@hitachivantara/uikit-react-lab
Version:
Contributed React components to UI Kit by the community.
32 lines (31 loc) • 1.38 kB
JavaScript
import { HvFlowProvider } from "./FlowContext/FlowContext.js";
import { HvDroppableFlow } from "./DroppableFlow.js";
import { jsx, jsxs } from "react/jsx-runtime";
import { ReactFlowProvider } from "reactflow";
import { DndContext, KeyboardSensor, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
import { restrictToWindowEdges } from "@dnd-kit/modifiers";
//#region src/Flow/Flow.tsx
/**
* Flow component to build interactive node-based UIs.
*
* This implementation leverages [React Flow](https://reactflow.dev).
* The drag and drop functionality leverages [Dnd Kit](https://docs.dndkit.com)
*
* Take a look at the [usage page](https://lumada-design.github.io/uikit/master/?path=/docs/lab-flow-usage--docs) to learn more about this component.
*
* DISCLAIMER: This component is a work in progress and there might be breaking changes.
*/
var HvFlow = ({ nodeGroups, sidebar, defaultActions, dndContextProps, ...others }) => {
return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(HvFlowProvider, {
nodeGroups,
defaultActions,
children: /* @__PURE__ */ jsxs(DndContext, {
sensors: useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor)),
modifiers: [restrictToWindowEdges],
...dndContextProps,
children: [/* @__PURE__ */ jsx(HvDroppableFlow, { ...others }), sidebar]
})
}) });
};
//#endregion
export { HvFlow };