import { SelectorElement } from '../Selector/SelectorElement'; import type { SelectorItemElement } from '../Selector/SelectorItemElement'; import type { IMultiSelectorElementProps } from './IMultiSelectorElementProps'; /** * Multi Selector - An abstract foundation for components supporting multiple simultaneous item selections. * * @description * The MultiSelectorElement extends the base SelectorElement to provide multi-selection capabilities, * allowing users to select multiple items concurrently from a collection. This element maintains * an array of selected items, handles toggle behavior (selecting an already-selected item will * deselect it), and emits selection change events for reactive UI updates. It is designed to be * extended by concrete implementations such as checkbox lists, multi-select dropdowns, tag pickers, * chip selectors, or any component requiring multi-item selection patterns. The element integrates * with keyboard navigation and provides comprehensive selection state management. * * @name Multi Selector * @category Selectors * * @fires selectionChanged {SelectionChangedEvent} - Fired when any item is selected or deselected, providing old and new selected items * @fires itemsChanged {ItemsChangedEvent} - Fired when the slotted items collection changes * @fires changed {PropertyChangedEvent} - Fired when any property changes * @fires connected {ConnectedEvent} - Fired when the element is connected to the DOM * * @keyhandle Home - Selects or toggles the first item * @keyhandle End - Selects or toggles the last item * * @example * Extending for a multi-select list: * ```typescript * class CheckboxListElement extends MultiSelectorElement { * constructor() { * super(); * this.selectionChanged.subscribe(({ oldValue, newValue }) => { * console.log('Selection changed:', this.selectedItems); * }); * } * } * ``` * * @example * Using multi-selection with custom items: * ```html * * Apple * Banana * Orange * * ``` * * @example * Accessing selected items programmatically: * ```typescript * const multiSelect = document.querySelector('my-multi-selector'); * multiSelect.select(0); // Select first item * multiSelect.select(2); // Select third item (both now selected) * console.log(multiSelect.selectedItems); // Array of selected item elements * ``` * * @example * Listening to selection changes: * ```typescript * const selector = document.querySelector('my-multi-selector'); * selector.addEventListener('selectionChanged', (event) => { * const selected = event.target.selectedItems; * console.log(`${selected.length} items selected`); * selected.forEach(item => console.log(item.value)); * }); * ``` * * @public * @abstract */ export declare abstract class MultiSelectorElement extends SelectorElement implements IMultiSelectorElementProps { private readonly _selectedItems; /** * @public */ constructor(); /** * Returns the `is` property. * The `is` property represents natural name of this element. * * @public * @static * @override * @readonly */ static get is(): string; /** * Gets the first item in the current selection or returns null if the selection is empty. * * @private * @readonly */ get selectedItems(): Array; /** * @protected * @override */ protected onSelectionChanged(oldIndex: number, newIndex: number, cb?: ((prev: TItem | null | undefined, next: TItem | null | undefined) => void)): void; } //# sourceMappingURL=MultiSelectorElement.d.ts.map