@julseb-lib/react 1.0.19 → 1.0.20
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/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2701,7 +2701,10 @@ var INPUT_HEIGHT = 32;
|
|
|
2701
2701
|
var import_react16 = require("react");
|
|
2702
2702
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2703
2703
|
var ThemeContext = (0, import_react16.createContext)(null);
|
|
2704
|
-
var ThemeProviderWrapper = ({
|
|
2704
|
+
var ThemeProviderWrapper = ({
|
|
2705
|
+
children,
|
|
2706
|
+
defaultTheme
|
|
2707
|
+
}) => {
|
|
2705
2708
|
const [theme, setTheme] = (0, import_react16.useState)("light");
|
|
2706
2709
|
const switchToLight = () => {
|
|
2707
2710
|
if (typeof window !== "undefined") {
|
|
@@ -2722,7 +2725,10 @@ var ThemeProviderWrapper = ({ children }) => {
|
|
|
2722
2725
|
(0, import_react16.useEffect)(() => {
|
|
2723
2726
|
if (typeof window !== "undefined") {
|
|
2724
2727
|
const storedTheme = localStorage.getItem("theme");
|
|
2725
|
-
if (
|
|
2728
|
+
if (defaultTheme) {
|
|
2729
|
+
if (defaultTheme === "light") switchToLight();
|
|
2730
|
+
else switchToDark();
|
|
2731
|
+
} else if (storedTheme) {
|
|
2726
2732
|
if (storedTheme === "light") switchToLight();
|
|
2727
2733
|
else switchToDark();
|
|
2728
2734
|
} else {
|