UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

60 lines (59 loc) 1.49 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true, }); Object.defineProperty(exports, 'Modal', { enumerable: true, get: function () { return Modal; }, }); const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard'); const _react = /*#__PURE__*/ _interop_require_wildcard._(require('react')); const _Dialog = require('../Dialog/Dialog.js'); const Modal = _react.forwardRef((props, forwardedRef) => { let { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, portal = true, wrapperProps, backdropProps, titleBarProps, ...rest } = props; return _react.createElement( _Dialog.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef, portal: portal, ...wrapperProps, }, _react.createElement(_Dialog.Dialog.Backdrop, backdropProps), _react.createElement( _Dialog.Dialog.Main, { 'aria-modal': true, ...rest, }, _react.createElement(_Dialog.Dialog.TitleBar, { titleText: title, ...titleBarProps, }), children, ), ); }); if ('development' === process.env.NODE_ENV) Modal.displayName = 'Modal';