veslx 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/bin/lib/import-config.ts +13 -0
- package/bin/lib/init.ts +31 -0
- package/bin/lib/serve.ts +35 -0
- package/bin/lib/start.ts +40 -0
- package/bin/lib/stop.ts +24 -0
- package/bin/vesl.ts +41 -0
- package/components.json +20 -0
- package/eslint.config.js +23 -0
- package/index.html +17 -0
- package/package.json +89 -0
- package/plugin/README.md +21 -0
- package/plugin/package.json +26 -0
- package/plugin/src/cli.ts +30 -0
- package/plugin/src/client.tsx +224 -0
- package/plugin/src/lib.ts +268 -0
- package/plugin/src/plugin.ts +109 -0
- package/postcss.config.js +5 -0
- package/public/logo_dark.png +0 -0
- package/public/logo_light.png +0 -0
- package/src/App.tsx +21 -0
- package/src/components/front-matter.tsx +53 -0
- package/src/components/gallery/components/figure-caption.tsx +15 -0
- package/src/components/gallery/components/figure-header.tsx +20 -0
- package/src/components/gallery/components/lightbox.tsx +106 -0
- package/src/components/gallery/components/loading-image.tsx +48 -0
- package/src/components/gallery/hooks/use-gallery-images.ts +103 -0
- package/src/components/gallery/hooks/use-lightbox.ts +40 -0
- package/src/components/gallery/index.tsx +134 -0
- package/src/components/gallery/lib/render-math-in-text.tsx +47 -0
- package/src/components/header.tsx +68 -0
- package/src/components/index.ts +5 -0
- package/src/components/loading.tsx +16 -0
- package/src/components/mdx-components.tsx +163 -0
- package/src/components/mode-toggle.tsx +44 -0
- package/src/components/page-error.tsx +59 -0
- package/src/components/parameter-badge.tsx +78 -0
- package/src/components/parameter-table.tsx +420 -0
- package/src/components/post-list.tsx +148 -0
- package/src/components/running-bar.tsx +21 -0
- package/src/components/runtime-mdx.tsx +82 -0
- package/src/components/slide.tsx +11 -0
- package/src/components/theme-provider.tsx +6 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/carousel.tsx +260 -0
- package/src/components/ui/dropdown-menu.tsx +198 -0
- package/src/components/ui/input.tsx +22 -0
- package/src/components/ui/kbd.tsx +22 -0
- package/src/components/ui/select.tsx +158 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/shadcn-io/code-block/index.tsx +620 -0
- package/src/components/ui/shadcn-io/code-block/server.tsx +63 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/sidebar.tsx +771 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/spinner.tsx +16 -0
- package/src/components/ui/tooltip.tsx +28 -0
- package/src/components/welcome.tsx +21 -0
- package/src/hooks/use-key-bindings.ts +72 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.css +279 -0
- package/src/lib/constants.ts +10 -0
- package/src/lib/format-date.tsx +6 -0
- package/src/lib/format-file-size.ts +10 -0
- package/src/lib/parameter-utils.ts +134 -0
- package/src/lib/utils.ts +6 -0
- package/src/main.tsx +10 -0
- package/src/pages/home.tsx +39 -0
- package/src/pages/post.tsx +65 -0
- package/src/pages/slides.tsx +173 -0
- package/tailwind.config.js +136 -0
- package/test-content/.vesl.json +49 -0
- package/test-content/README.md +33 -0
- package/test-content/test-post/README.mdx +7 -0
- package/test-content/test-slides/SLIDES.mdx +8 -0
- package/tsconfig.app.json +32 -0
- package/tsconfig.json +15 -0
- package/tsconfig.node.json +25 -0
- package/vesl.config.ts +4 -0
- package/vite.config.ts +54 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
8
|
+
|
|
9
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
10
|
+
|
|
11
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
12
|
+
|
|
13
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
14
|
+
|
|
15
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
16
|
+
|
|
17
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
18
|
+
|
|
19
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean
|
|
23
|
+
}
|
|
24
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
25
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
29
|
+
inset && "pl-8",
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
<ChevronRight className="ml-auto" />
|
|
36
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
37
|
+
))
|
|
38
|
+
DropdownMenuSubTrigger.displayName =
|
|
39
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
|
40
|
+
|
|
41
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
42
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
43
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
44
|
+
>(({ className, ...props }, ref) => (
|
|
45
|
+
<DropdownMenuPrimitive.SubContent
|
|
46
|
+
ref={ref}
|
|
47
|
+
className={cn(
|
|
48
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
))
|
|
54
|
+
DropdownMenuSubContent.displayName =
|
|
55
|
+
DropdownMenuPrimitive.SubContent.displayName
|
|
56
|
+
|
|
57
|
+
const DropdownMenuContent = React.forwardRef<
|
|
58
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
59
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
60
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
61
|
+
<DropdownMenuPrimitive.Portal>
|
|
62
|
+
<DropdownMenuPrimitive.Content
|
|
63
|
+
ref={ref}
|
|
64
|
+
sideOffset={sideOffset}
|
|
65
|
+
className={cn(
|
|
66
|
+
"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
</DropdownMenuPrimitive.Portal>
|
|
72
|
+
))
|
|
73
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
74
|
+
|
|
75
|
+
const DropdownMenuItem = React.forwardRef<
|
|
76
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
77
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
78
|
+
inset?: boolean
|
|
79
|
+
}
|
|
80
|
+
>(({ className, inset, ...props }, ref) => (
|
|
81
|
+
<DropdownMenuPrimitive.Item
|
|
82
|
+
ref={ref}
|
|
83
|
+
className={cn(
|
|
84
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
85
|
+
inset && "pl-8",
|
|
86
|
+
className
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
))
|
|
91
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
92
|
+
|
|
93
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
94
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
95
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
96
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
97
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn(
|
|
100
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
101
|
+
className
|
|
102
|
+
)}
|
|
103
|
+
checked={checked}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
107
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
108
|
+
<Check className="h-4 w-4" />
|
|
109
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
+
</span>
|
|
111
|
+
{children}
|
|
112
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
113
|
+
))
|
|
114
|
+
DropdownMenuCheckboxItem.displayName =
|
|
115
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
|
116
|
+
|
|
117
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
118
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
119
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
120
|
+
>(({ className, children, ...props }, ref) => (
|
|
121
|
+
<DropdownMenuPrimitive.RadioItem
|
|
122
|
+
ref={ref}
|
|
123
|
+
className={cn(
|
|
124
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
125
|
+
className
|
|
126
|
+
)}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
130
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
131
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
132
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
133
|
+
</span>
|
|
134
|
+
{children}
|
|
135
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
136
|
+
))
|
|
137
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
138
|
+
|
|
139
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
140
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
141
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
142
|
+
inset?: boolean
|
|
143
|
+
}
|
|
144
|
+
>(({ className, inset, ...props }, ref) => (
|
|
145
|
+
<DropdownMenuPrimitive.Label
|
|
146
|
+
ref={ref}
|
|
147
|
+
className={cn(
|
|
148
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
149
|
+
inset && "pl-8",
|
|
150
|
+
className
|
|
151
|
+
)}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
))
|
|
155
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
156
|
+
|
|
157
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
158
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
159
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
160
|
+
>(({ className, ...props }, ref) => (
|
|
161
|
+
<DropdownMenuPrimitive.Separator
|
|
162
|
+
ref={ref}
|
|
163
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
164
|
+
{...props}
|
|
165
|
+
/>
|
|
166
|
+
))
|
|
167
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
168
|
+
|
|
169
|
+
const DropdownMenuShortcut = ({
|
|
170
|
+
className,
|
|
171
|
+
...props
|
|
172
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
173
|
+
return (
|
|
174
|
+
<span
|
|
175
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
176
|
+
{...props}
|
|
177
|
+
/>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
DropdownMenu,
|
|
184
|
+
DropdownMenuTrigger,
|
|
185
|
+
DropdownMenuContent,
|
|
186
|
+
DropdownMenuItem,
|
|
187
|
+
DropdownMenuCheckboxItem,
|
|
188
|
+
DropdownMenuRadioItem,
|
|
189
|
+
DropdownMenuLabel,
|
|
190
|
+
DropdownMenuSeparator,
|
|
191
|
+
DropdownMenuShortcut,
|
|
192
|
+
DropdownMenuGroup,
|
|
193
|
+
DropdownMenuPortal,
|
|
194
|
+
DropdownMenuSub,
|
|
195
|
+
DropdownMenuSubContent,
|
|
196
|
+
DropdownMenuSubTrigger,
|
|
197
|
+
DropdownMenuRadioGroup,
|
|
198
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
|
6
|
+
({ className, type, ...props }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<input
|
|
9
|
+
type={type}
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
ref={ref}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
Input.displayName = "Input"
|
|
21
|
+
|
|
22
|
+
export { Input }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "@/lib/utils"
|
|
3
|
+
|
|
4
|
+
export interface KbdProps extends React.HTMLAttributes<HTMLElement> {}
|
|
5
|
+
|
|
6
|
+
const Kbd = React.forwardRef<HTMLElement, KbdProps>(
|
|
7
|
+
({ className, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<kbd
|
|
10
|
+
className={cn(
|
|
11
|
+
"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
ref={ref}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
Kbd.displayName = "Kbd"
|
|
21
|
+
|
|
22
|
+
export { Kbd }
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const Select = SelectPrimitive.Root
|
|
8
|
+
|
|
9
|
+
const SelectGroup = SelectPrimitive.Group
|
|
10
|
+
|
|
11
|
+
const SelectValue = SelectPrimitive.Value
|
|
12
|
+
|
|
13
|
+
const SelectTrigger = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
+
>(({ className, children, ...props }, ref) => (
|
|
17
|
+
<SelectPrimitive.Trigger
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
<SelectPrimitive.Icon asChild>
|
|
27
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
+
</SelectPrimitive.Icon>
|
|
29
|
+
</SelectPrimitive.Trigger>
|
|
30
|
+
))
|
|
31
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
32
|
+
|
|
33
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
+
>(({ className, ...props }, ref) => (
|
|
37
|
+
<SelectPrimitive.ScrollUpButton
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex cursor-default items-center justify-center py-1",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<ChevronUp className="h-4 w-4" />
|
|
46
|
+
</SelectPrimitive.ScrollUpButton>
|
|
47
|
+
))
|
|
48
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
|
49
|
+
|
|
50
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
51
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
52
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
53
|
+
>(({ className, ...props }, ref) => (
|
|
54
|
+
<SelectPrimitive.ScrollDownButton
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(
|
|
57
|
+
"flex cursor-default items-center justify-center py-1",
|
|
58
|
+
className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
<ChevronDown className="h-4 w-4" />
|
|
63
|
+
</SelectPrimitive.ScrollDownButton>
|
|
64
|
+
))
|
|
65
|
+
SelectScrollDownButton.displayName =
|
|
66
|
+
SelectPrimitive.ScrollDownButton.displayName
|
|
67
|
+
|
|
68
|
+
const SelectContent = React.forwardRef<
|
|
69
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
70
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
71
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
72
|
+
<SelectPrimitive.Portal>
|
|
73
|
+
<SelectPrimitive.Content
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
"relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
|
|
77
|
+
position === "popper" &&
|
|
78
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
position={position}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
<SelectScrollUpButton />
|
|
85
|
+
<SelectPrimitive.Viewport
|
|
86
|
+
className={cn(
|
|
87
|
+
"p-1",
|
|
88
|
+
position === "popper" &&
|
|
89
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</SelectPrimitive.Viewport>
|
|
94
|
+
<SelectScrollDownButton />
|
|
95
|
+
</SelectPrimitive.Content>
|
|
96
|
+
</SelectPrimitive.Portal>
|
|
97
|
+
))
|
|
98
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
99
|
+
|
|
100
|
+
const SelectLabel = React.forwardRef<
|
|
101
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
102
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
103
|
+
>(({ className, ...props }, ref) => (
|
|
104
|
+
<SelectPrimitive.Label
|
|
105
|
+
ref={ref}
|
|
106
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
))
|
|
110
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
111
|
+
|
|
112
|
+
const SelectItem = React.forwardRef<
|
|
113
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
114
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
115
|
+
>(({ className, children, ...props }, ref) => (
|
|
116
|
+
<SelectPrimitive.Item
|
|
117
|
+
ref={ref}
|
|
118
|
+
className={cn(
|
|
119
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
120
|
+
className
|
|
121
|
+
)}
|
|
122
|
+
{...props}
|
|
123
|
+
>
|
|
124
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
125
|
+
<SelectPrimitive.ItemIndicator>
|
|
126
|
+
<Check className="h-4 w-4" />
|
|
127
|
+
</SelectPrimitive.ItemIndicator>
|
|
128
|
+
</span>
|
|
129
|
+
|
|
130
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
131
|
+
</SelectPrimitive.Item>
|
|
132
|
+
))
|
|
133
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
134
|
+
|
|
135
|
+
const SelectSeparator = React.forwardRef<
|
|
136
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
137
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
138
|
+
>(({ className, ...props }, ref) => (
|
|
139
|
+
<SelectPrimitive.Separator
|
|
140
|
+
ref={ref}
|
|
141
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
))
|
|
145
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
Select,
|
|
149
|
+
SelectGroup,
|
|
150
|
+
SelectValue,
|
|
151
|
+
SelectTrigger,
|
|
152
|
+
SelectContent,
|
|
153
|
+
SelectLabel,
|
|
154
|
+
SelectItem,
|
|
155
|
+
SelectSeparator,
|
|
156
|
+
SelectScrollUpButton,
|
|
157
|
+
SelectScrollDownButton,
|
|
158
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
12
|
+
ref
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"shrink-0 bg-border",
|
|
20
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
28
|
+
|
|
29
|
+
export { Separator }
|