'use strict';

var React = require('react');
var reactDom = require('react-dom');
var index = require('../index-8029e07a.js');

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

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

const BottomSheet = props => {
  const {
    className = '',
    children,
    onBackdropClick
  } = props;

  // https://github.com/testing-library/react-testing-library/issues/62#issuecomment-438653348
  const portalRoot = React.useRef();
  portalRoot.current = document.getElementById(index.MODAL_ROOT);
  if (!portalRoot.current) {
    portalRoot.current = document.createElement('div');
    portalRoot.current.setAttribute('id', index.MODAL_ROOT);
    document.body.appendChild(portalRoot.current);
  }
  return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement("div", {
    className: `${className} sendbird-bottomsheet`
  }, /*#__PURE__*/React__default["default"].createElement("div", {
    className: 'sendbird-bottomsheet__content',
    role: "dialog",
    "aria-modal": "true",
    "aria-expanded": "true"
  }, children), /*#__PURE__*/React__default["default"].createElement("div", {
    className: `
          sendbird-bottomsheet__backdrop
        `,
    onClick: e => {
      e === null || e === void 0 ? void 0 : e.stopPropagation();
      onBackdropClick();
    }
  })), portalRoot.current);
};

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