@hortiview/shared-components 2.14.0 → 2.16.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 (60) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/AlertBanner-aW6joVUm.js +35 -0
  3. package/dist/GenericCard-IWX-Bmb_.js +90 -0
  4. package/dist/assets/ButtonCard.css +1 -0
  5. package/dist/assets/ConfirmationModal.css +1 -0
  6. package/dist/assets/GenericCard.css +1 -1
  7. package/dist/assets/GenericTable.css +1 -1
  8. package/dist/assets/InfoCard.css +1 -1
  9. package/dist/assets/stepper.css +1 -1
  10. package/dist/components/AlertBanner/AlertBanner.d.ts +5 -1
  11. package/dist/components/AlertBanner/AlertBanner.js +1 -1
  12. package/dist/components/AlertBanner/AlertBanner.test.js +9 -7
  13. package/dist/components/AlertBanner/LinkBanner.js +1 -1
  14. package/dist/components/AlertBanner/LinkBanner.test.js +3 -3
  15. package/dist/components/BaseView/BaseView.test.js +1 -1
  16. package/dist/components/ButtonCard/ButtonCard.d.ts +42 -0
  17. package/dist/components/ButtonCard/ButtonCard.js +51 -0
  18. package/dist/components/ButtonCard/ButtonCard.test.d.ts +1 -0
  19. package/dist/components/ButtonCard/ButtonCard.test.js +92 -0
  20. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +77 -0
  21. package/dist/components/ConfirmationModal/ConfirmationModal.js +90 -0
  22. package/dist/components/ConfirmationModal/ConfirmationModal.test.d.ts +1 -0
  23. package/dist/components/ConfirmationModal/ConfirmationModal.test.js +221 -0
  24. package/dist/components/DeleteModal/DeleteModal.js +6 -6
  25. package/dist/components/Filter/Filter.js +3 -3
  26. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +1 -1
  27. package/dist/components/FormComponents/FormNumber/CustomTextField.js +1 -1
  28. package/dist/components/FormComponents/FormSlider/FormSlider.js +1 -1
  29. package/dist/components/FormComponents/FormText/FormText.js +1 -1
  30. package/dist/components/GenericTable/GenericTable.js +145 -137
  31. package/dist/components/GenericTable/Mobile/GenericCard.js +1 -1
  32. package/dist/components/GenericTable/Mobile/GenericCard.test.js +1 -1
  33. package/dist/components/GenericTable/Mobile/GenericCardList.js +11 -11
  34. package/dist/components/InfoCard/InfoCard.d.ts +6 -2
  35. package/dist/components/InfoCard/InfoCard.js +50 -37
  36. package/dist/components/InfoCard/InfoCard.test.js +40 -18
  37. package/dist/components/ModulePadding/ModulePadding.js +2 -2
  38. package/dist/components/SearchBar/SearchBar.js +1 -1
  39. package/dist/components/Stepper/Stepper.d.ts +13 -6
  40. package/dist/components/Stepper/Stepper.js +94 -39
  41. package/dist/components/Stepper/Stepper.test.js +305 -121
  42. package/dist/components/Stepper/components/StepperButton.js +1 -1
  43. package/dist/components/Stepper/components/StepperHeader.d.ts +1 -10
  44. package/dist/components/Stepper/components/StepperHeader.js +140 -69
  45. package/dist/components/Stepper/components/StepperItem.d.ts +8 -0
  46. package/dist/components/Stepper/components/StepperItem.js +44 -0
  47. package/dist/components/Stepper/stepperTypes.d.ts +105 -46
  48. package/dist/components/Stepper/stepperTypes.js +4 -1
  49. package/dist/{index.es-B74L_Dje.js → index.es-BYcQTTL8.js} +3 -3
  50. package/dist/{index.es-C7cC1Hdu.js → index.es-C32E1Lcb.js} +1 -1
  51. package/dist/main.d.ts +2 -1
  52. package/dist/main.js +118 -116
  53. package/dist/services/UtilService.js +2 -2
  54. package/dist/stepper.module-DR_FbENS.js +23 -0
  55. package/package.json +3 -2
  56. package/dist/AlertBanner-Ci-F-6S9.js +0 -26
  57. package/dist/GenericCard-CeqYrtLH.js +0 -89
  58. package/dist/components/Stepper/components/StepperIndicator.d.ts +0 -9
  59. package/dist/components/Stepper/components/StepperIndicator.js +0 -16
  60. package/dist/stepper.module-c-CWmpkt.js +0 -15
@@ -4,7 +4,7 @@ import "../../../index.es-CeQB6igi.js";
4
4
  import "../../../index.es-SjZ_-d7U.js";
5
5
  import "react";
6
6
  import "../../OverflowTooltip/OverflowTooltip.js";
7
- import { G } from "../../../GenericCard-CeqYrtLH.js";
7
+ import { G } from "../../../GenericCard-IWX-Bmb_.js";
8
8
  export {
9
9
  G as GenericCard
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { a as c, s as o } from "../../../react.esm-Bm0cAgpZ.js";
3
- import { G as i } from "../../../GenericCard-CeqYrtLH.js";
3
+ import { G as i } from "../../../GenericCard-IWX-Bmb_.js";
4
4
  import { d as m, t as s, g as e } from "../../../vi.bdSIJ99Y-B308Q-4w.js";
5
5
  m("GenericCard", () => {
6
6
  const d = {
@@ -1,25 +1,25 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { G as c } from "../../../index.es-oxil0uFe.js";
3
- import { P as l } from "../../../index.es-BanVdXEd.js";
2
+ import { G as l } from "../../../index.es-oxil0uFe.js";
3
+ import { P as c } from "../../../index.es-BanVdXEd.js";
4
4
  import { a as o } from "../../../index.es-SjZ_-d7U.js";
5
- import { s as i, G as m } from "../../../GenericCard-CeqYrtLH.js";
6
- const u = ({
5
+ import { s as e, G as m } from "../../../GenericCard-IWX-Bmb_.js";
6
+ const g = ({
7
7
  columns: n,
8
- data: e,
8
+ data: t,
9
9
  hiddenColumns: a = [],
10
- noContentText: d
11
- }) => e?.length === 0 ? /* @__PURE__ */ r("div", { "data-testid": "empty-generic-card-list", className: i.emptyContainer, children: /* @__PURE__ */ r(l, { variant: "standard", style: { textAlign: "center" }, className: i.empty, children: /* @__PURE__ */ r(o, { children: d }) }) }) : (
10
+ noContentText: s
11
+ }) => t?.length === 0 ? /* @__PURE__ */ r("div", { "data-testid": "empty-generic-card-list", className: e.emptyContainer, children: /* @__PURE__ */ r(c, { variant: "standard", style: { textAlign: "center" }, className: e.empty, children: /* @__PURE__ */ r(o, { children: s }) }) }) : (
12
12
  // needs the div to surround the Group by an element with display: block to avoid visual errors
13
- /* @__PURE__ */ r("div", { "data-testid": "generic-card-list", style: { width: "100%" }, children: /* @__PURE__ */ r(c, { fullWidth: !0, direction: "vertical", primaryAlign: "center", secondaryAlign: "center", children: e?.map((t, s) => /* @__PURE__ */ r(
13
+ /* @__PURE__ */ r("div", { className: e.fullWidth, children: /* @__PURE__ */ r(l, { fullWidth: !0, direction: "vertical", primaryAlign: "center", secondaryAlign: "center", children: t?.map((i, d) => /* @__PURE__ */ r(
14
14
  m,
15
15
  {
16
- item: t,
16
+ item: i,
17
17
  columns: n,
18
18
  hiddenColumns: a
19
19
  },
20
- t.id ?? s
20
+ i.id ?? d
21
21
  )) }) })
22
22
  );
23
23
  export {
24
- u as GenericCardList
24
+ g as GenericCardList
25
25
  };
@@ -12,7 +12,11 @@ export type InfoCardProps = {
12
12
  /**
13
13
  * Type of the failed health check. Depending on the type, a different icon of 3rem size will be displayed.
14
14
  */
15
- type: 'database' | 'iot' | 'platform' | 'done' | 'other';
15
+ type: 'database' | 'iot' | 'platform' | 'done' | 'other' | 'celebration';
16
+ /**
17
+ * The color of the icon. Depending on the type, a different default color will be applied, but it can be overridden by providing a value for this prop.
18
+ */
19
+ colorOverride?: 'primary' | 'secondary' | 'success' | 'danger';
16
20
  /**
17
21
  * The card has a default outline. For design consistency, this prop should only be set to 'false' if the card is embedded, e.g. in a table.
18
22
  */
@@ -22,4 +26,4 @@ export type InfoCardProps = {
22
26
  */
23
27
  isFullHeight?: boolean;
24
28
  };
25
- export declare const InfoCard: ({ title, subtitle, type, isOutlined, isFullHeight, }: InfoCardProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const InfoCard: ({ title, subtitle, type, colorOverride, isOutlined, isFullHeight, }: InfoCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,59 +1,72 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { C as d, a as _, b as h } from "../../index.es-BPv5dCFQ.js";
3
- import { G as m } from "../../index.es-oxil0uFe.js";
4
- import { P as f } from "../../index.es-BanVdXEd.js";
5
- import { T as s } from "../../index.es-SjZ_-d7U.js";
6
- import { Iconify as u } from "../Iconify/Iconify.js";
7
- import '../../assets/InfoCard.css';const x = "_database_x7426_1", p = "_spin_x7426_1", g = "_done_x7426_16", C = "_iot_x7426_20", y = "_platform_x7426_21", b = "_other_x7426_22", N = "_crossedOut_x7426_26", H = "_fullHeight_x7426_45", T = "_centerText_x7426_49", n = {
8
- database: x,
9
- spin: p,
10
- done: g,
11
- iot: C,
12
- platform: y,
13
- other: b,
14
- crossedOut: N,
15
- fullHeight: H,
16
- centerText: T
17
- }, G = ({
18
- title: t,
19
- subtitle: c,
20
- type: a,
21
- isOutlined: i = !0,
22
- isFullHeight: r = !1
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { C as _, a as p, b as m } from "../../index.es-BPv5dCFQ.js";
3
+ import { G as h } from "../../index.es-oxil0uFe.js";
4
+ import { P as u } from "../../index.es-BanVdXEd.js";
5
+ import { T as c } from "../../index.es-SjZ_-d7U.js";
6
+ import { Iconify as f } from "../Iconify/Iconify.js";
7
+ import '../../assets/InfoCard.css';const g = "_database_1vpro_1", v = "_spin_1vpro_1", y = "_done_1vpro_16", b = "_iot_1vpro_20", C = "_platform_1vpro_21", x = "_other_1vpro_22", N = "_celebration_1vpro_26", H = "_primary_1vpro_30", T = "_secondary_1vpro_34", k = "_danger_1vpro_38", I = "_success_1vpro_42", A = "_crossedOut_1vpro_46", O = "_fullHeight_1vpro_65", j = "_centerText_1vpro_69", r = {
8
+ database: g,
9
+ spin: v,
10
+ done: y,
11
+ iot: b,
12
+ platform: C,
13
+ other: x,
14
+ celebration: N,
15
+ primary: H,
16
+ secondary: T,
17
+ danger: k,
18
+ success: I,
19
+ crossedOut: A,
20
+ fullHeight: O,
21
+ centerText: j
22
+ }, q = ({
23
+ title: o,
24
+ subtitle: t,
25
+ type: n,
26
+ colorOverride: i,
27
+ isOutlined: l = !0,
28
+ isFullHeight: s = !1
23
29
  }) => {
24
- const o = r ? n.fullHeight : "";
30
+ const a = s ? r.fullHeight : "";
25
31
  return /* @__PURE__ */ e(
26
- d,
32
+ _,
27
33
  {
28
- variant: i ? "outlined" : "flat",
29
- "data-testid": `${a}-health-check-failed-card`,
34
+ variant: l ? "outlined" : "flat",
35
+ "data-testid": `${n}-health-check-failed-card`,
30
36
  bodyAlignment: "centered",
31
- height: r ? "100%" : "auto",
32
- children: /* @__PURE__ */ e(_, { className: o, children: /* @__PURE__ */ e(f, { variant: "airy", className: o, children: /* @__PURE__ */ e(h, { className: o, children: /* @__PURE__ */ l(
33
- m,
37
+ height: s ? "100%" : "auto",
38
+ children: /* @__PURE__ */ e(p, { className: a, children: /* @__PURE__ */ e(u, { variant: "airy", className: a, children: /* @__PURE__ */ e(m, { className: a, children: /* @__PURE__ */ d(
39
+ h,
34
40
  {
35
41
  gap: "none",
36
42
  primaryAlign: "center",
37
43
  secondaryAlign: "center",
38
44
  direction: "vertical",
39
45
  fullWidth: !0,
40
- className: n.centerText,
46
+ className: r.centerText,
41
47
  children: [
42
- /* @__PURE__ */ e(v, { type: a }),
43
- /* @__PURE__ */ e(s, { level: 1, bold: !0, children: t }),
44
- /* @__PURE__ */ e(s, { level: 2, themeColor: "text-secondary-on-background", children: c })
48
+ /* @__PURE__ */ e(F, { type: n, colorOverride: i }),
49
+ /* @__PURE__ */ e(c, { level: 1, bold: !0, children: o }),
50
+ /* @__PURE__ */ e(c, { level: 2, themeColor: "text-secondary-on-background", children: t })
45
51
  ]
46
52
  }
47
53
  ) }) }) })
48
54
  }
49
55
  );
50
- }, k = {
56
+ }, B = {
51
57
  database: "sync",
52
58
  iot: "settings_input_antenna",
53
59
  platform: "engineering",
54
60
  done: "sunny-check",
55
- other: "error"
56
- }, v = ({ type: t }) => /* @__PURE__ */ e("span", { className: t === "iot" ? n.crossedOut : "", children: /* @__PURE__ */ e(u, { icon: k[t], className: n[t], iconSize: "xlarge" }) });
61
+ other: "error",
62
+ celebration: "celebration"
63
+ }, F = ({
64
+ type: o,
65
+ colorOverride: t
66
+ }) => {
67
+ const n = t ? r[t] : r[o];
68
+ return /* @__PURE__ */ e("span", { className: o === "iot" ? r.crossedOut : "", children: /* @__PURE__ */ e(f, { icon: B[o], className: n, iconSize: "xlarge" }) });
69
+ };
57
70
  export {
58
- G as InfoCard
71
+ q as InfoCard
59
72
  };
@@ -1,26 +1,48 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { a as r, s as e } from "../../react.esm-Bm0cAgpZ.js";
3
- import { InfoCard as s } from "./InfoCard.js";
4
- import { d as h, t as i, g as t } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
- h("HealthCheckFailed Component", () => {
6
- const n = "Test Title", c = "Test Subtitle";
2
+ import { a as r, s as t } from "../../react.esm-Bm0cAgpZ.js";
3
+ import { InfoCard as n } from "./InfoCard.js";
4
+ import { d as l, t as i, g as o } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
+ l("HealthCheckFailed Component", () => {
6
+ const c = "Test Title", s = "Test Subtitle";
7
7
  i("displays the correct title and subtitle", () => {
8
- r(/* @__PURE__ */ a(s, { title: n, subtitle: c, type: "database" })), t(e.getByText(n)).toBeInTheDocument(), t(e.getByText(c)).toBeInTheDocument();
8
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database" })), o(t.getByText(c)).toBeInTheDocument(), o(t.getByText(s)).toBeInTheDocument();
9
9
  }), i('displays the correct icon for type "database"', () => {
10
- r(/* @__PURE__ */ a(s, { title: n, subtitle: c, type: "database" }));
11
- const o = e.getByText("sync");
12
- t(o).toBeInTheDocument(), t(e.getByTestId("database-health-check-failed-card")).toBeInTheDocument();
10
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database" }));
11
+ const e = t.getByText("sync");
12
+ o(e).toBeInTheDocument(), o(t.getByTestId("database-health-check-failed-card")).toBeInTheDocument();
13
13
  }), i('displays the correct icon for type "iot"', () => {
14
- r(/* @__PURE__ */ a(s, { title: n, subtitle: c, type: "iot" }));
15
- const o = e.getByText("settings_input_antenna");
16
- t(o).toBeInTheDocument(), t(e.getByTestId("iot-health-check-failed-card")).toBeInTheDocument();
14
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "iot" }));
15
+ const e = t.getByText("settings_input_antenna");
16
+ o(e).toBeInTheDocument(), o(t.getByTestId("iot-health-check-failed-card")).toBeInTheDocument();
17
17
  }), i('displays the correct icon for type "platform"', () => {
18
- r(/* @__PURE__ */ a(s, { title: n, subtitle: c, type: "platform" }));
19
- const o = e.getByText("engineering");
20
- t(o).toBeInTheDocument(), t(e.getByTestId("platform-health-check-failed-card")).toBeInTheDocument();
18
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "platform" }));
19
+ const e = t.getByText("engineering");
20
+ o(e).toBeInTheDocument(), o(t.getByTestId("platform-health-check-failed-card")).toBeInTheDocument();
21
21
  }), i('displays the correct icon for type "other"', () => {
22
- r(/* @__PURE__ */ a(s, { title: n, subtitle: c, type: "other" }));
23
- const o = e.getByText("error");
24
- t(o).toBeInTheDocument(), t(e.getByTestId("other-health-check-failed-card")).toBeInTheDocument();
22
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "other" }));
23
+ const e = t.getByText("error");
24
+ o(e).toBeInTheDocument(), o(t.getByTestId("other-health-check-failed-card")).toBeInTheDocument();
25
+ }), i('displays the correct icon for type "celebration"', () => {
26
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "celebration" }));
27
+ const e = t.getByText("celebration");
28
+ o(e).toBeInTheDocument(), o(t.getByTestId("celebration-health-check-failed-card")).toBeInTheDocument();
29
+ }), i("applies colorOverride class for primary", () => {
30
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database", colorOverride: "primary" }));
31
+ const e = t.getByText("sync").closest("span")?.querySelector("svg, span, i");
32
+ o(e?.className).toMatch(/primary/);
33
+ }), i("applies colorOverride class for secondary", () => {
34
+ r(
35
+ /* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database", colorOverride: "secondary" })
36
+ );
37
+ const e = t.getByText("sync").closest("span")?.querySelector("svg, span, i");
38
+ o(e?.className).toMatch(/secondary/);
39
+ }), i("applies colorOverride class for success", () => {
40
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database", colorOverride: "success" }));
41
+ const e = t.getByText("sync").closest("span")?.querySelector("svg, span, i");
42
+ o(e?.className).toMatch(/success/);
43
+ }), i("applies colorOverride class for danger", () => {
44
+ r(/* @__PURE__ */ a(n, { title: c, subtitle: s, type: "database", colorOverride: "danger" }));
45
+ const e = t.getByText("sync").closest("span")?.querySelector("svg, span, i");
46
+ o(e?.className).toMatch(/danger/);
25
47
  });
26
48
  });
@@ -5,6 +5,8 @@ import "react";
5
5
  import { u as m } from "../../useBreakpoints-MzTZ0tCT.js";
6
6
  import "../../react-tooltip.min-CVsI--2Y.js";
7
7
  import "../../orderBy-DLBJlgdL.js";
8
+ import "../../index-CuHybtft.js";
9
+ import "../SharedComponentsPermissionProvider/PermissionContext.js";
8
10
  import "../../uniqueId-BNVTeImh.js";
9
11
  import "react-hook-form";
10
12
  import "../../get-D8IXqiys.js";
@@ -12,8 +14,6 @@ import "../../isArray-BjSPDQ4v.js";
12
14
  import "../../isString-DVA49FEo.js";
13
15
  import "../../omit-CYY_mIYv.js";
14
16
  import "../../types/Time.js";
15
- import "../../index-CuHybtft.js";
16
- import "../SharedComponentsPermissionProvider/PermissionContext.js";
17
17
  import "../../react.esm-Bm0cAgpZ.js";
18
18
  const D = ({ children: o }) => {
19
19
  const { isDesktop: t } = m();
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { I as l } from "../../index.es-t87yNd9Y.js";
3
- import { T as u } from "../../index.es-B74L_Dje.js";
3
+ import { T as u } from "../../index.es-BYcQTTL8.js";
4
4
  import '../../assets/SearchBar.css';const b = "_searchbar_g83qp_1", d = {
5
5
  searchbar: b
6
6
  }, g = ({
@@ -3,19 +3,26 @@ import { StepperProps } from './stepperTypes';
3
3
 
4
4
  /**
5
5
  * A component that displays a stepper with a header, content, and navigation buttons.<br />
6
- * Available in two display types: 'default' (dots) and 'description' (numerical with description).
6
+ * Available in three display types: 'desktop', 'small' and 'dots'.<br />
7
+ *
8
+ * - Desktop: Default EDS-like styling
9
+ * - Small: A compact version of the desktop stepper showing only the current step and total steps in the header, as well as the title of the current step.
10
+ * - Dots: A minimal version showing only centered dots for each step and the title of the current step in the header.
11
+ *
7
12
  *
8
13
  * **!! Be aware that the stepper is not a controlled component, so you need to manage the current step, content and loading state yourself. !!**
9
14
  *
10
- * @param stepperType - The type of the stepper indicator. Defaults to 'default' (dots).
15
+ * @param stepperType - The type of the stepper indicator. Defaults to 'desktop'.
11
16
  * @param steps - An array of steps for the stepper.
12
- * @param currentStep - The current step index.
13
- * @param customTotalSteps - A custom total number of steps to display in the stepper header. Only applicable for 'description' type.
14
- * @param children - The content to be displayed in the stepper.
17
+ * @param currentStepId - The current step id, matching the id property of one of the steps in
18
+ * the steps array.
19
+ * @param overwriteTotalSteps - A custom total number of steps to display in the stepper header. Only applicable for 'small' stepper.
15
20
  * @param isStepLoading - A boolean indicating if the current step is loading. If true, the next button will be disabled and show a loading state.
16
21
  * @param showStepperHeader - An indicator of whether to show the stepper header. Defaults to true.
22
+ * @param showStepperButtons - An indicator of whether to show the stepper buttons. Defaults to true.
17
23
  * @param stepperButtonAlignment - The alignment of the stepper button group. Defaults to 'center'.
18
24
  * @param showPreviousButtonOnFirstStep - A flag which indicates if the previous button should be shown on the first step. This can be useful for canceling the stepper. Defaults to false.
25
+ * @param children - The content to be displayed in the stepper.
19
26
  * @returns
20
27
  */
21
- export declare const Stepper: ({ stepperType, steps, currentStep, customTotalSteps, children, isStepLoading, showStepperHeader, stepperButtonAlignment, showPreviousButtonOnFirstStep, }: PropsWithChildren<StepperProps>) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const Stepper: ({ stepperType, steps, currentStepId, overwriteTotalSteps, isStepLoading, showStepperHeader, showStepperButtons, stepperButtonAlignment, showPreviousButtonOnFirstStep, children, }: PropsWithChildren<StepperProps>) => import("react/jsx-runtime").JSX.Element | null;
@@ -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 D } from "../../stepper.module-DR_FbENS.js";
7
+ import { StepperType as S } from "./stepperTypes.js";
8
+ const T = ({
9
+ stepperType: h = S.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
+ stepperType: 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: D.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
+ T as Stepper
76
131
  };