@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,637 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { i as cl, g as de, h as ll, c as ws, b as ys } from './core-BpghV7Ls.js';
3
+ import ke, { useState, useCallback, useEffect, useRef, forwardRef, Component } from 'react';
4
+
5
+ const Q = {
6
+ info: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" }) }),
7
+ success: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", clipRule: "evenodd" }) }),
8
+ warning: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
9
+ error: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z", clipRule: "evenodd" }) })
10
+ }, he = ({
11
+ variant: n = "info",
12
+ title: t,
13
+ children: s,
14
+ closable: r,
15
+ onClose: i,
16
+ icon: c,
17
+ size: l = "md",
18
+ className: u,
19
+ style: d,
20
+ displayStyle: p
21
+ }) => {
22
+ const m = cl("card", p);
23
+ return /* @__PURE__ */ jsxs(
24
+ "div",
25
+ {
26
+ className: `nice-alert nice-alert--${n} nice-alert--${l} nice-alert--ds-${m} ${u || ""}`,
27
+ style: d,
28
+ role: "alert",
29
+ children: [
30
+ /* @__PURE__ */ jsx("div", { className: `nice-alert__icon nice-alert__icon--${n}`, children: c || Q[n] }),
31
+ /* @__PURE__ */ jsxs("div", { className: "nice-alert__content", children: [
32
+ t && /* @__PURE__ */ jsx("div", { className: "nice-alert__title", children: t }),
33
+ /* @__PURE__ */ jsx("div", { children: s })
34
+ ] }),
35
+ r && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-alert__close", onClick: i, "aria-label": "Close", children: "✕" })
36
+ ]
37
+ }
38
+ );
39
+ }, fe = ({
40
+ open: n,
41
+ onClose: t,
42
+ title: s,
43
+ size: r = "md",
44
+ children: i,
45
+ footer: c,
46
+ closeOnOverlay: l = true,
47
+ closeOnEscape: u = true,
48
+ fullscreenable: d,
49
+ zIndex: p,
50
+ className: m,
51
+ style: y,
52
+ displayStyle: v
53
+ }) => {
54
+ const { t: _ } = de(), g = useRef(null), [h, o] = useState(false), $ = ll("modal", v), w = cl("modal", v);
55
+ return ws(g, n), useEffect(() => {
56
+ if (!n || !u)
57
+ return;
58
+ const f = (C) => {
59
+ C.key === "Escape" && t();
60
+ };
61
+ return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
62
+ }, [n, u, t]), useEffect(() => (n ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
63
+ document.body.style.overflow = "";
64
+ }), [n]), n ? /* @__PURE__ */ jsx(
65
+ "div",
66
+ {
67
+ className: "nice-modal-overlay",
68
+ style: p ? { zIndex: p } : void 0,
69
+ onClick: l ? t : void 0,
70
+ children: /* @__PURE__ */ jsxs(
71
+ "div",
72
+ {
73
+ ref: g,
74
+ className: `nice-modal nice-modal--${h ? "full" : r} nice-modal--ds-${w} ${m || ""}`,
75
+ style: { ...$, ...y },
76
+ role: "dialog",
77
+ "aria-modal": "true",
78
+ "aria-label": s,
79
+ onClick: (f) => f.stopPropagation(),
80
+ children: [
81
+ s && /* @__PURE__ */ jsxs("div", { className: "nice-modal__header", children: [
82
+ /* @__PURE__ */ jsx("h2", { className: "nice-modal__title", children: s }),
83
+ /* @__PURE__ */ jsxs("div", { className: "nice-modal__header-actions", children: [
84
+ d && /* @__PURE__ */ jsx(
85
+ "button",
86
+ {
87
+ type: "button",
88
+ className: "nice-modal__fullscreen",
89
+ onClick: () => o((f) => !f),
90
+ "aria-label": h ? "Exit fullscreen" : "Fullscreen",
91
+ children: h ? "⇲" : "⇱"
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ className: "nice-modal__close",
99
+ onClick: t,
100
+ "aria-label": _("controls.close", "Close"),
101
+ children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
102
+ }
103
+ )
104
+ ] })
105
+ ] }),
106
+ /* @__PURE__ */ jsx("div", { className: "nice-modal__body", children: i }),
107
+ c && /* @__PURE__ */ jsx("div", { className: "nice-modal__footer", children: c })
108
+ ]
109
+ }
110
+ )
111
+ }
112
+ ) : null;
113
+ }, _e = ({
114
+ open: n,
115
+ onClose: t,
116
+ title: s,
117
+ position: r = "right",
118
+ size: i = "md",
119
+ children: c,
120
+ footer: l,
121
+ transitionDuration: u,
122
+ className: d,
123
+ style: p,
124
+ displayStyle: m
125
+ }) => {
126
+ const y = ll("modal", m), v = cl("modal", m), { t: _ } = de(), g = useRef(null);
127
+ return ws(g, n), useEffect(() => {
128
+ if (!n)
129
+ return;
130
+ const h = (o) => {
131
+ o.key === "Escape" && t();
132
+ };
133
+ return document.addEventListener("keydown", h), document.body.style.overflow = "hidden", () => {
134
+ document.removeEventListener("keydown", h), document.body.style.overflow = "";
135
+ };
136
+ }, [n, t]), n ? /* @__PURE__ */ jsxs(Fragment, { children: [
137
+ /* @__PURE__ */ jsx("div", { className: "nice-drawer-overlay", onClick: t }),
138
+ /* @__PURE__ */ jsxs(
139
+ "div",
140
+ {
141
+ ref: g,
142
+ className: `nice-drawer nice-drawer--${r} nice-drawer--${i} nice-drawer--ds-${v} ${d || ""}`,
143
+ style: {
144
+ ...y,
145
+ ...p,
146
+ ...u != null ? { transitionDuration: `${u}ms` } : {}
147
+ },
148
+ role: "dialog",
149
+ "aria-modal": "true",
150
+ "aria-label": s,
151
+ children: [
152
+ s && /* @__PURE__ */ jsxs("div", { className: "nice-drawer__header", children: [
153
+ /* @__PURE__ */ jsx("h3", { className: "nice-drawer__title", children: s }),
154
+ /* @__PURE__ */ jsx(
155
+ "button",
156
+ {
157
+ type: "button",
158
+ className: "nice-drawer__close",
159
+ onClick: t,
160
+ "aria-label": _("controls.close", "Close"),
161
+ children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
162
+ }
163
+ )
164
+ ] }),
165
+ /* @__PURE__ */ jsx("div", { className: "nice-drawer__body", children: c }),
166
+ l && /* @__PURE__ */ jsx("div", { className: "nice-drawer__footer", children: l })
167
+ ]
168
+ }
169
+ )
170
+ ] }) : null;
171
+ }, be = ({
172
+ toasts: n,
173
+ onDismiss: t,
174
+ position: s = "top-right"
175
+ }) => /* @__PURE__ */ jsx("div", { className: `nice-toast-container nice-toast-container--${s}`, children: n.map((r) => /* @__PURE__ */ jsx(ne, { toast: r, onDismiss: t }, r.id)) }), ne = ({
176
+ toast: n,
177
+ onDismiss: t
178
+ }) => {
179
+ const [s, r] = useState(false);
180
+ return useEffect(() => {
181
+ if (!n.duration && n.duration !== 0) {
182
+ const i = setTimeout(() => r(true), 4e3);
183
+ return () => clearTimeout(i);
184
+ }
185
+ if (n.duration > 0) {
186
+ const i = setTimeout(() => r(true), n.duration);
187
+ return () => clearTimeout(i);
188
+ }
189
+ }, [n.duration]), useEffect(() => {
190
+ if (s) {
191
+ const i = setTimeout(() => t(n.id), 200);
192
+ return () => clearTimeout(i);
193
+ }
194
+ }, [s, n.id, t]), /* @__PURE__ */ jsxs(
195
+ "div",
196
+ {
197
+ className: `nice-toast nice-toast--${n.variant} ${s ? "nice-toast--exiting" : ""}`,
198
+ role: "alert",
199
+ style: { position: "relative" },
200
+ children: [
201
+ /* @__PURE__ */ jsx("div", { className: "nice-toast__icon", children: Q[n.variant] }),
202
+ /* @__PURE__ */ jsxs("div", { className: "nice-toast__content", children: [
203
+ n.title && /* @__PURE__ */ jsx("div", { className: "nice-toast__title", children: n.title }),
204
+ /* @__PURE__ */ jsx("div", { className: "nice-toast__message", children: n.message })
205
+ ] }),
206
+ /* @__PURE__ */ jsx("button", { type: "button", className: "nice-toast__close", onClick: () => r(true), children: "✕" })
207
+ ]
208
+ }
209
+ );
210
+ };
211
+ let ie = 0;
212
+ function pe() {
213
+ const [n, t] = useState([]), s = useCallback(
214
+ (i, c, l) => {
215
+ const u = `toast-${++ie}`;
216
+ return t((d) => [
217
+ ...d,
218
+ { id: u, variant: i, message: c, title: l?.title, duration: l?.duration }
219
+ ]), u;
220
+ },
221
+ []
222
+ ), r = useCallback((i) => {
223
+ t((c) => c.filter((l) => l.id !== i));
224
+ }, []);
225
+ return {
226
+ toasts: n,
227
+ dismiss: r,
228
+ info: (i, c) => s("info", i, c),
229
+ success: (i, c) => s("success", i, c),
230
+ warning: (i, c) => s("warning", i, c),
231
+ error: (i, c) => s("error", i, c)
232
+ };
233
+ }
234
+ const te = {
235
+ info: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }),
236
+ warning: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }),
237
+ error: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
238
+ success: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) })
239
+ }, ve = ({
240
+ visible: n,
241
+ message: t,
242
+ header: s,
243
+ icon: r,
244
+ variant: i = "warning",
245
+ acceptLabel: c,
246
+ rejectLabel: l,
247
+ onAccept: u,
248
+ onReject: d,
249
+ closeOnOverlay: p = false,
250
+ closeOnEscape: m = true,
251
+ size: y = "md",
252
+ className: v,
253
+ style: _
254
+ }) => {
255
+ const { t: g } = de();
256
+ if (ke.useEffect(() => {
257
+ if (!n || !m)
258
+ return;
259
+ const w = (f) => {
260
+ f.key === "Escape" && d();
261
+ };
262
+ return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
263
+ }, [n, m, d]), ke.useEffect(() => (n ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
264
+ document.body.style.overflow = "";
265
+ }), [n]), !n)
266
+ return null;
267
+ const h = r ?? te[i], o = c ?? g("confirm.accept", "Yes"), $ = l ?? g("confirm.reject", "No");
268
+ return /* @__PURE__ */ jsx("div", { className: "nice-modal-overlay", onClick: p ? d : void 0, children: /* @__PURE__ */ jsxs(
269
+ "div",
270
+ {
271
+ className: `nice-confirm nice-confirm--${i} nice-confirm--${y} ${v || ""}`,
272
+ style: _,
273
+ role: "alertdialog",
274
+ "aria-modal": "true",
275
+ "aria-label": s,
276
+ "aria-describedby": "nice-confirm-message",
277
+ onClick: (w) => w.stopPropagation(),
278
+ children: [
279
+ s && /* @__PURE__ */ jsx("div", { className: "nice-confirm__header", children: /* @__PURE__ */ jsx("h3", { className: "nice-confirm__title", children: s }) }),
280
+ /* @__PURE__ */ jsxs("div", { className: "nice-confirm__body", children: [
281
+ h && /* @__PURE__ */ jsx("div", { className: `nice-confirm__icon nice-confirm__icon--${i}`, children: h }),
282
+ /* @__PURE__ */ jsx("div", { id: "nice-confirm-message", className: "nice-confirm__message", children: t })
283
+ ] }),
284
+ /* @__PURE__ */ jsxs("div", { className: "nice-confirm__footer", children: [
285
+ /* @__PURE__ */ jsx(
286
+ "button",
287
+ {
288
+ type: "button",
289
+ className: "nice-btn nice-btn--ghost nice-btn--md",
290
+ onClick: d,
291
+ children: $
292
+ }
293
+ ),
294
+ /* @__PURE__ */ jsx(
295
+ "button",
296
+ {
297
+ type: "button",
298
+ className: `nice-btn nice-btn--${i === "error" ? "error" : "primary"} nice-btn--md`,
299
+ onClick: u,
300
+ autoFocus: true,
301
+ children: o
302
+ }
303
+ )
304
+ ] })
305
+ ]
306
+ }
307
+ ) });
308
+ };
309
+ const oe = forwardRef(
310
+ ({
311
+ visible: n,
312
+ onAcceptAll: t,
313
+ onRejectAll: s,
314
+ onSave: r,
315
+ categories: i = ["necessary", "analytics", "marketing", "preferences"],
316
+ defaults: c,
317
+ position: l = "bottom",
318
+ size: u = "md",
319
+ policyUrl: d,
320
+ showDetails: p = false,
321
+ className: m,
322
+ style: y,
323
+ id: v,
324
+ ..._
325
+ }, g) => {
326
+ const h = ys(v), { t: o } = de(), [$, w] = useState(true), f = n ?? $, [C, z] = useState(p), [b, T] = useState(() => {
327
+ const N = {
328
+ necessary: true,
329
+ analytics: false,
330
+ marketing: false,
331
+ preferences: false
332
+ };
333
+ return c && Object.assign(N, c), N.necessary = true, N;
334
+ }), M = {
335
+ necessary: o("cookie.necessary", "Necessary"),
336
+ analytics: o("cookie.analytics", "Analytics"),
337
+ marketing: o("cookie.marketing", "Marketing"),
338
+ preferences: o("cookie.preferences", "Preferences")
339
+ }, D = {
340
+ necessary: o(
341
+ "cookie.necessaryDesc",
342
+ "Required for the website to function. Cannot be disabled."
343
+ ),
344
+ analytics: o(
345
+ "cookie.analyticsDesc",
346
+ "Help us understand how visitors interact with the website."
347
+ ),
348
+ marketing: o("cookie.marketingDesc", "Used to deliver relevant advertisements."),
349
+ preferences: o("cookie.preferencesDesc", "Allow the website to remember your choices.")
350
+ }, R = useCallback(() => {
351
+ const N = {
352
+ necessary: true,
353
+ analytics: true,
354
+ marketing: true,
355
+ preferences: true
356
+ };
357
+ t?.(), r?.(N), w(false);
358
+ }, [t, r]), S = useCallback(() => {
359
+ const N = {
360
+ necessary: true,
361
+ analytics: false,
362
+ marketing: false,
363
+ preferences: false
364
+ };
365
+ s?.(), r?.(N), w(false);
366
+ }, [s, r]), A = useCallback(() => {
367
+ r?.({ ...b, necessary: true }), w(false);
368
+ }, [b, r]);
369
+ return f ? /* @__PURE__ */ jsx(
370
+ "div",
371
+ {
372
+ ref: g,
373
+ id: h,
374
+ className: `nice-cookie-consent nice-cookie-consent--${l} nice-cookie-consent--${u} ${m ?? ""}`,
375
+ style: y,
376
+ role: "dialog",
377
+ "aria-label": o("cookie.label", "Cookie Consent"),
378
+ "aria-modal": "true",
379
+ ..._,
380
+ children: /* @__PURE__ */ jsxs("div", { className: "nice-cookie-consent__content", children: [
381
+ /* @__PURE__ */ jsxs("p", { className: "nice-cookie-consent__message", children: [
382
+ o(
383
+ "cookie.message",
384
+ "We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."
385
+ ),
386
+ d && /* @__PURE__ */ jsxs(Fragment, { children: [
387
+ " ",
388
+ /* @__PURE__ */ jsx(
389
+ "a",
390
+ {
391
+ href: d,
392
+ className: "nice-cookie-consent__link",
393
+ target: "_blank",
394
+ rel: "noopener noreferrer",
395
+ children: o("cookie.learnMore", "Learn more")
396
+ }
397
+ )
398
+ ] })
399
+ ] }),
400
+ C && /* @__PURE__ */ jsx("div", { className: "nice-cookie-consent__details", children: i.map((N) => /* @__PURE__ */ jsxs("label", { className: "nice-cookie-consent__category", children: [
401
+ /* @__PURE__ */ jsx(
402
+ "input",
403
+ {
404
+ type: "checkbox",
405
+ checked: b[N],
406
+ disabled: N === "necessary",
407
+ onChange: (B) => T((F) => ({ ...F, [N]: B.target.checked })),
408
+ className: "nice-cookie-consent__checkbox"
409
+ }
410
+ ),
411
+ /* @__PURE__ */ jsxs("div", { className: "nice-cookie-consent__cat-info", children: [
412
+ /* @__PURE__ */ jsx("strong", { children: M[N] }),
413
+ /* @__PURE__ */ jsx("span", { className: "nice-cookie-consent__cat-desc", children: D[N] })
414
+ ] })
415
+ ] }, N)) }),
416
+ /* @__PURE__ */ jsxs("div", { className: "nice-cookie-consent__actions", children: [
417
+ !C && /* @__PURE__ */ jsx(
418
+ "button",
419
+ {
420
+ type: "button",
421
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--details",
422
+ onClick: () => z(true),
423
+ children: o("cookie.customize", "Customize")
424
+ }
425
+ ),
426
+ C && /* @__PURE__ */ jsx(
427
+ "button",
428
+ {
429
+ type: "button",
430
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--save",
431
+ onClick: A,
432
+ children: o("cookie.savePreferences", "Save preferences")
433
+ }
434
+ ),
435
+ /* @__PURE__ */ jsx(
436
+ "button",
437
+ {
438
+ type: "button",
439
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--reject",
440
+ onClick: S,
441
+ children: o("cookie.rejectAll", "Reject all")
442
+ }
443
+ ),
444
+ /* @__PURE__ */ jsx(
445
+ "button",
446
+ {
447
+ type: "button",
448
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--accept",
449
+ onClick: R,
450
+ children: o("cookie.acceptAll", "Accept all")
451
+ }
452
+ )
453
+ ] })
454
+ ] })
455
+ }
456
+ ) : null;
457
+ }
458
+ );
459
+ oe.displayName = "NiceCookieConsent";
460
+ const le = forwardRef(
461
+ ({
462
+ onSubmit: n,
463
+ onForgotPassword: t,
464
+ onRegister: s,
465
+ loading: r = false,
466
+ error: i,
467
+ variant: c = "primary",
468
+ size: l = "md",
469
+ showRememberMe: u = true,
470
+ showForgotPassword: d = true,
471
+ showRegister: p = false,
472
+ title: m,
473
+ logo: y,
474
+ usernameLabel: v,
475
+ passwordLabel: _,
476
+ usernamePlaceholder: g,
477
+ passwordPlaceholder: h,
478
+ className: o,
479
+ style: $,
480
+ id: w,
481
+ ...f
482
+ }, C) => {
483
+ const z = ys(w), { t: b } = de(), [T, M] = useState(""), [D, R] = useState(""), [S, A] = useState(false), [N, B] = useState(false), F = `${z}-user`, H = `${z}-pass`, V = `${z}-remember`, X = useCallback(
484
+ (E) => {
485
+ E.preventDefault(), !r && n?.({ username: T, password: D, rememberMe: S });
486
+ },
487
+ [r, T, D, S, n]
488
+ );
489
+ return /* @__PURE__ */ jsxs(
490
+ "form",
491
+ {
492
+ ref: C,
493
+ id: z,
494
+ className: `nice-login nice-login--${c} nice-login--${l} ${o ?? ""}`,
495
+ style: $,
496
+ onSubmit: X,
497
+ noValidate: true,
498
+ ...f,
499
+ children: [
500
+ y && /* @__PURE__ */ jsx("div", { className: "nice-login__logo", children: y }),
501
+ m && /* @__PURE__ */ jsx("h2", { className: "nice-login__title", children: m ?? b("login.title", "Sign In") }),
502
+ i && /* @__PURE__ */ jsx("div", { className: "nice-login__error", role: "alert", children: i }),
503
+ /* @__PURE__ */ jsxs("div", { className: "nice-login__field", children: [
504
+ /* @__PURE__ */ jsx("label", { htmlFor: F, className: "nice-login__label", children: v ?? b("login.username", "Username") }),
505
+ /* @__PURE__ */ jsx(
506
+ "input",
507
+ {
508
+ id: F,
509
+ className: "nice-login__input",
510
+ type: "text",
511
+ value: T,
512
+ onChange: (E) => M(E.target.value),
513
+ placeholder: g ?? b("login.usernamePlaceholder", "Enter your username"),
514
+ autoComplete: "username",
515
+ required: true,
516
+ disabled: r,
517
+ "aria-required": "true"
518
+ }
519
+ )
520
+ ] }),
521
+ /* @__PURE__ */ jsxs("div", { className: "nice-login__field", children: [
522
+ /* @__PURE__ */ jsx("label", { htmlFor: H, className: "nice-login__label", children: _ ?? b("login.password", "Password") }),
523
+ /* @__PURE__ */ jsxs("div", { className: "nice-login__password-wrap", children: [
524
+ /* @__PURE__ */ jsx(
525
+ "input",
526
+ {
527
+ id: H,
528
+ className: "nice-login__input",
529
+ type: N ? "text" : "password",
530
+ value: D,
531
+ onChange: (E) => R(E.target.value),
532
+ placeholder: h ?? b("login.passwordPlaceholder", "Enter your password"),
533
+ autoComplete: "current-password",
534
+ required: true,
535
+ disabled: r,
536
+ "aria-required": "true"
537
+ }
538
+ ),
539
+ /* @__PURE__ */ jsx(
540
+ "button",
541
+ {
542
+ type: "button",
543
+ className: "nice-login__toggle-password",
544
+ onClick: () => B(!N),
545
+ "aria-label": N ? b("login.hidePassword", "Hide password") : b("login.showPassword", "Show password"),
546
+ tabIndex: -1,
547
+ children: N ? "🙈" : "👁"
548
+ }
549
+ )
550
+ ] })
551
+ ] }),
552
+ /* @__PURE__ */ jsxs("div", { className: "nice-login__options", children: [
553
+ u && /* @__PURE__ */ jsxs("label", { className: "nice-login__remember", htmlFor: V, children: [
554
+ /* @__PURE__ */ jsx(
555
+ "input",
556
+ {
557
+ id: V,
558
+ type: "checkbox",
559
+ checked: S,
560
+ onChange: (E) => A(E.target.checked),
561
+ disabled: r
562
+ }
563
+ ),
564
+ /* @__PURE__ */ jsx("span", { children: b("login.rememberMe", "Remember me") })
565
+ ] }),
566
+ d && t && /* @__PURE__ */ jsx(
567
+ "button",
568
+ {
569
+ type: "button",
570
+ className: "nice-login__forgot",
571
+ onClick: t,
572
+ disabled: r,
573
+ children: b("login.forgotPassword", "Forgot password?")
574
+ }
575
+ )
576
+ ] }),
577
+ /* @__PURE__ */ jsx(
578
+ "button",
579
+ {
580
+ type: "submit",
581
+ className: `nice-login__submit nice-login__submit--${c}`,
582
+ disabled: r || !T || !D,
583
+ children: r ? b("login.loading", "Signing in...") : b("login.submit", "Sign In")
584
+ }
585
+ ),
586
+ p && s && /* @__PURE__ */ jsxs("p", { className: "nice-login__register", children: [
587
+ b("login.noAccount", "Don't have an account?"),
588
+ " ",
589
+ /* @__PURE__ */ jsx(
590
+ "button",
591
+ {
592
+ type: "button",
593
+ className: "nice-login__register-link",
594
+ onClick: s,
595
+ disabled: r,
596
+ children: b("login.register", "Register")
597
+ }
598
+ )
599
+ ] })
600
+ ]
601
+ }
602
+ );
603
+ }
604
+ );
605
+ le.displayName = "NiceLoginForm";
606
+ const q = class q extends Component {
607
+ constructor() {
608
+ super(...arguments), this.state = {
609
+ hasError: false,
610
+ error: null
611
+ }, this.handleReset = () => {
612
+ this.setState({ hasError: false, error: null });
613
+ };
614
+ }
615
+ static getDerivedStateFromError(t) {
616
+ return { hasError: true, error: t };
617
+ }
618
+ componentDidCatch(t, s) {
619
+ this.props.onError?.(t, s);
620
+ }
621
+ render() {
622
+ if (this.state.hasError && this.state.error) {
623
+ const { fallback: t, showRetry: s = true, retryLabel: r = "Retry", title: i = "Something went wrong" } = this.props;
624
+ return typeof t == "function" ? t(this.state.error, this.handleReset) : t || /* @__PURE__ */ jsxs("div", { className: "nice-error-boundary", role: "alert", children: [
625
+ /* @__PURE__ */ jsx("div", { className: "nice-error-boundary__icon", children: "⚠️" }),
626
+ /* @__PURE__ */ jsx("h2", { className: "nice-error-boundary__title", children: i }),
627
+ /* @__PURE__ */ jsx("p", { className: "nice-error-boundary__message", children: this.state.error.message }),
628
+ s && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: this.handleReset, children: r })
629
+ ] });
630
+ }
631
+ return this.props.children;
632
+ }
633
+ };
634
+ q.displayName = "NiceErrorBoundary";
635
+
636
+ export { he as N, ve as a, oe as b, _e as c, le as e, fe as f, be as j, Q as k, pe as u };
637
+ //# sourceMappingURL=NiceErrorBoundary-niMx1aSJ.js.map