@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,81 +0,0 @@
1
- var $28e10663603f5ea1$exports = require("./DragManager.main.js");
2
- var $4620ae0dc40f0031$exports = require("./utils.main.js");
3
- var $419982e205c8e8dc$exports = require("./useVirtualDrop.main.js");
4
- var $9Vk6V$react = require("react");
5
-
6
-
7
- function $parcel$export(e, n, v, s) {
8
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
- }
10
-
11
- $parcel$export(module.exports, "useDroppableItem", () => $fc1876157e07bcec$export$f7b0c5d28b66b6a5);
12
- /*
13
- * Copyright 2020 Adobe. All rights reserved.
14
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License. You may obtain a copy
16
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software distributed under
19
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
- * OF ANY KIND, either express or implied. See the License for the specific language
21
- * governing permissions and limitations under the License.
22
- */
23
-
24
-
25
-
26
- function $fc1876157e07bcec$export$f7b0c5d28b66b6a5(options, state, ref) {
27
- let { dropProps: dropProps } = (0, $419982e205c8e8dc$exports.useVirtualDrop)();
28
- let droppableCollectionRef = (0, $4620ae0dc40f0031$exports.getDroppableCollectionRef)(state);
29
- (0, $9Vk6V$react.useEffect)(()=>{
30
- if (ref.current) return $28e10663603f5ea1$exports.registerDropItem({
31
- element: ref.current,
32
- target: options.target,
33
- getDropOperation (types, allowedOperations) {
34
- let { draggingKeys: draggingKeys } = (0, $4620ae0dc40f0031$exports.globalDndState);
35
- let isInternal = (0, $4620ae0dc40f0031$exports.isInternalDropOperation)(droppableCollectionRef);
36
- return state.getDropOperation({
37
- target: options.target,
38
- types: types,
39
- allowedOperations: allowedOperations,
40
- isInternal: isInternal,
41
- draggingKeys: draggingKeys
42
- });
43
- },
44
- activateButtonRef: options.activateButtonRef
45
- });
46
- }, [
47
- ref,
48
- options.target,
49
- state,
50
- droppableCollectionRef,
51
- options.activateButtonRef
52
- ]);
53
- let dragSession = $28e10663603f5ea1$exports.useDragSession();
54
- let { draggingKeys: draggingKeys } = (0, $4620ae0dc40f0031$exports.globalDndState);
55
- let isInternal = (0, $4620ae0dc40f0031$exports.isInternalDropOperation)(droppableCollectionRef);
56
- let isValidDropTarget = dragSession && state.getDropOperation({
57
- target: options.target,
58
- types: (0, $4620ae0dc40f0031$exports.getTypes)(dragSession.dragTarget.items),
59
- allowedOperations: dragSession.dragTarget.allowedDropOperations,
60
- isInternal: isInternal,
61
- draggingKeys: draggingKeys
62
- }) !== 'cancel';
63
- let isDropTarget = state.isDropTarget(options.target);
64
- (0, $9Vk6V$react.useEffect)(()=>{
65
- if (dragSession && isDropTarget && ref.current) ref.current.focus();
66
- }, [
67
- isDropTarget,
68
- dragSession,
69
- ref
70
- ]);
71
- return {
72
- dropProps: {
73
- ...dropProps,
74
- 'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'
75
- },
76
- isDropTarget: isDropTarget
77
- };
78
- }
79
-
80
-
81
- //# sourceMappingURL=useDroppableItem.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA0BM,SAAS,0CAAiB,OAA6B,EAAE,KAA+B,EAAE,GAAkC;IACjI,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,wCAAa;IAC/B,IAAI,yBAAyB,CAAA,GAAA,mDAAwB,EAAE;IACvD,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EACb,OAAO,2CAA6B;YAClC,SAAS,IAAI,OAAO;YACpB,QAAQ,QAAQ,MAAM;YACtB,kBAAiB,KAAK,EAAE,iBAAiB;gBACvC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,wCAAa;gBAClC,IAAI,aAAa,CAAA,GAAA,iDAAsB,EAAE;gBACzC,OAAO,MAAM,gBAAgB,CAAC;oBAC5B,QAAQ,QAAQ,MAAM;2BACtB;uCACA;gCACA;kCACA;gBACF;YACF;YACA,mBAAmB,QAAQ,iBAAiB;QAC9C;IAEJ,GAAG;QAAC;QAAK,QAAQ,MAAM;QAAE;QAAO;QAAwB,QAAQ,iBAAiB;KAAC;IAElF,IAAI,cAAc;IAClB,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,wCAAa;IAClC,IAAI,aAAa,CAAA,GAAA,iDAAsB,EAAE;IACzC,IAAI,oBAAoB,eAAe,MAAM,gBAAgB,CAAC;QAC5D,QAAQ,QAAQ,MAAM;QACtB,OAAO,CAAA,GAAA,kCAAO,EAAE,YAAY,UAAU,CAAC,KAAK;QAC5C,mBAAmB,YAAY,UAAU,CAAC,qBAAqB;oBAC/D;sBACA;IACF,OAAO;IAEP,IAAI,eAAe,MAAM,YAAY,CAAC,QAAQ,MAAM;IACpD,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,eAAe,gBAAgB,IAAI,OAAO,EAC5C,IAAI,OAAO,CAAC,KAAK;IAErB,GAAG;QAAC;QAAc;QAAa;KAAI;IAEnC,OAAO;QACL,WAAW;YACT,GAAG,SAAS;YACZ,eAAe,CAAC,eAAe,oBAAoB,YAAY;QACjE;sBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDroppableItem.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 * as DragManager from './DragManager';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {DropTarget, FocusableElement, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionRef, getTypes, globalDndState, isInternalDropOperation} from './utils';\nimport {HTMLAttributes, useEffect} from 'react';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DroppableItemOptions {\n /** The drop target represented by the item. */\n target: DropTarget,\n /** The ref to the activate button. */\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport interface DroppableItemResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the item is currently the active drop target. */\n isDropTarget: boolean\n}\n\n/**\n * Handles drop interactions for an item within a collection component.\n */\nexport function useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DroppableItemResult {\n let {dropProps} = useVirtualDrop();\n let droppableCollectionRef = getDroppableCollectionRef(state);\n useEffect(() => {\n if (ref.current) {\n return DragManager.registerDropItem({\n element: ref.current,\n target: options.target,\n getDropOperation(types, allowedOperations) {\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(droppableCollectionRef);\n return state.getDropOperation({\n target: options.target,\n types,\n allowedOperations,\n isInternal,\n draggingKeys\n });\n },\n activateButtonRef: options.activateButtonRef\n });\n }\n }, [ref, options.target, state, droppableCollectionRef, options.activateButtonRef]);\n\n let dragSession = DragManager.useDragSession();\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(droppableCollectionRef);\n let isValidDropTarget = dragSession && state.getDropOperation({\n target: options.target,\n types: getTypes(dragSession.dragTarget.items),\n allowedOperations: dragSession.dragTarget.allowedDropOperations,\n isInternal,\n draggingKeys\n }) !== 'cancel';\n\n let isDropTarget = state.isDropTarget(options.target);\n useEffect(() => {\n if (dragSession && isDropTarget && ref.current) {\n ref.current.focus();\n }\n }, [isDropTarget, dragSession, ref]);\n\n return {\n dropProps: {\n ...dropProps,\n 'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'\n },\n isDropTarget\n };\n}\n"],"names":[],"version":3,"file":"useDroppableItem.main.js.map"}
@@ -1,76 +0,0 @@
1
- import {registerDropItem as $67560de7c78cb232$export$aef80212ac99c003, useDragSession as $67560de7c78cb232$export$418e185dd3f1b968} from "./DragManager.mjs";
2
- import {getDroppableCollectionRef as $7252cd45fc48c07c$export$7e397efd01d3db27, getTypes as $7252cd45fc48c07c$export$e1d41611756c6326, globalDndState as $7252cd45fc48c07c$export$6ca6700462636d0b, isInternalDropOperation as $7252cd45fc48c07c$export$78bf638634500fa5} from "./utils.mjs";
3
- import {useVirtualDrop as $224594fe3e57ff1e$export$62447ad3d2ec7da6} from "./useVirtualDrop.mjs";
4
- import {useEffect as $iZAZb$useEffect} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(options, state, ref) {
21
- let { dropProps: dropProps } = (0, $224594fe3e57ff1e$export$62447ad3d2ec7da6)();
22
- let droppableCollectionRef = (0, $7252cd45fc48c07c$export$7e397efd01d3db27)(state);
23
- (0, $iZAZb$useEffect)(()=>{
24
- if (ref.current) return $67560de7c78cb232$export$aef80212ac99c003({
25
- element: ref.current,
26
- target: options.target,
27
- getDropOperation (types, allowedOperations) {
28
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
29
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(droppableCollectionRef);
30
- return state.getDropOperation({
31
- target: options.target,
32
- types: types,
33
- allowedOperations: allowedOperations,
34
- isInternal: isInternal,
35
- draggingKeys: draggingKeys
36
- });
37
- },
38
- activateButtonRef: options.activateButtonRef
39
- });
40
- }, [
41
- ref,
42
- options.target,
43
- state,
44
- droppableCollectionRef,
45
- options.activateButtonRef
46
- ]);
47
- let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
48
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
49
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(droppableCollectionRef);
50
- let isValidDropTarget = dragSession && state.getDropOperation({
51
- target: options.target,
52
- types: (0, $7252cd45fc48c07c$export$e1d41611756c6326)(dragSession.dragTarget.items),
53
- allowedOperations: dragSession.dragTarget.allowedDropOperations,
54
- isInternal: isInternal,
55
- draggingKeys: draggingKeys
56
- }) !== 'cancel';
57
- let isDropTarget = state.isDropTarget(options.target);
58
- (0, $iZAZb$useEffect)(()=>{
59
- if (dragSession && isDropTarget && ref.current) ref.current.focus();
60
- }, [
61
- isDropTarget,
62
- dragSession,
63
- ref
64
- ]);
65
- return {
66
- dropProps: {
67
- ...dropProps,
68
- 'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'
69
- },
70
- isDropTarget: isDropTarget
71
- };
72
- }
73
-
74
-
75
- export {$bfaab576ce1c580e$export$f7b0c5d28b66b6a5 as useDroppableItem};
76
- //# sourceMappingURL=useDroppableItem.module.js.map
@@ -1,76 +0,0 @@
1
- import {registerDropItem as $67560de7c78cb232$export$aef80212ac99c003, useDragSession as $67560de7c78cb232$export$418e185dd3f1b968} from "./DragManager.module.js";
2
- import {getDroppableCollectionRef as $7252cd45fc48c07c$export$7e397efd01d3db27, getTypes as $7252cd45fc48c07c$export$e1d41611756c6326, globalDndState as $7252cd45fc48c07c$export$6ca6700462636d0b, isInternalDropOperation as $7252cd45fc48c07c$export$78bf638634500fa5} from "./utils.module.js";
3
- import {useVirtualDrop as $224594fe3e57ff1e$export$62447ad3d2ec7da6} from "./useVirtualDrop.module.js";
4
- import {useEffect as $iZAZb$useEffect} from "react";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(options, state, ref) {
21
- let { dropProps: dropProps } = (0, $224594fe3e57ff1e$export$62447ad3d2ec7da6)();
22
- let droppableCollectionRef = (0, $7252cd45fc48c07c$export$7e397efd01d3db27)(state);
23
- (0, $iZAZb$useEffect)(()=>{
24
- if (ref.current) return $67560de7c78cb232$export$aef80212ac99c003({
25
- element: ref.current,
26
- target: options.target,
27
- getDropOperation (types, allowedOperations) {
28
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
29
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(droppableCollectionRef);
30
- return state.getDropOperation({
31
- target: options.target,
32
- types: types,
33
- allowedOperations: allowedOperations,
34
- isInternal: isInternal,
35
- draggingKeys: draggingKeys
36
- });
37
- },
38
- activateButtonRef: options.activateButtonRef
39
- });
40
- }, [
41
- ref,
42
- options.target,
43
- state,
44
- droppableCollectionRef,
45
- options.activateButtonRef
46
- ]);
47
- let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
48
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
49
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(droppableCollectionRef);
50
- let isValidDropTarget = dragSession && state.getDropOperation({
51
- target: options.target,
52
- types: (0, $7252cd45fc48c07c$export$e1d41611756c6326)(dragSession.dragTarget.items),
53
- allowedOperations: dragSession.dragTarget.allowedDropOperations,
54
- isInternal: isInternal,
55
- draggingKeys: draggingKeys
56
- }) !== 'cancel';
57
- let isDropTarget = state.isDropTarget(options.target);
58
- (0, $iZAZb$useEffect)(()=>{
59
- if (dragSession && isDropTarget && ref.current) ref.current.focus();
60
- }, [
61
- isDropTarget,
62
- dragSession,
63
- ref
64
- ]);
65
- return {
66
- dropProps: {
67
- ...dropProps,
68
- 'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'
69
- },
70
- isDropTarget: isDropTarget
71
- };
72
- }
73
-
74
-
75
- export {$bfaab576ce1c580e$export$f7b0c5d28b66b6a5 as useDroppableItem};
76
- //# sourceMappingURL=useDroppableItem.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA0BM,SAAS,0CAAiB,OAA6B,EAAE,KAA+B,EAAE,GAAkC;IACjI,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAa;IAC/B,IAAI,yBAAyB,CAAA,GAAA,yCAAwB,EAAE;IACvD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EACb,OAAO,0CAA6B;YAClC,SAAS,IAAI,OAAO;YACpB,QAAQ,QAAQ,MAAM;YACtB,kBAAiB,KAAK,EAAE,iBAAiB;gBACvC,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAa;gBAClC,IAAI,aAAa,CAAA,GAAA,yCAAsB,EAAE;gBACzC,OAAO,MAAM,gBAAgB,CAAC;oBAC5B,QAAQ,QAAQ,MAAM;2BACtB;uCACA;gCACA;kCACA;gBACF;YACF;YACA,mBAAmB,QAAQ,iBAAiB;QAC9C;IAEJ,GAAG;QAAC;QAAK,QAAQ,MAAM;QAAE;QAAO;QAAwB,QAAQ,iBAAiB;KAAC;IAElF,IAAI,cAAc;IAClB,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,yCAAa;IAClC,IAAI,aAAa,CAAA,GAAA,yCAAsB,EAAE;IACzC,IAAI,oBAAoB,eAAe,MAAM,gBAAgB,CAAC;QAC5D,QAAQ,QAAQ,MAAM;QACtB,OAAO,CAAA,GAAA,yCAAO,EAAE,YAAY,UAAU,CAAC,KAAK;QAC5C,mBAAmB,YAAY,UAAU,CAAC,qBAAqB;oBAC/D;sBACA;IACF,OAAO;IAEP,IAAI,eAAe,MAAM,YAAY,CAAC,QAAQ,MAAM;IACpD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,eAAe,gBAAgB,IAAI,OAAO,EAC5C,IAAI,OAAO,CAAC,KAAK;IAErB,GAAG;QAAC;QAAc;QAAa;KAAI;IAEnC,OAAO;QACL,WAAW;YACT,GAAG,SAAS;YACZ,eAAe,CAAC,eAAe,oBAAoB,YAAY;QACjE;sBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDroppableItem.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 * as DragManager from './DragManager';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {DropTarget, FocusableElement, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionRef, getTypes, globalDndState, isInternalDropOperation} from './utils';\nimport {HTMLAttributes, useEffect} from 'react';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DroppableItemOptions {\n /** The drop target represented by the item. */\n target: DropTarget,\n /** The ref to the activate button. */\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport interface DroppableItemResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the item is currently the active drop target. */\n isDropTarget: boolean\n}\n\n/**\n * Handles drop interactions for an item within a collection component.\n */\nexport function useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DroppableItemResult {\n let {dropProps} = useVirtualDrop();\n let droppableCollectionRef = getDroppableCollectionRef(state);\n useEffect(() => {\n if (ref.current) {\n return DragManager.registerDropItem({\n element: ref.current,\n target: options.target,\n getDropOperation(types, allowedOperations) {\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(droppableCollectionRef);\n return state.getDropOperation({\n target: options.target,\n types,\n allowedOperations,\n isInternal,\n draggingKeys\n });\n },\n activateButtonRef: options.activateButtonRef\n });\n }\n }, [ref, options.target, state, droppableCollectionRef, options.activateButtonRef]);\n\n let dragSession = DragManager.useDragSession();\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(droppableCollectionRef);\n let isValidDropTarget = dragSession && state.getDropOperation({\n target: options.target,\n types: getTypes(dragSession.dragTarget.items),\n allowedOperations: dragSession.dragTarget.allowedDropOperations,\n isInternal,\n draggingKeys\n }) !== 'cancel';\n\n let isDropTarget = state.isDropTarget(options.target);\n useEffect(() => {\n if (dragSession && isDropTarget && ref.current) {\n ref.current.focus();\n }\n }, [isDropTarget, dragSession, ref]);\n\n return {\n dropProps: {\n ...dropProps,\n 'aria-hidden': !dragSession || isValidDropTarget ? undefined : 'true'\n },\n isDropTarget\n };\n}\n"],"names":[],"version":3,"file":"useDroppableItem.module.js.map"}
@@ -1,56 +0,0 @@
1
- var $28e10663603f5ea1$exports = require("./DragManager.main.js");
2
- var $7c8adf3925a26206$exports = require("./intlStrings.main.js");
3
- var $4620ae0dc40f0031$exports = require("./utils.main.js");
4
- var $iGjBd$reactariautils = require("@react-aria/utils");
5
- var $iGjBd$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, "useVirtualDrop", () => $419982e205c8e8dc$export$62447ad3d2ec7da6);
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 $419982e205c8e8dc$var$MESSAGES = {
33
- keyboard: 'dropDescriptionKeyboard',
34
- touch: 'dropDescriptionTouch',
35
- virtual: 'dropDescriptionVirtual'
36
- };
37
- function $419982e205c8e8dc$export$62447ad3d2ec7da6() {
38
- let stringFormatter = (0, $iGjBd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7c8adf3925a26206$exports))), '@react-aria/dnd');
39
- let modality = (0, $4620ae0dc40f0031$exports.useDragModality)();
40
- let dragSession = $28e10663603f5ea1$exports.useDragSession();
41
- let descriptionProps = (0, $iGjBd$reactariautils.useDescription)(dragSession ? stringFormatter.format($419982e205c8e8dc$var$MESSAGES[modality]) : '');
42
- return {
43
- dropProps: {
44
- ...descriptionProps,
45
- // Mobile Safari does not properly bubble click events on elements except links or inputs
46
- // unless there is an onclick handler bound directly to the element itself. By adding this
47
- // handler, React will take care of adding that for us, and we are able to handle document
48
- // level click events in the DragManager.
49
- // See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
50
- onClick: ()=>{}
51
- }
52
- };
53
- }
54
-
55
-
56
- //# sourceMappingURL=useVirtualDrop.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAeD,MAAM,iCAAW;IACf,UAAU;IACV,OAAO;IACP,SAAS;AACX;AAEO,SAAS;IACd,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,WAAW,CAAA,GAAA,yCAAc;IAC7B,IAAI,cAAc;IAClB,IAAI,mBAAmB,CAAA,GAAA,oCAAa,EAAE,cAAc,gBAAgB,MAAM,CAAC,8BAAQ,CAAC,SAAS,IAAI;IAEjG,OAAO;QACL,WAAW;YACT,GAAG,gBAAgB;YACnB,yFAAyF;YACzF,0FAA0F;YAC1F,0FAA0F;YAC1F,yCAAyC;YACzC,4EAA4E;YAC5E,SAAS,KAAO;QAClB;IACF;AACF","sources":["packages/@react-aria/dnd/src/useVirtualDrop.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 {DOMAttributes} from 'react';\nimport * as DragManager from './DragManager';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDescription} from '@react-aria/utils';\nimport {useDragModality} from './utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface VirtualDropResult {\n dropProps: AriaButtonProps & DOMAttributes<HTMLDivElement>\n}\n\nconst MESSAGES = {\n keyboard: 'dropDescriptionKeyboard',\n touch: 'dropDescriptionTouch',\n virtual: 'dropDescriptionVirtual'\n};\n\nexport function useVirtualDrop(): VirtualDropResult {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let modality = useDragModality();\n let dragSession = DragManager.useDragSession();\n let descriptionProps = useDescription(dragSession ? stringFormatter.format(MESSAGES[modality]) : '');\n\n return {\n dropProps: {\n ...descriptionProps,\n // Mobile Safari does not properly bubble click events on elements except links or inputs\n // unless there is an onclick handler bound directly to the element itself. By adding this\n // handler, React will take care of adding that for us, and we are able to handle document\n // level click events in the DragManager.\n // See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html\n onClick: () => {}\n }\n };\n}\n"],"names":[],"version":3,"file":"useVirtualDrop.main.js.map"}
@@ -1,51 +0,0 @@
1
- import {useDragSession as $67560de7c78cb232$export$418e185dd3f1b968} from "./DragManager.mjs";
2
- import $gKRvW$intlStringsmodulejs from "./intlStrings.mjs";
3
- import {useDragModality as $7252cd45fc48c07c$export$49bac5d6d4b352ea} from "./utils.mjs";
4
- import {useDescription as $gKRvW$useDescription} from "@react-aria/utils";
5
- import {useLocalizedStringFormatter as $gKRvW$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 $224594fe3e57ff1e$var$MESSAGES = {
27
- keyboard: 'dropDescriptionKeyboard',
28
- touch: 'dropDescriptionTouch',
29
- virtual: 'dropDescriptionVirtual'
30
- };
31
- function $224594fe3e57ff1e$export$62447ad3d2ec7da6() {
32
- let stringFormatter = (0, $gKRvW$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gKRvW$intlStringsmodulejs))), '@react-aria/dnd');
33
- let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
34
- let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
35
- let descriptionProps = (0, $gKRvW$useDescription)(dragSession ? stringFormatter.format($224594fe3e57ff1e$var$MESSAGES[modality]) : '');
36
- return {
37
- dropProps: {
38
- ...descriptionProps,
39
- // Mobile Safari does not properly bubble click events on elements except links or inputs
40
- // unless there is an onclick handler bound directly to the element itself. By adding this
41
- // handler, React will take care of adding that for us, and we are able to handle document
42
- // level click events in the DragManager.
43
- // See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
44
- onClick: ()=>{}
45
- }
46
- };
47
- }
48
-
49
-
50
- export {$224594fe3e57ff1e$export$62447ad3d2ec7da6 as useVirtualDrop};
51
- //# sourceMappingURL=useVirtualDrop.module.js.map
@@ -1,51 +0,0 @@
1
- import {useDragSession as $67560de7c78cb232$export$418e185dd3f1b968} from "./DragManager.module.js";
2
- import $gKRvW$intlStringsmodulejs from "./intlStrings.module.js";
3
- import {useDragModality as $7252cd45fc48c07c$export$49bac5d6d4b352ea} from "./utils.module.js";
4
- import {useDescription as $gKRvW$useDescription} from "@react-aria/utils";
5
- import {useLocalizedStringFormatter as $gKRvW$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 $224594fe3e57ff1e$var$MESSAGES = {
27
- keyboard: 'dropDescriptionKeyboard',
28
- touch: 'dropDescriptionTouch',
29
- virtual: 'dropDescriptionVirtual'
30
- };
31
- function $224594fe3e57ff1e$export$62447ad3d2ec7da6() {
32
- let stringFormatter = (0, $gKRvW$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gKRvW$intlStringsmodulejs))), '@react-aria/dnd');
33
- let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
34
- let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
35
- let descriptionProps = (0, $gKRvW$useDescription)(dragSession ? stringFormatter.format($224594fe3e57ff1e$var$MESSAGES[modality]) : '');
36
- return {
37
- dropProps: {
38
- ...descriptionProps,
39
- // Mobile Safari does not properly bubble click events on elements except links or inputs
40
- // unless there is an onclick handler bound directly to the element itself. By adding this
41
- // handler, React will take care of adding that for us, and we are able to handle document
42
- // level click events in the DragManager.
43
- // See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
44
- onClick: ()=>{}
45
- }
46
- };
47
- }
48
-
49
-
50
- export {$224594fe3e57ff1e$export$62447ad3d2ec7da6 as useVirtualDrop};
51
- //# sourceMappingURL=useVirtualDrop.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAeD,MAAM,iCAAW;IACf,UAAU;IACV,OAAO;IACP,SAAS;AACX;AAEO,SAAS;IACd,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,WAAW,CAAA,GAAA,yCAAc;IAC7B,IAAI,cAAc;IAClB,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE,cAAc,gBAAgB,MAAM,CAAC,8BAAQ,CAAC,SAAS,IAAI;IAEjG,OAAO;QACL,WAAW;YACT,GAAG,gBAAgB;YACnB,yFAAyF;YACzF,0FAA0F;YAC1F,0FAA0F;YAC1F,yCAAyC;YACzC,4EAA4E;YAC5E,SAAS,KAAO;QAClB;IACF;AACF","sources":["packages/@react-aria/dnd/src/useVirtualDrop.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 {DOMAttributes} from 'react';\nimport * as DragManager from './DragManager';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDescription} from '@react-aria/utils';\nimport {useDragModality} from './utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface VirtualDropResult {\n dropProps: AriaButtonProps & DOMAttributes<HTMLDivElement>\n}\n\nconst MESSAGES = {\n keyboard: 'dropDescriptionKeyboard',\n touch: 'dropDescriptionTouch',\n virtual: 'dropDescriptionVirtual'\n};\n\nexport function useVirtualDrop(): VirtualDropResult {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let modality = useDragModality();\n let dragSession = DragManager.useDragSession();\n let descriptionProps = useDescription(dragSession ? stringFormatter.format(MESSAGES[modality]) : '');\n\n return {\n dropProps: {\n ...descriptionProps,\n // Mobile Safari does not properly bubble click events on elements except links or inputs\n // unless there is an onclick handler bound directly to the element itself. By adding this\n // handler, React will take care of adding that for us, and we are able to handle document\n // level click events in the DragManager.\n // See https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html\n onClick: () => {}\n }\n };\n}\n"],"names":[],"version":3,"file":"useVirtualDrop.module.js.map"}