File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const Tooltip = ({
45
45
activeAnchor,
46
46
setActiveAnchor,
47
47
border,
48
+ opacity,
48
49
} : ITooltip ) => {
49
50
const tooltipRef = useRef < HTMLElement > ( null )
50
51
const tooltipArrowRef = useRef < HTMLElement > ( null )
@@ -598,7 +599,11 @@ const Tooltip = ({
598
599
[ coreStyles [ 'clickable' ] ] : clickable ,
599
600
} ,
600
601
) }
601
- style = { { ...externalStyles , ...inlineStyles } }
602
+ style = { {
603
+ ...externalStyles ,
604
+ ...inlineStyles ,
605
+ opacity : opacity !== undefined && canShow ? opacity : undefined ,
606
+ } }
602
607
ref = { tooltipRef }
603
608
>
604
609
{ content }
Original file line number Diff line number Diff line change @@ -90,4 +90,5 @@ export interface ITooltip {
90
90
activeAnchor : HTMLElement | null
91
91
setActiveAnchor : ( anchor : HTMLElement | null ) => void
92
92
border ?: CSSProperties [ 'border' ]
93
+ opacity ?: CSSProperties [ 'opacity' ]
93
94
}
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const TooltipController = ({
45
45
position,
46
46
isOpen,
47
47
border,
48
+ opacity,
48
49
setIsOpen,
49
50
afterShow,
50
51
afterHide,
@@ -248,6 +249,14 @@ const TooltipController = ({
248
249
// eslint-disable-next-line no-console
249
250
console . warn ( `[react-tooltip] "${ border } " is not a valid \`border\`.` )
250
251
}
252
+ if ( style ?. opacity ) {
253
+ // eslint-disable-next-line no-console
254
+ console . warn ( '[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.' )
255
+ }
256
+ if ( opacity && ! CSS . supports ( 'opacity' , `${ opacity } ` ) ) {
257
+ // eslint-disable-next-line no-console
258
+ console . warn ( `[react-tooltip] "${ opacity } " is not a valid \`opacity\`.` )
259
+ }
251
260
} , [ ] )
252
261
253
262
/**
@@ -299,6 +308,7 @@ const TooltipController = ({
299
308
position,
300
309
isOpen,
301
310
border,
311
+ opacity,
302
312
setIsOpen,
303
313
afterShow,
304
314
afterHide,
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export interface ITooltipController {
67
67
* might break the tooltip arrow positioning.
68
68
*/
69
69
border ?: CSSProperties [ 'border' ]
70
+ opacity ?: CSSProperties [ 'opacity' ]
70
71
setIsOpen ?: ( value : boolean ) => void
71
72
afterShow ?: ( ) => void
72
73
afterHide ?: ( ) => void
You can’t perform that action at this time.
0 commit comments