@tydavidson/design-system 1.1.17 → 1.1.19
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 +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +77 -274
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -274
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +1 -43
- package/dist/themes/index.d.ts +1 -43
- package/dist/themes/index.js +71 -287
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +72 -284
- package/dist/themes/index.mjs.map +1 -1
- package/docs/theme-usage.md +191 -542
- package/package.json +1 -2
package/dist/themes/index.d.mts
CHANGED
@@ -1,48 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
3
|
|
4
|
-
/**
|
5
|
-
* Utility functions for theme handling
|
6
|
-
*/
|
7
|
-
/**
|
8
|
-
* Supported color theme values
|
9
|
-
*/
|
10
|
-
type ThemeColor = 'brand' | 'error' | 'warning' | 'success';
|
11
|
-
/**
|
12
|
-
* Supported component variant types
|
13
|
-
*/
|
14
|
-
type ComponentVariant = 'primary' | 'secondary' | 'tertiary';
|
15
|
-
/**
|
16
|
-
* Map design system colors to shadcn variants
|
17
|
-
*
|
18
|
-
* @param color - The design system color
|
19
|
-
* @returns The corresponding shadcn variant
|
20
|
-
*/
|
21
|
-
declare const mapColorToShadcnVariant: (color: ThemeColor) => "secondary" | "default" | "destructive";
|
22
|
-
/**
|
23
|
-
* Map design system variants to shadcn variants
|
24
|
-
*
|
25
|
-
* @param variant - The design system variant
|
26
|
-
* @returns The corresponding shadcn variant
|
27
|
-
*/
|
28
|
-
declare const mapVariantToShadcnVariant: (variant: ComponentVariant) => "default" | "outline" | "ghost";
|
29
|
-
/**
|
30
|
-
* Generate Tailwind classes for color/variant combinations
|
31
|
-
*
|
32
|
-
* @param color - The design system color
|
33
|
-
* @param variant - The design system variant
|
34
|
-
* @returns String of Tailwind classes
|
35
|
-
*/
|
36
|
-
declare const getColorVariantClasses: (color: ThemeColor, variant: ComponentVariant) => string;
|
37
|
-
/**
|
38
|
-
* Determine if the current theme is dark
|
39
|
-
*
|
40
|
-
* @param theme - The current theme
|
41
|
-
* @param systemTheme - The system theme
|
42
|
-
* @returns True if the theme is dark
|
43
|
-
*/
|
44
|
-
declare const isDarkTheme: (theme: string | undefined, systemTheme: string | undefined) => boolean;
|
45
|
-
|
46
4
|
/**
|
47
5
|
* ThemeProvider component for handling theme state
|
48
6
|
*
|
@@ -83,4 +41,4 @@ declare function useThemeServer(): {
|
|
83
41
|
isDark: boolean;
|
84
42
|
};
|
85
43
|
|
86
|
-
export { ClientThemeProvider, ClientThemeToggle,
|
44
|
+
export { ClientThemeProvider, ClientThemeToggle, ThemeProvider, ThemeProviderNoSSR, useThemeServer };
|
package/dist/themes/index.d.ts
CHANGED
@@ -1,48 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
3
|
|
4
|
-
/**
|
5
|
-
* Utility functions for theme handling
|
6
|
-
*/
|
7
|
-
/**
|
8
|
-
* Supported color theme values
|
9
|
-
*/
|
10
|
-
type ThemeColor = 'brand' | 'error' | 'warning' | 'success';
|
11
|
-
/**
|
12
|
-
* Supported component variant types
|
13
|
-
*/
|
14
|
-
type ComponentVariant = 'primary' | 'secondary' | 'tertiary';
|
15
|
-
/**
|
16
|
-
* Map design system colors to shadcn variants
|
17
|
-
*
|
18
|
-
* @param color - The design system color
|
19
|
-
* @returns The corresponding shadcn variant
|
20
|
-
*/
|
21
|
-
declare const mapColorToShadcnVariant: (color: ThemeColor) => "secondary" | "default" | "destructive";
|
22
|
-
/**
|
23
|
-
* Map design system variants to shadcn variants
|
24
|
-
*
|
25
|
-
* @param variant - The design system variant
|
26
|
-
* @returns The corresponding shadcn variant
|
27
|
-
*/
|
28
|
-
declare const mapVariantToShadcnVariant: (variant: ComponentVariant) => "default" | "outline" | "ghost";
|
29
|
-
/**
|
30
|
-
* Generate Tailwind classes for color/variant combinations
|
31
|
-
*
|
32
|
-
* @param color - The design system color
|
33
|
-
* @param variant - The design system variant
|
34
|
-
* @returns String of Tailwind classes
|
35
|
-
*/
|
36
|
-
declare const getColorVariantClasses: (color: ThemeColor, variant: ComponentVariant) => string;
|
37
|
-
/**
|
38
|
-
* Determine if the current theme is dark
|
39
|
-
*
|
40
|
-
* @param theme - The current theme
|
41
|
-
* @param systemTheme - The system theme
|
42
|
-
* @returns True if the theme is dark
|
43
|
-
*/
|
44
|
-
declare const isDarkTheme: (theme: string | undefined, systemTheme: string | undefined) => boolean;
|
45
|
-
|
46
4
|
/**
|
47
5
|
* ThemeProvider component for handling theme state
|
48
6
|
*
|
@@ -83,4 +41,4 @@ declare function useThemeServer(): {
|
|
83
41
|
isDark: boolean;
|
84
42
|
};
|
85
43
|
|
86
|
-
export { ClientThemeProvider, ClientThemeToggle,
|
44
|
+
export { ClientThemeProvider, ClientThemeToggle, ThemeProvider, ThemeProviderNoSSR, useThemeServer };
|
package/dist/themes/index.js
CHANGED
@@ -2,9 +2,6 @@
|
|
2
2
|
|
3
3
|
var React = require('react');
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
5
|
-
var clsx = require('clsx');
|
6
|
-
var tailwindMerge = require('tailwind-merge');
|
7
|
-
var iconsReact = require('@tabler/icons-react');
|
8
5
|
|
9
6
|
function _interopNamespace(e) {
|
10
7
|
if (e && e.__esModule) return e;
|
@@ -26,222 +23,7 @@ function _interopNamespace(e) {
|
|
26
23
|
|
27
24
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
28
25
|
|
29
|
-
|
30
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
31
|
-
var __esm = (fn, res) => function __init() {
|
32
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
33
|
-
};
|
34
|
-
var __export = (target, all) => {
|
35
|
-
for (var name in all)
|
36
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
37
|
-
};
|
38
|
-
function useThemeServer() {
|
39
|
-
return {
|
40
|
-
theme: "system",
|
41
|
-
setTheme: (theme) => {
|
42
|
-
},
|
43
|
-
resolvedTheme: "light",
|
44
|
-
isDark: false
|
45
|
-
};
|
46
|
-
}
|
47
|
-
function useTheme() {
|
48
|
-
const [themeData, setThemeData] = React__namespace.useState({
|
49
|
-
theme: "system",
|
50
|
-
setTheme: (theme) => {
|
51
|
-
},
|
52
|
-
resolvedTheme: "light",
|
53
|
-
isDark: false
|
54
|
-
});
|
55
|
-
const [mounted, setMounted] = React__namespace.useState(false);
|
56
|
-
React__namespace.useEffect(() => {
|
57
|
-
if (typeof window === "undefined") return;
|
58
|
-
import('next-themes').then((nextThemes) => {
|
59
|
-
const themeManager = {
|
60
|
-
getTheme: () => {
|
61
|
-
if (typeof window !== "undefined") {
|
62
|
-
const savedTheme = localStorage.getItem("theme");
|
63
|
-
if (savedTheme) return savedTheme;
|
64
|
-
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
65
|
-
return "dark";
|
66
|
-
}
|
67
|
-
}
|
68
|
-
return "light";
|
69
|
-
},
|
70
|
-
setTheme: (theme) => {
|
71
|
-
if (typeof window !== "undefined") {
|
72
|
-
localStorage.setItem("theme", theme);
|
73
|
-
document.documentElement.classList.toggle("dark", theme === "dark");
|
74
|
-
setThemeData((prev) => ({
|
75
|
-
...prev,
|
76
|
-
theme,
|
77
|
-
resolvedTheme: theme,
|
78
|
-
isDark: theme === "dark"
|
79
|
-
}));
|
80
|
-
}
|
81
|
-
}
|
82
|
-
};
|
83
|
-
const currentTheme = themeManager.getTheme();
|
84
|
-
const isDark = currentTheme === "dark";
|
85
|
-
setThemeData({
|
86
|
-
theme: currentTheme,
|
87
|
-
setTheme: themeManager.setTheme,
|
88
|
-
resolvedTheme: currentTheme,
|
89
|
-
isDark
|
90
|
-
});
|
91
|
-
setMounted(true);
|
92
|
-
});
|
93
|
-
}, []);
|
94
|
-
return themeData;
|
95
|
-
}
|
96
|
-
var init_theme_context = __esm({
|
97
|
-
"src/themes/theme-context.tsx"() {
|
98
|
-
"use client";
|
99
|
-
}
|
100
|
-
});
|
101
|
-
function cn(...inputs) {
|
102
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
103
|
-
}
|
104
|
-
var init_utils = __esm({
|
105
|
-
"src/lib/utils.ts"() {
|
106
|
-
}
|
107
|
-
});
|
108
|
-
function ThemeToggle({
|
109
|
-
className,
|
110
|
-
variant = "icon",
|
111
|
-
size = "md",
|
112
|
-
...props
|
113
|
-
}) {
|
114
|
-
if (typeof window === "undefined") {
|
115
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
116
|
-
"button",
|
117
|
-
{
|
118
|
-
type: "button",
|
119
|
-
className: cn(
|
120
|
-
"inline-flex items-center justify-center rounded-md border border-input bg-background",
|
121
|
-
size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
|
122
|
-
className
|
123
|
-
),
|
124
|
-
"aria-label": "Toggle theme",
|
125
|
-
...props,
|
126
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
|
127
|
-
}
|
128
|
-
);
|
129
|
-
}
|
130
|
-
const { theme, setTheme, resolvedTheme } = useTheme();
|
131
|
-
const [mounted, setMounted] = React__namespace.useState(false);
|
132
|
-
React__namespace.useEffect(() => {
|
133
|
-
setMounted(true);
|
134
|
-
}, []);
|
135
|
-
if (!mounted) {
|
136
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
137
|
-
"button",
|
138
|
-
{
|
139
|
-
type: "button",
|
140
|
-
className: cn(
|
141
|
-
"inline-flex items-center justify-center rounded-md border border-input bg-background",
|
142
|
-
size === "sm" ? "h-8 w-8" : size === "lg" ? "h-12 w-12" : "h-10 w-10",
|
143
|
-
className
|
144
|
-
),
|
145
|
-
"aria-label": "Toggle theme",
|
146
|
-
...props,
|
147
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: size === "sm" ? 16 : size === "lg" ? 24 : 20, stroke: 1.5 })
|
148
|
-
}
|
149
|
-
);
|
150
|
-
}
|
151
|
-
const toggleTheme = () => {
|
152
|
-
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
153
|
-
};
|
154
|
-
const iconSize = {
|
155
|
-
sm: 16,
|
156
|
-
md: 20,
|
157
|
-
lg: 24
|
158
|
-
};
|
159
|
-
const sizeClasses = {
|
160
|
-
sm: "h-8 w-8",
|
161
|
-
md: "h-10 w-10",
|
162
|
-
lg: "h-12 w-12"
|
163
|
-
};
|
164
|
-
const textSizeClasses = {
|
165
|
-
sm: "text-xs",
|
166
|
-
md: "text-sm",
|
167
|
-
lg: "text-base"
|
168
|
-
};
|
169
|
-
if (variant === "icon") {
|
170
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
171
|
-
"button",
|
172
|
-
{
|
173
|
-
type: "button",
|
174
|
-
onClick: toggleTheme,
|
175
|
-
className: cn(
|
176
|
-
"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
177
|
-
sizeClasses[size],
|
178
|
-
className
|
179
|
-
),
|
180
|
-
"aria-label": "Toggle theme",
|
181
|
-
...props,
|
182
|
-
children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: iconSize[size], stroke: 1.5 }) : /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconMoon, { size: iconSize[size], stroke: 1.5 })
|
183
|
-
}
|
184
|
-
);
|
185
|
-
}
|
186
|
-
if (variant === "button") {
|
187
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
188
|
-
"button",
|
189
|
-
{
|
190
|
-
type: "button",
|
191
|
-
onClick: toggleTheme,
|
192
|
-
className: cn(
|
193
|
-
"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2",
|
194
|
-
textSizeClasses[size],
|
195
|
-
"hover:bg-accent hover:text-accent-foreground",
|
196
|
-
className
|
197
|
-
),
|
198
|
-
"aria-label": "Toggle theme",
|
199
|
-
...props,
|
200
|
-
children: resolvedTheme === "dark" ? "Light Mode" : "Dark Mode"
|
201
|
-
}
|
202
|
-
);
|
203
|
-
}
|
204
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
205
|
-
"button",
|
206
|
-
{
|
207
|
-
type: "button",
|
208
|
-
onClick: toggleTheme,
|
209
|
-
className: cn(
|
210
|
-
"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",
|
211
|
-
textSizeClasses[size],
|
212
|
-
resolvedTheme === "dark" ? "bg-accent text-accent-foreground hover:bg-accent/80" : "bg-muted text-muted-foreground hover:bg-muted/80",
|
213
|
-
className
|
214
|
-
),
|
215
|
-
"aria-label": "Toggle theme",
|
216
|
-
...props,
|
217
|
-
children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
|
218
|
-
/* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
|
219
|
-
"Light"
|
220
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconMoon, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
|
222
|
-
"Dark"
|
223
|
-
] })
|
224
|
-
}
|
225
|
-
);
|
226
|
-
}
|
227
|
-
var init_theme_toggle = __esm({
|
228
|
-
"src/components/ui/theme-toggle/theme-toggle.tsx"() {
|
229
|
-
"use client";
|
230
|
-
init_theme_context();
|
231
|
-
init_utils();
|
232
|
-
}
|
233
|
-
});
|
234
|
-
|
235
|
-
// src/components/ui/theme-toggle/index.ts
|
236
|
-
var theme_toggle_exports = {};
|
237
|
-
__export(theme_toggle_exports, {
|
238
|
-
ThemeToggle: () => ThemeToggle
|
239
|
-
});
|
240
|
-
var init_theme_toggle2 = __esm({
|
241
|
-
"src/components/ui/theme-toggle/index.ts"() {
|
242
|
-
init_theme_toggle();
|
243
|
-
}
|
244
|
-
});
|
26
|
+
// src/themes/theme-provider.tsx
|
245
27
|
function ThemeProvider({
|
246
28
|
children,
|
247
29
|
...props
|
@@ -297,14 +79,25 @@ function ClientThemeProvider({
|
|
297
79
|
}
|
298
80
|
function ClientThemeToggle(props) {
|
299
81
|
const [mounted, setMounted] = React__namespace.useState(false);
|
300
|
-
const [
|
82
|
+
const [isDark, setIsDark] = React__namespace.useState(false);
|
301
83
|
React__namespace.useEffect(() => {
|
302
84
|
setMounted(true);
|
303
|
-
|
304
|
-
|
305
|
-
|
85
|
+
if (typeof window !== "undefined") {
|
86
|
+
const savedTheme = localStorage.getItem("theme");
|
87
|
+
const systemPrefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
88
|
+
const currentTheme = savedTheme || (systemPrefersDark ? "dark" : "light");
|
89
|
+
setIsDark(currentTheme === "dark");
|
90
|
+
}
|
306
91
|
}, []);
|
307
|
-
|
92
|
+
const toggleTheme = () => {
|
93
|
+
if (typeof window !== "undefined") {
|
94
|
+
const newTheme = isDark ? "light" : "dark";
|
95
|
+
localStorage.setItem("theme", newTheme);
|
96
|
+
document.documentElement.classList.toggle("dark", newTheme === "dark");
|
97
|
+
setIsDark(newTheme === "dark");
|
98
|
+
}
|
99
|
+
};
|
100
|
+
if (!mounted) {
|
308
101
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
309
102
|
"button",
|
310
103
|
{
|
@@ -339,77 +132,68 @@ function ClientThemeToggle(props) {
|
|
339
132
|
}
|
340
133
|
);
|
341
134
|
}
|
342
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
136
|
+
"button",
|
137
|
+
{
|
138
|
+
type: "button",
|
139
|
+
onClick: toggleTheme,
|
140
|
+
className: "inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 w-10",
|
141
|
+
"aria-label": "Toggle theme",
|
142
|
+
...props,
|
143
|
+
children: isDark ? /* @__PURE__ */ jsxRuntime.jsxs(
|
144
|
+
"svg",
|
145
|
+
{
|
146
|
+
width: "20",
|
147
|
+
height: "20",
|
148
|
+
viewBox: "0 0 24 24",
|
149
|
+
fill: "none",
|
150
|
+
stroke: "currentColor",
|
151
|
+
strokeWidth: "2",
|
152
|
+
strokeLinecap: "round",
|
153
|
+
strokeLinejoin: "round",
|
154
|
+
children: [
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v2" }),
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 20v2" }),
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
|
160
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h2" }),
|
161
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 12h2" }),
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m19.07 4.93-1.41 1.41" })
|
164
|
+
]
|
165
|
+
}
|
166
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
167
|
+
"svg",
|
168
|
+
{
|
169
|
+
width: "20",
|
170
|
+
height: "20",
|
171
|
+
viewBox: "0 0 24 24",
|
172
|
+
fill: "none",
|
173
|
+
stroke: "currentColor",
|
174
|
+
strokeWidth: "2",
|
175
|
+
strokeLinecap: "round",
|
176
|
+
strokeLinejoin: "round",
|
177
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
|
178
|
+
}
|
179
|
+
)
|
180
|
+
}
|
181
|
+
);
|
343
182
|
}
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
// src/lib/theme-utils.ts
|
349
|
-
var mapColorToShadcnVariant = (color) => {
|
350
|
-
switch (color) {
|
351
|
-
case "brand":
|
352
|
-
return "default";
|
353
|
-
case "error":
|
354
|
-
return "destructive";
|
355
|
-
case "warning":
|
356
|
-
case "success":
|
357
|
-
return "secondary";
|
358
|
-
// Will need additional classes
|
359
|
-
default:
|
360
|
-
return "default";
|
361
|
-
}
|
362
|
-
};
|
363
|
-
var mapVariantToShadcnVariant = (variant) => {
|
364
|
-
switch (variant) {
|
365
|
-
case "primary":
|
366
|
-
return "default";
|
367
|
-
case "secondary":
|
368
|
-
return "outline";
|
369
|
-
case "tertiary":
|
370
|
-
return "ghost";
|
371
|
-
default:
|
372
|
-
return "default";
|
373
|
-
}
|
374
|
-
};
|
375
|
-
var getColorVariantClasses = (color, variant) => {
|
376
|
-
const colorVariantMap = {
|
377
|
-
primary: {
|
378
|
-
brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
|
379
|
-
error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
|
380
|
-
warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
|
381
|
-
success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
|
382
|
-
},
|
383
|
-
secondary: {
|
384
|
-
brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
|
385
|
-
error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
386
|
-
warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
387
|
-
success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
183
|
+
function useThemeServer() {
|
184
|
+
return {
|
185
|
+
theme: "system",
|
186
|
+
setTheme: (theme) => {
|
388
187
|
},
|
389
|
-
|
390
|
-
|
391
|
-
error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
|
392
|
-
warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
|
393
|
-
success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
|
394
|
-
}
|
188
|
+
resolvedTheme: "light",
|
189
|
+
isDark: false
|
395
190
|
};
|
396
|
-
|
397
|
-
};
|
398
|
-
var isDarkTheme = (theme, systemTheme) => {
|
399
|
-
if (theme === "system") {
|
400
|
-
return systemTheme === "dark";
|
401
|
-
}
|
402
|
-
return theme === "dark";
|
403
|
-
};
|
191
|
+
}
|
404
192
|
|
405
193
|
exports.ClientThemeProvider = ClientThemeProvider;
|
406
194
|
exports.ClientThemeToggle = ClientThemeToggle;
|
407
195
|
exports.ThemeProvider = ThemeProvider;
|
408
196
|
exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
|
409
|
-
exports.getColorVariantClasses = getColorVariantClasses;
|
410
|
-
exports.isDarkTheme = isDarkTheme;
|
411
|
-
exports.mapColorToShadcnVariant = mapColorToShadcnVariant;
|
412
|
-
exports.mapVariantToShadcnVariant = mapVariantToShadcnVariant;
|
413
197
|
exports.useThemeServer = useThemeServer;
|
414
198
|
//# sourceMappingURL=index.js.map
|
415
199
|
//# sourceMappingURL=index.js.map
|
package/dist/themes/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/client-wrapper.tsx","../../src/themes/index.ts","../../src/lib/theme-utils.ts"],"names":["React2","twMerge","clsx","js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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 * \n * IMPORTANT: This component uses React hooks and must only be used in Client Components.\n * For Server Components, use ClientThemeToggle from the themes package instead.\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n // Additional Server Component protection\n if (typeof window === 'undefined') {\n // Return a placeholder during SSR to prevent hydration issues\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background\",\n size === 'sm' ? 'h-8 w-8' : size === 'lg' ? 'h-12 w-12' : 'h-10 w-10',\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n <IconSun size={size === 'sm' ? 16 : size === 'lg' ? 24 : 20} stroke={1.5} />\n </button>\n );\n }\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n\n // Default variant (switch-like)\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n textSizeClasses[size],\n resolvedTheme === \"dark\"\n ? \"bg-accent text-accent-foreground hover:bg-accent/80\"\n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label=\"Toggle theme\"\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}","export * from './theme-toggle';","\"use client\"\n\nimport * as React from \"react\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n * \n * IMPORTANT: This component must be used in a Client Component context.\n * For Server Components, use the NoSSR wrapper or dynamic imports.\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [NextThemesProvider, setNextThemesProvider] = React.useState<any>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n * and provides a safe fallback for Server Components\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(undefined);\n\n React.useEffect(() => {\n setMounted(true);\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render a placeholder\n if (!mounted || !ThemeToggleComponent) {\n return (\n <button\n type=\"button\"\n className=\"inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10\"\n aria-label=\"Toggle theme\"\n {...props}\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2\" />\n <path d=\"M12 20v2\" />\n <path d=\"m4.93 4.93 1.41 1.41\" />\n <path d=\"m17.66 17.66 1.41 1.41\" />\n <path d=\"M2 12h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"m6.34 17.66-1.41 1.41\" />\n <path d=\"m19.07 4.93-1.41 1.41\" />\n </svg>\n </button>\n );\n }\n\n return <ThemeToggleComponent {...props} />;\n} ","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Server-safe theme hook\nexport { useThemeServer } from './theme-context';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n\n// NOTE: ThemeToggle and useTheme are NOT exported to prevent Server Component issues\n// Use ClientThemeToggle and useThemeServer instead for Server Component compatibility\n","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};"]}
|
1
|
+
{"version":3,"sources":["../../src/themes/theme-provider.tsx","../../src/themes/client-wrapper.tsx","../../src/themes/theme-context.tsx"],"names":["React","jsx","React2","Fragment","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,GAAUA,0BAAc,MAAS,CAAA;AACjF,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAUA,0BAAS,KAAK,CAAA;AAElD,EAAMA,2BAAU,MAAM;AAEpB,IAAA,OAAO,aAAa,CAAA,CAAE,IAAA,CAAK,CAAC,EAAE,aAAA,EAAe,UAAS,KAAM;AAC1D,MAAA,qBAAA,CAAsB,MAAM,QAAQ,CAAA;AACpC,MAAA,UAAA,CAAW,IAAI,CAAA;AAAA,IACjB,CAAC,CAAA;AAAA,EACH,CAAA,EAAG,EAAE,CAAA;AAGL,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,kBAAA,EAAoB;AACnC,IAAA,6DAAU,QAAA,EAAS,CAAA;AAAA,EACrB;AAEA,EAAA,uBACEC,cAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,OAAA;AAAA,MACV,YAAA,EAAa,QAAA;AAAA,MACb,YAAA,EAAY,IAAA;AAAA,M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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","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>(undefined);\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ ThemeProvider: Provider }) => {\n setNextThemesProvider(() => Provider);\n setMounted(true);\n });\n }, []);\n\n // Return children without theme provider during SSR or before mounting\n if (!mounted || !NextThemesProvider) {\n return <>{children}</>;\n }\n\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}\n\n/**\n * NoSSR wrapper for theme provider to prevent SSR issues\n * Use this when you need to ensure the theme provider only renders on the client\n */\nexport function ThemeProviderNoSSR({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n if (!mounted) {\n return <>{children}</>;\n }\n\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n * and provides a safe fallback for Server Components\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [isDark, setIsDark] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n // Check current theme\n if (typeof window !== 'undefined') {\n const savedTheme = localStorage.getItem('theme');\n const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;\n const currentTheme = savedTheme || (systemPrefersDark ? 'dark' : 'light');\n setIsDark(currentTheme === 'dark');\n }\n }, []);\n\n const toggleTheme = () => {\n if (typeof window !== 'undefined') {\n const newTheme = isDark ? 'light' : 'dark';\n localStorage.setItem('theme', newTheme);\n document.documentElement.classList.toggle('dark', newTheme === 'dark');\n setIsDark(newTheme === 'dark');\n }\n };\n\n // During SSR or before mounting, render a placeholder\n if (!mounted) {\n return (\n <button\n type=\"button\"\n className=\"inline-flex items-center justify-center rounded-md border border-input bg-background h-10 w-10\"\n aria-label=\"Toggle theme\"\n {...props}\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2\" />\n <path d=\"M12 20v2\" />\n <path d=\"m4.93 4.93 1.41 1.41\" />\n <path d=\"m17.66 17.66 1.41 1.41\" />\n <path d=\"M2 12h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"m6.34 17.66-1.41 1.41\" />\n <path d=\"m19.07 4.93-1.41 1.41\" />\n </svg>\n </button>\n );\n }\n\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className=\"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 w-10\"\n aria-label=\"Toggle theme\"\n {...props}\n >\n {isDark ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2\" />\n <path d=\"M12 20v2\" />\n <path d=\"m4.93 4.93 1.41 1.41\" />\n <path d=\"m17.66 17.66 1.41 1.41\" />\n <path d=\"M2 12h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"m6.34 17.66-1.41 1.41\" />\n <path d=\"m19.07 4.93-1.41 1.41\" />\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\" />\n </svg>\n )}\n </button>\n );\n} ","\"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}"]}
|