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.
75 lines • 3.05 kB
text/typescript
export default TinyHtmlRangeInput;
/**
* TinyHtmlRangeInput is a helper class for managing <input type="range"> elements.
* It provides validation and convenient getters/setters for standard attributes
* such as min, max, step, value, autocomplete, and list.
*
* @example
* const range = new TinyHtmlRangeInput({
* min: 0,
* max: 100,
* step: 5,
* value: 50,
* name: 'volume',
* required: true
* });
*/
declare class TinyHtmlRangeInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlRangeInput instance.
* @param {Object} config - Configuration object.
* @param {number} [config.min] - Minimum numeric value allowed.
* @param {number} [config.max] - Maximum numeric value allowed.
* @param {number} [config.step] - Step size for the value.
* @param {number} [config.value] - Initial value of the range input.
* @param {string} [config.name] - Name of the control.
* @param {string} [config.autocomplete] - Autocomplete hint ("on", "off", "email", etc.).
* @param {string} [config.list] - ID of an associated <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 (not commonly used for range).
* @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes.
* @param {string} [config.mainClass=''] - Main CSS class.
* @throws {TypeError} If any attribute has an invalid type.
*/
constructor({ min, max, step, value, name, placeholder, autocomplete, list, readonly, required, tags, mainClass, }?: {
min?: number | undefined;
max?: number | undefined;
step?: number | undefined;
value?: number | undefined;
name?: string | undefined;
autocomplete?: string | undefined;
list?: string | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
placeholder?: string | 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=TinyHtmlRangeInput.d.mts.map