create-app-ui 1.0.0

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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/boilerplate/README.md +18 -0
  4. package/boilerplate/react-base/.env.example +1 -0
  5. package/boilerplate/react-base/README.md +3 -0
  6. package/boilerplate/react-base/components.json +19 -0
  7. package/boilerplate/react-base/eslint.config.js +32 -0
  8. package/boilerplate/react-base/index.html +12 -0
  9. package/boilerplate/react-base/package.json +71 -0
  10. package/boilerplate/react-base/postcss.config.js +6 -0
  11. package/boilerplate/react-base/prettier.config.js +6 -0
  12. package/boilerplate/react-base/src/api/axios.ts +20 -0
  13. package/boilerplate/react-base/src/app/store.ts +13 -0
  14. package/boilerplate/react-base/src/components/data-table.tsx +919 -0
  15. package/boilerplate/react-base/src/components/ui/accordion.tsx +44 -0
  16. package/boilerplate/react-base/src/components/ui/alert-dialog.tsx +105 -0
  17. package/boilerplate/react-base/src/components/ui/alert.tsx +40 -0
  18. package/boilerplate/react-base/src/components/ui/avatar.tsx +30 -0
  19. package/boilerplate/react-base/src/components/ui/badge.tsx +27 -0
  20. package/boilerplate/react-base/src/components/ui/bar-chart.tsx +76 -0
  21. package/boilerplate/react-base/src/components/ui/breadcrumb.tsx +87 -0
  22. package/boilerplate/react-base/src/components/ui/button.tsx +34 -0
  23. package/boilerplate/react-base/src/components/ui/calendar.tsx +63 -0
  24. package/boilerplate/react-base/src/components/ui/card.tsx +36 -0
  25. package/boilerplate/react-base/src/components/ui/chart.tsx +280 -0
  26. package/boilerplate/react-base/src/components/ui/checkbox.tsx +51 -0
  27. package/boilerplate/react-base/src/components/ui/context-menu.tsx +173 -0
  28. package/boilerplate/react-base/src/components/ui/date-picker.tsx +42 -0
  29. package/boilerplate/react-base/src/components/ui/dialog.tsx +87 -0
  30. package/boilerplate/react-base/src/components/ui/drawer.tsx +81 -0
  31. package/boilerplate/react-base/src/components/ui/dropdown-menu.tsx +81 -0
  32. package/boilerplate/react-base/src/components/ui/dropdown-types.ts +28 -0
  33. package/boilerplate/react-base/src/components/ui/field.tsx +194 -0
  34. package/boilerplate/react-base/src/components/ui/hover-card.tsx +26 -0
  35. package/boilerplate/react-base/src/components/ui/input-group.tsx +98 -0
  36. package/boilerplate/react-base/src/components/ui/input-otp.tsx +63 -0
  37. package/boilerplate/react-base/src/components/ui/input.tsx +12 -0
  38. package/boilerplate/react-base/src/components/ui/item.tsx +152 -0
  39. package/boilerplate/react-base/src/components/ui/kbd.tsx +13 -0
  40. package/boilerplate/react-base/src/components/ui/label.tsx +14 -0
  41. package/boilerplate/react-base/src/components/ui/line-chart.tsx +65 -0
  42. package/boilerplate/react-base/src/components/ui/menubar.tsx +217 -0
  43. package/boilerplate/react-base/src/components/ui/multi-select-dropdown.tsx +200 -0
  44. package/boilerplate/react-base/src/components/ui/navigation-menu.tsx +120 -0
  45. package/boilerplate/react-base/src/components/ui/pie-chart.tsx +87 -0
  46. package/boilerplate/react-base/src/components/ui/popover.tsx +29 -0
  47. package/boilerplate/react-base/src/components/ui/progress.tsx +19 -0
  48. package/boilerplate/react-base/src/components/ui/radio-group.tsx +36 -0
  49. package/boilerplate/react-base/src/components/ui/scroll-area.tsx +38 -0
  50. package/boilerplate/react-base/src/components/ui/searchable-dropdown.tsx +118 -0
  51. package/boilerplate/react-base/src/components/ui/select.tsx +140 -0
  52. package/boilerplate/react-base/src/components/ui/separator.tsx +20 -0
  53. package/boilerplate/react-base/src/components/ui/sheet.tsx +70 -0
  54. package/boilerplate/react-base/src/components/ui/sidebar.tsx +470 -0
  55. package/boilerplate/react-base/src/components/ui/skeleton.tsx +11 -0
  56. package/boilerplate/react-base/src/components/ui/slider.tsx +23 -0
  57. package/boilerplate/react-base/src/components/ui/sonner.tsx +21 -0
  58. package/boilerplate/react-base/src/components/ui/sparkline.tsx +38 -0
  59. package/boilerplate/react-base/src/components/ui/spinner.tsx +10 -0
  60. package/boilerplate/react-base/src/components/ui/switch.tsx +16 -0
  61. package/boilerplate/react-base/src/components/ui/table.tsx +80 -0
  62. package/boilerplate/react-base/src/components/ui/tabs.tsx +32 -0
  63. package/boilerplate/react-base/src/components/ui/textarea.tsx +12 -0
  64. package/boilerplate/react-base/src/components/ui/toggle-group.tsx +49 -0
  65. package/boilerplate/react-base/src/components/ui/toggle.tsx +33 -0
  66. package/boilerplate/react-base/src/components/ui/tooltip.tsx +23 -0
  67. package/boilerplate/react-base/src/components/ui/typography.tsx +76 -0
  68. package/boilerplate/react-base/src/config/constants.ts +3 -0
  69. package/boilerplate/react-base/src/config/theme.ts +432 -0
  70. package/boilerplate/react-base/src/config/user.ts +52 -0
  71. package/boilerplate/react-base/src/context/theme-provider.tsx +12 -0
  72. package/boilerplate/react-base/src/features/auth/authSlice.ts +19 -0
  73. package/boilerplate/react-base/src/hooks/index.ts +1 -0
  74. package/boilerplate/react-base/src/hooks/use-mobile.ts +17 -0
  75. package/boilerplate/react-base/src/lib/utils.ts +6 -0
  76. package/boilerplate/react-base/src/routes/index.tsx +7 -0
  77. package/boilerplate/react-base/src/styles/globals.css +15 -0
  78. package/boilerplate/react-base/src/vite-env.d.ts +31 -0
  79. package/boilerplate/react-base/tailwind.config.ts +75 -0
  80. package/boilerplate/react-base/tsconfig.app.json +20 -0
  81. package/boilerplate/react-base/tsconfig.json +7 -0
  82. package/boilerplate/react-base/tsconfig.node.json +16 -0
  83. package/boilerplate/react-base/vite.config.ts +12 -0
  84. package/dist/bin/index.js +8 -0
  85. package/dist/src/cli-args.js +52 -0
  86. package/dist/src/generator.js +85 -0
  87. package/dist/src/installer.js +7 -0
  88. package/dist/src/paths.js +61 -0
  89. package/dist/src/prompts.js +79 -0
  90. package/dist/src/replace-placeholders.js +22 -0
  91. package/dist/src/utils.js +16 -0
  92. package/package.json +63 -0
  93. package/templates/admin-portal/README.md +26 -0
  94. package/templates/admin-portal/src/App.tsx +85 -0
  95. package/templates/admin-portal/src/assets/auth-hero.jpg +0 -0
  96. package/templates/admin-portal/src/assets/brand-logo.png +0 -0
  97. package/templates/admin-portal/src/components/app-breadcrumb.tsx +41 -0
  98. package/templates/admin-portal/src/components/app-header.tsx +20 -0
  99. package/templates/admin-portal/src/components/app-sidebar.tsx +78 -0
  100. package/templates/admin-portal/src/components/auth-layout.tsx +66 -0
  101. package/templates/admin-portal/src/components/dashboard-metric-card.tsx +105 -0
  102. package/templates/admin-portal/src/components/data-table.tsx +919 -0
  103. package/templates/admin-portal/src/components/layout-shell.tsx +23 -0
  104. package/templates/admin-portal/src/components/notifications-sheet.tsx +91 -0
  105. package/templates/admin-portal/src/components/sidebar-nav.tsx +164 -0
  106. package/templates/admin-portal/src/components/user-avatar.tsx +26 -0
  107. package/templates/admin-portal/src/components/user-menu.tsx +163 -0
  108. package/templates/admin-portal/src/config/branding.ts +17 -0
  109. package/templates/admin-portal/src/config/chart-data.ts +44 -0
  110. package/templates/admin-portal/src/config/navigation.ts +42 -0
  111. package/templates/admin-portal/src/context/auth-context.tsx +32 -0
  112. package/templates/admin-portal/src/lib/breadcrumbs.ts +58 -0
  113. package/templates/admin-portal/src/main.tsx +18 -0
  114. package/templates/admin-portal/src/pages/components/demo-columns.tsx +170 -0
  115. package/templates/admin-portal/src/pages/components.tsx +1368 -0
  116. package/templates/admin-portal/src/pages/dashboard.tsx +143 -0
  117. package/templates/admin-portal/src/pages/login.tsx +81 -0
  118. package/templates/admin-portal/src/pages/settings/notifications.tsx +31 -0
  119. package/templates/admin-portal/src/pages/settings/profile.tsx +26 -0
  120. package/templates/admin-portal/src/pages/signup.tsx +81 -0
  121. package/templates/admin-portal/src/pages/users.tsx +12 -0
  122. package/templates/admin-portal/tsconfig.json +10 -0
  123. package/templates/blank/README.md +15 -0
  124. package/templates/blank/src/App.tsx +5 -0
  125. package/templates/blank/src/main.tsx +15 -0
  126. package/templates/blank/src/pages/home.tsx +20 -0
  127. package/templates/blank/tsconfig.json +10 -0
  128. package/templates/tsconfig.overlay.base.json +7 -0
@@ -0,0 +1,32 @@
1
+ import * as React from "react";
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
3
+ import { ui } from "@/config/theme";
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const Tabs = TabsPrimitive.Root;
7
+
8
+ const TabsList = React.forwardRef<
9
+ React.ElementRef<typeof TabsPrimitive.List>,
10
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
11
+ >(({ className, ...props }, ref) => (
12
+ <TabsPrimitive.List ref={ref} className={cn(ui("tabsList"), className)} {...props} />
13
+ ));
14
+ TabsList.displayName = TabsPrimitive.List.displayName;
15
+
16
+ const TabsTrigger = React.forwardRef<
17
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
18
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
19
+ >(({ className, ...props }, ref) => (
20
+ <TabsPrimitive.Trigger ref={ref} className={cn(ui("tabsTrigger"), className)} {...props} />
21
+ ));
22
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
23
+
24
+ const TabsContent = React.forwardRef<
25
+ React.ElementRef<typeof TabsPrimitive.Content>,
26
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
27
+ >(({ className, ...props }, ref) => (
28
+ <TabsPrimitive.Content ref={ref} className={cn(ui("tabsContent"), className)} {...props} />
29
+ ));
30
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
31
+
32
+ export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { ui } from "@/config/theme";
3
+ import { cn } from "@/lib/utils";
4
+
5
+ const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<"textarea">>(
6
+ ({ className, ...props }, ref) => {
7
+ return <textarea className={cn(ui("textarea"), className)} ref={ref} {...props} />;
8
+ },
9
+ );
10
+ Textarea.displayName = "Textarea";
11
+
12
+ export { Textarea };
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
3
+ import { type VariantProps } from "class-variance-authority";
4
+ import { toggleVariants } from "@/components/ui/toggle";
5
+ import { ui } from "@/config/theme";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
9
+ size: "default",
10
+ variant: "default",
11
+ });
12
+
13
+ const ToggleGroup = React.forwardRef<
14
+ React.ElementRef<typeof ToggleGroupPrimitive.Root>,
15
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>
16
+ >(({ className, variant, size, children, ...props }, ref) => (
17
+ <ToggleGroupPrimitive.Root ref={ref} className={cn(ui("toggleGroupRoot"), className)} {...props}>
18
+ <ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
19
+ </ToggleGroupPrimitive.Root>
20
+ ));
21
+
22
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
23
+
24
+ const ToggleGroupItem = React.forwardRef<
25
+ React.ElementRef<typeof ToggleGroupPrimitive.Item>,
26
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
27
+ >(({ className, children, variant, size, ...props }, ref) => {
28
+ const context = React.useContext(ToggleGroupContext);
29
+
30
+ return (
31
+ <ToggleGroupPrimitive.Item
32
+ ref={ref}
33
+ className={cn(
34
+ toggleVariants({
35
+ variant: context.variant || variant,
36
+ size: context.size || size,
37
+ }),
38
+ className,
39
+ )}
40
+ {...props}
41
+ >
42
+ {children}
43
+ </ToggleGroupPrimitive.Item>
44
+ );
45
+ });
46
+
47
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
48
+
49
+ export { ToggleGroup, ToggleGroupItem };
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import * as TogglePrimitive from "@radix-ui/react-toggle";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+ import { ui } from "@/config/theme";
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const toggleVariants = cva(ui("toggle"), {
8
+ variants: {
9
+ variant: {
10
+ default: "",
11
+ outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
12
+ },
13
+ size: {
14
+ default: "h-9 px-3",
15
+ sm: "h-8 px-2",
16
+ lg: "h-10 px-3",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ variant: "default",
21
+ size: "default",
22
+ },
23
+ });
24
+
25
+ const Toggle = React.forwardRef<
26
+ React.ElementRef<typeof TogglePrimitive.Root>,
27
+ React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>
28
+ >(({ className, variant, size, ...props }, ref) => (
29
+ <TogglePrimitive.Root ref={ref} className={cn(toggleVariants({ variant, size, className }))} {...props} />
30
+ ));
31
+ Toggle.displayName = TogglePrimitive.Root.displayName;
32
+
33
+ export { Toggle, toggleVariants };
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
+ import { ui } from "@/config/theme";
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const TooltipProvider = TooltipPrimitive.Provider;
7
+ const Tooltip = TooltipPrimitive.Root;
8
+ const TooltipTrigger = TooltipPrimitive.Trigger;
9
+
10
+ const TooltipContent = React.forwardRef<
11
+ React.ElementRef<typeof TooltipPrimitive.Content>,
12
+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
13
+ >(({ className, sideOffset = 4, ...props }, ref) => (
14
+ <TooltipPrimitive.Content
15
+ ref={ref}
16
+ sideOffset={sideOffset}
17
+ className={cn(ui("tooltipContent"), className)}
18
+ {...props}
19
+ />
20
+ ));
21
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
22
+
23
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
@@ -0,0 +1,76 @@
1
+ import * as React from "react";
2
+ import { ui } from "@/config/theme";
3
+ import { cn } from "@/lib/utils";
4
+
5
+ function TypographyH1({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
6
+ return <h1 className={cn("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl", className)} {...props} />;
7
+ }
8
+
9
+ function TypographyH2({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
10
+ return (
11
+ <h2
12
+ className={cn("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0", className)}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ function TypographyH3({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
19
+ return <h3 className={cn("scroll-m-20 text-2xl font-semibold tracking-tight", className)} {...props} />;
20
+ }
21
+
22
+ function TypographyH4({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
23
+ return <h4 className={cn("scroll-m-20 text-xl font-semibold tracking-tight", className)} {...props} />;
24
+ }
25
+
26
+ function TypographyP({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {
27
+ return <p className={cn("leading-7 [&:not(:first-child)]:mt-6", className)} {...props} />;
28
+ }
29
+
30
+ function TypographyBlockquote({ className, ...props }: React.HTMLAttributes<HTMLQuoteElement>) {
31
+ return <blockquote className={cn("mt-6 border-l-2 pl-6 italic", className)} {...props} />;
32
+ }
33
+
34
+ function TypographyList({ className, ...props }: React.HTMLAttributes<HTMLUListElement>) {
35
+ return <ul className={cn("my-6 ml-6 list-disc [&>li]:mt-2", className)} {...props} />;
36
+ }
37
+
38
+ function TypographyInlineCode({ className, ...props }: React.HTMLAttributes<HTMLElement>) {
39
+ return (
40
+ <code
41
+ className={cn(ui("typographyInlineCode"), className)}
42
+ {...props}
43
+ />
44
+ );
45
+ }
46
+
47
+ function TypographyLead({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {
48
+ return <p className={cn("text-xl text-muted-foreground", className)} {...props} />;
49
+ }
50
+
51
+ function TypographyLarge({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
52
+ return <div className={cn("text-lg font-semibold", className)} {...props} />;
53
+ }
54
+
55
+ function TypographySmall({ className, ...props }: React.HTMLAttributes<HTMLElement>) {
56
+ return <small className={cn("text-sm font-medium leading-none", className)} {...props} />;
57
+ }
58
+
59
+ function TypographyMuted({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {
60
+ return <p className={cn(ui("typographyMuted"), className)} {...props} />;
61
+ }
62
+
63
+ export {
64
+ TypographyBlockquote,
65
+ TypographyH1,
66
+ TypographyH2,
67
+ TypographyH3,
68
+ TypographyH4,
69
+ TypographyInlineCode,
70
+ TypographyLarge,
71
+ TypographyLead,
72
+ TypographyList,
73
+ TypographyMuted,
74
+ TypographyP,
75
+ TypographySmall,
76
+ };
@@ -0,0 +1,3 @@
1
+ export const APP_NAME = "__APP_NAME__";
2
+ export const APP_TITLE = "__APP_TITLE__";
3
+ export const COMPANY_NAME = "__COMPANY_NAME__";
@@ -0,0 +1,432 @@
1
+ import type { ChartConfig } from "@/components/ui/chart";
2
+
3
+ // ---------------------------------------------------------------------------
4
+ // Types
5
+ // ---------------------------------------------------------------------------
6
+
7
+ /** HSL components for `hsl(var(--token))` — space-separated, no `hsl()` wrapper. */
8
+ type HslChannel = string;
9
+
10
+ export type ThemeMode = "light" | "dark";
11
+
12
+ export type ThemeCssVariables = {
13
+ background: HslChannel;
14
+ foreground: HslChannel;
15
+ card: HslChannel;
16
+ "card-foreground": HslChannel;
17
+ popover: HslChannel;
18
+ "popover-foreground": HslChannel;
19
+ primary: HslChannel;
20
+ "primary-foreground": HslChannel;
21
+ secondary: HslChannel;
22
+ "secondary-foreground": HslChannel;
23
+ muted: HslChannel;
24
+ "muted-foreground": HslChannel;
25
+ accent: HslChannel;
26
+ "accent-foreground": HslChannel;
27
+ border: HslChannel;
28
+ input: HslChannel;
29
+ ring: HslChannel;
30
+ destructive: HslChannel;
31
+ "destructive-foreground": HslChannel;
32
+ radius: string;
33
+ "sidebar-background": HslChannel;
34
+ "sidebar-foreground": HslChannel;
35
+ "sidebar-primary": HslChannel;
36
+ "sidebar-primary-foreground": HslChannel;
37
+ "sidebar-accent": HslChannel;
38
+ "sidebar-accent-foreground": HslChannel;
39
+ "sidebar-border": HslChannel;
40
+ "sidebar-ring": HslChannel;
41
+ "chart-1": HslChannel;
42
+ "chart-2": HslChannel;
43
+ "chart-3": HslChannel;
44
+ "chart-4": HslChannel;
45
+ "chart-5": HslChannel;
46
+ brand: HslChannel;
47
+ "brand-foreground": HslChannel;
48
+ "auth-page": HslChannel;
49
+ "auth-hero": HslChannel;
50
+ };
51
+
52
+ export type ThemePreset = {
53
+ mode: ThemeMode;
54
+ cssVariables: ThemeCssVariables;
55
+ metrics: {
56
+ revenue: { iconClassName: string; sparklineColor: string };
57
+ users: { iconClassName: string; sparklineColor: string };
58
+ conversion: { iconClassName: string; sparklineColor: string };
59
+ };
60
+ /** Tailwind class strings shared across layout & UI primitives */
61
+ classes: {
62
+ navActive: string;
63
+ sidebarMenuActive: string;
64
+ authSubmit: string;
65
+ authPage: string;
66
+ authHero: string;
67
+ authHeroOverlay: string;
68
+ skeleton: string;
69
+ destructiveText: string;
70
+ };
71
+ /** Per-component styles — used by files under `components/ui` */
72
+ ui: typeof themeUi;
73
+ };
74
+
75
+ /** All UI component class tokens (edit here to re-skin primitives). */
76
+ export const themeUi = {
77
+ overlay: "fixed inset-0 z-50 bg-foreground/80",
78
+ overlayLight: "fixed inset-0 z-40 bg-foreground/40",
79
+ focusRing:
80
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background",
81
+ iconClose:
82
+ "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",
83
+ popoverContent: "z-[100] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
84
+ popoverMenu: "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
85
+ popoverMenuWide: "z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
86
+ popoverHover: "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
87
+ dropdownContent: "z-[100] min-w-40 rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
88
+ modalContent:
89
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg sm:rounded-lg",
90
+ modalContentTop:
91
+ "fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg sm:rounded-lg",
92
+ chartContainer:
93
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_]:stroke-border [&_.recharts-sector]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
94
+ accordionItem: "border-b",
95
+ accordionTrigger:
96
+ "flex flex-1 items-center justify-between py-4 text-left text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
97
+ accordionChevron: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200",
98
+ accordionContent:
99
+ "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
100
+ accordionContentInner: "pb-4 pt-0",
101
+ alert: "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
102
+ alertDefault: "bg-background text-foreground",
103
+ alertDestructive: "border-destructive/50 text-destructive [&>svg]:text-destructive",
104
+ avatarRoot: "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
105
+ avatarFallback: "flex h-full w-full items-center justify-center rounded-full bg-muted",
106
+ badge:
107
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 ring-offset-background",
108
+ badgeDefault: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
109
+ badgeBrand: "border-transparent bg-brand text-brand-foreground shadow hover:opacity-90",
110
+ badgeSecondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
111
+ badgeDestructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
112
+ badgeOutline: "text-foreground",
113
+ buttonBase:
114
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
115
+ buttonDefault: "bg-primary text-primary-foreground hover:opacity-90",
116
+ buttonBrand: "bg-brand text-brand-foreground hover:opacity-90",
117
+ buttonDestructive: "bg-destructive text-destructive-foreground hover:opacity-90",
118
+ buttonOutline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
119
+ breadcrumbList: "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
120
+ breadcrumbLink: "transition-colors hover:text-foreground",
121
+ breadcrumbPage: "font-normal text-foreground",
122
+ card: "rounded-lg border bg-card text-card-foreground shadow-sm",
123
+ cardDescription: "text-sm text-muted-foreground",
124
+ checkbox:
125
+ "peer shrink-0 border border-primary shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
126
+ input:
127
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
128
+ textarea:
129
+ "flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
130
+ label: "text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
131
+ kbd: "pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",
132
+ tooltipContent: "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground",
133
+ spinner: "size-4 animate-spin text-primary",
134
+ progressTrack: "relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
135
+ progressIndicator: "h-full w-full flex-1 bg-primary transition-all",
136
+ separator: "shrink-0 bg-border",
137
+ switchRoot:
138
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
139
+ switchThumb:
140
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
141
+ sliderTrack: "relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",
142
+ sliderRange: "absolute h-full bg-primary",
143
+ sliderThumb:
144
+ "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
145
+ toggle:
146
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
147
+ tabsList: "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
148
+ tabsTrigger:
149
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
150
+ tabsContent: "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
151
+ tableHeader:
152
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
153
+ tableCell: "p-2 align-middle text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
154
+ selectTrigger:
155
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
156
+ selectContent:
157
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
158
+ drawerContent:
159
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
160
+ drawerHandle: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted",
161
+ sheetContent:
162
+ "fixed z-50 gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
163
+ navigationViewport:
164
+ "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow md:w-[var(--radix-navigation-menu-viewport-width)]",
165
+ calendarDaySelected:
166
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
167
+ typographyMuted: "text-sm text-muted-foreground",
168
+ typographyInlineCode:
169
+ "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold text-foreground",
170
+ radioItem:
171
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
172
+ itemBase:
173
+ "group/item flex flex-wrap items-center rounded-md border border-transparent text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring",
174
+ inputGroup:
175
+ "group/input-group relative flex w-full items-center rounded-md border border-input bg-background shadow-sm has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-offset-2 has-[[data-slot=input-group-control]:focus-visible]:ring-offset-background has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20",
176
+ sonnerToast:
177
+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
178
+ sonnerDescription: "group-[.toast]:text-muted-foreground",
179
+ sonnerAction: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
180
+ sonnerCancel: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
181
+ scrollThumb: "relative flex-1 rounded-full bg-border",
182
+ inputOtpSlot:
183
+ "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm text-foreground shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
184
+ fieldDescription: "text-sm font-normal leading-normal text-muted-foreground",
185
+ toggleGroupRoot: "flex items-center justify-center gap-1",
186
+ datePickerTrigger: "w-[240px] justify-start text-left font-normal",
187
+ datePickerPopoverContent: "w-auto p-0",
188
+ dropdownTrigger: "w-full justify-between font-normal",
189
+ dropdownTriggerMulti: "h-auto min-h-10 w-full justify-between py-2 font-normal",
190
+ dropdownPopoverContent: "w-[var(--radix-popover-trigger-width)] p-0",
191
+ dropdownSearchBar: "flex items-center border-b px-3",
192
+ dropdownSearchInput:
193
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm text-foreground outline-none placeholder:text-muted-foreground",
194
+ dropdownEmpty: "py-6 text-center",
195
+ dropdownOptionItem:
196
+ "relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
197
+ dropdownOptionItemActive: "bg-accent text-accent-foreground",
198
+ dropdownOptionItemMulti:
199
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
200
+ dropdownOptionItemMultiSelected: "bg-accent/60",
201
+ dropdownFooter: "flex items-center justify-between gap-2 border-t border-border px-3 py-2",
202
+ dropdownCheckIcon: "mr-2 h-4 w-4 shrink-0",
203
+ dropdownChevron: "ml-2 h-4 w-4 shrink-0 opacity-50",
204
+ dropdownSearchIcon: "mr-2 h-4 w-4 shrink-0 opacity-50",
205
+ } as const;
206
+
207
+ export type ThemeUiKey = keyof typeof themeUi;
208
+
209
+ /** Resolve a UI theme class token by key. */
210
+ export function ui(key: ThemeUiKey): string {
211
+ return themeUi[key];
212
+ }
213
+
214
+ // ---------------------------------------------------------------------------
215
+ // Presets — edit values here to re-skin the entire app
216
+ // ---------------------------------------------------------------------------
217
+
218
+ const sharedClasses = {
219
+ navActive: "bg-primary/10 font-medium text-primary",
220
+ sidebarMenuActive:
221
+ "data-[active=true]:bg-primary/10 data-[active=true]:font-medium data-[active=true]:text-primary",
222
+ authSubmit: "w-full",
223
+ authPage: "bg-auth-page",
224
+ authHero: "bg-auth-hero",
225
+ authHeroOverlay: "from-auth-hero/40",
226
+ skeleton: "bg-primary/10",
227
+ destructiveText: "text-destructive",
228
+ } as const;
229
+
230
+ const metricIcon = (chartIndex: 1 | 2 | 3 | 4 | 5) =>
231
+ `text-chart-${chartIndex} bg-chart-${chartIndex}/10 border-chart-${chartIndex}/20`;
232
+
233
+ export const lightThemePreset: ThemePreset = {
234
+ mode: "light",
235
+ cssVariables: {
236
+ background: "0 0% 100%",
237
+ foreground: "222.2 84% 4.9%",
238
+ card: "0 0% 100%",
239
+ "card-foreground": "222.2 84% 4.9%",
240
+ popover: "0 0% 100%",
241
+ "popover-foreground": "222.2 84% 4.9%",
242
+ primary: "221.2 83.2% 53.3%",
243
+ "primary-foreground": "210 40% 98%",
244
+ secondary: "210 40% 96.1%",
245
+ "secondary-foreground": "222.2 47.4% 11.2%",
246
+ muted: "210 40% 96.1%",
247
+ "muted-foreground": "215.4 16.3% 46.9%",
248
+ accent: "210 40% 96.1%",
249
+ "accent-foreground": "222.2 47.4% 11.2%",
250
+ border: "214.3 31.8% 91.4%",
251
+ input: "214.3 31.8% 91.4%",
252
+ ring: "221.2 83.2% 53.3%",
253
+ destructive: "0 84.2% 60.2%",
254
+ "destructive-foreground": "210 40% 98%",
255
+ radius: "0.75rem",
256
+ "sidebar-background": "0 0% 98%",
257
+ "sidebar-foreground": "240 5.3% 26.1%",
258
+ "sidebar-primary": "221.2 83.2% 53.3%",
259
+ "sidebar-primary-foreground": "210 40% 98%",
260
+ "sidebar-accent": "240 4.8% 95.9%",
261
+ "sidebar-accent-foreground": "240 5.9% 10%",
262
+ "sidebar-border": "220 13% 91%",
263
+ "sidebar-ring": "221.2 83.2% 53.3%",
264
+ "chart-1": "221.2 83.2% 53.3%",
265
+ "chart-2": "173 58% 39%",
266
+ "chart-3": "197 37% 24%",
267
+ "chart-4": "43 74% 66%",
268
+ "chart-5": "27 87% 67%",
269
+ brand: "73 78% 66%",
270
+ "brand-foreground": "0 0% 0%",
271
+ "auth-page": "220 14% 96%",
272
+ "auth-hero": "222 71% 11%",
273
+ },
274
+ metrics: {
275
+ revenue: {
276
+ iconClassName: metricIcon(2),
277
+ sparklineColor: "hsl(var(--chart-2))",
278
+ },
279
+ users: {
280
+ iconClassName: "text-primary bg-primary/10 border-primary/20",
281
+ sparklineColor: "hsl(var(--chart-1))",
282
+ },
283
+ conversion: {
284
+ iconClassName: metricIcon(4),
285
+ sparklineColor: "hsl(var(--chart-4))",
286
+ },
287
+ },
288
+ classes: sharedClasses,
289
+ ui: themeUi,
290
+ };
291
+
292
+ export const darkThemePreset: ThemePreset = {
293
+ mode: "dark",
294
+ cssVariables: {
295
+ background: "222.2 84% 4.9%",
296
+ foreground: "210 40% 98%",
297
+ card: "222.2 84% 4.9%",
298
+ "card-foreground": "210 40% 98%",
299
+ popover: "222.2 84% 4.9%",
300
+ "popover-foreground": "210 40% 98%",
301
+ primary: "217.2 91.2% 59.8%",
302
+ "primary-foreground": "222.2 47.4% 11.2%",
303
+ secondary: "217.2 32.6% 17.5%",
304
+ "secondary-foreground": "210 40% 98%",
305
+ muted: "217.2 32.6% 17.5%",
306
+ "muted-foreground": "215 20.2% 65.1%",
307
+ accent: "217.2 32.6% 17.5%",
308
+ "accent-foreground": "210 40% 98%",
309
+ border: "217.2 32.6% 17.5%",
310
+ input: "217.2 32.6% 17.5%",
311
+ ring: "224.3 76.3% 48%",
312
+ destructive: "0 62.8% 30.6%",
313
+ "destructive-foreground": "210 40% 98%",
314
+ radius: "0.75rem",
315
+ "sidebar-background": "240 5.9% 10%",
316
+ "sidebar-foreground": "240 4.8% 95.9%",
317
+ "sidebar-primary": "224.3 76.3% 48%",
318
+ "sidebar-primary-foreground": "0 0% 100%",
319
+ "sidebar-accent": "240 3.7% 15.9%",
320
+ "sidebar-accent-foreground": "240 4.8% 95.9%",
321
+ "sidebar-border": "240 3.7% 15.9%",
322
+ "sidebar-ring": "217.2 91.2% 59.8%",
323
+ "chart-1": "220 70% 50%",
324
+ "chart-2": "160 60% 45%",
325
+ "chart-3": "30 80% 55%",
326
+ "chart-4": "280 65% 60%",
327
+ "chart-5": "340 75% 55%",
328
+ brand: "73 78% 66%",
329
+ "brand-foreground": "0 0% 0%",
330
+ "auth-page": "222.2 84% 4.9%",
331
+ "auth-hero": "222 71% 11%",
332
+ },
333
+ metrics: {
334
+ revenue: {
335
+ iconClassName: metricIcon(2),
336
+ sparklineColor: "hsl(var(--chart-2))",
337
+ },
338
+ users: {
339
+ iconClassName: "text-primary bg-primary/10 border-primary/20",
340
+ sparklineColor: "hsl(var(--chart-1))",
341
+ },
342
+ conversion: {
343
+ iconClassName: metricIcon(4),
344
+ sparklineColor: "hsl(var(--chart-4))",
345
+ },
346
+ },
347
+ classes: sharedClasses,
348
+ ui: themeUi,
349
+ };
350
+
351
+ /** Active theme — set to `"dark"` for dark mode by default. */
352
+ export const THEME_MODE: ThemeMode = "light";
353
+
354
+ const presets: Record<ThemeMode, ThemePreset> = {
355
+ light: lightThemePreset,
356
+ dark: darkThemePreset,
357
+ };
358
+
359
+ export const THEME = presets[THEME_MODE];
360
+
361
+ export function getThemePreset(mode: ThemeMode = THEME_MODE): ThemePreset {
362
+ return presets[mode];
363
+ }
364
+
365
+ // ---------------------------------------------------------------------------
366
+ // Chart helpers & configs
367
+ // ---------------------------------------------------------------------------
368
+
369
+ export type ChartColorIndex = 1 | 2 | 3 | 4 | 5;
370
+
371
+ export function chartColor(index: ChartColorIndex): string {
372
+ return `hsl(var(--chart-${index}))`;
373
+ }
374
+
375
+ export function chartFill(index: ChartColorIndex): string {
376
+ return chartColor(index);
377
+ }
378
+
379
+ export const revenueChartConfig = {
380
+ revenue: { label: "Revenue", color: chartColor(1) },
381
+ users: { label: "New users", color: chartColor(2) },
382
+ } satisfies ChartConfig;
383
+
384
+ export const activeUsersChartConfig = {
385
+ users: { label: "Active users", color: chartColor(1) },
386
+ } satisfies ChartConfig;
387
+
388
+ export const trafficChartConfig = {
389
+ visitors: { label: "Visitors", color: chartColor(1) },
390
+ } satisfies ChartConfig;
391
+
392
+ export const roleChartConfig = {
393
+ Admin: { label: "Admin", color: chartColor(1) },
394
+ Editor: { label: "Editor", color: chartColor(2) },
395
+ Viewer: { label: "Viewer", color: chartColor(3) },
396
+ Invited: { label: "Invited", color: chartColor(4) },
397
+ } satisfies ChartConfig;
398
+
399
+ export const deviceChartConfig = {
400
+ Desktop: { label: "Desktop", color: chartColor(1) },
401
+ Mobile: { label: "Mobile", color: chartColor(2) },
402
+ Tablet: { label: "Tablet", color: chartColor(3) },
403
+ } satisfies ChartConfig;
404
+
405
+ // ---------------------------------------------------------------------------
406
+ // CSS injection (single source — no duplicate tokens in globals.css)
407
+ // ---------------------------------------------------------------------------
408
+
409
+ const THEME_STYLE_ID = "app-theme-variables";
410
+
411
+ function cssVariablesToDeclarations(variables: ThemeCssVariables): string {
412
+ return Object.entries(variables)
413
+ .map(([key, value]) => ` --${key}: ${value};`)
414
+ .join("\n");
415
+ }
416
+
417
+ export function buildThemeStylesheet(): string {
418
+ return `:root {\n${cssVariablesToDeclarations(lightThemePreset.cssVariables)}\n}\n.dark {\n${cssVariablesToDeclarations(darkThemePreset.cssVariables)}\n}`;
419
+ }
420
+
421
+ export function initializeTheme(): void {
422
+ let style = document.getElementById(THEME_STYLE_ID) as HTMLStyleElement | null;
423
+ if (!style) {
424
+ style = document.createElement("style");
425
+ style.id = THEME_STYLE_ID;
426
+ document.head.prepend(style);
427
+ }
428
+ style.textContent = buildThemeStylesheet();
429
+
430
+ const root = document.documentElement;
431
+ root.classList.toggle("dark", THEME_MODE === "dark");
432
+ }