@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,596 @@
|
|
|
1
|
+
import { jsxs as k, jsx as i, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { D as ee, r as be, g as ne, i as ve, J as _e, G as ge, c as ye, j as ke } from "./charts-BZgyyybE.js";
|
|
3
|
+
import { forwardRef as te, useCallback as Ne, useState as V, useRef as Z, useLayoutEffect as xe, useEffect as $e, useMemo as we } from "react";
|
|
4
|
+
import Me from "react-dom";
|
|
5
|
+
import { s as Pe } from "./NiceSelect-Dudf2T5T.js";
|
|
6
|
+
const Ce = te(
|
|
7
|
+
({
|
|
8
|
+
children: c,
|
|
9
|
+
variant: l = "primary",
|
|
10
|
+
size: u = "md",
|
|
11
|
+
type: d = "button",
|
|
12
|
+
disabled: n,
|
|
13
|
+
loading: e,
|
|
14
|
+
fullWidth: t,
|
|
15
|
+
onClick: h,
|
|
16
|
+
leftIcon: o,
|
|
17
|
+
rightIcon: a,
|
|
18
|
+
error: s,
|
|
19
|
+
errorPlacement: _ = "bottom",
|
|
20
|
+
ariaLabel: B,
|
|
21
|
+
className: U,
|
|
22
|
+
style: G,
|
|
23
|
+
id: E,
|
|
24
|
+
accessMode: O,
|
|
25
|
+
displayStyle: I,
|
|
26
|
+
...J
|
|
27
|
+
}, K) => {
|
|
28
|
+
const M = ve(l), S = _e(u), L = ee(O, E), H = L === "hidden";
|
|
29
|
+
(L === "disabled" || L === "readOnly") && (n = !0);
|
|
30
|
+
const D = be("button", I), F = ne("button", I);
|
|
31
|
+
let A = D;
|
|
32
|
+
if (M !== "primary") {
|
|
33
|
+
const y = { ...D };
|
|
34
|
+
delete y.background, delete y.color, (M === "outline" || M === "ghost") && (delete y.border, delete y.borderColor, delete y.borderWidth, delete y.borderStyle, delete y.boxShadow), A = y;
|
|
35
|
+
}
|
|
36
|
+
const g = c != null && c !== !1 && !(typeof c == "string" && c.trim() === ""), P = !g && !!(o || a), j = /* @__PURE__ */ k(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
ref: K,
|
|
40
|
+
type: d,
|
|
41
|
+
id: E,
|
|
42
|
+
className: `nice-btn nice-btn--${M} nice-btn--${S} nice-btn--ds-${F} ${P ? "nice-btn--icon-only" : ""} ${t ? "nice-btn--full-width" : ""} ${e ? "nice-btn--loading" : ""} ${s && !_ ? "nice-btn--has-error" : ""} ${U || ""}`,
|
|
43
|
+
style: { ...A, ...G },
|
|
44
|
+
disabled: n || e,
|
|
45
|
+
"aria-busy": e || void 0,
|
|
46
|
+
"aria-disabled": n || e || void 0,
|
|
47
|
+
"aria-label": B,
|
|
48
|
+
onClick: h,
|
|
49
|
+
...J,
|
|
50
|
+
children: [
|
|
51
|
+
e && /* @__PURE__ */ i(
|
|
52
|
+
"svg",
|
|
53
|
+
{
|
|
54
|
+
className: "nice-btn__spinner",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
fill: "none",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
strokeWidth: "3",
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
children: /* @__PURE__ */ i("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
!e && o && /* @__PURE__ */ i("span", { className: "nice-btn__icon", "aria-hidden": "true", children: o }),
|
|
64
|
+
!e && g && /* @__PURE__ */ i("span", { children: c }),
|
|
65
|
+
e && g && /* @__PURE__ */ i("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: c }),
|
|
66
|
+
e && P && /* @__PURE__ */ i("span", { className: "nice-btn__icon", style: { visibility: "hidden" }, "aria-hidden": "true", children: o || a }),
|
|
67
|
+
!e && a && /* @__PURE__ */ i("span", { className: "nice-btn__icon", "aria-hidden": "true", children: a })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
if (H)
|
|
72
|
+
return null;
|
|
73
|
+
if (!s)
|
|
74
|
+
return j;
|
|
75
|
+
const C = /* @__PURE__ */ i("div", { className: "nice-field__error", role: "alert", children: s });
|
|
76
|
+
return _ === "right" ? /* @__PURE__ */ k(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
className: `nice-btn-field nice-btn-field--right nice-field--${S}`,
|
|
80
|
+
style: {
|
|
81
|
+
display: "inline-flex",
|
|
82
|
+
flexDirection: "row",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
gap: "8px",
|
|
85
|
+
width: "fit-content"
|
|
86
|
+
},
|
|
87
|
+
children: [
|
|
88
|
+
j,
|
|
89
|
+
C
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
) : H ? null : /* @__PURE__ */ k(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: `nice-btn-field nice-btn-field--bottom nice-field--${S}`,
|
|
96
|
+
style: {
|
|
97
|
+
display: "inline-flex",
|
|
98
|
+
flexDirection: "column",
|
|
99
|
+
alignItems: "flex-start",
|
|
100
|
+
gap: "4px",
|
|
101
|
+
width: "fit-content"
|
|
102
|
+
},
|
|
103
|
+
children: [
|
|
104
|
+
j,
|
|
105
|
+
C
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
Ce.displayName = "NiceButton";
|
|
112
|
+
const Ee = [
|
|
113
|
+
"var(--nice-danger, #ef4444)",
|
|
114
|
+
"var(--nice-warning, #f97316)",
|
|
115
|
+
"var(--nice-warning, #f59e0b)",
|
|
116
|
+
"var(--nice-success, #84cc16)",
|
|
117
|
+
"var(--nice-success, #10b981)",
|
|
118
|
+
"var(--nice-info, #06b6d4)",
|
|
119
|
+
"var(--nice-primary, #3b82f6)",
|
|
120
|
+
"var(--nice-info, #6366f1)",
|
|
121
|
+
"var(--nice-accent, #8b5cf6)",
|
|
122
|
+
"var(--nice-accent-pink, #ec4899)",
|
|
123
|
+
"var(--nice-text-secondary, #64748b)",
|
|
124
|
+
"var(--nice-text, #1e293b)"
|
|
125
|
+
];
|
|
126
|
+
function Se() {
|
|
127
|
+
return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
128
|
+
}
|
|
129
|
+
function Le(c) {
|
|
130
|
+
const l = /^#?([0-9a-f]{6})$/i.exec(c.trim());
|
|
131
|
+
if (!l)
|
|
132
|
+
return { r: 0, g: 0, b: 0 };
|
|
133
|
+
const u = parseInt(l[1], 16);
|
|
134
|
+
return { r: u >> 16 & 255, g: u >> 8 & 255, b: u & 255 };
|
|
135
|
+
}
|
|
136
|
+
function Re(c, l, u) {
|
|
137
|
+
const d = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
138
|
+
return `#${d(c)}${d(l)}${d(u)}`;
|
|
139
|
+
}
|
|
140
|
+
function De(c, l, u) {
|
|
141
|
+
const d = c / 255, n = l / 255, e = u / 255, t = Math.max(d, n, e), h = Math.min(d, n, e), o = (t + h) / 2;
|
|
142
|
+
let a = 0, s = 0;
|
|
143
|
+
if (t !== h) {
|
|
144
|
+
const _ = t - h;
|
|
145
|
+
switch (s = o > 0.5 ? _ / (2 - t - h) : _ / (t + h), t) {
|
|
146
|
+
case d:
|
|
147
|
+
a = (n - e) / _ + (n < e ? 6 : 0);
|
|
148
|
+
break;
|
|
149
|
+
case n:
|
|
150
|
+
a = (e - d) / _ + 2;
|
|
151
|
+
break;
|
|
152
|
+
case e:
|
|
153
|
+
a = (d - n) / _ + 4;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
a *= 60;
|
|
157
|
+
}
|
|
158
|
+
return { h: Math.round(a), s: Math.round(s * 100), l: Math.round(o * 100) };
|
|
159
|
+
}
|
|
160
|
+
function He(c, l, u) {
|
|
161
|
+
const d = l / 100, n = u / 100, e = (1 - Math.abs(2 * n - 1)) * d, t = e * (1 - Math.abs(c / 60 % 2 - 1)), h = n - e / 2;
|
|
162
|
+
let o = 0, a = 0, s = 0;
|
|
163
|
+
return c < 60 ? [o, a, s] = [e, t, 0] : c < 120 ? [o, a, s] = [t, e, 0] : c < 180 ? [o, a, s] = [0, e, t] : c < 240 ? [o, a, s] = [0, t, e] : c < 300 ? [o, a, s] = [t, 0, e] : [o, a, s] = [e, 0, t], {
|
|
164
|
+
r: Math.round((o + h) * 255),
|
|
165
|
+
g: Math.round((a + h) * 255),
|
|
166
|
+
b: Math.round((s + h) * 255)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function Te(c, l, u) {
|
|
170
|
+
const d = c / 255, n = l / 255, e = u / 255, t = Math.max(d, n, e), h = Math.min(d, n, e), o = t - h;
|
|
171
|
+
let a = 0;
|
|
172
|
+
o !== 0 && (t === d ? a = (n - e) / o % 6 : t === n ? a = (e - d) / o + 2 : a = (d - n) / o + 4, a *= 60, a < 0 && (a += 360));
|
|
173
|
+
const s = t === 0 ? 0 : o / t;
|
|
174
|
+
return { h: Math.round(a), s: Math.round(s * 100), v: Math.round(t * 100) };
|
|
175
|
+
}
|
|
176
|
+
function Oe(c, l, u) {
|
|
177
|
+
const d = l / 100, n = u / 100, e = n * d, t = e * (1 - Math.abs(c / 60 % 2 - 1)), h = n - e;
|
|
178
|
+
let o = 0, a = 0, s = 0;
|
|
179
|
+
return c < 60 ? [o, a, s] = [e, t, 0] : c < 120 ? [o, a, s] = [t, e, 0] : c < 180 ? [o, a, s] = [0, e, t] : c < 240 ? [o, a, s] = [0, t, e] : c < 300 ? [o, a, s] = [t, 0, e] : [o, a, s] = [e, 0, t], {
|
|
180
|
+
r: Math.round((o + h) * 255),
|
|
181
|
+
g: Math.round((a + h) * 255),
|
|
182
|
+
b: Math.round((s + h) * 255)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function Fe(c) {
|
|
186
|
+
let l = c.trim();
|
|
187
|
+
const u = /var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);
|
|
188
|
+
u && (l = u[1]);
|
|
189
|
+
const d = /^#?([0-9a-f]{3})$/i.exec(l);
|
|
190
|
+
d && (l = `#${d[1].split("").map((t) => t + t).join("")}`);
|
|
191
|
+
const n = /^#?([0-9a-f]{6})$/i.exec(l), e = /^#?([0-9a-f]{8})$/i.exec(l);
|
|
192
|
+
if (e) {
|
|
193
|
+
const t = e[1];
|
|
194
|
+
return {
|
|
195
|
+
r: parseInt(t.slice(0, 2), 16),
|
|
196
|
+
g: parseInt(t.slice(2, 4), 16),
|
|
197
|
+
b: parseInt(t.slice(4, 6), 16),
|
|
198
|
+
a: parseInt(t.slice(6, 8), 16) / 255
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (n) {
|
|
202
|
+
const t = parseInt(n[1], 16);
|
|
203
|
+
return { r: t >> 16 & 255, g: t >> 8 & 255, b: t & 255, a: 1 };
|
|
204
|
+
}
|
|
205
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
206
|
+
}
|
|
207
|
+
function je(c, l, u, d, n) {
|
|
208
|
+
const e = (h) => Math.max(0, Math.min(255, Math.round(h))).toString(16).padStart(2, "0"), t = `#${e(c)}${e(l)}${e(u)}`;
|
|
209
|
+
return n ? `${t}${e(d * 255)}` : t;
|
|
210
|
+
}
|
|
211
|
+
const re = te(
|
|
212
|
+
({
|
|
213
|
+
label: c,
|
|
214
|
+
helperText: l,
|
|
215
|
+
error: u,
|
|
216
|
+
required: d,
|
|
217
|
+
disabled: n,
|
|
218
|
+
id: e,
|
|
219
|
+
className: t,
|
|
220
|
+
style: h,
|
|
221
|
+
accessMode: o,
|
|
222
|
+
displayStyle: a,
|
|
223
|
+
value: s = "var(--nice-primary, #3b82f6)",
|
|
224
|
+
onChange: _,
|
|
225
|
+
presets: B = Ee,
|
|
226
|
+
showInput: U = !1,
|
|
227
|
+
showRandom: G = !1,
|
|
228
|
+
withAlpha: E = !1,
|
|
229
|
+
compact: O = !1,
|
|
230
|
+
showKeyboardHints: I,
|
|
231
|
+
size: J = "md",
|
|
232
|
+
labelPlacement: K,
|
|
233
|
+
errorPlacement: M,
|
|
234
|
+
labelWidth: S,
|
|
235
|
+
controlWidth: L,
|
|
236
|
+
loading: H
|
|
237
|
+
}, D) => {
|
|
238
|
+
const F = ee(o, e), A = F === "hidden";
|
|
239
|
+
(F === "disabled" || F === "readOnly") && (n = !0);
|
|
240
|
+
const { t: g } = ge(), P = ye(e);
|
|
241
|
+
ne("input", a);
|
|
242
|
+
const j = Ne(() => {
|
|
243
|
+
n || _?.(Se());
|
|
244
|
+
}, [n, _]), [C, y] = V(!1), [Y, ie] = V(null), [q, ce] = V(""), W = Z(null), z = Z(null);
|
|
245
|
+
xe(() => {
|
|
246
|
+
if (!C || !z.current)
|
|
247
|
+
return;
|
|
248
|
+
ce(Pe(z.current));
|
|
249
|
+
const m = () => {
|
|
250
|
+
const p = z.current?.getBoundingClientRect();
|
|
251
|
+
if (!p)
|
|
252
|
+
return;
|
|
253
|
+
const x = 280, $ = 360;
|
|
254
|
+
let N = p.left, R = p.bottom + 6;
|
|
255
|
+
N + x > window.innerWidth - 8 && (N = Math.max(8, window.innerWidth - x - 8)), R + $ > window.innerHeight - 8 && (R = Math.max(8, p.top - $ - 6)), ie({ left: N, top: R });
|
|
256
|
+
};
|
|
257
|
+
return m(), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
|
|
258
|
+
window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
|
|
259
|
+
};
|
|
260
|
+
}, [C]), $e(() => {
|
|
261
|
+
if (!C)
|
|
262
|
+
return;
|
|
263
|
+
const m = (x) => {
|
|
264
|
+
const $ = x.target;
|
|
265
|
+
W.current?.contains($) || z.current?.contains($) || y(!1);
|
|
266
|
+
}, p = (x) => {
|
|
267
|
+
x.key === "Escape" && y(!1);
|
|
268
|
+
};
|
|
269
|
+
return document.addEventListener("mousedown", m), document.addEventListener("keydown", p), () => {
|
|
270
|
+
document.removeEventListener("mousedown", m), document.removeEventListener("keydown", p);
|
|
271
|
+
};
|
|
272
|
+
}, [C]);
|
|
273
|
+
const ae = we(
|
|
274
|
+
() => [
|
|
275
|
+
{ key: "Enter", description: g("shortcuts.openPicker", "Open color picker") },
|
|
276
|
+
{ key: "Arrow keys", description: g("shortcuts.navigatePresets", "Navigate presets") }
|
|
277
|
+
],
|
|
278
|
+
[g]
|
|
279
|
+
);
|
|
280
|
+
return A ? null : /* @__PURE__ */ k(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: `nice-field nice-field--${J} ${K === "left" ? "nice-field--label-left" : ""} ${O ? "nice-color-picker--compact" : ""} ${H ? "nice-field--loading" : ""} ${t || ""}`,
|
|
284
|
+
style: {
|
|
285
|
+
...h,
|
|
286
|
+
...S != null && {
|
|
287
|
+
"--nice-field-label-width": typeof S == "number" ? `${S}px` : S
|
|
288
|
+
},
|
|
289
|
+
...L != null && {
|
|
290
|
+
"--nice-field-control-width": typeof L == "number" ? `${L}px` : L
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"aria-busy": H || void 0,
|
|
294
|
+
children: [
|
|
295
|
+
c && /* @__PURE__ */ k(
|
|
296
|
+
"label",
|
|
297
|
+
{
|
|
298
|
+
htmlFor: P,
|
|
299
|
+
className: `nice-field__label ${d ? "nice-field__label--required" : ""}`,
|
|
300
|
+
children: [
|
|
301
|
+
c,
|
|
302
|
+
I && /* @__PURE__ */ i(ke, { shortcuts: ae, size: "sm" })
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ i("div", { className: "nice-field__control", children: /* @__PURE__ */ k("div", { className: "nice-color-picker", children: [
|
|
307
|
+
/* @__PURE__ */ k("div", { className: "nice-color-picker__preview-row", children: [
|
|
308
|
+
/* @__PURE__ */ i(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
ref: z,
|
|
312
|
+
className: "nice-color-picker__swatch",
|
|
313
|
+
id: P,
|
|
314
|
+
style: { background: s },
|
|
315
|
+
onClick: (m) => {
|
|
316
|
+
m.stopPropagation(), n || y((p) => !p);
|
|
317
|
+
},
|
|
318
|
+
onKeyDown: (m) => {
|
|
319
|
+
!n && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), y((p) => !p));
|
|
320
|
+
},
|
|
321
|
+
role: "button",
|
|
322
|
+
tabIndex: 0,
|
|
323
|
+
"aria-label": g("colorPicker.openPalette", "Open color palette"),
|
|
324
|
+
"aria-haspopup": "dialog",
|
|
325
|
+
"aria-expanded": C,
|
|
326
|
+
children: /* @__PURE__ */ i(
|
|
327
|
+
"input",
|
|
328
|
+
{
|
|
329
|
+
ref: (m) => {
|
|
330
|
+
typeof D == "function" ? D(m) : D && (D.current = m);
|
|
331
|
+
},
|
|
332
|
+
type: "hidden",
|
|
333
|
+
value: s,
|
|
334
|
+
disabled: n,
|
|
335
|
+
readOnly: !0
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
U && /* @__PURE__ */ i(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
className: "nice-input nice-input--sm",
|
|
344
|
+
style: O ? { flex: 1, minWidth: 0 } : { width: 100 },
|
|
345
|
+
children: /* @__PURE__ */ i(
|
|
346
|
+
"input",
|
|
347
|
+
{
|
|
348
|
+
className: "nice-input__native",
|
|
349
|
+
type: "text",
|
|
350
|
+
value: s,
|
|
351
|
+
disabled: n,
|
|
352
|
+
onChange: (m) => _?.(m.target.value),
|
|
353
|
+
maxLength: E ? 9 : 7
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
G && !O && /* @__PURE__ */ i(
|
|
359
|
+
"button",
|
|
360
|
+
{
|
|
361
|
+
type: "button",
|
|
362
|
+
className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
|
|
363
|
+
onClick: j,
|
|
364
|
+
disabled: n,
|
|
365
|
+
title: g("colorPicker.random", "Random"),
|
|
366
|
+
"aria-label": g("colorPicker.random", "Random"),
|
|
367
|
+
style: {
|
|
368
|
+
fontSize: "0.65rem",
|
|
369
|
+
textTransform: "uppercase",
|
|
370
|
+
letterSpacing: "0.05em"
|
|
371
|
+
},
|
|
372
|
+
children: g("colorPicker.random", "Random")
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
H && /* @__PURE__ */ i("span", { className: "nice-field__spinner", children: /* @__PURE__ */ i("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
376
|
+
M === "right" && u && /* @__PURE__ */ i("div", { id: `${P}-error`, className: "nice-field__error", role: "alert", children: u }),
|
|
377
|
+
M === "right" && !u && l && /* @__PURE__ */ i("div", { id: `${P}-helper`, className: "nice-field__helper", children: l })
|
|
378
|
+
] }),
|
|
379
|
+
C && Y && typeof document < "u" && Me.createPortal(
|
|
380
|
+
/* @__PURE__ */ i(
|
|
381
|
+
"div",
|
|
382
|
+
{
|
|
383
|
+
ref: W,
|
|
384
|
+
className: `nice-color-picker__popup nice-color-picker__popup--portal ${q}`,
|
|
385
|
+
"data-theme": q === "nice-dark" ? "dark" : q === "nice-light" ? "light" : void 0,
|
|
386
|
+
role: "dialog",
|
|
387
|
+
"aria-label": g("colorPicker.palette", "Color palette"),
|
|
388
|
+
style: { position: "fixed", left: Y.left, top: Y.top },
|
|
389
|
+
onClick: (m) => m.stopPropagation(),
|
|
390
|
+
children: (() => {
|
|
391
|
+
const m = Fe(s), p = { r: m.r, g: m.g, b: m.b }, x = E ? m.a : 1, $ = De(p.r, p.g, p.b), N = Te(p.r, p.g, p.b), R = (r, b, v, f = x) => _?.(je(r, b, v, f, E)), oe = (r, b, v) => R(r, b, v), se = (r, b, v) => {
|
|
392
|
+
const f = He(r, b, v);
|
|
393
|
+
R(f.r, f.g, f.b);
|
|
394
|
+
}, X = (r, b, v) => {
|
|
395
|
+
const f = Oe(r, b, v);
|
|
396
|
+
R(f.r, f.g, f.b);
|
|
397
|
+
}, Q = (r) => R(p.r, p.g, p.b, r), le = (r) => {
|
|
398
|
+
if (n)
|
|
399
|
+
return;
|
|
400
|
+
const b = r.currentTarget, v = (w) => {
|
|
401
|
+
const T = b.getBoundingClientRect(), pe = Math.max(0, Math.min(T.width, w.clientX - T.left)), ue = Math.max(0, Math.min(T.height, w.clientY - T.top)), me = Math.round(pe / T.width * 100), fe = 100 - Math.round(ue / T.height * 100);
|
|
402
|
+
X(N.h, me, fe);
|
|
403
|
+
};
|
|
404
|
+
v(r);
|
|
405
|
+
const f = () => {
|
|
406
|
+
document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", f);
|
|
407
|
+
};
|
|
408
|
+
document.addEventListener("pointermove", v), document.addEventListener("pointerup", f);
|
|
409
|
+
}, de = `hsl(${N.h}, 100%, 50%)`;
|
|
410
|
+
return /* @__PURE__ */ k(he, { children: [
|
|
411
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ i(
|
|
412
|
+
"input",
|
|
413
|
+
{
|
|
414
|
+
type: "text",
|
|
415
|
+
className: "nice-input__native nice-color-picker__popup-hex",
|
|
416
|
+
value: s,
|
|
417
|
+
disabled: n,
|
|
418
|
+
onChange: (r) => _?.(r.target.value),
|
|
419
|
+
maxLength: E ? 9 : 7,
|
|
420
|
+
"aria-label": g("colorPicker.hexValue", "Hex value")
|
|
421
|
+
}
|
|
422
|
+
) }),
|
|
423
|
+
/* @__PURE__ */ i(
|
|
424
|
+
"input",
|
|
425
|
+
{
|
|
426
|
+
type: "range",
|
|
427
|
+
min: 0,
|
|
428
|
+
max: 360,
|
|
429
|
+
value: N.h,
|
|
430
|
+
disabled: n,
|
|
431
|
+
onChange: (r) => X(Number(r.target.value), N.s, N.v),
|
|
432
|
+
className: "nice-color-picker__hue-slider",
|
|
433
|
+
"aria-label": g("colorPicker.hue", "Hue")
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ i(
|
|
437
|
+
"div",
|
|
438
|
+
{
|
|
439
|
+
className: "nice-color-picker__sv",
|
|
440
|
+
style: {
|
|
441
|
+
background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${de})`
|
|
442
|
+
},
|
|
443
|
+
onPointerDown: le,
|
|
444
|
+
role: "application",
|
|
445
|
+
"aria-label": g("colorPicker.svPalette", "Saturation/value palette"),
|
|
446
|
+
children: /* @__PURE__ */ i(
|
|
447
|
+
"span",
|
|
448
|
+
{
|
|
449
|
+
className: "nice-color-picker__sv-marker",
|
|
450
|
+
style: { left: `${N.s}%`, top: `${100 - N.v}%` }
|
|
451
|
+
}
|
|
452
|
+
)
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ k("div", { className: "nice-color-picker__sliders", children: [
|
|
456
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((r) => {
|
|
457
|
+
const b = r === "h" ? 360 : 100, v = $[r], f = (w) => se(
|
|
458
|
+
r === "h" ? w : $.h,
|
|
459
|
+
r === "s" ? w : $.s,
|
|
460
|
+
r === "l" ? w : $.l
|
|
461
|
+
);
|
|
462
|
+
return /* @__PURE__ */ k("div", { className: "nice-color-picker__slider-row", children: [
|
|
463
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
|
|
464
|
+
/* @__PURE__ */ i(
|
|
465
|
+
"input",
|
|
466
|
+
{
|
|
467
|
+
type: "range",
|
|
468
|
+
min: 0,
|
|
469
|
+
max: b,
|
|
470
|
+
value: v,
|
|
471
|
+
disabled: n,
|
|
472
|
+
onChange: (w) => f(Number(w.target.value))
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
/* @__PURE__ */ i(
|
|
476
|
+
"input",
|
|
477
|
+
{
|
|
478
|
+
type: "number",
|
|
479
|
+
min: 0,
|
|
480
|
+
max: b,
|
|
481
|
+
value: v,
|
|
482
|
+
disabled: n,
|
|
483
|
+
onChange: (w) => f(Number(w.target.value) || 0),
|
|
484
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
] }, r);
|
|
488
|
+
}) }),
|
|
489
|
+
/* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((r) => {
|
|
490
|
+
const b = p[r], v = (f) => oe(
|
|
491
|
+
r === "r" ? f : p.r,
|
|
492
|
+
r === "g" ? f : p.g,
|
|
493
|
+
r === "b" ? f : p.b
|
|
494
|
+
);
|
|
495
|
+
return /* @__PURE__ */ k("div", { className: "nice-color-picker__slider-row", children: [
|
|
496
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
|
|
497
|
+
/* @__PURE__ */ i(
|
|
498
|
+
"input",
|
|
499
|
+
{
|
|
500
|
+
type: "range",
|
|
501
|
+
min: 0,
|
|
502
|
+
max: 255,
|
|
503
|
+
value: b,
|
|
504
|
+
disabled: n,
|
|
505
|
+
onChange: (f) => v(Number(f.target.value))
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
/* @__PURE__ */ i(
|
|
509
|
+
"input",
|
|
510
|
+
{
|
|
511
|
+
type: "number",
|
|
512
|
+
min: 0,
|
|
513
|
+
max: 255,
|
|
514
|
+
value: b,
|
|
515
|
+
disabled: n,
|
|
516
|
+
onChange: (f) => v(Number(f.target.value) || 0),
|
|
517
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] }, r);
|
|
521
|
+
}) })
|
|
522
|
+
] }),
|
|
523
|
+
E && /* @__PURE__ */ k("div", { className: "nice-color-picker__alpha-row", children: [
|
|
524
|
+
/* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: "A" }),
|
|
525
|
+
/* @__PURE__ */ i(
|
|
526
|
+
"input",
|
|
527
|
+
{
|
|
528
|
+
type: "range",
|
|
529
|
+
min: 0,
|
|
530
|
+
max: 100,
|
|
531
|
+
value: Math.round(x * 100),
|
|
532
|
+
disabled: n,
|
|
533
|
+
onChange: (r) => Q(Number(r.target.value) / 100),
|
|
534
|
+
className: "nice-color-picker__alpha-slider",
|
|
535
|
+
style: {
|
|
536
|
+
background: `linear-gradient(to right, transparent, rgb(${p.r},${p.g},${p.b}))`
|
|
537
|
+
},
|
|
538
|
+
"aria-label": g("colorPicker.alpha", "Alpha")
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
/* @__PURE__ */ i(
|
|
542
|
+
"input",
|
|
543
|
+
{
|
|
544
|
+
type: "number",
|
|
545
|
+
min: 0,
|
|
546
|
+
max: 100,
|
|
547
|
+
value: Math.round(x * 100),
|
|
548
|
+
disabled: n,
|
|
549
|
+
onChange: (r) => Q((Number(r.target.value) || 0) / 100),
|
|
550
|
+
className: "nice-input__native nice-color-picker__slider-num"
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
] }),
|
|
554
|
+
B.length > 0 && /* @__PURE__ */ i("div", { className: "nice-color-picker__popup-presets", children: B.map((r) => /* @__PURE__ */ i(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
className: `nice-color-picker__preset ${s === r ? "nice-color-picker__preset--active" : ""}`,
|
|
558
|
+
style: { background: r },
|
|
559
|
+
onClick: () => {
|
|
560
|
+
_?.(r), y(!1);
|
|
561
|
+
},
|
|
562
|
+
role: "button",
|
|
563
|
+
tabIndex: 0,
|
|
564
|
+
"aria-label": r,
|
|
565
|
+
onKeyDown: (b) => {
|
|
566
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), _?.(r), y(!1));
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
r
|
|
570
|
+
)) })
|
|
571
|
+
] });
|
|
572
|
+
})()
|
|
573
|
+
}
|
|
574
|
+
),
|
|
575
|
+
document.body
|
|
576
|
+
)
|
|
577
|
+
] }) }),
|
|
578
|
+
M !== "right" && u && /* @__PURE__ */ i("div", { id: `${P}-error`, className: "nice-field__error", role: "alert", children: u }),
|
|
579
|
+
M !== "right" && !u && l && /* @__PURE__ */ i("div", { id: `${P}-helper`, className: "nice-field__helper", children: l })
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
re.displayName = "NiceColorPicker";
|
|
586
|
+
const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
587
|
+
__proto__: null,
|
|
588
|
+
NiceColorPicker: re,
|
|
589
|
+
hexToRgb: Le,
|
|
590
|
+
rgbToHex: Re
|
|
591
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
592
|
+
export {
|
|
593
|
+
re as N,
|
|
594
|
+
Ce as a,
|
|
595
|
+
Ge as b
|
|
596
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),C=require("./charts-B8_V3_nq.cjs"),d=require("react"),N={info:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),error:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),success:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})},b=({visible:c,message:m,header:o,icon:h,variant:i="warning",acceptLabel:a,rejectLabel:f,onAccept:u,onReject:n,closeOnOverlay:v=!1,closeOnEscape:s=!0,size:x="md",className:g,style:j})=>{const{t}=C.Gt();if(d.useEffect(()=>{if(!c||!s)return;const r=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[c,s,n]),d.useEffect(()=>(c?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[c]),!c)return null;const l=h??N[i],w=a??t("confirm.accept","Yes"),y=f??t("confirm.reject","No");return e.jsx("div",{className:"nice-modal-overlay",onClick:v?n:void 0,children:e.jsxs("div",{className:`nice-confirm nice-confirm--${i} nice-confirm--${x} ${g||""}`,style:j,role:"alertdialog","aria-modal":"true","aria-label":o,"aria-describedby":"nice-confirm-message",onClick:r=>r.stopPropagation(),children:[o&&e.jsx("div",{className:"nice-confirm__header",children:e.jsx("h3",{className:"nice-confirm__title",children:o})}),e.jsxs("div",{className:"nice-confirm__body",children:[l&&e.jsx("div",{className:`nice-confirm__icon nice-confirm__icon--${i}`,children:l}),e.jsx("div",{id:"nice-confirm-message",className:"nice-confirm__message",children:m})]}),e.jsxs("div",{className:"nice-confirm__footer",children:[e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--md",onClick:n,children:y}),e.jsx("button",{type:"button",className:`nice-btn nice-btn--${i==="error"?"error":"primary"} nice-btn--md`,onClick:u,autoFocus:!0,children:w})]})]})})};exports.NiceConfirmDialog=b;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { G as C } from "./charts-BZgyyybE.js";
|
|
3
|
+
import m from "react";
|
|
4
|
+
const z = {
|
|
5
|
+
info: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }),
|
|
6
|
+
warning: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }),
|
|
7
|
+
error: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
|
|
8
|
+
success: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) })
|
|
9
|
+
}, E = ({
|
|
10
|
+
visible: i,
|
|
11
|
+
message: a,
|
|
12
|
+
header: o,
|
|
13
|
+
icon: h,
|
|
14
|
+
variant: n = "warning",
|
|
15
|
+
acceptLabel: f,
|
|
16
|
+
rejectLabel: v,
|
|
17
|
+
onAccept: u,
|
|
18
|
+
onReject: c,
|
|
19
|
+
closeOnOverlay: g = !1,
|
|
20
|
+
closeOnEscape: l = !0,
|
|
21
|
+
size: p = "md",
|
|
22
|
+
className: w,
|
|
23
|
+
style: y
|
|
24
|
+
}) => {
|
|
25
|
+
const { t: s } = C();
|
|
26
|
+
if (m.useEffect(() => {
|
|
27
|
+
if (!i || !l)
|
|
28
|
+
return;
|
|
29
|
+
const r = (b) => {
|
|
30
|
+
b.key === "Escape" && c();
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
33
|
+
}, [i, l, c]), m.useEffect(() => (i ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
34
|
+
document.body.style.overflow = "";
|
|
35
|
+
}), [i]), !i)
|
|
36
|
+
return null;
|
|
37
|
+
const d = h ?? z[n], _ = f ?? s("confirm.accept", "Yes"), N = v ?? s("confirm.reject", "No");
|
|
38
|
+
return /* @__PURE__ */ e("div", { className: "nice-modal-overlay", onClick: g ? c : void 0, children: /* @__PURE__ */ t(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: `nice-confirm nice-confirm--${n} nice-confirm--${p} ${w || ""}`,
|
|
42
|
+
style: y,
|
|
43
|
+
role: "alertdialog",
|
|
44
|
+
"aria-modal": "true",
|
|
45
|
+
"aria-label": o,
|
|
46
|
+
"aria-describedby": "nice-confirm-message",
|
|
47
|
+
onClick: (r) => r.stopPropagation(),
|
|
48
|
+
children: [
|
|
49
|
+
o && /* @__PURE__ */ e("div", { className: "nice-confirm__header", children: /* @__PURE__ */ e("h3", { className: "nice-confirm__title", children: o }) }),
|
|
50
|
+
/* @__PURE__ */ t("div", { className: "nice-confirm__body", children: [
|
|
51
|
+
d && /* @__PURE__ */ e("div", { className: `nice-confirm__icon nice-confirm__icon--${n}`, children: d }),
|
|
52
|
+
/* @__PURE__ */ e("div", { id: "nice-confirm-message", className: "nice-confirm__message", children: a })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ t("div", { className: "nice-confirm__footer", children: [
|
|
55
|
+
/* @__PURE__ */ e(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
type: "button",
|
|
59
|
+
className: "nice-btn nice-btn--ghost nice-btn--md",
|
|
60
|
+
onClick: c,
|
|
61
|
+
children: N
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: `nice-btn nice-btn--${n === "error" ? "error" : "primary"} nice-btn--md`,
|
|
69
|
+
onClick: u,
|
|
70
|
+
autoFocus: !0,
|
|
71
|
+
children: _
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
E as N
|
|
81
|
+
};
|