@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.
@@ -1 +1 @@
1
- ._container_egebs_1{width:100%;padding:0;@media only screen and (max-width: 838px){padding-top:.5rem}}._dividerContainer_egebs_10{width:100%;padding:0rem 1rem;margin:-1rem 0rem}._mainGroup_egebs_16{border:.0775rem solid var(--lmnt-on-surface-stroke, rgba(0, 0, 0, .12));border-radius:.5rem}._row_egebs_21{min-height:5.5vh;padding:1rem}._row_egebs_21 input:not([type=checkbox]){@media only screen and (max-width: 839px){height:80%}}._row_egebs_21 input{padding-top:.2rem;border:none;color:#000!important;font-size:1.2rem;margin-top:1rem!important;@media only screen and (min-width: 839px){margin-top:1.5rem!important}}._row_egebs_21 label{font-size:1.2rem}._row_egebs_21 ._valueText_egebs_46{line-height:1rem}:before{border:none!important}._component_egebs_54{width:95%!important;background-color:var(--lmnt-theme-on-primary);padding-left:.4rem!important;justify-content:flex-end;min-height:3rem;height:4vh;align-items:center;text-align:center;display:flex;border-radius:.5rem;box-shadow:0 .125rem .25rem #00000040;padding:1rem;margin-right:1rem;@media only screen and (max-width: 839px){margin-bottom:1.6rem!important;margin-left:1rem}}._component_egebs_54>div{display:flex;justify-content:space-between;width:100%}._component_egebs_54>div label{font-size:1rem;color:#00000061;font-weight:500}._componentContainer_egebs_87{width:100%!important;@media only screen and (max-width: 839px){margin-top:1rem;margin-bottom:-.5rem}}._field_egebs_95{width:100%;padding:0rem .5rem;align-self:center;display:flex;flex-direction:column}
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 { jsxs as B, Fragment as I, jsx as t } from "react/jsx-runtime";
2
- import { Modal as j, Button as s, Group as A, Select as D, IconButton as K, NotificationBadge as v } from "@element/react-components";
3
- import { useState as u } from "react";
4
- import { s as f } from "../../genericTable.module-CXfRg0e4.js";
5
- import { u as F } from "../../useBreakpoints-BNeVhjjZ.js";
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 "../../iconify.module-C89oaw5b.js";
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-B3E1gCGi.js";
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 ft = ({
34
- clearFilterText: a,
35
- closeCallback: m,
36
- currentFilter: i,
37
- filterButtonAsIcon: r = !1,
38
- filterButtonText: l,
39
- filterModalTitle: x,
40
- filters: y,
41
- modalCancelButtonText: S,
42
- modalConfirmButtonText: k
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: O } = F(), [b, p] = u(!1), [n, h] = u(i), [N, g] = u(0), C = () => {
45
- p(!1), m(n), g(
46
- n.reduce((e, { selectedOptions: o }) => e + o.length, 0)
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
- h([]), g(0);
50
- }, w = (e) => {
51
- const o = [
52
- ...n.filter((c) => c.id !== e.id),
53
- e
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(o);
57
+ C(h);
56
58
  };
57
- return /* @__PURE__ */ B(I, { children: [
59
+ return b ? /* @__PURE__ */ y(I, { children: [
58
60
  /* @__PURE__ */ t(
59
- M,
61
+ K,
60
62
  {
61
- filterButtonText: l,
62
- filterButtonAsIcon: r,
63
- count: N,
64
- onClick: () => p(!0)
63
+ filterButtonText: i,
64
+ filterButtonAsIcon: e,
65
+ count: _,
66
+ onClick: () => f(!0)
65
67
  }
66
68
  ),
67
69
  /* @__PURE__ */ t(
68
- j,
70
+ W,
69
71
  {
70
- open: b,
71
- onClose: C,
72
- title: x,
73
- modalSize: O ? "small" : "fullscreen",
74
- headerActions: /* @__PURE__ */ t(s, { variant: "text", onClick: _, children: a }),
75
- dismissiveButton: /* @__PURE__ */ t(s, { variant: "outlined", onClick: () => p(!1), children: S }),
76
- primaryButton: /* @__PURE__ */ t(s, { variant: "filled", onClick: C, children: k }),
77
- children: /* @__PURE__ */ t(A, { direction: "vertical", children: y.map(({ id: e, title: o, availableOptions: c }) => /* @__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
- }, M = ({
99
- filterButtonText: a,
100
- filterButtonAsIcon: m,
101
- count: i,
102
- onClick: r
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: l } = F();
105
- return m ? /* @__PURE__ */ t(
106
- K,
112
+ const { isDesktop: i } = O();
113
+ return l ? /* @__PURE__ */ t(
114
+ z,
107
115
  {
108
116
  icon: "filter_list_alt",
109
- onClick: r,
110
- badge: i !== 0 && /* @__PURE__ */ t(
111
- v,
117
+ onClick: e,
118
+ badge: r !== 0 && /* @__PURE__ */ t(
119
+ S,
112
120
  {
113
- counter: i,
114
- className: f.filterBadge,
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__ */ B("div", { style: { height: "100%", width: l ? void 0 : "100%" }, children: [
128
+ ) : /* @__PURE__ */ y("div", { style: { height: "100%", width: i ? void 0 : "100%" }, children: [
121
129
  /* @__PURE__ */ t(
122
- s,
130
+ p,
123
131
  {
124
132
  variant: "outlined",
125
133
  themeColor: "primary",
126
134
  leadingIcon: "filter_list_alt",
127
- onClick: r,
128
- className: f.filterButton,
129
- fullWidth: !l,
130
- children: a
135
+ onClick: e,
136
+ className: d.filterButton,
137
+ fullWidth: !i,
138
+ children: o
131
139
  }
132
140
  ),
133
- i !== 0 && /* @__PURE__ */ t(
134
- v,
141
+ r !== 0 && /* @__PURE__ */ t(
142
+ S,
135
143
  {
136
- counter: i,
137
- className: f.filterBadge,
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
- ft as Filter
153
+ vt as Filter
146
154
  };
@@ -1,11 +1,11 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { a as r, s as t, f as c, t as u, w as m } from "../../react.esm-Dy4VzU4L.js";
3
- import { a as s } from "../../useBreakpoints-BNeVhjjZ.js";
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 x, b as d, d as f, t as B, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
6
- const o = x.fn();
7
- d(() => {
8
- x.spyOn(s, "useBreakpoints").mockReturnValue({
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 n = [
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
- ], i = [
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
- r(
39
- /* @__PURE__ */ a(
39
+ a(
40
+ /* @__PURE__ */ r(
40
41
  T,
41
42
  {
42
- filters: n,
43
- currentFilter: i,
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 l = t.getByRole("button", { name: "modalConfirmButtonText" });
54
- c.click(l), u.act(() => {
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
- r(
59
- /* @__PURE__ */ a(
59
+ a(
60
+ /* @__PURE__ */ r(
60
61
  T,
61
62
  {
62
- filters: n,
63
- currentFilter: i,
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 l = t.getByText("clearFilterText");
74
- c.click(l), u.act(() => {
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
- r(
79
- /* @__PURE__ */ a(
79
+ a(
80
+ /* @__PURE__ */ r(
80
81
  T,
81
82
  {
82
- filters: n,
83
- currentFilter: i,
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 l = t.getByRole("button", { name: "modalCancelButtonText" });
94
- c.click(l), u.act(() => {
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
- }), m(() => {
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
- r(
101
- /* @__PURE__ */ a(
101
+ a(
102
+ /* @__PURE__ */ r(
102
103
  T,
103
104
  {
104
- filters: n,
105
- currentFilter: i,
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-CXfRg0e4.js";
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-B3E1gCGi.js";
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?: 'primary' | 'secondary' | 'error' | 'text-primary-on-background' | 'text-secondary-on-background' | 'text-hint-on-background' | 'text-disabled-on-background' | 'text-icon-on-background' | 'text-primary-on-light' | 'text-secondary-on-light' | 'text-hint-on-light' | 'text-disabled-on-light' | 'text-icon-on-light';
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 s, jsx as e, Fragment as h } from "react/jsx-runtime";
2
- import { Divider as d, Group as c, TypoCaption as v, TypoSubtitle as g } from "@element/react-components";
3
- import { Fragment as u } from "react";
4
- import { u as f } from "../../useBreakpoints-BNeVhjjZ.js";
5
- import { VerticalDivider as y } from "../VerticalDivider/VerticalDivider.js";
6
- import { s as i } from "../../infoGroup.module-B3E1gCGi.js";
7
- const x = ({ fields: t, bold: n }) => {
8
- const r = t.length > 1 && Array.isArray(t.at(0)) ? t.map((a, o) => /* @__PURE__ */ s(u, { children: [
9
- o != 0 && /* @__PURE__ */ e("div", { "data-testid": "test-divider", className: i.dividerContainer, children: /* @__PURE__ */ e(d, {}) }),
10
- /* @__PURE__ */ e(m, { fields: a, bold: n })
11
- ] }, `row_${o}`)) : /* @__PURE__ */ e(m, { fields: t, bold: n });
12
- return /* @__PURE__ */ e(c, { direction: "vertical", fullWidth: !0, className: i.mainGroup, children: r });
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
- direction: l ? "horizontal" : "vertical",
19
- className: i.row,
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
- primaryAlign: "center",
22
- secondaryAlign: "center",
23
- children: t.map((r, a) => {
24
- const o = l ? /* @__PURE__ */ e(y, { className: i.divider, height: "3rem" }) : /* @__PURE__ */ e(d, {});
25
- return /* @__PURE__ */ s(u, { children: [
26
- a != 0 && o,
27
- /* @__PURE__ */ e(N, { field: r, bold: n, variant: r.variant })
28
- ] }, `${r.label ?? "label"}_${a}`);
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
- }, N = ({
33
- field: t,
34
- bold: n,
35
- variant: l = "default"
40
+ }, C = ({
41
+ field: r,
42
+ bold: i,
43
+ variant: a = "default"
36
44
  }) => {
37
- const { component: r, value: a, label: o, themeColor: p } = t;
38
- return r && l === "default" ? /* @__PURE__ */ e("div", { className: i.componentContainer, children: /* @__PURE__ */ e("div", { className: i.component, children: r }) }) : /* @__PURE__ */ s(
39
- c,
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
- gap: "dense",
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__ */ e(v, { className: i.label, themeColor: "text-hint-on-light", children: o }),
49
- a ? /* @__PURE__ */ e(
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
- N as Cell,
66
- x as InfoGroup
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("test-divider")).toBeInTheDocument(), 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");
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", variant: "embedded", component: /* @__PURE__ */ o("div", { children: "Badge" }) }
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
+ };