import { QuestionnaireState } from 'types/QuestionnaireState'; import { DescriptorState } from '../types'; /** * Field-update primitives composed by `useQuestionnaireStep` to keep the * form state internally consistent: applying side effects from * `getChangedFields`, resetting hidden fields, seeding defaults on newly * visible fields, and clearing stale option values when the available * choices have changed. * * They share an accumulator (`FieldUpdater`) so the hook can apply all * passes in one render and decide whether anything actually moved before * scheduling a setState. */ export type FieldUpdater = { current: QuestionnaireState; changed: boolean; }; /** Merge getChangedFields side effects into fields for a given key. */ export declare const mergeChangedFields: (key: string, fields: QuestionnaireState, state: DescriptorState) => QuestionnaireState; /** * Apply each hidden field's reset value. Default behavior (no `getResetValue` * declared) is to clear to undefined. Descriptors can override via * `getResetValue` to set a derived value, or return the current value to preserve. */ export declare const resetHiddenFields: (hiddenKeys: string[], state: DescriptorState, updater: FieldUpdater) => void; /** * Seed each newly-visible field with its `getDefaultValue` when the field * has no value yet. "Newly visible" = currently visible AND not in the * previous render's visible set, so defaults fire on hidden→visible * transitions but not on every render. This prevents re-seeding fields * the user has explicitly cleared. */ export declare const applyVisibleDefaults: (visibleKeys: Set, previouslyVisibleKeys: Set, state: DescriptorState, updater: FieldUpdater) => void; /** Reset radio/select values that don't match any available option. */ export declare const clearStaleOptionValues: (visibleKeys: Set, state: DescriptorState, updater: FieldUpdater) => void;