import { type ComponentProps, type ComponentPropsWithoutRef, type DialogHTMLAttributes, type FC } from "react"; import { Card } from "../Card/Card"; import { Box } from "../Box/Box"; import { Stack } from "../Stack/Stack"; import { TertiaryButton } from "../ButtonV2/TertiaryButton"; type Size = "s" | "m" | "l" | "xl"; type Props = Omit, "open" | "onClose"> & { /** * Triggers `showModal` or `close` on the internal `` element when set. * * Note: the user is able to close the modal outside of this props control. This means a two-way binding with the modal needs to be establised. * * This should be done by implementing the ModalDialog's onClose prop so it updates the `open` prop accordingly. * * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#creating_a_modal_dialog */ open: boolean; /** * Called when the internal dialog's `onClose` event is triggered. * * This callback is mandatory as the implementer should always take into account a `` can be closed by the user. * * This callback should be used to update any application state (open) accordingly. */ onClose: DialogHTMLAttributes["onClose"]; /** * Determines the max-width of the modal. */ size?: Size; /** * Determines the presentation of the modal * * - `"centered-dialog"` * Presents a dialog centered on screen. * * - `"side-modal"` * Presents a dialog on the right side of the screen stretching the full height of the viewport. * * - "full-screen" * Presents a dialog stretching the full height and width of the viewport. * * @default "centered-dialog" */ variant?: "centered-dialog" | "side-modal" | "full-screen"; /** * Controls whether the ModalDialog keeps its children mounted in the DOM when closed. * * This can be useful for preserving component state or preventing unnecessary re-renders. * * @default false */ keepChildrenMountedWhenClosed?: boolean; /** * A callback which is triggered when the closing transition has finished. * * This can be useful for removing the ModalDialog from the DOM after the close animation has completed. */ onCloseAnimationFinished?: () => void; }; type SubComponents = { /** * Represents the header of the ModalDialog. Applies consistent padding. */ Header: typeof Header; /** * Default title presentation of the ModalDialog. * * To be placed inside of the ModalDialog's header. */ Title: typeof Card.Title; /** * A control representing the close button of the Dialog using a cross icon. * * To be placed inside of the ModalDialog's header. */ CloseButton: typeof CloseButton; /** * Applies consistent padding and manages the scroll overflow of the ModalDialog's content, * ensuring the Modal does not overflow the users' viewport vertically. * * To be placed inside of the ModalDialog's header. */ Body: typeof Body; /** * Represents the footer of the ModalDialog. * Applies consistent padding and a background color of type "background". */ Footer: typeof Footer; /** * Groups together the primary actions of the Modal. * These actions should be placed in the Footer of the Modal. * * To be placed inside of the ModalDialog's footer. */ Actions: typeof Actions; /** * A hook to obtain a reference to the dialog's `` HTML element. * * This is useful for obtaining a DOMNode for portals or to close the dialog `$dialog?.close()`. */ useModalDialog: () => { $dialog: HTMLDialogElement | null; }; }; export declare const ModalDialog: FC & SubComponents; export declare const Body: FC>; export declare const Header: FC>; export declare const Footer: FC>; export declare const CloseButton: FC>; export declare const Actions: FC>; export {};