@nex-ui/react
Version:
🎉 A beautiful, modern, and reliable React component library.
31 lines (28 loc) • 992 B
JavaScript
"use client";
import { jsx } from 'react/jsx-runtime';
import { useControlledState } from '@nex-ui/hooks';
import { ModalProvider } from './ModalContext.mjs';
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] = 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__*/ jsx(ModalProvider, {
value: rootProps,
children: children
});
};
Modal.displayName = 'Modal';
export { Modal };