shadcn-packaged 2025.4.21 → 2025.6.16-1

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.
Files changed (97) hide show
  1. package/README.md +30 -31
  2. package/index.css +112 -138
  3. package/package.json +37 -37
  4. package/ui/accordion.d.ts +4 -4
  5. package/ui/accordion.jsx +20 -15
  6. package/ui/alert-dialog.d.ts +11 -17
  7. package/ui/alert-dialog.jsx +36 -23
  8. package/ui/alert.d.ts +5 -4
  9. package/ui/alert.jsx +12 -9
  10. package/ui/aspect-ratio.d.ts +1 -1
  11. package/ui/aspect-ratio.jsx +3 -1
  12. package/ui/avatar.d.ts +3 -3
  13. package/ui/avatar.jsx +9 -6
  14. package/ui/badge.d.ts +3 -3
  15. package/ui/badge.jsx +9 -7
  16. package/ui/breadcrumb.d.ts +8 -16
  17. package/ui/breadcrumb.jsx +26 -21
  18. package/ui/button.d.ts +2 -3
  19. package/ui/button.jsx +13 -14
  20. package/ui/calendar.d.ts +7 -7
  21. package/ui/calendar.jsx +70 -30
  22. package/ui/card.d.ts +8 -7
  23. package/ui/card.jsx +22 -13
  24. package/ui/carousel.d.ts +6 -5
  25. package/ui/carousel.jsx +26 -34
  26. package/ui/chart.d.ts +6 -28
  27. package/ui/chart.jsx +37 -40
  28. package/ui/checkbox.d.ts +1 -1
  29. package/ui/checkbox.jsx +8 -7
  30. package/ui/collapsible.d.ts +3 -3
  31. package/ui/collapsible.jsx +9 -3
  32. package/ui/command.d.ts +16 -78
  33. package/ui/command.jsx +37 -27
  34. package/ui/context-menu.d.ts +19 -21
  35. package/ui/context-menu.jsx +65 -47
  36. package/ui/dialog.d.ts +13 -17
  37. package/ui/dialog.jsx +41 -27
  38. package/ui/drawer.d.ts +10 -19
  39. package/ui/drawer.jsx +36 -23
  40. package/ui/dropdown-menu.d.ts +20 -22
  41. package/ui/dropdown-menu.jsx +66 -50
  42. package/ui/form.d.ts +6 -5
  43. package/ui/form.jsx +19 -23
  44. package/ui/hover-card.d.ts +3 -3
  45. package/ui/hover-card.jsx +11 -4
  46. package/ui/input-otp.d.ts +7 -30
  47. package/ui/input-otp.jsx +17 -15
  48. package/ui/input.d.ts +1 -1
  49. package/ui/input.jsx +3 -4
  50. package/ui/label.d.ts +1 -2
  51. package/ui/label.jsx +3 -4
  52. package/ui/menubar.d.ts +17 -19
  53. package/ui/menubar.jsx +58 -49
  54. package/ui/navigation-menu.d.ts +11 -9
  55. package/ui/navigation-menu.jsx +37 -29
  56. package/ui/pagination.d.ts +10 -25
  57. package/ui/pagination.jsx +35 -28
  58. package/ui/popover.d.ts +5 -4
  59. package/ui/popover.jsx +15 -7
  60. package/ui/progress.d.ts +1 -1
  61. package/ui/progress.jsx +5 -4
  62. package/ui/radio-group.d.ts +2 -2
  63. package/ui/radio-group.jsx +9 -11
  64. package/ui/resizable.d.ts +5 -20
  65. package/ui/resizable.jsx +15 -8
  66. package/ui/scroll-area.d.ts +2 -2
  67. package/ui/scroll-area.jsx +16 -14
  68. package/ui/select.d.ts +13 -11
  69. package/ui/select.jsx +58 -47
  70. package/ui/separator.d.ts +1 -1
  71. package/ui/separator.jsx +3 -2
  72. package/ui/sheet.d.ts +11 -23
  73. package/ui/sheet.jsx +45 -41
  74. package/ui/sidebar.d.ts +38 -34
  75. package/ui/sidebar.jsx +109 -122
  76. package/ui/skeleton.d.ts +1 -1
  77. package/ui/skeleton.jsx +1 -1
  78. package/ui/slider.d.ts +1 -1
  79. package/ui/slider.jsx +13 -7
  80. package/ui/sonner.d.ts +1 -2
  81. package/ui/sonner.jsx +4 -7
  82. package/ui/switch.d.ts +2 -2
  83. package/ui/switch.jsx +6 -5
  84. package/ui/table.d.ts +8 -8
  85. package/ui/table.jsx +27 -18
  86. package/ui/tabs.d.ts +4 -4
  87. package/ui/tabs.jsx +12 -7
  88. package/ui/textarea.d.ts +1 -1
  89. package/ui/textarea.jsx +3 -4
  90. package/ui/toggle-group.d.ts +3 -8
  91. package/ui/toggle-group.jsx +11 -11
  92. package/ui/toggle.d.ts +1 -4
  93. package/ui/toggle.jsx +8 -7
  94. package/ui/tooltip.d.ts +4 -4
  95. package/ui/tooltip.jsx +19 -5
  96. package/tailwind.config.js +0 -89
  97. /package/hooks/{use-mobile.jsx → use-mobile.js} +0 -0
package/ui/sheet.jsx CHANGED
@@ -1,45 +1,49 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
3
  import * as SheetPrimitive from "@radix-ui/react-dialog";
4
- import { cva } from "class-variance-authority";
5
- import { X } from "lucide-react";
4
+ import { XIcon } from "lucide-react";
6
5
  import { cn } from "../lib/utils";
7
- const Sheet = SheetPrimitive.Root;
8
- const SheetTrigger = SheetPrimitive.Trigger;
9
- const SheetClose = SheetPrimitive.Close;
10
- const SheetPortal = SheetPrimitive.Portal;
11
- const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Overlay className={cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className)} {...props} ref={ref}/>));
12
- SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
13
- const sheetVariants = cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", {
14
- variants: {
15
- side: {
16
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
17
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
18
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
19
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
20
- },
21
- },
22
- defaultVariants: {
23
- side: "right",
24
- },
25
- });
26
- const SheetContent = React.forwardRef(({ side = "right", className, children, ...props }, ref) => (<SheetPortal>
27
- <SheetOverlay />
28
- <SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
29
- {children}
30
- <SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
31
- <X className="h-4 w-4"/>
32
- <span className="sr-only">Close</span>
33
- </SheetPrimitive.Close>
34
- </SheetPrimitive.Content>
35
- </SheetPortal>));
36
- SheetContent.displayName = SheetPrimitive.Content.displayName;
37
- const SheetHeader = ({ className, ...props }) => (<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props}/>);
38
- SheetHeader.displayName = "SheetHeader";
39
- const SheetFooter = ({ className, ...props }) => (<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props}/>);
40
- SheetFooter.displayName = "SheetFooter";
41
- const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Title ref={ref} className={cn("text-lg font-semibold text-foreground", className)} {...props}/>));
42
- SheetTitle.displayName = SheetPrimitive.Title.displayName;
43
- const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props}/>));
44
- SheetDescription.displayName = SheetPrimitive.Description.displayName;
45
- export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
6
+ function Sheet({ ...props }) {
7
+ return <SheetPrimitive.Root data-slot="sheet" {...props}/>;
8
+ }
9
+ function SheetTrigger({ ...props }) {
10
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props}/>;
11
+ }
12
+ function SheetClose({ ...props }) {
13
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props}/>;
14
+ }
15
+ function SheetPortal({ ...props }) {
16
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props}/>;
17
+ }
18
+ function SheetOverlay({ className, ...props }) {
19
+ return (<SheetPrimitive.Overlay data-slot="sheet-overlay" className={cn("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", className)} {...props}/>);
20
+ }
21
+ function SheetContent({ className, children, side = "right", ...props }) {
22
+ return (<SheetPortal>
23
+ <SheetOverlay />
24
+ <SheetPrimitive.Content data-slot="sheet-content" className={cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" &&
25
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", side === "left" &&
26
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", side === "top" &&
27
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" &&
28
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className)} {...props}>
29
+ {children}
30
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
31
+ <XIcon className="size-4"/>
32
+ <span className="sr-only">Close</span>
33
+ </SheetPrimitive.Close>
34
+ </SheetPrimitive.Content>
35
+ </SheetPortal>);
36
+ }
37
+ function SheetHeader({ className, ...props }) {
38
+ return (<div data-slot="sheet-header" className={cn("flex flex-col gap-1.5 p-4", className)} {...props}/>);
39
+ }
40
+ function SheetFooter({ className, ...props }) {
41
+ return (<div data-slot="sheet-footer" className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props}/>);
42
+ }
43
+ function SheetTitle({ className, ...props }) {
44
+ return (<SheetPrimitive.Title data-slot="sheet-title" className={cn("text-foreground font-semibold", className)} {...props}/>);
45
+ }
46
+ function SheetDescription({ className, ...props }) {
47
+ return (<SheetPrimitive.Description data-slot="sheet-description" className={cn("text-muted-foreground text-sm", className)} {...props}/>);
48
+ }
49
+ export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
package/ui/sidebar.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
+ import { Button } from "../ui/button";
4
+ import { Input } from "../ui/input";
5
+ import { Separator } from "../ui/separator";
3
6
  import { TooltipContent } from "../ui/tooltip";
4
7
  type SidebarContextProps = {
5
8
  state: "expanded" | "collapsed";
@@ -11,55 +14,56 @@ type SidebarContextProps = {
11
14
  toggleSidebar: () => void;
12
15
  };
13
16
  declare function useSidebar(): SidebarContextProps;
14
- declare const SidebarProvider: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
17
+ declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<"div"> & {
15
18
  defaultOpen?: boolean;
16
19
  open?: boolean;
17
20
  onOpenChange?: (open: boolean) => void;
18
- }, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
- declare const Sidebar: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
21
+ }): React.JSX.Element;
22
+ declare function Sidebar({ side, variant, collapsible, className, children, ...props }: React.ComponentProps<"div"> & {
20
23
  side?: "left" | "right";
21
24
  variant?: "sidebar" | "floating" | "inset";
22
25
  collapsible?: "offcanvas" | "icon" | "none";
23
- }, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
- declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<import("../ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
25
- declare const SidebarRail: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
26
- declare const SidebarInset: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
- declare const SidebarInput: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
28
- declare const SidebarHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
29
- declare const SidebarFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
- declare const SidebarSeparator: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-separator").SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
- declare const SidebarContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
- declare const SidebarGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
- declare const SidebarGroupLabel: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
26
+ }): React.JSX.Element;
27
+ declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
28
+ declare function SidebarRail({ className, ...props }: React.ComponentProps<"button">): React.JSX.Element;
29
+ declare function SidebarInset({ className, ...props }: React.ComponentProps<"main">): React.JSX.Element;
30
+ declare function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>): React.JSX.Element;
31
+ declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
32
+ declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
33
+ declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
34
+ declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
35
+ declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
36
+ declare function SidebarGroupLabel({ className, asChild, ...props }: React.ComponentProps<"div"> & {
34
37
  asChild?: boolean;
35
- }, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
- declare const SidebarGroupAction: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
38
+ }): React.JSX.Element;
39
+ declare function SidebarGroupAction({ className, asChild, ...props }: React.ComponentProps<"button"> & {
37
40
  asChild?: boolean;
38
- }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
39
- declare const SidebarGroupContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
40
- declare const SidebarMenu: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
41
- declare const SidebarMenuItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
42
- declare const SidebarMenuButton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
41
+ }): React.JSX.Element;
42
+ declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
43
+ declare function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
44
+ declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
45
+ declare const sidebarMenuButtonVariants: (props?: {
46
+ variant?: "default" | "outline";
47
+ size?: "default" | "sm" | "lg";
48
+ } & import("class-variance-authority/dist/types").ClassProp) => string;
49
+ declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React.ComponentProps<"button"> & {
43
50
  asChild?: boolean;
44
51
  isActive?: boolean;
45
52
  tooltip?: string | React.ComponentProps<typeof TooltipContent>;
46
- } & VariantProps<(props?: {
47
- variant?: "default" | "outline";
48
- size?: "default" | "sm" | "lg";
49
- } & import("class-variance-authority/dist/types").ClassProp) => string>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
50
- declare const SidebarMenuAction: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
53
+ } & VariantProps<typeof sidebarMenuButtonVariants>): React.JSX.Element;
54
+ declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }: React.ComponentProps<"button"> & {
51
55
  asChild?: boolean;
52
56
  showOnHover?: boolean;
53
- }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
54
- declare const SidebarMenuBadge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
55
- declare const SidebarMenuSkeleton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
57
+ }): React.JSX.Element;
58
+ declare function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
59
+ declare function SidebarMenuSkeleton({ className, showIcon, ...props }: React.ComponentProps<"div"> & {
56
60
  showIcon?: boolean;
57
- }, "ref"> & React.RefAttributes<HTMLDivElement>>;
58
- declare const SidebarMenuSub: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
59
- declare const SidebarMenuSubItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
60
- declare const SidebarMenuSubButton: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
61
+ }): React.JSX.Element;
62
+ declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
63
+ declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
64
+ declare function SidebarMenuSubButton({ asChild, size, isActive, className, ...props }: React.ComponentProps<"a"> & {
61
65
  asChild?: boolean;
62
66
  size?: "sm" | "md";
63
67
  isActive?: boolean;
64
- }, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
68
+ }): React.JSX.Element;
65
69
  export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
package/ui/sidebar.jsx CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as React from "react";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
4
  import { cva } from "class-variance-authority";
5
- import { PanelLeft } from "lucide-react";
5
+ import { PanelLeftIcon } from "lucide-react";
6
6
  import { useIsMobile } from "../hooks/use-mobile";
7
7
  import { cn } from "../lib/utils";
8
8
  import { Button } from "../ui/button";
@@ -25,7 +25,7 @@ function useSidebar() {
25
25
  }
26
26
  return context;
27
27
  }
28
- const SidebarProvider = React.forwardRef(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }, ref) => {
28
+ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
29
29
  const isMobile = useIsMobile();
30
30
  const [openMobile, setOpenMobile] = React.useState(false);
31
31
  // This is the internal state of the sidebar.
@@ -45,9 +45,7 @@ const SidebarProvider = React.forwardRef(({ defaultOpen = true, open: openProp,
45
45
  }, [setOpenProp, open]);
46
46
  // Helper to toggle the sidebar.
47
47
  const toggleSidebar = React.useCallback(() => {
48
- return isMobile
49
- ? setOpenMobile((open) => !open)
50
- : setOpen((open) => !open);
48
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
51
49
  }, [isMobile, setOpen, setOpenMobile]);
52
50
  // Adds a keyboard shortcut to toggle the sidebar.
53
51
  React.useEffect(() => {
@@ -74,120 +72,110 @@ const SidebarProvider = React.forwardRef(({ defaultOpen = true, open: openProp,
74
72
  toggleSidebar,
75
73
  }), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
76
74
  return (<SidebarContext.Provider value={contextValue}>
77
- <TooltipProvider delayDuration={0}>
78
- <div style={{
75
+ <TooltipProvider delayDuration={0}>
76
+ <div data-slot="sidebar-wrapper" style={{
79
77
  "--sidebar-width": SIDEBAR_WIDTH,
80
78
  "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
81
79
  ...style,
82
- }} className={cn("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar", className)} ref={ref} {...props}>
83
- {children}
84
- </div>
85
- </TooltipProvider>
86
- </SidebarContext.Provider>);
87
- });
88
- SidebarProvider.displayName = "SidebarProvider";
89
- const Sidebar = React.forwardRef(({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }, ref) => {
80
+ }} className={cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className)} {...props}>
81
+ {children}
82
+ </div>
83
+ </TooltipProvider>
84
+ </SidebarContext.Provider>);
85
+ }
86
+ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
90
87
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
91
88
  if (collapsible === "none") {
92
- return (<div className={cn("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground", className)} ref={ref} {...props}>
93
- {children}
94
- </div>);
89
+ return (<div data-slot="sidebar" className={cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className)} {...props}>
90
+ {children}
91
+ </div>);
95
92
  }
96
93
  if (isMobile) {
97
94
  return (<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
98
- <SheetContent data-sidebar="sidebar" data-mobile="true" className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden" style={{
95
+ <SheetContent data-sidebar="sidebar" data-slot="sidebar" data-mobile="true" className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden" style={{
99
96
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
100
97
  }} side={side}>
101
- <SheetHeader className="sr-only">
102
- <SheetTitle>Sidebar</SheetTitle>
103
- <SheetDescription>Displays the mobile sidebar.</SheetDescription>
104
- </SheetHeader>
105
- <div className="flex h-full w-full flex-col">{children}</div>
106
- </SheetContent>
107
- </Sheet>);
98
+ <SheetHeader className="sr-only">
99
+ <SheetTitle>Sidebar</SheetTitle>
100
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
101
+ </SheetHeader>
102
+ <div className="flex h-full w-full flex-col">{children}</div>
103
+ </SheetContent>
104
+ </Sheet>);
108
105
  }
109
- return (<div ref={ref} className="group peer hidden text-sidebar-foreground md:block" data-state={state} data-collapsible={state === "collapsed" ? collapsible : ""} data-variant={variant} data-side={side}>
110
- {/* This is what handles the sidebar gap on desktop */}
111
- <div className={cn("relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
112
- ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
113
- : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}/>
114
- <div className={cn("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
106
+ return (<div className="group peer text-sidebar-foreground hidden md:block" data-state={state} data-collapsible={state === "collapsed" ? collapsible : ""} data-variant={variant} data-side={side} data-slot="sidebar">
107
+ {/* This is what handles the sidebar gap on desktop */}
108
+ <div data-slot="sidebar-gap" className={cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
109
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
110
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}/>
111
+ <div data-slot="sidebar-container" className={cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
115
112
  ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
116
113
  : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
117
114
  // Adjust the padding for floating and inset variants.
118
115
  variant === "floating" || variant === "inset"
119
- ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
120
- : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l", className)} {...props}>
121
- <div data-sidebar="sidebar" className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow">
122
- {children}
123
- </div>
116
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
117
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className)} {...props}>
118
+ <div data-sidebar="sidebar" data-slot="sidebar-inner" 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">
119
+ {children}
124
120
  </div>
125
- </div>);
126
- });
127
- Sidebar.displayName = "Sidebar";
128
- const SidebarTrigger = React.forwardRef(({ className, onClick, ...props }, ref) => {
121
+ </div>
122
+ </div>);
123
+ }
124
+ function SidebarTrigger({ className, onClick, ...props }) {
129
125
  const { toggleSidebar } = useSidebar();
130
- return (<Button ref={ref} data-sidebar="trigger" variant="ghost" size="icon" className={cn("h-7 w-7", className)} onClick={(event) => {
126
+ return (<Button data-sidebar="trigger" data-slot="sidebar-trigger" variant="ghost" size="icon" className={cn("size-7", className)} onClick={(event) => {
131
127
  onClick?.(event);
132
128
  toggleSidebar();
133
129
  }} {...props}>
134
- <PanelLeft />
130
+ <PanelLeftIcon />
135
131
  <span className="sr-only">Toggle Sidebar</span>
136
132
  </Button>);
137
- });
138
- SidebarTrigger.displayName = "SidebarTrigger";
139
- const SidebarRail = React.forwardRef(({ className, ...props }, ref) => {
133
+ }
134
+ function SidebarRail({ className, ...props }) {
140
135
  const { toggleSidebar } = useSidebar();
141
- return (<button ref={ref} data-sidebar="rail" aria-label="Toggle Sidebar" tabIndex={-1} onClick={toggleSidebar} title="Toggle Sidebar" className={cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex", "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className)} {...props}/>);
142
- });
143
- SidebarRail.displayName = "SidebarRail";
144
- const SidebarInset = React.forwardRef(({ className, ...props }, ref) => {
145
- return (<main ref={ref} className={cn("relative flex w-full flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow", className)} {...props}/>);
146
- });
147
- SidebarInset.displayName = "SidebarInset";
148
- const SidebarInput = React.forwardRef(({ className, ...props }, ref) => {
149
- return (<Input ref={ref} data-sidebar="input" className={cn("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring", className)} {...props}/>);
150
- });
151
- SidebarInput.displayName = "SidebarInput";
152
- const SidebarHeader = React.forwardRef(({ className, ...props }, ref) => {
153
- return (<div ref={ref} data-sidebar="header" className={cn("flex flex-col gap-2 p-2", className)} {...props}/>);
154
- });
155
- SidebarHeader.displayName = "SidebarHeader";
156
- const SidebarFooter = React.forwardRef(({ className, ...props }, ref) => {
157
- return (<div ref={ref} data-sidebar="footer" className={cn("flex flex-col gap-2 p-2", className)} {...props}/>);
158
- });
159
- SidebarFooter.displayName = "SidebarFooter";
160
- const SidebarSeparator = React.forwardRef(({ className, ...props }, ref) => {
161
- return (<Separator ref={ref} data-sidebar="separator" className={cn("mx-2 w-auto bg-sidebar-border", className)} {...props}/>);
162
- });
163
- SidebarSeparator.displayName = "SidebarSeparator";
164
- const SidebarContent = React.forwardRef(({ className, ...props }, ref) => {
165
- return (<div ref={ref} data-sidebar="content" className={cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className)} {...props}/>);
166
- });
167
- SidebarContent.displayName = "SidebarContent";
168
- const SidebarGroup = React.forwardRef(({ className, ...props }, ref) => {
169
- return (<div ref={ref} data-sidebar="group" className={cn("relative flex w-full min-w-0 flex-col p-2", className)} {...props}/>);
170
- });
171
- SidebarGroup.displayName = "SidebarGroup";
172
- const SidebarGroupLabel = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
136
+ return (<button data-sidebar="rail" data-slot="sidebar-rail" aria-label="Toggle Sidebar" tabIndex={-1} onClick={toggleSidebar} title="Toggle Sidebar" className={cn("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", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className)} {...props}/>);
137
+ }
138
+ function SidebarInset({ className, ...props }) {
139
+ return (<main data-slot="sidebar-inset" className={cn("bg-background relative flex w-full flex-1 flex-col", "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", className)} {...props}/>);
140
+ }
141
+ function SidebarInput({ className, ...props }) {
142
+ return (<Input data-slot="sidebar-input" data-sidebar="input" className={cn("bg-background h-8 w-full shadow-none", className)} {...props}/>);
143
+ }
144
+ function SidebarHeader({ className, ...props }) {
145
+ return (<div data-slot="sidebar-header" data-sidebar="header" className={cn("flex flex-col gap-2 p-2", className)} {...props}/>);
146
+ }
147
+ function SidebarFooter({ className, ...props }) {
148
+ return (<div data-slot="sidebar-footer" data-sidebar="footer" className={cn("flex flex-col gap-2 p-2", className)} {...props}/>);
149
+ }
150
+ function SidebarSeparator({ className, ...props }) {
151
+ return (<Separator data-slot="sidebar-separator" data-sidebar="separator" className={cn("bg-sidebar-border mx-2 w-auto", className)} {...props}/>);
152
+ }
153
+ function SidebarContent({ className, ...props }) {
154
+ return (<div data-slot="sidebar-content" data-sidebar="content" className={cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className)} {...props}/>);
155
+ }
156
+ function SidebarGroup({ className, ...props }) {
157
+ return (<div data-slot="sidebar-group" data-sidebar="group" className={cn("relative flex w-full min-w-0 flex-col p-2", className)} {...props}/>);
158
+ }
159
+ function SidebarGroupLabel({ className, asChild = false, ...props }) {
173
160
  const Comp = asChild ? Slot : "div";
174
- return (<Comp ref={ref} data-sidebar="group-label" className={cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className)} {...props}/>);
175
- });
176
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
177
- const SidebarGroupAction = React.forwardRef(({ className, asChild = false, ...props }, ref) => {
161
+ return (<Comp data-slot="sidebar-group-label" data-sidebar="group-label" className={cn("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", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className)} {...props}/>);
162
+ }
163
+ function SidebarGroupAction({ className, asChild = false, ...props }) {
178
164
  const Comp = asChild ? Slot : "button";
179
- return (<Comp ref={ref} data-sidebar="group-action" className={cn("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
165
+ return (<Comp data-slot="sidebar-group-action" data-sidebar="group-action" className={cn("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",
180
166
  // Increases the hit area of the button on mobile.
181
- "after:absolute after:-inset-2 after:md:hidden", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
182
- });
183
- SidebarGroupAction.displayName = "SidebarGroupAction";
184
- const SidebarGroupContent = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} data-sidebar="group-content" className={cn("w-full text-sm", className)} {...props}/>));
185
- SidebarGroupContent.displayName = "SidebarGroupContent";
186
- const SidebarMenu = React.forwardRef(({ className, ...props }, ref) => (<ul ref={ref} data-sidebar="menu" className={cn("flex w-full min-w-0 flex-col gap-1", className)} {...props}/>));
187
- SidebarMenu.displayName = "SidebarMenu";
188
- const SidebarMenuItem = React.forwardRef(({ className, ...props }, ref) => (<li ref={ref} data-sidebar="menu-item" className={cn("group/menu-item relative", className)} {...props}/>));
189
- SidebarMenuItem.displayName = "SidebarMenuItem";
190
- const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none 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", {
167
+ "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
168
+ }
169
+ function SidebarGroupContent({ className, ...props }) {
170
+ return (<div data-slot="sidebar-group-content" data-sidebar="group-content" className={cn("w-full text-sm", className)} {...props}/>);
171
+ }
172
+ function SidebarMenu({ className, ...props }) {
173
+ return (<ul data-slot="sidebar-menu" data-sidebar="menu" className={cn("flex w-full min-w-0 flex-col gap-1", className)} {...props}/>);
174
+ }
175
+ function SidebarMenuItem({ className, ...props }) {
176
+ return (<li data-slot="sidebar-menu-item" data-sidebar="menu-item" className={cn("group/menu-item relative", className)} {...props}/>);
177
+ }
178
+ const sidebarMenuButtonVariants = cva("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", {
191
179
  variants: {
192
180
  variant: {
193
181
  default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
@@ -196,7 +184,7 @@ const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center
196
184
  size: {
197
185
  default: "h-8 text-sm",
198
186
  sm: "h-7 text-xs",
199
- lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
187
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
200
188
  },
201
189
  },
202
190
  defaultVariants: {
@@ -204,10 +192,10 @@ const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center
204
192
  size: "default",
205
193
  },
206
194
  });
207
- const SidebarMenuButton = React.forwardRef(({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }, ref) => {
195
+ function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
208
196
  const Comp = asChild ? Slot : "button";
209
197
  const { isMobile, state } = useSidebar();
210
- const button = (<Comp ref={ref} data-sidebar="menu-button" data-size={size} data-active={isActive} className={cn(sidebarMenuButtonVariants({ variant, size }), className)} {...props}/>);
198
+ const button = (<Comp data-slot="sidebar-menu-button" data-sidebar="menu-button" data-size={size} data-active={isActive} className={cn(sidebarMenuButtonVariants({ variant, size }), className)} {...props}/>);
211
199
  if (!tooltip) {
212
200
  return button;
213
201
  }
@@ -217,41 +205,40 @@ const SidebarMenuButton = React.forwardRef(({ asChild = false, isActive = false,
217
205
  };
218
206
  }
219
207
  return (<Tooltip>
220
- <TooltipTrigger asChild>{button}</TooltipTrigger>
221
- <TooltipContent side="right" align="center" hidden={state !== "collapsed" || isMobile} {...tooltip}/>
222
- </Tooltip>);
223
- });
224
- SidebarMenuButton.displayName = "SidebarMenuButton";
225
- const SidebarMenuAction = React.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
208
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
209
+ <TooltipContent side="right" align="center" hidden={state !== "collapsed" || isMobile} {...tooltip}/>
210
+ </Tooltip>);
211
+ }
212
+ function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
226
213
  const Comp = asChild ? Slot : "button";
227
- return (<Comp ref={ref} data-sidebar="menu-action" className={cn("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
214
+ return (<Comp data-slot="sidebar-menu-action" data-sidebar="menu-action" className={cn("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",
228
215
  // Increases the hit area of the button on mobile.
229
- "after:absolute after:-inset-2 after:md:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover &&
230
- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0", className)} {...props}/>);
231
- });
232
- SidebarMenuAction.displayName = "SidebarMenuAction";
233
- const SidebarMenuBadge = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} data-sidebar="menu-badge" className={cn("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className)} {...props}/>));
234
- SidebarMenuBadge.displayName = "SidebarMenuBadge";
235
- const SidebarMenuSkeleton = React.forwardRef(({ className, showIcon = false, ...props }, ref) => {
216
+ "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover &&
217
+ "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", className)} {...props}/>);
218
+ }
219
+ function SidebarMenuBadge({ className, ...props }) {
220
+ return (<div data-slot="sidebar-menu-badge" data-sidebar="menu-badge" className={cn("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", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
221
+ }
222
+ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
236
223
  // Random width between 50 to 90%.
237
224
  const width = React.useMemo(() => {
238
225
  return `${Math.floor(Math.random() * 40) + 50}%`;
239
226
  }, []);
240
- return (<div ref={ref} data-sidebar="menu-skeleton" className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)} {...props}>
227
+ return (<div data-slot="sidebar-menu-skeleton" data-sidebar="menu-skeleton" className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)} {...props}>
241
228
  {showIcon && (<Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon"/>)}
242
- <Skeleton className="h-4 max-w-[--skeleton-width] flex-1" data-sidebar="menu-skeleton-text" style={{
229
+ <Skeleton className="h-4 max-w-(--skeleton-width) flex-1" data-sidebar="menu-skeleton-text" style={{
243
230
  "--skeleton-width": width,
244
231
  }}/>
245
232
  </div>);
246
- });
247
- SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
248
- const SidebarMenuSub = React.forwardRef(({ className, ...props }, ref) => (<ul ref={ref} data-sidebar="menu-sub" className={cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className)} {...props}/>));
249
- SidebarMenuSub.displayName = "SidebarMenuSub";
250
- const SidebarMenuSubItem = React.forwardRef(({ ...props }, ref) => <li ref={ref} {...props}/>);
251
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
252
- const SidebarMenuSubButton = React.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
233
+ }
234
+ function SidebarMenuSub({ className, ...props }) {
235
+ return (<ul data-slot="sidebar-menu-sub" data-sidebar="menu-sub" className={cn("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", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
236
+ }
237
+ function SidebarMenuSubItem({ className, ...props }) {
238
+ return (<li data-slot="sidebar-menu-sub-item" data-sidebar="menu-sub-item" className={cn("group/menu-sub-item relative", className)} {...props}/>);
239
+ }
240
+ function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
253
241
  const Comp = asChild ? Slot : "a";
254
- return (<Comp ref={ref} data-sidebar="menu-sub-button" data-size={size} data-active={isActive} className={cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring 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 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
255
- });
256
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
242
+ return (<Comp data-slot="sidebar-menu-sub-button" data-sidebar="menu-sub-button" data-size={size} data-active={isActive} className={cn("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", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className)} {...props}/>);
243
+ }
257
244
  export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
package/ui/skeleton.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
1
+ declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
2
2
  export { Skeleton };
package/ui/skeleton.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cn } from "../lib/utils";
2
2
  function Skeleton({ className, ...props }) {
3
- return (<div className={cn("animate-pulse rounded-md bg-muted", className)} {...props}/>);
3
+ return (<div data-slot="skeleton" className={cn("bg-accent animate-pulse rounded-md", className)} {...props}/>);
4
4
  }
5
5
  export { Skeleton };
package/ui/slider.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import * as React from "react";
2
2
  import * as SliderPrimitive from "@radix-ui/react-slider";
3
- declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
3
+ declare function Slider({ className, defaultValue, value, min, max, ...props }: React.ComponentProps<typeof SliderPrimitive.Root>): React.JSX.Element;
4
4
  export { Slider };