UNPKG

@mitcsutt/kiln-dnd

Version:

Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui

31 lines (30 loc) • 820 B
import { useDndController as e } from "../core/context.js"; import { useStore as t } from "../core/store.js"; import { useDragSource as n } from "../core/useDragSource.js"; import { useCallback as r } from "react"; //#region src/hooks/useSortable.ts function i(i) { let a = e("useSortable"), { id: o } = i, s = n(a, { id: o, label: i.label, data: i.data, disabled: i.disabled ?? !1, kind: "list", list: i.list ?? "list", index: i.index, droppable: !0, instructions: "list", hasHandle: i.handle ?? !1 }), c = t(a.store, r((e) => a.dropEdge(e, o), [a, o])); return { ref: s.ref, handleRef: s.handleRef, handleProps: s.handleProps, isDragging: s.dragging !== null, dragInput: s.dragging, dropEdge: c }; } //#endregion export { i as useSortable }; //# sourceMappingURL=useSortable.js.map