diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index d96719c..1f4462f 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,19 +1,19 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" import { cva, type VariantProps } from "class-variance-authority" +import { Slot } from "radix-ui" +import type * as React from "react" import { cn } from "@/lib/utils" const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", + "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { default: "bg-primary text-primary-foreground hover:bg-primary/90", destructive: - "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40", outline: - "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", + "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: @@ -22,33 +22,39 @@ const buttonVariants = cva( }, size: { default: "h-9 px-4 py-2 has-[>svg]:px-3", - sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", + xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3", + sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5", lg: "h-10 rounded-md px-6 has-[>svg]:px-4", icon: "size-9", + "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3", + "icon-sm": "size-8", + "icon-lg": "size-10", }, }, defaultVariants: { variant: "default", size: "default", }, - } + }, ) function Button({ className, - variant, - size, + variant = "default", + size = "default", asChild = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot.Root : "button" return ( diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index 97f4c2e..ebf9c54 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,4 +1,4 @@ -import * as React from "react" +import type * as React from "react" import { cn } from "@/lib/utils" @@ -7,8 +7,8 @@ function Card({ className, ...props }: React.ComponentProps<"div">) {
@@ -20,8 +20,8 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -42,7 +42,7 @@ function CardDescription({ className, ...props }: React.ComponentProps<"div">) { return (
) @@ -54,7 +54,7 @@ function CardAction({ className, ...props }: React.ComponentProps<"div">) { data-slot="card-action" className={cn( "col-start-2 row-span-2 row-start-1 self-start justify-self-end", - className, + className )} {...props} /> @@ -83,10 +83,10 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) { export { Card, - CardAction, - CardContent, - CardDescription, - CardFooter, CardHeader, + CardFooter, CardTitle, + CardAction, + CardDescription, + CardContent, } diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx index fa0e4b5..526f046 100644 --- a/src/components/ui/checkbox.tsx +++ b/src/components/ui/checkbox.tsx @@ -1,8 +1,8 @@ "use client" -import * as React from "react" -import * as CheckboxPrimitive from "@radix-ui/react-checkbox" +import type * as React from "react" import { CheckIcon } from "lucide-react" +import { Checkbox as CheckboxPrimitive } from "radix-ui" import { cn } from "@/lib/utils" @@ -14,14 +14,14 @@ function Checkbox({ diff --git a/src/components/ui/collapsible.tsx b/src/components/ui/collapsible.tsx index 61cfdf3..2f7a4e7 100644 --- a/src/components/ui/collapsible.tsx +++ b/src/components/ui/collapsible.tsx @@ -1,6 +1,6 @@ "use client" -import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" +import { Collapsible as CollapsiblePrimitive } from "radix-ui" function Collapsible({ ...props @@ -30,4 +30,4 @@ function CollapsibleContent({ ) } -export { Collapsible, CollapsibleContent, CollapsibleTrigger } +export { Collapsible, CollapsibleTrigger, CollapsibleContent } diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index d6f286e..0b49e06 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,10 +1,11 @@ "use client" -import * as DialogPrimitive from "@radix-ui/react-dialog" +import type * as React from "react" import { XIcon } from "lucide-react" -import * as React from "react" +import { Dialog as DialogPrimitive } from "radix-ui" import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" function Dialog({ ...props @@ -38,8 +39,8 @@ function DialogOverlay({ @@ -49,24 +50,32 @@ function DialogOverlay({ function DialogContent({ className, children, + showCloseButton = true, ...props -}: React.ComponentProps) { +}: React.ComponentProps & { + showCloseButton?: boolean +}) { return ( {children} - - - Close - + {showCloseButton && ( + + + Close + + )} ) @@ -82,16 +91,30 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { ) } -function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { +function DialogFooter({ + className, + showCloseButton = false, + children, + ...props +}: React.ComponentProps<"div"> & { + showCloseButton?: boolean +}) { return (
+ > + {children} + {showCloseButton && ( + + + + )} +
) } @@ -115,7 +138,7 @@ function DialogDescription({ return ( ) diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index 87221c8..2bcf798 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -1,8 +1,8 @@ "use client" -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" +import type * as React from "react" import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react" -import * as React from "react" +import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui" import { cn } from "@/lib/utils" @@ -42,8 +42,8 @@ function DropdownMenuContent({ data-slot="dropdown-menu-content" sideOffset={sideOffset} className={cn( - "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", - className, + "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", + className )} {...props} /> @@ -74,8 +74,8 @@ function DropdownMenuItem({ data-inset={inset} data-variant={variant} className={cn( - "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", - className, + "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!", + className )} {...props} /> @@ -92,8 +92,8 @@ function DropdownMenuCheckboxItem({ @@ -156,7 +156,7 @@ function DropdownMenuLabel({ data-inset={inset} className={cn( "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", - className, + className )} {...props} /> @@ -170,7 +170,7 @@ function DropdownMenuSeparator({ return ( ) @@ -184,8 +184,8 @@ function DropdownMenuShortcut({ @@ -211,8 +211,8 @@ function DropdownMenuSubTrigger({ data-slot="dropdown-menu-sub-trigger" data-inset={inset} className={cn( - "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", - className, + "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", + className )} {...props} > @@ -230,8 +230,8 @@ function DropdownMenuSubContent({ @@ -240,18 +240,18 @@ function DropdownMenuSubContent({ export { DropdownMenu, - DropdownMenuCheckboxItem, + DropdownMenuPortal, + DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, - DropdownMenuItem, DropdownMenuLabel, - DropdownMenuPortal, + DropdownMenuItem, + DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, - DropdownMenuSubContent, DropdownMenuSubTrigger, - DropdownMenuTrigger, + DropdownMenuSubContent, } diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 8916905..992a505 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -1,4 +1,4 @@ -import * as React from "react" +import type * as React from "react" import { cn } from "@/lib/utils" @@ -8,9 +8,9 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) { type={type} data-slot="input" className={cn( - "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", - "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", - "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", + "h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", + "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", + "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className )} {...props} diff --git a/src/components/ui/pagination.tsx b/src/components/ui/pagination.tsx index 0d18541..a8f9b2e 100755 --- a/src/components/ui/pagination.tsx +++ b/src/components/ui/pagination.tsx @@ -1,4 +1,4 @@ -import * as React from "react" +import type * as React from "react" import { ChevronLeftIcon, ChevronRightIcon, @@ -6,7 +6,7 @@ import { } from "lucide-react" import { cn } from "@/lib/utils" -import { Button, buttonVariants } from "@/components/ui/button" +import { buttonVariants, type Button } from "@/components/ui/button" function Pagination({ className, ...props }: React.ComponentProps<"nav">) { return ( diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator.tsx index 71d2f29..36aabcf 100644 --- a/src/components/ui/separator.tsx +++ b/src/components/ui/separator.tsx @@ -1,7 +1,7 @@ "use client" -import * as SeparatorPrimitive from "@radix-ui/react-separator" -import * as React from "react" +import type * as React from "react" +import { Separator as SeparatorPrimitive } from "radix-ui" import { cn } from "@/lib/utils" @@ -13,12 +13,12 @@ function Separator({ }: React.ComponentProps) { return ( diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx index 0482e87..66e7797 100644 --- a/src/components/ui/sheet.tsx +++ b/src/components/ui/sheet.tsx @@ -1,8 +1,8 @@ "use client" -import * as SheetPrimitive from "@radix-ui/react-dialog" +import type * as React from "react" import { XIcon } from "lucide-react" -import * as React from "react" +import { Dialog as SheetPrimitive } from "radix-ui" import { cn } from "@/lib/utils" @@ -36,8 +36,8 @@ function SheetOverlay({ @@ -48,9 +48,11 @@ function SheetContent({ className, children, side = "right", + showCloseButton = true, ...props }: React.ComponentProps & { side?: "top" | "right" | "bottom" | "left" + showCloseButton?: boolean }) { return ( @@ -58,24 +60,26 @@ function SheetContent({ {children} - - - Close - + {showCloseButton && ( + + + Close + + )} ) @@ -108,7 +112,7 @@ function SheetTitle({ return ( ) @@ -121,7 +125,7 @@ function SheetDescription({ return ( ) @@ -129,11 +133,11 @@ function SheetDescription({ export { Sheet, + SheetTrigger, SheetClose, SheetContent, - SheetDescription, - SheetFooter, SheetHeader, + SheetFooter, SheetTitle, - SheetTrigger, + SheetDescription, } diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx index 5b4ddb3..778bf99 100644 --- a/src/components/ui/sidebar.tsx +++ b/src/components/ui/sidebar.tsx @@ -1,10 +1,12 @@ "use client" -import { Slot } from "@radix-ui/react-slot" -import { cva, VariantProps } from "class-variance-authority" -import { PanelLeftIcon } from "lucide-react" import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" +import { PanelLeftIcon } from "lucide-react" +import { Slot } from "radix-ui" +import { useIsMobile } from "@/hooks/use-mobile" +import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Separator } from "@/components/ui/separator" @@ -22,8 +24,6 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip" -import { useIsMobile } from "@/hooks/use-mobile" -import { cn } from "@/lib/utils" const SIDEBAR_COOKIE_NAME = "sidebar_state" const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 @@ -85,7 +85,7 @@ function SidebarProvider({ // This sets the cookie to keep the sidebar state. document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` }, - [setOpenProp, open], + [setOpenProp, open] ) // Helper to toggle the sidebar. @@ -123,7 +123,7 @@ function SidebarProvider({ setOpenMobile, toggleSidebar, }), - [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar], + [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar] ) return ( @@ -139,8 +139,8 @@ function SidebarProvider({ } as React.CSSProperties } className={cn( - "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", - className, + "group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", + className )} {...props} > @@ -170,8 +170,8 @@ function Sidebar({
@@ -187,7 +187,7 @@ function Sidebar({ data-sidebar="sidebar" data-slot="sidebar" data-mobile="true" - className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden" + className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden" style={ { "--sidebar-width": SIDEBAR_WIDTH_MOBILE, @@ -207,7 +207,7 @@ function Sidebar({ return (
{children}
@@ -291,13 +291,13 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) { 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", + "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] hover:after:bg-sidebar-border 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", + "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", - className, + className )} {...props} /> @@ -309,9 +309,9 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
@@ -326,7 +326,7 @@ function SidebarInput({ ) @@ -362,7 +362,7 @@ function SidebarSeparator({ ) @@ -375,7 +375,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) { data-sidebar="content" className={cn( "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", - className, + className )} {...props} /> @@ -398,16 +398,16 @@ function SidebarGroupLabel({ asChild = false, ...props }: React.ComponentProps<"div"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "div" + const Comp = asChild ? Slot.Root : "div" return ( svg]:size-4 [&>svg]:shrink-0", + "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring 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, + className )} {...props} /> @@ -419,18 +419,18 @@ function SidebarGroupAction({ asChild = false, ...props }: React.ComponentProps<"button"> & { asChild?: boolean }) { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot.Root : "button" return ( svg]:size-4 [&>svg]:shrink-0", + "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", // Increases the hit area of the button on mobile. "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", - className, + className )} {...props} /> @@ -474,7 +474,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) { } 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", + "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! 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 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 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", { variants: { variant: { @@ -492,7 +492,7 @@ const sidebarMenuButtonVariants = cva( variant: "default", size: "default", }, - }, + } ) function SidebarMenuButton({ @@ -508,7 +508,7 @@ function SidebarMenuButton({ isActive?: boolean tooltip?: string | React.ComponentProps } & VariantProps) { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot.Root : "button" const { isMobile, state } = useSidebar() const button = ( @@ -554,14 +554,14 @@ function SidebarMenuAction({ asChild?: boolean showOnHover?: boolean }) { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot.Root : "button" return ( svg]:size-4 [&>svg]:shrink-0", + "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", // Increases the hit area of the button on mobile. "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", @@ -569,8 +569,8 @@ function SidebarMenuAction({ "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && - "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, + "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0", + className )} {...props} /> @@ -586,13 +586,13 @@ function SidebarMenuBadge({ 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", + "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground 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, + className )} {...props} /> @@ -643,9 +643,9 @@ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"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", + "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, + className )} {...props} /> @@ -677,7 +677,7 @@ function SidebarMenuSubButton({ size?: "sm" | "md" isActive?: boolean }) { - const Comp = asChild ? Slot : "a" + const Comp = asChild ? Slot.Root : "a" return ( 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", + "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden 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, + className )} {...props} /> diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx index 32ea0ef..3ec6be7 100644 --- a/src/components/ui/skeleton.tsx +++ b/src/components/ui/skeleton.tsx @@ -4,7 +4,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) { return (
) diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsx index 957524e..9b20afe 100644 --- a/src/components/ui/sonner.tsx +++ b/src/components/ui/sonner.tsx @@ -1,7 +1,14 @@ "use client" +import { + CircleCheckIcon, + InfoIcon, + Loader2Icon, + OctagonXIcon, + TriangleAlertIcon, +} from "lucide-react" import { useTheme } from "next-themes" -import { Toaster as Sonner, ToasterProps } from "sonner" +import { Toaster as Sonner, type ToasterProps } from "sonner" const Toaster = ({ ...props }: ToasterProps) => { const { theme = "system" } = useTheme() @@ -10,11 +17,19 @@ const Toaster = ({ ...props }: ToasterProps) => { , + info: , + warning: , + error: , + loading: , + }} style={ { "--normal-bg": "var(--popover)", "--normal-text": "var(--popover-foreground)", "--normal-border": "var(--border)", + "--border-radius": "var(--radius)", } as React.CSSProperties } {...props} diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx index f6b396e..b058c88 100644 --- a/src/components/ui/tooltip.tsx +++ b/src/components/ui/tooltip.tsx @@ -1,7 +1,7 @@ "use client" -import * as TooltipPrimitive from "@radix-ui/react-tooltip" -import * as React from "react" +import type * as React from "react" +import { Tooltip as TooltipPrimitive } from "radix-ui" import { cn } from "@/lib/utils" @@ -21,11 +21,7 @@ function TooltipProvider({ function Tooltip({ ...props }: React.ComponentProps) { - return ( - - - - ) + return } function TooltipTrigger({ @@ -46,16 +42,16 @@ function TooltipContent({ data-slot="tooltip-content" sideOffset={sideOffset} className={cn( - "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", - className, + "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", + className )} {...props} > {children} - + ) } -export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }