UNPKG

@mitcsutt/kiln-forms

Version:

Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui

16 lines (15 loc) • 909 B
import type { ComponentType, ReactNode } from 'react'; import type { AnyFieldApi } from '@tanstack/react-form'; export interface KitAppFieldProps { name: string; children: (field: AnyFieldApi) => ReactNode; [option: string]: unknown; } /** * The kit form's `AppField` (canonical path, §6.1): unchanged in edit mode; in view mode it * creates no TanStack field — `children` gets a read-only field (value from a one-path selector) * carrying the kit's field components, so `<form.AppField name>{(f) => <f.TextField/>}` in a * review never takes over the real field's instance, validators or meta. Field groups need nothing * extra: TanStack's `group.AppField` renders the form's `AppField` with the full path. */ export declare function createKitAppField(api: object, RawAppField: ComponentType<KitAppFieldProps>, fieldComponents: Record<string, unknown>): ComponentType<KitAppFieldProps>;