import { Observable, Subject } from 'rxjs'; import * as _angular_core from '@angular/core'; import { AfterContentInit, Signal, OnInit, Injector } from '@angular/core'; import { AbstractControl } from '@angular/forms'; import { ControlBaseDirective } from '@talenra/ngx-base/shared'; /** * Values accepted by the `FormField`'s `status` property. * * ### Import * * ```typescript * import { FormFieldStatus } from '@talenra/ngx-base/form-field'; * ``` * * @see {@link FormField} * @see {@link TFormFieldStatus} */ declare const FormFieldStatus: { readonly Default: "default"; readonly Invalid: "invalid"; }; /** * Type of values accepted by the `FormField`'s `status` property. * * ### Import * * ```typescript * import { TFormFieldStatus } from '@talenra/ngx-base/form-field'; * ``` * * @see {@link FormField} * @see {@link FormFieldStatus} */ type TFormFieldStatus = (typeof FormFieldStatus)[keyof typeof FormFieldStatus]; /** * Values accepted by the `FormField`'s `size§` property. * * ### Import * * ```typescript * import { FormFieldSize } from '@talenra/ngx-base/form-field'; * ``` * * @see {@link FormField} * @see {@link TFormFieldSize} */ declare const FormFieldSize: { readonly S: "s"; readonly M: "m"; }; /** * Type of values accepted by the `FormField`'s `size` property. * * ### Import * * ```typescript * import { TFormFieldSize } from '@talenra/ngx-base/form-field'; * ``` * * @see {@link FormField} * @see {@link FormFieldSize} */ type TFormFieldSize = (typeof FormFieldSize)[keyof typeof FormFieldSize]; /** * `` is a wrapper for form inputs. * * - implements the label associated with the input * - adds a hook to display validation errors * - shows an optional hint text * - injects consistent styling and behaviour for different inputs * * Minimal example: * * ```html * * * * ``` * * Example using a hint text and validation errors: * * ```html * * * This field is required. * Email address is invalid. * * ``` * * ### Import * * ```typescript * import { FormFieldComponent } from '@talenra/ngx-base/form-field'; * ``` * * ../../#/input * * @see {@link FormErrorComponent} */ declare class FormFieldComponent implements AfterContentInit { /** Optional hint text displayed to the user */ hint?: string; /** * Label displayed to the user * * ```html * * ``` */ label: _angular_core.InputSignal; /** * Determines the size of FormField and the wrapped control. Defaults to `m`. * * ```html * * ``` * * @see {@link FormFieldSize} */ size: _angular_core.InputSignal; /** * Suppress the clear button which is displayed by default if the input has a * value and is focused. * * ```html * * ```` */ hideClearButton: _angular_core.InputSignalWithTransform; /** * Status of the form-field. Controls display status like "invalid". * * @internal */ status: _angular_core.WritableSignal; /** @internal */ control?: FormFieldControl; private hostClass; private readonly changeDetector; private readonly destroyRef; /** @internal */ ngAfterContentInit(): void; private updateState; private updateHostClass; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Abstract class defining the requirements for a control implemented by a `FormFieldComponent` instance. */ declare abstract class FormFieldControl { /** Determines whether the control is disabled. */ readonly disabled: boolean; /** Determines whether the control is read-only. */ readonly readonly: boolean; /** Determines whether the control has focus. */ readonly hasFocus: boolean; /** Determines whether the control or any element within has focus. Used to toggle clear button visibility. */ readonly hasFocusWithin: boolean; /** The control's id (the value used in the HTML element's id attribute). */ readonly id: string; /** Determines whether the control contains a value. */ readonly isEmpty: boolean; /** Determines whether the control's value is required. */ readonly required: boolean; /** Determines whether the control's value is invalid. */ readonly invalid: boolean; /** Determines whether the control is touched. A control is considered touched after the user has triggered a 'blur' event on the control. */ readonly touched: boolean; /** Determines whether the control is dirty. A control is considered dirty after the user has changed its value in the UI. */ readonly dirty: boolean; /** Reference to the enclosing FormField if available */ readonly formField?: FormFieldComponent; /** Determines whether the control's content has scroll offset. */ readonly hasScroll: Signal; /** Observable, pushes an empty notification whenever the state of the control changes (e.g. when it gets focus). */ readonly stateChanges: Observable; /** * Determines whether the control (Input, Date, Select, etc.) includes its own ControlContainer. Most controls are ok * to use the FormField's ControlContainer, but some controls (e.g. Date) require their own ControlContainer, like * Date, which has two separate input fields for date and time. * * true → The FormField will not display a label, read-only icon (padlock), clear button etc. * false → The FormField will display a label, read-only icon, clear button etc. * * see {@link DateComponent} */ readonly hasControlContainer?: boolean; /** * `clearValue` is triggered when the user clicks the clear button in the FormField. It is the responsibility of the * control to clear its value and take any other necessary actions. */ readonly clearValue: () => void; } /** * Clear button component. Used in ControlContainer to clear the wrapped control's value. * * @internal */ declare class ClearButtonComponent { /** Determines whether clear button is visible (fade-in/out). */ isVisible: _angular_core.InputSignal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Wrapper for form controls used in FormField context. Adds read-only icon and underline effects. * * ### Import * * ```typescript * import { ControlContainerComponent } from '@talenra/ngx-base/form-field'; * ``` * * @internal */ declare class ControlContainerComponent implements OnInit { /** Label displayed to the user */ label: _angular_core.InputSignal; /** Determines whether the wrapped control is required. */ required: _angular_core.InputSignal; /** Determines whether the wrapped control has focus. */ hasFocus: _angular_core.InputSignal; /** Determines whether the wrapped control is read-only. */ readonly: _angular_core.InputSignal; /** Determines whether the wrapped control is disabled. */ disabled: _angular_core.InputSignal; /** Status of the form-field (e.g. "invalid"). */ status: _angular_core.InputSignal; /** Determindes whether the wrapped control contains a value. */ isEmpty: _angular_core.InputSignal; /** * Determines the size of ControlContainer. Defaults to "m". * * ```html * * ``` * * @see {@link FormFieldSize} */ size: _angular_core.InputSignal; /** * Suppress the clear button which is displayed by default if the input has a value and is focused. * * ```html * * ```` */ hideClearButton: _angular_core.InputSignalWithTransform; /** * Determines whether the control's content has scroll offset (textarea). Used to show/hide the label's background. */ hasScroll: _angular_core.InputSignal; /** * Event emitted when the clear button is pressed. * * ```typescript * protected onClearValue(): void { * console.log('Clear value'); * } * ``` * * ```html * * ``` */ clearValue: _angular_core.OutputEmitterRef; /** Determines whether clear button is visible */ protected showClearButton: _angular_core.Signal; /** * Determines whether the wrapped control (e.g. Input, Select) includes its own ControlContainer * * @see {@link FormFieldControl.hasControlContainer} */ hasChildControlContainer: _angular_core.InputSignal; /** Whether the UI shall use transitions (e.g. when the control gets focus) */ private useTransition; /** @internal */ ngOnInit(): void; /** Used for property binding in component's metadata */ private FormFieldStatus; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * `` is used as a child element of `` to display input validation errors. * * Use multiple instances to provide accurate description of the errors. * * ```html * * * This field is required. * Email address is invalid. * * ``` * * ### Import * * ```typescript * import { FormErrorComponent } from '@talenra/ngx-base/form-field'; * ``` * * ../../#/input * * @see {@link FormFieldComponent} */ declare class FormErrorComponent { /** * The component's active state determines whether the error message is displayed to the user. * * ```html * Email address is invalid. * ``` */ get isVisible(): boolean; /** Set the component's active state. */ set isVisible(value: boolean | undefined); private _isVisible; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; static ngAcceptInputType_isVisible: unknown; } /** * Base class to be expanded by controls used with FormFieldComponent. * * s. {@link InputComponent} or {@link SelectComponent} for examples. * * @internal */ declare class FormFieldControlBaseComponent extends ControlBaseDirective { /** @internal */ hasFocus: boolean; /** * Determines whether the control or any element within Form Field has focus. Used to toggle clear button visibility. * * @internal */ private _hasFocusWithin; get hasFocusWithin(): boolean; set hasFocusWithin(value: boolean); /** @internal */ id: string; /** @internal */ tabindex: number; /** @internal */ control: AbstractControl | null; /** Determines whether the control is required. */ get required(): boolean; /** Set the control's required state */ set required(value: boolean); /** @internal */ _required: boolean | undefined; /** * Get whether the control is invalid. * * @internal */ get invalid(): boolean; /** * Get whether the control is touched. * * @internal */ get touched(): boolean; /** * Get whether the control is dirty. * * @internal */ get dirty(): boolean; /** @internal */ stateChanges: Subject; /** * Reference to the enclosing `FormFieldComponent`. * * @internal */ formField?: FormFieldComponent; /** * Determine whether the control's content has scroll offset. * * @internal */ hasScroll: _angular_core.WritableSignal; protected injector: Injector; /** @internal */ constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵcmp: _angular_core.ɵɵComponentDeclaration, "ng-component", never, { "required": { "alias": "required"; "required": false; }; }, {}, never, never, true, never>; static ngAcceptInputType_required: unknown; } export { ClearButtonComponent, ControlContainerComponent, FormErrorComponent, FormFieldComponent, FormFieldControl, FormFieldControlBaseComponent, FormFieldSize, FormFieldStatus }; export type { TFormFieldSize, TFormFieldStatus };