import TinyHtmlTemplate from './TinyHtmlTemplate.mjs';
export type DatalistOption = {
value: string;
label?: string;
};
/**
* @typedef {{value: string, label?: string}} DatalistOption
*/
/**
* TinyHtmlDatalist is a helper class for creating and managing elements.
* A provides predefined options for elements via the `list` attribute.
*
* Only children are valid inside .
*
* @example
* const datalist = new TinyHtmlDatalist({ id: 'browsers' });
* datalist.addOption({ value: 'Firefox' });
* datalist.addOption({ value: 'Chrome' });
* document.body.appendChild(datalist.el);
*
*
*
* @extends TinyHtmlTemplate
*/
declare class TinyHtmlDatalist extends TinyHtmlTemplate {
/**
* Creates a new TinyHtmlDatalist instance.
* @param {Object} config - Configuration object.
* @param {string} [config.id] - The unique identifier for the datalist (to be linked with ).
* @param {string|string[]|Set} [config.tags=[]] - Initial CSS classes.
* @param {string} [config.mainClass=""] - Main CSS class.
* @param {Array} [config.options=[]] - Initial elements.
*/
constructor({ id, tags, mainClass, options }?: {
id?: string;
tags?: string | string[] | Set;
mainClass?: string;
options?: Array;
});
/** @param {Array} options */
set options(options: Array);
/** @returns {Array} */
get options(): Array;
/**
* Adds a new to the datalist.
* @param {Object} config - Option configuration.
* @param {string} config.value - The value of the option (required).
* @param {string} [config.label] - Optional label for accessibility or display.
* @returns {HTMLOptionElement} The created element.
*/
addOption({ value, label }: {
value: string;
label?: string;
}): HTMLOptionElement;
/**
* Removes an option by its value.
* @param {string} value - The value of the option to remove.
* @returns {boolean} True if an option was removed, false otherwise.
*/
removeOption(value: string): boolean;
}
export default TinyHtmlDatalist;
//# sourceMappingURL=TinyHtmlDatalist.d.mts.map