@hortiview/shared-components 1.3.5 → 1.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 (26) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/{BigLoadingSpinner-iegTbDcD.js → BigLoadingSpinner-CqSGYzZA.js} +2 -2
  3. package/dist/components/AlertBanner/AlertBanner.js +14 -14
  4. package/dist/components/BlockView/BlockView.js +26 -24
  5. package/dist/components/ContextMenu/ContextMenu.js +29 -29
  6. package/dist/components/ContextMenu/ContextMenu.test.js +1 -1
  7. package/dist/components/Disclaimer/Disclaimer.js +7 -6
  8. package/dist/components/EmptyView/EmptyView.js +47 -37
  9. package/dist/components/Filter/Filter.d.ts +2 -1
  10. package/dist/components/Filter/Filter.js +107 -90
  11. package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +1 -1
  12. package/dist/components/FormComponents/FormSelect/FormSelect.js +22 -22
  13. package/dist/components/FormComponents/FormSelect/SelectTooltipText.js +6 -6
  14. package/dist/components/FormComponents/FormToggle/FormToggle.d.ts +3 -1
  15. package/dist/components/FormComponents/FormToggle/FormToggle.js +32 -26
  16. package/dist/components/FormComponents/FormToggle/FormToggle.test.js +19 -15
  17. package/dist/components/GenericTable/Mobile/GenericCardList.js +10 -10
  18. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.js +1 -1
  19. package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +1 -1
  20. package/dist/components/LoadingSpinner/Default/LoadingSpinner.js +1 -1
  21. package/dist/components/OverflowTooltip/OverflowTooltip.js +10 -9
  22. package/dist/components/SearchBar/SearchBar.js +3 -2
  23. package/dist/components/Select/Select.d.ts +1 -1
  24. package/dist/components/Select/Select.js +34 -27
  25. package/dist/components/VerticalDivider/VerticalDivider.js +12 -5
  26. package/package.json +1 -1
@@ -1,162 +1,179 @@
1
- import { jsx as t, jsxs as y, Fragment as D } from "react/jsx-runtime";
2
- import { N } from "../../index.es-d5xhUpJZ.js";
1
+ import { jsx as e, jsxs as b, Fragment as D } from "react/jsx-runtime";
2
+ import { N as F } from "../../index.es-d5xhUpJZ.js";
3
3
  import { B as h } from "../../index.es-CiqbARoC.js";
4
4
  import { G as _ } from "../../index.es-DntoATwO.js";
5
- import { I } from "../../index.es-0lQcz8m1.js";
6
- import { S as T } from "../../index.es-8GOVkuo-.js";
5
+ import { I as W } from "../../index.es-0lQcz8m1.js";
6
+ import { S as j } from "../../index.es-8GOVkuo-.js";
7
7
  import { useState as v } from "react";
8
8
  import '../../assets/main.css';import '../../assets/Filter.css';/* empty css */
9
- import { u as b } from "../../useBreakpoints-MzTZ0tCT.js";
10
- import { Iconify as W } from "../Iconify/Iconify.js";
9
+ import { u as k } from "../../useBreakpoints-MzTZ0tCT.js";
10
+ import { Iconify as z } from "../Iconify/Iconify.js";
11
11
  import "../../react-tooltip.min-DSY6KDqS.js";
12
12
  import "../../orderBy-Bd48bw88.js";
13
- import { SearchBar as j } from "../SearchBar/SearchBar.js";
13
+ import { SearchBar as G } from "../SearchBar/SearchBar.js";
14
14
  import "../../uniqueId-NU3-C36A.js";
15
- import { Modal as z } from "../Modal/Modal.js";
16
- import { Select as G } from "../Select/Select.js";
15
+ import { Modal as H } from "../Modal/Modal.js";
16
+ import { Select as I } from "../Select/Select.js";
17
17
  import "react-hook-form";
18
18
  import "../../get-DFv1gXfq.js";
19
19
  import "../../isArray-Dub1wGJM.js";
20
20
  import "../../isString-BW9UHONv.js";
21
- const H = "_filterButton_qtl7a_1", K = "_relativeParent_qtl7a_6", V = "_filterBadge_qtl7a_10", E = "_dense_qtl7a_17", u = {
22
- filterButton: H,
23
- relativeParent: K,
21
+ const K = "_filterButton_qtl7a_1", T = "_relativeParent_qtl7a_6", V = "_filterBadge_qtl7a_10", E = "_dense_qtl7a_17", u = {
22
+ filterButton: K,
23
+ relativeParent: T,
24
24
  filterBadge: V,
25
25
  dense: E
26
- }, dt = ({
27
- clearFilterText: d,
26
+ }, ct = ({
27
+ clearFilterText: m,
28
28
  closeCallback: s,
29
- currentFilter: r,
30
- filterButtonAsIcon: f = !1,
31
- filterButtonText: n,
32
- filterModalTitle: i,
33
- filters: m,
29
+ currentFilter: i,
30
+ filterButtonAsIcon: d = !1,
31
+ filterButtonText: a,
32
+ filterModalTitle: t,
33
+ filters: f,
34
34
  modalCancelButtonText: g,
35
35
  modalConfirmButtonText: p,
36
- useModal: l = !0,
37
- selectAllLabel: e
36
+ useModal: o = !0,
37
+ selectAllLabel: r,
38
+ "data-testid": w
38
39
  }) => {
39
- const { isDesktop: A } = b(), [q, B] = v(!1), [c, C] = v(r), [w, x] = v(0), S = () => {
40
- B(!1), s(c), x(
41
- c.reduce((a, { filterValue: o }) => o === void 0 ? a : typeof o == "boolean" ? o ? a + 1 : a : Array.isArray(o) ? a + o.length : typeof o == "string" && o.length ? a + 1 : a, 0)
40
+ const { isDesktop: A } = k(), [$, B] = v(!1), [c, y] = v(i), [q, C] = v(0), x = () => {
41
+ B(!1), s(c), C(
42
+ c.reduce((l, { filterValue: n }) => n === void 0 ? l : typeof n == "boolean" ? n ? l + 1 : l : Array.isArray(n) ? l + n.length : typeof n == "string" && n.length ? l + 1 : l, 0)
42
43
  );
43
44
  }, O = () => {
44
- C([]), x(0);
45
- }, F = (a) => {
46
- const o = [
47
- ...c.filter((P) => P.id !== a.id),
48
- a
45
+ y([]), C(0);
46
+ }, S = (l) => {
47
+ const n = [
48
+ ...c.filter((P) => P.id !== l.id),
49
+ l
49
50
  ];
50
- C(o), l || s(o);
51
+ y(n), o || s(n);
51
52
  };
52
- return l ? /* @__PURE__ */ y(D, { children: [
53
- /* @__PURE__ */ t(
53
+ return o ? /* @__PURE__ */ b(D, { children: [
54
+ /* @__PURE__ */ e(
54
55
  J,
55
56
  {
56
- filterButtonText: n,
57
- filterButtonAsIcon: f,
58
- count: w,
59
- onClick: () => B(!0)
57
+ filterButtonText: a,
58
+ filterButtonAsIcon: d,
59
+ count: q,
60
+ onClick: () => B(!0),
61
+ "data-testid": w
60
62
  }
61
63
  ),
62
- /* @__PURE__ */ t(
63
- z,
64
+ /* @__PURE__ */ e(
65
+ H,
64
66
  {
65
- open: q,
66
- onClose: S,
67
- title: i,
67
+ open: $,
68
+ onClose: x,
69
+ title: t,
68
70
  modalSize: A ? "small" : "fullscreen",
69
- headerActions: /* @__PURE__ */ t(h, { variant: "text", onClick: O, children: d }),
70
- dismissiveButton: /* @__PURE__ */ t(h, { variant: "outlined", onClick: () => B(!1), children: g }),
71
- primaryButton: /* @__PURE__ */ t(h, { variant: "filled", onClick: S, children: p }),
72
- children: /* @__PURE__ */ t(_, { direction: "vertical", children: k(m, c, F, e) })
71
+ headerActions: /* @__PURE__ */ e(h, { "data-testid": "filter-clear-button", variant: "text", onClick: O, children: m }),
72
+ dismissiveButton: /* @__PURE__ */ e(
73
+ h,
74
+ {
75
+ "data-testid": "filter-cancel-button",
76
+ variant: "outlined",
77
+ onClick: () => B(!1),
78
+ children: g
79
+ }
80
+ ),
81
+ primaryButton: /* @__PURE__ */ e(h, { "data-testid": "filter-confirm-button", variant: "filled", onClick: x, children: p }),
82
+ children: /* @__PURE__ */ e(_, { direction: "vertical", "data-testid": "filter-map-filters", children: N(f, c, S, r) })
73
83
  }
74
84
  )
75
- ] }) : /* @__PURE__ */ t(_, { secondaryAlign: "center", fullWidth: !0, children: k(m, c, F, e, !1) });
76
- }, k = (d, s, r, f, n = !0) => d.map(({ id: i, title: m, availableOptions: g, icon: p, type: l }) => /* @__PURE__ */ y(_, { fullWidth: !0, secondaryAlign: "center", children: [
77
- p ? /* @__PURE__ */ t(W, { icon: p, iconSize: "medium" }) : null,
78
- l === "select" && /* @__PURE__ */ t(
79
- G,
85
+ ] }) : /* @__PURE__ */ e(_, { secondaryAlign: "center", fullWidth: !0, children: N(f, c, S, r, !1) });
86
+ }, N = (m, s, i, d, a = !0) => m.map(({ id: t, title: f, availableOptions: g, icon: p, type: o }) => /* @__PURE__ */ b(_, { fullWidth: !0, secondaryAlign: "center", "data-testid": `filter-${o}-group-${t}`, children: [
87
+ p ? /* @__PURE__ */ e(z, { icon: p, iconSize: "medium" }) : null,
88
+ o === "select" && /* @__PURE__ */ e(
89
+ I,
80
90
  {
81
- selectAllLabel: f,
82
- className: n ? void 0 : u.dense,
91
+ "data-testid": `filter-select-${t}`,
92
+ selectAllLabel: d,
93
+ className: a ? void 0 : u.dense,
83
94
  variant: "outlined",
84
95
  options: g,
85
- label: m,
96
+ label: f,
86
97
  multiSelect: !0,
87
98
  textKey: "text",
88
99
  valueKey: "id",
89
- value: s.find((e) => e.id === i)?.filterValue ?? [],
90
- onChange: (e) => r({ id: i, type: l, filterValue: e }),
100
+ value: s.find((r) => r.id === t)?.filterValue ?? [],
101
+ onChange: (r) => i({ id: t, type: o, filterValue: r }),
91
102
  hoisted: !0,
92
103
  menuMaxHeight: "300px",
93
- disabled: i === "location",
104
+ disabled: t === "location",
94
105
  showOptionFilter: !1,
95
- dense: !n,
96
- fixedHeightInput: !n,
97
- multiDisplayType: n ? "pills" : "text"
106
+ dense: !a,
107
+ fixedHeightInput: !a,
108
+ multiDisplayType: a ? "pills" : "text"
98
109
  }
99
110
  ),
100
- l === "toggle" && /* @__PURE__ */ t(
101
- T,
111
+ o === "toggle" && /* @__PURE__ */ e(
112
+ j,
102
113
  {
103
- label: m,
104
- onChange: (e) => r({ id: i, type: l, filterValue: e }),
105
- checked: !!s.find((e) => e.id === i)?.filterValue
114
+ "data-testid": `filter-switch-${t}`,
115
+ label: f,
116
+ onChange: (r) => i({ id: t, type: o, filterValue: r }),
117
+ checked: !!s.find((r) => r.id === t)?.filterValue
106
118
  }
107
119
  ),
108
- l === "search" && /* @__PURE__ */ t(
109
- j,
120
+ o === "search" && /* @__PURE__ */ e(
121
+ G,
110
122
  {
111
- placeholder: m,
112
- searchTerm: s.find((e) => e.id === i)?.filterValue,
113
- setSearchTerm: (e) => r({ id: i, type: l, filterValue: e })
123
+ "data-testid": `filter-search-${t}`,
124
+ placeholder: f,
125
+ searchTerm: s.find((r) => r.id === t)?.filterValue,
126
+ setSearchTerm: (r) => i({ id: t, type: o, filterValue: r })
114
127
  }
115
128
  )
116
- ] }, i)), J = ({
117
- filterButtonText: d,
129
+ ] }, t)), J = ({
130
+ filterButtonText: m,
118
131
  filterButtonAsIcon: s,
119
- count: r,
120
- onClick: f
132
+ count: i,
133
+ "data-testid": d,
134
+ onClick: a
121
135
  }) => {
122
- const { isDesktop: n } = b();
123
- return s ? /* @__PURE__ */ t(
124
- I,
136
+ const { isDesktop: t } = k();
137
+ return s ? /* @__PURE__ */ e(
138
+ W,
125
139
  {
140
+ "data-testid": d ?? "filter-icon-button",
126
141
  icon: "filter_list_alt",
127
- onClick: f,
128
- badge: r !== 0 && /* @__PURE__ */ t(
129
- N,
142
+ onClick: a,
143
+ badge: i !== 0 && /* @__PURE__ */ e(
144
+ F,
130
145
  {
131
- counter: r,
146
+ counter: i,
132
147
  className: u.filterBadge,
133
148
  themeColor: "secondary",
134
149
  "data-testid": "filter-badge"
135
150
  }
136
151
  )
137
152
  }
138
- ) : /* @__PURE__ */ y(
153
+ ) : /* @__PURE__ */ b(
139
154
  "div",
140
155
  {
156
+ "data-testid": d ?? "filter-button-container",
141
157
  className: u.relativeParent,
142
- style: { height: "100%", width: n ? void 0 : "100%" },
158
+ style: { height: "100%", width: t ? void 0 : "100%" },
143
159
  children: [
144
- /* @__PURE__ */ t(
160
+ /* @__PURE__ */ e(
145
161
  h,
146
162
  {
163
+ "data-testid": "filter-button",
147
164
  variant: "outlined",
148
165
  themeColor: "primary",
149
166
  leadingIcon: "filter_list_alt",
150
- onClick: f,
167
+ onClick: a,
151
168
  className: u.filterButton,
152
- fullWidth: !n,
153
- children: d
169
+ fullWidth: !t,
170
+ children: m
154
171
  }
155
172
  ),
156
- r !== 0 && /* @__PURE__ */ t(
157
- N,
173
+ i !== 0 && /* @__PURE__ */ e(
174
+ F,
158
175
  {
159
- counter: r,
176
+ counter: i,
160
177
  className: u.filterBadge,
161
178
  themeColor: "secondary",
162
179
  "data-testid": "filter-badge"
@@ -167,5 +184,5 @@ const H = "_filterButton_qtl7a_1", K = "_relativeParent_qtl7a_6", V = "_filterBa
167
184
  );
168
185
  };
169
186
  export {
170
- dt as Filter
187
+ ct as Filter
171
188
  };
@@ -5,7 +5,7 @@ import { ExtendedSelectProps } from '../../Select/Select';
5
5
  /**
6
6
  * a generic FormSelector property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
7
7
  */
8
- type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'options' | 'searchable' | 'textKey' | 'valid' | 'value' | 'valueKey' | 'variant'> & Pick<ExtendedSelectProps, 'portalClassName'> & {
8
+ type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'options' | 'searchable' | 'textKey' | 'valid' | 'value' | 'valueKey' | 'variant'> & Pick<ExtendedSelectProps, 'portalClassName' | 'data-testid'> & {
9
9
  /** the name of the property in the form */
10
10
  propertyName: Path<T>;
11
11
  /** the label of the select */
@@ -1,4 +1,4 @@
1
- import { jsx as l, Fragment as k, jsxs as z } from "react/jsx-runtime";
1
+ import { jsx as o, Fragment as k, jsxs as z } from "react/jsx-runtime";
2
2
  import { g as _ } from "../../../get-DFv1gXfq.js";
3
3
  import { i as G } from "../../../isArray-Dub1wGJM.js";
4
4
  import { useMemo as C } from "react";
@@ -20,19 +20,19 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
20
20
  }, ft = ({
21
21
  propertyName: i,
22
22
  label: s,
23
- options: o,
23
+ options: r,
24
24
  multi: d = !1,
25
25
  disabled: x = !1,
26
26
  hoisted: H = !1,
27
27
  hidden: I = !1,
28
- valueKey: r = "value",
28
+ valueKey: n = "value",
29
29
  textKey: u = "text",
30
30
  clearable: w = !1,
31
31
  searchable: D = !0,
32
32
  noOptionsMessage: T = "",
33
33
  rules: f,
34
34
  menuPosition: P = "auto",
35
- ...n
35
+ ...l
36
36
  }) => {
37
37
  const {
38
38
  control: v,
@@ -46,28 +46,28 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
46
46
  [f]
47
47
  ), { helperText: M, helperTextPersistent: j } = O({
48
48
  propertyName: i,
49
- helperText: n.helperText,
49
+ helperText: l.helperText,
50
50
  requiredText: b,
51
51
  hasCharacterCount: !1
52
52
  });
53
- return I ? /* @__PURE__ */ l($, { name: i, control: v, render: () => /* @__PURE__ */ l(k, {}) }) : /* @__PURE__ */ l(
53
+ return I ? /* @__PURE__ */ o($, { name: i, control: v, render: () => /* @__PURE__ */ o(k, {}) }) : /* @__PURE__ */ o(
54
54
  "div",
55
55
  {
56
56
  "data-testid": "form-select-container",
57
57
  className: e.formSelectContainer,
58
58
  "data-tooltip-id": s,
59
- children: /* @__PURE__ */ l(
59
+ children: /* @__PURE__ */ o(
60
60
  $,
61
61
  {
62
62
  name: i,
63
63
  rules: f,
64
64
  control: v,
65
65
  render: ({ field: { ref: et, onChange: m, value: g, ...q } }) => {
66
- let h = o;
67
- G(o) && _(o[0], "options") !== void 0 && (h = o.flatMap((t) => _(t, "options") ?? []));
66
+ let h = r;
67
+ G(r) && _(r[0], "options") !== void 0 && (h = r.flatMap((t) => _(t, "options") ?? []));
68
68
  const a = d ? h?.filter(
69
- (t) => g?.includes(t[r])
70
- ) : h?.find((t) => t[r] === g), A = d && n.multiDisplayType === "text" && n.fixedHeightInput, c = B(i).invalid, E = `
69
+ (t) => g?.includes(t[n])
70
+ ) : h?.find((t) => t[n] === g), A = d && l.multiDisplayType === "text" && l.fixedHeightInput, c = B(i).invalid, E = `
71
71
  ${e.formSelect}
72
72
  ${c ? e.invalidHelperText : ""}
73
73
  ${c ? e.invalidDropdownIcon : ""}
@@ -76,23 +76,23 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
76
76
  ${A ? e.multiText : ""}
77
77
  ${x ? e.disabled : ""}`;
78
78
  return /* @__PURE__ */ z(k, { children: [
79
- /* @__PURE__ */ l(
79
+ /* @__PURE__ */ o(
80
80
  Q,
81
81
  {
82
82
  ...q,
83
- ...n,
83
+ ...l,
84
84
  value: a ?? [],
85
85
  label: s,
86
86
  variant: "outlined",
87
87
  helperText: M,
88
88
  helperTextPersistent: j,
89
- options: o,
89
+ options: r,
90
90
  valid: !F,
91
- "data-testid": `select-${i}`,
92
- multiSelect: !o?.length && T ? !1 : d,
91
+ "data-testid": l["data-testid"] ?? `select-${i}`,
92
+ multiSelect: !r?.length && T ? !1 : d,
93
93
  className: E,
94
94
  disabled: x,
95
- valueKey: r,
95
+ valueKey: n,
96
96
  textKey: u,
97
97
  onChange: (t) => {
98
98
  if (t == null) {
@@ -100,10 +100,10 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
100
100
  return;
101
101
  }
102
102
  if (d) {
103
- m(t.map((V) => V[r]));
103
+ m(t.map((V) => V[n]));
104
104
  return;
105
105
  }
106
- m(t[r]), n?.onChange?.(t);
106
+ m(t[n]), l?.onChange?.(t);
107
107
  },
108
108
  hoisted: H,
109
109
  noOptionsMessage: T,
@@ -112,7 +112,7 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
112
112
  menuPosition: P
113
113
  }
114
114
  ),
115
- /* @__PURE__ */ l(
115
+ /* @__PURE__ */ o(
116
116
  L,
117
117
  {
118
118
  id: s,
@@ -120,8 +120,8 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
120
120
  place: "bottom",
121
121
  delayShow: 420,
122
122
  className: e.tooltip,
123
- hidden: !a || a.length === 0 || !n.fixedHeightInput,
124
- children: /* @__PURE__ */ l(R, { value: a, textKey: u, valueKey: r })
123
+ hidden: !a || a.length === 0 || !l.fixedHeightInput,
124
+ children: /* @__PURE__ */ o(R, { value: a, textKey: u, valueKey: n })
125
125
  }
126
126
  )
127
127
  ] });
@@ -1,10 +1,10 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { G as n } from "../../../index.es-DntoATwO.js";
3
- import { b as p } from "../../../index.es-CF_xy2ns.js";
4
- const s = ({ value: r, textKey: o, valueKey: e }) => {
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { G as p } from "../../../index.es-DntoATwO.js";
3
+ import { b as d } from "../../../index.es-CF_xy2ns.js";
4
+ const m = ({ value: r, textKey: t, valueKey: e }) => {
5
5
  if (!(!r || r.length === 0))
6
- return Array.isArray(r) ? /* @__PURE__ */ t(n, { direction: "vertical", gap: "dense", children: r?.map((i) => /* @__PURE__ */ t(p, { level: 2, children: i[o] }, i[e])) }) : r?.[o];
6
+ return Array.isArray(r) ? /* @__PURE__ */ i(p, { "data-testid": "select-tooltip", direction: "vertical", gap: "dense", children: r?.map((o) => /* @__PURE__ */ i(d, { level: 2, children: o[t] }, o[e])) }) : r?.[t];
7
7
  };
8
8
  export {
9
- s as SelectTooltipText
9
+ m as SelectTooltipText
10
10
  };
@@ -14,6 +14,8 @@ type FormToggleProps<T extends FieldValues> = {
14
14
  onChange?: SwitchProps['onChange'];
15
15
  /** Determines if this input is disabled. */
16
16
  disabled?: SwitchProps['disabled'];
17
+ /** Unique identifier for targeting this element in automated tests. */
18
+ 'data-testid'?: string;
17
19
  };
18
20
  /**
19
21
  * FormToggle is a custom form input component for selecting toggle.
@@ -28,5 +30,5 @@ type FormToggleProps<T extends FieldValues> = {
28
30
  *
29
31
  * @returns A JSX element that renders a toggle form input.
30
32
  */
31
- export declare const FormToggle: <T extends FieldValues>({ propertyName, label, validate, required, onChange, disabled, }: FormToggleProps<T>) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const FormToggle: <T extends FieldValues>({ propertyName, label, validate, required, onChange, disabled, "data-testid": dataTestId, }: FormToggleProps<T>) => import("react/jsx-runtime").JSX.Element;
32
34
  export {};
@@ -1,41 +1,47 @@
1
- import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
- import { G as h } from "../../../index.es-DntoATwO.js";
3
- import { S as l } from "../../../index.es-8GOVkuo-.js";
4
- import { a as d } from "../../../index.es-CF_xy2ns.js";
5
- import { useFormContext as u, Controller as C } from "react-hook-form";
1
+ import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
+ import { G as d } from "../../../index.es-DntoATwO.js";
3
+ import { S as f } from "../../../index.es-8GOVkuo-.js";
4
+ import { a as h } from "../../../index.es-CF_xy2ns.js";
5
+ import { u as C } from "../../../uniqueId-NU3-C36A.js";
6
+ import { useEffect as x } from "react";
7
+ import { useFormContext as T, Controller as y } from "react-hook-form";
6
8
  const F = ({
7
- propertyName: t,
8
- label: n,
9
- validate: m,
10
- required: s,
9
+ propertyName: n,
10
+ label: s,
11
+ validate: i,
12
+ required: c,
11
13
  onChange: a,
12
- disabled: c
14
+ disabled: g,
15
+ "data-testid": m = "toggle"
13
16
  }) => {
14
- const { control: i } = u();
15
- return /* @__PURE__ */ o(
16
- C,
17
+ const { control: l } = T(), e = C("formToggleTestId-");
18
+ return x(() => {
19
+ const r = document.querySelectorAll(`input#${e}[type="checkbox"]`);
20
+ r && r.forEach((o) => o.setAttribute("data-testid", m));
21
+ }, [m, e]), /* @__PURE__ */ t(
22
+ y,
17
23
  {
18
- name: t,
19
- control: i,
24
+ name: n,
25
+ control: l,
20
26
  rules: {
21
- required: s,
22
- validate: m
27
+ required: c,
28
+ validate: i
23
29
  },
24
- render: ({ field: r, fieldState: e }) => /* @__PURE__ */ g(h, { direction: "vertical", children: [
25
- /* @__PURE__ */ o(
26
- l,
30
+ render: ({ field: r, fieldState: o }) => /* @__PURE__ */ p(d, { direction: "vertical", children: [
31
+ /* @__PURE__ */ t(
32
+ f,
27
33
  {
28
- "data-testid": "checkbox",
34
+ id: e,
29
35
  ...r,
30
- label: n,
31
- onChange: (...p) => {
32
- r.onChange(...p), a?.();
36
+ label: s,
37
+ onChange: (...u) => {
38
+ r.onChange(...u), a?.();
33
39
  },
34
40
  checked: r.value,
35
- disabled: c
41
+ disabled: g
36
42
  }
37
43
  ),
38
- e.error && /* @__PURE__ */ o(d, { "data-testid": "toggle-error-message", themeColor: "error", children: e.error.message })
44
+ o.error && /* @__PURE__ */ t(h, { "data-testid": "toggle-error-message", themeColor: "error", children: o.error.message })
39
45
  ] })
40
46
  }
41
47
  );
@@ -1,15 +1,15 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { a as n, s as t, f as m } from "../../../react.esm-CX1WJ2Pp.js";
3
- import { FormToggle as l } from "./FormToggle.js";
4
- import { v as e, d as f, t as c, g as r } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
5
- const a = e.fn();
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { a as s, s as t, f as m } from "../../../react.esm-CX1WJ2Pp.js";
3
+ import { FormToggle as n } from "./FormToggle.js";
4
+ import { v as e, d as u, t as l, g as o } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
5
+ const c = e.fn();
6
6
  e.mock("react-hook-form", () => ({
7
7
  ...e.importActual("react-hook-form"),
8
8
  Controller: ({
9
- render: o
10
- }) => o({
9
+ render: r
10
+ }) => r({
11
11
  field: {
12
- onChange: a
12
+ onChange: c
13
13
  },
14
14
  fieldState: { error: { message: "error" } }
15
15
  }),
@@ -39,12 +39,16 @@ e.mock("react-hook-form", () => ({
39
39
  watch: () => "2024-08-07"
40
40
  })
41
41
  }));
42
- f("FormToggle Test", () => {
43
- c("render FormToggle", () => {
44
- n(/* @__PURE__ */ s(l, { propertyName: "hasValue", label: "user.hasValue" })), r(t.getByText("user.hasValue")).toBeInTheDocument(), r(t.getByText("error")).toBeInTheDocument(), r(t.getByRole("switch")).toBeInTheDocument();
45
- }), c("render FormToggle click", () => {
46
- n(/* @__PURE__ */ s(l, { propertyName: "hasValue", label: "user.hasValue", onChange: a }));
47
- const o = t.getByRole("switch");
48
- m.click(o), r(a).toHaveBeenCalled();
42
+ u("FormToggle Test", () => {
43
+ l("render FormToggle", () => {
44
+ s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), o(t.getByText("user.hasValue")).toBeInTheDocument(), o(t.getByText("error")).toBeInTheDocument(), o(t.getByRole("switch")).toBeInTheDocument();
45
+ }), l("render FormToggle click", () => {
46
+ s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue", onChange: c }));
47
+ const r = t.getByRole("switch");
48
+ m.click(r), o(c).toHaveBeenCalled();
49
+ }), l("render FormToggle with custom data-testid", () => {
50
+ s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue", "data-testid": "custom-test-id" })), o(t.getByTestId("custom-test-id")).toBeInTheDocument();
51
+ const r = t.queryByTestId("toggle");
52
+ o(r).not.toBeInTheDocument();
49
53
  });
50
54
  });
@@ -1,25 +1,25 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { G as d } from "../../../index.es-DntoATwO.js";
2
+ import { G as c } from "../../../index.es-DntoATwO.js";
3
3
  import { P as l } from "../../../index.es-D-CKRzIB.js";
4
- import { a as c } from "../../../index.es-CF_xy2ns.js";
5
- import { s as t, G as m } from "../../../GenericCard-CelFEWlW.js";
6
- const g = ({
4
+ import { a as o } from "../../../index.es-CF_xy2ns.js";
5
+ import { s as i, G as m } from "../../../GenericCard-CelFEWlW.js";
6
+ const u = ({
7
7
  columns: n,
8
8
  data: e,
9
9
  hiddenColumns: a = [],
10
- noContentText: s
11
- }) => e?.length === 0 ? /* @__PURE__ */ r("div", { className: t.emptyContainer, children: /* @__PURE__ */ r(l, { variant: "standard", style: { textAlign: "center" }, className: t.empty, children: /* @__PURE__ */ r(c, { children: s }) }) }) : (
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 }) }) }) : (
12
12
  // needs the div to surround the Group by an element with display: block to avoid visual errors
13
- /* @__PURE__ */ r("div", { style: { width: "100%" }, children: /* @__PURE__ */ r(d, { fullWidth: !0, direction: "vertical", primaryAlign: "center", secondaryAlign: "center", children: e?.map((i, o) => /* @__PURE__ */ r(
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(
14
14
  m,
15
15
  {
16
- item: i,
16
+ item: t,
17
17
  columns: n,
18
18
  hiddenColumns: a
19
19
  },
20
- i.id ?? o
20
+ t.id ?? s
21
21
  )) }) })
22
22
  );
23
23
  export {
24
- g as GenericCardList
24
+ u as GenericCardList
25
25
  };
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../../index.es-CF_xy2ns.js";
3
3
  import "../../Iconify/Iconify.js";
4
- import { B as t } from "../../../BigLoadingSpinner-iegTbDcD.js";
4
+ import { B as t } from "../../../BigLoadingSpinner-CqSGYzZA.js";
5
5
  export {
6
6
  t as BigLoadingSpinner
7
7
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { s as r, B as n } from "../../../BigLoadingSpinner-iegTbDcD.js";
2
+ import { s as r, B as n } from "../../../BigLoadingSpinner-CqSGYzZA.js";
3
3
  import { a as i, s as e } from "../../../react.esm-CX1WJ2Pp.js";
4
4
  import { d as g, t as a, g as t } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
5
5
  g("BigLoadingSpinner Test", () => {
@@ -7,7 +7,7 @@ import { M as G, a as K } from "../../../component-neHBNHRu.js";
7
7
  import { G as q } from "../../../index.es-DntoATwO.js";
8
8
  import { P as J } from "../../../index.es-D-CKRzIB.js";
9
9
  import { b as Q } from "../../../index.es-CF_xy2ns.js";
10
- import { B as X } from "../../../BigLoadingSpinner-iegTbDcD.js";
10
+ import { B as X } from "../../../BigLoadingSpinner-CqSGYzZA.js";
11
11
  import '../../../assets/LoadingSpinner.css';/**
12
12
  * @license
13
13
  * Copyright 2020 Google Inc.