@nice2dev/ui 1.3.6 → 1.3.8

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