@hitachivantara/uikit-react-lab 5.26.2 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/Flow/Controls/Controls.cjs +2 -1
  2. package/dist/cjs/Flow/Controls/Controls.cjs.map +1 -1
  3. package/dist/cjs/Flow/DroppableFlow.cjs +18 -11
  4. package/dist/cjs/Flow/DroppableFlow.cjs.map +1 -1
  5. package/dist/cjs/Flow/Flow.styles.cjs +0 -6
  6. package/dist/cjs/Flow/Flow.styles.cjs.map +1 -1
  7. package/dist/cjs/Flow/Node/BaseNode.cjs +11 -12
  8. package/dist/cjs/Flow/Node/BaseNode.cjs.map +1 -1
  9. package/dist/cjs/Flow/Node/BaseNode.styles.cjs +11 -1
  10. package/dist/cjs/Flow/Node/BaseNode.styles.cjs.map +1 -1
  11. package/dist/cjs/Flow/Node/Node.cjs +1 -1
  12. package/dist/cjs/Flow/Node/Node.cjs.map +1 -1
  13. package/dist/cjs/Flow/hooks/useFlowInstance.cjs +8 -0
  14. package/dist/cjs/Flow/hooks/useFlowInstance.cjs.map +1 -0
  15. package/dist/cjs/Flow/hooks/useFlowNode.cjs +31 -20
  16. package/dist/cjs/Flow/hooks/useFlowNode.cjs.map +1 -1
  17. package/dist/cjs/Flow/hooks/useFlowNodeMeta.cjs +5 -1
  18. package/dist/cjs/Flow/hooks/useFlowNodeMeta.cjs.map +1 -1
  19. package/dist/cjs/Flow/hooks/useNodeId.cjs +9 -0
  20. package/dist/cjs/Flow/hooks/useNodeId.cjs.map +1 -0
  21. package/dist/cjs/index.cjs +2 -0
  22. package/dist/cjs/index.cjs.map +1 -1
  23. package/dist/esm/Flow/Controls/Controls.js +3 -2
  24. package/dist/esm/Flow/Controls/Controls.js.map +1 -1
  25. package/dist/esm/Flow/DroppableFlow.js +19 -12
  26. package/dist/esm/Flow/DroppableFlow.js.map +1 -1
  27. package/dist/esm/Flow/Flow.styles.js +0 -6
  28. package/dist/esm/Flow/Flow.styles.js.map +1 -1
  29. package/dist/esm/Flow/Node/BaseNode.js +12 -13
  30. package/dist/esm/Flow/Node/BaseNode.js.map +1 -1
  31. package/dist/esm/Flow/Node/BaseNode.styles.js +11 -1
  32. package/dist/esm/Flow/Node/BaseNode.styles.js.map +1 -1
  33. package/dist/esm/Flow/Node/Node.js +1 -1
  34. package/dist/esm/Flow/Node/Node.js.map +1 -1
  35. package/dist/esm/Flow/hooks/useFlowInstance.js +8 -0
  36. package/dist/esm/Flow/hooks/useFlowInstance.js.map +1 -0
  37. package/dist/esm/Flow/hooks/useFlowNode.js +32 -21
  38. package/dist/esm/Flow/hooks/useFlowNode.js.map +1 -1
  39. package/dist/esm/Flow/hooks/useFlowNodeMeta.js +5 -1
  40. package/dist/esm/Flow/hooks/useFlowNodeMeta.js.map +1 -1
  41. package/dist/esm/Flow/hooks/useNodeId.js +9 -0
  42. package/dist/esm/Flow/hooks/useNodeId.js.map +1 -0
  43. package/dist/esm/index.js +2 -0
  44. package/dist/esm/index.js.map +1 -1
  45. package/dist/types/index.d.ts +22 -9
  46. package/package.json +3 -3
@@ -1,32 +1,41 @@
1
1
  import { useCallback, useMemo } from "react";
2
- import { useStore, useNodes, useEdges, useNodeId, useReactFlow } from "reactflow";
2
+ import { useStore, useNodes, useEdges } from "reactflow";
3
+ import { shallow } from "zustand/shallow";
4
+ import { useFlowInstance } from "./useFlowInstance.js";
5
+ import { useNodeId } from "./useNodeId.js";
3
6
  function useFlowNode(id) {
7
+ const nodeId = useNodeId(id);
4
8
  const nodeSelector = useCallback(
5
- (state) => state.getNodes().find((n) => n.id === id),
6
- [id]
9
+ (state) => state.getNodes().find((n) => n.id === nodeId),
10
+ [nodeId]
7
11
  );
8
- return useStore(nodeSelector);
12
+ return useStore(nodeSelector, shallow);
9
13
  }
10
14
  function useFlowNodeInputEdges(id) {
15
+ const nodeId = useNodeId(id);
11
16
  const inputEdgesSelector = useCallback(
12
- (state) => state.edges.filter((e) => e.target === id),
13
- [id]
17
+ (state) => state.edges.filter((e) => e.target === nodeId),
18
+ [nodeId]
14
19
  );
15
- return useStore(inputEdgesSelector);
20
+ return useStore(inputEdgesSelector, shallow);
16
21
  }
17
22
  function useFlowNodeOutputEdges(id) {
23
+ const nodeId = useNodeId(id);
18
24
  const outputEdgesSelector = useCallback(
19
- (state) => state.edges.filter((e) => e.source === id),
20
- [id]
25
+ (state) => state.edges.filter((e) => e.source === nodeId),
26
+ [nodeId]
21
27
  );
22
- return useStore(outputEdgesSelector);
28
+ return useStore(outputEdgesSelector, shallow);
23
29
  }
24
30
  function useFlowNodeEdges(id) {
31
+ const nodeId = useNodeId(id);
25
32
  const edgesSelector = useCallback(
26
- (state) => state.edges.filter((e) => e.source === id || e.target === id),
27
- [id]
33
+ (state) => state.edges.filter(
34
+ (e) => e.source === nodeId || e.target === nodeId
35
+ ),
36
+ [nodeId]
28
37
  );
29
- return useStore(edgesSelector);
38
+ return useStore(edgesSelector, shallow);
30
39
  }
31
40
  function useFlowNodeParents(id) {
32
41
  const inputEdges = useFlowNodeInputEdges(id);
@@ -36,25 +45,27 @@ function useFlowNodeParents(id) {
36
45
  },
37
46
  [inputEdges]
38
47
  );
39
- return useStore(parentNodesSelector);
48
+ return useStore(parentNodesSelector, shallow);
40
49
  }
41
50
  function useFlowInputNodes(id) {
51
+ const nodeId = useNodeId(id);
42
52
  const nodes = useNodes();
43
53
  const edges = useEdges();
44
54
  return useMemo(() => {
45
- return edges.filter((e) => e.target === id).map((e) => nodes.find((n) => n.id === e.source)).filter((n) => n !== null);
46
- }, [edges, id, nodes]);
55
+ return edges.filter((e) => e.target === nodeId).map((e) => nodes.find((n) => n.id === e.source)).filter((n) => n !== null);
56
+ }, [edges, nodeId, nodes]);
47
57
  }
48
58
  function useFlowOutputNodes(id) {
59
+ const nodeId = useNodeId(id);
49
60
  const nodes = useNodes();
50
61
  const edges = useEdges();
51
62
  return useMemo(() => {
52
- return edges.filter((e) => e.source === id).map((e) => nodes.find((n) => n.id === e.target)).filter((n) => n !== null);
53
- }, [edges, id, nodes]);
63
+ return edges.filter((e) => e.source === nodeId).map((e) => nodes.find((n) => n.id === e.target)).filter((n) => n !== null);
64
+ }, [edges, nodeId, nodes]);
54
65
  }
55
- function useFlowNodeUtils() {
56
- const nodeId = useNodeId();
57
- const reactFlowInstance = useReactFlow();
66
+ function useFlowNodeUtils(id) {
67
+ const nodeId = useNodeId(id);
68
+ const reactFlowInstance = useFlowInstance();
58
69
  const setNodeData = useCallback(
59
70
  (setNewData) => {
60
71
  if (!nodeId)
@@ -1 +1 @@
1
- {"version":3,"file":"useFlowNode.js","sources":["../../../../src/Flow/hooks/useFlowNode.ts"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport {\n Node,\n Edge,\n ReactFlowState,\n useStore,\n useNodes,\n useEdges,\n useReactFlow,\n useNodeId,\n} from \"reactflow\";\n\nexport function useFlowNode<T extends Node = Node>(id: string) {\n const nodeSelector = useCallback(\n (state: ReactFlowState) =>\n state.getNodes().find((n: Node): n is T => n.id === id),\n [id]\n );\n return useStore<T | undefined>(nodeSelector);\n}\n\nexport function useFlowNodeInputEdges(id: string) {\n const inputEdgesSelector = useCallback(\n (state: ReactFlowState) => state.edges.filter((e: Edge) => e.target === id),\n [id]\n );\n return useStore(inputEdgesSelector);\n}\n\nexport function useFlowNodeOutputEdges(id: string) {\n const outputEdgesSelector = useCallback(\n (state: ReactFlowState) => state.edges.filter((e: Edge) => e.source === id),\n [id]\n );\n return useStore(outputEdgesSelector);\n}\n\nexport function useFlowNodeEdges(id: string) {\n const edgesSelector = useCallback(\n (state: ReactFlowState) =>\n state.edges.filter((e: Edge) => e.source === id || e.target === id),\n [id]\n );\n return useStore(edgesSelector);\n}\n\nexport function useFlowNodeParents(id: string) {\n const inputEdges = useFlowNodeInputEdges(id);\n const parentNodesSelector = useCallback(\n (state: ReactFlowState) => {\n return inputEdges\n .map((e) => state.getNodes().find((n: Node) => n.id === e.source))\n .filter((n): n is Node => n !== null);\n },\n [inputEdges]\n );\n return useStore(parentNodesSelector);\n}\n\nexport function useFlowInputNodes<T = any>(id: string) {\n const nodes = useNodes();\n const edges = useEdges();\n\n return useMemo(() => {\n return edges\n .filter((e) => e.target === id)\n .map((e) => nodes.find((n) => n.id === e.source))\n .filter((n): n is Node<T> => n !== null);\n }, [edges, id, nodes]);\n}\n\nexport function useFlowOutputNodes<T = any>(id: string) {\n const nodes = useNodes();\n const edges = useEdges();\n\n return useMemo(() => {\n return edges\n .filter((e) => e.source === id)\n .map((e) => nodes.find((n) => n.id === e.target))\n .filter((n): n is Node<T> => n !== null);\n }, [edges, id, nodes]);\n}\n\n/** Utilities to manipulate a node in the flow */\nexport function useFlowNodeUtils<NodeData = any>() {\n const nodeId = useNodeId();\n const reactFlowInstance = useReactFlow<NodeData>();\n\n /** Mutate the node's `.data` object */\n const setNodeData = useCallback(\n (setNewData: (newData?: NodeData) => NodeData) => {\n if (!nodeId) return;\n\n reactFlowInstance.setNodes((nodes) => {\n return nodes.map((n) => {\n if (n.id === nodeId) {\n return { ...n, data: setNewData(n.data) };\n }\n return n;\n });\n });\n },\n [nodeId, reactFlowInstance]\n );\n\n return useMemo(\n () => ({\n setNodeData,\n }),\n [setNodeData]\n );\n}\n"],"names":[],"mappings":";;AAYO,SAAS,YAAmC,IAAY;AAC7D,QAAM,eAAe;AAAA,IACnB,CAAC,UACC,MAAM,WAAW,KAAK,CAAC,MAAoB,EAAE,OAAO,EAAE;AAAA,IACxD,CAAC,EAAE;AAAA,EAAA;AAEL,SAAO,SAAwB,YAAY;AAC7C;AAEO,SAAS,sBAAsB,IAAY;AAChD,QAAM,qBAAqB;AAAA,IACzB,CAAC,UAA0B,MAAM,MAAM,OAAO,CAAC,MAAY,EAAE,WAAW,EAAE;AAAA,IAC1E,CAAC,EAAE;AAAA,EAAA;AAEL,SAAO,SAAS,kBAAkB;AACpC;AAEO,SAAS,uBAAuB,IAAY;AACjD,QAAM,sBAAsB;AAAA,IAC1B,CAA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I;AAAA,EACxC,GAAA,CAAC,OAAO,IAAI,KAAK,CAAC;AACvB;AAGO,SAAS,mBAAmC;AACjD,QAAM,SAAS;AACf,QAAM,oBAAoB;AAG1B,QAAM,cAAc;AAAA,IAClB,CAAC,eAAiD;AAChD,UAAI,CAAC;AAAQ;AAEK,wBAAA,SAAS,CAAC,UAAU;AAC7B,eAAA,MAAM,IAAI,CAAC,MAAM;AAClB,cAAA,EAAE,OAAO,QAAQ;AACnB,mBAAO,EAAE,GAAG,GAAG,MAAM,WAAW,EAAE,IAAI;UACxC;AACO,iBAAA;AAAA,QAAA,CACR;AAAA,MAAA,CACF;AAAA,IACH;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,EAAA;AAGrB,SAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,IAAA;AAAA,IAEF,CAAC,WAAW;AAAA,EAAA;AAEhB;"}
1
+ {"version":3,"file":"useFlowNode.js","sources":["../../../../src/Flow/hooks/useFlowNode.ts"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport {\n Node,\n Edge,\n ReactFlowState,\n useStore,\n useNodes,\n useEdges,\n} from \"reactflow\";\nimport { shallow } from \"zustand/shallow\";\n\nimport { useFlowInstance } from \"./useFlowInstance\";\nimport { useNodeId } from \"./useNodeId\";\n\n/** Retrieves the node instance */\nexport function useFlowNode<T extends Node = Node>(id?: string) {\n const nodeId = useNodeId(id);\n\n const nodeSelector = useCallback(\n (state: ReactFlowState) =>\n state.getNodes().find((n: Node): n is T => n.id === nodeId),\n [nodeId]\n );\n return useStore<T | undefined>(nodeSelector, shallow);\n}\n\n/** Provides the input edges connected to the node */\nexport function useFlowNodeInputEdges(id?: string) {\n const nodeId = useNodeId(id);\n\n const inputEdgesSelector = useCallback(\n (state: ReactFlowState) =>\n state.edges.filter((e: Edge) => e.target === nodeId),\n [nodeId]\n );\n return useStore(inputEdgesSelector, shallow);\n}\n\n/** Gives the output edges connected from the node */\nexport function useFlowNodeOutputEdges(id?: string) {\n const nodeId = useNodeId(id);\n\n const outputEdgesSelector = useCallback(\n (state: ReactFlowState) =>\n state.edges.filter((e: Edge) => e.source === nodeId),\n [nodeId]\n );\n return useStore(outputEdgesSelector, shallow);\n}\n\n/** Offers both input and output edges of the node */\nexport function useFlowNodeEdges(id?: string) {\n const nodeId = useNodeId(id);\n\n const edgesSelector = useCallback(\n (state: ReactFlowState) =>\n state.edges.filter(\n (e: Edge) => e.source === nodeId || e.target === nodeId\n ),\n [nodeId]\n );\n return useStore(edgesSelector, shallow);\n}\n\n/** Gets the parent nodes of a specified node (nodes that have an output connected to one of the inputs of the node) */\nexport function useFlowNodeParents(id?: string) {\n const inputEdges = useFlowNodeInputEdges(id);\n const parentNodesSelector = useCallback(\n (state: ReactFlowState) => {\n return inputEdges\n .map((e) => state.getNodes().find((n: Node) => n.id === e.source))\n .filter((n): n is Node => n !== null);\n },\n [inputEdges]\n );\n return useStore(parentNodesSelector, shallow);\n}\n\n/** Retrieves the nodes connected to the inputs of the node */\nexport function useFlowInputNodes<T = any>(id?: string) {\n const nodeId = useNodeId(id);\n const nodes = useNodes();\n const edges = useEdges();\n\n return useMemo(() => {\n return edges\n .filter((e) => e.target === nodeId)\n .map((e) => nodes.find((n) => n.id === e.source))\n .filter((n): n is Node<T> => n !== null);\n }, [edges, nodeId, nodes]);\n}\n\n/** Retrieves the nodes connected to the outputs of the node */\nexport function useFlowOutputNodes<T = any>(id?: string) {\n const nodeId = useNodeId(id);\n const nodes = useNodes();\n const edges = useEdges();\n\n return useMemo(() => {\n return edges\n .filter((e) => e.source === nodeId)\n .map((e) => nodes.find((n) => n.id === e.target))\n .filter((n): n is Node<T> => n !== null);\n }, [edges, nodeId, nodes]);\n}\n\n/** Utilities to manipulate a node in the flow */\nexport function useFlowNodeUtils<NodeData = any>(id?: string) {\n const nodeId = useNodeId(id);\n const reactFlowInstance = useFlowInstance<NodeData>();\n\n /** Mutate the node's `.data` object */\n const setNodeData = useCallback(\n (setNewData: (newData?: NodeData) => NodeData) => {\n if (!nodeId) return;\n\n reactFlowInstance.setNodes((nodes) => {\n return nodes.map((n) => {\n if (n.id === nodeId) {\n return { ...n, data: setNewData(n.data) };\n }\n return n;\n });\n });\n },\n [nodeId, reactFlowInstance]\n );\n\n return useMemo(\n () => ({\n setNodeData,\n }),\n [setNodeData]\n );\n}\n"],"names":[],"mappings":";;;;;AAeO,SAAS,YAAmC,IAAa;AACxD,QAAA,SAAS,UAAU,EAAE;AAE3B,QAAM,eAAe;AAAA,IACnB,CAAC,UACC,MAAM,WAAW,KAAK,CAAC,MAAoB,EAAE,OAAO,MAAM;AAAA,IAC5D,CAAC,MAAM;AAAA,EAAA;AAEF,SAAA,SAAwB,cAAc,OAAO;AACtD;AAGO,SAAS,sBAAsB,IAAa;AAC3C,QAAA,SAAS,UAAU,EAAE;AAE3B,QAAM,qBAAqB;AAAA,IACzB,CAAC,UACC,MAAM,MAAM,OAAO,CAAC,MAAY,EAAE,WAAW,MAAM;AAAA,IACrD,CAAC,MAAM;AAAA,EAAA;AAEF,SAAA,SAAS,oBAAoB,OAAO;AAC7C;AAGO,SAAS,uBAAuB,IAAa;AAC5C,QAAA,SAAS,UAAU,EAAE;AAE3B,QAAM,sBAAsB;AAAA,IAC1B,CAAC,UACC,MAAM,MAAM,OAAO,CAAC,MAAY,EAAE,WAAW,MAAM;AAAA,IACrD,CAAC,MAAM;AAAA,EAAA;AAEF,SAAA,SAAS,qBAAqB,OAAO;AAC9C;AAGO,SAAS,iBAAiB,IAAa;AACtC,QAAA,SAAS,UAAU,EAAE;AAE3B,QAAM,gBAAgB;AAAA,IACpB,CAAC,UACC,MAAM,MAAM;AAAA,MACV,CAAC,MAAY,EAAE,WAAW,UAAU,EAAE,WAAW;AAAA,IACnD;AAAA,IACF,CAAC,MAAM;AAAA,EAAA;AAEF,SAAA,SAAS,eAAe,OAAO;AACxC;AAGO,SAAS,mBAAmB,IAAa;AACxC,QAAA,aAAa,sBAAsB,EAAE;AAC3C,QAAM,sBAAsB;AAAA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W,EAAE,IAAI;UACxC;AACO,iBAAA;AAAA,QAAA,CACR;AAAA,MAAA,CACF;AAAA,IACH;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,EAAA;AAGrB,SAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,IAAA;AAAA,IAEF,CAAC,WAAW;AAAA,EAAA;AAEhB;"}
@@ -1,7 +1,11 @@
1
1
  import { useNodeMetaRegistry } from "../FlowContext/NodeMetaContext.js";
2
+ import { useNodeId } from "./useNodeId.js";
2
3
  function useFlowNodeMeta(id) {
4
+ const nodeId = useNodeId(id);
3
5
  const { registry } = useNodeMetaRegistry();
4
- return registry[id];
6
+ if (nodeId) {
7
+ return registry[nodeId];
8
+ }
5
9
  }
6
10
  export {
7
11
  useFlowNodeMeta
@@ -1 +1 @@
1
- {"version":3,"file":"useFlowNodeMeta.js","sources":["../../../../src/Flow/hooks/useFlowNodeMeta.ts"],"sourcesContent":["import { useNodeMetaRegistry } from \"../FlowContext/NodeMetaContext\";\n\nexport function useFlowNodeMeta(id: string) {\n const { registry } = useNodeMetaRegistry();\n\n return registry[id];\n}\n"],"names":[],"mappings":";AAEO,SAAS,gBAAgB,IAAY;AACpC,QAAA,EAAE,aAAa;AAErB,SAAO,SAAS,EAAE;AACpB;"}
1
+ {"version":3,"file":"useFlowNodeMeta.js","sources":["../../../../src/Flow/hooks/useFlowNodeMeta.ts"],"sourcesContent":["import { useNodeMetaRegistry } from \"../FlowContext/NodeMetaContext\";\nimport { useNodeId } from \"./useNodeId\";\n\nexport function useFlowNodeMeta(id?: string) {\n const nodeId = useNodeId(id);\n const { registry } = useNodeMetaRegistry();\n\n if (nodeId) {\n return registry[nodeId];\n }\n}\n"],"names":[],"mappings":";;AAGO,SAAS,gBAAgB,IAAa;AACrC,QAAA,SAAS,UAAU,EAAE;AACrB,QAAA,EAAE,aAAa;AAErB,MAAI,QAAQ;AACV,WAAO,SAAS,MAAM;AAAA,EACxB;AACF;"}
@@ -0,0 +1,9 @@
1
+ import { useNodeId as useNodeId$1 } from "reactflow";
2
+ function useNodeId(id) {
3
+ const currentNodeId = useNodeId$1();
4
+ return id ?? currentNodeId;
5
+ }
6
+ export {
7
+ useNodeId
8
+ };
9
+ //# sourceMappingURL=useNodeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNodeId.js","sources":["../../../../src/Flow/hooks/useNodeId.ts"],"sourcesContent":["import { useNodeId as useReactNodeId } from \"reactflow\";\n\n/** Retrieves the node id. INTERNAL USE ONLY */\nexport function useNodeId(id?: string) {\n const currentNodeId = useReactNodeId();\n return id ?? currentNodeId;\n}\n"],"names":["useReactNodeId"],"mappings":";AAGO,SAAS,UAAU,IAAa;AACrC,QAAM,gBAAgBA;AACtB,SAAO,MAAM;AACf;"}
package/dist/esm/index.js CHANGED
@@ -22,6 +22,7 @@ import { HvDashboardNode } from "./Flow/nodes/DashboardNode.js";
22
22
  import { useFlowInputNodes, useFlowNode, useFlowNodeEdges, useFlowNodeInputEdges, useFlowNodeOutputEdges, useFlowNodeParents, useFlowNodeUtils, useFlowOutputNodes } from "./Flow/hooks/useFlowNode.js";
23
23
  import { useFlowContext } from "./Flow/hooks/useFlowContext.js";
24
24
  import { useFlowNodeMeta } from "./Flow/hooks/useFlowNodeMeta.js";
25
+ import { useFlowInstance } from "./Flow/hooks/useFlowInstance.js";
25
26
  import { staticClasses as staticClasses10 } from "./StepNavigation/StepNavigation.styles.js";
26
27
  import { HvStepNavigation } from "./StepNavigation/StepNavigation.js";
27
28
  import { staticClasses as staticClasses11 } from "./Wizard/Wizard.styles.js";
@@ -67,6 +68,7 @@ export {
67
68
  staticClasses10 as stepNavigationClasses,
68
69
  useFlowContext,
69
70
  useFlowInputNodes,
71
+ useFlowInstance,
70
72
  useFlowNode,
71
73
  useFlowNodeEdges,
72
74
  useFlowNodeInputEdges,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,6 +30,7 @@ import { Node as Node_2 } from 'reactflow';
30
30
  import { NodeProps } from 'reactflow';
31
31
  import { PanelPosition } from 'reactflow';
32
32
  import { default as React_2 } from 'react';
33
+ import { ReactFlowInstance } from 'reactflow';
33
34
  import { ReactFlowProps } from 'reactflow';
34
35
  import { ReactGridLayoutProps } from 'react-grid-layout';
35
36
  import { ResponsiveProps } from 'react-grid-layout';
@@ -461,6 +462,8 @@ export declare const HvFlowEmpty: ({ className, ...others }: HvFlowEmptyProps) =
461
462
  export declare interface HvFlowEmptyProps extends HvEmptyStateProps {
462
463
  }
463
464
 
465
+ export declare type HvFlowInstance<NodeData = any, EdgeData = any> = ReactFlowInstance<NodeData, EdgeData>;
466
+
464
467
  export declare const HvFlowMinimap: ({ nodeColor, maskColor, maskStrokeColor, nodeStrokeColor, classes: classesProp, className, ...others }: HvFlowMinimapProps) => JSX_2.Element;
465
468
 
466
469
  export declare type HvFlowMinimapClasses = ExtractNames<typeof useClasses_5>;
@@ -1133,26 +1136,36 @@ declare const useClasses_9: (classesProp?: Partial<Record<"root" | "title" | "ti
1133
1136
 
1134
1137
  export declare const useFlowContext: () => HvFlowContextValue<string>;
1135
1138
 
1136
- export declare function useFlowInputNodes<T = any>(id: string): Node_2<T, string | undefined>[];
1139
+ /** Retrieves the nodes connected to the inputs of the node */
1140
+ export declare function useFlowInputNodes<T = any>(id?: string): Node_2<T, string | undefined>[];
1141
+
1142
+ /** Retrieves the React Flow instance */
1143
+ export declare function useFlowInstance<NodeData = any, EdgeData = any>(): HvFlowInstance<NodeData, EdgeData>;
1137
1144
 
1138
- export declare function useFlowNode<T extends Node_2 = Node_2>(id: string): T | undefined;
1145
+ /** Retrieves the node instance */
1146
+ export declare function useFlowNode<T extends Node_2 = Node_2>(id?: string): T | undefined;
1139
1147
 
1140
- export declare function useFlowNodeEdges(id: string): Edge<any>[];
1148
+ /** Offers both input and output edges of the node */
1149
+ export declare function useFlowNodeEdges(id?: string): Edge<any>[];
1141
1150
 
1142
- export declare function useFlowNodeInputEdges(id: string): Edge<any>[];
1151
+ /** Provides the input edges connected to the node */
1152
+ export declare function useFlowNodeInputEdges(id?: string): Edge<any>[];
1143
1153
 
1144
- export declare function useFlowNodeMeta(id: string): HvFlowNodeMeta;
1154
+ export declare function useFlowNodeMeta(id?: string): HvFlowNodeMeta | undefined;
1145
1155
 
1146
- export declare function useFlowNodeOutputEdges(id: string): Edge<any>[];
1156
+ /** Gives the output edges connected from the node */
1157
+ export declare function useFlowNodeOutputEdges(id?: string): Edge<any>[];
1147
1158
 
1148
- export declare function useFlowNodeParents(id: string): Node_2<any, string | undefined>[];
1159
+ /** Gets the parent nodes of a specified node (nodes that have an output connected to one of the inputs of the node) */
1160
+ export declare function useFlowNodeParents(id?: string): Node_2<any, string | undefined>[];
1149
1161
 
1150
1162
  /** Utilities to manipulate a node in the flow */
1151
- export declare function useFlowNodeUtils<NodeData = any>(): {
1163
+ export declare function useFlowNodeUtils<NodeData = any>(id?: string): {
1152
1164
  setNodeData: (setNewData: (newData?: NodeData) => NodeData) => void;
1153
1165
  };
1154
1166
 
1155
- export declare function useFlowOutputNodes<T = any>(id: string): Node_2<T, string | undefined>[];
1167
+ /** Retrieves the nodes connected to the outputs of the node */
1168
+ export declare function useFlowOutputNodes<T = any>(id?: string): Node_2<T, string | undefined>[];
1156
1169
 
1157
1170
  export declare const wizardActionsClasses: {
1158
1171
  actionsContainer: "HvWizardActions-actionsContainer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-lab",
3
- "version": "5.26.2",
3
+ "version": "5.27.0",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Contributed React components for the NEXT UI Kit.",
@@ -32,7 +32,7 @@
32
32
  "@dnd-kit/core": "^6.1.0",
33
33
  "@dnd-kit/modifiers": "^6.0.1",
34
34
  "@emotion/css": "^11.11.0",
35
- "@hitachivantara/uikit-react-core": "^5.45.0",
35
+ "@hitachivantara/uikit-react-core": "^5.46.1",
36
36
  "@hitachivantara/uikit-react-icons": "^5.8.2",
37
37
  "@hitachivantara/uikit-styles": "^5.18.0",
38
38
  "@types/react-grid-layout": "^1.3.5",
@@ -50,7 +50,7 @@
50
50
  "access": "public",
51
51
  "directory": "package"
52
52
  },
53
- "gitHead": "8b3bfd1137cc8650dcd801f4910d0bdd285a0c3c",
53
+ "gitHead": "0811a83a15c475b16d6c8c210e84b91468c2722b",
54
54
  "main": "dist/cjs/index.cjs",
55
55
  "exports": {
56
56
  ".": {