@tydavidson/design-system 1.1.7 → 1.1.9
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +372 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +364 -174
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +41 -2
- package/dist/themes/index.d.ts +41 -2
- package/dist/themes/index.js +219 -66
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +211 -63
- package/dist/themes/index.mjs.map +1 -1
- package/docs/setup-guide.md +101 -4
- package/docs/troubleshooting.md +22 -4
- package/package.json +1 -1
package/dist/themes/index.d.mts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
3
|
import * as React$1 from 'react';
|
4
|
+
import { ComponentType } from 'react';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Utility functions for theme handling
|
@@ -49,14 +50,25 @@ declare const isDarkTheme: (theme: string | undefined, systemTheme: string | und
|
|
49
50
|
*
|
50
51
|
* This wraps the next-themes provider with sensible defaults
|
51
52
|
* for handling light/dark themes and system preferences
|
53
|
+
*
|
54
|
+
* IMPORTANT: This component must be used in a Client Component context.
|
55
|
+
* For Server Components, use the NoSSR wrapper or dynamic imports.
|
52
56
|
*/
|
53
57
|
declare function ThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
58
|
+
/**
|
59
|
+
* NoSSR wrapper for theme provider to prevent SSR issues
|
60
|
+
* Use this when you need to ensure the theme provider only renders on the client
|
61
|
+
*/
|
62
|
+
declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
54
63
|
|
55
64
|
/**
|
56
65
|
* Enhanced useTheme hook that works directly with next-themes
|
57
66
|
*
|
58
67
|
* This hook provides a simplified interface to next-themes with additional
|
59
68
|
* utility properties for better compatibility with Next.js App Router
|
69
|
+
*
|
70
|
+
* IMPORTANT: This hook must be used within a Client Component.
|
71
|
+
* For Server Components, use the useThemeServer hook instead.
|
60
72
|
*/
|
61
73
|
declare function useTheme(): {
|
62
74
|
theme: string;
|
@@ -64,12 +76,22 @@ declare function useTheme(): {
|
|
64
76
|
resolvedTheme: string;
|
65
77
|
isDark: boolean;
|
66
78
|
};
|
79
|
+
/**
|
80
|
+
* Server-safe theme hook that can be used in Server Components
|
81
|
+
* Returns default theme values without accessing client-side APIs
|
82
|
+
*/
|
83
|
+
declare function useThemeServer(): {
|
84
|
+
theme: string;
|
85
|
+
setTheme: (theme: string) => void;
|
86
|
+
resolvedTheme: string;
|
87
|
+
isDark: boolean;
|
88
|
+
};
|
67
89
|
/**
|
68
90
|
* @deprecated Use ThemeProvider from './theme-provider' instead
|
69
91
|
* This component is kept for backward compatibility but is no longer needed
|
70
92
|
*/
|
71
93
|
declare function ThemeContextProvider({ children }: {
|
72
|
-
children: React.ReactNode;
|
94
|
+
children: React$1.ReactNode;
|
73
95
|
}): react_jsx_runtime.JSX.Element;
|
74
96
|
|
75
97
|
/**
|
@@ -92,4 +114,21 @@ interface ThemeToggleProps extends React$1.HTMLAttributes<HTMLButtonElement> {
|
|
92
114
|
*/
|
93
115
|
declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
|
94
116
|
|
95
|
-
|
117
|
+
/**
|
118
|
+
* Dynamically import theme components to prevent SSR issues
|
119
|
+
* Use these imports when you need to use theme components in Server Components
|
120
|
+
*/
|
121
|
+
declare const DynamicThemeProvider: ComponentType<any>;
|
122
|
+
declare const DynamicThemeProviderNoSSR: ComponentType<any>;
|
123
|
+
declare const DynamicThemeToggle: ComponentType<any>;
|
124
|
+
/**
|
125
|
+
* Safe theme provider for Next.js App Router
|
126
|
+
* Automatically handles Server Component compatibility
|
127
|
+
*/
|
128
|
+
declare function SafeThemeProvider({ children, noSSR, ...props }: {
|
129
|
+
children: React.ReactNode;
|
130
|
+
noSSR?: boolean;
|
131
|
+
[key: string]: any;
|
132
|
+
}): react_jsx_runtime.JSX.Element;
|
133
|
+
|
134
|
+
export { type ComponentVariant, DynamicThemeProvider, DynamicThemeProviderNoSSR, DynamicThemeToggle, SafeThemeProvider, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
package/dist/themes/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
3
|
import * as React$1 from 'react';
|
4
|
+
import { ComponentType } from 'react';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Utility functions for theme handling
|
@@ -49,14 +50,25 @@ declare const isDarkTheme: (theme: string | undefined, systemTheme: string | und
|
|
49
50
|
*
|
50
51
|
* This wraps the next-themes provider with sensible defaults
|
51
52
|
* for handling light/dark themes and system preferences
|
53
|
+
*
|
54
|
+
* IMPORTANT: This component must be used in a Client Component context.
|
55
|
+
* For Server Components, use the NoSSR wrapper or dynamic imports.
|
52
56
|
*/
|
53
57
|
declare function ThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
58
|
+
/**
|
59
|
+
* NoSSR wrapper for theme provider to prevent SSR issues
|
60
|
+
* Use this when you need to ensure the theme provider only renders on the client
|
61
|
+
*/
|
62
|
+
declare function ThemeProviderNoSSR({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
54
63
|
|
55
64
|
/**
|
56
65
|
* Enhanced useTheme hook that works directly with next-themes
|
57
66
|
*
|
58
67
|
* This hook provides a simplified interface to next-themes with additional
|
59
68
|
* utility properties for better compatibility with Next.js App Router
|
69
|
+
*
|
70
|
+
* IMPORTANT: This hook must be used within a Client Component.
|
71
|
+
* For Server Components, use the useThemeServer hook instead.
|
60
72
|
*/
|
61
73
|
declare function useTheme(): {
|
62
74
|
theme: string;
|
@@ -64,12 +76,22 @@ declare function useTheme(): {
|
|
64
76
|
resolvedTheme: string;
|
65
77
|
isDark: boolean;
|
66
78
|
};
|
79
|
+
/**
|
80
|
+
* Server-safe theme hook that can be used in Server Components
|
81
|
+
* Returns default theme values without accessing client-side APIs
|
82
|
+
*/
|
83
|
+
declare function useThemeServer(): {
|
84
|
+
theme: string;
|
85
|
+
setTheme: (theme: string) => void;
|
86
|
+
resolvedTheme: string;
|
87
|
+
isDark: boolean;
|
88
|
+
};
|
67
89
|
/**
|
68
90
|
* @deprecated Use ThemeProvider from './theme-provider' instead
|
69
91
|
* This component is kept for backward compatibility but is no longer needed
|
70
92
|
*/
|
71
93
|
declare function ThemeContextProvider({ children }: {
|
72
|
-
children: React.ReactNode;
|
94
|
+
children: React$1.ReactNode;
|
73
95
|
}): react_jsx_runtime.JSX.Element;
|
74
96
|
|
75
97
|
/**
|
@@ -92,4 +114,21 @@ interface ThemeToggleProps extends React$1.HTMLAttributes<HTMLButtonElement> {
|
|
92
114
|
*/
|
93
115
|
declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
|
94
116
|
|
95
|
-
|
117
|
+
/**
|
118
|
+
* Dynamically import theme components to prevent SSR issues
|
119
|
+
* Use these imports when you need to use theme components in Server Components
|
120
|
+
*/
|
121
|
+
declare const DynamicThemeProvider: ComponentType<any>;
|
122
|
+
declare const DynamicThemeProviderNoSSR: ComponentType<any>;
|
123
|
+
declare const DynamicThemeToggle: ComponentType<any>;
|
124
|
+
/**
|
125
|
+
* Safe theme provider for Next.js App Router
|
126
|
+
* Automatically handles Server Component compatibility
|
127
|
+
*/
|
128
|
+
declare function SafeThemeProvider({ children, noSSR, ...props }: {
|
129
|
+
children: React.ReactNode;
|
130
|
+
noSSR?: boolean;
|
131
|
+
[key: string]: any;
|
132
|
+
}): react_jsx_runtime.JSX.Element;
|
133
|
+
|
134
|
+
export { type ComponentVariant, DynamicThemeProvider, DynamicThemeProviderNoSSR, DynamicThemeToggle, SafeThemeProvider, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
package/dist/themes/index.js
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var nextThemes = require('next-themes');
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
5
3
|
var React = require('react');
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
6
5
|
var clsx = require('clsx');
|
7
6
|
var tailwindMerge = require('tailwind-merge');
|
8
7
|
var iconsReact = require('@tabler/icons-react');
|
8
|
+
var dynamic = require('next/dynamic');
|
9
|
+
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
9
11
|
|
10
12
|
function _interopNamespace(e) {
|
11
13
|
if (e && e.__esModule) return e;
|
@@ -26,14 +28,41 @@ function _interopNamespace(e) {
|
|
26
28
|
}
|
27
29
|
|
28
30
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
31
|
+
var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
|
32
|
+
|
33
|
+
var __defProp = Object.defineProperty;
|
34
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
35
|
+
var __esm = (fn, res) => function __init() {
|
36
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
37
|
+
};
|
38
|
+
var __export = (target, all) => {
|
39
|
+
for (var name in all)
|
40
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
41
|
+
};
|
29
42
|
|
30
43
|
// src/themes/theme-provider.tsx
|
44
|
+
var theme_provider_exports = {};
|
45
|
+
__export(theme_provider_exports, {
|
46
|
+
ThemeProvider: () => ThemeProvider,
|
47
|
+
ThemeProviderNoSSR: () => ThemeProviderNoSSR
|
48
|
+
});
|
31
49
|
function ThemeProvider({
|
32
50
|
children,
|
33
51
|
...props
|
34
52
|
}) {
|
53
|
+
const [NextThemesProvider, setNextThemesProvider] = React__namespace.useState(null);
|
54
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
55
|
+
React__namespace.useEffect(() => {
|
56
|
+
import('next-themes').then(({ ThemeProvider: Provider }) => {
|
57
|
+
setNextThemesProvider(() => Provider);
|
58
|
+
setMounted(true);
|
59
|
+
});
|
60
|
+
}, []);
|
61
|
+
if (!mounted || !NextThemesProvider) {
|
62
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
63
|
+
}
|
35
64
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
36
|
-
|
65
|
+
NextThemesProvider,
|
37
66
|
{
|
38
67
|
attribute: "class",
|
39
68
|
defaultTheme: "system",
|
@@ -44,71 +73,126 @@ function ThemeProvider({
|
|
44
73
|
}
|
45
74
|
);
|
46
75
|
}
|
76
|
+
function ThemeProviderNoSSR({
|
77
|
+
children,
|
78
|
+
...props
|
79
|
+
}) {
|
80
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
81
|
+
React__namespace.useEffect(() => {
|
82
|
+
setMounted(true);
|
83
|
+
}, []);
|
84
|
+
if (!mounted) {
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
86
|
+
}
|
87
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { ...props, children });
|
88
|
+
}
|
89
|
+
var init_theme_provider = __esm({
|
90
|
+
"src/themes/theme-provider.tsx"() {
|
91
|
+
"use client";
|
92
|
+
}
|
93
|
+
});
|
47
94
|
|
48
95
|
// src/lib/theme-utils.ts
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
96
|
+
exports.mapColorToShadcnVariant = void 0; exports.mapVariantToShadcnVariant = void 0; exports.getColorVariantClasses = void 0; exports.isDarkTheme = void 0;
|
97
|
+
var init_theme_utils = __esm({
|
98
|
+
"src/lib/theme-utils.ts"() {
|
99
|
+
exports.mapColorToShadcnVariant = (color) => {
|
100
|
+
switch (color) {
|
101
|
+
case "brand":
|
102
|
+
return "default";
|
103
|
+
case "error":
|
104
|
+
return "destructive";
|
105
|
+
case "warning":
|
106
|
+
case "success":
|
107
|
+
return "secondary";
|
108
|
+
// Will need additional classes
|
109
|
+
default:
|
110
|
+
return "default";
|
111
|
+
}
|
112
|
+
};
|
113
|
+
exports.mapVariantToShadcnVariant = (variant) => {
|
114
|
+
switch (variant) {
|
115
|
+
case "primary":
|
116
|
+
return "default";
|
117
|
+
case "secondary":
|
118
|
+
return "outline";
|
119
|
+
case "tertiary":
|
120
|
+
return "ghost";
|
121
|
+
default:
|
122
|
+
return "default";
|
123
|
+
}
|
124
|
+
};
|
125
|
+
exports.getColorVariantClasses = (color, variant) => {
|
126
|
+
const colorVariantMap = {
|
127
|
+
primary: {
|
128
|
+
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
129
|
+
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
130
|
+
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
131
|
+
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
132
|
+
},
|
133
|
+
secondary: {
|
134
|
+
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
135
|
+
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
136
|
+
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
137
|
+
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
138
|
+
},
|
139
|
+
tertiary: {
|
140
|
+
brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
141
|
+
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
142
|
+
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
143
|
+
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
144
|
+
}
|
145
|
+
};
|
146
|
+
return colorVariantMap[variant]?.[color] || "";
|
147
|
+
};
|
148
|
+
exports.isDarkTheme = (theme, systemTheme) => {
|
149
|
+
if (theme === "system") {
|
150
|
+
return systemTheme === "dark";
|
151
|
+
}
|
152
|
+
return theme === "dark";
|
153
|
+
};
|
73
154
|
}
|
74
|
-
};
|
75
|
-
|
76
|
-
const
|
77
|
-
|
78
|
-
|
79
|
-
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
80
|
-
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
81
|
-
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
82
|
-
},
|
83
|
-
secondary: {
|
84
|
-
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
85
|
-
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
86
|
-
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
87
|
-
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
155
|
+
});
|
156
|
+
function useTheme() {
|
157
|
+
const [themeData, setThemeData] = React__namespace.useState({
|
158
|
+
theme: "system",
|
159
|
+
setTheme: (theme) => {
|
88
160
|
},
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
161
|
+
resolvedTheme: "light",
|
162
|
+
isDark: false
|
163
|
+
});
|
164
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
165
|
+
React__namespace.useEffect(() => {
|
166
|
+
import('next-themes').then(({ useTheme: useNextTheme }) => {
|
167
|
+
const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();
|
168
|
+
const isDark = exports.isDarkTheme(theme, systemTheme);
|
169
|
+
setThemeData({
|
170
|
+
theme: theme || "system",
|
171
|
+
setTheme,
|
172
|
+
resolvedTheme: resolvedTheme || "light",
|
173
|
+
isDark
|
174
|
+
});
|
175
|
+
setMounted(true);
|
176
|
+
});
|
177
|
+
}, []);
|
178
|
+
if (!mounted) {
|
179
|
+
return {
|
180
|
+
theme: "system",
|
181
|
+
setTheme: (theme) => {
|
182
|
+
},
|
183
|
+
resolvedTheme: "light",
|
184
|
+
isDark: false
|
185
|
+
};
|
101
186
|
}
|
102
|
-
return
|
103
|
-
}
|
104
|
-
function
|
105
|
-
const { theme, setTheme, resolvedTheme, systemTheme } = nextThemes.useTheme();
|
106
|
-
const isDark = isDarkTheme(theme, systemTheme);
|
187
|
+
return themeData;
|
188
|
+
}
|
189
|
+
function useThemeServer() {
|
107
190
|
return {
|
108
|
-
theme:
|
109
|
-
setTheme
|
110
|
-
|
111
|
-
|
191
|
+
theme: "system",
|
192
|
+
setTheme: (theme) => {
|
193
|
+
},
|
194
|
+
resolvedTheme: "light",
|
195
|
+
isDark: false
|
112
196
|
};
|
113
197
|
}
|
114
198
|
function ThemeContextProvider({
|
@@ -116,9 +200,19 @@ function ThemeContextProvider({
|
|
116
200
|
}) {
|
117
201
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
118
202
|
}
|
203
|
+
var init_theme_context = __esm({
|
204
|
+
"src/themes/theme-context.tsx"() {
|
205
|
+
"use client";
|
206
|
+
init_theme_utils();
|
207
|
+
}
|
208
|
+
});
|
119
209
|
function cn(...inputs) {
|
120
210
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
121
211
|
}
|
212
|
+
var init_utils = __esm({
|
213
|
+
"src/lib/utils.ts"() {
|
214
|
+
}
|
215
|
+
});
|
122
216
|
function ThemeToggle({
|
123
217
|
className,
|
124
218
|
variant = "icon",
|
@@ -206,14 +300,73 @@ function ThemeToggle({
|
|
206
300
|
}
|
207
301
|
);
|
208
302
|
}
|
303
|
+
var init_theme_toggle = __esm({
|
304
|
+
"src/components/ui/theme-toggle/theme-toggle.tsx"() {
|
305
|
+
"use client";
|
306
|
+
init_theme_context();
|
307
|
+
init_utils();
|
308
|
+
}
|
309
|
+
});
|
310
|
+
|
311
|
+
// src/components/ui/theme-toggle/index.ts
|
312
|
+
var theme_toggle_exports = {};
|
313
|
+
__export(theme_toggle_exports, {
|
314
|
+
ThemeToggle: () => ThemeToggle
|
315
|
+
});
|
316
|
+
var init_theme_toggle2 = __esm({
|
317
|
+
"src/components/ui/theme-toggle/index.ts"() {
|
318
|
+
init_theme_toggle();
|
319
|
+
}
|
320
|
+
});
|
321
|
+
|
322
|
+
// src/themes/index.ts
|
323
|
+
init_theme_provider();
|
324
|
+
init_theme_context();
|
325
|
+
init_theme_toggle2();
|
326
|
+
var DynamicThemeProvider = dynamic__default.default(
|
327
|
+
() => Promise.resolve().then(() => (init_theme_provider(), theme_provider_exports)).then((mod) => ({ default: mod.ThemeProvider })),
|
328
|
+
{
|
329
|
+
ssr: false,
|
330
|
+
loading: () => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" } })
|
331
|
+
}
|
332
|
+
);
|
333
|
+
var DynamicThemeProviderNoSSR = dynamic__default.default(
|
334
|
+
() => Promise.resolve().then(() => (init_theme_provider(), theme_provider_exports)).then((mod) => ({ default: mod.ThemeProviderNoSSR })),
|
335
|
+
{
|
336
|
+
ssr: false,
|
337
|
+
loading: () => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" } })
|
338
|
+
}
|
339
|
+
);
|
340
|
+
var DynamicThemeToggle = dynamic__default.default(
|
341
|
+
() => Promise.resolve().then(() => (init_theme_toggle2(), theme_toggle_exports)).then((mod) => ({ default: mod.ThemeToggle })),
|
342
|
+
{
|
343
|
+
ssr: false,
|
344
|
+
loading: () => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" } })
|
345
|
+
}
|
346
|
+
);
|
347
|
+
function SafeThemeProvider({
|
348
|
+
children,
|
349
|
+
noSSR = false,
|
350
|
+
...props
|
351
|
+
}) {
|
352
|
+
if (noSSR) {
|
353
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DynamicThemeProviderNoSSR, { ...props, children });
|
354
|
+
}
|
355
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DynamicThemeProvider, { ...props, children });
|
356
|
+
}
|
357
|
+
|
358
|
+
// src/themes/index.ts
|
359
|
+
init_theme_utils();
|
209
360
|
|
361
|
+
exports.DynamicThemeProvider = DynamicThemeProvider;
|
362
|
+
exports.DynamicThemeProviderNoSSR = DynamicThemeProviderNoSSR;
|
363
|
+
exports.DynamicThemeToggle = DynamicThemeToggle;
|
364
|
+
exports.SafeThemeProvider = SafeThemeProvider;
|
210
365
|
exports.ThemeContextProvider = ThemeContextProvider;
|
211
366
|
exports.ThemeProvider = ThemeProvider;
|
367
|
+
exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
|
212
368
|
exports.ThemeToggle = ThemeToggle;
|
213
|
-
exports.getColorVariantClasses = getColorVariantClasses;
|
214
|
-
exports.isDarkTheme = isDarkTheme;
|
215
|
-
exports.mapColorToShadcnVariant = mapColorToShadcnVariant;
|
216
|
-
exports.mapVariantToShadcnVariant = mapVariantToShadcnVariant;
|
217
369
|
exports.useTheme = useTheme;
|
370
|
+
exports.useThemeServer = useThemeServer;
|
218
371
|
//# sourceMappingURL=index.js.map
|
219
372
|
//# sourceMappingURL=index.js.map
|
package/dist/themes/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/themes/theme-provider.tsx","../../src/lib/theme-utils.ts","../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx"],"names":["jsx","NextThemesProvider","useNextTheme","Fragment","twMerge","clsx","React","IconSun","IconMoon","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,uBACEA,cAAA;AAAA,IAACC,wBAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,OAAA;AAAA,MACV,YAAA,EAAa,QAAA;AAAA,MACb,YAAA,EAAY,IAAA;AAAA,MACZ,yBAAA,EAAyB,IAAA;AAAA,MACxB,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;;;ACPO,IAAM,uBAAA,GAA0B,CAAC,KAAA,KAAsB;AAC5D,EAAA,QAAQ,KAAA;AAAO,IACb,KAAK,OAAA;AAAS,MAAA,OAAO,SAAA;AAAA,IACrB,KAAK,OAAA;AAAS,MAAA,OAAO,aAAA;AAAA,IACrB,KAAK,SAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAA,OAAO,WAAA;AAAA;AAAA,IACT;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AAQO,IAAM,yBAAA,GAA4B,CAAC,OAAA,KAA8B;AACtE,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,SAAA;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,KA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,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAEjE,CAAA,mBAEAE,eAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,mBAAA,EACd,QAAA,EAAA;AAAA,wBAAAT,cAAAA,CAACQ,uBAAS,IAAA,EAAM,QAAA,CAAS,IAAI,CAAA,EAAG,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAElE;AAAA;AAAA,GAEJ;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\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 */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\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};","\"use client\"\n\nimport { useTheme as useNextTheme } from \"next-themes\"\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 */\nexport function useTheme() {\n const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();\n \n // Determine if the theme is dark\n const isDark = isDarkTheme(theme, systemTheme);\n \n return {\n theme: theme || \"system\",\n setTheme,\n resolvedTheme: resolvedTheme || \"light\",\n isDark,\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={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark 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 {...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={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark 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}"]}
|
1
|
+
{"version":3,"sources":["../../src/themes/theme-provider.tsx","../../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/index.ts","../../src/themes/dynamic-imports.tsx"],"names":["React","jsx","mapColorToShadcnVariant","mapVariantToShadcnVariant","getColorVariantClasses","isDarkTheme","React2","Fragment","twMerge","clsx","React3","IconSun","IconMoon","jsxs","init_theme_toggle","dynamic"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,sBAAA,GAAA,EAAA;AAAA,QAAA,CAAA,sBAAA,EAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,EAAA,kBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAcO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAAUA,0BAAc,IAAI,CAAA;AAC5E,EAAA,MAAM,CAAC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,EAAY,QAAA,EAAS,EAAG;AAAA;AAEzD;AAMO,SAAS,iBAAA,CAAkB;AAAA,EAChC,QAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR,GAAG;AACL,CAAA,EAIG;AACD,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBAAOA,cAAAA,CAAC,yBAAA,EAAA,EAA2B,GAAG,OAAQ,QAAA,EAAS,CAAA;AAAA,EACzD;AAEA,EAAA,uBAAOA,cAAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,OAAQ,QAAA,EAAS,CAAA;AACpD;;;ADzCA,gBAAA,EAAA","file":"index.js","sourcesContent":["\"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>(null);\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}","/**\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={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark 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 {...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={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark 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';","// 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// Dynamic imports for Server Component compatibility\nexport { \n DynamicThemeProvider, \n DynamicThemeProviderNoSSR, \n DynamicThemeToggle,\n SafeThemeProvider \n} from './dynamic-imports';\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 dynamic from 'next/dynamic'\nimport type { ComponentType } from 'react'\n\n/**\n * Dynamically import theme components to prevent SSR issues\n * Use these imports when you need to use theme components in Server Components\n */\n\n// Dynamic import for ThemeProvider\nexport const DynamicThemeProvider = dynamic(\n () => import('./theme-provider').then(mod => ({ default: mod.ThemeProvider })),\n {\n ssr: false,\n loading: () => <div style={{ visibility: 'hidden' }} />,\n }\n) as ComponentType<any>\n\n// Dynamic import for ThemeProviderNoSSR\nexport const DynamicThemeProviderNoSSR = dynamic(\n () => import('./theme-provider').then(mod => ({ default: mod.ThemeProviderNoSSR })),\n {\n ssr: false,\n loading: () => <div style={{ visibility: 'hidden' }} />,\n }\n) as ComponentType<any>\n\n// Dynamic import for ThemeToggle\nexport const DynamicThemeToggle = dynamic(\n () => import('../components/ui/theme-toggle').then(mod => ({ default: mod.ThemeToggle })),\n {\n ssr: false,\n loading: () => <div style={{ visibility: 'hidden' }} />,\n }\n) as ComponentType<any>\n\n/**\n * Safe theme provider for Next.js App Router\n * Automatically handles Server Component compatibility\n */\nexport function SafeThemeProvider({ \n children, \n noSSR = false,\n ...props \n}: {\n children: React.ReactNode\n noSSR?: boolean\n [key: string]: any\n}) {\n if (noSSR) {\n return <DynamicThemeProviderNoSSR {...props}>{children}</DynamicThemeProviderNoSSR>\n }\n \n return <DynamicThemeProvider {...props}>{children}</DynamicThemeProvider>\n} "]}
|