/**
* ty-textarea - Enhanced textarea component with auto-resize functionality
*
* Features:
* - Auto-resize based on content
* - Form-associated custom element
* - Min/max height constraints
* - Size variants (xs, sm, md, lg, xl)
* - Validation states (error, required)
* - Manual resize control options
* - Accessibility support
*
* @example
* ```html
*
*
*
*
*
*
*
*
*
*
*
*
*
* ```
*
* @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';
/**
* Component internal state (for typing TyComponent)
* Actual state stored as 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: string;
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();
/**
* Called when component connects to DOM
* TyComponent already handled pre-connection property capture
*/
protected onConnect(): void;
/**
* Called when component disconnects from DOM
*/
protected onDisconnect(): void;
/**
* Handle property changes - called BEFORE render
* This replaces the old attributeChangedCallback logic
*/
protected onPropertiesChanged(changes: PropertyChange[]): void;
/**
* Override form value to return current value
*/
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);
/**
* Extract font-related CSS properties from element
*/
private getFontStyle;
/**
* Extract spacing-related CSS properties from element
*/
private getSpacingStyle;
/**
* Setup the hidden dummy element for height measurement
*/
private setupDummyElement;
/**
* Resize textarea based on dummy element content with min/max height constraints
*/
private resizeTextarea;
private _setupScrollbar;
private _destroyScrollbar;
/**
* Emit custom input and change events
*/
private emitValueEvents;
/**
* Handle textarea input event
*/
private handleInputEvent;
/**
* Handle textarea focus event
*/
private handleFocusEvent;
/**
* Handle textarea blur event
*/
private handleBlurEvent;
/**
* Build class list for textarea element
*/
private buildClassList;
/**
* Apply min/max height constraints to textarea element
*/
private applyHeightConstraints;
/**
* Setup event listeners for textarea
*/
private setupTextareaEvents;
protected render(): void;
}
export {};
//# sourceMappingURL=textarea.d.ts.map