boreal-ui 0.0.894 → 0.0.895
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-W9ItlBXS.js → Footer-DJQW1MAv.js} +1 -1
- package/dist/core/{Footer-CqEL5lCo.cjs → Footer-fVAC2wLQ.cjs} +1 -1
- package/dist/core/Footer.cjs.js +1 -1
- package/dist/core/Footer.js +1 -1
- package/dist/core/{ThemeContext-wbHzxDs2.js → ThemeContext-BGLAV7uR.js} +68 -67
- package/dist/core/ThemeContext-CTeDRtLE.cjs +1 -0
- package/dist/core/ThemeProvider.cjs.js +1 -1
- package/dist/core/ThemeProvider.js +1 -1
- package/dist/core/ThemeSelect-DGeevrTb.js +74 -0
- package/dist/core/ThemeSelect-gy2SszvH.cjs +1 -0
- package/dist/core/ThemeSelect.cjs.js +1 -1
- package/dist/core/ThemeSelect.js +1 -1
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.js +3 -3
- package/dist/next/{Footer-1gaUlUeU.js → Footer-DnQ6E77x.js} +1 -1
- package/dist/next/Footer.js +1 -1
- package/dist/next/{NextThemeProvider-Dy9dtA1A.js → NextThemeProvider-CcZFLACX.js} +1 -1
- package/dist/next/{ThemeContext-BdDCc3xM.js → ThemeContext-DiGDDpfQ.js} +69 -68
- package/dist/next/ThemeProvider.js +2 -2
- package/dist/next/ThemeSelect-Cjr3IPGx.js +75 -0
- package/dist/next/ThemeSelect.js +1 -1
- package/dist/next/index.js +4 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/Select/ThemeSelect/core/ThemeSelect.d.ts.map +1 -1
- package/dist/types/components/Select/ThemeSelect/next/ThemeSelect.d.ts.map +1 -1
- package/dist/types/context/ThemeContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/ThemeContext-BNZ28nPu.cjs +0 -1
- package/dist/core/ThemeSelect-B7LNF0B5.cjs +0 -1
- package/dist/core/ThemeSelect-C8cxeht_.js +0 -71
- package/dist/next/ThemeSelect-8AG_tLAW.js +0 -72
|
@@ -5,7 +5,7 @@ import { c as o } from "./classNames-Dz0_huu_.js";
|
|
|
5
5
|
import { g as Ee, f as Le } from "./boreal-style-config-rYvfCHLY.js";
|
|
6
6
|
import { c as p } from "./capitalize-D_pj4b3P.js";
|
|
7
7
|
import { I as Pe } from "./IconButton-Dq8m4yuP.js";
|
|
8
|
-
import { U as Ue } from "./ThemeSelect-
|
|
8
|
+
import { U as Ue } from "./ThemeSelect-DGeevrTb.js";
|
|
9
9
|
import './Footer.css';const B = (h) => h.toLowerCase().trim().replace(/\s+/g, "-"), de = ({
|
|
10
10
|
theme: h = Ee(),
|
|
11
11
|
glass: F = Le(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./Footer.css');const t=require("react/jsx-runtime"),ie=require("./propAliases-Bfsf5cJN.cjs"),Be=require("react"),r=require("./classNames-C7V3kfBj.cjs"),se=require("./boreal-style-config-BB8MdwYx.cjs"),y=require("./capitalize-CnTiekgk.cjs"),Ge=require("./IconButton-O0x6cSnS.cjs"),Re=require("./ThemeSelect-
|
|
1
|
+
"use strict";require('./Footer.css');const t=require("react/jsx-runtime"),ie=require("./propAliases-Bfsf5cJN.cjs"),Be=require("react"),r=require("./classNames-C7V3kfBj.cjs"),se=require("./boreal-style-config-BB8MdwYx.cjs"),y=require("./capitalize-CnTiekgk.cjs"),Ge=require("./IconButton-O0x6cSnS.cjs"),Re=require("./ThemeSelect-gy2SszvH.cjs"),k=c=>c.toLowerCase().trim().replace(/\s+/g,"-"),le=({theme:c=se.getDefaultTheme(),glass:v=se.getDefaultGlass(),attachment:ce="static",shadow:S="none",rounding:w="none",layout:m="inline",className:z="","data-testid":me,testId:n=me??"footer",copyright:i,copyrightInBottom:he,links:b=[],sections:q,logo:l,brandTitle:u,brandDescription:B,brandHref:G,brandTarget:R,brandRel:fe,socialLinks:N=[],showThemeSelect:E=!1,themeSelectLabel:be="Theme",bottomEnd:F,contentClassName:L,leftClassName:P,linksClassName:ue,linkClassName:Ne,logoClassName:T,socialClassName:xe,themeToggleClassName:je,brandClassName:_e,brandLinkClassName:U,brandTitleClassName:ge,brandDescriptionClassName:$e,sectionsClassName:Ce,sectionTitleClassName:H,actionsClassName:ye,actionGroupClassName:ve,bottomClassName:Se,bottomCopyrightClassName:we,bottomEndClassName:qe,copyrightClassName:J,IconButton:Fe,ImageComponent:K="img",ThemeSelect:Te,classMap:o,LinkWrapper:O=({href:j,children:_,...A})=>t.jsx("a",{href:j,...A,children:_}),"aria-label":Q,"aria-labelledby":V,"aria-describedby":W,navAriaLabel:X="Footer site links",socialNavAriaLabel:pe="Social media",themeSelectAriaLabel:Y="Theme selector",logoAriaLabel:x="Logo",logoDecorative:d=!1,labelId:f,...Z})=>{const j=ie.resolvePropAlias(ce),_=Be.useMemo(()=>r.combineClassNames(o.footer,o[c],v&&o.glass,m!=="inline"&&o[`layout${y.capitalize(m)}`],S!=="none"&&o[`shadow${y.capitalize(S)}`],w!=="none"&&o[`round${y.capitalize(w)}`],o[`attachment${y.capitalize(j)}`],z),[o,c,v,m,S,w,j,z]),D=typeof l=="string"||(e=>typeof e=="object"&&e!==null&&"src"in e)(l),a=D?typeof l=="string"?{src:l}:l:void 0,p=a==null?void 0:a.src,I=(a==null?void 0:a.width)??20,M=(a==null?void 0:a.height)??20,ee=q&&q.length>0?q:b.length>0?[{title:"Links",links:b,"aria-label":X,testId:"links"}]:[],te=he??m==="columns",oe=()=>D&&p?typeof K=="string"?t.jsx("img",{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,loading:"lazy",src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):t.jsx(K,{className:r.combineClassNames(o.logo,T),"data-testid":`${n}-logo`,src:p,alt:d?"":x,"aria-hidden":d?!0:void 0,height:M,width:I}):l?t.jsx("span",{className:r.combineClassNames(o.logo,T),role:d?void 0:"img","aria-label":d?void 0:x,"aria-hidden":d?!0:void 0,"data-testid":`${n}-logo`,children:l}):null,re=(e,s,g)=>{const h=k(e.label||e.href||`link-${s}`),$=`${e.href??h}-${s}`,C=r.combineClassNames(o.link,g);return e.disabled?t.jsx("li",{children:t.jsx("span",{className:C,"data-testid":`${n}-link-${h}`,"aria-disabled":"true",title:e.title,children:e.label})},$):t.jsx("li",{children:t.jsx(O,{href:e.href,className:C,"data-testid":`${n}-link-${h}`,"aria-label":e["aria-label"],"aria-current":e["aria-current"],title:e.title,rel:e.rel,target:e.target,children:e.label})},$)},ne=()=>N.length===0?null:t.jsx("nav",{className:r.combineClassNames(o.social,xe),"aria-label":pe,"data-testid":`${n}-social`,children:N.map((e,s)=>t.jsx(Fe,{icon:e.icon,href:e.href,isExternal:e.isExternal??!0,shadow:"none","aria-label":e["aria-label"]??e.title,title:e.tooltip??e.title,theme:"clear",glass:v,disabled:e.disabled,rel:e.rel,target:e.target,"data-testid":`${n}-social-${k(e.title)}`},`${e.href??e.title}-${s}`))}),ae=()=>E?t.jsx("div",{className:r.combineClassNames(o.themeToggle,je),"data-testid":`${n}-theme-select`,"aria-label":Y,children:t.jsx(Te,{theme:"clear",label:be,labelPosition:m==="columns"?"top":"left",shadow:"none","aria-label":Y})}):null,ke=()=>{const e=t.jsxs(t.Fragment,{children:[oe(),u&&t.jsx("span",{className:r.combineClassNames(o.brandTitle,ge),"data-testid":`${n}-brand-title`,children:u})]});return t.jsxs("div",{className:r.combineClassNames(o.brand,_e),"data-testid":`${n}-brand`,children:[G?t.jsx(O,{href:G,className:r.combineClassNames(o.brandLink,U),target:R,rel:fe??(R==="_blank"?"noopener noreferrer":void 0),"aria-label":typeof u=="string"?u:x,children:e}):t.jsx("div",{className:r.combineClassNames(o.brandLink,U),children:e}),B&&t.jsx("p",{className:r.combineClassNames(o.brandDescription,$e),"data-testid":`${n}-brand-description`,children:B}),i&&!te&&t.jsx("div",{className:r.combineClassNames(o.copyright,J),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]})},ze=()=>ee.length===0?null:t.jsx("div",{className:r.combineClassNames(o.sections,Ce),"data-testid":`${n}-sections`,children:ee.map((e,s)=>{const g=typeof e.title=="string"?e.title:`section-${s+1}`,h=e.testId??k(g);return t.jsxs("nav",{className:r.combineClassNames(o.section,e.className),"aria-label":e["aria-label"]??`${g} links`,"data-testid":`${n}-section-${h}`,children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H,e.titleClassName),children:e.title}),t.jsx("ul",{className:r.combineClassNames(o.sectionList,e.listClassName),children:e.links.map(($,C)=>re($,C,e.linkClassName))})]},h)})});return m==="columns"?t.jsxs("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:[t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[ke(),ze(),(N.length>0||E)&&t.jsxs("div",{className:r.combineClassNames(o.actions,ye),"data-testid":`${n}-actions`,children:[N.length>0&&t.jsxs("div",{className:r.combineClassNames(o.actionGroup,ve),children:[t.jsx("h2",{className:r.combineClassNames(o.sectionTitle,H),children:"Connect"}),ne()]}),ae()]})]}),(i||F)&&t.jsxs("div",{className:r.combineClassNames(o.bottom,Se),"data-testid":`${n}-bottom`,children:[i&&te&&t.jsx("p",{id:f,className:r.combineClassNames(o.bottomCopyright,we),"data-testid":`${n}-copyright`,children:i}),F&&t.jsx("div",{className:r.combineClassNames(o.bottomEnd,qe),"data-testid":`${n}-bottom-end`,children:F})]})]}):t.jsx("footer",{className:_,"data-testid":n,role:"contentinfo","aria-label":Q,"aria-labelledby":V??f,"aria-describedby":W,...Z,children:t.jsxs("div",{className:r.combineClassNames(o.content,L),children:[t.jsxs("div",{className:r.combineClassNames(o.left,P),"data-testid":`${n}-left`,children:[oe(),i&&t.jsx("div",{className:r.combineClassNames(o.copyright,J)??r.combineClassNames(o.left,P),"data-testid":`${n}-copyright`,children:t.jsx("p",{id:f,children:i})})]}),b.length>0&&t.jsx("nav",{className:r.combineClassNames(o.links,ue),"aria-label":X,"data-testid":`${n}-nav`,children:t.jsx("ul",{children:b.map((e,s)=>re(e,s,Ne))})}),ae(),ne()]})})};le.displayName="FooterBase";const Ee={footer:"footer",glass:"footer_glass",primary:"footer_primary",secondary:"footer_secondary",tertiary:"footer_tertiary",quaternary:"footer_quaternary",clear:"footer_clear",layoutColumns:"footer_layout-columns",shadowNone:"footer_shadow-None",shadowLight:"footer_shadow-Light",shadowMedium:"footer_shadow-Medium",shadowStrong:"footer_shadow-Strong",shadowIntense:"footer_shadow-Intense",roundNone:"footer_round-None",roundSmall:"footer_round-Small",roundMedium:"footer_round-Medium",roundLarge:"footer_round-Large",attachmentStatic:"footer_attachment-static",attachmentFixed:"footer_attachment-fixed",attachmentSticky:"footer_attachment-sticky",content:"footer_content",logo:"footer_logo",left:"footer_left",links:"footer_links",link:"footer_link",social:"footer_social",themeToggle:"footer_theme-toggle",copyright:"footer_copyright",brand:"footer_brand",brandLink:"footer_brand-link",brandTitle:"footer_brand-title",brandDescription:"footer_brand-description",sections:"footer_sections",section:"footer_section",sectionTitle:"footer_section-title",sectionList:"footer_section-list",actions:"footer_actions",actionGroup:"footer_action-group",bottom:"footer_bottom",bottomCopyright:"footer_bottom-copyright",bottomEnd:"footer_bottom-end"},de=c=>t.jsx(le,{...c,IconButton:Ge.IconButton,ThemeSelect:Re.UserThemeSettings,classMap:ie.expandClassMap(Ee)});de.displayName="Footer";exports.Footer=de;
|
package/dist/core/Footer.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Footer-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Footer-fVAC2wLQ.cjs");exports.default=e.Footer;
|
package/dist/core/Footer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as z, jsx as P } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
2
|
+
import { createContext as B, useMemo as T, useCallback as k, useState as F, useInsertionEffect as D, useEffect as E, useLayoutEffect as G } from "react";
|
|
3
3
|
import { c as H } from "./boreal-style-config-rYvfCHLY.js";
|
|
4
|
-
import { defaultColorSchemes as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
4
|
+
import { defaultColorSchemes as K } from "./colorSchemes.js";
|
|
5
|
+
const C = "boreal:selectedSchemeName", N = "boreal:theme-change", b = 4.5, _ = 3;
|
|
6
|
+
function U(t, e = []) {
|
|
7
7
|
const r = [...t];
|
|
8
8
|
for (const o of e) {
|
|
9
9
|
const n = r.findIndex((c) => c.name === o.name);
|
|
@@ -18,32 +18,32 @@ function J({
|
|
|
18
18
|
customSchemes: t = [],
|
|
19
19
|
useOnlyCustomSchemes: e = !1
|
|
20
20
|
}) {
|
|
21
|
-
return e ? [...t] :
|
|
21
|
+
return e ? [...t] : U([...K], t);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function W(t, {
|
|
24
24
|
initialSchemeName: e,
|
|
25
25
|
savedSchemeName: r
|
|
26
26
|
}) {
|
|
27
27
|
const o = x(t, e), n = x(t, r), c = x(t, H());
|
|
28
28
|
return o !== -1 ? o : n !== -1 ? n : c !== -1 ? c : 0;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function I(t) {
|
|
31
31
|
if (!t) return null;
|
|
32
32
|
try {
|
|
33
|
-
return t.getItem(
|
|
33
|
+
return t.getItem(C);
|
|
34
34
|
} catch {
|
|
35
35
|
return console.error("Failed to load saved theme name"), null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function X(t, e) {
|
|
39
39
|
if (!t) return !1;
|
|
40
40
|
try {
|
|
41
|
-
return t.getItem(
|
|
41
|
+
return t.getItem(C) === e ? !1 : (t.setItem(C, e), !0);
|
|
42
42
|
} catch {
|
|
43
43
|
return console.error("Failed to save theme name"), !1;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Y(t, e = typeof window > "u" ? void 0 : window) {
|
|
47
47
|
e && e.dispatchEvent(
|
|
48
48
|
new CustomEvent(N, {
|
|
49
49
|
detail: { schemeName: t }
|
|
@@ -54,7 +54,7 @@ function j(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
|
|
57
|
+
function L(t) {
|
|
58
58
|
const e = j(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, c = Math.max(r, o, n), i = Math.min(r, o, n);
|
|
59
59
|
let a = 0, l = 0;
|
|
60
60
|
const h = (c + i) / 2;
|
|
@@ -79,7 +79,7 @@ function $(t) {
|
|
|
79
79
|
l: Math.round(h * 100)
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function $(t, e, r) {
|
|
83
83
|
e /= 100, r /= 100;
|
|
84
84
|
const o = (i) => (i + t / 30) % 12, n = e * Math.min(r, 1 - r), c = (i) => Math.round(
|
|
85
85
|
255 * (r - n * Math.max(-1, Math.min(o(i) - 3, Math.min(9 - o(i), 1))))
|
|
@@ -87,8 +87,8 @@ function L(t, e, r) {
|
|
|
87
87
|
return `#${[c(0), c(8), c(4)].map((i) => i.toString(16).padStart(2, "0")).join("")}`;
|
|
88
88
|
}
|
|
89
89
|
function y(t, e) {
|
|
90
|
-
const { h: r, s: o, l: n } =
|
|
91
|
-
return
|
|
90
|
+
const { h: r, s: o, l: n } = L(t);
|
|
91
|
+
return $(r, o, Math.min(100, Math.max(0, n + e)));
|
|
92
92
|
}
|
|
93
93
|
function A(t) {
|
|
94
94
|
const e = j(t) ?? "#000000", r = [1, 3, 5].map((o) => {
|
|
@@ -101,42 +101,42 @@ function g(t, e) {
|
|
|
101
101
|
const r = A(t), o = A(e), n = Math.max(r, o), c = Math.min(r, o);
|
|
102
102
|
return (n + 0.05) / (c + 0.05);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function w(t, e, r = b) {
|
|
105
105
|
if (e && g(t, e) >= r)
|
|
106
106
|
return e;
|
|
107
107
|
const o = g(t, "#000000"), n = g(t, "#ffffff");
|
|
108
108
|
return o >= n ? "#000000" : "#ffffff";
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Q(t, e, r) {
|
|
111
111
|
const o = y(e, r);
|
|
112
|
-
return g(t, o) >=
|
|
112
|
+
return g(t, o) >= b ? o : e;
|
|
113
113
|
}
|
|
114
114
|
function O(t, e) {
|
|
115
115
|
const r = e === "#000000" ? 1 : -1;
|
|
116
116
|
for (let o = 30; o >= 0; o -= 5) {
|
|
117
117
|
const n = y(e, o * r);
|
|
118
|
-
if (g(t, n) >=
|
|
118
|
+
if (g(t, n) >= b)
|
|
119
119
|
return n;
|
|
120
120
|
}
|
|
121
121
|
return e;
|
|
122
122
|
}
|
|
123
123
|
function p(t, e, r) {
|
|
124
124
|
const o = y(t, r);
|
|
125
|
-
if (g(o, e) >=
|
|
125
|
+
if (g(o, e) >= b)
|
|
126
126
|
return o;
|
|
127
|
-
const { h: n, s: c, l: i } =
|
|
127
|
+
const { h: n, s: c, l: i } = L(t), a = e === "#ffffff";
|
|
128
128
|
for (let l = 4; l <= 48; l += 4) {
|
|
129
|
-
const h = a ? Math.max(0, i - l) : Math.min(100, i + l), u =
|
|
130
|
-
if (g(u, e) >=
|
|
129
|
+
const h = a ? Math.max(0, i - l) : Math.min(100, i + l), u = $(n, c, h);
|
|
130
|
+
if (g(u, e) >= b)
|
|
131
131
|
return u;
|
|
132
132
|
}
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
135
|
function M(t, e = 14, r = 14) {
|
|
136
|
-
const { h: o, s: n, l: c } =
|
|
137
|
-
return g(t, l) >= _ ? l :
|
|
136
|
+
const { h: o, s: n, l: c } = L(t), i = c >= 50 ? Math.max(0, c - r) : Math.min(100, c + e), a = n > 8 ? Math.max(0, n - 8) : n, l = $(o, a, i);
|
|
137
|
+
return g(t, l) >= _ ? l : w(t, void 0, _);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function Z(t) {
|
|
140
140
|
const {
|
|
141
141
|
primaryColor: e,
|
|
142
142
|
secondaryColor: r,
|
|
@@ -144,7 +144,7 @@ function Q(t) {
|
|
|
144
144
|
quaternaryColor: n,
|
|
145
145
|
backgroundColor: c,
|
|
146
146
|
forceTextColor: i
|
|
147
|
-
} = t, a =
|
|
147
|
+
} = t, a = w(c, i), l = w(e, i), h = w(r), u = w(o), v = w(n);
|
|
148
148
|
return {
|
|
149
149
|
"--primary-color": e,
|
|
150
150
|
"--primary-color-light": y(e, 10),
|
|
@@ -191,7 +191,7 @@ function Q(t) {
|
|
|
191
191
|
"--background-color-light": y(c, 10),
|
|
192
192
|
"--background-color-lighter": y(c, 20),
|
|
193
193
|
"--link-color": a,
|
|
194
|
-
"--link-hover-color":
|
|
194
|
+
"--link-hover-color": Q(
|
|
195
195
|
c,
|
|
196
196
|
a,
|
|
197
197
|
a === "#ffffff" ? -20 : 20
|
|
@@ -223,27 +223,27 @@ function Q(t) {
|
|
|
223
223
|
"--border-color-strong": M(c, 20, 20)
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ee(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 te(t, e = document) {
|
|
231
|
+
ee(
|
|
232
232
|
e.documentElement.style,
|
|
233
|
-
|
|
233
|
+
Z(t)
|
|
234
234
|
), e.documentElement.dataset.borealTheme = t.name;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function re({
|
|
237
237
|
customSchemes: t = [],
|
|
238
238
|
initialSchemeName: e,
|
|
239
239
|
useOnlyCustomSchemes: r = !1
|
|
240
240
|
} = {}) {
|
|
241
241
|
const o = J({ customSchemes: t, useOnlyCustomSchemes: r }), n = H();
|
|
242
|
-
return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(
|
|
242
|
+
return `(function(){try{var s=${JSON.stringify(o).replace(/</g, "\\u003c")};var k=${JSON.stringify(C)};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 oe = B(
|
|
245
245
|
void 0
|
|
246
|
-
),
|
|
246
|
+
), ne = typeof window > "u" ? E : G, le = ({
|
|
247
247
|
children: t,
|
|
248
248
|
customSchemes: e = [],
|
|
249
249
|
enableThemeScript: r = !0,
|
|
@@ -270,17 +270,17 @@ const re = F(
|
|
|
270
270
|
[i, n]
|
|
271
271
|
), l = k(
|
|
272
272
|
(s) => {
|
|
273
|
-
var
|
|
274
|
-
const m =
|
|
273
|
+
var d, f;
|
|
274
|
+
const m = W(a, {
|
|
275
275
|
initialSchemeName: o,
|
|
276
276
|
savedSchemeName: s
|
|
277
277
|
});
|
|
278
|
-
return ((
|
|
278
|
+
return ((d = a[m]) == null ? void 0 : d.name) ?? ((f = a[0]) == null ? void 0 : f.name) ?? "";
|
|
279
279
|
},
|
|
280
280
|
[o, a]
|
|
281
|
-
), [h, u] =
|
|
281
|
+
), [h, u] = F(
|
|
282
282
|
() => l(
|
|
283
|
-
typeof window > "u" ? null :
|
|
283
|
+
typeof window > "u" ? null : I(window.localStorage)
|
|
284
284
|
)
|
|
285
285
|
), v = T(() => {
|
|
286
286
|
const s = x(a, h);
|
|
@@ -288,8 +288,8 @@ const re = F(
|
|
|
288
288
|
}, [a, h]), R = k(
|
|
289
289
|
(s) => {
|
|
290
290
|
u((m) => {
|
|
291
|
-
const
|
|
292
|
-
return x(a,
|
|
291
|
+
const d = typeof s == "function" ? s(m) : s;
|
|
292
|
+
return x(a, d) === -1 ? m : d;
|
|
293
293
|
});
|
|
294
294
|
},
|
|
295
295
|
[a]
|
|
@@ -297,42 +297,42 @@ const re = F(
|
|
|
297
297
|
(s) => {
|
|
298
298
|
u((m) => {
|
|
299
299
|
var S;
|
|
300
|
-
const
|
|
301
|
-
return ((S = a[
|
|
300
|
+
const d = x(a, m), f = typeof s == "function" ? s(d === -1 ? 0 : d) : s;
|
|
301
|
+
return ((S = a[f]) == null ? void 0 : S.name) ?? m;
|
|
302
302
|
});
|
|
303
303
|
},
|
|
304
304
|
[a]
|
|
305
305
|
);
|
|
306
|
-
return
|
|
307
|
-
const s = typeof window > "u" ? null :
|
|
308
|
-
u((
|
|
306
|
+
return ne(() => {
|
|
307
|
+
const s = typeof window > "u" ? null : I(window.localStorage), m = x(a, s), d = l(s);
|
|
308
|
+
u((f) => o ? d : m !== -1 ? s : x(a, f) !== -1 ? f : d);
|
|
309
309
|
}, [o, l, a]), D(() => {
|
|
310
310
|
const s = a[v] ?? a[0];
|
|
311
|
-
!s || typeof document > "u" ||
|
|
312
|
-
}, [v, a]),
|
|
311
|
+
!s || typeof document > "u" || te(s, document);
|
|
312
|
+
}, [v, a]), E(() => {
|
|
313
313
|
if (typeof window > "u") return;
|
|
314
|
-
const s = (
|
|
315
|
-
x(a,
|
|
316
|
-
(S) => S ===
|
|
314
|
+
const s = (f) => {
|
|
315
|
+
x(a, f) !== -1 && u(
|
|
316
|
+
(S) => S === f ? S : f
|
|
317
317
|
);
|
|
318
|
-
}, m = (
|
|
318
|
+
}, m = (f) => {
|
|
319
319
|
var q;
|
|
320
|
-
s((q =
|
|
321
|
-
},
|
|
322
|
-
|
|
320
|
+
s((q = f.detail) == null ? void 0 : q.schemeName);
|
|
321
|
+
}, d = (f) => {
|
|
322
|
+
f.key === C && s(f.newValue);
|
|
323
323
|
};
|
|
324
|
-
return window.addEventListener(N, m), window.addEventListener("storage",
|
|
325
|
-
window.removeEventListener(N, m), window.removeEventListener("storage",
|
|
324
|
+
return window.addEventListener(N, m), window.addEventListener("storage", d), s(I(window.localStorage)), () => {
|
|
325
|
+
window.removeEventListener(N, m), window.removeEventListener("storage", d);
|
|
326
326
|
};
|
|
327
|
-
}, [a]),
|
|
327
|
+
}, [a]), E(() => {
|
|
328
328
|
const s = a[v] ?? a[0];
|
|
329
329
|
if (!s) return;
|
|
330
|
-
|
|
330
|
+
X(
|
|
331
331
|
typeof window > "u" ? void 0 : window.localStorage,
|
|
332
332
|
s.name
|
|
333
|
-
) &&
|
|
333
|
+
) && Y(s.name);
|
|
334
334
|
}, [v, a]), /* @__PURE__ */ z(
|
|
335
|
-
|
|
335
|
+
oe.Provider,
|
|
336
336
|
{
|
|
337
337
|
value: {
|
|
338
338
|
selectedScheme: v,
|
|
@@ -346,7 +346,7 @@ const re = F(
|
|
|
346
346
|
"script",
|
|
347
347
|
{
|
|
348
348
|
dangerouslySetInnerHTML: {
|
|
349
|
-
__html:
|
|
349
|
+
__html: re({
|
|
350
350
|
customSchemes: i,
|
|
351
351
|
initialSchemeName: o,
|
|
352
352
|
useOnlyCustomSchemes: n
|
|
@@ -361,7 +361,8 @@ const re = F(
|
|
|
361
361
|
);
|
|
362
362
|
};
|
|
363
363
|
export {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
oe as T,
|
|
365
|
+
le as a,
|
|
366
|
+
re as g,
|
|
367
|
+
I as r
|
|
367
368
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const L=require("react/jsx-runtime"),m=require("react"),O=require("./boreal-style-config-BB8MdwYx.cjs"),V=require("./colorSchemes.cjs.js"),w="boreal:selectedSchemeName",E="boreal:theme-change",T=4.5,$=3;function B(t,e=[]){const r=[...t];for(const o of e){const n=r.findIndex(c=>c.name===o.name);n>=0?r[n]=o:r.push(o)}return r}function g(t,e){return e?t.findIndex(r=>r.name===e):-1}function R({customSchemes:t=[],useOnlyCustomSchemes:e=!1}){return e?[...t]:B([...V.defaultColorSchemes],t)}function D(t,{initialSchemeName:e,savedSchemeName:r}){const o=g(t,e),n=g(t,r),c=g(t,O.getDefaultColorSchemeName());return o!==-1?o:n!==-1?n:c!==-1?c:0}function k(t){if(!t)return null;try{return t.getItem(w)}catch{return console.error("Failed to load saved theme name"),null}}function F(t,e){if(!t)return!1;try{return t.getItem(w)===e?!1:(t.setItem(w,e),!0)}catch{return console.error("Failed to save theme name"),!1}}function G(t,e=typeof window>"u"?void 0:window){e&&e.dispatchEvent(new CustomEvent(E,{detail:{schemeName:t}}))}function j(t){const e=t.trim(),r=/^#([\da-f])([\da-f])([\da-f])$/i.exec(e);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}function I(t){const e=j(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,c=Math.max(r,o,n),i=Math.min(r,o,n);let a=0,l=0;const y=(c+i)/2;if(c!==i){const u=c-i;switch(l=y>.5?u/(2-c-i):u/(c+i),c){case r:a=(o-n)/u+(o<n?6:0);break;case o:a=(n-r)/u+2;break;case n:a=(r-o)/u+4;break}a/=6}return{h:Math.round(a*360),s:Math.round(l*100),l:Math.round(y*100)}}function N(t,e,r){e/=100,r/=100;const o=i=>(i+t/30)%12,n=e*Math.min(r,1-r),c=i=>Math.round(255*(r-n*Math.max(-1,Math.min(o(i)-3,Math.min(9-o(i),1)))));return`#${[c(0),c(8),c(4)].map(i=>i.toString(16).padStart(2,"0")).join("")}`}function v(t,e){const{h:r,s:o,l:n}=I(t);return N(r,o,Math.min(100,Math.max(0,n+e)))}function _(t){const e=j(t)??"#000000",r=[1,3,5].map(o=>{const n=parseInt(e.slice(o,o+2),16)/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]}function S(t,e){const r=_(t),o=_(e),n=Math.max(r,o),c=Math.min(r,o);return(n+.05)/(c+.05)}function b(t,e,r=T){if(e&&S(t,e)>=r)return e;const o=S(t,"#000000"),n=S(t,"#ffffff");return o>=n?"#000000":"#ffffff"}function K(t,e,r){const o=v(e,r);return S(t,o)>=T?o:e}function A(t,e){const r=e==="#000000"?1:-1;for(let o=30;o>=0;o-=5){const n=v(e,o*r);if(S(t,n)>=T)return n}return e}function p(t,e,r){const o=v(t,r);if(S(o,e)>=T)return o;const{h:n,s:c,l:i}=I(t),a=e==="#ffffff";for(let l=4;l<=48;l+=4){const y=a?Math.max(0,i-l):Math.min(100,i+l),u=N(n,c,y);if(S(u,e)>=T)return u}return t}function M(t,e=14,r=14){const{h:o,s:n,l:c}=I(t),i=c>=50?Math.max(0,c-r):Math.min(100,c+e),a=n>8?Math.max(0,n-8):n,l=N(o,a,i);return S(t,l)>=$?l:b(t,void 0,$)}function U(t){const{primaryColor:e,secondaryColor:r,tertiaryColor:o,quaternaryColor:n,backgroundColor:c,forceTextColor:i}=t,a=b(c,i),l=b(e,i),y=b(r),u=b(o),x=b(n);return{"--primary-color":e,"--primary-color-light":v(e,10),"--primary-color-hover":p(e,l,-10),"--text-color-primary":l,"--text-color-primary-contrast":a,"--text-color":a,"--text-color-light":A(c,a),"--text-color-lighter":A(c,a),"--secondary-color":r,"--secondary-color-light":v(r,10),"--secondary-color-hover":p(r,y,-10),"--text-color-secondary":y,"--tertiary-color":o,"--tertiary-color-light":v(o,10),"--tertiary-color-hover":p(o,u,-10),"--text-color-tertiary":u,"--quaternary-color":n,"--quaternary-color-light":v(n,10),"--quaternary-color-hover":p(n,x,-10),"--text-color-quaternary":x,"--background-color":c,"--background-color-dark":v(c,-10),"--background-color-darker":v(c,-25),"--background-color-light":v(c,10),"--background-color-lighter":v(c,20),"--link-color":a,"--link-hover-color":K(c,a,a==="#ffffff"?-20:20),"--link-hover-color-primary":p(e,l,-10),"--link-hover-color-secondary":p(r,y,-10),"--link-hover-color-tertiary":p(o,u,-10),"--link-hover-color-quaternary":p(n,x,-10),"--focus-outline-color":a,"--divider-color":M(c),"--border-color":M(c),"--border-color-subtle":M(c,10,10),"--border-color-strong":M(c,20,20)}}function W(t,e){for(const[r,o]of Object.entries(e))t.setProperty(r,o)}function X(t,e=document){W(e.documentElement.style,U(t)),e.documentElement.dataset.borealTheme=t.name}function H({customSchemes:t=[],initialSchemeName:e,useOnlyCustomSchemes:r=!1}={}){const o=R({customSchemes:t,useOnlyCustomSchemes:r}),n=O.getDefaultColorSchemeName();return`(function(){try{var s=${JSON.stringify(o).replace(/</g,"\\u003c")};var k=${JSON.stringify(w)};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){}})();`}const J=m.createContext(void 0),Y=typeof window>"u"?m.useEffect:m.useLayoutEffect,Q=({children:t,customSchemes:e=[],enableThemeScript:r=!0,initialSchemeName:o,useOnlyCustomSchemes:n=!1})=>{const c=m.useMemo(()=>JSON.stringify(e??[]),[e]),i=m.useMemo(()=>{try{const s=JSON.parse(c);if(Array.isArray(s))return s}catch{console.error("Failed to parse custom schemes")}return[]},[c]),a=m.useMemo(()=>R({customSchemes:i,useOnlyCustomSchemes:n}),[i,n]),l=m.useCallback(s=>{var d,f;const h=D(a,{initialSchemeName:o,savedSchemeName:s});return((d=a[h])==null?void 0:d.name)??((f=a[0])==null?void 0:f.name)??""},[o,a]),[y,u]=m.useState(()=>l(typeof window>"u"?null:k(window.localStorage))),x=m.useMemo(()=>{const s=g(a,y);return s===-1?0:s},[a,y]),z=m.useCallback(s=>{u(h=>{const d=typeof s=="function"?s(h):s;return g(a,d)===-1?h:d})},[a]),P=m.useCallback(s=>{u(h=>{var C;const d=g(a,h),f=typeof s=="function"?s(d===-1?0:d):s;return((C=a[f])==null?void 0:C.name)??h})},[a]);return Y(()=>{const s=typeof window>"u"?null:k(window.localStorage),h=g(a,s),d=l(s);u(f=>o?d:h!==-1?s:g(a,f)!==-1?f:d)},[o,l,a]),m.useInsertionEffect(()=>{const s=a[x]??a[0];!s||typeof document>"u"||X(s,document)},[x,a]),m.useEffect(()=>{if(typeof window>"u")return;const s=f=>{g(a,f)!==-1&&u(C=>C===f?C:f)},h=f=>{var q;s((q=f.detail)==null?void 0:q.schemeName)},d=f=>{f.key===w&&s(f.newValue)};return window.addEventListener(E,h),window.addEventListener("storage",d),s(k(window.localStorage)),()=>{window.removeEventListener(E,h),window.removeEventListener("storage",d)}},[a]),m.useEffect(()=>{const s=a[x]??a[0];if(!s)return;F(typeof window>"u"?void 0:window.localStorage,s.name)&&G(s.name)},[x,a]),L.jsxs(J.Provider,{value:{selectedScheme:x,selectedSchemeName:y,setSelectedScheme:P,setSelectedSchemeName:z,schemes:a},children:[r?L.jsx("script",{dangerouslySetInnerHTML:{__html:H({customSchemes:i,initialSchemeName:o,useOnlyCustomSchemes:n})},suppressHydrationWarning:!0}):null,t]})};exports.ThemeContext=J;exports.ThemeProvider=Q;exports.getThemeInitializationScript=H;exports.readSavedSchemeName=k;
|
|
@@ -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-CTeDRtLE.cjs");exports.ThemeContext=e.ThemeContext;exports.ThemeProvider=e.ThemeProvider;exports.getThemeInitializationScript=e.getThemeInitializationScript;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as U, useContext as q, useMemo as L, useEffect as R, useLayoutEffect as j } from "react";
|
|
3
|
+
import { S as B } from "./Select-BtEKKotT.js";
|
|
4
|
+
import { T as M, r as P } from "./ThemeContext-BGLAV7uR.js";
|
|
5
|
+
import { g as W, a as k, b as z } from "./boreal-style-config-rYvfCHLY.js";
|
|
6
|
+
const A = typeof window > "u" ? R : j, F = U(
|
|
7
|
+
({
|
|
8
|
+
theme: s = W(),
|
|
9
|
+
glass: m,
|
|
10
|
+
shadow: d = k(),
|
|
11
|
+
rounding: l = z(),
|
|
12
|
+
"data-testid": c,
|
|
13
|
+
testId: f = c ?? "theme-select",
|
|
14
|
+
state: h = "",
|
|
15
|
+
"aria-label": u = "Select Theme",
|
|
16
|
+
"aria-description": S,
|
|
17
|
+
"aria-labelledby": p,
|
|
18
|
+
"aria-describedby": b,
|
|
19
|
+
"aria-invalid": g,
|
|
20
|
+
"aria-required": w,
|
|
21
|
+
disabled: v,
|
|
22
|
+
label: y,
|
|
23
|
+
labelPosition: T,
|
|
24
|
+
name: x,
|
|
25
|
+
id: N
|
|
26
|
+
}, C) => {
|
|
27
|
+
const o = q(M);
|
|
28
|
+
if (!o)
|
|
29
|
+
throw new Error("ThemeContext is undefined. Wrap with ThemeProvider.");
|
|
30
|
+
const { selectedSchemeName: r, setSelectedSchemeName: i, schemes: a } = o, E = L(
|
|
31
|
+
() => a.map((e) => ({
|
|
32
|
+
value: e.name,
|
|
33
|
+
label: e.name
|
|
34
|
+
})),
|
|
35
|
+
[a]
|
|
36
|
+
);
|
|
37
|
+
return A(() => {
|
|
38
|
+
const e = P(window.localStorage);
|
|
39
|
+
e && e !== r && a.some((t) => t.name === e) && i(e);
|
|
40
|
+
}, [a, r, i]), /* @__PURE__ */ n("div", { className: "control-container", children: /* @__PURE__ */ n(
|
|
41
|
+
B,
|
|
42
|
+
{
|
|
43
|
+
ref: C,
|
|
44
|
+
theme: s,
|
|
45
|
+
glass: m,
|
|
46
|
+
state: h,
|
|
47
|
+
shadow: d,
|
|
48
|
+
rounding: l,
|
|
49
|
+
options: E,
|
|
50
|
+
"data-testid": f,
|
|
51
|
+
value: r,
|
|
52
|
+
"aria-label": u,
|
|
53
|
+
"aria-description": S,
|
|
54
|
+
"aria-labelledby": p,
|
|
55
|
+
"aria-describedby": b,
|
|
56
|
+
"aria-invalid": g,
|
|
57
|
+
"aria-required": w,
|
|
58
|
+
disabled: v,
|
|
59
|
+
label: y,
|
|
60
|
+
labelPosition: T,
|
|
61
|
+
name: x,
|
|
62
|
+
id: N,
|
|
63
|
+
onChange: (e) => {
|
|
64
|
+
const t = String(e);
|
|
65
|
+
a.some((D) => D.name === t) && i(t);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
) });
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
F.displayName = "UserThemeSettings";
|
|
72
|
+
export {
|
|
73
|
+
F as U
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),a=require("react"),B=require("./Select-BkErbR5B.cjs"),d=require("./ThemeContext-CTeDRtLE.cjs"),s=require("./boreal-style-config-BB8MdwYx.cjs"),M=typeof window>"u"?a.useEffect:a.useLayoutEffect,l=a.forwardRef(({theme:m=s.getDefaultTheme(),glass:u,shadow:h=s.getDefaultShadow(),rounding:f=s.getDefaultRounding(),"data-testid":S,testId:b=S??"theme-select",state:g="","aria-label":w="Select Theme","aria-description":x,"aria-labelledby":y,"aria-describedby":T,"aria-invalid":v,"aria-required":p,disabled:q,label:C,labelPosition:N,name:E,id:R},j)=>{const o=a.useContext(d.ThemeContext);if(!o)throw new Error("ThemeContext is undefined. Wrap with ThemeProvider.");const{selectedSchemeName:i,setSelectedSchemeName:n,schemes:t}=o,D=a.useMemo(()=>t.map(e=>({value:e.name,label:e.name})),[t]);M(()=>{const e=d.readSavedSchemeName(window.localStorage);e&&e!==i&&t.some(r=>r.name===e)&&n(e)},[t,i,n]);const U=e=>{const r=String(e);t.some(L=>L.name===r)&&n(r)};return c.jsx("div",{className:"control-container",children:c.jsx(B.Select,{ref:j,theme:m,glass:u,state:g,shadow:h,rounding:f,options:D,"data-testid":b,value:i,"aria-label":w,"aria-description":x,"aria-labelledby":y,"aria-describedby":T,"aria-invalid":v,"aria-required":p,disabled:q,label:C,labelPosition:N,name:E,id:R,onChange:U})})});l.displayName="UserThemeSettings";exports.UserThemeSettings=l;
|
|
@@ -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-gy2SszvH.cjs");exports.default=e.UserThemeSettings;
|
package/dist/core/ThemeSelect.js
CHANGED