@dxos/react-ui-list 0.8.1-main.ae460ac → 0.8.1-staging.31c3ee1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/lib/browser/index.mjs +162 -72
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +191 -108
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +162 -72
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/Accordion/Accordion.d.ts +7 -0
  11. package/dist/types/src/components/Accordion/Accordion.d.ts.map +1 -0
  12. package/dist/types/src/components/Accordion/Accordion.stories.d.ts +8 -0
  13. package/dist/types/src/components/Accordion/Accordion.stories.d.ts.map +1 -0
  14. package/dist/types/src/components/Accordion/AccordionItem.d.ts +20 -0
  15. package/dist/types/src/components/Accordion/AccordionItem.d.ts.map +1 -0
  16. package/dist/types/src/components/Accordion/AccordionRoot.d.ts +20 -0
  17. package/dist/types/src/components/Accordion/AccordionRoot.d.ts.map +1 -0
  18. package/dist/types/src/components/Accordion/index.d.ts +2 -0
  19. package/dist/types/src/components/Accordion/index.d.ts.map +1 -0
  20. package/dist/types/src/components/List/List.d.ts +11 -8
  21. package/dist/types/src/components/List/List.d.ts.map +1 -1
  22. package/dist/types/src/components/List/List.stories.d.ts +2 -2
  23. package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/List/ListItem.d.ts +11 -8
  25. package/dist/types/src/components/List/ListItem.d.ts.map +1 -1
  26. package/dist/types/src/components/List/ListRoot.d.ts +9 -10
  27. package/dist/types/src/components/List/ListRoot.d.ts.map +1 -1
  28. package/dist/types/src/components/Tree/Tree.d.ts +2 -1
  29. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  30. package/dist/types/src/components/Tree/TreeItem.d.ts +2 -2
  31. package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
  32. package/dist/types/src/components/index.d.ts +1 -0
  33. package/dist/types/src/components/index.d.ts.map +1 -1
  34. package/package.json +19 -18
  35. package/src/components/Accordion/Accordion.stories.tsx +56 -0
  36. package/src/components/Accordion/Accordion.tsx +17 -0
  37. package/src/components/Accordion/AccordionItem.tsx +65 -0
  38. package/src/components/Accordion/AccordionRoot.tsx +58 -0
  39. package/src/components/Accordion/index.ts +5 -0
  40. package/src/components/List/List.stories.tsx +7 -7
  41. package/src/components/List/List.tsx +3 -1
  42. package/src/components/List/ListItem.tsx +18 -6
  43. package/src/components/List/ListRoot.tsx +10 -13
  44. package/src/components/Tree/TreeItem.tsx +8 -4
  45. package/src/components/Tree/TreeItemHeading.tsx +1 -1
  46. package/src/components/Tree/TreeItemToggle.tsx +1 -1
  47. package/src/components/index.ts +1 -0
@@ -1,25 +1,95 @@
1
+ // packages/ui/react-ui-list/src/components/Accordion/AccordionItem.tsx
2
+ import * as AccordionPrimitive2 from "@radix-ui/react-accordion";
3
+ import { createContext as createContext2 } from "@radix-ui/react-context";
4
+ import React2 from "react";
5
+ import { Icon } from "@dxos/react-ui";
6
+ import { mx as mx2 } from "@dxos/react-ui-theme";
7
+
8
+ // packages/ui/react-ui-list/src/components/Accordion/AccordionRoot.tsx
9
+ import * as AccordionPrimitive from "@radix-ui/react-accordion";
10
+ import { createContext } from "@radix-ui/react-context";
11
+ import React from "react";
12
+ import { mx } from "@dxos/react-ui-theme";
13
+ var ACCORDION_NAME = "Accordion";
14
+ var [AccordionProvider, useAccordionContext] = createContext(ACCORDION_NAME);
15
+ var defaultGetId = (item) => item?.id;
16
+ var AccordionRoot = ({ classNames, items, getId = defaultGetId, children, value, defaultValue, onValueChange }) => {
17
+ return /* @__PURE__ */ React.createElement(AccordionProvider, {
18
+ getId
19
+ }, /* @__PURE__ */ React.createElement(AccordionPrimitive.Root, {
20
+ type: "multiple",
21
+ value,
22
+ defaultValue,
23
+ onValueChange,
24
+ className: mx(classNames)
25
+ }, children?.({
26
+ items: items ?? []
27
+ })));
28
+ };
29
+
30
+ // packages/ui/react-ui-list/src/components/Accordion/AccordionItem.tsx
31
+ var ACCORDION_ITEM_NAME = "AccordionItem";
32
+ var [AccordionItemProvider, useAccordionItemContext] = createContext2(ACCORDION_ITEM_NAME);
33
+ var AccordionItem = ({ children, classNames, item }) => {
34
+ const { getId } = useAccordionContext(ACCORDION_ITEM_NAME);
35
+ return /* @__PURE__ */ React2.createElement(AccordionItemProvider, {
36
+ item
37
+ }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Item, {
38
+ value: getId(item),
39
+ className: mx2("overflow-hidden", classNames)
40
+ }, children));
41
+ };
42
+ var AccordionItemHeader = ({ classNames, children, ...props }) => {
43
+ return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Header, {
44
+ ...props,
45
+ className: mx2(classNames)
46
+ }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Trigger, {
47
+ className: "group flex items-center p-2 dx-focus-ring-inset is-full text-start"
48
+ }, children, /* @__PURE__ */ React2.createElement(Icon, {
49
+ icon: "ph--caret-right--regular",
50
+ size: 4,
51
+ classNames: "transition-transform duration-200 group-data-[state=open]:rotate-90"
52
+ })));
53
+ };
54
+ var AccordionItemBody = ({ children, classNames }) => {
55
+ return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Content, {
56
+ className: "overflow-hidden data-[state=closed]:animate-slideUp data-[state=open]:animate-slideDown"
57
+ }, /* @__PURE__ */ React2.createElement("div", {
58
+ role: "none",
59
+ className: mx2("p-2", classNames)
60
+ }, children));
61
+ };
62
+
63
+ // packages/ui/react-ui-list/src/components/Accordion/Accordion.tsx
64
+ var Accordion = {
65
+ Root: AccordionRoot,
66
+ Item: AccordionItem,
67
+ ItemHeader: AccordionItemHeader,
68
+ ItemBody: AccordionItemBody
69
+ };
70
+
1
71
  // packages/ui/react-ui-list/src/components/List/ListItem.tsx
2
72
  import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
3
73
  import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
4
74
  import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
5
75
  import { attachClosestEdge, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
6
- import { createContext as createContext2 } from "@radix-ui/react-context";
7
- import React2, { forwardRef, useEffect as useEffect2, useRef, useState as useState2 } from "react";
76
+ import { createContext as createContext4 } from "@radix-ui/react-context";
77
+ import React4, { forwardRef, useEffect as useEffect2, useRef, useState as useState2 } from "react";
8
78
  import { createPortal } from "react-dom";
9
79
  import { invariant } from "@dxos/invariant";
10
- import { Icon, ListItem as NaturalListItem } from "@dxos/react-ui";
11
- import { mx } from "@dxos/react-ui-theme";
80
+ import { Icon as Icon2, ListItem as NaturalListItem } from "@dxos/react-ui";
81
+ import { mx as mx3 } from "@dxos/react-ui-theme";
12
82
 
13
83
  // packages/ui/react-ui-list/src/components/List/ListRoot.tsx
14
84
  import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
15
85
  import { extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
16
86
  import { getReorderDestinationIndex } from "@atlaskit/pragmatic-drag-and-drop-hitbox/util/get-reorder-destination-index";
17
- import { createContext } from "@radix-ui/react-context";
18
- import React, { useCallback, useEffect, useState } from "react";
87
+ import { createContext as createContext3 } from "@radix-ui/react-context";
88
+ import React3, { useCallback, useEffect, useState } from "react";
19
89
  var LIST_NAME = "List";
20
- var [ListProvider, useListContext] = createContext(LIST_NAME);
21
- var defaultGetId = (item) => item?.id;
22
- var ListRoot = ({ classNames, children, items, isItem, getId = defaultGetId, onMove, ...props }) => {
90
+ var [ListProvider, useListContext] = createContext3(LIST_NAME);
91
+ var defaultGetId2 = (item) => item?.id;
92
+ var ListRoot = ({ children, items, isItem, getId = defaultGetId2, onMove, ...props }) => {
23
93
  const isEqual = useCallback((a, b) => {
24
94
  const idA = getId?.(a);
25
95
  const idB = getId?.(b);
@@ -68,10 +138,10 @@ var ListRoot = ({ classNames, children, items, isItem, getId = defaultGetId, onM
68
138
  isEqual,
69
139
  onMove
70
140
  ]);
71
- return /* @__PURE__ */ React.createElement(ListProvider, {
72
- isItem,
141
+ return /* @__PURE__ */ React3.createElement(ListProvider, {
73
142
  state,
74
143
  setState,
144
+ isItem,
75
145
  ...props
76
146
  }, children?.({
77
147
  state,
@@ -89,7 +159,7 @@ var stateStyles = {
89
159
  };
90
160
  var defaultContext = {};
91
161
  var LIST_ITEM_NAME = "ListItem";
92
- var [ListItemProvider, useListItemContext] = createContext2(LIST_ITEM_NAME, defaultContext);
162
+ var [ListItemProvider, useListItemContext] = createContext4(LIST_ITEM_NAME, defaultContext);
93
163
  var ListItem = ({ children, classNames, item, ...props }) => {
94
164
  const { isItem, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);
95
165
  const ref = useRef(null);
@@ -204,37 +274,49 @@ var ListItem = ({ children, classNames, item, ...props }) => {
204
274
  }, [
205
275
  item
206
276
  ]);
207
- return /* @__PURE__ */ React2.createElement(ListItemProvider, {
277
+ return /* @__PURE__ */ React4.createElement(ListItemProvider, {
208
278
  item,
209
279
  dragHandleRef
210
- }, /* @__PURE__ */ React2.createElement("div", {
280
+ }, /* @__PURE__ */ React4.createElement("div", {
211
281
  role: "none",
212
282
  className: "relative"
213
- }, /* @__PURE__ */ React2.createElement("div", {
283
+ }, /* @__PURE__ */ React4.createElement("div", {
214
284
  ref,
215
285
  role: "listitem",
216
- className: mx("flex overflow-hidden", classNames, stateStyles[state.type]),
286
+ className: mx3("flex overflow-hidden", classNames, stateStyles[state.type]),
217
287
  ...props
218
- }, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React2.createElement(NaturalListItem.DropIndicator, {
288
+ }, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React4.createElement(NaturalListItem.DropIndicator, {
219
289
  edge: state.closestEdge
220
290
  })));
221
291
  };
222
292
  var IconButton = /* @__PURE__ */ forwardRef(({ classNames, icon, ...props }, forwardedRef) => {
223
- return /* @__PURE__ */ React2.createElement("button", {
293
+ return /* @__PURE__ */ React4.createElement("button", {
224
294
  ref: forwardedRef,
225
- className: mx("flex items-center justify-center", classNames),
295
+ className: mx3("flex items-center justify-center", classNames),
226
296
  ...props
227
- }, /* @__PURE__ */ React2.createElement(Icon, {
297
+ }, /* @__PURE__ */ React4.createElement(Icon2, {
228
298
  icon,
229
299
  classNames: "cursor-pointer",
230
300
  size: 4
231
301
  }));
232
302
  });
233
- var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, ...props }) => {
303
+ var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph--x--regular", ...props }) => {
234
304
  const { state } = useListContext("DELETE_BUTTON");
235
305
  const isDisabled = state.type !== "idle" || disabled;
236
- return /* @__PURE__ */ React2.createElement(IconButton, {
237
- icon: "ph--x--regular",
306
+ return /* @__PURE__ */ React4.createElement(IconButton, {
307
+ icon,
308
+ disabled: isDisabled,
309
+ classNames: [
310
+ classNames,
311
+ autoHide && disabled && "hidden"
312
+ ],
313
+ ...props
314
+ });
315
+ };
316
+ var ListItemButton = ({ autoHide = true, classNames, disabled, ...props }) => {
317
+ const { state } = useListContext("ITEM_BUTTON");
318
+ const isDisabled = state.type !== "idle" || disabled;
319
+ return /* @__PURE__ */ React4.createElement(IconButton, {
238
320
  disabled: isDisabled,
239
321
  classNames: [
240
322
  classNames,
@@ -245,7 +327,7 @@ var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, ...props })
245
327
  };
246
328
  var ListItemDragHandle = () => {
247
329
  const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
248
- return /* @__PURE__ */ React2.createElement(IconButton, {
330
+ return /* @__PURE__ */ React4.createElement(IconButton, {
249
331
  ref: dragHandleRef,
250
332
  icon: "ph--dots-six-vertical--regular"
251
333
  });
@@ -256,11 +338,11 @@ var ListItemDragPreview = ({ children }) => {
256
338
  item: state.item
257
339
  }), state.container) : null;
258
340
  };
259
- var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */ React2.createElement("div", {
260
- className: mx("flex is-full gap-2", classNames)
341
+ var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */ React4.createElement("div", {
342
+ className: mx3("flex is-full gap-2", classNames)
261
343
  }, children);
262
- var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */ React2.createElement("div", {
263
- className: mx("flex grow items-center truncate", classNames),
344
+ var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */ React4.createElement("div", {
345
+ className: mx3("flex grow items-center truncate", classNames),
264
346
  ...props
265
347
  }, children);
266
348
 
@@ -272,18 +354,19 @@ var List = {
272
354
  ItemWrapper: ListItemWrapper,
273
355
  ItemDragHandle: ListItemDragHandle,
274
356
  ItemDeleteButton: ListItemDeleteButton,
357
+ ItemButton: ListItemButton,
275
358
  ItemTitle: ListItemTitle,
276
359
  IconButton
277
360
  };
278
361
 
279
362
  // packages/ui/react-ui-list/src/components/Tree/Tree.tsx
280
- import React6, { useMemo as useMemo2 } from "react";
363
+ import React8, { useMemo as useMemo2 } from "react";
281
364
  import { Treegrid as Treegrid2 } from "@dxos/react-ui";
282
365
 
283
366
  // packages/ui/react-ui-list/src/components/Tree/TreeContext.tsx
284
- import { createContext as createContext3, useContext } from "react";
367
+ import { createContext as createContext5, useContext } from "react";
285
368
  import { raise } from "@dxos/debug";
286
- var TreeContext = /* @__PURE__ */ createContext3(null);
369
+ var TreeContext = /* @__PURE__ */ createContext5(null);
287
370
  var useTree = () => useContext(TreeContext) ?? raise(new Error("TreeContext not found"));
288
371
  var TreeProvider = TreeContext.Provider;
289
372
 
@@ -291,17 +374,17 @@ var TreeProvider = TreeContext.Provider;
291
374
  import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
292
375
  import { draggable as draggable2, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
293
376
  import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
294
- import React5, { memo as memo3, useCallback as useCallback3, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
377
+ import React7, { memo as memo3, useCallback as useCallback3, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
295
378
  import { S } from "@dxos/echo-schema";
296
379
  import { invariant as invariant2 } from "@dxos/invariant";
297
380
  import { Treegrid, TreeItem as NaturalTreeItem } from "@dxos/react-ui";
298
- import { ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, mx as mx4 } from "@dxos/react-ui-theme";
381
+ import { ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, mx as mx6 } from "@dxos/react-ui-theme";
299
382
 
300
383
  // packages/ui/react-ui-list/src/components/Tree/TreeItemHeading.tsx
301
- import React3, { forwardRef as forwardRef2, memo, useCallback as useCallback2 } from "react";
302
- import { Button, Icon as Icon2, toLocalizedString, useTranslation } from "@dxos/react-ui";
384
+ import React5, { forwardRef as forwardRef2, memo, useCallback as useCallback2 } from "react";
385
+ import { Button, Icon as Icon3, toLocalizedString, useTranslation } from "@dxos/react-ui";
303
386
  import { TextTooltip } from "@dxos/react-ui-text-tooltip";
304
- import { mx as mx2 } from "@dxos/react-ui-theme";
387
+ import { mx as mx4 } from "@dxos/react-ui-theme";
305
388
  var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ label, icon, className, disabled, current, onSelect }, forwardedRef) => {
306
389
  const { t } = useTranslation();
307
390
  const handleSelect = useCallback2((event) => {
@@ -318,51 +401,51 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ label,
318
401
  }, [
319
402
  onSelect
320
403
  ]);
321
- return /* @__PURE__ */ React3.createElement(TextTooltip, {
404
+ return /* @__PURE__ */ React5.createElement(TextTooltip, {
322
405
  text: toLocalizedString(label, t),
323
406
  side: "bottom",
324
407
  truncateQuery: "span[data-tooltip]",
325
408
  onlyWhenTruncating: true,
326
409
  asChild: true,
327
410
  ref: forwardedRef
328
- }, /* @__PURE__ */ React3.createElement(Button, {
411
+ }, /* @__PURE__ */ React5.createElement(Button, {
329
412
  "data-testid": "treeItem.heading",
330
413
  variant: "ghost",
331
414
  density: "fine",
332
- classNames: mx2("grow gap-2 pis-0.5 hover:bg-transparent dark:hover:bg-transparent", "disabled:cursor-default disabled:opacity-100", className),
415
+ classNames: mx4("grow gap-2 pis-0.5 hover:bg-transparent dark:hover:bg-transparent", "disabled:cursor-default disabled:opacity-100", className),
333
416
  disabled,
334
417
  onClick: handleSelect,
335
418
  onKeyDown: handleButtonKeydown,
336
419
  ...current && {
337
420
  "aria-current": "location"
338
421
  }
339
- }, icon && /* @__PURE__ */ React3.createElement(Icon2, {
422
+ }, icon && /* @__PURE__ */ React5.createElement(Icon3, {
340
423
  icon: icon ?? "ph--placeholder--regular",
341
- size: 4,
342
- classNames: "is-[1em] bs-[1em] mlb-1"
343
- }), /* @__PURE__ */ React3.createElement("span", {
424
+ size: 5,
425
+ classNames: "mlb-1"
426
+ }), /* @__PURE__ */ React5.createElement("span", {
344
427
  className: "flex-1 is-0 truncate text-start text-sm font-normal",
345
428
  "data-tooltip": true
346
429
  }, toLocalizedString(label, t))));
347
430
  }));
348
431
 
349
432
  // packages/ui/react-ui-list/src/components/Tree/TreeItemToggle.tsx
350
- import React4, { forwardRef as forwardRef3, memo as memo2 } from "react";
351
- import { Button as Button2, Icon as Icon3 } from "@dxos/react-ui";
352
- import { mx as mx3 } from "@dxos/react-ui-theme";
433
+ import React6, { forwardRef as forwardRef3, memo as memo2 } from "react";
434
+ import { Button as Button2, Icon as Icon4 } from "@dxos/react-ui";
435
+ import { mx as mx5 } from "@dxos/react-ui-theme";
353
436
  var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef3(({ open, isBranch, hidden, onToggle }, forwardedRef) => {
354
- return /* @__PURE__ */ React4.createElement(Button2, {
437
+ return /* @__PURE__ */ React6.createElement(Button2, {
355
438
  ref: forwardedRef,
356
439
  "data-testid": "treeItem.toggle",
357
440
  "aria-expanded": open,
358
441
  variant: "ghost",
359
442
  density: "fine",
360
- classNames: mx3("is-4 dx-focus-ring-inset pli-0", hidden ? "hidden" : !isBranch && "invisible"),
443
+ classNames: mx5("is-6 pli-0 dx-focus-ring-inset", hidden ? "hidden" : !isBranch && "invisible"),
361
444
  onClick: onToggle
362
- }, /* @__PURE__ */ React4.createElement(Icon3, {
445
+ }, /* @__PURE__ */ React6.createElement(Icon4, {
363
446
  icon: "ph--caret-right--regular",
364
447
  size: 3,
365
- classNames: mx3("transition duration-200", open && "rotate-90")
448
+ classNames: mx5("transition duration-200", open && "rotate-90")
366
449
  }));
367
450
  }));
368
451
 
@@ -533,18 +616,24 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
533
616
  open
534
617
  ]);
535
618
  const handleSelect = useCallback3((option = false) => {
536
- rowRef.current?.focus();
537
- onSelect?.({
538
- item,
539
- path,
540
- current: !current,
541
- option
542
- });
619
+ if (isBranch) {
620
+ handleOpenChange();
621
+ } else {
622
+ rowRef.current?.focus();
623
+ onSelect?.({
624
+ item,
625
+ path,
626
+ current: !current,
627
+ option
628
+ });
629
+ }
543
630
  }, [
544
- onSelect,
545
631
  item,
546
632
  path,
547
- current
633
+ current,
634
+ isBranch,
635
+ handleOpenChange,
636
+ onSelect
548
637
  ]);
549
638
  const handleKeyDown = useCallback3((event) => {
550
639
  switch (event.key) {
@@ -564,13 +653,13 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
564
653
  handleOpenChange,
565
654
  handleSelect
566
655
  ]);
567
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Treegrid.Row, {
656
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Treegrid.Row, {
568
657
  ref: rowRef,
569
658
  key: id,
570
659
  id,
571
660
  "aria-labelledby": `${id}__label`,
572
661
  parentOf: parentOf?.join(Treegrid.PARENT_OF_SEPARATOR),
573
- classNames: mx4("grid grid-cols-subgrid col-[tree-row] mbs-0.5 aria-[current]:bg-groupSurface", hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, hoverableDescriptionIcons, ghostHover, className),
662
+ classNames: mx6("grid grid-cols-subgrid col-[tree-row] mbs-0.5 aria-[current]:bg-groupSurface", hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, hoverableDescriptionIcons, ghostHover, className),
574
663
  "data-itemid": id,
575
664
  "data-testid": testId,
576
665
  // NOTE(thure): This is intentionally an empty string to for descendents to select by in the CSS
@@ -582,18 +671,18 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
582
671
  event.preventDefault();
583
672
  setMenuOpen(true);
584
673
  }
585
- }, /* @__PURE__ */ React5.createElement(Treegrid.Cell, {
674
+ }, /* @__PURE__ */ React7.createElement(Treegrid.Cell, {
586
675
  indent: true,
587
676
  classNames: "relative grid grid-cols-subgrid col-[tree-row]",
588
677
  style: paddingIndentation(level)
589
- }, /* @__PURE__ */ React5.createElement("div", {
678
+ }, /* @__PURE__ */ React7.createElement("div", {
590
679
  role: "none",
591
680
  className: "flex items-center"
592
- }, /* @__PURE__ */ React5.createElement(TreeItemToggle, {
593
- open,
681
+ }, /* @__PURE__ */ React7.createElement(TreeItemToggle, {
594
682
  isBranch,
683
+ open,
595
684
  onToggle: handleOpenChange
596
- }), /* @__PURE__ */ React5.createElement(TreeItemHeading, {
685
+ }), /* @__PURE__ */ React7.createElement(TreeItemHeading, {
597
686
  ref: buttonRef,
598
687
  label,
599
688
  icon,
@@ -601,16 +690,16 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
601
690
  disabled,
602
691
  current,
603
692
  onSelect: handleSelect
604
- })), Columns && /* @__PURE__ */ React5.createElement(Columns, {
693
+ })), Columns && /* @__PURE__ */ React7.createElement(Columns, {
605
694
  item,
606
695
  path,
607
696
  open,
608
697
  menuOpen,
609
698
  setMenuOpen
610
- }), instruction && /* @__PURE__ */ React5.createElement(NaturalTreeItem.DropIndicator, {
699
+ }), instruction && /* @__PURE__ */ React7.createElement(NaturalTreeItem.DropIndicator, {
611
700
  instruction,
612
701
  gap: 2
613
- }))), open && items.map((item2, index) => /* @__PURE__ */ React5.createElement(TreeItem, {
702
+ }))), open && items.map((item2, index) => /* @__PURE__ */ React7.createElement(TreeItem, {
614
703
  key: item2.id,
615
704
  item: item2,
616
705
  path,
@@ -647,12 +736,12 @@ var Tree = ({ root, path, id, getItems, getProps, isOpen, isCurrent, draggable:
647
736
  id,
648
737
  path
649
738
  ]);
650
- return /* @__PURE__ */ React6.createElement(Treegrid2.Root, {
739
+ return /* @__PURE__ */ React8.createElement(Treegrid2.Root, {
651
740
  gridTemplateColumns,
652
741
  classNames
653
- }, /* @__PURE__ */ React6.createElement(TreeProvider, {
742
+ }, /* @__PURE__ */ React8.createElement(TreeProvider, {
654
743
  value: context
655
- }, items.map((item, index) => /* @__PURE__ */ React6.createElement(TreeItem, {
744
+ }, items.map((item, index) => /* @__PURE__ */ React8.createElement(TreeItem, {
656
745
  key: item.id,
657
746
  item,
658
747
  last: index === items.length - 1,
@@ -682,6 +771,7 @@ var Path = {
682
771
  onPath: (path, id) => Path.parts(path).includes(id)
683
772
  };
684
773
  export {
774
+ Accordion,
685
775
  List,
686
776
  Path,
687
777
  RawTreeItem,