/** * Type definitions for the Dialog component. * * Provides all prop interfaces, slot types, context types, and configuration * for the animated dialog system built on Base UI and Motion. * * @module @mks2508/mks-ui/react/ui/Dialog/Dialog.types */ import type * as React from 'react'; import type { Dialog as DialogPrimitive } from '@base-ui/react/dialog'; import type { HTMLMotionProps } from 'motion/react'; import type { SlotOverrides, IBaseConfig } from '../../../core/types'; /** * Visual regions available for class-name overrides via the `slots` prop. * * @example * ```tsx * * * ``` */ export type DialogSlot = 'root' | 'backdrop' | 'viewport' | 'popup' | 'header' | 'footer' | 'title' | 'description' | 'close'; /** * Direction from which the dialog popup flips in during its entrance animation. * * @example * ```tsx * * ``` */ export type DialogFlipDirection = 'top' | 'bottom' | 'left' | 'right'; /** * Extended configuration for the Dialog component. * Inherits base animation settings and adds dialog-specific options. * * @example * ```typescript * const config: IDialogConfig = { * animation: { duration: 0.2, easing: 'ease-in-out' }, * }; * ``` */ export interface IDialogConfig extends IBaseConfig { } /** * Internal context type shared between Dialog sub-components. * Tracks open state so AnimatePresence can coordinate enter/exit animations. * * @example * ```tsx * const { isOpen, setIsOpen } = useDialog(); * ``` */ export type DialogContextType = { /** Whether the dialog is currently open. */ isOpen: boolean; /** Callback to change the open state. */ setIsOpen: IDialogProps['onOpenChange']; }; /** * Props for the root `Dialog` component. * Wraps Base UI Dialog.Root with controlled-state support and context provider. * * @example * ```tsx * * Open * * * Content * * * ``` */ export interface IDialogProps extends React.ComponentProps { /** Style slot overrides for the root wrapper. */ slots?: SlotOverrides; /** Component configuration. */ config?: IDialogConfig; } /** * Props for the `DialogTrigger` component. * Renders the element that opens the dialog on interaction. * * @example * ```tsx * * * * ``` */ export interface IDialogTriggerProps extends React.ComponentProps { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogPortal` component. * Renders children into a React portal with AnimatePresence for exit animations. * The `keepMounted` prop is handled internally and cannot be overridden. * * @example * ```tsx * * * ... * * ``` */ export interface IDialogPortalProps extends Omit, 'keepMounted'> { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogBackdrop` component. * Renders a motion-animated overlay behind the dialog popup. * Accepts all HTMLMotionProps for full animation control. * * @example * ```tsx * * ``` */ export interface IDialogBackdropProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogViewport` component. * Required wrapper around DialogPopup per Base UI v1.x. * Must be a direct child of DialogPortal. * * @example * ```tsx * * * * ... * * * ``` */ export interface IDialogViewportProps extends React.ComponentProps { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogPopup` component. * The main content container with perspective-flip entrance animation. * * @example * ```tsx * * Confirm * Are you sure? * * ``` */ export interface IDialogPopupProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** * Direction from which the popup flips in. * @defaultValue 'top' */ from?: DialogFlipDirection; /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogClose` component. * Renders a button that closes the dialog when clicked. * * @example * ```tsx * * * * ``` */ export interface IDialogCloseProps extends React.ComponentProps { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogHeader` layout component. * Renders a semantic header region inside the dialog popup. * * @example * ```tsx * * Settings * Adjust your preferences. * * ``` */ export interface IDialogHeaderProps extends React.ComponentProps<'div'> { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogFooter` layout component. * Renders a semantic footer region inside the dialog popup. * * @example * ```tsx * * * * * ``` */ export interface IDialogFooterProps extends React.ComponentProps<'div'> { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogTitle` component. * Renders the accessible title for the dialog. * * @example * ```tsx * Delete Item * ``` */ export interface IDialogTitleProps extends React.ComponentProps { /** Style slot overrides. */ slots?: SlotOverrides; } /** * Props for the `DialogDescription` component. * Renders the accessible description for the dialog. * * @example * ```tsx * This action cannot be undone. * ``` */ export interface IDialogDescriptionProps extends React.ComponentProps { /** Style slot overrides. */ slots?: SlotOverrides; } //# sourceMappingURL=Dialog.types.d.ts.map