@lark-apaas/coding-templates 0.1.4 → 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/app.tsx +3 -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/client/src/pages/home/index.tsx +5 -5
- 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/vite.config.ts +5 -0
- 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
|
@@ -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}
|
|
@@ -1,35 +1,44 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
|
-
import
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
3
6
|
|
|
4
7
|
import { cn } from "@/lib/utils"
|
|
5
|
-
import { Button } from "@/components/ui/button"
|
|
6
|
-
import { XIcon } from "lucide-react"
|
|
7
8
|
|
|
8
|
-
function Dialog({
|
|
9
|
+
function Dialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
9
12
|
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
function DialogTrigger({
|
|
15
|
+
function DialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
13
18
|
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
function DialogPortal({
|
|
21
|
+
function DialogPortal({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
17
24
|
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
function DialogClose({
|
|
27
|
+
function DialogClose({
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
21
30
|
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
function DialogOverlay({
|
|
25
34
|
className,
|
|
26
35
|
...props
|
|
27
|
-
}: DialogPrimitive.
|
|
36
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
28
37
|
return (
|
|
29
|
-
<DialogPrimitive.
|
|
38
|
+
<DialogPrimitive.Overlay
|
|
30
39
|
data-slot="dialog-overlay"
|
|
31
40
|
className={cn(
|
|
32
|
-
"
|
|
41
|
+
"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",
|
|
33
42
|
className
|
|
34
43
|
)}
|
|
35
44
|
{...props}
|
|
@@ -42,16 +51,16 @@ function DialogContent({
|
|
|
42
51
|
children,
|
|
43
52
|
showCloseButton = true,
|
|
44
53
|
...props
|
|
45
|
-
}: DialogPrimitive.
|
|
54
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
46
55
|
showCloseButton?: boolean
|
|
47
56
|
}) {
|
|
48
57
|
return (
|
|
49
|
-
<DialogPortal>
|
|
58
|
+
<DialogPortal data-slot="dialog-portal">
|
|
50
59
|
<DialogOverlay />
|
|
51
|
-
<DialogPrimitive.
|
|
60
|
+
<DialogPrimitive.Content
|
|
52
61
|
data-slot="dialog-content"
|
|
53
62
|
className={cn(
|
|
54
|
-
"fixed top-
|
|
63
|
+
"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",
|
|
55
64
|
className
|
|
56
65
|
)}
|
|
57
66
|
{...props}
|
|
@@ -60,20 +69,13 @@ function DialogContent({
|
|
|
60
69
|
{showCloseButton && (
|
|
61
70
|
<DialogPrimitive.Close
|
|
62
71
|
data-slot="dialog-close"
|
|
63
|
-
|
|
64
|
-
<Button
|
|
65
|
-
variant="ghost"
|
|
66
|
-
className="absolute top-2 right-2"
|
|
67
|
-
size="icon-sm"
|
|
68
|
-
/>
|
|
69
|
-
}
|
|
72
|
+
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
70
73
|
>
|
|
71
|
-
<XIcon
|
|
72
|
-
/>
|
|
74
|
+
<XIcon />
|
|
73
75
|
<span className="sr-only">Close</span>
|
|
74
76
|
</DialogPrimitive.Close>
|
|
75
77
|
)}
|
|
76
|
-
</DialogPrimitive.
|
|
78
|
+
</DialogPrimitive.Content>
|
|
77
79
|
</DialogPortal>
|
|
78
80
|
)
|
|
79
81
|
}
|
|
@@ -82,47 +84,33 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
82
84
|
return (
|
|
83
85
|
<div
|
|
84
86
|
data-slot="dialog-header"
|
|
85
|
-
className={cn("flex flex-col gap-2", className)}
|
|
87
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
86
88
|
{...props}
|
|
87
89
|
/>
|
|
88
90
|
)
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
function DialogFooter({
|
|
92
|
-
className,
|
|
93
|
-
showCloseButton = false,
|
|
94
|
-
children,
|
|
95
|
-
...props
|
|
96
|
-
}: React.ComponentProps<"div"> & {
|
|
97
|
-
showCloseButton?: boolean
|
|
98
|
-
}) {
|
|
93
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
99
94
|
return (
|
|
100
95
|
<div
|
|
101
96
|
data-slot="dialog-footer"
|
|
102
97
|
className={cn(
|
|
103
|
-
"
|
|
98
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
104
99
|
className
|
|
105
100
|
)}
|
|
106
101
|
{...props}
|
|
107
|
-
|
|
108
|
-
{children}
|
|
109
|
-
{showCloseButton && (
|
|
110
|
-
<DialogPrimitive.Close render={<Button variant="outline" />}>
|
|
111
|
-
Close
|
|
112
|
-
</DialogPrimitive.Close>
|
|
113
|
-
)}
|
|
114
|
-
</div>
|
|
102
|
+
/>
|
|
115
103
|
)
|
|
116
104
|
}
|
|
117
105
|
|
|
118
|
-
function DialogTitle({
|
|
106
|
+
function DialogTitle({
|
|
107
|
+
className,
|
|
108
|
+
...props
|
|
109
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
119
110
|
return (
|
|
120
111
|
<DialogPrimitive.Title
|
|
121
112
|
data-slot="dialog-title"
|
|
122
|
-
className={cn(
|
|
123
|
-
"text-base leading-none font-medium",
|
|
124
|
-
className
|
|
125
|
-
)}
|
|
113
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
126
114
|
{...props}
|
|
127
115
|
/>
|
|
128
116
|
)
|
|
@@ -131,14 +119,11 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
|
131
119
|
function DialogDescription({
|
|
132
120
|
className,
|
|
133
121
|
...props
|
|
134
|
-
}: DialogPrimitive.Description
|
|
122
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
135
123
|
return (
|
|
136
124
|
<DialogPrimitive.Description
|
|
137
125
|
data-slot="dialog-description"
|
|
138
|
-
className={cn(
|
|
139
|
-
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
140
|
-
className
|
|
141
|
-
)}
|
|
126
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
142
127
|
{...props}
|
|
143
128
|
/>
|
|
144
129
|
)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
4
|
import { Drawer as DrawerPrimitive } from "vaul"
|
|
3
5
|
|
|
@@ -35,7 +37,7 @@ function DrawerOverlay({
|
|
|
35
37
|
<DrawerPrimitive.Overlay
|
|
36
38
|
data-slot="drawer-overlay"
|
|
37
39
|
className={cn(
|
|
38
|
-
"
|
|
40
|
+
"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",
|
|
39
41
|
className
|
|
40
42
|
)}
|
|
41
43
|
{...props}
|
|
@@ -54,12 +56,16 @@ function DrawerContent({
|
|
|
54
56
|
<DrawerPrimitive.Content
|
|
55
57
|
data-slot="drawer-content"
|
|
56
58
|
className={cn(
|
|
57
|
-
"group/drawer-content fixed z-50 flex h-auto flex-col
|
|
59
|
+
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
60
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
61
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
62
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
63
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
58
64
|
className
|
|
59
65
|
)}
|
|
60
66
|
{...props}
|
|
61
67
|
>
|
|
62
|
-
<div className="mx-auto mt-4 hidden h-
|
|
68
|
+
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
63
69
|
{children}
|
|
64
70
|
</DrawerPrimitive.Content>
|
|
65
71
|
</DrawerPortal>
|
|
@@ -71,7 +77,7 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
71
77
|
<div
|
|
72
78
|
data-slot="drawer-header"
|
|
73
79
|
className={cn(
|
|
74
|
-
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-
|
|
80
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
75
81
|
className
|
|
76
82
|
)}
|
|
77
83
|
{...props}
|
|
@@ -96,10 +102,7 @@ function DrawerTitle({
|
|
|
96
102
|
return (
|
|
97
103
|
<DrawerPrimitive.Title
|
|
98
104
|
data-slot="drawer-title"
|
|
99
|
-
className={cn(
|
|
100
|
-
"text-base font-medium text-foreground",
|
|
101
|
-
className
|
|
102
|
-
)}
|
|
105
|
+
className={cn("text-foreground font-semibold", className)}
|
|
103
106
|
{...props}
|
|
104
107
|
/>
|
|
105
108
|
)
|
|
@@ -112,7 +115,7 @@ function DrawerDescription({
|
|
|
112
115
|
return (
|
|
113
116
|
<DrawerPrimitive.Description
|
|
114
117
|
data-slot="drawer-description"
|
|
115
|
-
className={cn("text-
|
|
118
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
116
119
|
{...props}
|
|
117
120
|
/>
|
|
118
121
|
)
|