export type StepValidator = () => string[]; /** Reducer state: current step, the furthest validly reached step, and the blocking messages. */ export type WizardState = { /** Zero-based index of the current step. */ index: number; /** Furthest step the user has validly reached; stages beyond it stay locked. */ furthest: number; /** Messages blocking the current step; [] when none. */ errors: string[]; }; /** Actions `wizardTransition` understands. */ export type WizardAction = /** Validates the current step, then advances; failing keeps the step and stores its errors. */ { type: "next"; } /** Steps back one, clearing errors. */ | { type: "back"; } /** Jumps to `index` if it is at or before `furthest`; otherwise ignored. */ | { type: "goto"; index: number; } /** Moves to `index` and shows `errors`, used when finishing finds an invalid step. */ | { type: "fail"; index: number; errors: string[]; } /** Returns to the first step with nothing reached beyond it. */ | { type: "reset"; }; export declare const INITIAL_WIZARD_STATE: WizardState; /** Pure step reducer: `next` validates the current step, `goto` only reaches steps up to `furthest`. */ export declare function wizardTransition(state: WizardState, action: WizardAction, validators: (StepValidator | undefined)[]): WizardState; /** First step whose validator reports errors, or null when every step is valid. */ export declare function firstInvalidStep(validators: (StepValidator | undefined)[]): { index: number; errors: string[]; } | null;