@tydavidson/design-system 1.1.13 → 1.1.15
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 +105 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -94
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +10 -15
- package/dist/themes/index.d.ts +10 -15
- package/dist/themes/index.js +105 -94
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +101 -94
- package/dist/themes/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/themes/index.d.mts
CHANGED
@@ -60,21 +60,6 @@ declare function ThemeProvider({ children, ...props }: ThemeProviderProps): reac
|
|
60
60
|
*/
|
61
61
|
declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
62
62
|
|
63
|
-
/**
|
64
|
-
* Enhanced useTheme hook that works directly with next-themes
|
65
|
-
*
|
66
|
-
* This hook provides a simplified interface to next-themes with additional
|
67
|
-
* utility properties for better compatibility with Next.js App Router
|
68
|
-
*
|
69
|
-
* IMPORTANT: This hook must be used within a Client Component.
|
70
|
-
* For Server Components, use the useThemeServer hook instead.
|
71
|
-
*/
|
72
|
-
declare function useTheme(): {
|
73
|
-
theme: string;
|
74
|
-
setTheme: (theme: string) => void;
|
75
|
-
resolvedTheme: string;
|
76
|
-
isDark: boolean;
|
77
|
-
};
|
78
63
|
/**
|
79
64
|
* Server-safe theme hook that can be used in Server Components
|
80
65
|
* Returns default theme values without accessing client-side APIs
|
@@ -92,6 +77,16 @@ declare function useThemeServer(): {
|
|
92
77
|
declare function ThemeContextProvider({ children }: {
|
93
78
|
children: React.ReactNode;
|
94
79
|
}): react_jsx_runtime.JSX.Element;
|
80
|
+
/**
|
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
|
83
|
+
*/
|
84
|
+
declare function useTheme(): {
|
85
|
+
theme: string;
|
86
|
+
setTheme: (theme: string) => void;
|
87
|
+
resolvedTheme: string;
|
88
|
+
isDark: boolean;
|
89
|
+
};
|
95
90
|
|
96
91
|
/**
|
97
92
|
* Props for the ThemeToggle component
|
package/dist/themes/index.d.ts
CHANGED
@@ -60,21 +60,6 @@ declare function ThemeProvider({ children, ...props }: ThemeProviderProps): reac
|
|
60
60
|
*/
|
61
61
|
declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
62
62
|
|
63
|
-
/**
|
64
|
-
* Enhanced useTheme hook that works directly with next-themes
|
65
|
-
*
|
66
|
-
* This hook provides a simplified interface to next-themes with additional
|
67
|
-
* utility properties for better compatibility with Next.js App Router
|
68
|
-
*
|
69
|
-
* IMPORTANT: This hook must be used within a Client Component.
|
70
|
-
* For Server Components, use the useThemeServer hook instead.
|
71
|
-
*/
|
72
|
-
declare function useTheme(): {
|
73
|
-
theme: string;
|
74
|
-
setTheme: (theme: string) => void;
|
75
|
-
resolvedTheme: string;
|
76
|
-
isDark: boolean;
|
77
|
-
};
|
78
63
|
/**
|
79
64
|
* Server-safe theme hook that can be used in Server Components
|
80
65
|
* Returns default theme values without accessing client-side APIs
|
@@ -92,6 +77,16 @@ declare function useThemeServer(): {
|
|
92
77
|
declare function ThemeContextProvider({ children }: {
|
93
78
|
children: React.ReactNode;
|
94
79
|
}): react_jsx_runtime.JSX.Element;
|
80
|
+
/**
|
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
|
83
|
+
*/
|
84
|
+
declare function useTheme(): {
|
85
|
+
theme: string;
|
86
|
+
setTheme: (theme: string) => void;
|
87
|
+
resolvedTheme: string;
|
88
|
+
isDark: boolean;
|
89
|
+
};
|
95
90
|
|
96
91
|
/**
|
97
92
|
* Props for the ThemeToggle component
|
package/dist/themes/index.js
CHANGED
@@ -35,68 +35,20 @@ var __export = (target, all) => {
|
|
35
35
|
for (var name in all)
|
36
36
|
__defProp(target, name, { get: all[name], enumerable: true });
|
37
37
|
};
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
// Will need additional classes
|
53
|
-
default:
|
54
|
-
return "default";
|
55
|
-
}
|
56
|
-
};
|
57
|
-
exports.mapVariantToShadcnVariant = (variant) => {
|
58
|
-
switch (variant) {
|
59
|
-
case "primary":
|
60
|
-
return "default";
|
61
|
-
case "secondary":
|
62
|
-
return "outline";
|
63
|
-
case "tertiary":
|
64
|
-
return "ghost";
|
65
|
-
default:
|
66
|
-
return "default";
|
67
|
-
}
|
68
|
-
};
|
69
|
-
exports.getColorVariantClasses = (color, variant) => {
|
70
|
-
const colorVariantMap = {
|
71
|
-
primary: {
|
72
|
-
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
73
|
-
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
74
|
-
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
75
|
-
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
76
|
-
},
|
77
|
-
secondary: {
|
78
|
-
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
79
|
-
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
80
|
-
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
81
|
-
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
82
|
-
},
|
83
|
-
tertiary: {
|
84
|
-
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
85
|
-
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
86
|
-
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
87
|
-
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
88
|
-
}
|
89
|
-
};
|
90
|
-
return colorVariantMap[variant]?.[color] || "";
|
91
|
-
};
|
92
|
-
exports.isDarkTheme = (theme, systemTheme) => {
|
93
|
-
if (theme === "system") {
|
94
|
-
return systemTheme === "dark";
|
95
|
-
}
|
96
|
-
return theme === "dark";
|
97
|
-
};
|
98
|
-
}
|
99
|
-
});
|
38
|
+
function useThemeServer() {
|
39
|
+
return {
|
40
|
+
theme: "system",
|
41
|
+
setTheme: (theme) => {
|
42
|
+
},
|
43
|
+
resolvedTheme: "light",
|
44
|
+
isDark: false
|
45
|
+
};
|
46
|
+
}
|
47
|
+
function ThemeContextProvider({
|
48
|
+
children
|
49
|
+
}) {
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
51
|
+
}
|
100
52
|
function useTheme() {
|
101
53
|
const [themeData, setThemeData] = React__namespace.useState({
|
102
54
|
theme: "system",
|
@@ -107,47 +59,48 @@ function useTheme() {
|
|
107
59
|
});
|
108
60
|
const [mounted, setMounted] = React__namespace.useState(false);
|
109
61
|
React__namespace.useEffect(() => {
|
110
|
-
|
111
|
-
|
112
|
-
const
|
62
|
+
if (typeof window === "undefined") return;
|
63
|
+
import('next-themes').then((nextThemes) => {
|
64
|
+
const themeManager = {
|
65
|
+
getTheme: () => {
|
66
|
+
if (typeof window !== "undefined") {
|
67
|
+
const savedTheme = localStorage.getItem("theme");
|
68
|
+
if (savedTheme) return savedTheme;
|
69
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
70
|
+
return "dark";
|
71
|
+
}
|
72
|
+
}
|
73
|
+
return "light";
|
74
|
+
},
|
75
|
+
setTheme: (theme) => {
|
76
|
+
if (typeof window !== "undefined") {
|
77
|
+
localStorage.setItem("theme", theme);
|
78
|
+
document.documentElement.classList.toggle("dark", theme === "dark");
|
79
|
+
setThemeData((prev) => ({
|
80
|
+
...prev,
|
81
|
+
theme,
|
82
|
+
resolvedTheme: theme,
|
83
|
+
isDark: theme === "dark"
|
84
|
+
}));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
};
|
88
|
+
const currentTheme = themeManager.getTheme();
|
89
|
+
const isDark = currentTheme === "dark";
|
113
90
|
setThemeData({
|
114
|
-
theme:
|
115
|
-
setTheme,
|
116
|
-
resolvedTheme:
|
91
|
+
theme: currentTheme,
|
92
|
+
setTheme: themeManager.setTheme,
|
93
|
+
resolvedTheme: currentTheme,
|
117
94
|
isDark
|
118
95
|
});
|
119
96
|
setMounted(true);
|
120
97
|
});
|
121
98
|
}, []);
|
122
|
-
if (!mounted) {
|
123
|
-
return {
|
124
|
-
theme: "system",
|
125
|
-
setTheme: (theme) => {
|
126
|
-
},
|
127
|
-
resolvedTheme: "light",
|
128
|
-
isDark: false
|
129
|
-
};
|
130
|
-
}
|
131
99
|
return themeData;
|
132
100
|
}
|
133
|
-
function useThemeServer() {
|
134
|
-
return {
|
135
|
-
theme: "system",
|
136
|
-
setTheme: (theme) => {
|
137
|
-
},
|
138
|
-
resolvedTheme: "light",
|
139
|
-
isDark: false
|
140
|
-
};
|
141
|
-
}
|
142
|
-
function ThemeContextProvider({
|
143
|
-
children
|
144
|
-
}) {
|
145
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
146
|
-
}
|
147
101
|
var init_theme_context = __esm({
|
148
102
|
"src/themes/theme-context.tsx"() {
|
149
103
|
"use client";
|
150
|
-
init_theme_utils();
|
151
104
|
}
|
152
105
|
});
|
153
106
|
function cn(...inputs) {
|
@@ -335,8 +288,62 @@ function ClientThemeToggle(props) {
|
|
335
288
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeToggleComponent, { ...props });
|
336
289
|
}
|
337
290
|
|
338
|
-
// src/
|
339
|
-
|
291
|
+
// src/lib/theme-utils.ts
|
292
|
+
var mapColorToShadcnVariant = (color) => {
|
293
|
+
switch (color) {
|
294
|
+
case "brand":
|
295
|
+
return "default";
|
296
|
+
case "error":
|
297
|
+
return "destructive";
|
298
|
+
case "warning":
|
299
|
+
case "success":
|
300
|
+
return "secondary";
|
301
|
+
// Will need additional classes
|
302
|
+
default:
|
303
|
+
return "default";
|
304
|
+
}
|
305
|
+
};
|
306
|
+
var mapVariantToShadcnVariant = (variant) => {
|
307
|
+
switch (variant) {
|
308
|
+
case "primary":
|
309
|
+
return "default";
|
310
|
+
case "secondary":
|
311
|
+
return "outline";
|
312
|
+
case "tertiary":
|
313
|
+
return "ghost";
|
314
|
+
default:
|
315
|
+
return "default";
|
316
|
+
}
|
317
|
+
};
|
318
|
+
var getColorVariantClasses = (color, variant) => {
|
319
|
+
const colorVariantMap = {
|
320
|
+
primary: {
|
321
|
+
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
322
|
+
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
323
|
+
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
324
|
+
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
325
|
+
},
|
326
|
+
secondary: {
|
327
|
+
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
328
|
+
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
329
|
+
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
330
|
+
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
331
|
+
},
|
332
|
+
tertiary: {
|
333
|
+
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
334
|
+
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
335
|
+
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
336
|
+
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
337
|
+
}
|
338
|
+
};
|
339
|
+
return colorVariantMap[variant]?.[color] || "";
|
340
|
+
};
|
341
|
+
var isDarkTheme = (theme, systemTheme) => {
|
342
|
+
if (theme === "system") {
|
343
|
+
return systemTheme === "dark";
|
344
|
+
}
|
345
|
+
return theme === "dark";
|
346
|
+
};
|
340
347
|
|
341
348
|
exports.ClientThemeProvider = ClientThemeProvider;
|
342
349
|
exports.ClientThemeToggle = ClientThemeToggle;
|
@@ -344,6 +351,10 @@ exports.ThemeContextProvider = ThemeContextProvider;
|
|
344
351
|
exports.ThemeProvider = ThemeProvider;
|
345
352
|
exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
|
346
353
|
exports.ThemeToggle = ThemeToggle;
|
354
|
+
exports.getColorVariantClasses = getColorVariantClasses;
|
355
|
+
exports.isDarkTheme = isDarkTheme;
|
356
|
+
exports.mapColorToShadcnVariant = mapColorToShadcnVariant;
|
357
|
+
exports.mapVariantToShadcnVariant = mapVariantToShadcnVariant;
|
347
358
|
exports.useTheme = useTheme;
|
348
359
|
exports.useThemeServer = useThemeServer;
|
349
360
|
//# sourceMappingURL=index.js.map
|
package/dist/themes/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/lib/theme-utils.ts","../../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"],"names":["mapColorToShadcnVariant","mapVariantToShadcnVariant","getColorVariantClasses","isDarkTheme","React2","jsx","Fragment","twMerge","clsx","React3","IconSun","IconMoon","jsxs","init_theme_toggle","React","React4","ThemeToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBaA,wCAAA,CAAA,CAiBAC,4CAgBAC,uCAAA,CAAA,CAmCAC;AAxFb,IAAA,gBAAA,GAAA,KAAA,CAAA;AAAA,EAAA,wBAAA,GAAA;AAoBO,IAAMH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,OAAA,IAAW,CAAC,oBAAA,EAAsB;AACrC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,uBAAOX,cAAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,CAAA;AAC1C;;;ADhDA,gBAAA,EAAA","file":"index.js","sourcesContent":["/**\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};","\"use client\"\n\nimport * as React from \"react\"\nimport { isDarkTheme } from \"../lib/theme-utils\"\n\n/**\n * Enhanced useTheme hook that works directly with next-themes\n * \n * This hook provides a simplified interface to next-themes with additional\n * utility properties for better compatibility with Next.js App Router\n * \n * IMPORTANT: This hook must be used within a Client Component.\n * For Server Components, use the useThemeServer hook instead.\n */\nexport function useTheme() {\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 import next-themes on the client side\n import('next-themes').then(({ useTheme: useNextTheme }) => {\n const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();\n const isDark = isDarkTheme(theme, systemTheme);\n \n setThemeData({\n theme: theme || \"system\",\n setTheme,\n resolvedTheme: resolvedTheme || \"light\",\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n // Return default values during SSR or before mounting\n if (!mounted) {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n }\n\n return themeData;\n}\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}","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} "]}
|
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,U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A;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,WAAA;AAAa,MAAA,OAAO,SAAA;AAAA,IACzB,KAAK,UAAA;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};"]}
|
package/dist/themes/index.mjs
CHANGED
@@ -13,68 +13,20 @@ var __export = (target, all) => {
|
|
13
13
|
for (var name in all)
|
14
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
15
15
|
};
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
// Will need additional classes
|
31
|
-
default:
|
32
|
-
return "default";
|
33
|
-
}
|
34
|
-
};
|
35
|
-
mapVariantToShadcnVariant = (variant) => {
|
36
|
-
switch (variant) {
|
37
|
-
case "primary":
|
38
|
-
return "default";
|
39
|
-
case "secondary":
|
40
|
-
return "outline";
|
41
|
-
case "tertiary":
|
42
|
-
return "ghost";
|
43
|
-
default:
|
44
|
-
return "default";
|
45
|
-
}
|
46
|
-
};
|
47
|
-
getColorVariantClasses = (color, variant) => {
|
48
|
-
const colorVariantMap = {
|
49
|
-
primary: {
|
50
|
-
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
51
|
-
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
52
|
-
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
53
|
-
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
54
|
-
},
|
55
|
-
secondary: {
|
56
|
-
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
57
|
-
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
58
|
-
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
59
|
-
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
60
|
-
},
|
61
|
-
tertiary: {
|
62
|
-
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
63
|
-
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
64
|
-
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
65
|
-
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
66
|
-
}
|
67
|
-
};
|
68
|
-
return colorVariantMap[variant]?.[color] || "";
|
69
|
-
};
|
70
|
-
isDarkTheme = (theme, systemTheme) => {
|
71
|
-
if (theme === "system") {
|
72
|
-
return systemTheme === "dark";
|
73
|
-
}
|
74
|
-
return theme === "dark";
|
75
|
-
};
|
76
|
-
}
|
77
|
-
});
|
16
|
+
function useThemeServer() {
|
17
|
+
return {
|
18
|
+
theme: "system",
|
19
|
+
setTheme: (theme) => {
|
20
|
+
},
|
21
|
+
resolvedTheme: "light",
|
22
|
+
isDark: false
|
23
|
+
};
|
24
|
+
}
|
25
|
+
function ThemeContextProvider({
|
26
|
+
children
|
27
|
+
}) {
|
28
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
29
|
+
}
|
78
30
|
function useTheme() {
|
79
31
|
const [themeData, setThemeData] = React.useState({
|
80
32
|
theme: "system",
|
@@ -85,47 +37,48 @@ function useTheme() {
|
|
85
37
|
});
|
86
38
|
const [mounted, setMounted] = React.useState(false);
|
87
39
|
React.useEffect(() => {
|
88
|
-
|
89
|
-
|
90
|
-
const
|
40
|
+
if (typeof window === "undefined") return;
|
41
|
+
import('next-themes').then((nextThemes) => {
|
42
|
+
const themeManager = {
|
43
|
+
getTheme: () => {
|
44
|
+
if (typeof window !== "undefined") {
|
45
|
+
const savedTheme = localStorage.getItem("theme");
|
46
|
+
if (savedTheme) return savedTheme;
|
47
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
48
|
+
return "dark";
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return "light";
|
52
|
+
},
|
53
|
+
setTheme: (theme) => {
|
54
|
+
if (typeof window !== "undefined") {
|
55
|
+
localStorage.setItem("theme", theme);
|
56
|
+
document.documentElement.classList.toggle("dark", theme === "dark");
|
57
|
+
setThemeData((prev) => ({
|
58
|
+
...prev,
|
59
|
+
theme,
|
60
|
+
resolvedTheme: theme,
|
61
|
+
isDark: theme === "dark"
|
62
|
+
}));
|
63
|
+
}
|
64
|
+
}
|
65
|
+
};
|
66
|
+
const currentTheme = themeManager.getTheme();
|
67
|
+
const isDark = currentTheme === "dark";
|
91
68
|
setThemeData({
|
92
|
-
theme:
|
93
|
-
setTheme,
|
94
|
-
resolvedTheme:
|
69
|
+
theme: currentTheme,
|
70
|
+
setTheme: themeManager.setTheme,
|
71
|
+
resolvedTheme: currentTheme,
|
95
72
|
isDark
|
96
73
|
});
|
97
74
|
setMounted(true);
|
98
75
|
});
|
99
76
|
}, []);
|
100
|
-
if (!mounted) {
|
101
|
-
return {
|
102
|
-
theme: "system",
|
103
|
-
setTheme: (theme) => {
|
104
|
-
},
|
105
|
-
resolvedTheme: "light",
|
106
|
-
isDark: false
|
107
|
-
};
|
108
|
-
}
|
109
77
|
return themeData;
|
110
78
|
}
|
111
|
-
function useThemeServer() {
|
112
|
-
return {
|
113
|
-
theme: "system",
|
114
|
-
setTheme: (theme) => {
|
115
|
-
},
|
116
|
-
resolvedTheme: "light",
|
117
|
-
isDark: false
|
118
|
-
};
|
119
|
-
}
|
120
|
-
function ThemeContextProvider({
|
121
|
-
children
|
122
|
-
}) {
|
123
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
124
|
-
}
|
125
79
|
var init_theme_context = __esm({
|
126
80
|
"src/themes/theme-context.tsx"() {
|
127
81
|
"use client";
|
128
|
-
init_theme_utils();
|
129
82
|
}
|
130
83
|
});
|
131
84
|
function cn(...inputs) {
|
@@ -313,8 +266,62 @@ function ClientThemeToggle(props) {
|
|
313
266
|
return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
|
314
267
|
}
|
315
268
|
|
316
|
-
// src/
|
317
|
-
|
269
|
+
// src/lib/theme-utils.ts
|
270
|
+
var mapColorToShadcnVariant = (color) => {
|
271
|
+
switch (color) {
|
272
|
+
case "brand":
|
273
|
+
return "default";
|
274
|
+
case "error":
|
275
|
+
return "destructive";
|
276
|
+
case "warning":
|
277
|
+
case "success":
|
278
|
+
return "secondary";
|
279
|
+
// Will need additional classes
|
280
|
+
default:
|
281
|
+
return "default";
|
282
|
+
}
|
283
|
+
};
|
284
|
+
var mapVariantToShadcnVariant = (variant) => {
|
285
|
+
switch (variant) {
|
286
|
+
case "primary":
|
287
|
+
return "default";
|
288
|
+
case "secondary":
|
289
|
+
return "outline";
|
290
|
+
case "tertiary":
|
291
|
+
return "ghost";
|
292
|
+
default:
|
293
|
+
return "default";
|
294
|
+
}
|
295
|
+
};
|
296
|
+
var getColorVariantClasses = (color, variant) => {
|
297
|
+
const colorVariantMap = {
|
298
|
+
primary: {
|
299
|
+
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
300
|
+
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
301
|
+
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
302
|
+
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
303
|
+
},
|
304
|
+
secondary: {
|
305
|
+
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
306
|
+
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
307
|
+
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
308
|
+
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
309
|
+
},
|
310
|
+
tertiary: {
|
311
|
+
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
312
|
+
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
313
|
+
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
314
|
+
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
315
|
+
}
|
316
|
+
};
|
317
|
+
return colorVariantMap[variant]?.[color] || "";
|
318
|
+
};
|
319
|
+
var isDarkTheme = (theme, systemTheme) => {
|
320
|
+
if (theme === "system") {
|
321
|
+
return systemTheme === "dark";
|
322
|
+
}
|
323
|
+
return theme === "dark";
|
324
|
+
};
|
318
325
|
|
319
326
|
export { ClientThemeProvider, ClientThemeToggle, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
320
327
|
//# sourceMappingURL=index.mjs.map
|