import { UiCoreLocale } from '../../../helpers/uiCoreLocale'; /** The action that is running: its button is busy and the other buttons wait. */ export type UnsavedChangesPendingAction = 'save' | 'delete'; /** * The label of the save button. `leave` ("Save and leave") is the one label everywhere; `refresh` * ("Save and refresh") is the single exception, for refreshing a workspace questionnaire (ASMA-8895). */ export type UnsavedChangesSaveLabel = 'leave' | 'refresh'; export interface UnsavedChangesDialogProps { open: boolean; /** * Keep editing: the safe choice. Escape, a click outside and browser Back run it too. The app * closes the dialog and the user stays where they were; nothing is saved or deleted. */ onKeepEditing: () => void; /** * Delete changes: the app drops the changes and goes where the user asked to go. Return the * Promise when it is async: the button stays busy until it settles and nothing else can run. */ onDelete: () => void | Promise; /** * Shows the version with save ("Save changes?" and Save and leave). Leave it out for the default * version without save. UX approves every screen that keeps save (ASMA-8895): workspaces, the * questionnaire designer and document drafts. * * The app saves and leaves only when the save worked. On a failure it closes the dialog and moves * focus to the problem (a missing answer, the error), so the user is never moved on with unsaved * work. Return the Promise when it is async, for the same busy state as `onDelete`. */ onSave?: () => void | Promise; /** Label of the save button; defaults to "Save and leave". */ saveLabel?: UnsavedChangesSaveLabel; /** * An action the app runs outside the Promise it returned (a store flag, an event round trip). * Its button is busy and the others wait, as for a returned Promise. */ pendingAction?: UnsavedChangesPendingAction; /** Language of every text in the dialog; defaults to English. */ locale?: UiCoreLocale; dataTest?: string; } /** * Developer: alexandr.doicov@carasent.com * * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#47548-220018 * @remarks Figma "Unsaved changes" (`With save` on/off × `Mobile` on/off). The one unsaved-changes * dialog for every app (ASMA-8895). The version without save is the default; `onSave` adds Save and * leave. The Figma `Mobile` property is not a prop: the buttons stack, full width and in the desktop * order, only when they do not fit on one row. * * - Focus starts on Keep editing, so Enter never deletes. * - Escape, a click outside and browser Back (Back-closes-overlays, BACK-3) all mean Keep editing. * - While an action runs its button is busy and the others are soft-disabled with the reason (SUB-4, * SUB-8); nothing closes the dialog until it ends. */ export declare function UnsavedChangesDialog({ open, onKeepEditing, onDelete, onSave, saveLabel, pendingAction, locale, dataTest, }: UnsavedChangesDialogProps): JSX.Element;