import type { ComponentType, ReactNode } from 'react'; import type { FormField, FieldConfig, ComponentOverride } from '@zod-to-form/core'; import { defaultComponentMap } from './components/index.js'; type ComponentMap = typeof defaultComponentMap; /** * Public component-map type for ``. * * Preserves the per-key names from `defaultComponentMap` (consumers still get * autocomplete on `Input`, `Checkbox`, etc.) but widens each value to * `React.ComponentType`, so plain function components, React.memo-wrapped * components, and forwardRef components are all assignable. */ export type ZodFormComponents = Partial>>; export type RuntimeComponentConfig = { /** * Component source and optional per-component overrides. * `source` is used by CLI codegen to emit a static import statement (not used at runtime). * `overrides` maps component names to `ComponentOverride` metadata (controlled, props, etc.). */ components: { source: string; overrides?: Record; }; /** * The pre-imported components module object, e.g. `import * as myComponents from './components'`. * Used to resolve component functions by name at runtime. * Section components are also resolved from this module. */ componentModule?: Record; fields?: Record; }; /** * One-time validation of component config for removed keys. * Called once per form render (from ZodForm), not per field. */ export declare function warnRemovedConfigKeys(componentConfig: RuntimeComponentConfig | undefined): void; /** * Props passed to the field template component that wraps each rendered form field. * The template controls layout: label position, description placement, error display, etc. * Override the default template by providing a `FieldTemplate` export in `componentModule`. * * @category Types */ export interface FieldTemplateProps { /** The rendered field input (passed as `children`). */ children: ReactNode; /** Human-readable field label derived from the schema key or `title` metadata. */ label: string; /** Optional description text from `.describe()` or `.meta({ description })`. */ description?: string; /** Optional help text from `FormMeta.helpText`, displayed below the input. */ helpText?: string; /** Validation error message from RHF `formState.errors`, if present. */ error?: string; /** Field path used as the `htmlFor` target on the label. */ name: string; /** Whether the field is required (drives asterisk or `aria-required`). */ required?: boolean; /** Whether the field is disabled (drives `disabled` on the wrapper). */ disabled?: boolean; /** Whether the field is deprecated (drives strikethrough on the label). */ deprecated?: boolean; } type FieldRendererProps = { field: FormField; components?: ZodFormComponents; componentConfig?: RuntimeComponentConfig; /** * Controls when a field's validation error is surfaced. `'always'` * (default) shows the error as soon as `formState.errors` has one. * `'afterTouched'` suppresses it until the field is touched or dirtied. * See `UseZodFormOptions.errorDisplay` for the full contract. */ errorDisplay?: 'always' | 'afterTouched'; }; /** * Serialize a value into a dedup key for set uniqueness checks. * Returns null for empty/nullish values (skip from comparison). * Falls back to a unique symbol-string on serialization failure so * unserializable values never match other values. * * @internal Exported for testing */ export declare function safeSerializeForDedup(value: unknown): string | null; export declare const FieldRenderer: import("react").MemoExoticComponent<({ field, components, componentConfig, errorDisplay }: FieldRendererProps) => import("react").JSX.Element | null>; export {}; //# sourceMappingURL=FieldRenderer.d.ts.map