@dxos/react-ui-searchlist 0.8.4-main.406dc2a → 0.8.4-main.40e3dcdf1b

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