import React__default, { useRef } from 'react';
import { createPortal } from 'react-dom';
import '../hooks/useModal.js';
import { a as MODAL_ROOT } from '../chunks/bundle-22Jw6ztq.js';
import '../chunks/bundle-KIf79auh.js';
import '../chunks/bundle-0QDb7-Y_.js';
import '../chunks/bundle-DHw1C5gJ.js';
import '../chunks/bundle-wpc1Fted.js';
import '../chunks/bundle-XDy3Cf54.js';
import '../chunks/bundle-wWnN6K3w.js';
import '../chunks/bundle-Y3ZVN9yF.js';
import './IconButton.js';
import './Button.js';
import '../chunks/bundle-9c5vLDe9.js';
import './Icon.js';

var BottomSheet = function (props) {
    var _a = props.className, className = _a === void 0 ? '' : _a, children = props.children, onBackdropClick = props.onBackdropClick;
    // 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);
    }
    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: "\n          sendbird-bottomsheet__backdrop\n        ", onClick: function (e) {
                e === null || e === void 0 ? void 0 : e.stopPropagation();
                onBackdropClick();
            } })), portalRoot.current);
};

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