@hortiview/shared-components 0.0.5431 → 0.0.5551
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/components/EmptyView/EmptyView.d.ts +5 -1
- package/dist/components/EmptyView/EmptyView.js +19 -15
- package/dist/components/EmptyView/EmptyView.test.js +52 -22
- package/dist/components/InfoGroup/InfoGroup.d.ts +5 -0
- package/dist/components/InfoGroup/InfoGroup.js +64 -60
- package/dist/main.d.ts +1 -0
- package/package.json +1 -1
|
@@ -12,10 +12,14 @@ type EmptyViewProps = {
|
|
|
12
12
|
* The icon of the empty view, optional, default is 'dashbord'
|
|
13
13
|
*/
|
|
14
14
|
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A text value which is shown in the empty view, optional, default is empty string
|
|
17
|
+
*/
|
|
18
|
+
text?: string;
|
|
15
19
|
/**
|
|
16
20
|
* The action of the empty view, optional, default is empty
|
|
17
21
|
*/
|
|
18
22
|
action?: ReactNode;
|
|
19
23
|
};
|
|
20
|
-
export declare const EmptyView: ({ title, subtitle, icon, action, }: EmptyViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const EmptyView: ({ title, subtitle, icon, text, action, }: EmptyViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export {};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Hero as
|
|
3
|
-
const
|
|
4
|
-
title:
|
|
5
|
-
subtitle:
|
|
6
|
-
icon:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { Hero as h, HeroContent as d, Icon as s, TypoBody as n, Group as m } from "@element/react-components";
|
|
3
|
+
const f = ({
|
|
4
|
+
title: r = "",
|
|
5
|
+
subtitle: o = "",
|
|
6
|
+
icon: i = "dashbord",
|
|
7
|
+
text: t = "",
|
|
8
|
+
action: l
|
|
9
|
+
}) => /* @__PURE__ */ e(h, { style: { width: "100%", height: "25vh" }, themeColor: "surface", children: /* @__PURE__ */ e(
|
|
10
|
+
d,
|
|
10
11
|
{
|
|
11
|
-
logo: /* @__PURE__ */
|
|
12
|
+
logo: /* @__PURE__ */ e(s, { iconSize: "large", icon: i }),
|
|
12
13
|
overline: "",
|
|
13
|
-
subtitle:
|
|
14
|
-
title:
|
|
15
|
-
heroBtn:
|
|
14
|
+
subtitle: o,
|
|
15
|
+
title: r,
|
|
16
|
+
heroBtn: /* @__PURE__ */ e(p, { action: l, text: t })
|
|
16
17
|
}
|
|
17
|
-
) })
|
|
18
|
+
) }), p = ({ action: r, text: o }) => o ? r ? /* @__PURE__ */ c(m, { direction: "vertical", primaryAlign: "center", secondaryAlign: "center", children: [
|
|
19
|
+
/* @__PURE__ */ e(n, { level: 2, children: o }),
|
|
20
|
+
r
|
|
21
|
+
] }) : /* @__PURE__ */ e(n, { level: 2, children: o }) : r;
|
|
18
22
|
export {
|
|
19
|
-
|
|
23
|
+
f as EmptyView
|
|
20
24
|
};
|
|
@@ -1,24 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { r as
|
|
3
|
-
import { EmptyView as
|
|
4
|
-
import { d as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}),
|
|
9
|
-
|
|
10
|
-
}),
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
t
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
t
|
|
18
|
-
}),
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { r as s, s as o, w as r, f as l } from "../../react.esm-C0LtovhP.js";
|
|
3
|
+
import { EmptyView as c } from "./EmptyView.js";
|
|
4
|
+
import { d as h, t as T, g as e, v as d } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
5
|
+
h("EmptyView", () => {
|
|
6
|
+
T("should render", () => {
|
|
7
|
+
s(/* @__PURE__ */ n(c, {})), e(o.getByText("dashbord")).toBeInTheDocument();
|
|
8
|
+
}), T("should render with custom icon", () => {
|
|
9
|
+
s(/* @__PURE__ */ n(c, { icon: "add" })), e(o.getByText("add")).toBeInTheDocument();
|
|
10
|
+
}), T("should render with title", () => {
|
|
11
|
+
s(/* @__PURE__ */ n(c, { icon: "add", title: "TITLE" }));
|
|
12
|
+
const t = o.getByText("TITLE");
|
|
13
|
+
e(t).toBeInTheDocument(), e(t).toHaveClass(/headline2/);
|
|
14
|
+
}), T("should render with subtitle", () => {
|
|
15
|
+
s(/* @__PURE__ */ n(c, { icon: "add", subtitle: "SUB_TITLE" }));
|
|
16
|
+
const t = o.getByText("SUB_TITLE");
|
|
17
|
+
e(t).toBeInTheDocument(), e(t).toHaveClass(/headline6/);
|
|
18
|
+
}), T("should render with an action", async () => {
|
|
19
|
+
const t = d.fn();
|
|
20
|
+
s(/* @__PURE__ */ n(c, { icon: "add", action: /* @__PURE__ */ n("button", { onClick: t, children: "BUTTON" }) }));
|
|
21
|
+
const i = o.getByText("BUTTON");
|
|
22
|
+
e(i).toBeInTheDocument(), await r(() => l.click(i)), e(t).toHaveBeenCalledTimes(1);
|
|
23
|
+
}), T("should render with a text and a button", async () => {
|
|
24
|
+
const t = d.fn();
|
|
25
|
+
s(
|
|
26
|
+
/* @__PURE__ */ n(
|
|
27
|
+
c,
|
|
28
|
+
{
|
|
29
|
+
icon: "add",
|
|
30
|
+
action: /* @__PURE__ */ n("button", { onClick: t, children: "BUTTON" }),
|
|
31
|
+
text: "MY_TEXT"
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
const i = o.getByText("BUTTON");
|
|
36
|
+
e(i).toBeInTheDocument();
|
|
37
|
+
const a = o.getByText("MY_TEXT");
|
|
38
|
+
e(a).toBeInTheDocument();
|
|
39
|
+
}), T("should render with text only", async () => {
|
|
40
|
+
s(
|
|
41
|
+
/* @__PURE__ */ n(
|
|
42
|
+
c,
|
|
43
|
+
{
|
|
44
|
+
icon: "add",
|
|
45
|
+
text: "MY_TEXT"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
const t = o.queryByText("BUTTON");
|
|
50
|
+
e(t).not.toBeInTheDocument();
|
|
51
|
+
const i = o.getByText("MY_TEXT");
|
|
52
|
+
e(i).toBeInTheDocument();
|
|
23
53
|
});
|
|
24
54
|
});
|
|
@@ -50,4 +50,9 @@ interface InfoGroupProps {
|
|
|
50
50
|
* ];
|
|
51
51
|
*/
|
|
52
52
|
export declare const InfoGroup: React.FC<InfoGroupProps>;
|
|
53
|
+
export declare const Cell: ({ field, bold, variant, }: {
|
|
54
|
+
field: FieldItem;
|
|
55
|
+
bold?: boolean | undefined;
|
|
56
|
+
variant?: "default" | "embedded" | undefined;
|
|
57
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
53
58
|
export {};
|
|
@@ -1,72 +1,76 @@
|
|
|
1
1
|
import "../../assets/InfoGroup.css";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Divider as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsxs as c, jsx as e, Fragment as _ } from "react/jsx-runtime";
|
|
3
|
+
import { Divider as d, Group as s, TypoCaption as v, TypoSubtitle as h } from "@element/react-components";
|
|
4
|
+
import { a as g } from "../../useBreakpoint-DROHPVxO.js";
|
|
5
|
+
import { Fragment as p } from "react";
|
|
6
|
+
import { VerticalDivider as b } from "../VerticalDivider/VerticalDivider.js";
|
|
7
|
+
const f = "_container_egebs_1", C = "_dividerContainer_egebs_10", y = "_mainGroup_egebs_16", w = "_row_egebs_21", G = "_valueText_egebs_46", N = "_component_egebs_54", x = "_componentContainer_egebs_87", A = "_field_egebs_95", r = {
|
|
8
|
+
container: f,
|
|
8
9
|
dividerContainer: C,
|
|
9
|
-
mainGroup:
|
|
10
|
-
row:
|
|
11
|
-
valueText:
|
|
12
|
-
component:
|
|
13
|
-
componentContainer:
|
|
14
|
-
field:
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
] })) : /* @__PURE__ */
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
},
|
|
22
|
-
const { isLg:
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
10
|
+
mainGroup: y,
|
|
11
|
+
row: w,
|
|
12
|
+
valueText: G,
|
|
13
|
+
component: N,
|
|
14
|
+
componentContainer: x,
|
|
15
|
+
field: A
|
|
16
|
+
}, S = ({ fields: n, bold: i }) => {
|
|
17
|
+
const t = n.length > 1 && Array.isArray(n.at(0)) ? n.map((o, a) => /* @__PURE__ */ c(p, { children: [
|
|
18
|
+
a != 0 && /* @__PURE__ */ e("div", { "data-testid": "test-divider", className: r.dividerContainer, children: /* @__PURE__ */ e(d, {}) }),
|
|
19
|
+
/* @__PURE__ */ e(m, { fields: o, bold: i })
|
|
20
|
+
] }, `row_${a}`)) : /* @__PURE__ */ e(m, { fields: n, bold: i });
|
|
21
|
+
return /* @__PURE__ */ e(s, { direction: "vertical", fullWidth: !0, className: r.mainGroup, children: t });
|
|
22
|
+
}, m = ({ fields: n, bold: i }) => {
|
|
23
|
+
const { isLg: l } = g();
|
|
24
|
+
return /* @__PURE__ */ e(
|
|
25
|
+
s,
|
|
25
26
|
{
|
|
26
|
-
direction:
|
|
27
|
-
className:
|
|
27
|
+
direction: l ? "horizontal" : "vertical",
|
|
28
|
+
className: r.row,
|
|
28
29
|
fullWidth: !0,
|
|
29
30
|
primaryAlign: "center",
|
|
30
31
|
secondaryAlign: "center",
|
|
31
|
-
children:
|
|
32
|
-
const
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
] });
|
|
32
|
+
children: n.map((t, o) => {
|
|
33
|
+
const a = l ? /* @__PURE__ */ e(b, { className: r.divider, height: "3rem" }) : /* @__PURE__ */ e(d, {});
|
|
34
|
+
return /* @__PURE__ */ c(p, { children: [
|
|
35
|
+
o != 0 && a,
|
|
36
|
+
/* @__PURE__ */ e(T, { field: t, bold: i, variant: t.variant })
|
|
37
|
+
] }, `${t.label ?? "label"}_${o}`);
|
|
37
38
|
})
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
}, T = ({
|
|
42
|
+
field: n,
|
|
43
|
+
bold: i,
|
|
44
|
+
variant: l = "default"
|
|
45
|
+
}) => {
|
|
46
|
+
const { component: t, value: o, label: a, themeColor: u } = n;
|
|
47
|
+
return t && l === "default" ? /* @__PURE__ */ e("div", { className: r.componentContainer, children: /* @__PURE__ */ e("div", { className: r.component, children: t }) }) : /* @__PURE__ */ c(
|
|
48
|
+
s,
|
|
49
|
+
{
|
|
50
|
+
"data-testid": "infoGroupItem",
|
|
51
|
+
direction: "vertical",
|
|
52
|
+
primaryAlign: "center",
|
|
53
|
+
secondaryAlign: "space-between",
|
|
54
|
+
fullWidth: !0,
|
|
55
|
+
gap: "dense",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ e(v, { className: r.label, themeColor: "text-hint-on-light", children: a }),
|
|
58
|
+
o ? /* @__PURE__ */ e(
|
|
59
|
+
h,
|
|
60
|
+
{
|
|
61
|
+
level: 1,
|
|
62
|
+
"data-testid": "infoGroupValue",
|
|
63
|
+
themeColor: u,
|
|
64
|
+
bold: i,
|
|
65
|
+
className: r.valueText,
|
|
66
|
+
children: o
|
|
67
|
+
}
|
|
68
|
+
) : /* @__PURE__ */ e(_, { children: t })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
69
72
|
};
|
|
70
73
|
export {
|
|
71
|
-
|
|
74
|
+
T as Cell,
|
|
75
|
+
S as InfoGroup
|
|
72
76
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -30,3 +30,4 @@ export type { FieldItem } from './components/InfoGroup/InfoGroup';
|
|
|
30
30
|
export type { HashTab } from './types/HashTab';
|
|
31
31
|
export type { ListElement, BaseListElement } from './types/ListElement';
|
|
32
32
|
export type { CellTemplate, CellTemplateProps, TableLayoutProps } from './types/GenericTable';
|
|
33
|
+
export type { FormSelectOption } from './components/FormComponents/FormSelect/FormSelect';
|
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.5551",
|
|
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>",
|