react-tooltip 5.26.4 → 5.27.0-beta.1205.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/beta-release.js +77 -0
- package/dist/react-tooltip.cjs +31 -37
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.d.ts +2 -0
- package/dist/react-tooltip.min.cjs +2 -2
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.mjs +2 -2
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +31 -37
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +31 -37
- package/dist/react-tooltip.umd.js.map +1 -1
- package/dist/react-tooltip.umd.min.js +2 -2
- package/dist/react-tooltip.umd.min.js.map +1 -1
- package/package.json +2 -1
package/dist/react-tooltip.mjs
CHANGED
|
@@ -282,6 +282,14 @@ const getScrollParent = (node) => {
|
|
|
282
282
|
|
|
283
283
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
284
284
|
|
|
285
|
+
const clearTimeoutRef = (ref) => {
|
|
286
|
+
if (ref.current) {
|
|
287
|
+
clearTimeout(ref.current);
|
|
288
|
+
// eslint-disable-next-line no-param-reassign
|
|
289
|
+
ref.current = null;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
285
293
|
const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
|
|
286
294
|
const DEFAULT_CONTEXT_DATA = {
|
|
287
295
|
anchorRefs: new Set(),
|
|
@@ -420,8 +428,9 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
420
428
|
const actualOpenEvents = openEvents
|
|
421
429
|
? { ...openEvents }
|
|
422
430
|
: {
|
|
423
|
-
|
|
431
|
+
mouseover: true,
|
|
424
432
|
focus: true,
|
|
433
|
+
mouseenter: false,
|
|
425
434
|
click: false,
|
|
426
435
|
dblclick: false,
|
|
427
436
|
mousedown: false,
|
|
@@ -430,14 +439,16 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
430
439
|
Object.assign(actualOpenEvents, {
|
|
431
440
|
mouseenter: false,
|
|
432
441
|
focus: false,
|
|
442
|
+
mouseover: false,
|
|
433
443
|
click: true,
|
|
434
444
|
});
|
|
435
445
|
}
|
|
436
446
|
const actualCloseEvents = closeEvents
|
|
437
447
|
? { ...closeEvents }
|
|
438
448
|
: {
|
|
439
|
-
|
|
449
|
+
mouseout: true,
|
|
440
450
|
blur: true,
|
|
451
|
+
mouseleave: false,
|
|
441
452
|
click: false,
|
|
442
453
|
dblclick: false,
|
|
443
454
|
mouseup: false,
|
|
@@ -446,6 +457,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
446
457
|
Object.assign(actualCloseEvents, {
|
|
447
458
|
mouseleave: false,
|
|
448
459
|
blur: false,
|
|
460
|
+
mouseout: false,
|
|
449
461
|
});
|
|
450
462
|
}
|
|
451
463
|
const actualGlobalCloseEvents = globalCloseEvents
|
|
@@ -532,9 +544,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
532
544
|
if (show === wasShowing.current) {
|
|
533
545
|
return;
|
|
534
546
|
}
|
|
535
|
-
|
|
536
|
-
clearTimeout(missedTransitionTimerRef.current);
|
|
537
|
-
}
|
|
547
|
+
clearTimeoutRef(missedTransitionTimerRef);
|
|
538
548
|
wasShowing.current = show;
|
|
539
549
|
if (show) {
|
|
540
550
|
afterShow === null || afterShow === void 0 ? void 0 : afterShow();
|
|
@@ -563,9 +573,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
563
573
|
: newComputedPosition);
|
|
564
574
|
};
|
|
565
575
|
const handleShowTooltipDelayed = (delay = delayShow) => {
|
|
566
|
-
|
|
567
|
-
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
568
|
-
}
|
|
576
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
569
577
|
if (rendered) {
|
|
570
578
|
// if the tooltip is already rendered, ignore delay
|
|
571
579
|
handleShow(true);
|
|
@@ -576,9 +584,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
576
584
|
}, delay);
|
|
577
585
|
};
|
|
578
586
|
const handleHideTooltipDelayed = (delay = delayHide) => {
|
|
579
|
-
|
|
580
|
-
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
581
|
-
}
|
|
587
|
+
clearTimeoutRef(tooltipHideDelayTimerRef);
|
|
582
588
|
tooltipHideDelayTimerRef.current = setTimeout(() => {
|
|
583
589
|
if (hoveringTooltip.current) {
|
|
584
590
|
return;
|
|
@@ -609,9 +615,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
609
615
|
}
|
|
610
616
|
setActiveAnchor(target);
|
|
611
617
|
setProviderActiveAnchor({ current: target });
|
|
612
|
-
|
|
613
|
-
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
614
|
-
}
|
|
618
|
+
clearTimeoutRef(tooltipHideDelayTimerRef);
|
|
615
619
|
};
|
|
616
620
|
const handleHideTooltip = () => {
|
|
617
621
|
if (clickable) {
|
|
@@ -624,9 +628,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
624
628
|
else {
|
|
625
629
|
handleShow(false);
|
|
626
630
|
}
|
|
627
|
-
|
|
628
|
-
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
629
|
-
}
|
|
631
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
630
632
|
};
|
|
631
633
|
const handleTooltipPosition = ({ x, y }) => {
|
|
632
634
|
var _a;
|
|
@@ -687,9 +689,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
687
689
|
return;
|
|
688
690
|
}
|
|
689
691
|
handleShow(false);
|
|
690
|
-
|
|
691
|
-
clearTimeout(tooltipShowDelayTimerRef.current);
|
|
692
|
-
}
|
|
692
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
693
693
|
};
|
|
694
694
|
// debounce handler to prevent call twice when
|
|
695
695
|
// mouse enter and focus events being triggered toggether
|
|
@@ -827,7 +827,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
827
827
|
}
|
|
828
828
|
handleHideTooltip();
|
|
829
829
|
};
|
|
830
|
-
const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur'];
|
|
830
|
+
const regularEvents = ['mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'focus', 'blur'];
|
|
831
831
|
const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup'];
|
|
832
832
|
Object.entries(actualOpenEvents).forEach(([event, enabled]) => {
|
|
833
833
|
if (!enabled) {
|
|
@@ -973,12 +973,8 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
973
973
|
setRendered(false);
|
|
974
974
|
handleShow(false);
|
|
975
975
|
setActiveAnchor(null);
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
}
|
|
979
|
-
if (tooltipHideDelayTimerRef.current) {
|
|
980
|
-
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
981
|
-
}
|
|
976
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
977
|
+
clearTimeoutRef(tooltipHideDelayTimerRef);
|
|
982
978
|
return true;
|
|
983
979
|
}
|
|
984
980
|
return false;
|
|
@@ -1057,12 +1053,8 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
1057
1053
|
handleShow(true);
|
|
1058
1054
|
}
|
|
1059
1055
|
return () => {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
}
|
|
1063
|
-
if (tooltipHideDelayTimerRef.current) {
|
|
1064
|
-
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
1065
|
-
}
|
|
1056
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
1057
|
+
clearTimeoutRef(tooltipHideDelayTimerRef);
|
|
1066
1058
|
};
|
|
1067
1059
|
}, []);
|
|
1068
1060
|
useEffect(() => {
|
|
@@ -1085,7 +1077,11 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
1085
1077
|
}, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect]);
|
|
1086
1078
|
useEffect(() => {
|
|
1087
1079
|
if (tooltipShowDelayTimerRef.current) {
|
|
1088
|
-
|
|
1080
|
+
/**
|
|
1081
|
+
* if the delay changes while the tooltip is waiting to show,
|
|
1082
|
+
* reset the timer with the new delay
|
|
1083
|
+
*/
|
|
1084
|
+
clearTimeoutRef(tooltipShowDelayTimerRef);
|
|
1089
1085
|
handleShowTooltipDelayed(delayShow);
|
|
1090
1086
|
}
|
|
1091
1087
|
}, [delayShow]);
|
|
@@ -1126,9 +1122,7 @@ content, contentWrapperRef, isOpen, defaultIsOpen = false, setIsOpen, activeAnch
|
|
|
1126
1122
|
isOpen: Boolean(rendered && !hidden && actualContent && canShow),
|
|
1127
1123
|
}));
|
|
1128
1124
|
return rendered && !hidden && actualContent ? (React.createElement(WrapperElement, { id: id, role: role, className: classNames('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${computedPosition.place}`, coreStyles[canShow ? 'show' : 'closing'], canShow ? 'react-tooltip__show' : 'react-tooltip__closing', positionStrategy === 'fixed' && coreStyles['fixed'], clickable && coreStyles['clickable']), onTransitionEnd: (event) => {
|
|
1129
|
-
|
|
1130
|
-
clearTimeout(missedTransitionTimerRef.current);
|
|
1131
|
-
}
|
|
1125
|
+
clearTimeoutRef(missedTransitionTimerRef);
|
|
1132
1126
|
if (show || event.propertyName !== 'opacity') {
|
|
1133
1127
|
return;
|
|
1134
1128
|
}
|