/** * 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 input * @fires {CustomEvent<{value: string, originalEvent: Event}>} change - Emitted on change */ 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; 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; }; 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); get required(): boolean; set required(v: boolean); get error(): string; set error(v: string); get size(): 'xs' | 'sm' | 'md' | 'lg' | 'xl'; set size(v: 'xs' | 'sm' | 'md' | 'lg' | 'xl'); get rows(): string; set rows(v: string | number); get cols(): string; set cols(v: string | number); get resize(): 'none' | 'both' | 'horizontal' | 'vertical'; set resize(v: 'none' | 'both' | 'horizontal' | 'vertical'); get minHeight(): string; set minHeight(v: string); get maxHeight(): string; set maxHeight(v: string); private getFontStyle; private getSpacingStyle; /** Hidden dummy element used to measure the content height. */ private setupDummyElement; /** Resize the textarea to the dummy's measured height, within min/max. */ private resizeTextarea; private _setupScrollbar; private _destroyScrollbar; private emitValueEvents; private handleInputEvent; private handleFocusEvent; private handleBlurEvent; private buildClassList; private applyHeightConstraints; private setupTextareaEvents; protected render(): void; /** required + empty => valueMissing; otherwise valid. Disabled fields are * barred from constraint validation. */ private updateValidity; } export {};