@@ -569,6 +569,28 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) {
569
569
const classes = useUtilityClasses ( ownerState ) ;
570
570
571
571
const [ SlotRoot , rootProps ] = useSlot ( 'root' , {
572
+ additionalProps : {
573
+ component : PopperUnstyled ,
574
+ id,
575
+ popperRef,
576
+ placement,
577
+ popperOptions,
578
+ anchorEl : followCursor
579
+ ? {
580
+ getBoundingClientRect : ( ) =>
581
+ ( {
582
+ top : positionRef . current . y ,
583
+ left : positionRef . current . x ,
584
+ right : positionRef . current . x ,
585
+ bottom : positionRef . current . y ,
586
+ width : 0 ,
587
+ height : 0 ,
588
+ } as DOMRect ) ,
589
+ }
590
+ : childNode ,
591
+ open : childNode ? open : false ,
592
+ ...interactiveWrapperListeners ,
593
+ } ,
572
594
ref,
573
595
className : classes . root ,
574
596
elementType : TooltipRoot ,
@@ -577,6 +599,9 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) {
577
599
} ) ;
578
600
579
601
const [ SlotArrow , arrowProps ] = useSlot ( 'arrow' , {
602
+ additionalProps : {
603
+ ref : setArrowRef ,
604
+ } ,
580
605
className : classes . arrow ,
581
606
elementType : TooltipArrow ,
582
607
externalForwardedProps : other ,
@@ -586,34 +611,10 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) {
586
611
return (
587
612
< React . Fragment >
588
613
{ React . isValidElement ( children ) && React . cloneElement ( children , childrenProps ) }
589
- < PopperUnstyled
590
- component = { SlotRoot }
591
- placement = { placement }
592
- anchorEl = {
593
- followCursor
594
- ? {
595
- getBoundingClientRect : ( ) =>
596
- ( {
597
- top : positionRef . current . y ,
598
- left : positionRef . current . x ,
599
- right : positionRef . current . x ,
600
- bottom : positionRef . current . y ,
601
- width : 0 ,
602
- height : 0 ,
603
- } as DOMRect ) ,
604
- }
605
- : childNode
606
- }
607
- popperRef = { popperRef }
608
- open = { childNode ? open : false }
609
- id = { id }
610
- { ...interactiveWrapperListeners }
611
- { ...rootProps }
612
- popperOptions = { popperOptions }
613
- >
614
+ < SlotRoot { ...rootProps } >
614
615
{ title }
615
- { arrow ? < SlotArrow ref = { setArrowRef } { ...arrowProps } /> : null }
616
- </ PopperUnstyled >
616
+ { arrow ? < SlotArrow { ...arrowProps } /> : null }
617
+ </ SlotRoot >
617
618
</ React . Fragment >
618
619
) ;
619
620
} ) as OverridableComponent < TooltipTypeMap > ;
0 commit comments