create-next-imagicma 0.0.4 → 0.0.6

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 (106) hide show
  1. package/README.md +30 -13
  2. package/bin/create-next-imagicma.mjs +138 -22
  3. package/package.json +2 -1
  4. package/template/app/globals.css +331 -0
  5. package/template/app/layout.tsx +4 -6
  6. package/template/app/page.tsx +18 -40
  7. package/template/package.json +1 -1
  8. package/template/public/imagicma-picker-bridge.js +374 -0
  9. package/template-hono/.env.example +8 -0
  10. package/template-hono/.imagicma/AGENTS.md +7 -0
  11. package/template-hono/.imagicma/port.json +5 -0
  12. package/template-hono/AGENTS.md +39 -0
  13. package/template-hono/README.md +48 -0
  14. package/template-hono/client/src/App.tsx +13 -0
  15. package/template-hono/client/src/components/ErrorBoundary.tsx +74 -0
  16. package/template-hono/client/src/components/HelloClient.tsx +69 -0
  17. package/template-hono/client/src/globals.css +767 -0
  18. package/template-hono/client/src/main.tsx +24 -0
  19. package/template-hono/client/src/pages/HelloPage.tsx +22 -0
  20. package/template-hono/client/src/pages/HomePage.tsx +30 -0
  21. package/template-hono/client/src/providers.tsx +21 -0
  22. package/template-hono/components/ui/accordion.tsx +58 -0
  23. package/template-hono/components/ui/alert-dialog.tsx +141 -0
  24. package/template-hono/components/ui/alert.tsx +61 -0
  25. package/template-hono/components/ui/aspect-ratio.tsx +7 -0
  26. package/template-hono/components/ui/avatar.tsx +51 -0
  27. package/template-hono/components/ui/badge.tsx +40 -0
  28. package/template-hono/components/ui/breadcrumb.tsx +117 -0
  29. package/template-hono/components/ui/button.tsx +64 -0
  30. package/template-hono/components/ui/calendar.tsx +72 -0
  31. package/template-hono/components/ui/card.tsx +87 -0
  32. package/template-hono/components/ui/carousel.tsx +262 -0
  33. package/template-hono/components/ui/chart.tsx +365 -0
  34. package/template-hono/components/ui/checkbox.tsx +30 -0
  35. package/template-hono/components/ui/collapsible.tsx +11 -0
  36. package/template-hono/components/ui/command.tsx +153 -0
  37. package/template-hono/components/ui/context-menu.tsx +200 -0
  38. package/template-hono/components/ui/dialog.tsx +122 -0
  39. package/template-hono/components/ui/drawer.tsx +118 -0
  40. package/template-hono/components/ui/dropdown-menu.tsx +200 -0
  41. package/template-hono/components/ui/form.tsx +178 -0
  42. package/template-hono/components/ui/hover-card.tsx +29 -0
  43. package/template-hono/components/ui/input-otp.tsx +71 -0
  44. package/template-hono/components/ui/input.tsx +25 -0
  45. package/template-hono/components/ui/label.tsx +26 -0
  46. package/template-hono/components/ui/menubar.tsx +256 -0
  47. package/template-hono/components/ui/navigation-menu.tsx +130 -0
  48. package/template-hono/components/ui/pagination.tsx +119 -0
  49. package/template-hono/components/ui/popover.tsx +31 -0
  50. package/template-hono/components/ui/progress.tsx +28 -0
  51. package/template-hono/components/ui/radio-group.tsx +44 -0
  52. package/template-hono/components/ui/resizable.tsx +45 -0
  53. package/template-hono/components/ui/scroll-area.tsx +48 -0
  54. package/template-hono/components/ui/select.tsx +160 -0
  55. package/template-hono/components/ui/separator.tsx +31 -0
  56. package/template-hono/components/ui/sheet.tsx +140 -0
  57. package/template-hono/components/ui/sidebar.tsx +732 -0
  58. package/template-hono/components/ui/skeleton.tsx +17 -0
  59. package/template-hono/components/ui/slider.tsx +28 -0
  60. package/template-hono/components/ui/switch.tsx +29 -0
  61. package/template-hono/components/ui/table.tsx +119 -0
  62. package/template-hono/components/ui/tabs.tsx +55 -0
  63. package/template-hono/components/ui/textarea.tsx +24 -0
  64. package/template-hono/components/ui/toast.tsx +129 -0
  65. package/template-hono/components/ui/toaster.tsx +35 -0
  66. package/template-hono/components/ui/toggle-group.tsx +61 -0
  67. package/template-hono/components/ui/toggle.tsx +45 -0
  68. package/template-hono/components/ui/tooltip.tsx +30 -0
  69. package/template-hono/drizzle.config.ts +50 -0
  70. package/template-hono/eslint.config.mjs +13 -0
  71. package/template-hono/gitignore +40 -0
  72. package/template-hono/hooks/use-greeting.ts +15 -0
  73. package/template-hono/hooks/use-mobile.ts +21 -0
  74. package/template-hono/hooks/use-toast.ts +194 -0
  75. package/template-hono/index.html +13 -0
  76. package/template-hono/lib/queryClient.ts +59 -0
  77. package/template-hono/lib/theme/default-theme.ts +11 -0
  78. package/template-hono/lib/utils.ts +6 -0
  79. package/template-hono/package.json +82 -0
  80. package/template-hono/pnpm-lock.yaml +5162 -0
  81. package/template-hono/postcss.config.mjs +7 -0
  82. package/template-hono/process-compose.yaml +13 -0
  83. package/template-hono/public/favicon.ico +0 -0
  84. package/template-hono/public/file.svg +1 -0
  85. package/template-hono/public/globe.svg +1 -0
  86. package/template-hono/public/imagicma-picker-bridge.js +374 -0
  87. package/template-hono/public/next.svg +1 -0
  88. package/template-hono/public/vercel.svg +1 -0
  89. package/template-hono/public/window.svg +1 -0
  90. package/template-hono/scripts/imagicma-common.mjs +118 -0
  91. package/template-hono/scripts/imagicma-dev.mjs +29 -0
  92. package/template-hono/scripts/imagicma-guard.mjs +17 -0
  93. package/template-hono/scripts/imagicma-start.mjs +24 -0
  94. package/template-hono/server/app.ts +40 -0
  95. package/template-hono/server/db.ts +22 -0
  96. package/template-hono/server/dev-app.ts +5 -0
  97. package/template-hono/server/index.ts +94 -0
  98. package/template-hono/server/routes/greeting.ts +25 -0
  99. package/template-hono/server/storage.ts +39 -0
  100. package/template-hono/shared/routes.ts +13 -0
  101. package/template-hono/shared/schema.ts +17 -0
  102. package/template-hono/tailwind.config.mjs +97 -0
  103. package/template-hono/tsconfig.json +39 -0
  104. package/template-hono/tsconfig.server.json +15 -0
  105. package/template-hono/types/pg.d.ts +19 -0
  106. package/template-hono/vite.config.ts +125 -0
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { BrowserRouter } from "react-router-dom";
4
+ import { DEFAULT_THEME_STYLE } from "@/lib/theme/default-theme";
5
+ import { App } from "./App";
6
+ import { AppErrorBoundary } from "./components/ErrorBoundary";
7
+ import "./globals.css";
8
+ import { Providers } from "./providers";
9
+
10
+ if (!document.documentElement.dataset.themeStyle) {
11
+ document.documentElement.dataset.themeStyle = DEFAULT_THEME_STYLE;
12
+ }
13
+
14
+ createRoot(document.getElementById("root")!).render(
15
+ <React.StrictMode>
16
+ <AppErrorBoundary>
17
+ <BrowserRouter>
18
+ <Providers>
19
+ <App />
20
+ </Providers>
21
+ </BrowserRouter>
22
+ </AppErrorBoundary>
23
+ </React.StrictMode>,
24
+ );
@@ -0,0 +1,22 @@
1
+ import { HelloClient } from "../components/HelloClient";
2
+
3
+ export function HelloPage() {
4
+ return (
5
+ <div className="min-h-screen bg-background text-foreground">
6
+ <div className="mx-auto max-w-3xl px-6 py-12">
7
+ <div className="space-y-2">
8
+ <h1 className="text-3xl font-semibold tracking-tight">
9
+ Replit 模板精华迁移验证
10
+ </h1>
11
+ <p className="text-sm text-muted-foreground">
12
+ 该页面用于验证:shadcn/ui、React Query、Hono API、Drizzle/Postgres。
13
+ </p>
14
+ </div>
15
+
16
+ <div className="mt-8">
17
+ <HelloClient />
18
+ </div>
19
+ </div>
20
+ </div>
21
+ );
22
+ }
@@ -0,0 +1,30 @@
1
+ export function HomePage() {
2
+ return (
3
+ <div className="relative min-h-screen overflow-hidden bg-gradient-to-br from-indigo-600 via-purple-600 to-sky-600 text-white">
4
+ <div
5
+ aria-hidden
6
+ className="pointer-events-none absolute inset-0 overflow-hidden"
7
+ >
8
+ <div className="absolute inset-0 bg-[radial-gradient(60%_60%_at_50%_40%,rgba(255,255,255,0.20),transparent_60%)]" />
9
+ </div>
10
+
11
+ <div aria-hidden className="aurora-frame">
12
+ <span className="aurora-edge top" />
13
+ <span className="aurora-edge right" />
14
+ <span className="aurora-edge bottom" />
15
+ <span className="aurora-edge left" />
16
+ <span className="aurora-edge top is-glow" />
17
+ <span className="aurora-edge right is-glow" />
18
+ <span className="aurora-edge bottom is-glow" />
19
+ <span className="aurora-edge left is-glow" />
20
+ </div>
21
+
22
+ <main className="relative z-[1] flex min-h-screen items-center justify-center">
23
+ <div role="status" aria-live="polite">
24
+ <span className="sr-only">加载中</span>
25
+ <div className="h-10 w-10 rounded-full border-[3px] border-white/25 border-t-white/90 motion-reduce:animate-none animate-spin" />
26
+ </div>
27
+ </main>
28
+ </div>
29
+ );
30
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import { QueryClientProvider } from "@tanstack/react-query";
3
+ import { ThemeProvider } from "next-themes";
4
+ import { Toaster } from "@/components/ui/toaster";
5
+ import { TooltipProvider } from "@/components/ui/tooltip";
6
+ import { makeQueryClient } from "@/lib/queryClient";
7
+
8
+ export function Providers({ children }: { children: React.ReactNode }) {
9
+ const [queryClient] = React.useState(() => makeQueryClient());
10
+
11
+ return (
12
+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
13
+ <QueryClientProvider client={queryClient}>
14
+ <TooltipProvider>
15
+ <Toaster />
16
+ {children}
17
+ </TooltipProvider>
18
+ </QueryClientProvider>
19
+ </ThemeProvider>
20
+ );
21
+ }
@@ -0,0 +1,58 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import * as AccordionPrimitive from "@radix-ui/react-accordion"
5
+ import { ChevronDown } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Accordion = AccordionPrimitive.Root
10
+
11
+ const AccordionItem = React.forwardRef<
12
+ React.ElementRef<typeof AccordionPrimitive.Item>,
13
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
14
+ >(({ className, ...props }, ref) => (
15
+ <AccordionPrimitive.Item
16
+ ref={ref}
17
+ className={cn("border-b", className)}
18
+ {...props}
19
+ />
20
+ ))
21
+ AccordionItem.displayName = "AccordionItem"
22
+
23
+ const AccordionTrigger = React.forwardRef<
24
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
25
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
26
+ >(({ className, children, ...props }, ref) => (
27
+ <AccordionPrimitive.Header className="flex">
28
+ <AccordionPrimitive.Trigger
29
+ ref={ref}
30
+ className={cn(
31
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
32
+ className
33
+ )}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
38
+ </AccordionPrimitive.Trigger>
39
+ </AccordionPrimitive.Header>
40
+ ))
41
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
42
+
43
+ const AccordionContent = React.forwardRef<
44
+ React.ElementRef<typeof AccordionPrimitive.Content>,
45
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
46
+ >(({ className, children, ...props }, ref) => (
47
+ <AccordionPrimitive.Content
48
+ ref={ref}
49
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
50
+ {...props}
51
+ >
52
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
53
+ </AccordionPrimitive.Content>
54
+ ))
55
+
56
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName
57
+
58
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -0,0 +1,141 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { buttonVariants } from "@/components/ui/button"
8
+
9
+ const AlertDialog = AlertDialogPrimitive.Root
10
+
11
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger
12
+
13
+ const AlertDialogPortal = AlertDialogPrimitive.Portal
14
+
15
+ const AlertDialogOverlay = React.forwardRef<
16
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
18
+ >(({ className, ...props }, ref) => (
19
+ <AlertDialogPrimitive.Overlay
20
+ className={cn(
21
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
+ className
23
+ )}
24
+ {...props}
25
+ ref={ref}
26
+ />
27
+ ))
28
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
29
+
30
+ const AlertDialogContent = React.forwardRef<
31
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
32
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
33
+ >(({ className, ...props }, ref) => (
34
+ <AlertDialogPortal>
35
+ <AlertDialogOverlay />
36
+ <AlertDialogPrimitive.Content
37
+ ref={ref}
38
+ className={cn(
39
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ </AlertDialogPortal>
45
+ ))
46
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
47
+
48
+ const AlertDialogHeader = ({
49
+ className,
50
+ ...props
51
+ }: React.HTMLAttributes<HTMLDivElement>) => (
52
+ <div
53
+ className={cn(
54
+ "flex flex-col space-y-2 text-center sm:text-left",
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ )
60
+ AlertDialogHeader.displayName = "AlertDialogHeader"
61
+
62
+ const AlertDialogFooter = ({
63
+ className,
64
+ ...props
65
+ }: React.HTMLAttributes<HTMLDivElement>) => (
66
+ <div
67
+ className={cn(
68
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
69
+ className
70
+ )}
71
+ {...props}
72
+ />
73
+ )
74
+ AlertDialogFooter.displayName = "AlertDialogFooter"
75
+
76
+ const AlertDialogTitle = React.forwardRef<
77
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
78
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
79
+ >(({ className, ...props }, ref) => (
80
+ <AlertDialogPrimitive.Title
81
+ ref={ref}
82
+ className={cn("text-lg font-semibold", className)}
83
+ {...props}
84
+ />
85
+ ))
86
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
87
+
88
+ const AlertDialogDescription = React.forwardRef<
89
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
90
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
91
+ >(({ className, ...props }, ref) => (
92
+ <AlertDialogPrimitive.Description
93
+ ref={ref}
94
+ className={cn("text-sm text-muted-foreground", className)}
95
+ {...props}
96
+ />
97
+ ))
98
+ AlertDialogDescription.displayName =
99
+ AlertDialogPrimitive.Description.displayName
100
+
101
+ const AlertDialogAction = React.forwardRef<
102
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
103
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
104
+ >(({ className, ...props }, ref) => (
105
+ <AlertDialogPrimitive.Action
106
+ ref={ref}
107
+ className={cn(buttonVariants(), className)}
108
+ {...props}
109
+ />
110
+ ))
111
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
112
+
113
+ const AlertDialogCancel = React.forwardRef<
114
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
115
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
116
+ >(({ className, ...props }, ref) => (
117
+ <AlertDialogPrimitive.Cancel
118
+ ref={ref}
119
+ className={cn(
120
+ buttonVariants({ variant: "outline" }),
121
+ "mt-2 sm:mt-0",
122
+ className
123
+ )}
124
+ {...props}
125
+ />
126
+ ))
127
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
128
+
129
+ export {
130
+ AlertDialog,
131
+ AlertDialogPortal,
132
+ AlertDialogOverlay,
133
+ AlertDialogTrigger,
134
+ AlertDialogContent,
135
+ AlertDialogHeader,
136
+ AlertDialogFooter,
137
+ AlertDialogTitle,
138
+ AlertDialogDescription,
139
+ AlertDialogAction,
140
+ AlertDialogCancel,
141
+ }
@@ -0,0 +1,61 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const alertVariants = cva(
9
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-background text-foreground",
14
+ destructive:
15
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
16
+ },
17
+ },
18
+ defaultVariants: {
19
+ variant: "default",
20
+ },
21
+ }
22
+ )
23
+
24
+ const Alert = React.forwardRef<
25
+ HTMLDivElement,
26
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
27
+ >(({ className, variant, ...props }, ref) => (
28
+ <div
29
+ ref={ref}
30
+ role="alert"
31
+ className={cn(alertVariants({ variant }), className)}
32
+ {...props}
33
+ />
34
+ ))
35
+ Alert.displayName = "Alert"
36
+
37
+ const AlertTitle = React.forwardRef<
38
+ HTMLParagraphElement,
39
+ React.HTMLAttributes<HTMLHeadingElement>
40
+ >(({ className, ...props }, ref) => (
41
+ <h5
42
+ ref={ref}
43
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
44
+ {...props}
45
+ />
46
+ ))
47
+ AlertTitle.displayName = "AlertTitle"
48
+
49
+ const AlertDescription = React.forwardRef<
50
+ HTMLParagraphElement,
51
+ React.HTMLAttributes<HTMLParagraphElement>
52
+ >(({ className, ...props }, ref) => (
53
+ <div
54
+ ref={ref}
55
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
56
+ {...props}
57
+ />
58
+ ))
59
+ AlertDescription.displayName = "AlertDescription"
60
+
61
+ export { Alert, AlertTitle, AlertDescription }
@@ -0,0 +1,7 @@
1
+ "use client";
2
+
3
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
+
5
+ const AspectRatio = AspectRatioPrimitive.Root
6
+
7
+ export { AspectRatio }
@@ -0,0 +1,51 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AvatarPrimitive from "@radix-ui/react-avatar"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Avatar = React.forwardRef<
9
+ React.ElementRef<typeof AvatarPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <AvatarPrimitive.Root
13
+ ref={ref}
14
+ className={cn(`
15
+ after:content-[''] after:block after:absolute after:inset-0 after:rounded-full after:pointer-events-none after:border after:border-black/10 dark:after:border-white/10
16
+ relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ ))
22
+ Avatar.displayName = AvatarPrimitive.Root.displayName
23
+
24
+ const AvatarImage = React.forwardRef<
25
+ React.ElementRef<typeof AvatarPrimitive.Image>,
26
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
27
+ >(({ className, ...props }, ref) => (
28
+ <AvatarPrimitive.Image
29
+ ref={ref}
30
+ className={cn("aspect-square h-full w-full", className)}
31
+ {...props}
32
+ />
33
+ ))
34
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName
35
+
36
+ const AvatarFallback = React.forwardRef<
37
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
38
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
39
+ >(({ className, ...props }, ref) => (
40
+ <AvatarPrimitive.Fallback
41
+ ref={ref}
42
+ className={cn(
43
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ ))
49
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
50
+
51
+ export { Avatar, AvatarImage, AvatarFallback }
@@ -0,0 +1,40 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const badgeVariants = cva(
9
+ // Whitespace-nowrap: Badges should never wrap.
10
+ "whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2" +
11
+ " hover-elevate " ,
12
+ {
13
+ variants: {
14
+ variant: {
15
+ default:
16
+ "border-transparent bg-primary text-primary-foreground shadow-xs",
17
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
18
+ destructive:
19
+ "border-transparent bg-destructive text-destructive-foreground shadow-xs",
20
+
21
+ outline: " border [border-color:var(--badge-outline)] shadow-xs",
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ variant: "default",
26
+ },
27
+ },
28
+ )
29
+
30
+ export interface BadgeProps
31
+ extends React.HTMLAttributes<HTMLDivElement>,
32
+ VariantProps<typeof badgeVariants> {}
33
+
34
+ function Badge({ className, variant, ...props }: BadgeProps) {
35
+ return (
36
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
37
+ );
38
+ }
39
+
40
+ export { Badge, badgeVariants }
@@ -0,0 +1,117 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import { Slot } from "@radix-ui/react-slot"
5
+ import { ChevronRight, MoreHorizontal } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Breadcrumb = React.forwardRef<
10
+ HTMLElement,
11
+ React.ComponentPropsWithoutRef<"nav"> & {
12
+ separator?: React.ReactNode
13
+ }
14
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
15
+ Breadcrumb.displayName = "Breadcrumb"
16
+
17
+ const BreadcrumbList = React.forwardRef<
18
+ HTMLOListElement,
19
+ React.ComponentPropsWithoutRef<"ol">
20
+ >(({ className, ...props }, ref) => (
21
+ <ol
22
+ ref={ref}
23
+ className={cn(
24
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ ))
30
+ BreadcrumbList.displayName = "BreadcrumbList"
31
+
32
+ const BreadcrumbItem = React.forwardRef<
33
+ HTMLLIElement,
34
+ React.ComponentPropsWithoutRef<"li">
35
+ >(({ className, ...props }, ref) => (
36
+ <li
37
+ ref={ref}
38
+ className={cn("inline-flex items-center gap-1.5", className)}
39
+ {...props}
40
+ />
41
+ ))
42
+ BreadcrumbItem.displayName = "BreadcrumbItem"
43
+
44
+ const BreadcrumbLink = React.forwardRef<
45
+ HTMLAnchorElement,
46
+ React.ComponentPropsWithoutRef<"a"> & {
47
+ asChild?: boolean
48
+ }
49
+ >(({ asChild, className, ...props }, ref) => {
50
+ const Comp = asChild ? Slot : "a"
51
+
52
+ return (
53
+ <Comp
54
+ ref={ref}
55
+ className={cn("transition-colors hover:text-foreground", className)}
56
+ {...props}
57
+ />
58
+ )
59
+ })
60
+ BreadcrumbLink.displayName = "BreadcrumbLink"
61
+
62
+ const BreadcrumbPage = React.forwardRef<
63
+ HTMLSpanElement,
64
+ React.ComponentPropsWithoutRef<"span">
65
+ >(({ className, ...props }, ref) => (
66
+ <span
67
+ ref={ref}
68
+ role="link"
69
+ aria-disabled="true"
70
+ aria-current="page"
71
+ className={cn("font-normal text-foreground", className)}
72
+ {...props}
73
+ />
74
+ ))
75
+ BreadcrumbPage.displayName = "BreadcrumbPage"
76
+
77
+ const BreadcrumbSeparator = ({
78
+ children,
79
+ className,
80
+ ...props
81
+ }: React.ComponentProps<"li">) => (
82
+ <li
83
+ role="presentation"
84
+ aria-hidden="true"
85
+ className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
86
+ {...props}
87
+ >
88
+ {children ?? <ChevronRight />}
89
+ </li>
90
+ )
91
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
92
+
93
+ const BreadcrumbEllipsis = ({
94
+ className,
95
+ ...props
96
+ }: React.ComponentProps<"span">) => (
97
+ <span
98
+ role="presentation"
99
+ aria-hidden="true"
100
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
101
+ {...props}
102
+ >
103
+ <MoreHorizontal className="h-4 w-4" />
104
+ <span className="sr-only">More</span>
105
+ </span>
106
+ )
107
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
108
+
109
+ export {
110
+ Breadcrumb,
111
+ BreadcrumbList,
112
+ BreadcrumbItem,
113
+ BreadcrumbLink,
114
+ BreadcrumbPage,
115
+ BreadcrumbSeparator,
116
+ BreadcrumbEllipsis,
117
+ }
@@ -0,0 +1,64 @@
1
+ "use client";
2
+
3
+ import * as React from "react"
4
+ import { Slot } from "@radix-ui/react-slot"
5
+ import { cva, type VariantProps } from "class-variance-authority"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const buttonVariants = cva(
10
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0" +
11
+ " hover-elevate active-elevate-2",
12
+ {
13
+ variants: {
14
+ variant: {
15
+ default:
16
+ "bg-primary text-primary-foreground border border-primary-border",
17
+ destructive:
18
+ "bg-destructive text-destructive-foreground border border-destructive-border",
19
+ outline:
20
+ // Shows the background color of whatever card / sidebar / accent background it is inside of.
21
+ // Inherits the current text color.
22
+ " border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",
23
+ secondary: "border bg-secondary text-secondary-foreground border border-secondary-border ",
24
+ // Add a transparent border so that when someone toggles a border on later, it doesn't shift layout/size.
25
+ ghost: "border border-transparent",
26
+ },
27
+ // Heights are set as "min" heights, because sometimes Ai will place large amount of content
28
+ // inside buttons. With a min-height they will look appropriate with small amounts of content,
29
+ // but will expand to fit large amounts of content.
30
+ size: {
31
+ default: "min-h-9 px-4 py-2",
32
+ sm: "min-h-8 rounded-md px-3 text-xs",
33
+ lg: "min-h-10 rounded-md px-8",
34
+ icon: "h-9 w-9",
35
+ },
36
+ },
37
+ defaultVariants: {
38
+ variant: "default",
39
+ size: "default",
40
+ },
41
+ },
42
+ )
43
+
44
+ export interface ButtonProps
45
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
46
+ VariantProps<typeof buttonVariants> {
47
+ asChild?: boolean
48
+ }
49
+
50
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
51
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
52
+ const Comp = asChild ? Slot : "button"
53
+ return (
54
+ <Comp
55
+ className={cn(buttonVariants({ variant, size, className }))}
56
+ ref={ref}
57
+ {...props}
58
+ />
59
+ )
60
+ },
61
+ )
62
+ Button.displayName = "Button"
63
+
64
+ export { Button, buttonVariants }