@nice2dev/ui 1.0.31 → 1.1.6

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +403 -0
  2. package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
  3. package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
  4. package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
  5. package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
  6. package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
  7. package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
  8. package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
  9. package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
  10. package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
  11. package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
  12. package/dist/NiceForm-C6F0HvrX.cjs +1 -0
  13. package/dist/NiceForm-CCyfWgIs.js +4805 -0
  14. package/dist/NiceGantt-CSFLZD2y.js +328 -0
  15. package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
  16. package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
  17. package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
  18. package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
  19. package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
  20. package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
  21. package/dist/NiceMention-CWoLD0SE.js +11082 -0
  22. package/dist/NiceMention-J1lUDLhg.cjs +430 -0
  23. package/dist/NiceMention-OaCi-GNO.js +11094 -0
  24. package/dist/NiceMention.css +1 -0
  25. package/dist/NiceModal-0UxviEYE.cjs +1 -0
  26. package/dist/NiceModal-D-iOonog.js +95 -0
  27. package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
  28. package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
  29. package/dist/NiceModuleLifecyclePanel.css +1 -1
  30. package/dist/NicePagination-CPn-Q1h_.js +172 -0
  31. package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
  32. package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
  33. package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
  34. package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
  35. package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
  36. package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
  37. package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
  38. package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
  39. package/dist/NiceSelect-DHowflmX.js +433 -0
  40. package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
  41. package/dist/NiceWindow-xnTSHdHv.js +1623 -0
  42. package/dist/charts-B-sl1V9y.cjs +882 -0
  43. package/dist/charts-DO2z6Ziu.js +31920 -0
  44. package/dist/charts.cjs +1 -1
  45. package/dist/charts.mjs +7 -7
  46. package/dist/core-C2KhqEaU.cjs +1 -0
  47. package/dist/core-K2DIxXLn.js +795 -0
  48. package/dist/data-branching-DC6hcBQN.cjs +1 -0
  49. package/dist/data-branching-DykdTpjJ.js +6255 -0
  50. package/dist/data-branching.cjs +1 -1
  51. package/dist/data-branching.mjs +1 -1
  52. package/dist/data.cjs +1 -1
  53. package/dist/data.d.ts +29 -7
  54. package/dist/data.mjs +18 -16
  55. package/dist/devops-CU0sOVEA.cjs +17 -0
  56. package/dist/devops-CXyEwQeM.js +8165 -0
  57. package/dist/devops.cjs +1 -1
  58. package/dist/devops.mjs +1 -1
  59. package/dist/editors.cjs +1 -1
  60. package/dist/editors.d.ts +97 -9
  61. package/dist/editors.mjs +58 -54
  62. package/dist/feedback.cjs +1 -1
  63. package/dist/feedback.d.ts +1 -1
  64. package/dist/feedback.mjs +3 -3
  65. package/dist/index.cjs +5137 -1
  66. package/dist/index.css +1 -1
  67. package/dist/index.d.ts +139 -21
  68. package/dist/index.mjs +66371 -992
  69. package/dist/lazy.cjs +1 -1
  70. package/dist/lazy.mjs +24 -24
  71. package/dist/navigation.cjs +1 -1
  72. package/dist/navigation.d.ts +6 -0
  73. package/dist/navigation.mjs +4 -4
  74. package/dist/no-code-C58g8_fb.cjs +332 -0
  75. package/dist/no-code-Cj4xJ3w9.js +7425 -0
  76. package/dist/no-code.cjs +1 -1
  77. package/dist/no-code.mjs +1 -1
  78. package/dist/overlays.cjs +1 -1
  79. package/dist/overlays.d.ts +2 -0
  80. package/dist/overlays.mjs +2 -2
  81. package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
  82. package/dist/pickerCommons-COiSUiP2.js +1122 -0
  83. package/dist/pickerCommons.css +1 -1
  84. package/dist/style.css +7 -7
  85. package/dist/vendor-BPVpdtPp.js +271 -0
  86. package/dist/vendor-Bo2Q64AF.cjs +1 -0
  87. package/package.json +17 -17
@@ -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-DO2z6Ziu.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-DHowflmX.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"),w=require("./charts-B-sl1V9y.cjs"),N=require("react"),pe=require("react-dom"),me=require("./NiceSelect-BVoqtfYN.cjs"),ee=N.forwardRef(({children:c,variant:l="primary",size:p="md",type:u="button",disabled:t,loading:n,fullWidth:r,onClick:h,leftIcon:o,rightIcon:s,error:a,errorPlacement:x="bottom",ariaLabel:B,className:U,style:K,id:E,accessMode:O,displayStyle:I,...Y},G)=>{const M=w.Ys(l),S=w.Js(p),R=w.Dc(O,E),H=R==="hidden";(R==="disabled"||R==="readOnly")&&(t=!0);const D=w.rc("button",I),F=w.ac("button",I);let A=D;if(M!=="primary"){const g={...D};delete g.background,delete g.color,(M==="outline"||M==="ghost")&&(delete g.border,delete g.borderColor,delete g.borderWidth,delete g.borderStyle,delete g.boxShadow),A=g}const _=c!=null&&c!==!1&&!(typeof c=="string"&&c.trim()===""),P=!_&&!!(o||s),q=e.jsxs("button",{ref:G,type:u,id:E,className:`nice-btn nice-btn--${M} nice-btn--${S} nice-btn--ds-${F} ${P?"nice-btn--icon-only":""} ${r?"nice-btn--full-width":""} ${n?"nice-btn--loading":""} ${a&&!x?"nice-btn--has-error":""} ${U||""}`,style:{...A,...K},disabled:t||n,"aria-busy":n||void 0,"aria-disabled":t||n||void 0,"aria-label":B,onClick:h,...Y,children:[n&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),!n&&o&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:o}),!n&&_&&e.jsx("span",{children:c}),n&&_&&e.jsx("span",{style:{visibility:"hidden"},"aria-hidden":"true",children:c}),n&&P&&e.jsx("span",{className:"nice-btn__icon",style:{visibility:"hidden"},"aria-hidden":"true",children:o||s}),!n&&s&&e.jsx("span",{className:"nice-btn__icon","aria-hidden":"true",children:s})]});if(H)return null;if(!a)return q;const C=e.jsx("div",{className:"nice-field__error",role:"alert",children:a});return x==="right"?e.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${S}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[q,C]}):H?null:e.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${S}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[q,C]})});ee.displayName="NiceButton";const fe=["var(--nice-danger, #ef4444)","var(--nice-warning, #f97316)","var(--nice-warning, #f59e0b)","var(--nice-success, #84cc16)","var(--nice-success, #10b981)","var(--nice-info, #06b6d4)","var(--nice-primary, #3b82f6)","var(--nice-info, #6366f1)","var(--nice-accent, #8b5cf6)","var(--nice-accent-pink, #ec4899)","var(--nice-text-secondary, #64748b)","var(--nice-text, #1e293b)"];function he(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function be(c){const l=/^#?([0-9a-f]{6})$/i.exec(c.trim());if(!l)return{r:0,g:0,b:0};const p=parseInt(l[1],16);return{r:p>>16&255,g:p>>8&255,b:p&255}}function ve(c,l,p){const u=t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0");return`#${u(c)}${u(l)}${u(p)}`}function xe(c,l,p){const u=c/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),o=(r+h)/2;let s=0,a=0;if(r!==h){const x=r-h;switch(a=o>.5?x/(2-r-h):x/(r+h),r){case u:s=(t-n)/x+(t<n?6:0);break;case t:s=(n-u)/x+2;break;case n:s=(u-t)/x+4;break}s*=60}return{h:Math.round(s),s:Math.round(a*100),l:Math.round(o*100)}}function _e(c,l,p){const u=l/100,t=p/100,n=(1-Math.abs(2*t-1))*u,r=n*(1-Math.abs(c/60%2-1)),h=t-n/2;let o=0,s=0,a=0;return c<60?[o,s,a]=[n,r,0]:c<120?[o,s,a]=[r,n,0]:c<180?[o,s,a]=[0,n,r]:c<240?[o,s,a]=[0,r,n]:c<300?[o,s,a]=[r,0,n]:[o,s,a]=[n,0,r],{r:Math.round((o+h)*255),g:Math.round((s+h)*255),b:Math.round((a+h)*255)}}function ge(c,l,p){const u=c/255,t=l/255,n=p/255,r=Math.max(u,t,n),h=Math.min(u,t,n),o=r-h;let s=0;o!==0&&(r===u?s=(t-n)/o%6:r===t?s=(n-u)/o+2:s=(u-t)/o+4,s*=60,s<0&&(s+=360));const a=r===0?0:o/r;return{h:Math.round(s),s:Math.round(a*100),v:Math.round(r*100)}}function ye(c,l,p){const u=l/100,t=p/100,n=t*u,r=n*(1-Math.abs(c/60%2-1)),h=t-n;let o=0,s=0,a=0;return c<60?[o,s,a]=[n,r,0]:c<120?[o,s,a]=[r,n,0]:c<180?[o,s,a]=[0,n,r]:c<240?[o,s,a]=[0,r,n]:c<300?[o,s,a]=[r,0,n]:[o,s,a]=[n,0,r],{r:Math.round((o+h)*255),g:Math.round((s+h)*255),b:Math.round((a+h)*255)}}function Ne(c){let l=c.trim();const p=/var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(l);p&&(l=p[1]);const u=/^#?([0-9a-f]{3})$/i.exec(l);u&&(l=`#${u[1].split("").map(r=>r+r).join("")}`);const t=/^#?([0-9a-f]{6})$/i.exec(l),n=/^#?([0-9a-f]{8})$/i.exec(l);if(n){const r=n[1];return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16),a:parseInt(r.slice(6,8),16)/255}}if(t){const r=parseInt(t[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255,a:1}}return{r:0,g:0,b:0,a:1}}function ke(c,l,p,u,t){const n=h=>Math.max(0,Math.min(255,Math.round(h))).toString(16).padStart(2,"0"),r=`#${n(c)}${n(l)}${n(p)}`;return t?`${r}${n(u*255)}`:r}const W=N.forwardRef(({label:c,helperText:l,error:p,required:u,disabled:t,id:n,className:r,style:h,accessMode:o,displayStyle:s,value:a="var(--nice-primary, #3b82f6)",onChange:x,presets:B=fe,showInput:U=!1,showRandom:K=!1,withAlpha:E=!1,compact:O=!1,showKeyboardHints:I,size:Y="md",labelPlacement:G,errorPlacement:M,labelWidth:S,controlWidth:R,loading:H},D)=>{const F=w.Dc(o,n),A=F==="hidden";(F==="disabled"||F==="readOnly")&&(t=!0);const{t:_}=w.Gt(),P=w.bc(n);w.ac("input",s);const q=N.useCallback(()=>{t||x?.(he())},[t,x]),[C,g]=N.useState(!1),[J,ne]=N.useState(null),[V,te]=N.useState(""),X=N.useRef(null),z=N.useRef(null);N.useLayoutEffect(()=>{if(!C||!z.current)return;te(me.scopeThemeClass(z.current));const m=()=>{const d=z.current?.getBoundingClientRect();if(!d)return;const k=280,j=360;let y=d.left,L=d.bottom+6;y+k>window.innerWidth-8&&(y=Math.max(8,window.innerWidth-k-8)),L+j>window.innerHeight-8&&(L=Math.max(8,d.top-j-6)),ne({left:y,top:L})};return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[C]),N.useEffect(()=>{if(!C)return;const m=k=>{const j=k.target;X.current?.contains(j)||z.current?.contains(j)||g(!1)},d=k=>{k.key==="Escape"&&g(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d)}},[C]);const re=N.useMemo(()=>[{key:"Enter",description:_("shortcuts.openPicker","Open color picker")},{key:"Arrow keys",description:_("shortcuts.navigatePresets","Navigate presets")}],[_]);return A?null:e.jsxs("div",{className:`nice-field nice-field--${Y} ${G==="left"?"nice-field--label-left":""} ${O?"nice-color-picker--compact":""} ${H?"nice-field--loading":""} ${r||""}`,style:{...h,...S!=null&&{"--nice-field-label-width":typeof S=="number"?`${S}px`:S},...R!=null&&{"--nice-field-control-width":typeof R=="number"?`${R}px`:R}},"aria-busy":H||void 0,children:[c&&e.jsxs("label",{htmlFor:P,className:`nice-field__label ${u?"nice-field__label--required":""}`,children:[c,I&&e.jsx(w.ha,{shortcuts:re,size:"sm"})]}),e.jsx("div",{className:"nice-field__control",children:e.jsxs("div",{className:"nice-color-picker",children:[e.jsxs("div",{className:"nice-color-picker__preview-row",children:[e.jsx("div",{ref:z,className:"nice-color-picker__swatch",id:P,style:{background:a},onClick:m=>{m.stopPropagation(),t||g(d=>!d)},onKeyDown:m=>{!t&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),g(d=>!d))},role:"button",tabIndex:0,"aria-label":_("colorPicker.openPalette","Open color palette"),"aria-haspopup":"dialog","aria-expanded":C,children:e.jsx("input",{ref:m=>{typeof D=="function"?D(m):D&&(D.current=m)},type:"hidden",value:a,disabled:t,readOnly:!0})}),U&&e.jsx("div",{className:"nice-input nice-input--sm",style:O?{flex:1,minWidth:0}:{width:100},children:e.jsx("input",{className:"nice-input__native",type:"text",value:a,disabled:t,onChange:m=>x?.(m.target.value),maxLength:E?9:7})}),K&&!O&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",onClick:q,disabled:t,title:_("colorPicker.random","Random"),"aria-label":_("colorPicker.random","Random"),style:{fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:_("colorPicker.random","Random")}),H&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),M==="right"&&p&&e.jsx("div",{id:`${P}-error`,className:"nice-field__error",role:"alert",children:p}),M==="right"&&!p&&l&&e.jsx("div",{id:`${P}-helper`,className:"nice-field__helper",children:l})]}),C&&J&&typeof document<"u"&&pe.createPortal(e.jsx("div",{ref:X,className:`nice-color-picker__popup nice-color-picker__popup--portal ${V}`,"data-theme":V==="nice-dark"?"dark":V==="nice-light"?"light":void 0,role:"dialog","aria-label":_("colorPicker.palette","Color palette"),style:{position:"fixed",left:J.left,top:J.top},onClick:m=>m.stopPropagation(),children:(()=>{const m=Ne(a),d={r:m.r,g:m.g,b:m.b},k=E?m.a:1,j=xe(d.r,d.g,d.b),y=ge(d.r,d.g,d.b),L=(i,b,v,f=k)=>x?.(ke(i,b,v,f,E)),ie=(i,b,v)=>L(i,b,v),ce=(i,b,v)=>{const f=_e(i,b,v);L(f.r,f.g,f.b)},Q=(i,b,v)=>{const f=ye(i,b,v);L(f.r,f.g,f.b)},Z=i=>L(d.r,d.g,d.b,i),se=i=>{if(t)return;const b=i.currentTarget,v=$=>{const T=b.getBoundingClientRect(),ae=Math.max(0,Math.min(T.width,$.clientX-T.left)),le=Math.max(0,Math.min(T.height,$.clientY-T.top)),ue=Math.round(ae/T.width*100),de=100-Math.round(le/T.height*100);Q(y.h,ue,de)};v(i);const f=()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",f)};document.addEventListener("pointermove",v),document.addEventListener("pointerup",f)},oe=`hsl(${y.h}, 100%, 50%)`;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-color-picker__popup-header",children:e.jsx("input",{type:"text",className:"nice-input__native nice-color-picker__popup-hex",value:a,disabled:t,onChange:i=>x?.(i.target.value),maxLength:E?9:7,"aria-label":_("colorPicker.hexValue","Hex value")})}),e.jsx("input",{type:"range",min:0,max:360,value:y.h,disabled:t,onChange:i=>Q(Number(i.target.value),y.s,y.v),className:"nice-color-picker__hue-slider","aria-label":_("colorPicker.hue","Hue")}),e.jsx("div",{className:"nice-color-picker__sv",style:{background:`linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${oe})`},onPointerDown:se,role:"application","aria-label":_("colorPicker.svPalette","Saturation/value palette"),children:e.jsx("span",{className:"nice-color-picker__sv-marker",style:{left:`${y.s}%`,top:`${100-y.v}%`}})}),e.jsxs("div",{className:"nice-color-picker__sliders",children:[e.jsx("div",{className:"nice-color-picker__slider-col",children:["h","s","l"].map(i=>{const b=i==="h"?360:100,v=j[i],f=$=>ce(i==="h"?$:j.h,i==="s"?$:j.s,i==="l"?$:j.l);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:b,value:v,disabled:t,onChange:$=>f(Number($.target.value))}),e.jsx("input",{type:"number",min:0,max:b,value:v,disabled:t,onChange:$=>f(Number($.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})}),e.jsx("div",{className:"nice-color-picker__slider-col",children:["r","g","b"].map(i=>{const b=d[i],v=f=>ie(i==="r"?f:d.r,i==="g"?f:d.g,i==="b"?f:d.b);return e.jsxs("div",{className:"nice-color-picker__slider-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:i.toUpperCase()}),e.jsx("input",{type:"range",min:0,max:255,value:b,disabled:t,onChange:f=>v(Number(f.target.value))}),e.jsx("input",{type:"number",min:0,max:255,value:b,disabled:t,onChange:f=>v(Number(f.target.value)||0),className:"nice-input__native nice-color-picker__slider-num"})]},i)})})]}),E&&e.jsxs("div",{className:"nice-color-picker__alpha-row",children:[e.jsx("label",{className:"nice-color-picker__slider-label",children:"A"}),e.jsx("input",{type:"range",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z(Number(i.target.value)/100),className:"nice-color-picker__alpha-slider",style:{background:`linear-gradient(to right, transparent, rgb(${d.r},${d.g},${d.b}))`},"aria-label":_("colorPicker.alpha","Alpha")}),e.jsx("input",{type:"number",min:0,max:100,value:Math.round(k*100),disabled:t,onChange:i=>Z((Number(i.target.value)||0)/100),className:"nice-input__native nice-color-picker__slider-num"})]}),B.length>0&&e.jsx("div",{className:"nice-color-picker__popup-presets",children:B.map(i=>e.jsx("div",{className:`nice-color-picker__preset ${a===i?"nice-color-picker__preset--active":""}`,style:{background:i},onClick:()=>{x?.(i),g(!1)},role:"button",tabIndex:0,"aria-label":i,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),x?.(i),g(!1))}},i))})]})})()}),document.body)]})}),M!=="right"&&p&&e.jsx("div",{id:`${P}-error`,className:"nice-field__error",role:"alert",children:p}),M!=="right"&&!p&&l&&e.jsx("div",{id:`${P}-helper`,className:"nice-field__helper",children:l})]})});W.displayName="NiceColorPicker";const je=Object.freeze(Object.defineProperty({__proto__:null,NiceColorPicker:W,hexToRgb:be,rgbToHex:ve},Symbol.toStringTag,{value:"Module"}));exports.NiceButton=ee;exports.NiceColorPicker=W;exports.NiceColorPicker$1=je;