librechat-data-provider 0.8.402 → 0.8.404

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 (109) hide show
  1. package/dist/index.es.js +1 -1
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/react-query/index.es.js +1 -1
  6. package/dist/react-query/index.es.js.map +1 -1
  7. package/dist/types/accessPermissions.d.ts +744 -0
  8. package/dist/types/actions.d.ts +118 -0
  9. package/dist/types/api-endpoints.d.ts +150 -0
  10. package/dist/types/artifacts.d.ts +97 -0
  11. package/dist/types/azure.d.ts +22 -0
  12. package/dist/types/bedrock.d.ts +1220 -0
  13. package/dist/types/config.d.ts +14849 -0
  14. package/dist/types/config.spec.d.ts +1 -0
  15. package/dist/types/createPayload.d.ts +5 -0
  16. package/dist/types/data-service.d.ts +287 -0
  17. package/dist/types/feedback.d.ts +36 -0
  18. package/dist/types/file-config.d.ts +263 -0
  19. package/dist/types/file-config.spec.d.ts +1 -0
  20. package/dist/types/generate.d.ts +597 -0
  21. package/dist/types/headers-helpers.d.ts +2 -0
  22. package/{src/index.ts → dist/types/index.d.ts} +0 -15
  23. package/dist/types/keys.d.ts +92 -0
  24. package/dist/types/mcp.d.ts +2760 -0
  25. package/dist/types/messages.d.ts +10 -0
  26. package/dist/types/models.d.ts +1547 -0
  27. package/dist/types/parameterSettings.d.ts +69 -0
  28. package/dist/types/parsers.d.ts +110 -0
  29. package/dist/types/permissions.d.ts +522 -0
  30. package/dist/types/react-query/react-query-service.d.ts +85 -0
  31. package/dist/types/request.d.ts +25 -0
  32. package/dist/types/roles.d.ts +554 -0
  33. package/dist/types/roles.spec.d.ts +1 -0
  34. package/dist/types/schemas.d.ts +5110 -0
  35. package/dist/types/schemas.spec.d.ts +1 -0
  36. package/dist/types/types/agents.d.ts +433 -0
  37. package/dist/types/types/assistants.d.ts +547 -0
  38. package/dist/types/types/files.d.ts +172 -0
  39. package/dist/types/types/graph.d.ts +135 -0
  40. package/{src/types/mcpServers.ts → dist/types/types/mcpServers.d.ts} +12 -18
  41. package/dist/types/types/mutations.d.ts +209 -0
  42. package/dist/types/types/queries.d.ts +169 -0
  43. package/dist/types/types/runs.d.ts +36 -0
  44. package/dist/types/types/web.d.ts +520 -0
  45. package/dist/types/types.d.ts +503 -0
  46. package/dist/types/utils.d.ts +12 -0
  47. package/package.json +5 -1
  48. package/babel.config.js +0 -4
  49. package/check_updates.sh +0 -52
  50. package/jest.config.js +0 -19
  51. package/react-query/package-lock.json +0 -292
  52. package/react-query/package.json +0 -10
  53. package/rollup.config.js +0 -74
  54. package/server-rollup.config.js +0 -40
  55. package/specs/actions.spec.ts +0 -2533
  56. package/specs/api-endpoints-subdir.spec.ts +0 -140
  57. package/specs/api-endpoints.spec.ts +0 -74
  58. package/specs/azure.spec.ts +0 -844
  59. package/specs/bedrock.spec.ts +0 -862
  60. package/specs/filetypes.spec.ts +0 -175
  61. package/specs/generate.spec.ts +0 -770
  62. package/specs/headers-helpers.spec.ts +0 -24
  63. package/specs/mcp.spec.ts +0 -147
  64. package/specs/openapiSpecs.ts +0 -524
  65. package/specs/parsers.spec.ts +0 -601
  66. package/specs/request-interceptor.spec.ts +0 -304
  67. package/specs/utils.spec.ts +0 -196
  68. package/src/accessPermissions.ts +0 -346
  69. package/src/actions.ts +0 -813
  70. package/src/api-endpoints.ts +0 -440
  71. package/src/artifacts.ts +0 -3104
  72. package/src/azure.ts +0 -328
  73. package/src/bedrock.ts +0 -425
  74. package/src/config.spec.ts +0 -315
  75. package/src/config.ts +0 -2006
  76. package/src/createPayload.ts +0 -46
  77. package/src/data-service.ts +0 -1087
  78. package/src/feedback.ts +0 -141
  79. package/src/file-config.spec.ts +0 -1248
  80. package/src/file-config.ts +0 -764
  81. package/src/generate.ts +0 -634
  82. package/src/headers-helpers.ts +0 -13
  83. package/src/keys.ts +0 -99
  84. package/src/mcp.ts +0 -271
  85. package/src/messages.ts +0 -50
  86. package/src/models.ts +0 -69
  87. package/src/parameterSettings.ts +0 -1111
  88. package/src/parsers.ts +0 -563
  89. package/src/permissions.ts +0 -188
  90. package/src/react-query/react-query-service.ts +0 -566
  91. package/src/request.ts +0 -171
  92. package/src/roles.spec.ts +0 -132
  93. package/src/roles.ts +0 -225
  94. package/src/schemas.spec.ts +0 -355
  95. package/src/schemas.ts +0 -1234
  96. package/src/types/agents.ts +0 -470
  97. package/src/types/assistants.ts +0 -654
  98. package/src/types/files.ts +0 -191
  99. package/src/types/graph.ts +0 -145
  100. package/src/types/mutations.ts +0 -422
  101. package/src/types/queries.ts +0 -208
  102. package/src/types/runs.ts +0 -40
  103. package/src/types/web.ts +0 -588
  104. package/src/types.ts +0 -676
  105. package/src/utils.ts +0 -85
  106. package/tsconfig.json +0 -28
  107. package/tsconfig.spec.json +0 -10
  108. /package/{src/react-query/index.ts → dist/types/react-query/index.d.ts} +0 -0
  109. /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
package/src/artifacts.ts DELETED
@@ -1,3104 +0,0 @@
1
- export enum ArtifactModes {
2
- DEFAULT = 'default',
3
- SHADCNUI = 'shadcnui',
4
- CUSTOM = 'custom',
5
- }
6
-
7
- export const utils = `
8
- import { type ClassValue, clsx } from "clsx"
9
- import { twMerge } from "tailwind-merge"
10
-
11
- export function cn(...inputs: ClassValue[]) {
12
- return twMerge(clsx(inputs))
13
- }
14
- `;
15
- export const accordian = `import * as React from "react"
16
- import * as AccordionPrimitive from "@radix-ui/react-accordion"
17
- import { ChevronDown } from "lucide-react"
18
-
19
- import { cn } from "../../lib/utils"
20
-
21
- const Accordion = AccordionPrimitive.Root
22
-
23
- const AccordionItem = React.forwardRef<
24
- React.ElementRef<typeof AccordionPrimitive.Item>,
25
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
26
- >(({ className, ...props }, ref) => (
27
- <AccordionPrimitive.Item
28
- ref={ref}
29
- className={cn("border-b", className)}
30
- {...props}
31
- />
32
- ))
33
- AccordionItem.displayName = "AccordionItem"
34
-
35
- const AccordionTrigger = React.forwardRef<
36
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
37
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
38
- >(({ className, children, ...props }, ref) => (
39
- <AccordionPrimitive.Header className="flex">
40
- <AccordionPrimitive.Trigger
41
- ref={ref}
42
- className={cn(
43
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
44
- className
45
- )}
46
- {...props}
47
- >
48
- {children}
49
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
50
- </AccordionPrimitive.Trigger>
51
- </AccordionPrimitive.Header>
52
- ))
53
- AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
54
-
55
- const AccordionContent = React.forwardRef<
56
- React.ElementRef<typeof AccordionPrimitive.Content>,
57
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
58
- >(({ className, children, ...props }, ref) => (
59
- <AccordionPrimitive.Content
60
- ref={ref}
61
- className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
62
- {...props}
63
- >
64
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
65
- </AccordionPrimitive.Content>
66
- ))
67
-
68
- AccordionContent.displayName = AccordionPrimitive.Content.displayName
69
-
70
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
71
- `;
72
- export const alertDialog = `import * as React from "react"
73
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
74
-
75
- import { cn } from "../../lib/utils"
76
- import { buttonVariants } from "./button"
77
-
78
- const AlertDialog = AlertDialogPrimitive.Root
79
-
80
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger
81
-
82
- const AlertDialogPortal = AlertDialogPrimitive.Portal
83
-
84
- const AlertDialogOverlay = React.forwardRef<
85
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
86
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
87
- >(({ className, ...props }, ref) => (
88
- <AlertDialogPrimitive.Overlay
89
- className={cn(
90
- "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",
91
- className
92
- )}
93
- {...props}
94
- ref={ref}
95
- />
96
- ))
97
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
98
-
99
- const AlertDialogContent = React.forwardRef<
100
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
101
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
102
- >(({ className, ...props }, ref) => (
103
- <AlertDialogPortal>
104
- <AlertDialogOverlay />
105
- <AlertDialogPrimitive.Content
106
- ref={ref}
107
- className={cn(
108
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white 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 dark:border-gray-800 dark:bg-gray-950",
109
- className
110
- )}
111
- {...props}
112
- />
113
- </AlertDialogPortal>
114
- ))
115
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
116
-
117
- const AlertDialogHeader = ({
118
- className,
119
- ...props
120
- }: React.HTMLAttributes<HTMLDivElement>) => (
121
- <div
122
- className={cn(
123
- "flex flex-col space-y-2 text-center sm:text-left",
124
- className
125
- )}
126
- {...props}
127
- />
128
- )
129
- AlertDialogHeader.displayName = "AlertDialogHeader"
130
-
131
- const AlertDialogFooter = ({
132
- className,
133
- ...props
134
- }: React.HTMLAttributes<HTMLDivElement>) => (
135
- <div
136
- className={cn(
137
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
138
- className
139
- )}
140
- {...props}
141
- />
142
- )
143
- AlertDialogFooter.displayName = "AlertDialogFooter"
144
-
145
- const AlertDialogTitle = React.forwardRef<
146
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
147
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
148
- >(({ className, ...props }, ref) => (
149
- <AlertDialogPrimitive.Title
150
- ref={ref}
151
- className={cn("text-lg font-semibold", className)}
152
- {...props}
153
- />
154
- ))
155
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
156
-
157
- const AlertDialogDescription = React.forwardRef<
158
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
159
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
160
- >(({ className, ...props }, ref) => (
161
- <AlertDialogPrimitive.Description
162
- ref={ref}
163
- className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
164
- {...props}
165
- />
166
- ))
167
- AlertDialogDescription.displayName =
168
- AlertDialogPrimitive.Description.displayName
169
-
170
- const AlertDialogAction = React.forwardRef<
171
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
172
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
173
- >(({ className, ...props }, ref) => (
174
- <AlertDialogPrimitive.Action
175
- ref={ref}
176
- className={cn(buttonVariants(), className)}
177
- {...props}
178
- />
179
- ))
180
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
181
-
182
- const AlertDialogCancel = React.forwardRef<
183
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
184
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
185
- >(({ className, ...props }, ref) => (
186
- <AlertDialogPrimitive.Cancel
187
- ref={ref}
188
- className={cn(
189
- buttonVariants({ variant: "outline" }),
190
- "mt-2 sm:mt-0",
191
- className
192
- )}
193
- {...props}
194
- />
195
- ))
196
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
197
-
198
- export {
199
- AlertDialog,
200
- AlertDialogPortal,
201
- AlertDialogOverlay,
202
- AlertDialogTrigger,
203
- AlertDialogContent,
204
- AlertDialogHeader,
205
- AlertDialogFooter,
206
- AlertDialogTitle,
207
- AlertDialogDescription,
208
- AlertDialogAction,
209
- AlertDialogCancel,
210
- }
211
- `;
212
- export const alert = `import * as React from "react"
213
- import { cva, type VariantProps } from "class-variance-authority"
214
-
215
- import { cn } from "../../lib/utils"
216
-
217
- const alertVariants = cva(
218
- "relative w-full rounded-lg border border-gray-200 p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-gray-950 dark:border-gray-800 dark:[&>svg]:text-gray-50",
219
- {
220
- variants: {
221
- variant: {
222
- default: "bg-white text-gray-950 dark:bg-gray-950 dark:text-gray-50",
223
- destructive:
224
- "border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900",
225
- },
226
- },
227
- defaultVariants: {
228
- variant: "default",
229
- },
230
- }
231
- )
232
-
233
- const Alert = React.forwardRef<
234
- HTMLDivElement,
235
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
236
- >(({ className, variant, ...props }, ref) => (
237
- <div
238
- ref={ref}
239
- role="alert"
240
- className={cn(alertVariants({ variant }), className)}
241
- {...props}
242
- />
243
- ))
244
- Alert.displayName = "Alert"
245
-
246
- const AlertTitle = React.forwardRef<
247
- HTMLParagraphElement,
248
- React.HTMLAttributes<HTMLHeadingElement>
249
- >(({ className, ...props }, ref) => (
250
- <h5
251
- ref={ref}
252
- className={cn("mb-1 font-medium leading-none tracking-tight", className)}
253
- {...props}
254
- />
255
- ))
256
- AlertTitle.displayName = "AlertTitle"
257
-
258
- const AlertDescription = React.forwardRef<
259
- HTMLParagraphElement,
260
- React.HTMLAttributes<HTMLParagraphElement>
261
- >(({ className, ...props }, ref) => (
262
- <div
263
- ref={ref}
264
- className={cn("text-sm [&_p]:leading-relaxed", className)}
265
- {...props}
266
- />
267
- ))
268
- AlertDescription.displayName = "AlertDescription"
269
-
270
- export { Alert, AlertTitle, AlertDescription }
271
-
272
- `;
273
- export const avatar = `import * as React from "react"
274
- import * as AvatarPrimitive from "@radix-ui/react-avatar"
275
-
276
- import { cn } from "../../lib/utils"
277
-
278
- const Avatar = React.forwardRef<
279
- React.ElementRef<typeof AvatarPrimitive.Root>,
280
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
281
- >(({ className, ...props }, ref) => (
282
- <AvatarPrimitive.Root
283
- ref={ref}
284
- className={cn(
285
- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
286
- className
287
- )}
288
- {...props}
289
- />
290
- ))
291
- Avatar.displayName = AvatarPrimitive.Root.displayName
292
-
293
- const AvatarImage = React.forwardRef<
294
- React.ElementRef<typeof AvatarPrimitive.Image>,
295
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
296
- >(({ className, ...props }, ref) => (
297
- <AvatarPrimitive.Image
298
- ref={ref}
299
- className={cn("aspect-square h-full w-full", className)}
300
- {...props}
301
- />
302
- ))
303
- AvatarImage.displayName = AvatarPrimitive.Image.displayName
304
-
305
- const AvatarFallback = React.forwardRef<
306
- React.ElementRef<typeof AvatarPrimitive.Fallback>,
307
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
308
- >(({ className, ...props }, ref) => (
309
- <AvatarPrimitive.Fallback
310
- ref={ref}
311
- className={cn(
312
- "flex h-full w-full items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",
313
- className
314
- )}
315
- {...props}
316
- />
317
- ))
318
- AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
319
-
320
- export { Avatar, AvatarImage, AvatarFallback }
321
-
322
- `;
323
- export const badge = `import * as React from "react"
324
- import { cva, type VariantProps } from "class-variance-authority"
325
-
326
- import { cn } from "../../lib/utils"
327
-
328
- const badgeVariants = cva(
329
- "inline-flex items-center rounded-full border border-gray-200 px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-gray-950 focus:ring-offset-2 dark:border-gray-800 dark:focus:ring-gray-300",
330
- {
331
- variants: {
332
- variant: {
333
- default:
334
- "border-transparent bg-gray-900 text-gray-50 hover:bg-gray-900/80 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/80",
335
- secondary:
336
- "border-transparent bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80",
337
- destructive:
338
- "border-transparent bg-red-500 text-gray-50 hover:bg-red-500/80 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/80",
339
- outline: "text-gray-950 dark:text-gray-50",
340
- },
341
- },
342
- defaultVariants: {
343
- variant: "default",
344
- },
345
- }
346
- )
347
-
348
- export interface BadgeProps
349
- extends React.HTMLAttributes<HTMLDivElement>,
350
- VariantProps<typeof badgeVariants> {}
351
-
352
- function Badge({ className, variant, ...props }: BadgeProps) {
353
- return (
354
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
355
- )
356
- }
357
-
358
- export { Badge, badgeVariants }
359
-
360
- `;
361
- export const breadcrumb = `import * as React from "react"
362
- import { Slot } from "@radix-ui/react-slot"
363
- import { ChevronRight, MoreHorizontal } from "lucide-react"
364
-
365
- import { cn } from "../../lib/utils"
366
-
367
- const Breadcrumb = React.forwardRef<
368
- HTMLElement,
369
- React.ComponentPropsWithoutRef<"nav"> & {
370
- separator?: React.ReactNode
371
- }
372
- >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
373
- Breadcrumb.displayName = "Breadcrumb"
374
-
375
- const BreadcrumbList = React.forwardRef<
376
- HTMLOListElement,
377
- React.ComponentPropsWithoutRef<"ol">
378
- >(({ className, ...props }, ref) => (
379
- <ol
380
- ref={ref}
381
- className={cn(
382
- "flex flex-wrap items-center gap-1.5 break-words text-sm text-gray-500 sm:gap-2.5 dark:text-gray-400",
383
- className
384
- )}
385
- {...props}
386
- />
387
- ))
388
- BreadcrumbList.displayName = "BreadcrumbList"
389
-
390
- const BreadcrumbItem = React.forwardRef<
391
- HTMLLIElement,
392
- React.ComponentPropsWithoutRef<"li">
393
- >(({ className, ...props }, ref) => (
394
- <li
395
- ref={ref}
396
- className={cn("inline-flex items-center gap-1.5", className)}
397
- {...props}
398
- />
399
- ))
400
- BreadcrumbItem.displayName = "BreadcrumbItem"
401
-
402
- const BreadcrumbLink = React.forwardRef<
403
- HTMLAnchorElement,
404
- React.ComponentPropsWithoutRef<"a"> & {
405
- asChild?: boolean
406
- }
407
- >(({ asChild, className, ...props }, ref) => {
408
- const Comp = asChild ? Slot : "a"
409
-
410
- return (
411
- <Comp
412
- ref={ref}
413
- className={cn("transition-colors hover:text-gray-950 dark:hover:text-gray-50", className)}
414
- {...props}
415
- />
416
- )
417
- })
418
- BreadcrumbLink.displayName = "BreadcrumbLink"
419
-
420
- const BreadcrumbPage = React.forwardRef<
421
- HTMLSpanElement,
422
- React.ComponentPropsWithoutRef<"span">
423
- >(({ className, ...props }, ref) => (
424
- <span
425
- ref={ref}
426
- role="link"
427
- aria-disabled="true"
428
- aria-current="page"
429
- className={cn("font-normal text-gray-950 dark:text-gray-50", className)}
430
- {...props}
431
- />
432
- ))
433
- BreadcrumbPage.displayName = "BreadcrumbPage"
434
-
435
- const BreadcrumbSeparator = ({
436
- children,
437
- className,
438
- ...props
439
- }: React.ComponentProps<"li">) => (
440
- <li
441
- role="presentation"
442
- aria-hidden="true"
443
- className={cn("[&>svg]:size-3.5", className)}
444
- {...props}
445
- >
446
- {children ?? <ChevronRight />}
447
- </li>
448
- )
449
- BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
450
-
451
- const BreadcrumbEllipsis = ({
452
- className,
453
- ...props
454
- }: React.ComponentProps<"span">) => (
455
- <span
456
- role="presentation"
457
- aria-hidden="true"
458
- className={cn("flex h-9 w-9 items-center justify-center", className)}
459
- {...props}
460
- >
461
- <MoreHorizontal className="h-4 w-4" />
462
- <span className="sr-only">More</span>
463
- </span>
464
- )
465
- BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
466
-
467
- export {
468
- Breadcrumb,
469
- BreadcrumbList,
470
- BreadcrumbItem,
471
- BreadcrumbLink,
472
- BreadcrumbPage,
473
- BreadcrumbSeparator,
474
- BreadcrumbEllipsis,
475
- }
476
-
477
- `;
478
- export const button = `import * as React from "react"
479
- import { Slot } from "@radix-ui/react-slot"
480
- import { cva, type VariantProps } from "class-variance-authority"
481
-
482
- import { cn } from '../../lib/utils';
483
-
484
- const buttonVariants = cva(
485
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300",
486
- {
487
- variants: {
488
- variant: {
489
- default: "bg-gray-900 text-gray-50 hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90",
490
- destructive:
491
- "bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90",
492
- outline:
493
- "border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50",
494
- secondary:
495
- "bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80",
496
- ghost: "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50",
497
- link: "text-gray-900 underline-offset-4 hover:underline dark:text-gray-50",
498
- },
499
- size: {
500
- default: "h-10 px-4 py-2",
501
- sm: "h-9 rounded-md px-3",
502
- lg: "h-11 rounded-md px-8",
503
- icon: "h-10 w-10",
504
- },
505
- },
506
- defaultVariants: {
507
- variant: "default",
508
- size: "default",
509
- },
510
- }
511
- )
512
-
513
- export interface ButtonProps
514
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
515
- VariantProps<typeof buttonVariants> {
516
- asChild?: boolean
517
- }
518
-
519
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
520
- ({ className, variant, size, asChild = false, ...props }, ref) => {
521
- const Comp = asChild ? Slot : "button"
522
- return (
523
- <Comp
524
- className={cn(buttonVariants({ variant, size, className }))}
525
- ref={ref}
526
- {...props}
527
- />
528
- )
529
- }
530
- )
531
- Button.displayName = "Button"
532
-
533
- export { Button, buttonVariants }
534
- `;
535
- export const calendar = `import * as React from "react"
536
- import { ChevronLeft, ChevronRight } from "lucide-react"
537
- import { DayPicker } from "react-day-picker"
538
-
539
- import { cn } from "../../lib/utils"
540
- import { buttonVariants } from "./button"
541
-
542
- export type CalendarProps = React.ComponentProps<typeof DayPicker>
543
-
544
- function Calendar({
545
- className,
546
- classNames,
547
- showOutsideDays = true,
548
- ...props
549
- }: CalendarProps) {
550
- return (
551
- <DayPicker
552
- showOutsideDays={showOutsideDays}
553
- className={cn("p-3", className)}
554
- classNames={{
555
- months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
556
- month: "space-y-4",
557
- caption: "flex justify-center pt-1 relative items-center",
558
- caption_label: "text-sm font-medium",
559
- nav: "space-x-1 flex items-center",
560
- nav_button: cn(
561
- buttonVariants({ variant: "outline" }),
562
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
563
- ),
564
- nav_button_previous: "absolute left-1",
565
- nav_button_next: "absolute right-1",
566
- table: "w-full border-collapse space-y-1",
567
- head_row: "flex",
568
- head_cell:
569
- "text-gray-500 rounded-md w-9 font-normal text-[0.8rem] dark:text-gray-400",
570
- row: "flex w-full mt-2",
571
- cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-gray-100/50 [&:has([aria-selected])]:bg-gray-100 first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20 dark:[&:has([aria-selected].day-outside)]:bg-gray-800/50 dark:[&:has([aria-selected])]:bg-gray-800",
572
- day: cn(
573
- buttonVariants({ variant: "ghost" }),
574
- "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
575
- ),
576
- day_range_end: "day-range-end",
577
- day_selected:
578
- "bg-gray-900 text-gray-50 hover:bg-gray-900 hover:text-gray-50 focus:bg-gray-900 focus:text-gray-50 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50 dark:hover:text-gray-900 dark:focus:bg-gray-50 dark:focus:text-gray-900",
579
- day_today: "bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-50",
580
- day_outside:
581
- "day-outside text-gray-500 opacity-50 aria-selected:bg-gray-100/50 aria-selected:text-gray-500 aria-selected:opacity-30 dark:text-gray-400 dark:aria-selected:bg-gray-800/50 dark:aria-selected:text-gray-400",
582
- day_disabled: "text-gray-500 opacity-50 dark:text-gray-400",
583
- day_range_middle:
584
- "aria-selected:bg-gray-100 aria-selected:text-gray-900 dark:aria-selected:bg-gray-800 dark:aria-selected:text-gray-50",
585
- day_hidden: "invisible",
586
- ...classNames,
587
- }}
588
- components={{
589
- IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
590
- IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,
591
- }}
592
- {...props}
593
- />
594
- )
595
- }
596
- Calendar.displayName = "Calendar"
597
-
598
- export { Calendar }
599
-
600
- `;
601
- export const card = `import * as React from 'react';
602
-
603
- import { cn } from '../../lib/utils';
604
-
605
- const Card = React.forwardRef<
606
- HTMLDivElement,
607
- React.HTMLAttributes<HTMLDivElement>
608
- >(({ className, ...props }, ref) => (
609
- <div
610
- ref={ref}
611
- className={cn(
612
- "rounded-lg border border-gray-200 bg-white text-gray-950 shadow-sm dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
613
- className
614
- )}
615
- {...props}
616
- />
617
- ))
618
- Card.displayName = "Card"
619
-
620
- const CardHeader = React.forwardRef<
621
- HTMLDivElement,
622
- React.HTMLAttributes<HTMLDivElement>
623
- >(({ className, ...props }, ref) => (
624
- <div
625
- ref={ref}
626
- className={cn("flex flex-col space-y-1.5 p-6", className)}
627
- {...props}
628
- />
629
- ))
630
- CardHeader.displayName = "CardHeader"
631
-
632
- const CardTitle = React.forwardRef<
633
- HTMLParagraphElement,
634
- React.HTMLAttributes<HTMLHeadingElement>
635
- >(({ className, ...props }, ref) => (
636
- <h3
637
- ref={ref}
638
- className={cn(
639
- "text-2xl font-semibold leading-none tracking-tight",
640
- className
641
- )}
642
- {...props}
643
- />
644
- ))
645
- CardTitle.displayName = "CardTitle"
646
-
647
- const CardDescription = React.forwardRef<
648
- HTMLParagraphElement,
649
- React.HTMLAttributes<HTMLParagraphElement>
650
- >(({ className, ...props }, ref) => (
651
- <p
652
- ref={ref}
653
- className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
654
- {...props}
655
- />
656
- ))
657
- CardDescription.displayName = "CardDescription"
658
-
659
- const CardContent = React.forwardRef<
660
- HTMLDivElement,
661
- React.HTMLAttributes<HTMLDivElement>
662
- >(({ className, ...props }, ref) => (
663
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
664
- ))
665
- CardContent.displayName = "CardContent"
666
-
667
- const CardFooter = React.forwardRef<
668
- HTMLDivElement,
669
- React.HTMLAttributes<HTMLDivElement>
670
- >(({ className, ...props }, ref) => (
671
- <div
672
- ref={ref}
673
- className={cn("flex items-center p-6 pt-0", className)}
674
- {...props}
675
- />
676
- ))
677
- CardFooter.displayName = "CardFooter"
678
-
679
- export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
680
- `;
681
- export const carousel = `import * as React from "react"
682
- import useEmblaCarousel, {
683
- type UseEmblaCarouselType,
684
- } from "embla-carousel-react"
685
- import { ArrowLeft, ArrowRight } from "lucide-react"
686
-
687
- import { cn } from "../../lib/utils"
688
- import { Button } from "./button"
689
-
690
- type CarouselApi = UseEmblaCarouselType[1]
691
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
692
- type CarouselOptions = UseCarouselParameters[0]
693
- type CarouselPlugin = UseCarouselParameters[1]
694
-
695
- type CarouselProps = {
696
- opts?: CarouselOptions
697
- plugins?: CarouselPlugin
698
- orientation?: "horizontal" | "vertical"
699
- setApi?: (api: CarouselApi) => void
700
- }
701
-
702
- type CarouselContextProps = {
703
- carouselRef: ReturnType<typeof useEmblaCarousel>[0]
704
- api: ReturnType<typeof useEmblaCarousel>[1]
705
- scrollPrev: () => void
706
- scrollNext: () => void
707
- canScrollPrev: boolean
708
- canScrollNext: boolean
709
- } & CarouselProps
710
-
711
- const CarouselContext = React.createContext<CarouselContextProps | null>(null)
712
-
713
- function useCarousel() {
714
- const context = React.useContext(CarouselContext)
715
-
716
- if (!context) {
717
- throw new Error("useCarousel must be used within a <Carousel />")
718
- }
719
-
720
- return context
721
- }
722
-
723
- const Carousel = React.forwardRef<
724
- HTMLDivElement,
725
- React.HTMLAttributes<HTMLDivElement> & CarouselProps
726
- >(
727
- (
728
- {
729
- orientation = "horizontal",
730
- opts,
731
- setApi,
732
- plugins,
733
- className,
734
- children,
735
- ...props
736
- },
737
- ref
738
- ) => {
739
- const [carouselRef, api] = useEmblaCarousel(
740
- {
741
- ...opts,
742
- axis: orientation === "horizontal" ? "x" : "y",
743
- },
744
- plugins
745
- )
746
- const [canScrollPrev, setCanScrollPrev] = React.useState(false)
747
- const [canScrollNext, setCanScrollNext] = React.useState(false)
748
-
749
- const onSelect = React.useCallback((api: CarouselApi) => {
750
- if (!api) {
751
- return
752
- }
753
-
754
- setCanScrollPrev(api.canScrollPrev())
755
- setCanScrollNext(api.canScrollNext())
756
- }, [])
757
-
758
- const scrollPrev = React.useCallback(() => {
759
- api?.scrollPrev()
760
- }, [api])
761
-
762
- const scrollNext = React.useCallback(() => {
763
- api?.scrollNext()
764
- }, [api])
765
-
766
- const handleKeyDown = React.useCallback(
767
- (event: React.KeyboardEvent<HTMLDivElement>) => {
768
- if (event.key === "ArrowLeft") {
769
- event.preventDefault()
770
- scrollPrev()
771
- } else if (event.key === "ArrowRight") {
772
- event.preventDefault()
773
- scrollNext()
774
- }
775
- },
776
- [scrollPrev, scrollNext]
777
- )
778
-
779
- React.useEffect(() => {
780
- if (!api || !setApi) {
781
- return
782
- }
783
-
784
- setApi(api)
785
- }, [api, setApi])
786
-
787
- React.useEffect(() => {
788
- if (!api) {
789
- return
790
- }
791
-
792
- onSelect(api)
793
- api.on("reInit", onSelect)
794
- api.on("select", onSelect)
795
-
796
- return () => {
797
- api?.off("select", onSelect)
798
- }
799
- }, [api, onSelect])
800
-
801
- return (
802
- <CarouselContext.Provider
803
- value={{
804
- carouselRef,
805
- api: api,
806
- opts,
807
- orientation:
808
- orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
809
- scrollPrev,
810
- scrollNext,
811
- canScrollPrev,
812
- canScrollNext,
813
- }}
814
- >
815
- <div
816
- ref={ref}
817
- onKeyDownCapture={handleKeyDown}
818
- className={cn("relative", className)}
819
- role="region"
820
- aria-roledescription="carousel"
821
- {...props}
822
- >
823
- {children}
824
- </div>
825
- </CarouselContext.Provider>
826
- )
827
- }
828
- )
829
- Carousel.displayName = "Carousel"
830
-
831
- const CarouselContent = React.forwardRef<
832
- HTMLDivElement,
833
- React.HTMLAttributes<HTMLDivElement>
834
- >(({ className, ...props }, ref) => {
835
- const { carouselRef, orientation } = useCarousel()
836
-
837
- return (
838
- <div ref={carouselRef} className="overflow-hidden">
839
- <div
840
- ref={ref}
841
- className={cn(
842
- "flex",
843
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
844
- className
845
- )}
846
- {...props}
847
- />
848
- </div>
849
- )
850
- })
851
- CarouselContent.displayName = "CarouselContent"
852
-
853
- const CarouselItem = React.forwardRef<
854
- HTMLDivElement,
855
- React.HTMLAttributes<HTMLDivElement>
856
- >(({ className, ...props }, ref) => {
857
- const { orientation } = useCarousel()
858
-
859
- return (
860
- <div
861
- ref={ref}
862
- role="group"
863
- aria-roledescription="slide"
864
- className={cn(
865
- "min-w-0 shrink-0 grow-0 basis-full",
866
- orientation === "horizontal" ? "pl-4" : "pt-4",
867
- className
868
- )}
869
- {...props}
870
- />
871
- )
872
- })
873
- CarouselItem.displayName = "CarouselItem"
874
-
875
- const CarouselPrevious = React.forwardRef<
876
- HTMLButtonElement,
877
- React.ComponentProps<typeof Button>
878
- >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
879
- const { orientation, scrollPrev, canScrollPrev } = useCarousel()
880
-
881
- return (
882
- <Button
883
- ref={ref}
884
- variant={variant}
885
- size={size}
886
- className={cn(
887
- "absolute h-8 w-8 rounded-full",
888
- orientation === "horizontal"
889
- ? "-left-12 top-1/2 -translate-y-1/2"
890
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
891
- className
892
- )}
893
- disabled={!canScrollPrev}
894
- onClick={scrollPrev}
895
- {...props}
896
- >
897
- <ArrowLeft className="h-4 w-4" />
898
- <span className="sr-only">Previous slide</span>
899
- </Button>
900
- )
901
- })
902
- CarouselPrevious.displayName = "CarouselPrevious"
903
-
904
- const CarouselNext = React.forwardRef<
905
- HTMLButtonElement,
906
- React.ComponentProps<typeof Button>
907
- >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
908
- const { orientation, scrollNext, canScrollNext } = useCarousel()
909
-
910
- return (
911
- <Button
912
- ref={ref}
913
- variant={variant}
914
- size={size}
915
- className={cn(
916
- "absolute h-8 w-8 rounded-full",
917
- orientation === "horizontal"
918
- ? "-right-12 top-1/2 -translate-y-1/2"
919
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
920
- className
921
- )}
922
- disabled={!canScrollNext}
923
- onClick={scrollNext}
924
- {...props}
925
- >
926
- <ArrowRight className="h-4 w-4" />
927
- <span className="sr-only">Next slide</span>
928
- </Button>
929
- )
930
- })
931
- CarouselNext.displayName = "CarouselNext"
932
-
933
- export {
934
- type CarouselApi,
935
- Carousel,
936
- CarouselContent,
937
- CarouselItem,
938
- CarouselPrevious,
939
- CarouselNext,
940
- }
941
-
942
- `;
943
- export const checkbox = `import * as React from "react"
944
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
945
- import { Check } from "lucide-react"
946
-
947
- import { cn } from "../../lib/utils"
948
-
949
- const Checkbox = React.forwardRef<
950
- React.ElementRef<typeof CheckboxPrimitive.Root>,
951
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
952
- >(({ className, ...props }, ref) => (
953
- <CheckboxPrimitive.Root
954
- ref={ref}
955
- className={cn(
956
- "peer h-4 w-4 shrink-0 rounded-sm border border-gray-200 dark:border-gray-900 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-900 data-[state=checked]:text-gray-50 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300 dark:data-[state=checked]:bg-gray-50 dark:data-[state=checked]:text-gray-900",
957
- className
958
- )}
959
- {...props}
960
- >
961
- <CheckboxPrimitive.Indicator
962
- className={cn("flex items-center justify-center text-current")}
963
- >
964
- <Check className="h-4 w-4" />
965
- </CheckboxPrimitive.Indicator>
966
- </CheckboxPrimitive.Root>
967
- ))
968
- Checkbox.displayName = CheckboxPrimitive.Root.displayName
969
-
970
- export { Checkbox }
971
-
972
- `;
973
- export const collapsible = `import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
974
-
975
- const Collapsible = CollapsiblePrimitive.Root
976
-
977
- const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
978
-
979
- const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
980
-
981
- export { Collapsible, CollapsibleTrigger, CollapsibleContent }
982
-
983
- `;
984
- export const dialog = `import * as React from "react"
985
- import * as DialogPrimitive from "@radix-ui/react-dialog"
986
- import { X } from "lucide-react"
987
-
988
- import { cn } from "../../lib/utils"
989
-
990
- const Dialog = DialogPrimitive.Root
991
-
992
- const DialogTrigger = DialogPrimitive.Trigger
993
-
994
- const DialogPortal = DialogPrimitive.Portal
995
-
996
- const DialogClose = DialogPrimitive.Close
997
-
998
- const DialogOverlay = React.forwardRef<
999
- React.ElementRef<typeof DialogPrimitive.Overlay>,
1000
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
1001
- >(({ className, ...props }, ref) => (
1002
- <DialogPrimitive.Overlay
1003
- ref={ref}
1004
- className={cn(
1005
- "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",
1006
- className
1007
- )}
1008
- {...props}
1009
- />
1010
- ))
1011
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
1012
-
1013
- const DialogContent = React.forwardRef<
1014
- React.ElementRef<typeof DialogPrimitive.Content>,
1015
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
1016
- >(({ className, children, ...props }, ref) => (
1017
- <DialogPortal>
1018
- <DialogOverlay />
1019
- <DialogPrimitive.Content
1020
- ref={ref}
1021
- className={cn(
1022
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white 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 dark:border-gray-800 dark:bg-gray-950",
1023
- className
1024
- )}
1025
- {...props}
1026
- >
1027
- {children}
1028
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500 dark:ring-offset-gray-950 dark:focus:ring-gray-300 dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-400">
1029
- <X className="h-4 w-4" />
1030
- <span className="sr-only">Close</span>
1031
- </DialogPrimitive.Close>
1032
- </DialogPrimitive.Content>
1033
- </DialogPortal>
1034
- ))
1035
- DialogContent.displayName = DialogPrimitive.Content.displayName
1036
-
1037
- const DialogHeader = ({
1038
- className,
1039
- ...props
1040
- }: React.HTMLAttributes<HTMLDivElement>) => (
1041
- <div
1042
- className={cn(
1043
- "flex flex-col space-y-1.5 text-center sm:text-left",
1044
- className
1045
- )}
1046
- {...props}
1047
- />
1048
- )
1049
- DialogHeader.displayName = "DialogHeader"
1050
-
1051
- const DialogFooter = ({
1052
- className,
1053
- ...props
1054
- }: React.HTMLAttributes<HTMLDivElement>) => (
1055
- <div
1056
- className={cn(
1057
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
1058
- className
1059
- )}
1060
- {...props}
1061
- />
1062
- )
1063
- DialogFooter.displayName = "DialogFooter"
1064
-
1065
- const DialogTitle = React.forwardRef<
1066
- React.ElementRef<typeof DialogPrimitive.Title>,
1067
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
1068
- >(({ className, ...props }, ref) => (
1069
- <DialogPrimitive.Title
1070
- ref={ref}
1071
- className={cn(
1072
- "text-lg font-semibold leading-none tracking-tight",
1073
- className
1074
- )}
1075
- {...props}
1076
- />
1077
- ))
1078
- DialogTitle.displayName = DialogPrimitive.Title.displayName
1079
-
1080
- const DialogDescription = React.forwardRef<
1081
- React.ElementRef<typeof DialogPrimitive.Description>,
1082
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
1083
- >(({ className, ...props }, ref) => (
1084
- <DialogPrimitive.Description
1085
- ref={ref}
1086
- className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
1087
- {...props}
1088
- />
1089
- ))
1090
- DialogDescription.displayName = DialogPrimitive.Description.displayName
1091
-
1092
- export {
1093
- Dialog,
1094
- DialogPortal,
1095
- DialogOverlay,
1096
- DialogClose,
1097
- DialogTrigger,
1098
- DialogContent,
1099
- DialogHeader,
1100
- DialogFooter,
1101
- DialogTitle,
1102
- DialogDescription,
1103
- }
1104
-
1105
- `;
1106
- export const drawer = `import * as React from "react"
1107
- import { Drawer as DrawerPrimitive } from "vaul"
1108
-
1109
- import { cn } from "../../lib/utils"
1110
-
1111
- const Drawer = ({
1112
- shouldScaleBackground = true,
1113
- ...props
1114
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
1115
- <DrawerPrimitive.Root
1116
- shouldScaleBackground={shouldScaleBackground}
1117
- {...props}
1118
- />
1119
- )
1120
- Drawer.displayName = "Drawer"
1121
-
1122
- const DrawerTrigger = DrawerPrimitive.Trigger
1123
-
1124
- const DrawerPortal = DrawerPrimitive.Portal
1125
-
1126
- const DrawerClose = DrawerPrimitive.Close
1127
-
1128
- const DrawerOverlay = React.forwardRef<
1129
- React.ElementRef<typeof DrawerPrimitive.Overlay>,
1130
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
1131
- >(({ className, ...props }, ref) => (
1132
- <DrawerPrimitive.Overlay
1133
- ref={ref}
1134
- className={cn("fixed inset-0 z-50 bg-black/80", className)}
1135
- {...props}
1136
- />
1137
- ))
1138
- DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
1139
-
1140
- const DrawerContent = React.forwardRef<
1141
- React.ElementRef<typeof DrawerPrimitive.Content>,
1142
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
1143
- >(({ className, children, ...props }, ref) => (
1144
- <DrawerPortal>
1145
- <DrawerOverlay />
1146
- <DrawerPrimitive.Content
1147
- ref={ref}
1148
- className={cn(
1149
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-950",
1150
- className
1151
- )}
1152
- {...props}
1153
- >
1154
- <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-gray-100 dark:bg-gray-800" />
1155
- {children}
1156
- </DrawerPrimitive.Content>
1157
- </DrawerPortal>
1158
- ))
1159
- DrawerContent.displayName = "DrawerContent"
1160
-
1161
- const DrawerHeader = ({
1162
- className,
1163
- ...props
1164
- }: React.HTMLAttributes<HTMLDivElement>) => (
1165
- <div
1166
- className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
1167
- {...props}
1168
- />
1169
- )
1170
- DrawerHeader.displayName = "DrawerHeader"
1171
-
1172
- const DrawerFooter = ({
1173
- className,
1174
- ...props
1175
- }: React.HTMLAttributes<HTMLDivElement>) => (
1176
- <div
1177
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
1178
- {...props}
1179
- />
1180
- )
1181
- DrawerFooter.displayName = "DrawerFooter"
1182
-
1183
- const DrawerTitle = React.forwardRef<
1184
- React.ElementRef<typeof DrawerPrimitive.Title>,
1185
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
1186
- >(({ className, ...props }, ref) => (
1187
- <DrawerPrimitive.Title
1188
- ref={ref}
1189
- className={cn(
1190
- "text-lg font-semibold leading-none tracking-tight",
1191
- className
1192
- )}
1193
- {...props}
1194
- />
1195
- ))
1196
- DrawerTitle.displayName = DrawerPrimitive.Title.displayName
1197
-
1198
- const DrawerDescription = React.forwardRef<
1199
- React.ElementRef<typeof DrawerPrimitive.Description>,
1200
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
1201
- >(({ className, ...props }, ref) => (
1202
- <DrawerPrimitive.Description
1203
- ref={ref}
1204
- className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
1205
- {...props}
1206
- />
1207
- ))
1208
- DrawerDescription.displayName = DrawerPrimitive.Description.displayName
1209
-
1210
- export {
1211
- Drawer,
1212
- DrawerPortal,
1213
- DrawerOverlay,
1214
- DrawerTrigger,
1215
- DrawerClose,
1216
- DrawerContent,
1217
- DrawerHeader,
1218
- DrawerFooter,
1219
- DrawerTitle,
1220
- DrawerDescription,
1221
- }
1222
-
1223
- `;
1224
- export const dropdownMenu = `import * as React from "react"
1225
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
1226
- import { Check, ChevronRight, Circle } from "lucide-react"
1227
-
1228
- import { cn } from "../../lib/utils"
1229
-
1230
- const DropdownMenu = DropdownMenuPrimitive.Root
1231
-
1232
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
1233
-
1234
- const DropdownMenuGroup = DropdownMenuPrimitive.Group
1235
-
1236
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal
1237
-
1238
- const DropdownMenuSub = DropdownMenuPrimitive.Sub
1239
-
1240
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
1241
-
1242
- const DropdownMenuSubTrigger = React.forwardRef<
1243
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
1244
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
1245
- inset?: boolean
1246
- }
1247
- >(({ className, inset, children, ...props }, ref) => (
1248
- <DropdownMenuPrimitive.SubTrigger
1249
- ref={ref}
1250
- className={cn(
1251
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-gray-100 data-[state=open]:bg-gray-100 dark:focus:bg-gray-800 dark:data-[state=open]:bg-gray-800",
1252
- inset && "pl-8",
1253
- className
1254
- )}
1255
- {...props}
1256
- >
1257
- {children}
1258
- <ChevronRight className="ml-auto h-4 w-4" />
1259
- </DropdownMenuPrimitive.SubTrigger>
1260
- ))
1261
- DropdownMenuSubTrigger.displayName =
1262
- DropdownMenuPrimitive.SubTrigger.displayName
1263
-
1264
- const DropdownMenuSubContent = React.forwardRef<
1265
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
1266
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
1267
- >(({ className, ...props }, ref) => (
1268
- <DropdownMenuPrimitive.SubContent
1269
- ref={ref}
1270
- className={cn(
1271
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-gray-200 bg-white p-1 text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1272
- className
1273
- )}
1274
- {...props}
1275
- />
1276
- ))
1277
- DropdownMenuSubContent.displayName =
1278
- DropdownMenuPrimitive.SubContent.displayName
1279
-
1280
- const DropdownMenuContent = React.forwardRef<
1281
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
1282
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
1283
- >(({ className, sideOffset = 4, ...props }, ref) => (
1284
- <DropdownMenuPrimitive.Portal>
1285
- <DropdownMenuPrimitive.Content
1286
- ref={ref}
1287
- sideOffset={sideOffset}
1288
- className={cn(
1289
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-gray-200 bg-white p-1 text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1290
- className
1291
- )}
1292
- {...props}
1293
- />
1294
- </DropdownMenuPrimitive.Portal>
1295
- ))
1296
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
1297
-
1298
- const DropdownMenuItem = React.forwardRef<
1299
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
1300
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
1301
- inset?: boolean
1302
- }
1303
- >(({ className, inset, ...props }, ref) => (
1304
- <DropdownMenuPrimitive.Item
1305
- ref={ref}
1306
- className={cn(
1307
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1308
- inset && "pl-8",
1309
- className
1310
- )}
1311
- {...props}
1312
- />
1313
- ))
1314
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
1315
-
1316
- const DropdownMenuCheckboxItem = React.forwardRef<
1317
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
1318
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
1319
- >(({ className, children, checked, ...props }, ref) => (
1320
- <DropdownMenuPrimitive.CheckboxItem
1321
- ref={ref}
1322
- className={cn(
1323
- "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-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1324
- className
1325
- )}
1326
- checked={checked}
1327
- {...props}
1328
- >
1329
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
1330
- <DropdownMenuPrimitive.ItemIndicator>
1331
- <Check className="h-4 w-4" />
1332
- </DropdownMenuPrimitive.ItemIndicator>
1333
- </span>
1334
- {children}
1335
- </DropdownMenuPrimitive.CheckboxItem>
1336
- ))
1337
- DropdownMenuCheckboxItem.displayName =
1338
- DropdownMenuPrimitive.CheckboxItem.displayName
1339
-
1340
- const DropdownMenuRadioItem = React.forwardRef<
1341
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
1342
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
1343
- >(({ className, children, ...props }, ref) => (
1344
- <DropdownMenuPrimitive.RadioItem
1345
- ref={ref}
1346
- className={cn(
1347
- "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-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1348
- className
1349
- )}
1350
- {...props}
1351
- >
1352
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
1353
- <DropdownMenuPrimitive.ItemIndicator>
1354
- <Circle className="h-2 w-2 fill-current" />
1355
- </DropdownMenuPrimitive.ItemIndicator>
1356
- </span>
1357
- {children}
1358
- </DropdownMenuPrimitive.RadioItem>
1359
- ))
1360
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
1361
-
1362
- const DropdownMenuLabel = React.forwardRef<
1363
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
1364
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
1365
- inset?: boolean
1366
- }
1367
- >(({ className, inset, ...props }, ref) => (
1368
- <DropdownMenuPrimitive.Label
1369
- ref={ref}
1370
- className={cn(
1371
- "px-2 py-1.5 text-sm font-semibold",
1372
- inset && "pl-8",
1373
- className
1374
- )}
1375
- {...props}
1376
- />
1377
- ))
1378
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
1379
-
1380
- const DropdownMenuSeparator = React.forwardRef<
1381
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
1382
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
1383
- >(({ className, ...props }, ref) => (
1384
- <DropdownMenuPrimitive.Separator
1385
- ref={ref}
1386
- className={cn("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-800", className)}
1387
- {...props}
1388
- />
1389
- ))
1390
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
1391
-
1392
- const DropdownMenuShortcut = ({
1393
- className,
1394
- ...props
1395
- }: React.HTMLAttributes<HTMLSpanElement>) => {
1396
- return (
1397
- <span
1398
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
1399
- {...props}
1400
- />
1401
- )
1402
- }
1403
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
1404
-
1405
- export {
1406
- DropdownMenu,
1407
- DropdownMenuTrigger,
1408
- DropdownMenuContent,
1409
- DropdownMenuItem,
1410
- DropdownMenuCheckboxItem,
1411
- DropdownMenuRadioItem,
1412
- DropdownMenuLabel,
1413
- DropdownMenuSeparator,
1414
- DropdownMenuShortcut,
1415
- DropdownMenuGroup,
1416
- DropdownMenuPortal,
1417
- DropdownMenuSub,
1418
- DropdownMenuSubContent,
1419
- DropdownMenuSubTrigger,
1420
- DropdownMenuRadioGroup,
1421
- }
1422
-
1423
- `;
1424
- export const hoverCard = `import * as React from "react"
1425
- import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
1426
-
1427
- import { cn } from "../../lib/utils"
1428
-
1429
- const HoverCard = HoverCardPrimitive.Root
1430
-
1431
- const HoverCardTrigger = HoverCardPrimitive.Trigger
1432
-
1433
- const HoverCardContent = React.forwardRef<
1434
- React.ElementRef<typeof HoverCardPrimitive.Content>,
1435
- React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
1436
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
1437
- <HoverCardPrimitive.Content
1438
- ref={ref}
1439
- align={align}
1440
- sideOffset={sideOffset}
1441
- className={cn(
1442
- "z-50 w-64 rounded-md border border-gray-200 bg-white p-4 text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1443
- className
1444
- )}
1445
- {...props}
1446
- />
1447
- ))
1448
- HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
1449
-
1450
- export { HoverCard, HoverCardTrigger, HoverCardContent }
1451
-
1452
- `;
1453
- export const input = `import * as React from "react"
1454
- import { cn } from "../../lib/utils"
1455
-
1456
- export interface InputProps
1457
- extends React.InputHTMLAttributes<HTMLInputElement> {}
1458
-
1459
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
1460
- ({ className, type, ...props }, ref) => {
1461
- return (
1462
- <input
1463
- type={type}
1464
- className={cn(
1465
- "flex h-10 w-full rounded-md border border-gray-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:ring-offset-gray-950 dark:placeholder:text-gray-400 dark:focus-visible:ring-gray-300",
1466
- className
1467
- )}
1468
- ref={ref}
1469
- {...props}
1470
- />
1471
- )
1472
- }
1473
- )
1474
- Input.displayName = "Input"
1475
-
1476
- export { Input }
1477
- `;
1478
- export const label = `import * as React from 'react';
1479
- import * as LabelPrimitive from '@radix-ui/react-label';
1480
- import { cva, type VariantProps } from 'class-variance-authority';
1481
-
1482
- import { cn } from '../../lib/utils';
1483
-
1484
- const labelVariants = cva(
1485
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1486
- )
1487
-
1488
- const Label = React.forwardRef<
1489
- React.ElementRef<typeof LabelPrimitive.Root>,
1490
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
1491
- VariantProps<typeof labelVariants>
1492
- >(({ className, ...props }, ref) => (
1493
- <LabelPrimitive.Root
1494
- ref={ref}
1495
- className={cn(labelVariants(), className)}
1496
- {...props}
1497
- />
1498
- ))
1499
- Label.displayName = LabelPrimitive.Root.displayName
1500
-
1501
- export { Label }
1502
- `;
1503
- export const menuBar = `
1504
- import * as React from "react"
1505
- import * as MenubarPrimitive from "@radix-ui/react-menubar"
1506
- import { Check, ChevronRight, Circle } from "lucide-react"
1507
-
1508
- import { cn } from "../../lib/utils"
1509
-
1510
- const MenubarMenu = MenubarPrimitive.Menu
1511
-
1512
- const MenubarGroup = MenubarPrimitive.Group
1513
-
1514
- const MenubarPortal = MenubarPrimitive.Portal
1515
-
1516
- const MenubarSub = MenubarPrimitive.Sub
1517
-
1518
- const MenubarRadioGroup = MenubarPrimitive.RadioGroup
1519
-
1520
- const Menubar = React.forwardRef<
1521
- React.ElementRef<typeof MenubarPrimitive.Root>,
1522
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
1523
- >(({ className, ...props }, ref) => (
1524
- <MenubarPrimitive.Root
1525
- ref={ref}
1526
- className={cn(
1527
- "flex h-10 items-center space-x-1 rounded-md border border-gray-200 bg-white p-1 dark:border-gray-800 dark:bg-gray-950",
1528
- className
1529
- )}
1530
- {...props}
1531
- />
1532
- ))
1533
- Menubar.displayName = MenubarPrimitive.Root.displayName
1534
-
1535
- const MenubarTrigger = React.forwardRef<
1536
- React.ElementRef<typeof MenubarPrimitive.Trigger>,
1537
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
1538
- >(({ className, ...props }, ref) => (
1539
- <MenubarPrimitive.Trigger
1540
- ref={ref}
1541
- className={cn(
1542
- "flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-gray-100 focus:text-gray-900 data-[state=open]:bg-gray-100 data-[state=open]:text-gray-900 dark:focus:bg-gray-800 dark:focus:text-gray-50 dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-50",
1543
- className
1544
- )}
1545
- {...props}
1546
- />
1547
- ))
1548
- MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
1549
-
1550
- const MenubarSubTrigger = React.forwardRef<
1551
- React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
1552
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
1553
- inset?: boolean
1554
- }
1555
- >(({ className, inset, children, ...props }, ref) => (
1556
- <MenubarPrimitive.SubTrigger
1557
- ref={ref}
1558
- className={cn(
1559
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[state=open]:bg-gray-100 data-[state=open]:text-gray-900 dark:focus:bg-gray-800 dark:focus:text-gray-50 dark:data-[state=open]:bg-gray-800 dark:data-[state=open]:text-gray-50",
1560
- inset && "pl-8",
1561
- className
1562
- )}
1563
- {...props}
1564
- >
1565
- {children}
1566
- <ChevronRight className="ml-auto h-4 w-4" />
1567
- </MenubarPrimitive.SubTrigger>
1568
- ))
1569
- MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
1570
-
1571
- const MenubarSubContent = React.forwardRef<
1572
- React.ElementRef<typeof MenubarPrimitive.SubContent>,
1573
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
1574
- >(({ className, ...props }, ref) => (
1575
- <MenubarPrimitive.SubContent
1576
- ref={ref}
1577
- className={cn(
1578
- "z-50 min-w-[8rem] overflow-hidden rounded-md border border-gray-200 bg-white p-1 text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1579
- className
1580
- )}
1581
- {...props}
1582
- />
1583
- ))
1584
- MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
1585
-
1586
- const MenubarContent = React.forwardRef<
1587
- React.ElementRef<typeof MenubarPrimitive.Content>,
1588
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
1589
- >(
1590
- (
1591
- { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
1592
- ref
1593
- ) => (
1594
- <MenubarPrimitive.Portal>
1595
- <MenubarPrimitive.Content
1596
- ref={ref}
1597
- align={align}
1598
- alignOffset={alignOffset}
1599
- sideOffset={sideOffset}
1600
- className={cn(
1601
- "z-50 min-w-[12rem] overflow-hidden rounded-md border border-gray-200 bg-white p-1 text-gray-950 shadow-md data-[state=open]:animate-in 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1602
- className
1603
- )}
1604
- {...props}
1605
- />
1606
- </MenubarPrimitive.Portal>
1607
- )
1608
- )
1609
- MenubarContent.displayName = MenubarPrimitive.Content.displayName
1610
-
1611
- const MenubarItem = React.forwardRef<
1612
- React.ElementRef<typeof MenubarPrimitive.Item>,
1613
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
1614
- inset?: boolean
1615
- }
1616
- >(({ className, inset, ...props }, ref) => (
1617
- <MenubarPrimitive.Item
1618
- ref={ref}
1619
- className={cn(
1620
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1621
- inset && "pl-8",
1622
- className
1623
- )}
1624
- {...props}
1625
- />
1626
- ))
1627
- MenubarItem.displayName = MenubarPrimitive.Item.displayName
1628
-
1629
- const MenubarCheckboxItem = React.forwardRef<
1630
- React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
1631
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
1632
- >(({ className, children, checked, ...props }, ref) => (
1633
- <MenubarPrimitive.CheckboxItem
1634
- ref={ref}
1635
- className={cn(
1636
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1637
- className
1638
- )}
1639
- checked={checked}
1640
- {...props}
1641
- >
1642
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
1643
- <MenubarPrimitive.ItemIndicator>
1644
- <Check className="h-4 w-4" />
1645
- </MenubarPrimitive.ItemIndicator>
1646
- </span>
1647
- {children}
1648
- </MenubarPrimitive.CheckboxItem>
1649
- ))
1650
- MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
1651
-
1652
- const MenubarRadioItem = React.forwardRef<
1653
- React.ElementRef<typeof MenubarPrimitive.RadioItem>,
1654
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
1655
- >(({ className, children, ...props }, ref) => (
1656
- <MenubarPrimitive.RadioItem
1657
- ref={ref}
1658
- className={cn(
1659
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
1660
- className
1661
- )}
1662
- {...props}
1663
- >
1664
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
1665
- <MenubarPrimitive.ItemIndicator>
1666
- <Circle className="h-2 w-2 fill-current" />
1667
- </MenubarPrimitive.ItemIndicator>
1668
- </span>
1669
- {children}
1670
- </MenubarPrimitive.RadioItem>
1671
- ))
1672
- MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
1673
-
1674
- const MenubarLabel = React.forwardRef<
1675
- React.ElementRef<typeof MenubarPrimitive.Label>,
1676
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
1677
- inset?: boolean
1678
- }
1679
- >(({ className, inset, ...props }, ref) => (
1680
- <MenubarPrimitive.Label
1681
- ref={ref}
1682
- className={cn(
1683
- "px-2 py-1.5 text-sm font-semibold",
1684
- inset && "pl-8",
1685
- className
1686
- )}
1687
- {...props}
1688
- />
1689
- ))
1690
- MenubarLabel.displayName = MenubarPrimitive.Label.displayName
1691
-
1692
- const MenubarSeparator = React.forwardRef<
1693
- React.ElementRef<typeof MenubarPrimitive.Separator>,
1694
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
1695
- >(({ className, ...props }, ref) => (
1696
- <MenubarPrimitive.Separator
1697
- ref={ref}
1698
- className={cn("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-800", className)}
1699
- {...props}
1700
- />
1701
- ))
1702
- MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
1703
-
1704
- const MenubarShortcut = ({
1705
- className,
1706
- ...props
1707
- }: React.HTMLAttributes<HTMLSpanElement>) => {
1708
- return (
1709
- <span
1710
- className={cn(
1711
- "ml-auto text-xs tracking-widest text-gray-500 dark:text-gray-400",
1712
- className
1713
- )}
1714
- {...props}
1715
- />
1716
- )
1717
- }
1718
- MenubarShortcut.displayname = "MenubarShortcut"
1719
-
1720
- export {
1721
- Menubar,
1722
- MenubarMenu,
1723
- MenubarTrigger,
1724
- MenubarContent,
1725
- MenubarItem,
1726
- MenubarSeparator,
1727
- MenubarLabel,
1728
- MenubarCheckboxItem,
1729
- MenubarRadioGroup,
1730
- MenubarRadioItem,
1731
- MenubarPortal,
1732
- MenubarSubContent,
1733
- MenubarSubTrigger,
1734
- MenubarGroup,
1735
- MenubarSub,
1736
- MenubarShortcut,
1737
- }
1738
-
1739
- `;
1740
- export const navigationMenu = `import * as React from "react"
1741
- import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
1742
- import { cva } from "class-variance-authority"
1743
- import { ChevronDown } from "lucide-react"
1744
-
1745
- import { cn } from "../../lib/utils"
1746
-
1747
- const NavigationMenu = React.forwardRef<
1748
- React.ElementRef<typeof NavigationMenuPrimitive.Root>,
1749
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
1750
- >(({ className, children, ...props }, ref) => (
1751
- <NavigationMenuPrimitive.Root
1752
- ref={ref}
1753
- className={cn(
1754
- "relative z-10 flex max-w-max flex-1 items-center justify-center",
1755
- className
1756
- )}
1757
- {...props}
1758
- >
1759
- {children}
1760
- <NavigationMenuViewport />
1761
- </NavigationMenuPrimitive.Root>
1762
- ))
1763
- NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
1764
-
1765
- const NavigationMenuList = React.forwardRef<
1766
- React.ElementRef<typeof NavigationMenuPrimitive.List>,
1767
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
1768
- >(({ className, ...props }, ref) => (
1769
- <NavigationMenuPrimitive.List
1770
- ref={ref}
1771
- className={cn(
1772
- "group flex flex-1 list-none items-center justify-center space-x-1",
1773
- className
1774
- )}
1775
- {...props}
1776
- />
1777
- ))
1778
- NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
1779
-
1780
- const NavigationMenuItem = NavigationMenuPrimitive.Item
1781
-
1782
- const navigationMenuTriggerStyle = cva(
1783
- "group inline-flex h-10 w-max items-center justify-center rounded-md bg-white px-4 py-2 text-sm font-medium transition-colors hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900 focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-gray-100/50 data-[state=open]:bg-gray-100/50 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:focus:bg-gray-800 dark:focus:text-gray-50 dark:data-[active]:bg-gray-800/50 dark:data-[state=open]:bg-gray-800/50"
1784
- )
1785
-
1786
- const NavigationMenuTrigger = React.forwardRef<
1787
- React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
1788
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
1789
- >(({ className, children, ...props }, ref) => (
1790
- <NavigationMenuPrimitive.Trigger
1791
- ref={ref}
1792
- className={cn(navigationMenuTriggerStyle(), "group", className)}
1793
- {...props}
1794
- >
1795
- {children}{""}
1796
- <ChevronDown
1797
- className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
1798
- aria-hidden="true"
1799
- />
1800
- </NavigationMenuPrimitive.Trigger>
1801
- ))
1802
- NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
1803
-
1804
- const NavigationMenuContent = React.forwardRef<
1805
- React.ElementRef<typeof NavigationMenuPrimitive.Content>,
1806
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
1807
- >(({ className, ...props }, ref) => (
1808
- <NavigationMenuPrimitive.Content
1809
- ref={ref}
1810
- className={cn(
1811
- "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto",
1812
- className
1813
- )}
1814
- {...props}
1815
- />
1816
- ))
1817
- NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
1818
-
1819
- const NavigationMenuLink = NavigationMenuPrimitive.Link
1820
-
1821
- const NavigationMenuViewport = React.forwardRef<
1822
- React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
1823
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
1824
- >(({ className, ...props }, ref) => (
1825
- <div className={cn("absolute left-0 top-full flex justify-center")}>
1826
- <NavigationMenuPrimitive.Viewport
1827
- className={cn(
1828
- "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border border-gray-200 bg-white text-gray-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)] dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
1829
- className
1830
- )}
1831
- ref={ref}
1832
- {...props}
1833
- />
1834
- </div>
1835
- ))
1836
- NavigationMenuViewport.displayName =
1837
- NavigationMenuPrimitive.Viewport.displayName
1838
-
1839
- const NavigationMenuIndicator = React.forwardRef<
1840
- React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
1841
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
1842
- >(({ className, ...props }, ref) => (
1843
- <NavigationMenuPrimitive.Indicator
1844
- ref={ref}
1845
- className={cn(
1846
- "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
1847
- className
1848
- )}
1849
- {...props}
1850
- >
1851
- <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-gray-200 shadow-md dark:bg-gray-800" />
1852
- </NavigationMenuPrimitive.Indicator>
1853
- ))
1854
- NavigationMenuIndicator.displayName =
1855
- NavigationMenuPrimitive.Indicator.displayName
1856
-
1857
- export {
1858
- navigationMenuTriggerStyle,
1859
- NavigationMenu,
1860
- NavigationMenuList,
1861
- NavigationMenuItem,
1862
- NavigationMenuContent,
1863
- NavigationMenuTrigger,
1864
- NavigationMenuLink,
1865
- NavigationMenuIndicator,
1866
- NavigationMenuViewport,
1867
- }
1868
-
1869
- `;
1870
- export const pagination = `import * as React from "react"
1871
- import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
1872
-
1873
- import { cn } from "../../lib/utils"
1874
- import { ButtonProps, buttonVariants } from "./button"
1875
-
1876
- const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
1877
- <nav
1878
- role="navigation"
1879
- aria-label="pagination"
1880
- className={cn("mx-auto flex w-full justify-center", className)}
1881
- {...props}
1882
- />
1883
- )
1884
- Pagination.displayName = "Pagination"
1885
-
1886
- const PaginationContent = React.forwardRef<
1887
- HTMLUListElement,
1888
- React.ComponentProps<"ul">
1889
- >(({ className, ...props }, ref) => (
1890
- <ul
1891
- ref={ref}
1892
- className={cn("flex flex-row items-center gap-1", className)}
1893
- {...props}
1894
- />
1895
- ))
1896
- PaginationContent.displayName = "PaginationContent"
1897
-
1898
- const PaginationItem = React.forwardRef<
1899
- HTMLLIElement,
1900
- React.ComponentProps<"li">
1901
- >(({ className, ...props }, ref) => (
1902
- <li ref={ref} className={cn("", className)} {...props} />
1903
- ))
1904
- PaginationItem.displayName = "PaginationItem"
1905
-
1906
- type PaginationLinkProps = {
1907
- isActive?: boolean
1908
- } & Pick<ButtonProps, "size"> &
1909
- React.ComponentProps<"a">
1910
-
1911
- const PaginationLink = ({
1912
- className,
1913
- isActive,
1914
- size = "icon",
1915
- ...props
1916
- }: PaginationLinkProps) => (
1917
- <a
1918
- aria-current={isActive ? "page" : undefined}
1919
- className={cn(
1920
- buttonVariants({
1921
- variant: isActive ? "outline" : "ghost",
1922
- size,
1923
- }),
1924
- className
1925
- )}
1926
- {...props}
1927
- />
1928
- )
1929
- PaginationLink.displayName = "PaginationLink"
1930
-
1931
- const PaginationPrevious = ({
1932
- className,
1933
- ...props
1934
- }: React.ComponentProps<typeof PaginationLink>) => (
1935
- <PaginationLink
1936
- aria-label="Go to previous page"
1937
- size="default"
1938
- className={cn("gap-1 pl-2.5", className)}
1939
- {...props}
1940
- >
1941
- <ChevronLeft className="h-4 w-4" />
1942
- <span>Previous</span>
1943
- </PaginationLink>
1944
- )
1945
- PaginationPrevious.displayName = "PaginationPrevious"
1946
-
1947
- const PaginationNext = ({
1948
- className,
1949
- ...props
1950
- }: React.ComponentProps<typeof PaginationLink>) => (
1951
- <PaginationLink
1952
- aria-label="Go to next page"
1953
- size="default"
1954
- className={cn("gap-1 pr-2.5", className)}
1955
- {...props}
1956
- >
1957
- <span>Next</span>
1958
- <ChevronRight className="h-4 w-4" />
1959
- </PaginationLink>
1960
- )
1961
- PaginationNext.displayName = "PaginationNext"
1962
-
1963
- const PaginationEllipsis = ({
1964
- className,
1965
- ...props
1966
- }: React.ComponentProps<"span">) => (
1967
- <span
1968
- aria-hidden
1969
- className={cn("flex h-9 w-9 items-center justify-center", className)}
1970
- {...props}
1971
- >
1972
- <MoreHorizontal className="h-4 w-4" />
1973
- <span className="sr-only">More pages</span>
1974
- </span>
1975
- )
1976
- PaginationEllipsis.displayName = "PaginationEllipsis"
1977
-
1978
- export {
1979
- Pagination,
1980
- PaginationContent,
1981
- PaginationEllipsis,
1982
- PaginationItem,
1983
- PaginationLink,
1984
- PaginationNext,
1985
- PaginationPrevious,
1986
- }
1987
-
1988
- `;
1989
- export const popover = `import * as React from "react"
1990
- import * as PopoverPrimitive from "@radix-ui/react-popover"
1991
-
1992
- import { cn } from "../../lib/utils"
1993
-
1994
- const Popover = PopoverPrimitive.Root
1995
-
1996
- const PopoverTrigger = PopoverPrimitive.Trigger
1997
-
1998
- const PopoverContent = React.forwardRef<
1999
- React.ElementRef<typeof PopoverPrimitive.Content>,
2000
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
2001
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
2002
- <PopoverPrimitive.Portal>
2003
- <PopoverPrimitive.Content
2004
- ref={ref}
2005
- align={align}
2006
- sideOffset={sideOffset}
2007
- className={cn(
2008
- "z-50 w-72 rounded-md border border-gray-200 bg-white p-4 text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
2009
- className
2010
- )}
2011
- {...props}
2012
- />
2013
- </PopoverPrimitive.Portal>
2014
- ))
2015
- PopoverContent.displayName = PopoverPrimitive.Content.displayName
2016
-
2017
- export { Popover, PopoverTrigger, PopoverContent }
2018
-
2019
- `;
2020
- export const progress = `import * as React from "react"
2021
- import * as ProgressPrimitive from "@radix-ui/react-progress"
2022
-
2023
- import { cn } from "../../lib/utils"
2024
-
2025
- const Progress = React.forwardRef<
2026
- React.ElementRef<typeof ProgressPrimitive.Root>,
2027
- React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
2028
- >(({ className, value, ...props }, ref) => (
2029
- <ProgressPrimitive.Root
2030
- ref={ref}
2031
- className={cn(
2032
- "relative h-4 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800",
2033
- className
2034
- )}
2035
- {...props}
2036
- >
2037
- <ProgressPrimitive.Indicator
2038
- className="h-full w-full flex-1 bg-gray-900 transition-all dark:bg-gray-50"
2039
- style={{ transform: \`translateX(-\${100 - (value || 0)}%)\` }}
2040
- />
2041
- </ProgressPrimitive.Root>
2042
- ))
2043
- Progress.displayName = ProgressPrimitive.Root.displayName
2044
-
2045
- export { Progress }
2046
- `;
2047
- export const radioGroup = `import * as React from "react"
2048
- import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
2049
- import { Circle } from "lucide-react"
2050
-
2051
- import { cn } from "../../lib/utils"
2052
-
2053
- const RadioGroup = React.forwardRef<
2054
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
2055
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
2056
- >(({ className, ...props }, ref) => {
2057
- return (
2058
- <RadioGroupPrimitive.Root
2059
- className={cn("grid gap-2", className)}
2060
- {...props}
2061
- ref={ref}
2062
- />
2063
- )
2064
- })
2065
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
2066
-
2067
- const RadioGroupItem = React.forwardRef<
2068
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
2069
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
2070
- >(({ className, ...props }, ref) => {
2071
- return (
2072
- <RadioGroupPrimitive.Item
2073
- ref={ref}
2074
- className={cn(
2075
- "aspect-square h-4 w-4 rounded-full border border-gray-200 dark:border-gray-900 text-gray-900 ring-offset-white focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-50 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300",
2076
- className
2077
- )}
2078
- {...props}
2079
- >
2080
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
2081
- <Circle className="h-2.5 w-2.5 fill-current text-current" />
2082
- </RadioGroupPrimitive.Indicator>
2083
- </RadioGroupPrimitive.Item>
2084
- )
2085
- })
2086
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
2087
-
2088
- export { RadioGroup, RadioGroupItem }
2089
-
2090
- `;
2091
- export const select = `import * as React from "react"
2092
- import * as SelectPrimitive from "@radix-ui/react-select"
2093
- import { Check, ChevronDown, ChevronUp } from "lucide-react"
2094
-
2095
- import { cn } from "../../lib/utils"
2096
-
2097
- const Select = SelectPrimitive.Root
2098
-
2099
- const SelectGroup = SelectPrimitive.Group
2100
-
2101
- const SelectValue = SelectPrimitive.Value
2102
-
2103
- const SelectTrigger = React.forwardRef<
2104
- React.ElementRef<typeof SelectPrimitive.Trigger>,
2105
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
2106
- >(({ className, children, ...props }, ref) => (
2107
- <SelectPrimitive.Trigger
2108
- ref={ref}
2109
- className={cn(
2110
- "flex h-10 w-full items-center justify-between rounded-md border border-gray-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-950 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 dark:border-gray-800 dark:bg-gray-950 dark:ring-offset-gray-950 dark:placeholder:text-gray-400 dark:focus:ring-gray-300",
2111
- className
2112
- )}
2113
- {...props}
2114
- >
2115
- {children}
2116
- <SelectPrimitive.Icon asChild>
2117
- <ChevronDown className="h-4 w-4 opacity-50" />
2118
- </SelectPrimitive.Icon>
2119
- </SelectPrimitive.Trigger>
2120
- ))
2121
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
2122
-
2123
- const SelectScrollUpButton = React.forwardRef<
2124
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
2125
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
2126
- >(({ className, ...props }, ref) => (
2127
- <SelectPrimitive.ScrollUpButton
2128
- ref={ref}
2129
- className={cn(
2130
- "flex cursor-default items-center justify-center py-1",
2131
- className
2132
- )}
2133
- {...props}
2134
- >
2135
- <ChevronUp className="h-4 w-4" />
2136
- </SelectPrimitive.ScrollUpButton>
2137
- ))
2138
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
2139
-
2140
- const SelectScrollDownButton = React.forwardRef<
2141
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
2142
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
2143
- >(({ className, ...props }, ref) => (
2144
- <SelectPrimitive.ScrollDownButton
2145
- ref={ref}
2146
- className={cn(
2147
- "flex cursor-default items-center justify-center py-1",
2148
- className
2149
- )}
2150
- {...props}
2151
- >
2152
- <ChevronDown className="h-4 w-4" />
2153
- </SelectPrimitive.ScrollDownButton>
2154
- ))
2155
- SelectScrollDownButton.displayName =
2156
- SelectPrimitive.ScrollDownButton.displayName
2157
-
2158
- const SelectContent = React.forwardRef<
2159
- React.ElementRef<typeof SelectPrimitive.Content>,
2160
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
2161
- >(({ className, children, position = "popper", ...props }, ref) => (
2162
- <SelectPrimitive.Portal>
2163
- <SelectPrimitive.Content
2164
- ref={ref}
2165
- className={cn(
2166
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-gray-200 bg-white text-gray-950 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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
2167
- position === "popper" &&
2168
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
2169
- className
2170
- )}
2171
- position={position}
2172
- {...props}
2173
- >
2174
- <SelectScrollUpButton />
2175
- <SelectPrimitive.Viewport
2176
- className={cn(
2177
- "p-1",
2178
- position === "popper" &&
2179
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
2180
- )}
2181
- >
2182
- {children}
2183
- </SelectPrimitive.Viewport>
2184
- <SelectScrollDownButton />
2185
- </SelectPrimitive.Content>
2186
- </SelectPrimitive.Portal>
2187
- ))
2188
- SelectContent.displayName = SelectPrimitive.Content.displayName
2189
-
2190
- const SelectLabel = React.forwardRef<
2191
- React.ElementRef<typeof SelectPrimitive.Label>,
2192
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
2193
- >(({ className, ...props }, ref) => (
2194
- <SelectPrimitive.Label
2195
- ref={ref}
2196
- className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
2197
- {...props}
2198
- />
2199
- ))
2200
- SelectLabel.displayName = SelectPrimitive.Label.displayName
2201
-
2202
- const SelectItem = React.forwardRef<
2203
- React.ElementRef<typeof SelectPrimitive.Item>,
2204
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
2205
- >(({ className, children, ...props }, ref) => (
2206
- <SelectPrimitive.Item
2207
- ref={ref}
2208
- className={cn(
2209
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 focus:text-gray-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-gray-800 dark:focus:text-gray-50",
2210
- className
2211
- )}
2212
- {...props}
2213
- >
2214
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
2215
- <SelectPrimitive.ItemIndicator>
2216
- <Check className="h-4 w-4" />
2217
- </SelectPrimitive.ItemIndicator>
2218
- </span>
2219
-
2220
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
2221
- </SelectPrimitive.Item>
2222
- ))
2223
- SelectItem.displayName = SelectPrimitive.Item.displayName
2224
-
2225
- const SelectSeparator = React.forwardRef<
2226
- React.ElementRef<typeof SelectPrimitive.Separator>,
2227
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
2228
- >(({ className, ...props }, ref) => (
2229
- <SelectPrimitive.Separator
2230
- ref={ref}
2231
- className={cn("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-800", className)}
2232
- {...props}
2233
- />
2234
- ))
2235
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName
2236
-
2237
- export {
2238
- Select,
2239
- SelectGroup,
2240
- SelectValue,
2241
- SelectTrigger,
2242
- SelectContent,
2243
- SelectLabel,
2244
- SelectItem,
2245
- SelectSeparator,
2246
- SelectScrollUpButton,
2247
- SelectScrollDownButton,
2248
- }
2249
-
2250
- `;
2251
- export const separator = `import * as React from "react"
2252
- import * as SeparatorPrimitive from "@radix-ui/react-separator"
2253
-
2254
- import { cn } from "../../lib/utils"
2255
-
2256
- const Separator = React.forwardRef<
2257
- React.ElementRef<typeof SeparatorPrimitive.Root>,
2258
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
2259
- >(
2260
- (
2261
- { className, orientation = "horizontal", decorative = true, ...props },
2262
- ref
2263
- ) => (
2264
- <SeparatorPrimitive.Root
2265
- ref={ref}
2266
- decorative={decorative}
2267
- orientation={orientation}
2268
- className={cn(
2269
- "shrink-0 bg-gray-200 dark:bg-gray-800",
2270
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
2271
- className
2272
- )}
2273
- {...props}
2274
- />
2275
- )
2276
- )
2277
- Separator.displayName = SeparatorPrimitive.Root.displayName
2278
-
2279
- export { Separator }
2280
-
2281
- `;
2282
- export const skeleton = `import { cn } from "../../lib/utils"
2283
-
2284
- function Skeleton({
2285
- className,
2286
- ...props
2287
- }: React.HTMLAttributes<HTMLDivElement>) {
2288
- return (
2289
- <div
2290
- className={cn("animate-pulse rounded-md bg-gray-100 dark:bg-gray-800", className)}
2291
- {...props}
2292
- />
2293
- )
2294
- }
2295
-
2296
- export { Skeleton }
2297
- `;
2298
- export const slider = `import * as React from "react"
2299
- import * as SliderPrimitive from "@radix-ui/react-slider"
2300
-
2301
- import { cn } from "../../lib/utils"
2302
-
2303
- const Slider = React.forwardRef<
2304
- React.ElementRef<typeof SliderPrimitive.Root>,
2305
- React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
2306
- >(({ className, ...props }, ref) => (
2307
- <SliderPrimitive.Root
2308
- ref={ref}
2309
- className={cn(
2310
- "relative flex w-full touch-none select-none items-center",
2311
- className
2312
- )}
2313
- {...props}
2314
- >
2315
- <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800">
2316
- <SliderPrimitive.Range className="absolute h-full bg-gray-900 dark:bg-gray-50" />
2317
- </SliderPrimitive.Track>
2318
- <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-gray-900 bg-white ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-50 dark:bg-gray-950 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300" />
2319
- </SliderPrimitive.Root>
2320
- ))
2321
- Slider.displayName = SliderPrimitive.Root.displayName
2322
-
2323
- export { Slider }
2324
-
2325
- `;
2326
- export const switchComponent = `import * as React from "react"
2327
- import * as SwitchPrimitives from "@radix-ui/react-switch"
2328
-
2329
- import { cn } from "../../lib/utils"
2330
-
2331
- const Switch = React.forwardRef<
2332
- React.ElementRef<typeof SwitchPrimitives.Root>,
2333
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
2334
- >(({ className, ...props }, ref) => (
2335
- <SwitchPrimitives.Root
2336
- className={cn(
2337
- "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-900 data-[state=unchecked]:bg-gray-200 dark:focus-visible:ring-gray-300 dark:focus-visible:ring-offset-gray-950 dark:data-[state=checked]:bg-gray-50 dark:data-[state=unchecked]:bg-gray-800",
2338
- className
2339
- )}
2340
- {...props}
2341
- ref={ref}
2342
- >
2343
- <SwitchPrimitives.Thumb
2344
- className={cn(
2345
- "pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-gray-950"
2346
- )}
2347
- />
2348
- </SwitchPrimitives.Root>
2349
- ))
2350
- Switch.displayName = SwitchPrimitives.Root.displayName
2351
-
2352
- export { Switch }
2353
-
2354
- `;
2355
- export const table = `import * as React from "react"
2356
-
2357
- import { cn } from "../../lib/utils"
2358
-
2359
- const Table = React.forwardRef<
2360
- HTMLTableElement,
2361
- React.HTMLAttributes<HTMLTableElement>
2362
- >(({ className, ...props }, ref) => (
2363
- <div className="relative w-full overflow-auto">
2364
- <table
2365
- ref={ref}
2366
- className={cn("w-full caption-bottom text-sm", className)}
2367
- {...props}
2368
- />
2369
- </div>
2370
- ))
2371
- Table.displayName = "Table"
2372
-
2373
- const TableHeader = React.forwardRef<
2374
- HTMLTableSectionElement,
2375
- React.HTMLAttributes<HTMLTableSectionElement>
2376
- >(({ className, ...props }, ref) => (
2377
- <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
2378
- ))
2379
- TableHeader.displayName = "TableHeader"
2380
-
2381
- const TableBody = React.forwardRef<
2382
- HTMLTableSectionElement,
2383
- React.HTMLAttributes<HTMLTableSectionElement>
2384
- >(({ className, ...props }, ref) => (
2385
- <tbody
2386
- ref={ref}
2387
- className={cn("[&_tr:last-child]:border-0", className)}
2388
- {...props}
2389
- />
2390
- ))
2391
- TableBody.displayName = "TableBody"
2392
-
2393
- const TableFooter = React.forwardRef<
2394
- HTMLTableSectionElement,
2395
- React.HTMLAttributes<HTMLTableSectionElement>
2396
- >(({ className, ...props }, ref) => (
2397
- <tfoot
2398
- ref={ref}
2399
- className={cn(
2400
- "border-t bg-gray-100/50 font-medium [&>tr]:last:border-b-0 dark:bg-gray-800/50",
2401
- className
2402
- )}
2403
- {...props}
2404
- />
2405
- ))
2406
- TableFooter.displayName = "TableFooter"
2407
-
2408
- const TableRow = React.forwardRef<
2409
- HTMLTableRowElement,
2410
- React.HTMLAttributes<HTMLTableRowElement>
2411
- >(({ className, ...props }, ref) => (
2412
- <tr
2413
- ref={ref}
2414
- className={cn(
2415
- "border-b transition-colors hover:bg-gray-100/50 data-[state=selected]:bg-gray-100 dark:hover:bg-gray-800/50 dark:data-[state=selected]:bg-gray-800",
2416
- className
2417
- )}
2418
- {...props}
2419
- />
2420
- ))
2421
- TableRow.displayName = "TableRow"
2422
-
2423
- const TableHead = React.forwardRef<
2424
- HTMLTableCellElement,
2425
- React.ThHTMLAttributes<HTMLTableCellElement>
2426
- >(({ className, ...props }, ref) => (
2427
- <th
2428
- ref={ref}
2429
- className={cn(
2430
- "h-12 px-4 text-left align-middle font-medium text-gray-500 [&:has([role=checkbox])]:pr-0 dark:text-gray-400",
2431
- className
2432
- )}
2433
- {...props}
2434
- />
2435
- ))
2436
- TableHead.displayName = "TableHead"
2437
-
2438
- const TableCell = React.forwardRef<
2439
- HTMLTableCellElement,
2440
- React.TdHTMLAttributes<HTMLTableCellElement>
2441
- >(({ className, ...props }, ref) => (
2442
- <td
2443
- ref={ref}
2444
- className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
2445
- {...props}
2446
- />
2447
- ))
2448
- TableCell.displayName = "TableCell"
2449
-
2450
- const TableCaption = React.forwardRef<
2451
- HTMLTableCaptionElement,
2452
- React.HTMLAttributes<HTMLTableCaptionElement>
2453
- >(({ className, ...props }, ref) => (
2454
- <caption
2455
- ref={ref}
2456
- className={cn("mt-4 text-sm text-gray-500 dark:text-gray-400", className)}
2457
- {...props}
2458
- />
2459
- ))
2460
- TableCaption.displayName = "TableCaption"
2461
-
2462
- export {
2463
- Table,
2464
- TableHeader,
2465
- TableBody,
2466
- TableFooter,
2467
- TableHead,
2468
- TableRow,
2469
- TableCell,
2470
- TableCaption,
2471
- }
2472
-
2473
- `;
2474
- export const tabs = `import * as React from "react"
2475
- import * as TabsPrimitive from "@radix-ui/react-tabs"
2476
-
2477
- import { cn } from "../../lib/utils"
2478
-
2479
- const Tabs = TabsPrimitive.Root
2480
-
2481
- const TabsList = React.forwardRef<
2482
- React.ElementRef<typeof TabsPrimitive.List>,
2483
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
2484
- >(({ className, ...props }, ref) => (
2485
- <TabsPrimitive.List
2486
- ref={ref}
2487
- className={cn(
2488
- "inline-flex h-10 items-center justify-center rounded-md bg-gray-100 p-1 text-gray-500 dark:bg-gray-800 dark:text-gray-400",
2489
- className
2490
- )}
2491
- {...props}
2492
- />
2493
- ))
2494
- TabsList.displayName = TabsPrimitive.List.displayName
2495
-
2496
- const TabsTrigger = React.forwardRef<
2497
- React.ElementRef<typeof TabsPrimitive.Trigger>,
2498
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
2499
- >(({ className, ...props }, ref) => (
2500
- <TabsPrimitive.Trigger
2501
- ref={ref}
2502
- className={cn(
2503
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-gray-950 data-[state=active]:shadow-sm dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300 dark:data-[state=active]:bg-gray-950 dark:data-[state=active]:text-gray-50",
2504
- className
2505
- )}
2506
- {...props}
2507
- />
2508
- ))
2509
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
2510
-
2511
- const TabsContent = React.forwardRef<
2512
- React.ElementRef<typeof TabsPrimitive.Content>,
2513
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
2514
- >(({ className, ...props }, ref) => (
2515
- <TabsPrimitive.Content
2516
- ref={ref}
2517
- className={cn(
2518
- "mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 dark:ring-offset-gray-950 dark:focus-visible:ring-gray-300",
2519
- className
2520
- )}
2521
- {...props}
2522
- />
2523
- ))
2524
- TabsContent.displayName = TabsPrimitive.Content.displayName
2525
-
2526
- export { Tabs, TabsList, TabsTrigger, TabsContent }
2527
-
2528
- `;
2529
- export const textarea = `import * as React from "react"
2530
-
2531
- import { cn } from "../../lib/utils"
2532
-
2533
- export interface TextareaProps
2534
- extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
2535
-
2536
- const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
2537
- ({ className, ...props }, ref) => {
2538
- return (
2539
- <textarea
2540
- className={cn(
2541
- "flex min-h-[80px] w-full rounded-md border border-gray-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:ring-offset-gray-950 dark:placeholder:text-gray-400 dark:focus-visible:ring-gray-300",
2542
- className
2543
- )}
2544
- ref={ref}
2545
- {...props}
2546
- />
2547
- )
2548
- }
2549
- )
2550
- Textarea.displayName = "Textarea"
2551
-
2552
- export { Textarea }
2553
-
2554
- `;
2555
- export const toast = `import * as React from "react"
2556
- import * as ToastPrimitives from "@radix-ui/react-toast"
2557
- import { cva, type VariantProps } from "class-variance-authority"
2558
- import { X } from "lucide-react"
2559
-
2560
- import { cn } from "../../lib/utils"
2561
-
2562
- const ToastProvider = ToastPrimitives.Provider
2563
-
2564
- const ToastViewport = React.forwardRef<
2565
- React.ElementRef<typeof ToastPrimitives.Viewport>,
2566
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
2567
- >(({ className, ...props }, ref) => (
2568
- <ToastPrimitives.Viewport
2569
- ref={ref}
2570
- className={cn(
2571
- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
2572
- className
2573
- )}
2574
- {...props}
2575
- />
2576
- ))
2577
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName
2578
-
2579
- const toastVariants = cva(
2580
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border border-gray-200 p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full dark:border-gray-800",
2581
- {
2582
- variants: {
2583
- variant: {
2584
- default: "border bg-white text-gray-950 dark:bg-gray-950 dark:text-gray-50",
2585
- destructive:
2586
- "destructive group border-red-500 bg-red-500 text-gray-50 dark:border-red-900 dark:bg-red-900 dark:text-gray-50",
2587
- },
2588
- },
2589
- defaultVariants: {
2590
- variant: "default",
2591
- },
2592
- }
2593
- )
2594
-
2595
- const Toast = React.forwardRef<
2596
- React.ElementRef<typeof ToastPrimitives.Root>,
2597
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
2598
- VariantProps<typeof toastVariants>
2599
- >(({ className, variant, ...props }, ref) => {
2600
- return (
2601
- <ToastPrimitives.Root
2602
- ref={ref}
2603
- className={cn(toastVariants({ variant }), className)}
2604
- {...props}
2605
- />
2606
- )
2607
- })
2608
- Toast.displayName = ToastPrimitives.Root.displayName
2609
-
2610
- const ToastAction = React.forwardRef<
2611
- React.ElementRef<typeof ToastPrimitives.Action>,
2612
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
2613
- >(({ className, ...props }, ref) => (
2614
- <ToastPrimitives.Action
2615
- ref={ref}
2616
- className={cn(
2617
- "inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-gray-200 bg-transparent px-3 text-sm font-medium ring-offset-white transition-colors hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-950 focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-gray-100/40 group-[.destructive]:hover:border-red-500/30 group-[.destructive]:hover:bg-red-500 group-[.destructive]:hover:text-gray-50 group-[.destructive]:focus:ring-red-500 dark:border-gray-800 dark:ring-offset-gray-950 dark:hover:bg-gray-800 dark:focus:ring-gray-300 dark:group-[.destructive]:border-gray-800/40 dark:group-[.destructive]:hover:border-red-900/30 dark:group-[.destructive]:hover:bg-red-900 dark:group-[.destructive]:hover:text-gray-50 dark:group-[.destructive]:focus:ring-red-900",
2618
- className
2619
- )}
2620
- {...props}
2621
- />
2622
- ))
2623
- ToastAction.displayName = ToastPrimitives.Action.displayName
2624
-
2625
- const ToastClose = React.forwardRef<
2626
- React.ElementRef<typeof ToastPrimitives.Close>,
2627
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
2628
- >(({ className, ...props }, ref) => (
2629
- <ToastPrimitives.Close
2630
- ref={ref}
2631
- className={cn(
2632
- "absolute right-2 top-2 rounded-md p-1 text-gray-950/50 opacity-0 transition-opacity hover:text-gray-950 focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:text-gray-50/50 dark:hover:text-gray-50",
2633
- className
2634
- )}
2635
- toast-close=""
2636
- {...props}
2637
- >
2638
- <X className="h-4 w-4" />
2639
- </ToastPrimitives.Close>
2640
- ))
2641
- ToastClose.displayName = ToastPrimitives.Close.displayName
2642
-
2643
- const ToastTitle = React.forwardRef<
2644
- React.ElementRef<typeof ToastPrimitives.Title>,
2645
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
2646
- >(({ className, ...props }, ref) => (
2647
- <ToastPrimitives.Title
2648
- ref={ref}
2649
- className={cn("text-sm font-semibold", className)}
2650
- {...props}
2651
- />
2652
- ))
2653
- ToastTitle.displayName = ToastPrimitives.Title.displayName
2654
-
2655
- const ToastDescription = React.forwardRef<
2656
- React.ElementRef<typeof ToastPrimitives.Description>,
2657
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
2658
- >(({ className, ...props }, ref) => (
2659
- <ToastPrimitives.Description
2660
- ref={ref}
2661
- className={cn("text-sm opacity-90", className)}
2662
- {...props}
2663
- />
2664
- ))
2665
- ToastDescription.displayName = ToastPrimitives.Description.displayName
2666
-
2667
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
2668
-
2669
- type ToastActionElement = React.ReactElement<typeof ToastAction>
2670
-
2671
- export {
2672
- type ToastProps,
2673
- type ToastActionElement,
2674
- ToastProvider,
2675
- ToastViewport,
2676
- Toast,
2677
- ToastTitle,
2678
- ToastDescription,
2679
- ToastClose,
2680
- ToastAction,
2681
- }
2682
-
2683
- `;
2684
- export const toaster = `import {
2685
- Toast,
2686
- ToastClose,
2687
- ToastDescription,
2688
- ToastProvider,
2689
- ToastTitle,
2690
- ToastViewport,
2691
- } from "./toast"
2692
- import { useToast } from "./use-toast"
2693
-
2694
- export function Toaster() {
2695
- const { toasts } = useToast()
2696
-
2697
- return (
2698
- <ToastProvider>
2699
- {toasts.map(function ({ id, title, description, action, ...props }) {
2700
- return (
2701
- <Toast key={id} {...props}>
2702
- <div className="grid gap-1">
2703
- {title && <ToastTitle>{title}</ToastTitle>}
2704
- {description && (
2705
- <ToastDescription>{description}</ToastDescription>
2706
- )}
2707
- </div>
2708
- {action}
2709
- <ToastClose />
2710
- </Toast>
2711
- )
2712
- })}
2713
- <ToastViewport />
2714
- </ToastProvider>
2715
- )
2716
- }
2717
-
2718
- `;
2719
- export const toggleGroup = `import * as React from "react"
2720
- import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
2721
- import { type VariantProps } from "class-variance-authority"
2722
-
2723
- import { cn } from "../../lib/utils"
2724
- import { toggleVariants } from "./toggle"
2725
-
2726
- const ToggleGroupContext = React.createContext<
2727
- VariantProps<typeof toggleVariants>
2728
- >({
2729
- size: "default",
2730
- variant: "default",
2731
- })
2732
-
2733
- const ToggleGroup = React.forwardRef<
2734
- React.ElementRef<typeof ToggleGroupPrimitive.Root>,
2735
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
2736
- VariantProps<typeof toggleVariants>
2737
- >(({ className, variant, size, children, ...props }, ref) => (
2738
- <ToggleGroupPrimitive.Root
2739
- ref={ref}
2740
- className={cn("flex items-center justify-center gap-1", className)}
2741
- {...props}
2742
- >
2743
- <ToggleGroupContext.Provider value={{ variant, size }}>
2744
- {children}
2745
- </ToggleGroupContext.Provider>
2746
- </ToggleGroupPrimitive.Root>
2747
- ))
2748
-
2749
- ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
2750
-
2751
- const ToggleGroupItem = React.forwardRef<
2752
- React.ElementRef<typeof ToggleGroupPrimitive.Item>,
2753
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
2754
- VariantProps<typeof toggleVariants>
2755
- >(({ className, children, variant, size, ...props }, ref) => {
2756
- const context = React.useContext(ToggleGroupContext)
2757
-
2758
- return (
2759
- <ToggleGroupPrimitive.Item
2760
- ref={ref}
2761
- className={cn(
2762
- toggleVariants({
2763
- variant: context.variant || variant,
2764
- size: context.size || size,
2765
- }),
2766
- className
2767
- )}
2768
- {...props}
2769
- >
2770
- {children}
2771
- </ToggleGroupPrimitive.Item>
2772
- )
2773
- })
2774
-
2775
- ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
2776
-
2777
- export { ToggleGroup, ToggleGroupItem }
2778
-
2779
- `;
2780
- export const toggle = `import * as React from "react"
2781
- import * as TogglePrimitive from "@radix-ui/react-toggle"
2782
- import { cva, type VariantProps } from "class-variance-authority"
2783
-
2784
- import { cn } from "../../lib/utils"
2785
-
2786
- const toggleVariants = cva(
2787
- "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-white transition-colors hover:bg-gray-100 hover:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-gray-100 data-[state=on]:text-gray-900 dark:ring-offset-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-400 dark:focus-visible:ring-gray-300 dark:data-[state=on]:bg-gray-800 dark:data-[state=on]:text-gray-50",
2788
- {
2789
- variants: {
2790
- variant: {
2791
- default: "bg-transparent",
2792
- outline:
2793
- "border border-gray-200 bg-transparent hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-50",
2794
- },
2795
- size: {
2796
- default: "h-10 px-3",
2797
- sm: "h-9 px-2.5",
2798
- lg: "h-11 px-5",
2799
- },
2800
- },
2801
- defaultVariants: {
2802
- variant: "default",
2803
- size: "default",
2804
- },
2805
- }
2806
- )
2807
-
2808
- const Toggle = React.forwardRef<
2809
- React.ElementRef<typeof TogglePrimitive.Root>,
2810
- React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
2811
- VariantProps<typeof toggleVariants>
2812
- >(({ className, variant, size, ...props }, ref) => (
2813
- <TogglePrimitive.Root
2814
- ref={ref}
2815
- className={cn(toggleVariants({ variant, size, className }))}
2816
- {...props}
2817
- />
2818
- ))
2819
-
2820
- Toggle.displayName = TogglePrimitive.Root.displayName
2821
-
2822
- export { Toggle, toggleVariants }
2823
-
2824
- `;
2825
- export const tooltip = `import * as React from "react"
2826
- import * as TooltipPrimitive from "@radix-ui/react-tooltip"
2827
-
2828
- import { cn } from "../../lib/utils"
2829
-
2830
- const TooltipProvider = TooltipPrimitive.Provider
2831
-
2832
- const Tooltip = TooltipPrimitive.Root
2833
-
2834
- const TooltipTrigger = TooltipPrimitive.Trigger
2835
-
2836
- const TooltipContent = React.forwardRef<
2837
- React.ElementRef<typeof TooltipPrimitive.Content>,
2838
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
2839
- >(({ className, sideOffset = 4, ...props }, ref) => (
2840
- <TooltipPrimitive.Content
2841
- ref={ref}
2842
- sideOffset={sideOffset}
2843
- className={cn(
2844
- "z-50 overflow-hidden rounded-md border border-gray-200 bg-white px-3 py-1.5 text-sm text-gray-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
2845
- className
2846
- )}
2847
- {...props}
2848
- />
2849
- ))
2850
- TooltipContent.displayName = TooltipPrimitive.Content.displayName
2851
-
2852
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
2853
-
2854
- `;
2855
- export const useToast = `import * as React from "react"
2856
-
2857
- import type {
2858
- ToastActionElement,
2859
- ToastProps,
2860
- } from "./toast"
2861
-
2862
- const TOAST_LIMIT = 1
2863
- const TOAST_REMOVE_DELAY = 1000000
2864
-
2865
- type ToasterToast = ToastProps & {
2866
- id: string
2867
- title?: React.ReactNode
2868
- description?: React.ReactNode
2869
- action?: ToastActionElement
2870
- }
2871
-
2872
- const actionTypes = {
2873
- ADD_TOAST: "ADD_TOAST",
2874
- UPDATE_TOAST: "UPDATE_TOAST",
2875
- DISMISS_TOAST: "DISMISS_TOAST",
2876
- REMOVE_TOAST: "REMOVE_TOAST",
2877
- } as const
2878
-
2879
- let count = 0
2880
-
2881
- function genId() {
2882
- count = (count + 1) % Number.MAX_SAFE_INTEGER
2883
- return count.toString()
2884
- }
2885
-
2886
- type ActionType = typeof actionTypes
2887
-
2888
- type Action =
2889
- | {
2890
- type: ActionType["ADD_TOAST"]
2891
- toast: ToasterToast
2892
- }
2893
- | {
2894
- type: ActionType["UPDATE_TOAST"]
2895
- toast: Partial<ToasterToast>
2896
- }
2897
- | {
2898
- type: ActionType["DISMISS_TOAST"]
2899
- toastId?: ToasterToast["id"]
2900
- }
2901
- | {
2902
- type: ActionType["REMOVE_TOAST"]
2903
- toastId?: ToasterToast["id"]
2904
- }
2905
-
2906
- interface State {
2907
- toasts: ToasterToast[]
2908
- }
2909
-
2910
- const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
2911
-
2912
- const addToRemoveQueue = (toastId: string) => {
2913
- if (toastTimeouts.has(toastId)) {
2914
- return
2915
- }
2916
-
2917
- const timeout = setTimeout(() => {
2918
- toastTimeouts.delete(toastId)
2919
- dispatch({
2920
- type: "REMOVE_TOAST",
2921
- toastId: toastId,
2922
- })
2923
- }, TOAST_REMOVE_DELAY)
2924
-
2925
- toastTimeouts.set(toastId, timeout)
2926
- }
2927
-
2928
- export const reducer = (state: State, action: Action): State => {
2929
- switch (action.type) {
2930
- case "ADD_TOAST":
2931
- return {
2932
- ...state,
2933
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
2934
- }
2935
-
2936
- case "UPDATE_TOAST":
2937
- return {
2938
- ...state,
2939
- toasts: state.toasts.map((t) =>
2940
- t.id === action.toast.id ? { ...t, ...action.toast } : t
2941
- ),
2942
- }
2943
-
2944
- case "DISMISS_TOAST": {
2945
- const { toastId } = action
2946
-
2947
- // ! Side effects ! - This could be extracted into a dismissToast() action,
2948
- // but I'll keep it here for simplicity
2949
- if (toastId) {
2950
- addToRemoveQueue(toastId)
2951
- } else {
2952
- state.toasts.forEach((toast) => {
2953
- addToRemoveQueue(toast.id)
2954
- })
2955
- }
2956
-
2957
- return {
2958
- ...state,
2959
- toasts: state.toasts.map((t) =>
2960
- t.id === toastId || toastId === undefined
2961
- ? {
2962
- ...t,
2963
- open: false,
2964
- }
2965
- : t
2966
- ),
2967
- }
2968
- }
2969
- case "REMOVE_TOAST":
2970
- if (action.toastId === undefined) {
2971
- return {
2972
- ...state,
2973
- toasts: [],
2974
- }
2975
- }
2976
- return {
2977
- ...state,
2978
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
2979
- }
2980
- }
2981
- }
2982
-
2983
- const listeners: Array<(state: State) => void> = []
2984
-
2985
- let memoryState: State = { toasts: [] }
2986
-
2987
- function dispatch(action: Action) {
2988
- memoryState = reducer(memoryState, action)
2989
- listeners.forEach((listener) => {
2990
- listener(memoryState)
2991
- })
2992
- }
2993
-
2994
- type Toast = Omit<ToasterToast, "id">
2995
-
2996
- function toast({ ...props }: Toast) {
2997
- const id = genId()
2998
-
2999
- const update = (props: ToasterToast) =>
3000
- dispatch({
3001
- type: "UPDATE_TOAST",
3002
- toast: { ...props, id },
3003
- })
3004
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
3005
-
3006
- dispatch({
3007
- type: "ADD_TOAST",
3008
- toast: {
3009
- ...props,
3010
- id,
3011
- open: true,
3012
- onOpenChange: (open) => {
3013
- if (!open) dismiss()
3014
- },
3015
- },
3016
- })
3017
-
3018
- return {
3019
- id: id,
3020
- dismiss,
3021
- update,
3022
- }
3023
- }
3024
-
3025
- function useToast() {
3026
- const [state, setState] = React.useState<State>(memoryState)
3027
-
3028
- React.useEffect(() => {
3029
- listeners.push(setState)
3030
- return () => {
3031
- const index = listeners.indexOf(setState)
3032
- if (index > -1) {
3033
- listeners.splice(index, 1)
3034
- }
3035
- }
3036
- }, [state])
3037
-
3038
- return {
3039
- ...state,
3040
- toast,
3041
- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
3042
- }
3043
- }
3044
-
3045
- export { useToast, toast }
3046
- `;
3047
-
3048
- export const shadcnComponents = {
3049
- utils: utils,
3050
- accordian: accordian,
3051
- alertDialog: alertDialog,
3052
- alert: alert,
3053
- avatar: avatar,
3054
- badge: badge,
3055
- breadcrumb: breadcrumb,
3056
- button: button,
3057
- calendar: calendar,
3058
- card: card,
3059
- carousel: carousel,
3060
- checkbox: checkbox,
3061
- collapsible: collapsible,
3062
- dialog: dialog,
3063
- drawer: drawer,
3064
- dropdownMenu: dropdownMenu,
3065
- hoverCard: hoverCard,
3066
- input: input,
3067
- label: label,
3068
- menuBar: menuBar,
3069
- navigationMenu: navigationMenu,
3070
- pagination: pagination,
3071
- popover: popover,
3072
- progress: progress,
3073
- radioGroup: radioGroup,
3074
- select: select,
3075
- separator: separator,
3076
- skeleton: skeleton,
3077
- slider: slider,
3078
- switchComponent: switchComponent,
3079
- table: table,
3080
- tabs: tabs,
3081
- textarea: textarea,
3082
- toast: toast,
3083
- toaster: toaster,
3084
- toggleGroup: toggleGroup,
3085
- toggle: toggle,
3086
- tooltip: tooltip,
3087
- useToast: useToast,
3088
- };
3089
-
3090
- export const essentialShadcnComponents = {
3091
- utils: utils,
3092
- avatar: avatar,
3093
- button: button,
3094
- card: card,
3095
- checkbox: checkbox,
3096
- input: input,
3097
- label: label,
3098
- radioGroup: radioGroup,
3099
- select: select,
3100
- textarea: textarea,
3101
- // badge: badge,
3102
- // dialog: dialog,
3103
- // table: table,
3104
- };