import * as _angular_forms from '@angular/forms'; import { ValidationErrors, AbstractControl, FormGroupDirective, NgForm, NgControl } from '@angular/forms'; import * as _angular_core from '@angular/core'; import { Type, Provider, Signal } from '@angular/core'; interface ControlState { dirty: boolean; errors: ValidationErrors | null; invalid: boolean; spartanInvalid: boolean; touched: boolean; } type ChangeFn = (value: T) => void; type TouchFn = () => void; /** * Provides a custom {@link ErrorStateMatcher} at the component or application level. * * @example Application-level (appConfig) * ```ts * provideErrorStateMatcher(ShowOnDirtyErrorStateMatcher) * ``` * * @example Component-level * ```ts * providers: [provideErrorStateMatcher(ShowOnDirtyErrorStateMatcher)] * ``` */ declare function provideErrorStateMatcher(matcher: Type): Provider; /** Error state matcher that matches when a control is invalid and dirty. */ declare class ShowOnDirtyErrorStateMatcher implements ErrorStateMatcher { isInvalid(control: AbstractControl | null, form: FormGroupDirective | NgForm | null): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Determines when a form control should be considered in an invalid (error) state. * * The return value of `isInvalid` is reflected as the `data-matches-spartan-invalid` attribute * on field components, which drives both error styling and the visibility of `HlmFieldError` * messages. * * The default implementation matches when the control is invalid and either touched or, for * template-driven forms, the parent `NgForm` has been submitted. * * Provide a custom implementation (e.g. `ShowOnDirtyErrorStateMatcher`) at the component or * application level to change when errors are shown. */ declare class ErrorStateMatcher { isInvalid(control: AbstractControl | null, form: FormGroupDirective | NgForm | null): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } interface StateTracker { readonly controlState: Signal; readonly errors: Signal; readonly dirty: Signal; readonly invalid: Signal; readonly spartanInvalid: Signal; readonly touched: Signal; destroy(): void; } declare function controlStateEqual(a: ControlState | null, b: ControlState | null): boolean; declare function createStateTracker(ngControl: NgControl, matcher: ErrorStateMatcher | null, parentFormGroup: FormGroupDirective | null, parentForm: NgForm | null): StateTracker; declare class ReactiveStateTracker implements StateTracker { private readonly _ngControl; private readonly _matcher; private readonly _parentFormGroup; private readonly _parentForm; private readonly _stateVersion; private readonly _eventsSubscription?; private readonly _submitSubscription?; readonly controlState: _angular_core.Signal; readonly errors: _angular_core.Signal<_angular_forms.ValidationErrors | null>; readonly dirty: _angular_core.Signal; readonly invalid: _angular_core.Signal; readonly spartanInvalid: _angular_core.Signal; readonly touched: _angular_core.Signal; private get _controlParent(); constructor(_ngControl: NgControl, _matcher: ErrorStateMatcher | null, _parentFormGroup: FormGroupDirective | null, _parentForm: NgForm | null); destroy(): void; } declare class SignalStateTracker implements StateTracker { private readonly _ngControl; private readonly _matcher; private readonly _parentFormGroup; private readonly _parentForm; private readonly _submitVersion; private readonly _submitSubscription?; private readonly _control; readonly dirty: _angular_core.Signal; readonly touched: _angular_core.Signal; readonly invalid: _angular_core.Signal; readonly errors: _angular_core.Signal<_angular_forms.ValidationErrors | null>; readonly spartanInvalid: _angular_core.Signal; readonly controlState: _angular_core.Signal; private get _controlParent(); constructor(_ngControl: NgControl, _matcher: ErrorStateMatcher | null, _parentFormGroup: FormGroupDirective | null, _parentForm: NgForm | null); destroy(): void; } export { ErrorStateMatcher, ReactiveStateTracker, ShowOnDirtyErrorStateMatcher, SignalStateTracker, controlStateEqual, createStateTracker, provideErrorStateMatcher }; export type { ChangeFn, ControlState, StateTracker, TouchFn };