@dxos/react-ui-searchlist 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51

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.
Files changed (49) hide show
  1. package/dist/lib/browser/index.mjs +665 -336
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +665 -336
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Combobox/Combobox.d.ts +50 -10
  8. package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -1
  9. package/dist/types/src/components/Combobox/Combobox.stories.d.ts +1 -1
  10. package/dist/types/src/components/Combobox/Combobox.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -1
  12. package/dist/types/src/components/Listbox/Listbox.stories.d.ts +1 -1
  13. package/dist/types/src/components/SearchList/SearchList.d.ts +84 -20
  14. package/dist/types/src/components/SearchList/SearchList.d.ts.map +1 -1
  15. package/dist/types/src/components/SearchList/SearchList.stories.d.ts +10 -7
  16. package/dist/types/src/components/SearchList/SearchList.stories.d.ts.map +1 -1
  17. package/dist/types/src/components/SearchList/context.d.ts +33 -0
  18. package/dist/types/src/components/SearchList/context.d.ts.map +1 -0
  19. package/dist/types/src/components/SearchList/hooks/index.d.ts +5 -0
  20. package/dist/types/src/components/SearchList/hooks/index.d.ts.map +1 -0
  21. package/dist/types/src/components/SearchList/hooks/useGlobalFilter.d.ts +34 -0
  22. package/dist/types/src/components/SearchList/hooks/useGlobalFilter.d.ts.map +1 -0
  23. package/dist/types/src/components/SearchList/hooks/useSearchListInput.d.ts +12 -0
  24. package/dist/types/src/components/SearchList/hooks/useSearchListInput.d.ts.map +1 -0
  25. package/dist/types/src/components/SearchList/hooks/useSearchListItem.d.ts +10 -0
  26. package/dist/types/src/components/SearchList/hooks/useSearchListItem.d.ts.map +1 -0
  27. package/dist/types/src/components/SearchList/hooks/useSearchListResults.d.ts +36 -0
  28. package/dist/types/src/components/SearchList/hooks/useSearchListResults.d.ts.map +1 -0
  29. package/dist/types/src/components/SearchList/index.d.ts +1 -0
  30. package/dist/types/src/components/SearchList/index.d.ts.map +1 -1
  31. package/dist/types/src/translations.d.ts +2 -2
  32. package/dist/types/src/translations.d.ts.map +1 -1
  33. package/dist/types/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +20 -17
  35. package/src/components/Combobox/Combobox.stories.tsx +9 -4
  36. package/src/components/Combobox/Combobox.tsx +36 -23
  37. package/src/components/Listbox/Listbox.stories.tsx +1 -1
  38. package/src/components/Listbox/Listbox.tsx +8 -3
  39. package/src/components/SearchList/SearchList.stories.tsx +496 -28
  40. package/src/components/SearchList/SearchList.tsx +460 -63
  41. package/src/components/SearchList/context.ts +43 -0
  42. package/src/components/SearchList/hooks/index.ts +8 -0
  43. package/src/components/SearchList/hooks/useGlobalFilter.tsx +61 -0
  44. package/src/components/SearchList/hooks/useSearchListInput.ts +14 -0
  45. package/src/components/SearchList/hooks/useSearchListItem.ts +14 -0
  46. package/src/components/SearchList/hooks/useSearchListResults.ts +104 -0
  47. package/src/components/SearchList/index.ts +1 -0
  48. package/src/translations.ts +1 -1
  49. package/src/types/command-score.d.ts +16 -0
@@ -1,21 +1,19 @@
1
1
  // src/components/Combobox/Combobox.tsx
2
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
3
- import { createContext } from "@radix-ui/react-context";
4
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
5
- import React2, { forwardRef as forwardRef2, useCallback } from "react";
6
- import { Button, Icon, Popover } from "@dxos/react-ui";
2
+ import { createContext as createContext3 } from "@radix-ui/react-context";
3
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
4
+ import React3, { forwardRef as forwardRef2, useCallback as useCallback3 } from "react";
5
+ import { Button, Icon as Icon2, Popover } from "@dxos/react-ui";
7
6
  import { useId } from "@dxos/react-ui";
8
- import { mx as mx2, staticPlaceholderText } from "@dxos/react-ui-theme";
7
+ import { mx as mx2, staticPlaceholderText } from "@dxos/ui-theme";
9
8
 
10
9
  // src/components/SearchList/SearchList.tsx
11
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
12
- import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from "cmdk";
13
- import React, { forwardRef } from "react";
14
- import { useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
15
- import { mx } from "@dxos/react-ui-theme";
10
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
11
+ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
12
+ import { Icon, useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
13
+ import { descriptionText, mx } from "@dxos/ui-theme";
16
14
 
17
15
  // src/translations.ts
18
- var translationKey = "react-ui-searchlist";
16
+ var translationKey = "@dxos/react-ui-searchlist";
19
17
  var translations = [
20
18
  {
21
19
  "en-US": {
@@ -26,94 +24,461 @@ var translations = [
26
24
  }
27
25
  ];
28
26
 
27
+ // src/components/SearchList/context.ts
28
+ import { createContext } from "@radix-ui/react-context";
29
+ var [SearchListItemContextProvider, useSearchListItemContext] = createContext("SearchListItem");
30
+ var [SearchListInputContextProvider, useSearchListInputContext] = createContext("SearchListInput");
31
+
29
32
  // src/components/SearchList/SearchList.tsx
30
- var commandItem = "flex items-center overflow-hidden";
31
- var searchListItem = "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected]:bg-hoverOverlay hover:bg-hoverOverlay";
32
- var SEARCHLIST_NAME = "SearchList";
33
- var SEARCHLIST_ITEM_NAME = "SearchListItem";
34
- var SearchListRoot = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
35
- var _effect = _useSignals();
36
- try {
37
- return /* @__PURE__ */ React.createElement(CommandRoot, {
38
- ...props,
39
- className: mx(classNames),
40
- ref: forwardedRef
41
- }, children);
42
- } finally {
43
- _effect.f();
44
- }
33
+ var SearchListRoot = ({ children, value: valueProp, defaultValue = "", debounceMs = 200, onSearch }) => {
34
+ const [query = "", setQuery] = useControllableState({
35
+ prop: valueProp,
36
+ defaultProp: defaultValue,
37
+ onChange: void 0
38
+ });
39
+ const [selectedValue, setSelectedValue] = useState(void 0);
40
+ const itemsRef = useRef(/* @__PURE__ */ new Map());
41
+ const debounceRef = useRef(null);
42
+ const handleQueryChange = useCallback((newQuery) => {
43
+ setQuery(newQuery);
44
+ if (debounceRef.current) {
45
+ clearTimeout(debounceRef.current);
46
+ }
47
+ debounceRef.current = setTimeout(() => {
48
+ onSearch?.(newQuery);
49
+ }, debounceMs);
50
+ }, [
51
+ setQuery,
52
+ onSearch,
53
+ debounceMs
54
+ ]);
55
+ const [itemVersion, setItemVersion] = useState(0);
56
+ useEffect(() => {
57
+ return () => {
58
+ if (debounceRef.current) {
59
+ clearTimeout(debounceRef.current);
60
+ }
61
+ };
62
+ }, []);
63
+ useEffect(() => {
64
+ const currentItem = selectedValue !== void 0 ? itemsRef.current.get(selectedValue) : void 0;
65
+ const isSelectionValid = currentItem !== void 0 && !currentItem.disabled;
66
+ if (!isSelectionValid && itemsRef.current.size > 0) {
67
+ const entries = Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled);
68
+ if (entries.length > 0) {
69
+ entries.sort(([, a], [, b]) => {
70
+ const position = a.element.compareDocumentPosition(b.element);
71
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
72
+ return -1;
73
+ }
74
+ if (position & Node.DOCUMENT_POSITION_PRECEDING) {
75
+ return 1;
76
+ }
77
+ return 0;
78
+ });
79
+ const firstValue = entries[0]?.[0];
80
+ if (firstValue !== void 0 && firstValue !== selectedValue) {
81
+ setSelectedValue(firstValue);
82
+ }
83
+ } else if (selectedValue !== void 0) {
84
+ setSelectedValue(void 0);
85
+ }
86
+ }
87
+ }, [
88
+ itemVersion,
89
+ selectedValue
90
+ ]);
91
+ const registerItem = useCallback((value, element, onSelect, disabled) => {
92
+ if (element) {
93
+ itemsRef.current.set(value, {
94
+ element,
95
+ onSelect,
96
+ disabled
97
+ });
98
+ setItemVersion((v) => v + 1);
99
+ }
100
+ }, []);
101
+ const unregisterItem = useCallback((value) => {
102
+ itemsRef.current.delete(value);
103
+ setItemVersion((v) => v + 1);
104
+ }, []);
105
+ const getItemValues = useCallback(() => {
106
+ return Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled).sort(([, a], [, b]) => {
107
+ const position = a.element.compareDocumentPosition(b.element);
108
+ return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : position & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
109
+ }).map(([value]) => value);
110
+ }, []);
111
+ const triggerSelect = useCallback(() => {
112
+ if (selectedValue !== void 0) {
113
+ const item = itemsRef.current.get(selectedValue);
114
+ item?.onSelect?.();
115
+ }
116
+ }, [
117
+ selectedValue
118
+ ]);
119
+ const itemContextValue = useMemo(() => ({
120
+ selectedValue,
121
+ onSelectedValueChange: setSelectedValue,
122
+ registerItem,
123
+ unregisterItem
124
+ }), [
125
+ selectedValue,
126
+ registerItem,
127
+ unregisterItem
128
+ ]);
129
+ const inputContextValue = useMemo(() => ({
130
+ query,
131
+ onQueryChange: handleQueryChange,
132
+ selectedValue,
133
+ onSelectedValueChange: setSelectedValue,
134
+ getItemValues,
135
+ triggerSelect
136
+ }), [
137
+ query,
138
+ handleQueryChange,
139
+ selectedValue,
140
+ getItemValues,
141
+ triggerSelect
142
+ ]);
143
+ return /* @__PURE__ */ React.createElement(SearchListInputContextProvider, {
144
+ query: inputContextValue.query,
145
+ onQueryChange: inputContextValue.onQueryChange,
146
+ selectedValue: inputContextValue.selectedValue,
147
+ onSelectedValueChange: inputContextValue.onSelectedValueChange,
148
+ getItemValues: inputContextValue.getItemValues,
149
+ triggerSelect: inputContextValue.triggerSelect
150
+ }, /* @__PURE__ */ React.createElement(SearchListItemContextProvider, {
151
+ selectedValue: itemContextValue.selectedValue,
152
+ onSelectedValueChange: itemContextValue.onSelectedValueChange,
153
+ registerItem: itemContextValue.registerItem,
154
+ unregisterItem: itemContextValue.unregisterItem
155
+ }, children));
156
+ };
157
+ SearchListRoot.displayName = "SearchList.Root";
158
+ var SearchListContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
159
+ return /* @__PURE__ */ React.createElement("div", {
160
+ role: "none",
161
+ // TODO(burdon): Remove p-1 hack.
162
+ className: mx("flex flex-col gap-2 bs-full is-full min-bs-0 overflow-hidden p-1", classNames),
163
+ ref: forwardedRef
164
+ }, children);
45
165
  });
46
- SearchListRoot.displayName = SEARCHLIST_NAME;
47
- var SearchListInput = /* @__PURE__ */ forwardRef(({ classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
48
- var _effect = _useSignals();
49
- try {
50
- const { t } = useTranslation(translationKey);
51
- const placeholder = props.placeholder ?? t("search.placeholder");
52
- const { hasIosKeyboard } = useThemeContext();
53
- const { tx } = useThemeContext();
54
- const density = useDensityContext(propsDensity);
55
- const elevation = useElevationContext(propsElevation);
56
- return /* @__PURE__ */ React.createElement(CommandInput, {
57
- ...props,
58
- placeholder,
59
- className: tx("input.input", "input", {
60
- variant,
61
- disabled: props.disabled,
62
- density,
63
- elevation
64
- }, "mbe-cardSpacingBlock", classNames),
65
- ...props.autoFocus && !hasIosKeyboard && {
66
- autoFocus: true
67
- },
68
- ref: forwardedRef
69
- });
70
- } finally {
71
- _effect.f();
72
- }
166
+ SearchListContent.displayName = "SearchList.Content";
167
+ var SearchListViewport = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
168
+ return /* @__PURE__ */ React.createElement("div", {
169
+ role: "listbox",
170
+ className: mx("bs-full is-full min-bs-0 overflow-y-auto", classNames),
171
+ ref: forwardedRef
172
+ }, children);
73
173
  });
74
- var SearchListContent = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
75
- var _effect = _useSignals();
76
- try {
77
- return /* @__PURE__ */ React.createElement(CommandList, {
78
- ...props,
79
- className: mx(classNames),
80
- ref: forwardedRef
81
- }, children);
82
- } finally {
83
- _effect.f();
84
- }
174
+ SearchListViewport.displayName = "SearchList.Viewport";
175
+ var SearchListInput = /* @__PURE__ */ forwardRef(({ classNames, density: propsDensity, elevation: propsElevation, variant, placeholder, onChange, ...props }, forwardedRef) => {
176
+ const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } = useSearchListInputContext("SearchList.Input");
177
+ const { t } = useTranslation(translationKey);
178
+ const { hasIosKeyboard, tx } = useThemeContext();
179
+ const density = useDensityContext(propsDensity);
180
+ const elevation = useElevationContext(propsElevation);
181
+ const defaultPlaceholder = t("search.placeholder");
182
+ const handleChange = useCallback((event) => {
183
+ onQueryChange(event.target.value);
184
+ onChange?.(event);
185
+ }, [
186
+ onQueryChange,
187
+ onChange
188
+ ]);
189
+ const handleKeyDown = useCallback((event) => {
190
+ const values = getItemValues();
191
+ if (values.length === 0) {
192
+ if (event.key === "Escape") {
193
+ onQueryChange("");
194
+ }
195
+ return;
196
+ }
197
+ const currentIndex = selectedValue !== void 0 ? values.indexOf(selectedValue) : -1;
198
+ switch (event.key) {
199
+ case "ArrowDown": {
200
+ event.preventDefault();
201
+ const nextIndex = currentIndex === -1 ? 0 : Math.min(currentIndex + 1, values.length - 1);
202
+ const nextValue = values[nextIndex];
203
+ if (nextValue !== void 0) {
204
+ onSelectedValueChange(nextValue);
205
+ }
206
+ break;
207
+ }
208
+ case "ArrowUp": {
209
+ event.preventDefault();
210
+ const prevIndex = currentIndex === -1 ? values.length - 1 : Math.max(currentIndex - 1, 0);
211
+ const prevValue = values[prevIndex];
212
+ if (prevValue !== void 0) {
213
+ onSelectedValueChange(prevValue);
214
+ }
215
+ break;
216
+ }
217
+ case "Enter": {
218
+ if (selectedValue !== void 0) {
219
+ event.preventDefault();
220
+ triggerSelect();
221
+ }
222
+ break;
223
+ }
224
+ case "Home": {
225
+ event.preventDefault();
226
+ const firstValue = values[0];
227
+ if (firstValue !== void 0) {
228
+ onSelectedValueChange(firstValue);
229
+ }
230
+ break;
231
+ }
232
+ case "End": {
233
+ event.preventDefault();
234
+ const lastValue = values[values.length - 1];
235
+ if (lastValue !== void 0) {
236
+ onSelectedValueChange(lastValue);
237
+ }
238
+ break;
239
+ }
240
+ case "Escape": {
241
+ event.preventDefault();
242
+ if (selectedValue !== void 0) {
243
+ onSelectedValueChange(void 0);
244
+ } else {
245
+ onQueryChange("");
246
+ }
247
+ break;
248
+ }
249
+ }
250
+ }, [
251
+ selectedValue,
252
+ onSelectedValueChange,
253
+ getItemValues,
254
+ triggerSelect,
255
+ onQueryChange
256
+ ]);
257
+ return /* @__PURE__ */ React.createElement("input", {
258
+ ...props,
259
+ ...props.autoFocus && !hasIosKeyboard && {
260
+ autoFocus: true
261
+ },
262
+ type: "text",
263
+ placeholder: placeholder ?? defaultPlaceholder,
264
+ className: tx("input.input", {
265
+ variant,
266
+ disabled: props.disabled,
267
+ density,
268
+ elevation
269
+ }, classNames),
270
+ value: query,
271
+ onChange: handleChange,
272
+ onKeyDown: handleKeyDown,
273
+ ref: forwardedRef
274
+ });
85
275
  });
86
- var SearchListEmpty = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
87
- var _effect = _useSignals();
88
- try {
89
- return /* @__PURE__ */ React.createElement(CommandEmpty, {
90
- ...props,
91
- className: mx(classNames),
92
- ref: forwardedRef
93
- }, children);
94
- } finally {
95
- _effect.f();
96
- }
276
+ SearchListInput.displayName = "SearchList.Input";
277
+ var SearchListItem = /* @__PURE__ */ forwardRef(({ classNames, value, label, icon, checked, suffix, onSelect, disabled }, forwardedRef) => {
278
+ const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext("SearchList.Item");
279
+ const internalRef = useRef(null);
280
+ const isSelected = selectedValue === value && !disabled;
281
+ useEffect(() => {
282
+ const element = internalRef.current;
283
+ if (element) {
284
+ registerItem(value, element, onSelect, disabled);
285
+ }
286
+ return () => unregisterItem(value);
287
+ }, [
288
+ value,
289
+ onSelect,
290
+ disabled,
291
+ registerItem,
292
+ unregisterItem
293
+ ]);
294
+ useEffect(() => {
295
+ if (isSelected && internalRef.current) {
296
+ internalRef.current.scrollIntoView({
297
+ block: "nearest",
298
+ behavior: "smooth"
299
+ });
300
+ }
301
+ }, [
302
+ isSelected
303
+ ]);
304
+ const handleClick = useCallback(() => {
305
+ if (!disabled) {
306
+ onSelect?.();
307
+ }
308
+ }, [
309
+ onSelect,
310
+ disabled
311
+ ]);
312
+ return /* @__PURE__ */ React.createElement("div", {
313
+ ref: (node) => {
314
+ internalRef.current = node;
315
+ if (typeof forwardedRef === "function") {
316
+ forwardedRef(node);
317
+ } else if (forwardedRef) {
318
+ forwardedRef.current = node;
319
+ }
320
+ },
321
+ role: "option",
322
+ "aria-selected": isSelected,
323
+ "aria-disabled": disabled,
324
+ "data-selected": isSelected,
325
+ "data-disabled": disabled,
326
+ "data-value": value,
327
+ tabIndex: -1,
328
+ className: mx("flex gap-2 items-center", "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected=true]:bg-hoverOverlay hover:bg-hoverOverlay", disabled && "opacity-50 cursor-not-allowed hover:bg-transparent data-[selected=true]:bg-transparent", classNames),
329
+ onClick: handleClick
330
+ }, icon && /* @__PURE__ */ React.createElement(Icon, {
331
+ icon,
332
+ size: 5
333
+ }), /* @__PURE__ */ React.createElement("span", {
334
+ className: "is-0 grow truncate"
335
+ }, label), suffix && /* @__PURE__ */ React.createElement("span", {
336
+ className: mx("shrink-0", descriptionText)
337
+ }, suffix), checked && /* @__PURE__ */ React.createElement(Icon, {
338
+ icon: "ph--check--regular",
339
+ size: 5
340
+ }));
97
341
  });
98
- var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
99
- var _effect = _useSignals();
100
- try {
101
- return /* @__PURE__ */ React.createElement(CommandItem, {
102
- ...props,
103
- className: mx(searchListItem, classNames),
104
- ref: forwardedRef
105
- }, children);
106
- } finally {
107
- _effect.f();
108
- }
342
+ SearchListItem.displayName = "SearchList.Item";
343
+ var SearchListEmpty = ({ classNames, children }) => {
344
+ return /* @__PURE__ */ React.createElement("div", {
345
+ role: "status",
346
+ className: mx("flex flex-col is-full pli-2 plb-1", classNames)
347
+ }, children);
348
+ };
349
+ SearchListEmpty.displayName = "SearchList.Empty";
350
+ var SearchListGroup = /* @__PURE__ */ forwardRef(({ classNames, heading, children }, forwardedRef) => {
351
+ return /* @__PURE__ */ React.createElement("div", {
352
+ ref: forwardedRef,
353
+ role: "group",
354
+ className: mx("flex flex-col", classNames)
355
+ }, heading && /* @__PURE__ */ React.createElement("div", {
356
+ role: "presentation",
357
+ className: "pli-2 plb-1 text-xs font-medium text-description"
358
+ }, heading), children);
109
359
  });
110
- SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
360
+ SearchListGroup.displayName = "SearchList.Group";
111
361
  var SearchList = {
112
362
  Root: SearchListRoot,
113
- Input: SearchListInput,
114
363
  Content: SearchListContent,
364
+ Viewport: SearchListViewport,
365
+ Input: SearchListInput,
366
+ Item: SearchListItem,
115
367
  Empty: SearchListEmpty,
116
- Item: SearchListItem
368
+ Group: SearchListGroup
369
+ };
370
+
371
+ // src/components/SearchList/hooks/useGlobalFilter.tsx
372
+ import React2, { createContext as createContext2, useContext, useMemo as useMemo2 } from "react";
373
+ var GlobalFilterContext = /* @__PURE__ */ createContext2({});
374
+ var GlobalFilterProvider = ({ children, filter }) => {
375
+ const value = useMemo2(() => ({
376
+ filter
377
+ }), [
378
+ filter
379
+ ]);
380
+ return /* @__PURE__ */ React2.createElement(GlobalFilterContext.Provider, {
381
+ value
382
+ }, children);
383
+ };
384
+ var useGlobalFilter = () => {
385
+ return useContext(GlobalFilterContext);
386
+ };
387
+ var useGlobalFilteredObjects = (objects) => {
388
+ const { filter } = useGlobalFilter();
389
+ return useMemo2(() => {
390
+ if (!objects) {
391
+ return [];
392
+ }
393
+ if (!filter) {
394
+ return objects;
395
+ }
396
+ return filter(objects);
397
+ }, [
398
+ objects,
399
+ filter
400
+ ]);
401
+ };
402
+
403
+ // src/components/SearchList/hooks/useSearchListInput.ts
404
+ var useSearchListInput = () => {
405
+ const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } = useSearchListInputContext("useSearchListInput");
406
+ return {
407
+ query,
408
+ onQueryChange,
409
+ selectedValue,
410
+ onSelectedValueChange,
411
+ getItemValues,
412
+ triggerSelect
413
+ };
414
+ };
415
+
416
+ // src/components/SearchList/hooks/useSearchListItem.ts
417
+ var useSearchListItem = () => {
418
+ const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext("useSearchListItem");
419
+ return {
420
+ selectedValue,
421
+ registerItem,
422
+ unregisterItem
423
+ };
424
+ };
425
+
426
+ // src/components/SearchList/hooks/useSearchListResults.ts
427
+ import commandScore from "command-score";
428
+ import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
429
+ var useSearchListResults = ({ items, filter, fuzzy = true, extract, minScore = 0 }) => {
430
+ const [query, setQuery] = useState2("");
431
+ const queryRef = useRef2("");
432
+ useEffect2(() => {
433
+ queryRef.current = "";
434
+ setQuery("");
435
+ }, [
436
+ items
437
+ ]);
438
+ const defaultExtract = useCallback2((item) => {
439
+ if (typeof item === "string") {
440
+ return item;
441
+ }
442
+ return item?.label ?? "";
443
+ }, []);
444
+ const extractFn = extract ?? defaultExtract;
445
+ const defaultFilter = useCallback2((item, query2) => {
446
+ const searchable = extractFn(item);
447
+ return searchable.toLowerCase().includes(query2.toLowerCase());
448
+ }, [
449
+ extractFn
450
+ ]);
451
+ const filterFn = filter ?? defaultFilter;
452
+ const handleSearch = useCallback2((searchQuery) => {
453
+ queryRef.current = searchQuery;
454
+ setQuery(searchQuery);
455
+ }, []);
456
+ const results = useMemo3(() => {
457
+ const currentQuery = queryRef.current;
458
+ if (!currentQuery) {
459
+ return items;
460
+ }
461
+ if (fuzzy) {
462
+ const scored = items.map((item) => ({
463
+ item,
464
+ score: commandScore(extractFn(item), currentQuery)
465
+ })).filter(({ score }) => score > minScore).sort((a, b) => b.score - a.score);
466
+ return scored.map(({ item }) => item);
467
+ } else {
468
+ return items.filter((item) => filterFn(item, currentQuery));
469
+ }
470
+ }, [
471
+ items,
472
+ query,
473
+ filterFn,
474
+ fuzzy,
475
+ extractFn,
476
+ minScore
477
+ ]);
478
+ return {
479
+ results,
480
+ handleSearch
481
+ };
117
482
  };
118
483
 
119
484
  // src/components/Combobox/Combobox.tsx
@@ -121,170 +486,150 @@ var COMBOBOX_NAME = "Combobox";
121
486
  var COMBOBOX_CONTENT_NAME = "ComboboxContent";
122
487
  var COMBOBOX_ITEM_NAME = "ComboboxItem";
123
488
  var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
124
- var [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME, {});
489
+ var [ComboboxProvider, useComboboxContext] = createContext3(COMBOBOX_NAME, {});
125
490
  var ComboboxRoot = ({ modal, modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
126
- var _effect = _useSignals2();
127
- try {
128
- const modalId = useId(COMBOBOX_NAME, propsModalId);
129
- const [open = false, onOpenChange] = useControllableState({
130
- prop: propsOpen,
131
- onChange: propsOnOpenChange,
132
- defaultProp: defaultOpen
133
- });
134
- const [value = "", onValueChange] = useControllableState({
135
- prop: propsValue,
136
- onChange: propsOnValueChange,
137
- defaultProp: defaultValue
138
- });
139
- return /* @__PURE__ */ React2.createElement(Popover.Root, {
140
- open,
141
- onOpenChange,
142
- modal
143
- }, /* @__PURE__ */ React2.createElement(ComboboxProvider, {
144
- isCombobox: true,
145
- modalId,
146
- placeholder,
147
- open,
148
- onOpenChange,
149
- value,
150
- onValueChange
151
- }, children));
152
- } finally {
153
- _effect.f();
154
- }
491
+ const modalId = useId(COMBOBOX_NAME, propsModalId);
492
+ const [open = false, onOpenChange] = useControllableState2({
493
+ prop: propsOpen,
494
+ onChange: propsOnOpenChange,
495
+ defaultProp: defaultOpen
496
+ });
497
+ const [value = "", onValueChange] = useControllableState2({
498
+ prop: propsValue,
499
+ onChange: propsOnValueChange,
500
+ defaultProp: defaultValue
501
+ });
502
+ return /* @__PURE__ */ React3.createElement(Popover.Root, {
503
+ open,
504
+ onOpenChange,
505
+ modal
506
+ }, /* @__PURE__ */ React3.createElement(ComboboxProvider, {
507
+ isCombobox: true,
508
+ modalId,
509
+ placeholder,
510
+ open,
511
+ onOpenChange,
512
+ value,
513
+ onValueChange
514
+ }, children));
155
515
  };
156
- var ComboboxContent = /* @__PURE__ */ forwardRef2(({ side = "bottom", collisionPadding = 48, sideOffset, align, alignOffset, avoidCollisions, collisionBoundary, arrowPadding, sticky, hideWhenDetached, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, forceMount, children, classNames, ...props }, forwardedRef) => {
157
- var _effect = _useSignals2();
158
- try {
159
- const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);
160
- return /* @__PURE__ */ React2.createElement(Popover.Content, {
161
- side,
162
- sideOffset,
163
- align,
164
- alignOffset,
165
- avoidCollisions,
166
- collisionBoundary,
167
- collisionPadding,
168
- arrowPadding,
169
- sticky,
170
- hideWhenDetached,
171
- onOpenAutoFocus,
172
- onCloseAutoFocus,
173
- onEscapeKeyDown,
174
- onPointerDownOutside,
175
- onFocusOutside,
176
- onInteractOutside,
177
- forceMount,
178
- classNames: [
179
- "is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr]",
180
- classNames
181
- ],
182
- id: modalId,
183
- ref: forwardedRef
184
- }, /* @__PURE__ */ React2.createElement(SearchList.Root, {
185
- ...props,
186
- classNames: "contents density-fine",
187
- role: "none"
188
- }, children));
189
- } finally {
190
- _effect.f();
191
- }
516
+ var ComboboxContent = /* @__PURE__ */ forwardRef2(({ side = "bottom", collisionPadding = 48, sideOffset, align, alignOffset, avoidCollisions, collisionBoundary, arrowPadding, sticky, hideWhenDetached, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, forceMount, children, classNames, onSearch, value, defaultValue, debounceMs, label }, forwardedRef) => {
517
+ const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);
518
+ return /* @__PURE__ */ React3.createElement(Popover.Content, {
519
+ side,
520
+ sideOffset,
521
+ align,
522
+ alignOffset,
523
+ avoidCollisions,
524
+ collisionBoundary,
525
+ collisionPadding,
526
+ arrowPadding,
527
+ sticky,
528
+ hideWhenDetached,
529
+ onOpenAutoFocus,
530
+ onCloseAutoFocus,
531
+ onEscapeKeyDown,
532
+ onPointerDownOutside,
533
+ onFocusOutside,
534
+ onInteractOutside,
535
+ forceMount,
536
+ classNames: [
537
+ "is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr]",
538
+ classNames
539
+ ],
540
+ id: modalId,
541
+ ref: forwardedRef
542
+ }, /* @__PURE__ */ React3.createElement(SearchList.Root, {
543
+ onSearch,
544
+ value,
545
+ defaultValue,
546
+ debounceMs
547
+ }, /* @__PURE__ */ React3.createElement(SearchList.Content, null, children)));
192
548
  });
193
549
  ComboboxContent.displayName = COMBOBOX_CONTENT_NAME;
194
550
  var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props }, forwardedRef) => {
195
- var _effect = _useSignals2();
196
- try {
197
- const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
198
- const handleClick = useCallback((event) => {
199
- onClick?.(event);
200
- onOpenChange?.(true);
201
- }, [
202
- onClick,
203
- onOpenChange
204
- ]);
205
- return /* @__PURE__ */ React2.createElement(Popover.Trigger, {
206
- asChild: true
207
- }, /* @__PURE__ */ React2.createElement(Button, {
208
- ...props,
209
- role: "combobox",
210
- "aria-expanded": open,
211
- "aria-controls": modalId,
212
- "aria-haspopup": "dialog",
213
- onClick: handleClick,
214
- ref: forwardedRef
215
- }, children ?? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("span", {
216
- className: mx2("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
217
- }, value || placeholder), /* @__PURE__ */ React2.createElement(Icon, {
218
- icon: "ph--caret-down--bold",
219
- size: 3
220
- }))));
221
- } finally {
222
- _effect.f();
223
- }
551
+ const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
552
+ const handleClick = useCallback3((event) => {
553
+ onClick?.(event);
554
+ onOpenChange?.(true);
555
+ }, [
556
+ onClick,
557
+ onOpenChange
558
+ ]);
559
+ return /* @__PURE__ */ React3.createElement(Popover.Trigger, {
560
+ asChild: true
561
+ }, /* @__PURE__ */ React3.createElement(Button, {
562
+ ...props,
563
+ role: "combobox",
564
+ "aria-expanded": open,
565
+ "aria-controls": modalId,
566
+ "aria-haspopup": "dialog",
567
+ onClick: handleClick,
568
+ ref: forwardedRef
569
+ }, children ?? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("span", {
570
+ className: mx2("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
571
+ }, value || placeholder), /* @__PURE__ */ React3.createElement(Icon2, {
572
+ icon: "ph--caret-down--bold",
573
+ size: 3
574
+ }))));
224
575
  });
225
576
  ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
226
577
  var ComboboxVirtualTrigger = Popover.VirtualTrigger;
227
578
  var ComboboxInput = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
228
- var _effect = _useSignals2();
229
- try {
230
- return /* @__PURE__ */ React2.createElement(SearchList.Input, {
231
- ...props,
232
- classNames: [
233
- "mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]",
234
- classNames
235
- ],
236
- ref: forwardedRef
237
- });
238
- } finally {
239
- _effect.f();
240
- }
579
+ return /* @__PURE__ */ React3.createElement(SearchList.Input, {
580
+ ...props,
581
+ classNames: [
582
+ "mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]",
583
+ classNames
584
+ ],
585
+ ref: forwardedRef
586
+ });
241
587
  });
242
588
  var ComboboxList = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
243
- var _effect = _useSignals2();
244
- try {
245
- return /* @__PURE__ */ React2.createElement(SearchList.Content, {
246
- ...props,
247
- classNames: [
248
- "min-bs-0 overflow-y-auto plb-cardSpacingChrome",
249
- classNames
250
- ],
251
- ref: forwardedRef
252
- });
253
- } finally {
254
- _effect.f();
255
- }
589
+ return /* @__PURE__ */ React3.createElement(SearchList.Viewport, {
590
+ ...props,
591
+ classNames: [
592
+ "plb-cardSpacingChrome",
593
+ classNames
594
+ ],
595
+ ref: forwardedRef
596
+ });
256
597
  });
257
- var ComboboxItem = /* @__PURE__ */ forwardRef2(({ classNames, onSelect, ...props }, forwardedRef) => {
258
- var _effect = _useSignals2();
259
- try {
260
- const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);
261
- const handleSelect = useCallback((nextValue) => {
262
- onSelect?.(nextValue);
263
- onValueChange?.(nextValue);
598
+ var ComboboxItem = /* @__PURE__ */ forwardRef2(({ classNames, onSelect, value, closeOnSelect = true, ...props }, forwardedRef) => {
599
+ const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);
600
+ const handleSelect = useCallback3(() => {
601
+ onSelect?.();
602
+ if (value !== void 0) {
603
+ onValueChange?.(value);
604
+ }
605
+ if (closeOnSelect) {
264
606
  onOpenChange?.(false);
265
- }, [
266
- onSelect,
267
- onValueChange,
268
- onOpenChange
269
- ]);
270
- return /* @__PURE__ */ React2.createElement(SearchList.Item, {
271
- ...props,
272
- classNames: [
273
- "mli-cardSpacingChrome pli-cardSpacingChrome",
274
- classNames
275
- ],
276
- onSelect: handleSelect,
277
- ref: forwardedRef
278
- });
279
- } finally {
280
- _effect.f();
281
- }
607
+ }
608
+ }, [
609
+ onSelect,
610
+ onValueChange,
611
+ onOpenChange,
612
+ value,
613
+ closeOnSelect
614
+ ]);
615
+ return /* @__PURE__ */ React3.createElement(SearchList.Item, {
616
+ ...props,
617
+ value,
618
+ classNames: [
619
+ "mli-cardSpacingChrome pli-cardSpacingChrome",
620
+ classNames
621
+ ],
622
+ onSelect: handleSelect,
623
+ ref: forwardedRef
624
+ });
282
625
  });
283
626
  ComboboxItem.displayName = COMBOBOX_ITEM_NAME;
284
627
  var ComboboxArrow = Popover.Arrow;
285
628
  var ComboboxEmpty = SearchList.Empty;
629
+ var ComboboxPortal = Popover.Portal;
286
630
  var Combobox = {
287
631
  Root: ComboboxRoot,
632
+ Portal: ComboboxPortal,
288
633
  Content: ComboboxContent,
289
634
  Trigger: ComboboxTrigger,
290
635
  VirtualTrigger: ComboboxVirtualTrigger,
@@ -296,14 +641,14 @@ var Combobox = {
296
641
  };
297
642
 
298
643
  // src/components/Listbox/Listbox.tsx
299
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
300
644
  import { useArrowNavigationGroup } from "@fluentui/react-tabster";
301
645
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
302
646
  import { createContextScope } from "@radix-ui/react-context";
303
- import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
304
- import React3, { forwardRef as forwardRef3, useCallback as useCallback2, useEffect, useRef } from "react";
305
- import { Icon as Icon2 } from "@dxos/react-ui";
306
- import { mx as mx3 } from "@dxos/react-ui-theme";
647
+ import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
648
+ import React4, { forwardRef as forwardRef3, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3 } from "react";
649
+ import { Icon as Icon3 } from "@dxos/react-ui";
650
+ import { mx as mx3 } from "@dxos/ui-theme";
651
+ var commandItem = "flex items-center overflow-hidden";
307
652
  var LISTBOX_NAME = "Listbox";
308
653
  var LISTBOX_OPTION_NAME = "ListboxOption";
309
654
  var LISTBOX_OPTION_LABEL_NAME = "ListboxOptionLabel";
@@ -315,108 +660,88 @@ var [createListboxOptionContext, createListboxOptionScope] = createContextScope(
315
660
  var [ListboxProvider, useListboxContext] = createListboxContext(LISTBOX_NAME);
316
661
  var [ListboxOptionProvider, useListboxOptionContext] = createListboxOptionContext(LISTBOX_OPTION_NAME);
317
662
  var ListboxRoot = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
318
- var _effect = _useSignals3();
319
- try {
320
- const { __listboxScope, children, classNames, value: propsValue, defaultValue, onValueChange, autoFocus, ...rootProps } = props;
321
- const arrowGroup = useArrowNavigationGroup({
322
- axis: "vertical"
323
- });
324
- const ref = useRef(null);
325
- const rootRef = useComposedRefs(ref, forwardedRef);
326
- const [selectedValue, setSelectedValue] = useControllableState2({
327
- prop: propsValue,
328
- defaultProp: defaultValue,
329
- onChange: onValueChange
330
- });
331
- const handleValueChange = (value) => {
332
- setSelectedValue(value);
333
- };
334
- useEffect(() => {
335
- ref.current?.querySelector('[aria-selected="true"]')?.focus();
336
- }, [
337
- autoFocus
338
- ]);
339
- return /* @__PURE__ */ React3.createElement(ListboxProvider, {
340
- scope: __listboxScope,
341
- selectedValue,
342
- onValueChange: handleValueChange
343
- }, /* @__PURE__ */ React3.createElement("ul", {
344
- role: "listbox",
345
- ...rootProps,
346
- className: mx3("is-full p-cardSpacingChrome", classNames),
347
- ref: rootRef,
348
- ...arrowGroup
349
- }, children));
350
- } finally {
351
- _effect.f();
352
- }
663
+ const { __listboxScope, children, classNames, value: propsValue, defaultValue, onValueChange, autoFocus, ...rootProps } = props;
664
+ const arrowGroup = useArrowNavigationGroup({
665
+ axis: "vertical"
666
+ });
667
+ const ref = useRef3(null);
668
+ const rootRef = useComposedRefs(ref, forwardedRef);
669
+ const [selectedValue, setSelectedValue] = useControllableState3({
670
+ prop: propsValue,
671
+ defaultProp: defaultValue,
672
+ onChange: onValueChange
673
+ });
674
+ const handleValueChange = (value) => {
675
+ setSelectedValue(value);
676
+ };
677
+ useEffect3(() => {
678
+ ref.current?.querySelector('[aria-selected="true"]')?.focus();
679
+ }, [
680
+ autoFocus
681
+ ]);
682
+ return /* @__PURE__ */ React4.createElement(ListboxProvider, {
683
+ scope: __listboxScope,
684
+ selectedValue,
685
+ onValueChange: handleValueChange
686
+ }, /* @__PURE__ */ React4.createElement("ul", {
687
+ role: "listbox",
688
+ ...rootProps,
689
+ className: mx3("is-full p-cardSpacingChrome", classNames),
690
+ ref: rootRef,
691
+ ...arrowGroup
692
+ }, children));
353
693
  });
354
694
  ListboxRoot.displayName = LISTBOX_NAME;
355
695
  var ListboxOption = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
356
- var _effect = _useSignals3();
357
- try {
358
- const { __listboxScope, children, classNames, value, ...rootProps } = props;
359
- const { selectedValue, onValueChange } = useListboxContext(LISTBOX_OPTION_NAME, __listboxScope);
360
- const isSelected = selectedValue === value;
361
- const handleSelect = useCallback2(() => {
362
- onValueChange(value);
363
- }, [
364
- value,
365
- onValueChange
366
- ]);
367
- return /* @__PURE__ */ React3.createElement(ListboxOptionProvider, {
368
- scope: __listboxScope,
369
- value,
370
- isSelected
371
- }, /* @__PURE__ */ React3.createElement("li", {
372
- role: "option",
373
- ...rootProps,
374
- "aria-selected": isSelected,
375
- tabIndex: 0,
376
- className: mx3("dx-focus-ring", commandItem, searchListItem, classNames),
377
- onClick: handleSelect,
378
- onKeyDown: ({ key }) => {
379
- if ([
380
- "Enter",
381
- " "
382
- ].includes(key)) {
383
- handleSelect();
384
- }
385
- },
386
- ref: forwardedRef
387
- }, children));
388
- } finally {
389
- _effect.f();
390
- }
696
+ const { __listboxScope, children, classNames, value, ...rootProps } = props;
697
+ const { selectedValue, onValueChange } = useListboxContext(LISTBOX_OPTION_NAME, __listboxScope);
698
+ const isSelected = selectedValue === value;
699
+ const handleSelect = useCallback4(() => {
700
+ onValueChange(value);
701
+ }, [
702
+ value,
703
+ onValueChange
704
+ ]);
705
+ return /* @__PURE__ */ React4.createElement(ListboxOptionProvider, {
706
+ scope: __listboxScope,
707
+ value,
708
+ isSelected
709
+ }, /* @__PURE__ */ React4.createElement("li", {
710
+ role: "option",
711
+ ...rootProps,
712
+ "aria-selected": isSelected,
713
+ tabIndex: 0,
714
+ className: mx3("dx-focus-ring", "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected=true]:bg-hoverOverlay hover:bg-hoverOverlay", commandItem, classNames),
715
+ onClick: handleSelect,
716
+ onKeyDown: ({ key }) => {
717
+ if ([
718
+ "Enter",
719
+ " "
720
+ ].includes(key)) {
721
+ handleSelect();
722
+ }
723
+ },
724
+ ref: forwardedRef
725
+ }, children));
391
726
  });
392
727
  ListboxOption.displayName = LISTBOX_OPTION_NAME;
393
728
  var ListboxOptionLabel = /* @__PURE__ */ forwardRef3(({ children, classNames, ...rootProps }, forwardedRef) => {
394
- var _effect = _useSignals3();
395
- try {
396
- return /* @__PURE__ */ React3.createElement("span", {
397
- ...rootProps,
398
- className: mx3("grow truncate", classNames),
399
- ref: forwardedRef
400
- }, children);
401
- } finally {
402
- _effect.f();
403
- }
729
+ return /* @__PURE__ */ React4.createElement("span", {
730
+ ...rootProps,
731
+ className: mx3("grow truncate", classNames),
732
+ ref: forwardedRef
733
+ }, children);
404
734
  });
405
735
  ListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;
406
736
  var ListboxOptionIndicator = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
407
- var _effect = _useSignals3();
408
- try {
409
- const { __listboxOptionScope, classNames, ...rootProps } = props;
410
- const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);
411
- return /* @__PURE__ */ React3.createElement(Icon2, {
412
- icon: "ph--check--regular",
413
- ...rootProps,
414
- classNames: mx3(!isSelected && "invisible", classNames),
415
- ref: forwardedRef
416
- });
417
- } finally {
418
- _effect.f();
419
- }
737
+ const { __listboxOptionScope, classNames, ...rootProps } = props;
738
+ const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);
739
+ return /* @__PURE__ */ React4.createElement(Icon3, {
740
+ icon: "ph--check--regular",
741
+ ...rootProps,
742
+ classNames: mx3(!isSelected && "invisible", classNames),
743
+ ref: forwardedRef
744
+ });
420
745
  });
421
746
  ListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;
422
747
  var Listbox = {
@@ -427,13 +752,17 @@ var Listbox = {
427
752
  };
428
753
  export {
429
754
  Combobox,
755
+ GlobalFilterProvider,
430
756
  Listbox,
431
757
  SearchList,
432
- commandItem,
433
758
  createListboxScope,
434
- searchListItem,
435
759
  translationKey,
436
760
  translations,
437
- useListboxContext
761
+ useGlobalFilter,
762
+ useGlobalFilteredObjects,
763
+ useListboxContext,
764
+ useSearchListInput,
765
+ useSearchListItem,
766
+ useSearchListResults
438
767
  };
439
768
  //# sourceMappingURL=index.mjs.map