ar-saas 0.3.0 → 0.3.2

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 (114) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +338 -314
  3. package/dist/cli.js +19 -0
  4. package/dist/generator.js +166 -55
  5. package/package.json +52 -50
  6. package/templates/backend/.env.example +67 -67
  7. package/templates/backend/.prettierrc +4 -4
  8. package/templates/backend/README.md +249 -168
  9. package/templates/backend/eslint.config.mjs +35 -35
  10. package/templates/backend/nest-cli.json +8 -8
  11. package/templates/backend/package-lock.json +10979 -10979
  12. package/templates/backend/package.json +88 -88
  13. package/templates/backend/src/app.controller.spec.ts +24 -24
  14. package/templates/backend/src/app.controller.ts +15 -15
  15. package/templates/backend/src/app.module.ts +40 -40
  16. package/templates/backend/src/app.service.ts +11 -11
  17. package/templates/backend/src/common/base/base.repository.ts +221 -221
  18. package/templates/backend/src/common/base/base.schema.ts +24 -24
  19. package/templates/backend/src/common/decorators/cookie.decorator.ts +9 -9
  20. package/templates/backend/src/common/decorators/current-user.decorator.ts +20 -20
  21. package/templates/backend/src/common/decorators/workspace-id.decorator.ts +14 -14
  22. package/templates/backend/src/common/filters/global-exception.filter.ts +61 -61
  23. package/templates/backend/src/common/guards/jwt-auth.guard.ts +5 -5
  24. package/templates/backend/src/common/interceptors/workspace-tenant.interceptor.ts +45 -45
  25. package/templates/backend/src/main.ts +51 -51
  26. package/templates/backend/src/modules/auth/auth.controller.ts +158 -158
  27. package/templates/backend/src/modules/auth/auth.module.ts +20 -20
  28. package/templates/backend/src/modules/auth/auth.service.ts +257 -257
  29. package/templates/backend/src/modules/auth/dto/forgot-password.dto.ts +9 -9
  30. package/templates/backend/src/modules/auth/dto/login.dto.ts +14 -14
  31. package/templates/backend/src/modules/auth/dto/refresh-token.dto.ts +12 -12
  32. package/templates/backend/src/modules/auth/dto/register.dto.ts +26 -26
  33. package/templates/backend/src/modules/auth/dto/reset-password.dto.ts +16 -16
  34. package/templates/backend/src/modules/auth/dto/verify-email.dto.ts +9 -9
  35. package/templates/backend/src/modules/auth/strategies/jwt.strategy.ts +43 -43
  36. package/templates/backend/src/modules/mail/mail.module.ts +9 -9
  37. package/templates/backend/src/modules/mail/mail.service.ts +141 -141
  38. package/templates/backend/src/modules/users/schemas/user.schema.ts +54 -54
  39. package/templates/backend/src/modules/users/users.module.ts +14 -14
  40. package/templates/backend/src/modules/users/users.repository.ts +51 -51
  41. package/templates/backend/src/modules/users/users.service.ts +104 -104
  42. package/templates/backend/src/modules/workspaces/schemas/workspace.schema.ts +26 -26
  43. package/templates/backend/src/modules/workspaces/workspaces.module.ts +16 -16
  44. package/templates/backend/src/modules/workspaces/workspaces.repository.ts +34 -34
  45. package/templates/backend/src/modules/workspaces/workspaces.service.ts +42 -42
  46. package/templates/backend/test/app.e2e-spec.ts +25 -25
  47. package/templates/backend/test/jest-e2e.json +9 -9
  48. package/templates/backend/tsconfig.build.json +4 -4
  49. package/templates/backend/tsconfig.json +26 -26
  50. package/templates/frontend/.env.local.example +1 -1
  51. package/templates/frontend/README.md +152 -0
  52. package/templates/frontend/components.json +20 -20
  53. package/templates/frontend/eslint.config.mjs +14 -14
  54. package/templates/frontend/next.config.ts +5 -5
  55. package/templates/frontend/package-lock.json +6722 -6722
  56. package/templates/frontend/package.json +48 -48
  57. package/templates/frontend/pnpm-lock.yaml +5012 -5012
  58. package/templates/frontend/pnpm-workspace.yaml +3 -3
  59. package/templates/frontend/postcss.config.mjs +7 -7
  60. package/templates/frontend/src/app/(auth)/forgot-password/page.tsx +84 -84
  61. package/templates/frontend/src/app/(auth)/layout.tsx +28 -28
  62. package/templates/frontend/src/app/(auth)/login/page.tsx +111 -111
  63. package/templates/frontend/src/app/(auth)/register/page.tsx +161 -161
  64. package/templates/frontend/src/app/(auth)/reset-password/page.tsx +120 -120
  65. package/templates/frontend/src/app/(auth)/verify-email/page.tsx +78 -78
  66. package/templates/frontend/src/app/(dashboard)/billing/page.tsx +111 -111
  67. package/templates/frontend/src/app/(dashboard)/dashboard/page.tsx +105 -105
  68. package/templates/frontend/src/app/(dashboard)/layout.tsx +38 -38
  69. package/templates/frontend/src/app/(dashboard)/profile/page.tsx +226 -226
  70. package/templates/frontend/src/app/(dashboard)/settings/page.tsx +156 -156
  71. package/templates/frontend/src/app/(dashboard)/team/page.tsx +178 -178
  72. package/templates/frontend/src/app/(legal)/privacy/page.tsx +127 -127
  73. package/templates/frontend/src/app/(legal)/terms/page.tsx +118 -118
  74. package/templates/frontend/src/app/globals.css +81 -81
  75. package/templates/frontend/src/app/layout.tsx +26 -26
  76. package/templates/frontend/src/app/page.tsx +5 -45
  77. package/templates/frontend/src/app/setup/page.tsx +371 -275
  78. package/templates/frontend/src/components/dashboard/header.tsx +89 -89
  79. package/templates/frontend/src/components/dashboard/sidebar.tsx +71 -71
  80. package/templates/frontend/src/components/dashboard/stat-card.tsx +34 -34
  81. package/templates/frontend/src/components/landing/faq.tsx +39 -39
  82. package/templates/frontend/src/components/landing/features.tsx +54 -54
  83. package/templates/frontend/src/components/landing/footer.tsx +76 -76
  84. package/templates/frontend/src/components/landing/hero.tsx +72 -72
  85. package/templates/frontend/src/components/landing/navbar.tsx +78 -78
  86. package/templates/frontend/src/components/landing/pricing.tsx +90 -90
  87. package/templates/frontend/src/components/ui/accordion.tsx +52 -52
  88. package/templates/frontend/src/components/ui/avatar.tsx +46 -46
  89. package/templates/frontend/src/components/ui/badge.tsx +30 -30
  90. package/templates/frontend/src/components/ui/button.tsx +52 -52
  91. package/templates/frontend/src/components/ui/card.tsx +50 -50
  92. package/templates/frontend/src/components/ui/checkbox.tsx +27 -27
  93. package/templates/frontend/src/components/ui/dialog.tsx +100 -100
  94. package/templates/frontend/src/components/ui/dropdown-menu.tsx +173 -173
  95. package/templates/frontend/src/components/ui/form.tsx +158 -158
  96. package/templates/frontend/src/components/ui/input.tsx +21 -21
  97. package/templates/frontend/src/components/ui/label.tsx +22 -22
  98. package/templates/frontend/src/components/ui/separator.tsx +25 -25
  99. package/templates/frontend/src/components/ui/skeleton.tsx +7 -7
  100. package/templates/frontend/src/components/ui/switch.tsx +28 -28
  101. package/templates/frontend/src/components/ui/tabs.tsx +54 -54
  102. package/templates/frontend/src/components/ui/textarea.tsx +20 -20
  103. package/templates/frontend/src/components/ui/toast.tsx +109 -109
  104. package/templates/frontend/src/components/ui/toaster.tsx +30 -30
  105. package/templates/frontend/src/config/site.ts +197 -197
  106. package/templates/frontend/src/hooks/use-toast.ts +116 -116
  107. package/templates/frontend/src/lib/api/auth.ts +39 -39
  108. package/templates/frontend/src/lib/api/client.ts +66 -66
  109. package/templates/frontend/src/lib/hooks/use-auth.ts +1 -1
  110. package/templates/frontend/src/lib/utils.ts +6 -6
  111. package/templates/frontend/src/providers/auth-provider.tsx +60 -60
  112. package/templates/frontend/src/types/api.ts +12 -12
  113. package/templates/frontend/src/types/auth.ts +27 -27
  114. package/templates/frontend/tsconfig.json +23 -23
@@ -1,100 +1,100 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as DialogPrimitive from '@radix-ui/react-dialog'
5
- import { X } from 'lucide-react'
6
- import { cn } from '@/lib/utils'
7
-
8
- const Dialog = DialogPrimitive.Root
9
- const DialogTrigger = DialogPrimitive.Trigger
10
- const DialogPortal = DialogPrimitive.Portal
11
- const DialogClose = DialogPrimitive.Close
12
-
13
- const DialogOverlay = React.forwardRef<
14
- React.ElementRef<typeof DialogPrimitive.Overlay>,
15
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
16
- >(({ className, ...props }, ref) => (
17
- <DialogPrimitive.Overlay
18
- ref={ref}
19
- className={cn(
20
- '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',
21
- className,
22
- )}
23
- {...props}
24
- />
25
- ))
26
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
27
-
28
- const DialogContent = React.forwardRef<
29
- React.ElementRef<typeof DialogPrimitive.Content>,
30
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
31
- >(({ className, children, ...props }, ref) => (
32
- <DialogPortal>
33
- <DialogOverlay />
34
- <DialogPrimitive.Content
35
- ref={ref}
36
- className={cn(
37
- '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',
38
- className,
39
- )}
40
- {...props}
41
- >
42
- {children}
43
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
44
- <X className="h-4 w-4" />
45
- <span className="sr-only">Cerrar</span>
46
- </DialogPrimitive.Close>
47
- </DialogPrimitive.Content>
48
- </DialogPortal>
49
- ))
50
- DialogContent.displayName = DialogPrimitive.Content.displayName
51
-
52
- const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
53
- <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
54
- )
55
- DialogHeader.displayName = 'DialogHeader'
56
-
57
- const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
58
- <div
59
- className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
60
- {...props}
61
- />
62
- )
63
- DialogFooter.displayName = 'DialogFooter'
64
-
65
- const DialogTitle = React.forwardRef<
66
- React.ElementRef<typeof DialogPrimitive.Title>,
67
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
68
- >(({ className, ...props }, ref) => (
69
- <DialogPrimitive.Title
70
- ref={ref}
71
- className={cn('text-lg font-semibold leading-none tracking-tight', className)}
72
- {...props}
73
- />
74
- ))
75
- DialogTitle.displayName = DialogPrimitive.Title.displayName
76
-
77
- const DialogDescription = React.forwardRef<
78
- React.ElementRef<typeof DialogPrimitive.Description>,
79
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
80
- >(({ className, ...props }, ref) => (
81
- <DialogPrimitive.Description
82
- ref={ref}
83
- className={cn('text-sm text-muted-foreground', className)}
84
- {...props}
85
- />
86
- ))
87
- DialogDescription.displayName = DialogPrimitive.Description.displayName
88
-
89
- export {
90
- Dialog,
91
- DialogPortal,
92
- DialogOverlay,
93
- DialogClose,
94
- DialogTrigger,
95
- DialogContent,
96
- DialogHeader,
97
- DialogFooter,
98
- DialogTitle,
99
- DialogDescription,
100
- }
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import * as DialogPrimitive from '@radix-ui/react-dialog'
5
+ import { X } from 'lucide-react'
6
+ import { cn } from '@/lib/utils'
7
+
8
+ const Dialog = DialogPrimitive.Root
9
+ const DialogTrigger = DialogPrimitive.Trigger
10
+ const DialogPortal = DialogPrimitive.Portal
11
+ const DialogClose = DialogPrimitive.Close
12
+
13
+ const DialogOverlay = React.forwardRef<
14
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
15
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
16
+ >(({ className, ...props }, ref) => (
17
+ <DialogPrimitive.Overlay
18
+ ref={ref}
19
+ className={cn(
20
+ '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',
21
+ className,
22
+ )}
23
+ {...props}
24
+ />
25
+ ))
26
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
27
+
28
+ const DialogContent = React.forwardRef<
29
+ React.ElementRef<typeof DialogPrimitive.Content>,
30
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
31
+ >(({ className, children, ...props }, ref) => (
32
+ <DialogPortal>
33
+ <DialogOverlay />
34
+ <DialogPrimitive.Content
35
+ ref={ref}
36
+ className={cn(
37
+ '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',
38
+ className,
39
+ )}
40
+ {...props}
41
+ >
42
+ {children}
43
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
44
+ <X className="h-4 w-4" />
45
+ <span className="sr-only">Cerrar</span>
46
+ </DialogPrimitive.Close>
47
+ </DialogPrimitive.Content>
48
+ </DialogPortal>
49
+ ))
50
+ DialogContent.displayName = DialogPrimitive.Content.displayName
51
+
52
+ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
53
+ <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
54
+ )
55
+ DialogHeader.displayName = 'DialogHeader'
56
+
57
+ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
58
+ <div
59
+ className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
60
+ {...props}
61
+ />
62
+ )
63
+ DialogFooter.displayName = 'DialogFooter'
64
+
65
+ const DialogTitle = React.forwardRef<
66
+ React.ElementRef<typeof DialogPrimitive.Title>,
67
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
68
+ >(({ className, ...props }, ref) => (
69
+ <DialogPrimitive.Title
70
+ ref={ref}
71
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
72
+ {...props}
73
+ />
74
+ ))
75
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
76
+
77
+ const DialogDescription = React.forwardRef<
78
+ React.ElementRef<typeof DialogPrimitive.Description>,
79
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
80
+ >(({ className, ...props }, ref) => (
81
+ <DialogPrimitive.Description
82
+ ref={ref}
83
+ className={cn('text-sm text-muted-foreground', className)}
84
+ {...props}
85
+ />
86
+ ))
87
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
88
+
89
+ export {
90
+ Dialog,
91
+ DialogPortal,
92
+ DialogOverlay,
93
+ DialogClose,
94
+ DialogTrigger,
95
+ DialogContent,
96
+ DialogHeader,
97
+ DialogFooter,
98
+ DialogTitle,
99
+ DialogDescription,
100
+ }
@@ -1,173 +1,173 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
5
- import { Check, ChevronRight, Circle } from 'lucide-react'
6
- import { cn } from '@/lib/utils'
7
-
8
- const DropdownMenu = DropdownMenuPrimitive.Root
9
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
10
- const DropdownMenuGroup = DropdownMenuPrimitive.Group
11
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal
12
- const DropdownMenuSub = DropdownMenuPrimitive.Sub
13
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
14
-
15
- const DropdownMenuSubTrigger = React.forwardRef<
16
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
17
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }
18
- >(({ className, inset, children, ...props }, ref) => (
19
- <DropdownMenuPrimitive.SubTrigger
20
- ref={ref}
21
- className={cn(
22
- 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',
23
- inset && 'pl-8',
24
- className,
25
- )}
26
- {...props}
27
- >
28
- {children}
29
- <ChevronRight className="ml-auto h-4 w-4" />
30
- </DropdownMenuPrimitive.SubTrigger>
31
- ))
32
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
33
-
34
- const DropdownMenuSubContent = React.forwardRef<
35
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
36
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
37
- >(({ className, ...props }, ref) => (
38
- <DropdownMenuPrimitive.SubContent
39
- ref={ref}
40
- className={cn(
41
- 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[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',
42
- className,
43
- )}
44
- {...props}
45
- />
46
- ))
47
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
48
-
49
- const DropdownMenuContent = React.forwardRef<
50
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
51
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
52
- >(({ className, sideOffset = 4, ...props }, ref) => (
53
- <DropdownMenuPrimitive.Portal>
54
- <DropdownMenuPrimitive.Content
55
- ref={ref}
56
- sideOffset={sideOffset}
57
- className={cn(
58
- 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[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',
59
- className,
60
- )}
61
- {...props}
62
- />
63
- </DropdownMenuPrimitive.Portal>
64
- ))
65
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
66
-
67
- const DropdownMenuItem = React.forwardRef<
68
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
69
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
70
- >(({ className, inset, ...props }, ref) => (
71
- <DropdownMenuPrimitive.Item
72
- ref={ref}
73
- className={cn(
74
- 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
75
- inset && 'pl-8',
76
- className,
77
- )}
78
- {...props}
79
- />
80
- ))
81
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
82
-
83
- const DropdownMenuCheckboxItem = React.forwardRef<
84
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
85
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
86
- >(({ className, children, checked, ...props }, ref) => (
87
- <DropdownMenuPrimitive.CheckboxItem
88
- ref={ref}
89
- className={cn(
90
- 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
91
- className,
92
- )}
93
- checked={checked}
94
- {...props}
95
- >
96
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
97
- <DropdownMenuPrimitive.ItemIndicator>
98
- <Check className="h-4 w-4" />
99
- </DropdownMenuPrimitive.ItemIndicator>
100
- </span>
101
- {children}
102
- </DropdownMenuPrimitive.CheckboxItem>
103
- ))
104
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName
105
-
106
- const DropdownMenuRadioItem = React.forwardRef<
107
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
108
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
109
- >(({ className, children, ...props }, ref) => (
110
- <DropdownMenuPrimitive.RadioItem
111
- ref={ref}
112
- className={cn(
113
- 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
114
- className,
115
- )}
116
- {...props}
117
- >
118
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
119
- <DropdownMenuPrimitive.ItemIndicator>
120
- <Circle className="h-2 w-2 fill-current" />
121
- </DropdownMenuPrimitive.ItemIndicator>
122
- </span>
123
- {children}
124
- </DropdownMenuPrimitive.RadioItem>
125
- ))
126
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
127
-
128
- const DropdownMenuLabel = React.forwardRef<
129
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
130
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
131
- >(({ className, inset, ...props }, ref) => (
132
- <DropdownMenuPrimitive.Label
133
- ref={ref}
134
- className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
135
- {...props}
136
- />
137
- ))
138
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
139
-
140
- const DropdownMenuSeparator = React.forwardRef<
141
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
142
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
143
- >(({ className, ...props }, ref) => (
144
- <DropdownMenuPrimitive.Separator
145
- ref={ref}
146
- className={cn('-mx-1 my-1 h-px bg-muted', className)}
147
- {...props}
148
- />
149
- ))
150
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
151
-
152
- const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (
153
- <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />
154
- )
155
- DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'
156
-
157
- export {
158
- DropdownMenu,
159
- DropdownMenuTrigger,
160
- DropdownMenuContent,
161
- DropdownMenuItem,
162
- DropdownMenuCheckboxItem,
163
- DropdownMenuRadioItem,
164
- DropdownMenuLabel,
165
- DropdownMenuSeparator,
166
- DropdownMenuShortcut,
167
- DropdownMenuGroup,
168
- DropdownMenuPortal,
169
- DropdownMenuSub,
170
- DropdownMenuSubContent,
171
- DropdownMenuSubTrigger,
172
- DropdownMenuRadioGroup,
173
- }
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
5
+ import { Check, ChevronRight, Circle } from 'lucide-react'
6
+ import { cn } from '@/lib/utils'
7
+
8
+ const DropdownMenu = DropdownMenuPrimitive.Root
9
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
10
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group
11
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal
12
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub
13
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
14
+
15
+ const DropdownMenuSubTrigger = React.forwardRef<
16
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
17
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }
18
+ >(({ className, inset, children, ...props }, ref) => (
19
+ <DropdownMenuPrimitive.SubTrigger
20
+ ref={ref}
21
+ className={cn(
22
+ 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',
23
+ inset && 'pl-8',
24
+ className,
25
+ )}
26
+ {...props}
27
+ >
28
+ {children}
29
+ <ChevronRight className="ml-auto h-4 w-4" />
30
+ </DropdownMenuPrimitive.SubTrigger>
31
+ ))
32
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
33
+
34
+ const DropdownMenuSubContent = React.forwardRef<
35
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
36
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
37
+ >(({ className, ...props }, ref) => (
38
+ <DropdownMenuPrimitive.SubContent
39
+ ref={ref}
40
+ className={cn(
41
+ 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[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',
42
+ className,
43
+ )}
44
+ {...props}
45
+ />
46
+ ))
47
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
48
+
49
+ const DropdownMenuContent = React.forwardRef<
50
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
51
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
52
+ >(({ className, sideOffset = 4, ...props }, ref) => (
53
+ <DropdownMenuPrimitive.Portal>
54
+ <DropdownMenuPrimitive.Content
55
+ ref={ref}
56
+ sideOffset={sideOffset}
57
+ className={cn(
58
+ 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[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',
59
+ className,
60
+ )}
61
+ {...props}
62
+ />
63
+ </DropdownMenuPrimitive.Portal>
64
+ ))
65
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
66
+
67
+ const DropdownMenuItem = React.forwardRef<
68
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
69
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
70
+ >(({ className, inset, ...props }, ref) => (
71
+ <DropdownMenuPrimitive.Item
72
+ ref={ref}
73
+ className={cn(
74
+ 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
75
+ inset && 'pl-8',
76
+ className,
77
+ )}
78
+ {...props}
79
+ />
80
+ ))
81
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
82
+
83
+ const DropdownMenuCheckboxItem = React.forwardRef<
84
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
85
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
86
+ >(({ className, children, checked, ...props }, ref) => (
87
+ <DropdownMenuPrimitive.CheckboxItem
88
+ ref={ref}
89
+ className={cn(
90
+ 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
91
+ className,
92
+ )}
93
+ checked={checked}
94
+ {...props}
95
+ >
96
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
97
+ <DropdownMenuPrimitive.ItemIndicator>
98
+ <Check className="h-4 w-4" />
99
+ </DropdownMenuPrimitive.ItemIndicator>
100
+ </span>
101
+ {children}
102
+ </DropdownMenuPrimitive.CheckboxItem>
103
+ ))
104
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName
105
+
106
+ const DropdownMenuRadioItem = React.forwardRef<
107
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
108
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
109
+ >(({ className, children, ...props }, ref) => (
110
+ <DropdownMenuPrimitive.RadioItem
111
+ ref={ref}
112
+ className={cn(
113
+ 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
114
+ className,
115
+ )}
116
+ {...props}
117
+ >
118
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
119
+ <DropdownMenuPrimitive.ItemIndicator>
120
+ <Circle className="h-2 w-2 fill-current" />
121
+ </DropdownMenuPrimitive.ItemIndicator>
122
+ </span>
123
+ {children}
124
+ </DropdownMenuPrimitive.RadioItem>
125
+ ))
126
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
127
+
128
+ const DropdownMenuLabel = React.forwardRef<
129
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
130
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
131
+ >(({ className, inset, ...props }, ref) => (
132
+ <DropdownMenuPrimitive.Label
133
+ ref={ref}
134
+ className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
135
+ {...props}
136
+ />
137
+ ))
138
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
139
+
140
+ const DropdownMenuSeparator = React.forwardRef<
141
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
142
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
143
+ >(({ className, ...props }, ref) => (
144
+ <DropdownMenuPrimitive.Separator
145
+ ref={ref}
146
+ className={cn('-mx-1 my-1 h-px bg-muted', className)}
147
+ {...props}
148
+ />
149
+ ))
150
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
151
+
152
+ const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (
153
+ <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />
154
+ )
155
+ DropdownMenuShortcut.displayName = 'DropdownMenuShortcut'
156
+
157
+ export {
158
+ DropdownMenu,
159
+ DropdownMenuTrigger,
160
+ DropdownMenuContent,
161
+ DropdownMenuItem,
162
+ DropdownMenuCheckboxItem,
163
+ DropdownMenuRadioItem,
164
+ DropdownMenuLabel,
165
+ DropdownMenuSeparator,
166
+ DropdownMenuShortcut,
167
+ DropdownMenuGroup,
168
+ DropdownMenuPortal,
169
+ DropdownMenuSub,
170
+ DropdownMenuSubContent,
171
+ DropdownMenuSubTrigger,
172
+ DropdownMenuRadioGroup,
173
+ }