startx 0.0.1

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 (181) hide show
  1. package/.editorconfig +20 -0
  2. package/.prettierignore +24 -0
  3. package/.prettierrc.js +52 -0
  4. package/.vscode/settings.json +3 -0
  5. package/LICENSE +21 -0
  6. package/apps/core-server/.env.example +24 -0
  7. package/apps/core-server/Dockerfile +61 -0
  8. package/apps/core-server/eslint.config.mjs +47 -0
  9. package/apps/core-server/package.json +73 -0
  10. package/apps/core-server/src/config/custom-type.ts +54 -0
  11. package/apps/core-server/src/events/index.ts +37 -0
  12. package/apps/core-server/src/index.ts +19 -0
  13. package/apps/core-server/src/middlewares/auth-middleware.ts +50 -0
  14. package/apps/core-server/src/middlewares/cors-middleware.ts +6 -0
  15. package/apps/core-server/src/middlewares/error-middleware.ts +23 -0
  16. package/apps/core-server/src/middlewares/logger-middleware.ts +21 -0
  17. package/apps/core-server/src/middlewares/notfound-middleware.ts +14 -0
  18. package/apps/core-server/src/middlewares/serve-static.ts +24 -0
  19. package/apps/core-server/src/routes/files/router.ts +7 -0
  20. package/apps/core-server/src/routes/server.ts +36 -0
  21. package/apps/core-server/tsconfig.json +10 -0
  22. package/apps/core-server/tsdown.config.ts +14 -0
  23. package/biome.json +62 -0
  24. package/configs/eslint-config/package.json +60 -0
  25. package/configs/eslint-config/plugins.d.ts +1 -0
  26. package/configs/eslint-config/src/configs/base.ts +237 -0
  27. package/configs/eslint-config/src/configs/frontend.ts +62 -0
  28. package/configs/eslint-config/src/configs/node.ts +10 -0
  29. package/configs/eslint-config/src/plugin.ts +25 -0
  30. package/configs/eslint-config/src/rules/index.ts +30 -0
  31. package/configs/eslint-config/src/rules/no-argument-spread.test.ts +47 -0
  32. package/configs/eslint-config/src/rules/no-argument-spread.ts +96 -0
  33. package/configs/eslint-config/src/rules/no-dynamic-import-template.ts +32 -0
  34. package/configs/eslint-config/src/rules/no-internal-package-import.ts +40 -0
  35. package/configs/eslint-config/src/rules/no-interpolation-in-regular-string.ts +32 -0
  36. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +34 -0
  37. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +49 -0
  38. package/configs/eslint-config/src/rules/no-plain-errors.ts +50 -0
  39. package/configs/eslint-config/src/rules/no-skipped-tests.ts +61 -0
  40. package/configs/eslint-config/src/rules/no-top-level-relative-imports-in-backend-module.ts +27 -0
  41. package/configs/eslint-config/src/rules/no-type-unsafe-event-emitter.ts +33 -0
  42. package/configs/eslint-config/src/rules/no-uncaught-json-parse.test.ts +21 -0
  43. package/configs/eslint-config/src/rules/no-uncaught-json-parse.ts +45 -0
  44. package/configs/eslint-config/src/rules/no-untyped-config-class-field.ts +26 -0
  45. package/configs/eslint-config/src/rules/no-unused-param-catch-clause.ts +33 -0
  46. package/configs/eslint-config/src/rules/no-useless-catch-throw.test.ts +34 -0
  47. package/configs/eslint-config/src/rules/no-useless-catch-throw.ts +47 -0
  48. package/configs/eslint-config/src/utils/json.ts +21 -0
  49. package/configs/eslint-config/tsconfig.json +8 -0
  50. package/configs/eslint-config/tsdown.config.ts +11 -0
  51. package/configs/eslint-config/vitest.config.ts +3 -0
  52. package/configs/tsdown-config/package.json +14 -0
  53. package/configs/tsdown-config/src/config/tsdown.base.ts +13 -0
  54. package/configs/typescript-config/package.json +10 -0
  55. package/configs/typescript-config/tsconfig.common.json +32 -0
  56. package/configs/typescript-config/tsconfig.frontend.json +14 -0
  57. package/configs/typescript-config/tsconfig.node.json +9 -0
  58. package/configs/vitest-config/package.json +25 -0
  59. package/configs/vitest-config/src/base.ts +34 -0
  60. package/configs/vitest-config/src/frontend.ts +15 -0
  61. package/configs/vitest-config/src/node.ts +5 -0
  62. package/configs/vitest-config/tsconfig.json +7 -0
  63. package/package.json +47 -0
  64. package/packages/@repo/constants/eslint.config.mjs +21 -0
  65. package/packages/@repo/constants/package.json +19 -0
  66. package/packages/@repo/constants/src/api.ts +1 -0
  67. package/packages/@repo/constants/src/index.ts +8 -0
  68. package/packages/@repo/constants/src/time.ts +23 -0
  69. package/packages/@repo/constants/tsconfig.json +7 -0
  70. package/packages/@repo/db/eslint.config.mjs +21 -0
  71. package/packages/@repo/db/package.json +30 -0
  72. package/packages/@repo/db/src/functions.ts +122 -0
  73. package/packages/@repo/db/src/index.ts +20 -0
  74. package/packages/@repo/db/src/schema/common.ts +49 -0
  75. package/packages/@repo/db/src/schema/index.ts +1 -0
  76. package/packages/@repo/db/tsconfig.json +13 -0
  77. package/packages/@repo/lib/eslint.config.mjs +49 -0
  78. package/packages/@repo/lib/package.json +57 -0
  79. package/packages/@repo/lib/src/bucket-module/file-storage.ts +49 -0
  80. package/packages/@repo/lib/src/bucket-module/s3-storage.ts +114 -0
  81. package/packages/@repo/lib/src/bucket-module/utils.ts +11 -0
  82. package/packages/@repo/lib/src/command-module.ts +77 -0
  83. package/packages/@repo/lib/src/constants.ts +3 -0
  84. package/packages/@repo/lib/src/cookie-module.ts +42 -0
  85. package/packages/@repo/lib/src/custom-type.ts +54 -0
  86. package/packages/@repo/lib/src/env.ts +13 -0
  87. package/packages/@repo/lib/src/error-handlers-module/index.ts +11 -0
  88. package/packages/@repo/lib/src/file-system/index.ts +90 -0
  89. package/packages/@repo/lib/src/hashing-module.ts +9 -0
  90. package/packages/@repo/lib/src/index.ts +27 -0
  91. package/packages/@repo/lib/src/logger-module/log-config.ts +16 -0
  92. package/packages/@repo/lib/src/logger-module/logger.ts +78 -0
  93. package/packages/@repo/lib/src/logger-module/memory-profiler.ts +65 -0
  94. package/packages/@repo/lib/src/mail-module/api.ts +0 -0
  95. package/packages/@repo/lib/src/mail-module/mock.ts +8 -0
  96. package/packages/@repo/lib/src/mail-module/nodemailer.ts +45 -0
  97. package/packages/@repo/lib/src/notification-module/index.ts +172 -0
  98. package/packages/@repo/lib/src/notification-module/push-notification.ts +90 -0
  99. package/packages/@repo/lib/src/oauth2-client.ts +109 -0
  100. package/packages/@repo/lib/src/otp-module.ts +98 -0
  101. package/packages/@repo/lib/src/pagination-module.ts +49 -0
  102. package/packages/@repo/lib/src/token-module.ts +35 -0
  103. package/packages/@repo/lib/src/user-session.ts +117 -0
  104. package/packages/@repo/lib/src/utils.ts +42 -0
  105. package/packages/@repo/lib/src/validation-module.ts +187 -0
  106. package/packages/@repo/lib/tsconfig.json +7 -0
  107. package/packages/@repo/mail/package.json +29 -0
  108. package/packages/@repo/mail/src/emails/admin/OtpEmail.tsx +168 -0
  109. package/packages/@repo/mail/src/index.ts +13 -0
  110. package/packages/@repo/mail/tsconfig.build.json +14 -0
  111. package/packages/@repo/mail/tsconfig.json +13 -0
  112. package/packages/@repo/mail/tsdown.config.ts +9 -0
  113. package/packages/@repo/redis/eslint.config.mjs +8 -0
  114. package/packages/@repo/redis/package.json +31 -0
  115. package/packages/@repo/redis/src/index.ts +2 -0
  116. package/packages/@repo/redis/src/lib/redis-client.ts +23 -0
  117. package/packages/@repo/redis/src/lib/redis-module.ts +3 -0
  118. package/packages/@repo/redis/tsconfig.json +12 -0
  119. package/packages/ui/components.json +17 -0
  120. package/packages/ui/eslint.config.mjs +18 -0
  121. package/packages/ui/package.json +67 -0
  122. package/packages/ui/postcss.config.mjs +9 -0
  123. package/packages/ui/src/components/custom/form-wrapper.tsx +551 -0
  124. package/packages/ui/src/components/custom/grid-component.tsx +23 -0
  125. package/packages/ui/src/components/custom/hover-tool.tsx +38 -0
  126. package/packages/ui/src/components/custom/image-picker.tsx +109 -0
  127. package/packages/ui/src/components/custom/no-content.tsx +37 -0
  128. package/packages/ui/src/components/custom/page-container.tsx +24 -0
  129. package/packages/ui/src/components/custom/page-section.tsx +59 -0
  130. package/packages/ui/src/components/custom/simple-popover.tsx +29 -0
  131. package/packages/ui/src/components/custom/switch-component.tsx +20 -0
  132. package/packages/ui/src/components/custom/theme-provider.tsx +74 -0
  133. package/packages/ui/src/components/custom/typography.tsx +111 -0
  134. package/packages/ui/src/components/extensions/carousel.tsx +392 -0
  135. package/packages/ui/src/components/hooks/event/use-click.tsx +39 -0
  136. package/packages/ui/src/components/hooks/time/useDebounce.tsx +21 -0
  137. package/packages/ui/src/components/hooks/time/useInterval.tsx +35 -0
  138. package/packages/ui/src/components/hooks/time/useTimeout.tsx +19 -0
  139. package/packages/ui/src/components/hooks/time/useTimer.tsx +51 -0
  140. package/packages/ui/src/components/hooks/use-media-query.tsx +19 -0
  141. package/packages/ui/src/components/hooks/use-persistent-storage.tsx +52 -0
  142. package/packages/ui/src/components/hooks/use-update-effect.tsx +13 -0
  143. package/packages/ui/src/components/hooks/use-window-dimension.tsx +30 -0
  144. package/packages/ui/src/components/lib/utils.ts +242 -0
  145. package/packages/ui/src/components/lucide.tsx +3 -0
  146. package/packages/ui/src/components/sonner.tsx +1 -0
  147. package/packages/ui/src/components/ui/alert-dialog.tsx +116 -0
  148. package/packages/ui/src/components/ui/avatar.tsx +53 -0
  149. package/packages/ui/src/components/ui/badge.tsx +46 -0
  150. package/packages/ui/src/components/ui/breadcrumb.tsx +109 -0
  151. package/packages/ui/src/components/ui/button.tsx +96 -0
  152. package/packages/ui/src/components/ui/card.tsx +92 -0
  153. package/packages/ui/src/components/ui/carousel.tsx +243 -0
  154. package/packages/ui/src/components/ui/checkbox.tsx +32 -0
  155. package/packages/ui/src/components/ui/command.tsx +155 -0
  156. package/packages/ui/src/components/ui/dialog.tsx +127 -0
  157. package/packages/ui/src/components/ui/dropdown-menu.tsx +226 -0
  158. package/packages/ui/src/components/ui/form.tsx +165 -0
  159. package/packages/ui/src/components/ui/input-otp.tsx +76 -0
  160. package/packages/ui/src/components/ui/input.tsx +21 -0
  161. package/packages/ui/src/components/ui/label.tsx +24 -0
  162. package/packages/ui/src/components/ui/multiple-select.tsx +510 -0
  163. package/packages/ui/src/components/ui/popover.tsx +42 -0
  164. package/packages/ui/src/components/ui/select.tsx +170 -0
  165. package/packages/ui/src/components/ui/separator.tsx +28 -0
  166. package/packages/ui/src/components/ui/sheet.tsx +130 -0
  167. package/packages/ui/src/components/ui/skeleton.tsx +13 -0
  168. package/packages/ui/src/components/ui/spinner.tsx +16 -0
  169. package/packages/ui/src/components/ui/switch.tsx +28 -0
  170. package/packages/ui/src/components/ui/table.tsx +116 -0
  171. package/packages/ui/src/components/ui/tabs.tsx +54 -0
  172. package/packages/ui/src/components/ui/textarea.tsx +18 -0
  173. package/packages/ui/src/components/ui/timeline.tsx +118 -0
  174. package/packages/ui/src/components/ui/tooltip.tsx +30 -0
  175. package/packages/ui/src/components/util/n-formattor.ts +22 -0
  176. package/packages/ui/src/components/util/storage.ts +37 -0
  177. package/packages/ui/src/globals.css +87 -0
  178. package/packages/ui/tailwind.config.ts +94 -0
  179. package/packages/ui/tsconfig.json +12 -0
  180. package/pnpm-workspace.yaml +43 -0
  181. package/turbo.json +77 -0
@@ -0,0 +1,92 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "../lib/utils";
4
+
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ );
29
+ }
30
+
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ );
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ export {
85
+ Card,
86
+ CardHeader,
87
+ CardFooter,
88
+ CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
92
+ };
@@ -0,0 +1,243 @@
1
+ "use client"
2
+
3
+ import useEmblaCarousel, {
4
+ type UseEmblaCarouselType,
5
+ } from "embla-carousel-react"
6
+ import { ArrowLeft, ArrowRight } from "lucide-react"
7
+ import * as React from "react"
8
+
9
+ import { Button } from "@/components/ui/button"
10
+
11
+ import { cn } from "../lib/utils"
12
+
13
+
14
+ type CarouselApi = UseEmblaCarouselType[1]
15
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
16
+ type CarouselOptions = UseCarouselParameters[0]
17
+ type CarouselPlugin = UseCarouselParameters[1]
18
+
19
+ type CarouselProps = {
20
+ opts?: CarouselOptions
21
+ plugins?: CarouselPlugin
22
+ orientation?: "horizontal" | "vertical"
23
+ setApi?: (api: CarouselApi) => void
24
+ }
25
+
26
+ type CarouselContextProps = {
27
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
28
+ api: ReturnType<typeof useEmblaCarousel>[1]
29
+ scrollPrev: () => void
30
+ scrollNext: () => void
31
+ canScrollPrev: boolean
32
+ canScrollNext: boolean
33
+ } & CarouselProps
34
+
35
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
36
+
37
+ function useCarousel() {
38
+ const context = React.useContext(CarouselContext)
39
+
40
+ if (!context) {
41
+ throw new Error("useCarousel must be used within a <Carousel />")
42
+ }
43
+
44
+ return context
45
+ }
46
+
47
+ function Carousel({
48
+ orientation = "horizontal",
49
+ opts,
50
+ setApi,
51
+ plugins,
52
+ className,
53
+ children,
54
+ ...props
55
+ }: React.ComponentProps<"div"> & CarouselProps) {
56
+ const [carouselRef, api] = useEmblaCarousel(
57
+ {
58
+ ...opts,
59
+ axis: orientation === "horizontal" ? "x" : "y",
60
+ },
61
+ plugins
62
+ )
63
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
64
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
65
+
66
+ const onSelect = React.useCallback((api: CarouselApi) => {
67
+ if (!api) return
68
+ setCanScrollPrev(api.canScrollPrev())
69
+ setCanScrollNext(api.canScrollNext())
70
+ }, [])
71
+
72
+ const scrollPrev = React.useCallback(() => {
73
+ api?.scrollPrev()
74
+ }, [api])
75
+
76
+ const scrollNext = React.useCallback(() => {
77
+ api?.scrollNext()
78
+ }, [api])
79
+
80
+ const handleKeyDown = React.useCallback(
81
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
82
+ if (event.key === "ArrowLeft") {
83
+ event.preventDefault()
84
+ scrollPrev()
85
+ } else if (event.key === "ArrowRight") {
86
+ event.preventDefault()
87
+ scrollNext()
88
+ }
89
+ },
90
+ [scrollPrev, scrollNext]
91
+ )
92
+
93
+ React.useEffect(() => {
94
+ if (!api || !setApi) return
95
+ setApi(api)
96
+ }, [api, setApi])
97
+
98
+ React.useEffect(() => {
99
+ if (!api) return
100
+ onSelect(api)
101
+ api.on("reInit", onSelect)
102
+ api.on("select", onSelect)
103
+
104
+ return () => {
105
+ api?.off("select", onSelect)
106
+ }
107
+ }, [api, onSelect])
108
+
109
+ return (
110
+ <CarouselContext.Provider
111
+ value={{
112
+ carouselRef,
113
+ api,
114
+ opts,
115
+ orientation:
116
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
117
+ scrollPrev,
118
+ scrollNext,
119
+ canScrollPrev,
120
+ canScrollNext,
121
+ }}
122
+ >
123
+ <div
124
+ onKeyDownCapture={handleKeyDown}
125
+ className={cn("relative", className)}
126
+ role="region"
127
+ aria-roledescription="carousel"
128
+ data-slot="carousel"
129
+ {...props}
130
+ >
131
+ {children}
132
+ </div>
133
+ </CarouselContext.Provider>
134
+ )
135
+ }
136
+
137
+ function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
138
+ const { carouselRef, orientation } = useCarousel()
139
+
140
+ return (
141
+ <div
142
+ ref={carouselRef}
143
+ className="overflow-hidden"
144
+ data-slot="carousel-content"
145
+ >
146
+ <div
147
+ className={cn(
148
+ "flex",
149
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
150
+ className
151
+ )}
152
+ {...props}
153
+ />
154
+ </div>
155
+ )
156
+ }
157
+
158
+ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
159
+ const { orientation } = useCarousel()
160
+
161
+ return (
162
+ <div
163
+ role="group"
164
+ aria-roledescription="slide"
165
+ data-slot="carousel-item"
166
+ className={cn(
167
+ "min-w-0 shrink-0 grow-0 basis-full",
168
+ orientation === "horizontal" ? "pl-4" : "pt-4",
169
+ className
170
+ )}
171
+ {...props}
172
+ />
173
+ )
174
+ }
175
+
176
+ function CarouselPrevious({
177
+ className,
178
+ variant = "outline",
179
+ size = "icon",
180
+ ...props
181
+ }: React.ComponentProps<typeof Button>) {
182
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
183
+
184
+ return (
185
+ <Button
186
+ data-slot="carousel-previous"
187
+ variant={variant}
188
+ size={size}
189
+ className={cn(
190
+ "absolute size-8 rounded-full",
191
+ orientation === "horizontal"
192
+ ? "top-1/2 -left-12 -translate-y-1/2"
193
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
194
+ className
195
+ )}
196
+ disabled={!canScrollPrev}
197
+ onClick={scrollPrev}
198
+ {...props}
199
+ >
200
+ <ArrowLeft />
201
+ <span className="sr-only">Previous slide</span>
202
+ </Button>
203
+ )
204
+ }
205
+
206
+ function CarouselNext({
207
+ className,
208
+ variant = "outline",
209
+ size = "icon",
210
+ ...props
211
+ }: React.ComponentProps<typeof Button>) {
212
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
213
+
214
+ return (
215
+ <Button
216
+ data-slot="carousel-next"
217
+ variant={variant}
218
+ size={size}
219
+ className={cn(
220
+ "absolute size-8 rounded-full",
221
+ orientation === "horizontal"
222
+ ? "top-1/2 -right-12 -translate-y-1/2"
223
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
224
+ className
225
+ )}
226
+ disabled={!canScrollNext}
227
+ onClick={scrollNext}
228
+ {...props}
229
+ >
230
+ <ArrowRight />
231
+ <span className="sr-only">Next slide</span>
232
+ </Button>
233
+ )
234
+ }
235
+
236
+ export {
237
+ type CarouselApi,
238
+ Carousel,
239
+ CarouselContent,
240
+ CarouselItem,
241
+ CarouselPrevious,
242
+ CarouselNext,
243
+ }
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ import CheckboxPrimitive from "@radix-ui/react-checkbox";
4
+ import { CheckIcon } from "lucide-react";
5
+ import type * as React from "react";
6
+
7
+ import { cn } from "../lib/utils";
8
+
9
+ function Checkbox({
10
+ className,
11
+ ...props
12
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
13
+ return (
14
+ <CheckboxPrimitive.Root
15
+ data-slot="checkbox"
16
+ className={cn(
17
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
18
+ className
19
+ )}
20
+ {...props}
21
+ >
22
+ <CheckboxPrimitive.Indicator
23
+ data-slot="checkbox-indicator"
24
+ className="flex items-center justify-center text-current transition-none"
25
+ >
26
+ <CheckIcon className="size-3.5" />
27
+ </CheckboxPrimitive.Indicator>
28
+ </CheckboxPrimitive.Root>
29
+ );
30
+ }
31
+
32
+ export { Checkbox };
@@ -0,0 +1,155 @@
1
+ "use client";
2
+
3
+ import type { DialogProps } from "@radix-ui/react-dialog";
4
+ import { Command as CommandPrimitive } from "cmdk";
5
+ import { Search } from "lucide-react";
6
+ import * as React from "react";
7
+
8
+ import { Dialog, DialogContent } from "./dialog";
9
+ import { cn } from "../lib/utils";
10
+
11
+ const Command = React.forwardRef<
12
+ React.ElementRef<typeof CommandPrimitive>,
13
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
+ >(({ className, ...props }, ref) => (
15
+ <CommandPrimitive
16
+ ref={ref}
17
+ className={cn(
18
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ));
24
+ Command.displayName = CommandPrimitive.displayName;
25
+
26
+ interface CommandDialogProps extends DialogProps {}
27
+ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
28
+ return (
29
+ <Dialog {...props}>
30
+ <DialogContent className="overflow-hidden p-0 shadow-lg">
31
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
32
+ {children}
33
+ </Command>
34
+ </DialogContent>
35
+ </Dialog>
36
+ );
37
+ };
38
+
39
+ const CommandInput = React.forwardRef<
40
+ React.ElementRef<typeof CommandPrimitive.Input>,
41
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
42
+ >(({ className, ...props }, ref) => (
43
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
44
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
45
+ <CommandPrimitive.Input
46
+ ref={ref}
47
+ className={cn(
48
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
49
+ className
50
+ )}
51
+ {...props}
52
+ />
53
+ </div>
54
+ ));
55
+
56
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
57
+
58
+ const CommandList = React.forwardRef<
59
+ React.ElementRef<typeof CommandPrimitive.List>,
60
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
61
+ >(({ className, ...props }, ref) => (
62
+ <CommandPrimitive.List
63
+ ref={ref}
64
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
65
+ {...props}
66
+ />
67
+ ));
68
+
69
+ CommandList.displayName = CommandPrimitive.List.displayName;
70
+
71
+ const CommandEmpty = React.forwardRef<
72
+ React.ElementRef<typeof CommandPrimitive.Empty>,
73
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
74
+ >((props, ref) => (
75
+ <CommandPrimitive.Empty
76
+ ref={ref}
77
+ className="py-6 text-center text-sm"
78
+ {...props}
79
+ />
80
+ ));
81
+
82
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
83
+
84
+ const CommandGroup = React.forwardRef<
85
+ React.ElementRef<typeof CommandPrimitive.Group>,
86
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
87
+ >(({ className, ...props }, ref) => (
88
+ <CommandPrimitive.Group
89
+ ref={ref}
90
+ className={cn(
91
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ));
97
+
98
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
99
+
100
+ const CommandSeparator = React.forwardRef<
101
+ React.ElementRef<typeof CommandPrimitive.Separator>,
102
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
103
+ >(({ className, ...props }, ref) => (
104
+ <CommandPrimitive.Separator
105
+ ref={ref}
106
+ className={cn("-mx-1 h-px bg-border", className)}
107
+ {...props}
108
+ />
109
+ ));
110
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
111
+
112
+ const CommandItem = React.forwardRef<
113
+ React.ElementRef<typeof CommandPrimitive.Item>,
114
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
115
+ >(({ className, ...props }, ref) => (
116
+ <CommandPrimitive.Item
117
+ ref={ref}
118
+ className={cn(
119
+ // "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
120
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-[selected='true']:bg-accent aria-[selected='true']:text-accent-foreground data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50",
121
+ className
122
+ )}
123
+ {...props}
124
+ />
125
+ ));
126
+
127
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
128
+
129
+ const CommandShortcut = ({
130
+ className,
131
+ ...props
132
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
133
+ return (
134
+ <span
135
+ className={cn(
136
+ "ml-auto text-xs tracking-widest text-muted-foreground",
137
+ className
138
+ )}
139
+ {...props}
140
+ />
141
+ );
142
+ };
143
+ CommandShortcut.displayName = "CommandShortcut";
144
+
145
+ export {
146
+ Command,
147
+ CommandDialog,
148
+ CommandInput,
149
+ CommandList,
150
+ CommandEmpty,
151
+ CommandGroup,
152
+ CommandItem,
153
+ CommandShortcut,
154
+ CommandSeparator,
155
+ };
@@ -0,0 +1,127 @@
1
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
2
+ import { XIcon } from "lucide-react";
3
+ import * as React from "react";
4
+
5
+ import { cn } from "../lib/utils";
6
+
7
+ function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
8
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
9
+ }
10
+
11
+ function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
12
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
13
+ }
14
+
15
+ function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
16
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
17
+ }
18
+
19
+ function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
20
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
21
+ }
22
+
23
+ function DialogOverlay({
24
+ className,
25
+ ...props
26
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
27
+ return (
28
+ <DialogPrimitive.Overlay
29
+ data-slot="dialog-overlay"
30
+ className={cn(
31
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
32
+ className
33
+ )}
34
+ {...props}
35
+ />
36
+ );
37
+ }
38
+
39
+ function DialogContent({
40
+ className,
41
+ children,
42
+ showCloseButton = true,
43
+ ...props
44
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
45
+ showCloseButton?: boolean;
46
+ }) {
47
+ return (
48
+ <DialogPortal data-slot="dialog-portal">
49
+ <DialogOverlay />
50
+ <DialogPrimitive.Content
51
+ data-slot="dialog-content"
52
+ className={cn(
53
+ "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
54
+ className
55
+ )}
56
+ {...props}
57
+ >
58
+ {children}
59
+ {showCloseButton && (
60
+ <DialogPrimitive.Close
61
+ data-slot="dialog-close"
62
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
63
+ >
64
+ <XIcon />
65
+ <span className="sr-only">Close</span>
66
+ </DialogPrimitive.Close>
67
+ )}
68
+ </DialogPrimitive.Content>
69
+ </DialogPortal>
70
+ );
71
+ }
72
+
73
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
74
+ return (
75
+ <div
76
+ data-slot="dialog-header"
77
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+
83
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
84
+ return (
85
+ <div
86
+ data-slot="dialog-footer"
87
+ className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
88
+ {...props}
89
+ />
90
+ );
91
+ }
92
+
93
+ function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
94
+ return (
95
+ <DialogPrimitive.Title
96
+ data-slot="dialog-title"
97
+ className={cn("text-lg leading-none font-semibold", className)}
98
+ {...props}
99
+ />
100
+ );
101
+ }
102
+
103
+ function DialogDescription({
104
+ className,
105
+ ...props
106
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
107
+ return (
108
+ <DialogPrimitive.Description
109
+ data-slot="dialog-description"
110
+ className={cn("text-muted-foreground text-sm", className)}
111
+ {...props}
112
+ />
113
+ );
114
+ }
115
+
116
+ export {
117
+ Dialog,
118
+ DialogClose,
119
+ DialogContent,
120
+ DialogDescription,
121
+ DialogFooter,
122
+ DialogHeader,
123
+ DialogOverlay,
124
+ DialogPortal,
125
+ DialogTitle,
126
+ DialogTrigger,
127
+ };