react-tooltip 5.7.4 → 5.8.0-beta.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 +42 -19
- package/dist/react-tooltip.cjs.js +170 -58
- package/dist/react-tooltip.cjs.min.js +3 -3
- package/dist/react-tooltip.d.ts +19 -1
- package/dist/react-tooltip.esm.js +171 -59
- package/dist/react-tooltip.esm.min.js +3 -3
- package/dist/react-tooltip.umd.js +170 -58
- package/dist/react-tooltip.umd.min.js +3 -3
- package/package.json +11 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
1
|
+
import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
function getAlignment(placement) {
|
|
4
4
|
return placement.split('-')[1];
|
|
@@ -2535,6 +2535,10 @@ const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
|
2535
2535
|
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
2536
2536
|
};
|
|
2537
2537
|
const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
2538
|
+
/**
|
|
2539
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2540
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
2541
|
+
*/
|
|
2538
2542
|
const TooltipProvider = ({ children }) => {
|
|
2539
2543
|
const [anchorRefMap, setAnchorRefMap] = useState({
|
|
2540
2544
|
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
@@ -2595,6 +2599,10 @@ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
|
2595
2599
|
return useContext(TooltipContext).getTooltipData(tooltipId);
|
|
2596
2600
|
}
|
|
2597
2601
|
|
|
2602
|
+
/**
|
|
2603
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2604
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
2605
|
+
*/
|
|
2598
2606
|
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
2599
2607
|
const { attach, detach } = useTooltip(tooltipId);
|
|
2600
2608
|
const anchorRef = useRef(null);
|
|
@@ -2658,9 +2666,9 @@ var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fi
|
|
|
2658
2666
|
|
|
2659
2667
|
const Tooltip = ({
|
|
2660
2668
|
// props
|
|
2661
|
-
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2669
|
+
id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2662
2670
|
// props handled by controller
|
|
2663
|
-
content, html, isOpen, setIsOpen, }) => {
|
|
2671
|
+
content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
2664
2672
|
const tooltipRef = useRef(null);
|
|
2665
2673
|
const tooltipArrowRef = useRef(null);
|
|
2666
2674
|
const tooltipShowDelayTimerRef = useRef(null);
|
|
@@ -2668,20 +2676,98 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2668
2676
|
const [inlineStyles, setInlineStyles] = useState({});
|
|
2669
2677
|
const [inlineArrowStyles, setInlineArrowStyles] = useState({});
|
|
2670
2678
|
const [show, setShow] = useState(false);
|
|
2679
|
+
const [rendered, setRendered] = useState(false);
|
|
2671
2680
|
const wasShowing = useRef(false);
|
|
2672
|
-
const [calculatingPosition, setCalculatingPosition] = useState(false);
|
|
2673
2681
|
const lastFloatPosition = useRef(null);
|
|
2682
|
+
/**
|
|
2683
|
+
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
2684
|
+
*/
|
|
2674
2685
|
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
2675
|
-
const [activeAnchor, setActiveAnchor] = useState({ current: null });
|
|
2676
2686
|
const hoveringTooltip = useRef(false);
|
|
2677
|
-
const
|
|
2678
|
-
|
|
2679
|
-
|
|
2687
|
+
const [anchorsBySelect, setAnchorsBySelect] = useState([]);
|
|
2688
|
+
const mounted = useRef(false);
|
|
2689
|
+
useEffect(() => {
|
|
2690
|
+
let selector = anchorSelect;
|
|
2691
|
+
if (!selector && id) {
|
|
2692
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
2693
|
+
}
|
|
2694
|
+
if (!selector) {
|
|
2695
|
+
return;
|
|
2680
2696
|
}
|
|
2681
|
-
|
|
2682
|
-
|
|
2697
|
+
try {
|
|
2698
|
+
const anchors = Array.from(document.querySelectorAll(selector));
|
|
2699
|
+
setAnchorsBySelect(anchors);
|
|
2700
|
+
}
|
|
2701
|
+
catch (_a) {
|
|
2702
|
+
// warning was already issued in the controller
|
|
2703
|
+
setAnchorsBySelect([]);
|
|
2704
|
+
}
|
|
2705
|
+
}, [anchorSelect]);
|
|
2706
|
+
/**
|
|
2707
|
+
* useLayoutEffect runs before useEffect,
|
|
2708
|
+
* but should be used carefully because of caveats
|
|
2709
|
+
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
2710
|
+
*/
|
|
2711
|
+
useLayoutEffect(() => {
|
|
2712
|
+
mounted.current = true;
|
|
2713
|
+
return () => {
|
|
2714
|
+
mounted.current = false;
|
|
2715
|
+
};
|
|
2716
|
+
}, []);
|
|
2717
|
+
useEffect(() => {
|
|
2718
|
+
if (!show) {
|
|
2719
|
+
/**
|
|
2720
|
+
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
2721
|
+
* remove the timeout and switch quickly between two adjancent anchor elements to see it
|
|
2722
|
+
*
|
|
2723
|
+
* in practice, this means the tooltip is not immediately removed from the DOM on hide
|
|
2724
|
+
*/
|
|
2725
|
+
const timeout = setTimeout(() => {
|
|
2726
|
+
setRendered(false);
|
|
2727
|
+
}, 150);
|
|
2728
|
+
return () => {
|
|
2729
|
+
clearTimeout(timeout);
|
|
2730
|
+
};
|
|
2683
2731
|
}
|
|
2732
|
+
return () => null;
|
|
2733
|
+
}, [show]);
|
|
2734
|
+
const handleShow = (value) => {
|
|
2735
|
+
if (!mounted.current) {
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2738
|
+
setRendered(true);
|
|
2739
|
+
/**
|
|
2740
|
+
* wait for the component to render and calculate position
|
|
2741
|
+
* before actually showing
|
|
2742
|
+
*/
|
|
2743
|
+
setTimeout(() => {
|
|
2744
|
+
if (!mounted.current) {
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2747
|
+
setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(value);
|
|
2748
|
+
if (isOpen === undefined) {
|
|
2749
|
+
setShow(value);
|
|
2750
|
+
}
|
|
2751
|
+
}, 10);
|
|
2684
2752
|
};
|
|
2753
|
+
/**
|
|
2754
|
+
* this replicates the effect from `handleShow()`
|
|
2755
|
+
* when `isOpen` is changed from outside
|
|
2756
|
+
*/
|
|
2757
|
+
useEffect(() => {
|
|
2758
|
+
if (isOpen === undefined) {
|
|
2759
|
+
return () => null;
|
|
2760
|
+
}
|
|
2761
|
+
if (isOpen) {
|
|
2762
|
+
setRendered(true);
|
|
2763
|
+
}
|
|
2764
|
+
const timeout = setTimeout(() => {
|
|
2765
|
+
setShow(isOpen);
|
|
2766
|
+
}, 10);
|
|
2767
|
+
return () => {
|
|
2768
|
+
clearTimeout(timeout);
|
|
2769
|
+
};
|
|
2770
|
+
}, [isOpen]);
|
|
2685
2771
|
useEffect(() => {
|
|
2686
2772
|
if (show === wasShowing.current) {
|
|
2687
2773
|
return;
|
|
@@ -2725,7 +2811,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2725
2811
|
handleShow(true);
|
|
2726
2812
|
}
|
|
2727
2813
|
const target = (_a = event.currentTarget) !== null && _a !== void 0 ? _a : event.target;
|
|
2728
|
-
setActiveAnchor(
|
|
2814
|
+
setActiveAnchor(target);
|
|
2729
2815
|
setProviderActiveAnchor({ current: target });
|
|
2730
2816
|
if (tooltipHideDelayTimerRef.current) {
|
|
2731
2817
|
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
@@ -2734,7 +2820,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2734
2820
|
const handleHideTooltip = () => {
|
|
2735
2821
|
if (clickable) {
|
|
2736
2822
|
// allow time for the mouse to reach the tooltip, in case there's a gap
|
|
2737
|
-
handleHideTooltipDelayed(delayHide ||
|
|
2823
|
+
handleHideTooltipDelayed(delayHide || 100);
|
|
2738
2824
|
}
|
|
2739
2825
|
else if (delayHide) {
|
|
2740
2826
|
handleHideTooltipDelayed();
|
|
@@ -2761,7 +2847,6 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2761
2847
|
};
|
|
2762
2848
|
},
|
|
2763
2849
|
};
|
|
2764
|
-
setCalculatingPosition(true);
|
|
2765
2850
|
computeTooltipPosition({
|
|
2766
2851
|
place,
|
|
2767
2852
|
offset,
|
|
@@ -2771,7 +2856,6 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2771
2856
|
strategy: positionStrategy,
|
|
2772
2857
|
middlewares,
|
|
2773
2858
|
}).then((computedStylesData) => {
|
|
2774
|
-
setCalculatingPosition(false);
|
|
2775
2859
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
2776
2860
|
setInlineStyles(computedStylesData.tooltipStyles);
|
|
2777
2861
|
}
|
|
@@ -2798,9 +2882,12 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2798
2882
|
handleHideTooltipDelayed();
|
|
2799
2883
|
}
|
|
2800
2884
|
};
|
|
2801
|
-
const
|
|
2802
|
-
|
|
2803
|
-
if (
|
|
2885
|
+
const handleClickOutsideAnchors = (event) => {
|
|
2886
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
2887
|
+
if (anchorById === null || anchorById === void 0 ? void 0 : anchorById.contains(event.target)) {
|
|
2888
|
+
return;
|
|
2889
|
+
}
|
|
2890
|
+
if (anchorsBySelect.some((anchor) => anchor.contains(event.target))) {
|
|
2804
2891
|
return;
|
|
2805
2892
|
}
|
|
2806
2893
|
handleShow(false);
|
|
@@ -2818,9 +2905,11 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2818
2905
|
useEffect(() => {
|
|
2819
2906
|
var _a, _b;
|
|
2820
2907
|
const elementRefs = new Set(anchorRefs);
|
|
2908
|
+
anchorsBySelect.forEach((anchor) => {
|
|
2909
|
+
elementRefs.add({ current: anchor });
|
|
2910
|
+
});
|
|
2821
2911
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
2822
2912
|
if (anchorById) {
|
|
2823
|
-
setActiveAnchor((anchor) => anchor.current === anchorById ? anchor : { current: anchorById });
|
|
2824
2913
|
elementRefs.add({ current: anchorById });
|
|
2825
2914
|
}
|
|
2826
2915
|
if (!elementRefs.size) {
|
|
@@ -2831,7 +2920,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2831
2920
|
}
|
|
2832
2921
|
const enabledEvents = [];
|
|
2833
2922
|
if (events.find((event) => event === 'click')) {
|
|
2834
|
-
window.addEventListener('click',
|
|
2923
|
+
window.addEventListener('click', handleClickOutsideAnchors);
|
|
2835
2924
|
enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
|
|
2836
2925
|
}
|
|
2837
2926
|
if (events.find((event) => event === 'hover')) {
|
|
@@ -2860,9 +2949,8 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2860
2949
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener(event, listener);
|
|
2861
2950
|
});
|
|
2862
2951
|
});
|
|
2863
|
-
const anchorElement = anchorById !== null && anchorById !== void 0 ? anchorById : activeAnchor.current;
|
|
2864
2952
|
const parentObserverCallback = (mutationList) => {
|
|
2865
|
-
if (!
|
|
2953
|
+
if (!activeAnchor) {
|
|
2866
2954
|
return;
|
|
2867
2955
|
}
|
|
2868
2956
|
mutationList.some((mutation) => {
|
|
@@ -2870,7 +2958,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2870
2958
|
return false;
|
|
2871
2959
|
}
|
|
2872
2960
|
return [...mutation.removedNodes].some((node) => {
|
|
2873
|
-
if (node.contains(
|
|
2961
|
+
if (node.contains(activeAnchor)) {
|
|
2874
2962
|
handleShow(false);
|
|
2875
2963
|
return true;
|
|
2876
2964
|
}
|
|
@@ -2884,7 +2972,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2884
2972
|
return () => {
|
|
2885
2973
|
var _a, _b;
|
|
2886
2974
|
if (events.find((event) => event === 'click')) {
|
|
2887
|
-
window.removeEventListener('click',
|
|
2975
|
+
window.removeEventListener('click', handleClickOutsideAnchors);
|
|
2888
2976
|
}
|
|
2889
2977
|
if (closeOnEsc) {
|
|
2890
2978
|
window.removeEventListener('keydown', handleEsc);
|
|
@@ -2901,12 +2989,16 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2901
2989
|
});
|
|
2902
2990
|
parentObserver.disconnect();
|
|
2903
2991
|
};
|
|
2904
|
-
|
|
2992
|
+
/**
|
|
2993
|
+
* rendered is also a dependency to ensure anchor observers are re-registered
|
|
2994
|
+
* since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM
|
|
2995
|
+
*/
|
|
2996
|
+
}, [rendered, anchorRefs, activeAnchor, closeOnEsc, events, delayHide, delayShow]);
|
|
2905
2997
|
useEffect(() => {
|
|
2906
2998
|
if (position) {
|
|
2907
2999
|
// if `position` is set, override regular and `float` positioning
|
|
2908
3000
|
handleTooltipPosition(position);
|
|
2909
|
-
return
|
|
3001
|
+
return;
|
|
2910
3002
|
}
|
|
2911
3003
|
if (float) {
|
|
2912
3004
|
if (lastFloatPosition.current) {
|
|
@@ -2920,29 +3012,21 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2920
3012
|
handleTooltipPosition(lastFloatPosition.current);
|
|
2921
3013
|
}
|
|
2922
3014
|
// if `float` is set, override regular positioning
|
|
2923
|
-
return
|
|
2924
|
-
}
|
|
2925
|
-
let elementReference = activeAnchor.current;
|
|
2926
|
-
if (anchorId) {
|
|
2927
|
-
// `anchorId` element takes precedence
|
|
2928
|
-
elementReference = document.querySelector(`[id='${anchorId}']`);
|
|
3015
|
+
return;
|
|
2929
3016
|
}
|
|
2930
|
-
setCalculatingPosition(true);
|
|
2931
|
-
let mounted = true;
|
|
2932
3017
|
computeTooltipPosition({
|
|
2933
3018
|
place,
|
|
2934
3019
|
offset,
|
|
2935
|
-
elementReference,
|
|
3020
|
+
elementReference: activeAnchor,
|
|
2936
3021
|
tooltipReference: tooltipRef.current,
|
|
2937
3022
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2938
3023
|
strategy: positionStrategy,
|
|
2939
3024
|
middlewares,
|
|
2940
3025
|
}).then((computedStylesData) => {
|
|
2941
|
-
if (!mounted) {
|
|
3026
|
+
if (!mounted.current) {
|
|
2942
3027
|
// invalidate computed positions after remount
|
|
2943
3028
|
return;
|
|
2944
3029
|
}
|
|
2945
|
-
setCalculatingPosition(false);
|
|
2946
3030
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
2947
3031
|
setInlineStyles(computedStylesData.tooltipStyles);
|
|
2948
3032
|
}
|
|
@@ -2950,21 +3034,20 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2950
3034
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
2951
3035
|
}
|
|
2952
3036
|
});
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
]);
|
|
3037
|
+
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
3038
|
+
useEffect(() => {
|
|
3039
|
+
var _a;
|
|
3040
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3041
|
+
const anchors = [...anchorsBySelect, anchorById];
|
|
3042
|
+
if (!activeAnchor || !anchors.includes(activeAnchor)) {
|
|
3043
|
+
/**
|
|
3044
|
+
* if there is no active anchor,
|
|
3045
|
+
* or if the current active anchor is not amongst the allowed ones,
|
|
3046
|
+
* reset it
|
|
3047
|
+
*/
|
|
3048
|
+
setActiveAnchor((_a = anchorsBySelect[0]) !== null && _a !== void 0 ? _a : anchorById);
|
|
3049
|
+
}
|
|
3050
|
+
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
2968
3051
|
useEffect(() => {
|
|
2969
3052
|
return () => {
|
|
2970
3053
|
if (tooltipShowDelayTimerRef.current) {
|
|
@@ -2976,16 +3059,17 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2976
3059
|
};
|
|
2977
3060
|
}, []);
|
|
2978
3061
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
2979
|
-
|
|
2980
|
-
|
|
3062
|
+
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
3063
|
+
return rendered ? (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
3064
|
+
[styles['show']]: canShow,
|
|
2981
3065
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2982
3066
|
[styles['clickable']]: clickable,
|
|
2983
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [
|
|
3067
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.exports.jsx(TooltipContent, { content: html })) || content || children, jsxRuntime.exports.jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
2984
3068
|
[styles['no-arrow']]: noArrow,
|
|
2985
|
-
}), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
3069
|
+
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
2986
3070
|
};
|
|
2987
3071
|
|
|
2988
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
3072
|
+
const TooltipController = ({ id, anchorId, anchorSelect, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
2989
3073
|
const [tooltipContent, setTooltipContent] = useState(content);
|
|
2990
3074
|
const [tooltipHtml, setTooltipHtml] = useState(html);
|
|
2991
3075
|
const [tooltipPlace, setTooltipPlace] = useState(place);
|
|
@@ -2997,7 +3081,11 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2997
3081
|
const [tooltipWrapper, setTooltipWrapper] = useState(wrapper);
|
|
2998
3082
|
const [tooltipEvents, setTooltipEvents] = useState(events);
|
|
2999
3083
|
const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy);
|
|
3000
|
-
const
|
|
3084
|
+
const [activeAnchor, setActiveAnchor] = useState(null);
|
|
3085
|
+
/**
|
|
3086
|
+
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
3087
|
+
*/
|
|
3088
|
+
const { anchorRefs, activeAnchor: providerActiveAnchor } = useTooltip(id);
|
|
3001
3089
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
3002
3090
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
3003
3091
|
var _a;
|
|
@@ -3064,9 +3152,30 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3064
3152
|
useEffect(() => {
|
|
3065
3153
|
setTooltipHtml(html);
|
|
3066
3154
|
}, [html]);
|
|
3155
|
+
useEffect(() => {
|
|
3156
|
+
setTooltipPlace(place);
|
|
3157
|
+
}, [place]);
|
|
3067
3158
|
useEffect(() => {
|
|
3068
3159
|
var _a;
|
|
3069
3160
|
const elementRefs = new Set(anchorRefs);
|
|
3161
|
+
let selector = anchorSelect;
|
|
3162
|
+
if (!selector && id) {
|
|
3163
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
3164
|
+
}
|
|
3165
|
+
if (selector) {
|
|
3166
|
+
try {
|
|
3167
|
+
const anchorsBySelect = document.querySelectorAll(selector);
|
|
3168
|
+
anchorsBySelect.forEach((anchor) => {
|
|
3169
|
+
elementRefs.add({ current: anchor });
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
catch (_b) {
|
|
3173
|
+
{
|
|
3174
|
+
// eslint-disable-next-line no-console
|
|
3175
|
+
console.warn(`[react-tooltip] "${anchorSelect}" is not a valid CSS selector`);
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3070
3179
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3071
3180
|
if (anchorById) {
|
|
3072
3181
|
elementRefs.add({ current: anchorById });
|
|
@@ -3074,7 +3183,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3074
3183
|
if (!elementRefs.size) {
|
|
3075
3184
|
return () => null;
|
|
3076
3185
|
}
|
|
3077
|
-
const anchorElement = (_a = activeAnchor
|
|
3186
|
+
const anchorElement = (_a = activeAnchor !== null && activeAnchor !== void 0 ? activeAnchor : anchorById) !== null && _a !== void 0 ? _a : providerActiveAnchor.current;
|
|
3078
3187
|
const observerCallback = (mutationList) => {
|
|
3079
3188
|
mutationList.forEach((mutation) => {
|
|
3080
3189
|
var _a;
|
|
@@ -3103,10 +3212,11 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3103
3212
|
// Remove the observer when the tooltip is destroyed
|
|
3104
3213
|
observer.disconnect();
|
|
3105
3214
|
};
|
|
3106
|
-
}, [anchorRefs, activeAnchor, anchorId]);
|
|
3215
|
+
}, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect]);
|
|
3107
3216
|
const props = {
|
|
3108
3217
|
id,
|
|
3109
3218
|
anchorId,
|
|
3219
|
+
anchorSelect,
|
|
3110
3220
|
className,
|
|
3111
3221
|
classNameArrow,
|
|
3112
3222
|
content: tooltipContent,
|
|
@@ -3130,6 +3240,8 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3130
3240
|
setIsOpen,
|
|
3131
3241
|
afterShow,
|
|
3132
3242
|
afterHide,
|
|
3243
|
+
activeAnchor,
|
|
3244
|
+
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
3133
3245
|
};
|
|
3134
3246
|
return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
|
|
3135
3247
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{createContext as t,useState as n,useCallback as r,useMemo as o,useContext as i,useRef as l,useEffect as a}from"react";function s(e){return e.split("-")[1]}function c(e){return"y"===e?"height":"width"}function u(e){return e.split("-")[0]}function f(e){return["top","bottom"].includes(u(e))?"x":"y"}function p(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,a=f(t),p=c(a),d=r[p]/2-o[p]/2,y="x"===a;let m;switch(u(t)){case"top":m={x:i,y:r.y-o.height};break;case"bottom":m={x:i,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:l};break;case"left":m={x:r.x-o.width,y:l};break;default:m={x:r.x,y:r.y}}switch(s(t)){case"start":m[a]-=d*(n&&y?-1:1);break;case"end":m[a]+=d*(n&&y?-1:1)}return m}function d(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function y(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function m(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=t,h=d(m),g=a[p?"floating"===f?"reference":"floating":f],v=y(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:s})),w="floating"===f?{...l.floating,x:r,y:o}:l.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),x=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},R=y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:b,strategy:s}):w);return{top:(v.top-R.top+h.top)/x.y,bottom:(R.bottom-v.bottom+h.bottom)/x.y,left:(v.left-R.left+h.left)/x.x,right:(R.right-v.right+h.right)/x.x}}const h=Math.min,g=Math.max;function v(e,t,n){return g(e,h(t,n))}const w=["top","right","bottom","left"].reduce(((e,t)=>e.concat(t,t+"-start",t+"-end")),[]),b={left:"right",right:"left",bottom:"top",top:"bottom"};function x(e){return e.replace(/left|right|bottom|top/g,(e=>b[e]))}function R(e,t,n){void 0===n&&(n=!1);const r=s(e),o=f(e),i=c(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=x(l)),{main:l,cross:x(l)}}const _={start:"end",end:"start"};function T(e){return e.replace(/start|end/g,(e=>_[e]))}const O=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:l,placement:a,platform:c,elements:f}=t,{alignment:p,allowedPlacements:d=w,autoAlignment:y=!0,...h}=e,g=void 0!==p||d===w?function(e,t,n){return(e?[...n.filter((t=>s(t)===e)),...n.filter((t=>s(t)!==e))]:n.filter((e=>u(e)===e))).filter((n=>!e||s(n)===e||!!t&&T(n)!==n))}(p||null,y,d):d,v=await m(t,h),b=(null==(n=l.autoPlacement)?void 0:n.index)||0,x=g[b];if(null==x)return{};const{main:_,cross:O}=R(x,i,await(null==c.isRTL?void 0:c.isRTL(f.floating)));if(a!==x)return{reset:{placement:g[0]}};const k=[v[u(x)],v[_],v[O]],S=[...(null==(r=l.autoPlacement)?void 0:r.overflows)||[],{placement:x,overflows:k}],A=g[b+1];if(A)return{data:{index:b+1,overflows:S},reset:{placement:A}};const E=S.slice().sort(((e,t)=>e.overflows[0]-t.overflows[0])),j=null==(o=E.find((e=>{let{overflows:t}=e;return t.every((e=>e<=0))})))?void 0:o.placement,L=j||E[0].placement;return L!==a?{data:{index:b+1,overflows:S},reset:{placement:L}}:{}}}};const k=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:d,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=e,w=u(r),b=u(l)===l,_=await(null==a.isRTL?void 0:a.isRTL(c.floating)),O=d||(b||!g?[x(l)]:function(e){const t=x(e);return[T(e),t,T(t)]}(l));d||"none"===h||O.push(...function(e,t,n,r){const o=s(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(u(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(T)))),i}(l,g,h,_));const k=[l,...O],S=await m(t,v),A=[];let E=(null==(n=o.flip)?void 0:n.overflows)||[];if(f&&A.push(S[w]),p){const{main:e,cross:t}=R(r,i,_);A.push(S[e],S[t])}if(E=[...E,{placement:r,overflows:A}],!A.every((e=>e<=0))){var j,L;const e=((null==(j=o.flip)?void 0:j.index)||0)+1,t=k[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(L=E.find((e=>e.overflows[0]<=0)))?void 0:L.placement;if(!n)switch(y){case"bestFit":{var P;const e=null==(P=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0];e&&(n=e);break}case"initialPlacement":n=l}if(r!==n)return{reset:{placement:n}}}return{}}}},S=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:l}=t,{padding:a=2,x:s,y:c}=e,p=y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:o.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(r.floating)),strategy:l}):o.reference),m=await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[],v=d(a);const w=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===m.length&&m[0].left>m[1].right&&null!=s&&null!=c)return m.find((e=>s>e.left-v.left&&s<e.right+v.right&&c>e.top-v.top&&c<e.bottom+v.bottom))||p;if(m.length>=2){if("x"===f(n)){const e=m[0],t=m[m.length-1],r="top"===u(n),o=e.top,i=t.bottom,l=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:l,right:a,width:a-l,height:i-o,x:l,y:o}}const e="left"===u(n),t=g(...m.map((e=>e.right))),r=h(...m.map((e=>e.left))),o=m.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return p}},floating:r.floating,strategy:l});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}};const A=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=u(n),a=s(n),c="x"===f(n),p=["left","top"].includes(l)?-1:1,d=i&&c?-1:1,y="function"==typeof t?t(e):t;let{mainAxis:m,crossAxis:h,alignmentAxis:g}="number"==typeof y?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...y};return a&&"number"==typeof g&&(h="end"===a?-1*g:g),c?{x:h*d,y:m*p}:{x:m*p,y:h*d}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};const E=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=e,c={x:n,y:r},p=await m(t,s),d=f(u(o)),y="x"===d?"y":"x";let h=c[d],g=c[y];if(i){const e="y"===d?"bottom":"right";h=v(h+p["y"===d?"top":"left"],h,h-p[e])}if(l){const e="y"===y?"bottom":"right";g=v(g+p["y"===y?"top":"left"],g,g-p[e])}const w=a.fn({...t,[d]:h,[y]:g});return{...w,data:{x:w.x-n,y:w.y-r}}}}},j=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:l=(()=>{}),...a}=e,c=await m(t,a),f=u(n),p=s(n);let d,y;"top"===f||"bottom"===f?(d=f,y=p===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=f,d="end"===p?"top":"bottom");const h=g(c.left,0),v=g(c.right,0),w=g(c.top,0),b=g(c.bottom,0),x={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(0!==w||0!==b?w+b:g(c.top,c.bottom)):c[d]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(0!==h||0!==v?h+v:g(c.left,c.right)):c[y])};await l({...t,...x});const R=await o.getDimensions(i.floating);return r.floating.width!==R.width||r.floating.height!==R.height?{reset:{rects:!0}}:{}}}};function L(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){return L(e).getComputedStyle(e)}const D=Math.min,N=Math.max,F=Math.round;function C(e){const t=P(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,l=F(n)!==o||F(r)!==i;return l&&(n=o,r=i),{width:n,height:r,fallback:l}}function I(e){return B(e)?(e.nodeName||"").toLowerCase():""}let $;function W(){if($)return $;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?($=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),$):navigator.userAgent}function H(e){return e instanceof L(e).HTMLElement}function U(e){return e instanceof L(e).Element}function B(e){return e instanceof L(e).Node}function V(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof L(e).ShadowRoot||e instanceof ShadowRoot}function M(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=P(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function z(e){return["table","td","th"].includes(I(e))}function Y(e){const t=/firefox/i.test(W()),n=P(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((e=>n.willChange.includes(e)))||["paint","layout","strict","content"].some((e=>{const t=n.contain;return null!=t&&t.includes(e)}))}function q(){return!/^((?!chrome|android).)*safari/i.test(W())}function X(e){return["html","body","#document"].includes(I(e))}function K(e){return U(e)?e:e.contextElement}const J={x:1,y:1};function Z(e){const t=K(e);if(!H(t))return J;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=C(t);let l=(i?F(n.width):n.width)/r,a=(i?F(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}function G(e,t,n,r){var o,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect(),a=K(e);let s=J;t&&(r?U(r)&&(s=Z(r)):s=Z(e));const c=a?L(a):window,u=!q()&&n;let f=(l.left+(u&&(null==(o=c.visualViewport)?void 0:o.offsetLeft)||0))/s.x,p=(l.top+(u&&(null==(i=c.visualViewport)?void 0:i.offsetTop)||0))/s.y,d=l.width/s.x,y=l.height/s.y;if(a){const e=L(a),t=r&&U(r)?L(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=Z(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.paddingTop))*e.y,f*=e.x,p*=e.y,d*=e.x,y*=e.y,f+=t.x,p+=t.y,n=L(n).frameElement}}return{width:d,height:y,top:p,right:f+d,bottom:p+y,left:f,x:f,y:p}}function Q(e){return((B(e)?e.ownerDocument:e.document)||window.document).documentElement}function ee(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function te(e){return G(Q(e)).left+ee(e).scrollLeft}function ne(e){if("html"===I(e))return e;const t=e.assignedSlot||e.parentNode||V(e)&&e.host||Q(e);return V(t)?t.host:t}function re(e){const t=ne(e);return X(t)?t.ownerDocument.body:H(t)&&M(t)?t:re(t)}function oe(e,t){var n;void 0===t&&(t=[]);const r=re(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=L(r);return o?t.concat(i,i.visualViewport||[],M(r)?r:[]):t.concat(r,oe(r))}function ie(e,t,n){return"viewport"===t?y(function(e,t){const n=L(e),r=Q(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=q();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n)):U(t)?y(function(e,t){const n=G(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=H(e)?Z(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n)):y(function(e){const t=Q(e),n=ee(e),r=e.ownerDocument.body,o=N(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=N(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+te(e);const a=-n.scrollTop;return"rtl"===P(r).direction&&(l+=N(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(Q(e)))}function le(e){return H(e)&&"fixed"!==P(e).position?e.offsetParent:null}function ae(e){const t=L(e);let n=le(e);for(;n&&z(n)&&"static"===P(n).position;)n=le(n);return n&&("html"===I(n)||"body"===I(n)&&"static"===P(n).position&&!Y(n))?t:n||function(e){let t=ne(e);for(;H(t)&&!X(t);){if(Y(t))return t;t=ne(t)}return null}(e)||t}function se(e,t,n){const r=H(t),o=Q(t),i=G(e,!0,"fixed"===n,t);let l={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==I(t)||M(o))&&(l=ee(t)),H(t)){const e=G(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=te(o));return{x:i.left+l.scrollLeft-a.x,y:i.top+l.scrollTop-a.y,width:i.width,height:i.height}}const ce={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=oe(e).filter((e=>U(e)&&"body"!==I(e))),o=null;const i="fixed"===P(e).position;let l=i?ne(e):e;for(;U(l)&&!X(l);){const e=P(l),t=Y(l);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==l)),l=ne(l)}return t.set(e,r),r}(t,this._c):[].concat(n),l=[...i,r],a=l[0],s=l.reduce(((e,n)=>{const r=ie(t,n,o);return e.top=N(r.top,e.top),e.right=D(r.right,e.right),e.bottom=D(r.bottom,e.bottom),e.left=N(r.left,e.left),e}),ie(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=H(n),i=Q(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},a={x:1,y:1};const s={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==I(n)||M(i))&&(l=ee(n)),H(n))){const e=G(n);a=Z(n),s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-l.scrollLeft*a.x+s.x,y:t.y*a.y-l.scrollTop*a.y+s.y}},isElement:U,getDimensions:function(e){return H(e)?C(e):e.getBoundingClientRect()},getOffsetParent:ae,getDocumentElement:Q,getScale:Z,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ae,i=this.getDimensions;return{reference:se(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===P(e).direction},ue=(e,t,n)=>{const r=new Map,o={platform:ce,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));if(null==l&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),a.filter((e=>{let{name:t}=e;return"autoPlacement"===t||"flip"===t})).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));e&&t||console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "));let c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=p(c,r,s),d=r,y={},m=0;for(let n=0;n<a.length;n++){const{name:i,fn:h}=a[n],{x:g,y:v,data:w,reset:b}=await h({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:y,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,y={...y,[i]:{...y[i],...w}},m>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(c=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:f}=p(c,d,s))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:y}})(e,t,{...o,platform:i})};var fe,pe={exports:{}},de={};
|
|
1
|
+
import e,{createContext as t,useState as n,useCallback as r,useMemo as o,useContext as i,useRef as l,useEffect as a,useLayoutEffect as c}from"react";function s(e){return e.split("-")[1]}function u(e){return"y"===e?"height":"width"}function f(e){return e.split("-")[0]}function d(e){return["top","bottom"].includes(f(e))?"x":"y"}function p(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,a=d(t),c=u(a),p=r[c]/2-o[c]/2,m="x"===a;let y;switch(f(t)){case"top":y={x:i,y:r.y-o.height};break;case"bottom":y={x:i,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:l};break;case"left":y={x:r.x-o.width,y:l};break;default:y={x:r.x,y:r.y}}switch(s(t)){case"start":y[a]-=p*(n&&m?-1:1);break;case"end":y[a]+=p*(n&&m?-1:1)}return y}function m(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function y(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function h(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=t,h=m(p),g=a[d?"floating"===f?"reference":"floating":f],v=y(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:s,rootBoundary:u,strategy:c})),w="floating"===f?{...l.floating,x:r,y:o}:l.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),x=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},R=y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:b,strategy:c}):w);return{top:(v.top-R.top+h.top)/x.y,bottom:(R.bottom-v.bottom+h.bottom)/x.y,left:(v.left-R.left+h.left)/x.x,right:(R.right-v.right+h.right)/x.x}}const g=Math.min,v=Math.max;function w(e,t,n){return v(e,g(t,n))}const b=["top","right","bottom","left"].reduce(((e,t)=>e.concat(t,t+"-start",t+"-end")),[]),x={left:"right",right:"left",bottom:"top",top:"bottom"};function R(e){return e.replace(/left|right|bottom|top/g,(e=>x[e]))}function _(e,t,n){void 0===n&&(n=!1);const r=s(e),o=d(e),i=u(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=R(l)),{main:l,cross:R(l)}}const T={start:"end",end:"start"};function S(e){return e.replace(/start|end/g,(e=>T[e]))}const O=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:l,placement:a,platform:c,elements:u}=t,{alignment:d,allowedPlacements:p=b,autoAlignment:m=!0,...y}=e,g=void 0!==d||p===b?function(e,t,n){return(e?[...n.filter((t=>s(t)===e)),...n.filter((t=>s(t)!==e))]:n.filter((e=>f(e)===e))).filter((n=>!e||s(n)===e||!!t&&S(n)!==n))}(d||null,m,p):p,v=await h(t,y),w=(null==(n=l.autoPlacement)?void 0:n.index)||0,x=g[w];if(null==x)return{};const{main:R,cross:T}=_(x,i,await(null==c.isRTL?void 0:c.isRTL(u.floating)));if(a!==x)return{reset:{placement:g[0]}};const O=[v[f(x)],v[R],v[T]],A=[...(null==(r=l.autoPlacement)?void 0:r.overflows)||[],{placement:x,overflows:O}],k=g[w+1];if(k)return{data:{index:w+1,overflows:A},reset:{placement:k}};const E=A.slice().sort(((e,t)=>e.overflows[0]-t.overflows[0])),j=null==(o=E.find((e=>{let{overflows:t}=e;return t.every((e=>e<=0))})))?void 0:o.placement,L=j||E[0].placement;return L!==a?{data:{index:w+1,overflows:A},reset:{placement:L}}:{}}}};const A=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...v}=e,w=f(r),b=f(l)===l,x=await(null==a.isRTL?void 0:a.isRTL(c.floating)),T=p||(b||!g?[R(l)]:function(e){const t=R(e);return[S(e),t,S(t)]}(l));p||"none"===y||T.push(...function(e,t,n,r){const o=s(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(f(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(S)))),i}(l,g,y,x));const O=[l,...T],A=await h(t,v),k=[];let E=(null==(n=o.flip)?void 0:n.overflows)||[];if(u&&k.push(A[w]),d){const{main:e,cross:t}=_(r,i,x);k.push(A[e],A[t])}if(E=[...E,{placement:r,overflows:k}],!k.every((e=>e<=0))){var j,L;const e=((null==(j=o.flip)?void 0:j.index)||0)+1,t=O[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(L=E.find((e=>e.overflows[0]<=0)))?void 0:L.placement;if(!n)switch(m){case"bestFit":{var P;const e=null==(P=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0];e&&(n=e);break}case"initialPlacement":n=l}if(r!==n)return{reset:{placement:n}}}return{}}}},k=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:l}=t,{padding:a=2,x:c,y:s}=e,u=y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:o.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(r.floating)),strategy:l}):o.reference),p=await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[],h=m(a);const w=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===p.length&&p[0].left>p[1].right&&null!=c&&null!=s)return p.find((e=>c>e.left-h.left&&c<e.right+h.right&&s>e.top-h.top&&s<e.bottom+h.bottom))||u;if(p.length>=2){if("x"===d(n)){const e=p[0],t=p[p.length-1],r="top"===f(n),o=e.top,i=t.bottom,l=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:l,right:a,width:a-l,height:i-o,x:l,y:o}}const e="left"===f(n),t=v(...p.map((e=>e.right))),r=g(...p.map((e=>e.left))),o=p.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return u}},floating:r.floating,strategy:l});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}};const E=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=f(n),a=s(n),c="x"===d(n),u=["left","top"].includes(l)?-1:1,p=i&&c?-1:1,m="function"==typeof t?t(e):t;let{mainAxis:y,crossAxis:h,alignmentAxis:g}="number"==typeof m?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return a&&"number"==typeof g&&(h="end"===a?-1*g:g),c?{x:h*p,y:y*u}:{x:y*u,y:h*p}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};const j=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=e,s={x:n,y:r},u=await h(t,c),p=d(f(o)),m="x"===p?"y":"x";let y=s[p],g=s[m];if(i){const e="y"===p?"bottom":"right";y=w(y+u["y"===p?"top":"left"],y,y-u[e])}if(l){const e="y"===m?"bottom":"right";g=w(g+u["y"===m?"top":"left"],g,g-u[e])}const v=a.fn({...t,[p]:y,[m]:g});return{...v,data:{x:v.x-n,y:v.y-r}}}}},L=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:l=(()=>{}),...a}=e,c=await h(t,a),u=f(n),d=s(n);let p,m;"top"===u||"bottom"===u?(p=u,m=d===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=u,p="end"===d?"top":"bottom");const y=v(c.left,0),g=v(c.right,0),w=v(c.top,0),b=v(c.bottom,0),x={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(0!==w||0!==b?w+b:v(c.top,c.bottom)):c[p]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(0!==y||0!==g?y+g:v(c.left,c.right)):c[m])};await l({...t,...x});const R=await o.getDimensions(i.floating);return r.floating.width!==R.width||r.floating.height!==R.height?{reset:{rects:!0}}:{}}}};function P(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function D(e){return P(e).getComputedStyle(e)}const N=Math.min,F=Math.max,$=Math.round;function C(e){const t=D(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,l=$(n)!==o||$(r)!==i;return l&&(n=o,r=i),{width:n,height:r,fallback:l}}function I(e){return V(e)?(e.nodeName||"").toLowerCase():""}let W;function H(){if(W)return W;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(W=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),W):navigator.userAgent}function U(e){return e instanceof P(e).HTMLElement}function B(e){return e instanceof P(e).Element}function V(e){return e instanceof P(e).Node}function M(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof P(e).ShadowRoot||e instanceof ShadowRoot}function q(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=D(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function z(e){return["table","td","th"].includes(I(e))}function Y(e){const t=/firefox/i.test(H()),n=D(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((e=>n.willChange.includes(e)))||["paint","layout","strict","content"].some((e=>{const t=n.contain;return null!=t&&t.includes(e)}))}function X(){return!/^((?!chrome|android).)*safari/i.test(H())}function K(e){return["html","body","#document"].includes(I(e))}function J(e){return B(e)?e:e.contextElement}const Z={x:1,y:1};function G(e){const t=J(e);if(!U(t))return Z;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=C(t);let l=(i?$(n.width):n.width)/r,a=(i?$(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}function Q(e,t,n,r){var o,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect(),a=J(e);let c=Z;t&&(r?B(r)&&(c=G(r)):c=G(e));const s=a?P(a):window,u=!X()&&n;let f=(l.left+(u&&(null==(o=s.visualViewport)?void 0:o.offsetLeft)||0))/c.x,d=(l.top+(u&&(null==(i=s.visualViewport)?void 0:i.offsetTop)||0))/c.y,p=l.width/c.x,m=l.height/c.y;if(a){const e=P(a),t=r&&B(r)?P(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=G(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.paddingTop))*e.y,f*=e.x,d*=e.y,p*=e.x,m*=e.y,f+=t.x,d+=t.y,n=P(n).frameElement}}return{width:p,height:m,top:d,right:f+p,bottom:d+m,left:f,x:f,y:d}}function ee(e){return((V(e)?e.ownerDocument:e.document)||window.document).documentElement}function te(e){return B(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ne(e){return Q(ee(e)).left+te(e).scrollLeft}function re(e){if("html"===I(e))return e;const t=e.assignedSlot||e.parentNode||M(e)&&e.host||ee(e);return M(t)?t.host:t}function oe(e){const t=re(e);return K(t)?t.ownerDocument.body:U(t)&&q(t)?t:oe(t)}function ie(e,t){var n;void 0===t&&(t=[]);const r=oe(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=P(r);return o?t.concat(i,i.visualViewport||[],q(r)?r:[]):t.concat(r,ie(r))}function le(e,t,n){return"viewport"===t?y(function(e,t){const n=P(e),r=ee(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,c=0;if(o){i=o.width,l=o.height;const e=X();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:l,x:a,y:c}}(e,n)):B(t)?y(function(e,t){const n=Q(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=U(e)?G(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n)):y(function(e){const t=ee(e),n=te(e),r=e.ownerDocument.body,o=F(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=F(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ne(e);const a=-n.scrollTop;return"rtl"===D(r).direction&&(l+=F(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(ee(e)))}function ae(e){return U(e)&&"fixed"!==D(e).position?e.offsetParent:null}function ce(e){const t=P(e);let n=ae(e);for(;n&&z(n)&&"static"===D(n).position;)n=ae(n);return n&&("html"===I(n)||"body"===I(n)&&"static"===D(n).position&&!Y(n))?t:n||function(e){let t=re(e);for(;U(t)&&!K(t);){if(Y(t))return t;t=re(t)}return null}(e)||t}function se(e,t,n){const r=U(t),o=ee(t),i=Q(e,!0,"fixed"===n,t);let l={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==I(t)||q(o))&&(l=te(t)),U(t)){const e=Q(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=ne(o));return{x:i.left+l.scrollLeft-a.x,y:i.top+l.scrollTop-a.y,width:i.width,height:i.height}}const ue={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=ie(e).filter((e=>B(e)&&"body"!==I(e))),o=null;const i="fixed"===D(e).position;let l=i?re(e):e;for(;B(l)&&!K(l);){const e=D(l),t=Y(l);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==l)),l=re(l)}return t.set(e,r),r}(t,this._c):[].concat(n),l=[...i,r],a=l[0],c=l.reduce(((e,n)=>{const r=le(t,n,o);return e.top=F(r.top,e.top),e.right=N(r.right,e.right),e.bottom=N(r.bottom,e.bottom),e.left=F(r.left,e.left),e}),le(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=U(n),i=ee(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},a={x:1,y:1};const c={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==I(n)||q(i))&&(l=te(n)),U(n))){const e=Q(n);a=G(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-l.scrollLeft*a.x+c.x,y:t.y*a.y-l.scrollTop*a.y+c.y}},isElement:B,getDimensions:function(e){return U(e)?C(e):e.getBoundingClientRect()},getOffsetParent:ce,getDocumentElement:ee,getScale:G,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||ce,i=this.getDimensions;return{reference:se(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===D(e).direction},fe=(e,t,n)=>{const r=new Map,o={platform:ue,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));if(null==l&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),a.filter((e=>{let{name:t}=e;return"autoPlacement"===t||"flip"===t})).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));e&&t||console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "));let s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=p(s,r,c),d=r,m={},y=0;for(let n=0;n<a.length;n++){const{name:i,fn:h}=a[n],{x:g,y:v,data:w,reset:b}=await h({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:s,platform:l,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,m={...m,[i]:{...m[i],...w}},y>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),b&&y<=50&&(y++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(s=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:f}=p(s,d,c))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};var de,pe={exports:{}},me={};
|
|
2
2
|
/** @license React v16.14.0
|
|
3
3
|
* react-jsx-runtime.development.js
|
|
4
4
|
*
|
|
@@ -7,9 +7,9 @@ import e,{createContext as t,useState as n,useCallback as r,useMemo as o,useCont
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
de=me,function(){var t=e,n=60103,r=60106;de.Fragment=60107;var o=60108,i=60114,l=60109,a=60110,c=60112,s=60113,u=60120,f=60115,d=60116,p=60121,m=60122,y=60117,h=60129,g=60131;if("function"==typeof Symbol&&Symbol.for){var v=Symbol.for;n=v("react.element"),r=v("react.portal"),de.Fragment=v("react.fragment"),o=v("react.strict_mode"),i=v("react.profiler"),l=v("react.provider"),a=v("react.context"),c=v("react.forward_ref"),s=v("react.suspense"),u=v("react.suspense_list"),f=v("react.memo"),d=v("react.lazy"),p=v("react.block"),m=v("react.server.block"),y=v("react.fundamental"),v("react.scope"),v("react.opaque.id"),h=v("react.debug_trace_mode"),v("react.offscreen"),g=v("react.legacy_hidden")}var w="function"==typeof Symbol&&Symbol.iterator,b=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];R("error",e,n)}function R(e,t,n){var r=b.ReactDebugCurrentFrame,o="";if(O){var i=T(O.type),l=O._owner;o+=function(e,t,n){var r="";if(t){var o=t.fileName,i=o.replace(_,"");if(/^index\./.test(i)){var l=o.match(_);if(l){var a=l[1];a&&(i=a.replace(_,"")+"/"+i)}}r=" (at "+i+":"+t.lineNumber+")"}else n&&(r=" (created by "+n+")");return"\n in "+(e||"Unknown")+r}(i,O._source,l&&T(l.type))}""!==(o+=r.getStackAddendum())&&(t+="%s",n=n.concat([o]));var a=n.map((function(e){return""+e}));a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}var _=/^(.*)[\\\/]/;function T(e){if(null==e)return null;if("number"==typeof e.tag&&x("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case de.Fragment:return"Fragment";case r:return"Portal";case i:return"Profiler";case o:return"StrictMode";case s:return"Suspense";case u:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case a:return"Context.Consumer";case l:return"Context.Provider";case c:return m=e,y=e.render,h="ForwardRef",g=y.displayName||y.name||"",m.displayName||(""!==g?h+"("+g+")":h);case f:return T(e.type);case p:return T(e.render);case d:var t=1===(n=e)._status?n._result:null;if(t)return T(t)}var n,m,y,h,g;return null}var S={};b.ReactDebugCurrentFrame;var O=null;function A(e){O=e}var k,E,j,L=b.ReactCurrentOwner,P=Object.prototype.hasOwnProperty,D={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,r,o,i){var l,a={},c=null,s=null;for(l in void 0!==r&&(c=""+r),function(e){if(P.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(c=""+t.key),function(e){if(P.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(s=t.ref,function(e,t){if("string"==typeof e.ref&&L.current&&t&&L.current.stateNode!==t){var n=T(L.current.type);j[n]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',T(L.current.type),e.ref),j[n]=!0)}}(t,i)),t)P.call(t,l)&&!D.hasOwnProperty(l)&&(a[l]=t[l]);if(e&&e.defaultProps){var u=e.defaultProps;for(l in u)void 0===a[l]&&(a[l]=u[l])}if(c||s){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;c&&function(e,t){var n=function(){k||(k=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,f),s&&function(e,t){var n=function(){E||(E=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,f)}return function(e,t,r,o,i,l,a){var c={$$typeof:n,type:e,key:t,ref:r,props:a,_owner:l,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}(e,c,s,i,o,L.current,a)}j={};var F,$=b.ReactCurrentOwner;function C(e){O=e}function I(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function W(){if($.current){var e=T($.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}b.ReactDebugCurrentFrame,F=!1;var H={};function U(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=W();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!H[n]){H[n]=!0;var r="";e&&e._owner&&e._owner!==$.current&&(r=" It was passed a child from "+T(e._owner.type)+"."),C(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),C(null)}}}function B(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];I(r)&&U(r,t)}else if(I(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=w&&e[w]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,l=o.call(e);!(i=l.next()).done;)I(i.value)&&U(i.value,t)}}function V(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==f)return;t=n.propTypes}if(t){var r=T(n);!function(e,t,n,r,o){var i=Function.call.bind(Object.prototype.hasOwnProperty);for(var l in e)if(i(e,l)){var a=void 0;try{if("function"!=typeof e[l]){var c=Error((r||"React class")+": "+n+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}a=e[l](t,l,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){a=e}!a||a instanceof Error||(A(o),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,l,typeof a),A(null)),a instanceof Error&&!(a.message in S)&&(S[a.message]=!0,A(o),x("Failed %s type: %s",n,a.message),A(null))}}(t,e.props,"prop",r,e)}else void 0===n.PropTypes||F||(F=!0,x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function M(e,t,r,v,w,b){var R=function(e){return"string"==typeof e||"function"==typeof e||e===de.Fragment||e===i||e===h||e===o||e===s||e===u||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===f||e.$$typeof===l||e.$$typeof===a||e.$$typeof===c||e.$$typeof===y||e.$$typeof===p||e[0]===m)}(e);if(!R){var _="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S,O=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(w);_+=O||W(),null===e?S="null":Array.isArray(e)?S="array":void 0!==e&&e.$$typeof===n?(S="<"+(T(e.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,_)}var A=N(e,t,r,w,b);if(null==A)return A;if(R){var k=t.children;if(void 0!==k)if(v)if(Array.isArray(k)){for(var E=0;E<k.length;E++)B(k[E],e);Object.freeze&&Object.freeze(k)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else B(k,e)}return e===de.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){C(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),C(null);break}}null!==e.ref&&(C(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),C(null))}(A):V(A),A}var q=function(e,t,n){return M(e,t,n,!1)},z=function(e,t,n){return M(e,t,n,!0)};de.jsx=q,de.jsxs=z}(),pe.exports=me;var ye,he={exports:{}};
|
|
11
11
|
/*!
|
|
12
12
|
Copyright (c) 2018 Jed Watson.
|
|
13
13
|
Licensed under the MIT License (MIT), see
|
|
14
14
|
http://jedwatson.github.io/classnames
|
|
15
|
-
*/ye=me,function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var l=t.apply(null,o);l&&n.push(l)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var a in o)e.call(o,a)&&o[a]&&n.push(a)}}}return n.join(" ")}ye.exports?(t.default=t,ye.exports=t):window.classNames=t}();var he=me.exports;const ge=(e,t,n)=>{let r=null;return function(...o){r&&clearTimeout(r),r=setTimeout((()=>{r=null,n||e.apply(this,o)}),t)}},ve=({content:e})=>pe.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}}),we={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},be=t({getTooltipData:()=>we}),xe=({children:e})=>{const[t,i]=n({DEFAULT_TOOLTIP_ID:new Set}),[l,a]=n({DEFAULT_TOOLTIP_ID:{current:null}}),s=(e,...t)=>{i((n=>{var r;const o=null!==(r=n[e])&&void 0!==r?r:new Set;return t.forEach((e=>o.add(e))),{...n,[e]:new Set(o)}}))},c=(e,...t)=>{i((n=>{const r=n[e];return r?(t.forEach((e=>r.delete(e))),{...n}):n}))},u=r(((e="DEFAULT_TOOLTIP_ID")=>{var n,r;return{anchorRefs:null!==(n=t[e])&&void 0!==n?n:new Set,activeAnchor:null!==(r=l[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>c(e,...t),setActiveAnchor:t=>((e,t)=>{a((n=>{var r;return(null===(r=n[e])||void 0===r?void 0:r.current)===t.current?n:{...n,[e]:t}}))})(e,t)}}),[t,l,s,c]),f=o((()=>({getTooltipData:u})),[u]);return pe.exports.jsx(be.Provider,{value:f,children:e})};function Re(e="DEFAULT_TOOLTIP_ID"){return i(be).getTooltipData(e)}const _e=({tooltipId:e,children:t,className:n,place:r,content:o,html:i,variant:s,offset:c,wrapper:u,events:f,positionStrategy:p,delayShow:d,delayHide:y})=>{const{attach:m,detach:h}=Re(e),g=l(null);return a((()=>(m(g),()=>{h(g)})),[]),pe.exports.jsx("span",{ref:g,className:he("react-tooltip-wrapper",n),"data-tooltip-place":r,"data-tooltip-content":o,"data-tooltip-html":i,"data-tooltip-variant":s,"data-tooltip-offset":c,"data-tooltip-wrapper":u,"data-tooltip-events":f,"data-tooltip-position-strategy":p,"data-tooltip-delay-show":d,"data-tooltip-delay-hide":y,children:t})},Te=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:l=[A(Number(o)),k(),E({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const a=l;return n?(a.push({name:"arrow",options:u={element:n,padding:5},async fn(e){const{element:t,padding:n=0}=u||{},{x:r,y:o,placement:i,rects:l,platform:a}=e;if(null==t)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const p=d(n),y={x:r,y:o},m=f(i),h=c(m),g=await a.getDimensions(t),w="y"===m?"top":"left",b="y"===m?"bottom":"right",x=l.reference[h]+l.reference[m]-y[m]-l.floating[h],R=y[m]-l.reference[m],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(t));let T=_?"y"===m?_.clientHeight||0:_.clientWidth||0:0;0===T&&(T=l.floating[h]);const O=x/2-R/2,k=p[w],S=T-g[h]-p[b],A=T/2-g[h]/2+O,E=v(k,A,S),j=null!=s(i)&&A!=E&&l.reference[h]/2-(A<k?p[w]:p[b])-g[h]/2<0;return{[m]:y[m]-(j?A<k?k-A:S-A:0),data:{[m]:E,centerOffset:A-E}}}}),ue(e,t,{placement:r,strategy:i,middleware:a}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var o,i;const l={left:`${e}px`,top:`${t}px`},{x:a,y:s}=null!==(o=r.arrow)&&void 0!==o?o:{x:0,y:0};return{tooltipStyles:l,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",[null!==(i={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==i?i:"bottom"]:"-4px"}}}))):ue(e,t,{placement:"bottom",strategy:i,middleware:a}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})));var u};var Oe={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T","no-arrow":"styles-module_no-arrow__KcFZN",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",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"};const ke=({id:e,className:t,classNameArrow:r,variant:o="dark",anchorId:i,place:s="top",offset:c=10,events:u=["hover"],positionStrategy:f="absolute",middlewares:p,wrapper:d,children:y=null,delayShow:m=0,delayHide:h=0,float:g=!1,noArrow:v=!1,clickable:w=!1,closeOnEsc:b=!1,style:x,position:R,afterShow:_,afterHide:T,content:O,html:k,isOpen:S,setIsOpen:A})=>{const E=l(null),j=l(null),L=l(null),P=l(null),[D,N]=n({}),[F,C]=n({}),[I,$]=n(!1),W=l(!1),[H,U]=n(!1),B=l(null),{anchorRefs:V,setActiveAnchor:M}=Re(e),[z,Y]=n({current:null}),q=l(!1),X=e=>{A?A(e):void 0===S&&$(e)};a((()=>{I!==W.current&&(W.current=I,I?null==_||_():null==T||T())}),[I]);const K=(e=h)=>{P.current&&clearTimeout(P.current),P.current=setTimeout((()=>{q.current||X(!1)}),e)},J=e=>{var t;if(!e)return;m?(L.current&&clearTimeout(L.current),L.current=setTimeout((()=>{X(!0)}),m)):X(!0);const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;Y((e=>e.current===n?e:{current:n})),M({current:n}),P.current&&clearTimeout(P.current)},Z=()=>{w?K(h||50):h?K():X(!1),L.current&&clearTimeout(L.current)},G=({x:e,y:t})=>{const n={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};U(!0),Te({place:s,offset:c,elementReference:n,tooltipReference:E.current,tooltipArrowReference:j.current,strategy:f,middlewares:p}).then((e=>{U(!1),Object.keys(e.tooltipStyles).length&&N(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&C(e.tooltipArrowStyles)}))},Q=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};G(n),B.current=n},ee=e=>{J(e),h&&K()},te=e=>{var t;(null===(t=z.current)||void 0===t?void 0:t.contains(e.target))||X(!1)},ne=e=>{"Escape"===e.key&&X(!1)},re=ge(J,50),oe=ge(Z,50);a((()=>{var e,t;const n=new Set(V),r=document.querySelector(`[id='${i}']`);if(r&&(Y((e=>e.current===r?e:{current:r})),n.add({current:r})),!n.size)return()=>null;b&&window.addEventListener("keydown",ne);const o=[];u.find((e=>"click"===e))&&(window.addEventListener("click",te),o.push({event:"click",listener:ee})),u.find((e=>"hover"===e))&&(o.push({event:"mouseenter",listener:re},{event:"mouseleave",listener:oe},{event:"focus",listener:re},{event:"blur",listener:oe}),g&&o.push({event:"mousemove",listener:Q}));const l=()=>{q.current=!0},a=()=>{q.current=!1,Z()};w&&(null===(e=E.current)||void 0===e||e.addEventListener("mouseenter",l),null===(t=E.current)||void 0===t||t.addEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))}));const s=null!=r?r:z.current,c=new MutationObserver((e=>{s&&e.some((e=>"childList"===e.type&&[...e.removedNodes].some((e=>!!e.contains(s)&&(X(!1),!0)))))}));return c.observe(document.body,{attributes:!1,childList:!0,subtree:!0}),()=>{var e,t;u.find((e=>"click"===e))&&window.removeEventListener("click",te),b&&window.removeEventListener("keydown",ne),w&&(null===(e=E.current)||void 0===e||e.removeEventListener("mouseenter",l),null===(t=E.current)||void 0===t||t.removeEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))})),c.disconnect()}}),[V,z,b,i,u,h,m]),a((()=>{if(R)return G(R),()=>null;if(g)return B.current&&G(B.current),()=>null;let e=z.current;i&&(e=document.querySelector(`[id='${i}']`)),U(!0);let t=!0;return Te({place:s,offset:c,elementReference:e,tooltipReference:E.current,tooltipArrowReference:j.current,strategy:f,middlewares:p}).then((e=>{t&&(U(!1),Object.keys(e.tooltipStyles).length&&N(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&C(e.tooltipArrowStyles))})),()=>{t=!1}}),[I,S,i,z,O,k,s,c,f,R]),a((()=>()=>{L.current&&clearTimeout(L.current),P.current&&clearTimeout(P.current)}),[]);const ie=Boolean(k||O||y);return pe.exports.jsxs(d,{id:e,role:"tooltip",className:he("react-tooltip",Oe.tooltip,Oe[o],t,{[Oe.show]:ie&&!H&&(S||I),[Oe.fixed]:"fixed"===f,[Oe.clickable]:w}),style:{...x,...D},ref:E,children:[y||k&&pe.exports.jsx(ve,{content:k})||O,pe.exports.jsx(d,{className:he("react-tooltip-arrow",Oe.arrow,r,{[Oe["no-arrow"]]:v}),style:F,ref:j})]})},Se=({id:e,anchorId:t,content:r,html:o,className:i,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],positionStrategy:y="absolute",middlewares:m,delayShow:h=0,delayHide:g=0,float:v=!1,noArrow:w=!1,clickable:b=!1,closeOnEsc:x=!1,style:R,position:_,isOpen:T,setIsOpen:O,afterShow:k,afterHide:S})=>{const[A,E]=n(r),[j,L]=n(o),[P,D]=n(c),[N,F]=n(s),[C,I]=n(u),[$,W]=n(h),[H,U]=n(g),[B,V]=n(v),[M,z]=n(f),[Y,q]=n(d),[X,K]=n(y),{anchorRefs:J,activeAnchor:Z}=Re(e),G=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;if(n.startsWith("data-tooltip-")){t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null}return t}),{}),Q=e=>{const t={place:e=>{var t;D(null!==(t=e)&&void 0!==t?t:c)},content:e=>{E(null!=e?e:r)},html:e=>{L(null!=e?e:o)},variant:e=>{var t;F(null!==(t=e)&&void 0!==t?t:s)},offset:e=>{I(null===e?u:Number(e))},wrapper:e=>{var t;z(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");q(null!=t?t:d)},"position-strategy":e=>{var t;K(null!==(t=e)&&void 0!==t?t:y)},"delay-show":e=>{W(null===e?h:Number(e))},"delay-hide":e=>{U(null===e?g:Number(e))},float:e=>{V(null===e?v:Boolean(e))}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};a((()=>{E(r)}),[r]),a((()=>{L(o)}),[o]),a((()=>{var e;const n=new Set(J),r=document.querySelector(`[id='${t}']`);if(r&&n.add({current:r}),!n.size)return()=>null;const o=null!==(e=Z.current)&&void 0!==e?e:r,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!o||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=G(o);Q(n)}))})),l={attributes:!0,childList:!1,subtree:!1};if(o){const e=G(o);Q(e),i.observe(o,l)}return()=>{i.disconnect()}}),[J,Z,t]);const ee={id:e,anchorId:t,className:i,classNameArrow:l,content:A,html:j,place:P,variant:N,offset:C,wrapper:M,events:Y,positionStrategy:X,middlewares:m,delayShow:$,delayHide:H,float:B,noArrow:w,clickable:b,closeOnEsc:x,style:R,position:_,isOpen:T,setIsOpen:O,afterShow:k,afterHide:S};return p?pe.exports.jsx(ke,{...ee,children:p}):pe.exports.jsx(ke,{...ee})};export{Se as Tooltip,xe as TooltipProvider,_e as TooltipWrapper,O as autoPlacement,k as flip,S as inline,A as offset,E as shift,j as size};
|
|
15
|
+
*/ye=he,function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var l=t.apply(null,o);l&&n.push(l)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var a in o)e.call(o,a)&&o[a]&&n.push(a)}}}return n.join(" ")}ye.exports?(t.default=t,ye.exports=t):window.classNames=t}();var ge=he.exports;const ve=(e,t,n)=>{let r=null;return function(...o){r&&clearTimeout(r),r=setTimeout((()=>{r=null,n||e.apply(this,o)}),t)}},we=({content:e})=>pe.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}}),be={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},xe=t({getTooltipData:()=>be}),Re=({children:e})=>{const[t,i]=n({DEFAULT_TOOLTIP_ID:new Set}),[l,a]=n({DEFAULT_TOOLTIP_ID:{current:null}}),c=(e,...t)=>{i((n=>{var r;const o=null!==(r=n[e])&&void 0!==r?r:new Set;return t.forEach((e=>o.add(e))),{...n,[e]:new Set(o)}}))},s=(e,...t)=>{i((n=>{const r=n[e];return r?(t.forEach((e=>r.delete(e))),{...n}):n}))},u=r(((e="DEFAULT_TOOLTIP_ID")=>{var n,r;return{anchorRefs:null!==(n=t[e])&&void 0!==n?n:new Set,activeAnchor:null!==(r=l[e])&&void 0!==r?r:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>s(e,...t),setActiveAnchor:t=>((e,t)=>{a((n=>{var r;return(null===(r=n[e])||void 0===r?void 0:r.current)===t.current?n:{...n,[e]:t}}))})(e,t)}}),[t,l,c,s]),f=o((()=>({getTooltipData:u})),[u]);return pe.exports.jsx(xe.Provider,{value:f,children:e})};function _e(e="DEFAULT_TOOLTIP_ID"){return i(xe).getTooltipData(e)}const Te=({tooltipId:e,children:t,className:n,place:r,content:o,html:i,variant:c,offset:s,wrapper:u,events:f,positionStrategy:d,delayShow:p,delayHide:m})=>{const{attach:y,detach:h}=_e(e),g=l(null);return a((()=>(y(g),()=>{h(g)})),[]),pe.exports.jsx("span",{ref:g,className:ge("react-tooltip-wrapper",n),"data-tooltip-place":r,"data-tooltip-content":o,"data-tooltip-html":i,"data-tooltip-variant":c,"data-tooltip-offset":s,"data-tooltip-wrapper":u,"data-tooltip-events":f,"data-tooltip-position-strategy":d,"data-tooltip-delay-show":p,"data-tooltip-delay-hide":m,children:t})},Se=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:l=[E(Number(o)),A(),j({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const a=l;return n?(a.push({name:"arrow",options:c={element:n,padding:5},async fn(e){const{element:t,padding:n=0}=c||{},{x:r,y:o,placement:i,rects:l,platform:a}=e;if(null==t)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const f=m(n),p={x:r,y:o},y=d(i),h=u(y),g=await a.getDimensions(t),v="y"===y?"top":"left",b="y"===y?"bottom":"right",x=l.reference[h]+l.reference[y]-p[y]-l.floating[h],R=p[y]-l.reference[y],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(t));let T=_?"y"===y?_.clientHeight||0:_.clientWidth||0:0;0===T&&(T=l.floating[h]);const S=x/2-R/2,O=f[v],A=T-g[h]-f[b],k=T/2-g[h]/2+S,E=w(O,k,A),j=null!=s(i)&&k!=E&&l.reference[h]/2-(k<O?f[v]:f[b])-g[h]/2<0;return{[y]:p[y]-(j?k<O?O-k:A-k:0),data:{[y]:E,centerOffset:k-E}}}}),fe(e,t,{placement:r,strategy:i,middleware:a}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var o,i;const l={left:`${e}px`,top:`${t}px`},{x:a,y:c}=null!==(o=r.arrow)&&void 0!==o?o:{x:0,y:0};return{tooltipStyles:l,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=c?`${c}px`:"",right:"",bottom:"",[null!==(i={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==i?i:"bottom"]:"-4px"}}}))):fe(e,t,{placement:"bottom",strategy:i,middleware:a}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})));var c};var Oe={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T","no-arrow":"styles-module_no-arrow__KcFZN",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",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"};const Ae=({id:e,className:t,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:u="top",offset:f=10,events:d=["hover"],positionStrategy:p="absolute",middlewares:m,wrapper:y,children:h=null,delayShow:g=0,delayHide:v=0,float:w=!1,noArrow:b=!1,clickable:x=!1,closeOnEsc:R=!1,style:_,position:T,afterShow:S,afterHide:O,content:A,html:k,isOpen:E,setIsOpen:j,activeAnchor:L,setActiveAnchor:P})=>{const D=l(null),N=l(null),F=l(null),$=l(null),[C,I]=n({}),[W,H]=n({}),[U,B]=n(!1),[V,M]=n(!1),q=l(!1),z=l(null),{anchorRefs:Y,setActiveAnchor:X}=_e(e),K=l(!1),[J,Z]=n([]),G=l(!1);a((()=>{let t=s;if(!t&&e&&(t=`[data-tooltip-id='${e}']`),t)try{const e=Array.from(document.querySelectorAll(t));Z(e)}catch(e){Z([])}}),[s]),c((()=>(G.current=!0,()=>{G.current=!1})),[]),a((()=>{if(!U){const e=setTimeout((()=>{M(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[U]);const Q=e=>{G.current&&(M(!0),setTimeout((()=>{G.current&&(null==j||j(e),void 0===E&&B(e))}),10))};a((()=>{if(void 0===E)return()=>null;E&&M(!0);const e=setTimeout((()=>{B(E)}),10);return()=>{clearTimeout(e)}}),[E]),a((()=>{U!==q.current&&(q.current=U,U?null==S||S():null==O||O())}),[U]);const ee=(e=v)=>{$.current&&clearTimeout($.current),$.current=setTimeout((()=>{K.current||Q(!1)}),e)},te=e=>{var t;if(!e)return;g?(F.current&&clearTimeout(F.current),F.current=setTimeout((()=>{Q(!0)}),g)):Q(!0);const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;P(n),X({current:n}),$.current&&clearTimeout($.current)},ne=()=>{x?ee(v||100):v?ee():Q(!1),F.current&&clearTimeout(F.current)},re=({x:e,y:t})=>{Se({place:u,offset:f,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:D.current,tooltipArrowReference:N.current,strategy:p,middlewares:m}).then((e=>{Object.keys(e.tooltipStyles).length&&I(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&H(e.tooltipArrowStyles)}))},oe=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};re(n),z.current=n},ie=e=>{te(e),v&&ee()},le=e=>{const t=document.querySelector(`[id='${i}']`);(null==t?void 0:t.contains(e.target))||J.some((t=>t.contains(e.target)))||Q(!1)},ae=e=>{"Escape"===e.key&&Q(!1)},ce=ve(te,50),se=ve(ne,50);a((()=>{var e,t;const n=new Set(Y);J.forEach((e=>{n.add({current:e})}));const r=document.querySelector(`[id='${i}']`);if(r&&n.add({current:r}),!n.size)return()=>null;R&&window.addEventListener("keydown",ae);const o=[];d.find((e=>"click"===e))&&(window.addEventListener("click",le),o.push({event:"click",listener:ie})),d.find((e=>"hover"===e))&&(o.push({event:"mouseenter",listener:ce},{event:"mouseleave",listener:se},{event:"focus",listener:ce},{event:"blur",listener:se}),w&&o.push({event:"mousemove",listener:oe}));const l=()=>{K.current=!0},a=()=>{K.current=!1,ne()};x&&(null===(e=D.current)||void 0===e||e.addEventListener("mouseenter",l),null===(t=D.current)||void 0===t||t.addEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))}));const c=new MutationObserver((e=>{L&&e.some((e=>"childList"===e.type&&[...e.removedNodes].some((e=>!!e.contains(L)&&(Q(!1),!0)))))}));return c.observe(document.body,{attributes:!1,childList:!0,subtree:!0}),()=>{var e,t;d.find((e=>"click"===e))&&window.removeEventListener("click",le),R&&window.removeEventListener("keydown",ae),x&&(null===(e=D.current)||void 0===e||e.removeEventListener("mouseenter",l),null===(t=D.current)||void 0===t||t.removeEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))})),c.disconnect()}}),[V,Y,L,R,d,v,g]),a((()=>{T?re(T):w?z.current&&re(z.current):Se({place:u,offset:f,elementReference:L,tooltipReference:D.current,tooltipArrowReference:N.current,strategy:p,middlewares:m}).then((e=>{G.current&&(Object.keys(e.tooltipStyles).length&&I(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&H(e.tooltipArrowStyles))}))}),[U,L,A,k,u,f,p,T]),a((()=>{var e;const t=document.querySelector(`[id='${i}']`),n=[...J,t];L&&n.includes(L)||P(null!==(e=J[0])&&void 0!==e?e:t)}),[i,J,L]),a((()=>()=>{F.current&&clearTimeout(F.current),$.current&&clearTimeout($.current)}),[]);const ue=Boolean(k||A||h)&&U&&Object.keys(C).length>0;return V?pe.exports.jsxs(y,{id:e,role:"tooltip",className:ge("react-tooltip",Oe.tooltip,Oe[o],t,{[Oe.show]:ue,[Oe.fixed]:"fixed"===p,[Oe.clickable]:x}),style:{..._,...C},ref:D,children:[k&&pe.exports.jsx(we,{content:k})||A||h,pe.exports.jsx(y,{className:ge("react-tooltip-arrow",Oe.arrow,r,{[Oe["no-arrow"]]:b}),style:W,ref:N})]}):null},ke=({id:e,anchorId:t,anchorSelect:r,content:o,html:i,className:l,classNameArrow:c,variant:s="dark",place:u="top",offset:f=10,wrapper:d="div",children:p=null,events:m=["hover"],positionStrategy:y="absolute",middlewares:h,delayShow:g=0,delayHide:v=0,float:w=!1,noArrow:b=!1,clickable:x=!1,closeOnEsc:R=!1,style:_,position:T,isOpen:S,setIsOpen:O,afterShow:A,afterHide:k})=>{const[E,j]=n(o),[L,P]=n(i),[D,N]=n(u),[F,$]=n(s),[C,I]=n(f),[W,H]=n(g),[U,B]=n(v),[V,M]=n(w),[q,z]=n(d),[Y,X]=n(m),[K,J]=n(y),[Z,G]=n(null),{anchorRefs:Q,activeAnchor:ee}=_e(e),te=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;if(n.startsWith("data-tooltip-")){t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null}return t}),{}),ne=e=>{const t={place:e=>{var t;N(null!==(t=e)&&void 0!==t?t:u)},content:e=>{j(null!=e?e:o)},html:e=>{P(null!=e?e:i)},variant:e=>{var t;$(null!==(t=e)&&void 0!==t?t:s)},offset:e=>{I(null===e?f:Number(e))},wrapper:e=>{var t;z(null!==(t=e)&&void 0!==t?t:d)},events:e=>{const t=null==e?void 0:e.split(" ");X(null!=t?t:m)},"position-strategy":e=>{var t;J(null!==(t=e)&&void 0!==t?t:y)},"delay-show":e=>{H(null===e?g:Number(e))},"delay-hide":e=>{B(null===e?v:Number(e))},float:e=>{M(null===e?w:Boolean(e))}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};a((()=>{j(o)}),[o]),a((()=>{P(i)}),[i]),a((()=>{N(u)}),[u]),a((()=>{var n;const o=new Set(Q);let i=r;if(!i&&e&&(i=`[data-tooltip-id='${e}']`),i)try{document.querySelectorAll(i).forEach((e=>{o.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${r}" is not a valid CSS selector`)}const l=document.querySelector(`[id='${t}']`);if(l&&o.add({current:l}),!o.size)return()=>null;const a=null!==(n=null!=Z?Z:l)&&void 0!==n?n:ee.current,c=new MutationObserver((e=>{e.forEach((e=>{var t;if(!a||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=te(a);ne(n)}))})),s={attributes:!0,childList:!1,subtree:!1};if(a){const e=te(a);ne(e),c.observe(a,s)}return()=>{c.disconnect()}}),[Q,ee,Z,t,r]);const re={id:e,anchorId:t,anchorSelect:r,className:l,classNameArrow:c,content:E,html:L,place:D,variant:F,offset:C,wrapper:q,events:Y,positionStrategy:K,middlewares:h,delayShow:W,delayHide:U,float:V,noArrow:b,clickable:x,closeOnEsc:R,style:_,position:T,isOpen:S,setIsOpen:O,afterShow:A,afterHide:k,activeAnchor:Z,setActiveAnchor:e=>G(e)};return p?pe.exports.jsx(Ae,{...re,children:p}):pe.exports.jsx(Ae,{...re})};export{ke as Tooltip,Re as TooltipProvider,Te as TooltipWrapper,O as autoPlacement,A as flip,k as inline,E as offset,j as shift,L as size};
|