doo-boilerplate 0.1.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 (156) hide show
  1. package/dist/index.js +382 -0
  2. package/package.json +31 -0
  3. package/templates/template-nextjs/Dockerfile +29 -0
  4. package/templates/template-nextjs/README.md +215 -0
  5. package/templates/template-nextjs/_env.example +7 -0
  6. package/templates/template-nextjs/_gitignore +8 -0
  7. package/templates/template-nextjs/_prettierignore +4 -0
  8. package/templates/template-nextjs/_prettierrc +12 -0
  9. package/templates/template-nextjs/components.json +19 -0
  10. package/templates/template-nextjs/docker-compose.yml +12 -0
  11. package/templates/template-nextjs/docs/swagger/api.json +77 -0
  12. package/templates/template-nextjs/eslint.config.ts +25 -0
  13. package/templates/template-nextjs/generate/.gitkeep +0 -0
  14. package/templates/template-nextjs/knip.config.ts +8 -0
  15. package/templates/template-nextjs/messages/en.json +14 -0
  16. package/templates/template-nextjs/messages/vi.json +14 -0
  17. package/templates/template-nextjs/next.config.ts +13 -0
  18. package/templates/template-nextjs/optional/charts/deps.json +7 -0
  19. package/templates/template-nextjs/optional/dark-mode/deps.json +5 -0
  20. package/templates/template-nextjs/optional/dark-mode/files/providers/theme-provider.tsx +17 -0
  21. package/templates/template-nextjs/optional/dnd/deps.json +8 -0
  22. package/templates/template-nextjs/optional/editor/deps.json +10 -0
  23. package/templates/template-nextjs/optional/i18n/deps.json +5 -0
  24. package/templates/template-nextjs/optional/sentry/deps.json +5 -0
  25. package/templates/template-nextjs/package.json +82 -0
  26. package/templates/template-nextjs/postcss.config.js +1 -0
  27. package/templates/template-nextjs/public/images/.gitkeep +0 -0
  28. package/templates/template-nextjs/scripts/build-and-scan.sh +13 -0
  29. package/templates/template-nextjs/scripts/trivy-scan.sh +24 -0
  30. package/templates/template-nextjs/src/app/(auth)/layout.tsx +10 -0
  31. package/templates/template-nextjs/src/app/(auth)/sign-in/page.tsx +9 -0
  32. package/templates/template-nextjs/src/app/(dashboard)/layout.tsx +17 -0
  33. package/templates/template-nextjs/src/app/(dashboard)/page.tsx +27 -0
  34. package/templates/template-nextjs/src/app/(dashboard)/profile/page.tsx +39 -0
  35. package/templates/template-nextjs/src/app/(dashboard)/settings/page.tsx +15 -0
  36. package/templates/template-nextjs/src/app/api/health/route.ts +3 -0
  37. package/templates/template-nextjs/src/app/layout.tsx +22 -0
  38. package/templates/template-nextjs/src/app/not-found.tsx +18 -0
  39. package/templates/template-nextjs/src/app/page.tsx +5 -0
  40. package/templates/template-nextjs/src/components/common/error-boundary.tsx +56 -0
  41. package/templates/template-nextjs/src/components/common/loading-spinner.tsx +28 -0
  42. package/templates/template-nextjs/src/components/common/theme-toggle.tsx +21 -0
  43. package/templates/template-nextjs/src/components/layout/header.tsx +91 -0
  44. package/templates/template-nextjs/src/components/layout/page-layout.tsx +23 -0
  45. package/templates/template-nextjs/src/components/layout/sidebar.tsx +126 -0
  46. package/templates/template-nextjs/src/components/ui/avatar.tsx +45 -0
  47. package/templates/template-nextjs/src/components/ui/badge.tsx +31 -0
  48. package/templates/template-nextjs/src/components/ui/button.tsx +44 -0
  49. package/templates/template-nextjs/src/components/ui/card.tsx +55 -0
  50. package/templates/template-nextjs/src/components/ui/checkbox.tsx +26 -0
  51. package/templates/template-nextjs/src/components/ui/dialog.tsx +99 -0
  52. package/templates/template-nextjs/src/components/ui/dropdown-menu.tsx +180 -0
  53. package/templates/template-nextjs/src/components/ui/form.tsx +158 -0
  54. package/templates/template-nextjs/src/components/ui/input.tsx +24 -0
  55. package/templates/template-nextjs/src/components/ui/label.tsx +19 -0
  56. package/templates/template-nextjs/src/components/ui/scroll-area.tsx +40 -0
  57. package/templates/template-nextjs/src/components/ui/select.tsx +148 -0
  58. package/templates/template-nextjs/src/components/ui/separator.tsx +24 -0
  59. package/templates/template-nextjs/src/components/ui/sheet.tsx +96 -0
  60. package/templates/template-nextjs/src/components/ui/skeleton.tsx +7 -0
  61. package/templates/template-nextjs/src/components/ui/switch.tsx +27 -0
  62. package/templates/template-nextjs/src/components/ui/tabs.tsx +53 -0
  63. package/templates/template-nextjs/src/components/ui/tooltip.tsx +28 -0
  64. package/templates/template-nextjs/src/config/site.ts +5 -0
  65. package/templates/template-nextjs/src/features/auth/components/sign-in-form.tsx +93 -0
  66. package/templates/template-nextjs/src/features/auth/hooks/use-auth.ts +47 -0
  67. package/templates/template-nextjs/src/features/auth/schemas/auth-schema.ts +21 -0
  68. package/templates/template-nextjs/src/features/auth/services/auth-api.ts +30 -0
  69. package/templates/template-nextjs/src/hooks/use-media-query.ts +15 -0
  70. package/templates/template-nextjs/src/i18n/config.ts +3 -0
  71. package/templates/template-nextjs/src/lib/api-client.ts +43 -0
  72. package/templates/template-nextjs/src/lib/query-client.ts +17 -0
  73. package/templates/template-nextjs/src/lib/utils.ts +19 -0
  74. package/templates/template-nextjs/src/middleware.ts +23 -0
  75. package/templates/template-nextjs/src/providers/app-providers.tsx +18 -0
  76. package/templates/template-nextjs/src/providers/query-provider.tsx +16 -0
  77. package/templates/template-nextjs/src/providers/theme-provider.tsx +17 -0
  78. package/templates/template-nextjs/src/stores/auth-store.ts +82 -0
  79. package/templates/template-nextjs/src/styles/globals.css +65 -0
  80. package/templates/template-nextjs/src/types/index.ts +13 -0
  81. package/templates/template-nextjs/tsconfig.json +23 -0
  82. package/templates/template-vite/Dockerfile +20 -0
  83. package/templates/template-vite/README.md +241 -0
  84. package/templates/template-vite/_env.example +8 -0
  85. package/templates/template-vite/_gitignore +7 -0
  86. package/templates/template-vite/_prettierignore +4 -0
  87. package/templates/template-vite/_prettierrc +13 -0
  88. package/templates/template-vite/components.json +19 -0
  89. package/templates/template-vite/docker-compose.yml +11 -0
  90. package/templates/template-vite/docs/swagger/api.json +77 -0
  91. package/templates/template-vite/eslint.config.ts +30 -0
  92. package/templates/template-vite/generate/.gitkeep +0 -0
  93. package/templates/template-vite/index.html +13 -0
  94. package/templates/template-vite/knip.config.ts +8 -0
  95. package/templates/template-vite/nginx.conf +37 -0
  96. package/templates/template-vite/optional/charts/deps.json +7 -0
  97. package/templates/template-vite/optional/dark-mode/deps.json +5 -0
  98. package/templates/template-vite/optional/dnd/deps.json +8 -0
  99. package/templates/template-vite/optional/editor/deps.json +10 -0
  100. package/templates/template-vite/optional/i18n/deps.json +7 -0
  101. package/templates/template-vite/optional/sentry/deps.json +6 -0
  102. package/templates/template-vite/package.json +91 -0
  103. package/templates/template-vite/public/favicon.svg +5 -0
  104. package/templates/template-vite/scripts/build-and-scan.sh +13 -0
  105. package/templates/template-vite/scripts/trivy-scan.sh +24 -0
  106. package/templates/template-vite/src/components/common/error-boundary.tsx +51 -0
  107. package/templates/template-vite/src/components/common/loading-spinner.tsx +38 -0
  108. package/templates/template-vite/src/components/common/theme-toggle.tsx +19 -0
  109. package/templates/template-vite/src/components/layout/header.tsx +58 -0
  110. package/templates/template-vite/src/components/layout/page-layout.tsx +31 -0
  111. package/templates/template-vite/src/components/layout/sidebar.tsx +74 -0
  112. package/templates/template-vite/src/components/ui/avatar.tsx +45 -0
  113. package/templates/template-vite/src/components/ui/badge.tsx +31 -0
  114. package/templates/template-vite/src/components/ui/button.tsx +49 -0
  115. package/templates/template-vite/src/components/ui/card.tsx +56 -0
  116. package/templates/template-vite/src/components/ui/checkbox.tsx +26 -0
  117. package/templates/template-vite/src/components/ui/dialog.tsx +99 -0
  118. package/templates/template-vite/src/components/ui/dropdown-menu.tsx +174 -0
  119. package/templates/template-vite/src/components/ui/form.tsx +161 -0
  120. package/templates/template-vite/src/components/ui/input.tsx +24 -0
  121. package/templates/template-vite/src/components/ui/label.tsx +19 -0
  122. package/templates/template-vite/src/components/ui/scroll-area.tsx +44 -0
  123. package/templates/template-vite/src/components/ui/select.tsx +148 -0
  124. package/templates/template-vite/src/components/ui/separator.tsx +24 -0
  125. package/templates/template-vite/src/components/ui/sheet.tsx +118 -0
  126. package/templates/template-vite/src/components/ui/skeleton.tsx +7 -0
  127. package/templates/template-vite/src/components/ui/switch.tsx +27 -0
  128. package/templates/template-vite/src/components/ui/tabs.tsx +53 -0
  129. package/templates/template-vite/src/components/ui/tooltip.tsx +26 -0
  130. package/templates/template-vite/src/config/site.ts +5 -0
  131. package/templates/template-vite/src/context/theme-provider.tsx +10 -0
  132. package/templates/template-vite/src/features/auth/components/sign-in-form.tsx +86 -0
  133. package/templates/template-vite/src/features/auth/hooks/use-auth.ts +46 -0
  134. package/templates/template-vite/src/features/auth/schemas/auth-schema.ts +8 -0
  135. package/templates/template-vite/src/features/auth/services/auth-api.ts +24 -0
  136. package/templates/template-vite/src/hooks/use-media-query.ts +26 -0
  137. package/templates/template-vite/src/lib/api-client.ts +38 -0
  138. package/templates/template-vite/src/lib/i18n.ts +34 -0
  139. package/templates/template-vite/src/lib/query-client.ts +14 -0
  140. package/templates/template-vite/src/lib/utils.ts +28 -0
  141. package/templates/template-vite/src/main.tsx +37 -0
  142. package/templates/template-vite/src/routeTree.gen.ts +6 -0
  143. package/templates/template-vite/src/routes/(auth)/sign-in.tsx +17 -0
  144. package/templates/template-vite/src/routes/(errors)/404.tsx +19 -0
  145. package/templates/template-vite/src/routes/__root.tsx +17 -0
  146. package/templates/template-vite/src/routes/_authenticated/dashboard.tsx +22 -0
  147. package/templates/template-vite/src/routes/_authenticated/profile.tsx +47 -0
  148. package/templates/template-vite/src/routes/_authenticated/settings.tsx +17 -0
  149. package/templates/template-vite/src/routes/_authenticated.tsx +32 -0
  150. package/templates/template-vite/src/stores/auth-store.ts +56 -0
  151. package/templates/template-vite/src/styles/globals.css +81 -0
  152. package/templates/template-vite/src/types/index.ts +39 -0
  153. package/templates/template-vite/tsconfig.app.json +24 -0
  154. package/templates/template-vite/tsconfig.json +7 -0
  155. package/templates/template-vite/tsconfig.node.json +16 -0
  156. package/templates/template-vite/vite.config.ts +36 -0
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+
3
+ import { useTheme } from 'next-themes'
4
+ import { Moon, Sun } from 'lucide-react'
5
+
6
+ import { Button } from '@/components/ui/button'
7
+
8
+ export function ThemeToggle() {
9
+ const { theme, setTheme } = useTheme()
10
+ return (
11
+ <Button
12
+ variant='ghost'
13
+ size='icon'
14
+ onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
15
+ >
16
+ <Sun className='h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0' />
17
+ <Moon className='absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100' />
18
+ <span className='sr-only'>Toggle theme</span>
19
+ </Button>
20
+ )
21
+ }
@@ -0,0 +1,91 @@
1
+ 'use client'
2
+
3
+ import { LogOut, Menu, User } from 'lucide-react'
4
+ import Link from 'next/link'
5
+
6
+ import { useSignOut } from '@/features/auth/hooks/use-auth'
7
+ import { useAuthStore } from '@/stores/auth-store'
8
+
9
+ import { Avatar, AvatarFallback } from '../ui/avatar'
10
+ import { Button } from '../ui/button'
11
+ import {
12
+ DropdownMenu,
13
+ DropdownMenuContent,
14
+ DropdownMenuItem,
15
+ DropdownMenuLabel,
16
+ DropdownMenuSeparator,
17
+ DropdownMenuTrigger,
18
+ } from '../ui/dropdown-menu'
19
+ import { useSidebarStore } from './sidebar'
20
+
21
+ interface HeaderProps {
22
+ title?: string
23
+ }
24
+
25
+ export function Header({ title = 'Dashboard' }: HeaderProps) {
26
+ const { user } = useAuthStore()
27
+ const signOut = useSignOut()
28
+ const { setMobileOpen } = useSidebarStore()
29
+
30
+ const initials = user?.name
31
+ ? user.name
32
+ .split(' ')
33
+ .map((n) => n[0])
34
+ .join('')
35
+ .toUpperCase()
36
+ .slice(0, 2)
37
+ : 'U'
38
+
39
+ return (
40
+ <header className="flex h-14 items-center justify-between border-b bg-background px-4">
41
+ {/* Mobile menu trigger + page title */}
42
+ <div className="flex items-center gap-3">
43
+ <Button
44
+ variant="ghost"
45
+ size="icon"
46
+ className="lg:hidden"
47
+ onClick={() => setMobileOpen(true)}
48
+ aria-label="Open menu"
49
+ >
50
+ <Menu className="h-5 w-5" />
51
+ </Button>
52
+ <h2 className="text-lg font-semibold">{title}</h2>
53
+ </div>
54
+
55
+ {/* User dropdown */}
56
+ <DropdownMenu>
57
+ <DropdownMenuTrigger asChild>
58
+ <Button variant="ghost" className="relative h-9 w-9 rounded-full" aria-label="User menu">
59
+ <Avatar className="h-9 w-9">
60
+ <AvatarFallback className="text-xs">{initials}</AvatarFallback>
61
+ </Avatar>
62
+ </Button>
63
+ </DropdownMenuTrigger>
64
+ <DropdownMenuContent align="end" className="w-48">
65
+ <DropdownMenuLabel className="font-normal">
66
+ <div className="flex flex-col space-y-1">
67
+ <p className="text-sm font-medium">{user?.name ?? 'User'}</p>
68
+ <p className="text-xs text-muted-foreground">{user?.email}</p>
69
+ </div>
70
+ </DropdownMenuLabel>
71
+ <DropdownMenuSeparator />
72
+ <DropdownMenuItem asChild>
73
+ <Link href="/dashboard/profile">
74
+ <User className="mr-2 h-4 w-4" />
75
+ Profile
76
+ </Link>
77
+ </DropdownMenuItem>
78
+ <DropdownMenuSeparator />
79
+ <DropdownMenuItem
80
+ onClick={() => signOut.mutate()}
81
+ disabled={signOut.isPending}
82
+ className="text-destructive focus:text-destructive"
83
+ >
84
+ <LogOut className="mr-2 h-4 w-4" />
85
+ Sign out
86
+ </DropdownMenuItem>
87
+ </DropdownMenuContent>
88
+ </DropdownMenu>
89
+ </header>
90
+ )
91
+ }
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react'
2
+
3
+ interface PageLayoutProps {
4
+ title: string
5
+ description?: string
6
+ actions?: ReactNode
7
+ children: ReactNode
8
+ }
9
+
10
+ export function PageLayout({ title, description, actions, children }: PageLayoutProps) {
11
+ return (
12
+ <div className="flex flex-col gap-6 p-6">
13
+ <div className="flex items-center justify-between">
14
+ <div>
15
+ <h1 className="text-2xl font-bold tracking-tight">{title}</h1>
16
+ {description && <p className="mt-1 text-sm text-muted-foreground">{description}</p>}
17
+ </div>
18
+ {actions && <div className="flex items-center gap-2">{actions}</div>}
19
+ </div>
20
+ {children}
21
+ </div>
22
+ )
23
+ }
@@ -0,0 +1,126 @@
1
+ 'use client'
2
+
3
+ import { LayoutDashboard, Menu, Settings, User, X } from 'lucide-react'
4
+ import Link from 'next/link'
5
+ import { usePathname } from 'next/navigation'
6
+ import { create } from 'zustand'
7
+
8
+ import { cn } from '@/lib/utils'
9
+
10
+ import { Button } from '../ui/button'
11
+ import { Sheet, SheetContent, SheetTitle } from '../ui/sheet'
12
+
13
+ // Sidebar collapsed state
14
+ interface SidebarState {
15
+ isCollapsed: boolean
16
+ isMobileOpen: boolean
17
+ toggle: () => void
18
+ setMobileOpen: (open: boolean) => void
19
+ }
20
+
21
+ export const useSidebarStore = create<SidebarState>((set) => ({
22
+ isCollapsed: false,
23
+ isMobileOpen: false,
24
+ toggle: () => set((s) => ({ isCollapsed: !s.isCollapsed })),
25
+ setMobileOpen: (isMobileOpen) => set({ isMobileOpen }),
26
+ }))
27
+
28
+ const navItems = [
29
+ { href: '/dashboard', label: 'Dashboard', icon: LayoutDashboard },
30
+ { href: '/dashboard/settings', label: 'Settings', icon: Settings },
31
+ { href: '/dashboard/profile', label: 'Profile', icon: User },
32
+ ]
33
+
34
+ function NavLink({
35
+ href,
36
+ label,
37
+ icon: Icon,
38
+ collapsed,
39
+ }: {
40
+ href: string
41
+ label: string
42
+ icon: React.ElementType
43
+ collapsed: boolean
44
+ }) {
45
+ const pathname = usePathname()
46
+ const isActive = pathname === href
47
+
48
+ return (
49
+ <Link
50
+ href={href}
51
+ className={cn(
52
+ 'flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors',
53
+ isActive
54
+ ? 'bg-sidebar-primary text-sidebar-primary-foreground'
55
+ : 'text-sidebar-foreground hover:bg-sidebar-border/60 hover:text-sidebar-primary'
56
+ )}
57
+ title={collapsed ? label : undefined}
58
+ >
59
+ <Icon className="h-4 w-4 shrink-0" />
60
+ {!collapsed && <span>{label}</span>}
61
+ </Link>
62
+ )
63
+ }
64
+
65
+ function SidebarContent({ collapsed }: { collapsed: boolean }) {
66
+ const { toggle } = useSidebarStore()
67
+
68
+ return (
69
+ <div className="flex h-full flex-col bg-sidebar text-sidebar-foreground">
70
+ {/* Logo area */}
71
+ <div className="flex h-14 items-center justify-between border-b border-sidebar-border px-3">
72
+ {!collapsed && (
73
+ <Link href="/dashboard" className="text-sm font-bold">
74
+ {'{{PROJECT_NAME}}'}
75
+ </Link>
76
+ )}
77
+ <Button
78
+ variant="ghost"
79
+ size="icon"
80
+ onClick={toggle}
81
+ className="ml-auto text-sidebar-foreground hover:bg-sidebar-border/60"
82
+ aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
83
+ >
84
+ {collapsed ? <Menu className="h-4 w-4" /> : <X className="h-4 w-4" />}
85
+ </Button>
86
+ </div>
87
+
88
+ {/* Navigation */}
89
+ <nav className="flex-1 space-y-1 overflow-y-auto p-2">
90
+ {navItems.map((item) => (
91
+ <NavLink key={item.href} {...item} collapsed={collapsed} />
92
+ ))}
93
+ </nav>
94
+ </div>
95
+ )
96
+ }
97
+
98
+ // Desktop sidebar
99
+ export function Sidebar() {
100
+ const { isCollapsed } = useSidebarStore()
101
+
102
+ return (
103
+ <aside
104
+ className={cn(
105
+ 'hidden h-full border-r border-sidebar-border transition-all duration-200 lg:block',
106
+ isCollapsed ? 'w-14' : 'w-60'
107
+ )}
108
+ >
109
+ <SidebarContent collapsed={isCollapsed} />
110
+ </aside>
111
+ )
112
+ }
113
+
114
+ // Mobile sidebar (Sheet)
115
+ export function MobileSidebar() {
116
+ const { isMobileOpen, setMobileOpen } = useSidebarStore()
117
+
118
+ return (
119
+ <Sheet open={isMobileOpen} onOpenChange={setMobileOpen}>
120
+ <SheetContent side="left" className="w-60 p-0">
121
+ <SheetTitle className="sr-only">Navigation</SheetTitle>
122
+ <SidebarContent collapsed={false} />
123
+ </SheetContent>
124
+ </Sheet>
125
+ )
126
+ }
@@ -0,0 +1,45 @@
1
+ import * as React from 'react'
2
+ import * as AvatarPrimitive from '@radix-ui/react-avatar'
3
+
4
+ import { cn } from '@/lib/utils'
5
+
6
+ const Avatar = React.forwardRef<
7
+ React.ElementRef<typeof AvatarPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
9
+ >(({ className, ...props }, ref) => (
10
+ <AvatarPrimitive.Root
11
+ ref={ref}
12
+ className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
13
+ {...props}
14
+ />
15
+ ))
16
+ Avatar.displayName = AvatarPrimitive.Root.displayName
17
+
18
+ const AvatarImage = React.forwardRef<
19
+ React.ElementRef<typeof AvatarPrimitive.Image>,
20
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
21
+ >(({ className, ...props }, ref) => (
22
+ <AvatarPrimitive.Image
23
+ ref={ref}
24
+ className={cn('aspect-square h-full w-full', className)}
25
+ {...props}
26
+ />
27
+ ))
28
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName
29
+
30
+ const AvatarFallback = React.forwardRef<
31
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
32
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
33
+ >(({ className, ...props }, ref) => (
34
+ <AvatarPrimitive.Fallback
35
+ ref={ref}
36
+ className={cn(
37
+ 'flex h-full w-full items-center justify-center rounded-full bg-muted',
38
+ className
39
+ )}
40
+ {...props}
41
+ />
42
+ ))
43
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
44
+
45
+ export { Avatar, AvatarImage, AvatarFallback }
@@ -0,0 +1,31 @@
1
+ import * as React from 'react'
2
+ import { cva, type VariantProps } from 'class-variance-authority'
3
+
4
+ import { cn } from '@/lib/utils'
5
+
6
+ const badgeVariants = cva(
7
+ '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',
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
12
+ secondary:
13
+ 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
14
+ destructive:
15
+ 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
16
+ outline: 'text-foreground',
17
+ },
18
+ },
19
+ defaultVariants: { variant: 'default' },
20
+ }
21
+ )
22
+
23
+ export interface BadgeProps
24
+ extends React.HTMLAttributes<HTMLDivElement>,
25
+ VariantProps<typeof badgeVariants> {}
26
+
27
+ function Badge({ className, variant, ...props }: BadgeProps) {
28
+ return <div className={cn(badgeVariants({ variant }), className)} {...props} />
29
+ }
30
+
31
+ export { Badge, badgeVariants }
@@ -0,0 +1,44 @@
1
+ import * as React from 'react'
2
+ import { Slot } from '@radix-ui/react-slot'
3
+ import { cva, type VariantProps } from 'class-variance-authority'
4
+
5
+ import { cn } from '@/lib/utils'
6
+
7
+ const buttonVariants = cva(
8
+ 'inline-flex items-center justify-center gap-2 whitespace-nowrap 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',
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90',
13
+ destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
14
+ outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
15
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
16
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
17
+ link: 'text-primary underline-offset-4 hover:underline',
18
+ },
19
+ size: {
20
+ default: 'h-9 px-4 py-2',
21
+ sm: 'h-8 rounded-md px-3 text-xs',
22
+ lg: 'h-10 rounded-md px-8',
23
+ icon: 'h-9 w-9',
24
+ },
25
+ },
26
+ defaultVariants: { variant: 'default', size: 'default' },
27
+ }
28
+ )
29
+
30
+ export interface ButtonProps
31
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
32
+ VariantProps<typeof buttonVariants> {
33
+ asChild?: boolean
34
+ }
35
+
36
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
37
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
38
+ const Comp = asChild ? Slot : 'button'
39
+ return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
40
+ }
41
+ )
42
+ Button.displayName = 'Button'
43
+
44
+ export { Button, buttonVariants }
@@ -0,0 +1,55 @@
1
+ import * as React from 'react'
2
+
3
+ import { cn } from '@/lib/utils'
4
+
5
+ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
6
+ ({ className, ...props }, ref) => (
7
+ <div
8
+ ref={ref}
9
+ className={cn('rounded-xl border bg-card text-card-foreground shadow-sm', className)}
10
+ {...props}
11
+ />
12
+ )
13
+ )
14
+ Card.displayName = 'Card'
15
+
16
+ const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
17
+ ({ className, ...props }, ref) => (
18
+ <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
19
+ )
20
+ )
21
+ CardHeader.displayName = 'CardHeader'
22
+
23
+ const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
24
+ ({ className, ...props }, ref) => (
25
+ <div
26
+ ref={ref}
27
+ className={cn('font-semibold leading-none tracking-tight', className)}
28
+ {...props}
29
+ />
30
+ )
31
+ )
32
+ CardTitle.displayName = 'CardTitle'
33
+
34
+ const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
35
+ ({ className, ...props }, ref) => (
36
+ <div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
37
+ )
38
+ )
39
+ CardDescription.displayName = 'CardDescription'
40
+
41
+ const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
42
+ ({ className, ...props }, ref) => (
43
+ <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
44
+ )
45
+ )
46
+ CardContent.displayName = 'CardContent'
47
+
48
+ const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
49
+ ({ className, ...props }, ref) => (
50
+ <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
51
+ )
52
+ )
53
+ CardFooter.displayName = 'CardFooter'
54
+
55
+ export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }
@@ -0,0 +1,26 @@
1
+ import * as React from 'react'
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
3
+ import { Check } from 'lucide-react'
4
+
5
+ import { cn } from '@/lib/utils'
6
+
7
+ const Checkbox = React.forwardRef<
8
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
9
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10
+ >(({ className, ...props }, ref) => (
11
+ <CheckboxPrimitive.Root
12
+ ref={ref}
13
+ className={cn(
14
+ 'peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
15
+ className
16
+ )}
17
+ {...props}
18
+ >
19
+ <CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
20
+ <Check className="h-4 w-4" />
21
+ </CheckboxPrimitive.Indicator>
22
+ </CheckboxPrimitive.Root>
23
+ ))
24
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName
25
+
26
+ export { Checkbox }
@@ -0,0 +1,99 @@
1
+ import * as React from 'react'
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog'
3
+ import { X } from 'lucide-react'
4
+
5
+ import { cn } from '@/lib/utils'
6
+
7
+ const Dialog = DialogPrimitive.Root
8
+ const DialogTrigger = DialogPrimitive.Trigger
9
+ const DialogPortal = DialogPrimitive.Portal
10
+ const DialogClose = DialogPrimitive.Close
11
+
12
+ const DialogOverlay = React.forwardRef<
13
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
14
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
15
+ >(({ className, ...props }, ref) => (
16
+ <DialogPrimitive.Overlay
17
+ ref={ref}
18
+ className={cn(
19
+ 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ ))
25
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
26
+
27
+ const DialogContent = React.forwardRef<
28
+ React.ElementRef<typeof DialogPrimitive.Content>,
29
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
30
+ >(({ className, children, ...props }, ref) => (
31
+ <DialogPortal>
32
+ <DialogOverlay />
33
+ <DialogPrimitive.Content
34
+ ref={ref}
35
+ className={cn(
36
+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
37
+ className
38
+ )}
39
+ {...props}
40
+ >
41
+ {children}
42
+ <DialogClose className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
43
+ <X className="h-4 w-4" />
44
+ <span className="sr-only">Close</span>
45
+ </DialogClose>
46
+ </DialogPrimitive.Content>
47
+ </DialogPortal>
48
+ ))
49
+ DialogContent.displayName = DialogPrimitive.Content.displayName
50
+
51
+ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
52
+ <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
53
+ )
54
+ DialogHeader.displayName = 'DialogHeader'
55
+
56
+ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
57
+ <div
58
+ className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
59
+ {...props}
60
+ />
61
+ )
62
+ DialogFooter.displayName = 'DialogFooter'
63
+
64
+ const DialogTitle = React.forwardRef<
65
+ React.ElementRef<typeof DialogPrimitive.Title>,
66
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
67
+ >(({ className, ...props }, ref) => (
68
+ <DialogPrimitive.Title
69
+ ref={ref}
70
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
71
+ {...props}
72
+ />
73
+ ))
74
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
75
+
76
+ const DialogDescription = React.forwardRef<
77
+ React.ElementRef<typeof DialogPrimitive.Description>,
78
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
79
+ >(({ className, ...props }, ref) => (
80
+ <DialogPrimitive.Description
81
+ ref={ref}
82
+ className={cn('text-sm text-muted-foreground', className)}
83
+ {...props}
84
+ />
85
+ ))
86
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
87
+
88
+ export {
89
+ Dialog,
90
+ DialogPortal,
91
+ DialogOverlay,
92
+ DialogClose,
93
+ DialogTrigger,
94
+ DialogContent,
95
+ DialogHeader,
96
+ DialogFooter,
97
+ DialogTitle,
98
+ DialogDescription,
99
+ }