create-mohit-next 1.0.0 → 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 (220) hide show
  1. package/README.md +96 -65
  2. package/index.js +195 -195
  3. package/lib/features.js +358 -0
  4. package/lib/scaffold.js +471 -0
  5. package/package.json +10 -6
  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/{template → templates/common}/_prettierignore +4 -0
  14. package/templates/common/commitlint.config.mjs +10 -0
  15. package/templates/next/README.md +328 -0
  16. package/{template → templates/next}/_env.example +10 -1
  17. package/{template → templates/next}/_gitignore +8 -0
  18. package/templates/next/e2e/rbac.spec.ts +69 -0
  19. package/templates/next/e2e/server.mjs +35 -0
  20. package/{template → templates/next}/eslint.config.mjs +12 -0
  21. package/{template → templates/next}/next.config.ts +2 -0
  22. package/{template → templates/next}/package.json +18 -3
  23. package/templates/next/playwright.config.ts +30 -0
  24. package/templates/next/scripts/seed.ts +111 -0
  25. package/templates/next/src/app/(app)/admin/audit/page.tsx +99 -0
  26. package/templates/next/src/app/(app)/admin/page.tsx +92 -0
  27. package/{template → templates/next}/src/app/(app)/dashboard/page.tsx +22 -29
  28. package/{template → templates/next}/src/app/(app)/error.tsx +7 -7
  29. package/{template → templates/next}/src/app/(app)/layout.tsx +25 -2
  30. package/templates/next/src/app/(app)/reports/page.tsx +128 -0
  31. package/templates/next/src/app/(app)/settings/page.tsx +66 -0
  32. package/templates/next/src/app/(auth)/forgot-password/page.tsx +17 -0
  33. package/templates/next/src/app/(auth)/layout.tsx +18 -0
  34. package/{template → templates/next}/src/app/(auth)/register/page.tsx +2 -4
  35. package/templates/next/src/app/(auth)/reset-password/page.tsx +18 -0
  36. package/templates/next/src/app/api/account/password/route.ts +45 -0
  37. package/templates/next/src/app/api/account/route.ts +25 -0
  38. package/templates/next/src/app/api/account/sessions/route.ts +12 -0
  39. package/templates/next/src/app/api/admin/audit/route.ts +13 -0
  40. package/{template → templates/next}/src/app/api/admin/users/[id]/route.ts +25 -4
  41. package/templates/next/src/app/api/auth/forgot-password/route.ts +47 -0
  42. package/{template → templates/next}/src/app/api/auth/login/route.ts +19 -2
  43. package/{template → templates/next}/src/app/api/auth/me/route.ts +4 -2
  44. package/{template → templates/next}/src/app/api/auth/register/route.ts +38 -4
  45. package/templates/next/src/app/api/auth/resend-verification/route.ts +25 -0
  46. package/templates/next/src/app/api/auth/reset-password/route.ts +43 -0
  47. package/templates/next/src/app/api/auth/verify-email/route.ts +29 -0
  48. package/{template → templates/next}/src/app/forbidden/page.tsx +11 -13
  49. package/{template → templates/next}/src/app/layout.tsx +9 -6
  50. package/templates/next/src/app/not-found.tsx +20 -0
  51. package/templates/next/src/app/opengraph-image.tsx +49 -0
  52. package/templates/next/src/app/page.tsx +165 -0
  53. package/templates/next/src/app/robots.ts +15 -0
  54. package/templates/next/src/app/sitemap.ts +13 -0
  55. package/templates/next/src/app/verify-email/page.tsx +23 -0
  56. package/templates/next/src/components/admin/user-actions.tsx +124 -0
  57. package/templates/next/src/components/admin/users-data-table.tsx +221 -0
  58. package/templates/next/src/components/admin/users-table.tsx +67 -0
  59. package/{template → templates/next}/src/components/auth/auth-card.tsx +8 -8
  60. package/templates/next/src/components/auth/forgot-password-form.tsx +76 -0
  61. package/templates/next/src/components/auth/form-field.tsx +40 -0
  62. package/{template → templates/next}/src/components/auth/login-form.tsx +14 -9
  63. package/templates/next/src/components/auth/password-input.tsx +43 -0
  64. package/{template → templates/next}/src/components/auth/register-form.tsx +22 -19
  65. package/templates/next/src/components/auth/reset-password-form.tsx +80 -0
  66. package/{template → templates/next}/src/components/auth/session-refresher.tsx +1 -1
  67. package/templates/next/src/components/auth/verify-email-banner.tsx +43 -0
  68. package/templates/next/src/components/auth/verify-email-status.tsx +44 -0
  69. package/templates/next/src/components/layout/nav-links.tsx +37 -0
  70. package/templates/next/src/components/layout/navbar.tsx +27 -0
  71. package/templates/next/src/components/layout/page-header.tsx +21 -0
  72. package/templates/next/src/components/layout/sidebar.tsx +83 -0
  73. package/templates/next/src/components/layout/skeletons.tsx +57 -0
  74. package/templates/next/src/components/layout/user-menu.tsx +118 -0
  75. package/{template → templates/next}/src/components/logo.tsx +3 -6
  76. package/{template → templates/next}/src/components/reports/animated-bar.tsx +1 -5
  77. package/templates/next/src/components/reports/role-chart.tsx +61 -0
  78. package/templates/next/src/components/reports/signups-chart.tsx +64 -0
  79. package/templates/next/src/components/role-badge.tsx +11 -0
  80. package/templates/next/src/components/settings/password-form.tsx +80 -0
  81. package/templates/next/src/components/settings/profile-form.tsx +63 -0
  82. package/templates/next/src/components/settings/sessions-card.tsx +70 -0
  83. package/templates/next/src/components/theme-toggle.tsx +61 -0
  84. package/templates/next/src/config/rbac.test.ts +89 -0
  85. package/{template → templates/next}/src/config/rbac.ts +35 -5
  86. package/{template → templates/next}/src/lib/api.ts +40 -4
  87. package/templates/next/src/lib/audit.ts +66 -0
  88. package/{template → templates/next}/src/lib/auth.ts +10 -2
  89. package/{template → templates/next}/src/lib/dal.ts +8 -5
  90. package/templates/next/src/lib/email-templates.ts +55 -0
  91. package/templates/next/src/lib/email.ts +53 -0
  92. package/templates/next/src/lib/env.ts +90 -0
  93. package/templates/next/src/lib/password-strength.test.ts +20 -0
  94. package/templates/next/src/lib/password-strength.ts +24 -0
  95. package/templates/next/src/lib/rate-limit.test.ts +47 -0
  96. package/templates/next/src/lib/rate-limit.ts +70 -0
  97. package/templates/next/src/lib/redirect.test.ts +23 -0
  98. package/{template → templates/next}/src/lib/session.ts +5 -1
  99. package/templates/next/src/lib/theme.ts +32 -0
  100. package/templates/next/src/lib/tokens.ts +63 -0
  101. package/{template → templates/next}/src/lib/users.ts +49 -12
  102. package/templates/next/src/lib/validations/account.ts +20 -0
  103. package/templates/next/src/lib/validations/auth.test.ts +39 -0
  104. package/{template → templates/next}/src/lib/validations/auth.ts +24 -2
  105. package/templates/next/src/models/audit-log.ts +33 -0
  106. package/templates/next/src/models/auth-token.ts +26 -0
  107. package/{template → templates/next}/src/models/user.ts +5 -0
  108. package/{template → templates/next}/src/proxy.ts +1 -1
  109. package/templates/next/src/styles/app.css +1092 -0
  110. package/{template → templates/next}/src/types/user.ts +3 -0
  111. package/templates/next/vitest.config.mts +13 -0
  112. package/templates/styles/css.css +580 -0
  113. package/templates/styles/tailwind.css +140 -0
  114. package/templates/ui/css/components/alert-dialog.tsx +172 -0
  115. package/templates/ui/css/components/avatar.tsx +17 -0
  116. package/templates/ui/css/components/badge.tsx +18 -0
  117. package/templates/ui/css/components/button.tsx +41 -0
  118. package/templates/ui/css/components/card.tsx +33 -0
  119. package/templates/ui/css/components/dropdown-menu.tsx +230 -0
  120. package/templates/ui/css/components/input.tsx +7 -0
  121. package/templates/ui/css/components/label.tsx +7 -0
  122. package/templates/ui/css/components/native-select.tsx +23 -0
  123. package/templates/ui/css/components/skeleton.tsx +7 -0
  124. package/templates/ui/css/components/slot.tsx +30 -0
  125. package/templates/ui/css/components/table.tsx +31 -0
  126. package/templates/ui/css/utils.ts +16 -0
  127. package/templates/ui/shadcn/components/alert-dialog.tsx +199 -0
  128. package/templates/ui/shadcn/components/avatar.tsx +111 -0
  129. package/templates/ui/shadcn/components/dropdown-menu.tsx +268 -0
  130. package/templates/ui/shadcn/components/table.tsx +115 -0
  131. package/templates/ui/tailwind/components/alert-dialog.tsx +177 -0
  132. package/templates/ui/tailwind/components/avatar.tsx +36 -0
  133. package/templates/ui/tailwind/components/badge.tsx +29 -0
  134. package/templates/ui/tailwind/components/button.tsx +65 -0
  135. package/templates/ui/tailwind/components/card.tsx +70 -0
  136. package/templates/ui/tailwind/components/dropdown-menu.tsx +236 -0
  137. package/templates/ui/tailwind/components/input.tsx +17 -0
  138. package/templates/ui/tailwind/components/label.tsx +16 -0
  139. package/templates/ui/tailwind/components/native-select.tsx +32 -0
  140. package/templates/ui/tailwind/components/skeleton.tsx +13 -0
  141. package/templates/ui/tailwind/components/slot.tsx +34 -0
  142. package/templates/ui/tailwind/components/table.tsx +56 -0
  143. package/templates/ui/tailwind/utils.ts +1 -0
  144. package/templates/vite/Dockerfile +29 -0
  145. package/templates/vite/README.md +142 -0
  146. package/templates/vite/_dockerignore +14 -0
  147. package/templates/vite/_env.example +8 -0
  148. package/templates/vite/_gitignore +37 -0
  149. package/templates/vite/e2e/app.spec.ts +41 -0
  150. package/templates/vite/index.html +32 -0
  151. package/templates/vite/nginx.conf +26 -0
  152. package/templates/vite/package.json +61 -0
  153. package/templates/vite/playwright.config.ts +27 -0
  154. package/templates/vite/public/favicon.svg +1 -0
  155. package/templates/vite/src/App.test.tsx +28 -0
  156. package/templates/vite/src/App.tsx +26 -0
  157. package/templates/vite/src/components/home.tsx +121 -0
  158. package/templates/vite/src/components/layout/root-layout.tsx +18 -0
  159. package/templates/vite/src/components/layout/site-footer.tsx +10 -0
  160. package/templates/vite/src/components/layout/site-header.tsx +49 -0
  161. package/templates/vite/src/components/theme-toggle.tsx +90 -0
  162. package/templates/vite/src/env.ts +36 -0
  163. package/templates/vite/src/lib/theme.ts +26 -0
  164. package/templates/vite/src/main.tsx +13 -0
  165. package/templates/vite/src/pages/about.tsx +52 -0
  166. package/templates/vite/src/pages/not-found.tsx +33 -0
  167. package/templates/vite/src/router.ts +24 -0
  168. package/templates/vite/src/styles/app.css +281 -0
  169. package/templates/vite/src/test/setup.ts +21 -0
  170. package/templates/vite/tsconfig.app.json +31 -0
  171. package/templates/vite/tsconfig.json +7 -0
  172. package/templates/vite/tsconfig.node.json +23 -0
  173. package/templates/vite/vite.config.ts +30 -0
  174. package/template/README.md +0 -262
  175. package/template/_prettierrc +0 -9
  176. package/template/components.json +0 -25
  177. package/template/src/app/(app)/admin/page.tsx +0 -53
  178. package/template/src/app/(app)/reports/page.tsx +0 -109
  179. package/template/src/app/(auth)/layout.tsx +0 -22
  180. package/template/src/app/not-found.tsx +0 -18
  181. package/template/src/app/page.tsx +0 -187
  182. package/template/src/components/admin/users-table.tsx +0 -162
  183. package/template/src/components/auth/form-field.tsx +0 -32
  184. package/template/src/components/layout/logout-button.tsx +0 -34
  185. package/template/src/components/layout/navbar.tsx +0 -67
  186. package/template/src/components/layout/page-header.tsx +0 -21
  187. package/template/src/components/layout/skeletons.tsx +0 -35
  188. package/template/src/components/role-badge.tsx +0 -17
  189. package/template/src/components/theme-toggle.tsx +0 -25
  190. package/template/src/lib/env.ts +0 -36
  191. package/template/src/lib/theme.ts +0 -8
  192. /package/{template → templates/next}/AGENTS.md +0 -0
  193. /package/{template → templates/next}/Dockerfile +0 -0
  194. /package/{template → templates/next}/_dockerignore +0 -0
  195. /package/{template → templates/next}/docker-compose.yml +0 -0
  196. /package/{template → templates/next}/public/robots.txt +0 -0
  197. /package/{template → templates/next}/src/app/(app)/loading.tsx +0 -0
  198. /package/{template → templates/next}/src/app/(auth)/login/page.tsx +0 -0
  199. /package/{template → templates/next}/src/app/api/admin/users/route.ts +0 -0
  200. /package/{template → templates/next}/src/app/api/auth/logout/route.ts +0 -0
  201. /package/{template → templates/next}/src/app/api/health/route.ts +0 -0
  202. /package/{template → templates/next}/src/app/favicon.ico +0 -0
  203. /package/{template → templates/next}/src/components/auth/can.tsx +0 -0
  204. /package/{template → templates/next}/src/components/motion/fade-in.tsx +0 -0
  205. /package/{template → templates/next}/src/components/providers/user-provider.tsx +0 -0
  206. /package/{template → templates/next}/src/config/site.ts +0 -0
  207. /package/{template → templates/next}/src/lib/db.ts +0 -0
  208. /package/{template → templates/next}/src/lib/http.ts +0 -0
  209. /package/{template → templates/next}/src/lib/redirect.ts +0 -0
  210. /package/{template → templates/next}/src/lib/validations/user.ts +0 -0
  211. /package/{template → templates/next}/tsconfig.json +0 -0
  212. /package/{template/src/app/globals.css → templates/styles/shadcn.css} +0 -0
  213. /package/{template/src/components/ui → templates/ui/shadcn/components}/badge.tsx +0 -0
  214. /package/{template/src/components/ui → templates/ui/shadcn/components}/button.tsx +0 -0
  215. /package/{template/src/components/ui → templates/ui/shadcn/components}/card.tsx +0 -0
  216. /package/{template/src/components/ui → templates/ui/shadcn/components}/input.tsx +0 -0
  217. /package/{template/src/components/ui → templates/ui/shadcn/components}/label.tsx +0 -0
  218. /package/{template/src/components/ui → templates/ui/shadcn/components}/native-select.tsx +0 -0
  219. /package/{template/src/components/ui → templates/ui/shadcn/components}/skeleton.tsx +0 -0
  220. /package/{template/src/lib → templates/ui/shadcn}/utils.ts +0 -0
@@ -0,0 +1,7 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ export function Skeleton({ className, ...props }: ComponentProps<"div">) {
6
+ return <div data-slot="skeleton" className={cn("skeleton", className)} {...props} />;
7
+ }
@@ -0,0 +1,30 @@
1
+ import { cloneElement, isValidElement, type ReactElement, type ReactNode } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ type AnyProps = Record<string, unknown>;
6
+
7
+ /**
8
+ * Renders its only child, merging the given props into it (like Radix's Slot).
9
+ * Used for `asChild`: <Button asChild><Link href="/">Home</Link></Button>.
10
+ */
11
+ export function Slot({ children, ...props }: AnyProps & { children?: ReactNode }) {
12
+ if (!isValidElement(children)) return null;
13
+ const child = children as ReactElement<AnyProps>;
14
+ const childProps = child.props;
15
+ const merged: AnyProps = { ...props, ...childProps };
16
+
17
+ // Compose event handlers so both the slot's and the child's run.
18
+ for (const key of Object.keys(props)) {
19
+ const slotHandler = props[key];
20
+ const childHandler = childProps[key];
21
+ if (/^on[A-Z]/.test(key) && typeof slotHandler === "function" && typeof childHandler === "function") {
22
+ merged[key] = (...args: unknown[]) => {
23
+ childHandler(...args);
24
+ slotHandler(...args);
25
+ };
26
+ }
27
+ }
28
+ merged.className = cn(props.className as string, childProps.className as string);
29
+ return cloneElement(child, merged);
30
+ }
@@ -0,0 +1,31 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ export function Table({ className, ...props }: ComponentProps<"table">) {
6
+ return (
7
+ <div data-slot="table-container" className="table-container">
8
+ <table data-slot="table" className={cn("table", className)} {...props} />
9
+ </div>
10
+ );
11
+ }
12
+
13
+ export function TableHeader(props: ComponentProps<"thead">) {
14
+ return <thead data-slot="table-header" {...props} />;
15
+ }
16
+
17
+ export function TableBody(props: ComponentProps<"tbody">) {
18
+ return <tbody data-slot="table-body" {...props} />;
19
+ }
20
+
21
+ export function TableRow(props: ComponentProps<"tr">) {
22
+ return <tr data-slot="table-row" {...props} />;
23
+ }
24
+
25
+ export function TableHead(props: ComponentProps<"th">) {
26
+ return <th data-slot="table-head" {...props} />;
27
+ }
28
+
29
+ export function TableCell(props: ComponentProps<"td">) {
30
+ return <td data-slot="table-cell" {...props} />;
31
+ }
@@ -0,0 +1,16 @@
1
+ type ClassValue = string | number | false | null | undefined | ClassValue[];
2
+
3
+ /** Joins class names, skipping falsy values (a tiny clsx). */
4
+ export function cn(...values: ClassValue[]): string {
5
+ const out: string[] = [];
6
+ for (const value of values) {
7
+ if (!value) continue;
8
+ if (Array.isArray(value)) {
9
+ const nested = cn(...value);
10
+ if (nested) out.push(nested);
11
+ } else {
12
+ out.push(String(value));
13
+ }
14
+ }
15
+ return out.join(" ");
16
+ }
@@ -0,0 +1,199 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "@/lib/utils"
5
+ import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
6
+
7
+ import { Button } from "@/components/ui/button"
8
+
9
+ function AlertDialog({
10
+ ...props
11
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
13
+ }
14
+
15
+ function AlertDialogTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
+ return (
19
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
+ )
21
+ }
22
+
23
+ function AlertDialogPortal({
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
+ return (
27
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
+ )
29
+ }
30
+
31
+ function AlertDialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
+ return (
36
+ <AlertDialogPrimitive.Overlay
37
+ data-slot="alert-dialog-overlay"
38
+ className={cn(
39
+ "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function AlertDialogContent({
48
+ className,
49
+ size = "default",
50
+ ...props
51
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
52
+ size?: "default" | "sm"
53
+ }) {
54
+ return (
55
+ <AlertDialogPortal>
56
+ <AlertDialogOverlay />
57
+ <AlertDialogPrimitive.Content
58
+ data-slot="alert-dialog-content"
59
+ data-size={size}
60
+ className={cn(
61
+ "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ </AlertDialogPortal>
67
+ )
68
+ }
69
+
70
+ function AlertDialogHeader({
71
+ className,
72
+ ...props
73
+ }: React.ComponentProps<"div">) {
74
+ return (
75
+ <div
76
+ data-slot="alert-dialog-header"
77
+ className={cn(
78
+ "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ )
84
+ }
85
+
86
+ function AlertDialogFooter({
87
+ className,
88
+ ...props
89
+ }: React.ComponentProps<"div">) {
90
+ return (
91
+ <div
92
+ data-slot="alert-dialog-footer"
93
+ className={cn(
94
+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ )
100
+ }
101
+
102
+ function AlertDialogMedia({
103
+ className,
104
+ ...props
105
+ }: React.ComponentProps<"div">) {
106
+ return (
107
+ <div
108
+ data-slot="alert-dialog-media"
109
+ className={cn(
110
+ "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
111
+ className
112
+ )}
113
+ {...props}
114
+ />
115
+ )
116
+ }
117
+
118
+ function AlertDialogTitle({
119
+ className,
120
+ ...props
121
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
122
+ return (
123
+ <AlertDialogPrimitive.Title
124
+ data-slot="alert-dialog-title"
125
+ className={cn(
126
+ "font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
127
+ className
128
+ )}
129
+ {...props}
130
+ />
131
+ )
132
+ }
133
+
134
+ function AlertDialogDescription({
135
+ className,
136
+ ...props
137
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
138
+ return (
139
+ <AlertDialogPrimitive.Description
140
+ data-slot="alert-dialog-description"
141
+ className={cn(
142
+ "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
143
+ className
144
+ )}
145
+ {...props}
146
+ />
147
+ )
148
+ }
149
+
150
+ function AlertDialogAction({
151
+ className,
152
+ variant = "default",
153
+ size = "default",
154
+ ...props
155
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
156
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
157
+ return (
158
+ <Button variant={variant} size={size} asChild>
159
+ <AlertDialogPrimitive.Action
160
+ data-slot="alert-dialog-action"
161
+ className={cn(className)}
162
+ {...props}
163
+ />
164
+ </Button>
165
+ )
166
+ }
167
+
168
+ function AlertDialogCancel({
169
+ className,
170
+ variant = "outline",
171
+ size = "default",
172
+ ...props
173
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
174
+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
175
+ return (
176
+ <Button variant={variant} size={size} asChild>
177
+ <AlertDialogPrimitive.Cancel
178
+ data-slot="alert-dialog-cancel"
179
+ className={cn(className)}
180
+ {...props}
181
+ />
182
+ </Button>
183
+ )
184
+ }
185
+
186
+ export {
187
+ AlertDialog,
188
+ AlertDialogAction,
189
+ AlertDialogCancel,
190
+ AlertDialogContent,
191
+ AlertDialogDescription,
192
+ AlertDialogFooter,
193
+ AlertDialogHeader,
194
+ AlertDialogMedia,
195
+ AlertDialogOverlay,
196
+ AlertDialogPortal,
197
+ AlertDialogTitle,
198
+ AlertDialogTrigger,
199
+ }
@@ -0,0 +1,111 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "@/lib/utils"
5
+ import { Avatar as AvatarPrimitive } from "radix-ui"
6
+
7
+ function Avatar({
8
+ className,
9
+ size = "default",
10
+ ...props
11
+ }: React.ComponentProps<typeof AvatarPrimitive.Root> & {
12
+ size?: "default" | "sm" | "lg"
13
+ }) {
14
+ return (
15
+ <AvatarPrimitive.Root
16
+ data-slot="avatar"
17
+ data-size={size}
18
+ className={cn(
19
+ "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ )
25
+ }
26
+
27
+ function AvatarImage({
28
+ className,
29
+ ...props
30
+ }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
31
+ return (
32
+ <AvatarPrimitive.Image
33
+ data-slot="avatar-image"
34
+ className={cn(
35
+ "aspect-square size-full rounded-full object-cover",
36
+ className
37
+ )}
38
+ {...props}
39
+ />
40
+ )
41
+ }
42
+
43
+ function AvatarFallback({
44
+ className,
45
+ ...props
46
+ }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
47
+ return (
48
+ <AvatarPrimitive.Fallback
49
+ data-slot="avatar-fallback"
50
+ className={cn(
51
+ "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
52
+ className
53
+ )}
54
+ {...props}
55
+ />
56
+ )
57
+ }
58
+
59
+ function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
60
+ return (
61
+ <span
62
+ data-slot="avatar-badge"
63
+ className={cn(
64
+ "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
65
+ "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
66
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
67
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
68
+ className
69
+ )}
70
+ {...props}
71
+ />
72
+ )
73
+ }
74
+
75
+ function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
76
+ return (
77
+ <div
78
+ data-slot="avatar-group"
79
+ className={cn(
80
+ "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ )
86
+ }
87
+
88
+ function AvatarGroupCount({
89
+ className,
90
+ ...props
91
+ }: React.ComponentProps<"div">) {
92
+ return (
93
+ <div
94
+ data-slot="avatar-group-count"
95
+ className={cn(
96
+ "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
97
+ className
98
+ )}
99
+ {...props}
100
+ />
101
+ )
102
+ }
103
+
104
+ export {
105
+ Avatar,
106
+ AvatarImage,
107
+ AvatarFallback,
108
+ AvatarGroup,
109
+ AvatarGroupCount,
110
+ AvatarBadge,
111
+ }
@@ -0,0 +1,268 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "@/lib/utils"
5
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
6
+ import { CheckIcon, ChevronRightIcon } from "lucide-react"
7
+
8
+ function DropdownMenu({
9
+ ...props
10
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
11
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
12
+ }
13
+
14
+ function DropdownMenuPortal({
15
+ ...props
16
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
17
+ return (
18
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
19
+ )
20
+ }
21
+
22
+ function DropdownMenuTrigger({
23
+ ...props
24
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
25
+ return (
26
+ <DropdownMenuPrimitive.Trigger
27
+ data-slot="dropdown-menu-trigger"
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+
33
+ function DropdownMenuContent({
34
+ className,
35
+ align = "start",
36
+ sideOffset = 4,
37
+ ...props
38
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
39
+ return (
40
+ <DropdownMenuPrimitive.Portal>
41
+ <DropdownMenuPrimitive.Content
42
+ data-slot="dropdown-menu-content"
43
+ sideOffset={sideOffset}
44
+ align={align}
45
+ className={cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
46
+ {...props}
47
+ />
48
+ </DropdownMenuPrimitive.Portal>
49
+ )
50
+ }
51
+
52
+ function DropdownMenuGroup({
53
+ ...props
54
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
55
+ return (
56
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
+ )
58
+ }
59
+
60
+ function DropdownMenuItem({
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
66
+ inset?: boolean
67
+ variant?: "default" | "destructive"
68
+ }) {
69
+ return (
70
+ <DropdownMenuPrimitive.Item
71
+ data-slot="dropdown-menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
+ }
82
+
83
+ function DropdownMenuCheckboxItem({
84
+ className,
85
+ children,
86
+ checked,
87
+ inset,
88
+ ...props
89
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
90
+ inset?: boolean
91
+ }) {
92
+ return (
93
+ <DropdownMenuPrimitive.CheckboxItem
94
+ data-slot="dropdown-menu-checkbox-item"
95
+ data-inset={inset}
96
+ className={cn(
97
+ "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
98
+ className
99
+ )}
100
+ checked={checked}
101
+ {...props}
102
+ >
103
+ <span
104
+ className="pointer-events-none absolute right-2 flex items-center justify-center"
105
+ data-slot="dropdown-menu-checkbox-item-indicator"
106
+ >
107
+ <DropdownMenuPrimitive.ItemIndicator>
108
+ <CheckIcon
109
+ />
110
+ </DropdownMenuPrimitive.ItemIndicator>
111
+ </span>
112
+ {children}
113
+ </DropdownMenuPrimitive.CheckboxItem>
114
+ )
115
+ }
116
+
117
+ function DropdownMenuRadioGroup({
118
+ ...props
119
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
120
+ return (
121
+ <DropdownMenuPrimitive.RadioGroup
122
+ data-slot="dropdown-menu-radio-group"
123
+ {...props}
124
+ />
125
+ )
126
+ }
127
+
128
+ function DropdownMenuRadioItem({
129
+ className,
130
+ children,
131
+ inset,
132
+ ...props
133
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
134
+ inset?: boolean
135
+ }) {
136
+ return (
137
+ <DropdownMenuPrimitive.RadioItem
138
+ data-slot="dropdown-menu-radio-item"
139
+ data-inset={inset}
140
+ className={cn(
141
+ "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
142
+ className
143
+ )}
144
+ {...props}
145
+ >
146
+ <span
147
+ className="pointer-events-none absolute right-2 flex items-center justify-center"
148
+ data-slot="dropdown-menu-radio-item-indicator"
149
+ >
150
+ <DropdownMenuPrimitive.ItemIndicator>
151
+ <CheckIcon
152
+ />
153
+ </DropdownMenuPrimitive.ItemIndicator>
154
+ </span>
155
+ {children}
156
+ </DropdownMenuPrimitive.RadioItem>
157
+ )
158
+ }
159
+
160
+ function DropdownMenuLabel({
161
+ className,
162
+ inset,
163
+ ...props
164
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
165
+ inset?: boolean
166
+ }) {
167
+ return (
168
+ <DropdownMenuPrimitive.Label
169
+ data-slot="dropdown-menu-label"
170
+ data-inset={inset}
171
+ className={cn(
172
+ "px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
173
+ className
174
+ )}
175
+ {...props}
176
+ />
177
+ )
178
+ }
179
+
180
+ function DropdownMenuSeparator({
181
+ className,
182
+ ...props
183
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
184
+ return (
185
+ <DropdownMenuPrimitive.Separator
186
+ data-slot="dropdown-menu-separator"
187
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
188
+ {...props}
189
+ />
190
+ )
191
+ }
192
+
193
+ function DropdownMenuShortcut({
194
+ className,
195
+ ...props
196
+ }: React.ComponentProps<"span">) {
197
+ return (
198
+ <span
199
+ data-slot="dropdown-menu-shortcut"
200
+ className={cn(
201
+ "ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
202
+ className
203
+ )}
204
+ {...props}
205
+ />
206
+ )
207
+ }
208
+
209
+ function DropdownMenuSub({
210
+ ...props
211
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
212
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
213
+ }
214
+
215
+ function DropdownMenuSubTrigger({
216
+ className,
217
+ inset,
218
+ children,
219
+ ...props
220
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
221
+ inset?: boolean
222
+ }) {
223
+ return (
224
+ <DropdownMenuPrimitive.SubTrigger
225
+ data-slot="dropdown-menu-sub-trigger"
226
+ data-inset={inset}
227
+ className={cn(
228
+ "flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
229
+ className
230
+ )}
231
+ {...props}
232
+ >
233
+ {children}
234
+ <ChevronRightIcon className="ml-auto" />
235
+ </DropdownMenuPrimitive.SubTrigger>
236
+ )
237
+ }
238
+
239
+ function DropdownMenuSubContent({
240
+ className,
241
+ ...props
242
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
243
+ return (
244
+ <DropdownMenuPrimitive.SubContent
245
+ data-slot="dropdown-menu-sub-content"
246
+ className={cn("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
247
+ {...props}
248
+ />
249
+ )
250
+ }
251
+
252
+ export {
253
+ DropdownMenu,
254
+ DropdownMenuPortal,
255
+ DropdownMenuTrigger,
256
+ DropdownMenuContent,
257
+ DropdownMenuGroup,
258
+ DropdownMenuLabel,
259
+ DropdownMenuItem,
260
+ DropdownMenuCheckboxItem,
261
+ DropdownMenuRadioGroup,
262
+ DropdownMenuRadioItem,
263
+ DropdownMenuSeparator,
264
+ DropdownMenuShortcut,
265
+ DropdownMenuSub,
266
+ DropdownMenuSubTrigger,
267
+ DropdownMenuSubContent,
268
+ }