react-tooltip 5.22.0-beta.1109.0 → 5.22.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.
@@ -5,7 +5,7 @@
5
5
  * @copyright ReactTooltip Team
6
6
  * @license MIT
7
7
  */
8
- import React, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
8
+ import React, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect } from 'react';
9
9
  import { arrow, computePosition, offset, flip, shift, autoUpdate } from '@floating-ui/dom';
10
10
  import classNames from 'classnames';
11
11
 
@@ -318,16 +318,15 @@ const computeTooltipPosition = async ({ elementReference = null, tooltipReferenc
318
318
  });
319
319
  };
320
320
 
321
- var coreStyles = {"tooltip":"core-styles-module_tooltip__3vRRp","fixed":"core-styles-module_fixed__pcSol","arrow":"core-styles-module_arrow__cvMwQ","noArrow":"core-styles-module_noArrow__xock6","clickable":"core-styles-module_clickable__ZuTTB","show":"core-styles-module_show__Nt9eE"};
321
+ var coreStyles = {"tooltip":"core-styles-module_tooltip__3vRRp","fixed":"core-styles-module_fixed__pcSol","arrow":"core-styles-module_arrow__cvMwQ","noArrow":"core-styles-module_noArrow__xock6","clickable":"core-styles-module_clickable__ZuTTB","show":"core-styles-module_show__Nt9eE","closing":"core-styles-module_closing__sGnxF"};
322
322
 
323
323
  var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","dark":"styles-module_dark__xNqje","light":"styles-module_light__Z6W-X","success":"styles-module_success__A2AKt","warning":"styles-module_warning__SCK0X","error":"styles-module_error__JvumD","info":"styles-module_info__BWdHW"};
324
324
 
325
325
  const Tooltip = ({
326
326
  // props
327
- forwardRef, id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style: externalStyles, position, afterShow, afterHide,
327
+ id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, openEvents, closeEvents, globalCloseEvents, style: externalStyles, position, afterShow, afterHide,
328
328
  // props handled by controller
329
329
  content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => {
330
- var _a;
331
330
  const tooltipRef = useRef(null);
332
331
  const tooltipArrowRef = useRef(null);
333
332
  const tooltipShowDelayTimerRef = useRef(null);
@@ -337,7 +336,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
337
336
  const [inlineArrowStyles, setInlineArrowStyles] = useState({});
338
337
  const [show, setShow] = useState(false);
339
338
  const [rendered, setRendered] = useState(false);
340
- const [imperativeOptions, setImperativeOptions] = useState(null);
341
339
  const wasShowing = useRef(false);
342
340
  const lastFloatPosition = useRef(null);
343
341
  /**
@@ -347,7 +345,48 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
347
345
  const hoveringTooltip = useRef(false);
348
346
  const [anchorsBySelect, setAnchorsBySelect] = useState([]);
349
347
  const mounted = useRef(false);
348
+ /**
349
+ * @todo Update when deprecated stuff gets removed.
350
+ */
350
351
  const shouldOpenOnClick = openOnClick || events.includes('click');
352
+ const hasClickEvent = shouldOpenOnClick || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.click) || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.dblclick) || (openEvents === null || openEvents === void 0 ? void 0 : openEvents.mousedown);
353
+ const actualOpenEvents = openEvents
354
+ ? { ...openEvents }
355
+ : {
356
+ mouseenter: true,
357
+ focus: true,
358
+ click: false,
359
+ dblclick: false,
360
+ mousedown: false,
361
+ };
362
+ if (!openEvents && shouldOpenOnClick) {
363
+ Object.assign(actualOpenEvents, {
364
+ mouseenter: false,
365
+ focus: false,
366
+ click: true,
367
+ });
368
+ }
369
+ const actualCloseEvents = closeEvents
370
+ ? { ...closeEvents }
371
+ : {
372
+ mouseleave: true,
373
+ blur: true,
374
+ click: false,
375
+ };
376
+ if (!closeEvents && shouldOpenOnClick) {
377
+ Object.assign(actualCloseEvents, {
378
+ mouseleave: false,
379
+ blur: false,
380
+ });
381
+ }
382
+ const actualGlobalCloseEvents = globalCloseEvents
383
+ ? { ...globalCloseEvents }
384
+ : {
385
+ escape: closeOnEsc || false,
386
+ scroll: closeOnScroll || false,
387
+ resize: closeOnResize || false,
388
+ clickOutsideAnchor: hasClickEvent || false,
389
+ };
351
390
  /**
352
391
  * useLayoutEffect runs before useEffect,
353
392
  * but should be used carefully because of caveats
@@ -359,23 +398,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
359
398
  mounted.current = false;
360
399
  };
361
400
  }, []);
362
- useEffect(() => {
363
- if (!show) {
364
- /**
365
- * this fixes weird behavior when switching between two anchor elements very quickly
366
- * remove the timeout and switch quickly between two adjancent anchor elements to see it
367
- *
368
- * in practice, this means the tooltip is not immediately removed from the DOM on hide
369
- */
370
- const timeout = setTimeout(() => {
371
- setRendered(false);
372
- }, 150);
373
- return () => {
374
- clearTimeout(timeout);
375
- };
376
- }
377
- return () => null;
378
- }, [show]);
379
401
  const handleShow = (value) => {
380
402
  if (!mounted.current) {
381
403
  return;
@@ -424,7 +446,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
424
446
  afterShow === null || afterShow === void 0 ? void 0 : afterShow();
425
447
  }
426
448
  else {
427
- setImperativeOptions(null);
428
449
  afterHide === null || afterHide === void 0 ? void 0 : afterHide();
429
450
  }
430
451
  }, [show]);
@@ -535,17 +556,8 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
535
556
  handleTooltipPosition(mousePosition);
536
557
  lastFloatPosition.current = mousePosition;
537
558
  };
538
- const handleClickTooltipAnchor = (event) => {
539
- handleShowTooltip(event);
540
- if (delayHide) {
541
- handleHideTooltipDelayed();
542
- }
543
- };
544
559
  const handleClickOutsideAnchors = (event) => {
545
560
  var _a;
546
- if (!show) {
547
- return;
548
- }
549
561
  const anchorById = document.querySelector(`[id='${anchorId}']`);
550
562
  const anchors = [anchorById, ...anchorsBySelect];
551
563
  if (anchors.some((anchor) => anchor === null || anchor === void 0 ? void 0 : anchor.contains(event.target))) {
@@ -564,11 +576,9 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
564
576
  const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50, true);
565
577
  const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50, true);
566
578
  const updateTooltipPosition = useCallback(() => {
567
- var _a;
568
- const actualPosition = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position) !== null && _a !== void 0 ? _a : position;
569
- if (actualPosition) {
579
+ if (position) {
570
580
  // if `position` is set, override regular and `float` positioning
571
- handleTooltipPosition(actualPosition);
581
+ handleTooltipPosition(position);
572
582
  return;
573
583
  }
574
584
  if (float) {
@@ -619,7 +629,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
619
629
  offset,
620
630
  positionStrategy,
621
631
  position,
622
- imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position,
623
632
  float,
624
633
  ]);
625
634
  useEffect(() => {
@@ -637,13 +646,13 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
637
646
  };
638
647
  const anchorScrollParent = getScrollParent(activeAnchor);
639
648
  const tooltipScrollParent = getScrollParent(tooltipRef.current);
640
- if (closeOnScroll) {
649
+ if (actualGlobalCloseEvents.scroll) {
641
650
  window.addEventListener('scroll', handleScrollResize);
642
651
  anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.addEventListener('scroll', handleScrollResize);
643
652
  tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.addEventListener('scroll', handleScrollResize);
644
653
  }
645
654
  let updateTooltipCleanup = null;
646
- if (closeOnResize) {
655
+ if (actualGlobalCloseEvents.resize) {
647
656
  window.addEventListener('resize', handleScrollResize);
648
657
  }
649
658
  else if (activeAnchor && tooltipRef.current) {
@@ -659,22 +668,56 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
659
668
  }
660
669
  handleShow(false);
661
670
  };
662
- if (closeOnEsc) {
671
+ if (actualGlobalCloseEvents.escape) {
663
672
  window.addEventListener('keydown', handleEsc);
664
673
  }
665
- const enabledEvents = [];
666
- if (shouldOpenOnClick) {
674
+ if (actualGlobalCloseEvents.clickOutsideAnchor) {
667
675
  window.addEventListener('click', handleClickOutsideAnchors);
668
- enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
669
676
  }
670
- else {
671
- enabledEvents.push({ event: 'mouseenter', listener: debouncedHandleShowTooltip }, { event: 'mouseleave', listener: debouncedHandleHideTooltip }, { event: 'focus', listener: debouncedHandleShowTooltip }, { event: 'blur', listener: debouncedHandleHideTooltip });
672
- if (float) {
673
- enabledEvents.push({
674
- event: 'mousemove',
675
- listener: handleMouseMove,
676
- });
677
+ const enabledEvents = [];
678
+ const handleClickOpenTooltipAnchor = (event) => {
679
+ if (show) {
680
+ return;
681
+ }
682
+ handleShowTooltip(event);
683
+ };
684
+ const handleClickCloseTooltipAnchor = () => {
685
+ if (!show) {
686
+ return;
677
687
  }
688
+ handleHideTooltip();
689
+ };
690
+ const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur'];
691
+ const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup'];
692
+ Object.entries(actualOpenEvents).forEach(([event, enabled]) => {
693
+ if (!enabled) {
694
+ return;
695
+ }
696
+ if (regularEvents.includes(event)) {
697
+ enabledEvents.push({ event, listener: debouncedHandleShowTooltip });
698
+ }
699
+ else if (clickEvents.includes(event)) {
700
+ enabledEvents.push({ event, listener: handleClickOpenTooltipAnchor });
701
+ }
702
+ else ;
703
+ });
704
+ Object.entries(actualCloseEvents).forEach(([event, enabled]) => {
705
+ if (!enabled) {
706
+ return;
707
+ }
708
+ if (regularEvents.includes(event)) {
709
+ enabledEvents.push({ event, listener: debouncedHandleHideTooltip });
710
+ }
711
+ else if (clickEvents.includes(event)) {
712
+ enabledEvents.push({ event, listener: handleClickCloseTooltipAnchor });
713
+ }
714
+ else ;
715
+ });
716
+ if (float) {
717
+ enabledEvents.push({
718
+ event: 'mousemove',
719
+ listener: handleMouseMove,
720
+ });
678
721
  }
679
722
  const handleMouseEnterTooltip = () => {
680
723
  hoveringTooltip.current = true;
@@ -683,7 +726,9 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
683
726
  hoveringTooltip.current = false;
684
727
  handleHideTooltip();
685
728
  };
686
- if (clickable && !shouldOpenOnClick) {
729
+ if (clickable && !hasClickEvent) {
730
+ // used to keep the tooltip open when hovering content.
731
+ // not needed if using click events.
687
732
  (_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', handleMouseEnterTooltip);
688
733
  (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', handleMouseLeaveTooltip);
689
734
  }
@@ -695,24 +740,24 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
695
740
  });
696
741
  return () => {
697
742
  var _a, _b;
698
- if (closeOnScroll) {
743
+ if (actualGlobalCloseEvents.scroll) {
699
744
  window.removeEventListener('scroll', handleScrollResize);
700
745
  anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.removeEventListener('scroll', handleScrollResize);
701
746
  tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.removeEventListener('scroll', handleScrollResize);
702
747
  }
703
- if (closeOnResize) {
748
+ if (actualGlobalCloseEvents.resize) {
704
749
  window.removeEventListener('resize', handleScrollResize);
705
750
  }
706
751
  else {
707
752
  updateTooltipCleanup === null || updateTooltipCleanup === void 0 ? void 0 : updateTooltipCleanup();
708
753
  }
709
- if (shouldOpenOnClick) {
754
+ if (actualGlobalCloseEvents.clickOutsideAnchor) {
710
755
  window.removeEventListener('click', handleClickOutsideAnchors);
711
756
  }
712
- if (closeOnEsc) {
757
+ if (actualGlobalCloseEvents.escape) {
713
758
  window.removeEventListener('keydown', handleEsc);
714
759
  }
715
- if (clickable && !shouldOpenOnClick) {
760
+ if (clickable && !hasClickEvent) {
716
761
  (_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', handleMouseEnterTooltip);
717
762
  (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', handleMouseLeaveTooltip);
718
763
  }
@@ -733,12 +778,14 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
733
778
  rendered,
734
779
  anchorRefs,
735
780
  anchorsBySelect,
736
- closeOnEsc,
737
- events,
781
+ // the effect uses the `actual*Events` objects, but this should work
782
+ openEvents,
783
+ closeEvents,
784
+ globalCloseEvents,
785
+ shouldOpenOnClick,
738
786
  ]);
739
787
  useEffect(() => {
740
- var _a, _b;
741
- let selector = (_b = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect) !== null && _b !== void 0 ? _b : '';
788
+ let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
742
789
  if (!selector && id) {
743
790
  selector = `[data-tooltip-id='${id}']`;
744
791
  }
@@ -811,7 +858,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
811
858
  });
812
859
  if (newAnchors.length || removedAnchors.length) {
813
860
  setAnchorsBySelect((anchors) => [
814
- ...anchors.filter((anchor) => removedAnchors.includes(anchor)),
861
+ ...anchors.filter((anchor) => !removedAnchors.includes(anchor)),
815
862
  ...newAnchors,
816
863
  ]);
817
864
  }
@@ -827,7 +874,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
827
874
  return () => {
828
875
  documentObserver.disconnect();
829
876
  };
830
- }, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect, activeAnchor]);
877
+ }, [id, anchorSelect, activeAnchor]);
831
878
  useEffect(() => {
832
879
  updateTooltipPosition();
833
880
  }, [updateTooltipPosition]);
@@ -867,8 +914,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
867
914
  };
868
915
  }, []);
869
916
  useEffect(() => {
870
- var _a;
871
- let selector = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect;
917
+ let selector = anchorSelect;
872
918
  if (!selector && id) {
873
919
  selector = `[data-tooltip-id='${id}']`;
874
920
  }
@@ -879,55 +925,28 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
879
925
  const anchors = Array.from(document.querySelectorAll(selector));
880
926
  setAnchorsBySelect(anchors);
881
927
  }
882
- catch (_b) {
928
+ catch (_a) {
883
929
  // warning was already issued in the controller
884
930
  setAnchorsBySelect([]);
885
931
  }
886
- }, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect]);
887
- const actualContent = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.content) !== null && _a !== void 0 ? _a : content;
888
- const canShow = Boolean(!hidden && actualContent && show && Object.keys(inlineStyles).length > 0);
889
- useImperativeHandle(forwardRef, () => ({
890
- open: (options) => {
891
- if (options === null || options === void 0 ? void 0 : options.anchorSelect) {
892
- try {
893
- document.querySelector(options.anchorSelect);
894
- }
895
- catch (_a) {
896
- {
897
- // eslint-disable-next-line no-console
898
- console.warn(`[react-tooltip] "${options.anchorSelect}" is not a valid CSS selector`);
899
- }
900
- return;
901
- }
932
+ }, [id, anchorSelect]);
933
+ const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0;
934
+ return rendered ? (React.createElement(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, coreStyles[canShow ? 'show' : 'closing'], canShow ? 'react-tooltip__show' : 'react-tooltip__closing', positionStrategy === 'fixed' && coreStyles['fixed'], clickable && coreStyles['clickable']), onTransitionEnd: (event) => {
935
+ /**
936
+ * @warning if `--rt-transition-closing-delay` is set to 0,
937
+ * the tooltip will be stuck (but not visible) on the DOM
938
+ */
939
+ if (show || event.propertyName !== 'opacity') {
940
+ return;
902
941
  }
903
- setImperativeOptions(options !== null && options !== void 0 ? options : null);
904
- handleShow(true);
905
- },
906
- close: () => {
907
- handleShow(false);
908
- },
909
- activeAnchor,
910
- place: actualPlacement,
911
- isOpen: rendered && canShow,
912
- }));
913
- return rendered ? (React.createElement(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, {
914
- 'react-tooltip__show': canShow,
915
- [coreStyles['show']]: canShow,
916
- [coreStyles['fixed']]: positionStrategy === 'fixed',
917
- [coreStyles['clickable']]: clickable,
918
- }), style: {
942
+ setRendered(false);
943
+ }, style: {
919
944
  ...externalStyles,
920
945
  ...inlineStyles,
921
946
  opacity: opacity !== undefined && canShow ? opacity : undefined,
922
947
  }, ref: tooltipRef },
923
- actualContent,
924
- React.createElement(WrapperElement, { className: classNames('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, {
925
- /**
926
- * changed from dash `no-arrow` to camelcase because of:
927
- * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
928
- */
929
- [coreStyles['noArrow']]: noArrow,
930
- }), style: {
948
+ content,
949
+ React.createElement(WrapperElement, { className: classNames('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, noArrow && coreStyles['noArrow']), style: {
931
950
  ...inlineArrowStyles,
932
951
  background: arrowColor
933
952
  ? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`
@@ -940,7 +959,7 @@ const TooltipContent = ({ content }) => {
940
959
  return React.createElement("span", { dangerouslySetInnerHTML: { __html: content } });
941
960
  };
942
961
 
943
- const TooltipController = React.forwardRef(({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style, position, isOpen, disableStyleInjection = false, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }, ref) => {
962
+ const TooltipController = ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, openEvents, closeEvents, globalCloseEvents, style, position, isOpen, disableStyleInjection = false, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }) => {
944
963
  const [tooltipContent, setTooltipContent] = useState(content);
945
964
  const [tooltipHtml, setTooltipHtml] = useState(html);
946
965
  const [tooltipPlace, setTooltipPlace] = useState(place);
@@ -1164,7 +1183,6 @@ const TooltipController = React.forwardRef(({ id, anchorId, anchorSelect, conten
1164
1183
  renderedContent = React.createElement(TooltipContent, { content: tooltipHtml });
1165
1184
  }
1166
1185
  const props = {
1167
- forwardRef: ref,
1168
1186
  id,
1169
1187
  anchorId,
1170
1188
  anchorSelect,
@@ -1189,6 +1207,9 @@ const TooltipController = React.forwardRef(({ id, anchorId, anchorSelect, conten
1189
1207
  closeOnEsc,
1190
1208
  closeOnScroll,
1191
1209
  closeOnResize,
1210
+ openEvents,
1211
+ closeEvents,
1212
+ globalCloseEvents,
1192
1213
  style,
1193
1214
  position,
1194
1215
  isOpen,
@@ -1202,7 +1223,7 @@ const TooltipController = React.forwardRef(({ id, anchorId, anchorSelect, conten
1202
1223
  setActiveAnchor: (anchor) => setActiveAnchor(anchor),
1203
1224
  };
1204
1225
  return React.createElement(Tooltip, { ...props });
1205
- });
1226
+ };
1206
1227
 
1207
1228
  // those content will be replaced in build time with the `react-tooltip.css` builded content
1208
1229
  const TooltipCoreStyles = `:root {
@@ -1213,17 +1234,17 @@ const TooltipCoreStyles = `:root {
1213
1234
  --rt-color-warning: #f0ad4e;
1214
1235
  --rt-color-info: #337ab7;
1215
1236
  --rt-opacity: 0.9;
1237
+ --rt-transition-show-delay: 0.15s;
1238
+ --rt-transition-closing-delay: 0.15s;
1216
1239
  }
1217
1240
 
1218
1241
  .core-styles-module_tooltip__3vRRp {
1219
- visibility: hidden;
1220
1242
  position: absolute;
1221
1243
  top: 0;
1222
1244
  left: 0;
1223
1245
  pointer-events: none;
1224
1246
  opacity: 0;
1225
- transition: opacity 0.3s ease-out;
1226
- will-change: opacity, visibility;
1247
+ will-change: opacity;
1227
1248
  }
1228
1249
 
1229
1250
  .core-styles-module_fixed__pcSol {
@@ -1244,8 +1265,13 @@ const TooltipCoreStyles = `:root {
1244
1265
  }
1245
1266
 
1246
1267
  .core-styles-module_show__Nt9eE {
1247
- visibility: visible;
1248
1268
  opacity: var(--rt-opacity);
1269
+ transition: opacity var(--rt-transition-show-delay) ease-out;
1270
+ }
1271
+
1272
+ .core-styles-module_closing__sGnxF {
1273
+ opacity: 0;
1274
+ transition: opacity var(--rt-transition-closing-delay) ease-in;
1249
1275
  }
1250
1276
 
1251
1277
  `;