@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,243 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
|
5
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
const EMPTY_SENTINEL = "__dont__use__this__empty__value__"
|
|
9
|
+
|
|
10
|
+
function Select({
|
|
11
|
+
value,
|
|
12
|
+
defaultValue,
|
|
13
|
+
onValueChange,
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
16
|
+
const mappedValue = value === "" ? EMPTY_SENTINEL : value
|
|
17
|
+
const mappedDefaultValue = defaultValue === "" ? EMPTY_SENTINEL : defaultValue
|
|
18
|
+
const handleChange = (val: string) => {
|
|
19
|
+
onValueChange?.(val === EMPTY_SENTINEL ? "" : val)
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
<SelectPrimitive.Root
|
|
23
|
+
data-slot="select"
|
|
24
|
+
value={mappedValue}
|
|
25
|
+
defaultValue={mappedDefaultValue}
|
|
26
|
+
onValueChange={handleChange}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function SelectGroup({
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
35
|
+
return <SelectPrimitive.Group data-slot="select-group" {...props} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SelectValue({
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
41
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function SelectTrigger({
|
|
45
|
+
className,
|
|
46
|
+
size = "default",
|
|
47
|
+
children,
|
|
48
|
+
...props
|
|
49
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
50
|
+
size?: "sm" | "default"
|
|
51
|
+
}) {
|
|
52
|
+
return (
|
|
53
|
+
<SelectPrimitive.Trigger
|
|
54
|
+
data-slot="select-trigger"
|
|
55
|
+
data-size={size}
|
|
56
|
+
className={cn(
|
|
57
|
+
"border-input data-[placeholder]:text-muted-foreground data-[state=open]:border-ring [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] enabled:hover:border-ring disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg]:transition-transform [&_svg]:duration-200 data-[state=open]:[&_svg]:rotate-180",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{props.asChild ? (
|
|
63
|
+
children
|
|
64
|
+
) : (
|
|
65
|
+
<>
|
|
66
|
+
{children}
|
|
67
|
+
<SelectPrimitive.Icon asChild>
|
|
68
|
+
<ChevronDownIcon className="h-4 w-4 opacity-50" />
|
|
69
|
+
</SelectPrimitive.Icon>
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
</SelectPrimitive.Trigger>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function SelectContent({
|
|
77
|
+
className,
|
|
78
|
+
children,
|
|
79
|
+
position = "popper",
|
|
80
|
+
align = "center",
|
|
81
|
+
...props
|
|
82
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
83
|
+
return (
|
|
84
|
+
<SelectPrimitive.Portal>
|
|
85
|
+
<SelectPrimitive.Content
|
|
86
|
+
data-slot="select-content"
|
|
87
|
+
className={cn(
|
|
88
|
+
"bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
89
|
+
position === "popper" &&
|
|
90
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
91
|
+
className
|
|
92
|
+
)}
|
|
93
|
+
position={position}
|
|
94
|
+
align={align}
|
|
95
|
+
{...props}
|
|
96
|
+
>
|
|
97
|
+
<SelectScrollUpButton />
|
|
98
|
+
<SelectPrimitive.Viewport
|
|
99
|
+
className={cn(
|
|
100
|
+
"p-1",
|
|
101
|
+
position === "popper" &&
|
|
102
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</SelectPrimitive.Viewport>
|
|
107
|
+
<SelectScrollDownButton />
|
|
108
|
+
</SelectPrimitive.Content>
|
|
109
|
+
</SelectPrimitive.Portal>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function SelectLabel({
|
|
114
|
+
className,
|
|
115
|
+
...props
|
|
116
|
+
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
117
|
+
return (
|
|
118
|
+
<SelectPrimitive.Label
|
|
119
|
+
data-slot="select-label"
|
|
120
|
+
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type SelectItemProps = Omit<
|
|
127
|
+
React.ComponentProps<typeof SelectPrimitive.Item>,
|
|
128
|
+
"value"
|
|
129
|
+
> & {
|
|
130
|
+
value: string
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function SelectItem({
|
|
134
|
+
className,
|
|
135
|
+
children,
|
|
136
|
+
disabled,
|
|
137
|
+
onClick,
|
|
138
|
+
onMouseDown,
|
|
139
|
+
onKeyDown,
|
|
140
|
+
onKeyUp,
|
|
141
|
+
onPointerDown,
|
|
142
|
+
value,
|
|
143
|
+
...props
|
|
144
|
+
}: SelectItemProps) {
|
|
145
|
+
return (
|
|
146
|
+
<SelectPrimitive.Item
|
|
147
|
+
data-slot="select-item"
|
|
148
|
+
className={cn(
|
|
149
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=checked]:text-primary data-[state=checked]:[&_svg:not([class*='text-'])]:text-primary relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
150
|
+
className
|
|
151
|
+
)}
|
|
152
|
+
value={value === "" ? EMPTY_SENTINEL : value}
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
onClick={(event) => {
|
|
155
|
+
if (disabled) {
|
|
156
|
+
event.preventDefault()
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
onClick?.(event)
|
|
160
|
+
}}
|
|
161
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
162
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
163
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
164
|
+
onPointerDown={(event) => {
|
|
165
|
+
if (disabled) {
|
|
166
|
+
event.preventDefault()
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
onPointerDown?.(event)
|
|
170
|
+
}}
|
|
171
|
+
{...props}
|
|
172
|
+
>
|
|
173
|
+
<span className="absolute right-2 flex size-3.5 items-center justify-center">
|
|
174
|
+
<SelectPrimitive.ItemIndicator>
|
|
175
|
+
<CheckIcon className="size-4" />
|
|
176
|
+
</SelectPrimitive.ItemIndicator>
|
|
177
|
+
</span>
|
|
178
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
179
|
+
</SelectPrimitive.Item>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function SelectSeparator({
|
|
184
|
+
className,
|
|
185
|
+
...props
|
|
186
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
187
|
+
return (
|
|
188
|
+
<SelectPrimitive.Separator
|
|
189
|
+
data-slot="select-separator"
|
|
190
|
+
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
|
|
191
|
+
{...props}
|
|
192
|
+
/>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function SelectScrollUpButton({
|
|
197
|
+
className,
|
|
198
|
+
...props
|
|
199
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
200
|
+
return (
|
|
201
|
+
<SelectPrimitive.ScrollUpButton
|
|
202
|
+
data-slot="select-scroll-up-button"
|
|
203
|
+
className={cn(
|
|
204
|
+
"flex cursor-default items-center justify-center py-1",
|
|
205
|
+
className
|
|
206
|
+
)}
|
|
207
|
+
{...props}
|
|
208
|
+
>
|
|
209
|
+
<ChevronUpIcon className="size-4" />
|
|
210
|
+
</SelectPrimitive.ScrollUpButton>
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function SelectScrollDownButton({
|
|
215
|
+
className,
|
|
216
|
+
...props
|
|
217
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
218
|
+
return (
|
|
219
|
+
<SelectPrimitive.ScrollDownButton
|
|
220
|
+
data-slot="select-scroll-down-button"
|
|
221
|
+
className={cn(
|
|
222
|
+
"flex cursor-default items-center justify-center py-1",
|
|
223
|
+
className
|
|
224
|
+
)}
|
|
225
|
+
{...props}
|
|
226
|
+
>
|
|
227
|
+
<ChevronDownIcon className="size-4" />
|
|
228
|
+
</SelectPrimitive.ScrollDownButton>
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export {
|
|
233
|
+
Select,
|
|
234
|
+
SelectContent,
|
|
235
|
+
SelectGroup,
|
|
236
|
+
SelectItem,
|
|
237
|
+
SelectLabel,
|
|
238
|
+
SelectScrollDownButton,
|
|
239
|
+
SelectScrollUpButton,
|
|
240
|
+
SelectSeparator,
|
|
241
|
+
SelectTrigger,
|
|
242
|
+
SelectValue,
|
|
243
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
function Separator({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "horizontal",
|
|
11
|
+
decorative = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<SeparatorPrimitive.Root
|
|
16
|
+
data-slot="separator"
|
|
17
|
+
decorative={decorative}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
className={cn(
|
|
20
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Separator }
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
16
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SheetClose({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
22
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetPortal({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
28
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function SheetOverlay({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
35
|
+
return (
|
|
36
|
+
<SheetPrimitive.Overlay
|
|
37
|
+
data-slot="sheet-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 SheetContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
side = "right",
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
53
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
54
|
+
}) {
|
|
55
|
+
return (
|
|
56
|
+
<SheetPortal>
|
|
57
|
+
<SheetOverlay />
|
|
58
|
+
<SheetPrimitive.Content
|
|
59
|
+
data-slot="sheet-content"
|
|
60
|
+
className={cn(
|
|
61
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 p-6",
|
|
62
|
+
side === "right" &&
|
|
63
|
+
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
64
|
+
side === "left" &&
|
|
65
|
+
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
66
|
+
side === "top" &&
|
|
67
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
68
|
+
side === "bottom" &&
|
|
69
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity enabled:hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:cursor-not-allowed">
|
|
76
|
+
<XIcon className="size-4" />
|
|
77
|
+
<span className="sr-only">Close</span>
|
|
78
|
+
</SheetPrimitive.Close>
|
|
79
|
+
</SheetPrimitive.Content>
|
|
80
|
+
</SheetPortal>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
data-slot="sheet-header"
|
|
88
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
95
|
+
return (
|
|
96
|
+
<div
|
|
97
|
+
data-slot="sheet-footer"
|
|
98
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function SheetTitle({
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
108
|
+
return (
|
|
109
|
+
<SheetPrimitive.Title
|
|
110
|
+
data-slot="sheet-title"
|
|
111
|
+
className={cn("text-foreground font-semibold", className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function SheetDescription({
|
|
118
|
+
className,
|
|
119
|
+
...props
|
|
120
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
121
|
+
return (
|
|
122
|
+
<SheetPrimitive.Description
|
|
123
|
+
data-slot="sheet-description"
|
|
124
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
125
|
+
{...props}
|
|
126
|
+
/>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
Sheet,
|
|
132
|
+
SheetTrigger,
|
|
133
|
+
SheetClose,
|
|
134
|
+
SheetContent,
|
|
135
|
+
SheetHeader,
|
|
136
|
+
SheetFooter,
|
|
137
|
+
SheetTitle,
|
|
138
|
+
SheetDescription,
|
|
139
|
+
}
|