@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,182 +1,139 @@
|
|
|
1
|
+
import { HvDefaultNavigation } from "./DefaultNavigation/DefaultNavigation.js";
|
|
2
|
+
import { HvSimpleNavigation } from "./SimpleNavigation/SimpleNavigation.js";
|
|
3
|
+
import { useClasses } from "./StepNavigation.styles.js";
|
|
4
|
+
import { HvTooltip, HvTypography, useTheme, useWidth } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import { theme as theme$1 } from "@hitachivantara/uikit-styles";
|
|
1
6
|
import { jsx } from "react/jsx-runtime";
|
|
2
7
|
import styled from "@emotion/styled";
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
number: index + 1
|
|
133
|
-
}) ?? {};
|
|
134
|
-
return /* @__PURE__ */ jsx(
|
|
135
|
-
HvTypography,
|
|
136
|
-
{
|
|
137
|
-
variant,
|
|
138
|
-
className: cx(
|
|
139
|
-
css({
|
|
140
|
-
textAlign: "center",
|
|
141
|
-
width: titleWidth - TITLE_MARGIN,
|
|
142
|
-
marginRight: TITLE_MARGIN
|
|
143
|
-
}),
|
|
144
|
-
titleClassName
|
|
145
|
-
),
|
|
146
|
-
disabled: titleDisabled,
|
|
147
|
-
children: title
|
|
148
|
-
},
|
|
149
|
-
title
|
|
150
|
-
);
|
|
151
|
-
}) }) : null;
|
|
152
|
-
const StepNavigation = {
|
|
153
|
-
Default: HvDefaultNavigation,
|
|
154
|
-
Simple: HvSimpleNavigation
|
|
155
|
-
}[type];
|
|
156
|
-
return /* @__PURE__ */ jsx(
|
|
157
|
-
StepNavigation,
|
|
158
|
-
{
|
|
159
|
-
numSteps: steps.length,
|
|
160
|
-
stepSize: stepSizeKey,
|
|
161
|
-
getTitles,
|
|
162
|
-
getDynamicValues,
|
|
163
|
-
className: cx(classes.root, className),
|
|
164
|
-
...others,
|
|
165
|
-
children: ({ stepsWidth, navWidth, ...itemsProps }) => /* @__PURE__ */ jsx(
|
|
166
|
-
"nav",
|
|
167
|
-
{
|
|
168
|
-
style: {
|
|
169
|
-
width: `${navWidth}px`,
|
|
170
|
-
margin: 0
|
|
171
|
-
},
|
|
172
|
-
"aria-label": ariaLabel,
|
|
173
|
-
children: drawItems(itemsProps)
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
};
|
|
179
|
-
export {
|
|
180
|
-
HvStepNavigation,
|
|
181
|
-
staticClasses as stepNavigationClasses
|
|
8
|
+
//#region src/StepNavigation/StepNavigation.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Navigation page with steps.
|
|
11
|
+
*
|
|
12
|
+
* You need to define the `steps` displayed on the component so that itself can be drawn on the UI.
|
|
13
|
+
* On each step, you need to define a `state` - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -
|
|
14
|
+
* and a `title` to be shown as a tooltip or a text above of the step. You can also defined `className`, `separatorClassName`, and `titleClassName` to override the default styles.
|
|
15
|
+
*
|
|
16
|
+
* If the step component has titles, each one will have 215px of width by default.
|
|
17
|
+
*/
|
|
18
|
+
var HvStepNavigation = ({ className, classes: classesProp, width, steps, stepSize, showTitles, type = "Default", "aria-label": ariaLabel, ...others }) => {
|
|
19
|
+
const { classes, css, cx } = useClasses(classesProp);
|
|
20
|
+
const { activeTheme } = useTheme();
|
|
21
|
+
const breakpoint = useWidth();
|
|
22
|
+
const stepSizeKey = stepSize ?? (["xs", "sm"].includes(breakpoint) ? "sm" : "md");
|
|
23
|
+
const hasTitles = showTitles ?? !["xs", "sm"].includes(breakpoint);
|
|
24
|
+
const styledLi = (containerSize) => styled("li")({
|
|
25
|
+
width: containerSize,
|
|
26
|
+
height: containerSize
|
|
27
|
+
});
|
|
28
|
+
const styledDiv = (containerSize) => styled("div")({
|
|
29
|
+
width: containerSize,
|
|
30
|
+
height: containerSize
|
|
31
|
+
});
|
|
32
|
+
const styledSeparatorElement = (title, separatorClassName, separatorHeight, separatorWidth, backgroundColor) => {
|
|
33
|
+
return /* @__PURE__ */ jsx("li", {
|
|
34
|
+
"aria-hidden": true,
|
|
35
|
+
className: cx(css({
|
|
36
|
+
height: separatorHeight,
|
|
37
|
+
width: separatorWidth - 8,
|
|
38
|
+
backgroundColor,
|
|
39
|
+
margin: `0 4px`
|
|
40
|
+
}), classes.separator),
|
|
41
|
+
children: /* @__PURE__ */ jsx("div", { className: separatorClassName })
|
|
42
|
+
}, `separator-${title}`);
|
|
43
|
+
};
|
|
44
|
+
const drawItems = ({ separatorValues: { minWidth, maxWidth, getColor, height }, stepValues: { minSize, maxSize, StepComponent } }) => {
|
|
45
|
+
const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {
|
|
46
|
+
const containerSize = state === "Current" ? maxSize : minSize;
|
|
47
|
+
const StepContainer = styledLi(containerSize);
|
|
48
|
+
const Step = styledDiv(Math.max(containerSize, 30));
|
|
49
|
+
const stepProps = {
|
|
50
|
+
size: stepSizeKey,
|
|
51
|
+
state,
|
|
52
|
+
title,
|
|
53
|
+
number: index + 1,
|
|
54
|
+
...props
|
|
55
|
+
};
|
|
56
|
+
const stepElement = /* @__PURE__ */ jsx(StepContainer, {
|
|
57
|
+
className: classes.li,
|
|
58
|
+
children: hasTitles ? /* @__PURE__ */ jsx(StepComponent, {
|
|
59
|
+
"aria-label": `${title}`,
|
|
60
|
+
...stepProps
|
|
61
|
+
}, `step-${title}`) : /* @__PURE__ */ jsx(HvTooltip, {
|
|
62
|
+
placement: "bottom",
|
|
63
|
+
title: /* @__PURE__ */ jsx(HvTypography, { children: `${index + 1}. ${title}` }),
|
|
64
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Step, {
|
|
65
|
+
className: classes.li,
|
|
66
|
+
children: /* @__PURE__ */ jsx(StepComponent, {
|
|
67
|
+
"aria-label": `${title}`,
|
|
68
|
+
...stepProps
|
|
69
|
+
})
|
|
70
|
+
}) })
|
|
71
|
+
})
|
|
72
|
+
}, `step-${title}`);
|
|
73
|
+
if (index < steps.length - 1) {
|
|
74
|
+
const separatorElement = styledSeparatorElement(title, separatorClassName, height, [steps[index + 1].state, state].includes("Current") ? minWidth : maxWidth, getColor(steps[index + 1].state === "Disabled" ? "Disabled" : state, theme$1));
|
|
75
|
+
acc.push(stepElement, separatorElement);
|
|
76
|
+
return acc;
|
|
77
|
+
}
|
|
78
|
+
acc.push(stepElement);
|
|
79
|
+
return acc;
|
|
80
|
+
}, []);
|
|
81
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
82
|
+
className: classes.ol,
|
|
83
|
+
children: items
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const getDynamicValues = (stepsWidth) => {
|
|
87
|
+
const themeBreakpoints = activeTheme?.breakpoints.values || {};
|
|
88
|
+
const maxWidth = width?.[breakpoint] ?? Math.max(Number(hasTitles) * 235 * steps.length - 20, 100 * (steps.length - 1) + stepsWidth);
|
|
89
|
+
const next = Object.keys(themeBreakpoints).find((_, index, self) => index - 1 >= 0 ? self[index - 1] === breakpoint : false);
|
|
90
|
+
const navWidth = Math.min(maxWidth, next ? themeBreakpoints[next] : maxWidth);
|
|
91
|
+
return {
|
|
92
|
+
width: navWidth,
|
|
93
|
+
titleWidth: Number(hasTitles) * Math.ceil((navWidth + 20) / steps.length),
|
|
94
|
+
separatorWidth: Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1))
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const getTitles = (getTitleProps) => hasTitles ? /* @__PURE__ */ jsx("div", {
|
|
98
|
+
className: classes.titles,
|
|
99
|
+
children: steps.map(({ title: rawTitle, state, titleClassName }, index) => {
|
|
100
|
+
const { variant = "label", title = rawTitle, titleWidth = 0, titleDisabled = false } = getTitleProps?.({
|
|
101
|
+
state,
|
|
102
|
+
rawTitle,
|
|
103
|
+
number: index + 1
|
|
104
|
+
}) ?? {};
|
|
105
|
+
return /* @__PURE__ */ jsx(HvTypography, {
|
|
106
|
+
variant,
|
|
107
|
+
className: cx(css({
|
|
108
|
+
textAlign: "center",
|
|
109
|
+
width: titleWidth - 20,
|
|
110
|
+
marginRight: 20
|
|
111
|
+
}), titleClassName),
|
|
112
|
+
disabled: titleDisabled,
|
|
113
|
+
children: title
|
|
114
|
+
}, title);
|
|
115
|
+
})
|
|
116
|
+
}) : null;
|
|
117
|
+
const StepNavigation = {
|
|
118
|
+
Default: HvDefaultNavigation,
|
|
119
|
+
Simple: HvSimpleNavigation
|
|
120
|
+
}[type];
|
|
121
|
+
return /* @__PURE__ */ jsx(StepNavigation, {
|
|
122
|
+
numSteps: steps.length,
|
|
123
|
+
stepSize: stepSizeKey,
|
|
124
|
+
getTitles,
|
|
125
|
+
getDynamicValues,
|
|
126
|
+
className: cx(classes.root, className),
|
|
127
|
+
...others,
|
|
128
|
+
children: ({ stepsWidth, navWidth, ...itemsProps }) => /* @__PURE__ */ jsx("nav", {
|
|
129
|
+
style: {
|
|
130
|
+
width: `${navWidth}px`,
|
|
131
|
+
margin: 0
|
|
132
|
+
},
|
|
133
|
+
"aria-label": ariaLabel,
|
|
134
|
+
children: drawItems(itemsProps)
|
|
135
|
+
})
|
|
136
|
+
});
|
|
182
137
|
};
|
|
138
|
+
//#endregion
|
|
139
|
+
export { HvStepNavigation };
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import { createClasses } 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
|
-
}
|
|
2
|
+
//#region src/StepNavigation/StepNavigation.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvStepNavigation", {
|
|
4
|
+
root: {
|
|
5
|
+
display: "flex",
|
|
6
|
+
flexDirection: "column"
|
|
7
|
+
},
|
|
8
|
+
titles: {
|
|
9
|
+
marginTop: 8,
|
|
10
|
+
display: "flex"
|
|
11
|
+
},
|
|
12
|
+
ol: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
flexWrap: "wrap",
|
|
17
|
+
padding: 0,
|
|
18
|
+
listStyle: "none"
|
|
19
|
+
},
|
|
20
|
+
li: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center"
|
|
24
|
+
},
|
|
25
|
+
separator: {
|
|
26
|
+
userSelect: "none",
|
|
27
|
+
"& > div": { display: "flex" }
|
|
28
|
+
}
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
useClasses
|
|
34
|
-
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { staticClasses, useClasses };
|
package/dist/Wizard/Wizard.js
CHANGED
|
@@ -1,109 +1,86 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
1
|
import { useClasses } from "./Wizard.styles.js";
|
|
4
|
-
import { staticClasses } from "./Wizard.styles.js";
|
|
5
2
|
import HvWizardContext from "./WizardContext/WizardContext.js";
|
|
3
|
+
import { HvWizardActions } from "./WizardActions/WizardActions.js";
|
|
6
4
|
import { HvWizardContainer } from "./WizardContainer/WizardContainer.js";
|
|
7
|
-
import { HvWizardTitle } from "./WizardTitle/WizardTitle.js";
|
|
8
5
|
import { HvWizardContent } from "./WizardContent/WizardContent.js";
|
|
9
|
-
import {
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
fixedHeight,
|
|
88
|
-
summaryContent,
|
|
89
|
-
children
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
/* @__PURE__ */ jsx(
|
|
93
|
-
HvWizardActions,
|
|
94
|
-
{
|
|
95
|
-
loading,
|
|
96
|
-
skippable,
|
|
97
|
-
labels,
|
|
98
|
-
handleClose,
|
|
99
|
-
handleSubmit
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
) });
|
|
105
|
-
};
|
|
106
|
-
export {
|
|
107
|
-
HvWizard,
|
|
108
|
-
staticClasses as wizardClasses
|
|
6
|
+
import { HvWizardTitle } from "./WizardTitle/WizardTitle.js";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/Wizard/Wizard.tsx
|
|
10
|
+
var HvWizard = ({ className, children, onClose, handleSubmit, title, open, skippable = true, loading = false, hasSummary = false, summaryContent, labels = {
|
|
11
|
+
cancel: "Cancel",
|
|
12
|
+
next: "Next",
|
|
13
|
+
previous: "Previous",
|
|
14
|
+
skip: "Skip",
|
|
15
|
+
submit: "Submit",
|
|
16
|
+
summary: "Summary"
|
|
17
|
+
}, fixedHeight = false, customStep, classes: classesProp, ...others }) => {
|
|
18
|
+
const { classes, cx } = useClasses(classesProp);
|
|
19
|
+
const [context, setContext] = useState({});
|
|
20
|
+
const [summary, setSummary] = useState(false);
|
|
21
|
+
const [tab, setTab] = useState(0);
|
|
22
|
+
const handleClose = useCallback((evt, reason) => {
|
|
23
|
+
if (reason !== "backdropClick") onClose?.(evt, reason);
|
|
24
|
+
}, [onClose]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
return () => {
|
|
27
|
+
if (!open) {
|
|
28
|
+
setContext((c) => Object.entries(c).reduce((acc, [key, child]) => {
|
|
29
|
+
acc[+key] = {
|
|
30
|
+
...child,
|
|
31
|
+
touched: false
|
|
32
|
+
};
|
|
33
|
+
return acc;
|
|
34
|
+
}, {}));
|
|
35
|
+
setTab(0);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [open]);
|
|
39
|
+
const value = useMemo(() => ({
|
|
40
|
+
context,
|
|
41
|
+
setContext,
|
|
42
|
+
summary,
|
|
43
|
+
setSummary,
|
|
44
|
+
tab,
|
|
45
|
+
setTab
|
|
46
|
+
}), [
|
|
47
|
+
context,
|
|
48
|
+
setContext,
|
|
49
|
+
summary,
|
|
50
|
+
setSummary,
|
|
51
|
+
tab,
|
|
52
|
+
setTab
|
|
53
|
+
]);
|
|
54
|
+
return /* @__PURE__ */ jsx(HvWizardContext.Provider, {
|
|
55
|
+
value,
|
|
56
|
+
children: /* @__PURE__ */ jsxs(HvWizardContainer, {
|
|
57
|
+
className: cx(classes.root, className),
|
|
58
|
+
onClose: handleClose,
|
|
59
|
+
open,
|
|
60
|
+
...others,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx(HvWizardTitle, {
|
|
63
|
+
title,
|
|
64
|
+
hasSummary,
|
|
65
|
+
labels,
|
|
66
|
+
customStep
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsx(HvWizardContent, {
|
|
69
|
+
loading,
|
|
70
|
+
fixedHeight,
|
|
71
|
+
summaryContent,
|
|
72
|
+
children
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx(HvWizardActions, {
|
|
75
|
+
loading,
|
|
76
|
+
skippable,
|
|
77
|
+
labels,
|
|
78
|
+
handleClose,
|
|
79
|
+
handleSubmit
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
});
|
|
109
84
|
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { HvWizard };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createClasses } from "@hitachivantara/uikit-react-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
staticClasses,
|
|
7
|
-
useClasses
|
|
8
|
-
};
|
|
2
|
+
//#region src/Wizard/Wizard.styles.tsx
|
|
3
|
+
var { staticClasses, useClasses } = createClasses("HvWizard", { root: {} });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { staticClasses, useClasses };
|