UNPKG

@nex-ui/react

Version:

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

43 lines (40 loc) • 1.05 kB
"use client"; import { jsx } from 'react/jsx-runtime'; import { useMemo } from 'react'; import { defineRecipe } from '@nex-ui/system'; import { useModal } from './ModalContext.mjs'; import { useSlot } from '../utils/useSlot.mjs'; const recipe = defineRecipe({ base: { w: 'full', m: 0, boxSizing: 'border-box' } }); const useAriaProps = (props)=>{ const { modalHeaderId } = useModal(); const labelId = props.id ?? modalHeaderId; return useMemo(()=>{ return { id: labelId }; }, [ labelId ]); }; const style = recipe(); const ModalHeader = (inProps)=>{ const props = inProps; const ariaProps = useAriaProps(props); const [ModalHeaderRoot, getModalHeaderRootProps] = useSlot({ style, a11y: ariaProps, externalForwardedProps: props, elementType: 'h2' }); return /*#__PURE__*/ jsx(ModalHeaderRoot, { ...getModalHeaderRootProps() }); }; ModalHeader.displayName = 'ModalHeader'; export { ModalHeader };