@hortiview/shared-components 2.2.0 → 2.4.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 (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +11 -0
  3. package/dist/AlertBanner-75jjene1.js +26 -0
  4. package/dist/OfflineView-BW19N4Cu.js +48 -0
  5. package/dist/assets/AlertBanner.css +1 -1
  6. package/dist/assets/ContextMenu.css +1 -1
  7. package/dist/assets/Modal.css +1 -1
  8. package/dist/assets/OfflineView.css +1 -0
  9. package/dist/components/AlertBanner/AlertBanner.d.ts +1 -2
  10. package/dist/components/AlertBanner/AlertBanner.js +6 -22
  11. package/dist/components/AlertBanner/AlertBanner.test.js +1 -1
  12. package/dist/components/AlertBanner/LinkBanner.d.ts +21 -0
  13. package/dist/components/AlertBanner/LinkBanner.js +37 -0
  14. package/dist/components/AlertBanner/LinkBanner.test.d.ts +1 -0
  15. package/dist/components/AlertBanner/LinkBanner.test.js +17 -0
  16. package/dist/components/BaseView/BaseView.d.ts +10 -1
  17. package/dist/components/BaseView/BaseView.js +42 -39
  18. package/dist/components/BaseView/BaseView.test.js +51 -34
  19. package/dist/components/ContextMenu/ContextMenu.d.ts +12 -1
  20. package/dist/components/ContextMenu/ContextMenu.js +40 -36
  21. package/dist/components/ContextMenu/ContextMenu.test.js +42 -19
  22. package/dist/components/DeleteModal/DeleteModal.d.ts +13 -1
  23. package/dist/components/DeleteModal/DeleteModal.js +52 -48
  24. package/dist/components/DeleteModal/DeleteModal.test.js +35 -11
  25. package/dist/components/GenericTable/GenericTable.d.ts +3 -1
  26. package/dist/components/GenericTable/GenericTable.js +1225 -1216
  27. package/dist/components/GenericTable/GenericTable.test.js +36 -6
  28. package/dist/components/Modal/Modal.d.ts +6 -1
  29. package/dist/components/Modal/Modal.js +126 -120
  30. package/dist/components/ModulePadding/ModulePadding.js +1 -1
  31. package/dist/components/OfflineView/OfflineView.d.ts +68 -0
  32. package/dist/components/OfflineView/OfflineView.js +9 -0
  33. package/dist/components/OfflineView/OfflineView.test.d.ts +1 -0
  34. package/dist/components/OfflineView/OfflineView.test.js +24 -0
  35. package/dist/components/Stepper/Stepper.d.ts +4 -3
  36. package/dist/components/Stepper/Stepper.js +33 -21
  37. package/dist/components/Stepper/Stepper.test.js +40 -64
  38. package/dist/components/Stepper/components/StepperButton.d.ts +8 -2
  39. package/dist/components/Stepper/components/StepperButton.js +54 -38
  40. package/dist/components/Stepper/stepperTypes.d.ts +31 -1
  41. package/dist/main.d.ts +6 -4
  42. package/dist/main.js +101 -97
  43. package/dist/types/GenericTable.d.ts +9 -0
  44. package/package.json +1 -1
@@ -1,48 +1,52 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { I as d } from "../../index.es-0lQcz8m1.js";
3
- import { M as f, L as _, a as I } from "../../index.es-fnFnw2P1.js";
4
- import { useState as p, useCallback as a, useEffect as v } from "react";
5
- import { u as C } from "../../uniqueId-NU3-C36A.js";
6
- import '../../assets/ContextMenu.css';const k = "_menu_ol91v_1", y = "_icon_ol91v_5", M = "_listItem_ol91v_9", i = {
7
- menu: k,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { I as _ } from "../../index.es-0lQcz8m1.js";
3
+ import { M as k, L as p, a as w } from "../../index.es-fnFnw2P1.js";
4
+ import { useState as I, useCallback as a, useEffect as M } from "react";
5
+ import { u as x } from "../../uniqueId-NU3-C36A.js";
6
+ import { O as C } from "../../OfflineView-BW19N4Cu.js";
7
+ import '../../assets/ContextMenu.css';const v = "_menu_1xwk3_1", y = "_icon_1xwk3_5", V = "_listItem_1xwk3_9", g = "_offlineViewMargin_1xwk3_19", s = {
8
+ menu: v,
8
9
  icon: y,
9
- listItem: M
10
- }, T = ({
11
- triggerOpen: n = null,
12
- actions: c,
13
- iconOrientation: m = "vertical",
14
- "data-testid": r
10
+ listItem: V,
11
+ offlineViewMargin: g
12
+ }, b = ({
13
+ triggerOpen: o = null,
14
+ actions: r,
15
+ iconOrientation: c = "vertical",
16
+ "data-testid": m,
17
+ isOnline: f = !0,
18
+ offlineViewProps: u
15
19
  }) => {
16
- const [t, s] = p(!1), u = a(() => {
17
- s(!t);
18
- }, [t]), l = a(() => {
19
- s(!1);
20
+ const [i, n] = I(!1), d = a(() => {
21
+ n(!i);
22
+ }, [i]), l = a(() => {
23
+ n(!1);
20
24
  }, []);
21
- return v(() => {
22
- s(n !== null ? n : !1);
23
- }, [n]), /* @__PURE__ */ o(
24
- f,
25
+ return M(() => {
26
+ n(o !== null ? o : !1);
27
+ }, [o]), /* @__PURE__ */ t(
28
+ k,
25
29
  {
26
- className: i.menu,
27
- "data-testid": r ?? "selection-menu",
28
- open: t,
30
+ className: s.menu,
31
+ "data-testid": m ?? "selection-menu",
32
+ open: i,
29
33
  surfaceOnly: !0,
30
34
  hoistToBody: !0,
31
35
  onClose: l,
32
- trigger: /* @__PURE__ */ o(
33
- d,
36
+ trigger: /* @__PURE__ */ t(
37
+ _,
34
38
  {
35
- className: i.icon,
36
- variant: t ? "filled-primary" : void 0,
39
+ className: s.icon,
40
+ variant: i ? "filled-primary" : void 0,
37
41
  "data-testid": "open-button",
38
- icon: m === "vertical" ? "more_vert" : "more_horiz",
39
- onClick: u
42
+ icon: c === "vertical" ? "more_vert" : "more_horiz",
43
+ onClick: d
40
44
  }
41
45
  ),
42
- children: /* @__PURE__ */ o(_, { "data-testid": "selection-list", children: c.map((e) => /* @__PURE__ */ o(
43
- I,
46
+ children: f ? /* @__PURE__ */ t(p, { "data-testid": "selection-list", children: r.map((e) => /* @__PURE__ */ t(
47
+ w,
44
48
  {
45
- className: i.listItem,
49
+ className: s.listItem,
46
50
  ...e,
47
51
  leadingBlockType: "icon",
48
52
  "data-testid": e["data-testid"],
@@ -50,12 +54,12 @@ import '../../assets/ContextMenu.css';const k = "_menu_ol91v_1", y = "_icon_ol91
50
54
  e?.onClick?.(), e.closeOnClick !== !1 && l();
51
55
  }
52
56
  },
53
- C(`LI_${e.primaryText?.toString()}_`)
54
- )) })
57
+ x(`LI_${e.primaryText?.toString()}_`)
58
+ )) }) : /* @__PURE__ */ t(C, { size: "small", variant: "filled", className: s.offlineViewMargin, ...u })
55
59
  },
56
60
  "selectionmenu"
57
61
  );
58
62
  };
59
63
  export {
60
- T as ContextMenu
64
+ b as ContextMenu
61
65
  };
@@ -1,22 +1,45 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { a as B, s as t, f as o, w as s } from "../../react.esm-CX1WJ2Pp.js";
3
- import { ContextMenu as p } from "./ContextMenu.js";
4
- import { a as d, d as k, t as T, g as e } from "../../vi.CjhMlMwf-CKxPQtd6.js";
5
- const C = d.fn(), a = d.fn(), i = d.fn(), g = [
6
- { primaryText: "Open", onClick: C, leadingBlock: "add", "data-testid": "open-testid" },
7
- { primaryText: "Delete", onClick: i, leadingBlock: "delete_outline", "data-testid": "delete-testid" },
8
- { primaryText: "Edit", onClick: a, leadingBlock: "edit", "data-testid": "edit-testid" }
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { a as i, s as t, f as o, w as c } from "../../react.esm-CX1WJ2Pp.js";
3
+ import { ContextMenu as d } from "./ContextMenu.js";
4
+ import { a as B, d as I, t as l, g as e } from "../../vi.CjhMlMwf-CKxPQtd6.js";
5
+ const g = B.fn(), m = B.fn(), r = B.fn(), u = [
6
+ { primaryText: "Open", onClick: g, leadingBlock: "add", "data-testid": "open-testid" },
7
+ {
8
+ primaryText: "Delete",
9
+ onClick: r,
10
+ leadingBlock: "delete_outline",
11
+ "data-testid": "delete-testid"
12
+ },
13
+ { primaryText: "Edit", onClick: m, leadingBlock: "edit", "data-testid": "edit-testid" }
9
14
  ];
10
- k("ContextMenu Test", () => {
11
- T("render contextMenu and close it", () => {
12
- B(/* @__PURE__ */ r(p, { actions: g }));
13
- const c = t.getByTestId("open-button"), n = t.getByTestId("selection-menu");
14
- e(n).toBeInTheDocument(), e(n).not.toHaveClass("mdc-menu-surface--open"), o.click(c), s(() => e(n).toHaveClass("mdc-menu-surface--open")), o.click(c), s(() => e(n).not.toHaveClass("mdc-menu-surface--open"));
15
- }), T("render ContextMenu and open it", async () => {
16
- B(/* @__PURE__ */ r(p, { actions: g, triggerOpen: !0 }));
17
- const c = t.getByTestId("open-button"), n = t.getByTestId("selection-menu");
18
- e(n).toBeInTheDocument(), e(n).not.toHaveClass("mdc-menu-surface--open"), o.click(c), await s(() => e(n).toHaveClass("mdc-menu-surface--animating-open")), e(t.getByText("Open")).toBeInTheDocument(), e(t.getByText("Delete")).toBeInTheDocument(), e(t.getByText("Edit")).toBeInTheDocument();
19
- const l = t.getByTestId("open-testid"), m = t.getByTestId("delete-testid"), u = t.getByTestId("edit-testid");
20
- e(l).toBeInTheDocument(), e(m).toBeInTheDocument(), e(u).toBeInTheDocument(), o.click(l), e(C).toHaveBeenCalled(), e(i).not.toHaveBeenCalled(), e(a).not.toHaveBeenCalled(), o.click(m), e(i).toHaveBeenCalled(), o.click(u), e(a).toHaveBeenCalled();
15
+ I("ContextMenu Test", () => {
16
+ l("render contextMenu and close it", () => {
17
+ i(/* @__PURE__ */ a(d, { actions: u }));
18
+ const s = t.getByTestId("open-button"), n = t.getByTestId("selection-menu");
19
+ e(n).toBeInTheDocument(), e(n).not.toHaveClass("mdc-menu-surface--open"), o.click(s), c(() => e(n).toHaveClass("mdc-menu-surface--open")), o.click(s), c(() => e(n).not.toHaveClass("mdc-menu-surface--open"));
20
+ }), l("render ContextMenu and open it", async () => {
21
+ i(/* @__PURE__ */ a(d, { actions: u, triggerOpen: !0 }));
22
+ const s = t.getByTestId("open-button"), n = t.getByTestId("selection-menu");
23
+ e(n).toBeInTheDocument(), e(n).not.toHaveClass("mdc-menu-surface--open"), o.click(s), await c(() => e(n).toHaveClass("mdc-menu-surface--animating-open")), e(t.getByText("Open")).toBeInTheDocument(), e(t.getByText("Delete")).toBeInTheDocument(), e(t.getByText("Edit")).toBeInTheDocument();
24
+ const p = t.getByTestId("open-testid"), T = t.getByTestId("delete-testid"), f = t.getByTestId("edit-testid");
25
+ e(p).toBeInTheDocument(), e(T).toBeInTheDocument(), e(f).toBeInTheDocument(), o.click(p), e(g).toHaveBeenCalled(), e(r).not.toHaveBeenCalled(), e(m).not.toHaveBeenCalled(), o.click(T), e(r).toHaveBeenCalled(), o.click(f), e(m).toHaveBeenCalled();
26
+ }), l("render ContextMenu with offlineView", async () => {
27
+ i(
28
+ /* @__PURE__ */ a(
29
+ d,
30
+ {
31
+ actions: u,
32
+ triggerOpen: !0,
33
+ isOnline: !1,
34
+ offlineViewProps: {
35
+ "data-testid": "offline-test"
36
+ }
37
+ }
38
+ )
39
+ );
40
+ const s = t.getByTestId("open-button");
41
+ o.click(s);
42
+ const n = t.getByTestId("selection-menu");
43
+ await c(() => e(n).toHaveClass("mdc-menu-surface--animating-open")), e(t.getByTestId("offline-test")).toBeInTheDocument();
21
44
  });
22
45
  });
@@ -1,3 +1,5 @@
1
+ import { OfflineViewProps } from '../OfflineView/OfflineView';
2
+
1
3
  type DeleteModalProps = {
2
4
  /**
3
5
  * The title of the modal.
@@ -58,6 +60,14 @@ type DeleteModalProps = {
58
60
  * Default is _true_.
59
61
  */
60
62
  isDeletePossible?: boolean;
63
+ /**
64
+ * Whether the user is online; shows OfflineView when false.
65
+ */
66
+ isOnline?: boolean;
67
+ /**
68
+ * Props forwarded to <OfflineView /> when offline.
69
+ */
70
+ offlineViewProps?: Partial<OfflineViewProps>;
61
71
  };
62
72
  /**
63
73
  * A modal component for deleting items.
@@ -75,7 +85,9 @@ type DeleteModalProps = {
75
85
  * @prop {function} onDelete - The function to call when the confirm button is clicked.
76
86
  * @prop {function} onCancel - A optional function to call when the cancel button is clicked.
77
87
  * @prop {boolean} isDeletePossible - If true, the delete button will be enabled. If false, the delete button will be disabled and the {@link impossibleDeleteHeader} will be displayed. Default is _true_.
88
+ * @prop {boolean} isOnline - Whether the user is online; shows OfflineView when false.
89
+ * @prop {Partial} offlineViewProps - Props forwarded to OfflineView when offline.
78
90
  * @returns {ReactElement} A modal component for deleting items.
79
91
  */
80
- export declare const DeleteModal: ({ title, confirmButtonLabel, cancelButtonLabel, deleteHeader, deleteBody, deleteText, icon, isIconCrossedOut, impossibleDeleteHeader, open, setOpen, onDelete, onCancel, isDeletePossible, }: DeleteModalProps) => import("react/jsx-runtime").JSX.Element;
92
+ export declare const DeleteModal: ({ title, confirmButtonLabel, cancelButtonLabel, deleteHeader, deleteBody, deleteText, icon, isIconCrossedOut, impossibleDeleteHeader, open, setOpen, onDelete, onCancel, isDeletePossible, isOnline, offlineViewProps, }: DeleteModalProps) => import("react/jsx-runtime").JSX.Element;
81
93
  export {};
@@ -1,96 +1,100 @@
1
- import { jsx as o, jsxs as p, Fragment as i } from "react/jsx-runtime";
2
- import { B as u } from "../../index.es-CiqbARoC.js";
3
- import { G as c } from "../../index.es-DntoATwO.js";
4
- import { I as D } from "../../index.es-3043KTnb.js";
1
+ import { jsx as o, jsxs as f, Fragment as c } from "react/jsx-runtime";
2
+ import { B as p } from "../../index.es-CiqbARoC.js";
3
+ import { G as i } from "../../index.es-DntoATwO.js";
4
+ import { I } from "../../index.es-3043KTnb.js";
5
5
  import { T as l } from "../../index.es-D54RuMc_.js";
6
- import { u as k } from "../../uniqueId-NU3-C36A.js";
7
- import { AvailableCustomIcons as I } from "../../enums/AvailableCustomIcons.js";
8
- import { u as N } from "../../useBreakpoints-MzTZ0tCT.js";
9
- import { Iconify as O } from "../Iconify/Iconify.js";
10
- import { Modal as S } from "../Modal/Modal.js";
11
- import '../../assets/DeleteModal.css';const x = "_bulletPoint_bd412_1", B = "_modal_bd412_7", M = "_colorDanger_bd412_11", j = "_crossedOut_bd412_15", t = {
12
- bulletPoint: x,
13
- modal: B,
14
- colorDanger: M,
15
- crossedOut: j
16
- }, R = ({
6
+ import { u as N } from "../../uniqueId-NU3-C36A.js";
7
+ import { AvailableCustomIcons as S } from "../../enums/AvailableCustomIcons.js";
8
+ import { u as x } from "../../useBreakpoints-MzTZ0tCT.js";
9
+ import { Iconify as B } from "../Iconify/Iconify.js";
10
+ import { Modal as M } from "../Modal/Modal.js";
11
+ import '../../assets/DeleteModal.css';const O = "_bulletPoint_bd412_1", j = "_modal_bd412_7", z = "_colorDanger_bd412_11", P = "_crossedOut_bd412_15", t = {
12
+ bulletPoint: O,
13
+ modal: j,
14
+ colorDanger: z,
15
+ crossedOut: P
16
+ }, V = ({
17
17
  title: r,
18
18
  confirmButtonLabel: e,
19
19
  cancelButtonLabel: n,
20
20
  deleteHeader: a,
21
21
  deleteBody: s,
22
- deleteText: f,
23
- icon: b,
24
- isIconCrossedOut: g,
25
- impossibleDeleteHeader: h,
26
- open: v,
22
+ deleteText: b,
23
+ icon: g,
24
+ isIconCrossedOut: h,
25
+ impossibleDeleteHeader: v,
26
+ open: y,
27
27
  setOpen: d,
28
- onDelete: y,
29
- onCancel: _,
30
- isDeletePossible: m = !0
28
+ onDelete: _,
29
+ onCancel: C,
30
+ isDeletePossible: m = !0,
31
+ isOnline: u = !0,
32
+ offlineViewProps: D
31
33
  }) => {
32
- const { isDesktop: C } = N();
34
+ const { isDesktop: k } = x();
33
35
  return /* @__PURE__ */ o(
34
- S,
36
+ M,
35
37
  {
38
+ isOnline: u,
39
+ offlineViewProps: D,
36
40
  className: `${t.modal}`,
37
- modalSize: C ? "small" : "fullscreen",
38
- open: v,
41
+ modalSize: k ? "small" : "fullscreen",
42
+ open: y,
39
43
  title: r,
40
44
  onClose: () => d(!1),
41
45
  primaryButton: /* @__PURE__ */ o(
42
- u,
46
+ p,
43
47
  {
44
48
  "data-testid": "delete-button",
45
49
  variant: "danger",
46
50
  label: e,
47
- onClick: y,
48
- disabled: !m
51
+ onClick: _,
52
+ disabled: !m || !u
49
53
  }
50
54
  ),
51
55
  footerSupplemental: /* @__PURE__ */ o(
52
- u,
56
+ p,
53
57
  {
54
58
  "data-testid": "cancel-button",
55
59
  variant: "text",
56
60
  label: n,
57
61
  onClick: () => {
58
- _?.(), d(!1);
62
+ C?.(), d(!1);
59
63
  }
60
64
  }
61
65
  ),
62
- children: /* @__PURE__ */ p(c, { direction: "vertical", secondaryAlign: "center", children: [
63
- /* @__PURE__ */ o(z, { element: /* @__PURE__ */ o(P, { icon: b }), isCrossedOut: g }),
64
- /* @__PURE__ */ o(c, { direction: "vertical", children: m ? /* @__PURE__ */ o(
65
- A,
66
+ children: /* @__PURE__ */ f(i, { direction: "vertical", secondaryAlign: "center", children: [
67
+ /* @__PURE__ */ o(A, { element: /* @__PURE__ */ o(G, { icon: g }), isCrossedOut: h }),
68
+ /* @__PURE__ */ o(i, { direction: "vertical", children: m ? /* @__PURE__ */ o(
69
+ q,
66
70
  {
67
71
  deleteHeader: a,
68
- deleteText: f,
72
+ deleteText: b,
69
73
  deleteBody: s
70
74
  }
71
- ) : /* @__PURE__ */ o(G, { impossibleDeleteHeader: h }) })
75
+ ) : /* @__PURE__ */ o(F, { impossibleDeleteHeader: v }) })
72
76
  ] })
73
77
  }
74
78
  );
75
- }, z = ({
79
+ }, A = ({
76
80
  element: r,
77
81
  isCrossedOut: e = !1
78
- }) => e ? /* @__PURE__ */ o("span", { className: t.crossedOut, children: r }) : r, P = ({ icon: r }) => r ? typeof r != "string" ? r : Object.values(I).includes(r) ? /* @__PURE__ */ o(
79
- O,
82
+ }) => e ? /* @__PURE__ */ o("span", { className: t.crossedOut, children: r }) : r, G = ({ icon: r }) => r ? typeof r != "string" ? r : Object.values(S).includes(r) ? /* @__PURE__ */ o(
83
+ B,
80
84
  {
81
85
  icon: r,
82
86
  iconSize: "xlarge",
83
87
  className: t.colorDanger
84
88
  }
85
- ) : /* @__PURE__ */ o(D, { icon: r, iconSize: "xlarge", className: t.colorDanger }) : /* @__PURE__ */ o(i, {}), A = ({
89
+ ) : /* @__PURE__ */ o(I, { icon: r, iconSize: "xlarge", className: t.colorDanger }) : /* @__PURE__ */ o(c, {}), q = ({
86
90
  deleteHeader: r,
87
91
  deleteText: e,
88
92
  deleteBody: n
89
- }) => /* @__PURE__ */ p(i, { children: [
93
+ }) => /* @__PURE__ */ f(c, { children: [
90
94
  /* @__PURE__ */ o(l, { level: 1, themeColor: "text-primary-on-background", children: r }),
91
95
  e && typeof e == "string" && /* @__PURE__ */ o(l, { level: 2, themeColor: "text-secondary-on-background", children: e }),
92
- e && typeof e != "string" && /* @__PURE__ */ o(i, { children: e }),
93
- n && e === void 0 && /* @__PURE__ */ o(c, { direction: "vertical", gap: "none", children: n.map((a, s) => /* @__PURE__ */ o(
96
+ e && typeof e != "string" && /* @__PURE__ */ o(c, { children: e }),
97
+ n && e === void 0 && /* @__PURE__ */ o(i, { direction: "vertical", gap: "none", children: n.map((a, s) => /* @__PURE__ */ o(
94
98
  l,
95
99
  {
96
100
  level: 2,
@@ -98,11 +102,11 @@ import '../../assets/DeleteModal.css';const x = "_bulletPoint_bd412_1", B = "_mo
98
102
  themeColor: "text-secondary-on-background",
99
103
  children: a
100
104
  },
101
- k(s.toString())
105
+ N(s.toString())
102
106
  )) })
103
- ] }), G = ({
107
+ ] }), F = ({
104
108
  impossibleDeleteHeader: r
105
109
  }) => /* @__PURE__ */ o(l, { level: 1, themeColor: "text-primary-on-background", children: r });
106
110
  export {
107
- R as DeleteModal
111
+ V as DeleteModal
108
112
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { a as c, s as e } from "../../react.esm-CX1WJ2Pp.js";
3
- import { DeleteModal as b } from "./DeleteModal.js";
4
- import { d as B, t as a, a as o, g as t } from "../../vi.CjhMlMwf-CKxPQtd6.js";
5
- B("DeleteModal Test", () => {
6
- a("should render the DeleteModal properly", () => {
3
+ import { DeleteModal as a } from "./DeleteModal.js";
4
+ import { d, t as b, a as o, g as t } from "../../vi.CjhMlMwf-CKxPQtd6.js";
5
+ d("DeleteModal Test", () => {
6
+ b("should render the DeleteModal properly", () => {
7
7
  c(
8
8
  /* @__PURE__ */ n(
9
- b,
9
+ a,
10
10
  {
11
11
  icon: "block",
12
12
  open: !0,
@@ -22,10 +22,10 @@ B("DeleteModal Test", () => {
22
22
  }
23
23
  )
24
24
  ), t(e.getByText("DELETE")).toBeInTheDocument(), t(e.getByTestId("block")).toBeInTheDocument(), t(e.getByText("block 1")).toBeInTheDocument(), t(e.getByText("block 2")).toBeInTheDocument(), t(e.getByText("block 3")).toBeInTheDocument(), t(e.getByText("Remove")).toBeInTheDocument(), t(e.getByText("Cancel")).toBeInTheDocument(), t(e.queryByText("block cant be deleted")).not.toBeInTheDocument();
25
- }), a("should render the DeleteModal properly when isDeletePossible = false", () => {
25
+ }), b("should render the DeleteModal properly when isDeletePossible = false", () => {
26
26
  c(
27
27
  /* @__PURE__ */ n(
28
- b,
28
+ a,
29
29
  {
30
30
  icon: "block",
31
31
  open: !0,
@@ -41,11 +41,11 @@ B("DeleteModal Test", () => {
41
41
  }
42
42
  )
43
43
  ), t(e.getByText("DELETE")).toBeInTheDocument(), t(e.getByTestId("block")).toBeInTheDocument(), t(e.queryByText("block 1")).not.toBeInTheDocument(), t(e.queryByText("block 2")).not.toBeInTheDocument(), t(e.queryByText("block 3")).not.toBeInTheDocument(), t(e.getByText("Remove")).toBeInTheDocument(), t(e.getByText("Remove").parentElement).toBeDisabled(), t(e.getByText("Cancel")).toBeInTheDocument(), t(e.queryByText("block cant be deleted")).toBeInTheDocument();
44
- }), a("should call setOpen with false when clicking on cancel button", () => {
44
+ }), b("should call setOpen with false when clicking on cancel button", () => {
45
45
  const l = o.fn();
46
46
  c(
47
47
  /* @__PURE__ */ n(
48
- b,
48
+ a,
49
49
  {
50
50
  icon: "block",
51
51
  open: !0,
@@ -61,11 +61,11 @@ B("DeleteModal Test", () => {
61
61
  }
62
62
  )
63
63
  ), e.getByText("Cancel").click(), t(l).toHaveBeenCalledWith(!1);
64
- }), a("should call onDelete when clicking on delete button", () => {
64
+ }), b("should call onDelete when clicking on delete button", () => {
65
65
  const l = o.fn();
66
66
  c(
67
67
  /* @__PURE__ */ n(
68
- b,
68
+ a,
69
69
  {
70
70
  icon: "block",
71
71
  open: !0,
@@ -81,5 +81,29 @@ B("DeleteModal Test", () => {
81
81
  }
82
82
  )
83
83
  ), e.getByText("Remove").click(), t(l).toHaveBeenCalled();
84
+ }), b("render DeleteModal with OfflineView", () => {
85
+ const l = o.fn();
86
+ c(
87
+ /* @__PURE__ */ n(
88
+ a,
89
+ {
90
+ icon: "block",
91
+ open: !0,
92
+ setOpen: o.fn(),
93
+ onDelete: l,
94
+ title: "DELETE",
95
+ confirmButtonLabel: "Remove",
96
+ cancelButtonLabel: "Cancel",
97
+ deleteHeader: "Delete my block",
98
+ impossibleDeleteHeader: "block cant be deleted",
99
+ deleteBody: ["block 1", "block 2", "block 3"],
100
+ isDeletePossible: !0,
101
+ isOnline: !1,
102
+ offlineViewProps: {
103
+ "data-testid": "offline-test"
104
+ }
105
+ }
106
+ )
107
+ ), e.getByText("Remove").click(), t(l).not.toHaveBeenCalled(), t(e.getByTestId("offline-test")).toBeInTheDocument();
84
108
  });
85
109
  });
@@ -60,6 +60,8 @@ import { TableLayoutProps } from '../../types/GenericTable';
60
60
  * @param tableActionPosition position of the table actions, can be 'start' or 'end'
61
61
  * @param tableElevationLevel elevation level of the table
62
62
  * @param tableLayout layout of the table, can be 'standard' or 'flex'
63
+ * @param isOnline Whether the user is online; shows OfflineView when false.
64
+ * @param offlineViewProps Props forwarded to OfflineView when offline.
63
65
  * @returns a table based on a given type and data
64
66
  */
65
- export declare const GenericTable: <T>({ data, hiddenColumns, order, cellTemplates, tableActions, noContentText, headerTranslation, pagination, getRowActions, customColumnWidth, title, cardTitleColumn, cardSubTitleColumn, pageTranslation, pageOfTranslation, rowsPerPageTranslation, tableActionPosition, tableElevationLevel, tableLayout, }: TableLayoutProps<T>) => import("react/jsx-runtime").JSX.Element;
67
+ export declare const GenericTable: <T>({ data, hiddenColumns, order, cellTemplates, tableActions, noContentText, headerTranslation, pagination, getRowActions, customColumnWidth, title, cardTitleColumn, cardSubTitleColumn, pageTranslation, pageOfTranslation, rowsPerPageTranslation, tableActionPosition, tableElevationLevel, tableLayout, isOnline, offlineViewProps, }: TableLayoutProps<T>) => import("react/jsx-runtime").JSX.Element;