@nex-ui/react
Version:
🎉 A beautiful, modern, and reliable React component library.
58 lines (55 loc) • 1.75 kB
JavaScript
"use client";
import { jsx } from 'react/jsx-runtime';
import { useMemo } from 'react';
import { useDefaultProps } from '../utils/useDefaultProps.mjs';
import { useStyles } from '../utils/useStyles.mjs';
import { useSlot } from '../utils/useSlot.mjs';
import { ModalFooter } from '../modal/ModalFooter.mjs';
import { useNexUI } from '../provider/Context.mjs';
import { composeClasses } from '../utils/composeClasses.mjs';
import { dialogFooterRecipe } from '../../theme/recipes/dialog.mjs';
import { getUtilityClass } from '../utils/getUtilityClass.mjs';
const useSlotClasses = ()=>{
const { prefix } = useNexUI();
return useMemo(()=>{
const prefixClassName = `${prefix}-dialog-footer`;
const slots = {
root: [
'root'
]
};
return composeClasses(slots, getUtilityClass(prefixClassName));
}, [
prefix
]);
};
const DialogFooter = (inProps)=>{
const props = useDefaultProps({
name: 'DialogFooter',
props: inProps
});
const { children, ...remainingProps } = props;
const ownerState = {
...props
};
const classes = useSlotClasses();
const style = useStyles({
ownerState,
name: 'DialogFooter',
recipe: dialogFooterRecipe
});
const [DialogFooterRoot, getDialogFooterRootProps] = useSlot({
ownerState,
style,
elementType: ModalFooter,
classNames: classes.root,
externalForwardedProps: remainingProps,
shouldForwardComponent: false
});
return /*#__PURE__*/ jsx(DialogFooterRoot, {
...getDialogFooterRootProps(),
children: children
});
};
DialogFooter.displayName = 'DialogFooter';
export { DialogFooter };