@hortiview/shared-components 2.16.2 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/components/Stepper/Stepper.js +51 -63
- package/dist/components/Stepper/Stepper.test.js +52 -54
- package/dist/components/Stepper/components/StepperButton.d.ts +4 -2
- package/dist/components/Stepper/components/StepperButton.js +36 -33
- package/dist/components/Stepper/stepperTypes.d.ts +4 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [2.17.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.2...v2.17.0) (2026-02-27)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* made Step buttons optional and added variant support to stepperButtonProps ([bf876f1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/bf876f1435d54562c42166778ab7c326ec31b10b)), closes [#18954](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/issues/18954)
|
|
6
|
+
|
|
1
7
|
## [2.16.2](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.1...v2.16.2) (2026-02-24)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { G as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { StepperPreviousButton as
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { G as d } from "../../index.es-oxil0uFe.js";
|
|
3
|
+
import { useMemo as f } from "react";
|
|
4
|
+
import { StepperPreviousButton as C, StepperNextButton as S } from "./components/StepperButton.js";
|
|
5
5
|
import { StepperHeader as k } from "./components/StepperHeader.js";
|
|
6
|
-
import { s as
|
|
6
|
+
import { s as b } from "../../stepper.module-DR_FbENS.js";
|
|
7
7
|
import { StepperStyle as D } from "./stepperStyles.js";
|
|
8
|
-
const
|
|
9
|
-
stepperStyle:
|
|
10
|
-
steps:
|
|
11
|
-
currentStepId:
|
|
12
|
-
overwriteTotalSteps:
|
|
13
|
-
isStepLoading:
|
|
14
|
-
showStepperHeader:
|
|
15
|
-
showStepperButtons:
|
|
16
|
-
stepperButtonAlignment:
|
|
17
|
-
showPreviousButtonOnFirstStep:
|
|
18
|
-
children:
|
|
8
|
+
const G = ({
|
|
9
|
+
stepperStyle: m = D.DESKTOP,
|
|
10
|
+
steps: o,
|
|
11
|
+
currentStepId: s,
|
|
12
|
+
overwriteTotalSteps: v,
|
|
13
|
+
isStepLoading: P,
|
|
14
|
+
showStepperHeader: h = !0,
|
|
15
|
+
showStepperButtons: y = !0,
|
|
16
|
+
stepperButtonAlignment: g,
|
|
17
|
+
showPreviousButtonOnFirstStep: x = !1,
|
|
18
|
+
children: A
|
|
19
19
|
}) => {
|
|
20
|
-
const p =
|
|
21
|
-
const
|
|
20
|
+
const p = f(() => {
|
|
21
|
+
const i = o.map((r, e) => (e === 0 && r.excludeFromHeader && console.error(
|
|
22
22
|
"The first step is excluded from the header. Please check your configuration."
|
|
23
23
|
), {
|
|
24
24
|
step: r,
|
|
@@ -26,45 +26,31 @@ const W = ({
|
|
|
26
26
|
isCompleted: !1,
|
|
27
27
|
isRendered: !r.excludeFromHeader,
|
|
28
28
|
isFirst: e === 0,
|
|
29
|
-
isLast: e ===
|
|
30
|
-
})), l =
|
|
29
|
+
isLast: e === o.length - 1
|
|
30
|
+
})), l = o.findIndex((r) => r.id === s);
|
|
31
31
|
l === -1 && console.error(
|
|
32
|
-
`Current step with id ${
|
|
32
|
+
`Current step with id ${s} not found in steps array. Bad configuration?`
|
|
33
33
|
);
|
|
34
|
-
let
|
|
35
|
-
for (let r = 0; r <
|
|
36
|
-
const e =
|
|
34
|
+
let u = s;
|
|
35
|
+
for (let r = 0; r < i.length; r++) {
|
|
36
|
+
const e = i[r];
|
|
37
37
|
if (r > l) {
|
|
38
38
|
e.isActive = !1, e.isCompleted = !1;
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
if (e.step.id ===
|
|
41
|
+
if (e.step.id === s)
|
|
42
42
|
if (e.isRendered)
|
|
43
43
|
e.isActive = !0, e.isCompleted = !1;
|
|
44
44
|
else {
|
|
45
|
-
const a =
|
|
45
|
+
const a = i.find((B) => B.step.id === u);
|
|
46
46
|
a && (a.isActive = !0, a.isCompleted = e.step.excludedStepCompletesPreviousStep ?? !1);
|
|
47
47
|
}
|
|
48
|
-
r < l && (e.isActive = !1, e.isCompleted = !0, e.isRendered && (
|
|
48
|
+
r < l && (e.isActive = !1, e.isCompleted = !0, e.isRendered && (u = e.step.id));
|
|
49
49
|
}
|
|
50
|
-
return
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
`No active step found for currentStepId ${o}. Please check your configuration.`
|
|
55
|
-
), null;
|
|
56
|
-
if (c) {
|
|
57
|
-
if (!t.step.nextButtonProps?.onClick || !t.step.nextButtonProps?.label)
|
|
58
|
-
return console.error(
|
|
59
|
-
`Next button props not found for current step with id ${o}. If you want to use the stepper buttons, make sure to provide nextButtonProps for each step.`
|
|
60
|
-
), null;
|
|
61
|
-
if ((!t.isFirst || d) && (!t.step.prevButtonProps?.onClick || !t.step.prevButtonProps?.label))
|
|
62
|
-
return console.error(
|
|
63
|
-
`Previous button props not found for current step with id ${o}. If you want to use the stepper buttons, make sure to provide prevButtonProps for each applicable step.`
|
|
64
|
-
), null;
|
|
65
|
-
}
|
|
66
|
-
return /* @__PURE__ */ m(
|
|
67
|
-
u,
|
|
50
|
+
return i;
|
|
51
|
+
}, [o, s]), t = f(() => p.find((i) => i.isActive), [p]);
|
|
52
|
+
return t ? /* @__PURE__ */ c(
|
|
53
|
+
d,
|
|
68
54
|
{
|
|
69
55
|
"data-testid": "stepper",
|
|
70
56
|
fullWidth: !0,
|
|
@@ -73,59 +59,61 @@ const W = ({
|
|
|
73
59
|
primaryAlign: "center",
|
|
74
60
|
secondaryAlign: "center",
|
|
75
61
|
children: [
|
|
76
|
-
|
|
62
|
+
h ? /* @__PURE__ */ n(
|
|
77
63
|
k,
|
|
78
64
|
{
|
|
79
|
-
stepperStyle:
|
|
65
|
+
stepperStyle: m,
|
|
80
66
|
stepsData: p,
|
|
81
|
-
overwriteTotalSteps:
|
|
67
|
+
overwriteTotalSteps: v
|
|
82
68
|
}
|
|
83
69
|
) : null,
|
|
84
70
|
/* @__PURE__ */ n(
|
|
85
|
-
|
|
71
|
+
d,
|
|
86
72
|
{
|
|
87
73
|
"data-testid": "stepper-content",
|
|
88
74
|
fullWidth: !0,
|
|
89
|
-
className:
|
|
75
|
+
className: b.stepperContent,
|
|
90
76
|
gap: "airy",
|
|
91
77
|
secondaryAlign: "center",
|
|
92
78
|
direction: "vertical",
|
|
93
|
-
children:
|
|
79
|
+
children: A
|
|
94
80
|
}
|
|
95
81
|
),
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
y ? /* @__PURE__ */ c(
|
|
83
|
+
d,
|
|
98
84
|
{
|
|
99
85
|
"data-testid": "stepper-buttons",
|
|
100
86
|
fullWidth: !0,
|
|
101
87
|
secondaryAlign: "center",
|
|
102
|
-
primaryAlign:
|
|
88
|
+
primaryAlign: t.step.prevButtonProps ? g : "end",
|
|
103
89
|
children: [
|
|
104
|
-
(!t.isFirst ||
|
|
105
|
-
|
|
90
|
+
(!t.isFirst || x) && t.step.prevButtonProps ? /* @__PURE__ */ n(
|
|
91
|
+
C,
|
|
106
92
|
{
|
|
107
93
|
...t.step.prevButtonProps,
|
|
108
94
|
onClick: t.step.prevButtonProps.onClick,
|
|
109
95
|
label: t.step.prevButtonProps.label
|
|
110
96
|
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ n(
|
|
113
|
-
|
|
97
|
+
) : null,
|
|
98
|
+
t.step.nextButtonProps ? /* @__PURE__ */ n(
|
|
99
|
+
S,
|
|
114
100
|
{
|
|
115
101
|
...t.step.nextButtonProps,
|
|
116
102
|
onClick: t.step.nextButtonProps.onClick,
|
|
117
103
|
label: t.step.nextButtonProps.label,
|
|
118
|
-
isStepLoading:
|
|
104
|
+
isStepLoading: P,
|
|
119
105
|
isLastStep: t.isLast
|
|
120
106
|
}
|
|
121
|
-
)
|
|
107
|
+
) : null
|
|
122
108
|
]
|
|
123
109
|
}
|
|
124
110
|
) : null
|
|
125
111
|
]
|
|
126
112
|
}
|
|
127
|
-
)
|
|
113
|
+
) : (console.error(
|
|
114
|
+
`No active step found for currentStepId ${s}. Please check your configuration.`
|
|
115
|
+
), null);
|
|
128
116
|
};
|
|
129
117
|
export {
|
|
130
|
-
|
|
118
|
+
G as Stepper
|
|
131
119
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { a as p, s as t, f as
|
|
3
|
-
import { a as
|
|
2
|
+
import { a as p, s as t, f as y, c as C } from "../../react.esm-Bm0cAgpZ.js";
|
|
3
|
+
import { a as S } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
4
|
import { Stepper as s } from "./Stepper.js";
|
|
5
5
|
import { StepperStyle as i } from "./stepperStyles.js";
|
|
6
|
-
import { d as B, b as
|
|
7
|
-
const
|
|
6
|
+
import { d as B, b as T, t as c, g as e, v as l } from "../../vi.bdSIJ99Y-B308Q-4w.js";
|
|
7
|
+
const u = () => [
|
|
8
8
|
{
|
|
9
9
|
id: "step1",
|
|
10
10
|
stepNumber: 1,
|
|
11
11
|
text: "Description 1",
|
|
12
12
|
secondaryText: "Secondary Description 1",
|
|
13
13
|
optional: !1,
|
|
14
|
-
nextButtonProps: { onClick:
|
|
15
|
-
prevButtonProps: { onClick:
|
|
14
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
15
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
id: "step2",
|
|
@@ -20,8 +20,8 @@ const m = () => [
|
|
|
20
20
|
text: "Description 2",
|
|
21
21
|
secondaryText: "Secondary Description 2",
|
|
22
22
|
optional: !1,
|
|
23
|
-
nextButtonProps: { onClick:
|
|
24
|
-
prevButtonProps: { onClick:
|
|
23
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
24
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: "step3",
|
|
@@ -29,14 +29,14 @@ const m = () => [
|
|
|
29
29
|
text: "Description 3",
|
|
30
30
|
secondaryText: "Secondary Description 3",
|
|
31
31
|
optional: !0,
|
|
32
|
-
nextButtonProps: { onClick:
|
|
33
|
-
prevButtonProps: { onClick:
|
|
32
|
+
nextButtonProps: { onClick: l.fn(), label: "Finish" },
|
|
33
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
34
34
|
}
|
|
35
35
|
];
|
|
36
36
|
B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
37
37
|
let o;
|
|
38
|
-
|
|
39
|
-
o =
|
|
38
|
+
T(() => {
|
|
39
|
+
o = u();
|
|
40
40
|
}), c("Default Render", () => {
|
|
41
41
|
p(
|
|
42
42
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -66,15 +66,15 @@ B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
|
66
66
|
const r = t.getByText("Next").closest("button");
|
|
67
67
|
e(r).toBeDisabled();
|
|
68
68
|
}), c("calls nextButtonProps.onClick when next button is clicked", () => {
|
|
69
|
-
const r =
|
|
69
|
+
const r = l.fn();
|
|
70
70
|
o[1].nextButtonProps.onClick = r, p(
|
|
71
71
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
72
|
-
),
|
|
72
|
+
), y.click(t.getByText("Next")), e(r).toHaveBeenCalled();
|
|
73
73
|
}), c("calls prevButtonProps.onClick when prev button is clicked", () => {
|
|
74
|
-
const r =
|
|
74
|
+
const r = l.fn();
|
|
75
75
|
o[1].prevButtonProps.onClick = r, p(
|
|
76
76
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
77
|
-
),
|
|
77
|
+
), y.click(t.getByText("Back")), e(r).toHaveBeenCalled();
|
|
78
78
|
}), c("does not render the prev button on the first step", () => {
|
|
79
79
|
p(
|
|
80
80
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -116,31 +116,29 @@ B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
|
|
|
116
116
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
117
117
|
), e(t.queryByText("arrow_forward")).not.toBeInTheDocument(), e(t.queryByText("arrow_back")).not.toBeInTheDocument();
|
|
118
118
|
}), c("prints an error when current step is not found", () => {
|
|
119
|
-
const r =
|
|
119
|
+
const r = l.spyOn(console, "error").mockImplementation(() => {
|
|
120
120
|
});
|
|
121
121
|
p(
|
|
122
122
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "unknownId", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
123
123
|
), e(r).toHaveBeenCalledWith(
|
|
124
124
|
"Current step with id unknownId not found in steps array. Bad configuration?"
|
|
125
125
|
), r.mockRestore(), e(t.queryByTestId("description-stepper-header")).not.toBeInTheDocument();
|
|
126
|
-
}), c("
|
|
127
|
-
const r =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ n(s, { steps:
|
|
135
|
-
), e(
|
|
136
|
-
"Previous button props not found for current step with id step2. If you want to use the stepper buttons, make sure to provide prevButtonProps for each applicable step."
|
|
137
|
-
), r.mockRestore();
|
|
126
|
+
}), c("does not render buttons when props are not provided", () => {
|
|
127
|
+
const r = u();
|
|
128
|
+
r[0].nextButtonProps = void 0, r[0].prevButtonProps = void 0, p(
|
|
129
|
+
/* @__PURE__ */ n(s, { steps: r, currentStepId: "step1", showPreviousButtonOnFirstStep: !0, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
130
|
+
), e(t.queryByText("Next")).not.toBeInTheDocument(), e(t.queryByText("Back")).not.toBeInTheDocument();
|
|
131
|
+
}), c("renders only one button if the other is missing", () => {
|
|
132
|
+
const r = u();
|
|
133
|
+
r[1].prevButtonProps = void 0, p(
|
|
134
|
+
/* @__PURE__ */ n(s, { steps: r, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
135
|
+
), e(t.getByText("Next")).toBeInTheDocument(), e(t.queryByText("Back")).not.toBeInTheDocument();
|
|
138
136
|
});
|
|
139
137
|
});
|
|
140
138
|
B("Stepper Type DESKTOP Tests", () => {
|
|
141
139
|
let o;
|
|
142
|
-
|
|
143
|
-
o =
|
|
140
|
+
T(() => {
|
|
141
|
+
o = u();
|
|
144
142
|
}), c("renders numbers, text and secondary text", () => {
|
|
145
143
|
p(
|
|
146
144
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -203,23 +201,23 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
203
201
|
);
|
|
204
202
|
const r = t.getByTestId("stepper-item-circle-for-step1"), d = t.getByTestId(
|
|
205
203
|
"stepper-connector-before-step2"
|
|
206
|
-
),
|
|
207
|
-
e(r.className).toContain("stepperItemNumberActive"), e(d.className).toContain("stepperItemConnectorCompleted"), e(
|
|
204
|
+
), a = t.getByTestId("stepper-item-circle-for-step2"), m = t.getByTestId("stepper-connector-before-step3"), I = t.getByTestId("stepper-item-circle-for-step3");
|
|
205
|
+
e(r.className).toContain("stepperItemNumberActive"), e(d.className).toContain("stepperItemConnectorCompleted"), e(a.className).toContain("stepperItemNumberActive"), e(m.className).not.toContain("stepperItemConnectorCompleted"), e(I.className).not.toContain("stepperItemNumberActive");
|
|
208
206
|
}), c("advancing step changes number to checkmark and adjusts color", () => {
|
|
209
207
|
const { rerender: r } = p(
|
|
210
208
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
211
|
-
), d = t.getByTestId("stepper-item-circle-for-step1"),
|
|
212
|
-
e(d.className).toContain("stepperItemNumberActive"), e(
|
|
209
|
+
), d = t.getByTestId("stepper-item-circle-for-step1"), a = t.getByTestId("stepper-connector-before-step2"), m = t.getByTestId("stepper-item-circle-for-step2"), I = t.getByTestId("stepper-connector-before-step3"), h = t.getByTestId("stepper-item-circle-for-step3");
|
|
210
|
+
e(d.className).toContain("stepperItemNumberActive"), e(a.className).not.toContain("stepperItemConnectorCompleted"), e(m.className).not.toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(h.className).not.toContain("stepperItemNumberActive"), r(
|
|
213
211
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
214
|
-
), e(d.className).toContain("stepperItemNumberActive"), e(
|
|
212
|
+
), e(d.className).toContain("stepperItemNumberActive"), e(a.className).toContain("stepperItemConnectorCompleted"), e(m.className).toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(h.className).not.toContain("stepperItemNumberActive"), r(
|
|
215
213
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
216
|
-
), e(d.className).toContain("stepperItemNumberActive"), e(
|
|
214
|
+
), e(d.className).toContain("stepperItemNumberActive"), e(a.className).toContain("stepperItemConnectorCompleted"), e(m.className).toContain("stepperItemNumberActive"), e(I.className).toContain("stepperItemConnectorCompleted"), e(h.className).toContain("stepperItemNumberActive");
|
|
217
215
|
}), c("custom button icons are shown as expected", () => {
|
|
218
216
|
o[1].nextButtonProps.showArrowIcon = !1, o[1].nextButtonProps.trailingIcon = "flag", o[1].prevButtonProps.showArrowIcon = !1, o[1].prevButtonProps.leadingIcon = "wifi", p(
|
|
219
217
|
/* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
220
218
|
), e(t.getByText("flag")).toBeInTheDocument(), e(t.getByText("wifi")).toBeInTheDocument();
|
|
221
219
|
}), c("handles excludeFromHeader and excludedStepCompletesPreviousStep correctly", () => {
|
|
222
|
-
const r =
|
|
220
|
+
const r = u();
|
|
223
221
|
r.push({
|
|
224
222
|
id: "step4",
|
|
225
223
|
stepNumber: 4,
|
|
@@ -227,8 +225,8 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
227
225
|
excludeFromHeader: !0,
|
|
228
226
|
excludedStepCompletesPreviousStep: !1,
|
|
229
227
|
secondaryText: "Secondary Description 4",
|
|
230
|
-
nextButtonProps: { onClick:
|
|
231
|
-
prevButtonProps: { onClick:
|
|
228
|
+
nextButtonProps: { onClick: l.fn(), label: "Next" },
|
|
229
|
+
prevButtonProps: { onClick: l.fn(), label: "Back" }
|
|
232
230
|
}), r[1].excludedStepCompletesPreviousStep = !0, r[1].excludeFromHeader = !0, p(
|
|
233
231
|
/* @__PURE__ */ n(
|
|
234
232
|
s,
|
|
@@ -252,25 +250,25 @@ B("Stepper Type DESKTOP Tests", () => {
|
|
|
252
250
|
}
|
|
253
251
|
)
|
|
254
252
|
);
|
|
255
|
-
const
|
|
256
|
-
e(
|
|
253
|
+
const a = t.getByTestId("stepper-connector-before-step3");
|
|
254
|
+
e(a.className).toContain("stepperItemConnectorCompleted"), e(
|
|
257
255
|
t.queryByTestId("stepper-item-check-for-step3")
|
|
258
256
|
).not.toBeInTheDocument();
|
|
259
257
|
}), c("shows mobile view breakpoint is triggered (<600px)", () => {
|
|
260
|
-
|
|
258
|
+
l.spyOn(S, "useBreakpoints").mockReturnValue({
|
|
261
259
|
isMobile: !0,
|
|
262
260
|
isDesktop: !1,
|
|
263
261
|
isDesktopNavbar: !1,
|
|
264
262
|
isTablet: !1
|
|
265
263
|
}), p(
|
|
266
264
|
/* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
267
|
-
), e(t.getByTestId("desktop-stepper-header")).toBeInTheDocument(), e(t.getByTestId("stepper-item-step2")).toBeInTheDocument(), e(t.queryByTestId("stepper-item-step1")).not.toBeInTheDocument(), e(t.queryByTestId("stepper-item-step3")).not.toBeInTheDocument(),
|
|
265
|
+
), e(t.getByTestId("desktop-stepper-header")).toBeInTheDocument(), e(t.getByTestId("stepper-item-step2")).toBeInTheDocument(), e(t.queryByTestId("stepper-item-step1")).not.toBeInTheDocument(), e(t.queryByTestId("stepper-item-step3")).not.toBeInTheDocument(), l.spyOn(S, "useBreakpoints").mockRestore();
|
|
268
266
|
});
|
|
269
267
|
});
|
|
270
268
|
B("Stepper Type DOTS Tests", () => {
|
|
271
269
|
let o;
|
|
272
|
-
|
|
273
|
-
o =
|
|
270
|
+
T(() => {
|
|
271
|
+
o = u();
|
|
274
272
|
}), c("renders dots and text", () => {
|
|
275
273
|
p(
|
|
276
274
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -288,8 +286,8 @@ B("Stepper Type DOTS Tests", () => {
|
|
|
288
286
|
p(
|
|
289
287
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
290
288
|
);
|
|
291
|
-
const r = t.getByTestId("stepper-indicator-step1"), d = t.getByTestId("stepper-indicator-step2"),
|
|
292
|
-
e(r.className).toContain("stepperIndicatorItemActive"), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
289
|
+
const r = t.getByTestId("stepper-indicator-step1"), d = t.getByTestId("stepper-indicator-step2"), a = t.getByTestId("stepper-indicator-step3");
|
|
290
|
+
e(r.className).toContain("stepperIndicatorItemActive"), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).not.toContain("stepperIndicatorItemActive");
|
|
293
291
|
}), c("show optional style", () => {
|
|
294
292
|
p(
|
|
295
293
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -299,18 +297,18 @@ B("Stepper Type DOTS Tests", () => {
|
|
|
299
297
|
}), c("advancing step adjusts styles accordingly", () => {
|
|
300
298
|
const { rerender: r } = p(
|
|
301
299
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
302
|
-
), d = t.getByTestId("stepper-indicator-step1"),
|
|
303
|
-
e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
300
|
+
), d = t.getByTestId("stepper-indicator-step1"), a = t.getByTestId("stepper-indicator-step2"), m = t.getByTestId("stepper-indicator-step3");
|
|
301
|
+
e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).not.toContain("stepperIndicatorItemActive"), e(m.className).not.toContain("stepperIndicatorItemActive"), r(
|
|
304
302
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
305
|
-
), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
303
|
+
), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).toContain("stepperIndicatorItemActive"), e(m.className).not.toContain("stepperIndicatorItemActive"), r(
|
|
306
304
|
/* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
307
|
-
), e(d.className).toContain("stepperIndicatorItemActive"), e(
|
|
305
|
+
), e(d.className).toContain("stepperIndicatorItemActive"), e(a.className).toContain("stepperIndicatorItemActive"), e(m.className).toContain("stepperIndicatorItemActive");
|
|
308
306
|
});
|
|
309
307
|
});
|
|
310
308
|
B("Stepper Type SMALL Tests", () => {
|
|
311
309
|
let o;
|
|
312
|
-
|
|
313
|
-
o =
|
|
310
|
+
T(() => {
|
|
311
|
+
o = u();
|
|
314
312
|
}), c("renders step number, total steps and text", () => {
|
|
315
313
|
p(
|
|
316
314
|
/* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
|
|
@@ -3,6 +3,7 @@ import { StepperButtonProps } from '../stepperTypes';
|
|
|
3
3
|
/**
|
|
4
4
|
* A button component for the stepper that is used to go to the previous step.
|
|
5
5
|
* @param label - The label of the button.
|
|
6
|
+
* @param variant - The element variant of the button. Defaults to 'outlined'.
|
|
6
7
|
* @param onClick - The function to be called when the button is clicked.
|
|
7
8
|
* @param disabled - Whether the button is disabled or not.
|
|
8
9
|
* @param className - Additional class names to apply to the button.
|
|
@@ -13,10 +14,11 @@ import { StepperButtonProps } from '../stepperTypes';
|
|
|
13
14
|
* @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
|
-
export declare const StepperPreviousButton: ({ label, onClick, disabled, className, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const StepperPreviousButton: ({ label, variant, onClick, disabled, className, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
/**
|
|
18
19
|
* A button component for the stepper that is used to go to the next step.
|
|
19
20
|
* @param label - The label of the button.
|
|
21
|
+
* @param variant - The element variant of the button. Defaults to the element standard variant.
|
|
20
22
|
* @param onClick - The function to be called when the button is clicked.
|
|
21
23
|
* @param disabled - Whether the button is disabled or not.
|
|
22
24
|
* @param className - Additional class names to apply to the button.
|
|
@@ -29,7 +31,7 @@ export declare const StepperPreviousButton: ({ label, onClick, disabled, classNa
|
|
|
29
31
|
* @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
|
|
30
32
|
* @returns
|
|
31
33
|
*/
|
|
32
|
-
export declare const StepperNextButton: ({ label, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps & {
|
|
34
|
+
export declare const StepperNextButton: ({ label, variant, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps & {
|
|
33
35
|
isStepLoading?: boolean;
|
|
34
36
|
isLastStep?: boolean;
|
|
35
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,74 +1,77 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { B as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { s as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { B as v } from "../../../index.es-B8p8KCdj.js";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import { s as i } from "../../../stepper.module-DR_FbENS.js";
|
|
5
|
+
const N = ({
|
|
6
6
|
label: p,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
variant: s = "outlined",
|
|
8
|
+
onClick: m,
|
|
9
|
+
disabled: n,
|
|
10
|
+
className: d,
|
|
10
11
|
showArrowIcon: t = !0,
|
|
11
12
|
leadingIcon: e,
|
|
12
13
|
trailingIcon: r,
|
|
13
14
|
buttonSize: u = "themeDefault",
|
|
14
15
|
fullWidth: o = !0
|
|
15
16
|
}) => {
|
|
16
|
-
const
|
|
17
|
+
const f = b(() => {
|
|
17
18
|
if (e) return e;
|
|
18
19
|
if (!r)
|
|
19
20
|
return t ? "arrow_back" : void 0;
|
|
20
21
|
}, [e, r, t]);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
v,
|
|
23
24
|
{
|
|
24
25
|
"data-testid": "stepper-previous-button",
|
|
25
|
-
className: `${
|
|
26
|
-
onClick:
|
|
27
|
-
disabled:
|
|
26
|
+
className: `${i.stepperButton} ${d ?? ""}`,
|
|
27
|
+
onClick: m,
|
|
28
|
+
disabled: n,
|
|
28
29
|
fullWidth: o,
|
|
29
30
|
buttonSize: u,
|
|
30
|
-
variant:
|
|
31
|
-
leadingIcon:
|
|
31
|
+
variant: s,
|
|
32
|
+
leadingIcon: f,
|
|
32
33
|
trailingIcon: r,
|
|
33
34
|
type: "button",
|
|
34
35
|
children: p
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
|
-
},
|
|
38
|
+
}, h = ({
|
|
38
39
|
label: p,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
variant: s,
|
|
41
|
+
onClick: m,
|
|
42
|
+
disabled: n,
|
|
43
|
+
className: d,
|
|
42
44
|
isStepLoading: t,
|
|
43
45
|
isLastStep: e,
|
|
44
46
|
showArrowIcon: r = !0,
|
|
45
47
|
leadingIcon: u,
|
|
46
48
|
trailingIcon: o,
|
|
47
|
-
buttonSize:
|
|
48
|
-
fullWidth:
|
|
49
|
+
buttonSize: f = "themeDefault",
|
|
50
|
+
fullWidth: B = !0
|
|
49
51
|
}) => {
|
|
50
|
-
const
|
|
52
|
+
const c = b(() => {
|
|
51
53
|
if (o) return o;
|
|
52
54
|
if (!u && !t && !e)
|
|
53
55
|
return r ? "arrow_forward" : void 0;
|
|
54
56
|
}, [e, t, r, u, o]);
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
57
|
+
return /* @__PURE__ */ a(
|
|
58
|
+
v,
|
|
57
59
|
{
|
|
58
60
|
"data-testid": "stepper-next-button",
|
|
59
|
-
className: `${
|
|
60
|
-
onClick:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
className: `${i.stepperButton} ${t ? i.stepperButtonLoading : ""} ${d ?? ""}`,
|
|
62
|
+
onClick: m,
|
|
63
|
+
variant: s,
|
|
64
|
+
disabled: t || n,
|
|
65
|
+
fullWidth: B,
|
|
66
|
+
trailingIcon: c,
|
|
64
67
|
leadingIcon: u,
|
|
65
68
|
type: e ? "submit" : "button",
|
|
66
|
-
buttonSize:
|
|
69
|
+
buttonSize: f,
|
|
67
70
|
children: p
|
|
68
71
|
}
|
|
69
72
|
);
|
|
70
73
|
};
|
|
71
74
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
h as StepperNextButton,
|
|
76
|
+
N as StepperPreviousButton
|
|
74
77
|
};
|
|
@@ -47,23 +47,21 @@ export type Step = {
|
|
|
47
47
|
optional?: boolean;
|
|
48
48
|
/**
|
|
49
49
|
* The props for the next button, including onClick, label, className and disabled state.
|
|
50
|
-
* Will print a console error if the button is embedded but no props are provided and return null for the entire stepper.
|
|
51
50
|
*
|
|
52
51
|
* See {@link StepperButtonProps} for details.
|
|
53
52
|
*/
|
|
54
|
-
nextButtonProps
|
|
53
|
+
nextButtonProps?: StepperButtonProps;
|
|
55
54
|
/**
|
|
56
55
|
* The props for the previous button, including onClick, label, className and disabled state.
|
|
57
|
-
* Will print a console error if the button is embedded but no props are provided and return null for the entire stepper.
|
|
58
56
|
*
|
|
59
57
|
* See {@link StepperButtonProps} for details.
|
|
60
58
|
*/
|
|
61
|
-
prevButtonProps
|
|
59
|
+
prevButtonProps?: StepperButtonProps;
|
|
62
60
|
};
|
|
63
61
|
/**
|
|
64
62
|
* Defines the props for the stepper buttons, including onClick, label, className and disabled state.
|
|
65
63
|
*/
|
|
66
|
-
export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'fullWidth'> & {
|
|
64
|
+
export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'fullWidth' | 'variant'> & {
|
|
67
65
|
/**
|
|
68
66
|
* The function to be called when the button is clicked.
|
|
69
67
|
*/
|
|
@@ -140,9 +138,8 @@ export type StepperProps = {
|
|
|
140
138
|
showStepperButtons?: boolean;
|
|
141
139
|
/**
|
|
142
140
|
* The alignment of the stepper button group.
|
|
143
|
-
* @default 'center'
|
|
144
141
|
*/
|
|
145
|
-
stepperButtonAlignment?: Extract<CSSProperties['justifyContent'], 'center' | 'space-between'>;
|
|
142
|
+
stepperButtonAlignment?: Extract<CSSProperties['justifyContent'], 'start' | 'end' | 'center' | 'space-between'>;
|
|
146
143
|
/**
|
|
147
144
|
* A flag which indicates if the previous button should be shown on the first step.
|
|
148
145
|
* This can be useful for canceling the stepper.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.17.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|