@nice2dev/ui 1.0.19 → 1.0.20

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