import { Dialog as DialogPrimitive } from "radix-ui"; import { type ReactNode } from "react"; import { type ButtonProps } from "../Button"; import { type IconName } from "../Icon"; import { type TextProps } from "../Text"; export interface Custom { width: number | string; height: number | string; } export type DialogProps = { modal?: boolean; trigger?: ReactNode; children?: ReactNode; renderTooltip?: (trigger: ReactNode) => ReactNode; open?: boolean; onOpenChange?: (open: boolean) => void; onAnimationEnd?: () => void; onAnimationStart?: () => void; size?: "small" | "large" | "fullscreen" | Custom; /** * The position of the dialog in the viewport. * @default "top" - The dialog is positioned at the center, top of the viewport. This covers most cases. * "center" - The dialog is centered in the viewport. Useful for large, almost fullscreen dialogs. */ position?: "center" | "bottomRight" | "top"; onPointerDownOutside?: DialogPrimitive.DialogContentProps["onPointerDownOutside"]; onOpenAutoFocus?: DialogPrimitive.DialogContentProps["onOpenAutoFocus"]; /** * Pass this prop if the modal has no static text that describes it, i.e. if it's a form or a table. * Passing true will disable the warning that the dialog has no description. * If the dialog has some meaningful text description, wrap this text in a DialogDescription component and do not pass this prop. * Sources: * - https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/dialog/ * - https://www.radix-ui.com/primitives/docs/components/dialog#description */ noDescription?: true; } & CloseButtonProps; type CloseButtonProps = { hasClose?: true; closeButtonDisabled?: boolean; } | { hasClose?: false; closeButtonDisabled?: never; }; /** * A Dialog rendered in document.body. * The first focusable child will automatically be focused. */ export declare function Dialog(props: DialogProps): JSX.Element; interface DialogHeaderProps { icon?: IconName; onIconClick?: () => void; /** * If true, the Icon will have the same padding as the IconButton. * This is useful when transitioning between headers with Icon and IconButton, * to make sure there's no horizontal shift in the header. */ iconButtonPadding?: boolean; title: string; } export declare function DialogHeader(props: DialogHeaderProps): JSX.Element; interface DialogTitleProps { children: ReactNode; /** * If true, will hide the title visually but keep it accessible for screen readers. * @default false */ hidden?: boolean; asChild?: boolean; } /** * DialogTitle is supposed to be placed inside of our Dialog. * It is required to have either this component or DialogHeader inside of each Dialog, * at least for screen readers only (see `hidden` prop). */ export declare function DialogTitle(props: DialogTitleProps): JSX.Element; interface DialogDescriptionProps { children: ReactNode; /** * If true, will hide the description visually but keep it accessible for screen readers. * @default false */ hidden?: boolean; asChild?: boolean; } /** * DialogDescription is supposed to be placed inside of our Dialog. * It is required to use this component if the modal has some static text * or pass `noDescription` flag to our Dialog if there's no proper description * inside of a dialog, i.e. when it's a form or contains only a table. * You can also pass `hidden` prop to hide the description visually. */ export declare function DialogDescription(props: DialogDescriptionProps): JSX.Element; interface DialogContentProps { children: ReactNode; padding?: 16; paddingInline?: 8; gap?: 0 | 12 | 16; } export declare function DialogContent(props: DialogContentProps): JSX.Element; export declare function DialogActions(props: { children: ReactNode; }): JSX.Element; interface DialogActionButtonProps extends ButtonProps { tooltipLabel?: string; } export declare function DialogActionButton(props: DialogActionButtonProps): JSX.Element; export declare function DialogActionLink(props: TextProps): JSX.Element; export declare function DialogCancelButton(props: ButtonProps): JSX.Element; export {};