@nice2dev/ui 1.0.18 → 1.0.20

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 (101) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/NiceErrorBoundary-Bzx-bOeb.cjs +1 -0
  3. package/dist/NiceErrorBoundary-DBCCmeyl.js +770 -0
  4. package/dist/NiceErrorBoundary-DvA00DOz.cjs +1 -0
  5. package/dist/NiceErrorBoundary-V6wkSSLP.cjs +1 -0
  6. package/dist/NiceErrorBoundary-eTwBEuSH.js +770 -0
  7. package/dist/NiceErrorBoundary-qp4IJ18o.js +770 -0
  8. package/dist/NiceForm-B1Okz7SW.cjs +382 -0
  9. package/dist/NiceForm-BXHPoTcH.cjs +382 -0
  10. package/dist/NiceForm-DL7Kxsi2.js +5383 -0
  11. package/dist/NiceForm-DLADlHAQ.js +5383 -0
  12. package/dist/NiceForm-DUkduLqG.cjs +382 -0
  13. package/dist/NiceForm-D_XZxq3a.js +5383 -0
  14. package/dist/NiceForm.css +1 -1
  15. package/dist/NiceModal-0Sg2HxIb.cjs +1 -0
  16. package/dist/NiceModal-BRih_XEH.js +95 -0
  17. package/dist/NiceModal-C4HIsjrn.js +95 -0
  18. package/dist/NiceModal-CUdeVj-j.js +95 -0
  19. package/dist/NiceModal-Cc8R-DpX.cjs +1 -0
  20. package/dist/NiceModal-DieswZtd.cjs +1 -0
  21. package/dist/NiceModuleLifecyclePanel-4UEsYB5r.js +6553 -0
  22. package/dist/NiceModuleLifecyclePanel-C6agdtTI.cjs +1 -0
  23. package/dist/NiceModuleLifecyclePanel-CEfeJxw_.cjs +1 -0
  24. package/dist/NiceModuleLifecyclePanel-D4xWUswk.js +6777 -0
  25. package/dist/NiceModuleLifecyclePanel-jDzEfvDM.js +6553 -0
  26. package/dist/NiceModuleLifecyclePanel-sBJLlhJp.cjs +1 -0
  27. package/dist/NiceModuleLifecyclePanel.css +1 -1
  28. package/dist/NicePagination-B2TC6MTL.cjs +1 -0
  29. package/dist/NicePagination-BAywVGwT.js +171 -0
  30. package/dist/NicePagination-Cqr3Pe_F.js +171 -0
  31. package/dist/NicePagination-DnnypBiE.js +171 -0
  32. package/dist/NicePagination-DyWWdtb3.cjs +1 -0
  33. package/dist/NicePagination-F8NyMfgc.cjs +1 -0
  34. package/dist/NicePinCodeInput-Bo8Ahkae.js +12240 -0
  35. package/dist/NicePinCodeInput-C6zJxUVf.cjs +419 -0
  36. package/dist/NicePinCodeInput-CpPtHZsK.js +12240 -0
  37. package/dist/NicePinCodeInput-Cpa01Yfg.cjs +419 -0
  38. package/dist/NicePinCodeInput-JvYd_LB_.cjs +419 -0
  39. package/dist/NicePinCodeInput-ltwzQf4r.js +12240 -0
  40. package/dist/NicePinCodeInput.css +1 -1
  41. package/dist/NiceSavedQueryPanel-BIXW0y1X.js +6455 -0
  42. package/dist/NiceSavedQueryPanel-BOBULytX.js +6455 -0
  43. package/dist/NiceSavedQueryPanel-CFHwMDIx.cjs +596 -0
  44. package/dist/NiceSavedQueryPanel-CTfC-qwV.cjs +596 -0
  45. package/dist/NiceSavedQueryPanel-DuonbEem.js +6584 -0
  46. package/dist/NiceSavedQueryPanel-MdKdGYNg.cjs +596 -0
  47. package/dist/NiceSavedQueryPanel.css +1 -1
  48. package/dist/NiceTabs-B9zxj6qd.js +1657 -0
  49. package/dist/NiceTabs-BjBtazRn.cjs +1 -0
  50. package/dist/NiceTabs-C-VQXNIa.cjs +1 -0
  51. package/dist/NiceTabs-CJ8G2t0-.js +1657 -0
  52. package/dist/NiceTabs-CNauJ4fu.cjs +1 -0
  53. package/dist/NiceTabs-v7HfeXIw.js +1657 -0
  54. package/dist/NiceWindow-BMiF-so6.cjs +1 -0
  55. package/dist/NiceWindow-Bo_yCa1o.js +1418 -0
  56. package/dist/NiceWindow-CysIgnn3.js +1418 -0
  57. package/dist/NiceWindow-D6SjpDc4.cjs +1 -0
  58. package/dist/NiceWindow-DPzJxOfx.cjs +1 -0
  59. package/dist/NiceWindow-DUTRQOaP.js +1418 -0
  60. package/dist/charts-C60va95_.js +4657 -0
  61. package/dist/charts-CJlMAHJG.cjs +761 -0
  62. package/dist/charts-CX4jiyVh.cjs +761 -0
  63. package/dist/charts-CYpqDxHd.js +4657 -0
  64. package/dist/charts-D_I1iwel.cjs +761 -0
  65. package/dist/charts-P6qura0j.js +4657 -0
  66. package/dist/charts.cjs +1 -1
  67. package/dist/charts.css +1 -1
  68. package/dist/charts.mjs +1 -1
  69. package/dist/core-Bcc4sz15.cjs +96 -0
  70. package/dist/core-BfeyB9A8.cjs +96 -0
  71. package/dist/core-BgGSTko-.js +22401 -0
  72. package/dist/core-DDJKu5LZ.cjs +96 -0
  73. package/dist/core-Da1dGJN3.js +22401 -0
  74. package/dist/core-XsWxyBHD.js +22767 -0
  75. package/dist/data.cjs +1 -1
  76. package/dist/data.d.ts +5 -0
  77. package/dist/data.mjs +1 -1
  78. package/dist/editors.cjs +1 -1
  79. package/dist/editors.d.ts +44 -1
  80. package/dist/editors.mjs +3 -3
  81. package/dist/feedback.cjs +1 -1
  82. package/dist/feedback.mjs +2 -2
  83. package/dist/index-CQIDqjZp.cjs +5194 -0
  84. package/dist/index-CXVXf_HY.cjs +5194 -0
  85. package/dist/index-CtikFbFa.js +64337 -0
  86. package/dist/index-DCDfWfAt.js +64336 -0
  87. package/dist/index-DpiCo0_e.cjs +5194 -0
  88. package/dist/index-xVJiF843.js +65040 -0
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.css +1 -1
  91. package/dist/index.d.ts +450 -6
  92. package/dist/index.mjs +874 -860
  93. package/dist/lazy.cjs +1 -1
  94. package/dist/lazy.mjs +3 -3
  95. package/dist/navigation.cjs +1 -1
  96. package/dist/navigation.d.ts +50 -3
  97. package/dist/navigation.mjs +30 -30
  98. package/dist/overlays.cjs +1 -1
  99. package/dist/overlays.mjs +53 -53
  100. package/dist/style.css +6 -6
  101. package/package.json +3 -3
@@ -0,0 +1,1657 @@
1
+ import { jsxs as _, jsx as e, Fragment as Ee } from "react/jsx-runtime";
2
+ import { Z as xe, $ as Re, H as Ie, v as He, S as $e, M as Ke, g as ze, K as Te, C as qe, m as Ae, o as Je, b as Qe } from "./core-BgGSTko-.js";
3
+ import Ve, { forwardRef as Me, useCallback as ne, useMemo as oe, useState as ue, useRef as Fe, useLayoutEffect as Ue, useEffect as Oe } from "react";
4
+ import We from "react-dom";
5
+ const Pe = Me(
6
+ ({
7
+ label: c,
8
+ helperText: d,
9
+ error: t,
10
+ required: o,
11
+ disabled: n,
12
+ readOnly: i,
13
+ size: a = "md",
14
+ name: $,
15
+ id: p,
16
+ className: u,
17
+ style: h,
18
+ accessMode: S,
19
+ displayStyle: V,
20
+ variant: m,
21
+ value: x,
22
+ defaultValue: R,
23
+ onChange: f,
24
+ onBlur: Y,
25
+ onKeyDown: L,
26
+ placeholder: k,
27
+ type: E = "text",
28
+ maxLength: g,
29
+ prefix: I,
30
+ suffix: K,
31
+ clearable: D,
32
+ autoFocus: T,
33
+ submitOnEnter: w,
34
+ onSubmit: j,
35
+ showKeyboardHints: q,
36
+ labelPlacement: F,
37
+ errorPlacement: O,
38
+ loading: re,
39
+ labelWidth: se,
40
+ controlWidth: G,
41
+ displayMode: P,
42
+ ...pe
43
+ }, b) => {
44
+ const N = xe(S, p), z = N === "hidden";
45
+ N === "disabled" && (n = !0), N === "readOnly" && (i = !0);
46
+ const { t: H } = Re(), M = Ie(p), W = He("input", V), ae = $e("input", V), fe = m === "filled" ? "filled" : m === "underlined" ? "underlined" : "", X = ne(() => f?.(""), [f]), Z = Ke({ enabled: P, readOnly: i, disabled: n }), de = ze({
47
+ enabled: w,
48
+ onSubmit: j
49
+ }), ie = ne(
50
+ (v) => {
51
+ de(v), L?.(v);
52
+ },
53
+ [de, L]
54
+ ), r = oe(() => {
55
+ const v = [];
56
+ return w && v.push({ key: "Enter", description: H("shortcuts.submit", "Submit") }), D && v.push({ key: "Escape", description: H("shortcuts.clear", "Clear") }), v;
57
+ }, [w, D, H]);
58
+ return z ? null : /* @__PURE__ */ _(
59
+ "div",
60
+ {
61
+ className: `nice-field nice-field--${a} ${F === "left" ? "nice-field--label-left" : ""} ${F === "inside" ? "nice-field--label-inside" : ""} ${re ? "nice-field--loading" : ""} ${u || ""}`,
62
+ style: {
63
+ ...h,
64
+ ...se != null && {
65
+ "--nice-field-label-width": typeof se == "number" ? `${se}px` : se
66
+ },
67
+ ...G != null && {
68
+ "--nice-field-control-width": typeof G == "number" ? `${G}px` : G
69
+ }
70
+ },
71
+ "aria-busy": re || void 0,
72
+ "data-floating": F === "inside" && x ? "true" : void 0,
73
+ children: [
74
+ c && F !== "inside" && /* @__PURE__ */ _(
75
+ "label",
76
+ {
77
+ htmlFor: M,
78
+ className: `nice-field__label ${o ? "nice-field__label--required" : ""}`,
79
+ children: [
80
+ c,
81
+ q && r.length > 0 && /* @__PURE__ */ e(Te, { shortcuts: r, size: "sm" })
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ _("div", { className: "nice-field__control", children: [
86
+ Z.isDisplay ? /* @__PURE__ */ e(
87
+ qe,
88
+ {
89
+ value: x ?? R ?? "",
90
+ placeholder: k,
91
+ disabled: n,
92
+ readOnly: i,
93
+ onActivate: Z.enterEdit,
94
+ ariaLabel: c
95
+ }
96
+ ) : /* @__PURE__ */ _(
97
+ "div",
98
+ {
99
+ className: `nice-input nice-input--${a} nice-input--ds-${fe || ae} ${t ? "nice-input--error" : ""} ${n ? "nice-input--disabled" : ""} ${i ? "nice-input--readonly" : ""}`,
100
+ style: m ? void 0 : W,
101
+ children: [
102
+ I && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: I }),
103
+ /* @__PURE__ */ e(
104
+ "input",
105
+ {
106
+ ref: (v) => {
107
+ typeof b == "function" ? b(v) : b && (b.current = v), Z.autoFocusRef(v);
108
+ },
109
+ id: M,
110
+ className: "nice-input__native",
111
+ type: E,
112
+ name: $,
113
+ value: x,
114
+ defaultValue: R,
115
+ placeholder: k,
116
+ disabled: n || re,
117
+ readOnly: i,
118
+ maxLength: g,
119
+ autoFocus: T,
120
+ "aria-invalid": !!t,
121
+ "aria-describedby": t ? `${M}-error` : d ? `${M}-helper` : void 0,
122
+ onChange: (v) => f?.(v.target.value),
123
+ onBlur: (v) => {
124
+ P && Z.exitEdit(), Y?.(v);
125
+ },
126
+ onKeyDown: ie,
127
+ ...pe
128
+ }
129
+ ),
130
+ D && x && /* @__PURE__ */ e(
131
+ "button",
132
+ {
133
+ type: "button",
134
+ className: "nice-input__clear",
135
+ onClick: X,
136
+ "aria-label": H("controls.clear", "Clear"),
137
+ children: "✕"
138
+ }
139
+ ),
140
+ K && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: K }),
141
+ c && F === "inside" && /* @__PURE__ */ e(
142
+ "label",
143
+ {
144
+ htmlFor: M,
145
+ className: `nice-input__floating-label ${o ? "nice-input__floating-label--required" : ""}`,
146
+ children: c
147
+ }
148
+ )
149
+ ]
150
+ }
151
+ ),
152
+ re && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
153
+ O === "right" && t && /* @__PURE__ */ e("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: t }),
154
+ O === "right" && !t && d && /* @__PURE__ */ e("div", { id: `${M}-helper`, className: "nice-field__helper", children: d })
155
+ ] }),
156
+ O !== "right" && t && /* @__PURE__ */ e("div", { id: `${M}-error`, className: "nice-field__error", role: "alert", children: t }),
157
+ O !== "right" && !t && d && /* @__PURE__ */ e("div", { id: `${M}-helper`, className: "nice-field__helper", children: d })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ );
163
+ Pe.displayName = "NiceTextInput";
164
+ const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
165
+ __proto__: null,
166
+ NiceTextInput: Pe
167
+ }, Symbol.toStringTag, { value: "Module" })), Ze = Me(
168
+ ({
169
+ label: c,
170
+ helperText: d,
171
+ error: t,
172
+ required: o,
173
+ disabled: n,
174
+ readOnly: i,
175
+ size: a = "md",
176
+ name: $,
177
+ id: p,
178
+ className: u,
179
+ style: h,
180
+ accessMode: S,
181
+ displayStyle: V,
182
+ value: m,
183
+ onChange: x,
184
+ onBlur: R,
185
+ onKeyDown: f,
186
+ placeholder: Y,
187
+ min: L,
188
+ max: k,
189
+ step: E = 1,
190
+ precision: g,
191
+ prefix: I,
192
+ prefixType: K = "label",
193
+ prefixOptions: D,
194
+ prefixValue: T,
195
+ onPrefixChange: w,
196
+ suffix: j,
197
+ showStepper: q = !0,
198
+ submitOnEnter: F,
199
+ onSubmit: O,
200
+ showKeyboardHints: re,
201
+ labelPlacement: se,
202
+ errorPlacement: G,
203
+ loading: P,
204
+ labelWidth: pe,
205
+ controlWidth: b,
206
+ formatPreset: N,
207
+ format: z,
208
+ suffixType: H = "label",
209
+ suffixOptions: M,
210
+ suffixValue: W,
211
+ onSuffixChange: ae,
212
+ displayMode: fe
213
+ }, X) => {
214
+ const Z = xe(S, p), de = Z === "hidden";
215
+ Z === "disabled" && (n = !0), Z === "readOnly" && (i = !0);
216
+ const { t: ie } = Re(), r = Ie(p), v = He("input", V), U = $e("input", V), [C, J] = ue(!1), [Q, be] = ue(null), Ne = Ke({ enabled: fe, readOnly: i, disabled: n }), he = oe(() => {
217
+ let l = 3;
218
+ return k != null && (l = String(Math.abs(Math.floor(k))).length), L != null && L < 0 && (l += 1), g && (l += g + 1), Math.max(3, l) + 1;
219
+ }, [k, L, g]), Ce = ne(
220
+ (l) => {
221
+ if (z)
222
+ return z(l);
223
+ if (!N)
224
+ return g != null ? l.toFixed(g) : String(l);
225
+ switch (N) {
226
+ case "integer":
227
+ return Math.round(l).toLocaleString();
228
+ case "decimal":
229
+ return l.toLocaleString(void 0, {
230
+ minimumFractionDigits: g ?? 2,
231
+ maximumFractionDigits: g ?? 2
232
+ });
233
+ case "money":
234
+ return l.toLocaleString(void 0, {
235
+ minimumFractionDigits: g ?? 2,
236
+ maximumFractionDigits: g ?? 2,
237
+ useGrouping: !0
238
+ });
239
+ case "percent":
240
+ return (l * 100).toLocaleString(void 0, {
241
+ minimumFractionDigits: g ?? 0,
242
+ maximumFractionDigits: g ?? 2
243
+ }) + "%";
244
+ default:
245
+ return String(l);
246
+ }
247
+ },
248
+ [z, N, g]
249
+ ), Se = oe(() => C && Q !== null ? Q : m == null ? "" : C ? g != null ? m.toFixed(g) : String(m) : Ce(m), [m, C, Q, Ce, g]), me = m != null && m < 0, te = !!(I || K === "select" && D && D.length > 0), ee = me && te && !C, je = ee ? Se.replace(/^[-−]/, "") : Se, _e = ne(
250
+ (l) => {
251
+ let y = l;
252
+ return L !== void 0 && (y = Math.max(L, y)), k !== void 0 && (y = Math.min(k, y)), g !== void 0 && (y = parseFloat(y.toFixed(g))), y;
253
+ },
254
+ [L, k, g]
255
+ ), Be = ne(
256
+ (l) => {
257
+ const y = l.target.value;
258
+ if (be(y), y === "" || y === "-" || y === "." || y === "-.") {
259
+ y === "" && x?.(null);
260
+ return;
261
+ }
262
+ const le = parseFloat(y);
263
+ if (!isNaN(le)) {
264
+ let ge = le;
265
+ L !== void 0 && (ge = Math.max(L, ge)), k !== void 0 && (ge = Math.min(k, ge)), x?.(ge);
266
+ }
267
+ },
268
+ [x, L, k]
269
+ ), ye = ne(() => {
270
+ const l = ke.current, y = _e((l ?? 0) + E);
271
+ ke.current = y, x?.(y);
272
+ }, [E, x, _e]), De = ne(() => {
273
+ const l = ke.current, y = _e((l ?? 0) - E);
274
+ ke.current = y, x?.(y);
275
+ }, [E, x, _e]), ke = Fe(m);
276
+ ke.current = m;
277
+ const s = Fe(null), A = ne(() => {
278
+ s.current && (clearTimeout(s.current), s.current = null);
279
+ }, []), B = ne(
280
+ (l) => {
281
+ A();
282
+ let y = 300;
283
+ const le = () => {
284
+ l(), y = Math.max(30, y * 0.82), s.current = setTimeout(le, y);
285
+ };
286
+ s.current = setTimeout(le, 400);
287
+ },
288
+ [A]
289
+ ), ve = ze({
290
+ enabled: F,
291
+ onSubmit: O
292
+ }), Le = ne(
293
+ (l) => {
294
+ ve(l), l.key === "ArrowUp" ? (l.preventDefault(), ye()) : l.key === "ArrowDown" && (l.preventDefault(), De()), f?.(l);
295
+ },
296
+ [ve, f, ye, De]
297
+ ), ce = oe(() => {
298
+ const l = [];
299
+ return F && l.push(Ae.submit), q && (l.push({ key: "ArrowUp", description: ie("shortcuts.increment", "Increase value") }), l.push({ key: "ArrowDown", description: ie("shortcuts.decrement", "Decrease value") })), l;
300
+ }, [F, q, ie]);
301
+ return de ? null : /* @__PURE__ */ _(
302
+ "div",
303
+ {
304
+ className: `nice-field nice-field--${a} ${se === "left" ? "nice-field--label-left" : ""} ${P ? "nice-field--loading" : ""} ${u || ""}`,
305
+ style: {
306
+ ...h,
307
+ ...pe != null && {
308
+ "--nice-field-label-width": typeof pe == "number" ? `${pe}px` : pe
309
+ },
310
+ ...b != null && {
311
+ "--nice-field-control-width": typeof b == "number" ? `${b}px` : b
312
+ }
313
+ },
314
+ "aria-busy": P || void 0,
315
+ children: [
316
+ c && /* @__PURE__ */ _(
317
+ "label",
318
+ {
319
+ htmlFor: r,
320
+ className: `nice-field__label ${o ? "nice-field__label--required" : ""}`,
321
+ children: [
322
+ c,
323
+ re && ce.length > 0 && /* @__PURE__ */ e(Te, { shortcuts: ce, size: "sm" })
324
+ ]
325
+ }
326
+ ),
327
+ /* @__PURE__ */ _("div", { className: "nice-field__control", children: [
328
+ Ne.isDisplay ? /* @__PURE__ */ e(
329
+ qe,
330
+ {
331
+ value: m == null ? "" : I ? /* @__PURE__ */ _(Ee, { children: [
332
+ I,
333
+ Se
334
+ ] }) : Se,
335
+ placeholder: Y,
336
+ disabled: n,
337
+ readOnly: i,
338
+ onActivate: Ne.enterEdit,
339
+ ariaLabel: c
340
+ }
341
+ ) : /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ _(
342
+ "div",
343
+ {
344
+ className: `nice-input nice-input--number nice-input--${a} nice-input--ds-${U} ${t ? "nice-input--error" : ""} ${n ? "nice-input--disabled" : ""} ${i ? "nice-input--readonly" : ""}`,
345
+ style: v,
346
+ children: [
347
+ q && !i && /* @__PURE__ */ e(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ className: "nice-input__clear nice-input__minus",
352
+ onClick: De,
353
+ onMouseDown: () => B(De),
354
+ onMouseUp: A,
355
+ onMouseLeave: A,
356
+ disabled: n,
357
+ "aria-label": ie("controls.decrement", "Decrement"),
358
+ children: "−"
359
+ }
360
+ ),
361
+ K === "select" && D && D.length > 0 ? /* @__PURE__ */ _(Ee, { children: [
362
+ ee && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
363
+ /* @__PURE__ */ e(
364
+ "select",
365
+ {
366
+ className: "nice-input__suffix-select nice-input__icon--prefix",
367
+ value: T ?? D[0]?.value,
368
+ disabled: n,
369
+ onChange: (l) => {
370
+ const y = l.target.value, le = D.find(
371
+ (we) => we.value === (T ?? D[0]?.value)
372
+ ), ge = D.find((we) => we.value === y);
373
+ w?.(y, le?.weight, ge?.weight);
374
+ },
375
+ children: D.map((l) => /* @__PURE__ */ e("option", { value: l.value, children: l.label }, l.value))
376
+ }
377
+ )
378
+ ] }) : I ? /* @__PURE__ */ _("span", { className: "nice-input__icon nice-input__icon--prefix", children: [
379
+ ee && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
380
+ I
381
+ ] }) : null,
382
+ /* @__PURE__ */ e(
383
+ "input",
384
+ {
385
+ ref: (l) => {
386
+ typeof X == "function" ? X(l) : X && (X.current = l), Ne.autoFocusRef(l);
387
+ },
388
+ id: r,
389
+ className: "nice-input__native",
390
+ type: !C && (z || N) ? "text" : "number",
391
+ name: $,
392
+ value: je,
393
+ placeholder: Y,
394
+ min: L,
395
+ max: k,
396
+ step: E,
397
+ disabled: n || P,
398
+ readOnly: i,
399
+ "aria-invalid": !!t,
400
+ onChange: Be,
401
+ onFocus: (l) => {
402
+ J(!0), be(null), l.target.select();
403
+ },
404
+ onBlur: (l) => {
405
+ if (J(!1), be(null), m != null && g !== void 0) {
406
+ const y = parseFloat(m.toFixed(g));
407
+ y !== m && x?.(y);
408
+ }
409
+ fe && Ne.exitEdit(), R?.(l);
410
+ },
411
+ onKeyDown: Le,
412
+ style: { width: `${he}ch` }
413
+ }
414
+ ),
415
+ H === "select" && M && M.length > 0 ? /* @__PURE__ */ e(
416
+ "select",
417
+ {
418
+ className: "nice-input__suffix-select nice-input__icon--suffix",
419
+ value: W ?? M[0]?.value,
420
+ disabled: n,
421
+ onChange: (l) => {
422
+ const y = l.target.value, le = M.find(
423
+ (we) => we.value === (W ?? M[0]?.value)
424
+ ), ge = M.find((we) => we.value === y);
425
+ ae?.(y, le?.weight, ge?.weight);
426
+ },
427
+ children: M.map((l) => /* @__PURE__ */ e("option", { value: l.value, children: l.label }, l.value))
428
+ }
429
+ ) : j ? /* @__PURE__ */ e("span", { className: "nice-input__icon nice-input__icon--suffix", children: j }) : null,
430
+ q && !i && /* @__PURE__ */ e(
431
+ "button",
432
+ {
433
+ type: "button",
434
+ className: "nice-input__clear nice-input__plus",
435
+ onClick: ye,
436
+ onMouseDown: () => B(ye),
437
+ onMouseUp: A,
438
+ onMouseLeave: A,
439
+ disabled: n,
440
+ "aria-label": ie("controls.increment", "Increment"),
441
+ children: "+"
442
+ }
443
+ )
444
+ ]
445
+ }
446
+ ) }),
447
+ P && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
448
+ G === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
449
+ G === "right" && !t && d && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: d })
450
+ ] }),
451
+ G !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
452
+ G !== "right" && !t && d && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: d })
453
+ ]
454
+ }
455
+ );
456
+ }
457
+ );
458
+ Ze.displayName = "NiceNumberInput";
459
+ const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
460
+ __proto__: null,
461
+ NiceNumberInput: Ze
462
+ }, Symbol.toStringTag, { value: "Module" })), Ge = Me(
463
+ ({
464
+ label: c,
465
+ helperText: d,
466
+ error: t,
467
+ required: o,
468
+ disabled: n,
469
+ size: i = "md",
470
+ name: a,
471
+ id: $,
472
+ className: p,
473
+ style: u,
474
+ accessMode: h,
475
+ displayStyle: S,
476
+ options: V,
477
+ value: m,
478
+ onChange: x,
479
+ placeholder: R,
480
+ multiple: f = !1,
481
+ searchable: Y = !1,
482
+ clearable: L = !1,
483
+ emptyText: k,
484
+ maxHeight: E = 240,
485
+ optionsSource: g,
486
+ valueField: I,
487
+ labelField: K,
488
+ virtualScroll: D,
489
+ optionHeight: T = 36,
490
+ onSearch: w,
491
+ loading: j,
492
+ renderOption: q,
493
+ multipleAutosize: F = !1,
494
+ showKeyboardHints: O,
495
+ labelPlacement: re,
496
+ errorPlacement: se,
497
+ labelWidth: G,
498
+ controlWidth: P,
499
+ displayMode: pe
500
+ }, b) => {
501
+ const N = xe(h, $), z = N === "hidden";
502
+ (N === "disabled" || N === "readOnly") && (n = !0);
503
+ const { t: H } = Re(), M = He("input", S), W = $e("input", S), ae = Ie($), fe = Ke({ enabled: pe, disabled: n }), [X, Z] = ue(!1), [de, ie] = ue(""), [r, v] = ue(-1), [U, C] = ue(0), J = Fe(null), Q = Fe(null), [be, Ne] = ue(null);
504
+ Ue(() => {
505
+ !j && Q.current && Ne(Q.current.offsetWidth);
506
+ }, [j, m, S]);
507
+ const [he, Ce] = ue(null);
508
+ Ue(() => {
509
+ f && !F && Q.current && he == null && Ce(Q.current.offsetWidth);
510
+ }, [f, F, he]);
511
+ const Se = Je(
512
+ g ?? null,
513
+ I ?? g?.keyField ?? "id",
514
+ K ?? "name"
515
+ ), me = g ? Se.options : (V ?? []).map(
516
+ (s) => typeof s == "string" ? { value: s, label: s } : s
517
+ );
518
+ Qe(J, () => {
519
+ Z(!1), ie("");
520
+ });
521
+ const te = oe(() => m ? Array.isArray(m) ? m : [m] : [], [m]), ee = oe(() => {
522
+ if (!de && !w || w)
523
+ return me;
524
+ const s = de.toLowerCase();
525
+ return me.filter(
526
+ (A) => A.label.toLowerCase().includes(s) || String(A.value).toLowerCase().includes(s)
527
+ );
528
+ }, [me, de, w]), je = oe(() => {
529
+ const s = /* @__PURE__ */ new Map();
530
+ for (const A of ee) {
531
+ const B = A.group || "";
532
+ s.has(B) || s.set(B, []), s.get(B).push(A);
533
+ }
534
+ return s;
535
+ }, [ee]), _e = ne(
536
+ (s) => {
537
+ if (f) {
538
+ const A = te.includes(s) ? te.filter((B) => B !== s) : [...te, s];
539
+ x?.(A);
540
+ } else
541
+ x?.(s), Z(!1), ie("");
542
+ },
543
+ [f, te, x]
544
+ ), Be = ne(
545
+ (s) => {
546
+ if (s.key === "Escape") {
547
+ Z(!1), ie("");
548
+ return;
549
+ }
550
+ if (s.key === "Enter" || s.key === " ") {
551
+ if (!X) {
552
+ Z(!0), s.preventDefault();
553
+ return;
554
+ }
555
+ r >= 0 && ee[r] && (_e(ee[r].value), s.preventDefault());
556
+ return;
557
+ }
558
+ s.key === "ArrowDown" && (s.preventDefault(), v((A) => Math.min(A + 1, ee.length - 1))), s.key === "ArrowUp" && (s.preventDefault(), v((A) => Math.max(A - 1, 0)));
559
+ },
560
+ [X, r, ee, _e]
561
+ ), ye = oe(() => te.length === 0 ? null : f ? te.map((s) => me.find((A) => A.value === s)?.label || s).join(", ") : me.find((s) => s.value === te[0])?.label || te[0], [te, me, f]), De = ne(
562
+ (s) => {
563
+ s.stopPropagation(), x?.(f ? [] : "");
564
+ },
565
+ [x, f]
566
+ ), ke = oe(
567
+ () => [
568
+ { key: "Enter", description: H("shortcuts.select", "Select") },
569
+ { key: "Space", description: H("shortcuts.openDropdown", "Open dropdown") },
570
+ Ae.moveUp,
571
+ Ae.moveDown,
572
+ Ae.cancel
573
+ ],
574
+ [H]
575
+ );
576
+ return z ? null : /* @__PURE__ */ _(
577
+ "div",
578
+ {
579
+ className: `nice-field ${P == null ? "nice-field--select-auto" : ""} nice-field--${i} ${re === "left" ? "nice-field--label-left" : ""} ${j ? "nice-field--loading" : ""} ${p || ""}`,
580
+ style: {
581
+ ...u,
582
+ ...G != null && {
583
+ "--nice-field-label-width": typeof G == "number" ? `${G}px` : G
584
+ },
585
+ ...P != null && {
586
+ "--nice-field-control-width": typeof P == "number" ? `${P}px` : P
587
+ },
588
+ ...j && be != null && { "--nice-select-locked-width": `${be}px` }
589
+ },
590
+ "aria-busy": j || void 0,
591
+ children: [
592
+ c && /* @__PURE__ */ _(
593
+ "label",
594
+ {
595
+ htmlFor: ae,
596
+ className: `nice-field__label ${o ? "nice-field__label--required" : ""}`,
597
+ children: [
598
+ c,
599
+ O && /* @__PURE__ */ e(Te, { shortcuts: ke, size: "sm" })
600
+ ]
601
+ }
602
+ ),
603
+ /* @__PURE__ */ _("div", { className: "nice-field__control", children: [
604
+ fe.isDisplay ? /* @__PURE__ */ e(
605
+ qe,
606
+ {
607
+ value: ye,
608
+ placeholder: R || H("controls.select", "Select..."),
609
+ disabled: n,
610
+ onActivate: () => {
611
+ fe.enterEdit(), Z(!0);
612
+ },
613
+ ariaLabel: c
614
+ }
615
+ ) : /* @__PURE__ */ _("div", { className: "nice-select", ref: J, children: [
616
+ /* @__PURE__ */ _(
617
+ "button",
618
+ {
619
+ ref: (s) => {
620
+ Q.current = s, typeof b == "function" ? b(s) : b && (b.current = s);
621
+ },
622
+ type: "button",
623
+ id: ae,
624
+ role: "combobox",
625
+ "aria-expanded": X,
626
+ "aria-haspopup": "listbox",
627
+ "aria-invalid": !!t,
628
+ className: `nice-select__trigger nice-select__trigger--${i} nice-select--ds-${W} ${X ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${n ? "nice-select__trigger--disabled" : ""}`,
629
+ style: {
630
+ ...M,
631
+ ...f && !F && he != null ? {
632
+ width: he,
633
+ maxWidth: he,
634
+ overflow: "hidden"
635
+ } : {}
636
+ },
637
+ disabled: n,
638
+ onClick: () => Z(!X),
639
+ onKeyDown: Be,
640
+ children: [
641
+ ye ? /* @__PURE__ */ e(
642
+ "span",
643
+ {
644
+ style: f && !F ? {
645
+ flex: 1,
646
+ minWidth: 0,
647
+ overflow: "hidden",
648
+ textOverflow: "ellipsis",
649
+ whiteSpace: "nowrap"
650
+ } : void 0,
651
+ children: ye
652
+ }
653
+ ) : /* @__PURE__ */ e("span", { className: "nice-select__placeholder", children: R || H("controls.select", "Select...") }),
654
+ /* @__PURE__ */ _("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
655
+ L && te.length > 0 && /* @__PURE__ */ e(
656
+ "span",
657
+ {
658
+ className: "nice-input__clear",
659
+ onClick: De,
660
+ role: "button",
661
+ "aria-label": H("controls.clear", "Clear"),
662
+ children: "✕"
663
+ }
664
+ ),
665
+ /* @__PURE__ */ e(
666
+ "svg",
667
+ {
668
+ className: `nice-select__chevron ${X ? "nice-select__chevron--open" : ""}`,
669
+ viewBox: "0 0 20 20",
670
+ fill: "currentColor",
671
+ children: /* @__PURE__ */ e(
672
+ "path",
673
+ {
674
+ fillRule: "evenodd",
675
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
676
+ clipRule: "evenodd"
677
+ }
678
+ )
679
+ }
680
+ )
681
+ ] })
682
+ ]
683
+ }
684
+ ),
685
+ X && /* @__PURE__ */ _(
686
+ "div",
687
+ {
688
+ className: "nice-select__dropdown",
689
+ role: "listbox",
690
+ style: { maxHeight: E },
691
+ onScroll: D ? (s) => C(s.currentTarget.scrollTop) : void 0,
692
+ children: [
693
+ (Y || w) && /* @__PURE__ */ e("div", { className: "nice-select__search", children: /* @__PURE__ */ e(
694
+ "input",
695
+ {
696
+ type: "text",
697
+ value: de,
698
+ onChange: (s) => {
699
+ ie(s.target.value), v(0), w?.(s.target.value);
700
+ },
701
+ placeholder: H("controls.search", "Search..."),
702
+ autoFocus: !0
703
+ }
704
+ ) }),
705
+ j && /* @__PURE__ */ e("div", { className: "nice-select__loading", children: /* @__PURE__ */ e(
706
+ "div",
707
+ {
708
+ className: "nice-spinner nice-spinner--sm",
709
+ style: { margin: "8px auto" }
710
+ }
711
+ ) }),
712
+ !j && ee.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-select__empty", children: k || H("controls.noResults", "No results found") }) : D && !Array.from(je.keys()).some((s) => s !== "") ? (() => {
713
+ const A = ee.length * T, B = Math.max(
714
+ 0,
715
+ Math.floor(U / T) - 3
716
+ ), ve = Math.min(
717
+ ee.length,
718
+ Math.ceil((U + E) / T) + 3
719
+ ), Le = ee.slice(B, ve);
720
+ return /* @__PURE__ */ e("div", { style: { height: A, position: "relative" }, children: Le.map((ce, l) => {
721
+ const y = B + l, le = te.includes(ce.value);
722
+ return /* @__PURE__ */ e(
723
+ "div",
724
+ {
725
+ role: "option",
726
+ "aria-selected": le,
727
+ className: `nice-select__option ${le ? "nice-select__option--selected" : ""} ${y === r ? "nice-select__option--highlighted" : ""} ${ce.disabled ? "nice-select__option--disabled" : ""}`,
728
+ style: {
729
+ position: "absolute",
730
+ top: y * T,
731
+ left: 0,
732
+ right: 0,
733
+ height: T,
734
+ display: "flex",
735
+ alignItems: "center",
736
+ padding: "0 12px"
737
+ },
738
+ onClick: () => !ce.disabled && _e(String(ce.value)),
739
+ onMouseEnter: () => v(y),
740
+ children: q ? q(ce, le) : /* @__PURE__ */ _(Ee, { children: [
741
+ ce.icon && /* @__PURE__ */ e("span", { children: ce.icon }),
742
+ /* @__PURE__ */ _("div", { style: { flex: 1 }, children: [
743
+ /* @__PURE__ */ e("div", { children: ce.label }),
744
+ ce.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: ce.description })
745
+ ] }),
746
+ le && /* @__PURE__ */ e(
747
+ "svg",
748
+ {
749
+ className: "nice-select__option-check",
750
+ viewBox: "0 0 20 20",
751
+ fill: "currentColor",
752
+ children: /* @__PURE__ */ e(
753
+ "path",
754
+ {
755
+ fillRule: "evenodd",
756
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
757
+ clipRule: "evenodd"
758
+ }
759
+ )
760
+ }
761
+ )
762
+ ] })
763
+ },
764
+ ce.value
765
+ );
766
+ }) });
767
+ })() : Array.from(je.entries()).map(([s, A]) => /* @__PURE__ */ _(Ve.Fragment, { children: [
768
+ s && /* @__PURE__ */ e("div", { className: "nice-select__group-label", children: s }),
769
+ A.map((B) => {
770
+ const ve = te.includes(B.value), Le = ee.indexOf(B);
771
+ return /* @__PURE__ */ e(
772
+ "div",
773
+ {
774
+ role: "option",
775
+ "aria-selected": ve,
776
+ className: `nice-select__option ${ve ? "nice-select__option--selected" : ""} ${Le === r ? "nice-select__option--highlighted" : ""} ${B.disabled ? "nice-select__option--disabled" : ""}`,
777
+ onClick: () => !B.disabled && _e(String(B.value)),
778
+ onMouseEnter: () => v(Le),
779
+ children: q ? q(B, ve) : /* @__PURE__ */ _(Ee, { children: [
780
+ B.icon && /* @__PURE__ */ e("span", { children: B.icon }),
781
+ /* @__PURE__ */ _("div", { style: { flex: 1 }, children: [
782
+ /* @__PURE__ */ e("div", { children: B.label }),
783
+ B.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: B.description })
784
+ ] }),
785
+ ve && /* @__PURE__ */ e(
786
+ "svg",
787
+ {
788
+ className: "nice-select__option-check",
789
+ viewBox: "0 0 20 20",
790
+ fill: "currentColor",
791
+ children: /* @__PURE__ */ e(
792
+ "path",
793
+ {
794
+ fillRule: "evenodd",
795
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
796
+ clipRule: "evenodd"
797
+ }
798
+ )
799
+ }
800
+ )
801
+ ] })
802
+ },
803
+ B.value
804
+ );
805
+ })
806
+ ] }, s))
807
+ ]
808
+ }
809
+ )
810
+ ] }),
811
+ j && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
812
+ se === "right" && t && /* @__PURE__ */ e("div", { id: `${ae}-error`, className: "nice-field__error", role: "alert", children: t }),
813
+ se === "right" && !t && d && /* @__PURE__ */ e("div", { id: `${ae}-helper`, className: "nice-field__helper", children: d })
814
+ ] }),
815
+ se !== "right" && t && /* @__PURE__ */ e("div", { id: `${ae}-error`, className: "nice-field__error", role: "alert", children: t }),
816
+ se !== "right" && !t && d && /* @__PURE__ */ e("div", { id: `${ae}-helper`, className: "nice-field__helper", children: d })
817
+ ]
818
+ }
819
+ );
820
+ }
821
+ );
822
+ Ge.displayName = "NiceSelect";
823
+ const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
824
+ __proto__: null,
825
+ NiceSelect: Ge
826
+ }, Symbol.toStringTag, { value: "Module" })), Xe = Me(
827
+ ({
828
+ label: c,
829
+ checked: d = !1,
830
+ indeterminate: t = !1,
831
+ onChange: o,
832
+ disabled: n,
833
+ readOnly: i,
834
+ loading: a,
835
+ required: $,
836
+ size: p = "md",
837
+ name: u,
838
+ id: h,
839
+ className: S,
840
+ style: V,
841
+ error: m,
842
+ helperText: x,
843
+ accessMode: R,
844
+ displayStyle: f,
845
+ showKeyboardHints: Y,
846
+ labelPlacement: L,
847
+ errorPlacement: k,
848
+ labelWidth: E,
849
+ controlWidth: g
850
+ }, I) => {
851
+ const K = xe(R, h), D = K === "hidden";
852
+ (K === "disabled" || K === "readOnly") && (n = !0);
853
+ const { t: T } = Re(), w = Ie(h);
854
+ $e("toggle", f);
855
+ const j = oe(
856
+ () => [{ key: "Space", description: T("shortcuts.toggle", "Toggle") }],
857
+ [T]
858
+ ), q = Ve.useCallback(
859
+ (F) => {
860
+ F && (F.indeterminate = t), typeof I == "function" ? I(F) : I && (I.current = F);
861
+ },
862
+ [t, I]
863
+ );
864
+ return D ? null : /* @__PURE__ */ _(
865
+ "div",
866
+ {
867
+ className: `nice-field nice-field--inline nice-field--${p} ${L === "left" ? "nice-field--label-left" : ""} ${k === "right" ? "nice-field--error-right" : ""} ${a ? "nice-field--loading" : ""} ${S || ""}`,
868
+ style: {
869
+ ...V,
870
+ ...E != null && {
871
+ "--nice-field-label-width": typeof E == "number" ? `${E}px` : E
872
+ },
873
+ ...g != null && {
874
+ "--nice-field-control-width": typeof g == "number" ? `${g}px` : g
875
+ }
876
+ },
877
+ "aria-busy": a || void 0,
878
+ children: [
879
+ L === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${$ ? "nice-field__label--required" : ""}`, children: c }),
880
+ /* @__PURE__ */ _("div", { className: "nice-field__control", children: [
881
+ /* @__PURE__ */ _(
882
+ "label",
883
+ {
884
+ className: `nice-checkbox ${p !== "md" ? `nice-checkbox--${p}` : ""} ${n || a ? "nice-checkbox--disabled" : ""}`,
885
+ htmlFor: w,
886
+ children: [
887
+ /* @__PURE__ */ e(
888
+ "input",
889
+ {
890
+ ref: q,
891
+ id: w,
892
+ type: "checkbox",
893
+ className: "nice-checkbox__input",
894
+ name: u,
895
+ checked: d,
896
+ disabled: n || a,
897
+ readOnly: i,
898
+ "aria-invalid": !!m,
899
+ onChange: (F) => {
900
+ i || a || o?.(F.target.checked);
901
+ }
902
+ }
903
+ ),
904
+ /* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e(
905
+ "svg",
906
+ {
907
+ viewBox: "0 0 12 12",
908
+ fill: "none",
909
+ stroke: "currentColor",
910
+ strokeWidth: "2",
911
+ strokeLinecap: "round",
912
+ strokeLinejoin: "round",
913
+ children: t ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" })
914
+ }
915
+ ) }),
916
+ L !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
917
+ Y && /* @__PURE__ */ e(Te, { shortcuts: j, size: "sm" })
918
+ ]
919
+ }
920
+ ),
921
+ a && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
922
+ k === "right" && m && /* @__PURE__ */ e("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: m }),
923
+ k === "right" && !m && x && /* @__PURE__ */ e("div", { id: `${w}-helper`, className: "nice-field__helper", children: x })
924
+ ] }),
925
+ k !== "right" && m && /* @__PURE__ */ e("div", { id: `${w}-error`, className: "nice-field__error", role: "alert", children: m }),
926
+ k !== "right" && !m && x && /* @__PURE__ */ e("div", { id: `${w}-helper`, className: "nice-field__helper", children: x })
927
+ ]
928
+ }
929
+ );
930
+ }
931
+ );
932
+ Xe.displayName = "NiceCheckbox";
933
+ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
934
+ __proto__: null,
935
+ NiceCheckbox: Xe
936
+ }, Symbol.toStringTag, { value: "Module" })), en = Me(
937
+ ({
938
+ label: c,
939
+ checked: d = !1,
940
+ onChange: t,
941
+ disabled: o,
942
+ readOnly: n,
943
+ loading: i,
944
+ required: a,
945
+ size: $ = "md",
946
+ name: p,
947
+ id: u,
948
+ className: h,
949
+ style: S,
950
+ accessMode: V,
951
+ displayStyle: m,
952
+ showKeyboardHints: x,
953
+ error: R,
954
+ helperText: f,
955
+ labelPlacement: Y,
956
+ errorPlacement: L,
957
+ labelWidth: k,
958
+ controlWidth: E
959
+ }, g) => {
960
+ const I = xe(V, u), K = I === "hidden";
961
+ (I === "disabled" || I === "readOnly") && (o = !0);
962
+ const { t: D } = Re(), T = Ie(u);
963
+ He("toggle", m);
964
+ const w = $e("toggle", m), j = oe(
965
+ () => [{ key: "Space", description: D("shortcuts.toggle", "Toggle on/off") }],
966
+ [D]
967
+ );
968
+ return K ? null : /* @__PURE__ */ _(
969
+ "div",
970
+ {
971
+ className: `nice-field nice-field--inline nice-field--${$} ${Y === "left" ? "nice-field--label-left" : ""} ${i ? "nice-field--loading" : ""} ${h || ""}`,
972
+ style: {
973
+ ...S,
974
+ ...k != null && {
975
+ "--nice-field-label-width": typeof k == "number" ? `${k}px` : k
976
+ },
977
+ ...E != null && {
978
+ "--nice-field-control-width": typeof E == "number" ? `${E}px` : E
979
+ }
980
+ },
981
+ "aria-busy": i || void 0,
982
+ children: [
983
+ Y === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${a ? "nice-field__label--required" : ""}`, children: c }),
984
+ /* @__PURE__ */ _("div", { className: "nice-field__control", children: [
985
+ /* @__PURE__ */ _(
986
+ "label",
987
+ {
988
+ className: `nice-toggle nice-toggle--ds-${w} ${$ !== "md" ? `nice-toggle--${$}` : ""} ${o || i ? "nice-toggle--disabled" : ""}`,
989
+ htmlFor: T,
990
+ children: [
991
+ /* @__PURE__ */ e(
992
+ "input",
993
+ {
994
+ ref: g,
995
+ id: T,
996
+ type: "checkbox",
997
+ className: "nice-toggle__input",
998
+ name: p,
999
+ checked: d,
1000
+ disabled: o || i,
1001
+ readOnly: n,
1002
+ role: "switch",
1003
+ "aria-checked": d,
1004
+ "aria-invalid": !!R,
1005
+ onChange: (q) => {
1006
+ n || i || t?.(q.target.checked);
1007
+ }
1008
+ }
1009
+ ),
1010
+ /* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
1011
+ Y !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
1012
+ x && /* @__PURE__ */ e(Te, { shortcuts: j, size: "sm" })
1013
+ ]
1014
+ }
1015
+ ),
1016
+ i && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1017
+ L === "right" && R && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: R }),
1018
+ L === "right" && !R && f && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: f })
1019
+ ] }),
1020
+ L !== "right" && R && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: R }),
1021
+ L !== "right" && !R && f && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: f })
1022
+ ]
1023
+ }
1024
+ );
1025
+ }
1026
+ );
1027
+ en.displayName = "NiceToggle";
1028
+ const nn = [
1029
+ "var(--nice-danger, #ef4444)",
1030
+ "var(--nice-warning, #f97316)",
1031
+ "var(--nice-warning, #f59e0b)",
1032
+ "var(--nice-success, #84cc16)",
1033
+ "var(--nice-success, #10b981)",
1034
+ "var(--nice-info, #06b6d4)",
1035
+ "var(--nice-primary, #3b82f6)",
1036
+ "var(--nice-info, #6366f1)",
1037
+ "var(--nice-accent, #8b5cf6)",
1038
+ "var(--nice-accent-pink, #ec4899)",
1039
+ "var(--nice-text-secondary, #64748b)",
1040
+ "var(--nice-text, #1e293b)"
1041
+ ];
1042
+ function tn() {
1043
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
1044
+ }
1045
+ function cn(c) {
1046
+ const d = /^#?([0-9a-f]{6})$/i.exec(c.trim());
1047
+ if (!d)
1048
+ return { r: 0, g: 0, b: 0 };
1049
+ const t = parseInt(d[1], 16);
1050
+ return { r: t >> 16 & 255, g: t >> 8 & 255, b: t & 255 };
1051
+ }
1052
+ function ln(c, d, t) {
1053
+ const o = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
1054
+ return `#${o(c)}${o(d)}${o(t)}`;
1055
+ }
1056
+ function sn(c, d, t) {
1057
+ const o = c / 255, n = d / 255, i = t / 255, a = Math.max(o, n, i), $ = Math.min(o, n, i), p = (a + $) / 2;
1058
+ let u = 0, h = 0;
1059
+ if (a !== $) {
1060
+ const S = a - $;
1061
+ switch (h = p > 0.5 ? S / (2 - a - $) : S / (a + $), a) {
1062
+ case o:
1063
+ u = (n - i) / S + (n < i ? 6 : 0);
1064
+ break;
1065
+ case n:
1066
+ u = (i - o) / S + 2;
1067
+ break;
1068
+ case i:
1069
+ u = (o - n) / S + 4;
1070
+ break;
1071
+ }
1072
+ u *= 60;
1073
+ }
1074
+ return { h: Math.round(u), s: Math.round(h * 100), l: Math.round(p * 100) };
1075
+ }
1076
+ function rn(c, d, t) {
1077
+ const o = d / 100, n = t / 100, i = (1 - Math.abs(2 * n - 1)) * o, a = i * (1 - Math.abs(c / 60 % 2 - 1)), $ = n - i / 2;
1078
+ let p = 0, u = 0, h = 0;
1079
+ return c < 60 ? [p, u, h] = [i, a, 0] : c < 120 ? [p, u, h] = [a, i, 0] : c < 180 ? [p, u, h] = [0, i, a] : c < 240 ? [p, u, h] = [0, a, i] : c < 300 ? [p, u, h] = [a, 0, i] : [p, u, h] = [i, 0, a], {
1080
+ r: Math.round((p + $) * 255),
1081
+ g: Math.round((u + $) * 255),
1082
+ b: Math.round((h + $) * 255)
1083
+ };
1084
+ }
1085
+ function an(c, d, t) {
1086
+ const o = c / 255, n = d / 255, i = t / 255, a = Math.max(o, n, i), $ = Math.min(o, n, i), p = a - $;
1087
+ let u = 0;
1088
+ p !== 0 && (a === o ? u = (n - i) / p % 6 : a === n ? u = (i - o) / p + 2 : u = (o - n) / p + 4, u *= 60, u < 0 && (u += 360));
1089
+ const h = a === 0 ? 0 : p / a;
1090
+ return { h: Math.round(u), s: Math.round(h * 100), v: Math.round(a * 100) };
1091
+ }
1092
+ function on(c, d, t) {
1093
+ const o = d / 100, n = t / 100, i = n * o, a = i * (1 - Math.abs(c / 60 % 2 - 1)), $ = n - i;
1094
+ let p = 0, u = 0, h = 0;
1095
+ return c < 60 ? [p, u, h] = [i, a, 0] : c < 120 ? [p, u, h] = [a, i, 0] : c < 180 ? [p, u, h] = [0, i, a] : c < 240 ? [p, u, h] = [0, a, i] : c < 300 ? [p, u, h] = [a, 0, i] : [p, u, h] = [i, 0, a], {
1096
+ r: Math.round((p + $) * 255),
1097
+ g: Math.round((u + $) * 255),
1098
+ b: Math.round((h + $) * 255)
1099
+ };
1100
+ }
1101
+ function dn(c) {
1102
+ const d = /^#?([0-9a-f]{6})$/i.exec(c.trim()), t = /^#?([0-9a-f]{8})$/i.exec(c.trim());
1103
+ if (t) {
1104
+ const o = t[1];
1105
+ return {
1106
+ r: parseInt(o.slice(0, 2), 16),
1107
+ g: parseInt(o.slice(2, 4), 16),
1108
+ b: parseInt(o.slice(4, 6), 16),
1109
+ a: parseInt(o.slice(6, 8), 16) / 255
1110
+ };
1111
+ }
1112
+ if (d) {
1113
+ const o = parseInt(d[1], 16);
1114
+ return { r: o >> 16 & 255, g: o >> 8 & 255, b: o & 255, a: 1 };
1115
+ }
1116
+ return { r: 0, g: 0, b: 0, a: 1 };
1117
+ }
1118
+ function un(c, d, t, o, n) {
1119
+ const i = ($) => Math.max(0, Math.min(255, Math.round($))).toString(16).padStart(2, "0"), a = `#${i(c)}${i(d)}${i(t)}`;
1120
+ return n ? `${a}${i(o * 255)}` : a;
1121
+ }
1122
+ const Ye = Me(
1123
+ ({
1124
+ label: c,
1125
+ helperText: d,
1126
+ error: t,
1127
+ required: o,
1128
+ disabled: n,
1129
+ id: i,
1130
+ className: a,
1131
+ style: $,
1132
+ accessMode: p,
1133
+ displayStyle: u,
1134
+ value: h = "var(--nice-primary, #3b82f6)",
1135
+ onChange: S,
1136
+ presets: V = nn,
1137
+ showInput: m = !0,
1138
+ showRandom: x = !0,
1139
+ withAlpha: R = !1,
1140
+ showKeyboardHints: f,
1141
+ size: Y = "md",
1142
+ labelPlacement: L,
1143
+ errorPlacement: k,
1144
+ labelWidth: E,
1145
+ controlWidth: g,
1146
+ loading: I
1147
+ }, K) => {
1148
+ const D = xe(p, i), T = D === "hidden";
1149
+ (D === "disabled" || D === "readOnly") && (n = !0);
1150
+ const { t: w } = Re(), j = Ie(i);
1151
+ $e("input", u);
1152
+ const q = ne(() => {
1153
+ n || S?.(tn());
1154
+ }, [n, S]), [F, O] = ue(!1), [re, se] = ue(null), G = Fe(null), P = Fe(null);
1155
+ Ue(() => {
1156
+ if (!F || !P.current)
1157
+ return;
1158
+ const b = () => {
1159
+ const N = P.current?.getBoundingClientRect();
1160
+ if (!N)
1161
+ return;
1162
+ const z = 280, H = 360;
1163
+ let M = N.left, W = N.bottom + 6;
1164
+ M + z > window.innerWidth - 8 && (M = Math.max(8, window.innerWidth - z - 8)), W + H > window.innerHeight - 8 && (W = Math.max(8, N.top - H - 6)), se({ left: M, top: W });
1165
+ };
1166
+ return b(), window.addEventListener("scroll", b, !0), window.addEventListener("resize", b), () => {
1167
+ window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b);
1168
+ };
1169
+ }, [F]), Oe(() => {
1170
+ if (!F)
1171
+ return;
1172
+ const b = (z) => {
1173
+ const H = z.target;
1174
+ G.current?.contains(H) || P.current?.contains(H) || O(!1);
1175
+ }, N = (z) => {
1176
+ z.key === "Escape" && O(!1);
1177
+ };
1178
+ return document.addEventListener("mousedown", b), document.addEventListener("keydown", N), () => {
1179
+ document.removeEventListener("mousedown", b), document.removeEventListener("keydown", N);
1180
+ };
1181
+ }, [F]);
1182
+ const pe = oe(
1183
+ () => [
1184
+ { key: "Enter", description: w("shortcuts.openPicker", "Open color picker") },
1185
+ { key: "Arrow keys", description: w("shortcuts.navigatePresets", "Navigate presets") }
1186
+ ],
1187
+ [w]
1188
+ );
1189
+ return T ? null : /* @__PURE__ */ _(
1190
+ "div",
1191
+ {
1192
+ className: `nice-field nice-field--${Y} ${L === "left" ? "nice-field--label-left" : ""} ${I ? "nice-field--loading" : ""} ${a || ""}`,
1193
+ style: {
1194
+ ...$,
1195
+ ...E != null && {
1196
+ "--nice-field-label-width": typeof E == "number" ? `${E}px` : E
1197
+ },
1198
+ ...g != null && {
1199
+ "--nice-field-control-width": typeof g == "number" ? `${g}px` : g
1200
+ }
1201
+ },
1202
+ "aria-busy": I || void 0,
1203
+ children: [
1204
+ c && /* @__PURE__ */ _(
1205
+ "label",
1206
+ {
1207
+ htmlFor: j,
1208
+ className: `nice-field__label ${o ? "nice-field__label--required" : ""}`,
1209
+ children: [
1210
+ c,
1211
+ f && /* @__PURE__ */ e(Te, { shortcuts: pe, size: "sm" })
1212
+ ]
1213
+ }
1214
+ ),
1215
+ /* @__PURE__ */ e("div", { className: "nice-field__control", children: /* @__PURE__ */ _("div", { className: "nice-color-picker", children: [
1216
+ /* @__PURE__ */ _("div", { className: "nice-color-picker__preview-row", children: [
1217
+ /* @__PURE__ */ e(
1218
+ "div",
1219
+ {
1220
+ ref: P,
1221
+ className: "nice-color-picker__swatch",
1222
+ id: j,
1223
+ style: { background: h },
1224
+ onClick: (b) => {
1225
+ b.stopPropagation(), n || O((N) => !N);
1226
+ },
1227
+ onKeyDown: (b) => {
1228
+ !n && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), O((N) => !N));
1229
+ },
1230
+ role: "button",
1231
+ tabIndex: 0,
1232
+ "aria-label": w("colorPicker.openPalette", "Open color palette"),
1233
+ "aria-haspopup": "dialog",
1234
+ "aria-expanded": F,
1235
+ children: /* @__PURE__ */ e(
1236
+ "input",
1237
+ {
1238
+ ref: (b) => {
1239
+ typeof K == "function" ? K(b) : K && (K.current = b);
1240
+ },
1241
+ type: "hidden",
1242
+ value: h,
1243
+ disabled: n,
1244
+ readOnly: !0
1245
+ }
1246
+ )
1247
+ }
1248
+ ),
1249
+ m && /* @__PURE__ */ e("div", { className: "nice-input nice-input--sm", style: { width: 100 }, children: /* @__PURE__ */ e(
1250
+ "input",
1251
+ {
1252
+ className: "nice-input__native",
1253
+ type: "text",
1254
+ value: h,
1255
+ disabled: n,
1256
+ onChange: (b) => S?.(b.target.value),
1257
+ maxLength: 7
1258
+ }
1259
+ ) }),
1260
+ x && /* @__PURE__ */ e(
1261
+ "button",
1262
+ {
1263
+ type: "button",
1264
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
1265
+ onClick: q,
1266
+ disabled: n,
1267
+ title: w("colorPicker.random", "Random"),
1268
+ "aria-label": w("colorPicker.random", "Random"),
1269
+ style: {
1270
+ fontSize: "0.65rem",
1271
+ textTransform: "uppercase",
1272
+ letterSpacing: "0.05em"
1273
+ },
1274
+ children: w("colorPicker.random", "Random")
1275
+ }
1276
+ ),
1277
+ I && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1278
+ k === "right" && t && /* @__PURE__ */ e("div", { id: `${j}-error`, className: "nice-field__error", role: "alert", children: t }),
1279
+ k === "right" && !t && d && /* @__PURE__ */ e("div", { id: `${j}-helper`, className: "nice-field__helper", children: d })
1280
+ ] }),
1281
+ F && re && typeof document < "u" && We.createPortal(
1282
+ /* @__PURE__ */ e(
1283
+ "div",
1284
+ {
1285
+ ref: G,
1286
+ className: "nice-color-picker__popup nice-color-picker__popup--portal",
1287
+ role: "dialog",
1288
+ "aria-label": w("colorPicker.palette", "Color palette"),
1289
+ style: { position: "fixed", left: re.left, top: re.top },
1290
+ onClick: (b) => b.stopPropagation(),
1291
+ children: (() => {
1292
+ const b = dn(h), N = { r: b.r, g: b.g, b: b.b }, z = R ? b.a : 1, H = sn(N.r, N.g, N.b), M = an(N.r, N.g, N.b), W = (r, v, U, C = z) => S?.(un(r, v, U, C, R)), ae = (r, v, U) => W(r, v, U), fe = (r, v, U) => {
1293
+ const C = rn(r, v, U);
1294
+ W(C.r, C.g, C.b);
1295
+ }, X = (r, v, U) => {
1296
+ const C = on(r, v, U);
1297
+ W(C.r, C.g, C.b);
1298
+ }, Z = (r) => W(N.r, N.g, N.b, r), de = (r) => {
1299
+ if (n)
1300
+ return;
1301
+ const v = r.currentTarget, U = (J) => {
1302
+ const Q = v.getBoundingClientRect(), be = Math.max(0, Math.min(Q.width, J.clientX - Q.left)), Ne = Math.max(0, Math.min(Q.height, J.clientY - Q.top)), he = Math.round(be / Q.width * 100), Ce = 100 - Math.round(Ne / Q.height * 100);
1303
+ X(M.h, he, Ce);
1304
+ };
1305
+ U(r);
1306
+ const C = () => {
1307
+ document.removeEventListener("pointermove", U), document.removeEventListener("pointerup", C);
1308
+ };
1309
+ document.addEventListener("pointermove", U), document.addEventListener("pointerup", C);
1310
+ }, ie = `hsl(${M.h}, 100%, 50%)`;
1311
+ return /* @__PURE__ */ _(Ee, { children: [
1312
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ e(
1313
+ "input",
1314
+ {
1315
+ type: "text",
1316
+ className: "nice-input__native nice-color-picker__popup-hex",
1317
+ value: h,
1318
+ disabled: n,
1319
+ onChange: (r) => S?.(r.target.value),
1320
+ maxLength: R ? 9 : 7,
1321
+ "aria-label": w("colorPicker.hexValue", "Hex value")
1322
+ }
1323
+ ) }),
1324
+ /* @__PURE__ */ e(
1325
+ "input",
1326
+ {
1327
+ type: "range",
1328
+ min: 0,
1329
+ max: 360,
1330
+ value: M.h,
1331
+ disabled: n,
1332
+ onChange: (r) => X(Number(r.target.value), M.s, M.v),
1333
+ className: "nice-color-picker__hue-slider",
1334
+ "aria-label": w("colorPicker.hue", "Hue")
1335
+ }
1336
+ ),
1337
+ /* @__PURE__ */ e(
1338
+ "div",
1339
+ {
1340
+ className: "nice-color-picker__sv",
1341
+ style: {
1342
+ background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ie})`
1343
+ },
1344
+ onPointerDown: de,
1345
+ role: "application",
1346
+ "aria-label": w("colorPicker.svPalette", "Saturation/value palette"),
1347
+ children: /* @__PURE__ */ e(
1348
+ "span",
1349
+ {
1350
+ className: "nice-color-picker__sv-marker",
1351
+ style: { left: `${M.s}%`, top: `${100 - M.v}%` }
1352
+ }
1353
+ )
1354
+ }
1355
+ ),
1356
+ /* @__PURE__ */ _("div", { className: "nice-color-picker__sliders", children: [
1357
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((r) => {
1358
+ const v = r === "h" ? 360 : 100, U = H[r], C = (J) => fe(
1359
+ r === "h" ? J : H.h,
1360
+ r === "s" ? J : H.s,
1361
+ r === "l" ? J : H.l
1362
+ );
1363
+ return /* @__PURE__ */ _("div", { className: "nice-color-picker__slider-row", children: [
1364
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
1365
+ /* @__PURE__ */ e(
1366
+ "input",
1367
+ {
1368
+ type: "range",
1369
+ min: 0,
1370
+ max: v,
1371
+ value: U,
1372
+ disabled: n,
1373
+ onChange: (J) => C(Number(J.target.value))
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ e(
1377
+ "input",
1378
+ {
1379
+ type: "number",
1380
+ min: 0,
1381
+ max: v,
1382
+ value: U,
1383
+ disabled: n,
1384
+ onChange: (J) => C(Number(J.target.value) || 0),
1385
+ className: "nice-input__native nice-color-picker__slider-num"
1386
+ }
1387
+ )
1388
+ ] }, r);
1389
+ }) }),
1390
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((r) => {
1391
+ const v = N[r], U = (C) => ae(
1392
+ r === "r" ? C : N.r,
1393
+ r === "g" ? C : N.g,
1394
+ r === "b" ? C : N.b
1395
+ );
1396
+ return /* @__PURE__ */ _("div", { className: "nice-color-picker__slider-row", children: [
1397
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: r.toUpperCase() }),
1398
+ /* @__PURE__ */ e(
1399
+ "input",
1400
+ {
1401
+ type: "range",
1402
+ min: 0,
1403
+ max: 255,
1404
+ value: v,
1405
+ disabled: n,
1406
+ onChange: (C) => U(Number(C.target.value))
1407
+ }
1408
+ ),
1409
+ /* @__PURE__ */ e(
1410
+ "input",
1411
+ {
1412
+ type: "number",
1413
+ min: 0,
1414
+ max: 255,
1415
+ value: v,
1416
+ disabled: n,
1417
+ onChange: (C) => U(Number(C.target.value) || 0),
1418
+ className: "nice-input__native nice-color-picker__slider-num"
1419
+ }
1420
+ )
1421
+ ] }, r);
1422
+ }) })
1423
+ ] }),
1424
+ R && /* @__PURE__ */ _("div", { className: "nice-color-picker__alpha-row", children: [
1425
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: "A" }),
1426
+ /* @__PURE__ */ e(
1427
+ "input",
1428
+ {
1429
+ type: "range",
1430
+ min: 0,
1431
+ max: 100,
1432
+ value: Math.round(z * 100),
1433
+ disabled: n,
1434
+ onChange: (r) => Z(Number(r.target.value) / 100),
1435
+ className: "nice-color-picker__alpha-slider",
1436
+ style: {
1437
+ background: `linear-gradient(to right, transparent, rgb(${N.r},${N.g},${N.b}))`
1438
+ },
1439
+ "aria-label": w("colorPicker.alpha", "Alpha")
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ e(
1443
+ "input",
1444
+ {
1445
+ type: "number",
1446
+ min: 0,
1447
+ max: 100,
1448
+ value: Math.round(z * 100),
1449
+ disabled: n,
1450
+ onChange: (r) => Z((Number(r.target.value) || 0) / 100),
1451
+ className: "nice-input__native nice-color-picker__slider-num"
1452
+ }
1453
+ )
1454
+ ] }),
1455
+ V.length > 0 && /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-presets", children: V.map((r) => /* @__PURE__ */ e(
1456
+ "div",
1457
+ {
1458
+ className: `nice-color-picker__preset ${h === r ? "nice-color-picker__preset--active" : ""}`,
1459
+ style: { background: r },
1460
+ onClick: () => {
1461
+ S?.(r), O(!1);
1462
+ },
1463
+ role: "button",
1464
+ tabIndex: 0,
1465
+ "aria-label": r,
1466
+ onKeyDown: (v) => {
1467
+ (v.key === "Enter" || v.key === " ") && (v.preventDefault(), S?.(r), O(!1));
1468
+ }
1469
+ },
1470
+ r
1471
+ )) })
1472
+ ] });
1473
+ })()
1474
+ }
1475
+ ),
1476
+ document.body
1477
+ )
1478
+ ] }) }),
1479
+ k !== "right" && t && /* @__PURE__ */ e("div", { id: `${j}-error`, className: "nice-field__error", role: "alert", children: t }),
1480
+ k !== "right" && !t && d && /* @__PURE__ */ e("div", { id: `${j}-helper`, className: "nice-field__helper", children: d })
1481
+ ]
1482
+ }
1483
+ );
1484
+ }
1485
+ );
1486
+ Ye.displayName = "NiceColorPicker";
1487
+ const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1488
+ __proto__: null,
1489
+ NiceColorPicker: Ye,
1490
+ hexToRgb: cn,
1491
+ rgbToHex: ln
1492
+ }, Symbol.toStringTag, { value: "Module" })), pn = Me(
1493
+ ({
1494
+ children: c,
1495
+ variant: d = "primary",
1496
+ size: t = "md",
1497
+ type: o = "button",
1498
+ disabled: n,
1499
+ loading: i,
1500
+ fullWidth: a,
1501
+ onClick: $,
1502
+ leftIcon: p,
1503
+ rightIcon: u,
1504
+ error: h,
1505
+ errorPlacement: S = "bottom",
1506
+ className: V,
1507
+ style: m,
1508
+ id: x,
1509
+ accessMode: R,
1510
+ displayStyle: f,
1511
+ ...Y
1512
+ }, L) => {
1513
+ const k = xe(R, x), E = k === "hidden";
1514
+ (k === "disabled" || k === "readOnly") && (n = !0);
1515
+ const g = He("button", f), I = $e("button", f), K = d !== "primary" ? (({ background: w, color: j, ...q }) => q)(
1516
+ g
1517
+ ) : g, D = /* @__PURE__ */ _(
1518
+ "button",
1519
+ {
1520
+ ref: L,
1521
+ type: o,
1522
+ id: x,
1523
+ className: `nice-btn nice-btn--${d} nice-btn--${t} nice-btn--ds-${I} ${a ? "nice-btn--full-width" : ""} ${i ? "nice-btn--loading" : ""} ${h && !S ? "nice-btn--has-error" : ""} ${V || ""}`,
1524
+ style: { ...K, ...m },
1525
+ disabled: n || i,
1526
+ "aria-busy": i || void 0,
1527
+ "aria-disabled": n || i || void 0,
1528
+ onClick: $,
1529
+ ...Y,
1530
+ children: [
1531
+ i && /* @__PURE__ */ e(
1532
+ "svg",
1533
+ {
1534
+ className: "nice-btn__spinner",
1535
+ viewBox: "0 0 24 24",
1536
+ fill: "none",
1537
+ stroke: "currentColor",
1538
+ strokeWidth: "3",
1539
+ "aria-hidden": "true",
1540
+ children: /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
1541
+ }
1542
+ ),
1543
+ !i && p && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: p }),
1544
+ !i && /* @__PURE__ */ e("span", { children: c }),
1545
+ i && /* @__PURE__ */ e("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: c }),
1546
+ !i && u && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: u })
1547
+ ]
1548
+ }
1549
+ );
1550
+ if (E)
1551
+ return null;
1552
+ if (!h)
1553
+ return D;
1554
+ const T = /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: h });
1555
+ return S === "right" ? /* @__PURE__ */ _(
1556
+ "span",
1557
+ {
1558
+ className: `nice-btn-field nice-btn-field--right nice-field--${t}`,
1559
+ style: {
1560
+ display: "inline-flex",
1561
+ flexDirection: "row",
1562
+ alignItems: "center",
1563
+ gap: "8px",
1564
+ width: "fit-content"
1565
+ },
1566
+ children: [
1567
+ D,
1568
+ T
1569
+ ]
1570
+ }
1571
+ ) : E ? null : /* @__PURE__ */ _(
1572
+ "span",
1573
+ {
1574
+ className: `nice-btn-field nice-btn-field--bottom nice-field--${t}`,
1575
+ style: {
1576
+ display: "inline-flex",
1577
+ flexDirection: "column",
1578
+ alignItems: "flex-start",
1579
+ gap: "4px",
1580
+ width: "fit-content"
1581
+ },
1582
+ children: [
1583
+ D,
1584
+ T
1585
+ ]
1586
+ }
1587
+ );
1588
+ }
1589
+ );
1590
+ pn.displayName = "NiceButton";
1591
+ const $n = ({
1592
+ tabs: c,
1593
+ activeTab: d,
1594
+ onChange: t,
1595
+ variant: o = "default",
1596
+ vertical: n,
1597
+ size: i = "md",
1598
+ className: a,
1599
+ style: $,
1600
+ displayStyle: p
1601
+ }) => {
1602
+ const u = He("tab", p), h = $e("tab", p), [S, V] = ue(d || c[0]?.id), m = d ?? S, x = ne(
1603
+ (f) => {
1604
+ V(f), t?.(f);
1605
+ },
1606
+ [t]
1607
+ ), R = c.find((f) => f.id === m)?.content;
1608
+ return /* @__PURE__ */ _(
1609
+ "div",
1610
+ {
1611
+ className: `nice-tabs nice-tabs--${i} nice-tabs--ds-${h} ${a || ""}`,
1612
+ style: { ...u, ...$, ...n ? { display: "flex", gap: 16 } : {} },
1613
+ children: [
1614
+ /* @__PURE__ */ e(
1615
+ "div",
1616
+ {
1617
+ className: `nice-tabs__list ${o !== "default" ? `nice-tabs__list--${o}` : ""} ${n ? "nice-tabs__list--vertical" : ""}`,
1618
+ role: "tablist",
1619
+ children: c.map((f) => /* @__PURE__ */ _(
1620
+ "button",
1621
+ {
1622
+ type: "button",
1623
+ role: "tab",
1624
+ "aria-selected": m === f.id,
1625
+ className: `nice-tabs__tab ${m === f.id ? "nice-tabs__tab--active" : ""} ${f.disabled ? "nice-tabs__tab--disabled" : ""}`,
1626
+ disabled: f.disabled,
1627
+ onClick: () => x(f.id),
1628
+ children: [
1629
+ f.icon,
1630
+ /* @__PURE__ */ e("span", { children: f.label }),
1631
+ f.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-tabs__badge", children: f.badge })
1632
+ ]
1633
+ },
1634
+ f.id
1635
+ ))
1636
+ }
1637
+ ),
1638
+ R && /* @__PURE__ */ e("div", { className: "nice-tabs__panel", role: "tabpanel", children: R })
1639
+ ]
1640
+ }
1641
+ );
1642
+ };
1643
+ export {
1644
+ Xe as N,
1645
+ Ye as a,
1646
+ Ze as b,
1647
+ Ge as c,
1648
+ Pe as d,
1649
+ en as e,
1650
+ $n as f,
1651
+ pn as g,
1652
+ vn as h,
1653
+ gn as i,
1654
+ bn as j,
1655
+ Nn as k,
1656
+ yn as l
1657
+ };