@@ -20,17 +20,18 @@ type Timeout = {
2020
2121type Status = "accent" | "danger" | "notification" | "success" | "warning" ;
2222
23- export type ExtendedTooltipProps = Timeout & {
24- caption : React . ReactNode ;
25- children : React . ReactNode ;
26- placement ?: Placement ;
27- position ?: Position ;
28- margin ?: Margin ;
29- status ?: Status ;
30- zIndex ?: number ;
31- display ?: Display ;
32- adjustPositionToViewportSize ?: boolean ;
33- } ;
23+ export type ExtendedTooltipProps = React . HTMLAttributes < HTMLDivElement > &
24+ Timeout & {
25+ caption : React . ReactNode ;
26+ children : React . ReactNode ;
27+ placement ?: Placement ;
28+ position ?: Position ;
29+ margin ?: Margin ;
30+ status ?: Status ;
31+ zIndex ?: number ;
32+ display ?: Display ;
33+ adjustPositionToViewportSize ?: boolean ;
34+ } ;
3435
3536export function ExtendedTooltip ( {
3637 caption,
@@ -44,6 +45,7 @@ export function ExtendedTooltip({
4445 zIndex = theme . zindex . sticky ,
4546 display,
4647 adjustPositionToViewportSize = false ,
48+ ...rest
4749} : ExtendedTooltipProps ) {
4850 const wrapperRef = React . useRef < HTMLDivElement > ( null ) ;
4951 const tooltipRef = React . useRef < HTMLDivElement > ( null ) ;
@@ -80,7 +82,7 @@ export function ExtendedTooltip({
8082 return < > { children } </ > ;
8183 }
8284
83- const style = {
85+ const positionStyle = {
8486 ...getStyle ( {
8587 wrapperDimensions,
8688 tooltipDimensions,
@@ -105,18 +107,19 @@ export function ExtendedTooltip({
105107 caption = { caption }
106108 tooltipRef = { tooltipRef }
107109 status = { status }
108- style = { style }
110+ positionStyle = { positionStyle }
111+ { ...rest }
109112 />
110113 { children }
111114 </ TooltipWrapper >
112115 ) ;
113116}
114117
115- type TooltipProps = {
118+ type TooltipProps = React . HTMLAttributes < HTMLDivElement > & {
116119 caption : React . ReactNode ;
117120 isHovered : boolean ;
118121 tooltipRef : React . RefObject < HTMLDivElement > ;
119- style : { top ?: number ; left ?: number ; zIndex ?: number } ;
122+ positionStyle : { top ?: number ; left ?: number ; zIndex ?: number } ;
120123 status ?: Status ;
121124} ;
122125
@@ -125,16 +128,19 @@ function Tooltip({
125128 isHovered,
126129 tooltipRef,
127130 status,
131+ positionStyle,
128132 style,
133+ ...rest
129134} : TooltipProps ) {
130- const { zIndex = theme . zindex . sticky } = style ;
135+ const { zIndex = theme . zindex . sticky } = positionStyle ;
131136 return isHovered
132137 ? ReactDOM . createPortal (
133138 < StyledTooltip
134139 ref = { tooltipRef }
135140 status = { status }
136- style = { style }
141+ style = { { ... positionStyle , ... style } }
137142 zIndex = { zIndex }
143+ { ...rest }
138144 >
139145 { caption }
140146 </ StyledTooltip > ,
0 commit comments