@tydavidson/design-system 1.1.15 → 1.1.17

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.
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ThemeProviderProps } from 'next-themes/dist/types';
3
- import * as React from 'react';
4
3
 
5
4
  /**
6
5
  * Utility functions for theme handling
@@ -61,63 +60,27 @@ declare function ThemeProvider({ children, ...props }: ThemeProviderProps): reac
61
60
  declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
62
61
 
63
62
  /**
64
- * Server-safe theme hook that can be used in Server Components
65
- * Returns default theme values without accessing client-side APIs
63
+ * Client-only theme provider wrapper
64
+ * This component ensures theme functionality only runs on the client side
65
+ * without using next/dynamic which causes Server Component issues
66
66
  */
67
- declare function useThemeServer(): {
68
- theme: string;
69
- setTheme: (theme: string) => void;
70
- resolvedTheme: string;
71
- isDark: boolean;
72
- };
67
+ declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
73
68
  /**
74
- * @deprecated Use ThemeProvider from './theme-provider' instead
75
- * This component is kept for backward compatibility but is no longer needed
69
+ * Client-only theme toggle wrapper
70
+ * This component ensures theme toggle only renders on the client side
71
+ * and provides a safe fallback for Server Components
76
72
  */
77
- declare function ThemeContextProvider({ children }: {
78
- children: React.ReactNode;
79
- }): react_jsx_runtime.JSX.Element;
73
+ declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element;
74
+
80
75
  /**
81
- * @deprecated Use useTheme from next-themes directly or use the ThemeProvider
82
- * This hook is kept for backward compatibility but is no longer needed
76
+ * Server-safe theme hook that can be used in Server Components
77
+ * Returns default theme values without accessing client-side APIs
83
78
  */
84
- declare function useTheme(): {
79
+ declare function useThemeServer(): {
85
80
  theme: string;
86
81
  setTheme: (theme: string) => void;
87
82
  resolvedTheme: string;
88
83
  isDark: boolean;
89
84
  };
90
85
 
91
- /**
92
- * Props for the ThemeToggle component
93
- */
94
- interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {
95
- /**
96
- * Variant of the toggle
97
- * @default 'icon'
98
- */
99
- variant?: 'icon' | 'switch' | 'button';
100
- /**
101
- * Size of the toggle
102
- * @default 'md'
103
- */
104
- size?: 'sm' | 'md' | 'lg';
105
- }
106
- /**
107
- * ThemeToggle component to switch between light and dark themes
108
- */
109
- declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
110
-
111
- /**
112
- * Client-only theme provider wrapper
113
- * This component ensures theme functionality only runs on the client side
114
- * without using next/dynamic which causes Server Component issues
115
- */
116
- declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
117
- /**
118
- * Client-only theme toggle wrapper
119
- * This component ensures theme toggle only renders on the client side
120
- */
121
- declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element | null;
122
-
123
- export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
86
+ export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeProvider, ThemeProviderNoSSR, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useThemeServer };
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ThemeProviderProps } from 'next-themes/dist/types';
3
- import * as React from 'react';
4
3
 
5
4
  /**
6
5
  * Utility functions for theme handling
@@ -61,63 +60,27 @@ declare function ThemeProvider({ children, ...props }: ThemeProviderProps): reac
61
60
  declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
62
61
 
63
62
  /**
64
- * Server-safe theme hook that can be used in Server Components
65
- * Returns default theme values without accessing client-side APIs
63
+ * Client-only theme provider wrapper
64
+ * This component ensures theme functionality only runs on the client side
65
+ * without using next/dynamic which causes Server Component issues
66
66
  */
67
- declare function useThemeServer(): {
68
- theme: string;
69
- setTheme: (theme: string) => void;
70
- resolvedTheme: string;
71
- isDark: boolean;
72
- };
67
+ declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
73
68
  /**
74
- * @deprecated Use ThemeProvider from './theme-provider' instead
75
- * This component is kept for backward compatibility but is no longer needed
69
+ * Client-only theme toggle wrapper
70
+ * This component ensures theme toggle only renders on the client side
71
+ * and provides a safe fallback for Server Components
76
72
  */
77
- declare function ThemeContextProvider({ children }: {
78
- children: React.ReactNode;
79
- }): react_jsx_runtime.JSX.Element;
73
+ declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element;
74
+
80
75
  /**
81
- * @deprecated Use useTheme from next-themes directly or use the ThemeProvider
82
- * This hook is kept for backward compatibility but is no longer needed
76
+ * Server-safe theme hook that can be used in Server Components
77
+ * Returns default theme values without accessing client-side APIs
83
78
  */
84
- declare function useTheme(): {
79
+ declare function useThemeServer(): {
85
80
  theme: string;
86
81
  setTheme: (theme: string) => void;
87
82
  resolvedTheme: string;
88
83
  isDark: boolean;
89
84
  };
90
85
 
91
- /**
92
- * Props for the ThemeToggle component
93
- */
94
- interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {
95
- /**
96
- * Variant of the toggle
97
- * @default 'icon'
98
- */
99
- variant?: 'icon' | 'switch' | 'button';
100
- /**
101
- * Size of the toggle
102
- * @default 'md'
103
- */
104
- size?: 'sm' | 'md' | 'lg';
105
- }
106
- /**
107
- * ThemeToggle component to switch between light and dark themes
108
- */
109
- declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
110
-
111
- /**
112
- * Client-only theme provider wrapper
113
- * This component ensures theme functionality only runs on the client side
114
- * without using next/dynamic which causes Server Component issues
115
- */
116
- declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
117
- /**
118
- * Client-only theme toggle wrapper
119
- * This component ensures theme toggle only renders on the client side
120
- */
121
- declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element | null;
122
-
123
- export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
86
+ export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeProvider, ThemeProviderNoSSR, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useThemeServer };
@@ -44,11 +44,6 @@ function useThemeServer() {
44
44
  isDark: false
45
45
  };
46
46
  }
47
- function ThemeContextProvider({
48
- children
49
- }) {
50
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
51
- }
52
47
  function useTheme() {
53
48
  const [themeData, setThemeData] = React__namespace.useState({
54
49
  theme: "system",
@@ -116,12 +111,43 @@ function ThemeToggle({
116
111
  size = "md",
117
112
  ...props
118
113
  }) {
114
+ if (typeof window === "undefined") {
115
+ return /* @__PURE__ */ jsxRuntime.jsx(
116
+ "button",
117
+ {
118
+ type: "button",
119
+ className: cn(
120
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
121
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
122
+ className
123
+ ),
124
+ "aria-label": "Toggle theme",
125
+ ...props,
126
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
127
+ }
128
+ );
129
+ }
119
130
  const { theme, setTheme, resolvedTheme } = useTheme();
120
131
  const [mounted, setMounted] = React__namespace.useState(false);
121
132
  React__namespace.useEffect(() => {
122
133
  setMounted(true);
123
134
  }, []);
124
- if (!mounted) return null;
135
+ if (!mounted) {
136
+ return /* @__PURE__ */ jsxRuntime.jsx(
137
+ "button",
138
+ {
139
+ type: "button",
140
+ className: cn(
141
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
142
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
143
+ className
144
+ ),
145
+ "aria-label": "Toggle theme",
146
+ ...props,
147
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
148
+ }
149
+ );
150
+ }
125
151
  const toggleTheme = () => {
126
152
  setTheme(resolvedTheme === "dark" ? "light" : "dark");
127
153
  };
@@ -256,10 +282,6 @@ function ThemeProviderNoSSR({
256
282
  }
257
283
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { ...props, children });
258
284
  }
259
-
260
- // src/themes/index.ts
261
- init_theme_context();
262
- init_theme_toggle2();
263
285
  function ClientThemeProvider({
264
286
  children,
265
287
  ...props
@@ -283,11 +305,46 @@ function ClientThemeToggle(props) {
283
305
  });
284
306
  }, []);
285
307
  if (!mounted || !ThemeToggleComponent) {
286
- return null;
308
+ return /* @__PURE__ */ jsxRuntime.jsx(
309
+ "button",
310
+ {
311
+ type: "button",
312
+ className: "inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10",
313
+ "aria-label": "Toggle theme",
314
+ ...props,
315
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
316
+ "svg",
317
+ {
318
+ width: "20",
319
+ height: "20",
320
+ viewBox: "0 0 24 24",
321
+ fill: "none",
322
+ stroke: "currentColor",
323
+ strokeWidth: "2",
324
+ strokeLinecap: "round",
325
+ strokeLinejoin: "round",
326
+ children: [
327
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "4" }),
328
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v2" }),
329
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 20v2" }),
330
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
331
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
332
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h2" }),
333
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 12h2" }),
334
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
335
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m19.07 4.93-1.41 1.41" })
336
+ ]
337
+ }
338
+ )
339
+ }
340
+ );
287
341
  }
288
342
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeToggleComponent, { ...props });
289
343
  }
290
344
 
345
+ // src/themes/index.ts
346
+ init_theme_context();
347
+
291
348
  // src/lib/theme-utils.ts
292
349
  var mapColorToShadcnVariant = (color) => {
293
350
  switch (color) {
@@ -347,15 +404,12 @@ var isDarkTheme = (theme, systemTheme) => {
347
404
 
348
405
  exports.ClientThemeProvider = ClientThemeProvider;
349
406
  exports.ClientThemeToggle = ClientThemeToggle;
350
- exports.ThemeContextProvider = ThemeContextProvider;
351
407
  exports.ThemeProvider = ThemeProvider;
352
408
  exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
353
- exports.ThemeToggle = ThemeToggle;
354
409
  exports.getColorVariantClasses = getColorVariantClasses;
355
410
  exports.isDarkTheme = isDarkTheme;
356
411
  exports.mapColorToShadcnVariant = mapColorToShadcnVariant;
357
412
  exports.mapVariantToShadcnVariant = mapVariantToShadcnVariant;
358
- exports.useTheme = useTheme;
359
413
  exports.useThemeServer = useThemeServer;
360
414
  //# sourceMappingURL=index.js.map
361
415
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/index.ts","../../src/themes/client-wrapper.tsx","../../src/lib/theme-utils.ts"],"names":["jsx","Fragment","React2","twMerge","clsx","React3","IconSun","IconMoon","jsxs","init_theme_toggle","React","React4","ThemeToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,cAAA,GAAiB;AAC/B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,QAAA;AAAA,IACP,QAAA,EAAU,CAAC,KAAA,KAAkB;AAAA,IAAC,CAAA;AAAA,IAC9B,aAAA,EAAe,OAAA;AAAA,IACf,MAAA,EAAQ;AAAA,GACV;AACF;AAMO,SAAS,oBAAA,CAAqB;AAAA,EACnC;AACF,CAAA,EAEG;AAED,EAAA,uBAAOA,cAAAA,CAAAC,mBAAAA,EAAA,EAAG,QAAA,EAAS,CAAA;AACrB;AAMO,SAAS,QAAA,GAAW;AAEzB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAUC,gBAAA,CAAA,QAAA,CAAS;AAAA,IAC/C,KAAA,EAAO,QAAA;AAAA,IACP,QAAA,EAAU,CAAC,KAAA,KAAkB;AAAA,IAAC,CAAA;AAAA,IAC9B,aAAA,EAAe,OAAA;AAAA,IACf,MAAA,EAAQ;AAAA,GACT,CAAA;AACD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAUA,0BAAS,KAAK,CAAA;AAElD,EAAMA,2BAAU,MAAM;AAEpB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAGnC,IAAA,OAAO,aAAa,CAAA,CAAE,IAAA,CAAK,CAAC,UAAA,KAAe;AAEzC,MAAA,MAAM,YAAA,GAAe;AAAA,QACnB,UAAU,MAAM;AAEd,UAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,YAAA,MAAM,UAAA,GAAa,YAAA,CAAa,OAAA,CAAQ,OAAO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AA;AAAY,MAAA,OAAO,OAAA;AAAA,IACxB;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AASO,IAAM,sBAAA,GAAyB,CACpC,KAAA,EACA,OAAA,KACW;AACX,EAAA,MAAM,eAAA,GAAwE;AAAA,IAC5E,OAAA,EAAS;AAAA,MACP,KAAA,EAAO,yEAAA;AAAA,MACP,KAAA,EAAO,yEAAA;AAAA,MACP,OAAA,EAAS,+EAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,IACA,SAAA,EAAW;AAAA,MACT,KAAA,EAAO,gFAAA;AAAA,MACP,KAAA,EAAO,gFAAA;AAAA,MACP,OAAA,EAAS,wFAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,IACA,QAAA,EAAU;AAAA,MACR,KAAA,EAAO,+DAAA;AAAA,MACP,KAAA,EAAO,+DAAA;AAAA,MACP,OAAA,EAAS,qEAAA;AAAA,MACT,OAAA,EAAS;AAAA;AACX,GACF;AAEA,EAAA,OAAO,eAAA,CAAgB,OAAO,CAAA,GAAI,KAAK,CAAA,IAAK,EAAA;AAC9C;AASO,IAAM,WAAA,GAAc,CAAC,KAAA,EAA2B,WAAA,KAA6C;AAClG,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,WAAA,KAAgB,MAAA;AAAA,EACzB;AACA,EAAA,OAAO,KAAA,KAAU,MAAA;AACnB","file":"index.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/**\n * Server-safe theme hook that can be used in Server Components\n * Returns default theme values without accessing client-side APIs\n */\nexport function useThemeServer() {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n}\n\n/**\n * @deprecated Use ThemeProvider from './theme-provider' instead\n * This component is kept for backward compatibility but is no longer needed\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n // This is now a no-op wrapper for backward compatibility\n return <>{children}</>;\n}\n\n/**\n * @deprecated Use useTheme from next-themes directly or use the ThemeProvider\n * This hook is kept for backward compatibility but is no longer needed\n */\nexport function useTheme() {\n // Import next-themes dynamically to avoid SSR issues\n const [themeData, setThemeData] = React.useState({\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n });\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only run on client side\n if (typeof window === 'undefined') return;\n\n // Import next-themes and use it properly\n import('next-themes').then((nextThemes) => {\n // Create a simple theme manager that doesn't violate hook rules\n const themeManager = {\n getTheme: () => {\n // Get theme from localStorage or system preference\n if (typeof window !== 'undefined') {\n const savedTheme = localStorage.getItem('theme');\n if (savedTheme) return savedTheme;\n \n // Check system preference\n if (window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n }\n return 'light';\n },\n setTheme: (theme: string) => {\n if (typeof window !== 'undefined') {\n localStorage.setItem('theme', theme);\n document.documentElement.classList.toggle('dark', theme === 'dark');\n // Trigger a re-render\n setThemeData(prev => ({\n ...prev,\n theme,\n resolvedTheme: theme,\n isDark: theme === 'dark'\n }));\n }\n }\n };\n\n const currentTheme = themeManager.getTheme();\n const isDark = currentTheme === 'dark';\n \n setThemeData({\n theme: currentTheme,\n setTheme: themeManager.setTheme,\n resolvedTheme: currentTheme,\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n return themeData;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) return null;\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n \n // Switch variant\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n textSizeClasses[size],\n resolvedTheme === \"dark\" \n ? \"bg-accent text-accent-foreground hover:bg-accent/80\" \n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}","export * from './theme-toggle';","\"use client\"\n\nimport * as React from \"react\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n * \n * IMPORTANT: This component must be used in a Client Component context.\n * For Server Components, use the NoSSR wrapper or dynamic imports.\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [NextThemesProvider, setNextThemesProvider] = React.useState<any>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\nexport { ThemeContextProvider, useTheme, useThemeServer } from './theme-context';\nexport { ThemeToggle } from '../components/ui/theme-toggle/index';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(undefined);\n\n React.useEffect(() => {\n setMounted(true);\n // Use dynamic import instead of require for ESM compatibility\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render nothing\n if (!mounted || !ThemeToggleComponent) {\n return null;\n }\n\n // Once mounted, render the theme toggle\n return <ThemeToggleComponent {...props} />;\n} ","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};"]}
1
+ {"version":3,"sources":["../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/client-wrapper.tsx","../../src/themes/index.ts","../../src/lib/theme-utils.ts"],"names":["React2","twMerge","clsx","jsx","IconSun","React3","IconMoon","jsxs","init_theme_toggle","React","React4","Fragment","ThemeToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;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EAAS;AAAA;AACX,GACF;AAEA,EAAA,OAAO,eAAA,CAAgB,OAAO,CAAA,GAAI,KAAK,CAAA,IAAK,EAAA;AAC9C;AASO,IAAM,WAAA,GAAc,CAAC,KAAA,EAA2B,WAAA,KAA6C;AAClG,EAAA,IAAI,UAAU,QAAA,EAAU;AACtB,IAAA,OAAO,WAAA,KAAgB,MAAA;AAAA,EACzB;AACA,EAAA,OAAO,KAAA,KAAU,MAAA;AACnB","file":"index.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\n/**\n * Server-safe theme hook that can be used in Server Components\n * Returns default theme values without accessing client-side APIs\n */\nexport function useThemeServer() {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n}\n\n/**\n * @deprecated Use ThemeProvider from './theme-provider' instead\n * This component is kept for backward compatibility but is no longer needed\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n // This is now a no-op wrapper for backward compatibility\n return <>{children}</>;\n}\n\n/**\n * @deprecated Use useTheme from next-themes directly or use the ThemeProvider\n * This hook is kept for backward compatibility but is no longer needed\n */\nexport function useTheme() {\n // Import next-themes dynamically to avoid SSR issues\n const [themeData, setThemeData] = React.useState({\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n });\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only run on client side\n if (typeof window === 'undefined') return;\n\n // Import next-themes and use it properly\n import('next-themes').then((nextThemes) => {\n // Create a simple theme manager that doesn't violate hook rules\n const themeManager = {\n getTheme: () => {\n // Get theme from localStorage or system preference\n if (typeof window !== 'undefined') {\n const savedTheme = localStorage.getItem('theme');\n if (savedTheme) return savedTheme;\n \n // Check system preference\n if (window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n }\n return 'light';\n },\n setTheme: (theme: string) => {\n if (typeof window !== 'undefined') {\n localStorage.setItem('theme', theme);\n document.documentElement.classList.toggle('dark', theme === 'dark');\n // Trigger a re-render\n setThemeData(prev => ({\n ...prev,\n theme,\n resolvedTheme: theme,\n isDark: theme === 'dark'\n }));\n }\n }\n };\n\n const currentTheme = themeManager.getTheme();\n const isDark = currentTheme === 'dark';\n \n setThemeData({\n theme: currentTheme,\n setTheme: themeManager.setTheme,\n resolvedTheme: currentTheme,\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n return themeData;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n * \n * IMPORTANT: This component uses React hooks and must only be used in Client Components.\n * For Server Components, use ClientThemeToggle from the themes package instead.\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n // Additional Server Component protection\n if (typeof window === 'undefined') {\n // Return a placeholder during SSR to prevent hydration issues\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n\n // Default variant (switch-like)\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n textSizeClasses[size],\n resolvedTheme === \"dark\"\n ? \"bg-accent text-accent-foreground hover:bg-accent/80\"\n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}","export * from './theme-toggle';","\"use client\"\n\nimport * as React from \"react\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n * \n * IMPORTANT: This component must be used in a Client Component context.\n * For Server Components, use the NoSSR wrapper or dynamic imports.\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [NextThemesProvider, setNextThemesProvider] = React.useState<any>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n * and provides a safe fallback for Server Components\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(undefined);\n\n React.useEffect(() => {\n setMounted(true);\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render a placeholder\n if (!mounted || !ThemeToggleComponent) {\n return (\n <button\n type=\"button\"\n className=\"inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10\"\n aria-label=\"Toggle theme\"\n {...props}\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2\" />\n <path d=\"M12 20v2\" />\n <path d=\"m4.93 4.93 1.41 1.41\" />\n <path d=\"m17.66 17.66 1.41 1.41\" />\n <path d=\"M2 12h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"m6.34 17.66-1.41 1.41\" />\n <path d=\"m19.07 4.93-1.41 1.41\" />\n </svg>\n </button>\n );\n }\n\n return <ThemeToggleComponent {...props} />;\n} ","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Server-safe theme hook\nexport { useThemeServer } from './theme-context';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n\n// NOTE: ThemeToggle and useTheme are NOT exported to prevent Server Component issues\n// Use ClientThemeToggle and useThemeServer instead for Server Component compatibility\n","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};"]}
@@ -22,11 +22,6 @@ function useThemeServer() {
22
22
  isDark: false
23
23
  };
24
24
  }
25
- function ThemeContextProvider({
26
- children
27
- }) {
28
- return /* @__PURE__ */ jsx(Fragment, { children });
29
- }
30
25
  function useTheme() {
31
26
  const [themeData, setThemeData] = React.useState({
32
27
  theme: "system",
@@ -94,12 +89,43 @@ function ThemeToggle({
94
89
  size = "md",
95
90
  ...props
96
91
  }) {
92
+ if (typeof window === "undefined") {
93
+ return /* @__PURE__ */ jsx(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ className: cn(
98
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
99
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
100
+ className
101
+ ),
102
+ "aria-label": "Toggle theme",
103
+ ...props,
104
+ children: /* @__PURE__ */ jsx(IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
105
+ }
106
+ );
107
+ }
97
108
  const { theme, setTheme, resolvedTheme } = useTheme();
98
109
  const [mounted, setMounted] = React.useState(false);
99
110
  React.useEffect(() => {
100
111
  setMounted(true);
101
112
  }, []);
102
- if (!mounted) return null;
113
+ if (!mounted) {
114
+ return /* @__PURE__ */ jsx(
115
+ "button",
116
+ {
117
+ type: "button",
118
+ className: cn(
119
+ "inline-flex items-center justify-center rounded-md border border-input bg-background",
120
+ size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
121
+ className
122
+ ),
123
+ "aria-label": "Toggle theme",
124
+ ...props,
125
+ children: /* @__PURE__ */ jsx(IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
126
+ }
127
+ );
128
+ }
103
129
  const toggleTheme = () => {
104
130
  setTheme(resolvedTheme === "dark" ? "light" : "dark");
105
131
  };
@@ -234,10 +260,6 @@ function ThemeProviderNoSSR({
234
260
  }
235
261
  return /* @__PURE__ */ jsx(ThemeProvider, { ...props, children });
236
262
  }
237
-
238
- // src/themes/index.ts
239
- init_theme_context();
240
- init_theme_toggle2();
241
263
  function ClientThemeProvider({
242
264
  children,
243
265
  ...props
@@ -261,11 +283,46 @@ function ClientThemeToggle(props) {
261
283
  });
262
284
  }, []);
263
285
  if (!mounted || !ThemeToggleComponent) {
264
- return null;
286
+ return /* @__PURE__ */ jsx(
287
+ "button",
288
+ {
289
+ type: "button",
290
+ className: "inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10",
291
+ "aria-label": "Toggle theme",
292
+ ...props,
293
+ children: /* @__PURE__ */ jsxs(
294
+ "svg",
295
+ {
296
+ width: "20",
297
+ height: "20",
298
+ viewBox: "0 0 24 24",
299
+ fill: "none",
300
+ stroke: "currentColor",
301
+ strokeWidth: "2",
302
+ strokeLinecap: "round",
303
+ strokeLinejoin: "round",
304
+ children: [
305
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
306
+ /* @__PURE__ */ jsx("path", { d: "M12 2v2" }),
307
+ /* @__PURE__ */ jsx("path", { d: "M12 20v2" }),
308
+ /* @__PURE__ */ jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
309
+ /* @__PURE__ */ jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
310
+ /* @__PURE__ */ jsx("path", { d: "M2 12h2" }),
311
+ /* @__PURE__ */ jsx("path", { d: "M20 12h2" }),
312
+ /* @__PURE__ */ jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
313
+ /* @__PURE__ */ jsx("path", { d: "m19.07 4.93-1.41 1.41" })
314
+ ]
315
+ }
316
+ )
317
+ }
318
+ );
265
319
  }
266
320
  return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
267
321
  }
268
322
 
323
+ // src/themes/index.ts
324
+ init_theme_context();
325
+
269
326
  // src/lib/theme-utils.ts
270
327
  var mapColorToShadcnVariant = (color) => {
271
328
  switch (color) {
@@ -323,6 +380,6 @@ var isDarkTheme = (theme, systemTheme) => {
323
380
  return theme === "dark";
324
381
  };
325
382
 
326
- export { ClientThemeProvider, ClientThemeToggle, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
383
+ export { ClientThemeProvider, ClientThemeToggle, ThemeProvider, ThemeProviderNoSSR, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useThemeServer };
327
384
  //# sourceMappingURL=index.mjs.map
328
385
  //# sourceMappingURL=index.mjs.map