@hitachivantara/uikit-react-lab 5.46.19 → 6.0.0-next.10

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 (134) hide show
  1. package/dist/{esm/Flow → Flow}/Empty/Empty.styles.js +1 -1
  2. package/dist/{esm/Flow → Flow}/Node/Node.js +0 -3
  3. package/dist/{esm/Flow → Flow}/Sidebar/Sidebar.js +1 -1
  4. package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/DefaultNavigation.js +1 -3
  5. package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/SimpleNavigation.js +1 -3
  6. package/dist/{esm/StepNavigation → StepNavigation}/StepNavigation.js +2 -7
  7. package/dist/{esm/Wizard → Wizard}/WizardTitle/WizardTitle.js +31 -47
  8. package/dist/{esm/Wizard → Wizard}/WizardTitle/WizardTitle.styles.js +0 -10
  9. package/dist/{types/index.d.ts → index.d.ts} +11 -27
  10. package/package.json +14 -14
  11. package/dist/cjs/Blade/Blade.cjs +0 -174
  12. package/dist/cjs/Blade/Blade.styles.cjs +0 -71
  13. package/dist/cjs/Blades/Blades.cjs +0 -104
  14. package/dist/cjs/Blades/Blades.styles.cjs +0 -11
  15. package/dist/cjs/Dashboard/Dashboard.cjs +0 -63
  16. package/dist/cjs/Dashboard/Dashboard.styles.cjs +0 -196
  17. package/dist/cjs/Flow/Background/Background.cjs +0 -19
  18. package/dist/cjs/Flow/Controls/Controls.cjs +0 -96
  19. package/dist/cjs/Flow/DroppableFlow.cjs +0 -204
  20. package/dist/cjs/Flow/Empty/Empty.cjs +0 -12
  21. package/dist/cjs/Flow/Empty/Empty.styles.cjs +0 -16
  22. package/dist/cjs/Flow/Flow.cjs +0 -33
  23. package/dist/cjs/Flow/Flow.styles.cjs +0 -19
  24. package/dist/cjs/Flow/FlowContext/FlowContext.cjs +0 -25
  25. package/dist/cjs/Flow/FlowContext/NodeMetaContext.cjs +0 -43
  26. package/dist/cjs/Flow/Minimap/Minimap.cjs +0 -30
  27. package/dist/cjs/Flow/Minimap/Minimap.styles.cjs +0 -10
  28. package/dist/cjs/Flow/Node/BaseNode.cjs +0 -192
  29. package/dist/cjs/Flow/Node/BaseNode.styles.cjs +0 -135
  30. package/dist/cjs/Flow/Node/Node.cjs +0 -115
  31. package/dist/cjs/Flow/Node/Node.styles.cjs +0 -42
  32. package/dist/cjs/Flow/Node/Parameters/ParamRenderer.cjs +0 -19
  33. package/dist/cjs/Flow/Node/Parameters/Select.cjs +0 -41
  34. package/dist/cjs/Flow/Node/Parameters/Slider.cjs +0 -33
  35. package/dist/cjs/Flow/Node/Parameters/Text.cjs +0 -19
  36. package/dist/cjs/Flow/Node/utils.cjs +0 -54
  37. package/dist/cjs/Flow/Sidebar/Sidebar.cjs +0 -141
  38. package/dist/cjs/Flow/Sidebar/Sidebar.styles.cjs +0 -24
  39. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroup.cjs +0 -62
  40. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroup.styles.cjs +0 -34
  41. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.cjs +0 -51
  42. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.cjs +0 -35
  43. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.cjs +0 -23
  44. package/dist/cjs/Flow/base.cjs +0 -411
  45. package/dist/cjs/Flow/hooks/useFlowContext.cjs +0 -6
  46. package/dist/cjs/Flow/hooks/useFlowInstance.cjs +0 -7
  47. package/dist/cjs/Flow/hooks/useFlowNode.cjs +0 -134
  48. package/dist/cjs/Flow/hooks/useFlowNodeMeta.cjs +0 -10
  49. package/dist/cjs/Flow/hooks/useNode.cjs +0 -159
  50. package/dist/cjs/Flow/hooks/useNodeId.cjs +0 -8
  51. package/dist/cjs/Flow/nodes/DashboardNode.cjs +0 -88
  52. package/dist/cjs/Flow/nodes/DashboardNode.styles.cjs +0 -16
  53. package/dist/cjs/Flow/nodes/StickyNode.cjs +0 -441
  54. package/dist/cjs/StepNavigation/DefaultNavigation/DefaultNavigation.cjs +0 -56
  55. package/dist/cjs/StepNavigation/DefaultNavigation/Step/Step.cjs +0 -78
  56. package/dist/cjs/StepNavigation/DefaultNavigation/Step/Step.styles.cjs +0 -35
  57. package/dist/cjs/StepNavigation/DefaultNavigation/utils.cjs +0 -34
  58. package/dist/cjs/StepNavigation/SimpleNavigation/Dot/Dot.cjs +0 -43
  59. package/dist/cjs/StepNavigation/SimpleNavigation/Dot/Dot.styles.cjs +0 -18
  60. package/dist/cjs/StepNavigation/SimpleNavigation/SimpleNavigation.cjs +0 -52
  61. package/dist/cjs/StepNavigation/SimpleNavigation/utils.cjs +0 -13
  62. package/dist/cjs/StepNavigation/StepNavigation.cjs +0 -188
  63. package/dist/cjs/StepNavigation/StepNavigation.styles.cjs +0 -34
  64. package/dist/cjs/StepNavigation/utils.cjs +0 -8
  65. package/dist/cjs/Wizard/Wizard.cjs +0 -108
  66. package/dist/cjs/Wizard/Wizard.styles.cjs +0 -8
  67. package/dist/cjs/Wizard/WizardActions/WizardActions.cjs +0 -132
  68. package/dist/cjs/Wizard/WizardActions/WizardActions.styles.cjs +0 -22
  69. package/dist/cjs/Wizard/WizardContainer/WizardContainer.cjs +0 -31
  70. package/dist/cjs/Wizard/WizardContainer/WizardContainer.styles.cjs +0 -15
  71. package/dist/cjs/Wizard/WizardContent/WizardContent.cjs +0 -121
  72. package/dist/cjs/Wizard/WizardContent/WizardContent.styles.cjs +0 -38
  73. package/dist/cjs/Wizard/WizardContext/WizardContext.cjs +0 -15
  74. package/dist/cjs/Wizard/WizardTitle/WizardTitle.cjs +0 -97
  75. package/dist/cjs/Wizard/WizardTitle/WizardTitle.styles.cjs +0 -27
  76. package/dist/cjs/index.cjs +0 -93
  77. /package/dist/{esm/Blade → Blade}/Blade.js +0 -0
  78. /package/dist/{esm/Blade → Blade}/Blade.styles.js +0 -0
  79. /package/dist/{esm/Blades → Blades}/Blades.js +0 -0
  80. /package/dist/{esm/Blades → Blades}/Blades.styles.js +0 -0
  81. /package/dist/{esm/Dashboard → Dashboard}/Dashboard.js +0 -0
  82. /package/dist/{esm/Dashboard → Dashboard}/Dashboard.styles.js +0 -0
  83. /package/dist/{esm/Flow → Flow}/Background/Background.js +0 -0
  84. /package/dist/{esm/Flow → Flow}/Controls/Controls.js +0 -0
  85. /package/dist/{esm/Flow → Flow}/DroppableFlow.js +0 -0
  86. /package/dist/{esm/Flow → Flow}/Empty/Empty.js +0 -0
  87. /package/dist/{esm/Flow → Flow}/Flow.js +0 -0
  88. /package/dist/{esm/Flow → Flow}/Flow.styles.js +0 -0
  89. /package/dist/{esm/Flow → Flow}/FlowContext/FlowContext.js +0 -0
  90. /package/dist/{esm/Flow → Flow}/FlowContext/NodeMetaContext.js +0 -0
  91. /package/dist/{esm/Flow → Flow}/Minimap/Minimap.js +0 -0
  92. /package/dist/{esm/Flow → Flow}/Minimap/Minimap.styles.js +0 -0
  93. /package/dist/{esm/Flow → Flow}/Node/BaseNode.js +0 -0
  94. /package/dist/{esm/Flow → Flow}/Node/BaseNode.styles.js +0 -0
  95. /package/dist/{esm/Flow → Flow}/Node/Node.styles.js +0 -0
  96. /package/dist/{esm/Flow → Flow}/Node/Parameters/ParamRenderer.js +0 -0
  97. /package/dist/{esm/Flow → Flow}/Node/Parameters/Select.js +0 -0
  98. /package/dist/{esm/Flow → Flow}/Node/Parameters/Slider.js +0 -0
  99. /package/dist/{esm/Flow → Flow}/Node/Parameters/Text.js +0 -0
  100. /package/dist/{esm/Flow → Flow}/Node/utils.js +0 -0
  101. /package/dist/{esm/Flow → Flow}/Sidebar/Sidebar.styles.js +0 -0
  102. /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroup.js +0 -0
  103. /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroup.styles.js +0 -0
  104. /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.js +0 -0
  105. /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.js +0 -0
  106. /package/dist/{esm/Flow → Flow}/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.js +0 -0
  107. /package/dist/{esm/Flow → Flow}/base.js +0 -0
  108. /package/dist/{esm/Flow → Flow}/hooks/useFlowContext.js +0 -0
  109. /package/dist/{esm/Flow → Flow}/hooks/useFlowInstance.js +0 -0
  110. /package/dist/{esm/Flow → Flow}/hooks/useFlowNode.js +0 -0
  111. /package/dist/{esm/Flow → Flow}/hooks/useFlowNodeMeta.js +0 -0
  112. /package/dist/{esm/Flow → Flow}/hooks/useNode.js +0 -0
  113. /package/dist/{esm/Flow → Flow}/hooks/useNodeId.js +0 -0
  114. /package/dist/{esm/Flow → Flow}/nodes/DashboardNode.js +0 -0
  115. /package/dist/{esm/Flow → Flow}/nodes/DashboardNode.styles.js +0 -0
  116. /package/dist/{esm/Flow → Flow}/nodes/StickyNode.js +0 -0
  117. /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/Step/Step.js +0 -0
  118. /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/Step/Step.styles.js +0 -0
  119. /package/dist/{esm/StepNavigation → StepNavigation}/DefaultNavigation/utils.js +0 -0
  120. /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/Dot/Dot.js +0 -0
  121. /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/Dot/Dot.styles.js +0 -0
  122. /package/dist/{esm/StepNavigation → StepNavigation}/SimpleNavigation/utils.js +0 -0
  123. /package/dist/{esm/StepNavigation → StepNavigation}/StepNavigation.styles.js +0 -0
  124. /package/dist/{esm/StepNavigation → StepNavigation}/utils.js +0 -0
  125. /package/dist/{esm/Wizard → Wizard}/Wizard.js +0 -0
  126. /package/dist/{esm/Wizard → Wizard}/Wizard.styles.js +0 -0
  127. /package/dist/{esm/Wizard → Wizard}/WizardActions/WizardActions.js +0 -0
  128. /package/dist/{esm/Wizard → Wizard}/WizardActions/WizardActions.styles.js +0 -0
  129. /package/dist/{esm/Wizard → Wizard}/WizardContainer/WizardContainer.js +0 -0
  130. /package/dist/{esm/Wizard → Wizard}/WizardContainer/WizardContainer.styles.js +0 -0
  131. /package/dist/{esm/Wizard → Wizard}/WizardContent/WizardContent.js +0 -0
  132. /package/dist/{esm/Wizard → Wizard}/WizardContent/WizardContent.styles.js +0 -0
  133. /package/dist/{esm/Wizard → Wizard}/WizardContext/WizardContext.js +0 -0
  134. /package/dist/{esm/index.js → index.js} +0 -0
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
- const Blades_styles = require("./Blades.styles.cjs");
7
- function getExpandedBlades(defaultExpanded, children, atMostOneExpanded, atLeastOneExpanded) {
8
- const childrenArray = react.Children.toArray(children);
9
- const expandedBlades = defaultExpanded ?? childrenArray.map((child, i) => {
10
- const childIsControlled = child?.props?.expanded !== void 0;
11
- const childIsExpanded = childIsControlled ? child?.props?.expanded : child?.props?.defaultExpanded;
12
- return childIsExpanded ? i : void 0;
13
- }).filter((v) => v !== void 0);
14
- const numberOfExpandedBlades = expandedBlades.length;
15
- if (atLeastOneExpanded && numberOfExpandedBlades === 0 && childrenArray.length > 0) {
16
- return [0];
17
- }
18
- if (atMostOneExpanded && numberOfExpandedBlades > 1) {
19
- return [expandedBlades[0]];
20
- }
21
- return expandedBlades;
22
- }
23
- const HvBlades = (props) => {
24
- const {
25
- id,
26
- className,
27
- classes: classesProp,
28
- children,
29
- expanded: expandedProp,
30
- defaultExpanded,
31
- atMostOneExpanded = false,
32
- atLeastOneExpanded = false,
33
- fullWidthBlades = false,
34
- onChange,
35
- ...others
36
- } = uikitReactCore.useDefaultProps("HvBlades", props);
37
- const { classes, cx } = Blades_styles.useClasses(classesProp);
38
- const [expanded, setExpanded] = uikitReactCore.useControlled(
39
- expandedProp,
40
- () => getExpandedBlades(
41
- defaultExpanded,
42
- children,
43
- atMostOneExpanded,
44
- atLeastOneExpanded
45
- )
46
- );
47
- const onChildChangeInterceptor = react.useCallback(
48
- (index, childOnChange, event, isExpanded) => {
49
- const newValue = [];
50
- if (atMostOneExpanded) {
51
- if (isExpanded) {
52
- newValue.push(index);
53
- }
54
- } else {
55
- newValue.push(...expanded);
56
- if (isExpanded) {
57
- newValue.push(index);
58
- } else {
59
- newValue.splice(newValue.indexOf(index), 1);
60
- }
61
- }
62
- if (atLeastOneExpanded && newValue.length === 0) {
63
- newValue.push(index);
64
- }
65
- childOnChange?.(event, isExpanded);
66
- onChange?.(event, newValue);
67
- setExpanded(newValue);
68
- },
69
- [onChange, expanded, setExpanded, atMostOneExpanded, atLeastOneExpanded]
70
- );
71
- const modifiedChildren = react.useMemo(() => {
72
- return react.Children.map(children, (child, i) => {
73
- const childIsExpanded = expanded.includes(i);
74
- return react.cloneElement(child, {
75
- expanded: childIsExpanded,
76
- fullWidth: child?.props?.fullWidth ?? fullWidthBlades,
77
- buttonProps: {
78
- ...child?.props?.buttonProps,
79
- "aria-disabled": (
80
- // If the accordion panel associated with an accordion header is visible,
81
- // and if the accordion does not permit the panel to be collapsed, the header
82
- // button element has aria-disabled set to true.
83
- child?.props?.disabled || childIsExpanded && atMostOneExpanded && expanded.length === 1 ? true : void 0
84
- )
85
- },
86
- onChange: (event, isExpanded) => onChildChangeInterceptor(
87
- i,
88
- child?.props?.onChange,
89
- event,
90
- isExpanded
91
- )
92
- });
93
- });
94
- }, [
95
- children,
96
- expanded,
97
- fullWidthBlades,
98
- atMostOneExpanded,
99
- onChildChangeInterceptor
100
- ]);
101
- return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: cx(classes.root, className), ...others, children: modifiedChildren });
102
- };
103
- exports.bladesClasses = Blades_styles.staticClasses;
104
- exports.HvBlades = HvBlades;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
4
- const { staticClasses, useClasses } = uikitReactCore.createClasses("HvBlades", {
5
- root: {
6
- position: "relative",
7
- display: "flex"
8
- }
9
- });
10
- exports.staticClasses = staticClasses;
11
- exports.useClasses = useClasses;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const reactGridLayout = require("react-grid-layout");
6
- const react$1 = require("@emotion/react");
7
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
8
- const Dashboard_styles = require("./Dashboard.styles.cjs");
9
- const GridLayout = reactGridLayout.WidthProvider(reactGridLayout.Responsive);
10
- const defaultCols = {
11
- xs: 12,
12
- sm: 12,
13
- md: 12,
14
- lg: 12,
15
- xl: 12
16
- };
17
- const HvDashboard = (props) => {
18
- const {
19
- children,
20
- className,
21
- layout,
22
- cols: colsProp,
23
- layouts: layoutsProp,
24
- classes: classesProp,
25
- ...others
26
- } = uikitReactCore.useDefaultProps("HvDashboard", props);
27
- const { classes, cx } = Dashboard_styles.useClasses(classesProp);
28
- const { activeTheme } = uikitReactCore.useTheme();
29
- const layouts = react.useMemo(() => {
30
- if (layoutsProp) return layoutsProp;
31
- if (!layout) return {};
32
- return { xs: layout, sm: layout, md: layout, lg: layout, xl: layout };
33
- }, [layoutsProp, layout]);
34
- const cols = react.useMemo(() => {
35
- if (!colsProp) return defaultCols;
36
- if (typeof colsProp === "number") {
37
- return {
38
- xs: colsProp,
39
- sm: colsProp,
40
- md: colsProp,
41
- lg: colsProp,
42
- xl: colsProp
43
- };
44
- }
45
- return colsProp;
46
- }, [colsProp]);
47
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
48
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Global, { styles: Dashboard_styles.gridStyles }),
49
- /* @__PURE__ */ jsxRuntime.jsx(
50
- GridLayout,
51
- {
52
- className: cx(classes.root, className),
53
- breakpoints: activeTheme?.breakpoints.values,
54
- cols,
55
- layouts,
56
- ...others,
57
- children
58
- }
59
- )
60
- ] });
61
- };
62
- exports.dashboardClasses = Dashboard_styles.staticClasses;
63
- exports.HvDashboard = HvDashboard;
@@ -1,196 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("@emotion/react");
4
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
5
- const { staticClasses, useClasses } = uikitReactCore.createClasses("HvDashboard", {
6
- root: {}
7
- });
8
- const gridStyles = react.css`
9
- .react-grid-layout {
10
- position: relative;
11
- transition: height 200ms ease;
12
- }
13
- .react-grid-item {
14
- transition: all 200ms ease;
15
- transition-property: left, top, width, height;
16
- }
17
- .react-grid-item img {
18
- pointer-events: none;
19
- user-select: none;
20
- }
21
- .react-grid-item.cssTransforms {
22
- transition-property: transform, width, height;
23
- }
24
- .react-grid-item.resizing {
25
- transition: none;
26
- z-index: 1;
27
- will-change: width, height;
28
- }
29
-
30
- .react-grid-item.react-draggable-dragging {
31
- transition: none;
32
- z-index: 3;
33
- will-change: transform;
34
- }
35
-
36
- .react-grid-item.dropping {
37
- visibility: hidden;
38
- }
39
-
40
- .react-grid-item.react-grid-placeholder {
41
- background: ${uikitReactCore.theme.colors.primaryDimmed};
42
- transition-duration: 100ms;
43
- z-index: 2;
44
- -webkit-user-select: none;
45
- -moz-user-select: none;
46
- -ms-user-select: none;
47
- -o-user-select: none;
48
- user-select: none;
49
- }
50
-
51
- .react-grid-item.react-grid-placeholder.placeholder-resizing {
52
- transition: none;
53
- }
54
-
55
- .react-grid-item > .react-resizable-handle {
56
- position: absolute;
57
- width: 20px;
58
- height: 20px;
59
- }
60
-
61
- .react-grid-item > .react-resizable-handle::after {
62
- content: "";
63
- position: absolute;
64
- right: 3px;
65
- bottom: 3px;
66
- width: 5px;
67
- height: 5px;
68
- border-right: 2px solid rgba(0, 0, 0, 0.4);
69
- border-bottom: 2px solid rgba(0, 0, 0, 0.4);
70
- }
71
-
72
- .react-resizable-hide > .react-resizable-handle {
73
- display: none;
74
- }
75
-
76
- .react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
77
- bottom: 0;
78
- left: 0;
79
- cursor: sw-resize;
80
- transform: rotate(90deg);
81
- }
82
- .react-grid-item > .react-resizable-handle.react-resizable-handle-se {
83
- bottom: 0;
84
- right: 0;
85
- cursor: se-resize;
86
- }
87
- .react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
88
- top: 0;
89
- left: 0;
90
- cursor: nw-resize;
91
- transform: rotate(180deg);
92
- }
93
- .react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
94
- top: 0;
95
- right: 0;
96
- cursor: ne-resize;
97
- transform: rotate(270deg);
98
- }
99
- .react-grid-item > .react-resizable-handle.react-resizable-handle-w,
100
- .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
101
- top: 50%;
102
- margin-top: -10px;
103
- cursor: ew-resize;
104
- }
105
- .react-grid-item > .react-resizable-handle.react-resizable-handle-w {
106
- left: 0;
107
- transform: rotate(135deg);
108
- }
109
- .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
110
- right: 0;
111
- transform: rotate(315deg);
112
- }
113
- .react-grid-item > .react-resizable-handle.react-resizable-handle-n,
114
- .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
115
- left: 50%;
116
- margin-left: -10px;
117
- cursor: ns-resize;
118
- }
119
- .react-grid-item > .react-resizable-handle.react-resizable-handle-n {
120
- top: 0;
121
- transform: rotate(225deg);
122
- }
123
- .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
124
- bottom: 0;
125
- transform: rotate(45deg);
126
- }
127
-
128
- .react-resizable {
129
- position: relative;
130
- }
131
- .react-resizable-handle {
132
- position: absolute;
133
- width: 20px;
134
- height: 20px;
135
- background-repeat: no-repeat;
136
- background-origin: content-box;
137
- box-sizing: border-box;
138
- background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+");
139
- background-position: bottom right;
140
- padding: 0 3px 3px 0;
141
- }
142
- .react-resizable-handle-sw {
143
- bottom: 0;
144
- left: 0;
145
- cursor: sw-resize;
146
- transform: rotate(90deg);
147
- }
148
- .react-resizable-handle-se {
149
- bottom: 0;
150
- right: 0;
151
- cursor: se-resize;
152
- }
153
- .react-resizable-handle-nw {
154
- top: 0;
155
- left: 0;
156
- cursor: nw-resize;
157
- transform: rotate(180deg);
158
- }
159
- .react-resizable-handle-ne {
160
- top: 0;
161
- right: 0;
162
- cursor: ne-resize;
163
- transform: rotate(270deg);
164
- }
165
- .react-resizable-handle-w,
166
- .react-resizable-handle-e {
167
- top: 50%;
168
- margin-top: -10px;
169
- cursor: ew-resize;
170
- }
171
- .react-resizable-handle-w {
172
- left: 0;
173
- transform: rotate(135deg);
174
- }
175
- .react-resizable-handle-e {
176
- right: 0;
177
- transform: rotate(315deg);
178
- }
179
- .react-resizable-handle-n,
180
- .react-resizable-handle-s {
181
- left: 50%;
182
- margin-left: -10px;
183
- cursor: ns-resize;
184
- }
185
- .react-resizable-handle-n {
186
- top: 0;
187
- transform: rotate(225deg);
188
- }
189
- .react-resizable-handle-s {
190
- bottom: 0;
191
- transform: rotate(45deg);
192
- }
193
- `;
194
- exports.gridStyles = gridStyles;
195
- exports.staticClasses = staticClasses;
196
- exports.useClasses = useClasses;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const reactflow = require("reactflow");
5
- const uikitStyles = require("@hitachivantara/uikit-styles");
6
- const HvFlowBackground = ({
7
- color = "text",
8
- ...others
9
- }) => {
10
- return /* @__PURE__ */ jsxRuntime.jsx(
11
- reactflow.Background,
12
- {
13
- color: uikitStyles.getColor(color, uikitStyles.theme.colors.textSubtle),
14
- gap: 16,
15
- ...others
16
- }
17
- );
18
- };
19
- exports.HvFlowBackground = HvFlowBackground;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const reactflow = require("reactflow");
5
- const shallow = require("zustand/shallow");
6
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
7
- const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
8
- const useFlowInstance = require("../hooks/useFlowInstance.cjs");
9
- const DEFAULT_LABELS = {
10
- fitView: "Fit view",
11
- zoomIn: "Zoom in",
12
- zoomOut: "Zoom out",
13
- interactive: "Interactive"
14
- };
15
- const selector = (state) => ({
16
- isInteractive: state.nodesDraggable || state.nodesConnectable || state.elementsSelectable,
17
- minZoomReached: state.transform[2] <= state.minZoom,
18
- maxZoomReached: state.transform[2] >= state.maxZoom
19
- });
20
- const HvFlowControls = ({
21
- onZoomIn: onZoomInProp,
22
- onZoomOut: onZoomOutProp,
23
- onFitView: onFitViewProp,
24
- labels: labelsProps,
25
- hideInteractive,
26
- hideFitView,
27
- hideZoom,
28
- position = "bottom-center",
29
- orientation = "horizontal",
30
- onInteractiveChange,
31
- fitViewOptions,
32
- children,
33
- ...others
34
- }) => {
35
- const { isInteractive, minZoomReached, maxZoomReached } = reactflow.useStore(
36
- selector,
37
- shallow.shallow
38
- );
39
- const store = reactflow.useStoreApi();
40
- const { zoomIn, zoomOut, fitView } = useFlowInstance.useFlowInstance();
41
- const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProps);
42
- const handleZoomIn = () => {
43
- zoomIn();
44
- onZoomInProp?.();
45
- };
46
- const handleZoomOut = () => {
47
- zoomOut();
48
- onZoomOutProp?.();
49
- };
50
- const handleFitView = () => {
51
- fitView(fitViewOptions);
52
- onFitViewProp?.();
53
- };
54
- const handleInteractive = () => {
55
- store.setState({
56
- nodesDraggable: !isInteractive,
57
- nodesConnectable: !isInteractive,
58
- elementsSelectable: !isInteractive
59
- });
60
- onInteractiveChange?.(!isInteractive);
61
- };
62
- return /* @__PURE__ */ jsxRuntime.jsx(reactflow.Panel, { position, ...others, children: /* @__PURE__ */ jsxRuntime.jsxs(uikitReactCore.HvMultiButton, { vertical: orientation === "vertical", children: [
63
- !hideZoom && /* @__PURE__ */ jsxRuntime.jsx(
64
- uikitReactCore.HvButton,
65
- {
66
- icon: true,
67
- title: labels?.zoomIn,
68
- onClick: handleZoomIn,
69
- disabled: maxZoomReached,
70
- children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.ZoomIn, {})
71
- }
72
- ),
73
- !hideZoom && /* @__PURE__ */ jsxRuntime.jsx(
74
- uikitReactCore.HvButton,
75
- {
76
- icon: true,
77
- title: labels?.zoomOut,
78
- onClick: handleZoomOut,
79
- disabled: minZoomReached,
80
- children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.ZoomOut, {})
81
- }
82
- ),
83
- !hideFitView && /* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvButton, { icon: true, title: labels?.fitView, onClick: handleFitView, children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Focus, {}) }),
84
- !hideInteractive && /* @__PURE__ */ jsxRuntime.jsx(
85
- uikitReactCore.HvButton,
86
- {
87
- icon: true,
88
- title: labels?.interactive,
89
- onClick: handleInteractive,
90
- children: isInteractive ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Unlock, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Lock, {})
91
- }
92
- ),
93
- children
94
- ] }) });
95
- };
96
- exports.HvFlowControls = HvFlowControls;
@@ -1,204 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const core = require("@dnd-kit/core");
6
- const react$1 = require("@emotion/react");
7
- const reactflow = require("reactflow");
8
- const uid = require("uid");
9
- const uikitReactCore = require("@hitachivantara/uikit-react-core");
10
- const base = require("./base.cjs");
11
- const Flow_styles = require("./Flow.styles.cjs");
12
- const NodeMetaContext = require("./FlowContext/NodeMetaContext.cjs");
13
- const useFlowInstance = require("./hooks/useFlowInstance.cjs");
14
- const getNode = (nodes, nodeId) => {
15
- return nodes.find((n) => n.id === nodeId);
16
- };
17
- const validateEdge = (nodes, edges, connection, nodeMetaRegistry) => {
18
- const {
19
- source: sourceId,
20
- sourceHandle,
21
- target: targetId,
22
- targetHandle
23
- } = connection;
24
- if (!sourceHandle || !targetHandle || !sourceId || !targetId) return false;
25
- const sourceNode = getNode(nodes, sourceId);
26
- const targetNode = getNode(nodes, targetId);
27
- if (!sourceNode || !targetNode) return false;
28
- const sourceType = sourceNode.type;
29
- const targetType = targetNode.type;
30
- if (!sourceType || !targetType) return false;
31
- const inputs = nodeMetaRegistry[targetId]?.inputs || [];
32
- const outputs = nodeMetaRegistry[sourceId]?.outputs || [];
33
- const source = outputs.flatMap((out) => out.outputs || out).find((out) => out.id === sourceHandle);
34
- const target = inputs.flatMap((inp) => inp.inputs || inp).find((inp) => inp.id === targetHandle);
35
- const sourceProvides = source?.provides || "";
36
- const targetAccepts = target?.accepts || [];
37
- const sourceMaxConnections = source?.maxConnections;
38
- const targetMaxConnections = target?.maxConnections;
39
- let isValid = targetAccepts.length === 0 || targetAccepts.includes(sourceProvides);
40
- if (isValid && targetMaxConnections != null) {
41
- const targetConnections = edges.filter(
42
- (edg) => edg.target === targetId && edg.targetHandle === targetHandle
43
- ).length;
44
- isValid = targetConnections < targetMaxConnections;
45
- }
46
- if (isValid && sourceMaxConnections != null) {
47
- const sourceConnections = edges.filter(
48
- (edg) => edg.source === sourceId && edg.sourceHandle === sourceHandle
49
- ).length;
50
- isValid = sourceConnections < sourceMaxConnections;
51
- }
52
- return isValid;
53
- };
54
- const HvDroppableFlow = ({
55
- id,
56
- className,
57
- children,
58
- onFlowChange,
59
- onDndDrop,
60
- classes: classesProp,
61
- nodes: initialNodes = [],
62
- edges: initialEdges = [],
63
- onConnect: onConnectProp,
64
- onNodesChange: onNodesChangeProp,
65
- onEdgesChange: onEdgesChangeProp,
66
- defaultEdgeOptions: defaultEdgeOptionsProp,
67
- nodeTypes,
68
- ...others
69
- }) => {
70
- const { classes, cx } = Flow_styles.useClasses(classesProp);
71
- const elementId = uikitReactCore.useUniqueId(id);
72
- const reactFlowInstance = useFlowInstance.useFlowInstance();
73
- const [nodes, setNodes] = react.useState(initialNodes);
74
- const [edges, setEdges] = react.useState(initialEdges);
75
- const nodesRef = react.useRef(initialNodes);
76
- const edgesRef = react.useRef(initialEdges);
77
- const updateNodes = (nds) => {
78
- setNodes(nds);
79
- nodesRef.current = nds;
80
- };
81
- const updateEdges = (eds) => {
82
- setEdges(eds);
83
- edgesRef.current = eds;
84
- };
85
- const { setNodeRef } = core.useDroppable({
86
- id: elementId
87
- });
88
- const handleDragEnd = react.useCallback(
89
- (event) => {
90
- if (event.over?.id !== elementId) return;
91
- const hvFlow = event.active.data.current?.hvFlow;
92
- const type = hvFlow?.type;
93
- if (!type || !nodeTypes?.[type]) {
94
- return;
95
- }
96
- const position = reactFlowInstance.screenToFlowPosition({
97
- x: hvFlow?.x || 0,
98
- y: hvFlow?.y || 0
99
- });
100
- const data = {
101
- nodeLabel: hvFlow?.label,
102
- ...hvFlow?.data
103
- };
104
- const newNode = {
105
- id: uid.uid(),
106
- position,
107
- data,
108
- type
109
- };
110
- if (onDndDrop) {
111
- onDndDrop(event, newNode);
112
- return;
113
- }
114
- updateNodes(nodes.concat(newNode));
115
- },
116
- [elementId, nodeTypes, nodes, onDndDrop, reactFlowInstance]
117
- );
118
- core.useDndMonitor({
119
- onDragEnd: handleDragEnd
120
- });
121
- const handleFlowChange = react.useCallback(
122
- (nds, eds) => {
123
- const isDragging = nds.find((node) => node.dragging);
124
- if (!isDragging) {
125
- onFlowChange?.(nds, eds);
126
- }
127
- },
128
- [onFlowChange]
129
- );
130
- const handleConnect = react.useCallback(
131
- (connection) => {
132
- const eds = reactflow.addEdge(connection, edgesRef.current);
133
- updateEdges(eds);
134
- handleFlowChange(nodesRef.current, eds);
135
- onConnectProp?.(connection);
136
- },
137
- [handleFlowChange, onConnectProp]
138
- );
139
- const handleNodesChange = react.useCallback(
140
- (changes) => {
141
- const nds = reactflow.applyNodeChanges(changes, nodesRef.current);
142
- updateNodes(nds);
143
- handleFlowChange(nds, edgesRef.current);
144
- onNodesChangeProp?.(changes);
145
- },
146
- [handleFlowChange, onNodesChangeProp]
147
- );
148
- const handleEdgesChange = react.useCallback(
149
- (changes) => {
150
- const eds = reactflow.applyEdgeChanges(changes, edgesRef.current);
151
- updateEdges(eds);
152
- handleFlowChange(nodesRef.current, eds);
153
- onEdgesChangeProp?.(changes);
154
- },
155
- [handleFlowChange, onEdgesChangeProp]
156
- );
157
- const { registry } = NodeMetaContext.useNodeMetaRegistry();
158
- const isValidConnection = (connection) => validateEdge(nodes, edges, connection, registry);
159
- const defaultEdgeOptions = {
160
- markerEnd: {
161
- type: reactflow.MarkerType.ArrowClosed,
162
- height: 20,
163
- width: 20
164
- },
165
- type: "smoothstep",
166
- pathOptions: {
167
- borderRadius: 40
168
- },
169
- ...defaultEdgeOptionsProp
170
- };
171
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
172
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Global, { styles: base.flowStyles }),
173
- /* @__PURE__ */ jsxRuntime.jsx(
174
- "div",
175
- {
176
- id: elementId,
177
- ref: setNodeRef,
178
- className: cx(classes.root, className),
179
- children: /* @__PURE__ */ jsxRuntime.jsx(
180
- reactflow.ReactFlow,
181
- {
182
- nodes,
183
- edges,
184
- nodeTypes,
185
- onNodesChange: handleNodesChange,
186
- onEdgesChange: handleEdgesChange,
187
- onConnect: handleConnect,
188
- isValidConnection,
189
- defaultEdgeOptions,
190
- snapGrid: [1, 1],
191
- snapToGrid: true,
192
- onError: (code, message) => {
193
- },
194
- ...others,
195
- children
196
- }
197
- )
198
- }
199
- )
200
- ] });
201
- };
202
- exports.flowClasses = Flow_styles.staticClasses;
203
- exports.HvDroppableFlow = HvDroppableFlow;
204
- exports.getNode = getNode;