File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -158,14 +158,14 @@ const Tooltip = ({
158
158
}
159
159
} , [ show ] )
160
160
161
- const handleShowTooltipDelayed = ( ) => {
161
+ const handleShowTooltipDelayed = ( delay = delayShow ) => {
162
162
if ( tooltipShowDelayTimerRef . current ) {
163
163
clearTimeout ( tooltipShowDelayTimerRef . current )
164
164
}
165
165
166
166
tooltipShowDelayTimerRef . current = setTimeout ( ( ) => {
167
167
handleShow ( true )
168
- } , delayShow )
168
+ } , delay )
169
169
}
170
170
171
171
const handleHideTooltipDelayed = ( delay = delayHide ) => {
@@ -672,10 +672,18 @@ const Tooltip = ({
672
672
}
673
673
}
674
674
setImperativeOptions ( options ?? null )
675
- handleShow ( true )
675
+ if ( options ?. delay ) {
676
+ handleShowTooltipDelayed ( options . delay )
677
+ } else {
678
+ handleShow ( true )
679
+ }
676
680
} ,
677
- close : ( ) => {
678
- handleShow ( false )
681
+ close : ( options ) => {
682
+ if ( options ?. delay ) {
683
+ handleHideTooltipDelayed ( options . delay )
684
+ } else {
685
+ handleShow ( false )
686
+ }
679
687
} ,
680
688
activeAnchor,
681
689
place : actualPlacement ,
Original file line number Diff line number Diff line change @@ -54,11 +54,16 @@ export interface TooltipImperativeOpenOptions {
54
54
position ?: IPosition
55
55
place ?: PlacesType
56
56
content ?: ChildrenType
57
+ delay ?: number
58
+ }
59
+
60
+ export interface TooltipImperativeCloseOptions {
61
+ delay ?: number
57
62
}
58
63
59
64
export interface TooltipImperativeProps {
60
65
open : ( options ?: TooltipImperativeOpenOptions ) => void
61
- close : ( ) => void
66
+ close : ( options ?: TooltipImperativeCloseOptions ) => void
62
67
/**
63
68
* @readonly
64
69
*/
You can’t perform that action at this time.
0 commit comments