import { useRef } from 'react' ; import { Button } from './button' ; import { TooltipRect , useTooltip } from './tooltip' ; import { ButtonProps } from './types' ; export const TooltipButton = ( props ) => { const { tooltip : { label , ... rect } , ... rest } = props ; const buttonRef = useRef < HTMLButtonElement > ( null ) ; const tooltipTrigger = useTooltip < HTMLButtonElement > ( { tooltip : label , target : buttonRef , ... rect } ) ; return < Button { ... rest } { ... tooltipTrigger } ref = { buttonRef } / > ; } ;