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 = ({
158158 }
159159 } , [ show ] )
160160
161- const handleShowTooltipDelayed = ( ) => {
161+ const handleShowTooltipDelayed = ( delay = delayShow ) => {
162162 if ( tooltipShowDelayTimerRef . current ) {
163163 clearTimeout ( tooltipShowDelayTimerRef . current )
164164 }
165165
166166 tooltipShowDelayTimerRef . current = setTimeout ( ( ) => {
167167 handleShow ( true )
168- } , delayShow )
168+ } , delay )
169169 }
170170
171171 const handleHideTooltipDelayed = ( delay = delayHide ) => {
@@ -672,10 +672,18 @@ const Tooltip = ({
672672 }
673673 }
674674 setImperativeOptions ( options ?? null )
675- handleShow ( true )
675+ if ( options ?. delay ) {
676+ handleShowTooltipDelayed ( options . delay )
677+ } else {
678+ handleShow ( true )
679+ }
676680 } ,
677- close : ( ) => {
678- handleShow ( false )
681+ close : ( options ) => {
682+ if ( options ?. delay ) {
683+ handleHideTooltipDelayed ( options . delay )
684+ } else {
685+ handleShow ( false )
686+ }
679687 } ,
680688 activeAnchor,
681689 place : actualPlacement ,
Original file line number Diff line number Diff line change @@ -54,11 +54,16 @@ export interface TooltipImperativeOpenOptions {
5454 position ?: IPosition
5555 place ?: PlacesType
5656 content ?: ChildrenType
57+ delay ?: number
58+ }
59+
60+ export interface TooltipImperativeCloseOptions {
61+ delay ?: number
5762}
5863
5964export interface TooltipImperativeProps {
6065 open : ( options ?: TooltipImperativeOpenOptions ) => void
61- close : ( ) => void
66+ close : ( options ?: TooltipImperativeCloseOptions ) => void
6267 /**
6368 * @readonly
6469 */
You can’t perform that action at this time.
0 commit comments