'use strict';

var React = require('react');
var reactDom = require('react-dom');
require('../hooks/useModal.js');
var useSendbird = require('../chunks/bundle-LI9JjqG2.js');
var ui_Modal = require('../chunks/bundle-YeW89zsR.js');
require('../chunks/bundle-CxoFSSXv.js');
require('../chunks/bundle-Dn0hi6OJ.js');
require('../chunks/bundle-DQNu-S6D.js');
require('../chunks/bundle-DDNdw3A9.js');
require('../chunks/bundle-EhtiN7UV.js');
require('../chunks/bundle-BV7y6VDn.js');
require('../chunks/bundle-CyQD5TkW.js');
require('./IconButton.js');
require('./Button.js');
require('../chunks/bundle-B0UICprZ.js');
require('./Icon.js');
require('../chunks/bundle-BUGwK1WK.js');
require('../chunks/bundle-AAO7jUU2.js');
require('../chunks/bundle-yU9Mr2pS.js');
require('@sendbird/chat');
require('@sendbird/chat/groupChannel');
require('@sendbird/chat/openChannel');

function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefaultCompat(React);

var BottomSheet = function (props) {
    var _a;
    var _b = props.className, className = _b === void 0 ? '' : _b, children = props.children, onBackdropClick = props.onBackdropClick;
    var logger = useSendbird.useSendbird().state.config.logger;
    // https://github.com/testing-library/react-testing-library/issues/62#issuecomment-438653348
    var portalRoot = React.useRef();
    portalRoot.current = document.getElementById(ui_Modal.MODAL_ROOT);
    if (!portalRoot.current) {
        portalRoot.current = document.createElement('div');
        portalRoot.current.setAttribute('id', ui_Modal.MODAL_ROOT);
        document.body.appendChild(portalRoot.current);
        (_a = logger === null || logger === void 0 ? void 0 : logger.warning) === null || _a === void 0 ? void 0 : _a.call(logger, '@sendbird/uikit-react/ui/BottomSheet | Should put a ModalRoot to use the BottomSheet.');
    }
    return reactDom.createPortal(React__default.default.createElement("div", { className: "".concat(className, " sendbird-bottomsheet") },
        React__default.default.createElement("div", { className: "sendbird-bottomsheet__content", role: 'dialog', "aria-modal": 'true', "aria-expanded": 'true' }, children),
        React__default.default.createElement("div", { className: "sendbird-bottomsheet__backdrop", onClick: function (e) {
                e === null || e === void 0 ? void 0 : e.stopPropagation();
                onBackdropClick === null || onBackdropClick === void 0 ? void 0 : onBackdropClick();
            } })), portalRoot.current);
};

module.exports = BottomSheet;
//# sourceMappingURL=BottomSheet.js.map
