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