import { InputStep } from './InputStep'; import { Locale } from './Locale'; import { QuestionnaireStateKey } from './QuestionnaireState'; import { StepId } from './StepId'; export type UiState = { language: Locale; stepId: StepId; isEditing: boolean; isSubmitting: boolean; isShowingErrors: boolean; setValue: (key: QuestionnaireStateKey, value: string | undefined) => void; /** * File-typed write path, parallel to `setValue`. Used by `hydrateFile` for * `type: 'file'` descriptors, whose value is a `File`, not a string. The * `File` is held in the flat state map at runtime (the map is string-typed, * so storing casts); safe because state is only serialized by the whitelist * submit transform, which excludes file fields. * * Required: the questionnaire state hook always provides it, and a file * field can't function without it, so we guarantee it at compile time. (The * generic `HydratableState.ui` keeps it optional for parallel consumers that * collect no files — which is why `hydrateFile` still guards at runtime.) */ setFile: (key: QuestionnaireStateKey, file: File | null) => void; showErrors: () => void; hideErrors: () => void; goTo: (step: InputStep) => void; setIsEditing: (editing: boolean) => void; };