@hortiview/shared-components 0.0.8519 → 0.0.8611

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 +1 @@
1
- ._menu_1jlla_1{width:15.875rem}._icon_1jlla_5{color:var(--lmnt-theme-on-secondary-inactive)}
1
+ ._menu_ol91v_1{width:15.875rem}._icon_ol91v_5{color:var(--lmnt-theme-on-secondary-inactive)}._listItem_ol91v_9 [class*=mdc-list-item__start]{color:var(--lmnt-theme-on-secondary-inactive);align-self:center!important;margin:0 1rem!important}._listItem_ol91v_9 [class*=mdc-list-item__end]{color:var(--lmnt-theme-on-secondary-inactive)}
@@ -6,15 +6,18 @@ type ContextMenuProps = {
6
6
  triggerOpen?: boolean | null;
7
7
  /**
8
8
  * List of actions to display in the context menu as ListItems
9
- * @see ListItemProps
9
+ * @see ActionProps
10
10
  */
11
- actions: ListItemProps[];
11
+ actions: ActionProps[];
12
12
  /**
13
13
  * Determines if menu icon should be vertical or horizontal three dots
14
14
  * Default is 'vertical'
15
15
  */
16
16
  iconOrientation?: 'vertical' | 'horizontal';
17
17
  };
18
+ export type ActionProps = ListItemProps & {
19
+ closeOnClick?: boolean;
20
+ };
18
21
  /**
19
22
  *
20
23
  * @param {boolean} triggerOpen indicates if the menu should be open
@@ -1,50 +1,51 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { Menu as u, IconButton as d, List as f, ListItem as p } from "@element/react-components";
3
- import { useState as y, useCallback as l, useEffect as C } from "react";
4
- import { uniqueId as k } from "lodash";
5
- import { s as r } from "../../contextMenu.module-DNQ8d9Aj.js";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { Menu as u, IconButton as f, List as d, ListItem as p } from "@element/react-components";
3
+ import { useState as C, useCallback as r, useEffect as k } from "react";
4
+ import { uniqueId as y } from "lodash";
5
+ import { s } from "../../contextMenu.module-vNQHb48g.js";
6
6
  const M = ({
7
- triggerOpen: n = null,
7
+ triggerOpen: l = null,
8
8
  actions: a,
9
9
  iconOrientation: c = "vertical"
10
10
  }) => {
11
- const [e, t] = y(!1), m = l(() => {
11
+ const [e, t] = C(!1), m = r(() => {
12
12
  t(!e);
13
- }, [e]), s = l(() => {
13
+ }, [e]), i = r(() => {
14
14
  t(!1);
15
15
  }, []);
16
- return C(() => {
17
- t(n !== null ? n : !1);
18
- }, [n]), /* @__PURE__ */ o(
16
+ return k(() => {
17
+ t(l !== null ? l : !1);
18
+ }, [l]), /* @__PURE__ */ n(
19
19
  u,
20
20
  {
21
- className: r.menu,
21
+ className: s.menu,
22
22
  "data-testid": "selectionmenu",
23
23
  open: e,
24
24
  surfaceOnly: !0,
25
25
  hoistToBody: !0,
26
- onClose: s,
27
- trigger: /* @__PURE__ */ o(
28
- d,
26
+ onClose: i,
27
+ trigger: /* @__PURE__ */ n(
28
+ f,
29
29
  {
30
- className: r.icon,
30
+ className: s.icon,
31
31
  variant: e ? "filled-primary" : void 0,
32
32
  "data-testid": "openButton",
33
33
  icon: c === "vertical" ? "more_vert" : "more_horiz",
34
34
  onClick: m
35
35
  }
36
36
  ),
37
- children: /* @__PURE__ */ o(f, { children: a.map((i) => /* @__PURE__ */ o(
37
+ children: /* @__PURE__ */ n(d, { children: a.map((o) => /* @__PURE__ */ n(
38
38
  p,
39
39
  {
40
- ...i,
40
+ className: s.listItem,
41
+ ...o,
41
42
  leadingBlockType: "icon",
42
43
  "data-testid": "listItemButton",
43
44
  onClick: () => {
44
- i?.onClick?.(), s();
45
+ o?.onClick?.(), o.closeOnClick !== !1 && i();
45
46
  }
46
47
  },
47
- k(`LI_${i.primaryText?.toString()}_`)
48
+ y(`LI_${o.primaryText?.toString()}_`)
48
49
  )) })
49
50
  },
50
51
  "selectionmenu"
@@ -19,7 +19,7 @@ import "../../baseView.module-uWbm_a5f.js";
19
19
  import "../../BlockView.module-BPlNT5uh.js";
20
20
  import "../../chipCard.module-BjpKuf1b.js";
21
21
  import "lodash";
22
- import "../../contextMenu.module-DNQ8d9Aj.js";
22
+ import "../../contextMenu.module-vNQHb48g.js";
23
23
  import { Modal as K } from "../Modal/Modal.js";
24
24
  import "../../deleteModal.module-Ds3MDzdl.js";
25
25
  import "../../disclaimer.module-BZydt-Q_.js";
@@ -1,90 +1,93 @@
1
- import { jsx as n, jsxs as Y } from "react/jsx-runtime";
2
- import { Datepicker as b, Divider as j, Padding as H, Button as M } from "@element/react-components";
3
- import { g as Q } from "../../../get-UxX31Aph.js";
4
- import { useMemo as s, useState as $ } from "react";
5
- import { useFormContext as w, Controller as B } from "react-hook-form";
1
+ import { jsx as o, jsxs as Y } from "react/jsx-runtime";
2
+ import { Datepicker as w, Divider as M, Padding as U, Button as b } from "@element/react-components";
3
+ import { g as j } from "../../../get-UxX31Aph.js";
4
+ import { useMemo as s, useState as H } from "react";
5
+ import { useFormContext as I, Controller as Q } from "react-hook-form";
6
6
  import { s as l } from "../../../formDatePicker.module-BV3ma_7y.js";
7
- const G = ({
7
+ const $ = (t) => {
8
+ const a = new Date(t), u = a.getUTCDate(), f = a.getUTCMonth(), d = a.getUTCFullYear();
9
+ return new Date(d, f, u);
10
+ }, G = ({
8
11
  propertyName: t,
9
- label: k,
10
- closeLabel: p,
11
- className: P,
12
- minRangeYear: m,
13
- maxRangeYear: f,
14
- locale: D,
15
- rules: o,
16
- ...S
12
+ label: a,
13
+ closeLabel: u,
14
+ className: f,
15
+ minRangeYear: d,
16
+ maxRangeYear: g,
17
+ locale: h,
18
+ rules: i,
19
+ ...k
17
20
  }) => {
18
21
  const {
19
- control: h,
20
- formState: { errors: r, isValidating: u }
21
- } = w(), g = s(
22
- () => o?.required?.value,
23
- [o]
24
- ), x = s(
25
- () => o?.required?.message,
26
- [o]
27
- ), C = s(
28
- () => (/* @__PURE__ */ new Date()).getFullYear() - (m ?? 95),
29
- [m]
30
- ), v = s(
31
- () => (/* @__PURE__ */ new Date()).getFullYear() + (f ?? 15),
32
- [f]
33
- ), c = s(
34
- () => !u && Q(r, t) !== void 0,
35
- [r, t, u]
36
- ), T = s(() => ({
37
- valid: !c,
38
- helperTextPersistent: c || g,
22
+ control: p,
23
+ formState: { errors: r, isValidating: x }
24
+ } = I(), C = s(
25
+ () => i?.required?.value,
26
+ [i]
27
+ ), S = s(
28
+ () => i?.required?.message,
29
+ [i]
30
+ ), P = s(
31
+ () => (/* @__PURE__ */ new Date()).getFullYear() - (d ?? 95),
32
+ [d]
33
+ ), T = s(
34
+ () => (/* @__PURE__ */ new Date()).getFullYear() + (g ?? 15),
35
+ [g]
36
+ ), m = s(
37
+ () => !x && j(r, t) !== void 0,
38
+ [r, t, x]
39
+ ), v = s(() => ({
40
+ valid: !m,
41
+ helperTextPersistent: m || C,
39
42
  helperText: (() => {
40
43
  if (r && r[t]) {
41
- const i = r[t]?.message;
42
- return i || "Invalid input";
44
+ const n = r[t]?.message;
45
+ return n || "Invalid input";
43
46
  }
44
- return x;
47
+ return S;
45
48
  })(),
46
- className: `${l.fromPickerText} ${c ? l.invalid : ""}`
47
- }), [r, x, t, g, c]), [q, d] = $(!1);
48
- return /* @__PURE__ */ n(
49
- B,
49
+ className: `${l.fromPickerText} ${m ? l.invalid : ""}`
50
+ }), [r, S, t, C, m]), [F, D] = H(!1);
51
+ return /* @__PURE__ */ o(
52
+ Q,
50
53
  {
51
54
  name: t,
52
- rules: o,
53
- control: h,
54
- render: ({ field: { ref: F, onChange: i, value: a, ...O } }) => /* @__PURE__ */ n("div", { className: l.datePickerContainer, children: /* @__PURE__ */ n(
55
- b,
55
+ rules: i,
56
+ control: p,
57
+ render: ({ field: { ref: q, onChange: n, value: c, ...O } }) => /* @__PURE__ */ o("div", { className: l.datePickerContainer, children: /* @__PURE__ */ o(
58
+ w,
56
59
  {
57
- ...S,
60
+ ...k,
58
61
  ...O,
59
- className: P ?? "",
60
- value: a,
62
+ className: f ?? "",
63
+ value: c,
61
64
  variant: "outlined",
62
- label: k,
63
- format: (e) => e ? e.toLocaleDateString(D ?? "en") : "",
65
+ label: a,
66
+ format: (e) => e ? $(e.toISOString()).toLocaleDateString(h ?? "en") : "",
64
67
  disableClearing: !0,
65
68
  trailingContent: /* @__PURE__ */ Y("div", { className: l.trailingContent, children: [
66
- /* @__PURE__ */ n(j, {}),
67
- /* @__PURE__ */ n(H, { variant: "dense", children: /* @__PURE__ */ n(M, { label: p, variant: "text", onClick: () => d(!1) }) })
69
+ /* @__PURE__ */ o(M, {}),
70
+ /* @__PURE__ */ o(U, { variant: "dense", children: /* @__PURE__ */ o(b, { label: u, variant: "text", onClick: () => D(!1) }) })
68
71
  ] }),
69
72
  onClick: () => {
70
- d(!0);
73
+ D(!0);
71
74
  },
72
75
  onSelect: (e) => {
73
- i(e), d(!1);
76
+ n(e), D(!1);
74
77
  },
75
78
  onSelectMonth: (e) => {
76
- a && (e.setDate(a.getDate()), i(e));
79
+ c && (e.setDate(c.getDate()), n(e));
77
80
  },
78
81
  onSelectYear: (e) => {
79
- a && (e.setDate(a.getDate()), i(e));
82
+ c && (e.setDate(c.getDate()), n(e));
80
83
  },
81
84
  hoisted: !0,
82
85
  calendarProps: { hoisted: !0, className: l.datePickerCalendar },
83
- minQuickSelectYear: C,
84
- maxQuickSelectYear: v,
86
+ minQuickSelectYear: P,
87
+ maxQuickSelectYear: T,
85
88
  readOnly: !0,
86
- textfieldProps: T,
87
- alwaysOpen: q
89
+ textfieldProps: v,
90
+ alwaysOpen: F
88
91
  }
89
92
  ) })
90
93
  }
@@ -18,7 +18,7 @@ import "../../baseView.module-uWbm_a5f.js";
18
18
  import "../../BlockView.module-BPlNT5uh.js";
19
19
  import "../../chipCard.module-BjpKuf1b.js";
20
20
  import "lodash";
21
- import "../../contextMenu.module-DNQ8d9Aj.js";
21
+ import "../../contextMenu.module-vNQHb48g.js";
22
22
  import "../../modal.module-BlDp1Wiq.js";
23
23
  import "../../deleteModal.module-Ds3MDzdl.js";
24
24
  import "../../disclaimer.module-BZydt-Q_.js";
@@ -0,0 +1,9 @@
1
+ import "./assets/contextMenu.css";
2
+ const t = "_menu_ol91v_1", o = "_icon_ol91v_5", s = "_listItem_ol91v_9", _ = {
3
+ menu: t,
4
+ icon: o,
5
+ listItem: s
6
+ };
7
+ export {
8
+ _ as s
9
+ };
package/dist/main.d.ts CHANGED
@@ -30,6 +30,7 @@ export { AvailableCustomIcons } from './enums/AvailableCustomIcons';
30
30
  export { ThemeColor } from './enums/ThemeColor';
31
31
  export { useBreakpoints } from './hooks/useBreakpoints';
32
32
  export { capitalizeFirstLetters } from './services/UtilService';
33
+ export type { ActionProps } from './components/ContextMenu/ContextMenu';
33
34
  export type { FormSelectOption } from './components/FormComponents/FormSelect/FormSelect';
34
35
  export type { FormTextProps } from './components/FormComponents/FormText/FormText';
35
36
  export type { FieldItem } from './components/InfoGroup/InfoGroup';
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.8519",
4
+ "version": "0.0.8611",
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>",
@@ -1,8 +0,0 @@
1
- import "./assets/contextMenu.css";
2
- const n = "_menu_1jlla_1", o = "_icon_1jlla_5", c = {
3
- menu: n,
4
- icon: o
5
- };
6
- export {
7
- c as s
8
- };