@djangocfg/ui-nextjs 2.1.102 → 2.1.104
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/package.json +26 -30
- package/src/components/index.ts +2 -0
- package/src/components/ssr-pagination.tsx +2 -1
- package/src/hooks/index.ts +1 -6
- package/src/index.ts +2 -0
- package/src/theme/index.ts +2 -0
- package/dist/animations.cjs +0 -880
- package/dist/animations.cjs.map +0 -1
- package/dist/animations.mjs +0 -877
- package/dist/animations.mjs.map +0 -1
- package/dist/blocks.cjs +0 -1609
- package/dist/blocks.cjs.map +0 -1
- package/dist/blocks.d.mts +0 -278
- package/dist/blocks.d.ts +0 -278
- package/dist/blocks.mjs +0 -1589
- package/dist/blocks.mjs.map +0 -1
- package/dist/components.cjs +0 -1946
- package/dist/components.cjs.map +0 -1
- package/dist/components.d.mts +0 -322
- package/dist/components.d.ts +0 -322
- package/dist/components.mjs +0 -1860
- package/dist/components.mjs.map +0 -1
- package/dist/hooks.cjs +0 -530
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.mjs +0 -506
- package/dist/hooks.mjs.map +0 -1
- package/dist/index.cjs +0 -4080
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -1044
- package/dist/index.d.ts +0 -1044
- package/dist/index.mjs +0 -3962
- package/dist/index.mjs.map +0 -1
- package/dist/theme.cjs +0 -189
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.d.mts +0 -60
- package/dist/theme.d.ts +0 -60
- package/dist/theme.mjs +0 -184
- package/dist/theme.mjs.map +0 -1
- package/src/hooks/useCfgRouter.ts +0 -153
- package/src/hooks/useQueryParams.ts +0 -73
package/dist/theme.cjs
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var nextThemes = require('next-themes');
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var lucideReact = require('lucide-react');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var components = require('@djangocfg/ui-core/components');
|
|
8
|
-
var hooks = require('@djangocfg/ui-core/hooks');
|
|
9
|
-
var lib = require('@djangocfg/ui-core/lib');
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
-
function ThemeProvider({
|
|
14
|
-
children,
|
|
15
|
-
attribute = "class",
|
|
16
|
-
defaultTheme = "system",
|
|
17
|
-
enableSystem = true,
|
|
18
|
-
disableTransitionOnChange = true,
|
|
19
|
-
...props
|
|
20
|
-
}) {
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
-
nextThemes.ThemeProvider,
|
|
23
|
-
{
|
|
24
|
-
attribute,
|
|
25
|
-
defaultTheme,
|
|
26
|
-
enableSystem,
|
|
27
|
-
disableTransitionOnChange,
|
|
28
|
-
...props,
|
|
29
|
-
children
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
__name(ThemeProvider, "ThemeProvider");
|
|
34
|
-
function useThemeContext() {
|
|
35
|
-
const { theme, setTheme, resolvedTheme, systemTheme, themes } = nextThemes.useTheme();
|
|
36
|
-
const toggleTheme = /* @__PURE__ */ __name(() => {
|
|
37
|
-
const currentResolved = resolvedTheme || "light";
|
|
38
|
-
setTheme(currentResolved === "light" ? "dark" : "light");
|
|
39
|
-
}, "toggleTheme");
|
|
40
|
-
return {
|
|
41
|
-
theme,
|
|
42
|
-
setTheme,
|
|
43
|
-
resolvedTheme,
|
|
44
|
-
systemTheme,
|
|
45
|
-
themes,
|
|
46
|
-
toggleTheme
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
__name(useThemeContext, "useThemeContext");
|
|
50
|
-
function ThemeToggle({ className, size = "auto" }) {
|
|
51
|
-
const { resolvedTheme, toggleTheme } = useThemeContext();
|
|
52
|
-
const [mounted, setMounted] = react.useState(false);
|
|
53
|
-
const isMobile = hooks.useIsMobile();
|
|
54
|
-
react.useEffect(() => {
|
|
55
|
-
setMounted(true);
|
|
56
|
-
}, []);
|
|
57
|
-
const actualSize = size === "auto" ? isMobile ? "compact" : "default" : size;
|
|
58
|
-
const buttonSize = actualSize === "compact" ? "h-8 w-8" : "h-9 w-9";
|
|
59
|
-
const iconSize = actualSize === "compact" ? "h-3.5 w-3.5" : "h-4 w-4";
|
|
60
|
-
if (!mounted) {
|
|
61
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62
|
-
components.Button,
|
|
63
|
-
{
|
|
64
|
-
variant: "ghost",
|
|
65
|
-
size: "icon",
|
|
66
|
-
className: lib.cn(buttonSize, className),
|
|
67
|
-
disabled: true,
|
|
68
|
-
children: [
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, { className: iconSize }),
|
|
70
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
76
|
-
components.Button,
|
|
77
|
-
{
|
|
78
|
-
variant: "ghost",
|
|
79
|
-
size: "icon",
|
|
80
|
-
onClick: toggleTheme,
|
|
81
|
-
className: lib.cn(buttonSize, className),
|
|
82
|
-
title: `Switch to ${resolvedTheme === "light" ? "dark" : "light"} theme`,
|
|
83
|
-
children: [
|
|
84
|
-
resolvedTheme === "light" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, { className: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, { className: iconSize }),
|
|
85
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
__name(ThemeToggle, "ThemeToggle");
|
|
91
|
-
var darkThemeVars = {
|
|
92
|
-
// Base HSL values
|
|
93
|
-
"--background": "0 0% 4%",
|
|
94
|
-
"--foreground": "0 0% 98%",
|
|
95
|
-
"--card": "0 0% 8%",
|
|
96
|
-
"--card-foreground": "0 0% 98%",
|
|
97
|
-
"--popover": "0 0% 12%",
|
|
98
|
-
"--popover-foreground": "0 0% 98%",
|
|
99
|
-
"--primary": "217 91% 60%",
|
|
100
|
-
"--primary-foreground": "0 0% 100%",
|
|
101
|
-
"--secondary": "0 0% 98%",
|
|
102
|
-
"--secondary-foreground": "0 0% 9%",
|
|
103
|
-
"--muted": "0 0% 10%",
|
|
104
|
-
"--muted-foreground": "0 0% 60%",
|
|
105
|
-
"--accent": "0 0% 15%",
|
|
106
|
-
"--accent-foreground": "0 0% 98%",
|
|
107
|
-
"--destructive": "0 84% 60%",
|
|
108
|
-
"--destructive-foreground": "0 0% 98%",
|
|
109
|
-
"--border": "0 0% 15%",
|
|
110
|
-
"--input": "0 0% 15%",
|
|
111
|
-
"--ring": "217 91% 60%",
|
|
112
|
-
// Tailwind color tokens (used by bg-*, text-*, etc)
|
|
113
|
-
"--color-background": "hsl(0 0% 4%)",
|
|
114
|
-
"--color-foreground": "hsl(0 0% 98%)",
|
|
115
|
-
"--color-card": "hsl(0 0% 8%)",
|
|
116
|
-
"--color-card-foreground": "hsl(0 0% 98%)",
|
|
117
|
-
"--color-primary": "hsl(217 91% 60%)",
|
|
118
|
-
"--color-primary-foreground": "hsl(0 0% 100%)",
|
|
119
|
-
"--color-secondary": "hsl(0 0% 98%)",
|
|
120
|
-
"--color-secondary-foreground": "hsl(0 0% 9%)",
|
|
121
|
-
"--color-muted": "hsl(0 0% 10%)",
|
|
122
|
-
"--color-muted-foreground": "hsl(0 0% 60%)",
|
|
123
|
-
"--color-accent": "hsl(0 0% 15%)",
|
|
124
|
-
"--color-accent-foreground": "hsl(0 0% 98%)",
|
|
125
|
-
"--color-destructive": "hsl(0 84% 60%)",
|
|
126
|
-
"--color-destructive-foreground": "hsl(0 0% 98%)",
|
|
127
|
-
"--color-border": "hsl(0 0% 15%)",
|
|
128
|
-
"--color-input": "hsl(0 0% 15%)",
|
|
129
|
-
"--color-ring": "hsl(217 91% 60%)"
|
|
130
|
-
};
|
|
131
|
-
var lightThemeVars = {
|
|
132
|
-
// Base HSL values
|
|
133
|
-
"--background": "0 0% 96%",
|
|
134
|
-
"--foreground": "0 0% 9%",
|
|
135
|
-
"--card": "0 0% 100%",
|
|
136
|
-
"--card-foreground": "0 0% 9%",
|
|
137
|
-
"--popover": "0 0% 100%",
|
|
138
|
-
"--popover-foreground": "0 0% 9%",
|
|
139
|
-
"--primary": "217 91% 60%",
|
|
140
|
-
"--primary-foreground": "0 0% 100%",
|
|
141
|
-
"--secondary": "0 0% 9%",
|
|
142
|
-
"--secondary-foreground": "0 0% 98%",
|
|
143
|
-
"--muted": "0 0% 96%",
|
|
144
|
-
"--muted-foreground": "0 0% 40%",
|
|
145
|
-
"--accent": "0 0% 92%",
|
|
146
|
-
"--accent-foreground": "0 0% 9%",
|
|
147
|
-
"--destructive": "0 84% 60%",
|
|
148
|
-
"--destructive-foreground": "0 0% 98%",
|
|
149
|
-
"--border": "0 0% 90%",
|
|
150
|
-
"--input": "0 0% 90%",
|
|
151
|
-
"--ring": "217 91% 60%",
|
|
152
|
-
// Tailwind color tokens (used by bg-*, text-*, etc)
|
|
153
|
-
"--color-background": "hsl(0 0% 96%)",
|
|
154
|
-
"--color-foreground": "hsl(0 0% 9%)",
|
|
155
|
-
"--color-card": "hsl(0 0% 100%)",
|
|
156
|
-
"--color-card-foreground": "hsl(0 0% 9%)",
|
|
157
|
-
"--color-primary": "hsl(217 91% 60%)",
|
|
158
|
-
"--color-primary-foreground": "hsl(0 0% 100%)",
|
|
159
|
-
"--color-secondary": "hsl(0 0% 9%)",
|
|
160
|
-
"--color-secondary-foreground": "hsl(0 0% 98%)",
|
|
161
|
-
"--color-muted": "hsl(0 0% 96%)",
|
|
162
|
-
"--color-muted-foreground": "hsl(0 0% 40%)",
|
|
163
|
-
"--color-accent": "hsl(0 0% 92%)",
|
|
164
|
-
"--color-accent-foreground": "hsl(0 0% 9%)",
|
|
165
|
-
"--color-destructive": "hsl(0 84% 60%)",
|
|
166
|
-
"--color-destructive-foreground": "hsl(0 0% 98%)",
|
|
167
|
-
"--color-border": "hsl(0 0% 90%)",
|
|
168
|
-
"--color-input": "hsl(0 0% 90%)",
|
|
169
|
-
"--color-ring": "hsl(217 91% 60%)"
|
|
170
|
-
};
|
|
171
|
-
function ForceTheme({ theme, children, className }) {
|
|
172
|
-
const themeVars = theme === "dark" ? darkThemeVars : lightThemeVars;
|
|
173
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
-
"div",
|
|
175
|
-
{
|
|
176
|
-
className: lib.cn(theme, className),
|
|
177
|
-
style: themeVars,
|
|
178
|
-
children
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
__name(ForceTheme, "ForceTheme");
|
|
183
|
-
|
|
184
|
-
exports.ForceTheme = ForceTheme;
|
|
185
|
-
exports.ThemeProvider = ThemeProvider;
|
|
186
|
-
exports.ThemeToggle = ThemeToggle;
|
|
187
|
-
exports.useThemeContext = useThemeContext;
|
|
188
|
-
//# sourceMappingURL=theme.cjs.map
|
|
189
|
-
//# sourceMappingURL=theme.cjs.map
|
package/dist/theme.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/ThemeProvider.tsx","../src/theme/ThemeToggle.tsx","../src/theme/ForceTheme.tsx"],"names":["jsx","NextThemesProvider","useNextTheme","useState","useIsMobile","useEffect","jsxs","Button","cn","Sun","Moon"],"mappings":";;;;;;;;;;;;AAkCO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,SAAA,GAAY,OAAA;AAAA,EACZ,YAAA,GAAe,QAAA;AAAA,EACf,YAAA,GAAe,IAAA;AAAA,EACf,yBAAA,GAA4B,IAAA;AAAA,EAC5B,GAAG;AACL,CA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AA,GAAY,KAAA,KAAU,MAAA,GAAS,aAAA,GAAgB,cAAA;AAErD,EAAA,uBACEA,cAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWQ,MAAAA,CAAG,KAAA,EAAO,SAAS,CAAA;AAAA,MAC9B,KAAA,EAAO,SAAA;AAAA,MAEN;AAAA;AAAA,GACH;AAEJ;AAXgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"theme.cjs","sourcesContent":["/**\n * ThemeProvider - Universal theme management\n *\n * Re-exports next-themes ThemeProvider with sensible defaults.\n * Supports light, dark, and system themes with localStorage persistence.\n *\n * @example\n * ```tsx\n * // In app/layout.tsx\n * import { ThemeProvider } from '@djangocfg/ui-nextjs';\n *\n * <ThemeProvider\n * attribute=\"class\"\n * defaultTheme=\"system\"\n * enableSystem\n * >\n * {children}\n * </ThemeProvider>\n * ```\n */\n\n'use client';\n\nimport { ThemeProvider as NextThemesProvider, useTheme as useNextTheme } from 'next-themes';\n\nimport type { ThemeProviderProps as NextThemesProviderProps } from 'next-themes';\n\n// Re-export types\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ThemeProviderProps = NextThemesProviderProps;\n\n/**\n * ThemeProvider wraps next-themes with sensible defaults\n */\nexport function ThemeProvider({\n children,\n attribute = 'class',\n defaultTheme = 'system',\n enableSystem = true,\n disableTransitionOnChange = true,\n ...props\n}: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute={attribute}\n defaultTheme={defaultTheme}\n enableSystem={enableSystem}\n disableTransitionOnChange={disableTransitionOnChange}\n {...props}\n >\n {children}\n </NextThemesProvider>\n );\n}\n\n/**\n * Hook to access theme context\n * Returns theme, setTheme, resolvedTheme, systemTheme, and themes\n */\nexport function useThemeContext() {\n const { theme, setTheme, resolvedTheme, systemTheme, themes } = useNextTheme();\n\n const toggleTheme = () => {\n // Toggle between light and dark (ignore system)\n const currentResolved = resolvedTheme || 'light';\n setTheme(currentResolved === 'light' ? 'dark' : 'light');\n };\n\n return {\n theme: theme as Theme | undefined,\n setTheme,\n resolvedTheme: resolvedTheme as 'light' | 'dark' | undefined,\n systemTheme: systemTheme as 'light' | 'dark' | undefined,\n themes,\n toggleTheme,\n };\n}\n","/**\n * ThemeToggle - Theme switcher component\n *\n * Switches between light and dark themes.\n * Must be used within ThemeProvider.\n *\n * @example\n * ```tsx\n * import { ThemeToggle } from '@djangocfg/ui-nextjs';\n *\n * // Default\n * <ThemeToggle />\n *\n * // Compact (for mobile/tight spaces)\n * <ThemeToggle size=\"compact\" />\n *\n * // Custom className\n * <ThemeToggle className=\"ml-auto\" />\n * ```\n */\n\n'use client';\n\nimport { Moon, Sun } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport { Button } from '@djangocfg/ui-core/components';\nimport { useIsMobile } from '@djangocfg/ui-core/hooks';\nimport { cn } from '@djangocfg/ui-core/lib';\nimport { useThemeContext } from './ThemeProvider';\n\nexport interface ThemeToggleProps {\n /** Custom className */\n className?: string;\n /** Size variant (auto-detects mobile if not specified) */\n size?: 'default' | 'compact' | 'auto';\n}\n\nexport function ThemeToggle({ className, size = 'auto' }: ThemeToggleProps) {\n const { resolvedTheme, toggleTheme } = useThemeContext();\n const [mounted, setMounted] = useState(false);\n const isMobile = useIsMobile();\n\n // Prevent hydration mismatch\n useEffect(() => {\n setMounted(true);\n }, []);\n\n // Determine actual size based on prop and screen size\n const actualSize = size === 'auto' ? (isMobile ? 'compact' : 'default') : size;\n const buttonSize = actualSize === 'compact' ? 'h-8 w-8' : 'h-9 w-9';\n const iconSize = actualSize === 'compact' ? 'h-3.5 w-3.5' : 'h-4 w-4';\n\n if (!mounted) {\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(buttonSize, className)}\n disabled\n >\n <Sun className={iconSize} />\n <span className=\"sr-only\">Toggle theme</span>\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={toggleTheme}\n className={cn(buttonSize, className)}\n title={`Switch to ${resolvedTheme === 'light' ? 'dark' : 'light'} theme`}\n >\n {resolvedTheme === 'light' ? (\n <Sun className={iconSize} />\n ) : (\n <Moon className={iconSize} />\n )}\n <span className=\"sr-only\">Toggle theme</span>\n </Button>\n );\n}\n","/**\n * ForceTheme - Force a specific theme for a section\n *\n * Wraps content to override the global theme setting.\n * Works by adding both the theme class and inline CSS variables\n * to ensure proper theme application regardless of parent context.\n */\n\n'use client';\n\nimport React, { ReactNode } from 'react';\n\nimport { cn } from '@djangocfg/ui-core/lib';\n\ninterface ForceThemeProps {\n theme: 'light' | 'dark';\n children: ReactNode;\n className?: string;\n}\n\n// Dark theme CSS variables\nconst darkThemeVars = {\n // Base HSL values\n '--background': '0 0% 4%',\n '--foreground': '0 0% 98%',\n '--card': '0 0% 8%',\n '--card-foreground': '0 0% 98%',\n '--popover': '0 0% 12%',\n '--popover-foreground': '0 0% 98%',\n '--primary': '217 91% 60%',\n '--primary-foreground': '0 0% 100%',\n '--secondary': '0 0% 98%',\n '--secondary-foreground': '0 0% 9%',\n '--muted': '0 0% 10%',\n '--muted-foreground': '0 0% 60%',\n '--accent': '0 0% 15%',\n '--accent-foreground': '0 0% 98%',\n '--destructive': '0 84% 60%',\n '--destructive-foreground': '0 0% 98%',\n '--border': '0 0% 15%',\n '--input': '0 0% 15%',\n '--ring': '217 91% 60%',\n // Tailwind color tokens (used by bg-*, text-*, etc)\n '--color-background': 'hsl(0 0% 4%)',\n '--color-foreground': 'hsl(0 0% 98%)',\n '--color-card': 'hsl(0 0% 8%)',\n '--color-card-foreground': 'hsl(0 0% 98%)',\n '--color-primary': 'hsl(217 91% 60%)',\n '--color-primary-foreground': 'hsl(0 0% 100%)',\n '--color-secondary': 'hsl(0 0% 98%)',\n '--color-secondary-foreground': 'hsl(0 0% 9%)',\n '--color-muted': 'hsl(0 0% 10%)',\n '--color-muted-foreground': 'hsl(0 0% 60%)',\n '--color-accent': 'hsl(0 0% 15%)',\n '--color-accent-foreground': 'hsl(0 0% 98%)',\n '--color-destructive': 'hsl(0 84% 60%)',\n '--color-destructive-foreground': 'hsl(0 0% 98%)',\n '--color-border': 'hsl(0 0% 15%)',\n '--color-input': 'hsl(0 0% 15%)',\n '--color-ring': 'hsl(217 91% 60%)',\n} as React.CSSProperties;\n\n// Light theme CSS variables\nconst lightThemeVars = {\n // Base HSL values\n '--background': '0 0% 96%',\n '--foreground': '0 0% 9%',\n '--card': '0 0% 100%',\n '--card-foreground': '0 0% 9%',\n '--popover': '0 0% 100%',\n '--popover-foreground': '0 0% 9%',\n '--primary': '217 91% 60%',\n '--primary-foreground': '0 0% 100%',\n '--secondary': '0 0% 9%',\n '--secondary-foreground': '0 0% 98%',\n '--muted': '0 0% 96%',\n '--muted-foreground': '0 0% 40%',\n '--accent': '0 0% 92%',\n '--accent-foreground': '0 0% 9%',\n '--destructive': '0 84% 60%',\n '--destructive-foreground': '0 0% 98%',\n '--border': '0 0% 90%',\n '--input': '0 0% 90%',\n '--ring': '217 91% 60%',\n // Tailwind color tokens (used by bg-*, text-*, etc)\n '--color-background': 'hsl(0 0% 96%)',\n '--color-foreground': 'hsl(0 0% 9%)',\n '--color-card': 'hsl(0 0% 100%)',\n '--color-card-foreground': 'hsl(0 0% 9%)',\n '--color-primary': 'hsl(217 91% 60%)',\n '--color-primary-foreground': 'hsl(0 0% 100%)',\n '--color-secondary': 'hsl(0 0% 9%)',\n '--color-secondary-foreground': 'hsl(0 0% 98%)',\n '--color-muted': 'hsl(0 0% 96%)',\n '--color-muted-foreground': 'hsl(0 0% 40%)',\n '--color-accent': 'hsl(0 0% 92%)',\n '--color-accent-foreground': 'hsl(0 0% 9%)',\n '--color-destructive': 'hsl(0 84% 60%)',\n '--color-destructive-foreground': 'hsl(0 0% 98%)',\n '--color-border': 'hsl(0 0% 90%)',\n '--color-input': 'hsl(0 0% 90%)',\n '--color-ring': 'hsl(217 91% 60%)',\n} as React.CSSProperties;\n\nexport function ForceTheme({ theme, children, className }: ForceThemeProps) {\n const themeVars = theme === 'dark' ? darkThemeVars : lightThemeVars;\n\n return (\n <div\n className={cn(theme, className)}\n style={themeVars}\n >\n {children}\n </div>\n );\n}\n"]}
|
package/dist/theme.d.mts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { ThemeProviderProps as ThemeProviderProps$1 } from 'next-themes';
|
|
5
|
-
|
|
6
|
-
type Theme = 'light' | 'dark' | 'system';
|
|
7
|
-
type ThemeProviderProps = ThemeProviderProps$1;
|
|
8
|
-
/**
|
|
9
|
-
* ThemeProvider wraps next-themes with sensible defaults
|
|
10
|
-
*/
|
|
11
|
-
declare function ThemeProvider({ children, attribute, defaultTheme, enableSystem, disableTransitionOnChange, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
/**
|
|
13
|
-
* Hook to access theme context
|
|
14
|
-
* Returns theme, setTheme, resolvedTheme, systemTheme, and themes
|
|
15
|
-
*/
|
|
16
|
-
declare function useThemeContext(): {
|
|
17
|
-
theme: Theme | undefined;
|
|
18
|
-
setTheme: react.Dispatch<react.SetStateAction<string>>;
|
|
19
|
-
resolvedTheme: "light" | "dark" | undefined;
|
|
20
|
-
systemTheme: "light" | "dark" | undefined;
|
|
21
|
-
themes: string[];
|
|
22
|
-
toggleTheme: () => void;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ThemeToggle - Theme switcher component
|
|
27
|
-
*
|
|
28
|
-
* Switches between light and dark themes.
|
|
29
|
-
* Must be used within ThemeProvider.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* import { ThemeToggle } from '@djangocfg/ui-nextjs';
|
|
34
|
-
*
|
|
35
|
-
* // Default
|
|
36
|
-
* <ThemeToggle />
|
|
37
|
-
*
|
|
38
|
-
* // Compact (for mobile/tight spaces)
|
|
39
|
-
* <ThemeToggle size="compact" />
|
|
40
|
-
*
|
|
41
|
-
* // Custom className
|
|
42
|
-
* <ThemeToggle className="ml-auto" />
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
interface ThemeToggleProps {
|
|
46
|
-
/** Custom className */
|
|
47
|
-
className?: string;
|
|
48
|
-
/** Size variant (auto-detects mobile if not specified) */
|
|
49
|
-
size?: 'default' | 'compact' | 'auto';
|
|
50
|
-
}
|
|
51
|
-
declare function ThemeToggle({ className, size }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
52
|
-
|
|
53
|
-
interface ForceThemeProps {
|
|
54
|
-
theme: 'light' | 'dark';
|
|
55
|
-
children: ReactNode;
|
|
56
|
-
className?: string;
|
|
57
|
-
}
|
|
58
|
-
declare function ForceTheme({ theme, children, className }: ForceThemeProps): react_jsx_runtime.JSX.Element;
|
|
59
|
-
|
|
60
|
-
export { ForceTheme, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, useThemeContext };
|
package/dist/theme.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { ThemeProviderProps as ThemeProviderProps$1 } from 'next-themes';
|
|
5
|
-
|
|
6
|
-
type Theme = 'light' | 'dark' | 'system';
|
|
7
|
-
type ThemeProviderProps = ThemeProviderProps$1;
|
|
8
|
-
/**
|
|
9
|
-
* ThemeProvider wraps next-themes with sensible defaults
|
|
10
|
-
*/
|
|
11
|
-
declare function ThemeProvider({ children, attribute, defaultTheme, enableSystem, disableTransitionOnChange, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
/**
|
|
13
|
-
* Hook to access theme context
|
|
14
|
-
* Returns theme, setTheme, resolvedTheme, systemTheme, and themes
|
|
15
|
-
*/
|
|
16
|
-
declare function useThemeContext(): {
|
|
17
|
-
theme: Theme | undefined;
|
|
18
|
-
setTheme: react.Dispatch<react.SetStateAction<string>>;
|
|
19
|
-
resolvedTheme: "light" | "dark" | undefined;
|
|
20
|
-
systemTheme: "light" | "dark" | undefined;
|
|
21
|
-
themes: string[];
|
|
22
|
-
toggleTheme: () => void;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ThemeToggle - Theme switcher component
|
|
27
|
-
*
|
|
28
|
-
* Switches between light and dark themes.
|
|
29
|
-
* Must be used within ThemeProvider.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* import { ThemeToggle } from '@djangocfg/ui-nextjs';
|
|
34
|
-
*
|
|
35
|
-
* // Default
|
|
36
|
-
* <ThemeToggle />
|
|
37
|
-
*
|
|
38
|
-
* // Compact (for mobile/tight spaces)
|
|
39
|
-
* <ThemeToggle size="compact" />
|
|
40
|
-
*
|
|
41
|
-
* // Custom className
|
|
42
|
-
* <ThemeToggle className="ml-auto" />
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
interface ThemeToggleProps {
|
|
46
|
-
/** Custom className */
|
|
47
|
-
className?: string;
|
|
48
|
-
/** Size variant (auto-detects mobile if not specified) */
|
|
49
|
-
size?: 'default' | 'compact' | 'auto';
|
|
50
|
-
}
|
|
51
|
-
declare function ThemeToggle({ className, size }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
52
|
-
|
|
53
|
-
interface ForceThemeProps {
|
|
54
|
-
theme: 'light' | 'dark';
|
|
55
|
-
children: ReactNode;
|
|
56
|
-
className?: string;
|
|
57
|
-
}
|
|
58
|
-
declare function ForceTheme({ theme, children, className }: ForceThemeProps): react_jsx_runtime.JSX.Element;
|
|
59
|
-
|
|
60
|
-
export { ForceTheme, type Theme, ThemeProvider, type ThemeProviderProps, ThemeToggle, useThemeContext };
|
package/dist/theme.mjs
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider as ThemeProvider$1, useTheme } from 'next-themes';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { Sun, Moon } from 'lucide-react';
|
|
4
|
-
import { useState, useEffect } from 'react';
|
|
5
|
-
import { Button } from '@djangocfg/ui-core/components';
|
|
6
|
-
import { useIsMobile } from '@djangocfg/ui-core/hooks';
|
|
7
|
-
import { cn } from '@djangocfg/ui-core/lib';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
-
function ThemeProvider({
|
|
12
|
-
children,
|
|
13
|
-
attribute = "class",
|
|
14
|
-
defaultTheme = "system",
|
|
15
|
-
enableSystem = true,
|
|
16
|
-
disableTransitionOnChange = true,
|
|
17
|
-
...props
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
-
ThemeProvider$1,
|
|
21
|
-
{
|
|
22
|
-
attribute,
|
|
23
|
-
defaultTheme,
|
|
24
|
-
enableSystem,
|
|
25
|
-
disableTransitionOnChange,
|
|
26
|
-
...props,
|
|
27
|
-
children
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
__name(ThemeProvider, "ThemeProvider");
|
|
32
|
-
function useThemeContext() {
|
|
33
|
-
const { theme, setTheme, resolvedTheme, systemTheme, themes } = useTheme();
|
|
34
|
-
const toggleTheme = /* @__PURE__ */ __name(() => {
|
|
35
|
-
const currentResolved = resolvedTheme || "light";
|
|
36
|
-
setTheme(currentResolved === "light" ? "dark" : "light");
|
|
37
|
-
}, "toggleTheme");
|
|
38
|
-
return {
|
|
39
|
-
theme,
|
|
40
|
-
setTheme,
|
|
41
|
-
resolvedTheme,
|
|
42
|
-
systemTheme,
|
|
43
|
-
themes,
|
|
44
|
-
toggleTheme
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
__name(useThemeContext, "useThemeContext");
|
|
48
|
-
function ThemeToggle({ className, size = "auto" }) {
|
|
49
|
-
const { resolvedTheme, toggleTheme } = useThemeContext();
|
|
50
|
-
const [mounted, setMounted] = useState(false);
|
|
51
|
-
const isMobile = useIsMobile();
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
setMounted(true);
|
|
54
|
-
}, []);
|
|
55
|
-
const actualSize = size === "auto" ? isMobile ? "compact" : "default" : size;
|
|
56
|
-
const buttonSize = actualSize === "compact" ? "h-8 w-8" : "h-9 w-9";
|
|
57
|
-
const iconSize = actualSize === "compact" ? "h-3.5 w-3.5" : "h-4 w-4";
|
|
58
|
-
if (!mounted) {
|
|
59
|
-
return /* @__PURE__ */ jsxs(
|
|
60
|
-
Button,
|
|
61
|
-
{
|
|
62
|
-
variant: "ghost",
|
|
63
|
-
size: "icon",
|
|
64
|
-
className: cn(buttonSize, className),
|
|
65
|
-
disabled: true,
|
|
66
|
-
children: [
|
|
67
|
-
/* @__PURE__ */ jsx(Sun, { className: iconSize }),
|
|
68
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
return /* @__PURE__ */ jsxs(
|
|
74
|
-
Button,
|
|
75
|
-
{
|
|
76
|
-
variant: "ghost",
|
|
77
|
-
size: "icon",
|
|
78
|
-
onClick: toggleTheme,
|
|
79
|
-
className: cn(buttonSize, className),
|
|
80
|
-
title: `Switch to ${resolvedTheme === "light" ? "dark" : "light"} theme`,
|
|
81
|
-
children: [
|
|
82
|
-
resolvedTheme === "light" ? /* @__PURE__ */ jsx(Sun, { className: iconSize }) : /* @__PURE__ */ jsx(Moon, { className: iconSize }),
|
|
83
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
__name(ThemeToggle, "ThemeToggle");
|
|
89
|
-
var darkThemeVars = {
|
|
90
|
-
// Base HSL values
|
|
91
|
-
"--background": "0 0% 4%",
|
|
92
|
-
"--foreground": "0 0% 98%",
|
|
93
|
-
"--card": "0 0% 8%",
|
|
94
|
-
"--card-foreground": "0 0% 98%",
|
|
95
|
-
"--popover": "0 0% 12%",
|
|
96
|
-
"--popover-foreground": "0 0% 98%",
|
|
97
|
-
"--primary": "217 91% 60%",
|
|
98
|
-
"--primary-foreground": "0 0% 100%",
|
|
99
|
-
"--secondary": "0 0% 98%",
|
|
100
|
-
"--secondary-foreground": "0 0% 9%",
|
|
101
|
-
"--muted": "0 0% 10%",
|
|
102
|
-
"--muted-foreground": "0 0% 60%",
|
|
103
|
-
"--accent": "0 0% 15%",
|
|
104
|
-
"--accent-foreground": "0 0% 98%",
|
|
105
|
-
"--destructive": "0 84% 60%",
|
|
106
|
-
"--destructive-foreground": "0 0% 98%",
|
|
107
|
-
"--border": "0 0% 15%",
|
|
108
|
-
"--input": "0 0% 15%",
|
|
109
|
-
"--ring": "217 91% 60%",
|
|
110
|
-
// Tailwind color tokens (used by bg-*, text-*, etc)
|
|
111
|
-
"--color-background": "hsl(0 0% 4%)",
|
|
112
|
-
"--color-foreground": "hsl(0 0% 98%)",
|
|
113
|
-
"--color-card": "hsl(0 0% 8%)",
|
|
114
|
-
"--color-card-foreground": "hsl(0 0% 98%)",
|
|
115
|
-
"--color-primary": "hsl(217 91% 60%)",
|
|
116
|
-
"--color-primary-foreground": "hsl(0 0% 100%)",
|
|
117
|
-
"--color-secondary": "hsl(0 0% 98%)",
|
|
118
|
-
"--color-secondary-foreground": "hsl(0 0% 9%)",
|
|
119
|
-
"--color-muted": "hsl(0 0% 10%)",
|
|
120
|
-
"--color-muted-foreground": "hsl(0 0% 60%)",
|
|
121
|
-
"--color-accent": "hsl(0 0% 15%)",
|
|
122
|
-
"--color-accent-foreground": "hsl(0 0% 98%)",
|
|
123
|
-
"--color-destructive": "hsl(0 84% 60%)",
|
|
124
|
-
"--color-destructive-foreground": "hsl(0 0% 98%)",
|
|
125
|
-
"--color-border": "hsl(0 0% 15%)",
|
|
126
|
-
"--color-input": "hsl(0 0% 15%)",
|
|
127
|
-
"--color-ring": "hsl(217 91% 60%)"
|
|
128
|
-
};
|
|
129
|
-
var lightThemeVars = {
|
|
130
|
-
// Base HSL values
|
|
131
|
-
"--background": "0 0% 96%",
|
|
132
|
-
"--foreground": "0 0% 9%",
|
|
133
|
-
"--card": "0 0% 100%",
|
|
134
|
-
"--card-foreground": "0 0% 9%",
|
|
135
|
-
"--popover": "0 0% 100%",
|
|
136
|
-
"--popover-foreground": "0 0% 9%",
|
|
137
|
-
"--primary": "217 91% 60%",
|
|
138
|
-
"--primary-foreground": "0 0% 100%",
|
|
139
|
-
"--secondary": "0 0% 9%",
|
|
140
|
-
"--secondary-foreground": "0 0% 98%",
|
|
141
|
-
"--muted": "0 0% 96%",
|
|
142
|
-
"--muted-foreground": "0 0% 40%",
|
|
143
|
-
"--accent": "0 0% 92%",
|
|
144
|
-
"--accent-foreground": "0 0% 9%",
|
|
145
|
-
"--destructive": "0 84% 60%",
|
|
146
|
-
"--destructive-foreground": "0 0% 98%",
|
|
147
|
-
"--border": "0 0% 90%",
|
|
148
|
-
"--input": "0 0% 90%",
|
|
149
|
-
"--ring": "217 91% 60%",
|
|
150
|
-
// Tailwind color tokens (used by bg-*, text-*, etc)
|
|
151
|
-
"--color-background": "hsl(0 0% 96%)",
|
|
152
|
-
"--color-foreground": "hsl(0 0% 9%)",
|
|
153
|
-
"--color-card": "hsl(0 0% 100%)",
|
|
154
|
-
"--color-card-foreground": "hsl(0 0% 9%)",
|
|
155
|
-
"--color-primary": "hsl(217 91% 60%)",
|
|
156
|
-
"--color-primary-foreground": "hsl(0 0% 100%)",
|
|
157
|
-
"--color-secondary": "hsl(0 0% 9%)",
|
|
158
|
-
"--color-secondary-foreground": "hsl(0 0% 98%)",
|
|
159
|
-
"--color-muted": "hsl(0 0% 96%)",
|
|
160
|
-
"--color-muted-foreground": "hsl(0 0% 40%)",
|
|
161
|
-
"--color-accent": "hsl(0 0% 92%)",
|
|
162
|
-
"--color-accent-foreground": "hsl(0 0% 9%)",
|
|
163
|
-
"--color-destructive": "hsl(0 84% 60%)",
|
|
164
|
-
"--color-destructive-foreground": "hsl(0 0% 98%)",
|
|
165
|
-
"--color-border": "hsl(0 0% 90%)",
|
|
166
|
-
"--color-input": "hsl(0 0% 90%)",
|
|
167
|
-
"--color-ring": "hsl(217 91% 60%)"
|
|
168
|
-
};
|
|
169
|
-
function ForceTheme({ theme, children, className }) {
|
|
170
|
-
const themeVars = theme === "dark" ? darkThemeVars : lightThemeVars;
|
|
171
|
-
return /* @__PURE__ */ jsx(
|
|
172
|
-
"div",
|
|
173
|
-
{
|
|
174
|
-
className: cn(theme, className),
|
|
175
|
-
style: themeVars,
|
|
176
|
-
children
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
__name(ForceTheme, "ForceTheme");
|
|
181
|
-
|
|
182
|
-
export { ForceTheme, ThemeProvider, ThemeToggle, useThemeContext };
|
|
183
|
-
//# sourceMappingURL=theme.mjs.map
|
|
184
|
-
//# sourceMappingURL=theme.mjs.map
|
package/dist/theme.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/ThemeProvider.tsx","../src/theme/ThemeToggle.tsx","../src/theme/ForceTheme.tsx"],"names":["NextThemesProvider","useNextTheme","jsx","cn"],"mappings":";;;;;;;;;;AAkCO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,SAAA,GAAY,OAAA;AAAA,EACZ,YAAA,GAAe,QAAA;AAAA,EACf,YAAA,GAAe,IAAA;AAAA,EACf,yBAAA,GAA4B,IAAA;AAAA,EAC5B,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,uBACE,GAAA;AAAA,IAACA,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,MACA,y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G,KAAA,EAAO,SAAS,CAAA;AAAA,MAC9B,KAAA,EAAO,SAAA;AAAA,MAEN;AAAA;AAAA,GACH;AAEJ;AAXgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"theme.mjs","sourcesContent":["/**\n * ThemeProvider - Universal theme management\n *\n * Re-exports next-themes ThemeProvider with sensible defaults.\n * Supports light, dark, and system themes with localStorage persistence.\n *\n * @example\n * ```tsx\n * // In app/layout.tsx\n * import { ThemeProvider } from '@djangocfg/ui-nextjs';\n *\n * <ThemeProvider\n * attribute=\"class\"\n * defaultTheme=\"system\"\n * enableSystem\n * >\n * {children}\n * </ThemeProvider>\n * ```\n */\n\n'use client';\n\nimport { ThemeProvider as NextThemesProvider, useTheme as useNextTheme } from 'next-themes';\n\nimport type { ThemeProviderProps as NextThemesProviderProps } from 'next-themes';\n\n// Re-export types\nexport type Theme = 'light' | 'dark' | 'system';\nexport type ThemeProviderProps = NextThemesProviderProps;\n\n/**\n * ThemeProvider wraps next-themes with sensible defaults\n */\nexport function ThemeProvider({\n children,\n attribute = 'class',\n defaultTheme = 'system',\n enableSystem = true,\n disableTransitionOnChange = true,\n ...props\n}: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute={attribute}\n defaultTheme={defaultTheme}\n enableSystem={enableSystem}\n disableTransitionOnChange={disableTransitionOnChange}\n {...props}\n >\n {children}\n </NextThemesProvider>\n );\n}\n\n/**\n * Hook to access theme context\n * Returns theme, setTheme, resolvedTheme, systemTheme, and themes\n */\nexport function useThemeContext() {\n const { theme, setTheme, resolvedTheme, systemTheme, themes } = useNextTheme();\n\n const toggleTheme = () => {\n // Toggle between light and dark (ignore system)\n const currentResolved = resolvedTheme || 'light';\n setTheme(currentResolved === 'light' ? 'dark' : 'light');\n };\n\n return {\n theme: theme as Theme | undefined,\n setTheme,\n resolvedTheme: resolvedTheme as 'light' | 'dark' | undefined,\n systemTheme: systemTheme as 'light' | 'dark' | undefined,\n themes,\n toggleTheme,\n };\n}\n","/**\n * ThemeToggle - Theme switcher component\n *\n * Switches between light and dark themes.\n * Must be used within ThemeProvider.\n *\n * @example\n * ```tsx\n * import { ThemeToggle } from '@djangocfg/ui-nextjs';\n *\n * // Default\n * <ThemeToggle />\n *\n * // Compact (for mobile/tight spaces)\n * <ThemeToggle size=\"compact\" />\n *\n * // Custom className\n * <ThemeToggle className=\"ml-auto\" />\n * ```\n */\n\n'use client';\n\nimport { Moon, Sun } from 'lucide-react';\nimport { useEffect, useState } from 'react';\n\nimport { Button } from '@djangocfg/ui-core/components';\nimport { useIsMobile } from '@djangocfg/ui-core/hooks';\nimport { cn } from '@djangocfg/ui-core/lib';\nimport { useThemeContext } from './ThemeProvider';\n\nexport interface ThemeToggleProps {\n /** Custom className */\n className?: string;\n /** Size variant (auto-detects mobile if not specified) */\n size?: 'default' | 'compact' | 'auto';\n}\n\nexport function ThemeToggle({ className, size = 'auto' }: ThemeToggleProps) {\n const { resolvedTheme, toggleTheme } = useThemeContext();\n const [mounted, setMounted] = useState(false);\n const isMobile = useIsMobile();\n\n // Prevent hydration mismatch\n useEffect(() => {\n setMounted(true);\n }, []);\n\n // Determine actual size based on prop and screen size\n const actualSize = size === 'auto' ? (isMobile ? 'compact' : 'default') : size;\n const buttonSize = actualSize === 'compact' ? 'h-8 w-8' : 'h-9 w-9';\n const iconSize = actualSize === 'compact' ? 'h-3.5 w-3.5' : 'h-4 w-4';\n\n if (!mounted) {\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className={cn(buttonSize, className)}\n disabled\n >\n <Sun className={iconSize} />\n <span className=\"sr-only\">Toggle theme</span>\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={toggleTheme}\n className={cn(buttonSize, className)}\n title={`Switch to ${resolvedTheme === 'light' ? 'dark' : 'light'} theme`}\n >\n {resolvedTheme === 'light' ? (\n <Sun className={iconSize} />\n ) : (\n <Moon className={iconSize} />\n )}\n <span className=\"sr-only\">Toggle theme</span>\n </Button>\n );\n}\n","/**\n * ForceTheme - Force a specific theme for a section\n *\n * Wraps content to override the global theme setting.\n * Works by adding both the theme class and inline CSS variables\n * to ensure proper theme application regardless of parent context.\n */\n\n'use client';\n\nimport React, { ReactNode } from 'react';\n\nimport { cn } from '@djangocfg/ui-core/lib';\n\ninterface ForceThemeProps {\n theme: 'light' | 'dark';\n children: ReactNode;\n className?: string;\n}\n\n// Dark theme CSS variables\nconst darkThemeVars = {\n // Base HSL values\n '--background': '0 0% 4%',\n '--foreground': '0 0% 98%',\n '--card': '0 0% 8%',\n '--card-foreground': '0 0% 98%',\n '--popover': '0 0% 12%',\n '--popover-foreground': '0 0% 98%',\n '--primary': '217 91% 60%',\n '--primary-foreground': '0 0% 100%',\n '--secondary': '0 0% 98%',\n '--secondary-foreground': '0 0% 9%',\n '--muted': '0 0% 10%',\n '--muted-foreground': '0 0% 60%',\n '--accent': '0 0% 15%',\n '--accent-foreground': '0 0% 98%',\n '--destructive': '0 84% 60%',\n '--destructive-foreground': '0 0% 98%',\n '--border': '0 0% 15%',\n '--input': '0 0% 15%',\n '--ring': '217 91% 60%',\n // Tailwind color tokens (used by bg-*, text-*, etc)\n '--color-background': 'hsl(0 0% 4%)',\n '--color-foreground': 'hsl(0 0% 98%)',\n '--color-card': 'hsl(0 0% 8%)',\n '--color-card-foreground': 'hsl(0 0% 98%)',\n '--color-primary': 'hsl(217 91% 60%)',\n '--color-primary-foreground': 'hsl(0 0% 100%)',\n '--color-secondary': 'hsl(0 0% 98%)',\n '--color-secondary-foreground': 'hsl(0 0% 9%)',\n '--color-muted': 'hsl(0 0% 10%)',\n '--color-muted-foreground': 'hsl(0 0% 60%)',\n '--color-accent': 'hsl(0 0% 15%)',\n '--color-accent-foreground': 'hsl(0 0% 98%)',\n '--color-destructive': 'hsl(0 84% 60%)',\n '--color-destructive-foreground': 'hsl(0 0% 98%)',\n '--color-border': 'hsl(0 0% 15%)',\n '--color-input': 'hsl(0 0% 15%)',\n '--color-ring': 'hsl(217 91% 60%)',\n} as React.CSSProperties;\n\n// Light theme CSS variables\nconst lightThemeVars = {\n // Base HSL values\n '--background': '0 0% 96%',\n '--foreground': '0 0% 9%',\n '--card': '0 0% 100%',\n '--card-foreground': '0 0% 9%',\n '--popover': '0 0% 100%',\n '--popover-foreground': '0 0% 9%',\n '--primary': '217 91% 60%',\n '--primary-foreground': '0 0% 100%',\n '--secondary': '0 0% 9%',\n '--secondary-foreground': '0 0% 98%',\n '--muted': '0 0% 96%',\n '--muted-foreground': '0 0% 40%',\n '--accent': '0 0% 92%',\n '--accent-foreground': '0 0% 9%',\n '--destructive': '0 84% 60%',\n '--destructive-foreground': '0 0% 98%',\n '--border': '0 0% 90%',\n '--input': '0 0% 90%',\n '--ring': '217 91% 60%',\n // Tailwind color tokens (used by bg-*, text-*, etc)\n '--color-background': 'hsl(0 0% 96%)',\n '--color-foreground': 'hsl(0 0% 9%)',\n '--color-card': 'hsl(0 0% 100%)',\n '--color-card-foreground': 'hsl(0 0% 9%)',\n '--color-primary': 'hsl(217 91% 60%)',\n '--color-primary-foreground': 'hsl(0 0% 100%)',\n '--color-secondary': 'hsl(0 0% 9%)',\n '--color-secondary-foreground': 'hsl(0 0% 98%)',\n '--color-muted': 'hsl(0 0% 96%)',\n '--color-muted-foreground': 'hsl(0 0% 40%)',\n '--color-accent': 'hsl(0 0% 92%)',\n '--color-accent-foreground': 'hsl(0 0% 9%)',\n '--color-destructive': 'hsl(0 84% 60%)',\n '--color-destructive-foreground': 'hsl(0 0% 98%)',\n '--color-border': 'hsl(0 0% 90%)',\n '--color-input': 'hsl(0 0% 90%)',\n '--color-ring': 'hsl(217 91% 60%)',\n} as React.CSSProperties;\n\nexport function ForceTheme({ theme, children, className }: ForceThemeProps) {\n const themeVars = theme === 'dark' ? darkThemeVars : lightThemeVars;\n\n return (\n <div\n className={cn(theme, className)}\n style={themeVars}\n >\n {children}\n </div>\n );\n}\n"]}
|