@react-aria/table 3.17.11 → 3.18.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 (239) hide show
  1. package/dist/import.mjs +2 -19
  2. package/dist/main.js +10 -27
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -19
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +4 -0
  7. package/package.json +15 -25
  8. package/src/index.ts +4 -21
  9. package/dist/TableKeyboardDelegate.main.js +0 -142
  10. package/dist/TableKeyboardDelegate.main.js.map +0 -1
  11. package/dist/TableKeyboardDelegate.mjs +0 -137
  12. package/dist/TableKeyboardDelegate.module.js +0 -137
  13. package/dist/TableKeyboardDelegate.module.js.map +0 -1
  14. package/dist/ar-AE.main.js +0 -14
  15. package/dist/ar-AE.main.js.map +0 -1
  16. package/dist/ar-AE.mjs +0 -16
  17. package/dist/ar-AE.module.js +0 -16
  18. package/dist/ar-AE.module.js.map +0 -1
  19. package/dist/bg-BG.main.js +0 -14
  20. package/dist/bg-BG.main.js.map +0 -1
  21. package/dist/bg-BG.mjs +0 -16
  22. package/dist/bg-BG.module.js +0 -16
  23. package/dist/bg-BG.module.js.map +0 -1
  24. package/dist/cs-CZ.main.js +0 -14
  25. package/dist/cs-CZ.main.js.map +0 -1
  26. package/dist/cs-CZ.mjs +0 -16
  27. package/dist/cs-CZ.module.js +0 -16
  28. package/dist/cs-CZ.module.js.map +0 -1
  29. package/dist/da-DK.main.js +0 -14
  30. package/dist/da-DK.main.js.map +0 -1
  31. package/dist/da-DK.mjs +0 -16
  32. package/dist/da-DK.module.js +0 -16
  33. package/dist/da-DK.module.js.map +0 -1
  34. package/dist/de-DE.main.js +0 -14
  35. package/dist/de-DE.main.js.map +0 -1
  36. package/dist/de-DE.mjs +0 -16
  37. package/dist/de-DE.module.js +0 -16
  38. package/dist/de-DE.module.js.map +0 -1
  39. package/dist/el-GR.main.js +0 -14
  40. package/dist/el-GR.main.js.map +0 -1
  41. package/dist/el-GR.mjs +0 -16
  42. package/dist/el-GR.module.js +0 -16
  43. package/dist/el-GR.module.js.map +0 -1
  44. package/dist/en-US.main.js +0 -14
  45. package/dist/en-US.main.js.map +0 -1
  46. package/dist/en-US.mjs +0 -16
  47. package/dist/en-US.module.js +0 -16
  48. package/dist/en-US.module.js.map +0 -1
  49. package/dist/es-ES.main.js +0 -14
  50. package/dist/es-ES.main.js.map +0 -1
  51. package/dist/es-ES.mjs +0 -16
  52. package/dist/es-ES.module.js +0 -16
  53. package/dist/es-ES.module.js.map +0 -1
  54. package/dist/et-EE.main.js +0 -14
  55. package/dist/et-EE.main.js.map +0 -1
  56. package/dist/et-EE.mjs +0 -16
  57. package/dist/et-EE.module.js +0 -16
  58. package/dist/et-EE.module.js.map +0 -1
  59. package/dist/fi-FI.main.js +0 -14
  60. package/dist/fi-FI.main.js.map +0 -1
  61. package/dist/fi-FI.mjs +0 -16
  62. package/dist/fi-FI.module.js +0 -16
  63. package/dist/fi-FI.module.js.map +0 -1
  64. package/dist/fr-FR.main.js +0 -14
  65. package/dist/fr-FR.main.js.map +0 -1
  66. package/dist/fr-FR.mjs +0 -16
  67. package/dist/fr-FR.module.js +0 -16
  68. package/dist/fr-FR.module.js.map +0 -1
  69. package/dist/he-IL.main.js +0 -14
  70. package/dist/he-IL.main.js.map +0 -1
  71. package/dist/he-IL.mjs +0 -16
  72. package/dist/he-IL.module.js +0 -16
  73. package/dist/he-IL.module.js.map +0 -1
  74. package/dist/hr-HR.main.js +0 -14
  75. package/dist/hr-HR.main.js.map +0 -1
  76. package/dist/hr-HR.mjs +0 -16
  77. package/dist/hr-HR.module.js +0 -16
  78. package/dist/hr-HR.module.js.map +0 -1
  79. package/dist/hu-HU.main.js +0 -14
  80. package/dist/hu-HU.main.js.map +0 -1
  81. package/dist/hu-HU.mjs +0 -16
  82. package/dist/hu-HU.module.js +0 -16
  83. package/dist/hu-HU.module.js.map +0 -1
  84. package/dist/intlStrings.main.js +0 -108
  85. package/dist/intlStrings.main.js.map +0 -1
  86. package/dist/intlStrings.mjs +0 -110
  87. package/dist/intlStrings.module.js +0 -110
  88. package/dist/intlStrings.module.js.map +0 -1
  89. package/dist/it-IT.main.js +0 -14
  90. package/dist/it-IT.main.js.map +0 -1
  91. package/dist/it-IT.mjs +0 -16
  92. package/dist/it-IT.module.js +0 -16
  93. package/dist/it-IT.module.js.map +0 -1
  94. package/dist/ja-JP.main.js +0 -14
  95. package/dist/ja-JP.main.js.map +0 -1
  96. package/dist/ja-JP.mjs +0 -16
  97. package/dist/ja-JP.module.js +0 -16
  98. package/dist/ja-JP.module.js.map +0 -1
  99. package/dist/ko-KR.main.js +0 -14
  100. package/dist/ko-KR.main.js.map +0 -1
  101. package/dist/ko-KR.mjs +0 -16
  102. package/dist/ko-KR.module.js +0 -16
  103. package/dist/ko-KR.module.js.map +0 -1
  104. package/dist/lt-LT.main.js +0 -14
  105. package/dist/lt-LT.main.js.map +0 -1
  106. package/dist/lt-LT.mjs +0 -16
  107. package/dist/lt-LT.module.js +0 -16
  108. package/dist/lt-LT.module.js.map +0 -1
  109. package/dist/lv-LV.main.js +0 -14
  110. package/dist/lv-LV.main.js.map +0 -1
  111. package/dist/lv-LV.mjs +0 -16
  112. package/dist/lv-LV.module.js +0 -16
  113. package/dist/lv-LV.module.js.map +0 -1
  114. package/dist/nb-NO.main.js +0 -14
  115. package/dist/nb-NO.main.js.map +0 -1
  116. package/dist/nb-NO.mjs +0 -16
  117. package/dist/nb-NO.module.js +0 -16
  118. package/dist/nb-NO.module.js.map +0 -1
  119. package/dist/nl-NL.main.js +0 -14
  120. package/dist/nl-NL.main.js.map +0 -1
  121. package/dist/nl-NL.mjs +0 -16
  122. package/dist/nl-NL.module.js +0 -16
  123. package/dist/nl-NL.module.js.map +0 -1
  124. package/dist/pl-PL.main.js +0 -14
  125. package/dist/pl-PL.main.js.map +0 -1
  126. package/dist/pl-PL.mjs +0 -16
  127. package/dist/pl-PL.module.js +0 -16
  128. package/dist/pl-PL.module.js.map +0 -1
  129. package/dist/pt-BR.main.js +0 -14
  130. package/dist/pt-BR.main.js.map +0 -1
  131. package/dist/pt-BR.mjs +0 -16
  132. package/dist/pt-BR.module.js +0 -16
  133. package/dist/pt-BR.module.js.map +0 -1
  134. package/dist/pt-PT.main.js +0 -14
  135. package/dist/pt-PT.main.js.map +0 -1
  136. package/dist/pt-PT.mjs +0 -16
  137. package/dist/pt-PT.module.js +0 -16
  138. package/dist/pt-PT.module.js.map +0 -1
  139. package/dist/ro-RO.main.js +0 -14
  140. package/dist/ro-RO.main.js.map +0 -1
  141. package/dist/ro-RO.mjs +0 -16
  142. package/dist/ro-RO.module.js +0 -16
  143. package/dist/ro-RO.module.js.map +0 -1
  144. package/dist/ru-RU.main.js +0 -14
  145. package/dist/ru-RU.main.js.map +0 -1
  146. package/dist/ru-RU.mjs +0 -16
  147. package/dist/ru-RU.module.js +0 -16
  148. package/dist/ru-RU.module.js.map +0 -1
  149. package/dist/sk-SK.main.js +0 -14
  150. package/dist/sk-SK.main.js.map +0 -1
  151. package/dist/sk-SK.mjs +0 -16
  152. package/dist/sk-SK.module.js +0 -16
  153. package/dist/sk-SK.module.js.map +0 -1
  154. package/dist/sl-SI.main.js +0 -14
  155. package/dist/sl-SI.main.js.map +0 -1
  156. package/dist/sl-SI.mjs +0 -16
  157. package/dist/sl-SI.module.js +0 -16
  158. package/dist/sl-SI.module.js.map +0 -1
  159. package/dist/sr-SP.main.js +0 -14
  160. package/dist/sr-SP.main.js.map +0 -1
  161. package/dist/sr-SP.mjs +0 -16
  162. package/dist/sr-SP.module.js +0 -16
  163. package/dist/sr-SP.module.js.map +0 -1
  164. package/dist/sv-SE.main.js +0 -14
  165. package/dist/sv-SE.main.js.map +0 -1
  166. package/dist/sv-SE.mjs +0 -16
  167. package/dist/sv-SE.module.js +0 -16
  168. package/dist/sv-SE.module.js.map +0 -1
  169. package/dist/tr-TR.main.js +0 -14
  170. package/dist/tr-TR.main.js.map +0 -1
  171. package/dist/tr-TR.mjs +0 -16
  172. package/dist/tr-TR.module.js +0 -16
  173. package/dist/tr-TR.module.js.map +0 -1
  174. package/dist/types.d.ts +0 -157
  175. package/dist/types.d.ts.map +0 -1
  176. package/dist/uk-UA.main.js +0 -14
  177. package/dist/uk-UA.main.js.map +0 -1
  178. package/dist/uk-UA.mjs +0 -16
  179. package/dist/uk-UA.module.js +0 -16
  180. package/dist/uk-UA.module.js.map +0 -1
  181. package/dist/useTable.main.js +0 -114
  182. package/dist/useTable.main.js.map +0 -1
  183. package/dist/useTable.mjs +0 -109
  184. package/dist/useTable.module.js +0 -109
  185. package/dist/useTable.module.js.map +0 -1
  186. package/dist/useTableCell.main.js +0 -37
  187. package/dist/useTableCell.main.js.map +0 -1
  188. package/dist/useTableCell.mjs +0 -32
  189. package/dist/useTableCell.module.js +0 -32
  190. package/dist/useTableCell.module.js.map +0 -1
  191. package/dist/useTableColumnHeader.main.js +0 -92
  192. package/dist/useTableColumnHeader.main.js.map +0 -1
  193. package/dist/useTableColumnHeader.mjs +0 -87
  194. package/dist/useTableColumnHeader.module.js +0 -87
  195. package/dist/useTableColumnHeader.module.js.map +0 -1
  196. package/dist/useTableColumnResize.main.js +0 -226
  197. package/dist/useTableColumnResize.main.js.map +0 -1
  198. package/dist/useTableColumnResize.mjs +0 -221
  199. package/dist/useTableColumnResize.module.js +0 -221
  200. package/dist/useTableColumnResize.module.js.map +0 -1
  201. package/dist/useTableHeaderRow.main.js +0 -32
  202. package/dist/useTableHeaderRow.main.js.map +0 -1
  203. package/dist/useTableHeaderRow.mjs +0 -27
  204. package/dist/useTableHeaderRow.module.js +0 -27
  205. package/dist/useTableHeaderRow.module.js.map +0 -1
  206. package/dist/useTableRow.main.js +0 -82
  207. package/dist/useTableRow.main.js.map +0 -1
  208. package/dist/useTableRow.mjs +0 -77
  209. package/dist/useTableRow.module.js +0 -77
  210. package/dist/useTableRow.module.js.map +0 -1
  211. package/dist/useTableSelectionCheckbox.main.js +0 -56
  212. package/dist/useTableSelectionCheckbox.main.js.map +0 -1
  213. package/dist/useTableSelectionCheckbox.mjs +0 -50
  214. package/dist/useTableSelectionCheckbox.module.js +0 -50
  215. package/dist/useTableSelectionCheckbox.module.js.map +0 -1
  216. package/dist/utils.main.js +0 -43
  217. package/dist/utils.main.js.map +0 -1
  218. package/dist/utils.mjs +0 -35
  219. package/dist/utils.module.js +0 -35
  220. package/dist/utils.module.js.map +0 -1
  221. package/dist/zh-CN.main.js +0 -14
  222. package/dist/zh-CN.main.js.map +0 -1
  223. package/dist/zh-CN.mjs +0 -16
  224. package/dist/zh-CN.module.js +0 -16
  225. package/dist/zh-CN.module.js.map +0 -1
  226. package/dist/zh-TW.main.js +0 -14
  227. package/dist/zh-TW.main.js.map +0 -1
  228. package/dist/zh-TW.mjs +0 -16
  229. package/dist/zh-TW.module.js +0 -16
  230. package/dist/zh-TW.module.js.map +0 -1
  231. package/src/TableKeyboardDelegate.ts +0 -214
  232. package/src/useTable.ts +0 -123
  233. package/src/useTableCell.ts +0 -59
  234. package/src/useTableColumnHeader.ts +0 -108
  235. package/src/useTableColumnResize.ts +0 -277
  236. package/src/useTableHeaderRow.ts +0 -42
  237. package/src/useTableRow.ts +0 -86
  238. package/src/useTableSelectionCheckbox.ts +0 -72
  239. package/src/utils.ts +0 -49
@@ -1,221 +0,0 @@
1
- import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./utils.module.js";
2
- import $d9Rqy$intlStringsmodulejs from "./intlStrings.module.js";
3
- import {useRef as $d9Rqy$useRef, useCallback as $d9Rqy$useCallback, useEffect as $d9Rqy$useEffect} from "react";
4
- import {focusSafely as $d9Rqy$focusSafely, useKeyboard as $d9Rqy$useKeyboard, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
5
- import {useId as $d9Rqy$useId, useDescription as $d9Rqy$useDescription, useEffectEvent as $d9Rqy$useEffectEvent, getActiveElement as $d9Rqy$getActiveElement, getEventTarget as $d9Rqy$getEventTarget, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
6
- import {useLocalizedStringFormatter as $d9Rqy$useLocalizedStringFormatter, useLocale as $d9Rqy$useLocale} from "@react-aria/i18n";
7
- import {useVisuallyHidden as $d9Rqy$useVisuallyHidden} from "@react-aria/visually-hidden";
8
-
9
-
10
- function $parcel$interopDefault(a) {
11
- return a && a.__esModule ? a.default : a;
12
- }
13
- /*
14
- * Copyright 2020 Adobe. All rights reserved.
15
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License. You may obtain a copy
17
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software distributed under
20
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
- * OF ANY KIND, either express or implied. See the License for the specific language
22
- * governing permissions and limitations under the License.
23
- */
24
-
25
-
26
-
27
-
28
-
29
-
30
- function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
31
- let { column: item, triggerRef: triggerRef, isDisabled: isDisabled, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, 'aria-label': ariaLabel } = props;
32
- const stringFormatter = (0, $d9Rqy$useLocalizedStringFormatter)((0, ($parcel$interopDefault($d9Rqy$intlStringsmodulejs))), '@react-aria/table');
33
- let id = (0, $d9Rqy$useId)();
34
- let isResizing = state.resizingColumn === item.key;
35
- let isResizingRef = (0, $d9Rqy$useRef)(isResizing);
36
- let lastSize = (0, $d9Rqy$useRef)(null);
37
- let wasFocusedOnResizeStart = (0, $d9Rqy$useRef)(false);
38
- let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
39
- let { direction: direction } = (0, $d9Rqy$useLocale)();
40
- let startResize = (0, $d9Rqy$useCallback)((item)=>{
41
- if (!isResizingRef.current) {
42
- lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
43
- state.startResize(item.key);
44
- state.tableState.setKeyboardNavigationDisabled(true);
45
- onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(lastSize.current);
46
- }
47
- isResizingRef.current = true;
48
- }, [
49
- state,
50
- onResizeStart
51
- ]);
52
- let resize = (0, $d9Rqy$useCallback)((item, newWidth)=>{
53
- let sizes = state.updateResizedColumns(item.key, newWidth);
54
- onResize === null || onResize === void 0 ? void 0 : onResize(sizes);
55
- lastSize.current = sizes;
56
- }, [
57
- state,
58
- onResize
59
- ]);
60
- let endResize = (0, $d9Rqy$useCallback)((item)=>{
61
- if (isResizingRef.current) {
62
- if (lastSize.current == null) lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
63
- state.endResize();
64
- state.tableState.setKeyboardNavigationDisabled(false);
65
- onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd(lastSize.current);
66
- isResizingRef.current = false;
67
- if ((triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) && !wasFocusedOnResizeStart.current) // switch focus back to the column header unless the resizer was already focused when resizing started.
68
- (0, $d9Rqy$focusSafely)(triggerRef.current);
69
- }
70
- lastSize.current = null;
71
- }, [
72
- state,
73
- triggerRef,
74
- onResizeEnd
75
- ]);
76
- let { keyboardProps: keyboardProps } = (0, $d9Rqy$useKeyboard)({
77
- onKeyDown: (e)=>{
78
- if (editModeEnabled) {
79
- if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
80
- e.preventDefault();
81
- endResize(item);
82
- }
83
- } else {
84
- // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
85
- e.continuePropagation();
86
- if (e.key === 'Enter') startResize(item);
87
- }
88
- }
89
- });
90
- const columnResizeWidthRef = (0, $d9Rqy$useRef)(0);
91
- const { moveProps: moveProps } = (0, $d9Rqy$useMove)({
92
- onMoveStart () {
93
- columnResizeWidthRef.current = state.getColumnWidth(item.key);
94
- startResize(item);
95
- },
96
- onMove (e) {
97
- let { deltaX: deltaX, deltaY: deltaY, pointerType: pointerType } = e;
98
- if (direction === 'rtl') deltaX *= -1;
99
- if (pointerType === 'keyboard') {
100
- if (deltaY !== 0 && deltaX === 0) deltaX = deltaY * -1;
101
- deltaX *= 10;
102
- }
103
- // if moving up/down only, no need to resize
104
- if (deltaX !== 0) {
105
- columnResizeWidthRef.current += deltaX;
106
- resize(item, columnResizeWidthRef.current);
107
- }
108
- },
109
- onMoveEnd (e) {
110
- let { pointerType: pointerType } = e;
111
- columnResizeWidthRef.current = 0;
112
- if (pointerType === 'mouse' || pointerType === 'touch' && wasFocusedOnResizeStart.current) endResize(item);
113
- }
114
- });
115
- let onKeyDown = (0, $d9Rqy$useCallback)((e)=>{
116
- var _moveProps_onKeyDown;
117
- if (editModeEnabled) (_moveProps_onKeyDown = moveProps.onKeyDown) === null || _moveProps_onKeyDown === void 0 ? void 0 : _moveProps_onKeyDown.call(moveProps, e);
118
- }, [
119
- editModeEnabled,
120
- moveProps
121
- ]);
122
- let min = Math.floor(state.getColumnMinWidth(item.key));
123
- let max = Math.floor(state.getColumnMaxWidth(item.key));
124
- if (max === Infinity) max = Number.MAX_SAFE_INTEGER;
125
- let value = Math.floor(state.getColumnWidth(item.key));
126
- let modality = (0, $d9Rqy$useInteractionModality)();
127
- if (modality === 'virtual' && typeof window !== 'undefined' && 'ontouchstart' in window) modality = 'touch';
128
- let description = (triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;
129
- let descriptionProps = (0, $d9Rqy$useDescription)(description);
130
- let ariaProps = {
131
- 'aria-label': ariaLabel,
132
- 'aria-orientation': 'horizontal',
133
- 'aria-labelledby': `${id} ${(0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state.tableState, item.key)}`,
134
- 'aria-valuetext': stringFormatter.format('columnSize', {
135
- value: value
136
- }),
137
- 'type': 'range',
138
- min: min,
139
- max: max,
140
- value: value,
141
- ...descriptionProps
142
- };
143
- const focusInput = (0, $d9Rqy$useCallback)(()=>{
144
- if (ref.current) (0, $d9Rqy$focusSafely)(ref.current);
145
- }, [
146
- ref
147
- ]);
148
- let resizingColumn = state.resizingColumn;
149
- let prevResizingColumn = (0, $d9Rqy$useRef)(null);
150
- let startResizeEvent = (0, $d9Rqy$useEffectEvent)(startResize);
151
- (0, $d9Rqy$useEffect)(()=>{
152
- if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
153
- wasFocusedOnResizeStart.current = (0, $d9Rqy$getActiveElement)() === ref.current;
154
- startResizeEvent(item);
155
- // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
156
- let timeout = setTimeout(()=>focusInput(), 0);
157
- // VoiceOver on iOS has problems focusing the input from a menu.
158
- let VOTimeout = setTimeout(focusInput, 400);
159
- return ()=>{
160
- clearTimeout(timeout);
161
- clearTimeout(VOTimeout);
162
- };
163
- }
164
- prevResizingColumn.current = resizingColumn;
165
- }, [
166
- resizingColumn,
167
- item,
168
- focusInput,
169
- ref
170
- ]);
171
- let onChange = (e)=>{
172
- let currentWidth = state.getColumnWidth(item.key);
173
- let nextValue = parseFloat((0, $d9Rqy$getEventTarget)(e).value);
174
- if (nextValue > currentWidth) nextValue = currentWidth + 10;
175
- else nextValue = currentWidth - 10;
176
- resize(item, nextValue);
177
- };
178
- let { pressProps: pressProps } = (0, $d9Rqy$usePress)({
179
- preventFocusOnPress: true,
180
- onPressStart: (e)=>{
181
- if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') return;
182
- if (e.pointerType === 'virtual' && state.resizingColumn != null) {
183
- endResize(item);
184
- return;
185
- }
186
- // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away
187
- // can cancel resize mode for us.
188
- focusInput();
189
- // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need
190
- // to handle a virtual click to start the resizer.
191
- if (e.pointerType !== 'virtual') startResize(item);
192
- },
193
- onPress: (e)=>{
194
- if ((e.pointerType === 'touch' && wasFocusedOnResizeStart.current || e.pointerType === 'mouse') && state.resizingColumn != null) endResize(item);
195
- }
196
- });
197
- let { visuallyHiddenProps: visuallyHiddenProps } = (0, $d9Rqy$useVisuallyHidden)();
198
- return {
199
- resizerProps: (0, $d9Rqy$mergeProps)(keyboardProps, {
200
- ...moveProps,
201
- onKeyDown: onKeyDown
202
- }, pressProps, {
203
- style: {
204
- touchAction: 'none'
205
- }
206
- }),
207
- inputProps: (0, $d9Rqy$mergeProps)(visuallyHiddenProps, {
208
- id: id,
209
- onBlur: ()=>{
210
- endResize(item);
211
- },
212
- onChange: onChange,
213
- disabled: isDisabled
214
- }, ariaProps),
215
- isResizing: isResizing
216
- };
217
- }
218
-
219
-
220
- export {$e91ef4e5004e3774$export$52994e973806c219 as useTableColumnResize};
221
- //# sourceMappingURL=useTableColumnResize.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc,SAAS,EAAC,GAAG;IAC5G,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAClE,IAAI,KAAK,CAAA,GAAA,YAAI;IACb,IAAI,aAAa,MAAM,cAAc,KAAK,KAAK,GAAG;IAClD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,WAAW,CAAA,GAAA,aAAK,EAA+B;IACnD,IAAI,0BAA0B,CAAA,GAAA,aAAK,EAAE;IACrC,IAAI,kBAAkB,MAAM,UAAU,CAAC,4BAA4B;IAEnE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA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;QAAM;QAAY;KAAI;IAE1C,IAAI,WAAW,CAAC;QACd,IAAI,eAAe,MAAM,cAAc,CAAC,KAAK,GAAG;QAChD,IAAI,YAAY,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,KAAK;QAElD,IAAI,YAAY,cACd,YAAY,eAAe;aAE3B,YAAY,eAAe;QAE7B,OAAO,MAAM;IACf;IAEA,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,qBAAqB;QACrB,cAAc,CAAC;YACb,IAAI,EAAE,OAAO,IAAI,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,QAAQ,IAAI,EAAE,WAAW,KAAK,YACxE;YAEF,IAAI,EAAE,WAAW,KAAK,aAAa,MAAM,cAAc,IAAI,MAAM;gBAC/D,UAAU;gBACV;YACF;YAEA,0GAA0G;YAC1G,iCAAiC;YACjC;YAEA,gIAAgI;YAChI,kDAAkD;YAClD,IAAI,EAAE,WAAW,KAAK,WACpB,YAAY;QAEhB;QACA,SAAS,CAAC;YACR,IAAI,AAAC,CAAA,AAAC,EAAE,WAAW,KAAK,WAAW,wBAAwB,OAAO,IAAK,EAAE,WAAW,KAAK,OAAM,KAAM,MAAM,cAAc,IAAI,MAC3H,UAAU;QAEd;IACF;IACA,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,OAAO;QACL,cAAc,CAAA,GAAA,iBAAS,EACrB,eACA;YAAC,GAAG,SAAS;uBAAE;QAAS,GACxB,YACA;YAAC,OAAO;gBAAC,aAAa;YAAM;QAAC;QAE/B,YAAY,CAAA,GAAA,iBAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.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\nimport {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely, useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {getActiveElement, getEventTarget, mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n\n let startResize = useCallback((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n }, [state, onResizeStart]);\n\n let resize = useCallback((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n }, [state, onResize]);\n\n let endResize = useCallback((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n }, [state, triggerRef, onResizeEnd]);\n\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n let startResizeEvent = useEffectEvent(startResize);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = getActiveElement() === ref.current;\n startResizeEvent(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(getEventTarget(e).value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n preventFocusOnPress: true,\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.module.js.map"}
@@ -1,32 +0,0 @@
1
- var $dwJMn$reactstatelyflags = require("@react-stately/flags");
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, "useTableHeaderRow", () => $eb16c38321a72835$export$1b95a7d2d517b841);
9
- /*
10
- * Copyright 2020 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 $eb16c38321a72835$export$1b95a7d2d517b841(props, state, ref) {
21
- let { node: node, isVirtualized: isVirtualized } = props;
22
- let rowProps = {
23
- role: 'row'
24
- };
25
- if (isVirtualized && !((0, $dwJMn$reactstatelyflags.tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1; // aria-rowindex is 1 based
26
- return {
27
- rowProps: rowProps
28
- };
29
- }
30
-
31
-
32
- //# sourceMappingURL=useTableHeaderRow.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAkBM,SAAS,0CAAqB,KAAsB,EAAE,KAAoB,EAAE,GAA8B;IAC/G,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,WAAW;QACb,MAAM;IACR;IAEA,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,wCAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,GAAG,2BAA2B;IAGzE,OAAO;kBACL;IACF;AACF","sources":["packages/@react-aria/table/src/useTableHeaderRow.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\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {GridRowProps} from '@react-aria/grid';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState} from '@react-stately/table';\n\nexport interface TableHeaderRowAria {\n /** Props for the grid row element. */\n rowProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a header row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function useTableHeaderRow<T>(props: GridRowProps<T>, state: TableState<T>, ref: RefObject<Element | null>): TableHeaderRowAria {\n let {node, isVirtualized} = props;\n let rowProps = {\n role: 'row'\n };\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1; // aria-rowindex is 1 based\n }\n\n return {\n rowProps\n };\n}\n"],"names":[],"version":3,"file":"useTableHeaderRow.main.js.map"}
@@ -1,27 +0,0 @@
1
- import {tableNestedRows as $4ns2c$tableNestedRows} from "@react-stately/flags";
2
-
3
- /*
4
- * Copyright 2020 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 $f917ee10f4c32dab$export$1b95a7d2d517b841(props, state, ref) {
15
- let { node: node, isVirtualized: isVirtualized } = props;
16
- let rowProps = {
17
- role: 'row'
18
- };
19
- if (isVirtualized && !((0, $4ns2c$tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1; // aria-rowindex is 1 based
20
- return {
21
- rowProps: rowProps
22
- };
23
- }
24
-
25
-
26
- export {$f917ee10f4c32dab$export$1b95a7d2d517b841 as useTableHeaderRow};
27
- //# sourceMappingURL=useTableHeaderRow.module.js.map
@@ -1,27 +0,0 @@
1
- import {tableNestedRows as $4ns2c$tableNestedRows} from "@react-stately/flags";
2
-
3
- /*
4
- * Copyright 2020 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 $f917ee10f4c32dab$export$1b95a7d2d517b841(props, state, ref) {
15
- let { node: node, isVirtualized: isVirtualized } = props;
16
- let rowProps = {
17
- role: 'row'
18
- };
19
- if (isVirtualized && !((0, $4ns2c$tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1; // aria-rowindex is 1 based
20
- return {
21
- rowProps: rowProps
22
- };
23
- }
24
-
25
-
26
- export {$f917ee10f4c32dab$export$1b95a7d2d517b841 as useTableHeaderRow};
27
- //# sourceMappingURL=useTableHeaderRow.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAkBM,SAAS,0CAAqB,KAAsB,EAAE,KAAoB,EAAE,GAA8B;IAC/G,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,WAAW;QACb,MAAM;IACR;IAEA,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,sBAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,GAAG,2BAA2B;IAGzE,OAAO;kBACL;IACF;AACF","sources":["packages/@react-aria/table/src/useTableHeaderRow.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\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {GridRowProps} from '@react-aria/grid';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState} from '@react-stately/table';\n\nexport interface TableHeaderRowAria {\n /** Props for the grid row element. */\n rowProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a header row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function useTableHeaderRow<T>(props: GridRowProps<T>, state: TableState<T>, ref: RefObject<Element | null>): TableHeaderRowAria {\n let {node, isVirtualized} = props;\n let rowProps = {\n role: 'row'\n };\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1; // aria-rowindex is 1 based\n }\n\n return {\n rowProps\n };\n}\n"],"names":[],"version":3,"file":"useTableHeaderRow.module.js.map"}
@@ -1,82 +0,0 @@
1
- var $6acf696f746f932c$exports = require("./utils.main.js");
2
- var $6RVcf$reactstatelycollections = require("@react-stately/collections");
3
- var $6RVcf$reactariagrid = require("@react-aria/grid");
4
- var $6RVcf$reactariautils = require("@react-aria/utils");
5
- var $6RVcf$reactstatelyflags = require("@react-stately/flags");
6
- var $6RVcf$reactariai18n = require("@react-aria/i18n");
7
-
8
-
9
- function $parcel$export(e, n, v, s) {
10
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
11
- }
12
-
13
- $parcel$export(module.exports, "useTableRow", () => $10b2115217af7c93$export$7f2f6ae19e707aa5);
14
- /*
15
- * Copyright 2020 Adobe. All rights reserved.
16
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
- * you may not use this file except in compliance with the License. You may obtain a copy
18
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
- *
20
- * Unless required by applicable law or agreed to in writing, software distributed under
21
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
- * OF ANY KIND, either express or implied. See the License for the specific language
23
- * governing permissions and limitations under the License.
24
- */
25
-
26
-
27
-
28
-
29
-
30
- const $10b2115217af7c93$var$EXPANSION_KEYS = {
31
- expand: {
32
- ltr: 'ArrowRight',
33
- rtl: 'ArrowLeft'
34
- },
35
- 'collapse': {
36
- ltr: 'ArrowLeft',
37
- rtl: 'ArrowRight'
38
- }
39
- };
40
- function $10b2115217af7c93$export$7f2f6ae19e707aa5(props, state, ref) {
41
- let { node: node, isVirtualized: isVirtualized } = props;
42
- let { rowProps: rowProps, ...states } = (0, $6RVcf$reactariagrid.useGridRow)(props, state, ref);
43
- let { direction: direction } = (0, $6RVcf$reactariai18n.useLocale)();
44
- if (isVirtualized && !((0, $6RVcf$reactstatelyflags.tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
45
- else delete rowProps['aria-rowindex'];
46
- let treeGridRowProps = {};
47
- if ((0, $6RVcf$reactstatelyflags.tableNestedRows)() && 'expandedKeys' in state) {
48
- let treeNode = state.keyMap.get(node.key);
49
- if (treeNode != null) {
50
- var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
51
- let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
52
- var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
53
- treeGridRowProps = {
54
- onKeyDown: (e)=>{
55
- if (e.key === $10b2115217af7c93$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
56
- state.toggleKey(treeNode.key);
57
- e.stopPropagation();
58
- } else if (e.key === $10b2115217af7c93$var$EXPANSION_KEYS['collapse'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {
59
- state.toggleKey(treeNode.key);
60
- e.stopPropagation();
61
- }
62
- },
63
- 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
64
- 'aria-level': treeNode.level,
65
- 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
66
- 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $6RVcf$reactstatelycollections.getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $6RVcf$reactstatelycollections.getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
67
- };
68
- }
69
- }
70
- let syntheticLinkProps = (0, $6RVcf$reactariautils.useSyntheticLinkProps)(node.props);
71
- let linkProps = states.hasAction ? syntheticLinkProps : {};
72
- return {
73
- rowProps: {
74
- ...(0, $6RVcf$reactariautils.mergeProps)(rowProps, treeGridRowProps, linkProps),
75
- 'aria-labelledby': (0, $6acf696f746f932c$exports.getRowLabelledBy)(state, node.key)
76
- },
77
- ...states
78
- };
79
- }
80
-
81
-
82
- //# sourceMappingURL=useTableRow.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAuC;IACrI,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,+BAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,G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eAAe;oBACnB;gBACF;gBACA,iBAAiB,eAAe,MAAM,YAAY,KAAK,SAAS,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI;gBACnG,cAAc,SAAS,KAAK;gBAC5B,iBAAiB,AAAC,CAAA,CAAA,wBAAA,SAAS,WAAW,cAApB,mCAAA,wBAAwB,CAAA,IAAK;gBAC/C,gBAAgB,SAAS,KAAK,GAAG,IAC/B,AAAC,CAAA,CAAA,4BAAC,eAAA,CAAA,GAAA,0CAAU,EAAE,CAAA,gCAAA,oBAAA,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,SAAS,eAAnC,wCAAA,kBAAuC,UAAU,cAAjD,0CAAA,+BAAqD,EAAE,eAAnE,mCAAD,AAAC,aAAsF,WAAW,cAAlG,sCAAA,2BAAsG,CAAA,IAAK,IAC5G,AAAC,CAAA,CAAA,6BAAC,gBAAA,CAAA,GAAA,0CAAU,EAAE,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,eAA5C,oCAAD,AAAC,cAA+D,WAAW,cAA3E,uCAAA,4BAA+E,CAAA,IAAK;YACzF;QACF;IACF;IAEA,IAAI,qBAAqB,CAAA,GAAA,2CAAoB,EAAE,KAAK,KAAK;IACzD,IAAI,YAAY,OAAO,SAAS,GAAG,qBAAqB,CAAC;IACzD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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\nimport {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': (treeNode.indexOfType ?? 0) + 1,\n 'aria-setsize': treeNode.level > 1 ?\n ((getLastItem(state.keyMap.get(treeNode.parentKey!)?.childNodes ?? []) as GridNode<T>)?.indexOfType ?? 0) + 1 :\n ((getLastItem(state.collection.body.childNodes) as GridNode<T>)?.indexOfType ?? 0) + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.main.js.map"}
@@ -1,77 +0,0 @@
1
- import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.mjs";
2
- import {getLastItem as $2K6sg$getLastItem} from "@react-stately/collections";
3
- import {useGridRow as $2K6sg$useGridRow} from "@react-aria/grid";
4
- import {useSyntheticLinkProps as $2K6sg$useSyntheticLinkProps, mergeProps as $2K6sg$mergeProps} from "@react-aria/utils";
5
- import {tableNestedRows as $2K6sg$tableNestedRows} from "@react-stately/flags";
6
- import {useLocale as $2K6sg$useLocale} from "@react-aria/i18n";
7
-
8
- /*
9
- * Copyright 2020 Adobe. All rights reserved.
10
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License. You may obtain a copy
12
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software distributed under
15
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
- * OF ANY KIND, either express or implied. See the License for the specific language
17
- * governing permissions and limitations under the License.
18
- */
19
-
20
-
21
-
22
-
23
-
24
- const $b2db214c022798eb$var$EXPANSION_KEYS = {
25
- expand: {
26
- ltr: 'ArrowRight',
27
- rtl: 'ArrowLeft'
28
- },
29
- 'collapse': {
30
- ltr: 'ArrowLeft',
31
- rtl: 'ArrowRight'
32
- }
33
- };
34
- function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
35
- let { node: node, isVirtualized: isVirtualized } = props;
36
- let { rowProps: rowProps, ...states } = (0, $2K6sg$useGridRow)(props, state, ref);
37
- let { direction: direction } = (0, $2K6sg$useLocale)();
38
- if (isVirtualized && !((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
39
- else delete rowProps['aria-rowindex'];
40
- let treeGridRowProps = {};
41
- if ((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state) {
42
- let treeNode = state.keyMap.get(node.key);
43
- if (treeNode != null) {
44
- var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
45
- let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
46
- var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
47
- treeGridRowProps = {
48
- onKeyDown: (e)=>{
49
- if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
50
- state.toggleKey(treeNode.key);
51
- e.stopPropagation();
52
- } else if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['collapse'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {
53
- state.toggleKey(treeNode.key);
54
- e.stopPropagation();
55
- }
56
- },
57
- 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
58
- 'aria-level': treeNode.level,
59
- 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
60
- 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $2K6sg$getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $2K6sg$getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
61
- };
62
- }
63
- }
64
- let syntheticLinkProps = (0, $2K6sg$useSyntheticLinkProps)(node.props);
65
- let linkProps = states.hasAction ? syntheticLinkProps : {};
66
- return {
67
- rowProps: {
68
- ...(0, $2K6sg$mergeProps)(rowProps, treeGridRowProps, linkProps),
69
- 'aria-labelledby': (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
70
- },
71
- ...states
72
- };
73
- }
74
-
75
-
76
- export {$b2db214c022798eb$export$7f2f6ae19e707aa5 as useTableRow};
77
- //# sourceMappingURL=useTableRow.module.js.map
@@ -1,77 +0,0 @@
1
- import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.module.js";
2
- import {getLastItem as $2K6sg$getLastItem} from "@react-stately/collections";
3
- import {useGridRow as $2K6sg$useGridRow} from "@react-aria/grid";
4
- import {useSyntheticLinkProps as $2K6sg$useSyntheticLinkProps, mergeProps as $2K6sg$mergeProps} from "@react-aria/utils";
5
- import {tableNestedRows as $2K6sg$tableNestedRows} from "@react-stately/flags";
6
- import {useLocale as $2K6sg$useLocale} from "@react-aria/i18n";
7
-
8
- /*
9
- * Copyright 2020 Adobe. All rights reserved.
10
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License. You may obtain a copy
12
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software distributed under
15
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
- * OF ANY KIND, either express or implied. See the License for the specific language
17
- * governing permissions and limitations under the License.
18
- */
19
-
20
-
21
-
22
-
23
-
24
- const $b2db214c022798eb$var$EXPANSION_KEYS = {
25
- expand: {
26
- ltr: 'ArrowRight',
27
- rtl: 'ArrowLeft'
28
- },
29
- 'collapse': {
30
- ltr: 'ArrowLeft',
31
- rtl: 'ArrowRight'
32
- }
33
- };
34
- function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
35
- let { node: node, isVirtualized: isVirtualized } = props;
36
- let { rowProps: rowProps, ...states } = (0, $2K6sg$useGridRow)(props, state, ref);
37
- let { direction: direction } = (0, $2K6sg$useLocale)();
38
- if (isVirtualized && !((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state)) rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
39
- else delete rowProps['aria-rowindex'];
40
- let treeGridRowProps = {};
41
- if ((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state) {
42
- let treeNode = state.keyMap.get(node.key);
43
- if (treeNode != null) {
44
- var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
45
- let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
46
- var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
47
- treeGridRowProps = {
48
- onKeyDown: (e)=>{
49
- if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
50
- state.toggleKey(treeNode.key);
51
- e.stopPropagation();
52
- } else if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['collapse'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {
53
- state.toggleKey(treeNode.key);
54
- e.stopPropagation();
55
- }
56
- },
57
- 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
58
- 'aria-level': treeNode.level,
59
- 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
60
- 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $2K6sg$getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $2K6sg$getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
61
- };
62
- }
63
- }
64
- let syntheticLinkProps = (0, $2K6sg$useSyntheticLinkProps)(node.props);
65
- let linkProps = states.hasAction ? syntheticLinkProps : {};
66
- return {
67
- rowProps: {
68
- ...(0, $2K6sg$mergeProps)(rowProps, treeGridRowProps, linkProps),
69
- 'aria-labelledby': (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
70
- },
71
- ...states
72
- };
73
- }
74
-
75
-
76
- export {$b2db214c022798eb$export$7f2f6ae19e707aa5 as useTableRow};
77
- //# sourceMappingURL=useTableRow.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAuC;IACrI,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,iBAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAE1B,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,sBAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,2BAA2B;SAE5G,OAAO,QAAQ,CAAC,gBAAgB;IA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,gBAAgB,SAAS,KAAK,GAAG,IAC/B,AAAC,CAAA,CAAA,4BAAC,eAAA,CAAA,GAAA,kBAAU,EAAE,CAAA,gCAAA,oBAAA,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,SAAS,eAAnC,wCAAA,kBAAuC,UAAU,cAAjD,0CAAA,+BAAqD,EAAE,eAAnE,mCAAD,AAAC,aAAsF,WAAW,cAAlG,sCAAA,2BAAsG,CAAA,IAAK,IAC5G,AAAC,CAAA,CAAA,6BAAC,gBAAA,CAAA,GAAA,kBAAU,EAAE,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,eAA5C,oCAAD,AAAC,cAA+D,WAAW,cAA3E,uCAAA,4BAA+E,CAAA,IAAK;YACzF;QACF;IACF;IAEA,IAAI,qBAAqB,CAAA,GAAA,4BAAoB,EAAE,KAAK,KAAK;IACzD,IAAI,YAAY,OAAO,SAAS,GAAG,qBAAqB,CAAC;IACzD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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\nimport {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': (treeNode.indexOfType ?? 0) + 1,\n 'aria-setsize': treeNode.level > 1 ?\n ((getLastItem(state.keyMap.get(treeNode.parentKey!)?.childNodes ?? []) as GridNode<T>)?.indexOfType ?? 0) + 1 :\n ((getLastItem(state.collection.body.childNodes) as GridNode<T>)?.indexOfType ?? 0) + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.module.js.map"}