UNPKG

@nex-ui/react

Version:

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

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