import * as React from 'react'; /** * The unified dirty-state contract for modals: a promise-based house confirm * (`useConfirm`), a close guard that asks before discarding unsaved edits * (`useGuardedClose`), and the standing "Unsaved changes" footer chip * (`UnsavedChangesChip`). Form-modal shells compose these three instead of * reimplementing the affordance — closing a dirty form must never silently * discard the edits, and the chip is the standing signal that edits exist. */ /** * State-driven confirm dialog using `ModalV2` — the house replacement for * `window.confirm`. `ask(title, body)` returns a `Promise`; the * consumer awaits the user's choice and then proceeds. The returned `dialog` * element MUST be rendered in the host's JSX (inside the host modal is fine — * `ModalV2` stacks). * * Concurrency: a second `ask` while a dialog is already open resolves `false` * immediately — without the guard the second `setPending` would overwrite the * first entry and the first Promise would hang forever. The ref-based * in-flight flag also covers two synchronous `ask()` calls in the same render * tick, which `useState` alone races. */ export declare function useConfirm(): { ask: (title: string, body: string) => Promise; dialog: React.JSX.Element | null; }; export interface UseGuardedCloseOptions { /** Confirm dialog title. */ title?: string; /** Confirm dialog body. */ body?: string; } /** * Close guard for dirty forms: `guardedClose` runs `onClose` directly while * clean, and asks the house confirm first once `dirty` — wire it to the * modal's `onClose` AND the Cancel button so every dismissal path is guarded. * Render the returned `dialog` in the host's JSX. */ export declare function useGuardedClose(dirty: boolean, onClose: () => void, { title, body }?: UseGuardedCloseOptions): { guardedClose: () => Promise; dialog: React.JSX.Element | null; }; export interface UnsavedChangesChipProps { /** Names WHAT is dirty (hover tooltip) — turns "why is this dirty?!" into a hover. */ detail?: string; className?: string; } /** The standing "Unsaved changes" signal for a dirty modal's footer. */ export declare function UnsavedChangesChip({ detail, className }: UnsavedChangesChipProps): React.JSX.Element; //# sourceMappingURL=modal-guarded-close.d.ts.map