@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
10 lines (9 loc) • 1.49 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";
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),N=require("./context/index.js"),l=require("../hooks/useControlledState.js"),o=require("../hooks/useCollection.js");function T(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const m=T(y),d=e=>{const{context:n=N.DragAndDropContext}=e,[r,s]=l.useControlledState(null),[i,u]=l.useControlledState(null),[p,c]=o.useCollection([]),[g,a]=o.useCollection([]),C=t=>{c({type:o.COLLECTION_ACTION.add,item:t})},D=t=>{c({type:o.COLLECTION_ACTION.remove,item:t})},O=t=>{a({type:o.COLLECTION_ACTION.add,item:t})},f=t=>{a({type:o.COLLECTION_ACTION.remove,item:t})};return m.createElement(n.Provider,{value:{drag:r,setDrag:s,drop:i,setDrop:u,drags:p,registerDrag:C,deregisterDrag:D,drops:g,registerDrop:O,deregisterDrop:f}},e.children)};d.displayName="KendoReactDragAndDrop";exports.DragAndDrop=d;