@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
@@ -0,0 +1,221 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { a as i, s as n } from "../../react.esm-Bm0cAgpZ.js";
3
+ import { ConfirmationModal as l } from "./ConfirmationModal.js";
4
+ import { d as m, t as a, a as e, g as t } from "../../vi.bdSIJ99Y-B308Q-4w.js";
5
+ m("ConfirmationModal", () => {
6
+ a("renders modal title, label, list content, icon, and buttons", () => {
7
+ i(
8
+ /* @__PURE__ */ o(
9
+ l,
10
+ {
11
+ modalTitle: "Confirm Action",
12
+ confirmButtonLabel: "Confirm",
13
+ cancelButtonLabel: "Cancel",
14
+ label: "Are you sure?",
15
+ content: ["First item", "Second item"],
16
+ icon: "block",
17
+ isOpen: !0,
18
+ onConfirm: e.fn(),
19
+ onCancel: e.fn(),
20
+ isConfirmationDisabled: !1
21
+ }
22
+ )
23
+ ), t(n.getByText("Confirm Action")).toBeInTheDocument(), t(n.getByText("Are you sure?")).toBeInTheDocument(), t(n.getByText("First item")).toBeInTheDocument(), t(n.getByText("Second item")).toBeInTheDocument(), t(n.getByTestId("block")).toBeInTheDocument(), t(n.getByText("Confirm")).toBeInTheDocument(), t(n.getByText("Cancel")).toBeInTheDocument();
24
+ }), a("renders string content", () => {
25
+ i(
26
+ /* @__PURE__ */ o(
27
+ l,
28
+ {
29
+ modalTitle: "Confirm Action",
30
+ confirmButtonLabel: "Confirm",
31
+ cancelButtonLabel: "Cancel",
32
+ label: "Are you sure?",
33
+ content: ["This action cannot be undone."],
34
+ isOpen: !0,
35
+ onConfirm: e.fn(),
36
+ onCancel: e.fn(),
37
+ isConfirmationDisabled: !1
38
+ }
39
+ )
40
+ ), t(n.getByText("This action cannot be undone.")).toBeInTheDocument();
41
+ }), a("calls onConfirm when confirm button is clicked", () => {
42
+ const r = e.fn();
43
+ i(
44
+ /* @__PURE__ */ o(
45
+ l,
46
+ {
47
+ modalTitle: "Confirm Action",
48
+ confirmButtonLabel: "Confirm",
49
+ cancelButtonLabel: "Cancel",
50
+ label: "Are you sure?",
51
+ isOpen: !0,
52
+ onConfirm: r,
53
+ onCancel: e.fn(),
54
+ isConfirmationDisabled: !1
55
+ }
56
+ )
57
+ ), n.getByText("Confirm").click(), t(r).toHaveBeenCalled();
58
+ }), a("calls onCancel when cancel button is clicked", () => {
59
+ const r = e.fn();
60
+ i(
61
+ /* @__PURE__ */ o(
62
+ l,
63
+ {
64
+ modalTitle: "Confirm Action",
65
+ confirmButtonLabel: "Confirm",
66
+ cancelButtonLabel: "Cancel",
67
+ label: "Are you sure?",
68
+ isOpen: !0,
69
+ onConfirm: e.fn(),
70
+ onCancel: r
71
+ }
72
+ )
73
+ ), n.getByText("Cancel").click(), t(r).toHaveBeenCalled();
74
+ }), a("disables confirm button when confirmation is disabled", () => {
75
+ i(
76
+ /* @__PURE__ */ o(
77
+ l,
78
+ {
79
+ modalTitle: "Confirm Action",
80
+ confirmButtonLabel: "Confirm",
81
+ cancelButtonLabel: "Cancel",
82
+ label: "Are you sure?",
83
+ isOpen: !0,
84
+ onConfirm: e.fn(),
85
+ onCancel: e.fn(),
86
+ isConfirmationDisabled: !0
87
+ }
88
+ )
89
+ ), t(n.getByTestId("confirm-button")).toBeDisabled();
90
+ }), a("renders correctly when content is null or undefined", () => {
91
+ const { rerender: r } = i(
92
+ /* @__PURE__ */ o(
93
+ l,
94
+ {
95
+ modalTitle: "Confirm Action",
96
+ confirmButtonLabel: "Confirm",
97
+ cancelButtonLabel: "Cancel",
98
+ label: "Are you sure?",
99
+ content: void 0,
100
+ isOpen: !0,
101
+ onConfirm: e.fn(),
102
+ onCancel: e.fn()
103
+ }
104
+ )
105
+ );
106
+ t(n.queryByRole("list")).not.toBeInTheDocument(), r(
107
+ /* @__PURE__ */ o(
108
+ l,
109
+ {
110
+ modalTitle: "Confirm Action",
111
+ confirmButtonLabel: "Confirm",
112
+ cancelButtonLabel: "Cancel",
113
+ label: "Are you sure?",
114
+ content: void 0,
115
+ isOpen: !0,
116
+ onConfirm: e.fn(),
117
+ onCancel: e.fn()
118
+ }
119
+ )
120
+ ), t(n.queryByRole("list")).not.toBeInTheDocument();
121
+ }), a("renders correctly when content is an empty array", () => {
122
+ i(
123
+ /* @__PURE__ */ o(
124
+ l,
125
+ {
126
+ modalTitle: "Confirm Action",
127
+ confirmButtonLabel: "Confirm",
128
+ cancelButtonLabel: "Cancel",
129
+ label: "Are you sure?",
130
+ content: [],
131
+ isOpen: !0,
132
+ onConfirm: e.fn(),
133
+ onCancel: e.fn()
134
+ }
135
+ )
136
+ ), t(n.getByText("Are you sure?")).toBeInTheDocument();
137
+ }), a("renders ReactNode as label", () => {
138
+ i(
139
+ /* @__PURE__ */ o(
140
+ l,
141
+ {
142
+ modalTitle: "Confirm Action",
143
+ confirmButtonLabel: "Confirm",
144
+ cancelButtonLabel: "Cancel",
145
+ label: /* @__PURE__ */ o("span", { "data-testid": "custom-label", children: "Custom Label" }),
146
+ isOpen: !0,
147
+ onConfirm: e.fn(),
148
+ onCancel: e.fn()
149
+ }
150
+ )
151
+ ), t(n.getByTestId("custom-label")).toBeInTheDocument(), t(n.getByText("Custom Label")).toBeInTheDocument();
152
+ }), a("confirm button is not disabled by default", () => {
153
+ i(
154
+ /* @__PURE__ */ o(
155
+ l,
156
+ {
157
+ modalTitle: "Confirm Action",
158
+ confirmButtonLabel: "Confirm",
159
+ cancelButtonLabel: "Cancel",
160
+ label: "Are you sure?",
161
+ isOpen: !0,
162
+ onConfirm: e.fn(),
163
+ onCancel: e.fn()
164
+ }
165
+ )
166
+ ), t(n.getByTestId("confirm-button")).not.toBeDisabled();
167
+ }), a("confirm button can be disabled", () => {
168
+ i(
169
+ /* @__PURE__ */ o(
170
+ l,
171
+ {
172
+ modalTitle: "Confirm Action",
173
+ confirmButtonLabel: "Confirm",
174
+ cancelButtonLabel: "Cancel",
175
+ label: "Are you sure?",
176
+ isOpen: !0,
177
+ onConfirm: e.fn(),
178
+ onCancel: e.fn(),
179
+ isConfirmationDisabled: !0
180
+ }
181
+ )
182
+ ), t(n.getByTestId("confirm-button")).toBeDisabled();
183
+ }), a("renders bullet points when showBulletPoints is true", () => {
184
+ i(
185
+ /* @__PURE__ */ o(
186
+ l,
187
+ {
188
+ modalTitle: "Bullet Modal",
189
+ confirmButtonLabel: "Confirm",
190
+ cancelButtonLabel: "Cancel",
191
+ label: "Choose wisely:",
192
+ content: ["Bullet 1", "Bullet 2"],
193
+ showBulletPoints: !0,
194
+ isOpen: !0,
195
+ onConfirm: e.fn(),
196
+ onCancel: e.fn()
197
+ }
198
+ )
199
+ ), t(n.getByText("Bullet 1")).toBeInTheDocument(), t(n.getByText("Bullet 2")).toBeInTheDocument();
200
+ const r = n.getByText("Bullet 1"), s = n.getByText("Bullet 2");
201
+ t(Array.from(r.classList).some((c) => c.includes("bulletPoint"))).toBe(!0), t(Array.from(s.classList).some((c) => c.includes("bulletPoint"))).toBe(!0);
202
+ }), a("does not render bullet point class when showBulletPoints is false", () => {
203
+ i(
204
+ /* @__PURE__ */ o(
205
+ l,
206
+ {
207
+ modalTitle: "No Bullet Modal",
208
+ confirmButtonLabel: "Confirm",
209
+ cancelButtonLabel: "Cancel",
210
+ label: "Choose wisely:",
211
+ content: ["Item 1", "Item 2"],
212
+ isOpen: !0,
213
+ onConfirm: e.fn(),
214
+ onCancel: e.fn()
215
+ }
216
+ )
217
+ );
218
+ const r = n.getByText("Item 1"), s = n.getByText("Item 2");
219
+ t(Array.from(r.classList).some((c) => c.includes("bulletPoint"))).toBe(!1), t(Array.from(s.classList).some((c) => c.includes("bulletPoint"))).toBe(!1);
220
+ });
221
+ });
@@ -10,16 +10,16 @@ import { Iconify as z } from "../Iconify/Iconify.js";
10
10
  import "react";
11
11
  import "../../react-tooltip.min-CVsI--2Y.js";
12
12
  import "../../orderBy-DLBJlgdL.js";
13
- import { LoadingSpinner as B } from "../LoadingSpinner/Default/LoadingSpinner.js";
14
- import { Modal as M } from "../Modal/Modal.js";
13
+ import "../../index-CuHybtft.js";
14
+ import "../SharedComponentsPermissionProvider/PermissionContext.js";
15
+ import { Modal as B } from "../Modal/Modal.js";
16
+ import { LoadingSpinner as M } from "../LoadingSpinner/Default/LoadingSpinner.js";
15
17
  import "react-hook-form";
16
18
  import "../../get-D8IXqiys.js";
17
19
  import "../../isArray-BjSPDQ4v.js";
18
20
  import "../../isString-DVA49FEo.js";
19
21
  import "../../omit-CYY_mIYv.js";
20
22
  import "../../types/Time.js";
21
- import "../../index-CuHybtft.js";
22
- import "../SharedComponentsPermissionProvider/PermissionContext.js";
23
23
  import "../../react.esm-Bm0cAgpZ.js";
24
24
  import '../../assets/DeleteModal.css';const j = "_bulletPoint_bd412_1", A = "_modal_bd412_7", G = "_colorDanger_bd412_11", q = "_crossedOut_bd412_15", e = {
25
25
  bulletPoint: j,
@@ -47,7 +47,7 @@ import '../../assets/DeleteModal.css';const j = "_bulletPoint_bd412_1", A = "_mo
47
47
  }) => {
48
48
  const { isDesktop: D } = O();
49
49
  return /* @__PURE__ */ o(
50
- M,
50
+ B,
51
51
  {
52
52
  isOnline: p,
53
53
  offlineViewProps: k,
@@ -64,7 +64,7 @@ import '../../assets/DeleteModal.css';const j = "_bulletPoint_bd412_1", A = "_mo
64
64
  label: s ? "" : t,
65
65
  onClick: C,
66
66
  disabled: !u || s || !p,
67
- trailingIcon: s ? /* @__PURE__ */ o(B, { size: "sm", text: "", spinnerOnly: !0 }) : null
67
+ trailingIcon: s ? /* @__PURE__ */ o(M, { size: "sm", text: "", spinnerOnly: !0 }) : null
68
68
  }
69
69
  ),
70
70
  footerSupplemental: /* @__PURE__ */ o(
@@ -11,8 +11,10 @@ import { u as F } from "../../useBreakpoints-MzTZ0tCT.js";
11
11
  import "../../react-tooltip.min-CVsI--2Y.js";
12
12
  import "../../orderBy-DLBJlgdL.js";
13
13
  import { SearchBar as I } from "../SearchBar/SearchBar.js";
14
- import "../../uniqueId-BNVTeImh.js";
14
+ import "../../index-CuHybtft.js";
15
+ import "../SharedComponentsPermissionProvider/PermissionContext.js";
15
16
  import { Modal as K } from "../Modal/Modal.js";
17
+ import "../../uniqueId-BNVTeImh.js";
16
18
  import { Select as M } from "../Select/Select.js";
17
19
  import "react-hook-form";
18
20
  import "../../get-D8IXqiys.js";
@@ -20,8 +22,6 @@ import "../../isArray-BjSPDQ4v.js";
20
22
  import "../../isString-DVA49FEo.js";
21
23
  import "../../omit-CYY_mIYv.js";
22
24
  import "../../types/Time.js";
23
- import "../../index-CuHybtft.js";
24
- import "../SharedComponentsPermissionProvider/PermissionContext.js";
25
25
  import "../../react.esm-Bm0cAgpZ.js";
26
26
  import '../../assets/Filter.css';const T = "_filterButton_1qtzn_1", V = "_relativeParent_1qtzn_21", E = "_iconColor_1qtzn_25", J = "_filterBadge_1qtzn_29", Q = "_dense_1qtzn_36", U = "_filterModal_1qtzn_41", X = "_borderRadius_1qtzn_45", s = {
27
27
  filterButton: T,
@@ -1,6 +1,6 @@
1
1
  import { jsx as C, jsxs as pa } from "react/jsx-runtime";
2
2
  import { B as ba } from "../../../index.es-B8p8KCdj.js";
3
- import { b as u, a as o, c as d, d as s, r as wa, s as be, t as M, m as j, l as D, f as z, e as N, g as ya, D as Pa } from "../../../index.es-C7cC1Hdu.js";
3
+ import { b as u, a as o, c as d, d as s, r as wa, s as be, t as M, m as j, l as D, f as z, e as N, g as ya, D as Pa } from "../../../index.es-C32E1Lcb.js";
4
4
  import { D as ka } from "../../../index.es-B1h6DPYp.js";
5
5
  import { P as Ma } from "../../../index.es-BanVdXEd.js";
6
6
  import { useMemo as V, useState as $a } from "react";
@@ -1,5 +1,5 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { T as u } from "../../../index.es-B74L_Dje.js";
2
+ import { T as u } from "../../../index.es-BYcQTTL8.js";
3
3
  import { g } from "../../../get-D8IXqiys.js";
4
4
  import { o as f } from "../../../omit-CYY_mIYv.js";
5
5
  import { useMemo as v } from "react";
@@ -4,7 +4,7 @@ import { _ as Qe, a as Ce, b as Ye, c as et, d as Oe, e as _e, f as tt } from ".
4
4
  import { _ as Re } from "../../../parse-int-D-3oah_F.js";
5
5
  import p, { forwardRef as rt, useRef as De, useImperativeHandle as Ne, useCallback as x, useEffect as V, useMemo as ke } from "react";
6
6
  import { I as Be } from "../../../index.es-Dgxrk6xW.js";
7
- import { T as Pe } from "../../../index.es-B74L_Dje.js";
7
+ import { T as Pe } from "../../../index.es-BYcQTTL8.js";
8
8
  import { c as Me } from "../../../index.es-Da7ok-B-.js";
9
9
  import { b as Fe, c as j } from "../../../tslib.es6-BDCynO9F.js";
10
10
  import { M as nt, a as it } from "../../../component-Bz_dtX1r.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, Fragment as _, jsxs as z } from "react/jsx-runtime";
2
- import { T as M } from "../../../index.es-B74L_Dje.js";
2
+ import { T as M } from "../../../index.es-BYcQTTL8.js";
3
3
  import { a as P } from "../../../index.es-SjZ_-d7U.js";
4
4
  import { useState as V, useCallback as W, useMemo as d } from "react";
5
5
  import { useFormContext as D, Controller as v } from "react-hook-form";