@hortiview/shared-components 0.0.5409 → 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.
@@ -1,49 +1,51 @@
1
1
  import "../../assets/ContextMenu.css";
2
2
  import { jsx as n } from "react/jsx-runtime";
3
- import { Menu as a, IconButton as m, List as d, ListItem as f } from "@element/react-components";
4
- import { useState as p, useCallback as i, useEffect as C } from "react";
5
- const k = "_menu_1rfel_1", v = {
6
- menu: k
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: c,
10
- iconOrientation: r = "vertical"
10
+ actions: r,
11
+ iconOrientation: u = "vertical"
11
12
  }) => {
12
- const [e, t] = p(!1), u = i(() => {
13
+ const [e, t] = p(!1), m = s(() => {
13
14
  t(!e);
14
- }, [e]), l = i(() => {
15
+ }, [e]), l = s(() => {
15
16
  t(!1);
16
17
  }, []);
17
- return C(() => {
18
+ return _(() => {
18
19
  t(o !== null ? o : !1);
19
20
  }, [o]), /* @__PURE__ */ n(
20
- a,
21
+ c,
21
22
  {
22
- className: v.menu,
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
- m,
30
+ a,
30
31
  {
31
32
  variant: e ? "filled-primary" : void 0,
32
33
  "data-testid": "openButton",
33
- icon: r === "vertical" ? "more_vert" : "more_horiz",
34
- onClick: u
34
+ icon: u === "vertical" ? "more_vert" : "more_horiz",
35
+ onClick: m
35
36
  }
36
37
  ),
37
- children: /* @__PURE__ */ n(d, { children: c.map((s) => /* @__PURE__ */ n(
38
+ children: /* @__PURE__ */ n(d, { children: r.map((i) => /* @__PURE__ */ n(
38
39
  f,
39
40
  {
40
- ...s,
41
+ ...i,
41
42
  leadingBlockType: "icon",
42
43
  "data-testid": "listItemButton",
43
44
  onClick: () => {
44
- s?.onClick?.(), l();
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 d } from "react/jsx-runtime";
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 m, d as C, t as B, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
5
- const T = m.fn(), l = m.fn(), i = m.fn(), p = [
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
- C("ContextMenu Test", () => {
11
- B("render ContextMenu and open it", () => {
12
- r(/* @__PURE__ */ d(u, { actions: p }));
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
- export declare const EmptyView: ({ title, subtitle, icon, }: {
1
+ import { ReactNode } from 'react';
2
+ type EmptyViewProps = {
2
3
  /**
3
- * the title of the empty view
4
+ * The title of the empty view, optional, default is empty string
4
5
  */
5
- title?: string | undefined;
6
+ title?: string;
6
7
  /**
7
- * the subtitle of the empty view
8
+ * The subtitle of the empty view, optional, default is empty string
8
9
  */
9
- subtitle?: string | undefined;
10
+ subtitle?: string;
10
11
  /**
11
- * the icon of the empty view
12
+ * The icon of the empty view, optional, default is 'dashbord'
12
13
  */
13
- icon?: string | undefined;
14
- }) => import("react/jsx-runtime").JSX.Element;
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 i, HeroContent as n, Icon as h } from "@element/react-components";
3
- const c = ({
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
- }) => /* @__PURE__ */ o(i, { style: { width: "100%", height: "25vh" }, children: /* @__PURE__ */ o(n, { logo: /* @__PURE__ */ o(h, { iconSize: "large", icon: t }), overline: "", subtitle: r, title: e }) });
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
- c as EmptyView
19
+ d as EmptyView
10
20
  };
@@ -1,19 +1,24 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { r as s, s as d } from "../../react.esm-C0LtovhP.js";
3
- import { EmptyView as n } from "./EmptyView.js";
4
- import { d as i, t as r, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
5
- i("EmptyView", () => {
6
- r("should render", () => {
7
- s(/* @__PURE__ */ o(n, {})), e(d.getByText("dashbord")).toBeInTheDocument();
8
- }), r("should render with custom icon", () => {
9
- s(/* @__PURE__ */ o(n, { icon: "add" })), e(d.getByText("add")).toBeInTheDocument();
10
- }), r("should render with title", () => {
11
- s(/* @__PURE__ */ o(n, { icon: "add", title: "TITLE" }));
12
- const t = d.getByText("TITLE");
13
- e(t).toBeInTheDocument(), e(t).toHaveClass(/headline2/);
14
- }), r("should render with subtitle", () => {
15
- s(/* @__PURE__ */ o(n, { icon: "add", subtitle: "SUB_TITLE" }));
16
- const t = d.getByText("SUB_TITLE");
17
- e(t).toBeInTheDocument(), e(t).toHaveClass(/headline6/);
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
  });
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.5409",
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>",