@leabankab/component-library 8.9.1 → 8.10.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.
@@ -1,27 +1,27 @@
1
1
  "use client";
2
- import { a as e, c as t, i as n, l as r, o as i, r as a, s as o, t as s } from "./cookie-consent-core-lX0QAEAo.mjs";
3
- import { createContext as c, isValidElement as l, useContext as u, useEffect as d, useId as f, useMemo as p, useState as m, useSyncExternalStore as h } from "react";
4
- import { Button as g } from "@base-ui/react/button";
5
- import { useRender as _ } from "@base-ui/react/use-render";
6
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
7
- import { Dialog as x } from "@base-ui/react/dialog";
8
- import { ChevronDown as ee, X as te } from "lucide-react";
9
- import { Switch as S } from "@base-ui/react/switch";
10
- import { Accordion as C } from "@base-ui/react/accordion";
2
+ import { a as e, c as t, d as n, i as r, l as i, o as a, r as o, s, t as c, u as l } from "./cookie-consent-core-DMnn4IZW.mjs";
3
+ import { createContext as u, isValidElement as d, useContext as f, useEffect as p, useId as m, useLayoutEffect as h, useMemo as ee, useRef as g, useState as _, useSyncExternalStore as te } from "react";
4
+ import { Button as v } from "@base-ui/react/button";
5
+ import { useRender as y } from "@base-ui/react/use-render";
6
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
7
+ import { Dialog as C } from "@base-ui/react/dialog";
8
+ import { ChevronDown as w, X as T } from "lucide-react";
9
+ import { Switch as E } from "@base-ui/react/switch";
10
+ import { Accordion as D } from "@base-ui/react/accordion";
11
11
  import './cookie-consent.css';//#region src/utils/merge-class-name.ts
12
- var w = (e, t) => (n) => [e, typeof t == "function" ? t(n) : t].filter(Boolean).join(" "), T = {
12
+ var O = (e, t) => (n) => [e, typeof t == "function" ? t(n) : t].filter(Boolean).join(" "), k = {
13
13
  Button: "_Button_dq81c_1",
14
14
  IconButton: "_IconButton_dq81c_141",
15
15
  Spinner: "_Spinner_dq81c_172",
16
16
  "button-spin": "_button-spin_dq81c_1",
17
17
  SrOnly: "_SrOnly_dq81c_190"
18
- }, E = (e) => l(e) && (e.props.href != null || e.props.to != null), ne = (e) => e.preventDefault();
18
+ }, ne = (e) => d(e) && (e.props.href != null || e.props.to != null), A = (e) => e.preventDefault();
19
19
  function re({ loading: e = !1, disabled: t, className: n, render: r, nativeButton: i, focusableWhenDisabled: a, ref: o, ...s }) {
20
- let c = !!(t || e), l = E(r), u = {
20
+ let c = !!(t || e), l = ne(r), u = {
21
21
  "aria-busy": e || void 0,
22
22
  "data-loading": e || void 0
23
23
  };
24
- return _({
24
+ return y({
25
25
  enabled: l,
26
26
  render: l ? r : void 0,
27
27
  ref: o,
@@ -32,9 +32,9 @@ function re({ loading: e = !1, disabled: t, className: n, render: r, nativeButto
32
32
  "aria-disabled": c || void 0,
33
33
  "data-disabled": c ? "" : void 0,
34
34
  className: typeof n == "function" ? n({ disabled: c }) : n,
35
- onClick: c ? ne : s.onClick
35
+ onClick: c ? A : s.onClick
36
36
  }
37
- }) || /* @__PURE__ */ y(g, {
37
+ }) || /* @__PURE__ */ x(v, {
38
38
  ...s,
39
39
  ...u,
40
40
  ref: o,
@@ -46,37 +46,37 @@ function re({ loading: e = !1, disabled: t, className: n, render: r, nativeButto
46
46
  });
47
47
  }
48
48
  function ie({ variant: e = "solid", color: t = "primary", size: n = "md", className: r, ...i }) {
49
- return /* @__PURE__ */ y(re, {
49
+ return /* @__PURE__ */ x(re, {
50
50
  ...i,
51
51
  "data-variant": e,
52
52
  "data-color": t,
53
53
  "data-size": n,
54
- className: w(T.Button, r)
54
+ className: O(k.Button, r)
55
55
  });
56
56
  }
57
57
  //#endregion
58
58
  //#region src/components/buttons/button/button.tsx
59
- function D({ startIcon: e, endIcon: t, loading: n = !1, loadingLabel: r, children: i, ...a }) {
60
- return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b(ie, {
59
+ function j({ startIcon: e, endIcon: t, loading: n = !1, loadingLabel: r, children: i, ...a }) {
60
+ return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ S(ie, {
61
61
  ...a,
62
62
  loading: n,
63
63
  "data-start-icon": n || e != null || void 0,
64
64
  "data-end-icon": t != null || void 0,
65
65
  children: [
66
- n ? /* @__PURE__ */ y("span", {
67
- className: T.Spinner,
66
+ n ? /* @__PURE__ */ x("span", {
67
+ className: k.Spinner,
68
68
  "aria-hidden": !0
69
69
  }) : e,
70
70
  i,
71
71
  t
72
72
  ]
73
- }), r != null && /* @__PURE__ */ y("span", {
73
+ }), r != null && /* @__PURE__ */ x("span", {
74
74
  role: "status",
75
- className: T.SrOnly,
75
+ className: k.SrOnly,
76
76
  children: n ? r : null
77
77
  })] });
78
78
  }
79
- var O = {
79
+ var M = {
80
80
  Backdrop: "_Backdrop_1do7v_8",
81
81
  Viewport: "_Viewport_1do7v_22",
82
82
  Popup: "_Popup_1do7v_38",
@@ -86,7 +86,7 @@ var O = {
86
86
  Content: "_Content_1do7v_111",
87
87
  Footer: "_Footer_1do7v_119",
88
88
  CloseButton: "_CloseButton_1do7v_135"
89
- }, ae = c("no"), oe = () => u(ae);
89
+ }, ae = u("no"), oe = () => f(ae);
90
90
  //#endregion
91
91
  //#region src/i18n/create-translation.ts
92
92
  function se(e) {
@@ -105,86 +105,86 @@ var ce = se({ close: {
105
105
  se: "Stäng",
106
106
  fi: "Sulje",
107
107
  es: "Cerrar"
108
- } }), k = x.Root;
109
- x.Trigger;
110
- var A = x.Portal;
111
- function j({ className: e, ...t }) {
112
- return /* @__PURE__ */ y(x.Backdrop, {
108
+ } }), le = C.Root;
109
+ C.Trigger;
110
+ var ue = C.Portal;
111
+ function N({ className: e, ...t }) {
112
+ return /* @__PURE__ */ x(C.Backdrop, {
113
113
  ...t,
114
- className: w(O.Backdrop, e)
114
+ className: O(M.Backdrop, e)
115
115
  });
116
116
  }
117
- function M({ className: e, ...t }) {
118
- return /* @__PURE__ */ y(x.Viewport, {
117
+ function P({ className: e, ...t }) {
118
+ return /* @__PURE__ */ x(C.Viewport, {
119
119
  ...t,
120
- className: w(O.Viewport, e)
120
+ className: O(M.Viewport, e)
121
121
  });
122
122
  }
123
- function N({ size: e = "sm", fullScreenOnMobile: t, className: n, ...r }) {
124
- return /* @__PURE__ */ y(x.Popup, {
123
+ function F({ size: e = "sm", fullScreenOnMobile: t, className: n, ...r }) {
124
+ return /* @__PURE__ */ x(C.Popup, {
125
125
  ...r,
126
126
  "data-size": e,
127
127
  "data-full-screen-on-mobile": t || void 0,
128
- className: w(O.Popup, n)
128
+ className: O(M.Popup, n)
129
129
  });
130
130
  }
131
- function P({ className: e, ...t }) {
132
- return /* @__PURE__ */ y("div", {
131
+ function I({ className: e, ...t }) {
132
+ return /* @__PURE__ */ x("div", {
133
133
  ...t,
134
- className: [O.Header, e].filter(Boolean).join(" ")
134
+ className: [M.Header, e].filter(Boolean).join(" ")
135
135
  });
136
136
  }
137
- function F({ className: e, ...t }) {
138
- return /* @__PURE__ */ y(x.Title, {
137
+ function L({ className: e, ...t }) {
138
+ return /* @__PURE__ */ x(C.Title, {
139
139
  ...t,
140
- className: w(O.Title, e)
140
+ className: O(M.Title, e)
141
141
  });
142
142
  }
143
- function I({ className: e, ...t }) {
144
- return /* @__PURE__ */ y(x.Description, {
143
+ function R({ className: e, ...t }) {
144
+ return /* @__PURE__ */ x(C.Description, {
145
145
  ...t,
146
- className: w(O.Description, e)
146
+ className: O(M.Description, e)
147
147
  });
148
148
  }
149
- function L({ className: e, ...t }) {
150
- return /* @__PURE__ */ y("div", {
149
+ function z({ className: e, ...t }) {
150
+ return /* @__PURE__ */ x("div", {
151
151
  ...t,
152
- className: [O.Content, e].filter(Boolean).join(" ")
152
+ className: [M.Content, e].filter(Boolean).join(" ")
153
153
  });
154
154
  }
155
- function R({ className: e, ...t }) {
156
- return /* @__PURE__ */ y("div", {
155
+ function B({ className: e, ...t }) {
156
+ return /* @__PURE__ */ x("div", {
157
157
  ...t,
158
- className: [O.Footer, e].filter(Boolean).join(" ")
158
+ className: [M.Footer, e].filter(Boolean).join(" ")
159
159
  });
160
160
  }
161
- x.Close;
162
- function z({ label: e, className: t, ...n }) {
161
+ C.Close;
162
+ function V({ label: e, className: t, ...n }) {
163
163
  let r = ce();
164
- return /* @__PURE__ */ y(x.Close, {
164
+ return /* @__PURE__ */ x(C.Close, {
165
165
  ...n,
166
166
  "aria-label": e ?? r.close,
167
- className: w(O.CloseButton, t),
168
- children: /* @__PURE__ */ y(te, {
167
+ className: O(M.CloseButton, t),
168
+ children: /* @__PURE__ */ x(T, {
169
169
  size: 20,
170
170
  "aria-hidden": !0
171
171
  })
172
172
  });
173
173
  }
174
- var B = {
174
+ var H = {
175
175
  Switch: "_Switch_9c9ji_7",
176
176
  Thumb: "_Thumb_9c9ji_36"
177
177
  };
178
178
  //#endregion
179
179
  //#region src/components/form/switch/switch.tsx
180
- function V({ className: e, ...t }) {
181
- return /* @__PURE__ */ y(S.Root, {
180
+ function U({ className: e, ...t }) {
181
+ return /* @__PURE__ */ x(E.Root, {
182
182
  ...t,
183
- className: w(B.Switch, e),
184
- children: /* @__PURE__ */ y(S.Thumb, { className: B.Thumb })
183
+ className: O(H.Switch, e),
184
+ children: /* @__PURE__ */ x(E.Thumb, { className: H.Thumb })
185
185
  });
186
186
  }
187
- var H = {
187
+ var W = {
188
188
  Root: "_Root_oibl2_13",
189
189
  Item: "_Item_oibl2_10",
190
190
  Header: "_Header_oibl2_10",
@@ -196,46 +196,46 @@ var H = {
196
196
  };
197
197
  //#endregion
198
198
  //#region src/components/surfaces/accordion/accordion.tsx
199
- function U({ variant: e = "outline", iconPosition: t = "end", className: n, ...r }) {
200
- return /* @__PURE__ */ y(C.Root, {
199
+ function de({ variant: e = "outline", iconPosition: t = "end", className: n, ...r }) {
200
+ return /* @__PURE__ */ x(D.Root, {
201
201
  ...r,
202
202
  "data-variant": e,
203
203
  "data-icon-position": t,
204
- className: w(H.Root, n)
204
+ className: O(W.Root, n)
205
205
  });
206
206
  }
207
- function W({ className: e, ...t }) {
208
- return /* @__PURE__ */ y(C.Item, {
207
+ function fe({ className: e, ...t }) {
208
+ return /* @__PURE__ */ x(D.Item, {
209
209
  ...t,
210
- className: w(H.Item, e)
210
+ className: O(W.Item, e)
211
211
  });
212
212
  }
213
- function le({ className: e, ...t }) {
214
- return /* @__PURE__ */ y(C.Header, {
213
+ function pe({ className: e, ...t }) {
214
+ return /* @__PURE__ */ x(D.Header, {
215
215
  ...t,
216
- className: w(H.Header, e)
216
+ className: O(W.Header, e)
217
217
  });
218
218
  }
219
- function ue({ children: e, className: t, ...n }) {
220
- return /* @__PURE__ */ b(C.Trigger, {
219
+ function me({ children: e, className: t, ...n }) {
220
+ return /* @__PURE__ */ S(D.Trigger, {
221
221
  ...n,
222
- className: w(H.Trigger, t),
223
- children: [/* @__PURE__ */ y("span", {
224
- className: H.Label,
222
+ className: O(W.Trigger, t),
223
+ children: [/* @__PURE__ */ x("span", {
224
+ className: W.Label,
225
225
  children: e
226
- }), /* @__PURE__ */ y(ee, {
227
- className: H.Icon,
226
+ }), /* @__PURE__ */ x(w, {
227
+ className: W.Icon,
228
228
  size: 20,
229
229
  "aria-hidden": !0
230
230
  })]
231
231
  });
232
232
  }
233
- function de({ children: e, className: t, ...n }) {
234
- return /* @__PURE__ */ y(C.Panel, {
233
+ function he({ children: e, className: t, ...n }) {
234
+ return /* @__PURE__ */ x(D.Panel, {
235
235
  ...n,
236
- className: w(H.Panel, t),
237
- children: /* @__PURE__ */ y("div", {
238
- className: H.Content,
236
+ className: O(W.Panel, t),
237
+ children: /* @__PURE__ */ x("div", {
238
+ className: W.Content,
239
239
  children: e
240
240
  })
241
241
  });
@@ -254,54 +254,54 @@ function q(e, t) {
254
254
  return null;
255
255
  }
256
256
  }
257
- function fe(e) {
257
+ function ge(e) {
258
258
  let t = e.trim();
259
259
  if (!t) return !1;
260
260
  let n = q(t);
261
261
  return n ? n.protocol === "https:" || n.protocol === "mailto:" : q(t, K)?.origin === K;
262
262
  }
263
- function pe({ href: e, resolveHref: t = (e) => e, children: n }) {
263
+ function J({ href: e, resolveHref: t = (e) => e, children: n }) {
264
264
  let r = t(e);
265
- return !r || !fe(r) ? /* @__PURE__ */ y(v, { children: n }) : /* @__PURE__ */ y("a", {
265
+ return !r || !ge(r) ? /* @__PURE__ */ x(b, { children: n }) : /* @__PURE__ */ x("a", {
266
266
  href: r.trim(),
267
267
  target: "_blank",
268
268
  rel: "noopener noreferrer",
269
269
  children: n
270
270
  });
271
271
  }
272
- function J({ node: e }) {
272
+ function Y({ node: e }) {
273
273
  let t = e.text;
274
- return e.underline && (t = /* @__PURE__ */ y("u", { children: t })), e.italic && (t = /* @__PURE__ */ y("em", { children: t })), e.bold && (t = /* @__PURE__ */ y("strong", { children: t })), /* @__PURE__ */ y(v, { children: t });
274
+ return e.underline && (t = /* @__PURE__ */ x("u", { children: t })), e.italic && (t = /* @__PURE__ */ x("em", { children: t })), e.bold && (t = /* @__PURE__ */ x("strong", { children: t })), /* @__PURE__ */ x(b, { children: t });
275
275
  }
276
- function Y({ nodes: e, resolveHref: t }) {
277
- return /* @__PURE__ */ y(v, { children: (e ?? []).map((e, n) => e.type === "text" ? /* @__PURE__ */ y(J, { node: e }, n) : e.type === "link" ? /* @__PURE__ */ y(pe, {
276
+ function X({ nodes: e, resolveHref: t }) {
277
+ return /* @__PURE__ */ x(b, { children: (e ?? []).map((e, n) => e.type === "text" ? /* @__PURE__ */ x(Y, { node: e }, n) : e.type === "link" ? /* @__PURE__ */ x(J, {
278
278
  href: e.url ?? "",
279
279
  resolveHref: t,
280
- children: (e.children ?? []).filter((e) => e.type === "text").map((e, t) => /* @__PURE__ */ y(J, { node: e }, t))
280
+ children: (e.children ?? []).filter((e) => e.type === "text").map((e, t) => /* @__PURE__ */ x(Y, { node: e }, t))
281
281
  }, n) : null) });
282
282
  }
283
- function X({ node: e, resolveHref: t }) {
283
+ function Z({ node: e, resolveHref: t }) {
284
284
  let n = e.format === "ordered" ? "ol" : "ul";
285
- return /* @__PURE__ */ y(n, { children: (e.children ?? []).map((e, n) => e.type === "list" ? /* @__PURE__ */ y("li", { children: /* @__PURE__ */ y(X, {
285
+ return /* @__PURE__ */ x(n, { children: (e.children ?? []).map((e, n) => e.type === "list" ? /* @__PURE__ */ x("li", { children: /* @__PURE__ */ x(Z, {
286
286
  node: e,
287
287
  resolveHref: t
288
- }) }, n) : e.type === "list-item" ? /* @__PURE__ */ y("li", { children: /* @__PURE__ */ y(Y, {
288
+ }) }, n) : e.type === "list-item" ? /* @__PURE__ */ x("li", { children: /* @__PURE__ */ x(X, {
289
289
  nodes: e.children,
290
290
  resolveHref: t
291
291
  }) }, n) : null) });
292
292
  }
293
- function me({ nodes: e, resolveHref: t }) {
294
- return /* @__PURE__ */ y(v, { children: e.map((e, n) => {
293
+ function _e({ nodes: e, resolveHref: t }) {
294
+ return /* @__PURE__ */ x(b, { children: e.map((e, n) => {
295
295
  switch (e.type) {
296
- case "paragraph": return /* @__PURE__ */ y("p", { children: /* @__PURE__ */ y(Y, {
296
+ case "paragraph": return /* @__PURE__ */ x("p", { children: /* @__PURE__ */ x(X, {
297
297
  nodes: e.children,
298
298
  resolveHref: t
299
299
  }) }, n);
300
- case "heading": return /* @__PURE__ */ y("p", { children: /* @__PURE__ */ y("strong", { children: /* @__PURE__ */ y(Y, {
300
+ case "heading": return /* @__PURE__ */ x("p", { children: /* @__PURE__ */ x("strong", { children: /* @__PURE__ */ x(X, {
301
301
  nodes: e.children,
302
302
  resolveHref: t
303
303
  }) }) }, n);
304
- case "list": return /* @__PURE__ */ y(X, {
304
+ case "list": return /* @__PURE__ */ x(Z, {
305
305
  node: e,
306
306
  resolveHref: t
307
307
  }, n);
@@ -311,7 +311,7 @@ function me({ nodes: e, resolveHref: t }) {
311
311
  }
312
312
  //#endregion
313
313
  //#region src/cookie-consent/consent-dialog.tsx
314
- function Z(e) {
314
+ function Q(e) {
315
315
  return {
316
316
  necessary: !0,
317
317
  preferences: e?.preferences ?? !1,
@@ -319,22 +319,22 @@ function Z(e) {
319
319
  marketing: e?.marketing ?? !1
320
320
  };
321
321
  }
322
- function he({ category: e, copy: t, checked: n, onCheckedChange: r }) {
323
- let i = f(), a = f(), { title: o, description: s } = t.categories[e];
324
- return /* @__PURE__ */ b(W, {
322
+ function ve({ category: e, copy: t, checked: n, onCheckedChange: r }) {
323
+ let i = m(), a = m(), { title: o, description: s } = t.categories[e];
324
+ return /* @__PURE__ */ S(fe, {
325
325
  value: e,
326
- children: [/* @__PURE__ */ b(le, { children: [/* @__PURE__ */ y(ue, { children: /* @__PURE__ */ y("span", {
326
+ children: [/* @__PURE__ */ S(pe, { children: [/* @__PURE__ */ x(me, { children: /* @__PURE__ */ x("span", {
327
327
  id: i,
328
328
  children: o
329
- }) }), /* @__PURE__ */ y(V, {
329
+ }) }), /* @__PURE__ */ x(U, {
330
330
  "aria-labelledby": i,
331
331
  "aria-describedby": s ? a : void 0,
332
332
  checked: n,
333
333
  disabled: e === "necessary",
334
334
  onCheckedChange: r
335
- })] }), /* @__PURE__ */ y(de, {
335
+ })] }), /* @__PURE__ */ x(he, {
336
336
  keepMounted: !0,
337
- children: s && /* @__PURE__ */ y("p", {
337
+ children: s && /* @__PURE__ */ x("p", {
338
338
  id: a,
339
339
  className: G.CategoryDescription,
340
340
  children: s
@@ -342,34 +342,34 @@ function he({ category: e, copy: t, checked: n, onCheckedChange: r }) {
342
342
  })]
343
343
  });
344
344
  }
345
- function ge({ open: e, consent: t, copy: n, resolveHref: i, onAcceptAll: a, onAcceptNecessary: o, onSave: s, onClose: c }) {
346
- let l = t !== null, [u, d] = m(() => Z(t)), [f, p] = m(e);
347
- return e !== f && (p(e), e && d(Z(t))), /* @__PURE__ */ y(k, {
345
+ function ye({ open: e, consent: t, copy: r, resolveHref: i, onAcceptAll: a, onAcceptNecessary: o, onSave: s, onClose: c }) {
346
+ let l = t !== null, [u, d] = _(() => Q(t)), [f, p] = _(e);
347
+ return e !== f && (p(e), e && d(Q(t))), /* @__PURE__ */ x(le, {
348
348
  open: e,
349
349
  onOpenChange: (e) => {
350
350
  !e && l && c();
351
351
  },
352
352
  disablePointerDismissal: !l,
353
- children: /* @__PURE__ */ b(A, { children: [/* @__PURE__ */ y(j, {}), /* @__PURE__ */ y(M, { children: /* @__PURE__ */ b(N, {
353
+ children: /* @__PURE__ */ S(ue, { children: [/* @__PURE__ */ x(N, {}), /* @__PURE__ */ x(P, { children: /* @__PURE__ */ S(F, {
354
354
  fullScreenOnMobile: !0,
355
355
  size: "md",
356
356
  children: [
357
- /* @__PURE__ */ b(P, { children: [/* @__PURE__ */ y(F, { children: n.modalTitle }), l && /* @__PURE__ */ y(z, { label: n.closeIconLabel })] }),
358
- /* @__PURE__ */ b(L, { children: [/* @__PURE__ */ y(I, {
359
- render: /* @__PURE__ */ y("div", {}),
357
+ /* @__PURE__ */ S(I, { children: [/* @__PURE__ */ x(L, { children: r.modalTitle }), l && /* @__PURE__ */ x(V, { label: r.closeIconLabel })] }),
358
+ /* @__PURE__ */ S(z, { children: [/* @__PURE__ */ x(R, {
359
+ render: /* @__PURE__ */ x("div", {}),
360
360
  className: G.Intro,
361
- children: /* @__PURE__ */ y(me, {
362
- nodes: n.intro,
361
+ children: /* @__PURE__ */ x(_e, {
362
+ nodes: r.intro,
363
363
  resolveHref: i
364
364
  })
365
- }), /* @__PURE__ */ y(U, {
365
+ }), /* @__PURE__ */ x(de, {
366
366
  variant: "solid",
367
367
  iconPosition: "start",
368
368
  multiple: !0,
369
369
  className: G.Categories,
370
- children: r.map((e) => /* @__PURE__ */ y(he, {
370
+ children: n.map((e) => /* @__PURE__ */ x(ve, {
371
371
  category: e,
372
- copy: n,
372
+ copy: r,
373
373
  checked: u[e],
374
374
  onCheckedChange: (t) => d((n) => ({
375
375
  ...n,
@@ -377,28 +377,28 @@ function ge({ open: e, consent: t, copy: n, resolveHref: i, onAcceptAll: a, onAc
377
377
  }))
378
378
  }, e))
379
379
  })] }),
380
- /* @__PURE__ */ b(R, {
380
+ /* @__PURE__ */ S(B, {
381
381
  className: G.Actions,
382
382
  children: [
383
- /* @__PURE__ */ y(D, {
383
+ /* @__PURE__ */ x(j, {
384
384
  onClick: a,
385
385
  color: "secondary",
386
386
  size: "sm",
387
- children: n.btnAcceptAll
387
+ children: r.btnAcceptAll
388
388
  }),
389
- /* @__PURE__ */ y(D, {
389
+ /* @__PURE__ */ x(j, {
390
390
  onClick: o,
391
391
  color: "secondary",
392
392
  size: "sm",
393
- children: n.btnAcceptNecessary
393
+ children: r.btnAcceptNecessary
394
394
  }),
395
- /* @__PURE__ */ y(D, {
395
+ /* @__PURE__ */ x(j, {
396
396
  variant: "outline",
397
397
  color: "secondary",
398
398
  size: "sm",
399
399
  className: G.Save,
400
- onClick: () => s(r.filter((e) => u[e])),
401
- children: n.btnSaveSettings
400
+ onClick: () => s(n.filter((e) => u[e])),
401
+ children: r.btnSaveSettings
402
402
  })
403
403
  ]
404
404
  })
@@ -408,36 +408,53 @@ function ge({ open: e, consent: t, copy: n, resolveHref: i, onAcceptAll: a, onAc
408
408
  }
409
409
  //#endregion
410
410
  //#region src/cookie-consent/react.tsx
411
- var Q = c(null);
412
- function $({ market: r, copy: c, resolveHref: l, children: u }) {
413
- let { consent: f, settingsOpen: m, ready: g } = h(t, n, a);
414
- d(() => {
415
- e({ market: r });
411
+ var be = typeof document > "u" ? p : h, $ = u(null);
412
+ function xe({ market: n, copy: u, resolveHref: d, onConsentChange: f, autoOpen: m = !0, children: h }) {
413
+ let { consent: _, settingsOpen: v, ready: y } = te(l, r, o), b = g(f);
414
+ be(() => {
415
+ b.current = f;
416
+ });
417
+ let C = g(null);
418
+ p(() => {
419
+ let e = () => {
420
+ let { consent: e } = r();
421
+ if (!(e === null || t(e, C.current))) {
422
+ C.current = e;
423
+ try {
424
+ b.current?.(e);
425
+ } catch (e) {
426
+ reportError(e);
427
+ }
428
+ }
429
+ };
430
+ return e(), l(e);
431
+ }, []), p(() => {
432
+ e({ market: n });
416
433
  }, []);
417
- let _ = p(() => ({
418
- consent: f,
419
- openSettings: i
420
- }), [f]);
421
- return /* @__PURE__ */ b(Q.Provider, {
422
- value: _,
423
- children: [u, g && /* @__PURE__ */ y(ge, {
424
- open: m,
425
- consent: f,
426
- copy: c,
427
- resolveHref: l,
428
- onAcceptAll: () => o("all"),
429
- onAcceptNecessary: () => o([]),
430
- onSave: o,
431
- onClose: s
434
+ let w = ee(() => ({
435
+ consent: _,
436
+ openSettings: s
437
+ }), [_]), T = y && (v || _ === null && m && !a(navigator.userAgent));
438
+ return /* @__PURE__ */ S($.Provider, {
439
+ value: w,
440
+ children: [h, y && /* @__PURE__ */ x(ye, {
441
+ open: T,
442
+ consent: _,
443
+ copy: u,
444
+ resolveHref: d,
445
+ onAcceptAll: () => i("all"),
446
+ onAcceptNecessary: () => i([]),
447
+ onSave: i,
448
+ onClose: c
432
449
  })]
433
450
  });
434
451
  }
435
- function _e() {
436
- let e = u(Q);
452
+ function Se() {
453
+ let e = f($);
437
454
  if (!e) throw Error("useCookieConsent must be used inside a CookieConsentProvider.");
438
455
  return e;
439
456
  }
440
457
  //#endregion
441
- export { $ as CookieConsentProvider, _e as useCookieConsent };
458
+ export { xe as CookieConsentProvider, Se as useCookieConsent };
442
459
 
443
460
  //# sourceMappingURL=cookie-consent-react.mjs.map