import { ChangeDetectorRef, type Provider, type Type } from '@angular/core'; import { type ControlValueAccessor, type FormControlStatus, NgControl } from '@angular/forms'; import { TuiValueTransformer } from './value-transformer'; import * as i0 from "@angular/core"; /** * Basic ControlValueAccessor class to build form components upon * * TODO(v6): implement `FormValueControl` from `@angular/forms/signals` once Angular 22 is the * minimal supported version. Most of the existed logic below goes away. * * [According to documentation](https://angular.dev/guide/forms/signals/migration#custom-controls): * > Any custom Signal Form Control can be used with Reactive (and Template-Driven) Forms as-is * * ```ts * export abstract class TuiControl implements FormValueControl { * private readonly fallback = inject(TUI_FALLBACK_VALUE, FLAGS) as T; * * protected transformer = * inject(TuiValueTransformer, FLAGS) ?? TUI_IDENTITY_VALUE_TRANSFORMER; * * public readonly disabled = input(false); * public readonly invalid = input(false); * public readonly touched = input(false); * public readonly readonly = input(false); * public readonly touch = output(); * * public readonly value = model(this.fallback); * * // https://angular.dev/guide/forms/signals/custom-controls#value-transformation * // https://angular.dev/api/forms/signals/transformedValue * protected readonly rawValue = transformedValue(this.value, { * parse: (raw: T) => ({value: this.transformer.toControlValue(raw)}), * format: (value) => this.transformer.fromControlValue(value), * }); * * reset() { * // [...] * } * * // [...] * } * ``` */ export declare abstract class TuiControl implements ControlValueAccessor { private readonly fallback; private readonly refresh$; private readonly internal; protected readonly control: NgControl; protected readonly cdr: ChangeDetectorRef; protected readonly field: import("@angular/core").Signal<{ errors: import("@angular/core").Signal; }>; protected transformer: TuiValueTransformer; readonly value: import("@angular/core").Signal; /** * @deprecated use `` instead * TODO(v6): delete */ readonly readOnlyLegacy: import("@angular/core").InputSignal; /** * TODO(v6): delete, it's only for backward compatibility */ readonly readOnly: import("@angular/core").Signal; readonly readonly: import("@angular/core").InputSignalWithTransform; /** * @deprecated use `` instead * TODO(v6): delete */ readonly pseudoInvalid: import("@angular/core").InputSignal; /** * @deprecated internal purpose only * TODO(v6): delete when `TuiControl[pseudoInvalid]` is deleted */ readonly externalInvalid: import("@angular/core").WritableSignal; readonly touched: import("@angular/core").WritableSignal; readonly status: import("@angular/core").WritableSignal; readonly disabled: import("@angular/core").Signal; readonly interactive: import("@angular/core").Signal; readonly invalid: import("@angular/core").Signal; readonly mode: import("@angular/core").Signal<"invalid" | "readonly" | "valid">; onTouched: (...args: any[]) => void; onChange: (value: T) => void; constructor(); registerOnChange(onChange: (value: unknown) => void): void; registerOnTouched(onTouched: () => void): void; setDisabledState(): void; writeValue(value: T | null): void; private update; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, never, never, { "readOnlyLegacy": { "alias": "readOnly"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pseudoInvalid": { "alias": "invalid"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } export declare function tuiAsControl(control: Type>): Provider;