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