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.
54 lines • 2.55 kB
text/typescript
export default TinyHtmlButtonInput;
/**
* TinyHtmlButtonInput is a helper class for managing `<input type="button">` elements.
* It provides validation and easy configuration for standard and button-specific attributes.
*
* @example
* const button = new TinyHtmlButtonInput({
* value: 'Click me',
* name: 'myButton',
* popovertarget: 'popoverId',
* popovertargetaction: 'toggle'
* });
*/
declare class TinyHtmlButtonInput extends TinyHtmlInput {
/**
* Creates a new TinyHtmlButtonInput instance.
* @param {Object} config - Configuration object.
* @param {string} [config.name] - The name of the input.
* @param {string} [config.placeholder] - Placeholder text (non-standard for buttons).
* @param {string} [config.popovertarget] - The ID of the target popover.
* @param {"show"|"hide"|"toggle"} [config.popovertargetaction] - The action applied to the popover.
* @param {string|number} [config.value="Button"] - The label displayed on the button.
* @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 applied.
* @throws {TypeError} If attributes are of the wrong type.
*/
constructor({ value, tags, placeholder, popovertarget, popovertargetaction, readonly, required, name, mainClass, }?: {
name?: string | undefined;
placeholder?: string | undefined;
popovertarget?: string | undefined;
popovertargetaction?: "hide" | "show" | "toggle" | undefined;
value?: string | number | undefined;
readonly?: boolean | undefined;
required?: boolean | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/** @param {string|number} value */
set value(value: string | number);
/** @returns {string|null} */
get value(): string | null;
/** @param {string} popovertarget */
set popovertarget(popovertarget: string);
/** @returns {string|null} */
get popovertarget(): string | null;
/** @param {"show"|"hide"|"toggle"} action */
set popovertargetaction(action: "show" | "hide" | "toggle");
/** @returns {string|null} */
get popovertargetaction(): string | null;
}
import TinyHtmlInput from '../../TinyHtmlInput.mjs';
//# sourceMappingURL=TinyHtmlButtonInput.d.mts.map