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