@hortiview/shared-components 0.0.4993 → 0.0.5053

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/README.md CHANGED
@@ -27,6 +27,7 @@ Additionally the library provides form components using [react-hook-form](https:
27
27
 
28
28
  ## Available packages:
29
29
 
30
+ 1. [AlertBanner](#alertbanner)
30
31
  1. [BaseView](#baseview)
31
32
  1. [BasicHeading](#basicheading)
32
33
  1. [BlockView](#blockview)
@@ -50,6 +51,20 @@ Additionally the library provides form components using [react-hook-form](https:
50
51
  1. [SearchBar](#searchbar)
51
52
  1. [VerticalDivider](#verticaldivider)
52
53
 
54
+ ### AlertBanner
55
+
56
+ Presents an Banner containing important messages. Can used in different colors and you can add an optional action.
57
+
58
+ ```typescript
59
+ import { AlertBanner } from '@hortiview/shared-components';
60
+
61
+ <AlertBanner
62
+ text='My Alert'
63
+ color='danger' // | 'info' | 'success'
64
+ action={<MyButton />}
65
+ />;
66
+ ```
67
+
53
68
  ### BaseView
54
69
 
55
70
  Can used to show a kind off main and detail view. On the left side you will have a list of elements and on the right a detail section of the element selected.
@@ -437,6 +452,7 @@ const fields: FieldItem[] = [
437
452
  ```
438
453
 
439
454
  You can also render a multiline section, that receives an array if FieldItem-Arrays instead of a single FieldItem-Array
455
+
440
456
  ```typescript
441
457
  import { InfoGroup } from '@hortiview/shared-components';
442
458
 
@@ -453,7 +469,7 @@ const multiLineFields: FieldItem[][] = [
453
469
  { label: 'FieldTitle2', value: 'Value2' },
454
470
  { label: 'FieldTitle3', value: 'Value3' },
455
471
  { label: 'FieldTitle4', value: 'Value4' },
456
- ]
472
+ ]
457
473
  ]
458
474
 
459
475
  <InfoGroup fields={multiLineFields} />
@@ -0,0 +1 @@
1
+ ._messageContainer_92aoe_1{border-radius:.25rem;padding:.5rem 1rem;width:-moz-available;width:-webkit-fill-available;width:stretch}._message_92aoe_1{color:var(--lmnt-theme-on-surface-active);font-weight:700}._info_92aoe_13{border:1px solid var(--lmnt-theme-on-secondary-stroke);background:var(--lmnt-theme-secondary-50)}._danger_92aoe_18{border:1px solid var(--lmnt-theme-on-danger-stroke);background:var(--lmnt-theme-danger-50)}._success_92aoe_23{border:1px solid var(--lmnt-theme-on-success-stroke);background:var(--lmnt-theme-success-50)}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ type AlertBannerProps = {
3
+ text: string | JSX.Element;
4
+ color?: 'danger' | 'info' | 'success';
5
+ isOpen?: boolean;
6
+ action?: JSX.Element;
7
+ };
8
+ export declare const AlertBanner: ({ text, color, isOpen, action }: AlertBannerProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,20 @@
1
+ import "../../assets/AlertBanner.css";
2
+ import { jsx as e, Fragment as t, jsxs as c } from "react/jsx-runtime";
3
+ import { Group as m, TypoBody as g } from "@element/react-components";
4
+ import { a as _ } from "../../useBreakpoint-DROHPVxO.js";
5
+ const l = "_messageContainer_92aoe_1", d = "_message_92aoe_1", p = "_info_92aoe_13", f = "_danger_92aoe_18", u = "_success_92aoe_23", n = {
6
+ messageContainer: l,
7
+ message: d,
8
+ info: p,
9
+ danger: f,
10
+ success: u
11
+ }, A = ({ text: s, color: o = "info", isOpen: r = !0, action: a }) => {
12
+ const { isLg: i } = _();
13
+ return r ? /* @__PURE__ */ e("div", { className: `${n.messageContainer} ${n[o]}`, children: /* @__PURE__ */ c(m, { direction: i ? "horizontal" : "vertical", primaryAlign: "space-between", secondaryAlign: "center", children: [
14
+ typeof s == "string" ? /* @__PURE__ */ e(g, { bold: !0, level: 2, children: s }) : /* @__PURE__ */ e("div", { children: s }),
15
+ a
16
+ ] }) }) : /* @__PURE__ */ e(t, {});
17
+ };
18
+ export {
19
+ A as AlertBanner
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx as e, Fragment as m } from "react/jsx-runtime";
2
+ import { r as t, s } from "../../react.esm-C0LtovhP.js";
3
+ import { u as i } from "../../useBreakpoint-DROHPVxO.js";
4
+ import { AlertBanner as n } from "./AlertBanner.js";
5
+ import { d as c, b as u, t as r, g as l, v as a } from "../../vi.JYQecGiw-BbUbJcT8.js";
6
+ c("AlertBanner Test", () => {
7
+ u(() => {
8
+ a.spyOn(i, "useBreakpoints").mockReturnValue({
9
+ isXs: !1,
10
+ isSm: !1,
11
+ isMd: !1,
12
+ isLg: !0,
13
+ isXlg: !0,
14
+ active: "lg"
15
+ });
16
+ }), r("render AlertBanner with text", () => {
17
+ t(/* @__PURE__ */ e(n, { text: "Test" })), l(s.getByText("Test")).toBeInTheDocument();
18
+ }), r("render AlertBanner with element", () => {
19
+ t(/* @__PURE__ */ e(n, { text: /* @__PURE__ */ e(m, { children: "Element" }) })), l(s.getByText("Element")).toBeInTheDocument();
20
+ }), r("renders AlertBanner with vertical style (flex-direction: column) when screen is small", () => {
21
+ a.spyOn(i, "useBreakpoints").mockReturnValue({
22
+ isXs: !1,
23
+ isSm: !0,
24
+ isMd: !1,
25
+ isLg: !1,
26
+ isXlg: !1,
27
+ active: "sm"
28
+ }), t(/* @__PURE__ */ e(n, { text: "Test" }));
29
+ const o = s.getByText("Test").closest(".lmnt.lmnt-group");
30
+ l(o).toHaveStyle(
31
+ "display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 16px;"
32
+ );
33
+ }), r("renders nothing when isOpen is false", () => {
34
+ t(/* @__PURE__ */ e(n, { text: "Test", isOpen: !1 })), l(s.queryByText("Test")).not.toBeInTheDocument();
35
+ });
36
+ });
@@ -1,59 +1,59 @@
1
1
  import "../../assets/HashTabView.css";
2
- import { jsx as r, jsxs as d, Fragment as w } from "react/jsx-runtime";
2
+ import { jsx as a, jsxs as l, Fragment as w } from "react/jsx-runtime";
3
3
  import { Elevation as T, Group as o, TabBar as C, Tab as k, Padding as A } from "@element/react-components";
4
4
  import { useState as I, useEffect as L } from "react";
5
5
  import { a as N } from "../../useBreakpoint-DROHPVxO.js";
6
- const x = "_elevation_1rcw6_1", y = "_themeBackground_1rcw6_6", W = "_tabBar_1rcw6_10", $ = "_tabWrapper_1rcw6_16", j = "_tabButton_1rcw6_20", E = "_childContainer_1rcw6_24", z = "_childContainerLg_1rcw6_28", a = {
6
+ const x = "_elevation_1rcw6_1", y = "_themeBackground_1rcw6_6", W = "_tabBar_1rcw6_10", j = "_tabWrapper_1rcw6_16", E = "_tabButton_1rcw6_20", $ = "_childContainer_1rcw6_24", z = "_childContainerLg_1rcw6_28", t = {
7
7
  elevation: x,
8
8
  themeBackground: y,
9
9
  tabBar: W,
10
- tabWrapper: $,
11
- tabButton: j,
12
- childContainer: E,
10
+ tabWrapper: j,
11
+ tabButton: E,
12
+ childContainer: $,
13
13
  childContainerLg: z
14
- }, _ = (n, t, c) => !c || !t || !n ? 0 : n.findIndex((i) => `#${i.hash}` === t) ?? 0, q = ({
14
+ }, p = (n, r) => !r || !n ? 0 : n.findIndex((c) => c.hash === r.replace("#", "")) ?? 0, q = ({
15
15
  tabs: n,
16
- hasHash: t = !0,
16
+ hasHash: r = !0,
17
17
  hash: c = "",
18
- clusterAlign: i = "start",
19
- hasClusteredTabs: g,
20
- children: l,
21
- verticalGap: h = "none",
18
+ clusterAlign: u = "start",
19
+ hasClusteredTabs: _,
20
+ children: i,
21
+ verticalGap: g = "none",
22
22
  elevation: B = 0,
23
23
  backgroundColor: v = "themeBackground",
24
24
  onChange: b
25
25
  }) => {
26
- const [m, p] = I(_(n, c, t)), { isLg: s } = N();
26
+ const [d, h] = I(p(n, c)), { isLg: s } = N();
27
27
  L(() => {
28
- const e = _(n, c, t);
29
- p(e);
30
- }, [c, n, t]);
28
+ const e = p(n, c);
29
+ h(e);
30
+ }, [c, n, r]);
31
31
  const f = (e) => {
32
- const u = n[e].hash;
33
- u != null && t && (window.location.hash = u), p(e), b?.(e);
32
+ const m = n[e].hash;
33
+ m != null && r && (window.location.hash = m), h(e), b?.(e);
34
34
  };
35
- return /* @__PURE__ */ r(
35
+ return /* @__PURE__ */ a(
36
36
  T,
37
37
  {
38
38
  elevation: B,
39
- className: `${a.elevation} ${v === "none" ? "" : a.themeBackground}`,
40
- children: /* @__PURE__ */ d(o, { direction: "vertical", gap: h, secondaryAlign: "stretch", children: [
41
- /* @__PURE__ */ d(o, { direction: s ? "horizontal" : "vertical", className: a.tabWrapper, children: [
42
- /* @__PURE__ */ r(
39
+ className: `${t.elevation} ${v === "none" ? "" : t.themeBackground}`,
40
+ children: /* @__PURE__ */ l(o, { direction: "vertical", gap: g, secondaryAlign: "stretch", children: [
41
+ /* @__PURE__ */ l(o, { direction: s ? "horizontal" : "vertical", className: t.tabWrapper, children: [
42
+ /* @__PURE__ */ a(
43
43
  C,
44
44
  {
45
- className: a.tabBar,
46
- clustered: s ? g : !1,
47
- clusterAlign: i,
45
+ className: t.tabBar,
46
+ clustered: s ? _ : !1,
47
+ clusterAlign: u,
48
48
  variant: "surface",
49
- activeTabIndex: m,
49
+ activeTabIndex: d,
50
50
  onTabActivated: f,
51
- children: n.map((e) => /* @__PURE__ */ r(
51
+ children: n.map((e) => /* @__PURE__ */ a(
52
52
  k,
53
53
  {
54
54
  icon: e.leadingIcon,
55
- className: l ? a.tabButton : "",
56
- children: /* @__PURE__ */ d(o, { gap: "dense", children: [
55
+ className: i ? t.tabButton : "",
56
+ children: /* @__PURE__ */ l(o, { gap: "dense", children: [
57
57
  e.title,
58
58
  e.trailingIcon
59
59
  ] })
@@ -62,16 +62,16 @@ const x = "_elevation_1rcw6_1", y = "_themeBackground_1rcw6_6", W = "_tabBar_1rc
62
62
  ))
63
63
  }
64
64
  ),
65
- l ? /* @__PURE__ */ r(
65
+ i ? /* @__PURE__ */ a(
66
66
  A,
67
67
  {
68
68
  variant: "dense",
69
- className: s ? a.childContainer : a.childContainerLg,
70
- children: /* @__PURE__ */ r(o, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: l })
69
+ className: s ? t.childContainer : t.childContainerLg,
70
+ children: /* @__PURE__ */ a(o, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: i })
71
71
  }
72
- ) : /* @__PURE__ */ r(w, {})
72
+ ) : /* @__PURE__ */ a(w, {})
73
73
  ] }),
74
- n[m]?.component
74
+ n[d]?.component
75
75
  ] })
76
76
  }
77
77
  );
@@ -22,15 +22,15 @@ export declare const getGroupedItems: (items: ListElement[], pathname: string, i
22
22
  */
23
23
  export declare const getListedItems: (items: ListElement[], pathname: string, itemClassName: string, routerLinkElement: undefined | React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>) => {
24
24
  select: boolean;
25
- primaryText: import("react/jsx-runtime").JSX.Element;
25
+ primaryText: JSX.Element;
26
26
  secondaryText: import("react/jsx-runtime").JSX.Element | undefined;
27
27
  overlineText: string | undefined;
28
- trailingBlock: string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode>;
29
- leadingBlock: string | import("react/jsx-runtime").JSX.Element | undefined;
28
+ trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
29
+ leadingBlock: string | JSX.Element | undefined;
30
30
  value: string | undefined;
31
31
  componentProps: {
32
- leadingBlockType: "icon" | "checkbox" | "radio" | "switch" | "avatar" | "badge" | "image" | "lgImage" | "meta" | "thumbnail";
33
- trailingBlockType: "icon" | "checkbox" | "radio" | "switch" | "avatar" | "badge" | "image" | "lgImage" | "meta" | "thumbnail";
32
+ leadingBlockType: "icon" | "badge" | "image" | "meta" | "checkbox" | "radio" | "switch" | "avatar" | "lgImage" | "thumbnail";
33
+ trailingBlockType: "icon" | "badge" | "image" | "meta" | "checkbox" | "radio" | "switch" | "avatar" | "lgImage" | "thumbnail";
34
34
  className: string;
35
35
  onClick: (_: ChangeEvent, value: string) => void | undefined;
36
36
  tag: string | import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>> | undefined;
@@ -48,15 +48,15 @@ export declare const getListedItems: (items: ListElement[], pathname: string, it
48
48
  */
49
49
  export declare const mapListElement: (element: ListElement, pathname: string | undefined, itemClassName: string | undefined, isGrouped: boolean, routerLinkElement: undefined | React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>) => {
50
50
  select: boolean;
51
- primaryText: import("react/jsx-runtime").JSX.Element;
51
+ primaryText: JSX.Element;
52
52
  secondaryText: import("react/jsx-runtime").JSX.Element | undefined;
53
53
  overlineText: string | undefined;
54
- trailingBlock: string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode>;
55
- leadingBlock: string | import("react/jsx-runtime").JSX.Element | undefined;
54
+ trailingBlock: string | number | boolean | JSX.Element | Iterable<import("react").ReactNode>;
55
+ leadingBlock: string | JSX.Element | undefined;
56
56
  value: string | undefined;
57
57
  componentProps: {
58
- leadingBlockType: "icon" | "checkbox" | "radio" | "switch" | "avatar" | "badge" | "image" | "lgImage" | "meta" | "thumbnail";
59
- trailingBlockType: "icon" | "checkbox" | "radio" | "switch" | "avatar" | "badge" | "image" | "lgImage" | "meta" | "thumbnail";
58
+ leadingBlockType: "icon" | "badge" | "image" | "meta" | "checkbox" | "radio" | "switch" | "avatar" | "lgImage" | "thumbnail";
59
+ trailingBlockType: "icon" | "badge" | "image" | "meta" | "checkbox" | "radio" | "switch" | "avatar" | "lgImage" | "thumbnail";
60
60
  className: string;
61
61
  onClick: (_: ChangeEvent, value: string) => void | undefined;
62
62
  tag: string | import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>> | undefined;
package/dist/main.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './styles/main.css';
2
+ export { AlertBanner } from './components/AlertBanner/AlertBanner';
2
3
  export { BaseView } from './components/BaseView/BaseView';
3
4
  export { BasicHeading } from './components/BasicHeading/BasicHeading';
4
5
  export { BlockView } from './components/BlockView/BlockView';
package/dist/main.js CHANGED
@@ -1,52 +1,54 @@
1
1
  import "./assets/main.css";
2
- import { BaseView as t } from "./components/BaseView/BaseView.js";
3
- import { BasicHeading as p } from "./components/BasicHeading/BasicHeading.js";
4
- import { BlockView as f } from "./components/BlockView/BlockView.js";
5
- import { ContextMenu as i } from "./components/ContextMenu/ContextMenu.js";
6
- import { DeleteModal as c } from "./components/DeleteModal/DeleteModal.js";
7
- import { Disclaimer as F } from "./components/Disclaimer/Disclaimer.js";
8
- import { EmptyView as d } from "./components/EmptyView/EmptyView.js";
9
- import { HashTabView as S } from "./components/HashTabView/HashTabView.js";
10
- import { HeaderFilter as b } from "./components/HeaderFilter/HeaderFilter.js";
11
- import { Iconify as u } from "./components/Iconify/Iconify.js";
12
- import { InfoGroup as D } from "./components/InfoGroup/InfoGroup.js";
13
- import { ListArea as C } from "./components/ListArea/ListArea.js";
14
- import { ScrollbarX as I, ScrollbarY as v } from "./components/Scrollbar/Scrollbar.js";
15
- import { SearchBar as A } from "./components/SearchBar/SearchBar.js";
16
- import { VerticalDivider as M } from "./components/VerticalDivider/VerticalDivider.js";
17
- import { FormCheckBox as g } from "./components/FormComponents/FormCheckBox/FormCheckBox.js";
18
- import { FormDatePicker as E } from "./components/FormComponents/FormDatePicker/FormDatePicker.js";
19
- import { FormRadio as P } from "./components/FormComponents/FormRadio/FormRadio.js";
20
- import { FormSelect as X } from "./components/FormComponents/FormSelect/FormSelect.js";
21
- import { FormSlider as j } from "./components/FormComponents/FormSlider/FormSlider.js";
22
- import { FormText as J } from "./components/FormComponents/FormText/FormText.js";
23
- import { AvailableCustomIcons as N } from "./enums/AvailableCustomIcons.js";
24
- import { a as Q } from "./useBreakpoint-DROHPVxO.js";
25
- import { capitalizeFirstLetters as W } from "./services/UtilService.js";
2
+ import { AlertBanner as t } from "./components/AlertBanner/AlertBanner.js";
3
+ import { BaseView as p } from "./components/BaseView/BaseView.js";
4
+ import { BasicHeading as f } from "./components/BasicHeading/BasicHeading.js";
5
+ import { BlockView as i } from "./components/BlockView/BlockView.js";
6
+ import { ContextMenu as c } from "./components/ContextMenu/ContextMenu.js";
7
+ import { DeleteModal as n } from "./components/DeleteModal/DeleteModal.js";
8
+ import { Disclaimer as B } from "./components/Disclaimer/Disclaimer.js";
9
+ import { EmptyView as S } from "./components/EmptyView/EmptyView.js";
10
+ import { HashTabView as b } from "./components/HashTabView/HashTabView.js";
11
+ import { HeaderFilter as u } from "./components/HeaderFilter/HeaderFilter.js";
12
+ import { Iconify as D } from "./components/Iconify/Iconify.js";
13
+ import { InfoGroup as A } from "./components/InfoGroup/InfoGroup.js";
14
+ import { ListArea as H } from "./components/ListArea/ListArea.js";
15
+ import { ScrollbarX as v, ScrollbarY as y } from "./components/Scrollbar/Scrollbar.js";
16
+ import { SearchBar as M } from "./components/SearchBar/SearchBar.js";
17
+ import { VerticalDivider as g } from "./components/VerticalDivider/VerticalDivider.js";
18
+ import { FormCheckBox as E } from "./components/FormComponents/FormCheckBox/FormCheckBox.js";
19
+ import { FormDatePicker as P } from "./components/FormComponents/FormDatePicker/FormDatePicker.js";
20
+ import { FormRadio as X } from "./components/FormComponents/FormRadio/FormRadio.js";
21
+ import { FormSelect as j } from "./components/FormComponents/FormSelect/FormSelect.js";
22
+ import { FormSlider as J } from "./components/FormComponents/FormSlider/FormSlider.js";
23
+ import { FormText as N } from "./components/FormComponents/FormText/FormText.js";
24
+ import { AvailableCustomIcons as Q } from "./enums/AvailableCustomIcons.js";
25
+ import { a as W } from "./useBreakpoint-DROHPVxO.js";
26
+ import { capitalizeFirstLetters as _ } from "./services/UtilService.js";
26
27
  export {
27
- N as AvailableCustomIcons,
28
- t as BaseView,
29
- p as BasicHeading,
30
- f as BlockView,
31
- i as ContextMenu,
32
- c as DeleteModal,
33
- F as Disclaimer,
34
- d as EmptyView,
35
- g as FormCheckBox,
36
- E as FormDatePicker,
37
- P as FormRadio,
38
- X as FormSelect,
39
- j as FormSlider,
40
- J as FormText,
41
- S as HashTabView,
42
- b as HeaderFilter,
43
- u as Iconify,
44
- D as InfoGroup,
45
- C as ListArea,
46
- I as ScrollbarX,
47
- v as ScrollbarY,
48
- A as SearchBar,
49
- M as VerticalDivider,
50
- W as capitalizeFirstLetters,
51
- Q as useBreakpoints
28
+ t as AlertBanner,
29
+ Q as AvailableCustomIcons,
30
+ p as BaseView,
31
+ f as BasicHeading,
32
+ i as BlockView,
33
+ c as ContextMenu,
34
+ n as DeleteModal,
35
+ B as Disclaimer,
36
+ S as EmptyView,
37
+ E as FormCheckBox,
38
+ P as FormDatePicker,
39
+ X as FormRadio,
40
+ j as FormSelect,
41
+ J as FormSlider,
42
+ N as FormText,
43
+ b as HashTabView,
44
+ u as HeaderFilter,
45
+ D as Iconify,
46
+ A as InfoGroup,
47
+ H as ListArea,
48
+ v as ScrollbarX,
49
+ y as ScrollbarY,
50
+ M as SearchBar,
51
+ g as VerticalDivider,
52
+ _ as capitalizeFirstLetters,
53
+ W as useBreakpoints
52
54
  };
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": "0.0.4993",
4
+ "version": "0.0.5053",
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>",