react-spectrum
cb54cf48 - Update simplified DnD handler api and memoize useDnDHooks (#3533)

Commit
3 years ago
Update simplified DnD handler api and memoize useDnDHooks (#3533) * updating dnd util handler api isInternalDrop -> isInternal. Use target provided to onDrop for the util handlers * adding utility function for checking if it is a internal drop operation * memoize everything in useDnDHooks * remove extra itemProcessor * return isInternal=false if drop cancelled and fix .click detection for Android slight optimization in DragManager by removing extraneous setDropCollectionRef in favor of drag end handling isInternal logic instead. Also fix detection of Android virtual clicks, element clicked via click() will have pointerType="" and detail=0 so we can rely on the previous detail=0 logic for that case instead * making directory drag type a Symbol directory may be a type that is common among user data so it may accidentally conflict with our special directory keyword in acceptedDragTypes. To resolve this we change it so acceptedDragTypes allows a Symbol equivalent that we defined for directory * auditing package.jsons for dnd stuff * replacing directorySymbol with DIRECTORY_DRAG_TYPE also expand acceptedDragTypes to accept any symbol in case we add more unique drag types in the future * adjusting dnd hook object creation * changing default for acceptedDragTypes back to all also skips calling the util handlers if filteredItems is empty * use getDropOperation to determine final drop operation if provided this allows the user to define what drop operations a droppable collection accepts, making it so copy or link can become the new default operation. * re-export DIRECTORY_DRAG_TYPE from react-spectrum/dnd * optimization to default useDrop filtering * moving list types into aria and spectrum packages this avoids the need for adding a dev dep of react-spectrum/dnd to the types packages * reexport grid list and spectrum list prop from react-types/list for backcompat. We define and export these props from aria/spectrum packages now, the react-types/list packages is no longer necessary since it is only used for one component * extra space removal Co-authored-by: Robert Snow <rsnow@adobe.com>
Author
Parents
Loading