@tydavidson/design-system 1.1.9 → 1.1.11
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 +57 -2
- package/dist/index.d.ts +57 -2
- package/dist/index.js +220 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -81
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +11 -17
- package/dist/themes/index.d.ts +11 -17
- package/dist/themes/index.js +64 -87
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +63 -81
- package/dist/themes/index.mjs.map +1 -1
- package/docs/setup-guide.md +15 -15
- package/docs/troubleshooting.md +7 -7
- package/package.json +1 -1
package/dist/themes/index.d.mts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
|
-
import * as React
|
4
|
-
import { ComponentType } from 'react';
|
3
|
+
import * as React from 'react';
|
5
4
|
|
6
5
|
/**
|
7
6
|
* Utility functions for theme handling
|
@@ -91,13 +90,13 @@ declare function useThemeServer(): {
|
|
91
90
|
* This component is kept for backward compatibility but is no longer needed
|
92
91
|
*/
|
93
92
|
declare function ThemeContextProvider({ children }: {
|
94
|
-
children: React
|
93
|
+
children: React.ReactNode;
|
95
94
|
}): react_jsx_runtime.JSX.Element;
|
96
95
|
|
97
96
|
/**
|
98
97
|
* Props for the ThemeToggle component
|
99
98
|
*/
|
100
|
-
interface ThemeToggleProps extends React
|
99
|
+
interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {
|
101
100
|
/**
|
102
101
|
* Variant of the toggle
|
103
102
|
* @default 'icon'
|
@@ -115,20 +114,15 @@ interface ThemeToggleProps extends React$1.HTMLAttributes<HTMLButtonElement> {
|
|
115
114
|
declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
|
116
115
|
|
117
116
|
/**
|
118
|
-
*
|
119
|
-
*
|
117
|
+
* Client-only theme provider wrapper
|
118
|
+
* This component ensures theme functionality only runs on the client side
|
119
|
+
* without using next/dynamic which causes Server Component issues
|
120
120
|
*/
|
121
|
-
declare
|
122
|
-
declare const DynamicThemeProviderNoSSR: ComponentType<any>;
|
123
|
-
declare const DynamicThemeToggle: ComponentType<any>;
|
121
|
+
declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
124
122
|
/**
|
125
|
-
*
|
126
|
-
*
|
123
|
+
* Client-only theme toggle wrapper
|
124
|
+
* This component ensures theme toggle only renders on the client side
|
127
125
|
*/
|
128
|
-
declare function
|
129
|
-
children: React.ReactNode;
|
130
|
-
noSSR?: boolean;
|
131
|
-
[key: string]: any;
|
132
|
-
}): react_jsx_runtime.JSX.Element;
|
126
|
+
declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element | null;
|
133
127
|
|
134
|
-
export {
|
128
|
+
export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
package/dist/themes/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import { ThemeProviderProps } from 'next-themes/dist/types';
|
3
|
-
import * as React
|
4
|
-
import { ComponentType } from 'react';
|
3
|
+
import * as React from 'react';
|
5
4
|
|
6
5
|
/**
|
7
6
|
* Utility functions for theme handling
|
@@ -91,13 +90,13 @@ declare function useThemeServer(): {
|
|
91
90
|
* This component is kept for backward compatibility but is no longer needed
|
92
91
|
*/
|
93
92
|
declare function ThemeContextProvider({ children }: {
|
94
|
-
children: React
|
93
|
+
children: React.ReactNode;
|
95
94
|
}): react_jsx_runtime.JSX.Element;
|
96
95
|
|
97
96
|
/**
|
98
97
|
* Props for the ThemeToggle component
|
99
98
|
*/
|
100
|
-
interface ThemeToggleProps extends React
|
99
|
+
interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {
|
101
100
|
/**
|
102
101
|
* Variant of the toggle
|
103
102
|
* @default 'icon'
|
@@ -115,20 +114,15 @@ interface ThemeToggleProps extends React$1.HTMLAttributes<HTMLButtonElement> {
|
|
115
114
|
declare function ThemeToggle({ className, variant, size, ...props }: ThemeToggleProps): react_jsx_runtime.JSX.Element | null;
|
116
115
|
|
117
116
|
/**
|
118
|
-
*
|
119
|
-
*
|
117
|
+
* Client-only theme provider wrapper
|
118
|
+
* This component ensures theme functionality only runs on the client side
|
119
|
+
* without using next/dynamic which causes Server Component issues
|
120
120
|
*/
|
121
|
-
declare
|
122
|
-
declare const DynamicThemeProviderNoSSR: ComponentType<any>;
|
123
|
-
declare const DynamicThemeToggle: ComponentType<any>;
|
121
|
+
declare function ClientThemeProvider({ children, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
124
122
|
/**
|
125
|
-
*
|
126
|
-
*
|
123
|
+
* Client-only theme toggle wrapper
|
124
|
+
* This component ensures theme toggle only renders on the client side
|
127
125
|
*/
|
128
|
-
declare function
|
129
|
-
children: React.ReactNode;
|
130
|
-
noSSR?: boolean;
|
131
|
-
[key: string]: any;
|
132
|
-
}): react_jsx_runtime.JSX.Element;
|
126
|
+
declare function ClientThemeToggle(props: any): react_jsx_runtime.JSX.Element | null;
|
133
127
|
|
134
|
-
export {
|
128
|
+
export { ClientThemeProvider, ClientThemeToggle, type ComponentVariant, type ThemeColor, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
package/dist/themes/index.js
CHANGED
@@ -5,9 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var clsx = require('clsx');
|
6
6
|
var tailwindMerge = require('tailwind-merge');
|
7
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 }; }
|
11
8
|
|
12
9
|
function _interopNamespace(e) {
|
13
10
|
if (e && e.__esModule) return e;
|
@@ -28,7 +25,6 @@ function _interopNamespace(e) {
|
|
28
25
|
}
|
29
26
|
|
30
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
31
|
-
var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
|
32
28
|
|
33
29
|
var __defProp = Object.defineProperty;
|
34
30
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -40,58 +36,6 @@ var __export = (target, all) => {
|
|
40
36
|
__defProp(target, name, { get: all[name], enumerable: true });
|
41
37
|
};
|
42
38
|
|
43
|
-
// src/themes/theme-provider.tsx
|
44
|
-
var theme_provider_exports = {};
|
45
|
-
__export(theme_provider_exports, {
|
46
|
-
ThemeProvider: () => ThemeProvider,
|
47
|
-
ThemeProviderNoSSR: () => ThemeProviderNoSSR
|
48
|
-
});
|
49
|
-
function ThemeProvider({
|
50
|
-
children,
|
51
|
-
...props
|
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
|
-
}
|
64
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
65
|
-
NextThemesProvider,
|
66
|
-
{
|
67
|
-
attribute: "class",
|
68
|
-
defaultTheme: "system",
|
69
|
-
enableSystem: true,
|
70
|
-
disableTransitionOnChange: true,
|
71
|
-
...props,
|
72
|
-
children
|
73
|
-
}
|
74
|
-
);
|
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
|
-
});
|
94
|
-
|
95
39
|
// src/lib/theme-utils.ts
|
96
40
|
exports.mapColorToShadcnVariant = void 0; exports.mapVariantToShadcnVariant = void 0; exports.getColorVariantClasses = void 0; exports.isDarkTheme = void 0;
|
97
41
|
var init_theme_utils = __esm({
|
@@ -318,50 +262,83 @@ var init_theme_toggle2 = __esm({
|
|
318
262
|
init_theme_toggle();
|
319
263
|
}
|
320
264
|
});
|
265
|
+
function ThemeProvider({
|
266
|
+
children,
|
267
|
+
...props
|
268
|
+
}) {
|
269
|
+
const [NextThemesProvider, setNextThemesProvider] = React__namespace.useState(null);
|
270
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
271
|
+
React__namespace.useEffect(() => {
|
272
|
+
import('next-themes').then(({ ThemeProvider: Provider }) => {
|
273
|
+
setNextThemesProvider(() => Provider);
|
274
|
+
setMounted(true);
|
275
|
+
});
|
276
|
+
}, []);
|
277
|
+
if (!mounted || !NextThemesProvider) {
|
278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
279
|
+
}
|
280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
281
|
+
NextThemesProvider,
|
282
|
+
{
|
283
|
+
attribute: "class",
|
284
|
+
defaultTheme: "system",
|
285
|
+
enableSystem: true,
|
286
|
+
disableTransitionOnChange: true,
|
287
|
+
...props,
|
288
|
+
children
|
289
|
+
}
|
290
|
+
);
|
291
|
+
}
|
292
|
+
function ThemeProviderNoSSR({
|
293
|
+
children,
|
294
|
+
...props
|
295
|
+
}) {
|
296
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
297
|
+
React__namespace.useEffect(() => {
|
298
|
+
setMounted(true);
|
299
|
+
}, []);
|
300
|
+
if (!mounted) {
|
301
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
302
|
+
}
|
303
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { ...props, children });
|
304
|
+
}
|
321
305
|
|
322
306
|
// src/themes/index.ts
|
323
|
-
init_theme_provider();
|
324
307
|
init_theme_context();
|
325
308
|
init_theme_toggle2();
|
326
|
-
|
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({
|
309
|
+
function ClientThemeProvider({
|
348
310
|
children,
|
349
|
-
noSSR = false,
|
350
311
|
...props
|
351
312
|
}) {
|
352
|
-
|
353
|
-
|
313
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
314
|
+
React__namespace.useEffect(() => {
|
315
|
+
setMounted(true);
|
316
|
+
}, []);
|
317
|
+
if (!mounted) {
|
318
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
319
|
+
}
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { ...props, children });
|
321
|
+
}
|
322
|
+
function ClientThemeToggle(props) {
|
323
|
+
const [mounted, setMounted] = React__namespace.useState(false);
|
324
|
+
const [ThemeToggleComponent, setThemeToggleComponent] = React__namespace.useState(null);
|
325
|
+
React__namespace.useEffect(() => {
|
326
|
+
setMounted(true);
|
327
|
+
Promise.resolve().then(() => (init_theme_toggle2(), theme_toggle_exports)).then(({ ThemeToggle: ThemeToggle2 }) => {
|
328
|
+
setThemeToggleComponent(() => ThemeToggle2);
|
329
|
+
});
|
330
|
+
}, []);
|
331
|
+
if (!mounted || !ThemeToggleComponent) {
|
332
|
+
return null;
|
354
333
|
}
|
355
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThemeToggleComponent, { ...props });
|
356
335
|
}
|
357
336
|
|
358
337
|
// src/themes/index.ts
|
359
338
|
init_theme_utils();
|
360
339
|
|
361
|
-
exports.
|
362
|
-
exports.
|
363
|
-
exports.DynamicThemeToggle = DynamicThemeToggle;
|
364
|
-
exports.SafeThemeProvider = SafeThemeProvider;
|
340
|
+
exports.ClientThemeProvider = ClientThemeProvider;
|
341
|
+
exports.ClientThemeToggle = ClientThemeToggle;
|
365
342
|
exports.ThemeContextProvider = ThemeContextProvider;
|
366
343
|
exports.ThemeProvider = ThemeProvider;
|
367
344
|
exports.ThemeProviderNoSSR = ThemeProviderNoSSR;
|
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","../../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,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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import * 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} "]}
|
1
|
+
{"version":3,"sources":["../../src/lib/theme-utils.ts","../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx","../../src/components/ui/theme-toggle/index.ts","../../src/themes/theme-provider.tsx","../../src/themes/index.ts","../../src/themes/client-wrapper.tsx"],"names":["mapColorToShadcnVariant","mapVariantToShadcnVariant","getColorVariantClasses","isDarkTheme","React2","jsx","Fragment","twMerge","clsx","React3","IconSun","IconMoon","jsxs","init_theme_toggle","React","React4","ThemeToggle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBaA,wCAAA,CAAA,CAiBAC,4CAgBAC,uCAAA,CAAA,CAmCAC;AAxFb,IAAA,gBAAA,GAAA,KAAA,CAAA;AAAA,EAAA,wBAAA,GAAA;AAoBO,IAAMH,+BAAA,GAA0B,CAAC,KAAA,KAAsB;AAC5D,MAAA,QAAQ,KAAA;AAAO,QACb,KAAK,OAAA;AAAS,UAAA,OAAO,SAAA;AAAA,QACrB,KAAK,OAAA;AAAS,UAAA,OAAO,aAAA;AAAA,QACrB,KAAK,SAAA;AAAA,QACL,KAAK,SAAA;AACH,UAAA,OAAO,WAAA;AAAA;AAAA,QACT;AAAS,UAAA,OAAO,SAAA;AAAA;AAClB,IACF,CAAA;AAQO,IAAMC,iCAAA,GAA4B,CAAC,OAAA,KAA8B;AACtE,MAAA,QAAQ,OAAA;AAAS,QACf,KAAK,SAAA;AAAW,UAAA,OAAO,SAAA;AAAA,QACvB,KAAK,WAAA;AAAa,UAAA,OAAO,SAAA;AAAA,QACzB,KAAK,UAAA;AAAY,UAAA,OAAO,OAAA;AAAA,QACxB;AAAS,UAAA,OAAO,SAAA;AAAA;AAClB,IACF,CAAA;AASO,IAAMC,8BAAA,GAAyB,CACpC,KAAA,EACA,OAAA,KACW;AACX,MAAA,MAAM,eAAA,GAAwE;AAAA,QAC5E,OAAA,EAAS;AAAA,UACP,KAAA,EAAO,yEAAA;AAAA,UACP,KAAA,EAAO,yEA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QAAA,EACH,CAAA;AAEJ;AAMO,SAAS,kBAAkB,KAAA,EAAY;AAC5C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAUU,0BAAS,KAAK,CAAA;AAClD,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAUA,0BAAc,IAAI,CAAA;AAEhF,EAAMA,2BAAU,MAAM;AACpB,IAAA,UAAA,CAAW,IAAI,CAAA;AAEf,IAAA,OAAA,CAAA,OAAA,EAAA,CAAA,IAAA,CAAA,OAAA,kBAAA,EAAA,EAAA,oBAAA,CAAA,CAAA,CAAwC,IAAA,CAAK,CAAC,EAAE,WAAA,EAAAC,cAAY,KAAM;AAChE,MAAA,uBAAA,CAAwB,MAAMA,YAAW,CAAA;AAAA,IAC3C,CAAC,CAAA;AAAA,EACH,CAAA,EAAG,EAAE,CAAA;AAGL,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,oBAAA,EAAsB;AACrC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,uBAAOX,cAAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,KAAA,EAAO,CAAA;AAC1C;;;ADhDA,gBAAA,EAAA","file":"index.js","sourcesContent":["/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};","\"use client\"\n\nimport * as React from \"react\"\nimport { isDarkTheme } from \"../lib/theme-utils\"\n\n/**\n * Enhanced useTheme hook that works directly with next-themes\n * \n * This hook provides a simplified interface to next-themes with additional\n * utility properties for better compatibility with Next.js App Router\n * \n * IMPORTANT: This hook must be used within a Client Component.\n * For Server Components, use the useThemeServer hook instead.\n */\nexport function useTheme() {\n const [themeData, setThemeData] = React.useState({\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n });\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n // Only import next-themes on the client side\n import('next-themes').then(({ useTheme: useNextTheme }) => {\n const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();\n const isDark = isDarkTheme(theme, systemTheme);\n \n setThemeData({\n theme: theme || \"system\",\n setTheme,\n resolvedTheme: resolvedTheme || \"light\",\n isDark,\n });\n setMounted(true);\n });\n }, []);\n\n // Return default values during SSR or before mounting\n if (!mounted) {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n }\n\n return themeData;\n}\n\n/**\n * Server-safe theme hook that can be used in Server Components\n * Returns default theme values without accessing client-side APIs\n */\nexport function useThemeServer() {\n return {\n theme: \"system\",\n setTheme: (theme: string) => {},\n resolvedTheme: \"light\",\n isDark: false,\n };\n}\n\n/**\n * @deprecated Use ThemeProvider from './theme-provider' instead\n * This component is kept for backward compatibility but is no longer needed\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n // This is now a no-op wrapper for backward compatibility\n return <>{children}</>;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n const { theme, setTheme, resolvedTheme } = useTheme()\n const [mounted, setMounted] = React.useState(false)\n\n // Handle hydration mismatch\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Only render on client to prevent hydration mismatch\n if (!mounted) return null;\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label={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';","\"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}","// Theme system exports\nexport { ThemeProvider, ThemeProviderNoSSR } from './theme-provider';\nexport { ThemeContextProvider, useTheme, useThemeServer } from './theme-context';\nexport { ThemeToggle } from '../components/ui/theme-toggle/index';\n\n// Client-only wrappers for Server Component compatibility\nexport { ClientThemeProvider, ClientThemeToggle } from './client-wrapper';\n\n// Re-export theme utilities\nexport { isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses } from '../lib/theme-utils';\n\n// Export types\nexport type { ThemeColor, ComponentVariant } from '../lib/theme-utils';\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider } from \"./theme-provider\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * Client-only theme provider wrapper\n * This component ensures theme functionality only runs on the client side\n * without using next/dynamic which causes Server Component issues\n */\nexport function ClientThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n const [mounted, setMounted] = React.useState(false);\n\n React.useEffect(() => {\n setMounted(true);\n }, []);\n\n // During SSR or before mounting, render children without theme provider\n if (!mounted) {\n return <>{children}</>;\n }\n\n // Once mounted, render with theme provider\n return (\n <ThemeProvider {...props}>\n {children}\n </ThemeProvider>\n );\n}\n\n/**\n * Client-only theme toggle wrapper\n * This component ensures theme toggle only renders on the client side\n */\nexport function ClientThemeToggle(props: any) {\n const [mounted, setMounted] = React.useState(false);\n const [ThemeToggleComponent, setThemeToggleComponent] = React.useState<any>(null);\n\n React.useEffect(() => {\n setMounted(true);\n // Use dynamic import instead of require for ESM compatibility\n import(\"../components/ui/theme-toggle\").then(({ ThemeToggle }) => {\n setThemeToggleComponent(() => ThemeToggle);\n });\n }, []);\n\n // During SSR or before mounting, render nothing\n if (!mounted || !ThemeToggleComponent) {\n return null;\n }\n\n // Once mounted, render the theme toggle\n return <ThemeToggleComponent {...props} />;\n} "]}
|
package/dist/themes/index.mjs
CHANGED
@@ -3,7 +3,6 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { clsx } from 'clsx';
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
5
5
|
import { IconSun, IconMoon } from '@tabler/icons-react';
|
6
|
-
import dynamic from 'next/dynamic';
|
7
6
|
|
8
7
|
var __defProp = Object.defineProperty;
|
9
8
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
@@ -15,58 +14,6 @@ var __export = (target, all) => {
|
|
15
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
16
15
|
};
|
17
16
|
|
18
|
-
// src/themes/theme-provider.tsx
|
19
|
-
var theme_provider_exports = {};
|
20
|
-
__export(theme_provider_exports, {
|
21
|
-
ThemeProvider: () => ThemeProvider,
|
22
|
-
ThemeProviderNoSSR: () => ThemeProviderNoSSR
|
23
|
-
});
|
24
|
-
function ThemeProvider({
|
25
|
-
children,
|
26
|
-
...props
|
27
|
-
}) {
|
28
|
-
const [NextThemesProvider, setNextThemesProvider] = React.useState(null);
|
29
|
-
const [mounted, setMounted] = React.useState(false);
|
30
|
-
React.useEffect(() => {
|
31
|
-
import('next-themes').then(({ ThemeProvider: Provider }) => {
|
32
|
-
setNextThemesProvider(() => Provider);
|
33
|
-
setMounted(true);
|
34
|
-
});
|
35
|
-
}, []);
|
36
|
-
if (!mounted || !NextThemesProvider) {
|
37
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
38
|
-
}
|
39
|
-
return /* @__PURE__ */ jsx(
|
40
|
-
NextThemesProvider,
|
41
|
-
{
|
42
|
-
attribute: "class",
|
43
|
-
defaultTheme: "system",
|
44
|
-
enableSystem: true,
|
45
|
-
disableTransitionOnChange: true,
|
46
|
-
...props,
|
47
|
-
children
|
48
|
-
}
|
49
|
-
);
|
50
|
-
}
|
51
|
-
function ThemeProviderNoSSR({
|
52
|
-
children,
|
53
|
-
...props
|
54
|
-
}) {
|
55
|
-
const [mounted, setMounted] = React.useState(false);
|
56
|
-
React.useEffect(() => {
|
57
|
-
setMounted(true);
|
58
|
-
}, []);
|
59
|
-
if (!mounted) {
|
60
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
61
|
-
}
|
62
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { ...props, children });
|
63
|
-
}
|
64
|
-
var init_theme_provider = __esm({
|
65
|
-
"src/themes/theme-provider.tsx"() {
|
66
|
-
"use client";
|
67
|
-
}
|
68
|
-
});
|
69
|
-
|
70
17
|
// src/lib/theme-utils.ts
|
71
18
|
var mapColorToShadcnVariant, mapVariantToShadcnVariant, getColorVariantClasses, isDarkTheme;
|
72
19
|
var init_theme_utils = __esm({
|
@@ -293,46 +240,81 @@ var init_theme_toggle2 = __esm({
|
|
293
240
|
init_theme_toggle();
|
294
241
|
}
|
295
242
|
});
|
243
|
+
function ThemeProvider({
|
244
|
+
children,
|
245
|
+
...props
|
246
|
+
}) {
|
247
|
+
const [NextThemesProvider, setNextThemesProvider] = React.useState(null);
|
248
|
+
const [mounted, setMounted] = React.useState(false);
|
249
|
+
React.useEffect(() => {
|
250
|
+
import('next-themes').then(({ ThemeProvider: Provider }) => {
|
251
|
+
setNextThemesProvider(() => Provider);
|
252
|
+
setMounted(true);
|
253
|
+
});
|
254
|
+
}, []);
|
255
|
+
if (!mounted || !NextThemesProvider) {
|
256
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
257
|
+
}
|
258
|
+
return /* @__PURE__ */ jsx(
|
259
|
+
NextThemesProvider,
|
260
|
+
{
|
261
|
+
attribute: "class",
|
262
|
+
defaultTheme: "system",
|
263
|
+
enableSystem: true,
|
264
|
+
disableTransitionOnChange: true,
|
265
|
+
...props,
|
266
|
+
children
|
267
|
+
}
|
268
|
+
);
|
269
|
+
}
|
270
|
+
function ThemeProviderNoSSR({
|
271
|
+
children,
|
272
|
+
...props
|
273
|
+
}) {
|
274
|
+
const [mounted, setMounted] = React.useState(false);
|
275
|
+
React.useEffect(() => {
|
276
|
+
setMounted(true);
|
277
|
+
}, []);
|
278
|
+
if (!mounted) {
|
279
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
280
|
+
}
|
281
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { ...props, children });
|
282
|
+
}
|
296
283
|
|
297
284
|
// src/themes/index.ts
|
298
|
-
init_theme_provider();
|
299
285
|
init_theme_context();
|
300
286
|
init_theme_toggle2();
|
301
|
-
|
302
|
-
() => Promise.resolve().then(() => (init_theme_provider(), theme_provider_exports)).then((mod) => ({ default: mod.ThemeProvider })),
|
303
|
-
{
|
304
|
-
ssr: false,
|
305
|
-
loading: () => /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" } })
|
306
|
-
}
|
307
|
-
);
|
308
|
-
var DynamicThemeProviderNoSSR = dynamic(
|
309
|
-
() => Promise.resolve().then(() => (init_theme_provider(), theme_provider_exports)).then((mod) => ({ default: mod.ThemeProviderNoSSR })),
|
310
|
-
{
|
311
|
-
ssr: false,
|
312
|
-
loading: () => /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" } })
|
313
|
-
}
|
314
|
-
);
|
315
|
-
var DynamicThemeToggle = dynamic(
|
316
|
-
() => Promise.resolve().then(() => (init_theme_toggle2(), theme_toggle_exports)).then((mod) => ({ default: mod.ThemeToggle })),
|
317
|
-
{
|
318
|
-
ssr: false,
|
319
|
-
loading: () => /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" } })
|
320
|
-
}
|
321
|
-
);
|
322
|
-
function SafeThemeProvider({
|
287
|
+
function ClientThemeProvider({
|
323
288
|
children,
|
324
|
-
noSSR = false,
|
325
289
|
...props
|
326
290
|
}) {
|
327
|
-
|
328
|
-
|
291
|
+
const [mounted, setMounted] = React.useState(false);
|
292
|
+
React.useEffect(() => {
|
293
|
+
setMounted(true);
|
294
|
+
}, []);
|
295
|
+
if (!mounted) {
|
296
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
297
|
+
}
|
298
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { ...props, children });
|
299
|
+
}
|
300
|
+
function ClientThemeToggle(props) {
|
301
|
+
const [mounted, setMounted] = React.useState(false);
|
302
|
+
const [ThemeToggleComponent, setThemeToggleComponent] = React.useState(null);
|
303
|
+
React.useEffect(() => {
|
304
|
+
setMounted(true);
|
305
|
+
Promise.resolve().then(() => (init_theme_toggle2(), theme_toggle_exports)).then(({ ThemeToggle: ThemeToggle2 }) => {
|
306
|
+
setThemeToggleComponent(() => ThemeToggle2);
|
307
|
+
});
|
308
|
+
}, []);
|
309
|
+
if (!mounted || !ThemeToggleComponent) {
|
310
|
+
return null;
|
329
311
|
}
|
330
|
-
return /* @__PURE__ */ jsx(
|
312
|
+
return /* @__PURE__ */ jsx(ThemeToggleComponent, { ...props });
|
331
313
|
}
|
332
314
|
|
333
315
|
// src/themes/index.ts
|
334
316
|
init_theme_utils();
|
335
317
|
|
336
|
-
export {
|
318
|
+
export { ClientThemeProvider, ClientThemeToggle, ThemeContextProvider, ThemeProvider, ThemeProviderNoSSR, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme, useThemeServer };
|
337
319
|
//# sourceMappingURL=index.mjs.map
|
338
320
|
//# sourceMappingURL=index.mjs.map
|