@nice2dev/ui 1.2.2 → 1.3.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 (80) hide show
  1. package/CHANGELOG.md +433 -0
  2. package/dist/NiceButton-CnAIqCbd.js +101 -0
  3. package/dist/NiceButton-DzCqkG5a.cjs +1 -0
  4. package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
  5. package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
  6. package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
  7. package/dist/NiceColorPicker-CyY-4q89.js +552 -0
  8. package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
  9. package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
  10. package/dist/NiceForm-CfAPcXdX.cjs +1 -0
  11. package/dist/NiceForm-DfKYNQti.js +5017 -0
  12. package/dist/NiceGantt-TEXbAELi.js +333 -0
  13. package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
  14. package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
  15. package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
  16. package/dist/NiceLoginForm-DRPldHXa.js +808 -0
  17. package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
  18. package/dist/NiceMention-CgDp0sl9.cjs +430 -0
  19. package/dist/NiceMention-DBvFvx71.js +11653 -0
  20. package/dist/NiceMention.css +1 -1
  21. package/dist/NiceModal-BlYhFDhP.js +80 -0
  22. package/dist/NiceModal-DmWz2PDM.cjs +1 -0
  23. package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
  24. package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
  25. package/dist/NiceModuleLifecyclePanel.css +1 -1
  26. package/dist/NicePagination-BJS65foT.js +200 -0
  27. package/dist/NicePagination-D_3GfWp5.cjs +1 -0
  28. package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
  29. package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
  30. package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
  31. package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
  32. package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
  33. package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
  34. package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
  35. package/dist/NiceSelect-fOelG_QB.js +495 -0
  36. package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
  37. package/dist/NiceWindow-DZLPhXbR.js +2223 -0
  38. package/dist/charts-BYQwl_GS.js +4789 -0
  39. package/dist/charts-C6iOu0H6.cjs +768 -0
  40. package/dist/charts.cjs +1 -1
  41. package/dist/charts.d.ts +1 -1
  42. package/dist/charts.mjs +1 -1
  43. package/dist/core-lazy-B_laOXNf.cjs +1 -0
  44. package/dist/core-lazy-VQEjdz0L.js +351 -0
  45. package/dist/data-branching-7rpktFJ-.cjs +1 -0
  46. package/dist/data-branching-BS0aFUMu.js +6428 -0
  47. package/dist/data-branching.cjs +1 -1
  48. package/dist/data-branching.mjs +1 -1
  49. package/dist/data.cjs +1 -1
  50. package/dist/data.mjs +3 -3
  51. package/dist/devops-CFytAJQr.cjs +18 -0
  52. package/dist/devops-CW8YY_zA.js +9122 -0
  53. package/dist/devops.cjs +1 -1
  54. package/dist/devops.css +1 -0
  55. package/dist/devops.mjs +5 -5
  56. package/dist/editors.cjs +1 -1
  57. package/dist/editors.mjs +8 -8
  58. package/dist/feedback.cjs +1 -1
  59. package/dist/feedback.d.ts +21 -16
  60. package/dist/feedback.mjs +3 -3
  61. package/dist/index.cjs +262 -257
  62. package/dist/index.css +1 -1
  63. package/dist/index.d.ts +374 -20
  64. package/dist/index.mjs +21602 -20317
  65. package/dist/lazy.cjs +1 -1
  66. package/dist/lazy.mjs +24 -24
  67. package/dist/navigation.cjs +1 -1
  68. package/dist/navigation.d.ts +31 -0
  69. package/dist/navigation.mjs +404 -354
  70. package/dist/no-code-BaAI_sJR.js +8318 -0
  71. package/dist/no-code-oQTeAtnW.cjs +331 -0
  72. package/dist/no-code.cjs +1 -1
  73. package/dist/no-code.mjs +1 -1
  74. package/dist/overlays.cjs +1 -1
  75. package/dist/overlays.d.ts +5 -0
  76. package/dist/overlays.mjs +1 -1
  77. package/dist/pickerCommons-BQi6IEAt.js +661 -0
  78. package/dist/pickerCommons-DvQptSPX.cjs +1 -0
  79. package/dist/style.css +7 -4
  80. package/package.json +4 -3
@@ -0,0 +1,808 @@
1
+ import { jsx as e, jsxs as h, Fragment as H } from "react/jsx-runtime";
2
+ import { NiceIcon as I, useNiceTranslation as D, useComponentDisplayClass as U, useComponentDisplayStyle as X, useOverlayFocus as K, useInputHints as Z, useControlId as Y } from "@nice2dev/ui-core";
3
+ import { useRef as L, useEffect as P, useCallback as $, useState as k, Component as ee, useSyncExternalStore as ne, forwardRef as G } from "react";
4
+ import { N as te } from "./NiceButton-CnAIqCbd.js";
5
+ const J = {
6
+ info: /* @__PURE__ */ e(I, { name: "info", size: 20 }),
7
+ success: /* @__PURE__ */ e(I, { name: "success", size: 20 }),
8
+ warning: /* @__PURE__ */ e(I, { name: "warning", size: 20 }),
9
+ error: /* @__PURE__ */ e(I, { name: "error", size: 20 })
10
+ }, he = ({
11
+ variant: t = "info",
12
+ title: s,
13
+ children: c,
14
+ closable: i,
15
+ onClose: n,
16
+ icon: r,
17
+ size: u = "md",
18
+ className: a,
19
+ style: d,
20
+ displayStyle: f
21
+ }) => {
22
+ const { t: m } = D(), b = U("card", f);
23
+ return /* @__PURE__ */ h(
24
+ "div",
25
+ {
26
+ className: `nice-alert nice-alert--${t} nice-alert--${u} nice-alert--ds-${b} ${a || ""}`,
27
+ style: d,
28
+ role: "alert",
29
+ children: [
30
+ /* @__PURE__ */ e("div", { className: `nice-alert__icon nice-alert__icon--${t}`, children: r || J[t] }),
31
+ /* @__PURE__ */ h("div", { className: "nice-alert__content", children: [
32
+ s && /* @__PURE__ */ e("div", { className: "nice-alert__title", children: s }),
33
+ /* @__PURE__ */ e("div", { children: c })
34
+ ] }),
35
+ i && /* @__PURE__ */ e(
36
+ "button",
37
+ {
38
+ type: "button",
39
+ className: "nice-alert__close",
40
+ onClick: n,
41
+ "aria-label": m("alert.close", "Close"),
42
+ children: /* @__PURE__ */ e(I, { name: "close", size: 16 })
43
+ }
44
+ )
45
+ ]
46
+ }
47
+ );
48
+ }, be = ({
49
+ open: t,
50
+ onClose: s,
51
+ title: c,
52
+ position: i = "right",
53
+ size: n = "md",
54
+ children: r,
55
+ footer: u,
56
+ transitionDuration: a,
57
+ className: d,
58
+ style: f,
59
+ displayStyle: m
60
+ }) => {
61
+ const b = X("modal", m), N = U("modal", m), { t: o } = D(), p = L(null);
62
+ return K(p, { open: t, onClose: s }), P(() => {
63
+ if (t)
64
+ return document.body.style.overflow = "hidden", () => {
65
+ document.body.style.overflow = "";
66
+ };
67
+ }, [t]), t ? /* @__PURE__ */ h(H, { children: [
68
+ /* @__PURE__ */ e(
69
+ "div",
70
+ {
71
+ className: "nice-drawer-overlay",
72
+ onMouseDown: (y) => {
73
+ y.target === y.currentTarget && s();
74
+ }
75
+ }
76
+ ),
77
+ /* @__PURE__ */ h(
78
+ "div",
79
+ {
80
+ ref: p,
81
+ className: `nice-drawer nice-drawer--${i} nice-drawer--${n} nice-drawer--ds-${N} ${d || ""}`,
82
+ style: {
83
+ ...b,
84
+ ...f,
85
+ ...a != null ? { transitionDuration: `${a}ms` } : {}
86
+ },
87
+ role: "dialog",
88
+ "aria-modal": "true",
89
+ "aria-label": c,
90
+ children: [
91
+ c && /* @__PURE__ */ h("div", { className: "nice-drawer__header", children: [
92
+ /* @__PURE__ */ e("h3", { className: "nice-drawer__title", children: c }),
93
+ /* @__PURE__ */ e(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ className: "nice-drawer__close",
98
+ onClick: s,
99
+ "aria-label": o("controls.close", "Close"),
100
+ children: /* @__PURE__ */ e(I, { name: "close", size: 18 })
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ e("div", { className: "nice-drawer__body", children: r }),
105
+ u && /* @__PURE__ */ e("div", { className: "nice-drawer__footer", children: u })
106
+ ]
107
+ }
108
+ )
109
+ ] }) : null;
110
+ }, _e = ({
111
+ toasts: t,
112
+ onDismiss: s,
113
+ position: c = "top-right"
114
+ }) => {
115
+ const { t: i } = D(), n = L(null), r = L(null);
116
+ Z(n, [{ intent: "back", label: i("toast.dismiss", "Dismiss") }]);
117
+ const u = $((a) => {
118
+ const d = n.current;
119
+ if (!d || !a.contains(document.activeElement))
120
+ return;
121
+ const f = [...d.querySelectorAll(".nice-toast:not(.nice-toast--exiting)")], m = f.indexOf(a), b = f[m + 1] ?? f[m - 1];
122
+ (b && b !== a ? b.querySelector("button") : r.current?.isConnected ? r.current : null)?.focus();
123
+ }, []);
124
+ return P(() => {
125
+ const a = n.current;
126
+ if (!a)
127
+ return;
128
+ const d = (f) => {
129
+ const m = f.relatedTarget;
130
+ m instanceof HTMLElement && !a.contains(m) && (r.current = m);
131
+ };
132
+ return a.addEventListener("focusin", d), () => a.removeEventListener("focusin", d);
133
+ }, []), /* @__PURE__ */ e(
134
+ "div",
135
+ {
136
+ ref: n,
137
+ className: `nice-toast-container nice-toast-container--${c}`,
138
+ role: "region",
139
+ "aria-label": i("toast.region", "Notifications"),
140
+ children: t.map((a) => /* @__PURE__ */ e(se, { toast: a, onDismiss: s, onLeave: u }, a.id))
141
+ }
142
+ );
143
+ }, se = ({ toast: t, onDismiss: s, onLeave: c }) => {
144
+ const { t: i } = D(), n = L(null), [r, u] = k(!1), [a, d] = k(!1), [f, m] = k(!1), b = a || f, N = $(() => {
145
+ n.current && c(n.current), u(!0);
146
+ }, [c]);
147
+ return P(() => {
148
+ if (b || r)
149
+ return;
150
+ const o = t.duration ?? 4e3;
151
+ if (o > 0) {
152
+ const p = setTimeout(() => u(!0), o);
153
+ return () => clearTimeout(p);
154
+ }
155
+ }, [t.duration, b, r]), P(() => {
156
+ if (r) {
157
+ const o = setTimeout(() => s(t.id), 200);
158
+ return () => clearTimeout(o);
159
+ }
160
+ }, [r, t.id, s]), P(() => {
161
+ const o = n.current;
162
+ if (!o)
163
+ return;
164
+ const p = (_) => {
165
+ _.key === "Escape" && !_.defaultPrevented && (_.preventDefault(), N());
166
+ }, y = () => d(!0), l = () => d(!1), C = () => m(!0), w = (_) => {
167
+ o.contains(_.relatedTarget) || m(!1);
168
+ };
169
+ return o.addEventListener("keydown", p), o.addEventListener("mouseenter", y), o.addEventListener("mouseleave", l), o.addEventListener("focusin", C), o.addEventListener("focusout", w), () => {
170
+ o.removeEventListener("keydown", p), o.removeEventListener("mouseenter", y), o.removeEventListener("mouseleave", l), o.removeEventListener("focusin", C), o.removeEventListener("focusout", w);
171
+ };
172
+ }, [N]), /* @__PURE__ */ h(
173
+ "div",
174
+ {
175
+ ref: n,
176
+ className: `nice-toast nice-toast--${t.variant} ${r ? "nice-toast--exiting" : ""}`,
177
+ role: "alert",
178
+ style: { position: "relative" },
179
+ children: [
180
+ /* @__PURE__ */ e("div", { className: "nice-toast__icon", children: J[t.variant] }),
181
+ /* @__PURE__ */ h("div", { className: "nice-toast__content", children: [
182
+ t.title && /* @__PURE__ */ e("div", { className: "nice-toast__title", children: t.title }),
183
+ /* @__PURE__ */ e("div", { className: "nice-toast__message", children: t.message }),
184
+ t.action && /* @__PURE__ */ e(
185
+ "button",
186
+ {
187
+ type: "button",
188
+ className: "nice-toast__action",
189
+ onClick: () => {
190
+ t.action?.onClick(), N();
191
+ },
192
+ children: t.action.label
193
+ }
194
+ )
195
+ ] }),
196
+ /* @__PURE__ */ e(
197
+ "button",
198
+ {
199
+ type: "button",
200
+ className: "nice-toast__close",
201
+ onClick: N,
202
+ "aria-label": i("toast.close", "Close"),
203
+ children: /* @__PURE__ */ e(I, { name: "close", size: 16 })
204
+ }
205
+ )
206
+ ]
207
+ }
208
+ );
209
+ };
210
+ let re = 0;
211
+ function ge() {
212
+ const [t, s] = k([]), c = $(
213
+ (n, r, u) => {
214
+ const a = `toast-${++re}`;
215
+ return s((d) => [
216
+ ...d,
217
+ {
218
+ id: a,
219
+ variant: n,
220
+ message: r,
221
+ title: u?.title,
222
+ duration: u?.duration,
223
+ action: u?.action
224
+ }
225
+ ]), a;
226
+ },
227
+ []
228
+ ), i = $((n) => {
229
+ s((r) => r.filter((u) => u.id !== n));
230
+ }, []);
231
+ return {
232
+ toasts: t,
233
+ dismiss: i,
234
+ info: (n, r) => c("info", n, r),
235
+ success: (n, r) => c("success", n, r),
236
+ warning: (n, r) => c("warning", n, r),
237
+ error: (n, r) => c("error", n, r)
238
+ };
239
+ }
240
+ function ie({
241
+ error: t,
242
+ showRetry: s,
243
+ retryLabel: c,
244
+ title: i,
245
+ onReset: n
246
+ }) {
247
+ const { t: r } = D();
248
+ return /* @__PURE__ */ h("div", { className: "nice-error-boundary", role: "alert", children: [
249
+ /* @__PURE__ */ e("div", { className: "nice-error-boundary__icon", children: /* @__PURE__ */ e(I, { name: "warning", size: 32 }) }),
250
+ /* @__PURE__ */ e("h2", { className: "nice-error-boundary__title", children: i ?? r("errorBoundary.somethingWentWrong", "Something went wrong") }),
251
+ /* @__PURE__ */ e("p", { className: "nice-error-boundary__message", children: t.message }),
252
+ s && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: n, children: c ?? r("errorBoundary.retry", "Retry") })
253
+ ] });
254
+ }
255
+ const V = class V extends ee {
256
+ constructor() {
257
+ super(...arguments), this.state = {
258
+ hasError: !1,
259
+ error: null
260
+ }, this.handleReset = () => {
261
+ this.setState({ hasError: !1, error: null });
262
+ };
263
+ }
264
+ static getDerivedStateFromError(s) {
265
+ return { hasError: !0, error: s };
266
+ }
267
+ componentDidCatch(s, c) {
268
+ this.props.onError?.(s, c);
269
+ }
270
+ render() {
271
+ if (this.state.hasError && this.state.error) {
272
+ const { fallback: s, showRetry: c = !0, retryLabel: i, title: n } = this.props;
273
+ return typeof s == "function" ? s(this.state.error, this.handleReset) : s || /* @__PURE__ */ e(
274
+ ie,
275
+ {
276
+ error: this.state.error,
277
+ showRetry: c,
278
+ retryLabel: i,
279
+ title: n,
280
+ onReset: this.handleReset
281
+ }
282
+ );
283
+ }
284
+ return this.props.children;
285
+ }
286
+ };
287
+ V.displayName = "NiceErrorBoundary";
288
+ let W = V;
289
+ function ce(t) {
290
+ return window.addEventListener("online", t), window.addEventListener("offline", t), () => {
291
+ window.removeEventListener("online", t), window.removeEventListener("offline", t);
292
+ };
293
+ }
294
+ function ae() {
295
+ return navigator.onLine;
296
+ }
297
+ function oe() {
298
+ return !0;
299
+ }
300
+ const pe = ({
301
+ message: t,
302
+ variant: s = "warning",
303
+ icon: c,
304
+ online: i,
305
+ size: n = "md",
306
+ className: r,
307
+ style: u,
308
+ "data-testid": a
309
+ }) => {
310
+ const { t: d } = D(), f = ne(ce, ae, oe);
311
+ return i ?? f ? null : /* @__PURE__ */ h(
312
+ "div",
313
+ {
314
+ className: `nice-offline-banner nice-offline-banner--${s} nice-offline-banner--${n} ${r || ""}`,
315
+ style: u,
316
+ role: "alert",
317
+ "aria-live": "assertive",
318
+ "data-testid": a,
319
+ children: [
320
+ /* @__PURE__ */ e("span", { className: "nice-offline-banner__icon", children: c ?? /* @__PURE__ */ e(I, { name: "wifi", size: 18 }) }),
321
+ /* @__PURE__ */ e("span", { className: "nice-offline-banner__message", children: t ?? d("offlineBanner.message", "You are offline. Some features may be unavailable.") })
322
+ ]
323
+ }
324
+ );
325
+ }, ye = ({
326
+ error: t,
327
+ onRetry: s,
328
+ retryLabel: c,
329
+ title: i,
330
+ autoRetrySeconds: n,
331
+ variant: r = "error",
332
+ icon: u,
333
+ size: a = "md",
334
+ className: d,
335
+ style: f,
336
+ "data-testid": m
337
+ }) => {
338
+ const { t: b } = D(), N = c ?? b("retryPanel.retry", "Retry"), o = i ?? b("retryPanel.operationFailed", "Operation failed"), [p, y] = k(n ?? 0), l = L(void 0), C = typeof t == "string" ? t : t.message, w = $(() => {
339
+ y(n ?? 0), s();
340
+ }, [s, n]);
341
+ return P(() => {
342
+ if (!(!n || n <= 0))
343
+ return y(n), l.current = setInterval(() => {
344
+ y((_) => _ <= 1 ? (clearInterval(l.current), s(), 0) : _ - 1);
345
+ }, 1e3), () => clearInterval(l.current);
346
+ }, [n, s]), /* @__PURE__ */ h(
347
+ "div",
348
+ {
349
+ className: `nice-retry-panel nice-retry-panel--${r} nice-retry-panel--${a} ${d || ""}`,
350
+ style: f,
351
+ role: "alert",
352
+ "data-testid": m,
353
+ children: [
354
+ /* @__PURE__ */ e("div", { className: "nice-retry-panel__icon", children: u ?? /* @__PURE__ */ e(I, { name: "warning", size: 24 }) }),
355
+ /* @__PURE__ */ h("div", { className: "nice-retry-panel__content", children: [
356
+ /* @__PURE__ */ e("div", { className: "nice-retry-panel__title", children: o }),
357
+ /* @__PURE__ */ e("p", { className: "nice-retry-panel__message", children: C })
358
+ ] }),
359
+ /* @__PURE__ */ h("div", { className: "nice-retry-panel__actions", children: [
360
+ /* @__PURE__ */ e(
361
+ "button",
362
+ {
363
+ type: "button",
364
+ className: "nice-btn nice-btn--primary nice-btn--sm",
365
+ onClick: w,
366
+ children: N
367
+ }
368
+ ),
369
+ n && p > 0 && /* @__PURE__ */ e("span", { className: "nice-retry-panel__countdown", children: b("retryPanel.autoRetryInS", "Auto-retry in {countdown}s").replace(
370
+ "{countdown}",
371
+ String(p)
372
+ ) })
373
+ ] })
374
+ ]
375
+ }
376
+ );
377
+ };
378
+ function le({
379
+ timeoutMs: t = 1e4,
380
+ slowThresholdMs: s = 3e3,
381
+ onTimeout: c,
382
+ autoRetry: i = !1,
383
+ autoRetryCount: n = 3
384
+ } = {}) {
385
+ const [r, u] = k(!1), [a, d] = k(!1), [f, m] = k(!1), [b, N] = k(0), [o, p] = k(0), y = L(null), l = L(null), C = L(null), w = L(0), _ = $(() => {
386
+ y.current && clearTimeout(y.current), l.current && clearTimeout(l.current), C.current && clearInterval(C.current);
387
+ }, []), E = $(() => {
388
+ _(), u(!0), d(!1), m(!1), N(0), w.current = Date.now(), C.current = setInterval(() => {
389
+ N(Date.now() - w.current);
390
+ }, 200), y.current = setTimeout(() => {
391
+ d(!0);
392
+ }, s), l.current = setTimeout(() => {
393
+ m(!0), u(!1), d(!1), _(), c?.();
394
+ }, t);
395
+ }, [_, s, t, c]), x = $(() => {
396
+ _(), u(!1), d(!1);
397
+ }, [_]), g = $(() => {
398
+ p((T) => T + 1), m(!1), E();
399
+ }, [E]);
400
+ return P(() => () => _(), [_]), P(() => {
401
+ if (i && f && o < n) {
402
+ const T = Math.pow(2, o) * 1e3, S = setTimeout(() => g(), T);
403
+ return () => clearTimeout(S);
404
+ }
405
+ }, [i, n, f, o, g]), { isLoading: r, isSlow: a, isTimedOut: f, elapsed: b, retryCount: o, start: E, stop: x, retry: g };
406
+ }
407
+ const ve = ({
408
+ timeoutMs: t = 1e4,
409
+ slowThresholdMs: s = 3e3,
410
+ onTimeout: c,
411
+ onRetry: i,
412
+ autoRetry: n = !1,
413
+ autoRetryCount: r = 3,
414
+ showProgress: u = !0,
415
+ slowMessage: a,
416
+ timeoutMessage: d,
417
+ loading: f,
418
+ children: m,
419
+ size: b = "md",
420
+ className: N,
421
+ style: o,
422
+ "data-testid": p
423
+ }) => {
424
+ const { t: y } = D(), { isSlow: l, isTimedOut: C, elapsed: w, start: _, stop: E, retry: x } = le({
425
+ timeoutMs: t,
426
+ slowThresholdMs: s,
427
+ onTimeout: c,
428
+ autoRetry: n,
429
+ autoRetryCount: r
430
+ }), g = L(_);
431
+ g.current = _;
432
+ const T = L(E);
433
+ T.current = E, P(() => {
434
+ f ? g.current() : T.current();
435
+ }, [f]);
436
+ const S = () => {
437
+ x(), i?.();
438
+ };
439
+ if (!f)
440
+ return /* @__PURE__ */ e(H, { children: m });
441
+ if (C)
442
+ return /* @__PURE__ */ h(
443
+ "div",
444
+ {
445
+ className: `nice-timeout-feedback nice-timeout-feedback--timeout nice-timeout-feedback--${b} ${N ?? ""}`,
446
+ style: o,
447
+ role: "alert",
448
+ "data-testid": p,
449
+ children: [
450
+ /* @__PURE__ */ e("p", { className: "nice-timeout-feedback__message", children: d ?? y("timeoutFeedback.timeout", "The operation timed out. Please try again.") }),
451
+ /* @__PURE__ */ e(te, { size: "sm", className: "nice-timeout-feedback__retry-btn", onClick: S, children: y("timeoutFeedback.retry", "Try again") })
452
+ ]
453
+ }
454
+ );
455
+ const F = Math.min(100, w / t * 100);
456
+ return /* @__PURE__ */ h(
457
+ "div",
458
+ {
459
+ className: `nice-timeout-feedback nice-timeout-feedback--${b} ${l ? "nice-timeout-feedback--slow" : ""} ${N ?? ""}`,
460
+ style: o,
461
+ role: "status",
462
+ "aria-busy": "true",
463
+ "data-testid": p,
464
+ children: [
465
+ /* @__PURE__ */ e("div", { className: "nice-timeout-feedback__spinner", "aria-hidden": "true" }),
466
+ l && /* @__PURE__ */ e("p", { className: "nice-timeout-feedback__slow-msg", children: a ?? y("timeoutFeedback.slow", "This is taking longer than usual…") }),
467
+ u && /* @__PURE__ */ e(
468
+ "div",
469
+ {
470
+ className: "nice-timeout-feedback__progress",
471
+ role: "progressbar",
472
+ "aria-label": y("timeoutFeedback.progress", "Time until timeout"),
473
+ "aria-valuenow": Math.round(F),
474
+ "aria-valuemin": 0,
475
+ "aria-valuemax": 100,
476
+ children: /* @__PURE__ */ e(
477
+ "div",
478
+ {
479
+ className: "nice-timeout-feedback__progress-bar",
480
+ style: { width: `${F}%` }
481
+ }
482
+ )
483
+ }
484
+ )
485
+ ]
486
+ }
487
+ );
488
+ }, Ne = /* @__PURE__ */ Object.assign(
489
+ /* @__PURE__ */ G(
490
+ ({
491
+ visible: t,
492
+ onAcceptAll: s,
493
+ onRejectAll: c,
494
+ onSave: i,
495
+ categories: n = ["necessary", "analytics", "marketing", "preferences"],
496
+ defaults: r,
497
+ position: u = "bottom",
498
+ size: a = "md",
499
+ policyUrl: d,
500
+ showDetails: f = !1,
501
+ className: m,
502
+ style: b,
503
+ id: N,
504
+ ...o
505
+ }, p) => {
506
+ const y = Y(N), { t: l } = D(), [C, w] = k(!0), _ = t ?? C, [E, x] = k(f), [g, T] = k(() => {
507
+ const v = {
508
+ necessary: !0,
509
+ analytics: !1,
510
+ marketing: !1,
511
+ preferences: !1
512
+ };
513
+ return r && Object.assign(v, r), v.necessary = !0, v;
514
+ }), S = {
515
+ necessary: l("cookie.necessary", "Necessary"),
516
+ analytics: l("cookie.analytics", "Analytics"),
517
+ marketing: l("cookie.marketing", "Marketing"),
518
+ preferences: l("cookie.preferences", "Preferences")
519
+ }, F = {
520
+ necessary: l(
521
+ "cookie.necessaryDesc",
522
+ "Required for the website to function. Cannot be disabled."
523
+ ),
524
+ analytics: l(
525
+ "cookie.analyticsDesc",
526
+ "Help us understand how visitors interact with the website."
527
+ ),
528
+ marketing: l("cookie.marketingDesc", "Used to deliver relevant advertisements."),
529
+ preferences: l("cookie.preferencesDesc", "Allow the website to remember your choices.")
530
+ }, q = $(() => {
531
+ const v = {
532
+ necessary: !0,
533
+ analytics: !0,
534
+ marketing: !0,
535
+ preferences: !0
536
+ };
537
+ s?.(), i?.(v), w(!1);
538
+ }, [s, i]), O = $(() => {
539
+ const v = {
540
+ necessary: !0,
541
+ analytics: !1,
542
+ marketing: !1,
543
+ preferences: !1
544
+ };
545
+ c?.(), i?.(v), w(!1);
546
+ }, [c, i]), M = $(() => {
547
+ i?.({ ...g, necessary: !0 }), w(!1);
548
+ }, [g, i]), z = L(null);
549
+ K(z, { open: _ });
550
+ const B = $(
551
+ (v) => {
552
+ z.current = v, typeof p == "function" ? p(v) : p && (p.current = v);
553
+ },
554
+ [p]
555
+ );
556
+ return _ ? /* @__PURE__ */ e(
557
+ "div",
558
+ {
559
+ ref: B,
560
+ id: y,
561
+ className: `nice-cookie-consent nice-cookie-consent--${u} nice-cookie-consent--${a} ${m ?? ""}`,
562
+ style: b,
563
+ role: "dialog",
564
+ "aria-label": l("cookie.label", "Cookie Consent"),
565
+ "aria-modal": "true",
566
+ ...o,
567
+ children: /* @__PURE__ */ h("div", { className: "nice-cookie-consent__content", children: [
568
+ /* @__PURE__ */ h("p", { className: "nice-cookie-consent__message", children: [
569
+ l(
570
+ "cookie.message",
571
+ "We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."
572
+ ),
573
+ d && /* @__PURE__ */ h(H, { children: [
574
+ " ",
575
+ /* @__PURE__ */ e(
576
+ "a",
577
+ {
578
+ href: d,
579
+ className: "nice-cookie-consent__link",
580
+ target: "_blank",
581
+ rel: "noopener noreferrer",
582
+ children: l("cookie.learnMore", "Learn more")
583
+ }
584
+ )
585
+ ] })
586
+ ] }),
587
+ E && /* @__PURE__ */ e("div", { className: "nice-cookie-consent__details", children: n.map((v) => /* @__PURE__ */ h("label", { className: "nice-cookie-consent__category", children: [
588
+ /* @__PURE__ */ e(
589
+ "input",
590
+ {
591
+ type: "checkbox",
592
+ checked: g[v],
593
+ disabled: v === "necessary",
594
+ onChange: (j) => T((A) => ({ ...A, [v]: j.target.checked })),
595
+ className: "nice-cookie-consent__checkbox"
596
+ }
597
+ ),
598
+ /* @__PURE__ */ h("div", { className: "nice-cookie-consent__cat-info", children: [
599
+ /* @__PURE__ */ e("strong", { children: S[v] }),
600
+ /* @__PURE__ */ e("span", { className: "nice-cookie-consent__cat-desc", children: F[v] })
601
+ ] })
602
+ ] }, v)) }),
603
+ /* @__PURE__ */ h("div", { className: "nice-cookie-consent__actions", children: [
604
+ !E && /* @__PURE__ */ e(
605
+ "button",
606
+ {
607
+ type: "button",
608
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--details",
609
+ onClick: () => x(!0),
610
+ children: l("cookie.customize", "Customize")
611
+ }
612
+ ),
613
+ E && /* @__PURE__ */ e(
614
+ "button",
615
+ {
616
+ type: "button",
617
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--save",
618
+ onClick: M,
619
+ children: l("cookie.savePreferences", "Save preferences")
620
+ }
621
+ ),
622
+ /* @__PURE__ */ e(
623
+ "button",
624
+ {
625
+ type: "button",
626
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--reject",
627
+ onClick: O,
628
+ children: l("cookie.rejectAll", "Reject all")
629
+ }
630
+ ),
631
+ /* @__PURE__ */ e(
632
+ "button",
633
+ {
634
+ type: "button",
635
+ className: "nice-cookie-consent__btn nice-cookie-consent__btn--accept",
636
+ onClick: q,
637
+ children: l("cookie.acceptAll", "Accept all")
638
+ }
639
+ )
640
+ ] })
641
+ ] })
642
+ }
643
+ ) : null;
644
+ }
645
+ ),
646
+ { displayName: "NiceCookieConsent" }
647
+ ), ke = /* @__PURE__ */ Object.assign(
648
+ /* @__PURE__ */ G(
649
+ ({
650
+ onSubmit: t,
651
+ onForgotPassword: s,
652
+ onRegister: c,
653
+ loading: i = !1,
654
+ error: n,
655
+ variant: r = "primary",
656
+ size: u = "md",
657
+ showRememberMe: a = !0,
658
+ showForgotPassword: d = !0,
659
+ showRegister: f = !1,
660
+ title: m,
661
+ logo: b,
662
+ usernameLabel: N,
663
+ passwordLabel: o,
664
+ usernamePlaceholder: p,
665
+ passwordPlaceholder: y,
666
+ className: l,
667
+ style: C,
668
+ id: w,
669
+ ..._
670
+ }, E) => {
671
+ const x = Y(w), { t: g } = D(), [T, S] = k(""), [F, q] = k(""), [O, M] = k(!1), [z, B] = k(!1), v = `${x}-user`, j = `${x}-pass`, A = `${x}-remember`, Q = $(
672
+ (R) => {
673
+ R.preventDefault(), !i && t?.({ username: T, password: F, rememberMe: O });
674
+ },
675
+ [i, T, F, O, t]
676
+ );
677
+ return /* @__PURE__ */ h(
678
+ "form",
679
+ {
680
+ ref: E,
681
+ id: x,
682
+ className: `nice-login nice-login--${r} nice-login--${u} ${l ?? ""}`,
683
+ style: C,
684
+ onSubmit: Q,
685
+ noValidate: !0,
686
+ ..._,
687
+ children: [
688
+ b && /* @__PURE__ */ e("div", { className: "nice-login__logo", children: b }),
689
+ m && /* @__PURE__ */ e("h2", { className: "nice-login__title", children: m ?? g("login.title", "Sign In") }),
690
+ n && /* @__PURE__ */ e("div", { className: "nice-login__error", role: "alert", children: n }),
691
+ /* @__PURE__ */ h("div", { className: "nice-login__field", children: [
692
+ /* @__PURE__ */ e("label", { htmlFor: v, className: "nice-login__label", children: N ?? g("login.username", "Username") }),
693
+ /* @__PURE__ */ e(
694
+ "input",
695
+ {
696
+ id: v,
697
+ className: "nice-login__input",
698
+ type: "text",
699
+ value: T,
700
+ onChange: (R) => S(R.target.value),
701
+ placeholder: p ?? g("login.usernamePlaceholder", "Enter your username"),
702
+ autoComplete: "username",
703
+ required: !0,
704
+ disabled: i,
705
+ "aria-required": "true"
706
+ }
707
+ )
708
+ ] }),
709
+ /* @__PURE__ */ h("div", { className: "nice-login__field", children: [
710
+ /* @__PURE__ */ e("label", { htmlFor: j, className: "nice-login__label", children: o ?? g("login.password", "Password") }),
711
+ /* @__PURE__ */ h("div", { className: "nice-login__password-wrap", children: [
712
+ /* @__PURE__ */ e(
713
+ "input",
714
+ {
715
+ id: j,
716
+ className: "nice-login__input",
717
+ type: z ? "text" : "password",
718
+ value: F,
719
+ onChange: (R) => q(R.target.value),
720
+ placeholder: y ?? g("login.passwordPlaceholder", "Enter your password"),
721
+ autoComplete: "current-password",
722
+ required: !0,
723
+ disabled: i,
724
+ "aria-required": "true"
725
+ }
726
+ ),
727
+ /* @__PURE__ */ e(
728
+ "button",
729
+ {
730
+ type: "button",
731
+ className: "nice-login__toggle-password",
732
+ onClick: () => B(!z),
733
+ "aria-label": z ? g("login.hidePassword", "Hide password") : g("login.showPassword", "Show password"),
734
+ tabIndex: -1,
735
+ children: /* @__PURE__ */ e(I, { name: z ? "eye-off" : "eye", size: 16 })
736
+ }
737
+ )
738
+ ] })
739
+ ] }),
740
+ /* @__PURE__ */ h("div", { className: "nice-login__options", children: [
741
+ a && /* @__PURE__ */ h("label", { className: "nice-login__remember", htmlFor: A, children: [
742
+ /* @__PURE__ */ e(
743
+ "input",
744
+ {
745
+ id: A,
746
+ type: "checkbox",
747
+ checked: O,
748
+ onChange: (R) => M(R.target.checked),
749
+ disabled: i
750
+ }
751
+ ),
752
+ /* @__PURE__ */ e("span", { children: g("login.rememberMe", "Remember me") })
753
+ ] }),
754
+ d && s && /* @__PURE__ */ e(
755
+ "button",
756
+ {
757
+ type: "button",
758
+ className: "nice-login__forgot",
759
+ onClick: s,
760
+ disabled: i,
761
+ children: g("login.forgotPassword", "Forgot password?")
762
+ }
763
+ )
764
+ ] }),
765
+ /* @__PURE__ */ e(
766
+ "button",
767
+ {
768
+ type: "submit",
769
+ className: `nice-login__submit nice-login__submit--${r}`,
770
+ disabled: i || !T || !F,
771
+ children: i ? g("login.loading", "Signing in...") : g("login.submit", "Sign In")
772
+ }
773
+ ),
774
+ f && c && /* @__PURE__ */ h("p", { className: "nice-login__register", children: [
775
+ g("login.noAccount", "Don't have an account?"),
776
+ " ",
777
+ /* @__PURE__ */ e(
778
+ "button",
779
+ {
780
+ type: "button",
781
+ className: "nice-login__register-link",
782
+ onClick: c,
783
+ disabled: i,
784
+ children: g("login.register", "Register")
785
+ }
786
+ )
787
+ ] })
788
+ ]
789
+ }
790
+ );
791
+ }
792
+ ),
793
+ { displayName: "NiceLoginForm" }
794
+ );
795
+ export {
796
+ he as N,
797
+ Ne as a,
798
+ be as b,
799
+ W as c,
800
+ ke as d,
801
+ pe as e,
802
+ ye as f,
803
+ ve as g,
804
+ _e as h,
805
+ J as i,
806
+ le as j,
807
+ ge as u
808
+ };