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.
- package/dist/core/{Footer-BRldxyPK.cjs → Footer-CmpLvoZb.cjs} +1 -1
- package/dist/core/{Footer-DPspjwxk.js → Footer-CoFPqecX.js} +1 -1
- package/dist/core/Footer.cjs.js +1 -1
- package/dist/core/Footer.js +1 -1
- package/dist/core/RadioButton.cjs.js +1 -1
- package/dist/core/RadioButton.js +1 -1
- package/dist/core/{RadioGroup-BE7ap9Q-.cjs → RadioGroup-Bdjdyec3.cjs} +1 -1
- package/dist/core/{RadioGroup-Q10i7UkK.js → RadioGroup-D1nlf4NZ.js} +0 -1
- package/dist/core/RadioGroup.cjs.js +1 -1
- package/dist/core/RadioGroup.js +1 -1
- package/dist/core/ThemeContext-D1VVOPG1.cjs +1 -0
- package/dist/{next/ThemeContext-QLpHalQp.js → core/ThemeContext-DRXOWRyX.js} +155 -152
- package/dist/core/ThemeProvider.cjs.js +1 -1
- package/dist/core/ThemeProvider.js +1 -1
- package/dist/core/{ThemeSelect-BhvN814l.cjs → ThemeSelect-CPpf-wbN.cjs} +1 -1
- package/dist/core/{ThemeSelect-BL5YdtZJ.js → ThemeSelect-DxmyeZm_.js} +1 -1
- package/dist/core/ThemeSelect.cjs.js +1 -1
- package/dist/core/ThemeSelect.js +1 -1
- package/dist/core/index.cjs.js +3 -3
- package/dist/core/index.js +29 -11
- package/dist/generated-docs/Footer.props.js +9 -0
- package/dist/generated-docs/ThemeSelect.props.js +9 -0
- package/dist/next/{Footer-BUB9lMtL.js → Footer-D78Lzvjg.js} +1 -1
- package/dist/next/Footer.js +1 -1
- package/dist/next/{NextThemeProvider-B9YjrpO8.js → NextThemeProvider-NpALBYoC.js} +1 -1
- package/dist/next/{RadioButton-BbJ50szC.js → RadioButton-BHoW7U55.js} +1 -1
- package/dist/next/RadioButton.js +2 -2
- package/dist/next/{RadioGroup-BEFTo4Q5.js → RadioGroup-DEFfETJs.js} +0 -1
- package/dist/next/RadioGroup.js +1 -1
- package/dist/{core/ThemeContext-CuyHtN7b.js → next/ThemeContext-19HbcfZg.js} +155 -152
- package/dist/next/ThemeProvider.js +2 -2
- package/dist/next/{ThemeSelect-BCB022pq.js → ThemeSelect-BdFqSfT_.js} +1 -1
- package/dist/next/ThemeSelect.js +1 -1
- package/dist/next/index.js +31 -13
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/RadioButton/RadioGroupBase.d.ts.map +1 -1
- package/dist/types/context/ThemeContext.d.ts.map +1 -1
- package/dist/types/generated-docs/Footer.props.d.ts.map +1 -1
- package/dist/types/generated-docs/ThemeSelect.props.d.ts.map +1 -1
- package/package.json +1 -1
- 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
|
|
3
|
-
import { c as
|
|
4
|
-
import { defaultColorSchemes as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
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
|
|
14
|
+
function C(t, e) {
|
|
15
15
|
return e ? t.findIndex((r) => r.name === e) : -1;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function R({
|
|
18
18
|
customSchemes: t = [],
|
|
19
19
|
useOnlyCustomSchemes: e = !1
|
|
20
20
|
}) {
|
|
21
|
-
return e ? [...t] :
|
|
21
|
+
return e ? [...t] : D([...B], t);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function q(t, {
|
|
24
24
|
initialSchemeName: e,
|
|
25
25
|
savedSchemeName: r
|
|
26
26
|
}) {
|
|
27
|
-
const o =
|
|
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
|
|
30
|
+
function T(t) {
|
|
31
31
|
if (!t) return null;
|
|
32
32
|
try {
|
|
33
|
-
return t.getItem(
|
|
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
|
|
38
|
+
function G(t, e) {
|
|
39
39
|
if (!t) return !1;
|
|
40
40
|
try {
|
|
41
|
-
return t.getItem(
|
|
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
|
|
46
|
+
function K(t, e = typeof window > "u" ? void 0 : window) {
|
|
47
47
|
e && e.dispatchEvent(
|
|
48
|
-
new CustomEvent(
|
|
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
|
|
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),
|
|
59
|
-
let c = 0,
|
|
60
|
-
const
|
|
61
|
-
if (a !==
|
|
62
|
-
const
|
|
63
|
-
switch (
|
|
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) /
|
|
65
|
+
c = (o - n) / u + (o < n ? 6 : 0);
|
|
66
66
|
break;
|
|
67
67
|
case o:
|
|
68
|
-
c = (n - r) /
|
|
68
|
+
c = (n - r) / u + 2;
|
|
69
69
|
break;
|
|
70
70
|
case n:
|
|
71
|
-
c = (r - o) /
|
|
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(
|
|
79
|
-
l: Math.round(
|
|
78
|
+
s: Math.round(i * 100),
|
|
79
|
+
l: Math.round(f * 100)
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function $(t, e, r) {
|
|
83
83
|
e /= 100, r /= 100;
|
|
84
|
-
const o = (
|
|
85
|
-
255 * (r - n * Math.max(-1, Math.min(o(
|
|
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((
|
|
87
|
+
return `#${[a(0), a(8), a(4)].map((s) => s.toString(16).padStart(2, "0")).join("")}`;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const { h: r, s: o, l: n } =
|
|
91
|
-
return
|
|
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
|
|
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
|
|
101
|
-
const r =
|
|
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
|
|
105
|
-
if (e &&
|
|
104
|
+
function x(t, e, r = w) {
|
|
105
|
+
if (e && v(t, e) >= r)
|
|
106
106
|
return e;
|
|
107
|
-
const o =
|
|
107
|
+
const o = v(t, "#000000"), n = v(t, "#ffffff");
|
|
108
108
|
return o >= n ? "#000000" : "#ffffff";
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const o =
|
|
112
|
-
return
|
|
110
|
+
function U(t, e, r) {
|
|
111
|
+
const o = d(e, r);
|
|
112
|
+
return v(t, o) >= w ? o : e;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
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 =
|
|
118
|
-
if (
|
|
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
|
|
124
|
-
const o =
|
|
125
|
-
if (
|
|
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:
|
|
128
|
-
for (let
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
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
|
|
136
|
-
const { h: o, s: n, l: a } =
|
|
137
|
-
return
|
|
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
|
|
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:
|
|
147
|
-
} = t, c =
|
|
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":
|
|
151
|
-
"--primary-color-hover":
|
|
150
|
+
"--primary-color-light": d(e, 10),
|
|
151
|
+
"--primary-color-hover": y(
|
|
152
152
|
e,
|
|
153
|
-
|
|
153
|
+
i,
|
|
154
154
|
-10
|
|
155
155
|
),
|
|
156
|
-
"--text-color-primary":
|
|
156
|
+
"--text-color-primary": i,
|
|
157
157
|
"--text-color-primary-contrast": c,
|
|
158
158
|
"--text-color": c,
|
|
159
|
-
"--text-color-light":
|
|
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":
|
|
166
|
-
"--secondary-color-hover":
|
|
165
|
+
"--secondary-color-light": d(r, 10),
|
|
166
|
+
"--secondary-color-hover": y(
|
|
167
167
|
r,
|
|
168
|
-
|
|
168
|
+
f,
|
|
169
169
|
-10
|
|
170
170
|
),
|
|
171
|
-
"--text-color-secondary":
|
|
171
|
+
"--text-color-secondary": f,
|
|
172
172
|
"--tertiary-color": o,
|
|
173
|
-
"--tertiary-color-light":
|
|
174
|
-
"--tertiary-color-hover":
|
|
173
|
+
"--tertiary-color-light": d(o, 10),
|
|
174
|
+
"--tertiary-color-hover": y(
|
|
175
175
|
o,
|
|
176
|
-
|
|
176
|
+
u,
|
|
177
177
|
-10
|
|
178
178
|
),
|
|
179
|
-
"--text-color-tertiary":
|
|
179
|
+
"--text-color-tertiary": u,
|
|
180
180
|
"--quaternary-color": n,
|
|
181
|
-
"--quaternary-color-light":
|
|
182
|
-
"--quaternary-color-hover":
|
|
181
|
+
"--quaternary-color-light": d(n, 10),
|
|
182
|
+
"--quaternary-color-hover": y(
|
|
183
183
|
n,
|
|
184
|
-
|
|
184
|
+
l,
|
|
185
185
|
-10
|
|
186
186
|
),
|
|
187
|
-
"--text-color-quaternary":
|
|
187
|
+
"--text-color-quaternary": l,
|
|
188
188
|
"--background-color": a,
|
|
189
|
-
"--background-color-dark":
|
|
190
|
-
"--background-color-darker":
|
|
191
|
-
"--background-color-light":
|
|
192
|
-
"--background-color-lighter":
|
|
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":
|
|
194
|
+
"--link-hover-color": U(
|
|
195
195
|
a,
|
|
196
196
|
c,
|
|
197
197
|
c === "#ffffff" ? -20 : 20
|
|
198
198
|
),
|
|
199
|
-
"--link-hover-color-primary":
|
|
199
|
+
"--link-hover-color-primary": y(
|
|
200
200
|
e,
|
|
201
|
-
|
|
201
|
+
i,
|
|
202
202
|
-10
|
|
203
203
|
),
|
|
204
|
-
"--link-hover-color-secondary":
|
|
204
|
+
"--link-hover-color-secondary": y(
|
|
205
205
|
r,
|
|
206
|
-
|
|
206
|
+
f,
|
|
207
207
|
-10
|
|
208
208
|
),
|
|
209
|
-
"--link-hover-color-tertiary":
|
|
209
|
+
"--link-hover-color-tertiary": y(
|
|
210
210
|
o,
|
|
211
|
-
|
|
211
|
+
u,
|
|
212
212
|
-10
|
|
213
213
|
),
|
|
214
|
-
"--link-hover-color-quaternary":
|
|
214
|
+
"--link-hover-color-quaternary": y(
|
|
215
215
|
n,
|
|
216
|
-
|
|
216
|
+
l,
|
|
217
217
|
-10
|
|
218
218
|
),
|
|
219
219
|
"--focus-outline-color": c,
|
|
220
|
-
"--divider-color":
|
|
221
|
-
"--border-color":
|
|
222
|
-
"--border-color-subtle":
|
|
223
|
-
"--border-color-strong":
|
|
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
|
|
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
|
|
231
|
-
|
|
230
|
+
function Y(t, e = document) {
|
|
231
|
+
X(
|
|
232
232
|
e.documentElement.style,
|
|
233
|
-
|
|
233
|
+
W(t)
|
|
234
234
|
), e.documentElement.dataset.borealTheme = t.name;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function Q({
|
|
237
237
|
customSchemes: t = [],
|
|
238
238
|
initialSchemeName: e,
|
|
239
239
|
useOnlyCustomSchemes: r = !1
|
|
240
240
|
} = {}) {
|
|
241
|
-
const o =
|
|
242
|
-
return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(
|
|
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
|
|
244
|
+
const Z = V(
|
|
245
245
|
void 0
|
|
246
|
-
),
|
|
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 =
|
|
253
|
+
const a = k(
|
|
254
254
|
() => JSON.stringify(e ?? []),
|
|
255
255
|
[e]
|
|
256
|
-
),
|
|
256
|
+
), s = k(() => {
|
|
257
257
|
try {
|
|
258
|
-
const
|
|
259
|
-
if (Array.isArray(
|
|
260
|
-
return
|
|
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 =
|
|
266
|
-
() =>
|
|
267
|
-
customSchemes:
|
|
265
|
+
}, [a]), c = k(
|
|
266
|
+
() => R({
|
|
267
|
+
customSchemes: s,
|
|
268
268
|
useOnlyCustomSchemes: n
|
|
269
269
|
}),
|
|
270
|
-
[
|
|
271
|
-
), [
|
|
272
|
-
() =>
|
|
270
|
+
[s, n]
|
|
271
|
+
), [i, f] = z(
|
|
272
|
+
() => q(c, {
|
|
273
273
|
initialSchemeName: o,
|
|
274
|
-
savedSchemeName: typeof window > "u" ? null :
|
|
274
|
+
savedSchemeName: typeof window > "u" ? null : T(window.localStorage)
|
|
275
275
|
})
|
|
276
|
-
);
|
|
277
|
-
return
|
|
278
|
-
const
|
|
276
|
+
), u = P(!1);
|
|
277
|
+
return I(() => {
|
|
278
|
+
const l = q(c, {
|
|
279
279
|
initialSchemeName: o,
|
|
280
|
-
savedSchemeName: typeof window > "u" ? null :
|
|
280
|
+
savedSchemeName: typeof window > "u" ? null : T(window.localStorage)
|
|
281
281
|
});
|
|
282
|
-
|
|
283
|
-
}, [c, o]),
|
|
284
|
-
const
|
|
285
|
-
!
|
|
286
|
-
}, [
|
|
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
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
(
|
|
288
|
+
const l = (m) => {
|
|
289
|
+
const g = C(c, m);
|
|
290
|
+
g !== -1 && f(
|
|
291
|
+
(p) => p === g ? p : g
|
|
298
292
|
);
|
|
299
|
-
},
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
},
|
|
303
|
-
|
|
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(
|
|
306
|
-
window.removeEventListener(
|
|
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]),
|
|
309
|
-
|
|
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:
|
|
313
|
-
setSelectedScheme:
|
|
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:
|
|
322
|
-
customSchemes:
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
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-
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),a=require("react"),U=require("./Select-BkErbR5B.cjs"),E=require("./ThemeContext-
|
|
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-
|
|
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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ThemeSelect-CPpf-wbN.cjs");exports.default=e.UserThemeSettings;
|
package/dist/core/ThemeSelect.js
CHANGED