nextworks 0.2.0-alpha.2 → 0.2.0-alpha.20

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.
Files changed (145) hide show
  1. package/README.md +280 -228
  2. package/dist/cli_manifests/blocks_manifest.json +193 -194
  3. package/dist/commands/blocks.d.ts +3 -0
  4. package/dist/commands/blocks.d.ts.map +1 -1
  5. package/dist/commands/blocks.js +128 -19
  6. package/dist/commands/blocks.js.map +1 -1
  7. package/dist/commands/doctor.d.ts +136 -0
  8. package/dist/commands/doctor.d.ts.map +1 -0
  9. package/dist/commands/doctor.js +696 -0
  10. package/dist/commands/doctor.js.map +1 -0
  11. package/dist/commands/remove-blocks.d.ts +4 -1
  12. package/dist/commands/remove-blocks.d.ts.map +1 -1
  13. package/dist/commands/remove-blocks.js +24 -6
  14. package/dist/commands/remove-blocks.js.map +1 -1
  15. package/dist/index.js +125 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +104 -194
  18. package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +115 -75
  19. package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +269 -251
  20. package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -80
  21. package/dist/kits/blocks/app/templates/digitalagency/README.md +42 -36
  22. package/dist/kits/blocks/app/templates/digitalagency/components/About.tsx +71 -99
  23. package/dist/kits/blocks/app/templates/digitalagency/components/CTA.tsx +40 -74
  24. package/dist/kits/blocks/app/templates/digitalagency/components/Contact.tsx +123 -227
  25. package/dist/kits/blocks/app/templates/digitalagency/components/Footer.tsx +89 -89
  26. package/dist/kits/blocks/app/templates/digitalagency/components/Hero.tsx +83 -90
  27. package/dist/kits/blocks/app/templates/digitalagency/components/Navbar.tsx +121 -168
  28. package/dist/kits/blocks/app/templates/digitalagency/components/NetworkPattern.tsx +288 -297
  29. package/dist/kits/blocks/app/templates/digitalagency/components/Portfolio.tsx +157 -157
  30. package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -114
  31. package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -59
  32. package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -55
  33. package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -28
  34. package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -65
  35. package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -38
  36. package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +130 -85
  37. package/dist/kits/blocks/app/templates/gallery/page.tsx +357 -303
  38. package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +75 -74
  39. package/dist/kits/blocks/app/templates/productlaunch/README.md +62 -55
  40. package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +84 -178
  41. package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +50 -93
  42. package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -231
  43. package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +86 -93
  44. package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +83 -84
  45. package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -132
  46. package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +88 -89
  47. package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +116 -162
  48. package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -106
  49. package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -110
  50. package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -68
  51. package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -104
  52. package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +90 -89
  53. package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -76
  54. package/dist/kits/blocks/app/templates/productlaunch/page.tsx +43 -43
  55. package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -80
  56. package/dist/kits/blocks/app/templates/saasdashboard/README.md +44 -38
  57. package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +129 -176
  58. package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -293
  59. package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -55
  60. package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +90 -91
  61. package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -77
  62. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +104 -105
  63. package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +126 -127
  64. package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +117 -159
  65. package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -90
  66. package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +96 -97
  67. package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -72
  68. package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -53
  69. package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -39
  70. package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -183
  71. package/dist/kits/blocks/components/providers/BlocksAppProviders.tsx +27 -27
  72. package/dist/kits/blocks/components/sections/About.tsx +291 -291
  73. package/dist/kits/blocks/components/sections/CTA.tsx +257 -258
  74. package/dist/kits/blocks/components/sections/CommandShowcase.tsx +517 -0
  75. package/dist/kits/blocks/components/sections/Contact.tsx +267 -267
  76. package/dist/kits/blocks/components/sections/FAQ.tsx +214 -225
  77. package/dist/kits/blocks/components/sections/FeaturedProjectShowcase.tsx +687 -0
  78. package/dist/kits/blocks/components/sections/Features.tsx +268 -270
  79. package/dist/kits/blocks/components/sections/Footer.tsx +302 -302
  80. package/dist/kits/blocks/components/sections/HeroMotion.tsx +308 -308
  81. package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -358
  82. package/dist/kits/blocks/components/sections/HeroProductDemo.tsx +246 -0
  83. package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -352
  84. package/dist/kits/blocks/components/sections/HeroWithVideo.tsx +495 -0
  85. package/dist/kits/blocks/components/sections/Navbar.tsx +352 -353
  86. package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +549 -550
  87. package/dist/kits/blocks/components/sections/Pricing.tsx +264 -264
  88. package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -325
  89. package/dist/kits/blocks/components/sections/ProjectDeepDive.tsx +805 -0
  90. package/dist/kits/blocks/components/sections/SelectedWorkRail.tsx +485 -0
  91. package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -210
  92. package/dist/kits/blocks/components/sections/Team.tsx +309 -309
  93. package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -158
  94. package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -162
  95. package/dist/kits/blocks/components/sections/product-demo/ApprovalInboxPanel.tsx +128 -0
  96. package/dist/kits/blocks/components/sections/product-demo/DemoStage.tsx +519 -0
  97. package/dist/kits/blocks/components/sections/product-demo/DemoWindow.tsx +140 -0
  98. package/dist/kits/blocks/components/sections/product-demo/KnowledgePanel.tsx +130 -0
  99. package/dist/kits/blocks/components/sections/product-demo/RunConsolePanel.tsx +430 -0
  100. package/dist/kits/blocks/components/sections/product-demo/TaskListPanel.tsx +302 -0
  101. package/dist/kits/blocks/components/sections/product-demo/WorkflowStudioPanel.tsx +744 -0
  102. package/dist/kits/blocks/components/sections/product-demo/types.ts +262 -0
  103. package/dist/kits/blocks/components/theme-provider.tsx +1 -34
  104. package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -134
  105. package/dist/kits/blocks/components/ui/brand-node.tsx +121 -121
  106. package/dist/kits/blocks/components/ui/button.tsx +122 -122
  107. package/dist/kits/blocks/components/ui/card.tsx +95 -95
  108. package/dist/kits/blocks/components/ui/checkbox.tsx +30 -30
  109. package/dist/kits/blocks/components/ui/cta-button.tsx +125 -125
  110. package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -201
  111. package/dist/kits/blocks/components/ui/feature-card.tsx +91 -91
  112. package/dist/kits/blocks/components/ui/input.tsx +27 -27
  113. package/dist/kits/blocks/components/ui/label.tsx +29 -29
  114. package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -120
  115. package/dist/kits/blocks/components/ui/select.tsx +25 -25
  116. package/dist/kits/blocks/components/ui/skeleton.tsx +13 -13
  117. package/dist/kits/blocks/components/ui/table.tsx +98 -98
  118. package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -108
  119. package/dist/kits/blocks/components/ui/textarea.tsx +26 -26
  120. package/dist/kits/blocks/components/ui/theme-selector.tsx +243 -247
  121. package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -74
  122. package/dist/kits/blocks/components/ui/toaster.tsx +7 -7
  123. package/dist/kits/blocks/lib/themes.ts +400 -400
  124. package/dist/kits/blocks/lib/utils.ts +6 -9
  125. package/dist/kits/blocks/package-deps.json +40 -28
  126. package/dist/kits/blocks/tsconfig.json +11 -0
  127. package/dist/kits/blocks/tsconfig.tsbuildinfo +1 -0
  128. package/dist/utils/file-operations.d.ts +3 -1
  129. package/dist/utils/file-operations.d.ts.map +1 -1
  130. package/dist/utils/file-operations.js +84 -12
  131. package/dist/utils/file-operations.js.map +1 -1
  132. package/dist/utils/installation-tracker.d.ts +2 -2
  133. package/dist/utils/installation-tracker.d.ts.map +1 -1
  134. package/dist/utils/installation-tracker.js +11 -11
  135. package/dist/utils/installation-tracker.js.map +1 -1
  136. package/dist/utils/package-manager.d.ts +6 -0
  137. package/dist/utils/package-manager.d.ts.map +1 -0
  138. package/dist/utils/package-manager.js +58 -0
  139. package/dist/utils/package-manager.js.map +1 -0
  140. package/dist/utils/yarn-pnp.d.ts +6 -0
  141. package/dist/utils/yarn-pnp.d.ts.map +1 -0
  142. package/dist/utils/yarn-pnp.js +39 -0
  143. package/dist/utils/yarn-pnp.js.map +1 -0
  144. package/package.json +5 -2
  145. package/dist/kits/blocks/notes/THEME_GUIDE.md +0 -29
@@ -1,247 +1,243 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Check, Palette, Wrench } from "lucide-react";
5
- import { useTheme } from "next-themes";
6
- import { useThemeVariant } from "../enhanced-theme-provider";
7
- import {
8
- themes,
9
- darkThemes,
10
- type ThemeVariant,
11
- type ThemeConfig,
12
- } from "@/lib/themes";
13
-
14
- import { Button } from "@/components/ui/button";
15
- import {
16
- DropdownMenu,
17
- DropdownMenuContent,
18
- DropdownMenuItem,
19
- DropdownMenuLabel,
20
- DropdownMenuSeparator,
21
- DropdownMenuTrigger,
22
- } from "@/components/ui/dropdown-menu";
23
-
24
- type ThemeSelectorProps = React.ComponentPropsWithoutRef<typeof Button> & {
25
- ariaLabel?: string;
26
- label?: string; // optional override for the visible text ("Theme")
27
- };
28
-
29
- export function ThemeSelector({
30
- ariaLabel = "Demo: Color theme",
31
- label = "Theme",
32
- className,
33
- ...buttonProps
34
- }: ThemeSelectorProps) {
35
- const { theme, setTheme } = useTheme();
36
- const { themeVariant, setThemeVariant, setCustomBrandColors } =
37
- useThemeVariant();
38
-
39
- const isDark = theme === "dark";
40
-
41
- const [showCustom, setShowCustom] = React.useState(false);
42
- const [custom, setCustom] = React.useState<Partial<ThemeConfig["colors"]>>(
43
- {},
44
- );
45
-
46
- function openCustomDialog() {
47
- setCustom({});
48
- setShowCustom(true);
49
- }
50
-
51
- function applyCustom() {
52
- setCustomBrandColors(custom);
53
- document.cookie = `theme-variant=custom; Path=/; Max-Age=31536000; SameSite=Lax`;
54
- document.cookie = `theme-custom=${encodeURIComponent(JSON.stringify(custom))}; Path=/; Max-Age=31536000; SameSite=Lax`;
55
- setShowCustom(false);
56
- }
57
-
58
- return (
59
- <DropdownMenu>
60
- <DropdownMenuTrigger asChild>
61
- <Button
62
- variant="outline"
63
- size="sm"
64
- className={`gap-2 ${className ?? ""}`}
65
- aria-label={ariaLabel}
66
- {...buttonProps}
67
- >
68
- <Palette className="h-4 w-4" />
69
- {label}
70
- </Button>
71
- </DropdownMenuTrigger>
72
- <DropdownMenuContent align="end" className="w-64">
73
- <DropdownMenuLabel className="space-y-1">
74
- <div className="flex items-center justify-between">
75
- <span>Color theme variants</span>
76
- <span
77
- aria-hidden="true"
78
- className="border-border bg-muted/50 text-muted-foreground rounded-md border px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase"
79
- >
80
- Gallery
81
- </span>
82
- </div>
83
- <p className="text-muted-foreground text-xs">
84
- Affects this preview only ( button is not part of the shared Navbar.
85
- )
86
- </p>
87
- </DropdownMenuLabel>
88
- {/* <DropdownMenuLabel>
89
- Color theme variants — gallery only
90
- </DropdownMenuLabel> */}
91
- {/* <DropdownMenuLabel>Theme preview controls</DropdownMenuLabel> */}
92
-
93
- <DropdownMenuSeparator />
94
- {Object.entries(themes).map(([key, themeConfig]) => (
95
- <DropdownMenuItem
96
- key={key}
97
- onClick={() => {
98
- setThemeVariant(key as ThemeVariant);
99
- document.cookie = `theme-variant=${key}; Path=/; Max-Age=31536000; SameSite=Lax`;
100
- }}
101
- className="flex items-center justify-between"
102
- >
103
- <div className="flex items-center gap-2">
104
- <div
105
- className="h-4 w-4 rounded-full border"
106
- style={{
107
- backgroundColor: isDark
108
- ? darkThemes[key as ThemeVariant].colors.primary
109
- : themeConfig.colors.primary,
110
- }}
111
- />
112
- {themeConfig.name}
113
- </div>
114
- {themeVariant === key && <Check className="h-4 w-4" />}
115
- </DropdownMenuItem>
116
- ))}
117
- <DropdownMenuSeparator />
118
- <DropdownMenuLabel>Custom</DropdownMenuLabel>
119
- <DropdownMenuItem
120
- onClick={openCustomDialog}
121
- className="flex items-center gap-2"
122
- >
123
- <Wrench className="h-4 w-4" />
124
- Customize brand colors…
125
- </DropdownMenuItem>
126
-
127
- <DropdownMenuSeparator />
128
- <DropdownMenuLabel>Appearance</DropdownMenuLabel>
129
- <DropdownMenuItem onClick={() => setTheme("light")}>
130
- Light
131
- </DropdownMenuItem>
132
- <DropdownMenuItem onClick={() => setTheme("dark")}>
133
- Dark
134
- </DropdownMenuItem>
135
- <DropdownMenuItem onClick={() => setTheme("system")}>
136
- System
137
- </DropdownMenuItem>
138
- </DropdownMenuContent>
139
- {showCustom && (
140
- <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4">
141
- <div
142
- role="dialog"
143
- aria-modal="true"
144
- aria-labelledby="customBrandColorsTitle"
145
- className="bg-popover text-popover-foreground w-full max-w-md rounded-md border p-4 shadow-lg"
146
- >
147
- <div
148
- id="customBrandColorsTitle"
149
- className="mb-3 text-sm font-semibold"
150
- >
151
- Custom brand colors
152
- </div>
153
- <div className="space-y-3">
154
- <div className="flex items-center gap-3">
155
- <label className="w-28 text-sm">primary</label>
156
- <input
157
- type="text"
158
- placeholder="oklch(...) or #hex"
159
- className="bg-background flex-1 rounded border p-2 text-sm"
160
- value={custom.primary ?? ""}
161
- onChange={(e) =>
162
- setCustom((c) => ({ ...c, primary: e.target.value }))
163
- }
164
- />
165
- <input
166
- type="color"
167
- className="h-8 w-10 cursor-pointer"
168
- value={
169
- typeof custom.primary === "string" &&
170
- custom.primary.startsWith("#")
171
- ? (custom.primary as string)
172
- : "#000000"
173
- }
174
- onChange={(e) =>
175
- setCustom((c) => ({ ...c, primary: e.target.value }))
176
- }
177
- />
178
- </div>
179
- <div className="flex items-center gap-3">
180
- <label className="w-28 text-sm">accent</label>
181
- <input
182
- type="text"
183
- placeholder="oklch(...) or #hex"
184
- className="bg-background flex-1 rounded border p-2 text-sm"
185
- value={custom.accent ?? ""}
186
- onChange={(e) =>
187
- setCustom((c) => ({ ...c, accent: e.target.value }))
188
- }
189
- />
190
- <input
191
- type="color"
192
- className="h-8 w-10 cursor-pointer"
193
- value={
194
- typeof custom.accent === "string" &&
195
- custom.accent.startsWith("#")
196
- ? (custom.accent as string)
197
- : "#000000"
198
- }
199
- onChange={(e) =>
200
- setCustom((c) => ({ ...c, accent: e.target.value }))
201
- }
202
- />
203
- </div>
204
- <div className="flex items-center gap-3">
205
- <label className="w-28 text-sm">ring</label>
206
- <input
207
- type="text"
208
- placeholder="oklch(...) or #hex"
209
- className="bg-background flex-1 rounded border p-2 text-sm"
210
- value={custom.ring ?? ""}
211
- onChange={(e) =>
212
- setCustom((c) => ({ ...c, ring: e.target.value }))
213
- }
214
- />
215
- <input
216
- type="color"
217
- className="h-8 w-10 cursor-pointer"
218
- value={
219
- typeof custom.ring === "string" &&
220
- custom.ring.startsWith("#")
221
- ? (custom.ring as string)
222
- : "#000000"
223
- }
224
- onChange={(e) =>
225
- setCustom((c) => ({ ...c, ring: e.target.value }))
226
- }
227
- />
228
- </div>
229
- </div>
230
- <div className="mt-4 flex justify-end gap-2">
231
- <Button
232
- variant="outline"
233
- size="sm"
234
- onClick={() => setShowCustom(false)}
235
- >
236
- Cancel
237
- </Button>
238
- <Button size="sm" onClick={applyCustom}>
239
- Apply
240
- </Button>
241
- </div>
242
- </div>
243
- </div>
244
- )}
245
- </DropdownMenu>
246
- );
247
- }
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Check, Palette, Wrench } from "lucide-react";
5
+ import { useTheme } from "next-themes";
6
+ import { useThemeVariant } from "../enhanced-theme-provider";
7
+ import {
8
+ themes,
9
+ darkThemes,
10
+ type ThemeVariant,
11
+ type ThemeConfig,
12
+ } from "@/lib/themes";
13
+
14
+ import { Button } from "@/components/ui/button";
15
+ import {
16
+ DropdownMenu,
17
+ DropdownMenuContent,
18
+ DropdownMenuItem,
19
+ DropdownMenuLabel,
20
+ DropdownMenuSeparator,
21
+ DropdownMenuTrigger,
22
+ } from "@/components/ui/dropdown-menu";
23
+
24
+ type ThemeSelectorProps = React.ComponentPropsWithoutRef<typeof Button> & {
25
+ ariaLabel?: string;
26
+ label?: string; // optional override for the visible text ("Theme")
27
+ };
28
+
29
+ export function ThemeSelector({
30
+ ariaLabel = "Demo: Color theme",
31
+ label = "Theme",
32
+ className,
33
+ ...buttonProps
34
+ }: ThemeSelectorProps) {
35
+ const { theme, setTheme } = useTheme();
36
+ const { themeVariant, setThemeVariant, setCustomBrandColors } =
37
+ useThemeVariant();
38
+
39
+ const isDark = theme === "dark";
40
+
41
+ const [showCustom, setShowCustom] = React.useState(false);
42
+ const [custom, setCustom] = React.useState<Partial<ThemeConfig["colors"]>>(
43
+ {},
44
+ );
45
+
46
+ function openCustomDialog() {
47
+ setCustom({});
48
+ setShowCustom(true);
49
+ }
50
+
51
+ function applyCustom() {
52
+ setCustomBrandColors(custom);
53
+ document.cookie = `theme-variant=custom; Path=/; Max-Age=31536000; SameSite=Lax`;
54
+ document.cookie = `theme-custom=${encodeURIComponent(JSON.stringify(custom))}; Path=/; Max-Age=31536000; SameSite=Lax`;
55
+ setShowCustom(false);
56
+ }
57
+
58
+ return (
59
+ <DropdownMenu modal={false}>
60
+ <DropdownMenuTrigger asChild>
61
+ <Button
62
+ variant="outline"
63
+ size="sm"
64
+ className={`gap-2 ${className ?? ""}`}
65
+ aria-label={ariaLabel}
66
+ {...buttonProps}
67
+ >
68
+ <Palette className="h-4 w-4" />
69
+ {label}
70
+ </Button>
71
+ </DropdownMenuTrigger>
72
+ <DropdownMenuContent align="end" className="w-64">
73
+ <DropdownMenuLabel className="space-y-1">
74
+ <div className="flex items-center justify-between">
75
+ <span>Color theme variants</span>
76
+ <span
77
+ aria-hidden="true"
78
+ className="border-border bg-muted/50 text-muted-foreground rounded-md border px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase"
79
+ >
80
+ Gallery
81
+ </span>
82
+ </div>
83
+ <p className="text-muted-foreground text-xs">
84
+ Affects this preview only ( button is not part of the shared Navbar.
85
+ )
86
+ </p>
87
+ </DropdownMenuLabel>
88
+
89
+ <DropdownMenuSeparator />
90
+ {Object.entries(themes).map(([key, themeConfig]) => (
91
+ <DropdownMenuItem
92
+ key={key}
93
+ onClick={() => {
94
+ setThemeVariant(key as ThemeVariant);
95
+ document.cookie = `theme-variant=${key}; Path=/; Max-Age=31536000; SameSite=Lax`;
96
+ }}
97
+ className="flex items-center justify-between"
98
+ >
99
+ <div className="flex items-center gap-2">
100
+ <div
101
+ className="h-4 w-4 rounded-full border"
102
+ style={{
103
+ backgroundColor: isDark
104
+ ? darkThemes[key as ThemeVariant].colors.primary
105
+ : themeConfig.colors.primary,
106
+ }}
107
+ />
108
+ {themeConfig.name}
109
+ </div>
110
+ {themeVariant === key && <Check className="h-4 w-4" />}
111
+ </DropdownMenuItem>
112
+ ))}
113
+ <DropdownMenuSeparator />
114
+ <DropdownMenuLabel>Custom</DropdownMenuLabel>
115
+ <DropdownMenuItem
116
+ onClick={openCustomDialog}
117
+ className="flex items-center gap-2"
118
+ >
119
+ <Wrench className="h-4 w-4" />
120
+ Customize brand colors…
121
+ </DropdownMenuItem>
122
+
123
+ <DropdownMenuSeparator />
124
+ <DropdownMenuLabel>Appearance</DropdownMenuLabel>
125
+ <DropdownMenuItem onClick={() => setTheme("light")}>
126
+ Light
127
+ </DropdownMenuItem>
128
+ <DropdownMenuItem onClick={() => setTheme("dark")}>
129
+ Dark
130
+ </DropdownMenuItem>
131
+ <DropdownMenuItem onClick={() => setTheme("system")}>
132
+ System
133
+ </DropdownMenuItem>
134
+ </DropdownMenuContent>
135
+ {showCustom && (
136
+ <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4">
137
+ <div
138
+ role="dialog"
139
+ aria-modal="true"
140
+ aria-labelledby="customBrandColorsTitle"
141
+ className="bg-popover text-popover-foreground w-full max-w-md rounded-md border p-4 shadow-lg"
142
+ >
143
+ <div
144
+ id="customBrandColorsTitle"
145
+ className="mb-3 text-sm font-semibold"
146
+ >
147
+ Custom brand colors
148
+ </div>
149
+ <div className="space-y-3">
150
+ <div className="flex items-center gap-3">
151
+ <label className="w-28 text-sm">primary</label>
152
+ <input
153
+ type="text"
154
+ placeholder="oklch(...) or #hex"
155
+ className="bg-background flex-1 rounded border p-2 text-sm"
156
+ value={custom.primary ?? ""}
157
+ onChange={(e) =>
158
+ setCustom((c) => ({ ...c, primary: e.target.value }))
159
+ }
160
+ />
161
+ <input
162
+ type="color"
163
+ className="h-8 w-10 cursor-pointer"
164
+ value={
165
+ typeof custom.primary === "string" &&
166
+ custom.primary.startsWith("#")
167
+ ? (custom.primary as string)
168
+ : "#000000"
169
+ }
170
+ onChange={(e) =>
171
+ setCustom((c) => ({ ...c, primary: e.target.value }))
172
+ }
173
+ />
174
+ </div>
175
+ <div className="flex items-center gap-3">
176
+ <label className="w-28 text-sm">accent</label>
177
+ <input
178
+ type="text"
179
+ placeholder="oklch(...) or #hex"
180
+ className="bg-background flex-1 rounded border p-2 text-sm"
181
+ value={custom.accent ?? ""}
182
+ onChange={(e) =>
183
+ setCustom((c) => ({ ...c, accent: e.target.value }))
184
+ }
185
+ />
186
+ <input
187
+ type="color"
188
+ className="h-8 w-10 cursor-pointer"
189
+ value={
190
+ typeof custom.accent === "string" &&
191
+ custom.accent.startsWith("#")
192
+ ? (custom.accent as string)
193
+ : "#000000"
194
+ }
195
+ onChange={(e) =>
196
+ setCustom((c) => ({ ...c, accent: e.target.value }))
197
+ }
198
+ />
199
+ </div>
200
+ <div className="flex items-center gap-3">
201
+ <label className="w-28 text-sm">ring</label>
202
+ <input
203
+ type="text"
204
+ placeholder="oklch(...) or #hex"
205
+ className="bg-background flex-1 rounded border p-2 text-sm"
206
+ value={custom.ring ?? ""}
207
+ onChange={(e) =>
208
+ setCustom((c) => ({ ...c, ring: e.target.value }))
209
+ }
210
+ />
211
+ <input
212
+ type="color"
213
+ className="h-8 w-10 cursor-pointer"
214
+ value={
215
+ typeof custom.ring === "string" &&
216
+ custom.ring.startsWith("#")
217
+ ? (custom.ring as string)
218
+ : "#000000"
219
+ }
220
+ onChange={(e) =>
221
+ setCustom((c) => ({ ...c, ring: e.target.value }))
222
+ }
223
+ />
224
+ </div>
225
+ </div>
226
+ <div className="mt-4 flex justify-end gap-2">
227
+ <Button
228
+ variant="outline"
229
+ size="sm"
230
+ onClick={() => setShowCustom(false)}
231
+ >
232
+ Cancel
233
+ </Button>
234
+ <Button size="sm" onClick={applyCustom}>
235
+ Apply
236
+ </Button>
237
+ </div>
238
+ </div>
239
+ </div>
240
+ )}
241
+ </DropdownMenu>
242
+ );
243
+ }
@@ -1,74 +1,74 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Moon, Sun } from "lucide-react";
5
- import { useTheme } from "next-themes";
6
- import { cn } from "@/lib/utils";
7
-
8
- import { Button } from "@/components/ui/button";
9
-
10
- type ButtonProps = React.ComponentProps<typeof Button>;
11
-
12
- export type ThemeToggleProps = {
13
- /** Forwarded to internal Button. You can set unstyled, className, variant, size, etc. */
14
- buttonProps?: Partial<ButtonProps>;
15
- /** Optional aria-label override */
16
- ariaLabel?: string;
17
- /** Optional class overrides for icons */
18
- moonClassName?: string;
19
- sunClassName?: string;
20
- };
21
-
22
- export function ThemeToggle({
23
- buttonProps,
24
- ariaLabel = "Toggle theme",
25
- moonClassName,
26
- sunClassName,
27
- }: ThemeToggleProps) {
28
- const { theme, setTheme } = useTheme();
29
-
30
- const mergedButtonProps: ButtonProps = {
31
- variant: "outline",
32
- size: "icon",
33
- ...(buttonProps as ButtonProps),
34
- className: cn(
35
- "relative",
36
- // Prefer preset variables if provided on Navbar
37
- "bg-[var(--navbar-toggle-bg)] text-[var(--navbar-accent)] hover:bg-[var(--navbar-hover-bg)] focus-visible:ring-[var(--navbar-ring)]",
38
- // Ensure border uses preset variable; provide width for unstyled cases
39
- "border border-[var(--navbar-border)]",
40
- buttonProps?.className,
41
- ),
42
- // Inline style ensures our accent wins over token classes even under dark: variants
43
- style: {
44
- ...(buttonProps?.style as React.CSSProperties),
45
- color: "var(--navbar-accent)",
46
- backgroundColor: "var(--navbar-toggle-bg)",
47
- borderColor: "var(--navbar-border)",
48
- // Tell Tailwind ring utilities which ring color to use
49
- "--tw-ring-color": "var(--navbar-ring)",
50
- },
51
- } as ButtonProps;
52
-
53
- return (
54
- <Button
55
- {...mergedButtonProps}
56
- onClick={() => setTheme(theme === "light" ? "dark" : "light")}
57
- aria-label={ariaLabel}
58
- >
59
- <Moon
60
- className={cn(
61
- "h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90",
62
- moonClassName,
63
- )}
64
- />
65
- <Sun
66
- className={cn(
67
- "absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0",
68
- sunClassName,
69
- )}
70
- />
71
- <span className="sr-only">{ariaLabel}</span>
72
- </Button>
73
- );
74
- }
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Moon, Sun } from "lucide-react";
5
+ import { useTheme } from "next-themes";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ import { Button } from "@/components/ui/button";
9
+
10
+ type ButtonProps = React.ComponentProps<typeof Button>;
11
+
12
+ export type ThemeToggleProps = {
13
+ /** Forwarded to internal Button. You can set unstyled, className, variant, size, etc. */
14
+ buttonProps?: Partial<ButtonProps>;
15
+ /** Optional aria-label override */
16
+ ariaLabel?: string;
17
+ /** Optional class overrides for icons */
18
+ moonClassName?: string;
19
+ sunClassName?: string;
20
+ };
21
+
22
+ export function ThemeToggle({
23
+ buttonProps,
24
+ ariaLabel = "Toggle theme",
25
+ moonClassName,
26
+ sunClassName,
27
+ }: ThemeToggleProps) {
28
+ const { theme, setTheme } = useTheme();
29
+
30
+ const mergedButtonProps: ButtonProps = {
31
+ variant: "outline",
32
+ size: "icon",
33
+ ...(buttonProps as ButtonProps),
34
+ className: cn(
35
+ "relative",
36
+ // Prefer preset variables if provided on Navbar
37
+ "bg-[var(--navbar-toggle-bg)] text-[var(--navbar-accent)] hover:bg-[var(--navbar-hover-bg)] focus-visible:ring-[var(--navbar-ring)]",
38
+ // Ensure border uses preset variable; provide width for unstyled cases
39
+ "border border-[var(--navbar-border)]",
40
+ buttonProps?.className,
41
+ ),
42
+ // Inline style ensures our accent wins over token classes even under dark: variants
43
+ style: {
44
+ ...(buttonProps?.style as React.CSSProperties),
45
+ color: "var(--navbar-accent)",
46
+ backgroundColor: "var(--navbar-toggle-bg)",
47
+ borderColor: "var(--navbar-border)",
48
+ // Tell Tailwind ring utilities which ring color to use
49
+ "--tw-ring-color": "var(--navbar-ring)",
50
+ },
51
+ } as ButtonProps;
52
+
53
+ return (
54
+ <Button
55
+ {...mergedButtonProps}
56
+ onClick={() => setTheme(theme === "light" ? "dark" : "light")}
57
+ aria-label={ariaLabel}
58
+ >
59
+ <Moon
60
+ className={cn(
61
+ "h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90",
62
+ moonClassName,
63
+ )}
64
+ />
65
+ <Sun
66
+ className={cn(
67
+ "absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0",
68
+ sunClassName,
69
+ )}
70
+ />
71
+ <span className="sr-only">{ariaLabel}</span>
72
+ </Button>
73
+ );
74
+ }