@hitachivantara/uikit-react-lab 6.1.8 → 6.1.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.
- package/dist/Blade/Blade.js +134 -173
- package/dist/Blade/Blade.styles.js +54 -69
- package/dist/Blades/Blades.js +70 -101
- package/dist/Blades/Blades.styles.js +7 -10
- package/dist/Dashboard/Dashboard.js +57 -60
- package/dist/Dashboard/Dashboard.styles.js +6 -10
- package/dist/Flow/Background/Background.js +10 -16
- package/dist/Flow/Controls/Controls.js +77 -91
- package/dist/Flow/DroppableFlow.js +135 -200
- package/dist/Flow/Empty/Empty.js +12 -9
- package/dist/Flow/Empty/Empty.styles.js +12 -15
- package/dist/Flow/Flow.js +28 -30
- package/dist/Flow/Flow.styles.js +12 -18
- package/dist/Flow/FlowContext/FlowContext.js +22 -23
- package/dist/Flow/FlowContext/NodeMetaContext.js +36 -39
- package/dist/Flow/Minimap/Minimap.js +15 -28
- package/dist/Flow/Minimap/Minimap.styles.js +4 -9
- package/dist/Flow/Node/BaseNode.js +144 -190
- package/dist/Flow/Node/BaseNode.styles.js +122 -133
- package/dist/Flow/Node/Node.js +90 -108
- package/dist/Flow/Node/Node.styles.js +30 -40
- package/dist/Flow/Node/Parameters/ParamRenderer.js +17 -14
- package/dist/Flow/Node/Parameters/Select.js +33 -38
- package/dist/Flow/Node/Parameters/Slider.js +27 -29
- package/dist/Flow/Node/Parameters/Text.js +17 -17
- package/dist/Flow/Node/utils.js +44 -49
- package/dist/Flow/Sidebar/Sidebar.js +115 -137
- package/dist/Flow/Sidebar/Sidebar.styles.js +21 -22
- package/dist/Flow/Sidebar/SidebarGroup/SidebarGroup.js +57 -60
- package/dist/Flow/Sidebar/SidebarGroup/SidebarGroup.styles.js +27 -33
- package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.js +27 -47
- package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.js +14 -32
- package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.js +17 -23
- package/dist/Flow/base.js +5 -5
- package/dist/Flow/hooks/useFlowContext.js +5 -5
- package/dist/Flow/hooks/useFlowInstance.js +5 -4
- package/dist/Flow/hooks/useFlowNode.js +92 -113
- package/dist/Flow/hooks/useFlowNodeMeta.js +7 -7
- package/dist/Flow/hooks/useNode.js +136 -154
- package/dist/Flow/hooks/useNodeId.js +8 -7
- package/dist/Flow/nodes/DashboardNode.js +64 -86
- package/dist/Flow/nodes/DashboardNode.styles.js +8 -14
- package/dist/Flow/nodes/StickyNode.js +370 -435
- package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +36 -52
- package/dist/StepNavigation/DefaultNavigation/Step/Step.js +40 -51
- package/dist/StepNavigation/DefaultNavigation/Step/Step.styles.js +22 -33
- package/dist/StepNavigation/DefaultNavigation/utils.js +38 -30
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +24 -41
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.styles.js +13 -16
- package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +35 -47
- package/dist/StepNavigation/SimpleNavigation/utils.js +10 -11
- package/dist/StepNavigation/StepNavigation.js +136 -179
- package/dist/StepNavigation/StepNavigation.styles.js +29 -32
- package/dist/Wizard/Wizard.js +81 -104
- package/dist/Wizard/Wizard.styles.js +4 -7
- package/dist/Wizard/WizardActions/WizardActions.js +111 -131
- package/dist/Wizard/WizardActions/WizardActions.styles.js +19 -20
- package/dist/Wizard/WizardContainer/WizardContainer.js +19 -28
- package/dist/Wizard/WizardContainer/WizardContainer.styles.js +8 -14
- package/dist/Wizard/WizardContent/WizardContent.js +103 -120
- package/dist/Wizard/WizardContent/WizardContent.styles.js +33 -36
- package/dist/Wizard/WizardContext/WizardContext.js +10 -13
- package/dist/Wizard/WizardTitle/WizardTitle.js +74 -79
- package/dist/Wizard/WizardTitle/WizardTitle.styles.js +12 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -81
- package/package.json +6 -6
- package/dist/StepNavigation/utils.js +0 -8
|
@@ -1,142 +1,120 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect } from "react";
|
|
3
|
-
import { useDroppable, useDndMonitor, DragOverlay } from "@dnd-kit/core";
|
|
4
|
-
import { restrictToWindowEdges } from "@dnd-kit/modifiers";
|
|
5
|
-
import { useLabels, useUniqueId, HvDrawer, HvTypography, HvInput } from "@hitachivantara/uikit-react-core";
|
|
6
|
-
import { Add } from "@hitachivantara/uikit-react-icons";
|
|
7
|
-
import { useClasses } from "./Sidebar.styles.js";
|
|
8
|
-
import { staticClasses } from "./Sidebar.styles.js";
|
|
9
1
|
import { useFlowContext } from "../hooks/useFlowContext.js";
|
|
2
|
+
import { useClasses } from "./Sidebar.styles.js";
|
|
3
|
+
import { HvFlowSidebarGroupItem } from "./SidebarGroup/SidebarGroupItem/SidebarGroupItem.js";
|
|
10
4
|
import { HvFlowDraggableSidebarGroupItem } from "./SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.js";
|
|
11
5
|
import { HvFlowSidebarGroup } from "./SidebarGroup/SidebarGroup.js";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
buttonTitle = "Close",
|
|
25
|
-
flatten = false,
|
|
26
|
-
classes: classesProp,
|
|
27
|
-
labels: labelsProps,
|
|
28
|
-
dragOverlayProps,
|
|
29
|
-
...others
|
|
30
|
-
}) => {
|
|
31
|
-
const { classes } = useClasses(classesProp);
|
|
32
|
-
const { nodeGroups, setExpandedNodeGroups } = useFlowContext();
|
|
33
|
-
const [filterValue, setFilterValue] = useState("");
|
|
34
|
-
const [draggingLabel, setDraggingLabel] = useState();
|
|
35
|
-
const labels = useLabels(DEFAULT_LABELS, labelsProps);
|
|
36
|
-
const drawerElementId = useUniqueId(id);
|
|
37
|
-
const groupsElementId = useUniqueId();
|
|
38
|
-
const { setNodeRef } = useDroppable({ id: drawerElementId });
|
|
39
|
-
const handleDragStart = (event) => {
|
|
40
|
-
if (event.active.data.current?.hvFlow) {
|
|
41
|
-
setDraggingLabel(event.active.data.current.hvFlow?.label);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const handleDragEnd = () => {
|
|
45
|
-
setDraggingLabel(void 0);
|
|
46
|
-
};
|
|
47
|
-
useDndMonitor({
|
|
48
|
-
onDragEnd: handleDragEnd,
|
|
49
|
-
onDragStart: handleDragStart
|
|
50
|
-
});
|
|
51
|
-
const filteredGroups = useMemo(() => {
|
|
52
|
-
if (!filterValue || !nodeGroups) return nodeGroups || {};
|
|
53
|
-
return filterValue ? Object.entries(nodeGroups).reduce(
|
|
54
|
-
(acc, [groupId, group]) => {
|
|
55
|
-
const filteredItems = (group.items || []).filter(
|
|
56
|
-
(item) => item.label.toLowerCase().includes(filterValue.toLowerCase())
|
|
57
|
-
);
|
|
58
|
-
const itemsCount = Object.keys(filteredItems).length;
|
|
59
|
-
if (itemsCount > 0) {
|
|
60
|
-
acc[groupId] = {
|
|
61
|
-
...group,
|
|
62
|
-
items: filteredItems
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return acc;
|
|
66
|
-
},
|
|
67
|
-
{}
|
|
68
|
-
) : nodeGroups;
|
|
69
|
-
}, [filterValue, nodeGroups]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
setExpandedNodeGroups?.(filterValue ? Object.keys(filteredGroups) : []);
|
|
72
|
-
}, [filterValue, filteredGroups, setExpandedNodeGroups]);
|
|
73
|
-
return /* @__PURE__ */ jsxs(
|
|
74
|
-
HvDrawer,
|
|
75
|
-
{
|
|
76
|
-
BackdropComponent: void 0,
|
|
77
|
-
variant: "persistent",
|
|
78
|
-
classes: {
|
|
79
|
-
paper: classes.drawerPaper
|
|
80
|
-
},
|
|
81
|
-
hideBackdrop: true,
|
|
82
|
-
anchor,
|
|
83
|
-
buttonTitle,
|
|
84
|
-
...others,
|
|
85
|
-
children: [
|
|
86
|
-
/* @__PURE__ */ jsxs("div", { id: drawerElementId, ref: setNodeRef, children: [
|
|
87
|
-
/* @__PURE__ */ jsxs("div", { className: classes.titleContainer, children: [
|
|
88
|
-
/* @__PURE__ */ jsx(Add, {}),
|
|
89
|
-
/* @__PURE__ */ jsx(HvTypography, { component: "p", variant: "title3", children: title })
|
|
90
|
-
] }),
|
|
91
|
-
/* @__PURE__ */ jsxs("div", { className: classes.contentContainer, children: [
|
|
92
|
-
/* @__PURE__ */ jsx(HvTypography, { className: classes.description, children: description }),
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
HvInput,
|
|
95
|
-
{
|
|
96
|
-
className: classes.searchRoot,
|
|
97
|
-
type: "search",
|
|
98
|
-
placeholder: labels?.searchPlaceholder,
|
|
99
|
-
"aria-label": labels?.searchAriaLabel,
|
|
100
|
-
"aria-controls": groupsElementId,
|
|
101
|
-
"aria-owns": groupsElementId,
|
|
102
|
-
onChange: (evt, val) => setFilterValue(val.trim()),
|
|
103
|
-
inputProps: { autoComplete: "off" }
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
/* @__PURE__ */ jsx("ul", { id: groupsElementId, className: classes.groupsContainer, children: Object.entries(filteredGroups).map(([groupId, group]) => {
|
|
107
|
-
if (flatten) {
|
|
108
|
-
return (group.items || []).map((item, i) => /* @__PURE__ */ jsx(
|
|
109
|
-
HvFlowDraggableSidebarGroupItem,
|
|
110
|
-
{
|
|
111
|
-
"aria-roledescription": labels?.itemAriaRoleDescription,
|
|
112
|
-
...item
|
|
113
|
-
},
|
|
114
|
-
`${item.nodeType}-${i}`
|
|
115
|
-
));
|
|
116
|
-
}
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
118
|
-
HvFlowSidebarGroup,
|
|
119
|
-
{
|
|
120
|
-
id: groupId,
|
|
121
|
-
expandButtonProps: {
|
|
122
|
-
"aria-label": labels?.expandGroupButtonAriaLabel
|
|
123
|
-
},
|
|
124
|
-
itemProps: {
|
|
125
|
-
"aria-roledescription": labels?.itemAriaRoleDescription
|
|
126
|
-
},
|
|
127
|
-
...group
|
|
128
|
-
},
|
|
129
|
-
groupId
|
|
130
|
-
);
|
|
131
|
-
}) })
|
|
132
|
-
] })
|
|
133
|
-
] }),
|
|
134
|
-
/* @__PURE__ */ jsx(DragOverlay, { modifiers: [restrictToWindowEdges], ...dragOverlayProps, children: draggingLabel ? /* @__PURE__ */ jsx(HvFlowSidebarGroupItem, { label: draggingLabel, isDragging: true }) : null })
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
);
|
|
6
|
+
import { useEffect, useMemo, useState } from "react";
|
|
7
|
+
import { HvDrawer, HvInput, HvTypography, useLabels, useUniqueId } from "@hitachivantara/uikit-react-core";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Add } from "@hitachivantara/uikit-react-icons";
|
|
10
|
+
import { DragOverlay, useDndMonitor, useDroppable } from "@dnd-kit/core";
|
|
11
|
+
import { restrictToWindowEdges } from "@dnd-kit/modifiers";
|
|
12
|
+
//#region src/Flow/Sidebar/Sidebar.tsx
|
|
13
|
+
var DEFAULT_LABELS = {
|
|
14
|
+
itemAriaRoleDescription: "Draggable",
|
|
15
|
+
expandGroupButtonAriaLabel: "Expand group",
|
|
16
|
+
searchPlaceholder: "Search node...",
|
|
17
|
+
searchAriaLabel: "Search node..."
|
|
138
18
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
19
|
+
var HvFlowSidebar = ({ id, title, description, anchor = "right", buttonTitle = "Close", flatten = false, classes: classesProp, labels: labelsProps, dragOverlayProps, ...others }) => {
|
|
20
|
+
const { classes } = useClasses(classesProp);
|
|
21
|
+
const { nodeGroups, setExpandedNodeGroups } = useFlowContext();
|
|
22
|
+
const [filterValue, setFilterValue] = useState("");
|
|
23
|
+
const [draggingLabel, setDraggingLabel] = useState();
|
|
24
|
+
const labels = useLabels(DEFAULT_LABELS, labelsProps);
|
|
25
|
+
const drawerElementId = useUniqueId(id);
|
|
26
|
+
const groupsElementId = useUniqueId();
|
|
27
|
+
const { setNodeRef } = useDroppable({ id: drawerElementId });
|
|
28
|
+
const handleDragStart = (event) => {
|
|
29
|
+
if (event.active.data.current?.hvFlow) setDraggingLabel(event.active.data.current.hvFlow?.label);
|
|
30
|
+
};
|
|
31
|
+
const handleDragEnd = () => {
|
|
32
|
+
setDraggingLabel(void 0);
|
|
33
|
+
};
|
|
34
|
+
useDndMonitor({
|
|
35
|
+
onDragEnd: handleDragEnd,
|
|
36
|
+
onDragStart: handleDragStart
|
|
37
|
+
});
|
|
38
|
+
const filteredGroups = useMemo(() => {
|
|
39
|
+
if (!filterValue || !nodeGroups) return nodeGroups || {};
|
|
40
|
+
return filterValue ? Object.entries(nodeGroups).reduce((acc, [groupId, group]) => {
|
|
41
|
+
const filteredItems = (group.items || []).filter((item) => item.label.toLowerCase().includes(filterValue.toLowerCase()));
|
|
42
|
+
if (Object.keys(filteredItems).length > 0) acc[groupId] = {
|
|
43
|
+
...group,
|
|
44
|
+
items: filteredItems
|
|
45
|
+
};
|
|
46
|
+
return acc;
|
|
47
|
+
}, {}) : nodeGroups;
|
|
48
|
+
}, [filterValue, nodeGroups]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setExpandedNodeGroups?.(filterValue ? Object.keys(filteredGroups) : []);
|
|
51
|
+
}, [
|
|
52
|
+
filterValue,
|
|
53
|
+
filteredGroups,
|
|
54
|
+
setExpandedNodeGroups
|
|
55
|
+
]);
|
|
56
|
+
return /* @__PURE__ */ jsxs(HvDrawer, {
|
|
57
|
+
BackdropComponent: void 0,
|
|
58
|
+
variant: "persistent",
|
|
59
|
+
classes: { paper: classes.drawerPaper },
|
|
60
|
+
hideBackdrop: true,
|
|
61
|
+
anchor,
|
|
62
|
+
buttonTitle,
|
|
63
|
+
...others,
|
|
64
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
65
|
+
id: drawerElementId,
|
|
66
|
+
ref: setNodeRef,
|
|
67
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
68
|
+
className: classes.titleContainer,
|
|
69
|
+
children: [/* @__PURE__ */ jsx(Add, {}), /* @__PURE__ */ jsx(HvTypography, {
|
|
70
|
+
component: "p",
|
|
71
|
+
variant: "title3",
|
|
72
|
+
children: title
|
|
73
|
+
})]
|
|
74
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: classes.contentContainer,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(HvTypography, {
|
|
78
|
+
className: classes.description,
|
|
79
|
+
children: description
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx(HvInput, {
|
|
82
|
+
className: classes.searchRoot,
|
|
83
|
+
type: "search",
|
|
84
|
+
placeholder: labels?.searchPlaceholder,
|
|
85
|
+
"aria-label": labels?.searchAriaLabel,
|
|
86
|
+
"aria-controls": groupsElementId,
|
|
87
|
+
"aria-owns": groupsElementId,
|
|
88
|
+
onChange: (evt, val) => setFilterValue(val.trim()),
|
|
89
|
+
inputProps: { autoComplete: "off" }
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx("ul", {
|
|
92
|
+
id: groupsElementId,
|
|
93
|
+
className: classes.groupsContainer,
|
|
94
|
+
children: Object.entries(filteredGroups).map(([groupId, group]) => {
|
|
95
|
+
if (flatten) return group.items?.map((item, i) => /* @__PURE__ */ jsx(HvFlowDraggableSidebarGroupItem, {
|
|
96
|
+
"aria-roledescription": labels?.itemAriaRoleDescription,
|
|
97
|
+
...item
|
|
98
|
+
}, `${item.nodeType}-${i}`));
|
|
99
|
+
return /* @__PURE__ */ jsx(HvFlowSidebarGroup, {
|
|
100
|
+
id: groupId,
|
|
101
|
+
expandButtonProps: { "aria-label": labels?.expandGroupButtonAriaLabel },
|
|
102
|
+
itemProps: { "aria-roledescription": labels?.itemAriaRoleDescription },
|
|
103
|
+
...group
|
|
104
|
+
}, groupId);
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
})]
|
|
109
|
+
}), /* @__PURE__ */ jsx(DragOverlay, {
|
|
110
|
+
modifiers: [restrictToWindowEdges],
|
|
111
|
+
...dragOverlayProps,
|
|
112
|
+
children: draggingLabel ? /* @__PURE__ */ jsx(HvFlowSidebarGroupItem, {
|
|
113
|
+
label: draggingLabel,
|
|
114
|
+
isDragging: true
|
|
115
|
+
}) : null
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
142
118
|
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { HvFlowSidebar };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { createClasses, theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
//#region src/Flow/Sidebar/Sidebar.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvFlowSidebar", {
|
|
4
|
+
drawerPaper: { width: "360px" },
|
|
5
|
+
titleContainer: {
|
|
6
|
+
display: "flex",
|
|
7
|
+
padding: theme.spacing("sm", "lg", "xs", "sm")
|
|
8
|
+
},
|
|
9
|
+
contentContainer: { padding: theme.spacing(0, "lg", "sm", "lg") },
|
|
10
|
+
description: { color: theme.colors.textSubtle },
|
|
11
|
+
searchRoot: {
|
|
12
|
+
paddingTop: theme.space.sm,
|
|
13
|
+
paddingBottom: theme.space.sm
|
|
14
|
+
},
|
|
15
|
+
groupsContainer: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
gap: theme.space.sm,
|
|
19
|
+
listStyleType: "none"
|
|
20
|
+
}
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
useClasses
|
|
24
|
-
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { staticClasses, useClasses };
|
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useCallback } from "react";
|
|
3
|
-
import { HvTypography, HvButton } from "@hitachivantara/uikit-react-core";
|
|
4
|
-
import { DropDownXS } from "@hitachivantara/uikit-react-icons";
|
|
5
|
-
import { getColor } from "@hitachivantara/uikit-styles";
|
|
6
|
-
import { useClasses } from "./SidebarGroup.styles.js";
|
|
7
|
-
import { staticClasses } from "./SidebarGroup.styles.js";
|
|
8
1
|
import { useFlowContext } from "../../hooks/useFlowContext.js";
|
|
2
|
+
import { useClasses } from "./SidebarGroup.styles.js";
|
|
9
3
|
import { HvFlowDraggableSidebarGroupItem } from "./SidebarGroupItem/DraggableSidebarGroupItem.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
5
|
+
import { HvButton, HvTypography } from "@hitachivantara/uikit-react-core";
|
|
6
|
+
import { getColor } from "@hitachivantara/uikit-styles";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { DropDownXS } from "@hitachivantara/uikit-react-icons";
|
|
9
|
+
//#region src/Flow/Sidebar/SidebarGroup/SidebarGroup.tsx
|
|
10
|
+
var HvFlowSidebarGroup = ({ id, label, items = [], color, description, icon, expandButtonProps, classes: classesProp, itemProps }) => {
|
|
11
|
+
const { classes, cx, css } = useClasses(classesProp);
|
|
12
|
+
const { expandedNodeGroups, setExpandedNodeGroups } = useFlowContext();
|
|
13
|
+
const opened = useMemo(() => !!expandedNodeGroups?.find((group) => group === id), [expandedNodeGroups, id]);
|
|
14
|
+
const handleClick = useCallback(() => {
|
|
15
|
+
setExpandedNodeGroups?.((prev) => opened ? prev.filter((group) => id !== group) : [...prev, id]);
|
|
16
|
+
}, [
|
|
17
|
+
id,
|
|
18
|
+
opened,
|
|
19
|
+
setExpandedNodeGroups
|
|
20
|
+
]);
|
|
21
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
22
|
+
className: cx(css({ borderColor: getColor(color) }), classes.root),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: classes.titleContainer,
|
|
26
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: classes.labelContainer,
|
|
28
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: classes.icon,
|
|
30
|
+
role: "presentation",
|
|
31
|
+
children: icon
|
|
32
|
+
}), /* @__PURE__ */ jsx(HvTypography, {
|
|
33
|
+
component: "p",
|
|
34
|
+
variant: "title4",
|
|
35
|
+
children: Object.keys(items).length > 1 ? `${label} (${Object.keys(items).length})` : label
|
|
36
|
+
})]
|
|
37
|
+
}), /* @__PURE__ */ jsx(HvButton, {
|
|
38
|
+
icon: true,
|
|
39
|
+
onClick: handleClick,
|
|
40
|
+
"aria-expanded": opened,
|
|
41
|
+
...expandButtonProps,
|
|
42
|
+
children: /* @__PURE__ */ jsx(DropDownXS, { rotate: opened })
|
|
43
|
+
})]
|
|
44
|
+
}),
|
|
45
|
+
description && /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: classes.descriptionContainer,
|
|
47
|
+
children: /* @__PURE__ */ jsx(HvTypography, { children: description })
|
|
48
|
+
}),
|
|
49
|
+
opened && /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: classes.itemsContainer,
|
|
51
|
+
children: Object.entries(items).map(([itemId, item]) => /* @__PURE__ */ jsx(HvFlowDraggableSidebarGroupItem, {
|
|
52
|
+
...itemProps,
|
|
53
|
+
...item
|
|
54
|
+
}, itemId))
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
63
58
|
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { HvFlowSidebarGroup };
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { createClasses, theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
export {
|
|
32
|
-
staticClasses,
|
|
33
|
-
useClasses
|
|
34
|
-
};
|
|
2
|
+
//#region src/Flow/Sidebar/SidebarGroup/SidebarGroup.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvFlowSidebarGroup", {
|
|
4
|
+
root: {
|
|
5
|
+
padding: theme.space.sm,
|
|
6
|
+
borderRadius: theme.radii.round,
|
|
7
|
+
borderWidth: "1px",
|
|
8
|
+
borderTopWidth: "3px"
|
|
9
|
+
},
|
|
10
|
+
titleContainer: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
justifyContent: "space-between"
|
|
13
|
+
},
|
|
14
|
+
labelContainer: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
alignItems: "center"
|
|
17
|
+
},
|
|
18
|
+
icon: { paddingRight: theme.space.xs },
|
|
19
|
+
descriptionContainer: { padding: `${theme.space.xs} 0 ${theme.space.sm} calc(32px + ${theme.space.xs})` },
|
|
20
|
+
itemsContainer: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "column",
|
|
23
|
+
gap: theme.space.xs,
|
|
24
|
+
paddingLeft: theme.space.sm
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useClasses };
|
|
@@ -1,51 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HvFlowSidebarGroupItem } from "./SidebarGroupItem.js";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
+
import { useUniqueId } from "@hitachivantara/uikit-react-core";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
import { useDraggable } from "@dnd-kit/core";
|
|
4
6
|
import { useForkRef } from "@mui/material/utils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Data
|
|
28
|
-
data
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const forkedRef = useForkRef(itemRef, setNodeRef);
|
|
33
|
-
const style = transform ? {
|
|
34
|
-
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`
|
|
35
|
-
} : void 0;
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
-
HvFlowSidebarGroupItem,
|
|
38
|
-
{
|
|
39
|
-
ref: forkedRef,
|
|
40
|
-
style,
|
|
41
|
-
label,
|
|
42
|
-
isDragging,
|
|
43
|
-
...listeners,
|
|
44
|
-
...attributes,
|
|
45
|
-
...others
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
HvFlowDraggableSidebarGroupItem
|
|
7
|
+
//#region src/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.tsx
|
|
8
|
+
var HvFlowDraggableSidebarGroupItem = ({ id: idProp, label, nodeType, data, ...others }) => {
|
|
9
|
+
const itemRef = useRef(null);
|
|
10
|
+
const { attributes, listeners, setNodeRef, isDragging, transform } = useDraggable({
|
|
11
|
+
id: useUniqueId(idProp),
|
|
12
|
+
data: { hvFlow: {
|
|
13
|
+
type: nodeType,
|
|
14
|
+
label,
|
|
15
|
+
x: itemRef.current?.getBoundingClientRect().x,
|
|
16
|
+
y: itemRef.current?.getBoundingClientRect().y,
|
|
17
|
+
data
|
|
18
|
+
} }
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(HvFlowSidebarGroupItem, {
|
|
21
|
+
ref: useForkRef(itemRef, setNodeRef),
|
|
22
|
+
style: transform ? { transform: `translate3d(${transform.x}px, ${transform.y}px, 0)` } : void 0,
|
|
23
|
+
label,
|
|
24
|
+
isDragging,
|
|
25
|
+
...listeners,
|
|
26
|
+
...attributes,
|
|
27
|
+
...others
|
|
28
|
+
});
|
|
51
29
|
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { HvFlowDraggableSidebarGroupItem };
|
|
@@ -1,36 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useClasses } from "./SidebarGroupItem.styles.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { HvTypography } from "@hitachivantara/uikit-react-core";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Drag } from "@hitachivantara/uikit-react-icons";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { classes, cx } = useClasses(classesProp);
|
|
16
|
-
return /* @__PURE__ */ jsxs(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
ref,
|
|
20
|
-
className: cx(
|
|
21
|
-
classes.root,
|
|
22
|
-
{ [classes.dragging]: isDragging },
|
|
23
|
-
className
|
|
24
|
-
),
|
|
25
|
-
...others,
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsx(HvTypography, { children: label }),
|
|
28
|
-
/* @__PURE__ */ jsx(Drag, {})
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
);
|
|
6
|
+
//#region src/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.tsx
|
|
7
|
+
var HvFlowSidebarGroupItem = forwardRef(function HvFlowSidebarGroupItem(props, ref) {
|
|
8
|
+
const { label, isDragging, classes: classesProp, className, ...others } = props;
|
|
9
|
+
const { classes, cx } = useClasses(classesProp);
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
ref,
|
|
12
|
+
className: cx(classes.root, { [classes.dragging]: isDragging }, className),
|
|
13
|
+
...others,
|
|
14
|
+
children: [/* @__PURE__ */ jsx(HvTypography, { children: label }), /* @__PURE__ */ jsx(Drag, {})]
|
|
15
|
+
});
|
|
32
16
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
staticClasses as flowSidebarGroupItemClasses
|
|
36
|
-
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { HvFlowSidebarGroupItem };
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { createClasses,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
export {
|
|
21
|
-
staticClasses,
|
|
22
|
-
useClasses
|
|
23
|
-
};
|
|
1
|
+
import { createClasses, outlineStyles, theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
+
//#region src/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvFlowSidebarGroupItem", {
|
|
4
|
+
root: {
|
|
5
|
+
display: "flex",
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
justifyContent: "space-between",
|
|
8
|
+
border: `1px solid ${theme.colors.border}`,
|
|
9
|
+
padding: theme.spacing(0, 0, 0, "sm"),
|
|
10
|
+
cursor: "pointer",
|
|
11
|
+
boxShadow: `0 1px 0 ${theme.colors.shad1}`,
|
|
12
|
+
"&:focus-visible": { ...outlineStyles }
|
|
13
|
+
},
|
|
14
|
+
dragging: { borderColor: theme.colors.primaryStrong }
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useClasses };
|