boreal-ui 0.0.891 → 0.0.892

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 (41) hide show
  1. package/dist/core/{Footer-BRldxyPK.cjs → Footer-CmpLvoZb.cjs} +1 -1
  2. package/dist/core/{Footer-DPspjwxk.js → Footer-CoFPqecX.js} +1 -1
  3. package/dist/core/Footer.cjs.js +1 -1
  4. package/dist/core/Footer.js +1 -1
  5. package/dist/core/RadioButton.cjs.js +1 -1
  6. package/dist/core/RadioButton.js +1 -1
  7. package/dist/core/{RadioGroup-BE7ap9Q-.cjs → RadioGroup-Bdjdyec3.cjs} +1 -1
  8. package/dist/core/{RadioGroup-Q10i7UkK.js → RadioGroup-D1nlf4NZ.js} +0 -1
  9. package/dist/core/RadioGroup.cjs.js +1 -1
  10. package/dist/core/RadioGroup.js +1 -1
  11. package/dist/core/ThemeContext-D1VVOPG1.cjs +1 -0
  12. package/dist/{next/ThemeContext-QLpHalQp.js → core/ThemeContext-DRXOWRyX.js} +155 -152
  13. package/dist/core/ThemeProvider.cjs.js +1 -1
  14. package/dist/core/ThemeProvider.js +1 -1
  15. package/dist/core/{ThemeSelect-BhvN814l.cjs → ThemeSelect-CPpf-wbN.cjs} +1 -1
  16. package/dist/core/{ThemeSelect-BL5YdtZJ.js → ThemeSelect-DxmyeZm_.js} +1 -1
  17. package/dist/core/ThemeSelect.cjs.js +1 -1
  18. package/dist/core/ThemeSelect.js +1 -1
  19. package/dist/core/index.cjs.js +3 -3
  20. package/dist/core/index.js +29 -11
  21. package/dist/generated-docs/Footer.props.js +9 -0
  22. package/dist/generated-docs/ThemeSelect.props.js +9 -0
  23. package/dist/next/{Footer-BUB9lMtL.js → Footer-D78Lzvjg.js} +1 -1
  24. package/dist/next/Footer.js +1 -1
  25. package/dist/next/{NextThemeProvider-B9YjrpO8.js → NextThemeProvider-NpALBYoC.js} +1 -1
  26. package/dist/next/{RadioButton-BbJ50szC.js → RadioButton-BHoW7U55.js} +1 -1
  27. package/dist/next/RadioButton.js +2 -2
  28. package/dist/next/{RadioGroup-BEFTo4Q5.js → RadioGroup-DEFfETJs.js} +0 -1
  29. package/dist/next/RadioGroup.js +1 -1
  30. package/dist/{core/ThemeContext-CuyHtN7b.js → next/ThemeContext-19HbcfZg.js} +155 -152
  31. package/dist/next/ThemeProvider.js +2 -2
  32. package/dist/next/{ThemeSelect-BCB022pq.js → ThemeSelect-BdFqSfT_.js} +1 -1
  33. package/dist/next/ThemeSelect.js +1 -1
  34. package/dist/next/index.js +31 -13
  35. package/dist/tsconfig.build.tsbuildinfo +1 -1
  36. package/dist/types/components/RadioButton/RadioGroupBase.d.ts.map +1 -1
  37. package/dist/types/context/ThemeContext.d.ts.map +1 -1
  38. package/dist/types/generated-docs/Footer.props.d.ts.map +1 -1
  39. package/dist/types/generated-docs/ThemeSelect.props.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/core/ThemeContext-FD4ODqF4.cjs +0 -1
@@ -1,9 +1,9 @@
1
1
  import { jsxs as J, jsx as j } from "react/jsx-runtime";
2
- import { useMemo as w, useState as R, useEffect as T, useInsertionEffect as V, createContext as z } from "react";
3
- import { c as A } from "./boreal-style-config-rYvfCHLY.js";
4
- import { defaultColorSchemes as P } from "./colorSchemes.js";
5
- const p = "boreal:selectedSchemeName", M = "boreal:theme-change", g = 4.5, N = 3;
6
- function F(t, e = []) {
2
+ import { createContext as V, useMemo as k, useState as z, useRef as P, useEffect as I, useInsertionEffect as F } from "react";
3
+ import { c as O } from "./boreal-style-config-rYvfCHLY.js";
4
+ import { defaultColorSchemes as B } from "./colorSchemes.js";
5
+ const S = "boreal:selectedSchemeName", E = "boreal:theme-change", w = 4.5, L = 3;
6
+ function D(t, e = []) {
7
7
  const r = [...t];
8
8
  for (const o of e) {
9
9
  const n = r.findIndex((a) => a.name === o.name);
@@ -11,41 +11,41 @@ function F(t, e = []) {
11
11
  }
12
12
  return r;
13
13
  }
14
- function b(t, e) {
14
+ function C(t, e) {
15
15
  return e ? t.findIndex((r) => r.name === e) : -1;
16
16
  }
17
- function O({
17
+ function R({
18
18
  customSchemes: t = [],
19
19
  useOnlyCustomSchemes: e = !1
20
20
  }) {
21
- return e ? [...t] : F([...P], t);
21
+ return e ? [...t] : D([...B], t);
22
22
  }
23
- function $(t, {
23
+ function q(t, {
24
24
  initialSchemeName: e,
25
25
  savedSchemeName: r
26
26
  }) {
27
- const o = b(t, e), n = b(t, r), a = b(t, A());
27
+ const o = C(t, e), n = C(t, r), a = C(t, O());
28
28
  return o !== -1 ? o : n !== -1 ? n : a !== -1 ? a : 0;
29
29
  }
30
- function L(t) {
30
+ function T(t) {
31
31
  if (!t) return null;
32
32
  try {
33
- return t.getItem(p);
33
+ return t.getItem(S);
34
34
  } catch {
35
35
  return console.error("Failed to load saved theme name"), null;
36
36
  }
37
37
  }
38
- function B(t, e) {
38
+ function G(t, e) {
39
39
  if (!t) return !1;
40
40
  try {
41
- return t.getItem(p) === e ? !1 : (t.setItem(p, e), !0);
41
+ return t.getItem(S) === e ? !1 : (t.setItem(S, e), !0);
42
42
  } catch {
43
43
  return console.error("Failed to save theme name"), !1;
44
44
  }
45
45
  }
46
- function D(t, e = typeof window > "u" ? void 0 : window) {
46
+ function K(t, e = typeof window > "u" ? void 0 : window) {
47
47
  e && e.dispatchEvent(
48
- new CustomEvent(M, {
48
+ new CustomEvent(E, {
49
49
  detail: { schemeName: t }
50
50
  })
51
51
  );
@@ -54,263 +54,266 @@ function H(t) {
54
54
  const e = t.trim(), r = /^#([\da-f])([\da-f])([\da-f])$/i.exec(e);
55
55
  return r ? `#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`.toLowerCase() : /^#[\da-f]{6}([\da-f]{2})?$/i.exec(e) ? e.slice(0, 7).toLowerCase() : null;
56
56
  }
57
- function k(t) {
58
- const e = H(t) ?? "#000000", r = parseInt(e.slice(1, 3), 16) / 255, o = parseInt(e.slice(3, 5), 16) / 255, n = parseInt(e.slice(5, 7), 16) / 255, a = Math.max(r, o, n), i = Math.min(r, o, n);
59
- let c = 0, l = 0;
60
- const u = (a + i) / 2;
61
- if (a !== i) {
62
- const s = a - i;
63
- switch (l = u > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
57
+ function N(t) {
58
+ const e = H(t) ?? "#000000", r = parseInt(e.slice(1, 3), 16) / 255, o = parseInt(e.slice(3, 5), 16) / 255, n = parseInt(e.slice(5, 7), 16) / 255, a = Math.max(r, o, n), s = Math.min(r, o, n);
59
+ let c = 0, i = 0;
60
+ const f = (a + s) / 2;
61
+ if (a !== s) {
62
+ const u = a - s;
63
+ switch (i = f > 0.5 ? u / (2 - a - s) : u / (a + s), a) {
64
64
  case r:
65
- c = (o - n) / s + (o < n ? 6 : 0);
65
+ c = (o - n) / u + (o < n ? 6 : 0);
66
66
  break;
67
67
  case o:
68
- c = (n - r) / s + 2;
68
+ c = (n - r) / u + 2;
69
69
  break;
70
70
  case n:
71
- c = (r - o) / s + 4;
71
+ c = (r - o) / u + 4;
72
72
  break;
73
73
  }
74
74
  c /= 6;
75
75
  }
76
76
  return {
77
77
  h: Math.round(c * 360),
78
- s: Math.round(l * 100),
79
- l: Math.round(u * 100)
78
+ s: Math.round(i * 100),
79
+ l: Math.round(f * 100)
80
80
  };
81
81
  }
82
- function I(t, e, r) {
82
+ function $(t, e, r) {
83
83
  e /= 100, r /= 100;
84
- const o = (i) => (i + t / 30) % 12, n = e * Math.min(r, 1 - r), a = (i) => Math.round(
85
- 255 * (r - n * Math.max(-1, Math.min(o(i) - 3, Math.min(9 - o(i), 1))))
84
+ const o = (s) => (s + t / 30) % 12, n = e * Math.min(r, 1 - r), a = (s) => Math.round(
85
+ 255 * (r - n * Math.max(-1, Math.min(o(s) - 3, Math.min(9 - o(s), 1))))
86
86
  );
87
- return `#${[a(0), a(8), a(4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
87
+ return `#${[a(0), a(8), a(4)].map((s) => s.toString(16).padStart(2, "0")).join("")}`;
88
88
  }
89
- function f(t, e) {
90
- const { h: r, s: o, l: n } = k(t);
91
- return I(r, o, Math.min(100, Math.max(0, n + e)));
89
+ function d(t, e) {
90
+ const { h: r, s: o, l: n } = N(t);
91
+ return $(r, o, Math.min(100, Math.max(0, n + e)));
92
92
  }
93
- function q(t) {
93
+ function _(t) {
94
94
  const e = H(t) ?? "#000000", r = [1, 3, 5].map((o) => {
95
95
  const n = parseInt(e.slice(o, o + 2), 16) / 255;
96
96
  return n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4);
97
97
  });
98
98
  return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
99
99
  }
100
- function h(t, e) {
101
- const r = q(t), o = q(e), n = Math.max(r, o), a = Math.min(r, o);
100
+ function v(t, e) {
101
+ const r = _(t), o = _(e), n = Math.max(r, o), a = Math.min(r, o);
102
102
  return (n + 0.05) / (a + 0.05);
103
103
  }
104
- function v(t, e, r = g) {
105
- if (e && h(t, e) >= r)
104
+ function x(t, e, r = w) {
105
+ if (e && v(t, e) >= r)
106
106
  return e;
107
- const o = h(t, "#000000"), n = h(t, "#ffffff");
107
+ const o = v(t, "#000000"), n = v(t, "#ffffff");
108
108
  return o >= n ? "#000000" : "#ffffff";
109
109
  }
110
- function G(t, e, r) {
111
- const o = f(e, r);
112
- return h(t, o) >= g ? o : e;
110
+ function U(t, e, r) {
111
+ const o = d(e, r);
112
+ return v(t, o) >= w ? o : e;
113
113
  }
114
- function _(t, e) {
114
+ function A(t, e) {
115
115
  const r = e === "#000000" ? 1 : -1;
116
116
  for (let o = 30; o >= 0; o -= 5) {
117
- const n = f(e, o * r);
118
- if (h(t, n) >= g)
117
+ const n = d(e, o * r);
118
+ if (v(t, n) >= w)
119
119
  return n;
120
120
  }
121
121
  return e;
122
122
  }
123
- function m(t, e, r) {
124
- const o = f(t, r);
125
- if (h(o, e) >= g)
123
+ function y(t, e, r) {
124
+ const o = d(t, r);
125
+ if (v(o, e) >= w)
126
126
  return o;
127
- const { h: n, s: a, l: i } = k(t), c = e === "#ffffff";
128
- for (let l = 4; l <= 48; l += 4) {
129
- const u = c ? Math.max(0, i - l) : Math.min(100, i + l), s = I(n, a, u);
130
- if (h(s, e) >= g)
131
- return s;
127
+ const { h: n, s: a, l: s } = N(t), c = e === "#ffffff";
128
+ for (let i = 4; i <= 48; i += 4) {
129
+ const f = c ? Math.max(0, s - i) : Math.min(100, s + i), u = $(n, a, f);
130
+ if (v(u, e) >= w)
131
+ return u;
132
132
  }
133
133
  return t;
134
134
  }
135
- function S(t, e = 14, r = 14) {
136
- const { h: o, s: n, l: a } = k(t), i = a >= 50 ? Math.max(0, a - r) : Math.min(100, a + e), c = n > 8 ? Math.max(0, n - 8) : n, l = I(o, c, i);
137
- return h(t, l) >= N ? l : v(t, void 0, N);
135
+ function M(t, e = 14, r = 14) {
136
+ const { h: o, s: n, l: a } = N(t), s = a >= 50 ? Math.max(0, a - r) : Math.min(100, a + e), c = n > 8 ? Math.max(0, n - 8) : n, i = $(o, c, s);
137
+ return v(t, i) >= L ? i : x(t, void 0, L);
138
138
  }
139
- function K(t) {
139
+ function W(t) {
140
140
  const {
141
141
  primaryColor: e,
142
142
  secondaryColor: r,
143
143
  tertiaryColor: o,
144
144
  quaternaryColor: n,
145
145
  backgroundColor: a,
146
- forceTextColor: i
147
- } = t, c = v(a, i), l = v(e, i), u = v(r), s = v(o), d = v(n);
146
+ forceTextColor: s
147
+ } = t, c = x(a, s), i = x(e, s), f = x(r), u = x(o), l = x(n);
148
148
  return {
149
149
  "--primary-color": e,
150
- "--primary-color-light": f(e, 10),
151
- "--primary-color-hover": m(
150
+ "--primary-color-light": d(e, 10),
151
+ "--primary-color-hover": y(
152
152
  e,
153
- l,
153
+ i,
154
154
  -10
155
155
  ),
156
- "--text-color-primary": l,
156
+ "--text-color-primary": i,
157
157
  "--text-color-primary-contrast": c,
158
158
  "--text-color": c,
159
- "--text-color-light": _(a, c),
160
- "--text-color-lighter": _(
159
+ "--text-color-light": A(a, c),
160
+ "--text-color-lighter": A(
161
161
  a,
162
162
  c
163
163
  ),
164
164
  "--secondary-color": r,
165
- "--secondary-color-light": f(r, 10),
166
- "--secondary-color-hover": m(
165
+ "--secondary-color-light": d(r, 10),
166
+ "--secondary-color-hover": y(
167
167
  r,
168
- u,
168
+ f,
169
169
  -10
170
170
  ),
171
- "--text-color-secondary": u,
171
+ "--text-color-secondary": f,
172
172
  "--tertiary-color": o,
173
- "--tertiary-color-light": f(o, 10),
174
- "--tertiary-color-hover": m(
173
+ "--tertiary-color-light": d(o, 10),
174
+ "--tertiary-color-hover": y(
175
175
  o,
176
- s,
176
+ u,
177
177
  -10
178
178
  ),
179
- "--text-color-tertiary": s,
179
+ "--text-color-tertiary": u,
180
180
  "--quaternary-color": n,
181
- "--quaternary-color-light": f(n, 10),
182
- "--quaternary-color-hover": m(
181
+ "--quaternary-color-light": d(n, 10),
182
+ "--quaternary-color-hover": y(
183
183
  n,
184
- d,
184
+ l,
185
185
  -10
186
186
  ),
187
- "--text-color-quaternary": d,
187
+ "--text-color-quaternary": l,
188
188
  "--background-color": a,
189
- "--background-color-dark": f(a, -10),
190
- "--background-color-darker": f(a, -25),
191
- "--background-color-light": f(a, 10),
192
- "--background-color-lighter": f(a, 20),
189
+ "--background-color-dark": d(a, -10),
190
+ "--background-color-darker": d(a, -25),
191
+ "--background-color-light": d(a, 10),
192
+ "--background-color-lighter": d(a, 20),
193
193
  "--link-color": c,
194
- "--link-hover-color": G(
194
+ "--link-hover-color": U(
195
195
  a,
196
196
  c,
197
197
  c === "#ffffff" ? -20 : 20
198
198
  ),
199
- "--link-hover-color-primary": m(
199
+ "--link-hover-color-primary": y(
200
200
  e,
201
- l,
201
+ i,
202
202
  -10
203
203
  ),
204
- "--link-hover-color-secondary": m(
204
+ "--link-hover-color-secondary": y(
205
205
  r,
206
- u,
206
+ f,
207
207
  -10
208
208
  ),
209
- "--link-hover-color-tertiary": m(
209
+ "--link-hover-color-tertiary": y(
210
210
  o,
211
- s,
211
+ u,
212
212
  -10
213
213
  ),
214
- "--link-hover-color-quaternary": m(
214
+ "--link-hover-color-quaternary": y(
215
215
  n,
216
- d,
216
+ l,
217
217
  -10
218
218
  ),
219
219
  "--focus-outline-color": c,
220
- "--divider-color": S(a),
221
- "--border-color": S(a),
222
- "--border-color-subtle": S(a, 10, 10),
223
- "--border-color-strong": S(a, 20, 20)
220
+ "--divider-color": M(a),
221
+ "--border-color": M(a),
222
+ "--border-color-subtle": M(a, 10, 10),
223
+ "--border-color-strong": M(a, 20, 20)
224
224
  };
225
225
  }
226
- function U(t, e) {
226
+ function X(t, e) {
227
227
  for (const [r, o] of Object.entries(e))
228
228
  t.setProperty(r, o);
229
229
  }
230
- function W(t, e = document) {
231
- U(
230
+ function Y(t, e = document) {
231
+ X(
232
232
  e.documentElement.style,
233
- K(t)
233
+ W(t)
234
234
  ), e.documentElement.dataset.borealTheme = t.name;
235
235
  }
236
- function X({
236
+ function Q({
237
237
  customSchemes: t = [],
238
238
  initialSchemeName: e,
239
239
  useOnlyCustomSchemes: r = !1
240
240
  } = {}) {
241
- const o = O({ customSchemes: t, useOnlyCustomSchemes: r }), n = A();
242
- return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(p)};var initial=${JSON.stringify(e ?? null)};var fallback=${JSON.stringify(n)};var saved=null;try{saved=localStorage.getItem(k)}catch(e){}var name=initial||saved||fallback;var scheme=s.find(function(x){return x.name===name})||s.find(function(x){return x.name===fallback})||s[0];if(!scheme)return;var d=document.documentElement.style;var hex=function(v){v=String(v||"").trim();var m=/^#([\\da-f])([\\da-f])([\\da-f])$/i.exec(v);if(m)return("#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3]).toLowerCase();return /^#[\\da-f]{6}([\\da-f]{2})?$/i.test(v)?v.slice(0,7).toLowerCase():"#000000"};var lum=function(v){v=hex(v);var r=[1,3,5].map(function(i){var c=parseInt(v.slice(i,i+2),16)/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]};var contrast=function(a,b){var x=lum(a),y=lum(b),l=Math.max(x,y),q=Math.min(x,y);return(l+.05)/(q+.05)};var text=function(bg,preferred,min){min=min||4.5;if(preferred&&contrast(bg,preferred)>=min)return preferred;return contrast(bg,"#000000")>=contrast(bg,"#ffffff")?"#000000":"#ffffff"};var set=function(n,v){d.setProperty(n,v)};var page=text(scheme.backgroundColor,scheme.forceTextColor);set("--primary-color",scheme.primaryColor);set("--secondary-color",scheme.secondaryColor);set("--tertiary-color",scheme.tertiaryColor);set("--quaternary-color",scheme.quaternaryColor);set("--background-color",scheme.backgroundColor);set("--text-color",page);set("--text-color-primary",text(scheme.primaryColor,scheme.forceTextColor));set("--text-color-primary-contrast",page);set("--text-color-secondary",text(scheme.secondaryColor));set("--text-color-tertiary",text(scheme.tertiaryColor));set("--text-color-quaternary",text(scheme.quaternaryColor));set("--link-color",page);set("--focus-outline-color",page);document.documentElement.dataset.borealTheme=scheme.name}catch(e){}})();`;
241
+ const o = R({ customSchemes: t, useOnlyCustomSchemes: r }), n = O();
242
+ return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(S)};var initial=${JSON.stringify(e ?? null)};var fallback=${JSON.stringify(n)};var saved=null;try{saved=localStorage.getItem(k)}catch(e){}var name=initial||saved||fallback;var scheme=s.find(function(x){return x.name===name})||s.find(function(x){return x.name===fallback})||s[0];if(!scheme)return;var d=document.documentElement.style;var hex=function(v){v=String(v||"").trim();var m=/^#([\\da-f])([\\da-f])([\\da-f])$/i.exec(v);if(m)return("#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3]).toLowerCase();return /^#[\\da-f]{6}([\\da-f]{2})?$/i.test(v)?v.slice(0,7).toLowerCase():"#000000"};var lum=function(v){v=hex(v);var r=[1,3,5].map(function(i){var c=parseInt(v.slice(i,i+2),16)/255;return c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]};var contrast=function(a,b){var x=lum(a),y=lum(b),l=Math.max(x,y),q=Math.min(x,y);return(l+.05)/(q+.05)};var text=function(bg,preferred,min){min=min||4.5;if(preferred&&contrast(bg,preferred)>=min)return preferred;return contrast(bg,"#000000")>=contrast(bg,"#ffffff")?"#000000":"#ffffff"};var set=function(n,v){d.setProperty(n,v)};var page=text(scheme.backgroundColor,scheme.forceTextColor);set("--primary-color",scheme.primaryColor);set("--secondary-color",scheme.secondaryColor);set("--tertiary-color",scheme.tertiaryColor);set("--quaternary-color",scheme.quaternaryColor);set("--background-color",scheme.backgroundColor);set("--text-color",page);set("--text-color-primary",text(scheme.primaryColor,scheme.forceTextColor));set("--text-color-primary-contrast",page);set("--text-color-secondary",text(scheme.secondaryColor));set("--text-color-tertiary",text(scheme.tertiaryColor));set("--text-color-quaternary",text(scheme.quaternaryColor));set("--link-color",page);set("--focus-outline-color",page);document.documentElement.dataset.borealTheme=scheme.name}catch(e){}})();`;
243
243
  }
244
- const Y = z(
244
+ const Z = V(
245
245
  void 0
246
- ), re = ({
246
+ ), ne = ({
247
247
  children: t,
248
248
  customSchemes: e = [],
249
249
  enableThemeScript: r = !0,
250
250
  initialSchemeName: o,
251
251
  useOnlyCustomSchemes: n = !1
252
252
  }) => {
253
- const a = w(
253
+ const a = k(
254
254
  () => JSON.stringify(e ?? []),
255
255
  [e]
256
- ), i = w(() => {
256
+ ), s = k(() => {
257
257
  try {
258
- const s = JSON.parse(a);
259
- if (Array.isArray(s))
260
- return s;
258
+ const l = JSON.parse(a);
259
+ if (Array.isArray(l))
260
+ return l;
261
261
  } catch {
262
262
  console.error("Failed to parse custom schemes");
263
263
  }
264
264
  return [];
265
- }, [a]), c = w(
266
- () => O({
267
- customSchemes: i,
265
+ }, [a]), c = k(
266
+ () => R({
267
+ customSchemes: s,
268
268
  useOnlyCustomSchemes: n
269
269
  }),
270
- [i, n]
271
- ), [l, u] = R(
272
- () => $(c, {
270
+ [s, n]
271
+ ), [i, f] = z(
272
+ () => q(c, {
273
273
  initialSchemeName: o,
274
- savedSchemeName: typeof window > "u" ? null : L(window.localStorage)
274
+ savedSchemeName: typeof window > "u" ? null : T(window.localStorage)
275
275
  })
276
- );
277
- return T(() => {
278
- const s = $(c, {
276
+ ), u = P(!1);
277
+ return I(() => {
278
+ const l = q(c, {
279
279
  initialSchemeName: o,
280
- savedSchemeName: typeof window > "u" ? null : L(window.localStorage)
280
+ savedSchemeName: typeof window > "u" ? null : T(window.localStorage)
281
281
  });
282
- u((d) => o ? s : c[d] ? d : s);
283
- }, [c, o]), V(() => {
284
- const s = c[l] ?? c[0];
285
- !s || typeof document > "u" || W(s, document);
286
- }, [l, c]), T(() => {
287
- const s = c[l] ?? c[0];
288
- s && (B(
289
- typeof window > "u" ? void 0 : window.localStorage,
290
- s.name
291
- ), D(s.name));
292
- }, [l, c]), T(() => {
282
+ f((h) => o ? l : c[h] ? h : l);
283
+ }, [c, o]), F(() => {
284
+ const l = c[i] ?? c[0];
285
+ !l || typeof document > "u" || Y(l, document);
286
+ }, [i, c]), I(() => {
293
287
  if (typeof window > "u") return;
294
- const s = (y) => {
295
- const C = b(c, y);
296
- C !== -1 && u(
297
- (x) => x === C ? x : C
288
+ const l = (m) => {
289
+ const g = C(c, m);
290
+ g !== -1 && f(
291
+ (p) => p === g ? p : g
298
292
  );
299
- }, d = (y) => {
300
- var x;
301
- s((x = y.detail) == null ? void 0 : x.schemeName);
302
- }, E = (y) => {
303
- y.key === p && s(y.newValue);
293
+ }, h = (m) => {
294
+ var p;
295
+ l((p = m.detail) == null ? void 0 : p.schemeName);
296
+ }, b = (m) => {
297
+ m.key === S && l(m.newValue);
304
298
  };
305
- return window.addEventListener(M, d), window.addEventListener("storage", E), () => {
306
- window.removeEventListener(M, d), window.removeEventListener("storage", E);
299
+ return window.addEventListener(E, h), window.addEventListener("storage", b), l(T(window.localStorage)), () => {
300
+ window.removeEventListener(E, h), window.removeEventListener("storage", b);
307
301
  };
308
- }, [c]), /* @__PURE__ */ J(
309
- Y.Provider,
302
+ }, [c]), I(() => {
303
+ const l = c[i] ?? c[0];
304
+ if (!l) return;
305
+ const h = typeof window > "u" ? void 0 : window.localStorage, b = T(h), m = C(c, b);
306
+ if (!u.current && !o && m !== -1 && m !== i) {
307
+ u.current = !0, f(m);
308
+ return;
309
+ }
310
+ u.current = !0, G(h, l.name) && K(l.name);
311
+ }, [o, i, c]), /* @__PURE__ */ J(
312
+ Z.Provider,
310
313
  {
311
314
  value: {
312
- selectedScheme: l,
313
- setSelectedScheme: u,
315
+ selectedScheme: i,
316
+ setSelectedScheme: f,
314
317
  schemes: c
315
318
  },
316
319
  children: [
@@ -318,8 +321,8 @@ const Y = z(
318
321
  "script",
319
322
  {
320
323
  dangerouslySetInnerHTML: {
321
- __html: X({
322
- customSchemes: i,
324
+ __html: Q({
325
+ customSchemes: s,
323
326
  initialSchemeName: o,
324
327
  useOnlyCustomSchemes: n
325
328
  })
@@ -333,7 +336,7 @@ const Y = z(
333
336
  );
334
337
  };
335
338
  export {
336
- Y as T,
337
- re as a,
338
- X as g
339
+ Z as T,
340
+ ne as a,
341
+ Q as g
339
342
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ThemeContext-FD4ODqF4.cjs");exports.ThemeContext=e.ThemeContext;exports.ThemeProvider=e.ThemeProvider;exports.getThemeInitializationScript=e.getThemeInitializationScript;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ThemeContext-D1VVOPG1.cjs");exports.ThemeContext=e.ThemeContext;exports.ThemeProvider=e.ThemeProvider;exports.getThemeInitializationScript=e.getThemeInitializationScript;
@@ -1,4 +1,4 @@
1
- import { T as a, a as i, g as o } from "./ThemeContext-CuyHtN7b.js";
1
+ import { T as a, a as i, g as o } from "./ThemeContext-DRXOWRyX.js";
2
2
  export {
3
3
  a as ThemeContext,
4
4
  i as ThemeProvider,
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),a=require("react"),U=require("./Select-BkErbR5B.cjs"),E=require("./ThemeContext-FD4ODqF4.cjs"),i=require("./boreal-style-config-BB8MdwYx.cjs"),l=a.forwardRef(({theme:o=i.getDefaultTheme(),glass:c,shadow:d=i.getDefaultShadow(),rounding:u=i.getDefaultRounding(),"data-testid":m,testId:h=m??"theme-select",state:b="","aria-label":g="Select Theme","aria-description":S,"aria-labelledby":x,"aria-describedby":f,"aria-invalid":T,"aria-required":p,disabled:q,label:C,labelPosition:v,name:y,id:w},N)=>{const n=a.useContext(E.ThemeContext);if(!n)throw new Error("ThemeContext is undefined. Wrap with ThemeProvider.");const{selectedScheme:R,setSelectedScheme:j,schemes:t}=n,D=a.useMemo(()=>t.map((r,e)=>({value:String(e),label:r.name})),[t]),I=r=>{const e=Number.parseInt(String(r),10);!Number.isInteger(e)||!t[e]||j(e)};return s.jsx("div",{className:"control-container",children:s.jsx(U.Select,{ref:N,theme:o,glass:c,state:b,shadow:d,rounding:u,options:D,"data-testid":h,value:String(R),"aria-label":g,"aria-description":S,"aria-labelledby":x,"aria-describedby":f,"aria-invalid":T,"aria-required":p,disabled:q,label:C,labelPosition:v,name:y,id:w,onChange:I})})});l.displayName="UserThemeSettings";exports.UserThemeSettings=l;
1
+ "use strict";const s=require("react/jsx-runtime"),a=require("react"),U=require("./Select-BkErbR5B.cjs"),E=require("./ThemeContext-D1VVOPG1.cjs"),i=require("./boreal-style-config-BB8MdwYx.cjs"),l=a.forwardRef(({theme:o=i.getDefaultTheme(),glass:c,shadow:d=i.getDefaultShadow(),rounding:u=i.getDefaultRounding(),"data-testid":m,testId:h=m??"theme-select",state:b="","aria-label":g="Select Theme","aria-description":S,"aria-labelledby":x,"aria-describedby":f,"aria-invalid":T,"aria-required":p,disabled:q,label:C,labelPosition:v,name:y,id:w},N)=>{const n=a.useContext(E.ThemeContext);if(!n)throw new Error("ThemeContext is undefined. Wrap with ThemeProvider.");const{selectedScheme:R,setSelectedScheme:j,schemes:t}=n,D=a.useMemo(()=>t.map((r,e)=>({value:String(e),label:r.name})),[t]),I=r=>{const e=Number.parseInt(String(r),10);!Number.isInteger(e)||!t[e]||j(e)};return s.jsx("div",{className:"control-container",children:s.jsx(U.Select,{ref:N,theme:o,glass:c,state:b,shadow:d,rounding:u,options:D,"data-testid":h,value:String(R),"aria-label":g,"aria-description":S,"aria-labelledby":x,"aria-describedby":f,"aria-invalid":T,"aria-required":p,disabled:q,label:C,labelPosition:v,name:y,id:w,onChange:I})})});l.displayName="UserThemeSettings";exports.UserThemeSettings=l;
@@ -1,7 +1,7 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { forwardRef as U, useContext as q, useMemo as R } from "react";
3
3
  import { S as j } from "./Select-BtEKKotT.js";
4
- import { T as E } from "./ThemeContext-CuyHtN7b.js";
4
+ import { T as E } from "./ThemeContext-DRXOWRyX.js";
5
5
  import { g as M, a as P, b as W } from "./boreal-style-config-rYvfCHLY.js";
6
6
  const k = U(
7
7
  ({
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ThemeSelect-BhvN814l.cjs");exports.default=e.UserThemeSettings;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ThemeSelect-CPpf-wbN.cjs");exports.default=e.UserThemeSettings;
@@ -1,4 +1,4 @@
1
- import { U as f } from "./ThemeSelect-BL5YdtZJ.js";
1
+ import { U as f } from "./ThemeSelect-DxmyeZm_.js";
2
2
  export {
3
3
  f as default
4
4
  };