@nice2dev/ui 1.3.8 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
  3. package/dist/NiceColorPicker-DS59tNkP.js +552 -0
  4. package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
  5. package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
  6. package/dist/NiceForm-BQj-K7p7.cjs +1 -0
  7. package/dist/NiceForm-HQ4h7hX_.js +5023 -0
  8. package/dist/NiceGantt-BygumlaY.cjs +1 -0
  9. package/dist/NiceGantt-DTC7OH-v.js +334 -0
  10. package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
  11. package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
  12. package/dist/NiceMention-CVxxCVtQ.js +11668 -0
  13. package/dist/NiceMention-Te66Oid1.cjs +430 -0
  14. package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
  15. package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
  16. package/dist/NicePagination-CKsAP38Q.cjs +1 -0
  17. package/dist/NicePagination-zOed5QxG.js +202 -0
  18. package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
  19. package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
  20. package/dist/NiceSavedQueryPanel-B8hVgWR2.cjs +587 -0
  21. package/dist/NiceSavedQueryPanel-BFtY9GOP.js +6002 -0
  22. package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
  23. package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
  24. package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
  25. package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
  26. package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
  27. package/dist/NiceSelect-DEruWHan.js +495 -0
  28. package/dist/NiceTree.doc-AIR9cRQp.js +40 -0
  29. package/dist/NiceTree.doc-DGrIAx3G.cjs +16 -0
  30. package/dist/NiceWindow-D3V7A69Q.js +2247 -0
  31. package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
  32. package/dist/core-lazy-Bjdu111n.js +351 -0
  33. package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
  34. package/dist/data.cjs +1 -1
  35. package/dist/data.d.ts +189 -14
  36. package/dist/data.mjs +3 -3
  37. package/dist/devops-CqhA0rjL.js +9130 -0
  38. package/dist/devops-cgRBnZVX.cjs +18 -0
  39. package/dist/devops.cjs +1 -1
  40. package/dist/devops.mjs +1 -1
  41. package/dist/editors.cjs +1 -1
  42. package/dist/editors.mjs +7 -7
  43. package/dist/feedback.cjs +1 -1
  44. package/dist/feedback.mjs +1 -1
  45. package/dist/index.cjs +130 -130
  46. package/dist/index.css +1 -1
  47. package/dist/index.d.ts +193 -17
  48. package/dist/index.mjs +14780 -14657
  49. package/dist/lazy.cjs +1 -1
  50. package/dist/lazy.mjs +15 -15
  51. package/dist/navigation.cjs +1 -1
  52. package/dist/navigation.d.ts +2 -0
  53. package/dist/navigation.mjs +3 -3
  54. package/dist/no-code-BQqK8mvU.cjs +331 -0
  55. package/dist/no-code-Cppb-xz3.js +8320 -0
  56. package/dist/no-code.cjs +1 -1
  57. package/dist/no-code.mjs +1 -1
  58. package/dist/overlays.cjs +1 -1
  59. package/dist/overlays.mjs +1 -1
  60. package/dist/pickerCommons-BA3-D5RC.js +663 -0
  61. package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
  62. package/dist/style.css +1 -1
  63. package/package.json +4 -4
@@ -0,0 +1,552 @@
1
+ import { jsxs as x, jsx as i, Fragment as he } from "react/jsx-runtime";
2
+ import { useNiceAccessMode as fe, useNiceTranslation as ge, useControlId as ve, useComponentDisplayClass as be, useOverlayFocus as _e, useRovingFocus as ke, NiceKeyboardHint as ye } from "@nice2dev/ui-core";
3
+ import { forwardRef as Ne, useCallback as xe, useState as B, useRef as V, useLayoutEffect as Me, useEffect as we, useMemo as $e } from "react";
4
+ import Pe from "react-dom";
5
+ import { s as Ce } from "./devops-CqhA0rjL.js";
6
+ const Re = [
7
+ "#ef4444",
8
+ "#f97316",
9
+ "#f59e0b",
10
+ "#84cc16",
11
+ "#10b981",
12
+ "#06b6d4",
13
+ "#3b82f6",
14
+ "#6366f1",
15
+ "#8b5cf6",
16
+ "#ec4899",
17
+ "#64748b",
18
+ "#1e293b"
19
+ ];
20
+ function Ee() {
21
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
22
+ }
23
+ function je(c) {
24
+ const u = /^#?([0-9a-f]{6})$/i.exec(c.trim());
25
+ if (!u)
26
+ return { r: 0, g: 0, b: 0 };
27
+ const h = parseInt(u[1], 16);
28
+ return { r: h >> 16 & 255, g: h >> 8 & 255, b: h & 255 };
29
+ }
30
+ function ze(c, u, h) {
31
+ const p = (r) => Math.max(0, Math.min(255, Math.round(r))).toString(16).padStart(2, "0");
32
+ return `#${p(c)}${p(u)}${p(h)}`;
33
+ }
34
+ function Se(c, u, h) {
35
+ const p = c / 255, r = u / 255, t = h / 255, n = Math.max(p, r, t), b = Math.min(p, r, t), m = (n + b) / 2;
36
+ let o = 0, s = 0;
37
+ if (n !== b) {
38
+ const k = n - b;
39
+ switch (s = m > 0.5 ? k / (2 - n - b) : k / (n + b), n) {
40
+ case p:
41
+ o = (r - t) / k + (r < t ? 6 : 0);
42
+ break;
43
+ case r:
44
+ o = (t - p) / k + 2;
45
+ break;
46
+ case t:
47
+ o = (p - r) / k + 4;
48
+ break;
49
+ }
50
+ o *= 60;
51
+ }
52
+ return { h: Math.round(o), s: Math.round(s * 100), l: Math.round(m * 100) };
53
+ }
54
+ function He(c, u, h) {
55
+ const p = u / 100, r = h / 100, t = (1 - Math.abs(2 * r - 1)) * p, n = t * (1 - Math.abs(c / 60 % 2 - 1)), b = r - t / 2;
56
+ let m = 0, o = 0, s = 0;
57
+ return c < 60 ? [m, o, s] = [t, n, 0] : c < 120 ? [m, o, s] = [n, t, 0] : c < 180 ? [m, o, s] = [0, t, n] : c < 240 ? [m, o, s] = [0, n, t] : c < 300 ? [m, o, s] = [n, 0, t] : [m, o, s] = [t, 0, n], {
58
+ r: Math.round((m + b) * 255),
59
+ g: Math.round((o + b) * 255),
60
+ b: Math.round((s + b) * 255)
61
+ };
62
+ }
63
+ function Le(c, u, h) {
64
+ const p = c / 255, r = u / 255, t = h / 255, n = Math.max(p, r, t), b = Math.min(p, r, t), m = n - b;
65
+ let o = 0;
66
+ m !== 0 && (n === p ? o = (r - t) / m % 6 : n === r ? o = (t - p) / m + 2 : o = (p - r) / m + 4, o *= 60, o < 0 && (o += 360));
67
+ const s = n === 0 ? 0 : m / n;
68
+ return { h: Math.round(o), s: Math.round(s * 100), v: Math.round(n * 100) };
69
+ }
70
+ function De(c, u, h) {
71
+ const p = u / 100, r = h / 100, t = r * p, n = t * (1 - Math.abs(c / 60 % 2 - 1)), b = r - t;
72
+ let m = 0, o = 0, s = 0;
73
+ return c < 60 ? [m, o, s] = [t, n, 0] : c < 120 ? [m, o, s] = [n, t, 0] : c < 180 ? [m, o, s] = [0, t, n] : c < 240 ? [m, o, s] = [0, n, t] : c < 300 ? [m, o, s] = [n, 0, t] : [m, o, s] = [t, 0, n], {
74
+ r: Math.round((m + b) * 255),
75
+ g: Math.round((o + b) * 255),
76
+ b: Math.round((s + b) * 255)
77
+ };
78
+ }
79
+ function Te(c) {
80
+ let u = c.trim();
81
+ const h = /var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(u);
82
+ h && (u = h[1]);
83
+ const p = /^#?([0-9a-f]{3})$/i.exec(u);
84
+ p && (u = `#${p[1].split("").map((n) => n + n).join("")}`);
85
+ const r = /^#?([0-9a-f]{6})$/i.exec(u), t = /^#?([0-9a-f]{8})$/i.exec(u);
86
+ if (t) {
87
+ const n = t[1];
88
+ return {
89
+ r: parseInt(n.slice(0, 2), 16),
90
+ g: parseInt(n.slice(2, 4), 16),
91
+ b: parseInt(n.slice(4, 6), 16),
92
+ a: parseInt(n.slice(6, 8), 16) / 255
93
+ };
94
+ }
95
+ if (r) {
96
+ const n = parseInt(r[1], 16);
97
+ return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255, a: 1 };
98
+ }
99
+ return { r: 0, g: 0, b: 0, a: 1 };
100
+ }
101
+ function Fe(c, u, h, p, r) {
102
+ const t = (b) => Math.max(0, Math.min(255, Math.round(b))).toString(16).padStart(2, "0"), n = `#${t(c)}${t(u)}${t(h)}`;
103
+ return r ? `${n}${t(p * 255)}` : n;
104
+ }
105
+ const Be = /* @__PURE__ */ Object.assign(
106
+ /* @__PURE__ */ Ne(
107
+ ({
108
+ label: c,
109
+ helperText: u,
110
+ error: h,
111
+ required: p,
112
+ disabled: r,
113
+ id: t,
114
+ className: n,
115
+ style: b,
116
+ accessMode: m,
117
+ displayStyle: o,
118
+ value: s = "#3b82f6",
119
+ onChange: k,
120
+ presets: q = Re,
121
+ showInput: Y = !1,
122
+ showRandom: J = !1,
123
+ withAlpha: E = !1,
124
+ compact: I = !1,
125
+ showKeyboardHints: Q,
126
+ size: Z = "md",
127
+ labelPlacement: W,
128
+ errorPlacement: L,
129
+ labelWidth: D,
130
+ controlWidth: T,
131
+ loading: A
132
+ }, F) => {
133
+ const O = fe(m, t), ee = O === "hidden";
134
+ (O === "disabled" || O === "readOnly") && (r = !0);
135
+ const { t: v } = ge(), P = ve(t);
136
+ be("input", o);
137
+ const re = xe(() => {
138
+ r || k?.(Ee());
139
+ }, [r, k]), [w, C] = B(!1), [K, ne] = B(null), [U, te] = B(""), j = V(null), S = V(null);
140
+ Me(() => {
141
+ if (!w || !S.current)
142
+ return;
143
+ te(Ce(S.current));
144
+ const d = () => {
145
+ const l = S.current?.getBoundingClientRect();
146
+ if (!l)
147
+ return;
148
+ const N = 280, $ = 360;
149
+ let _ = l.left, M = l.bottom + 6;
150
+ _ + N > window.innerWidth - 8 && (_ = Math.max(8, window.innerWidth - N - 8)), M + $ > window.innerHeight - 8 && (M = Math.max(8, l.top - $ - 6)), ne({ left: _, top: M });
151
+ };
152
+ return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
153
+ window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
154
+ };
155
+ }, [w]), we(() => {
156
+ if (!w)
157
+ return;
158
+ const d = (l) => {
159
+ const N = l.target;
160
+ j.current?.contains(N) || S.current?.contains(N) || C(!1);
161
+ };
162
+ return document.addEventListener("mousedown", d), () => {
163
+ document.removeEventListener("mousedown", d);
164
+ };
165
+ }, [w]), _e(j, {
166
+ open: w,
167
+ modal: !1,
168
+ onClose: () => C(!1)
169
+ });
170
+ const G = V(null);
171
+ ke(G, {
172
+ orientation: "grid",
173
+ itemSelector: ".nice-color-picker__preset",
174
+ wrap: !0
175
+ });
176
+ const ie = $e(
177
+ () => [
178
+ { key: "Enter", description: v("shortcuts.openPicker", "Open color picker") },
179
+ { key: "Arrow keys", description: v("shortcuts.navigatePresets", "Navigate presets") }
180
+ ],
181
+ [v]
182
+ );
183
+ return ee ? null : /* @__PURE__ */ x(
184
+ "div",
185
+ {
186
+ className: `nice-field nice-field--${Z} ${W === "left" ? "nice-field--label-left" : ""} ${I ? "nice-color-picker--compact" : ""} ${A ? "nice-field--loading" : ""} ${n || ""}`,
187
+ style: {
188
+ ...b,
189
+ ...D != null && {
190
+ "--nice-field-label-width": typeof D == "number" ? `${D}px` : D
191
+ },
192
+ ...T != null && {
193
+ "--nice-field-control-width": typeof T == "number" ? `${T}px` : T
194
+ }
195
+ },
196
+ "aria-busy": A || void 0,
197
+ children: [
198
+ c && /* @__PURE__ */ x(
199
+ "label",
200
+ {
201
+ htmlFor: P,
202
+ className: `nice-field__label ${p ? "nice-field__label--required" : ""}`,
203
+ children: [
204
+ c,
205
+ Q && /* @__PURE__ */ i(ye, { shortcuts: ie, size: "sm" })
206
+ ]
207
+ }
208
+ ),
209
+ /* @__PURE__ */ i("div", { className: "nice-field__control", children: /* @__PURE__ */ x("div", { className: "nice-color-picker", children: [
210
+ /* @__PURE__ */ x("div", { className: "nice-color-picker__preview-row", children: [
211
+ /* @__PURE__ */ i(
212
+ "div",
213
+ {
214
+ ref: S,
215
+ className: "nice-color-picker__swatch",
216
+ id: P,
217
+ style: { background: s },
218
+ onClick: (d) => {
219
+ d.stopPropagation(), r || C((l) => !l);
220
+ },
221
+ onKeyDown: (d) => {
222
+ !r && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), C((l) => !l));
223
+ },
224
+ role: "button",
225
+ tabIndex: r ? -1 : 0,
226
+ "aria-disabled": r || void 0,
227
+ "aria-label": v("colorPicker.openPalette", "Open color palette"),
228
+ "aria-haspopup": "dialog",
229
+ "aria-expanded": w,
230
+ children: /* @__PURE__ */ i(
231
+ "input",
232
+ {
233
+ ref: (d) => {
234
+ typeof F == "function" ? F(d) : F && (F.current = d);
235
+ },
236
+ type: "hidden",
237
+ value: s,
238
+ disabled: r,
239
+ readOnly: !0
240
+ }
241
+ )
242
+ }
243
+ ),
244
+ Y && /* @__PURE__ */ i(
245
+ "div",
246
+ {
247
+ className: "nice-input nice-input--sm",
248
+ style: I ? { flex: 1, minWidth: 0 } : { width: 100 },
249
+ children: /* @__PURE__ */ i(
250
+ "input",
251
+ {
252
+ className: "nice-input__native",
253
+ type: "text",
254
+ value: s,
255
+ disabled: r,
256
+ onChange: (d) => k?.(d.target.value),
257
+ maxLength: E ? 9 : 7,
258
+ "aria-label": v("colorPicker.hexValue", "Hex value")
259
+ }
260
+ )
261
+ }
262
+ ),
263
+ J && !I && /* @__PURE__ */ i(
264
+ "button",
265
+ {
266
+ type: "button",
267
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
268
+ onClick: re,
269
+ disabled: r,
270
+ title: v("colorPicker.random", "Random"),
271
+ "aria-label": v("colorPicker.random", "Random"),
272
+ style: {
273
+ fontSize: "0.65rem",
274
+ textTransform: "uppercase",
275
+ letterSpacing: "0.05em"
276
+ },
277
+ children: v("colorPicker.random", "Random")
278
+ }
279
+ ),
280
+ A && /* @__PURE__ */ i("span", { className: "nice-field__spinner", children: /* @__PURE__ */ i("span", { className: "nice-spinner nice-spinner--sm" }) }),
281
+ L === "right" && h && /* @__PURE__ */ i("div", { id: `${P}-error`, className: "nice-field__error", role: "alert", children: h }),
282
+ L === "right" && !h && u && /* @__PURE__ */ i("div", { id: `${P}-helper`, className: "nice-field__helper", children: u })
283
+ ] }),
284
+ w && K && typeof document < "u" && Pe.createPortal(
285
+ // stopPropagation keeps a click inside the palette from reaching the closer
286
+ // listening outside it; it is no interaction of its own
287
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- no interaction of its own: it keeps a click inside the palette from the closer outside it
288
+ /* @__PURE__ */ i(
289
+ "div",
290
+ {
291
+ ref: j,
292
+ className: `nice-color-picker__popup nice-color-picker__popup--portal ${U}`,
293
+ "data-theme": U === "nice-dark" ? "dark" : U === "nice-light" ? "light" : void 0,
294
+ role: "dialog",
295
+ "aria-label": v("colorPicker.palette", "Color palette"),
296
+ style: { position: "fixed", left: K.left, top: K.top },
297
+ onClick: (d) => d.stopPropagation(),
298
+ children: (() => {
299
+ const d = Te(s), l = { r: d.r, g: d.g, b: d.b }, N = E ? d.a : 1, $ = Se(l.r, l.g, l.b), _ = Le(l.r, l.g, l.b), M = (e, f, g, a = N) => k?.(Fe(e, f, g, a, E)), oe = (e, f, g) => M(e, f, g), ae = (e, f, g) => {
300
+ const a = He(e, f, g);
301
+ M(a.r, a.g, a.b);
302
+ }, z = (e, f, g) => {
303
+ const a = De(e, f, g);
304
+ M(a.r, a.g, a.b);
305
+ }, X = (e) => M(l.r, l.g, l.b, e), ce = (e) => {
306
+ if (r)
307
+ return;
308
+ const f = e.currentTarget, g = (y) => {
309
+ const R = f.getBoundingClientRect(), ue = Math.max(0, Math.min(R.width, y.clientX - R.left)), pe = Math.max(0, Math.min(R.height, y.clientY - R.top)), me = Math.round(ue / R.width * 100), de = 100 - Math.round(pe / R.height * 100);
310
+ z(_.h, me, de);
311
+ };
312
+ g(e);
313
+ const a = () => {
314
+ document.removeEventListener("pointermove", g), document.removeEventListener("pointerup", a);
315
+ };
316
+ document.addEventListener("pointermove", g), document.addEventListener("pointerup", a);
317
+ }, se = `hsl(${_.h}, 100%, 50%)`, le = (e) => {
318
+ if (r)
319
+ return;
320
+ const f = e.shiftKey ? 10 : 1;
321
+ let { s: g, v: a } = _;
322
+ if (e.key === "ArrowLeft")
323
+ g -= f;
324
+ else if (e.key === "ArrowRight")
325
+ g += f;
326
+ else if (e.key === "ArrowDown")
327
+ a -= f;
328
+ else if (e.key === "ArrowUp")
329
+ a += f;
330
+ else if (e.key === "PageDown")
331
+ a -= 10;
332
+ else if (e.key === "PageUp")
333
+ a += 10;
334
+ else if (e.key === "Home")
335
+ g = 0;
336
+ else if (e.key === "End")
337
+ g = 100;
338
+ else
339
+ return;
340
+ e.preventDefault(), z(_.h, Math.max(0, Math.min(100, g)), Math.max(0, Math.min(100, a)));
341
+ }, H = {
342
+ h: v("colorPicker.hue", "Hue"),
343
+ s: v("colorPicker.saturation", "Saturation"),
344
+ l: v("colorPicker.lightness", "Lightness"),
345
+ r: v("colorPicker.red", "Red"),
346
+ g: v("colorPicker.green", "Green"),
347
+ b: v("colorPicker.blue", "Blue")
348
+ };
349
+ return /* @__PURE__ */ x(he, { children: [
350
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ i(
351
+ "input",
352
+ {
353
+ type: "text",
354
+ className: "nice-input__native nice-color-picker__popup-hex",
355
+ value: s,
356
+ disabled: r,
357
+ onChange: (e) => k?.(e.target.value),
358
+ maxLength: E ? 9 : 7,
359
+ "aria-label": v("colorPicker.hexValue", "Hex value")
360
+ }
361
+ ) }),
362
+ /* @__PURE__ */ i(
363
+ "input",
364
+ {
365
+ type: "range",
366
+ min: 0,
367
+ max: 360,
368
+ value: _.h,
369
+ disabled: r,
370
+ onChange: (e) => z(Number(e.target.value), _.s, _.v),
371
+ className: "nice-color-picker__hue-slider",
372
+ "aria-label": v("colorPicker.hue", "Hue")
373
+ }
374
+ ),
375
+ /* @__PURE__ */ i(
376
+ "div",
377
+ {
378
+ className: "nice-color-picker__sv",
379
+ style: {
380
+ /* audit-allow: token-role — black letterbox / canvas fill. A video frame or a
381
+ drawing surface is not a themed surface, so it stays black in both themes. */
382
+ background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${se})`
383
+ },
384
+ onPointerDown: ce,
385
+ onKeyDown: le,
386
+ role: "slider",
387
+ tabIndex: r ? -1 : 0,
388
+ "aria-label": v("colorPicker.svPalette", "Saturation/value palette"),
389
+ "aria-valuemin": 0,
390
+ "aria-valuemax": 100,
391
+ "aria-valuenow": _.s,
392
+ "aria-valuetext": `${H.s} ${_.s}%, ${v("colorPicker.brightness", "Brightness")} ${_.v}%`,
393
+ children: /* @__PURE__ */ i(
394
+ "span",
395
+ {
396
+ className: "nice-color-picker__sv-marker",
397
+ style: { left: `${_.s}%`, top: `${100 - _.v}%` }
398
+ }
399
+ )
400
+ }
401
+ ),
402
+ /* @__PURE__ */ x("div", { className: "nice-color-picker__sliders", children: [
403
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((e) => {
404
+ const f = e === "h" ? 360 : 100, g = $[e], a = (y) => ae(
405
+ e === "h" ? y : $.h,
406
+ e === "s" ? y : $.s,
407
+ e === "l" ? y : $.l
408
+ );
409
+ return /* @__PURE__ */ x("div", { className: "nice-color-picker__slider-row", children: [
410
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: e.toUpperCase() }),
411
+ /* @__PURE__ */ i(
412
+ "input",
413
+ {
414
+ type: "range",
415
+ min: 0,
416
+ max: f,
417
+ value: g,
418
+ disabled: r,
419
+ onChange: (y) => a(Number(y.target.value)),
420
+ "aria-label": H[e]
421
+ }
422
+ ),
423
+ /* @__PURE__ */ i(
424
+ "input",
425
+ {
426
+ type: "number",
427
+ min: 0,
428
+ max: f,
429
+ value: g,
430
+ disabled: r,
431
+ onChange: (y) => a(Number(y.target.value) || 0),
432
+ className: "nice-input__native nice-color-picker__slider-num",
433
+ "aria-label": H[e]
434
+ }
435
+ )
436
+ ] }, e);
437
+ }) }),
438
+ /* @__PURE__ */ i("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((e) => {
439
+ const f = l[e], g = (a) => oe(
440
+ e === "r" ? a : l.r,
441
+ e === "g" ? a : l.g,
442
+ e === "b" ? a : l.b
443
+ );
444
+ return /* @__PURE__ */ x("div", { className: "nice-color-picker__slider-row", children: [
445
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: e.toUpperCase() }),
446
+ /* @__PURE__ */ i(
447
+ "input",
448
+ {
449
+ type: "range",
450
+ min: 0,
451
+ max: 255,
452
+ value: f,
453
+ disabled: r,
454
+ onChange: (a) => g(Number(a.target.value)),
455
+ "aria-label": H[e]
456
+ }
457
+ ),
458
+ /* @__PURE__ */ i(
459
+ "input",
460
+ {
461
+ type: "number",
462
+ min: 0,
463
+ max: 255,
464
+ value: f,
465
+ disabled: r,
466
+ onChange: (a) => g(Number(a.target.value) || 0),
467
+ className: "nice-input__native nice-color-picker__slider-num",
468
+ "aria-label": H[e]
469
+ }
470
+ )
471
+ ] }, e);
472
+ }) })
473
+ ] }),
474
+ E && /* @__PURE__ */ x("div", { className: "nice-color-picker__alpha-row", children: [
475
+ /* @__PURE__ */ i("label", { className: "nice-color-picker__slider-label", children: "A" }),
476
+ /* @__PURE__ */ i(
477
+ "input",
478
+ {
479
+ type: "range",
480
+ min: 0,
481
+ max: 100,
482
+ value: Math.round(N * 100),
483
+ disabled: r,
484
+ onChange: (e) => X(Number(e.target.value) / 100),
485
+ className: "nice-color-picker__alpha-slider",
486
+ style: {
487
+ background: `linear-gradient(to right, transparent, rgb(${l.r},${l.g},${l.b}))`
488
+ },
489
+ "aria-label": v("colorPicker.alpha", "Alpha")
490
+ }
491
+ ),
492
+ /* @__PURE__ */ i(
493
+ "input",
494
+ {
495
+ type: "number",
496
+ min: 0,
497
+ max: 100,
498
+ value: Math.round(N * 100),
499
+ disabled: r,
500
+ onChange: (e) => X((Number(e.target.value) || 0) / 100),
501
+ className: "nice-input__native nice-color-picker__slider-num",
502
+ "aria-label": v("colorPicker.alpha", "Alpha")
503
+ }
504
+ )
505
+ ] }),
506
+ q.length > 0 && /* @__PURE__ */ i(
507
+ "div",
508
+ {
509
+ ref: G,
510
+ className: "nice-color-picker__popup-presets",
511
+ role: "group",
512
+ "aria-label": v("colorPicker.presets", "Preset colors"),
513
+ children: q.map((e) => /* @__PURE__ */ i(
514
+ "div",
515
+ {
516
+ className: `nice-color-picker__preset ${s === e ? "nice-color-picker__preset--active" : ""}`,
517
+ style: { background: e },
518
+ onClick: () => {
519
+ k?.(e), C(!1);
520
+ },
521
+ role: "button",
522
+ "aria-label": e,
523
+ "aria-pressed": s === e,
524
+ onKeyDown: (f) => {
525
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k?.(e), C(!1));
526
+ }
527
+ },
528
+ e
529
+ ))
530
+ }
531
+ )
532
+ ] });
533
+ })()
534
+ }
535
+ ),
536
+ document.body
537
+ )
538
+ ] }) }),
539
+ L !== "right" && h && /* @__PURE__ */ i("div", { id: `${P}-error`, className: "nice-field__error", role: "alert", children: h }),
540
+ L !== "right" && !h && u && /* @__PURE__ */ i("div", { id: `${P}-helper`, className: "nice-field__helper", children: u })
541
+ ]
542
+ }
543
+ );
544
+ }
545
+ ),
546
+ { displayName: "NiceColorPicker" }
547
+ );
548
+ export {
549
+ Be as NiceColorPicker,
550
+ je as hexToRgb,
551
+ ze as rgbToHex
552
+ };