UNPKG

@nex-ui/react

Version:

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

36 lines (33 loc) • 917 B
"use client"; import { jsx } from 'react/jsx-runtime'; import { nex } from '@nex-ui/styled'; import { useMemo } from 'react'; import { useModal } from './ModalContext.mjs'; import { modalBodyRecipe } from '../../theme/recipes/modal.mjs'; import { useSlotProps } from '../utils/useSlotProps.mjs'; const style = modalBodyRecipe(); const useAriaProps = (props)=>{ const modal = useModal(); const bodyId = props.id ?? modal['aria-describedby']; return useMemo(()=>{ return { id: bodyId }; }, [ bodyId ]); }; const ModalBody = (inProps)=>{ const props = inProps; const ariaProps = useAriaProps(props); const rootProps = useSlotProps({ style, a11y: ariaProps, externalForwardedProps: props }); return /*#__PURE__*/ jsx(nex.div, { ...rootProps }); }; ModalBody.displayName = 'ModalBody'; export { ModalBody };