@iqworksai/common-components 0.1.23 → 0.1.25
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/context/ThemeContext.d.ts +6 -0
- package/dist/context/ThemeContext.d.ts.map +1 -1
- package/dist/context/ThemeContext.mjs +44 -35
- package/dist/{index-DtVOjJk3.cjs → index-Cf4bZpgR.cjs} +1 -1
- package/dist/{index-CUUuCzyM.cjs → index-CncKotGK.cjs} +38 -38
- package/dist/index.cjs +1 -1
- package/dist/{jquery-BKuE7Afe.cjs → jquery-Dnnsv72h.cjs} +1 -1
- package/dist/{jstree-CtrCtuMv.cjs → jstree-O0geaCrw.cjs} +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { FaviconProductKey } from '../components/Favicons';
|
|
2
3
|
|
|
3
4
|
export type Theme = 'light' | 'dark';
|
|
4
5
|
export interface ThemeConfig {
|
|
@@ -44,6 +45,11 @@ export interface ThemeProviderProps {
|
|
|
44
45
|
defaultTheme?: Theme;
|
|
45
46
|
config?: Partial<ThemeConfig>;
|
|
46
47
|
storageKey?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Product key for favicon. When provided, automatically sets and updates
|
|
50
|
+
* the favicon based on the current theme (light icon for dark mode, dark icon for light mode).
|
|
51
|
+
*/
|
|
52
|
+
favicon?: FaviconProductKey;
|
|
47
53
|
}
|
|
48
54
|
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
49
55
|
export declare const useTheme: () => ThemeContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/context/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/context/ThemeContext.tsx"],"names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IAG3B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AA+ED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwJtD,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,gBAM3B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as p, jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useMemo as T, useEffect as y, createContext as k, useContext as S } from "react";
|
|
3
|
+
import { useFavicon as v } from "../components/Favicons/index.mjs";
|
|
3
4
|
const t = {
|
|
4
5
|
// Brand colors - IQ Works palette (HSL format for Tailwind opacity support)
|
|
5
6
|
brandOrange: "25 100% 50%",
|
|
@@ -60,7 +61,7 @@ const t = {
|
|
|
60
61
|
// Fonts - Inter for body, Manrope for headings
|
|
61
62
|
fontFamily: "'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
62
63
|
fontFamilyHeading: "'Manrope', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
63
|
-
},
|
|
64
|
+
}, w = {
|
|
64
65
|
bgColor: "0 0% 23%",
|
|
65
66
|
// #3a3a3a
|
|
66
67
|
textColor: "210 20% 98%",
|
|
@@ -102,36 +103,41 @@ const t = {
|
|
|
102
103
|
// #bbf7d0 green-200
|
|
103
104
|
statusSuccessBorder: "142 64% 24%"
|
|
104
105
|
// #166534 green-800
|
|
105
|
-
},
|
|
106
|
+
}, b = k(void 0);
|
|
107
|
+
function E({ product: s, theme: a }) {
|
|
108
|
+
return v(s, { theme: a === "dark" ? "light" : "dark" }), null;
|
|
109
|
+
}
|
|
110
|
+
const M = ({
|
|
106
111
|
children: s,
|
|
107
|
-
defaultTheme:
|
|
108
|
-
config:
|
|
109
|
-
storageKey:
|
|
112
|
+
defaultTheme: a,
|
|
113
|
+
config: n = {},
|
|
114
|
+
storageKey: d = "theme",
|
|
115
|
+
favicon: i
|
|
110
116
|
}) => {
|
|
111
|
-
const
|
|
117
|
+
const C = () => {
|
|
112
118
|
if (typeof window < "u") {
|
|
113
|
-
const o = localStorage.getItem(
|
|
119
|
+
const o = localStorage.getItem(d);
|
|
114
120
|
if (o === "light" || o === "dark")
|
|
115
121
|
return o;
|
|
116
122
|
}
|
|
117
|
-
return
|
|
118
|
-
}, [e,
|
|
123
|
+
return a || (typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
124
|
+
}, [e, g] = u(C), [l, h] = u(() => ({
|
|
119
125
|
...t,
|
|
120
|
-
...
|
|
121
|
-
})), r =
|
|
122
|
-
...
|
|
123
|
-
...
|
|
126
|
+
...n
|
|
127
|
+
})), r = T(() => e === "dark" ? {
|
|
128
|
+
...l,
|
|
129
|
+
...w,
|
|
124
130
|
// User config takes precedence
|
|
125
|
-
...
|
|
131
|
+
...n
|
|
126
132
|
} : {
|
|
127
|
-
...
|
|
128
|
-
...
|
|
129
|
-
}, [e,
|
|
130
|
-
|
|
133
|
+
...l,
|
|
134
|
+
...n
|
|
135
|
+
}, [e, l, n]);
|
|
136
|
+
y(() => {
|
|
131
137
|
if (typeof window > "u") return;
|
|
132
138
|
const o = window.document.documentElement;
|
|
133
|
-
o.classList.remove(e === "light" ? "dark" : "light"), o.classList.add(e), localStorage.setItem(
|
|
134
|
-
const
|
|
139
|
+
o.classList.remove(e === "light" ? "dark" : "light"), o.classList.add(e), localStorage.setItem(d, e);
|
|
140
|
+
const c = {
|
|
135
141
|
// Brand colors (HSL format for Tailwind opacity support)
|
|
136
142
|
"--brand-orange": r.brandOrange || t.brandOrange,
|
|
137
143
|
"--brand-dark": r.brandDark || t.brandDark,
|
|
@@ -168,34 +174,37 @@ const t = {
|
|
|
168
174
|
// Custom variables
|
|
169
175
|
...r.customVariables || {}
|
|
170
176
|
};
|
|
171
|
-
Object.entries(
|
|
172
|
-
o.style.setProperty(
|
|
177
|
+
Object.entries(c).forEach(([f, B]) => {
|
|
178
|
+
o.style.setProperty(f, B);
|
|
173
179
|
}), r.fontFamily && (document.body.style.fontFamily = r.fontFamily), document.body.style.backgroundColor = e === "dark" ? r.appBgColorDark || t.appBgColorDark : r.appBgColor || t.appBgColor;
|
|
174
|
-
}, [e, r,
|
|
175
|
-
const
|
|
180
|
+
}, [e, r, d]);
|
|
181
|
+
const m = {
|
|
176
182
|
theme: e,
|
|
177
183
|
toggleTheme: () => {
|
|
178
|
-
|
|
184
|
+
g((o) => o === "light" ? "dark" : "light");
|
|
179
185
|
},
|
|
180
186
|
setTheme: (o) => {
|
|
181
|
-
|
|
187
|
+
g(o);
|
|
182
188
|
},
|
|
183
189
|
config: r,
|
|
184
190
|
updateConfig: (o) => {
|
|
185
|
-
|
|
186
|
-
...
|
|
191
|
+
h((c) => ({
|
|
192
|
+
...c,
|
|
187
193
|
...o
|
|
188
194
|
}));
|
|
189
195
|
}
|
|
190
196
|
};
|
|
191
|
-
return /* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
return /* @__PURE__ */ p(b.Provider, { value: m, children: [
|
|
198
|
+
i && /* @__PURE__ */ x(E, { product: i, theme: e }),
|
|
199
|
+
s
|
|
200
|
+
] });
|
|
201
|
+
}, O = () => {
|
|
202
|
+
const s = S(b);
|
|
194
203
|
if (!s)
|
|
195
204
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
196
205
|
return s;
|
|
197
206
|
};
|
|
198
207
|
export {
|
|
199
|
-
|
|
200
|
-
|
|
208
|
+
M as ThemeProvider,
|
|
209
|
+
O as useTheme
|
|
201
210
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),gt=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),gt=require("./index-CncKotGK.cjs"),Xo=require("react-dom");function ze(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,on=new RegExp(yn.source,"g");function Gi(e){return function(){return e}}function Zi(e){return function(t){return e(t)+""}}function qi(e,t){var n=yn.lastIndex=on.lastIndex=0,o,r,s,i=-1,c=[],a=[];for(e=e+"",t=t+"";(o=yn.exec(e))&&(r=on.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),c[i]?c[i]+=s:c[++i]=s),(o=o[0])===(r=r[0])?c[i]?c[i]+=r:c[++i]=r:(c[++i]=null,a.push({i,x:ze(o,r)})),n=on.lastIndex;return n<t.length&&(s=t.slice(n),c[i]?c[i]+=s:c[++i]=s),c.length<2?a[0]?Zi(a[0].x):Gi(t):(t=a.length,function(u){for(var l=0,d;l<t;++l)c[(d=a[l]).i]=d.x(u);return c.join("")})}var ro=180/Math.PI,wn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yo(e,t,n,o,r,s){var i,c,a;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(a=e*n+t*o)&&(n-=e*a,o-=t*a),(c=Math.sqrt(n*n+o*o))&&(n/=c,o/=c,a/=c),e*o<t*n&&(e=-e,t=-t,a=-a,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(a)*ro,scaleX:i,scaleY:c}}var xt;function Qi(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wn:Yo(t.a,t.b,t.c,t.d,t.e,t.f)}function Ji(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?wn:(e=e.matrix,Yo(e.a,e.b,e.c,e.d,e.e,e.f))}function Uo(e,t,n,o){function r(u){return u.length?u.pop()+" ":""}function s(u,l,d,g,h,w){if(u!==d||l!==g){var m=h.push("translate(",null,t,null,n);w.push({i:m-4,x:ze(u,d)},{i:m-2,x:ze(l,g)})}else(d||g)&&h.push("translate("+d+t+g+n)}function i(u,l,d,g){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),g.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(u,l)})):l&&d.push(r(d)+"rotate("+l+o)}function c(u,l,d,g){u!==l?g.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(u,l)}):l&&d.push(r(d)+"skewX("+l+o)}function a(u,l,d,g,h,w){if(u!==d||l!==g){var m=h.push(r(h)+"scale(",null,",",null,")");w.push({i:m-4,x:ze(u,d)},{i:m-2,x:ze(l,g)})}else(d!==1||g!==1)&&h.push(r(h)+"scale("+d+","+g+")")}return function(u,l){var d=[],g=[];return u=e(u),l=e(l),s(u.translateX,u.translateY,l.translateX,l.translateY,d,g),i(u.rotate,l.rotate,d,g),c(u.skewX,l.skewX,d,g),a(u.scaleX,u.scaleY,l.scaleX,l.scaleY,d,g),u=l=null,function(h){for(var w=-1,m=g.length,_;++w<m;)d[(_=g[w]).i]=_.x(h);return d.join("")}}}var ji=Uo(Qi,"px, ","px)","deg)"),es=Uo(Ji,", ",")",")"),ts=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function ns(e){return((e=Math.exp(e))-1/e)/2}function os(e){return((e=Math.exp(2*e))-1)/(e+1)}const rs=function e(t,n,o){function r(s,i){var c=s[0],a=s[1],u=s[2],l=i[0],d=i[1],g=i[2],h=l-c,w=d-a,m=h*h+w*w,_,y;if(m<ts)y=Math.log(g/u)/t,_=function(P){return[c+P*h,a+P*w,u*Math.exp(t*P*y)]};else{var x=Math.sqrt(m),N=(g*g-u*u+o*m)/(2*u*n*x),S=(g*g-u*u-o*m)/(2*g*n*x),C=Math.log(Math.sqrt(N*N+1)-N),M=Math.log(Math.sqrt(S*S+1)-S);y=(M-C)/t,_=function(P){var D=P*y,k=io(C),B=u/(n*x)*(k*os(t*D+C)-ns(C));return[c+B*h,a+B*w,u*k/io(t*D+C)]}}return _.duration=y*1e3*t/Math.SQRT2,_}return r.rho=function(s){var i=Math.max(.001,+s),c=i*i,a=c*c;return e(i,c,a)},r}(Math.SQRT2,2,4);function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var _n={exports:{}},rn={},bt={exports:{}},sn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|