import type { ReactNode } from "react"; import React from "react"; interface DisplayAction { type: "display"; title?: string; message: string; confirmLabel: string; cancelLabel?: string; onConfirm(): void; onCancel?(): void; } export interface ConfirmationModalRef { show(props: Omit): void; } interface BaseConfirmationModalProps { /** * Title for the modal. */ readonly title?: string; /** * Text or rich text content for the body of the modal. * Not displayed if **children** prop is passed. */ readonly message?: string; /** * Controls if the modal is open or not. */ readonly open?: boolean; /** * Label for the confirm button. */ readonly confirmLabel?: string; /** * Label for the cancel button. */ readonly cancelLabel?: string; /** * Type (Work or destructive) for confirm button. */ readonly variation?: "work" | "destructive"; /** * Size of the modal (small, large), */ readonly size?: "small" | "large"; /** * Child component. Not displayed if **message** prop is passed. */ readonly children?: ReactNode; /** * Callback for when the confirm button is pressed. */ onConfirm?(): void; /** * Callback for when the cancel button is pressed. */ onCancel?(): void; /** * Callback for whenever a user's action should close the modal. */ onRequestClose?(): void; } export interface SimpleConfirmationModalProps extends BaseConfirmationModalProps { readonly open: boolean; readonly confirmLabel: string; } export interface ComplexConfirmationModalProps extends BaseConfirmationModalProps { readonly open?: undefined; } export interface ChildrenMessage extends BaseConfirmationModalProps { message?: never; children: ReactNode; } export interface StringMessage extends BaseConfirmationModalProps { message: string; children?: never; } type ConfirmationModalProps = (SimpleConfirmationModalProps & (StringMessage | ChildrenMessage)) | (ComplexConfirmationModalProps & (StringMessage | ChildrenMessage)); export declare const ConfirmationModal: React.ForwardRefExoticComponent>; export {};