import React from 'react';
import { I18nContext } from '@smg-automotive/i18n-pkg';
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, appliedLabel = _a.appliedLabel, 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, _d = _a.showResetButton, showResetButton = _d === void 0 ? true : _d, header = _a.header, _e = _a.isDisabled, isDisabled = _e === void 0 ? false : _e, children = _a.children, paddingX = _a.paddingX, backgroundColor = _a.backgroundColor, color = _a.color, _f = _a.trapFocus, trapFocus = _f === void 0 ? true : _f, triggerHeight = _a.triggerHeight, triggerDisplayType = _a.triggerDisplayType;
    var _g = useDisclosure({
        defaultIsOpen: initialModalState === 'open',
        onOpen: onModalOpen,
        onClose: onModalClose,
    }), onOpen = _g.onOpen, onClose = _g.onClose, isOpen = _g.isOpen;
    return (React.createElement(TranslationProvider, { language: language, scopes: ['filterSelectButton'] },
        React.createElement(I18nContext.Consumer, null, function (_a) {
            var t = _a.t;
            return (React.createElement(React.Fragment, null,
                React.createElement(OpenFilterButton, { displayValue: displayValue, Icon: Icon, isApplied: isApplied, label: label, onClick: onOpen, isDisabled: isDisabled, paddingX: paddingX, backgroundColor: backgroundColor, color: color, height: triggerHeight, showResetButton: showResetButton, displayType: triggerDisplayType, appliedLabel: appliedLabel, resetButtonAriaLabel: t('filterSelectButton.resetButtonAriaLabel', { label: label }), onResetFilter: function () { return onResetFilter('filterButton'); } }),
                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
