@nice2dev/ui-3d 1.0.6 → 1.1.0

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 (79) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +5 -5
  7. package/dist/cjs/model/ModelEditorMenuBar.js +6 -6
  8. package/dist/cjs/model/ModelEditorRightPanel.js +19 -19
  9. package/dist/cjs/model/ModelEditorSubComponents.js +10 -10
  10. package/dist/cjs/model/ModelEditorTimeline.js +6 -6
  11. package/dist/cjs/model/ModelEditorToolbar.js +4 -4
  12. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  13. package/dist/cjs/model/ModelViewer.js +14 -14
  14. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  15. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  16. package/dist/cjs/model/NiceOctree.js +16 -16
  17. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  18. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  19. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  20. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  21. package/dist/cjs/model/NiceXRPreview.js +18 -18
  22. package/dist/cjs/model/useModelEditor.js +127 -127
  23. package/dist/cjs/model/useModelViewer.js +61 -61
  24. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  25. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  26. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  27. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  28. package/dist/cjs/rendering/NiceSSR.js +14 -14
  29. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  30. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js +598 -0
  31. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  32. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js +647 -0
  33. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  34. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5048 -0
  35. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  36. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js +13081 -0
  37. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  38. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6054 -0
  39. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  40. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js +280 -0
  41. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  42. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js +806 -0
  43. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  44. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js +3508 -0
  45. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  46. package/dist/cjs/ui/dist/core-BpghV7Ls.js +10249 -0
  47. package/dist/cjs/ui/dist/core-BpghV7Ls.js.map +1 -0
  48. package/dist/cjs/ui/dist/index-CIl98Vbm.js +40039 -0
  49. package/dist/cjs/ui/dist/index-CIl98Vbm.js.map +1 -0
  50. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  51. package/dist/esm/model/ModelEditorLeftPanel.js +4 -4
  52. package/dist/esm/model/ModelEditorMenuBar.js +4 -4
  53. package/dist/esm/model/ModelEditorRightPanel.js +5 -5
  54. package/dist/esm/model/ModelEditorSubComponents.js +2 -2
  55. package/dist/esm/model/ModelEditorTimeline.js +5 -5
  56. package/dist/esm/model/ModelEditorToolbar.js +3 -3
  57. package/dist/esm/model/ModelEditorViewport.js +2 -2
  58. package/dist/esm/model/ModelViewer.js +2 -2
  59. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js +593 -0
  60. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  61. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js +637 -0
  62. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  63. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5007 -0
  64. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  65. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js +13011 -0
  66. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  67. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6037 -0
  68. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  69. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js +276 -0
  70. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  71. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js +795 -0
  72. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  73. package/dist/esm/ui/dist/charts-Bx_kNBsE.js +3483 -0
  74. package/dist/esm/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  75. package/dist/esm/ui/dist/core-BpghV7Ls.js +10071 -0
  76. package/dist/esm/ui/dist/core-BpghV7Ls.js.map +1 -0
  77. package/dist/esm/ui/dist/index-CIl98Vbm.js +39917 -0
  78. package/dist/esm/ui/dist/index-CIl98Vbm.js.map +1 -0
  79. package/package.json +1 -1
@@ -0,0 +1,593 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import ke, { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
3
+ import { f as ei, g as de, h as ll, i as cl, b as ys, k as xi, d as vs, C as Ns, N as Gr, j as Is } from './core-BpghV7Ls.js';
4
+
5
+ const Re = forwardRef(
6
+ ({
7
+ label: y,
8
+ helperText: v,
9
+ error: t,
10
+ required: A,
11
+ disabled: s,
12
+ readOnly: a,
13
+ size: B = "md",
14
+ name: M,
15
+ id: x,
16
+ className: R,
17
+ style: k,
18
+ accessMode: p,
19
+ displayStyle: g,
20
+ value: h,
21
+ defaultValue: _,
22
+ onChange: C,
23
+ onBlur: o,
24
+ onKeyDown: m,
25
+ placeholder: w,
26
+ type: D = "text",
27
+ maxLength: F,
28
+ prefix: I,
29
+ suffix: j,
30
+ clearable: c,
31
+ autoFocus: J,
32
+ submitOnEnter: S,
33
+ onSubmit: L,
34
+ showKeyboardHints: Q,
35
+ ...q
36
+ }, le) => {
37
+ const G = ei(p, x);
38
+ if (G === "hidden")
39
+ return null;
40
+ G === "disabled" && (s = true), G === "readOnly" && (a = true);
41
+ const { t: E } = de(), d = ys(x), te = ll("input", g), se = cl("input", g), V = useCallback(() => C?.(""), [C]), $ = Is({
42
+ enabled: S,
43
+ onSubmit: L
44
+ }), O = useCallback(
45
+ (u) => {
46
+ $(u), m?.(u);
47
+ },
48
+ [$, m]
49
+ ), P = useMemo(() => {
50
+ const u = [];
51
+ return S && u.push({ key: "Enter", description: E("shortcuts.submit", "Submit") }), c && u.push({ key: "Escape", description: E("shortcuts.clear", "Clear") }), u;
52
+ }, [S, c, E]);
53
+ return /* @__PURE__ */ jsxs("div", { className: `nice-field ${R || ""}`, style: k, children: [
54
+ y && /* @__PURE__ */ jsxs(
55
+ "label",
56
+ {
57
+ htmlFor: d,
58
+ className: `nice-field__label ${A ? "nice-field__label--required" : ""}`,
59
+ children: [
60
+ y,
61
+ Q && P.length > 0 && /* @__PURE__ */ jsx(Gr, { shortcuts: P, size: "sm" })
62
+ ]
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsxs(
66
+ "div",
67
+ {
68
+ className: `nice-input nice-input--${B} nice-input--ds-${se} ${t ? "nice-input--error" : ""} ${s ? "nice-input--disabled" : ""} ${a ? "nice-input--readonly" : ""}`,
69
+ style: te,
70
+ children: [
71
+ I && /* @__PURE__ */ jsx("span", { className: "nice-input__icon", children: I }),
72
+ /* @__PURE__ */ jsx(
73
+ "input",
74
+ {
75
+ ref: le,
76
+ id: d,
77
+ className: "nice-input__native",
78
+ type: D,
79
+ name: M,
80
+ value: h,
81
+ defaultValue: _,
82
+ placeholder: w,
83
+ disabled: s,
84
+ readOnly: a,
85
+ maxLength: F,
86
+ autoFocus: J,
87
+ "aria-invalid": !!t,
88
+ "aria-describedby": t ? `${d}-error` : v ? `${d}-helper` : void 0,
89
+ onChange: (u) => C?.(u.target.value),
90
+ onBlur: o,
91
+ onKeyDown: O,
92
+ ...q
93
+ }
94
+ ),
95
+ c && h && /* @__PURE__ */ jsx(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ className: "nice-input__clear",
100
+ onClick: V,
101
+ "aria-label": E("controls.clear", "Clear"),
102
+ children: "✕"
103
+ }
104
+ ),
105
+ j && /* @__PURE__ */ jsx("span", { className: "nice-input__icon", children: j })
106
+ ]
107
+ }
108
+ ),
109
+ t && /* @__PURE__ */ jsx("div", { id: `${d}-error`, className: "nice-field__error", role: "alert", children: t }),
110
+ !t && v && /* @__PURE__ */ jsx("div", { id: `${d}-helper`, className: "nice-field__helper", children: v })
111
+ ] });
112
+ }
113
+ );
114
+ Re.displayName = "NiceTextInput";
115
+ const De = forwardRef(
116
+ ({
117
+ label: y,
118
+ helperText: v,
119
+ error: t,
120
+ required: A,
121
+ disabled: s,
122
+ size: a = "md",
123
+ name: B,
124
+ id: M,
125
+ className: x,
126
+ style: R,
127
+ accessMode: k,
128
+ displayStyle: p,
129
+ options: g,
130
+ value: h,
131
+ onChange: _,
132
+ placeholder: C,
133
+ multiple: o = false,
134
+ searchable: m = false,
135
+ clearable: w = false,
136
+ emptyText: D,
137
+ maxHeight: F = 240,
138
+ optionsSource: I,
139
+ valueField: j,
140
+ labelField: c,
141
+ virtualScroll: J,
142
+ optionHeight: S = 36,
143
+ onSearch: L,
144
+ loading: Q,
145
+ renderOption: q,
146
+ showKeyboardHints: le
147
+ }, G) => {
148
+ const E = ei(k, M);
149
+ if (E === "hidden")
150
+ return null;
151
+ (E === "disabled" || E === "readOnly") && (s = true);
152
+ const { t: d } = de(), te = ll("input", p), se = cl("input", p), V = ys(M), [$, O] = useState(false), [P, u] = useState(""), [K, H] = useState(-1), [he, Ne] = useState(0), _e = useRef(null), ye = xi(
153
+ I ?? null,
154
+ j ?? I?.keyField ?? "id",
155
+ c ?? "name"
156
+ ), T = I ? ye.options : g ?? [];
157
+ vs(_e, () => {
158
+ O(false), u("");
159
+ });
160
+ const f = useMemo(() => h ? Array.isArray(h) ? h : [h] : [], [h]), b = useMemo(() => {
161
+ if (!P && !L || L)
162
+ return T;
163
+ const n = P.toLowerCase();
164
+ return T.filter(
165
+ (r) => r.label.toLowerCase().includes(n) || String(r.value).toLowerCase().includes(n)
166
+ );
167
+ }, [T, P, L]), me = useMemo(() => {
168
+ const n = /* @__PURE__ */ new Map();
169
+ for (const r of b) {
170
+ const i = r.group || "";
171
+ n.has(i) || n.set(i, []), n.get(i).push(r);
172
+ }
173
+ return n;
174
+ }, [b]), X = useCallback(
175
+ (n) => {
176
+ if (o) {
177
+ const r = f.includes(n) ? f.filter((i) => i !== n) : [...f, n];
178
+ _?.(r);
179
+ } else
180
+ _?.(n), O(false), u("");
181
+ },
182
+ [o, f, _]
183
+ ), ke$1 = useCallback(
184
+ (n) => {
185
+ if (n.key === "Escape") {
186
+ O(false), u("");
187
+ return;
188
+ }
189
+ if (n.key === "Enter" || n.key === " ") {
190
+ if (!$) {
191
+ O(true), n.preventDefault();
192
+ return;
193
+ }
194
+ K >= 0 && b[K] && (X(b[K].value), n.preventDefault());
195
+ return;
196
+ }
197
+ n.key === "ArrowDown" && (n.preventDefault(), H((r) => Math.min(r + 1, b.length - 1))), n.key === "ArrowUp" && (n.preventDefault(), H((r) => Math.max(r - 1, 0)));
198
+ },
199
+ [$, K, b, X]
200
+ ), fe = useMemo(() => f.length === 0 ? null : o ? f.map((n) => T.find((r) => r.value === n)?.label || n).join(", ") : T.find((n) => n.value === f[0])?.label || f[0], [f, T, o]), ge = useCallback(
201
+ (n) => {
202
+ n.stopPropagation(), _?.(o ? [] : "");
203
+ },
204
+ [_, o]
205
+ ), $e = useMemo(
206
+ () => [
207
+ { key: "Enter", description: d("shortcuts.select", "Select") },
208
+ { key: "Space", description: d("shortcuts.openDropdown", "Open dropdown") },
209
+ Ns.moveUp,
210
+ Ns.moveDown,
211
+ Ns.cancel
212
+ ],
213
+ [d]
214
+ );
215
+ return /* @__PURE__ */ jsxs("div", { className: `nice-field ${x || ""}`, style: R, children: [
216
+ y && /* @__PURE__ */ jsxs(
217
+ "label",
218
+ {
219
+ htmlFor: V,
220
+ className: `nice-field__label ${A ? "nice-field__label--required" : ""}`,
221
+ children: [
222
+ y,
223
+ le && /* @__PURE__ */ jsx(Gr, { shortcuts: $e, size: "sm" })
224
+ ]
225
+ }
226
+ ),
227
+ /* @__PURE__ */ jsxs("div", { className: "nice-select", ref: _e, children: [
228
+ /* @__PURE__ */ jsxs(
229
+ "button",
230
+ {
231
+ ref: G,
232
+ type: "button",
233
+ id: V,
234
+ role: "combobox",
235
+ "aria-expanded": $,
236
+ "aria-haspopup": "listbox",
237
+ "aria-invalid": !!t,
238
+ className: `nice-select__trigger nice-select__trigger--${a} nice-select--ds-${se} ${$ ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${s ? "nice-select__trigger--disabled" : ""}`,
239
+ style: te,
240
+ disabled: s,
241
+ onClick: () => O(!$),
242
+ onKeyDown: ke$1,
243
+ children: [
244
+ fe ? /* @__PURE__ */ jsx("span", { children: fe }) : /* @__PURE__ */ jsx("span", { className: "nice-select__placeholder", children: C || d("controls.select", "Select...") }),
245
+ /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
246
+ w && f.length > 0 && /* @__PURE__ */ jsx(
247
+ "span",
248
+ {
249
+ className: "nice-input__clear",
250
+ onClick: ge,
251
+ role: "button",
252
+ "aria-label": d("controls.clear", "Clear"),
253
+ children: "✕"
254
+ }
255
+ ),
256
+ /* @__PURE__ */ jsx(
257
+ "svg",
258
+ {
259
+ className: `nice-select__chevron ${$ ? "nice-select__chevron--open" : ""}`,
260
+ viewBox: "0 0 20 20",
261
+ fill: "currentColor",
262
+ children: /* @__PURE__ */ jsx(
263
+ "path",
264
+ {
265
+ fillRule: "evenodd",
266
+ 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",
267
+ clipRule: "evenodd"
268
+ }
269
+ )
270
+ }
271
+ )
272
+ ] })
273
+ ]
274
+ }
275
+ ),
276
+ $ && /* @__PURE__ */ jsxs(
277
+ "div",
278
+ {
279
+ className: "nice-select__dropdown",
280
+ role: "listbox",
281
+ style: { maxHeight: F },
282
+ onScroll: J ? (n) => Ne(n.currentTarget.scrollTop) : void 0,
283
+ children: [
284
+ (m || L) && /* @__PURE__ */ jsx("div", { className: "nice-select__search", children: /* @__PURE__ */ jsx(
285
+ "input",
286
+ {
287
+ type: "text",
288
+ value: P,
289
+ onChange: (n) => {
290
+ u(n.target.value), H(0), L?.(n.target.value);
291
+ },
292
+ placeholder: d("controls.search", "Search..."),
293
+ autoFocus: true
294
+ }
295
+ ) }),
296
+ Q && /* @__PURE__ */ jsx("div", { className: "nice-select__loading", children: /* @__PURE__ */ jsx("div", { className: "nice-spinner nice-spinner--sm", style: { margin: "8px auto" } }) }),
297
+ !Q && b.length === 0 ? /* @__PURE__ */ jsx("div", { className: "nice-select__empty", children: D || d("controls.noResults", "No results found") }) : J && !Array.from(me.keys()).some((n) => n !== "") ? (() => {
298
+ const r = b.length * S, i = Math.max(0, Math.floor(he / S) - 3), U = Math.min(
299
+ b.length,
300
+ Math.ceil((he + F) / S) + 3
301
+ ), Y = b.slice(i, U);
302
+ return /* @__PURE__ */ jsx("div", { style: { height: r, position: "relative" }, children: Y.map((N, xe) => {
303
+ const re = i + xe, Z = f.includes(N.value);
304
+ return /* @__PURE__ */ jsx(
305
+ "div",
306
+ {
307
+ role: "option",
308
+ "aria-selected": Z,
309
+ className: `nice-select__option ${Z ? "nice-select__option--selected" : ""} ${re === K ? "nice-select__option--highlighted" : ""} ${N.disabled ? "nice-select__option--disabled" : ""}`,
310
+ style: {
311
+ position: "absolute",
312
+ top: re * S,
313
+ left: 0,
314
+ right: 0,
315
+ height: S,
316
+ display: "flex",
317
+ alignItems: "center",
318
+ padding: "0 12px"
319
+ },
320
+ onClick: () => !N.disabled && X(String(N.value)),
321
+ onMouseEnter: () => H(re),
322
+ children: q ? q(N, Z) : /* @__PURE__ */ jsxs(Fragment, { children: [
323
+ N.icon && /* @__PURE__ */ jsx("span", { children: N.icon }),
324
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
325
+ /* @__PURE__ */ jsx("div", { children: N.label }),
326
+ N.description && /* @__PURE__ */ jsx("div", { className: "nice-select__option-desc", children: N.description })
327
+ ] }),
328
+ Z && /* @__PURE__ */ jsx(
329
+ "svg",
330
+ {
331
+ className: "nice-select__option-check",
332
+ viewBox: "0 0 20 20",
333
+ fill: "currentColor",
334
+ children: /* @__PURE__ */ jsx(
335
+ "path",
336
+ {
337
+ fillRule: "evenodd",
338
+ 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",
339
+ clipRule: "evenodd"
340
+ }
341
+ )
342
+ }
343
+ )
344
+ ] })
345
+ },
346
+ N.value
347
+ );
348
+ }) });
349
+ })() : Array.from(me.entries()).map(([n, r]) => /* @__PURE__ */ jsxs(ke.Fragment, { children: [
350
+ n && /* @__PURE__ */ jsx("div", { className: "nice-select__group-label", children: n }),
351
+ r.map((i) => {
352
+ const U = f.includes(i.value), Y = b.indexOf(i);
353
+ return /* @__PURE__ */ jsx(
354
+ "div",
355
+ {
356
+ role: "option",
357
+ "aria-selected": U,
358
+ className: `nice-select__option ${U ? "nice-select__option--selected" : ""} ${Y === K ? "nice-select__option--highlighted" : ""} ${i.disabled ? "nice-select__option--disabled" : ""}`,
359
+ onClick: () => !i.disabled && X(String(i.value)),
360
+ onMouseEnter: () => H(Y),
361
+ children: q ? q(i, U) : /* @__PURE__ */ jsxs(Fragment, { children: [
362
+ i.icon && /* @__PURE__ */ jsx("span", { children: i.icon }),
363
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
364
+ /* @__PURE__ */ jsx("div", { children: i.label }),
365
+ i.description && /* @__PURE__ */ jsx("div", { className: "nice-select__option-desc", children: i.description })
366
+ ] }),
367
+ U && /* @__PURE__ */ jsx(
368
+ "svg",
369
+ {
370
+ className: "nice-select__option-check",
371
+ viewBox: "0 0 20 20",
372
+ fill: "currentColor",
373
+ children: /* @__PURE__ */ jsx(
374
+ "path",
375
+ {
376
+ fillRule: "evenodd",
377
+ 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",
378
+ clipRule: "evenodd"
379
+ }
380
+ )
381
+ }
382
+ )
383
+ ] })
384
+ },
385
+ i.value
386
+ );
387
+ })
388
+ ] }, n))
389
+ ]
390
+ }
391
+ )
392
+ ] }),
393
+ t && /* @__PURE__ */ jsx("div", { className: "nice-field__error", role: "alert", children: t }),
394
+ !t && v && /* @__PURE__ */ jsx("div", { className: "nice-field__helper", children: v })
395
+ ] });
396
+ }
397
+ );
398
+ De.displayName = "NiceSelect";
399
+ const Ie = [
400
+ "#ef4444",
401
+ "#f97316",
402
+ "#f59e0b",
403
+ "#84cc16",
404
+ "#10b981",
405
+ "#06b6d4",
406
+ "#3b82f6",
407
+ "#6366f1",
408
+ "#8b5cf6",
409
+ "#ec4899",
410
+ "#64748b",
411
+ "#1e293b"
412
+ ];
413
+ function Ee() {
414
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
415
+ }
416
+ const Ae = forwardRef(
417
+ ({
418
+ label: y,
419
+ helperText: v,
420
+ error: t,
421
+ required: A,
422
+ disabled: s,
423
+ id: a,
424
+ className: B,
425
+ style: M,
426
+ accessMode: x,
427
+ displayStyle: R,
428
+ value: k = "#3b82f6",
429
+ onChange: p,
430
+ presets: g = Ie,
431
+ showInput: h = true,
432
+ showRandom: _ = true,
433
+ showKeyboardHints: C
434
+ }, o) => {
435
+ const m = ei(x, a);
436
+ if (m === "hidden")
437
+ return null;
438
+ (m === "disabled" || m === "readOnly") && (s = true);
439
+ const { t: w } = de(), D = ys(a);
440
+ cl("input", R);
441
+ const F = useRef(null), I = useCallback(() => {
442
+ s || p?.(Ee());
443
+ }, [s, p]), j = useMemo(
444
+ () => [
445
+ { key: "Enter", description: w("shortcuts.openPicker", "Open color picker") },
446
+ { key: "Arrow keys", description: w("shortcuts.navigatePresets", "Navigate presets") }
447
+ ],
448
+ [w]
449
+ );
450
+ return /* @__PURE__ */ jsxs("div", { className: `nice-field ${B || ""}`, style: M, children: [
451
+ y && /* @__PURE__ */ jsxs(
452
+ "label",
453
+ {
454
+ htmlFor: D,
455
+ className: `nice-field__label ${A ? "nice-field__label--required" : ""}`,
456
+ children: [
457
+ y,
458
+ C && /* @__PURE__ */ jsx(Gr, { shortcuts: j, size: "sm" })
459
+ ]
460
+ }
461
+ ),
462
+ /* @__PURE__ */ jsxs("div", { className: "nice-color-picker", children: [
463
+ /* @__PURE__ */ jsxs("div", { className: "nice-color-picker__preview-row", children: [
464
+ /* @__PURE__ */ jsx(
465
+ "div",
466
+ {
467
+ className: "nice-color-picker__swatch",
468
+ style: { background: k },
469
+ onClick: () => F.current?.click(),
470
+ role: "button",
471
+ tabIndex: 0,
472
+ "aria-label": "Pick color",
473
+ children: /* @__PURE__ */ jsx(
474
+ "input",
475
+ {
476
+ ref: (c) => {
477
+ F.current = c, typeof o == "function" ? o(c) : o && (o.current = c);
478
+ },
479
+ type: "color",
480
+ className: "nice-color-picker__native",
481
+ id: D,
482
+ value: k,
483
+ disabled: s,
484
+ onChange: (c) => p?.(c.target.value)
485
+ }
486
+ )
487
+ }
488
+ ),
489
+ h && /* @__PURE__ */ jsx("div", { className: "nice-input nice-input--sm", style: { width: 100 }, children: /* @__PURE__ */ jsx(
490
+ "input",
491
+ {
492
+ className: "nice-input__native",
493
+ type: "text",
494
+ value: k,
495
+ disabled: s,
496
+ onChange: (c) => p?.(c.target.value),
497
+ maxLength: 7
498
+ }
499
+ ) }),
500
+ _ && /* @__PURE__ */ jsx(
501
+ "button",
502
+ {
503
+ type: "button",
504
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
505
+ onClick: I,
506
+ disabled: s,
507
+ title: "Random color",
508
+ "aria-label": "Random color",
509
+ children: "🎲"
510
+ }
511
+ )
512
+ ] }),
513
+ g.length > 0 && /* @__PURE__ */ jsx("div", { className: "nice-color-picker__presets", children: g.map((c) => /* @__PURE__ */ jsx(
514
+ "div",
515
+ {
516
+ className: `nice-color-picker__preset ${k === c ? "nice-color-picker__preset--active" : ""}`,
517
+ style: { background: c },
518
+ onClick: () => p?.(c),
519
+ role: "button",
520
+ tabIndex: 0,
521
+ "aria-label": c
522
+ },
523
+ c
524
+ )) })
525
+ ] }),
526
+ t && /* @__PURE__ */ jsx("div", { className: "nice-field__error", role: "alert", children: t }),
527
+ !t && v && /* @__PURE__ */ jsx("div", { className: "nice-field__helper", children: v })
528
+ ] });
529
+ }
530
+ );
531
+ Ae.displayName = "NiceColorPicker";
532
+ const Fe = forwardRef(
533
+ ({
534
+ children: y,
535
+ variant: v = "primary",
536
+ size: t = "md",
537
+ type: A = "button",
538
+ disabled: s,
539
+ loading: a,
540
+ fullWidth: B,
541
+ onClick: M,
542
+ leftIcon: x,
543
+ rightIcon: R,
544
+ className: k,
545
+ style: p,
546
+ id: g,
547
+ accessMode: h,
548
+ displayStyle: _,
549
+ ...C
550
+ }, o) => {
551
+ const m = ei(h, g);
552
+ if (m === "hidden")
553
+ return null;
554
+ (m === "disabled" || m === "readOnly") && (s = true);
555
+ const w = ll("button", _), D = cl("button", _);
556
+ return /* @__PURE__ */ jsxs(
557
+ "button",
558
+ {
559
+ ref: o,
560
+ type: A,
561
+ id: g,
562
+ className: `nice-btn nice-btn--${v} nice-btn--${t} nice-btn--ds-${D} ${B ? "nice-btn--full-width" : ""} ${a ? "nice-btn--loading" : ""} ${k || ""}`,
563
+ style: { ...w, ...p },
564
+ disabled: s || a,
565
+ "aria-busy": a || void 0,
566
+ "aria-disabled": s || a || void 0,
567
+ onClick: M,
568
+ ...C,
569
+ children: [
570
+ a && /* @__PURE__ */ jsx(
571
+ "svg",
572
+ {
573
+ className: "nice-btn__spinner",
574
+ viewBox: "0 0 24 24",
575
+ fill: "none",
576
+ stroke: "currentColor",
577
+ strokeWidth: "3",
578
+ "aria-hidden": "true",
579
+ children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
580
+ }
581
+ ),
582
+ !a && x && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: x }),
583
+ /* @__PURE__ */ jsx("span", { children: y }),
584
+ !a && R && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: R })
585
+ ]
586
+ }
587
+ );
588
+ }
589
+ );
590
+ Fe.displayName = "NiceButton";
591
+
592
+ export { Ae as N, De as a, Re as b, Fe as c };
593
+ //# sourceMappingURL=NiceButton-D9l39Rs7.js.map