@react-aria/dnd 3.6.2-nightly.4673 → 3.6.2-nightly.4681
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.
- package/dist/DragPreview.main.js.map +1 -1
- package/dist/DragPreview.module.js.map +1 -1
- package/dist/ListDropTargetDelegate.main.js +1 -1
- package/dist/ListDropTargetDelegate.main.js.map +1 -1
- package/dist/ListDropTargetDelegate.mjs +1 -1
- package/dist/ListDropTargetDelegate.module.js +1 -1
- package/dist/ListDropTargetDelegate.module.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/useAutoScroll.main.js.map +1 -1
- package/dist/useAutoScroll.module.js.map +1 -1
- package/dist/useDrag.main.js.map +1 -1
- package/dist/useDrag.module.js.map +1 -1
- package/dist/useDraggableCollection.main.js.map +1 -1
- package/dist/useDraggableCollection.module.js.map +1 -1
- package/dist/useDrop.main.js.map +1 -1
- package/dist/useDrop.module.js.map +1 -1
- package/dist/useDropIndicator.main.js.map +1 -1
- package/dist/useDropIndicator.module.js.map +1 -1
- package/dist/useDroppableCollection.main.js.map +1 -1
- package/dist/useDroppableCollection.module.js.map +1 -1
- package/dist/useDroppableItem.main.js.map +1 -1
- package/dist/useDroppableItem.module.js.map +1 -1
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.module.js.map +1 -1
- package/package.json +13 -13
- package/src/DragPreview.tsx +1 -1
- package/src/ListDropTargetDelegate.ts +5 -5
- package/src/useAutoScroll.ts +1 -1
- package/src/useDrag.ts +1 -1
- package/src/useDraggableCollection.ts +1 -1
- package/src/useDrop.ts +1 -1
- package/src/useDropIndicator.ts +1 -1
- package/src/useDroppableCollection.ts +1 -1
- package/src/useDroppableItem.ts +1 -1
- package/src/utils.ts +6 -6
package/src/useDroppableItem.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface DroppableItemResult {
|
|
|
32
32
|
/**
|
|
33
33
|
* Handles drop interactions for an item within a collection component.
|
|
34
34
|
*/
|
|
35
|
-
export function useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableItemResult {
|
|
35
|
+
export function useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>): DroppableItemResult {
|
|
36
36
|
let {dropProps} = useVirtualDrop();
|
|
37
37
|
let droppableCollectionRef = getDroppableCollectionRef(state);
|
|
38
38
|
useEffect(() => {
|
package/src/utils.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {RefObject} from 'react';
|
|
|
18
18
|
|
|
19
19
|
interface DroppableCollectionMap {
|
|
20
20
|
id: string,
|
|
21
|
-
ref: RefObject<HTMLElement>
|
|
21
|
+
ref: RefObject<HTMLElement | null>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();
|
|
@@ -332,16 +332,16 @@ export function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDr
|
|
|
332
332
|
// Global DnD collection state tracker.
|
|
333
333
|
export interface DnDState {
|
|
334
334
|
/** A ref for the of the drag items in the current drag session if any. */
|
|
335
|
-
draggingCollectionRef?: RefObject<HTMLElement>,
|
|
335
|
+
draggingCollectionRef?: RefObject<HTMLElement | null>,
|
|
336
336
|
/** The set of currently dragged keys. */
|
|
337
337
|
draggingKeys: Set<Key>,
|
|
338
338
|
/** A ref for the collection that is targeted for a drop operation, if any. */
|
|
339
|
-
dropCollectionRef?: RefObject<HTMLElement>
|
|
339
|
+
dropCollectionRef?: RefObject<HTMLElement | null>
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
export let globalDndState: DnDState = {draggingKeys: new Set()};
|
|
343
343
|
|
|
344
|
-
export function setDraggingCollectionRef(ref: RefObject<HTMLElement>) {
|
|
344
|
+
export function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>) {
|
|
345
345
|
globalDndState.draggingCollectionRef = ref;
|
|
346
346
|
}
|
|
347
347
|
|
|
@@ -349,7 +349,7 @@ export function setDraggingKeys(keys: Set<Key>) {
|
|
|
349
349
|
globalDndState.draggingKeys = keys;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
export function setDropCollectionRef(ref: RefObject<HTMLElement>) {
|
|
352
|
+
export function setDropCollectionRef(ref: RefObject<HTMLElement | null>) {
|
|
353
353
|
globalDndState.dropCollectionRef = ref;
|
|
354
354
|
}
|
|
355
355
|
|
|
@@ -363,7 +363,7 @@ export function setGlobalDnDState(state: DnDState) {
|
|
|
363
363
|
|
|
364
364
|
// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.
|
|
365
365
|
// Allows a droppable ref arg in case the global drop collection ref hasn't been set
|
|
366
|
-
export function isInternalDropOperation(ref?: RefObject<HTMLElement>) {
|
|
366
|
+
export function isInternalDropOperation(ref?: RefObject<HTMLElement | null>) {
|
|
367
367
|
let {draggingCollectionRef, dropCollectionRef} = globalDndState;
|
|
368
368
|
return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);
|
|
369
369
|
}
|