@react-aria/dnd 3.11.5 → 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 -519
  10. package/dist/DragManager.main.js.map +0 -1
  11. package/dist/DragManager.mjs +0 -510
  12. package/dist/DragManager.module.js +0 -510
  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 -205
  20. package/dist/DropTargetKeyboardNavigation.main.js.map +0 -1
  21. package/dist/DropTargetKeyboardNavigation.mjs +0 -200
  22. package/dist/DropTargetKeyboardNavigation.module.js +0 -200
  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 -656
  267. package/src/DragPreview.tsx +0 -81
  268. package/src/DropTargetKeyboardNavigation.ts +0 -282
  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 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA+DM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,IAAI,aAAa,CAAA,GAAA,mBAAK,EAKnB;eACD;eACA;QACA,YAAY;QACZ,eAAe;IACjB,GAAG,OAAO;IACV,WAAW,KAAK,GAAG;IACnB,WAAW,KAAK,GAAG;IAEnB,IAAI,gBAAgB,CAAA,GAAA,wBAAU,EAAE,OAAO;QACrC,IAAI,YACF,QAAQ,cACR,UAAU,cACV,UAAU,aACV,SAAS,UACT,MAAM,qBACN,oBAAoB,6BACpB,oBAAoB,EACrB,GAAG,WAAW,K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AA,WAAW,KAAK,EAAC,SAAS,cAA1B,kDAAA,iCAAA,mBAA6B;YAC/B;QACF;IACF,GAAG;QAAC;QAAY;QAAK;QAAQ;KAAU;IAEvC,IAAI,KAAK,CAAA,GAAA,2BAAI;IACb,CAAA,GAAA,gDAAqB,EAAE,GAAG,CAAC,OAAO;YAAC;aAAI;IAAG;IAC1C,OAAO;QACL,iBAAiB,CAAA,GAAA,gCAAS,EAAE,WAAW;gBACrC;YACA,oFAAoF;YACpF,6FAA6F;YAC7F,oBAAoB;QACtB;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDroppableCollection.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 {\n clearGlobalDnDState,\n DIRECTORY_DRAG_TYPE,\n droppableCollectionMap,\n getTypes,\n globalDndState,\n isInternalDropOperation,\n setDropCollectionRef\n} from './utils';\nimport {\n Collection,\n DropEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionProps,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n Key,\n KeyboardDelegate,\n Node,\n RefObject\n} from '@react-types/shared';\nimport * as DragManager from './DragManager';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {HTMLAttributes, useCallback, useEffect, useRef} from 'react';\nimport {mergeProps, useId, useLayoutEffect} from '@react-aria/utils';\nimport {navigate} from './DropTargetKeyboardNavigation';\nimport {setInteractionModality} from '@react-aria/interactions';\nimport {useAutoScroll} from './useAutoScroll';\nimport {useDrop} from './useDrop';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface DroppableCollectionOptions extends DroppableCollectionProps {\n /** A delegate object that implements behavior for keyboard focus movement. */\n keyboardDelegate: KeyboardDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate: DropTargetDelegate,\n /** A custom keyboard event handler for drop targets. */\n onKeyDown?: (e: KeyboardEvent) => void\n}\n\nexport interface DroppableCollectionResult {\n /** Props for the collection element. */\n collectionProps: HTMLAttributes<HTMLElement>\n}\n\ninterface DroppingState {\n collection: Collection<Node<unknown>>,\n focusedKey: Key | null,\n selectedKeys: Set<Key>,\n target: DropTarget,\n draggingKeys: Set<Key | null | undefined>,\n isInternal: boolean,\n timeout: ReturnType<typeof setTimeout> | undefined\n}\n\n/**\n * Handles drop 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 useDroppableCollection(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DroppableCollectionResult {\n let localState = useRef<{\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n nextTarget: DropTarget | null,\n dropOperation: DropOperation | null\n }>({\n props,\n state,\n nextTarget: null,\n dropOperation: null\n }).current;\n localState.props = props;\n localState.state = state;\n\n let defaultOnDrop = useCallback(async (e: DroppableCollectionDropEvent) => {\n let {\n onInsert,\n onRootDrop,\n onItemDrop,\n onReorder,\n onMove,\n acceptedDragTypes = 'all',\n shouldAcceptItemDrop\n } = localState.props;\n\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n let {\n target,\n dropOperation,\n items\n } = e;\n\n let filteredItems = items;\n if (acceptedDragTypes !== 'all' || shouldAcceptItemDrop) {\n filteredItems = items.filter(item => {\n let itemTypes: Set<string | symbol>;\n if (item.kind === 'directory') {\n itemTypes = new Set([DIRECTORY_DRAG_TYPE]);\n } else {\n itemTypes = item.kind === 'file' ? new Set([item.type]) : item.types;\n }\n\n if (acceptedDragTypes === 'all' || acceptedDragTypes.some(type => itemTypes.has(type))) {\n // If we are performing a on item drop, check if the item in question accepts the dropped item since the item may have heavier restrictions\n // than the droppable collection itself\n if (target.type === 'item' && target.dropPosition === 'on' && shouldAcceptItemDrop) {\n return shouldAcceptItemDrop(target, itemTypes);\n }\n return true;\n }\n\n return false;\n });\n }\n\n if (filteredItems.length > 0) {\n if (target.type === 'root' && onRootDrop) {\n await onRootDrop({items: filteredItems, dropOperation});\n }\n\n if (target.type === 'item') {\n if (target.dropPosition === 'on' && onItemDrop) {\n await onItemDrop({items: filteredItems, dropOperation, isInternal, target});\n }\n\n if (onMove && isInternal) {\n await onMove({keys: draggingKeys, dropOperation, target});\n }\n\n if (target.dropPosition !== 'on') {\n if (!isInternal && onInsert) {\n await onInsert({items: filteredItems, dropOperation, target});\n }\n\n if (isInternal && onReorder) {\n await onReorder({keys: draggingKeys, dropOperation, target});\n }\n }\n }\n }\n }, [localState, ref]);\n\n let autoScroll = useAutoScroll(ref);\n let {dropProps} = useDrop({\n ref,\n onDropEnter() {\n if (localState.nextTarget != null) {\n state.setTarget(localState.nextTarget);\n }\n },\n onDropMove(e) {\n if (localState.nextTarget != null) {\n state.setTarget(localState.nextTarget);\n }\n autoScroll.move(e.x, e.y);\n },\n getDropOperationForPoint(types, allowedOperations, x, y) {\n let {draggingKeys, dropCollectionRef} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n let isValidDropTarget = (target) => state.getDropOperation({target, types, allowedOperations, isInternal, draggingKeys}) !== 'cancel';\n let target = props.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);\n if (!target) {\n localState.dropOperation = 'cancel';\n localState.nextTarget = null;\n return 'cancel';\n }\n\n localState.dropOperation = state.getDropOperation({target, types, allowedOperations, isInternal, draggingKeys});\n\n // If the target doesn't accept the drop, see if the root accepts it instead.\n if (localState.dropOperation === 'cancel') {\n let rootTarget: DropTarget = {type: 'root'};\n let dropOperation = state.getDropOperation({target: rootTarget, types, allowedOperations, isInternal, draggingKeys});\n if (dropOperation !== 'cancel') {\n target = rootTarget;\n localState.dropOperation = dropOperation;\n }\n }\n\n // Only set dropCollectionRef if there is a valid drop target since we cleanup dropCollectionRef in onDropExit\n // which only runs when leaving a valid drop target or if the dropEffect become none (mouse dnd only).\n if (target && localState.dropOperation !== 'cancel' && ref?.current !== dropCollectionRef?.current) {\n setDropCollectionRef(ref);\n }\n localState.nextTarget = localState.dropOperation === 'cancel' ? null : target;\n return localState.dropOperation;\n },\n onDropExit() {\n setDropCollectionRef(undefined);\n state.setTarget(null);\n autoScroll.stop();\n },\n onDropActivate(e) {\n if (state.target?.type === 'item' && typeof props.onDropActivate === 'function') {\n props.onDropActivate({\n type: 'dropactivate',\n x: e.x, // todo\n y: e.y,\n target: state.target\n });\n }\n },\n onDrop(e) {\n setDropCollectionRef(ref);\n if (state.target) {\n onDrop(e, state.target);\n }\n\n // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n // RSP collection and thus we don't need to preserve the global DnD state for onDragEnd\n let {draggingCollectionRef} = globalDndState;\n if (draggingCollectionRef == null) {\n clearGlobalDnDState();\n }\n }\n });\n\n let droppingState = useRef<DroppingState>(null);\n let updateFocusAfterDrop = useCallback(() => {\n let {state} = localState;\n if (droppingState.current) {\n let {\n target,\n collection: prevCollection,\n selectedKeys: prevSelectedKeys,\n focusedKey: prevFocusedKey,\n isInternal,\n draggingKeys\n } = droppingState.current;\n\n // If an insert occurs during a drop, we want to immediately select these items to give\n // feedback to the user that a drop occurred. Only do this if the selection didn't change\n // since the drop started so we don't override if the user or application did something.\n if (\n state.collection.size > prevCollection.size &&\n state.selectionManager.isSelectionEqual(prevSelectedKeys)\n ) {\n let newKeys = new Set<Key>();\n for (let key of state.collection.getKeys()) {\n if (!prevCollection.getItem(key)) {\n newKeys.add(key);\n }\n }\n\n state.selectionManager.setSelectedKeys(newKeys);\n\n // If the focused item didn't change since the drop occurred, also focus the first\n // inserted item. If selection is disabled, then also show the focus ring so there\n // is some indication that items were added.\n if (state.selectionManager.focusedKey === prevFocusedKey) {\n let first: Key | null | undefined = newKeys.keys().next().value;\n if (first != null) {\n let item = state.collection.getItem(first);\n\n // If this is a cell, focus the parent row.\n // eslint-disable-next-line max-depth\n if (item?.type === 'cell') {\n first = item.parentKey;\n }\n\n // eslint-disable-next-line max-depth\n if (first != null) {\n state.selectionManager.setFocusedKey(first);\n }\n\n // eslint-disable-next-line max-depth\n if (state.selectionManager.selectionMode === 'none') {\n setInteractionModality('keyboard');\n }\n }\n }\n } else if (\n prevFocusedKey != null &&\n state.selectionManager.focusedKey === prevFocusedKey &&\n isInternal &&\n target.type === 'item' &&\n target.dropPosition !== 'on' &&\n draggingKeys.has(state.collection.getItem(prevFocusedKey)?.parentKey)\n ) {\n // Focus row instead of cell when reordering.\n state.selectionManager.setFocusedKey(state.collection.getItem(prevFocusedKey)?.parentKey ?? null);\n setInteractionModality('keyboard');\n } else if (\n state.selectionManager.focusedKey === prevFocusedKey &&\n target.type === 'item' &&\n target.dropPosition === 'on' &&\n state.collection.getItem(target.key) != null\n ) {\n // If focus didn't move already (e.g. due to an insert), and the user dropped on an item,\n // focus that item and show the focus ring to give the user feedback that the drop occurred.\n // Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.\n state.selectionManager.setFocusedKey(target.key);\n setInteractionModality('keyboard');\n } else if (state.selectionManager.focusedKey != null && !state.selectionManager.isSelected(state.selectionManager.focusedKey)) {\n setInteractionModality('keyboard');\n }\n\n state.selectionManager.setFocused(true);\n }\n }, [localState]);\n\n let onDrop = useCallback((e: DropEvent, target: DropTarget) => {\n let {state} = localState;\n\n // Save some state of the collection/selection before the drop occurs so we can compare later.\n droppingState.current = {\n timeout: undefined,\n focusedKey: state.selectionManager.focusedKey,\n collection: state.collection,\n selectedKeys: state.selectionManager.selectedKeys,\n draggingKeys: globalDndState.draggingKeys,\n isInternal: isInternalDropOperation(ref),\n target\n };\n\n let onDropFn = localState.props.onDrop || defaultOnDrop;\n onDropFn({\n type: 'drop',\n x: e.x, // todo\n y: e.y,\n target,\n items: e.items,\n dropOperation: e.dropOperation\n });\n\n // Wait for a short time period after the onDrop is called to allow the data to be read asynchronously\n // and for React to re-render. If the collection didn't already change during this time (handled below),\n // update the focused key here.\n droppingState.current.timeout = setTimeout(() => {\n updateFocusAfterDrop();\n droppingState.current = null;\n }, 50);\n }, [localState, defaultOnDrop, ref, updateFocusAfterDrop]);\n\n\n useEffect(() => {\n return () => {\n if (droppingState.current) {\n clearTimeout(droppingState.current.timeout);\n }\n };\n }, []);\n\n useLayoutEffect(() => {\n // If the collection changed after a drop, update the focused key.\n if (droppingState.current && state.collection !== droppingState.current.collection) {\n updateFocusAfterDrop();\n }\n });\n\n let {direction} = useLocale();\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n let getNextTarget = (target: DropTarget | null | undefined, wrap = true, key: 'left' | 'right' | 'up' | 'down' = 'down') => {\n return navigate(localState.props.keyboardDelegate, localState.state.collection, target, key, direction === 'rtl', wrap);\n };\n\n let getPreviousTarget = (target: DropTarget | null | undefined, wrap = true) => {\n return getNextTarget(target, wrap, 'up');\n };\n\n let nextValidTarget = (\n target: DropTarget | null | undefined,\n types: Set<string>,\n allowedDropOperations: DropOperation[],\n getNextTarget: (target: DropTarget | null | undefined, wrap: boolean) => DropTarget | null,\n wrap = true\n ): DropTarget | null => {\n let seenRoot = 0;\n let operation: DropOperation;\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n do {\n let nextTarget = getNextTarget(target, wrap);\n if (!nextTarget) {\n return null;\n }\n target = nextTarget;\n operation = localState.state.getDropOperation({target: nextTarget, types, allowedOperations: allowedDropOperations, isInternal, draggingKeys});\n if (target.type === 'root') {\n seenRoot++;\n }\n } while (\n operation === 'cancel' &&\n !localState.state.isDropTarget(target) &&\n seenRoot < 2\n );\n\n if (operation === 'cancel') {\n return null;\n }\n\n return target;\n };\n\n return DragManager.registerDropTarget({\n element: ref.current,\n preventFocusOnDrop: true,\n getDropOperation(types, allowedOperations) {\n if (localState.state.target) {\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n return localState.state.getDropOperation({target: localState.state.target, types, allowedOperations, isInternal, draggingKeys});\n }\n\n // Check if any of the targets accept the drop.\n // TODO: should we have a faster way of doing this or e.g. for pagination?\n let target = nextValidTarget(null, types, allowedOperations, getNextTarget);\n return target ? 'move' : 'cancel';\n },\n onDropEnter(e, drag) {\n let types = getTypes(drag.items);\n let selectionManager = localState.state.selectionManager;\n let target: DropTarget | null = null;\n // Update the drop collection ref tracker for useDroppableItem's getDropOperation isInternal check\n setDropCollectionRef(ref);\n\n // When entering the droppable collection for the first time, the default drop target\n // is after the focused key.\n let key: Key | null | undefined = selectionManager.focusedKey;\n let dropPosition: DropPosition = 'after';\n\n // If the focused key is a cell, get the parent item instead.\n // For now, we assume that individual cells cannot be dropped on.\n let item = key != null ? localState.state.collection.getItem(key) : null;\n if (item?.type === 'cell') {\n key = item.parentKey;\n }\n\n // If the focused item is also selected, the default drop target is after the last selected item.\n // But if the focused key is the first selected item, then default to before the first selected item.\n // This is to make reordering lists slightly easier. If you select top down, we assume you want to\n // move the items down. If you select bottom up, we assume you want to move the items up.\n if (key != null && selectionManager.isSelected(key)) {\n if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) {\n dropPosition = 'before';\n } else {\n key = selectionManager.lastSelectedKey;\n }\n }\n\n if (key != null) {\n target = {\n type: 'item',\n key,\n dropPosition\n };\n\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n // If the default target is not valid, find the next one that is.\n if (localState.state.getDropOperation({target, types, allowedOperations: drag.allowedDropOperations, isInternal, draggingKeys}) === 'cancel') {\n target = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)\n ?? nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);\n }\n }\n\n // If no focused key, then start from the root.\n if (!target) {\n target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n }\n\n localState.state.setTarget(target);\n },\n onDropExit() {\n setDropCollectionRef(undefined);\n localState.state.setTarget(null);\n },\n onDropTargetEnter(target) {\n localState.state.setTarget(target);\n },\n onDropActivate(e, target) {\n if (\n target?.type === 'item' &&\n target?.dropPosition === 'on' &&\n typeof localState.props.onDropActivate === 'function'\n ) {\n localState.props.onDropActivate({\n type: 'dropactivate',\n x: e.x, // todo\n y: e.y,\n target\n });\n }\n },\n onDrop(e, target) {\n setDropCollectionRef(ref);\n if (localState.state.target) {\n onDrop(e, target || localState.state.target);\n }\n },\n onKeyDown(e, drag) {\n let {keyboardDelegate} = localState.props;\n let types = getTypes(drag.items);\n switch (e.key) {\n case 'ArrowDown': {\n if (keyboardDelegate.getKeyBelow) {\n let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, 'down'));\n localState.state.setTarget(target);\n }\n break;\n }\n case 'ArrowUp': {\n if (keyboardDelegate.getKeyAbove) {\n let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, 'up'));\n localState.state.setTarget(target);\n }\n break;\n }\n case 'ArrowLeft': {\n if (keyboardDelegate.getKeyLeftOf) {\n let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, 'left'));\n localState.state.setTarget(target);\n }\n break;\n }\n case 'ArrowRight': {\n if (keyboardDelegate.getKeyRightOf) {\n let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap) => getNextTarget(target, wrap, 'right'));\n localState.state.setTarget(target);\n }\n break;\n }\n case 'Home': {\n if (keyboardDelegate.getFirstKey) {\n let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n localState.state.setTarget(target);\n }\n break;\n }\n case 'End': {\n if (keyboardDelegate.getLastKey) {\n let target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);\n localState.state.setTarget(target);\n }\n break;\n }\n case 'PageDown': {\n if (keyboardDelegate.getKeyPageBelow) {\n let target = localState.state.target;\n if (!target) {\n target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n } else {\n // If on the root, go to the item a page below the top. Otherwise a page below the current item.\n let targetKey = keyboardDelegate.getFirstKey?.();\n if (target.type === 'item') {\n targetKey = target.key;\n }\n let nextKey: Key | null = null;\n if (targetKey != null) {\n nextKey = keyboardDelegate.getKeyPageBelow(targetKey);\n }\n let dropPosition = target.type === 'item' ? target.dropPosition : 'after';\n\n // If there is no next key, or we are starting on the last key, jump to the last possible position.\n if (nextKey == null || (target.type === 'item' && target.key === keyboardDelegate.getLastKey?.())) {\n nextKey = keyboardDelegate.getLastKey?.() ?? null;\n dropPosition = 'after';\n }\n\n if (nextKey == null) {\n break;\n }\n target = {\n type: 'item',\n key: nextKey,\n dropPosition\n };\n\n // If the target does not accept the drop, find the next valid target.\n // If no next valid target, find the previous valid target.\n let {draggingCollectionRef, draggingKeys} = globalDndState;\n let isInternal = draggingCollectionRef?.current === ref?.current;\n let operation = localState.state.getDropOperation({target, types, allowedOperations: drag.allowedDropOperations, isInternal, draggingKeys});\n if (operation === 'cancel') {\n target = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)\n ?? nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);\n }\n }\n\n localState.state.setTarget(target ?? localState.state.target);\n }\n break;\n }\n case 'PageUp': {\n if (!keyboardDelegate.getKeyPageAbove) {\n break;\n }\n\n let target = localState.state.target;\n if (!target) {\n target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);\n } else if (target.type === 'item') {\n // If at the top already, switch to the root. Otherwise navigate a page up.\n if (target.key === keyboardDelegate.getFirstKey?.()) {\n target = {\n type: 'root'\n };\n } else {\n let nextKey: Key | null | undefined = keyboardDelegate.getKeyPageAbove(target.key);\n let dropPosition = target.dropPosition;\n if (nextKey == null) {\n nextKey = keyboardDelegate.getFirstKey?.();\n dropPosition = 'before';\n }\n\n if (nextKey == null) {\n break;\n }\n target = {\n type: 'item',\n key: nextKey,\n dropPosition\n };\n }\n\n // If the target does not accept the drop, find the previous valid target.\n // If no next valid target, find the next valid target.\n let {draggingKeys} = globalDndState;\n let isInternal = isInternalDropOperation(ref);\n let operation = localState.state.getDropOperation({target, types, allowedOperations: drag.allowedDropOperations, isInternal, draggingKeys});\n if (operation === 'cancel') {\n target = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)\n ?? nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);\n }\n }\n\n localState.state.setTarget(target ?? localState.state.target);\n break;\n }\n }\n localState.props.onKeyDown?.(e);\n }\n });\n }, [localState, ref, onDrop, direction]);\n\n let id = useId();\n droppableCollectionMap.set(state, {id, ref});\n return {\n collectionProps: mergeProps(dropProps, {\n id,\n // Remove description from collection element. If dropping on the entire collection,\n // there should be a drop indicator that has this description, so no need to double announce.\n 'aria-describedby': null\n })\n };\n}\n"],"names":[],"version":3,"file":"useDroppableCollection.main.js.map"}
@@ -1,531 +0,0 @@
1
- import {clearGlobalDnDState as $7252cd45fc48c07c$export$70936501603e6c57, DIRECTORY_DRAG_TYPE as $7252cd45fc48c07c$export$990fced5dfac2637, droppableCollectionMap as $7252cd45fc48c07c$export$dfdf5deeaf27473f, getTypes as $7252cd45fc48c07c$export$e1d41611756c6326, globalDndState as $7252cd45fc48c07c$export$6ca6700462636d0b, isInternalDropOperation as $7252cd45fc48c07c$export$78bf638634500fa5, setDropCollectionRef as $7252cd45fc48c07c$export$dac8db29d42db9a1} from "./utils.mjs";
2
- import {registerDropTarget as $67560de7c78cb232$export$c28d9fb4a54e471a} from "./DragManager.mjs";
3
- import {navigate as $e154566cef11553b$export$ff7962acd6052c28} from "./DropTargetKeyboardNavigation.mjs";
4
- import {useAutoScroll as $80d9daea3067eff3$export$6323452ca4533ed8} from "./useAutoScroll.mjs";
5
- import {useDrop as $5c06e4929e123553$export$ccdee5eaf73cf661} from "./useDrop.mjs";
6
- import {useRef as $4ZR0C$useRef, useCallback as $4ZR0C$useCallback, useEffect as $4ZR0C$useEffect} from "react";
7
- import {useLayoutEffect as $4ZR0C$useLayoutEffect, useId as $4ZR0C$useId, mergeProps as $4ZR0C$mergeProps} from "@react-aria/utils";
8
- import {setInteractionModality as $4ZR0C$setInteractionModality} from "@react-aria/interactions";
9
- import {useLocale as $4ZR0C$useLocale} from "@react-aria/i18n";
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
-
27
-
28
-
29
-
30
- function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
31
- let localState = (0, $4ZR0C$useRef)({
32
- props: props,
33
- state: state,
34
- nextTarget: null,
35
- dropOperation: null
36
- }).current;
37
- localState.props = props;
38
- localState.state = state;
39
- let defaultOnDrop = (0, $4ZR0C$useCallback)(async (e)=>{
40
- let { onInsert: onInsert, onRootDrop: onRootDrop, onItemDrop: onItemDrop, onReorder: onReorder, onMove: onMove, acceptedDragTypes: acceptedDragTypes = 'all', shouldAcceptItemDrop: shouldAcceptItemDrop } = localState.props;
41
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
42
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
43
- let { target: target, dropOperation: dropOperation, items: items } = e;
44
- let filteredItems = items;
45
- if (acceptedDragTypes !== 'all' || shouldAcceptItemDrop) filteredItems = items.filter((item)=>{
46
- let itemTypes;
47
- if (item.kind === 'directory') itemTypes = new Set([
48
- (0, $7252cd45fc48c07c$export$990fced5dfac2637)
49
- ]);
50
- else itemTypes = item.kind === 'file' ? new Set([
51
- item.type
52
- ]) : item.types;
53
- if (acceptedDragTypes === 'all' || acceptedDragTypes.some((type)=>itemTypes.has(type))) {
54
- // If we are performing a on item drop, check if the item in question accepts the dropped item since the item may have heavier restrictions
55
- // than the droppable collection itself
56
- if (target.type === 'item' && target.dropPosition === 'on' && shouldAcceptItemDrop) return shouldAcceptItemDrop(target, itemTypes);
57
- return true;
58
- }
59
- return false;
60
- });
61
- if (filteredItems.length > 0) {
62
- if (target.type === 'root' && onRootDrop) await onRootDrop({
63
- items: filteredItems,
64
- dropOperation: dropOperation
65
- });
66
- if (target.type === 'item') {
67
- if (target.dropPosition === 'on' && onItemDrop) await onItemDrop({
68
- items: filteredItems,
69
- dropOperation: dropOperation,
70
- isInternal: isInternal,
71
- target: target
72
- });
73
- if (onMove && isInternal) await onMove({
74
- keys: draggingKeys,
75
- dropOperation: dropOperation,
76
- target: target
77
- });
78
- if (target.dropPosition !== 'on') {
79
- if (!isInternal && onInsert) await onInsert({
80
- items: filteredItems,
81
- dropOperation: dropOperation,
82
- target: target
83
- });
84
- if (isInternal && onReorder) await onReorder({
85
- keys: draggingKeys,
86
- dropOperation: dropOperation,
87
- target: target
88
- });
89
- }
90
- }
91
- }
92
- }, [
93
- localState,
94
- ref
95
- ]);
96
- let autoScroll = (0, $80d9daea3067eff3$export$6323452ca4533ed8)(ref);
97
- let { dropProps: dropProps } = (0, $5c06e4929e123553$export$ccdee5eaf73cf661)({
98
- ref: ref,
99
- onDropEnter () {
100
- if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
101
- },
102
- onDropMove (e) {
103
- if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
104
- autoScroll.move(e.x, e.y);
105
- },
106
- getDropOperationForPoint (types, allowedOperations, x, y) {
107
- let { draggingKeys: draggingKeys, dropCollectionRef: dropCollectionRef } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
108
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
109
- let isValidDropTarget = (target)=>state.getDropOperation({
110
- target: target,
111
- types: types,
112
- allowedOperations: allowedOperations,
113
- isInternal: isInternal,
114
- draggingKeys: draggingKeys
115
- }) !== 'cancel';
116
- let target = props.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);
117
- if (!target) {
118
- localState.dropOperation = 'cancel';
119
- localState.nextTarget = null;
120
- return 'cancel';
121
- }
122
- localState.dropOperation = state.getDropOperation({
123
- target: target,
124
- types: types,
125
- allowedOperations: allowedOperations,
126
- isInternal: isInternal,
127
- draggingKeys: draggingKeys
128
- });
129
- // If the target doesn't accept the drop, see if the root accepts it instead.
130
- if (localState.dropOperation === 'cancel') {
131
- let rootTarget = {
132
- type: 'root'
133
- };
134
- let dropOperation = state.getDropOperation({
135
- target: rootTarget,
136
- types: types,
137
- allowedOperations: allowedOperations,
138
- isInternal: isInternal,
139
- draggingKeys: draggingKeys
140
- });
141
- if (dropOperation !== 'cancel') {
142
- target = rootTarget;
143
- localState.dropOperation = dropOperation;
144
- }
145
- }
146
- // Only set dropCollectionRef if there is a valid drop target since we cleanup dropCollectionRef in onDropExit
147
- // which only runs when leaving a valid drop target or if the dropEffect become none (mouse dnd only).
148
- if (target && localState.dropOperation !== 'cancel' && (ref === null || ref === void 0 ? void 0 : ref.current) !== (dropCollectionRef === null || dropCollectionRef === void 0 ? void 0 : dropCollectionRef.current)) (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(ref);
149
- localState.nextTarget = localState.dropOperation === 'cancel' ? null : target;
150
- return localState.dropOperation;
151
- },
152
- onDropExit () {
153
- (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(undefined);
154
- state.setTarget(null);
155
- autoScroll.stop();
156
- },
157
- onDropActivate (e) {
158
- var _state_target;
159
- if (((_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.type) === 'item' && typeof props.onDropActivate === 'function') props.onDropActivate({
160
- type: 'dropactivate',
161
- x: e.x,
162
- y: e.y,
163
- target: state.target
164
- });
165
- },
166
- onDrop (e) {
167
- (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(ref);
168
- if (state.target) onDrop(e, state.target);
169
- // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a
170
- // RSP collection and thus we don't need to preserve the global DnD state for onDragEnd
171
- let { draggingCollectionRef: draggingCollectionRef } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
172
- if (draggingCollectionRef == null) (0, $7252cd45fc48c07c$export$70936501603e6c57)();
173
- }
174
- });
175
- let droppingState = (0, $4ZR0C$useRef)(null);
176
- let updateFocusAfterDrop = (0, $4ZR0C$useCallback)(()=>{
177
- let { state: state } = localState;
178
- if (droppingState.current) {
179
- var _state_collection_getItem;
180
- let { target: target, collection: prevCollection, selectedKeys: prevSelectedKeys, focusedKey: prevFocusedKey, isInternal: isInternal, draggingKeys: draggingKeys } = droppingState.current;
181
- // If an insert occurs during a drop, we want to immediately select these items to give
182
- // feedback to the user that a drop occurred. Only do this if the selection didn't change
183
- // since the drop started so we don't override if the user or application did something.
184
- if (state.collection.size > prevCollection.size && state.selectionManager.isSelectionEqual(prevSelectedKeys)) {
185
- let newKeys = new Set();
186
- for (let key of state.collection.getKeys())if (!prevCollection.getItem(key)) newKeys.add(key);
187
- state.selectionManager.setSelectedKeys(newKeys);
188
- // If the focused item didn't change since the drop occurred, also focus the first
189
- // inserted item. If selection is disabled, then also show the focus ring so there
190
- // is some indication that items were added.
191
- if (state.selectionManager.focusedKey === prevFocusedKey) {
192
- let first = newKeys.keys().next().value;
193
- if (first != null) {
194
- let item = state.collection.getItem(first);
195
- // If this is a cell, focus the parent row.
196
- // eslint-disable-next-line max-depth
197
- if ((item === null || item === void 0 ? void 0 : item.type) === 'cell') first = item.parentKey;
198
- // eslint-disable-next-line max-depth
199
- if (first != null) state.selectionManager.setFocusedKey(first);
200
- // eslint-disable-next-line max-depth
201
- if (state.selectionManager.selectionMode === 'none') (0, $4ZR0C$setInteractionModality)('keyboard');
202
- }
203
- }
204
- } else if (prevFocusedKey != null && state.selectionManager.focusedKey === prevFocusedKey && isInternal && target.type === 'item' && target.dropPosition !== 'on' && draggingKeys.has((_state_collection_getItem = state.collection.getItem(prevFocusedKey)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.parentKey)) {
205
- var _state_collection_getItem1;
206
- var _state_collection_getItem_parentKey;
207
- // Focus row instead of cell when reordering.
208
- state.selectionManager.setFocusedKey((_state_collection_getItem_parentKey = (_state_collection_getItem1 = state.collection.getItem(prevFocusedKey)) === null || _state_collection_getItem1 === void 0 ? void 0 : _state_collection_getItem1.parentKey) !== null && _state_collection_getItem_parentKey !== void 0 ? _state_collection_getItem_parentKey : null);
209
- (0, $4ZR0C$setInteractionModality)('keyboard');
210
- } else if (state.selectionManager.focusedKey === prevFocusedKey && target.type === 'item' && target.dropPosition === 'on' && state.collection.getItem(target.key) != null) {
211
- // If focus didn't move already (e.g. due to an insert), and the user dropped on an item,
212
- // focus that item and show the focus ring to give the user feedback that the drop occurred.
213
- // Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.
214
- state.selectionManager.setFocusedKey(target.key);
215
- (0, $4ZR0C$setInteractionModality)('keyboard');
216
- } else if (state.selectionManager.focusedKey != null && !state.selectionManager.isSelected(state.selectionManager.focusedKey)) (0, $4ZR0C$setInteractionModality)('keyboard');
217
- state.selectionManager.setFocused(true);
218
- }
219
- }, [
220
- localState
221
- ]);
222
- let onDrop = (0, $4ZR0C$useCallback)((e, target)=>{
223
- let { state: state } = localState;
224
- // Save some state of the collection/selection before the drop occurs so we can compare later.
225
- droppingState.current = {
226
- timeout: undefined,
227
- focusedKey: state.selectionManager.focusedKey,
228
- collection: state.collection,
229
- selectedKeys: state.selectionManager.selectedKeys,
230
- draggingKeys: (0, $7252cd45fc48c07c$export$6ca6700462636d0b).draggingKeys,
231
- isInternal: (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref),
232
- target: target
233
- };
234
- let onDropFn = localState.props.onDrop || defaultOnDrop;
235
- onDropFn({
236
- type: 'drop',
237
- x: e.x,
238
- y: e.y,
239
- target: target,
240
- items: e.items,
241
- dropOperation: e.dropOperation
242
- });
243
- // Wait for a short time period after the onDrop is called to allow the data to be read asynchronously
244
- // and for React to re-render. If the collection didn't already change during this time (handled below),
245
- // update the focused key here.
246
- droppingState.current.timeout = setTimeout(()=>{
247
- updateFocusAfterDrop();
248
- droppingState.current = null;
249
- }, 50);
250
- }, [
251
- localState,
252
- defaultOnDrop,
253
- ref,
254
- updateFocusAfterDrop
255
- ]);
256
- (0, $4ZR0C$useEffect)(()=>{
257
- return ()=>{
258
- if (droppingState.current) clearTimeout(droppingState.current.timeout);
259
- };
260
- }, []);
261
- (0, $4ZR0C$useLayoutEffect)(()=>{
262
- // If the collection changed after a drop, update the focused key.
263
- if (droppingState.current && state.collection !== droppingState.current.collection) updateFocusAfterDrop();
264
- });
265
- let { direction: direction } = (0, $4ZR0C$useLocale)();
266
- (0, $4ZR0C$useEffect)(()=>{
267
- if (!ref.current) return;
268
- let getNextTarget = (target, wrap = true, key = 'down')=>{
269
- return (0, $e154566cef11553b$export$ff7962acd6052c28)(localState.props.keyboardDelegate, localState.state.collection, target, key, direction === 'rtl', wrap);
270
- };
271
- let getPreviousTarget = (target, wrap = true)=>{
272
- return getNextTarget(target, wrap, 'up');
273
- };
274
- let nextValidTarget = (target, types, allowedDropOperations, getNextTarget, wrap = true)=>{
275
- let seenRoot = 0;
276
- let operation;
277
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
278
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
279
- do {
280
- let nextTarget = getNextTarget(target, wrap);
281
- if (!nextTarget) return null;
282
- target = nextTarget;
283
- operation = localState.state.getDropOperation({
284
- target: nextTarget,
285
- types: types,
286
- allowedOperations: allowedDropOperations,
287
- isInternal: isInternal,
288
- draggingKeys: draggingKeys
289
- });
290
- if (target.type === 'root') seenRoot++;
291
- }while (operation === 'cancel' && !localState.state.isDropTarget(target) && seenRoot < 2);
292
- if (operation === 'cancel') return null;
293
- return target;
294
- };
295
- return $67560de7c78cb232$export$c28d9fb4a54e471a({
296
- element: ref.current,
297
- preventFocusOnDrop: true,
298
- getDropOperation (types, allowedOperations) {
299
- if (localState.state.target) {
300
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
301
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
302
- return localState.state.getDropOperation({
303
- target: localState.state.target,
304
- types: types,
305
- allowedOperations: allowedOperations,
306
- isInternal: isInternal,
307
- draggingKeys: draggingKeys
308
- });
309
- }
310
- // Check if any of the targets accept the drop.
311
- // TODO: should we have a faster way of doing this or e.g. for pagination?
312
- let target = nextValidTarget(null, types, allowedOperations, getNextTarget);
313
- return target ? 'move' : 'cancel';
314
- },
315
- onDropEnter (e, drag) {
316
- let types = (0, $7252cd45fc48c07c$export$e1d41611756c6326)(drag.items);
317
- let selectionManager = localState.state.selectionManager;
318
- let target = null;
319
- // Update the drop collection ref tracker for useDroppableItem's getDropOperation isInternal check
320
- (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(ref);
321
- // When entering the droppable collection for the first time, the default drop target
322
- // is after the focused key.
323
- let key = selectionManager.focusedKey;
324
- let dropPosition = 'after';
325
- // If the focused key is a cell, get the parent item instead.
326
- // For now, we assume that individual cells cannot be dropped on.
327
- let item = key != null ? localState.state.collection.getItem(key) : null;
328
- if ((item === null || item === void 0 ? void 0 : item.type) === 'cell') key = item.parentKey;
329
- // If the focused item is also selected, the default drop target is after the last selected item.
330
- // But if the focused key is the first selected item, then default to before the first selected item.
331
- // This is to make reordering lists slightly easier. If you select top down, we assume you want to
332
- // move the items down. If you select bottom up, we assume you want to move the items up.
333
- if (key != null && selectionManager.isSelected(key)) {
334
- if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) dropPosition = 'before';
335
- else key = selectionManager.lastSelectedKey;
336
- }
337
- if (key != null) {
338
- target = {
339
- type: 'item',
340
- key: key,
341
- dropPosition: dropPosition
342
- };
343
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
344
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
345
- var _nextValidTarget;
346
- // If the default target is not valid, find the next one that is.
347
- if (localState.state.getDropOperation({
348
- target: target,
349
- types: types,
350
- allowedOperations: drag.allowedDropOperations,
351
- isInternal: isInternal,
352
- draggingKeys: draggingKeys
353
- }) === 'cancel') target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
354
- }
355
- // If no focused key, then start from the root.
356
- if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
357
- localState.state.setTarget(target);
358
- },
359
- onDropExit () {
360
- (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(undefined);
361
- localState.state.setTarget(null);
362
- },
363
- onDropTargetEnter (target) {
364
- localState.state.setTarget(target);
365
- },
366
- onDropActivate (e, target) {
367
- if ((target === null || target === void 0 ? void 0 : target.type) === 'item' && (target === null || target === void 0 ? void 0 : target.dropPosition) === 'on' && typeof localState.props.onDropActivate === 'function') localState.props.onDropActivate({
368
- type: 'dropactivate',
369
- x: e.x,
370
- y: e.y,
371
- target: target
372
- });
373
- },
374
- onDrop (e, target) {
375
- (0, $7252cd45fc48c07c$export$dac8db29d42db9a1)(ref);
376
- if (localState.state.target) onDrop(e, target || localState.state.target);
377
- },
378
- onKeyDown (e, drag) {
379
- var _localState_props_onKeyDown, _localState_props;
380
- let { keyboardDelegate: keyboardDelegate } = localState.props;
381
- let types = (0, $7252cd45fc48c07c$export$e1d41611756c6326)(drag.items);
382
- switch(e.key){
383
- case 'ArrowDown':
384
- if (keyboardDelegate.getKeyBelow) {
385
- let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap)=>getNextTarget(target, wrap, 'down'));
386
- localState.state.setTarget(target);
387
- }
388
- break;
389
- case 'ArrowUp':
390
- if (keyboardDelegate.getKeyAbove) {
391
- let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap)=>getNextTarget(target, wrap, 'up'));
392
- localState.state.setTarget(target);
393
- }
394
- break;
395
- case 'ArrowLeft':
396
- if (keyboardDelegate.getKeyLeftOf) {
397
- let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap)=>getNextTarget(target, wrap, 'left'));
398
- localState.state.setTarget(target);
399
- }
400
- break;
401
- case 'ArrowRight':
402
- if (keyboardDelegate.getKeyRightOf) {
403
- let target = nextValidTarget(localState.state.target, types, drag.allowedDropOperations, (target, wrap)=>getNextTarget(target, wrap, 'right'));
404
- localState.state.setTarget(target);
405
- }
406
- break;
407
- case 'Home':
408
- if (keyboardDelegate.getFirstKey) {
409
- let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
410
- localState.state.setTarget(target);
411
- }
412
- break;
413
- case 'End':
414
- if (keyboardDelegate.getLastKey) {
415
- let target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
416
- localState.state.setTarget(target);
417
- }
418
- break;
419
- case 'PageDown':
420
- if (keyboardDelegate.getKeyPageBelow) {
421
- let target = localState.state.target;
422
- if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
423
- else {
424
- var _keyboardDelegate_getFirstKey, _keyboardDelegate_getLastKey;
425
- // If on the root, go to the item a page below the top. Otherwise a page below the current item.
426
- let targetKey = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate);
427
- if (target.type === 'item') targetKey = target.key;
428
- let nextKey = null;
429
- if (targetKey != null) nextKey = keyboardDelegate.getKeyPageBelow(targetKey);
430
- let dropPosition = target.type === 'item' ? target.dropPosition : 'after';
431
- // If there is no next key, or we are starting on the last key, jump to the last possible position.
432
- if (nextKey == null || target.type === 'item' && target.key === ((_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate))) {
433
- var _keyboardDelegate_getLastKey1;
434
- var _keyboardDelegate_getLastKey2;
435
- nextKey = (_keyboardDelegate_getLastKey2 = (_keyboardDelegate_getLastKey1 = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey1 === void 0 ? void 0 : _keyboardDelegate_getLastKey1.call(keyboardDelegate)) !== null && _keyboardDelegate_getLastKey2 !== void 0 ? _keyboardDelegate_getLastKey2 : null;
436
- dropPosition = 'after';
437
- }
438
- if (nextKey == null) break;
439
- target = {
440
- type: 'item',
441
- key: nextKey,
442
- dropPosition: dropPosition
443
- };
444
- // If the target does not accept the drop, find the next valid target.
445
- // If no next valid target, find the previous valid target.
446
- let { draggingCollectionRef: draggingCollectionRef, draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
447
- let isInternal = (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) === (ref === null || ref === void 0 ? void 0 : ref.current);
448
- let operation = localState.state.getDropOperation({
449
- target: target,
450
- types: types,
451
- allowedOperations: drag.allowedDropOperations,
452
- isInternal: isInternal,
453
- draggingKeys: draggingKeys
454
- });
455
- var _nextValidTarget;
456
- if (operation === 'cancel') target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
457
- }
458
- localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
459
- }
460
- break;
461
- case 'PageUp':
462
- {
463
- if (!keyboardDelegate.getKeyPageAbove) break;
464
- let target = localState.state.target;
465
- if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
466
- else if (target.type === 'item') {
467
- var _keyboardDelegate_getFirstKey1;
468
- // If at the top already, switch to the root. Otherwise navigate a page up.
469
- if (target.key === ((_keyboardDelegate_getFirstKey1 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey1 === void 0 ? void 0 : _keyboardDelegate_getFirstKey1.call(keyboardDelegate))) target = {
470
- type: 'root'
471
- };
472
- else {
473
- let nextKey = keyboardDelegate.getKeyPageAbove(target.key);
474
- let dropPosition = target.dropPosition;
475
- if (nextKey == null) {
476
- var _keyboardDelegate_getFirstKey2;
477
- nextKey = (_keyboardDelegate_getFirstKey2 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey2 === void 0 ? void 0 : _keyboardDelegate_getFirstKey2.call(keyboardDelegate);
478
- dropPosition = 'before';
479
- }
480
- if (nextKey == null) break;
481
- target = {
482
- type: 'item',
483
- key: nextKey,
484
- dropPosition: dropPosition
485
- };
486
- }
487
- // If the target does not accept the drop, find the previous valid target.
488
- // If no next valid target, find the next valid target.
489
- let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
490
- let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
491
- let operation = localState.state.getDropOperation({
492
- target: target,
493
- types: types,
494
- allowedOperations: drag.allowedDropOperations,
495
- isInternal: isInternal,
496
- draggingKeys: draggingKeys
497
- });
498
- var _nextValidTarget1;
499
- if (operation === 'cancel') target = (_nextValidTarget1 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);
500
- }
501
- localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
502
- break;
503
- }
504
- }
505
- (_localState_props_onKeyDown = (_localState_props = localState.props).onKeyDown) === null || _localState_props_onKeyDown === void 0 ? void 0 : _localState_props_onKeyDown.call(_localState_props, e);
506
- }
507
- });
508
- }, [
509
- localState,
510
- ref,
511
- onDrop,
512
- direction
513
- ]);
514
- let id = (0, $4ZR0C$useId)();
515
- (0, $7252cd45fc48c07c$export$dfdf5deeaf27473f).set(state, {
516
- id: id,
517
- ref: ref
518
- });
519
- return {
520
- collectionProps: (0, $4ZR0C$mergeProps)(dropProps, {
521
- id: id,
522
- // Remove description from collection element. If dropping on the entire collection,
523
- // there should be a drop indicator that has this description, so no need to double announce.
524
- 'aria-describedby': null
525
- })
526
- };
527
- }
528
-
529
-
530
- export {$4b52e4eff84e5217$export$f4e2f423c21f7b04 as useDroppableCollection};
531
- //# sourceMappingURL=useDroppableCollection.module.js.map