@hortiview/shared-components 2.16.2 → 2.18.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 +20 -0
- package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +2 -2
- package/dist/components/FormComponents/FormSelect/FormSelect.js +72 -71
- package/dist/components/FormComponents/FormSelect/FormSelect.test.js +127 -55
- 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,23 @@
|
|
|
1
|
+
## [2.18.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.17.0...v2.18.0) (2026-03-05)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* adjust searchable default logic ([0e66c32](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/0e66c32a89b72fad851aad24b2a24bc152844520))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* fixed publish.yaml to use devops service user ([ec046ce](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/ec046ce290294d3857a6fedf4594a0e688bfd9f0))
|
|
10
|
+
|
|
11
|
+
### Code Refactoring
|
|
12
|
+
|
|
13
|
+
* replace isDesktopNavbar with isDesktop and update tests ([6bc6f7e](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/6bc6f7e47a963b95f367200938d79d25c83ba231))
|
|
14
|
+
|
|
15
|
+
## [2.17.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.16.2...v2.17.0) (2026-02-27)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* 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)
|
|
20
|
+
|
|
1
21
|
## [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
22
|
|
|
3
23
|
### Bug Fixes
|
|
@@ -26,7 +26,7 @@ export type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'classNam
|
|
|
26
26
|
multi?: boolean;
|
|
27
27
|
/** if true, the select allows the user to clear the selection */
|
|
28
28
|
clearable?: boolean;
|
|
29
|
-
/** if true, the select allows the user to search for options */
|
|
29
|
+
/** if true, the select allows the user to search for options defaults to enabled on desktop and disabled on mobile unless explicitly overridden */
|
|
30
30
|
searchable?: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* the rules for the picker
|
|
@@ -47,7 +47,7 @@ export type FormSelectOption = {
|
|
|
47
47
|
* creates a Select which should be part of a form component.
|
|
48
48
|
* the Select is wrapped by the react hook forms {@link Controller} component.
|
|
49
49
|
* @param clearable if the select allows the user to clear the selection
|
|
50
|
-
* @param searchable
|
|
50
|
+
* @param searchable whether the select allows the user to search for options. If not provided, search is enabled on desktop and disabled on mobile by default.
|
|
51
51
|
* @param disabled if the select is disabled
|
|
52
52
|
* @param hidden if the select should be hidden
|
|
53
53
|
* @param hoisted if the select should be rendered outside of the parent
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, Fragment as g, jsxs as J } from "react/jsx-runtime";
|
|
2
2
|
import { g as u } from "../../../get-D8IXqiys.js";
|
|
3
|
-
import { i as
|
|
3
|
+
import { i as L } from "../../../isArray-BjSPDQ4v.js";
|
|
4
4
|
import { useMemo as z } from "react";
|
|
5
|
-
import { useFormContext as
|
|
6
|
-
import { M as
|
|
7
|
-
import { useHelperText as
|
|
8
|
-
import { Select as
|
|
9
|
-
import { SelectTooltipText as
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
import { useFormContext as O, Controller as C } from "react-hook-form";
|
|
6
|
+
import { M as Q } from "../../../react-tooltip.min-CVsI--2Y.js";
|
|
7
|
+
import { useHelperText as R } from "../../../hooks/useHelperText.js";
|
|
8
|
+
import { Select as U } from "../../Select/Select.js";
|
|
9
|
+
import { SelectTooltipText as W } from "./SelectTooltipText.js";
|
|
10
|
+
import { u as X } from "../../../useBreakpoints-MzTZ0tCT.js";
|
|
11
|
+
import '../../../assets/FormSelect.css';const Y = "_invalidHelperText_zh2wu_1", Z = "_invalidBorder_zh2wu_5", N = "_invalidPlaceholder_zh2wu_9", y = "_invalidDropdownIcon_zh2wu_13", K = "_formSelectContainer_zh2wu_18", ee = "_formSelect_zh2wu_18", te = "_multiText_zh2wu_53", ie = "_tooltip_zh2wu_62", oe = "_disabled_zh2wu_67", t = {
|
|
12
|
+
invalidHelperText: Y,
|
|
13
|
+
invalidBorder: Z,
|
|
14
|
+
invalidPlaceholder: N,
|
|
15
|
+
invalidDropdownIcon: y,
|
|
16
|
+
formSelectContainer: K,
|
|
17
|
+
formSelect: ee,
|
|
18
|
+
multiText: te,
|
|
19
|
+
tooltip: ie,
|
|
20
|
+
disabled: oe
|
|
21
|
+
}, _e = ({
|
|
21
22
|
propertyName: i,
|
|
22
|
-
label:
|
|
23
|
+
label: c,
|
|
23
24
|
options: r,
|
|
24
25
|
multi: a = !1,
|
|
25
26
|
disabled: _ = !1,
|
|
@@ -28,100 +29,100 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_zh2wu_1",
|
|
|
28
29
|
valueKey: n = "value",
|
|
29
30
|
textKey: x = "text",
|
|
30
31
|
clearable: I = !1,
|
|
31
|
-
searchable: D
|
|
32
|
-
noOptionsMessage:
|
|
33
|
-
rules:
|
|
34
|
-
menuPosition:
|
|
35
|
-
...
|
|
32
|
+
searchable: D,
|
|
33
|
+
noOptionsMessage: S = "",
|
|
34
|
+
rules: m,
|
|
35
|
+
menuPosition: b = "auto",
|
|
36
|
+
...o
|
|
36
37
|
}) => {
|
|
37
|
-
const {
|
|
38
|
-
control:
|
|
39
|
-
getFieldState:
|
|
40
|
-
formState: { errors:
|
|
41
|
-
} =
|
|
42
|
-
() => !w && u(
|
|
43
|
-
[
|
|
44
|
-
),
|
|
45
|
-
() =>
|
|
46
|
-
[
|
|
47
|
-
), { helperText:
|
|
38
|
+
const { isDesktop: B } = X(), {
|
|
39
|
+
control: T,
|
|
40
|
+
getFieldState: P,
|
|
41
|
+
formState: { errors: v, isValidating: w }
|
|
42
|
+
} = O(), F = z(
|
|
43
|
+
() => !w && u(v, i) !== void 0,
|
|
44
|
+
[v, i, w]
|
|
45
|
+
), M = z(
|
|
46
|
+
() => m?.required?.message,
|
|
47
|
+
[m]
|
|
48
|
+
), { helperText: j, helperTextPersistent: k } = R({
|
|
48
49
|
propertyName: i,
|
|
49
|
-
helperText:
|
|
50
|
-
requiredText:
|
|
50
|
+
helperText: o.helperText,
|
|
51
|
+
requiredText: M,
|
|
51
52
|
hasCharacterCount: !1
|
|
52
53
|
});
|
|
53
|
-
return H ? /* @__PURE__ */
|
|
54
|
+
return H ? /* @__PURE__ */ l(C, { name: i, control: T, render: () => /* @__PURE__ */ l(g, {}) }) : /* @__PURE__ */ l(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
56
57
|
"data-testid": "form-select-container",
|
|
57
58
|
className: t.formSelectContainer,
|
|
58
|
-
"data-tooltip-id":
|
|
59
|
-
children: /* @__PURE__ */
|
|
59
|
+
"data-tooltip-id": c,
|
|
60
|
+
children: /* @__PURE__ */ l(
|
|
60
61
|
C,
|
|
61
62
|
{
|
|
62
63
|
name: i,
|
|
63
|
-
rules:
|
|
64
|
-
control:
|
|
65
|
-
render: ({ field: { ref:
|
|
64
|
+
rules: m,
|
|
65
|
+
control: T,
|
|
66
|
+
render: ({ field: { ref: le, onChange: f, value: p, ...q } }) => {
|
|
66
67
|
let h = r;
|
|
67
|
-
|
|
68
|
+
L(r) && u(r[0], "options") !== void 0 && (h = r.flatMap((e) => u(e, "options") ?? []));
|
|
68
69
|
const d = a ? h?.filter(
|
|
69
70
|
(e) => p?.includes(e[n])
|
|
70
|
-
) : h?.find((e) => e[n] === p), A = a &&
|
|
71
|
+
) : h?.find((e) => e[n] === p), A = a && o.multiDisplayType === "text" && o.fixedHeightInput, s = P(i).invalid, E = D ?? B, V = `
|
|
71
72
|
${t.formSelect}
|
|
72
|
-
${
|
|
73
|
-
${
|
|
74
|
-
${
|
|
75
|
-
${
|
|
73
|
+
${s ? t.invalidHelperText : ""}
|
|
74
|
+
${s ? t.invalidDropdownIcon : ""}
|
|
75
|
+
${s ? t.invalidBorder : ""}
|
|
76
|
+
${s ? t.invalidPlaceholder : ""}
|
|
76
77
|
${A ? t.multiText : ""}
|
|
77
78
|
${_ ? t.disabled : ""}`;
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
79
|
+
return /* @__PURE__ */ J(g, { children: [
|
|
80
|
+
/* @__PURE__ */ l(
|
|
81
|
+
U,
|
|
81
82
|
{
|
|
82
83
|
...q,
|
|
83
|
-
...
|
|
84
|
+
...o,
|
|
84
85
|
value: d ?? [],
|
|
85
|
-
label:
|
|
86
|
+
label: c,
|
|
86
87
|
variant: "outlined",
|
|
87
|
-
helperText:
|
|
88
|
-
helperTextPersistent:
|
|
88
|
+
helperText: j,
|
|
89
|
+
helperTextPersistent: k,
|
|
89
90
|
options: r,
|
|
90
91
|
valid: !F,
|
|
91
|
-
"data-testid":
|
|
92
|
-
multiSelect: !r?.length &&
|
|
93
|
-
className:
|
|
92
|
+
"data-testid": o["data-testid"] ?? `select-${i}`,
|
|
93
|
+
multiSelect: !r?.length && S ? !1 : a,
|
|
94
|
+
className: V,
|
|
94
95
|
disabled: _,
|
|
95
96
|
valueKey: n,
|
|
96
97
|
textKey: x,
|
|
97
98
|
onChange: (e) => {
|
|
98
99
|
if (e == null) {
|
|
99
|
-
|
|
100
|
+
f(e);
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
if (a) {
|
|
103
|
-
|
|
104
|
+
f(e.map((G) => G[n]));
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
f(e[n]), o?.onChange?.(e);
|
|
107
108
|
},
|
|
108
109
|
hoisted: $,
|
|
109
|
-
noOptionsMessage:
|
|
110
|
-
searchable:
|
|
110
|
+
noOptionsMessage: S,
|
|
111
|
+
searchable: E,
|
|
111
112
|
clearable: I,
|
|
112
|
-
menuPosition:
|
|
113
|
+
menuPosition: b
|
|
113
114
|
}
|
|
114
115
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
116
|
+
/* @__PURE__ */ l(
|
|
117
|
+
Q,
|
|
117
118
|
{
|
|
118
|
-
id:
|
|
119
|
+
id: c,
|
|
119
120
|
noArrow: !0,
|
|
120
121
|
place: "bottom",
|
|
121
122
|
delayShow: 420,
|
|
122
123
|
className: t.tooltip,
|
|
123
|
-
hidden: !d || d.length === 0 || !
|
|
124
|
-
children: /* @__PURE__ */
|
|
124
|
+
hidden: !d || d.length === 0 || !o.fixedHeightInput,
|
|
125
|
+
children: /* @__PURE__ */ l(W, { value: d, textKey: x, valueKey: n })
|
|
125
126
|
}
|
|
126
127
|
)
|
|
127
128
|
] });
|
|
@@ -132,5 +133,5 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_zh2wu_1",
|
|
|
132
133
|
);
|
|
133
134
|
};
|
|
134
135
|
export {
|
|
135
|
-
|
|
136
|
+
_e as FormSelect
|
|
136
137
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { a, s as t, f as
|
|
3
|
-
import { u as
|
|
4
|
-
import { FormSelect as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { a as s, s as t, f as B, w as f } from "../../../react.esm-Bm0cAgpZ.js";
|
|
3
|
+
import { u as y } from "../../../index-BLPBqbdx.js";
|
|
4
|
+
import { FormSelect as c } from "./FormSelect.js";
|
|
5
5
|
import { SelectTooltipText as d } from "./SelectTooltipText.js";
|
|
6
|
-
import { a as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { a as m } from "../../../useBreakpoints-MzTZ0tCT.js";
|
|
7
|
+
import { a as r, b as h, d as v, t as u, g as e } from "../../../vi.bdSIJ99Y-B308Q-4w.js";
|
|
8
|
+
const g = r.fn();
|
|
9
|
+
r.mock("react-hook-form", () => ({
|
|
10
|
+
...r.importActual("react-hook-form"),
|
|
10
11
|
Controller: ({
|
|
11
|
-
render:
|
|
12
|
-
}) =>
|
|
12
|
+
render: l
|
|
13
|
+
}) => l({
|
|
13
14
|
field: {
|
|
14
15
|
ref: void 0,
|
|
15
16
|
onChange: g,
|
|
@@ -18,9 +19,9 @@ n.mock("react-hook-form", () => ({
|
|
|
18
19
|
}),
|
|
19
20
|
useFormContext: () => ({
|
|
20
21
|
control: {
|
|
21
|
-
register:
|
|
22
|
-
unregister:
|
|
23
|
-
getFieldState:
|
|
22
|
+
register: r.fn(),
|
|
23
|
+
unregister: r.fn(),
|
|
24
|
+
getFieldState: r.fn(),
|
|
24
25
|
_names: {
|
|
25
26
|
array: new Set("test"),
|
|
26
27
|
mount: new Set("test"),
|
|
@@ -30,11 +31,11 @@ n.mock("react-hook-form", () => ({
|
|
|
30
31
|
watchAll: !1
|
|
31
32
|
},
|
|
32
33
|
_subjects: {
|
|
33
|
-
watch:
|
|
34
|
-
array:
|
|
35
|
-
state:
|
|
34
|
+
watch: r.fn(),
|
|
35
|
+
array: r.fn(),
|
|
36
|
+
state: r.fn()
|
|
36
37
|
},
|
|
37
|
-
_getWatch:
|
|
38
|
+
_getWatch: r.fn(),
|
|
38
39
|
_formValues: ["test"],
|
|
39
40
|
_defaultValues: ["test"]
|
|
40
41
|
},
|
|
@@ -42,12 +43,20 @@ n.mock("react-hook-form", () => ({
|
|
|
42
43
|
getFieldState: () => ({ invalid: !1 })
|
|
43
44
|
})
|
|
44
45
|
}));
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
h(() => {
|
|
47
|
+
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
48
|
+
isDesktop: !0,
|
|
49
|
+
isMobile: !1,
|
|
50
|
+
isTablet: !1,
|
|
51
|
+
isDesktopNavbar: !1
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
v("FormSelect Test", () => {
|
|
55
|
+
const l = [
|
|
47
56
|
{ id: "1", value: "Germany", description: "" },
|
|
48
57
|
{ id: "2", value: "France", description: "" },
|
|
49
58
|
{ id: "3", value: "Afar", description: "" }
|
|
50
|
-
],
|
|
59
|
+
], p = [
|
|
51
60
|
{
|
|
52
61
|
groupValue: "Europe",
|
|
53
62
|
groupName: "Europe",
|
|
@@ -63,14 +72,14 @@ f("FormSelect Test", () => {
|
|
|
63
72
|
}
|
|
64
73
|
];
|
|
65
74
|
u("render FormSelect", () => {
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
75
|
+
s(
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
c,
|
|
69
78
|
{
|
|
70
79
|
label: "address.country",
|
|
71
80
|
rules: { required: { value: !0, message: "required" } },
|
|
72
81
|
propertyName: "countryId",
|
|
73
|
-
options:
|
|
82
|
+
options: l,
|
|
74
83
|
valueKey: "id",
|
|
75
84
|
textKey: "value"
|
|
76
85
|
}
|
|
@@ -78,77 +87,140 @@ f("FormSelect Test", () => {
|
|
|
78
87
|
);
|
|
79
88
|
const o = t.getByRole("combobox");
|
|
80
89
|
e(o).toBeInTheDocument(), e(o).toBeInstanceOf(HTMLInputElement), e(t.getByText("address.country")).toBeInTheDocument(), e(t.getByText("Afar")).toBeInTheDocument(), e(t.getByText("required")).toBeInTheDocument();
|
|
90
|
+
}), u("enables search by default when isDesktop is true", () => {
|
|
91
|
+
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
92
|
+
isMobile: !1,
|
|
93
|
+
isTablet: !1,
|
|
94
|
+
isDesktop: !0,
|
|
95
|
+
isDesktopNavbar: !1
|
|
96
|
+
}), s(
|
|
97
|
+
/* @__PURE__ */ a(
|
|
98
|
+
c,
|
|
99
|
+
{
|
|
100
|
+
label: "address.country",
|
|
101
|
+
propertyName: "countryId",
|
|
102
|
+
options: l,
|
|
103
|
+
valueKey: "id",
|
|
104
|
+
textKey: "value"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
const o = t.getByRole("combobox");
|
|
109
|
+
e(o).not.toHaveAttribute("aria-readonly");
|
|
110
|
+
}), u("searchable=false overrides isDesktop=true", async () => {
|
|
111
|
+
const o = y.setup();
|
|
112
|
+
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
113
|
+
isMobile: !1,
|
|
114
|
+
isTablet: !1,
|
|
115
|
+
isDesktop: !0,
|
|
116
|
+
isDesktopNavbar: !1
|
|
117
|
+
}), s(
|
|
118
|
+
/* @__PURE__ */ a(
|
|
119
|
+
c,
|
|
120
|
+
{
|
|
121
|
+
label: "address.country",
|
|
122
|
+
propertyName: "countryId",
|
|
123
|
+
options: l,
|
|
124
|
+
valueKey: "id",
|
|
125
|
+
textKey: "value",
|
|
126
|
+
searchable: !1
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
const n = t.getByRole("combobox");
|
|
131
|
+
e(n).toHaveAttribute("aria-readonly", "true"), await o.click(n), await o.type(n, "Ger"), e(n).toHaveValue("");
|
|
132
|
+
}), u("cannot type when isDesktop=false and searchable is undefined", async () => {
|
|
133
|
+
const o = y.setup();
|
|
134
|
+
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
135
|
+
isMobile: !1,
|
|
136
|
+
isTablet: !1,
|
|
137
|
+
isDesktop: !1,
|
|
138
|
+
isDesktopNavbar: !1
|
|
139
|
+
}), s(
|
|
140
|
+
/* @__PURE__ */ a(
|
|
141
|
+
c,
|
|
142
|
+
{
|
|
143
|
+
label: "address.country",
|
|
144
|
+
propertyName: "countryId",
|
|
145
|
+
options: l,
|
|
146
|
+
valueKey: "id",
|
|
147
|
+
textKey: "value"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
const n = t.getByRole("combobox");
|
|
152
|
+
await o.click(n), await o.type(n, "Ger"), e(n).toHaveValue("");
|
|
81
153
|
}), u("render grouped FormSelect and click on option", () => {
|
|
82
|
-
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
154
|
+
s(
|
|
155
|
+
/* @__PURE__ */ a(
|
|
156
|
+
c,
|
|
85
157
|
{
|
|
86
158
|
label: "address.country",
|
|
87
159
|
rules: { required: { value: !0, message: "required" } },
|
|
88
160
|
propertyName: "countryId",
|
|
89
|
-
options:
|
|
161
|
+
options: p,
|
|
90
162
|
valueKey: "id",
|
|
91
163
|
textKey: "value"
|
|
92
164
|
}
|
|
93
165
|
)
|
|
94
166
|
);
|
|
95
167
|
const o = t.getByRole("combobox");
|
|
96
|
-
e(o).toBeInTheDocument(), e(o).toBeInstanceOf(HTMLInputElement), e(t.getByText("address.country")).toBeInTheDocument(), e(t.getByText("Afar")).toBeInTheDocument(), e(t.getByText("required")).toBeInTheDocument(),
|
|
97
|
-
const
|
|
98
|
-
e(
|
|
99
|
-
const
|
|
100
|
-
e(
|
|
101
|
-
const
|
|
102
|
-
e(
|
|
168
|
+
e(o).toBeInTheDocument(), e(o).toBeInstanceOf(HTMLInputElement), e(t.getByText("address.country")).toBeInTheDocument(), e(t.getByText("Afar")).toBeInTheDocument(), e(t.getByText("required")).toBeInTheDocument(), B.mouseDown(o);
|
|
169
|
+
const n = t.getByText("Africa");
|
|
170
|
+
e(n).toBeInTheDocument(), e(n.parentElement?.parentElement).toBeInstanceOf(HTMLHeadingElement);
|
|
171
|
+
const i = t.getByText("Europe");
|
|
172
|
+
e(i).toBeInTheDocument(), e(i.parentElement?.parentElement).toBeInstanceOf(HTMLHeadingElement);
|
|
173
|
+
const T = t.getByText("France");
|
|
174
|
+
e(T).toBeInTheDocument(), e(T.parentElement?.parentElement).not.toBeInstanceOf(HTMLHeadingElement), e(t.getByText("Germany")).toBeInTheDocument(), e(t.getAllByText("Afar")).toHaveLength(2), B.click(T), e(g).toBeCalledWith("2");
|
|
103
175
|
}), u("render grouped FormSelect and hover to see tooltip on fixedHeightInput", async () => {
|
|
104
|
-
const o =
|
|
105
|
-
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
|
|
176
|
+
const o = y.setup();
|
|
177
|
+
s(
|
|
178
|
+
/* @__PURE__ */ a(
|
|
179
|
+
c,
|
|
108
180
|
{
|
|
109
181
|
label: "address.country",
|
|
110
182
|
rules: { required: { value: !0, message: "required" } },
|
|
111
183
|
propertyName: "countryId",
|
|
112
|
-
options:
|
|
184
|
+
options: p,
|
|
113
185
|
valueKey: "id",
|
|
114
186
|
textKey: "value",
|
|
115
187
|
fixedHeightInput: !0
|
|
116
188
|
}
|
|
117
189
|
)
|
|
118
190
|
);
|
|
119
|
-
const
|
|
120
|
-
e(
|
|
121
|
-
const
|
|
122
|
-
e(
|
|
191
|
+
const n = document.querySelector('div[data-tooltip-id="address.country"]');
|
|
192
|
+
e(n).toBeInTheDocument();
|
|
193
|
+
const i = t.getByRole("combobox");
|
|
194
|
+
e(i).toBeInTheDocument(), e(i).toBeInstanceOf(HTMLInputElement), e(t.getByText("address.country")).toBeInTheDocument(), e(t.getByText("Afar")).toBeInTheDocument(), e(t.getByText("required")).toBeInTheDocument(), o.hover(t.getByText("Afar")), await f(() => {
|
|
123
195
|
e(t.getByRole("tooltip")).toBeInTheDocument();
|
|
124
196
|
});
|
|
125
197
|
}), u("render grouped FormSelect and no tooltip on fixedHeightInput === false", async () => {
|
|
126
|
-
const o =
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
198
|
+
const o = y.setup();
|
|
199
|
+
s(
|
|
200
|
+
/* @__PURE__ */ a(
|
|
201
|
+
c,
|
|
130
202
|
{
|
|
131
203
|
label: "address.country",
|
|
132
204
|
rules: { required: { value: !0, message: "required" } },
|
|
133
205
|
propertyName: "countryId",
|
|
134
|
-
options:
|
|
206
|
+
options: p,
|
|
135
207
|
valueKey: "id",
|
|
136
208
|
textKey: "value",
|
|
137
209
|
fixedHeightInput: !1
|
|
138
210
|
}
|
|
139
211
|
)
|
|
140
212
|
);
|
|
141
|
-
const
|
|
142
|
-
e(
|
|
213
|
+
const n = document.querySelector('div[data-tooltip-id="address.country"]');
|
|
214
|
+
e(n).toBeInTheDocument(), e(t.getByText("Afar")).toBeInTheDocument(), o.hover(t.getByText("Afar")), await f(() => {
|
|
143
215
|
e(t.queryByRole("tooltip")).not.toBeInTheDocument();
|
|
144
216
|
});
|
|
145
217
|
}), u("render ToolTipText", async () => {
|
|
146
|
-
|
|
218
|
+
s(/* @__PURE__ */ a(d, { value: l[0], textKey: "value", valueKey: "id" })), e(t.getByText("Germany")).toBeInTheDocument();
|
|
147
219
|
}), u("render ToolTipText with multiple entries", async () => {
|
|
148
|
-
|
|
220
|
+
s(/* @__PURE__ */ a(d, { value: l, textKey: "value", valueKey: "id" })), e(t.getByText("Afar")).toBeInTheDocument(), e(t.getByText("France")).toBeInTheDocument(), e(t.getByText("Germany")).toBeInTheDocument();
|
|
149
221
|
}), u("render ToolTipText with no entries", async () => {
|
|
150
|
-
|
|
222
|
+
s(/* @__PURE__ */ a(d, { value: [], textKey: "value", valueKey: "id" })), e(t.queryByText("Afar")).not.toBeInTheDocument(), e(t.queryByText("France")).not.toBeInTheDocument(), e(t.queryByText("Germany")).not.toBeInTheDocument();
|
|
151
223
|
}), u("render ToolTipText with no entries", async () => {
|
|
152
|
-
|
|
224
|
+
s(/* @__PURE__ */ a(d, { value: void 0, textKey: "value", valueKey: "id" })), e(t.queryByText("Afar")).not.toBeInTheDocument(), e(t.queryByText("France")).not.toBeInTheDocument(), e(t.queryByText("Germany")).not.toBeInTheDocument();
|
|
153
225
|
});
|
|
154
226
|
});
|
|
@@ -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.18.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>",
|