import { DependencyList, FormEvent, ReactElement } from "react"; import type { Atom } from "../atom/definition.ts"; import { Field } from "../field/definition.ts"; export declare const formChange: Form.Change; declare const hintSymbol: unique symbol; export declare class Form implements Form.Interface { static use(initialValue: Value, deps: DependencyList, options?: Form.Options): Form; static Component(props: Form.ComponentProps): ReactElement; [hintSymbol]: true; constructor(initialValue: Value, options?: Form.Options); get id(): string; get field(): Field; get value(): Atom.Value.Prop>; useValue: Atom.Value.Use.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default>; set(value: Value): void; get dirty(): boolean; useDirty: Field.Dirty.Use.Prop; commit(): void; reset(): void; get initial(): Atom.Value.Prop>; useCompute: Atom.Compute.Use.Prop, Atom.Qualifier.Default>; get $(): Atom.$.Prop<"field", "exact", Value, Atom.Qualifier.Default>; at: Atom.At.Prop<"field", "exact", Value, Atom.Qualifier.Default>; try: Atom.TryProp<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; into: Atom.Proxy.Into.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; useInto: Atom.Proxy.Into.Use.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; watch(callback: Atom.Watch.Callback>): Atom.Unwatch; useWatch(callback: Atom.Watch.Callback>, deps: DependencyList): Atom.Unwatch; get submitting(): boolean; useSubmitting(): boolean; get errors(): Field.Error[]; useErrors: Field.Errors.Use.Prop; get valid(): boolean; useValid: Field.Valid.Use.Prop; validate(): Promise; addError: Field.AddError.Prop; clearErrors(): void; control(props?: Form.ControlProps | undefined): Form.ControlRegistration; } export declare namespace Form { interface Interface extends Field.Ish.Value.Read, Atom.Qualifier.Default>, Field.Ish.Value.Write, Field.Ish.Validation, Atom.Qualifier.Default> { [hintSymbol]: true; id: string; field: Field; value: Atom.Value.Prop>; useValue: Atom.Value.Use.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default>; set(value: Value): void; useCompute: Atom.Compute.Use.Prop, Atom.Qualifier.Default>; get $(): Atom.$.Prop<"field", "exact", Value, Atom.Qualifier.Default>; at: Atom.At.Prop<"field", "exact", Value, Atom.Qualifier.Default>; try: Atom.TryProp<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; into: Atom.Proxy.Into.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; useInto: Atom.Proxy.Into.Use.Prop<"field", "exact", Atom.Def, Atom.Qualifier.Default, Atom.Parent.Default>; watch(callback: Atom.Watch.Callback>): Atom.Unwatch; useWatch(callback: Atom.Watch.Callback>, deps: DependencyList): Atom.Unwatch; validate(): Promise; } interface Change { formSubmitting: bigint; formSubmitted: bigint; formValid: bigint; formInvalid: bigint; } interface Options { id?: string; validate?: Field.Validator; } interface ComponentProps extends ControlProps, Omit, "onSubmit" | "onReset"> { form: Form; children?: React.ReactNode; } interface ControlProps { onSubmit?: Control.OnSubmit | undefined; onReset?: Control.OnReset | undefined; server?: IsServer; } interface ControlRegistration { onSubmit(event: React.FormEvent): void; onReset(event: React.FormEvent): void; } namespace Control { type OnSubmit = true extends IsServer ? (payload: Value) => unknown | Promise : (payload: Value, event: FormEvent) => unknown | Promise; interface OnReset { (event: FormEvent): unknown | Promise; } } } export {}; //# sourceMappingURL=definition.d.ts.map