@bazza-ui/react 0.0.0 → 0.1.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ListboxStore-BtcTXpzi.d.cts +351 -0
- package/dist/ListboxStore-DPqpLlAL.d.ts +351 -0
- package/dist/adapters/index.cjs +2 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +363 -0
- package/dist/adapters/index.d.ts +363 -0
- package/dist/adapters/index.js +2 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/chunk-4C666HHU.js +2 -0
- package/dist/chunk-4C666HHU.js.map +1 -0
- package/dist/chunk-AVZ64JQ3.js +2 -0
- package/dist/chunk-AVZ64JQ3.js.map +1 -0
- package/dist/chunk-BGJJC6GX.cjs +2 -0
- package/dist/chunk-BGJJC6GX.cjs.map +1 -0
- package/dist/chunk-FWWOE2SW.cjs +2 -0
- package/dist/chunk-FWWOE2SW.cjs.map +1 -0
- package/dist/chunk-JSPKF52O.cjs +2 -0
- package/dist/chunk-JSPKF52O.cjs.map +1 -0
- package/dist/chunk-KWGD24VS.js +2 -0
- package/dist/chunk-KWGD24VS.js.map +1 -0
- package/dist/chunk-M4G6J7DP.cjs +2 -0
- package/dist/chunk-M4G6J7DP.cjs.map +1 -0
- package/dist/chunk-WKAPAKUL.js +2 -0
- package/dist/chunk-WKAPAKUL.js.map +1 -0
- package/dist/combobox/index.cjs +2 -0
- package/dist/combobox/index.cjs.map +1 -0
- package/dist/combobox/index.d.cts +1039 -0
- package/dist/combobox/index.d.ts +1039 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/command-score-Dgo3ZS3Z.d.ts +36 -0
- package/dist/command-score-YjNr3ZWi.d.cts +36 -0
- package/dist/context-menu/index.cjs +2 -0
- package/dist/context-menu/index.cjs.map +1 -0
- package/dist/context-menu/index.d.cts +658 -0
- package/dist/context-menu/index.d.ts +658 -0
- package/dist/context-menu/index.js +2 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/data-surface-B-eIGTBi.d.cts +678 -0
- package/dist/data-surface-D1OilMDu.d.ts +678 -0
- package/dist/dropdown-menu/index.cjs +2 -0
- package/dist/dropdown-menu/index.cjs.map +1 -0
- package/dist/dropdown-menu/index.d.cts +700 -0
- package/dist/dropdown-menu/index.d.ts +700 -0
- package/dist/dropdown-menu/index.js +2 -0
- package/dist/dropdown-menu/index.js.map +1 -0
- package/dist/events-BPr8sRGH.d.cts +166 -0
- package/dist/events-BPr8sRGH.d.ts +166 -0
- package/dist/input-BoIK003I.d.cts +41 -0
- package/dist/input-DF7D8YzW.d.ts +41 -0
- package/dist/internal/listbox/index.cjs +2 -0
- package/dist/internal/listbox/index.cjs.map +1 -0
- package/dist/internal/listbox/index.d.cts +269 -0
- package/dist/internal/listbox/index.d.ts +269 -0
- package/dist/internal/listbox/index.js +2 -0
- package/dist/internal/listbox/index.js.map +1 -0
- package/dist/internal/popup-menu/index.cjs +2 -0
- package/dist/internal/popup-menu/index.cjs.map +1 -0
- package/dist/internal/popup-menu/index.d.cts +846 -0
- package/dist/internal/popup-menu/index.d.ts +846 -0
- package/dist/internal/popup-menu/index.js +2 -0
- package/dist/internal/popup-menu/index.js.map +1 -0
- package/dist/item-equality-B6TbXlBT.d.cts +7 -0
- package/dist/item-equality-B6TbXlBT.d.ts +7 -0
- package/dist/loading-DphSt8MY.d.cts +27 -0
- package/dist/loading-TsgH6v92.d.ts +27 -0
- package/dist/select/index.cjs +2 -0
- package/dist/select/index.cjs.map +1 -0
- package/dist/select/index.d.cts +927 -0
- package/dist/select/index.d.ts +927 -0
- package/dist/select/index.js +2 -0
- package/dist/select/index.js.map +1 -0
- package/dist/separator-B4Ot84B0.d.ts +748 -0
- package/dist/separator-BmbUeeaT.d.cts +748 -0
- package/dist/types-9vS1uLIK.d.cts +1557 -0
- package/dist/types-lQCIvWW8.d.ts +1557 -0
- package/dist/use-listbox-item-BIi4eRPI.d.cts +182 -0
- package/dist/use-listbox-item-BIi4eRPI.d.ts +182 -0
- package/package.json +50 -12
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { ReactStore } from '@base-ui/utils/store';
|
|
2
|
+
import { v as PopupMenuOpenChangeEventDetails, H as HighlightChangeEventDetails, P as PopupMenuOpenChangeReason } from './events-BPr8sRGH.cjs';
|
|
3
|
+
|
|
4
|
+
type FilterFn = (value: string, search: string, keywords?: string[]) => number;
|
|
5
|
+
type SearchNormalizer = (search: string) => string;
|
|
6
|
+
interface ItemRegistration {
|
|
7
|
+
value: string;
|
|
8
|
+
keywords?: string[];
|
|
9
|
+
groupId?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Lower values are sorted earlier in score-based lists. */
|
|
12
|
+
forceOrder?: number;
|
|
13
|
+
/** Overrides computed fuzzy score in score-based lists. */
|
|
14
|
+
forceScore?: number;
|
|
15
|
+
/** Whether this item is a submenu trigger */
|
|
16
|
+
isSubmenuTrigger?: boolean;
|
|
17
|
+
/** Single character keyboard shortcut to trigger this item */
|
|
18
|
+
shortcut?: string;
|
|
19
|
+
/** Whether selecting this item should close the menu (default: true) */
|
|
20
|
+
closeOnClick?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pre-registered item for virtualization.
|
|
24
|
+
* This allows the store to know about all items even when they're not mounted.
|
|
25
|
+
* The `value` field serves as both the unique identifier and the filtering value.
|
|
26
|
+
*/
|
|
27
|
+
interface VirtualItem {
|
|
28
|
+
/** Value used as unique identifier and for filtering/matching */
|
|
29
|
+
value: string;
|
|
30
|
+
/** Additional keywords for filtering */
|
|
31
|
+
keywords?: string[];
|
|
32
|
+
/** Whether the item is disabled */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type HighlightSource = 'keyboard' | 'pointer' | 'auto' | null;
|
|
36
|
+
/**
|
|
37
|
+
* Describes why the consumer updated ordered items when filter={false}.
|
|
38
|
+
* - `replace`: list was re-ordered/replaced (default)
|
|
39
|
+
* - `append`: new items were appended to the end while preserving existing order
|
|
40
|
+
*/
|
|
41
|
+
type OrderedItemsUpdateReason = 'replace' | 'append';
|
|
42
|
+
interface SetOrderedItemsOptions {
|
|
43
|
+
/** Why ordered items were updated. @default 'replace' */
|
|
44
|
+
reason?: OrderedItemsUpdateReason;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Refs for DOM elements used for scroll behavior.
|
|
48
|
+
* These are stored outside of reactive state to avoid unnecessary re-renders.
|
|
49
|
+
*/
|
|
50
|
+
interface DOMRefs {
|
|
51
|
+
/** Ref to the list/scroll container element */
|
|
52
|
+
listRef: React.RefObject<HTMLElement | null>;
|
|
53
|
+
/** Map of item ID to ref for the item's DOM element */
|
|
54
|
+
itemRefs: Map<string, React.RefObject<HTMLElement | null>>;
|
|
55
|
+
}
|
|
56
|
+
interface ListboxState {
|
|
57
|
+
/** Whether the listbox is open */
|
|
58
|
+
open: boolean;
|
|
59
|
+
/** Current search query */
|
|
60
|
+
search: string;
|
|
61
|
+
/** Normalized search query used for filtering and visibility checks */
|
|
62
|
+
normalizedSearch: string;
|
|
63
|
+
/** Currently highlighted item ID */
|
|
64
|
+
highlightedId: string | null;
|
|
65
|
+
/** Source of the current highlight (keyboard or pointer) */
|
|
66
|
+
highlightSource: HighlightSource;
|
|
67
|
+
/** Whether an Input is present in the Surface */
|
|
68
|
+
hasInput: boolean;
|
|
69
|
+
/** Whether the input is currently active (rendered) when hideUntilActive mode is used */
|
|
70
|
+
inputActive: boolean;
|
|
71
|
+
/** Pending search character typed before input was active */
|
|
72
|
+
pendingSearch: string;
|
|
73
|
+
/** Filtered results: item ID to score */
|
|
74
|
+
filteredItems: Map<string, number>;
|
|
75
|
+
/** Groups that have at least one visible item */
|
|
76
|
+
visibleGroups: Set<string>;
|
|
77
|
+
/** Count of visible items */
|
|
78
|
+
filteredCount: number;
|
|
79
|
+
/** Counter to trigger re-filtering when items change */
|
|
80
|
+
filterTrigger: number;
|
|
81
|
+
/** Whether virtualization mode is enabled */
|
|
82
|
+
virtualized: boolean;
|
|
83
|
+
/** Count of virtual items (from items prop) */
|
|
84
|
+
virtualItemsCount: number;
|
|
85
|
+
}
|
|
86
|
+
interface ListboxContext {
|
|
87
|
+
/** Filter function or false to disable filtering */
|
|
88
|
+
filter: FilterFn | false;
|
|
89
|
+
/** Function used to normalize search before filtering. */
|
|
90
|
+
normalizeSearch: SearchNormalizer;
|
|
91
|
+
/** Whether to loop navigation */
|
|
92
|
+
loop: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Controls auto-highlighting behavior when the menu opens.
|
|
95
|
+
* - `true`: highlight the first item (default)
|
|
96
|
+
* - `false`: don't auto-highlight any item
|
|
97
|
+
* - `string`: highlight the item with this specific value
|
|
98
|
+
*/
|
|
99
|
+
autoHighlightFirst: boolean | string;
|
|
100
|
+
/**
|
|
101
|
+
* Whether to clear search on close.
|
|
102
|
+
* - `true`: clear immediately when menu closes (default)
|
|
103
|
+
* - `false`: preserve search when menu closes
|
|
104
|
+
* - `'after-exit'`: clear after exit animation completes (requires Surface to call clearSearch)
|
|
105
|
+
*/
|
|
106
|
+
clearSearchOnClose: boolean | 'after-exit';
|
|
107
|
+
/** Whether hideUntilActive mode is enabled */
|
|
108
|
+
hideUntilActive: boolean;
|
|
109
|
+
/** ID for the list element (for aria-activedescendant) */
|
|
110
|
+
listId: string;
|
|
111
|
+
/** ID for the input element */
|
|
112
|
+
inputId: string;
|
|
113
|
+
/** Map of item ID to registration data */
|
|
114
|
+
readonly items: Map<string, ItemRegistration>;
|
|
115
|
+
/** Map of group ID to set of item IDs */
|
|
116
|
+
readonly groups: Map<string, Set<string>>;
|
|
117
|
+
/** Map of item ID to onSelect callback */
|
|
118
|
+
readonly itemSelects: Map<string, () => void>;
|
|
119
|
+
/** Map of submenu trigger ID to open callback */
|
|
120
|
+
readonly submenuOpens: Map<string, () => void>;
|
|
121
|
+
/** Map of submenu trigger ID to close callback */
|
|
122
|
+
readonly submenuCloses: Map<string, () => void>;
|
|
123
|
+
/** Map of shortcut key to item ID */
|
|
124
|
+
readonly shortcuts: Map<string, string>;
|
|
125
|
+
/**
|
|
126
|
+
* Callback when open state changes.
|
|
127
|
+
* The second parameter contains event details including the reason for the change.
|
|
128
|
+
*/
|
|
129
|
+
onOpenChange: (open: boolean, eventDetails: PopupMenuOpenChangeEventDetails) => void;
|
|
130
|
+
/** Callback when search state changes */
|
|
131
|
+
onSearchChange: ((search: string) => void) | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Pre-registered items for virtualization.
|
|
134
|
+
* When provided, navigation uses this array order instead of DOM registration order.
|
|
135
|
+
*/
|
|
136
|
+
virtualItems: VirtualItem[];
|
|
137
|
+
/**
|
|
138
|
+
* Consumer-provided ordered list of item values when filter={false}.
|
|
139
|
+
* Used to determine correct navigation/highlight order when consumer handles filtering externally.
|
|
140
|
+
* Must always be provided when filter={false}.
|
|
141
|
+
*/
|
|
142
|
+
orderedItems: string[];
|
|
143
|
+
/**
|
|
144
|
+
* Callback when highlighted item changes.
|
|
145
|
+
* Useful for synchronizing with virtualizers (scrollToIndex) and other UI state.
|
|
146
|
+
* The third parameter contains event details including the reason for the change.
|
|
147
|
+
*/
|
|
148
|
+
onHighlightChange: ((id: string | null, index: number, eventDetails: HighlightChangeEventDetails) => void) | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* DOM refs for scroll behavior.
|
|
151
|
+
* Stored in context (not state) to avoid re-renders.
|
|
152
|
+
*/
|
|
153
|
+
refs: DOMRefs;
|
|
154
|
+
/**
|
|
155
|
+
* Callback when menu close animation completes.
|
|
156
|
+
* Used for resetting row width measurements.
|
|
157
|
+
*/
|
|
158
|
+
onCloseComplete?: () => void;
|
|
159
|
+
/**
|
|
160
|
+
* Callback when popup close transition completes.
|
|
161
|
+
* Used by popup-layer features that should reset only after exit animations.
|
|
162
|
+
*/
|
|
163
|
+
onPopupCloseComplete?: () => void;
|
|
164
|
+
/**
|
|
165
|
+
* Last known pointer position for detecting actual pointer movement.
|
|
166
|
+
* Used to prevent "phantom" highlights when content shifts under a stationary pointer.
|
|
167
|
+
*/
|
|
168
|
+
lastPointerPosition: {
|
|
169
|
+
x: number;
|
|
170
|
+
y: number;
|
|
171
|
+
} | null;
|
|
172
|
+
}
|
|
173
|
+
declare const selectors: {
|
|
174
|
+
open: (state: ListboxState) => boolean;
|
|
175
|
+
search: (state: ListboxState) => string;
|
|
176
|
+
normalizedSearch: (state: ListboxState) => string;
|
|
177
|
+
highlightedId: (state: ListboxState) => string | null;
|
|
178
|
+
highlightSource: (state: ListboxState) => HighlightSource;
|
|
179
|
+
hasInput: (state: ListboxState) => boolean;
|
|
180
|
+
inputActive: (state: ListboxState) => boolean;
|
|
181
|
+
pendingSearch: (state: ListboxState) => string;
|
|
182
|
+
filteredCount: (state: ListboxState) => number;
|
|
183
|
+
filteredItems: (state: ListboxState) => Map<string, number>;
|
|
184
|
+
visibleGroups: (state: ListboxState) => Set<string>;
|
|
185
|
+
virtualized: (state: ListboxState) => boolean;
|
|
186
|
+
isHighlighted: (state: ListboxState, itemId: string) => boolean;
|
|
187
|
+
isGroupVisible: (state: ListboxState, groupId: string) => boolean;
|
|
188
|
+
getItemScore: (state: ListboxState, itemId: string) => number;
|
|
189
|
+
hasSearchWithNoResults: (state: ListboxState) => boolean;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Core store for listbox-like components.
|
|
193
|
+
* Handles item registration, filtering, navigation, and highlight state.
|
|
194
|
+
*
|
|
195
|
+
* Used by: DropdownMenu, ContextMenu, Select, CommandMenu
|
|
196
|
+
*/
|
|
197
|
+
declare class ListboxStore extends ReactStore<ListboxState, ListboxContext, typeof selectors> {
|
|
198
|
+
constructor(initialState?: Partial<ListboxState>, context?: Partial<ListboxContext>);
|
|
199
|
+
/**
|
|
200
|
+
* Set the open state with event details.
|
|
201
|
+
*
|
|
202
|
+
* @param open - The new open state
|
|
203
|
+
* @param reason - The reason for the state change (default: 'none')
|
|
204
|
+
* @param event - The native DOM event that triggered the change (optional)
|
|
205
|
+
*/
|
|
206
|
+
setOpen(open: boolean, reason?: PopupMenuOpenChangeReason, event?: Event): void;
|
|
207
|
+
setSearch(search: string): void;
|
|
208
|
+
setSearchNormalizer(normalizeSearch: SearchNormalizer): void;
|
|
209
|
+
setHighlightedId(id: string | null, cause?: HighlightSource): void;
|
|
210
|
+
/**
|
|
211
|
+
* Notify listeners about highlight changes.
|
|
212
|
+
* Called whenever highlightedId changes, regardless of virtualization or DOM state.
|
|
213
|
+
* Useful for virtualization scroll sync, analytics, or any other tracking needs.
|
|
214
|
+
*
|
|
215
|
+
* @param id - The newly highlighted item ID (or null if cleared)
|
|
216
|
+
* @param cause - What caused the highlight change
|
|
217
|
+
*/
|
|
218
|
+
private notifyHighlightChange;
|
|
219
|
+
/**
|
|
220
|
+
* Scroll the highlighted item into view.
|
|
221
|
+
* Uses native scrollIntoView if the element is in the DOM.
|
|
222
|
+
* For virtualized lists, the onHighlightChange callback (called from setHighlightedId)
|
|
223
|
+
* should handle scrolling via the virtualizer.
|
|
224
|
+
*
|
|
225
|
+
* @param id - The item ID to scroll into view
|
|
226
|
+
*/
|
|
227
|
+
private scrollItemIntoView;
|
|
228
|
+
setHasInput(hasInput: boolean): void;
|
|
229
|
+
setInputActive(active: boolean): void;
|
|
230
|
+
setPendingSearch(search: string): void;
|
|
231
|
+
setHideUntilActive(enabled: boolean): void;
|
|
232
|
+
setVirtualized(virtualized: boolean): void;
|
|
233
|
+
setVirtualItems(items: VirtualItem[]): void;
|
|
234
|
+
/**
|
|
235
|
+
* Set the consumer-provided ordered items.
|
|
236
|
+
* Used when filter={false} and consumer controls item order/visibility.
|
|
237
|
+
* Must always be provided when filter={false}.
|
|
238
|
+
*
|
|
239
|
+
* @param items - Array of item IDs in display order
|
|
240
|
+
*/
|
|
241
|
+
setOrderedItems(items: string[], options?: SetOrderedItemsOptions): void;
|
|
242
|
+
/**
|
|
243
|
+
* Try to auto-highlight when an item registers.
|
|
244
|
+
* This handles the case where orderedItems was set before items mounted.
|
|
245
|
+
* Only highlights if:
|
|
246
|
+
* - filter={false} (using orderedItems)
|
|
247
|
+
* - Menu is open
|
|
248
|
+
* - No item is currently highlighted
|
|
249
|
+
* - autoHighlightFirst is enabled
|
|
250
|
+
* - The registering item is the first in orderedItems
|
|
251
|
+
*/
|
|
252
|
+
private maybeAutoHighlightOnRegister;
|
|
253
|
+
setOnHighlightChange(callback: ((id: string | null, index: number, eventDetails: HighlightChangeEventDetails) => void) | undefined): void;
|
|
254
|
+
/**
|
|
255
|
+
* Set the list element ref for scroll container detection.
|
|
256
|
+
*/
|
|
257
|
+
setListRef(ref: React.RefObject<HTMLElement | null>): void;
|
|
258
|
+
/**
|
|
259
|
+
* Register an item's DOM ref for scrollIntoView behavior.
|
|
260
|
+
* Returns a cleanup function.
|
|
261
|
+
*/
|
|
262
|
+
registerItemRef(id: string, ref: React.RefObject<HTMLElement | null>): () => void;
|
|
263
|
+
/**
|
|
264
|
+
* Check if pointer has moved and should allow highlight.
|
|
265
|
+
* This prevents "phantom" highlights when content shifts under a stationary pointer
|
|
266
|
+
* (e.g., when search results change or menu items reorder).
|
|
267
|
+
*
|
|
268
|
+
* @param x - Current pointer X position
|
|
269
|
+
* @param y - Current pointer Y position
|
|
270
|
+
* @returns true if pointer has actually moved and highlight should be allowed
|
|
271
|
+
*/
|
|
272
|
+
shouldAllowPointerHighlight(x: number, y: number): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Reset pointer position tracking.
|
|
275
|
+
* Call this when the menu opens or content changes significantly.
|
|
276
|
+
*/
|
|
277
|
+
resetPointerPosition(): void;
|
|
278
|
+
/**
|
|
279
|
+
* Pre-register virtual items so they appear in filteredItems.
|
|
280
|
+
* This allows filtering to work for items that aren't mounted yet.
|
|
281
|
+
*/
|
|
282
|
+
private preRegisterVirtualItems;
|
|
283
|
+
registerItem(id: string, registration: ItemRegistration): () => void;
|
|
284
|
+
registerGroup(id: string): () => void;
|
|
285
|
+
registerItemSelect(id: string, onSelect: (() => void) | undefined): () => void;
|
|
286
|
+
registerSubmenuOpen(id: string, onOpen: (() => void) | undefined): () => void;
|
|
287
|
+
registerSubmenuClose(id: string, onClose: (() => void) | undefined): () => void;
|
|
288
|
+
/**
|
|
289
|
+
* Close all submenus except the one with the given ID.
|
|
290
|
+
* Used when hovering over a new submenu trigger to close sibling submenus.
|
|
291
|
+
*/
|
|
292
|
+
closeSiblingSubmenus(exceptId: string | null): void;
|
|
293
|
+
highlightNext(): void;
|
|
294
|
+
highlightPrev(): void;
|
|
295
|
+
selectHighlighted(): void;
|
|
296
|
+
/**
|
|
297
|
+
* Select an item by its keyboard shortcut.
|
|
298
|
+
* Returns true if an item was found and selected, false otherwise.
|
|
299
|
+
*/
|
|
300
|
+
selectByShortcut(key: string): boolean;
|
|
301
|
+
openSubmenuForHighlighted(): void;
|
|
302
|
+
isHighlightedSubmenuTrigger(): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Get the item registration for the highlighted item.
|
|
305
|
+
* Returns undefined if no item is highlighted.
|
|
306
|
+
*/
|
|
307
|
+
getHighlightedItem(): ItemRegistration | undefined;
|
|
308
|
+
clearSearch(): void;
|
|
309
|
+
highlightFirstItem(): void;
|
|
310
|
+
/**
|
|
311
|
+
* Apply auto-highlight based on the current context.autoHighlightFirst value.
|
|
312
|
+
* Called by Surface after updating the context to ensure correct value is used.
|
|
313
|
+
*/
|
|
314
|
+
applyAutoHighlight(): void;
|
|
315
|
+
/**
|
|
316
|
+
* Highlight a specific item by its value.
|
|
317
|
+
* If the item is not visible or doesn't exist, falls back to highlighting the first item.
|
|
318
|
+
* Scrolls the highlighted item into view.
|
|
319
|
+
*/
|
|
320
|
+
highlightItemByValue(value: string): void;
|
|
321
|
+
/**
|
|
322
|
+
* Returns whether filtering is disabled (consumer handles filtering externally).
|
|
323
|
+
*/
|
|
324
|
+
isFilterDisabled(): boolean;
|
|
325
|
+
getVisibleItemIds(): string[];
|
|
326
|
+
/**
|
|
327
|
+
* Get the index of an item in the visible items list.
|
|
328
|
+
* Returns -1 if the item is not found or not visible.
|
|
329
|
+
*/
|
|
330
|
+
getVisibleItemIndex(id: string): number;
|
|
331
|
+
/**
|
|
332
|
+
* Get the index of an item in the virtualItems array.
|
|
333
|
+
* This is used for virtualizer scrollToIndex which needs the raw array index,
|
|
334
|
+
* not the filtered/visible index.
|
|
335
|
+
* Returns -1 if not found or not in virtualized mode.
|
|
336
|
+
*/
|
|
337
|
+
getVirtualItemIndex(value: string): number;
|
|
338
|
+
/**
|
|
339
|
+
* Validates and updates the highlighted item.
|
|
340
|
+
* This is the single source of truth for highlight management.
|
|
341
|
+
*
|
|
342
|
+
* @param options.forceFirst - Force highlight first item even if current is valid
|
|
343
|
+
* @param options.filteredItems - Use this map instead of state (for mid-update calls)
|
|
344
|
+
* @param options.newSearch - The search query for filteredItems (to detect search cleared)
|
|
345
|
+
*/
|
|
346
|
+
private validateHighlight;
|
|
347
|
+
private recomputeFilteredItems;
|
|
348
|
+
static useStore(externalStore: ListboxStore | undefined, initialState?: Partial<ListboxState>, context?: Partial<ListboxContext>): ListboxStore;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { type DOMRefs as D, type FilterFn as F, type HighlightSource as H, type ItemRegistration as I, type ListboxContext as L, type SearchNormalizer as S, type VirtualItem as V, type ListboxState as a, ListboxStore as b };
|