import type { ReactNode } from 'react'; import type { ZodObject } from 'zod'; import type { ZodFormComponents, RuntimeComponentConfig } from './FieldRenderer.js'; /** * Props for {@link ZodFormSwitch}. * * @category Components */ export interface ZodFormSwitchProps, TKey extends keyof TSource & string, TSchemas extends Record> { /** * Source object whose `[discriminator]` value selects the schema. * `null` / `undefined` are valid and route to `fallback` (or to a one-time * warning + `null` render if no fallback is provided). */ source: TSource | null | undefined; /** Property name on `source` to use as the discriminator. */ discriminator: TKey; /** Map from discriminator values to Zod schemas. */ schemas: TSchemas; /** * Component(s) to render when the discriminator value matches no * schema. ReactNode for static fallback; function for dynamic. * The function form receives the (possibly nullish) source. */ fallback?: ReactNode | ((source: TSource | null | undefined) => ReactNode); /** Forwarded to the rendered . */ components?: ZodFormComponents; /** Forwarded to the rendered . */ componentConfig?: RuntimeComponentConfig; /** Forwarded to the rendered . */ onValueChange?: (data: unknown, meta: { isValid: boolean; }) => void; /** Forwarded to the rendered . */ className?: string; /** Forwarded to the rendered . */ errorDisplay?: 'always' | 'afterTouched'; } /** * Render the form matching `source[discriminator]`, unmounting on changes via * a React `key`. Falls back to `fallback` (or `null` plus a one-time warning) * for unmapped discriminator values. * * @example * ```tsx * } * /> * ``` * * @category Components */ export declare function ZodFormSwitch, TKey extends keyof TSource & string, TSchemas extends Record>(props: ZodFormSwitchProps): ReactNode; //# sourceMappingURL=ZodFormSwitch.d.ts.map