/** * ty-textarea — form-associated textarea that auto-resizes to its content, * within optional min-height/max-height constraints. * * @fires {CustomEvent<{value: string, originalEvent: Event}>} input - Emitted on every edit * @fires {CustomEvent<{value: string, originalEvent: Event}>} change - Emitted on blur, if the value changed (like a native textarea) */ import { TyComponent } from '../base/ty-component.js'; import type { PropertyChange } from '../utils/property-manager.js'; /** For typing TyComponent only — actual state lives in private fields. */ interface TextareaState { value: string; isFocused: boolean; textareaEl: HTMLTextAreaElement | null; dummyEl: HTMLPreElement | null; } export interface TyTextareaElement extends HTMLElement { value?: string; name?: string; placeholder?: string; label?: string; disabled?: boolean; required?: boolean; minLength?: number; maxLength?: number; tooShortMessage?: string; tooLongMessage?: string; error?: string; size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; rows?: string | number; cols?: string | number; resize?: 'none' | 'both' | 'horizontal' | 'vertical'; minHeight?: string; maxHeight?: string; } export declare class TyTextarea extends TyComponent implements TyTextareaElement { static formAssociated: boolean; protected static properties: { value: { type: "string"; visual: boolean; formValue: boolean; emitChange: boolean; default: string; }; name: { type: "string"; default: string; }; placeholder: { type: "string"; visual: boolean; default: string; }; label: { type: "string"; visual: boolean; default: string; }; disabled: { type: "boolean"; visual: boolean; default: boolean; }; required: { type: "boolean"; visual: boolean; default: boolean; }; minlength: { type: "string"; visual: boolean; default: string; }; maxlength: { type: "string"; visual: boolean; default: string; }; tooShortMessage: { type: "string"; visual: boolean; default: string; }; tooLongMessage: { type: "string"; visual: boolean; default: string; }; error: { type: "string"; visual: boolean; default: string; }; size: { type: "string"; visual: boolean; default: import("../types/common.js").Size; validate: (v: any) => boolean; coerce: (v: any) => any; }; rows: { type: "string"; visual: boolean; default: string; coerce: (v: any) => string; }; cols: { type: "string"; visual: boolean; default: string; coerce: (v: any) => string; }; resize: { type: "string"; visual: boolean; default: string; validate: (v: any) => boolean; coerce: (v: any) => any; }; minHeight: { type: "string"; visual: boolean; default: string; }; maxHeight: { type: "string"; visual: boolean; default: string; }; }; private _textareaEl; private _dummyEl; private _scrollbar; private _isFocused; constructor(); protected onConnect(): void; protected onDisconnect(): void; /** Called BEFORE render. Visual property changes re-render automatically. */ protected onPropertiesChanged(changes: PropertyChange[]): void; protected getFormValue(): FormDataEntryValue | null; get value(): string; set value(v: string); get name(): string; set name(v: string); get placeholder(): string; set placeholder(v: string); get label(): string; set label(v: string); get disabled(): boolean; set disabled(v: boolean); /** Focus the inner