@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.
- package/CHANGELOG.md +26 -0
- package/dist/{BigLoadingSpinner-iegTbDcD.js → BigLoadingSpinner-CqSGYzZA.js} +2 -2
- package/dist/components/AlertBanner/AlertBanner.js +14 -14
- package/dist/components/BlockView/BlockView.js +26 -24
- package/dist/components/ContextMenu/ContextMenu.js +29 -29
- package/dist/components/ContextMenu/ContextMenu.test.js +1 -1
- package/dist/components/Disclaimer/Disclaimer.js +7 -6
- package/dist/components/EmptyView/EmptyView.js +47 -37
- package/dist/components/Filter/Filter.d.ts +2 -1
- package/dist/components/Filter/Filter.js +107 -90
- package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +1 -1
- package/dist/components/FormComponents/FormSelect/FormSelect.js +22 -22
- package/dist/components/FormComponents/FormSelect/SelectTooltipText.js +6 -6
- package/dist/components/FormComponents/FormToggle/FormToggle.d.ts +3 -1
- package/dist/components/FormComponents/FormToggle/FormToggle.js +32 -26
- package/dist/components/FormComponents/FormToggle/FormToggle.test.js +19 -15
- package/dist/components/GenericTable/Mobile/GenericCardList.js +10 -10
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +1 -1
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.js +1 -1
- package/dist/components/OverflowTooltip/OverflowTooltip.js +10 -9
- package/dist/components/SearchBar/SearchBar.js +3 -2
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.js +34 -27
- package/dist/components/VerticalDivider/VerticalDivider.js +12 -5
- package/package.json +1 -1
|
@@ -1,162 +1,179 @@
|
|
|
1
|
-
import { jsx as
|
|
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
|
|
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
|
|
10
|
-
import { Iconify as
|
|
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
|
|
13
|
+
import { SearchBar as G } from "../SearchBar/SearchBar.js";
|
|
14
14
|
import "../../uniqueId-NU3-C36A.js";
|
|
15
|
-
import { Modal as
|
|
16
|
-
import { Select as
|
|
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
|
|
22
|
-
filterButton:
|
|
23
|
-
relativeParent:
|
|
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
|
-
},
|
|
27
|
-
clearFilterText:
|
|
26
|
+
}, ct = ({
|
|
27
|
+
clearFilterText: m,
|
|
28
28
|
closeCallback: s,
|
|
29
|
-
currentFilter:
|
|
30
|
-
filterButtonAsIcon:
|
|
31
|
-
filterButtonText:
|
|
32
|
-
filterModalTitle:
|
|
33
|
-
filters:
|
|
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:
|
|
37
|
-
selectAllLabel:
|
|
36
|
+
useModal: o = !0,
|
|
37
|
+
selectAllLabel: r,
|
|
38
|
+
"data-testid": w
|
|
38
39
|
}) => {
|
|
39
|
-
const { isDesktop: A } =
|
|
40
|
-
B(!1), s(c),
|
|
41
|
-
c.reduce((
|
|
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
|
-
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
...c.filter((P) => P.id !==
|
|
48
|
-
|
|
45
|
+
y([]), C(0);
|
|
46
|
+
}, S = (l) => {
|
|
47
|
+
const n = [
|
|
48
|
+
...c.filter((P) => P.id !== l.id),
|
|
49
|
+
l
|
|
49
50
|
];
|
|
50
|
-
|
|
51
|
+
y(n), o || s(n);
|
|
51
52
|
};
|
|
52
|
-
return
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
return o ? /* @__PURE__ */ b(D, { children: [
|
|
54
|
+
/* @__PURE__ */ e(
|
|
54
55
|
J,
|
|
55
56
|
{
|
|
56
|
-
filterButtonText:
|
|
57
|
-
filterButtonAsIcon:
|
|
58
|
-
count:
|
|
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__ */
|
|
63
|
-
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
H,
|
|
64
66
|
{
|
|
65
|
-
open:
|
|
66
|
-
onClose:
|
|
67
|
-
title:
|
|
67
|
+
open: $,
|
|
68
|
+
onClose: x,
|
|
69
|
+
title: t,
|
|
68
70
|
modalSize: A ? "small" : "fullscreen",
|
|
69
|
-
headerActions: /* @__PURE__ */
|
|
70
|
-
dismissiveButton: /* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
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__ */
|
|
76
|
-
},
|
|
77
|
-
p ? /* @__PURE__ */
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
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:
|
|
96
|
+
label: f,
|
|
86
97
|
multiSelect: !0,
|
|
87
98
|
textKey: "text",
|
|
88
99
|
valueKey: "id",
|
|
89
|
-
value: s.find((
|
|
90
|
-
onChange: (
|
|
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:
|
|
104
|
+
disabled: t === "location",
|
|
94
105
|
showOptionFilter: !1,
|
|
95
|
-
dense: !
|
|
96
|
-
fixedHeightInput: !
|
|
97
|
-
multiDisplayType:
|
|
106
|
+
dense: !a,
|
|
107
|
+
fixedHeightInput: !a,
|
|
108
|
+
multiDisplayType: a ? "pills" : "text"
|
|
98
109
|
}
|
|
99
110
|
),
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
o === "toggle" && /* @__PURE__ */ e(
|
|
112
|
+
j,
|
|
102
113
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
109
|
-
|
|
120
|
+
o === "search" && /* @__PURE__ */ e(
|
|
121
|
+
G,
|
|
110
122
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
] },
|
|
117
|
-
filterButtonText:
|
|
129
|
+
] }, t)), J = ({
|
|
130
|
+
filterButtonText: m,
|
|
118
131
|
filterButtonAsIcon: s,
|
|
119
|
-
count:
|
|
120
|
-
|
|
132
|
+
count: i,
|
|
133
|
+
"data-testid": d,
|
|
134
|
+
onClick: a
|
|
121
135
|
}) => {
|
|
122
|
-
const { isDesktop:
|
|
123
|
-
return s ? /* @__PURE__ */
|
|
124
|
-
|
|
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:
|
|
128
|
-
badge:
|
|
129
|
-
|
|
142
|
+
onClick: a,
|
|
143
|
+
badge: i !== 0 && /* @__PURE__ */ e(
|
|
144
|
+
F,
|
|
130
145
|
{
|
|
131
|
-
counter:
|
|
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__ */
|
|
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:
|
|
158
|
+
style: { height: "100%", width: t ? void 0 : "100%" },
|
|
143
159
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
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:
|
|
167
|
+
onClick: a,
|
|
151
168
|
className: u.filterButton,
|
|
152
|
-
fullWidth: !
|
|
153
|
-
children:
|
|
169
|
+
fullWidth: !t,
|
|
170
|
+
children: m
|
|
154
171
|
}
|
|
155
172
|
),
|
|
156
|
-
|
|
157
|
-
|
|
173
|
+
i !== 0 && /* @__PURE__ */ e(
|
|
174
|
+
F,
|
|
158
175
|
{
|
|
159
|
-
counter:
|
|
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
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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
|
-
...
|
|
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:
|
|
49
|
+
helperText: l.helperText,
|
|
50
50
|
requiredText: b,
|
|
51
51
|
hasCharacterCount: !1
|
|
52
52
|
});
|
|
53
|
-
return I ? /* @__PURE__ */
|
|
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__ */
|
|
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 =
|
|
67
|
-
G(
|
|
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[
|
|
70
|
-
) : h?.find((t) => t[
|
|
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__ */
|
|
79
|
+
/* @__PURE__ */ o(
|
|
80
80
|
Q,
|
|
81
81
|
{
|
|
82
82
|
...q,
|
|
83
|
-
...
|
|
83
|
+
...l,
|
|
84
84
|
value: a ?? [],
|
|
85
85
|
label: s,
|
|
86
86
|
variant: "outlined",
|
|
87
87
|
helperText: M,
|
|
88
88
|
helperTextPersistent: j,
|
|
89
|
-
options:
|
|
89
|
+
options: r,
|
|
90
90
|
valid: !F,
|
|
91
|
-
"data-testid": `select-${i}`,
|
|
92
|
-
multiSelect: !
|
|
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:
|
|
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[
|
|
103
|
+
m(t.map((V) => V[n]));
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
m(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__ */
|
|
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 || !
|
|
124
|
-
children: /* @__PURE__ */
|
|
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
|
|
2
|
-
import { G as
|
|
3
|
-
import { b as
|
|
4
|
-
const
|
|
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__ */
|
|
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
|
-
|
|
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
|
|
2
|
-
import { G as
|
|
3
|
-
import { S as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
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:
|
|
8
|
-
label:
|
|
9
|
-
validate:
|
|
10
|
-
required:
|
|
9
|
+
propertyName: n,
|
|
10
|
+
label: s,
|
|
11
|
+
validate: i,
|
|
12
|
+
required: c,
|
|
11
13
|
onChange: a,
|
|
12
|
-
disabled:
|
|
14
|
+
disabled: g,
|
|
15
|
+
"data-testid": m = "toggle"
|
|
13
16
|
}) => {
|
|
14
|
-
const { control:
|
|
15
|
-
return
|
|
16
|
-
|
|
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:
|
|
19
|
-
control:
|
|
24
|
+
name: n,
|
|
25
|
+
control: l,
|
|
20
26
|
rules: {
|
|
21
|
-
required:
|
|
22
|
-
validate:
|
|
27
|
+
required: c,
|
|
28
|
+
validate: i
|
|
23
29
|
},
|
|
24
|
-
render: ({ field: r, fieldState:
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
30
|
+
render: ({ field: r, fieldState: o }) => /* @__PURE__ */ p(d, { direction: "vertical", children: [
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
f,
|
|
27
33
|
{
|
|
28
|
-
|
|
34
|
+
id: e,
|
|
29
35
|
...r,
|
|
30
|
-
label:
|
|
31
|
-
onChange: (...
|
|
32
|
-
r.onChange(...
|
|
36
|
+
label: s,
|
|
37
|
+
onChange: (...u) => {
|
|
38
|
+
r.onChange(...u), a?.();
|
|
33
39
|
},
|
|
34
40
|
checked: r.value,
|
|
35
|
-
disabled:
|
|
41
|
+
disabled: g
|
|
36
42
|
}
|
|
37
43
|
),
|
|
38
|
-
|
|
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
|
|
2
|
-
import { a as
|
|
3
|
-
import { FormToggle as
|
|
4
|
-
import { v as e, d as
|
|
5
|
-
const
|
|
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:
|
|
10
|
-
}) =>
|
|
9
|
+
render: r
|
|
10
|
+
}) => r({
|
|
11
11
|
field: {
|
|
12
|
-
onChange:
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
m.click(
|
|
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
|
|
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
|
|
5
|
-
import { s as
|
|
6
|
-
const
|
|
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:
|
|
11
|
-
}) => e?.length === 0 ? /* @__PURE__ */ r("div", { className:
|
|
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(
|
|
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:
|
|
16
|
+
item: t,
|
|
17
17
|
columns: n,
|
|
18
18
|
hiddenColumns: a
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
t.id ?? s
|
|
21
21
|
)) }) })
|
|
22
22
|
);
|
|
23
23
|
export {
|
|
24
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
10
|
+
import { B as X } from "../../../BigLoadingSpinner-CqSGYzZA.js";
|
|
11
11
|
import '../../../assets/LoadingSpinner.css';/**
|
|
12
12
|
* @license
|
|
13
13
|
* Copyright 2020 Google Inc.
|