import React from "react";
import { Skeleton, message } from "antd";
import { isFunction, locales } from "@pisell/utils";
import PlusCircle from "@pisell/icon/es/PlusCircle";
import classNames from "classnames";
import ChevronRight from "@pisell/icon/es/ChevronRight";
import "./index.less";
//#region src/components/booking/components/addButton/index.tsx
/**
* @title: 添加按钮,  两种状态切换
* @description:
* @return {*}
* @Author: zhiwei.Wang
* @Date: 2024-01-30 16:42
*/
const AddButton = ({ onClick, showSub, title, subTitle, style, disabled, loading, showDisabledMessage = true }) => {
	const _onClick = () => {
		if (disabled) {
			if (showDisabledMessage) message.warning(locales.getText("pisell2.text.please-select-the-customer-first"));
		} else onClick === null || onClick === void 0 || onClick();
	};
	if (loading) return /* @__PURE__ */ React.createElement(Skeleton, {
		style: { marginTop: 16 },
		loading: true,
		round: true,
		active: true
	});
	return /* @__PURE__ */ React.createElement(React.Fragment, null, showSub ? /* @__PURE__ */ React.createElement("div", {
		className: "pisell-lowcode__booking-add-button-add-row",
		onClick: _onClick,
		style: isFunction(style) ? style(showSub) : style
	}, /* @__PURE__ */ React.createElement(PlusCircle, { className: "pisell-lowcode__booking-add-button-add-row-icon" }), /* @__PURE__ */ React.createElement("span", { className: "pisell-lowcode__booking-add-button-add-row-txt" }, subTitle)) : /* @__PURE__ */ React.createElement("div", {
		className: classNames("pisell-lowcode__booking-add-button-add", { "pisell-lowcode__booking-add-button-add-disabled": disabled }),
		onClick: _onClick,
		style: isFunction(style) ? style(showSub) : style
	}, /* @__PURE__ */ React.createElement("span", { className: "pisell-lowcode__booking-add-button-add-label" }, title), /* @__PURE__ */ React.createElement(ChevronRight, { className: "pisell-lowcode__booking-add-button-add-icon" })));
};
//#endregion
export { AddButton as default };
