@hortiview/shared-components 0.0.5404 → 0.0.5431
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/InfoGroup.css +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +20 -18
- package/dist/components/ContextMenu/ContextMenu.test.js +11 -11
- package/dist/components/EmptyView/EmptyView.d.ts +15 -8
- package/dist/components/EmptyView/EmptyView.js +15 -5
- package/dist/components/EmptyView/EmptyView.test.js +21 -16
- package/dist/components/InfoGroup/InfoGroup.js +57 -45
- package/package.json +1 -1
|
@@ -1 +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,49 +1,51 @@
|
|
|
1
1
|
import "../../assets/ContextMenu.css";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import { Menu as
|
|
4
|
-
import { useState as p, useCallback as
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { Menu as c, IconButton as a, List as d, ListItem as f } from "@element/react-components";
|
|
4
|
+
import { useState as p, useCallback as s, useEffect as _ } from "react";
|
|
5
|
+
import { uniqueId as y } from "lodash";
|
|
6
|
+
const C = "_menu_1rfel_1", k = {
|
|
7
|
+
menu: C
|
|
7
8
|
}, M = ({
|
|
8
9
|
triggerOpen: o = null,
|
|
9
|
-
actions:
|
|
10
|
-
iconOrientation:
|
|
10
|
+
actions: r,
|
|
11
|
+
iconOrientation: u = "vertical"
|
|
11
12
|
}) => {
|
|
12
|
-
const [e, t] = p(!1),
|
|
13
|
+
const [e, t] = p(!1), m = s(() => {
|
|
13
14
|
t(!e);
|
|
14
|
-
}, [e]), l =
|
|
15
|
+
}, [e]), l = s(() => {
|
|
15
16
|
t(!1);
|
|
16
17
|
}, []);
|
|
17
|
-
return
|
|
18
|
+
return _(() => {
|
|
18
19
|
t(o !== null ? o : !1);
|
|
19
20
|
}, [o]), /* @__PURE__ */ n(
|
|
20
|
-
|
|
21
|
+
c,
|
|
21
22
|
{
|
|
22
|
-
className:
|
|
23
|
+
className: k.menu,
|
|
23
24
|
"data-testid": "selectionmenu",
|
|
24
25
|
open: e,
|
|
25
26
|
surfaceOnly: !0,
|
|
26
27
|
hoistToBody: !0,
|
|
27
28
|
onClose: l,
|
|
28
29
|
trigger: /* @__PURE__ */ n(
|
|
29
|
-
|
|
30
|
+
a,
|
|
30
31
|
{
|
|
31
32
|
variant: e ? "filled-primary" : void 0,
|
|
32
33
|
"data-testid": "openButton",
|
|
33
|
-
icon:
|
|
34
|
-
onClick:
|
|
34
|
+
icon: u === "vertical" ? "more_vert" : "more_horiz",
|
|
35
|
+
onClick: m
|
|
35
36
|
}
|
|
36
37
|
),
|
|
37
|
-
children: /* @__PURE__ */ n(d, { children:
|
|
38
|
+
children: /* @__PURE__ */ n(d, { children: r.map((i) => /* @__PURE__ */ n(
|
|
38
39
|
f,
|
|
39
40
|
{
|
|
40
|
-
...
|
|
41
|
+
...i,
|
|
41
42
|
leadingBlockType: "icon",
|
|
42
43
|
"data-testid": "listItemButton",
|
|
43
44
|
onClick: () => {
|
|
44
|
-
|
|
45
|
+
i?.onClick?.(), l();
|
|
45
46
|
}
|
|
46
|
-
}
|
|
47
|
+
},
|
|
48
|
+
y(`LI_${i.primaryText?.toString()}_`)
|
|
47
49
|
)) })
|
|
48
50
|
},
|
|
49
51
|
"selectionmenu"
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { r, s as n, f as o, w as a } from "../../react.esm-C0LtovhP.js";
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { r as d, s as n, f as o, w as a } from "../../react.esm-C0LtovhP.js";
|
|
3
3
|
import { ContextMenu as u } from "./ContextMenu.js";
|
|
4
|
-
import { v as
|
|
5
|
-
const T =
|
|
4
|
+
import { v as r, d as g, t as B, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
5
|
+
const T = r.fn(), l = r.fn(), i = r.fn(), p = [
|
|
6
6
|
{ primaryText: "Open", onClick: T, leadingBlock: "add" },
|
|
7
7
|
{ primaryText: "Delete", onClick: i, leadingBlock: "delete_outline" },
|
|
8
8
|
{ primaryText: "Edit", onClick: l, leadingBlock: "edit" }
|
|
9
9
|
];
|
|
10
|
-
|
|
11
|
-
B("render
|
|
12
|
-
|
|
10
|
+
g("ContextMenu Test", () => {
|
|
11
|
+
B("render contextMenu and close it", () => {
|
|
12
|
+
d(/* @__PURE__ */ m(u, { actions: p }));
|
|
13
|
+
const c = n.getByTestId("openButton"), t = n.getByTestId("selectionmenu");
|
|
14
|
+
e(t).toBeInTheDocument(), e(t).not.toHaveClass("mdc-menu-surface--open"), o.click(c), a(() => e(t).toHaveClass("mdc-menu-surface--open")), o.click(c), a(() => e(t).not.toHaveClass("mdc-menu-surface--open"));
|
|
15
|
+
}), B("render ContextMenu and open it", async () => {
|
|
16
|
+
d(/* @__PURE__ */ m(u, { actions: p, triggerOpen: !0 }));
|
|
13
17
|
const c = n.getByTestId("openButton"), t = n.getByTestId("selectionmenu");
|
|
14
18
|
e(t).toBeInTheDocument(), e(t).not.toHaveClass("mdc-menu-surface--open"), o.click(c), a(() => e(t).toHaveClass("mdc-menu-surface--open"));
|
|
15
19
|
const s = n.getAllByTestId("listItemButton");
|
|
16
20
|
e(s.length).toBe(3), e(n.getByText("Open")).toBeInTheDocument(), e(n.getByText("Delete")).toBeInTheDocument(), e(n.getByText("Edit")).toBeInTheDocument(), o.click(s[0]), e(T).toHaveBeenCalled(), e(i).not.toHaveBeenCalled(), e(l).not.toHaveBeenCalled(), o.click(s[1]), e(i).toHaveBeenCalled(), o.click(s[2]), e(l).toHaveBeenCalled();
|
|
17
|
-
}), B("render contextMenu and close it", () => {
|
|
18
|
-
r(/* @__PURE__ */ d(u, { actions: p }));
|
|
19
|
-
const c = n.getByTestId("openButton"), t = n.getByTestId("selectionmenu");
|
|
20
|
-
e(t).toBeInTheDocument(), e(t).not.toHaveClass("mdc-menu-surface--open"), o.click(c), a(() => e(t).toHaveClass("mdc-menu-surface--open")), o.click(c), a(() => e(t).not.toHaveClass("mdc-menu-surface--open"));
|
|
21
21
|
});
|
|
22
22
|
});
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type EmptyViewProps = {
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* The title of the empty view, optional, default is empty string
|
|
4
5
|
*/
|
|
5
|
-
title?: string
|
|
6
|
+
title?: string;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* The subtitle of the empty view, optional, default is empty string
|
|
8
9
|
*/
|
|
9
|
-
subtitle?: string
|
|
10
|
+
subtitle?: string;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* The icon of the empty view, optional, default is 'dashbord'
|
|
12
13
|
*/
|
|
13
|
-
icon?: string
|
|
14
|
-
|
|
14
|
+
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The action of the empty view, optional, default is empty
|
|
17
|
+
*/
|
|
18
|
+
action?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export declare const EmptyView: ({ title, subtitle, icon, action, }: EmptyViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Hero as
|
|
3
|
-
const
|
|
2
|
+
import { Hero as n, HeroContent as h, Icon as l } from "@element/react-components";
|
|
3
|
+
const d = ({
|
|
4
4
|
title: e = "",
|
|
5
5
|
subtitle: r = "",
|
|
6
|
-
icon: t = "dashbord"
|
|
7
|
-
|
|
6
|
+
icon: t = "dashbord",
|
|
7
|
+
action: i
|
|
8
|
+
}) => /* @__PURE__ */ o(n, { style: { width: "100%", height: "25vh" }, children: /* @__PURE__ */ o(
|
|
9
|
+
h,
|
|
10
|
+
{
|
|
11
|
+
logo: /* @__PURE__ */ o(l, { iconSize: "large", icon: t }),
|
|
12
|
+
overline: "",
|
|
13
|
+
subtitle: r,
|
|
14
|
+
title: e,
|
|
15
|
+
heroBtn: i
|
|
16
|
+
}
|
|
17
|
+
) });
|
|
8
18
|
export {
|
|
9
|
-
|
|
19
|
+
d as EmptyView
|
|
10
20
|
};
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { r as
|
|
3
|
-
import { EmptyView as
|
|
4
|
-
import { d as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}),
|
|
9
|
-
|
|
10
|
-
}),
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
e
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
e
|
|
2
|
+
import { r as n, s, w as r, f as c } from "../../react.esm-C0LtovhP.js";
|
|
3
|
+
import { EmptyView as i } from "./EmptyView.js";
|
|
4
|
+
import { d as T, t as a, g as t, v as l } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
5
|
+
T("EmptyView", () => {
|
|
6
|
+
a("should render", () => {
|
|
7
|
+
n(/* @__PURE__ */ o(i, {})), t(s.getByText("dashbord")).toBeInTheDocument();
|
|
8
|
+
}), a("should render with custom icon", () => {
|
|
9
|
+
n(/* @__PURE__ */ o(i, { icon: "add" })), t(s.getByText("add")).toBeInTheDocument();
|
|
10
|
+
}), a("should render with title", () => {
|
|
11
|
+
n(/* @__PURE__ */ o(i, { icon: "add", title: "TITLE" }));
|
|
12
|
+
const e = s.getByText("TITLE");
|
|
13
|
+
t(e).toBeInTheDocument(), t(e).toHaveClass(/headline2/);
|
|
14
|
+
}), a("should render with subtitle", () => {
|
|
15
|
+
n(/* @__PURE__ */ o(i, { icon: "add", subtitle: "SUB_TITLE" }));
|
|
16
|
+
const e = s.getByText("SUB_TITLE");
|
|
17
|
+
t(e).toBeInTheDocument(), t(e).toHaveClass(/headline6/);
|
|
18
|
+
}), a("should render with an action", async () => {
|
|
19
|
+
const e = l.fn();
|
|
20
|
+
n(/* @__PURE__ */ o(i, { icon: "add", action: /* @__PURE__ */ o("button", { onClick: e, children: "BUTTON" }) }));
|
|
21
|
+
const d = s.getByText("BUTTON");
|
|
22
|
+
t(d).toBeInTheDocument(), await r(() => c.click(d)), t(e).toHaveBeenCalledTimes(1);
|
|
18
23
|
});
|
|
19
24
|
});
|
|
@@ -1,60 +1,72 @@
|
|
|
1
1
|
import "../../assets/InfoGroup.css";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Divider as p, Group as
|
|
4
|
-
import { a as
|
|
5
|
-
import { VerticalDivider as
|
|
6
|
-
const
|
|
7
|
-
container:
|
|
2
|
+
import { jsxs as s, Fragment as l, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { Divider as p, Group as m, TypoCaption as u, TypoSubtitle as v } from "@element/react-components";
|
|
4
|
+
import { a as _ } from "../../useBreakpoint-DROHPVxO.js";
|
|
5
|
+
import { VerticalDivider as h } from "../VerticalDivider/VerticalDivider.js";
|
|
6
|
+
const g = "_container_egebs_1", C = "_dividerContainer_egebs_10", b = "_mainGroup_egebs_16", y = "_row_egebs_21", w = "_valueText_egebs_46", G = "_component_egebs_54", N = "_componentContainer_egebs_87", x = "_field_egebs_95", t = {
|
|
7
|
+
container: g,
|
|
8
8
|
dividerContainer: C,
|
|
9
9
|
mainGroup: b,
|
|
10
|
-
row:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
row: y,
|
|
11
|
+
valueText: w,
|
|
12
|
+
component: G,
|
|
13
|
+
componentContainer: N,
|
|
14
|
+
field: x
|
|
15
|
+
}, I = ({ fields: e, bold: r }) => {
|
|
16
|
+
const a = e.length > 1 && Array.isArray(e.at(0)) ? e.map((c, o) => /* @__PURE__ */ s(l, { children: [
|
|
17
|
+
o != 0 && /* @__PURE__ */ n("div", { "data-testid": "test-divider", className: t.dividerContainer, children: /* @__PURE__ */ n(p, {}) }),
|
|
18
|
+
/* @__PURE__ */ n(d, { fields: c, bold: r }, `row${o}`)
|
|
19
|
+
] })) : /* @__PURE__ */ n(d, { fields: e, bold: r });
|
|
20
|
+
return /* @__PURE__ */ n(m, { direction: "vertical", fullWidth: !0, className: t.mainGroup, children: a });
|
|
21
|
+
}, d = ({ fields: e, bold: r }) => {
|
|
22
|
+
const { isLg: i } = _();
|
|
23
|
+
return /* @__PURE__ */ n(
|
|
24
|
+
m,
|
|
24
25
|
{
|
|
25
26
|
direction: i ? "horizontal" : "vertical",
|
|
26
|
-
className:
|
|
27
|
+
className: t.row,
|
|
27
28
|
fullWidth: !0,
|
|
28
29
|
primaryAlign: "center",
|
|
29
30
|
secondaryAlign: "center",
|
|
30
|
-
children:
|
|
31
|
-
const
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
c != 0 &&
|
|
34
|
-
/* @__PURE__ */
|
|
31
|
+
children: e.map((a, c) => {
|
|
32
|
+
const o = i ? /* @__PURE__ */ n(h, { className: t.divider, height: "3rem" }) : /* @__PURE__ */ n(p, {});
|
|
33
|
+
return /* @__PURE__ */ s(l, { children: [
|
|
34
|
+
c != 0 && o,
|
|
35
|
+
/* @__PURE__ */ n(A, { field: a, bold: r })
|
|
35
36
|
] });
|
|
36
37
|
})
|
|
37
38
|
}
|
|
38
39
|
);
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
children:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
}, A = ({ field: e, bold: r }) => {
|
|
41
|
+
if (e.variant || (e.variant = "default"), !e.component || e.variant === "embedded")
|
|
42
|
+
return /* @__PURE__ */ s(
|
|
43
|
+
m,
|
|
44
|
+
{
|
|
45
|
+
"data-testid": "infoGroupItem",
|
|
46
|
+
direction: "vertical",
|
|
47
|
+
primaryAlign: "center",
|
|
48
|
+
secondaryAlign: "space-between",
|
|
49
|
+
fullWidth: !0,
|
|
50
|
+
gap: "dense",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ n(u, { className: t.label, themeColor: "text-hint-on-light", children: e.label }),
|
|
53
|
+
e.value ? /* @__PURE__ */ n(
|
|
54
|
+
v,
|
|
55
|
+
{
|
|
56
|
+
level: 1,
|
|
57
|
+
"data-testid": "infoGroupValue",
|
|
58
|
+
themeColor: e.themeColor,
|
|
59
|
+
bold: r,
|
|
60
|
+
className: t.valueText,
|
|
61
|
+
children: e.value
|
|
62
|
+
}
|
|
63
|
+
) : /* @__PURE__ */ n(l, { children: e.component })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
if (e.component && e.variant === "default")
|
|
68
|
+
return /* @__PURE__ */ n("div", { className: t.componentContainer, children: /* @__PURE__ */ n("div", { className: t.component, children: e.component }) });
|
|
57
69
|
};
|
|
58
70
|
export {
|
|
59
|
-
|
|
71
|
+
I as InfoGroup
|
|
60
72
|
};
|
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.
|
|
4
|
+
"version": "0.0.5431",
|
|
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>",
|