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.
70 lines • 3 kB
text/typescript
export default TinyHtmlPasswordInput;
/**
* TinyHtmlPasswordInput is a helper class for managing
* `<input type="password">` elements with validation and attribute control.
*
* @example
* const passwordInput = new TinyHtmlPasswordInput({
* name: 'user-password',
* required: true,
* minlength: 8,
* maxlength: 32,
* pattern: '[A-Za-z0-9]+',
* placeholder: 'Enter your password...'
* });
*/
declare class TinyHtmlPasswordInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlPasswordInput 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] - Name of the input.
* @param {string} [config.pattern] - Regex pattern to validate against.
* @param {string} [config.autocomplete] - Autocomplete hint (e.g., "on", "off", "email").
* @param {number} [config.size] - Number of characters visible.
* @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, minlength, maxlength, name, pattern, autocomplete, size, readonly, required, placeholder, tags, mainClass, }?: {
value?: string | undefined;
minlength?: number | undefined;
maxlength?: number | undefined;
name?: string | undefined;
pattern?: string | undefined;
autocomplete?: string | undefined;
size?: number | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
placeholder?: string | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @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} autocomplete */
set autocomplete(autocomplete: string);
/** @returns {string|null} */
get autocomplete(): string | null;
/** @param {string} value */
set value(value: string);
/** @returns {string} */
get value(): string;
}
import TinyHtmlInput from '../../TinyHtmlInput.mjs';
//# sourceMappingURL=TinyHtmlPasswordInput.d.mts.map