@situaction/traq-ui-ste 1.2.40 → 1.2.41
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.
|
@@ -55,6 +55,8 @@ export interface MenuProps {
|
|
|
55
55
|
defaultOpen?: boolean;
|
|
56
56
|
/** ID of the menu item selected by default */
|
|
57
57
|
selectedId?: string;
|
|
58
|
+
/** Layout mode: 'left' for vertical sidebar (default), 'bottom' for horizontal bottom bar */
|
|
59
|
+
mode?: 'left' | 'bottom';
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* Menu component renders a vertical navigation bar with collapsible state,
|
|
@@ -1,125 +1,153 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { IconButton as
|
|
1
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as r, useRef as w, useEffect as H } from "react";
|
|
3
|
+
import { Button as L } from "../button/Button.js";
|
|
4
|
+
import { IconButton as a } from "../icon-button/IconButton.js";
|
|
5
5
|
import "react-dom";
|
|
6
6
|
import "../accordion/Accordion.js";
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { Modal as
|
|
7
|
+
import { Icon as E } from "../icon/Icon.js";
|
|
8
|
+
import { Modal as R } from "../modal/Modal.js";
|
|
9
9
|
import "../carousel/Carousel.js";
|
|
10
10
|
import "../carousel/FadeCarousel.js";
|
|
11
11
|
import "../theme/ThemeContext.js";
|
|
12
12
|
import '../../styles/Size.css';import '../../styles/Menu.css';/* empty css */
|
|
13
|
-
const
|
|
14
|
-
fullHeight:
|
|
15
|
-
fullWidth:
|
|
16
|
-
open:
|
|
17
|
-
close:
|
|
18
|
-
menuButton:
|
|
19
|
-
closeIcon:
|
|
20
|
-
textEllipsis:
|
|
21
|
-
pointer:
|
|
22
|
-
fullImg:
|
|
23
|
-
menuParams:
|
|
24
|
-
line:
|
|
25
|
-
borderRadiusM:
|
|
26
|
-
menuItem:
|
|
27
|
-
longLogo:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
13
|
+
const O = "_fullHeight_rmd17_15", j = "_fullWidth_rmd17_18", D = "_open_rmd17_21", q = "_close_rmd17_25", A = "_menuButton_rmd17_29", F = "_closeIcon_rmd17_37", G = "_textEllipsis_rmd17_47", J = "_pointer_rmd17_52", K = "_fullImg_rmd17_55", Q = "_menuParams_rmd17_61", T = "_line_rmd17_67", U = "_borderRadiusM_rmd17_74", X = "_menuItem_rmd17_78", Y = "_longLogo_rmd17_87", Z = "_bottomNav_rmd17_92", ee = "_bottomInner_rmd17_101", oe = "_bottomItems_rmd17_109", ne = "_bottomParams_rmd17_117", te = "_flexVerticalBetweenStart_rmd17_126", le = "_flexHorizontalCenter_rmd17_140", se = "_flexVerticalBetweenCenter_rmd17_155", n = {
|
|
14
|
+
fullHeight: O,
|
|
15
|
+
fullWidth: j,
|
|
16
|
+
open: D,
|
|
17
|
+
close: q,
|
|
18
|
+
menuButton: A,
|
|
19
|
+
closeIcon: F,
|
|
20
|
+
textEllipsis: G,
|
|
21
|
+
pointer: J,
|
|
22
|
+
fullImg: K,
|
|
23
|
+
menuParams: Q,
|
|
24
|
+
line: T,
|
|
25
|
+
borderRadiusM: U,
|
|
26
|
+
menuItem: X,
|
|
27
|
+
longLogo: Y,
|
|
28
|
+
bottomNav: Z,
|
|
29
|
+
bottomInner: ee,
|
|
30
|
+
bottomItems: oe,
|
|
31
|
+
bottomParams: ne,
|
|
32
|
+
flexVerticalBetweenStart: te,
|
|
33
|
+
flexHorizontalCenter: le,
|
|
34
|
+
flexVerticalBetweenCenter: se
|
|
35
|
+
}, ge = ({ menuItems: i = [], menuParams: d = [], shortLogo: b, logo: g, isOpen: v, defaultOpen: z = !1, selectedId: f, mode: V = "left" }) => {
|
|
36
|
+
const [s, C] = r(z ?? !1), [_, x] = r(f ?? (i.length > 0 ? i[0].id : null)), N = w(null), [P, u] = r(!1), [I, h] = r(!1), [M, S] = r(null), [$, W] = r({}), B = w(null);
|
|
37
|
+
H(() => {
|
|
38
|
+
f != null && x(f);
|
|
39
|
+
}, [f]);
|
|
40
|
+
const p = (e, t) => {
|
|
41
|
+
if (e.stopPropagation(), x(t), i) {
|
|
42
|
+
const l = i.find((m) => m.id === t);
|
|
43
|
+
l == null || l.onClick();
|
|
40
44
|
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
var
|
|
45
|
+
}, y = () => {
|
|
46
|
+
C(!s), u(!1);
|
|
47
|
+
}, k = (e) => {
|
|
48
|
+
var t;
|
|
45
49
|
if (d) {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const l = d.find((m) => m.id === e);
|
|
51
|
+
if (!l) return;
|
|
52
|
+
if (l.content) {
|
|
53
|
+
const m = s ? "200px" : "40px";
|
|
54
|
+
S(l.content), W({ ...l.position, left: m }), h(!0);
|
|
51
55
|
} else
|
|
52
|
-
(
|
|
56
|
+
(t = l.onClick) == null || t.call(l);
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
59
|
+
return H(() => {
|
|
60
|
+
v && v(s);
|
|
61
|
+
}, [s]), V === "bottom" ? /* @__PURE__ */ o("nav", { ref: N, className: n.bottomNav, children: /* @__PURE__ */ c("div", { className: n.bottomInner, children: [
|
|
62
|
+
/* @__PURE__ */ o("div", { className: n.bottomItems, children: i && i.map((e) => /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
63
|
+
a,
|
|
64
|
+
{
|
|
65
|
+
mode: e.disabled ? "ghost" : _ === e.id ? "secondary" : "ghost",
|
|
66
|
+
children: e.icon,
|
|
67
|
+
disabled: e.disabled,
|
|
68
|
+
onClick: (t) => p(t, e.id)
|
|
69
|
+
}
|
|
70
|
+
) }, `icon-${e.id}`)) }),
|
|
71
|
+
/* @__PURE__ */ c("div", { className: n.bottomParams, children: [
|
|
72
|
+
d && d.map((e) => /* @__PURE__ */ o("div", { onClick: () => k(e.id), children: /* @__PURE__ */ o(a, { mode: "ghost", children: e.icon, disabled: e.disabled }) }, `param-icon-${e.id}`)),
|
|
73
|
+
/* @__PURE__ */ o(
|
|
74
|
+
R,
|
|
75
|
+
{
|
|
76
|
+
ref: B,
|
|
77
|
+
className: n.borderRadiusM,
|
|
78
|
+
open: I,
|
|
79
|
+
onClose: () => h(!1),
|
|
80
|
+
position: $,
|
|
81
|
+
children: M
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] })
|
|
85
|
+
] }) }) : /* @__PURE__ */ o("nav", { ref: N, children: /* @__PURE__ */ c("div", { className: `${n.flexVerticalBetweenStart} ${n.fullHeight} ${s ? n.open : n.close}`, children: [
|
|
86
|
+
/* @__PURE__ */ c("div", { className: n.fullWidth, children: [
|
|
87
|
+
/* @__PURE__ */ o(
|
|
60
88
|
"div",
|
|
61
89
|
{
|
|
62
|
-
className: `${
|
|
63
|
-
onClick: () =>
|
|
64
|
-
children:
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
] }) : /* @__PURE__ */
|
|
90
|
+
className: `${n.flexHorizontalCenter} ${n.pointer} ${n.textEllipsis}`,
|
|
91
|
+
onClick: () => y(),
|
|
92
|
+
children: s ? /* @__PURE__ */ c("div", { className: n.fullImg, children: [
|
|
93
|
+
g && /* @__PURE__ */ o("img", { className: n.longLogo, src: g, alt: "Logo situaction" }),
|
|
94
|
+
/* @__PURE__ */ o(a, { mode: "ghost", size: "menu", children: /* @__PURE__ */ o(E, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
|
|
95
|
+
] }) : /* @__PURE__ */ o(
|
|
68
96
|
"div",
|
|
69
97
|
{
|
|
70
|
-
className:
|
|
71
|
-
onMouseEnter: () =>
|
|
72
|
-
onMouseLeave: () =>
|
|
73
|
-
onClick: () =>
|
|
74
|
-
children:
|
|
98
|
+
className: n.closeIcon,
|
|
99
|
+
onMouseEnter: () => u(!0),
|
|
100
|
+
onMouseLeave: () => u(!1),
|
|
101
|
+
onClick: () => C(!s),
|
|
102
|
+
children: P || !b ? /* @__PURE__ */ o(a, { mode: "ghost", size: "menu", children: /* @__PURE__ */ o(E, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ o("img", { src: b, alt: "Logo situaction" })
|
|
75
103
|
}
|
|
76
104
|
)
|
|
77
105
|
}
|
|
78
106
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
107
|
+
/* @__PURE__ */ o("div", { className: n.menuItem, children: i && i.map((e) => s ? /* @__PURE__ */ o("div", { className: `${n.textEllipsis} ${n.menuButton}`, children: /* @__PURE__ */ o(
|
|
108
|
+
L,
|
|
81
109
|
{
|
|
82
|
-
mode: e.disabled ? "ghost" :
|
|
110
|
+
mode: e.disabled ? "ghost" : _ === e.id ? "secondary" : "ghost",
|
|
83
111
|
label: e.label,
|
|
84
112
|
disabled: e.disabled,
|
|
85
|
-
onClick: (
|
|
113
|
+
onClick: (t) => p(t, e.id),
|
|
86
114
|
childrenLeft: e.icon
|
|
87
115
|
}
|
|
88
|
-
) }, `button-${e.id}`) : /* @__PURE__ */
|
|
89
|
-
|
|
116
|
+
) }, `button-${e.id}`) : /* @__PURE__ */ o("div", { className: n.textEllipsis, children: /* @__PURE__ */ o(
|
|
117
|
+
a,
|
|
90
118
|
{
|
|
91
|
-
mode: e.disabled ? "ghost" :
|
|
119
|
+
mode: e.disabled ? "ghost" : _ === e.id ? "secondary" : "ghost",
|
|
92
120
|
children: e.icon,
|
|
93
121
|
disabled: e.disabled,
|
|
94
|
-
onClick: (
|
|
122
|
+
onClick: (t) => p(t, e.id)
|
|
95
123
|
}
|
|
96
124
|
) }, `icon-${e.id}`)) }),
|
|
97
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ o("div", { className: n.line })
|
|
98
126
|
] }),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
d && d.map((e) => /* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ c("div", { className: `${n.menuParams} ${n.flexVerticalBetweenCenter}`, children: [
|
|
128
|
+
d && d.map((e) => /* @__PURE__ */ o(
|
|
101
129
|
"div",
|
|
102
130
|
{
|
|
103
|
-
className: `${
|
|
104
|
-
onClick: () =>
|
|
105
|
-
children:
|
|
131
|
+
className: `${n.fullWidth} ${n.textEllipsis}`,
|
|
132
|
+
onClick: () => k(e.id),
|
|
133
|
+
children: s ? /* @__PURE__ */ o("div", { className: n.menuButton, children: /* @__PURE__ */ o(L, { mode: "ghost", label: e.label, disabled: e.disabled, childrenLeft: e.icon }, e.id) }) : /* @__PURE__ */ o(a, { mode: "ghost", children: e.icon, disabled: e.disabled })
|
|
106
134
|
},
|
|
107
135
|
`param-icon-${e.id}`
|
|
108
136
|
)),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
137
|
+
/* @__PURE__ */ o(
|
|
138
|
+
R,
|
|
111
139
|
{
|
|
112
|
-
ref:
|
|
113
|
-
className:
|
|
114
|
-
open:
|
|
115
|
-
onClose: () =>
|
|
116
|
-
position:
|
|
117
|
-
children:
|
|
140
|
+
ref: B,
|
|
141
|
+
className: n.borderRadiusM,
|
|
142
|
+
open: I,
|
|
143
|
+
onClose: () => h(!1),
|
|
144
|
+
position: $,
|
|
145
|
+
children: M
|
|
118
146
|
}
|
|
119
147
|
)
|
|
120
148
|
] })
|
|
121
149
|
] }) });
|
|
122
150
|
};
|
|
123
151
|
export {
|
|
124
|
-
|
|
152
|
+
ge as Menu
|
|
125
153
|
};
|
package/dist/styles/Menu.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nav{height:100vh;width:fit-content;padding:0 var(--spacing-xs-3) var(--spacing-xs-3);flex-shrink:1;transition:.3s;box-sizing:border-box;z-index:5}nav .
|
|
1
|
+
nav{height:100vh;width:fit-content;padding:0 var(--spacing-xs-3) var(--spacing-xs-3);flex-shrink:1;transition:.3s;box-sizing:border-box;z-index:5}nav ._fullHeight_rmd17_15{height:100%}nav ._fullWidth_rmd17_18{width:100%}nav ._open_rmd17_21{width:200px;transition:all ease .3s}nav ._close_rmd17_25{width:40px;transition:all ease-out .3s}nav ._menuButton_rmd17_29{width:100%}nav ._menuButton_rmd17_29 button{padding:var(--spacing-xs-4);width:inherit!important;justify-content:flex-start!important}nav ._closeIcon_rmd17_37{height:30px;cursor:pointer;margin:.875rem 0;padding:1px 0}nav ._label_rmd17_43{letter-spacing:.72px;font-weight:600}nav ._textEllipsis_rmd17_47{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}nav ._pointer_rmd17_52{cursor:pointer}nav ._fullImg_rmd17_55{margin:.875rem 0;display:flex;justify-content:space-between;width:100%}nav ._menuParams_rmd17_61{gap:.125rem;position:relative;width:100%}._line_rmd17_67{height:1px;width:100%;background-color:var(--general-border-window);margin:var(--spacing-xs-3) 0}._borderRadiusM_rmd17_74{border-radius:6px}._menuItem_rmd17_78{gap:.25rem;width:100%;display:flex;justify-content:flex-start;align-items:stretch;flex-direction:column}._longLogo_rmd17_87{transition:transform .25s ease,opacity .25s ease;will-change:transform,opacity}._bottomNav_rmd17_92{width:100%;height:fit-content;padding:var(--spacing-xs-3);box-sizing:border-box;z-index:5;flex-shrink:0}._bottomInner_rmd17_101{display:flex;justify-content:space-between;align-items:center;flex-direction:row;width:100%}._bottomItems_rmd17_109{display:flex;justify-content:flex-start;align-items:center;flex-direction:row;gap:var(--spacing-xs-6)}._bottomParams_rmd17_117{display:flex;justify-content:flex-end;align-items:center;flex-direction:row;gap:var(--spacing-xs-6);position:relative}._flexVerticalBetweenStart_rmd17_126{display:flex;justify-content:space-between;align-items:start;flex-direction:column}._flexHorizontalBetween_rmd17_133{display:flex;justify-content:space-between;align-items:center;flex-direction:row}._flexHorizontalCenter_rmd17_140{height:60px;display:flex;justify-content:center;align-items:center;flex-direction:row}._flexVertical_rmd17_126{display:flex;justify-content:flex-start;align-items:stretch;flex-direction:column}._flexVerticalBetweenCenter_rmd17_155{display:flex;justify-content:space-between;align-items:center;flex-direction:column}
|