react-tooltip 5.22.0-beta.1109.1 → 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.
@@ -6,4 +6,6 @@
6
6
  --rt-color-warning: #f0ad4e;
7
7
  --rt-color-info: #337ab7;
8
8
  --rt-opacity: 0.9;
9
+ --rt-transition-show-delay: 0.15s;
10
+ --rt-transition-closing-delay: 0.15s;
9
11
  }
@@ -327,16 +327,15 @@ const computeTooltipPosition = async ({ elementReference = null, tooltipReferenc
327
327
  });
328
328
  };
329
329
 
330
- 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"};
330
+ 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"};
331
331
 
332
332
  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"};
333
333
 
334
334
  const Tooltip = ({
335
335
  // props
336
- 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,
336
+ 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,
337
337
  // props handled by controller
338
338
  content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => {
339
- var _a;
340
339
  const tooltipRef = React.useRef(null);
341
340
  const tooltipArrowRef = React.useRef(null);
342
341
  const tooltipShowDelayTimerRef = React.useRef(null);
@@ -346,7 +345,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
346
345
  const [inlineArrowStyles, setInlineArrowStyles] = React.useState({});
347
346
  const [show, setShow] = React.useState(false);
348
347
  const [rendered, setRendered] = React.useState(false);
349
- const [imperativeOptions, setImperativeOptions] = React.useState(null);
350
348
  const wasShowing = React.useRef(false);
351
349
  const lastFloatPosition = React.useRef(null);
352
350
  /**
@@ -356,7 +354,48 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
356
354
  const hoveringTooltip = React.useRef(false);
357
355
  const [anchorsBySelect, setAnchorsBySelect] = React.useState([]);
358
356
  const mounted = React.useRef(false);
357
+ /**
358
+ * @todo Update when deprecated stuff gets removed.
359
+ */
359
360
  const shouldOpenOnClick = openOnClick || events.includes('click');
361
+ 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);
362
+ const actualOpenEvents = openEvents
363
+ ? { ...openEvents }
364
+ : {
365
+ mouseenter: true,
366
+ focus: true,
367
+ click: false,
368
+ dblclick: false,
369
+ mousedown: false,
370
+ };
371
+ if (!openEvents && shouldOpenOnClick) {
372
+ Object.assign(actualOpenEvents, {
373
+ mouseenter: false,
374
+ focus: false,
375
+ click: true,
376
+ });
377
+ }
378
+ const actualCloseEvents = closeEvents
379
+ ? { ...closeEvents }
380
+ : {
381
+ mouseleave: true,
382
+ blur: true,
383
+ click: false,
384
+ };
385
+ if (!closeEvents && shouldOpenOnClick) {
386
+ Object.assign(actualCloseEvents, {
387
+ mouseleave: false,
388
+ blur: false,
389
+ });
390
+ }
391
+ const actualGlobalCloseEvents = globalCloseEvents
392
+ ? { ...globalCloseEvents }
393
+ : {
394
+ escape: closeOnEsc || false,
395
+ scroll: closeOnScroll || false,
396
+ resize: closeOnResize || false,
397
+ clickOutsideAnchor: hasClickEvent || false,
398
+ };
360
399
  /**
361
400
  * useLayoutEffect runs before useEffect,
362
401
  * but should be used carefully because of caveats
@@ -368,23 +407,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
368
407
  mounted.current = false;
369
408
  };
370
409
  }, []);
371
- React.useEffect(() => {
372
- if (!show) {
373
- /**
374
- * this fixes weird behavior when switching between two anchor elements very quickly
375
- * remove the timeout and switch quickly between two adjancent anchor elements to see it
376
- *
377
- * in practice, this means the tooltip is not immediately removed from the DOM on hide
378
- */
379
- const timeout = setTimeout(() => {
380
- setRendered(false);
381
- }, 150);
382
- return () => {
383
- clearTimeout(timeout);
384
- };
385
- }
386
- return () => null;
387
- }, [show]);
388
410
  const handleShow = (value) => {
389
411
  if (!mounted.current) {
390
412
  return;
@@ -433,17 +455,16 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
433
455
  afterShow === null || afterShow === void 0 ? void 0 : afterShow();
434
456
  }
435
457
  else {
436
- setImperativeOptions(null);
437
458
  afterHide === null || afterHide === void 0 ? void 0 : afterHide();
438
459
  }
439
460
  }, [show]);
440
- const handleShowTooltipDelayed = (delay = delayShow) => {
461
+ const handleShowTooltipDelayed = () => {
441
462
  if (tooltipShowDelayTimerRef.current) {
442
463
  clearTimeout(tooltipShowDelayTimerRef.current);
443
464
  }
444
465
  tooltipShowDelayTimerRef.current = setTimeout(() => {
445
466
  handleShow(true);
446
- }, delay);
467
+ }, delayShow);
447
468
  };
448
469
  const handleHideTooltipDelayed = (delay = delayHide) => {
449
470
  if (tooltipHideDelayTimerRef.current) {
@@ -499,7 +520,6 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
499
520
  }
500
521
  };
501
522
  const handleTooltipPosition = ({ x, y }) => {
502
- var _a;
503
523
  const virtualElement = {
504
524
  getBoundingClientRect() {
505
525
  return {
@@ -515,7 +535,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
515
535
  },
516
536
  };
517
537
  computeTooltipPosition({
518
- place: (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place) !== null && _a !== void 0 ? _a : place,
538
+ place,
519
539
  offset,
520
540
  elementReference: virtualElement,
521
541
  tooltipReference: tooltipRef.current,
@@ -545,17 +565,8 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
545
565
  handleTooltipPosition(mousePosition);
546
566
  lastFloatPosition.current = mousePosition;
547
567
  };
548
- const handleClickTooltipAnchor = (event) => {
549
- handleShowTooltip(event);
550
- if (delayHide) {
551
- handleHideTooltipDelayed();
552
- }
553
- };
554
568
  const handleClickOutsideAnchors = (event) => {
555
569
  var _a;
556
- if (!show) {
557
- return;
558
- }
559
570
  const anchorById = document.querySelector(`[id='${anchorId}']`);
560
571
  const anchors = [anchorById, ...anchorsBySelect];
561
572
  if (anchors.some((anchor) => anchor === null || anchor === void 0 ? void 0 : anchor.contains(event.target))) {
@@ -574,11 +585,9 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
574
585
  const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50, true);
575
586
  const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50, true);
576
587
  const updateTooltipPosition = React.useCallback(() => {
577
- var _a, _b;
578
- const actualPosition = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position) !== null && _a !== void 0 ? _a : position;
579
- if (actualPosition) {
588
+ if (position) {
580
589
  // if `position` is set, override regular and `float` positioning
581
- handleTooltipPosition(actualPosition);
590
+ handleTooltipPosition(position);
582
591
  return;
583
592
  }
584
593
  if (float) {
@@ -599,7 +608,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
599
608
  return;
600
609
  }
601
610
  computeTooltipPosition({
602
- place: (_b = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place) !== null && _b !== void 0 ? _b : place,
611
+ place,
603
612
  offset,
604
613
  elementReference: activeAnchor,
605
614
  tooltipReference: tooltipRef.current,
@@ -626,11 +635,9 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
626
635
  content,
627
636
  externalStyles,
628
637
  place,
629
- imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.place,
630
638
  offset,
631
639
  positionStrategy,
632
640
  position,
633
- imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position,
634
641
  float,
635
642
  ]);
636
643
  React.useEffect(() => {
@@ -648,13 +655,13 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
648
655
  };
649
656
  const anchorScrollParent = getScrollParent(activeAnchor);
650
657
  const tooltipScrollParent = getScrollParent(tooltipRef.current);
651
- if (closeOnScroll) {
658
+ if (actualGlobalCloseEvents.scroll) {
652
659
  window.addEventListener('scroll', handleScrollResize);
653
660
  anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.addEventListener('scroll', handleScrollResize);
654
661
  tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.addEventListener('scroll', handleScrollResize);
655
662
  }
656
663
  let updateTooltipCleanup = null;
657
- if (closeOnResize) {
664
+ if (actualGlobalCloseEvents.resize) {
658
665
  window.addEventListener('resize', handleScrollResize);
659
666
  }
660
667
  else if (activeAnchor && tooltipRef.current) {
@@ -670,22 +677,56 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
670
677
  }
671
678
  handleShow(false);
672
679
  };
673
- if (closeOnEsc) {
680
+ if (actualGlobalCloseEvents.escape) {
674
681
  window.addEventListener('keydown', handleEsc);
675
682
  }
676
- const enabledEvents = [];
677
- if (shouldOpenOnClick) {
683
+ if (actualGlobalCloseEvents.clickOutsideAnchor) {
678
684
  window.addEventListener('click', handleClickOutsideAnchors);
679
- enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
680
685
  }
681
- else {
682
- enabledEvents.push({ event: 'mouseenter', listener: debouncedHandleShowTooltip }, { event: 'mouseleave', listener: debouncedHandleHideTooltip }, { event: 'focus', listener: debouncedHandleShowTooltip }, { event: 'blur', listener: debouncedHandleHideTooltip });
683
- if (float) {
684
- enabledEvents.push({
685
- event: 'mousemove',
686
- listener: handleMouseMove,
687
- });
686
+ const enabledEvents = [];
687
+ const handleClickOpenTooltipAnchor = (event) => {
688
+ if (show) {
689
+ return;
690
+ }
691
+ handleShowTooltip(event);
692
+ };
693
+ const handleClickCloseTooltipAnchor = () => {
694
+ if (!show) {
695
+ return;
696
+ }
697
+ handleHideTooltip();
698
+ };
699
+ const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur'];
700
+ const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup'];
701
+ Object.entries(actualOpenEvents).forEach(([event, enabled]) => {
702
+ if (!enabled) {
703
+ return;
688
704
  }
705
+ if (regularEvents.includes(event)) {
706
+ enabledEvents.push({ event, listener: debouncedHandleShowTooltip });
707
+ }
708
+ else if (clickEvents.includes(event)) {
709
+ enabledEvents.push({ event, listener: handleClickOpenTooltipAnchor });
710
+ }
711
+ else ;
712
+ });
713
+ Object.entries(actualCloseEvents).forEach(([event, enabled]) => {
714
+ if (!enabled) {
715
+ return;
716
+ }
717
+ if (regularEvents.includes(event)) {
718
+ enabledEvents.push({ event, listener: debouncedHandleHideTooltip });
719
+ }
720
+ else if (clickEvents.includes(event)) {
721
+ enabledEvents.push({ event, listener: handleClickCloseTooltipAnchor });
722
+ }
723
+ else ;
724
+ });
725
+ if (float) {
726
+ enabledEvents.push({
727
+ event: 'mousemove',
728
+ listener: handleMouseMove,
729
+ });
689
730
  }
690
731
  const handleMouseEnterTooltip = () => {
691
732
  hoveringTooltip.current = true;
@@ -694,7 +735,9 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
694
735
  hoveringTooltip.current = false;
695
736
  handleHideTooltip();
696
737
  };
697
- if (clickable && !shouldOpenOnClick) {
738
+ if (clickable && !hasClickEvent) {
739
+ // used to keep the tooltip open when hovering content.
740
+ // not needed if using click events.
698
741
  (_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', handleMouseEnterTooltip);
699
742
  (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', handleMouseLeaveTooltip);
700
743
  }
@@ -706,24 +749,24 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
706
749
  });
707
750
  return () => {
708
751
  var _a, _b;
709
- if (closeOnScroll) {
752
+ if (actualGlobalCloseEvents.scroll) {
710
753
  window.removeEventListener('scroll', handleScrollResize);
711
754
  anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.removeEventListener('scroll', handleScrollResize);
712
755
  tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.removeEventListener('scroll', handleScrollResize);
713
756
  }
714
- if (closeOnResize) {
757
+ if (actualGlobalCloseEvents.resize) {
715
758
  window.removeEventListener('resize', handleScrollResize);
716
759
  }
717
760
  else {
718
761
  updateTooltipCleanup === null || updateTooltipCleanup === void 0 ? void 0 : updateTooltipCleanup();
719
762
  }
720
- if (shouldOpenOnClick) {
763
+ if (actualGlobalCloseEvents.clickOutsideAnchor) {
721
764
  window.removeEventListener('click', handleClickOutsideAnchors);
722
765
  }
723
- if (closeOnEsc) {
766
+ if (actualGlobalCloseEvents.escape) {
724
767
  window.removeEventListener('keydown', handleEsc);
725
768
  }
726
- if (clickable && !shouldOpenOnClick) {
769
+ if (clickable && !hasClickEvent) {
727
770
  (_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', handleMouseEnterTooltip);
728
771
  (_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', handleMouseLeaveTooltip);
729
772
  }
@@ -744,12 +787,14 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
744
787
  rendered,
745
788
  anchorRefs,
746
789
  anchorsBySelect,
747
- closeOnEsc,
748
- events,
790
+ // the effect uses the `actual*Events` objects, but this should work
791
+ openEvents,
792
+ closeEvents,
793
+ globalCloseEvents,
794
+ shouldOpenOnClick,
749
795
  ]);
750
796
  React.useEffect(() => {
751
- var _a, _b;
752
- let selector = (_b = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect) !== null && _b !== void 0 ? _b : '';
797
+ let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
753
798
  if (!selector && id) {
754
799
  selector = `[data-tooltip-id='${id}']`;
755
800
  }
@@ -822,7 +867,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
822
867
  });
823
868
  if (newAnchors.length || removedAnchors.length) {
824
869
  setAnchorsBySelect((anchors) => [
825
- ...anchors.filter((anchor) => removedAnchors.includes(anchor)),
870
+ ...anchors.filter((anchor) => !removedAnchors.includes(anchor)),
826
871
  ...newAnchors,
827
872
  ]);
828
873
  }
@@ -838,7 +883,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
838
883
  return () => {
839
884
  documentObserver.disconnect();
840
885
  };
841
- }, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect, activeAnchor]);
886
+ }, [id, anchorSelect, activeAnchor]);
842
887
  React.useEffect(() => {
843
888
  updateTooltipPosition();
844
889
  }, [updateTooltipPosition]);
@@ -878,8 +923,7 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
878
923
  };
879
924
  }, []);
880
925
  React.useEffect(() => {
881
- var _a;
882
- let selector = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect;
926
+ let selector = anchorSelect;
883
927
  if (!selector && id) {
884
928
  selector = `[data-tooltip-id='${id}']`;
885
929
  }
@@ -890,65 +934,28 @@ content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, bo
890
934
  const anchors = Array.from(document.querySelectorAll(selector));
891
935
  setAnchorsBySelect(anchors);
892
936
  }
893
- catch (_b) {
937
+ catch (_a) {
894
938
  // warning was already issued in the controller
895
939
  setAnchorsBySelect([]);
896
940
  }
897
- }, [id, anchorSelect, imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect]);
898
- const actualContent = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.content) !== null && _a !== void 0 ? _a : content;
899
- const canShow = Boolean(!hidden && actualContent && show && Object.keys(inlineStyles).length > 0);
900
- React.useImperativeHandle(forwardRef, () => ({
901
- open: (options) => {
902
- if (options === null || options === void 0 ? void 0 : options.anchorSelect) {
903
- try {
904
- document.querySelector(options.anchorSelect);
905
- }
906
- catch (_a) {
907
- {
908
- // eslint-disable-next-line no-console
909
- console.warn(`[react-tooltip] "${options.anchorSelect}" is not a valid CSS selector`);
910
- }
911
- return;
912
- }
913
- }
914
- setImperativeOptions(options !== null && options !== void 0 ? options : null);
915
- if (options === null || options === void 0 ? void 0 : options.delay) {
916
- handleShowTooltipDelayed(options.delay);
917
- }
918
- else {
919
- handleShow(true);
920
- }
921
- },
922
- close: (options) => {
923
- if (options === null || options === void 0 ? void 0 : options.delay) {
924
- handleHideTooltipDelayed(options.delay);
925
- }
926
- else {
927
- handleShow(false);
941
+ }, [id, anchorSelect]);
942
+ const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0;
943
+ return rendered ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('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) => {
944
+ /**
945
+ * @warning if `--rt-transition-closing-delay` is set to 0,
946
+ * the tooltip will be stuck (but not visible) on the DOM
947
+ */
948
+ if (show || event.propertyName !== 'opacity') {
949
+ return;
928
950
  }
929
- },
930
- activeAnchor,
931
- place: actualPlacement,
932
- isOpen: rendered && canShow,
933
- }));
934
- return rendered ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, {
935
- 'react-tooltip__show': canShow,
936
- [coreStyles['show']]: canShow,
937
- [coreStyles['fixed']]: positionStrategy === 'fixed',
938
- [coreStyles['clickable']]: clickable,
939
- }), style: {
951
+ setRendered(false);
952
+ }, style: {
940
953
  ...externalStyles,
941
954
  ...inlineStyles,
942
955
  opacity: opacity !== undefined && canShow ? opacity : undefined,
943
956
  }, ref: tooltipRef },
944
- actualContent,
945
- React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, {
946
- /**
947
- * changed from dash `no-arrow` to camelcase because of:
948
- * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
949
- */
950
- [coreStyles['noArrow']]: noArrow,
951
- }), style: {
957
+ content,
958
+ React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, noArrow && coreStyles['noArrow']), style: {
952
959
  ...inlineArrowStyles,
953
960
  background: arrowColor
954
961
  ? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`
@@ -961,7 +968,7 @@ const TooltipContent = ({ content }) => {
961
968
  return React__default["default"].createElement("span", { dangerouslySetInnerHTML: { __html: content } });
962
969
  };
963
970
 
964
- const TooltipController = React__default["default"].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) => {
971
+ 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, }) => {
965
972
  const [tooltipContent, setTooltipContent] = React.useState(content);
966
973
  const [tooltipHtml, setTooltipHtml] = React.useState(html);
967
974
  const [tooltipPlace, setTooltipPlace] = React.useState(place);
@@ -1185,7 +1192,6 @@ const TooltipController = React__default["default"].forwardRef(({ id, anchorId,
1185
1192
  renderedContent = React__default["default"].createElement(TooltipContent, { content: tooltipHtml });
1186
1193
  }
1187
1194
  const props = {
1188
- forwardRef: ref,
1189
1195
  id,
1190
1196
  anchorId,
1191
1197
  anchorSelect,
@@ -1210,6 +1216,9 @@ const TooltipController = React__default["default"].forwardRef(({ id, anchorId,
1210
1216
  closeOnEsc,
1211
1217
  closeOnScroll,
1212
1218
  closeOnResize,
1219
+ openEvents,
1220
+ closeEvents,
1221
+ globalCloseEvents,
1213
1222
  style,
1214
1223
  position,
1215
1224
  isOpen,
@@ -1223,7 +1232,7 @@ const TooltipController = React__default["default"].forwardRef(({ id, anchorId,
1223
1232
  setActiveAnchor: (anchor) => setActiveAnchor(anchor),
1224
1233
  };
1225
1234
  return React__default["default"].createElement(Tooltip, { ...props });
1226
- });
1235
+ };
1227
1236
 
1228
1237
  // those content will be replaced in build time with the `react-tooltip.css` builded content
1229
1238
  const TooltipCoreStyles = `:root {
@@ -1234,17 +1243,17 @@ const TooltipCoreStyles = `:root {
1234
1243
  --rt-color-warning: #f0ad4e;
1235
1244
  --rt-color-info: #337ab7;
1236
1245
  --rt-opacity: 0.9;
1246
+ --rt-transition-show-delay: 0.15s;
1247
+ --rt-transition-closing-delay: 0.15s;
1237
1248
  }
1238
1249
 
1239
1250
  .core-styles-module_tooltip__3vRRp {
1240
- visibility: hidden;
1241
1251
  position: absolute;
1242
1252
  top: 0;
1243
1253
  left: 0;
1244
1254
  pointer-events: none;
1245
1255
  opacity: 0;
1246
- transition: opacity 0.3s ease-out;
1247
- will-change: opacity, visibility;
1256
+ will-change: opacity;
1248
1257
  }
1249
1258
 
1250
1259
  .core-styles-module_fixed__pcSol {
@@ -1265,8 +1274,13 @@ const TooltipCoreStyles = `:root {
1265
1274
  }
1266
1275
 
1267
1276
  .core-styles-module_show__Nt9eE {
1268
- visibility: visible;
1269
1277
  opacity: var(--rt-opacity);
1278
+ transition: opacity var(--rt-transition-show-delay) ease-out;
1279
+ }
1280
+
1281
+ .core-styles-module_closing__sGnxF {
1282
+ opacity: 0;
1283
+ transition: opacity var(--rt-transition-closing-delay) ease-in;
1270
1284
  }
1271
1285
 
1272
1286
  `;