github clauderic/dnd-kit @dnd-kit/sortable@3.0.0

latest releases: @dnd-kit/core@6.0.8, @dnd-kit/sortable@7.0.2, @dnd-kit/core@6.0.7...
3 years ago

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.

Minor Changes

  • b7355d1 #207 Thanks @clauderic! - The data argument for useDraggable and useDroppable is now exposed in event handlers and on the active and over 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

  • fb2db94 #212 Thanks @clauderic! - Allow consumers of SortableContext to provide items of shape {id: string}[] or string[]

  • Updated dependencies [b7355d1, a9d92cf, b406cb9]:

    • @dnd-kit/core@3.0.0
    • @dnd-kit/utilities@2.0.0

Don't miss a new dnd-kit release

NewReleases is sending notifications on new releases.