@lark-apaas/coding-templates 0.1.5 → 0.1.7
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 +29 -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
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar"
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
6
6
|
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
8
|
-
import {
|
|
9
|
-
DropdownMenu,
|
|
10
|
-
DropdownMenuContent,
|
|
11
|
-
DropdownMenuGroup,
|
|
12
|
-
DropdownMenuItem,
|
|
13
|
-
DropdownMenuLabel,
|
|
14
|
-
DropdownMenuPortal,
|
|
15
|
-
DropdownMenuRadioGroup,
|
|
16
|
-
DropdownMenuSeparator,
|
|
17
|
-
DropdownMenuShortcut,
|
|
18
|
-
DropdownMenuSub,
|
|
19
|
-
DropdownMenuSubContent,
|
|
20
|
-
DropdownMenuSubTrigger,
|
|
21
|
-
DropdownMenuTrigger,
|
|
22
|
-
} from "@/components/ui/dropdown-menu"
|
|
23
|
-
import { CheckIcon } from "lucide-react"
|
|
24
8
|
|
|
25
|
-
function Menubar({
|
|
9
|
+
function Menubar({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Root>) {
|
|
26
13
|
return (
|
|
27
|
-
<MenubarPrimitive
|
|
14
|
+
<MenubarPrimitive.Root
|
|
28
15
|
data-slot="menubar"
|
|
29
16
|
className={cn(
|
|
30
|
-
"flex h-
|
|
17
|
+
"bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
|
|
31
18
|
className
|
|
32
19
|
)}
|
|
33
20
|
{...props}
|
|
@@ -35,31 +22,41 @@ function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
|
35
22
|
)
|
|
36
23
|
}
|
|
37
24
|
|
|
38
|
-
function MenubarMenu({
|
|
39
|
-
|
|
25
|
+
function MenubarMenu({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
|
|
28
|
+
return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />
|
|
40
29
|
}
|
|
41
30
|
|
|
42
31
|
function MenubarGroup({
|
|
43
32
|
...props
|
|
44
|
-
}: React.ComponentProps<typeof
|
|
45
|
-
return <
|
|
33
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
|
34
|
+
return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />
|
|
46
35
|
}
|
|
47
36
|
|
|
48
37
|
function MenubarPortal({
|
|
49
38
|
...props
|
|
50
|
-
}: React.ComponentProps<typeof
|
|
51
|
-
return <
|
|
39
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
|
40
|
+
return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function MenubarRadioGroup({
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
|
46
|
+
return (
|
|
47
|
+
<MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />
|
|
48
|
+
)
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
function MenubarTrigger({
|
|
55
52
|
className,
|
|
56
53
|
...props
|
|
57
|
-
}: React.ComponentProps<typeof
|
|
54
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
|
|
58
55
|
return (
|
|
59
|
-
<
|
|
56
|
+
<MenubarPrimitive.Trigger
|
|
60
57
|
data-slot="menubar-trigger"
|
|
61
58
|
className={cn(
|
|
62
|
-
"flex items-center rounded-sm px-
|
|
59
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",
|
|
63
60
|
className
|
|
64
61
|
)}
|
|
65
62
|
{...props}
|
|
@@ -73,16 +70,21 @@ function MenubarContent({
|
|
|
73
70
|
alignOffset = -4,
|
|
74
71
|
sideOffset = 8,
|
|
75
72
|
...props
|
|
76
|
-
}: React.ComponentProps<typeof
|
|
73
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Content>) {
|
|
77
74
|
return (
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
<MenubarPortal>
|
|
76
|
+
<MenubarPrimitive.Content
|
|
77
|
+
data-slot="menubar-content"
|
|
78
|
+
align={align}
|
|
79
|
+
alignOffset={alignOffset}
|
|
80
|
+
sideOffset={sideOffset}
|
|
81
|
+
className={cn(
|
|
82
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in 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-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md",
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
</MenubarPortal>
|
|
86
88
|
)
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -90,17 +92,44 @@ function MenubarItem({
|
|
|
90
92
|
className,
|
|
91
93
|
inset,
|
|
92
94
|
variant = "default",
|
|
95
|
+
disabled,
|
|
96
|
+
onClick,
|
|
97
|
+
onMouseDown,
|
|
98
|
+
onKeyDown,
|
|
99
|
+
onKeyUp,
|
|
100
|
+
onPointerDown,
|
|
93
101
|
...props
|
|
94
|
-
}: React.ComponentProps<typeof
|
|
102
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
103
|
+
inset?: boolean
|
|
104
|
+
variant?: "default" | "destructive"
|
|
105
|
+
}) {
|
|
95
106
|
return (
|
|
96
|
-
<
|
|
107
|
+
<MenubarPrimitive.Item
|
|
97
108
|
data-slot="menubar-item"
|
|
98
109
|
data-inset={inset}
|
|
99
110
|
data-variant={variant}
|
|
100
111
|
className={cn(
|
|
101
|
-
"
|
|
112
|
+
"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",
|
|
102
113
|
className
|
|
103
114
|
)}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
onClick={(event) => {
|
|
117
|
+
if (disabled) {
|
|
118
|
+
event.preventDefault()
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
onClick?.(event)
|
|
122
|
+
}}
|
|
123
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
124
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
125
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
126
|
+
onPointerDown={(event) => {
|
|
127
|
+
if (disabled) {
|
|
128
|
+
event.preventDefault()
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
onPointerDown?.(event)
|
|
132
|
+
}}
|
|
104
133
|
{...props}
|
|
105
134
|
/>
|
|
106
135
|
)
|
|
@@ -110,65 +139,97 @@ function MenubarCheckboxItem({
|
|
|
110
139
|
className,
|
|
111
140
|
children,
|
|
112
141
|
checked,
|
|
113
|
-
|
|
142
|
+
disabled,
|
|
143
|
+
onClick,
|
|
144
|
+
onMouseDown,
|
|
145
|
+
onKeyDown,
|
|
146
|
+
onKeyUp,
|
|
147
|
+
onPointerDown,
|
|
114
148
|
...props
|
|
115
|
-
}:
|
|
116
|
-
inset?: boolean
|
|
117
|
-
}) {
|
|
149
|
+
}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {
|
|
118
150
|
return (
|
|
119
|
-
<
|
|
151
|
+
<MenubarPrimitive.CheckboxItem
|
|
120
152
|
data-slot="menubar-checkbox-item"
|
|
121
|
-
data-inset={inset}
|
|
122
153
|
className={cn(
|
|
123
|
-
"relative flex cursor-default items-center gap-
|
|
154
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs 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",
|
|
124
155
|
className
|
|
125
156
|
)}
|
|
126
157
|
checked={checked}
|
|
158
|
+
disabled={disabled}
|
|
159
|
+
onClick={(event) => {
|
|
160
|
+
if (disabled) {
|
|
161
|
+
event.preventDefault()
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
onClick?.(event)
|
|
165
|
+
}}
|
|
166
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
167
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
168
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
169
|
+
onPointerDown={(event) => {
|
|
170
|
+
if (disabled) {
|
|
171
|
+
event.preventDefault()
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
onPointerDown?.(event)
|
|
175
|
+
}}
|
|
127
176
|
{...props}
|
|
128
177
|
>
|
|
129
|
-
<span className="pointer-events-none absolute left-
|
|
130
|
-
<
|
|
131
|
-
<CheckIcon
|
|
132
|
-
|
|
133
|
-
</MenuPrimitive.CheckboxItemIndicator>
|
|
178
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
179
|
+
<MenubarPrimitive.ItemIndicator>
|
|
180
|
+
<CheckIcon className="size-4" />
|
|
181
|
+
</MenubarPrimitive.ItemIndicator>
|
|
134
182
|
</span>
|
|
135
183
|
{children}
|
|
136
|
-
</
|
|
184
|
+
</MenubarPrimitive.CheckboxItem>
|
|
137
185
|
)
|
|
138
186
|
}
|
|
139
187
|
|
|
140
|
-
function MenubarRadioGroup({
|
|
141
|
-
...props
|
|
142
|
-
}: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
|
|
143
|
-
return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />
|
|
144
|
-
}
|
|
145
|
-
|
|
146
188
|
function MenubarRadioItem({
|
|
147
189
|
className,
|
|
148
190
|
children,
|
|
149
|
-
|
|
191
|
+
disabled,
|
|
192
|
+
onClick,
|
|
193
|
+
onMouseDown,
|
|
194
|
+
onKeyDown,
|
|
195
|
+
onKeyUp,
|
|
196
|
+
onPointerDown,
|
|
150
197
|
...props
|
|
151
|
-
}:
|
|
152
|
-
inset?: boolean
|
|
153
|
-
}) {
|
|
198
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {
|
|
154
199
|
return (
|
|
155
|
-
<
|
|
200
|
+
<MenubarPrimitive.RadioItem
|
|
156
201
|
data-slot="menubar-radio-item"
|
|
157
|
-
data-inset={inset}
|
|
158
202
|
className={cn(
|
|
159
|
-
"relative flex cursor-default items-center gap-
|
|
203
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs 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",
|
|
160
204
|
className
|
|
161
205
|
)}
|
|
206
|
+
disabled={disabled}
|
|
207
|
+
onClick={(event) => {
|
|
208
|
+
if (disabled) {
|
|
209
|
+
event.preventDefault()
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
onClick?.(event)
|
|
213
|
+
}}
|
|
214
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
215
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
216
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
217
|
+
onPointerDown={(event) => {
|
|
218
|
+
if (disabled) {
|
|
219
|
+
event.preventDefault()
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
onPointerDown?.(event)
|
|
223
|
+
}}
|
|
162
224
|
{...props}
|
|
163
225
|
>
|
|
164
|
-
<span className="pointer-events-none absolute left-
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
</MenuPrimitive.RadioItemIndicator>
|
|
226
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
227
|
+
<MenubarPrimitive.ItemIndicator>
|
|
228
|
+
<CircleIcon className="size-2 fill-current" />
|
|
229
|
+
</MenubarPrimitive.ItemIndicator>
|
|
169
230
|
</span>
|
|
170
231
|
{children}
|
|
171
|
-
</
|
|
232
|
+
</MenubarPrimitive.RadioItem>
|
|
172
233
|
)
|
|
173
234
|
}
|
|
174
235
|
|
|
@@ -176,15 +237,15 @@ function MenubarLabel({
|
|
|
176
237
|
className,
|
|
177
238
|
inset,
|
|
178
239
|
...props
|
|
179
|
-
}: React.ComponentProps<typeof
|
|
240
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Label> & {
|
|
180
241
|
inset?: boolean
|
|
181
242
|
}) {
|
|
182
243
|
return (
|
|
183
|
-
<
|
|
244
|
+
<MenubarPrimitive.Label
|
|
184
245
|
data-slot="menubar-label"
|
|
185
246
|
data-inset={inset}
|
|
186
247
|
className={cn(
|
|
187
|
-
"px-
|
|
248
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
188
249
|
className
|
|
189
250
|
)}
|
|
190
251
|
{...props}
|
|
@@ -195,11 +256,11 @@ function MenubarLabel({
|
|
|
195
256
|
function MenubarSeparator({
|
|
196
257
|
className,
|
|
197
258
|
...props
|
|
198
|
-
}: React.ComponentProps<typeof
|
|
259
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
|
|
199
260
|
return (
|
|
200
|
-
<
|
|
261
|
+
<MenubarPrimitive.Separator
|
|
201
262
|
data-slot="menubar-separator"
|
|
202
|
-
className={cn("-mx-1 my-1 h-px
|
|
263
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
203
264
|
{...props}
|
|
204
265
|
/>
|
|
205
266
|
)
|
|
@@ -208,12 +269,12 @@ function MenubarSeparator({
|
|
|
208
269
|
function MenubarShortcut({
|
|
209
270
|
className,
|
|
210
271
|
...props
|
|
211
|
-
}: React.ComponentProps<
|
|
272
|
+
}: React.ComponentProps<"span">) {
|
|
212
273
|
return (
|
|
213
|
-
<
|
|
274
|
+
<span
|
|
214
275
|
data-slot="menubar-shortcut"
|
|
215
276
|
className={cn(
|
|
216
|
-
"ml-auto text-xs tracking-widest
|
|
277
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
217
278
|
className
|
|
218
279
|
)}
|
|
219
280
|
{...props}
|
|
@@ -223,38 +284,45 @@ function MenubarShortcut({
|
|
|
223
284
|
|
|
224
285
|
function MenubarSub({
|
|
225
286
|
...props
|
|
226
|
-
}: React.ComponentProps<typeof
|
|
227
|
-
return <
|
|
287
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
|
|
288
|
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
|
|
228
289
|
}
|
|
229
290
|
|
|
230
291
|
function MenubarSubTrigger({
|
|
231
292
|
className,
|
|
232
293
|
inset,
|
|
294
|
+
children,
|
|
233
295
|
...props
|
|
234
|
-
}: React.ComponentProps<typeof
|
|
296
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
|
|
235
297
|
inset?: boolean
|
|
236
298
|
}) {
|
|
237
299
|
return (
|
|
238
|
-
<
|
|
300
|
+
<MenubarPrimitive.SubTrigger
|
|
239
301
|
data-slot="menubar-sub-trigger"
|
|
240
302
|
data-inset={inset}
|
|
241
303
|
className={cn(
|
|
242
|
-
"
|
|
304
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8",
|
|
243
305
|
className
|
|
244
306
|
)}
|
|
245
307
|
{...props}
|
|
246
|
-
|
|
308
|
+
>
|
|
309
|
+
{children}
|
|
310
|
+
<ChevronRightIcon className="ml-auto h-4 w-4" />
|
|
311
|
+
</MenubarPrimitive.SubTrigger>
|
|
247
312
|
)
|
|
248
313
|
}
|
|
249
314
|
|
|
250
315
|
function MenubarSubContent({
|
|
251
316
|
className,
|
|
252
317
|
...props
|
|
253
|
-
}: React.ComponentProps<typeof
|
|
318
|
+
}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
|
|
254
319
|
return (
|
|
255
|
-
<
|
|
320
|
+
<MenubarPrimitive.SubContent
|
|
256
321
|
data-slot="menubar-sub-content"
|
|
257
|
-
className={cn(
|
|
322
|
+
className={cn(
|
|
323
|
+
"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-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
324
|
+
className
|
|
325
|
+
)}
|
|
258
326
|
{...props}
|
|
259
327
|
/>
|
|
260
328
|
)
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
|
|
2
3
|
import { cva } from "class-variance-authority"
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
3
5
|
|
|
4
6
|
import { cn } from "@/lib/utils"
|
|
5
|
-
import { ChevronDownIcon } from "lucide-react"
|
|
6
7
|
|
|
7
8
|
function NavigationMenu({
|
|
8
|
-
align = "start",
|
|
9
9
|
className,
|
|
10
10
|
children,
|
|
11
|
+
viewport = true,
|
|
11
12
|
...props
|
|
12
|
-
}: NavigationMenuPrimitive.Root
|
|
13
|
-
|
|
13
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
|
|
14
|
+
viewport?: boolean
|
|
15
|
+
}) {
|
|
14
16
|
return (
|
|
15
17
|
<NavigationMenuPrimitive.Root
|
|
16
18
|
data-slot="navigation-menu"
|
|
19
|
+
data-viewport={viewport}
|
|
17
20
|
className={cn(
|
|
18
21
|
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
19
22
|
className
|
|
@@ -21,7 +24,7 @@ function NavigationMenu({
|
|
|
21
24
|
{...props}
|
|
22
25
|
>
|
|
23
26
|
{children}
|
|
24
|
-
<
|
|
27
|
+
{viewport && <NavigationMenuViewport />}
|
|
25
28
|
</NavigationMenuPrimitive.Root>
|
|
26
29
|
)
|
|
27
30
|
}
|
|
@@ -29,12 +32,12 @@ function NavigationMenu({
|
|
|
29
32
|
function NavigationMenuList({
|
|
30
33
|
className,
|
|
31
34
|
...props
|
|
32
|
-
}: React.
|
|
35
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
|
|
33
36
|
return (
|
|
34
37
|
<NavigationMenuPrimitive.List
|
|
35
38
|
data-slot="navigation-menu-list"
|
|
36
39
|
className={cn(
|
|
37
|
-
"group flex flex-1 list-none items-center justify-center gap-
|
|
40
|
+
"group flex flex-1 list-none items-center justify-center gap-1",
|
|
38
41
|
className
|
|
39
42
|
)}
|
|
40
43
|
{...props}
|
|
@@ -45,7 +48,7 @@ function NavigationMenuList({
|
|
|
45
48
|
function NavigationMenuItem({
|
|
46
49
|
className,
|
|
47
50
|
...props
|
|
48
|
-
}: React.
|
|
51
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
|
|
49
52
|
return (
|
|
50
53
|
<NavigationMenuPrimitive.Item
|
|
51
54
|
data-slot="navigation-menu-item"
|
|
@@ -56,14 +59,14 @@ function NavigationMenuItem({
|
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
const navigationMenuTriggerStyle = cva(
|
|
59
|
-
"group
|
|
62
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium enabled:hover:bg-accent enabled:hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 enabled:data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/20 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
|
|
60
63
|
)
|
|
61
64
|
|
|
62
65
|
function NavigationMenuTrigger({
|
|
63
66
|
className,
|
|
64
67
|
children,
|
|
65
68
|
...props
|
|
66
|
-
}: NavigationMenuPrimitive.Trigger
|
|
69
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
|
|
67
70
|
return (
|
|
68
71
|
<NavigationMenuPrimitive.Trigger
|
|
69
72
|
data-slot="navigation-menu-trigger"
|
|
@@ -71,7 +74,10 @@ function NavigationMenuTrigger({
|
|
|
71
74
|
{...props}
|
|
72
75
|
>
|
|
73
76
|
{children}{" "}
|
|
74
|
-
<ChevronDownIcon
|
|
77
|
+
<ChevronDownIcon
|
|
78
|
+
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
/>
|
|
75
81
|
</NavigationMenuPrimitive.Trigger>
|
|
76
82
|
)
|
|
77
83
|
}
|
|
@@ -79,12 +85,13 @@ function NavigationMenuTrigger({
|
|
|
79
85
|
function NavigationMenuContent({
|
|
80
86
|
className,
|
|
81
87
|
...props
|
|
82
|
-
}: NavigationMenuPrimitive.Content
|
|
88
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
|
|
83
89
|
return (
|
|
84
90
|
<NavigationMenuPrimitive.Content
|
|
85
91
|
data-slot="navigation-menu-content"
|
|
86
92
|
className={cn(
|
|
87
|
-
"data-
|
|
93
|
+
"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto",
|
|
94
|
+
"group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
|
|
88
95
|
className
|
|
89
96
|
)}
|
|
90
97
|
{...props}
|
|
@@ -92,44 +99,37 @@ function NavigationMenuContent({
|
|
|
92
99
|
)
|
|
93
100
|
}
|
|
94
101
|
|
|
95
|
-
function
|
|
102
|
+
function NavigationMenuViewport({
|
|
96
103
|
className,
|
|
97
|
-
side = "bottom",
|
|
98
|
-
sideOffset = 8,
|
|
99
|
-
align = "start",
|
|
100
|
-
alignOffset = 0,
|
|
101
104
|
...props
|
|
102
|
-
}: NavigationMenuPrimitive.
|
|
105
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
|
|
103
106
|
return (
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
<div
|
|
108
|
+
className={cn(
|
|
109
|
+
"absolute top-full left-0 isolate z-50 flex justify-center"
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
<NavigationMenuPrimitive.Viewport
|
|
113
|
+
data-slot="navigation-menu-viewport"
|
|
110
114
|
className={cn(
|
|
111
|
-
"
|
|
115
|
+
"origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",
|
|
112
116
|
className
|
|
113
117
|
)}
|
|
114
118
|
{...props}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
|
|
118
|
-
</NavigationMenuPrimitive.Popup>
|
|
119
|
-
</NavigationMenuPrimitive.Positioner>
|
|
120
|
-
</NavigationMenuPrimitive.Portal>
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
121
|
)
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function NavigationMenuLink({
|
|
125
125
|
className,
|
|
126
126
|
...props
|
|
127
|
-
}: NavigationMenuPrimitive.Link
|
|
127
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
|
|
128
128
|
return (
|
|
129
129
|
<NavigationMenuPrimitive.Link
|
|
130
130
|
data-slot="navigation-menu-link"
|
|
131
131
|
className={cn(
|
|
132
|
-
"
|
|
132
|
+
"data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/20 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
|
|
133
133
|
className
|
|
134
134
|
)}
|
|
135
135
|
{...props}
|
|
@@ -140,29 +140,29 @@ function NavigationMenuLink({
|
|
|
140
140
|
function NavigationMenuIndicator({
|
|
141
141
|
className,
|
|
142
142
|
...props
|
|
143
|
-
}: React.
|
|
143
|
+
}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
|
|
144
144
|
return (
|
|
145
|
-
<NavigationMenuPrimitive.
|
|
145
|
+
<NavigationMenuPrimitive.Indicator
|
|
146
146
|
data-slot="navigation-menu-indicator"
|
|
147
147
|
className={cn(
|
|
148
|
-
"
|
|
148
|
+
"data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
|
|
149
149
|
className
|
|
150
150
|
)}
|
|
151
151
|
{...props}
|
|
152
152
|
>
|
|
153
|
-
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm
|
|
154
|
-
</NavigationMenuPrimitive.
|
|
153
|
+
<div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
|
|
154
|
+
</NavigationMenuPrimitive.Indicator>
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export {
|
|
159
159
|
NavigationMenu,
|
|
160
|
-
NavigationMenuContent,
|
|
161
|
-
NavigationMenuIndicator,
|
|
162
|
-
NavigationMenuItem,
|
|
163
|
-
NavigationMenuLink,
|
|
164
160
|
NavigationMenuList,
|
|
161
|
+
NavigationMenuItem,
|
|
162
|
+
NavigationMenuContent,
|
|
165
163
|
NavigationMenuTrigger,
|
|
164
|
+
NavigationMenuLink,
|
|
165
|
+
NavigationMenuIndicator,
|
|
166
|
+
NavigationMenuViewport,
|
|
166
167
|
navigationMenuTriggerStyle,
|
|
167
|
-
NavigationMenuPositioner,
|
|
168
168
|
}
|