UNPKG

@nex-ui/react

Version:

🎉 A beautiful, modern, and reliable React component library.

32 lines (29 loc) • 920 B
"use client"; import { jsx } from 'react/jsx-runtime'; import { nex } from '@nex-ui/styled'; import { useEvent } from '@nex-ui/hooks'; import { useModal } from './ModalContext.mjs'; import { modalPanelRecipe } from '../../theme/recipes/modal.mjs'; import { useSlotProps } from '../utils/useSlotProps.mjs'; const style = modalPanelRecipe(); const ModalPanel = (inProps)=>{ const { closeOnInteractOutside, setOpen } = useModal(); const props = inProps; const handleClick = useEvent((e)=>{ if (closeOnInteractOutside && e.target === e.currentTarget) { setOpen(false); } }); const rootProps = useSlotProps({ style, externalForwardedProps: props, additionalProps: { onClick: handleClick } }); return /*#__PURE__*/ jsx(nex.div, { ...rootProps }); }; ModalPanel.displayName = 'ModalPanel'; export { ModalPanel };