create-ej-app 12.0.0 → 14.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 (140) hide show
  1. package/cli.js +5 -4
  2. package/cli.ts +9 -4
  3. package/package.json +1 -1
  4. package/template/base/package.json +9 -15
  5. package/template/base/terraform/artifact-registry.tf +5 -0
  6. package/template/base/terraform/backend-service.tf +13 -0
  7. package/template/base/terraform/cleanup.sh +9 -0
  8. package/template/base/terraform/cloudbuild.tf +70 -0
  9. package/template/base/terraform/cloudrun.tf +68 -0
  10. package/template/base/terraform/database.tf +60 -0
  11. package/template/base/terraform/forwarding-rule.tf +43 -0
  12. package/template/base/terraform/ip-address.tf +11 -0
  13. package/template/base/terraform/network-endpoint-group.tf +11 -0
  14. package/template/base/terraform/network.tf +21 -0
  15. package/template/base/terraform/pre.sh +3 -0
  16. package/template/base/terraform/providers.tf +18 -0
  17. package/template/base/terraform/secret.txt +11 -0
  18. package/template/base/terraform/setup.sh +25 -0
  19. package/template/base/terraform/ssl-certs.tf +32 -0
  20. package/template/base/terraform/target-https-proxy copy.tf +14 -0
  21. package/template/base/terraform/target-https-proxy.tf +14 -0
  22. package/template/base/terraform/terraform.tfvars +4 -0
  23. package/template/base/terraform/url-map.tf +23 -0
  24. package/template/base/terraform/variables.tf +21 -0
  25. package/template/old/.env.example +0 -17
  26. package/template/old/.eslintrc.cjs +0 -26
  27. package/template/old/components.json +0 -17
  28. package/template/old/drizzle.config.ts +0 -11
  29. package/template/old/next.config.mjs +0 -4
  30. package/template/old/package.json +0 -87
  31. package/template/old/postcss.config.mjs +0 -8
  32. package/template/old/prettier.config.mjs +0 -11
  33. package/template/old/public/next.svg +0 -1
  34. package/template/old/public/vercel.svg +0 -1
  35. package/template/old/src/app/(app)/dashboard/layout.tsx +0 -14
  36. package/template/old/src/app/(app)/dashboard/page.tsx +0 -12
  37. package/template/old/src/app/(app)/layout.tsx +0 -125
  38. package/template/old/src/app/(app)/roles/[id]/actions.ts +0 -59
  39. package/template/old/src/app/(app)/roles/[id]/page.tsx +0 -46
  40. package/template/old/src/app/(app)/roles/[id]/render.tsx +0 -264
  41. package/template/old/src/app/(app)/roles/[id]/validation.ts +0 -22
  42. package/template/old/src/app/(app)/roles/actions.ts +0 -33
  43. package/template/old/src/app/(app)/roles/page.tsx +0 -52
  44. package/template/old/src/app/(app)/roles/render.tsx +0 -80
  45. package/template/old/src/app/(app)/settings/actions.ts +0 -17
  46. package/template/old/src/app/(app)/settings/layout.tsx +0 -14
  47. package/template/old/src/app/(app)/settings/loading.tsx +0 -28
  48. package/template/old/src/app/(app)/settings/page.tsx +0 -19
  49. package/template/old/src/app/(app)/settings/render.tsx +0 -107
  50. package/template/old/src/app/(app)/settings/validation.ts +0 -5
  51. package/template/old/src/app/(app)/tasks/[id]/actions.ts +0 -92
  52. package/template/old/src/app/(app)/tasks/[id]/page.tsx +0 -59
  53. package/template/old/src/app/(app)/tasks/[id]/render.tsx +0 -482
  54. package/template/old/src/app/(app)/tasks/[id]/validation.ts +0 -18
  55. package/template/old/src/app/(app)/tasks/actions.ts +0 -39
  56. package/template/old/src/app/(app)/tasks/page.tsx +0 -59
  57. package/template/old/src/app/(app)/tasks/render.tsx +0 -129
  58. package/template/old/src/app/(app)/tasks/statusEnum.ts +0 -3
  59. package/template/old/src/app/(app)/users/[id]/actions.ts +0 -68
  60. package/template/old/src/app/(app)/users/[id]/page.tsx +0 -39
  61. package/template/old/src/app/(app)/users/[id]/render.tsx +0 -325
  62. package/template/old/src/app/(app)/users/[id]/validation.ts +0 -18
  63. package/template/old/src/app/(app)/users/actions.ts +0 -34
  64. package/template/old/src/app/(app)/users/page.tsx +0 -62
  65. package/template/old/src/app/(app)/users/render.tsx +0 -124
  66. package/template/old/src/app/(auth)/layout.tsx +0 -27
  67. package/template/old/src/app/(auth)/login/page.tsx +0 -49
  68. package/template/old/src/app/(auth)/login/render.tsx +0 -146
  69. package/template/old/src/app/(marketing)/layout.tsx +0 -42
  70. package/template/old/src/app/(marketing)/page.tsx +0 -97
  71. package/template/old/src/app/api/auth/[...nextauth]/route.ts +0 -7
  72. package/template/old/src/app/favicon.ico +0 -0
  73. package/template/old/src/app/globals.css +0 -76
  74. package/template/old/src/app/layout.tsx +0 -31
  75. package/template/old/src/components/app-nav-command.tsx +0 -178
  76. package/template/old/src/components/dark-mode-toggle.tsx +0 -43
  77. package/template/old/src/components/data-table/data-table-column-header.tsx +0 -91
  78. package/template/old/src/components/data-table/data-table-faceted-filter.tsx +0 -149
  79. package/template/old/src/components/data-table/data-table-loading.tsx +0 -77
  80. package/template/old/src/components/data-table/data-table-pagination.tsx +0 -94
  81. package/template/old/src/components/data-table/data-table-toolbar.tsx +0 -78
  82. package/template/old/src/components/data-table/data-table-types.ts +0 -17
  83. package/template/old/src/components/data-table/data-table-view-options.tsx +0 -59
  84. package/template/old/src/components/data-table/data-table.tsx +0 -301
  85. package/template/old/src/components/data-table/simple-data-table.tsx +0 -109
  86. package/template/old/src/components/empty-placeholder.tsx +0 -78
  87. package/template/old/src/components/heading.tsx +0 -17
  88. package/template/old/src/components/icons.tsx +0 -101
  89. package/template/old/src/components/main-nav.tsx +0 -64
  90. package/template/old/src/components/mobile-nav.tsx +0 -50
  91. package/template/old/src/components/shell.tsx +0 -13
  92. package/template/old/src/components/side-nav.tsx +0 -51
  93. package/template/old/src/components/site-footer.tsx +0 -31
  94. package/template/old/src/components/system-info.tsx +0 -36
  95. package/template/old/src/components/ui/alert-dialog.tsx +0 -141
  96. package/template/old/src/components/ui/avatar.tsx +0 -50
  97. package/template/old/src/components/ui/badge.tsx +0 -36
  98. package/template/old/src/components/ui/button.tsx +0 -56
  99. package/template/old/src/components/ui/card.tsx +0 -79
  100. package/template/old/src/components/ui/checkbox.tsx +0 -30
  101. package/template/old/src/components/ui/command.tsx +0 -155
  102. package/template/old/src/components/ui/dialog.tsx +0 -122
  103. package/template/old/src/components/ui/dropdown-menu.tsx +0 -200
  104. package/template/old/src/components/ui/form.tsx +0 -176
  105. package/template/old/src/components/ui/input.tsx +0 -25
  106. package/template/old/src/components/ui/label.tsx +0 -26
  107. package/template/old/src/components/ui/popover.tsx +0 -31
  108. package/template/old/src/components/ui/select.tsx +0 -160
  109. package/template/old/src/components/ui/separator.tsx +0 -31
  110. package/template/old/src/components/ui/skeleton.tsx +0 -15
  111. package/template/old/src/components/ui/sonner.tsx +0 -31
  112. package/template/old/src/components/ui/table.tsx +0 -117
  113. package/template/old/src/components/user-account-nav.tsx +0 -60
  114. package/template/old/src/components/user-avatar.tsx +0 -27
  115. package/template/old/src/data-access/resource.ts +0 -85
  116. package/template/old/src/data-access/role-permission.ts +0 -45
  117. package/template/old/src/data-access/role.ts +0 -105
  118. package/template/old/src/data-access/task.ts +0 -141
  119. package/template/old/src/data-access/user.ts +0 -141
  120. package/template/old/src/db/index.ts +0 -14
  121. package/template/old/src/db/schema.ts +0 -287
  122. package/template/old/src/env.mjs +0 -58
  123. package/template/old/src/hooks/use-debounce.tsx +0 -17
  124. package/template/old/src/hooks/use-lock-body.tsx +0 -13
  125. package/template/old/src/lib/auth.ts +0 -89
  126. package/template/old/src/lib/cn.ts +0 -4
  127. package/template/old/src/lib/currentUser.ts +0 -8
  128. package/template/old/src/lib/delay.ts +0 -2
  129. package/template/old/src/lib/formatDate.ts +0 -11
  130. package/template/old/src/lib/generateLabel.ts +0 -5
  131. package/template/old/src/lib/s3Client.ts +0 -156
  132. package/template/old/src/lib/safe-action.ts +0 -19
  133. package/template/old/src/lib/siteConfig.ts +0 -4
  134. package/template/old/src/lib/sortOrderEnum.ts +0 -2
  135. package/template/old/src/use-case/role-permission.ts +0 -19
  136. package/template/old/src/use-case/role.ts +0 -110
  137. package/template/old/src/use-case/task.ts +0 -166
  138. package/template/old/src/use-case/user.ts +0 -121
  139. package/template/old/tailwind.config.ts +0 -81
  140. package/template/old/tsconfig.json +0 -47
@@ -1,101 +0,0 @@
1
- import { cn } from '@/lib/cn'
2
- import {
3
- ArrowDown,
4
- ArrowRight,
5
- ArrowUp,
6
- ArrowUpDown,
7
- Biohazard,
8
- Check,
9
- ChevronLeft,
10
- ChevronRight,
11
- ChevronsLeft,
12
- ChevronsRight,
13
- ClipboardList,
14
- Edit,
15
- EyeOff,
16
- Laptop,
17
- LayoutDashboard,
18
- Loader2,
19
- LogIn,
20
- LogOut,
21
- LucideIcon,
22
- LucideProps,
23
- Moon,
24
- Plus,
25
- PlusCircle,
26
- Save,
27
- Settings,
28
- Settings2,
29
- Sun,
30
- Terminal,
31
- Trash,
32
- User,
33
- X
34
- } from 'lucide-react'
35
-
36
- export type Icon = LucideIcon
37
-
38
- export const Icons = {
39
- logo: Biohazard,
40
- sun: Sun,
41
- moon: Moon,
42
- laptop: Laptop,
43
- chevronLeft: ChevronLeft,
44
- arrowRight: ArrowRight,
45
- github: ({ ...props }: LucideProps) => (
46
- <svg
47
- aria-hidden="true"
48
- focusable="false"
49
- data-prefix="fab"
50
- data-icon="github"
51
- role="img"
52
- xmlns="http://www.w3.org/2000/svg"
53
- viewBox="0 0 496 512"
54
- {...props}
55
- className={cn('fill-current', props.className)}
56
- >
57
- <path
58
- fill="currentColor"
59
- d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"
60
- ></path>
61
- </svg>
62
- ),
63
- google: ({ ...props }: LucideProps) => (
64
- <svg
65
- aria-hidden="true"
66
- focusable="false"
67
- data-prefix="fab"
68
- data-icon="google"
69
- role="img"
70
- xmlns="http://www.w3.org/2000/svg"
71
- viewBox="0 0 30 30"
72
- {...props}
73
- className={cn('fill-current', props.className)}
74
- >
75
- <path d="M 15.003906 3 C 8.3749062 3 3 8.373 3 15 C 3 21.627 8.3749062 27 15.003906 27 C 25.013906 27 27.269078 17.707 26.330078 13 L 25 13 L 22.732422 13 L 15 13 L 15 17 L 22.738281 17 C 21.848702 20.448251 18.725955 23 15 23 C 10.582 23 7 19.418 7 15 C 7 10.582 10.582 7 15 7 C 17.009 7 18.839141 7.74575 20.244141 8.96875 L 23.085938 6.1289062 C 20.951937 4.1849063 18.116906 3 15.003906 3 z"></path>
76
- </svg>
77
- ),
78
- login: LogIn,
79
- logout: LogOut,
80
- user: User,
81
- spinner: Loader2,
82
- settings: Settings,
83
- close: X,
84
- add: Plus,
85
- edit: Edit,
86
- save: Save,
87
- delete: Trash,
88
- dashboard: LayoutDashboard,
89
- task: ClipboardList,
90
- arrowUp: ArrowUp,
91
- arrowDown: ArrowDown,
92
- arrowUpDown: ArrowUpDown,
93
- eyeOff: EyeOff,
94
- plusCircle: PlusCircle,
95
- check: Check,
96
- chevronsLeft: ChevronsLeft,
97
- chevronsRight: ChevronsRight,
98
- chevronRight: ChevronRight,
99
- mixer: Settings2,
100
- terminal: Terminal
101
- }
@@ -1,64 +0,0 @@
1
- 'use client'
2
-
3
- import Link from 'next/link'
4
- import { useSelectedLayoutSegment } from 'next/navigation'
5
- import { FC, useState } from 'react'
6
-
7
- import { Icons } from '@/components/icons'
8
- import { MobileNav } from '@/components/mobile-nav'
9
- import { cn } from '@/lib/cn'
10
- import { siteConfig } from '@/lib/siteConfig'
11
-
12
- type MainNavItem = {
13
- title: string
14
- href: string
15
- disabled?: boolean
16
- }
17
-
18
- type MainNavProps = {
19
- logoLink?: string
20
- items?: MainNavItem[]
21
- }
22
-
23
- export const MainNav: FC<MainNavProps> = ({ logoLink = '/', items }) => {
24
- const [showMobileMenu, setShowMobileMenu] = useState(false)
25
- const segment = useSelectedLayoutSegment()
26
-
27
- return (
28
- <div className="flex md:gap-10">
29
- <Link href={logoLink} className="hidden items-center space-x-2 md:flex">
30
- <Icons.logo />
31
- <span className="hidden font-bold sm:inline-block">
32
- {siteConfig.name}
33
- </span>
34
- </Link>
35
- {items?.length ? (
36
- <nav className="hidden gap-6 md:flex">
37
- {items?.map((item, i) => (
38
- <Link
39
- key={i}
40
- href={item.disabled ? '#' : item.href}
41
- className={cn(
42
- 'flex items-center text-lg font-medium transition-colors hover:text-foreground/80 sm:text-sm',
43
- item.href.startsWith(`/${segment}`)
44
- ? 'text-foreground'
45
- : 'text-foreground/60',
46
- item.disabled && 'cursor-not-allowed opacity-80'
47
- )}
48
- >
49
- {item.title}
50
- </Link>
51
- ))}
52
- </nav>
53
- ) : undefined}
54
- <button
55
- className="flex items-center space-x-2 md:hidden"
56
- onClick={() => setShowMobileMenu(prev => !prev)}
57
- >
58
- {showMobileMenu ? <Icons.close /> : <Icons.logo />}
59
- <span className="font-bold">Menu</span>
60
- </button>
61
- {showMobileMenu && items?.length && <MobileNav items={items} />}
62
- </div>
63
- )
64
- }
@@ -1,50 +0,0 @@
1
- 'use client'
2
-
3
- import Link from 'next/link'
4
-
5
- import { Icons } from '@/components/icons'
6
- import { useLockBody } from '@/hooks/use-lock-body'
7
- import { cn } from '@/lib/cn'
8
- import { siteConfig } from '@/lib/siteConfig'
9
- import { FC } from 'react'
10
-
11
- interface MobileNavProps {
12
- items: {
13
- title: string
14
- href: string
15
- disabled?: boolean
16
- }[]
17
- }
18
-
19
- export const MobileNav: FC<MobileNavProps> = ({ items }) => {
20
- useLockBody()
21
-
22
- return (
23
- <div
24
- className={cn(
25
- 'fixed inset-0 top-16 z-50 grid h-[calc(100vh-4rem)] grid-flow-row auto-rows-max overflow-auto p-6 pb-32 shadow-md animate-in slide-in-from-bottom-80 md:hidden'
26
- )}
27
- >
28
- <div className="relative z-20 grid gap-6 rounded-md bg-popover p-4 text-popover-foreground shadow-md">
29
- <Link href="/" className="flex items-center space-x-2">
30
- <Icons.logo />
31
- <span className="font-bold">{siteConfig.name}</span>
32
- </Link>
33
- <nav className="grid grid-flow-row auto-rows-max text-sm">
34
- {items.map((item, index) => (
35
- <Link
36
- key={index}
37
- href={item.disabled ? '#' : item.href}
38
- className={cn(
39
- 'flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline',
40
- item.disabled && 'cursor-not-allowed opacity-60'
41
- )}
42
- >
43
- {item.title}
44
- </Link>
45
- ))}
46
- </nav>
47
- </div>
48
- </div>
49
- )
50
- }
@@ -1,13 +0,0 @@
1
- import { FC } from 'react'
2
-
3
- import { cn } from '@/lib/cn'
4
-
5
- interface ShellProps extends React.HTMLAttributes<HTMLDivElement> {}
6
-
7
- export const Shell: FC<ShellProps> = ({ children, className, ...props }) => {
8
- return (
9
- <div className={cn('grid items-start gap-8 p-1', className)} {...props}>
10
- {children}
11
- </div>
12
- )
13
- }
@@ -1,51 +0,0 @@
1
- 'use client'
2
-
3
- import Link from 'next/link'
4
- import { usePathname } from 'next/navigation'
5
-
6
- import { Icons } from '@/components/icons'
7
- import { cn } from '@/lib/cn'
8
- import { FC } from 'react'
9
-
10
- type IconKeys = keyof typeof Icons
11
-
12
- interface SideNavProps {
13
- items: {
14
- title: string
15
- href?: string | null
16
- disabled?: boolean | null
17
- icon?: IconKeys | null
18
- }[]
19
- }
20
-
21
- export const SideNav: FC<SideNavProps> = ({ items }) => {
22
- const path = usePathname()
23
-
24
- if (!items?.length) return null
25
-
26
- return (
27
- <nav className="grid items-start gap-2">
28
- {items.map((item, index) => {
29
- const Icon = Icons[item.icon || 'arrowRight']
30
- return (
31
- item.href && (
32
- <Link key={index} href={item.disabled ? '/' : item.href}>
33
- <span
34
- className={cn(
35
- 'group flex items-center rounded-md px-3 py-2 text-sm font-medium',
36
- path.includes(item.href)
37
- ? 'bg-accent'
38
- : 'transparent underline-offset-4 hover:underline',
39
- item.disabled && 'cursor-not-allowed opacity-80'
40
- )}
41
- >
42
- <Icon className="mr-2 h-4 w-4" />
43
- <span>{item.title}</span>
44
- </span>
45
- </Link>
46
- )
47
- )
48
- })}
49
- </nav>
50
- )
51
- }
@@ -1,31 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react'
2
-
3
- import { DarkModeToggle } from '@/components/dark-mode-toggle'
4
- import { Icons } from '@/components/icons'
5
- import { cn } from '@/lib/cn'
6
- import { siteConfig } from '@/lib/siteConfig'
7
-
8
- export const SiteFooter: FC<HTMLAttributes<HTMLElement>> = ({ className }) => {
9
- return (
10
- <footer className={cn(className)}>
11
- <div className="container flex flex-col items-center justify-between gap-2 py-4 sm:flex-row">
12
- <div className="flex flex-col items-center gap-2 sm:flex-row">
13
- <Icons.logo />
14
- <p className="text-center text-sm leading-loose sm:text-left">
15
- {siteConfig.name}. Built by{' '}
16
- <a
17
- href="https://github.com/ejekanshjain"
18
- target="_blank"
19
- rel="noreferrer"
20
- className="font-medium underline underline-offset-4"
21
- >
22
- ejekanshjain
23
- </a>
24
- .
25
- </p>
26
- </div>
27
- <DarkModeToggle />
28
- </div>
29
- </footer>
30
- )
31
- }
@@ -1,36 +0,0 @@
1
- 'use client'
2
-
3
- import { FC, ReactNode } from 'react'
4
-
5
- import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
6
- import { Separator } from '@/components/ui/separator'
7
-
8
- type SystemInfoProps = {
9
- items: {
10
- label: string
11
- value: string | ReactNode
12
- }[]
13
- }
14
-
15
- export const SystemInfo: FC<SystemInfoProps> = ({ items }) => {
16
- return (
17
- <Card className="max-w-[600px]">
18
- <CardHeader>
19
- <CardTitle>System Information</CardTitle>
20
- </CardHeader>
21
- <CardContent>
22
- <dl className="grid gap-4">
23
- {items.map((item, i) => (
24
- <div key={i}>
25
- <dt className="font-semibold">{item.label}</dt>
26
- <dd>{item.value}</dd>
27
- {i < items.length - 1 ? (
28
- <Separator className="mt-2" />
29
- ) : undefined}
30
- </div>
31
- ))}
32
- </dl>
33
- </CardContent>
34
- </Card>
35
- )
36
- }
@@ -1,141 +0,0 @@
1
- 'use client'
2
-
3
- import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
4
- import * as React from 'react'
5
-
6
- import { buttonVariants } from '@/components/ui/button'
7
- import { cn } from '@/lib/cn'
8
-
9
- const AlertDialog = AlertDialogPrimitive.Root
10
-
11
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger
12
-
13
- const AlertDialogPortal = AlertDialogPrimitive.Portal
14
-
15
- const AlertDialogOverlay = React.forwardRef<
16
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
18
- >(({ className, ...props }, ref) => (
19
- <AlertDialogPrimitive.Overlay
20
- className={cn(
21
- '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',
22
- className
23
- )}
24
- {...props}
25
- ref={ref}
26
- />
27
- ))
28
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
29
-
30
- const AlertDialogContent = React.forwardRef<
31
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
32
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
33
- >(({ className, ...props }, ref) => (
34
- <AlertDialogPortal>
35
- <AlertDialogOverlay />
36
- <AlertDialogPrimitive.Content
37
- ref={ref}
38
- className={cn(
39
- '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',
40
- className
41
- )}
42
- {...props}
43
- />
44
- </AlertDialogPortal>
45
- ))
46
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
47
-
48
- const AlertDialogHeader = ({
49
- className,
50
- ...props
51
- }: React.HTMLAttributes<HTMLDivElement>) => (
52
- <div
53
- className={cn(
54
- 'flex flex-col space-y-2 text-center sm:text-left',
55
- className
56
- )}
57
- {...props}
58
- />
59
- )
60
- AlertDialogHeader.displayName = 'AlertDialogHeader'
61
-
62
- const AlertDialogFooter = ({
63
- className,
64
- ...props
65
- }: React.HTMLAttributes<HTMLDivElement>) => (
66
- <div
67
- className={cn(
68
- 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
69
- className
70
- )}
71
- {...props}
72
- />
73
- )
74
- AlertDialogFooter.displayName = 'AlertDialogFooter'
75
-
76
- const AlertDialogTitle = React.forwardRef<
77
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
78
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
79
- >(({ className, ...props }, ref) => (
80
- <AlertDialogPrimitive.Title
81
- ref={ref}
82
- className={cn('text-lg font-semibold', className)}
83
- {...props}
84
- />
85
- ))
86
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
87
-
88
- const AlertDialogDescription = React.forwardRef<
89
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
90
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
91
- >(({ className, ...props }, ref) => (
92
- <AlertDialogPrimitive.Description
93
- ref={ref}
94
- className={cn('text-sm text-muted-foreground', className)}
95
- {...props}
96
- />
97
- ))
98
- AlertDialogDescription.displayName =
99
- AlertDialogPrimitive.Description.displayName
100
-
101
- const AlertDialogAction = React.forwardRef<
102
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
103
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
104
- >(({ className, ...props }, ref) => (
105
- <AlertDialogPrimitive.Action
106
- ref={ref}
107
- className={cn(buttonVariants(), className)}
108
- {...props}
109
- />
110
- ))
111
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
112
-
113
- const AlertDialogCancel = React.forwardRef<
114
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
115
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
116
- >(({ className, ...props }, ref) => (
117
- <AlertDialogPrimitive.Cancel
118
- ref={ref}
119
- className={cn(
120
- buttonVariants({ variant: 'outline' }),
121
- 'mt-2 sm:mt-0',
122
- className
123
- )}
124
- {...props}
125
- />
126
- ))
127
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
128
-
129
- export {
130
- AlertDialog,
131
- AlertDialogAction,
132
- AlertDialogCancel,
133
- AlertDialogContent,
134
- AlertDialogDescription,
135
- AlertDialogFooter,
136
- AlertDialogHeader,
137
- AlertDialogOverlay,
138
- AlertDialogPortal,
139
- AlertDialogTitle,
140
- AlertDialogTrigger
141
- }
@@ -1,50 +0,0 @@
1
- 'use client'
2
-
3
- import * as AvatarPrimitive from '@radix-ui/react-avatar'
4
- import * as React from 'react'
5
-
6
- import { cn } from '@/lib/cn'
7
-
8
- const Avatar = React.forwardRef<
9
- React.ElementRef<typeof AvatarPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
11
- >(({ className, ...props }, ref) => (
12
- <AvatarPrimitive.Root
13
- ref={ref}
14
- className={cn(
15
- 'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full',
16
- className
17
- )}
18
- {...props}
19
- />
20
- ))
21
- Avatar.displayName = AvatarPrimitive.Root.displayName
22
-
23
- const AvatarImage = React.forwardRef<
24
- React.ElementRef<typeof AvatarPrimitive.Image>,
25
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
26
- >(({ className, ...props }, ref) => (
27
- <AvatarPrimitive.Image
28
- ref={ref}
29
- className={cn('aspect-square h-full w-full', className)}
30
- {...props}
31
- />
32
- ))
33
- AvatarImage.displayName = AvatarPrimitive.Image.displayName
34
-
35
- const AvatarFallback = React.forwardRef<
36
- React.ElementRef<typeof AvatarPrimitive.Fallback>,
37
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
38
- >(({ className, ...props }, ref) => (
39
- <AvatarPrimitive.Fallback
40
- ref={ref}
41
- className={cn(
42
- 'flex h-full w-full items-center justify-center rounded-full bg-muted',
43
- className
44
- )}
45
- {...props}
46
- />
47
- ))
48
- AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
49
-
50
- export { Avatar, AvatarFallback, AvatarImage }
@@ -1,36 +0,0 @@
1
- import { cva, type VariantProps } from 'class-variance-authority'
2
- import * as React from 'react'
3
-
4
- import { cn } from '@/lib/cn'
5
-
6
- const badgeVariants = cva(
7
- 'inline-flex items-center rounded-full 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:
12
- 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
13
- secondary:
14
- 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
15
- destructive:
16
- 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
17
- outline: 'text-foreground'
18
- }
19
- },
20
- defaultVariants: {
21
- variant: 'default'
22
- }
23
- }
24
- )
25
-
26
- export interface BadgeProps
27
- extends React.HTMLAttributes<HTMLDivElement>,
28
- VariantProps<typeof badgeVariants> {}
29
-
30
- function Badge({ className, variant, ...props }: BadgeProps) {
31
- return (
32
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
33
- )
34
- }
35
-
36
- export { Badge, badgeVariants }
@@ -1,56 +0,0 @@
1
- import { Slot } from '@radix-ui/react-slot'
2
- import { cva, type VariantProps } from 'class-variance-authority'
3
- import * as React from 'react'
4
-
5
- import { cn } from '@/lib/cn'
6
-
7
- const buttonVariants = cva(
8
- 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 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:
14
- 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
15
- outline:
16
- 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
17
- secondary:
18
- 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
19
- ghost: 'hover:bg-accent hover:text-accent-foreground',
20
- link: 'text-primary underline-offset-4 hover:underline'
21
- },
22
- size: {
23
- default: 'h-10 px-4 py-2',
24
- sm: 'h-9 rounded-md px-3',
25
- lg: 'h-11 rounded-md px-8',
26
- icon: 'h-10 w-10'
27
- }
28
- },
29
- defaultVariants: {
30
- variant: 'default',
31
- size: 'default'
32
- }
33
- }
34
- )
35
-
36
- export interface ButtonProps
37
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38
- VariantProps<typeof buttonVariants> {
39
- asChild?: boolean
40
- }
41
-
42
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43
- ({ className, variant, size, asChild = false, ...props }, ref) => {
44
- const Comp = asChild ? Slot : 'button'
45
- return (
46
- <Comp
47
- className={cn(buttonVariants({ variant, size, className }))}
48
- ref={ref}
49
- {...props}
50
- />
51
- )
52
- }
53
- )
54
- Button.displayName = 'Button'
55
-
56
- export { Button, buttonVariants }