@lark-apaas/coding-templates 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-vite-react/README.md +175 -0
- package/template-vite-react/client/index.html +2 -1
- package/template-vite-react/client/src/components/layout.tsx +0 -2
- package/template-vite-react/client/src/components/ui/README.md +134 -0
- package/template-vite-react/client/src/components/ui/accordion.tsx +22 -28
- package/template-vite-react/client/src/components/ui/alert-dialog.tsx +34 -64
- package/template-vite-react/client/src/components/ui/alert.tsx +10 -15
- package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +5 -16
- package/template-vite-react/client/src/components/ui/avatar.tsx +11 -67
- package/template-vite-react/client/src/components/ui/badge.tsx +21 -31
- package/template-vite-react/client/src/components/ui/breadcrumb.tsx +23 -39
- package/template-vite-react/client/src/components/ui/button.tsx +36 -25
- package/template-vite-react/client/src/components/ui/calendar.tsx +37 -43
- package/template-vite-react/client/src/components/ui/card.tsx +73 -94
- package/template-vite-react/client/src/components/ui/carousel.tsx +7 -8
- package/template-vite-react/client/src/components/ui/chart.tsx +35 -49
- package/template-vite-react/client/src/components/ui/checkbox.tsx +10 -7
- package/template-vite-react/client/src/components/ui/collapsible.tsx +20 -6
- package/template-vite-react/client/src/components/ui/command.tsx +52 -40
- package/template-vite-react/client/src/components/ui/context-menu.tsx +170 -117
- package/template-vite-react/client/src/components/ui/dialog.tsx +37 -52
- package/template-vite-react/client/src/components/ui/drawer.tsx +12 -9
- package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +194 -133
- package/template-vite-react/client/src/components/ui/hover-card.tsx +24 -29
- package/template-vite-react/client/src/components/ui/input-group.tsx +39 -29
- package/template-vite-react/client/src/components/ui/input-otp.tsx +7 -17
- package/template-vite-react/client/src/components/ui/input.tsx +4 -3
- package/template-vite-react/client/src/components/ui/label.tsx +9 -3
- package/template-vite-react/client/src/components/ui/menubar.tsx +160 -92
- package/template-vite-react/client/src/components/ui/navigation-menu.tsx +45 -45
- package/template-vite-react/client/src/components/ui/pagination.tsx +32 -35
- package/template-vite-react/client/src/components/ui/popover.tsx +20 -62
- package/template-vite-react/client/src/components/ui/progress.tsx +14 -64
- package/template-vite-react/client/src/components/ui/radio-group.tsx +20 -13
- package/template-vite-react/client/src/components/ui/resizable.tsx +18 -10
- package/template-vite-react/client/src/components/ui/scroll-area.tsx +13 -10
- package/template-vite-react/client/src/components/ui/select.tsx +122 -78
- package/template-vite-react/client/src/components/ui/separator.tsx +7 -4
- package/template-vite-react/client/src/components/ui/sheet.tsx +42 -41
- package/template-vite-react/client/src/components/ui/sidebar.tsx +162 -156
- package/template-vite-react/client/src/components/ui/skeleton.tsx +1 -1
- package/template-vite-react/client/src/components/ui/slider.tsx +52 -22
- package/template-vite-react/client/src/components/ui/sonner.tsx +44 -26
- package/template-vite-react/client/src/components/ui/switch.tsx +9 -8
- package/template-vite-react/client/src/components/ui/table.tsx +5 -5
- package/template-vite-react/client/src/components/ui/tabs.tsx +24 -38
- package/template-vite-react/client/src/components/ui/textarea.tsx +1 -1
- package/template-vite-react/client/src/components/ui/toggle-group.tsx +14 -20
- package/template-vite-react/client/src/components/ui/toggle.tsx +13 -10
- package/template-vite-react/client/src/components/ui/tooltip.tsx +30 -33
- package/template-vite-react/client/src/index.css +130 -0
- package/template-vite-react/client/src/main.tsx +1 -4
- package/template-vite-react/components.json +2 -6
- package/template-vite-react/eslint.config.js +11 -0
- package/template-vite-react/package.json +27 -2
- package/template-vite-react/client/src/components/header.tsx +0 -22
- package/template-vite-react/client/src/components/theme-provider.tsx +0 -45
- package/template-vite-react/client/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
- package/template-vite-react/client/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
- package/template-vite-react/client/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
- package/template-vite-react/client/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
- package/template-vite-react/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
- package/template-vite-react/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
- package/template-vite-react/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
- package/template-vite-react/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
- package/template-vite-react/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
- package/template-vite-react/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
- package/template-vite-react/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
- package/template-vite-react/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
- package/template-vite-react/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
- package/template-vite-react/client/src/types/index.ts +0 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
import { SearchIcon } from "lucide-react"
|
|
5
6
|
|
|
6
7
|
import { cn } from "@/lib/utils"
|
|
7
8
|
import {
|
|
@@ -11,11 +12,6 @@ import {
|
|
|
11
12
|
DialogHeader,
|
|
12
13
|
DialogTitle,
|
|
13
14
|
} from "@/components/ui/dialog"
|
|
14
|
-
import {
|
|
15
|
-
InputGroup,
|
|
16
|
-
InputGroupAddon,
|
|
17
|
-
} from "@/components/ui/input-group"
|
|
18
|
-
import { SearchIcon, CheckIcon } from "lucide-react"
|
|
19
15
|
|
|
20
16
|
function Command({
|
|
21
17
|
className,
|
|
@@ -25,7 +21,7 @@ function Command({
|
|
|
25
21
|
<CommandPrimitive
|
|
26
22
|
data-slot="command"
|
|
27
23
|
className={cn(
|
|
28
|
-
"flex
|
|
24
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
29
25
|
className
|
|
30
26
|
)}
|
|
31
27
|
{...props}
|
|
@@ -38,14 +34,13 @@ function CommandDialog({
|
|
|
38
34
|
description = "Search for a command to run...",
|
|
39
35
|
children,
|
|
40
36
|
className,
|
|
41
|
-
showCloseButton =
|
|
37
|
+
showCloseButton = true,
|
|
42
38
|
...props
|
|
43
|
-
}:
|
|
39
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
44
40
|
title?: string
|
|
45
41
|
description?: string
|
|
46
42
|
className?: string
|
|
47
43
|
showCloseButton?: boolean
|
|
48
|
-
children: React.ReactNode
|
|
49
44
|
}) {
|
|
50
45
|
return (
|
|
51
46
|
<Dialog {...props}>
|
|
@@ -54,13 +49,12 @@ function CommandDialog({
|
|
|
54
49
|
<DialogDescription>{description}</DialogDescription>
|
|
55
50
|
</DialogHeader>
|
|
56
51
|
<DialogContent
|
|
57
|
-
className={cn(
|
|
58
|
-
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
59
|
-
className
|
|
60
|
-
)}
|
|
52
|
+
className={cn("overflow-hidden p-0", className)}
|
|
61
53
|
showCloseButton={showCloseButton}
|
|
62
54
|
>
|
|
63
|
-
|
|
55
|
+
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
56
|
+
{children}
|
|
57
|
+
</Command>
|
|
64
58
|
</DialogContent>
|
|
65
59
|
</Dialog>
|
|
66
60
|
)
|
|
@@ -71,20 +65,19 @@ function CommandInput({
|
|
|
71
65
|
...props
|
|
72
66
|
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
73
67
|
return (
|
|
74
|
-
<div
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</InputGroup>
|
|
68
|
+
<div
|
|
69
|
+
data-slot="command-input-wrapper"
|
|
70
|
+
className="flex h-9 items-center gap-2 border-b px-3"
|
|
71
|
+
>
|
|
72
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
73
|
+
<CommandPrimitive.Input
|
|
74
|
+
data-slot="command-input"
|
|
75
|
+
className={cn(
|
|
76
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
88
81
|
</div>
|
|
89
82
|
)
|
|
90
83
|
}
|
|
@@ -97,7 +90,7 @@ function CommandList({
|
|
|
97
90
|
<CommandPrimitive.List
|
|
98
91
|
data-slot="command-list"
|
|
99
92
|
className={cn(
|
|
100
|
-
"
|
|
93
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
101
94
|
className
|
|
102
95
|
)}
|
|
103
96
|
{...props}
|
|
@@ -106,13 +99,12 @@ function CommandList({
|
|
|
106
99
|
}
|
|
107
100
|
|
|
108
101
|
function CommandEmpty({
|
|
109
|
-
className,
|
|
110
102
|
...props
|
|
111
103
|
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
112
104
|
return (
|
|
113
105
|
<CommandPrimitive.Empty
|
|
114
106
|
data-slot="command-empty"
|
|
115
|
-
className=
|
|
107
|
+
className="py-6 text-center text-sm"
|
|
116
108
|
{...props}
|
|
117
109
|
/>
|
|
118
110
|
)
|
|
@@ -126,7 +118,7 @@ function CommandGroup({
|
|
|
126
118
|
<CommandPrimitive.Group
|
|
127
119
|
data-slot="command-group"
|
|
128
120
|
className={cn(
|
|
129
|
-
"overflow-hidden p-1
|
|
121
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
130
122
|
className
|
|
131
123
|
)}
|
|
132
124
|
{...props}
|
|
@@ -141,7 +133,7 @@ function CommandSeparator({
|
|
|
141
133
|
return (
|
|
142
134
|
<CommandPrimitive.Separator
|
|
143
135
|
data-slot="command-separator"
|
|
144
|
-
className={cn("-mx-1 h-px
|
|
136
|
+
className={cn("bg-border -mx-1 h-px", className)}
|
|
145
137
|
{...props}
|
|
146
138
|
/>
|
|
147
139
|
)
|
|
@@ -149,21 +141,41 @@ function CommandSeparator({
|
|
|
149
141
|
|
|
150
142
|
function CommandItem({
|
|
151
143
|
className,
|
|
152
|
-
|
|
144
|
+
disabled,
|
|
145
|
+
onClick,
|
|
146
|
+
onMouseDown,
|
|
147
|
+
onKeyDown,
|
|
148
|
+
onKeyUp,
|
|
149
|
+
onPointerDown,
|
|
153
150
|
...props
|
|
154
151
|
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
155
152
|
return (
|
|
156
153
|
<CommandPrimitive.Item
|
|
157
154
|
data-slot="command-item"
|
|
158
155
|
className={cn(
|
|
159
|
-
"
|
|
156
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
160
157
|
className
|
|
161
158
|
)}
|
|
159
|
+
disabled={disabled}
|
|
160
|
+
onClick={(event) => {
|
|
161
|
+
if (disabled) {
|
|
162
|
+
event.preventDefault()
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
onClick?.(event)
|
|
166
|
+
}}
|
|
167
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
168
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
169
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
170
|
+
onPointerDown={(event) => {
|
|
171
|
+
if (disabled) {
|
|
172
|
+
event.preventDefault()
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
onPointerDown?.(event)
|
|
176
|
+
}}
|
|
162
177
|
{...props}
|
|
163
|
-
|
|
164
|
-
{children}
|
|
165
|
-
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
166
|
-
</CommandPrimitive.Item>
|
|
178
|
+
/>
|
|
167
179
|
)
|
|
168
180
|
}
|
|
169
181
|
|
|
@@ -175,7 +187,7 @@ function CommandShortcut({
|
|
|
175
187
|
<span
|
|
176
188
|
data-slot="command-shortcut"
|
|
177
189
|
className={cn(
|
|
178
|
-
"ml-auto text-xs tracking-widest
|
|
190
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
179
191
|
className
|
|
180
192
|
)}
|
|
181
193
|
{...props}
|
|
@@ -1,107 +1,91 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import
|
|
4
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
5
6
|
|
|
6
7
|
import { cn } from "@/lib/utils"
|
|
7
|
-
import { ChevronRightIcon, CheckIcon } from "lucide-react"
|
|
8
8
|
|
|
9
|
-
function ContextMenu({
|
|
9
|
+
function ContextMenu({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
|
|
10
12
|
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
function
|
|
15
|
+
function ContextMenuTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
|
|
14
18
|
return (
|
|
15
|
-
<ContextMenuPrimitive.
|
|
19
|
+
<ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
|
|
16
20
|
)
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
function
|
|
20
|
-
className,
|
|
23
|
+
function ContextMenuGroup({
|
|
21
24
|
...props
|
|
22
|
-
}: ContextMenuPrimitive.
|
|
25
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
|
|
23
26
|
return (
|
|
24
|
-
<ContextMenuPrimitive.
|
|
25
|
-
data-slot="context-menu-trigger"
|
|
26
|
-
className={cn("select-none", className)}
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
27
|
+
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
|
29
28
|
)
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
function
|
|
33
|
-
className,
|
|
34
|
-
align = "start",
|
|
35
|
-
alignOffset = 4,
|
|
36
|
-
side = "right",
|
|
37
|
-
sideOffset = 0,
|
|
31
|
+
function ContextMenuPortal({
|
|
38
32
|
...props
|
|
39
|
-
}: ContextMenuPrimitive.
|
|
40
|
-
Pick<
|
|
41
|
-
ContextMenuPrimitive.Positioner.Props,
|
|
42
|
-
"align" | "alignOffset" | "side" | "sideOffset"
|
|
43
|
-
>) {
|
|
33
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
|
|
44
34
|
return (
|
|
45
|
-
<ContextMenuPrimitive.Portal
|
|
46
|
-
<ContextMenuPrimitive.Positioner
|
|
47
|
-
className="isolate z-50 outline-none"
|
|
48
|
-
align={align}
|
|
49
|
-
alignOffset={alignOffset}
|
|
50
|
-
side={side}
|
|
51
|
-
sideOffset={sideOffset}
|
|
52
|
-
>
|
|
53
|
-
<ContextMenuPrimitive.Popup
|
|
54
|
-
data-slot="context-menu-content"
|
|
55
|
-
className={cn("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
56
|
-
{...props}
|
|
57
|
-
/>
|
|
58
|
-
</ContextMenuPrimitive.Positioner>
|
|
59
|
-
</ContextMenuPrimitive.Portal>
|
|
35
|
+
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
|
60
36
|
)
|
|
61
37
|
}
|
|
62
38
|
|
|
63
|
-
function
|
|
39
|
+
function ContextMenuSub({
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
|
|
42
|
+
return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ContextMenuRadioGroup({
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
|
|
64
48
|
return (
|
|
65
|
-
<ContextMenuPrimitive.
|
|
49
|
+
<ContextMenuPrimitive.RadioGroup
|
|
50
|
+
data-slot="context-menu-radio-group"
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
66
53
|
)
|
|
67
54
|
}
|
|
68
55
|
|
|
69
|
-
function
|
|
56
|
+
function ContextMenuSubTrigger({
|
|
70
57
|
className,
|
|
71
58
|
inset,
|
|
59
|
+
children,
|
|
72
60
|
...props
|
|
73
|
-
}: ContextMenuPrimitive.
|
|
61
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
74
62
|
inset?: boolean
|
|
75
63
|
}) {
|
|
76
64
|
return (
|
|
77
|
-
<ContextMenuPrimitive.
|
|
78
|
-
data-slot="context-menu-
|
|
65
|
+
<ContextMenuPrimitive.SubTrigger
|
|
66
|
+
data-slot="context-menu-sub-trigger"
|
|
79
67
|
data-inset={inset}
|
|
80
68
|
className={cn(
|
|
81
|
-
"
|
|
69
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
82
70
|
className
|
|
83
71
|
)}
|
|
84
72
|
{...props}
|
|
85
|
-
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
<ChevronRightIcon className="ml-auto" />
|
|
76
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
86
77
|
)
|
|
87
78
|
}
|
|
88
79
|
|
|
89
|
-
function
|
|
80
|
+
function ContextMenuSubContent({
|
|
90
81
|
className,
|
|
91
|
-
inset,
|
|
92
|
-
variant = "default",
|
|
93
82
|
...props
|
|
94
|
-
}: ContextMenuPrimitive.
|
|
95
|
-
inset?: boolean
|
|
96
|
-
variant?: "default" | "destructive"
|
|
97
|
-
}) {
|
|
83
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
|
98
84
|
return (
|
|
99
|
-
<ContextMenuPrimitive.
|
|
100
|
-
data-slot="context-menu-
|
|
101
|
-
data-inset={inset}
|
|
102
|
-
data-variant={variant}
|
|
85
|
+
<ContextMenuPrimitive.SubContent
|
|
86
|
+
data-slot="context-menu-sub-content"
|
|
103
87
|
className={cn(
|
|
104
|
-
"
|
|
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 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
105
89
|
className
|
|
106
90
|
)}
|
|
107
91
|
{...props}
|
|
@@ -109,44 +93,66 @@ function ContextMenuItem({
|
|
|
109
93
|
)
|
|
110
94
|
}
|
|
111
95
|
|
|
112
|
-
function
|
|
96
|
+
function ContextMenuContent({
|
|
97
|
+
className,
|
|
98
|
+
...props
|
|
99
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
|
113
100
|
return (
|
|
114
|
-
<ContextMenuPrimitive.
|
|
101
|
+
<ContextMenuPrimitive.Portal>
|
|
102
|
+
<ContextMenuPrimitive.Content
|
|
103
|
+
data-slot="context-menu-content"
|
|
104
|
+
className={cn(
|
|
105
|
+
"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 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
</ContextMenuPrimitive.Portal>
|
|
115
111
|
)
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
function
|
|
114
|
+
function ContextMenuItem({
|
|
119
115
|
className,
|
|
120
116
|
inset,
|
|
121
|
-
|
|
117
|
+
variant = "default",
|
|
118
|
+
disabled,
|
|
119
|
+
onClick,
|
|
120
|
+
onMouseDown,
|
|
121
|
+
onKeyDown,
|
|
122
|
+
onKeyUp,
|
|
123
|
+
onPointerDown,
|
|
122
124
|
...props
|
|
123
|
-
}: ContextMenuPrimitive.
|
|
125
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
124
126
|
inset?: boolean
|
|
127
|
+
variant?: "default" | "destructive"
|
|
125
128
|
}) {
|
|
126
129
|
return (
|
|
127
|
-
<ContextMenuPrimitive.
|
|
128
|
-
data-slot="context-menu-
|
|
130
|
+
<ContextMenuPrimitive.Item
|
|
131
|
+
data-slot="context-menu-item"
|
|
129
132
|
data-inset={inset}
|
|
133
|
+
data-variant={variant}
|
|
130
134
|
className={cn(
|
|
131
|
-
"flex cursor-default items-center gap-
|
|
135
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
132
136
|
className
|
|
133
137
|
)}
|
|
134
|
-
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
disabled={disabled}
|
|
139
|
+
onClick={(event) => {
|
|
140
|
+
if (disabled) {
|
|
141
|
+
event.preventDefault()
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
onClick?.(event)
|
|
145
|
+
}}
|
|
146
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
147
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
148
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
149
|
+
onPointerDown={(event) => {
|
|
150
|
+
if (disabled) {
|
|
151
|
+
event.preventDefault()
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
onPointerDown?.(event)
|
|
155
|
+
}}
|
|
150
156
|
{...props}
|
|
151
157
|
/>
|
|
152
158
|
)
|
|
@@ -156,81 +162,128 @@ function ContextMenuCheckboxItem({
|
|
|
156
162
|
className,
|
|
157
163
|
children,
|
|
158
164
|
checked,
|
|
159
|
-
|
|
165
|
+
disabled,
|
|
166
|
+
onClick,
|
|
167
|
+
onMouseDown,
|
|
168
|
+
onKeyDown,
|
|
169
|
+
onKeyUp,
|
|
170
|
+
onPointerDown,
|
|
160
171
|
...props
|
|
161
|
-
}: ContextMenuPrimitive.CheckboxItem
|
|
162
|
-
inset?: boolean
|
|
163
|
-
}) {
|
|
172
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
|
164
173
|
return (
|
|
165
174
|
<ContextMenuPrimitive.CheckboxItem
|
|
166
175
|
data-slot="context-menu-checkbox-item"
|
|
167
|
-
data-inset={inset}
|
|
168
176
|
className={cn(
|
|
169
|
-
"relative flex cursor-default items-center gap-
|
|
177
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
|
|
170
178
|
className
|
|
171
179
|
)}
|
|
172
180
|
checked={checked}
|
|
181
|
+
disabled={disabled}
|
|
182
|
+
onClick={(event) => {
|
|
183
|
+
if (disabled) {
|
|
184
|
+
event.preventDefault()
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
onClick?.(event)
|
|
188
|
+
}}
|
|
189
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
190
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
191
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
192
|
+
onPointerDown={(event) => {
|
|
193
|
+
if (disabled) {
|
|
194
|
+
event.preventDefault()
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
onPointerDown?.(event)
|
|
198
|
+
}}
|
|
173
199
|
{...props}
|
|
174
200
|
>
|
|
175
|
-
<span className="pointer-events-none absolute
|
|
176
|
-
<ContextMenuPrimitive.
|
|
177
|
-
<CheckIcon
|
|
178
|
-
|
|
179
|
-
</ContextMenuPrimitive.CheckboxItemIndicator>
|
|
201
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
202
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
203
|
+
<CheckIcon className="size-4" />
|
|
204
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
180
205
|
</span>
|
|
181
206
|
{children}
|
|
182
207
|
</ContextMenuPrimitive.CheckboxItem>
|
|
183
208
|
)
|
|
184
209
|
}
|
|
185
210
|
|
|
186
|
-
function
|
|
211
|
+
function ContextMenuRadioItem({
|
|
212
|
+
className,
|
|
213
|
+
children,
|
|
214
|
+
disabled,
|
|
215
|
+
onClick,
|
|
216
|
+
onMouseDown,
|
|
217
|
+
onKeyDown,
|
|
218
|
+
onKeyUp,
|
|
219
|
+
onPointerDown,
|
|
187
220
|
...props
|
|
188
|
-
}: ContextMenuPrimitive.
|
|
221
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
|
189
222
|
return (
|
|
190
|
-
<ContextMenuPrimitive.
|
|
191
|
-
data-slot="context-menu-radio-
|
|
223
|
+
<ContextMenuPrimitive.RadioItem
|
|
224
|
+
data-slot="context-menu-radio-item"
|
|
225
|
+
className={cn(
|
|
226
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
|
|
227
|
+
className
|
|
228
|
+
)}
|
|
229
|
+
disabled={disabled}
|
|
230
|
+
onClick={(event) => {
|
|
231
|
+
if (disabled) {
|
|
232
|
+
event.preventDefault()
|
|
233
|
+
return
|
|
234
|
+
}
|
|
235
|
+
onClick?.(event)
|
|
236
|
+
}}
|
|
237
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
238
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
239
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
240
|
+
onPointerDown={(event) => {
|
|
241
|
+
if (disabled) {
|
|
242
|
+
event.preventDefault()
|
|
243
|
+
return
|
|
244
|
+
}
|
|
245
|
+
onPointerDown?.(event)
|
|
246
|
+
}}
|
|
192
247
|
{...props}
|
|
193
|
-
|
|
248
|
+
>
|
|
249
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
250
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
251
|
+
<CircleIcon className="size-2 fill-current" />
|
|
252
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
253
|
+
</span>
|
|
254
|
+
{children}
|
|
255
|
+
</ContextMenuPrimitive.RadioItem>
|
|
194
256
|
)
|
|
195
257
|
}
|
|
196
258
|
|
|
197
|
-
function
|
|
259
|
+
function ContextMenuLabel({
|
|
198
260
|
className,
|
|
199
|
-
children,
|
|
200
261
|
inset,
|
|
201
262
|
...props
|
|
202
|
-
}: ContextMenuPrimitive.
|
|
263
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
203
264
|
inset?: boolean
|
|
204
265
|
}) {
|
|
205
266
|
return (
|
|
206
|
-
<ContextMenuPrimitive.
|
|
207
|
-
data-slot="context-menu-
|
|
267
|
+
<ContextMenuPrimitive.Label
|
|
268
|
+
data-slot="context-menu-label"
|
|
208
269
|
data-inset={inset}
|
|
209
270
|
className={cn(
|
|
210
|
-
"
|
|
271
|
+
"text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
211
272
|
className
|
|
212
273
|
)}
|
|
213
274
|
{...props}
|
|
214
|
-
|
|
215
|
-
<span className="pointer-events-none absolute right-2">
|
|
216
|
-
<ContextMenuPrimitive.RadioItemIndicator>
|
|
217
|
-
<CheckIcon
|
|
218
|
-
/>
|
|
219
|
-
</ContextMenuPrimitive.RadioItemIndicator>
|
|
220
|
-
</span>
|
|
221
|
-
{children}
|
|
222
|
-
</ContextMenuPrimitive.RadioItem>
|
|
275
|
+
/>
|
|
223
276
|
)
|
|
224
277
|
}
|
|
225
278
|
|
|
226
279
|
function ContextMenuSeparator({
|
|
227
280
|
className,
|
|
228
281
|
...props
|
|
229
|
-
}: ContextMenuPrimitive.Separator
|
|
282
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
|
230
283
|
return (
|
|
231
284
|
<ContextMenuPrimitive.Separator
|
|
232
285
|
data-slot="context-menu-separator"
|
|
233
|
-
className={cn("-mx-1 my-1 h-px
|
|
286
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
234
287
|
{...props}
|
|
235
288
|
/>
|
|
236
289
|
)
|
|
@@ -244,7 +297,7 @@ function ContextMenuShortcut({
|
|
|
244
297
|
<span
|
|
245
298
|
data-slot="context-menu-shortcut"
|
|
246
299
|
className={cn(
|
|
247
|
-
"ml-auto text-xs tracking-widest
|
|
300
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
248
301
|
className
|
|
249
302
|
)}
|
|
250
303
|
{...props}
|