import TinyHtml from '../TinyHtml.mjs'; import TinyHtmlTemplate from './TinyHtmlTemplate.mjs'; /** * TinyHtmlSelect is a helper class for managing elements. * It supports all standard attributes (multiple, autocomplete, autofocus, disabled, etc.) * and provides helpers for managing elements. * * @example * const select = new TinyHtmlSelect({ * options: [ * { value: '1', label: 'One' }, * { value: '2', label: 'Two', selected: true } * ], * multiple: true, * required: true, * size: 5, * name: 'numbers', * }); * * @extends TinyHtmlTemplate */ declare class TinyHtmlSelect extends TinyHtmlTemplate { /** * Creates a new custom element with configurable options and attributes. * * @param {Object} [config={}] Configuration object for the select element. * @param {Array<{ * value: string, * label: string | Element | TinyHtml, * selected?: boolean, * allowHtml?: boolean * }>} [config.options=[]] * An array of option definitions. Each option must provide a `value` and a `label`. * The `label` can be a string, a DOM element, or a TinyHtml instance. * The `selected` flag sets the option as initially selected. * If `allowHtml` is true, the label will be interpreted as HTML instead of plain text. * * @param {boolean} [config.multiple=false] * If true, allows selecting multiple options. * * @param {string} [config.autocomplete] * Provides autocomplete hints for the control. * Possible values include `"on"` or `"off"`. * * @param {boolean} [config.autofocus=false] * If true, the element will automatically receive focus when the page loads. * * @param {boolean} [config.disabled=false] * If true, disables the select element so it cannot be interacted with. * * @param {string} [config.form] * Associates the select element with the `id` of a form element. * * @param {string} [config.name] * The name of the select control, used when submitting forms. * * @param {boolean} [config.required=false] * If true, the control must be selected before submitting the form. * * @param {number} [config.size] * Defines the number of visible options in the dropdown (without scrolling). * * @param {string | string[] | Set} [config.tags=[]] * A set of tags or CSS classes that can be used for styling or categorization. * * @param {string} [config.mainClass=''] * A primary CSS class name to be applied to the select element. */ constructor({ options, multiple, autocomplete, autofocus, disabled, form, name, required, size, tags, mainClass, }?: { options?: Array<{ value: string; label: string | Element | TinyHtml; selected?: boolean; allowHtml?: boolean; }>; multiple?: boolean; autocomplete?: string; autofocus?: boolean; disabled?: boolean; form?: string; name?: string; required?: boolean; size?: number; tags?: string | string[] | Set; mainClass?: string; }); /** @param {boolean} multiple */ set multiple(multiple: boolean); /** @returns {boolean} */ get multiple(): boolean; /** @param {string} autocomplete */ set autocomplete(autocomplete: string); /** @returns {string|null} */ get autocomplete(): string | null; /** @param {boolean} autofocus */ set autofocus(autofocus: boolean); /** @returns {boolean} */ get autofocus(): boolean; /** @param {boolean} disabled */ set disabled(disabled: boolean); /** @returns {boolean} */ get disabled(): boolean; /** @param {string} form */ set form(form: string); /** @returns {string|null} */ get form(): string | null; /** @param {string} name */ set name(name: string); /** @returns {string|null} */ get name(): string | null; /** @param {boolean} required */ set required(required: boolean); /** @returns {boolean} */ get required(): boolean; /** @param {number} size */ set sizeEl(size: number); /** @returns {number|null} */ get sizeEl(): number | null; /** * Adds an option element. * @param {{ value: string, label: string|Element|TinyHtml, selected?: boolean, allowHtml?: boolean }} option * @returns {this} */ addOption({ value, label, allowHtml, selected }: { value: string; label: string | Element | TinyHtml; selected?: boolean; allowHtml?: boolean; }): this; /** @returns {string} */ get value(): string; /** @param {string} val */ set value(val: string); /** @returns {string[]} */ get values(): string[]; /** @param {string[]} vals */ set values(vals: string[]); /** * Internal: apply selection to options. * @param {string|string[]} value * @returns {this} */ setValue(value: string | string[]): this; } export default TinyHtmlSelect; //# sourceMappingURL=TinyHtmlSelect.d.mts.map