UNPKG

reablocks

Version:
39 lines (38 loc) 1.18 kB
export interface ConfirmDialogContextValue { /** * Whether the confirm action is currently pending. */ isLoading: boolean; /** * Wrapped confirm handler. Awaits the user's `onConfirm` and toggles * the loading state automatically when it returns a Promise. Returns a * Promise so callers can await completion. */ onConfirm: () => void | Promise<void>; /** * Wrapped cancel handler. Suppressed while the confirm action is pending. */ onCancel: () => void; /** * The visual variant of the dialog. */ variant: 'default' | 'destructive'; /** * Whether the confirm button should be disabled (separate from loading). */ confirmDisabled: boolean; /** * The label for the confirm button. */ confirmLabel: string; /** * The label for the cancel button. */ cancelLabel: string; } export declare const ConfirmDialogContext: import('react').Context<ConfirmDialogContextValue>; /** * Hook to access the ConfirmDialog context. * Must be used within a ConfirmDialog component. */ export declare const useConfirmDialogContext: () => ConfirmDialogContextValue;