@hortiview/shared-components 0.0.7369 → 0.0.7403
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/dist/assets/genericTable.css +1 -1
- package/dist/assets/infoGroup.css +1 -1
- package/dist/components/Filter/Filter.d.ts +4 -1
- package/dist/components/Filter/Filter.js +93 -85
- package/dist/components/Filter/Filter.test.js +51 -33
- package/dist/components/GenericTable/GenericTable.js +2 -2
- package/dist/components/InfoGroup/InfoGroup.d.ts +10 -6
- package/dist/components/InfoGroup/InfoGroup.js +51 -52
- package/dist/components/InfoGroup/InfoGroup.test.js +2 -2
- package/dist/enums/ThemeColor.d.ts +15 -0
- package/dist/enums/ThemeColor.js +4 -0
- package/dist/genericTable.module-CNV1Yt1K.js +16 -0
- package/dist/infoGroup.module-Cxw88dfC.js +12 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +17 -15
- package/dist/types/Filter.d.ts +1 -0
- package/package.json +10 -10
- package/dist/genericTable.module-CXfRg0e4.js +0 -15
- package/dist/infoGroup.module-B3E1gCGi.js +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._dividerContainer_4c1hq_1{width:100%;padding:1rem 0}._fullWidth_4c1hq_6{width:100%}._centerDefaultComponent_4c1hq_10{margin:auto}._verticalDivider_4c1hq_14{display:flex;align-self:stretch;height:auto;width:1px;background-color:var(--lmnt-theme-on-surface-stroke, rgba(0, 0, 0, .12))}._mainGroup_4c1hq_22{padding:1rem;border:.0775rem solid var(--lmnt-on-surface-stroke, rgba(0, 0, 0, .12));border-radius:.5rem}._textAlignRight_4c1hq_28{text-align:right}
|
|
@@ -9,6 +9,7 @@ type FilterProps = {
|
|
|
9
9
|
filterButtonText: string;
|
|
10
10
|
filterModalTitle: string;
|
|
11
11
|
filters: FilterData[];
|
|
12
|
+
useModal?: boolean;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* Filter component that allows the user to filter the data provided
|
|
@@ -21,7 +22,9 @@ type FilterProps = {
|
|
|
21
22
|
* @param filters - the filter data
|
|
22
23
|
* @param modalCancelButtonText - the text for the cancel button in the modal
|
|
23
24
|
* @param modalConfirmButtonText - the text for the confirm button in the modal
|
|
25
|
+
* @param useModal - if the filter should use a modal and a filter button, default is true,
|
|
26
|
+
* if false the filters will be displayed directly in the page, be aware that the filters will be displayed in a row and there needs to be enough space for them
|
|
24
27
|
* @returns
|
|
25
28
|
*/
|
|
26
|
-
export declare const Filter: ({ clearFilterText, closeCallback, currentFilter, filterButtonAsIcon, filterButtonText, filterModalTitle, filters, modalCancelButtonText, modalConfirmButtonText, }: FilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const Filter: ({ clearFilterText, closeCallback, currentFilter, filterButtonAsIcon, filterButtonText, filterModalTitle, filters, modalCancelButtonText, modalConfirmButtonText, useModal, }: FilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
30
|
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import { s as
|
|
5
|
-
import { u as
|
|
1
|
+
import { jsx as t, jsxs as y, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { Group as v, Modal as W, Button as p, Select as j, IconButton as z, NotificationBadge as S } from "@element/react-components";
|
|
3
|
+
import { useState as g } from "react";
|
|
4
|
+
import { s as d } from "../../genericTable.module-CNV1Yt1K.js";
|
|
5
|
+
import { u as O } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
6
6
|
import "../../alertBanner.module-HneYdVzN.js";
|
|
7
|
-
import "../../
|
|
8
|
-
import "../../isArray-Ca4KR8TK.js";
|
|
7
|
+
import { I as H } from "../../Iconify-CY9lZjFd.js";
|
|
9
8
|
import "../../react-tooltip.min-BzHiZW8k.js";
|
|
10
9
|
import "../../basicHeading.module-BYb8xvuk.js";
|
|
10
|
+
import "../../isArray-Ca4KR8TK.js";
|
|
11
11
|
import "../../_baseToString-BNXOi2Mf.js";
|
|
12
12
|
import "../../_equalByTag-DJhSpgVG.js";
|
|
13
|
+
import "../../iconify.module-C89oaw5b.js";
|
|
13
14
|
import "../../searchBar.module-9gKyrZRT.js";
|
|
14
15
|
import "../../listArea.module-CGpHPOji.js";
|
|
15
16
|
import "../../verticalDivider.module-C3_GL-fH.js";
|
|
@@ -22,7 +23,7 @@ import "../../disclaimer.module-BZydt-Q_.js";
|
|
|
22
23
|
import "../../genericCard.module-DzqcufuN.js";
|
|
23
24
|
import "../../HashTabView.module-CJX4gxTu.js";
|
|
24
25
|
import "../../HeaderFilter.module-DiBmulr5.js";
|
|
25
|
-
import "../../infoGroup.module-
|
|
26
|
+
import "../../infoGroup.module-Cxw88dfC.js";
|
|
26
27
|
import "../../bigLoadingSpinner.module-GgbFol8k.js";
|
|
27
28
|
import "../../loadingSpinner.module-CLtqSMWA.js";
|
|
28
29
|
import "../Scrollbar/Scrollbar.js";
|
|
@@ -30,111 +31,118 @@ import "react-hook-form";
|
|
|
30
31
|
import "../../formDatePicker.module-BV3ma_7y.js";
|
|
31
32
|
import "../../formSelect.module-C18N-SsT.js";
|
|
32
33
|
import "../../formText.module-C0by6_DK.js";
|
|
33
|
-
const
|
|
34
|
-
clearFilterText:
|
|
35
|
-
closeCallback:
|
|
36
|
-
currentFilter:
|
|
37
|
-
filterButtonAsIcon:
|
|
38
|
-
filterButtonText:
|
|
39
|
-
filterModalTitle:
|
|
40
|
-
filters:
|
|
41
|
-
modalCancelButtonText:
|
|
42
|
-
modalConfirmButtonText:
|
|
34
|
+
const vt = ({
|
|
35
|
+
clearFilterText: o,
|
|
36
|
+
closeCallback: l,
|
|
37
|
+
currentFilter: r,
|
|
38
|
+
filterButtonAsIcon: e = !1,
|
|
39
|
+
filterButtonText: i,
|
|
40
|
+
filterModalTitle: u,
|
|
41
|
+
filters: a,
|
|
42
|
+
modalCancelButtonText: m,
|
|
43
|
+
modalConfirmButtonText: n,
|
|
44
|
+
useModal: b = !0
|
|
43
45
|
}) => {
|
|
44
|
-
const { isDesktop:
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
const { isDesktop: N } = O(), [A, f] = g(!1), [s, C] = g(r), [_, x] = g(0), B = () => {
|
|
47
|
+
f(!1), l(s), x(
|
|
48
|
+
s.reduce((c, { selectedOptions: h }) => c + h.length, 0)
|
|
47
49
|
);
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
...
|
|
53
|
-
|
|
50
|
+
}, w = () => {
|
|
51
|
+
C([]), x(0);
|
|
52
|
+
}, F = (c) => {
|
|
53
|
+
const h = [
|
|
54
|
+
...s.filter((D) => D.id !== c.id),
|
|
55
|
+
c
|
|
54
56
|
];
|
|
55
|
-
h
|
|
57
|
+
C(h);
|
|
56
58
|
};
|
|
57
|
-
return /* @__PURE__ */
|
|
59
|
+
return b ? /* @__PURE__ */ y(I, { children: [
|
|
58
60
|
/* @__PURE__ */ t(
|
|
59
|
-
|
|
61
|
+
K,
|
|
60
62
|
{
|
|
61
|
-
filterButtonText:
|
|
62
|
-
filterButtonAsIcon:
|
|
63
|
-
count:
|
|
64
|
-
onClick: () =>
|
|
63
|
+
filterButtonText: i,
|
|
64
|
+
filterButtonAsIcon: e,
|
|
65
|
+
count: _,
|
|
66
|
+
onClick: () => f(!0)
|
|
65
67
|
}
|
|
66
68
|
),
|
|
67
69
|
/* @__PURE__ */ t(
|
|
68
|
-
|
|
70
|
+
W,
|
|
69
71
|
{
|
|
70
|
-
open:
|
|
71
|
-
onClose:
|
|
72
|
-
title:
|
|
73
|
-
modalSize:
|
|
74
|
-
headerActions: /* @__PURE__ */ t(
|
|
75
|
-
dismissiveButton: /* @__PURE__ */ t(
|
|
76
|
-
primaryButton: /* @__PURE__ */ t(
|
|
77
|
-
children: /* @__PURE__ */ t(
|
|
78
|
-
D,
|
|
79
|
-
{
|
|
80
|
-
variant: "outlined",
|
|
81
|
-
options: c,
|
|
82
|
-
label: o,
|
|
83
|
-
multiSelect: !0,
|
|
84
|
-
textKey: "text",
|
|
85
|
-
valueKey: "id",
|
|
86
|
-
value: n.find((d) => d.id === e)?.selectedOptions ?? [],
|
|
87
|
-
onChange: (d) => w({ id: e, selectedOptions: d }),
|
|
88
|
-
hoisted: !0,
|
|
89
|
-
menuMaxHeight: "300px",
|
|
90
|
-
disabled: e === "location",
|
|
91
|
-
showOptionFilter: !1
|
|
92
|
-
},
|
|
93
|
-
e
|
|
94
|
-
)) })
|
|
72
|
+
open: A,
|
|
73
|
+
onClose: B,
|
|
74
|
+
title: u,
|
|
75
|
+
modalSize: N ? "small" : "fullscreen",
|
|
76
|
+
headerActions: /* @__PURE__ */ t(p, { variant: "text", onClick: w, children: o }),
|
|
77
|
+
dismissiveButton: /* @__PURE__ */ t(p, { variant: "outlined", onClick: () => f(!1), children: m }),
|
|
78
|
+
primaryButton: /* @__PURE__ */ t(p, { variant: "filled", onClick: B, children: n }),
|
|
79
|
+
children: /* @__PURE__ */ t(v, { direction: "vertical", children: k(a, s, F) })
|
|
95
80
|
}
|
|
96
81
|
)
|
|
97
|
-
] });
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
] }) : /* @__PURE__ */ t(v, { secondaryAlign: "center", fullWidth: !0, children: k(a, s, F, !1) });
|
|
83
|
+
}, k = (o, l, r, e = !0) => o.map(({ id: i, title: u, availableOptions: a, icon: m }) => /* @__PURE__ */ y(v, { fullWidth: !0, secondaryAlign: "center", children: [
|
|
84
|
+
m ? /* @__PURE__ */ t(H, { icon: m, iconSize: "medium" }) : null,
|
|
85
|
+
/* @__PURE__ */ t(
|
|
86
|
+
j,
|
|
87
|
+
{
|
|
88
|
+
className: e ? void 0 : d.dense,
|
|
89
|
+
variant: "outlined",
|
|
90
|
+
options: a,
|
|
91
|
+
label: u,
|
|
92
|
+
multiSelect: !0,
|
|
93
|
+
textKey: "text",
|
|
94
|
+
valueKey: "id",
|
|
95
|
+
value: l.find((n) => n.id === i)?.selectedOptions ?? [],
|
|
96
|
+
onChange: (n) => r({ id: i, selectedOptions: n }),
|
|
97
|
+
hoisted: !0,
|
|
98
|
+
menuMaxHeight: "300px",
|
|
99
|
+
disabled: i === "location",
|
|
100
|
+
showOptionFilter: !1,
|
|
101
|
+
dense: !e,
|
|
102
|
+
fixedHeightInput: !e,
|
|
103
|
+
multiDisplayType: e ? "pills" : "text"
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }, i)), K = ({
|
|
107
|
+
filterButtonText: o,
|
|
108
|
+
filterButtonAsIcon: l,
|
|
109
|
+
count: r,
|
|
110
|
+
onClick: e
|
|
103
111
|
}) => {
|
|
104
|
-
const { isDesktop:
|
|
105
|
-
return
|
|
106
|
-
|
|
112
|
+
const { isDesktop: i } = O();
|
|
113
|
+
return l ? /* @__PURE__ */ t(
|
|
114
|
+
z,
|
|
107
115
|
{
|
|
108
116
|
icon: "filter_list_alt",
|
|
109
|
-
onClick:
|
|
110
|
-
badge:
|
|
111
|
-
|
|
117
|
+
onClick: e,
|
|
118
|
+
badge: r !== 0 && /* @__PURE__ */ t(
|
|
119
|
+
S,
|
|
112
120
|
{
|
|
113
|
-
counter:
|
|
114
|
-
className:
|
|
121
|
+
counter: r,
|
|
122
|
+
className: d.filterBadge,
|
|
115
123
|
themeColor: "secondary",
|
|
116
124
|
"data-testid": "filter-badge"
|
|
117
125
|
}
|
|
118
126
|
)
|
|
119
127
|
}
|
|
120
|
-
) : /* @__PURE__ */
|
|
128
|
+
) : /* @__PURE__ */ y("div", { style: { height: "100%", width: i ? void 0 : "100%" }, children: [
|
|
121
129
|
/* @__PURE__ */ t(
|
|
122
|
-
|
|
130
|
+
p,
|
|
123
131
|
{
|
|
124
132
|
variant: "outlined",
|
|
125
133
|
themeColor: "primary",
|
|
126
134
|
leadingIcon: "filter_list_alt",
|
|
127
|
-
onClick:
|
|
128
|
-
className:
|
|
129
|
-
fullWidth: !
|
|
130
|
-
children:
|
|
135
|
+
onClick: e,
|
|
136
|
+
className: d.filterButton,
|
|
137
|
+
fullWidth: !i,
|
|
138
|
+
children: o
|
|
131
139
|
}
|
|
132
140
|
),
|
|
133
|
-
|
|
134
|
-
|
|
141
|
+
r !== 0 && /* @__PURE__ */ t(
|
|
142
|
+
S,
|
|
135
143
|
{
|
|
136
|
-
counter:
|
|
137
|
-
className:
|
|
144
|
+
counter: r,
|
|
145
|
+
className: d.filterBadge,
|
|
138
146
|
themeColor: "secondary",
|
|
139
147
|
"data-testid": "filter-badge"
|
|
140
148
|
}
|
|
@@ -142,5 +150,5 @@ const ft = ({
|
|
|
142
150
|
] });
|
|
143
151
|
};
|
|
144
152
|
export {
|
|
145
|
-
|
|
153
|
+
vt as Filter
|
|
146
154
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { a
|
|
3
|
-
import { a as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { a, s as t, f as u, t as c, w as x } from "../../react.esm-Dy4VzU4L.js";
|
|
3
|
+
import { a as d } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
4
4
|
import { Filter as T } from "./Filter.js";
|
|
5
|
-
import { v as
|
|
6
|
-
const o =
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { v as m, b as s, d as f, t as B, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
6
|
+
const o = m.fn();
|
|
7
|
+
s(() => {
|
|
8
|
+
m.spyOn(d, "useBreakpoints").mockReturnValue({
|
|
9
9
|
isDesktop: !0,
|
|
10
10
|
isMobile: !1,
|
|
11
11
|
isTablet: !1,
|
|
@@ -13,10 +13,11 @@ d(() => {
|
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
f("Filter", () => {
|
|
16
|
-
const
|
|
16
|
+
const l = [
|
|
17
17
|
{
|
|
18
18
|
id: "1",
|
|
19
19
|
title: "Filter 1",
|
|
20
|
+
icon: "farm",
|
|
20
21
|
availableOptions: [
|
|
21
22
|
{ id: "1", text: "Option 1" },
|
|
22
23
|
{ id: "2", text: "Option 2" }
|
|
@@ -30,17 +31,17 @@ f("Filter", () => {
|
|
|
30
31
|
{ id: "4", text: "Option 4" }
|
|
31
32
|
]
|
|
32
33
|
}
|
|
33
|
-
],
|
|
34
|
+
], n = [
|
|
34
35
|
{ id: "1", selectedOptions: [{ id: "1", text: "Option 1" }] },
|
|
35
36
|
{ id: "2", selectedOptions: [{ id: "3", text: "Option 3" }] }
|
|
36
37
|
];
|
|
37
38
|
B("should render filter", () => {
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
a(
|
|
40
|
+
/* @__PURE__ */ r(
|
|
40
41
|
T,
|
|
41
42
|
{
|
|
42
|
-
filters:
|
|
43
|
-
currentFilter:
|
|
43
|
+
filters: l,
|
|
44
|
+
currentFilter: n,
|
|
44
45
|
closeCallback: o,
|
|
45
46
|
filterButtonText: "filterButtonText",
|
|
46
47
|
filterModalTitle: "filterModalTitle",
|
|
@@ -49,18 +50,18 @@ f("Filter", () => {
|
|
|
49
50
|
clearFilterText: "clearFilterText"
|
|
50
51
|
}
|
|
51
52
|
)
|
|
52
|
-
), e(t.getByText("filterButtonText")).toBeInTheDocument(), e(t.getByText("filterModalTitle")).toBeInTheDocument(), e(t.getByText("modalCancelButtonText")).toBeInTheDocument(), e(t.getByText("modalConfirmButtonText")).toBeInTheDocument(), e(t.getByText("clearFilterText")).toBeInTheDocument(), e(t.getByText("Filter 1")).toBeInTheDocument(), e(t.getByText("Filter 2")).toBeInTheDocument(), e(t.getByText("Option 1")).toBeInTheDocument(), e(t.getByText("Option 3")).toBeInTheDocument();
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
), e(t.getByText("filterButtonText")).toBeInTheDocument(), e(t.getByText("filterModalTitle")).toBeInTheDocument(), e(t.getByText("modalCancelButtonText")).toBeInTheDocument(), e(t.getByText("modalConfirmButtonText")).toBeInTheDocument(), e(t.getByText("clearFilterText")).toBeInTheDocument(), e(t.getByText("Filter 1")).toBeInTheDocument(), e(t.getByText("Filter 2")).toBeInTheDocument(), e(t.getByText("Option 1")).toBeInTheDocument(), e(t.getByText("Option 3")).toBeInTheDocument(), e(t.getByTestId("farm")).toBeInTheDocument();
|
|
54
|
+
const i = t.getByRole("button", { name: "modalConfirmButtonText" });
|
|
55
|
+
u.click(i), c.act(() => {
|
|
55
56
|
e(o).toHaveBeenCalledTimes(1), e(t.getByText("2")).toBeInTheDocument();
|
|
56
57
|
});
|
|
57
58
|
}), B("should clear filter", () => {
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */
|
|
59
|
+
a(
|
|
60
|
+
/* @__PURE__ */ r(
|
|
60
61
|
T,
|
|
61
62
|
{
|
|
62
|
-
filters:
|
|
63
|
-
currentFilter:
|
|
63
|
+
filters: l,
|
|
64
|
+
currentFilter: n,
|
|
64
65
|
closeCallback: o,
|
|
65
66
|
filterButtonText: "filterButtonText",
|
|
66
67
|
filterModalTitle: "filterModalTitle",
|
|
@@ -70,17 +71,17 @@ f("Filter", () => {
|
|
|
70
71
|
}
|
|
71
72
|
)
|
|
72
73
|
);
|
|
73
|
-
const
|
|
74
|
-
|
|
74
|
+
const i = t.getByText("clearFilterText");
|
|
75
|
+
u.click(i), c.act(() => {
|
|
75
76
|
e(o).toHaveBeenCalledTimes(1), e(t.queryByTestId("filter-badge")).not.toBeInTheDocument();
|
|
76
77
|
});
|
|
77
78
|
}), B("should close filter", () => {
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
a(
|
|
80
|
+
/* @__PURE__ */ r(
|
|
80
81
|
T,
|
|
81
82
|
{
|
|
82
|
-
filters:
|
|
83
|
-
currentFilter:
|
|
83
|
+
filters: l,
|
|
84
|
+
currentFilter: n,
|
|
84
85
|
closeCallback: o,
|
|
85
86
|
filterButtonText: "filterButtonText",
|
|
86
87
|
filterModalTitle: "filterModalTitle",
|
|
@@ -90,19 +91,19 @@ f("Filter", () => {
|
|
|
90
91
|
}
|
|
91
92
|
)
|
|
92
93
|
);
|
|
93
|
-
const
|
|
94
|
-
|
|
94
|
+
const i = t.getByRole("button", { name: "modalCancelButtonText" });
|
|
95
|
+
u.click(i), c.act(() => {
|
|
95
96
|
e(o).toHaveBeenCalledTimes(1), e(t.queryByTestId("filter-badge")).not.toBeInTheDocument();
|
|
96
|
-
}),
|
|
97
|
+
}), x(() => {
|
|
97
98
|
e(t.queryByText("filterModalTitle")).not.toBeInTheDocument(), e(t.queryByText("modalCancelButtonText")).not.toBeInTheDocument(), e(t.queryByText("modalConfirmButtonText")).not.toBeInTheDocument(), e(t.queryByText("clearFilterText")).not.toBeInTheDocument();
|
|
98
99
|
});
|
|
99
100
|
}), B("should render as icon button ", () => {
|
|
100
|
-
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
a(
|
|
102
|
+
/* @__PURE__ */ r(
|
|
102
103
|
T,
|
|
103
104
|
{
|
|
104
|
-
filters:
|
|
105
|
-
currentFilter:
|
|
105
|
+
filters: l,
|
|
106
|
+
currentFilter: n,
|
|
106
107
|
closeCallback: o,
|
|
107
108
|
filterButtonText: "filterButtonText",
|
|
108
109
|
filterModalTitle: "filterModalTitle",
|
|
@@ -113,5 +114,22 @@ f("Filter", () => {
|
|
|
113
114
|
}
|
|
114
115
|
)
|
|
115
116
|
), e(t.queryByText("filterButtonText")).not.toBeInTheDocument(), e(t.getByText("filter_list_alt")).toBeInTheDocument(), e(t.getByText("filter_list_alt").tagName).toBe("I");
|
|
117
|
+
}), B("should render filter without modal", () => {
|
|
118
|
+
a(
|
|
119
|
+
/* @__PURE__ */ r(
|
|
120
|
+
T,
|
|
121
|
+
{
|
|
122
|
+
filters: l,
|
|
123
|
+
currentFilter: n,
|
|
124
|
+
closeCallback: o,
|
|
125
|
+
filterButtonText: "filterButtonText",
|
|
126
|
+
filterModalTitle: "filterModalTitle",
|
|
127
|
+
modalCancelButtonText: "modalCancelButtonText",
|
|
128
|
+
modalConfirmButtonText: "modalConfirmButtonText",
|
|
129
|
+
clearFilterText: "clearFilterText",
|
|
130
|
+
useModal: !1
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
), e(t.queryByText("filterButtonText")).not.toBeInTheDocument(), e(t.queryByText("clearFilterText")).not.toBeInTheDocument(), e(t.queryByText("modalCancelButtonText")).not.toBeInTheDocument(), e(t.queryByText("modalConfirmButtonText")).not.toBeInTheDocument(), e(t.queryByText("clearFilterText")).not.toBeInTheDocument(), e(t.getByTestId("farm")).toBeInTheDocument(), e(t.getByText("Filter 1")).toBeInTheDocument(), e(t.getByText("Filter 2")).toBeInTheDocument(), e(t.getByText("Option 1")).toBeInTheDocument(), e(t.getByText("Option 3")).toBeInTheDocument();
|
|
116
134
|
});
|
|
117
135
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as B } from "react/jsx-runtime";
|
|
2
2
|
import { Elevation as D, Table as G, TableTopBar as u, Group as l, Padding as W, TypoDisplay as k, TypoSubtitle as C } from "@element/react-components";
|
|
3
3
|
import { Fragment as j } from "react";
|
|
4
|
-
import { a as e } from "../../genericTable.module-
|
|
4
|
+
import { a as e } from "../../genericTable.module-CNV1Yt1K.js";
|
|
5
5
|
import { u as x } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
6
6
|
import "../../alertBanner.module-HneYdVzN.js";
|
|
7
7
|
import "../../iconify.module-C89oaw5b.js";
|
|
@@ -21,7 +21,7 @@ import "../../deleteModal.module-Ds3MDzdl.js";
|
|
|
21
21
|
import "../../disclaimer.module-BZydt-Q_.js";
|
|
22
22
|
import "../../HashTabView.module-CJX4gxTu.js";
|
|
23
23
|
import "../../HeaderFilter.module-DiBmulr5.js";
|
|
24
|
-
import "../../infoGroup.module-
|
|
24
|
+
import "../../infoGroup.module-Cxw88dfC.js";
|
|
25
25
|
import "../../bigLoadingSpinner.module-GgbFol8k.js";
|
|
26
26
|
import "../../loadingSpinner.module-CLtqSMWA.js";
|
|
27
27
|
import "../Scrollbar/Scrollbar.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ThemeColor } from '../../enums/ThemeColor';
|
|
2
3
|
/**
|
|
3
4
|
* FieldItem type that defines the structure of the fields to render in the InfoGroup component
|
|
4
5
|
*/
|
|
@@ -14,22 +15,25 @@ export type FieldItem = {
|
|
|
14
15
|
/**
|
|
15
16
|
* ThemeColor for the Textfield (default: none)
|
|
16
17
|
*/
|
|
17
|
-
themeColor?:
|
|
18
|
-
/**
|
|
19
|
-
* Variant of the component (default: default) - embedded will render the component without any padding or border
|
|
20
|
-
*/
|
|
21
|
-
variant?: 'default' | 'embedded';
|
|
18
|
+
themeColor?: keyof typeof ThemeColor;
|
|
22
19
|
/**
|
|
23
20
|
* Optional component to render instead of Textfields
|
|
24
21
|
*/
|
|
25
22
|
component?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Variant of the component (default: default)
|
|
25
|
+
* default: will render the plain component without the label
|
|
26
|
+
* embedded: will render the component with the label
|
|
27
|
+
*/
|
|
28
|
+
componentVariant?: 'default' | 'embedded';
|
|
26
29
|
};
|
|
27
30
|
/**
|
|
28
31
|
* Props for the InfoGroup component that defines the fields to render
|
|
29
32
|
*/
|
|
30
33
|
interface InfoGroupProps {
|
|
31
34
|
/**
|
|
32
|
-
* Array of fields to render in the InfoGroup
|
|
35
|
+
* Array of fields to render in the InfoGroup.
|
|
36
|
+
* Using a matrix [][] will render multiple rows of fields in a vertical layout
|
|
33
37
|
*/
|
|
34
38
|
fields: FieldItem[] | FieldItem[][];
|
|
35
39
|
/**
|
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Divider as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { u
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, m = ({ fields: t, bold: n }) => {
|
|
14
|
-
const { isDesktop: l } = f();
|
|
15
|
-
return /* @__PURE__ */ e(
|
|
16
|
-
c,
|
|
1
|
+
import { jsxs as d, Fragment as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Divider as h, Group as s, TypoCaption as g, TypoSubtitle as v } from "@element/react-components";
|
|
3
|
+
import { useMemo as y, Fragment as A } from "react";
|
|
4
|
+
import { u } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
5
|
+
import { s as l } from "../../infoGroup.module-Cxw88dfC.js";
|
|
6
|
+
const w = ({ fields: r, bold: i }) => {
|
|
7
|
+
const { isDesktop: a } = u(), e = !!r.length && Array.isArray(r.at(0)), n = y(() => e && a ? r.map((o, c) => /* @__PURE__ */ d(p, { children: [
|
|
8
|
+
c != 0 && /* @__PURE__ */ t("span", { "data-testid": "test-divider", className: l.dividerContainer, children: /* @__PURE__ */ t(h, {}) }),
|
|
9
|
+
/* @__PURE__ */ t(m, { fields: o, bold: i })
|
|
10
|
+
] })) : /* @__PURE__ */ t(m, { fields: r.flat(), bold: i }), [a, e, r, i]);
|
|
11
|
+
return /* @__PURE__ */ t(
|
|
12
|
+
s,
|
|
17
13
|
{
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
"data-testid": "infoGroup",
|
|
15
|
+
direction: "vertical",
|
|
16
|
+
fullWidth: !0,
|
|
17
|
+
className: l.mainGroup,
|
|
18
|
+
gap: "none",
|
|
19
|
+
children: n
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}, m = ({ fields: r, bold: i }) => {
|
|
23
|
+
const { isDesktop: a } = u();
|
|
24
|
+
return /* @__PURE__ */ t(
|
|
25
|
+
s,
|
|
26
|
+
{
|
|
27
|
+
"data-testid": "singleRow",
|
|
20
28
|
fullWidth: !0,
|
|
21
|
-
|
|
22
|
-
secondaryAlign: "
|
|
23
|
-
children:
|
|
24
|
-
const o =
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
] }, `${
|
|
29
|
+
direction: a ? "horizontal" : "vertical",
|
|
30
|
+
secondaryAlign: "start",
|
|
31
|
+
children: r.map((e, n) => {
|
|
32
|
+
const o = a ? /* @__PURE__ */ t("div", { className: l.verticalDivider }) : /* @__PURE__ */ t(h, {});
|
|
33
|
+
return /* @__PURE__ */ d(A, { children: [
|
|
34
|
+
n != 0 && o,
|
|
35
|
+
/* @__PURE__ */ t(C, { field: e, bold: i, variant: e.componentVariant })
|
|
36
|
+
] }, `${e.label ?? "label"}_${n}`);
|
|
29
37
|
})
|
|
30
38
|
}
|
|
31
39
|
);
|
|
32
|
-
},
|
|
33
|
-
field:
|
|
34
|
-
bold:
|
|
35
|
-
variant:
|
|
40
|
+
}, C = ({
|
|
41
|
+
field: r,
|
|
42
|
+
bold: i,
|
|
43
|
+
variant: a = "default"
|
|
36
44
|
}) => {
|
|
37
|
-
const { component:
|
|
38
|
-
return
|
|
39
|
-
|
|
45
|
+
const { isDesktop: e } = u(), { component: n, value: o, label: c, themeColor: f } = r;
|
|
46
|
+
return n && a === "default" ? /* @__PURE__ */ t(s, { fullWidth: !0, primaryAlign: "center", className: l.centerDefaultComponent, children: n }) : /* @__PURE__ */ d(
|
|
47
|
+
s,
|
|
40
48
|
{
|
|
41
|
-
"data-testid": "infoGroupItem",
|
|
42
|
-
direction: "vertical",
|
|
43
|
-
primaryAlign: "center",
|
|
44
|
-
secondaryAlign: "space-between",
|
|
45
49
|
fullWidth: !0,
|
|
46
|
-
|
|
50
|
+
"data-testid": "infoGroupItem",
|
|
51
|
+
direction: e ? "vertical" : "horizontal",
|
|
52
|
+
gap: "none",
|
|
53
|
+
primaryAlign: e ? "start" : "space-between",
|
|
54
|
+
secondaryAlign: e ? "baseline" : "center",
|
|
55
|
+
className: e ? "" : l.textAlignRight,
|
|
47
56
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
g,
|
|
51
|
-
{
|
|
52
|
-
level: 1,
|
|
53
|
-
"data-testid": "infoGroupValue",
|
|
54
|
-
themeColor: p,
|
|
55
|
-
bold: n,
|
|
56
|
-
className: i.valueText,
|
|
57
|
-
children: a
|
|
58
|
-
}
|
|
59
|
-
) : /* @__PURE__ */ e(h, { children: r })
|
|
57
|
+
/* @__PURE__ */ t(g, { themeColor: "text-hint-on-light", children: c }),
|
|
58
|
+
n ? /* @__PURE__ */ t(p, { children: n }) : /* @__PURE__ */ t(v, { level: 1, "data-testid": "infoGroupValue", themeColor: f, bold: i, children: o })
|
|
60
59
|
]
|
|
61
60
|
}
|
|
62
61
|
);
|
|
63
62
|
};
|
|
64
63
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
C as Cell,
|
|
65
|
+
w as InfoGroup
|
|
67
66
|
};
|
|
@@ -24,12 +24,12 @@ s("InfoGroup Test", () => {
|
|
|
24
24
|
]
|
|
25
25
|
] }));
|
|
26
26
|
const n = t.getAllByTestId("infoGroupValue");
|
|
27
|
-
e(n.length).toBe(4), e(t.getByText("organization.create.registration-number")).toBeInTheDocument(), e(n[0]).toHaveTextContent("123"), e(t.getByText("myOrganizations.label-primary-contact")).toBeInTheDocument(), e(n[1]).toHaveTextContent("User A"), e(t.getByTestId("
|
|
27
|
+
e(n.length).toBe(4), e(t.getByText("organization.create.registration-number")).toBeInTheDocument(), e(n[0]).toHaveTextContent("123"), e(t.getByText("myOrganizations.label-primary-contact")).toBeInTheDocument(), e(n[1]).toHaveTextContent("User A"), e(t.getByTestId("infoGroup")).toBeInTheDocument(), e(t.getByTestId("singleRow")).toBeInTheDocument(), e(t.getAllByTestId("infoGroupItem").length).toBe(4), e(t.getByText("myOrganizations.label-contact")).toBeInTheDocument(), e(n[2]).toHaveTextContent("User B"), e(t.getByText("organization.something-else")).toBeInTheDocument(), e(n[3]).toHaveTextContent("some");
|
|
28
28
|
}), i("render Single InfoGroup with component", () => {
|
|
29
29
|
l(/* @__PURE__ */ o(r, { fields: [
|
|
30
30
|
{ label: "labelSouldntBeRendered", component: /* @__PURE__ */ o("div", { children: "Component" }) },
|
|
31
31
|
{ label: "myOrganizations.label-primary-contact", value: "User A" },
|
|
32
|
-
{ label: "componentWithLabel",
|
|
32
|
+
{ label: "componentWithLabel", componentVariant: "embedded", component: /* @__PURE__ */ o("div", { children: "Badge" }) }
|
|
33
33
|
] })), e(t.queryByText("labelSouldntBeRendered")).toBeNull(), e(t.getByText("Component")).toBeInTheDocument(), e(t.getByText("myOrganizations.label-primary-contact")).toBeInTheDocument(), e(t.getByText("User A")).toBeInTheDocument(), e(t.getByText("componentWithLabel")).toBeInTheDocument(), e(t.getByText("Badge")).toBeInTheDocument();
|
|
34
34
|
});
|
|
35
35
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum ThemeColor {
|
|
2
|
+
'primary' = 0,
|
|
3
|
+
'secondary' = 1,
|
|
4
|
+
'error' = 2,
|
|
5
|
+
'text-primary-on-background' = 3,
|
|
6
|
+
'text-secondary-on-background' = 4,
|
|
7
|
+
'text-hint-on-background' = 5,
|
|
8
|
+
'text-disabled-on-background' = 6,
|
|
9
|
+
'text-icon-on-background' = 7,
|
|
10
|
+
'text-primary-on-light' = 8,
|
|
11
|
+
'text-secondary-on-light' = 9,
|
|
12
|
+
'text-hint-on-light' = 10,
|
|
13
|
+
'text-disabled-on-light' = 11,
|
|
14
|
+
'text-icon-on-light' = 12
|
|
15
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var n = /* @__PURE__ */ ((t) => (t[t.primary = 0] = "primary", t[t.secondary = 1] = "secondary", t[t.error = 2] = "error", t[t["text-primary-on-background"] = 3] = "text-primary-on-background", t[t["text-secondary-on-background"] = 4] = "text-secondary-on-background", t[t["text-hint-on-background"] = 5] = "text-hint-on-background", t[t["text-disabled-on-background"] = 6] = "text-disabled-on-background", t[t["text-icon-on-background"] = 7] = "text-icon-on-background", t[t["text-primary-on-light"] = 8] = "text-primary-on-light", t[t["text-secondary-on-light"] = 9] = "text-secondary-on-light", t[t["text-hint-on-light"] = 10] = "text-hint-on-light", t[t["text-disabled-on-light"] = 11] = "text-disabled-on-light", t[t["text-icon-on-light"] = 12] = "text-icon-on-light", t))(n || {});
|
|
2
|
+
export {
|
|
3
|
+
n as ThemeColor
|
|
4
|
+
};
|