@julseb-lib/react 1.0.18 → 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 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 = ({ children }) => {
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 (storedTheme) {
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 {
@@ -3013,7 +3019,7 @@ var Key = ({
3013
3019
  accentColor = "primary",
3014
3020
  ...rest
3015
3021
  }) => {
3016
- const theme = localStorage.getItem("theme") ?? "light";
3022
+ const { theme } = useLibTheme();
3017
3023
  const Element = element;
3018
3024
  const childrenArray = import_react23.Children.toArray(
3019
3025
  children?.toString().replaceAll(",", "").split("")
@@ -67223,7 +67229,7 @@ var Toast = ({
67223
67229
  ...rest
67224
67230
  }) => {
67225
67231
  const Element = element;
67226
- const theme = localStorage.getItem("theme") ?? "light";
67232
+ const { theme } = useLibTheme();
67227
67233
  return /* @__PURE__ */ (0, import_jsx_runtime333.jsxs)(
67228
67234
  Element,
67229
67235
  {
@@ -67414,7 +67420,7 @@ var Alert = ({
67414
67420
  ...rest
67415
67421
  }) => {
67416
67422
  const Element = element;
67417
- const theme = localStorage.getItem("theme") ?? "light";
67423
+ const { theme } = useLibTheme();
67418
67424
  return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
67419
67425
  Element,
67420
67426
  {