import type { ReactNode } from 'react'; import React from 'react'; type DialogProps = { /** * The question or message the dialog asks the user to respond to. Accepts formatted content, * such as text with emphasis or a short list. */ children: ReactNode; /** * Additional classnames passed in for styling. * * This is applied to the dialog's surface, not the overlay behind it. */ className?: string; /** * Label for the secondary button, which cancels. * * **Default is `"Cancel"`**. */ cancelLabel?: string; /** * Label for the primary button, which runs the default action. Name the action, for example * `"Discard changes"` or `"Delete file"`, rather than `"OK"` or `"Yes"`. */ confirmLabel: string; /** * Called when the user cancels: the secondary button, the ESC key, or a click on the overlay. * Use this to hide the dialog. */ onCancel: () => void; /** * Called when the user takes the default action: the primary button, or the Enter key while * focus isn't on another button or a link. Use this to act and hide the dialog. */ onConfirm: () => void; /** * Whether the dialog is visible. */ open: boolean; /** * Short title for the dialog, which also names it for screen readers. Use a verb-noun question * or statement, for example `"Discard your changes?"`. */ title: string; /** * Status (color) of the primary button. Use `"critical"` when the default action destroys * something or can't be undone. * * **Default is `"default"`**. */ confirmVariant?: 'default' | 'critical'; }; /** * BETA: This component is still a work in progress and is subject to change. * * `import {Dialog} from "@chanzuckerberg/eds";` * * A small, focused prompt that asks the user to confirm or cancel an action. Use it in place of * the browser's `window.confirm()`, which can't be styled or given formatted content. * * ## Usage * * * Ask one question with one default action. For anything with more content or more choices, * use `Modal`. * * The primary button runs the default action and receives focus when the dialog opens, so * Enter confirms. The secondary button cancels, as do ESC and a click on the overlay. * * Set `confirmVariant="critical"` when the action is destructive. * * ### Confirming before a `Modal` closes * * `Modal`'s `warnOnClose` uses `window.confirm()`. To ask with a `Dialog` instead, leave * `warnOnClose` off and decide in the modal's `onClose`: close straight away when nothing would * be lost, otherwise open the `Dialog`. Render the `Dialog` inside `Modal.Body` so it stacks * above the modal. * * ## Content & Accessibility * * * Use a verb-noun question for the title, and a primary label that names the action. * * Keep the body to a sentence or two that says what happens next. * * The dialog is announced as an `alertdialog`, named by its title and described by its body. */ export declare const Dialog: { ({ cancelLabel, children, className, confirmLabel, confirmVariant, onCancel, onConfirm, open, title, }: DialogProps): React.JSX.Element; displayName: string; }; export {};