import { __rest, __assign } from '../../node_modules/tslib/tslib.es6.js';
import React from 'react';
import { useMultiStyleConfig, Modal as Modal$1, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, Divider, ModalBody, ModalFooter } from '@chakra-ui/react';
import { H3 } from '../heading/index.js';
import Button from '../button/index.js';

var Modal = function (_a) {
    var title = _a.title, primaryActionButton = _a.primaryActionButton, secondaryActionButton = _a.secondaryActionButton, children = _a.children, size = _a.size, _b = _a.motionPreset, motionPreset = _b === void 0 ? 'scale' : _b, _c = _a.variant, variant = _c === void 0 ? 'base' : _c, _d = _a.disableBodyPadding, disableBodyPadding = _d === void 0 ? false : _d, _e = _a.overlayColor, overlayColor = _e === void 0 ? 'default' : _e, modalProps = __rest(_a, ["title", "primaryActionButton", "secondaryActionButton", "children", "size", "motionPreset", "variant", "disableBodyPadding", "overlayColor"]);
    var modalSize = size || variant !== 'fullScreen' ? { xs: 'full', sm: size } : 'full';
    var bothActionButtons = primaryActionButton && secondaryActionButton;
    var bodyPadding = disableBodyPadding ? { p: 0 } : {};
    var overlay = useMultiStyleConfig('Modal').overlay;
    if (overlayColor === 'gray') {
        overlay.bg = 'gray.100';
        overlay.opacity = '1 !important';
    }
    return (React.createElement(Modal$1, __assign({ isCentered: true, motionPreset: motionPreset, variant: variant, size: modalSize }, modalProps),
        React.createElement(ModalOverlay, { sx: overlay }),
        React.createElement(ModalContent, null,
            title && (React.createElement(React.Fragment, null,
                React.createElement(ModalHeader, null,
                    React.createElement(H3, null, title),
                    React.createElement(ModalCloseButton, { fontSize: "base" })),
                React.createElement(Divider, null))),
            React.createElement(ModalBody, __assign({}, bodyPadding), children),
            (primaryActionButton || secondaryActionButton) && (React.createElement(React.Fragment, null,
                React.createElement(Divider, null),
                React.createElement(ModalFooter, { display: "flex", justifyContent: bothActionButtons ? 'space-between' : 'flex-start', gap: bothActionButtons ? 'sm' : 0 },
                    secondaryActionButton ? (React.createElement(Button, { variant: "secondary", onClick: secondaryActionButton.action, width: { base: 'full', sm: 'fit-content' } }, secondaryActionButton.label)) : null,
                    primaryActionButton ? (React.createElement(Button, { variant: "primary", onClick: primaryActionButton.action, width: { base: 'full', sm: 'fit-content' } }, primaryActionButton.label)) : null))))));
};

export { Modal as default };
//# sourceMappingURL=index.js.map
