@situaction/traq-ui-ste 1.1.22 → 1.1.24
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.
|
@@ -50,7 +50,7 @@ export interface MenuProps {
|
|
|
50
50
|
/** Whether the menu should be open by default */
|
|
51
51
|
defaultOpen?: boolean;
|
|
52
52
|
/** ID of the menu item selected by default */
|
|
53
|
-
|
|
53
|
+
selectedId?: string;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Menu component renders a vertical navigation bar with collapsible state,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import { useState as c, useRef as M, useEffect as $ } from "react";
|
|
3
3
|
import { Button as b } from "../button/Button.js";
|
|
4
4
|
import '../../styles/Size.css';import '../../styles/index.css';import '../../styles/Menu.css';/* empty css */
|
|
5
5
|
import { IconButton as u } from "../icon-button/IconButton.js";
|
|
6
6
|
import { Icon as w } from "../icon/Icon.js";
|
|
7
|
-
import { Modal as
|
|
7
|
+
import { Modal as W } from "../modal/Modal.js";
|
|
8
8
|
import "../theme/ThemeContext.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
const
|
|
11
|
-
fullHeight:
|
|
12
|
-
fullWidth:
|
|
10
|
+
const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21", D = "_close_o2xi7_25", q = "_menuButton_o2xi7_29", A = "_closeIcon_o2xi7_37", F = "_label_o2xi7_42", G = "_textEllipsis_o2xi7_46", J = "_pointer_o2xi7_51", K = "_fullImg_o2xi7_54", Q = "_menuParams_o2xi7_60", T = "_line_o2xi7_66", U = "_borderRadiusM_o2xi7_73", X = "_menuItem_o2xi7_77", Y = "_flexVerticalBetweenStart_o2xi7_86", Z = "_flexHorizontalBetween_o2xi7_93", ee = "_flexVertical_o2xi7_86", oe = "_flexVerticalBetweenCenter_o2xi7_107", e = {
|
|
11
|
+
fullHeight: y,
|
|
12
|
+
fullWidth: O,
|
|
13
13
|
open: j,
|
|
14
14
|
close: D,
|
|
15
15
|
menuButton: q,
|
|
@@ -26,55 +26,55 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
|
|
|
26
26
|
flexHorizontalBetween: Z,
|
|
27
27
|
flexVertical: ee,
|
|
28
28
|
flexVerticalBetweenCenter: oe
|
|
29
|
-
}, fe = ({ menuItems: s = [], menuParams:
|
|
30
|
-
const [t, p] = c(N ?? !1), [g, B] = c(
|
|
29
|
+
}, fe = ({ menuItems: s = [], menuParams: d = [], shortLogo: m, logo: x, isOpen: h, defaultOpen: N = !1, selectedId: a }) => {
|
|
30
|
+
const [t, p] = c(N ?? !1), [g, B] = c(a ?? (s.length > 0 ? s[0].id : null)), V = M(null), [H, _] = c(!1), [I, C] = c(!1), [k, E] = c(null), [z, R] = c({}), L = M(null);
|
|
31
31
|
$(() => {
|
|
32
|
-
|
|
33
|
-
}, [
|
|
32
|
+
console.log("menu selectionné : ", a), a != null && B(a);
|
|
33
|
+
}, [a]);
|
|
34
34
|
const v = (o, i) => {
|
|
35
35
|
if (o.stopPropagation(), B(i), s) {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const n = s.find((r) => r.id === i);
|
|
37
|
+
n == null || n.onClick();
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, S = () => {
|
|
40
40
|
p(!t), _(!1);
|
|
41
|
-
},
|
|
41
|
+
}, P = (o) => {
|
|
42
42
|
var i;
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
E(
|
|
43
|
+
if (d) {
|
|
44
|
+
const n = d.find((r) => r.id === o);
|
|
45
|
+
if (!n) return;
|
|
46
|
+
if (n.content) {
|
|
47
|
+
const r = t ? "200px" : "40px";
|
|
48
|
+
E(n.content), R({ ...n.position, left: r }), C(!0);
|
|
49
49
|
} else
|
|
50
|
-
(i =
|
|
50
|
+
(i = n.onClick) == null || i.call(n);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
return $(() => {
|
|
54
54
|
h && h(t);
|
|
55
|
-
}, [t]), /* @__PURE__ */
|
|
55
|
+
}, [t]), /* @__PURE__ */ l("nav", { ref: V, children: /* @__PURE__ */ f("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${t ? e.open : e.close}`, children: [
|
|
56
56
|
/* @__PURE__ */ f("div", { className: e.fullWidth, children: [
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ l(
|
|
58
58
|
"div",
|
|
59
59
|
{
|
|
60
60
|
className: `${e.flexHorizontalBetween} ${e.pointer} ${e.textEllipsis}`,
|
|
61
|
-
onClick: () =>
|
|
61
|
+
onClick: () => S(),
|
|
62
62
|
children: t ? /* @__PURE__ */ f("div", { className: e.fullImg, children: [
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
] }) : /* @__PURE__ */
|
|
63
|
+
x && /* @__PURE__ */ l("img", { src: x, alt: "Logo situaction" }),
|
|
64
|
+
/* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
|
|
65
|
+
] }) : /* @__PURE__ */ l(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
68
|
className: e.closeIcon,
|
|
69
69
|
onMouseEnter: () => _(!0),
|
|
70
70
|
onMouseLeave: () => _(!1),
|
|
71
71
|
onClick: () => p(!t),
|
|
72
|
-
children:
|
|
72
|
+
children: H || !m ? /* @__PURE__ */ l(u, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(w, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ l("img", { src: m, alt: "Logo situaction" })
|
|
73
73
|
}
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ l("div", { className: e.menuItem, children: s && s.map((o) => t ? /* @__PURE__ */ l("div", { className: `${e.textEllipsis} ${e.menuButton}`, children: /* @__PURE__ */ l(
|
|
78
78
|
b,
|
|
79
79
|
{
|
|
80
80
|
mode: g === o.id ? "secondary" : "ghost",
|
|
@@ -82,7 +82,7 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
|
|
|
82
82
|
onClick: (i) => v(i, o.id),
|
|
83
83
|
childrenLeft: o.icon
|
|
84
84
|
}
|
|
85
|
-
) }, `button-${o.id}`) : /* @__PURE__ */
|
|
85
|
+
) }, `button-${o.id}`) : /* @__PURE__ */ l("div", { className: e.textEllipsis, children: /* @__PURE__ */ l(
|
|
86
86
|
u,
|
|
87
87
|
{
|
|
88
88
|
mode: g === o.id ? "secondary" : "ghost",
|
|
@@ -90,24 +90,24 @@ const O = "_fullHeight_o2xi7_15", S = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
|
|
|
90
90
|
onClick: (i) => v(i, o.id)
|
|
91
91
|
}
|
|
92
92
|
) }, `icon-${o.id}`)) }),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ l("div", { className: e.line })
|
|
94
94
|
] }),
|
|
95
95
|
/* @__PURE__ */ f("div", { className: `${e.menuParams} ${e.flexVerticalBetweenCenter}`, children: [
|
|
96
|
-
|
|
96
|
+
d && d.map((o) => /* @__PURE__ */ l(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
99
99
|
className: `${e.fullWidth} ${e.textEllipsis}`,
|
|
100
|
-
onClick: () =>
|
|
101
|
-
children: t ? /* @__PURE__ */
|
|
100
|
+
onClick: () => P(o.id),
|
|
101
|
+
children: t ? /* @__PURE__ */ l("div", { className: e.menuButton, children: /* @__PURE__ */ l(b, { mode: "ghost", label: o.label, childrenLeft: o.icon }, o.id) }) : /* @__PURE__ */ l(u, { mode: "ghost", children: o.icon })
|
|
102
102
|
},
|
|
103
103
|
`param-icon-${o.id}`
|
|
104
104
|
)),
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
105
|
+
/* @__PURE__ */ l(
|
|
106
|
+
W,
|
|
107
107
|
{
|
|
108
108
|
ref: L,
|
|
109
109
|
className: e.borderRadiusM,
|
|
110
|
-
open:
|
|
110
|
+
open: I,
|
|
111
111
|
onClose: () => C(!1),
|
|
112
112
|
position: z,
|
|
113
113
|
children: k
|