@nice2dev/ui 1.1.5 → 1.1.7
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 +102 -0
- package/README.md +50 -29
- package/css/legacy-bg-text-aliases.css +65 -61
- package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
- package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
- package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
- package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
- package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
- package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
- package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
- package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
- package/dist/NiceColorPicker-DMATcNWG.js +596 -0
- package/dist/NiceColorPicker-R3O1nemp.js +596 -0
- package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
- package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
- package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
- package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
- package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
- package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
- package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
- package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
- package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
- package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
- package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
- package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
- package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
- package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
- package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
- package/dist/NiceForm-CHEAHxDw.js +4805 -0
- package/dist/NiceForm-CJUp1CL0.cjs +1 -0
- package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
- package/dist/NiceForm-a6tGr6ss.js +4819 -0
- package/dist/NiceForm-jU89oe2S.cjs +1 -0
- package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
- package/dist/NiceGantt-D8coFAvK.js +328 -0
- package/dist/NiceGantt-DOZfT6r5.js +328 -0
- package/dist/NiceGantt-DQzH1V-R.js +328 -0
- package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
- package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
- package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
- package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
- package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
- package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
- package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
- package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
- package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
- package/dist/NiceLoginForm-X05Vadeg.js +708 -0
- package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
- package/dist/NiceMention-BByI4nFG.js +11120 -0
- package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
- package/dist/NiceMention-C2TPiMph.cjs +430 -0
- package/dist/NiceMention-C67vT6m0.js +11145 -0
- package/dist/NiceMention-D1cdy63w.cjs +430 -0
- package/dist/NiceMention-OaCi-GNO.js +11094 -0
- package/dist/NiceMention-QIuggb9Y.js +11122 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-CHaan9al.js +95 -0
- package/dist/NiceModal-Czq6OEAT.js +95 -0
- package/dist/NiceModal-D-HFwawr.js +95 -0
- package/dist/NiceModal-DOy2XTzc.cjs +1 -0
- package/dist/NiceModal-DkawKzEE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
- package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-7od5KUa3.cjs +1 -0
- package/dist/NicePagination-DMrkR8hH.cjs +1 -0
- package/dist/NicePagination-DQmZpsSQ.js +179 -0
- package/dist/NicePagination-DipQRjPq.js +172 -0
- package/dist/NicePagination-KhlVXYaT.js +172 -0
- package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
- package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
- package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
- package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
- package/dist/NicePivotGrid-etwpfccz.js +1167 -0
- package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
- package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
- package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
- package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
- package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
- package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
- package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
- package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
- package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
- package/dist/NiceSelect-A336yeLZ.js +433 -0
- package/dist/NiceSelect-B5hTbqi2.js +433 -0
- package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
- package/dist/NiceSelect-Dudf2T5T.js +433 -0
- package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
- package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
- package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
- package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
- package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
- package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-B8_V3_nq.cjs +882 -0
- package/dist/charts-BZgyyybE.js +31933 -0
- package/dist/charts-FuDk5-r6.js +31958 -0
- package/dist/charts-INj3yFo5.js +31946 -0
- package/dist/charts-NolNXKUL.cjs +882 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-A_A6c7an.js +795 -0
- package/dist/core-B2iH2J_X.js +795 -0
- package/dist/core-BmspZEfD.js +795 -0
- package/dist/core-DAfLOet6.cjs +1 -0
- package/dist/core-ZG3bgnBR.cjs +1 -0
- package/dist/data-branching-B3TOqXAO.cjs +1 -0
- package/dist/data-branching-BUGiICDZ.js +6275 -0
- package/dist/data-branching-DMXmcocj.js +6275 -0
- package/dist/data-branching-YE8P9M5P.js +6275 -0
- package/dist/data-branching-t6uhAwIm.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +7 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-BhV3OmF7.js +8285 -0
- package/dist/devops-BqUxnbRi.cjs +17 -0
- package/dist/devops-Bx-Qwj9w.cjs +17 -0
- package/dist/devops-DYZatW45.js +8251 -0
- package/dist/devops-R98k2zpd.js +8251 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +29 -16
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +59 -28
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +445 -445
- package/dist/index.css +1 -1
- package/dist/index.d.ts +214 -119
- package/dist/index.mjs +16635 -16351
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +31 -18
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +17 -14
- package/dist/navigation.mjs +130 -130
- package/dist/no-code-BPaAS4wW.cjs +332 -0
- package/dist/no-code-CBwUVL1i.js +7447 -0
- package/dist/no-code-CjktkQ50.js +7447 -0
- package/dist/no-code-DW2NrRba.js +7447 -0
- package/dist/no-code-DmFxrZ5T.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +2 -2
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +4 -4
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
- package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
- package/dist/pickerCommons-DAOXH_u5.js +1122 -0
- package/dist/pickerCommons-Dn4wnDco.js +1122 -0
- package/dist/pickerCommons-DskswPS5.js +1122 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +7 -7
- package/package.json +3 -3
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import { E as Oe, D as qe, G as He, r as We, g as Be, c as Ge, n as Ke, p as Pe, q as oe, j as Ue, t as Je, o as be } from "./charts-BZgyyybE.js";
|
|
3
|
+
import Ye, { useRef as ne, useState as m, useContext as Qe, useLayoutEffect as de, useEffect as Ve, forwardRef as Xe, useMemo as W, useCallback as ae } from "react";
|
|
4
|
+
import { createPortal as Ze } from "react-dom";
|
|
5
|
+
function et(h) {
|
|
6
|
+
const s = h?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");
|
|
7
|
+
if (!s)
|
|
8
|
+
return "";
|
|
9
|
+
const r = s.getAttribute("data-theme");
|
|
10
|
+
return r === "dark" || s.classList.contains("nice-dark") || s.classList.contains("dark") ? "nice-dark" : r === "light" || s.classList.contains("nice-light") ? "nice-light" : "";
|
|
11
|
+
}
|
|
12
|
+
function tt(h, s, r, ue) {
|
|
13
|
+
const k = ne(null), [fe, B] = m(null), [se, G] = m(!1), [ie, I] = m(""), _ = Qe(Oe)?.portalTarget ?? (typeof document < "u" ? document.body : null), d = ne(r);
|
|
14
|
+
return d.current = r, de(() => {
|
|
15
|
+
if (!h || !s.current)
|
|
16
|
+
return;
|
|
17
|
+
I(et(s.current)), G(!1);
|
|
18
|
+
const v = () => {
|
|
19
|
+
const N = s.current;
|
|
20
|
+
if (!N)
|
|
21
|
+
return;
|
|
22
|
+
const l = N.getBoundingClientRect(), $ = k.current?.offsetHeight ?? 320;
|
|
23
|
+
let L = l.bottom;
|
|
24
|
+
L + $ > window.innerHeight - 8 && l.top - $ > 8 && (L = l.top - $);
|
|
25
|
+
let M = l.left;
|
|
26
|
+
M + l.width > window.innerWidth - 8 && (M = Math.max(8, window.innerWidth - l.width - 8)), B(
|
|
27
|
+
(w) => w && w.left === M && w.top === L && w.width === l.width ? w : { left: M, top: L, width: l.width }
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
v();
|
|
31
|
+
const c = requestAnimationFrame(() => {
|
|
32
|
+
v(), G(!0);
|
|
33
|
+
}), g = (N) => {
|
|
34
|
+
const l = N.target;
|
|
35
|
+
l instanceof Node && (k.current?.contains(l) || s.current?.contains(l)) || d.current();
|
|
36
|
+
}, p = () => d.current();
|
|
37
|
+
return window.addEventListener("scroll", g, !0), window.addEventListener("resize", p), () => {
|
|
38
|
+
cancelAnimationFrame(c), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", p);
|
|
39
|
+
};
|
|
40
|
+
}, [h, s, 320]), Ve(() => {
|
|
41
|
+
if (!h)
|
|
42
|
+
return;
|
|
43
|
+
const v = (g) => {
|
|
44
|
+
const p = g.target;
|
|
45
|
+
s.current?.contains(p) || k.current?.contains(p) || (p instanceof Element ? p : p?.parentElement ?? null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]') || d.current();
|
|
46
|
+
}, c = (g) => {
|
|
47
|
+
g.key === "Escape" && d.current();
|
|
48
|
+
};
|
|
49
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", c), () => {
|
|
50
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", c);
|
|
51
|
+
};
|
|
52
|
+
}, [h, s]), { popupRef: k, coords: fe, ready: se, themeClass: ie, portalTarget: _ };
|
|
53
|
+
}
|
|
54
|
+
const ke = Xe(
|
|
55
|
+
({
|
|
56
|
+
label: h,
|
|
57
|
+
helperText: s,
|
|
58
|
+
error: r,
|
|
59
|
+
required: ue,
|
|
60
|
+
disabled: C,
|
|
61
|
+
size: k = "md",
|
|
62
|
+
name: fe,
|
|
63
|
+
id: B,
|
|
64
|
+
className: se,
|
|
65
|
+
style: G,
|
|
66
|
+
accessMode: ie,
|
|
67
|
+
displayStyle: I,
|
|
68
|
+
options: he,
|
|
69
|
+
value: _,
|
|
70
|
+
onChange: d,
|
|
71
|
+
placeholder: v,
|
|
72
|
+
multiple: c = !1,
|
|
73
|
+
searchable: g = !0,
|
|
74
|
+
clearable: p = !1,
|
|
75
|
+
emptyText: N,
|
|
76
|
+
maxHeight: l = 240,
|
|
77
|
+
optionsSource: $,
|
|
78
|
+
valueField: L,
|
|
79
|
+
labelField: M,
|
|
80
|
+
virtualScroll: w,
|
|
81
|
+
optionHeight: F = 36,
|
|
82
|
+
onSearch: T,
|
|
83
|
+
loading: y,
|
|
84
|
+
renderOption: K,
|
|
85
|
+
multipleAutosize: P = !1,
|
|
86
|
+
showKeyboardHints: Ne,
|
|
87
|
+
labelPlacement: $e,
|
|
88
|
+
errorPlacement: U,
|
|
89
|
+
labelWidth: J,
|
|
90
|
+
controlWidth: j,
|
|
91
|
+
displayMode: Ee
|
|
92
|
+
}, Y) => {
|
|
93
|
+
const ce = qe(ie, B), Ce = ce === "hidden";
|
|
94
|
+
(ce === "disabled" || ce === "readOnly") && (C = !0);
|
|
95
|
+
const { t: x } = He(), Le = We("input", I), Me = Be("input", I), S = Ge(B), pe = Ke({ enabled: Ee, disabled: C }), [b, D] = m(!1), [Q, V] = m(""), [R, z] = m(-1), [me, Se] = m(0), _e = ne(null), O = ne(null), [ve, De] = m(null);
|
|
96
|
+
de(() => {
|
|
97
|
+
!y && O.current && De(O.current.offsetWidth);
|
|
98
|
+
}, [y, _, I]);
|
|
99
|
+
const [q, Re] = m(null);
|
|
100
|
+
de(() => {
|
|
101
|
+
c && !P && O.current && q == null && Re(O.current.offsetWidth);
|
|
102
|
+
}, [c, P, q]);
|
|
103
|
+
const Ae = Pe(
|
|
104
|
+
$ ?? null,
|
|
105
|
+
L ?? $?.keyField ?? "id",
|
|
106
|
+
M ?? "name"
|
|
107
|
+
), E = $ ? Ae.options : (he ?? []).map(
|
|
108
|
+
(e) => typeof e == "string" ? { value: e, label: e } : e
|
|
109
|
+
), { popupRef: Ie, coords: H, ready: ge, themeClass: X, portalTarget: we } = tt(
|
|
110
|
+
b,
|
|
111
|
+
_e,
|
|
112
|
+
() => {
|
|
113
|
+
D(!1), V("");
|
|
114
|
+
}
|
|
115
|
+
), o = W(() => _ ? Array.isArray(_) ? _ : [_] : [], [_]), u = W(() => {
|
|
116
|
+
if (!Q && !T || T)
|
|
117
|
+
return E;
|
|
118
|
+
const e = Q.toLowerCase();
|
|
119
|
+
return E.filter(
|
|
120
|
+
(i) => i.label.toLowerCase().includes(e) || String(i.value).toLowerCase().includes(e)
|
|
121
|
+
);
|
|
122
|
+
}, [E, Q, T]), ye = W(() => {
|
|
123
|
+
const e = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const i of u) {
|
|
125
|
+
const n = i.group || "";
|
|
126
|
+
e.has(n) || e.set(n, []), e.get(n).push(i);
|
|
127
|
+
}
|
|
128
|
+
return e;
|
|
129
|
+
}, [u]), Z = ae(
|
|
130
|
+
(e) => {
|
|
131
|
+
if (c) {
|
|
132
|
+
const i = o.includes(e) ? o.filter((n) => n !== e) : [...o, e];
|
|
133
|
+
d?.(i);
|
|
134
|
+
} else
|
|
135
|
+
d?.(e), D(!1), V("");
|
|
136
|
+
},
|
|
137
|
+
[c, o, d]
|
|
138
|
+
), Fe = ae(
|
|
139
|
+
(e) => {
|
|
140
|
+
if (e.key === "Escape") {
|
|
141
|
+
D(!1), V("");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
145
|
+
if (!b) {
|
|
146
|
+
D(!0), e.preventDefault();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
R >= 0 && u[R] && (Z(u[R].value), e.preventDefault());
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
e.key === "ArrowDown" && (e.preventDefault(), z((i) => Math.min(i + 1, u.length - 1))), e.key === "ArrowUp" && (e.preventDefault(), z((i) => Math.max(i - 1, 0)));
|
|
153
|
+
},
|
|
154
|
+
[b, R, u, Z]
|
|
155
|
+
), le = W(() => o.length === 0 ? null : c ? o.map((e) => E.find((i) => i.value === e)?.label || e).join(", ") : E.find((e) => e.value === o[0])?.label || o[0], [o, E, c]), Te = ae(
|
|
156
|
+
(e) => {
|
|
157
|
+
e.stopPropagation(), d?.(c ? [] : "");
|
|
158
|
+
},
|
|
159
|
+
[d, c]
|
|
160
|
+
), je = W(
|
|
161
|
+
() => [
|
|
162
|
+
{ key: "Enter", description: x("shortcuts.select", "Select") },
|
|
163
|
+
{ key: "Space", description: x("shortcuts.openDropdown", "Open dropdown") },
|
|
164
|
+
oe.moveUp,
|
|
165
|
+
oe.moveDown,
|
|
166
|
+
oe.cancel
|
|
167
|
+
],
|
|
168
|
+
[x]
|
|
169
|
+
);
|
|
170
|
+
return Ce ? null : /* @__PURE__ */ a(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
className: `nice-field ${j == null ? "nice-field--select-auto" : ""} nice-field--${k} ${$e === "left" ? "nice-field--label-left" : ""} ${y ? "nice-field--loading" : ""} ${se || ""}`,
|
|
174
|
+
style: {
|
|
175
|
+
...G,
|
|
176
|
+
...J != null && {
|
|
177
|
+
"--nice-field-label-width": typeof J == "number" ? `${J}px` : J
|
|
178
|
+
},
|
|
179
|
+
...j != null && {
|
|
180
|
+
"--nice-field-control-width": typeof j == "number" ? `${j}px` : j
|
|
181
|
+
},
|
|
182
|
+
...y && ve != null && { "--nice-select-locked-width": `${ve}px` }
|
|
183
|
+
},
|
|
184
|
+
"aria-busy": y || void 0,
|
|
185
|
+
children: [
|
|
186
|
+
h && /* @__PURE__ */ a(
|
|
187
|
+
"label",
|
|
188
|
+
{
|
|
189
|
+
htmlFor: S,
|
|
190
|
+
className: `nice-field__label ${ue ? "nice-field__label--required" : ""}`,
|
|
191
|
+
children: [
|
|
192
|
+
h,
|
|
193
|
+
Ne && /* @__PURE__ */ t(Ue, { shortcuts: je, size: "sm" })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ a("div", { className: "nice-field__control", children: [
|
|
198
|
+
pe.isDisplay ? /* @__PURE__ */ t(
|
|
199
|
+
Je,
|
|
200
|
+
{
|
|
201
|
+
value: le,
|
|
202
|
+
placeholder: v || x("controls.select", "Select..."),
|
|
203
|
+
disabled: C,
|
|
204
|
+
onActivate: () => {
|
|
205
|
+
pe.enterEdit(), D(!0);
|
|
206
|
+
},
|
|
207
|
+
ariaLabel: h
|
|
208
|
+
}
|
|
209
|
+
) : /* @__PURE__ */ a("div", { className: "nice-select", ref: _e, children: [
|
|
210
|
+
/* @__PURE__ */ a(
|
|
211
|
+
"button",
|
|
212
|
+
{
|
|
213
|
+
ref: (e) => {
|
|
214
|
+
O.current = e, typeof Y == "function" ? Y(e) : Y && (Y.current = e);
|
|
215
|
+
},
|
|
216
|
+
type: "button",
|
|
217
|
+
id: S,
|
|
218
|
+
role: "combobox",
|
|
219
|
+
"aria-expanded": b,
|
|
220
|
+
"aria-haspopup": "listbox",
|
|
221
|
+
"aria-invalid": !!r,
|
|
222
|
+
className: `nice-select__trigger nice-select__trigger--${k} nice-select--ds-${Me} ${b ? "nice-select__trigger--open" : ""} ${r ? "nice-select__trigger--error" : ""} ${C ? "nice-select__trigger--disabled" : ""}`,
|
|
223
|
+
style: {
|
|
224
|
+
...Le,
|
|
225
|
+
...c && !P && q != null ? {
|
|
226
|
+
width: q,
|
|
227
|
+
maxWidth: q,
|
|
228
|
+
overflow: "hidden"
|
|
229
|
+
} : {}
|
|
230
|
+
},
|
|
231
|
+
disabled: C,
|
|
232
|
+
onClick: () => D(!b),
|
|
233
|
+
onKeyDown: Fe,
|
|
234
|
+
children: [
|
|
235
|
+
le ? /* @__PURE__ */ t(
|
|
236
|
+
"span",
|
|
237
|
+
{
|
|
238
|
+
style: c && !P ? {
|
|
239
|
+
flex: 1,
|
|
240
|
+
minWidth: 0,
|
|
241
|
+
overflow: "hidden",
|
|
242
|
+
textOverflow: "ellipsis",
|
|
243
|
+
whiteSpace: "nowrap"
|
|
244
|
+
} : void 0,
|
|
245
|
+
children: le
|
|
246
|
+
}
|
|
247
|
+
) : /* @__PURE__ */ t("span", { className: "nice-select__placeholder", children: v || x("controls.select", "Select...") }),
|
|
248
|
+
/* @__PURE__ */ a("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
249
|
+
p && o.length > 0 && /* @__PURE__ */ t(
|
|
250
|
+
"span",
|
|
251
|
+
{
|
|
252
|
+
className: "nice-input__clear",
|
|
253
|
+
onClick: Te,
|
|
254
|
+
role: "button",
|
|
255
|
+
"aria-label": x("controls.clear", "Clear"),
|
|
256
|
+
children: /* @__PURE__ */ t(be, { name: "close", size: 14 })
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ t(
|
|
260
|
+
"span",
|
|
261
|
+
{
|
|
262
|
+
className: `nice-select__chevron ${b ? "nice-select__chevron--open" : ""}`,
|
|
263
|
+
children: /* @__PURE__ */ t(be, { name: "chevron-down", size: 16 })
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
] })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
b && H && we && Ze(
|
|
271
|
+
/* @__PURE__ */ a(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
ref: Ie,
|
|
275
|
+
className: `nice-select__dropdown${X ? ` ${X}` : ""}`,
|
|
276
|
+
"data-theme": X === "nice-dark" ? "dark" : X === "nice-light" ? "light" : void 0,
|
|
277
|
+
role: "listbox",
|
|
278
|
+
style: {
|
|
279
|
+
maxHeight: l,
|
|
280
|
+
position: "fixed",
|
|
281
|
+
left: H.left,
|
|
282
|
+
top: H.top,
|
|
283
|
+
width: H.width,
|
|
284
|
+
minWidth: H.width,
|
|
285
|
+
zIndex: 1e3,
|
|
286
|
+
// Hidden until measured so the estimate frame never paints above.
|
|
287
|
+
opacity: ge ? 1 : 0,
|
|
288
|
+
pointerEvents: ge ? void 0 : "none"
|
|
289
|
+
},
|
|
290
|
+
onScroll: w ? (e) => Se(e.currentTarget.scrollTop) : void 0,
|
|
291
|
+
children: [
|
|
292
|
+
(g || T) && /* @__PURE__ */ t("div", { className: "nice-select__search", children: /* @__PURE__ */ t(
|
|
293
|
+
"input",
|
|
294
|
+
{
|
|
295
|
+
type: "text",
|
|
296
|
+
value: Q,
|
|
297
|
+
onChange: (e) => {
|
|
298
|
+
V(e.target.value), z(0), T?.(e.target.value);
|
|
299
|
+
},
|
|
300
|
+
placeholder: x("controls.search", "Search..."),
|
|
301
|
+
autoFocus: !0
|
|
302
|
+
}
|
|
303
|
+
) }),
|
|
304
|
+
y && /* @__PURE__ */ t("div", { className: "nice-select__loading", children: /* @__PURE__ */ t(
|
|
305
|
+
"div",
|
|
306
|
+
{
|
|
307
|
+
className: "nice-spinner nice-spinner--sm",
|
|
308
|
+
style: { margin: "8px auto" }
|
|
309
|
+
}
|
|
310
|
+
) }),
|
|
311
|
+
!y && u.length === 0 ? /* @__PURE__ */ t("div", { className: "nice-select__empty", children: N || x("controls.noResults", "No results found") }) : w && !Array.from(ye.keys()).some((e) => e !== "") ? (() => {
|
|
312
|
+
const i = u.length * F, n = Math.max(
|
|
313
|
+
0,
|
|
314
|
+
Math.floor(me / F) - 3
|
|
315
|
+
), A = Math.min(
|
|
316
|
+
u.length,
|
|
317
|
+
Math.ceil((me + l) / F) + 3
|
|
318
|
+
), ee = u.slice(n, A);
|
|
319
|
+
return /* @__PURE__ */ t("div", { style: { height: i, position: "relative" }, children: ee.map((f, ze) => {
|
|
320
|
+
const re = n + ze, te = o.includes(f.value);
|
|
321
|
+
return /* @__PURE__ */ t(
|
|
322
|
+
"div",
|
|
323
|
+
{
|
|
324
|
+
role: "option",
|
|
325
|
+
"aria-selected": te,
|
|
326
|
+
className: `nice-select__option ${te ? "nice-select__option--selected" : ""} ${re === R ? "nice-select__option--highlighted" : ""} ${f.disabled ? "nice-select__option--disabled" : ""}`,
|
|
327
|
+
style: {
|
|
328
|
+
position: "absolute",
|
|
329
|
+
top: re * F,
|
|
330
|
+
left: 0,
|
|
331
|
+
right: 0,
|
|
332
|
+
height: F,
|
|
333
|
+
display: "flex",
|
|
334
|
+
alignItems: "center",
|
|
335
|
+
padding: "0 12px"
|
|
336
|
+
},
|
|
337
|
+
onClick: () => !f.disabled && Z(String(f.value)),
|
|
338
|
+
onMouseEnter: () => z(re),
|
|
339
|
+
children: K ? K(f, te) : /* @__PURE__ */ a(xe, { children: [
|
|
340
|
+
f.icon && /* @__PURE__ */ t("span", { children: f.icon }),
|
|
341
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
342
|
+
/* @__PURE__ */ t("div", { children: f.label }),
|
|
343
|
+
f.description && /* @__PURE__ */ t("div", { className: "nice-select__option-desc", children: f.description })
|
|
344
|
+
] }),
|
|
345
|
+
te && /* @__PURE__ */ t(
|
|
346
|
+
"svg",
|
|
347
|
+
{
|
|
348
|
+
className: "nice-select__option-check",
|
|
349
|
+
viewBox: "0 0 20 20",
|
|
350
|
+
fill: "currentColor",
|
|
351
|
+
children: /* @__PURE__ */ t(
|
|
352
|
+
"path",
|
|
353
|
+
{
|
|
354
|
+
fillRule: "evenodd",
|
|
355
|
+
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
|
|
356
|
+
clipRule: "evenodd"
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
] })
|
|
362
|
+
},
|
|
363
|
+
f.value
|
|
364
|
+
);
|
|
365
|
+
}) });
|
|
366
|
+
})() : Array.from(ye.entries()).map(([e, i]) => /* @__PURE__ */ a(Ye.Fragment, { children: [
|
|
367
|
+
e && /* @__PURE__ */ t("div", { className: "nice-select__group-label", children: e }),
|
|
368
|
+
i.map((n) => {
|
|
369
|
+
const A = o.includes(n.value), ee = u.indexOf(n);
|
|
370
|
+
return /* @__PURE__ */ t(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
role: "option",
|
|
374
|
+
"aria-selected": A,
|
|
375
|
+
className: `nice-select__option ${A ? "nice-select__option--selected" : ""} ${ee === R ? "nice-select__option--highlighted" : ""} ${n.disabled ? "nice-select__option--disabled" : ""}`,
|
|
376
|
+
onClick: () => !n.disabled && Z(String(n.value)),
|
|
377
|
+
onMouseEnter: () => z(ee),
|
|
378
|
+
children: K ? K(n, A) : /* @__PURE__ */ a(xe, { children: [
|
|
379
|
+
n.icon && /* @__PURE__ */ t("span", { children: n.icon }),
|
|
380
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
381
|
+
/* @__PURE__ */ t("div", { children: n.label }),
|
|
382
|
+
n.description && /* @__PURE__ */ t("div", { className: "nice-select__option-desc", children: n.description })
|
|
383
|
+
] }),
|
|
384
|
+
A && /* @__PURE__ */ t(
|
|
385
|
+
"svg",
|
|
386
|
+
{
|
|
387
|
+
className: "nice-select__option-check",
|
|
388
|
+
viewBox: "0 0 20 20",
|
|
389
|
+
fill: "currentColor",
|
|
390
|
+
children: /* @__PURE__ */ t(
|
|
391
|
+
"path",
|
|
392
|
+
{
|
|
393
|
+
fillRule: "evenodd",
|
|
394
|
+
d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
|
|
395
|
+
clipRule: "evenodd"
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
] })
|
|
401
|
+
},
|
|
402
|
+
n.value
|
|
403
|
+
);
|
|
404
|
+
})
|
|
405
|
+
] }, e))
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
we
|
|
410
|
+
)
|
|
411
|
+
] }),
|
|
412
|
+
y && /* @__PURE__ */ t("span", { className: "nice-field__spinner", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
413
|
+
U === "right" && r && /* @__PURE__ */ t("div", { id: `${S}-error`, className: "nice-field__error", role: "alert", children: r }),
|
|
414
|
+
U === "right" && !r && s && /* @__PURE__ */ t("div", { id: `${S}-helper`, className: "nice-field__helper", children: s })
|
|
415
|
+
] }),
|
|
416
|
+
U !== "right" && r && /* @__PURE__ */ t("div", { id: `${S}-error`, className: "nice-field__error", role: "alert", children: r }),
|
|
417
|
+
U !== "right" && !r && s && /* @__PURE__ */ t("div", { id: `${S}-helper`, className: "nice-field__helper", children: s })
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
ke.displayName = "NiceSelect";
|
|
424
|
+
const lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
425
|
+
__proto__: null,
|
|
426
|
+
NiceSelect: ke
|
|
427
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
428
|
+
export {
|
|
429
|
+
ke as N,
|
|
430
|
+
lt as a,
|
|
431
|
+
et as s,
|
|
432
|
+
tt as u
|
|
433
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),o=require("./charts-B8_V3_nq.cjs"),n=require("react"),Ae=require("react-dom");function _e(p){const c=p?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");if(!c)return"";const a=c.getAttribute("data-theme");return a==="dark"||c.classList.contains("nice-dark")||c.classList.contains("dark")?"nice-dark":a==="light"||c.classList.contains("nice-light")?"nice-light":""}function ve(p,c,a,re){const b=n.useRef(null),[oe,W]=n.useState(null),[te,B]=n.useState(!1),[ne,A]=n.useState(""),x=n.useContext(o.Er)?.portalTarget??(typeof document<"u"?document.body:null),u=n.useRef(a);return u.current=a,n.useLayoutEffect(()=>{if(!p||!c.current)return;A(_e(c.current)),B(!1);const _=()=>{const k=c.current;if(!k)return;const r=k.getBoundingClientRect(),N=b.current?.offsetHeight??320;let E=r.bottom;E+N>window.innerHeight-8&&r.top-N>8&&(E=r.top-N);let C=r.left;C+r.width>window.innerWidth-8&&(C=Math.max(8,window.innerWidth-r.width-8)),W(g=>g&&g.left===C&&g.top===E&&g.width===r.width?g:{left:C,top:E,width:r.width})};_();const l=requestAnimationFrame(()=>{_(),B(!0)}),v=k=>{const r=k.target;r instanceof Node&&(b.current?.contains(r)||c.current?.contains(r))||u.current()},m=()=>u.current();return window.addEventListener("scroll",v,!0),window.addEventListener("resize",m),()=>{cancelAnimationFrame(l),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",m)}},[p,c,320]),n.useEffect(()=>{if(!p)return;const _=v=>{const m=v.target;c.current?.contains(m)||b.current?.contains(m)||(m instanceof Element?m:m?.parentElement??null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]')||u.current()},l=v=>{v.key==="Escape"&&u.current()};return document.addEventListener("mousedown",_),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("keydown",l)}},[p,c]),{popupRef:b,coords:oe,ready:te,themeClass:ne,portalTarget:x}}const le=n.forwardRef(({label:p,helperText:c,error:a,required:re,disabled:S,size:b="md",name:oe,id:W,className:te,style:B,accessMode:ne,displayStyle:A,options:ae,value:x,onChange:u,placeholder:_,multiple:l=!1,searchable:v=!0,clearable:m=!1,emptyText:k,maxHeight:r=240,optionsSource:N,valueField:E,labelField:C,virtualScroll:g,optionHeight:F=36,onSearch:I,loading:w,renderOption:P,multipleAutosize:Y=!1,showKeyboardHints:ge,labelPlacement:we,errorPlacement:K,labelWidth:U,controlWidth:T,displayMode:ye},G)=>{const se=o.Dc(ne,W),je=se==="hidden";(se==="disabled"||se==="readOnly")&&(S=!0);const{t:y}=o.Gt(),be=o.rc("input",A),ke=o.ac("input",A),L=o.bc(W),de=o.sc({enabled:ye,disabled:S}),[j,M]=n.useState(!1),[J,Q]=n.useState(""),[R,q]=n.useState(-1),[ue,Ne]=n.useState(0),fe=n.useRef(null),z=n.useRef(null),[he,$e]=n.useState(null);n.useLayoutEffect(()=>{!w&&z.current&&$e(z.current.offsetWidth)},[w,x,A]);const[O,Se]=n.useState(null);n.useLayoutEffect(()=>{l&&!Y&&z.current&&O==null&&Se(z.current.offsetWidth)},[l,Y,O]);const Ee=o.Jd(N??null,E??N?.keyField??"id",C??"name"),$=N?Ee.options:(ae??[]).map(e=>typeof e=="string"?{value:e,label:e}:e),{popupRef:Ce,coords:H,ready:pe,themeClass:V,portalTarget:me}=ve(j,fe,()=>{M(!1),Q("")}),d=n.useMemo(()=>x?Array.isArray(x)?x:[x]:[],[x]),f=n.useMemo(()=>{if(!J&&!I||I)return $;const e=J.toLowerCase();return $.filter(i=>i.label.toLowerCase().includes(e)||String(i.value).toLowerCase().includes(e))},[$,J,I]),xe=n.useMemo(()=>{const e=new Map;for(const i of f){const s=i.group||"";e.has(s)||e.set(s,[]),e.get(s).push(i)}return e},[f]),X=n.useCallback(e=>{if(l){const i=d.includes(e)?d.filter(s=>s!==e):[...d,e];u?.(i)}else u?.(e),M(!1),Q("")},[l,d,u]),Le=n.useCallback(e=>{if(e.key==="Escape"){M(!1),Q("");return}if(e.key==="Enter"||e.key===" "){if(!j){M(!0),e.preventDefault();return}R>=0&&f[R]&&(X(f[R].value),e.preventDefault());return}e.key==="ArrowDown"&&(e.preventDefault(),q(i=>Math.min(i+1,f.length-1))),e.key==="ArrowUp"&&(e.preventDefault(),q(i=>Math.max(i-1,0)))},[j,R,f,X]),ce=n.useMemo(()=>d.length===0?null:l?d.map(e=>$.find(i=>i.value===e)?.label||e).join(", "):$.find(e=>e.value===d[0])?.label||d[0],[d,$,l]),Me=n.useCallback(e=>{e.stopPropagation(),u?.(l?[]:"")},[u,l]),Re=n.useMemo(()=>[{key:"Enter",description:y("shortcuts.select","Select")},{key:"Space",description:y("shortcuts.openDropdown","Open dropdown")},o.Yc.moveUp,o.Yc.moveDown,o.Yc.cancel],[y]);return je?null:t.jsxs("div",{className:`nice-field ${T==null?"nice-field--select-auto":""} nice-field--${b} ${we==="left"?"nice-field--label-left":""} ${w?"nice-field--loading":""} ${te||""}`,style:{...B,...U!=null&&{"--nice-field-label-width":typeof U=="number"?`${U}px`:U},...T!=null&&{"--nice-field-control-width":typeof T=="number"?`${T}px`:T},...w&&he!=null&&{"--nice-select-locked-width":`${he}px`}},"aria-busy":w||void 0,children:[p&&t.jsxs("label",{htmlFor:L,className:`nice-field__label ${re?"nice-field__label--required":""}`,children:[p,ge&&t.jsx(o.ha,{shortcuts:Re,size:"sm"})]}),t.jsxs("div",{className:"nice-field__control",children:[de.isDisplay?t.jsx(o.cc,{value:ce,placeholder:_||y("controls.select","Select..."),disabled:S,onActivate:()=>{de.enterEdit(),M(!0)},ariaLabel:p}):t.jsxs("div",{className:"nice-select",ref:fe,children:[t.jsxs("button",{ref:e=>{z.current=e,typeof G=="function"?G(e):G&&(G.current=e)},type:"button",id:L,role:"combobox","aria-expanded":j,"aria-haspopup":"listbox","aria-invalid":!!a,className:`nice-select__trigger nice-select__trigger--${b} nice-select--ds-${ke} ${j?"nice-select__trigger--open":""} ${a?"nice-select__trigger--error":""} ${S?"nice-select__trigger--disabled":""}`,style:{...be,...l&&!Y&&O!=null?{width:O,maxWidth:O,overflow:"hidden"}:{}},disabled:S,onClick:()=>M(!j),onKeyDown:Le,children:[ce?t.jsx("span",{style:l&&!Y?{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:void 0,children:ce}):t.jsx("span",{className:"nice-select__placeholder",children:_||y("controls.select","Select...")}),t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[m&&d.length>0&&t.jsx("span",{className:"nice-input__clear",onClick:Me,role:"button","aria-label":y("controls.clear","Clear"),children:t.jsx(o.oa,{name:"close",size:14})}),t.jsx("span",{className:`nice-select__chevron ${j?"nice-select__chevron--open":""}`,children:t.jsx(o.oa,{name:"chevron-down",size:16})})]})]}),j&&H&&me&&Ae.createPortal(t.jsxs("div",{ref:Ce,className:`nice-select__dropdown${V?` ${V}`:""}`,"data-theme":V==="nice-dark"?"dark":V==="nice-light"?"light":void 0,role:"listbox",style:{maxHeight:r,position:"fixed",left:H.left,top:H.top,width:H.width,minWidth:H.width,zIndex:1e3,opacity:pe?1:0,pointerEvents:pe?void 0:"none"},onScroll:g?e=>Ne(e.currentTarget.scrollTop):void 0,children:[(v||I)&&t.jsx("div",{className:"nice-select__search",children:t.jsx("input",{type:"text",value:J,onChange:e=>{Q(e.target.value),q(0),I?.(e.target.value)},placeholder:y("controls.search","Search..."),autoFocus:!0})}),w&&t.jsx("div",{className:"nice-select__loading",children:t.jsx("div",{className:"nice-spinner nice-spinner--sm",style:{margin:"8px auto"}})}),!w&&f.length===0?t.jsx("div",{className:"nice-select__empty",children:k||y("controls.noResults","No results found")}):g&&!Array.from(xe.keys()).some(e=>e!=="")?(()=>{const i=f.length*F,s=Math.max(0,Math.floor(ue/F)-3),D=Math.min(f.length,Math.ceil((ue+r)/F)+3),Z=f.slice(s,D);return t.jsx("div",{style:{height:i,position:"relative"},children:Z.map((h,De)=>{const ie=s+De,ee=d.includes(h.value);return t.jsx("div",{role:"option","aria-selected":ee,className:`nice-select__option ${ee?"nice-select__option--selected":""} ${ie===R?"nice-select__option--highlighted":""} ${h.disabled?"nice-select__option--disabled":""}`,style:{position:"absolute",top:ie*F,left:0,right:0,height:F,display:"flex",alignItems:"center",padding:"0 12px"},onClick:()=>!h.disabled&&X(String(h.value)),onMouseEnter:()=>q(ie),children:P?P(h,ee):t.jsxs(t.Fragment,{children:[h.icon&&t.jsx("span",{children:h.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:h.label}),h.description&&t.jsx("div",{className:"nice-select__option-desc",children:h.description})]}),ee&&t.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},h.value)})})})():Array.from(xe.entries()).map(([e,i])=>t.jsxs(n.Fragment,{children:[e&&t.jsx("div",{className:"nice-select__group-label",children:e}),i.map(s=>{const D=d.includes(s.value),Z=f.indexOf(s);return t.jsx("div",{role:"option","aria-selected":D,className:`nice-select__option ${D?"nice-select__option--selected":""} ${Z===R?"nice-select__option--highlighted":""} ${s.disabled?"nice-select__option--disabled":""}`,onClick:()=>!s.disabled&&X(String(s.value)),onMouseEnter:()=>q(Z),children:P?P(s,D):t.jsxs(t.Fragment,{children:[s.icon&&t.jsx("span",{children:s.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:s.label}),s.description&&t.jsx("div",{className:"nice-select__option-desc",children:s.description})]}),D&&t.jsx("svg",{className:"nice-select__option-check",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})]})},s.value)})]},e))]}),me)]}),w&&t.jsx("span",{className:"nice-field__spinner",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),K==="right"&&a&&t.jsx("div",{id:`${L}-error`,className:"nice-field__error",role:"alert",children:a}),K==="right"&&!a&&c&&t.jsx("div",{id:`${L}-helper`,className:"nice-field__helper",children:c})]}),K!=="right"&&a&&t.jsx("div",{id:`${L}-error`,className:"nice-field__error",role:"alert",children:a}),K!=="right"&&!a&&c&&t.jsx("div",{id:`${L}-helper`,className:"nice-field__helper",children:c})]})});le.displayName="NiceSelect";const Fe=Object.freeze(Object.defineProperty({__proto__:null,NiceSelect:le},Symbol.toStringTag,{value:"Module"}));exports.NiceSelect=le;exports.NiceSelect$1=Fe;exports.scopeThemeClass=_e;exports.useAnchoredPopup=ve;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),X=require("./charts-B8_V3_nq.cjs"),n=require("react"),ht=({visible:t,onClose:i,title:s,items:l,showCancelButton:h=!0,cancelText:f,size:x="md",disabled:w,readOnly:u,loading:b,error:a,className:v,style:T})=>{const{t:S}=X.Gt();if(!t)return null;const N=w||b||u;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-actionsheet__overlay",onClick:i}),e.jsxs("div",{className:`nice-actionsheet nice-actionsheet--${x} ${w?"nice-actionsheet--disabled":""} ${u?"nice-actionsheet--readonly":""} ${b?"nice-actionsheet--loading":""} ${a?"nice-actionsheet--error":""} ${v||""}`,style:T,"aria-disabled":w||void 0,"aria-readonly":u||void 0,"aria-busy":b||void 0,children:[a&&e.jsx("div",{className:"nice-actionsheet__error",role:"alert",children:a}),b&&e.jsx("span",{className:"nice-actionsheet__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),s&&e.jsx("div",{className:"nice-actionsheet__title",children:s}),e.jsx("div",{className:"nice-actionsheet__items",children:l.map((j,P)=>e.jsxs("button",{className:`nice-actionsheet__item ${j.type==="danger"?"nice-actionsheet__item--danger":""}`,disabled:j.disabled||N,onClick:()=>{N||(j.onClick?.(),i())},children:[j.icon&&e.jsx("span",{className:"nice-actionsheet__icon",children:j.icon}),j.text]},P))}),h&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:f||S("cancel","Cancel")})]})]})},ft=({visible:t,onClose:i,targetRef:s,position:l="bottom",title:h,showArrow:f=!0,width:x,children:w,className:u,style:b,displayStyle:a})=>{X.ac("tooltip",a);const v=n.useRef(null),[T,S]=n.useState({top:0,left:0}),N=n.useCallback(()=>{const j=s.current,P=v.current;if(!j||!P)return;const c=j.getBoundingClientRect(),g=P.getBoundingClientRect();let r=0,C=0;const _=8;switch(l){case"top":r=c.top-g.height-_,C=c.left+(c.width-g.width)/2;break;case"bottom":r=c.bottom+_,C=c.left+(c.width-g.width)/2;break;case"left":r=c.top+(c.height-g.height)/2,C=c.left-g.width-_;break;case"right":r=c.top+(c.height-g.height)/2,C=c.right+_;break}S({top:r+window.scrollY,left:C+window.scrollX})},[s,l]);return n.useEffect(()=>{if(t){requestAnimationFrame(N);const j=P=>{v.current&&!v.current.contains(P.target)&&s.current&&!s.current.contains(P.target)&&i()};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)}},[t,N,i,s]),t?e.jsxs("div",{ref:v,className:`nice-popover nice-popover--${l} ${u||""}`,style:{...b,position:"absolute",top:T.top,left:T.left,width:x},children:[f&&e.jsx("div",{className:`nice-popover__arrow nice-popover__arrow--${l}`}),h&&e.jsx("div",{className:"nice-popover__title",children:h}),e.jsx("div",{className:"nice-popover__content",children:w})]}):null},pt=({visible:t,message:i,container:s,showIndicator:l=!0,shading:h=!0,className:f,style:x})=>{const{t:w}=X.Gt();if(!t)return null;const u=!!s?.current,b=e.jsxs("div",{className:`nice-loadpanel ${f||""}`,style:x,children:[h&&e.jsx("div",{className:"nice-loadpanel__shade"}),e.jsxs("div",{className:"nice-loadpanel__box",children:[l&&e.jsx("div",{className:"nice-spinner nice-spinner--md"}),e.jsx("span",{className:"nice-loadpanel__text",children:i||w("loading","Loading...")})]})]});if(u&&s.current){const a=s.current;return a.style.position=a.style.position||"relative",b}return b},xt=({direction:t="row",align:i,justify:s,wrap:l,gap:h,flex:f,children:x,className:w,style:u})=>e.jsx("div",{className:`nice-box ${w||""}`,style:{display:"flex",flexDirection:t,alignItems:i,justifyContent:s,flexWrap:l?"wrap":void 0,gap:h,flex:f,...u},children:x}),wt=({direction:t="row",items:i,gap:s,className:l,style:h})=>e.jsx("div",{className:`nice-responsivebox ${l||""}`,style:{display:"flex",flexDirection:t,gap:s,...h},children:i.map((f,x)=>e.jsx("div",{style:{flex:f.ratio??1,flexBasis:f.baseSize,flexShrink:f.shrink??1},children:f.children},x))}),_t=({width:t=200,height:i=200,minWidth:s=50,minHeight:l=50,maxWidth:h=1/0,maxHeight:f=1/0,handles:x=["right","bottom","bottomRight"],onResize:w,children:u,className:b,style:a})=>{const[v,T]=n.useState({width:t,height:i}),S=n.useRef(null),N=(c,g)=>{g.preventDefault();const r=g.clientX,C=g.clientY,_=v.width,G=v.height,M={n:"top",s:"bottom",e:"right",w:"left",ne:"topRight",se:"bottomRight",sw:"bottomLeft",nw:"topLeft"}[c]??c,o=M==="right"||M==="topRight"||M==="bottomRight",E=M==="left"||M==="topLeft"||M==="bottomLeft",k=M==="bottom"||M==="bottomRight"||M==="bottomLeft",I=M==="top"||M==="topRight"||M==="topLeft",d=m=>{const L=m.clientX-r,p=m.clientY-C;let Y=_,O=G;o&&(Y=_+L),E&&(Y=_-L),k&&(O=G+p),I&&(O=G-p),Y=Math.max(s,Math.min(h,Y)),O=Math.max(l,Math.min(f,O)),T({width:Y,height:O}),w?.({width:Y,height:O})},y=()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",y)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",y)},j=c=>{switch(c){case"top":case"bottom":return"ns-resize";case"left":case"right":return"ew-resize";case"topLeft":case"bottomRight":return"nwse-resize";case"topRight":case"bottomLeft":return"nesw-resize";default:return"default"}},P=c=>{const g={position:"absolute",zIndex:1},r=8;return c==="right"?{...g,top:0,right:-r/2,width:r,height:"100%",cursor:j(c)}:c==="bottom"?{...g,left:0,bottom:-r/2,width:"100%",height:r,cursor:j(c)}:c==="left"?{...g,top:0,left:-r/2,width:r,height:"100%",cursor:j(c)}:c==="top"?{...g,top:-r/2,left:0,width:"100%",height:r,cursor:j(c)}:c==="bottomRight"?{...g,bottom:-r/2,right:-r/2,width:r*2,height:r*2,cursor:j(c)}:c==="bottomLeft"?{...g,bottom:-r/2,left:-r/2,width:r*2,height:r*2,cursor:j(c)}:c==="topRight"?{...g,top:-r/2,right:-r/2,width:r*2,height:r*2,cursor:j(c)}:c==="topLeft"?{...g,top:-r/2,left:-r/2,width:r*2,height:r*2,cursor:j(c)}:g};return e.jsxs("div",{ref:S,className:`nice-resizable ${b||""}`,style:{...a,width:v.width,height:v.height,position:"relative",overflow:"hidden"},children:[u,x.map(c=>e.jsx("div",{style:P(c),onPointerDown:g=>N(c,g)},c))]})},gt=({direction:t="vertical",showScrollbar:i="onInteraction",width:s,height:l,onScroll:h,children:f,className:x,style:w})=>{const u=t==="horizontal"||t==="both"?"auto":"hidden",b=t==="vertical"||t==="both"?"auto":"hidden",a=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{className:`nice-scrollview ${a} ${x||""}`,style:{...w,width:s,height:l,overflowX:u,overflowY:b},onScroll:h,children:f})};function Me(t,i){if(!t)return{score:1,indices:[]};const s=t.toLowerCase(),l=i.toLowerCase();let h=0;const f=[];let x=0,w=-1;for(let u=0;u<l.length&&h<s.length;u++)l[u]===s[h]&&(f.push(u),w===u-1&&(x+=3),(u===0||/[\s\-_/.]/.test(i[u-1]))&&(x+=5),i[u]===t[h]&&(x+=1),x+=1,w=u,h++);return h<s.length?null:(x-=f[0]*.1,{score:x,indices:f})}function qe(t,i){if(i.length===0)return[t];const s=[];let l=0;const h=new Set(i);for(let f=0;f<t.length;f++)h.has(f)&&(l<f&&s.push(t.slice(l,f)),s.push(n.createElement("mark",{key:`m-${f}`,className:"nice-command-palette__match"},t[f])),l=f+1);return l<t.length&&s.push(t.slice(l)),s}function bt(t,i){switch(i.type){case"REGISTER":{const s=new Map(t.commands);return s.set(i.command.id,i.command),{...t,commands:s}}case"REGISTER_BATCH":{const s=new Map(t.commands);for(const l of i.commands)s.set(l.id,l);return{...t,commands:s}}case"UNREGISTER":{const s=new Map(t.commands);return s.delete(i.id),{...t,commands:s}}case"OPEN":return{...t,isOpen:!0,query:"",selectedIndex:0};case"CLOSE":return{...t,isOpen:!1,query:"",selectedIndex:0};case"SET_QUERY":return{...t,query:i.query,selectedIndex:0};case"SET_SELECTED":return{...t,selectedIndex:i.index};case"ADD_RECENT":{const s=t.recentIds.filter(l=>l!==i.id);return{...t,recentIds:[i.id,...s].slice(0,i.maxRecent)}}default:return t}}const Oe=n.createContext(null);function We(){const t=n.useContext(Oe);if(!t)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return t}const Ae=({children:t,commands:i,placeholder:s="Type a command...",maxVisible:l=10,maxRecent:h=5,className:f,emptyText:x="No commands found",closeOnAction:w=!0,onOpen:u,onClose:b})=>{const[a,v]=n.useReducer(bt,{commands:new Map(i?.map(d=>[d.id,d])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),T=n.useRef(null),S=n.useRef(null),[N,j]=n.useState(!1),P=n.useCallback(d=>{v({type:"REGISTER",command:d})},[]),c=n.useCallback(d=>{v({type:"UNREGISTER",id:d})},[]),g=n.useCallback(d=>{v({type:"REGISTER_BATCH",commands:d})},[]),r=n.useCallback(()=>{v({type:"OPEN"}),u?.()},[u]),C=n.useCallback(()=>{v({type:"CLOSE"}),b?.()},[b]),_=n.useCallback(()=>{a.isOpen?C():r()},[a.isOpen,C,r]),q=n.useMemo(()=>{const d=Array.from(a.commands.values()).filter(m=>!m.hidden);if(!a.query.trim()){const m=a.recentIds.map(p=>a.commands.get(p)).filter(p=>!!p&&!p.hidden),L=d.filter(p=>!a.recentIds.includes(p.id));return L.sort((p,Y)=>p.label.localeCompare(Y.label)),[...m,...L].map(p=>({command:p,match:null,isRecent:a.recentIds.includes(p.id)}))}return d.map(m=>{const L=Me(a.query,m.label),p=m.description?Me(a.query,m.description):null,Y=m.keywords?.map(H=>Me(a.query,H)).filter(Boolean)[0]??null,O=[L,p,Y].filter(Boolean).sort((H,J)=>(J?.score??0)-(H?.score??0))[0];return{command:m,match:O,isRecent:!1}}).filter(m=>m.match!==null).sort((m,L)=>(L.match?.score??0)-(m.match?.score??0))},[a.commands,a.query,a.recentIds]).slice(0,l),M=n.useCallback(async d=>{const y=a.commands.get(d);if(!(!y||y.disabled)){j(!0);try{await y.action(),v({type:"ADD_RECENT",id:d,maxRecent:h})}finally{j(!1),w&&C()}}},[a.commands,h,w,C]);n.useEffect(()=>{const d=y=>{(y.metaKey||y.ctrlKey)&&y.key==="k"&&(y.preventDefault(),_()),y.key==="Escape"&&a.isOpen&&(y.preventDefault(),C())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[_,a.isOpen,C]),n.useEffect(()=>{a.isOpen&&requestAnimationFrame(()=>T.current?.focus())},[a.isOpen]);const o=n.useCallback(d=>{const y=q.length;if(y){if(d.key==="ArrowDown")d.preventDefault(),v({type:"SET_SELECTED",index:(a.selectedIndex+1)%y});else if(d.key==="ArrowUp")d.preventDefault(),v({type:"SET_SELECTED",index:(a.selectedIndex-1+y)%y});else if(d.key==="Enter"){d.preventDefault();const m=q[a.selectedIndex];m&&M(m.command.id)}}},[q,a.selectedIndex,M]);n.useEffect(()=>{if(!S.current)return;S.current.children[a.selectedIndex]?.scrollIntoView({block:"nearest"})},[a.selectedIndex]);const E=n.useMemo(()=>({registerCommand:P,unregisterCommand:c,registerCommands:g,open:r,close:C,toggle:_,isOpen:a.isOpen,executeCommand:M}),[P,c,g,r,C,_,a.isOpen,M]),k=n.useMemo(()=>{const d=new Map;for(const y of q){const m=y.command.category??"General";d.has(m)||d.set(m,[]),d.get(m).push(y)}return d},[q]);let I=0;return e.jsxs(Oe.Provider,{value:E,children:[t,a.isOpen&&e.jsx("div",{className:`nice-command-palette__overlay ${f??""}`,onClick:C,children:e.jsxs("div",{className:"nice-command-palette",role:"dialog","aria-label":"Command Palette","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:T,className:"nice-command-palette__input",type:"text",placeholder:s,value:a.query,onChange:d=>v({type:"SET_QUERY",query:d.target.value}),onKeyDown:o,"aria-label":"Search commands","aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":q[a.selectedIndex]?`nice-cmd-${q[a.selectedIndex].command.id}`:void 0})}),e.jsxs("div",{ref:S,id:"nice-command-palette-list",className:"nice-command-palette__list",role:"listbox",children:[q.length===0&&e.jsx("div",{className:"nice-command-palette__empty",children:x}),Array.from(k.entries()).map(([d,y])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:d}),y.map(m=>{const L=I++,p=L===a.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${m.command.id}`,className:`nice-command-palette__item ${p?"nice-command-palette__item--selected":""} ${m.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":p,"aria-disabled":m.command.disabled,onClick:()=>!m.command.disabled&&M(m.command.id),onMouseEnter:()=>v({type:"SET_SELECTED",index:L}),children:[m.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:m.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:m.match&&a.query?qe(m.command.label,m.match.indices):m.command.label}),m.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:m.command.description})]}),m.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:m.command.shortcut}),m.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:"Recent"})]},m.command.id)})]},d))]}),N&&e.jsx("div",{className:"nice-command-palette__executing",children:"Executing..."})]})})]})};Ae.displayName="NiceCommandPaletteProvider";function vt(t){const{registerCommands:i,unregisterCommand:s}=We();n.useEffect(()=>(i(t),()=>{for(const l of t)s(l.id)}),[])}const Fe=n.forwardRef(({blocked:t,message:i,spinner:s,blur:l,children:h,className:f,style:x,id:w},u)=>{const b=X.bc(w);return e.jsxs("div",{ref:u,id:b,className:`nice-block-ui ${f||""}`,style:{position:"relative",...x},children:[h,t&&e.jsx("div",{className:`nice-block-ui__overlay${l?" nice-block-ui__overlay--blur":""}`,"aria-busy":"true",role:"alert",children:(s||i)&&e.jsxs("div",{className:"nice-block-ui__content",children:[s&&e.jsx("div",{className:"nice-block-ui__spinner","aria-hidden":"true"}),i&&e.jsx("div",{className:"nice-block-ui__message",children:i})]})})]})});Fe.displayName="NiceBlockUI";const Ue=n.forwardRef(({windows:t,children:i,onChange:s,onClose:l,onFocus:h,showTaskbar:f=!0,size:x="md",className:w,style:u,id:b,...a},v)=>{const T=X.bc(b),{t:S}=X.Gt(),[N,j]=n.useState(null),P=n.useRef(null),c=t??[],g=Math.max(1,...c.map(o=>o.zIndex??1)),r=n.useCallback((o,E)=>{const k=c.map(I=>I.key===o?{...I,...E}:I);s?.(k)},[c,s]),C=n.useCallback(o=>{r(o,{zIndex:g+1}),h?.(o)},[r,g,h]),_=n.useCallback(o=>{l?.(o),s?.(c.filter(E=>E.key!==o))},[c,s,l]),G=n.useCallback(o=>{const E=c.find(k=>k.key===o);E&&r(o,{minimized:!E.minimized,maximized:!1})},[c,r]),q=n.useCallback(o=>{const E=c.find(k=>k.key===o);E&&r(o,{maximized:!E.maximized,minimized:!1})},[c,r]);n.useEffect(()=>{if(!N)return;const o=k=>{const I=c.find(d=>d.key===N.key);if(I)if(N.mode==="move")r(N.key,{x:k.clientX-N.offsetX,y:k.clientY-N.offsetY});else{const y=P.current?.getBoundingClientRect(),m=y?.left??0,L=y?.top??0;r(N.key,{width:Math.max(200,k.clientX-m-I.x),height:Math.max(100,k.clientY-L-I.y)})}},E=()=>j(null);return document.addEventListener("mousemove",o),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",E)}},[N,c,r]);const M=n.useCallback((o,E,k)=>{E.preventDefault();const I=c.find(d=>d.key===o);I&&(C(o),j({key:o,offsetX:k==="move"?E.clientX-I.x:0,offsetY:k==="move"?E.clientY-I.y:0,mode:k}))},[c,C]);return e.jsxs("div",{ref:o=>{P.current=o,typeof v=="function"?v(o):v&&(v.current=o)},id:T,className:`nice-wm nice-wm--${x} ${w??""}`,style:{...u,position:"relative",overflow:"hidden"},...a,children:[c.map(o=>{if(o.minimized)return null;const E=o.maximized,k=E?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:o.zIndex??1}:{position:"absolute",top:o.y,left:o.x,width:o.width,height:o.height,zIndex:o.zIndex??1};return e.jsxs("div",{className:`nice-wm__window ${E?"nice-wm__window--maximized":""}`,style:k,onMouseDown:()=>C(o.key),role:"dialog","aria-label":o.title,children:[e.jsxs("div",{className:"nice-wm__titlebar",onMouseDown:I=>!E&&M(o.key,I,"move"),children:[o.icon&&e.jsx("span",{className:"nice-wm__icon",children:o.icon}),e.jsx("span",{className:"nice-wm__title",children:o.title}),e.jsxs("div",{className:"nice-wm__controls",children:[(o.minimizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--min",onClick:()=>G(o.key),title:S("wm.minimize","Minimize"),children:e.jsx(X.oa,{name:"minus",size:14})}),(o.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>q(o.key),title:S("wm.maximize","Maximize"),children:e.jsx(X.oa,{name:E?"copy":"window",size:14})}),(o.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>_(o.key),title:S("wm.close","Close"),children:e.jsx(X.oa,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-wm__body",children:o.content}),(o.resizable??!0)&&!E&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:I=>M(o.key,I,"resize")})]},o.key)}),t===void 0&&i,f&&e.jsx("div",{className:"nice-wm__taskbar",role:"toolbar","aria-label":S("wm.taskbar","Taskbar"),children:c.map(o=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${o.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{o.minimized&&G(o.key),C(o.key)},children:[o.icon&&e.jsx("span",{className:"nice-wm__taskbar-icon",children:o.icon}),e.jsx("span",{className:"nice-wm__taskbar-label",children:o.title})]},o.key))})]})});Ue.displayName="NiceWindowManager";function yt(t,i){const s=document.querySelector(t);if(!s)return null;const l=s.getBoundingClientRect();return{top:l.top-i+window.scrollY,left:l.left-i+window.scrollX,width:l.width+i*2,height:l.height+i*2}}function Nt(t,i,s,l){const f={w:window.innerWidth,h:window.innerHeight+window.scrollY},x={top:{top:t.top-s-12,left:t.left+t.width/2-i/2},bottom:{top:t.top+t.height+12,left:t.left+t.width/2-i/2},left:{top:t.top+t.height/2-s/2,left:t.left-i-12},right:{top:t.top+t.height/2-s/2,left:t.left+t.width+12}};if(l&&l!=="auto")return{...x[l],actualPlacement:l};for(const w of["bottom","top","right","left"]){const u=x[w];if(u.top>=0&&u.left>=0&&u.top+s<=f.h&&u.left+i<=f.w)return{...u,actualPlacement:w}}return{...x.bottom,actualPlacement:"bottom"}}const be={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function jt(){return e.jsxs("svg",{...be,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function kt(){return e.jsx("svg",{...be,children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Ct(){return e.jsx("svg",{...be,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Et(){return e.jsxs("svg",{...be,children:[e.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),e.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}function zt(){return e.jsx("svg",{...be,children:e.jsx("polygon",{points:"6 4 20 12 6 20 6 4",fill:"currentColor"})})}function St(){return e.jsxs("svg",{...be,children:[e.jsx("rect",{x:"6",y:"4",width:"4",height:"16",fill:"currentColor"}),e.jsx("rect",{x:"14",y:"4",width:"4",height:"16",fill:"currentColor"})]})}function Re(t,i,s){return s==="text"?e.jsx("span",{className:"nice-tutorial__btn-label",children:i}):s==="icon-text"?e.jsxs(e.Fragment,{children:[t,e.jsx("span",{className:"nice-tutorial__btn-label",children:i})]}):t}const Be=({steps:t,active:i,onFinish:s,onSkip:l,onStepChange:h,closeOnEscape:f=!0,closeOnOverlayClick:x=!1,showProgress:w=!0,showSkipButton:u=!0,labels:b,animationDuration:a=300,overlayOpacity:v=.6,zIndex:T=1e4,buttonsPlacement:S="floating-bottom",buttonsDisplay:N="icon",showAutoplay:j=!0,autoplayInterval:P=5e3,autoplaySpeedRange:c={min:2e3,max:15e3},onAutoplayChange:g})=>{const[r,C]=n.useState(0),[_,G]=n.useState(null),[q,M]=n.useState({w:340,h:200}),[o,E]=n.useState(!0),[k,I]=n.useState(!1),[d,y]=n.useState(P),m=n.useRef(null),L=n.useRef(-1),p=t[r],Y=r===t.length-1,O=r===0,H=b?.next??"Next",J=b?.back??"Back",ee=b?.finish??"Finish",ue=b?.skip??"Skip",me=b?.stepOf??"of",he=b?.play??"Play",fe=b?.pause??"Pause",ze=b?.speed??"Speed",ve=b?.close??"Close";n.useEffect(()=>{i&&(C(0),I(!1),y(P))},[i,P]),n.useEffect(()=>{if(m.current){const R=m.current.getBoundingClientRect();M({w:R.width,h:R.height})}},[r,i]),n.useEffect(()=>{if(!i||!p)return;const R=p.highlightPadding??0,$=()=>{const A=yt(p.target,R);G(A)};if($(),p.scrollIntoView!==!1){document.querySelector(p.target)?.scrollIntoView({behavior:"smooth",block:"center"});const K=setTimeout($,350);return()=>clearTimeout(K)}},[i,p,r]),n.useEffect(()=>{!i||!p||L.current!==r&&(L.current>=0&&L.current<t.length&&t[L.current]?.onLeave?.(),p.onEnter?.(),L.current=r)},[i,p,r,t]);const te=n.useCallback(()=>{if(Y)p?.onLeave?.(),s?.();else{const R=r+1;C(R),h?.(R)}},[r,Y,s,h,p]),pe=n.useCallback(()=>{if(!O){const R=r-1;C(R),h?.(R)}},[r,O,h]);n.useEffect(()=>{if(!i||!p?.advanceOn)return;const R=document.querySelector(p.target);if(!R)return;const $=()=>te();return R.addEventListener(p.advanceOn.event,$),()=>R.removeEventListener(p.advanceOn.event,$)},[i,p,r,te]),n.useEffect(()=>{if(!i)return;const R=$=>{$.key==="Escape"&&f?l?.():$.key==="ArrowRight"?te():$.key==="ArrowLeft"&&pe()};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i,r,f,te,pe,l]),n.useEffect(()=>{E(!0);const R=setTimeout(()=>E(!1),a);return()=>clearTimeout(R)},[r,a]),n.useEffect(()=>{if(!i||!k)return;const R=setInterval(()=>{C($=>{if($>=t.length-1)return I(!1),g?.(!1),t[$]?.onLeave?.(),s?.(),$;const A=$+1;return h?.(A),A})},Math.max(500,d));return()=>clearInterval(R)},[i,k,d,t,g,s,h]);const Se=n.useCallback(()=>{I(R=>{const $=!R;return g?.($),$})},[g]),xe=n.useMemo(()=>_?Nt(_,q.w,q.h,p?.placement):{top:typeof window<"u"?window.innerHeight/2:0,left:typeof window<"u"?window.innerWidth/2:0,actualPlacement:"bottom"},[_,q,p?.placement]),ye=t.length===0?0:(r+1)/t.length*100,ne=n.useCallback(R=>{const $=j&&t.length>1,A=u&&!Y&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${N}`,onClick:l,"aria-label":ue,title:ue,children:Re(e.jsx(Et,{}),ue,N)}),K=!O&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${N}`,onClick:pe,"aria-label":J,title:J,children:Re(e.jsx(kt,{}),J,N)}),we=!p?.waitForAction&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${N}`,onClick:te,"aria-label":Y?ee:H,title:Y?ee:H,children:Re(e.jsx(Ct,{}),Y?ee:H,N)}),_e=$&&e.jsx("button",{type:"button",className:["nice-tutorial__btn","nice-tutorial__btn--play",`nice-tutorial__btn--${N}`,k?"nice-tutorial__btn--active":""].filter(Boolean).join(" "),onClick:Se,"aria-label":k?fe:he,title:k?fe:he,"aria-pressed":k,children:Re(k?e.jsx(St,{}):e.jsx(zt,{}),k?fe:he,N)});return e.jsxs("div",{className:["nice-tutorial__controls",R?"nice-tutorial__controls--inline":"nice-tutorial__controls--floating-bottom"].join(" "),style:R?void 0:{zIndex:T+2},role:"group","aria-label":"Tutorial controls",children:[A,K,w&&e.jsxs("span",{className:"nice-tutorial__step-label","aria-live":"polite",children:[r+1," ",me," ",t.length]}),we,$&&e.jsx("div",{className:"nice-tutorial__progress-bar",role:"progressbar","aria-valuenow":Math.round(ye),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${r+1} ${me} ${t.length}`,children:e.jsx("div",{className:"nice-tutorial__progress-bar-fill",style:{width:`${ye}%`}})}),_e,$&&e.jsxs("label",{className:"nice-tutorial__speed",children:[e.jsx("input",{type:"range",className:"nice-tutorial__speed-slider",min:c.min,max:c.max,step:500,value:c.min+c.max-d,onChange:Ie=>y(c.min+c.max-Number(Ie.target.value)),"aria-label":ze}),e.jsxs("span",{className:"nice-tutorial__speed-value",children:[(d/1e3).toFixed(1),"s"]})]})]})},[j,u,w,N,O,Y,l,ue,J,H,ee,he,fe,ze,me,pe,te,p,k,Se,r,t.length,ye,d,c,T]);if(!i||!p)return null;const Ne=typeof document<"u"?Math.max(document.documentElement.scrollWidth,window.innerWidth):0,D=typeof document<"u"?Math.max(document.documentElement.scrollHeight,window.innerHeight):0;return e.jsxs("div",{className:"nice-tutorial",style:{zIndex:T},"aria-modal":"true",role:"dialog","aria-label":"Tutorial",children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:Ne,height:D,pointerEvents:"auto"},onClick:x?l:void 0,children:[e.jsx("defs",{children:e.jsxs("mask",{id:"nice-tutorial-mask",children:[e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),_&&e.jsx("rect",{x:_.left,y:_.top,width:_.width,height:_.height,rx:"4",fill:"black",className:o?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${v})`,mask:"url(#nice-tutorial-mask)"})]}),_&&e.jsx("div",{className:`nice-tutorial__highlight ${o?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height,transition:`all ${a}ms ease`}}),p.disableInteraction&&_&&e.jsx("div",{className:"nice-tutorial__blocker",style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height}}),e.jsxs("div",{ref:m,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${xe.actualPlacement} ${o?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:xe.top,left:xe.left,transition:`all ${a}ms ease`,maxWidth:380,zIndex:T+1},children:[p.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${xe.actualPlacement}`}),e.jsxs("div",{className:"nice-tutorial__header",children:[e.jsx("h4",{className:"nice-tutorial__title",children:p.title}),u&&e.jsx("button",{type:"button",className:"nice-tutorial__close",onClick:l,"aria-label":ve,title:ve,children:e.jsx(jt,{})})]}),e.jsx("div",{className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:X.lc(p.content)}}),S==="inline"&&ne(!0)]}),S==="floating-bottom"&&ne(!1)]})};Be.displayName="NiceTutorial";const Ge=n.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function Rt(){return n.useContext(Ge)}const He=({children:t})=>{const[i,s]=n.useState([]),[l,h]=n.useState(!1),[f,x]=n.useState(0),w=n.useCallback(S=>{s(S),x(0),h(!0)},[]),u=n.useCallback(()=>{h(!1),x(0),s([])},[]),b=n.useCallback(()=>{x(S=>Math.min(S+1,i.length-1))},[i.length]),a=n.useCallback(()=>{x(S=>Math.max(S-1,0))},[]),v=n.useCallback(S=>{x(Math.max(0,Math.min(S,i.length-1)))},[i.length]),T={startTutorial:w,stopTutorial:u,isActive:l,currentStep:f,nextStep:b,prevStep:a,goToStep:v};return e.jsxs(Ge.Provider,{value:T,children:[t,l&&i.length>0&&e.jsx(Be,{steps:i,active:l,onFinish:u,onSkip:u,onStepChange:x})]})};He.displayName="NiceTutorialProvider";function Mt(t,i,s,l,h){const f=t<=h,x=t+h>=s,w=i<=h,u=i+h>=l;return w&&f?"top-left":w&&x?"top-right":u&&f?"bottom-left":u&&x?"bottom-right":f?"left":x?"right":w?"top":u?"bottom":"none"}function It(t){switch(t){case"left":return{left:0,top:0,width:"50%",height:"100%"};case"right":return{left:"50%",top:0,width:"50%",height:"100%"};case"top":return{left:0,top:0,width:"100%",height:"50%"};case"bottom":return{left:0,top:"50%",width:"100%",height:"50%"};case"top-left":return{left:0,top:0,width:"50%",height:"50%"};case"top-right":return{left:"50%",top:0,width:"50%",height:"50%"};case"bottom-left":return{left:0,top:"50%",width:"50%",height:"50%"};case"bottom-right":return{left:"50%",top:"50%",width:"50%",height:"50%"};default:return null}}const Ke=n.forwardRef(({windowKey:t,title:i,icon:s,children:l,footer:h,x:f,y:x,defaultPosition:w,width:u=480,height:b=360,minWidth:a=200,minHeight:v=120,maxWidth:T,maxHeight:S,zIndex:N=1,closable:j=!0,minimizable:P=!0,maximizable:c=!0,fullscreenable:g=!1,pinnable:r=!1,resizable:C=!0,draggable:_=!0,snappable:G=!0,snapThreshold:q=20,minimized:M,maximized:o,fullscreen:E,pinned:k,focused:I,onClose:d,onMinimize:y,onMaximize:m,onFullscreen:L,onPin:p,onFocus:Y,onMove:O,onResize:H,onSnap:J,onTitleBarDoubleClick:ee,size:ue="md",statusBar:me,titleBarActions:he,className:fe,style:ze,id:ve,accessMode:te,...pe},Se)=>{const xe=X.bc(ve),ye=X.Dc(te,ve),{t:ne}=X.Gt(),Ne=n.useRef(null);Ne.current==null&&(Ne.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const D=t??Ne.current,R=f??w?.x??100,$=x??w?.y??100;if(ye==="hidden")return null;const[A,K]=n.useState({x:R,y:$}),[we,_e]=n.useState({width:u,height:b}),[Ie,Ve]=n.useState(!1),[Qe,Ze]=n.useState(!1),[Je,et]=n.useState(!1),[tt,nt]=n.useState(!1),[Q,Le]=n.useState("none"),it=M??Ie,V=o??Qe,F=E??Je,je=k??tt,$e=I??!0,ae=A.x,de=A.y,ie=we.width,se=we.height,oe=n.useRef(null),U=n.useRef(null),B=n.useRef(null),st=n.useCallback(()=>{d?.(D)},[D,d]),ot=n.useCallback(()=>{Ve(!0),y?.(D)},[D,y]),Te=n.useCallback(()=>{const z=!V;Ze(z),!z&&B.current?(K({x:B.current.x,y:B.current.y}),_e({width:B.current.w,height:B.current.h}),B.current=null):z&&(B.current={x:ae,y:de,w:ie,h:se}),Le("none"),m?.(D,z)},[D,V,ae,de,ie,se,m]),Pe=n.useCallback(()=>{const z=!F;et(z),z?B.current={x:ae,y:de,w:ie,h:se}:B.current&&(K({x:B.current.x,y:B.current.y}),_e({width:B.current.w,height:B.current.h}),B.current=null),L?.(D,z)},[D,F,ae,de,ie,se,L]),ct=n.useCallback(()=>{const z=!je;nt(z),p?.(D,z)},[D,je,p]),ke=n.useCallback(()=>{Y?.(D)},[D,Y]),rt=n.useCallback(()=>{ee?ee(D):c&&Te()},[D,c,Te,ee]);n.useEffect(()=>{const z=ce=>{if(!oe.current)return;const Z=ce.clientX-oe.current.startX+oe.current.origX,Ce=ce.clientY-oe.current.startY+oe.current.origY;K({x:Z,y:Ce}),O?.(D,{x:Z,y:Ce})},W=ce=>{if(oe.current){if(G){const Z=Mt(ce.clientX,ce.clientY,window.innerWidth,window.innerHeight,q);Z!=="none"&&(B.current={x:A.x,y:A.y,w:ie,h:se},Le(Z),J?.(D,Z))}oe.current=null}};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",W),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",W)}});const lt=n.useCallback(z=>{!_||V||F||(z.preventDefault(),Q!=="none"&&(B.current&&(K({x:B.current.x,y:B.current.y}),_e({width:B.current.w,height:B.current.h})),Le("none")),ke(),oe.current={startX:z.clientX,startY:z.clientY,origX:ae,origY:de})},[_,V,F,Q,ae,de,ke]);n.useEffect(()=>{const z=ce=>{if(!U.current)return;const Z=ce.clientX-U.current.startX,Ce=ce.clientY-U.current.startY,ge=U.current.handle;let re=U.current.origW,le=U.current.origH;if(ge.includes("e")&&(re=U.current.origW+Z),ge.includes("w")&&(re=U.current.origW-Z),ge.includes("s")&&(le=U.current.origH+Ce),ge.includes("n")&&(le=U.current.origH-Ce),re=Math.max(a,T?Math.min(T,re):re),le=Math.max(v,S?Math.min(S,le):le),ge.includes("w")){const Ye=we.width-re;K(Ee=>({...Ee,x:Ee.x+Ye}))}if(ge.includes("n")){const Ye=we.height-le;K(Ee=>({...Ee,y:Ee.y+Ye}))}_e({width:re,height:le}),H?.(D,{width:re,height:le})},W=()=>{U.current=null};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",W),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",W)}});const at=n.useCallback((z,W)=>{!C||V||F||Q!=="none"||(W.preventDefault(),W.stopPropagation(),ke(),U.current={startX:W.clientX,startY:W.clientY,origW:ie,origH:se,handle:z})},[C,V,F,Q,ie,se,ke]);if(n.useEffect(()=>{if(!$e)return;const z=W=>{W.key==="Escape"&&F&&Pe()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[$e,F,Pe]),it)return null;const De=Q!=="none"?It(Q):null,Xe=V||F,dt=F?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:V?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:N}:De?{position:"absolute",...De,zIndex:N}:{position:"absolute",top:de,left:ae,width:ie,height:se,zIndex:N},ut=["n","e","s","w","ne","se","sw","nw"],mt={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};return e.jsxs("div",{ref:Se,id:xe,className:`nice-window nice-window--${ue} ${$e?"nice-window--focused":""} ${je?"nice-window--pinned":""} ${Xe?"nice-window--maximized":""} ${Q!=="none"?`nice-window--snapped-${Q}`:""} ${fe??""}`,style:{...dt,...ze},onMouseDown:ke,role:"dialog","aria-label":i,...pe,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:lt,onDoubleClick:rt,children:[s&&e.jsx("span",{className:"nice-window__icon",children:s}),e.jsx("span",{className:"nice-window__title",children:i}),e.jsxs("div",{className:"nice-window__actions",children:[he,r&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${je?"nice-window__action--active":""}`,onClick:ct,title:ne("window.pin",je?"Unpin":"Pin"),children:e.jsx(X.oa,{name:"paperclip",size:14})}),P&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:ot,title:ne("window.minimize","Minimize"),children:e.jsx(X.oa,{name:"minus",size:14})}),c&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:Te,title:ne("window.maximize",V?"Restore":"Maximize"),children:e.jsx(X.oa,{name:V?"copy":"window",size:14})}),g&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:Pe,title:ne("window.fullscreen",F?"Exit Full Screen":"Full Screen"),children:e.jsx(X.oa,{name:F?"collapse":"expand",size:14})}),j&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--close",onClick:st,title:ne("window.close","Close"),children:e.jsx(X.oa,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-window__body",children:l}),h&&e.jsx("div",{className:"nice-window__footer",children:h}),me&&e.jsx("div",{className:"nice-window__statusbar",children:me}),C&&!Xe&&Q==="none"&&e.jsx(e.Fragment,{children:ut.map(z=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${z}`,style:{cursor:mt[z]},onMouseDown:W=>at(z,W)},z))})]})});Ke.displayName="NiceWindow";exports.NiceActionSheet=ht;exports.NiceBlockUI=Fe;exports.NiceBox=xt;exports.NiceCommandPaletteProvider=Ae;exports.NiceLoadPanel=pt;exports.NicePopover=ft;exports.NiceResizable=_t;exports.NiceResponsiveBox=wt;exports.NiceScrollView=gt;exports.NiceTutorial=Be;exports.NiceTutorialProvider=He;exports.NiceWindow=Ke;exports.NiceWindowManager=Ue;exports.fuzzyMatch=Me;exports.highlightMatches=qe;exports.useCommandPalette=We;exports.useNiceTutorial=Rt;exports.useRegisterCommands=vt;
|