/** * Lifecycle state of a validation run. * @public */ export type ValidationStatus = 'pending' | 'done' | 'aborted'; /** * Why a validation run was triggered. * @public */ export type ValidationTrigger = 'change' | 'blur' | 'manual' | 'submit' | 'initial'; /** * Where a {@link ValidationError} originated. * @public */ export type ValidationErrorSource = 'native' | 'strato' | 'custom'; /** * Stable, comparable identity for a validity key. * * @remarks * Use {@link ValidityStateKey.equals} for comparisons. `===` fails across * module boundaries since each instance is a distinct object reference. * * @public */ export declare class ValidityStateKey { readonly value: T; constructor(value: T); /** Value equality check. Safe across module boundaries. */ equals(other: ValidityStateKey): boolean; toString(): string; } /** * Browser-native validity keys, wrapping the same values as the native * {@link https://developer.mozilla.org/en-US/docs/Web/API/ValidityState | ValidityState}. * @public */ export declare const NativeValidityStateKeys: { readonly valueMissing: ValidityStateKey<"valueMissing">; readonly typeMismatch: ValidityStateKey<"typeMismatch">; readonly patternMismatch: ValidityStateKey<"patternMismatch">; readonly tooLong: ValidityStateKey<"tooLong">; readonly tooShort: ValidityStateKey<"tooShort">; readonly rangeUnderflow: ValidityStateKey<"rangeUnderflow">; readonly rangeOverflow: ValidityStateKey<"rangeOverflow">; readonly stepMismatch: ValidityStateKey<"stepMismatch">; readonly badInput: ValidityStateKey<"badInput">; readonly customError: ValidityStateKey<"customError">; }; /** * Union of the browser-native validity keys. * @public */ export type NativeValidityStateKey = (typeof NativeValidityStateKeys)[keyof typeof NativeValidityStateKeys]; /** * Strato-specific validity keys used by components whose validation cannot be * represented by browser-native validity states. * @public */ export declare const StratoValidityStateKeys: { readonly syntaxError: ValidityStateKey<"syntaxError">; readonly minMaxBoundary: ValidityStateKey<"minMaxBoundary">; readonly invalidOrder: ValidityStateKey<"invalidOrder">; readonly invalid: ValidityStateKey<"invalid">; readonly invalidFrom: ValidityStateKey<"invalidFrom">; readonly invalidTo: ValidityStateKey<"invalidTo">; readonly invalidFromTo: ValidityStateKey<"invalidFromTo">; readonly missingFrom: ValidityStateKey<"missingFrom">; readonly missingTo: ValidityStateKey<"missingTo">; readonly arrayIdentifierError: ValidityStateKey<"arrayIdentifierError">; readonly unavailable: ValidityStateKey<"unavailable">; readonly needsUpdate: ValidityStateKey<"needs-update">; readonly missingVariables: ValidityStateKey<"missing-variables">; readonly genericError: ValidityStateKey<"genericError">; }; /** * Union of Strato-specific validity keys. * @public */ export type StratoValidityStateKey = (typeof StratoValidityStateKeys)[keyof typeof StratoValidityStateKeys]; /** * Options accepted by the {@link ValidationError} constructor. * @public */ export type ValidationErrorOptions = ErrorOptions & { /** Where the error came from. @defaultValue `'custom'` */ source?: ValidationErrorSource; /** Stable error identity. @defaultValue `NativeValidityStateKeys.customError` */ validityStateKey?: ValidityStateKey; /** ID(s) of all form control inputs affected by this error. */ formControlId?: string | string[]; }; /** * A single validation error. * * @remarks * Extends `Error` so that `instanceof` narrowing works across package * boundaries and the original async failure can be preserved via `Error.cause`. * * @public */ export declare class ValidationError extends Error { /** Where the error came from. */ readonly source: ValidationErrorSource; /** Stable error identity; always compare via {@link ValidityStateKey.equals}. */ readonly validityStateKey: ValidityStateKey; /** ID(s) of all form control inputs affected by this error. */ readonly formControlId: string | string[] | undefined; constructor(message: string, options?: ValidationErrorOptions); } /** * Shared validation result type returned by `validateAsync()` and passed to * `onValidityChange`. * @public */ export type ValidationState = { /** Validation lifecycle state. */ status: ValidationStatus; /** Why validation fired. */ trigger: ValidationTrigger; /** Validation errors. Empty when the control is valid or still `'pending'`. */ errors: ValidationError[]; };