@react-aria/dnd 3.7.3 → 3.8.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 (140) hide show
  1. package/LICENSE +201 -0
  2. package/dist/DragManager.main.js +25 -13
  3. package/dist/DragManager.main.js.map +1 -1
  4. package/dist/DragManager.mjs +25 -13
  5. package/dist/DragManager.module.js +25 -13
  6. package/dist/DragManager.module.js.map +1 -1
  7. package/dist/DragPreview.main.js +7 -1
  8. package/dist/DragPreview.main.js.map +1 -1
  9. package/dist/DragPreview.mjs +8 -2
  10. package/dist/DragPreview.module.js +8 -2
  11. package/dist/DragPreview.module.js.map +1 -1
  12. package/dist/ListDropTargetDelegate.main.js +5 -4
  13. package/dist/ListDropTargetDelegate.main.js.map +1 -1
  14. package/dist/ListDropTargetDelegate.mjs +5 -4
  15. package/dist/ListDropTargetDelegate.module.js +5 -4
  16. package/dist/ListDropTargetDelegate.module.js.map +1 -1
  17. package/dist/ar-AE.main.js.map +1 -1
  18. package/dist/ar-AE.module.js.map +1 -1
  19. package/dist/bg-BG.main.js.map +1 -1
  20. package/dist/bg-BG.module.js.map +1 -1
  21. package/dist/constants.main.js +3 -3
  22. package/dist/constants.main.js.map +1 -1
  23. package/dist/constants.mjs +3 -3
  24. package/dist/constants.module.js +3 -3
  25. package/dist/constants.module.js.map +1 -1
  26. package/dist/cs-CZ.main.js.map +1 -1
  27. package/dist/cs-CZ.module.js.map +1 -1
  28. package/dist/da-DK.main.js.map +1 -1
  29. package/dist/da-DK.module.js.map +1 -1
  30. package/dist/de-DE.main.js.map +1 -1
  31. package/dist/de-DE.module.js.map +1 -1
  32. package/dist/el-GR.main.js.map +1 -1
  33. package/dist/el-GR.module.js.map +1 -1
  34. package/dist/en-US.main.js.map +1 -1
  35. package/dist/en-US.module.js.map +1 -1
  36. package/dist/es-ES.main.js.map +1 -1
  37. package/dist/es-ES.module.js.map +1 -1
  38. package/dist/et-EE.main.js.map +1 -1
  39. package/dist/et-EE.module.js.map +1 -1
  40. package/dist/fi-FI.main.js.map +1 -1
  41. package/dist/fi-FI.module.js.map +1 -1
  42. package/dist/fr-FR.main.js.map +1 -1
  43. package/dist/fr-FR.module.js.map +1 -1
  44. package/dist/he-IL.main.js.map +1 -1
  45. package/dist/he-IL.module.js.map +1 -1
  46. package/dist/hr-HR.main.js.map +1 -1
  47. package/dist/hr-HR.module.js.map +1 -1
  48. package/dist/hu-HU.main.js.map +1 -1
  49. package/dist/hu-HU.module.js.map +1 -1
  50. package/dist/it-IT.main.js.map +1 -1
  51. package/dist/it-IT.module.js.map +1 -1
  52. package/dist/ja-JP.main.js.map +1 -1
  53. package/dist/ja-JP.module.js.map +1 -1
  54. package/dist/ko-KR.main.js.map +1 -1
  55. package/dist/ko-KR.module.js.map +1 -1
  56. package/dist/lt-LT.main.js.map +1 -1
  57. package/dist/lt-LT.module.js.map +1 -1
  58. package/dist/lv-LV.main.js.map +1 -1
  59. package/dist/lv-LV.module.js.map +1 -1
  60. package/dist/nb-NO.main.js.map +1 -1
  61. package/dist/nb-NO.module.js.map +1 -1
  62. package/dist/nl-NL.main.js.map +1 -1
  63. package/dist/nl-NL.module.js.map +1 -1
  64. package/dist/pl-PL.main.js.map +1 -1
  65. package/dist/pl-PL.module.js.map +1 -1
  66. package/dist/pt-BR.main.js.map +1 -1
  67. package/dist/pt-BR.module.js.map +1 -1
  68. package/dist/pt-PT.main.js.map +1 -1
  69. package/dist/pt-PT.module.js.map +1 -1
  70. package/dist/ro-RO.main.js.map +1 -1
  71. package/dist/ro-RO.module.js.map +1 -1
  72. package/dist/ru-RU.main.js.map +1 -1
  73. package/dist/ru-RU.module.js.map +1 -1
  74. package/dist/sk-SK.main.js.map +1 -1
  75. package/dist/sk-SK.module.js.map +1 -1
  76. package/dist/sl-SI.main.js.map +1 -1
  77. package/dist/sl-SI.module.js.map +1 -1
  78. package/dist/sr-SP.main.js.map +1 -1
  79. package/dist/sr-SP.module.js.map +1 -1
  80. package/dist/sv-SE.main.js.map +1 -1
  81. package/dist/sv-SE.module.js.map +1 -1
  82. package/dist/tr-TR.main.js.map +1 -1
  83. package/dist/tr-TR.module.js.map +1 -1
  84. package/dist/types.d.ts +4 -4
  85. package/dist/types.d.ts.map +1 -1
  86. package/dist/uk-UA.main.js.map +1 -1
  87. package/dist/uk-UA.module.js.map +1 -1
  88. package/dist/useAutoScroll.main.js +5 -5
  89. package/dist/useAutoScroll.main.js.map +1 -1
  90. package/dist/useAutoScroll.mjs +5 -5
  91. package/dist/useAutoScroll.module.js +5 -5
  92. package/dist/useAutoScroll.module.js.map +1 -1
  93. package/dist/useClipboard.main.js +13 -7
  94. package/dist/useClipboard.main.js.map +1 -1
  95. package/dist/useClipboard.mjs +13 -7
  96. package/dist/useClipboard.module.js +13 -7
  97. package/dist/useClipboard.module.js.map +1 -1
  98. package/dist/useDrag.main.js +2 -2
  99. package/dist/useDrag.main.js.map +1 -1
  100. package/dist/useDrag.mjs +2 -2
  101. package/dist/useDrag.module.js +2 -2
  102. package/dist/useDrag.module.js.map +1 -1
  103. package/dist/useDrop.main.js +5 -4
  104. package/dist/useDrop.main.js.map +1 -1
  105. package/dist/useDrop.mjs +5 -4
  106. package/dist/useDrop.module.js +5 -4
  107. package/dist/useDrop.module.js.map +1 -1
  108. package/dist/useDropIndicator.main.js +3 -2
  109. package/dist/useDropIndicator.main.js.map +1 -1
  110. package/dist/useDropIndicator.mjs +3 -2
  111. package/dist/useDropIndicator.module.js +3 -2
  112. package/dist/useDropIndicator.module.js.map +1 -1
  113. package/dist/useDroppableCollection.main.js +33 -19
  114. package/dist/useDroppableCollection.main.js.map +1 -1
  115. package/dist/useDroppableCollection.mjs +33 -19
  116. package/dist/useDroppableCollection.module.js +33 -19
  117. package/dist/useDroppableCollection.module.js.map +1 -1
  118. package/dist/useVirtualDrop.main.js.map +1 -1
  119. package/dist/useVirtualDrop.module.js.map +1 -1
  120. package/dist/utils.main.js +5 -3
  121. package/dist/utils.main.js.map +1 -1
  122. package/dist/utils.mjs +5 -3
  123. package/dist/utils.module.js +5 -3
  124. package/dist/utils.module.js.map +1 -1
  125. package/dist/zh-CN.main.js.map +1 -1
  126. package/dist/zh-CN.module.js.map +1 -1
  127. package/dist/zh-TW.main.js.map +1 -1
  128. package/dist/zh-TW.module.js.map +1 -1
  129. package/package.json +15 -14
  130. package/src/DragManager.ts +26 -24
  131. package/src/DragPreview.tsx +17 -8
  132. package/src/ListDropTargetDelegate.ts +8 -5
  133. package/src/useAutoScroll.ts +6 -6
  134. package/src/useClipboard.ts +12 -6
  135. package/src/useDrag.ts +5 -2
  136. package/src/useDrop.ts +17 -9
  137. package/src/useDropIndicator.ts +10 -4
  138. package/src/useDroppableCollection.ts +62 -39
  139. package/src/useVirtualDrop.ts +3 -2
  140. package/src/utils.ts +16 -10
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAuDD,MAAM,8CAAwB;AAMvB,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,CAAC,cAAc,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7C,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,GAAG;QACH,GAAG;QACH,kBAAkB,IAAI;QACtB,YAAY;QACZ,mBAAmB,CAAA,GAAA,yCAAa,EAAE,GAAG;QACrC,mBAAmB;IACrB,GAAG,OAAO;IAEV,IAAI,gBAAgB,CAAC;QACnB,cAAc;QAEd,IAAI,OAAO,QAAQ,WAAW,KAAK,YAAY;YAC7C,IAAI,OAAO,AAAC,EAAE,aAAa,CAAiB,qBAAqB;YACjE,QAAQ,WAAW,CAAC;gBAClB,MAAM;gBACN,GAAG,EAAE,OAAO,GAAG,KAAK,CAAC;gBACrB,GAAG,EAAE,OAAO,GAAG,KAAK,CAAC;YACvB;QACF;IACF;IAEA,IAAI,eAAe,CAAC;QAClB,cAAc;QAEd,IAAI,OAAO,QAA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AI,EAAE,MAAM,EACV,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;QAGzC,iGAAiG;QACjG,+GAA+G;QAC/G,iDAAiD;QACjD,IAAI,EAAE,OAAO,IAAI,CAAC,CAAA,GAAA,aAAK,KACrB,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,OAAO,EACX,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;IAE3C,OAAO;QACL,IAAI,EAAE,MAAM,EACV,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,QAAQ,EACZ,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,OAAO,EACX,oBAAoB,CAAA,GAAA,yCAAa,EAAE,IAAI;IAE3C;IAEA,IAAI,kBACF,OAAO,oBAAoB;IAG7B,OAAO;AACT;AAEA,SAAS,+CAAyB,qBAAqC;IACrE,IAAI,oBAAoB,EAAE;IAC1B,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,OAAO;AACT;AAEA,SAAS,uCAAiB,iBAAiC,EAAE,SAAwB;IACnF,IAAI,KAAK,CAAA,GAAA,yCAAa,CAAC,CAAC,UAAU;IAClC,OAAO,oBAAoB,KAAK,YAAY;AAC9C","sources":["packages/@react-aria/dnd/src/useDrop.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 {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<HTMLElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, 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 useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none' as DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: null\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n options.onDropActivate({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\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 drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAuDD,MAAM,8CAAwB;AAMvB,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,CAAC,cAAc,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7C,IAAI,QAAQ,CAAA,GAAA,aAAK,EAOd;QACD,GAAG;QACH,GAAG;QACH,kBAAkB,IAAI;QACtB,YAAY;QACZ,mBAAmB,CAAA,GAAA,yCAAa,EAAE,GAAG;QACrC,mBAAmB;IACrB,GAAG,OAAO;IAEV,IAAI,gBAAgB,CAAC;QACnB,cAAc;QAEd,IAAI,OAAO,QAAQ,WAAW,KAAK,YAAY;YAC7C,IAAI,OAAO,AAAC,EAAE,aAAa,CAAiB,qBAAqB;YACjE,QAAQ,WAAW,CAAC;gBAClB,MAAM;gBACN,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packages/@react-aria/dnd/src/useDrop.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 {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<FocusableElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, 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 useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef<{\n x: number,\n y: number,\n dragOverElements: Set<Element>,\n dropEffect: DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION,\n dropActivateTimer: ReturnType<typeof setTimeout> | undefined\n }>({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none',\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: undefined\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (options.onDropActivate && typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let onDropActivateOptions = options.onDropActivate;\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n onDropActivateOptions({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\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 drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations: Array<DropOperation> = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.module.js.map"}
@@ -40,8 +40,9 @@ function $c5557edbed563ebf$export$8d0e41d2815afac5(props, state, ref) {
40
40
  let id = (0, $Zlq1e$reactariautils.useId)();
41
41
  let getText = (key)=>{
42
42
  var _collection_getTextValue, _collection_getItem;
43
- var _collection_getTextValue1;
44
- return (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
43
+ var _collection_getTextValue1, _ref;
44
+ if (key == null) return '';
45
+ else return (_ref = (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _ref !== void 0 ? _ref : '';
45
46
  };
46
47
  let label = '';
47
48
  let labelledBy;
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAiCM,SAAS,0CAAiB,KAAyB,EAAE,KAA+B,EAAE,GAAkC;IAC7H,IAAI,UAAC,MAAM,EAAC,GAAG;IACf,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,cAAc;IAClB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,0CAAe,EAAE,OAAO,OAAO;IACjD,IAAI,KAAK,CAAA,GAAA,2BAAI;IACb,IAAI,UAAU,CAAC;YAAa,0BAAkC;YAAlC;eAAA,CAAA,6BAAA,2BAAA,WAAW,YAAY,cAAvB,+CAAA,8BAAA,YAA0B,kBAA1B,uCAAA,6BAAkC,sBAAA,WAAW,OAAO,CAAC,kBAAnB,0CAAA,oBAAyB,SAAS;IAAD;IAE/F,IAAI,QAAQ;IACZ,IAAI;IACJ,IAAI,OAAO,IAAI,KAAK,QAAQ;QAC1B,QAAQ,gBAAgB,MAAM,CAAC;QAC/B,aAAa,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA,GAAA,kDAAuB,EAAE,OAAO,CAAC;IACzD,OAAO,IAAI,OAAO,YAAY,KAAK,MACjC,QAAQ,gBAAgB,MAAM,CAAC,cAAc;QAC3C,UAAU,QAAQ,OAAO,GAAG;IAC9B;SACK;QACL,IAAI;QACJ,IAAI;QACJ,IAAI,WAAW,WAAW,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,UACrE,SAAS;aAET,SAAS,OAAO,YAAY,KAAK,WAAW,WAAW,YAAY,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG9F,IAAI,WAAW,UAAU,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,SACpE,QAAQ;aAER,QAAQ,OAAO,YAAY,KAAK,UAAU,WAAW,WAAW,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG3F,IAAI,UAAU,OACZ,QAAQ,gBAAgB,MAAM,CAAC,iBAAiB;YAC9C,gBAAgB,QAAQ;YACxB,eAAe,QAAQ;QACzB;aACK,IAAI,QACT,QAAQ,gBAAgB,MAAM,CAAC,eAAe;YAC5C,UAAU,QAAQ;QACpB;aACK,IAAI,OACT,QAAQ,gBAAgB,MAAM,CAAC,gBAAgB;YAC7C,UAAU,QAAQ;QACpB;IAEJ;IAEA,IAAI,eAAe,MAAM,YAAY,CAAC;IACtC,IAAI,aAAa,CAAC,cAAc,SAAS,SAAS,CAAC,cAAc;IACjE,OAAO;QACL,oBAAoB;YAClB,GAAG,SAAS;gBACZ;YACA,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;YACd,mBAAmB;YACnB,eAAe;YACf,UAAU;QACZ;sBACA;QACA,qFAAqF;QACrF,yGAAyG;QACzG,0FAA0F;QAC1F,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC/B;AACF","sources":["packages/@react-aria/dnd/src/useDropIndicator.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, Key, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionId} from './utils';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDroppableItem} from './useDroppableItem';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DropIndicatorProps {\n /** The drop target that the drop indicator represents. */\n target: DropTarget\n}\n\nexport interface DropIndicatorAria {\n /** Props for the drop indicator element. */\n dropIndicatorProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop indicator is currently the active drop target. */\n isDropTarget: boolean,\n /**\n * Whether the drop indicator is hidden, both visually and from assistive technology.\n * Use this to determine whether to omit the element from the DOM entirely.\n */\n isHidden: boolean\n}\n\n/**\n * Handles drop interactions for a target within a droppable collection.\n */\nexport function useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DropIndicatorAria {\n let {target} = props;\n let {collection} = state;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let dragSession = DragManager.useDragSession();\n let {dropProps} = useDroppableItem(props, state, ref);\n let id = useId();\n let getText = (key: Key) => collection.getTextValue?.(key) ?? collection.getItem(key)?.textValue;\n\n let label = '';\n let labelledBy: string;\n if (target.type === 'root') {\n label = stringFormatter.format('dropOnRoot');\n labelledBy = `${id} ${getDroppableCollectionId(state)}`;\n } else if (target.dropPosition === 'on') {\n label = stringFormatter.format('dropOnItem', {\n itemText: getText(target.key)\n });\n } else {\n let before: Key | null;\n let after: Key | null;\n if (collection.getFirstKey() === target.key && target.dropPosition === 'before') {\n before = null;\n } else {\n before = target.dropPosition === 'before' ? collection.getKeyBefore(target.key) : target.key;\n }\n\n if (collection.getLastKey() === target.key && target.dropPosition === 'after') {\n after = null;\n } else {\n after = target.dropPosition === 'after' ? collection.getKeyAfter(target.key) : target.key;\n }\n\n if (before && after) {\n label = stringFormatter.format('insertBetween', {\n beforeItemText: getText(before),\n afterItemText: getText(after)\n });\n } else if (before) {\n label = stringFormatter.format('insertAfter', {\n itemText: getText(before)\n });\n } else if (after) {\n label = stringFormatter.format('insertBefore', {\n itemText: getText(after)\n });\n }\n }\n\n let isDropTarget = state.isDropTarget(target);\n let ariaHidden = !dragSession ? 'true' : dropProps['aria-hidden'];\n return {\n dropIndicatorProps: {\n ...dropProps,\n id,\n 'aria-roledescription': stringFormatter.format('dropIndicator'),\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n 'aria-hidden': ariaHidden,\n tabIndex: -1\n },\n isDropTarget,\n // If aria-hidden, we are either not in a drag session or the drop target is invalid.\n // In that case, there's no need to render anything at all unless we need to show the indicator visually.\n // This can happen when dragging using the native DnD API as opposed to keyboard dragging.\n isHidden: !isDropTarget && !!ariaHidden\n };\n}\n"],"names":[],"version":3,"file":"useDropIndicator.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAiCM,SAAS,0CAAiB,KAAyB,EAAE,KAA+B,EAAE,GAAkC;IAC7H,IAAI,UAAC,MAAM,EAAC,GAAG;IACf,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,cAAc;IAClB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,0CAAe,EAAE,OAAO,OAAO;IACjD,IAAI,KAAK,CAAA,GAAA,2BAAI;IACb,IAA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a,CAAC,cAAc,SAAS,SAAS,CAAC,cAAc;IACjE,OAAO;QACL,oBAAoB;YAClB,GAAG,SAAS;gBACZ;YACA,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;YACd,mBAAmB;YACnB,eAAe;YACf,UAAU;QACZ;sBACA;QACA,qFAAqF;QACrF,yGAAyG;QACzG,0FAA0F;QAC1F,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC/B;AACF","sources":["packages/@react-aria/dnd/src/useDropIndicator.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, Key, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionId} from './utils';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDroppableItem} from './useDroppableItem';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DropIndicatorProps {\n /** The drop target that the drop indicator represents. */\n target: DropTarget\n}\n\nexport interface DropIndicatorAria {\n /** Props for the drop indicator element. */\n dropIndicatorProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop indicator is currently the active drop target. */\n isDropTarget: boolean,\n /**\n * Whether the drop indicator is hidden, both visually and from assistive technology.\n * Use this to determine whether to omit the element from the DOM entirely.\n */\n isHidden: boolean\n}\n\n/**\n * Handles drop interactions for a target within a droppable collection.\n */\nexport function useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DropIndicatorAria {\n let {target} = props;\n let {collection} = state;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let dragSession = DragManager.useDragSession();\n let {dropProps} = useDroppableItem(props, state, ref);\n let id = useId();\n let getText = (key: Key | null) => {\n if (key == null) {\n return '';\n } else {\n return collection.getTextValue?.(key) ?? collection.getItem(key)?.textValue ?? '';\n }\n };\n\n let label = '';\n let labelledBy: string | undefined;\n if (target.type === 'root') {\n label = stringFormatter.format('dropOnRoot');\n labelledBy = `${id} ${getDroppableCollectionId(state)}`;\n } else if (target.dropPosition === 'on') {\n label = stringFormatter.format('dropOnItem', {\n itemText: getText(target.key)\n });\n } else {\n let before: Key | null | undefined;\n let after: Key | null | undefined;\n if (collection.getFirstKey() === target.key && target.dropPosition === 'before') {\n before = null;\n } else {\n before = target.dropPosition === 'before' ? collection.getKeyBefore(target.key) : target.key;\n }\n\n if (collection.getLastKey() === target.key && target.dropPosition === 'after') {\n after = null;\n } else {\n after = target.dropPosition === 'after' ? collection.getKeyAfter(target.key) : target.key;\n }\n\n if (before && after) {\n label = stringFormatter.format('insertBetween', {\n beforeItemText: getText(before),\n afterItemText: getText(after)\n });\n } else if (before) {\n label = stringFormatter.format('insertAfter', {\n itemText: getText(before)\n });\n } else if (after) {\n label = stringFormatter.format('insertBefore', {\n itemText: getText(after)\n });\n }\n }\n\n let isDropTarget = state.isDropTarget(target);\n let ariaHidden = !dragSession ? 'true' : dropProps['aria-hidden'];\n return {\n dropIndicatorProps: {\n ...dropProps,\n id,\n 'aria-roledescription': stringFormatter.format('dropIndicator'),\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n 'aria-hidden': ariaHidden,\n tabIndex: -1\n },\n isDropTarget,\n // If aria-hidden, we are either not in a drag session or the drop target is invalid.\n // In that case, there's no need to render anything at all unless we need to show the indicator visually.\n // This can happen when dragging using the native DnD API as opposed to keyboard dragging.\n isHidden: !isDropTarget && !!ariaHidden\n };\n}\n"],"names":[],"version":3,"file":"useDropIndicator.main.js.map"}
@@ -34,8 +34,9 @@ function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
34
34
  let id = (0, $8HwJV$useId)();
35
35
  let getText = (key)=>{
36
36
  var _collection_getTextValue, _collection_getItem;
37
- var _collection_getTextValue1;
38
- return (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
37
+ var _collection_getTextValue1, _ref;
38
+ if (key == null) return '';
39
+ else return (_ref = (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _ref !== void 0 ? _ref : '';
39
40
  };
40
41
  let label = '';
41
42
  let labelledBy;
@@ -34,8 +34,9 @@ function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
34
34
  let id = (0, $8HwJV$useId)();
35
35
  let getText = (key)=>{
36
36
  var _collection_getTextValue, _collection_getItem;
37
- var _collection_getTextValue1;
38
- return (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
37
+ var _collection_getTextValue1, _ref;
38
+ if (key == null) return '';
39
+ else return (_ref = (_collection_getTextValue1 = (_collection_getTextValue = collection.getTextValue) === null || _collection_getTextValue === void 0 ? void 0 : _collection_getTextValue.call(collection, key)) !== null && _collection_getTextValue1 !== void 0 ? _collection_getTextValue1 : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _ref !== void 0 ? _ref : '';
39
40
  };
40
41
  let label = '';
41
42
  let labelledBy;
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAiCM,SAAS,0CAAiB,KAAyB,EAAE,KAA+B,EAAE,GAAkC;IAC7H,IAAI,UAAC,MAAM,EAAC,GAAG;IACf,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,cAAc;IAClB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAe,EAAE,OAAO,OAAO;IACjD,IAAI,KAAK,CAAA,GAAA,YAAI;IACb,IAAI,UAAU,CAAC;YAAa,0BAAkC;YAAlC;eAAA,CAAA,6BAAA,2BAAA,WAAW,YAAY,cAAvB,+CAAA,8BAAA,YAA0B,kBAA1B,uCAAA,6BAAkC,sBAAA,WAAW,OAAO,CAAC,kBAAnB,0CAAA,oBAAyB,SAAS;IAAD;IAE/F,IAAI,QAAQ;IACZ,IAAI;IACJ,IAAI,OAAO,IAAI,KAAK,QAAQ;QAC1B,QAAQ,gBAAgB,MAAM,CAAC;QAC/B,aAAa,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA,GAAA,yCAAuB,EAAE,OAAO,CAAC;IACzD,OAAO,IAAI,OAAO,YAAY,KAAK,MACjC,QAAQ,gBAAgB,MAAM,CAAC,cAAc;QAC3C,UAAU,QAAQ,OAAO,GAAG;IAC9B;SACK;QACL,IAAI;QACJ,IAAI;QACJ,IAAI,WAAW,WAAW,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,UACrE,SAAS;aAET,SAAS,OAAO,YAAY,KAAK,WAAW,WAAW,YAAY,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG9F,IAAI,WAAW,UAAU,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,SACpE,QAAQ;aAER,QAAQ,OAAO,YAAY,KAAK,UAAU,WAAW,WAAW,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG3F,IAAI,UAAU,OACZ,QAAQ,gBAAgB,MAAM,CAAC,iBAAiB;YAC9C,gBAAgB,QAAQ;YACxB,eAAe,QAAQ;QACzB;aACK,IAAI,QACT,QAAQ,gBAAgB,MAAM,CAAC,eAAe;YAC5C,UAAU,QAAQ;QACpB;aACK,IAAI,OACT,QAAQ,gBAAgB,MAAM,CAAC,gBAAgB;YAC7C,UAAU,QAAQ;QACpB;IAEJ;IAEA,IAAI,eAAe,MAAM,YAAY,CAAC;IACtC,IAAI,aAAa,CAAC,cAAc,SAAS,SAAS,CAAC,cAAc;IACjE,OAAO;QACL,oBAAoB;YAClB,GAAG,SAAS;gBACZ;YACA,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;YACd,mBAAmB;YACnB,eAAe;YACf,UAAU;QACZ;sBACA;QACA,qFAAqF;QACrF,yGAAyG;QACzG,0FAA0F;QAC1F,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC/B;AACF","sources":["packages/@react-aria/dnd/src/useDropIndicator.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, Key, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionId} from './utils';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDroppableItem} from './useDroppableItem';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DropIndicatorProps {\n /** The drop target that the drop indicator represents. */\n target: DropTarget\n}\n\nexport interface DropIndicatorAria {\n /** Props for the drop indicator element. */\n dropIndicatorProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop indicator is currently the active drop target. */\n isDropTarget: boolean,\n /**\n * Whether the drop indicator is hidden, both visually and from assistive technology.\n * Use this to determine whether to omit the element from the DOM entirely.\n */\n isHidden: boolean\n}\n\n/**\n * Handles drop interactions for a target within a droppable collection.\n */\nexport function useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DropIndicatorAria {\n let {target} = props;\n let {collection} = state;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let dragSession = DragManager.useDragSession();\n let {dropProps} = useDroppableItem(props, state, ref);\n let id = useId();\n let getText = (key: Key) => collection.getTextValue?.(key) ?? collection.getItem(key)?.textValue;\n\n let label = '';\n let labelledBy: string;\n if (target.type === 'root') {\n label = stringFormatter.format('dropOnRoot');\n labelledBy = `${id} ${getDroppableCollectionId(state)}`;\n } else if (target.dropPosition === 'on') {\n label = stringFormatter.format('dropOnItem', {\n itemText: getText(target.key)\n });\n } else {\n let before: Key | null;\n let after: Key | null;\n if (collection.getFirstKey() === target.key && target.dropPosition === 'before') {\n before = null;\n } else {\n before = target.dropPosition === 'before' ? collection.getKeyBefore(target.key) : target.key;\n }\n\n if (collection.getLastKey() === target.key && target.dropPosition === 'after') {\n after = null;\n } else {\n after = target.dropPosition === 'after' ? collection.getKeyAfter(target.key) : target.key;\n }\n\n if (before && after) {\n label = stringFormatter.format('insertBetween', {\n beforeItemText: getText(before),\n afterItemText: getText(after)\n });\n } else if (before) {\n label = stringFormatter.format('insertAfter', {\n itemText: getText(before)\n });\n } else if (after) {\n label = stringFormatter.format('insertBefore', {\n itemText: getText(after)\n });\n }\n }\n\n let isDropTarget = state.isDropTarget(target);\n let ariaHidden = !dragSession ? 'true' : dropProps['aria-hidden'];\n return {\n dropIndicatorProps: {\n ...dropProps,\n id,\n 'aria-roledescription': stringFormatter.format('dropIndicator'),\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n 'aria-hidden': ariaHidden,\n tabIndex: -1\n },\n isDropTarget,\n // If aria-hidden, we are either not in a drag session or the drop target is invalid.\n // In that case, there's no need to render anything at all unless we need to show the indicator visually.\n // This can happen when dragging using the native DnD API as opposed to keyboard dragging.\n isHidden: !isDropTarget && !!ariaHidden\n };\n}\n"],"names":[],"version":3,"file":"useDropIndicator.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAiCM,SAAS,0CAAiB,KAAyB,EAAE,KAA+B,EAAE,GAAkC;IAC7H,IAAI,UAAC,MAAM,EAAC,GAAG;IACf,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,cAAc;IAClB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAe,EAAE,OAAO,OAAO;IACjD,IAAI,KAAK,CAAA,GAAA,YAAI;IACb,IAAI,UAAU,CAAC;YAIJ,0BAAkC;YAAlC,2BAAA;QAHT,IAAI,OAAO,MACT,OAAO;aAEP,OAAO,CAAA,OAAA,CAAA,6BAAA,2BAAA,WAAW,YAAY,cAAvB,+CAAA,8BAAA,YAA0B,kBAA1B,uCAAA,6BAAkC,sBAAA,WAAW,OAAO,CAAC,kBAAnB,0CAAA,oBAAyB,SAAS,cAApE,kBAAA,OAAwE;IAEnF;IAEA,IAAI,QAAQ;IACZ,IAAI;IACJ,IAAI,OAAO,IAAI,KAAK,QAAQ;QAC1B,QAAQ,gBAAgB,MAAM,CAAC;QAC/B,aAAa,GAAG,GAAG,CAAC,EAAE,CAAA,GAAA,yCAAuB,EAAE,QAAQ;IACzD,OAAO,IAAI,OAAO,YAAY,KAAK,MACjC,QAAQ,gBAAgB,MAAM,CAAC,cAAc;QAC3C,UAAU,QAAQ,OAAO,GAAG;IAC9B;SACK;QACL,IAAI;QACJ,IAAI;QACJ,IAAI,WAAW,WAAW,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,UACrE,SAAS;aAET,SAAS,OAAO,YAAY,KAAK,WAAW,WAAW,YAAY,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG9F,IAAI,WAAW,UAAU,OAAO,OAAO,GAAG,IAAI,OAAO,YAAY,KAAK,SACpE,QAAQ;aAER,QAAQ,OAAO,YAAY,KAAK,UAAU,WAAW,WAAW,CAAC,OAAO,GAAG,IAAI,OAAO,GAAG;QAG3F,IAAI,UAAU,OACZ,QAAQ,gBAAgB,MAAM,CAAC,iBAAiB;YAC9C,gBAAgB,QAAQ;YACxB,eAAe,QAAQ;QACzB;aACK,IAAI,QACT,QAAQ,gBAAgB,MAAM,CAAC,eAAe;YAC5C,UAAU,QAAQ;QACpB;aACK,IAAI,OACT,QAAQ,gBAAgB,MAAM,CAAC,gBAAgB;YAC7C,UAAU,QAAQ;QACpB;IAEJ;IAEA,IAAI,eAAe,MAAM,YAAY,CAAC;IACtC,IAAI,aAAa,CAAC,cAAc,SAAS,SAAS,CAAC,cAAc;IACjE,OAAO;QACL,oBAAoB;YAClB,GAAG,SAAS;gBACZ;YACA,wBAAwB,gBAAgB,MAAM,CAAC;YAC/C,cAAc;YACd,mBAAmB;YACnB,eAAe;YACf,UAAU;QACZ;sBACA;QACA,qFAAqF;QACrF,yGAAyG;QACzG,0FAA0F;QAC1F,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC/B;AACF","sources":["packages/@react-aria/dnd/src/useDropIndicator.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, Key, RefObject} from '@react-types/shared';\nimport {getDroppableCollectionId} from './utils';\nimport {HTMLAttributes} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useDroppableItem} from './useDroppableItem';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DropIndicatorProps {\n /** The drop target that the drop indicator represents. */\n target: DropTarget\n}\n\nexport interface DropIndicatorAria {\n /** Props for the drop indicator element. */\n dropIndicatorProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop indicator is currently the active drop target. */\n isDropTarget: boolean,\n /**\n * Whether the drop indicator is hidden, both visually and from assistive technology.\n * Use this to determine whether to omit the element from the DOM entirely.\n */\n isHidden: boolean\n}\n\n/**\n * Handles drop interactions for a target within a droppable collection.\n */\nexport function useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DropIndicatorAria {\n let {target} = props;\n let {collection} = state;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let dragSession = DragManager.useDragSession();\n let {dropProps} = useDroppableItem(props, state, ref);\n let id = useId();\n let getText = (key: Key | null) => {\n if (key == null) {\n return '';\n } else {\n return collection.getTextValue?.(key) ?? collection.getItem(key)?.textValue ?? '';\n }\n };\n\n let label = '';\n let labelledBy: string | undefined;\n if (target.type === 'root') {\n label = stringFormatter.format('dropOnRoot');\n labelledBy = `${id} ${getDroppableCollectionId(state)}`;\n } else if (target.dropPosition === 'on') {\n label = stringFormatter.format('dropOnItem', {\n itemText: getText(target.key)\n });\n } else {\n let before: Key | null | undefined;\n let after: Key | null | undefined;\n if (collection.getFirstKey() === target.key && target.dropPosition === 'before') {\n before = null;\n } else {\n before = target.dropPosition === 'before' ? collection.getKeyBefore(target.key) : target.key;\n }\n\n if (collection.getLastKey() === target.key && target.dropPosition === 'after') {\n after = null;\n } else {\n after = target.dropPosition === 'after' ? collection.getKeyAfter(target.key) : target.key;\n }\n\n if (before && after) {\n label = stringFormatter.format('insertBetween', {\n beforeItemText: getText(before),\n afterItemText: getText(after)\n });\n } else if (before) {\n label = stringFormatter.format('insertAfter', {\n itemText: getText(before)\n });\n } else if (after) {\n label = stringFormatter.format('insertBefore', {\n itemText: getText(after)\n });\n }\n }\n\n let isDropTarget = state.isDropTarget(target);\n let ariaHidden = !dragSession ? 'true' : dropProps['aria-hidden'];\n return {\n dropIndicatorProps: {\n ...dropProps,\n id,\n 'aria-roledescription': stringFormatter.format('dropIndicator'),\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n 'aria-hidden': ariaHidden,\n tabIndex: -1\n },\n isDropTarget,\n // If aria-hidden, we are either not in a drag session or the drop target is invalid.\n // In that case, there's no need to render anything at all unless we need to show the indicator visually.\n // This can happen when dragging using the native DnD API as opposed to keyboard dragging.\n isHidden: !isDropTarget && !!ariaHidden\n };\n}\n"],"names":[],"version":3,"file":"useDropIndicator.module.js.map"}
@@ -106,10 +106,10 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
106
106
  let { dropProps: dropProps } = (0, $1ca228bc9257ca16$exports.useDrop)({
107
107
  ref: ref,
108
108
  onDropEnter () {
109
- state.setTarget(localState.nextTarget);
109
+ if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
110
110
  },
111
111
  onDropMove (e) {
112
- state.setTarget(localState.nextTarget);
112
+ if (localState.nextTarget != null) state.setTarget(localState.nextTarget);
113
113
  autoScroll.move(e.x, e.y);
114
114
  },
115
115
  getDropOperationForPoint (types, allowedOperations, x, y) {
@@ -205,9 +205,11 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
205
205
  state.selectionManager.setFocusedKey(first);
206
206
  if (state.selectionManager.selectionMode === 'none') (0, $foOxf$reactariainteractions.setInteractionModality)('keyboard');
207
207
  }
208
- } else if (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)) {
208
+ } 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)) {
209
+ var _state_collection_getItem1;
210
+ var _state_collection_getItem_parentKey;
209
211
  // Focus row instead of cell when reordering.
210
- state.selectionManager.setFocusedKey(state.collection.getItem(prevFocusedKey).parentKey);
212
+ 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);
211
213
  (0, $foOxf$reactariainteractions.setInteractionModality)('keyboard');
212
214
  } else if (state.selectionManager.focusedKey === prevFocusedKey && target.type === 'item' && target.dropPosition === 'on' && state.collection.getItem(target.key) != null) {
213
215
  // If focus didn't move already (e.g. due to an insert), and the user dropped on an item,
@@ -215,7 +217,7 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
215
217
  // Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.
216
218
  state.selectionManager.setFocusedKey(target.key);
217
219
  (0, $foOxf$reactariainteractions.setInteractionModality)('keyboard');
218
- } else if (!state.selectionManager.isSelected(state.selectionManager.focusedKey)) (0, $foOxf$reactariainteractions.setInteractionModality)('keyboard');
220
+ } else if (state.selectionManager.focusedKey != null && !state.selectionManager.isSelected(state.selectionManager.focusedKey)) (0, $foOxf$reactariainteractions.setInteractionModality)('keyboard');
219
221
  state.selectionManager.setFocused(true);
220
222
  }
221
223
  }, [
@@ -225,7 +227,7 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
225
227
  let { state: state } = localState;
226
228
  // Save some state of the collection/selection before the drop occurs so we can compare later.
227
229
  droppingState.current = {
228
- timeout: null,
230
+ timeout: undefined,
229
231
  focusedKey: state.selectionManager.focusedKey,
230
232
  collection: state.collection,
231
233
  selectedKeys: state.selectionManager.selectedKeys,
@@ -255,7 +257,6 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
255
257
  ref,
256
258
  updateFocusAfterDrop
257
259
  ]);
258
- // eslint-disable-next-line arrow-body-style
259
260
  (0, $foOxf$react.useEffect)(()=>{
260
261
  return ()=>{
261
262
  if (droppingState.current) clearTimeout(droppingState.current.timeout);
@@ -267,14 +268,16 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
267
268
  });
268
269
  let { direction: direction } = (0, $foOxf$reactariai18n.useLocale)();
269
270
  (0, $foOxf$react.useEffect)(()=>{
271
+ if (!ref.current) return;
270
272
  let getNextTarget = (target, wrap = true, horizontal = false)=>{
273
+ var _keyboardDelegate_getKeyRightOf, _keyboardDelegate_getKeyBelow, _keyboardDelegate_getLastKey, _keyboardDelegate_getFirstKey;
271
274
  if (!target) return {
272
275
  type: 'root'
273
276
  };
274
277
  let { keyboardDelegate: keyboardDelegate } = localState.props;
275
278
  let nextKey;
276
- if ((target === null || target === void 0 ? void 0 : target.type) === 'item') nextKey = horizontal ? keyboardDelegate.getKeyRightOf(target.key) : keyboardDelegate.getKeyBelow(target.key);
277
- else nextKey = horizontal && direction === 'rtl' ? keyboardDelegate.getLastKey() : keyboardDelegate.getFirstKey();
279
+ if ((target === null || target === void 0 ? void 0 : target.type) === 'item') nextKey = horizontal ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
280
+ else nextKey = horizontal && direction === 'rtl' ? (_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate) : (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate);
278
281
  let dropPositions = horizontal && direction === 'rtl' ? $7f93a158ac20b90a$var$DROP_POSITIONS_RTL : $7f93a158ac20b90a$var$DROP_POSITIONS;
279
282
  let dropPosition = dropPositions[0];
280
283
  if (target.type === 'item') {
@@ -308,10 +311,11 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
308
311
  };
309
312
  };
310
313
  let getPreviousTarget = (target, wrap = true, horizontal = false)=>{
314
+ var _keyboardDelegate_getKeyLeftOf, _keyboardDelegate_getKeyAbove, _keyboardDelegate_getFirstKey, _keyboardDelegate_getLastKey;
311
315
  let { keyboardDelegate: keyboardDelegate } = localState.props;
312
316
  let nextKey;
313
- if ((target === null || target === void 0 ? void 0 : target.type) === 'item') nextKey = horizontal ? keyboardDelegate.getKeyLeftOf(target.key) : keyboardDelegate.getKeyAbove(target.key);
314
- else nextKey = horizontal && direction === 'rtl' ? keyboardDelegate.getFirstKey() : keyboardDelegate.getLastKey();
317
+ if ((target === null || target === void 0 ? void 0 : target.type) === 'item') nextKey = horizontal ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
318
+ else nextKey = horizontal && direction === 'rtl' ? (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate) : (_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate);
315
319
  let dropPositions = horizontal && direction === 'rtl' ? $7f93a158ac20b90a$var$DROP_POSITIONS_RTL : $7f93a158ac20b90a$var$DROP_POSITIONS;
316
320
  let dropPosition = !target || target.type === 'root' ? dropPositions[2] : 'on';
317
321
  if ((target === null || target === void 0 ? void 0 : target.type) === 'item') {
@@ -388,7 +392,7 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
388
392
  onDropEnter (e, drag) {
389
393
  let types = (0, $4620ae0dc40f0031$exports.getTypes)(drag.items);
390
394
  let selectionManager = localState.state.selectionManager;
391
- let target;
395
+ let target = null;
392
396
  // Update the drop collection ref tracker for useDroppableItem's getDropOperation isInternal check
393
397
  (0, $4620ae0dc40f0031$exports.setDropCollectionRef)(ref);
394
398
  // When entering the droppable collection for the first time, the default drop target
@@ -397,13 +401,13 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
397
401
  let dropPosition = 'after';
398
402
  // If the focused key is a cell, get the parent item instead.
399
403
  // For now, we assume that individual cells cannot be dropped on.
400
- let item = localState.state.collection.getItem(key);
404
+ let item = key != null ? localState.state.collection.getItem(key) : null;
401
405
  if ((item === null || item === void 0 ? void 0 : item.type) === 'cell') key = item.parentKey;
402
406
  // If the focused item is also selected, the default drop target is after the last selected item.
403
407
  // But if the focused key is the first selected item, then default to before the first selected item.
404
408
  // This is to make reordering lists slightly easier. If you select top down, we assume you want to
405
409
  // move the items down. If you select bottom up, we assume you want to move the items up.
406
- if (selectionManager.isSelected(key)) {
410
+ if (key != null && selectionManager.isSelected(key)) {
407
411
  if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) dropPosition = 'before';
408
412
  else key = selectionManager.lastSelectedKey;
409
413
  }
@@ -494,14 +498,21 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
494
498
  let target = localState.state.target;
495
499
  if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
496
500
  else {
501
+ var _keyboardDelegate_getFirstKey, _keyboardDelegate_getLastKey;
497
502
  // If on the root, go to the item a page below the top. Otherwise a page below the current item.
498
- let nextKey = keyboardDelegate.getKeyPageBelow(target.type === 'item' ? target.key : keyboardDelegate.getFirstKey());
503
+ let targetKey = (_keyboardDelegate_getFirstKey = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey === void 0 ? void 0 : _keyboardDelegate_getFirstKey.call(keyboardDelegate);
504
+ if (target.type === 'item') targetKey = target.key;
505
+ let nextKey = null;
506
+ if (targetKey != null) nextKey = keyboardDelegate.getKeyPageBelow(targetKey);
499
507
  let dropPosition = target.type === 'item' ? target.dropPosition : 'after';
500
508
  // If there is no next key, or we are starting on the last key, jump to the last possible position.
501
- if (nextKey == null || target.type === 'item' && target.key === keyboardDelegate.getLastKey()) {
502
- nextKey = keyboardDelegate.getLastKey();
509
+ if (nextKey == null || target.type === 'item' && target.key === ((_keyboardDelegate_getLastKey = keyboardDelegate.getLastKey) === null || _keyboardDelegate_getLastKey === void 0 ? void 0 : _keyboardDelegate_getLastKey.call(keyboardDelegate))) {
510
+ var _keyboardDelegate_getLastKey1;
511
+ var _keyboardDelegate_getLastKey2;
512
+ 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;
503
513
  dropPosition = 'after';
504
514
  }
515
+ if (nextKey == null) break;
505
516
  target = {
506
517
  type: 'item',
507
518
  key: nextKey,
@@ -530,17 +541,20 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
530
541
  let target = localState.state.target;
531
542
  if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
532
543
  else if (target.type === 'item') {
544
+ var _keyboardDelegate_getFirstKey1;
533
545
  // If at the top already, switch to the root. Otherwise navigate a page up.
534
- if (target.key === keyboardDelegate.getFirstKey()) target = {
546
+ if (target.key === ((_keyboardDelegate_getFirstKey1 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey1 === void 0 ? void 0 : _keyboardDelegate_getFirstKey1.call(keyboardDelegate))) target = {
535
547
  type: 'root'
536
548
  };
537
549
  else {
538
550
  let nextKey = keyboardDelegate.getKeyPageAbove(target.key);
539
551
  let dropPosition = target.dropPosition;
540
552
  if (nextKey == null) {
541
- nextKey = keyboardDelegate.getFirstKey();
553
+ var _keyboardDelegate_getFirstKey2;
554
+ nextKey = (_keyboardDelegate_getFirstKey2 = keyboardDelegate.getFirstKey) === null || _keyboardDelegate_getFirstKey2 === void 0 ? void 0 : _keyboardDelegate_getFirstKey2.call(keyboardDelegate);
542
555
  dropPosition = 'before';
543
556
  }
557
+ if (nextKey == null) break;
544
558
  target = {
545
559
  type: 'item',
546
560
  key: nextKey,