@react-aria/dnd 3.6.2-nightly.4701 → 3.6.2-nightly.4709

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 (36) hide show
  1. package/dist/DragPreview.main.js.map +1 -1
  2. package/dist/DragPreview.module.js.map +1 -1
  3. package/dist/ListDropTargetDelegate.main.js +5 -1
  4. package/dist/ListDropTargetDelegate.main.js.map +1 -1
  5. package/dist/ListDropTargetDelegate.mjs +5 -1
  6. package/dist/ListDropTargetDelegate.module.js +5 -1
  7. package/dist/ListDropTargetDelegate.module.js.map +1 -1
  8. package/dist/types.d.ts +2 -2
  9. package/dist/types.d.ts.map +1 -1
  10. package/dist/useAutoScroll.main.js.map +1 -1
  11. package/dist/useAutoScroll.module.js.map +1 -1
  12. package/dist/useDrag.main.js.map +1 -1
  13. package/dist/useDrag.module.js.map +1 -1
  14. package/dist/useDraggableCollection.main.js.map +1 -1
  15. package/dist/useDraggableCollection.module.js.map +1 -1
  16. package/dist/useDrop.main.js.map +1 -1
  17. package/dist/useDrop.module.js.map +1 -1
  18. package/dist/useDropIndicator.main.js.map +1 -1
  19. package/dist/useDropIndicator.module.js.map +1 -1
  20. package/dist/useDroppableCollection.main.js.map +1 -1
  21. package/dist/useDroppableCollection.module.js.map +1 -1
  22. package/dist/useDroppableItem.main.js.map +1 -1
  23. package/dist/useDroppableItem.module.js.map +1 -1
  24. package/dist/utils.main.js.map +1 -1
  25. package/dist/utils.module.js.map +1 -1
  26. package/package.json +11 -11
  27. package/src/DragPreview.tsx +2 -2
  28. package/src/ListDropTargetDelegate.ts +6 -3
  29. package/src/useAutoScroll.ts +2 -1
  30. package/src/useDrag.ts +2 -2
  31. package/src/useDraggableCollection.ts +1 -1
  32. package/src/useDrop.ts +2 -2
  33. package/src/useDropIndicator.ts +2 -2
  34. package/src/useDroppableCollection.ts +3 -2
  35. package/src/useDroppableItem.ts +2 -2
  36. package/src/utils.ts +1 -2
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUD,SAAS,kCAAY,KAAuB,EAAE,GAA0C;IACtF,IAAI,SAAS,MAAM,QAAQ;IAC3B,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAe;IACpD,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAE;IAEpB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,CAAC,OAAmB;YACjD,qFAAqF;YACrF,kGAAkG;YAClG,CAAA,GAAA,yBAAQ,EAAE;gBACR,YAAY,OAAO;YACrB;YAEA,+CAA+C;YAC/C,SAAS,OAAO,OAAO;YAEvB,kFAAkF;YAClF,sBAAsB;gBACpB,YAAY;YACd;QACF,GAAG;QAAC;KAAO;IAEX,IAAI,CAAC,UACH,OAAO;IAGT,qBACE,0DAAC;QAAI,OAAO;YAAC,QAAQ;YAAM,UAAU;YAAY,KAAK;YAAG,MAAM;QAAO;QAAG,KAAK;OAC3E;AAGP;AAEA,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-aria/dnd/src/DragPreview.tsx"],"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 {DragItem, DragPreviewRenderer} from '@react-types/shared';\nimport {flushSync} from 'react-dom';\nimport React, {JSX, RefObject, useImperativeHandle, useRef, useState} from 'react';\n\nexport interface DragPreviewProps {\n children: (items: DragItem[]) => JSX.Element\n}\n\nfunction DragPreview(props: DragPreviewProps, ref: RefObject<DragPreviewRenderer | null>) {\n let render = props.children;\n let [children, setChildren] = useState<JSX.Element>(null);\n let domRef = useRef(null);\n\n useImperativeHandle(ref, () => (items: DragItem[], callback: (node: HTMLElement) => void) => {\n // This will be called during the onDragStart event by useDrag. We need to render the\n // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.\n flushSync(() => {\n setChildren(render(items));\n });\n\n // Yield back to useDrag to set the drag image.\n callback(domRef.current);\n\n // Remove the preview from the DOM after a frame so the browser has time to paint.\n requestAnimationFrame(() => {\n setChildren(null);\n });\n }, [render]);\n\n if (!children) {\n return null;\n }\n\n return (\n <div style={{zIndex: -100, position: 'absolute', top: 0, left: -100000}} ref={domRef}>\n {children}\n </div>\n );\n}\n\nlet _DragPreview = React.forwardRef(DragPreview);\nexport {_DragPreview as DragPreview};\n"],"names":[],"version":3,"file":"DragPreview.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUD,SAAS,kCAAY,KAAuB,EAAE,GAA0C;IACtF,IAAI,SAAS,MAAM,QAAQ;IAC3B,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAe;IACpD,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAE;IAEpB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,CAAC,OAAmB;YACjD,qFAAqF;YACrF,kGAAkG;YAClG,CAAA,GAAA,yBAAQ,EAAE;gBACR,YAAY,OAAO;YACrB;YAEA,+CAA+C;YAC/C,SAAS,OAAO,OAAO;YAEvB,kFAAkF;YAClF,sBAAsB;gBACpB,YAAY;YACd;QACF,GAAG;QAAC;KAAO;IAEX,IAAI,CAAC,UACH,OAAO;IAGT,qBACE,0DAAC;QAAI,OAAO;YAAC,QAAQ;YAAM,UAAU;YAAY,KAAK;YAAG,MAAM;QAAO;QAAG,KAAK;OAC3E;AAGP;AAEA,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-aria/dnd/src/DragPreview.tsx"],"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 {DragItem, DragPreviewRenderer, RefObject} from '@react-types/shared';\nimport {flushSync} from 'react-dom';\nimport React, {JSX, useImperativeHandle, useRef, useState} from 'react';\n\nexport interface DragPreviewProps {\n children: (items: DragItem[]) => JSX.Element\n}\n\nfunction DragPreview(props: DragPreviewProps, ref: RefObject<DragPreviewRenderer | null>) {\n let render = props.children;\n let [children, setChildren] = useState<JSX.Element>(null);\n let domRef = useRef(null);\n\n useImperativeHandle(ref, () => (items: DragItem[], callback: (node: HTMLElement) => void) => {\n // This will be called during the onDragStart event by useDrag. We need to render the\n // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.\n flushSync(() => {\n setChildren(render(items));\n });\n\n // Yield back to useDrag to set the drag image.\n callback(domRef.current);\n\n // Remove the preview from the DOM after a frame so the browser has time to paint.\n requestAnimationFrame(() => {\n setChildren(null);\n });\n }, [render]);\n\n if (!children) {\n return null;\n }\n\n return (\n <div style={{zIndex: -100, position: 'absolute', top: 0, left: -100000}} ref={domRef}>\n {children}\n </div>\n );\n}\n\nlet _DragPreview = React.forwardRef(DragPreview);\nexport {_DragPreview as DragPreview};\n"],"names":[],"version":3,"file":"DragPreview.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUD,SAAS,kCAAY,KAAuB,EAAE,GAA0C;IACtF,IAAI,SAAS,MAAM,QAAQ;IAC3B,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAe;IACpD,IAAI,SAAS,CAAA,GAAA,aAAK,EAAE;IAEpB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,CAAC,OAAmB;YACjD,qFAAqF;YACrF,kGAAkG;YAClG,CAAA,GAAA,gBAAQ,EAAE;gBACR,YAAY,OAAO;YACrB;YAEA,+CAA+C;YAC/C,SAAS,OAAO,OAAO;YAEvB,kFAAkF;YAClF,sBAAsB;gBACpB,YAAY;YACd;QACF,GAAG;QAAC;KAAO;IAEX,IAAI,CAAC,UACH,OAAO;IAGT,qBACE,gCAAC;QAAI,OAAO;YAAC,QAAQ;YAAM,UAAU;YAAY,KAAK;YAAG,MAAM;QAAO;QAAG,KAAK;OAC3E;AAGP;AAEA,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-aria/dnd/src/DragPreview.tsx"],"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 {DragItem, DragPreviewRenderer} from '@react-types/shared';\nimport {flushSync} from 'react-dom';\nimport React, {JSX, RefObject, useImperativeHandle, useRef, useState} from 'react';\n\nexport interface DragPreviewProps {\n children: (items: DragItem[]) => JSX.Element\n}\n\nfunction DragPreview(props: DragPreviewProps, ref: RefObject<DragPreviewRenderer | null>) {\n let render = props.children;\n let [children, setChildren] = useState<JSX.Element>(null);\n let domRef = useRef(null);\n\n useImperativeHandle(ref, () => (items: DragItem[], callback: (node: HTMLElement) => void) => {\n // This will be called during the onDragStart event by useDrag. We need to render the\n // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.\n flushSync(() => {\n setChildren(render(items));\n });\n\n // Yield back to useDrag to set the drag image.\n callback(domRef.current);\n\n // Remove the preview from the DOM after a frame so the browser has time to paint.\n requestAnimationFrame(() => {\n setChildren(null);\n });\n }, [render]);\n\n if (!children) {\n return null;\n }\n\n return (\n <div style={{zIndex: -100, position: 'absolute', top: 0, left: -100000}} ref={domRef}>\n {children}\n </div>\n );\n}\n\nlet _DragPreview = React.forwardRef(DragPreview);\nexport {_DragPreview as DragPreview};\n"],"names":[],"version":3,"file":"DragPreview.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUD,SAAS,kCAAY,KAAuB,EAAE,GAA0C;IACtF,IAAI,SAAS,MAAM,QAAQ;IAC3B,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAe;IACpD,IAAI,SAAS,CAAA,GAAA,aAAK,EAAE;IAEpB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,CAAC,OAAmB;YACjD,qFAAqF;YACrF,kGAAkG;YAClG,CAAA,GAAA,gBAAQ,EAAE;gBACR,YAAY,OAAO;YACrB;YAEA,+CAA+C;YAC/C,SAAS,OAAO,OAAO;YAEvB,kFAAkF;YAClF,sBAAsB;gBACpB,YAAY;YACd;QACF,GAAG;QAAC;KAAO;IAEX,IAAI,CAAC,UACH,OAAO;IAGT,qBACE,gCAAC;QAAI,OAAO;YAAC,QAAQ;YAAM,UAAU;YAAY,KAAK;YAAG,MAAM;QAAO;QAAG,KAAK;OAC3E;AAGP;AAEA,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-aria/dnd/src/DragPreview.tsx"],"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 {DragItem, DragPreviewRenderer, RefObject} from '@react-types/shared';\nimport {flushSync} from 'react-dom';\nimport React, {JSX, useImperativeHandle, useRef, useState} from 'react';\n\nexport interface DragPreviewProps {\n children: (items: DragItem[]) => JSX.Element\n}\n\nfunction DragPreview(props: DragPreviewProps, ref: RefObject<DragPreviewRenderer | null>) {\n let render = props.children;\n let [children, setChildren] = useState<JSX.Element>(null);\n let domRef = useRef(null);\n\n useImperativeHandle(ref, () => (items: DragItem[], callback: (node: HTMLElement) => void) => {\n // This will be called during the onDragStart event by useDrag. We need to render the\n // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.\n flushSync(() => {\n setChildren(render(items));\n });\n\n // Yield back to useDrag to set the drag image.\n callback(domRef.current);\n\n // Remove the preview from the DOM after a frame so the browser has time to paint.\n requestAnimationFrame(() => {\n setChildren(null);\n });\n }, [render]);\n\n if (!children) {\n return null;\n }\n\n return (\n <div style={{zIndex: -100, position: 'absolute', top: 0, left: -100000}} ref={domRef}>\n {children}\n </div>\n );\n}\n\nlet _DragPreview = React.forwardRef(DragPreview);\nexport {_DragPreview as DragPreview};\n"],"names":[],"version":3,"file":"DragPreview.module.js.map"}
@@ -42,9 +42,13 @@ class $2268795bbb597ecb$export$fbd65d14c79e28cc {
42
42
  let elements = this.ref.current.querySelectorAll('[data-key]');
43
43
  let elementMap = new Map();
44
44
  for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
45
+ // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
46
+ // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.
47
+ // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic
48
+ // that may need to happen then
45
49
  let items = [
46
50
  ...this.collection
47
- ];
51
+ ].filter((item)=>item.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AAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AA6HF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation} from '@react-types/shared';\nimport {RefObject} from 'react';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n let items = [...this.collection];\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
1
+ {"mappings":";;;;;;AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,c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AAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAiIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
@@ -36,9 +36,13 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
36
36
  let elements = this.ref.current.querySelectorAll('[data-key]');
37
37
  let elementMap = new Map();
38
38
  for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
39
+ // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
40
+ // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.
41
+ // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic
42
+ // that may need to happen then
39
43
  let items = [
40
44
  ...this.collection
41
- ];
45
+ ].filter((item)=>item.type === 'item');
42
46
  let low = 0;
43
47
  let high = items.length;
44
48
  while(low < high){
@@ -36,9 +36,13 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
36
36
  let elements = this.ref.current.querySelectorAll('[data-key]');
37
37
  let elementMap = new Map();
38
38
  for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
39
+ // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
40
+ // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.
41
+ // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic
42
+ // that may need to happen then
39
43
  let items = [
40
44
  ...this.collection
41
- ];
45
+ ].filter((item)=>item.type === 'item');
42
46
  let low = 0;
43
47
  let high = items.length;
44
48
  while(low < high){
@@ -1 +1 @@
1
- {"mappings":"AA+BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB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argetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation} from '@react-types/shared';\nimport {RefObject} from 'react';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n let items = [...this.collection];\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
1
+ {"mappings":"AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,E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AAC,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ;oBAC7D,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAQ,IACrE,OAAO,YAAY,GAAG,YAAY,UAAU;yBACvC,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAO,IAC3E,OAAO,YAAY,GAAG,YAAY,WAAW;gBAEjD;gBAEA,OAAO;YACT;QACF;QAEA,IAAI,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,QAAQ,qBAAqB;QAEpC,IAAI,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,QACrH,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IAtIA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAiIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { DirectoryDropItem, DropItem, FileDropItem, TextDropItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, DragTypes, DroppableCollectionProps, DropTargetDelegate, KeyboardDelegate, DropTarget, DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, Key, DOMAttributes, Direction, Node, Orientation } from "@react-types/shared";
1
+ import { DirectoryDropItem, DropItem, FileDropItem, TextDropItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, DragTypes, RefObject, DroppableCollectionProps, DropTargetDelegate, KeyboardDelegate, DropTarget, DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, Key, DOMAttributes, Direction, Node, Orientation } from "@react-types/shared";
2
2
  import { AriaButtonProps } from "@react-types/button";
3
- import React, { HTMLAttributes, RefObject, JSX } from "react";
3
+ import React, { HTMLAttributes, JSX } from "react";
4
4
  import { DroppableCollectionState, DraggableCollectionState } from "@react-stately/dnd";
5
5
  export const DIRECTORY_DRAG_TYPE: unique symbol;
6
6
  /** Returns whether a drop item contains text data. */
@@ -1 +1 @@
1
- {"mappings":";;;;ACwBA,OAAO,MAAM,kCAA8B,CAAC;AAoS5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;ACvOD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AGhFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,CAAC;IACnC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;IAC1H,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aA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C,YAAW,kBAAkB;gBAOnD,UAAU,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CA+F7G;ACpJD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\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\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;ACuBA,OAAO,MAAM,kCAA8B,CAAC;AAoS5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;ACtOD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AGhFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,CAAC;IACnC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,E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AAO,EAAE,cAAc,GAAG,eAAe,CA6ErE;AC9ID;IACE;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAWD,mCAAoC,YAAW,kBAAkB;gBAOnD,UAAU,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CAmG7G;ACvJD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\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\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,kCAAW,EAAE,IAAI,OAAO,IAAI,IAAI,OAAO,GA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AM,EAAE,GAAG,IAAI;gBAEjB,IAAI,IAAI,KACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.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 {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject, useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef({\n timer: null,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,kCAAW,EAAE,IAAI,OAAO,IAAI,IAAI,OAAO,GAAG,CAAA,GAAA,qCAAc,EAAE,IAAI,OAAO;YAC7F,IAAI,QAAQ,OAAO,gBAAgB,CAAC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I,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.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 {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef({\n timer: null,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,mBAAW,EAAE,IAAI,OAAO,IAAI,IAAI,OAAO,GAAG,CAAA,GAAA,sBAAc,EAAE,IAAI,OAAO;YAC7F,IAAI,QAAQ,OAAO,gBAAgB,CAAC,cAAc,OAAO;YACzD,YAAY,OAAO,GAAG,gBAAgB,IAAI,CAAC,MA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KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.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 {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject, useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef({\n timer: null,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,mBAAW,EAAE,IAAI,OAAO,IAAI,IAAI,OAAO,GAAG,CAAA,GAAA,sBAAc,EAAE,IAAI,OAAO;YAC7F,IAAI,QAAQ,OAAO,gBAAgB,CAAC,cAAc,OAAO;YACzD,YAAY,OAAO,GAAG,gBAAgB,IAAI,CAAC,MAAM,SAAS;YAC1D,YAAY,OAAO,GAAG,gBAAgB,IAAI,CAAC,MAAM,SAAS;QAC5D;IACF,GAAG;QAAC;KAA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AAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.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 {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef({\n timer: null,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = null;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CD,MAAM,iCAAW;IACf,UAAU;QACR,OAAO;QACP,KAAK;IACP;IACA,OAAO;QACL,OAAO;QACP,KAAK;IACP;IACA,SAAS;QACP,OAAO;QACP,KAAK;IACP;AACF;AAMO,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,QAAQ,CAAA,GAAA,mBAAK,EAAE;iBACjB;QACA,GAAG;QACH,GAAG;IACL,GAAG,OAAO;IACV,MAAM,OAAO,GAAG;IAChB,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAE;IAC3B,IAAI,CAAC,YAAY,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC9C,IAAI,cAAc,CAAC;QACjB,cAAc,OAAO,GAAG;QACxB,iBAAiB;IACnB;IACA,IAAI,qBA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,YAAY,KACvE,oBAAoB;gBACpB,sBAAsB,OAAO,GAAG;qBAEhC,sBAAsB,OAAO,GAAG,EAAE,WAAW;YAEjD;QACF;QACA,kBAAiB,CAAC;YAChB,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,EAAE,GAAG,KAAK,SAAS;gBACrD,EAAE,cAAc;gBAChB,EAAE,eAAe;YACnB;QACF;QACA,gBAAe,CAAC;YACd,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,EAAE,GAAG,KAAK,SAAS;gBACrD,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;QACA,SAAQ,CAAC;YACP,yGAAyG;YACzG,IAAI,CAAA,GAAA,oCAAa,EAAE,EAAE,WAAW,KAAK,sBAAsB,OAAO,KAAK,WAAW;gBAChF,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;IACF;IAGF,IAAI,YACF,OAAO;QACL,WAAW;YACT,WAAW;QACb;QACA,iBAAiB,CAAC;QAClB,YAAY;IACd;IAGF,OAAO;QACL,WAAW;YACT,GAAG,YAAY;YACf,WAAW;yBACX;oBACA;uBACA;QACF;QACA,iBAAiB;YACf,GAAG,gBAAgB;qBACnB;QACF;oBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDrag.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 {DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, DropOperation, PressEvent} from '@react-types/shared';\nimport {DragEvent, HTMLAttributes, RefObject, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, EFFECT_ALLOWED} from './constants';\nimport {globalDropEffect, setGlobalAllowedDropOperations, setGlobalDropEffect, useDragModality, writeToDataTransfer} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isVirtualClick, isVirtualPointerEvent, useDescription, useGlobalListeners, useLayoutEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DragOptions {\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DragStartEvent) => void,\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DragMoveEvent) => void,\n /** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */\n onDragEnd?: (e: DragEndEvent) => void,\n /** A function that returns the items being dragged. */\n getItems: () => DragItem[],\n /** The ref of the element that will be rendered as the drag preview while dragging. */\n preview?: RefObject<DragPreviewRenderer | null>,\n /** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */\n getAllowedDropOperations?: () => DropOperation[],\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the drag operation is disabled. If true, the element will not be draggable.\n */\n isDisabled?: boolean\n}\n\nexport interface DragResult {\n /** Props for the draggable element. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps,\n /** Whether the element is currently being dragged. */\n isDragging: boolean\n}\n\nconst MESSAGES = {\n keyboard: {\n start: 'dragDescriptionKeyboard',\n end: 'endDragKeyboard'\n },\n touch: {\n start: 'dragDescriptionTouch',\n end: 'endDragTouch'\n },\n virtual: {\n start: 'dragDescriptionVirtual',\n end: 'endDragVirtual'\n }\n};\n\n/**\n * Handles drag 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 useDrag(options: DragOptions): DragResult {\n let {hasDragButton, isDisabled} = options;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let state = useRef({\n options,\n x: 0,\n y: 0\n }).current;\n state.options = options;\n let isDraggingRef = useRef(false);\n let [isDragging, setDraggingState] = useState(false);\n let setDragging = (isDragging) => {\n isDraggingRef.current = isDragging;\n setDraggingState(isDragging);\n };\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n let modalityOnPointerDown = useRef<string>(null);\n\n let onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) {\n return;\n }\n\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n // If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.\n if (modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n startDragging(e.target as HTMLElement);\n modalityOnPointerDown.current = null;\n return;\n }\n\n if (typeof options.onDragStart === 'function') {\n options.onDragStart({\n type: 'dragstart',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n let items = options.getItems();\n writeToDataTransfer(e.dataTransfer, items);\n\n let allowed = DROP_OPERATION.all;\n if (typeof options.getAllowedDropOperations === 'function') {\n let allowedOperations = options.getAllowedDropOperations();\n allowed = DROP_OPERATION.none;\n for (let operation of allowedOperations) {\n allowed |= DROP_OPERATION[operation] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n e.dataTransfer.effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n\n // If there is a preview option, use it to render a custom preview image that will\n // appear under the pointer while dragging. If not, the element itself is dragged by the browser.\n if (typeof options.preview?.current === 'function') {\n options.preview.current(items, node => {\n // Compute the offset that the preview will appear under the mouse.\n // If possible, this is based on the point the user clicked on the target.\n // If the preview is much smaller, then just use the center point of the preview.\n let size = node.getBoundingClientRect();\n let rect = e.currentTarget.getBoundingClientRect();\n let x = e.clientX - rect.x;\n let y = e.clientY - rect.y;\n if (x > size.width || y > size.height) {\n x = size.width / 2;\n y = size.height / 2;\n }\n\n // Rounding height to an even number prevents blurry preview seen on some screens\n let height = 2 * Math.round(size.height / 2);\n node.style.height = `${height}px`;\n\n e.dataTransfer.setDragImage(node, x, y);\n });\n }\n\n // Enforce that drops are handled by useDrop.\n addGlobalListener(window, 'drop', e => {\n e.preventDefault();\n e.stopPropagation();\n console.warn('Drags initiated from the React Aria useDrag hook may only be dropped on a target created with useDrop. This ensures that a keyboard and screen reader accessible alternative is available.');\n }, {once: true});\n state.x = e.clientX;\n state.y = e.clientY;\n\n // Wait a frame before we set dragging to true so that the browser has time to\n // render the preview image before we update the element that has been dragged.\n requestAnimationFrame(() => {\n setDragging(true);\n });\n };\n\n let onDrag = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (e.clientX === state.x && e.clientY === state.y) {\n return;\n }\n\n if (typeof options.onDragMove === 'function') {\n options.onDragMove({\n type: 'dragmove',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n };\n\n let onDragEnd = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (typeof options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: e.clientX,\n y: e.clientY,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[e.dataTransfer.dropEffect]\n };\n\n // Chrome Android always returns none as its dropEffect so we use the drop effect set in useDrop via\n // onDragEnter/onDragOver instead. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n if (globalDropEffect) {\n event.dropOperation = DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect];\n }\n options.onDragEnd(event);\n }\n\n setDragging(false);\n removeAllGlobalListeners();\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // If the dragged element is removed from the DOM via onDrop, onDragEnd won't fire: https://bugzilla.mozilla.org/show_bug.cgi?id=460801\n // In this case, we need to manually call onDragEnd on cleanup\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n return () => {\n if (isDraggingRef.current) {\n if (typeof state.options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: 0,\n y: 0,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect || 'none']\n };\n state.options.onDragEnd(event);\n }\n\n setDragging(false);\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n }\n };\n }, [state]);\n\n let onPress = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard' && e.pointerType !== 'virtual') {\n return;\n }\n\n startDragging(e.target as HTMLElement);\n };\n\n let startDragging = (target: HTMLElement) => {\n if (typeof state.options.onDragStart === 'function') {\n let rect = target.getBoundingClientRect();\n state.options.onDragStart({\n type: 'dragstart',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2)\n });\n }\n\n DragManager.beginDragging({\n element: target,\n items: state.options.getItems(),\n allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function'\n ? state.options.getAllowedDropOperations()\n : ['move', 'copy', 'link'],\n onDragEnd(e) {\n setDragging(false);\n if (typeof state.options.onDragEnd === 'function') {\n state.options.onDragEnd(e);\n }\n }\n }, stringFormatter);\n\n setDragging(true);\n };\n\n let modality = useDragModality();\n let message = !isDragging ? MESSAGES[modality].start : MESSAGES[modality].end;\n\n let descriptionProps = useDescription(stringFormatter.format(message));\n\n let interactions: HTMLAttributes<HTMLElement>;\n if (!hasDragButton) {\n // If there's no separate button to trigger accessible drag and drop mode,\n // then add event handlers to the draggable element itself to start dragging.\n // For keyboard, we use the Enter key in a capturing listener to prevent other\n // events such as selection from also occurring. We attempt to infer whether a\n // pointer event (e.g. long press) came from a touch screen reader, and then initiate\n // dragging in the native onDragStart listener above.\n\n interactions = {\n ...descriptionProps,\n onPointerDown(e) {\n modalityOnPointerDown.current = isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType;\n\n // Try to detect virtual drag passthrough gestures.\n if (e.width < 1 && e.height < 1) {\n // iOS VoiceOver.\n modalityOnPointerDown.current = 'virtual';\n } else {\n let rect = e.currentTarget.getBoundingClientRect();\n let offsetX = e.clientX - rect.x;\n let offsetY = e.clientY - rect.y;\n let centerX = rect.width / 2;\n let centerY = rect.height / 2;\n\n if (Math.abs(offsetX - centerX) <= 0.5 && Math.abs(offsetY - centerY) <= 0.5) {\n // Android TalkBack.\n modalityOnPointerDown.current = 'virtual';\n } else {\n modalityOnPointerDown.current = e.pointerType;\n }\n }\n },\n onKeyDownCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n onKeyUpCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n },\n onClick(e) {\n // Handle NVDA/JAWS in browse mode, and touch screen readers. In this case, no keyboard events are fired.\n if (isVirtualClick(e.nativeEvent) || modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n }\n };\n }\n\n if (isDisabled) {\n return {\n dragProps: {\n draggable: 'false'\n },\n dragButtonProps: {},\n isDragging: false\n };\n }\n\n return {\n dragProps: {\n ...interactions,\n draggable: 'true',\n onDragStart,\n onDrag,\n onDragEnd\n },\n dragButtonProps: {\n ...descriptionProps,\n onPress\n },\n isDragging\n };\n}\n"],"names":[],"version":3,"file":"useDrag.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CD,MAAM,iCAAW;IACf,UAAU;QACR,OAAO;QACP,KAAK;IACP;IACA,OAAO;QACL,OAAO;QACP,KAAK;IACP;IACA,SAAS;QACP,OAAO;QACP,KAAK;IACP;AACF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ACf,GAAG,gBAAgB;qBACnB;QACF;oBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDrag.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 {DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, DropOperation, PressEvent, RefObject} from '@react-types/shared';\nimport {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, EFFECT_ALLOWED} from './constants';\nimport {globalDropEffect, setGlobalAllowedDropOperations, setGlobalDropEffect, useDragModality, writeToDataTransfer} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isVirtualClick, isVirtualPointerEvent, useDescription, useGlobalListeners, useLayoutEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DragOptions {\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DragStartEvent) => void,\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DragMoveEvent) => void,\n /** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */\n onDragEnd?: (e: DragEndEvent) => void,\n /** A function that returns the items being dragged. */\n getItems: () => DragItem[],\n /** The ref of the element that will be rendered as the drag preview while dragging. */\n preview?: RefObject<DragPreviewRenderer | null>,\n /** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */\n getAllowedDropOperations?: () => DropOperation[],\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the drag operation is disabled. If true, the element will not be draggable.\n */\n isDisabled?: boolean\n}\n\nexport interface DragResult {\n /** Props for the draggable element. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps,\n /** Whether the element is currently being dragged. */\n isDragging: boolean\n}\n\nconst MESSAGES = {\n keyboard: {\n start: 'dragDescriptionKeyboard',\n end: 'endDragKeyboard'\n },\n touch: {\n start: 'dragDescriptionTouch',\n end: 'endDragTouch'\n },\n virtual: {\n start: 'dragDescriptionVirtual',\n end: 'endDragVirtual'\n }\n};\n\n/**\n * Handles drag 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 useDrag(options: DragOptions): DragResult {\n let {hasDragButton, isDisabled} = options;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let state = useRef({\n options,\n x: 0,\n y: 0\n }).current;\n state.options = options;\n let isDraggingRef = useRef(false);\n let [isDragging, setDraggingState] = useState(false);\n let setDragging = (isDragging) => {\n isDraggingRef.current = isDragging;\n setDraggingState(isDragging);\n };\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n let modalityOnPointerDown = useRef<string>(null);\n\n let onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) {\n return;\n }\n\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n // If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.\n if (modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n startDragging(e.target as HTMLElement);\n modalityOnPointerDown.current = null;\n return;\n }\n\n if (typeof options.onDragStart === 'function') {\n options.onDragStart({\n type: 'dragstart',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n let items = options.getItems();\n writeToDataTransfer(e.dataTransfer, items);\n\n let allowed = DROP_OPERATION.all;\n if (typeof options.getAllowedDropOperations === 'function') {\n let allowedOperations = options.getAllowedDropOperations();\n allowed = DROP_OPERATION.none;\n for (let operation of allowedOperations) {\n allowed |= DROP_OPERATION[operation] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n e.dataTransfer.effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n\n // If there is a preview option, use it to render a custom preview image that will\n // appear under the pointer while dragging. If not, the element itself is dragged by the browser.\n if (typeof options.preview?.current === 'function') {\n options.preview.current(items, node => {\n // Compute the offset that the preview will appear under the mouse.\n // If possible, this is based on the point the user clicked on the target.\n // If the preview is much smaller, then just use the center point of the preview.\n let size = node.getBoundingClientRect();\n let rect = e.currentTarget.getBoundingClientRect();\n let x = e.clientX - rect.x;\n let y = e.clientY - rect.y;\n if (x > size.width || y > size.height) {\n x = size.width / 2;\n y = size.height / 2;\n }\n\n // Rounding height to an even number prevents blurry preview seen on some screens\n let height = 2 * Math.round(size.height / 2);\n node.style.height = `${height}px`;\n\n e.dataTransfer.setDragImage(node, x, y);\n });\n }\n\n // Enforce that drops are handled by useDrop.\n addGlobalListener(window, 'drop', e => {\n e.preventDefault();\n e.stopPropagation();\n console.warn('Drags initiated from the React Aria useDrag hook may only be dropped on a target created with useDrop. This ensures that a keyboard and screen reader accessible alternative is available.');\n }, {once: true});\n state.x = e.clientX;\n state.y = e.clientY;\n\n // Wait a frame before we set dragging to true so that the browser has time to\n // render the preview image before we update the element that has been dragged.\n requestAnimationFrame(() => {\n setDragging(true);\n });\n };\n\n let onDrag = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (e.clientX === state.x && e.clientY === state.y) {\n return;\n }\n\n if (typeof options.onDragMove === 'function') {\n options.onDragMove({\n type: 'dragmove',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n };\n\n let onDragEnd = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (typeof options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: e.clientX,\n y: e.clientY,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[e.dataTransfer.dropEffect]\n };\n\n // Chrome Android always returns none as its dropEffect so we use the drop effect set in useDrop via\n // onDragEnter/onDragOver instead. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n if (globalDropEffect) {\n event.dropOperation = DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect];\n }\n options.onDragEnd(event);\n }\n\n setDragging(false);\n removeAllGlobalListeners();\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // If the dragged element is removed from the DOM via onDrop, onDragEnd won't fire: https://bugzilla.mozilla.org/show_bug.cgi?id=460801\n // In this case, we need to manually call onDragEnd on cleanup\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n return () => {\n if (isDraggingRef.current) {\n if (typeof state.options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: 0,\n y: 0,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect || 'none']\n };\n state.options.onDragEnd(event);\n }\n\n setDragging(false);\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n }\n };\n }, [state]);\n\n let onPress = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard' && e.pointerType !== 'virtual') {\n return;\n }\n\n startDragging(e.target as HTMLElement);\n };\n\n let startDragging = (target: HTMLElement) => {\n if (typeof state.options.onDragStart === 'function') {\n let rect = target.getBoundingClientRect();\n state.options.onDragStart({\n type: 'dragstart',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2)\n });\n }\n\n DragManager.beginDragging({\n element: target,\n items: state.options.getItems(),\n allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function'\n ? state.options.getAllowedDropOperations()\n : ['move', 'copy', 'link'],\n onDragEnd(e) {\n setDragging(false);\n if (typeof state.options.onDragEnd === 'function') {\n state.options.onDragEnd(e);\n }\n }\n }, stringFormatter);\n\n setDragging(true);\n };\n\n let modality = useDragModality();\n let message = !isDragging ? MESSAGES[modality].start : MESSAGES[modality].end;\n\n let descriptionProps = useDescription(stringFormatter.format(message));\n\n let interactions: HTMLAttributes<HTMLElement>;\n if (!hasDragButton) {\n // If there's no separate button to trigger accessible drag and drop mode,\n // then add event handlers to the draggable element itself to start dragging.\n // For keyboard, we use the Enter key in a capturing listener to prevent other\n // events such as selection from also occurring. We attempt to infer whether a\n // pointer event (e.g. long press) came from a touch screen reader, and then initiate\n // dragging in the native onDragStart listener above.\n\n interactions = {\n ...descriptionProps,\n onPointerDown(e) {\n modalityOnPointerDown.current = isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType;\n\n // Try to detect virtual drag passthrough gestures.\n if (e.width < 1 && e.height < 1) {\n // iOS VoiceOver.\n modalityOnPointerDown.current = 'virtual';\n } else {\n let rect = e.currentTarget.getBoundingClientRect();\n let offsetX = e.clientX - rect.x;\n let offsetY = e.clientY - rect.y;\n let centerX = rect.width / 2;\n let centerY = rect.height / 2;\n\n if (Math.abs(offsetX - centerX) <= 0.5 && Math.abs(offsetY - centerY) <= 0.5) {\n // Android TalkBack.\n modalityOnPointerDown.current = 'virtual';\n } else {\n modalityOnPointerDown.current = e.pointerType;\n }\n }\n },\n onKeyDownCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n onKeyUpCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n },\n onClick(e) {\n // Handle NVDA/JAWS in browse mode, and touch screen readers. In this case, no keyboard events are fired.\n if (isVirtualClick(e.nativeEvent) || modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n }\n };\n }\n\n if (isDisabled) {\n return {\n dragProps: {\n draggable: 'false'\n },\n dragButtonProps: {},\n isDragging: false\n };\n }\n\n return {\n dragProps: {\n ...interactions,\n draggable: 'true',\n onDragStart,\n onDrag,\n onDragEnd\n },\n dragButtonProps: {\n ...descriptionProps,\n onPress\n },\n isDragging\n };\n}\n"],"names":[],"version":3,"file":"useDrag.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CD,MAAM,iCAAW;IACf,UAAU;QACR,OAAO;QACP,KAAK;IACP;IACA,OAAO;QACL,OAAO;QACP,KAAK;IACP;IACA,SAAS;QACP,OAAO;QACP,KAAK;IACP;AACF;AAMO,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;iBACjB;QACA,GAAG;QACH,GAAG;IACL,GAAG,OAAO;IACV,MAAM,OAAO,GAAG;IAChB,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,CAAC,YAAY,iBAAiB,GAAG,CAAA,GAAA,eAAO,EAAE;IAC9C,IAAI,cAAc,CAAC;QACjB,cAAc,OAAO,GAAG;QACxB,iBAAiB;IACnB;IACA,IAAI,qBAAC,iBAAiB,4BAAE,wBAAwB,EAAC,GAAG,CAAA,GAAA,yBAAiB;IACrE,IAAI,wBAAwB,CAAA,GAAA,aAAK,EAAU;IAE3C,IAAI,cAAc,CAAC;YAyCN;QAxCX,IAAI,EAAE,gBAAgB,EACpB;QAGF,mEAAmE;QACnE,EAAE,eAAe;QAEjB,kHAAkH;QAClH,IAAI,sBAAsB,OAAO,KAAK,WAAW;YAC/C,EAAE,cAAc;YAChB,cAAc,EAAE,MAAM;YACtB,sBA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E,GAAG,KAAK,SAAS;gBACrD,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;QACA,SAAQ,CAAC;YACP,yGAAyG;YACzG,IAAI,CAAA,GAAA,qBAAa,EAAE,EAAE,WAAW,KAAK,sBAAsB,OAAO,KAAK,WAAW;gBAChF,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;IACF;IAGF,IAAI,YACF,OAAO;QACL,WAAW;YACT,WAAW;QACb;QACA,iBAAiB,CAAC;QAClB,YAAY;IACd;IAGF,OAAO;QACL,WAAW;YACT,GAAG,YAAY;YACf,WAAW;yBACX;oBACA;uBACA;QACF;QACA,iBAAiB;YACf,GAAG,gBAAgB;qBACnB;QACF;oBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDrag.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 {DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, DropOperation, PressEvent} from '@react-types/shared';\nimport {DragEvent, HTMLAttributes, RefObject, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, EFFECT_ALLOWED} from './constants';\nimport {globalDropEffect, setGlobalAllowedDropOperations, setGlobalDropEffect, useDragModality, writeToDataTransfer} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isVirtualClick, isVirtualPointerEvent, useDescription, useGlobalListeners, useLayoutEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DragOptions {\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DragStartEvent) => void,\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DragMoveEvent) => void,\n /** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */\n onDragEnd?: (e: DragEndEvent) => void,\n /** A function that returns the items being dragged. */\n getItems: () => DragItem[],\n /** The ref of the element that will be rendered as the drag preview while dragging. */\n preview?: RefObject<DragPreviewRenderer | null>,\n /** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */\n getAllowedDropOperations?: () => DropOperation[],\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the drag operation is disabled. If true, the element will not be draggable.\n */\n isDisabled?: boolean\n}\n\nexport interface DragResult {\n /** Props for the draggable element. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps,\n /** Whether the element is currently being dragged. */\n isDragging: boolean\n}\n\nconst MESSAGES = {\n keyboard: {\n start: 'dragDescriptionKeyboard',\n end: 'endDragKeyboard'\n },\n touch: {\n start: 'dragDescriptionTouch',\n end: 'endDragTouch'\n },\n virtual: {\n start: 'dragDescriptionVirtual',\n end: 'endDragVirtual'\n }\n};\n\n/**\n * Handles drag 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 useDrag(options: DragOptions): DragResult {\n let {hasDragButton, isDisabled} = options;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let state = useRef({\n options,\n x: 0,\n y: 0\n }).current;\n state.options = options;\n let isDraggingRef = useRef(false);\n let [isDragging, setDraggingState] = useState(false);\n let setDragging = (isDragging) => {\n isDraggingRef.current = isDragging;\n setDraggingState(isDragging);\n };\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n let modalityOnPointerDown = useRef<string>(null);\n\n let onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) {\n return;\n }\n\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n // If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.\n if (modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n startDragging(e.target as HTMLElement);\n modalityOnPointerDown.current = null;\n return;\n }\n\n if (typeof options.onDragStart === 'function') {\n options.onDragStart({\n type: 'dragstart',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n let items = options.getItems();\n writeToDataTransfer(e.dataTransfer, items);\n\n let allowed = DROP_OPERATION.all;\n if (typeof options.getAllowedDropOperations === 'function') {\n let allowedOperations = options.getAllowedDropOperations();\n allowed = DROP_OPERATION.none;\n for (let operation of allowedOperations) {\n allowed |= DROP_OPERATION[operation] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n e.dataTransfer.effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n\n // If there is a preview option, use it to render a custom preview image that will\n // appear under the pointer while dragging. If not, the element itself is dragged by the browser.\n if (typeof options.preview?.current === 'function') {\n options.preview.current(items, node => {\n // Compute the offset that the preview will appear under the mouse.\n // If possible, this is based on the point the user clicked on the target.\n // If the preview is much smaller, then just use the center point of the preview.\n let size = node.getBoundingClientRect();\n let rect = e.currentTarget.getBoundingClientRect();\n let x = e.clientX - rect.x;\n let y = e.clientY - rect.y;\n if (x > size.width || y > size.height) {\n x = size.width / 2;\n y = size.height / 2;\n }\n\n // Rounding height to an even number prevents blurry preview seen on some screens\n let height = 2 * Math.round(size.height / 2);\n node.style.height = `${height}px`;\n\n e.dataTransfer.setDragImage(node, x, y);\n });\n }\n\n // Enforce that drops are handled by useDrop.\n addGlobalListener(window, 'drop', e => {\n e.preventDefault();\n e.stopPropagation();\n console.warn('Drags initiated from the React Aria useDrag hook may only be dropped on a target created with useDrop. This ensures that a keyboard and screen reader accessible alternative is available.');\n }, {once: true});\n state.x = e.clientX;\n state.y = e.clientY;\n\n // Wait a frame before we set dragging to true so that the browser has time to\n // render the preview image before we update the element that has been dragged.\n requestAnimationFrame(() => {\n setDragging(true);\n });\n };\n\n let onDrag = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (e.clientX === state.x && e.clientY === state.y) {\n return;\n }\n\n if (typeof options.onDragMove === 'function') {\n options.onDragMove({\n type: 'dragmove',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n };\n\n let onDragEnd = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (typeof options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: e.clientX,\n y: e.clientY,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[e.dataTransfer.dropEffect]\n };\n\n // Chrome Android always returns none as its dropEffect so we use the drop effect set in useDrop via\n // onDragEnter/onDragOver instead. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n if (globalDropEffect) {\n event.dropOperation = DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect];\n }\n options.onDragEnd(event);\n }\n\n setDragging(false);\n removeAllGlobalListeners();\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // If the dragged element is removed from the DOM via onDrop, onDragEnd won't fire: https://bugzilla.mozilla.org/show_bug.cgi?id=460801\n // In this case, we need to manually call onDragEnd on cleanup\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n return () => {\n if (isDraggingRef.current) {\n if (typeof state.options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: 0,\n y: 0,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect || 'none']\n };\n state.options.onDragEnd(event);\n }\n\n setDragging(false);\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n }\n };\n }, [state]);\n\n let onPress = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard' && e.pointerType !== 'virtual') {\n return;\n }\n\n startDragging(e.target as HTMLElement);\n };\n\n let startDragging = (target: HTMLElement) => {\n if (typeof state.options.onDragStart === 'function') {\n let rect = target.getBoundingClientRect();\n state.options.onDragStart({\n type: 'dragstart',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2)\n });\n }\n\n DragManager.beginDragging({\n element: target,\n items: state.options.getItems(),\n allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function'\n ? state.options.getAllowedDropOperations()\n : ['move', 'copy', 'link'],\n onDragEnd(e) {\n setDragging(false);\n if (typeof state.options.onDragEnd === 'function') {\n state.options.onDragEnd(e);\n }\n }\n }, stringFormatter);\n\n setDragging(true);\n };\n\n let modality = useDragModality();\n let message = !isDragging ? MESSAGES[modality].start : MESSAGES[modality].end;\n\n let descriptionProps = useDescription(stringFormatter.format(message));\n\n let interactions: HTMLAttributes<HTMLElement>;\n if (!hasDragButton) {\n // If there's no separate button to trigger accessible drag and drop mode,\n // then add event handlers to the draggable element itself to start dragging.\n // For keyboard, we use the Enter key in a capturing listener to prevent other\n // events such as selection from also occurring. We attempt to infer whether a\n // pointer event (e.g. long press) came from a touch screen reader, and then initiate\n // dragging in the native onDragStart listener above.\n\n interactions = {\n ...descriptionProps,\n onPointerDown(e) {\n modalityOnPointerDown.current = isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType;\n\n // Try to detect virtual drag passthrough gestures.\n if (e.width < 1 && e.height < 1) {\n // iOS VoiceOver.\n modalityOnPointerDown.current = 'virtual';\n } else {\n let rect = e.currentTarget.getBoundingClientRect();\n let offsetX = e.clientX - rect.x;\n let offsetY = e.clientY - rect.y;\n let centerX = rect.width / 2;\n let centerY = rect.height / 2;\n\n if (Math.abs(offsetX - centerX) <= 0.5 && Math.abs(offsetY - centerY) <= 0.5) {\n // Android TalkBack.\n modalityOnPointerDown.current = 'virtual';\n } else {\n modalityOnPointerDown.current = e.pointerType;\n }\n }\n },\n onKeyDownCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n onKeyUpCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n },\n onClick(e) {\n // Handle NVDA/JAWS in browse mode, and touch screen readers. In this case, no keyboard events are fired.\n if (isVirtualClick(e.nativeEvent) || modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n }\n };\n }\n\n if (isDisabled) {\n return {\n dragProps: {\n draggable: 'false'\n },\n dragButtonProps: {},\n isDragging: false\n };\n }\n\n return {\n dragProps: {\n ...interactions,\n draggable: 'true',\n onDragStart,\n onDrag,\n onDragEnd\n },\n dragButtonProps: {\n ...descriptionProps,\n onPress\n },\n isDragging\n };\n}\n"],"names":[],"version":3,"file":"useDrag.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CD,MAAM,iCAAW;IACf,UAAU;QACR,OAAO;QACP,KAAK;IACP;IACA,OAAO;QACL,OAAO;QACP,KAAK;IACP;IACA,SAAS;QACP,OAAO;QACP,KAAK;IACP;AACF;AAMO,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;iBACjB;QACA,GAAG;QACH,GAAG;IACL,GAAG,OAAO;IACV,MAAM,OAAO,GAAG;IAChB,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAA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UAAU,KAAK,KAAK,GAAG;gBAC3B,IAAI,UAAU,KAAK,MAAM,GAAG;gBAE5B,IAAI,KAAK,GAAG,CAAC,UAAU,YAAY,OAAO,KAAK,GAAG,CAAC,UAAU,YAAY,KACvE,oBAAoB;gBACpB,sBAAsB,OAAO,GAAG;qBAEhC,sBAAsB,OAAO,GAAG,EAAE,WAAW;YAEjD;QACF;QACA,kBAAiB,CAAC;YAChB,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,EAAE,GAAG,KAAK,SAAS;gBACrD,EAAE,cAAc;gBAChB,EAAE,eAAe;YACnB;QACF;QACA,gBAAe,CAAC;YACd,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,EAAE,GAAG,KAAK,SAAS;gBACrD,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;QACA,SAAQ,CAAC;YACP,yGAAyG;YACzG,IAAI,CAAA,GAAA,qBAAa,EAAE,EAAE,WAAW,KAAK,sBAAsB,OAAO,KAAK,WAAW;gBAChF,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,cAAc,EAAE,MAAM;YACxB;QACF;IACF;IAGF,IAAI,YACF,OAAO;QACL,WAAW;YACT,WAAW;QACb;QACA,iBAAiB,CAAC;QAClB,YAAY;IACd;IAGF,OAAO;QACL,WAAW;YACT,GAAG,YAAY;YACf,WAAW;yBACX;oBACA;uBACA;QACF;QACA,iBAAiB;YACf,GAAG,gBAAgB;qBACnB;QACF;oBACA;IACF;AACF","sources":["packages/@react-aria/dnd/src/useDrag.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 {DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, DropOperation, PressEvent, RefObject} from '@react-types/shared';\nimport {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, EFFECT_ALLOWED} from './constants';\nimport {globalDropEffect, setGlobalAllowedDropOperations, setGlobalDropEffect, useDragModality, writeToDataTransfer} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isVirtualClick, isVirtualPointerEvent, useDescription, useGlobalListeners, useLayoutEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DragOptions {\n /** Handler that is called when a drag operation is started. */\n onDragStart?: (e: DragStartEvent) => void,\n /** Handler that is called when the drag is moved. */\n onDragMove?: (e: DragMoveEvent) => void,\n /** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */\n onDragEnd?: (e: DragEndEvent) => void,\n /** A function that returns the items being dragged. */\n getItems: () => DragItem[],\n /** The ref of the element that will be rendered as the drag preview while dragging. */\n preview?: RefObject<DragPreviewRenderer | null>,\n /** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */\n getAllowedDropOperations?: () => DropOperation[],\n /**\n * Whether the item has an explicit focusable drag affordance to initiate accessible drag and drop mode.\n * If true, the dragProps will omit these event handlers, and they will be applied to dragButtonProps instead.\n */\n hasDragButton?: boolean,\n /**\n * Whether the drag operation is disabled. If true, the element will not be draggable.\n */\n isDisabled?: boolean\n}\n\nexport interface DragResult {\n /** Props for the draggable element. */\n dragProps: HTMLAttributes<HTMLElement>,\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: AriaButtonProps,\n /** Whether the element is currently being dragged. */\n isDragging: boolean\n}\n\nconst MESSAGES = {\n keyboard: {\n start: 'dragDescriptionKeyboard',\n end: 'endDragKeyboard'\n },\n touch: {\n start: 'dragDescriptionTouch',\n end: 'endDragTouch'\n },\n virtual: {\n start: 'dragDescriptionVirtual',\n end: 'endDragVirtual'\n }\n};\n\n/**\n * Handles drag 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 useDrag(options: DragOptions): DragResult {\n let {hasDragButton, isDisabled} = options;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/dnd');\n let state = useRef({\n options,\n x: 0,\n y: 0\n }).current;\n state.options = options;\n let isDraggingRef = useRef(false);\n let [isDragging, setDraggingState] = useState(false);\n let setDragging = (isDragging) => {\n isDraggingRef.current = isDragging;\n setDraggingState(isDragging);\n };\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n let modalityOnPointerDown = useRef<string>(null);\n\n let onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) {\n return;\n }\n\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n // If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.\n if (modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n startDragging(e.target as HTMLElement);\n modalityOnPointerDown.current = null;\n return;\n }\n\n if (typeof options.onDragStart === 'function') {\n options.onDragStart({\n type: 'dragstart',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n let items = options.getItems();\n writeToDataTransfer(e.dataTransfer, items);\n\n let allowed = DROP_OPERATION.all;\n if (typeof options.getAllowedDropOperations === 'function') {\n let allowedOperations = options.getAllowedDropOperations();\n allowed = DROP_OPERATION.none;\n for (let operation of allowedOperations) {\n allowed |= DROP_OPERATION[operation] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n e.dataTransfer.effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n\n // If there is a preview option, use it to render a custom preview image that will\n // appear under the pointer while dragging. If not, the element itself is dragged by the browser.\n if (typeof options.preview?.current === 'function') {\n options.preview.current(items, node => {\n // Compute the offset that the preview will appear under the mouse.\n // If possible, this is based on the point the user clicked on the target.\n // If the preview is much smaller, then just use the center point of the preview.\n let size = node.getBoundingClientRect();\n let rect = e.currentTarget.getBoundingClientRect();\n let x = e.clientX - rect.x;\n let y = e.clientY - rect.y;\n if (x > size.width || y > size.height) {\n x = size.width / 2;\n y = size.height / 2;\n }\n\n // Rounding height to an even number prevents blurry preview seen on some screens\n let height = 2 * Math.round(size.height / 2);\n node.style.height = `${height}px`;\n\n e.dataTransfer.setDragImage(node, x, y);\n });\n }\n\n // Enforce that drops are handled by useDrop.\n addGlobalListener(window, 'drop', e => {\n e.preventDefault();\n e.stopPropagation();\n console.warn('Drags initiated from the React Aria useDrag hook may only be dropped on a target created with useDrop. This ensures that a keyboard and screen reader accessible alternative is available.');\n }, {once: true});\n state.x = e.clientX;\n state.y = e.clientY;\n\n // Wait a frame before we set dragging to true so that the browser has time to\n // render the preview image before we update the element that has been dragged.\n requestAnimationFrame(() => {\n setDragging(true);\n });\n };\n\n let onDrag = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (e.clientX === state.x && e.clientY === state.y) {\n return;\n }\n\n if (typeof options.onDragMove === 'function') {\n options.onDragMove({\n type: 'dragmove',\n x: e.clientX,\n y: e.clientY\n });\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n };\n\n let onDragEnd = (e: DragEvent) => {\n // Prevent the drag event from propagating to any parent draggables\n e.stopPropagation();\n\n if (typeof options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: e.clientX,\n y: e.clientY,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[e.dataTransfer.dropEffect]\n };\n\n // Chrome Android always returns none as its dropEffect so we use the drop effect set in useDrop via\n // onDragEnter/onDragOver instead. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n if (globalDropEffect) {\n event.dropOperation = DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect];\n }\n options.onDragEnd(event);\n }\n\n setDragging(false);\n removeAllGlobalListeners();\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // If the dragged element is removed from the DOM via onDrop, onDragEnd won't fire: https://bugzilla.mozilla.org/show_bug.cgi?id=460801\n // In this case, we need to manually call onDragEnd on cleanup\n // eslint-disable-next-line arrow-body-style\n useLayoutEffect(() => {\n return () => {\n if (isDraggingRef.current) {\n if (typeof state.options.onDragEnd === 'function') {\n let event: DragEndEvent = {\n type: 'dragend',\n x: 0,\n y: 0,\n dropOperation: DROP_EFFECT_TO_DROP_OPERATION[globalDropEffect || 'none']\n };\n state.options.onDragEnd(event);\n }\n\n setDragging(false);\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n }\n };\n }, [state]);\n\n let onPress = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard' && e.pointerType !== 'virtual') {\n return;\n }\n\n startDragging(e.target as HTMLElement);\n };\n\n let startDragging = (target: HTMLElement) => {\n if (typeof state.options.onDragStart === 'function') {\n let rect = target.getBoundingClientRect();\n state.options.onDragStart({\n type: 'dragstart',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2)\n });\n }\n\n DragManager.beginDragging({\n element: target,\n items: state.options.getItems(),\n allowedDropOperations: typeof state.options.getAllowedDropOperations === 'function'\n ? state.options.getAllowedDropOperations()\n : ['move', 'copy', 'link'],\n onDragEnd(e) {\n setDragging(false);\n if (typeof state.options.onDragEnd === 'function') {\n state.options.onDragEnd(e);\n }\n }\n }, stringFormatter);\n\n setDragging(true);\n };\n\n let modality = useDragModality();\n let message = !isDragging ? MESSAGES[modality].start : MESSAGES[modality].end;\n\n let descriptionProps = useDescription(stringFormatter.format(message));\n\n let interactions: HTMLAttributes<HTMLElement>;\n if (!hasDragButton) {\n // If there's no separate button to trigger accessible drag and drop mode,\n // then add event handlers to the draggable element itself to start dragging.\n // For keyboard, we use the Enter key in a capturing listener to prevent other\n // events such as selection from also occurring. We attempt to infer whether a\n // pointer event (e.g. long press) came from a touch screen reader, and then initiate\n // dragging in the native onDragStart listener above.\n\n interactions = {\n ...descriptionProps,\n onPointerDown(e) {\n modalityOnPointerDown.current = isVirtualPointerEvent(e.nativeEvent) ? 'virtual' : e.pointerType;\n\n // Try to detect virtual drag passthrough gestures.\n if (e.width < 1 && e.height < 1) {\n // iOS VoiceOver.\n modalityOnPointerDown.current = 'virtual';\n } else {\n let rect = e.currentTarget.getBoundingClientRect();\n let offsetX = e.clientX - rect.x;\n let offsetY = e.clientY - rect.y;\n let centerX = rect.width / 2;\n let centerY = rect.height / 2;\n\n if (Math.abs(offsetX - centerX) <= 0.5 && Math.abs(offsetY - centerY) <= 0.5) {\n // Android TalkBack.\n modalityOnPointerDown.current = 'virtual';\n } else {\n modalityOnPointerDown.current = e.pointerType;\n }\n }\n },\n onKeyDownCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n onKeyUpCapture(e) {\n if (e.target === e.currentTarget && e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n },\n onClick(e) {\n // Handle NVDA/JAWS in browse mode, and touch screen readers. In this case, no keyboard events are fired.\n if (isVirtualClick(e.nativeEvent) || modalityOnPointerDown.current === 'virtual') {\n e.preventDefault();\n e.stopPropagation();\n startDragging(e.target as HTMLElement);\n }\n }\n };\n }\n\n if (isDisabled) {\n return {\n dragProps: {\n draggable: 'false'\n },\n dragButtonProps: {},\n isDragging: false\n };\n }\n\n return {\n dragProps: {\n ...interactions,\n draggable: 'true',\n onDragStart,\n onDrag,\n onDragEnd\n },\n dragButtonProps: {\n ...descriptionProps,\n onPress\n },\n isDragging\n };\n}\n"],"names":[],"version":3,"file":"useDrag.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,wCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,kDAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from 'react';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,wCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,kDAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from '@react-types/shared';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,yCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,yCAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from 'react';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAYM,SAAS,0CAAuB,KAAiC,EAAE,KAA+B,EAAE,GAAkC;IAC3I,0EAA0E;IAC1E,IAAI,yBAAC,qBAAqB,EAAC,GAAG,CAAA,GAAA,yCAAa;IAC3C,IAAK,MAAM,YAAY,CAAC,IAAI,GAAG,KAAK,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,MAAK,IAAI,OAAO,EAChF,CAAA,GAAA,yCAAuB,EAAE;AAE7B","sources":["packages/@react-aria/dnd/src/useDraggableCollection.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DraggableCollectionState} from '@react-stately/dnd';\nimport {globalDndState, setDraggingCollectionRef} from './utils';\nimport {RefObject} from '@react-types/shared';\n\nexport interface DraggableCollectionOptions {}\n\n/**\n * Handles drag interactions for a collection component, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDraggableCollection(props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>): void {\n // Update global DnD state if this keys within this collection are dragged\n let {draggingCollectionRef} = globalDndState;\n if (state.draggingKeys.size > 0 && draggingCollectionRef?.current !== ref.current) {\n setDraggingCollectionRef(ref);\n }\n}\n"],"names":[],"version":3,"file":"useDraggableCollection.module.js.map"}