"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MobileMainButton = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const ConfirmAction_1 = require("../../../../ConfirmAction");
const styles_1 = require("./styles");
const MobileMainButton = ({ action, isDisabled, onActionClick, }) => {
    const { mobileProps, name, icon, needConfirm, confirmText, confirmButtonProps, disabledReason, disabled, loading, isBlockingOperation, loadingNote, onClick, isMobilePrimary, ...actions } = action;
    const { text, color } = mobileProps ?? { text: name, color: 'primary' };
    const renderButton = (renderProps) => ((0, jsx_runtime_1.jsx)(styles_1.StyledButton, { disabled: isDisabled || disabled, loading: loading, color: color, ...actions, variant: "contained", ...renderProps, children: text }));
    return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: needConfirm ? ((0, jsx_runtime_1.jsx)(ConfirmAction_1.ConfirmAction, { text: confirmText, confirmButtonProps: confirmButtonProps, actionComponent: (renderProps) => renderButton(renderProps), onConfirm: onActionClick(onClick) })) : (renderButton({
            onClick: onActionClick(onClick),
        })) }));
};
exports.MobileMainButton = MobileMainButton;
