@lark-apaas/coding-templates 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +128 -0
- package/meta.json +22 -0
- package/package.json +22 -0
- package/template-html/README.md +148 -0
- package/template-html/_gitignore +2 -0
- package/template-html/index.html +22 -0
- package/template-html/package.json +12 -0
- package/template-html/routes.json +1 -0
- package/template-html/scripts/build.sh +31 -0
- package/template-nextjs-fullstack/README.md +169 -0
- package/template-nextjs-fullstack/_env.local.example +1 -0
- package/template-nextjs-fullstack/_gitignore +41 -0
- package/template-nextjs-fullstack/components.json +25 -0
- package/template-nextjs-fullstack/drizzle.config.ts +10 -0
- package/template-nextjs-fullstack/eslint.config.js +15 -0
- package/template-nextjs-fullstack/next.config.ts +5 -0
- package/template-nextjs-fullstack/package.json +85 -0
- package/template-nextjs-fullstack/postcss.config.js +8 -0
- package/template-nextjs-fullstack/scripts/build.sh +37 -0
- package/template-nextjs-fullstack/src/app/favicon.ico +0 -0
- package/template-nextjs-fullstack/src/app/globals.css +130 -0
- package/template-nextjs-fullstack/src/app/layout.tsx +24 -0
- package/template-nextjs-fullstack/src/app/page.tsx +69 -0
- package/template-nextjs-fullstack/src/app/todos/actions.ts +37 -0
- package/template-nextjs-fullstack/src/app/todos/page.tsx +26 -0
- package/template-nextjs-fullstack/src/app/todos/todo-form.tsx +27 -0
- package/template-nextjs-fullstack/src/app/todos/todo-list.tsx +44 -0
- package/template-nextjs-fullstack/src/components/header.tsx +32 -0
- package/template-nextjs-fullstack/src/components/theme-provider.tsx +8 -0
- package/template-nextjs-fullstack/src/components/ui/README.md +134 -0
- package/template-nextjs-fullstack/src/components/ui/accordion.tsx +66 -0
- package/template-nextjs-fullstack/src/components/ui/alert-dialog.tsx +157 -0
- package/template-nextjs-fullstack/src/components/ui/alert.tsx +71 -0
- package/template-nextjs-fullstack/src/components/ui/aspect-ratio.tsx +11 -0
- package/template-nextjs-fullstack/src/components/ui/avatar.tsx +53 -0
- package/template-nextjs-fullstack/src/components/ui/badge.tsx +42 -0
- package/template-nextjs-fullstack/src/components/ui/breadcrumb.tsx +109 -0
- package/template-nextjs-fullstack/src/components/ui/button-group.tsx +83 -0
- package/template-nextjs-fullstack/src/components/ui/button.tsx +69 -0
- package/template-nextjs-fullstack/src/components/ui/calendar.tsx +213 -0
- package/template-nextjs-fullstack/src/components/ui/card.tsx +82 -0
- package/template-nextjs-fullstack/src/components/ui/carousel.tsx +241 -0
- package/template-nextjs-fullstack/src/components/ui/chart.tsx +357 -0
- package/template-nextjs-fullstack/src/components/ui/checkbox.tsx +32 -0
- package/template-nextjs-fullstack/src/components/ui/collapsible.tsx +33 -0
- package/template-nextjs-fullstack/src/components/ui/command.tsx +208 -0
- package/template-nextjs-fullstack/src/components/ui/context-menu.tsx +324 -0
- package/template-nextjs-fullstack/src/components/ui/dialog.tsx +143 -0
- package/template-nextjs-fullstack/src/components/ui/drawer.tsx +135 -0
- package/template-nextjs-fullstack/src/components/ui/dropdown-menu.tsx +329 -0
- package/template-nextjs-fullstack/src/components/ui/empty.tsx +104 -0
- package/template-nextjs-fullstack/src/components/ui/field.tsx +248 -0
- package/template-nextjs-fullstack/src/components/ui/form.tsx +167 -0
- package/template-nextjs-fullstack/src/components/ui/hover-card.tsx +44 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
- package/template-nextjs-fullstack/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/image.tsx +183 -0
- package/template-nextjs-fullstack/src/components/ui/input-group.tsx +166 -0
- package/template-nextjs-fullstack/src/components/ui/input-otp.tsx +77 -0
- package/template-nextjs-fullstack/src/components/ui/input.tsx +21 -0
- package/template-nextjs-fullstack/src/components/ui/item.tsx +193 -0
- package/template-nextjs-fullstack/src/components/ui/kbd.tsx +28 -0
- package/template-nextjs-fullstack/src/components/ui/label.tsx +24 -0
- package/template-nextjs-fullstack/src/components/ui/menubar.tsx +348 -0
- package/template-nextjs-fullstack/src/components/ui/native-select.tsx +48 -0
- package/template-nextjs-fullstack/src/components/ui/navigation-menu.tsx +168 -0
- package/template-nextjs-fullstack/src/components/ui/pagination.tsx +127 -0
- package/template-nextjs-fullstack/src/components/ui/popover.tsx +48 -0
- package/template-nextjs-fullstack/src/components/ui/progress.tsx +31 -0
- package/template-nextjs-fullstack/src/components/ui/radio-group.tsx +45 -0
- package/template-nextjs-fullstack/src/components/ui/resizable.tsx +56 -0
- package/template-nextjs-fullstack/src/components/ui/scroll-area.tsx +58 -0
- package/template-nextjs-fullstack/src/components/ui/select.tsx +243 -0
- package/template-nextjs-fullstack/src/components/ui/separator.tsx +28 -0
- package/template-nextjs-fullstack/src/components/ui/sheet.tsx +139 -0
- package/template-nextjs-fullstack/src/components/ui/sidebar.tsx +727 -0
- package/template-nextjs-fullstack/src/components/ui/skeleton.tsx +13 -0
- package/template-nextjs-fullstack/src/components/ui/slider.tsx +87 -0
- package/template-nextjs-fullstack/src/components/ui/sonner.tsx +67 -0
- package/template-nextjs-fullstack/src/components/ui/spinner.tsx +16 -0
- package/template-nextjs-fullstack/src/components/ui/streamdown.tsx +186 -0
- package/template-nextjs-fullstack/src/components/ui/switch.tsx +31 -0
- package/template-nextjs-fullstack/src/components/ui/table.tsx +116 -0
- package/template-nextjs-fullstack/src/components/ui/tabs.tsx +66 -0
- package/template-nextjs-fullstack/src/components/ui/textarea.tsx +18 -0
- package/template-nextjs-fullstack/src/components/ui/toggle-group.tsx +83 -0
- package/template-nextjs-fullstack/src/components/ui/toggle.tsx +47 -0
- package/template-nextjs-fullstack/src/components/ui/tooltip.tsx +61 -0
- package/template-nextjs-fullstack/src/db/index.ts +8 -0
- package/template-nextjs-fullstack/src/db/schema.ts +11 -0
- package/template-nextjs-fullstack/src/hooks/use-mobile.ts +19 -0
- package/template-nextjs-fullstack/src/lib/utils.ts +6 -0
- package/template-nextjs-fullstack/tailwind.config.ts +10 -0
- package/template-nextjs-fullstack/tsconfig.json +34 -0
- package/template-nextjs-static/README.md +80 -0
- package/template-nextjs-static/_gitignore +41 -0
- package/template-nextjs-static/components.json +25 -0
- package/template-nextjs-static/eslint.config.js +15 -0
- package/template-nextjs-static/next.config.ts +8 -0
- package/template-nextjs-static/package.json +77 -0
- package/template-nextjs-static/postcss.config.js +8 -0
- package/template-nextjs-static/public/favicon.ico +0 -0
- package/template-nextjs-static/scripts/build.sh +36 -0
- package/template-nextjs-static/src/components/header.tsx +30 -0
- package/template-nextjs-static/src/components/theme-provider.tsx +6 -0
- package/template-nextjs-static/src/components/ui/README.md +134 -0
- package/template-nextjs-static/src/components/ui/accordion.tsx +66 -0
- package/template-nextjs-static/src/components/ui/alert-dialog.tsx +157 -0
- package/template-nextjs-static/src/components/ui/alert.tsx +71 -0
- package/template-nextjs-static/src/components/ui/aspect-ratio.tsx +11 -0
- package/template-nextjs-static/src/components/ui/avatar.tsx +53 -0
- package/template-nextjs-static/src/components/ui/badge.tsx +42 -0
- package/template-nextjs-static/src/components/ui/breadcrumb.tsx +109 -0
- package/template-nextjs-static/src/components/ui/button-group.tsx +83 -0
- package/template-nextjs-static/src/components/ui/button.tsx +69 -0
- package/template-nextjs-static/src/components/ui/calendar.tsx +213 -0
- package/template-nextjs-static/src/components/ui/card.tsx +82 -0
- package/template-nextjs-static/src/components/ui/carousel.tsx +241 -0
- package/template-nextjs-static/src/components/ui/chart.tsx +357 -0
- package/template-nextjs-static/src/components/ui/checkbox.tsx +32 -0
- package/template-nextjs-static/src/components/ui/collapsible.tsx +33 -0
- package/template-nextjs-static/src/components/ui/command.tsx +208 -0
- package/template-nextjs-static/src/components/ui/context-menu.tsx +324 -0
- package/template-nextjs-static/src/components/ui/dialog.tsx +143 -0
- package/template-nextjs-static/src/components/ui/drawer.tsx +135 -0
- package/template-nextjs-static/src/components/ui/dropdown-menu.tsx +329 -0
- package/template-nextjs-static/src/components/ui/empty.tsx +104 -0
- package/template-nextjs-static/src/components/ui/field.tsx +248 -0
- package/template-nextjs-static/src/components/ui/form.tsx +167 -0
- package/template-nextjs-static/src/components/ui/hover-card.tsx +44 -0
- package/template-nextjs-static/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
- package/template-nextjs-static/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
- package/template-nextjs-static/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
- package/template-nextjs-static/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
- package/template-nextjs-static/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
- package/template-nextjs-static/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
- package/template-nextjs-static/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
- package/template-nextjs-static/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
- package/template-nextjs-static/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
- package/template-nextjs-static/src/components/ui/image.tsx +183 -0
- package/template-nextjs-static/src/components/ui/input-group.tsx +166 -0
- package/template-nextjs-static/src/components/ui/input-otp.tsx +77 -0
- package/template-nextjs-static/src/components/ui/input.tsx +21 -0
- package/template-nextjs-static/src/components/ui/item.tsx +193 -0
- package/template-nextjs-static/src/components/ui/kbd.tsx +28 -0
- package/template-nextjs-static/src/components/ui/label.tsx +24 -0
- package/template-nextjs-static/src/components/ui/menubar.tsx +348 -0
- package/template-nextjs-static/src/components/ui/native-select.tsx +48 -0
- package/template-nextjs-static/src/components/ui/navigation-menu.tsx +168 -0
- package/template-nextjs-static/src/components/ui/pagination.tsx +127 -0
- package/template-nextjs-static/src/components/ui/popover.tsx +48 -0
- package/template-nextjs-static/src/components/ui/progress.tsx +31 -0
- package/template-nextjs-static/src/components/ui/radio-group.tsx +45 -0
- package/template-nextjs-static/src/components/ui/resizable.tsx +56 -0
- package/template-nextjs-static/src/components/ui/scroll-area.tsx +58 -0
- package/template-nextjs-static/src/components/ui/select.tsx +243 -0
- package/template-nextjs-static/src/components/ui/separator.tsx +28 -0
- package/template-nextjs-static/src/components/ui/sheet.tsx +139 -0
- package/template-nextjs-static/src/components/ui/sidebar.tsx +727 -0
- package/template-nextjs-static/src/components/ui/skeleton.tsx +13 -0
- package/template-nextjs-static/src/components/ui/slider.tsx +87 -0
- package/template-nextjs-static/src/components/ui/sonner.tsx +67 -0
- package/template-nextjs-static/src/components/ui/spinner.tsx +16 -0
- package/template-nextjs-static/src/components/ui/streamdown.tsx +186 -0
- package/template-nextjs-static/src/components/ui/switch.tsx +31 -0
- package/template-nextjs-static/src/components/ui/table.tsx +116 -0
- package/template-nextjs-static/src/components/ui/tabs.tsx +66 -0
- package/template-nextjs-static/src/components/ui/textarea.tsx +18 -0
- package/template-nextjs-static/src/components/ui/toggle-group.tsx +83 -0
- package/template-nextjs-static/src/components/ui/toggle.tsx +47 -0
- package/template-nextjs-static/src/components/ui/tooltip.tsx +61 -0
- package/template-nextjs-static/src/hooks/use-mobile.ts +19 -0
- package/template-nextjs-static/src/lib/utils.ts +6 -0
- package/template-nextjs-static/src/pages/_app.tsx +11 -0
- package/template-nextjs-static/src/pages/_document.tsx +13 -0
- package/template-nextjs-static/src/pages/hello.tsx +32 -0
- package/template-nextjs-static/src/pages/index.tsx +76 -0
- package/template-nextjs-static/src/styles/globals.css +143 -0
- package/template-nextjs-static/tailwind.config.ts +10 -0
- package/template-nextjs-static/tsconfig.json +34 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
5
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Accordion({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
12
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
19
|
+
return (
|
|
20
|
+
<AccordionPrimitive.Item
|
|
21
|
+
data-slot="accordion-item"
|
|
22
|
+
className={cn("border-b last:border-b-0", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function AccordionTrigger({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
33
|
+
return (
|
|
34
|
+
<AccordionPrimitive.Header className="flex">
|
|
35
|
+
<AccordionPrimitive.Trigger
|
|
36
|
+
data-slot="accordion-trigger"
|
|
37
|
+
className={cn(
|
|
38
|
+
"focus-visible:border-ring focus-visible:ring-ring/20 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none enabled:hover:underline focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
45
|
+
</AccordionPrimitive.Trigger>
|
|
46
|
+
</AccordionPrimitive.Header>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function AccordionContent({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<AccordionPrimitive.Content
|
|
57
|
+
data-slot="accordion-content"
|
|
58
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
62
|
+
</AccordionPrimitive.Content>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
function AlertDialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
12
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AlertDialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
18
|
+
return (
|
|
19
|
+
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function AlertDialogPortal({
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
+
return (
|
|
27
|
+
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function AlertDialogOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<AlertDialogPrimitive.Overlay
|
|
37
|
+
data-slot="alert-dialog-overlay"
|
|
38
|
+
className={cn(
|
|
39
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function AlertDialogContent({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
51
|
+
return (
|
|
52
|
+
<AlertDialogPortal>
|
|
53
|
+
<AlertDialogOverlay />
|
|
54
|
+
<AlertDialogPrimitive.Content
|
|
55
|
+
data-slot="alert-dialog-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-sm:max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 max-w-lg",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
</AlertDialogPortal>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function AlertDialogHeader({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<"div">) {
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
data-slot="alert-dialog-header"
|
|
73
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function AlertDialogFooter({
|
|
80
|
+
className,
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<"div">) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="alert-dialog-footer"
|
|
86
|
+
className={cn(
|
|
87
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function AlertDialogTitle({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
+
return (
|
|
100
|
+
<AlertDialogPrimitive.Title
|
|
101
|
+
data-slot="alert-dialog-title"
|
|
102
|
+
className={cn("text-lg font-semibold", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function AlertDialogDescription({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
112
|
+
return (
|
|
113
|
+
<AlertDialogPrimitive.Description
|
|
114
|
+
data-slot="alert-dialog-description"
|
|
115
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function AlertDialogAction({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
+
return (
|
|
126
|
+
<AlertDialogPrimitive.Action
|
|
127
|
+
className={cn(buttonVariants(), className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function AlertDialogCancel({
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
137
|
+
return (
|
|
138
|
+
<AlertDialogPrimitive.Cancel
|
|
139
|
+
className={cn(buttonVariants({ variant: "outline" }), className)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
AlertDialog,
|
|
147
|
+
AlertDialogPortal,
|
|
148
|
+
AlertDialogOverlay,
|
|
149
|
+
AlertDialogTrigger,
|
|
150
|
+
AlertDialogContent,
|
|
151
|
+
AlertDialogHeader,
|
|
152
|
+
AlertDialogFooter,
|
|
153
|
+
AlertDialogTitle,
|
|
154
|
+
AlertDialogDescription,
|
|
155
|
+
AlertDialogAction,
|
|
156
|
+
AlertDialogCancel,
|
|
157
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const alertVariants = cva(
|
|
7
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-card text-card-foreground",
|
|
12
|
+
destructive:
|
|
13
|
+
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
14
|
+
// 新增语义化 success/warning variant
|
|
15
|
+
success:
|
|
16
|
+
"bg-success text-success-foreground border-success/50 [&>svg]:text-success-foreground *:data-[slot=alert-description]:text-success-foreground/90",
|
|
17
|
+
warning:
|
|
18
|
+
"bg-warning text-warning-foreground border-warning/50 [&>svg]:text-warning-foreground *:data-[slot=alert-description]:text-warning-foreground/90",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
function Alert({
|
|
28
|
+
className,
|
|
29
|
+
variant,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="alert"
|
|
35
|
+
role="alert"
|
|
36
|
+
className={cn(alertVariants({ variant }), className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
data-slot="alert-title"
|
|
46
|
+
className={cn(
|
|
47
|
+
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function AlertDescription({
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<"div">) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot="alert-description"
|
|
62
|
+
className={cn(
|
|
63
|
+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
|
|
4
|
+
|
|
5
|
+
function AspectRatio({
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
8
|
+
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AspectRatio }
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
function Avatar({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<AvatarPrimitive.Root
|
|
14
|
+
data-slot="avatar"
|
|
15
|
+
className={cn(
|
|
16
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function AvatarImage({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
28
|
+
return (
|
|
29
|
+
<AvatarPrimitive.Image
|
|
30
|
+
data-slot="avatar-image"
|
|
31
|
+
className={cn("aspect-square size-full", className)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function AvatarFallback({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
41
|
+
return (
|
|
42
|
+
<AvatarPrimitive.Fallback
|
|
43
|
+
data-slot="avatar-fallback"
|
|
44
|
+
className={cn(
|
|
45
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
// Whitespace-nowrap: Badges should never wrap.
|
|
8
|
+
// hover-elevate: adds subtle dark overlay on hover for interactive feedback
|
|
9
|
+
"whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold hover-elevate",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default:
|
|
14
|
+
// Primary badge with subtle shadow for elevation
|
|
15
|
+
"border-transparent bg-primary text-primary-foreground shadow-xs",
|
|
16
|
+
secondary:
|
|
17
|
+
// Subtle filled badge for secondary information
|
|
18
|
+
"border-transparent bg-secondary text-secondary-foreground",
|
|
19
|
+
destructive:
|
|
20
|
+
// Error/danger state with matching shadow
|
|
21
|
+
"border-transparent bg-destructive text-destructive-foreground shadow-xs",
|
|
22
|
+
// Outline uses badge-outline variable to blend with parent background
|
|
23
|
+
outline: "border [border-color:var(--badge-outline)] shadow-xs",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export interface BadgeProps
|
|
33
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
34
|
+
VariantProps<typeof badgeVariants> {}
|
|
35
|
+
|
|
36
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
37
|
+
return (
|
|
38
|
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
8
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
12
|
+
return (
|
|
13
|
+
<ol
|
|
14
|
+
data-slot="breadcrumb-list"
|
|
15
|
+
className={cn(
|
|
16
|
+
"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
25
|
+
return (
|
|
26
|
+
<li
|
|
27
|
+
data-slot="breadcrumb-item"
|
|
28
|
+
className={cn("inline-flex items-center gap-1.5", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function BreadcrumbLink({
|
|
35
|
+
asChild,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<"a"> & {
|
|
39
|
+
asChild?: boolean
|
|
40
|
+
}) {
|
|
41
|
+
const Comp = asChild ? Slot : "a"
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Comp
|
|
45
|
+
data-slot="breadcrumb-link"
|
|
46
|
+
className={cn("hover:text-foreground transition-colors", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
53
|
+
return (
|
|
54
|
+
<span
|
|
55
|
+
data-slot="breadcrumb-page"
|
|
56
|
+
role="link"
|
|
57
|
+
aria-disabled="true"
|
|
58
|
+
aria-current="page"
|
|
59
|
+
className={cn("text-foreground font-normal", className)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function BreadcrumbSeparator({
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<"li">) {
|
|
70
|
+
return (
|
|
71
|
+
<li
|
|
72
|
+
data-slot="breadcrumb-separator"
|
|
73
|
+
role="presentation"
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
className={cn("[&>svg]:size-3.5", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{children ?? <ChevronRight />}
|
|
79
|
+
</li>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function BreadcrumbEllipsis({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: React.ComponentProps<"span">) {
|
|
87
|
+
return (
|
|
88
|
+
<span
|
|
89
|
+
data-slot="breadcrumb-ellipsis"
|
|
90
|
+
role="presentation"
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<MoreHorizontal className="size-4" />
|
|
96
|
+
<span className="sr-only">More</span>
|
|
97
|
+
</span>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
Breadcrumb,
|
|
103
|
+
BreadcrumbList,
|
|
104
|
+
BreadcrumbItem,
|
|
105
|
+
BreadcrumbLink,
|
|
106
|
+
BreadcrumbPage,
|
|
107
|
+
BreadcrumbSeparator,
|
|
108
|
+
BreadcrumbEllipsis,
|
|
109
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { Separator } from "@/components/ui/separator"
|
|
6
|
+
|
|
7
|
+
const buttonGroupVariants = cva(
|
|
8
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
orientation: {
|
|
12
|
+
horizontal:
|
|
13
|
+
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
14
|
+
vertical:
|
|
15
|
+
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
orientation: "horizontal",
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
function ButtonGroup({
|
|
25
|
+
className,
|
|
26
|
+
orientation,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
role="group"
|
|
32
|
+
data-slot="button-group"
|
|
33
|
+
data-orientation={orientation}
|
|
34
|
+
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function ButtonGroupText({
|
|
41
|
+
className,
|
|
42
|
+
asChild = false,
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<"div"> & {
|
|
45
|
+
asChild?: boolean
|
|
46
|
+
}) {
|
|
47
|
+
const Comp = asChild ? Slot : "div"
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Comp
|
|
51
|
+
className={cn(
|
|
52
|
+
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-normal [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ButtonGroupSeparator({
|
|
61
|
+
className,
|
|
62
|
+
orientation = "vertical",
|
|
63
|
+
...props
|
|
64
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
65
|
+
return (
|
|
66
|
+
<Separator
|
|
67
|
+
data-slot="button-group-separator"
|
|
68
|
+
orientation={orientation}
|
|
69
|
+
className={cn(
|
|
70
|
+
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
|
|
71
|
+
className
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
ButtonGroup,
|
|
80
|
+
ButtonGroupSeparator,
|
|
81
|
+
ButtonGroupText,
|
|
82
|
+
buttonGroupVariants,
|
|
83
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
// Base button styles with elevate system for hover/active states.
|
|
9
|
+
// hover-elevate: applies subtle dark overlay on hover
|
|
10
|
+
// active-elevate-2: applies stronger dark overlay when pressed
|
|
11
|
+
"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 hover-elevate active-elevate-2",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default:
|
|
16
|
+
// Solid primary button with computed border for depth
|
|
17
|
+
"bg-primary text-primary-foreground border border-primary-border",
|
|
18
|
+
destructive:
|
|
19
|
+
// Destructive action button with matching border
|
|
20
|
+
"bg-destructive text-destructive-foreground border border-destructive-border",
|
|
21
|
+
outline:
|
|
22
|
+
// Shows the background color of whatever card / sidebar / accent background it is inside of.
|
|
23
|
+
// Inherits the current text color.
|
|
24
|
+
"border [border-color:var(--button-outline)] shadow-xs active:shadow-none",
|
|
25
|
+
secondary:
|
|
26
|
+
// Subtle filled button for secondary actions
|
|
27
|
+
"bg-secondary text-secondary-foreground border border-secondary-border",
|
|
28
|
+
// Add a transparent border so that when someone toggles a border on later, it doesn't shift layout/size.
|
|
29
|
+
ghost: "border border-transparent",
|
|
30
|
+
},
|
|
31
|
+
// Heights are set as "min" heights, because sometimes AI will place large amount of content
|
|
32
|
+
// inside buttons. With a min-height they will look appropriate with small amounts of content,
|
|
33
|
+
// but will expand to fit large amounts of content.
|
|
34
|
+
size: {
|
|
35
|
+
default: "min-h-9 px-4 py-2",
|
|
36
|
+
sm: "min-h-8 rounded-md px-3 text-xs",
|
|
37
|
+
lg: "min-h-10 rounded-md px-8",
|
|
38
|
+
icon: "h-9 w-9",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
variant: "default",
|
|
43
|
+
size: "default",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
function Button({
|
|
49
|
+
className,
|
|
50
|
+
variant,
|
|
51
|
+
size,
|
|
52
|
+
asChild = false,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<"button"> &
|
|
55
|
+
VariantProps<typeof buttonVariants> & {
|
|
56
|
+
asChild?: boolean
|
|
57
|
+
}) {
|
|
58
|
+
const Comp = asChild ? Slot : "button"
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Comp
|
|
62
|
+
data-slot="button"
|
|
63
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { Button, buttonVariants }
|