@nex-ui/react
Version:
🎉 A beautiful, modern, and reliable React component library.
33 lines (29 loc) • 1.03 kB
JavaScript
"use client";
;
var jsxRuntime = require('react/jsx-runtime');
var hooks = require('@nex-ui/hooks');
var ModalContext = require('./ModalContext.cjs');
const Modal = (props)=>{
const { children, container, onOpenChange, open: openProp, restoreFocus = true, closeOnEscape = true, preventScroll = false, defaultOpen = false, keepMounted = false, closeOnInteractOutside = true } = props;
const [open, setOpen] = hooks.useControlledState(openProp, defaultOpen, onOpenChange);
const rootProps = {
setOpen,
restoreFocus,
closeOnEscape,
open,
keepMounted,
defaultOpen,
closeOnInteractOutside,
onOpenChange,
preventScroll,
container,
'aria-labelledby': props['aria-labelledby'],
'aria-describedby': props['aria-describedby']
};
return /*#__PURE__*/ jsxRuntime.jsx(ModalContext.ModalProvider, {
value: rootProps,
children: children
});
};
Modal.displayName = 'Modal';
exports.Modal = Modal;