UNPKG

@sendbird/uikit-react

Version:

Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

47 lines (44 loc) 2.4 kB
import React__default, { useRef } from 'react'; import { createPortal } from 'react-dom'; import '../hooks/useModal.js'; import { u as useSendbird } from '../chunks/bundle-BnaoVUUl.js'; import { a as MODAL_ROOT } from '../chunks/bundle-BDItDVZl.js'; import '../chunks/bundle-DlZj_j5B.js'; import '../chunks/bundle-DZaN4z9l.js'; import '../chunks/bundle-CaW4IP0_.js'; import '../chunks/bundle-DxLnjDoJ.js'; import '../chunks/bundle-Dhutxl0X.js'; import '../chunks/bundle-D89Qj0P4.js'; import '../chunks/bundle-DWJPyrDa.js'; import './IconButton.js'; import './Button.js'; import '../chunks/bundle-FZ_FdxZT.js'; import './Icon.js'; import '../chunks/bundle-CSjCAZib.js'; import '../chunks/bundle-C1jTnXNH.js'; import '../chunks/bundle-C8kxBudB.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