import { type ReactNode, type RefObject } from "react"; export type DestructiveConfirmVariant = "consequences" | "type-to-confirm" | "blocked"; export type DependencyKind = "schedule" | "chat" | "environment" | "workspace" | "variable-set" | "api-key" | "person"; export interface ConfirmDependency { id: string; kind: DependencyKind; /** "Schedule", "Chat", "Sandbox environment default". */ kindLabel: string; name: string; /** One quiet fact, for example "Every weekday at 08:00 · Oslo". */ detail?: string | undefined; /** Where to fix it. Rendered as a link. */ href?: string | undefined; } export interface DestructiveConfirmContentProps { variant?: DestructiveConfirmVariant | undefined; /** Names the real object: "Delete AWS production?" or, when blocked, "AWS production is in use". */ title: ReactNode; /** One optional sentence under the title. */ description?: ReactNode | undefined; /** 2-4 short bullets of what happens. End with "This can't be undone." when true. */ consequences?: ReactNode[] | undefined; /** What depends on the object, with links. Required for "blocked". */ dependencies?: ConfirmDependency[] | undefined; /** Heading over the dependencies. Default "Used by". */ dependenciesTitle?: ReactNode | undefined; /** * Opens a dependency's page in the app (the router). Without it a plain * click on a dependency link is a full page load. */ onOpenDependency?: ((dependency: ConfirmDependency & { href: string; }) => void) | undefined; /** The exact name to type ("type-to-confirm"). */ confirmText?: string | undefined; /** Neutral placeholder for the typed name; never the name itself. */ confirmPlaceholder?: string | undefined; /** Verb + object: "Delete variable set". */ confirmLabel?: string | undefined; /** "Deleting…". */ pendingLabel?: string | undefined; /** The only button when blocked. Default "Close". */ closeLabel?: string | undefined; /** May be async. Throw (with a user-facing message) to show the error inside. */ onConfirm?: (() => void | boolean | Promise) | undefined; /** A server error, shown inside the dialog. */ error?: ReactNode | undefined; /** Controlled typed text. */ typedValue?: string | undefined; /** Initial typed text, for previews. The dialog always starts empty. */ defaultTypedValue?: string | undefined; onTypedValueChange?: ((value: string) => void) | undefined; /** Controlled submitting state, for previews. */ pending?: boolean | undefined; } /** True when the typed name matches exactly, ignoring surrounding spaces. */ export declare function confirmTextMatches(typed: string, expected: string): boolean; /** The destructive confirm in a modal. Focus starts on Cancel unless a name must be typed. */ export declare function DestructiveConfirm({ open, onOpenChange, trigger, restoreFocusRef, restoreFocusFallbackRef, ...content }: DestructiveConfirmContentProps & { open: boolean; onOpenChange: (open: boolean) => void; trigger?: ReactNode | undefined; /** Where focus goes after closing when the trigger is gone (a deleted row). */ restoreFocusRef?: RefObject | undefined; restoreFocusFallbackRef?: RefObject | undefined; }): import("react").JSX.Element; /** * The same content as a static panel, for previews and documentation. It is * exactly what the modal renders, without the overlay. */ export declare function DestructiveConfirmPanel({ onClose, className, ...content }: DestructiveConfirmContentProps & { onClose?: (() => void) | undefined; className?: string | undefined; }): import("react").JSX.Element; export declare function UndoToast({ title, description, undoLabel, onUndo, onDismiss, icon, className, }: { /** What just happened, past tense: "Archived 14 Sep checkout outage". */ title: ReactNode; description?: ReactNode | undefined; undoLabel?: string | undefined; onUndo: () => void; onDismiss?: (() => void) | undefined; icon?: ReactNode | undefined; className?: string | undefined; }): import("react").JSX.Element; /** * Runs nothing itself: call it right after a reversible action. Undo calls * `onUndo` and closes the toast. Stays 8 seconds, longer than a normal toast. */ export declare function showUndoToast({ title, description, undoLabel, onUndo, icon, duration, }: { title: ReactNode; description?: ReactNode | undefined; undoLabel?: string | undefined; onUndo: () => void; icon?: ReactNode | undefined; duration?: number | undefined; }): string | number;