@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.38 → 0.2.39

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/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to the stan-design theme package will be documented in this file.
4
4
 
5
- ## [0.2.38] - 2025-10-06
5
+ ## [0.2.39] - 2025-10-06
6
6
 
7
7
  ### Added
8
8
  - Initial release of stan-design theme package
@@ -1 +1 @@
1
- {"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/theme-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAiC/B,CAAC"}
1
+ {"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/theme-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAgD/B,CAAC"}
@@ -7,9 +7,18 @@ import { Moon, Sun } from 'lucide-react';
7
7
  export const ThemeToggle = () => {
8
8
  const [isDark, setIsDark] = useState(false);
9
9
  useEffect(() => {
10
- // Check initial theme
11
- const isDarkMode = document.documentElement.classList.contains('dark');
10
+ // Check initial theme from localStorage and DOM
11
+ const savedTheme = localStorage.getItem('theme');
12
+ const isDarkMode = savedTheme === 'dark' ||
13
+ (savedTheme === null && document.documentElement.classList.contains('dark'));
12
14
  setIsDark(isDarkMode);
15
+ // Ensure DOM is in sync
16
+ if (isDarkMode) {
17
+ document.documentElement.classList.add('dark');
18
+ }
19
+ else {
20
+ document.documentElement.classList.remove('dark');
21
+ }
13
22
  }, []);
14
23
  const toggleTheme = () => {
15
24
  const newDarkMode = !isDark;
@@ -23,5 +32,5 @@ export const ThemeToggle = () => {
23
32
  localStorage.setItem('theme', 'light');
24
33
  }
25
34
  };
26
- return (_jsx(Button, { variant: "ghost", size: "sm", onClick: toggleTheme, className: "h-8 w-8 px-0", "aria-label": `Switch to ${isDark ? 'light' : 'dark'} mode`, children: isDark ? _jsx(Sun, { className: "h-4 w-4" }) : _jsx(Moon, { className: "h-4 w-4" }) }));
35
+ return (_jsx(Button, { variant: "ghost", size: "sm", onClick: toggleTheme, className: "theme-toggle h-8 w-8 px-0", "aria-label": `Switch to ${isDark ? 'light' : 'dark'} mode`, "aria-pressed": isDark, children: isDark ? (_jsx(Sun, { className: "h-4 w-4 sun-icon" })) : (_jsx(Moon, { className: "h-4 w-4 moon-icon" })) }));
27
36
  };
@@ -7,9 +7,18 @@ import { Moon, Sun } from 'lucide-react';
7
7
  export const ThemeToggle = () => {
8
8
  const [isDark, setIsDark] = useState(false);
9
9
  useEffect(() => {
10
- // Check initial theme
11
- const isDarkMode = document.documentElement.classList.contains('dark');
10
+ // Check initial theme from localStorage and DOM
11
+ const savedTheme = localStorage.getItem('theme');
12
+ const isDarkMode = savedTheme === 'dark' ||
13
+ (savedTheme === null && document.documentElement.classList.contains('dark'));
12
14
  setIsDark(isDarkMode);
15
+ // Ensure DOM is in sync
16
+ if (isDarkMode) {
17
+ document.documentElement.classList.add('dark');
18
+ }
19
+ else {
20
+ document.documentElement.classList.remove('dark');
21
+ }
13
22
  }, []);
14
23
  const toggleTheme = () => {
15
24
  const newDarkMode = !isDark;
@@ -23,5 +32,5 @@ export const ThemeToggle = () => {
23
32
  localStorage.setItem('theme', 'light');
24
33
  }
25
34
  };
26
- return (_jsx(Button, { variant: "ghost", size: "sm", onClick: toggleTheme, className: "h-8 w-8 px-0", "aria-label": `Switch to ${isDark ? 'light' : 'dark'} mode`, children: isDark ? _jsx(Sun, { className: "h-4 w-4" }) : _jsx(Moon, { className: "h-4 w-4" }) }));
35
+ return (_jsx(Button, { variant: "ghost", size: "sm", onClick: toggleTheme, className: "theme-toggle h-8 w-8 px-0", "aria-label": `Switch to ${isDark ? 'light' : 'dark'} mode`, "aria-pressed": isDark, children: isDark ? (_jsx(Sun, { className: "h-4 w-4 sun-icon" })) : (_jsx(Moon, { className: "h-4 w-4 moon-icon" })) }));
27
36
  };