@dxos/react-ui-list 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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 +746 -93
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +746 -93
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Accordion/Accordion.d.ts +1 -1
- package/dist/types/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/Accordion.stories.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionRoot.d.ts +1 -1
- package/dist/types/src/components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts +105 -0
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts +12 -0
- 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/List/List.d.ts +14 -5
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +2 -2
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListItem.d.ts +3 -3
- package/dist/types/src/components/List/ListItem.d.ts.map +1 -1
- package/dist/types/src/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/src/components/List/testing.d.ts.map +1 -1
- package/dist/types/src/components/Listbox/Listbox.d.ts +27 -0
- package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts +12 -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/Picker/Picker.d.ts +49 -0
- package/dist/types/src/components/Picker/Picker.d.ts.map +1 -0
- package/dist/types/src/components/Picker/Picker.stories.d.ts +28 -0
- package/dist/types/src/components/Picker/Picker.stories.d.ts.map +1 -0
- package/dist/types/src/components/Picker/context.d.ts +29 -0
- package/dist/types/src/components/Picker/context.d.ts.map +1 -0
- package/dist/types/src/components/Picker/index.d.ts +3 -0
- package/dist/types/src/components/Picker/index.d.ts.map +1 -0
- package/dist/types/src/components/RowList/RowList.d.ts +61 -0
- package/dist/types/src/components/RowList/RowList.d.ts.map +1 -0
- package/dist/types/src/components/RowList/RowList.stories.d.ts +35 -0
- package/dist/types/src/components/RowList/RowList.stories.d.ts.map +1 -0
- package/dist/types/src/components/RowList/index.d.ts +3 -0
- package/dist/types/src/components/RowList/index.d.ts.map +1 -0
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
- package/dist/types/src/components/Tree/helpers.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/Combobox/Combobox.stories.tsx +60 -0
- package/src/components/Combobox/Combobox.tsx +387 -0
- package/src/components/Combobox/index.ts +5 -0
- package/src/components/List/List.tsx +11 -2
- package/src/components/Listbox/Listbox.stories.tsx +48 -0
- package/src/components/Listbox/Listbox.tsx +201 -0
- package/src/components/Listbox/index.ts +5 -0
- package/src/components/Picker/Picker.stories.tsx +131 -0
- package/src/components/Picker/Picker.tsx +439 -0
- package/src/components/Picker/context.ts +43 -0
- package/src/components/Picker/index.ts +6 -0
- package/src/components/RowList/RowList.stories.tsx +163 -0
- package/src/components/RowList/RowList.tsx +353 -0
- package/src/components/RowList/index.ts +6 -0
- package/src/components/index.ts +4 -0
|
@@ -68,30 +68,469 @@ var Accordion = {
|
|
|
68
68
|
ItemBody: AccordionItemBody
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// src/components/Combobox/Combobox.tsx
|
|
72
|
+
import { createContext as createContext4 } from "@radix-ui/react-context";
|
|
73
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
74
|
+
import React4, { forwardRef as forwardRef2, useCallback as useCallback2 } from "react";
|
|
75
|
+
import { Button, Icon as Icon2, Popover, ScrollArea, useId } from "@dxos/react-ui";
|
|
76
|
+
import { composable, composableProps, mx as mx4 } from "@dxos/ui-theme";
|
|
77
|
+
|
|
78
|
+
// src/components/Picker/Picker.tsx
|
|
79
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
80
|
+
import React3, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
81
|
+
import { Input, useThemeContext } from "@dxos/react-ui";
|
|
82
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
83
|
+
|
|
84
|
+
// src/components/Picker/context.ts
|
|
85
|
+
import { createContext as createContext3 } from "@radix-ui/react-context";
|
|
86
|
+
var [PickerItemContextProvider, usePickerItemContext] = createContext3("PickerItem");
|
|
87
|
+
var [PickerInputContextProvider, usePickerInputContext] = createContext3("PickerInput");
|
|
88
|
+
|
|
89
|
+
// src/components/Picker/Picker.tsx
|
|
90
|
+
var PickerRoot = ({ children }) => {
|
|
91
|
+
const [selectedValue, setSelectedValue] = useState(void 0);
|
|
92
|
+
const itemsRef = useRef(/* @__PURE__ */ new Map());
|
|
93
|
+
const [itemVersion, setItemVersion] = useState(0);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const current = selectedValue !== void 0 ? itemsRef.current.get(selectedValue) : void 0;
|
|
96
|
+
const isValid = current !== void 0 && !current.disabled;
|
|
97
|
+
if (!isValid && itemsRef.current.size > 0) {
|
|
98
|
+
const entries = Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled);
|
|
99
|
+
if (entries.length > 0) {
|
|
100
|
+
entries.sort(([, a], [, b]) => {
|
|
101
|
+
const position = a.element.compareDocumentPosition(b.element);
|
|
102
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
103
|
+
return -1;
|
|
104
|
+
}
|
|
105
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
108
|
+
return 0;
|
|
109
|
+
});
|
|
110
|
+
const firstValue = entries[0]?.[0];
|
|
111
|
+
if (firstValue !== void 0 && firstValue !== selectedValue) {
|
|
112
|
+
setSelectedValue(firstValue);
|
|
113
|
+
}
|
|
114
|
+
} else if (selectedValue !== void 0) {
|
|
115
|
+
setSelectedValue(void 0);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, [
|
|
119
|
+
itemVersion,
|
|
120
|
+
selectedValue
|
|
121
|
+
]);
|
|
122
|
+
const registerItem = useCallback((value, element, onSelect, disabled) => {
|
|
123
|
+
if (element) {
|
|
124
|
+
itemsRef.current.set(value, {
|
|
125
|
+
element,
|
|
126
|
+
onSelect,
|
|
127
|
+
disabled
|
|
128
|
+
});
|
|
129
|
+
setItemVersion((v) => v + 1);
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
const unregisterItem = useCallback((value) => {
|
|
133
|
+
itemsRef.current.delete(value);
|
|
134
|
+
setItemVersion((v) => v + 1);
|
|
135
|
+
}, []);
|
|
136
|
+
const getItemValues = useCallback(() => {
|
|
137
|
+
return Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled).sort(([, a], [, b]) => {
|
|
138
|
+
const position = a.element.compareDocumentPosition(b.element);
|
|
139
|
+
return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : position & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
140
|
+
}).map(([value]) => value);
|
|
141
|
+
}, []);
|
|
142
|
+
const triggerSelect = useCallback(() => {
|
|
143
|
+
if (selectedValue !== void 0) {
|
|
144
|
+
const item = itemsRef.current.get(selectedValue);
|
|
145
|
+
item?.onSelect?.();
|
|
146
|
+
}
|
|
147
|
+
}, [
|
|
148
|
+
selectedValue
|
|
149
|
+
]);
|
|
150
|
+
const itemContextValue = useMemo(() => ({
|
|
151
|
+
selectedValue,
|
|
152
|
+
onSelectedValueChange: setSelectedValue,
|
|
153
|
+
registerItem,
|
|
154
|
+
unregisterItem
|
|
155
|
+
}), [
|
|
156
|
+
selectedValue,
|
|
157
|
+
registerItem,
|
|
158
|
+
unregisterItem
|
|
159
|
+
]);
|
|
160
|
+
const inputContextValue = useMemo(() => ({
|
|
161
|
+
selectedValue,
|
|
162
|
+
onSelectedValueChange: setSelectedValue,
|
|
163
|
+
getItemValues,
|
|
164
|
+
triggerSelect
|
|
165
|
+
}), [
|
|
166
|
+
selectedValue,
|
|
167
|
+
getItemValues,
|
|
168
|
+
triggerSelect
|
|
169
|
+
]);
|
|
170
|
+
return /* @__PURE__ */ React3.createElement(PickerInputContextProvider, inputContextValue, /* @__PURE__ */ React3.createElement(PickerItemContextProvider, itemContextValue, children));
|
|
171
|
+
};
|
|
172
|
+
PickerRoot.displayName = "Picker.Root";
|
|
173
|
+
var PickerInput = /* @__PURE__ */ forwardRef(({ value, onValueChange, onChange, onKeyDown, autoFocus, ...props }, forwardedRef) => {
|
|
174
|
+
const { hasIosKeyboard } = useThemeContext();
|
|
175
|
+
const { selectedValue, onSelectedValueChange, getItemValues, triggerSelect } = usePickerInputContext("Picker.Input");
|
|
176
|
+
const handleChange = useCallback((event) => {
|
|
177
|
+
onValueChange?.(event.target.value);
|
|
178
|
+
onChange?.(event);
|
|
179
|
+
}, [
|
|
180
|
+
onValueChange,
|
|
181
|
+
onChange
|
|
182
|
+
]);
|
|
183
|
+
const handleKeyDown = useCallback((event) => {
|
|
184
|
+
onKeyDown?.(event);
|
|
185
|
+
if (event.defaultPrevented) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const values = getItemValues();
|
|
189
|
+
if (values.length === 0) {
|
|
190
|
+
if (event.key === "Escape") {
|
|
191
|
+
onValueChange?.("");
|
|
192
|
+
}
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const currentIndex = selectedValue !== void 0 ? values.indexOf(selectedValue) : -1;
|
|
196
|
+
switch (event.key) {
|
|
197
|
+
case "ArrowDown": {
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
const nextIndex = currentIndex === -1 ? 0 : Math.min(currentIndex + 1, values.length - 1);
|
|
200
|
+
const nextValue = values[nextIndex];
|
|
201
|
+
if (nextValue !== void 0) {
|
|
202
|
+
onSelectedValueChange(nextValue);
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "ArrowUp": {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
const prevIndex = currentIndex === -1 ? values.length - 1 : Math.max(currentIndex - 1, 0);
|
|
209
|
+
const prevValue = values[prevIndex];
|
|
210
|
+
if (prevValue !== void 0) {
|
|
211
|
+
onSelectedValueChange(prevValue);
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
case "Enter": {
|
|
216
|
+
if (selectedValue !== void 0) {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
triggerSelect();
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case "Home": {
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
const firstValue = values[0];
|
|
225
|
+
if (firstValue !== void 0) {
|
|
226
|
+
onSelectedValueChange(firstValue);
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case "End": {
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
const lastValue = values[values.length - 1];
|
|
233
|
+
if (lastValue !== void 0) {
|
|
234
|
+
onSelectedValueChange(lastValue);
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case "Escape": {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
if (selectedValue !== void 0) {
|
|
241
|
+
onSelectedValueChange(void 0);
|
|
242
|
+
} else {
|
|
243
|
+
onValueChange?.("");
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}, [
|
|
249
|
+
selectedValue,
|
|
250
|
+
onSelectedValueChange,
|
|
251
|
+
getItemValues,
|
|
252
|
+
triggerSelect,
|
|
253
|
+
onValueChange,
|
|
254
|
+
onKeyDown
|
|
255
|
+
]);
|
|
256
|
+
return /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.TextInput, {
|
|
257
|
+
...props,
|
|
258
|
+
autoFocus: autoFocus && !hasIosKeyboard,
|
|
259
|
+
...value !== void 0 && {
|
|
260
|
+
value
|
|
261
|
+
},
|
|
262
|
+
onChange: handleChange,
|
|
263
|
+
onKeyDown: handleKeyDown,
|
|
264
|
+
ref: forwardedRef
|
|
265
|
+
}));
|
|
266
|
+
});
|
|
267
|
+
PickerInput.displayName = "Picker.Input";
|
|
268
|
+
var PickerItem = /* @__PURE__ */ forwardRef(({ classNames, value, onSelect, disabled, asChild, children, ...props }, forwardedRef) => {
|
|
269
|
+
const { selectedValue, onSelectedValueChange, registerItem, unregisterItem } = usePickerItemContext("Picker.Item");
|
|
270
|
+
const internalRef = useRef(null);
|
|
271
|
+
const isSelected = selectedValue === value && !disabled;
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
const element = internalRef.current;
|
|
274
|
+
if (element) {
|
|
275
|
+
registerItem(value, element, onSelect, disabled);
|
|
276
|
+
}
|
|
277
|
+
return () => unregisterItem(value);
|
|
278
|
+
}, [
|
|
279
|
+
value,
|
|
280
|
+
onSelect,
|
|
281
|
+
disabled,
|
|
282
|
+
registerItem,
|
|
283
|
+
unregisterItem
|
|
284
|
+
]);
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (isSelected && internalRef.current) {
|
|
287
|
+
internalRef.current.scrollIntoView({
|
|
288
|
+
block: "nearest",
|
|
289
|
+
behavior: "smooth"
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}, [
|
|
293
|
+
isSelected
|
|
294
|
+
]);
|
|
295
|
+
const handleClick = useCallback(() => {
|
|
296
|
+
if (disabled) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
onSelectedValueChange(value);
|
|
300
|
+
onSelect?.();
|
|
301
|
+
}, [
|
|
302
|
+
disabled,
|
|
303
|
+
value,
|
|
304
|
+
onSelectedValueChange,
|
|
305
|
+
onSelect
|
|
306
|
+
]);
|
|
307
|
+
const handleMouseDown = useCallback((event) => {
|
|
308
|
+
event.preventDefault();
|
|
309
|
+
}, []);
|
|
310
|
+
const Comp = asChild ? Slot : "div";
|
|
311
|
+
return /* @__PURE__ */ React3.createElement(Comp, {
|
|
312
|
+
...props,
|
|
313
|
+
ref: (node) => {
|
|
314
|
+
internalRef.current = node;
|
|
315
|
+
if (typeof forwardedRef === "function") {
|
|
316
|
+
forwardedRef(node);
|
|
317
|
+
} else if (forwardedRef) {
|
|
318
|
+
forwardedRef.current = node;
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
role: "option",
|
|
322
|
+
"aria-selected": isSelected,
|
|
323
|
+
"aria-disabled": disabled,
|
|
324
|
+
"data-selected": isSelected,
|
|
325
|
+
"data-disabled": disabled,
|
|
326
|
+
"data-value": value,
|
|
327
|
+
// tabIndex={-1} — combobox pattern keeps browser focus on the
|
|
328
|
+
// input; the selected option is highlighted via `aria-selected`,
|
|
329
|
+
// not via DOM focus. Differs from `Row` (listbox pattern,
|
|
330
|
+
// tabIndex={0}). See header comment.
|
|
331
|
+
tabIndex: -1,
|
|
332
|
+
className: mx3("dx-hover dx-selected px-[var(--gutter,0.75rem)] py-1 cursor-pointer select-none", disabled && "opacity-50 cursor-not-allowed", classNames),
|
|
333
|
+
onMouseDown: handleMouseDown,
|
|
334
|
+
onClick: handleClick
|
|
335
|
+
}, children);
|
|
336
|
+
});
|
|
337
|
+
PickerItem.displayName = "Picker.Item";
|
|
338
|
+
var Picker = {
|
|
339
|
+
Root: PickerRoot,
|
|
340
|
+
Input: PickerInput,
|
|
341
|
+
Item: PickerItem
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// src/components/Combobox/Combobox.tsx
|
|
345
|
+
var COMBOBOX_NAME = "Combobox";
|
|
346
|
+
var COMBOBOX_CONTENT_NAME = "ComboboxContent";
|
|
347
|
+
var COMBOBOX_ITEM_NAME = "ComboboxItem";
|
|
348
|
+
var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
|
|
349
|
+
var [ComboboxProvider, useComboboxContext] = createContext4(COMBOBOX_NAME, {});
|
|
350
|
+
var ComboboxRoot = ({ children, modal, modalId: modalIdProp, open: openProp, defaultOpen, onOpenChange: propsOnOpenChange, value: valueProp, defaultValue, onValueChange: propsOnValueChange, placeholder }) => {
|
|
351
|
+
const modalId = useId(COMBOBOX_NAME, modalIdProp);
|
|
352
|
+
const [open = false, onOpenChange] = useControllableState({
|
|
353
|
+
prop: openProp,
|
|
354
|
+
defaultProp: defaultOpen,
|
|
355
|
+
onChange: propsOnOpenChange
|
|
356
|
+
});
|
|
357
|
+
const [value = "", onValueChange] = useControllableState({
|
|
358
|
+
prop: valueProp,
|
|
359
|
+
defaultProp: defaultValue,
|
|
360
|
+
onChange: propsOnValueChange
|
|
361
|
+
});
|
|
362
|
+
return /* @__PURE__ */ React4.createElement(Popover.Root, {
|
|
363
|
+
open,
|
|
364
|
+
onOpenChange,
|
|
365
|
+
modal
|
|
366
|
+
}, /* @__PURE__ */ React4.createElement(ComboboxProvider, {
|
|
367
|
+
isCombobox: true,
|
|
368
|
+
modalId,
|
|
369
|
+
placeholder,
|
|
370
|
+
open,
|
|
371
|
+
onOpenChange,
|
|
372
|
+
value,
|
|
373
|
+
onValueChange
|
|
374
|
+
}, children));
|
|
375
|
+
};
|
|
376
|
+
var ComboboxContent = composable(({ children, ...props }, forwardedRef) => {
|
|
377
|
+
const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);
|
|
378
|
+
return /* @__PURE__ */ React4.createElement(Popover.Content, {
|
|
379
|
+
...composableProps(props, {
|
|
380
|
+
id: modalId
|
|
381
|
+
}),
|
|
382
|
+
ref: forwardedRef
|
|
383
|
+
}, /* @__PURE__ */ React4.createElement(Popover.Viewport, {
|
|
384
|
+
classNames: "w-(--radix-popover-trigger-width)"
|
|
385
|
+
}, /* @__PURE__ */ React4.createElement(Picker.Root, null, children)));
|
|
386
|
+
});
|
|
387
|
+
ComboboxContent.displayName = COMBOBOX_CONTENT_NAME;
|
|
388
|
+
var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props }, forwardedRef) => {
|
|
389
|
+
const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
|
|
390
|
+
const handleClick = useCallback2((event) => {
|
|
391
|
+
onClick?.(event);
|
|
392
|
+
onOpenChange?.(true);
|
|
393
|
+
}, [
|
|
394
|
+
onClick,
|
|
395
|
+
onOpenChange
|
|
396
|
+
]);
|
|
397
|
+
return /* @__PURE__ */ React4.createElement(Popover.Trigger, {
|
|
398
|
+
asChild: true
|
|
399
|
+
}, /* @__PURE__ */ React4.createElement(Button, {
|
|
400
|
+
...props,
|
|
401
|
+
role: "combobox",
|
|
402
|
+
"aria-expanded": open,
|
|
403
|
+
"aria-controls": modalId,
|
|
404
|
+
"aria-haspopup": "dialog",
|
|
405
|
+
onClick: handleClick,
|
|
406
|
+
ref: forwardedRef
|
|
407
|
+
}, children ?? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("span", {
|
|
408
|
+
className: mx4("font-normal text-start flex-1 min-w-0 truncate me-2", !value && "text-subdued")
|
|
409
|
+
}, value || placeholder), /* @__PURE__ */ React4.createElement(Icon2, {
|
|
410
|
+
icon: "ph--caret-down--bold",
|
|
411
|
+
size: 3
|
|
412
|
+
}))));
|
|
413
|
+
});
|
|
414
|
+
ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
|
|
415
|
+
var ComboboxVirtualTrigger = Popover.VirtualTrigger;
|
|
416
|
+
var ComboboxInput = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
|
|
417
|
+
return /* @__PURE__ */ React4.createElement(Picker.Input, {
|
|
418
|
+
...props,
|
|
419
|
+
classNames: [
|
|
420
|
+
"m-form-chrome mb-0 w-[calc(100%-2*var(--spacing-form-chrome))]",
|
|
421
|
+
classNames
|
|
422
|
+
],
|
|
423
|
+
ref: forwardedRef
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
ComboboxInput.displayName = "Combobox.Input";
|
|
427
|
+
var ComboboxList = /* @__PURE__ */ forwardRef2(({ classNames, children, ...props }, forwardedRef) => {
|
|
428
|
+
return /* @__PURE__ */ React4.createElement(ScrollArea.Root, {
|
|
429
|
+
...composableProps(props, {
|
|
430
|
+
classNames: [
|
|
431
|
+
"py-form-chrome",
|
|
432
|
+
classNames
|
|
433
|
+
]
|
|
434
|
+
}),
|
|
435
|
+
role: "listbox",
|
|
436
|
+
centered: true,
|
|
437
|
+
padding: true,
|
|
438
|
+
thin: true,
|
|
439
|
+
ref: forwardedRef
|
|
440
|
+
}, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, children));
|
|
441
|
+
});
|
|
442
|
+
ComboboxList.displayName = "Combobox.List";
|
|
443
|
+
var ComboboxItem = /* @__PURE__ */ forwardRef2(({ classNames, onSelect, value, label, icon, iconClassNames, checked, suffix, disabled, closeOnSelect = true, children }, forwardedRef) => {
|
|
444
|
+
const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);
|
|
445
|
+
const handleSelect = useCallback2(() => {
|
|
446
|
+
onSelect?.();
|
|
447
|
+
if (value !== void 0) {
|
|
448
|
+
onValueChange?.(value);
|
|
449
|
+
}
|
|
450
|
+
if (closeOnSelect) {
|
|
451
|
+
onOpenChange?.(false);
|
|
452
|
+
}
|
|
453
|
+
}, [
|
|
454
|
+
onSelect,
|
|
455
|
+
onValueChange,
|
|
456
|
+
onOpenChange,
|
|
457
|
+
value,
|
|
458
|
+
closeOnSelect
|
|
459
|
+
]);
|
|
460
|
+
return /* @__PURE__ */ React4.createElement(Picker.Item, {
|
|
461
|
+
value,
|
|
462
|
+
disabled,
|
|
463
|
+
onSelect: handleSelect,
|
|
464
|
+
ref: forwardedRef,
|
|
465
|
+
classNames: [
|
|
466
|
+
// Full width inside the viewport (no horizontal margin).
|
|
467
|
+
// `px-3 py-1`, `cursor-pointer`, `select-none` and the
|
|
468
|
+
// `dx-hover` / `dx-selected` pairing come from `Picker.Item`'s
|
|
469
|
+
// defaults; we only add the row-shape (flex / icons + label)
|
|
470
|
+
// and the disabled overrides on top.
|
|
471
|
+
"flex w-full gap-2 items-center",
|
|
472
|
+
disabled && "hover:bg-transparent data-[selected=true]:bg-transparent",
|
|
473
|
+
classNames
|
|
474
|
+
]
|
|
475
|
+
}, children ?? /* @__PURE__ */ React4.createElement(React4.Fragment, null, icon && /* @__PURE__ */ React4.createElement(Icon2, {
|
|
476
|
+
icon,
|
|
477
|
+
classNames: iconClassNames
|
|
478
|
+
}), /* @__PURE__ */ React4.createElement("span", {
|
|
479
|
+
className: "w-0 grow truncate"
|
|
480
|
+
}, label), suffix && /* @__PURE__ */ React4.createElement("span", {
|
|
481
|
+
className: "shrink-0 text-description"
|
|
482
|
+
}, suffix), checked && /* @__PURE__ */ React4.createElement(Icon2, {
|
|
483
|
+
icon: "ph--check--regular"
|
|
484
|
+
})));
|
|
485
|
+
});
|
|
486
|
+
ComboboxItem.displayName = COMBOBOX_ITEM_NAME;
|
|
487
|
+
var ComboboxArrow = Popover.Arrow;
|
|
488
|
+
var ComboboxEmpty = /* @__PURE__ */ forwardRef2(({ classNames, children }, forwardedRef) => {
|
|
489
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
490
|
+
ref: forwardedRef,
|
|
491
|
+
role: "status",
|
|
492
|
+
className: mx4(classNames)
|
|
493
|
+
}, children);
|
|
494
|
+
});
|
|
495
|
+
ComboboxEmpty.displayName = "Combobox.Empty";
|
|
496
|
+
var ComboboxPortal = Popover.Portal;
|
|
497
|
+
var Combobox = {
|
|
498
|
+
Root: ComboboxRoot,
|
|
499
|
+
Portal: ComboboxPortal,
|
|
500
|
+
Content: ComboboxContent,
|
|
501
|
+
Trigger: ComboboxTrigger,
|
|
502
|
+
VirtualTrigger: ComboboxVirtualTrigger,
|
|
503
|
+
Input: ComboboxInput,
|
|
504
|
+
List: ComboboxList,
|
|
505
|
+
Item: ComboboxItem,
|
|
506
|
+
Arrow: ComboboxArrow,
|
|
507
|
+
Empty: ComboboxEmpty
|
|
508
|
+
};
|
|
509
|
+
|
|
71
510
|
// src/components/List/ListItem.tsx
|
|
72
511
|
import { attachClosestEdge, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
73
512
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
74
513
|
import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
75
514
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
76
|
-
import { createContext as
|
|
77
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
78
|
-
import
|
|
515
|
+
import { createContext as createContext6 } from "@radix-ui/react-context";
|
|
516
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
517
|
+
import React6, { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
79
518
|
import { createPortal } from "react-dom";
|
|
80
519
|
import { invariant } from "@dxos/invariant";
|
|
81
520
|
import { IconButton, ListItem as NaturalListItem, useTranslation } from "@dxos/react-ui";
|
|
82
|
-
import { mx as
|
|
521
|
+
import { mx as mx5, osTranslations } from "@dxos/ui-theme";
|
|
83
522
|
|
|
84
523
|
// src/components/List/ListRoot.tsx
|
|
85
524
|
import { extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
86
525
|
import { getReorderDestinationIndex } from "@atlaskit/pragmatic-drag-and-drop-hitbox/util/get-reorder-destination-index";
|
|
87
526
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
88
|
-
import { createContext as
|
|
89
|
-
import
|
|
527
|
+
import { createContext as createContext5 } from "@radix-ui/react-context";
|
|
528
|
+
import React5, { useCallback as useCallback3, useEffect as useEffect2, useState as useState2 } from "react";
|
|
90
529
|
var LIST_NAME = "List";
|
|
91
|
-
var [ListProvider, useListContext] =
|
|
530
|
+
var [ListProvider, useListContext] = createContext5(LIST_NAME);
|
|
92
531
|
var defaultGetId2 = (item) => item?.id;
|
|
93
532
|
var ListRoot = ({ children, items, isItem, getId = defaultGetId2, onMove, ...props }) => {
|
|
94
|
-
const isEqual =
|
|
533
|
+
const isEqual = useCallback3((a, b) => {
|
|
95
534
|
const idA = getId?.(a);
|
|
96
535
|
const idB = getId?.(b);
|
|
97
536
|
if (idA !== void 0 && idB !== void 0) {
|
|
@@ -102,8 +541,8 @@ var ListRoot = ({ children, items, isItem, getId = defaultGetId2, onMove, ...pro
|
|
|
102
541
|
}, [
|
|
103
542
|
getId
|
|
104
543
|
]);
|
|
105
|
-
const [state, setState] =
|
|
106
|
-
|
|
544
|
+
const [state, setState] = useState2(idle);
|
|
545
|
+
useEffect2(() => {
|
|
107
546
|
if (!items) {
|
|
108
547
|
return;
|
|
109
548
|
}
|
|
@@ -139,7 +578,7 @@ var ListRoot = ({ children, items, isItem, getId = defaultGetId2, onMove, ...pro
|
|
|
139
578
|
isEqual,
|
|
140
579
|
onMove
|
|
141
580
|
]);
|
|
142
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ React5.createElement(ListProvider, {
|
|
143
582
|
state,
|
|
144
583
|
setState,
|
|
145
584
|
isItem,
|
|
@@ -160,24 +599,16 @@ var stateStyles = {
|
|
|
160
599
|
};
|
|
161
600
|
var defaultContext = {};
|
|
162
601
|
var LIST_ITEM_NAME = "ListItem";
|
|
163
|
-
var [ListItemProvider, useListItemContext] =
|
|
602
|
+
var [ListItemProvider, useListItemContext] = createContext6(LIST_ITEM_NAME, defaultContext);
|
|
164
603
|
var ListItem = ({ children, classNames, item, asChild, selected, ...props }) => {
|
|
165
|
-
const Comp = asChild ?
|
|
604
|
+
const Comp = asChild ? Slot2 : "div";
|
|
166
605
|
const { isItem, readonly, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);
|
|
167
|
-
const rootRef =
|
|
168
|
-
const dragHandleRef =
|
|
169
|
-
const [state, setState] =
|
|
170
|
-
|
|
606
|
+
const rootRef = useRef2(null);
|
|
607
|
+
const dragHandleRef = useRef2(null);
|
|
608
|
+
const [state, setState] = useState3(idle);
|
|
609
|
+
useEffect3(() => {
|
|
171
610
|
const element = rootRef.current;
|
|
172
|
-
invariant(element, void 0, {
|
|
173
|
-
F: __dxlog_file,
|
|
174
|
-
L: 109,
|
|
175
|
-
S: void 0,
|
|
176
|
-
A: [
|
|
177
|
-
"element",
|
|
178
|
-
""
|
|
179
|
-
]
|
|
180
|
-
});
|
|
611
|
+
invariant(element, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 37, S: void 0, A: ["element", ""] });
|
|
181
612
|
return combine(
|
|
182
613
|
//
|
|
183
614
|
// https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#draggable
|
|
@@ -277,23 +708,23 @@ var ListItem = ({ children, classNames, item, asChild, selected, ...props }) =>
|
|
|
277
708
|
}, [
|
|
278
709
|
item
|
|
279
710
|
]);
|
|
280
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ React6.createElement(ListItemProvider, {
|
|
281
712
|
item,
|
|
282
713
|
dragHandleRef
|
|
283
|
-
}, /* @__PURE__ */
|
|
714
|
+
}, /* @__PURE__ */ React6.createElement(Comp, {
|
|
284
715
|
...props,
|
|
285
716
|
role: "listitem",
|
|
286
717
|
"aria-selected": selected,
|
|
287
|
-
className:
|
|
718
|
+
className: mx5("relative p-1 dx-selected dx-hover", classNames, stateStyles[state.type]),
|
|
288
719
|
ref: rootRef
|
|
289
|
-
}, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */
|
|
720
|
+
}, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React6.createElement(NaturalListItem.DropIndicator, {
|
|
290
721
|
edge: state.closestEdge
|
|
291
722
|
}));
|
|
292
723
|
};
|
|
293
724
|
var ListItemIconButton = ({ autoHide = true, iconOnly = true, variant = "ghost", classNames, disabled, ...props }) => {
|
|
294
725
|
const { state } = useListContext("ITEM_BUTTON");
|
|
295
726
|
const isDisabled = state.type !== "idle" || disabled;
|
|
296
|
-
return /* @__PURE__ */
|
|
727
|
+
return /* @__PURE__ */ React6.createElement(IconButton, {
|
|
297
728
|
...props,
|
|
298
729
|
disabled: isDisabled,
|
|
299
730
|
iconOnly,
|
|
@@ -308,7 +739,7 @@ var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph-
|
|
|
308
739
|
const { state } = useListContext("DELETE_BUTTON");
|
|
309
740
|
const isDisabled = state.type !== "idle" || disabled;
|
|
310
741
|
const { t } = useTranslation(osTranslations);
|
|
311
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ React6.createElement(IconButton, {
|
|
312
743
|
...props,
|
|
313
744
|
variant: "ghost",
|
|
314
745
|
disabled: isDisabled,
|
|
@@ -324,7 +755,7 @@ var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph-
|
|
|
324
755
|
var ListItemDragHandle = ({ disabled }) => {
|
|
325
756
|
const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
|
|
326
757
|
const { t } = useTranslation(osTranslations);
|
|
327
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ React6.createElement(IconButton, {
|
|
328
759
|
variant: "ghost",
|
|
329
760
|
disabled,
|
|
330
761
|
icon: "ph--dots-six-vertical--regular",
|
|
@@ -339,13 +770,13 @@ var ListItemDragPreview = ({ children }) => {
|
|
|
339
770
|
item: state.item
|
|
340
771
|
}), state.container) : null;
|
|
341
772
|
};
|
|
342
|
-
var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */
|
|
773
|
+
var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */ React6.createElement("div", {
|
|
343
774
|
role: "none",
|
|
344
|
-
className:
|
|
775
|
+
className: mx5("flex w-full gap-2", classNames)
|
|
345
776
|
}, children);
|
|
346
|
-
var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */
|
|
777
|
+
var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */ React6.createElement("div", {
|
|
347
778
|
role: "none",
|
|
348
|
-
className:
|
|
779
|
+
className: mx5("flex grow items-center truncate", classNames),
|
|
349
780
|
...props
|
|
350
781
|
}, children);
|
|
351
782
|
|
|
@@ -361,15 +792,235 @@ var List = {
|
|
|
361
792
|
ItemTitle: ListItemTitle
|
|
362
793
|
};
|
|
363
794
|
|
|
795
|
+
// src/components/Listbox/Listbox.tsx
|
|
796
|
+
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
797
|
+
import React8, { forwardRef as forwardRef3 } from "react";
|
|
798
|
+
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
799
|
+
import { mx as mx6 } from "@dxos/ui-theme";
|
|
800
|
+
|
|
801
|
+
// src/components/RowList/RowList.tsx
|
|
802
|
+
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
803
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
804
|
+
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
805
|
+
import React7, { useCallback as useCallback4 } from "react";
|
|
806
|
+
import { List as List2, ListItem as ListItem2 } from "@dxos/react-list";
|
|
807
|
+
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
808
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
|
|
809
|
+
var ROW_LIST_NAME = "RowList";
|
|
810
|
+
var ROW_LIST_ROOT_NAME = "RowList.Root";
|
|
811
|
+
var ROW_LIST_VIEWPORT_NAME = "RowList.Viewport";
|
|
812
|
+
var ROW_LIST_CONTENT_NAME = "RowList.Content";
|
|
813
|
+
var ROW_NAME = "List.Row";
|
|
814
|
+
var [createRowListContext, createRowListScope] = createContextScope(ROW_LIST_NAME, []);
|
|
815
|
+
var [RowListProvider, useRowListContext] = createRowListContext(ROW_LIST_NAME);
|
|
816
|
+
var Root2 = ({ selectedId, defaultSelectedId, onSelectChange, children }) => {
|
|
817
|
+
const [resolved, setResolved] = useControllableState2({
|
|
818
|
+
prop: selectedId,
|
|
819
|
+
defaultProp: defaultSelectedId,
|
|
820
|
+
onChange: (next) => {
|
|
821
|
+
if (next !== void 0) {
|
|
822
|
+
onSelectChange?.(next);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
const setSelected = useCallback4((id) => setResolved(id), [
|
|
827
|
+
setResolved
|
|
828
|
+
]);
|
|
829
|
+
return /* @__PURE__ */ React7.createElement(RowListProvider, {
|
|
830
|
+
scope: void 0,
|
|
831
|
+
selectedId: resolved,
|
|
832
|
+
setSelected
|
|
833
|
+
}, children);
|
|
834
|
+
};
|
|
835
|
+
Root2.displayName = ROW_LIST_ROOT_NAME;
|
|
836
|
+
var Viewport = composable2((props, forwardedRef) => {
|
|
837
|
+
const { thin, padding, centered, children, ...rest } = props;
|
|
838
|
+
const composed = composableProps2(rest, {
|
|
839
|
+
classNames: "dx-container"
|
|
840
|
+
});
|
|
841
|
+
return /* @__PURE__ */ React7.createElement(ScrollArea2.Root, {
|
|
842
|
+
orientation: "vertical",
|
|
843
|
+
thin,
|
|
844
|
+
padding,
|
|
845
|
+
centered,
|
|
846
|
+
...composed,
|
|
847
|
+
ref: forwardedRef
|
|
848
|
+
}, /* @__PURE__ */ React7.createElement(ScrollArea2.Viewport, null, children));
|
|
849
|
+
});
|
|
850
|
+
Viewport.displayName = ROW_LIST_VIEWPORT_NAME;
|
|
851
|
+
var firstEnabledOption = (ul) => {
|
|
852
|
+
if (!ul) {
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
855
|
+
return ul.querySelector('[role="option"]:not([aria-disabled="true"])');
|
|
856
|
+
};
|
|
857
|
+
var Content2 = composable2((props, forwardedRef) => {
|
|
858
|
+
useRowListContext(ROW_LIST_CONTENT_NAME, void 0);
|
|
859
|
+
const arrowGroup = useArrowNavigationGroup({
|
|
860
|
+
axis: "vertical",
|
|
861
|
+
memorizeCurrent: true
|
|
862
|
+
});
|
|
863
|
+
const { children, ...rest } = props;
|
|
864
|
+
const handleFocus = useCallback4((event) => {
|
|
865
|
+
if (event.target !== event.currentTarget) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
const ul = event.currentTarget;
|
|
869
|
+
const selected = ul.querySelector('[role="option"][aria-selected="true"]:not([aria-disabled="true"])');
|
|
870
|
+
const target = selected ?? firstEnabledOption(ul);
|
|
871
|
+
target?.focus();
|
|
872
|
+
}, []);
|
|
873
|
+
const composed = composableProps2(rest, {
|
|
874
|
+
classNames: "flex flex-col"
|
|
875
|
+
});
|
|
876
|
+
return /* @__PURE__ */ React7.createElement(List2, {
|
|
877
|
+
variant: "unordered",
|
|
878
|
+
...composed,
|
|
879
|
+
...arrowGroup,
|
|
880
|
+
role: "listbox",
|
|
881
|
+
onFocus: handleFocus,
|
|
882
|
+
ref: forwardedRef
|
|
883
|
+
}, children);
|
|
884
|
+
});
|
|
885
|
+
Content2.displayName = ROW_LIST_CONTENT_NAME;
|
|
886
|
+
var ROW_BASE = "dx-hover dx-selected px-3 py-2 cursor-pointer outline-none border-b border-separator last:border-b-0";
|
|
887
|
+
var Row = composable2((props, forwardedRef) => {
|
|
888
|
+
const { id, disabled, onClick, onFocus, children, ...rest } = props;
|
|
889
|
+
const { selectedId, setSelected } = useRowListContext(ROW_NAME, void 0);
|
|
890
|
+
const isSelected = selectedId === id;
|
|
891
|
+
const handleClick = useCallback4((event) => {
|
|
892
|
+
if (disabled) {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
setSelected(id);
|
|
896
|
+
onClick?.(event);
|
|
897
|
+
}, [
|
|
898
|
+
disabled,
|
|
899
|
+
id,
|
|
900
|
+
setSelected,
|
|
901
|
+
onClick
|
|
902
|
+
]);
|
|
903
|
+
const handleFocus = useCallback4((event) => {
|
|
904
|
+
if (!disabled && selectedId !== id) {
|
|
905
|
+
setSelected(id);
|
|
906
|
+
}
|
|
907
|
+
onFocus?.(event);
|
|
908
|
+
}, [
|
|
909
|
+
disabled,
|
|
910
|
+
selectedId,
|
|
911
|
+
id,
|
|
912
|
+
setSelected,
|
|
913
|
+
onFocus
|
|
914
|
+
]);
|
|
915
|
+
const composed = composableProps2(rest, {
|
|
916
|
+
classNames: [
|
|
917
|
+
ROW_BASE,
|
|
918
|
+
disabled && "opacity-50 cursor-not-allowed"
|
|
919
|
+
]
|
|
920
|
+
});
|
|
921
|
+
return /* @__PURE__ */ React7.createElement(ListItem2, {
|
|
922
|
+
...composed,
|
|
923
|
+
role: "option",
|
|
924
|
+
tabIndex: 0,
|
|
925
|
+
"aria-selected": isSelected,
|
|
926
|
+
"aria-disabled": disabled || void 0,
|
|
927
|
+
onClick: handleClick,
|
|
928
|
+
onFocus: handleFocus,
|
|
929
|
+
ref: forwardedRef
|
|
930
|
+
}, children);
|
|
931
|
+
});
|
|
932
|
+
Row.displayName = ROW_NAME;
|
|
933
|
+
var useRowListSelection = (id) => {
|
|
934
|
+
const { selectedId } = useRowListContext("useRowListSelection", void 0);
|
|
935
|
+
return selectedId === id;
|
|
936
|
+
};
|
|
937
|
+
var RowList = {
|
|
938
|
+
Root: Root2,
|
|
939
|
+
Viewport,
|
|
940
|
+
Content: Content2
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// src/components/Listbox/Listbox.tsx
|
|
944
|
+
var commandItem = "flex items-center overflow-hidden";
|
|
945
|
+
var LISTBOX_NAME = "Listbox";
|
|
946
|
+
var LISTBOX_OPTION_NAME = "ListboxOption";
|
|
947
|
+
var LISTBOX_OPTION_LABEL_NAME = "ListboxOptionLabel";
|
|
948
|
+
var LISTBOX_OPTION_INDICATOR_NAME = "ListboxOptionIndicator";
|
|
949
|
+
var [createListboxContext, createListboxScope] = createContextScope2(LISTBOX_NAME, [
|
|
950
|
+
createRowListScope
|
|
951
|
+
]);
|
|
952
|
+
var [createListboxOptionContext, createListboxOptionScope] = createContextScope2(LISTBOX_OPTION_NAME, [
|
|
953
|
+
createListboxScope
|
|
954
|
+
]);
|
|
955
|
+
var [ListboxOptionProvider, useListboxOptionContext] = createListboxOptionContext(LISTBOX_OPTION_NAME);
|
|
956
|
+
var ListboxRoot = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
957
|
+
const { __listboxScope: _scope, children, classNames, value, defaultValue, onValueChange, autoFocus: _autoFocus, ...rootProps } = props;
|
|
958
|
+
return /* @__PURE__ */ React8.createElement(RowList.Root, {
|
|
959
|
+
selectedId: value,
|
|
960
|
+
defaultSelectedId: defaultValue,
|
|
961
|
+
onSelectChange: onValueChange
|
|
962
|
+
}, /* @__PURE__ */ React8.createElement(RowList.Content, {
|
|
963
|
+
...rootProps,
|
|
964
|
+
classNames: mx6("w-full", classNames),
|
|
965
|
+
ref: forwardedRef
|
|
966
|
+
}, children));
|
|
967
|
+
});
|
|
968
|
+
ListboxRoot.displayName = LISTBOX_NAME;
|
|
969
|
+
var ListboxOption = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
970
|
+
const { __listboxScope, children, classNames, value, ...rootProps } = props;
|
|
971
|
+
return /* @__PURE__ */ React8.createElement(Row, {
|
|
972
|
+
id: value,
|
|
973
|
+
...rootProps,
|
|
974
|
+
classNames: mx6("dx-focus-ring rounded-xs", commandItem, classNames),
|
|
975
|
+
ref: forwardedRef
|
|
976
|
+
}, /* @__PURE__ */ React8.createElement(ListboxOptionProviderHost, {
|
|
977
|
+
value
|
|
978
|
+
}, children));
|
|
979
|
+
});
|
|
980
|
+
ListboxOption.displayName = LISTBOX_OPTION_NAME;
|
|
981
|
+
var ListboxOptionProviderHost = ({ value, children }) => {
|
|
982
|
+
const isSelected = useRowListSelection(value);
|
|
983
|
+
return /* @__PURE__ */ React8.createElement(ListboxOptionProvider, {
|
|
984
|
+
scope: void 0,
|
|
985
|
+
value,
|
|
986
|
+
isSelected
|
|
987
|
+
}, children);
|
|
988
|
+
};
|
|
989
|
+
var ListboxOptionLabel = /* @__PURE__ */ forwardRef3(({ children, classNames, ...rootProps }, forwardedRef) => {
|
|
990
|
+
return /* @__PURE__ */ React8.createElement("span", {
|
|
991
|
+
...rootProps,
|
|
992
|
+
className: mx6("grow truncate", classNames),
|
|
993
|
+
ref: forwardedRef
|
|
994
|
+
}, children);
|
|
995
|
+
});
|
|
996
|
+
ListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;
|
|
997
|
+
var ListboxOptionIndicator = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
998
|
+
const { __listboxOptionScope, classNames, ...rootProps } = props;
|
|
999
|
+
const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);
|
|
1000
|
+
return /* @__PURE__ */ React8.createElement(Icon3, {
|
|
1001
|
+
icon: "ph--check--regular",
|
|
1002
|
+
...rootProps,
|
|
1003
|
+
classNames: mx6(!isSelected && "invisible", classNames),
|
|
1004
|
+
ref: forwardedRef
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
ListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;
|
|
1008
|
+
var Listbox = {
|
|
1009
|
+
Root: ListboxRoot,
|
|
1010
|
+
Option: ListboxOption,
|
|
1011
|
+
OptionLabel: ListboxOptionLabel,
|
|
1012
|
+
OptionIndicator: ListboxOptionIndicator
|
|
1013
|
+
};
|
|
1014
|
+
|
|
364
1015
|
// src/components/Tree/Tree.tsx
|
|
365
1016
|
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
366
|
-
import
|
|
1017
|
+
import React12, { useMemo as useMemo3 } from "react";
|
|
367
1018
|
import { Treegrid as Treegrid2 } from "@dxos/react-ui";
|
|
368
1019
|
|
|
369
1020
|
// src/components/Tree/TreeContext.tsx
|
|
370
|
-
import { createContext as
|
|
1021
|
+
import { createContext as createContext7, useContext } from "react";
|
|
371
1022
|
import { raise } from "@dxos/debug";
|
|
372
|
-
var TreeContext = /* @__PURE__ */
|
|
1023
|
+
var TreeContext = /* @__PURE__ */ createContext7(null);
|
|
373
1024
|
var TreeProvider = TreeContext.Provider;
|
|
374
1025
|
var useTree = () => useContext(TreeContext) ?? raise(new Error("TreeContext not found"));
|
|
375
1026
|
|
|
@@ -379,10 +1030,10 @@ import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
|
379
1030
|
import { draggable as draggable2, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
380
1031
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
381
1032
|
import * as Schema from "effect/Schema";
|
|
382
|
-
import
|
|
1033
|
+
import React11, { memo as memo3, useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
383
1034
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
384
1035
|
import { TreeItem as NaturalTreeItem, Treegrid, TREEGRID_PARENT_OF_SEPARATOR } from "@dxos/react-ui";
|
|
385
|
-
import { ghostFocusWithin, ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, mx as
|
|
1036
|
+
import { ghostFocusWithin, ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, mx as mx7 } from "@dxos/ui-theme";
|
|
386
1037
|
|
|
387
1038
|
// src/components/Tree/helpers.ts
|
|
388
1039
|
var DEFAULT_INDENTATION = 8;
|
|
@@ -391,19 +1042,19 @@ var paddingIndentation = (level, indentation = DEFAULT_INDENTATION) => ({
|
|
|
391
1042
|
});
|
|
392
1043
|
|
|
393
1044
|
// src/components/Tree/TreeItemHeading.tsx
|
|
394
|
-
import
|
|
395
|
-
import { Button, Icon as
|
|
1045
|
+
import React9, { forwardRef as forwardRef4, memo, useCallback as useCallback5 } from "react";
|
|
1046
|
+
import { Button as Button2, Icon as Icon4, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
396
1047
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
397
1048
|
import { getStyles } from "@dxos/ui-theme";
|
|
398
|
-
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */
|
|
1049
|
+
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef4(({ label, className, icon, iconHue, disabled, current, onSelect }, forwardedRef) => {
|
|
399
1050
|
const { t } = useTranslation2();
|
|
400
1051
|
const styles = iconHue ? getStyles(iconHue) : void 0;
|
|
401
|
-
const handleSelect =
|
|
1052
|
+
const handleSelect = useCallback5((event) => {
|
|
402
1053
|
onSelect?.(event.altKey);
|
|
403
1054
|
}, [
|
|
404
1055
|
onSelect
|
|
405
1056
|
]);
|
|
406
|
-
const handleButtonKeydown =
|
|
1057
|
+
const handleButtonKeydown = useCallback5((event) => {
|
|
407
1058
|
if (event.key === " " || event.key === "Enter") {
|
|
408
1059
|
event.preventDefault();
|
|
409
1060
|
event.stopPropagation();
|
|
@@ -412,14 +1063,14 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ label,
|
|
|
412
1063
|
}, [
|
|
413
1064
|
onSelect
|
|
414
1065
|
]);
|
|
415
|
-
return /* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ React9.createElement(TextTooltip, {
|
|
416
1067
|
text: toLocalizedString(label, t),
|
|
417
1068
|
side: "bottom",
|
|
418
1069
|
truncateQuery: "span[data-tooltip]",
|
|
419
1070
|
onlyWhenTruncating: true,
|
|
420
1071
|
asChild: true,
|
|
421
1072
|
ref: forwardedRef
|
|
422
|
-
}, /* @__PURE__ */
|
|
1073
|
+
}, /* @__PURE__ */ React9.createElement(Button2, {
|
|
423
1074
|
"data-testid": "treeItem.heading",
|
|
424
1075
|
variant: "ghost",
|
|
425
1076
|
classNames: [
|
|
@@ -433,23 +1084,23 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ label,
|
|
|
433
1084
|
...current && {
|
|
434
1085
|
"aria-current": "location"
|
|
435
1086
|
}
|
|
436
|
-
}, icon && /* @__PURE__ */
|
|
1087
|
+
}, icon && /* @__PURE__ */ React9.createElement(Icon4, {
|
|
437
1088
|
icon: icon ?? "ph--placeholder--regular",
|
|
438
1089
|
classNames: [
|
|
439
1090
|
"my-1",
|
|
440
1091
|
styles?.surfaceText
|
|
441
1092
|
]
|
|
442
|
-
}), /* @__PURE__ */
|
|
1093
|
+
}), /* @__PURE__ */ React9.createElement("span", {
|
|
443
1094
|
className: "flex-1 w-0 truncate text-start font-normal",
|
|
444
1095
|
"data-tooltip": true
|
|
445
1096
|
}, toLocalizedString(label, t))));
|
|
446
1097
|
}));
|
|
447
1098
|
|
|
448
1099
|
// src/components/Tree/TreeItemToggle.tsx
|
|
449
|
-
import
|
|
1100
|
+
import React10, { forwardRef as forwardRef5, memo as memo2 } from "react";
|
|
450
1101
|
import { IconButton as IconButton2 } from "@dxos/react-ui";
|
|
451
|
-
var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */
|
|
452
|
-
return /* @__PURE__ */
|
|
1102
|
+
var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classNames, open, isBranch, hidden, ...props }, forwardedRef) => {
|
|
1103
|
+
return /* @__PURE__ */ React10.createElement(IconButton2, {
|
|
453
1104
|
ref: forwardedRef,
|
|
454
1105
|
"data-testid": "treeItem.toggle",
|
|
455
1106
|
"aria-expanded": open,
|
|
@@ -482,15 +1133,15 @@ var TreeDataSchema = Schema.Struct({
|
|
|
482
1133
|
});
|
|
483
1134
|
var isTreeData = (data) => Schema.is(TreeDataSchema)(data);
|
|
484
1135
|
var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: draggableProp, renderColumns: Columns, blockInstruction, canDrop, canSelect, onOpenChange, onSelect, onItemHover }) => {
|
|
485
|
-
const rowRef =
|
|
486
|
-
const buttonRef =
|
|
487
|
-
const openRef =
|
|
488
|
-
const cancelExpandRef =
|
|
489
|
-
const [_state, setState] =
|
|
490
|
-
const [instruction, setInstruction] =
|
|
491
|
-
const [menuOpen, setMenuOpen] =
|
|
1136
|
+
const rowRef = useRef3(null);
|
|
1137
|
+
const buttonRef = useRef3(null);
|
|
1138
|
+
const openRef = useRef3(false);
|
|
1139
|
+
const cancelExpandRef = useRef3(null);
|
|
1140
|
+
const [_state, setState] = useState4("idle");
|
|
1141
|
+
const [instruction, setInstruction] = useState4(null);
|
|
1142
|
+
const [menuOpen, setMenuOpen] = useState4(false);
|
|
492
1143
|
const { itemProps: itemPropsAtom, childIds: childIdsAtom, itemOpen: itemOpenAtom, itemCurrent: itemCurrentAtom } = useTree();
|
|
493
|
-
const path =
|
|
1144
|
+
const path = useMemo2(() => [
|
|
494
1145
|
...pathProp,
|
|
495
1146
|
item.id
|
|
496
1147
|
], [
|
|
@@ -514,7 +1165,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
514
1165
|
item
|
|
515
1166
|
};
|
|
516
1167
|
const shouldSeedNativeDragData = typeof document !== "undefined" && document.body.hasAttribute("data-platform");
|
|
517
|
-
const cancelExpand =
|
|
1168
|
+
const cancelExpand = useCallback6(() => {
|
|
518
1169
|
if (cancelExpandRef.current) {
|
|
519
1170
|
clearTimeout(cancelExpandRef.current);
|
|
520
1171
|
cancelExpandRef.current = null;
|
|
@@ -523,19 +1174,11 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
523
1174
|
const isItemDraggable = draggableProp && itemDraggable !== false;
|
|
524
1175
|
const isItemDroppable = itemDroppable !== false;
|
|
525
1176
|
const nativeDragText = id;
|
|
526
|
-
|
|
1177
|
+
useEffect4(() => {
|
|
527
1178
|
if (!draggableProp) {
|
|
528
1179
|
return;
|
|
529
1180
|
}
|
|
530
|
-
invariant2(buttonRef.current, void 0, {
|
|
531
|
-
F: __dxlog_file2,
|
|
532
|
-
L: 150,
|
|
533
|
-
S: void 0,
|
|
534
|
-
A: [
|
|
535
|
-
"buttonRef.current",
|
|
536
|
-
""
|
|
537
|
-
]
|
|
538
|
-
});
|
|
1181
|
+
invariant2(buttonRef.current, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 70, S: void 0, A: ["buttonRef.current", ""] });
|
|
539
1182
|
const makeDraggable = () => draggable2({
|
|
540
1183
|
element: buttonRef.current,
|
|
541
1184
|
getInitialData: () => data,
|
|
@@ -650,10 +1293,10 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
650
1293
|
blockInstruction,
|
|
651
1294
|
canDrop
|
|
652
1295
|
]);
|
|
653
|
-
|
|
1296
|
+
useEffect4(() => () => cancelExpand(), [
|
|
654
1297
|
cancelExpand
|
|
655
1298
|
]);
|
|
656
|
-
const handleOpenToggle =
|
|
1299
|
+
const handleOpenToggle = useCallback6(() => onOpenChange?.({
|
|
657
1300
|
item,
|
|
658
1301
|
path,
|
|
659
1302
|
open: !open
|
|
@@ -663,7 +1306,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
663
1306
|
path,
|
|
664
1307
|
open
|
|
665
1308
|
]);
|
|
666
|
-
const handleSelect =
|
|
1309
|
+
const handleSelect = useCallback6((option = false) => {
|
|
667
1310
|
if (isBranch && (option || current)) {
|
|
668
1311
|
handleOpenToggle();
|
|
669
1312
|
} else if (canSelectItem) {
|
|
@@ -688,7 +1331,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
688
1331
|
handleOpenToggle,
|
|
689
1332
|
onSelect
|
|
690
1333
|
]);
|
|
691
|
-
const handleKeyDown =
|
|
1334
|
+
const handleKeyDown = useCallback6((event) => {
|
|
692
1335
|
switch (event.key) {
|
|
693
1336
|
case "ArrowRight":
|
|
694
1337
|
case "ArrowLeft":
|
|
@@ -701,7 +1344,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
701
1344
|
handleOpenToggle,
|
|
702
1345
|
handleSelect
|
|
703
1346
|
]);
|
|
704
|
-
const handleItemHover =
|
|
1347
|
+
const handleItemHover = useCallback6(() => {
|
|
705
1348
|
onItemHover?.({
|
|
706
1349
|
item
|
|
707
1350
|
});
|
|
@@ -709,7 +1352,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
709
1352
|
onItemHover,
|
|
710
1353
|
item
|
|
711
1354
|
]);
|
|
712
|
-
const handleContextMenu =
|
|
1355
|
+
const handleContextMenu = useCallback6((event) => {
|
|
713
1356
|
event.preventDefault();
|
|
714
1357
|
setMenuOpen(true);
|
|
715
1358
|
}, [
|
|
@@ -725,7 +1368,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
725
1368
|
onOpenChange,
|
|
726
1369
|
onSelect
|
|
727
1370
|
};
|
|
728
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Treegrid.Row, {
|
|
729
1372
|
ref: rowRef,
|
|
730
1373
|
key: id,
|
|
731
1374
|
id,
|
|
@@ -737,21 +1380,21 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
737
1380
|
// without alerting the user (except for in the correct link element). See also:
|
|
738
1381
|
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current#description
|
|
739
1382
|
"aria-current": current ? "" : void 0,
|
|
740
|
-
classNames:
|
|
1383
|
+
classNames: mx7("grid grid-cols-subgrid col-[tree-row] mt-0.5 is-current:bg-active-surface", hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, hoverableDescriptionIcons, ghostFocusWithin, ghostHover, className),
|
|
741
1384
|
onKeyDown: handleKeyDown,
|
|
742
1385
|
onMouseEnter: handleItemHover,
|
|
743
1386
|
onContextMenu: handleContextMenu
|
|
744
|
-
}, /* @__PURE__ */
|
|
1387
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
745
1388
|
role: "none",
|
|
746
1389
|
className: "indent relative grid grid-cols-subgrid col-[tree-row]",
|
|
747
1390
|
style: paddingIndentation(level)
|
|
748
|
-
}, /* @__PURE__ */
|
|
1391
|
+
}, /* @__PURE__ */ React11.createElement(Treegrid.Cell, {
|
|
749
1392
|
classNames: "flex items-center"
|
|
750
|
-
}, /* @__PURE__ */
|
|
1393
|
+
}, /* @__PURE__ */ React11.createElement(TreeItemToggle, {
|
|
751
1394
|
isBranch,
|
|
752
1395
|
open,
|
|
753
1396
|
onClick: handleOpenToggle
|
|
754
|
-
}), /* @__PURE__ */
|
|
1397
|
+
}), /* @__PURE__ */ React11.createElement(TreeItemHeading, {
|
|
755
1398
|
disabled,
|
|
756
1399
|
current,
|
|
757
1400
|
label,
|
|
@@ -760,16 +1403,16 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
760
1403
|
iconHue,
|
|
761
1404
|
onSelect: handleSelect,
|
|
762
1405
|
ref: buttonRef
|
|
763
|
-
})), Columns && /* @__PURE__ */
|
|
1406
|
+
})), Columns && /* @__PURE__ */ React11.createElement(Columns, {
|
|
764
1407
|
item,
|
|
765
1408
|
path,
|
|
766
1409
|
open,
|
|
767
1410
|
menuOpen,
|
|
768
1411
|
setMenuOpen
|
|
769
|
-
}), instruction && /* @__PURE__ */
|
|
1412
|
+
}), instruction && /* @__PURE__ */ React11.createElement(NaturalTreeItem.DropIndicator, {
|
|
770
1413
|
instruction,
|
|
771
1414
|
gap: 2
|
|
772
|
-
}))), open && childIds.map((childId, index) => /* @__PURE__ */
|
|
1415
|
+
}))), open && childIds.map((childId, index) => /* @__PURE__ */ React11.createElement(TreeItemById, {
|
|
773
1416
|
key: childId,
|
|
774
1417
|
id: childId,
|
|
775
1418
|
path,
|
|
@@ -784,7 +1427,7 @@ var RawTreeItemById = ({ id, ...props }) => {
|
|
|
784
1427
|
if (!item) {
|
|
785
1428
|
return null;
|
|
786
1429
|
}
|
|
787
|
-
return /* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ React11.createElement(TreeItem, {
|
|
788
1431
|
item,
|
|
789
1432
|
...props
|
|
790
1433
|
});
|
|
@@ -794,7 +1437,7 @@ var TreeItemById = /* @__PURE__ */ memo3(RawTreeItemById);
|
|
|
794
1437
|
// src/components/Tree/Tree.tsx
|
|
795
1438
|
var Tree = ({ model, rootId, path, id, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] 1fr min-content [tree-row-end]", classNames, levelOffset, renderColumns, blockInstruction, canDrop, canSelect, onOpenChange, onSelect, onItemHover }) => {
|
|
796
1439
|
const childIds = useAtomValue2(model.childIds(rootId));
|
|
797
|
-
const treePath =
|
|
1440
|
+
const treePath = useMemo3(() => path ? [
|
|
798
1441
|
...path,
|
|
799
1442
|
id
|
|
800
1443
|
] : [
|
|
@@ -815,12 +1458,12 @@ var Tree = ({ model, rootId, path, id, draggable: draggable3 = false, gridTempla
|
|
|
815
1458
|
onSelect,
|
|
816
1459
|
onItemHover
|
|
817
1460
|
};
|
|
818
|
-
return /* @__PURE__ */
|
|
1461
|
+
return /* @__PURE__ */ React12.createElement(Treegrid2.Root, {
|
|
819
1462
|
gridTemplateColumns,
|
|
820
1463
|
classNames
|
|
821
|
-
}, /* @__PURE__ */
|
|
1464
|
+
}, /* @__PURE__ */ React12.createElement(TreeProvider, {
|
|
822
1465
|
value: model
|
|
823
|
-
}, childIds.map((childId, index) => /* @__PURE__ */
|
|
1466
|
+
}, childIds.map((childId, index) => /* @__PURE__ */ React12.createElement(TreeItemById, {
|
|
824
1467
|
key: childId,
|
|
825
1468
|
id: childId,
|
|
826
1469
|
last: index === childIds.length - 1,
|
|
@@ -845,17 +1488,27 @@ var Path = {
|
|
|
845
1488
|
};
|
|
846
1489
|
export {
|
|
847
1490
|
Accordion,
|
|
1491
|
+
Combobox,
|
|
848
1492
|
DEFAULT_INDENTATION,
|
|
849
1493
|
List,
|
|
1494
|
+
Listbox,
|
|
850
1495
|
Path,
|
|
1496
|
+
Picker,
|
|
1497
|
+
Row,
|
|
1498
|
+
RowList,
|
|
851
1499
|
Tree,
|
|
852
1500
|
TreeDataSchema,
|
|
853
1501
|
TreeItem,
|
|
854
1502
|
TreeItemById,
|
|
855
1503
|
TreeItemToggle,
|
|
856
1504
|
TreeProvider,
|
|
1505
|
+
createListboxScope,
|
|
1506
|
+
createRowListScope,
|
|
857
1507
|
isTreeData,
|
|
858
1508
|
paddingIndentation,
|
|
1509
|
+
usePickerInputContext,
|
|
1510
|
+
usePickerItemContext,
|
|
1511
|
+
useRowListSelection,
|
|
859
1512
|
useTree
|
|
860
1513
|
};
|
|
861
1514
|
//# sourceMappingURL=index.mjs.map
|