@situaction/traq-ui-ste 1.1.2 → 1.1.3
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.
|
@@ -17,7 +17,7 @@ interface ThemeContextType {
|
|
|
17
17
|
toggleMode: () => void;
|
|
18
18
|
setMode: Dispatch<SetStateAction<Mode>>;
|
|
19
19
|
customVariables: Record<string, string>[] | undefined;
|
|
20
|
-
|
|
20
|
+
changeCustomVariables: (customVariables: Record<string, string>[]) => void;
|
|
21
21
|
}
|
|
22
22
|
interface ThemeProviderProps {
|
|
23
23
|
children: ReactNode;
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as w, useState as i, useEffect as E, useContext as P } from "react";
|
|
3
3
|
import { baseTheme as m } from "./createTheme.js";
|
|
4
|
-
import { variables_dark as
|
|
5
|
-
import { variables_light as
|
|
6
|
-
import { primary as
|
|
7
|
-
import '../../styles/ThemeContext.css';const C =
|
|
4
|
+
import { variables_dark as T } from "./variables_dark.js";
|
|
5
|
+
import { variables_light as g } from "./variables_light.js";
|
|
6
|
+
import { primary as p } from "./primary.js";
|
|
7
|
+
import '../../styles/ThemeContext.css';const C = w(void 0), z = ({ children: o, theme: v, mode: x, customVariables: r }) => {
|
|
8
8
|
var l, y;
|
|
9
|
-
const [t] = i(v ?? m), [n, s] = i(x ?? "light"), [a, h] = i(r ?? [
|
|
10
|
-
|
|
11
|
-
h(r ?? [
|
|
9
|
+
const [t] = i(v ?? m), [n, s] = i(x ?? "light"), [a, h] = i(r ?? [p, g]);
|
|
10
|
+
E(() => {
|
|
11
|
+
h(r ?? [p, n === "light" ? g : T]);
|
|
12
12
|
}, [n, r]);
|
|
13
13
|
const b = () => {
|
|
14
14
|
s((e) => e === "light" ? "dark" : "light");
|
|
15
|
-
}, F = (e) =>
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
}, F = (e) => {
|
|
16
|
+
h(e);
|
|
17
|
+
}, M = (e) => e.length ? e.reduce((d, f) => (Object.keys(f).forEach((c) => {
|
|
18
|
+
d[c] = f[c];
|
|
19
|
+
}), d), {}) : e, S = {
|
|
18
20
|
"--font-family": ((l = t == null ? void 0 : t.typography) == null ? void 0 : l.fontFamily) ?? m.typography.fontFamily,
|
|
19
21
|
"--font-family-secondary": ((y = t == null ? void 0 : t.typography) == null ? void 0 : y.fontFamilySecondary) ?? m.typography.fontFamilySecondary,
|
|
20
|
-
...
|
|
22
|
+
...M(a)
|
|
21
23
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ u(C.Provider, { value: {
|
|
23
25
|
theme: t,
|
|
24
26
|
mode: n,
|
|
25
27
|
toggleMode: b,
|
|
26
28
|
setMode: s,
|
|
27
29
|
customVariables: a,
|
|
28
|
-
|
|
29
|
-
}, children: /* @__PURE__ */
|
|
30
|
-
},
|
|
31
|
-
const o =
|
|
30
|
+
changeCustomVariables: F
|
|
31
|
+
}, children: /* @__PURE__ */ u("div", { style: { ...S, height: "100%" }, children: o }) });
|
|
32
|
+
}, A = () => {
|
|
33
|
+
const o = P(C);
|
|
32
34
|
if (o === void 0)
|
|
33
35
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
34
36
|
return o;
|
|
35
37
|
};
|
|
36
38
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
z as ThemeProvider,
|
|
40
|
+
A as useTheme
|
|
39
41
|
};
|