({
asChild = false,
isActive = false,
variant = "default",
size = "default",
tooltip,
className,
...props
}: React.ComponentProps<"button"> & {
asChild?: boolean;
isActive?: boolean;
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
} & VariantProps<typeof sidebarMenuButtonVariants>)
| 468 | ); |
| 469 | |
| 470 | function SidebarMenuButton({ |
| 471 | asChild = false, |
| 472 | isActive = false, |
| 473 | variant = "default", |
| 474 | size = "default", |
| 475 | tooltip, |
| 476 | className, |
| 477 | ...props |
| 478 | }: React.ComponentProps<"button"> & { |
| 479 | asChild?: boolean; |
| 480 | isActive?: boolean; |
| 481 | tooltip?: string | React.ComponentProps<typeof TooltipContent>; |
| 482 | } & VariantProps<typeof sidebarMenuButtonVariants>) { |
| 483 | const Comp = asChild ? Slot.Root : "button"; |
| 484 | const { isMobile, state } = useSidebar(); |
| 485 | |
| 486 | const button = ( |
| 487 | <Comp |
| 488 | data-slot="sidebar-menu-button" |
| 489 | data-sidebar="menu-button" |
| 490 | data-size={size} |
| 491 | data-active={isActive} |
| 492 | className={cn(sidebarMenuButtonVariants({ variant, size }), className)} |
| 493 | {...props} |
| 494 | /> |
| 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 | /> |
| 516 | </Tooltip> |
| 517 | ); |
| 518 | } |
| 519 | |
| 520 | function SidebarMenuAction({ |
| 521 | className, |
nothing calls this directly
no test coverage detected