@hortiview/shared-components 2.15.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 (53) hide show
  1. package/CHANGELOG.md +6 -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 +13 -6
  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 +1 -10
  38. package/dist/components/Stepper/components/StepperHeader.js +140 -69
  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/stepperTypes.d.ts +105 -46
  42. package/dist/components/Stepper/stepperTypes.js +4 -1
  43. package/dist/{index.es-B74L_Dje.js → index.es-BYcQTTL8.js} +3 -3
  44. package/dist/{index.es-C7cC1Hdu.js → index.es-C32E1Lcb.js} +1 -1
  45. package/dist/main.d.ts +2 -1
  46. package/dist/main.js +118 -116
  47. package/dist/services/UtilService.js +2 -2
  48. package/dist/stepper.module-DR_FbENS.js +23 -0
  49. package/package.json +3 -2
  50. package/dist/AlertBanner-Ci-F-6S9.js +0 -26
  51. package/dist/components/Stepper/components/StepperIndicator.d.ts +0 -9
  52. package/dist/components/Stepper/components/StepperIndicator.js +0 -16
  53. package/dist/stepper.module-c-CWmpkt.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.16.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.15.0...v2.16.0) (2026-02-20)
2
+
3
+ ### Features
4
+
5
+ * add new UI components, enhance Stepper, and extend AlertBanner & InfoCard functionality ([f690592](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/f690592e99037fef438c4b5f0edd06747b7a6e19)), closes [#18954](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/issues/18954) [#19035](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/issues/19035)
6
+
1
7
  ## [2.15.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.14.0...v2.15.0) (2026-02-18)
2
8
 
3
9
  ### Features
@@ -0,0 +1,35 @@
1
+ import { jsx as n, Fragment as t, jsxs as l } from "react/jsx-runtime";
2
+ import { G as _ } from "./index.es-oxil0uFe.js";
3
+ import { I as m } from "./index.es-Dgxrk6xW.js";
4
+ import { T as d } from "./index.es-SjZ_-d7U.js";
5
+ import './assets/AlertBanner.css';const g = "_messageContainer_2hnjr_1", h = "_info_2hnjr_9", f = "_danger_2hnjr_14", p = "_success_2hnjr_19", u = "_warning_2hnjr_24", j = "_closeIcon_2hnjr_29", y = "_linkBanner_2hnjr_34", s = {
6
+ messageContainer: g,
7
+ info: h,
8
+ danger: f,
9
+ success: p,
10
+ warning: u,
11
+ closeIcon: j,
12
+ linkBanner: y
13
+ }, C = ({
14
+ text: e,
15
+ id: o,
16
+ color: a = "info",
17
+ isOpen: c = !0,
18
+ isBold: i = !0,
19
+ onClose: r
20
+ }) => c ? /* @__PURE__ */ n(
21
+ "div",
22
+ {
23
+ id: o,
24
+ "data-testid": "alert-banner",
25
+ className: `${s.messageContainer} ${s[a]}`,
26
+ children: /* @__PURE__ */ l(_, { primaryAlign: "space-between", gap: "dense", fullWidth: !0, children: [
27
+ typeof e == "string" ? /* @__PURE__ */ n(d, { bold: i, level: 2, children: e }) : /* @__PURE__ */ n("div", { style: { width: "100%" }, children: e }),
28
+ r && /* @__PURE__ */ n(m, { icon: "close", iconSize: "small", onClick: r, className: s.closeIcon })
29
+ ] })
30
+ }
31
+ ) : /* @__PURE__ */ n(t, {});
32
+ export {
33
+ C as A,
34
+ s
35
+ };
@@ -0,0 +1 @@
1
+ ._buttonCard_1fv6b_1[class*="lmnt mdc-button"]{height:auto;border-radius:5px;border-bottom:2px solid rgba(0,0,0,.12);justify-content:flex-start}._buttonCard_1fv6b_1>span[class*=mdc-button__ripple]{border-radius:5px}._noInteraction_1fv6b_12{pointer-events:none}._iconContainer_1fv6b_16{display:flex;align-items:center;justify-content:center;width:40px;height:40px;min-width:40px;border-radius:50%;background-color:var(--lmnt-theme-primary);color:var(--lmnt-theme-on-primary)}._iconContainer_1fv6b_16._iconContainer_1fv6b_16._iconContainer_1fv6b_16 i[class*="lmnt lmnt-icon material-icons lmnt-icon--medium"]{margin-left:unset;margin-right:unset;width:24px;height:24px;font-size:24px}._centerText_1fv6b_43{text-align:start}
@@ -0,0 +1 @@
1
+ ._bulletPoint_v4va9_1{display:list-item;margin-left:1.5rem}._modal_v4va9_7 [class*="lmnt-modal__actions mdc-dialog__actions"]{margin-bottom:0!important}._primary_v4va9_11{color:var(--lmnt-theme-primary)}._secondary_v4va9_15{color:var(--lmnt-theme-secondary)}._success_v4va9_19{color:var(--lmnt-theme-success)}._danger_v4va9_23{color:var(--lmnt-theme-danger)}._fullHeight_v4va9_27{height:100%}
@@ -1 +1 @@
1
- ._database_x7426_1{color:var(--lmnt-theme-secondary);animation:_spin_x7426_1 4s linear infinite}@keyframes _spin_x7426_1{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}._done_x7426_16{color:var(--lmnt-theme-success)}._iot_x7426_20,._platform_x7426_21,._other_x7426_22{color:var(--lmnt-theme-danger)}._crossedOut_x7426_26{position:relative;display:inline-block}._crossedOut_x7426_26:after{content:"";position:absolute;width:3rem;height:.25rem;left:50%;top:50%;background:var(--lmnt-theme-danger-on-surface);box-shadow:0 0 0 .125rem var(--lmnt-theme-background);transform:translate(-50%,calc(-50% - .25rem)) rotate(45deg);transform-origin:center;z-index:2}._fullHeight_x7426_45{height:100%}._centerText_x7426_49{text-align:center}
1
+ ._database_1vpro_1{color:var(--lmnt-theme-secondary);animation:_spin_1vpro_1 4s linear infinite}@keyframes _spin_1vpro_1{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}._done_1vpro_16{color:var(--lmnt-theme-success)}._iot_1vpro_20,._platform_1vpro_21,._other_1vpro_22{color:var(--lmnt-theme-danger)}._celebration_1vpro_26,._primary_1vpro_30{color:var(--lmnt-theme-primary)}._secondary_1vpro_34{color:var(--lmnt-theme-secondary)}._danger_1vpro_38{color:var(--lmnt-theme-danger)}._success_1vpro_42{color:var(--lmnt-theme-success)}._crossedOut_1vpro_46{position:relative;display:inline-block}._crossedOut_1vpro_46:after{content:"";position:absolute;width:3rem;height:.25rem;left:50%;top:50%;background:var(--lmnt-theme-danger-on-surface);box-shadow:0 0 0 .125rem var(--lmnt-theme-background);transform:translate(-50%,calc(-50% - .25rem)) rotate(45deg);transform-origin:center;z-index:2}._fullHeight_1vpro_65{height:100%}._centerText_1vpro_69{text-align:center}
@@ -1 +1 @@
1
- ._stepperIndicatorItem_x786o_1{height:var(--lmnt-stepper-indicator__size);width:var(--lmnt-stepper-indicator__size);background-color:#c7c7c7;border-radius:50%}._stepperIndicatorItemActive_x786o_8{background-color:var(--lmnt-theme-primary)}._stepperIndicatorItemOptional_x786o_12{border:1.5px dashed #7e7e7e}._stepperContainer_x786o_16{background-color:var(--lmnt-theme-primary-50);border:1px solid var(--lmnt-theme-on-surface-stroke);border-radius:.25rem;padding:.75rem 1rem}._stepperTitle_x786o_23{text-align:center;color:var(--lmnt-theme-on-secondary-inactive)}._stepperButton_x786o_28{margin-bottom:0}._stepperButtonLoading_x786o_32{padding-top:.375rem!important;padding-bottom:.375rem!important}._stepperButtonLoading_x786o_32 svg{stroke:var(--lmnt-theme-white)!important}._stepperDescriptionContainer_x786o_43{border-radius:.2rem;background-color:var(--lmnt-theme-primary-50);border:1px solid var(--lmnt-theme-on-surface-stroke)}._stepperDescriptionProgress_x786o_49{padding:0 1rem;min-width:3.5rem;background:var(--lmnt-theme-primary);color:var(--lmnt-theme-on-primary);border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}._stepperDescriptionText_x786o_60{padding:.7rem}
1
+ ._stepperIndicatorItem_1tz4b_1{height:var(--lmnt-stepper-indicator__size);width:var(--lmnt-stepper-indicator__size);background-color:#c7c7c7;border-radius:50%}._stepperIndicatorItemActive_1tz4b_8{background-color:var(--lmnt-theme-primary)}._stepperIndicatorItemOptional_1tz4b_12{border:1.5px dashed #7e7e7e}._stepperContainer_1tz4b_16{background-color:var(--lmnt-theme-primary-50);border:1px solid var(--lmnt-theme-on-surface-stroke);border-radius:.25rem;padding:.75rem 1rem}._stepperTitle_1tz4b_23{text-align:center;color:var(--lmnt-theme-on-secondary-inactive)}._stepperButton_1tz4b_28{margin-bottom:0}._stepperButtonLoading_1tz4b_32{padding-top:.375rem!important;padding-bottom:.375rem!important}._stepperButtonLoading_1tz4b_32 svg{stroke:var(--lmnt-theme-white)!important}._stepperDescriptionContainer_1tz4b_43{border-radius:.2rem;background-color:var(--lmnt-theme-primary-50);border:1px solid var(--lmnt-theme-on-surface-stroke)}._stepperDescriptionProgress_1tz4b_49{padding:0 1rem;min-width:3.5rem;background:var(--lmnt-theme-primary);color:var(--lmnt-theme-on-primary);border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}._stepperDescriptionText_1tz4b_60{padding:.7rem}._stepperDesktopHeaderContainer_1tz4b_66{border-radius:.5rem;padding:1rem;background-color:#ecf4f4}._stepperItem_1tz4b_73 ._stepperItemNumber_1tz4b_73{display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:32px;border-radius:50%;background-color:var(--lmnt-theme-surface-variant);color:var(--lmnt-theme-on-surface-inactive);transition:background-color .6s ease}._stepperItem_1tz4b_73 ._stepperItemNumberActive_1tz4b_91{background-color:var(--lmnt-theme-primary);color:var(--lmnt-theme-on-primary)}._stepperItem_1tz4b_73 ._itemText_1tz4b_96{transition:color .6s ease;color:var(--lmnt-theme-on-surface-inactive)}._stepperItem_1tz4b_73 ._itemTextActive_1tz4b_101{color:var(--lmnt-theme-on-surface-active)}._stepperItemConnector_1tz4b_105{flex:1;height:4px;border:none;border-radius:2px;background:linear-gradient(90deg,var(--lmnt-theme-primary) 0%,var(--lmnt-theme-primary) 50%,var(--lmnt-theme-on-surface-stroke) 50%,var(--lmnt-theme-on-surface-stroke) 100%);background-size:200% 100%;background-position:100% 0;transition:background-position .6s cubic-bezier(.4,0,.2,1)}._stepperItemConnectorCompleted_1tz4b_125{background-position:0% 0}
@@ -1,5 +1,9 @@
1
1
  export type AlertBannerProps = {
2
2
  text: string | JSX.Element;
3
+ /**
4
+ * Id property to be able to query for the element
5
+ */
6
+ id?: string;
3
7
  color?: 'danger' | 'info' | 'success' | 'warning';
4
8
  isOpen?: boolean;
5
9
  isBold?: boolean;
@@ -12,4 +16,4 @@ export type AlertBannerProps = {
12
16
  */
13
17
  action?: JSX.Element;
14
18
  };
15
- export declare const AlertBanner: ({ text, color, isOpen, isBold, onClose, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const AlertBanner: ({ text, id, color, isOpen, isBold, onClose, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../../index.es-oxil0uFe.js";
3
3
  import "../../index.es-Dgxrk6xW.js";
4
4
  import "../../index.es-SjZ_-d7U.js";
5
- import { A as e } from "../../AlertBanner-Ci-F-6S9.js";
5
+ import { A as e } from "../../AlertBanner-aW6joVUm.js";
6
6
  export {
7
7
  e as AlertBanner
8
8
  };
@@ -1,11 +1,11 @@
1
1
  import { jsx as e, Fragment as m } from "react/jsx-runtime";
2
2
  import { a as t, s } from "../../react.esm-Bm0cAgpZ.js";
3
- import { a as o } from "../../useBreakpoints-MzTZ0tCT.js";
4
- import { A as n } from "../../AlertBanner-Ci-F-6S9.js";
5
- import { d as p, b as c, a as l, t as r, g as a } from "../../vi.bdSIJ99Y-B308Q-4w.js";
3
+ import { a as i } from "../../useBreakpoints-MzTZ0tCT.js";
4
+ import { A as n } from "../../AlertBanner-aW6joVUm.js";
5
+ import { d as p, b as c, t as r, g as a, a as o } from "../../vi.bdSIJ99Y-B308Q-4w.js";
6
6
  p("AlertBanner Test", () => {
7
7
  c(() => {
8
- l.spyOn(o, "useBreakpoints").mockReturnValue({
8
+ o.spyOn(i, "useBreakpoints").mockReturnValue({
9
9
  isMobile: !1,
10
10
  isTablet: !1,
11
11
  isDesktop: !0,
@@ -16,17 +16,19 @@ p("AlertBanner Test", () => {
16
16
  }), r("render AlertBanner with element", () => {
17
17
  t(/* @__PURE__ */ e(n, { text: /* @__PURE__ */ e(m, { children: "Element" }) })), a(s.getByText("Element")).toBeInTheDocument();
18
18
  }), r("renders AlertBanner with vertical style (flex-direction: column) when screen is small", () => {
19
- l.spyOn(o, "useBreakpoints").mockReturnValue({
19
+ o.spyOn(i, "useBreakpoints").mockReturnValue({
20
20
  isMobile: !0,
21
21
  isTablet: !1,
22
22
  isDesktop: !1,
23
23
  isDesktopNavbar: !1
24
24
  }), t(/* @__PURE__ */ e(n, { text: "Test" }));
25
- const i = s.getByText("Test").closest(".lmnt.lmnt-group");
26
- a(i).toHaveStyle(
25
+ const l = s.getByText("Test").closest(".lmnt.lmnt-group");
26
+ a(l).toHaveStyle(
27
27
  "display: flex; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 8px;"
28
28
  );
29
29
  }), r("renders nothing when isOpen is false", () => {
30
30
  t(/* @__PURE__ */ e(n, { text: "Test", isOpen: !1 })), a(s.queryByText("Test")).not.toBeInTheDocument();
31
+ }), r("renders AlertBanner with id", () => {
32
+ t(/* @__PURE__ */ e(n, { text: "Test", id: "test-id" })), a(s.getByTestId("alert-banner")).toHaveAttribute("id", "test-id");
31
33
  });
32
34
  });
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
2
  import { G as l } from "../../index.es-oxil0uFe.js";
3
3
  import { T as s } from "../../index.es-SjZ_-d7U.js";
4
4
  import { Iconify as p } from "../Iconify/Iconify.js";
5
- import { A as m, s as c } from "../../AlertBanner-Ci-F-6S9.js";
5
+ import { A as m, s as c } from "../../AlertBanner-aW6joVUm.js";
6
6
  const g = ({
7
7
  text: n,
8
8
  color: o = "info",
@@ -2,16 +2,16 @@ import { jsx as s } from "react/jsx-runtime";
2
2
  import { a as r, s as e } from "../../react.esm-Bm0cAgpZ.js";
3
3
  import { a as o } from "../../useBreakpoints-MzTZ0tCT.js";
4
4
  import { LinkBanner as a } from "./LinkBanner.js";
5
- import { d as n, b as i, a as m, t as p, g as t } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
+ import { d as n, b as i, t as m, g as t, a as p } from "../../vi.bdSIJ99Y-B308Q-4w.js";
6
6
  n("LinkBanner Test", () => {
7
7
  i(() => {
8
- m.spyOn(o, "useBreakpoints").mockReturnValue({
8
+ p.spyOn(o, "useBreakpoints").mockReturnValue({
9
9
  isMobile: !1,
10
10
  isTablet: !1,
11
11
  isDesktop: !0,
12
12
  isDesktopNavbar: !0
13
13
  });
14
- }), p("render LinkBanner with text", () => {
14
+ }), m("render LinkBanner with text", () => {
15
15
  r(/* @__PURE__ */ s(a, { text: "Test", url: "#" })), t(e.getByText("Test")).toBeInTheDocument(), t(e.getByText("open_in_new")).toBeInTheDocument(), t(e.getByRole("link")).toHaveAttribute("href", "#");
16
16
  });
17
17
  });
@@ -2,7 +2,7 @@ import { jsx as o, Fragment as s } from "react/jsx-runtime";
2
2
  import { a as n, s as e, f as d } from "../../react.esm-Bm0cAgpZ.js";
3
3
  import { a as l } from "../../useBreakpoints-MzTZ0tCT.js";
4
4
  import { BaseView as i } from "./BaseView.js";
5
- import { d as p, b as m, a as c, t as r, g as t } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
+ import { d as p, b as m, t as r, g as t, a as c } from "../../vi.bdSIJ99Y-B308Q-4w.js";
6
6
  p("BaseView Test", () => {
7
7
  m(() => {
8
8
  c.spyOn(l, "useBreakpoints").mockReturnValue({
@@ -0,0 +1,42 @@
1
+ import { IconifyProps } from '../Iconify/Iconify';
2
+ import { IsAllowedProps } from '../PermissionChecks/PermissionService.tsx';
3
+
4
+ export type ButtonCardProps = {
5
+ /**
6
+ * The label of the card.
7
+ */
8
+ title: string;
9
+ /**
10
+ * The subtitle of the card, displayed underneath the title in smaller font size.
11
+ */
12
+ subtitle: string;
13
+ /**
14
+ * Optional callback function that is called when the card is clicked.
15
+ */
16
+ onClick?: () => void;
17
+ /**
18
+ * The leading icon. The available icons are all material icons and icons listed in the AvailableCustomIcons enum.
19
+ */
20
+ icon?: IconifyProps['icon'];
21
+ /**
22
+ * The entity id, the permission is for (FarmOrganizationId, VendorOrganizationId or FarmLocationId).
23
+ */
24
+ entityIds: IsAllowedProps['entityIds'];
25
+ /**
26
+ * The permissions needed to enable the button. If the array is empty, the button is always enabled.
27
+ */
28
+ permissions: IsAllowedProps['neededPermissions'];
29
+ };
30
+ /**
31
+ * A button styled as a card, used for displaying actions.
32
+ * The card behaves as a clickable button when the onClick prop is provided.
33
+ * If onClick is not provided, the card will remain static on hover and not be focusable.
34
+ *
35
+ * @param title the title of the card
36
+ * @param subtitle the subtitle of the card
37
+ * @param icon the leading icon. The available icons are all material icons and icons listed in the {@link AvailableCustomIcons} enum.
38
+ * @param onClick optional callback function that is called when the card is clicked.
39
+ * @param entityIds the entity id, the permission is for (FarmOrganizationId, VendorOrganizationId or FarmLocationId).
40
+ * @param permissions the permissions needed to enable the button. If the array is empty, the button is always enabled.
41
+ */
42
+ export declare const ButtonCard: ({ title, subtitle, icon, onClick, entityIds, permissions, }: ButtonCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
+ import { B as m } from "../../index.es-B8p8KCdj.js";
3
+ import { G as a } from "../../index.es-oxil0uFe.js";
4
+ import { e as c } from "../../index.es-SjZ_-d7U.js";
5
+ import { Iconify as u } from "../Iconify/Iconify.js";
6
+ import { Allowed as p } from "../Allowed/Allowed.js";
7
+ import '../../assets/ButtonCard.css';const b = "_buttonCard_1fv6b_1", f = "_noInteraction_1fv6b_12", h = "_iconContainer_1fv6b_16", y = "_centerText_1fv6b_43", n = {
8
+ buttonCard: b,
9
+ noInteraction: f,
10
+ iconContainer: h,
11
+ centerText: y
12
+ }, A = ({
13
+ title: o,
14
+ subtitle: d,
15
+ icon: r,
16
+ onClick: e,
17
+ entityIds: s,
18
+ permissions: l
19
+ }) => /* @__PURE__ */ t(p, { neededPermissions: l, entityIds: s, children: /* @__PURE__ */ t(
20
+ m,
21
+ {
22
+ className: `${n.buttonCard} ${e === void 0 ? n.noInteraction : ""}`,
23
+ variant: "outlined",
24
+ "data-testid": `button-card-${o}`,
25
+ type: "button",
26
+ onClick: e,
27
+ fullWidth: !0,
28
+ tabIndex: e === void 0 ? -1 : 0,
29
+ children: /* @__PURE__ */ i(a, { primaryAlign: "start", secondaryAlign: "center", fullWidth: !0, children: [
30
+ r && /* @__PURE__ */ t("div", { className: n.iconContainer, children: /* @__PURE__ */ t(u, { icon: r, "data-testid": `card-icon-${r}` }) }),
31
+ /* @__PURE__ */ i(
32
+ a,
33
+ {
34
+ gap: "none",
35
+ primaryAlign: "center",
36
+ secondaryAlign: "start",
37
+ direction: "vertical",
38
+ fullWidth: !0,
39
+ className: n.centerText,
40
+ children: [
41
+ /* @__PURE__ */ t(c, { type: "body1-bold", themeColor: "text-primary-on-light", children: o }),
42
+ /* @__PURE__ */ t(c, { type: "subtitle1", themeColor: "text-secondary-on-background", children: d })
43
+ ]
44
+ }
45
+ )
46
+ ] })
47
+ }
48
+ ) });
49
+ export {
50
+ A as ButtonCard
51
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,92 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { s as e } from "../../react.esm-Bm0cAgpZ.js";
3
+ import { ButtonCard as s } from "./ButtonCard.js";
4
+ import { renderWithPermissions as r } from "../../test-utils.js";
5
+ import { d as c, t as a, g as t, v as d } from "../../vi.bdSIJ99Y-B308Q-4w.js";
6
+ c("ButtonCard Component", () => {
7
+ a("renders the correct title and subtitle", () => {
8
+ r(
9
+ /* @__PURE__ */ o(
10
+ s,
11
+ {
12
+ title: "Card Title",
13
+ subtitle: "Card Subtitle",
14
+ entityIds: "General",
15
+ permissions: []
16
+ }
17
+ )
18
+ ), t(e.getByText("Card Title")).toBeInTheDocument(), t(e.getByText("Card Subtitle")).toBeInTheDocument(), t(e.queryByTestId("card-icon")).not.toBeInTheDocument();
19
+ }), a("renders the correct title and subtitle with icon", () => {
20
+ r(
21
+ /* @__PURE__ */ o(
22
+ s,
23
+ {
24
+ title: "Card Title",
25
+ subtitle: "Card Subtitle",
26
+ icon: "store",
27
+ entityIds: "General",
28
+ permissions: []
29
+ }
30
+ )
31
+ ), t(e.getByText("Card Title")).toBeInTheDocument(), t(e.getByText("Card Subtitle")).toBeInTheDocument(), t(e.getByTestId("card-icon-store")).toBeInTheDocument();
32
+ }), a("calls onClick when button is clicked", () => {
33
+ const n = d.fn();
34
+ r(
35
+ /* @__PURE__ */ o(
36
+ s,
37
+ {
38
+ title: "Clickable Card",
39
+ subtitle: "Card Subtitle",
40
+ onClick: n,
41
+ entityIds: "General",
42
+ permissions: []
43
+ }
44
+ )
45
+ );
46
+ const i = e.getByTestId("button-card-Clickable Card");
47
+ t(i).not.toHaveClass("noInteraction"), i.click(), t(n).toHaveBeenCalled();
48
+ }), a("adds noInteraction class when onClick is not set", () => {
49
+ r(
50
+ /* @__PURE__ */ o(
51
+ s,
52
+ {
53
+ title: "Static Card",
54
+ subtitle: "Card Subtitle",
55
+ entityIds: "General",
56
+ permissions: []
57
+ }
58
+ )
59
+ );
60
+ const n = e.getByTestId("button-card-Static Card");
61
+ t(Array.from(n.classList).some((i) => i.includes("noInteraction"))).toBe(!0);
62
+ }), a("does not add noInteraction class when onClick is set", () => {
63
+ r(
64
+ /* @__PURE__ */ o(
65
+ s,
66
+ {
67
+ title: "Interactive Card",
68
+ subtitle: "Card Subtitle",
69
+ onClick: () => {
70
+ },
71
+ entityIds: "General",
72
+ permissions: []
73
+ }
74
+ )
75
+ );
76
+ const n = e.getByTestId("button-card-Interactive Card");
77
+ t(Array.from(n.classList).some((i) => i.includes("noInteraction"))).toBe(!1);
78
+ }), a("sets correct data-testid for button and icon", () => {
79
+ r(
80
+ /* @__PURE__ */ o(
81
+ s,
82
+ {
83
+ title: "Icon Card",
84
+ subtitle: "Card Subtitle",
85
+ icon: "wifi",
86
+ entityIds: "General",
87
+ permissions: []
88
+ }
89
+ )
90
+ ), t(e.getByTestId("button-card-Icon Card")).toBeInTheDocument(), t(e.getByTestId("card-icon-wifi")).toBeInTheDocument();
91
+ });
92
+ });
@@ -0,0 +1,77 @@
1
+ import { IconifyProps } from '../Iconify/Iconify';
2
+ import { ReactNode } from 'react';
3
+
4
+ type ConfirmationModalProps = {
5
+ /**
6
+ * The title of the modal.
7
+ */
8
+ modalTitle: string;
9
+ /**
10
+ * The label of the confirmation button.
11
+ */
12
+ confirmButtonLabel: string;
13
+ /**
14
+ * The label of the cancel button.
15
+ */
16
+ cancelButtonLabel: string;
17
+ /**
18
+ * The header text of the modal body
19
+ */
20
+ label: string | ReactNode;
21
+ /**
22
+ * Content of the modal body.
23
+ */
24
+ content?: string[] | ReactNode[];
25
+ /**
26
+ * Whether to display the content as bullet points.
27
+ */
28
+ showBulletPoints?: boolean;
29
+ /**
30
+ * Set the color of the icon displayed in the modal.
31
+ * @default ConfirmationModalColors.Primary
32
+ */
33
+ iconColor?: 'primary' | 'secondary' | 'success' | 'danger';
34
+ /**
35
+ * Set the color of the confirmation button.
36
+ * @default filled
37
+ */
38
+ confirmButtonVariant?: 'filled' | 'outlined' | 'danger' | 'success';
39
+ /**
40
+ * The visibility of the modal.
41
+ */
42
+ isOpen: boolean;
43
+ /**
44
+ * The function to call when the confirmation button is clicked.
45
+ */
46
+ onConfirm: () => void;
47
+ /**
48
+ * The function to call when the cancel button is clicked.
49
+ */
50
+ onCancel: () => void;
51
+ /**
52
+ * Whether the confirmation button is disabled.
53
+ */
54
+ isConfirmationDisabled?: boolean;
55
+ /**
56
+ * The leading icon. The available icons are all material icons and icons listed in the AvailableCustomIcons enum.
57
+ */
58
+ icon?: IconifyProps['icon'];
59
+ };
60
+ /**
61
+ * A modal component for confirming actions.
62
+ *
63
+ * @param modalTitle The title of the modal.
64
+ * @param confirmButtonLabel The label of the confirmation button.
65
+ * @param cancelButtonLabel The label of the cancel button.
66
+ * @param label The header text of the modal body
67
+ * @param content Content of the modal body. When providing a string or Element, each will be displayed as is. When providing an array of strings or Elements, each will be displayed as a bullet point.
68
+ * @param icon The leading icon. The available icons are all material icons and icons listed in the {@link AvailableCustomIcons} enum.
69
+ * @param [iconColor='primary'] Set the color of the icon displayed in the modal. Default is ConfirmationModalColors.Primary
70
+ * @param [confirmButtonVariant='filled'] Set the color of the confirmation button. Default is ConfirmationModalColors.Primary
71
+ * @param isOpen The visibility of the modal.
72
+ * @param onConfirm The function to call when the confirmation button is clicked.
73
+ * @param onCancel The function to call when the cancel button is clicked.
74
+ * @param isConfirmationDisabled Whether the confirmation button is disabled.
75
+ */
76
+ export declare const ConfirmationModal: ({ modalTitle, confirmButtonLabel, cancelButtonLabel, label, content, showBulletPoints, icon, iconColor, confirmButtonVariant, isOpen, onConfirm, onCancel, isConfirmationDisabled, }: ConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
77
+ export {};
@@ -0,0 +1,90 @@
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { B as s } from "../../index.es-B8p8KCdj.js";
3
+ import { G as o } from "../../index.es-oxil0uFe.js";
4
+ import { T as c } from "../../index.es-SjZ_-d7U.js";
5
+ import { u as C } from "../../useBreakpoints-MzTZ0tCT.js";
6
+ import { Iconify as B } from "../Iconify/Iconify.js";
7
+ import { Modal as H } from "../Modal/Modal.js";
8
+ import '../../assets/ConfirmationModal.css';const N = "_bulletPoint_v4va9_1", P = "_modal_v4va9_7", S = "_primary_v4va9_11", j = "_secondary_v4va9_15", z = "_success_v4va9_19", A = "_danger_v4va9_23", G = "_fullHeight_v4va9_27", t = {
9
+ bulletPoint: N,
10
+ modal: P,
11
+ primary: S,
12
+ secondary: j,
13
+ success: z,
14
+ danger: A,
15
+ fullHeight: G
16
+ }, E = ({
17
+ modalTitle: r,
18
+ confirmButtonLabel: d,
19
+ cancelButtonLabel: m,
20
+ label: u,
21
+ content: a,
22
+ showBulletPoints: p,
23
+ icon: n,
24
+ iconColor: v = "primary",
25
+ confirmButtonVariant: _ = "filled",
26
+ isOpen: f,
27
+ onConfirm: y,
28
+ onCancel: l,
29
+ isConfirmationDisabled: g
30
+ }) => {
31
+ const { isDesktop: h } = C(), b = () => a ? /* @__PURE__ */ e(o, { direction: "vertical", gap: "none", children: a.map((x, k) => /* @__PURE__ */ e(
32
+ c,
33
+ {
34
+ level: 2,
35
+ className: p ? t.bulletPoint : "",
36
+ themeColor: "text-secondary-on-background",
37
+ children: x
38
+ },
39
+ k
40
+ )) }) : null;
41
+ return /* @__PURE__ */ e(
42
+ H,
43
+ {
44
+ "data-testid": `confirmation-modal-${r}`,
45
+ className: `${t.modal}`,
46
+ modalSize: h ? "small" : "fullscreen",
47
+ open: f,
48
+ title: r,
49
+ onClose: l,
50
+ actionButton: /* @__PURE__ */ e(
51
+ s,
52
+ {
53
+ "data-testid": "confirm-button",
54
+ variant: _,
55
+ label: d,
56
+ onClick: y,
57
+ disabled: g
58
+ }
59
+ ),
60
+ footerSupplemental: /* @__PURE__ */ e(
61
+ s,
62
+ {
63
+ "data-testid": "cancel-button",
64
+ variant: "text",
65
+ label: m,
66
+ onClick: l
67
+ }
68
+ ),
69
+ children: /* @__PURE__ */ i(
70
+ o,
71
+ {
72
+ className: t.fullHeight,
73
+ direction: "vertical",
74
+ primaryAlign: "center",
75
+ secondaryAlign: "center",
76
+ children: [
77
+ n && /* @__PURE__ */ e(B, { icon: n, iconSize: "xlarge", className: t[v] }),
78
+ /* @__PURE__ */ i(o, { direction: "vertical", children: [
79
+ /* @__PURE__ */ e(c, { level: 1, themeColor: "text-primary-on-background", children: u }),
80
+ b()
81
+ ] })
82
+ ]
83
+ }
84
+ )
85
+ }
86
+ );
87
+ };
88
+ export {
89
+ E as ConfirmationModal
90
+ };