@react-aria/dnd 3.11.5 → 3.11.6

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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,IAAI,oCAAc,IAAI;AACtB,IAAI,kCAAY,IAAI;AACpB,IAAI,oCAAkC;AACtC,IAAI,sCAAgB,IAAI;AAejB,SAAS,0CAAmB,MAAkB;IACnD,kCAAY,GAAG,CAAC,OAAO,OAAO,EAAE;IAChC,8CAAA,wDAAA,kCAAa,sBAAsB;IACnC,OAAO;QACL,kCAAY,MAAM,CAAC,OAAO,OAAO;QACjC,8CAAA,wDAAA,kCAAa,sBAAsB;IACrC;AACF;AASO,SAAS,0CAAiB,IAAmB;IAClD,gCAAU,GAAG,CAAC,KAAK,OAAO,EAAE;IAC5B,OAAO;QACL,gCAAU,MAAM,CAAC,KAAK,OAAO;IAC/B;AACF;AASO,SAAS,0CAAc,MAAkB,EAAE,eAAyC;IACzF,IAAI,mCACF,MAAM,IAAI,MAAM;IAGlB,oCAAc,IAAI,kCAAY,QAAQ;IACtC,sBAAsB;QACpB,IAAI,mCAAa;YACf,kCAAY,KAAK;YACjB,IAAI,CAAA,GAAA,yCAAc,QAAQ,YACxB,kCAAY,IAAI;QAEpB;IACF;IAEA,KAAK,IAAI,MAAM,oCACb;AAEJ;AAEO,SAAS;IACd,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IAErC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,KAAK,IAAM,WAAW;QAC1B,oCAAc,GAAG,CAAC;QAClB,OAAO;YACL,oCAAc,MAAM,CAAC;QACvB;IACF,GAAG,EAAE;IAEL,OAAO;AACT;AAGO,SAAS;IACd,OAAO,CAAC,CAAC;AACX;AAEA,SAAS;IACP,oCAAc;IACd,KAAK,IAAI,MAAM,oCACb;AAEJ;AAEO,SAAS,0CAAkB,OAAgB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A,yCAAO,EAAE,QAAQ,KAAK;IAClC,OAAO;WAAI,kCAAY,MAAM;KAAG,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,kCACzB,OAAO;QAGT,IAAI,OAAO,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.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 {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getDragModality, getTypes} from './utils';\nimport {isVirtualClick, isVirtualPointerEvent, nodeContains} from '@react-aria/utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {RefObject, useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void,\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return (): void => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return (): void => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession(): DragSession | null {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (nodeContains(target, element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup(): void {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown(): void {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent): void {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent): void {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey || nodeContains(this.getCurrentActivateButton(), e.target as Node)) {\n this.activate(this.currentDropTarget, this.currentDropItem);\n } else {\n this.drop();\n }\n }\n }\n\n getCurrentActivateButton(): FocusableElement | null {\n return this.currentDropItem?.activateButtonRef?.current ?? this.currentDropTarget?.activateButtonRef?.current ?? null;\n }\n\n onFocus(e: FocusEvent): void {\n let activateButton = this.getCurrentActivateButton();\n if (e.target === activateButton) {\n // TODO: canceling this breaks the focus ring. Revisit when we support tabbing.\n this.cancelEvent(e);\n return;\n }\n\n // Prevent focus events, except to the original drag target.\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === e.target as HTMLElement) ||\n this.validDropTargets.find(target => nodeContains(target.element, e.target as HTMLElement));\n\n if (!dropTarget) {\n // if (e.target === activateButton) {\n // activateButton.focus();\n // }\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(e.target as HTMLElement);\n if (dropTarget) {\n this.setCurrentDropTarget(dropTarget, item);\n }\n }\n\n onBlur(e: FocusEvent): void {\n let activateButton = this.getCurrentActivateButton();\n if (e.relatedTarget === activateButton) {\n this.cancelEvent(e);\n return;\n }\n\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent): void {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n let dropElements = dropItems.values();\n let item = [...dropElements].find(item => item.element === e.target as HTMLElement || nodeContains(item.activateButtonRef?.current, e.target as HTMLElement));\n let dropTarget = this.validDropTargets.find(target => nodeContains(target.element, e.target as HTMLElement));\n let activateButton = item?.activateButtonRef?.current ?? dropTarget?.activateButtonRef?.current;\n if (nodeContains(activateButton, e.target as HTMLElement) && dropTarget) {\n this.activate(dropTarget, item);\n return;\n }\n\n if (e.target === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n if (dropTarget) {\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent): void {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event): void {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n if ((e.type === 'focusin' || e.type === 'focusout') && (e.target === this.dragTarget?.element || e.target === this.getCurrentActivateButton())) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets(): void {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => nodeContains(target.element, item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.flatMap(item => item.activateButtonRef?.current ? [item.element, item.activateButtonRef?.current] : [item.element]),\n ...visibleDropTargets.flatMap(target => target.activateButtonRef?.current ? [target.element, target.activateButtonRef?.current] : [target.element])\n ], {shouldUseInert: true});\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden', 'inert']});\n }\n\n next(): void {\n // TODO: Allow tabbing to the activate button. Revisit once we fix the focus ring.\n // For now, the activate button is reachable by screen readers and ArrowLeft/ArrowRight\n // is usable specifically by Tree. Will need tabbing for other components.\n // let activateButton = this.getCurrentActivateButton();\n // if (activateButton && document.activeElement !== activateButton) {\n // activateButton.focus();\n // return;\n // }\n\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous(): void {\n // let activateButton = this.getCurrentActivateButton();\n // if (activateButton && document.activeElement === activateButton) {\n // let target = this.currentDropItem ?? this.currentDropTarget;\n // if (target) {\n // target.element.focus();\n // return;\n // }\n // }\n\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem): void {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end(): void {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel(): void {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.dragTarget.element.focus();\n }\n\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem): void {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate(dropTarget: DropTarget | null, dropItem: DroppableItem | null | undefined): void {\n if (dropTarget && typeof dropTarget.onDropActivate === 'function') {\n let target = dropItem?.target ?? null;\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, target);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"], [inert]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n}\n"],"names":[],"version":3,"file":"DragManager.module.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,IAAI,oCAAc,IAAI;AACtB,IAAI,kCAAY,IAAI;AACpB,IAAI,oCAAkC;AACtC,IAAI,sCAAgB,IAAI;AAejB,SAAS,0CAAmB,MAAkB;IACnD,kCAAY,GAAG,CAAC,OAAO,OAAO,EAAE;IAChC,8CAAA,wDAAA,kCAAa,sBAAsB;IACnC,OAAO;QACL,kCAAY,MAAM,CAAC,OAAO,OAAO;QACjC,8CAAA,wDAAA,kCAAa,sBAAsB;IACrC;AACF;AASO,SAAS,0CAAiB,IAAmB;IAClD,gCAAU,GAAG,CAAC,KAAK,OAAO,EAAE;IAC5B,OAAO;QACL,gCAAU,MAAM,CAAC,KAAK,OAAO;IAC/B;AACF;AASO,SAAS,0CAAc,MAAkB,EAAE,eAAyC;IACzF,IAAI,mCACF,MAAM,IAAI,MAAM;IAGlB,oCAAc,IAAI,kCAAY,QAAQ;IACtC,sBAAsB;QACpB,IAAI,mCAAa;YACf,kCAAY,KAAK;YACjB,IAAI,CAAA,GAAA,yCAAc,QAAQ,YACxB,kCAAY,IAAI;QAEpB;IACF;IAEA,KAAK,IAAI,MAAM,oCACb;AAEJ;AAEO,SAAS;IACd,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IAErC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,KAAK,IAAM,WAAW;QAC1B,oCAAc,GAAG,CAAC;QAClB,OAAO;YACL,oCAAc,MAAM,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G,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI;QAC7C,IAAI,CAAC,cAAc,GAAG;IACxB;AA6cF;AAEA,SAAS,2CAAqB,OAAmB;IAC/C,IAAI,QAAQ,CAAA,GAAA,yCAAO,EAAE,QAAQ,KAAK;IAClC,OAAO;WAAI,kCAAY,MAAM;KAAG,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,kCACzB,OAAO;QAGT,IAAI,OAAO,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.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 {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getActiveElement, getEventTarget, isVirtualClick, isVirtualPointerEvent, nodeContains} from '@react-aria/utils';\nimport {getDragModality, getTypes} from './utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {RefObject, useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void,\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return (): void => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n activateButtonRef?: RefObject<FocusableElement | null>\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return (): void => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession(): DragSession | null {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (nodeContains(target, element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup(): void {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown(): void {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent): void {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent): void {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey || nodeContains(this.getCurrentActivateButton(), getEventTarget(e) as Node)) {\n this.activate(this.currentDropTarget, this.currentDropItem);\n } else {\n this.drop();\n }\n }\n }\n\n getCurrentActivateButton(): FocusableElement | null {\n return this.currentDropItem?.activateButtonRef?.current ?? this.currentDropTarget?.activateButtonRef?.current ?? null;\n }\n\n onFocus(e: FocusEvent): void {\n let activateButton = this.getCurrentActivateButton();\n let eventTarget = getEventTarget(e);\n if (eventTarget === activateButton) {\n // TODO: canceling this breaks the focus ring. Revisit when we support tabbing.\n this.cancelEvent(e);\n return;\n }\n\n // Prevent focus events, except to the original drag target.\n if (eventTarget !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(eventTarget instanceof HTMLElement) || eventTarget === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === eventTarget) ||\n this.validDropTargets.find(target => nodeContains(target.element, eventTarget));\n\n if (!dropTarget) {\n // if (e.target === activateButton) {\n // activateButton.focus();\n // }\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(eventTarget);\n if (dropTarget) {\n this.setCurrentDropTarget(dropTarget, item);\n }\n }\n\n onBlur(e: FocusEvent): void {\n let activateButton = this.getCurrentActivateButton();\n if (e.relatedTarget === activateButton) {\n this.cancelEvent(e);\n return;\n }\n\n if (getEventTarget(e) !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent): void {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n let dropElements = dropItems.values();\n let eventTarget = getEventTarget(e) as HTMLElement;\n let item = [...dropElements].find(item => item.element === eventTarget || nodeContains(item.activateButtonRef?.current, eventTarget));\n let dropTarget = this.validDropTargets.find(target => nodeContains(target.element, eventTarget));\n let activateButton = item?.activateButtonRef?.current ?? dropTarget?.activateButtonRef?.current;\n if (nodeContains(activateButton, eventTarget) && dropTarget) {\n this.activate(dropTarget, item);\n return;\n }\n\n if (getEventTarget(e) === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n if (dropTarget) {\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent): void {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event): void {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n let eventTarget = getEventTarget(e);\n if ((e.type === 'focusin' || e.type === 'focusout') && (eventTarget === this.dragTarget?.element || eventTarget === this.getCurrentActivateButton())) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets(): void {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => nodeContains(target.element, item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.flatMap(item => item.activateButtonRef?.current ? [item.element, item.activateButtonRef?.current] : [item.element]),\n ...visibleDropTargets.flatMap(target => target.activateButtonRef?.current ? [target.element, target.activateButtonRef?.current] : [target.element])\n ], {shouldUseInert: true});\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden', 'inert']});\n }\n\n next(): void {\n // TODO: Allow tabbing to the activate button. Revisit once we fix the focus ring.\n // For now, the activate button is reachable by screen readers and ArrowLeft/ArrowRight\n // is usable specifically by Tree. Will need tabbing for other components.\n // let activateButton = this.getCurrentActivateButton();\n // if (activateButton && document.activeElement !== activateButton) {\n // activateButton.focus();\n // return;\n // }\n\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous(): void {\n // let activateButton = this.getCurrentActivateButton();\n // if (activateButton && document.activeElement === activateButton) {\n // let target = this.currentDropItem ?? this.currentDropTarget;\n // if (target) {\n // target.element.focus();\n // return;\n // }\n // }\n\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem): void {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end(): void {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n getActiveElement()?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel(): void {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"], [inert]')) {\n this.dragTarget.element.focus();\n }\n\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n getActiveElement()?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem): void {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate(dropTarget: DropTarget | null, dropItem: DroppableItem | null | undefined): void {\n if (dropTarget && typeof dropTarget.onDropActivate === 'function') {\n let target = dropItem?.target ?? null;\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, target);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"], [inert]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n}\n"],"names":[],"version":3,"file":"DragManager.module.js.map"}
@@ -39,7 +39,7 @@ function $6e16de4c92a0f271$var$nextDropTarget(keyboardDelegate, collection, targ
39
39
  let nextKey = null;
40
40
  if (horizontal) nextKey = horizontal === 'right' ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
41
41
  else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
42
- let nextCollectionKey = collection.getKeyAfter(target.key);
42
+ let nextCollectionKey = $6e16de4c92a0f271$var$getNextItem(collection, target.key, (key)=>collection.getKeyAfter(key));
43
43
  // If the keyboard delegate did not move to the next key in the collection,
44
44
  // jump to that key with the same drop position. Otherwise, try the other
45
45
  // drop positions on the current key first.
@@ -131,7 +131,7 @@ function $6e16de4c92a0f271$var$previousDropTarget(keyboardDelegate, collection,
131
131
  let prevKey = null;
132
132
  if (horizontal) prevKey = horizontal === 'left' ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
133
133
  else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
134
- let prevCollectionKey = collection.getKeyBefore(target.key);
134
+ let prevCollectionKey = $6e16de4c92a0f271$var$getNextItem(collection, target.key, (key)=>collection.getKeyBefore(key));
135
135
  // If the keyboard delegate did not move to the next key in the collection,
136
136
  // jump to that key with the same drop position. Otherwise, try the other
137
137
  // drop positions on the current key first.
@@ -186,7 +186,7 @@ function $6e16de4c92a0f271$var$getLastChild(collection, key) {
186
186
  // getChildNodes still returns child tree items even when the item is collapsed.
187
187
  // Checking if the next item has a greater level is a silly way to determine if the item is expanded.
188
188
  let targetNode = collection.getItem(key);
189
- let nextKey = collection.getKeyAfter(key);
189
+ let nextKey = $6e16de4c92a0f271$var$getNextItem(collection, key, (key)=>collection.getKeyAfter(key));
190
190
  let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
191
191
  if (targetNode && nextNode && nextNode.level > targetNode.level) {
192
192
  let children = (0, $2pOR2$reactstatelycollections.getChildNodes)(targetNode, collection);
@@ -200,6 +200,16 @@ function $6e16de4c92a0f271$var$getLastChild(collection, key) {
200
200
  }
201
201
  return null;
202
202
  }
203
+ // Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).
204
+ function $6e16de4c92a0f271$var$getNextItem(collection, key, getNextKey) {
205
+ let nextCollectionKey = getNextKey(key);
206
+ let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
207
+ while(nextCollectionNode && nextCollectionNode.type !== 'item'){
208
+ nextCollectionKey = getNextKey(nextCollectionNode.key);
209
+ nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
210
+ }
211
+ return nextCollectionKey;
212
+ }
203
213
 
204
214
 
205
215
  //# sourceMappingURL=DropTargetKeyboardNavigation.main.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAGO,SAAS,0CACd,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,SAA2C,EAC3C,MAAM,KAAK,EACX,OAAO,KAAK;IAEZ,OAAQ;QACN,KAAK;YACH,OAAO,MACH,qCAAe,kBAAkB,YAAY,QAAQ,MAAM,UAC3D,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM;QACrE,KAAK;YACH,OAAO,MACH,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM,WAC/D,qCAAe,kBAAkB,YAAY,QAAQ,MAAM;QACjE,KAAK;YACH,OAAO,yCAAmB,kBAAkB,YAAY,QAAQ;QAClE,KAAK;YACH,OAAO,qCAAe,kBAAkB,YAAY,QAAQ;IAChE;AACF;AAEA,SAAS,qCACP,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,OAAO,KAAK,EACZ,aAAsC,IAAI;IAE1C,IAAI,CAAC,QACH,OAAO;QACL,MAAM;IACR;IAGF,IAAI,OAAO,IAAI,KAAK,QAAQ;YACZ;YAAA;QAAd,IAAI,UAAU,CAAA,kCAAA,gCAAA,iBAAiB,WAAW,cAA5B,oDAAA,mCAAA,+BAAA,4CAAA,iCAAoC;QAClD,IAAI,WAAW,MACb,OAAO;YACL,MAAM;YACN,KAAK;Y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,mCAAa,UAAqC,EAAE,GAAQ;IACnE,gFAAgF;IAChF,qGAAqG;IACrG,IAAI,aAAa,WAAW,OAAO,CAAC;IACpC,IAAI,UAAU,WAAW,WAAW,CAAC;IACrC,IAAI,WAAW,WAAW,OAAO,WAAW,OAAO,CAAC,WAAW;IAC/D,IAAI,cAAc,YAAY,SAAS,KAAK,GAAG,WAAW,KAAK,EAAE;QAC/D,IAAI,WAAW,CAAA,GAAA,4CAAY,EAAE,YAAY;QACzC,IAAI,YAAkC;QACtC,KAAK,IAAI,SAAS,SAChB,IAAI,MAAM,IAAI,KAAK,QACjB,YAAY;QAIhB,IAAI,WACF,OAAO;YACL,MAAM;YACN,KAAK,UAAU,GAAG;YAClB,cAAc;QAChB;IAEJ;IAEA,OAAO;AACT","sources":["packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts"],"sourcesContent":["import {Collection, DropTarget, Key, KeyboardDelegate, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\n\nexport function navigate(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n direction: 'left' | 'right' | 'up' | 'down',\n rtl = false,\n wrap = false\n): DropTarget | null {\n switch (direction) {\n case 'left':\n return rtl \n ? nextDropTarget(keyboardDelegate, collection, target, wrap, 'left')\n : previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');\n case 'right':\n return rtl \n ? previousDropTarget(keyboardDelegate, collection, target, wrap, 'right')\n : nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');\n case 'up':\n return previousDropTarget(keyboardDelegate, collection, target, wrap);\n case 'down':\n return nextDropTarget(keyboardDelegate, collection, target, wrap);\n }\n}\n\nfunction nextDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n if (!target) {\n return {\n type: 'root'\n };\n }\n\n if (target.type === 'root') {\n let nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n if (nextKey != null) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let nextKey: Key | null | undefined = null;\n if (horizontal) {\n nextKey = horizontal === 'right' ? keyboardDelegate.getKeyRightOf?.(target.key) : keyboardDelegate.getKeyLeftOf?.(target.key);\n } else {\n nextKey = keyboardDelegate.getKeyBelow?.(target.key);\n }\n let nextCollectionKey = collection.getKeyAfter(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (nextKey != null && nextKey !== nextCollectionKey) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: target.dropPosition\n };\n }\n \n switch (target.dropPosition) {\n case 'before': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n case 'on': {\n // If there are nested items, traverse to them prior to the \"after\" position of this target.\n // If the next key is on the same level, then its \"before\" position is equivalent to this item's \"after\" position.\n let targetNode = collection.getItem(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level >= targetNode.level) {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'after'\n };\n }\n case 'after': {\n // If this is the last sibling in a level, traverse to the parent.\n let targetNode = collection.getItem(target.key);\n let nextItemInSameLevel = targetNode?.nextKey != null ? collection.getItem(targetNode.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n \n if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {\n // If the parent item has an item after it, use the \"before\" position.\n let parentNode = collection.getItem(targetNode.parentKey);\n const nextNode = parentNode?.nextKey != null ? collection.getItem(parentNode.nextKey) : null;\n if (nextNode?.type === 'item') {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n if (parentNode?.type === 'item') {\n return {\n type: 'item',\n key: parentNode.key,\n dropPosition: 'after'\n };\n }\n }\n\n if (nextItemInSameLevel) {\n return {\n type: 'item',\n key: nextItemInSameLevel.key,\n dropPosition: 'on'\n };\n }\n }\n }\n }\n\n if (wrap) {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction previousDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n // Start after the last root-level item.\n if (!target || (wrap && target.type === 'root')) {\n // Keyboard delegate gets the deepest item but we want the shallowest.\n let prevKey: Key | null = null;\n let lastKey = keyboardDelegate.getLastKey?.();\n while (lastKey != null) {\n let node = collection.getItem(lastKey);\n if (node?.type !== 'item') {\n break;\n }\n prevKey = lastKey;\n lastKey = node?.parentKey;\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'after'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let prevKey: Key | null | undefined = null;\n if (horizontal) {\n prevKey = horizontal === 'left' ? keyboardDelegate.getKeyLeftOf?.(target.key) : keyboardDelegate.getKeyRightOf?.(target.key);\n } else {\n prevKey = keyboardDelegate.getKeyAbove?.(target.key);\n }\n let prevCollectionKey = collection.getKeyBefore(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (prevKey != null && prevKey !== prevCollectionKey) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: target.dropPosition\n };\n }\n\n switch (target.dropPosition) {\n case 'before': {\n // Move after the last child of the previous item.\n let targetNode = collection.getItem(target.key);\n if (targetNode && targetNode.prevKey != null) {\n let lastChild = getLastChild(collection, targetNode.prevKey);\n if (lastChild) {\n return lastChild;\n }\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'on'\n };\n }\n\n return {\n type: 'root'\n };\n }\n case 'on': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'before'\n };\n }\n case 'after': {\n // Move after the last child of this item.\n let lastChild = getLastChild(collection, target.key);\n if (lastChild) {\n return lastChild;\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n }\n }\n\n if (target.type !== 'root') {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction getLastChild(collection: Collection<Node<unknown>>, key: Key): DropTarget | null {\n // getChildNodes still returns child tree items even when the item is collapsed.\n // Checking if the next item has a greater level is a silly way to determine if the item is expanded.\n let targetNode = collection.getItem(key);\n let nextKey = collection.getKeyAfter(key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level > targetNode.level) {\n let children = getChildNodes(targetNode, collection);\n let lastChild: Node<unknown> | null = null;\n for (let child of children) {\n if (child.type === 'item') {\n lastChild = child;\n }\n }\n\n if (lastChild) {\n return {\n type: 'item',\n key: lastChild.key,\n dropPosition: 'after'\n };\n }\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"DropTargetKeyboardNavigation.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAGO,SAAS,0CACd,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,SAA2C,EAC3C,MAAM,KAAK,EACX,OAAO,KAAK;IAEZ,OAAQ;QACN,KAAK;YACH,OAAO,MACH,qCAAe,kBAAkB,YAAY,QAAQ,MAAM,UAC3D,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM;QACrE,KAAK;YACH,OAAO,MACH,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM,WAC/D,qCAAe,kBAAkB,YAAY,QAAQ,MAAM;QACjE,KAAK;YACH,OAAO,yCAAmB,kBAAkB,YAAY,QAAQ;QAClE,KAAK;YACH,OAAO,qCAAe,kBAAkB,YAAY,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ACA,OAAO;AACT","sources":["packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts"],"sourcesContent":["import {Collection, DropTarget, Key, KeyboardDelegate, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\n\nexport function navigate(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n direction: 'left' | 'right' | 'up' | 'down',\n rtl = false,\n wrap = false\n): DropTarget | null {\n switch (direction) {\n case 'left':\n return rtl \n ? nextDropTarget(keyboardDelegate, collection, target, wrap, 'left')\n : previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');\n case 'right':\n return rtl \n ? previousDropTarget(keyboardDelegate, collection, target, wrap, 'right')\n : nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');\n case 'up':\n return previousDropTarget(keyboardDelegate, collection, target, wrap);\n case 'down':\n return nextDropTarget(keyboardDelegate, collection, target, wrap);\n }\n}\n\nfunction nextDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n if (!target) {\n return {\n type: 'root'\n };\n }\n\n if (target.type === 'root') {\n let nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n if (nextKey != null) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let nextKey: Key | null | undefined = null;\n if (horizontal) {\n nextKey = horizontal === 'right' ? keyboardDelegate.getKeyRightOf?.(target.key) : keyboardDelegate.getKeyLeftOf?.(target.key);\n } else {\n nextKey = keyboardDelegate.getKeyBelow?.(target.key);\n }\n let nextCollectionKey = getNextItem(collection, target.key, key => collection.getKeyAfter(key));\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (nextKey != null && nextKey !== nextCollectionKey) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: target.dropPosition\n };\n }\n \n switch (target.dropPosition) {\n case 'before': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n case 'on': {\n // If there are nested items, traverse to them prior to the \"after\" position of this target.\n // If the next key is on the same level, then its \"before\" position is equivalent to this item's \"after\" position.\n let targetNode = collection.getItem(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level >= targetNode.level) {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'after'\n };\n }\n case 'after': {\n // If this is the last sibling in a level, traverse to the parent.\n let targetNode = collection.getItem(target.key);\n let nextItemInSameLevel = targetNode?.nextKey != null ? collection.getItem(targetNode.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n \n if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {\n // If the parent item has an item after it, use the \"before\" position.\n let parentNode = collection.getItem(targetNode.parentKey);\n const nextNode = parentNode?.nextKey != null ? collection.getItem(parentNode.nextKey) : null;\n if (nextNode?.type === 'item') {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n if (parentNode?.type === 'item') {\n return {\n type: 'item',\n key: parentNode.key,\n dropPosition: 'after'\n };\n }\n }\n\n if (nextItemInSameLevel) {\n return {\n type: 'item',\n key: nextItemInSameLevel.key,\n dropPosition: 'on'\n };\n }\n }\n }\n }\n\n if (wrap) {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction previousDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n // Start after the last root-level item.\n if (!target || (wrap && target.type === 'root')) {\n // Keyboard delegate gets the deepest item but we want the shallowest.\n let prevKey: Key | null = null;\n let lastKey = keyboardDelegate.getLastKey?.();\n while (lastKey != null) {\n let node = collection.getItem(lastKey);\n if (node?.type !== 'item') {\n break;\n }\n prevKey = lastKey;\n lastKey = node?.parentKey;\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'after'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let prevKey: Key | null | undefined = null;\n if (horizontal) {\n prevKey = horizontal === 'left' ? keyboardDelegate.getKeyLeftOf?.(target.key) : keyboardDelegate.getKeyRightOf?.(target.key);\n } else {\n prevKey = keyboardDelegate.getKeyAbove?.(target.key);\n }\n let prevCollectionKey = getNextItem(collection, target.key, key => collection.getKeyBefore(key));\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (prevKey != null && prevKey !== prevCollectionKey) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: target.dropPosition\n };\n }\n\n switch (target.dropPosition) {\n case 'before': {\n // Move after the last child of the previous item.\n let targetNode = collection.getItem(target.key);\n if (targetNode && targetNode.prevKey != null) {\n let lastChild = getLastChild(collection, targetNode.prevKey);\n if (lastChild) {\n return lastChild;\n }\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'on'\n };\n }\n\n return {\n type: 'root'\n };\n }\n case 'on': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'before'\n };\n }\n case 'after': {\n // Move after the last child of this item.\n let lastChild = getLastChild(collection, target.key);\n if (lastChild) {\n return lastChild;\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n }\n }\n\n if (target.type !== 'root') {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction getLastChild(collection: Collection<Node<unknown>>, key: Key): DropTarget | null {\n // getChildNodes still returns child tree items even when the item is collapsed.\n // Checking if the next item has a greater level is a silly way to determine if the item is expanded.\n let targetNode = collection.getItem(key);\n let nextKey = getNextItem(collection, key, key => collection.getKeyAfter(key));\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level > targetNode.level) {\n let children = getChildNodes(targetNode, collection);\n let lastChild: Node<unknown> | null = null;\n for (let child of children) {\n if (child.type === 'item') {\n lastChild = child;\n }\n }\n\n if (lastChild) {\n return {\n type: 'item',\n key: lastChild.key,\n dropPosition: 'after'\n };\n }\n }\n\n return null;\n}\n\n// Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).\nfunction getNextItem(collection: Collection<Node<unknown>>, key: Key, getNextKey: (key: Key) => Key | null): Key | null {\n let nextCollectionKey = getNextKey(key);\n let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;\n while (nextCollectionNode && nextCollectionNode.type !== 'item') {\n nextCollectionKey = getNextKey(nextCollectionNode.key);\n nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;\n }\n return nextCollectionKey;\n}\n"],"names":[],"version":3,"file":"DropTargetKeyboardNavigation.main.js.map"}
@@ -33,7 +33,7 @@ function $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, targ
33
33
  let nextKey = null;
34
34
  if (horizontal) nextKey = horizontal === 'right' ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
35
35
  else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
36
- let nextCollectionKey = collection.getKeyAfter(target.key);
36
+ let nextCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key)=>collection.getKeyAfter(key));
37
37
  // If the keyboard delegate did not move to the next key in the collection,
38
38
  // jump to that key with the same drop position. Otherwise, try the other
39
39
  // drop positions on the current key first.
@@ -125,7 +125,7 @@ function $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection,
125
125
  let prevKey = null;
126
126
  if (horizontal) prevKey = horizontal === 'left' ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
127
127
  else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
128
- let prevCollectionKey = collection.getKeyBefore(target.key);
128
+ let prevCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key)=>collection.getKeyBefore(key));
129
129
  // If the keyboard delegate did not move to the next key in the collection,
130
130
  // jump to that key with the same drop position. Otherwise, try the other
131
131
  // drop positions on the current key first.
@@ -180,7 +180,7 @@ function $e154566cef11553b$var$getLastChild(collection, key) {
180
180
  // getChildNodes still returns child tree items even when the item is collapsed.
181
181
  // Checking if the next item has a greater level is a silly way to determine if the item is expanded.
182
182
  let targetNode = collection.getItem(key);
183
- let nextKey = collection.getKeyAfter(key);
183
+ let nextKey = $e154566cef11553b$var$getNextItem(collection, key, (key)=>collection.getKeyAfter(key));
184
184
  let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
185
185
  if (targetNode && nextNode && nextNode.level > targetNode.level) {
186
186
  let children = (0, $9nGAq$getChildNodes)(targetNode, collection);
@@ -194,6 +194,16 @@ function $e154566cef11553b$var$getLastChild(collection, key) {
194
194
  }
195
195
  return null;
196
196
  }
197
+ // Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).
198
+ function $e154566cef11553b$var$getNextItem(collection, key, getNextKey) {
199
+ let nextCollectionKey = getNextKey(key);
200
+ let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
201
+ while(nextCollectionNode && nextCollectionNode.type !== 'item'){
202
+ nextCollectionKey = getNextKey(nextCollectionNode.key);
203
+ nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
204
+ }
205
+ return nextCollectionKey;
206
+ }
197
207
 
198
208
 
199
209
  export {$e154566cef11553b$export$ff7962acd6052c28 as navigate};
@@ -33,7 +33,7 @@ function $e154566cef11553b$var$nextDropTarget(keyboardDelegate, collection, targ
33
33
  let nextKey = null;
34
34
  if (horizontal) nextKey = horizontal === 'right' ? (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key);
35
35
  else nextKey = (_keyboardDelegate_getKeyBelow = keyboardDelegate.getKeyBelow) === null || _keyboardDelegate_getKeyBelow === void 0 ? void 0 : _keyboardDelegate_getKeyBelow.call(keyboardDelegate, target.key);
36
- let nextCollectionKey = collection.getKeyAfter(target.key);
36
+ let nextCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key)=>collection.getKeyAfter(key));
37
37
  // If the keyboard delegate did not move to the next key in the collection,
38
38
  // jump to that key with the same drop position. Otherwise, try the other
39
39
  // drop positions on the current key first.
@@ -125,7 +125,7 @@ function $e154566cef11553b$var$previousDropTarget(keyboardDelegate, collection,
125
125
  let prevKey = null;
126
126
  if (horizontal) prevKey = horizontal === 'left' ? (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, target.key) : (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, target.key);
127
127
  else prevKey = (_keyboardDelegate_getKeyAbove = keyboardDelegate.getKeyAbove) === null || _keyboardDelegate_getKeyAbove === void 0 ? void 0 : _keyboardDelegate_getKeyAbove.call(keyboardDelegate, target.key);
128
- let prevCollectionKey = collection.getKeyBefore(target.key);
128
+ let prevCollectionKey = $e154566cef11553b$var$getNextItem(collection, target.key, (key)=>collection.getKeyBefore(key));
129
129
  // If the keyboard delegate did not move to the next key in the collection,
130
130
  // jump to that key with the same drop position. Otherwise, try the other
131
131
  // drop positions on the current key first.
@@ -180,7 +180,7 @@ function $e154566cef11553b$var$getLastChild(collection, key) {
180
180
  // getChildNodes still returns child tree items even when the item is collapsed.
181
181
  // Checking if the next item has a greater level is a silly way to determine if the item is expanded.
182
182
  let targetNode = collection.getItem(key);
183
- let nextKey = collection.getKeyAfter(key);
183
+ let nextKey = $e154566cef11553b$var$getNextItem(collection, key, (key)=>collection.getKeyAfter(key));
184
184
  let nextNode = nextKey != null ? collection.getItem(nextKey) : null;
185
185
  if (targetNode && nextNode && nextNode.level > targetNode.level) {
186
186
  let children = (0, $9nGAq$getChildNodes)(targetNode, collection);
@@ -194,6 +194,16 @@ function $e154566cef11553b$var$getLastChild(collection, key) {
194
194
  }
195
195
  return null;
196
196
  }
197
+ // Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).
198
+ function $e154566cef11553b$var$getNextItem(collection, key, getNextKey) {
199
+ let nextCollectionKey = getNextKey(key);
200
+ let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
201
+ while(nextCollectionNode && nextCollectionNode.type !== 'item'){
202
+ nextCollectionKey = getNextKey(nextCollectionNode.key);
203
+ nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;
204
+ }
205
+ return nextCollectionKey;
206
+ }
197
207
 
198
208
 
199
209
  export {$e154566cef11553b$export$ff7962acd6052c28 as navigate};
@@ -1 +1 @@
1
- {"mappings":";;;AAGO,SAAS,0CACd,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,SAA2C,EAC3C,MAAM,KAAK,EACX,OAAO,KAAK;IAEZ,OAAQ;QACN,KAAK;YACH,OAAO,MACH,qCAAe,kBAAkB,YAAY,QAAQ,MAAM,UAC3D,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM;QACrE,KAAK;YACH,OAAO,MACH,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM,WAC/D,qCAAe,kBAAkB,YAAY,QAAQ,MAAM;QACjE,KAAK;YACH,OAAO,yCAAmB,kBAAkB,YAAY,QAAQ;QAClE,KAAK;YACH,OAAO,qCAAe,kBAAkB,YAAY,QAAQ;IAChE;AACF;AAEA,SAAS,qCACP,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,OAAO,KAAK,EACZ,aAAsC,IAAI;IAE1C,IAAI,CAAC,QACH,OAAO;QACL,MAAM;IACR;IAGF,IAAI,OAAO,IAAI,KAAK,QAAQ;YACZ;YAAA;QAAd,IAAI,UAAU,CAAA,kCAAA,gCAAA,iBAAiB,WAAW,cAA5B,oDAAA,mCAAA,+BAAA,4CAAA,iCAAoC;QAClD,IAAI,WAAW,MACb,OAAO;YACL,MAAM;YACN,KAAK;YACL,cAAc;QAChB;QAGF,OAAO;IACT;IAEA,IAAI,OAAO,IAAI,KAAK,QAAQ;YAGW,iCAA+C,gCAExE;QAJZ,IAAI,UAAkC;QACtC,IAAI,YACF,UAAU,eAAe,WAAU,kCAAA,iBAAiB,aAAa,cAA9B,sDAAA,qCAA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/D,IAAI,cAAc,YAAY,SAAS,KAAK,GAAG,WAAW,KAAK,EAAE;QAC/D,IAAI,WAAW,CAAA,GAAA,oBAAY,EAAE,YAAY;QACzC,IAAI,YAAkC;QACtC,KAAK,IAAI,SAAS,SAChB,IAAI,MAAM,IAAI,KAAK,QACjB,YAAY;QAIhB,IAAI,WACF,OAAO;YACL,MAAM;YACN,KAAK,UAAU,GAAG;YAClB,cAAc;QAChB;IAEJ;IAEA,OAAO;AACT","sources":["packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts"],"sourcesContent":["import {Collection, DropTarget, Key, KeyboardDelegate, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\n\nexport function navigate(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n direction: 'left' | 'right' | 'up' | 'down',\n rtl = false,\n wrap = false\n): DropTarget | null {\n switch (direction) {\n case 'left':\n return rtl \n ? nextDropTarget(keyboardDelegate, collection, target, wrap, 'left')\n : previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');\n case 'right':\n return rtl \n ? previousDropTarget(keyboardDelegate, collection, target, wrap, 'right')\n : nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');\n case 'up':\n return previousDropTarget(keyboardDelegate, collection, target, wrap);\n case 'down':\n return nextDropTarget(keyboardDelegate, collection, target, wrap);\n }\n}\n\nfunction nextDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n if (!target) {\n return {\n type: 'root'\n };\n }\n\n if (target.type === 'root') {\n let nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n if (nextKey != null) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let nextKey: Key | null | undefined = null;\n if (horizontal) {\n nextKey = horizontal === 'right' ? keyboardDelegate.getKeyRightOf?.(target.key) : keyboardDelegate.getKeyLeftOf?.(target.key);\n } else {\n nextKey = keyboardDelegate.getKeyBelow?.(target.key);\n }\n let nextCollectionKey = collection.getKeyAfter(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (nextKey != null && nextKey !== nextCollectionKey) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: target.dropPosition\n };\n }\n \n switch (target.dropPosition) {\n case 'before': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n case 'on': {\n // If there are nested items, traverse to them prior to the \"after\" position of this target.\n // If the next key is on the same level, then its \"before\" position is equivalent to this item's \"after\" position.\n let targetNode = collection.getItem(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level >= targetNode.level) {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'after'\n };\n }\n case 'after': {\n // If this is the last sibling in a level, traverse to the parent.\n let targetNode = collection.getItem(target.key);\n let nextItemInSameLevel = targetNode?.nextKey != null ? collection.getItem(targetNode.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n \n if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {\n // If the parent item has an item after it, use the \"before\" position.\n let parentNode = collection.getItem(targetNode.parentKey);\n const nextNode = parentNode?.nextKey != null ? collection.getItem(parentNode.nextKey) : null;\n if (nextNode?.type === 'item') {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n if (parentNode?.type === 'item') {\n return {\n type: 'item',\n key: parentNode.key,\n dropPosition: 'after'\n };\n }\n }\n\n if (nextItemInSameLevel) {\n return {\n type: 'item',\n key: nextItemInSameLevel.key,\n dropPosition: 'on'\n };\n }\n }\n }\n }\n\n if (wrap) {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction previousDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n // Start after the last root-level item.\n if (!target || (wrap && target.type === 'root')) {\n // Keyboard delegate gets the deepest item but we want the shallowest.\n let prevKey: Key | null = null;\n let lastKey = keyboardDelegate.getLastKey?.();\n while (lastKey != null) {\n let node = collection.getItem(lastKey);\n if (node?.type !== 'item') {\n break;\n }\n prevKey = lastKey;\n lastKey = node?.parentKey;\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'after'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let prevKey: Key | null | undefined = null;\n if (horizontal) {\n prevKey = horizontal === 'left' ? keyboardDelegate.getKeyLeftOf?.(target.key) : keyboardDelegate.getKeyRightOf?.(target.key);\n } else {\n prevKey = keyboardDelegate.getKeyAbove?.(target.key);\n }\n let prevCollectionKey = collection.getKeyBefore(target.key);\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (prevKey != null && prevKey !== prevCollectionKey) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: target.dropPosition\n };\n }\n\n switch (target.dropPosition) {\n case 'before': {\n // Move after the last child of the previous item.\n let targetNode = collection.getItem(target.key);\n if (targetNode && targetNode.prevKey != null) {\n let lastChild = getLastChild(collection, targetNode.prevKey);\n if (lastChild) {\n return lastChild;\n }\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'on'\n };\n }\n\n return {\n type: 'root'\n };\n }\n case 'on': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'before'\n };\n }\n case 'after': {\n // Move after the last child of this item.\n let lastChild = getLastChild(collection, target.key);\n if (lastChild) {\n return lastChild;\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n }\n }\n\n if (target.type !== 'root') {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction getLastChild(collection: Collection<Node<unknown>>, key: Key): DropTarget | null {\n // getChildNodes still returns child tree items even when the item is collapsed.\n // Checking if the next item has a greater level is a silly way to determine if the item is expanded.\n let targetNode = collection.getItem(key);\n let nextKey = collection.getKeyAfter(key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level > targetNode.level) {\n let children = getChildNodes(targetNode, collection);\n let lastChild: Node<unknown> | null = null;\n for (let child of children) {\n if (child.type === 'item') {\n lastChild = child;\n }\n }\n\n if (lastChild) {\n return {\n type: 'item',\n key: lastChild.key,\n dropPosition: 'after'\n };\n }\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"DropTargetKeyboardNavigation.module.js.map"}
1
+ {"mappings":";;;AAGO,SAAS,0CACd,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,SAA2C,EAC3C,MAAM,KAAK,EACX,OAAO,KAAK;IAEZ,OAAQ;QACN,KAAK;YACH,OAAO,MACH,qCAAe,kBAAkB,YAAY,QAAQ,MAAM,UAC3D,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM;QACrE,KAAK;YACH,OAAO,MACH,yCAAmB,kBAAkB,YAAY,QAAQ,MAAM,WAC/D,qCAAe,kBAAkB,YAAY,QAAQ,MAAM;QACjE,KAAK;YACH,OAAO,yCAAmB,kBAAkB,YAAY,QAAQ;QAClE,KAAK;YACH,OAAO,qCAAe,kBAAkB,YAAY,QAAQ;IAChE;AACF;AAEA,SAAS,qCACP,gBAAkC,EAClC,UAAqC,EACrC,MAAqC,EACrC,OAAO,KAAK,EACZ,aAAsC,IAAI;IAE1C,IAAI,CAAC,QACH,OAAO;QACL,MAAM;IACR;IAGF,IAAI,OAAO,IAAI,KAAK,QAAQ;YACZ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,mCAAa,YAAY,OAAO,GAAG;oBACnD,IAAI,WACF,OAAO;oBAGT,OAAO;wBACL,MAAM;wBACN,KAAK,OAAO,GAAG;wBACf,cAAc;oBAChB;gBACF;QACF;IACF;IAEA,IAAI,OAAO,IAAI,KAAK,QAClB,OAAO;QACL,MAAM;IACR;IAGF,OAAO;AACT;AAEA,SAAS,mCAAa,UAAqC,EAAE,GAAQ;IACnE,gFAAgF;IAChF,qGAAqG;IACrG,IAAI,aAAa,WAAW,OAAO,CAAC;IACpC,IAAI,UAAU,kCAAY,YAAY,KAAK,CAAA,MAAO,WAAW,WAAW,CAAC;IACzE,IAAI,WAAW,WAAW,OAAO,WAAW,OAAO,CAAC,WAAW;IAC/D,IAAI,cAAc,YAAY,SAAS,KAAK,GAAG,WAAW,KAAK,EAAE;QAC/D,IAAI,WAAW,CAAA,GAAA,oBAAY,EAAE,YAAY;QACzC,IAAI,YAAkC;QACtC,KAAK,IAAI,SAAS,SAChB,IAAI,MAAM,IAAI,KAAK,QACjB,YAAY;QAIhB,IAAI,WACF,OAAO;YACL,MAAM;YACN,KAAK,UAAU,GAAG;YAClB,cAAc;QAChB;IAEJ;IAEA,OAAO;AACT;AAEA,qGAAqG;AACrG,SAAS,kCAAY,UAAqC,EAAE,GAAQ,EAAE,UAAoC;IACxG,IAAI,oBAAoB,WAAW;IACnC,IAAI,qBAAqB,qBAAqB,OAAO,WAAW,OAAO,CAAC,qBAAqB;IAC7F,MAAO,sBAAsB,mBAAmB,IAAI,KAAK,OAAQ;QAC/D,oBAAoB,WAAW,mBAAmB,GAAG;QACrD,qBAAqB,qBAAqB,OAAO,WAAW,OAAO,CAAC,qBAAqB;IAC3F;IACA,OAAO;AACT","sources":["packages/@react-aria/dnd/src/DropTargetKeyboardNavigation.ts"],"sourcesContent":["import {Collection, DropTarget, Key, KeyboardDelegate, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\n\nexport function navigate(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n direction: 'left' | 'right' | 'up' | 'down',\n rtl = false,\n wrap = false\n): DropTarget | null {\n switch (direction) {\n case 'left':\n return rtl \n ? nextDropTarget(keyboardDelegate, collection, target, wrap, 'left')\n : previousDropTarget(keyboardDelegate, collection, target, wrap, 'left');\n case 'right':\n return rtl \n ? previousDropTarget(keyboardDelegate, collection, target, wrap, 'right')\n : nextDropTarget(keyboardDelegate, collection, target, wrap, 'right');\n case 'up':\n return previousDropTarget(keyboardDelegate, collection, target, wrap);\n case 'down':\n return nextDropTarget(keyboardDelegate, collection, target, wrap);\n }\n}\n\nfunction nextDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n if (!target) {\n return {\n type: 'root'\n };\n }\n\n if (target.type === 'root') {\n let nextKey = keyboardDelegate.getFirstKey?.() ?? null;\n if (nextKey != null) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: 'before'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let nextKey: Key | null | undefined = null;\n if (horizontal) {\n nextKey = horizontal === 'right' ? keyboardDelegate.getKeyRightOf?.(target.key) : keyboardDelegate.getKeyLeftOf?.(target.key);\n } else {\n nextKey = keyboardDelegate.getKeyBelow?.(target.key);\n }\n let nextCollectionKey = getNextItem(collection, target.key, key => collection.getKeyAfter(key));\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (nextKey != null && nextKey !== nextCollectionKey) {\n return {\n type: 'item',\n key: nextKey,\n dropPosition: target.dropPosition\n };\n }\n \n switch (target.dropPosition) {\n case 'before': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n case 'on': {\n // If there are nested items, traverse to them prior to the \"after\" position of this target.\n // If the next key is on the same level, then its \"before\" position is equivalent to this item's \"after\" position.\n let targetNode = collection.getItem(target.key);\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level >= targetNode.level) {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'after'\n };\n }\n case 'after': {\n // If this is the last sibling in a level, traverse to the parent.\n let targetNode = collection.getItem(target.key);\n let nextItemInSameLevel = targetNode?.nextKey != null ? collection.getItem(targetNode.nextKey) : null;\n while (nextItemInSameLevel != null && nextItemInSameLevel.type !== 'item') {\n nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;\n }\n \n if (targetNode && nextItemInSameLevel == null && targetNode.parentKey != null) {\n // If the parent item has an item after it, use the \"before\" position.\n let parentNode = collection.getItem(targetNode.parentKey);\n const nextNode = parentNode?.nextKey != null ? collection.getItem(parentNode.nextKey) : null;\n if (nextNode?.type === 'item') {\n return {\n type: 'item',\n key: nextNode.key,\n dropPosition: 'before'\n };\n }\n\n if (parentNode?.type === 'item') {\n return {\n type: 'item',\n key: parentNode.key,\n dropPosition: 'after'\n };\n }\n }\n\n if (nextItemInSameLevel) {\n return {\n type: 'item',\n key: nextItemInSameLevel.key,\n dropPosition: 'on'\n };\n }\n }\n }\n }\n\n if (wrap) {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction previousDropTarget(\n keyboardDelegate: KeyboardDelegate,\n collection: Collection<Node<unknown>>,\n target: DropTarget | null | undefined,\n wrap = false,\n horizontal: 'left' | 'right' | null = null\n): DropTarget | null {\n // Start after the last root-level item.\n if (!target || (wrap && target.type === 'root')) {\n // Keyboard delegate gets the deepest item but we want the shallowest.\n let prevKey: Key | null = null;\n let lastKey = keyboardDelegate.getLastKey?.();\n while (lastKey != null) {\n let node = collection.getItem(lastKey);\n if (node?.type !== 'item') {\n break;\n }\n prevKey = lastKey;\n lastKey = node?.parentKey;\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'after'\n };\n }\n\n return null;\n }\n\n if (target.type === 'item') {\n let prevKey: Key | null | undefined = null;\n if (horizontal) {\n prevKey = horizontal === 'left' ? keyboardDelegate.getKeyLeftOf?.(target.key) : keyboardDelegate.getKeyRightOf?.(target.key);\n } else {\n prevKey = keyboardDelegate.getKeyAbove?.(target.key);\n }\n let prevCollectionKey = getNextItem(collection, target.key, key => collection.getKeyBefore(key));\n\n // If the keyboard delegate did not move to the next key in the collection,\n // jump to that key with the same drop position. Otherwise, try the other\n // drop positions on the current key first.\n if (prevKey != null && prevKey !== prevCollectionKey) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: target.dropPosition\n };\n }\n\n switch (target.dropPosition) {\n case 'before': {\n // Move after the last child of the previous item.\n let targetNode = collection.getItem(target.key);\n if (targetNode && targetNode.prevKey != null) {\n let lastChild = getLastChild(collection, targetNode.prevKey);\n if (lastChild) {\n return lastChild;\n }\n }\n\n if (prevKey != null) {\n return {\n type: 'item',\n key: prevKey,\n dropPosition: 'on'\n };\n }\n\n return {\n type: 'root'\n };\n }\n case 'on': {\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'before'\n };\n }\n case 'after': {\n // Move after the last child of this item.\n let lastChild = getLastChild(collection, target.key);\n if (lastChild) {\n return lastChild;\n }\n\n return {\n type: 'item',\n key: target.key,\n dropPosition: 'on'\n };\n }\n }\n }\n\n if (target.type !== 'root') {\n return {\n type: 'root'\n };\n }\n\n return null;\n}\n\nfunction getLastChild(collection: Collection<Node<unknown>>, key: Key): DropTarget | null {\n // getChildNodes still returns child tree items even when the item is collapsed.\n // Checking if the next item has a greater level is a silly way to determine if the item is expanded.\n let targetNode = collection.getItem(key);\n let nextKey = getNextItem(collection, key, key => collection.getKeyAfter(key));\n let nextNode = nextKey != null ? collection.getItem(nextKey) : null;\n if (targetNode && nextNode && nextNode.level > targetNode.level) {\n let children = getChildNodes(targetNode, collection);\n let lastChild: Node<unknown> | null = null;\n for (let child of children) {\n if (child.type === 'item') {\n lastChild = child;\n }\n }\n\n if (lastChild) {\n return {\n type: 'item',\n key: lastChild.key,\n dropPosition: 'after'\n };\n }\n }\n\n return null;\n}\n\n// Find the next or previous item in a collection, skipping over other types of nodes (e.g. content).\nfunction getNextItem(collection: Collection<Node<unknown>>, key: Key, getNextKey: (key: Key) => Key | null): Key | null {\n let nextCollectionKey = getNextKey(key);\n let nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;\n while (nextCollectionNode && nextCollectionNode.type !== 'item') {\n nextCollectionKey = getNextKey(nextCollectionNode.key);\n nextCollectionNode = nextCollectionKey != null ? collection.getItem(nextCollectionKey) : null;\n }\n return nextCollectionKey;\n}\n"],"names":[],"version":3,"file":"DropTargetKeyboardNavigation.module.js.map"}
@@ -73,7 +73,7 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
73
73
  // If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.
74
74
  if (modalityOnPointerDown.current === 'virtual') {
75
75
  e.preventDefault();
76
- startDragging(e.target);
76
+ startDragging((0, $3w36N$reactariautils.getEventTarget)(e));
77
77
  modalityOnPointerDown.current = null;
78
78
  return;
79
79
  }
@@ -140,7 +140,7 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
140
140
  state.y = e.clientY;
141
141
  // Wait a frame before we set dragging to true so that the browser has time to
142
142
  // render the preview image before we update the element that has been dragged.
143
- let target = e.target;
143
+ let target = (0, $3w36N$reactariautils.getEventTarget)(e);
144
144
  requestAnimationFrame(()=>{
145
145
  setDragging(target);
146
146
  });
@@ -259,16 +259,16 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
259
259
  }
260
260
  },
261
261
  onKeyDownCapture (e) {
262
- if (e.target === e.currentTarget && e.key === 'Enter') {
262
+ if ((0, $3w36N$reactariautils.getEventTarget)(e) === e.currentTarget && e.key === 'Enter') {
263
263
  e.preventDefault();
264
264
  e.stopPropagation();
265
265
  }
266
266
  },
267
267
  onKeyUpCapture (e) {
268
- if (e.target === e.currentTarget && e.key === 'Enter') {
268
+ if ((0, $3w36N$reactariautils.getEventTarget)(e) === e.currentTarget && e.key === 'Enter') {
269
269
  e.preventDefault();
270
270
  e.stopPropagation();
271
- startDragging(e.target);
271
+ startDragging((0, $3w36N$reactariautils.getEventTarget)(e));
272
272
  }
273
273
  },
274
274
  onClick (e) {
@@ -276,7 +276,7 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
276
276
  if ((0, $3w36N$reactariautils.isVirtualClick)(e.nativeEvent) || modalityOnPointerDown.current === 'virtual') {
277
277
  e.preventDefault();
278
278
  e.stopPropagation();
279
- startDragging(e.target);
279
+ startDragging((0, $3w36N$reactariautils.getEventTarget)(e));
280
280
  }
281
281
  }
282
282
  };