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.
74 lines • 2.94 kB
text/typescript
export default TinyHtmlNumberInput;
/**
* TinyHtmlNumberInput is a helper class for managing <input type="number"> elements.
* It provides typed getters and setters for standard number input attributes
* such as min, max, step, value, and more.
*
* @example
* const numberInput = new TinyHtmlNumberInput({
* min: 0,
* max: 100,
* step: 5,
* value: 10,
* required: true
* });
*/
declare class TinyHtmlNumberInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlNumberInput instance.
* @param {Object} config - Configuration object.
* @param {number} [config.value] - Initial numeric value.
* @param {number} [config.min] - Minimum allowed value.
* @param {number} [config.max] - Maximum allowed value.
* @param {number} [config.step] - Step size.
* @param {string} [config.name] - Name of the control.
* @param {string} [config.placeholder] - Placeholder text.
* @param {string} [config.autocomplete] - Autocomplete hint (e.g., "on", "off", "email").
* @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|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, min, max, step, readonly, required, name, placeholder, autocomplete, tags, mainClass, }?: {
value?: number | undefined;
min?: number | undefined;
max?: number | undefined;
step?: number | undefined;
name?: string | undefined;
placeholder?: string | undefined;
autocomplete?: string | undefined;
list?: string | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {number} value */
set value(value: number);
/** @returns {number} */
get value(): number;
/** @param {number} min */
set min(min: number);
/** @returns {number|null} */
get min(): number | null;
/** @param {number} max */
set max(max: number);
/** @returns {number|null} */
get max(): number | null;
/** @param {number} step */
set step(step: number);
/** @returns {number|null} */
get step(): number | null;
/** @param {string} list */
set list(list: string);
/** @returns {string|null} */
get list(): string | null;
/** @param {string} autocomplete */
set autocomplete(autocomplete: string);
/** @returns {string|null} */
get autocomplete(): string | null;
}
import TinyHtmlInput from '../../TinyHtmlInput.mjs';
//# sourceMappingURL=TinyHtmlNumberInput.d.mts.map