import React from 'react';
import { useDisclosure, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@chakra-ui/react';
import TranslationProvider from '../../translationProvider/index.js';
import { FilterHeading } from '../Heading.js';
import FilterActionButton from '../ActionButton.js';
import { OpenFilterButton } from './OpenFilterButton.js';

var ModalFilter = function (_a) {
    var actionButton = _a.actionButton, displayValue = _a.displayValue, _b = _a.initialModalState, initialModalState = _b === void 0 ? 'closed' : _b, Icon = _a.Icon, isApplied = _a.isApplied, label = _a.label, language = _a.language, numberOfAppliedFilters = _a.numberOfAppliedFilters, onModalClose = _a.onModalClose, onModalOpen = _a.onModalOpen, onResetFilter = _a.onResetFilter, _c = _a.showCallToActionButton, showCallToActionButton = _c === void 0 ? true : _c, header = _a.header, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, children = _a.children, paddingX = _a.paddingX, backgroundColor = _a.backgroundColor, _e = _a.trapFocus, trapFocus = _e === void 0 ? true : _e;
    var _f = useDisclosure({
        defaultIsOpen: initialModalState === 'open',
        onOpen: onModalOpen,
        onClose: onModalClose,
    }), onOpen = _f.onOpen, onClose = _f.onClose, isOpen = _f.isOpen;
    return (React.createElement(TranslationProvider, { language: language, scopes: ['filterSelectButton'] },
        React.createElement(React.Fragment, null,
            React.createElement(OpenFilterButton, { displayValue: displayValue, Icon: Icon, isApplied: isApplied, label: label, onClick: onOpen, isDisabled: isDisabled, paddingX: paddingX, backgroundColor: backgroundColor }),
            React.createElement(Modal, { key: "modal-filter-".concat(label, "-").concat(isOpen ? 'open' : 'closed'), isOpen: isOpen, onClose: onClose, size: "full", motionPreset: "slideInBottom", trapFocus: trapFocus },
                React.createElement(ModalContent, { h: "full", w: "full", paddingY: "2xl", paddingX: "0" },
                    React.createElement(ModalHeader, { display: "flex", flexDirection: "column", alignItems: "flex-start", paddingY: "0", paddingX: "2xl" }, header ? (header) : (React.createElement(FilterHeading, { language: language, Icon: Icon, isApplied: isApplied, label: label, numberOfAppliedFilters: numberOfAppliedFilters, onClose: onClose, onResetFilter: function () { return onResetFilter('filter'); } }))),
                    React.createElement(ModalBody, { overflowY: "auto", marginTop: "2xl", marginBottom: showCallToActionButton ? '2xl' : '0', paddingY: "0", paddingX: "2xl" }, children),
                    showCallToActionButton ? (React.createElement(ModalFooter, { paddingY: "0", paddingX: "2xl" },
                        React.createElement(FilterActionButton, { actionButton: actionButton, isApplied: isApplied, onClose: onClose }))) : null)))));
};

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