@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) • 920 B
JavaScript
import { useDroppable as e } from "../../hooks/useDroppable.js";
import t from "./DropZone.module.js";
import { cx as n } from "@mitcsutt/kiln-ui";
import { forwardRef as r, useCallback as i } from "react";
import { jsx as a } from "react/jsx-runtime";
//#region src/components/DropZone/DropZone.tsx
var o = r(function({ id: r, label: o, accept: s, data: c, disabled: l = !1, onDrop: u, className: d, children: f, ...p }, m) {
let h = e({
id: r,
label: o,
accept: s,
data: c,
disabled: l,
onDrop: u
}), { ref: g } = h, _ = i((e) => {
g(e), typeof m == "function" ? m(e) : m && (m.current = e);
}, [g, m]);
return /* @__PURE__ */ a("div", {
ref: _,
...p,
className: n(t.zone, d),
"data-active": h.isActive ? "" : void 0,
"data-over": h.isOver ? "" : void 0,
"data-disabled": l ? "" : void 0,
children: f
});
});
//#endregion
export { o as DropZone };
//# sourceMappingURL=DropZone.js.map