UNPKG

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.

89 lines 3.99 kB
export default TinyHtmlTextInput; /** * TinyHtmlTextInput is a helper class for managing `<input type="text">` elements. * It provides validated getters and setters for common text input attributes * such as minlength, maxlength, pattern, autocomplete, and more. * * @example * const input = new TinyHtmlTextInput({ * name: 'username', * placeholder: 'Enter your username', * minlength: 3, * maxlength: 20, * required: true, * autocomplete: 'username' * }); */ declare class TinyHtmlTextInput extends TinyHtmlInput { /** * Creates a new TinyHtmlTextInput instance. * @param {Object} config - Configuration object. * @param {string} [config.value=""] - Initial value. * @param {number} [config.minlength] - Minimum length in UTF-16 code units. * @param {number} [config.maxlength] - Maximum length in UTF-16 code units. * @param {string} [config.name] - The name of the control. * @param {string} [config.pattern] - Regex pattern. * @param {string} [config.autocomplete] - Autocomplete hint ("on", "off", or a token like "email"). * @param {'none'|'sentences'|'words'|'characters'} [config.autocapitalize] - Auto-capitalization mode. * @param {string} [config.dirname] - Name for directionality field (text-based inputs). * @param {number} [config.size] - Size of text input. * @param {string} [config.list] - ID of a <datalist>. * @param {boolean} [config.readonly=false] - Whether the input is read-only. * @param {boolean} [config.required=false] - Whether the input is required. * @param {string} [config.placeholder] - Placeholder text. * @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, list, autocapitalize, placeholder, minlength, maxlength, readonly, required, pattern, size, dirname, autocomplete, name, tags, mainClass, }?: { value?: string | undefined; minlength?: number | undefined; maxlength?: number | undefined; name?: string | undefined; pattern?: string | undefined; autocomplete?: string | undefined; autocapitalize?: "none" | "sentences" | "words" | "characters" | undefined; dirname?: string | undefined; size?: number | undefined; list?: string | undefined; readonly?: boolean | undefined; required?: boolean | undefined; placeholder?: string | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); /** @param {string} value */ set value(value: string); /** @returns {string} */ get value(): string; /** @param {number} minlength */ set minlength(minlength: number); /** @returns {number|null} */ get minlength(): number | null; /** @param {number} maxlength */ set maxlength(maxlength: number); /** @returns {number|null} */ get maxlength(): number | null; /** @param {string} pattern */ set pattern(pattern: string); /** @returns {string|null} */ get pattern(): string | null; /** @param {string} list */ set list(list: string); /** @returns {string|null} */ get list(): string | null; /** @param {'none'|'sentences'|'words'|'characters'} autocapitalize */ set autocapitalize(autocapitalize: "none" | "sentences" | "words" | "characters"); /** @returns {string|null} */ get autocapitalize(): string | null; /** @param {string} autocomplete */ set autocomplete(autocomplete: string); /** @returns {string|null} */ get autocomplete(): string | null; /** @param {string} dirname */ set dirname(dirname: string); /** @returns {string|null} */ get dirname(): string | null; } import TinyHtmlInput from '../../TinyHtmlInput.mjs'; //# sourceMappingURL=TinyHtmlTextInput.d.mts.map