github-actions
released this
20 Apr 02:23
·
292 commits
to master
since this release
Major Changes
-
a9d92cf
#174 Thanks @clauderic! - Distributed assets now only target modern browsers. Browserlist config:defaults last 2 version not IE 11 not dead
If you need to support older browsers, include the appropriate polyfills in your project's build process.
-
b406cb9
#187 Thanks @clauderic! - Introduced theuseDndMonitor
hook. TheuseDndMonitor
hook can be used within components wrapped in aDndContext
provider to monitor the different drag and drop events that happen for thatDndContext
.Example usage:
import {DndContext, useDndMonitor} from '@dnd-kit/core'; function App() { return ( <DndContext> <Component /> </DndContext> ); } function Component() { useDndMonitor({ onDragStart(event) {}, onDragMove(event) {}, onDragOver(event) {}, onDragEnd(event) {}, onDragCancel(event) {}, }); }
Minor Changes
-
b7355d1
#207 Thanks @clauderic! - Thedata
argument foruseDraggable
anduseDroppable
is now exposed in event handlers and on theactive
andover
objects.Example usage:
import {DndContext, useDraggable, useDroppable} from '@dnd-kit/core'; function Draggable() { const {attributes, listeners, setNodeRef, transform} = useDraggable({ id: 'draggable', data: { type: 'type1', }, }); /* ... */ } function Droppable() { const {setNodeRef} = useDroppable({ id: 'droppable', data: { accepts: ['type1', 'type2'], }, }); /* ... */ } function App() { return ( <DndContext onDragEnd={({active, over}) => { if (over?.data.current.accepts.includes(active.data.current.type)) { // do stuff } }} /> ); }
Patch Changes
- Updated dependencies [
a9d92cf
,b406cb9
]:- @dnd-kit/[email protected]
- @dnd-kit/[email protected]