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

34 lines (33 loc) • 1.01 kB
import { HandleContext as e } from "../DragHandle/context.js"; import { useSortable as t } from "../../hooks/useSortable.js"; import n from "./SortableItem.module.js"; import { jsx as r } from "react/jsx-runtime"; //#region src/components/SortableItem/SortableItem.tsx function i({ orientation: i = "vertical", handle: a = !1, disabled: o = !1, label: s, children: c, ...l }) { let u = t({ ...l, label: s, handle: a, disabled: o }), { handleRef: d, handleProps: f, dragInput: p, dropEdge: m } = u, h = { ...a ? {} : f, className: n.entry ?? "", "data-orientation": i }; return a && (h["data-handle"] = ""), p && (h["data-dragging"] = p), m && (h["data-drop-edge"] = m), !a && o && (h["aria-disabled"] = !0), /* @__PURE__ */ r(e.Provider, { value: { handleRef: d, handleProps: f, label: s, disabled: o }, children: c({ ref: u.ref, props: h, isDragging: u.isDragging }) }); } //#endregion export { i as SortableItem }; //# sourceMappingURL=SortableItem.js.map