@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
|
-
.
|
|
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
|
|
2
|
-
import { I as
|
|
3
|
-
import { M as
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 [
|
|
22
|
-
|
|
23
|
-
}, []),
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
|
|
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":
|
|
35
|
-
open:
|
|
39
|
+
"data-testid": c ?? "contextMenu-undefined",
|
|
40
|
+
open: u,
|
|
36
41
|
surfaceOnly: !0,
|
|
37
42
|
hoistToBody: !0,
|
|
38
|
-
onClose:
|
|
39
|
-
trigger: /* @__PURE__ */
|
|
40
|
-
|
|
43
|
+
onClose: p,
|
|
44
|
+
trigger: /* @__PURE__ */ i(
|
|
45
|
+
k,
|
|
41
46
|
{
|
|
42
47
|
className: n.icon,
|
|
43
|
-
variant:
|
|
48
|
+
variant: u ? "filled-primary" : void 0,
|
|
44
49
|
"data-testid": "open-button",
|
|
45
|
-
icon:
|
|
46
|
-
onClick:
|
|
50
|
+
icon: a === "vertical" ? "more_vert" : "more_horiz",
|
|
51
|
+
onClick: h
|
|
47
52
|
}
|
|
48
53
|
),
|
|
49
|
-
children:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
...
|
|
72
|
+
...f
|
|
82
73
|
}
|
|
83
74
|
)
|
|
84
75
|
},
|
|
85
|
-
`contextMenu-${
|
|
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
|
-
|
|
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.
|
|
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>",
|