@react-aria/tree 3.1.6 → 3.2.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 (197) hide show
  1. package/dist/import.mjs +2 -4
  2. package/dist/main.js +3 -5
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -4
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +4 -0
  7. package/package.json +15 -18
  8. package/src/index.ts +4 -4
  9. package/dist/ar-AE.main.js +0 -7
  10. package/dist/ar-AE.main.js.map +0 -1
  11. package/dist/ar-AE.mjs +0 -9
  12. package/dist/ar-AE.module.js +0 -9
  13. package/dist/ar-AE.module.js.map +0 -1
  14. package/dist/bg-BG.main.js +0 -7
  15. package/dist/bg-BG.main.js.map +0 -1
  16. package/dist/bg-BG.mjs +0 -9
  17. package/dist/bg-BG.module.js +0 -9
  18. package/dist/bg-BG.module.js.map +0 -1
  19. package/dist/cs-CZ.main.js +0 -7
  20. package/dist/cs-CZ.main.js.map +0 -1
  21. package/dist/cs-CZ.mjs +0 -9
  22. package/dist/cs-CZ.module.js +0 -9
  23. package/dist/cs-CZ.module.js.map +0 -1
  24. package/dist/da-DK.main.js +0 -7
  25. package/dist/da-DK.main.js.map +0 -1
  26. package/dist/da-DK.mjs +0 -9
  27. package/dist/da-DK.module.js +0 -9
  28. package/dist/da-DK.module.js.map +0 -1
  29. package/dist/de-DE.main.js +0 -7
  30. package/dist/de-DE.main.js.map +0 -1
  31. package/dist/de-DE.mjs +0 -9
  32. package/dist/de-DE.module.js +0 -9
  33. package/dist/de-DE.module.js.map +0 -1
  34. package/dist/el-GR.main.js +0 -7
  35. package/dist/el-GR.main.js.map +0 -1
  36. package/dist/el-GR.mjs +0 -9
  37. package/dist/el-GR.module.js +0 -9
  38. package/dist/el-GR.module.js.map +0 -1
  39. package/dist/en-US.main.js +0 -7
  40. package/dist/en-US.main.js.map +0 -1
  41. package/dist/en-US.mjs +0 -9
  42. package/dist/en-US.module.js +0 -9
  43. package/dist/en-US.module.js.map +0 -1
  44. package/dist/es-ES.main.js +0 -7
  45. package/dist/es-ES.main.js.map +0 -1
  46. package/dist/es-ES.mjs +0 -9
  47. package/dist/es-ES.module.js +0 -9
  48. package/dist/es-ES.module.js.map +0 -1
  49. package/dist/et-EE.main.js +0 -7
  50. package/dist/et-EE.main.js.map +0 -1
  51. package/dist/et-EE.mjs +0 -9
  52. package/dist/et-EE.module.js +0 -9
  53. package/dist/et-EE.module.js.map +0 -1
  54. package/dist/fi-FI.main.js +0 -7
  55. package/dist/fi-FI.main.js.map +0 -1
  56. package/dist/fi-FI.mjs +0 -9
  57. package/dist/fi-FI.module.js +0 -9
  58. package/dist/fi-FI.module.js.map +0 -1
  59. package/dist/fr-FR.main.js +0 -7
  60. package/dist/fr-FR.main.js.map +0 -1
  61. package/dist/fr-FR.mjs +0 -9
  62. package/dist/fr-FR.module.js +0 -9
  63. package/dist/fr-FR.module.js.map +0 -1
  64. package/dist/he-IL.main.js +0 -7
  65. package/dist/he-IL.main.js.map +0 -1
  66. package/dist/he-IL.mjs +0 -9
  67. package/dist/he-IL.module.js +0 -9
  68. package/dist/he-IL.module.js.map +0 -1
  69. package/dist/hr-HR.main.js +0 -7
  70. package/dist/hr-HR.main.js.map +0 -1
  71. package/dist/hr-HR.mjs +0 -9
  72. package/dist/hr-HR.module.js +0 -9
  73. package/dist/hr-HR.module.js.map +0 -1
  74. package/dist/hu-HU.main.js +0 -7
  75. package/dist/hu-HU.main.js.map +0 -1
  76. package/dist/hu-HU.mjs +0 -9
  77. package/dist/hu-HU.module.js +0 -9
  78. package/dist/hu-HU.module.js.map +0 -1
  79. package/dist/intlStrings.main.js +0 -108
  80. package/dist/intlStrings.main.js.map +0 -1
  81. package/dist/intlStrings.mjs +0 -110
  82. package/dist/intlStrings.module.js +0 -110
  83. package/dist/intlStrings.module.js.map +0 -1
  84. package/dist/it-IT.main.js +0 -7
  85. package/dist/it-IT.main.js.map +0 -1
  86. package/dist/it-IT.mjs +0 -9
  87. package/dist/it-IT.module.js +0 -9
  88. package/dist/it-IT.module.js.map +0 -1
  89. package/dist/ja-JP.main.js +0 -7
  90. package/dist/ja-JP.main.js.map +0 -1
  91. package/dist/ja-JP.mjs +0 -9
  92. package/dist/ja-JP.module.js +0 -9
  93. package/dist/ja-JP.module.js.map +0 -1
  94. package/dist/ko-KR.main.js +0 -7
  95. package/dist/ko-KR.main.js.map +0 -1
  96. package/dist/ko-KR.mjs +0 -9
  97. package/dist/ko-KR.module.js +0 -9
  98. package/dist/ko-KR.module.js.map +0 -1
  99. package/dist/lt-LT.main.js +0 -7
  100. package/dist/lt-LT.main.js.map +0 -1
  101. package/dist/lt-LT.mjs +0 -9
  102. package/dist/lt-LT.module.js +0 -9
  103. package/dist/lt-LT.module.js.map +0 -1
  104. package/dist/lv-LV.main.js +0 -7
  105. package/dist/lv-LV.main.js.map +0 -1
  106. package/dist/lv-LV.mjs +0 -9
  107. package/dist/lv-LV.module.js +0 -9
  108. package/dist/lv-LV.module.js.map +0 -1
  109. package/dist/nb-NO.main.js +0 -7
  110. package/dist/nb-NO.main.js.map +0 -1
  111. package/dist/nb-NO.mjs +0 -9
  112. package/dist/nb-NO.module.js +0 -9
  113. package/dist/nb-NO.module.js.map +0 -1
  114. package/dist/nl-NL.main.js +0 -7
  115. package/dist/nl-NL.main.js.map +0 -1
  116. package/dist/nl-NL.mjs +0 -9
  117. package/dist/nl-NL.module.js +0 -9
  118. package/dist/nl-NL.module.js.map +0 -1
  119. package/dist/pl-PL.main.js +0 -7
  120. package/dist/pl-PL.main.js.map +0 -1
  121. package/dist/pl-PL.mjs +0 -9
  122. package/dist/pl-PL.module.js +0 -9
  123. package/dist/pl-PL.module.js.map +0 -1
  124. package/dist/pt-BR.main.js +0 -7
  125. package/dist/pt-BR.main.js.map +0 -1
  126. package/dist/pt-BR.mjs +0 -9
  127. package/dist/pt-BR.module.js +0 -9
  128. package/dist/pt-BR.module.js.map +0 -1
  129. package/dist/pt-PT.main.js +0 -7
  130. package/dist/pt-PT.main.js.map +0 -1
  131. package/dist/pt-PT.mjs +0 -9
  132. package/dist/pt-PT.module.js +0 -9
  133. package/dist/pt-PT.module.js.map +0 -1
  134. package/dist/ro-RO.main.js +0 -7
  135. package/dist/ro-RO.main.js.map +0 -1
  136. package/dist/ro-RO.mjs +0 -9
  137. package/dist/ro-RO.module.js +0 -9
  138. package/dist/ro-RO.module.js.map +0 -1
  139. package/dist/ru-RU.main.js +0 -7
  140. package/dist/ru-RU.main.js.map +0 -1
  141. package/dist/ru-RU.mjs +0 -9
  142. package/dist/ru-RU.module.js +0 -9
  143. package/dist/ru-RU.module.js.map +0 -1
  144. package/dist/sk-SK.main.js +0 -7
  145. package/dist/sk-SK.main.js.map +0 -1
  146. package/dist/sk-SK.mjs +0 -9
  147. package/dist/sk-SK.module.js +0 -9
  148. package/dist/sk-SK.module.js.map +0 -1
  149. package/dist/sl-SI.main.js +0 -7
  150. package/dist/sl-SI.main.js.map +0 -1
  151. package/dist/sl-SI.mjs +0 -9
  152. package/dist/sl-SI.module.js +0 -9
  153. package/dist/sl-SI.module.js.map +0 -1
  154. package/dist/sr-SP.main.js +0 -7
  155. package/dist/sr-SP.main.js.map +0 -1
  156. package/dist/sr-SP.mjs +0 -9
  157. package/dist/sr-SP.module.js +0 -9
  158. package/dist/sr-SP.module.js.map +0 -1
  159. package/dist/sv-SE.main.js +0 -7
  160. package/dist/sv-SE.main.js.map +0 -1
  161. package/dist/sv-SE.mjs +0 -9
  162. package/dist/sv-SE.module.js +0 -9
  163. package/dist/sv-SE.module.js.map +0 -1
  164. package/dist/tr-TR.main.js +0 -7
  165. package/dist/tr-TR.main.js.map +0 -1
  166. package/dist/tr-TR.mjs +0 -9
  167. package/dist/tr-TR.module.js +0 -9
  168. package/dist/tr-TR.module.js.map +0 -1
  169. package/dist/types.d.ts +0 -50
  170. package/dist/types.d.ts.map +0 -1
  171. package/dist/uk-UA.main.js +0 -7
  172. package/dist/uk-UA.main.js.map +0 -1
  173. package/dist/uk-UA.mjs +0 -9
  174. package/dist/uk-UA.module.js +0 -9
  175. package/dist/uk-UA.module.js.map +0 -1
  176. package/dist/useTree.main.js +0 -29
  177. package/dist/useTree.main.js.map +0 -1
  178. package/dist/useTree.mjs +0 -24
  179. package/dist/useTree.module.js +0 -24
  180. package/dist/useTree.module.js.map +0 -1
  181. package/dist/useTreeItem.main.js +0 -60
  182. package/dist/useTreeItem.main.js.map +0 -1
  183. package/dist/useTreeItem.mjs +0 -55
  184. package/dist/useTreeItem.module.js +0 -55
  185. package/dist/useTreeItem.module.js.map +0 -1
  186. package/dist/zh-CN.main.js +0 -7
  187. package/dist/zh-CN.main.js.map +0 -1
  188. package/dist/zh-CN.mjs +0 -9
  189. package/dist/zh-CN.module.js +0 -9
  190. package/dist/zh-CN.module.js.map +0 -1
  191. package/dist/zh-TW.main.js +0 -7
  192. package/dist/zh-TW.main.js.map +0 -1
  193. package/dist/zh-TW.mjs +0 -9
  194. package/dist/zh-TW.module.js +0 -9
  195. package/dist/zh-TW.module.js.map +0 -1
  196. package/src/useTree.ts +0 -51
  197. package/src/useTreeItem.ts +0 -73
@@ -1,60 +0,0 @@
1
- var $6fc07bed32f3daee$exports = require("./intlStrings.main.js");
2
- var $cDrlP$reactariagridlist = require("@react-aria/gridlist");
3
- var $cDrlP$reactariautils = require("@react-aria/utils");
4
- var $cDrlP$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, "useTreeItem", () => $739d43f6fe8a5583$export$e4bcc4675b2b123a);
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 $739d43f6fe8a5583$export$e4bcc4675b2b123a(props, state, ref) {
31
- let { node: node } = props;
32
- let gridListAria = (0, $cDrlP$reactariagridlist.useGridListItem)(props, state, ref);
33
- let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
34
- let stringFormatter = (0, $cDrlP$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($6fc07bed32f3daee$exports))), '@react-aria/tree');
35
- let labelProps = (0, $cDrlP$reactariautils.useLabels)({
36
- 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
37
- 'aria-labelledby': gridListAria.rowProps.id
38
- });
39
- let expandButtonProps = {
40
- onPress: ()=>{
41
- if (!gridListAria.isDisabled) {
42
- state.toggleKey(node.key);
43
- state.selectionManager.setFocused(true);
44
- state.selectionManager.setFocusedKey(node.key);
45
- }
46
- },
47
- excludeFromTabOrder: true,
48
- preventFocusOnPress: true,
49
- 'data-react-aria-prevent-focus': true,
50
- ...labelProps
51
- };
52
- // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
53
- return {
54
- ...gridListAria,
55
- expandButtonProps: expandButtonProps
56
- };
57
- }
58
-
59
-
60
- //# sourceMappingURL=useTreeItem.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAe,KAA0B,EAAE,KAAmB,EAAE,GAAuC;IACrH,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;IAChE,IAAI,aAAa,CAAA,GAAA,+BAAQ,EAAE;QACzB,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,mBAAmB,aAAa,QAAQ,CAAC,EAAE;IAC7C;IAEA,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,qBAAqB;QACrB,qBAAqB;QACrB,iCAAiC;QACjC,GAAG,UAAU;IACf;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeItem.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, RefObject} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TreeState} from '@react-stately/tree';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeItemOptions 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 TreeItemAria 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 useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {\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 let labelProps = useLabels({\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n 'aria-labelledby': gridListAria.rowProps.id\n });\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 excludeFromTabOrder: true,\n preventFocusOnPress: true,\n 'data-react-aria-prevent-focus': true,\n ...labelProps\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":"useTreeItem.main.js.map"}
@@ -1,55 +0,0 @@
1
- import $f4zHe$intlStringsmodulejs from "./intlStrings.mjs";
2
- import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
3
- import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
4
- import {useLocalizedStringFormatter as $f4zHe$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 $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
25
- let { node: node } = props;
26
- let gridListAria = (0, $f4zHe$useGridListItem)(props, state, ref);
27
- let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
28
- let stringFormatter = (0, $f4zHe$useLocalizedStringFormatter)((0, ($parcel$interopDefault($f4zHe$intlStringsmodulejs))), '@react-aria/tree');
29
- let labelProps = (0, $f4zHe$useLabels)({
30
- 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
31
- 'aria-labelledby': gridListAria.rowProps.id
32
- });
33
- let expandButtonProps = {
34
- onPress: ()=>{
35
- if (!gridListAria.isDisabled) {
36
- state.toggleKey(node.key);
37
- state.selectionManager.setFocused(true);
38
- state.selectionManager.setFocusedKey(node.key);
39
- }
40
- },
41
- excludeFromTabOrder: true,
42
- preventFocusOnPress: true,
43
- 'data-react-aria-prevent-focus': true,
44
- ...labelProps
45
- };
46
- // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
47
- return {
48
- ...gridListAria,
49
- expandButtonProps: expandButtonProps
50
- };
51
- }
52
-
53
-
54
- export {$b41e0bc5ca49db3d$export$e4bcc4675b2b123a as useTreeItem};
55
- //# sourceMappingURL=useTreeItem.module.js.map
@@ -1,55 +0,0 @@
1
- import $f4zHe$intlStringsmodulejs from "./intlStrings.module.js";
2
- import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
3
- import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
4
- import {useLocalizedStringFormatter as $f4zHe$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 $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
25
- let { node: node } = props;
26
- let gridListAria = (0, $f4zHe$useGridListItem)(props, state, ref);
27
- let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
28
- let stringFormatter = (0, $f4zHe$useLocalizedStringFormatter)((0, ($parcel$interopDefault($f4zHe$intlStringsmodulejs))), '@react-aria/tree');
29
- let labelProps = (0, $f4zHe$useLabels)({
30
- 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
31
- 'aria-labelledby': gridListAria.rowProps.id
32
- });
33
- let expandButtonProps = {
34
- onPress: ()=>{
35
- if (!gridListAria.isDisabled) {
36
- state.toggleKey(node.key);
37
- state.selectionManager.setFocused(true);
38
- state.selectionManager.setFocusedKey(node.key);
39
- }
40
- },
41
- excludeFromTabOrder: true,
42
- preventFocusOnPress: true,
43
- 'data-react-aria-prevent-focus': true,
44
- ...labelProps
45
- };
46
- // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
47
- return {
48
- ...gridListAria,
49
- expandButtonProps: expandButtonProps
50
- };
51
- }
52
-
53
-
54
- export {$b41e0bc5ca49db3d$export$e4bcc4675b2b123a as useTreeItem};
55
- //# sourceMappingURL=useTreeItem.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAe,KAA0B,EAAE,KAAmB,EAAE,GAAuC;IACrH,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;IAChE,IAAI,aAAa,CAAA,GAAA,gBAAQ,EAAE;QACzB,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,mBAAmB,aAAa,QAAQ,CAAC,EAAE;IAC7C;IAEA,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,qBAAqB;QACrB,qBAAqB;QACrB,iCAAiC;QACjC,GAAG,UAAU;IACf;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeItem.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, RefObject} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TreeState} from '@react-stately/tree';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeItemOptions 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 TreeItemAria 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 useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {\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 let labelProps = useLabels({\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n 'aria-labelledby': gridListAria.rowProps.id\n });\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 excludeFromTabOrder: true,\n preventFocusOnPress: true,\n 'data-react-aria-prevent-focus': true,\n ...labelProps\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":"useTreeItem.module.js.map"}
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- "collapse": `\u{6298}\u{53E0}`,
3
- "expand": `\u{6269}\u{5C55}`
4
- };
5
-
6
-
7
- //# sourceMappingURL=zh-CN.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"collapse\": \"折叠\",\n \"expand\": \"扩展\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
package/dist/zh-CN.mjs DELETED
@@ -1,9 +0,0 @@
1
- var $bca1931646cb2236$exports = {};
2
- $bca1931646cb2236$exports = {
3
- "collapse": `\u{6298}\u{53E0}`,
4
- "expand": `\u{6269}\u{5C55}`
5
- };
6
-
7
-
8
- export {$bca1931646cb2236$exports as default};
9
- //# sourceMappingURL=zh-CN.module.js.map
@@ -1,9 +0,0 @@
1
- var $bca1931646cb2236$exports = {};
2
- $bca1931646cb2236$exports = {
3
- "collapse": `\u{6298}\u{53E0}`,
4
- "expand": `\u{6269}\u{5C55}`
5
- };
6
-
7
-
8
- export {$bca1931646cb2236$exports as default};
9
- //# sourceMappingURL=zh-CN.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";AAAA,4BAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"collapse\": \"折叠\",\n \"expand\": \"扩展\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- "collapse": `\u{6536}\u{5408}`,
3
- "expand": `\u{5C55}\u{958B}`
4
- };
5
-
6
-
7
- //# sourceMappingURL=zh-TW.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"collapse\": \"收合\",\n \"expand\": \"展開\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
package/dist/zh-TW.mjs DELETED
@@ -1,9 +0,0 @@
1
- var $35be4b468e070ce1$exports = {};
2
- $35be4b468e070ce1$exports = {
3
- "collapse": `\u{6536}\u{5408}`,
4
- "expand": `\u{5C55}\u{958B}`
5
- };
6
-
7
-
8
- export {$35be4b468e070ce1$exports as default};
9
- //# sourceMappingURL=zh-TW.module.js.map
@@ -1,9 +0,0 @@
1
- var $35be4b468e070ce1$exports = {};
2
- $35be4b468e070ce1$exports = {
3
- "collapse": `\u{6536}\u{5408}`,
4
- "expand": `\u{5C55}\u{958B}`
5
- };
6
-
7
-
8
- export {$35be4b468e070ce1$exports as default};
9
- //# sourceMappingURL=zh-TW.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";AAAA,4BAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"collapse\": \"收合\",\n \"expand\": \"展開\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
package/src/useTree.ts DELETED
@@ -1,51 +0,0 @@
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
- RefObject
18
- } from '@react-types/shared';
19
- import {TreeState} from '@react-stately/tree';
20
-
21
- export interface TreeProps<T> extends GridListProps<T> {}
22
-
23
- export interface AriaTreeProps<T> extends Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'> {}
24
- export interface AriaTreeOptions<T> extends Omit<AriaGridListOptions<T>, 'children' | '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 TreeAria {
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 useTree<T>(props: AriaTreeOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement | null>): TreeAria {
45
- let {gridProps} = useGridList(props, state, ref);
46
- gridProps.role = 'treegrid';
47
-
48
- return {
49
- gridProps
50
- };
51
- }
@@ -1,73 +0,0 @@
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, RefObject} from '@react-types/shared';
16
- // @ts-ignore
17
- import intlMessages from '../intl/*.json';
18
- import {TreeState} from '@react-stately/tree';
19
- import {useLabels} from '@react-aria/utils';
20
- import {useLocalizedStringFormatter} from '@react-aria/i18n';
21
-
22
- export interface AriaTreeItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {
23
- /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */
24
- node: Node<unknown>
25
- }
26
-
27
- export interface TreeItemAria extends GridListItemAria {
28
- /** Props for the tree grid row element. */
29
- rowProps: DOMAttributes,
30
- /** Props for the tree grid cell element within the tree grid list row. */
31
- gridCellProps: DOMAttributes,
32
- /** Props for the tree grid row description element, if any. */
33
- descriptionProps: DOMAttributes,
34
- /** Props for the tree grid row expand button. */
35
- expandButtonProps: AriaButtonProps
36
- }
37
-
38
- /**
39
- * Provides the behavior and accessibility implementation for a row in a tree grid list.
40
- * @param props - Props for the row.
41
- * @param state - State of the parent list, as returned by `useTreeState`.
42
- * @param ref - The ref attached to the row element.
43
- */
44
- export function useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {
45
- let {node} = props;
46
- let gridListAria = useGridListItem(props, state, ref);
47
- let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
48
- let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');
49
- let labelProps = useLabels({
50
- 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
51
- 'aria-labelledby': gridListAria.rowProps.id
52
- });
53
-
54
- let expandButtonProps = {
55
- onPress: () => {
56
- if (!gridListAria.isDisabled) {
57
- state.toggleKey(node.key);
58
- state.selectionManager.setFocused(true);
59
- state.selectionManager.setFocusedKey(node.key);
60
- }
61
- },
62
- excludeFromTabOrder: true,
63
- preventFocusOnPress: true,
64
- 'data-react-aria-prevent-focus': true,
65
- ...labelProps
66
- };
67
-
68
- // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
69
- return {
70
- ...gridListAria,
71
- expandButtonProps
72
- };
73
- }