@angular/forms
Version:
Angular - directives and services for creating forms
565 lines (544 loc) • 31.9 kB
TypeScript
/**
* @license Angular v21.0.5
* (c) 2010-2025 Google LLC. https://angular.dev/
* License: MIT
*/
import { InputSignal, InputSignalWithTransform, ModelSignal, OutputRef, Signal, ResourceRef } from '@angular/core';
import { WithOptionalField, ValidationError, DisabledReason, PathKind, SchemaPath, SchemaPathRules, LogicFn, OneOrMany, SchemaPathTree, FieldValidator, FieldContext, TreeValidationResult, TreeValidator, Debouncer } from './_structure-chunk.js';
export { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, CustomValidationError, EmailValidationError, FIELD, Field, FieldState, FieldTree, FormOptions, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SignalFormsConfig, StandardSchemaValidationError, Subfields, SubmittedStatus, ValidationResult, ValidationSuccess, Validator, WithField, WithoutField, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, customError, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit } from './_structure-chunk.js';
import { StandardSchemaV1 } from '@standard-schema/spec';
import { HttpResourceRequest, HttpResourceOptions } from '@angular/common/http';
import '@angular/forms';
/**
* The base set of properties shared by all form control contracts.
*
* @category control
* @experimental 21.0.0
*/
interface FormUiControl {
/**
* An input to receive the errors for the field. If implemented, the `Field` directive will
* automatically bind errors from the bound field to this input.
*/
readonly errors?: InputSignal<readonly WithOptionalField<ValidationError>[]> | InputSignalWithTransform<readonly WithOptionalField<ValidationError>[], unknown>;
/**
* An input to receive the disabled status for the field. If implemented, the `Field` directive
* will automatically bind the disabled status from the bound field to this input.
*/
readonly disabled?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the reasons for the disablement of the field. If implemented, the `Field`
* directive will automatically bind the disabled reason from the bound field to this input.
*/
readonly disabledReasons?: InputSignal<readonly WithOptionalField<DisabledReason>[]> | InputSignalWithTransform<readonly WithOptionalField<DisabledReason>[], unknown>;
/**
* An input to receive the readonly status for the field. If implemented, the `Field` directive
* will automatically bind the readonly status from the bound field to this input.
*/
readonly readonly?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the hidden status for the field. If implemented, the `Field` directive
* will automatically bind the hidden status from the bound field to this input.
*/
readonly hidden?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the invalid status for the field. If implemented, the `Field` directive
* will automatically bind the invalid status from the bound field to this input.
*/
readonly invalid?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the pending status for the field. If implemented, the `Field` directive
* will automatically bind the pending status from the bound field to this input.
*/
readonly pending?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the touched status for the field. If implemented, the `Field` directive
* will automatically bind the touched status from the bound field to this input.
*/
readonly touched?: ModelSignal<boolean> | InputSignal<boolean> | InputSignalWithTransform<boolean, unknown> | OutputRef<boolean>;
/**
* An input to receive the dirty status for the field. If implemented, the `Field` directive
* will automatically bind the dirty status from the bound field to this input.
*/
readonly dirty?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the name for the field. If implemented, the `Field` directive will
* automatically bind the name from the bound field to this input.
*/
readonly name?: InputSignal<string> | InputSignalWithTransform<string, unknown>;
/**
* An input to receive the required status for the field. If implemented, the `Field` directive
* will automatically bind the required status from the bound field to this input.
*/
readonly required?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
/**
* An input to receive the min value for the field. If implemented, the `Field` directive will
* automatically bind the min value from the bound field to this input.
*/
readonly min?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
/**
* An input to receive the min length for the field. If implemented, the `Field` directive will
* automatically bind the min length from the bound field to this input.
*/
readonly minLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
/**
* An input to receive the max value for the field. If implemented, the `Field` directive will
* automatically bind the max value from the bound field to this input.
*/
readonly max?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
/**
* An input to receive the max length for the field. If implemented, the `Field` directive will
* automatically bind the max length from the bound field to this input.
*/
readonly maxLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
/**
* An input to receive the value patterns for the field. If implemented, the `Field` directive
* will automatically bind the value patterns from the bound field to this input.
*/
readonly pattern?: InputSignal<readonly RegExp[]> | InputSignalWithTransform<readonly RegExp[], unknown>;
}
/**
* A contract for a form control that edits a `FieldTree` of type `TValue`. Any component that
* implements this contract can be used with the `Field` directive.
*
* Many of the properties declared on this contract are optional. They do not need to be
* implemented, but if they are will be kept in sync with the field state of the field bound to the
* `Field` directive.
*
* @template TValue The type of `FieldTree` that the implementing component can edit.
*
* @category control
* @experimental 21.0.0
*/
interface FormValueControl<TValue> extends FormUiControl {
/**
* The value is the only required property in this contract. A component that wants to integrate
* with the `Field` directive via this contract, *must* provide a `model()` that will be kept in
* sync with the value of the bound `FieldTree`.
*/
readonly value: ModelSignal<TValue>;
/**
* The implementing component *must not* define a `checked` property. This is reserved for
* components that want to integrate with the `Field` directive as a checkbox.
*/
readonly checked?: undefined;
}
/**
* A contract for a form control that edits a boolean checkbox `FieldTree`. Any component that
* implements this contract can be used with the `Field` directive.
*
* Many of the properties declared on this contract are optional. They do not need to be
* implemented, but if they are will be kept in sync with the field state of the field bound to the
* `Field` directive.
*
* @category control
* @experimental 21.0.0
*/
interface FormCheckboxControl extends FormUiControl {
/**
* The checked is the only required property in this contract. A component that wants to integrate
* with the `Field` directive, *must* provide a `model()` that will be kept in sync with the
* value of the bound `FieldTree`.
*/
readonly checked: ModelSignal<boolean>;
/**
* The implementing component *must not* define a `value` property. This is reserved for
* components that want to integrate with the `Field` directive as a standard input.
*/
readonly value?: undefined;
}
/**
* Adds logic to a field to conditionally disable it. A disabled field does not contribute to the
* validation, touched/dirty, or other state of its parent field.
*
* @param path The target path to add the disabled logic to.
* @param logic A reactive function that returns `true` (or a string reason) when the field is disabled,
* and `false` when it is not disabled.
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category logic
* @experimental 21.0.0
*/
declare function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>): void;
/**
* Adds logic to a field to conditionally hide it. A hidden field does not contribute to the
* validation, touched/dirty, or other state of its parent field.
*
* If a field may be hidden it is recommended to guard it with an `@if` in the template:
* ```
* @if (!email().hidden()) {
* <label for="email">Email</label>
* <input id="email" type="email" [control]="email" />
* }
* ```
*
* @param path The target path to add the hidden logic to.
* @param logic A reactive function that returns `true` when the field is hidden.
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category logic
* @experimental 21.0.0
*/
declare function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic: NoInfer<LogicFn<TValue, boolean, TPathKind>>): void;
/**
* Adds logic to a field to conditionally make it readonly. A readonly field does not contribute to
* the validation, touched/dirty, or other state of its parent field.
*
* @param path The target path to make readonly.
* @param logic A reactive function that returns `true` when the field is readonly.
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category logic
* @experimental 21.0.0
*/
declare function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic?: NoInfer<LogicFn<TValue, boolean, TPathKind>>): void;
/** Represents a value that has a length or size, such as an array or string, or set. */
type ValueWithLengthOrSize = {
length: number;
} | {
size: number;
};
/** Common options available on the standard validators. */
type BaseValidatorConfig<TValue, TPathKind extends PathKind = PathKind.Root> = {
/** A user-facing error message to include with the error. */
message?: string | LogicFn<TValue, string, TPathKind>;
error?: never;
} | {
/**
* Custom validation error(s) to report instead of the default,
* or a function that receives the `FieldContext` and returns custom validation error(s).
*/
error?: OneOrMany<ValidationError> | LogicFn<TValue, OneOrMany<ValidationError>, TPathKind>;
message?: never;
};
/**
* Binds a validator to the given path that requires the value to match the standard email format.
* This function can only be called on string paths.
*
* @param path Path of the field to validate
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.email()`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function email<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: BaseValidatorConfig<string, TPathKind>): void;
/**
* Binds a validator to the given path that requires the value to be less than or equal to the
* given `maxValue`.
* This function can only be called on number paths.
* In addition to binding a validator, this function adds `MAX` property to the field.
*
* @param path Path of the field to validate
* @param maxValue The maximum value, or a LogicFn that returns the maximum value.
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.max(maxValue)`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function max<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<number | string | null, SchemaPathRules.Supported, TPathKind>, maxValue: number | LogicFn<number | string | null, number | undefined, TPathKind>, config?: BaseValidatorConfig<number | string | null, TPathKind>): void;
/**
* Binds a validator to the given path that requires the length of the value to be less than or
* equal to the given `maxLength`.
* This function can only be called on string or array paths.
* In addition to binding a validator, this function adds `MAX_LENGTH` property to the field.
*
* @param path Path of the field to validate
* @param maxLength The maximum length, or a LogicFn that returns the maximum length.
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.maxLength(maxLength)`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function maxLength<TValue extends ValueWithLengthOrSize, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, maxLength: number | LogicFn<TValue, number | undefined, TPathKind>, config?: BaseValidatorConfig<TValue, TPathKind>): void;
/**
* Binds a validator to the given path that requires the value to be greater than or equal to
* the given `minValue`.
* This function can only be called on number paths.
* In addition to binding a validator, this function adds `MIN` property to the field.
*
* @param path Path of the field to validate
* @param minValue The minimum value, or a LogicFn that returns the minimum value.
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.min(minValue)`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function min<TValue extends number | string | null, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, minValue: number | LogicFn<TValue, number | undefined, TPathKind>, config?: BaseValidatorConfig<TValue, TPathKind>): void;
/**
* Binds a validator to the given path that requires the length of the value to be greater than or
* equal to the given `minLength`.
* This function can only be called on string or array paths.
* In addition to binding a validator, this function adds `MIN_LENGTH` property to the field.
*
* @param path Path of the field to validate
* @param minLength The minimum length, or a LogicFn that returns the minimum length.
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.minLength(minLength)`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function minLength<TValue extends ValueWithLengthOrSize, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, minLength: number | LogicFn<TValue, number | undefined, TPathKind>, config?: BaseValidatorConfig<TValue, TPathKind>): void;
/**
* Binds a validator to the given path that requires the value to match a specific regex pattern.
* This function can only be called on string paths.
* In addition to binding a validator, this function adds `PATTERN` property to the field.
*
* @param path Path of the field to validate
* @param pattern The RegExp pattern to match, or a LogicFn that returns the RegExp pattern.
* @param config Optional, allows providing any of the following options:
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.pattern(pattern)`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function pattern<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, pattern: RegExp | LogicFn<string | undefined, RegExp | undefined, TPathKind>, config?: BaseValidatorConfig<string, TPathKind>): void;
/**
* Binds a validator to the given path that requires the value to be non-empty.
* This function can only be called on any type of path.
* In addition to binding a validator, this function adds `REQUIRED` property to the field.
*
* @param path Path of the field to validate
* @param config Optional, allows providing any of the following options:
* - `message`: A user-facing message for the error.
* - `error`: Custom validation error(s) to be used instead of the default `ValidationError.required()`
* or a function that receives the `FieldContext` and returns custom validation error(s).
* - `when`: A function that receives the `FieldContext` and returns true if the field is required
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function required<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, config?: BaseValidatorConfig<TValue, TPathKind> & {
when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;
}): void;
/**
* Utility type that removes a string index key when its value is `unknown`,
* i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their
* value is `unknown`, e.g. `{key: unknown}`.
*
* @experimental 21.0.0
*/
type RemoveStringIndexUnknownKey<K, V> = string extends K ? unknown extends V ? never : K : K;
/**
* Utility type that recursively ignores unknown string index properties on the given object.
* We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's
* `looseObject` which includes `{[key: string]: unknown}` as part of the type.
*
* @experimental 21.0.0
*/
type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
[K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;
} : T;
/**
* Validates a field using a `StandardSchemaV1` compatible validator (e.g. a Zod validator).
*
* See https://github.com/standard-schema/standard-schema for more about standard schema.
*
* @param path The `FieldPath` to the field to validate.
* @param schema The standard schema compatible validator to use for validation.
* @template TSchema The type validated by the schema. This may be either the full `TValue` type,
* or a partial of it.
* @template TValue The type of value stored in the field being validated.
*
* @category validation
* @experimental 21.0.0
*/
declare function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProperties<TSchema>>(path: SchemaPath<TModel> & SchemaPathTree<TModel>, schema: StandardSchemaV1<TSchema>): void;
/**
* Adds logic to a field to determine if the field has validation errors.
*
* @param path The target path to add the validation logic to.
* @param logic A `Validator` that returns the current validation errors.
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category logic
* @experimental 21.0.0
*/
declare function validate<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic: NoInfer<FieldValidator<TValue, TPathKind>>): void;
/**
* A function that takes the result of an async operation and the current field context, and maps it
* to a list of validation errors.
*
* @param result The result of the async operation.
* @param ctx The context for the field the validator is attached to.
* @return A validation error, or list of validation errors to report based on the result of the async operation.
* The returned errors can optionally specify a field that the error should be targeted to.
* A targeted error will show up as an error on its target field rather than the field being validated.
* If a field is not given, the error is assumed to apply to the field being validated.
* @template TValue The type of value stored in the field being validated.
* @template TResult The type of result returned by the async operation
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @experimental 21.0.0
*/
type MapToErrorsFn<TValue, TResult, TPathKind extends PathKind = PathKind.Root> = (result: TResult, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;
/**
* Options that indicate how to create a resource for async validation for a field,
* and map its result to validation errors.
*
* @template TValue The type of value stored in the field being validated.
* @template TParams The type of parameters to the resource.
* @template TResult The type of result returned by the resource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
interface AsyncValidatorOptions<TValue, TParams, TResult, TPathKind extends PathKind = PathKind.Root> {
/**
* A function that receives the field context and returns the params for the resource.
*
* @param ctx The field context for the field being validated.
* @returns The params for the resource.
*/
readonly params: (ctx: FieldContext<TValue, TPathKind>) => TParams;
/**
* A function that receives the resource params and returns a resource of the given params.
* The given params should be used as is to create the resource.
* The forms system will report the params as `undefined` when this validation doesn't need to be run.
*
* @param params The params to use for constructing the resource
* @returns A reference to the constructed resource.
*/
readonly factory: (params: Signal<TParams | undefined>) => ResourceRef<TResult | undefined>;
/**
* A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).
* Receives the error and the field context, returns a list of validation errors.
*/
readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;
/**
* A function that takes the resource result, and the current field context and maps it to a list
* of validation errors.
*
* @param result The resource result.
* @param ctx The context for the field the validator is attached to.
* @return A validation error, or list of validation errors to report based on the resource result.
* The returned errors can optionally specify a field that the error should be targeted to.
* A targeted error will show up as an error on its target field rather than the field being validated.
* If a field is not given, the error is assumed to apply to the field being validated.
*/
readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;
}
/**
* Adds async validation to the field corresponding to the given path based on a resource.
* Async validation for a field only runs once all synchronous validation is passing.
*
* @param path A path indicating the field to bind the async validation logic to.
* @param opts The async validation options.
* @template TValue The type of value stored in the field being validated.
* @template TParams The type of parameters to the resource.
* @template TResult The type of result returned by the resource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function validateAsync<TValue, TParams, TResult, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, opts: AsyncValidatorOptions<TValue, TParams, TResult, TPathKind>): void;
/**
* Options that indicate how to create an httpResource for async validation for a field,
* and map its result to validation errors.
*
* @template TValue The type of value stored in the field being validated.
* @template TResult The type of result returned by the httpResource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKind = PathKind.Root> {
/**
* A function that receives the field context and returns the url or request for the httpResource.
* If given a URL, the underlying httpResource will perform an HTTP GET on it.
*
* @param ctx The field context for the field being validated.
* @returns The URL or request for creating the httpResource.
*/
readonly request: ((ctx: FieldContext<TValue, TPathKind>) => string | undefined) | ((ctx: FieldContext<TValue, TPathKind>) => HttpResourceRequest | undefined);
/**
* A function that takes the httpResource result, and the current field context and maps it to a
* list of validation errors.
*
* @param result The httpResource result.
* @param ctx The context for the field the validator is attached to.
* @return A validation error, or list of validation errors to report based on the httpResource result.
* The returned errors can optionally specify a field that the error should be targeted to.
* A targeted error will show up as an error on its target field rather than the field being validated.
* If a field is not given, the error is assumed to apply to the field being validated.
*/
readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;
/**
* A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).
* Receives the error and the field context, returns a list of validation errors.
*/
readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;
/**
* The options to use when creating the httpResource.
*/
readonly options?: HttpResourceOptions<TResult, unknown>;
}
/**
* Adds async validation to the field corresponding to the given path based on an httpResource.
* Async validation for a field only runs once all synchronous validation is passing.
*
* @param path A path indicating the field to bind the async validation logic to.
* @param opts The http validation options.
* @template TValue The type of value stored in the field being validated.
* @template TResult The type of result returned by the httpResource
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
*
* @category validation
* @experimental 21.0.0
*/
declare function validateHttp<TValue, TResult = unknown, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, opts: HttpValidatorOptions<TValue, TResult, TPathKind>): void;
/**
* Adds logic to a field to determine if the field or any of its child fields has validation errors.
*
* @param path The target path to add the validation logic to.
* @param logic A `TreeValidator` that returns the current validation errors.
* Errors returned by the validator may specify a target field to indicate an error on a child field.
* @template TValue The type of value stored in the field the logic is bound to.
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
*
* @category logic
* @experimental 21.0.0
*/
declare function validateTree<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic: NoInfer<TreeValidator<TValue, TPathKind>>): void;
/**
* Configures the frequency at which a form field is updated by UI events.
*
* When this rule is applied, updates from the UI to the form model will be delayed until either
* the field is touched, or the most recently debounced update resolves.
*
* @param path The target path to debounce.
* @param durationOrDebouncer Either a debounce duration in milliseconds, or a custom
* {@link Debouncer} function.
*
* @experimental 21.0.0
*/
declare function debounce<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, durationOrDebouncer: number | Debouncer<TValue, TPathKind>): void;
export { Debouncer, DisabledReason, FieldContext, FieldValidator, LogicFn, OneOrMany, PathKind, SchemaPath, SchemaPathRules, SchemaPathTree, TreeValidationResult, TreeValidator, ValidationError, WithOptionalField, debounce, disabled, email, hidden, max, maxLength, min, minLength, pattern, readonly, required, validate, validateAsync, validateHttp, validateStandardSchema, validateTree };
export type { AsyncValidatorOptions, FormCheckboxControl, FormUiControl, FormValueControl, HttpValidatorOptions, IgnoreUnknownProperties, MapToErrorsFn, RemoveStringIndexUnknownKey };