import { Listbox as FluentListbox } from "@fluentui/web-components"; import type { DropdownOption } from "../option/index.js"; /** * Listbox * @summary A Listbox Custom HTML Element that allows for single or multiple selection from a list of options. * Extends the Fluent Listbox to support option groups ({@link @fabric-msft/fabric-web#OptionGroup}). * * @example * ```html * * Option 1 * Option 2 * Option 3 * * ``` * * @example * ```html * * * Apple * Banana * * * Carrot * * * ``` * * @attr {string} id - Sets the listbox ID to a unique value if one is not provided. * @attr {boolean | undefined} multiple - Indicates whether the listbox allows multiple selection. * * @prop {Array} options - The collection of child options that are not disabled. * @prop {Array} selectedOptions - The collection of child options that are selected. * @prop {number} selectedIndex - The index of the currently selected option. * * @slot - The default slot for the options and option groups. * * @method multipleChanged - Updates the multiple selection state of the listbox and its options. Parameters: prev (boolean | undefined), next (boolean | undefined). * @method clickHandler - Sets the `selected` state on a target option when clicked. Parameters: e (PointerEvent). * @method selectOption - Selects an option by index. Parameters: index (number). * * @fires connected - Dispatched when the element is connected to the DOM. * * @extends FluentListbox * @tagname fabric-listbox * @public */ export declare class Listbox extends FluentListbox { /** * Checks if an option belongs to a disabled option group. * * @param option - The option to check. * @returns true if the option is inside a disabled option group. * @internal */ private isOptionInDisabledGroup; /** * Sets the `selected` state on a target option when clicked. * Overrides the base implementation to prevent selection of options in disabled groups. * * @param e - The pointer event * @override * @public */ clickHandler(e: PointerEvent): boolean | void; /** * Selects an option by index. * Overrides the base implementation to prevent selection of options in disabled groups. * * @param index - The index of the option to select. * @override * @public */ selectOption(index?: number): void; /** * Handles the slotchange event for the listbox. * Overrides the base implementation to support option groups. * Extracts options from both direct option elements and option group children, * flattening them into a single options array while propagating group disabled states. * * @param e - The slot change event. * @override * @internal */ slotchangeHandler(e: Event): void; /** * Handles changes to the options collection. * Overrides the base implementation to apply group-aware ARIA positioning. * * @param prev - The previous options collection. * @param next - The new options collection. * @override * @internal */ optionsChanged(prev: DropdownOption[] | undefined, next: DropdownOption[] | undefined): void; /** * Build a list of groups and options * @param options * @param groups */ private setOptionGroups; /** * Applies group-scoped ARIA positioning attributes to options. * Options within the same group share aria-setsize scoped to that group. * * @param options - The flattened options collection. * @internal */ private applyGroupScopedAria; /** * Updates the multiple selection state of the listbox and its options. * * @param prev - the previous multiple value * @param next - the current multiple value */ multipleChanged(prev: boolean | undefined, next: boolean | undefined): void; } //# sourceMappingURL=listbox.d.ts.map