"use client"; import { useWatch } from "react-hook-form"; import type { FieldConfig, SelectOption } from "@/types/form"; import type { UseFormRegister, FieldValues, FieldErrors, Control, } from "react-hook-form"; interface FieldRendererProps { field: FieldConfig; register: UseFormRegister; errors: FieldErrors; /** Form control — required for currency live-preview formatting. */ control: Control; /** For readonly display fields, the value to render. */ readonlyValue?: unknown; /** * Options resolved at runtime (from /api/data). When `field.optionGroupId` * is set, look up options here first; fall back to the field's hard-coded * `options` array if absent. */ resolvedOptions?: SelectOption[]; } const DATE_MIN_DEFAULT = "1900-01-01"; const DATE_MAX_DEFAULT = "2100-12-31"; /** * Renders a single field appropriate to its `type`. All inputs share a common * accessibility scaffold: a real