@tydavidson/design-system 1.1.3 → 1.1.4

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.js CHANGED
@@ -1566,30 +1566,20 @@ var isDarkTheme = (theme, systemTheme) => {
1566
1566
  }
1567
1567
  return theme === "dark";
1568
1568
  };
1569
- var ThemeContext = React2.createContext(void 0);
1570
- function ThemeContextProvider({
1571
- children
1572
- }) {
1573
- const [isClient, setIsClient] = React2.useState(false);
1569
+ function useTheme() {
1574
1570
  const { theme, setTheme, resolvedTheme, systemTheme } = nextThemes.useTheme();
1575
- React2.useEffect(() => {
1576
- setIsClient(true);
1577
- }, []);
1578
1571
  const isDark = isDarkTheme(theme, systemTheme);
1579
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: {
1572
+ return {
1580
1573
  theme: theme || "system",
1581
1574
  setTheme,
1582
1575
  resolvedTheme: resolvedTheme || "light",
1583
- isClient,
1584
1576
  isDark
1585
- }, children });
1577
+ };
1586
1578
  }
1587
- function useTheme() {
1588
- const context = React2.useContext(ThemeContext);
1589
- if (context === void 0) {
1590
- throw new Error("useTheme must be used within a ThemeContextProvider");
1591
- }
1592
- return context;
1579
+ function ThemeContextProvider({
1580
+ children
1581
+ }) {
1582
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1593
1583
  }
1594
1584
  function ThemeToggle({
1595
1585
  className,
@@ -1597,8 +1587,12 @@ function ThemeToggle({
1597
1587
  size = "md",
1598
1588
  ...props
1599
1589
  }) {
1600
- const { theme, setTheme, resolvedTheme, isClient } = useTheme();
1601
- if (!isClient) return null;
1590
+ const { theme, setTheme, resolvedTheme } = useTheme();
1591
+ const [mounted, setMounted] = React2__namespace.useState(false);
1592
+ React2__namespace.useEffect(() => {
1593
+ setMounted(true);
1594
+ }, []);
1595
+ if (!mounted) return null;
1602
1596
  const toggleTheme = () => {
1603
1597
  setTheme(resolvedTheme === "dark" ? "light" : "dark");
1604
1598
  };