@dxos/react-ui-searchlist 0.8.3 → 0.8.4-main.1068cf700f

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 (81) hide show
  1. package/dist/lib/browser/index.mjs +741 -265
  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 +741 -265
  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 +84 -0
  8. package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -0
  9. package/dist/types/src/components/Combobox/Combobox.stories.d.ts +21 -0
  10. package/dist/types/src/components/Combobox/Combobox.stories.d.ts.map +1 -0
  11. package/dist/types/src/components/Combobox/index.d.ts +2 -0
  12. package/dist/types/src/components/Combobox/index.d.ts.map +1 -0
  13. package/dist/types/src/components/Listbox/Listbox.d.ts +31 -0
  14. package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -0
  15. package/dist/types/src/components/Listbox/Listbox.stories.d.ts +21 -0
  16. package/dist/types/src/components/Listbox/Listbox.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/Listbox/index.d.ts +2 -0
  18. package/dist/types/src/components/Listbox/index.d.ts.map +1 -0
  19. package/dist/types/src/components/SearchList/SearchList.d.ts +88 -0
  20. package/dist/types/src/components/SearchList/SearchList.d.ts.map +1 -0
  21. package/dist/types/src/components/SearchList/SearchList.stories.d.ts +28 -0
  22. package/dist/types/src/components/SearchList/SearchList.stories.d.ts.map +1 -0
  23. package/dist/types/src/components/SearchList/context.d.ts +33 -0
  24. package/dist/types/src/components/SearchList/context.d.ts.map +1 -0
  25. package/dist/types/src/components/SearchList/hooks/index.d.ts +5 -0
  26. package/dist/types/src/components/SearchList/hooks/index.d.ts.map +1 -0
  27. package/dist/types/src/components/SearchList/hooks/useGlobalFilter.d.ts +34 -0
  28. package/dist/types/src/components/SearchList/hooks/useGlobalFilter.d.ts.map +1 -0
  29. package/dist/types/src/components/SearchList/hooks/useSearchListInput.d.ts +12 -0
  30. package/dist/types/src/components/SearchList/hooks/useSearchListInput.d.ts.map +1 -0
  31. package/dist/types/src/components/SearchList/hooks/useSearchListItem.d.ts +10 -0
  32. package/dist/types/src/components/SearchList/hooks/useSearchListItem.d.ts.map +1 -0
  33. package/dist/types/src/components/SearchList/hooks/useSearchListResults.d.ts +36 -0
  34. package/dist/types/src/components/SearchList/hooks/useSearchListResults.d.ts.map +1 -0
  35. package/dist/types/src/components/SearchList/index.d.ts +3 -0
  36. package/dist/types/src/components/SearchList/index.d.ts.map +1 -0
  37. package/dist/types/src/components/index.d.ts +2 -0
  38. package/dist/types/src/components/index.d.ts.map +1 -1
  39. package/dist/types/src/index.d.ts +1 -2
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/translations.d.ts +7 -6
  42. package/dist/types/src/translations.d.ts.map +1 -1
  43. package/dist/types/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +24 -20
  45. package/src/components/Combobox/Combobox.stories.tsx +62 -0
  46. package/src/components/Combobox/Combobox.tsx +348 -0
  47. package/src/components/Combobox/index.ts +5 -0
  48. package/src/components/Listbox/Listbox.stories.tsx +53 -0
  49. package/src/components/Listbox/Listbox.tsx +214 -0
  50. package/src/components/Listbox/index.ts +5 -0
  51. package/src/components/SearchList/SearchList.stories.tsx +532 -0
  52. package/src/components/SearchList/SearchList.tsx +560 -0
  53. package/src/components/SearchList/context.ts +43 -0
  54. package/src/components/SearchList/hooks/index.ts +8 -0
  55. package/src/components/SearchList/hooks/useGlobalFilter.tsx +61 -0
  56. package/src/components/SearchList/hooks/useSearchListInput.ts +14 -0
  57. package/src/components/SearchList/hooks/useSearchListItem.ts +14 -0
  58. package/src/components/SearchList/hooks/useSearchListResults.ts +104 -0
  59. package/src/components/SearchList/index.ts +6 -0
  60. package/src/components/index.ts +2 -0
  61. package/src/index.ts +1 -2
  62. package/src/translations.ts +8 -4
  63. package/src/types/command-score.d.ts +16 -0
  64. package/dist/lib/node/index.cjs +0 -324
  65. package/dist/lib/node/index.cjs.map +0 -7
  66. package/dist/lib/node/meta.json +0 -1
  67. package/dist/types/src/components/SearchList.d.ts +0 -44
  68. package/dist/types/src/components/SearchList.d.ts.map +0 -1
  69. package/dist/types/src/components/SearchList.stories.d.ts +0 -15
  70. package/dist/types/src/components/SearchList.stories.d.ts.map +0 -1
  71. package/dist/types/src/composites/PopoverCombobox.d.ts +0 -32
  72. package/dist/types/src/composites/PopoverCombobox.d.ts.map +0 -1
  73. package/dist/types/src/composites/PopoverCombobox.stories.d.ts +0 -28
  74. package/dist/types/src/composites/PopoverCombobox.stories.d.ts.map +0 -1
  75. package/dist/types/src/composites/index.d.ts +0 -2
  76. package/dist/types/src/composites/index.d.ts.map +0 -1
  77. package/src/components/SearchList.stories.tsx +0 -47
  78. package/src/components/SearchList.tsx +0 -250
  79. package/src/composites/PopoverCombobox.stories.tsx +0 -44
  80. package/src/composites/PopoverCombobox.tsx +0 -186
  81. package/src/composites/index.ts +0 -5
@@ -1,294 +1,770 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
- // packages/ui/react-ui-searchlist/src/components/SearchList.tsx
4
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
5
- import { CaretDown } from "@phosphor-icons/react";
6
- import { createContext } from "@radix-ui/react-context";
3
+ // src/components/Combobox/Combobox.tsx
4
+ import { createContext as createContext3 } from "@radix-ui/react-context";
5
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
6
+ import React3, { forwardRef as forwardRef2, useCallback as useCallback3 } from "react";
7
+ import { Button, Icon as Icon2, Popover } from "@dxos/react-ui";
8
+ import { useId } from "@dxos/react-ui";
9
+ import { mx as mx2, staticPlaceholderText } from "@dxos/ui-theme";
10
+
11
+ // src/components/SearchList/SearchList.tsx
7
12
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
8
- import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from "cmdk";
9
- import React, { forwardRef, useCallback } from "react";
10
- import { Button, useDensityContext, useElevationContext, useId, useThemeContext } from "@dxos/react-ui";
11
- import { getSize, mx, staticPlaceholderText } from "@dxos/react-ui-theme";
12
- var COMBOBOX_NAME = "Combobox";
13
- var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
14
- var SEARCHLIST_NAME = "SearchList";
15
- var SEARCHLIST_ITEM_NAME = "SearchListItem";
16
- var [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME, {});
17
- var SearchListRoot = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
18
- var _effect = _useSignals();
19
- try {
20
- return /* @__PURE__ */ React.createElement(CommandRoot, {
21
- ...props,
22
- className: mx("", classNames),
23
- ref: forwardedRef
24
- }, children);
25
- } finally {
26
- _effect.f();
27
- }
28
- });
29
- SearchListRoot.displayName = SEARCHLIST_NAME;
30
- var SearchListInput = /* @__PURE__ */ forwardRef(({ children, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
31
- var _effect = _useSignals();
32
- try {
33
- const { hasIosKeyboard } = useThemeContext();
34
- const { tx } = useThemeContext();
35
- const density = useDensityContext(propsDensity);
36
- const elevation = useElevationContext(propsElevation);
37
- return /* @__PURE__ */ React.createElement(CommandInput, {
38
- ...props,
39
- className: tx("input.input", "input", {
40
- variant,
41
- disabled: props.disabled,
42
- density,
43
- elevation
44
- }, "mbe-cardSpacingBlock", classNames),
45
- ...props.autoFocus && !hasIosKeyboard && {
46
- autoFocus: true
47
- },
48
- ref: forwardedRef
49
- });
50
- } finally {
51
- _effect.f();
13
+ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
14
+ import { Icon, useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
15
+ import { descriptionText, mx } from "@dxos/ui-theme";
16
+
17
+ // src/translations.ts
18
+ var translationKey = "@dxos/react-ui-searchlist";
19
+ var translations = [
20
+ {
21
+ "en-US": {
22
+ [translationKey]: {
23
+ "search.placeholder": "Search..."
24
+ }
25
+ }
52
26
  }
27
+ ];
28
+
29
+ // src/components/SearchList/context.ts
30
+ import { createContext } from "@radix-ui/react-context";
31
+ var [SearchListItemContextProvider, useSearchListItemContext] = createContext("SearchListItem");
32
+ var [SearchListInputContextProvider, useSearchListInputContext] = createContext("SearchListInput");
33
+
34
+ // src/components/SearchList/SearchList.tsx
35
+ var SearchListRoot = ({ children, value: valueProp, defaultValue = "", debounceMs = 200, onSearch }) => {
36
+ const [query = "", setQuery] = useControllableState({
37
+ prop: valueProp,
38
+ defaultProp: defaultValue,
39
+ onChange: void 0
40
+ });
41
+ const [selectedValue, setSelectedValue] = useState(void 0);
42
+ const itemsRef = useRef(/* @__PURE__ */ new Map());
43
+ const debounceRef = useRef(null);
44
+ const handleQueryChange = useCallback((newQuery) => {
45
+ setQuery(newQuery);
46
+ if (debounceRef.current) {
47
+ clearTimeout(debounceRef.current);
48
+ }
49
+ debounceRef.current = setTimeout(() => {
50
+ onSearch?.(newQuery);
51
+ }, debounceMs);
52
+ }, [
53
+ setQuery,
54
+ onSearch,
55
+ debounceMs
56
+ ]);
57
+ const [itemVersion, setItemVersion] = useState(0);
58
+ useEffect(() => {
59
+ return () => {
60
+ if (debounceRef.current) {
61
+ clearTimeout(debounceRef.current);
62
+ }
63
+ };
64
+ }, []);
65
+ useEffect(() => {
66
+ const currentItem = selectedValue !== void 0 ? itemsRef.current.get(selectedValue) : void 0;
67
+ const isSelectionValid = currentItem !== void 0 && !currentItem.disabled;
68
+ if (!isSelectionValid && itemsRef.current.size > 0) {
69
+ const entries = Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled);
70
+ if (entries.length > 0) {
71
+ entries.sort(([, a], [, b]) => {
72
+ const position = a.element.compareDocumentPosition(b.element);
73
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
74
+ return -1;
75
+ }
76
+ if (position & Node.DOCUMENT_POSITION_PRECEDING) {
77
+ return 1;
78
+ }
79
+ return 0;
80
+ });
81
+ const firstValue = entries[0]?.[0];
82
+ if (firstValue !== void 0 && firstValue !== selectedValue) {
83
+ setSelectedValue(firstValue);
84
+ }
85
+ } else if (selectedValue !== void 0) {
86
+ setSelectedValue(void 0);
87
+ }
88
+ }
89
+ }, [
90
+ itemVersion,
91
+ selectedValue
92
+ ]);
93
+ const registerItem = useCallback((value, element, onSelect, disabled) => {
94
+ if (element) {
95
+ itemsRef.current.set(value, {
96
+ element,
97
+ onSelect,
98
+ disabled
99
+ });
100
+ setItemVersion((v) => v + 1);
101
+ }
102
+ }, []);
103
+ const unregisterItem = useCallback((value) => {
104
+ itemsRef.current.delete(value);
105
+ setItemVersion((v) => v + 1);
106
+ }, []);
107
+ const getItemValues = useCallback(() => {
108
+ return Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled).sort(([, a], [, b]) => {
109
+ const position = a.element.compareDocumentPosition(b.element);
110
+ return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : position & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
111
+ }).map(([value]) => value);
112
+ }, []);
113
+ const triggerSelect = useCallback(() => {
114
+ if (selectedValue !== void 0) {
115
+ const item = itemsRef.current.get(selectedValue);
116
+ item?.onSelect?.();
117
+ }
118
+ }, [
119
+ selectedValue
120
+ ]);
121
+ const itemContextValue = useMemo(() => ({
122
+ selectedValue,
123
+ onSelectedValueChange: setSelectedValue,
124
+ registerItem,
125
+ unregisterItem
126
+ }), [
127
+ selectedValue,
128
+ registerItem,
129
+ unregisterItem
130
+ ]);
131
+ const inputContextValue = useMemo(() => ({
132
+ query,
133
+ onQueryChange: handleQueryChange,
134
+ selectedValue,
135
+ onSelectedValueChange: setSelectedValue,
136
+ getItemValues,
137
+ triggerSelect
138
+ }), [
139
+ query,
140
+ handleQueryChange,
141
+ selectedValue,
142
+ getItemValues,
143
+ triggerSelect
144
+ ]);
145
+ return /* @__PURE__ */ React.createElement(SearchListInputContextProvider, {
146
+ query: inputContextValue.query,
147
+ onQueryChange: inputContextValue.onQueryChange,
148
+ selectedValue: inputContextValue.selectedValue,
149
+ onSelectedValueChange: inputContextValue.onSelectedValueChange,
150
+ getItemValues: inputContextValue.getItemValues,
151
+ triggerSelect: inputContextValue.triggerSelect
152
+ }, /* @__PURE__ */ React.createElement(SearchListItemContextProvider, {
153
+ selectedValue: itemContextValue.selectedValue,
154
+ onSelectedValueChange: itemContextValue.onSelectedValueChange,
155
+ registerItem: itemContextValue.registerItem,
156
+ unregisterItem: itemContextValue.unregisterItem
157
+ }, children));
158
+ };
159
+ SearchListRoot.displayName = "SearchList.Root";
160
+ var SearchListContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
161
+ return /* @__PURE__ */ React.createElement("div", {
162
+ role: "none",
163
+ // TODO(burdon): Remove p-1 hack.
164
+ className: mx("flex flex-col gap-2 bs-full is-full min-bs-0 overflow-hidden p-1", classNames),
165
+ ref: forwardedRef
166
+ }, children);
53
167
  });
54
- var SearchListContent = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
55
- var _effect = _useSignals();
56
- try {
57
- return /* @__PURE__ */ React.createElement(CommandList, {
58
- ...props,
59
- className: mx(classNames),
60
- ref: forwardedRef
61
- }, children);
62
- } finally {
63
- _effect.f();
64
- }
168
+ SearchListContent.displayName = "SearchList.Content";
169
+ var SearchListViewport = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
170
+ return /* @__PURE__ */ React.createElement("div", {
171
+ role: "listbox",
172
+ className: mx("bs-full is-full min-bs-0 overflow-y-auto", classNames),
173
+ ref: forwardedRef
174
+ }, children);
65
175
  });
66
- var SearchListEmpty = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
67
- var _effect = _useSignals();
68
- try {
69
- return /* @__PURE__ */ React.createElement(CommandEmpty, {
70
- ...props,
71
- className: mx(classNames),
72
- ref: forwardedRef
73
- }, children);
74
- } finally {
75
- _effect.f();
76
- }
176
+ SearchListViewport.displayName = "SearchList.Viewport";
177
+ var SearchListInput = /* @__PURE__ */ forwardRef(({ classNames, density: propsDensity, elevation: propsElevation, variant, placeholder, onChange, ...props }, forwardedRef) => {
178
+ const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } = useSearchListInputContext("SearchList.Input");
179
+ const { t } = useTranslation(translationKey);
180
+ const { hasIosKeyboard, tx } = useThemeContext();
181
+ const density = useDensityContext(propsDensity);
182
+ const elevation = useElevationContext(propsElevation);
183
+ const defaultPlaceholder = t("search.placeholder");
184
+ const handleChange = useCallback((event) => {
185
+ onQueryChange(event.target.value);
186
+ onChange?.(event);
187
+ }, [
188
+ onQueryChange,
189
+ onChange
190
+ ]);
191
+ const handleKeyDown = useCallback((event) => {
192
+ const values = getItemValues();
193
+ if (values.length === 0) {
194
+ if (event.key === "Escape") {
195
+ onQueryChange("");
196
+ }
197
+ return;
198
+ }
199
+ const currentIndex = selectedValue !== void 0 ? values.indexOf(selectedValue) : -1;
200
+ switch (event.key) {
201
+ case "ArrowDown": {
202
+ event.preventDefault();
203
+ const nextIndex = currentIndex === -1 ? 0 : Math.min(currentIndex + 1, values.length - 1);
204
+ const nextValue = values[nextIndex];
205
+ if (nextValue !== void 0) {
206
+ onSelectedValueChange(nextValue);
207
+ }
208
+ break;
209
+ }
210
+ case "ArrowUp": {
211
+ event.preventDefault();
212
+ const prevIndex = currentIndex === -1 ? values.length - 1 : Math.max(currentIndex - 1, 0);
213
+ const prevValue = values[prevIndex];
214
+ if (prevValue !== void 0) {
215
+ onSelectedValueChange(prevValue);
216
+ }
217
+ break;
218
+ }
219
+ case "Enter": {
220
+ if (selectedValue !== void 0) {
221
+ event.preventDefault();
222
+ triggerSelect();
223
+ }
224
+ break;
225
+ }
226
+ case "Home": {
227
+ event.preventDefault();
228
+ const firstValue = values[0];
229
+ if (firstValue !== void 0) {
230
+ onSelectedValueChange(firstValue);
231
+ }
232
+ break;
233
+ }
234
+ case "End": {
235
+ event.preventDefault();
236
+ const lastValue = values[values.length - 1];
237
+ if (lastValue !== void 0) {
238
+ onSelectedValueChange(lastValue);
239
+ }
240
+ break;
241
+ }
242
+ case "Escape": {
243
+ event.preventDefault();
244
+ if (selectedValue !== void 0) {
245
+ onSelectedValueChange(void 0);
246
+ } else {
247
+ onQueryChange("");
248
+ }
249
+ break;
250
+ }
251
+ }
252
+ }, [
253
+ selectedValue,
254
+ onSelectedValueChange,
255
+ getItemValues,
256
+ triggerSelect,
257
+ onQueryChange
258
+ ]);
259
+ return /* @__PURE__ */ React.createElement("input", {
260
+ ...props,
261
+ ...props.autoFocus && !hasIosKeyboard && {
262
+ autoFocus: true
263
+ },
264
+ type: "text",
265
+ placeholder: placeholder ?? defaultPlaceholder,
266
+ className: tx("input.input", {
267
+ variant,
268
+ disabled: props.disabled,
269
+ density,
270
+ elevation
271
+ }, classNames),
272
+ value: query,
273
+ onChange: handleChange,
274
+ onKeyDown: handleKeyDown,
275
+ ref: forwardedRef
276
+ });
77
277
  });
78
- var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, onSelect, ...props }, forwardedRef) => {
79
- var _effect = _useSignals();
80
- try {
81
- const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);
82
- const handleSelect = useCallback((nextValue) => {
83
- onValueChange?.(nextValue);
84
- onOpenChange?.(false);
85
- onSelect?.(nextValue);
86
- }, [
87
- onValueChange,
88
- onOpenChange,
89
- onSelect
90
- ]);
91
- return /* @__PURE__ */ React.createElement(CommandItem, {
92
- ...props,
93
- onSelect: handleSelect,
94
- className: mx("p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay", classNames),
95
- ref: forwardedRef
96
- }, children);
97
- } finally {
98
- _effect.f();
99
- }
278
+ SearchListInput.displayName = "SearchList.Input";
279
+ var SearchListItem = /* @__PURE__ */ forwardRef(({ classNames, value, label, icon, checked, suffix, onSelect, disabled }, forwardedRef) => {
280
+ const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext("SearchList.Item");
281
+ const internalRef = useRef(null);
282
+ const isSelected = selectedValue === value && !disabled;
283
+ useEffect(() => {
284
+ const element = internalRef.current;
285
+ if (element) {
286
+ registerItem(value, element, onSelect, disabled);
287
+ }
288
+ return () => unregisterItem(value);
289
+ }, [
290
+ value,
291
+ onSelect,
292
+ disabled,
293
+ registerItem,
294
+ unregisterItem
295
+ ]);
296
+ useEffect(() => {
297
+ if (isSelected && internalRef.current) {
298
+ internalRef.current.scrollIntoView({
299
+ block: "nearest",
300
+ behavior: "smooth"
301
+ });
302
+ }
303
+ }, [
304
+ isSelected
305
+ ]);
306
+ const handleClick = useCallback(() => {
307
+ if (!disabled) {
308
+ onSelect?.();
309
+ }
310
+ }, [
311
+ onSelect,
312
+ disabled
313
+ ]);
314
+ return /* @__PURE__ */ React.createElement("div", {
315
+ ref: (node) => {
316
+ internalRef.current = node;
317
+ if (typeof forwardedRef === "function") {
318
+ forwardedRef(node);
319
+ } else if (forwardedRef) {
320
+ forwardedRef.current = node;
321
+ }
322
+ },
323
+ role: "option",
324
+ "aria-selected": isSelected,
325
+ "aria-disabled": disabled,
326
+ "data-selected": isSelected,
327
+ "data-disabled": disabled,
328
+ "data-value": value,
329
+ tabIndex: -1,
330
+ 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),
331
+ onClick: handleClick
332
+ }, icon && /* @__PURE__ */ React.createElement(Icon, {
333
+ icon,
334
+ size: 5
335
+ }), /* @__PURE__ */ React.createElement("span", {
336
+ className: "is-0 grow truncate"
337
+ }, label), suffix && /* @__PURE__ */ React.createElement("span", {
338
+ className: mx("shrink-0", descriptionText)
339
+ }, suffix), checked && /* @__PURE__ */ React.createElement(Icon, {
340
+ icon: "ph--check--regular",
341
+ size: 5
342
+ }));
100
343
  });
101
- SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
102
- var ComboboxRoot = ({ modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
103
- var _effect = _useSignals();
104
- try {
105
- const modalId = useId(COMBOBOX_NAME, propsModalId);
106
- const [open = false, onOpenChange] = useControllableState({
107
- prop: propsOpen,
108
- onChange: propsOnOpenChange,
109
- defaultProp: defaultOpen
110
- });
111
- const [value = "", onValueChange] = useControllableState({
112
- prop: propsValue,
113
- onChange: propsOnValueChange,
114
- defaultProp: defaultValue
115
- });
116
- return /* @__PURE__ */ React.createElement(ComboboxProvider, {
117
- isCombobox: true,
118
- modalId,
119
- open,
120
- onOpenChange,
121
- value,
122
- onValueChange,
123
- placeholder
124
- }, children);
125
- } finally {
126
- _effect.f();
127
- }
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 is-full pli-2 plb-1", classNames)
349
+ }, children);
128
350
  };
129
- ComboboxRoot.displayName = COMBOBOX_NAME;
130
- var ComboboxTrigger = /* @__PURE__ */ forwardRef(({ children, onClick, ...props }, forwardedRef) => {
131
- var _effect = _useSignals();
132
- try {
133
- const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
134
- const handleClick = useCallback((event) => {
135
- onClick?.(event);
136
- onOpenChange?.(true);
137
- }, [
138
- onClick,
139
- onOpenChange
140
- ]);
141
- return /* @__PURE__ */ React.createElement(Button, {
142
- ...props,
143
- role: "combobox",
144
- "aria-expanded": open,
145
- "aria-controls": modalId,
146
- "aria-haspopup": "dialog",
147
- onClick: handleClick,
148
- ref: forwardedRef
149
- }, children ?? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
150
- className: mx("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
151
- }, value || placeholder), /* @__PURE__ */ React.createElement(CaretDown, {
152
- weight: "bold",
153
- className: getSize(3)
154
- })));
155
- } finally {
156
- _effect.f();
157
- }
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: "pli-2 plb-1 text-xs font-medium text-description"
360
+ }, heading), children);
158
361
  });
159
- ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
362
+ SearchListGroup.displayName = "SearchList.Group";
160
363
  var SearchList = {
161
364
  Root: SearchListRoot,
162
- Input: SearchListInput,
163
365
  Content: SearchListContent,
366
+ Viewport: SearchListViewport,
367
+ Input: SearchListInput,
368
+ Item: SearchListItem,
164
369
  Empty: SearchListEmpty,
165
- Item: SearchListItem
370
+ Group: SearchListGroup
166
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
+ };
484
+ };
485
+
486
+ // src/components/Combobox/Combobox.tsx
487
+ var COMBOBOX_NAME = "Combobox";
488
+ var COMBOBOX_CONTENT_NAME = "ComboboxContent";
489
+ var COMBOBOX_ITEM_NAME = "ComboboxItem";
490
+ var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
491
+ var [ComboboxProvider, useComboboxContext] = createContext3(COMBOBOX_NAME, {});
492
+ var ComboboxRoot = ({ modal, modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
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));
517
+ };
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
+ "is-[--radix-popover-trigger-width] max-bs-[--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)));
550
+ });
551
+ ComboboxContent.displayName = COMBOBOX_CONTENT_NAME;
552
+ var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props }, forwardedRef) => {
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-is-0 truncate mie-2", !value && staticPlaceholderText)
573
+ }, value || placeholder), /* @__PURE__ */ React3.createElement(Icon2, {
574
+ icon: "ph--caret-down--bold",
575
+ size: 3
576
+ }))));
577
+ });
578
+ ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
579
+ var ComboboxVirtualTrigger = Popover.VirtualTrigger;
580
+ var ComboboxInput = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
581
+ return /* @__PURE__ */ React3.createElement(SearchList.Input, {
582
+ ...props,
583
+ classNames: [
584
+ "mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]",
585
+ classNames
586
+ ],
587
+ ref: forwardedRef
588
+ });
589
+ });
590
+ var ComboboxList = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
591
+ return /* @__PURE__ */ React3.createElement(SearchList.Viewport, {
592
+ ...props,
593
+ classNames: [
594
+ "plb-cardSpacingChrome",
595
+ classNames
596
+ ],
597
+ ref: forwardedRef
598
+ });
599
+ });
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) {
608
+ onOpenChange?.(false);
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
+ "mli-cardSpacingChrome pli-cardSpacingChrome",
622
+ classNames
623
+ ],
624
+ onSelect: handleSelect,
625
+ ref: forwardedRef
626
+ });
627
+ });
628
+ ComboboxItem.displayName = COMBOBOX_ITEM_NAME;
629
+ var ComboboxArrow = Popover.Arrow;
630
+ var ComboboxEmpty = SearchList.Empty;
631
+ var ComboboxPortal = Popover.Portal;
167
632
  var Combobox = {
168
633
  Root: ComboboxRoot,
634
+ Portal: ComboboxPortal,
635
+ Content: ComboboxContent,
169
636
  Trigger: ComboboxTrigger,
170
- useComboboxContext
637
+ VirtualTrigger: ComboboxVirtualTrigger,
638
+ Input: ComboboxInput,
639
+ List: ComboboxList,
640
+ Item: ComboboxItem,
641
+ Arrow: ComboboxArrow,
642
+ Empty: ComboboxEmpty
171
643
  };
172
644
 
173
- // packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx
174
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
175
- import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
176
- import React2, { forwardRef as forwardRef2 } from "react";
177
- import { Popover } from "@dxos/react-ui";
178
- var PopoverComboboxRoot = ({ modal, children, open: propsOpen, onOpenChange: propsOnOpenChange, defaultOpen, ...props }) => {
179
- var _effect = _useSignals2();
180
- try {
181
- const [open, onOpenChange] = useControllableState2({
182
- prop: propsOpen,
183
- onChange: propsOnOpenChange,
184
- defaultProp: defaultOpen
185
- });
186
- return /* @__PURE__ */ React2.createElement(Combobox.Root, {
187
- open,
188
- onOpenChange,
189
- ...props
190
- }, /* @__PURE__ */ React2.createElement(Popover.Root, {
191
- open,
192
- onOpenChange,
193
- modal
194
- }, children));
195
- } finally {
196
- _effect.f();
197
- }
198
- };
199
- var POPOVER_COMBOBOX_CONTENT_NAME = "PopoverComboboxContent";
200
- var PopoverComboboxContent = /* @__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) => {
201
- var _effect = _useSignals2();
202
- try {
203
- const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);
204
- return /* @__PURE__ */ React2.createElement(Popover.Content, {
205
- side,
206
- sideOffset,
207
- align,
208
- alignOffset,
209
- avoidCollisions,
210
- collisionBoundary,
211
- collisionPadding,
212
- arrowPadding,
213
- sticky,
214
- hideWhenDetached,
215
- onOpenAutoFocus,
216
- onCloseAutoFocus,
217
- onEscapeKeyDown,
218
- onPointerDownOutside,
219
- onFocusOutside,
220
- onInteractOutside,
221
- forceMount,
222
- classNames,
223
- id: modalId,
224
- ref: forwardedRef
225
- }, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(SearchList.Root, {
226
- ...props,
227
- classNames: "contents",
228
- role: "none"
229
- }, children)));
230
- } finally {
231
- _effect.f();
232
- }
645
+ // src/components/Listbox/Listbox.tsx
646
+ import { useArrowNavigationGroup } from "@fluentui/react-tabster";
647
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
648
+ import { createContextScope } from "@radix-ui/react-context";
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";
654
+ var LISTBOX_NAME = "Listbox";
655
+ var LISTBOX_OPTION_NAME = "ListboxOption";
656
+ var LISTBOX_OPTION_LABEL_NAME = "ListboxOptionLabel";
657
+ var LISTBOX_OPTION_INDICATOR_NAME = "ListboxOptionIndicator";
658
+ var [createListboxContext, createListboxScope] = createContextScope(LISTBOX_NAME, []);
659
+ var [createListboxOptionContext, createListboxOptionScope] = createContextScope(LISTBOX_OPTION_NAME, [
660
+ createListboxScope
661
+ ]);
662
+ var [ListboxProvider, useListboxContext] = createListboxContext(LISTBOX_NAME);
663
+ var [ListboxOptionProvider, useListboxOptionContext] = createListboxOptionContext(LISTBOX_OPTION_NAME);
664
+ var ListboxRoot = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
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("is-full p-cardSpacingChrome", classNames),
692
+ ref: rootRef,
693
+ ...arrowGroup
694
+ }, children));
233
695
  });
234
- PopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;
235
- var PopoverComboboxTrigger = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
236
- var _effect = _useSignals2();
237
- try {
238
- return /* @__PURE__ */ React2.createElement(Popover.Trigger, {
239
- asChild: true
240
- }, /* @__PURE__ */ React2.createElement(Combobox.Trigger, {
241
- ...props,
242
- ref: forwardedRef
243
- }));
244
- } finally {
245
- _effect.f();
246
- }
696
+ ListboxRoot.displayName = LISTBOX_NAME;
697
+ var ListboxOption = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
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", "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected=true]:bg-hoverOverlay hover:bg-hoverOverlay", 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));
247
728
  });
248
- var PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;
249
- var PopoverComboboxInput = SearchList.Input;
250
- var PopoverComboboxList = /* @__PURE__ */ forwardRef2(({ constrainInline, constrainBlock, ...props }, forwardedRef) => {
251
- var _effect = _useSignals2();
252
- try {
253
- return /* @__PURE__ */ React2.createElement(Popover.Viewport, {
254
- constrainInline,
255
- constrainBlock
256
- }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
257
- ...props,
258
- ref: forwardedRef
259
- }));
260
- } finally {
261
- _effect.f();
262
- }
729
+ ListboxOption.displayName = LISTBOX_OPTION_NAME;
730
+ var ListboxOptionLabel = /* @__PURE__ */ forwardRef3(({ children, classNames, ...rootProps }, forwardedRef) => {
731
+ return /* @__PURE__ */ React4.createElement("span", {
732
+ ...rootProps,
733
+ className: mx3("grow truncate", classNames),
734
+ ref: forwardedRef
735
+ }, children);
736
+ });
737
+ ListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;
738
+ var ListboxOptionIndicator = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
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
+ });
263
747
  });
264
- var PopoverComboboxItem = SearchList.Item;
265
- var PopoverComboboxArrow = Popover.Arrow;
266
- var PopoverComboboxEmpty = SearchList.Empty;
267
- var PopoverCombobox = {
268
- Root: PopoverComboboxRoot,
269
- Content: PopoverComboboxContent,
270
- Trigger: PopoverComboboxTrigger,
271
- VirtualTrigger: PopoverComboboxVirtualTrigger,
272
- Input: PopoverComboboxInput,
273
- List: PopoverComboboxList,
274
- Item: PopoverComboboxItem,
275
- Arrow: PopoverComboboxArrow,
276
- Empty: PopoverComboboxEmpty
748
+ ListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;
749
+ var Listbox = {
750
+ Root: ListboxRoot,
751
+ Option: ListboxOption,
752
+ OptionLabel: ListboxOptionLabel,
753
+ OptionIndicator: ListboxOptionIndicator
277
754
  };
278
-
279
- // packages/ui/react-ui-searchlist/src/translations.ts
280
- var translationKey = "searchlist";
281
- var translations_default = [
282
- {
283
- "en-US": {
284
- [translationKey]: {}
285
- }
286
- }
287
- ];
288
755
  export {
289
756
  Combobox,
290
- PopoverCombobox,
757
+ GlobalFilterProvider,
758
+ Listbox,
291
759
  SearchList,
292
- translations_default as translations
760
+ createListboxScope,
761
+ translationKey,
762
+ translations,
763
+ useGlobalFilter,
764
+ useGlobalFilteredObjects,
765
+ useListboxContext,
766
+ useSearchListInput,
767
+ useSearchListItem,
768
+ useSearchListResults
293
769
  };
294
770
  //# sourceMappingURL=index.mjs.map