import React from 'react'; /** What the server told us about the missing reason. */ export interface ReasonRequiredInfo { /** Minimum trimmed length the policy demands (default 3). */ min: number; /** True when a reason WAS sent but was too short. */ tooShort: boolean; } export declare const DEFAULT_REASON_MIN = 3; /** * Detects the kernel's mandatory-reason refusal in an axios error (or a bare * response body): HTTP 422 with `errors.reason[0].code` of `required` | `min`. * Returns null for any other error. */ export declare function reasonRequiredInfo(err: unknown): ReasonRequiredInfo | null; export interface ReasonPromptDialogProps { open: boolean; title: string; description?: React.ReactNode; /** Minimum trimmed length; the submit button stays disabled below it. */ min?: number; /** Label of the confirm button (default "Continuar"). */ confirmLabel?: string; /** Style the confirm button as destructive (delete / cancel). */ destructive?: boolean; /** Inline error from a previous attempt. */ error?: string | null; busy?: boolean; onSubmit: (reason: string) => void; onCancel: () => void; } export declare function ReasonPromptDialog({ open, title, description, min, confirmLabel, destructive, error, busy, onSubmit, onCancel, }: ReasonPromptDialogProps): React.JSX.Element; export interface RunWithReasonOptions { /** Dialog headline, e.g. "Eliminar registro". */ title: string; description?: React.ReactNode; confirmLabel?: string; destructive?: boolean; /** * Performs the request. Called first WITHOUT a reason; when the server * demands one it is called again with the operator's reason. Throw (axios * style) on failure. */ request: (reason?: string) => Promise; /** A reason already collected (bulk operations reuse one for every row). */ reason?: string; } export interface ReasonPromptApi { /** * Resolves the request's result, or `undefined` when the operator cancelled * the reason prompt. Any error that is NOT a reason refusal is rethrown. */ run: (opts: RunWithReasonOptions) => Promise; /** Render once near the caller: the dialog the helper opens. */ dialog: React.ReactNode; } /** See the module comment. Render `dialog` somewhere in the caller's tree. */ export declare function useReasonPrompt(): ReasonPromptApi; //# sourceMappingURL=reason-prompt.d.ts.map