import type { RefObject, SyntheticEvent } from 'react'; export type LumenFormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; export interface LumenFormIssue { name: string; controlId: string; message: string; label?: string; } export declare const isLumenFormControl: (element: EventTarget) => element is LumenFormControl; export interface LumenFormWorkflowOptions { getControlName?: (control: LumenFormControl) => string; validateControl?: (control: LumenFormControl) => string; validateValues?: (form: HTMLFormElement) => readonly LumenFormIssue[]; /** Map a changed field name to the other field names that need validation. */ dependencies?: Readonly>; } export interface LumenFormWorkflow { formRef: RefObject; errors: readonly LumenFormIssue[]; dirty: boolean; attempted: boolean; validate: (form?: HTMLFormElement | null, names?: readonly string[]) => boolean; refresh: (form?: HTMLFormElement | null, changedName?: string) => void; setErrors: (errors: readonly LumenFormIssue[]) => void; markSaved: () => void; formProps: { ref: RefObject; noValidate: true; onBlur: (event: SyntheticEvent) => void; onChange: (event: SyntheticEvent) => void; onInput: (event: SyntheticEvent) => void; onReset: (event: SyntheticEvent) => void; }; } /** Validation and edit state; schemas, requests, draft storage and business policy remain application-owned. */ export declare const useLumenFormWorkflow: ({ getControlName, validateControl, validateValues, dependencies }?: LumenFormWorkflowOptions) => LumenFormWorkflow; export interface LumenFieldArrayItem { id: string; value: Value; } /** Stable row identity survives insertions, removals and reordering. */ export declare const useLumenFieldArray: (initialValues?: readonly Value[]) => { items: LumenFieldArrayItem[]; append: (value: Value) => string; remove: (id: string) => void; update: (id: string, value: Value) => void; move: (id: string, offset: number) => void; }; /** A failed or superseded check cannot replace the newest result. */ export declare const useLumenAsyncCheck: (check: (value: Value, signal: AbortSignal) => Promise) => { state: { status: "idle" | "pending"; } | { status: "success"; result: Result; } | { status: "error"; error: unknown; }; run: (value: Value) => Promise; cancel: () => void; }; /** Steps remain application-defined and validate before advancing. */ export declare const useLumenFormSteps: (steps: readonly { id: string; fields: readonly string[]; }[], validate: (names: readonly string[]) => boolean) => { activeId: string; index: number; goTo: (id: string) => boolean; next: () => boolean; previous: () => boolean; }; /** Prompt on reload/close; application routers and dialogs should use the same dirty state. */ export declare const useLumenBeforeUnload: (dirty: boolean) => void; export { type LumenReviewResult, type LumenReviewStatus, type LumenReviewWorkflowOptions, useLumenReviewWorkflow } from './review-workflow.js'; //# sourceMappingURL=form-workflow.d.ts.map