import { Controller } from "./Controller"; declare type BooleanFromStatus = (status: Form) => boolean; declare type StringFromValue = (value: any) => string; declare type BooleanFromValue = (value: any) => boolean; declare type FormField = { defaultValue?: any; required?: boolean | BooleanFromStatus; validation?: BooleanFromValue; errorText?: string | StringFromValue; hidden?: boolean | BooleanFromStatus; }; declare type Options = { [key: string]: FormField; }; declare type Entry = { value: any; errorText: string; valid: boolean; hidden: boolean; required: boolean; }; declare type Entries = { [key in keyof Options]: Entry; }; interface Form { fields: Options; data: Entries; ready: boolean; } /** * Control forms. * When creating a form, use an object to define the form's `fields`. * For each field, provide a set of optional properties used to * determine the field's `data` entry: * - `defaultValue` - a value for new or reset fields * - `required` - a boolean (or method that takes the Form's state and returns a boolean) * - `validation` - method that takes the field's data value and returns a boolean * - `errorText` - a string (or method that takes the Form's state and returns a string) * - `hidden` - a boolean (or method that takes the Form's state and returns a boolean) * @example``` const controller = new FormController({ name: { defaultValue: "", validation: (v) => v.includes(" "), errorText: "Please provide a first and last name.", required: true, hidden: false } })``` */ export declare class FormController extends Controller