@situaction/traq-ui-ste 1.2.9 → 1.2.10
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/dist/components/menu/Menu.js +59 -57
- package/dist/styles/Menu.css +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as c, useRef as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { IconButton as
|
|
5
|
-
import { Icon as
|
|
1
|
+
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useRef as v, useEffect as M } from "react";
|
|
3
|
+
import { Button as $ } from "../button/Button.js";
|
|
4
|
+
import { IconButton as f } from "../icon-button/IconButton.js";
|
|
5
|
+
import { Icon as N } from "../icon/Icon.js";
|
|
6
6
|
import { Modal as W } from "../modal/Modal.js";
|
|
7
7
|
import "../theme/ThemeContext.js";
|
|
8
8
|
import '../../styles/Size.css';import '../../styles/Menu.css';/* empty css */
|
|
9
|
-
const y = "
|
|
9
|
+
const y = "_fullHeight_11eub_15", O = "_fullWidth_11eub_18", j = "_open_11eub_21", D = "_close_11eub_25", q = "_menuButton_11eub_29", A = "_closeIcon_11eub_37", F = "_label_11eub_43", G = "_textEllipsis_11eub_47", J = "_pointer_11eub_52", K = "_fullImg_11eub_55", Q = "_menuParams_11eub_61", T = "_line_11eub_67", U = "_borderRadiusM_11eub_74", X = "_menuItem_11eub_78", Y = "_longLogo_11eub_87", Z = "_flexVerticalBetweenStart_11eub_92", ee = "_flexHorizontalBetween_11eub_99", le = "_flexHorizontalCenter_11eub_106", oe = "_flexVertical_11eub_92", ne = "_flexVerticalBetweenCenter_11eub_121", e = {
|
|
10
10
|
fullHeight: y,
|
|
11
11
|
fullWidth: O,
|
|
12
12
|
open: j,
|
|
@@ -21,100 +21,102 @@ const y = "_fullHeight_o2xi7_15", O = "_fullWidth_o2xi7_18", j = "_open_o2xi7_21
|
|
|
21
21
|
line: T,
|
|
22
22
|
borderRadiusM: U,
|
|
23
23
|
menuItem: X,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
longLogo: Y,
|
|
25
|
+
flexVerticalBetweenStart: Z,
|
|
26
|
+
flexHorizontalBetween: ee,
|
|
27
|
+
flexHorizontalCenter: le,
|
|
28
|
+
flexVertical: oe,
|
|
29
|
+
flexVerticalBetweenCenter: ne
|
|
30
|
+
}, fe = ({ menuItems: s = [], menuParams: r = [], shortLogo: m, logo: h, isOpen: p, defaultOpen: w = !1, selectedId: u }) => {
|
|
31
|
+
const [t, b] = c(w ?? !1), [x, g] = c(u ?? (s.length > 0 ? s[0].id : null)), H = v(null), [z, _] = c(!1), [I, C] = c(!1), [V, L] = c(null), [k, E] = c({}), R = v(null);
|
|
32
|
+
M(() => {
|
|
33
|
+
u != null && g(u);
|
|
34
|
+
}, [u]);
|
|
35
|
+
const B = (l, i) => {
|
|
36
|
+
if (l.stopPropagation(), g(i), s) {
|
|
35
37
|
const n = s.find((a) => a.id === i);
|
|
36
38
|
n == null || n.onClick();
|
|
37
39
|
}
|
|
38
40
|
}, S = () => {
|
|
39
|
-
|
|
40
|
-
}, P = (
|
|
41
|
+
b(!t), _(!1);
|
|
42
|
+
}, P = (l) => {
|
|
41
43
|
var i;
|
|
42
44
|
if (r) {
|
|
43
|
-
const n = r.find((a) => a.id ===
|
|
45
|
+
const n = r.find((a) => a.id === l);
|
|
44
46
|
if (!n) return;
|
|
45
47
|
if (n.content) {
|
|
46
48
|
const a = t ? "200px" : "40px";
|
|
47
|
-
|
|
49
|
+
L(n.content), E({ ...n.position, left: a }), C(!0);
|
|
48
50
|
} else
|
|
49
51
|
(i = n.onClick) == null || i.call(n);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
}, [t]), /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
54
|
+
return M(() => {
|
|
55
|
+
p && p(t);
|
|
56
|
+
}, [t]), /* @__PURE__ */ o("nav", { ref: H, children: /* @__PURE__ */ d("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${t ? e.open : e.close}`, children: [
|
|
57
|
+
/* @__PURE__ */ d("div", { className: e.fullWidth, children: [
|
|
58
|
+
/* @__PURE__ */ o(
|
|
57
59
|
"div",
|
|
58
60
|
{
|
|
59
|
-
className: `${e.
|
|
61
|
+
className: `${e.flexHorizontalCenter} ${e.pointer} ${e.textEllipsis}`,
|
|
60
62
|
onClick: () => S(),
|
|
61
|
-
children: t ? /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
] }) : /* @__PURE__ */
|
|
63
|
+
children: t ? /* @__PURE__ */ d("div", { className: e.fullImg, children: [
|
|
64
|
+
h && /* @__PURE__ */ o("img", { className: e.longLogo, src: h, alt: "Logo situaction" }),
|
|
65
|
+
/* @__PURE__ */ o(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ o(N, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
|
|
66
|
+
] }) : /* @__PURE__ */ o(
|
|
65
67
|
"div",
|
|
66
68
|
{
|
|
67
69
|
className: e.closeIcon,
|
|
68
70
|
onMouseEnter: () => _(!0),
|
|
69
71
|
onMouseLeave: () => _(!1),
|
|
70
|
-
onClick: () =>
|
|
71
|
-
children:
|
|
72
|
+
onClick: () => b(!t),
|
|
73
|
+
children: z || !m ? /* @__PURE__ */ o(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ o(N, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ o("img", { src: m, alt: "Logo situaction" })
|
|
72
74
|
}
|
|
73
75
|
)
|
|
74
76
|
}
|
|
75
77
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
78
|
+
/* @__PURE__ */ o("div", { className: e.menuItem, children: s && s.map((l) => t ? /* @__PURE__ */ o("div", { className: `${e.textEllipsis} ${e.menuButton}`, children: /* @__PURE__ */ o(
|
|
79
|
+
$,
|
|
78
80
|
{
|
|
79
|
-
mode:
|
|
80
|
-
label:
|
|
81
|
-
onClick: (i) =>
|
|
82
|
-
childrenLeft:
|
|
81
|
+
mode: x === l.id ? "secondary" : "ghost",
|
|
82
|
+
label: l.label,
|
|
83
|
+
onClick: (i) => B(i, l.id),
|
|
84
|
+
childrenLeft: l.icon
|
|
83
85
|
}
|
|
84
|
-
) }, `button-${
|
|
85
|
-
|
|
86
|
+
) }, `button-${l.id}`) : /* @__PURE__ */ o("div", { className: e.textEllipsis, children: /* @__PURE__ */ o(
|
|
87
|
+
f,
|
|
86
88
|
{
|
|
87
|
-
mode:
|
|
88
|
-
children:
|
|
89
|
-
onClick: (i) =>
|
|
89
|
+
mode: x === l.id ? "secondary" : "ghost",
|
|
90
|
+
children: l.icon,
|
|
91
|
+
onClick: (i) => B(i, l.id)
|
|
90
92
|
}
|
|
91
|
-
) }, `icon-${
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
+
) }, `icon-${l.id}`)) }),
|
|
94
|
+
/* @__PURE__ */ o("div", { className: e.line })
|
|
93
95
|
] }),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
r && r.map((
|
|
96
|
+
/* @__PURE__ */ d("div", { className: `${e.menuParams} ${e.flexVerticalBetweenCenter}`, children: [
|
|
97
|
+
r && r.map((l) => /* @__PURE__ */ o(
|
|
96
98
|
"div",
|
|
97
99
|
{
|
|
98
100
|
className: `${e.fullWidth} ${e.textEllipsis}`,
|
|
99
|
-
onClick: () => P(
|
|
100
|
-
children: t ? /* @__PURE__ */
|
|
101
|
+
onClick: () => P(l.id),
|
|
102
|
+
children: t ? /* @__PURE__ */ o("div", { className: e.menuButton, children: /* @__PURE__ */ o($, { mode: "ghost", label: l.label, childrenLeft: l.icon }, l.id) }) : /* @__PURE__ */ o(f, { mode: "ghost", children: l.icon })
|
|
101
103
|
},
|
|
102
|
-
`param-icon-${
|
|
104
|
+
`param-icon-${l.id}`
|
|
103
105
|
)),
|
|
104
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ o(
|
|
105
107
|
W,
|
|
106
108
|
{
|
|
107
|
-
ref:
|
|
109
|
+
ref: R,
|
|
108
110
|
className: e.borderRadiusM,
|
|
109
|
-
open:
|
|
111
|
+
open: I,
|
|
110
112
|
onClose: () => C(!1),
|
|
111
|
-
position:
|
|
112
|
-
children:
|
|
113
|
+
position: k,
|
|
114
|
+
children: V
|
|
113
115
|
}
|
|
114
116
|
)
|
|
115
117
|
] })
|
|
116
118
|
] }) });
|
|
117
119
|
};
|
|
118
120
|
export {
|
|
119
|
-
|
|
121
|
+
fe as Menu
|
|
120
122
|
};
|
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_11eub_15{height:100%}nav ._fullWidth_11eub_18{width:100%}nav ._open_11eub_21{width:200px;transition:all ease .3s}nav ._close_11eub_25{width:40px;transition:all ease-out .3s}nav ._menuButton_11eub_29{width:100%}nav ._menuButton_11eub_29 button{padding:var(--spacing-xs-4);width:inherit!important;justify-content:flex-start!important}nav ._closeIcon_11eub_37{height:30px;cursor:pointer;margin:.875rem 0;padding:1px 0}nav ._label_11eub_43{letter-spacing:.72px;font-weight:600}nav ._textEllipsis_11eub_47{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}nav ._pointer_11eub_52{cursor:pointer}nav ._fullImg_11eub_55{margin:.875rem 0;display:flex;justify-content:space-between;width:100%}nav ._menuParams_11eub_61{gap:.125rem;position:relative;width:100%}._line_11eub_67{height:1px;width:100%;background-color:var(--general-border-window);margin:var(--spacing-xs-3) 0}._borderRadiusM_11eub_74{border-radius:6px}._menuItem_11eub_78{gap:.25rem;width:100%;display:flex;justify-content:flex-start;align-items:stretch;flex-direction:column}._longLogo_11eub_87{transition:transform .25s ease,opacity .25s ease;will-change:transform,opacity}._flexVerticalBetweenStart_11eub_92{display:flex;justify-content:space-between;align-items:start;flex-direction:column}._flexHorizontalBetween_11eub_99{display:flex;justify-content:space-between;align-items:center;flex-direction:row}._flexHorizontalCenter_11eub_106{height:60px;display:flex;justify-content:center;align-items:center;flex-direction:row}._flexVertical_11eub_92{display:flex;justify-content:flex-start;align-items:stretch;flex-direction:column}._flexVerticalBetweenCenter_11eub_121{display:flex;justify-content:space-between;align-items:center;flex-direction:column}
|