create-nextjs-cms 0.5.8

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 (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +395 -0
  6. package/dist/lib/utils.d.ts +11 -0
  7. package/dist/lib/utils.d.ts.map +1 -0
  8. package/dist/lib/utils.js +48 -0
  9. package/package.json +44 -0
  10. package/templates/default/.env +24 -0
  11. package/templates/default/.env.development +8 -0
  12. package/templates/default/.eslintrc.json +5 -0
  13. package/templates/default/.prettierignore +7 -0
  14. package/templates/default/.prettierrc.json +19 -0
  15. package/templates/default/CHANGELOG.md +77 -0
  16. package/templates/default/README.md +45 -0
  17. package/templates/default/app/(auth)/auth/login/LoginPage.tsx +175 -0
  18. package/templates/default/app/(auth)/auth/login/page.tsx +12 -0
  19. package/templates/default/app/(rootLayout)/admins/page.tsx +5 -0
  20. package/templates/default/app/(rootLayout)/advanced/page.tsx +5 -0
  21. package/templates/default/app/(rootLayout)/analytics/page.tsx +7 -0
  22. package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +7 -0
  23. package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +7 -0
  24. package/templates/default/app/(rootLayout)/dashboard/page.tsx +7 -0
  25. package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +7 -0
  26. package/templates/default/app/(rootLayout)/emails/page.tsx +6 -0
  27. package/templates/default/app/(rootLayout)/layout.tsx +5 -0
  28. package/templates/default/app/(rootLayout)/loading.tsx +10 -0
  29. package/templates/default/app/(rootLayout)/log/page.tsx +7 -0
  30. package/templates/default/app/(rootLayout)/new/[section]/page.tsx +7 -0
  31. package/templates/default/app/(rootLayout)/page.tsx +9 -0
  32. package/templates/default/app/(rootLayout)/section/[section]/page.tsx +7 -0
  33. package/templates/default/app/(rootLayout)/settings/page.tsx +7 -0
  34. package/templates/default/app/_trpc/client.ts +4 -0
  35. package/templates/default/app/api/auth/csrf/route.ts +25 -0
  36. package/templates/default/app/api/auth/refresh/route.ts +10 -0
  37. package/templates/default/app/api/auth/route.ts +23 -0
  38. package/templates/default/app/api/auth/session/route.ts +20 -0
  39. package/templates/default/app/api/editor/photo/route.ts +42 -0
  40. package/templates/default/app/api/photo/route.ts +27 -0
  41. package/templates/default/app/api/placeholder/route.ts +7 -0
  42. package/templates/default/app/api/submit/section/item/[slug]/route.ts +63 -0
  43. package/templates/default/app/api/submit/section/item/route.ts +53 -0
  44. package/templates/default/app/api/submit/section/simple/route.ts +54 -0
  45. package/templates/default/app/api/trpc/[trpc]/route.ts +33 -0
  46. package/templates/default/app/api/video/route.ts +174 -0
  47. package/templates/default/app/dictionaries.ts +14 -0
  48. package/templates/default/app/layout.tsx +28 -0
  49. package/templates/default/app/providers.tsx +151 -0
  50. package/templates/default/cli.ts +4 -0
  51. package/templates/default/components/AdminCard.tsx +163 -0
  52. package/templates/default/components/AdminEditPage.tsx +123 -0
  53. package/templates/default/components/AdminPrivilegeCard.tsx +184 -0
  54. package/templates/default/components/AdminsPage.tsx +43 -0
  55. package/templates/default/components/AdvancedSettingsPage.tsx +167 -0
  56. package/templates/default/components/AnalyticsPage.tsx +127 -0
  57. package/templates/default/components/BarChartBox.tsx +43 -0
  58. package/templates/default/components/BrowsePage.tsx +119 -0
  59. package/templates/default/components/CategorizedSectionPage.tsx +36 -0
  60. package/templates/default/components/CategoryDeleteConfirmPage.tsx +129 -0
  61. package/templates/default/components/CategorySectionSelectInput.tsx +139 -0
  62. package/templates/default/components/ConditionalFields.tsx +49 -0
  63. package/templates/default/components/ContainerBox.tsx +24 -0
  64. package/templates/default/components/DashboardPage.tsx +187 -0
  65. package/templates/default/components/DashboardPageAlt.tsx +43 -0
  66. package/templates/default/components/DefaultNavItems.tsx +3 -0
  67. package/templates/default/components/Dropzone.tsx +153 -0
  68. package/templates/default/components/EmailCard.tsx +137 -0
  69. package/templates/default/components/EmailPasswordForm.tsx +84 -0
  70. package/templates/default/components/EmailQuotaForm.tsx +72 -0
  71. package/templates/default/components/EmailsPage.tsx +48 -0
  72. package/templates/default/components/GalleryPhoto.tsx +93 -0
  73. package/templates/default/components/InfoCard.tsx +94 -0
  74. package/templates/default/components/ItemEditPage.tsx +217 -0
  75. package/templates/default/components/Layout.tsx +70 -0
  76. package/templates/default/components/LoadingSpinners.tsx +67 -0
  77. package/templates/default/components/LogPage.tsx +17 -0
  78. package/templates/default/components/Modal.tsx +99 -0
  79. package/templates/default/components/Navbar.tsx +29 -0
  80. package/templates/default/components/NavbarAlt.tsx +182 -0
  81. package/templates/default/components/NewAdminForm.tsx +172 -0
  82. package/templates/default/components/NewEmailForm.tsx +131 -0
  83. package/templates/default/components/NewPage.tsx +206 -0
  84. package/templates/default/components/NewVariantComponent.tsx +228 -0
  85. package/templates/default/components/PhotoGallery.tsx +35 -0
  86. package/templates/default/components/PieChartBox.tsx +101 -0
  87. package/templates/default/components/ProgressBar.tsx +24 -0
  88. package/templates/default/components/ProtectedDocument.tsx +78 -0
  89. package/templates/default/components/ProtectedImage.tsx +143 -0
  90. package/templates/default/components/ProtectedVideo.tsx +76 -0
  91. package/templates/default/components/SectionItemCard.tsx +143 -0
  92. package/templates/default/components/SectionItemStatusBadge.tsx +16 -0
  93. package/templates/default/components/SectionPage.tsx +124 -0
  94. package/templates/default/components/SelectBox.tsx +99 -0
  95. package/templates/default/components/SelectInputButtons.tsx +124 -0
  96. package/templates/default/components/SettingsPage.tsx +238 -0
  97. package/templates/default/components/Sidebar.tsx +209 -0
  98. package/templates/default/components/SidebarDropdownItem.tsx +74 -0
  99. package/templates/default/components/SidebarItem.tsx +19 -0
  100. package/templates/default/components/TempPage.tsx +12 -0
  101. package/templates/default/components/ThemeProvider.tsx +8 -0
  102. package/templates/default/components/TooltipComponent.tsx +27 -0
  103. package/templates/default/components/VariantCard.tsx +123 -0
  104. package/templates/default/components/VariantEditPage.tsx +229 -0
  105. package/templates/default/components/analytics/BounceRate.tsx +69 -0
  106. package/templates/default/components/analytics/LivePageViews.tsx +54 -0
  107. package/templates/default/components/analytics/LiveUsersCount.tsx +32 -0
  108. package/templates/default/components/analytics/MonthlyPageViews.tsx +41 -0
  109. package/templates/default/components/analytics/TopCountries.tsx +51 -0
  110. package/templates/default/components/analytics/TopDevices.tsx +45 -0
  111. package/templates/default/components/analytics/TopMediums.tsx +57 -0
  112. package/templates/default/components/analytics/TopSources.tsx +44 -0
  113. package/templates/default/components/analytics/TotalPageViews.tsx +40 -0
  114. package/templates/default/components/analytics/TotalSessions.tsx +40 -0
  115. package/templates/default/components/analytics/TotalUniqueUsers.tsx +40 -0
  116. package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +137 -0
  117. package/templates/default/components/dndKit/Draggable.tsx +21 -0
  118. package/templates/default/components/dndKit/Droppable.tsx +20 -0
  119. package/templates/default/components/dndKit/SortableItem.tsx +18 -0
  120. package/templates/default/components/form/DateRangeFormInput.tsx +55 -0
  121. package/templates/default/components/form/Form.tsx +298 -0
  122. package/templates/default/components/form/FormInputElement.tsx +68 -0
  123. package/templates/default/components/form/FormInputs.tsx +108 -0
  124. package/templates/default/components/form/helpers/util.ts +20 -0
  125. package/templates/default/components/form/inputs/CheckboxFormInput.tsx +33 -0
  126. package/templates/default/components/form/inputs/ColorFormInput.tsx +44 -0
  127. package/templates/default/components/form/inputs/DateFormInput.tsx +107 -0
  128. package/templates/default/components/form/inputs/DocumentFormInput.tsx +124 -0
  129. package/templates/default/components/form/inputs/MapFormInput.tsx +139 -0
  130. package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +150 -0
  131. package/templates/default/components/form/inputs/NumberFormInput.tsx +42 -0
  132. package/templates/default/components/form/inputs/PasswordFormInput.tsx +47 -0
  133. package/templates/default/components/form/inputs/PhotoFormInput.tsx +218 -0
  134. package/templates/default/components/form/inputs/RichTextFormInput.tsx +133 -0
  135. package/templates/default/components/form/inputs/SelectFormInput.tsx +164 -0
  136. package/templates/default/components/form/inputs/TagsFormInput.tsx +63 -0
  137. package/templates/default/components/form/inputs/TextFormInput.tsx +48 -0
  138. package/templates/default/components/form/inputs/TextareaFormInput.tsx +47 -0
  139. package/templates/default/components/form/inputs/VideoFormInput.tsx +117 -0
  140. package/templates/default/components/pagination/Pagination.tsx +36 -0
  141. package/templates/default/components/pagination/PaginationButtons.tsx +145 -0
  142. package/templates/default/components/ui/accordion.tsx +57 -0
  143. package/templates/default/components/ui/alert.tsx +46 -0
  144. package/templates/default/components/ui/badge.tsx +33 -0
  145. package/templates/default/components/ui/button.tsx +57 -0
  146. package/templates/default/components/ui/calendar.tsx +68 -0
  147. package/templates/default/components/ui/card.tsx +76 -0
  148. package/templates/default/components/ui/checkbox.tsx +29 -0
  149. package/templates/default/components/ui/dropdown-menu.tsx +205 -0
  150. package/templates/default/components/ui/input.tsx +25 -0
  151. package/templates/default/components/ui/label.tsx +26 -0
  152. package/templates/default/components/ui/popover.tsx +31 -0
  153. package/templates/default/components/ui/scroll-area.tsx +42 -0
  154. package/templates/default/components/ui/select.tsx +164 -0
  155. package/templates/default/components/ui/sheet.tsx +107 -0
  156. package/templates/default/components/ui/switch.tsx +29 -0
  157. package/templates/default/components/ui/table.tsx +120 -0
  158. package/templates/default/components/ui/tabs.tsx +55 -0
  159. package/templates/default/components/ui/toast.tsx +113 -0
  160. package/templates/default/components/ui/toaster.tsx +35 -0
  161. package/templates/default/components/ui/tooltip.tsx +30 -0
  162. package/templates/default/components/ui/use-toast.ts +188 -0
  163. package/templates/default/components.json +16 -0
  164. package/templates/default/context/ModalProvider.tsx +53 -0
  165. package/templates/default/drizzle.config.ts +4 -0
  166. package/templates/default/dynamic-schemas/schema.ts +373 -0
  167. package/templates/default/env/env.js +130 -0
  168. package/templates/default/envConfig.ts +4 -0
  169. package/templates/default/hooks/useModal.ts +8 -0
  170. package/templates/default/lib/apiHelpers.ts +106 -0
  171. package/templates/default/lz.config.ts +40 -0
  172. package/templates/default/middleware.ts +33 -0
  173. package/templates/default/next.config.ts +46 -0
  174. package/templates/default/package.json +134 -0
  175. package/templates/default/postcss.config.js +6 -0
  176. package/templates/default/postinstall.js +14 -0
  177. package/templates/default/public/blank_avatar.png +0 -0
  178. package/templates/default/public/favicon.ico +0 -0
  179. package/templates/default/public/img/placeholder.svg +1 -0
  180. package/templates/default/public/lazemni_logo.png +0 -0
  181. package/templates/default/public/next.svg +1 -0
  182. package/templates/default/public/vercel.svg +1 -0
  183. package/templates/default/section-tests.ts +92 -0
  184. package/templates/default/styles/globals.css +88 -0
  185. package/templates/default/tailwind.config.js +95 -0
  186. package/templates/default/test.ts +77 -0
  187. package/templates/default/tsconfig.json +44 -0
@@ -0,0 +1,205 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
5
+ import {
6
+ CheckIcon,
7
+ ChevronRightIcon,
8
+ DotFilledIcon,
9
+ } from "@radix-ui/react-icons"
10
+
11
+ import { cn } from 'nextjs-cms/utils'
12
+
13
+ const DropdownMenu = DropdownMenuPrimitive.Root
14
+
15
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
16
+
17
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group
18
+
19
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal
20
+
21
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub
22
+
23
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
24
+
25
+ const DropdownMenuSubTrigger = React.forwardRef<
26
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
27
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
28
+ inset?: boolean
29
+ }
30
+ >(({ className, inset, children, ...props }, ref) => (
31
+ <DropdownMenuPrimitive.SubTrigger
32
+ ref={ref}
33
+ className={cn(
34
+ "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",
35
+ inset && "pl-8",
36
+ className
37
+ )}
38
+ {...props}
39
+ >
40
+ {children}
41
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
42
+ </DropdownMenuPrimitive.SubTrigger>
43
+ ))
44
+ DropdownMenuSubTrigger.displayName =
45
+ DropdownMenuPrimitive.SubTrigger.displayName
46
+
47
+ const DropdownMenuSubContent = React.forwardRef<
48
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
49
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
50
+ >(({ className, ...props }, ref) => (
51
+ <DropdownMenuPrimitive.SubContent
52
+ ref={ref}
53
+ className={cn(
54
+ "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",
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ ))
60
+ DropdownMenuSubContent.displayName =
61
+ DropdownMenuPrimitive.SubContent.displayName
62
+
63
+ const DropdownMenuContent = React.forwardRef<
64
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
65
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
66
+ >(({ className, sideOffset = 4, ...props }, ref) => (
67
+ <DropdownMenuPrimitive.Portal>
68
+ <DropdownMenuPrimitive.Content
69
+ ref={ref}
70
+ sideOffset={sideOffset}
71
+ className={cn(
72
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
73
+ "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",
74
+ className
75
+ )}
76
+ {...props}
77
+ />
78
+ </DropdownMenuPrimitive.Portal>
79
+ ))
80
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
81
+
82
+ const DropdownMenuItem = React.forwardRef<
83
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
84
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
85
+ inset?: boolean
86
+ }
87
+ >(({ className, inset, ...props }, ref) => (
88
+ <DropdownMenuPrimitive.Item
89
+ ref={ref}
90
+ className={cn(
91
+ "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",
92
+ inset && "pl-8",
93
+ className
94
+ )}
95
+ {...props}
96
+ />
97
+ ))
98
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
99
+
100
+ const DropdownMenuCheckboxItem = React.forwardRef<
101
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
102
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
103
+ >(({ className, children, checked, ...props }, ref) => (
104
+ <DropdownMenuPrimitive.CheckboxItem
105
+ ref={ref}
106
+ className={cn(
107
+ "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",
108
+ className
109
+ )}
110
+ checked={checked}
111
+ {...props}
112
+ >
113
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
114
+ <DropdownMenuPrimitive.ItemIndicator>
115
+ <CheckIcon className="h-4 w-4" />
116
+ </DropdownMenuPrimitive.ItemIndicator>
117
+ </span>
118
+ {children}
119
+ </DropdownMenuPrimitive.CheckboxItem>
120
+ ))
121
+ DropdownMenuCheckboxItem.displayName =
122
+ DropdownMenuPrimitive.CheckboxItem.displayName
123
+
124
+ const DropdownMenuRadioItem = React.forwardRef<
125
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
126
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
127
+ >(({ className, children, ...props }, ref) => (
128
+ <DropdownMenuPrimitive.RadioItem
129
+ ref={ref}
130
+ className={cn(
131
+ "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",
132
+ className
133
+ )}
134
+ {...props}
135
+ >
136
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
137
+ <DropdownMenuPrimitive.ItemIndicator>
138
+ <DotFilledIcon className="h-4 w-4 fill-current" />
139
+ </DropdownMenuPrimitive.ItemIndicator>
140
+ </span>
141
+ {children}
142
+ </DropdownMenuPrimitive.RadioItem>
143
+ ))
144
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
145
+
146
+ const DropdownMenuLabel = React.forwardRef<
147
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
148
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
149
+ inset?: boolean
150
+ }
151
+ >(({ className, inset, ...props }, ref) => (
152
+ <DropdownMenuPrimitive.Label
153
+ ref={ref}
154
+ className={cn(
155
+ "px-2 py-1.5 text-sm font-semibold",
156
+ inset && "pl-8",
157
+ className
158
+ )}
159
+ {...props}
160
+ />
161
+ ))
162
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
163
+
164
+ const DropdownMenuSeparator = React.forwardRef<
165
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
166
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
167
+ >(({ className, ...props }, ref) => (
168
+ <DropdownMenuPrimitive.Separator
169
+ ref={ref}
170
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
171
+ {...props}
172
+ />
173
+ ))
174
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
175
+
176
+ const DropdownMenuShortcut = ({
177
+ className,
178
+ ...props
179
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
180
+ return (
181
+ <span
182
+ className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
183
+ {...props}
184
+ />
185
+ )
186
+ }
187
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
188
+
189
+ export {
190
+ DropdownMenu,
191
+ DropdownMenuTrigger,
192
+ DropdownMenuContent,
193
+ DropdownMenuItem,
194
+ DropdownMenuCheckboxItem,
195
+ DropdownMenuRadioItem,
196
+ DropdownMenuLabel,
197
+ DropdownMenuSeparator,
198
+ DropdownMenuShortcut,
199
+ DropdownMenuGroup,
200
+ DropdownMenuPortal,
201
+ DropdownMenuSub,
202
+ DropdownMenuSubContent,
203
+ DropdownMenuSubTrigger,
204
+ DropdownMenuRadioGroup,
205
+ }
@@ -0,0 +1,25 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from 'nextjs-cms/utils'
4
+
5
+ export interface InputProps
6
+ extends React.InputHTMLAttributes<HTMLInputElement> {}
7
+
8
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
9
+ ({ className, type, ...props }, ref) => {
10
+ return (
11
+ <input
12
+ type={type}
13
+ className={cn(
14
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
15
+ className
16
+ )}
17
+ ref={ref}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+ )
23
+ Input.displayName = "Input"
24
+
25
+ export { Input }
@@ -0,0 +1,26 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as LabelPrimitive from "@radix-ui/react-label"
5
+ import { cva, type VariantProps } from "class-variance-authority"
6
+
7
+ import { cn } from 'nextjs-cms/utils'
8
+
9
+ const labelVariants = cva(
10
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
11
+ )
12
+
13
+ const Label = React.forwardRef<
14
+ React.ElementRef<typeof LabelPrimitive.Root>,
15
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
16
+ VariantProps<typeof labelVariants>
17
+ >(({ className, ...props }, ref) => (
18
+ <LabelPrimitive.Root
19
+ ref={ref}
20
+ className={cn(labelVariants(), className)}
21
+ {...props}
22
+ />
23
+ ))
24
+ Label.displayName = LabelPrimitive.Root.displayName
25
+
26
+ export { Label }
@@ -0,0 +1,31 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
5
+
6
+ import { cn } from 'nextjs-cms/utils'
7
+
8
+ const Popover = PopoverPrimitive.Root
9
+
10
+ const PopoverTrigger = PopoverPrimitive.Trigger
11
+
12
+ const PopoverContent = React.forwardRef<
13
+ React.ElementRef<typeof PopoverPrimitive.Content>,
14
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
+ <PopoverPrimitive.Portal>
17
+ <PopoverPrimitive.Content
18
+ ref={ref}
19
+ align={align}
20
+ sideOffset={sideOffset}
21
+ className={cn(
22
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
23
+ className
24
+ )}
25
+ {...props}
26
+ />
27
+ </PopoverPrimitive.Portal>
28
+ ))
29
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
30
+
31
+ export { Popover, PopoverTrigger, PopoverContent }
@@ -0,0 +1,42 @@
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
5
+
6
+ import { cn } from 'nextjs-cms/utils'
7
+
8
+ const ScrollArea = React.forwardRef<
9
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
11
+ >(({ className, children, ...props }, ref) => (
12
+ <ScrollAreaPrimitive.Root ref={ref} className={cn('relative overflow-hidden', className)} {...props}>
13
+ <ScrollAreaPrimitive.Viewport className='h-full w-full rounded-[inherit]'>
14
+ {children}
15
+ </ScrollAreaPrimitive.Viewport>
16
+ <ScrollBar />
17
+ <ScrollAreaPrimitive.Corner />
18
+ </ScrollAreaPrimitive.Root>
19
+ ))
20
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
21
+
22
+ const ScrollBar = React.forwardRef<
23
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
24
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
25
+ >(({ className, orientation = 'vertical', ...props }, ref) => (
26
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
27
+ ref={ref}
28
+ orientation={orientation}
29
+ className={cn(
30
+ 'flex touch-none select-none transition-colors',
31
+ orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',
32
+ orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
33
+ className,
34
+ )}
35
+ {...props}
36
+ >
37
+ <ScrollAreaPrimitive.ScrollAreaThumb className='relative flex-1 rounded-full bg-border dark:bg-primary/40' />
38
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
39
+ ))
40
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
41
+
42
+ export { ScrollArea, ScrollBar }
@@ -0,0 +1,164 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import {
5
+ CaretSortIcon,
6
+ CheckIcon,
7
+ ChevronDownIcon,
8
+ ChevronUpIcon,
9
+ } from "@radix-ui/react-icons"
10
+ import * as SelectPrimitive from "@radix-ui/react-select"
11
+
12
+ import { cn } from 'nextjs-cms/utils'
13
+
14
+ const Select = SelectPrimitive.Root
15
+
16
+ const SelectGroup = SelectPrimitive.Group
17
+
18
+ const SelectValue = SelectPrimitive.Value
19
+
20
+ const SelectTrigger = React.forwardRef<
21
+ React.ElementRef<typeof SelectPrimitive.Trigger>,
22
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
23
+ >(({ className, children, ...props }, ref) => (
24
+ <SelectPrimitive.Trigger
25
+ ref={ref}
26
+ className={cn(
27
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
28
+ className
29
+ )}
30
+ {...props}
31
+ >
32
+ {children}
33
+ <SelectPrimitive.Icon asChild>
34
+ <CaretSortIcon className="h-4 w-4 opacity-50" />
35
+ </SelectPrimitive.Icon>
36
+ </SelectPrimitive.Trigger>
37
+ ))
38
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
39
+
40
+ const SelectScrollUpButton = React.forwardRef<
41
+ React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
42
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
43
+ >(({ className, ...props }, ref) => (
44
+ <SelectPrimitive.ScrollUpButton
45
+ ref={ref}
46
+ className={cn(
47
+ "flex cursor-default items-center justify-center py-1",
48
+ className
49
+ )}
50
+ {...props}
51
+ >
52
+ <ChevronUpIcon />
53
+ </SelectPrimitive.ScrollUpButton>
54
+ ))
55
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
56
+
57
+ const SelectScrollDownButton = React.forwardRef<
58
+ React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
59
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
60
+ >(({ className, ...props }, ref) => (
61
+ <SelectPrimitive.ScrollDownButton
62
+ ref={ref}
63
+ className={cn(
64
+ "flex cursor-default items-center justify-center py-1",
65
+ className
66
+ )}
67
+ {...props}
68
+ >
69
+ <ChevronDownIcon />
70
+ </SelectPrimitive.ScrollDownButton>
71
+ ))
72
+ SelectScrollDownButton.displayName =
73
+ SelectPrimitive.ScrollDownButton.displayName
74
+
75
+ const SelectContent = React.forwardRef<
76
+ React.ElementRef<typeof SelectPrimitive.Content>,
77
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
78
+ >(({ className, children, position = "popper", ...props }, ref) => (
79
+ <SelectPrimitive.Portal>
80
+ <SelectPrimitive.Content
81
+ ref={ref}
82
+ className={cn(
83
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",
84
+ position === "popper" &&
85
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
86
+ className
87
+ )}
88
+ position={position}
89
+ {...props}
90
+ >
91
+ <SelectScrollUpButton />
92
+ <SelectPrimitive.Viewport
93
+ className={cn(
94
+ "p-1",
95
+ position === "popper" &&
96
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
97
+ )}
98
+ >
99
+ {children}
100
+ </SelectPrimitive.Viewport>
101
+ <SelectScrollDownButton />
102
+ </SelectPrimitive.Content>
103
+ </SelectPrimitive.Portal>
104
+ ))
105
+ SelectContent.displayName = SelectPrimitive.Content.displayName
106
+
107
+ const SelectLabel = React.forwardRef<
108
+ React.ElementRef<typeof SelectPrimitive.Label>,
109
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
110
+ >(({ className, ...props }, ref) => (
111
+ <SelectPrimitive.Label
112
+ ref={ref}
113
+ className={cn("px-2 py-1.5 text-sm font-semibold", className)}
114
+ {...props}
115
+ />
116
+ ))
117
+ SelectLabel.displayName = SelectPrimitive.Label.displayName
118
+
119
+ const SelectItem = React.forwardRef<
120
+ React.ElementRef<typeof SelectPrimitive.Item>,
121
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
122
+ >(({ className, children, ...props }, ref) => (
123
+ <SelectPrimitive.Item
124
+ ref={ref}
125
+ className={cn(
126
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
127
+ className
128
+ )}
129
+ {...props}
130
+ >
131
+ <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
132
+ <SelectPrimitive.ItemIndicator>
133
+ <CheckIcon className="h-4 w-4" />
134
+ </SelectPrimitive.ItemIndicator>
135
+ </span>
136
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
137
+ </SelectPrimitive.Item>
138
+ ))
139
+ SelectItem.displayName = SelectPrimitive.Item.displayName
140
+
141
+ const SelectSeparator = React.forwardRef<
142
+ React.ElementRef<typeof SelectPrimitive.Separator>,
143
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
144
+ >(({ className, ...props }, ref) => (
145
+ <SelectPrimitive.Separator
146
+ ref={ref}
147
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
148
+ {...props}
149
+ />
150
+ ))
151
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName
152
+
153
+ export {
154
+ Select,
155
+ SelectGroup,
156
+ SelectValue,
157
+ SelectTrigger,
158
+ SelectContent,
159
+ SelectLabel,
160
+ SelectItem,
161
+ SelectSeparator,
162
+ SelectScrollUpButton,
163
+ SelectScrollDownButton,
164
+ }
@@ -0,0 +1,107 @@
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import * as SheetPrimitive from '@radix-ui/react-dialog'
5
+ import { Cross2Icon } from '@radix-ui/react-icons'
6
+ import { cva, type VariantProps } from 'class-variance-authority'
7
+
8
+ import { cn } from 'nextjs-cms/utils'
9
+
10
+ const Sheet = SheetPrimitive.Root
11
+
12
+ const SheetTrigger = SheetPrimitive.Trigger
13
+
14
+ const SheetClose = SheetPrimitive.Close
15
+
16
+ const SheetPortal = SheetPrimitive.Portal
17
+
18
+ const SheetOverlay = React.forwardRef<
19
+ React.ElementRef<typeof SheetPrimitive.Overlay>,
20
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
21
+ >(({ className, ...props }, ref) => (
22
+ <SheetPrimitive.Overlay
23
+ className={cn(
24
+ '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',
25
+ className,
26
+ )}
27
+ {...props}
28
+ ref={ref}
29
+ />
30
+ ))
31
+ SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
32
+
33
+ const sheetVariants = cva(
34
+ 'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-200',
35
+ {
36
+ variants: {
37
+ side: {
38
+ top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
39
+ bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
40
+ left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
41
+ right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
42
+ },
43
+ },
44
+ defaultVariants: {
45
+ side: 'right',
46
+ },
47
+ },
48
+ )
49
+
50
+ interface SheetContentProps
51
+ extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
52
+ VariantProps<typeof sheetVariants> {}
53
+
54
+ const SheetContent = React.forwardRef<React.ElementRef<typeof SheetPrimitive.Content>, SheetContentProps>(
55
+ ({ side = 'right', className, children, ...props }, ref) => (
56
+ <SheetPortal>
57
+ <SheetOverlay />
58
+ <SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
59
+ {children}
60
+ <SheetPrimitive.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-secondary'>
61
+ <Cross2Icon className='h-4 w-4' />
62
+ <span className='sr-only'>Close</span>
63
+ </SheetPrimitive.Close>
64
+ </SheetPrimitive.Content>
65
+ </SheetPortal>
66
+ ),
67
+ )
68
+ SheetContent.displayName = SheetPrimitive.Content.displayName
69
+
70
+ const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
71
+ <div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
72
+ )
73
+ SheetHeader.displayName = 'SheetHeader'
74
+
75
+ const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
76
+ <div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
77
+ )
78
+ SheetFooter.displayName = 'SheetFooter'
79
+
80
+ const SheetTitle = React.forwardRef<
81
+ React.ElementRef<typeof SheetPrimitive.Title>,
82
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
83
+ >(({ className, ...props }, ref) => (
84
+ <SheetPrimitive.Title ref={ref} className={cn('text-lg font-semibold text-foreground', className)} {...props} />
85
+ ))
86
+ SheetTitle.displayName = SheetPrimitive.Title.displayName
87
+
88
+ const SheetDescription = React.forwardRef<
89
+ React.ElementRef<typeof SheetPrimitive.Description>,
90
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
91
+ >(({ className, ...props }, ref) => (
92
+ <SheetPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
93
+ ))
94
+ SheetDescription.displayName = SheetPrimitive.Description.displayName
95
+
96
+ export {
97
+ Sheet,
98
+ SheetPortal,
99
+ SheetOverlay,
100
+ SheetTrigger,
101
+ SheetClose,
102
+ SheetContent,
103
+ SheetHeader,
104
+ SheetFooter,
105
+ SheetTitle,
106
+ SheetDescription,
107
+ }
@@ -0,0 +1,29 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
5
+
6
+ import { cn } from 'nextjs-cms/utils'
7
+
8
+ const Switch = React.forwardRef<
9
+ React.ElementRef<typeof SwitchPrimitives.Root>,
10
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <SwitchPrimitives.Root
13
+ className={cn(
14
+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
15
+ className
16
+ )}
17
+ {...props}
18
+ ref={ref}
19
+ >
20
+ <SwitchPrimitives.Thumb
21
+ className={cn(
22
+ "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
23
+ )}
24
+ />
25
+ </SwitchPrimitives.Root>
26
+ ))
27
+ Switch.displayName = SwitchPrimitives.Root.displayName
28
+
29
+ export { Switch }