import { r as IDataProvider } from "./data-provider-Cq_ylpET.js"; import { h as ListSelectionMode } from "./list-selection-types-CKTt7Rrw.js"; import "./panel.js"; import { LitElement, PropertyValues, nothing } from "lit"; import { CommandId } from "@clinth/ui-commands"; /** * Fired when the selection set changes by any means. * Event name: `select` */ type SubComponentSelectDetail = { readonly selected: ReadonlySet; readonly previous: ReadonlySet; }; /** * Fired when an item is explicitly activated (double-click or Enter key). * Event name: `activate` */ type SubComponentActivateDetail = { readonly item: T; }; /** * Fired on a raw pointer click before any selection change. * Event name: `item-click` */ type SubComponentItemClickDetail = { readonly item: T; }; /** * Fired when the pointer hovers over an item or the keyboard cursor moves to it. * Event name: `tickle` */ type SubComponentTickleDetail = { readonly item: T; }; type SubComponentSelectEvent = CustomEvent>; type SubComponentActivateEvent = CustomEvent>; type SubComponentItemClickEvent = CustomEvent>; type SubComponentTickleEvent = CustomEvent>; interface IGroupedSubComponentEventMap { 'select': SubComponentSelectEvent; 'activate': SubComponentActivateEvent; 'item-click': SubComponentItemClickEvent; 'tickle': SubComponentTickleEvent; } /** * Contract that sub-components passed to `ixfx-grouped-item-lister` must satisfy. * * All four events (`select`, `activate`, `item-click`, `tickle`) must bubble and be composed * so they propagate through the lister's light DOM to external listeners. */ interface IGroupedSubComponent extends HTMLElement { /** Replace the full item list. Called whenever the lister's items or grouping changes. */ setItems: (items: readonly T[]) => void; /** Clear the current selection without firing a `select` event (avoids re-entrant loops). */ clearSelection: () => void; /** The current selection set. */ readonly selectedItems: ReadonlySet; /** Controls how many items can be selected simultaneously. */ selectionMode: ListSelectionMode; /** * Forward a command (e.g. sort-order change) to this sub-component. * Uses `CommandId` from `@clinth/ui-commands` for interoperability. */ dispatch: (commandId: CommandId, args?: Record) => void; addEventListener: (>(type: K, listener: (event: IGroupedSubComponentEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); } /** * Factory that creates a sub-component for a given group. * Called once per group (or once with `undefined` in ungrouped mode). */ type SubComponentFactory = (groupKey: string | undefined) => HTMLElement & IGroupedSubComponent; /** * Fired by `ixfx-grouped-item-lister` after any sub-component fires `select`. * Carries the full cross-group selection union and the key of the group whose * selection just changed (or `undefined` in ungrouped mode). */ type GroupedSelectDetail = { readonly selected: ReadonlySet; readonly groupKey: string | undefined; }; type GroupedSelectEvent = CustomEvent>; interface GroupedItemListerElementEventMap { 'grouped-select': GroupedSelectEvent; } declare class GroupedItemListerElement extends LitElement { #private; grouped: boolean; crossGroupSelection: boolean; get groupBy(): ((item: T) => string) | undefined; set groupBy(value: ((item: T) => string) | undefined); get factory(): SubComponentFactory | undefined; set factory(value: SubComponentFactory | undefined); get provider(): IDataProvider | undefined; set provider(value: IDataProvider | undefined); /** The union of all selected items across every sub-component. */ get selectedItems(): ReadonlySet; /** * Forward a command to all live sub-components. * Use this to propagate changes like sort order, filter state, or view mode. */ dispatch(commandId: CommandId, args?: Record): void; protected createRenderRoot(): this; connectedCallback(): void; disconnectedCallback(): void; protected updated(changed: PropertyValues): void; protected render(): import("lit").TemplateResult<1> | typeof nothing; } declare global { interface HTMLElementTagNameMap { 'ixfx-grouped-item-lister': GroupedItemListerElement; } } interface GroupedItemListerElement { addEventListener: (>(type: K, listener: (this: GroupedItemListerElement, event: GroupedItemListerElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); } export { IGroupedSubComponent as a, SubComponentActivateEvent as c, SubComponentItemClickEvent as d, SubComponentSelectDetail as f, SubComponentTickleEvent as h, GroupedSelectEvent as i, SubComponentFactory as l, SubComponentTickleDetail as m, GroupedItemListerElementEventMap as n, IGroupedSubComponentEventMap as o, SubComponentSelectEvent as p, GroupedSelectDetail as r, SubComponentActivateDetail as s, GroupedItemListerElement as t, SubComponentItemClickDetail as u };