@hortiview/shared-components 2.15.0 → 2.16.1

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 (54) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/AlertBanner-aW6joVUm.js +35 -0
  3. package/dist/assets/ButtonCard.css +1 -0
  4. package/dist/assets/ConfirmationModal.css +1 -0
  5. package/dist/assets/InfoCard.css +1 -1
  6. package/dist/assets/stepper.css +1 -1
  7. package/dist/components/AlertBanner/AlertBanner.d.ts +5 -1
  8. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  9. package/dist/components/AlertBanner/AlertBanner.test.js +9 -7
  10. package/dist/components/AlertBanner/LinkBanner.js +1 -1
  11. package/dist/components/AlertBanner/LinkBanner.test.js +3 -3
  12. package/dist/components/BaseView/BaseView.test.js +1 -1
  13. package/dist/components/ButtonCard/ButtonCard.d.ts +42 -0
  14. package/dist/components/ButtonCard/ButtonCard.js +51 -0
  15. package/dist/components/ButtonCard/ButtonCard.test.d.ts +1 -0
  16. package/dist/components/ButtonCard/ButtonCard.test.js +92 -0
  17. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +77 -0
  18. package/dist/components/ConfirmationModal/ConfirmationModal.js +90 -0
  19. package/dist/components/ConfirmationModal/ConfirmationModal.test.d.ts +1 -0
  20. package/dist/components/ConfirmationModal/ConfirmationModal.test.js +221 -0
  21. package/dist/components/DeleteModal/DeleteModal.js +6 -6
  22. package/dist/components/Filter/Filter.js +3 -3
  23. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +1 -1
  24. package/dist/components/FormComponents/FormNumber/CustomTextField.js +1 -1
  25. package/dist/components/FormComponents/FormSlider/FormSlider.js +1 -1
  26. package/dist/components/FormComponents/FormText/FormText.js +1 -1
  27. package/dist/components/GenericTable/GenericTable.js +4 -4
  28. package/dist/components/InfoCard/InfoCard.d.ts +6 -2
  29. package/dist/components/InfoCard/InfoCard.js +50 -37
  30. package/dist/components/InfoCard/InfoCard.test.js +40 -18
  31. package/dist/components/ModulePadding/ModulePadding.js +2 -2
  32. package/dist/components/SearchBar/SearchBar.js +1 -1
  33. package/dist/components/Stepper/Stepper.d.ts +19 -14
  34. package/dist/components/Stepper/Stepper.js +94 -39
  35. package/dist/components/Stepper/Stepper.test.js +305 -121
  36. package/dist/components/Stepper/components/StepperButton.js +1 -1
  37. package/dist/components/Stepper/components/StepperHeader.d.ts +2 -11
  38. package/dist/components/Stepper/components/StepperHeader.js +141 -70
  39. package/dist/components/Stepper/components/StepperItem.d.ts +8 -0
  40. package/dist/components/Stepper/components/StepperItem.js +44 -0
  41. package/dist/components/Stepper/stepperStyles.d.ts +5 -0
  42. package/dist/components/Stepper/stepperStyles.js +4 -0
  43. package/dist/components/Stepper/stepperTypes.d.ts +102 -47
  44. package/dist/{index.es-B74L_Dje.js → index.es-BYcQTTL8.js} +3 -3
  45. package/dist/{index.es-C7cC1Hdu.js → index.es-C32E1Lcb.js} +1 -1
  46. package/dist/main.d.ts +3 -1
  47. package/dist/main.js +120 -116
  48. package/dist/services/UtilService.js +2 -2
  49. package/dist/stepper.module-DR_FbENS.js +23 -0
  50. package/package.json +3 -2
  51. package/dist/AlertBanner-Ci-F-6S9.js +0 -26
  52. package/dist/components/Stepper/components/StepperIndicator.d.ts +0 -9
  53. package/dist/components/Stepper/components/StepperIndicator.js +0 -16
  54. package/dist/stepper.module-c-CWmpkt.js +0 -15
@@ -1,23 +1,70 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import { G as o } from "../../index.es-oxil0uFe.js";
3
- import { useMemo as u } from "react";
4
- import { StepperPreviousButton as f, StepperNextButton as g } from "./components/StepperButton.js";
5
- import { StepperHeader as y } from "./components/StepperHeader.js";
6
- import { s as h } from "../../stepper.module-c-CWmpkt.js";
7
- const j = ({
8
- stepperType: n = "default",
9
- steps: e,
10
- currentStep: t,
11
- customTotalSteps: a,
12
- children: l,
13
- isStepLoading: p,
14
- showStepperHeader: s = !0,
15
- stepperButtonAlignment: d = "center",
16
- showPreviousButtonOnFirstStep: m = !1
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import { G as u } from "../../index.es-oxil0uFe.js";
3
+ import { useMemo as v } from "react";
4
+ import { StepperPreviousButton as g, StepperNextButton as A } from "./components/StepperButton.js";
5
+ import { StepperHeader as k } from "./components/StepperHeader.js";
6
+ import { s as S } from "../../stepper.module-DR_FbENS.js";
7
+ import { StepperStyle as D } from "./stepperStyles.js";
8
+ const W = ({
9
+ stepperStyle: h = D.DESKTOP,
10
+ steps: i,
11
+ currentStepId: o,
12
+ overwriteTotalSteps: P,
13
+ isStepLoading: x,
14
+ showStepperHeader: y = !0,
15
+ showStepperButtons: c = !0,
16
+ stepperButtonAlignment: C = "center",
17
+ showPreviousButtonOnFirstStep: d = !1,
18
+ children: B
17
19
  }) => {
18
- const c = u(() => t === e.length - 1, [t, e.length]);
19
- return /* @__PURE__ */ i(
20
- o,
20
+ const p = v(() => {
21
+ const s = i.map((r, e) => (e === 0 && r.excludeFromHeader && console.error(
22
+ "The first step is excluded from the header. Please check your configuration."
23
+ ), {
24
+ step: r,
25
+ isActive: !1,
26
+ isCompleted: !1,
27
+ isRendered: !r.excludeFromHeader,
28
+ isFirst: e === 0,
29
+ isLast: e === i.length - 1
30
+ })), l = i.findIndex((r) => r.id === o);
31
+ l === -1 && console.error(
32
+ `Current step with id ${o} not found in steps array. Bad configuration?`
33
+ );
34
+ let f = o;
35
+ for (let r = 0; r < s.length; r++) {
36
+ const e = s[r];
37
+ if (r > l) {
38
+ e.isActive = !1, e.isCompleted = !1;
39
+ continue;
40
+ }
41
+ if (e.step.id === o)
42
+ if (e.isRendered)
43
+ e.isActive = !0, e.isCompleted = !1;
44
+ else {
45
+ const a = s.find((b) => b.step.id === f);
46
+ a && (a.isActive = !0, a.isCompleted = e.step.excludedStepCompletesPreviousStep ?? !1);
47
+ }
48
+ r < l && (e.isActive = !1, e.isCompleted = !0, e.isRendered && (f = e.step.id));
49
+ }
50
+ return s;
51
+ }, [i, o]), t = v(() => p.find((s) => s.isActive), [p]);
52
+ if (!t)
53
+ return console.error(
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,
21
68
  {
22
69
  "data-testid": "stepper",
23
70
  fullWidth: !0,
@@ -26,51 +73,59 @@ const j = ({
26
73
  primaryAlign: "center",
27
74
  secondaryAlign: "center",
28
75
  children: [
29
- s ? /* @__PURE__ */ r(
30
- y,
76
+ y ? /* @__PURE__ */ n(
77
+ k,
31
78
  {
32
- stepperType: n,
33
- steps: e,
34
- currentStep: t,
35
- customTotalSteps: a
79
+ stepperStyle: h,
80
+ stepsData: p,
81
+ overwriteTotalSteps: P
36
82
  }
37
83
  ) : null,
38
- /* @__PURE__ */ r(
39
- o,
84
+ /* @__PURE__ */ n(
85
+ u,
40
86
  {
41
87
  "data-testid": "stepper-content",
42
88
  fullWidth: !0,
43
- className: h.stepperContent,
89
+ className: S.stepperContent,
44
90
  gap: "airy",
45
91
  secondaryAlign: "center",
46
92
  direction: "vertical",
47
- children: l
93
+ children: B
48
94
  }
49
95
  ),
50
- /* @__PURE__ */ i(
51
- o,
96
+ c ? /* @__PURE__ */ m(
97
+ u,
52
98
  {
53
99
  "data-testid": "stepper-buttons",
54
100
  fullWidth: !0,
55
101
  secondaryAlign: "center",
56
- primaryAlign: d,
102
+ primaryAlign: C,
57
103
  children: [
58
- (t !== 0 || m) && /* @__PURE__ */ r(f, { ...e[t].prevButtonProps }),
59
- /* @__PURE__ */ r(
104
+ (!t.isFirst || d) && /* @__PURE__ */ n(
60
105
  g,
61
106
  {
62
- ...e[t].nextButtonProps,
63
- isStepLoading: p,
64
- isLastStep: c
107
+ ...t.step.prevButtonProps,
108
+ onClick: t.step.prevButtonProps.onClick,
109
+ label: t.step.prevButtonProps.label
110
+ }
111
+ ),
112
+ /* @__PURE__ */ n(
113
+ A,
114
+ {
115
+ ...t.step.nextButtonProps,
116
+ onClick: t.step.nextButtonProps.onClick,
117
+ label: t.step.nextButtonProps.label,
118
+ isStepLoading: x,
119
+ isLastStep: t.isLast
65
120
  }
66
121
  )
67
122
  ]
68
123
  }
69
- )
124
+ ) : null
70
125
  ]
71
126
  }
72
127
  );
73
128
  };
74
129
  export {
75
- j as Stepper
130
+ W as Stepper
76
131
  };
@@ -1,160 +1,344 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { a as p, s as t, f as u, c as l } from "../../react.esm-Bm0cAgpZ.js";
3
- import { Stepper as o } from "./Stepper.js";
4
- import { v as s, d as a, t as c, g as n } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
- const i = [
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { a as p, s as t, f as S, c as C } from "../../react.esm-Bm0cAgpZ.js";
3
+ import { a as y } from "../../useBreakpoints-MzTZ0tCT.js";
4
+ import { Stepper as s } from "./Stepper.js";
5
+ import { StepperStyle as i } from "./stepperStyles.js";
6
+ import { d as B, b as h, t as c, g as e, v as a } from "../../vi.bdSIJ99Y-B308Q-4w.js";
7
+ const m = () => [
6
8
  {
7
- name: "step1",
8
- step: 0,
9
- title: "Step 1",
9
+ id: "step1",
10
+ stepNumber: 1,
11
+ text: "Description 1",
12
+ secondaryText: "Secondary Description 1",
10
13
  optional: !1,
11
- nextButtonProps: { onClick: s.fn(), label: "Next" },
12
- prevButtonProps: { onClick: s.fn(), label: "Back" }
14
+ nextButtonProps: { onClick: a.fn(), label: "Next" },
15
+ prevButtonProps: { onClick: a.fn(), label: "Back" }
13
16
  },
14
17
  {
15
- name: "step2",
16
- step: 1,
17
- title: "Step 2",
18
+ id: "step2",
19
+ stepNumber: 2,
20
+ text: "Description 2",
21
+ secondaryText: "Secondary Description 2",
18
22
  optional: !1,
19
- nextButtonProps: { onClick: s.fn(), label: "Next" },
20
- prevButtonProps: { onClick: s.fn(), label: "Back" }
23
+ nextButtonProps: { onClick: a.fn(), label: "Next" },
24
+ prevButtonProps: { onClick: a.fn(), label: "Back" }
21
25
  },
22
26
  {
23
- name: "step3",
24
- step: 2,
25
- title: "Step 3",
27
+ id: "step3",
28
+ stepNumber: 3,
29
+ text: "Description 3",
30
+ secondaryText: "Secondary Description 3",
26
31
  optional: !0,
27
- nextButtonProps: { onClick: s.fn(), label: "Finish" },
28
- prevButtonProps: { onClick: s.fn(), label: "Back" }
32
+ nextButtonProps: { onClick: a.fn(), label: "Finish" },
33
+ prevButtonProps: { onClick: a.fn(), label: "Back" }
29
34
  }
30
35
  ];
31
- a("Stepper", () => {
32
- c("renders the stepper header and children", () => {
36
+ B("Generic Stepper Tests (StepperStyle.DESKTOP)", () => {
37
+ let o;
38
+ h(() => {
39
+ o = m();
40
+ }), c("Default Render", () => {
33
41
  p(
34
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
35
- ), n(t.queryByText("Step 1")).not.toBeInTheDocument(), n(t.getByText("Step 2")).toBeInTheDocument(), n(t.queryByText("Step 3")).not.toBeInTheDocument(), n(t.getByText("Step Content")).toBeInTheDocument();
36
- }), c("disables the next button when isStepLoading is true", () => {
42
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
43
+ ), e(t.getByText(
44
+ 1
45
+ /* STEP_1 */
46
+ )).toBeInTheDocument(), e(t.getByText(
47
+ 2
48
+ /* STEP_2 */
49
+ )).toBeInTheDocument(), e(t.getByText(
50
+ 3
51
+ /* STEP_3 */
52
+ )).toBeInTheDocument(), e(t.getByText(
53
+ "Description 1"
54
+ /* STEP_1 */
55
+ )).toBeInTheDocument(), e(t.getByText(
56
+ "Description 2"
57
+ /* STEP_2 */
58
+ )).toBeInTheDocument(), e(t.getByText(
59
+ "Description 3"
60
+ /* STEP_3 */
61
+ )).toBeInTheDocument(), e(t.getByText("Step Content")).toBeInTheDocument(), e(t.getByText("Next")).toBeInTheDocument();
62
+ }), c("isStepLoading disables buttons", () => {
37
63
  p(
38
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !0, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
64
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", isStepLoading: !0, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
39
65
  );
40
66
  const r = t.getByText("Next").closest("button");
41
- n(r).toBeDisabled();
67
+ e(r).toBeDisabled();
42
68
  }), c("calls nextButtonProps.onClick when next button is clicked", () => {
43
- const r = s.fn();
44
- i[1].nextButtonProps.onClick = r, p(
45
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
46
- ), u.click(t.getByText("Next")), n(r).toHaveBeenCalled();
69
+ const r = a.fn();
70
+ o[1].nextButtonProps.onClick = r, p(
71
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
72
+ ), S.click(t.getByText("Next")), e(r).toHaveBeenCalled();
47
73
  }), c("calls prevButtonProps.onClick when prev button is clicked", () => {
48
- const r = s.fn();
49
- i[1].prevButtonProps.onClick = r, p(
50
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
51
- ), u.click(t.getByText("Back")), n(r).toHaveBeenCalled();
74
+ const r = a.fn();
75
+ o[1].prevButtonProps.onClick = r, p(
76
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
77
+ ), S.click(t.getByText("Back")), e(r).toHaveBeenCalled();
52
78
  }), c("does not render the prev button on the first step", () => {
53
79
  p(
54
- /* @__PURE__ */ e(o, { steps: i, currentStep: 0, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
55
- ), n(t.queryByText("Back")).not.toBeInTheDocument();
80
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step1", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
81
+ ), e(t.queryByText("Back")).not.toBeInTheDocument();
56
82
  }), c("renders the next button as submit on last step", () => {
57
83
  p(
58
- /* @__PURE__ */ e(o, { steps: i, currentStep: 2, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
84
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step3", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
59
85
  );
60
86
  const r = t.getByText("Finish").closest("button");
61
- n(r).toHaveAttribute("type", "submit");
62
- }), c("does not render the stepper header when showStepperHeader is false", () => {
87
+ e(r).toHaveAttribute("type", "submit");
88
+ }), c("hide stepper header when showStepperHeader is false", () => {
89
+ p(
90
+ /* @__PURE__ */ n(
91
+ s,
92
+ {
93
+ steps: o,
94
+ currentStepId: "step2",
95
+ isStepLoading: !1,
96
+ showStepperHeader: !1,
97
+ children: /* @__PURE__ */ n("div", { children: "Step Content" })
98
+ }
99
+ )
100
+ ), e(t.queryByTestId("stepper-header")).not.toBeInTheDocument();
101
+ }), c("hide stepper buttons when showStepperButtons is false", () => {
63
102
  p(
64
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, showStepperHeader: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
65
- ), n(t.queryByTestId("stepper-header")).not.toBeInTheDocument();
103
+ /* @__PURE__ */ n(
104
+ s,
105
+ {
106
+ steps: o,
107
+ currentStepId: "step2",
108
+ isStepLoading: !1,
109
+ showStepperButtons: !1,
110
+ children: /* @__PURE__ */ n("div", { children: "Step Content" })
111
+ }
112
+ )
113
+ ), e(t.queryByText("Next")).not.toBeInTheDocument(), e(t.queryByText("Back")).not.toBeInTheDocument();
66
114
  }), c("does not render stepper button icons when showArrowIcon is false", () => {
67
- i[1].nextButtonProps.showArrowIcon = !1, i[1].prevButtonProps.showArrowIcon = !1, p(
68
- /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
69
- ), n(t.queryByText("arrow_forward")).not.toBeInTheDocument(), n(t.queryByText("arrow_back")).not.toBeInTheDocument();
115
+ o[1].nextButtonProps.showArrowIcon = !1, o[1].prevButtonProps.showArrowIcon = !1, p(
116
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
117
+ ), e(t.queryByText("arrow_forward")).not.toBeInTheDocument(), e(t.queryByText("arrow_back")).not.toBeInTheDocument();
118
+ }), c("prints an error when current step is not found", () => {
119
+ const r = a.spyOn(console, "error").mockImplementation(() => {
120
+ });
121
+ p(
122
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "unknownId", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
123
+ ), e(r).toHaveBeenCalledWith(
124
+ "Current step with id unknownId not found in steps array. Bad configuration?"
125
+ ), r.mockRestore(), e(t.queryByTestId("description-stepper-header")).not.toBeInTheDocument();
126
+ }), c("prints an error when next button props are not found but showStepperButtons is true", () => {
127
+ const r = a.spyOn(console, "error").mockImplementation(() => {
128
+ }), d = m();
129
+ d[0].nextButtonProps.onClick = void 0, d[1].prevButtonProps.label = void 0, p(
130
+ /* @__PURE__ */ n(s, { steps: d, currentStepId: "step1", showStepperButtons: !0, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
131
+ ), e(r).toHaveBeenCalledWith(
132
+ "Next button props not found for current step with id step1. If you want to use the stepper buttons, make sure to provide nextButtonProps for each step."
133
+ ), p(
134
+ /* @__PURE__ */ n(s, { steps: d, currentStepId: "step2", showStepperButtons: !0, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
135
+ ), e(r).toHaveBeenCalledWith(
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();
70
138
  });
71
139
  });
72
- const d = [
73
- {
74
- name: "Description Step 1",
75
- step: 1,
76
- title: "Description 1",
77
- nextButtonProps: { onClick: s.fn(), label: "Next" },
78
- prevButtonProps: { onClick: s.fn(), label: "Back" }
79
- },
80
- {
81
- name: "Description Step 2",
82
- step: 2,
83
- title: "Description 2",
84
- nextButtonProps: { onClick: s.fn(), label: "Next" },
85
- prevButtonProps: { onClick: s.fn(), label: "Back" }
86
- },
87
- {
88
- name: "Description Step 2.5",
89
- step: 2.5,
90
- title: "Description 2.5",
91
- nextButtonProps: { onClick: s.fn(), label: "Next" },
92
- prevButtonProps: { onClick: s.fn(), label: "Back" }
93
- },
94
- {
95
- name: "Description Step 3",
96
- step: 3,
97
- title: "Description 3",
98
- nextButtonProps: { onClick: s.fn(), label: "Finish" },
99
- prevButtonProps: { onClick: s.fn(), label: "Back" }
100
- }
101
- ];
102
- a("stepper types", () => {
103
- const r = /* @__PURE__ */ e("div", { children: "content" });
104
- c("default type without prop", () => {
140
+ B("Stepper Type DESKTOP Tests", () => {
141
+ let o;
142
+ h(() => {
143
+ o = m();
144
+ }), c("renders numbers, text and secondary text", () => {
105
145
  p(
106
- /* @__PURE__ */ e(o, { steps: i, currentStep: 0, children: r })
107
- ), n(t.getByTestId("stepper-header")).toBeInTheDocument(), n(t.getByText("Step 1")).toBeInTheDocument();
108
- }), c("default type via prop", () => {
146
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
147
+ ), e(t.getByTestId("desktop-stepper-header")).toBeInTheDocument(), e(t.getByText(
148
+ 1
149
+ /* STEP_1 */
150
+ )).toBeInTheDocument(), e(t.getByText(
151
+ 2
152
+ /* STEP_2 */
153
+ )).toBeInTheDocument(), e(t.getByText(
154
+ 3
155
+ /* STEP_3 */
156
+ )).toBeInTheDocument(), e(t.getByText(
157
+ "Description 1"
158
+ /* STEP_1 */
159
+ )).toBeInTheDocument(), e(t.getByText(
160
+ "Description 2"
161
+ /* STEP_2 */
162
+ )).toBeInTheDocument(), e(t.getByText(
163
+ "Description 3"
164
+ /* STEP_3 */
165
+ )).toBeInTheDocument(), e(t.getByText(
166
+ "Secondary Description 1"
167
+ /* STEP_1 */
168
+ )).toBeInTheDocument(), e(t.getByText(
169
+ "Secondary Description 2"
170
+ /* STEP_2 */
171
+ )).toBeInTheDocument(), e(t.getByText(
172
+ "Secondary Description 3"
173
+ /* STEP_3 */
174
+ )).toBeInTheDocument(), e(t.getByTestId("stepper-connector-before-step2")).toBeInTheDocument(), e(t.getByTestId("stepper-connector-before-step3")).toBeInTheDocument(), e(
175
+ t.queryByTestId("stepper-connector-before-step1")
176
+ ).not.toBeInTheDocument(), e(t.getByText("Step Content")).toBeInTheDocument(), e(t.getByText("Next")).toBeInTheDocument();
177
+ }), c("show numbers for active and incompleted step", () => {
109
178
  p(
110
- /* @__PURE__ */ e(o, { stepperType: "default", steps: i, currentStep: 0, children: r })
111
- ), n(t.getByTestId("stepper-header")).toBeInTheDocument(), n(t.getByText("Step 1")).toBeInTheDocument();
112
- }), c("description type via prop", () => {
179
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
180
+ ), e(t.queryByText(
181
+ 1
182
+ /* STEP_1 */
183
+ )).not.toBeInTheDocument(), e(t.getByText(
184
+ 2
185
+ /* STEP_2 */
186
+ )).toBeInTheDocument(), e(t.getByText(
187
+ 3
188
+ /* STEP_3 */
189
+ )).toBeInTheDocument();
190
+ }), c("show checkmark for completed step", () => {
113
191
  p(
114
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 0, children: r })
115
- ), n(t.getByTestId("description-stepper-header")).toBeInTheDocument(), n(t.getByText("Description 1")).toBeInTheDocument();
116
- });
117
- });
118
- a("description stepper header", () => {
119
- const r = /* @__PURE__ */ e("div", { children: "content" });
120
- c("render step process", () => {
121
- p(
122
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 0, children: r })
123
- ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("1/4"), l(), p(
124
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 1, children: r })
125
- ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("2/4"), l(), p(
126
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 2, children: r })
127
- ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("2.5/4"), l(), p(
128
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 3, children: r })
129
- ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("3/4"), l(), p(
130
- /* @__PURE__ */ e(
131
- o,
192
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
193
+ ), e(t.queryByText(
194
+ 1
195
+ /* STEP_1 */
196
+ )).not.toBeInTheDocument(), e(t.queryByText(
197
+ 2
198
+ /* STEP_2 */
199
+ )).not.toBeInTheDocument(), e(t.getByTestId("stepper-item-check-for-step1")).toBeInTheDocument(), e(t.getByTestId("stepper-item-check-for-step2")).toBeInTheDocument();
200
+ }), c("has correct color styles for completed and active steps", () => {
201
+ p(
202
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
203
+ );
204
+ const r = t.getByTestId("stepper-item-circle-for-step1"), d = t.getByTestId(
205
+ "stepper-connector-before-step2"
206
+ ), l = t.getByTestId("stepper-item-circle-for-step2"), u = t.getByTestId("stepper-connector-before-step3"), I = t.getByTestId("stepper-item-circle-for-step3");
207
+ e(r.className).toContain("stepperItemNumberActive"), e(d.className).toContain("stepperItemConnectorCompleted"), e(l.className).toContain("stepperItemNumberActive"), e(u.className).not.toContain("stepperItemConnectorCompleted"), e(I.className).not.toContain("stepperItemNumberActive");
208
+ }), c("advancing step changes number to checkmark and adjusts color", () => {
209
+ const { rerender: r } = p(
210
+ /* @__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"), l = t.getByTestId("stepper-connector-before-step2"), u = t.getByTestId("stepper-item-circle-for-step2"), I = t.getByTestId("stepper-connector-before-step3"), T = t.getByTestId("stepper-item-circle-for-step3");
212
+ e(d.className).toContain("stepperItemNumberActive"), e(l.className).not.toContain("stepperItemConnectorCompleted"), e(u.className).not.toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(T.className).not.toContain("stepperItemNumberActive"), r(
213
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
214
+ ), e(d.className).toContain("stepperItemNumberActive"), e(l.className).toContain("stepperItemConnectorCompleted"), e(u.className).toContain("stepperItemNumberActive"), e(I.className).not.toContain("stepperItemConnectorCompleted"), e(T.className).not.toContain("stepperItemNumberActive"), r(
215
+ /* @__PURE__ */ n(s, { stepperStyle: i.DESKTOP, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
216
+ ), e(d.className).toContain("stepperItemNumberActive"), e(l.className).toContain("stepperItemConnectorCompleted"), e(u.className).toContain("stepperItemNumberActive"), e(I.className).toContain("stepperItemConnectorCompleted"), e(T.className).toContain("stepperItemNumberActive");
217
+ }), c("custom button icons are shown as expected", () => {
218
+ o[1].nextButtonProps.showArrowIcon = !1, o[1].nextButtonProps.trailingIcon = "flag", o[1].prevButtonProps.showArrowIcon = !1, o[1].prevButtonProps.leadingIcon = "wifi", p(
219
+ /* @__PURE__ */ n(s, { steps: o, currentStepId: "step2", isStepLoading: !1, children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
220
+ ), e(t.getByText("flag")).toBeInTheDocument(), e(t.getByText("wifi")).toBeInTheDocument();
221
+ }), c("handles excludeFromHeader and excludedStepCompletesPreviousStep correctly", () => {
222
+ const r = m();
223
+ r.push({
224
+ id: "step4",
225
+ stepNumber: 4,
226
+ text: "Description 4",
227
+ excludeFromHeader: !0,
228
+ excludedStepCompletesPreviousStep: !1,
229
+ secondaryText: "Secondary Description 4",
230
+ nextButtonProps: { onClick: a.fn(), label: "Next" },
231
+ prevButtonProps: { onClick: a.fn(), label: "Back" }
232
+ }), r[1].excludedStepCompletesPreviousStep = !0, r[1].excludeFromHeader = !0, p(
233
+ /* @__PURE__ */ n(
234
+ s,
132
235
  {
133
- stepperType: "description",
134
- steps: d,
135
- currentStep: 3,
136
- customTotalSteps: 3,
137
- children: r
236
+ stepperStyle: i.DESKTOP,
237
+ steps: r,
238
+ currentStepId: "step2",
239
+ children: /* @__PURE__ */ n("div", { children: "Step Content" })
138
240
  }
139
241
  )
140
- ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("3/3");
141
- }), c("render description text", () => {
242
+ ), e(t.getByTestId("stepper-item-check-for-step1")).toBeInTheDocument();
243
+ const d = t.getByTestId("stepper-connector-before-step3");
244
+ e(d.className).not.toContain("stepperItemConnectorCompleted"), e(t.queryByTestId("stepper-item-step2")).not.toBeInTheDocument(), e(t.queryByTestId("stepper-item-step4")).not.toBeInTheDocument(), C(), p(
245
+ /* @__PURE__ */ n(
246
+ s,
247
+ {
248
+ stepperStyle: i.DESKTOP,
249
+ steps: r,
250
+ currentStepId: "step4",
251
+ children: /* @__PURE__ */ n("div", { children: "Step Content" })
252
+ }
253
+ )
254
+ );
255
+ const l = t.getByTestId("stepper-connector-before-step3");
256
+ e(l.className).toContain("stepperItemConnectorCompleted"), e(
257
+ t.queryByTestId("stepper-item-check-for-step3")
258
+ ).not.toBeInTheDocument();
259
+ }), c("shows mobile view breakpoint is triggered (<600px)", () => {
260
+ a.spyOn(y, "useBreakpoints").mockReturnValue({
261
+ isMobile: !0,
262
+ isDesktop: !1,
263
+ isDesktopNavbar: !1,
264
+ isTablet: !1
265
+ }), p(
266
+ /* @__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(), a.spyOn(y, "useBreakpoints").mockRestore();
268
+ });
269
+ });
270
+ B("Stepper Type DOTS Tests", () => {
271
+ let o;
272
+ h(() => {
273
+ o = m();
274
+ }), c("renders dots and text", () => {
142
275
  p(
143
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 0, children: r })
144
- ), n(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
276
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
277
+ ), e(t.getByTestId("dots-stepper-header")).toBeInTheDocument(), e(t.getByTestId("stepper-indicator")).toBeInTheDocument(), e(t.getByTestId("stepper-indicator-step1")).toBeInTheDocument(), e(t.getByTestId("stepper-indicator-step2")).toBeInTheDocument(), e(t.getByTestId("stepper-indicator-step3")).toBeInTheDocument(), e(t.getByText(
145
278
  "Description 1"
146
- ), l(), p(
147
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 1, children: r })
148
- ), n(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
279
+ /* STEP_1 */
280
+ )).toBeInTheDocument(), e(t.queryByText(
149
281
  "Description 2"
150
- ), l(), p(
151
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 2, children: r })
152
- ), n(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
153
- "Description 2.5"
154
- ), l(), p(
155
- /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 3, children: r })
156
- ), n(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
282
+ /* STEP_2 */
283
+ )).not.toBeInTheDocument(), e(t.queryByText(
157
284
  "Description 3"
285
+ /* STEP_3 */
286
+ )).not.toBeInTheDocument(), e(t.getByText("Step Content")).toBeInTheDocument(), e(t.getByText("Next")).toBeInTheDocument();
287
+ }), c("show active style for completed, active and incompleted steps", () => {
288
+ p(
289
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
158
290
  );
291
+ const r = t.getByTestId("stepper-indicator-step1"), d = t.getByTestId("stepper-indicator-step2"), l = t.getByTestId("stepper-indicator-step3");
292
+ e(r.className).toContain("stepperIndicatorItemActive"), e(d.className).toContain("stepperIndicatorItemActive"), e(l.className).not.toContain("stepperIndicatorItemActive");
293
+ }), c("show optional style", () => {
294
+ p(
295
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
296
+ );
297
+ const r = t.getByTestId("stepper-indicator-step3");
298
+ e(r.className).toContain("stepperIndicatorItemOptional");
299
+ }), c("advancing step adjusts styles accordingly", () => {
300
+ const { rerender: r } = p(
301
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
302
+ ), d = t.getByTestId("stepper-indicator-step1"), l = t.getByTestId("stepper-indicator-step2"), u = t.getByTestId("stepper-indicator-step3");
303
+ e(d.className).toContain("stepperIndicatorItemActive"), e(l.className).not.toContain("stepperIndicatorItemActive"), e(u.className).not.toContain("stepperIndicatorItemActive"), r(
304
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
305
+ ), e(d.className).toContain("stepperIndicatorItemActive"), e(l.className).toContain("stepperIndicatorItemActive"), e(u.className).not.toContain("stepperIndicatorItemActive"), r(
306
+ /* @__PURE__ */ n(s, { stepperStyle: i.DOTS, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
307
+ ), e(d.className).toContain("stepperIndicatorItemActive"), e(l.className).toContain("stepperIndicatorItemActive"), e(u.className).toContain("stepperIndicatorItemActive");
308
+ });
309
+ });
310
+ B("Stepper Type SMALL Tests", () => {
311
+ let o;
312
+ h(() => {
313
+ o = m();
314
+ }), c("renders step number, total steps and text", () => {
315
+ p(
316
+ /* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
317
+ ), e(t.getByTestId("description-stepper-header")).toBeInTheDocument(), e(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("1/3"), e(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
318
+ "Description 1"
319
+ /* STEP_1 */
320
+ ), e(t.getByText("Step Content")).toBeInTheDocument(), e(t.getByText("Next")).toBeInTheDocument();
321
+ }), c("advancing step adjusts progress accordingly", () => {
322
+ const { rerender: r } = p(
323
+ /* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step1", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
324
+ );
325
+ e(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("1/3"), r(
326
+ /* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step2", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
327
+ ), e(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("2/3"), r(
328
+ /* @__PURE__ */ n(s, { stepperStyle: i.SMALL, steps: o, currentStepId: "step3", children: /* @__PURE__ */ n("div", { children: "Step Content" }) })
329
+ ), e(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("3/3");
330
+ }), c("overwriting total steps accordingly", () => {
331
+ p(
332
+ /* @__PURE__ */ n(
333
+ s,
334
+ {
335
+ stepperStyle: i.SMALL,
336
+ steps: o,
337
+ currentStepId: "step3",
338
+ overwriteTotalSteps: 5,
339
+ children: /* @__PURE__ */ n("div", { children: "Step Content" })
340
+ }
341
+ )
342
+ ), e(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("3/5");
159
343
  });
160
344
  });