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.
- package/dist/react-tooltip-tokens.css +2 -0
- package/dist/react-tooltip.cjs +137 -111
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.css +9 -4
- package/dist/react-tooltip.d.ts +36 -26
- package/dist/react-tooltip.min.cjs +2 -2
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.css +1 -1
- package/dist/react-tooltip.min.mjs +2 -2
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +138 -112
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +137 -111
- 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 +1 -1
|
@@ -325,16 +325,15 @@
|
|
|
325
325
|
});
|
|
326
326
|
};
|
|
327
327
|
|
|
328
|
-
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"};
|
|
328
|
+
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"};
|
|
329
329
|
|
|
330
330
|
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"};
|
|
331
331
|
|
|
332
332
|
const Tooltip = ({
|
|
333
333
|
// props
|
|
334
|
-
|
|
334
|
+
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,
|
|
335
335
|
// props handled by controller
|
|
336
336
|
content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => {
|
|
337
|
-
var _a;
|
|
338
337
|
const tooltipRef = React.useRef(null);
|
|
339
338
|
const tooltipArrowRef = React.useRef(null);
|
|
340
339
|
const tooltipShowDelayTimerRef = React.useRef(null);
|
|
@@ -344,7 +343,6 @@
|
|
|
344
343
|
const [inlineArrowStyles, setInlineArrowStyles] = React.useState({});
|
|
345
344
|
const [show, setShow] = React.useState(false);
|
|
346
345
|
const [rendered, setRendered] = React.useState(false);
|
|
347
|
-
const [imperativeOptions, setImperativeOptions] = React.useState(null);
|
|
348
346
|
const wasShowing = React.useRef(false);
|
|
349
347
|
const lastFloatPosition = React.useRef(null);
|
|
350
348
|
/**
|
|
@@ -354,7 +352,48 @@
|
|
|
354
352
|
const hoveringTooltip = React.useRef(false);
|
|
355
353
|
const [anchorsBySelect, setAnchorsBySelect] = React.useState([]);
|
|
356
354
|
const mounted = React.useRef(false);
|
|
355
|
+
/**
|
|
356
|
+
* @todo Update when deprecated stuff gets removed.
|
|
357
|
+
*/
|
|
357
358
|
const shouldOpenOnClick = openOnClick || events.includes('click');
|
|
359
|
+
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);
|
|
360
|
+
const actualOpenEvents = openEvents
|
|
361
|
+
? { ...openEvents }
|
|
362
|
+
: {
|
|
363
|
+
mouseenter: true,
|
|
364
|
+
focus: true,
|
|
365
|
+
click: false,
|
|
366
|
+
dblclick: false,
|
|
367
|
+
mousedown: false,
|
|
368
|
+
};
|
|
369
|
+
if (!openEvents && shouldOpenOnClick) {
|
|
370
|
+
Object.assign(actualOpenEvents, {
|
|
371
|
+
mouseenter: false,
|
|
372
|
+
focus: false,
|
|
373
|
+
click: true,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
const actualCloseEvents = closeEvents
|
|
377
|
+
? { ...closeEvents }
|
|
378
|
+
: {
|
|
379
|
+
mouseleave: true,
|
|
380
|
+
blur: true,
|
|
381
|
+
click: false,
|
|
382
|
+
};
|
|
383
|
+
if (!closeEvents && shouldOpenOnClick) {
|
|
384
|
+
Object.assign(actualCloseEvents, {
|
|
385
|
+
mouseleave: false,
|
|
386
|
+
blur: false,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
const actualGlobalCloseEvents = globalCloseEvents
|
|
390
|
+
? { ...globalCloseEvents }
|
|
391
|
+
: {
|
|
392
|
+
escape: closeOnEsc || false,
|
|
393
|
+
scroll: closeOnScroll || false,
|
|
394
|
+
resize: closeOnResize || false,
|
|
395
|
+
clickOutsideAnchor: hasClickEvent || false,
|
|
396
|
+
};
|
|
358
397
|
/**
|
|
359
398
|
* useLayoutEffect runs before useEffect,
|
|
360
399
|
* but should be used carefully because of caveats
|
|
@@ -366,23 +405,6 @@
|
|
|
366
405
|
mounted.current = false;
|
|
367
406
|
};
|
|
368
407
|
}, []);
|
|
369
|
-
React.useEffect(() => {
|
|
370
|
-
if (!show) {
|
|
371
|
-
/**
|
|
372
|
-
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
373
|
-
* remove the timeout and switch quickly between two adjancent anchor elements to see it
|
|
374
|
-
*
|
|
375
|
-
* in practice, this means the tooltip is not immediately removed from the DOM on hide
|
|
376
|
-
*/
|
|
377
|
-
const timeout = setTimeout(() => {
|
|
378
|
-
setRendered(false);
|
|
379
|
-
}, 150);
|
|
380
|
-
return () => {
|
|
381
|
-
clearTimeout(timeout);
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
return () => null;
|
|
385
|
-
}, [show]);
|
|
386
408
|
const handleShow = (value) => {
|
|
387
409
|
if (!mounted.current) {
|
|
388
410
|
return;
|
|
@@ -431,7 +453,6 @@
|
|
|
431
453
|
afterShow === null || afterShow === void 0 ? void 0 : afterShow();
|
|
432
454
|
}
|
|
433
455
|
else {
|
|
434
|
-
setImperativeOptions(null);
|
|
435
456
|
afterHide === null || afterHide === void 0 ? void 0 : afterHide();
|
|
436
457
|
}
|
|
437
458
|
}, [show]);
|
|
@@ -542,17 +563,8 @@
|
|
|
542
563
|
handleTooltipPosition(mousePosition);
|
|
543
564
|
lastFloatPosition.current = mousePosition;
|
|
544
565
|
};
|
|
545
|
-
const handleClickTooltipAnchor = (event) => {
|
|
546
|
-
handleShowTooltip(event);
|
|
547
|
-
if (delayHide) {
|
|
548
|
-
handleHideTooltipDelayed();
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
566
|
const handleClickOutsideAnchors = (event) => {
|
|
552
567
|
var _a;
|
|
553
|
-
if (!show) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
568
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
557
569
|
const anchors = [anchorById, ...anchorsBySelect];
|
|
558
570
|
if (anchors.some((anchor) => anchor === null || anchor === void 0 ? void 0 : anchor.contains(event.target))) {
|
|
@@ -571,11 +583,9 @@
|
|
|
571
583
|
const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50, true);
|
|
572
584
|
const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50, true);
|
|
573
585
|
const updateTooltipPosition = React.useCallback(() => {
|
|
574
|
-
|
|
575
|
-
const actualPosition = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position) !== null && _a !== void 0 ? _a : position;
|
|
576
|
-
if (actualPosition) {
|
|
586
|
+
if (position) {
|
|
577
587
|
// if `position` is set, override regular and `float` positioning
|
|
578
|
-
handleTooltipPosition(
|
|
588
|
+
handleTooltipPosition(position);
|
|
579
589
|
return;
|
|
580
590
|
}
|
|
581
591
|
if (float) {
|
|
@@ -626,7 +636,6 @@
|
|
|
626
636
|
offset,
|
|
627
637
|
positionStrategy,
|
|
628
638
|
position,
|
|
629
|
-
imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.position,
|
|
630
639
|
float,
|
|
631
640
|
]);
|
|
632
641
|
React.useEffect(() => {
|
|
@@ -644,13 +653,13 @@
|
|
|
644
653
|
};
|
|
645
654
|
const anchorScrollParent = getScrollParent(activeAnchor);
|
|
646
655
|
const tooltipScrollParent = getScrollParent(tooltipRef.current);
|
|
647
|
-
if (
|
|
656
|
+
if (actualGlobalCloseEvents.scroll) {
|
|
648
657
|
window.addEventListener('scroll', handleScrollResize);
|
|
649
658
|
anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.addEventListener('scroll', handleScrollResize);
|
|
650
659
|
tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.addEventListener('scroll', handleScrollResize);
|
|
651
660
|
}
|
|
652
661
|
let updateTooltipCleanup = null;
|
|
653
|
-
if (
|
|
662
|
+
if (actualGlobalCloseEvents.resize) {
|
|
654
663
|
window.addEventListener('resize', handleScrollResize);
|
|
655
664
|
}
|
|
656
665
|
else if (activeAnchor && tooltipRef.current) {
|
|
@@ -666,22 +675,56 @@
|
|
|
666
675
|
}
|
|
667
676
|
handleShow(false);
|
|
668
677
|
};
|
|
669
|
-
if (
|
|
678
|
+
if (actualGlobalCloseEvents.escape) {
|
|
670
679
|
window.addEventListener('keydown', handleEsc);
|
|
671
680
|
}
|
|
672
|
-
|
|
673
|
-
if (shouldOpenOnClick) {
|
|
681
|
+
if (actualGlobalCloseEvents.clickOutsideAnchor) {
|
|
674
682
|
window.addEventListener('click', handleClickOutsideAnchors);
|
|
675
|
-
enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
|
|
676
683
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
if (
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
+
const enabledEvents = [];
|
|
685
|
+
const handleClickOpenTooltipAnchor = (event) => {
|
|
686
|
+
if (show) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
handleShowTooltip(event);
|
|
690
|
+
};
|
|
691
|
+
const handleClickCloseTooltipAnchor = () => {
|
|
692
|
+
if (!show) {
|
|
693
|
+
return;
|
|
684
694
|
}
|
|
695
|
+
handleHideTooltip();
|
|
696
|
+
};
|
|
697
|
+
const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur'];
|
|
698
|
+
const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup'];
|
|
699
|
+
Object.entries(actualOpenEvents).forEach(([event, enabled]) => {
|
|
700
|
+
if (!enabled) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
if (regularEvents.includes(event)) {
|
|
704
|
+
enabledEvents.push({ event, listener: debouncedHandleShowTooltip });
|
|
705
|
+
}
|
|
706
|
+
else if (clickEvents.includes(event)) {
|
|
707
|
+
enabledEvents.push({ event, listener: handleClickOpenTooltipAnchor });
|
|
708
|
+
}
|
|
709
|
+
else ;
|
|
710
|
+
});
|
|
711
|
+
Object.entries(actualCloseEvents).forEach(([event, enabled]) => {
|
|
712
|
+
if (!enabled) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
if (regularEvents.includes(event)) {
|
|
716
|
+
enabledEvents.push({ event, listener: debouncedHandleHideTooltip });
|
|
717
|
+
}
|
|
718
|
+
else if (clickEvents.includes(event)) {
|
|
719
|
+
enabledEvents.push({ event, listener: handleClickCloseTooltipAnchor });
|
|
720
|
+
}
|
|
721
|
+
else ;
|
|
722
|
+
});
|
|
723
|
+
if (float) {
|
|
724
|
+
enabledEvents.push({
|
|
725
|
+
event: 'mousemove',
|
|
726
|
+
listener: handleMouseMove,
|
|
727
|
+
});
|
|
685
728
|
}
|
|
686
729
|
const handleMouseEnterTooltip = () => {
|
|
687
730
|
hoveringTooltip.current = true;
|
|
@@ -690,7 +733,9 @@
|
|
|
690
733
|
hoveringTooltip.current = false;
|
|
691
734
|
handleHideTooltip();
|
|
692
735
|
};
|
|
693
|
-
if (clickable && !
|
|
736
|
+
if (clickable && !hasClickEvent) {
|
|
737
|
+
// used to keep the tooltip open when hovering content.
|
|
738
|
+
// not needed if using click events.
|
|
694
739
|
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', handleMouseEnterTooltip);
|
|
695
740
|
(_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', handleMouseLeaveTooltip);
|
|
696
741
|
}
|
|
@@ -702,24 +747,24 @@
|
|
|
702
747
|
});
|
|
703
748
|
return () => {
|
|
704
749
|
var _a, _b;
|
|
705
|
-
if (
|
|
750
|
+
if (actualGlobalCloseEvents.scroll) {
|
|
706
751
|
window.removeEventListener('scroll', handleScrollResize);
|
|
707
752
|
anchorScrollParent === null || anchorScrollParent === void 0 ? void 0 : anchorScrollParent.removeEventListener('scroll', handleScrollResize);
|
|
708
753
|
tooltipScrollParent === null || tooltipScrollParent === void 0 ? void 0 : tooltipScrollParent.removeEventListener('scroll', handleScrollResize);
|
|
709
754
|
}
|
|
710
|
-
if (
|
|
755
|
+
if (actualGlobalCloseEvents.resize) {
|
|
711
756
|
window.removeEventListener('resize', handleScrollResize);
|
|
712
757
|
}
|
|
713
758
|
else {
|
|
714
759
|
updateTooltipCleanup === null || updateTooltipCleanup === void 0 ? void 0 : updateTooltipCleanup();
|
|
715
760
|
}
|
|
716
|
-
if (
|
|
761
|
+
if (actualGlobalCloseEvents.clickOutsideAnchor) {
|
|
717
762
|
window.removeEventListener('click', handleClickOutsideAnchors);
|
|
718
763
|
}
|
|
719
|
-
if (
|
|
764
|
+
if (actualGlobalCloseEvents.escape) {
|
|
720
765
|
window.removeEventListener('keydown', handleEsc);
|
|
721
766
|
}
|
|
722
|
-
if (clickable && !
|
|
767
|
+
if (clickable && !hasClickEvent) {
|
|
723
768
|
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', handleMouseEnterTooltip);
|
|
724
769
|
(_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', handleMouseLeaveTooltip);
|
|
725
770
|
}
|
|
@@ -740,12 +785,14 @@
|
|
|
740
785
|
rendered,
|
|
741
786
|
anchorRefs,
|
|
742
787
|
anchorsBySelect,
|
|
743
|
-
|
|
744
|
-
|
|
788
|
+
// the effect uses the `actual*Events` objects, but this should work
|
|
789
|
+
openEvents,
|
|
790
|
+
closeEvents,
|
|
791
|
+
globalCloseEvents,
|
|
792
|
+
shouldOpenOnClick,
|
|
745
793
|
]);
|
|
746
794
|
React.useEffect(() => {
|
|
747
|
-
|
|
748
|
-
let selector = (_b = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect) !== null && _b !== void 0 ? _b : '';
|
|
795
|
+
let selector = anchorSelect !== null && anchorSelect !== void 0 ? anchorSelect : '';
|
|
749
796
|
if (!selector && id) {
|
|
750
797
|
selector = `[data-tooltip-id='${id}']`;
|
|
751
798
|
}
|
|
@@ -818,7 +865,7 @@
|
|
|
818
865
|
});
|
|
819
866
|
if (newAnchors.length || removedAnchors.length) {
|
|
820
867
|
setAnchorsBySelect((anchors) => [
|
|
821
|
-
...anchors.filter((anchor) => removedAnchors.includes(anchor)),
|
|
868
|
+
...anchors.filter((anchor) => !removedAnchors.includes(anchor)),
|
|
822
869
|
...newAnchors,
|
|
823
870
|
]);
|
|
824
871
|
}
|
|
@@ -834,7 +881,7 @@
|
|
|
834
881
|
return () => {
|
|
835
882
|
documentObserver.disconnect();
|
|
836
883
|
};
|
|
837
|
-
}, [id, anchorSelect,
|
|
884
|
+
}, [id, anchorSelect, activeAnchor]);
|
|
838
885
|
React.useEffect(() => {
|
|
839
886
|
updateTooltipPosition();
|
|
840
887
|
}, [updateTooltipPosition]);
|
|
@@ -874,8 +921,7 @@
|
|
|
874
921
|
};
|
|
875
922
|
}, []);
|
|
876
923
|
React.useEffect(() => {
|
|
877
|
-
|
|
878
|
-
let selector = (_a = imperativeOptions === null || imperativeOptions === void 0 ? void 0 : imperativeOptions.anchorSelect) !== null && _a !== void 0 ? _a : anchorSelect;
|
|
924
|
+
let selector = anchorSelect;
|
|
879
925
|
if (!selector && id) {
|
|
880
926
|
selector = `[data-tooltip-id='${id}']`;
|
|
881
927
|
}
|
|
@@ -886,55 +932,28 @@
|
|
|
886
932
|
const anchors = Array.from(document.querySelectorAll(selector));
|
|
887
933
|
setAnchorsBySelect(anchors);
|
|
888
934
|
}
|
|
889
|
-
catch (
|
|
935
|
+
catch (_a) {
|
|
890
936
|
// warning was already issued in the controller
|
|
891
937
|
setAnchorsBySelect([]);
|
|
892
938
|
}
|
|
893
|
-
}, [id, anchorSelect
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
catch (_a) {
|
|
903
|
-
{
|
|
904
|
-
// eslint-disable-next-line no-console
|
|
905
|
-
console.warn(`[react-tooltip] "${options.anchorSelect}" is not a valid CSS selector`);
|
|
906
|
-
}
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
939
|
+
}, [id, anchorSelect]);
|
|
940
|
+
const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0;
|
|
941
|
+
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) => {
|
|
942
|
+
/**
|
|
943
|
+
* @warning if `--rt-transition-closing-delay` is set to 0,
|
|
944
|
+
* the tooltip will be stuck (but not visible) on the DOM
|
|
945
|
+
*/
|
|
946
|
+
if (show || event.propertyName !== 'opacity') {
|
|
947
|
+
return;
|
|
909
948
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
},
|
|
913
|
-
close: () => {
|
|
914
|
-
handleShow(false);
|
|
915
|
-
},
|
|
916
|
-
activeAnchor,
|
|
917
|
-
place: actualPlacement,
|
|
918
|
-
isOpen: rendered && canShow,
|
|
919
|
-
}));
|
|
920
|
-
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}`, {
|
|
921
|
-
'react-tooltip__show': canShow,
|
|
922
|
-
[coreStyles['show']]: canShow,
|
|
923
|
-
[coreStyles['fixed']]: positionStrategy === 'fixed',
|
|
924
|
-
[coreStyles['clickable']]: clickable,
|
|
925
|
-
}), style: {
|
|
949
|
+
setRendered(false);
|
|
950
|
+
}, style: {
|
|
926
951
|
...externalStyles,
|
|
927
952
|
...inlineStyles,
|
|
928
953
|
opacity: opacity !== undefined && canShow ? opacity : undefined,
|
|
929
954
|
}, ref: tooltipRef },
|
|
930
|
-
|
|
931
|
-
React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, {
|
|
932
|
-
/**
|
|
933
|
-
* changed from dash `no-arrow` to camelcase because of:
|
|
934
|
-
* https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42
|
|
935
|
-
*/
|
|
936
|
-
[coreStyles['noArrow']]: noArrow,
|
|
937
|
-
}), style: {
|
|
955
|
+
content,
|
|
956
|
+
React__default["default"].createElement(WrapperElement, { className: classNames__default["default"]('react-tooltip-arrow', coreStyles['arrow'], styles['arrow'], classNameArrow, noArrow && coreStyles['noArrow']), style: {
|
|
938
957
|
...inlineArrowStyles,
|
|
939
958
|
background: arrowColor
|
|
940
959
|
? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`
|
|
@@ -947,7 +966,7 @@
|
|
|
947
966
|
return React__default["default"].createElement("span", { dangerouslySetInnerHTML: { __html: content } });
|
|
948
967
|
};
|
|
949
968
|
|
|
950
|
-
const TooltipController =
|
|
969
|
+
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, }) => {
|
|
951
970
|
const [tooltipContent, setTooltipContent] = React.useState(content);
|
|
952
971
|
const [tooltipHtml, setTooltipHtml] = React.useState(html);
|
|
953
972
|
const [tooltipPlace, setTooltipPlace] = React.useState(place);
|
|
@@ -1171,7 +1190,6 @@
|
|
|
1171
1190
|
renderedContent = React__default["default"].createElement(TooltipContent, { content: tooltipHtml });
|
|
1172
1191
|
}
|
|
1173
1192
|
const props = {
|
|
1174
|
-
forwardRef: ref,
|
|
1175
1193
|
id,
|
|
1176
1194
|
anchorId,
|
|
1177
1195
|
anchorSelect,
|
|
@@ -1196,6 +1214,9 @@
|
|
|
1196
1214
|
closeOnEsc,
|
|
1197
1215
|
closeOnScroll,
|
|
1198
1216
|
closeOnResize,
|
|
1217
|
+
openEvents,
|
|
1218
|
+
closeEvents,
|
|
1219
|
+
globalCloseEvents,
|
|
1199
1220
|
style,
|
|
1200
1221
|
position,
|
|
1201
1222
|
isOpen,
|
|
@@ -1209,7 +1230,7 @@
|
|
|
1209
1230
|
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
1210
1231
|
};
|
|
1211
1232
|
return React__default["default"].createElement(Tooltip, { ...props });
|
|
1212
|
-
}
|
|
1233
|
+
};
|
|
1213
1234
|
|
|
1214
1235
|
// those content will be replaced in build time with the `react-tooltip.css` builded content
|
|
1215
1236
|
const TooltipCoreStyles = `:root {
|
|
@@ -1220,17 +1241,17 @@
|
|
|
1220
1241
|
--rt-color-warning: #f0ad4e;
|
|
1221
1242
|
--rt-color-info: #337ab7;
|
|
1222
1243
|
--rt-opacity: 0.9;
|
|
1244
|
+
--rt-transition-show-delay: 0.15s;
|
|
1245
|
+
--rt-transition-closing-delay: 0.15s;
|
|
1223
1246
|
}
|
|
1224
1247
|
|
|
1225
1248
|
.core-styles-module_tooltip__3vRRp {
|
|
1226
|
-
visibility: hidden;
|
|
1227
1249
|
position: absolute;
|
|
1228
1250
|
top: 0;
|
|
1229
1251
|
left: 0;
|
|
1230
1252
|
pointer-events: none;
|
|
1231
1253
|
opacity: 0;
|
|
1232
|
-
|
|
1233
|
-
will-change: opacity, visibility;
|
|
1254
|
+
will-change: opacity;
|
|
1234
1255
|
}
|
|
1235
1256
|
|
|
1236
1257
|
.core-styles-module_fixed__pcSol {
|
|
@@ -1251,8 +1272,13 @@
|
|
|
1251
1272
|
}
|
|
1252
1273
|
|
|
1253
1274
|
.core-styles-module_show__Nt9eE {
|
|
1254
|
-
visibility: visible;
|
|
1255
1275
|
opacity: var(--rt-opacity);
|
|
1276
|
+
transition: opacity var(--rt-transition-show-delay) ease-out;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
.core-styles-module_closing__sGnxF {
|
|
1280
|
+
opacity: 0;
|
|
1281
|
+
transition: opacity var(--rt-transition-closing-delay) ease-in;
|
|
1256
1282
|
}
|
|
1257
1283
|
|
|
1258
1284
|
`;
|