@react-aria/tree 3.0.0-alpha.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 (204) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/dist/ar-AE.main.js +7 -0
  4. package/dist/ar-AE.main.js.map +1 -0
  5. package/dist/ar-AE.mjs +9 -0
  6. package/dist/ar-AE.module.js +9 -0
  7. package/dist/ar-AE.module.js.map +1 -0
  8. package/dist/bg-BG.main.js +7 -0
  9. package/dist/bg-BG.main.js.map +1 -0
  10. package/dist/bg-BG.mjs +9 -0
  11. package/dist/bg-BG.module.js +9 -0
  12. package/dist/bg-BG.module.js.map +1 -0
  13. package/dist/cs-CZ.main.js +7 -0
  14. package/dist/cs-CZ.main.js.map +1 -0
  15. package/dist/cs-CZ.mjs +9 -0
  16. package/dist/cs-CZ.module.js +9 -0
  17. package/dist/cs-CZ.module.js.map +1 -0
  18. package/dist/da-DK.main.js +7 -0
  19. package/dist/da-DK.main.js.map +1 -0
  20. package/dist/da-DK.mjs +9 -0
  21. package/dist/da-DK.module.js +9 -0
  22. package/dist/da-DK.module.js.map +1 -0
  23. package/dist/de-DE.main.js +7 -0
  24. package/dist/de-DE.main.js.map +1 -0
  25. package/dist/de-DE.mjs +9 -0
  26. package/dist/de-DE.module.js +9 -0
  27. package/dist/de-DE.module.js.map +1 -0
  28. package/dist/el-GR.main.js +7 -0
  29. package/dist/el-GR.main.js.map +1 -0
  30. package/dist/el-GR.mjs +9 -0
  31. package/dist/el-GR.module.js +9 -0
  32. package/dist/el-GR.module.js.map +1 -0
  33. package/dist/en-US.main.js +7 -0
  34. package/dist/en-US.main.js.map +1 -0
  35. package/dist/en-US.mjs +9 -0
  36. package/dist/en-US.module.js +9 -0
  37. package/dist/en-US.module.js.map +1 -0
  38. package/dist/es-ES.main.js +7 -0
  39. package/dist/es-ES.main.js.map +1 -0
  40. package/dist/es-ES.mjs +9 -0
  41. package/dist/es-ES.module.js +9 -0
  42. package/dist/es-ES.module.js.map +1 -0
  43. package/dist/et-EE.main.js +7 -0
  44. package/dist/et-EE.main.js.map +1 -0
  45. package/dist/et-EE.mjs +9 -0
  46. package/dist/et-EE.module.js +9 -0
  47. package/dist/et-EE.module.js.map +1 -0
  48. package/dist/fi-FI.main.js +7 -0
  49. package/dist/fi-FI.main.js.map +1 -0
  50. package/dist/fi-FI.mjs +9 -0
  51. package/dist/fi-FI.module.js +9 -0
  52. package/dist/fi-FI.module.js.map +1 -0
  53. package/dist/fr-FR.main.js +7 -0
  54. package/dist/fr-FR.main.js.map +1 -0
  55. package/dist/fr-FR.mjs +9 -0
  56. package/dist/fr-FR.module.js +9 -0
  57. package/dist/fr-FR.module.js.map +1 -0
  58. package/dist/he-IL.main.js +7 -0
  59. package/dist/he-IL.main.js.map +1 -0
  60. package/dist/he-IL.mjs +9 -0
  61. package/dist/he-IL.module.js +9 -0
  62. package/dist/he-IL.module.js.map +1 -0
  63. package/dist/hr-HR.main.js +7 -0
  64. package/dist/hr-HR.main.js.map +1 -0
  65. package/dist/hr-HR.mjs +9 -0
  66. package/dist/hr-HR.module.js +9 -0
  67. package/dist/hr-HR.module.js.map +1 -0
  68. package/dist/hu-HU.main.js +7 -0
  69. package/dist/hu-HU.main.js.map +1 -0
  70. package/dist/hu-HU.mjs +9 -0
  71. package/dist/hu-HU.module.js +9 -0
  72. package/dist/hu-HU.module.js.map +1 -0
  73. package/dist/import.mjs +21 -0
  74. package/dist/intlStrings.main.js +108 -0
  75. package/dist/intlStrings.main.js.map +1 -0
  76. package/dist/intlStrings.mjs +110 -0
  77. package/dist/intlStrings.module.js +110 -0
  78. package/dist/intlStrings.module.js.map +1 -0
  79. package/dist/it-IT.main.js +7 -0
  80. package/dist/it-IT.main.js.map +1 -0
  81. package/dist/it-IT.mjs +9 -0
  82. package/dist/it-IT.module.js +9 -0
  83. package/dist/it-IT.module.js.map +1 -0
  84. package/dist/ja-JP.main.js +7 -0
  85. package/dist/ja-JP.main.js.map +1 -0
  86. package/dist/ja-JP.mjs +9 -0
  87. package/dist/ja-JP.module.js +9 -0
  88. package/dist/ja-JP.module.js.map +1 -0
  89. package/dist/ko-KR.main.js +7 -0
  90. package/dist/ko-KR.main.js.map +1 -0
  91. package/dist/ko-KR.mjs +9 -0
  92. package/dist/ko-KR.module.js +9 -0
  93. package/dist/ko-KR.module.js.map +1 -0
  94. package/dist/lt-LT.main.js +7 -0
  95. package/dist/lt-LT.main.js.map +1 -0
  96. package/dist/lt-LT.mjs +9 -0
  97. package/dist/lt-LT.module.js +9 -0
  98. package/dist/lt-LT.module.js.map +1 -0
  99. package/dist/lv-LV.main.js +7 -0
  100. package/dist/lv-LV.main.js.map +1 -0
  101. package/dist/lv-LV.mjs +9 -0
  102. package/dist/lv-LV.module.js +9 -0
  103. package/dist/lv-LV.module.js.map +1 -0
  104. package/dist/main.js +28 -0
  105. package/dist/main.js.map +1 -0
  106. package/dist/module.js +21 -0
  107. package/dist/module.js.map +1 -0
  108. package/dist/nb-NO.main.js +7 -0
  109. package/dist/nb-NO.main.js.map +1 -0
  110. package/dist/nb-NO.mjs +9 -0
  111. package/dist/nb-NO.module.js +9 -0
  112. package/dist/nb-NO.module.js.map +1 -0
  113. package/dist/nl-NL.main.js +7 -0
  114. package/dist/nl-NL.main.js.map +1 -0
  115. package/dist/nl-NL.mjs +9 -0
  116. package/dist/nl-NL.module.js +9 -0
  117. package/dist/nl-NL.module.js.map +1 -0
  118. package/dist/pl-PL.main.js +7 -0
  119. package/dist/pl-PL.main.js.map +1 -0
  120. package/dist/pl-PL.mjs +9 -0
  121. package/dist/pl-PL.module.js +9 -0
  122. package/dist/pl-PL.module.js.map +1 -0
  123. package/dist/pt-BR.main.js +7 -0
  124. package/dist/pt-BR.main.js.map +1 -0
  125. package/dist/pt-BR.mjs +9 -0
  126. package/dist/pt-BR.module.js +9 -0
  127. package/dist/pt-BR.module.js.map +1 -0
  128. package/dist/pt-PT.main.js +7 -0
  129. package/dist/pt-PT.main.js.map +1 -0
  130. package/dist/pt-PT.mjs +9 -0
  131. package/dist/pt-PT.module.js +9 -0
  132. package/dist/pt-PT.module.js.map +1 -0
  133. package/dist/ro-RO.main.js +7 -0
  134. package/dist/ro-RO.main.js.map +1 -0
  135. package/dist/ro-RO.mjs +9 -0
  136. package/dist/ro-RO.module.js +9 -0
  137. package/dist/ro-RO.module.js.map +1 -0
  138. package/dist/ru-RU.main.js +7 -0
  139. package/dist/ru-RU.main.js.map +1 -0
  140. package/dist/ru-RU.mjs +9 -0
  141. package/dist/ru-RU.module.js +9 -0
  142. package/dist/ru-RU.module.js.map +1 -0
  143. package/dist/sk-SK.main.js +7 -0
  144. package/dist/sk-SK.main.js.map +1 -0
  145. package/dist/sk-SK.mjs +9 -0
  146. package/dist/sk-SK.module.js +9 -0
  147. package/dist/sk-SK.module.js.map +1 -0
  148. package/dist/sl-SI.main.js +7 -0
  149. package/dist/sl-SI.main.js.map +1 -0
  150. package/dist/sl-SI.mjs +9 -0
  151. package/dist/sl-SI.module.js +9 -0
  152. package/dist/sl-SI.module.js.map +1 -0
  153. package/dist/sr-SP.main.js +7 -0
  154. package/dist/sr-SP.main.js.map +1 -0
  155. package/dist/sr-SP.mjs +9 -0
  156. package/dist/sr-SP.module.js +9 -0
  157. package/dist/sr-SP.module.js.map +1 -0
  158. package/dist/sv-SE.main.js +7 -0
  159. package/dist/sv-SE.main.js.map +1 -0
  160. package/dist/sv-SE.mjs +9 -0
  161. package/dist/sv-SE.module.js +9 -0
  162. package/dist/sv-SE.module.js.map +1 -0
  163. package/dist/tr-TR.main.js +7 -0
  164. package/dist/tr-TR.main.js.map +1 -0
  165. package/dist/tr-TR.mjs +9 -0
  166. package/dist/tr-TR.module.js +9 -0
  167. package/dist/tr-TR.module.js.map +1 -0
  168. package/dist/types.d.ts +52 -0
  169. package/dist/types.d.ts.map +1 -0
  170. package/dist/uk-UA.main.js +7 -0
  171. package/dist/uk-UA.main.js.map +1 -0
  172. package/dist/uk-UA.mjs +9 -0
  173. package/dist/uk-UA.module.js +9 -0
  174. package/dist/uk-UA.module.js.map +1 -0
  175. package/dist/useTree.main.js +22 -0
  176. package/dist/useTree.main.js.map +1 -0
  177. package/dist/useTree.mjs +17 -0
  178. package/dist/useTree.module.js +17 -0
  179. package/dist/useTree.module.js.map +1 -0
  180. package/dist/useTreeGridList.main.js +29 -0
  181. package/dist/useTreeGridList.main.js.map +1 -0
  182. package/dist/useTreeGridList.mjs +24 -0
  183. package/dist/useTreeGridList.module.js +24 -0
  184. package/dist/useTreeGridList.module.js.map +1 -0
  185. package/dist/useTreeGridListItem.main.js +55 -0
  186. package/dist/useTreeGridListItem.main.js.map +1 -0
  187. package/dist/useTreeGridListItem.mjs +50 -0
  188. package/dist/useTreeGridListItem.module.js +50 -0
  189. package/dist/useTreeGridListItem.module.js.map +1 -0
  190. package/dist/zh-CN.main.js +7 -0
  191. package/dist/zh-CN.main.js.map +1 -0
  192. package/dist/zh-CN.mjs +9 -0
  193. package/dist/zh-CN.module.js +9 -0
  194. package/dist/zh-CN.module.js.map +1 -0
  195. package/dist/zh-TW.main.js +7 -0
  196. package/dist/zh-TW.main.js.map +1 -0
  197. package/dist/zh-TW.mjs +9 -0
  198. package/dist/zh-TW.module.js +9 -0
  199. package/dist/zh-TW.module.js.map +1 -0
  200. package/package.json +42 -0
  201. package/src/index.ts +18 -0
  202. package/src/useTree.ts +15 -0
  203. package/src/useTreeGridList.ts +51 -0
  204. package/src/useTreeGridListItem.ts +69 -0
@@ -0,0 +1,9 @@
1
+ var $f8ed0031472d4b0e$exports = {};
2
+ $f8ed0031472d4b0e$exports = {
3
+ "expand": `Expand`,
4
+ "collapse": `Collapse`
5
+ };
6
+
7
+
8
+ export {$f8ed0031472d4b0e$exports as default};
9
+ //# sourceMappingURL=uk-UA.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,UAAU,CAAC,MAAM,CAAC;IACpC,YAAY,CAAC,QAAQ,CAAC;AACxB","sources":["packages/@react-aria/tree/intl/uk-UA.json"],"sourcesContent":["{\n \"expand\": \"Expand\",\n \"collapse\": \"Collapse\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
@@ -0,0 +1,22 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "useTree", () => $0caa22fd4e1b3c7e$export$fb0040ce9d6e8bd1);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ function $0caa22fd4e1b3c7e$export$fb0040ce9d6e8bd1() {
18
+ return {};
19
+ }
20
+
21
+
22
+ //# sourceMappingURL=useTree.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAEM,SAAS;IACd,OAAO,CAAC;AACV","sources":["packages/@react-aria/tree/src/useTree.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nexport function useTree() {\n return {};\n}\n"],"names":[],"version":3,"file":"useTree.main.js.map"}
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ function $6d8a57ce39fda2fa$export$fb0040ce9d6e8bd1() {
12
+ return {};
13
+ }
14
+
15
+
16
+ export {$6d8a57ce39fda2fa$export$fb0040ce9d6e8bd1 as useTree};
17
+ //# sourceMappingURL=useTree.mjs.map
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ function $6d8a57ce39fda2fa$export$fb0040ce9d6e8bd1() {
12
+ return {};
13
+ }
14
+
15
+
16
+ export {$6d8a57ce39fda2fa$export$fb0040ce9d6e8bd1 as useTree};
17
+ //# sourceMappingURL=useTree.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAEM,SAAS;IACd,OAAO,CAAC;AACV","sources":["packages/@react-aria/tree/src/useTree.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nexport function useTree() {\n return {};\n}\n"],"names":[],"version":3,"file":"useTree.module.js.map"}
@@ -0,0 +1,29 @@
1
+ var $fE5UD$reactariagridlist = require("@react-aria/gridlist");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "useTreeGridList", () => $41ae298c995bc55f$export$abb2211d46906a63);
9
+ /*
10
+ * Copyright 2024 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+ function $41ae298c995bc55f$export$abb2211d46906a63(props, state, ref) {
21
+ let { gridProps: gridProps } = (0, $fE5UD$reactariagridlist.useGridList)(props, state, ref);
22
+ gridProps.role = "treegrid";
23
+ return {
24
+ gridProps: gridProps
25
+ };
26
+ }
27
+
28
+
29
+ //# sourceMappingURL=useTreeGridList.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAiCM,SAAS,0CAAmB,KAAiC,EAAE,KAAmB,EAAE,GAA2B;IACpH,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,oCAAU,EAAE,OAAO,OAAO;IAC5C,UAAU,IAAI,GAAG;IAEjB,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeGridList.ts"],"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 {AriaGridListOptions, AriaGridListProps, GridListProps, useGridList} from '@react-aria/gridlist';\nimport {\n DOMAttributes,\n KeyboardDelegate\n} from '@react-types/shared';\nimport {RefObject} from 'react';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface TreeGridListProps<T> extends GridListProps<T> {}\n\nexport interface AriaTreeGridListProps<T> extends AriaGridListProps<T> {}\nexport interface AriaTreeGridListOptions<T> extends Omit<AriaGridListOptions<T>, 'children' | 'isVirtualized' | 'shouldFocusWrap'> {\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\nexport interface TreeGridListAria {\n /** Props for the treegrid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a single column treegrid component with interactive children.\n * A tree grid provides users with a way to navigate nested hierarchical information.\n * @param props - Props for the treegrid.\n * @param state - State for the treegrid, as returned by `useTreeState`.\n * @param ref - The ref attached to the treegrid element.\n */\nexport function useTreeGridList<T>(props: AriaTreeGridListOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): TreeGridListAria {\n let {gridProps} = useGridList(props, state, ref);\n gridProps.role = 'treegrid';\n\n return {\n gridProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeGridList.main.js.map"}
@@ -0,0 +1,24 @@
1
+ import {useGridList as $2nLyh$useGridList} from "@react-aria/gridlist";
2
+
3
+ /*
4
+ * Copyright 2024 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $1642482277341dec$export$abb2211d46906a63(props, state, ref) {
15
+ let { gridProps: gridProps } = (0, $2nLyh$useGridList)(props, state, ref);
16
+ gridProps.role = "treegrid";
17
+ return {
18
+ gridProps: gridProps
19
+ };
20
+ }
21
+
22
+
23
+ export {$1642482277341dec$export$abb2211d46906a63 as useTreeGridList};
24
+ //# sourceMappingURL=useTreeGridList.mjs.map
@@ -0,0 +1,24 @@
1
+ import {useGridList as $2nLyh$useGridList} from "@react-aria/gridlist";
2
+
3
+ /*
4
+ * Copyright 2024 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $1642482277341dec$export$abb2211d46906a63(props, state, ref) {
15
+ let { gridProps: gridProps } = (0, $2nLyh$useGridList)(props, state, ref);
16
+ gridProps.role = "treegrid";
17
+ return {
18
+ gridProps: gridProps
19
+ };
20
+ }
21
+
22
+
23
+ export {$1642482277341dec$export$abb2211d46906a63 as useTreeGridList};
24
+ //# sourceMappingURL=useTreeGridList.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAiCM,SAAS,0CAAmB,KAAiC,EAAE,KAAmB,EAAE,GAA2B;IACpH,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE,OAAO,OAAO;IAC5C,UAAU,IAAI,GAAG;IAEjB,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeGridList.ts"],"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 {AriaGridListOptions, AriaGridListProps, GridListProps, useGridList} from '@react-aria/gridlist';\nimport {\n DOMAttributes,\n KeyboardDelegate\n} from '@react-types/shared';\nimport {RefObject} from 'react';\nimport {TreeState} from '@react-stately/tree';\n\nexport interface TreeGridListProps<T> extends GridListProps<T> {}\n\nexport interface AriaTreeGridListProps<T> extends AriaGridListProps<T> {}\nexport interface AriaTreeGridListOptions<T> extends Omit<AriaGridListOptions<T>, 'children' | 'isVirtualized' | 'shouldFocusWrap'> {\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\nexport interface TreeGridListAria {\n /** Props for the treegrid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a single column treegrid component with interactive children.\n * A tree grid provides users with a way to navigate nested hierarchical information.\n * @param props - Props for the treegrid.\n * @param state - State for the treegrid, as returned by `useTreeState`.\n * @param ref - The ref attached to the treegrid element.\n */\nexport function useTreeGridList<T>(props: AriaTreeGridListOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): TreeGridListAria {\n let {gridProps} = useGridList(props, state, ref);\n gridProps.role = 'treegrid';\n\n return {\n gridProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeGridList.module.js.map"}
@@ -0,0 +1,55 @@
1
+ var $6fc07bed32f3daee$exports = require("./intlStrings.main.js");
2
+ var $gqXxM$reactariagridlist = require("@react-aria/gridlist");
3
+ var $gqXxM$reactariautils = require("@react-aria/utils");
4
+ var $gqXxM$reactariai18n = require("@react-aria/i18n");
5
+
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+
11
+ function $parcel$export(e, n, v, s) {
12
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
+ }
14
+
15
+ $parcel$export(module.exports, "useTreeGridListItem", () => $89b99a0b1379ba07$export$8001083cb3f61028);
16
+ /*
17
+ * Copyright 2024 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+
28
+
29
+
30
+ function $89b99a0b1379ba07$export$8001083cb3f61028(props, state, ref) {
31
+ let { node: node } = props;
32
+ let gridListAria = (0, $gqXxM$reactariagridlist.useGridListItem)(props, state, ref);
33
+ let isExpanded = gridListAria.rowProps["aria-expanded"] === true;
34
+ let stringFormatter = (0, $gqXxM$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($6fc07bed32f3daee$exports))), "@react-aria/tree");
35
+ let expandButtonProps = {
36
+ onPress: ()=>{
37
+ if (!gridListAria.isDisabled) {
38
+ state.toggleKey(node.key);
39
+ state.selectionManager.setFocused(true);
40
+ state.selectionManager.setFocusedKey(node.key);
41
+ }
42
+ },
43
+ "aria-label": isExpanded ? stringFormatter.format("collapse") : stringFormatter.format("expand"),
44
+ tabIndex: (0, $gqXxM$reactariautils.isAndroid)() ? -1 : null,
45
+ "data-react-aria-prevent-focus": true
46
+ };
47
+ // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
48
+ return {
49
+ ...gridListAria,
50
+ expandButtonProps: expandButtonProps
51
+ };
52
+ }
53
+
54
+
55
+ //# sourceMappingURL=useTreeGridListItem.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkCM,SAAS,0CAAuB,KAAkC,EAAE,KAAmB,EAAE,GAAgC;IAC9H,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,eAAe,CAAA,GAAA,wCAAc,EAAE,OAAO,OAAO;IACjD,IAAI,aAAa,aAAa,QAAQ,CAAC,gBAAgB,KAAK;IAC5D,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,oBAAoB;QACtB,SAAS;YACP,IAAI,CAAC,aAAa,UAAU,EAAE;gBAC5B,MAAM,SAAS,CAAC,KAAK,GAAG;gBACxB,MAAM,gBAAgB,CAAC,UAAU,CAAC;gBAClC,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,GAAG;YAC/C;QACF;QACA,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,UAAU,CAAA,GAAA,+BAAQ,MAAM,KAAK;QAC7B,iCAAiC;IACnC;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeGridListItem.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';\nimport {DOMAttributes, FocusableElement, Node} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid} from '@react-aria/utils';\nimport {RefObject} from 'react';\nimport {TreeState} from '@react-stately/tree';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeGridListItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {\n /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */\n node: Node<unknown>\n}\n\nexport interface TreeGridListItemAria extends GridListItemAria {\n /** Props for the tree grid row element. */\n rowProps: DOMAttributes,\n /** Props for the tree grid cell element within the tree grid list row. */\n gridCellProps: DOMAttributes,\n /** Props for the tree grid row description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the tree grid row expand button. */\n expandButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a row in a tree grid list.\n * @param props - Props for the row.\n * @param state - State of the parent list, as returned by `useTreeState`.\n * @param ref - The ref attached to the row element.\n */\nexport function useTreeGridListItem<T>(props: AriaTreeGridListItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement>): TreeGridListItemAria {\n let {node} = props;\n let gridListAria = useGridListItem(props, state, ref);\n let isExpanded = gridListAria.rowProps['aria-expanded'] === true;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');\n\n let expandButtonProps = {\n onPress: () => {\n if (!gridListAria.isDisabled) {\n state.toggleKey(node.key);\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(node.key);\n }\n },\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n tabIndex: isAndroid() ? -1 : null,\n 'data-react-aria-prevent-focus': true\n };\n\n // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?\n return {\n ...gridListAria,\n expandButtonProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeGridListItem.main.js.map"}
@@ -0,0 +1,50 @@
1
+ import $ho3NY$intlStringsmodulejs from "./intlStrings.mjs";
2
+ import {useGridListItem as $ho3NY$useGridListItem} from "@react-aria/gridlist";
3
+ import {isAndroid as $ho3NY$isAndroid} from "@react-aria/utils";
4
+ import {useLocalizedStringFormatter as $ho3NY$useLocalizedStringFormatter} from "@react-aria/i18n";
5
+
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+ /*
11
+ * Copyright 2024 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+
23
+
24
+ function $0cbbe9a595ac1615$export$8001083cb3f61028(props, state, ref) {
25
+ let { node: node } = props;
26
+ let gridListAria = (0, $ho3NY$useGridListItem)(props, state, ref);
27
+ let isExpanded = gridListAria.rowProps["aria-expanded"] === true;
28
+ let stringFormatter = (0, $ho3NY$useLocalizedStringFormatter)((0, ($parcel$interopDefault($ho3NY$intlStringsmodulejs))), "@react-aria/tree");
29
+ let expandButtonProps = {
30
+ onPress: ()=>{
31
+ if (!gridListAria.isDisabled) {
32
+ state.toggleKey(node.key);
33
+ state.selectionManager.setFocused(true);
34
+ state.selectionManager.setFocusedKey(node.key);
35
+ }
36
+ },
37
+ "aria-label": isExpanded ? stringFormatter.format("collapse") : stringFormatter.format("expand"),
38
+ tabIndex: (0, $ho3NY$isAndroid)() ? -1 : null,
39
+ "data-react-aria-prevent-focus": true
40
+ };
41
+ // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
42
+ return {
43
+ ...gridListAria,
44
+ expandButtonProps: expandButtonProps
45
+ };
46
+ }
47
+
48
+
49
+ export {$0cbbe9a595ac1615$export$8001083cb3f61028 as useTreeGridListItem};
50
+ //# sourceMappingURL=useTreeGridListItem.mjs.map
@@ -0,0 +1,50 @@
1
+ import $ho3NY$intlStringsmodulejs from "./intlStrings.module.js";
2
+ import {useGridListItem as $ho3NY$useGridListItem} from "@react-aria/gridlist";
3
+ import {isAndroid as $ho3NY$isAndroid} from "@react-aria/utils";
4
+ import {useLocalizedStringFormatter as $ho3NY$useLocalizedStringFormatter} from "@react-aria/i18n";
5
+
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+ /*
11
+ * Copyright 2024 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+
23
+
24
+ function $0cbbe9a595ac1615$export$8001083cb3f61028(props, state, ref) {
25
+ let { node: node } = props;
26
+ let gridListAria = (0, $ho3NY$useGridListItem)(props, state, ref);
27
+ let isExpanded = gridListAria.rowProps["aria-expanded"] === true;
28
+ let stringFormatter = (0, $ho3NY$useLocalizedStringFormatter)((0, ($parcel$interopDefault($ho3NY$intlStringsmodulejs))), "@react-aria/tree");
29
+ let expandButtonProps = {
30
+ onPress: ()=>{
31
+ if (!gridListAria.isDisabled) {
32
+ state.toggleKey(node.key);
33
+ state.selectionManager.setFocused(true);
34
+ state.selectionManager.setFocusedKey(node.key);
35
+ }
36
+ },
37
+ "aria-label": isExpanded ? stringFormatter.format("collapse") : stringFormatter.format("expand"),
38
+ tabIndex: (0, $ho3NY$isAndroid)() ? -1 : null,
39
+ "data-react-aria-prevent-focus": true
40
+ };
41
+ // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
42
+ return {
43
+ ...gridListAria,
44
+ expandButtonProps: expandButtonProps
45
+ };
46
+ }
47
+
48
+
49
+ export {$0cbbe9a595ac1615$export$8001083cb3f61028 as useTreeGridListItem};
50
+ //# sourceMappingURL=useTreeGridListItem.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAkCM,SAAS,0CAAuB,KAAkC,EAAE,KAAmB,EAAE,GAAgC;IAC9H,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,eAAe,CAAA,GAAA,sBAAc,EAAE,OAAO,OAAO;IACjD,IAAI,aAAa,aAAa,QAAQ,CAAC,gBAAgB,KAAK;IAC5D,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,IAAI,oBAAoB;QACtB,SAAS;YACP,IAAI,CAAC,aAAa,UAAU,EAAE;gBAC5B,MAAM,SAAS,CAAC,KAAK,GAAG;gBACxB,MAAM,gBAAgB,CAAC,UAAU,CAAC;gBAClC,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,GAAG;YAC/C;QACF;QACA,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,UAAU,CAAA,GAAA,gBAAQ,MAAM,KAAK;QAC7B,iCAAiC;IACnC;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeGridListItem.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';\nimport {DOMAttributes, FocusableElement, Node} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid} from '@react-aria/utils';\nimport {RefObject} from 'react';\nimport {TreeState} from '@react-stately/tree';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeGridListItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {\n /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */\n node: Node<unknown>\n}\n\nexport interface TreeGridListItemAria extends GridListItemAria {\n /** Props for the tree grid row element. */\n rowProps: DOMAttributes,\n /** Props for the tree grid cell element within the tree grid list row. */\n gridCellProps: DOMAttributes,\n /** Props for the tree grid row description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the tree grid row expand button. */\n expandButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a row in a tree grid list.\n * @param props - Props for the row.\n * @param state - State of the parent list, as returned by `useTreeState`.\n * @param ref - The ref attached to the row element.\n */\nexport function useTreeGridListItem<T>(props: AriaTreeGridListItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement>): TreeGridListItemAria {\n let {node} = props;\n let gridListAria = useGridListItem(props, state, ref);\n let isExpanded = gridListAria.rowProps['aria-expanded'] === true;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');\n\n let expandButtonProps = {\n onPress: () => {\n if (!gridListAria.isDisabled) {\n state.toggleKey(node.key);\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(node.key);\n }\n },\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n tabIndex: isAndroid() ? -1 : null,\n 'data-react-aria-prevent-focus': true\n };\n\n // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?\n return {\n ...gridListAria,\n expandButtonProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeGridListItem.module.js.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "expand": `Expand`,
3
+ "collapse": `Collapse`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-CN.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,UAAU,CAAC,MAAM,CAAC;IACpC,YAAY,CAAC,QAAQ,CAAC;AACxB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"expand\": \"Expand\",\n \"collapse\": \"Collapse\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
package/dist/zh-CN.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $bca1931646cb2236$exports = {};
2
+ $bca1931646cb2236$exports = {
3
+ "expand": `Expand`,
4
+ "collapse": `Collapse`
5
+ };
6
+
7
+
8
+ export {$bca1931646cb2236$exports as default};
9
+ //# sourceMappingURL=zh-CN.mjs.map
@@ -0,0 +1,9 @@
1
+ var $bca1931646cb2236$exports = {};
2
+ $bca1931646cb2236$exports = {
3
+ "expand": `Expand`,
4
+ "collapse": `Collapse`
5
+ };
6
+
7
+
8
+ export {$bca1931646cb2236$exports as default};
9
+ //# sourceMappingURL=zh-CN.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,UAAU,CAAC,MAAM,CAAC;IACpC,YAAY,CAAC,QAAQ,CAAC;AACxB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"expand\": \"Expand\",\n \"collapse\": \"Collapse\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "expand": `Expand`,
3
+ "collapse": `Collapse`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-TW.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,UAAU,CAAC,MAAM,CAAC;IACpC,YAAY,CAAC,QAAQ,CAAC;AACxB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"expand\": \"Expand\",\n \"collapse\": \"Collapse\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
package/dist/zh-TW.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $35be4b468e070ce1$exports = {};
2
+ $35be4b468e070ce1$exports = {
3
+ "expand": `Expand`,
4
+ "collapse": `Collapse`
5
+ };
6
+
7
+
8
+ export {$35be4b468e070ce1$exports as default};
9
+ //# sourceMappingURL=zh-TW.mjs.map
@@ -0,0 +1,9 @@
1
+ var $35be4b468e070ce1$exports = {};
2
+ $35be4b468e070ce1$exports = {
3
+ "expand": `Expand`,
4
+ "collapse": `Collapse`
5
+ };
6
+
7
+
8
+ export {$35be4b468e070ce1$exports as default};
9
+ //# sourceMappingURL=zh-TW.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,UAAU,CAAC,MAAM,CAAC;IACpC,YAAY,CAAC,QAAQ,CAAC;AACxB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"expand\": \"Expand\",\n \"collapse\": \"Collapse\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@react-aria/tree",
3
+ "version": "3.0.0-alpha.0",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
13
+ "types": "dist/types.d.ts",
14
+ "source": "src/index.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": false,
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/adobe/react-spectrum"
23
+ },
24
+ "dependencies": {
25
+ "@react-aria/gridlist": "^3.8.0",
26
+ "@react-aria/i18n": "^3.11.0",
27
+ "@react-aria/selection": "^3.18.0",
28
+ "@react-aria/utils": "^3.24.0",
29
+ "@react-stately/tree": "^3.8.0",
30
+ "@react-types/button": "^3.9.3",
31
+ "@react-types/shared": "^3.23.0",
32
+ "@swc/helpers": "^0.5.0"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
36
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
42
+ }
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ export {useTree} from './useTree';
14
+ export {useTreeGridList} from './useTreeGridList';
15
+ export {useTreeGridListItem} from './useTreeGridListItem';
16
+
17
+ export type {AriaTreeGridListOptions, AriaTreeGridListProps, TreeGridListAria, TreeGridListProps} from './useTreeGridList';
18
+ export type {AriaTreeGridListItemOptions, TreeGridListItemAria} from './useTreeGridListItem';
package/src/useTree.ts ADDED
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ export function useTree() {
14
+ return {};
15
+ }
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {AriaGridListOptions, AriaGridListProps, GridListProps, useGridList} from '@react-aria/gridlist';
14
+ import {
15
+ DOMAttributes,
16
+ KeyboardDelegate
17
+ } from '@react-types/shared';
18
+ import {RefObject} from 'react';
19
+ import {TreeState} from '@react-stately/tree';
20
+
21
+ export interface TreeGridListProps<T> extends GridListProps<T> {}
22
+
23
+ export interface AriaTreeGridListProps<T> extends AriaGridListProps<T> {}
24
+ export interface AriaTreeGridListOptions<T> extends Omit<AriaGridListOptions<T>, 'children' | 'isVirtualized' | 'shouldFocusWrap'> {
25
+ /**
26
+ * An optional keyboard delegate implementation for type to select,
27
+ * to override the default.
28
+ */
29
+ keyboardDelegate?: KeyboardDelegate
30
+ }
31
+
32
+ export interface TreeGridListAria {
33
+ /** Props for the treegrid element. */
34
+ gridProps: DOMAttributes
35
+ }
36
+
37
+ /**
38
+ * Provides the behavior and accessibility implementation for a single column treegrid component with interactive children.
39
+ * A tree grid provides users with a way to navigate nested hierarchical information.
40
+ * @param props - Props for the treegrid.
41
+ * @param state - State for the treegrid, as returned by `useTreeState`.
42
+ * @param ref - The ref attached to the treegrid element.
43
+ */
44
+ export function useTreeGridList<T>(props: AriaTreeGridListOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): TreeGridListAria {
45
+ let {gridProps} = useGridList(props, state, ref);
46
+ gridProps.role = 'treegrid';
47
+
48
+ return {
49
+ gridProps
50
+ };
51
+ }
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {AriaButtonProps} from '@react-types/button';
14
+ import {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';
15
+ import {DOMAttributes, FocusableElement, Node} from '@react-types/shared';
16
+ // @ts-ignore
17
+ import intlMessages from '../intl/*.json';
18
+ import {isAndroid} from '@react-aria/utils';
19
+ import {RefObject} from 'react';
20
+ import {TreeState} from '@react-stately/tree';
21
+ import {useLocalizedStringFormatter} from '@react-aria/i18n';
22
+
23
+ export interface AriaTreeGridListItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {
24
+ /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */
25
+ node: Node<unknown>
26
+ }
27
+
28
+ export interface TreeGridListItemAria extends GridListItemAria {
29
+ /** Props for the tree grid row element. */
30
+ rowProps: DOMAttributes,
31
+ /** Props for the tree grid cell element within the tree grid list row. */
32
+ gridCellProps: DOMAttributes,
33
+ /** Props for the tree grid row description element, if any. */
34
+ descriptionProps: DOMAttributes,
35
+ /** Props for the tree grid row expand button. */
36
+ expandButtonProps: AriaButtonProps
37
+ }
38
+
39
+ /**
40
+ * Provides the behavior and accessibility implementation for a row in a tree grid list.
41
+ * @param props - Props for the row.
42
+ * @param state - State of the parent list, as returned by `useTreeState`.
43
+ * @param ref - The ref attached to the row element.
44
+ */
45
+ export function useTreeGridListItem<T>(props: AriaTreeGridListItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement>): TreeGridListItemAria {
46
+ let {node} = props;
47
+ let gridListAria = useGridListItem(props, state, ref);
48
+ let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
49
+ let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');
50
+
51
+ let expandButtonProps = {
52
+ onPress: () => {
53
+ if (!gridListAria.isDisabled) {
54
+ state.toggleKey(node.key);
55
+ state.selectionManager.setFocused(true);
56
+ state.selectionManager.setFocusedKey(node.key);
57
+ }
58
+ },
59
+ 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
60
+ tabIndex: isAndroid() ? -1 : null,
61
+ 'data-react-aria-prevent-focus': true
62
+ };
63
+
64
+ // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
65
+ return {
66
+ ...gridListAria,
67
+ expandButtonProps
68
+ };
69
+ }