@dxos/react-ui-searchlist 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +193 -216
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +193 -216
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts +44 -0
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -0
- package/dist/types/src/{composites/PopoverCombobox.stories.d.ts → components/Combobox/Combobox.stories.d.ts} +10 -1
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/index.d.ts +2 -0
- package/dist/types/src/components/Combobox/index.d.ts.map +1 -0
- package/dist/types/src/components/{Listbox.d.ts → Listbox/Listbox.d.ts} +6 -6
- package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts +21 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/index.d.ts +2 -0
- package/dist/types/src/components/Listbox/index.d.ts.map +1 -0
- package/dist/types/src/components/{SearchList.d.ts → SearchList/SearchList.d.ts} +5 -28
- package/dist/types/src/components/SearchList/SearchList.d.ts.map +1 -0
- package/dist/types/src/components/{SearchList.stories.d.ts → SearchList/SearchList.stories.d.ts} +9 -0
- package/dist/types/src/components/SearchList/SearchList.stories.d.ts.map +1 -0
- package/dist/types/src/components/SearchList/index.d.ts +2 -0
- package/dist/types/src/components/SearchList/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/components/Combobox/Combobox.stories.tsx +57 -0
- package/src/components/Combobox/Combobox.tsx +335 -0
- package/src/components/Combobox/index.ts +5 -0
- package/src/components/Listbox/Listbox.stories.tsx +53 -0
- package/src/components/{Listbox.tsx → Listbox/Listbox.tsx} +33 -9
- package/src/components/Listbox/index.ts +5 -0
- package/src/components/{SearchList.stories.tsx → SearchList/SearchList.stories.tsx} +17 -8
- package/src/components/SearchList/SearchList.tsx +163 -0
- package/src/components/SearchList/index.ts +5 -0
- package/src/components/index.ts +2 -1
- package/src/index.ts +0 -1
- package/src/translations.ts +3 -1
- package/dist/types/src/components/Listbox.d.ts.map +0 -1
- package/dist/types/src/components/Listbox.stories.d.ts +0 -16
- package/dist/types/src/components/Listbox.stories.d.ts.map +0 -1
- package/dist/types/src/components/SearchList.d.ts.map +0 -1
- package/dist/types/src/components/SearchList.stories.d.ts.map +0 -1
- package/dist/types/src/composites/PopoverCombobox.d.ts +0 -32
- package/dist/types/src/composites/PopoverCombobox.d.ts.map +0 -1
- package/dist/types/src/composites/PopoverCombobox.stories.d.ts.map +0 -1
- package/dist/types/src/composites/index.d.ts +0 -2
- package/dist/types/src/composites/index.d.ts.map +0 -1
- package/src/components/Listbox.stories.tsx +0 -73
- package/src/components/SearchList.tsx +0 -251
- package/src/composites/PopoverCombobox.stories.tsx +0 -47
- package/src/composites/PopoverCombobox.tsx +0 -209
- package/src/composites/index.ts +0 -5
|
@@ -1,24 +1,44 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// src/components/
|
|
4
|
-
import { useSignals as
|
|
3
|
+
// src/components/Combobox/Combobox.tsx
|
|
4
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
5
5
|
import { createContext } from "@radix-ui/react-context";
|
|
6
6
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
7
|
+
import React2, { forwardRef as forwardRef2, useCallback } from "react";
|
|
8
|
+
import { Button, Icon, Popover } from "@dxos/react-ui";
|
|
9
|
+
import { useId } from "@dxos/react-ui";
|
|
10
|
+
import { mx as mx2, staticPlaceholderText } from "@dxos/react-ui-theme";
|
|
11
|
+
|
|
12
|
+
// src/components/SearchList/SearchList.tsx
|
|
13
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
7
14
|
import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from "cmdk";
|
|
8
|
-
import React, { forwardRef
|
|
9
|
-
import {
|
|
10
|
-
import { mx
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
import React, { forwardRef } from "react";
|
|
16
|
+
import { useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
17
|
+
import { mx } from "@dxos/react-ui-theme";
|
|
18
|
+
|
|
19
|
+
// src/translations.ts
|
|
20
|
+
var translationKey = "react-ui-searchlist";
|
|
21
|
+
var translations = [
|
|
22
|
+
{
|
|
23
|
+
"en-US": {
|
|
24
|
+
[translationKey]: {
|
|
25
|
+
"search.placeholder": "Search..."
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// src/components/SearchList/SearchList.tsx
|
|
32
|
+
var commandItem = "flex items-center overflow-hidden";
|
|
33
|
+
var searchListItem = "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected]:bg-hoverOverlay hover:bg-hoverOverlay";
|
|
13
34
|
var SEARCHLIST_NAME = "SearchList";
|
|
14
35
|
var SEARCHLIST_ITEM_NAME = "SearchListItem";
|
|
15
|
-
var [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME, {});
|
|
16
36
|
var SearchListRoot = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
|
|
17
37
|
var _effect = _useSignals();
|
|
18
38
|
try {
|
|
19
39
|
return /* @__PURE__ */ React.createElement(CommandRoot, {
|
|
20
40
|
...props,
|
|
21
|
-
className: mx(
|
|
41
|
+
className: mx(classNames),
|
|
22
42
|
ref: forwardedRef
|
|
23
43
|
}, children);
|
|
24
44
|
} finally {
|
|
@@ -29,12 +49,15 @@ SearchListRoot.displayName = SEARCHLIST_NAME;
|
|
|
29
49
|
var SearchListInput = /* @__PURE__ */ forwardRef(({ classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
30
50
|
var _effect = _useSignals();
|
|
31
51
|
try {
|
|
52
|
+
const { t } = useTranslation(translationKey);
|
|
53
|
+
const placeholder = props.placeholder ?? t("search.placeholder");
|
|
32
54
|
const { hasIosKeyboard } = useThemeContext();
|
|
33
55
|
const { tx } = useThemeContext();
|
|
34
56
|
const density = useDensityContext(propsDensity);
|
|
35
57
|
const elevation = useElevationContext(propsElevation);
|
|
36
58
|
return /* @__PURE__ */ React.createElement(CommandInput, {
|
|
37
59
|
...props,
|
|
60
|
+
placeholder,
|
|
38
61
|
className: tx("input.input", "input", {
|
|
39
62
|
variant,
|
|
40
63
|
disabled: props.disabled,
|
|
@@ -74,24 +97,11 @@ var SearchListEmpty = /* @__PURE__ */ forwardRef(({ children, classNames, ...pro
|
|
|
74
97
|
_effect.f();
|
|
75
98
|
}
|
|
76
99
|
});
|
|
77
|
-
var
|
|
78
|
-
var searchListItem = "plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected]:bg-hoverOverlay hover:bg-hoverOverlay";
|
|
79
|
-
var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, onSelect, ...props }, forwardedRef) => {
|
|
100
|
+
var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
|
|
80
101
|
var _effect = _useSignals();
|
|
81
102
|
try {
|
|
82
|
-
const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);
|
|
83
|
-
const handleSelect = useCallback((nextValue) => {
|
|
84
|
-
onValueChange?.(nextValue);
|
|
85
|
-
onOpenChange?.(false);
|
|
86
|
-
onSelect?.(nextValue);
|
|
87
|
-
}, [
|
|
88
|
-
onValueChange,
|
|
89
|
-
onOpenChange,
|
|
90
|
-
onSelect
|
|
91
|
-
]);
|
|
92
103
|
return /* @__PURE__ */ React.createElement(CommandItem, {
|
|
93
104
|
...props,
|
|
94
|
-
onSelect: handleSelect,
|
|
95
105
|
className: mx(searchListItem, classNames),
|
|
96
106
|
ref: forwardedRef
|
|
97
107
|
}, children);
|
|
@@ -100,8 +110,22 @@ var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, onSelec
|
|
|
100
110
|
}
|
|
101
111
|
});
|
|
102
112
|
SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
|
|
103
|
-
var
|
|
104
|
-
|
|
113
|
+
var SearchList = {
|
|
114
|
+
Root: SearchListRoot,
|
|
115
|
+
Input: SearchListInput,
|
|
116
|
+
Content: SearchListContent,
|
|
117
|
+
Empty: SearchListEmpty,
|
|
118
|
+
Item: SearchListItem
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/components/Combobox/Combobox.tsx
|
|
122
|
+
var COMBOBOX_NAME = "Combobox";
|
|
123
|
+
var COMBOBOX_CONTENT_NAME = "ComboboxContent";
|
|
124
|
+
var COMBOBOX_ITEM_NAME = "ComboboxItem";
|
|
125
|
+
var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
|
|
126
|
+
var [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME, {});
|
|
127
|
+
var ComboboxRoot = ({ modal, modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
|
|
128
|
+
var _effect = _useSignals2();
|
|
105
129
|
try {
|
|
106
130
|
const modalId = useId(COMBOBOX_NAME, propsModalId);
|
|
107
131
|
const [open = false, onOpenChange] = useControllableState({
|
|
@@ -114,22 +138,63 @@ var ComboboxRoot = ({ modalId: propsModalId, open: propsOpen, defaultOpen, onOpe
|
|
|
114
138
|
onChange: propsOnValueChange,
|
|
115
139
|
defaultProp: defaultValue
|
|
116
140
|
});
|
|
117
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ React2.createElement(Popover.Root, {
|
|
142
|
+
open,
|
|
143
|
+
onOpenChange,
|
|
144
|
+
modal
|
|
145
|
+
}, /* @__PURE__ */ React2.createElement(ComboboxProvider, {
|
|
118
146
|
isCombobox: true,
|
|
119
147
|
modalId,
|
|
148
|
+
placeholder,
|
|
120
149
|
open,
|
|
121
150
|
onOpenChange,
|
|
122
151
|
value,
|
|
123
|
-
onValueChange
|
|
124
|
-
|
|
125
|
-
}, children);
|
|
152
|
+
onValueChange
|
|
153
|
+
}, children));
|
|
126
154
|
} finally {
|
|
127
155
|
_effect.f();
|
|
128
156
|
}
|
|
129
157
|
};
|
|
130
|
-
|
|
131
|
-
var
|
|
132
|
-
|
|
158
|
+
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) => {
|
|
159
|
+
var _effect = _useSignals2();
|
|
160
|
+
try {
|
|
161
|
+
const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);
|
|
162
|
+
return /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
163
|
+
side,
|
|
164
|
+
sideOffset,
|
|
165
|
+
align,
|
|
166
|
+
alignOffset,
|
|
167
|
+
avoidCollisions,
|
|
168
|
+
collisionBoundary,
|
|
169
|
+
collisionPadding,
|
|
170
|
+
arrowPadding,
|
|
171
|
+
sticky,
|
|
172
|
+
hideWhenDetached,
|
|
173
|
+
onOpenAutoFocus,
|
|
174
|
+
onCloseAutoFocus,
|
|
175
|
+
onEscapeKeyDown,
|
|
176
|
+
onPointerDownOutside,
|
|
177
|
+
onFocusOutside,
|
|
178
|
+
onInteractOutside,
|
|
179
|
+
forceMount,
|
|
180
|
+
classNames: [
|
|
181
|
+
"is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr]",
|
|
182
|
+
classNames
|
|
183
|
+
],
|
|
184
|
+
id: modalId,
|
|
185
|
+
ref: forwardedRef
|
|
186
|
+
}, /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
187
|
+
...props,
|
|
188
|
+
classNames: "contents density-fine",
|
|
189
|
+
role: "none"
|
|
190
|
+
}, children));
|
|
191
|
+
} finally {
|
|
192
|
+
_effect.f();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
ComboboxContent.displayName = COMBOBOX_CONTENT_NAME;
|
|
196
|
+
var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props }, forwardedRef) => {
|
|
197
|
+
var _effect = _useSignals2();
|
|
133
198
|
try {
|
|
134
199
|
const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
|
|
135
200
|
const handleClick = useCallback((event) => {
|
|
@@ -139,7 +204,9 @@ var ComboboxTrigger = /* @__PURE__ */ forwardRef(({ children, onClick, ...props
|
|
|
139
204
|
onClick,
|
|
140
205
|
onOpenChange
|
|
141
206
|
]);
|
|
142
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
208
|
+
asChild: true
|
|
209
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
143
210
|
...props,
|
|
144
211
|
role: "combobox",
|
|
145
212
|
"aria-expanded": open,
|
|
@@ -147,39 +214,98 @@ var ComboboxTrigger = /* @__PURE__ */ forwardRef(({ children, onClick, ...props
|
|
|
147
214
|
"aria-haspopup": "dialog",
|
|
148
215
|
onClick: handleClick,
|
|
149
216
|
ref: forwardedRef
|
|
150
|
-
}, children ?? /* @__PURE__ */
|
|
151
|
-
className:
|
|
152
|
-
}, value || placeholder), /* @__PURE__ */
|
|
217
|
+
}, children ?? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("span", {
|
|
218
|
+
className: mx2("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
|
|
219
|
+
}, value || placeholder), /* @__PURE__ */ React2.createElement(Icon, {
|
|
153
220
|
icon: "ph--caret-down--bold",
|
|
154
221
|
size: 3
|
|
155
|
-
})));
|
|
222
|
+
}))));
|
|
156
223
|
} finally {
|
|
157
224
|
_effect.f();
|
|
158
225
|
}
|
|
159
226
|
});
|
|
160
227
|
ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
228
|
+
var ComboboxVirtualTrigger = Popover.VirtualTrigger;
|
|
229
|
+
var ComboboxInput = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
|
|
230
|
+
var _effect = _useSignals2();
|
|
231
|
+
try {
|
|
232
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
233
|
+
...props,
|
|
234
|
+
classNames: [
|
|
235
|
+
"mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]",
|
|
236
|
+
classNames
|
|
237
|
+
],
|
|
238
|
+
ref: forwardedRef
|
|
239
|
+
});
|
|
240
|
+
} finally {
|
|
241
|
+
_effect.f();
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
var ComboboxList = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
|
|
245
|
+
var _effect = _useSignals2();
|
|
246
|
+
try {
|
|
247
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
248
|
+
...props,
|
|
249
|
+
classNames: [
|
|
250
|
+
"min-bs-0 overflow-y-auto plb-cardSpacingChrome",
|
|
251
|
+
classNames
|
|
252
|
+
],
|
|
253
|
+
ref: forwardedRef
|
|
254
|
+
});
|
|
255
|
+
} finally {
|
|
256
|
+
_effect.f();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
var ComboboxItem = /* @__PURE__ */ forwardRef2(({ classNames, onSelect, ...props }, forwardedRef) => {
|
|
260
|
+
var _effect = _useSignals2();
|
|
261
|
+
try {
|
|
262
|
+
const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);
|
|
263
|
+
const handleSelect = useCallback((nextValue) => {
|
|
264
|
+
onSelect?.(nextValue);
|
|
265
|
+
onValueChange?.(nextValue);
|
|
266
|
+
onOpenChange?.(false);
|
|
267
|
+
}, [
|
|
268
|
+
onSelect,
|
|
269
|
+
onValueChange,
|
|
270
|
+
onOpenChange
|
|
271
|
+
]);
|
|
272
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
273
|
+
...props,
|
|
274
|
+
classNames: [
|
|
275
|
+
"mli-cardSpacingChrome pli-cardSpacingChrome",
|
|
276
|
+
classNames
|
|
277
|
+
],
|
|
278
|
+
onSelect: handleSelect,
|
|
279
|
+
ref: forwardedRef
|
|
280
|
+
});
|
|
281
|
+
} finally {
|
|
282
|
+
_effect.f();
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
ComboboxItem.displayName = COMBOBOX_ITEM_NAME;
|
|
286
|
+
var ComboboxArrow = Popover.Arrow;
|
|
287
|
+
var ComboboxEmpty = SearchList.Empty;
|
|
168
288
|
var Combobox = {
|
|
169
289
|
Root: ComboboxRoot,
|
|
290
|
+
Content: ComboboxContent,
|
|
170
291
|
Trigger: ComboboxTrigger,
|
|
171
|
-
|
|
292
|
+
VirtualTrigger: ComboboxVirtualTrigger,
|
|
293
|
+
Input: ComboboxInput,
|
|
294
|
+
List: ComboboxList,
|
|
295
|
+
Item: ComboboxItem,
|
|
296
|
+
Arrow: ComboboxArrow,
|
|
297
|
+
Empty: ComboboxEmpty
|
|
172
298
|
};
|
|
173
299
|
|
|
174
|
-
// src/components/Listbox.tsx
|
|
175
|
-
import { useSignals as
|
|
300
|
+
// src/components/Listbox/Listbox.tsx
|
|
301
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
176
302
|
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
177
303
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
178
304
|
import { createContextScope } from "@radix-ui/react-context";
|
|
179
305
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
180
|
-
import
|
|
306
|
+
import React3, { forwardRef as forwardRef3, useCallback as useCallback2, useEffect, useRef } from "react";
|
|
181
307
|
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
182
|
-
import { mx as
|
|
308
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
183
309
|
var LISTBOX_NAME = "Listbox";
|
|
184
310
|
var LISTBOX_OPTION_NAME = "ListboxOption";
|
|
185
311
|
var LISTBOX_OPTION_LABEL_NAME = "ListboxOptionLabel";
|
|
@@ -190,8 +316,8 @@ var [createListboxOptionContext, createListboxOptionScope] = createContextScope(
|
|
|
190
316
|
]);
|
|
191
317
|
var [ListboxProvider, useListboxContext] = createListboxContext(LISTBOX_NAME);
|
|
192
318
|
var [ListboxOptionProvider, useListboxOptionContext] = createListboxOptionContext(LISTBOX_OPTION_NAME);
|
|
193
|
-
var ListboxRoot = /* @__PURE__ */
|
|
194
|
-
var _effect =
|
|
319
|
+
var ListboxRoot = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
320
|
+
var _effect = _useSignals3();
|
|
195
321
|
try {
|
|
196
322
|
const { __listboxScope, children, classNames, value: propsValue, defaultValue, onValueChange, autoFocus, ...rootProps } = props;
|
|
197
323
|
const arrowGroup = useArrowNavigationGroup({
|
|
@@ -212,14 +338,14 @@ var ListboxRoot = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
|
|
|
212
338
|
}, [
|
|
213
339
|
autoFocus
|
|
214
340
|
]);
|
|
215
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ React3.createElement(ListboxProvider, {
|
|
216
342
|
scope: __listboxScope,
|
|
217
343
|
selectedValue,
|
|
218
344
|
onValueChange: handleValueChange
|
|
219
|
-
}, /* @__PURE__ */
|
|
345
|
+
}, /* @__PURE__ */ React3.createElement("ul", {
|
|
220
346
|
role: "listbox",
|
|
221
347
|
...rootProps,
|
|
222
|
-
className:
|
|
348
|
+
className: mx3("is-full p-cardSpacingChrome", classNames),
|
|
223
349
|
ref: rootRef,
|
|
224
350
|
...arrowGroup
|
|
225
351
|
}, children));
|
|
@@ -228,8 +354,8 @@ var ListboxRoot = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
|
|
|
228
354
|
}
|
|
229
355
|
});
|
|
230
356
|
ListboxRoot.displayName = LISTBOX_NAME;
|
|
231
|
-
var ListboxOption = /* @__PURE__ */
|
|
232
|
-
var _effect =
|
|
357
|
+
var ListboxOption = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
358
|
+
var _effect = _useSignals3();
|
|
233
359
|
try {
|
|
234
360
|
const { __listboxScope, children, classNames, value, ...rootProps } = props;
|
|
235
361
|
const { selectedValue, onValueChange } = useListboxContext(LISTBOX_OPTION_NAME, __listboxScope);
|
|
@@ -240,16 +366,16 @@ var ListboxOption = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
|
|
|
240
366
|
value,
|
|
241
367
|
onValueChange
|
|
242
368
|
]);
|
|
243
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ React3.createElement(ListboxOptionProvider, {
|
|
244
370
|
scope: __listboxScope,
|
|
245
371
|
value,
|
|
246
372
|
isSelected
|
|
247
|
-
}, /* @__PURE__ */
|
|
373
|
+
}, /* @__PURE__ */ React3.createElement("li", {
|
|
248
374
|
role: "option",
|
|
249
375
|
...rootProps,
|
|
250
376
|
"aria-selected": isSelected,
|
|
251
377
|
tabIndex: 0,
|
|
252
|
-
className:
|
|
378
|
+
className: mx3("dx-focus-ring", commandItem, searchListItem, classNames),
|
|
253
379
|
onClick: handleSelect,
|
|
254
380
|
onKeyDown: ({ key }) => {
|
|
255
381
|
if ([
|
|
@@ -266,12 +392,12 @@ var ListboxOption = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
|
|
|
266
392
|
}
|
|
267
393
|
});
|
|
268
394
|
ListboxOption.displayName = LISTBOX_OPTION_NAME;
|
|
269
|
-
var ListboxOptionLabel = /* @__PURE__ */
|
|
270
|
-
var _effect =
|
|
395
|
+
var ListboxOptionLabel = /* @__PURE__ */ forwardRef3(({ children, classNames, ...rootProps }, forwardedRef) => {
|
|
396
|
+
var _effect = _useSignals3();
|
|
271
397
|
try {
|
|
272
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ React3.createElement("span", {
|
|
273
399
|
...rootProps,
|
|
274
|
-
className:
|
|
400
|
+
className: mx3("grow truncate", classNames),
|
|
275
401
|
ref: forwardedRef
|
|
276
402
|
}, children);
|
|
277
403
|
} finally {
|
|
@@ -279,15 +405,15 @@ var ListboxOptionLabel = /* @__PURE__ */ forwardRef2(({ children, classNames, ..
|
|
|
279
405
|
}
|
|
280
406
|
});
|
|
281
407
|
ListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;
|
|
282
|
-
var ListboxOptionIndicator = /* @__PURE__ */
|
|
283
|
-
var _effect =
|
|
408
|
+
var ListboxOptionIndicator = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
409
|
+
var _effect = _useSignals3();
|
|
284
410
|
try {
|
|
285
411
|
const { __listboxOptionScope, classNames, ...rootProps } = props;
|
|
286
412
|
const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);
|
|
287
|
-
return /* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */ React3.createElement(Icon2, {
|
|
288
414
|
icon: "ph--check--regular",
|
|
289
415
|
...rootProps,
|
|
290
|
-
classNames:
|
|
416
|
+
classNames: mx3(!isSelected && "invisible", classNames),
|
|
291
417
|
ref: forwardedRef
|
|
292
418
|
});
|
|
293
419
|
} finally {
|
|
@@ -301,158 +427,9 @@ var Listbox = {
|
|
|
301
427
|
OptionLabel: ListboxOptionLabel,
|
|
302
428
|
OptionIndicator: ListboxOptionIndicator
|
|
303
429
|
};
|
|
304
|
-
|
|
305
|
-
// src/composites/PopoverCombobox.tsx
|
|
306
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
307
|
-
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
308
|
-
import React3, { forwardRef as forwardRef3 } from "react";
|
|
309
|
-
import { Popover } from "@dxos/react-ui";
|
|
310
|
-
var PopoverComboboxRoot = ({ modal, children, open: propsOpen, onOpenChange: propsOnOpenChange, defaultOpen, ...props }) => {
|
|
311
|
-
var _effect = _useSignals3();
|
|
312
|
-
try {
|
|
313
|
-
const [open, onOpenChange] = useControllableState3({
|
|
314
|
-
prop: propsOpen,
|
|
315
|
-
onChange: propsOnOpenChange,
|
|
316
|
-
defaultProp: defaultOpen
|
|
317
|
-
});
|
|
318
|
-
return /* @__PURE__ */ React3.createElement(Combobox.Root, {
|
|
319
|
-
open,
|
|
320
|
-
onOpenChange,
|
|
321
|
-
...props
|
|
322
|
-
}, /* @__PURE__ */ React3.createElement(Popover.Root, {
|
|
323
|
-
open,
|
|
324
|
-
onOpenChange,
|
|
325
|
-
modal
|
|
326
|
-
}, children));
|
|
327
|
-
} finally {
|
|
328
|
-
_effect.f();
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
var POPOVER_COMBOBOX_CONTENT_NAME = "PopoverComboboxContent";
|
|
332
|
-
var PopoverComboboxContent = /* @__PURE__ */ forwardRef3(({ side = "bottom", collisionPadding = 48, sideOffset, align, alignOffset, avoidCollisions, collisionBoundary, arrowPadding, sticky, hideWhenDetached, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, forceMount, children, classNames, ...props }, forwardedRef) => {
|
|
333
|
-
var _effect = _useSignals3();
|
|
334
|
-
try {
|
|
335
|
-
const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);
|
|
336
|
-
return /* @__PURE__ */ React3.createElement(Popover.Content, {
|
|
337
|
-
side,
|
|
338
|
-
sideOffset,
|
|
339
|
-
align,
|
|
340
|
-
alignOffset,
|
|
341
|
-
avoidCollisions,
|
|
342
|
-
collisionBoundary,
|
|
343
|
-
collisionPadding,
|
|
344
|
-
arrowPadding,
|
|
345
|
-
sticky,
|
|
346
|
-
hideWhenDetached,
|
|
347
|
-
onOpenAutoFocus,
|
|
348
|
-
onCloseAutoFocus,
|
|
349
|
-
onEscapeKeyDown,
|
|
350
|
-
onPointerDownOutside,
|
|
351
|
-
onFocusOutside,
|
|
352
|
-
onInteractOutside,
|
|
353
|
-
forceMount,
|
|
354
|
-
classNames: [
|
|
355
|
-
"is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr]",
|
|
356
|
-
classNames
|
|
357
|
-
],
|
|
358
|
-
id: modalId,
|
|
359
|
-
ref: forwardedRef
|
|
360
|
-
}, /* @__PURE__ */ React3.createElement(SearchList.Root, {
|
|
361
|
-
...props,
|
|
362
|
-
classNames: "contents density-fine",
|
|
363
|
-
role: "none"
|
|
364
|
-
}, children));
|
|
365
|
-
} finally {
|
|
366
|
-
_effect.f();
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
PopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;
|
|
370
|
-
var PopoverComboboxTrigger = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
371
|
-
var _effect = _useSignals3();
|
|
372
|
-
try {
|
|
373
|
-
return /* @__PURE__ */ React3.createElement(Popover.Trigger, {
|
|
374
|
-
asChild: true
|
|
375
|
-
}, /* @__PURE__ */ React3.createElement(Combobox.Trigger, {
|
|
376
|
-
...props,
|
|
377
|
-
ref: forwardedRef
|
|
378
|
-
}));
|
|
379
|
-
} finally {
|
|
380
|
-
_effect.f();
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
var PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;
|
|
384
|
-
var PopoverComboboxInput = /* @__PURE__ */ forwardRef3(({ classNames, ...props }, forwardedRef) => {
|
|
385
|
-
var _effect = _useSignals3();
|
|
386
|
-
try {
|
|
387
|
-
return /* @__PURE__ */ React3.createElement(SearchList.Input, {
|
|
388
|
-
...props,
|
|
389
|
-
classNames: [
|
|
390
|
-
"mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]",
|
|
391
|
-
classNames
|
|
392
|
-
],
|
|
393
|
-
ref: forwardedRef
|
|
394
|
-
});
|
|
395
|
-
} finally {
|
|
396
|
-
_effect.f();
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
var PopoverComboboxList = /* @__PURE__ */ forwardRef3(({ classNames, ...props }, forwardedRef) => {
|
|
400
|
-
var _effect = _useSignals3();
|
|
401
|
-
try {
|
|
402
|
-
return /* @__PURE__ */ React3.createElement(SearchList.Content, {
|
|
403
|
-
...props,
|
|
404
|
-
classNames: [
|
|
405
|
-
"min-bs-0 overflow-y-auto plb-cardSpacingChrome",
|
|
406
|
-
classNames
|
|
407
|
-
],
|
|
408
|
-
ref: forwardedRef
|
|
409
|
-
});
|
|
410
|
-
} finally {
|
|
411
|
-
_effect.f();
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
var PopoverComboboxItem = /* @__PURE__ */ forwardRef3(({ classNames, ...props }, forwardedRef) => {
|
|
415
|
-
var _effect = _useSignals3();
|
|
416
|
-
try {
|
|
417
|
-
return /* @__PURE__ */ React3.createElement(SearchList.Item, {
|
|
418
|
-
...props,
|
|
419
|
-
classNames: [
|
|
420
|
-
"mli-cardSpacingChrome pli-cardSpacingChrome",
|
|
421
|
-
classNames
|
|
422
|
-
],
|
|
423
|
-
ref: forwardedRef
|
|
424
|
-
});
|
|
425
|
-
} finally {
|
|
426
|
-
_effect.f();
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
var PopoverComboboxArrow = Popover.Arrow;
|
|
430
|
-
var PopoverComboboxEmpty = SearchList.Empty;
|
|
431
|
-
var PopoverCombobox = {
|
|
432
|
-
Root: PopoverComboboxRoot,
|
|
433
|
-
Content: PopoverComboboxContent,
|
|
434
|
-
Trigger: PopoverComboboxTrigger,
|
|
435
|
-
VirtualTrigger: PopoverComboboxVirtualTrigger,
|
|
436
|
-
Input: PopoverComboboxInput,
|
|
437
|
-
List: PopoverComboboxList,
|
|
438
|
-
Item: PopoverComboboxItem,
|
|
439
|
-
Arrow: PopoverComboboxArrow,
|
|
440
|
-
Empty: PopoverComboboxEmpty
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// src/translations.ts
|
|
444
|
-
var translationKey = "react-ui-searchlist";
|
|
445
|
-
var translations = [
|
|
446
|
-
{
|
|
447
|
-
"en-US": {
|
|
448
|
-
[translationKey]: {}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
];
|
|
452
430
|
export {
|
|
453
431
|
Combobox,
|
|
454
432
|
Listbox,
|
|
455
|
-
PopoverCombobox,
|
|
456
433
|
SearchList,
|
|
457
434
|
commandItem,
|
|
458
435
|
createListboxScope,
|