@hortiview/shared-components 2.10.2 → 2.11.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +29 -13
  3. package/dist/assets/stepper.css +1 -1
  4. package/dist/components/AlertBanner/AlertBanner.test.js +1 -1
  5. package/dist/components/AlertBanner/LinkBanner.test.js +1 -1
  6. package/dist/components/BaseView/BaseView.test.js +1 -1
  7. package/dist/components/BasicHeading/BasicHeading.test.js +1 -1
  8. package/dist/components/BlockView/BlockView.test.js +1 -1
  9. package/dist/components/ChipCard/ChipCard.test.js +1 -1
  10. package/dist/components/ContextMenu/ContextMenu.test.js +1 -1
  11. package/dist/components/DeleteModal/DeleteModal.test.js +1 -1
  12. package/dist/components/Disclaimer/Disclaimer.test.js +1 -1
  13. package/dist/components/EmptyView/EmptyView.test.js +1 -1
  14. package/dist/components/Filter/Filter.test.js +1 -1
  15. package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.js +1 -1
  16. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.js +1 -1
  17. package/dist/components/FormComponents/FormNumber/FormNumber.test.js +1 -1
  18. package/dist/components/FormComponents/FormRadio/FormRadio.test.js +1 -1
  19. package/dist/components/FormComponents/FormSelect/FormSelect.test.js +2 -2
  20. package/dist/components/FormComponents/FormSlider/FormSlider.test.js +1 -1
  21. package/dist/components/FormComponents/FormText/FormText.test.js +1 -1
  22. package/dist/components/FormComponents/FormToggle/FormToggle.test.js +1 -1
  23. package/dist/components/GenericTable/GenericTable.test.js +1 -1
  24. package/dist/components/GenericTable/Mobile/GenericCard.test.js +1 -1
  25. package/dist/components/GenericTable/Mobile/GenericCardList.test.js +1 -1
  26. package/dist/components/HashTabView/HashTabView.test.js +1 -1
  27. package/dist/components/HeaderFilter/HeaderFilter.test.js +1 -1
  28. package/dist/components/Iconify/Iconify.test.js +1 -1
  29. package/dist/components/InfoCard/InfoCard.test.js +1 -1
  30. package/dist/components/InfoGroup/InfoGroup.test.js +1 -1
  31. package/dist/components/ListArea/ListArea.test.js +1 -1
  32. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +1 -1
  33. package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.js +1 -1
  34. package/dist/components/Modal/Modal.d.ts +3 -1
  35. package/dist/components/Modal/Modal.js +111 -110
  36. package/dist/components/ModulePadding/ModulePadding.test.js +1 -1
  37. package/dist/components/OfflineView/OfflineView.test.js +1 -1
  38. package/dist/components/OnboardingBanner/OnboardingBanner.test.js +1 -1
  39. package/dist/components/OverflowTooltip/OverflowTooltip.test.js +2 -2
  40. package/dist/components/SafeForm/SafeForm.test.js +2 -2
  41. package/dist/components/Scrollbar/scrollbar.test.js +1 -1
  42. package/dist/components/SearchBar/SearchBar.test.js +1 -1
  43. package/dist/components/Select/Select.test.js +1 -1
  44. package/dist/components/Stepper/Stepper.d.ts +7 -3
  45. package/dist/components/Stepper/Stepper.js +30 -20
  46. package/dist/components/Stepper/Stepper.test.js +127 -38
  47. package/dist/components/Stepper/components/StepperButton.d.ts +6 -2
  48. package/dist/components/Stepper/components/StepperButton.js +60 -46
  49. package/dist/components/Stepper/components/StepperHeader.d.ts +8 -2
  50. package/dist/components/Stepper/components/StepperHeader.js +60 -14
  51. package/dist/components/Stepper/components/StepperIndicator.js +1 -1
  52. package/dist/components/Stepper/stepperTypes.d.ts +35 -5
  53. package/dist/components/VerticalDivider/VerticalDivider.test.js +1 -1
  54. package/dist/hooks/useBreakpoints.test.js +1 -1
  55. package/dist/{index-I7uTh4Tr.js → index-CkZYDkGd.js} +1 -1
  56. package/dist/{react.esm-CX1WJ2Pp.js → react.esm-BbMrgZCM.js} +3 -2
  57. package/dist/stepper.module-c-CWmpkt.js +15 -0
  58. package/package.json +1 -1
  59. package/dist/stepper.module-HuqmDJPj.js +0 -12
@@ -1,19 +1,21 @@
1
1
  import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
2
  import { G as o } from "../../index.es-DsGuBR0Z.js";
3
- import { useMemo as m } from "react";
4
- import { StepperPreviousButton as c, StepperNextButton as u } from "./components/StepperButton.js";
5
- import { StepperHeader as f } from "./components/StepperHeader.js";
6
- import { s as g } from "../../stepper.module-HuqmDJPj.js";
7
- const P = ({
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",
8
9
  steps: e,
9
10
  currentStep: t,
10
- children: n,
11
- isStepLoading: a,
12
- showStepperHeader: p = !0,
13
- stepperButtonAlignment: l = "center",
14
- showPreviousButtonOnFirstStep: s = !1
11
+ customTotalSteps: a,
12
+ children: l,
13
+ isStepLoading: p,
14
+ showStepperHeader: s = !0,
15
+ stepperButtonAlignment: d = "center",
16
+ showPreviousButtonOnFirstStep: m = !1
15
17
  }) => {
16
- const d = m(() => t === e.length - 1, [t, e.length]);
18
+ const c = u(() => t === e.length - 1, [t, e.length]);
17
19
  return /* @__PURE__ */ i(
18
20
  o,
19
21
  {
@@ -24,17 +26,25 @@ const P = ({
24
26
  primaryAlign: "center",
25
27
  secondaryAlign: "center",
26
28
  children: [
27
- p ? /* @__PURE__ */ r(f, { steps: e, currentStep: t }) : null,
29
+ s ? /* @__PURE__ */ r(
30
+ y,
31
+ {
32
+ stepperType: n,
33
+ steps: e,
34
+ currentStep: t,
35
+ customTotalSteps: a
36
+ }
37
+ ) : null,
28
38
  /* @__PURE__ */ r(
29
39
  o,
30
40
  {
31
41
  "data-testid": "stepper-content",
32
42
  fullWidth: !0,
33
- className: g.stepperContent,
43
+ className: h.stepperContent,
34
44
  gap: "airy",
35
45
  secondaryAlign: "center",
36
46
  direction: "vertical",
37
- children: n
47
+ children: l
38
48
  }
39
49
  ),
40
50
  /* @__PURE__ */ i(
@@ -43,15 +53,15 @@ const P = ({
43
53
  "data-testid": "stepper-buttons",
44
54
  fullWidth: !0,
45
55
  secondaryAlign: "center",
46
- primaryAlign: l,
56
+ primaryAlign: d,
47
57
  children: [
48
- (t !== 0 || s) && /* @__PURE__ */ r(c, { ...e[t].prevButtonProps }),
58
+ (t !== 0 || m) && /* @__PURE__ */ r(f, { ...e[t].prevButtonProps }),
49
59
  /* @__PURE__ */ r(
50
- u,
60
+ g,
51
61
  {
52
62
  ...e[t].nextButtonProps,
53
- isStepLoading: a,
54
- isLastStep: d
63
+ isStepLoading: p,
64
+ isLastStep: c
55
65
  }
56
66
  )
57
67
  ]
@@ -62,5 +72,5 @@ const P = ({
62
72
  );
63
73
  };
64
74
  export {
65
- P as Stepper
75
+ j as Stepper
66
76
  };
@@ -1,71 +1,160 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { a as s, s as t, f as c } from "../../react.esm-CX1WJ2Pp.js";
3
- import { Stepper as i } from "./Stepper.js";
4
- import { v as l, d as a, t as p, g as n } from "../../vi.CjhMlMwf-CKxPQtd6.js";
5
- const o = [
2
+ import { a as p, s as t, f as u, c as l } from "../../react.esm-BbMrgZCM.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.CjhMlMwf-CKxPQtd6.js";
5
+ const i = [
6
6
  {
7
7
  name: "step1",
8
8
  step: 0,
9
9
  title: "Step 1",
10
10
  optional: !1,
11
- nextButtonProps: { onClick: l.fn(), label: "Next" },
12
- prevButtonProps: { onClick: l.fn(), label: "Back" }
11
+ nextButtonProps: { onClick: s.fn(), label: "Next" },
12
+ prevButtonProps: { onClick: s.fn(), label: "Back" }
13
13
  },
14
14
  {
15
15
  name: "step2",
16
16
  step: 1,
17
17
  title: "Step 2",
18
18
  optional: !1,
19
- nextButtonProps: { onClick: l.fn(), label: "Next" },
20
- prevButtonProps: { onClick: l.fn(), label: "Back" }
19
+ nextButtonProps: { onClick: s.fn(), label: "Next" },
20
+ prevButtonProps: { onClick: s.fn(), label: "Back" }
21
21
  },
22
22
  {
23
23
  name: "step3",
24
24
  step: 2,
25
25
  title: "Step 3",
26
26
  optional: !0,
27
- nextButtonProps: { onClick: l.fn(), label: "Finish" },
28
- prevButtonProps: { onClick: l.fn(), label: "Back" }
27
+ nextButtonProps: { onClick: s.fn(), label: "Finish" },
28
+ prevButtonProps: { onClick: s.fn(), label: "Back" }
29
29
  }
30
30
  ];
31
31
  a("Stepper", () => {
32
- p("renders the stepper header and children", () => {
33
- s(
34
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
32
+ c("renders the stepper header and children", () => {
33
+ p(
34
+ /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
35
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
- }), p("disables the next button when isStepLoading is true", () => {
37
- s(
38
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !0, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
36
+ }), c("disables the next button when isStepLoading is true", () => {
37
+ p(
38
+ /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !0, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
39
39
  );
40
40
  const r = t.getByText("Next").closest("button");
41
41
  n(r).toBeDisabled();
42
- }), p("calls nextButtonProps.onClick when next button is clicked", () => {
43
- const r = l.fn();
44
- o[1].nextButtonProps.onClick = r, s(
45
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
46
- ), c.click(t.getByText("Next")), n(r).toHaveBeenCalled();
47
- }), p("calls prevButtonProps.onClick when prev button is clicked", () => {
48
- const r = l.fn();
49
- o[1].prevButtonProps.onClick = r, s(
50
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
51
- ), c.click(t.getByText("Back")), n(r).toHaveBeenCalled();
52
- }), p("does not render the prev button on the first step", () => {
53
- s(
54
- /* @__PURE__ */ e(i, { steps: o, currentStep: 0, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
42
+ }), 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();
47
+ }), 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();
52
+ }), c("does not render the prev button on the first step", () => {
53
+ p(
54
+ /* @__PURE__ */ e(o, { steps: i, currentStep: 0, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
55
55
  ), n(t.queryByText("Back")).not.toBeInTheDocument();
56
- }), p("renders the next button as submit on last step", () => {
57
- s(
58
- /* @__PURE__ */ e(i, { steps: o, currentStep: 2, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
56
+ }), c("renders the next button as submit on last step", () => {
57
+ p(
58
+ /* @__PURE__ */ e(o, { steps: i, currentStep: 2, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
59
59
  );
60
60
  const r = t.getByText("Finish").closest("button");
61
61
  n(r).toHaveAttribute("type", "submit");
62
- }), p("does not render the stepper header when showStepperHeader is false", () => {
63
- s(
64
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !1, showStepperHeader: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
62
+ }), c("does not render the stepper header when showStepperHeader is false", () => {
63
+ p(
64
+ /* @__PURE__ */ e(o, { steps: i, currentStep: 1, isStepLoading: !1, showStepperHeader: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
65
65
  ), n(t.queryByTestId("stepper-header")).not.toBeInTheDocument();
66
- }), p("does not render stepper button icons when showArrowIcon is false", () => {
67
- o[1].nextButtonProps.showArrowIcon = !1, o[1].prevButtonProps.showArrowIcon = !1, s(
68
- /* @__PURE__ */ e(i, { steps: o, currentStep: 1, isStepLoading: !1, children: /* @__PURE__ */ e("div", { children: "Step Content" }) })
66
+ }), 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
69
  ), n(t.queryByText("arrow_forward")).not.toBeInTheDocument(), n(t.queryByText("arrow_back")).not.toBeInTheDocument();
70
70
  });
71
71
  });
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", () => {
105
+ 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", () => {
109
+ 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", () => {
113
+ 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,
132
+ {
133
+ stepperType: "description",
134
+ steps: d,
135
+ currentStep: 3,
136
+ customTotalSteps: 3,
137
+ children: r
138
+ }
139
+ )
140
+ ), n(t.getByTestId("description-stepper-header-progress")).toHaveTextContent("3/3");
141
+ }), c("render description text", () => {
142
+ p(
143
+ /* @__PURE__ */ e(o, { stepperType: "description", steps: d, currentStep: 0, children: r })
144
+ ), n(t.getByTestId("description-stepper-header-description")).toHaveTextContent(
145
+ "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(
149
+ "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(
157
+ "Description 3"
158
+ );
159
+ });
160
+ });
@@ -7,11 +7,13 @@ import { StepperButtonProps } from '../stepperTypes';
7
7
  * @param disabled - Whether the button is disabled or not.
8
8
  * @param className - Additional class names to apply to the button.
9
9
  * @param showArrowIcon - Whether to show a leading arrow icon for the button. Defaults to true.
10
+ * @param leadingIcon - A custom leading icon for the button.
11
+ * @param trailingIcon - A custom trailing icon for the button.
10
12
  * @param buttonSize - The size of the button, defaults to 'themeDefault'.
11
13
  * @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
12
14
  * @returns
13
15
  */
14
- export declare const StepperPreviousButton: ({ label, onClick, disabled, className, showArrowIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const StepperPreviousButton: ({ label, onClick, disabled, className, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps) => import("react/jsx-runtime").JSX.Element;
15
17
  /**
16
18
  * A button component for the stepper that is used to go to the next step.
17
19
  * @param label - The label of the button.
@@ -21,11 +23,13 @@ export declare const StepperPreviousButton: ({ label, onClick, disabled, classNa
21
23
  * @param isStepLoading - A boolean indicating if the current step is loading. If true, the next button will show a loading state and be disabled.
22
24
  * @param isLastStep - A boolean indicating if this is the last step. If true, the button will submit the form instead of going to the next step.
23
25
  * @param showArrowIcon - Whether to show a trailing arrow icon for the button. Defaults to true.
26
+ * @param leadingIcon - A custom icon to display instead of the default arrow icon.
27
+ * @param trailingIcon - A custom icon to display instead of the default arrow icon.
24
28
  * @param buttonSize - The size of the button, defaults to 'themeDefault'.
25
29
  * @param fullWidth - Whether the button should take the full width of its container. Defaults to true.
26
30
  * @returns
27
31
  */
28
- export declare const StepperNextButton: ({ label, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, buttonSize, fullWidth, }: StepperButtonProps & {
32
+ export declare const StepperNextButton: ({ label, onClick, disabled, className, isStepLoading, isLastStep, showArrowIcon, leadingIcon, trailingIcon, buttonSize, fullWidth, }: StepperButtonProps & {
29
33
  isStepLoading?: boolean;
30
34
  isLastStep?: boolean;
31
35
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,60 +1,74 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { B as s } from "../../../index.es-DUcI2Zyr.js";
3
- import { useMemo as c } from "react";
4
- import { s as i } from "../../../stepper.module-HuqmDJPj.js";
5
- const $ = ({
6
- label: o,
7
- onClick: u,
8
- disabled: n,
9
- className: a,
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { B as a } from "../../../index.es-DUcI2Zyr.js";
3
+ import { useMemo as v } from "react";
4
+ import { s as f } from "../../../stepper.module-c-CWmpkt.js";
5
+ const y = ({
6
+ label: p,
7
+ onClick: n,
8
+ disabled: s,
9
+ className: m,
10
10
  showArrowIcon: t = !0,
11
- buttonSize: e = "themeDefault",
12
- fullWidth: r = !0
13
- }) => /* @__PURE__ */ p(
14
- s,
15
- {
16
- "data-testid": "stepper-previous-button",
17
- className: `${i.stepperButton} ${a ?? ""}`,
18
- onClick: u,
19
- disabled: n,
20
- fullWidth: r,
21
- buttonSize: e,
22
- variant: "outlined",
23
- leadingIcon: t ? "arrow_back" : void 0,
24
- type: "button",
25
- children: o
26
- }
27
- ), x = ({
28
- label: o,
29
- onClick: u,
30
- disabled: n,
31
- className: a,
11
+ leadingIcon: e,
12
+ trailingIcon: r,
13
+ buttonSize: u = "themeDefault",
14
+ fullWidth: o = !0
15
+ }) => {
16
+ const d = v(() => {
17
+ if (e) return e;
18
+ if (!r)
19
+ return t ? "arrow_back" : void 0;
20
+ }, [e, r, t]);
21
+ return /* @__PURE__ */ i(
22
+ a,
23
+ {
24
+ "data-testid": "stepper-previous-button",
25
+ className: `${f.stepperButton} ${m ?? ""}`,
26
+ onClick: n,
27
+ disabled: s,
28
+ fullWidth: o,
29
+ buttonSize: u,
30
+ variant: "outlined",
31
+ leadingIcon: d,
32
+ trailingIcon: r,
33
+ type: "button",
34
+ children: p
35
+ }
36
+ );
37
+ }, N = ({
38
+ label: p,
39
+ onClick: n,
40
+ disabled: s,
41
+ className: m,
32
42
  isStepLoading: t,
33
43
  isLastStep: e,
34
44
  showArrowIcon: r = !0,
35
- buttonSize: m = "themeDefault",
36
- fullWidth: d = !0
45
+ leadingIcon: u,
46
+ trailingIcon: o,
47
+ buttonSize: d = "themeDefault",
48
+ fullWidth: b = !0
37
49
  }) => {
38
- const l = c(() => {
39
- if (!t && !e)
50
+ const B = v(() => {
51
+ if (o) return o;
52
+ if (!u && !t && !e)
40
53
  return r ? "arrow_forward" : void 0;
41
- }, [e, t, r]);
42
- return /* @__PURE__ */ p(
43
- s,
54
+ }, [e, t, r, u, o]);
55
+ return /* @__PURE__ */ i(
56
+ a,
44
57
  {
45
58
  "data-testid": "stepper-next-button",
46
- className: `${i.stepperButton} ${t ? i.stepperButtonLoading : ""} ${a ?? ""}`,
47
- onClick: u,
48
- disabled: t || n,
49
- fullWidth: d,
50
- trailingIcon: l,
59
+ className: `${f.stepperButton} ${t ? f.stepperButtonLoading : ""} ${m ?? ""}`,
60
+ onClick: n,
61
+ disabled: t || s,
62
+ fullWidth: b,
63
+ trailingIcon: B,
64
+ leadingIcon: u,
51
65
  type: e ? "submit" : "button",
52
- buttonSize: m,
53
- children: o
66
+ buttonSize: d,
67
+ children: p
54
68
  }
55
69
  );
56
70
  };
57
71
  export {
58
- x as StepperNextButton,
59
- $ as StepperPreviousButton
72
+ N as StepperNextButton,
73
+ y as StepperPreviousButton
60
74
  };
@@ -1,9 +1,15 @@
1
1
  import { StepperBaseProps } from '../stepperTypes';
2
2
 
3
3
  /**
4
- * A component that displays the header of the stepper, including the step indicator (see {@link StepperIndicator}) and title.
4
+ * A component that displays the specified type of stepper header based on the provided type prop.
5
+ *
6
+ * If the type is 'default', it displays a stepper indicator with dots and the title of the current step.
7
+ * If the type is 'description', it shows the current step out of total steps and the title of the current step.
8
+ *
9
+ * @param stepperType - The type of the stepper indicator.
5
10
  * @param steps - An array of steps for the stepper.
6
11
  * @param currentStep - The current step index.
12
+ * @param customTotalSteps - A custom total number of steps to display in the stepper header.
7
13
  * @returns
8
14
  */
9
- export declare const StepperHeader: ({ steps, currentStep }: StepperBaseProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const StepperHeader: ({ stepperType, steps, currentStep, customTotalSteps, }: StepperBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,34 +1,80 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { G as o } from "../../../index.es-DsGuBR0Z.js";
3
- import { T as p } from "../../../index.es-DCSgIiJH.js";
4
- import { s as i } from "../../../stepper.module-HuqmDJPj.js";
5
- import { StepperIndicator as s } from "./StepperIndicator.js";
6
- const f = ({ steps: e, currentStep: r }) => /* @__PURE__ */ a(
7
- o,
1
+ import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
+ import { G as s } from "../../../index.es-DsGuBR0Z.js";
3
+ import { T as n } from "../../../index.es-DCSgIiJH.js";
4
+ import { s as t } from "../../../stepper.module-c-CWmpkt.js";
5
+ import { StepperIndicator as o } from "./StepperIndicator.js";
6
+ const y = ({
7
+ stepperType: d,
8
+ steps: e,
9
+ currentStep: i,
10
+ customTotalSteps: p
11
+ }) => d === "description" ? /* @__PURE__ */ a(
12
+ s,
13
+ {
14
+ "data-testid": "description-stepper-header",
15
+ className: t.stepperDescriptionContainer,
16
+ secondaryAlign: "stretch",
17
+ gap: "none",
18
+ fullWidth: !0,
19
+ children: [
20
+ /* @__PURE__ */ r(
21
+ s,
22
+ {
23
+ className: t.stepperDescriptionProgress,
24
+ primaryAlign: "center",
25
+ secondaryAlign: "center",
26
+ children: /* @__PURE__ */ a(n, { "data-testid": "description-stepper-header-progress", level: 2, children: [
27
+ e[i].step,
28
+ "/",
29
+ p ?? e.length
30
+ ] })
31
+ }
32
+ ),
33
+ /* @__PURE__ */ r(
34
+ s,
35
+ {
36
+ className: t.stepperDescriptionText,
37
+ primaryAlign: "flex-start",
38
+ secondaryAlign: "center",
39
+ children: /* @__PURE__ */ r(
40
+ n,
41
+ {
42
+ "data-testid": "description-stepper-header-description",
43
+ themeColor: "secondary-font",
44
+ level: 2,
45
+ children: e[i].title ?? ""
46
+ }
47
+ )
48
+ }
49
+ )
50
+ ]
51
+ }
52
+ ) : /* @__PURE__ */ a(
53
+ s,
8
54
  {
9
55
  "data-testid": "stepper-header",
10
- className: i.stepperContainer,
56
+ className: t.stepperContainer,
11
57
  gap: "dense",
12
58
  primaryAlign: "center",
13
59
  secondaryAlign: "center",
14
60
  direction: "vertical",
15
61
  fullWidth: !0,
16
62
  children: [
17
- /* @__PURE__ */ t(s, { steps: e, currentStep: r }),
18
- /* @__PURE__ */ t(
19
- p,
63
+ /* @__PURE__ */ r(o, { steps: e, currentStep: i }),
64
+ /* @__PURE__ */ r(
65
+ n,
20
66
  {
21
67
  "data-testid": "stepper-header-description",
22
68
  level: 2,
23
69
  bold: !0,
24
70
  tag: "div",
25
- className: i.stepperTitle,
26
- children: e[r]?.title
71
+ className: t.stepperTitle,
72
+ children: e[i]?.title
27
73
  }
28
74
  )
29
75
  ]
30
76
  }
31
77
  );
32
78
  export {
33
- f as StepperHeader
79
+ y as StepperHeader
34
80
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { G as p } from "../../../index.es-DsGuBR0Z.js";
3
- import { s as e } from "../../../stepper.module-HuqmDJPj.js";
3
+ import { s as e } from "../../../stepper.module-c-CWmpkt.js";
4
4
  const m = ({ steps: a, currentStep: i }) => /* @__PURE__ */ r(p, { gap: "dense", "data-testid": "stepper-indicator", children: a.map((t, o) => /* @__PURE__ */ r(
5
5
  "div",
6
6
  {
@@ -15,17 +15,21 @@ export type Step = {
15
15
  */
16
16
  name: string;
17
17
  /**
18
- * The step number, starting from 0.
18
+ * The step number that is displayed when the stepper type is 'description'.
19
+ * @remarks This property is not visible within the stepper type 'default' and only serves as an identifier for the step.
19
20
  */
20
21
  step: number;
21
22
  /**
22
- * The title of the step showing in the Stepper.
23
+ * The title/description of the step showing in the Stepper.
23
24
  */
24
- title: string;
25
+ title: string | ReactNode;
25
26
  /**
26
27
  * Whether the step is optional or not showing a different design.
28
+ *
29
+ * @remarks There's no adjusted display logic for optional steps when using the description type stepper.
30
+ * In that case, use the title prop / description to indicate that the step is optional.
27
31
  */
28
- optional: boolean;
32
+ optional?: boolean;
29
33
  /**
30
34
  * The props for the next button, including onClick, label, className and disabled state. {@link StepperButtonProps}
31
35
  */
@@ -40,6 +44,8 @@ export type Step = {
40
44
  * @param {boolean} disabled - Whether the button is disabled or not.
41
45
  * @param {() => void} onClick - The function to be called when the button is clicked.
42
46
  * @param {string | ReactNode} label - The label of the button.
47
+ * @param {string | ReactNode} leadingIcon - A custom leading icon for the button. Takes precedence over showArrowIcon.
48
+ * @param {string | ReactNode} trailingIcon - A custom trailing icon for the button. Takes precedence over showArrowIcon.
43
49
  * @param {boolean} showArrowIcon - Whether to show a leading/trailing arrow icon for the button.
44
50
  * @param {string} buttonSize - The size of the button, defaults to 'themeDefault'.
45
51
  * @param {boolean} fullWidth - Whether the button should take the full width of its container. *
@@ -57,12 +63,21 @@ export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'f
57
63
  * Whether to show a leading/trailing arrow icon for the button.
58
64
  */
59
65
  showArrowIcon?: boolean;
66
+ /**
67
+ * A custom leading icon for the button. Takes precedence over showArrowIcon.
68
+ */
69
+ leadingIcon?: string | ReactNode;
70
+ /**
71
+ * A custom trailing icon for the button. Takes precedence over showArrowIcon.
72
+ */
73
+ trailingIcon?: string | ReactNode;
60
74
  /**
61
75
  * Property adapted from Element library
62
76
  */
63
77
  buttonSize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'themeDefault';
64
78
  };
65
79
  /**
80
+ * @param {string} stepperType - The type of the stepper indicator. Defaults to 'dots'.
66
81
  * @param {Step[]} steps - An array of steps for the stepper.
67
82
  * @param {number} currentStep - The current step index.
68
83
  * @param {boolean} isStepLoading - A boolean indicating if the current step is loading. If true, the next button will be disabled and show a loading state.
@@ -71,10 +86,23 @@ export type StepperButtonProps = Pick<ButtonProps, 'className' | 'disabled' | 'f
71
86
  * @param {boolean} showPreviousButtonOnFirstStep - A flag which indicates if the previous button should be shown on the first step. This can be useful for canceling the stepper.
72
87
  */
73
88
  export type StepperProps = {
89
+ /**
90
+ * The display-type of the Stepper.
91
+ * - `default` – Shows a row of dots for each step.
92
+ * - `description` – Displays progress numerically (n/n) and the title next to it.
93
+ *
94
+ * @default default
95
+ */
96
+ stepperType?: 'default' | 'description';
74
97
  /**
75
98
  * An array of steps for the stepper.
76
99
  */
77
100
  steps: Step[];
101
+ /**
102
+ * A custom total number of steps to display in the stepper header.
103
+ * @remarks This can be used to show a different total number of steps than the length of the steps array.
104
+ */
105
+ customTotalSteps?: number;
78
106
  /**
79
107
  * The current step index.
80
108
  */
@@ -101,7 +129,9 @@ export type StepperProps = {
101
129
  showPreviousButtonOnFirstStep?: boolean;
102
130
  };
103
131
  /**
132
+ * @param {string} type - The type of the stepper indicator.
104
133
  * @param {Step[]} steps - An array of steps for the stepper.
105
134
  * @param {number} currentStep - The current step index.
135
+ * @param {number} customTotalSteps - A custom total number of steps to display in the stepper header.
106
136
  */
107
- export type StepperBaseProps = Pick<StepperProps, 'steps' | 'currentStep'>;
137
+ export type StepperBaseProps = Pick<StepperProps, 'stepperType' | 'steps' | 'currentStep' | 'customTotalSteps'>;