@snapdragonsnursery/react-components 1.7.0 → 1.9.0

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.
@@ -0,0 +1,681 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva } from "class-variance-authority";
4
+ import { PanelLeftIcon } from "lucide-react"
5
+
6
+ import { useIsMobile } from "../../hooks/use-mobile"
7
+ import { cn } from "../../lib/utils"
8
+ import { Button } from "./button"
9
+ import { Input } from "./input"
10
+ import { Separator } from "./separator"
11
+ import {
12
+ Sheet,
13
+ SheetContent,
14
+ SheetDescription,
15
+ SheetHeader,
16
+ SheetTitle,
17
+ } from "./sheet"
18
+ import { Skeleton } from "./skeleton"
19
+ import {
20
+ Tooltip,
21
+ TooltipContent,
22
+ TooltipProvider,
23
+ TooltipTrigger,
24
+ } from "./tooltip"
25
+
26
+ const SIDEBAR_COOKIE_NAME = "sidebar_state"
27
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
28
+ const SIDEBAR_WIDTH = "16rem"
29
+ const SIDEBAR_WIDTH_MOBILE = "18rem"
30
+ const SIDEBAR_WIDTH_ICON = "3rem"
31
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b"
32
+
33
+ const SidebarContext = React.createContext(null)
34
+
35
+ function useSidebar() {
36
+ const context = React.useContext(SidebarContext)
37
+ if (!context) {
38
+ throw new Error("useSidebar must be used within a SidebarProvider.")
39
+ }
40
+
41
+ return context
42
+ }
43
+
44
+ function SidebarProvider({
45
+ defaultOpen = true,
46
+ open: openProp,
47
+ onOpenChange: setOpenProp,
48
+ className,
49
+ style,
50
+ children,
51
+ ...props
52
+ }) {
53
+ const isMobile = useIsMobile()
54
+ const [openMobile, setOpenMobile] = React.useState(false)
55
+
56
+ // This is the internal state of the sidebar.
57
+ // We use openProp and setOpenProp for control from outside the component.
58
+ const [_open, _setOpen] = React.useState(defaultOpen)
59
+ const open = openProp ?? _open
60
+ const setOpen = React.useCallback((value) => {
61
+ const openState = typeof value === "function" ? value(open) : value
62
+ if (setOpenProp) {
63
+ setOpenProp(openState)
64
+ } else {
65
+ _setOpen(openState)
66
+ }
67
+
68
+ // This sets the cookie to keep the sidebar state.
69
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
70
+ }, [setOpenProp, open])
71
+
72
+ // Helper to toggle the sidebar.
73
+ const toggleSidebar = React.useCallback(() => {
74
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
75
+ }, [isMobile, setOpen, setOpenMobile])
76
+
77
+ // Adds a keyboard shortcut to toggle the sidebar.
78
+ React.useEffect(() => {
79
+ const handleKeyDown = (event) => {
80
+ if (
81
+ event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
82
+ (event.metaKey || event.ctrlKey)
83
+ ) {
84
+ event.preventDefault()
85
+ toggleSidebar()
86
+ }
87
+ }
88
+
89
+ window.addEventListener("keydown", handleKeyDown)
90
+ return () => window.removeEventListener("keydown", handleKeyDown);
91
+ }, [toggleSidebar])
92
+
93
+ // We add a state so that we can do data-state="expanded" or "collapsed".
94
+ // This makes it easier to style the sidebar with Tailwind classes.
95
+ const state = open ? "expanded" : "collapsed"
96
+
97
+ const contextValue = React.useMemo(() => ({
98
+ state,
99
+ open,
100
+ setOpen,
101
+ isMobile,
102
+ openMobile,
103
+ setOpenMobile,
104
+ toggleSidebar,
105
+ }), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar])
106
+
107
+ return (
108
+ <SidebarContext.Provider value={contextValue}>
109
+ <TooltipProvider delayDuration={0}>
110
+ <div
111
+ data-slot="sidebar-wrapper"
112
+ style={
113
+ {
114
+ "--sidebar-width": SIDEBAR_WIDTH,
115
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
116
+ ...style
117
+ }
118
+ }
119
+ className={cn(
120
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
121
+ className
122
+ )}
123
+ {...props}>
124
+ {children}
125
+ </div>
126
+ </TooltipProvider>
127
+ </SidebarContext.Provider>
128
+ );
129
+ }
130
+
131
+ function Sidebar({
132
+ side = "left",
133
+ variant = "sidebar",
134
+ collapsible = "offcanvas",
135
+ className,
136
+ children,
137
+ ...props
138
+ }) {
139
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
140
+
141
+ if (collapsible === "none") {
142
+ return (
143
+ <div
144
+ data-slot="sidebar"
145
+ className={cn(
146
+ "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
147
+ className
148
+ )}
149
+ {...props}>
150
+ {children}
151
+ </div>
152
+ );
153
+ }
154
+
155
+ if (isMobile) {
156
+ return (
157
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
158
+ <SheetContent
159
+ data-sidebar="sidebar"
160
+ data-slot="sidebar"
161
+ data-mobile="true"
162
+ className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
163
+ style={
164
+ {
165
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE
166
+ }
167
+ }
168
+ side={side}>
169
+ <SheetHeader className="sr-only">
170
+ <SheetTitle>Sidebar</SheetTitle>
171
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
172
+ </SheetHeader>
173
+ <div className="flex h-full w-full flex-col">{children}</div>
174
+ </SheetContent>
175
+ </Sheet>
176
+ );
177
+ }
178
+
179
+ return (
180
+ <div
181
+ className="group peer text-sidebar-foreground hidden md:block"
182
+ data-state={state}
183
+ data-collapsible={state === "collapsed" ? collapsible : ""}
184
+ data-variant={variant}
185
+ data-side={side}
186
+ data-slot="sidebar">
187
+ {/* This is what handles the sidebar gap on desktop */}
188
+ <div
189
+ data-slot="sidebar-gap"
190
+ className={cn(
191
+ "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
192
+ "group-data-[collapsible=offcanvas]:w-0",
193
+ "group-data-[side=right]:rotate-180",
194
+ variant === "floating" || variant === "inset"
195
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
196
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
197
+ )} />
198
+ <div
199
+ data-slot="sidebar-container"
200
+ className={cn(
201
+ "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
202
+ side === "left"
203
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
204
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
205
+ // Adjust the padding for floating and inset variants.
206
+ variant === "floating" || variant === "inset"
207
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
208
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
209
+ className
210
+ )}
211
+ {...props}>
212
+ <div
213
+ data-sidebar="sidebar"
214
+ data-slot="sidebar-inner"
215
+ 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">
216
+ {children}
217
+ </div>
218
+ </div>
219
+ </div>
220
+ );
221
+ }
222
+
223
+ function SidebarTrigger({
224
+ className,
225
+ onClick,
226
+ ...props
227
+ }) {
228
+ const { toggleSidebar } = useSidebar()
229
+
230
+ return (
231
+ <Button
232
+ data-sidebar="trigger"
233
+ data-slot="sidebar-trigger"
234
+ variant="ghost"
235
+ size="icon"
236
+ className={cn("size-7", className)}
237
+ onClick={(event) => {
238
+ onClick?.(event)
239
+ toggleSidebar()
240
+ }}
241
+ {...props}>
242
+ <PanelLeftIcon />
243
+ <span className="sr-only">Toggle Sidebar</span>
244
+ </Button>
245
+ );
246
+ }
247
+
248
+ function SidebarRail({
249
+ className,
250
+ ...props
251
+ }) {
252
+ const { toggleSidebar } = useSidebar()
253
+
254
+ return (
255
+ <button
256
+ data-sidebar="rail"
257
+ data-slot="sidebar-rail"
258
+ aria-label="Toggle Sidebar"
259
+ tabIndex={-1}
260
+ onClick={toggleSidebar}
261
+ title="Toggle Sidebar"
262
+ className={cn(
263
+ "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",
264
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
265
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
266
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
267
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
268
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
269
+ className
270
+ )}
271
+ {...props} />
272
+ );
273
+ }
274
+
275
+ function SidebarInset({
276
+ className,
277
+ ...props
278
+ }) {
279
+ return (
280
+ <main
281
+ data-slot="sidebar-inset"
282
+ className={cn(
283
+ "bg-background relative flex w-full flex-1 flex-col",
284
+ "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",
285
+ className
286
+ )}
287
+ {...props} />
288
+ );
289
+ }
290
+
291
+ function SidebarInput({
292
+ className,
293
+ ...props
294
+ }) {
295
+ return (
296
+ <Input
297
+ data-slot="sidebar-input"
298
+ data-sidebar="input"
299
+ className={cn("bg-background h-8 w-full shadow-none", className)}
300
+ {...props} />
301
+ );
302
+ }
303
+
304
+ function SidebarHeader({
305
+ className,
306
+ ...props
307
+ }) {
308
+ return (
309
+ <div
310
+ data-slot="sidebar-header"
311
+ data-sidebar="header"
312
+ className={cn("flex flex-col gap-2 p-2", className)}
313
+ {...props} />
314
+ );
315
+ }
316
+
317
+ function SidebarFooter({
318
+ className,
319
+ ...props
320
+ }) {
321
+ return (
322
+ <div
323
+ data-slot="sidebar-footer"
324
+ data-sidebar="footer"
325
+ className={cn("flex flex-col gap-2 p-2", className)}
326
+ {...props} />
327
+ );
328
+ }
329
+
330
+ function SidebarSeparator({
331
+ className,
332
+ ...props
333
+ }) {
334
+ return (
335
+ <Separator
336
+ data-slot="sidebar-separator"
337
+ data-sidebar="separator"
338
+ className={cn("bg-sidebar-border mx-2 w-auto", className)}
339
+ {...props} />
340
+ );
341
+ }
342
+
343
+ function SidebarContent({
344
+ className,
345
+ ...props
346
+ }) {
347
+ return (
348
+ <div
349
+ data-slot="sidebar-content"
350
+ data-sidebar="content"
351
+ className={cn(
352
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
353
+ className
354
+ )}
355
+ {...props} />
356
+ );
357
+ }
358
+
359
+ function SidebarGroup({
360
+ className,
361
+ ...props
362
+ }) {
363
+ return (
364
+ <div
365
+ data-slot="sidebar-group"
366
+ data-sidebar="group"
367
+ className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
368
+ {...props} />
369
+ );
370
+ }
371
+
372
+ function SidebarGroupLabel({
373
+ className,
374
+ asChild = false,
375
+ ...props
376
+ }) {
377
+ const Comp = asChild ? Slot : "div"
378
+
379
+ return (
380
+ <Comp
381
+ data-slot="sidebar-group-label"
382
+ data-sidebar="group-label"
383
+ className={cn(
384
+ "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",
385
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
386
+ className
387
+ )}
388
+ {...props} />
389
+ );
390
+ }
391
+
392
+ function SidebarGroupAction({
393
+ className,
394
+ asChild = false,
395
+ ...props
396
+ }) {
397
+ const Comp = asChild ? Slot : "button"
398
+
399
+ return (
400
+ <Comp
401
+ data-slot="sidebar-group-action"
402
+ data-sidebar="group-action"
403
+ className={cn(
404
+ "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",
405
+ // Increases the hit area of the button on mobile.
406
+ "after:absolute after:-inset-2 md:after:hidden",
407
+ "group-data-[collapsible=icon]:hidden",
408
+ className
409
+ )}
410
+ {...props} />
411
+ );
412
+ }
413
+
414
+ function SidebarGroupContent({
415
+ className,
416
+ ...props
417
+ }) {
418
+ return (
419
+ <div
420
+ data-slot="sidebar-group-content"
421
+ data-sidebar="group-content"
422
+ className={cn("w-full text-sm", className)}
423
+ {...props} />
424
+ );
425
+ }
426
+
427
+ function SidebarMenu({
428
+ className,
429
+ ...props
430
+ }) {
431
+ return (
432
+ <ul
433
+ data-slot="sidebar-menu"
434
+ data-sidebar="menu"
435
+ className={cn("flex w-full min-w-0 flex-col gap-1", className)}
436
+ {...props} />
437
+ );
438
+ }
439
+
440
+ function SidebarMenuItem({
441
+ className,
442
+ ...props
443
+ }) {
444
+ return (
445
+ <li
446
+ data-slot="sidebar-menu-item"
447
+ data-sidebar="menu-item"
448
+ className={cn("group/menu-item relative", className)}
449
+ {...props} />
450
+ );
451
+ }
452
+
453
+ const sidebarMenuButtonVariants = cva(
454
+ "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] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent 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",
455
+ {
456
+ variants: {
457
+ variant: {
458
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
459
+ outline:
460
+ "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))]",
461
+ },
462
+ size: {
463
+ default: "h-8 text-sm",
464
+ sm: "h-7 text-xs",
465
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
466
+ },
467
+ },
468
+ defaultVariants: {
469
+ variant: "default",
470
+ size: "default",
471
+ },
472
+ }
473
+ )
474
+
475
+ function SidebarMenuButton({
476
+ asChild = false,
477
+ isActive = false,
478
+ variant = "default",
479
+ size = "default",
480
+ tooltip,
481
+ className,
482
+ ...props
483
+ }) {
484
+ const Comp = asChild ? Slot : "button"
485
+ const { isMobile, state } = useSidebar()
486
+
487
+ const button = (
488
+ <Comp
489
+ data-slot="sidebar-menu-button"
490
+ data-sidebar="menu-button"
491
+ data-size={size}
492
+ data-active={isActive}
493
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
494
+ {...props} />
495
+ )
496
+
497
+ if (!tooltip) {
498
+ return button
499
+ }
500
+
501
+ if (typeof tooltip === "string") {
502
+ tooltip = {
503
+ children: tooltip,
504
+ }
505
+ }
506
+
507
+ return (
508
+ <Tooltip>
509
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
510
+ <TooltipContent
511
+ side="right"
512
+ align="center"
513
+ hidden={state !== "collapsed" || isMobile}
514
+ {...tooltip} />
515
+ </Tooltip>
516
+ );
517
+ }
518
+
519
+ function SidebarMenuAction({
520
+ className,
521
+ asChild = false,
522
+ showOnHover = false,
523
+ ...props
524
+ }) {
525
+ const Comp = asChild ? Slot : "button"
526
+
527
+ return (
528
+ <Comp
529
+ data-slot="sidebar-menu-action"
530
+ data-sidebar="menu-action"
531
+ className={cn(
532
+ "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",
533
+ // Increases the hit area of the button on mobile.
534
+ "after:absolute after:-inset-2 md:after:hidden",
535
+ "peer-data-[size=sm]/menu-button:top-1",
536
+ "peer-data-[size=default]/menu-button:top-1.5",
537
+ "peer-data-[size=lg]/menu-button:top-2.5",
538
+ "group-data-[collapsible=icon]:hidden",
539
+ showOnHover &&
540
+ "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",
541
+ className
542
+ )}
543
+ {...props} />
544
+ );
545
+ }
546
+
547
+ function SidebarMenuBadge({
548
+ className,
549
+ ...props
550
+ }) {
551
+ return (
552
+ <div
553
+ data-slot="sidebar-menu-badge"
554
+ data-sidebar="menu-badge"
555
+ className={cn(
556
+ "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",
557
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
558
+ "peer-data-[size=sm]/menu-button:top-1",
559
+ "peer-data-[size=default]/menu-button:top-1.5",
560
+ "peer-data-[size=lg]/menu-button:top-2.5",
561
+ "group-data-[collapsible=icon]:hidden",
562
+ className
563
+ )}
564
+ {...props} />
565
+ );
566
+ }
567
+
568
+ function SidebarMenuSkeleton({
569
+ className,
570
+ showIcon = false,
571
+ ...props
572
+ }) {
573
+ // Random width between 50 to 90%.
574
+ const width = React.useMemo(() => {
575
+ return `${Math.floor(Math.random() * 40) + 50}%`;
576
+ }, [])
577
+
578
+ return (
579
+ <div
580
+ data-slot="sidebar-menu-skeleton"
581
+ data-sidebar="menu-skeleton"
582
+ className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
583
+ {...props}>
584
+ {showIcon && (
585
+ <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />
586
+ )}
587
+ <Skeleton
588
+ className="h-4 max-w-(--skeleton-width) flex-1"
589
+ data-sidebar="menu-skeleton-text"
590
+ style={
591
+ {
592
+ "--skeleton-width": width
593
+ }
594
+ } />
595
+ </div>
596
+ );
597
+ }
598
+
599
+ function SidebarMenuSub({
600
+ className,
601
+ ...props
602
+ }) {
603
+ return (
604
+ <ul
605
+ data-slot="sidebar-menu-sub"
606
+ data-sidebar="menu-sub"
607
+ className={cn(
608
+ "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",
609
+ "group-data-[collapsible=icon]:hidden",
610
+ className
611
+ )}
612
+ {...props} />
613
+ );
614
+ }
615
+
616
+ function SidebarMenuSubItem({
617
+ className,
618
+ ...props
619
+ }) {
620
+ return (
621
+ <li
622
+ data-slot="sidebar-menu-sub-item"
623
+ data-sidebar="menu-sub-item"
624
+ className={cn("group/menu-sub-item relative", className)}
625
+ {...props} />
626
+ );
627
+ }
628
+
629
+ function SidebarMenuSubButton({
630
+ asChild = false,
631
+ size = "md",
632
+ isActive = false,
633
+ className,
634
+ ...props
635
+ }) {
636
+ const Comp = asChild ? Slot : "a"
637
+
638
+ return (
639
+ <Comp
640
+ data-slot="sidebar-menu-sub-button"
641
+ data-sidebar="menu-sub-button"
642
+ data-size={size}
643
+ data-active={isActive}
644
+ className={cn(
645
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent 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:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
646
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
647
+ size === "sm" && "text-xs",
648
+ size === "md" && "text-sm",
649
+ "group-data-[collapsible=icon]:hidden",
650
+ className
651
+ )}
652
+ {...props} />
653
+ );
654
+ }
655
+
656
+ export {
657
+ Sidebar,
658
+ SidebarContent,
659
+ SidebarFooter,
660
+ SidebarGroup,
661
+ SidebarGroupAction,
662
+ SidebarGroupContent,
663
+ SidebarGroupLabel,
664
+ SidebarHeader,
665
+ SidebarInput,
666
+ SidebarInset,
667
+ SidebarMenu,
668
+ SidebarMenuAction,
669
+ SidebarMenuBadge,
670
+ SidebarMenuButton,
671
+ SidebarMenuItem,
672
+ SidebarMenuSkeleton,
673
+ SidebarMenuSub,
674
+ SidebarMenuSubButton,
675
+ SidebarMenuSubItem,
676
+ SidebarProvider,
677
+ SidebarRail,
678
+ SidebarSeparator,
679
+ SidebarTrigger,
680
+ useSidebar,
681
+ }
@@ -0,0 +1,15 @@
1
+ import { cn } from "../../lib/utils"
2
+
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }) {
7
+ return (
8
+ <div
9
+ data-slot="skeleton"
10
+ className={cn("bg-accent animate-pulse rounded-md", className)}
11
+ {...props} />
12
+ );
13
+ }
14
+
15
+ export { Skeleton }