import type { InferType, PropertyDescriptor, PropertyDescriptorTree, SchemaBuilder, ValidationResult } from '@cleverbrush/schema'; import { ObjectSchemaBuilder } from '@cleverbrush/schema'; import type { FormContextValue } from './contexts.js'; import type { FieldRenderer, FormSystemConfig, UseFieldResult, UseSchemaFormOptions } from './types.js'; /** * Return type for useSchemaForm — fully typed for IntelliSense. * The `useField` method infers the field value type from the schema via PropertyDescriptor. */ export type SchemaFormInstance> = { useField: >(forProperty: (tree: PropertyDescriptorTree) => PropertyDescriptor) => UseFieldResult>; submit: () => Promise>>; validate: () => Promise>>; reset: (values?: Partial>) => void; getValue: () => InferType; setValue: (values: Partial>) => void; /** @internal — Used by FormProvider and Field to access internal context */ _getFormContext: () => FormContextValue; }; /** * Hook that binds a schema to a form instance. * Provides field binding API, form-level validation, submit, reset. */ export declare function useSchemaForm>(schema: TSchema, options?: UseSchemaFormOptions): SchemaFormInstance; /** * Internal useField implementation, requires FormContextValue. * Returns UseFieldResult with untyped values — callers should cast to the proper generic type. */ export declare function useFieldFromContext(formContext: FormContextValue, forProperty: (tree: any) => any, triggerValidation?: (markTouched: boolean) => Promise): UseFieldResult; /** * Resolves a renderer from the FormSystem config based on schema type and optional variant. * * When `variant` is provided the registry is checked for `"type:variant"` first * (e.g. `"string:password"`). If no match is found it falls back to the base * `"type"` key (e.g. `"string"`). */ export declare function resolveRenderer(config: FormSystemConfig | null, schema: SchemaBuilder, variant?: string): FieldRenderer | undefined;