tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
139 lines • 6.3 kB
text/typescript
export default TinyHtmlTextarea;
/**
* TinyTextarea is a helper class for managing <textarea> elements.
* It allows configuring all standard attributes such as rows, cols, placeholder,
* autocomplete, spellcheck, and more, with validation.
*
* @example
* const textarea = new TinyHtmlTextarea({
* rows: 5,
* placeholder: 'Write here...',
* required: true,
* maxlength: 200
* });
*
* @extends TinyHtmlTemplate<HTMLTextAreaElement>
*/
declare class TinyHtmlTextarea extends TinyHtmlTemplate<HTMLTextAreaElement> {
/**
* Creates a new TinyTextarea instance.
* @param {Object} config - Configuration object.
* @param {string} [config.value=""] - Initial text inside the textarea.
* @param {number} [config.rows] - Number of visible text lines.
* @param {number} [config.cols] - Number of character columns.
* @param {string} [config.placeholder] - Placeholder text.
* @param {'none'|'sentences'|'words'|'characters'|'on'|'off'} [config.autocapitalize] - Controls automatic capitalization.
* @param {string} [config.autocomplete] - Autocomplete behavior ("on", "off", or token list).
* @param {'on'|'off'|boolean} [config.autocorrect] - Autocorrect behavior ("on" or "off").
* @param {boolean} [config.autofocus=false] - Whether the textarea should autofocus on load.
* @param {string} [config.dirname] - Directionality of submitted text.
* @param {boolean} [config.disabled=false] - Whether the textarea is disabled.
* @param {string} [config.form] - The id of the associated form.
* @param {number} [config.maxlength] - Maximum length in UTF-16 code units.
* @param {number} [config.minlength] - Minimum length in UTF-16 code units.
* @param {string} [config.name] - The name of the control.
* @param {boolean} [config.readonly=false] - Whether the textarea is read-only.
* @param {boolean} [config.required=false] - Whether the textarea is required.
* @param {true|false|"true"|"false"|"default"} [config.spellcheck] - Spellcheck behavior.
* @param {"hard"|"soft"|"off"} [config.wrap] - Wrapping behavior.
* @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes.
* @param {string} [config.mainClass=''] - Main CSS class.
* @throws {TypeError} If any attribute is of the wrong type.
*/
constructor({ value, rows, cols, placeholder, autocapitalize, autocomplete, autocorrect, autofocus, dirname, disabled, form, maxlength, minlength, name, readonly, required, spellcheck, wrap, tags, mainClass, }?: {
value?: string | undefined;
rows?: number | undefined;
cols?: number | undefined;
placeholder?: string | undefined;
autocapitalize?: "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
autocomplete?: string | undefined;
autocorrect?: boolean | "off" | "on" | undefined;
autofocus?: boolean | undefined;
dirname?: string | undefined;
disabled?: boolean | undefined;
form?: string | undefined;
maxlength?: number | undefined;
minlength?: number | undefined;
name?: string | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
spellcheck?: boolean | "false" | "true" | "default" | undefined;
wrap?: "off" | "soft" | "hard" | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string} value */
set value(value: string);
/** @returns {string} */
get value(): string;
/** @param {number} rows */
set rows(rows: number);
/** @returns {number|null} */
get rows(): number | null;
/** @param {number} cols */
set cols(cols: number);
/** @returns {number|null} */
get cols(): number | null;
/** @param {string} placeholder */
set placeholder(placeholder: string);
/** @returns {string|null} */
get placeholder(): string | null;
/** @param {'none'|'sentences'|'words'|'characters'|'on'|'off'} autocapitalize */
set autocapitalize(autocapitalize: "none" | "sentences" | "words" | "characters" | "on" | "off");
/** @returns {string|null} */
get autocapitalize(): string | null;
/** @param {string} autocomplete */
set autocomplete(autocomplete: string);
/** @returns {string|null} */
get autocomplete(): string | null;
/** @param {'on'|'off'|boolean} autocorrect */
set autocorrect(autocorrect: "on" | "off" | boolean);
/** @returns {boolean|null} */
get autocorrect(): boolean | null;
/** @param {boolean} autofocus */
set autofocus(autofocus: boolean);
/** @returns {boolean} */
get autofocus(): boolean;
/** @param {string} dirname */
set dirname(dirname: string);
/** @returns {string|null} */
get dirname(): string | null;
/** @param {boolean} disabled */
set disabled(disabled: boolean);
/** @returns {boolean} */
get disabled(): boolean;
/** @param {string} form */
set form(form: string);
/** @returns {string|null} */
get form(): string | null;
/** @param {number} maxlength */
set maxlength(maxlength: number);
/** @returns {number|null} */
get maxlength(): number | null;
/** @param {number} minlength */
set minlength(minlength: number);
/** @returns {number|null} */
get minlength(): number | null;
/** @param {string} name */
set name(name: string);
/** @returns {string|null} */
get name(): string | null;
/** @param {boolean} readonly */
set readonly(readonly: boolean);
/** @returns {boolean} */
get readonly(): boolean;
/** @param {boolean} required */
set required(required: boolean);
/** @returns {boolean} */
get required(): boolean;
/** @param {'true'|'false'|boolean|'default'} spellcheck */
set spellcheck(spellcheck: "true" | "false" | boolean | "default");
/** @returns {string|null} */
get spellcheck(): string | null;
/** @param {'hard'|'soft'|'off'} wrap */
set wrap(wrap: "hard" | "soft" | "off");
/** @returns {string|null} */
get wrap(): string | null;
}
import TinyHtmlTemplate from './TinyHtmlTemplate.mjs';
//# sourceMappingURL=TinyHtmlTextarea.d.mts.map