@hitachivantara/uikit-react-lab 6.1.9 → 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.
Files changed (68) hide show
  1. package/dist/Blade/Blade.js +134 -173
  2. package/dist/Blade/Blade.styles.js +54 -69
  3. package/dist/Blades/Blades.js +70 -101
  4. package/dist/Blades/Blades.styles.js +7 -10
  5. package/dist/Dashboard/Dashboard.js +57 -60
  6. package/dist/Dashboard/Dashboard.styles.js +6 -10
  7. package/dist/Flow/Background/Background.js +10 -16
  8. package/dist/Flow/Controls/Controls.js +77 -91
  9. package/dist/Flow/DroppableFlow.js +135 -200
  10. package/dist/Flow/Empty/Empty.js +12 -9
  11. package/dist/Flow/Empty/Empty.styles.js +12 -15
  12. package/dist/Flow/Flow.js +28 -30
  13. package/dist/Flow/Flow.styles.js +12 -18
  14. package/dist/Flow/FlowContext/FlowContext.js +22 -23
  15. package/dist/Flow/FlowContext/NodeMetaContext.js +36 -39
  16. package/dist/Flow/Minimap/Minimap.js +15 -28
  17. package/dist/Flow/Minimap/Minimap.styles.js +4 -9
  18. package/dist/Flow/Node/BaseNode.js +144 -190
  19. package/dist/Flow/Node/BaseNode.styles.js +122 -133
  20. package/dist/Flow/Node/Node.js +90 -108
  21. package/dist/Flow/Node/Node.styles.js +30 -40
  22. package/dist/Flow/Node/Parameters/ParamRenderer.js +17 -14
  23. package/dist/Flow/Node/Parameters/Select.js +33 -38
  24. package/dist/Flow/Node/Parameters/Slider.js +27 -29
  25. package/dist/Flow/Node/Parameters/Text.js +17 -17
  26. package/dist/Flow/Node/utils.js +44 -49
  27. package/dist/Flow/Sidebar/Sidebar.js +115 -137
  28. package/dist/Flow/Sidebar/Sidebar.styles.js +21 -22
  29. package/dist/Flow/Sidebar/SidebarGroup/SidebarGroup.js +57 -60
  30. package/dist/Flow/Sidebar/SidebarGroup/SidebarGroup.styles.js +27 -33
  31. package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.js +27 -47
  32. package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.js +14 -32
  33. package/dist/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.styles.js +17 -23
  34. package/dist/Flow/base.js +5 -5
  35. package/dist/Flow/hooks/useFlowContext.js +5 -5
  36. package/dist/Flow/hooks/useFlowInstance.js +5 -4
  37. package/dist/Flow/hooks/useFlowNode.js +92 -113
  38. package/dist/Flow/hooks/useFlowNodeMeta.js +7 -7
  39. package/dist/Flow/hooks/useNode.js +136 -154
  40. package/dist/Flow/hooks/useNodeId.js +8 -7
  41. package/dist/Flow/nodes/DashboardNode.js +64 -86
  42. package/dist/Flow/nodes/DashboardNode.styles.js +8 -14
  43. package/dist/Flow/nodes/StickyNode.js +370 -435
  44. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +36 -52
  45. package/dist/StepNavigation/DefaultNavigation/Step/Step.js +40 -51
  46. package/dist/StepNavigation/DefaultNavigation/Step/Step.styles.js +22 -33
  47. package/dist/StepNavigation/DefaultNavigation/utils.js +38 -30
  48. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +24 -41
  49. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.styles.js +13 -16
  50. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +35 -47
  51. package/dist/StepNavigation/SimpleNavigation/utils.js +10 -11
  52. package/dist/StepNavigation/StepNavigation.js +136 -179
  53. package/dist/StepNavigation/StepNavigation.styles.js +29 -32
  54. package/dist/Wizard/Wizard.js +81 -104
  55. package/dist/Wizard/Wizard.styles.js +4 -7
  56. package/dist/Wizard/WizardActions/WizardActions.js +111 -131
  57. package/dist/Wizard/WizardActions/WizardActions.styles.js +19 -20
  58. package/dist/Wizard/WizardContainer/WizardContainer.js +19 -28
  59. package/dist/Wizard/WizardContainer/WizardContainer.styles.js +8 -14
  60. package/dist/Wizard/WizardContent/WizardContent.js +103 -120
  61. package/dist/Wizard/WizardContent/WizardContent.styles.js +33 -36
  62. package/dist/Wizard/WizardContext/WizardContext.js +10 -13
  63. package/dist/Wizard/WizardTitle/WizardTitle.js +74 -79
  64. package/dist/Wizard/WizardTitle/WizardTitle.styles.js +12 -15
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +30 -81
  67. package/package.json +6 -6
  68. 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
- import { useTheme, useWidth, HvTypography, HvTooltip } from "@hitachivantara/uikit-react-core";
4
- import { theme } from "@hitachivantara/uikit-styles";
5
- import { useClasses } from "./StepNavigation.styles.js";
6
- import { staticClasses } from "./StepNavigation.styles.js";
7
- import { TITLE_WIDTH, TITLE_MARGIN, SEPARATOR_WIDTH } from "./utils.js";
8
- import { HvSimpleNavigation } from "./SimpleNavigation/SimpleNavigation.js";
9
- import { HvDefaultNavigation } from "./DefaultNavigation/DefaultNavigation.js";
10
- const HvStepNavigation = ({
11
- className,
12
- classes: classesProp,
13
- width,
14
- steps,
15
- stepSize,
16
- showTitles,
17
- type = "Default",
18
- "aria-label": ariaLabel,
19
- ...others
20
- }) => {
21
- const { classes, css, cx } = useClasses(classesProp);
22
- const { activeTheme } = useTheme();
23
- const breakpoint = useWidth();
24
- const stepSizeKey = stepSize ?? (["xs", "sm"].includes(breakpoint) ? "sm" : "md");
25
- const hasTitles = showTitles ?? !["xs", "sm"].includes(breakpoint);
26
- const styledLi = (containerSize) => styled("li")({
27
- width: containerSize,
28
- height: containerSize
29
- });
30
- const styledDiv = (containerSize) => styled("div")({
31
- width: containerSize,
32
- height: containerSize
33
- });
34
- const styledSeparatorElement = (title, separatorClassName, separatorHeight, separatorWidth, backgroundColor) => {
35
- const widthValue = separatorWidth - 2 * 4;
36
- return /* @__PURE__ */ jsx(
37
- "li",
38
- {
39
- "aria-hidden": true,
40
- className: cx(
41
- css({
42
- height: separatorHeight,
43
- width: widthValue,
44
- backgroundColor,
45
- margin: `0 4px`
46
- }),
47
- classes.separator
48
- ),
49
- children: /* @__PURE__ */ jsx("div", { className: separatorClassName })
50
- },
51
- `separator-${title}`
52
- );
53
- };
54
- const drawItems = ({
55
- separatorValues: { minWidth, maxWidth, getColor, height },
56
- stepValues: { minSize, maxSize, StepComponent }
57
- }) => {
58
- const items = steps.reduce(
59
- (acc, { state, title, separatorClassName, ...props }, index) => {
60
- const containerSize = state === "Current" ? maxSize : minSize;
61
- const StepContainer = styledLi(containerSize);
62
- const Step = styledDiv(Math.max(containerSize, 30));
63
- const stepProps = {
64
- size: stepSizeKey,
65
- state,
66
- title,
67
- number: index + 1,
68
- ...props
69
- };
70
- const stepElement = /* @__PURE__ */ jsx(StepContainer, { className: classes.li, children: hasTitles ? /* @__PURE__ */ jsx(
71
- StepComponent,
72
- {
73
- "aria-label": `${title}`,
74
- ...stepProps
75
- },
76
- `step-${title}`
77
- ) : /* @__PURE__ */ jsx(
78
- HvTooltip,
79
- {
80
- placement: "bottom",
81
- title: /* @__PURE__ */ jsx(HvTypography, { children: `${index + 1}. ${title}` }),
82
- children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Step, { className: classes.li, children: /* @__PURE__ */ jsx(StepComponent, { "aria-label": `${title}`, ...stepProps }) }) })
83
- }
84
- ) }, `step-${title}`);
85
- if (index < steps.length - 1) {
86
- const separatorElement = styledSeparatorElement(
87
- title,
88
- separatorClassName,
89
- height,
90
- [steps[index + 1].state, state].includes("Current") ? minWidth : maxWidth,
91
- getColor(
92
- steps[index + 1].state === "Disabled" ? "Disabled" : state,
93
- theme
94
- )
95
- );
96
- acc.push(stepElement, separatorElement);
97
- return acc;
98
- }
99
- acc.push(stepElement);
100
- return acc;
101
- },
102
- []
103
- );
104
- return /* @__PURE__ */ jsx("ol", { className: classes.ol, children: items });
105
- };
106
- const getDynamicValues = (stepsWidth) => {
107
- const themeBreakpoints = activeTheme?.breakpoints.values || {};
108
- const maxWidth = width?.[breakpoint] ?? Math.max(
109
- Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,
110
- SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth
111
- );
112
- const next = Object.keys(themeBreakpoints).find(
113
- (_, index, self) => index - 1 >= 0 ? self[index - 1] === breakpoint : false
114
- );
115
- const navWidth = Math.min(
116
- maxWidth,
117
- next ? themeBreakpoints[next] : maxWidth
118
- );
119
- const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);
120
- const separatorWidth = Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));
121
- return { width: navWidth, titleWidth, separatorWidth };
122
- };
123
- const getTitles = (getTitleProps) => hasTitles ? /* @__PURE__ */ jsx("div", { className: classes.titles, children: steps.map(({ title: rawTitle, state, titleClassName }, index) => {
124
- const {
125
- variant = "label",
126
- title = rawTitle,
127
- titleWidth = 0,
128
- titleDisabled = false
129
- } = getTitleProps?.({
130
- state,
131
- rawTitle,
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
- const { staticClasses, useClasses } = createClasses("HvStepNavigation", {
3
- root: {
4
- display: "flex",
5
- flexDirection: "column"
6
- },
7
- titles: {
8
- marginTop: 8,
9
- display: "flex"
10
- },
11
- ol: {
12
- display: "flex",
13
- alignItems: "center",
14
- justifyContent: "center",
15
- flexWrap: "wrap",
16
- padding: 0,
17
- listStyle: "none"
18
- },
19
- li: {
20
- display: "flex",
21
- alignItems: "center",
22
- justifyContent: "center"
23
- },
24
- separator: {
25
- userSelect: "none",
26
- "& > div": {
27
- display: "flex"
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
- export {
32
- staticClasses,
33
- useClasses
34
- };
30
+ //#endregion
31
+ export { staticClasses, useClasses };
@@ -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 { HvWizardActions } from "./WizardActions/WizardActions.js";
10
- const HvWizard = ({
11
- className,
12
- children,
13
- onClose,
14
- handleSubmit,
15
- title,
16
- open,
17
- skippable = true,
18
- loading = false,
19
- hasSummary = false,
20
- summaryContent,
21
- labels = {
22
- cancel: "Cancel",
23
- next: "Next",
24
- previous: "Previous",
25
- skip: "Skip",
26
- submit: "Submit",
27
- summary: "Summary"
28
- },
29
- fixedHeight = false,
30
- customStep,
31
- classes: classesProp,
32
- ...others
33
- }) => {
34
- const { classes, cx } = useClasses(classesProp);
35
- const [context, setContext] = useState({});
36
- const [summary, setSummary] = useState(false);
37
- const [tab, setTab] = useState(0);
38
- const handleClose = useCallback(
39
- (evt, reason) => {
40
- if (reason !== "backdropClick") {
41
- onClose?.(evt, reason);
42
- }
43
- },
44
- [onClose]
45
- );
46
- useEffect(() => {
47
- return () => {
48
- if (!open) {
49
- setContext(
50
- (c) => Object.entries(c).reduce((acc, [key, child]) => {
51
- acc[+key] = {
52
- ...child,
53
- touched: false
54
- };
55
- return acc;
56
- }, {})
57
- );
58
- setTab(0);
59
- }
60
- };
61
- }, [open]);
62
- const value = useMemo(
63
- () => ({ context, setContext, summary, setSummary, tab, setTab }),
64
- [context, setContext, summary, setSummary, tab, setTab]
65
- );
66
- return /* @__PURE__ */ jsx(HvWizardContext.Provider, { value, children: /* @__PURE__ */ jsxs(
67
- HvWizardContainer,
68
- {
69
- className: cx(classes.root, className),
70
- onClose: handleClose,
71
- open,
72
- ...others,
73
- children: [
74
- /* @__PURE__ */ jsx(
75
- HvWizardTitle,
76
- {
77
- title,
78
- hasSummary,
79
- labels,
80
- customStep
81
- }
82
- ),
83
- /* @__PURE__ */ jsx(
84
- HvWizardContent,
85
- {
86
- loading,
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
- const { staticClasses, useClasses } = createClasses("HvWizard", {
3
- root: {}
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 };