import { DOMMotionComponents } from 'motion/react'; import { ElementType, ReactNode } from 'react'; import { Interpolation } from '@nex-ui/system'; import { ClassValue } from 'clsx'; import { ModalProps } from '../modal/types.js'; import { DrawerContentVariants } from '../../theme/recipes/drawer.js'; import { OverrideProps, ComponentSlotClasses, HTMLMotionProps, ComponentPropsWithCommonProps } from '../../types/utils.js'; type DrawerSlotProps = { backdrop?: ComponentPropsWithCommonProps<'div'>; }; type DrawerOwnProps = { /** * The component or element to render as the root. * * @default 'div' */ as?: RootComponent; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Interpolation; /** * The content of the drawer. It's usually the `DrawerContent` component. */ children?: ReactNode; /** * Additional class names to apply to the root. */ className?: ClassValue; /** * If true, the backdrop is not rendered. * @default false */ hideBackdrop?: boolean; /** * The props used for each slot. */ slotProps?: DrawerSlotProps; /** * The className used for each slot. */ classNames?: ComponentSlotClasses; /** * If true, closes the drawer when the backdrop is clicked. * @default true */ closeOnInteractBackdrop?: boolean; } & Omit; interface DrawerPropsOverrides { } type DrawerProps = OverrideProps, DrawerPropsOverrides>; type DrawerContentSlotProps = { closeButton?: ComponentPropsWithCommonProps<'button'>; paper?: ComponentPropsWithCommonProps; }; interface DrawerContentPropsOverrides { } type DrawerContentOwnProps = { /** * The component or element to render as the root. * @default 'div' */ as?: RootComponent; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Interpolation; /** * Additional class names to apply to the root. */ className?: ClassValue; /** * The className used for each slot. */ classNames?: ComponentSlotClasses<'paper' | 'closeButton'>; /** * It's usually the DrawerHeader、DrawerBody andd DrawerFooter component. */ children?: ReactNode; /** * The props used for each slot. */ slotProps?: DrawerContentSlotProps; /** * Custom close button to display on top right corner. */ closeIcon?: ReactNode; /** * If true, the close button is not rendered. * @default false */ hideCloseButton?: boolean; /** * The size of the drawer. * @default 'md' */ size?: DrawerContentVariants['size']; /** * The placement of the drawer. * @default 'right' */ placement?: DrawerContentVariants['placement']; /** * The props to modify the framer motion animation. * Use the `variants` API to create your own animation. */ motionProps?: HTMLMotionProps<'div'> | ((placement: DrawerContentVariants['placement']) => HTMLMotionProps<'div'>); /** * The id(s) of the element(s) that label the drawer. */ 'aria-labelledby'?: string; /** * The id(s) of the element(s) that describe the drawer. */ 'aria-describedby'?: string; }; type DrawerContentProps = OverrideProps, DrawerContentPropsOverrides>; interface DrawerHeaderPropsOverrides { } type DrawerHeaderOwnProps = { /** * The component or element to render as the root. * @default 'h2' */ as?: RootComponent; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Interpolation; /** * The content of the drawer header. */ children?: ReactNode; /** * Additional class names to apply to the root. */ className?: ClassValue; }; type DrawerHeaderProps = OverrideProps, DrawerHeaderPropsOverrides>; interface DrawerBodyPropsOverrides { } type DrawerBodyOwnProps = { /** * The component or element to render as the root. * @default 'div' */ as?: RootComponent; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Interpolation; /** * The content of the drawer body. */ children?: ReactNode; /** * Additional class names to apply to the root. */ className?: ClassValue; }; type DrawerBodyProps = OverrideProps, DrawerBodyPropsOverrides>; interface DrawerFooterPropsOverrides { } type DrawerFooterOwnProps = { /** * The component or element to render as the root. * @default 'div' */ as?: RootComponent; /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Interpolation; /** * The content of the drawer footer. */ children?: ReactNode; /** * Additional class names to apply to the root. */ className?: ClassValue; }; type DrawerFooterProps = OverrideProps, DrawerFooterPropsOverrides>; export type { DrawerBodyProps, DrawerBodyPropsOverrides, DrawerContentProps, DrawerContentPropsOverrides, DrawerFooterProps, DrawerFooterPropsOverrides, DrawerHeaderProps, DrawerHeaderPropsOverrides, DrawerProps, DrawerPropsOverrides };