react-aria-components 1.6.0 → 1.7.0

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 (228) hide show
  1. package/README.md +1 -1
  2. package/dist/Autocomplete.main.js +23 -12
  3. package/dist/Autocomplete.main.js.map +1 -1
  4. package/dist/Autocomplete.mjs +23 -12
  5. package/dist/Autocomplete.module.js +23 -12
  6. package/dist/Autocomplete.module.js.map +1 -1
  7. package/dist/Checkbox.main.js +1 -1
  8. package/dist/Checkbox.main.js.map +1 -1
  9. package/dist/Checkbox.mjs +1 -1
  10. package/dist/Checkbox.module.js +1 -1
  11. package/dist/Checkbox.module.js.map +1 -1
  12. package/dist/Collection.main.js.map +1 -1
  13. package/dist/Collection.module.js.map +1 -1
  14. package/dist/ColorArea.main.js +4 -4
  15. package/dist/ColorArea.main.js.map +1 -1
  16. package/dist/ColorArea.mjs +2 -2
  17. package/dist/ColorArea.module.js +2 -2
  18. package/dist/ColorArea.module.js.map +1 -1
  19. package/dist/ColorField.main.js +8 -10
  20. package/dist/ColorField.main.js.map +1 -1
  21. package/dist/ColorField.mjs +4 -6
  22. package/dist/ColorField.module.js +4 -6
  23. package/dist/ColorField.module.js.map +1 -1
  24. package/dist/ColorPicker.main.js +2 -2
  25. package/dist/ColorPicker.main.js.map +1 -1
  26. package/dist/ColorPicker.mjs +1 -1
  27. package/dist/ColorPicker.module.js +1 -1
  28. package/dist/ColorPicker.module.js.map +1 -1
  29. package/dist/ColorSlider.main.js +5 -7
  30. package/dist/ColorSlider.main.js.map +1 -1
  31. package/dist/ColorSlider.mjs +3 -5
  32. package/dist/ColorSlider.module.js +3 -5
  33. package/dist/ColorSlider.module.js.map +1 -1
  34. package/dist/ColorSwatch.main.js +2 -2
  35. package/dist/ColorSwatch.main.js.map +1 -1
  36. package/dist/ColorSwatch.mjs +1 -1
  37. package/dist/ColorSwatch.module.js +1 -1
  38. package/dist/ColorSwatch.module.js.map +1 -1
  39. package/dist/ColorSwatchPicker.main.js +3 -3
  40. package/dist/ColorSwatchPicker.main.js.map +1 -1
  41. package/dist/ColorSwatchPicker.mjs +1 -1
  42. package/dist/ColorSwatchPicker.module.js +1 -1
  43. package/dist/ColorSwatchPicker.module.js.map +1 -1
  44. package/dist/ColorThumb.main.js +2 -6
  45. package/dist/ColorThumb.main.js.map +1 -1
  46. package/dist/ColorThumb.mjs +1 -5
  47. package/dist/ColorThumb.module.js +1 -5
  48. package/dist/ColorThumb.module.js.map +1 -1
  49. package/dist/ColorWheel.main.js +4 -4
  50. package/dist/ColorWheel.main.js.map +1 -1
  51. package/dist/ColorWheel.mjs +2 -2
  52. package/dist/ColorWheel.module.js +2 -2
  53. package/dist/ColorWheel.module.js.map +1 -1
  54. package/dist/ComboBox.main.js +1 -1
  55. package/dist/ComboBox.main.js.map +1 -1
  56. package/dist/ComboBox.mjs +1 -1
  57. package/dist/ComboBox.module.js +1 -1
  58. package/dist/ComboBox.module.js.map +1 -1
  59. package/dist/DateField.main.js +4 -3
  60. package/dist/DateField.main.js.map +1 -1
  61. package/dist/DateField.mjs +4 -3
  62. package/dist/DateField.module.js +4 -3
  63. package/dist/DateField.module.js.map +1 -1
  64. package/dist/DatePicker.main.js +2 -2
  65. package/dist/DatePicker.main.js.map +1 -1
  66. package/dist/DatePicker.mjs +2 -2
  67. package/dist/DatePicker.module.js +2 -2
  68. package/dist/DatePicker.module.js.map +1 -1
  69. package/dist/Dialog.main.js +2 -1
  70. package/dist/Dialog.main.js.map +1 -1
  71. package/dist/Dialog.mjs +2 -1
  72. package/dist/Dialog.module.js +2 -1
  73. package/dist/Dialog.module.js.map +1 -1
  74. package/dist/Disclosure.main.js +5 -7
  75. package/dist/Disclosure.main.js.map +1 -1
  76. package/dist/Disclosure.mjs +2 -4
  77. package/dist/Disclosure.module.js +2 -4
  78. package/dist/Disclosure.module.js.map +1 -1
  79. package/dist/DropZone.main.js +1 -3
  80. package/dist/DropZone.main.js.map +1 -1
  81. package/dist/DropZone.mjs +1 -3
  82. package/dist/DropZone.module.js +1 -3
  83. package/dist/DropZone.module.js.map +1 -1
  84. package/dist/GridList.main.js.map +1 -1
  85. package/dist/GridList.module.js.map +1 -1
  86. package/dist/Group.main.js.map +1 -1
  87. package/dist/Group.module.js.map +1 -1
  88. package/dist/ListBox.main.js +17 -16
  89. package/dist/ListBox.main.js.map +1 -1
  90. package/dist/ListBox.mjs +19 -18
  91. package/dist/ListBox.module.js +19 -18
  92. package/dist/ListBox.module.js.map +1 -1
  93. package/dist/Menu.main.js +39 -24
  94. package/dist/Menu.main.js.map +1 -1
  95. package/dist/Menu.mjs +40 -25
  96. package/dist/Menu.module.js +40 -25
  97. package/dist/Menu.module.js.map +1 -1
  98. package/dist/Meter.main.js +1 -1
  99. package/dist/Meter.main.js.map +1 -1
  100. package/dist/Meter.mjs +1 -1
  101. package/dist/Meter.module.js +1 -1
  102. package/dist/Meter.module.js.map +1 -1
  103. package/dist/NumberField.main.js +4 -2
  104. package/dist/NumberField.main.js.map +1 -1
  105. package/dist/NumberField.mjs +4 -2
  106. package/dist/NumberField.module.js +4 -2
  107. package/dist/NumberField.module.js.map +1 -1
  108. package/dist/Popover.main.js +67 -15
  109. package/dist/Popover.main.js.map +1 -1
  110. package/dist/Popover.mjs +69 -17
  111. package/dist/Popover.module.js +69 -17
  112. package/dist/Popover.module.js.map +1 -1
  113. package/dist/ProgressBar.main.js +1 -1
  114. package/dist/ProgressBar.main.js.map +1 -1
  115. package/dist/ProgressBar.mjs +1 -1
  116. package/dist/ProgressBar.module.js +1 -1
  117. package/dist/ProgressBar.module.js.map +1 -1
  118. package/dist/RadioGroup.main.js +1 -1
  119. package/dist/RadioGroup.main.js.map +1 -1
  120. package/dist/RadioGroup.mjs +1 -1
  121. package/dist/RadioGroup.module.js +1 -1
  122. package/dist/RadioGroup.module.js.map +1 -1
  123. package/dist/SearchField.main.js +4 -2
  124. package/dist/SearchField.main.js.map +1 -1
  125. package/dist/SearchField.mjs +5 -3
  126. package/dist/SearchField.module.js +5 -3
  127. package/dist/SearchField.module.js.map +1 -1
  128. package/dist/Select.main.js +3 -2
  129. package/dist/Select.main.js.map +1 -1
  130. package/dist/Select.mjs +3 -2
  131. package/dist/Select.module.js +3 -2
  132. package/dist/Select.module.js.map +1 -1
  133. package/dist/Slider.main.js +2 -2
  134. package/dist/Slider.main.js.map +1 -1
  135. package/dist/Slider.mjs +2 -2
  136. package/dist/Slider.module.js +2 -2
  137. package/dist/Slider.module.js.map +1 -1
  138. package/dist/Table.main.js +15 -6
  139. package/dist/Table.main.js.map +1 -1
  140. package/dist/Table.mjs +15 -6
  141. package/dist/Table.module.js +15 -6
  142. package/dist/Table.module.js.map +1 -1
  143. package/dist/TableLayout.main.js.map +1 -1
  144. package/dist/TableLayout.module.js.map +1 -1
  145. package/dist/Tabs.main.js +3 -2
  146. package/dist/Tabs.main.js.map +1 -1
  147. package/dist/Tabs.mjs +4 -3
  148. package/dist/Tabs.module.js +4 -3
  149. package/dist/Tabs.module.js.map +1 -1
  150. package/dist/TagGroup.main.js +1 -1
  151. package/dist/TagGroup.main.js.map +1 -1
  152. package/dist/TagGroup.mjs +1 -1
  153. package/dist/TagGroup.module.js +1 -1
  154. package/dist/TagGroup.module.js.map +1 -1
  155. package/dist/TextField.main.js +4 -2
  156. package/dist/TextField.main.js.map +1 -1
  157. package/dist/TextField.mjs +5 -3
  158. package/dist/TextField.module.js +5 -3
  159. package/dist/TextField.module.js.map +1 -1
  160. package/dist/Toast.main.js +148 -0
  161. package/dist/Toast.main.js.map +1 -0
  162. package/dist/Toast.mjs +137 -0
  163. package/dist/Toast.module.js +137 -0
  164. package/dist/Toast.module.js.map +1 -0
  165. package/dist/Tree.main.js +38 -34
  166. package/dist/Tree.main.js.map +1 -1
  167. package/dist/Tree.mjs +34 -30
  168. package/dist/Tree.module.js +34 -30
  169. package/dist/Tree.module.js.map +1 -1
  170. package/dist/Virtualizer.main.js +4 -1
  171. package/dist/Virtualizer.main.js.map +1 -1
  172. package/dist/Virtualizer.mjs +4 -1
  173. package/dist/Virtualizer.module.js +4 -1
  174. package/dist/Virtualizer.module.js.map +1 -1
  175. package/dist/import.mjs +9 -7
  176. package/dist/main.js +31 -17
  177. package/dist/main.js.map +1 -1
  178. package/dist/module.js +9 -7
  179. package/dist/module.js.map +1 -1
  180. package/dist/types.d.ts +159 -59
  181. package/dist/types.d.ts.map +1 -1
  182. package/dist/utils.main.js +9 -7
  183. package/dist/utils.main.js.map +1 -1
  184. package/dist/utils.mjs +9 -7
  185. package/dist/utils.module.js +9 -7
  186. package/dist/utils.module.js.map +1 -1
  187. package/i18n/index.js +1 -1
  188. package/i18n/index.mjs +1 -1
  189. package/package.json +25 -30
  190. package/src/Autocomplete.tsx +19 -15
  191. package/src/Checkbox.tsx +3 -1
  192. package/src/Collection.tsx +2 -2
  193. package/src/ColorArea.tsx +2 -3
  194. package/src/ColorField.tsx +8 -6
  195. package/src/ColorPicker.tsx +1 -2
  196. package/src/ColorSlider.tsx +5 -5
  197. package/src/ColorSwatch.tsx +2 -2
  198. package/src/ColorSwatchPicker.tsx +1 -1
  199. package/src/ColorThumb.tsx +2 -4
  200. package/src/ColorWheel.tsx +2 -2
  201. package/src/ComboBox.tsx +3 -1
  202. package/src/DateField.tsx +8 -3
  203. package/src/DatePicker.tsx +6 -2
  204. package/src/Dialog.tsx +6 -2
  205. package/src/Disclosure.tsx +2 -3
  206. package/src/DropZone.tsx +1 -2
  207. package/src/GridList.tsx +5 -0
  208. package/src/Group.tsx +1 -0
  209. package/src/ListBox.tsx +11 -9
  210. package/src/Menu.tsx +53 -25
  211. package/src/Meter.tsx +3 -1
  212. package/src/NumberField.tsx +11 -2
  213. package/src/Popover.tsx +77 -25
  214. package/src/ProgressBar.tsx +3 -1
  215. package/src/RadioGroup.tsx +3 -1
  216. package/src/SearchField.tsx +6 -4
  217. package/src/Select.tsx +5 -2
  218. package/src/Slider.tsx +6 -2
  219. package/src/Table.tsx +35 -15
  220. package/src/TableLayout.ts +1 -1
  221. package/src/Tabs.tsx +6 -3
  222. package/src/TagGroup.tsx +3 -1
  223. package/src/TextField.tsx +6 -4
  224. package/src/Toast.tsx +184 -0
  225. package/src/Tree.tsx +67 -49
  226. package/src/Virtualizer.tsx +18 -3
  227. package/src/index.ts +16 -16
  228. package/src/utils.tsx +8 -10
package/dist/Tree.main.js CHANGED
@@ -2,10 +2,9 @@ var $b856e6788a7ea5bf$exports = require("./Button.main.js");
2
2
  var $525402dfec7da5bc$exports = require("./RSPContexts.main.js");
3
3
  var $3114c2382242bdc0$exports = require("./Collection.main.js");
4
4
  var $c5ccf687772c0422$exports = require("./utils.main.js");
5
- var $5SMu3$reactariatree = require("@react-aria/tree");
5
+ var $5SMu3$reactaria = require("react-aria");
6
6
  var $5SMu3$reactariacollections = require("@react-aria/collections");
7
7
  var $5SMu3$reactariautils = require("@react-aria/utils");
8
- var $5SMu3$reactaria = require("react-aria");
9
8
  var $5SMu3$reactstately = require("react-stately");
10
9
  var $5SMu3$react = require("react");
11
10
  var $5SMu3$reactstatelyutils = require("@react-stately/utils");
@@ -19,11 +18,11 @@ function $parcel$export(e, n, v, s) {
19
18
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
20
19
  }
21
20
 
22
- $parcel$export(module.exports, "UNSTABLE_TreeContext", () => $c6576bb58bfa084b$export$3bc9de6f50aaf218);
23
- $parcel$export(module.exports, "UNSTABLE_TreeStateContext", () => $c6576bb58bfa084b$export$284f9562065cdd9d);
24
- $parcel$export(module.exports, "UNSTABLE_Tree", () => $c6576bb58bfa084b$export$d0a8e7e54b84533e);
25
- $parcel$export(module.exports, "UNSTABLE_TreeItemContent", () => $c6576bb58bfa084b$export$c6dbc5e1eadc6d13);
26
- $parcel$export(module.exports, "UNSTABLE_TreeItem", () => $c6576bb58bfa084b$export$635b3358b7a3dfbb);
21
+ $parcel$export(module.exports, "TreeContext", () => $c6576bb58bfa084b$export$dfae7d399eea2568);
22
+ $parcel$export(module.exports, "TreeStateContext", () => $c6576bb58bfa084b$export$8953bccafd7bce87);
23
+ $parcel$export(module.exports, "Tree", () => $c6576bb58bfa084b$export$7fbedc92909ed28e);
24
+ $parcel$export(module.exports, "TreeItemContent", () => $c6576bb58bfa084b$export$4b687e3f663d618c);
25
+ $parcel$export(module.exports, "TreeItem", () => $c6576bb58bfa084b$export$53d36ab85dc89436);
27
26
  $parcel$export(module.exports, "UNSTABLE_TreeLoadingIndicator", () => $c6576bb58bfa084b$export$9d1a587784d97b41);
28
27
  /*
29
28
  * Copyright 2024 Adobe. All rights reserved.
@@ -45,7 +44,6 @@ $parcel$export(module.exports, "UNSTABLE_TreeLoadingIndicator", () => $c6576bb58
45
44
 
46
45
 
47
46
 
48
-
49
47
  class $c6576bb58bfa084b$var$TreeCollection {
50
48
  // TODO: should this collection's getters reflect the flattened structure or the original structure
51
49
  // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes
@@ -111,11 +109,11 @@ class $c6576bb58bfa084b$var$TreeCollection {
111
109
  this.keyMap = keyMap;
112
110
  }
113
111
  }
114
- const $c6576bb58bfa084b$export$3bc9de6f50aaf218 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
115
- const $c6576bb58bfa084b$export$284f9562065cdd9d = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
116
- const $c6576bb58bfa084b$export$d0a8e7e54b84533e = /*#__PURE__*/ (0, $5SMu3$react.forwardRef)(function Tree(props, ref) {
112
+ const $c6576bb58bfa084b$export$dfae7d399eea2568 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
113
+ const $c6576bb58bfa084b$export$8953bccafd7bce87 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
114
+ const $c6576bb58bfa084b$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $5SMu3$react.forwardRef)(function Tree(props, ref) {
117
115
  // Render the portal first so that we have the collection by the time we render the DOM in SSR.
118
- [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $c6576bb58bfa084b$export$3bc9de6f50aaf218);
116
+ [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $c6576bb58bfa084b$export$dfae7d399eea2568);
119
117
  return /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $5SMu3$reactariacollections.CollectionBuilder), {
120
118
  content: /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $5SMu3$reactariacollections.Collection), props)
121
119
  }, (collection)=>/*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement($c6576bb58bfa084b$var$TreeInner, {
@@ -125,7 +123,7 @@ const $c6576bb58bfa084b$export$d0a8e7e54b84533e = /*#__PURE__*/ (0, $5SMu3$react
125
123
  }));
126
124
  });
127
125
  function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection, treeRef: ref }) {
128
- let { selectionMode: selectionMode = 'none', expandedKeys: propExpandedKeys, defaultExpandedKeys: propDefaultExpandedKeys, onExpandedChange: onExpandedChange, disabledBehavior: disabledBehavior = 'selection' } = props;
126
+ let { selectionMode: selectionMode = 'none', expandedKeys: propExpandedKeys, defaultExpandedKeys: propDefaultExpandedKeys, onExpandedChange: onExpandedChange, disabledBehavior: disabledBehavior = 'all' } = props;
129
127
  let { CollectionRoot: CollectionRoot, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate } = (0, $5SMu3$react.useContext)((0, $3114c2382242bdc0$exports.CollectionRendererContext));
130
128
  // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add
131
129
  // flattenCollection stuff to useTreeState. Think about this later
@@ -148,7 +146,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
148
146
  children: undefined,
149
147
  disabledBehavior: disabledBehavior
150
148
  });
151
- let { gridProps: gridProps } = (0, $5SMu3$reactariatree.useTreeGridList)({
149
+ let { gridProps: gridProps } = (0, $5SMu3$reactaria.useTree)({
152
150
  ...props,
153
151
  isVirtualized: isVirtualized,
154
152
  layoutDelegate: layoutDelegate
@@ -167,7 +165,6 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
167
165
  values: renderValues
168
166
  });
169
167
  let emptyState = null;
170
- let emptyStatePropOverrides = null;
171
168
  if (state.collection.size === 0 && props.renderEmptyState) {
172
169
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
173
170
  let { isEmpty: isEmpty, ...values } = renderValues;
@@ -195,7 +192,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
195
192
  return /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $5SMu3$reactaria.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement("div", {
196
193
  ...(0, $5SMu3$reactariautils.filterDOMProps)(props),
197
194
  ...renderProps,
198
- ...(0, $5SMu3$reactaria.mergeProps)(gridProps, focusProps, emptyStatePropOverrides),
195
+ ...(0, $5SMu3$reactaria.mergeProps)(gridProps, focusProps),
199
196
  ref: ref,
200
197
  slot: props.slot || undefined,
201
198
  onScroll: props.onScroll,
@@ -205,7 +202,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
205
202
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
206
203
  values: [
207
204
  [
208
- $c6576bb58bfa084b$export$284f9562065cdd9d,
205
+ $c6576bb58bfa084b$export$8953bccafd7bce87,
209
206
  state
210
207
  ]
211
208
  ]
@@ -215,7 +212,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
215
212
  scrollRef: ref
216
213
  })), emptyState));
217
214
  }
218
- const $c6576bb58bfa084b$export$c6dbc5e1eadc6d13 = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createLeafComponent)('content', function TreeItemContent(props) {
215
+ const $c6576bb58bfa084b$export$4b687e3f663d618c = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createLeafComponent)('content', function TreeItemContent(props) {
219
216
  let values = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$36b5dda0d9bc8f78);
220
217
  let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
221
218
  children: props.children,
@@ -226,17 +223,17 @@ const $c6576bb58bfa084b$export$c6dbc5e1eadc6d13 = /*#__PURE__*/ (0, $5SMu3$react
226
223
  }, renderProps.children);
227
224
  });
228
225
  const $c6576bb58bfa084b$export$36b5dda0d9bc8f78 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
229
- const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createBranchComponent)('item', (props, ref, item)=>{
226
+ const $c6576bb58bfa084b$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createBranchComponent)('item', (props, ref, item)=>{
230
227
  var _this;
231
- let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$284f9562065cdd9d);
228
+ let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$8953bccafd7bce87);
232
229
  ref = (0, $5SMu3$reactariautils.useObjectRef)(ref);
233
230
  // TODO: remove this when we support description in tree row
234
231
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
235
- let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $5SMu3$reactariatree.useTreeGridListItem)({
232
+ let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $5SMu3$reactaria.useTreeItem)({
236
233
  node: item
237
234
  }, state, ref);
238
235
  let isExpanded = rowProps['aria-expanded'] === true;
239
- let hasChildRows = ((_this = [
236
+ let hasChildItems = props.hasChildItems || ((_this = [
240
237
  ...state.collection.getChildren(item.key)
241
238
  ]) === null || _this === void 0 ? void 0 : _this.length) > 1;
242
239
  let level = rowProps['aria-level'] || 1;
@@ -253,25 +250,32 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
253
250
  let { checkboxProps: checkboxProps } = (0, $5SMu3$reactaria.useGridListSelectionCheckbox)({
254
251
  key: item.key
255
252
  }, state);
253
+ let selectionMode = state.selectionManager.selectionMode;
254
+ let selectionBehavior = state.selectionManager.selectionBehavior;
256
255
  let renderPropValues = (0, ($parcel$interopDefault($5SMu3$react))).useMemo(()=>({
257
256
  ...states,
258
257
  isHovered: isHovered,
259
258
  isFocusVisible: isFocusVisible,
260
259
  isExpanded: isExpanded,
261
- hasChildRows: hasChildRows,
260
+ hasChildItems: hasChildItems,
262
261
  level: level,
263
- selectionMode: state.selectionManager.selectionMode,
264
- selectionBehavior: state.selectionManager.selectionBehavior,
265
- isFocusVisibleWithin: isFocusVisibleWithin
262
+ selectionMode: selectionMode,
263
+ selectionBehavior: selectionBehavior,
264
+ isFocusVisibleWithin: isFocusVisibleWithin,
265
+ state: state,
266
+ id: item.key
266
267
  }), [
267
268
  states,
268
269
  isHovered,
269
270
  isFocusVisible,
270
- state.selectionManager,
271
+ selectionMode,
272
+ selectionBehavior,
271
273
  isExpanded,
272
- hasChildRows,
274
+ hasChildItems,
273
275
  level,
274
- isFocusVisibleWithin
276
+ isFocusVisibleWithin,
277
+ state,
278
+ item.key
275
279
  ]);
276
280
  let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
277
281
  ...props,
@@ -291,7 +295,7 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
291
295
  ]);
292
296
  let expandButtonRef = (0, $5SMu3$react.useRef)(null);
293
297
  (0, $5SMu3$react.useEffect)(()=>{
294
- if (hasChildRows && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
298
+ if (hasChildItems && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
295
299
  // eslint-disable-next-line
296
300
  }, []);
297
301
  let children = (0, $5SMu3$reactariacollections.useCachedChildren)({
@@ -315,8 +319,8 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
315
319
  ...renderProps,
316
320
  ref: ref,
317
321
  // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?
318
- "data-expanded": hasChildRows && isExpanded || undefined,
319
- "data-has-child-rows": hasChildRows || undefined,
322
+ "data-expanded": hasChildItems && isExpanded || undefined,
323
+ "data-has-child-items": hasChildItems || undefined,
320
324
  "data-level": level,
321
325
  "data-selected": states.isSelected || undefined,
322
326
  "data-disabled": states.isDisabled || undefined,
@@ -364,10 +368,10 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
364
368
  }, children))));
365
369
  });
366
370
  const $c6576bb58bfa084b$export$9d1a587784d97b41 = (0, $5SMu3$reactariacollections.createLeafComponent)('loader', function TreeLoader(props, ref, item) {
367
- let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$284f9562065cdd9d);
371
+ let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$8953bccafd7bce87);
368
372
  // This loader row is is non-interactable, but we want the same aria props calculated as a typical row
369
373
  // @ts-ignore
370
- let { rowProps: rowProps } = (0, $5SMu3$reactariatree.useTreeGridListItem)({
374
+ let { rowProps: rowProps } = (0, $5SMu3$reactaria.useTreeItem)({
371
375
  node: item
372
376
  }, state, ref);
373
377
  let level = rowProps['aria-level'] || 1;
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAeD,MAAM;IAYJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM;IAClC;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAA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I,gBAA2B,EAAE;IAEjC,IAAI,YAAY,CAAC;QACf,IAAI,KAAK,IAAI,KAAK,UAAU,KAAK,IAAI,KAAK,UAAU;YAClD,IAAI,YAAY,iBAAA,2BAAA,KAAM,SAAS;YAC/B,IAAI,QAAQ;gBAAC,GAAG,IAAI;YAAA;YACpB,IAAI,aAAa,MAAM;gBACrB,sMAAsM;gBACtM,oGAAoG;gBACpG,IAAI,iBAAiB;uBAAI,WAAW,WAAW,CAAC;iBAAW,CAAC,EAAE,CAAC,IAAI,KAAK;gBACxE,IAAI,gBACF,MAAM,KAAK,GAAG,CAAA,iBAAA,2BAAA,KAAM,KAAK,KAAI,OAAO,CAAA,iBAAA,2BAAA,KAAM,KAAK,IAAG,IAAI;gBAGxD,iJAAiJ;gBACjJ,sEAAsE;gBACtE,IAAI,KAAK,IAAI,KAAK,UAChB,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG;gBAG7B,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE;YACxB,OACE,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;YAGvB,IAAI,KAAK,KAAK,KAAK,KAAM,aAAa,QAAQ,aAAa,GAAG,CAAC,cAAc,cAAc,IAAI,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK,YACjH,6GAA6G;YAC7G,cAAc,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK;QAE/C,OAAO,IAAI,KAAK,IAAI,KAAK,MACvB,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;QAGvB,KAAK,IAAI,SAAS,WAAW,WAAW,CAAC,KAAK,GAAG,EAC/C,UAAU;IAEd;IAEA,KAAK,IAAI,QAAQ,WACf,UAAU;IAGZ,OAAO;uBACL;gBACA;IACF;AACF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeGridListProps, useTreeGridList, useTreeGridListItem} from '@react-aria/tree';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DisabledBehavior, Expandable, forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {FocusScope, mergeProps, useFocusRing, useGridListSelectionCheckbox, useHover} from 'react-aria';\nimport {Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.flattenedRows.length;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.size - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, ScrollableProps<HTMLDivElement>, Expandable {\n /** How multiple selection should behave in the tree. */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'selection'\n */\n disabledBehavior?: DisabledBehavior\n}\n\n\nexport const UNSTABLE_TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const UNSTABLE_TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const UNSTABLE_Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, UNSTABLE_TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'selection'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTreeGridList({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n let emptyStatePropOverrides: HTMLAttributes<HTMLElement> | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1,\n 'aria-posinset': 1,\n 'aria-setsize': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps, emptyStatePropOverrides)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [UNSTABLE_TreeStateContext, state]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends Omit<ItemRenderProps, 'allowsDragging' | 'isDragging' | 'isDropTarget'> {\n /** Whether the tree item is expanded. */\n isExpanded: boolean,\n // TODO: api discussion, how do we feel about the below? This is so we can still style the row as grey when a child element within is focused\n // Maybe should have this for the other collection item render props\n /** Whether the tree item's children have keyboard focus. */\n isFocusVisibleWithin: boolean\n}\n\nexport interface TreeItemContentRenderProps extends ItemRenderProps {\n // Whether the tree item is expanded.\n isExpanded: boolean,\n // Whether the tree item has child rows.\n hasChildRows: boolean,\n // What level the tree item has within the tree.\n level: number,\n // Whether the tree item's children have keyboard focus.\n isFocusVisibleWithin: boolean\n}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nexport const UNSTABLE_TreeItemContent = /*#__PURE__*/ createLeafComponent('content', function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const UNSTABLE_TreeItem = /*#__PURE__*/ createBranchComponent('item', <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(UNSTABLE_TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeGridListItem({node: item}, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildRows = [...state.collection.getChildren!(item.key)]?.length > 1;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildRows,\n level,\n selectionMode: state.selectionManager.selectionMode,\n selectionBehavior: state.selectionManager.selectionBehavior,\n isFocusVisibleWithin\n }), [states, isHovered, isFocusVisible, state.selectionManager, isExpanded, hasChildRows, level, isFocusVisibleWithin]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (hasChildRows && !expandButtonRef.current) {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n return (\n <>\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, focusWithinProps)}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildRows && isExpanded) || undefined}\n data-has-child-rows={hasChildRows || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface TreeLoadingIndicatorRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoaderProps extends RenderProps<TreeLoadingIndicatorRenderProps>, StyleRenderProps<TreeLoadingIndicatorRenderProps> {}\n\nexport const UNSTABLE_TreeLoadingIndicator = createLeafComponent('loader', function TreeLoader<T extends object>(props: TreeLoaderProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(UNSTABLE_TreeStateContext);\n // This loader row is is non-interactable, but we want the same aria props calculated as a typical row\n // @ts-ignore\n let {rowProps} = useTreeGridListItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n let ariaProps = {\n 'aria-level': rowProps['aria-level'],\n 'aria-posinset': rowProps['aria-posinset'],\n 'aria-setsize': rowProps['aria-setsize']\n };\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n\n return (\n <>\n <div\n role=\"row\"\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div role=\"gridcell\" aria-colindex={1}>\n {renderProps.children}\n </div>\n </div>\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n if (node.level === 0 || (parentKey != null && expandedKeys.has(parentKey) && flattenedRows.find(row => row.key === parentKey))) {\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n flattenedRows.push(keyMap.get(node.key) || node);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap\n };\n}\n"],"names":[],"version":3,"file":"Tree.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAcD,MAAM;IAYJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM;IAClC;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAE;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI;IAChC;IAEA,cAAc;YACL;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,EAAE,cAArB,2CAAA,qBAAuB,GAAG;IACnC;IAEA,aAAa;YACJ;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,cAAjC,2CAAA,qBAAmC,GAAG;IAC/C;IAEA,YAAY,GAAQ,EAAE;YAEb;QADP,IAAI,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK;QAC5D,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,cAA7B,2CAAA,qBAA+B,GAAG;IAC3C;IAEA,aAAa,GAAQ,EAAE;YAEd;QADP,IAAI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M,GAAG,EAAE;YACxB,OACE,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;YAGvB,IAAI,KAAK,KAAK,KAAK,KAAM,aAAa,QAAQ,aAAa,GAAG,CAAC,cAAc,cAAc,IAAI,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK,YACjH,6GAA6G;YAC7G,cAAc,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK;QAE/C,OAAO,IAAI,KAAK,IAAI,KAAK,MACvB,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;QAGvB,KAAK,IAAI,SAAS,WAAW,WAAW,CAAC,KAAK,GAAG,EAC/C,UAAU;IAEd;IAEA,KAAK,IAAI,QAAQ,WACf,UAAU;IAGZ,OAAO;uBACL;gBACA;IACF;AACF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTreeItemOptions, AriaTreeProps, FocusScope, mergeProps, useFocusRing, useGridListSelectionCheckbox, useHover, useTree, useTreeItem} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DisabledBehavior, Expandable, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection, RefObject} from '@react-types/shared';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.flattenedRows.length;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.size - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, ScrollableProps<HTMLDivElement>, Expandable {\n /** How multiple selection should behave in the tree. */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1,\n 'aria-posinset': 1,\n 'aria-setsize': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [TreeStateContext, state]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends Omit<ItemRenderProps, 'allowsDragging' | 'isDragging' | 'isDropTarget'> {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent('content', function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, Pick<AriaTreeItemOptions, 'hasChildItems'> {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent('item', <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({node: item}, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key\n }), [states, isHovered, isFocusVisible, selectionMode, selectionBehavior, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current) {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n return (\n <>\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, focusWithinProps)}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface UNSTABLE_TreeLoadingIndicatorRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoaderProps extends RenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps>, StyleRenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps> {}\n\nexport const UNSTABLE_TreeLoadingIndicator = createLeafComponent('loader', function TreeLoader<T extends object>(props: TreeLoaderProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(TreeStateContext);\n // This loader row is is non-interactable, but we want the same aria props calculated as a typical row\n // @ts-ignore\n let {rowProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n let ariaProps = {\n 'aria-level': rowProps['aria-level'],\n 'aria-posinset': rowProps['aria-posinset'],\n 'aria-setsize': rowProps['aria-setsize']\n };\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n\n return (\n <>\n <div\n role=\"row\"\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div role=\"gridcell\" aria-colindex={1}>\n {renderProps.children}\n </div>\n </div>\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n if (node.level === 0 || (parentKey != null && expandedKeys.has(parentKey) && flattenedRows.find(row => row.key === parentKey))) {\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n flattenedRows.push(keyMap.get(node.key) || node);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap\n };\n}\n"],"names":[],"version":3,"file":"Tree.main.js.map"}
package/dist/Tree.mjs CHANGED
@@ -2,10 +2,9 @@ import {ButtonContext as $d2b4bc8c273e7be6$export$24d547caef80ccd1} from "./Butt
2
2
  import {CheckboxContext as $4e85f108e88277b8$export$b085522c77523c51} from "./RSPContexts.mjs";
3
3
  import {CollectionRendererContext as $7135fc7d473fd974$export$4feb769f8ddf26c5, DefaultCollectionRenderer as $7135fc7d473fd974$export$a164736487e3f0ae, usePersistedKeys as $7135fc7d473fd974$export$90e00781bc59d8f9} from "./Collection.mjs";
4
4
  import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
5
- import {useTreeGridList as $kUtXx$useTreeGridList, useTreeGridListItem as $kUtXx$useTreeGridListItem} from "@react-aria/tree";
5
+ import {useTree as $kUtXx$useTree, useFocusRing as $kUtXx$useFocusRing, FocusScope as $kUtXx$FocusScope, mergeProps as $kUtXx$mergeProps, useTreeItem as $kUtXx$useTreeItem, useHover as $kUtXx$useHover, useGridListSelectionCheckbox as $kUtXx$useGridListSelectionCheckbox} from "react-aria";
6
6
  import {CollectionBuilder as $kUtXx$CollectionBuilder, Collection as $kUtXx$Collection, createLeafComponent as $kUtXx$createLeafComponent, createBranchComponent as $kUtXx$createBranchComponent, useCachedChildren as $kUtXx$useCachedChildren} from "@react-aria/collections";
7
7
  import {filterDOMProps as $kUtXx$filterDOMProps, useObjectRef as $kUtXx$useObjectRef} from "@react-aria/utils";
8
- import {useFocusRing as $kUtXx$useFocusRing, FocusScope as $kUtXx$FocusScope, mergeProps as $kUtXx$mergeProps, useHover as $kUtXx$useHover, useGridListSelectionCheckbox as $kUtXx$useGridListSelectionCheckbox} from "react-aria";
9
8
  import {useTreeState as $kUtXx$useTreeState} from "react-stately";
10
9
  import $kUtXx$react, {createContext as $kUtXx$createContext, forwardRef as $kUtXx$forwardRef, useContext as $kUtXx$useContext, useMemo as $kUtXx$useMemo, useEffect as $kUtXx$useEffect, useRef as $kUtXx$useRef} from "react";
11
10
  import {useControlledState as $kUtXx$useControlledState} from "@react-stately/utils";
@@ -30,7 +29,6 @@ import {useControlledState as $kUtXx$useControlledState} from "@react-stately/ut
30
29
 
31
30
 
32
31
 
33
-
34
32
  class $2f5eaf4a2a47b4cf$var$TreeCollection {
35
33
  // TODO: should this collection's getters reflect the flattened structure or the original structure
36
34
  // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes
@@ -96,11 +94,11 @@ class $2f5eaf4a2a47b4cf$var$TreeCollection {
96
94
  this.keyMap = keyMap;
97
95
  }
98
96
  }
99
- const $2f5eaf4a2a47b4cf$export$3bc9de6f50aaf218 = /*#__PURE__*/ (0, $kUtXx$createContext)(null);
100
- const $2f5eaf4a2a47b4cf$export$284f9562065cdd9d = /*#__PURE__*/ (0, $kUtXx$createContext)(null);
101
- const $2f5eaf4a2a47b4cf$export$d0a8e7e54b84533e = /*#__PURE__*/ (0, $kUtXx$forwardRef)(function Tree(props, ref) {
97
+ const $2f5eaf4a2a47b4cf$export$dfae7d399eea2568 = /*#__PURE__*/ (0, $kUtXx$createContext)(null);
98
+ const $2f5eaf4a2a47b4cf$export$8953bccafd7bce87 = /*#__PURE__*/ (0, $kUtXx$createContext)(null);
99
+ const $2f5eaf4a2a47b4cf$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $kUtXx$forwardRef)(function Tree(props, ref) {
102
100
  // Render the portal first so that we have the collection by the time we render the DOM in SSR.
103
- [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $2f5eaf4a2a47b4cf$export$3bc9de6f50aaf218);
101
+ [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $2f5eaf4a2a47b4cf$export$dfae7d399eea2568);
104
102
  return /*#__PURE__*/ (0, $kUtXx$react).createElement((0, $kUtXx$CollectionBuilder), {
105
103
  content: /*#__PURE__*/ (0, $kUtXx$react).createElement((0, $kUtXx$Collection), props)
106
104
  }, (collection)=>/*#__PURE__*/ (0, $kUtXx$react).createElement($2f5eaf4a2a47b4cf$var$TreeInner, {
@@ -110,7 +108,7 @@ const $2f5eaf4a2a47b4cf$export$d0a8e7e54b84533e = /*#__PURE__*/ (0, $kUtXx$forwa
110
108
  }));
111
109
  });
112
110
  function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection, treeRef: ref }) {
113
- let { selectionMode: selectionMode = 'none', expandedKeys: propExpandedKeys, defaultExpandedKeys: propDefaultExpandedKeys, onExpandedChange: onExpandedChange, disabledBehavior: disabledBehavior = 'selection' } = props;
111
+ let { selectionMode: selectionMode = 'none', expandedKeys: propExpandedKeys, defaultExpandedKeys: propDefaultExpandedKeys, onExpandedChange: onExpandedChange, disabledBehavior: disabledBehavior = 'all' } = props;
114
112
  let { CollectionRoot: CollectionRoot, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate } = (0, $kUtXx$useContext)((0, $7135fc7d473fd974$export$4feb769f8ddf26c5));
115
113
  // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add
116
114
  // flattenCollection stuff to useTreeState. Think about this later
@@ -133,7 +131,7 @@ function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection,
133
131
  children: undefined,
134
132
  disabledBehavior: disabledBehavior
135
133
  });
136
- let { gridProps: gridProps } = (0, $kUtXx$useTreeGridList)({
134
+ let { gridProps: gridProps } = (0, $kUtXx$useTree)({
137
135
  ...props,
138
136
  isVirtualized: isVirtualized,
139
137
  layoutDelegate: layoutDelegate
@@ -152,7 +150,6 @@ function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection,
152
150
  values: renderValues
153
151
  });
154
152
  let emptyState = null;
155
- let emptyStatePropOverrides = null;
156
153
  if (state.collection.size === 0 && props.renderEmptyState) {
157
154
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
158
155
  let { isEmpty: isEmpty, ...values } = renderValues;
@@ -180,7 +177,7 @@ function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection,
180
177
  return /*#__PURE__*/ (0, $kUtXx$react).createElement((0, $kUtXx$FocusScope), null, /*#__PURE__*/ (0, $kUtXx$react).createElement("div", {
181
178
  ...(0, $kUtXx$filterDOMProps)(props),
182
179
  ...renderProps,
183
- ...(0, $kUtXx$mergeProps)(gridProps, focusProps, emptyStatePropOverrides),
180
+ ...(0, $kUtXx$mergeProps)(gridProps, focusProps),
184
181
  ref: ref,
185
182
  slot: props.slot || undefined,
186
183
  onScroll: props.onScroll,
@@ -190,7 +187,7 @@ function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection,
190
187
  }, /*#__PURE__*/ (0, $kUtXx$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
191
188
  values: [
192
189
  [
193
- $2f5eaf4a2a47b4cf$export$284f9562065cdd9d,
190
+ $2f5eaf4a2a47b4cf$export$8953bccafd7bce87,
194
191
  state
195
192
  ]
196
193
  ]
@@ -200,7 +197,7 @@ function $2f5eaf4a2a47b4cf$var$TreeInner({ props: props, collection: collection,
200
197
  scrollRef: ref
201
198
  })), emptyState));
202
199
  }
203
- const $2f5eaf4a2a47b4cf$export$c6dbc5e1eadc6d13 = /*#__PURE__*/ (0, $kUtXx$createLeafComponent)('content', function TreeItemContent(props) {
200
+ const $2f5eaf4a2a47b4cf$export$4b687e3f663d618c = /*#__PURE__*/ (0, $kUtXx$createLeafComponent)('content', function TreeItemContent(props) {
204
201
  let values = (0, $kUtXx$useContext)($2f5eaf4a2a47b4cf$export$36b5dda0d9bc8f78);
205
202
  let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
206
203
  children: props.children,
@@ -211,17 +208,17 @@ const $2f5eaf4a2a47b4cf$export$c6dbc5e1eadc6d13 = /*#__PURE__*/ (0, $kUtXx$creat
211
208
  }, renderProps.children);
212
209
  });
213
210
  const $2f5eaf4a2a47b4cf$export$36b5dda0d9bc8f78 = /*#__PURE__*/ (0, $kUtXx$createContext)(null);
214
- const $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $kUtXx$createBranchComponent)('item', (props, ref, item)=>{
211
+ const $2f5eaf4a2a47b4cf$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $kUtXx$createBranchComponent)('item', (props, ref, item)=>{
215
212
  var _this;
216
- let state = (0, $kUtXx$useContext)($2f5eaf4a2a47b4cf$export$284f9562065cdd9d);
213
+ let state = (0, $kUtXx$useContext)($2f5eaf4a2a47b4cf$export$8953bccafd7bce87);
217
214
  ref = (0, $kUtXx$useObjectRef)(ref);
218
215
  // TODO: remove this when we support description in tree row
219
216
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
220
- let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $kUtXx$useTreeGridListItem)({
217
+ let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $kUtXx$useTreeItem)({
221
218
  node: item
222
219
  }, state, ref);
223
220
  let isExpanded = rowProps['aria-expanded'] === true;
224
- let hasChildRows = ((_this = [
221
+ let hasChildItems = props.hasChildItems || ((_this = [
225
222
  ...state.collection.getChildren(item.key)
226
223
  ]) === null || _this === void 0 ? void 0 : _this.length) > 1;
227
224
  let level = rowProps['aria-level'] || 1;
@@ -238,25 +235,32 @@ const $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $kUtXx$creat
238
235
  let { checkboxProps: checkboxProps } = (0, $kUtXx$useGridListSelectionCheckbox)({
239
236
  key: item.key
240
237
  }, state);
238
+ let selectionMode = state.selectionManager.selectionMode;
239
+ let selectionBehavior = state.selectionManager.selectionBehavior;
241
240
  let renderPropValues = (0, $kUtXx$react).useMemo(()=>({
242
241
  ...states,
243
242
  isHovered: isHovered,
244
243
  isFocusVisible: isFocusVisible,
245
244
  isExpanded: isExpanded,
246
- hasChildRows: hasChildRows,
245
+ hasChildItems: hasChildItems,
247
246
  level: level,
248
- selectionMode: state.selectionManager.selectionMode,
249
- selectionBehavior: state.selectionManager.selectionBehavior,
250
- isFocusVisibleWithin: isFocusVisibleWithin
247
+ selectionMode: selectionMode,
248
+ selectionBehavior: selectionBehavior,
249
+ isFocusVisibleWithin: isFocusVisibleWithin,
250
+ state: state,
251
+ id: item.key
251
252
  }), [
252
253
  states,
253
254
  isHovered,
254
255
  isFocusVisible,
255
- state.selectionManager,
256
+ selectionMode,
257
+ selectionBehavior,
256
258
  isExpanded,
257
- hasChildRows,
259
+ hasChildItems,
258
260
  level,
259
- isFocusVisibleWithin
261
+ isFocusVisibleWithin,
262
+ state,
263
+ item.key
260
264
  ]);
261
265
  let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
262
266
  ...props,
@@ -276,7 +280,7 @@ const $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $kUtXx$creat
276
280
  ]);
277
281
  let expandButtonRef = (0, $kUtXx$useRef)(null);
278
282
  (0, $kUtXx$useEffect)(()=>{
279
- if (hasChildRows && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
283
+ if (hasChildItems && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
280
284
  // eslint-disable-next-line
281
285
  }, []);
282
286
  let children = (0, $kUtXx$useCachedChildren)({
@@ -300,8 +304,8 @@ const $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $kUtXx$creat
300
304
  ...renderProps,
301
305
  ref: ref,
302
306
  // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?
303
- "data-expanded": hasChildRows && isExpanded || undefined,
304
- "data-has-child-rows": hasChildRows || undefined,
307
+ "data-expanded": hasChildItems && isExpanded || undefined,
308
+ "data-has-child-items": hasChildItems || undefined,
305
309
  "data-level": level,
306
310
  "data-selected": states.isSelected || undefined,
307
311
  "data-disabled": states.isDisabled || undefined,
@@ -349,10 +353,10 @@ const $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $kUtXx$creat
349
353
  }, children))));
350
354
  });
351
355
  const $2f5eaf4a2a47b4cf$export$9d1a587784d97b41 = (0, $kUtXx$createLeafComponent)('loader', function TreeLoader(props, ref, item) {
352
- let state = (0, $kUtXx$useContext)($2f5eaf4a2a47b4cf$export$284f9562065cdd9d);
356
+ let state = (0, $kUtXx$useContext)($2f5eaf4a2a47b4cf$export$8953bccafd7bce87);
353
357
  // This loader row is is non-interactable, but we want the same aria props calculated as a typical row
354
358
  // @ts-ignore
355
- let { rowProps: rowProps } = (0, $kUtXx$useTreeGridListItem)({
359
+ let { rowProps: rowProps } = (0, $kUtXx$useTreeItem)({
356
360
  node: item
357
361
  }, state, ref);
358
362
  let level = rowProps['aria-level'] || 1;
@@ -420,5 +424,5 @@ function $2f5eaf4a2a47b4cf$var$flattenTree(collection, opts) {
420
424
  }
421
425
 
422
426
 
423
- export {$2f5eaf4a2a47b4cf$export$3bc9de6f50aaf218 as UNSTABLE_TreeContext, $2f5eaf4a2a47b4cf$export$284f9562065cdd9d as UNSTABLE_TreeStateContext, $2f5eaf4a2a47b4cf$export$d0a8e7e54b84533e as UNSTABLE_Tree, $2f5eaf4a2a47b4cf$export$c6dbc5e1eadc6d13 as UNSTABLE_TreeItemContent, $2f5eaf4a2a47b4cf$export$36b5dda0d9bc8f78 as TreeItemContentContext, $2f5eaf4a2a47b4cf$export$635b3358b7a3dfbb as UNSTABLE_TreeItem, $2f5eaf4a2a47b4cf$export$9d1a587784d97b41 as UNSTABLE_TreeLoadingIndicator};
427
+ export {$2f5eaf4a2a47b4cf$export$dfae7d399eea2568 as TreeContext, $2f5eaf4a2a47b4cf$export$8953bccafd7bce87 as TreeStateContext, $2f5eaf4a2a47b4cf$export$7fbedc92909ed28e as Tree, $2f5eaf4a2a47b4cf$export$4b687e3f663d618c as TreeItemContent, $2f5eaf4a2a47b4cf$export$36b5dda0d9bc8f78 as TreeItemContentContext, $2f5eaf4a2a47b4cf$export$53d36ab85dc89436 as TreeItem, $2f5eaf4a2a47b4cf$export$9d1a587784d97b41 as UNSTABLE_TreeLoadingIndicator};
424
428
  //# sourceMappingURL=Tree.module.js.map