import { EventEmitter, OnChanges } from '@angular/core'; import { SafeHtml } from '@angular/platform-browser'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { ButtonVariant } from '../button/button'; import * as i0 from "@angular/core"; /** Size variant of a `compsych-text-input`. Controls input height, padding, and font size. */ export type TextInputSize = 'small' | 'medium' | 'large'; /** Native input type. */ export type TextInputType = 'text' | 'password'; /** Configuration for the optional button rendered at the right of the label row. */ export interface TextInputLabelButton { /** Stable identifier emitted by `labelButtonClick` when clicked. */ id: string; /** Text displayed on the button. */ label: string; /** Visual style of the button. Defaults to `'text'`. */ variant?: ButtonVariant; /** Lucide icon name shown before the label. */ leadingIcon?: string; /** Lucide icon name shown after the label. */ trailingIcon?: string; /** Hides the label and renders a square icon-only button. Requires `leadingIcon`. */ iconOnly?: boolean; } /** * A labelled text input that wraps a native `` element. * Implements `ControlValueAccessor` so it works with both reactive forms * (`formControlName`, `[formControl]`) and template-driven forms (`ngModel`). * The error visual state is driven automatically by the bound `FormControl`'s * validity once the field has been touched, and can also be set explicitly via * the `error` input for use outside of Angular forms. */ export declare class TextInputComponent implements ControlValueAccessor, OnChanges { private readonly _autoId; private readonly cdr; private readonly sanitizer; private _onChange; private _onTouched; /** Injected when the component is used inside a reactive or template-driven form. */ protected readonly ngControl: NgControl | null; constructor(); /** Label displayed above the input. */ label: string; /** Placeholder text shown inside the input when empty. */ placeholder: string; /** Current value of the input. When used in a form, the form controls the value. */ value: string; /** Native input type. Defaults to `'text'`. Use `'password'` to mask the value. */ type: TextInputType; /** Size variant — controls height, padding, and font size. Defaults to `'medium'`. */ size: TextInputSize; /** Native `name` attribute forwarded to the ``. Defaults to the auto-generated id. */ name?: string; /** Native `id` attribute for the ``. Auto-generated if omitted. */ id?: string; /** * Id(s) of external elements that describe the input, space-separated. * Forwarded to `aria-describedby` on the native ``. */ ariaDescribedBy?: string; /** Text displayed below the input. Shown in red when the input is in error state. */ supportingText: string; /** * Static error text shown in red when the input is in error state. * Used when the input is outside a form (with `[error]="true"`). * When inside a form, prefer `errorMessages` for per-validator messages. */ errorMessage: string; /** * Map of Angular validator error keys to display strings. * The component reads `ngControl.errors` to determine which validator failed * and shows the matching message in red below the input. * Example: `{ required: 'Username is required', minlength: 'Min 8 characters' }` */ errorMessages: Record; private _labelButton; /** * JSON string configuring the optional button at the right of the label row. * Hidden when empty or omitted. Example: `'{"id":"show","label":"Show"}'` * Clicking emits the button's `id` via the `labelButtonClick` output. */ set labelButton(json: string); /** @internal Template access to the parsed label button config. */ protected get parsedLabelButton(): TextInputLabelButton | null; /** * Adds a blue asterisk after the label. When used in a form, this is set * automatically if the bound `FormControl` has `Validators.required`. * Can also be set explicitly for non-form use. Supports boolean coercion. */ required: boolean; /** * Applies the error visual state (red border) explicitly. When used in a form, * the error state is driven automatically from the `FormControl`'s validity once * the field is touched — this input is only needed outside of forms. * Supports boolean coercion. */ error: boolean; /** Disables the input. When used in a form, also responds to `FormControl.disable()`. Supports boolean coercion. */ disabled: boolean; /** Makes the input read-only — focusable and copyable but not editable. Value is still submitted with the form. Supports boolean coercion. */ readonly: boolean; /** Visually hides the label while keeping it accessible to screen readers. Supports boolean coercion. */ hideLabel: boolean; /** Lucide icon name rendered inside the input before the text (e.g. `'search'`). */ leadingIcon?: string; /** Lucide icon name rendered inside the input after the text (e.g. `'eye'`). */ trailingIcon?: string; /** Accessible label for the trailing icon button. Required when `trailingIconClick` is used. */ trailingIconAriaLabel: string; protected leadingIconSvg: SafeHtml | null; protected trailingIconSvg: SafeHtml | null; ngOnChanges(): void; private buildIconSvg; /** Emits the new string value whenever the user types. For use outside Angular forms; inside forms use the `FormControl` value stream. */ readonly valueChange: EventEmitter; /** Emits the label button's `id` when it is clicked. */ readonly labelButtonClick: EventEmitter; /** Emitted when the trailing icon button is clicked. When observed, the trailing icon renders as an interactive button. */ readonly trailingIconClick: EventEmitter; get inputId(): string; /** True when the bound FormControl is invalid and touched, or when `error` is explicitly set. */ get hasError(): boolean; /** True when `required` is set explicitly, or when the bound FormControl has Validators.required. */ get isRequired(): boolean; private get activeErrorMessage(); get displayedSupportingText(): string; get describedBy(): string | null; get wrapperClasses(): string; writeValue(value: string | null): void; registerOnChange(fn: (value: string) => void): void; registerOnTouched(fn: () => void): void; /** Called by Angular when the bound FormControl is programmatically disabled or enabled. */ setDisabledState(isDisabled: boolean): void; protected onInput(event: Event): void; protected onBlur(): void; protected onLabelButtonClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_required: unknown; static ngAcceptInputType_error: unknown; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_readonly: unknown; static ngAcceptInputType_hideLabel: unknown; }