import React__default, { useRef } from 'react';
import { createPortal } from 'react-dom';
import '../hooks/useModal.js';
import { u as useSendbird } from '../chunks/bundle-I25ah_Bv.js';
import { a as MODAL_ROOT } from '../chunks/bundle-LnGQMQVt.js';
import '../chunks/bundle-B8Grfnrx.js';
import '../chunks/bundle-De-3zaYV.js';
import '../chunks/bundle-CDcu1I4f.js';
import '../chunks/bundle-l_QLKq1Y.js';
import '../chunks/bundle-Y2KBbxRr.js';
import '../chunks/bundle-BYOddwmS.js';
import '../chunks/bundle-yKqHFFfz.js';
import './IconButton.js';
import './Button.js';
import '../chunks/bundle-HspRRkmy.js';
import './Icon.js';
import '../chunks/bundle-CTkGIdt8.js';
import '../chunks/bundle-C4OmfIXk.js';
import '../chunks/bundle-Ob7Cw3V-.js';
import '@sendbird/chat';
import '@sendbird/chat/groupChannel';
import '@sendbird/chat/openChannel';

var BottomSheet = function (props) {
    var _a;
    var _b = props.className, className = _b === void 0 ? '' : _b, children = props.children, onBackdropClick = props.onBackdropClick;
    var logger = useSendbird().state.config.logger;
    // https://github.com/testing-library/react-testing-library/issues/62#issuecomment-438653348
    var portalRoot = useRef();
    portalRoot.current = document.getElementById(MODAL_ROOT);
    if (!portalRoot.current) {
        portalRoot.current = document.createElement('div');
        portalRoot.current.setAttribute('id', 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 createPortal(React__default.createElement("div", { className: "".concat(className, " sendbird-bottomsheet") },
        React__default.createElement("div", { className: "sendbird-bottomsheet__content", role: 'dialog', "aria-modal": 'true', "aria-expanded": 'true' }, children),
        React__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);
};

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