@react-spectrum/list 3.0.0-beta.0 → 3.0.0-nightly-641446f65-240905

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 (230) hide show
  1. package/dist/DragPreview.main.js +79 -0
  2. package/dist/DragPreview.main.js.map +1 -0
  3. package/dist/DragPreview.mjs +74 -0
  4. package/dist/DragPreview.module.js +74 -0
  5. package/dist/DragPreview.module.js.map +1 -0
  6. package/dist/InsertionIndicator.main.js +49 -0
  7. package/dist/InsertionIndicator.main.js.map +1 -0
  8. package/dist/InsertionIndicator.mjs +44 -0
  9. package/dist/InsertionIndicator.module.js +44 -0
  10. package/dist/InsertionIndicator.module.js.map +1 -0
  11. package/dist/ListView.main.js +299 -0
  12. package/dist/ListView.main.js.map +1 -0
  13. package/dist/ListView.mjs +293 -0
  14. package/dist/ListView.module.js +293 -0
  15. package/dist/ListView.module.js.map +1 -0
  16. package/dist/ListViewItem.main.js +252 -0
  17. package/dist/ListViewItem.main.js.map +1 -0
  18. package/dist/ListViewItem.mjs +247 -0
  19. package/dist/ListViewItem.module.js +247 -0
  20. package/dist/ListViewItem.module.js.map +1 -0
  21. package/dist/ListViewLayout.main.js +69 -0
  22. package/dist/ListViewLayout.main.js.map +1 -0
  23. package/dist/ListViewLayout.mjs +64 -0
  24. package/dist/ListViewLayout.module.js +64 -0
  25. package/dist/ListViewLayout.module.js.map +1 -0
  26. package/dist/RootDropIndicator.main.js +46 -0
  27. package/dist/RootDropIndicator.main.js.map +1 -0
  28. package/dist/RootDropIndicator.mjs +37 -0
  29. package/dist/RootDropIndicator.module.js +37 -0
  30. package/dist/RootDropIndicator.module.js.map +1 -0
  31. package/dist/ar-AE.main.js +7 -0
  32. package/dist/ar-AE.main.js.map +1 -0
  33. package/dist/ar-AE.mjs +9 -0
  34. package/dist/ar-AE.module.js +9 -0
  35. package/dist/ar-AE.module.js.map +1 -0
  36. package/dist/bg-BG.main.js +7 -0
  37. package/dist/bg-BG.main.js.map +1 -0
  38. package/dist/bg-BG.mjs +9 -0
  39. package/dist/bg-BG.module.js +9 -0
  40. package/dist/bg-BG.module.js.map +1 -0
  41. package/dist/cs-CZ.main.js +7 -0
  42. package/dist/cs-CZ.main.js.map +1 -0
  43. package/dist/cs-CZ.mjs +9 -0
  44. package/dist/cs-CZ.module.js +9 -0
  45. package/dist/cs-CZ.module.js.map +1 -0
  46. package/dist/da-DK.main.js +7 -0
  47. package/dist/da-DK.main.js.map +1 -0
  48. package/dist/da-DK.mjs +9 -0
  49. package/dist/da-DK.module.js +9 -0
  50. package/dist/da-DK.module.js.map +1 -0
  51. package/dist/de-DE.main.js +7 -0
  52. package/dist/de-DE.main.js.map +1 -0
  53. package/dist/de-DE.mjs +9 -0
  54. package/dist/de-DE.module.js +9 -0
  55. package/dist/de-DE.module.js.map +1 -0
  56. package/dist/el-GR.main.js +7 -0
  57. package/dist/el-GR.main.js.map +1 -0
  58. package/dist/el-GR.mjs +9 -0
  59. package/dist/el-GR.module.js +9 -0
  60. package/dist/el-GR.module.js.map +1 -0
  61. package/dist/en-US.main.js +7 -0
  62. package/dist/en-US.main.js.map +1 -0
  63. package/dist/en-US.mjs +9 -0
  64. package/dist/en-US.module.js +9 -0
  65. package/dist/en-US.module.js.map +1 -0
  66. package/dist/es-ES.main.js +7 -0
  67. package/dist/es-ES.main.js.map +1 -0
  68. package/dist/es-ES.mjs +9 -0
  69. package/dist/es-ES.module.js +9 -0
  70. package/dist/es-ES.module.js.map +1 -0
  71. package/dist/et-EE.main.js +7 -0
  72. package/dist/et-EE.main.js.map +1 -0
  73. package/dist/et-EE.mjs +9 -0
  74. package/dist/et-EE.module.js +9 -0
  75. package/dist/et-EE.module.js.map +1 -0
  76. package/dist/fi-FI.main.js +7 -0
  77. package/dist/fi-FI.main.js.map +1 -0
  78. package/dist/fi-FI.mjs +9 -0
  79. package/dist/fi-FI.module.js +9 -0
  80. package/dist/fi-FI.module.js.map +1 -0
  81. package/dist/fr-FR.main.js +7 -0
  82. package/dist/fr-FR.main.js.map +1 -0
  83. package/dist/fr-FR.mjs +9 -0
  84. package/dist/fr-FR.module.js +9 -0
  85. package/dist/fr-FR.module.js.map +1 -0
  86. package/dist/he-IL.main.js +7 -0
  87. package/dist/he-IL.main.js.map +1 -0
  88. package/dist/he-IL.mjs +9 -0
  89. package/dist/he-IL.module.js +9 -0
  90. package/dist/he-IL.module.js.map +1 -0
  91. package/dist/hr-HR.main.js +7 -0
  92. package/dist/hr-HR.main.js.map +1 -0
  93. package/dist/hr-HR.mjs +9 -0
  94. package/dist/hr-HR.module.js +9 -0
  95. package/dist/hr-HR.module.js.map +1 -0
  96. package/dist/hu-HU.main.js +7 -0
  97. package/dist/hu-HU.main.js.map +1 -0
  98. package/dist/hu-HU.mjs +9 -0
  99. package/dist/hu-HU.module.js +9 -0
  100. package/dist/hu-HU.module.js.map +1 -0
  101. package/dist/import.mjs +19 -0
  102. package/dist/intlStrings.main.js +108 -0
  103. package/dist/intlStrings.main.js.map +1 -0
  104. package/dist/intlStrings.mjs +110 -0
  105. package/dist/intlStrings.module.js +110 -0
  106. package/dist/intlStrings.module.js.map +1 -0
  107. package/dist/it-IT.main.js +7 -0
  108. package/dist/it-IT.main.js.map +1 -0
  109. package/dist/it-IT.mjs +9 -0
  110. package/dist/it-IT.module.js +9 -0
  111. package/dist/it-IT.module.js.map +1 -0
  112. package/dist/ja-JP.main.js +7 -0
  113. package/dist/ja-JP.main.js.map +1 -0
  114. package/dist/ja-JP.mjs +9 -0
  115. package/dist/ja-JP.module.js +9 -0
  116. package/dist/ja-JP.module.js.map +1 -0
  117. package/dist/ko-KR.main.js +7 -0
  118. package/dist/ko-KR.main.js.map +1 -0
  119. package/dist/ko-KR.mjs +9 -0
  120. package/dist/ko-KR.module.js +9 -0
  121. package/dist/ko-KR.module.js.map +1 -0
  122. package/dist/lt-LT.main.js +7 -0
  123. package/dist/lt-LT.main.js.map +1 -0
  124. package/dist/lt-LT.mjs +9 -0
  125. package/dist/lt-LT.module.js +9 -0
  126. package/dist/lt-LT.module.js.map +1 -0
  127. package/dist/lv-LV.main.js +7 -0
  128. package/dist/lv-LV.main.js.map +1 -0
  129. package/dist/lv-LV.mjs +9 -0
  130. package/dist/lv-LV.module.js +9 -0
  131. package/dist/lv-LV.module.js.map +1 -0
  132. package/dist/main.js +14 -962
  133. package/dist/main.js.map +1 -1
  134. package/dist/module.js +12 -964
  135. package/dist/module.js.map +1 -1
  136. package/dist/nb-NO.main.js +7 -0
  137. package/dist/nb-NO.main.js.map +1 -0
  138. package/dist/nb-NO.mjs +9 -0
  139. package/dist/nb-NO.module.js +9 -0
  140. package/dist/nb-NO.module.js.map +1 -0
  141. package/dist/nl-NL.main.js +7 -0
  142. package/dist/nl-NL.main.js.map +1 -0
  143. package/dist/nl-NL.mjs +9 -0
  144. package/dist/nl-NL.module.js +9 -0
  145. package/dist/nl-NL.module.js.map +1 -0
  146. package/dist/pl-PL.main.js +7 -0
  147. package/dist/pl-PL.main.js.map +1 -0
  148. package/dist/pl-PL.mjs +9 -0
  149. package/dist/pl-PL.module.js +9 -0
  150. package/dist/pl-PL.module.js.map +1 -0
  151. package/dist/pt-BR.main.js +7 -0
  152. package/dist/pt-BR.main.js.map +1 -0
  153. package/dist/pt-BR.mjs +9 -0
  154. package/dist/pt-BR.module.js +9 -0
  155. package/dist/pt-BR.module.js.map +1 -0
  156. package/dist/pt-PT.main.js +7 -0
  157. package/dist/pt-PT.main.js.map +1 -0
  158. package/dist/pt-PT.mjs +9 -0
  159. package/dist/pt-PT.module.js +9 -0
  160. package/dist/pt-PT.module.js.map +1 -0
  161. package/dist/ro-RO.main.js +7 -0
  162. package/dist/ro-RO.main.js.map +1 -0
  163. package/dist/ro-RO.mjs +9 -0
  164. package/dist/ro-RO.module.js +9 -0
  165. package/dist/ro-RO.module.js.map +1 -0
  166. package/dist/ru-RU.main.js +7 -0
  167. package/dist/ru-RU.main.js.map +1 -0
  168. package/dist/ru-RU.mjs +9 -0
  169. package/dist/ru-RU.module.js +9 -0
  170. package/dist/ru-RU.module.js.map +1 -0
  171. package/dist/sk-SK.main.js +7 -0
  172. package/dist/sk-SK.main.js.map +1 -0
  173. package/dist/sk-SK.mjs +9 -0
  174. package/dist/sk-SK.module.js +9 -0
  175. package/dist/sk-SK.module.js.map +1 -0
  176. package/dist/sl-SI.main.js +7 -0
  177. package/dist/sl-SI.main.js.map +1 -0
  178. package/dist/sl-SI.mjs +9 -0
  179. package/dist/sl-SI.module.js +9 -0
  180. package/dist/sl-SI.module.js.map +1 -0
  181. package/dist/sr-SP.main.js +7 -0
  182. package/dist/sr-SP.main.js.map +1 -0
  183. package/dist/sr-SP.mjs +9 -0
  184. package/dist/sr-SP.module.js +9 -0
  185. package/dist/sr-SP.module.js.map +1 -0
  186. package/dist/styles.d09a6cc6.css +839 -0
  187. package/dist/styles.d09a6cc6.css.map +1 -0
  188. package/dist/styles_css.main.js +197 -0
  189. package/dist/styles_css.main.js.map +1 -0
  190. package/dist/styles_css.mjs +199 -0
  191. package/dist/styles_css.module.js +199 -0
  192. package/dist/styles_css.module.js.map +1 -0
  193. package/dist/sv-SE.main.js +7 -0
  194. package/dist/sv-SE.main.js.map +1 -0
  195. package/dist/sv-SE.mjs +9 -0
  196. package/dist/sv-SE.module.js +9 -0
  197. package/dist/sv-SE.module.js.map +1 -0
  198. package/dist/tr-TR.main.js +7 -0
  199. package/dist/tr-TR.main.js.map +1 -0
  200. package/dist/tr-TR.mjs +9 -0
  201. package/dist/tr-TR.module.js +9 -0
  202. package/dist/tr-TR.module.js.map +1 -0
  203. package/dist/types.d.ts +33 -5
  204. package/dist/types.d.ts.map +1 -1
  205. package/dist/uk-UA.main.js +7 -0
  206. package/dist/uk-UA.main.js.map +1 -0
  207. package/dist/uk-UA.mjs +9 -0
  208. package/dist/uk-UA.module.js +9 -0
  209. package/dist/uk-UA.module.js.map +1 -0
  210. package/dist/zh-CN.main.js +7 -0
  211. package/dist/zh-CN.main.js.map +1 -0
  212. package/dist/zh-CN.mjs +9 -0
  213. package/dist/zh-CN.module.js +9 -0
  214. package/dist/zh-CN.module.js.map +1 -0
  215. package/dist/zh-TW.main.js +7 -0
  216. package/dist/zh-TW.main.js.map +1 -0
  217. package/dist/zh-TW.mjs +9 -0
  218. package/dist/zh-TW.module.js +9 -0
  219. package/dist/zh-TW.module.js.map +1 -0
  220. package/package.json +39 -43
  221. package/src/DragPreview.tsx +20 -8
  222. package/src/InsertionIndicator.tsx +3 -3
  223. package/src/ListView.tsx +187 -178
  224. package/src/ListViewItem.tsx +30 -17
  225. package/src/ListViewLayout.ts +66 -0
  226. package/src/RootDropIndicator.tsx +6 -7
  227. package/src/index.ts +13 -0
  228. package/src/styles.css +195 -68
  229. package/LICENSE +0 -201
  230. package/dist/main.css +0 -1
@@ -0,0 +1,247 @@
1
+ import "./styles.d09a6cc6.css";
2
+ import $asbps$styles_cssmodulejs from "./styles_css.mjs";
3
+ import {ListViewContext as $f85fb77f9d4cbc6c$export$870039b0abfe3de0} from "./ListView.mjs";
4
+ import {Checkbox as $asbps$Checkbox} from "@react-spectrum/checkbox";
5
+ import $asbps$spectrumiconsuiChevronLeftMedium from "@spectrum-icons/ui/ChevronLeftMedium";
6
+ import $asbps$spectrumiconsuiChevronRightMedium from "@spectrum-icons/ui/ChevronRightMedium";
7
+ import {useHasChild as $asbps$useHasChild, classNames as $asbps$classNames, SlotProvider as $asbps$SlotProvider, ClearSlots as $asbps$ClearSlots} from "@react-spectrum/utils";
8
+ import {CSSTransition as $asbps$CSSTransition} from "react-transition-group";
9
+ import {useFocusRing as $asbps$useFocusRing, FocusRing as $asbps$FocusRing} from "@react-aria/focus";
10
+ import {Grid as $asbps$Grid} from "@react-spectrum/layout";
11
+ import {useHover as $asbps$useHover, isFocusVisible as $asbps$isFocusVisible} from "@react-aria/interactions";
12
+ import $asbps$spectrumiconsuiListGripper from "@spectrum-icons/ui/ListGripper";
13
+ import {mergeProps as $asbps$mergeProps} from "@react-aria/utils";
14
+ import {Provider as $asbps$Provider} from "@react-spectrum/provider";
15
+ import $asbps$react, {useContext as $asbps$useContext, useRef as $asbps$useRef} from "react";
16
+ import {Text as $asbps$Text} from "@react-spectrum/text";
17
+ import {useButton as $asbps$useButton} from "@react-aria/button";
18
+ import {useGridListItem as $asbps$useGridListItem, useGridListSelectionCheckbox as $asbps$useGridListSelectionCheckbox} from "@react-aria/gridlist";
19
+ import {useLocale as $asbps$useLocale} from "@react-aria/i18n";
20
+ import {useVisuallyHidden as $asbps$useVisuallyHidden} from "@react-aria/visually-hidden";
21
+
22
+
23
+ function $parcel$interopDefault(a) {
24
+ return a && a.__esModule ? a.default : a;
25
+ }
26
+ /*
27
+ * Copyright 2021 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
56
+ var _layout_getContentSize, _layout_virtualizer;
57
+ let { item: item, isEmphasized: isEmphasized } = props;
58
+ let { state: state, dragState: dragState, dropState: dropState, isListDraggable: isListDraggable, isListDroppable: isListDroppable, layout: layout, dragAndDropHooks: dragAndDropHooks, loadingState: loadingState } = (0, $asbps$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
59
+ let { direction: direction } = (0, $asbps$useLocale)();
60
+ let rowRef = (0, $asbps$useRef)(undefined);
61
+ let checkboxWrapperRef = (0, $asbps$useRef)(undefined);
62
+ let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $asbps$useFocusRing)({
63
+ within: true
64
+ });
65
+ let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $asbps$useFocusRing)();
66
+ let { rowProps: rowProps, gridCellProps: gridCellProps, isPressed: isPressed, descriptionProps: descriptionProps, isSelected: isSelected, isDisabled: isDisabled, allowsSelection: allowsSelection, hasAction: hasAction } = (0, $asbps$useGridListItem)({
67
+ node: item,
68
+ isVirtualized: true,
69
+ shouldSelectOnPressUp: isListDraggable
70
+ }, state, rowRef);
71
+ let isDroppable = isListDroppable && !isDisabled;
72
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $asbps$useHover)({
73
+ isDisabled: !allowsSelection && !hasAction
74
+ });
75
+ let { checkboxProps: checkboxProps } = (0, $asbps$useGridListSelectionCheckbox)({
76
+ key: item.key
77
+ }, state);
78
+ let hasDescription = (0, $asbps$useHasChild)(`.${(0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description']}`, rowRef);
79
+ let draggableItem;
80
+ if (isListDraggable) {
81
+ // eslint-disable-next-line react-hooks/rules-of-hooks
82
+ draggableItem = dragAndDropHooks.useDraggableItem({
83
+ key: item.key,
84
+ hasDragButton: true
85
+ }, dragState);
86
+ if (isDisabled) draggableItem = null;
87
+ }
88
+ let droppableItem;
89
+ let isDropTarget;
90
+ let dropIndicator;
91
+ let dropIndicatorRef = (0, $asbps$useRef)(undefined);
92
+ if (isListDroppable) {
93
+ let target = {
94
+ type: 'item',
95
+ key: item.key,
96
+ dropPosition: 'on'
97
+ };
98
+ isDropTarget = dropState.isDropTarget(target);
99
+ // eslint-disable-next-line react-hooks/rules-of-hooks
100
+ dropIndicator = dragAndDropHooks.useDropIndicator({
101
+ target: target
102
+ }, dropState, dropIndicatorRef);
103
+ }
104
+ let dragButtonRef = (0, $asbps$react).useRef(undefined);
105
+ let { buttonProps: buttonProps } = (0, $asbps$useButton)({
106
+ ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
107
+ elementType: 'div'
108
+ }, dragButtonRef);
109
+ let chevron = direction === 'ltr' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiChevronRightMedium), {
110
+ "aria-hidden": "true",
111
+ UNSAFE_className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-parentIndicator', {
112
+ 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,
113
+ 'is-disabled': !hasAction
114
+ })
115
+ }) : /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiChevronLeftMedium), {
116
+ "aria-hidden": "true",
117
+ UNSAFE_className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-parentIndicator', {
118
+ 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,
119
+ 'is-disabled': !hasAction
120
+ })
121
+ });
122
+ let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
123
+ let { visuallyHiddenProps: visuallyHiddenProps } = (0, $asbps$useVisuallyHidden)();
124
+ let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
125
+ 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
126
+ };
127
+ const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, dropProps, hoverProps, focusWithinProps, focusProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
128
+ // allowing for single swipe navigation between row drop indicator
129
+ (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
130
+ tabIndex: null
131
+ });
132
+ let isFirstRow = item.prevKey == null;
133
+ let isLastRow = item.nextKey == null;
134
+ // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom
135
+ // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap
136
+ // with bottom border
137
+ let isFlushWithContainerBottom = false;
138
+ if (isLastRow && loadingState !== 'loadingMore') {
139
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
140
+ }
141
+ // previous item isn't selected
142
+ // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
143
+ let roundTops = !state.selectionManager.isSelected(item.prevKey) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
144
+ let roundBottoms = !state.selectionManager.isSelected(item.nextKey) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
145
+ let content = typeof item.rendered === 'string' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Text), null, item.rendered) : item.rendered;
146
+ if (isDisabled) content = /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Provider), {
147
+ isDisabled: true
148
+ }, content);
149
+ return /*#__PURE__*/ (0, $asbps$react).createElement("div", {
150
+ ...mergedProps,
151
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListView-row', {
152
+ 'focus-ring': isFocusVisible,
153
+ 'round-tops': roundTops || isHovered && !isSelected && state.selectionManager.focusedKey !== item.key,
154
+ 'round-bottoms': roundBottoms || isHovered && !isSelected && state.selectionManager.focusedKey !== item.key
155
+ }),
156
+ ref: rowRef
157
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
158
+ // TODO: refactor the css here now that we are focusing the row?
159
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem', {
160
+ 'is-active': isPressed,
161
+ 'is-focused': isFocusVisibleWithin,
162
+ 'focus-ring': isFocusVisible,
163
+ 'is-hovered': isHovered,
164
+ 'is-selected': isSelected,
165
+ 'is-disabled': isDisabled,
166
+ 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
167
+ 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
168
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
169
+ 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
170
+ 'react-spectrum-ListViewItem--firstRow': isFirstRow,
171
+ 'react-spectrum-ListViewItem--lastRow': isLastRow,
172
+ 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,
173
+ 'react-spectrum-ListViewItem--hasDescription': hasDescription
174
+ }),
175
+ ...gridCellProps
176
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Grid), {
177
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-grid']
178
+ }, isListDraggable && /*#__PURE__*/ (0, $asbps$react).createElement("div", {
179
+ className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-draghandle-container']
180
+ }, !isDisabled && /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$FocusRing), {
181
+ focusRingClass: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'focus-ring')
182
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
183
+ ...buttonProps,
184
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-draghandle-button'),
185
+ style: !isFocusVisibleWithin ? {
186
+ ...visuallyHiddenProps.style
187
+ } : {},
188
+ ref: dragButtonRef,
189
+ draggable: "true"
190
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiListGripper), null)))), isListDroppable && !(dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isHidden) && /*#__PURE__*/ (0, $asbps$react).createElement("div", {
191
+ role: "button",
192
+ ...visuallyHiddenProps,
193
+ ...dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.dropIndicatorProps,
194
+ ref: dropIndicatorRef
195
+ }), /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$CSSTransition), {
196
+ in: showCheckbox,
197
+ unmountOnExit: true,
198
+ classNames: {
199
+ enter: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--enter'],
200
+ enterActive: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--enterActive'],
201
+ exit: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--exit'],
202
+ exitActive: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--exitActive']
203
+ },
204
+ timeout: 160,
205
+ nodeRef: checkboxWrapperRef
206
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
207
+ ref: checkboxWrapperRef,
208
+ className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkboxWrapper']
209
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Checkbox), {
210
+ ...checkboxProps,
211
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox'],
212
+ isEmphasized: isEmphasized
213
+ }))), /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$SlotProvider), {
214
+ slots: {
215
+ text: {
216
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-content']
217
+ },
218
+ description: {
219
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description'],
220
+ ...descriptionProps
221
+ },
222
+ illustration: {
223
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-thumbnail']
224
+ },
225
+ image: {
226
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-thumbnail']
227
+ },
228
+ actionButton: {
229
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actions'],
230
+ isQuiet: true
231
+ },
232
+ actionGroup: {
233
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actions'],
234
+ isQuiet: true,
235
+ density: 'compact'
236
+ },
237
+ actionMenu: {
238
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actionmenu'],
239
+ isQuiet: true
240
+ }
241
+ }
242
+ }, content, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$ClearSlots), null, chevron)))));
243
+ }
244
+
245
+
246
+ export {$d7c07ca2efc5ba02$export$c6bde0c04b033c0e as ListViewItem};
247
+ //# sourceMappingURL=ListViewItem.module.js.map
@@ -0,0 +1,247 @@
1
+ import "./styles.d09a6cc6.css";
2
+ import $asbps$styles_cssmodulejs from "./styles_css.module.js";
3
+ import {ListViewContext as $f85fb77f9d4cbc6c$export$870039b0abfe3de0} from "./ListView.module.js";
4
+ import {Checkbox as $asbps$Checkbox} from "@react-spectrum/checkbox";
5
+ import $asbps$spectrumiconsuiChevronLeftMedium from "@spectrum-icons/ui/ChevronLeftMedium";
6
+ import $asbps$spectrumiconsuiChevronRightMedium from "@spectrum-icons/ui/ChevronRightMedium";
7
+ import {useHasChild as $asbps$useHasChild, classNames as $asbps$classNames, SlotProvider as $asbps$SlotProvider, ClearSlots as $asbps$ClearSlots} from "@react-spectrum/utils";
8
+ import {CSSTransition as $asbps$CSSTransition} from "react-transition-group";
9
+ import {useFocusRing as $asbps$useFocusRing, FocusRing as $asbps$FocusRing} from "@react-aria/focus";
10
+ import {Grid as $asbps$Grid} from "@react-spectrum/layout";
11
+ import {useHover as $asbps$useHover, isFocusVisible as $asbps$isFocusVisible} from "@react-aria/interactions";
12
+ import $asbps$spectrumiconsuiListGripper from "@spectrum-icons/ui/ListGripper";
13
+ import {mergeProps as $asbps$mergeProps} from "@react-aria/utils";
14
+ import {Provider as $asbps$Provider} from "@react-spectrum/provider";
15
+ import $asbps$react, {useContext as $asbps$useContext, useRef as $asbps$useRef} from "react";
16
+ import {Text as $asbps$Text} from "@react-spectrum/text";
17
+ import {useButton as $asbps$useButton} from "@react-aria/button";
18
+ import {useGridListItem as $asbps$useGridListItem, useGridListSelectionCheckbox as $asbps$useGridListSelectionCheckbox} from "@react-aria/gridlist";
19
+ import {useLocale as $asbps$useLocale} from "@react-aria/i18n";
20
+ import {useVisuallyHidden as $asbps$useVisuallyHidden} from "@react-aria/visually-hidden";
21
+
22
+
23
+ function $parcel$interopDefault(a) {
24
+ return a && a.__esModule ? a.default : a;
25
+ }
26
+ /*
27
+ * Copyright 2021 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+ function $d7c07ca2efc5ba02$export$c6bde0c04b033c0e(props) {
56
+ var _layout_getContentSize, _layout_virtualizer;
57
+ let { item: item, isEmphasized: isEmphasized } = props;
58
+ let { state: state, dragState: dragState, dropState: dropState, isListDraggable: isListDraggable, isListDroppable: isListDroppable, layout: layout, dragAndDropHooks: dragAndDropHooks, loadingState: loadingState } = (0, $asbps$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
59
+ let { direction: direction } = (0, $asbps$useLocale)();
60
+ let rowRef = (0, $asbps$useRef)(undefined);
61
+ let checkboxWrapperRef = (0, $asbps$useRef)(undefined);
62
+ let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $asbps$useFocusRing)({
63
+ within: true
64
+ });
65
+ let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $asbps$useFocusRing)();
66
+ let { rowProps: rowProps, gridCellProps: gridCellProps, isPressed: isPressed, descriptionProps: descriptionProps, isSelected: isSelected, isDisabled: isDisabled, allowsSelection: allowsSelection, hasAction: hasAction } = (0, $asbps$useGridListItem)({
67
+ node: item,
68
+ isVirtualized: true,
69
+ shouldSelectOnPressUp: isListDraggable
70
+ }, state, rowRef);
71
+ let isDroppable = isListDroppable && !isDisabled;
72
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $asbps$useHover)({
73
+ isDisabled: !allowsSelection && !hasAction
74
+ });
75
+ let { checkboxProps: checkboxProps } = (0, $asbps$useGridListSelectionCheckbox)({
76
+ key: item.key
77
+ }, state);
78
+ let hasDescription = (0, $asbps$useHasChild)(`.${(0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description']}`, rowRef);
79
+ let draggableItem;
80
+ if (isListDraggable) {
81
+ // eslint-disable-next-line react-hooks/rules-of-hooks
82
+ draggableItem = dragAndDropHooks.useDraggableItem({
83
+ key: item.key,
84
+ hasDragButton: true
85
+ }, dragState);
86
+ if (isDisabled) draggableItem = null;
87
+ }
88
+ let droppableItem;
89
+ let isDropTarget;
90
+ let dropIndicator;
91
+ let dropIndicatorRef = (0, $asbps$useRef)(undefined);
92
+ if (isListDroppable) {
93
+ let target = {
94
+ type: 'item',
95
+ key: item.key,
96
+ dropPosition: 'on'
97
+ };
98
+ isDropTarget = dropState.isDropTarget(target);
99
+ // eslint-disable-next-line react-hooks/rules-of-hooks
100
+ dropIndicator = dragAndDropHooks.useDropIndicator({
101
+ target: target
102
+ }, dropState, dropIndicatorRef);
103
+ }
104
+ let dragButtonRef = (0, $asbps$react).useRef(undefined);
105
+ let { buttonProps: buttonProps } = (0, $asbps$useButton)({
106
+ ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
107
+ elementType: 'div'
108
+ }, dragButtonRef);
109
+ let chevron = direction === 'ltr' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiChevronRightMedium), {
110
+ "aria-hidden": "true",
111
+ UNSAFE_className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-parentIndicator', {
112
+ 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,
113
+ 'is-disabled': !hasAction
114
+ })
115
+ }) : /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiChevronLeftMedium), {
116
+ "aria-hidden": "true",
117
+ UNSAFE_className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-parentIndicator', {
118
+ 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,
119
+ 'is-disabled': !hasAction
120
+ })
121
+ });
122
+ let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
123
+ let { visuallyHiddenProps: visuallyHiddenProps } = (0, $asbps$useVisuallyHidden)();
124
+ let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
125
+ 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
126
+ };
127
+ const mergedProps = (0, $asbps$mergeProps)(rowProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, dropProps, hoverProps, focusWithinProps, focusProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
128
+ // allowing for single swipe navigation between row drop indicator
129
+ (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
130
+ tabIndex: null
131
+ });
132
+ let isFirstRow = item.prevKey == null;
133
+ let isLastRow = item.nextKey == null;
134
+ // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom
135
+ // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap
136
+ // with bottom border
137
+ let isFlushWithContainerBottom = false;
138
+ if (isLastRow && loadingState !== 'loadingMore') {
139
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
140
+ }
141
+ // previous item isn't selected
142
+ // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
143
+ let roundTops = !state.selectionManager.isSelected(item.prevKey) && (state.selectionManager.focusedKey !== item.prevKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
144
+ let roundBottoms = !state.selectionManager.isSelected(item.nextKey) && (state.selectionManager.focusedKey !== item.nextKey || !((0, $asbps$isFocusVisible)() && state.selectionManager.isFocused));
145
+ let content = typeof item.rendered === 'string' ? /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Text), null, item.rendered) : item.rendered;
146
+ if (isDisabled) content = /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Provider), {
147
+ isDisabled: true
148
+ }, content);
149
+ return /*#__PURE__*/ (0, $asbps$react).createElement("div", {
150
+ ...mergedProps,
151
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListView-row', {
152
+ 'focus-ring': isFocusVisible,
153
+ 'round-tops': roundTops || isHovered && !isSelected && state.selectionManager.focusedKey !== item.key,
154
+ 'round-bottoms': roundBottoms || isHovered && !isSelected && state.selectionManager.focusedKey !== item.key
155
+ }),
156
+ ref: rowRef
157
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
158
+ // TODO: refactor the css here now that we are focusing the row?
159
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem', {
160
+ 'is-active': isPressed,
161
+ 'is-focused': isFocusVisibleWithin,
162
+ 'focus-ring': isFocusVisible,
163
+ 'is-hovered': isHovered,
164
+ 'is-selected': isSelected,
165
+ 'is-disabled': isDisabled,
166
+ 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
167
+ 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
168
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
169
+ 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
170
+ 'react-spectrum-ListViewItem--firstRow': isFirstRow,
171
+ 'react-spectrum-ListViewItem--lastRow': isLastRow,
172
+ 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,
173
+ 'react-spectrum-ListViewItem--hasDescription': hasDescription
174
+ }),
175
+ ...gridCellProps
176
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Grid), {
177
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-grid']
178
+ }, isListDraggable && /*#__PURE__*/ (0, $asbps$react).createElement("div", {
179
+ className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-draghandle-container']
180
+ }, !isDisabled && /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$FocusRing), {
181
+ focusRingClass: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'focus-ring')
182
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
183
+ ...buttonProps,
184
+ className: (0, $asbps$classNames)((0, ($parcel$interopDefault($asbps$styles_cssmodulejs))), 'react-spectrum-ListViewItem-draghandle-button'),
185
+ style: !isFocusVisibleWithin ? {
186
+ ...visuallyHiddenProps.style
187
+ } : {},
188
+ ref: dragButtonRef,
189
+ draggable: "true"
190
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$spectrumiconsuiListGripper), null)))), isListDroppable && !(dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isHidden) && /*#__PURE__*/ (0, $asbps$react).createElement("div", {
191
+ role: "button",
192
+ ...visuallyHiddenProps,
193
+ ...dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.dropIndicatorProps,
194
+ ref: dropIndicatorRef
195
+ }), /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$CSSTransition), {
196
+ in: showCheckbox,
197
+ unmountOnExit: true,
198
+ classNames: {
199
+ enter: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--enter'],
200
+ enterActive: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--enterActive'],
201
+ exit: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--exit'],
202
+ exitActive: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox--exitActive']
203
+ },
204
+ timeout: 160,
205
+ nodeRef: checkboxWrapperRef
206
+ }, /*#__PURE__*/ (0, $asbps$react).createElement("div", {
207
+ ref: checkboxWrapperRef,
208
+ className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkboxWrapper']
209
+ }, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$Checkbox), {
210
+ ...checkboxProps,
211
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-checkbox'],
212
+ isEmphasized: isEmphasized
213
+ }))), /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$SlotProvider), {
214
+ slots: {
215
+ text: {
216
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-content']
217
+ },
218
+ description: {
219
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-description'],
220
+ ...descriptionProps
221
+ },
222
+ illustration: {
223
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-thumbnail']
224
+ },
225
+ image: {
226
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-thumbnail']
227
+ },
228
+ actionButton: {
229
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actions'],
230
+ isQuiet: true
231
+ },
232
+ actionGroup: {
233
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actions'],
234
+ isQuiet: true,
235
+ density: 'compact'
236
+ },
237
+ actionMenu: {
238
+ UNSAFE_className: (0, ($parcel$interopDefault($asbps$styles_cssmodulejs)))['react-spectrum-ListViewItem-actionmenu'],
239
+ isQuiet: true
240
+ }
241
+ }
242
+ }, content, /*#__PURE__*/ (0, $asbps$react).createElement((0, $asbps$ClearSlots), null, chevron)))));
243
+ }
244
+
245
+
246
+ export {$d7c07ca2efc5ba02$export$c6bde0c04b033c0e as ListViewItem};
247
+ //# sourceMappingURL=ListViewItem.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6BM,SAAS,0CAAgB,KAA2B;QAyHnD,wBAAmC;IAx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@react-spectrum/list/src/ListViewItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult, DropIndicatorAria, DroppableItemResult} from '@react-aria/dnd';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing, useFocusRing} from '@react-aria/focus';\nimport {Grid} from '@react-spectrum/layout';\nimport {isFocusVisible as isGlobalFocusVisible, useHover} from '@react-aria/interactions';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from '@react-aria/utils';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useContext, useRef} from 'react';\nimport {Text} from '@react-spectrum/text';\nimport {useButton} from '@react-aria/button';\nimport {useGridListItem, useGridListSelectionCheckbox} from '@react-aria/gridlist';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>,\n isEmphasized: boolean,\n hasActions: boolean\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>) {\n let {\n item,\n isEmphasized\n } = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext);\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement>(undefined);\n let checkboxWrapperRef = useRef<HTMLDivElement>(undefined);\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem({\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n }, state, rowRef);\n let isDroppable = isListDroppable && !isDisabled;\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);\n\n let draggableItem: DraggableItemResult;\n if (isListDraggable) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n draggableItem = dragAndDropHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let droppableItem: DroppableItemResult;\n let isDropTarget: boolean;\n let dropIndicator: DropIndicatorAria;\n let dropIndicatorRef = useRef(undefined);\n if (isListDroppable) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n dropIndicator = dragAndDropHooks.useDropIndicator({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef(undefined);\n let {buttonProps} = useButton({\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n }, dragButtonRef);\n\n let chevron = direction === 'ltr'\n ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n )\n : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-parentIndicator',\n {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n }\n )\n } />\n );\n\n let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n let dropProps = isDroppable ? droppableItem?.dropProps : {'aria-hidden': droppableItem?.dropProps['aria-hidden']};\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n dropProps,\n hoverProps,\n focusWithinProps,\n focusProps,\n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n dragAndDropHooks?.isVirtualDragging() && {tabIndex: null}\n );\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= layout.virtualizer?.visibleRect.height) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops = (!state.selectionManager.isSelected(item.prevKey)\n && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n let roundBottoms = (!state.selectionManager.isSelected(item.nextKey)\n && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListView-row',\n {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n }\n )\n }\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem',\n {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected': state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n }\n )\n }\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable &&\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled &&\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...buttonProps as React.HTMLAttributes<HTMLElement>}\n className={\n classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )\n }\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n }\n </div>\n }\n {isListDroppable && !dropIndicator?.isHidden &&\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n }\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef} >\n <div ref={checkboxWrapperRef} className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized} />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'], ...descriptionProps},\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], isQuiet: true},\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'], isQuiet: true}\n }}>\n {content}\n <ClearSlots>\n {chevron}\n </ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.module.js.map"}
@@ -0,0 +1,69 @@
1
+ var $gyQtY$reactstatelyvirtualizer = require("@react-stately/virtualizer");
2
+ var $gyQtY$reactstatelylayout = require("@react-stately/layout");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "ListViewLayout", () => $a0cb8c9f009bf274$export$dab781655dfbb7d3);
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
+ class $a0cb8c9f009bf274$export$dab781655dfbb7d3 extends (0, $gyQtY$reactstatelylayout.ListLayout) {
23
+ update(invalidationContext) {
24
+ var _invalidationContext_layoutOptions;
25
+ this.isLoading = ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.isLoading) || false;
26
+ super.update(invalidationContext);
27
+ }
28
+ buildCollection() {
29
+ let nodes = super.buildCollection();
30
+ let y = this.contentSize.height;
31
+ if (this.isLoading) {
32
+ let rect = new (0, $gyQtY$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);
33
+ let loader = new (0, $gyQtY$reactstatelyvirtualizer.LayoutInfo)('loader', 'loader', rect);
34
+ let node = {
35
+ layoutInfo: loader,
36
+ validRect: loader.rect
37
+ };
38
+ nodes.push(node);
39
+ this.layoutNodes.set(loader.key, node);
40
+ y = loader.rect.maxY;
41
+ }
42
+ if (nodes.length === 0) {
43
+ let rect = new (0, $gyQtY$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
44
+ let placeholder = new (0, $gyQtY$reactstatelyvirtualizer.LayoutInfo)('placeholder', 'placeholder', rect);
45
+ let node = {
46
+ layoutInfo: placeholder,
47
+ validRect: placeholder.rect
48
+ };
49
+ nodes.push(node);
50
+ this.layoutNodes.set(placeholder.key, node);
51
+ y = placeholder.rect.maxY;
52
+ }
53
+ this.contentSize.height = y;
54
+ return nodes;
55
+ }
56
+ buildItem(node, x, y) {
57
+ let res = super.buildItem(node, x, y);
58
+ // allow overflow so the focus ring/selection ring can extend outside to overlap with the adjacent items borders
59
+ res.layoutInfo.allowOverflow = true;
60
+ return res;
61
+ }
62
+ constructor(...args){
63
+ super(...args);
64
+ this.isLoading = false;
65
+ }
66
+ }
67
+
68
+
69
+ //# sourceMappingURL=ListViewLayout.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AASM,MAAM,kDAA0B,CAAA,GAAA,oCAAS;IAG9C,OAAO,mBAA6D,EAAQ;YACzD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;QACxC,IAAI,QAAQ,KAAK,CAAC;QAClB,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM;QAE/B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,OAAO,IAAI,CAAA,GAAA,mCAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB;YAChJ,IAAI,SAAS,IAAI,CAAA,GAAA,yCAAS,EAAE,UAAU,UAAU;YAChD,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,OAAO,IAAI;YACxB;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE;YACjC,IAAI,OAAO,IAAI,CAAC,IAAI;QACtB;QAEA,IAAI,MAAM,MAAM,KAAK,GAAG;YACtB,IAAI,OAAO,IAAI,CAAA,GAAA,mCAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM;YACjG,IAAI,cAAc,IAAI,CAAA,GAAA,yCAAS,EAAE,eAAe,eAAe;YAC/D,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,YAAY,IAAI;YAC7B;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,GAAG,EAAE;YACtC,IAAI,YAAY,IAAI,CAAC,IAAI;QAC3B;QAEA,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG;QAC1B,OAAO;IACT;IAEU,UAAU,IAAa,EAAE,CAAS,EAAE,CAAS,EAAc;QACnE,IAAI,MAAM,KAAK,CAAC,UAAU,MAAM,GAAG;QACnC,gHAAgH;QAChH,IAAI,UAAU,CAAC,aAAa,GAAG;QAC/B,OAAO;IACT;;;aA5CQ,YAAqB;;AA6C/B","sources":["packages/@react-spectrum/list/src/ListViewLayout.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 */\nimport {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps {\n isLoading?: boolean\n}\n\nexport class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {\n private isLoading: boolean = false;\n\n update(invalidationContext: InvalidationContext<ListViewLayoutProps>): void {\n this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n let nodes = super.buildCollection();\n let y = this.contentSize.height;\n\n if (this.isLoading) {\n let rect = new Rect(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n nodes.push(node);\n this.layoutNodes.set(loader.key, node);\n y = loader.rect.maxY;\n }\n\n if (nodes.length === 0) {\n let rect = new Rect(0, y, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n let node = {\n layoutInfo: placeholder,\n validRect: placeholder.rect\n };\n nodes.push(node);\n this.layoutNodes.set(placeholder.key, node);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize.height = y;\n return nodes;\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let res = super.buildItem(node, x, y);\n // allow overflow so the focus ring/selection ring can extend outside to overlap with the adjacent items borders\n res.layoutInfo.allowOverflow = true;\n return res;\n }\n}\n"],"names":[],"version":3,"file":"ListViewLayout.main.js.map"}