@nice2dev/ui 1.4.20 → 1.4.22
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 +90 -0
- package/dist/NiceCodeEditor-CBgbzwjx.cjs +297 -0
- package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/{NiceMention-DhaTUqvR.cjs → NiceMention-D330ovOt.cjs} +1 -1
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-CUnBYI-T.cjs} +1 -1
- package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
- package/dist/display/NiceLeaderboard.mjs +47 -40
- package/dist/display/NiceQuestCard.mjs +93 -76
- package/dist/docs/NiceGantt.doc.json.mjs +9 -9
- package/dist/documentation/utils.mjs +1 -1
- package/dist/editors/rich/NiceCodeEditor.mjs +525 -504
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +99 -94
- package/dist/index.d.ts +63 -2
- package/dist/index.mjs +778 -776
- package/dist/navigation/NiceMenu.mjs +249 -248
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/overlays/NiceResponsiveBox.mjs +51 -24
- package/dist/overlays/NiceTutorial.mjs +136 -127
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +25 -2
- package/dist/planning/NiceGantt.mjs +130 -121
- package/dist/planning/NiceStepper.mjs +36 -35
- package/dist/style.css +2 -2
- package/dist/tools/NiceDraggable.mjs +44 -29
- package/dist/tools/NiceGitManager.mjs +5 -0
- package/dist/tools/NiceSortable.mjs +66 -48
- package/dist/tools/NiceSpeechToText.mjs +67 -52
- package/dist/tools/NiceValidationBuilder.mjs +210 -119
- package/dist/tools/NiceViewRegistry.mjs +67 -34
- package/dist/workflow/NiceTaskInbox.mjs +14 -12
- package/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +0 -289
- package/dist/NiceGantt-BygumlaY.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
- package/dist/NiceWindow-BklnkBpu.cjs +0 -1
- package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
|
@@ -1,239 +1,240 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as x, jsx as s, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as Je, useComponentDisplayClass as Qe, useComponentDisplayStyle as We, NiceThemeContext as Ze, useNiceAccessMode as Ye, NiceIcon as $e } from "@nice2dev/ui-core";
|
|
3
|
+
import { useContext as Ge, useId as Xe, useState as K, useRef as q, useEffect as oe, useCallback as R, useLayoutEffect as en, useMemo as nn } from "react";
|
|
4
|
+
import { createPortal as tn } from "react-dom";
|
|
5
5
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return (
|
|
6
|
+
const rn = [];
|
|
7
|
+
function U(c) {
|
|
8
|
+
return (c.id ?? c.key ?? "") + "";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function Me(c) {
|
|
11
|
+
return c.label ?? c.text ?? "";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function ae(c) {
|
|
14
|
+
return c.children ?? c.items;
|
|
15
15
|
}
|
|
16
|
-
function _e(
|
|
17
|
-
const o =
|
|
16
|
+
function _e(c) {
|
|
17
|
+
const o = ae(c);
|
|
18
18
|
return !o || o.length === 0;
|
|
19
19
|
}
|
|
20
|
-
function we(
|
|
20
|
+
function we(c, o) {
|
|
21
21
|
if (!o)
|
|
22
22
|
return !1;
|
|
23
|
-
if (
|
|
23
|
+
if (U(c) === o)
|
|
24
24
|
return !0;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const p = ae(c);
|
|
26
|
+
return p ? p.some((C) => we(C, o)) : !1;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
items:
|
|
28
|
+
const sn = ({
|
|
29
|
+
items: c = rn,
|
|
30
30
|
orientation: o = "horizontal",
|
|
31
|
-
variant:
|
|
31
|
+
variant: p = "ghost",
|
|
32
32
|
density: C = "normal",
|
|
33
|
-
size:
|
|
34
|
-
loading:
|
|
35
|
-
fullWidth:
|
|
36
|
-
showDividers:
|
|
33
|
+
size: z = "md",
|
|
34
|
+
loading: v = !1,
|
|
35
|
+
fullWidth: F = !1,
|
|
36
|
+
showDividers: P = !1,
|
|
37
37
|
panelAlign: m = "start",
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
panelAnchor: N = "item",
|
|
39
|
+
panelMinWidth: g = 200,
|
|
40
|
+
panelMaxWidth: V = 360,
|
|
40
41
|
itemGap: E,
|
|
41
|
-
paddingX:
|
|
42
|
-
paddingY:
|
|
43
|
-
portal:
|
|
44
|
-
panelZIndex:
|
|
45
|
-
arrowIcon:
|
|
46
|
-
flyoutArrowIcon:
|
|
47
|
-
closeOnSelect:
|
|
48
|
-
openTrigger:
|
|
49
|
-
openDelay:
|
|
50
|
-
closeDelay:
|
|
51
|
-
onOpenChange:
|
|
52
|
-
activeId:
|
|
53
|
-
activeKey:
|
|
54
|
-
onItemClick:
|
|
55
|
-
ariaLabel:
|
|
56
|
-
renderTriggerLabel:
|
|
57
|
-
renderEntryLabel:
|
|
58
|
-
maxDepth:
|
|
59
|
-
className:
|
|
60
|
-
"data-testid":
|
|
61
|
-
style:
|
|
62
|
-
id:
|
|
63
|
-
accessMode:
|
|
64
|
-
displayStyle:
|
|
42
|
+
paddingX: k,
|
|
43
|
+
paddingY: $,
|
|
44
|
+
portal: h = !0,
|
|
45
|
+
panelZIndex: A = 1100,
|
|
46
|
+
arrowIcon: ce = /* @__PURE__ */ s($e, { name: "chevron-down", size: 14 }),
|
|
47
|
+
flyoutArrowIcon: b = /* @__PURE__ */ s($e, { name: "chevron-right", size: 14 }),
|
|
48
|
+
closeOnSelect: L = !0,
|
|
49
|
+
openTrigger: _ = "click",
|
|
50
|
+
openDelay: ie = 120,
|
|
51
|
+
closeDelay: J = 180,
|
|
52
|
+
onOpenChange: le,
|
|
53
|
+
activeId: r,
|
|
54
|
+
activeKey: M,
|
|
55
|
+
onItemClick: w,
|
|
56
|
+
ariaLabel: ye,
|
|
57
|
+
renderTriggerLabel: f,
|
|
58
|
+
renderEntryLabel: Q,
|
|
59
|
+
maxDepth: ue = 3,
|
|
60
|
+
className: W,
|
|
61
|
+
"data-testid": Z,
|
|
62
|
+
style: Y,
|
|
63
|
+
id: T,
|
|
64
|
+
accessMode: de,
|
|
65
|
+
displayStyle: xe
|
|
65
66
|
}) => {
|
|
66
|
-
const { t:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [i,
|
|
70
|
-
const
|
|
71
|
-
|
|
67
|
+
const { t: De } = Je(), Re = ye ?? De("menu.menu", "Menu"), ze = Qe("menu", xe), Fe = We("menu", xe), Ce = Ge(Ze)?.portalTarget ?? (typeof document < "u" ? document.body : null), me = Ye(de, T), Pe = me === "hidden", fe = me === "disabled" || me === "readOnly" || v, Ne = Xe(), pe = r ?? M, Te = Math.min(10, Math.max(1, ue)), [i, G] = K(null), [Se, S] = K([]), X = q(null), ee = q(null);
|
|
68
|
+
oe(() => {
|
|
69
|
+
le?.(i);
|
|
70
|
+
}, [i, le]);
|
|
71
|
+
const y = R(() => {
|
|
72
|
+
X.current != null && (window.clearTimeout(X.current), X.current = null), ee.current != null && (window.clearTimeout(ee.current), ee.current = null);
|
|
72
73
|
}, []);
|
|
73
|
-
|
|
74
|
-
const
|
|
74
|
+
oe(() => () => y(), [y]);
|
|
75
|
+
const je = R(
|
|
75
76
|
(e) => {
|
|
76
|
-
|
|
77
|
+
y(), i !== e && (X.current = window.setTimeout(
|
|
77
78
|
() => {
|
|
78
|
-
|
|
79
|
+
G(e), S([]);
|
|
79
80
|
},
|
|
80
|
-
Math.max(0,
|
|
81
|
+
Math.max(0, ie)
|
|
81
82
|
));
|
|
82
83
|
},
|
|
83
|
-
[
|
|
84
|
-
),
|
|
85
|
-
|
|
84
|
+
[y, i, ie]
|
|
85
|
+
), ge = R(() => {
|
|
86
|
+
y(), ee.current = window.setTimeout(
|
|
86
87
|
() => {
|
|
87
|
-
|
|
88
|
+
G(null), S([]);
|
|
88
89
|
},
|
|
89
|
-
Math.max(0,
|
|
90
|
+
Math.max(0, J)
|
|
90
91
|
);
|
|
91
|
-
}, [
|
|
92
|
+
}, [y, J]), [ne, I] = K(-1), [Be, ve] = K(-1), [te, he] = K(null), j = q(null), re = q(null), B = q(/* @__PURE__ */ new Map()), O = R(() => {
|
|
92
93
|
if (!i) {
|
|
93
94
|
he(null);
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
const e =
|
|
97
|
+
const e = B.current.get(i);
|
|
97
98
|
if (!e)
|
|
98
99
|
return;
|
|
99
100
|
const n = e.getBoundingClientRect();
|
|
100
101
|
if (o === "vertical")
|
|
101
102
|
he({ left: n.right, top: n.top, width: n.width });
|
|
102
103
|
else {
|
|
103
|
-
const t =
|
|
104
|
-
let
|
|
105
|
-
m === "end" ?
|
|
104
|
+
const t = re.current?.offsetWidth ?? Math.max(g, n.width), a = N === "menu" && j.current ? j.current.getBoundingClientRect() : n;
|
|
105
|
+
let l = a.left;
|
|
106
|
+
m === "end" ? l = a.right - t : m === "center" && (l = a.left + a.width / 2 - t / 2), he({ left: l, top: n.bottom, width: n.width });
|
|
106
107
|
}
|
|
107
|
-
}, [i, o, m,
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
const e = requestAnimationFrame(
|
|
108
|
+
}, [i, o, m, N, g]);
|
|
109
|
+
en(() => {
|
|
110
|
+
if (h && (O(), i && (m === "end" || m === "center"))) {
|
|
111
|
+
const e = requestAnimationFrame(O);
|
|
111
112
|
return () => cancelAnimationFrame(e);
|
|
112
113
|
}
|
|
113
|
-
}, [
|
|
114
|
-
if (!
|
|
114
|
+
}, [h, O, i, m]), oe(() => {
|
|
115
|
+
if (!h || !i)
|
|
115
116
|
return;
|
|
116
|
-
const e = () =>
|
|
117
|
+
const e = () => O();
|
|
117
118
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
118
119
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
119
120
|
};
|
|
120
|
-
}, [
|
|
121
|
-
const
|
|
122
|
-
|
|
121
|
+
}, [h, i, O]);
|
|
122
|
+
const H = nn(() => c.filter((e) => U(e).length > 0), [c]), D = R(() => {
|
|
123
|
+
G(null), S([]), ve(-1);
|
|
123
124
|
}, []);
|
|
124
|
-
|
|
125
|
+
oe(() => {
|
|
125
126
|
if (!i)
|
|
126
127
|
return;
|
|
127
128
|
const e = (t) => {
|
|
128
|
-
const
|
|
129
|
-
|
|
129
|
+
const a = t.target;
|
|
130
|
+
j.current && j.current.contains(a) || re.current && re.current.contains(a) || D();
|
|
130
131
|
}, n = (t) => {
|
|
131
|
-
t.key === "Escape" &&
|
|
132
|
+
t.key === "Escape" && D();
|
|
132
133
|
};
|
|
133
134
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", n), () => {
|
|
134
135
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", n);
|
|
135
136
|
};
|
|
136
|
-
}, [i,
|
|
137
|
+
}, [i, D]);
|
|
137
138
|
const be = (e, n) => {
|
|
138
|
-
if (e.disabled ||
|
|
139
|
+
if (e.disabled || fe)
|
|
139
140
|
return;
|
|
140
|
-
const t =
|
|
141
|
+
const t = U(e);
|
|
141
142
|
if (_e(e)) {
|
|
142
|
-
e.onClick?.(n),
|
|
143
|
+
e.onClick?.(n), w?.(e, n), L && D();
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
146
|
+
S([]), G(i === t ? null : t), ve(-1);
|
|
147
|
+
}, Oe = R((e, n) => {
|
|
148
|
+
S((t) => {
|
|
149
|
+
const a = e - 2;
|
|
150
|
+
if (a < 0)
|
|
150
151
|
return t;
|
|
151
|
-
if (t[
|
|
152
|
-
return t.slice(0,
|
|
153
|
-
const
|
|
154
|
-
return
|
|
152
|
+
if (t[a] === n)
|
|
153
|
+
return t.slice(0, a);
|
|
154
|
+
const d = t.slice(0, a);
|
|
155
|
+
return d[a] = n, d;
|
|
155
156
|
});
|
|
156
|
-
}, []),
|
|
157
|
-
e.disabled || (e.onClick?.(n),
|
|
158
|
-
},
|
|
159
|
-
if (
|
|
157
|
+
}, []), He = (e, n) => {
|
|
158
|
+
e.disabled || (e.onClick?.(n), w?.(e, n), L && D());
|
|
159
|
+
}, Ke = (e) => {
|
|
160
|
+
if (fe)
|
|
160
161
|
return;
|
|
161
|
-
const n = o === "horizontal", t = n ? "ArrowLeft" : "ArrowUp",
|
|
162
|
+
const n = o === "horizontal", t = n ? "ArrowLeft" : "ArrowUp", a = n ? "ArrowRight" : "ArrowDown";
|
|
162
163
|
if (e.key === t)
|
|
163
|
-
e.preventDefault(),
|
|
164
|
-
else if (e.key ===
|
|
165
|
-
e.preventDefault(),
|
|
164
|
+
e.preventDefault(), I((l) => l <= 0 ? H.length - 1 : l - 1);
|
|
165
|
+
else if (e.key === a)
|
|
166
|
+
e.preventDefault(), I((l) => l >= H.length - 1 ? 0 : l + 1);
|
|
166
167
|
else if (e.key === "Home")
|
|
167
|
-
e.preventDefault(),
|
|
168
|
+
e.preventDefault(), I(0);
|
|
168
169
|
else if (e.key === "End")
|
|
169
|
-
e.preventDefault(),
|
|
170
|
+
e.preventDefault(), I(H.length - 1);
|
|
170
171
|
else if (e.key === "Enter" || e.key === " ") {
|
|
171
172
|
e.preventDefault();
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
} else e.key === "Escape" &&
|
|
173
|
+
const l = H[ne];
|
|
174
|
+
l && be(l, e);
|
|
175
|
+
} else e.key === "Escape" && D();
|
|
175
176
|
};
|
|
176
|
-
if (
|
|
177
|
+
if (Pe)
|
|
177
178
|
return null;
|
|
178
|
-
const
|
|
179
|
+
const qe = [
|
|
179
180
|
"nice-menu",
|
|
180
181
|
`nice-menu--orientation-${o}`,
|
|
181
|
-
`nice-menu--variant-${
|
|
182
|
+
`nice-menu--variant-${p}`,
|
|
182
183
|
`nice-menu--density-${C}`,
|
|
183
|
-
`nice-menu--size-${
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
`nice-menu--size-${z}`,
|
|
185
|
+
F ? "nice-menu--full-width" : "",
|
|
186
|
+
P ? "nice-menu--show-dividers" : "",
|
|
187
|
+
v ? "nice-menu--loading" : "",
|
|
187
188
|
ze ?? "",
|
|
188
|
-
|
|
189
|
-
].filter(Boolean).join(" "),
|
|
189
|
+
W ?? ""
|
|
190
|
+
].filter(Boolean).join(" "), se = {
|
|
190
191
|
...Fe,
|
|
191
|
-
...
|
|
192
|
-
"--nice-menu-panel-min-w": `${
|
|
193
|
-
"--nice-menu-panel-max-w": `${
|
|
192
|
+
...Y,
|
|
193
|
+
"--nice-menu-panel-min-w": `${g}px`,
|
|
194
|
+
"--nice-menu-panel-max-w": `${V}px`
|
|
194
195
|
};
|
|
195
|
-
return E !== void 0 && (
|
|
196
|
+
return E !== void 0 && (se["--nice-menu-gap"] = typeof E == "number" ? `${E}px` : E), k !== void 0 && (se["--nice-menu-padding-x"] = typeof k == "number" ? `${k}px` : k), $ !== void 0 && (se["--nice-menu-padding-y"] = typeof $ == "number" ? `${$}px` : $), /* @__PURE__ */ x(
|
|
196
197
|
"nav",
|
|
197
198
|
{
|
|
198
|
-
id:
|
|
199
|
-
ref:
|
|
200
|
-
className:
|
|
201
|
-
style:
|
|
202
|
-
"data-testid":
|
|
203
|
-
"aria-label":
|
|
204
|
-
"aria-busy":
|
|
199
|
+
id: T,
|
|
200
|
+
ref: j,
|
|
201
|
+
className: qe,
|
|
202
|
+
style: se,
|
|
203
|
+
"data-testid": Z,
|
|
204
|
+
"aria-label": Re,
|
|
205
|
+
"aria-busy": v || void 0,
|
|
205
206
|
children: [
|
|
206
|
-
|
|
207
|
-
/* @__PURE__ */ s("ul", { className: "nice-menu__list", role: "menubar", onKeyDown:
|
|
208
|
-
const t =
|
|
207
|
+
v && /* @__PURE__ */ s("span", { className: "nice-menu__spinner", "aria-hidden": "true", children: /* @__PURE__ */ s("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
208
|
+
/* @__PURE__ */ s("ul", { className: "nice-menu__list", role: "menubar", onKeyDown: Ke, tabIndex: 0, children: H.map((e, n) => {
|
|
209
|
+
const t = U(e), a = i === t, l = !!pe && we(e, pe), d = !_e(e), Ue = [
|
|
209
210
|
"nice-menu__item",
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
a ? "nice-menu__item--open" : "",
|
|
212
|
+
l ? "nice-menu__item--active" : "",
|
|
212
213
|
e.disabled ? "nice-menu__item--disabled" : "",
|
|
213
214
|
e.danger ? "nice-menu__item--danger" : "",
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
].filter(Boolean).join(" "),
|
|
215
|
+
d ? "nice-menu__item--has-children" : "",
|
|
216
|
+
ne === n ? "nice-menu__item--focused" : ""
|
|
217
|
+
].filter(Boolean).join(" "), Ve = f ? f(e) : Me(e), Ee = /* @__PURE__ */ x(Le, { children: [
|
|
217
218
|
e.icon ? /* @__PURE__ */ s("span", { className: "nice-menu__icon", children: e.icon }) : null,
|
|
218
|
-
/* @__PURE__ */ s("span", { className: "nice-menu__label", children:
|
|
219
|
+
/* @__PURE__ */ s("span", { className: "nice-menu__label", children: Ve }),
|
|
219
220
|
e.badge != null ? /* @__PURE__ */ s("span", { className: "nice-menu__badge", children: e.badge }) : null,
|
|
220
|
-
|
|
221
|
+
d ? /* @__PURE__ */ s("span", { className: "nice-menu__arrow", "aria-hidden": !0, children: ce }) : null
|
|
221
222
|
] });
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ x(
|
|
223
224
|
"li",
|
|
224
225
|
{
|
|
225
|
-
className:
|
|
226
|
+
className: Ue,
|
|
226
227
|
role: "none",
|
|
227
228
|
"data-nice-menu-id": t,
|
|
228
229
|
"data-nice-depth": 1,
|
|
229
|
-
onMouseEnter:
|
|
230
|
-
onMouseLeave:
|
|
230
|
+
onMouseEnter: d && (_ === "hover" || _ === "both") ? () => je(t) : void 0,
|
|
231
|
+
onMouseLeave: d && (_ === "hover" || _ === "both") ? () => ge() : void 0,
|
|
231
232
|
children: [
|
|
232
|
-
e.href && !
|
|
233
|
+
e.href && !d ? /* @__PURE__ */ s(
|
|
233
234
|
"a",
|
|
234
235
|
{
|
|
235
|
-
ref: (
|
|
236
|
-
|
|
236
|
+
ref: (u) => {
|
|
237
|
+
u ? B.current.set(t, u) : B.current.delete(t);
|
|
237
238
|
},
|
|
238
239
|
className: "nice-menu__btn",
|
|
239
240
|
href: e.href,
|
|
@@ -242,67 +243,67 @@ const rn = ({
|
|
|
242
243
|
role: "menuitem",
|
|
243
244
|
"aria-disabled": e.disabled || void 0,
|
|
244
245
|
"aria-label": e.ariaLabel,
|
|
245
|
-
tabIndex:
|
|
246
|
-
onClick: (
|
|
247
|
-
onFocus: () =>
|
|
246
|
+
tabIndex: ne === n ? 0 : -1,
|
|
247
|
+
onClick: (u) => be(e, u),
|
|
248
|
+
onFocus: () => I(n),
|
|
248
249
|
children: Ee
|
|
249
250
|
}
|
|
250
251
|
) : /* @__PURE__ */ s(
|
|
251
252
|
"button",
|
|
252
253
|
{
|
|
253
|
-
ref: (
|
|
254
|
-
|
|
254
|
+
ref: (u) => {
|
|
255
|
+
u ? B.current.set(t, u) : B.current.delete(t);
|
|
255
256
|
},
|
|
256
257
|
type: "button",
|
|
257
258
|
className: "nice-menu__btn",
|
|
258
|
-
disabled: e.disabled ||
|
|
259
|
+
disabled: e.disabled || fe,
|
|
259
260
|
role: "menuitem",
|
|
260
|
-
"aria-haspopup":
|
|
261
|
-
"aria-expanded":
|
|
262
|
-
"aria-controls":
|
|
261
|
+
"aria-haspopup": d || void 0,
|
|
262
|
+
"aria-expanded": d ? a : void 0,
|
|
263
|
+
"aria-controls": d ? `${Ne}-panel-${t}` : void 0,
|
|
263
264
|
"aria-label": e.ariaLabel,
|
|
264
|
-
tabIndex:
|
|
265
|
-
onClick: (
|
|
266
|
-
onFocus: () =>
|
|
265
|
+
tabIndex: ne === n ? 0 : -1,
|
|
266
|
+
onClick: (u) => be(e, u),
|
|
267
|
+
onFocus: () => I(n),
|
|
267
268
|
children: Ee
|
|
268
269
|
}
|
|
269
270
|
),
|
|
270
|
-
|
|
271
|
-
const
|
|
271
|
+
d && a ? (() => {
|
|
272
|
+
const u = h && typeof document < "u" && !!te && !!Ce, Ae = u ? {
|
|
272
273
|
position: "fixed",
|
|
273
|
-
left:
|
|
274
|
-
top:
|
|
275
|
-
minWidth: Math.max(
|
|
276
|
-
maxWidth:
|
|
277
|
-
zIndex:
|
|
278
|
-
} : { zIndex:
|
|
279
|
-
|
|
274
|
+
left: te.left,
|
|
275
|
+
top: te.top,
|
|
276
|
+
minWidth: Math.max(g, te.width),
|
|
277
|
+
maxWidth: V,
|
|
278
|
+
zIndex: A
|
|
279
|
+
} : { zIndex: A }, ke = /* @__PURE__ */ s(
|
|
280
|
+
Ie,
|
|
280
281
|
{
|
|
281
|
-
items:
|
|
282
|
+
items: ae(e) ?? [],
|
|
282
283
|
depth: 2,
|
|
283
|
-
maxDepth:
|
|
284
|
-
openPath:
|
|
285
|
-
onToggleBranch:
|
|
286
|
-
onLeafClick:
|
|
287
|
-
effectiveActiveId:
|
|
288
|
-
renderEntryLabel:
|
|
289
|
-
flyoutArrowIcon:
|
|
290
|
-
openTrigger:
|
|
291
|
-
onPanelEnter: () =>
|
|
292
|
-
onPanelLeave: () =>
|
|
284
|
+
maxDepth: Te,
|
|
285
|
+
openPath: Se,
|
|
286
|
+
onToggleBranch: Oe,
|
|
287
|
+
onLeafClick: He,
|
|
288
|
+
effectiveActiveId: pe,
|
|
289
|
+
renderEntryLabel: Q,
|
|
290
|
+
flyoutArrowIcon: b,
|
|
291
|
+
openTrigger: _,
|
|
292
|
+
onPanelEnter: () => y(),
|
|
293
|
+
onPanelLeave: () => ge(),
|
|
293
294
|
panelClassName: [
|
|
294
295
|
"nice-menu__panel",
|
|
295
296
|
`nice-menu__panel--align-${m}`,
|
|
296
|
-
|
|
297
|
+
u ? "nice-menu__panel--portal" : ""
|
|
297
298
|
].filter(Boolean).join(" "),
|
|
298
|
-
panelStyle:
|
|
299
|
+
panelStyle: Ae,
|
|
299
300
|
panelId: `${Ne}-panel-${t}`,
|
|
300
|
-
panelRef:
|
|
301
|
-
focusedEntryIdx:
|
|
302
|
-
setFocusedEntryIdx:
|
|
301
|
+
panelRef: u ? re : void 0,
|
|
302
|
+
focusedEntryIdx: Be,
|
|
303
|
+
setFocusedEntryIdx: ve
|
|
303
304
|
}
|
|
304
305
|
);
|
|
305
|
-
return
|
|
306
|
+
return u ? tn(ke, Ce) : ke;
|
|
306
307
|
})() : null
|
|
307
308
|
]
|
|
308
309
|
},
|
|
@@ -313,124 +314,124 @@ const rn = ({
|
|
|
313
314
|
}
|
|
314
315
|
);
|
|
315
316
|
};
|
|
316
|
-
process.env.NODE_ENV !== "production" && (
|
|
317
|
-
function
|
|
318
|
-
items:
|
|
317
|
+
process.env.NODE_ENV !== "production" && (sn.displayName = "NiceMenu");
|
|
318
|
+
function Ie({
|
|
319
|
+
items: c,
|
|
319
320
|
depth: o,
|
|
320
|
-
maxDepth:
|
|
321
|
+
maxDepth: p,
|
|
321
322
|
openPath: C,
|
|
322
|
-
onToggleBranch:
|
|
323
|
-
onLeafClick:
|
|
324
|
-
effectiveActiveId:
|
|
325
|
-
renderEntryLabel:
|
|
323
|
+
onToggleBranch: z,
|
|
324
|
+
onLeafClick: v,
|
|
325
|
+
effectiveActiveId: F,
|
|
326
|
+
renderEntryLabel: P,
|
|
326
327
|
flyoutArrowIcon: m,
|
|
327
|
-
openTrigger:
|
|
328
|
-
onPanelEnter:
|
|
329
|
-
onPanelLeave:
|
|
330
|
-
panelClassName:
|
|
328
|
+
openTrigger: N,
|
|
329
|
+
onPanelEnter: g,
|
|
330
|
+
onPanelLeave: V,
|
|
331
|
+
panelClassName: E,
|
|
331
332
|
panelStyle: k,
|
|
332
|
-
panelId:
|
|
333
|
-
panelRef:
|
|
334
|
-
focusedEntryIdx:
|
|
333
|
+
panelId: $,
|
|
334
|
+
panelRef: h,
|
|
335
|
+
focusedEntryIdx: A,
|
|
335
336
|
setFocusedEntryIdx: ce
|
|
336
337
|
}) {
|
|
337
|
-
const
|
|
338
|
-
"--nice-row-bg": `var(--nice-menu-level-${
|
|
339
|
-
"--nice-row-text": `var(--nice-menu-level-${
|
|
340
|
-
"--nice-row-border": `var(--nice-menu-level-${
|
|
341
|
-
"--nice-row-hover-bg": `var(--nice-menu-level-${
|
|
342
|
-
"--nice-row-active-bg": `var(--nice-menu-level-${
|
|
338
|
+
const b = Math.min(Math.max(o, 1), 10), L = o === 2, _ = E ?? (L ? "nice-menu__panel" : "nice-menu__subpanel"), J = { ...{
|
|
339
|
+
"--nice-row-bg": `var(--nice-menu-level-${b}-bg, var(--nice-bg-elevated, var(--nice-bg-primary)))`,
|
|
340
|
+
"--nice-row-text": `var(--nice-menu-level-${b}-text, var(--nice-text-primary))`,
|
|
341
|
+
"--nice-row-border": `var(--nice-menu-level-${b}-border, var(--nice-border-color))`,
|
|
342
|
+
"--nice-row-hover-bg": `var(--nice-menu-level-${b}-hover-bg, var(--nice-hover-bg))`,
|
|
343
|
+
"--nice-row-active-bg": `var(--nice-menu-level-${b}-active-bg, var(--nice-selected-bg))`
|
|
343
344
|
}, ...k ?? {} };
|
|
344
345
|
return /* @__PURE__ */ s(
|
|
345
346
|
"div",
|
|
346
347
|
{
|
|
347
|
-
ref:
|
|
348
|
-
id:
|
|
349
|
-
className:
|
|
350
|
-
style:
|
|
348
|
+
ref: h,
|
|
349
|
+
id: $,
|
|
350
|
+
className: _,
|
|
351
|
+
style: J,
|
|
351
352
|
role: "menu",
|
|
352
353
|
"data-nice-depth": o,
|
|
353
|
-
...
|
|
354
|
-
children:
|
|
354
|
+
...N === "hover" || N === "both" ? { onMouseEnter: g, onMouseLeave: V } : {},
|
|
355
|
+
children: c.map((r, M) => {
|
|
355
356
|
if (r.divider)
|
|
356
|
-
return /* @__PURE__ */ s("hr", { className: "nice-menu__divider" }, `d-${
|
|
357
|
-
const
|
|
357
|
+
return /* @__PURE__ */ s("hr", { className: "nice-menu__divider" }, `d-${M}`);
|
|
358
|
+
const w = U(r), f = !_e(r) && o < p, Q = C[o - 2] === w, ue = !!F && we(r, F), W = [
|
|
358
359
|
"nice-menu__entry",
|
|
359
360
|
r.disabled ? "nice-menu__entry--disabled" : "",
|
|
360
361
|
r.danger ? "nice-menu__entry--danger" : "",
|
|
361
362
|
ue ? "nice-menu__entry--active" : "",
|
|
362
|
-
|
|
363
|
-
].filter(Boolean).join(" "),
|
|
363
|
+
L && A === M ? "nice-menu__entry--focused" : ""
|
|
364
|
+
].filter(Boolean).join(" "), Z = /* @__PURE__ */ x(Le, { children: [
|
|
364
365
|
r.icon ? /* @__PURE__ */ s("span", { className: "nice-menu__icon", children: r.icon }) : null,
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
|
|
366
|
+
/* @__PURE__ */ x("span", { className: "nice-menu__entry-content", children: [
|
|
367
|
+
/* @__PURE__ */ x("span", { className: "nice-menu__entry-label", children: [
|
|
368
|
+
P ? P(r) : Me(r),
|
|
368
369
|
r.badge != null ? /* @__PURE__ */ s("span", { className: "nice-menu__badge", children: r.badge }) : null
|
|
369
370
|
] }),
|
|
370
371
|
r.description ? /* @__PURE__ */ s("span", { className: "nice-menu__entry-desc", children: r.description }) : null
|
|
371
372
|
] }),
|
|
372
|
-
|
|
373
|
-
] }),
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
return /* @__PURE__ */
|
|
373
|
+
f ? /* @__PURE__ */ s("span", { className: "nice-menu__entry-arrow", "aria-hidden": !0, children: m }) : null
|
|
374
|
+
] }), Y = (de) => {
|
|
375
|
+
f ? z(o, w) : v(r, de);
|
|
376
|
+
}, T = L ? () => ce?.(M) : void 0;
|
|
377
|
+
return /* @__PURE__ */ x(
|
|
377
378
|
"div",
|
|
378
379
|
{
|
|
379
380
|
style: { position: "relative" },
|
|
380
|
-
onMouseEnter:
|
|
381
|
+
onMouseEnter: f ? () => z(o, w) : void 0,
|
|
381
382
|
children: [
|
|
382
|
-
r.href && !
|
|
383
|
+
r.href && !f ? /* @__PURE__ */ s(
|
|
383
384
|
"a",
|
|
384
385
|
{
|
|
385
|
-
className:
|
|
386
|
+
className: W,
|
|
386
387
|
href: r.href,
|
|
387
388
|
target: r.target,
|
|
388
389
|
rel: r.rel,
|
|
389
390
|
role: "menuitem",
|
|
390
391
|
"aria-disabled": r.disabled || void 0,
|
|
391
392
|
"aria-label": r.ariaLabel,
|
|
392
|
-
onClick:
|
|
393
|
-
onFocus:
|
|
394
|
-
children:
|
|
393
|
+
onClick: Y,
|
|
394
|
+
onFocus: T,
|
|
395
|
+
children: Z
|
|
395
396
|
}
|
|
396
397
|
) : /* @__PURE__ */ s(
|
|
397
398
|
"button",
|
|
398
399
|
{
|
|
399
400
|
type: "button",
|
|
400
|
-
className:
|
|
401
|
+
className: W,
|
|
401
402
|
disabled: r.disabled,
|
|
402
403
|
role: "menuitem",
|
|
403
|
-
"aria-haspopup":
|
|
404
|
-
"aria-expanded":
|
|
404
|
+
"aria-haspopup": f || void 0,
|
|
405
|
+
"aria-expanded": f ? Q : void 0,
|
|
405
406
|
"aria-label": r.ariaLabel,
|
|
406
|
-
onClick:
|
|
407
|
-
onFocus:
|
|
408
|
-
children:
|
|
407
|
+
onClick: Y,
|
|
408
|
+
onFocus: T,
|
|
409
|
+
children: Z
|
|
409
410
|
}
|
|
410
411
|
),
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
f && Q ? /* @__PURE__ */ s(
|
|
413
|
+
Ie,
|
|
413
414
|
{
|
|
414
|
-
items:
|
|
415
|
+
items: ae(r) ?? [],
|
|
415
416
|
depth: o + 1,
|
|
416
|
-
maxDepth:
|
|
417
|
+
maxDepth: p,
|
|
417
418
|
openPath: C,
|
|
418
|
-
onToggleBranch:
|
|
419
|
-
onLeafClick:
|
|
420
|
-
effectiveActiveId:
|
|
421
|
-
renderEntryLabel:
|
|
419
|
+
onToggleBranch: z,
|
|
420
|
+
onLeafClick: v,
|
|
421
|
+
effectiveActiveId: F,
|
|
422
|
+
renderEntryLabel: P,
|
|
422
423
|
flyoutArrowIcon: m,
|
|
423
|
-
openTrigger:
|
|
424
|
+
openTrigger: N
|
|
424
425
|
}
|
|
425
426
|
) : null
|
|
426
427
|
]
|
|
427
428
|
},
|
|
428
|
-
|
|
429
|
+
w || `c-${M}`
|
|
429
430
|
);
|
|
430
431
|
})
|
|
431
432
|
}
|
|
432
433
|
);
|
|
433
434
|
}
|
|
434
435
|
export {
|
|
435
|
-
|
|
436
|
+
sn as NiceMenu
|
|
436
437
|
};
|