@nice2dev/ui 1.3.9 → 1.3.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/CHANGELOG.md +37 -0
- package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
- package/dist/NiceColorPicker-DS59tNkP.js +552 -0
- package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
- package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
- package/dist/NiceForm-BQj-K7p7.cjs +1 -0
- package/dist/NiceForm-HQ4h7hX_.js +5023 -0
- package/dist/NiceGantt-BygumlaY.cjs +1 -0
- package/dist/NiceGantt-DTC7OH-v.js +334 -0
- package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
- package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
- package/dist/NiceMention-CVxxCVtQ.js +11668 -0
- package/dist/NiceMention-Te66Oid1.cjs +430 -0
- package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
- package/dist/NicePagination-CKsAP38Q.cjs +1 -0
- package/dist/NicePagination-zOed5QxG.js +202 -0
- package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
- package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
- package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
- package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
- package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
- package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
- package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
- package/dist/NiceSelect-DEruWHan.js +495 -0
- package/dist/NiceWindow-D3V7A69Q.js +2247 -0
- package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
- package/dist/core-lazy-Bjdu111n.js +351 -0
- package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +46 -5
- package/dist/data.mjs +3 -3
- package/dist/devops-CqhA0rjL.js +9130 -0
- package/dist/devops-cgRBnZVX.cjs +18 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/index.cjs +108 -108
- package/dist/index.css +1 -1
- package/dist/index.d.ts +51 -8
- package/dist/index.mjs +13739 -13579
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +15 -15
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +2 -0
- package/dist/navigation.mjs +3 -3
- package/dist/no-code-BQqK8mvU.cjs +331 -0
- package/dist/no-code-Cppb-xz3.js +8320 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BA3-D5RC.js +663 -0
- package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,2247 @@
|
|
|
1
|
+
import { jsxs as R, Fragment as Te, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as ze, useComponentDisplayClass as kt, useOverlayFocus as ve, NiceIcon as ee, triggerHaptic as We, useClickOutside as st, useRovingFocus as at, usePan as Et, NiceThemeContext as It, useNiceActions as Tt, triggerNiceAction as zt, useIntent as tt, useInputHints as lt, useControlId as nt, focusCandidates as Mt, useInputEngine as Ct, sanitizeHtml as $t, useNiceAccessMode as Rt } from "@nice2dev/ui-core";
|
|
3
|
+
import St, { useRef as H, useState as X, useCallback as v, useEffect as K, useContext as it, useReducer as Pt, useMemo as Re, createContext as dt, forwardRef as ot, useId as Lt } from "react";
|
|
4
|
+
import { createPortal as Se } from "react-dom";
|
|
5
|
+
const Yt = [], rn = ({
|
|
6
|
+
visible: e,
|
|
7
|
+
onClose: n,
|
|
8
|
+
title: c,
|
|
9
|
+
items: o = Yt,
|
|
10
|
+
showCancelButton: l = !0,
|
|
11
|
+
cancelText: u,
|
|
12
|
+
size: d = "md",
|
|
13
|
+
disabled: p,
|
|
14
|
+
readOnly: m,
|
|
15
|
+
loading: x,
|
|
16
|
+
error: S,
|
|
17
|
+
className: M,
|
|
18
|
+
"data-testid": C,
|
|
19
|
+
style: T
|
|
20
|
+
}) => {
|
|
21
|
+
const { t: N } = ze();
|
|
22
|
+
if (!e)
|
|
23
|
+
return null;
|
|
24
|
+
const h = p || x || m;
|
|
25
|
+
return /* @__PURE__ */ R(Te, { children: [
|
|
26
|
+
/* @__PURE__ */ t("div", { role: "presentation", className: "nice-actionsheet__overlay", onClick: n }),
|
|
27
|
+
/* @__PURE__ */ R(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: `nice-actionsheet nice-actionsheet--${d} ${p ? "nice-actionsheet--disabled" : ""} ${m ? "nice-actionsheet--readonly" : ""} ${x ? "nice-actionsheet--loading" : ""} ${S ? "nice-actionsheet--error" : ""} ${M || ""}`,
|
|
31
|
+
style: T,
|
|
32
|
+
"data-testid": C,
|
|
33
|
+
"aria-disabled": p || void 0,
|
|
34
|
+
"aria-readonly": m || void 0,
|
|
35
|
+
"aria-busy": x || void 0,
|
|
36
|
+
children: [
|
|
37
|
+
S && /* @__PURE__ */ t("div", { className: "nice-actionsheet__error", role: "alert", children: S }),
|
|
38
|
+
x && /* @__PURE__ */ t("span", { className: "nice-actionsheet__spinner", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
39
|
+
c && /* @__PURE__ */ t("div", { className: "nice-actionsheet__title", children: c }),
|
|
40
|
+
/* @__PURE__ */ t("div", { className: "nice-actionsheet__items", children: o.map((s, w) => /* @__PURE__ */ R(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
className: `nice-actionsheet__item ${s.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
|
|
44
|
+
disabled: s.disabled || h,
|
|
45
|
+
onClick: () => {
|
|
46
|
+
h || (s.onClick?.(), n());
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
s.icon && /* @__PURE__ */ t("span", { className: "nice-actionsheet__icon", children: s.icon }),
|
|
50
|
+
s.text
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
w
|
|
54
|
+
)) }),
|
|
55
|
+
l && /* @__PURE__ */ t("button", { className: "nice-actionsheet__cancel", onClick: n, children: u || N("cancel", "Cancel") })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}, sn = ({
|
|
61
|
+
visible: e,
|
|
62
|
+
onClose: n,
|
|
63
|
+
targetRef: c,
|
|
64
|
+
position: o = "bottom",
|
|
65
|
+
title: l,
|
|
66
|
+
showArrow: u = !0,
|
|
67
|
+
width: d,
|
|
68
|
+
children: p,
|
|
69
|
+
className: m,
|
|
70
|
+
"data-testid": x,
|
|
71
|
+
style: S,
|
|
72
|
+
displayStyle: M
|
|
73
|
+
}) => {
|
|
74
|
+
kt("tooltip", M);
|
|
75
|
+
const C = H(null), [T, N] = X({ top: 0, left: 0 }), h = v(() => {
|
|
76
|
+
const s = c.current, w = C.current;
|
|
77
|
+
if (!s || !w)
|
|
78
|
+
return;
|
|
79
|
+
const a = s.getBoundingClientRect(), $ = w.getBoundingClientRect();
|
|
80
|
+
let r = 0, Y = 0;
|
|
81
|
+
const _ = 8;
|
|
82
|
+
switch (o) {
|
|
83
|
+
case "top":
|
|
84
|
+
r = a.top - $.height - _, Y = a.left + (a.width - $.width) / 2;
|
|
85
|
+
break;
|
|
86
|
+
case "bottom":
|
|
87
|
+
r = a.bottom + _, Y = a.left + (a.width - $.width) / 2;
|
|
88
|
+
break;
|
|
89
|
+
case "left":
|
|
90
|
+
r = a.top + (a.height - $.height) / 2, Y = a.left - $.width - _;
|
|
91
|
+
break;
|
|
92
|
+
case "right":
|
|
93
|
+
r = a.top + (a.height - $.height) / 2, Y = a.right + _;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
N({ top: r + window.scrollY, left: Y + window.scrollX });
|
|
97
|
+
}, [c, o]);
|
|
98
|
+
return K(() => {
|
|
99
|
+
if (e) {
|
|
100
|
+
requestAnimationFrame(h);
|
|
101
|
+
const s = (w) => {
|
|
102
|
+
const a = w.target;
|
|
103
|
+
(a instanceof Element ? a : a?.parentElement ?? null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]') || C.current && !C.current.contains(a) && c.current && !c.current.contains(a) && n();
|
|
104
|
+
};
|
|
105
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
106
|
+
}
|
|
107
|
+
}, [e, h, n, c]), ve(C, { open: e, modal: !1, onClose: () => n() }), e ? /* @__PURE__ */ R(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
ref: C,
|
|
111
|
+
className: `nice-popover nice-popover--${o} ${m || ""}`,
|
|
112
|
+
style: { ...S, position: "absolute", top: T.top, left: T.left, width: d },
|
|
113
|
+
"data-testid": x,
|
|
114
|
+
role: "dialog",
|
|
115
|
+
"aria-label": l,
|
|
116
|
+
children: [
|
|
117
|
+
u && /* @__PURE__ */ t("div", { className: `nice-popover__arrow nice-popover__arrow--${o}` }),
|
|
118
|
+
l && /* @__PURE__ */ t("div", { className: "nice-popover__title", children: l }),
|
|
119
|
+
/* @__PURE__ */ t("div", { className: "nice-popover__content", children: p })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
) : null;
|
|
123
|
+
}, an = ({
|
|
124
|
+
visible: e,
|
|
125
|
+
message: n,
|
|
126
|
+
container: c,
|
|
127
|
+
showIndicator: o = !0,
|
|
128
|
+
shading: l = !0,
|
|
129
|
+
className: u,
|
|
130
|
+
"data-testid": d,
|
|
131
|
+
style: p
|
|
132
|
+
}) => {
|
|
133
|
+
const { t: m } = ze();
|
|
134
|
+
if (!e)
|
|
135
|
+
return null;
|
|
136
|
+
const x = !!c?.current, S = /* @__PURE__ */ R("div", { className: `nice-loadpanel ${u || ""}`, style: p, "data-testid": d, children: [
|
|
137
|
+
l && /* @__PURE__ */ t("div", { className: "nice-loadpanel__shade" }),
|
|
138
|
+
/* @__PURE__ */ R("div", { className: "nice-loadpanel__box", children: [
|
|
139
|
+
o && /* @__PURE__ */ t("div", { className: "nice-spinner nice-spinner--md" }),
|
|
140
|
+
/* @__PURE__ */ t("span", { className: "nice-loadpanel__text", children: n || m("loading", "Loading...") })
|
|
141
|
+
] })
|
|
142
|
+
] });
|
|
143
|
+
if (x && c.current) {
|
|
144
|
+
const M = c.current;
|
|
145
|
+
return M.style.position = M.style.position || "relative", S;
|
|
146
|
+
}
|
|
147
|
+
return S;
|
|
148
|
+
}, ln = ({
|
|
149
|
+
direction: e = "row",
|
|
150
|
+
align: n,
|
|
151
|
+
justify: c,
|
|
152
|
+
wrap: o,
|
|
153
|
+
gap: l,
|
|
154
|
+
flex: u,
|
|
155
|
+
children: d,
|
|
156
|
+
className: p,
|
|
157
|
+
"data-testid": m,
|
|
158
|
+
style: x
|
|
159
|
+
}) => /* @__PURE__ */ t(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
"data-testid": m,
|
|
163
|
+
className: `nice-box ${p || ""}`,
|
|
164
|
+
style: {
|
|
165
|
+
display: "flex",
|
|
166
|
+
flexDirection: e,
|
|
167
|
+
alignItems: n,
|
|
168
|
+
justifyContent: c,
|
|
169
|
+
flexWrap: o ? "wrap" : void 0,
|
|
170
|
+
gap: l,
|
|
171
|
+
flex: u,
|
|
172
|
+
...x
|
|
173
|
+
},
|
|
174
|
+
children: d
|
|
175
|
+
}
|
|
176
|
+
), Ot = [], dn = ({
|
|
177
|
+
direction: e = "row",
|
|
178
|
+
items: n = Ot,
|
|
179
|
+
gap: c,
|
|
180
|
+
className: o,
|
|
181
|
+
"data-testid": l,
|
|
182
|
+
style: u
|
|
183
|
+
}) => /* @__PURE__ */ t(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
"data-testid": l,
|
|
187
|
+
className: `nice-responsivebox ${o || ""}`,
|
|
188
|
+
style: { display: "flex", flexDirection: e, gap: c, ...u },
|
|
189
|
+
children: n.map((d, p) => /* @__PURE__ */ t(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
style: { flex: d.ratio ?? 1, flexBasis: d.baseSize, flexShrink: d.shrink ?? 1 },
|
|
193
|
+
children: d.children
|
|
194
|
+
},
|
|
195
|
+
p
|
|
196
|
+
))
|
|
197
|
+
}
|
|
198
|
+
), un = ({
|
|
199
|
+
width: e = 200,
|
|
200
|
+
height: n = 200,
|
|
201
|
+
minWidth: c = 50,
|
|
202
|
+
minHeight: o = 50,
|
|
203
|
+
maxWidth: l = 1 / 0,
|
|
204
|
+
maxHeight: u = 1 / 0,
|
|
205
|
+
handles: d = ["right", "bottom", "bottomRight"],
|
|
206
|
+
onResize: p,
|
|
207
|
+
children: m,
|
|
208
|
+
className: x,
|
|
209
|
+
"data-testid": S,
|
|
210
|
+
style: M
|
|
211
|
+
}) => {
|
|
212
|
+
const [C, T] = X({ width: e, height: n }), N = H(null), h = (a, $) => {
|
|
213
|
+
$.preventDefault();
|
|
214
|
+
const r = $.clientX, Y = $.clientY, _ = C.width, F = C.height, k = {
|
|
215
|
+
n: "top",
|
|
216
|
+
s: "bottom",
|
|
217
|
+
e: "right",
|
|
218
|
+
w: "left",
|
|
219
|
+
ne: "topRight",
|
|
220
|
+
se: "bottomRight",
|
|
221
|
+
sw: "bottomLeft",
|
|
222
|
+
nw: "topLeft"
|
|
223
|
+
}[a] ?? a, A = k === "right" || k === "topRight" || k === "bottomRight", E = k === "left" || k === "topLeft" || k === "bottomLeft", i = k === "bottom" || k === "bottomRight" || k === "bottomLeft", y = k === "top" || k === "topRight" || k === "topLeft", I = (O) => {
|
|
224
|
+
const q = O.clientX - r, b = O.clientY - Y;
|
|
225
|
+
let U = _, f = F;
|
|
226
|
+
A && (U = _ + q), E && (U = _ - q), i && (f = F + b), y && (f = F - b), U = Math.max(c, Math.min(l, U)), f = Math.max(o, Math.min(u, f)), T({ width: U, height: f }), p?.({ width: U, height: f });
|
|
227
|
+
}, z = () => {
|
|
228
|
+
document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", z);
|
|
229
|
+
};
|
|
230
|
+
document.addEventListener("pointermove", I), document.addEventListener("pointerup", z);
|
|
231
|
+
}, s = (a) => {
|
|
232
|
+
switch (a) {
|
|
233
|
+
case "top":
|
|
234
|
+
case "bottom":
|
|
235
|
+
return "ns-resize";
|
|
236
|
+
case "left":
|
|
237
|
+
case "right":
|
|
238
|
+
return "ew-resize";
|
|
239
|
+
case "topLeft":
|
|
240
|
+
case "bottomRight":
|
|
241
|
+
return "nwse-resize";
|
|
242
|
+
case "topRight":
|
|
243
|
+
case "bottomLeft":
|
|
244
|
+
return "nesw-resize";
|
|
245
|
+
default:
|
|
246
|
+
return "default";
|
|
247
|
+
}
|
|
248
|
+
}, w = (a) => {
|
|
249
|
+
const $ = { position: "absolute", zIndex: 1 }, r = 8;
|
|
250
|
+
return a === "right" ? {
|
|
251
|
+
...$,
|
|
252
|
+
top: 0,
|
|
253
|
+
right: -r / 2,
|
|
254
|
+
width: r,
|
|
255
|
+
height: "100%",
|
|
256
|
+
cursor: s(a)
|
|
257
|
+
} : a === "bottom" ? {
|
|
258
|
+
...$,
|
|
259
|
+
left: 0,
|
|
260
|
+
bottom: -r / 2,
|
|
261
|
+
width: "100%",
|
|
262
|
+
height: r,
|
|
263
|
+
cursor: s(a)
|
|
264
|
+
} : a === "left" ? { ...$, top: 0, left: -r / 2, width: r, height: "100%", cursor: s(a) } : a === "top" ? { ...$, top: -r / 2, left: 0, width: "100%", height: r, cursor: s(a) } : a === "bottomRight" ? {
|
|
265
|
+
...$,
|
|
266
|
+
bottom: -r / 2,
|
|
267
|
+
right: -r / 2,
|
|
268
|
+
width: r * 2,
|
|
269
|
+
height: r * 2,
|
|
270
|
+
cursor: s(a)
|
|
271
|
+
} : a === "bottomLeft" ? {
|
|
272
|
+
...$,
|
|
273
|
+
bottom: -r / 2,
|
|
274
|
+
left: -r / 2,
|
|
275
|
+
width: r * 2,
|
|
276
|
+
height: r * 2,
|
|
277
|
+
cursor: s(a)
|
|
278
|
+
} : a === "topRight" ? {
|
|
279
|
+
...$,
|
|
280
|
+
top: -r / 2,
|
|
281
|
+
right: -r / 2,
|
|
282
|
+
width: r * 2,
|
|
283
|
+
height: r * 2,
|
|
284
|
+
cursor: s(a)
|
|
285
|
+
} : a === "topLeft" ? {
|
|
286
|
+
...$,
|
|
287
|
+
top: -r / 2,
|
|
288
|
+
left: -r / 2,
|
|
289
|
+
width: r * 2,
|
|
290
|
+
height: r * 2,
|
|
291
|
+
cursor: s(a)
|
|
292
|
+
} : $;
|
|
293
|
+
};
|
|
294
|
+
return /* @__PURE__ */ R(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
ref: N,
|
|
298
|
+
"data-testid": S,
|
|
299
|
+
className: `nice-resizable ${x || ""}`,
|
|
300
|
+
style: {
|
|
301
|
+
...M,
|
|
302
|
+
width: C.width,
|
|
303
|
+
height: C.height,
|
|
304
|
+
position: "relative",
|
|
305
|
+
overflow: "hidden"
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
308
|
+
m,
|
|
309
|
+
d.map((a) => /* @__PURE__ */ t("div", { style: w(a), onPointerDown: ($) => h(a, $) }, a))
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
}, mn = ({
|
|
314
|
+
direction: e = "vertical",
|
|
315
|
+
showScrollbar: n = "onInteraction",
|
|
316
|
+
width: c,
|
|
317
|
+
height: o,
|
|
318
|
+
onScroll: l,
|
|
319
|
+
children: u,
|
|
320
|
+
className: d,
|
|
321
|
+
"data-testid": p,
|
|
322
|
+
style: m
|
|
323
|
+
}) => {
|
|
324
|
+
const x = e === "horizontal" || e === "both" ? "auto" : "hidden", S = e === "vertical" || e === "both" ? "auto" : "hidden";
|
|
325
|
+
return /* @__PURE__ */ t(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
"data-testid": p,
|
|
329
|
+
className: `nice-scrollview ${n === "never" ? "nice-scrollview--hide-sb" : n === "always" ? "nice-scrollview--show-sb" : ""} ${d || ""}`,
|
|
330
|
+
style: { ...m, width: c, height: o, overflowX: x, overflowY: S },
|
|
331
|
+
onScroll: l,
|
|
332
|
+
children: u
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
}, Dt = [];
|
|
336
|
+
function Pe() {
|
|
337
|
+
const e = it(It);
|
|
338
|
+
return e?.portalTarget ? e.portalTarget : typeof document < "u" ? document.body : null;
|
|
339
|
+
}
|
|
340
|
+
const hn = ({
|
|
341
|
+
open: e,
|
|
342
|
+
onClose: n,
|
|
343
|
+
children: c,
|
|
344
|
+
title: o,
|
|
345
|
+
size: l = "md",
|
|
346
|
+
closeOnBackdropClick: u = !0,
|
|
347
|
+
closeOnEscape: d = !0,
|
|
348
|
+
disableFocusTrap: p = !1,
|
|
349
|
+
disableBodyScroll: m = !0,
|
|
350
|
+
zIndex: x = 1e3,
|
|
351
|
+
className: S,
|
|
352
|
+
style: M
|
|
353
|
+
}) => {
|
|
354
|
+
const C = H(null);
|
|
355
|
+
ve(C, { open: e, modal: !p, onClose: n, closeOnEscape: d });
|
|
356
|
+
const T = Pe();
|
|
357
|
+
K(() => {
|
|
358
|
+
if (!m && e) {
|
|
359
|
+
const s = document.body.style.overflow;
|
|
360
|
+
return document.body.style.overflow = "hidden", () => {
|
|
361
|
+
document.body.style.overflow = s;
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}, [e, m]);
|
|
365
|
+
const N = v(
|
|
366
|
+
(s) => {
|
|
367
|
+
u && s.target === s.currentTarget && n();
|
|
368
|
+
},
|
|
369
|
+
[u, n]
|
|
370
|
+
);
|
|
371
|
+
if (!e)
|
|
372
|
+
return null;
|
|
373
|
+
const h = {
|
|
374
|
+
sm: "nice-modal--sm",
|
|
375
|
+
md: "nice-modal--md",
|
|
376
|
+
lg: "nice-modal--lg",
|
|
377
|
+
xl: "nice-modal--xl",
|
|
378
|
+
full: "nice-modal--full"
|
|
379
|
+
}[l];
|
|
380
|
+
return Se(
|
|
381
|
+
/* @__PURE__ */ t(
|
|
382
|
+
"div",
|
|
383
|
+
{
|
|
384
|
+
className: "nice-modal__overlay",
|
|
385
|
+
style: { zIndex: x },
|
|
386
|
+
onClick: N,
|
|
387
|
+
role: "presentation",
|
|
388
|
+
children: /* @__PURE__ */ t(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
ref: C,
|
|
392
|
+
className: `nice-modal ${h} ${S || ""}`,
|
|
393
|
+
role: "dialog",
|
|
394
|
+
"aria-modal": "true",
|
|
395
|
+
"aria-label": o,
|
|
396
|
+
style: M,
|
|
397
|
+
tabIndex: -1,
|
|
398
|
+
children: c
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
T
|
|
404
|
+
);
|
|
405
|
+
}, fn = ({
|
|
406
|
+
children: e,
|
|
407
|
+
showClose: n = !0,
|
|
408
|
+
onClose: c,
|
|
409
|
+
className: o
|
|
410
|
+
}) => {
|
|
411
|
+
const { t: l } = ze();
|
|
412
|
+
return /* @__PURE__ */ R("div", { className: `nice-modal__header ${o || ""}`, children: [
|
|
413
|
+
/* @__PURE__ */ t("div", { className: "nice-modal__title", children: e }),
|
|
414
|
+
n && c && /* @__PURE__ */ t(
|
|
415
|
+
"button",
|
|
416
|
+
{
|
|
417
|
+
type: "button",
|
|
418
|
+
className: "nice-modal__close",
|
|
419
|
+
onClick: c,
|
|
420
|
+
"aria-label": l("overlays.close", "Close"),
|
|
421
|
+
children: /* @__PURE__ */ t(ee, { name: "close", size: 20 })
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] });
|
|
425
|
+
}, pn = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__body ${n || ""}`, children: e }), wn = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__footer ${n || ""}`, children: e }), gn = ({
|
|
426
|
+
open: e,
|
|
427
|
+
onClose: n,
|
|
428
|
+
children: c,
|
|
429
|
+
position: o = "right",
|
|
430
|
+
size: l = 320,
|
|
431
|
+
title: u,
|
|
432
|
+
closeOnBackdropClick: d = !0,
|
|
433
|
+
closeOnEscape: p = !0,
|
|
434
|
+
swipeToClose: m = !0,
|
|
435
|
+
zIndex: x = 1e3,
|
|
436
|
+
className: S,
|
|
437
|
+
style: M
|
|
438
|
+
}) => {
|
|
439
|
+
const C = H(null), [T, N] = X(!1), [h, s] = X(0);
|
|
440
|
+
ve(C, { open: e, onClose: n, closeOnEscape: p });
|
|
441
|
+
const w = Pe(), a = v(
|
|
442
|
+
(k) => {
|
|
443
|
+
let A = 0;
|
|
444
|
+
switch (o) {
|
|
445
|
+
case "left":
|
|
446
|
+
A = Math.min(0, k.deltaX);
|
|
447
|
+
break;
|
|
448
|
+
case "right":
|
|
449
|
+
A = Math.max(0, k.deltaX);
|
|
450
|
+
break;
|
|
451
|
+
case "top":
|
|
452
|
+
A = Math.min(0, k.deltaY);
|
|
453
|
+
break;
|
|
454
|
+
case "bottom":
|
|
455
|
+
A = Math.max(0, k.deltaY);
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
s(A);
|
|
459
|
+
},
|
|
460
|
+
[o]
|
|
461
|
+
), $ = v(
|
|
462
|
+
(k) => {
|
|
463
|
+
let E = !1;
|
|
464
|
+
switch (o) {
|
|
465
|
+
case "left":
|
|
466
|
+
E = k.deltaX < -100;
|
|
467
|
+
break;
|
|
468
|
+
case "right":
|
|
469
|
+
E = k.deltaX > 100;
|
|
470
|
+
break;
|
|
471
|
+
case "top":
|
|
472
|
+
E = k.deltaY < -100;
|
|
473
|
+
break;
|
|
474
|
+
case "bottom":
|
|
475
|
+
E = k.deltaY > 100;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
E && (We("light"), n()), s(0), N(!1);
|
|
479
|
+
},
|
|
480
|
+
[o, n]
|
|
481
|
+
), { ref: r } = Et({
|
|
482
|
+
enabled: m && e,
|
|
483
|
+
onPanStart: () => N(!0),
|
|
484
|
+
onPan: a,
|
|
485
|
+
onPanEnd: $
|
|
486
|
+
}), Y = v(
|
|
487
|
+
(k) => {
|
|
488
|
+
d && k.target === k.currentTarget && n();
|
|
489
|
+
},
|
|
490
|
+
[d, n]
|
|
491
|
+
);
|
|
492
|
+
if (!e)
|
|
493
|
+
return null;
|
|
494
|
+
const _ = o === "left" || o === "right", F = _ ? { width: typeof l == "number" ? `${l}px` : l } : { height: typeof l == "number" ? `${l}px` : l }, Q = () => {
|
|
495
|
+
if (T)
|
|
496
|
+
return _ ? `translateX(${h}px)` : `translateY(${h}px)`;
|
|
497
|
+
};
|
|
498
|
+
return Se(
|
|
499
|
+
/* @__PURE__ */ R(Te, { children: [
|
|
500
|
+
/* @__PURE__ */ t(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
role: "presentation",
|
|
504
|
+
className: `nice-drawer__overlay ${e ? "nice-drawer__overlay--visible" : ""}`,
|
|
505
|
+
style: { zIndex: x },
|
|
506
|
+
onClick: Y
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
/* @__PURE__ */ t(
|
|
510
|
+
"div",
|
|
511
|
+
{
|
|
512
|
+
ref: (k) => {
|
|
513
|
+
C.current = k, r.current = k;
|
|
514
|
+
},
|
|
515
|
+
className: `nice-drawer nice-drawer--${o} ${e ? "nice-drawer--open" : ""} ${S || ""}`,
|
|
516
|
+
style: {
|
|
517
|
+
...F,
|
|
518
|
+
zIndex: x + 1,
|
|
519
|
+
transform: Q(),
|
|
520
|
+
transition: T ? "none" : void 0,
|
|
521
|
+
...M
|
|
522
|
+
},
|
|
523
|
+
role: "dialog",
|
|
524
|
+
"aria-modal": "true",
|
|
525
|
+
"aria-label": u,
|
|
526
|
+
tabIndex: -1,
|
|
527
|
+
children: c
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
] }),
|
|
531
|
+
w
|
|
532
|
+
);
|
|
533
|
+
}, _n = ({
|
|
534
|
+
open: e,
|
|
535
|
+
onClose: n,
|
|
536
|
+
children: c,
|
|
537
|
+
title: o,
|
|
538
|
+
showHandle: l = !0,
|
|
539
|
+
snapPoints: u = [0.5, 0.9],
|
|
540
|
+
initialSnap: d = 0,
|
|
541
|
+
expandable: p = !0,
|
|
542
|
+
closeOnBackdropClick: m = !0,
|
|
543
|
+
closeOnEscape: x = !0,
|
|
544
|
+
hapticFeedback: S = !0,
|
|
545
|
+
zIndex: M = 1e3,
|
|
546
|
+
className: C,
|
|
547
|
+
style: T
|
|
548
|
+
}) => {
|
|
549
|
+
const N = H(null), h = H(null), [s, w] = X(d), [a, $] = X(!1), [r, Y] = X(0), _ = H(0);
|
|
550
|
+
K(() => {
|
|
551
|
+
e && (w(d), Y(0));
|
|
552
|
+
}, [e, d]), ve(N, { open: e, onClose: n, closeOnEscape: x });
|
|
553
|
+
const F = Pe();
|
|
554
|
+
K(() => {
|
|
555
|
+
if (e) {
|
|
556
|
+
const I = document.body.style.overflow;
|
|
557
|
+
return document.body.style.overflow = "hidden", () => {
|
|
558
|
+
document.body.style.overflow = I;
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}, [e]);
|
|
562
|
+
const Q = v((I) => {
|
|
563
|
+
const z = I.target.closest(".nice-bottom-sheet__handle"), O = h.current, q = !O || O.scrollTop <= 0;
|
|
564
|
+
!z && !q || ($(!0), _.current = I.touches[0].clientY);
|
|
565
|
+
}, []), k = v(
|
|
566
|
+
(I) => {
|
|
567
|
+
if (!a)
|
|
568
|
+
return;
|
|
569
|
+
const z = I.touches[0].clientY - _.current;
|
|
570
|
+
(z > 0 || s < u.length - 1) && Y(z);
|
|
571
|
+
},
|
|
572
|
+
[a, s, u.length]
|
|
573
|
+
), A = v(() => {
|
|
574
|
+
if (!a)
|
|
575
|
+
return;
|
|
576
|
+
const I = window.innerHeight;
|
|
577
|
+
u[s] * I;
|
|
578
|
+
const z = -r, O = I * 0.15;
|
|
579
|
+
z > O && p && s < u.length - 1 ? (w(s + 1), S && We("selection")) : z < -O && (s > 0 ? (w(s - 1), S && We("selection")) : (S && We("light"), n())), $(!1), Y(0);
|
|
580
|
+
}, [a, r, s, u, p, S, n]), E = v(() => {
|
|
581
|
+
m && n();
|
|
582
|
+
}, [m, n]);
|
|
583
|
+
if (!e)
|
|
584
|
+
return null;
|
|
585
|
+
const i = u[s] * 100, y = a ? r : 0;
|
|
586
|
+
return Se(
|
|
587
|
+
/* @__PURE__ */ R(Te, { children: [
|
|
588
|
+
/* @__PURE__ */ t(
|
|
589
|
+
"div",
|
|
590
|
+
{
|
|
591
|
+
role: "presentation",
|
|
592
|
+
className: `nice-bottom-sheet__overlay ${e ? "nice-bottom-sheet__overlay--visible" : ""}`,
|
|
593
|
+
style: { zIndex: M },
|
|
594
|
+
onClick: E
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ R(
|
|
598
|
+
"div",
|
|
599
|
+
{
|
|
600
|
+
ref: N,
|
|
601
|
+
className: `nice-bottom-sheet ${e ? "nice-bottom-sheet--open" : ""} ${C || ""}`,
|
|
602
|
+
style: {
|
|
603
|
+
zIndex: M + 1,
|
|
604
|
+
height: `${i}vh`,
|
|
605
|
+
transform: `translateY(${Math.max(0, y)}px)`,
|
|
606
|
+
transition: a ? "none" : "transform 0.3s ease-out, height 0.3s ease-out",
|
|
607
|
+
...T
|
|
608
|
+
},
|
|
609
|
+
role: "dialog",
|
|
610
|
+
"aria-modal": "true",
|
|
611
|
+
"aria-label": o,
|
|
612
|
+
tabIndex: -1,
|
|
613
|
+
onTouchStart: Q,
|
|
614
|
+
onTouchMove: k,
|
|
615
|
+
onTouchEnd: A,
|
|
616
|
+
children: [
|
|
617
|
+
l && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
618
|
+
o && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__title", children: o }),
|
|
619
|
+
/* @__PURE__ */ t("div", { ref: h, className: "nice-bottom-sheet__content", children: c })
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
] }),
|
|
624
|
+
F
|
|
625
|
+
);
|
|
626
|
+
}, vn = ({
|
|
627
|
+
trigger: e,
|
|
628
|
+
children: n,
|
|
629
|
+
placement: c = "bottom",
|
|
630
|
+
triggerMode: o = "click",
|
|
631
|
+
open: l,
|
|
632
|
+
onOpenChange: u,
|
|
633
|
+
hoverDelay: d = 200,
|
|
634
|
+
offset: p = 8,
|
|
635
|
+
className: m,
|
|
636
|
+
showArrow: x = !0
|
|
637
|
+
}) => {
|
|
638
|
+
const [S, M] = X(!1), C = H(null), T = H(null), N = H(null), h = Pe(), s = l !== void 0, w = s ? l : S, a = v(
|
|
639
|
+
(E) => {
|
|
640
|
+
s || M(E), u?.(E);
|
|
641
|
+
},
|
|
642
|
+
[s, u]
|
|
643
|
+
);
|
|
644
|
+
st(T, () => {
|
|
645
|
+
o !== "manual" && w && a(!1);
|
|
646
|
+
});
|
|
647
|
+
const $ = o !== "hover";
|
|
648
|
+
ve(T, {
|
|
649
|
+
open: w && $,
|
|
650
|
+
modal: !1,
|
|
651
|
+
onClose: () => a(!1)
|
|
652
|
+
});
|
|
653
|
+
const r = v(() => {
|
|
654
|
+
o === "click" && a(!w);
|
|
655
|
+
}, [o, w, a]), Y = v(() => {
|
|
656
|
+
o === "hover" && (N.current && window.clearTimeout(N.current), N.current = window.setTimeout(() => a(!0), d));
|
|
657
|
+
}, [o, d, a]), _ = v(() => {
|
|
658
|
+
o === "hover" && (N.current && window.clearTimeout(N.current), N.current = window.setTimeout(() => a(!1), d));
|
|
659
|
+
}, [o, d, a]), F = v(
|
|
660
|
+
(E) => {
|
|
661
|
+
const i = E.relatedTarget;
|
|
662
|
+
!C.current?.contains(i) && !T.current?.contains(i) && _();
|
|
663
|
+
},
|
|
664
|
+
[_]
|
|
665
|
+
), Q = v(
|
|
666
|
+
(E) => {
|
|
667
|
+
o === "hover" && w && E.key === "Escape" && (E.preventDefault(), E.stopPropagation(), N.current && window.clearTimeout(N.current), a(!1));
|
|
668
|
+
},
|
|
669
|
+
[o, w, a]
|
|
670
|
+
), [k, A] = X({ top: 0, left: 0 });
|
|
671
|
+
return K(() => {
|
|
672
|
+
if (!w || !C.current || !T.current)
|
|
673
|
+
return;
|
|
674
|
+
const E = C.current.getBoundingClientRect(), i = T.current.getBoundingClientRect(), y = window.innerWidth, I = window.innerHeight;
|
|
675
|
+
let z = 0, O = 0;
|
|
676
|
+
const [q, b = "center"] = c.split("-");
|
|
677
|
+
switch (q) {
|
|
678
|
+
case "top":
|
|
679
|
+
z = E.top - i.height - p, O = E.left + (E.width - i.width) / 2;
|
|
680
|
+
break;
|
|
681
|
+
case "bottom":
|
|
682
|
+
z = E.bottom + p, O = E.left + (E.width - i.width) / 2;
|
|
683
|
+
break;
|
|
684
|
+
case "left":
|
|
685
|
+
z = E.top + (E.height - i.height) / 2, O = E.left - i.width - p;
|
|
686
|
+
break;
|
|
687
|
+
case "right":
|
|
688
|
+
z = E.top + (E.height - i.height) / 2, O = E.right + p;
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
q === "top" || q === "bottom" ? (b === "start" && (O = E.left), b === "end" && (O = E.right - i.width)) : (b === "start" && (z = E.top), b === "end" && (z = E.bottom - i.height)), O = Math.max(8, Math.min(y - i.width - 8, O)), z = Math.max(8, Math.min(I - i.height - 8, z)), A({ top: z, left: O });
|
|
692
|
+
}, [w, c, p]), /* @__PURE__ */ R(Te, { children: [
|
|
693
|
+
/* @__PURE__ */ t(
|
|
694
|
+
"div",
|
|
695
|
+
{
|
|
696
|
+
ref: C,
|
|
697
|
+
className: "nice-popover__trigger",
|
|
698
|
+
onClick: r,
|
|
699
|
+
onMouseEnter: Y,
|
|
700
|
+
onMouseLeave: _,
|
|
701
|
+
onFocus: Y,
|
|
702
|
+
onBlur: F,
|
|
703
|
+
onKeyDown: Q,
|
|
704
|
+
style: { display: "inline-block" },
|
|
705
|
+
children: e
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
w && Se(
|
|
709
|
+
/* @__PURE__ */ R(
|
|
710
|
+
"div",
|
|
711
|
+
{
|
|
712
|
+
ref: T,
|
|
713
|
+
className: `nice-popover nice-popover--${c} ${m || ""}`,
|
|
714
|
+
style: {
|
|
715
|
+
position: "fixed",
|
|
716
|
+
top: k.top,
|
|
717
|
+
left: k.left,
|
|
718
|
+
zIndex: 1100
|
|
719
|
+
},
|
|
720
|
+
onMouseEnter: Y,
|
|
721
|
+
onMouseLeave: _,
|
|
722
|
+
role: $ ? "dialog" : "tooltip",
|
|
723
|
+
children: [
|
|
724
|
+
x && /* @__PURE__ */ t("div", { className: "nice-popover__arrow" }),
|
|
725
|
+
/* @__PURE__ */ t("div", { className: "nice-popover__content", children: n })
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
h
|
|
730
|
+
)
|
|
731
|
+
] });
|
|
732
|
+
}, bn = ({
|
|
733
|
+
items: e = Dt,
|
|
734
|
+
children: n,
|
|
735
|
+
onOpen: c,
|
|
736
|
+
onClose: o,
|
|
737
|
+
className: l
|
|
738
|
+
}) => {
|
|
739
|
+
const [u, d] = X(!1), [p, m] = X({ x: 0, y: 0 }), x = H(null), S = H(null), M = Pe();
|
|
740
|
+
st(x, () => {
|
|
741
|
+
u && (d(!1), o?.());
|
|
742
|
+
});
|
|
743
|
+
const C = v(
|
|
744
|
+
(s) => {
|
|
745
|
+
if (s.preventDefault(), s.clientX === 0 && s.clientY === 0 && s.target instanceof Element) {
|
|
746
|
+
const w = s.target.getBoundingClientRect();
|
|
747
|
+
m({ x: w.left, y: w.bottom });
|
|
748
|
+
} else
|
|
749
|
+
m({ x: s.clientX, y: s.clientY });
|
|
750
|
+
d(!0), c?.();
|
|
751
|
+
},
|
|
752
|
+
[c]
|
|
753
|
+
), T = v(() => {
|
|
754
|
+
d(!1), o?.();
|
|
755
|
+
}, [o]), N = v(
|
|
756
|
+
(s) => {
|
|
757
|
+
!s.disabled && s.onClick && (s.onClick(), T());
|
|
758
|
+
},
|
|
759
|
+
[T]
|
|
760
|
+
);
|
|
761
|
+
ve(x, { open: u, modal: !1, onClose: T }), at(x, { orientation: "vertical", wrap: !0, typeahead: !0 });
|
|
762
|
+
const h = (s) => /* @__PURE__ */ t("ul", { className: "nice-context-menu__list", role: "menu", children: s.map((w) => w.divider ? /* @__PURE__ */ t("li", { className: "nice-context-menu__divider", role: "separator" }, w.key) : /* @__PURE__ */ t("li", { role: "presentation", children: /* @__PURE__ */ R(
|
|
763
|
+
"button",
|
|
764
|
+
{
|
|
765
|
+
type: "button",
|
|
766
|
+
className: `nice-context-menu__item ${w.disabled ? "nice-context-menu__item--disabled" : ""} ${w.danger ? "nice-context-menu__item--danger" : ""}`,
|
|
767
|
+
role: "menuitem",
|
|
768
|
+
disabled: w.disabled,
|
|
769
|
+
onClick: () => N(w),
|
|
770
|
+
children: [
|
|
771
|
+
w.icon && /* @__PURE__ */ t("span", { className: "nice-context-menu__icon", children: w.icon }),
|
|
772
|
+
/* @__PURE__ */ t("span", { className: "nice-context-menu__label", children: w.label })
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
) }, w.key)) });
|
|
776
|
+
return /* @__PURE__ */ R(Te, { children: [
|
|
777
|
+
/* @__PURE__ */ t("div", { ref: S, onContextMenu: C, style: { display: "contents" }, children: n }),
|
|
778
|
+
u && Se(
|
|
779
|
+
/* @__PURE__ */ t(
|
|
780
|
+
"div",
|
|
781
|
+
{
|
|
782
|
+
ref: x,
|
|
783
|
+
className: `nice-context-menu ${l || ""}`,
|
|
784
|
+
style: {
|
|
785
|
+
position: "fixed",
|
|
786
|
+
left: p.x,
|
|
787
|
+
top: p.y,
|
|
788
|
+
zIndex: 1200
|
|
789
|
+
},
|
|
790
|
+
children: h(e)
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
M
|
|
794
|
+
)
|
|
795
|
+
] });
|
|
796
|
+
};
|
|
797
|
+
function et(e, n) {
|
|
798
|
+
if (!e)
|
|
799
|
+
return { score: 1, indices: [] };
|
|
800
|
+
const c = e.toLowerCase(), o = n.toLowerCase();
|
|
801
|
+
let l = 0;
|
|
802
|
+
const u = [];
|
|
803
|
+
let d = 0, p = -1;
|
|
804
|
+
for (let m = 0; m < o.length && l < c.length; m++)
|
|
805
|
+
o[m] === c[l] && (u.push(m), p === m - 1 && (d += 3), (m === 0 || /[\s\-_/.]/.test(n[m - 1])) && (d += 5), n[m] === e[l] && (d += 1), d += 1, p = m, l++);
|
|
806
|
+
return l < c.length ? null : (d -= u[0] * 0.1, { score: d, indices: u });
|
|
807
|
+
}
|
|
808
|
+
function Xt(e, n) {
|
|
809
|
+
if (n.length === 0)
|
|
810
|
+
return [e];
|
|
811
|
+
const c = [];
|
|
812
|
+
let o = 0;
|
|
813
|
+
const l = new Set(n);
|
|
814
|
+
for (let u = 0; u < e.length; u++)
|
|
815
|
+
l.has(u) && (o < u && c.push(e.slice(o, u)), c.push(
|
|
816
|
+
St.createElement(
|
|
817
|
+
"mark",
|
|
818
|
+
{ key: `m-${u}`, className: "nice-command-palette__match" },
|
|
819
|
+
e[u]
|
|
820
|
+
)
|
|
821
|
+
), o = u + 1);
|
|
822
|
+
return o < e.length && c.push(e.slice(o)), c;
|
|
823
|
+
}
|
|
824
|
+
function Bt(e, n) {
|
|
825
|
+
switch (n.type) {
|
|
826
|
+
case "REGISTER": {
|
|
827
|
+
const c = new Map(e.commands);
|
|
828
|
+
return c.set(n.command.id, n.command), { ...e, commands: c };
|
|
829
|
+
}
|
|
830
|
+
case "REGISTER_BATCH": {
|
|
831
|
+
const c = new Map(e.commands);
|
|
832
|
+
for (const o of n.commands)
|
|
833
|
+
c.set(o.id, o);
|
|
834
|
+
return { ...e, commands: c };
|
|
835
|
+
}
|
|
836
|
+
case "UNREGISTER": {
|
|
837
|
+
const c = new Map(e.commands);
|
|
838
|
+
return c.delete(n.id), { ...e, commands: c };
|
|
839
|
+
}
|
|
840
|
+
case "OPEN":
|
|
841
|
+
return { ...e, isOpen: !0, query: "", selectedIndex: 0 };
|
|
842
|
+
case "CLOSE":
|
|
843
|
+
return { ...e, isOpen: !1, query: "", selectedIndex: 0 };
|
|
844
|
+
case "SET_QUERY":
|
|
845
|
+
return { ...e, query: n.query, selectedIndex: 0 };
|
|
846
|
+
case "SET_SELECTED":
|
|
847
|
+
return { ...e, selectedIndex: n.index };
|
|
848
|
+
case "ADD_RECENT": {
|
|
849
|
+
const c = e.recentIds.filter((o) => o !== n.id);
|
|
850
|
+
return {
|
|
851
|
+
...e,
|
|
852
|
+
recentIds: [n.id, ...c].slice(0, n.maxRecent)
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
default:
|
|
856
|
+
return e;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
const ut = /* @__PURE__ */ dt(
|
|
860
|
+
null
|
|
861
|
+
);
|
|
862
|
+
function Ht() {
|
|
863
|
+
const e = it(ut);
|
|
864
|
+
if (!e)
|
|
865
|
+
throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");
|
|
866
|
+
return e;
|
|
867
|
+
}
|
|
868
|
+
const At = ({
|
|
869
|
+
children: e,
|
|
870
|
+
commands: n,
|
|
871
|
+
placeholder: c,
|
|
872
|
+
maxVisible: o = 10,
|
|
873
|
+
maxRecent: l = 5,
|
|
874
|
+
className: u,
|
|
875
|
+
emptyText: d,
|
|
876
|
+
closeOnAction: p = !0,
|
|
877
|
+
onOpen: m,
|
|
878
|
+
onClose: x,
|
|
879
|
+
includeActions: S = !0
|
|
880
|
+
}) => {
|
|
881
|
+
const { t: M } = ze(), C = Tt(), T = M("commandPalette.general", "General"), N = Pe(), [h, s] = Pt(Bt, {
|
|
882
|
+
commands: new Map(n?.map((f) => [f.id, f]) ?? []),
|
|
883
|
+
isOpen: !1,
|
|
884
|
+
query: "",
|
|
885
|
+
selectedIndex: 0,
|
|
886
|
+
recentIds: []
|
|
887
|
+
}), w = H(null), a = H(null), [$, r] = X(!1), Y = v((f) => {
|
|
888
|
+
s({ type: "REGISTER", command: f });
|
|
889
|
+
}, []), _ = v((f) => {
|
|
890
|
+
s({ type: "UNREGISTER", id: f });
|
|
891
|
+
}, []), F = v((f) => {
|
|
892
|
+
s({ type: "REGISTER_BATCH", commands: f });
|
|
893
|
+
}, []), Q = v(() => {
|
|
894
|
+
s({ type: "OPEN" }), m?.();
|
|
895
|
+
}, [m]), k = v(() => {
|
|
896
|
+
s({ type: "CLOSE" }), x?.();
|
|
897
|
+
}, [x]), A = v(() => {
|
|
898
|
+
h.isOpen ? k() : Q();
|
|
899
|
+
}, [h.isOpen, k, Q]), E = Re(() => {
|
|
900
|
+
const f = new Map(h.commands);
|
|
901
|
+
if (S)
|
|
902
|
+
for (const P of C) {
|
|
903
|
+
const g = `action:${P.id}`;
|
|
904
|
+
P.palette === !1 || f.has(g) || f.set(g, {
|
|
905
|
+
id: g,
|
|
906
|
+
label: P.label,
|
|
907
|
+
description: P.description,
|
|
908
|
+
category: P.group,
|
|
909
|
+
shortcut: typeof P.keyboard == "string" ? P.keyboard : P.keyboard?.[0],
|
|
910
|
+
disabled: P.when ? !P.when() : !1,
|
|
911
|
+
action: () => {
|
|
912
|
+
zt(P.id, "keyboard");
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
return f;
|
|
917
|
+
}, [h.commands, C, S, h.isOpen]), y = Re(() => {
|
|
918
|
+
const f = Array.from(E.values()).filter((g) => !g.hidden);
|
|
919
|
+
if (!h.query.trim()) {
|
|
920
|
+
const g = h.recentIds.map((B) => E.get(B)).filter((B) => !!B && !B.hidden), V = f.filter((B) => !h.recentIds.includes(B.id));
|
|
921
|
+
return V.sort((B, ae) => B.label.localeCompare(ae.label)), [...g, ...V].map((B) => ({
|
|
922
|
+
command: B,
|
|
923
|
+
match: null,
|
|
924
|
+
isRecent: h.recentIds.includes(B.id)
|
|
925
|
+
}));
|
|
926
|
+
}
|
|
927
|
+
return f.map((g) => {
|
|
928
|
+
const V = et(h.query, g.label), B = g.description ? et(h.query, g.description) : null, ae = g.keywords?.map((re) => et(h.query, re)).filter(Boolean)[0] ?? null, ue = [V, B, ae].filter(Boolean).sort((re, be) => (be?.score ?? 0) - (re?.score ?? 0))[0] ?? null;
|
|
929
|
+
return { command: g, match: ue, isRecent: !1 };
|
|
930
|
+
}).filter((g) => g.match !== null).sort((g, V) => (V.match?.score ?? 0) - (g.match?.score ?? 0));
|
|
931
|
+
}, [E, h.query, h.recentIds]).slice(0, o), I = v(
|
|
932
|
+
async (f) => {
|
|
933
|
+
const P = E.get(f);
|
|
934
|
+
if (!(!P || P.disabled)) {
|
|
935
|
+
r(!0);
|
|
936
|
+
try {
|
|
937
|
+
await P.action(), s({ type: "ADD_RECENT", id: f, maxRecent: l });
|
|
938
|
+
} finally {
|
|
939
|
+
r(!1), p && k();
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
[E, l, p, k]
|
|
944
|
+
);
|
|
945
|
+
tt("menu", () => A());
|
|
946
|
+
const z = H(null);
|
|
947
|
+
ve(z, { open: h.isOpen, onClose: k, initialFocus: w }), tt(
|
|
948
|
+
["navigate", "activate"],
|
|
949
|
+
(f) => {
|
|
950
|
+
const P = y.length;
|
|
951
|
+
if (f.intent === "activate") {
|
|
952
|
+
const V = y[h.selectedIndex];
|
|
953
|
+
return V && I(V.command.id), !0;
|
|
954
|
+
}
|
|
955
|
+
if (!P || f.direction !== "up" && f.direction !== "down")
|
|
956
|
+
return !1;
|
|
957
|
+
const g = f.direction === "down" ? 1 : -1;
|
|
958
|
+
return s({ type: "SET_SELECTED", index: (h.selectedIndex + g + P) % P }), !0;
|
|
959
|
+
},
|
|
960
|
+
{ ref: z, enabled: h.isOpen }
|
|
961
|
+
), lt(
|
|
962
|
+
z,
|
|
963
|
+
h.isOpen ? [
|
|
964
|
+
{ intent: "navigate", label: M("commandPalette.choose", "Choose") },
|
|
965
|
+
{ intent: "activate", label: M("commandPalette.run", "Run") },
|
|
966
|
+
{ intent: "back", label: M("input.hint.close", "Close") }
|
|
967
|
+
] : []
|
|
968
|
+
);
|
|
969
|
+
const O = v(
|
|
970
|
+
(f) => {
|
|
971
|
+
const P = y.length;
|
|
972
|
+
if (P) {
|
|
973
|
+
if (f.key === "ArrowDown")
|
|
974
|
+
f.preventDefault(), s({ type: "SET_SELECTED", index: (h.selectedIndex + 1) % P });
|
|
975
|
+
else if (f.key === "ArrowUp")
|
|
976
|
+
f.preventDefault(), s({ type: "SET_SELECTED", index: (h.selectedIndex - 1 + P) % P });
|
|
977
|
+
else if (f.key === "Enter") {
|
|
978
|
+
f.preventDefault();
|
|
979
|
+
const g = y[h.selectedIndex];
|
|
980
|
+
g && I(g.command.id);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
[y, h.selectedIndex, I]
|
|
985
|
+
);
|
|
986
|
+
K(() => {
|
|
987
|
+
if (!a.current)
|
|
988
|
+
return;
|
|
989
|
+
a.current.children[h.selectedIndex]?.scrollIntoView?.({ block: "nearest" });
|
|
990
|
+
}, [h.selectedIndex]);
|
|
991
|
+
const q = Re(
|
|
992
|
+
() => ({
|
|
993
|
+
registerCommand: Y,
|
|
994
|
+
unregisterCommand: _,
|
|
995
|
+
registerCommands: F,
|
|
996
|
+
open: Q,
|
|
997
|
+
close: k,
|
|
998
|
+
toggle: A,
|
|
999
|
+
isOpen: h.isOpen,
|
|
1000
|
+
executeCommand: I
|
|
1001
|
+
}),
|
|
1002
|
+
[
|
|
1003
|
+
Y,
|
|
1004
|
+
_,
|
|
1005
|
+
F,
|
|
1006
|
+
Q,
|
|
1007
|
+
k,
|
|
1008
|
+
A,
|
|
1009
|
+
h.isOpen,
|
|
1010
|
+
I
|
|
1011
|
+
]
|
|
1012
|
+
), b = Re(() => {
|
|
1013
|
+
const f = /* @__PURE__ */ new Map();
|
|
1014
|
+
for (const P of y) {
|
|
1015
|
+
const g = P.command.category ?? T;
|
|
1016
|
+
f.has(g) || f.set(g, []), f.get(g).push(P);
|
|
1017
|
+
}
|
|
1018
|
+
return f;
|
|
1019
|
+
}, [y, T]);
|
|
1020
|
+
let U = 0;
|
|
1021
|
+
return /* @__PURE__ */ R(ut.Provider, { value: q, children: [
|
|
1022
|
+
e,
|
|
1023
|
+
h.isOpen && Se(
|
|
1024
|
+
/* @__PURE__ */ t(
|
|
1025
|
+
"div",
|
|
1026
|
+
{
|
|
1027
|
+
className: `nice-command-palette__overlay ${u ?? ""}`,
|
|
1028
|
+
role: "presentation",
|
|
1029
|
+
onClick: (f) => {
|
|
1030
|
+
f.stopPropagation(), f.target === f.currentTarget && k();
|
|
1031
|
+
},
|
|
1032
|
+
children: /* @__PURE__ */ R(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
ref: z,
|
|
1036
|
+
className: "nice-command-palette",
|
|
1037
|
+
role: "dialog",
|
|
1038
|
+
"aria-label": M("commandPalette.title", "Command palette"),
|
|
1039
|
+
"aria-modal": "true",
|
|
1040
|
+
children: [
|
|
1041
|
+
/* @__PURE__ */ t("div", { className: "nice-command-palette__input-wrapper", children: /* @__PURE__ */ t(
|
|
1042
|
+
"input",
|
|
1043
|
+
{
|
|
1044
|
+
ref: w,
|
|
1045
|
+
className: "nice-command-palette__input",
|
|
1046
|
+
type: "text",
|
|
1047
|
+
placeholder: c ?? M("commandPalette.placeholder", "Type a command..."),
|
|
1048
|
+
value: h.query,
|
|
1049
|
+
onChange: (f) => s({ type: "SET_QUERY", query: f.target.value }),
|
|
1050
|
+
onKeyDown: O,
|
|
1051
|
+
"aria-label": M("commandPalette.search", "Search commands"),
|
|
1052
|
+
"aria-autocomplete": "list",
|
|
1053
|
+
"aria-controls": "nice-command-palette-list",
|
|
1054
|
+
"aria-activedescendant": y[h.selectedIndex] ? `nice-cmd-${y[h.selectedIndex].command.id}` : void 0
|
|
1055
|
+
}
|
|
1056
|
+
) }),
|
|
1057
|
+
/* @__PURE__ */ R(
|
|
1058
|
+
"div",
|
|
1059
|
+
{
|
|
1060
|
+
ref: a,
|
|
1061
|
+
id: "nice-command-palette-list",
|
|
1062
|
+
className: "nice-command-palette__list",
|
|
1063
|
+
role: "listbox",
|
|
1064
|
+
children: [
|
|
1065
|
+
y.length === 0 && /* @__PURE__ */ t("div", { className: "nice-command-palette__empty", children: d ?? M("commandPalette.empty", "No commands found") }),
|
|
1066
|
+
Array.from(b.entries()).map(([f, P]) => /* @__PURE__ */ R("div", { className: "nice-command-palette__group", children: [
|
|
1067
|
+
/* @__PURE__ */ t("div", { className: "nice-command-palette__category", children: f }),
|
|
1068
|
+
P.map((g) => {
|
|
1069
|
+
const V = U++, B = V === h.selectedIndex;
|
|
1070
|
+
return (
|
|
1071
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events -- keys: the search field (aria-activedescendant)
|
|
1072
|
+
/* @__PURE__ */ R(
|
|
1073
|
+
"div",
|
|
1074
|
+
{
|
|
1075
|
+
id: `nice-cmd-${g.command.id}`,
|
|
1076
|
+
className: `nice-command-palette__item ${B ? "nice-command-palette__item--selected" : ""} ${g.command.disabled ? "nice-command-palette__item--disabled" : ""}`,
|
|
1077
|
+
role: "option",
|
|
1078
|
+
"aria-selected": B,
|
|
1079
|
+
"aria-disabled": g.command.disabled,
|
|
1080
|
+
onClick: () => !g.command.disabled && I(g.command.id),
|
|
1081
|
+
onMouseEnter: () => s({ type: "SET_SELECTED", index: V }),
|
|
1082
|
+
children: [
|
|
1083
|
+
g.command.icon && /* @__PURE__ */ t("span", { className: "nice-command-palette__icon", children: g.command.icon }),
|
|
1084
|
+
/* @__PURE__ */ R("div", { className: "nice-command-palette__label-group", children: [
|
|
1085
|
+
/* @__PURE__ */ t("span", { className: "nice-command-palette__label", children: g.match && h.query ? Xt(g.command.label, g.match.indices) : g.command.label }),
|
|
1086
|
+
g.command.description && /* @__PURE__ */ t("span", { className: "nice-command-palette__description", children: g.command.description })
|
|
1087
|
+
] }),
|
|
1088
|
+
g.command.shortcut && /* @__PURE__ */ t("kbd", { className: "nice-command-palette__shortcut", children: g.command.shortcut }),
|
|
1089
|
+
g.isRecent && /* @__PURE__ */ t("span", { className: "nice-command-palette__recent-badge", children: M("commandPalette.recent", "Recent") })
|
|
1090
|
+
]
|
|
1091
|
+
},
|
|
1092
|
+
g.command.id
|
|
1093
|
+
)
|
|
1094
|
+
);
|
|
1095
|
+
})
|
|
1096
|
+
] }, f))
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
),
|
|
1100
|
+
$ && /* @__PURE__ */ t("div", { className: "nice-command-palette__executing", children: M("commandPalette.executing", "Executing...") })
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
)
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
N
|
|
1107
|
+
)
|
|
1108
|
+
] });
|
|
1109
|
+
};
|
|
1110
|
+
process.env.NODE_ENV !== "production" && (At.displayName = "NiceCommandPaletteProvider");
|
|
1111
|
+
function yn(e) {
|
|
1112
|
+
const { registerCommands: n, unregisterCommand: c } = Ht();
|
|
1113
|
+
K(() => (n(e), () => {
|
|
1114
|
+
for (const o of e)
|
|
1115
|
+
c(o.id);
|
|
1116
|
+
}), []);
|
|
1117
|
+
}
|
|
1118
|
+
const xn = /* @__PURE__ */ Object.assign(
|
|
1119
|
+
/* @__PURE__ */ ot(
|
|
1120
|
+
({
|
|
1121
|
+
blocked: e,
|
|
1122
|
+
message: n,
|
|
1123
|
+
spinner: c,
|
|
1124
|
+
blur: o,
|
|
1125
|
+
children: l,
|
|
1126
|
+
className: u,
|
|
1127
|
+
"data-testid": d,
|
|
1128
|
+
style: p,
|
|
1129
|
+
id: m
|
|
1130
|
+
}, x) => {
|
|
1131
|
+
const S = nt(m);
|
|
1132
|
+
return /* @__PURE__ */ R(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
ref: x,
|
|
1136
|
+
id: S,
|
|
1137
|
+
className: `nice-block-ui ${u || ""}`,
|
|
1138
|
+
style: { position: "relative", ...p },
|
|
1139
|
+
"data-testid": d,
|
|
1140
|
+
children: [
|
|
1141
|
+
l,
|
|
1142
|
+
e && /* @__PURE__ */ t(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
className: `nice-block-ui__overlay${o ? " nice-block-ui__overlay--blur" : ""}`,
|
|
1146
|
+
"aria-busy": "true",
|
|
1147
|
+
role: "alert",
|
|
1148
|
+
children: (c || n) && /* @__PURE__ */ R("div", { className: "nice-block-ui__content", children: [
|
|
1149
|
+
c && /* @__PURE__ */ t("div", { className: "nice-block-ui__spinner", "aria-hidden": "true" }),
|
|
1150
|
+
n && /* @__PURE__ */ t("div", { className: "nice-block-ui__message", children: n })
|
|
1151
|
+
] })
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
]
|
|
1155
|
+
}
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1158
|
+
),
|
|
1159
|
+
{ displayName: "NiceBlockUI" }
|
|
1160
|
+
), Nn = /* @__PURE__ */ Object.assign(
|
|
1161
|
+
/* @__PURE__ */ ot(
|
|
1162
|
+
({
|
|
1163
|
+
windows: e,
|
|
1164
|
+
children: n,
|
|
1165
|
+
onChange: c,
|
|
1166
|
+
onClose: o,
|
|
1167
|
+
onFocus: l,
|
|
1168
|
+
showTaskbar: u = !0,
|
|
1169
|
+
size: d = "md",
|
|
1170
|
+
className: p,
|
|
1171
|
+
style: m,
|
|
1172
|
+
id: x,
|
|
1173
|
+
...S
|
|
1174
|
+
}, M) => {
|
|
1175
|
+
const C = nt(x), { t: T } = ze(), [N, h] = X(null), s = H(null), w = H(null);
|
|
1176
|
+
at(w, {
|
|
1177
|
+
orientation: "horizontal",
|
|
1178
|
+
itemSelector: ".nice-wm__taskbar-btn"
|
|
1179
|
+
});
|
|
1180
|
+
const a = H(null), $ = v((i) => {
|
|
1181
|
+
const y = [
|
|
1182
|
+
...s.current?.querySelectorAll("[data-wm-key]") ?? []
|
|
1183
|
+
].find((I) => I.getAttribute("data-wm-key") === i);
|
|
1184
|
+
return y ? ((Mt(y)[0] ?? y).focus(), !0) : !1;
|
|
1185
|
+
}, []);
|
|
1186
|
+
K(() => {
|
|
1187
|
+
const i = a.current;
|
|
1188
|
+
i && $(i) && (a.current = null);
|
|
1189
|
+
});
|
|
1190
|
+
const r = Re(() => e ?? [], [e]), Y = Math.max(1, ...r.map((i) => i.zIndex ?? 1)), _ = v(
|
|
1191
|
+
(i, y) => {
|
|
1192
|
+
const I = r.map((z) => z.key === i ? { ...z, ...y } : z);
|
|
1193
|
+
c?.(I);
|
|
1194
|
+
},
|
|
1195
|
+
[r, c]
|
|
1196
|
+
), F = v(
|
|
1197
|
+
(i) => {
|
|
1198
|
+
_(i, { zIndex: Y + 1 }), l?.(i);
|
|
1199
|
+
},
|
|
1200
|
+
[_, Y, l]
|
|
1201
|
+
), Q = v(
|
|
1202
|
+
(i) => {
|
|
1203
|
+
o?.(i), c?.(r.filter((y) => y.key !== i));
|
|
1204
|
+
},
|
|
1205
|
+
[r, c, o]
|
|
1206
|
+
), k = v(
|
|
1207
|
+
(i) => {
|
|
1208
|
+
const y = r.find((I) => I.key === i);
|
|
1209
|
+
y && _(i, { minimized: !y.minimized, maximized: !1 });
|
|
1210
|
+
},
|
|
1211
|
+
[r, _]
|
|
1212
|
+
), A = v(
|
|
1213
|
+
(i) => {
|
|
1214
|
+
const y = r.find((I) => I.key === i);
|
|
1215
|
+
y && _(i, { maximized: !y.maximized, minimized: !1 });
|
|
1216
|
+
},
|
|
1217
|
+
[r, _]
|
|
1218
|
+
);
|
|
1219
|
+
K(() => {
|
|
1220
|
+
if (!N)
|
|
1221
|
+
return;
|
|
1222
|
+
const i = (I) => {
|
|
1223
|
+
const z = r.find((O) => O.key === N.key);
|
|
1224
|
+
if (z)
|
|
1225
|
+
if (N.mode === "move")
|
|
1226
|
+
_(N.key, {
|
|
1227
|
+
x: I.clientX - N.offsetX,
|
|
1228
|
+
y: I.clientY - N.offsetY
|
|
1229
|
+
});
|
|
1230
|
+
else {
|
|
1231
|
+
const q = s.current?.getBoundingClientRect(), b = q?.left ?? 0, U = q?.top ?? 0;
|
|
1232
|
+
_(N.key, {
|
|
1233
|
+
width: Math.max(200, I.clientX - b - z.x),
|
|
1234
|
+
height: Math.max(100, I.clientY - U - z.y)
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
}, y = () => h(null);
|
|
1238
|
+
return document.addEventListener("mousemove", i), document.addEventListener("mouseup", y), () => {
|
|
1239
|
+
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", y);
|
|
1240
|
+
};
|
|
1241
|
+
}, [N, r, _]);
|
|
1242
|
+
const E = v(
|
|
1243
|
+
(i, y, I) => {
|
|
1244
|
+
y.preventDefault();
|
|
1245
|
+
const z = r.find((O) => O.key === i);
|
|
1246
|
+
z && (F(i), h({
|
|
1247
|
+
key: i,
|
|
1248
|
+
offsetX: I === "move" ? y.clientX - z.x : 0,
|
|
1249
|
+
offsetY: I === "move" ? y.clientY - z.y : 0,
|
|
1250
|
+
mode: I
|
|
1251
|
+
}));
|
|
1252
|
+
},
|
|
1253
|
+
[r, F]
|
|
1254
|
+
);
|
|
1255
|
+
return /* @__PURE__ */ R(
|
|
1256
|
+
"div",
|
|
1257
|
+
{
|
|
1258
|
+
ref: (i) => {
|
|
1259
|
+
s.current = i, typeof M == "function" ? M(i) : M && (M.current = i);
|
|
1260
|
+
},
|
|
1261
|
+
id: C,
|
|
1262
|
+
className: `nice-wm nice-wm--${d} ${p ?? ""}`,
|
|
1263
|
+
style: { ...m, position: "relative", overflow: "hidden" },
|
|
1264
|
+
...S,
|
|
1265
|
+
children: [
|
|
1266
|
+
r.map((i) => {
|
|
1267
|
+
if (i.minimized)
|
|
1268
|
+
return null;
|
|
1269
|
+
const y = i.maximized, I = y ? {
|
|
1270
|
+
position: "absolute",
|
|
1271
|
+
top: 0,
|
|
1272
|
+
left: 0,
|
|
1273
|
+
width: "100%",
|
|
1274
|
+
height: "100%",
|
|
1275
|
+
zIndex: i.zIndex ?? 1
|
|
1276
|
+
} : {
|
|
1277
|
+
position: "absolute",
|
|
1278
|
+
top: i.y,
|
|
1279
|
+
left: i.x,
|
|
1280
|
+
width: i.width,
|
|
1281
|
+
height: i.height,
|
|
1282
|
+
zIndex: i.zIndex ?? 1
|
|
1283
|
+
};
|
|
1284
|
+
return (
|
|
1285
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a press raises the window; focus moving in does it from the keyboard
|
|
1286
|
+
/* @__PURE__ */ R(
|
|
1287
|
+
"div",
|
|
1288
|
+
{
|
|
1289
|
+
className: `nice-wm__window ${y ? "nice-wm__window--maximized" : ""}`,
|
|
1290
|
+
style: I,
|
|
1291
|
+
onMouseDown: () => F(i.key),
|
|
1292
|
+
onFocus: () => {
|
|
1293
|
+
(i.zIndex ?? 1) < Y && F(i.key);
|
|
1294
|
+
},
|
|
1295
|
+
role: "dialog",
|
|
1296
|
+
"aria-label": i.title,
|
|
1297
|
+
tabIndex: -1,
|
|
1298
|
+
"data-wm-key": i.key,
|
|
1299
|
+
"data-nice-focus-scope": "spatial",
|
|
1300
|
+
"data-nice-region": i.title,
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ R(
|
|
1303
|
+
"div",
|
|
1304
|
+
{
|
|
1305
|
+
className: "nice-wm__titlebar",
|
|
1306
|
+
onMouseDown: (z) => !y && E(i.key, z, "move"),
|
|
1307
|
+
children: [
|
|
1308
|
+
i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__icon", children: i.icon }),
|
|
1309
|
+
/* @__PURE__ */ t("span", { className: "nice-wm__title", children: i.title }),
|
|
1310
|
+
/* @__PURE__ */ R("div", { className: "nice-wm__controls", children: [
|
|
1311
|
+
(i.minimizable ?? !0) && /* @__PURE__ */ t(
|
|
1312
|
+
"button",
|
|
1313
|
+
{
|
|
1314
|
+
type: "button",
|
|
1315
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min",
|
|
1316
|
+
onClick: () => k(i.key),
|
|
1317
|
+
title: T("wm.minimize", "Minimize"),
|
|
1318
|
+
children: /* @__PURE__ */ t(ee, { name: "minus", size: 14 })
|
|
1319
|
+
}
|
|
1320
|
+
),
|
|
1321
|
+
(i.maximizable ?? !0) && /* @__PURE__ */ t(
|
|
1322
|
+
"button",
|
|
1323
|
+
{
|
|
1324
|
+
type: "button",
|
|
1325
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max",
|
|
1326
|
+
onClick: () => A(i.key),
|
|
1327
|
+
title: T("wm.maximize", "Maximize"),
|
|
1328
|
+
children: /* @__PURE__ */ t(ee, { name: y ? "copy" : "window", size: 14 })
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
(i.closable ?? !0) && /* @__PURE__ */ t(
|
|
1332
|
+
"button",
|
|
1333
|
+
{
|
|
1334
|
+
type: "button",
|
|
1335
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close",
|
|
1336
|
+
onClick: () => Q(i.key),
|
|
1337
|
+
title: T("wm.close", "Close"),
|
|
1338
|
+
children: /* @__PURE__ */ t(ee, { name: "close", size: 14 })
|
|
1339
|
+
}
|
|
1340
|
+
)
|
|
1341
|
+
] })
|
|
1342
|
+
]
|
|
1343
|
+
}
|
|
1344
|
+
),
|
|
1345
|
+
/* @__PURE__ */ t("div", { className: "nice-wm__body", children: i.content }),
|
|
1346
|
+
(i.resizable ?? !0) && !y && /* @__PURE__ */ t(
|
|
1347
|
+
"div",
|
|
1348
|
+
{
|
|
1349
|
+
className: "nice-wm__resize-handle",
|
|
1350
|
+
onMouseDown: (z) => E(i.key, z, "resize")
|
|
1351
|
+
}
|
|
1352
|
+
)
|
|
1353
|
+
]
|
|
1354
|
+
},
|
|
1355
|
+
i.key
|
|
1356
|
+
)
|
|
1357
|
+
);
|
|
1358
|
+
}),
|
|
1359
|
+
e === void 0 && n,
|
|
1360
|
+
u && /* @__PURE__ */ t(
|
|
1361
|
+
"div",
|
|
1362
|
+
{
|
|
1363
|
+
ref: w,
|
|
1364
|
+
className: "nice-wm__taskbar",
|
|
1365
|
+
role: "toolbar",
|
|
1366
|
+
"aria-label": T("wm.taskbar", "Taskbar"),
|
|
1367
|
+
"data-nice-region": T("wm.taskbar", "Taskbar"),
|
|
1368
|
+
children: r.map((i) => /* @__PURE__ */ R(
|
|
1369
|
+
"button",
|
|
1370
|
+
{
|
|
1371
|
+
type: "button",
|
|
1372
|
+
className: `nice-wm__taskbar-btn ${i.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
|
|
1373
|
+
onClick: () => {
|
|
1374
|
+
i.minimized && k(i.key), F(i.key), (i.minimized || !$(i.key)) && (a.current = i.key);
|
|
1375
|
+
},
|
|
1376
|
+
children: [
|
|
1377
|
+
i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__taskbar-icon", children: i.icon }),
|
|
1378
|
+
/* @__PURE__ */ t("span", { className: "nice-wm__taskbar-label", children: i.title })
|
|
1379
|
+
]
|
|
1380
|
+
},
|
|
1381
|
+
i.key
|
|
1382
|
+
))
|
|
1383
|
+
}
|
|
1384
|
+
)
|
|
1385
|
+
]
|
|
1386
|
+
}
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
),
|
|
1390
|
+
{ displayName: "NiceWindowManager" }
|
|
1391
|
+
);
|
|
1392
|
+
function Ft(e, n) {
|
|
1393
|
+
const c = document.querySelector(e);
|
|
1394
|
+
if (!c)
|
|
1395
|
+
return null;
|
|
1396
|
+
const o = c.getBoundingClientRect();
|
|
1397
|
+
return {
|
|
1398
|
+
top: o.top - n + window.scrollY,
|
|
1399
|
+
left: o.left - n + window.scrollX,
|
|
1400
|
+
width: o.width + n * 2,
|
|
1401
|
+
height: o.height + n * 2
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
function qt(e, n, c, o) {
|
|
1405
|
+
const u = { w: window.innerWidth, h: window.innerHeight + window.scrollY }, d = {
|
|
1406
|
+
top: {
|
|
1407
|
+
top: e.top - c - 12,
|
|
1408
|
+
left: e.left + e.width / 2 - n / 2
|
|
1409
|
+
},
|
|
1410
|
+
bottom: {
|
|
1411
|
+
top: e.top + e.height + 12,
|
|
1412
|
+
left: e.left + e.width / 2 - n / 2
|
|
1413
|
+
},
|
|
1414
|
+
left: {
|
|
1415
|
+
top: e.top + e.height / 2 - c / 2,
|
|
1416
|
+
left: e.left - n - 12
|
|
1417
|
+
},
|
|
1418
|
+
right: {
|
|
1419
|
+
top: e.top + e.height / 2 - c / 2,
|
|
1420
|
+
left: e.left + e.width + 12
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
if (o && o !== "auto")
|
|
1424
|
+
return { ...d[o], actualPlacement: o };
|
|
1425
|
+
for (const p of ["bottom", "top", "right", "left"]) {
|
|
1426
|
+
const m = d[p];
|
|
1427
|
+
if (m.top >= 0 && m.left >= 0 && m.top + c <= u.h && m.left + n <= u.w)
|
|
1428
|
+
return { ...m, actualPlacement: p };
|
|
1429
|
+
}
|
|
1430
|
+
return { ...d.bottom, actualPlacement: "bottom" };
|
|
1431
|
+
}
|
|
1432
|
+
function Wt() {
|
|
1433
|
+
return /* @__PURE__ */ t(ee, { name: "close", size: 16 });
|
|
1434
|
+
}
|
|
1435
|
+
function Ut() {
|
|
1436
|
+
return /* @__PURE__ */ t(ee, { name: "chevron-left", size: 16 });
|
|
1437
|
+
}
|
|
1438
|
+
function jt() {
|
|
1439
|
+
return /* @__PURE__ */ t(ee, { name: "chevron-right", size: 16 });
|
|
1440
|
+
}
|
|
1441
|
+
function Kt() {
|
|
1442
|
+
return /* @__PURE__ */ t(ee, { name: "skip-forward", size: 16 });
|
|
1443
|
+
}
|
|
1444
|
+
function Vt() {
|
|
1445
|
+
return /* @__PURE__ */ t(ee, { name: "play", size: 16 });
|
|
1446
|
+
}
|
|
1447
|
+
function Gt() {
|
|
1448
|
+
return /* @__PURE__ */ t(ee, { name: "pause", size: 16 });
|
|
1449
|
+
}
|
|
1450
|
+
function qe(e, n, c) {
|
|
1451
|
+
return c === "text" ? /* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n }) : c === "icon-text" ? /* @__PURE__ */ R(Te, { children: [
|
|
1452
|
+
e,
|
|
1453
|
+
/* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n })
|
|
1454
|
+
] }) : e;
|
|
1455
|
+
}
|
|
1456
|
+
const Qt = [], mt = ({
|
|
1457
|
+
steps: e = Qt,
|
|
1458
|
+
active: n,
|
|
1459
|
+
onFinish: c,
|
|
1460
|
+
onSkip: o,
|
|
1461
|
+
onStepChange: l,
|
|
1462
|
+
closeOnEscape: u = !0,
|
|
1463
|
+
closeOnOverlayClick: d = !1,
|
|
1464
|
+
showProgress: p = !0,
|
|
1465
|
+
showSkipButton: m = !0,
|
|
1466
|
+
labels: x,
|
|
1467
|
+
animationDuration: S = 300,
|
|
1468
|
+
overlayOpacity: M = 0.6,
|
|
1469
|
+
zIndex: C = 1e4,
|
|
1470
|
+
buttonsPlacement: T = "floating-bottom",
|
|
1471
|
+
buttonsDisplay: N = "icon",
|
|
1472
|
+
showAutoplay: h = !0,
|
|
1473
|
+
autoplayInterval: s = 5e3,
|
|
1474
|
+
autoplaySpeedRange: w = { min: 2e3, max: 15e3 },
|
|
1475
|
+
onAutoplayChange: a
|
|
1476
|
+
}) => {
|
|
1477
|
+
const { t: $ } = ze(), [r, Y] = X(0), [_, F] = X(null), [Q, k] = X({ w: 340, h: 200 }), [A, E] = X(!0), [i, y] = X(!1), [I, z] = X(s), O = H(null), q = H(-1), b = e[r], U = r === e.length - 1, f = r === 0, P = x?.next ?? "Next", g = x?.back ?? "Back", V = x?.finish ?? "Finish", B = x?.skip ?? "Skip", ae = x?.stepOf ?? "of", ue = x?.play ?? "Play", re = x?.pause ?? "Pause", be = x?.speed ?? "Speed", Be = x?.close ?? "Close";
|
|
1478
|
+
K(() => {
|
|
1479
|
+
n && (Y(0), y(!1), z(s));
|
|
1480
|
+
}, [n, s]), K(() => {
|
|
1481
|
+
if (O.current) {
|
|
1482
|
+
const L = O.current.getBoundingClientRect();
|
|
1483
|
+
k({ w: L.width, h: L.height });
|
|
1484
|
+
}
|
|
1485
|
+
}, [r, n]), K(() => {
|
|
1486
|
+
if (!n || !b)
|
|
1487
|
+
return;
|
|
1488
|
+
const L = b.highlightPadding ?? 0, W = () => {
|
|
1489
|
+
const Z = Ft(b.target, L);
|
|
1490
|
+
F(Z);
|
|
1491
|
+
};
|
|
1492
|
+
if (W(), b.scrollIntoView !== !1) {
|
|
1493
|
+
document.querySelector(b.target)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1494
|
+
const Ye = setTimeout(W, 350);
|
|
1495
|
+
return () => clearTimeout(Ye);
|
|
1496
|
+
}
|
|
1497
|
+
}, [n, b, r]), K(() => {
|
|
1498
|
+
!n || !b || q.current !== r && (q.current >= 0 && q.current < e.length && e[q.current]?.onLeave?.(), b.onEnter?.(), q.current = r);
|
|
1499
|
+
}, [n, b, r, e]);
|
|
1500
|
+
const le = v(() => {
|
|
1501
|
+
if (U)
|
|
1502
|
+
b?.onLeave?.(), c?.();
|
|
1503
|
+
else {
|
|
1504
|
+
const L = r + 1;
|
|
1505
|
+
Y(L), l?.(L);
|
|
1506
|
+
}
|
|
1507
|
+
}, [r, U, c, l, b]), ye = v(() => {
|
|
1508
|
+
if (!f) {
|
|
1509
|
+
const L = r - 1;
|
|
1510
|
+
Y(L), l?.(L);
|
|
1511
|
+
}
|
|
1512
|
+
}, [r, f, l]), He = v(
|
|
1513
|
+
(L) => {
|
|
1514
|
+
L !== r && L >= 0 && L < e.length && (Y(L), l?.(L));
|
|
1515
|
+
},
|
|
1516
|
+
[r, e.length, l]
|
|
1517
|
+
);
|
|
1518
|
+
K(() => {
|
|
1519
|
+
if (!n || !b?.advanceOn)
|
|
1520
|
+
return;
|
|
1521
|
+
const L = document.querySelector(b.target);
|
|
1522
|
+
if (!L)
|
|
1523
|
+
return;
|
|
1524
|
+
const W = () => le();
|
|
1525
|
+
return L.addEventListener(b.advanceOn.event, W), () => L.removeEventListener(b.advanceOn.event, W);
|
|
1526
|
+
}, [n, b, r, le]);
|
|
1527
|
+
const xe = H(null), J = !!(n && b);
|
|
1528
|
+
ve(xe, {
|
|
1529
|
+
open: J,
|
|
1530
|
+
modal: !(b?.waitForAction || b?.advanceOn),
|
|
1531
|
+
onClose: () => o?.(),
|
|
1532
|
+
closeOnEscape: u,
|
|
1533
|
+
closeHint: B
|
|
1534
|
+
}), K(() => {
|
|
1535
|
+
const L = xe.current;
|
|
1536
|
+
if (!J || !L)
|
|
1537
|
+
return;
|
|
1538
|
+
const W = (Z) => {
|
|
1539
|
+
if (!(Z.defaultPrevented || Z.target instanceof HTMLInputElement)) {
|
|
1540
|
+
if (Z.key === "ArrowRight")
|
|
1541
|
+
le();
|
|
1542
|
+
else if (Z.key === "ArrowLeft")
|
|
1543
|
+
ye();
|
|
1544
|
+
else if (Z.key === "Home" || Z.key === "End")
|
|
1545
|
+
He(Z.key === "Home" ? 0 : e.length - 1);
|
|
1546
|
+
else
|
|
1547
|
+
return;
|
|
1548
|
+
Z.preventDefault();
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
return L.addEventListener("keydown", W), () => L.removeEventListener("keydown", W);
|
|
1552
|
+
}, [J, le, ye, He, e.length]);
|
|
1553
|
+
const Me = Ct(), j = J ? b?.title : void 0;
|
|
1554
|
+
K(() => {
|
|
1555
|
+
j && r > 0 && Me?.announce(j);
|
|
1556
|
+
}, [Me, j, r]);
|
|
1557
|
+
const Le = Lt(), Ae = `${Le}-content`;
|
|
1558
|
+
tt(
|
|
1559
|
+
["sectionPrev", "sectionNext"],
|
|
1560
|
+
(L) => {
|
|
1561
|
+
if (L.intent === "sectionNext") {
|
|
1562
|
+
if (b?.waitForAction)
|
|
1563
|
+
return !1;
|
|
1564
|
+
le();
|
|
1565
|
+
} else
|
|
1566
|
+
ye();
|
|
1567
|
+
},
|
|
1568
|
+
{ ref: xe, enabled: J }
|
|
1569
|
+
), lt(
|
|
1570
|
+
xe,
|
|
1571
|
+
J ? [
|
|
1572
|
+
...f ? [] : [{ intent: "sectionPrev", label: g }],
|
|
1573
|
+
...b?.waitForAction ? [] : [{ intent: "sectionNext", label: U ? V : P }]
|
|
1574
|
+
] : []
|
|
1575
|
+
), K(() => {
|
|
1576
|
+
E(!0);
|
|
1577
|
+
const L = setTimeout(() => E(!1), S);
|
|
1578
|
+
return () => clearTimeout(L);
|
|
1579
|
+
}, [r, S]), K(() => {
|
|
1580
|
+
if (!n || !i)
|
|
1581
|
+
return;
|
|
1582
|
+
const L = setInterval(
|
|
1583
|
+
() => {
|
|
1584
|
+
Y((W) => {
|
|
1585
|
+
if (W >= e.length - 1)
|
|
1586
|
+
return y(!1), a?.(!1), e[W]?.onLeave?.(), c?.(), W;
|
|
1587
|
+
const Z = W + 1;
|
|
1588
|
+
return l?.(Z), Z;
|
|
1589
|
+
});
|
|
1590
|
+
},
|
|
1591
|
+
Math.max(500, I)
|
|
1592
|
+
);
|
|
1593
|
+
return () => clearInterval(L);
|
|
1594
|
+
}, [n, i, I, e, a, c, l]);
|
|
1595
|
+
const Ne = v(() => {
|
|
1596
|
+
y((L) => {
|
|
1597
|
+
const W = !L;
|
|
1598
|
+
return a?.(W), W;
|
|
1599
|
+
});
|
|
1600
|
+
}, [a]), oe = Re(() => _ ? qt(_, Q.w, Q.h, b?.placement) : {
|
|
1601
|
+
top: typeof window < "u" ? window.innerHeight / 2 : 0,
|
|
1602
|
+
left: typeof window < "u" ? window.innerWidth / 2 : 0,
|
|
1603
|
+
actualPlacement: "bottom"
|
|
1604
|
+
}, [_, Q, b?.placement]), me = e.length === 0 ? 0 : (r + 1) / e.length * 100, ke = v(
|
|
1605
|
+
(L) => {
|
|
1606
|
+
const W = h && e.length > 1, Z = m && !U && /* @__PURE__ */ t(
|
|
1607
|
+
"button",
|
|
1608
|
+
{
|
|
1609
|
+
type: "button",
|
|
1610
|
+
className: `nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${N}`,
|
|
1611
|
+
onClick: o,
|
|
1612
|
+
"aria-label": B,
|
|
1613
|
+
title: B,
|
|
1614
|
+
children: qe(/* @__PURE__ */ t(Kt, {}), B, N)
|
|
1615
|
+
}
|
|
1616
|
+
), Ye = !f && /* @__PURE__ */ t(
|
|
1617
|
+
"button",
|
|
1618
|
+
{
|
|
1619
|
+
type: "button",
|
|
1620
|
+
className: `nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${N}`,
|
|
1621
|
+
onClick: ye,
|
|
1622
|
+
"aria-label": g,
|
|
1623
|
+
title: g,
|
|
1624
|
+
children: qe(/* @__PURE__ */ t(Ut, {}), g, N)
|
|
1625
|
+
}
|
|
1626
|
+
), Ke = !b?.waitForAction && /* @__PURE__ */ t(
|
|
1627
|
+
"button",
|
|
1628
|
+
{
|
|
1629
|
+
type: "button",
|
|
1630
|
+
className: `nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${N}`,
|
|
1631
|
+
onClick: le,
|
|
1632
|
+
"aria-label": U ? V : P,
|
|
1633
|
+
title: U ? V : P,
|
|
1634
|
+
children: qe(/* @__PURE__ */ t(jt, {}), U ? V : P, N)
|
|
1635
|
+
}
|
|
1636
|
+
), Ve = W && /* @__PURE__ */ t(
|
|
1637
|
+
"button",
|
|
1638
|
+
{
|
|
1639
|
+
type: "button",
|
|
1640
|
+
className: [
|
|
1641
|
+
"nice-tutorial__btn",
|
|
1642
|
+
"nice-tutorial__btn--play",
|
|
1643
|
+
`nice-tutorial__btn--${N}`,
|
|
1644
|
+
i ? "nice-tutorial__btn--active" : ""
|
|
1645
|
+
].filter(Boolean).join(" "),
|
|
1646
|
+
onClick: Ne,
|
|
1647
|
+
"aria-label": i ? re : ue,
|
|
1648
|
+
title: i ? re : ue,
|
|
1649
|
+
"aria-pressed": i,
|
|
1650
|
+
children: qe(
|
|
1651
|
+
i ? /* @__PURE__ */ t(Gt, {}) : /* @__PURE__ */ t(Vt, {}),
|
|
1652
|
+
i ? re : ue,
|
|
1653
|
+
N
|
|
1654
|
+
)
|
|
1655
|
+
}
|
|
1656
|
+
);
|
|
1657
|
+
return /* @__PURE__ */ R(
|
|
1658
|
+
"div",
|
|
1659
|
+
{
|
|
1660
|
+
className: [
|
|
1661
|
+
"nice-tutorial__controls",
|
|
1662
|
+
L ? "nice-tutorial__controls--inline" : "nice-tutorial__controls--floating-bottom"
|
|
1663
|
+
].join(" "),
|
|
1664
|
+
style: L ? void 0 : { zIndex: C + 2 },
|
|
1665
|
+
role: "group",
|
|
1666
|
+
"aria-label": $("tutorial.tutorialControls", "Tutorial controls"),
|
|
1667
|
+
children: [
|
|
1668
|
+
Z,
|
|
1669
|
+
Ye,
|
|
1670
|
+
p && /* @__PURE__ */ R("span", { className: "nice-tutorial__step-label", "aria-live": "polite", children: [
|
|
1671
|
+
r + 1,
|
|
1672
|
+
" ",
|
|
1673
|
+
ae,
|
|
1674
|
+
" ",
|
|
1675
|
+
e.length
|
|
1676
|
+
] }),
|
|
1677
|
+
Ke,
|
|
1678
|
+
W && /* @__PURE__ */ t(
|
|
1679
|
+
"div",
|
|
1680
|
+
{
|
|
1681
|
+
className: "nice-tutorial__progress-bar",
|
|
1682
|
+
role: "progressbar",
|
|
1683
|
+
"aria-valuenow": Math.round(me),
|
|
1684
|
+
"aria-valuemin": 0,
|
|
1685
|
+
"aria-valuemax": 100,
|
|
1686
|
+
"aria-label": `${r + 1} ${ae} ${e.length}`,
|
|
1687
|
+
children: /* @__PURE__ */ t(
|
|
1688
|
+
"div",
|
|
1689
|
+
{
|
|
1690
|
+
className: "nice-tutorial__progress-bar-fill",
|
|
1691
|
+
style: { width: `${me}%` }
|
|
1692
|
+
}
|
|
1693
|
+
)
|
|
1694
|
+
}
|
|
1695
|
+
),
|
|
1696
|
+
Ve,
|
|
1697
|
+
W && /* @__PURE__ */ R("label", { className: "nice-tutorial__speed", children: [
|
|
1698
|
+
/* @__PURE__ */ t(
|
|
1699
|
+
"input",
|
|
1700
|
+
{
|
|
1701
|
+
type: "range",
|
|
1702
|
+
className: "nice-tutorial__speed-slider",
|
|
1703
|
+
min: w.min,
|
|
1704
|
+
max: w.max,
|
|
1705
|
+
step: 500,
|
|
1706
|
+
value: w.min + w.max - I,
|
|
1707
|
+
onChange: (ce) => z(w.min + w.max - Number(ce.target.value)),
|
|
1708
|
+
"aria-label": be
|
|
1709
|
+
}
|
|
1710
|
+
),
|
|
1711
|
+
/* @__PURE__ */ R("span", { className: "nice-tutorial__speed-value", children: [
|
|
1712
|
+
(I / 1e3).toFixed(1),
|
|
1713
|
+
"s"
|
|
1714
|
+
] })
|
|
1715
|
+
] })
|
|
1716
|
+
]
|
|
1717
|
+
}
|
|
1718
|
+
);
|
|
1719
|
+
},
|
|
1720
|
+
[
|
|
1721
|
+
h,
|
|
1722
|
+
m,
|
|
1723
|
+
p,
|
|
1724
|
+
N,
|
|
1725
|
+
f,
|
|
1726
|
+
U,
|
|
1727
|
+
o,
|
|
1728
|
+
B,
|
|
1729
|
+
g,
|
|
1730
|
+
P,
|
|
1731
|
+
V,
|
|
1732
|
+
ue,
|
|
1733
|
+
re,
|
|
1734
|
+
be,
|
|
1735
|
+
ae,
|
|
1736
|
+
ye,
|
|
1737
|
+
le,
|
|
1738
|
+
b,
|
|
1739
|
+
i,
|
|
1740
|
+
Ne,
|
|
1741
|
+
r,
|
|
1742
|
+
e.length,
|
|
1743
|
+
me,
|
|
1744
|
+
I,
|
|
1745
|
+
w,
|
|
1746
|
+
C,
|
|
1747
|
+
$
|
|
1748
|
+
]
|
|
1749
|
+
);
|
|
1750
|
+
if (!n || !b)
|
|
1751
|
+
return null;
|
|
1752
|
+
const Ue = typeof document < "u" ? Math.max(document.documentElement.scrollWidth, window.innerWidth) : 0, je = typeof document < "u" ? Math.max(document.documentElement.scrollHeight, window.innerHeight) : 0;
|
|
1753
|
+
return /* @__PURE__ */ R(
|
|
1754
|
+
"div",
|
|
1755
|
+
{
|
|
1756
|
+
ref: xe,
|
|
1757
|
+
className: "nice-tutorial",
|
|
1758
|
+
style: { zIndex: C },
|
|
1759
|
+
"aria-modal": b.waitForAction || b.advanceOn ? void 0 : !0,
|
|
1760
|
+
role: "dialog",
|
|
1761
|
+
"aria-label": b.title ? void 0 : $("tutorial.tutorial", "Tutorial"),
|
|
1762
|
+
"aria-labelledby": b.title ? Le : void 0,
|
|
1763
|
+
"aria-describedby": b.content ? Ae : void 0,
|
|
1764
|
+
children: [
|
|
1765
|
+
/* @__PURE__ */ R(
|
|
1766
|
+
"svg",
|
|
1767
|
+
{
|
|
1768
|
+
className: "nice-tutorial__overlay",
|
|
1769
|
+
style: {
|
|
1770
|
+
position: "absolute",
|
|
1771
|
+
top: 0,
|
|
1772
|
+
left: 0,
|
|
1773
|
+
width: Ue,
|
|
1774
|
+
height: je,
|
|
1775
|
+
pointerEvents: "auto"
|
|
1776
|
+
},
|
|
1777
|
+
onClick: d ? o : void 0,
|
|
1778
|
+
children: [
|
|
1779
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ R("mask", { id: "nice-tutorial-mask", children: [
|
|
1780
|
+
/* @__PURE__ */ t("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }),
|
|
1781
|
+
_ && /* @__PURE__ */ t(
|
|
1782
|
+
"rect",
|
|
1783
|
+
{
|
|
1784
|
+
x: _.left,
|
|
1785
|
+
y: _.top,
|
|
1786
|
+
width: _.width,
|
|
1787
|
+
height: _.height,
|
|
1788
|
+
rx: "4",
|
|
1789
|
+
fill: "black",
|
|
1790
|
+
className: A ? "nice-tutorial__spotlight--entering" : ""
|
|
1791
|
+
}
|
|
1792
|
+
)
|
|
1793
|
+
] }) }),
|
|
1794
|
+
/* @__PURE__ */ t(
|
|
1795
|
+
"rect",
|
|
1796
|
+
{
|
|
1797
|
+
x: "0",
|
|
1798
|
+
y: "0",
|
|
1799
|
+
width: "100%",
|
|
1800
|
+
height: "100%",
|
|
1801
|
+
fill: `rgba(0,0,0,${M})`,
|
|
1802
|
+
mask: "url(#nice-tutorial-mask)"
|
|
1803
|
+
}
|
|
1804
|
+
)
|
|
1805
|
+
]
|
|
1806
|
+
}
|
|
1807
|
+
),
|
|
1808
|
+
_ && /* @__PURE__ */ t(
|
|
1809
|
+
"div",
|
|
1810
|
+
{
|
|
1811
|
+
className: `nice-tutorial__highlight ${A ? "nice-tutorial__highlight--entering" : ""}`,
|
|
1812
|
+
style: {
|
|
1813
|
+
position: "absolute",
|
|
1814
|
+
top: _.top,
|
|
1815
|
+
left: _.left,
|
|
1816
|
+
width: _.width,
|
|
1817
|
+
height: _.height,
|
|
1818
|
+
transition: `all ${S}ms ease`
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
),
|
|
1822
|
+
b.disableInteraction && _ && /* @__PURE__ */ t(
|
|
1823
|
+
"div",
|
|
1824
|
+
{
|
|
1825
|
+
className: "nice-tutorial__blocker",
|
|
1826
|
+
style: {
|
|
1827
|
+
position: "absolute",
|
|
1828
|
+
top: _.top,
|
|
1829
|
+
left: _.left,
|
|
1830
|
+
width: _.width,
|
|
1831
|
+
height: _.height
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
),
|
|
1835
|
+
/* @__PURE__ */ R(
|
|
1836
|
+
"div",
|
|
1837
|
+
{
|
|
1838
|
+
ref: O,
|
|
1839
|
+
className: `nice-tutorial__tooltip nice-tutorial__tooltip--${oe.actualPlacement} ${A ? "nice-tutorial__tooltip--entering" : ""}`,
|
|
1840
|
+
style: {
|
|
1841
|
+
position: "absolute",
|
|
1842
|
+
top: oe.top,
|
|
1843
|
+
left: oe.left,
|
|
1844
|
+
transition: `all ${S}ms ease`,
|
|
1845
|
+
maxWidth: 380,
|
|
1846
|
+
zIndex: C + 1
|
|
1847
|
+
},
|
|
1848
|
+
children: [
|
|
1849
|
+
b.showArrow !== !1 && /* @__PURE__ */ t(
|
|
1850
|
+
"div",
|
|
1851
|
+
{
|
|
1852
|
+
className: `nice-tutorial__arrow nice-tutorial__arrow--${oe.actualPlacement}`
|
|
1853
|
+
}
|
|
1854
|
+
),
|
|
1855
|
+
/* @__PURE__ */ R("div", { className: "nice-tutorial__header", children: [
|
|
1856
|
+
/* @__PURE__ */ t("h4", { id: Le, className: "nice-tutorial__title", children: b.title }),
|
|
1857
|
+
m && /* @__PURE__ */ t(
|
|
1858
|
+
"button",
|
|
1859
|
+
{
|
|
1860
|
+
type: "button",
|
|
1861
|
+
className: "nice-tutorial__close",
|
|
1862
|
+
onClick: o,
|
|
1863
|
+
"aria-label": Be,
|
|
1864
|
+
title: Be,
|
|
1865
|
+
children: /* @__PURE__ */ t(Wt, {})
|
|
1866
|
+
}
|
|
1867
|
+
)
|
|
1868
|
+
] }),
|
|
1869
|
+
/* @__PURE__ */ t(
|
|
1870
|
+
"div",
|
|
1871
|
+
{
|
|
1872
|
+
id: Ae,
|
|
1873
|
+
className: "nice-tutorial__content",
|
|
1874
|
+
dangerouslySetInnerHTML: { __html: $t(b.content) }
|
|
1875
|
+
}
|
|
1876
|
+
),
|
|
1877
|
+
T === "inline" && ke(!0)
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
),
|
|
1881
|
+
T === "floating-bottom" && ke(!1)
|
|
1882
|
+
]
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
};
|
|
1886
|
+
process.env.NODE_ENV !== "production" && (mt.displayName = "NiceTutorial");
|
|
1887
|
+
const ht = /* @__PURE__ */ dt({
|
|
1888
|
+
startTutorial: () => {
|
|
1889
|
+
},
|
|
1890
|
+
stopTutorial: () => {
|
|
1891
|
+
},
|
|
1892
|
+
isActive: !1,
|
|
1893
|
+
currentStep: 0,
|
|
1894
|
+
nextStep: () => {
|
|
1895
|
+
},
|
|
1896
|
+
prevStep: () => {
|
|
1897
|
+
},
|
|
1898
|
+
goToStep: () => {
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
function kn() {
|
|
1902
|
+
return it(ht);
|
|
1903
|
+
}
|
|
1904
|
+
const Zt = ({ children: e }) => {
|
|
1905
|
+
const [n, c] = X([]), [o, l] = X(!1), [u, d] = X(0), p = v((T) => {
|
|
1906
|
+
c(T), d(0), l(!0);
|
|
1907
|
+
}, []), m = v(() => {
|
|
1908
|
+
l(!1), d(0), c([]);
|
|
1909
|
+
}, []), x = v(() => {
|
|
1910
|
+
d((T) => Math.min(T + 1, n.length - 1));
|
|
1911
|
+
}, [n.length]), S = v(() => {
|
|
1912
|
+
d((T) => Math.max(T - 1, 0));
|
|
1913
|
+
}, []), M = v(
|
|
1914
|
+
(T) => {
|
|
1915
|
+
d(Math.max(0, Math.min(T, n.length - 1)));
|
|
1916
|
+
},
|
|
1917
|
+
[n.length]
|
|
1918
|
+
), C = {
|
|
1919
|
+
startTutorial: p,
|
|
1920
|
+
stopTutorial: m,
|
|
1921
|
+
isActive: o,
|
|
1922
|
+
currentStep: u,
|
|
1923
|
+
nextStep: x,
|
|
1924
|
+
prevStep: S,
|
|
1925
|
+
goToStep: M
|
|
1926
|
+
};
|
|
1927
|
+
return /* @__PURE__ */ R(ht.Provider, { value: C, children: [
|
|
1928
|
+
e,
|
|
1929
|
+
o && n.length > 0 && /* @__PURE__ */ t(
|
|
1930
|
+
mt,
|
|
1931
|
+
{
|
|
1932
|
+
steps: n,
|
|
1933
|
+
active: o,
|
|
1934
|
+
onFinish: m,
|
|
1935
|
+
onSkip: m,
|
|
1936
|
+
onStepChange: d
|
|
1937
|
+
}
|
|
1938
|
+
)
|
|
1939
|
+
] });
|
|
1940
|
+
};
|
|
1941
|
+
process.env.NODE_ENV !== "production" && (Zt.displayName = "NiceTutorialProvider");
|
|
1942
|
+
function Jt(e, n, c, o, l) {
|
|
1943
|
+
const u = e <= l, d = e + l >= c, p = n <= l, m = n + l >= o;
|
|
1944
|
+
return p && u ? "top-left" : p && d ? "top-right" : m && u ? "bottom-left" : m && d ? "bottom-right" : u ? "left" : d ? "right" : p ? "top" : m ? "bottom" : "none";
|
|
1945
|
+
}
|
|
1946
|
+
function en(e) {
|
|
1947
|
+
switch (e) {
|
|
1948
|
+
case "left":
|
|
1949
|
+
return { left: 0, top: 0, width: "50%", height: "100%" };
|
|
1950
|
+
case "right":
|
|
1951
|
+
return { left: "50%", top: 0, width: "50%", height: "100%" };
|
|
1952
|
+
case "top":
|
|
1953
|
+
return { left: 0, top: 0, width: "100%", height: "50%" };
|
|
1954
|
+
case "bottom":
|
|
1955
|
+
return { left: 0, top: "50%", width: "100%", height: "50%" };
|
|
1956
|
+
case "top-left":
|
|
1957
|
+
return { left: 0, top: 0, width: "50%", height: "50%" };
|
|
1958
|
+
case "top-right":
|
|
1959
|
+
return { left: "50%", top: 0, width: "50%", height: "50%" };
|
|
1960
|
+
case "bottom-left":
|
|
1961
|
+
return { left: 0, top: "50%", width: "50%", height: "50%" };
|
|
1962
|
+
case "bottom-right":
|
|
1963
|
+
return { left: "50%", top: "50%", width: "50%", height: "50%" };
|
|
1964
|
+
default:
|
|
1965
|
+
return null;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
const En = /* @__PURE__ */ Object.assign(
|
|
1969
|
+
/* @__PURE__ */ ot(
|
|
1970
|
+
({
|
|
1971
|
+
windowKey: e,
|
|
1972
|
+
title: n,
|
|
1973
|
+
icon: c,
|
|
1974
|
+
children: o,
|
|
1975
|
+
footer: l,
|
|
1976
|
+
x: u,
|
|
1977
|
+
y: d,
|
|
1978
|
+
defaultPosition: p,
|
|
1979
|
+
width: m = 480,
|
|
1980
|
+
height: x = 360,
|
|
1981
|
+
minWidth: S = 200,
|
|
1982
|
+
minHeight: M = 120,
|
|
1983
|
+
maxWidth: C,
|
|
1984
|
+
maxHeight: T,
|
|
1985
|
+
zIndex: N = 1,
|
|
1986
|
+
closable: h = !0,
|
|
1987
|
+
minimizable: s = !0,
|
|
1988
|
+
maximizable: w = !0,
|
|
1989
|
+
fullscreenable: a = !1,
|
|
1990
|
+
pinnable: $ = !1,
|
|
1991
|
+
resizable: r = !0,
|
|
1992
|
+
draggable: Y = !0,
|
|
1993
|
+
snappable: _ = !0,
|
|
1994
|
+
snapThreshold: F = 20,
|
|
1995
|
+
minimized: Q,
|
|
1996
|
+
maximized: k,
|
|
1997
|
+
fullscreen: A,
|
|
1998
|
+
pinned: E,
|
|
1999
|
+
focused: i,
|
|
2000
|
+
onClose: y,
|
|
2001
|
+
onMinimize: I,
|
|
2002
|
+
onMaximize: z,
|
|
2003
|
+
onFullscreen: O,
|
|
2004
|
+
onPin: q,
|
|
2005
|
+
onFocus: b,
|
|
2006
|
+
onMove: U,
|
|
2007
|
+
onResize: f,
|
|
2008
|
+
onSnap: P,
|
|
2009
|
+
onTitleBarDoubleClick: g,
|
|
2010
|
+
size: V = "md",
|
|
2011
|
+
statusBar: B,
|
|
2012
|
+
titleBarActions: ae,
|
|
2013
|
+
className: ue,
|
|
2014
|
+
style: re,
|
|
2015
|
+
id: be,
|
|
2016
|
+
accessMode: Be,
|
|
2017
|
+
...le
|
|
2018
|
+
}, ye) => {
|
|
2019
|
+
const He = nt(be), xe = Rt(Be, be), { t: J } = ze(), Me = H(null);
|
|
2020
|
+
Me.current == null && (Me.current = `nice-window-${Math.random().toString(36).slice(2, 10)}`);
|
|
2021
|
+
const j = e ?? Me.current, Le = u ?? p?.x ?? 100, Ae = d ?? p?.y ?? 100, [Ne, oe] = X({ x: Le, y: Ae }), [me, ke] = X({ width: m, height: x }), [Ue, je] = X(!1), [L, W] = X(!1), [Z, Ye] = X(!1), [Ke, Ve] = X(!1), [ce, Ge] = X("none"), ft = Q ?? Ue, se = k ?? L, ne = A ?? Z, Oe = E ?? Ke, Fe = i ?? !0, Ee = Ne.x, Ie = Ne.y, he = me.width, fe = me.height, pe = H(null), ie = H(null), G = H(null), pt = v(() => {
|
|
2022
|
+
y?.(j);
|
|
2023
|
+
}, [j, y]), wt = v(() => {
|
|
2024
|
+
je(!0), I?.(j);
|
|
2025
|
+
}, [j, I]), Qe = v(() => {
|
|
2026
|
+
const D = !se;
|
|
2027
|
+
W(D), !D && G.current ? (oe({ x: G.current.x, y: G.current.y }), ke({ width: G.current.w, height: G.current.h }), G.current = null) : D && (G.current = { x: Ee, y: Ie, w: he, h: fe }), Ge("none"), z?.(j, D);
|
|
2028
|
+
}, [j, se, Ee, Ie, he, fe, z]), Ze = v(() => {
|
|
2029
|
+
const D = !ne;
|
|
2030
|
+
Ye(D), D ? G.current = { x: Ee, y: Ie, w: he, h: fe } : G.current && (oe({ x: G.current.x, y: G.current.y }), ke({ width: G.current.w, height: G.current.h }), G.current = null), O?.(j, D);
|
|
2031
|
+
}, [j, ne, Ee, Ie, he, fe, O]), gt = v(() => {
|
|
2032
|
+
const D = !Oe;
|
|
2033
|
+
Ve(D), q?.(j, D);
|
|
2034
|
+
}, [j, Oe, q]), Ce = v(() => {
|
|
2035
|
+
b?.(j);
|
|
2036
|
+
}, [j, b]), _t = v(() => {
|
|
2037
|
+
g ? g(j) : w && Qe();
|
|
2038
|
+
}, [j, w, Qe, g]);
|
|
2039
|
+
K(() => {
|
|
2040
|
+
const D = (we) => {
|
|
2041
|
+
if (!pe.current)
|
|
2042
|
+
return;
|
|
2043
|
+
const de = we.clientX - pe.current.startX + pe.current.origX, De = we.clientY - pe.current.startY + pe.current.origY;
|
|
2044
|
+
oe({ x: de, y: De }), U?.(j, { x: de, y: De });
|
|
2045
|
+
}, te = (we) => {
|
|
2046
|
+
if (pe.current) {
|
|
2047
|
+
if (_) {
|
|
2048
|
+
const de = Jt(
|
|
2049
|
+
we.clientX,
|
|
2050
|
+
we.clientY,
|
|
2051
|
+
window.innerWidth,
|
|
2052
|
+
window.innerHeight,
|
|
2053
|
+
F
|
|
2054
|
+
);
|
|
2055
|
+
de !== "none" && (G.current = { x: Ne.x, y: Ne.y, w: he, h: fe }, Ge(de), P?.(j, de));
|
|
2056
|
+
}
|
|
2057
|
+
pe.current = null;
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
return document.addEventListener("mousemove", D), document.addEventListener("mouseup", te), () => {
|
|
2061
|
+
document.removeEventListener("mousemove", D), document.removeEventListener("mouseup", te);
|
|
2062
|
+
};
|
|
2063
|
+
});
|
|
2064
|
+
const vt = v(
|
|
2065
|
+
(D) => {
|
|
2066
|
+
!Y || se || ne || (D.preventDefault(), ce !== "none" && (G.current && (oe({ x: G.current.x, y: G.current.y }), ke({ width: G.current.w, height: G.current.h })), Ge("none")), Ce(), pe.current = { startX: D.clientX, startY: D.clientY, origX: Ee, origY: Ie });
|
|
2067
|
+
},
|
|
2068
|
+
[Y, se, ne, ce, Ee, Ie, Ce]
|
|
2069
|
+
);
|
|
2070
|
+
K(() => {
|
|
2071
|
+
const D = (we) => {
|
|
2072
|
+
if (!ie.current)
|
|
2073
|
+
return;
|
|
2074
|
+
const de = we.clientX - ie.current.startX, De = we.clientY - ie.current.startY, $e = ie.current.handle;
|
|
2075
|
+
let ge = ie.current.origW, _e = ie.current.origH;
|
|
2076
|
+
if ($e.includes("e") && (ge = ie.current.origW + de), $e.includes("w") && (ge = ie.current.origW - de), $e.includes("s") && (_e = ie.current.origH + De), $e.includes("n") && (_e = ie.current.origH - De), ge = Math.max(S, C ? Math.min(C, ge) : ge), _e = Math.max(M, T ? Math.min(T, _e) : _e), $e.includes("w")) {
|
|
2077
|
+
const Je = me.width - ge;
|
|
2078
|
+
oe((Xe) => ({ ...Xe, x: Xe.x + Je }));
|
|
2079
|
+
}
|
|
2080
|
+
if ($e.includes("n")) {
|
|
2081
|
+
const Je = me.height - _e;
|
|
2082
|
+
oe((Xe) => ({ ...Xe, y: Xe.y + Je }));
|
|
2083
|
+
}
|
|
2084
|
+
ke({ width: ge, height: _e }), f?.(j, { width: ge, height: _e });
|
|
2085
|
+
}, te = () => {
|
|
2086
|
+
ie.current = null;
|
|
2087
|
+
};
|
|
2088
|
+
return document.addEventListener("mousemove", D), document.addEventListener("mouseup", te), () => {
|
|
2089
|
+
document.removeEventListener("mousemove", D), document.removeEventListener("mouseup", te);
|
|
2090
|
+
};
|
|
2091
|
+
});
|
|
2092
|
+
const bt = v(
|
|
2093
|
+
(D, te) => {
|
|
2094
|
+
!r || se || ne || ce !== "none" || (te.preventDefault(), te.stopPropagation(), Ce(), ie.current = { startX: te.clientX, startY: te.clientY, origW: he, origH: fe, handle: D });
|
|
2095
|
+
},
|
|
2096
|
+
[r, se, ne, ce, he, fe, Ce]
|
|
2097
|
+
);
|
|
2098
|
+
if (K(() => {
|
|
2099
|
+
if (!Fe)
|
|
2100
|
+
return;
|
|
2101
|
+
const D = (te) => {
|
|
2102
|
+
te.key === "Escape" && ne && Ze();
|
|
2103
|
+
};
|
|
2104
|
+
return document.addEventListener("keydown", D), () => document.removeEventListener("keydown", D);
|
|
2105
|
+
}, [Fe, ne, Ze]), xe === "hidden" || ft)
|
|
2106
|
+
return null;
|
|
2107
|
+
const ct = ce !== "none" ? en(ce) : null, rt = se || ne, yt = ne ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : se ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: N } : ct ? { position: "absolute", ...ct, zIndex: N } : { position: "absolute", top: Ie, left: Ee, width: he, height: fe, zIndex: N }, xt = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], Nt = {
|
|
2108
|
+
n: "ns-resize",
|
|
2109
|
+
s: "ns-resize",
|
|
2110
|
+
e: "ew-resize",
|
|
2111
|
+
w: "ew-resize",
|
|
2112
|
+
ne: "nesw-resize",
|
|
2113
|
+
sw: "nesw-resize",
|
|
2114
|
+
nw: "nwse-resize",
|
|
2115
|
+
se: "nwse-resize"
|
|
2116
|
+
};
|
|
2117
|
+
return (
|
|
2118
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a press raises the window; focus moving in does it from the keyboard
|
|
2119
|
+
/* @__PURE__ */ R(
|
|
2120
|
+
"div",
|
|
2121
|
+
{
|
|
2122
|
+
ref: ye,
|
|
2123
|
+
id: He,
|
|
2124
|
+
className: `nice-window nice-window--${V} ${Fe ? "nice-window--focused" : ""} ${Oe ? "nice-window--pinned" : ""} ${rt ? "nice-window--maximized" : ""} ${ce !== "none" ? `nice-window--snapped-${ce}` : ""} ${ue ?? ""}`,
|
|
2125
|
+
style: { ...yt, ...re },
|
|
2126
|
+
onMouseDown: Ce,
|
|
2127
|
+
onFocus: Fe ? void 0 : Ce,
|
|
2128
|
+
role: "dialog",
|
|
2129
|
+
"aria-label": n,
|
|
2130
|
+
tabIndex: -1,
|
|
2131
|
+
"data-nice-focus-scope": "spatial",
|
|
2132
|
+
"data-nice-region": n,
|
|
2133
|
+
...le,
|
|
2134
|
+
children: [
|
|
2135
|
+
/* @__PURE__ */ R(
|
|
2136
|
+
"div",
|
|
2137
|
+
{
|
|
2138
|
+
className: "nice-window__titlebar",
|
|
2139
|
+
onMouseDown: vt,
|
|
2140
|
+
onDoubleClick: _t,
|
|
2141
|
+
children: [
|
|
2142
|
+
c && /* @__PURE__ */ t("span", { className: "nice-window__icon", children: c }),
|
|
2143
|
+
/* @__PURE__ */ t("span", { className: "nice-window__title", children: n }),
|
|
2144
|
+
/* @__PURE__ */ R("div", { className: "nice-window__actions", children: [
|
|
2145
|
+
ae,
|
|
2146
|
+
$ && /* @__PURE__ */ t(
|
|
2147
|
+
"button",
|
|
2148
|
+
{
|
|
2149
|
+
type: "button",
|
|
2150
|
+
className: `nice-window__action nice-window__action--pin ${Oe ? "nice-window__action--active" : ""}`,
|
|
2151
|
+
onClick: gt,
|
|
2152
|
+
title: Oe ? J("window.unpin", "Unpin") : J("window.pin", "Pin"),
|
|
2153
|
+
children: /* @__PURE__ */ t(ee, { name: "paperclip", size: 14 })
|
|
2154
|
+
}
|
|
2155
|
+
),
|
|
2156
|
+
s && /* @__PURE__ */ t(
|
|
2157
|
+
"button",
|
|
2158
|
+
{
|
|
2159
|
+
type: "button",
|
|
2160
|
+
className: "nice-window__action nice-window__action--minimize",
|
|
2161
|
+
onClick: wt,
|
|
2162
|
+
title: J("window.minimize", "Minimize"),
|
|
2163
|
+
children: /* @__PURE__ */ t(ee, { name: "minus", size: 14 })
|
|
2164
|
+
}
|
|
2165
|
+
),
|
|
2166
|
+
w && /* @__PURE__ */ t(
|
|
2167
|
+
"button",
|
|
2168
|
+
{
|
|
2169
|
+
type: "button",
|
|
2170
|
+
className: "nice-window__action nice-window__action--maximize",
|
|
2171
|
+
onClick: Qe,
|
|
2172
|
+
title: se ? J("window.restore", "Restore") : J("window.maximize", "Maximize"),
|
|
2173
|
+
children: /* @__PURE__ */ t(ee, { name: se ? "copy" : "window", size: 14 })
|
|
2174
|
+
}
|
|
2175
|
+
),
|
|
2176
|
+
a && /* @__PURE__ */ t(
|
|
2177
|
+
"button",
|
|
2178
|
+
{
|
|
2179
|
+
type: "button",
|
|
2180
|
+
className: "nice-window__action nice-window__action--fullscreen",
|
|
2181
|
+
onClick: Ze,
|
|
2182
|
+
title: ne ? J("window.exitFullscreen", "Exit Full Screen") : J("window.fullscreen", "Full Screen"),
|
|
2183
|
+
children: /* @__PURE__ */ t(ee, { name: ne ? "collapse" : "expand", size: 14 })
|
|
2184
|
+
}
|
|
2185
|
+
),
|
|
2186
|
+
h && /* @__PURE__ */ t(
|
|
2187
|
+
"button",
|
|
2188
|
+
{
|
|
2189
|
+
type: "button",
|
|
2190
|
+
className: "nice-window__action nice-window__action--close",
|
|
2191
|
+
onClick: pt,
|
|
2192
|
+
title: J("window.close", "Close"),
|
|
2193
|
+
children: /* @__PURE__ */ t(ee, { name: "close", size: 14 })
|
|
2194
|
+
}
|
|
2195
|
+
)
|
|
2196
|
+
] })
|
|
2197
|
+
]
|
|
2198
|
+
}
|
|
2199
|
+
),
|
|
2200
|
+
/* @__PURE__ */ t("div", { className: "nice-window__body", children: o }),
|
|
2201
|
+
l && /* @__PURE__ */ t("div", { className: "nice-window__footer", children: l }),
|
|
2202
|
+
B && /* @__PURE__ */ t("div", { className: "nice-window__statusbar", children: B }),
|
|
2203
|
+
r && !rt && ce === "none" && /* @__PURE__ */ t(Te, { children: xt.map((D) => /* @__PURE__ */ t(
|
|
2204
|
+
"div",
|
|
2205
|
+
{
|
|
2206
|
+
className: `nice-window__resize nice-window__resize--${D}`,
|
|
2207
|
+
style: { cursor: Nt[D] },
|
|
2208
|
+
onMouseDown: (te) => bt(D, te)
|
|
2209
|
+
},
|
|
2210
|
+
D
|
|
2211
|
+
)) })
|
|
2212
|
+
]
|
|
2213
|
+
}
|
|
2214
|
+
)
|
|
2215
|
+
);
|
|
2216
|
+
}
|
|
2217
|
+
),
|
|
2218
|
+
{ displayName: "NiceWindow" }
|
|
2219
|
+
);
|
|
2220
|
+
export {
|
|
2221
|
+
rn as N,
|
|
2222
|
+
xn as a,
|
|
2223
|
+
ln as b,
|
|
2224
|
+
At as c,
|
|
2225
|
+
an as d,
|
|
2226
|
+
pn as e,
|
|
2227
|
+
wn as f,
|
|
2228
|
+
fn as g,
|
|
2229
|
+
_n as h,
|
|
2230
|
+
bn as i,
|
|
2231
|
+
gn as j,
|
|
2232
|
+
hn as k,
|
|
2233
|
+
vn as l,
|
|
2234
|
+
sn as m,
|
|
2235
|
+
un as n,
|
|
2236
|
+
dn as o,
|
|
2237
|
+
mn as p,
|
|
2238
|
+
mt as q,
|
|
2239
|
+
Zt as r,
|
|
2240
|
+
En as s,
|
|
2241
|
+
Nn as t,
|
|
2242
|
+
Ht as u,
|
|
2243
|
+
yn as v,
|
|
2244
|
+
et as w,
|
|
2245
|
+
Xt as x,
|
|
2246
|
+
kn as y
|
|
2247
|
+
};
|