@hortiview/shared-components 2.25.0 → 2.26.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.26.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.25.0...v2.26.0) (2026-05-11)
2
+
3
+ ### Features
4
+
5
+ * add truncation handling for primary text in ContextMenu and update styles and tests ([9ed40a5](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/9ed40a5e66e49bd42cfd94fd1213a60ebcf8c4a9))
6
+ * enhance ContextMenu with responsive styles and add story for long text handling ([c712489](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/c7124897ced3931f32e65b65c16654053417ae9d))
7
+
1
8
  ## [2.25.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.24.3...v2.25.0) (2026-05-07)
2
9
 
3
10
  ### Features
@@ -1 +1 @@
1
- ._menu_x6qd9_1{width:15.875rem;border-radius:.5rem!important}._icon_x6qd9_6{color:var(--lmnt-theme-on-secondary-inactive)}._listItem_x6qd9_10 [class*=mdc-list-item__start]{color:var(--lmnt-theme-on-secondary-inactive);align-self:center!important;margin:0 1rem!important}._listItem_x6qd9_10 [class*=mdc-list-item__end]{color:var(--lmnt-theme-on-secondary-inactive)}._offlineViewMargin_x6qd9_20{margin:.5rem}
1
+ ._menu_52omh_1{min-width:10rem;width:max-content;border-radius:.5rem!important}._mobile_52omh_7{max-width:12.5rem}._desktop_52omh_11{max-width:21.25rem}._icon_52omh_15{color:var(--lmnt-theme-on-secondary-inactive)}._listItem_52omh_19 [class*=mdc-list-item__primary-text],._listItem_52omh_19 [class*=mdc-list-item__secondary-text]{display:-webkit-box!important;-webkit-line-clamp:2!important;line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:normal!important}._listItem_52omh_19 [class*=mdc-list-item__start]{color:var(--lmnt-theme-on-secondary-inactive);align-self:center!important;margin:0 1rem!important}._listItem_52omh_19 [class*=mdc-list-item__end]{color:var(--lmnt-theme-on-secondary-inactive)}._offlineViewMargin_52omh_51{margin:.5rem}._primaryTextTruncated_52omh_55 [class*=mdc-list-item__secondary-text]{padding-top:1rem!important}
@@ -1,90 +1,120 @@
1
- import { jsx as t, jsxs as I } from "react/jsx-runtime";
2
- import { I as A } from "../../index.es-CkB4776y.js";
3
- import { M as h, L as k, a as c, b as y } from "../../index.es-Cg57snrN.js";
4
- import { useState as q, useCallback as m, useEffect as L, useMemo as V, Fragment as B } from "react";
5
- import { u as N } from "../../uniqueId-CJo-XRQb.js";
6
- import { OfflineView as b } from "../OfflineView/OfflineView.js";
7
- import { useIsAllowed as $ } from "../PermissionChecks/PermissionService.js";
8
- import '../../assets/ContextMenu.css';const j = "_menu_x6qd9_1", z = "_icon_x6qd9_6", H = "_listItem_x6qd9_10", O = "_offlineViewMargin_x6qd9_20", n = {
9
- menu: j,
10
- icon: z,
11
- listItem: H,
12
- offlineViewMargin: O
13
- }, U = ({
14
- triggerOpen: s = null,
15
- actions: r,
16
- iconOrientation: _ = "vertical",
17
- "data-testid": a,
18
- isOnline: p = !0,
19
- offlineViewProps: M
1
+ import { jsx as i, jsxs as M } from "react/jsx-runtime";
2
+ import { I as k } from "../../index.es-CkB4776y.js";
3
+ import { M as v, L as w, a as x, b as C } from "../../index.es-Cg57snrN.js";
4
+ import { useState as g, useCallback as T, useEffect as I, useMemo as b, Fragment as A, useRef as L, useLayoutEffect as B } from "react";
5
+ import { c as V } from "../../index-Df2FYN-K.js";
6
+ import { u as z } from "../../uniqueId-CJo-XRQb.js";
7
+ import { OfflineView as H } from "../OfflineView/OfflineView.js";
8
+ import { useIsAllowed as N } from "../PermissionChecks/PermissionService.js";
9
+ import { useBreakpoints as O } from "../../hooks/useBreakpoints.js";
10
+ import '../../assets/ContextMenu.css';const E = "_menu_52omh_1", R = "_mobile_52omh_7", S = "_desktop_52omh_11", $ = "_icon_52omh_15", j = "_listItem_52omh_19", q = "_offlineViewMargin_52omh_51", D = "_primaryTextTruncated_52omh_55", n = {
11
+ menu: E,
12
+ mobile: R,
13
+ desktop: S,
14
+ icon: $,
15
+ listItem: j,
16
+ offlineViewMargin: q,
17
+ primaryTextTruncated: D
18
+ }, P = ({
19
+ triggerOpen: t = null,
20
+ actions: l,
21
+ iconOrientation: a = "vertical",
22
+ "data-testid": c,
23
+ isOnline: m = !0,
24
+ offlineViewProps: f
20
25
  }) => {
21
- const [f, i] = q(!1), u = $(), d = m(() => {
22
- i(!1);
23
- }, []), g = m(() => {
24
- i((e) => !e);
26
+ const { isMobile: d } = O(), [u, o] = g(!1), _ = N(), p = T(() => {
27
+ o(!1);
28
+ }, []), h = T(() => {
29
+ o((e) => !e);
25
30
  }, []);
26
- L(() => {
27
- i(s !== null ? s : !1);
28
- }, [s]);
29
- const o = V(() => r.filter((e) => e.isHidden || e.isAllowed === !1 ? !1 : !(e.permissionConfiguration && !u(e.permissionConfiguration))), [r, u]);
30
- return o.length === 0 ? null : /* @__PURE__ */ t(
31
- h,
31
+ I(() => {
32
+ o(t !== null ? t : !1);
33
+ }, [t]);
34
+ const r = b(() => l.filter((e) => e.isHidden || e.isAllowed === !1 ? !1 : !(e.permissionConfiguration && !_(e.permissionConfiguration))), [l, _]);
35
+ return r.length === 0 ? null : /* @__PURE__ */ i(
36
+ v,
32
37
  {
33
38
  className: n.menu,
34
- "data-testid": a ?? "contextMenu-undefined",
35
- open: f,
39
+ "data-testid": c ?? "contextMenu-undefined",
40
+ open: u,
36
41
  surfaceOnly: !0,
37
42
  hoistToBody: !0,
38
- onClose: d,
39
- trigger: /* @__PURE__ */ t(
40
- A,
43
+ onClose: p,
44
+ trigger: /* @__PURE__ */ i(
45
+ k,
41
46
  {
42
47
  className: n.icon,
43
- variant: f ? "filled-primary" : void 0,
48
+ variant: u ? "filled-primary" : void 0,
44
49
  "data-testid": "open-button",
45
- icon: _ === "vertical" ? "more_vert" : "more_horiz",
46
- onClick: g
50
+ icon: a === "vertical" ? "more_vert" : "more_horiz",
51
+ onClick: h
47
52
  }
48
53
  ),
49
- children: p ? /* @__PURE__ */ t(k, { "data-testid": "selection-list", children: o.map((e, l) => {
50
- const {
51
- closeOnClick: w,
52
- dividerBefore: x,
53
- dividerAfter: C,
54
- permissionConfiguration: S,
55
- isAllowed: T,
56
- isHidden: D,
57
- ...v
58
- } = e;
59
- return /* @__PURE__ */ I(B, { children: [
60
- x && l !== 0 && /* @__PURE__ */ t(c, {}),
61
- /* @__PURE__ */ t(
62
- y,
63
- {
64
- className: n.listItem,
65
- ...v,
66
- leadingBlockType: "icon",
67
- "data-testid": e["data-testid"] ?? `contextMenu-action-${l}`,
68
- onClick: () => {
69
- e?.onClick?.(), w !== !1 && d();
70
- }
71
- }
72
- ),
73
- C && l !== o.length - 1 && /* @__PURE__ */ t(c, {})
74
- ] }, N(`LI_${e.primaryText?.toString()}_`));
75
- }) }) : /* @__PURE__ */ t(
76
- b,
54
+ children: m ? /* @__PURE__ */ i(w, { "data-testid": "selection-list", children: r.map((e, s) => /* @__PURE__ */ M(A, { children: [
55
+ e.dividerBefore && s !== 0 && /* @__PURE__ */ i(x, {}),
56
+ /* @__PURE__ */ i(
57
+ F,
58
+ {
59
+ actionProps: e,
60
+ index: s,
61
+ isMobile: d,
62
+ closeMenu: p
63
+ }
64
+ ),
65
+ e.dividerAfter && s !== r.length - 1 && /* @__PURE__ */ i(x, {})
66
+ ] }, z(`LI_${e.primaryText?.toString()}_`))) }) : /* @__PURE__ */ i(
67
+ H,
77
68
  {
78
69
  size: "small",
79
70
  variant: "filled",
80
71
  className: n.offlineViewMargin,
81
- ...M
72
+ ...f
82
73
  }
83
74
  )
84
75
  },
85
- `contextMenu-${a ?? "undefined"}`
76
+ `contextMenu-${c ?? "undefined"}`
77
+ );
78
+ }, F = ({
79
+ actionProps: t,
80
+ index: l,
81
+ isMobile: a,
82
+ closeMenu: c
83
+ }) => {
84
+ const m = L(null), [f, d] = g(!1), { closeOnClick: u, permissionConfiguration: o, isAllowed: _, isHidden: p, ...h } = t;
85
+ return B(() => {
86
+ const r = m.current;
87
+ if (!r) return;
88
+ const e = r.querySelector(
89
+ "[class*='mdc-list-item__primary-text']"
90
+ );
91
+ if (!e) return;
92
+ const s = () => {
93
+ d(e.scrollHeight > e.clientHeight);
94
+ };
95
+ s();
96
+ const y = new ResizeObserver(s);
97
+ return y.observe(e), () => {
98
+ y.disconnect();
99
+ };
100
+ }, [t.primaryText, a]), /* @__PURE__ */ i(
101
+ C,
102
+ {
103
+ ref: m,
104
+ "data-testid": t["data-testid"] ?? `contextMenu-action-${l}`,
105
+ className: V(
106
+ n.listItem,
107
+ f && n.primaryTextTruncated,
108
+ a ? n.mobile : n.desktop
109
+ ),
110
+ ...h,
111
+ leadingBlockType: "icon",
112
+ onClick: () => {
113
+ t?.onClick?.(), u !== !1 && c();
114
+ }
115
+ }
86
116
  );
87
117
  };
88
118
  export {
89
- U as ContextMenu
119
+ P as ContextMenu
90
120
  };
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": "2.25.0",
4
+ "version": "2.26.0",
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>",