create-mohit-next 0.0.0-stage → 2.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 (202) hide show
  1. package/README.md +139 -2
  2. package/index.js +399 -0
  3. package/lib/features.js +358 -0
  4. package/lib/scaffold.js +471 -0
  5. package/package.json +40 -4
  6. package/templates/common/_editorconfig +12 -0
  7. package/templates/common/_gitattributes +5 -0
  8. package/templates/common/_github/dependabot.yml +14 -0
  9. package/templates/common/_github/workflows/ci.yml +66 -0
  10. package/templates/common/_husky/commit-msg +1 -0
  11. package/templates/common/_husky/pre-commit +1 -0
  12. package/templates/common/_nvmrc +1 -0
  13. package/templates/common/_prettierignore +15 -0
  14. package/templates/common/commitlint.config.mjs +10 -0
  15. package/templates/next/AGENTS.md +9 -0
  16. package/templates/next/Dockerfile +48 -0
  17. package/templates/next/README.md +328 -0
  18. package/templates/next/_dockerignore +13 -0
  19. package/templates/next/_env.example +20 -0
  20. package/templates/next/_gitignore +50 -0
  21. package/templates/next/docker-compose.yml +33 -0
  22. package/templates/next/e2e/rbac.spec.ts +69 -0
  23. package/templates/next/e2e/server.mjs +35 -0
  24. package/templates/next/eslint.config.mjs +33 -0
  25. package/templates/next/next.config.ts +47 -0
  26. package/templates/next/package.json +68 -0
  27. package/templates/next/playwright.config.ts +30 -0
  28. package/templates/next/public/robots.txt +6 -0
  29. package/templates/next/scripts/seed.ts +111 -0
  30. package/templates/next/src/app/(app)/admin/audit/page.tsx +99 -0
  31. package/templates/next/src/app/(app)/admin/page.tsx +92 -0
  32. package/templates/next/src/app/(app)/dashboard/page.tsx +120 -0
  33. package/templates/next/src/app/(app)/error.tsx +28 -0
  34. package/templates/next/src/app/(app)/layout.tsx +58 -0
  35. package/templates/next/src/app/(app)/loading.tsx +5 -0
  36. package/templates/next/src/app/(app)/reports/page.tsx +128 -0
  37. package/templates/next/src/app/(app)/settings/page.tsx +66 -0
  38. package/templates/next/src/app/(auth)/forgot-password/page.tsx +17 -0
  39. package/templates/next/src/app/(auth)/layout.tsx +18 -0
  40. package/templates/next/src/app/(auth)/login/page.tsx +18 -0
  41. package/templates/next/src/app/(auth)/register/page.tsx +18 -0
  42. package/templates/next/src/app/(auth)/reset-password/page.tsx +18 -0
  43. package/templates/next/src/app/api/account/password/route.ts +45 -0
  44. package/templates/next/src/app/api/account/route.ts +25 -0
  45. package/templates/next/src/app/api/account/sessions/route.ts +12 -0
  46. package/templates/next/src/app/api/admin/audit/route.ts +13 -0
  47. package/templates/next/src/app/api/admin/users/[id]/route.ts +61 -0
  48. package/templates/next/src/app/api/admin/users/route.ts +18 -0
  49. package/templates/next/src/app/api/auth/forgot-password/route.ts +47 -0
  50. package/templates/next/src/app/api/auth/login/route.ts +43 -0
  51. package/templates/next/src/app/api/auth/logout/route.ts +21 -0
  52. package/templates/next/src/app/api/auth/me/route.ts +21 -0
  53. package/templates/next/src/app/api/auth/register/route.ts +74 -0
  54. package/templates/next/src/app/api/auth/resend-verification/route.ts +25 -0
  55. package/templates/next/src/app/api/auth/reset-password/route.ts +43 -0
  56. package/templates/next/src/app/api/auth/verify-email/route.ts +29 -0
  57. package/templates/next/src/app/api/health/route.ts +27 -0
  58. package/templates/next/src/app/favicon.ico +0 -0
  59. package/templates/next/src/app/forbidden/page.tsx +47 -0
  60. package/templates/next/src/app/layout.tsx +55 -0
  61. package/templates/next/src/app/not-found.tsx +20 -0
  62. package/templates/next/src/app/opengraph-image.tsx +49 -0
  63. package/templates/next/src/app/page.tsx +165 -0
  64. package/templates/next/src/app/robots.ts +15 -0
  65. package/templates/next/src/app/sitemap.ts +13 -0
  66. package/templates/next/src/app/verify-email/page.tsx +23 -0
  67. package/templates/next/src/components/admin/user-actions.tsx +124 -0
  68. package/templates/next/src/components/admin/users-data-table.tsx +221 -0
  69. package/templates/next/src/components/admin/users-table.tsx +67 -0
  70. package/templates/next/src/components/auth/auth-card.tsx +41 -0
  71. package/templates/next/src/components/auth/can.tsx +34 -0
  72. package/templates/next/src/components/auth/forgot-password-form.tsx +76 -0
  73. package/templates/next/src/components/auth/form-field.tsx +40 -0
  74. package/templates/next/src/components/auth/login-form.tsx +87 -0
  75. package/templates/next/src/components/auth/password-input.tsx +43 -0
  76. package/templates/next/src/components/auth/register-form.tsx +117 -0
  77. package/templates/next/src/components/auth/reset-password-form.tsx +80 -0
  78. package/templates/next/src/components/auth/session-refresher.tsx +44 -0
  79. package/templates/next/src/components/auth/verify-email-banner.tsx +43 -0
  80. package/templates/next/src/components/auth/verify-email-status.tsx +44 -0
  81. package/templates/next/src/components/layout/nav-links.tsx +37 -0
  82. package/templates/next/src/components/layout/navbar.tsx +27 -0
  83. package/templates/next/src/components/layout/page-header.tsx +21 -0
  84. package/templates/next/src/components/layout/sidebar.tsx +83 -0
  85. package/templates/next/src/components/layout/skeletons.tsx +57 -0
  86. package/templates/next/src/components/layout/user-menu.tsx +118 -0
  87. package/templates/next/src/components/logo.tsx +16 -0
  88. package/templates/next/src/components/motion/fade-in.tsx +19 -0
  89. package/templates/next/src/components/providers/user-provider.tsx +60 -0
  90. package/templates/next/src/components/reports/animated-bar.tsx +24 -0
  91. package/templates/next/src/components/reports/role-chart.tsx +61 -0
  92. package/templates/next/src/components/reports/signups-chart.tsx +64 -0
  93. package/templates/next/src/components/role-badge.tsx +11 -0
  94. package/templates/next/src/components/settings/password-form.tsx +80 -0
  95. package/templates/next/src/components/settings/profile-form.tsx +63 -0
  96. package/templates/next/src/components/settings/sessions-card.tsx +70 -0
  97. package/templates/next/src/components/theme-toggle.tsx +61 -0
  98. package/templates/next/src/config/rbac.test.ts +89 -0
  99. package/templates/next/src/config/rbac.ts +170 -0
  100. package/templates/next/src/config/site.ts +4 -0
  101. package/templates/next/src/lib/api.ts +179 -0
  102. package/templates/next/src/lib/audit.ts +66 -0
  103. package/templates/next/src/lib/auth.ts +50 -0
  104. package/templates/next/src/lib/dal.ts +63 -0
  105. package/templates/next/src/lib/db.ts +35 -0
  106. package/templates/next/src/lib/email-templates.ts +55 -0
  107. package/templates/next/src/lib/email.ts +53 -0
  108. package/templates/next/src/lib/env.ts +90 -0
  109. package/templates/next/src/lib/http.ts +57 -0
  110. package/templates/next/src/lib/password-strength.test.ts +20 -0
  111. package/templates/next/src/lib/password-strength.ts +24 -0
  112. package/templates/next/src/lib/rate-limit.test.ts +47 -0
  113. package/templates/next/src/lib/rate-limit.ts +70 -0
  114. package/templates/next/src/lib/redirect.test.ts +23 -0
  115. package/templates/next/src/lib/redirect.ts +21 -0
  116. package/templates/next/src/lib/session.ts +71 -0
  117. package/templates/next/src/lib/theme.ts +32 -0
  118. package/templates/next/src/lib/tokens.ts +63 -0
  119. package/templates/next/src/lib/users.ts +196 -0
  120. package/templates/next/src/lib/validations/account.ts +20 -0
  121. package/templates/next/src/lib/validations/auth.test.ts +39 -0
  122. package/templates/next/src/lib/validations/auth.ts +66 -0
  123. package/templates/next/src/lib/validations/user.ts +13 -0
  124. package/templates/next/src/models/audit-log.ts +33 -0
  125. package/templates/next/src/models/auth-token.ts +26 -0
  126. package/templates/next/src/models/user.ts +35 -0
  127. package/templates/next/src/proxy.ts +57 -0
  128. package/templates/next/src/styles/app.css +1092 -0
  129. package/templates/next/src/types/user.ts +13 -0
  130. package/templates/next/tsconfig.json +34 -0
  131. package/templates/next/vitest.config.mts +13 -0
  132. package/templates/styles/css.css +580 -0
  133. package/templates/styles/shadcn.css +142 -0
  134. package/templates/styles/tailwind.css +140 -0
  135. package/templates/ui/css/components/alert-dialog.tsx +172 -0
  136. package/templates/ui/css/components/avatar.tsx +17 -0
  137. package/templates/ui/css/components/badge.tsx +18 -0
  138. package/templates/ui/css/components/button.tsx +41 -0
  139. package/templates/ui/css/components/card.tsx +33 -0
  140. package/templates/ui/css/components/dropdown-menu.tsx +230 -0
  141. package/templates/ui/css/components/input.tsx +7 -0
  142. package/templates/ui/css/components/label.tsx +7 -0
  143. package/templates/ui/css/components/native-select.tsx +23 -0
  144. package/templates/ui/css/components/skeleton.tsx +7 -0
  145. package/templates/ui/css/components/slot.tsx +30 -0
  146. package/templates/ui/css/components/table.tsx +31 -0
  147. package/templates/ui/css/utils.ts +16 -0
  148. package/templates/ui/shadcn/components/alert-dialog.tsx +199 -0
  149. package/templates/ui/shadcn/components/avatar.tsx +111 -0
  150. package/templates/ui/shadcn/components/badge.tsx +44 -0
  151. package/templates/ui/shadcn/components/button.tsx +66 -0
  152. package/templates/ui/shadcn/components/card.tsx +87 -0
  153. package/templates/ui/shadcn/components/dropdown-menu.tsx +268 -0
  154. package/templates/ui/shadcn/components/input.tsx +18 -0
  155. package/templates/ui/shadcn/components/label.tsx +20 -0
  156. package/templates/ui/shadcn/components/native-select.tsx +54 -0
  157. package/templates/ui/shadcn/components/skeleton.tsx +13 -0
  158. package/templates/ui/shadcn/components/table.tsx +115 -0
  159. package/templates/ui/shadcn/utils.ts +1 -0
  160. package/templates/ui/tailwind/components/alert-dialog.tsx +177 -0
  161. package/templates/ui/tailwind/components/avatar.tsx +36 -0
  162. package/templates/ui/tailwind/components/badge.tsx +29 -0
  163. package/templates/ui/tailwind/components/button.tsx +65 -0
  164. package/templates/ui/tailwind/components/card.tsx +70 -0
  165. package/templates/ui/tailwind/components/dropdown-menu.tsx +236 -0
  166. package/templates/ui/tailwind/components/input.tsx +17 -0
  167. package/templates/ui/tailwind/components/label.tsx +16 -0
  168. package/templates/ui/tailwind/components/native-select.tsx +32 -0
  169. package/templates/ui/tailwind/components/skeleton.tsx +13 -0
  170. package/templates/ui/tailwind/components/slot.tsx +34 -0
  171. package/templates/ui/tailwind/components/table.tsx +56 -0
  172. package/templates/ui/tailwind/utils.ts +1 -0
  173. package/templates/vite/Dockerfile +29 -0
  174. package/templates/vite/README.md +142 -0
  175. package/templates/vite/_dockerignore +14 -0
  176. package/templates/vite/_env.example +8 -0
  177. package/templates/vite/_gitignore +37 -0
  178. package/templates/vite/e2e/app.spec.ts +41 -0
  179. package/templates/vite/index.html +32 -0
  180. package/templates/vite/nginx.conf +26 -0
  181. package/templates/vite/package.json +61 -0
  182. package/templates/vite/playwright.config.ts +27 -0
  183. package/templates/vite/public/favicon.svg +1 -0
  184. package/templates/vite/src/App.test.tsx +28 -0
  185. package/templates/vite/src/App.tsx +26 -0
  186. package/templates/vite/src/components/home.tsx +121 -0
  187. package/templates/vite/src/components/layout/root-layout.tsx +18 -0
  188. package/templates/vite/src/components/layout/site-footer.tsx +10 -0
  189. package/templates/vite/src/components/layout/site-header.tsx +49 -0
  190. package/templates/vite/src/components/theme-toggle.tsx +90 -0
  191. package/templates/vite/src/env.ts +36 -0
  192. package/templates/vite/src/lib/theme.ts +26 -0
  193. package/templates/vite/src/main.tsx +13 -0
  194. package/templates/vite/src/pages/about.tsx +52 -0
  195. package/templates/vite/src/pages/not-found.tsx +33 -0
  196. package/templates/vite/src/router.ts +24 -0
  197. package/templates/vite/src/styles/app.css +281 -0
  198. package/templates/vite/src/test/setup.ts +21 -0
  199. package/templates/vite/tsconfig.app.json +31 -0
  200. package/templates/vite/tsconfig.json +7 -0
  201. package/templates/vite/tsconfig.node.json +23 -0
  202. package/templates/vite/vite.config.ts +30 -0
@@ -0,0 +1,142 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+ @import "shadcn/tailwind.css";
4
+
5
+ @custom-variant dark (&:is(.dark *));
6
+
7
+ @theme inline {
8
+ --color-background: var(--background);
9
+ --color-foreground: var(--foreground);
10
+ --font-sans: var(--font-geist-sans);
11
+ --font-mono: var(--font-geist-mono);
12
+ --font-heading: var(--font-geist-sans);
13
+ --color-sidebar-ring: var(--sidebar-ring);
14
+ --color-sidebar-border: var(--sidebar-border);
15
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
16
+ --color-sidebar-accent: var(--sidebar-accent);
17
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
18
+ --color-sidebar-primary: var(--sidebar-primary);
19
+ --color-sidebar-foreground: var(--sidebar-foreground);
20
+ --color-sidebar: var(--sidebar);
21
+ --color-chart-5: var(--chart-5);
22
+ --color-chart-4: var(--chart-4);
23
+ --color-chart-3: var(--chart-3);
24
+ --color-chart-2: var(--chart-2);
25
+ --color-chart-1: var(--chart-1);
26
+ --color-ring: var(--ring);
27
+ --color-input: var(--input);
28
+ --color-border: var(--border);
29
+ --color-destructive: var(--destructive);
30
+ --color-accent-foreground: var(--accent-foreground);
31
+ --color-accent: var(--accent);
32
+ --color-muted-foreground: var(--muted-foreground);
33
+ --color-muted: var(--muted);
34
+ --color-secondary-foreground: var(--secondary-foreground);
35
+ --color-secondary: var(--secondary);
36
+ --color-primary-foreground: var(--primary-foreground);
37
+ --color-primary: var(--primary);
38
+ --color-popover-foreground: var(--popover-foreground);
39
+ --color-popover: var(--popover);
40
+ --color-card-foreground: var(--card-foreground);
41
+ --color-card: var(--card);
42
+ --radius-sm: calc(var(--radius) * 0.6);
43
+ --radius-md: calc(var(--radius) * 0.8);
44
+ --radius-lg: var(--radius);
45
+ --radius-xl: calc(var(--radius) * 1.4);
46
+ --radius-2xl: calc(var(--radius) * 1.8);
47
+ --radius-3xl: calc(var(--radius) * 2.2);
48
+ --radius-4xl: calc(var(--radius) * 2.6);
49
+ }
50
+
51
+ :root {
52
+ --background: oklch(1 0 0);
53
+ --foreground: oklch(0.145 0 0);
54
+ --card: oklch(1 0 0);
55
+ --card-foreground: oklch(0.145 0 0);
56
+ --popover: oklch(1 0 0);
57
+ --popover-foreground: oklch(0.145 0 0);
58
+ --primary: oklch(0.205 0 0);
59
+ --primary-foreground: oklch(0.985 0 0);
60
+ --secondary: oklch(0.97 0 0);
61
+ --secondary-foreground: oklch(0.205 0 0);
62
+ --muted: oklch(0.97 0 0);
63
+ --muted-foreground: oklch(0.556 0 0);
64
+ --accent: oklch(0.97 0 0);
65
+ --accent-foreground: oklch(0.205 0 0);
66
+ --destructive: oklch(0.577 0.245 27.325);
67
+ --border: oklch(0.922 0 0);
68
+ --input: oklch(0.922 0 0);
69
+ --ring: oklch(0.708 0 0);
70
+ --chart-1: oklch(0.87 0 0);
71
+ --chart-2: oklch(0.556 0 0);
72
+ --chart-3: oklch(0.439 0 0);
73
+ --chart-4: oklch(0.371 0 0);
74
+ --chart-5: oklch(0.269 0 0);
75
+ --radius: 0.625rem;
76
+ --sidebar: oklch(0.985 0 0);
77
+ --sidebar-foreground: oklch(0.145 0 0);
78
+ --sidebar-primary: oklch(0.205 0 0);
79
+ --sidebar-primary-foreground: oklch(0.985 0 0);
80
+ --sidebar-accent: oklch(0.97 0 0);
81
+ --sidebar-accent-foreground: oklch(0.205 0 0);
82
+ --sidebar-border: oklch(0.922 0 0);
83
+ --sidebar-ring: oklch(0.708 0 0);
84
+ }
85
+
86
+ .dark {
87
+ --background: oklch(0.145 0 0);
88
+ --foreground: oklch(0.985 0 0);
89
+ --card: oklch(0.205 0 0);
90
+ --card-foreground: oklch(0.985 0 0);
91
+ --popover: oklch(0.205 0 0);
92
+ --popover-foreground: oklch(0.985 0 0);
93
+ --primary: oklch(0.922 0 0);
94
+ --primary-foreground: oklch(0.205 0 0);
95
+ --secondary: oklch(0.269 0 0);
96
+ --secondary-foreground: oklch(0.985 0 0);
97
+ --muted: oklch(0.269 0 0);
98
+ --muted-foreground: oklch(0.708 0 0);
99
+ --accent: oklch(0.269 0 0);
100
+ --accent-foreground: oklch(0.985 0 0);
101
+ --destructive: oklch(0.704 0.191 22.216);
102
+ --border: oklch(1 0 0 / 10%);
103
+ --input: oklch(1 0 0 / 15%);
104
+ --ring: oklch(0.556 0 0);
105
+ --chart-1: oklch(0.87 0 0);
106
+ --chart-2: oklch(0.556 0 0);
107
+ --chart-3: oklch(0.439 0 0);
108
+ --chart-4: oklch(0.371 0 0);
109
+ --chart-5: oklch(0.269 0 0);
110
+ --sidebar: oklch(0.205 0 0);
111
+ --sidebar-foreground: oklch(0.985 0 0);
112
+ --sidebar-primary: oklch(0.488 0.243 264.376);
113
+ --sidebar-primary-foreground: oklch(0.985 0 0);
114
+ --sidebar-accent: oklch(0.269 0 0);
115
+ --sidebar-accent-foreground: oklch(0.985 0 0);
116
+ --sidebar-border: oklch(1 0 0 / 10%);
117
+ --sidebar-ring: oklch(0.556 0 0);
118
+ }
119
+
120
+ @layer base {
121
+ * {
122
+ @apply border-border outline-ring/50;
123
+ }
124
+ body {
125
+ @apply bg-background text-foreground;
126
+ }
127
+ html {
128
+ @apply font-sans;
129
+ }
130
+ }
131
+ @layer base {
132
+ html {
133
+ color-scheme: light;
134
+ }
135
+ html.dark {
136
+ color-scheme: dark;
137
+ }
138
+ button:not(:disabled),
139
+ [role="button"]:not(:disabled) {
140
+ cursor: pointer;
141
+ }
142
+ }
@@ -0,0 +1,140 @@
1
+ @import "tailwindcss";
2
+
3
+ @custom-variant dark (&:is(.dark *));
4
+
5
+ @theme inline {
6
+ --color-background: var(--background);
7
+ --color-foreground: var(--foreground);
8
+ --font-sans: var(--font-geist-sans);
9
+ --font-mono: var(--font-geist-mono);
10
+ --font-heading: var(--font-geist-sans);
11
+ --color-sidebar-ring: var(--sidebar-ring);
12
+ --color-sidebar-border: var(--sidebar-border);
13
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
+ --color-sidebar-accent: var(--sidebar-accent);
15
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
+ --color-sidebar-primary: var(--sidebar-primary);
17
+ --color-sidebar-foreground: var(--sidebar-foreground);
18
+ --color-sidebar: var(--sidebar);
19
+ --color-chart-5: var(--chart-5);
20
+ --color-chart-4: var(--chart-4);
21
+ --color-chart-3: var(--chart-3);
22
+ --color-chart-2: var(--chart-2);
23
+ --color-chart-1: var(--chart-1);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --radius-sm: calc(var(--radius) * 0.6);
41
+ --radius-md: calc(var(--radius) * 0.8);
42
+ --radius-lg: var(--radius);
43
+ --radius-xl: calc(var(--radius) * 1.4);
44
+ --radius-2xl: calc(var(--radius) * 1.8);
45
+ --radius-3xl: calc(var(--radius) * 2.2);
46
+ --radius-4xl: calc(var(--radius) * 2.6);
47
+ }
48
+
49
+ :root {
50
+ --background: oklch(1 0 0);
51
+ --foreground: oklch(0.145 0 0);
52
+ --card: oklch(1 0 0);
53
+ --card-foreground: oklch(0.145 0 0);
54
+ --popover: oklch(1 0 0);
55
+ --popover-foreground: oklch(0.145 0 0);
56
+ --primary: oklch(0.205 0 0);
57
+ --primary-foreground: oklch(0.985 0 0);
58
+ --secondary: oklch(0.97 0 0);
59
+ --secondary-foreground: oklch(0.205 0 0);
60
+ --muted: oklch(0.97 0 0);
61
+ --muted-foreground: oklch(0.556 0 0);
62
+ --accent: oklch(0.97 0 0);
63
+ --accent-foreground: oklch(0.205 0 0);
64
+ --destructive: oklch(0.577 0.245 27.325);
65
+ --border: oklch(0.922 0 0);
66
+ --input: oklch(0.922 0 0);
67
+ --ring: oklch(0.708 0 0);
68
+ --chart-1: oklch(0.87 0 0);
69
+ --chart-2: oklch(0.556 0 0);
70
+ --chart-3: oklch(0.439 0 0);
71
+ --chart-4: oklch(0.371 0 0);
72
+ --chart-5: oklch(0.269 0 0);
73
+ --radius: 0.625rem;
74
+ --sidebar: oklch(0.985 0 0);
75
+ --sidebar-foreground: oklch(0.145 0 0);
76
+ --sidebar-primary: oklch(0.205 0 0);
77
+ --sidebar-primary-foreground: oklch(0.985 0 0);
78
+ --sidebar-accent: oklch(0.97 0 0);
79
+ --sidebar-accent-foreground: oklch(0.205 0 0);
80
+ --sidebar-border: oklch(0.922 0 0);
81
+ --sidebar-ring: oklch(0.708 0 0);
82
+ }
83
+
84
+ .dark {
85
+ --background: oklch(0.145 0 0);
86
+ --foreground: oklch(0.985 0 0);
87
+ --card: oklch(0.205 0 0);
88
+ --card-foreground: oklch(0.985 0 0);
89
+ --popover: oklch(0.205 0 0);
90
+ --popover-foreground: oklch(0.985 0 0);
91
+ --primary: oklch(0.922 0 0);
92
+ --primary-foreground: oklch(0.205 0 0);
93
+ --secondary: oklch(0.269 0 0);
94
+ --secondary-foreground: oklch(0.985 0 0);
95
+ --muted: oklch(0.269 0 0);
96
+ --muted-foreground: oklch(0.708 0 0);
97
+ --accent: oklch(0.269 0 0);
98
+ --accent-foreground: oklch(0.985 0 0);
99
+ --destructive: oklch(0.704 0.191 22.216);
100
+ --border: oklch(1 0 0 / 10%);
101
+ --input: oklch(1 0 0 / 15%);
102
+ --ring: oklch(0.556 0 0);
103
+ --chart-1: oklch(0.87 0 0);
104
+ --chart-2: oklch(0.556 0 0);
105
+ --chart-3: oklch(0.439 0 0);
106
+ --chart-4: oklch(0.371 0 0);
107
+ --chart-5: oklch(0.269 0 0);
108
+ --sidebar: oklch(0.205 0 0);
109
+ --sidebar-foreground: oklch(0.985 0 0);
110
+ --sidebar-primary: oklch(0.488 0.243 264.376);
111
+ --sidebar-primary-foreground: oklch(0.985 0 0);
112
+ --sidebar-accent: oklch(0.269 0 0);
113
+ --sidebar-accent-foreground: oklch(0.985 0 0);
114
+ --sidebar-border: oklch(1 0 0 / 10%);
115
+ --sidebar-ring: oklch(0.556 0 0);
116
+ }
117
+
118
+ @layer base {
119
+ * {
120
+ @apply border-border outline-ring/50;
121
+ }
122
+ body {
123
+ @apply bg-background text-foreground;
124
+ }
125
+ html {
126
+ @apply font-sans;
127
+ }
128
+ }
129
+ @layer base {
130
+ html {
131
+ color-scheme: light;
132
+ }
133
+ html.dark {
134
+ color-scheme: dark;
135
+ }
136
+ button:not(:disabled),
137
+ [role="button"]:not(:disabled) {
138
+ cursor: pointer;
139
+ }
140
+ }
@@ -0,0 +1,172 @@
1
+ "use client";
2
+
3
+ import {
4
+ createContext,
5
+ use,
6
+ useCallback,
7
+ useEffect,
8
+ useId,
9
+ useMemo,
10
+ useRef,
11
+ useState,
12
+ type ComponentProps,
13
+ type MouseEvent,
14
+ type ReactNode,
15
+ } from "react";
16
+
17
+ import { Button, type ButtonSize, type ButtonVariant } from "@/components/ui/button";
18
+ import { Slot } from "@/components/ui/slot";
19
+ import { cn } from "@/lib/utils";
20
+
21
+ const classes = {
22
+ content: "dialog",
23
+ inner: "dialog-inner",
24
+ header: "dialog-header",
25
+ footer: "dialog-footer",
26
+ title: "dialog-title",
27
+ description: "dialog-description",
28
+ };
29
+
30
+ type DialogContextValue = {
31
+ open: boolean;
32
+ setOpen: (open: boolean) => void;
33
+ titleId: string;
34
+ descriptionId: string;
35
+ };
36
+
37
+ const DialogContext = createContext<DialogContextValue | null>(null);
38
+
39
+ function useDialog() {
40
+ const ctx = use(DialogContext);
41
+ if (!ctx) throw new Error("AlertDialog parts must be used inside <AlertDialog>");
42
+ return ctx;
43
+ }
44
+
45
+ /** A confirmation dialog built on the native <dialog> element (same API as shadcn/ui's). */
46
+ export function AlertDialog({
47
+ children,
48
+ open: openProp,
49
+ onOpenChange,
50
+ }: {
51
+ children: ReactNode;
52
+ open?: boolean;
53
+ onOpenChange?: (open: boolean) => void;
54
+ }) {
55
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
56
+ const open = openProp ?? uncontrolledOpen;
57
+ const setOpen = useCallback(
58
+ (next: boolean) => {
59
+ setUncontrolledOpen(next);
60
+ onOpenChange?.(next);
61
+ },
62
+ [onOpenChange],
63
+ );
64
+ const titleId = useId();
65
+ const descriptionId = useId();
66
+ const value = useMemo(
67
+ () => ({ open, setOpen, titleId, descriptionId }),
68
+ [open, setOpen, titleId, descriptionId],
69
+ );
70
+ return <DialogContext value={value}>{children}</DialogContext>;
71
+ }
72
+
73
+ export function AlertDialogTrigger({
74
+ asChild = false,
75
+ ...props
76
+ }: ComponentProps<"button"> & { asChild?: boolean }) {
77
+ const { setOpen } = useDialog();
78
+ const Comp = asChild ? Slot : "button";
79
+ return (
80
+ <Comp
81
+ type={asChild ? undefined : "button"}
82
+ aria-haspopup="dialog"
83
+ {...props}
84
+ onClick={() => setOpen(true)}
85
+ />
86
+ );
87
+ }
88
+
89
+ export function AlertDialogContent({ className, children, ...props }: ComponentProps<"dialog">) {
90
+ const { open, setOpen, titleId, descriptionId } = useDialog();
91
+ const ref = useRef<HTMLDialogElement>(null);
92
+
93
+ useEffect(() => {
94
+ const dialog = ref.current;
95
+ if (!dialog) return;
96
+ if (open && !dialog.open) dialog.showModal();
97
+ if (!open && dialog.open) dialog.close();
98
+ }, [open]);
99
+
100
+ return (
101
+ <dialog
102
+ ref={ref}
103
+ role="alertdialog"
104
+ aria-labelledby={titleId}
105
+ aria-describedby={descriptionId}
106
+ data-slot="alert-dialog-content"
107
+ className={cn(classes.content, className)}
108
+ // Escape: close through state so the parent stays in sync.
109
+ onCancel={(e) => {
110
+ e.preventDefault();
111
+ setOpen(false);
112
+ }}
113
+ onClose={() => open && setOpen(false)}
114
+ {...props}
115
+ >
116
+ {open && <div className={classes.inner}>{children}</div>}
117
+ </dialog>
118
+ );
119
+ }
120
+
121
+ export function AlertDialogHeader({ className, ...props }: ComponentProps<"div">) {
122
+ return <div data-slot="alert-dialog-header" className={cn(classes.header, className)} {...props} />;
123
+ }
124
+
125
+ export function AlertDialogFooter({ className, ...props }: ComponentProps<"div">) {
126
+ return <div data-slot="alert-dialog-footer" className={cn(classes.footer, className)} {...props} />;
127
+ }
128
+
129
+ export function AlertDialogTitle({ className, ...props }: ComponentProps<"h2">) {
130
+ const { titleId } = useDialog();
131
+ return <h2 id={titleId} className={cn(classes.title, className)} {...props} />;
132
+ }
133
+
134
+ export function AlertDialogDescription({ className, ...props }: ComponentProps<"p">) {
135
+ const { descriptionId } = useDialog();
136
+ return <p id={descriptionId} className={cn(classes.description, className)} {...props} />;
137
+ }
138
+
139
+ type ActionProps = Omit<ComponentProps<"button">, "onClick"> & {
140
+ variant?: ButtonVariant;
141
+ size?: ButtonSize;
142
+ /** Call event.preventDefault() to keep the dialog open (e.g. while a request runs). */
143
+ onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
144
+ };
145
+
146
+ export function AlertDialogAction({ variant = "default", onClick, ...props }: ActionProps) {
147
+ const { setOpen } = useDialog();
148
+ return (
149
+ <Button
150
+ variant={variant}
151
+ onClick={(e) => {
152
+ onClick?.(e);
153
+ if (!e.defaultPrevented) setOpen(false);
154
+ }}
155
+ {...props}
156
+ />
157
+ );
158
+ }
159
+
160
+ export function AlertDialogCancel({ variant = "outline", onClick, ...props }: ActionProps) {
161
+ const { setOpen } = useDialog();
162
+ return (
163
+ <Button
164
+ variant={variant}
165
+ onClick={(e) => {
166
+ onClick?.(e);
167
+ setOpen(false);
168
+ }}
169
+ {...props}
170
+ />
171
+ );
172
+ }
@@ -0,0 +1,17 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ export function Avatar({
6
+ className,
7
+ size = "default",
8
+ ...props
9
+ }: ComponentProps<"span"> & { size?: "sm" | "default" | "lg" }) {
10
+ return (
11
+ <span data-slot="avatar" className={cn("avatar", `avatar--${size}`, className)} {...props} />
12
+ );
13
+ }
14
+
15
+ export function AvatarFallback({ className, ...props }: ComponentProps<"span">) {
16
+ return <span data-slot="avatar-fallback" className={cn("avatar-fallback", className)} {...props} />;
17
+ }
@@ -0,0 +1,18 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ export function Badge({
6
+ className,
7
+ variant = "default",
8
+ ...props
9
+ }: ComponentProps<"span"> & { variant?: "default" | "secondary" | "destructive" | "outline" }) {
10
+ return (
11
+ <span
12
+ data-slot="badge"
13
+ data-variant={variant}
14
+ className={cn("badge", `badge--${variant}`, className)}
15
+ {...props}
16
+ />
17
+ );
18
+ }
@@ -0,0 +1,41 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { Slot } from "@/components/ui/slot";
4
+ import { cn } from "@/lib/utils";
5
+
6
+ export type ButtonVariant = "default" | "outline" | "secondary" | "ghost" | "destructive" | "link";
7
+ export type ButtonSize = "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg";
8
+
9
+ /** Class names for a button look (styles live in src/app/globals.css or src/index.css). */
10
+ export function buttonVariants({
11
+ variant = "default",
12
+ size = "default",
13
+ className,
14
+ }: { variant?: ButtonVariant; size?: ButtonSize; className?: string } = {}) {
15
+ return cn("btn", `btn--${variant}`, `btn--size-${size}`, className);
16
+ }
17
+
18
+ export type ButtonProps = ComponentProps<"button"> & {
19
+ variant?: ButtonVariant;
20
+ size?: ButtonSize;
21
+ /** Render the child element (e.g. a <Link>) with button styles instead of a <button>. */
22
+ asChild?: boolean;
23
+ };
24
+
25
+ export function Button({
26
+ variant = "default",
27
+ size = "default",
28
+ asChild = false,
29
+ className,
30
+ ...props
31
+ }: ButtonProps) {
32
+ const Comp = asChild ? Slot : "button";
33
+ return (
34
+ <Comp
35
+ data-slot="button"
36
+ data-variant={variant}
37
+ className={buttonVariants({ variant, size, className })}
38
+ {...props}
39
+ />
40
+ );
41
+ }
@@ -0,0 +1,33 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ export function Card({ className, ...props }: ComponentProps<"div">) {
6
+ return <div data-slot="card" className={cn("card", className)} {...props} />;
7
+ }
8
+
9
+ export function CardHeader({ className, ...props }: ComponentProps<"div">) {
10
+ return <div data-slot="card-header" className={cn("card-header", className)} {...props} />;
11
+ }
12
+
13
+ export function CardTitle({ className, ...props }: ComponentProps<"div">) {
14
+ return <div data-slot="card-title" className={cn("card-title", className)} {...props} />;
15
+ }
16
+
17
+ export function CardDescription({ className, ...props }: ComponentProps<"div">) {
18
+ return (
19
+ <div data-slot="card-description" className={cn("card-description", className)} {...props} />
20
+ );
21
+ }
22
+
23
+ export function CardAction({ className, ...props }: ComponentProps<"div">) {
24
+ return <div data-slot="card-action" className={cn("card-action", className)} {...props} />;
25
+ }
26
+
27
+ export function CardContent({ className, ...props }: ComponentProps<"div">) {
28
+ return <div data-slot="card-content" className={cn("card-content", className)} {...props} />;
29
+ }
30
+
31
+ export function CardFooter({ className, ...props }: ComponentProps<"div">) {
32
+ return <div data-slot="card-footer" className={cn("card-footer", className)} {...props} />;
33
+ }