nextworks 0.0.1 → 0.1.0-alpha.1
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/README.md +209 -30
- package/dist/.gitkeep +0 -0
- package/dist/cli_manifests/auth_manifest.json +86 -0
- package/dist/cli_manifests/blocks_manifest.json +185 -0
- package/dist/cli_manifests/data_manifest.json +51 -0
- package/dist/cli_manifests/forms_manifest.json +61 -0
- package/dist/commands/admin-posts.d.ts +2 -0
- package/dist/commands/admin-posts.d.ts.map +1 -0
- package/dist/commands/admin-posts.js +15 -0
- package/dist/commands/admin-posts.js.map +1 -0
- package/dist/commands/admin-users.d.ts +2 -0
- package/dist/commands/admin-users.d.ts.map +1 -0
- package/dist/commands/admin-users.js +15 -0
- package/dist/commands/admin-users.js.map +1 -0
- package/dist/commands/auth-core.d.ts +2 -0
- package/dist/commands/auth-core.d.ts.map +1 -0
- package/dist/commands/auth-core.js +83 -0
- package/dist/commands/auth-core.js.map +1 -0
- package/dist/commands/auth-forms.d.ts +2 -0
- package/dist/commands/auth-forms.d.ts.map +1 -0
- package/dist/commands/auth-forms.js +15 -0
- package/dist/commands/auth-forms.js.map +1 -0
- package/dist/commands/blocks-options.d.ts +7 -0
- package/dist/commands/blocks-options.d.ts.map +1 -0
- package/dist/commands/blocks-options.js +19 -0
- package/dist/commands/blocks-options.js.map +1 -0
- package/dist/commands/blocks.d.ts +7 -0
- package/dist/commands/blocks.d.ts.map +1 -0
- package/dist/commands/blocks.js +145 -0
- package/dist/commands/blocks.js.map +1 -0
- package/dist/commands/data.d.ts +3 -0
- package/dist/commands/data.d.ts.map +1 -0
- package/dist/commands/data.js +88 -0
- package/dist/commands/data.js.map +1 -0
- package/dist/commands/forms.d.ts +6 -0
- package/dist/commands/forms.d.ts.map +1 -0
- package/dist/commands/forms.js +107 -0
- package/dist/commands/forms.js.map +1 -0
- package/dist/commands/remove-auth-core.d.ts +2 -0
- package/dist/commands/remove-auth-core.d.ts.map +1 -0
- package/dist/commands/remove-auth-core.js +69 -0
- package/dist/commands/remove-auth-core.js.map +1 -0
- package/dist/commands/remove-blocks.d.ts +2 -0
- package/dist/commands/remove-blocks.d.ts.map +1 -0
- package/dist/commands/remove-blocks.js +36 -0
- package/dist/commands/remove-blocks.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/kits/auth-core/README.md +106 -0
- package/dist/kits/auth-core/app/(protected)/dashboard/page.tsx +8 -0
- package/dist/kits/auth-core/app/(protected)/layout.tsx +18 -0
- package/dist/kits/auth-core/app/(protected)/settings/profile/page.tsx +15 -0
- package/dist/kits/auth-core/app/(protected)/settings/profile/profile-form.tsx +114 -0
- package/dist/kits/auth-core/app/api/auth/[...nextauth]/route.ts +1 -0
- package/dist/kits/auth-core/app/api/auth/forgot-password/route.ts +114 -0
- package/dist/kits/auth-core/app/api/auth/providers/route.ts +6 -0
- package/dist/kits/auth-core/app/api/auth/reset-password/route.ts +63 -0
- package/dist/kits/auth-core/app/api/auth/send-verify-email/route.ts +6 -0
- package/dist/kits/auth-core/app/api/signup/route.ts +41 -0
- package/dist/kits/auth-core/app/auth/forgot-password/page.tsx +21 -0
- package/dist/kits/auth-core/app/auth/login/page.tsx +5 -0
- package/dist/kits/auth-core/app/auth/reset-password/page.tsx +187 -0
- package/dist/kits/auth-core/app/auth/signup/page.tsx +5 -0
- package/dist/kits/auth-core/app/auth/verify-email/page.tsx +11 -0
- package/dist/kits/auth-core/components/admin/admin-header.tsx +57 -0
- package/dist/kits/auth-core/components/auth/dashboard.tsx +237 -0
- package/dist/kits/auth-core/components/auth/forgot-password-form.tsx +90 -0
- package/dist/kits/auth-core/components/auth/login-form.tsx +467 -0
- package/dist/kits/auth-core/components/auth/logout-button.tsx +50 -0
- package/dist/kits/auth-core/components/auth/minimal-logout-button.tsx +40 -0
- package/dist/kits/auth-core/components/auth/signup-form.tsx +468 -0
- package/dist/kits/auth-core/components/require-auth.tsx +59 -0
- package/dist/kits/auth-core/components/session-provider.tsx +11 -0
- package/dist/kits/auth-core/components/ui/README.txt +1 -0
- package/dist/kits/auth-core/components/ui/button.tsx +55 -0
- package/dist/kits/auth-core/components/ui/input.tsx +25 -0
- package/dist/kits/auth-core/components/ui/label.tsx +23 -0
- package/dist/kits/auth-core/lib/api/errors.ts +14 -0
- package/dist/kits/auth-core/lib/auth-helpers.ts +29 -0
- package/dist/kits/auth-core/lib/auth.ts +142 -0
- package/dist/kits/auth-core/lib/email/dev-transport.ts +42 -0
- package/dist/kits/auth-core/lib/email/index.ts +28 -0
- package/dist/kits/auth-core/lib/email/provider-smtp.ts +36 -0
- package/dist/kits/auth-core/lib/forms/map-errors.ts +11 -0
- package/dist/kits/auth-core/lib/hash.ts +6 -0
- package/dist/kits/auth-core/lib/prisma.ts +15 -0
- package/dist/kits/auth-core/lib/server/result.ts +45 -0
- package/dist/kits/auth-core/lib/utils.ts +6 -0
- package/dist/kits/auth-core/lib/validation/forms.ts +88 -0
- package/dist/kits/auth-core/package-deps.json +19 -0
- package/dist/kits/auth-core/prisma/auth-models.prisma +81 -0
- package/dist/kits/auth-core/prisma/schema.prisma +81 -0
- package/dist/kits/auth-core/scripts/populate-tokenhash.mjs +26 -0
- package/dist/kits/auth-core/scripts/promote-admin.mjs +33 -0
- package/dist/kits/auth-core/scripts/seed-demo.mjs +40 -0
- package/dist/kits/auth-core/types/next-auth.d.ts +25 -0
- package/dist/kits/blocks/README.md +53 -0
- package/dist/kits/blocks/app/globals.css +175 -0
- package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -0
- package/dist/kits/blocks/app/templates/digitalagency/README.md +36 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/About.tsx +99 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/CTA.tsx +74 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Contact.tsx +227 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Footer.tsx +89 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Hero.tsx +90 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Navbar.tsx +168 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/NetworkPattern.tsx +297 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Portfolio.tsx +157 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -0
- package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -0
- package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -0
- package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +85 -0
- package/dist/kits/blocks/app/templates/gallery/page.tsx +303 -0
- package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +74 -0
- package/dist/kits/blocks/app/templates/productlaunch/README.md +55 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +178 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +93 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +93 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +84 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +89 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +162 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +89 -0
- package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -0
- package/dist/kits/blocks/app/templates/productlaunch/page.tsx +45 -0
- package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -0
- package/dist/kits/blocks/app/templates/saasdashboard/README.md +38 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +176 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +91 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +105 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +127 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +159 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +97 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -0
- package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -0
- package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -0
- package/dist/kits/blocks/components/app-providers.tsx +1 -0
- package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -0
- package/dist/kits/blocks/components/sections/About.tsx +291 -0
- package/dist/kits/blocks/components/sections/CTA.tsx +258 -0
- package/dist/kits/blocks/components/sections/Contact.tsx +267 -0
- package/dist/kits/blocks/components/sections/FAQ.tsx +226 -0
- package/dist/kits/blocks/components/sections/Features.tsx +269 -0
- package/dist/kits/blocks/components/sections/Footer.tsx +302 -0
- package/dist/kits/blocks/components/sections/HeroMotion.tsx +307 -0
- package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -0
- package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -0
- package/dist/kits/blocks/components/sections/Navbar.tsx +353 -0
- package/dist/kits/blocks/components/sections/Newsletter.tsx +156 -0
- package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +550 -0
- package/dist/kits/blocks/components/sections/Pricing.tsx +264 -0
- package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -0
- package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -0
- package/dist/kits/blocks/components/sections/Team.tsx +309 -0
- package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -0
- package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -0
- package/dist/kits/blocks/components/theme-provider.tsx +34 -0
- package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -0
- package/dist/kits/blocks/components/ui/brand-node.tsx +121 -0
- package/dist/kits/blocks/components/ui/button.tsx +122 -0
- package/dist/kits/blocks/components/ui/button_bck.tsx +93 -0
- package/dist/kits/blocks/components/ui/card.tsx +95 -0
- package/dist/kits/blocks/components/ui/checkbox.tsx +30 -0
- package/dist/kits/blocks/components/ui/cta-button.tsx +125 -0
- package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -0
- package/dist/kits/blocks/components/ui/feature-card.tsx +91 -0
- package/dist/kits/blocks/components/ui/input.tsx +27 -0
- package/dist/kits/blocks/components/ui/label.tsx +29 -0
- package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -0
- package/dist/kits/blocks/components/ui/select.tsx +25 -0
- package/dist/kits/blocks/components/ui/skeleton.tsx +13 -0
- package/dist/kits/blocks/components/ui/switch.tsx +78 -0
- package/dist/kits/blocks/components/ui/table.tsx +98 -0
- package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -0
- package/dist/kits/blocks/components/ui/textarea.tsx +26 -0
- package/dist/kits/blocks/components/ui/theme-selector.tsx +247 -0
- package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -0
- package/dist/kits/blocks/components/ui/toaster.tsx +7 -0
- package/dist/kits/blocks/lib/themes.ts +399 -0
- package/dist/kits/blocks/lib/themes_old.ts +37 -0
- package/dist/kits/blocks/lib/utils.ts +9 -0
- package/dist/kits/blocks/next.config.ts +11 -0
- package/dist/kits/blocks/notes/THEME_GUIDE.md +29 -0
- package/dist/kits/blocks/notes/THEMING_CONVERSION_SUMMARY.md +14 -0
- package/dist/kits/blocks/package-deps.json +22 -0
- package/dist/kits/blocks/public/placeholders/gallery/hero-pexels-broken-9945014.avif +0 -0
- package/dist/kits/blocks/public/placeholders/gallery/pexels-googledeepmind-25626431.jpg +0 -0
- package/dist/kits/blocks/public/placeholders/gallery/pexels-googledeepmind-25626432.jpg +0 -0
- package/dist/kits/blocks/public/placeholders/gallery/pexels-googledeepmind-25626434.jpg +0 -0
- package/dist/kits/blocks/public/placeholders/gallery/pexels-googledeepmind-25626436.jpg +0 -0
- package/dist/kits/blocks/public/placeholders/product_launch/feature_1.png +0 -0
- package/dist/kits/blocks/public/placeholders/product_launch/feature_2.png +0 -0
- package/dist/kits/blocks/public/placeholders/product_launch/feature_3.png +0 -0
- package/dist/kits/blocks/public/placeholders/product_launch/feature_4.png +0 -0
- package/dist/kits/blocks/public/placeholders/product_launch/hero.png +0 -0
- package/dist/kits/blocks/public/placeholders/saas_dashboard/analytics.png +0 -0
- package/dist/kits/blocks/public/placeholders/saas_dashboard/chat.png +0 -0
- package/dist/kits/blocks/public/placeholders/saas_dashboard/projectBoard.png +0 -0
- package/dist/kits/data/.gitkeep +0 -0
- package/dist/kits/data/README.md +104 -0
- package/dist/kits/data/app/(protected)/admin/posts/page.tsx +5 -0
- package/dist/kits/data/app/(protected)/admin/users/page.tsx +5 -0
- package/dist/kits/data/app/api/posts/[id]/route.ts +83 -0
- package/dist/kits/data/app/api/posts/route.ts +138 -0
- package/dist/kits/data/app/api/seed-demo/route.ts +45 -0
- package/dist/kits/data/app/api/users/[id]/route.ts +127 -0
- package/dist/kits/data/app/api/users/check-email/route.ts +18 -0
- package/dist/kits/data/app/api/users/check-unique/route.ts +27 -0
- package/dist/kits/data/app/api/users/route.ts +79 -0
- package/dist/kits/data/app/examples/demo/README.md +4 -0
- package/dist/kits/data/app/examples/demo/create-post-form.tsx +106 -0
- package/dist/kits/data/app/examples/demo/page.tsx +118 -0
- package/dist/kits/data/app/examples/demo/seed-demo-button.tsx +37 -0
- package/dist/kits/data/components/admin/posts-manager.tsx +719 -0
- package/dist/kits/data/components/admin/users-manager.tsx +432 -0
- package/dist/kits/data/lib/prisma.ts +15 -0
- package/dist/kits/data/lib/server/result.ts +90 -0
- package/dist/kits/data/package-deps.json +11 -0
- package/dist/kits/data/scripts/seed-demo.mjs +41 -0
- package/dist/kits/forms/.gitkeep +0 -0
- package/dist/kits/forms/README.md +49 -0
- package/dist/kits/forms/app/.gitkeep +0 -0
- package/dist/kits/forms/app/api/wizard/route.ts +71 -0
- package/dist/kits/forms/app/examples/forms/basic/page.tsx +124 -0
- package/dist/kits/forms/app/examples/forms/server-action/form-client.tsx +28 -0
- package/dist/kits/forms/app/examples/forms/server-action/page.tsx +71 -0
- package/dist/kits/forms/app/examples/forms/wizard/page.tsx +15 -0
- package/dist/kits/forms/app/examples/forms/wizard/wizard-client.tsx +2 -0
- package/dist/kits/forms/components/.gitkeep +0 -0
- package/dist/kits/forms/components/examples/wizard-client.tsx +231 -0
- package/dist/kits/forms/components/hooks/useCheckUnique.ts +79 -0
- package/dist/kits/forms/components/ui/button.tsx +122 -0
- package/dist/kits/forms/components/ui/checkbox.tsx +30 -0
- package/dist/kits/forms/components/ui/form/context.ts +33 -0
- package/dist/kits/forms/components/ui/form/form-control.tsx +28 -0
- package/dist/kits/forms/components/ui/form/form-description.tsx +22 -0
- package/dist/kits/forms/components/ui/form/form-field.tsx +36 -0
- package/dist/kits/forms/components/ui/form/form-item.tsx +21 -0
- package/dist/kits/forms/components/ui/form/form-label.tsx +24 -0
- package/dist/kits/forms/components/ui/form/form-message.tsx +29 -0
- package/dist/kits/forms/components/ui/form/form.tsx +26 -0
- package/dist/kits/forms/components/ui/input.tsx +27 -0
- package/dist/kits/forms/components/ui/label.tsx +29 -0
- package/dist/kits/forms/components/ui/select.tsx +25 -0
- package/dist/kits/forms/components/ui/switch.tsx +78 -0
- package/dist/kits/forms/components/ui/textarea.tsx +26 -0
- package/dist/kits/forms/lib/.gitkeep +0 -0
- package/dist/kits/forms/lib/forms/map-errors.ts +29 -0
- package/dist/kits/forms/lib/prisma.ts +16 -0
- package/dist/kits/forms/lib/utils.ts +9 -0
- package/dist/kits/forms/lib/validation/forms.ts +88 -0
- package/dist/kits/forms/lib/validation/wizard.ts +32 -0
- package/dist/kits/forms/package-deps.json +17 -0
- package/dist/utils/file-operations.d.ts +18 -0
- package/dist/utils/file-operations.d.ts.map +1 -0
- package/dist/utils/file-operations.js +327 -0
- package/dist/utils/file-operations.js.map +1 -0
- package/dist/utils/installation-tracker.d.ts +26 -0
- package/dist/utils/installation-tracker.d.ts.map +1 -0
- package/dist/utils/installation-tracker.js +98 -0
- package/dist/utils/installation-tracker.js.map +1 -0
- package/package.json +51 -21
- package/index.js +0 -1
|
@@ -0,0 +1,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 "@/components/enhanced-theme-provider";
|
|
7
|
+
import {
|
|
8
|
+
themes,
|
|
9
|
+
darkThemes,
|
|
10
|
+
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
|
+
}
|
|
@@ -0,0 +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
|
+
}
|