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.
76 lines • 2.95 kB
text/typescript
export default TinyHtmlInput;
/**
* TinyHtmlInput is a helper class for managing <input> elements.
* It allows configuring all standard attributes such as type, value, placeholder,
* name, and form-related flags with validation.
*
* @example
* const input = new TinyHtmlInput({
* type: 'text',
* placeholder: 'Your name',
* required: true
* });
*
* @extends TinyHtmlTemplate<HTMLInputElement>
*/
declare class TinyHtmlInput extends TinyHtmlTemplate<HTMLInputElement> {
/**
* Creates a new TinyHtmlInput instance.
* @param {Object} config - Configuration object.
* @param {string} [config.type="text"] - Input type (e.g., "text", "password", "email").
* @param {string} [config.placeholder] - Placeholder text.
* @param {string} [config.name] - Input name.
* @param {boolean} [config.disabled=false] - Whether input is disabled.
* @param {boolean} [config.readonly=false] - Whether input is readonly.
* @param {boolean} [config.required=false] - Whether input is required.
* @param {string} [config.form] - ID of a form element.
* @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({ type, placeholder, name, disabled, readonly, required, form, tags, mainClass, }?: {
type?: string | undefined;
placeholder?: string | undefined;
name?: string | undefined;
disabled?: boolean | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
form?: string | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string} type */
set type(type: string);
/** @returns {string|null} */
get type(): string | null;
/** @param {string} placeholder */
set placeholder(placeholder: string);
/** @returns {string|null} */
get placeholder(): string | null;
/** @param {string} name */
set name(name: string);
/** @returns {string|null} */
get name(): string | null;
/** @param {boolean} disabled */
set disabled(disabled: boolean);
/** @returns {boolean} */
get disabled(): boolean;
/** @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 {string} form */
set form(form: string);
/** @returns {string|null} */
get form(): string | null;
/** @param {number} size */
set sizeEl(size: number);
/** @returns {number|null} */
get sizeEl(): number | null;
}
import TinyHtmlTemplate from './TinyHtmlTemplate.mjs';
//# sourceMappingURL=TinyHtmlInput.d.mts.map