@hortiview/shared-components 1.9.0 → 1.10.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 CHANGED
@@ -1,3 +1,14 @@
1
+ ## [1.10.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.9.0...v1.10.0) (2025-05-26)
2
+
3
+ ### Features
4
+
5
+ * add hint prop to BaseView and update story ([d466795](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/d4667958fe9739be4a9db3e249e31cbbc8387946))
6
+ * provide close button for alert banner ([52958aa](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/52958aa7f3bbfb3beab3fbf97147f81b236edafb))
7
+
8
+ ### Styles
9
+
10
+ * fix vertical divider in BaseView ([8b82d3a](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/8b82d3a0a19e215fe92ee46eeb83714a2e5df4e7))
11
+
1
12
  ## [1.9.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.8.1...v1.9.0) (2025-05-23)
2
13
 
3
14
  ### Features
@@ -1 +1 @@
1
- ._messageContainer_1seos_1{border-radius:.25rem;padding:.5rem 1rem;width:-moz-available;width:-webkit-fill-available;width:stretch}._info_1seos_9{border:1px solid var(--lmnt-theme-on-secondary-stroke);background:var(--lmnt-theme-secondary-50)}._danger_1seos_14{border:1px solid var(--lmnt-theme-on-danger-stroke);background:var(--lmnt-theme-danger-50)}._success_1seos_19{border:1px solid var(--lmnt-theme-on-success-stroke);background:var(--lmnt-theme-success-50)}._warning_1seos_24{border:1px solid var(--lmnt-utility-orange-surface);background:#f6a6491a}
1
+ ._messageContainer_1i2s1_1{border-radius:.25rem;padding:.75rem 1rem;width:-moz-available;width:-webkit-fill-available;width:stretch}._info_1i2s1_9{border:1px solid var(--lmnt-theme-on-secondary-stroke);background:var(--lmnt-theme-secondary-50)}._danger_1i2s1_14{border:1px solid var(--lmnt-theme-on-danger-stroke);background:var(--lmnt-theme-danger-50)}._success_1i2s1_19{border:1px solid var(--lmnt-theme-on-success-stroke);background:var(--lmnt-theme-success-50)}._warning_1i2s1_24{border:1px solid var(--lmnt-utility-orange-surface);background:#f6a6491a}._closeIcon_1i2s1_29{align-self:flex-start;margin-right:-.15rem}
@@ -1 +1 @@
1
- ._divider_dw2rc_1{margin:0 2rem}._maxWidth_dw2rc_5{max-width:55vw}._desktopList_dw2rc_9{width:30%}._mobileList_dw2rc_13{width:100%}._desktopDetail_dw2rc_17{width:70%}._mobileDetail_dw2rc_21{width:100%}
1
+ ._parentGroup_w7vsz_1{align-items:stretch}._divider_w7vsz_5{margin:0 1.5rem;align-self:stretch}._maxWidth_w7vsz_10{max-width:55vw}._desktopList_w7vsz_14{width:30%;align-self:stretch}._mobileList_w7vsz_19{width:100%}._desktopDetail_w7vsz_23{width:70%;align-self:stretch}._mobileDetail_w7vsz_28{width:100%}
@@ -2,8 +2,15 @@ type AlertBannerProps = {
2
2
  text: string | JSX.Element;
3
3
  color?: 'danger' | 'info' | 'success' | 'warning';
4
4
  isOpen?: boolean;
5
- action?: JSX.Element;
6
5
  isBold?: boolean;
6
+ /**
7
+ * if defined, the close button will be displayed
8
+ */
9
+ onClose?: () => void;
10
+ /**
11
+ * @deprecated will be removed in the next major version - please use onClose if you need a close button
12
+ */
13
+ action?: JSX.Element;
7
14
  };
8
- export declare const AlertBanner: ({ text, color, isOpen, action, isBold, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const AlertBanner: ({ text, color, isOpen, isBold, onClose, }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
9
16
  export {};
@@ -1,34 +1,24 @@
1
- import { jsx as e, Fragment as c, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as n, Fragment as a, jsxs as t } from "react/jsx-runtime";
2
2
  import { G as l } from "../../index.es-DntoATwO.js";
3
+ import { I as _ } from "../../index.es-3043KTnb.js";
3
4
  import { b as m } from "../../index.es-CF_xy2ns.js";
4
- import { u as _ } from "../../useBreakpoints-MzTZ0tCT.js";
5
- import '../../assets/AlertBanner.css';const g = "_messageContainer_1seos_1", p = "_info_1seos_9", f = "_danger_1seos_14", u = "_success_1seos_19", y = "_warning_1seos_24", n = {
6
- messageContainer: g,
7
- info: p,
8
- danger: f,
9
- success: u,
10
- warning: y
5
+ import '../../assets/AlertBanner.css';const d = "_messageContainer_1i2s1_1", g = "_info_1i2s1_9", p = "_danger_1i2s1_14", f = "_success_1i2s1_19", u = "_warning_1i2s1_24", y = "_closeIcon_1i2s1_29", e = {
6
+ messageContainer: d,
7
+ info: g,
8
+ danger: p,
9
+ success: f,
10
+ warning: u,
11
+ closeIcon: y
11
12
  }, C = ({
12
13
  text: s,
13
14
  color: r = "info",
14
- isOpen: o = !0,
15
- action: i,
16
- isBold: t = !0
17
- }) => {
18
- const { isDesktop: a } = _();
19
- return o ? /* @__PURE__ */ e("div", { "data-testid": "alert-banner", className: `${n.messageContainer} ${n[r]}`, children: /* @__PURE__ */ d(
20
- l,
21
- {
22
- direction: a ? "horizontal" : "vertical",
23
- primaryAlign: "space-between",
24
- secondaryAlign: "center",
25
- children: [
26
- typeof s == "string" ? /* @__PURE__ */ e(m, { bold: t, level: 2, children: s }) : /* @__PURE__ */ e("div", { children: s }),
27
- i
28
- ]
29
- }
30
- ) }) : /* @__PURE__ */ e(c, {});
31
- };
15
+ isOpen: i = !0,
16
+ isBold: c = !0,
17
+ onClose: o
18
+ }) => i ? /* @__PURE__ */ n("div", { "data-testid": "alert-banner", className: `${e.messageContainer} ${e[r]}`, children: /* @__PURE__ */ t(l, { primaryAlign: "space-between", secondaryAlign: "top", gap: "dense", children: [
19
+ typeof s == "string" ? /* @__PURE__ */ n(m, { bold: c, level: 2, children: s }) : /* @__PURE__ */ n("div", { children: s }),
20
+ o && /* @__PURE__ */ n(_, { icon: "close", iconSize: "small", onClick: o, className: e.closeIcon })
21
+ ] }) }) : /* @__PURE__ */ n(a, {});
32
22
  export {
33
23
  C as AlertBanner
34
24
  };
@@ -1,32 +1,32 @@
1
1
  import { jsx as e, Fragment as m } from "react/jsx-runtime";
2
2
  import { a as t, s } from "../../react.esm-CX1WJ2Pp.js";
3
- import { a } from "../../useBreakpoints-MzTZ0tCT.js";
3
+ import { a as o } from "../../useBreakpoints-MzTZ0tCT.js";
4
4
  import { AlertBanner as n } from "./AlertBanner.js";
5
- import { d as p, b as c, v as l, t as r, g as o } from "../../vi.CjhMlMwf-BCJNwXvu.js";
5
+ import { d as p, b as c, v as l, t as r, g as a } from "../../vi.CjhMlMwf-BCJNwXvu.js";
6
6
  p("AlertBanner Test", () => {
7
7
  c(() => {
8
- l.spyOn(a, "useBreakpoints").mockReturnValue({
8
+ l.spyOn(o, "useBreakpoints").mockReturnValue({
9
9
  isMobile: !1,
10
10
  isTablet: !1,
11
11
  isDesktop: !0,
12
12
  isDesktopNavbar: !0
13
13
  });
14
14
  }), r("render AlertBanner with text", () => {
15
- t(/* @__PURE__ */ e(n, { text: "Test" })), o(s.getByText("Test")).toBeInTheDocument();
15
+ t(/* @__PURE__ */ e(n, { text: "Test" })), a(s.getByText("Test")).toBeInTheDocument();
16
16
  }), r("render AlertBanner with element", () => {
17
- t(/* @__PURE__ */ e(n, { text: /* @__PURE__ */ e(m, { children: "Element" }) })), o(s.getByText("Element")).toBeInTheDocument();
17
+ t(/* @__PURE__ */ e(n, { text: /* @__PURE__ */ e(m, { children: "Element" }) })), a(s.getByText("Element")).toBeInTheDocument();
18
18
  }), r("renders AlertBanner with vertical style (flex-direction: column) when screen is small", () => {
19
- l.spyOn(a, "useBreakpoints").mockReturnValue({
19
+ l.spyOn(o, "useBreakpoints").mockReturnValue({
20
20
  isMobile: !0,
21
21
  isTablet: !1,
22
22
  isDesktop: !1,
23
23
  isDesktopNavbar: !1
24
24
  }), t(/* @__PURE__ */ e(n, { text: "Test" }));
25
25
  const i = s.getByText("Test").closest(".lmnt.lmnt-group");
26
- o(i).toHaveStyle(
27
- "display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 16px;"
26
+ a(i).toHaveStyle(
27
+ "display: flex; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 8px;"
28
28
  );
29
29
  }), r("renders nothing when isOpen is false", () => {
30
- t(/* @__PURE__ */ e(n, { text: "Test", isOpen: !1 })), o(s.queryByText("Test")).not.toBeInTheDocument();
30
+ t(/* @__PURE__ */ e(n, { text: "Test", isOpen: !1 })), a(s.queryByText("Test")).not.toBeInTheDocument();
31
31
  });
32
32
  });
@@ -22,6 +22,10 @@ type BaseViewProps = {
22
22
  * action to be displayed in the headings ActionButton
23
23
  */
24
24
  action?: JSX.Element;
25
+ /**
26
+ * hint to be displayed below the heading
27
+ */
28
+ hint?: JSX.Element;
25
29
  /**
26
30
  * isSorted is true if the list should be sorted, @default true
27
31
  */
@@ -58,5 +62,5 @@ type BaseViewProps = {
58
62
  /**
59
63
  * `BaseView` is a layout component that displays a main (a list) and a detail section.
60
64
  */
61
- export declare const BaseView: ({ action, heading, elements, emptyText, hasSearch, isSorted, className, withAvatar, listMaxHeight, pathname, routerLinkElement, searchPlaceholder, }: BaseViewProps) => import("react/jsx-runtime").JSX.Element;
65
+ export declare const BaseView: ({ heading, action, hint, elements, emptyText, hasSearch, isSorted, className, withAvatar, listMaxHeight, pathname, routerLinkElement, searchPlaceholder, }: BaseViewProps) => import("react/jsx-runtime").JSX.Element;
62
66
  export {};
@@ -1,77 +1,89 @@
1
- import { jsx as e, Fragment as x, jsxs as s } from "react/jsx-runtime";
1
+ import { jsx as i, Fragment as d, jsxs as s } from "react/jsx-runtime";
2
2
  import { G as r } from "../../index.es-DntoATwO.js";
3
- import { useMemo as d } from "react";
3
+ import { useMemo as a } from "react";
4
4
  import { BasicHeading as u } from "../BasicHeading/BasicHeading.js";
5
5
  import { EmptyView as W } from "../EmptyView/EmptyView.js";
6
6
  import { ListArea as B } from "../ListArea/ListArea.js";
7
+ import { u as G } from "../../useBreakpoints-MzTZ0tCT.js";
7
8
  import { VerticalDivider as N } from "../VerticalDivider/VerticalDivider.js";
8
- import { u as A } from "../../useBreakpoints-MzTZ0tCT.js";
9
- import '../../assets/BaseView.css';const V = "_divider_dw2rc_1", j = "_maxWidth_dw2rc_5", E = "_desktopList_dw2rc_9", G = "_mobileList_dw2rc_13", H = "_desktopDetail_dw2rc_17", I = "_mobileDetail_dw2rc_21", o = {
9
+ import '../../assets/BaseView.css';const A = "_parentGroup_w7vsz_1", V = "_divider_w7vsz_5", j = "_maxWidth_w7vsz_10", E = "_desktopList_w7vsz_14", H = "_mobileList_w7vsz_19", I = "_desktopDetail_w7vsz_23", $ = "_mobileDetail_w7vsz_28", o = {
10
+ parentGroup: A,
10
11
  divider: V,
11
12
  maxWidth: j,
12
13
  desktopList: E,
13
- mobileList: G,
14
- desktopDetail: H,
15
- mobileDetail: I
14
+ mobileList: H,
15
+ desktopDetail: I,
16
+ mobileDetail: $
16
17
  }, P = ({
17
- action: l,
18
18
  heading: c,
19
- elements: a,
20
- emptyText: m,
21
- hasSearch: p = !0,
19
+ action: m = /* @__PURE__ */ i(d, {}),
20
+ hint: v = /* @__PURE__ */ i(d, {}),
21
+ elements: n,
22
+ emptyText: p,
23
+ hasSearch: _ = !0,
22
24
  isSorted: h = !0,
23
- className: _,
24
- withAvatar: v = !1,
25
- listMaxHeight: f = "calc(100vh - 200px)",
26
- pathname: n,
27
- routerLinkElement: w,
28
- searchPlaceholder: b
25
+ className: f,
26
+ withAvatar: b = !1,
27
+ listMaxHeight: w = "calc(100vh - 200px)",
28
+ pathname: l,
29
+ routerLinkElement: D,
30
+ searchPlaceholder: g
29
31
  }) => {
30
- const { isDesktopNavbar: i } = A(), t = d(() => a.find((L) => L.route === n), [n, a]), D = d(() => t?.component ?? (i ? /* @__PURE__ */ e(W, { subtitle: m }) : /* @__PURE__ */ e(x, {})), [t, i, m]), g = d(() => i ? !0 : !t, [t, i]), k = d(() => i ? !0 : t, [t, i]);
31
- return /* @__PURE__ */ s(r, { "data-testid": "base-view-container", className: _ ?? "", gap: "none", fullWidth: !0, children: [
32
- g && /* @__PURE__ */ e(r, { gap: "none", className: i ? o.desktopList : o.mobileList, children: /* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, gap: i ? "standard" : "dense", children: [
33
- c && /* @__PURE__ */ e(u, { "data-testid": "heading", heading: c, level: 4, marginBottom: 0, children: l }),
34
- /* @__PURE__ */ e(
35
- B,
36
- {
37
- elements: a,
38
- hasSearch: p,
39
- maxHeight: f,
40
- isSorted: h,
41
- pathname: n,
42
- routerLinkElement: w,
43
- searchPlaceholder: b
44
- }
45
- )
46
- ] }) }),
47
- k && /* @__PURE__ */ s(
48
- r,
49
- {
50
- "data-testid": "details",
51
- gap: "none",
52
- className: i ? o.desktopDetail : o.mobileDetail,
53
- children: [
54
- i && /* @__PURE__ */ e(N, { className: o.divider, height: "100%" }),
55
- /* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, children: [
56
- /* @__PURE__ */ e(
57
- u,
58
- {
59
- className: o.maxWidth,
60
- heading: t?.detailTitle ?? t?.title ?? "",
61
- level: 4,
62
- icon: t?.hideIconInDetail === !0 ? void 0 : t?.icon,
63
- marginBottom: 0,
64
- invisibleButton: t?.detailAction === void 0,
65
- withAvatar: v,
66
- children: t?.detailAction ?? l
67
- }
68
- ),
69
- D
70
- ] })
71
- ]
72
- }
73
- )
74
- ] });
32
+ const { isDesktopNavbar: e } = G(), t = a(() => n.find((z) => z.route === l), [l, n]), k = a(() => t?.component ?? (e ? /* @__PURE__ */ i(W, { subtitle: p }) : /* @__PURE__ */ i(d, {})), [t, e, p]), L = a(() => e ? !0 : !t, [t, e]), x = a(() => e ? !0 : t, [t, e]);
33
+ return /* @__PURE__ */ s(
34
+ r,
35
+ {
36
+ "data-testid": "base-view-container",
37
+ className: `${o.parentGroup} ${f ?? ""}`,
38
+ gap: "none",
39
+ fullWidth: !0,
40
+ children: [
41
+ L && /* @__PURE__ */ i(r, { gap: "none", className: e ? o.desktopList : o.mobileList, children: /* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, gap: e ? "standard" : "dense", children: [
42
+ c && /* @__PURE__ */ i(u, { "data-testid": "heading", heading: c, level: 4, marginBottom: 0, children: m }),
43
+ v,
44
+ /* @__PURE__ */ i(
45
+ B,
46
+ {
47
+ elements: n,
48
+ hasSearch: _,
49
+ maxHeight: w,
50
+ isSorted: h,
51
+ pathname: l,
52
+ routerLinkElement: D,
53
+ searchPlaceholder: g
54
+ }
55
+ )
56
+ ] }) }),
57
+ x && /* @__PURE__ */ s(
58
+ r,
59
+ {
60
+ "data-testid": "details",
61
+ gap: "none",
62
+ className: e ? o.desktopDetail : o.mobileDetail,
63
+ children: [
64
+ e && /* @__PURE__ */ i(N, { className: o.divider, height: "100%" }),
65
+ /* @__PURE__ */ s(r, { direction: "vertical", fullWidth: !0, children: [
66
+ /* @__PURE__ */ i(
67
+ u,
68
+ {
69
+ className: o.maxWidth,
70
+ heading: t?.detailTitle ?? t?.title ?? "",
71
+ level: 4,
72
+ icon: t?.hideIconInDetail === !0 ? void 0 : t?.icon,
73
+ marginBottom: 0,
74
+ invisibleButton: t?.detailAction === void 0,
75
+ withAvatar: b,
76
+ children: t?.detailAction ?? m
77
+ }
78
+ ),
79
+ k
80
+ ] })
81
+ ]
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ );
75
87
  };
76
88
  export {
77
89
  P as BaseView
@@ -6,8 +6,8 @@ import { I as W } from "../../index.es-0lQcz8m1.js";
6
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 k } from "../../useBreakpoints-MzTZ0tCT.js";
10
9
  import { Iconify as z } from "../Iconify/Iconify.js";
10
+ import { u as k } from "../../useBreakpoints-MzTZ0tCT.js";
11
11
  import "../../react-tooltip.min-DSY6KDqS.js";
12
12
  import "../../orderBy-Bd48bw88.js";
13
13
  import { SearchBar as G } from "../SearchBar/SearchBar.js";
@@ -22,8 +22,8 @@ import { M as bi, a as wi } from "../../component-neHBNHRu.js";
22
22
  import { c as Ga } from "../../component-DsB0poTj.js";
23
23
  import { a as Cl } from "../../util-DA21pZXj.js";
24
24
  import '../../assets/main.css';import '../../assets/GenericTable.css';/* empty css */
25
- import { u as Sl } from "../../useBreakpoints-MzTZ0tCT.js";
26
25
  import "../../isEmpty-B4GG2s-V.js";
26
+ import { u as Sl } from "../../useBreakpoints-MzTZ0tCT.js";
27
27
  import "../../react-tooltip.min-DSY6KDqS.js";
28
28
  import "../../uniqueId-NU3-C36A.js";
29
29
  import "react-hook-form";
@@ -1,9 +1,9 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { P as r } from "../../index.es-D-CKRzIB.js";
3
3
  import '../../assets/main.css';/* empty css */
4
- import { u as m } from "../../useBreakpoints-MzTZ0tCT.js";
5
4
  import "react";
6
5
  import "../../isEmpty-B4GG2s-V.js";
6
+ import { u as m } from "../../useBreakpoints-MzTZ0tCT.js";
7
7
  import "../../react-tooltip.min-DSY6KDqS.js";
8
8
  import "../../orderBy-Bd48bw88.js";
9
9
  import "../../uniqueId-NU3-C36A.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/shared-components",
3
3
  "description": "This is a shared component library. It should used in the HortiView platform and its modules.",
4
- "version": "1.9.0",
4
+ "version": "1.10.0",
5
5
  "type": "module",
6
6
  "repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
7
7
  "author": "Falk Menge <falk.menge.ext@bayer.com>",