({
render,
isActive = false,
variant = "default",
size = "default",
tooltip,
className,
...props
}: useRender.ComponentProps<"button"> &
React.ComponentProps<"button"> & {
isActive?: boolean
tooltip?: string | React.ComponentProps<typeof TooltipContent>
} & VariantProps<typeof sidebarMenuButtonVariants>)
| 506 | ) |
| 507 | |
| 508 | function SidebarMenuButton({ |
| 509 | render, |
| 510 | isActive = false, |
| 511 | variant = "default", |
| 512 | size = "default", |
| 513 | tooltip, |
| 514 | className, |
| 515 | ...props |
| 516 | }: useRender.ComponentProps<"button"> & |
| 517 | React.ComponentProps<"button"> & { |
| 518 | isActive?: boolean |
| 519 | tooltip?: string | React.ComponentProps<typeof TooltipContent> |
| 520 | } & VariantProps<typeof sidebarMenuButtonVariants>) { |
| 521 | const { isMobile, state } = useSidebar() |
| 522 | const comp = useRender({ |
| 523 | defaultTagName: "button", |
| 524 | props: mergeProps<"button">( |
| 525 | { |
| 526 | className: cn(sidebarMenuButtonVariants({ variant, size }), className), |
| 527 | }, |
| 528 | props |
| 529 | ), |
| 530 | render: !tooltip ? render : <TooltipTrigger render={render} />, |
| 531 | state: { |
| 532 | slot: "sidebar-menu-button", |
| 533 | sidebar: "menu-button", |
| 534 | size, |
| 535 | active: isActive, |
| 536 | }, |
| 537 | }) |
| 538 | |
| 539 | if (!tooltip) { |
| 540 | return comp |
| 541 | } |
| 542 | |
| 543 | if (typeof tooltip === "string") { |
| 544 | tooltip = { |
| 545 | children: tooltip, |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | return ( |
| 550 | <Tooltip> |
| 551 | {comp} |
| 552 | <TooltipContent |
| 553 | side="right" |
| 554 | align="center" |
| 555 | hidden={state !== "collapsed" || isMobile} |
| 556 | {...tooltip} |
| 557 | /> |
| 558 | </Tooltip> |
| 559 | ) |
| 560 | } |
| 561 | |
| 562 | function SidebarMenuAction({ |
| 563 | className, |
nothing calls this directly
no test coverage detected