nexstruct 1.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 (229) hide show
  1. package/AGENTS.md +122 -0
  2. package/LICENSE +21 -0
  3. package/README.md +103 -0
  4. package/package.json +99 -0
  5. package/scaffold/generator.js +409 -0
  6. package/scaffold/index.js +20 -0
  7. package/scaffold/prompts.js +108 -0
  8. package/templates/api/axios/src/api/axios/client.api.ts +30 -0
  9. package/templates/api/axios/src/api/axios/users.api.ts +15 -0
  10. package/templates/api/fetch/src/api/fetch/client.api.ts +68 -0
  11. package/templates/api/fetch/src/api/fetch/users.api.ts +15 -0
  12. package/templates/api/trpc/src/api/trpc/client.api.ts +4 -0
  13. package/templates/api/trpc/src/api/trpc/router.api.ts +15 -0
  14. package/templates/api/trpc/src/api/trpc/server.client.api.ts +4 -0
  15. package/templates/api/trpc/src/providers/trpc.provider.tsx +24 -0
  16. package/templates/auth/clerk/src/auth/clerk/auth.service.ts +4 -0
  17. package/templates/auth/clerk/src/hooks/use-auth.hook.ts +13 -0
  18. package/templates/auth/clerk/src/middleware.ts +7 -0
  19. package/templates/auth/clerk/src/providers/auth.provider.tsx +6 -0
  20. package/templates/auth/next-auth/src/app/api/auth/[...nextauth]/route.ts +5 -0
  21. package/templates/auth/next-auth/src/auth/next-auth/auth.service.ts +45 -0
  22. package/templates/auth/next-auth/src/hooks/use-session.hook.ts +13 -0
  23. package/templates/auth/next-auth/src/providers/session.provider.tsx +6 -0
  24. package/templates/forms/formik/src/components/forms/login-form.component.tsx +30 -0
  25. package/templates/forms/formik/src/forms/formik/hooks/use-form-config.hook.ts +7 -0
  26. package/templates/forms/formik/src/forms/formik/schemas/example.schema.ts +8 -0
  27. package/templates/forms/react-hook-form/src/components/forms/login-form.component.tsx +27 -0
  28. package/templates/forms/react-hook-form/src/forms/react-hook-form/hooks/use-form.hook.ts +13 -0
  29. package/templates/forms/react-hook-form/src/forms/react-hook-form/schemas/example.schema.ts +15 -0
  30. package/templates/nextjs-base/next.config.ts +5 -0
  31. package/templates/nextjs-base/postcss.config.mjs +9 -0
  32. package/templates/nextjs-base/src/app/_components/navbar.tsx +88 -0
  33. package/templates/nextjs-base/src/app/_components/sidebar.tsx +223 -0
  34. package/templates/nextjs-base/src/app/error.tsx +39 -0
  35. package/templates/nextjs-base/src/app/globals.css +71 -0
  36. package/templates/nextjs-base/src/app/layout.tsx +21 -0
  37. package/templates/nextjs-base/src/app/loading.tsx +13 -0
  38. package/templates/nextjs-base/src/app/not-found.tsx +22 -0
  39. package/templates/nextjs-base/src/app/page.tsx +10 -0
  40. package/templates/nextjs-base/tailwind.config.ts +69 -0
  41. package/templates/shared/src/components/common/theme-toggle.component.tsx +31 -0
  42. package/templates/shared/src/components/common/toast/custom-message.component.tsx +18 -0
  43. package/templates/shared/src/components/common/toast/index.ts +8 -0
  44. package/templates/shared/src/components/common/toast/toast-message.component.tsx +112 -0
  45. package/templates/shared/src/hooks/use-debounce.hook.ts +12 -0
  46. package/templates/shared/src/hooks/use-fetch.hook.ts +42 -0
  47. package/templates/shared/src/hooks/use-intersection-observer.hook.ts +39 -0
  48. package/templates/shared/src/hooks/use-local-storage.hook.ts +30 -0
  49. package/templates/shared/src/hooks/use-media-query.hook.ts +26 -0
  50. package/templates/shared/src/hooks/use-toggle.hook.ts +12 -0
  51. package/templates/shared/src/lib/utils.util.ts +361 -0
  52. package/templates/shared/src/providers/theme.provider.tsx +17 -0
  53. package/templates/shared/src/providers/toast.provider.tsx +32 -0
  54. package/templates/shared/src/types/common.type.ts +34 -0
  55. package/templates/state/context/src/store/context/auth.context.tsx +47 -0
  56. package/templates/state/context/src/store/context/counter.context.tsx +41 -0
  57. package/templates/state/context/src/store/context/index.ts +2 -0
  58. package/templates/state/redux/src/providers/redux.provider.tsx +7 -0
  59. package/templates/state/redux/src/store/redux/hooks.store.ts +5 -0
  60. package/templates/state/redux/src/store/redux/index.ts +4 -0
  61. package/templates/state/redux/src/store/redux/slices/api.slice.ts +8 -0
  62. package/templates/state/redux/src/store/redux/slices/counter.slice.ts +24 -0
  63. package/templates/state/redux/src/store/redux/store.store.ts +13 -0
  64. package/templates/state/zustand/src/store/zustand/counter.store.ts +15 -0
  65. package/templates/state/zustand/src/store/zustand/index.ts +2 -0
  66. package/templates/state/zustand/src/store/zustand/user.store.ts +32 -0
  67. package/templates/ui/antd/COMPONENT_GUIDE.md +326 -0
  68. package/templates/ui/antd/src/app/examples/dialog/page.tsx +205 -0
  69. package/templates/ui/antd/src/app/examples/form/page.tsx +160 -0
  70. package/templates/ui/antd/src/app/examples/layout.tsx +125 -0
  71. package/templates/ui/antd/src/app/examples/page.tsx +64 -0
  72. package/templates/ui/antd/src/app/examples/table/page.tsx +118 -0
  73. package/templates/ui/antd/src/app/page.tsx +283 -0
  74. package/templates/ui/antd/src/components/common/DynamicTable/dynamic-table.component.tsx +79 -0
  75. package/templates/ui/antd/src/components/common/button/action-button.component.tsx +63 -0
  76. package/templates/ui/antd/src/components/common/dialog/dialog-wrapper.component.tsx +63 -0
  77. package/templates/ui/antd/src/components/common/fields/assets/components/check-field.component.tsx +55 -0
  78. package/templates/ui/antd/src/components/common/fields/assets/components/date-picker-field.component.tsx +80 -0
  79. package/templates/ui/antd/src/components/common/fields/assets/components/limit-field.component.tsx +26 -0
  80. package/templates/ui/antd/src/components/common/fields/assets/components/multi-check-field.component.tsx +56 -0
  81. package/templates/ui/antd/src/components/common/fields/assets/components/number-field.component.tsx +100 -0
  82. package/templates/ui/antd/src/components/common/fields/assets/components/otp-field.component.tsx +63 -0
  83. package/templates/ui/antd/src/components/common/fields/assets/components/password-field.component.tsx +106 -0
  84. package/templates/ui/antd/src/components/common/fields/assets/components/phone-number-field.component.tsx +78 -0
  85. package/templates/ui/antd/src/components/common/fields/assets/components/radio-field.component.tsx +55 -0
  86. package/templates/ui/antd/src/components/common/fields/assets/components/range-date-picker.component.tsx +66 -0
  87. package/templates/ui/antd/src/components/common/fields/assets/components/search-field.component.tsx +24 -0
  88. package/templates/ui/antd/src/components/common/fields/assets/components/select-field.component.tsx +82 -0
  89. package/templates/ui/antd/src/components/common/fields/assets/components/single-check-field.component.tsx +50 -0
  90. package/templates/ui/antd/src/components/common/fields/assets/components/single-select-field.component.tsx +86 -0
  91. package/templates/ui/antd/src/components/common/fields/assets/components/string-number-field.component.tsx +80 -0
  92. package/templates/ui/antd/src/components/common/fields/assets/components/switch-field.component.tsx +62 -0
  93. package/templates/ui/antd/src/components/common/fields/assets/components/text-area-field.component.tsx +85 -0
  94. package/templates/ui/antd/src/components/common/fields/assets/components/text-field.component.tsx +88 -0
  95. package/templates/ui/antd/src/components/common/fields/assets/interface/input-props.type.ts +233 -0
  96. package/templates/ui/antd/src/components/common/fields/cusInputField.component.tsx +40 -0
  97. package/templates/ui/antd/src/components/common/pagination/pagination.component.tsx +27 -0
  98. package/templates/ui/antd/src/components/ui/avatar.component.tsx +8 -0
  99. package/templates/ui/antd/src/components/ui/badge.component.tsx +8 -0
  100. package/templates/ui/antd/src/components/ui/button.component.tsx +8 -0
  101. package/templates/ui/antd/src/components/ui/card.component.tsx +8 -0
  102. package/templates/ui/antd/src/components/ui/checkbox.component.tsx +8 -0
  103. package/templates/ui/antd/src/components/ui/dialog.component.tsx +9 -0
  104. package/templates/ui/antd/src/components/ui/dropdown-menu.component.tsx +10 -0
  105. package/templates/ui/antd/src/components/ui/form.component.tsx +12 -0
  106. package/templates/ui/antd/src/components/ui/input.component.tsx +13 -0
  107. package/templates/ui/antd/src/components/ui/label.component.tsx +18 -0
  108. package/templates/ui/antd/src/components/ui/popover.component.tsx +8 -0
  109. package/templates/ui/antd/src/components/ui/progress.component.tsx +8 -0
  110. package/templates/ui/antd/src/components/ui/radio-group.component.tsx +10 -0
  111. package/templates/ui/antd/src/components/ui/scroll-area.component.tsx +25 -0
  112. package/templates/ui/antd/src/components/ui/select.component.tsx +8 -0
  113. package/templates/ui/antd/src/components/ui/separator.component.tsx +8 -0
  114. package/templates/ui/antd/src/components/ui/sheet.component.tsx +8 -0
  115. package/templates/ui/antd/src/components/ui/switch.component.tsx +8 -0
  116. package/templates/ui/antd/src/components/ui/table.component.tsx +8 -0
  117. package/templates/ui/antd/src/components/ui/tabs.component.tsx +8 -0
  118. package/templates/ui/antd/src/components/ui/textarea.component.tsx +9 -0
  119. package/templates/ui/antd/src/components/ui/tooltip.component.tsx +8 -0
  120. package/templates/ui/antd/src/lib/theme.util.ts +40 -0
  121. package/templates/ui/antd/src/providers/antd.provider.tsx +13 -0
  122. package/templates/ui/mui/src/app/examples/layout.tsx +113 -0
  123. package/templates/ui/mui/src/app/examples/page.tsx +716 -0
  124. package/templates/ui/mui/src/app/page.tsx +298 -0
  125. package/templates/ui/mui/src/components/common/DynamicTable/dynamic-table.component.tsx +131 -0
  126. package/templates/ui/mui/src/components/common/button/action-button.component.tsx +57 -0
  127. package/templates/ui/mui/src/components/common/dialog/dialog-wrapper.component.tsx +55 -0
  128. package/templates/ui/mui/src/components/common/fields/assets/components/check-field.component.tsx +51 -0
  129. package/templates/ui/mui/src/components/common/fields/assets/components/date-picker-field.component.tsx +50 -0
  130. package/templates/ui/mui/src/components/common/fields/assets/components/multi-check-field.component.tsx +14 -0
  131. package/templates/ui/mui/src/components/common/fields/assets/components/number-field.component.tsx +59 -0
  132. package/templates/ui/mui/src/components/common/fields/assets/components/password-field.component.tsx +87 -0
  133. package/templates/ui/mui/src/components/common/fields/assets/components/phone-number-field.component.tsx +48 -0
  134. package/templates/ui/mui/src/components/common/fields/assets/components/radio-field.component.tsx +37 -0
  135. package/templates/ui/mui/src/components/common/fields/assets/components/search-field.component.tsx +41 -0
  136. package/templates/ui/mui/src/components/common/fields/assets/components/select-field.component.tsx +77 -0
  137. package/templates/ui/mui/src/components/common/fields/assets/components/single-check-field.component.tsx +39 -0
  138. package/templates/ui/mui/src/components/common/fields/assets/components/single-select-field.component.tsx +56 -0
  139. package/templates/ui/mui/src/components/common/fields/assets/components/string-number-field.component.tsx +52 -0
  140. package/templates/ui/mui/src/components/common/fields/assets/components/switch-field.component.tsx +35 -0
  141. package/templates/ui/mui/src/components/common/fields/assets/components/text-area-field.component.tsx +46 -0
  142. package/templates/ui/mui/src/components/common/fields/assets/components/text-field.component.tsx +51 -0
  143. package/templates/ui/mui/src/components/common/fields/assets/interface/input-props.type.ts +193 -0
  144. package/templates/ui/mui/src/components/common/fields/cusInputField.component.tsx +34 -0
  145. package/templates/ui/mui/src/components/common/pagination/pagination.component.tsx +59 -0
  146. package/templates/ui/mui/src/components/ui/avatar.component.tsx +19 -0
  147. package/templates/ui/mui/src/components/ui/badge.component.tsx +18 -0
  148. package/templates/ui/mui/src/components/ui/button.component.tsx +22 -0
  149. package/templates/ui/mui/src/components/ui/card.component.tsx +39 -0
  150. package/templates/ui/mui/src/components/ui/checkbox.component.tsx +21 -0
  151. package/templates/ui/mui/src/components/ui/dialog.component.tsx +38 -0
  152. package/templates/ui/mui/src/components/ui/dropdown-menu.component.tsx +43 -0
  153. package/templates/ui/mui/src/components/ui/form.component.tsx +98 -0
  154. package/templates/ui/mui/src/components/ui/input.component.tsx +15 -0
  155. package/templates/ui/mui/src/components/ui/label.component.tsx +15 -0
  156. package/templates/ui/mui/src/components/ui/popover.component.tsx +20 -0
  157. package/templates/ui/mui/src/components/ui/progress.component.tsx +19 -0
  158. package/templates/ui/mui/src/components/ui/radio-group.component.tsx +25 -0
  159. package/templates/ui/mui/src/components/ui/scroll-area.component.tsx +27 -0
  160. package/templates/ui/mui/src/components/ui/select.component.tsx +26 -0
  161. package/templates/ui/mui/src/components/ui/separator.component.tsx +11 -0
  162. package/templates/ui/mui/src/components/ui/sheet.component.tsx +44 -0
  163. package/templates/ui/mui/src/components/ui/switch.component.tsx +23 -0
  164. package/templates/ui/mui/src/components/ui/table.component.tsx +34 -0
  165. package/templates/ui/mui/src/components/ui/tabs.component.tsx +38 -0
  166. package/templates/ui/mui/src/components/ui/textarea.component.tsx +18 -0
  167. package/templates/ui/mui/src/components/ui/tooltip.component.tsx +24 -0
  168. package/templates/ui/mui/src/lib/theme.util.ts +73 -0
  169. package/templates/ui/mui/src/providers/mui.provider.tsx +13 -0
  170. package/templates/ui/shadcn/COMPONENT_GUIDE.md +306 -0
  171. package/templates/ui/shadcn/src/app/examples/dialog/page.tsx +122 -0
  172. package/templates/ui/shadcn/src/app/examples/form/page.tsx +107 -0
  173. package/templates/ui/shadcn/src/app/examples/layout.tsx +24 -0
  174. package/templates/ui/shadcn/src/app/examples/page.tsx +30 -0
  175. package/templates/ui/shadcn/src/app/examples/table/page.tsx +77 -0
  176. package/templates/ui/shadcn/src/app/page.tsx +20 -0
  177. package/templates/ui/shadcn/src/components/common/DynamicTable/dynamic-table.component.tsx +136 -0
  178. package/templates/ui/shadcn/src/components/common/button/action-button.component.tsx +68 -0
  179. package/templates/ui/shadcn/src/components/common/dialog/dialog-wrapper.component.tsx +58 -0
  180. package/templates/ui/shadcn/src/components/common/fields/assets/components/check-field.component.tsx +52 -0
  181. package/templates/ui/shadcn/src/components/common/fields/assets/components/date-picker-field.component.tsx +62 -0
  182. package/templates/ui/shadcn/src/components/common/fields/assets/components/dynamic-file-upload-field.component.tsx +152 -0
  183. package/templates/ui/shadcn/src/components/common/fields/assets/components/limit-field.component.tsx +73 -0
  184. package/templates/ui/shadcn/src/components/common/fields/assets/components/multi-check-field.component.tsx +46 -0
  185. package/templates/ui/shadcn/src/components/common/fields/assets/components/number-field.component.tsx +124 -0
  186. package/templates/ui/shadcn/src/components/common/fields/assets/components/otp-field.component.tsx +61 -0
  187. package/templates/ui/shadcn/src/components/common/fields/assets/components/password-field.component.tsx +110 -0
  188. package/templates/ui/shadcn/src/components/common/fields/assets/components/phone-number-field.component.tsx +90 -0
  189. package/templates/ui/shadcn/src/components/common/fields/assets/components/radio-field.component.tsx +41 -0
  190. package/templates/ui/shadcn/src/components/common/fields/assets/components/range-date-picker.component.tsx +71 -0
  191. package/templates/ui/shadcn/src/components/common/fields/assets/components/rich-text-editor.component.tsx +91 -0
  192. package/templates/ui/shadcn/src/components/common/fields/assets/components/search-field.component.tsx +34 -0
  193. package/templates/ui/shadcn/src/components/common/fields/assets/components/select-field.component.tsx +231 -0
  194. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-check-field.component.tsx +42 -0
  195. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-select-field.component.tsx +82 -0
  196. package/templates/ui/shadcn/src/components/common/fields/assets/components/string-number-field.component.tsx +68 -0
  197. package/templates/ui/shadcn/src/components/common/fields/assets/components/switch-field.component.tsx +61 -0
  198. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-field.component.tsx +62 -0
  199. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-with-file.component.tsx +142 -0
  200. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-field.component.tsx +80 -0
  201. package/templates/ui/shadcn/src/components/common/fields/assets/components/tiny-editor.component.tsx +51 -0
  202. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-profile-picture.component.tsx +103 -0
  203. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-video-file.component.tsx +86 -0
  204. package/templates/ui/shadcn/src/components/common/fields/assets/interface/input-props.type.ts +198 -0
  205. package/templates/ui/shadcn/src/components/common/fields/cusInputField.component.tsx +52 -0
  206. package/templates/ui/shadcn/src/components/common/pagination/pagination.component.tsx +68 -0
  207. package/templates/ui/shadcn/src/components/ui/avatar.component.tsx +37 -0
  208. package/templates/ui/shadcn/src/components/ui/badge.component.tsx +28 -0
  209. package/templates/ui/shadcn/src/components/ui/button.component.tsx +52 -0
  210. package/templates/ui/shadcn/src/components/ui/card.component.tsx +46 -0
  211. package/templates/ui/shadcn/src/components/ui/checkbox.component.tsx +25 -0
  212. package/templates/ui/shadcn/src/components/ui/dialog.component.tsx +98 -0
  213. package/templates/ui/shadcn/src/components/ui/dropdown-menu.component.tsx +163 -0
  214. package/templates/ui/shadcn/src/components/ui/form.component.tsx +110 -0
  215. package/templates/ui/shadcn/src/components/ui/input-otp.component.tsx +64 -0
  216. package/templates/ui/shadcn/src/components/ui/input.component.tsx +23 -0
  217. package/templates/ui/shadcn/src/components/ui/label.component.tsx +23 -0
  218. package/templates/ui/shadcn/src/components/ui/popover.component.tsx +27 -0
  219. package/templates/ui/shadcn/src/components/ui/progress.component.tsx +22 -0
  220. package/templates/ui/shadcn/src/components/ui/radio-group.component.tsx +33 -0
  221. package/templates/ui/shadcn/src/components/ui/scroll-area.component.tsx +37 -0
  222. package/templates/ui/shadcn/src/components/ui/select.component.tsx +139 -0
  223. package/templates/ui/shadcn/src/components/ui/separator.component.tsx +23 -0
  224. package/templates/ui/shadcn/src/components/ui/sheet.component.tsx +89 -0
  225. package/templates/ui/shadcn/src/components/ui/switch.component.tsx +26 -0
  226. package/templates/ui/shadcn/src/components/ui/table.component.tsx +71 -0
  227. package/templates/ui/shadcn/src/components/ui/tabs.component.tsx +52 -0
  228. package/templates/ui/shadcn/src/components/ui/textarea.component.tsx +20 -0
  229. package/templates/ui/shadcn/src/components/ui/tooltip.component.tsx +25 -0
@@ -0,0 +1,98 @@
1
+ import * as React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import { X } from 'lucide-react';
4
+ import { cn } from '@/lib/utils.util';
5
+
6
+ const Dialog = DialogPrimitive.Root;
7
+
8
+ const DialogTrigger = DialogPrimitive.Trigger;
9
+
10
+ const DialogClose = DialogPrimitive.Close;
11
+
12
+ const DialogPortal = DialogPrimitive.Portal;
13
+
14
+ const DialogOverlay = React.forwardRef<
15
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
16
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
17
+ >(({ className, ...props }, ref) => (
18
+ <DialogPrimitive.Overlay
19
+ ref={ref}
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
+ />
26
+ ));
27
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
28
+
29
+ const DialogContent = React.forwardRef<
30
+ React.ElementRef<typeof DialogPrimitive.Content>,
31
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
32
+ >(({ className, children, ...props }, ref) => (
33
+ <DialogPortal>
34
+ <DialogOverlay />
35
+ <DialogPrimitive.Content
36
+ ref={ref}
37
+ className={cn(
38
+ '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',
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {children}
44
+ <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">
45
+ <X className="h-4 w-4" />
46
+ <span className="sr-only">Close</span>
47
+ </DialogPrimitive.Close>
48
+ </DialogPrimitive.Content>
49
+ </DialogPortal>
50
+ ));
51
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
52
+
53
+ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
54
+ <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />
55
+ );
56
+ DialogHeader.displayName = 'DialogHeader';
57
+
58
+ const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
59
+ <div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
60
+ );
61
+ DialogFooter.displayName = 'DialogFooter';
62
+
63
+ const DialogTitle = React.forwardRef<
64
+ React.ElementRef<typeof DialogPrimitive.Title>,
65
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
66
+ >(({ className, ...props }, ref) => (
67
+ <DialogPrimitive.Title
68
+ ref={ref}
69
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
70
+ {...props}
71
+ />
72
+ ));
73
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
74
+
75
+ const DialogDescription = React.forwardRef<
76
+ React.ElementRef<typeof DialogPrimitive.Description>,
77
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
78
+ >(({ className, ...props }, ref) => (
79
+ <DialogPrimitive.Description
80
+ ref={ref}
81
+ className={cn('text-sm text-muted-foreground', className)}
82
+ {...props}
83
+ />
84
+ ));
85
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
86
+
87
+ export {
88
+ Dialog,
89
+ DialogPortal,
90
+ DialogOverlay,
91
+ DialogClose,
92
+ DialogTrigger,
93
+ DialogContent,
94
+ DialogHeader,
95
+ DialogFooter,
96
+ DialogTitle,
97
+ DialogDescription,
98
+ };
@@ -0,0 +1,163 @@
1
+ import * as React from 'react';
2
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
+ import { Check, ChevronRight, Circle } from 'lucide-react';
4
+ import { cn } from '@/lib/utils.util';
5
+
6
+ const DropdownMenu = DropdownMenuPrimitive.Root;
7
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
8
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
9
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
10
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
11
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
12
+
13
+ const DropdownMenuSubTrigger = React.forwardRef<
14
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
15
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }
16
+ >(({ className, inset, children, ...props }, ref) => (
17
+ <DropdownMenuPrimitive.SubTrigger
18
+ ref={ref}
19
+ className={cn(
20
+ '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',
21
+ inset && 'pl-8',
22
+ className
23
+ )}
24
+ {...props}
25
+ >
26
+ {children}
27
+ <ChevronRight className="ml-auto h-4 w-4" />
28
+ </DropdownMenuPrimitive.SubTrigger>
29
+ ));
30
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
31
+
32
+ const DropdownMenuSubContent = React.forwardRef<
33
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
34
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
35
+ >(({ className, ...props }, ref) => (
36
+ <DropdownMenuPrimitive.SubContent
37
+ ref={ref}
38
+ className={cn(
39
+ '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',
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ ));
45
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
46
+
47
+ const DropdownMenuContent = React.forwardRef<
48
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
49
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
50
+ >(({ className, sideOffset = 4, ...props }, ref) => (
51
+ <DropdownMenuPrimitive.Portal>
52
+ <DropdownMenuPrimitive.Content
53
+ ref={ref}
54
+ sideOffset={sideOffset}
55
+ className={cn(
56
+ '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',
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ </DropdownMenuPrimitive.Portal>
62
+ ));
63
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
64
+
65
+ const DropdownMenuItem = React.forwardRef<
66
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
67
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }
68
+ >(({ className, inset, ...props }, ref) => (
69
+ <DropdownMenuPrimitive.Item
70
+ ref={ref}
71
+ className={cn(
72
+ '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',
73
+ inset && 'pl-8',
74
+ className
75
+ )}
76
+ {...props}
77
+ />
78
+ ));
79
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
80
+
81
+ const DropdownMenuCheckboxItem = React.forwardRef<
82
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
83
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
84
+ >(({ className, children, checked, ...props }, ref) => (
85
+ <DropdownMenuPrimitive.CheckboxItem
86
+ ref={ref}
87
+ className={cn(
88
+ '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',
89
+ className
90
+ )}
91
+ checked={checked}
92
+ {...props}
93
+ >
94
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
95
+ <DropdownMenuPrimitive.ItemIndicator>
96
+ <Check className="h-4 w-4" />
97
+ </DropdownMenuPrimitive.ItemIndicator>
98
+ </span>
99
+ {children}
100
+ </DropdownMenuPrimitive.CheckboxItem>
101
+ ));
102
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
103
+
104
+ const DropdownMenuRadioItem = React.forwardRef<
105
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
106
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
107
+ >(({ className, children, ...props }, ref) => (
108
+ <DropdownMenuPrimitive.RadioItem
109
+ ref={ref}
110
+ className={cn(
111
+ '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',
112
+ className
113
+ )}
114
+ {...props}
115
+ >
116
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
117
+ <DropdownMenuPrimitive.ItemIndicator>
118
+ <Circle className="h-2 w-2 fill-current" />
119
+ </DropdownMenuPrimitive.ItemIndicator>
120
+ </span>
121
+ {children}
122
+ </DropdownMenuPrimitive.RadioItem>
123
+ ));
124
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
125
+
126
+ const DropdownMenuLabel = React.forwardRef<
127
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
128
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }
129
+ >(({ className, inset, ...props }, ref) => (
130
+ <DropdownMenuPrimitive.Label ref={ref} className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)} {...props} />
131
+ ));
132
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
133
+
134
+ const DropdownMenuSeparator = React.forwardRef<
135
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
136
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
137
+ >(({ className, ...props }, ref) => (
138
+ <DropdownMenuPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-muted', className)} {...props} />
139
+ ));
140
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
141
+
142
+ const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (
143
+ <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />
144
+ );
145
+ DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
146
+
147
+ export {
148
+ DropdownMenu,
149
+ DropdownMenuTrigger,
150
+ DropdownMenuContent,
151
+ DropdownMenuItem,
152
+ DropdownMenuCheckboxItem,
153
+ DropdownMenuRadioItem,
154
+ DropdownMenuLabel,
155
+ DropdownMenuSeparator,
156
+ DropdownMenuShortcut,
157
+ DropdownMenuGroup,
158
+ DropdownMenuPortal,
159
+ DropdownMenuSub,
160
+ DropdownMenuSubContent,
161
+ DropdownMenuSubTrigger,
162
+ DropdownMenuRadioGroup,
163
+ };
@@ -0,0 +1,110 @@
1
+ import * as React from 'react';
2
+ import type * as LabelPrimitive from '@radix-ui/react-label';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+ import {
5
+ Controller,
6
+ type ControllerProps,
7
+ type FieldPath,
8
+ type FieldValues,
9
+ FormProvider,
10
+ useFormContext,
11
+ } from 'react-hook-form';
12
+ import { cn } from '@/lib/utils.util';
13
+ import { Label } from './label.component';
14
+
15
+ const Form = FormProvider;
16
+
17
+ type FormFieldContextValue<
18
+ TFieldValues extends FieldValues = FieldValues,
19
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
20
+ > = { name: TName };
21
+
22
+ const FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);
23
+
24
+ const FormField = <
25
+ TFieldValues extends FieldValues = FieldValues,
26
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
27
+ >(props: ControllerProps<TFieldValues, TName>) => {
28
+ return (
29
+ <FormFieldContext.Provider value={{ name: props.name }}>
30
+ <Controller {...props} />
31
+ </FormFieldContext.Provider>
32
+ );
33
+ };
34
+
35
+ const useFormField = () => {
36
+ const fieldContext = React.useContext(FormFieldContext);
37
+ const itemContext = React.useContext(FormItemContext);
38
+ if (!fieldContext) throw new Error('useFormField should be used within <FormField>');
39
+ const formContext = useFormContext();
40
+ const fieldState = formContext
41
+ ? formContext.getFieldState(fieldContext.name, formContext.formState)
42
+ : { invalid: false, isDirty: false, isTouched: false, error: undefined };
43
+ const { id } = itemContext;
44
+ return { id, name: fieldContext.name, formItemId: `${id}-form-item`, formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState };
45
+ };
46
+
47
+ type FormItemContextValue = { id: string };
48
+ const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);
49
+
50
+ const FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
51
+ ({ className, ...props }, ref) => {
52
+ const id = React.useId();
53
+ return (
54
+ <FormItemContext.Provider value={{ id }}>
55
+ <div ref={ref} className={cn('space-y-2', className)} {...props} />
56
+ </FormItemContext.Provider>
57
+ );
58
+ }
59
+ );
60
+ FormItem.displayName = 'FormItem';
61
+
62
+ const FormLabel = React.forwardRef<
63
+ React.ElementRef<typeof LabelPrimitive.Root>,
64
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
65
+ >(({ className, ...props }, ref) => {
66
+ const { error, formItemId } = useFormField();
67
+ return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;
68
+ });
69
+ FormLabel.displayName = 'FormLabel';
70
+
71
+ const FormControl = React.forwardRef<
72
+ React.ElementRef<typeof Slot>,
73
+ React.ComponentPropsWithoutRef<typeof Slot>
74
+ >(({ ...props }, ref) => {
75
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
76
+ return (
77
+ <Slot
78
+ ref={ref}
79
+ id={formItemId}
80
+ aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
81
+ aria-invalid={!!error}
82
+ {...props}
83
+ />
84
+ );
85
+ });
86
+ FormControl.displayName = 'FormControl';
87
+
88
+ const FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
89
+ ({ className, ...props }, ref) => {
90
+ const { formDescriptionId } = useFormField();
91
+ return <p ref={ref} id={formDescriptionId} className={cn('text-sm text-muted-foreground', className)} {...props} />;
92
+ }
93
+ );
94
+ FormDescription.displayName = 'FormDescription';
95
+
96
+ const FormMessage = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
97
+ ({ className, children, ...props }, ref) => {
98
+ const { error, formMessageId } = useFormField();
99
+ const body = error ? String(error?.message) : children;
100
+ if (!body) return null;
101
+ return (
102
+ <p ref={ref} id={formMessageId} className={cn('text-sm font-medium text-destructive', className)} {...props}>
103
+ {body}
104
+ </p>
105
+ );
106
+ }
107
+ );
108
+ FormMessage.displayName = 'FormMessage';
109
+
110
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
@@ -0,0 +1,64 @@
1
+ import * as React from 'react';
2
+ import { OTPInput, OTPInputContext } from 'input-otp';
3
+ import { Minus } from 'lucide-react';
4
+ import { cn } from '@/lib/utils.util';
5
+
6
+ const InputOTP = React.forwardRef<
7
+ React.ElementRef<typeof OTPInput>,
8
+ React.ComponentPropsWithoutRef<typeof OTPInput>
9
+ >(({ className, containerClassName, ...props }, ref) => (
10
+ <OTPInput
11
+ ref={ref}
12
+ containerClassName={cn('flex items-center gap-2 has-[:disabled]:opacity-50', containerClassName)}
13
+ className={cn('disabled:cursor-not-allowed', className)}
14
+ {...props}
15
+ />
16
+ ));
17
+ InputOTP.displayName = 'InputOTP';
18
+
19
+ const InputOTPGroup = React.forwardRef<
20
+ React.ElementRef<'div'>,
21
+ React.ComponentPropsWithoutRef<'div'>
22
+ >(({ className, ...props }, ref) => (
23
+ <div ref={ref} className={cn('flex items-center', className)} {...props} />
24
+ ));
25
+ InputOTPGroup.displayName = 'InputOTPGroup';
26
+
27
+ const InputOTPSlot = React.forwardRef<
28
+ React.ElementRef<'div'>,
29
+ React.ComponentPropsWithoutRef<'div'> & { index: number }
30
+ >(({ index, className, ...props }, ref) => {
31
+ const inputOTPContext = React.useContext(OTPInputContext);
32
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
33
+ return (
34
+ <div
35
+ ref={ref}
36
+ className={cn(
37
+ 'relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
38
+ isActive && 'z-10 ring-2 ring-ring ring-offset-background',
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {char}
44
+ {hasFakeCaret && (
45
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
46
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
47
+ </div>
48
+ )}
49
+ </div>
50
+ );
51
+ });
52
+ InputOTPSlot.displayName = 'InputOTPSlot';
53
+
54
+ const InputOTPSeparator = React.forwardRef<
55
+ React.ElementRef<'div'>,
56
+ React.ComponentPropsWithoutRef<'div'>
57
+ >(({ ...props }, ref) => (
58
+ <div ref={ref} role="separator" {...props}>
59
+ <Minus />
60
+ </div>
61
+ ));
62
+ InputOTPSeparator.displayName = 'InputOTPSeparator';
63
+
64
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { cn } from '@/lib/utils.util';
3
+
4
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
5
+
6
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
7
+ ({ className, type, ...props }, ref) => {
8
+ return (
9
+ <input
10
+ type={type}
11
+ className={cn(
12
+ 'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
13
+ className
14
+ )}
15
+ ref={ref}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+ );
21
+ Input.displayName = 'Input';
22
+
23
+ export { Input };
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import * as LabelPrimitive from '@radix-ui/react-label';
3
+ import { cva, type VariantProps } from 'class-variance-authority';
4
+ import { cn } from '@/lib/utils.util';
5
+
6
+ const labelVariants = cva(
7
+ 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
8
+ );
9
+
10
+ const Label = React.forwardRef<
11
+ React.ElementRef<typeof LabelPrimitive.Root>,
12
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
13
+ VariantProps<typeof labelVariants>
14
+ >(({ className, ...props }, ref) => (
15
+ <LabelPrimitive.Root
16
+ ref={ref}
17
+ className={cn(labelVariants(), className)}
18
+ {...props}
19
+ />
20
+ ));
21
+ Label.displayName = LabelPrimitive.Root.displayName;
22
+
23
+ export { Label };
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
3
+ import { cn } from '@/lib/utils.util';
4
+
5
+ const Popover = PopoverPrimitive.Root;
6
+ const PopoverTrigger = PopoverPrimitive.Trigger;
7
+
8
+ const PopoverContent = React.forwardRef<
9
+ React.ElementRef<typeof PopoverPrimitive.Content>,
10
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
11
+ >(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
12
+ <PopoverPrimitive.Portal>
13
+ <PopoverPrimitive.Content
14
+ ref={ref}
15
+ align={align}
16
+ sideOffset={sideOffset}
17
+ className={cn(
18
+ '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',
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ </PopoverPrimitive.Portal>
24
+ ));
25
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
26
+
27
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import * as ProgressPrimitive from '@radix-ui/react-progress';
3
+ import { cn } from '@/lib/utils.util';
4
+
5
+ const Progress = React.forwardRef<
6
+ React.ElementRef<typeof ProgressPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
8
+ >(({ className, value, ...props }, ref) => (
9
+ <ProgressPrimitive.Root
10
+ ref={ref}
11
+ className={cn('relative h-4 w-full overflow-hidden rounded-full bg-secondary', className)}
12
+ {...props}
13
+ >
14
+ <ProgressPrimitive.Indicator
15
+ className="h-full w-full flex-1 bg-primary transition-all"
16
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
17
+ />
18
+ </ProgressPrimitive.Root>
19
+ ));
20
+ Progress.displayName = ProgressPrimitive.Root.displayName;
21
+
22
+ export { Progress };
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
3
+ import { Circle } from 'lucide-react';
4
+ import { cn } from '@/lib/utils.util';
5
+
6
+ const RadioGroup = React.forwardRef<
7
+ React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
+ >(({ className, ...props }, ref) => {
10
+ return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />;
11
+ });
12
+ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
13
+
14
+ const RadioGroupItem = React.forwardRef<
15
+ React.ElementRef<typeof RadioGroupPrimitive.Item>,
16
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
17
+ >(({ className, ...props }, ref) => (
18
+ <RadioGroupPrimitive.Item
19
+ ref={ref}
20
+ className={cn(
21
+ 'aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
22
+ className
23
+ )}
24
+ {...props}
25
+ >
26
+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
27
+ <Circle className="h-2.5 w-2.5 fill-current text-current" />
28
+ </RadioGroupPrimitive.Indicator>
29
+ </RadioGroupPrimitive.Item>
30
+ ));
31
+ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
32
+
33
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
3
+ import { cn } from '@/lib/utils.util';
4
+
5
+ const ScrollArea = React.forwardRef<
6
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
8
+ >(({ className, children, ...props }, ref) => (
9
+ <ScrollAreaPrimitive.Root ref={ref} className={cn('relative overflow-hidden', className)} {...props}>
10
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
11
+ <ScrollBar />
12
+ <ScrollAreaPrimitive.Corner />
13
+ </ScrollAreaPrimitive.Root>
14
+ ));
15
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
16
+
17
+ const ScrollBar = React.forwardRef<
18
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
19
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
20
+ >(({ className, orientation = 'vertical', ...props }, ref) => (
21
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
22
+ ref={ref}
23
+ orientation={orientation}
24
+ className={cn(
25
+ 'flex touch-none select-none transition-colors',
26
+ orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]',
27
+ orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]',
28
+ className
29
+ )}
30
+ {...props}
31
+ >
32
+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
33
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
34
+ ));
35
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
36
+
37
+ export { ScrollArea, ScrollBar };