({
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>)
| 497 | ) |
| 498 | |
| 499 | function SidebarMenuButton({ |
| 500 | asChild = false, |
| 501 | isActive = false, |
| 502 | variant = "default", |
| 503 | size = "default", |
| 504 | tooltip, |
| 505 | className, |
| 506 | ...props |
| 507 | }: React.ComponentProps<"button"> & { |
| 508 | asChild?: boolean |
| 509 | isActive?: boolean |
| 510 | tooltip?: string | React.ComponentProps<typeof TooltipContent> |
| 511 | } & VariantProps<typeof sidebarMenuButtonVariants>) { |
| 512 | const Comp = asChild ? Slot : "button" |
| 513 | const { isMobile, state } = useSidebar() |
| 514 | |
| 515 | const button = ( |
| 516 | <Comp |
| 517 | data-slot="sidebar-menu-button" |
| 518 | data-sidebar="menu-button" |
| 519 | data-size={size} |
| 520 | data-active={isActive} |
| 521 | className={cn(sidebarMenuButtonVariants({ variant, size }), className)} |
| 522 | {...props} |
| 523 | /> |
| 524 | ) |
| 525 | |
| 526 | if (!tooltip) { |
| 527 | return button |
| 528 | } |
| 529 | |
| 530 | if (typeof tooltip === "string") { |
| 531 | tooltip = { |
| 532 | children: tooltip, |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | return ( |
| 537 | <Tooltip> |
| 538 | <TooltipTrigger asChild>{button}</TooltipTrigger> |
| 539 | <TooltipContent |
| 540 | side="right" |
| 541 | align="center" |
| 542 | hidden={state !== "collapsed" || isMobile} |
| 543 | {...tooltip} |
| 544 | /> |
| 545 | </Tooltip> |
| 546 | ) |
| 547 | } |
| 548 | |
| 549 | function SidebarMenuAction({ |
| 550 | className, |
nothing calls this directly
no test coverage detected