@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
JavaScript
import React__default, { useRef } from 'react';
import { createPortal } from 'react-dom';
import '../hooks/useModal.js';
import { u as useSendbird } from '../chunks/bundle-i_3w58Zd.js';
import { a as MODAL_ROOT } from '../chunks/bundle-CtQtfJlT.js';
import '../chunks/bundle-yl5d1NoZ.js';
import '../chunks/bundle-DEuCwnTn.js';
import '../chunks/bundle-MlG9piGf.js';
import '../chunks/bundle-Del33VzI.js';
import '../chunks/bundle-C1dqPUnT.js';
import '../chunks/bundle-BZGITC2g.js';
import '../chunks/bundle-DBhJIxHw.js';
import './IconButton.js';
import './Button.js';
import '../chunks/bundle-viBng0Kh.js';
import './Icon.js';
import '../chunks/bundle-DGh2T5IL.js';
import '../chunks/bundle-BUYU9H94.js';
import '../chunks/bundle-CqLLOVG5.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