@react-aria/dnd 3.11.6 → 3.12.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 (281) hide show
  1. package/dist/import.mjs +8 -18
  2. package/dist/main.js +22 -32
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +8 -18
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +13 -0
  7. package/package.json +16 -21
  8. package/src/index.ts +13 -56
  9. package/dist/DragManager.main.js +0 -522
  10. package/dist/DragManager.main.js.map +0 -1
  11. package/dist/DragManager.mjs +0 -513
  12. package/dist/DragManager.module.js +0 -513
  13. package/dist/DragManager.module.js.map +0 -1
  14. package/dist/DragPreview.main.js +0 -73
  15. package/dist/DragPreview.main.js.map +0 -1
  16. package/dist/DragPreview.mjs +0 -64
  17. package/dist/DragPreview.module.js +0 -64
  18. package/dist/DragPreview.module.js.map +0 -1
  19. package/dist/DropTargetKeyboardNavigation.main.js +0 -215
  20. package/dist/DropTargetKeyboardNavigation.main.js.map +0 -1
  21. package/dist/DropTargetKeyboardNavigation.mjs +0 -210
  22. package/dist/DropTargetKeyboardNavigation.module.js +0 -210
  23. package/dist/DropTargetKeyboardNavigation.module.js.map +0 -1
  24. package/dist/ListDropTargetDelegate.main.js +0 -129
  25. package/dist/ListDropTargetDelegate.main.js.map +0 -1
  26. package/dist/ListDropTargetDelegate.mjs +0 -124
  27. package/dist/ListDropTargetDelegate.module.js +0 -124
  28. package/dist/ListDropTargetDelegate.module.js.map +0 -1
  29. package/dist/ar-AE.main.js +0 -44
  30. package/dist/ar-AE.main.js.map +0 -1
  31. package/dist/ar-AE.mjs +0 -46
  32. package/dist/ar-AE.module.js +0 -46
  33. package/dist/ar-AE.module.js.map +0 -1
  34. package/dist/bg-BG.main.js +0 -44
  35. package/dist/bg-BG.main.js.map +0 -1
  36. package/dist/bg-BG.mjs +0 -46
  37. package/dist/bg-BG.module.js +0 -46
  38. package/dist/bg-BG.module.js.map +0 -1
  39. package/dist/constants.main.js +0 -64
  40. package/dist/constants.main.js.map +0 -1
  41. package/dist/constants.mjs +0 -52
  42. package/dist/constants.module.js +0 -52
  43. package/dist/constants.module.js.map +0 -1
  44. package/dist/cs-CZ.main.js +0 -45
  45. package/dist/cs-CZ.main.js.map +0 -1
  46. package/dist/cs-CZ.mjs +0 -47
  47. package/dist/cs-CZ.module.js +0 -47
  48. package/dist/cs-CZ.module.js.map +0 -1
  49. package/dist/da-DK.main.js +0 -44
  50. package/dist/da-DK.main.js.map +0 -1
  51. package/dist/da-DK.mjs +0 -46
  52. package/dist/da-DK.module.js +0 -46
  53. package/dist/da-DK.module.js.map +0 -1
  54. package/dist/de-DE.main.js +0 -44
  55. package/dist/de-DE.main.js.map +0 -1
  56. package/dist/de-DE.mjs +0 -46
  57. package/dist/de-DE.module.js +0 -46
  58. package/dist/de-DE.module.js.map +0 -1
  59. package/dist/el-GR.main.js +0 -44
  60. package/dist/el-GR.main.js.map +0 -1
  61. package/dist/el-GR.mjs +0 -46
  62. package/dist/el-GR.module.js +0 -46
  63. package/dist/el-GR.module.js.map +0 -1
  64. package/dist/en-US.main.js +0 -44
  65. package/dist/en-US.main.js.map +0 -1
  66. package/dist/en-US.mjs +0 -46
  67. package/dist/en-US.module.js +0 -46
  68. package/dist/en-US.module.js.map +0 -1
  69. package/dist/es-ES.main.js +0 -44
  70. package/dist/es-ES.main.js.map +0 -1
  71. package/dist/es-ES.mjs +0 -46
  72. package/dist/es-ES.module.js +0 -46
  73. package/dist/es-ES.module.js.map +0 -1
  74. package/dist/et-EE.main.js +0 -44
  75. package/dist/et-EE.main.js.map +0 -1
  76. package/dist/et-EE.mjs +0 -46
  77. package/dist/et-EE.module.js +0 -46
  78. package/dist/et-EE.module.js.map +0 -1
  79. package/dist/fi-FI.main.js +0 -44
  80. package/dist/fi-FI.main.js.map +0 -1
  81. package/dist/fi-FI.mjs +0 -46
  82. package/dist/fi-FI.module.js +0 -46
  83. package/dist/fi-FI.module.js.map +0 -1
  84. package/dist/fr-FR.main.js +0 -44
  85. package/dist/fr-FR.main.js.map +0 -1
  86. package/dist/fr-FR.mjs +0 -46
  87. package/dist/fr-FR.module.js +0 -46
  88. package/dist/fr-FR.module.js.map +0 -1
  89. package/dist/he-IL.main.js +0 -44
  90. package/dist/he-IL.main.js.map +0 -1
  91. package/dist/he-IL.mjs +0 -46
  92. package/dist/he-IL.module.js +0 -46
  93. package/dist/he-IL.module.js.map +0 -1
  94. package/dist/hr-HR.main.js +0 -44
  95. package/dist/hr-HR.main.js.map +0 -1
  96. package/dist/hr-HR.mjs +0 -46
  97. package/dist/hr-HR.module.js +0 -46
  98. package/dist/hr-HR.module.js.map +0 -1
  99. package/dist/hu-HU.main.js +0 -44
  100. package/dist/hu-HU.main.js.map +0 -1
  101. package/dist/hu-HU.mjs +0 -46
  102. package/dist/hu-HU.module.js +0 -46
  103. package/dist/hu-HU.module.js.map +0 -1
  104. package/dist/intlStrings.main.js +0 -108
  105. package/dist/intlStrings.main.js.map +0 -1
  106. package/dist/intlStrings.mjs +0 -110
  107. package/dist/intlStrings.module.js +0 -110
  108. package/dist/intlStrings.module.js.map +0 -1
  109. package/dist/it-IT.main.js +0 -44
  110. package/dist/it-IT.main.js.map +0 -1
  111. package/dist/it-IT.mjs +0 -46
  112. package/dist/it-IT.module.js +0 -46
  113. package/dist/it-IT.module.js.map +0 -1
  114. package/dist/ja-JP.main.js +0 -44
  115. package/dist/ja-JP.main.js.map +0 -1
  116. package/dist/ja-JP.mjs +0 -46
  117. package/dist/ja-JP.module.js +0 -46
  118. package/dist/ja-JP.module.js.map +0 -1
  119. package/dist/ko-KR.main.js +0 -44
  120. package/dist/ko-KR.main.js.map +0 -1
  121. package/dist/ko-KR.mjs +0 -46
  122. package/dist/ko-KR.module.js +0 -46
  123. package/dist/ko-KR.module.js.map +0 -1
  124. package/dist/lt-LT.main.js +0 -44
  125. package/dist/lt-LT.main.js.map +0 -1
  126. package/dist/lt-LT.mjs +0 -46
  127. package/dist/lt-LT.module.js +0 -46
  128. package/dist/lt-LT.module.js.map +0 -1
  129. package/dist/lv-LV.main.js +0 -44
  130. package/dist/lv-LV.main.js.map +0 -1
  131. package/dist/lv-LV.mjs +0 -46
  132. package/dist/lv-LV.module.js +0 -46
  133. package/dist/lv-LV.module.js.map +0 -1
  134. package/dist/nb-NO.main.js +0 -44
  135. package/dist/nb-NO.main.js.map +0 -1
  136. package/dist/nb-NO.mjs +0 -46
  137. package/dist/nb-NO.module.js +0 -46
  138. package/dist/nb-NO.module.js.map +0 -1
  139. package/dist/nl-NL.main.js +0 -44
  140. package/dist/nl-NL.main.js.map +0 -1
  141. package/dist/nl-NL.mjs +0 -46
  142. package/dist/nl-NL.module.js +0 -46
  143. package/dist/nl-NL.module.js.map +0 -1
  144. package/dist/pl-PL.main.js +0 -44
  145. package/dist/pl-PL.main.js.map +0 -1
  146. package/dist/pl-PL.mjs +0 -46
  147. package/dist/pl-PL.module.js +0 -46
  148. package/dist/pl-PL.module.js.map +0 -1
  149. package/dist/pt-BR.main.js +0 -44
  150. package/dist/pt-BR.main.js.map +0 -1
  151. package/dist/pt-BR.mjs +0 -46
  152. package/dist/pt-BR.module.js +0 -46
  153. package/dist/pt-BR.module.js.map +0 -1
  154. package/dist/pt-PT.main.js +0 -44
  155. package/dist/pt-PT.main.js.map +0 -1
  156. package/dist/pt-PT.mjs +0 -46
  157. package/dist/pt-PT.module.js +0 -46
  158. package/dist/pt-PT.module.js.map +0 -1
  159. package/dist/ro-RO.main.js +0 -44
  160. package/dist/ro-RO.main.js.map +0 -1
  161. package/dist/ro-RO.mjs +0 -46
  162. package/dist/ro-RO.module.js +0 -46
  163. package/dist/ro-RO.module.js.map +0 -1
  164. package/dist/ru-RU.main.js +0 -44
  165. package/dist/ru-RU.main.js.map +0 -1
  166. package/dist/ru-RU.mjs +0 -46
  167. package/dist/ru-RU.module.js +0 -46
  168. package/dist/ru-RU.module.js.map +0 -1
  169. package/dist/sk-SK.main.js +0 -44
  170. package/dist/sk-SK.main.js.map +0 -1
  171. package/dist/sk-SK.mjs +0 -46
  172. package/dist/sk-SK.module.js +0 -46
  173. package/dist/sk-SK.module.js.map +0 -1
  174. package/dist/sl-SI.main.js +0 -44
  175. package/dist/sl-SI.main.js.map +0 -1
  176. package/dist/sl-SI.mjs +0 -46
  177. package/dist/sl-SI.module.js +0 -46
  178. package/dist/sl-SI.module.js.map +0 -1
  179. package/dist/sr-SP.main.js +0 -44
  180. package/dist/sr-SP.main.js.map +0 -1
  181. package/dist/sr-SP.mjs +0 -46
  182. package/dist/sr-SP.module.js +0 -46
  183. package/dist/sr-SP.module.js.map +0 -1
  184. package/dist/sv-SE.main.js +0 -44
  185. package/dist/sv-SE.main.js.map +0 -1
  186. package/dist/sv-SE.mjs +0 -46
  187. package/dist/sv-SE.module.js +0 -46
  188. package/dist/sv-SE.module.js.map +0 -1
  189. package/dist/tr-TR.main.js +0 -44
  190. package/dist/tr-TR.main.js.map +0 -1
  191. package/dist/tr-TR.mjs +0 -46
  192. package/dist/tr-TR.module.js +0 -46
  193. package/dist/tr-TR.module.js.map +0 -1
  194. package/dist/types.d.ts +0 -244
  195. package/dist/types.d.ts.map +0 -1
  196. package/dist/uk-UA.main.js +0 -44
  197. package/dist/uk-UA.main.js.map +0 -1
  198. package/dist/uk-UA.mjs +0 -46
  199. package/dist/uk-UA.module.js +0 -46
  200. package/dist/uk-UA.module.js.map +0 -1
  201. package/dist/useAutoScroll.main.js +0 -89
  202. package/dist/useAutoScroll.main.js.map +0 -1
  203. package/dist/useAutoScroll.mjs +0 -84
  204. package/dist/useAutoScroll.module.js +0 -84
  205. package/dist/useAutoScroll.module.js.map +0 -1
  206. package/dist/useClipboard.main.js +0 -111
  207. package/dist/useClipboard.main.js.map +0 -1
  208. package/dist/useClipboard.mjs +0 -106
  209. package/dist/useClipboard.module.js +0 -106
  210. package/dist/useClipboard.module.js.map +0 -1
  211. package/dist/useDrag.main.js +0 -307
  212. package/dist/useDrag.main.js.map +0 -1
  213. package/dist/useDrag.mjs +0 -302
  214. package/dist/useDrag.module.js +0 -302
  215. package/dist/useDrag.module.js.map +0 -1
  216. package/dist/useDraggableCollection.main.js +0 -27
  217. package/dist/useDraggableCollection.main.js.map +0 -1
  218. package/dist/useDraggableCollection.mjs +0 -22
  219. package/dist/useDraggableCollection.module.js +0 -22
  220. package/dist/useDraggableCollection.module.js.map +0 -1
  221. package/dist/useDraggableItem.main.js +0 -128
  222. package/dist/useDraggableItem.main.js.map +0 -1
  223. package/dist/useDraggableItem.mjs +0 -123
  224. package/dist/useDraggableItem.module.js +0 -123
  225. package/dist/useDraggableItem.module.js.map +0 -1
  226. package/dist/useDrop.main.js +0 -295
  227. package/dist/useDrop.main.js.map +0 -1
  228. package/dist/useDrop.mjs +0 -290
  229. package/dist/useDrop.module.js +0 -290
  230. package/dist/useDrop.module.js.map +0 -1
  231. package/dist/useDropIndicator.main.js +0 -102
  232. package/dist/useDropIndicator.main.js.map +0 -1
  233. package/dist/useDropIndicator.mjs +0 -97
  234. package/dist/useDropIndicator.module.js +0 -97
  235. package/dist/useDropIndicator.module.js.map +0 -1
  236. package/dist/useDroppableCollection.main.js +0 -536
  237. package/dist/useDroppableCollection.main.js.map +0 -1
  238. package/dist/useDroppableCollection.mjs +0 -531
  239. package/dist/useDroppableCollection.module.js +0 -531
  240. package/dist/useDroppableCollection.module.js.map +0 -1
  241. package/dist/useDroppableItem.main.js +0 -81
  242. package/dist/useDroppableItem.main.js.map +0 -1
  243. package/dist/useDroppableItem.mjs +0 -76
  244. package/dist/useDroppableItem.module.js +0 -76
  245. package/dist/useDroppableItem.module.js.map +0 -1
  246. package/dist/useVirtualDrop.main.js +0 -56
  247. package/dist/useVirtualDrop.main.js.map +0 -1
  248. package/dist/useVirtualDrop.mjs +0 -51
  249. package/dist/useVirtualDrop.module.js +0 -51
  250. package/dist/useVirtualDrop.module.js.map +0 -1
  251. package/dist/utils.main.js +0 -285
  252. package/dist/utils.main.js.map +0 -1
  253. package/dist/utils.mjs +0 -257
  254. package/dist/utils.module.js +0 -257
  255. package/dist/utils.module.js.map +0 -1
  256. package/dist/zh-CN.main.js +0 -44
  257. package/dist/zh-CN.main.js.map +0 -1
  258. package/dist/zh-CN.mjs +0 -46
  259. package/dist/zh-CN.module.js +0 -46
  260. package/dist/zh-CN.module.js.map +0 -1
  261. package/dist/zh-TW.main.js +0 -44
  262. package/dist/zh-TW.main.js.map +0 -1
  263. package/dist/zh-TW.mjs +0 -46
  264. package/dist/zh-TW.module.js +0 -46
  265. package/dist/zh-TW.module.js.map +0 -1
  266. package/src/DragManager.ts +0 -659
  267. package/src/DragPreview.tsx +0 -81
  268. package/src/DropTargetKeyboardNavigation.ts +0 -293
  269. package/src/ListDropTargetDelegate.ts +0 -182
  270. package/src/constants.ts +0 -85
  271. package/src/useAutoScroll.ts +0 -105
  272. package/src/useClipboard.ts +0 -151
  273. package/src/useDrag.ts +0 -390
  274. package/src/useDraggableCollection.ts +0 -29
  275. package/src/useDraggableItem.ts +0 -158
  276. package/src/useDrop.ts +0 -444
  277. package/src/useDropIndicator.ts +0 -124
  278. package/src/useDroppableCollection.ts +0 -665
  279. package/src/useDroppableItem.ts +0 -86
  280. package/src/useVirtualDrop.ts +0 -49
  281. package/src/utils.ts +0 -385
@@ -1,27 +0,0 @@
1
- var $4620ae0dc40f0031$exports = require("./utils.main.js");
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, "useDraggableCollection", () => $c3e901bab7fcc6ff$export$2962a7984b2f0a80);
9
- /*
10
- * Copyright 2022 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 $c3e901bab7fcc6ff$export$2962a7984b2f0a80(props, state, ref) {
21
- // Update global DnD state if this keys within this collection are dragged
22
- let { draggingCollectionRef: draggingCollectionRef } = (0, $4620ae0dc40f0031$exports.globalDndState);
23
- if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current) (0, $4620ae0dc40f0031$exports.setDraggingCollectionRef)(ref);
24
- }
25
-
26
-
27
- //# sourceMappingURL=useDraggableCollection.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,wCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,kDAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from '@react-types/shared';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.main.js.map"}
@@ -1,22 +0,0 @@
1
- import {globalDndState as $7252cd45fc48c07c$export$6ca6700462636d0b, setDraggingCollectionRef as $7252cd45fc48c07c$export$f2be18a910c0caa6} from "./utils.mjs";
2
-
3
- /*
4
- * Copyright 2022 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 $4ac1fdc3a0fcd564$export$2962a7984b2f0a80(props, state, ref) {
15
- // Update global DnD state if this keys within this collection are dragged
16
- let { draggingCollectionRef: draggingCollectionRef } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
17
- if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current) (0, $7252cd45fc48c07c$export$f2be18a910c0caa6)(ref);
18
- }
19
-
20
-
21
- export {$4ac1fdc3a0fcd564$export$2962a7984b2f0a80 as useDraggableCollection};
22
- //# sourceMappingURL=useDraggableCollection.module.js.map
@@ -1,22 +0,0 @@
1
- import {globalDndState as $7252cd45fc48c07c$export$6ca6700462636d0b, setDraggingCollectionRef as $7252cd45fc48c07c$export$f2be18a910c0caa6} from "./utils.module.js";
2
-
3
- /*
4
- * Copyright 2022 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 $4ac1fdc3a0fcd564$export$2962a7984b2f0a80(props, state, ref) {
15
- // Update global DnD state if this keys within this collection are dragged
16
- let { draggingCollectionRef: draggingCollectionRef } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
17
- if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current) (0, $7252cd45fc48c07c$export$f2be18a910c0caa6)(ref);
18
- }
19
-
20
-
21
- export {$4ac1fdc3a0fcd564$export$2962a7984b2f0a80 as useDraggableCollection};
22
- //# sourceMappingURL=useDraggableCollection.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,yCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,yCAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from '@react-types/shared';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.module.js.map"}
@@ -1,128 +0,0 @@
1
- var $4620ae0dc40f0031$exports = require("./utils.main.js");
2
- var $7c8adf3925a26206$exports = require("./intlStrings.main.js");
3
- var $dc204e8ec58447a6$exports = require("./useDrag.main.js");
4
- var $6Ms7J$reactariautils = require("@react-aria/utils");
5
- var $6Ms7J$reactariai18n = require("@react-aria/i18n");
6
-
7
-
8
- function $parcel$interopDefault(a) {
9
- return a && a.__esModule ? a.default : a;
10
- }
11
-
12
- function $parcel$export(e, n, v, s) {
13
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
- }
15
-
16
- $parcel$export(module.exports, "useDraggableItem", () => $0cbbd00cda972c67$export$b35afafff42da2d9);
17
- /*
18
- * Copyright 2020 Adobe. All rights reserved.
19
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
- * you may not use this file except in compliance with the License. You may obtain a copy
21
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
22
- *
23
- * Unless required by applicable law or agreed to in writing, software distributed under
24
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
- * OF ANY KIND, either express or implied. See the License for the specific language
26
- * governing permissions and limitations under the License.
27
- */
28
-
29
-
30
-
31
-
32
- const $0cbbd00cda972c67$var$MESSAGES = {
33
- keyboard: {
34
- selected: 'dragSelectedKeyboard',
35
- notSelected: 'dragDescriptionKeyboard'
36
- },
37
- touch: {
38
- selected: 'dragSelectedLongPress',
39
- notSelected: 'dragDescriptionLongPress'
40
- },
41
- virtual: {
42
- selected: 'dragDescriptionVirtual',
43
- notSelected: 'dragDescriptionVirtual'
44
- }
45
- };
46
- function $0cbbd00cda972c67$export$b35afafff42da2d9(props, state) {
47
- let stringFormatter = (0, $6Ms7J$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7c8adf3925a26206$exports))), '@react-aria/dnd');
48
- let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);
49
- let { dragProps: dragProps, dragButtonProps: dragButtonProps } = (0, $dc204e8ec58447a6$exports.useDrag)({
50
- getItems () {
51
- return state.getItems(props.key);
52
- },
53
- preview: state.preview,
54
- getAllowedDropOperations: state.getAllowedDropOperations,
55
- hasDragButton: props.hasDragButton,
56
- onDragStart (e) {
57
- state.startDrag(props.key, e);
58
- // Track draggingKeys for useDroppableCollection's default onDrop handler and useDroppableCollectionState's default getDropOperation
59
- (0, $4620ae0dc40f0031$exports.setDraggingKeys)(state.draggingKeys);
60
- },
61
- onDragMove (e) {
62
- state.moveDrag(e);
63
- },
64
- onDragEnd (e) {
65
- let { dropOperation: dropOperation } = e;
66
- let isInternal = dropOperation === 'cancel' ? false : (0, $4620ae0dc40f0031$exports.isInternalDropOperation)();
67
- state.endDrag({
68
- ...e,
69
- keys: state.draggingKeys,
70
- isInternal: isInternal
71
- });
72
- (0, $4620ae0dc40f0031$exports.clearGlobalDnDState)();
73
- }
74
- });
75
- let item = state.collection.getItem(props.key);
76
- let numKeysForDrag = state.getKeysForDrag(props.key).size;
77
- let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);
78
- let dragButtonLabel;
79
- let description;
80
- // Override description to include selected item count.
81
- let modality = (0, $4620ae0dc40f0031$exports.useDragModality)();
82
- if (!props.hasDragButton && state.selectionManager.selectionMode !== 'none') {
83
- let msg = $0cbbd00cda972c67$var$MESSAGES[modality][isSelected ? 'selected' : 'notSelected'];
84
- if (props.hasAction && modality === 'keyboard') msg += 'Alt';
85
- if (isSelected) description = stringFormatter.format(msg, {
86
- count: numKeysForDrag
87
- });
88
- else description = stringFormatter.format(msg);
89
- // Remove the onClick handler from useDrag. Long pressing will be required on touch devices,
90
- // and NVDA/JAWS are always in forms mode within collection components.
91
- delete dragProps.onClick;
92
- } else if (isSelected) dragButtonLabel = stringFormatter.format('dragSelectedItems', {
93
- count: numKeysForDrag
94
- });
95
- else {
96
- var _state_collection_getTextValue, _state_collection;
97
- var _state_collection_getTextValue1, _ref;
98
- let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : '';
99
- dragButtonLabel = stringFormatter.format('dragItem', {
100
- itemText: itemText
101
- });
102
- }
103
- let descriptionProps = (0, $6Ms7J$reactariautils.useDescription)(description);
104
- if (description) Object.assign(dragProps, descriptionProps);
105
- if (!props.hasDragButton && props.hasAction) {
106
- let { onKeyDownCapture: onKeyDownCapture, onKeyUpCapture: onKeyUpCapture } = dragProps;
107
- if (modality === 'touch') // Remove long press description if an action is present, because in that case long pressing selects the item.
108
- delete dragProps['aria-describedby'];
109
- // Require Alt key if there is a conflicting action.
110
- dragProps.onKeyDownCapture = (e)=>{
111
- if (e.altKey) onKeyDownCapture === null || onKeyDownCapture === void 0 ? void 0 : onKeyDownCapture(e);
112
- };
113
- dragProps.onKeyUpCapture = (e)=>{
114
- if (e.altKey) onKeyUpCapture === null || onKeyUpCapture === void 0 ? void 0 : onKeyUpCapture(e);
115
- };
116
- }
117
- return {
118
- dragProps: isDisabled ? {} : dragProps,
119
- dragButtonProps: {
120
- ...dragButtonProps,
121
- isDisabled: isDisabled,
122
- 'aria-label': dragButtonLabel
123
- }
124
- };
125
- }
126
-
127
-
128
- //# sourceMappingURL=useDraggableItem.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":"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","sources":["packages/@react-aria/dnd/src/useDraggableItem.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 {AriaButtonProps} from '@react-types/button';\nimport {clearGlobalDnDState, isInternalDropOperation, setDraggingKeys, useDragModality} from './utils';\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {useDescription} from '@react-aria/utils';\nimport {useDrag} from './useDrag';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DraggableItemProps {\n /** The key of the draggable item within the collection. */\n key: Key,\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the item has a primary action (e.g. Enter key or long press) that would\n * conflict with initiating accessible drag and drop. If true, the Alt key must be held to\n * start dragging with a keyboard, and long press is disabled until selection mode is entered.\n * This should be passed from the associated collection item hook (e.g. useOption, useGridListItem, etc.).\n */\n hasAction?: boolean\n}\n\nexport interface DraggableItemResult {\n /** Props for the draggable item. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps\n}\n\nconst MESSAGES = {\n keyboard: {\n selected: 'dragSelectedKeyboard',\n notSelected: 'dragDescriptionKeyboard'\n },\n touch: {\n selected: 'dragSelectedLongPress',\n notSelected: 'dragDescriptionLongPress'\n },\n virtual: {\n selected: 'dragDescriptionVirtual',\n notSelected: 'dragDescriptionVirtual'\n }\n};\n\n/**\n * Handles drag interactions for an item within a draggable collection.\n */\nexport function useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);\n let {dragProps, dragButtonProps} = useDrag({\n getItems() {\n return state.getItems(props.key);\n },\n preview: state.preview,\n getAllowedDropOperations: state.getAllowedDropOperations,\n hasDragButton: props.hasDragButton,\n onDragStart(e) {\n state.startDrag(props.key, e);\n // Track draggingKeys for useDroppableCollection's default onDrop handler and useDroppableCollectionState's default getDropOperation\n setDraggingKeys(state.draggingKeys);\n },\n onDragMove(e) {\n state.moveDrag(e);\n },\n onDragEnd(e) {\n let {dropOperation} = e;\n let isInternal = dropOperation === 'cancel' ? false : isInternalDropOperation();\n state.endDrag({...e, keys: state.draggingKeys, isInternal});\n clearGlobalDnDState();\n }\n });\n\n let item = state.collection.getItem(props.key);\n let numKeysForDrag = state.getKeysForDrag(props.key).size;\n let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);\n let dragButtonLabel: string | undefined;\n let description: string | undefined;\n\n // Override description to include selected item count.\n let modality = useDragModality();\n if (!props.hasDragButton && state.selectionManager.selectionMode !== 'none') {\n let msg = MESSAGES[modality][isSelected ? 'selected' : 'notSelected'];\n if (props.hasAction && modality === 'keyboard') {\n msg += 'Alt';\n }\n\n if (isSelected) {\n description = stringFormatter.format(msg, {count: numKeysForDrag});\n } else {\n description = stringFormatter.format(msg);\n }\n\n // Remove the onClick handler from useDrag. Long pressing will be required on touch devices,\n // and NVDA/JAWS are always in forms mode within collection components.\n delete dragProps.onClick;\n } else {\n if (isSelected) {\n dragButtonLabel = stringFormatter.format('dragSelectedItems', {count: numKeysForDrag});\n } else {\n let itemText = state.collection.getTextValue?.(props.key) ?? item?.textValue ?? '';\n dragButtonLabel = stringFormatter.format('dragItem', {itemText});\n }\n }\n\n let descriptionProps = useDescription(description);\n if (description) {\n Object.assign(dragProps, descriptionProps);\n }\n\n if (!props.hasDragButton && props.hasAction) {\n let {onKeyDownCapture, onKeyUpCapture} = dragProps;\n if (modality === 'touch') {\n // Remove long press description if an action is present, because in that case long pressing selects the item.\n delete dragProps['aria-describedby'];\n }\n\n // Require Alt key if there is a conflicting action.\n dragProps.onKeyDownCapture = e => {\n if (e.altKey) {\n onKeyDownCapture?.(e);\n }\n };\n\n dragProps.onKeyUpCapture = e => {\n if (e.altKey) {\n onKeyUpCapture?.(e);\n }\n };\n }\n\n return {\n dragProps: isDisabled ? {} : dragProps,\n dragButtonProps: {\n ...dragButtonProps,\n isDisabled,\n 'aria-label': dragButtonLabel\n }\n };\n}\n"],"names":[],"version":3,"file":"useDraggableItem.main.js.map"}
@@ -1,123 +0,0 @@
1
- import {clearGlobalDnDState as $7252cd45fc48c07c$export$70936501603e6c57, isInternalDropOperation as $7252cd45fc48c07c$export$78bf638634500fa5, setDraggingKeys as $7252cd45fc48c07c$export$72cb63bdda528276, useDragModality as $7252cd45fc48c07c$export$49bac5d6d4b352ea} from "./utils.mjs";
2
- import $91Fvt$intlStringsmodulejs from "./intlStrings.mjs";
3
- import {useDrag as $8253ed7ece74b463$export$7941f8aafa4b6021} from "./useDrag.mjs";
4
- import {useDescription as $91Fvt$useDescription} from "@react-aria/utils";
5
- import {useLocalizedStringFormatter as $91Fvt$useLocalizedStringFormatter} from "@react-aria/i18n";
6
-
7
-
8
- function $parcel$interopDefault(a) {
9
- return a && a.__esModule ? a.default : a;
10
- }
11
- /*
12
- * Copyright 2020 Adobe. All rights reserved.
13
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License. You may obtain a copy
15
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software distributed under
18
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
- * OF ANY KIND, either express or implied. See the License for the specific language
20
- * governing permissions and limitations under the License.
21
- */
22
-
23
-
24
-
25
-
26
- const $fd98cf7cbf233429$var$MESSAGES = {
27
- keyboard: {
28
- selected: 'dragSelectedKeyboard',
29
- notSelected: 'dragDescriptionKeyboard'
30
- },
31
- touch: {
32
- selected: 'dragSelectedLongPress',
33
- notSelected: 'dragDescriptionLongPress'
34
- },
35
- virtual: {
36
- selected: 'dragDescriptionVirtual',
37
- notSelected: 'dragDescriptionVirtual'
38
- }
39
- };
40
- function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
41
- let stringFormatter = (0, $91Fvt$useLocalizedStringFormatter)((0, ($parcel$interopDefault($91Fvt$intlStringsmodulejs))), '@react-aria/dnd');
42
- let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);
43
- let { dragProps: dragProps, dragButtonProps: dragButtonProps } = (0, $8253ed7ece74b463$export$7941f8aafa4b6021)({
44
- getItems () {
45
- return state.getItems(props.key);
46
- },
47
- preview: state.preview,
48
- getAllowedDropOperations: state.getAllowedDropOperations,
49
- hasDragButton: props.hasDragButton,
50
- onDragStart (e) {
51
- state.startDrag(props.key, e);
52
- // Track draggingKeys for useDroppableCollection's default onDrop handler and useDroppableCollectionState's default getDropOperation
53
- (0, $7252cd45fc48c07c$export$72cb63bdda528276)(state.draggingKeys);
54
- },
55
- onDragMove (e) {
56
- state.moveDrag(e);
57
- },
58
- onDragEnd (e) {
59
- let { dropOperation: dropOperation } = e;
60
- let isInternal = dropOperation === 'cancel' ? false : (0, $7252cd45fc48c07c$export$78bf638634500fa5)();
61
- state.endDrag({
62
- ...e,
63
- keys: state.draggingKeys,
64
- isInternal: isInternal
65
- });
66
- (0, $7252cd45fc48c07c$export$70936501603e6c57)();
67
- }
68
- });
69
- let item = state.collection.getItem(props.key);
70
- let numKeysForDrag = state.getKeysForDrag(props.key).size;
71
- let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);
72
- let dragButtonLabel;
73
- let description;
74
- // Override description to include selected item count.
75
- let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
76
- if (!props.hasDragButton && state.selectionManager.selectionMode !== 'none') {
77
- let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? 'selected' : 'notSelected'];
78
- if (props.hasAction && modality === 'keyboard') msg += 'Alt';
79
- if (isSelected) description = stringFormatter.format(msg, {
80
- count: numKeysForDrag
81
- });
82
- else description = stringFormatter.format(msg);
83
- // Remove the onClick handler from useDrag. Long pressing will be required on touch devices,
84
- // and NVDA/JAWS are always in forms mode within collection components.
85
- delete dragProps.onClick;
86
- } else if (isSelected) dragButtonLabel = stringFormatter.format('dragSelectedItems', {
87
- count: numKeysForDrag
88
- });
89
- else {
90
- var _state_collection_getTextValue, _state_collection;
91
- var _state_collection_getTextValue1, _ref;
92
- let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : '';
93
- dragButtonLabel = stringFormatter.format('dragItem', {
94
- itemText: itemText
95
- });
96
- }
97
- let descriptionProps = (0, $91Fvt$useDescription)(description);
98
- if (description) Object.assign(dragProps, descriptionProps);
99
- if (!props.hasDragButton && props.hasAction) {
100
- let { onKeyDownCapture: onKeyDownCapture, onKeyUpCapture: onKeyUpCapture } = dragProps;
101
- if (modality === 'touch') // Remove long press description if an action is present, because in that case long pressing selects the item.
102
- delete dragProps['aria-describedby'];
103
- // Require Alt key if there is a conflicting action.
104
- dragProps.onKeyDownCapture = (e)=>{
105
- if (e.altKey) onKeyDownCapture === null || onKeyDownCapture === void 0 ? void 0 : onKeyDownCapture(e);
106
- };
107
- dragProps.onKeyUpCapture = (e)=>{
108
- if (e.altKey) onKeyUpCapture === null || onKeyUpCapture === void 0 ? void 0 : onKeyUpCapture(e);
109
- };
110
- }
111
- return {
112
- dragProps: isDisabled ? {} : dragProps,
113
- dragButtonProps: {
114
- ...dragButtonProps,
115
- isDisabled: isDisabled,
116
- 'aria-label': dragButtonLabel
117
- }
118
- };
119
- }
120
-
121
-
122
- export {$fd98cf7cbf233429$export$b35afafff42da2d9 as useDraggableItem};
123
- //# sourceMappingURL=useDraggableItem.module.js.map
@@ -1,123 +0,0 @@
1
- import {clearGlobalDnDState as $7252cd45fc48c07c$export$70936501603e6c57, isInternalDropOperation as $7252cd45fc48c07c$export$78bf638634500fa5, setDraggingKeys as $7252cd45fc48c07c$export$72cb63bdda528276, useDragModality as $7252cd45fc48c07c$export$49bac5d6d4b352ea} from "./utils.module.js";
2
- import $91Fvt$intlStringsmodulejs from "./intlStrings.module.js";
3
- import {useDrag as $8253ed7ece74b463$export$7941f8aafa4b6021} from "./useDrag.module.js";
4
- import {useDescription as $91Fvt$useDescription} from "@react-aria/utils";
5
- import {useLocalizedStringFormatter as $91Fvt$useLocalizedStringFormatter} from "@react-aria/i18n";
6
-
7
-
8
- function $parcel$interopDefault(a) {
9
- return a && a.__esModule ? a.default : a;
10
- }
11
- /*
12
- * Copyright 2020 Adobe. All rights reserved.
13
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License. You may obtain a copy
15
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software distributed under
18
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
- * OF ANY KIND, either express or implied. See the License for the specific language
20
- * governing permissions and limitations under the License.
21
- */
22
-
23
-
24
-
25
-
26
- const $fd98cf7cbf233429$var$MESSAGES = {
27
- keyboard: {
28
- selected: 'dragSelectedKeyboard',
29
- notSelected: 'dragDescriptionKeyboard'
30
- },
31
- touch: {
32
- selected: 'dragSelectedLongPress',
33
- notSelected: 'dragDescriptionLongPress'
34
- },
35
- virtual: {
36
- selected: 'dragDescriptionVirtual',
37
- notSelected: 'dragDescriptionVirtual'
38
- }
39
- };
40
- function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
41
- let stringFormatter = (0, $91Fvt$useLocalizedStringFormatter)((0, ($parcel$interopDefault($91Fvt$intlStringsmodulejs))), '@react-aria/dnd');
42
- let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);
43
- let { dragProps: dragProps, dragButtonProps: dragButtonProps } = (0, $8253ed7ece74b463$export$7941f8aafa4b6021)({
44
- getItems () {
45
- return state.getItems(props.key);
46
- },
47
- preview: state.preview,
48
- getAllowedDropOperations: state.getAllowedDropOperations,
49
- hasDragButton: props.hasDragButton,
50
- onDragStart (e) {
51
- state.startDrag(props.key, e);
52
- // Track draggingKeys for useDroppableCollection's default onDrop handler and useDroppableCollectionState's default getDropOperation
53
- (0, $7252cd45fc48c07c$export$72cb63bdda528276)(state.draggingKeys);
54
- },
55
- onDragMove (e) {
56
- state.moveDrag(e);
57
- },
58
- onDragEnd (e) {
59
- let { dropOperation: dropOperation } = e;
60
- let isInternal = dropOperation === 'cancel' ? false : (0, $7252cd45fc48c07c$export$78bf638634500fa5)();
61
- state.endDrag({
62
- ...e,
63
- keys: state.draggingKeys,
64
- isInternal: isInternal
65
- });
66
- (0, $7252cd45fc48c07c$export$70936501603e6c57)();
67
- }
68
- });
69
- let item = state.collection.getItem(props.key);
70
- let numKeysForDrag = state.getKeysForDrag(props.key).size;
71
- let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);
72
- let dragButtonLabel;
73
- let description;
74
- // Override description to include selected item count.
75
- let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
76
- if (!props.hasDragButton && state.selectionManager.selectionMode !== 'none') {
77
- let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? 'selected' : 'notSelected'];
78
- if (props.hasAction && modality === 'keyboard') msg += 'Alt';
79
- if (isSelected) description = stringFormatter.format(msg, {
80
- count: numKeysForDrag
81
- });
82
- else description = stringFormatter.format(msg);
83
- // Remove the onClick handler from useDrag. Long pressing will be required on touch devices,
84
- // and NVDA/JAWS are always in forms mode within collection components.
85
- delete dragProps.onClick;
86
- } else if (isSelected) dragButtonLabel = stringFormatter.format('dragSelectedItems', {
87
- count: numKeysForDrag
88
- });
89
- else {
90
- var _state_collection_getTextValue, _state_collection;
91
- var _state_collection_getTextValue1, _ref;
92
- let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : '';
93
- dragButtonLabel = stringFormatter.format('dragItem', {
94
- itemText: itemText
95
- });
96
- }
97
- let descriptionProps = (0, $91Fvt$useDescription)(description);
98
- if (description) Object.assign(dragProps, descriptionProps);
99
- if (!props.hasDragButton && props.hasAction) {
100
- let { onKeyDownCapture: onKeyDownCapture, onKeyUpCapture: onKeyUpCapture } = dragProps;
101
- if (modality === 'touch') // Remove long press description if an action is present, because in that case long pressing selects the item.
102
- delete dragProps['aria-describedby'];
103
- // Require Alt key if there is a conflicting action.
104
- dragProps.onKeyDownCapture = (e)=>{
105
- if (e.altKey) onKeyDownCapture === null || onKeyDownCapture === void 0 ? void 0 : onKeyDownCapture(e);
106
- };
107
- dragProps.onKeyUpCapture = (e)=>{
108
- if (e.altKey) onKeyUpCapture === null || onKeyUpCapture === void 0 ? void 0 : onKeyUpCapture(e);
109
- };
110
- }
111
- return {
112
- dragProps: isDisabled ? {} : dragProps,
113
- dragButtonProps: {
114
- ...dragButtonProps,
115
- isDisabled: isDisabled,
116
- 'aria-label': dragButtonLabel
117
- }
118
- };
119
- }
120
-
121
-
122
- export {$fd98cf7cbf233429$export$b35afafff42da2d9 as useDraggableItem};
123
- //# sourceMappingURL=useDraggableItem.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAqCD,MAAM,iCAAW;IACf,UAAU;QACR,UAAU;QACV,aAAa;IACf;IACA,OAAO;QACL,UAAU;QACV,aAAa;IACf;IACA,SAAS;QACP,UAAU;QACV,aAAa;IACf;AACF;AAKO,SAAS,0CAAiB,KAAyB,EAAE,KAA+B;IACzF,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,aAAa,MAAM,UAAU,IAAI,MAAM,gBAAgB,CAAC,UAAU,CAAC,MAAM,GAAG;IAChF,IAAI,aAAC,SAAS,mBAAE,eAAe,EAAC,GAAG,CAAA,GAAA,yCAAM,EAAE;QACzC;YACE,OAAO,MAAM,QAAQ,CAAC,MAAM,GAAG;QACjC;QACA,SAAS,MAAM,OAAO;QACtB,0BAA0B,MAAM,wBAAwB;QACxD,eAAe,MAAM,aAAa;QAClC,aAAY,CAAC;YACX,MAAM,SAAS,CAAC,MAAM,GAAG,EAAE;YAC3B,oIAAoI;YACpI,CAAA,GAAA,yCAAc,EAAE,MAAM,YAAY;QACpC;QACA,YAAW,CAAC;YACV,MAAM,QAAQ,CAAC;QACjB;QACA,WAAU,CAAC;YACT,IAAI,iBAAC,aAAa,EAAC,GAAG;YACtB,IAAI,aAAa,kBAAkB,WAAW,QAAQ,CAAA,GAAA,yCAAsB;YAC5E,MAAM,OAAO,CAAC;gBAAC,GAAG,CAAC;gBAAE,MAAM,MAAM,YAAY;4BAAE;YAAU;YACzD,CAAA,GAAA,yCAAkB;QACpB;IACF;IAEA,IAAI,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG;IAC7C,IAAI,iBAAiB,MAAM,cAAc,CAAC,MAAM,GAAG,EAAE,IAAI;IACzD,IAAI,aAAa,iBAAiB,KAAK,MAAM,gBAAgB,CAAC,UAAU,CAAC,MAAM,GAAG;IAClF,IAAI;IACJ,IAAI;IAEJ,uDAAuD;IACvD,IAAI,WAAW,CAAA,GAAA,yCAAc;IAC7B,IAAI,CAAC,MAAM,aAAa,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK,QAAQ;QAC3E,IAAI,MAAM,8BAAQ,CAAC,SAAS,CAAC,aAAa,aAAa,cAAc;QACrE,IAAI,MAAM,SAAS,IAAI,aAAa,YAClC,OAAO;QAGT,IAAI,YACF,cAAc,gBAAgB,MAAM,CAAC,KAAK;YAAC,OAAO;QAAc;aAEhE,cAAc,gBAAgB,MAAM,CAAC;QAGvC,4FAA4F;QAC5F,uEAAuE;QACvE,OAAO,UAAU,OAAO;IAC1B,OACE,IAAI,YACF,kBAAkB,gBAAgB,MAAM,CAAC,qBAAqB;QAAC,OAAO;IAAc;SAC/E;YACU,gCAAA;YAAA,iCAAA;QAAf,IAAI,WAAW,CAAA,OAAA,CAAA,mCAAA,iCAAA,CAAA,oBAAA,MAAM,UAAU,EAAC,YAAY,cAA7B,qDAAA,oCAAA,mBAAgC,MAAM,GAAG,eAAzC,6CAAA,kCAA8C,iBAAA,2BAAA,KAAM,SAAS,cAA7D,kBAAA,OAAiE;QAChF,kBAAkB,gBAAgB,MAAM,CAAC,YAAY;sBAAC;QAAQ;IAChE;IAGF,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IACtC,IAAI,aACF,OAAO,MAAM,CAAC,WAAW;IAG3B,IAAI,CAAC,MAAM,aAAa,IAAI,MAAM,SAAS,EAAE;QAC3C,IAAI,oBAAC,gBAAgB,kBAAE,cAAc,EAAC,GAAG;QACzC,IAAI,aAAa,SACf,8GAA8G;QAC9G,OAAO,SAAS,CAAC,mBAAmB;QAGtC,oDAAoD;QACpD,UAAU,gBAAgB,GAAG,CAAA;YAC3B,IAAI,EAAE,MAAM,EACV,6BAAA,uCAAA,iBAAmB;QAEvB;QAEA,UAAU,cAAc,GAAG,CAAA;YACzB,IAAI,EAAE,MAAM,EACV,2BAAA,qCAAA,eAAiB;QAErB;IACF;IAEA,OAAO;QACL,WAAW,aAAa,CAAC,IAAI;QAC7B,iBAAiB;YACf,GAAG,eAAe;wBAClB;YACA,cAAc;QAChB;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDraggableItem.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 {AriaButtonProps} from '@react-types/button';\nimport {clearGlobalDnDState, isInternalDropOperation, setDraggingKeys, useDragModality} from './utils';\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {useDescription} from '@react-aria/utils';\nimport {useDrag} from './useDrag';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DraggableItemProps {\n /** The key of the draggable item within the collection. */\n key: Key,\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the item has a primary action (e.g. Enter key or long press) that would\n * conflict with initiating accessible drag and drop. If true, the Alt key must be held to\n * start dragging with a keyboard, and long press is disabled until selection mode is entered.\n * This should be passed from the associated collection item hook (e.g. useOption, useGridListItem, etc.).\n */\n hasAction?: boolean\n}\n\nexport interface DraggableItemResult {\n /** Props for the draggable item. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps\n}\n\nconst MESSAGES = {\n keyboard: {\n selected: 'dragSelectedKeyboard',\n notSelected: 'dragDescriptionKeyboard'\n },\n touch: {\n selected: 'dragSelectedLongPress',\n notSelected: 'dragDescriptionLongPress'\n },\n virtual: {\n selected: 'dragDescriptionVirtual',\n notSelected: 'dragDescriptionVirtual'\n }\n};\n\n/**\n * Handles drag interactions for an item within a draggable collection.\n */\nexport function useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let isDisabled = state.isDisabled || state.selectionManager.isDisabled(props.key);\n let {dragProps, dragButtonProps} = useDrag({\n getItems() {\n return state.getItems(props.key);\n },\n preview: state.preview,\n getAllowedDropOperations: state.getAllowedDropOperations,\n hasDragButton: props.hasDragButton,\n onDragStart(e) {\n state.startDrag(props.key, e);\n // Track draggingKeys for useDroppableCollection's default onDrop handler and useDroppableCollectionState's default getDropOperation\n setDraggingKeys(state.draggingKeys);\n },\n onDragMove(e) {\n state.moveDrag(e);\n },\n onDragEnd(e) {\n let {dropOperation} = e;\n let isInternal = dropOperation === 'cancel' ? false : isInternalDropOperation();\n state.endDrag({...e, keys: state.draggingKeys, isInternal});\n clearGlobalDnDState();\n }\n });\n\n let item = state.collection.getItem(props.key);\n let numKeysForDrag = state.getKeysForDrag(props.key).size;\n let isSelected = numKeysForDrag > 1 && state.selectionManager.isSelected(props.key);\n let dragButtonLabel: string | undefined;\n let description: string | undefined;\n\n // Override description to include selected item count.\n let modality = useDragModality();\n if (!props.hasDragButton && state.selectionManager.selectionMode !== 'none') {\n let msg = MESSAGES[modality][isSelected ? 'selected' : 'notSelected'];\n if (props.hasAction && modality === 'keyboard') {\n msg += 'Alt';\n }\n\n if (isSelected) {\n description = stringFormatter.format(msg, {count: numKeysForDrag});\n } else {\n description = stringFormatter.format(msg);\n }\n\n // Remove the onClick handler from useDrag. Long pressing will be required on touch devices,\n // and NVDA/JAWS are always in forms mode within collection components.\n delete dragProps.onClick;\n } else {\n if (isSelected) {\n dragButtonLabel = stringFormatter.format('dragSelectedItems', {count: numKeysForDrag});\n } else {\n let itemText = state.collection.getTextValue?.(props.key) ?? item?.textValue ?? '';\n dragButtonLabel = stringFormatter.format('dragItem', {itemText});\n }\n }\n\n let descriptionProps = useDescription(description);\n if (description) {\n Object.assign(dragProps, descriptionProps);\n }\n\n if (!props.hasDragButton && props.hasAction) {\n let {onKeyDownCapture, onKeyUpCapture} = dragProps;\n if (modality === 'touch') {\n // Remove long press description if an action is present, because in that case long pressing selects the item.\n delete dragProps['aria-describedby'];\n }\n\n // Require Alt key if there is a conflicting action.\n dragProps.onKeyDownCapture = e => {\n if (e.altKey) {\n onKeyDownCapture?.(e);\n }\n };\n\n dragProps.onKeyUpCapture = e => {\n if (e.altKey) {\n onKeyUpCapture?.(e);\n }\n };\n }\n\n return {\n dragProps: isDisabled ? {} : dragProps,\n dragButtonProps: {\n ...dragButtonProps,\n isDisabled,\n 'aria-label': dragButtonLabel\n }\n };\n}\n"],"names":[],"version":3,"file":"useDraggableItem.module.js.map"}