@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
62 lines (61 loc) • 1.46 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as f from "react";
import { DragAndDropContext as v } from "./context/index.mjs";
import { useControlledState as n } from "../hooks/useControlledState.mjs";
import { useCollection as a, COLLECTION_ACTION as t } from "../hooks/useCollection.mjs";
const x = (e) => {
const { context: d = v } = e, [p, c] = n(
null
), [i, D] = n(
null
), [g, o] = a([]), [l, s] = a([]), m = (r) => {
o({
type: t.add,
item: r
});
}, C = (r) => {
o({
type: t.remove,
item: r
});
}, u = (r) => {
s({
type: t.add,
item: r
});
}, y = (r) => {
s({
type: t.remove,
item: r
});
};
return /* @__PURE__ */ f.createElement(
d.Provider,
{
value: {
drag: p,
setDrag: c,
drop: i,
setDrop: D,
drags: g,
registerDrag: m,
deregisterDrag: C,
drops: l,
registerDrop: u,
deregisterDrop: y
}
},
e.children
);
};
x.displayName = "KendoReactDragAndDrop";
export {
x as DragAndDrop
};