@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
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
|
-
import {
|
|
3
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
4
5
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
+
import { PanelLeftIcon } from "lucide-react"
|
|
5
7
|
|
|
6
|
-
import { useIsMobile } from "@/hooks/use-mobile"
|
|
7
8
|
import { cn } from "@/lib/utils"
|
|
9
|
+
import { useIsMobile } from "@/hooks/use-mobile"
|
|
8
10
|
import { Button } from "@/components/ui/button"
|
|
9
11
|
import { Input } from "@/components/ui/input"
|
|
10
12
|
import { Separator } from "@/components/ui/separator"
|
|
@@ -19,9 +21,9 @@ import { Skeleton } from "@/components/ui/skeleton"
|
|
|
19
21
|
import {
|
|
20
22
|
Tooltip,
|
|
21
23
|
TooltipContent,
|
|
24
|
+
TooltipProvider,
|
|
22
25
|
TooltipTrigger,
|
|
23
26
|
} from "@/components/ui/tooltip"
|
|
24
|
-
import { PanelLeftIcon } from "lucide-react"
|
|
25
27
|
|
|
26
28
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
27
29
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
@@ -126,23 +128,25 @@ function SidebarProvider({
|
|
|
126
128
|
|
|
127
129
|
return (
|
|
128
130
|
<SidebarContext.Provider value={contextValue}>
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
<TooltipProvider delayDuration={0}>
|
|
132
|
+
<div
|
|
133
|
+
data-slot="sidebar-wrapper"
|
|
134
|
+
style={
|
|
135
|
+
{
|
|
136
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
137
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
138
|
+
...style,
|
|
139
|
+
} as React.CSSProperties
|
|
140
|
+
}
|
|
141
|
+
className={cn(
|
|
142
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
143
|
+
className
|
|
144
|
+
)}
|
|
145
|
+
{...props}
|
|
146
|
+
>
|
|
147
|
+
{children}
|
|
148
|
+
</div>
|
|
149
|
+
</TooltipProvider>
|
|
146
150
|
</SidebarContext.Provider>
|
|
147
151
|
)
|
|
148
152
|
}
|
|
@@ -153,7 +157,6 @@ function Sidebar({
|
|
|
153
157
|
collapsible = "offcanvas",
|
|
154
158
|
className,
|
|
155
159
|
children,
|
|
156
|
-
dir,
|
|
157
160
|
...props
|
|
158
161
|
}: React.ComponentProps<"div"> & {
|
|
159
162
|
side?: "left" | "right"
|
|
@@ -167,7 +170,7 @@ function Sidebar({
|
|
|
167
170
|
<div
|
|
168
171
|
data-slot="sidebar"
|
|
169
172
|
className={cn(
|
|
170
|
-
"flex h-full w-(--sidebar-width) flex-col
|
|
173
|
+
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
171
174
|
className
|
|
172
175
|
)}
|
|
173
176
|
{...props}
|
|
@@ -181,11 +184,10 @@ function Sidebar({
|
|
|
181
184
|
return (
|
|
182
185
|
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
183
186
|
<SheetContent
|
|
184
|
-
dir={dir}
|
|
185
187
|
data-sidebar="sidebar"
|
|
186
188
|
data-slot="sidebar"
|
|
187
189
|
data-mobile="true"
|
|
188
|
-
className="w-(--sidebar-width)
|
|
190
|
+
className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
|
|
189
191
|
style={
|
|
190
192
|
{
|
|
191
193
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
@@ -205,7 +207,7 @@ function Sidebar({
|
|
|
205
207
|
|
|
206
208
|
return (
|
|
207
209
|
<div
|
|
208
|
-
className="group peer
|
|
210
|
+
className="group peer text-sidebar-foreground hidden md:block"
|
|
209
211
|
data-state={state}
|
|
210
212
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
211
213
|
data-variant={variant}
|
|
@@ -226,9 +228,11 @@ function Sidebar({
|
|
|
226
228
|
/>
|
|
227
229
|
<div
|
|
228
230
|
data-slot="sidebar-container"
|
|
229
|
-
data-side={side}
|
|
230
231
|
className={cn(
|
|
231
|
-
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear
|
|
232
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
233
|
+
side === "left"
|
|
234
|
+
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
235
|
+
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
232
236
|
// Adjust the padding for floating and inset variants.
|
|
233
237
|
variant === "floating" || variant === "inset"
|
|
234
238
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
@@ -240,7 +244,7 @@ function Sidebar({
|
|
|
240
244
|
<div
|
|
241
245
|
data-sidebar="sidebar"
|
|
242
246
|
data-slot="sidebar-inner"
|
|
243
|
-
className="
|
|
247
|
+
className="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
|
|
244
248
|
>
|
|
245
249
|
{children}
|
|
246
250
|
</div>
|
|
@@ -261,8 +265,8 @@ function SidebarTrigger({
|
|
|
261
265
|
data-sidebar="trigger"
|
|
262
266
|
data-slot="sidebar-trigger"
|
|
263
267
|
variant="ghost"
|
|
264
|
-
size="icon
|
|
265
|
-
className={cn(className)}
|
|
268
|
+
size="icon"
|
|
269
|
+
className={cn("size-7", className)}
|
|
266
270
|
onClick={(event) => {
|
|
267
271
|
onClick?.(event)
|
|
268
272
|
toggleSidebar()
|
|
@@ -287,10 +291,10 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
|
287
291
|
onClick={toggleSidebar}
|
|
288
292
|
title="Toggle Sidebar"
|
|
289
293
|
className={cn(
|
|
290
|
-
"absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:
|
|
294
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
|
|
291
295
|
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
292
296
|
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
293
|
-
"group-data-[collapsible=offcanvas]:
|
|
297
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
294
298
|
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
295
299
|
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
296
300
|
className
|
|
@@ -305,7 +309,8 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
|
|
|
305
309
|
<main
|
|
306
310
|
data-slot="sidebar-inset"
|
|
307
311
|
className={cn(
|
|
308
|
-
"relative flex w-full flex-1 flex-col
|
|
312
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
313
|
+
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
309
314
|
className
|
|
310
315
|
)}
|
|
311
316
|
{...props}
|
|
@@ -321,7 +326,7 @@ function SidebarInput({
|
|
|
321
326
|
<Input
|
|
322
327
|
data-slot="sidebar-input"
|
|
323
328
|
data-sidebar="input"
|
|
324
|
-
className={cn("h-8 w-full
|
|
329
|
+
className={cn("bg-background h-8 w-full shadow-none", className)}
|
|
325
330
|
{...props}
|
|
326
331
|
/>
|
|
327
332
|
)
|
|
@@ -357,7 +362,7 @@ function SidebarSeparator({
|
|
|
357
362
|
<Separator
|
|
358
363
|
data-slot="sidebar-separator"
|
|
359
364
|
data-sidebar="separator"
|
|
360
|
-
className={cn("mx-2 w-auto
|
|
365
|
+
className={cn("bg-sidebar-border mx-2 w-auto", className)}
|
|
361
366
|
{...props}
|
|
362
367
|
/>
|
|
363
368
|
)
|
|
@@ -369,7 +374,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
369
374
|
data-slot="sidebar-content"
|
|
370
375
|
data-sidebar="content"
|
|
371
376
|
className={cn(
|
|
372
|
-
"
|
|
377
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
373
378
|
className
|
|
374
379
|
)}
|
|
375
380
|
{...props}
|
|
@@ -390,50 +395,46 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
390
395
|
|
|
391
396
|
function SidebarGroupLabel({
|
|
392
397
|
className,
|
|
393
|
-
|
|
398
|
+
asChild = false,
|
|
394
399
|
...props
|
|
395
|
-
}:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
sidebar: "group-label",
|
|
411
|
-
},
|
|
412
|
-
})
|
|
400
|
+
}: React.ComponentProps<"div"> & { asChild?: boolean }) {
|
|
401
|
+
const Comp = asChild ? Slot : "div"
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<Comp
|
|
405
|
+
data-slot="sidebar-group-label"
|
|
406
|
+
data-sidebar="group-label"
|
|
407
|
+
className={cn(
|
|
408
|
+
"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
409
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
410
|
+
className
|
|
411
|
+
)}
|
|
412
|
+
{...props}
|
|
413
|
+
/>
|
|
414
|
+
)
|
|
413
415
|
}
|
|
414
416
|
|
|
415
417
|
function SidebarGroupAction({
|
|
416
418
|
className,
|
|
417
|
-
|
|
419
|
+
asChild = false,
|
|
418
420
|
...props
|
|
419
|
-
}:
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
})
|
|
421
|
+
}: React.ComponentProps<"button"> & { asChild?: boolean }) {
|
|
422
|
+
const Comp = asChild ? Slot : "button"
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<Comp
|
|
426
|
+
data-slot="sidebar-group-action"
|
|
427
|
+
data-sidebar="group-action"
|
|
428
|
+
className={cn(
|
|
429
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
430
|
+
// Increases the hit area of the button on mobile.
|
|
431
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
432
|
+
"group-data-[collapsible=icon]:hidden",
|
|
433
|
+
className
|
|
434
|
+
)}
|
|
435
|
+
{...props}
|
|
436
|
+
/>
|
|
437
|
+
)
|
|
437
438
|
}
|
|
438
439
|
|
|
439
440
|
function SidebarGroupContent({
|
|
@@ -455,7 +456,7 @@ function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
|
|
|
455
456
|
<ul
|
|
456
457
|
data-slot="sidebar-menu"
|
|
457
458
|
data-sidebar="menu"
|
|
458
|
-
className={cn("flex w-full min-w-0 flex-col gap-
|
|
459
|
+
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
459
460
|
{...props}
|
|
460
461
|
/>
|
|
461
462
|
)
|
|
@@ -473,13 +474,14 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
const sidebarMenuButtonVariants = cva(
|
|
476
|
-
"peer/menu-button
|
|
477
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] not-disabled:hover:bg-sidebar-accent not-disabled:hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground not-disabled:data-[state=open]:hover:bg-sidebar-accent not-disabled:data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
477
478
|
{
|
|
478
479
|
variants: {
|
|
479
480
|
variant: {
|
|
480
|
-
default:
|
|
481
|
+
default:
|
|
482
|
+
"not-disabled:hover:bg-sidebar-accent not-disabled:hover:text-sidebar-accent-foreground",
|
|
481
483
|
outline:
|
|
482
|
-
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
484
|
+
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] not-disabled:hover:bg-sidebar-accent not-disabled:hover:text-sidebar-accent-foreground not-disabled:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
483
485
|
},
|
|
484
486
|
size: {
|
|
485
487
|
default: "h-8 text-sm",
|
|
@@ -495,38 +497,34 @@ const sidebarMenuButtonVariants = cva(
|
|
|
495
497
|
)
|
|
496
498
|
|
|
497
499
|
function SidebarMenuButton({
|
|
498
|
-
|
|
500
|
+
asChild = false,
|
|
499
501
|
isActive = false,
|
|
500
502
|
variant = "default",
|
|
501
503
|
size = "default",
|
|
502
504
|
tooltip,
|
|
503
505
|
className,
|
|
504
506
|
...props
|
|
505
|
-
}:
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
507
|
+
}: React.ComponentProps<"button"> & {
|
|
508
|
+
asChild?: boolean
|
|
509
|
+
isActive?: boolean
|
|
510
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
511
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
512
|
+
const Comp = asChild ? Slot : "button"
|
|
510
513
|
const { isMobile, state } = useSidebar()
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
sidebar: "menu-button",
|
|
523
|
-
size,
|
|
524
|
-
active: isActive,
|
|
525
|
-
},
|
|
526
|
-
})
|
|
514
|
+
|
|
515
|
+
const button = (
|
|
516
|
+
<Comp
|
|
517
|
+
data-slot="sidebar-menu-button"
|
|
518
|
+
data-sidebar="menu-button"
|
|
519
|
+
data-size={size}
|
|
520
|
+
data-active={isActive}
|
|
521
|
+
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
522
|
+
{...props}
|
|
523
|
+
/>
|
|
524
|
+
)
|
|
527
525
|
|
|
528
526
|
if (!tooltip) {
|
|
529
|
-
return
|
|
527
|
+
return button
|
|
530
528
|
}
|
|
531
529
|
|
|
532
530
|
if (typeof tooltip === "string") {
|
|
@@ -537,7 +535,7 @@ function SidebarMenuButton({
|
|
|
537
535
|
|
|
538
536
|
return (
|
|
539
537
|
<Tooltip>
|
|
540
|
-
{
|
|
538
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
541
539
|
<TooltipContent
|
|
542
540
|
side="right"
|
|
543
541
|
align="center"
|
|
@@ -550,32 +548,34 @@ function SidebarMenuButton({
|
|
|
550
548
|
|
|
551
549
|
function SidebarMenuAction({
|
|
552
550
|
className,
|
|
553
|
-
|
|
551
|
+
asChild = false,
|
|
554
552
|
showOnHover = false,
|
|
555
553
|
...props
|
|
556
|
-
}:
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
554
|
+
}: React.ComponentProps<"button"> & {
|
|
555
|
+
asChild?: boolean
|
|
556
|
+
showOnHover?: boolean
|
|
557
|
+
}) {
|
|
558
|
+
const Comp = asChild ? Slot : "button"
|
|
559
|
+
|
|
560
|
+
return (
|
|
561
|
+
<Comp
|
|
562
|
+
data-slot="sidebar-menu-action"
|
|
563
|
+
data-sidebar="menu-action"
|
|
564
|
+
className={cn(
|
|
565
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
566
|
+
// Increases the hit area of the button on mobile.
|
|
567
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
568
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
569
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
570
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
571
|
+
"group-data-[collapsible=icon]:hidden",
|
|
572
|
+
showOnHover &&
|
|
573
|
+
"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
574
|
+
className
|
|
575
|
+
)}
|
|
576
|
+
{...props}
|
|
577
|
+
/>
|
|
578
|
+
)
|
|
579
579
|
}
|
|
580
580
|
|
|
581
581
|
function SidebarMenuBadge({
|
|
@@ -587,7 +587,12 @@ function SidebarMenuBadge({
|
|
|
587
587
|
data-slot="sidebar-menu-badge"
|
|
588
588
|
data-sidebar="menu-badge"
|
|
589
589
|
className={cn(
|
|
590
|
-
"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium
|
|
590
|
+
"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
|
|
591
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
592
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
593
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
594
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
595
|
+
"group-data-[collapsible=icon]:hidden",
|
|
591
596
|
className
|
|
592
597
|
)}
|
|
593
598
|
{...props}
|
|
@@ -603,9 +608,9 @@ function SidebarMenuSkeleton({
|
|
|
603
608
|
showIcon?: boolean
|
|
604
609
|
}) {
|
|
605
610
|
// Random width between 50 to 90%.
|
|
606
|
-
const
|
|
611
|
+
const width = React.useMemo(() => {
|
|
607
612
|
return `${Math.floor(Math.random() * 40) + 50}%`
|
|
608
|
-
})
|
|
613
|
+
}, [])
|
|
609
614
|
|
|
610
615
|
return (
|
|
611
616
|
<div
|
|
@@ -639,7 +644,8 @@ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
|
|
|
639
644
|
data-slot="sidebar-menu-sub"
|
|
640
645
|
data-sidebar="menu-sub"
|
|
641
646
|
className={cn(
|
|
642
|
-
"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l
|
|
647
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
|
|
648
|
+
"group-data-[collapsible=icon]:hidden",
|
|
643
649
|
className
|
|
644
650
|
)}
|
|
645
651
|
{...props}
|
|
@@ -662,35 +668,35 @@ function SidebarMenuSubItem({
|
|
|
662
668
|
}
|
|
663
669
|
|
|
664
670
|
function SidebarMenuSubButton({
|
|
665
|
-
|
|
671
|
+
asChild = false,
|
|
666
672
|
size = "md",
|
|
667
673
|
isActive = false,
|
|
668
674
|
className,
|
|
669
675
|
...props
|
|
670
|
-
}:
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
676
|
+
}: React.ComponentProps<"a"> & {
|
|
677
|
+
asChild?: boolean
|
|
678
|
+
size?: "sm" | "md"
|
|
679
|
+
isActive?: boolean
|
|
680
|
+
}) {
|
|
681
|
+
const Comp = asChild ? Slot : "a"
|
|
682
|
+
|
|
683
|
+
return (
|
|
684
|
+
<Comp
|
|
685
|
+
data-slot="sidebar-menu-sub-button"
|
|
686
|
+
data-sidebar="menu-sub-button"
|
|
687
|
+
data-size={size}
|
|
688
|
+
data-active={isActive}
|
|
689
|
+
className={cn(
|
|
690
|
+
"text-sidebar-foreground ring-sidebar-ring not-disabled:hover:bg-sidebar-accent not-disabled:hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
691
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
692
|
+
size === "sm" && "text-xs",
|
|
693
|
+
size === "md" && "text-sm",
|
|
694
|
+
"group-data-[collapsible=icon]:hidden",
|
|
695
|
+
className
|
|
696
|
+
)}
|
|
697
|
+
{...props}
|
|
698
|
+
/>
|
|
699
|
+
)
|
|
694
700
|
}
|
|
695
701
|
|
|
696
702
|
export {
|
|
@@ -4,7 +4,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
4
4
|
return (
|
|
5
5
|
<div
|
|
6
6
|
data-slot="skeleton"
|
|
7
|
-
className={cn("animate-pulse rounded-md
|
|
7
|
+
className={cn("bg-accent animate-pulse rounded-md", className)}
|
|
8
8
|
{...props}
|
|
9
9
|
/>
|
|
10
10
|
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import * as React from "react"
|
|
2
|
-
import
|
|
4
|
+
import * as SliderPrimitive from "@radix-ui/react-slider"
|
|
3
5
|
|
|
4
6
|
import { cn } from "@/lib/utils"
|
|
5
7
|
|
|
@@ -9,8 +11,14 @@ function Slider({
|
|
|
9
11
|
value,
|
|
10
12
|
min = 0,
|
|
11
13
|
max = 100,
|
|
14
|
+
disabled,
|
|
15
|
+
onClick,
|
|
16
|
+
onMouseDown,
|
|
17
|
+
onKeyDown,
|
|
18
|
+
onKeyUp,
|
|
19
|
+
onPointerDown,
|
|
12
20
|
...props
|
|
13
|
-
}: SliderPrimitive.Root
|
|
21
|
+
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
|
|
14
22
|
const _values = React.useMemo(
|
|
15
23
|
() =>
|
|
16
24
|
Array.isArray(value)
|
|
@@ -23,33 +31,55 @@ function Slider({
|
|
|
23
31
|
|
|
24
32
|
return (
|
|
25
33
|
<SliderPrimitive.Root
|
|
26
|
-
className={cn("data-horizontal:w-full data-vertical:h-full", className)}
|
|
27
34
|
data-slot="slider"
|
|
28
35
|
defaultValue={defaultValue}
|
|
29
36
|
value={value}
|
|
30
37
|
min={min}
|
|
31
38
|
max={max}
|
|
32
|
-
|
|
39
|
+
className={cn(
|
|
40
|
+
"relative flex w-full touch-none items-center select-none cursor-pointer data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
onClick={(event) => {
|
|
45
|
+
if (disabled) {
|
|
46
|
+
event.preventDefault()
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
onClick?.(event)
|
|
50
|
+
}}
|
|
51
|
+
onMouseDown={disabled ? undefined : onMouseDown}
|
|
52
|
+
onKeyDown={disabled ? undefined : onKeyDown}
|
|
53
|
+
onKeyUp={disabled ? undefined : onKeyUp}
|
|
54
|
+
onPointerDown={(event) => {
|
|
55
|
+
if (disabled) {
|
|
56
|
+
event.preventDefault()
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
onPointerDown?.(event)
|
|
60
|
+
}}
|
|
33
61
|
{...props}
|
|
34
62
|
>
|
|
35
|
-
<SliderPrimitive.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
<SliderPrimitive.Track
|
|
64
|
+
data-slot="slider-track"
|
|
65
|
+
className={cn(
|
|
66
|
+
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
<SliderPrimitive.Range
|
|
70
|
+
data-slot="slider-range"
|
|
71
|
+
className={cn(
|
|
72
|
+
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
</SliderPrimitive.Track>
|
|
76
|
+
{Array.from({ length: _values.length }, (_, index) => (
|
|
77
|
+
<SliderPrimitive.Thumb
|
|
78
|
+
data-slot="slider-thumb"
|
|
79
|
+
key={index}
|
|
80
|
+
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] not-data-disabled:hover:ring-4 not-data-disabled:focus-visible:ring-4 not-data-disabled:focus-visible:outline-hidden disabled:cursor-not-allowed data-[disabled]:cursor-not-allowed disabled:opacity-50"
|
|
81
|
+
/>
|
|
82
|
+
))}
|
|
53
83
|
</SliderPrimitive.Root>
|
|
54
84
|
)
|
|
55
85
|
}
|