@nex-ui/react
Version:
🎉 A beautiful, modern, and reliable React component library.
44 lines (41 loc) • 1.07 kB
JavaScript
"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',
boxSizing: 'border-box',
height: '100%',
wordBreak: 'break-word'
}
});
const style = recipe();
const useAriaProps = (props)=>{
const { modalBodyId } = useModal();
const bodyId = props.id ?? modalBodyId;
return useMemo(()=>{
return {
id: bodyId
};
}, [
bodyId
]);
};
const ModalBody = (inProps)=>{
const props = inProps;
const ariaProps = useAriaProps(props);
const [ModalBodyRoot, getModalBodyRootProps] = useSlot({
style,
elementType: 'div',
a11y: ariaProps,
externalForwardedProps: props
});
return /*#__PURE__*/ jsx(ModalBodyRoot, {
...getModalBodyRootProps()
});
};
ModalBody.displayName = 'ModalBody';
export { ModalBody };