react-tooltip 5.0.0 → 5.1.0-beta.1
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/CONTRIBUTION.md +38 -0
- package/README.md +9 -4
- package/dist/react-tooltip.cjs.js +15 -5
- package/dist/react-tooltip.cjs.min.js +1 -1
- package/dist/react-tooltip.css +11 -13
- package/dist/react-tooltip.d.ts +17 -3
- package/dist/react-tooltip.esm.js +15 -5
- package/dist/react-tooltip.esm.min.js +2 -2
- package/dist/react-tooltip.min.css +1 -1
- package/dist/react-tooltip.umd.js +15 -5
- package/dist/react-tooltip.umd.min.js +1 -1
- package/package.json +2 -2
- package/rollup.config.types.js +6 -2
package/CONTRIBUTION.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contribution
|
|
2
|
+
|
|
3
|
+
## Running project locally
|
|
4
|
+
|
|
5
|
+
### ReactTooltip (root)
|
|
6
|
+
|
|
7
|
+
1. Run `npm install` || `yarn` to install dependencies
|
|
8
|
+
2. You can test by: `yarn dev` to run dev mode, or you can run **docs** directly using root folder instead of NPM, for this, please check **docs section**.
|
|
9
|
+
|
|
10
|
+
### Docs
|
|
11
|
+
|
|
12
|
+
You still need step 1 from `ReactTooltip (root)` section.
|
|
13
|
+
Docs are commited using npm packages, but with this steps, you can use local ReactTooltip package build.
|
|
14
|
+
|
|
15
|
+
1. In **docs** folder, run `npm install` || `yarn` to install dependencies
|
|
16
|
+
2. In **root** folder (parent of docs folder), run `yarn build` to generate a production build (you can use `yarn build --watch` to always generate a new build when a file changes)
|
|
17
|
+
3. Change `package.json`:
|
|
18
|
+
|
|
19
|
+
From this:
|
|
20
|
+
```
|
|
21
|
+
"react": "18.2.0",
|
|
22
|
+
"react-dom": "18.2.0",
|
|
23
|
+
"react-tooltip": "5.0.0"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To this:
|
|
27
|
+
```
|
|
28
|
+
"react": "link:../node_modules/react",
|
|
29
|
+
"react-dom": "link:../node_modules/react-dom",
|
|
30
|
+
"react-tooltip": "link:.."
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
4. Run `yarn start` and open `localhost:3000` to see docs running locally.
|
|
35
|
+
|
|
36
|
+
OBS: do not commit this change or the docs will broken the deployment and will not be updated.
|
|
37
|
+
|
|
38
|
+
|
package/README.md
CHANGED
|
@@ -102,18 +102,23 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
102
102
|
|
|
103
103
|
## Maintainers
|
|
104
104
|
|
|
105
|
-
[danielbarion](https://github.com/danielbarion)
|
|
105
|
+
[danielbarion](https://github.com/danielbarion) Maintainer - Creator of React Tooltip >= V5.
|
|
106
106
|
|
|
107
|
-
[
|
|
108
|
-
|
|
109
|
-
[pdeszynski](https://github.com/pdeszynski) Casual maintainer - accepting PRs and doing minor testing/development.
|
|
107
|
+
[gabrieljablonski](https://github.com/gabrieljablonski) Maintainer.
|
|
110
108
|
|
|
111
109
|
[aronhelser](https://github.com/aronhelser) Passive maintainer - accepting PRs and doing minor testing, but not fixing issues or doing active development.
|
|
112
110
|
|
|
111
|
+
[alexgurr](https://github.com/alexgurr) (inactive).
|
|
112
|
+
|
|
113
|
+
[pdeszynski](https://github.com/pdeszynski) (inactive).
|
|
114
|
+
|
|
113
115
|
[roggervalf](https://github.com/roggervalf) (inactive).
|
|
114
116
|
|
|
115
117
|
[huumanoid](https://github.com/huumanoid) (inactive)
|
|
116
118
|
|
|
119
|
+
[wwayne](https://github.com/wwayne) (inactive) - Creator of the original React Tooltip (V1.x ~ V4.x.)
|
|
120
|
+
|
|
121
|
+
|
|
117
122
|
We would gladly accept a new maintainer to help out!
|
|
118
123
|
|
|
119
124
|
## Contributing
|
|
@@ -2608,7 +2608,7 @@ const computePosition = (reference, floating, options) => computePosition$1(refe
|
|
|
2608
2608
|
...options
|
|
2609
2609
|
});
|
|
2610
2610
|
|
|
2611
|
-
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, }) => {
|
|
2611
|
+
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
|
|
2612
2612
|
if (!elementReference) {
|
|
2613
2613
|
// elementReference can be null or undefined and we will not compute the position
|
|
2614
2614
|
// eslint-disable-next-line no-console
|
|
@@ -2623,6 +2623,7 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2623
2623
|
middleware.push(arrow({ element: tooltipArrowReference }));
|
|
2624
2624
|
return computePosition(elementReference, tooltipReference, {
|
|
2625
2625
|
placement: place,
|
|
2626
|
+
strategy,
|
|
2626
2627
|
middleware,
|
|
2627
2628
|
}).then(({ x, y, placement, middlewareData }) => {
|
|
2628
2629
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2647,6 +2648,7 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2647
2648
|
}
|
|
2648
2649
|
return computePosition(elementReference, tooltipReference, {
|
|
2649
2650
|
placement: 'bottom',
|
|
2651
|
+
strategy,
|
|
2650
2652
|
middleware,
|
|
2651
2653
|
}).then(({ x, y }) => {
|
|
2652
2654
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2654,11 +2656,11 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2654
2656
|
});
|
|
2655
2657
|
};
|
|
2656
2658
|
|
|
2657
|
-
var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2659
|
+
var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fixed__7ciUi","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2658
2660
|
|
|
2659
2661
|
const Tooltip = ({
|
|
2660
2662
|
// props
|
|
2661
|
-
id = require$$0.useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0,
|
|
2663
|
+
id = require$$0.useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, style: externalStyles,
|
|
2662
2664
|
// props handled by controller
|
|
2663
2665
|
isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
2664
2666
|
const tooltipRef = require$$0.createRef();
|
|
@@ -2763,6 +2765,7 @@ isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
|
2763
2765
|
elementReference,
|
|
2764
2766
|
tooltipReference: tooltipRef.current,
|
|
2765
2767
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2768
|
+
strategy: positionStrategy,
|
|
2766
2769
|
}).then((computedStylesData) => {
|
|
2767
2770
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
2768
2771
|
setInlineStyles(computedStylesData.tooltipStyles);
|
|
@@ -2778,7 +2781,8 @@ isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
|
2778
2781
|
}, [show, isOpen, anchorId]);
|
|
2779
2782
|
return (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames(styles['tooltip'], styles[variant], className, {
|
|
2780
2783
|
[styles['show']]: isOpen || show,
|
|
2781
|
-
|
|
2784
|
+
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2785
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [children || (isHtmlContent ? jsxRuntime.exports.jsx(TooltipContent, { content: content }) : content), jsxRuntime.exports.jsx("div", { className: classNames(styles['arrow'], classNameArrow), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
2782
2786
|
};
|
|
2783
2787
|
|
|
2784
2788
|
const dataAttributesKeys = [
|
|
@@ -2793,7 +2797,7 @@ const dataAttributesKeys = [
|
|
|
2793
2797
|
'delay-hide', // delay to hide tooltip
|
|
2794
2798
|
];
|
|
2795
2799
|
|
|
2796
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], delayShow = 0, delayHide = 0, getContent, isOpen, setIsOpen, }) => {
|
|
2800
|
+
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, style, getContent, isOpen, setIsOpen, }) => {
|
|
2797
2801
|
const [tooltipContent, setTooltipContent] = require$$0.useState(content || html);
|
|
2798
2802
|
const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
|
|
2799
2803
|
const [tooltipVariant, setTooltipVariant] = require$$0.useState(variant);
|
|
@@ -2802,6 +2806,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2802
2806
|
const [tooltipDelayHide, setTooltipDelayHide] = require$$0.useState(delayHide);
|
|
2803
2807
|
const [tooltipWrapper, setTooltipWrapper] = require$$0.useState(wrapper);
|
|
2804
2808
|
const [tooltipEvents, setTooltipEvents] = require$$0.useState(events);
|
|
2809
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = require$$0.useState(positionStrategy);
|
|
2805
2810
|
const [isHtmlContent, setIsHtmlContent] = require$$0.useState(Boolean(html));
|
|
2806
2811
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
2807
2812
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
@@ -2850,6 +2855,9 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2850
2855
|
const parsedEvents = value.split(' ');
|
|
2851
2856
|
setTooltipEvents(parsedEvents);
|
|
2852
2857
|
},
|
|
2858
|
+
positionStrategy: (value) => {
|
|
2859
|
+
setTooltipPositionStrategy(value);
|
|
2860
|
+
},
|
|
2853
2861
|
'delay-show': (value) => {
|
|
2854
2862
|
setTooltipDelayShow(Number(value));
|
|
2855
2863
|
},
|
|
@@ -2918,8 +2926,10 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2918
2926
|
offset: tooltipOffset,
|
|
2919
2927
|
wrapper: tooltipWrapper,
|
|
2920
2928
|
events: tooltipEvents,
|
|
2929
|
+
positionStrategy: tooltipPositionStrategy,
|
|
2921
2930
|
delayShow: tooltipDelayShow,
|
|
2922
2931
|
delayHide: tooltipDelayHide,
|
|
2932
|
+
style,
|
|
2923
2933
|
isOpen,
|
|
2924
2934
|
setIsOpen,
|
|
2925
2935
|
};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/i=a,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 a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var l in o)e.call(o,l)&&o[l]&&n.push(l)}}}return n.join(" ")}i.exports?(t.default=t,i.exports=t):window.classNames=t}();var l=a.exports;const s=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},c=({content:e})=>r.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function u(e){return e.split("-")[0]}function f(e){return e.split("-")[1]}function p(e){return["top","bottom"].includes(u(e))?"x":"y"}function d(e){return"y"===e?"height":"width"}function y(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=p(t),s=d(l),c=r[s]/2-o[s]/2,y="x"===l;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:a};break;case"left":m={x:r.x-o.width,y:a};break;default:m={x:r.x,y:r.y}}switch(f(t)){case"start":m[l]-=c*(n&&y?-1:1);break;case"end":m[l]+=c*(n&&y?-1:1)}return m}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 h(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function g(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=m(d),g=l[p?"floating"===f?"reference":"floating":f],v=h(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(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b=h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:v.top-b.top+y.top,bottom:b.bottom-v.bottom+y.bottom,left:v.left-b.left+y.left,right:b.right-v.right+y.right}}const v=Math.min,b=Math.max;function w(e,t,n){return b(e,v(t,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function S(e){return e.replace(/left|right|bottom|top/g,(e=>x[e]))}const _={start:"end",end:"start"};function R(e){return e.replace(/start|end/g,(e=>_[e]))}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:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:y=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",flipAlignment:v=!0,...b}=e,w=u(r),x=m||(w===a||!v?[S(a)]:function(e){const t=S(e);return[R(e),t,R(t)]}(a)),_=[a,...x],k=await g(t,b),T=[];let O=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&T.push(k[w]),y){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=f(e),o=p(e),i=d(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=S(a)),{main:a,cross:S(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));T.push(k[e],k[t])}if(O=[...O,{placement:r,overflows:T}],!T.every((e=>e<=0))){var j,E;const e=(null!=(j=null==(E=o.flip)?void 0:E.index)?j:0)+1,t=_[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var P;const e=null==(P=O.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const T=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)),a=u(n),l=f(n),s="x"===p(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-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 l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*d,y:m*c}:{x:m*c,y:h*d}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function O(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function j(e){if(null==e)return window;if(!O(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function E(e){return j(e).getComputedStyle(e)}function P(e){return O(e)?"":e?(e.nodeName||"").toLowerCase():""}function A(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function N(e){return e instanceof j(e).HTMLElement}function L(e){return e instanceof j(e).Element}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof j(e).ShadowRoot||e instanceof ShadowRoot}function $(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function D(e){return["table","td","th"].includes(P(e))}function F(e){const t=/firefox/i.test(A()),n=E(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 I(){return!/^((?!chrome|android).)*safari/i.test(A())}function W(e){return["html","body","#document"].includes(P(e))}const H=Math.min,M=Math.max,U=Math.round;function B(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&N(e)&&(s=e.offsetWidth>0&&U(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&U(l.height)/e.offsetHeight||1);const u=L(e)?j(e):window,f=!I()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function V(e){return(t=e,(t instanceof j(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function q(e){return L(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function z(e){return B(V(e)).left+q(e).scrollLeft}function Y(e,t,n){const r=N(t),o=V(t),i=B(e,r&&function(e){const t=B(e);return U(t.width)!==e.offsetWidth||U(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==P(t)||$(o))&&(a=q(t)),N(t)){const e=B(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=z(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function X(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||(C(e)?e.host:null)||V(e);return C(t)?t.host:t}function J(e){return N(e)&&"fixed"!==E(e).position?e.offsetParent:null}function K(e){const t=j(e);let n=J(e);for(;n&&D(n)&&"static"===E(n).position;)n=J(n);return n&&("html"===P(n)||"body"===P(n)&&"static"===E(n).position&&!F(n))?t:n||function(e){let t=X(e);for(;N(t)&&!W(t);){if(F(t))return t;t=X(t)}return null}(e)||t}function Z(e){if(N(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=B(e);return{width:t.width,height:t.height}}function G(e){const t=X(e);return W(t)?e.ownerDocument.body:N(t)&&$(t)?t:G(t)}function Q(e,t){var n;void 0===t&&(t=[]);const r=G(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=j(r),a=o?[i].concat(i.visualViewport||[],$(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(Q(a))}function ee(e,t,n){return"viewport"===t?h(function(e,t){const n=j(e),r=V(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=I();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):L(t)?function(e,t){const n=B(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):h(function(e){var t;const n=V(e),r=q(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=M(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=M(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+z(e);const s=-r.scrollTop;return"rtl"===E(o||n).direction&&(l+=M(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(V(e)))}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=Q(e).filter((e=>L(e)&&"body"!==P(e))),n=e,r=null;for(;L(n)&&!W(n);){const e=E(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!F(n)?t=t.filter((e=>e!==n)):r=e,n=X(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=ee(t,n,o);return e.top=M(r.top,e.top),e.right=H(r.right,e.right),e.bottom=H(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),ee(t,l,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=N(n),i=V(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==P(n)||$(i))&&(a=q(n)),N(n))){const e=B(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:L,getDimensions:Z,getOffsetParent:K,getDocumentElement:V,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Y(t,K(n),r),floating:{...Z(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===E(e).direction},ne=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=y(c,r,s),p=r,d={},m=0;for(let n=0;n<l.length;n++){const{name:i,fn:h}=l[n],{x:g,y:v,data:b,reset:w}=await h({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=y(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:te,...n}),re=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const i=[T(Number(o)),k(),(a={padding:5},void 0===a&&(a={}),{name:"shift",options:a,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=a,c={x:t,y:n},f=await g(e,s),d=p(u(r)),y="x"===d?"y":"x";let m=c[d],h=c[y];if(o){const e="y"===d?"bottom":"right";m=w(m+f["y"===d?"top":"left"],m,m-f[e])}if(i){const e="y"===y?"bottom":"right";h=w(h+f["y"===y?"top":"left"],h,h-f[e])}const v=l.fn({...e,[d]:m,[y]:h});return{...v,data:{x:v.x-t,y:v.y-n}}}})];var a;return n?(i.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=m(r),u={x:o,y:i},y=p(a),h=f(a),g=d(y),v=await s.getDimensions(n),b="y"===y?"top":"left",x="y"===y?"bottom":"right",S=l.reference[g]+l.reference[y]-u[y]-l.floating[g],_=u[y]-l.reference[y],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===y?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[g]);const T=S/2-_/2,O=c[b],j=k-v[g]-c[x],E=k/2-v[g]/2+T,P=w(O,E,j),A=("start"===h?c[b]:c[x])>0&&E!==P&&l.reference[g]<=l.floating[g];return{[y]:u[y]-(A?E<O?O-E:j-E:0),data:{[y]:P,centerOffset:E-P}}}}))({element:n})),ne(e,t,{placement:r,middleware:i}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ne(e,t,{placement:"bottom",middleware:i}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var oe={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",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 ie=({id:t=e.useId(),className:n,classNameArrow:o,variant:i="dark",anchorId:a,place:u="top",offset:f=10,events:p=["hover"],wrapper:d="div",children:y=null,delayShow:m=0,delayHide:h=0,isHtmlContent:g=!1,content:v,isOpen:b,setIsOpen:w})=>{const x=e.createRef(),S=e.createRef(),_=e.useRef(),R=e.useRef(),[k,T]=e.useState({}),[O,j]=e.useState({}),[E,P]=e.useState(!1),A=e=>{w?w(e):void 0===b&&P(e)},N=()=>{w?w(!b):void 0===b&&P((e=>!e))},L=s((()=>{m?(_.current&&clearTimeout(_.current),_.current=setTimeout((()=>{A(!0)}),m)):A(!0),R.current&&clearTimeout(R.current)}),50),C=s((()=>{h?(R.current&&clearTimeout(R.current),R.current=setTimeout((()=>{A(!1)}),h)):A(!1),E&&_.current?clearTimeout(_.current):!E&&_.current&&(R.current=setTimeout((()=>{A(!1)}),2*m))}),50);return e.useEffect((()=>{const e=document.querySelector(`#${a}`);if(!e)return()=>{};const t=[];return p.find((e=>"click"===e))&&t.push({event:"click",listener:N}),p.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:L},{event:"mouseleave",listener:C},{event:"focus",listener:L},{event:"blur",listener:C}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[a,p,h,m]),e.useEffect((()=>{const e=document.querySelector(`#${a}`);return re({place:u,offset:f,elementReference:e,tooltipReference:x.current,tooltipArrowReference:S.current}).then((e=>{Object.keys(e.tooltipStyles).length&&T(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&j(e.tooltipArrowStyles)})),()=>{_.current=void 0,R.current=void 0}}),[E,b,a]),r.exports.jsxs(d,{id:t,role:"tooltip",className:l(oe.tooltip,oe[i],n,{[oe.show]:b||E}),style:k,ref:x,children:[y||(g?r.exports.jsx(c,{content:v}):v),r.exports.jsx("div",{className:l(oe.arrow,o),style:O,ref:S})]})},ae=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"];exports.Tooltip=({id:t,anchorId:n,content:o,html:i,className:a,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],delayShow:y=0,delayHide:m=0,getContent:h,isOpen:g,setIsOpen:v})=>{const[b,w]=e.useState(o||i),[x,S]=e.useState(c),[_,R]=e.useState(s),[k,T]=e.useState(u),[O,j]=e.useState(y),[E,P]=e.useState(m),[A,N]=e.useState(f),[L,C]=e.useState(d),[$,D]=e.useState(Boolean(i)),F=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{S(e)},content:e=>{D(!0),w(h?h(e):e)},html:e=>{D(!0),w(h?h(e):e)},variant:e=>{R(e)},offset:e=>{T(e)},wrapper:e=>{N(e)},events:e=>{const t=e.split(" ");C(t)},"delay-show":e=>{j(Number(e))},"delay-hide":e=>{P(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ae.includes(n)&&r[n](e[t])}))};e.useEffect((()=>{if(!n)return()=>{};const e=document.querySelector(`#${n}`);if(!e)return()=>{};o&&h&&w(h(o));const t=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});F(n)}}))}));t.observe(e,{attributes:!0,childList:!1,subtree:!1});const r=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return F(r),()=>{t.disconnect()}}),[n]);const I={id:t,anchorId:n,className:a,classNameArrow:l,content:b,isHtmlContent:$,place:x,variant:_,offset:k,wrapper:A,events:L,delayShow:O,delayHide:E,isOpen:g,setIsOpen:v};return p?r.exports.jsx(ie,{...I,children:p}):r.exports.jsx(ie,{...I})};
|
|
6
|
+
*/i=a,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 a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var l in o)e.call(o,l)&&o[l]&&n.push(l)}}}return n.join(" ")}i.exports?(t.default=t,i.exports=t):window.classNames=t}();var l=a.exports;const s=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},c=({content:e})=>r.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function u(e){return e.split("-")[0]}function f(e){return e.split("-")[1]}function p(e){return["top","bottom"].includes(u(e))?"x":"y"}function d(e){return"y"===e?"height":"width"}function y(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=p(t),s=d(l),c=r[s]/2-o[s]/2,y="x"===l;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:a};break;case"left":m={x:r.x-o.width,y:a};break;default:m={x:r.x,y:r.y}}switch(f(t)){case"start":m[l]-=c*(n&&y?-1:1);break;case"end":m[l]+=c*(n&&y?-1:1)}return m}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 h(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function g(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=m(d),g=l[p?"floating"===f?"reference":"floating":f],v=h(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(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b=h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:v.top-b.top+y.top,bottom:b.bottom-v.bottom+y.bottom,left:v.left-b.left+y.left,right:b.right-v.right+y.right}}const v=Math.min,b=Math.max;function w(e,t,n){return b(e,v(t,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function S(e){return e.replace(/left|right|bottom|top/g,(e=>x[e]))}const _={start:"end",end:"start"};function R(e){return e.replace(/start|end/g,(e=>_[e]))}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:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:y=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",flipAlignment:v=!0,...b}=e,w=u(r),x=m||(w===a||!v?[S(a)]:function(e){const t=S(e);return[R(e),t,R(t)]}(a)),_=[a,...x],k=await g(t,b),T=[];let O=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&T.push(k[w]),y){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=f(e),o=p(e),i=d(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=S(a)),{main:a,cross:S(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));T.push(k[e],k[t])}if(O=[...O,{placement:r,overflows:T}],!T.every((e=>e<=0))){var j,E;const e=(null!=(j=null==(E=o.flip)?void 0:E.index)?j:0)+1,t=_[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var P;const e=null==(P=O.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const T=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)),a=u(n),l=f(n),s="x"===p(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-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 l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*d,y:m*c}:{x:m*c,y:h*d}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function O(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function j(e){if(null==e)return window;if(!O(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function E(e){return j(e).getComputedStyle(e)}function P(e){return O(e)?"":e?(e.nodeName||"").toLowerCase():""}function A(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function N(e){return e instanceof j(e).HTMLElement}function L(e){return e instanceof j(e).Element}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof j(e).ShadowRoot||e instanceof ShadowRoot}function $(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function D(e){return["table","td","th"].includes(P(e))}function F(e){const t=/firefox/i.test(A()),n=E(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 I(){return!/^((?!chrome|android).)*safari/i.test(A())}function W(e){return["html","body","#document"].includes(P(e))}const H=Math.min,M=Math.max,U=Math.round;function B(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&N(e)&&(s=e.offsetWidth>0&&U(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&U(l.height)/e.offsetHeight||1);const u=L(e)?j(e):window,f=!I()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function V(e){return(t=e,(t instanceof j(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function q(e){return L(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function z(e){return B(V(e)).left+q(e).scrollLeft}function Y(e,t,n){const r=N(t),o=V(t),i=B(e,r&&function(e){const t=B(e);return U(t.width)!==e.offsetWidth||U(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==P(t)||$(o))&&(a=q(t)),N(t)){const e=B(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=z(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function X(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||(C(e)?e.host:null)||V(e);return C(t)?t.host:t}function J(e){return N(e)&&"fixed"!==E(e).position?e.offsetParent:null}function K(e){const t=j(e);let n=J(e);for(;n&&D(n)&&"static"===E(n).position;)n=J(n);return n&&("html"===P(n)||"body"===P(n)&&"static"===E(n).position&&!F(n))?t:n||function(e){let t=X(e);for(;N(t)&&!W(t);){if(F(t))return t;t=X(t)}return null}(e)||t}function Z(e){if(N(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=B(e);return{width:t.width,height:t.height}}function G(e){const t=X(e);return W(t)?e.ownerDocument.body:N(t)&&$(t)?t:G(t)}function Q(e,t){var n;void 0===t&&(t=[]);const r=G(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=j(r),a=o?[i].concat(i.visualViewport||[],$(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(Q(a))}function ee(e,t,n){return"viewport"===t?h(function(e,t){const n=j(e),r=V(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=I();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):L(t)?function(e,t){const n=B(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):h(function(e){var t;const n=V(e),r=q(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=M(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=M(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+z(e);const s=-r.scrollTop;return"rtl"===E(o||n).direction&&(l+=M(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(V(e)))}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=Q(e).filter((e=>L(e)&&"body"!==P(e))),n=e,r=null;for(;L(n)&&!W(n);){const e=E(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!F(n)?t=t.filter((e=>e!==n)):r=e,n=X(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=ee(t,n,o);return e.top=M(r.top,e.top),e.right=H(r.right,e.right),e.bottom=H(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),ee(t,l,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=N(n),i=V(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==P(n)||$(i))&&(a=q(n)),N(n))){const e=B(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:L,getDimensions:Z,getOffsetParent:K,getDocumentElement:V,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Y(t,K(n),r),floating:{...Z(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===E(e).direction},ne=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=y(c,r,s),p=r,d={},m=0;for(let n=0;n<l.length;n++){const{name:i,fn:h}=l[n],{x:g,y:v,data:b,reset:w}=await h({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=y(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:te,...n}),re=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute"})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const a=[T(Number(o)),k(),(l={padding:5},void 0===l&&(l={}),{name:"shift",options:l,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=l,c={x:t,y:n},f=await g(e,s),d=p(u(r)),y="x"===d?"y":"x";let m=c[d],h=c[y];if(o){const e="y"===d?"bottom":"right";m=w(m+f["y"===d?"top":"left"],m,m-f[e])}if(i){const e="y"===y?"bottom":"right";h=w(h+f["y"===y?"top":"left"],h,h-f[e])}const v=a.fn({...e,[d]:m,[y]:h});return{...v,data:{x:v.x-t,y:v.y-n}}}})];var l;return n?(a.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=m(r),u={x:o,y:i},y=p(a),h=f(a),g=d(y),v=await s.getDimensions(n),b="y"===y?"top":"left",x="y"===y?"bottom":"right",S=l.reference[g]+l.reference[y]-u[y]-l.floating[g],_=u[y]-l.reference[y],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===y?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[g]);const T=S/2-_/2,O=c[b],j=k-v[g]-c[x],E=k/2-v[g]/2+T,P=w(O,E,j),A=("start"===h?c[b]:c[x])>0&&E!==P&&l.reference[g]<=l.floating[g];return{[y]:u[y]-(A?E<O?O-E:j-E:0),data:{[y]:P,centerOffset:E-P}}}}))({element:n})),ne(e,t,{placement:r,strategy:i,middleware:a}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ne(e,t,{placement:"bottom",strategy:i,middleware:a}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var oe={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T",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 ie=({id:t=e.useId(),className:n,classNameArrow:o,variant:i="dark",anchorId:a,place:u="top",offset:f=10,events:p=["hover"],positionStrategy:d="absolute",wrapper:y="div",children:m=null,delayShow:h=0,delayHide:g=0,style:v,isHtmlContent:b=!1,content:w,isOpen:x,setIsOpen:S})=>{const _=e.createRef(),R=e.createRef(),k=e.useRef(),T=e.useRef(),[O,j]=e.useState({}),[E,P]=e.useState({}),[A,N]=e.useState(!1),L=e=>{S?S(e):void 0===x&&N(e)},C=()=>{S?S(!x):void 0===x&&N((e=>!e))},$=s((()=>{h?(k.current&&clearTimeout(k.current),k.current=setTimeout((()=>{L(!0)}),h)):L(!0),T.current&&clearTimeout(T.current)}),50),D=s((()=>{g?(T.current&&clearTimeout(T.current),T.current=setTimeout((()=>{L(!1)}),g)):L(!1),A&&k.current?clearTimeout(k.current):!A&&k.current&&(T.current=setTimeout((()=>{L(!1)}),2*h))}),50);return e.useEffect((()=>{const e=document.querySelector(`#${a}`);if(!e)return()=>{};const t=[];return p.find((e=>"click"===e))&&t.push({event:"click",listener:C}),p.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:$},{event:"mouseleave",listener:D},{event:"focus",listener:$},{event:"blur",listener:D}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[a,p,g,h]),e.useEffect((()=>{const e=document.querySelector(`#${a}`);return re({place:u,offset:f,elementReference:e,tooltipReference:_.current,tooltipArrowReference:R.current,strategy:d}).then((e=>{Object.keys(e.tooltipStyles).length&&j(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&P(e.tooltipArrowStyles)})),()=>{k.current=void 0,T.current=void 0}}),[A,x,a]),r.exports.jsxs(y,{id:t,role:"tooltip",className:l(oe.tooltip,oe[i],n,{[oe.show]:x||A,[oe.fixed]:"fixed"===d}),style:{...v,...O},ref:_,children:[m||(b?r.exports.jsx(c,{content:w}):w),r.exports.jsx("div",{className:l(oe.arrow,o),style:E,ref:R})]})},ae=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"];exports.Tooltip=({id:t,anchorId:n,content:o,html:i,className:a,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],positionStrategy:y="absolute",delayShow:m=0,delayHide:h=0,style:g,getContent:v,isOpen:b,setIsOpen:w})=>{const[x,S]=e.useState(o||i),[_,R]=e.useState(c),[k,T]=e.useState(s),[O,j]=e.useState(u),[E,P]=e.useState(m),[A,N]=e.useState(h),[L,C]=e.useState(f),[$,D]=e.useState(d),[F,I]=e.useState(y),[W,H]=e.useState(Boolean(i)),M=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{R(e)},content:e=>{H(!0),S(v?v(e):e)},html:e=>{H(!0),S(v?v(e):e)},variant:e=>{T(e)},offset:e=>{j(e)},wrapper:e=>{C(e)},events:e=>{const t=e.split(" ");D(t)},positionStrategy:e=>{I(e)},"delay-show":e=>{P(Number(e))},"delay-hide":e=>{N(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ae.includes(n)&&r[n](e[t])}))};e.useEffect((()=>{if(!n)return()=>{};const e=document.querySelector(`#${n}`);if(!e)return()=>{};o&&v&&S(v(o));const t=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});M(n)}}))}));t.observe(e,{attributes:!0,childList:!1,subtree:!1});const r=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return M(r),()=>{t.disconnect()}}),[n]);const U={id:t,anchorId:n,className:a,classNameArrow:l,content:x,isHtmlContent:W,place:_,variant:k,offset:O,wrapper:L,events:$,positionStrategy:F,delayShow:E,delayHide:A,style:g,isOpen:b,setIsOpen:w};return p?r.exports.jsx(ie,{...U,children:p}):r.exports.jsx(ie,{...U})};
|
package/dist/react-tooltip.css
CHANGED
|
@@ -22,9 +22,13 @@
|
|
|
22
22
|
will-change: opacity, visibility;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
.styles-module_fixed__7ciUi {
|
|
26
|
+
position: fixed;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
.styles-module_arrow__K0L3T {
|
|
26
30
|
position: absolute;
|
|
27
|
-
background:
|
|
31
|
+
background: inherit;
|
|
28
32
|
width: 8px;
|
|
29
33
|
height: 8px;
|
|
30
34
|
transform: rotate(45deg);
|
|
@@ -36,38 +40,32 @@
|
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
/** Types variant **/
|
|
39
|
-
.styles-module_dark__xNqje
|
|
40
|
-
.styles-module_dark__xNqje .styles-module_arrow__K0L3T {
|
|
43
|
+
.styles-module_dark__xNqje {
|
|
41
44
|
background: var(--rt-color-dark);
|
|
42
45
|
color: var(--rt-color-white);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
.styles-module_light__Z6W-X
|
|
46
|
-
.styles-module_light__Z6W-X .styles-module_arrow__K0L3T {
|
|
48
|
+
.styles-module_light__Z6W-X {
|
|
47
49
|
background-color: var(--rt-color-white);
|
|
48
50
|
color: var(--rt-color-dark);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
.styles-module_success__A2AKt
|
|
52
|
-
.styles-module_success__A2AKt .styles-module_arrow__K0L3T {
|
|
53
|
+
.styles-module_success__A2AKt {
|
|
53
54
|
background-color: var(--rt-color-success);
|
|
54
55
|
color: var(--rt-color-white);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
.styles-module_warning__SCK0X
|
|
58
|
-
.styles-module_warning__SCK0X .styles-module_arrow__K0L3T {
|
|
58
|
+
.styles-module_warning__SCK0X {
|
|
59
59
|
background-color: var(--rt-color-warning);
|
|
60
60
|
color: var(--rt-color-white);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.styles-module_error__JvumD
|
|
64
|
-
.styles-module_error__JvumD .styles-module_arrow__K0L3T {
|
|
63
|
+
.styles-module_error__JvumD {
|
|
65
64
|
background-color: var(--rt-color-error);
|
|
66
65
|
color: var(--rt-color-white);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
.styles-module_info__BWdHW
|
|
70
|
-
.styles-module_info__BWdHW .styles-module_arrow__K0L3T {
|
|
68
|
+
.styles-module_info__BWdHW {
|
|
71
69
|
background-color: var(--rt-color-info);
|
|
72
70
|
color: var(--rt-color-white);
|
|
73
71
|
}
|
package/dist/react-tooltip.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType, Element, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
type PlacesType = 'top' | 'right' | 'bottom' | 'left'
|
|
4
|
+
|
|
5
|
+
type VariantType = 'dark' | 'light' | 'success' | 'warning' | 'error' | 'info'
|
|
6
|
+
|
|
7
|
+
type WrapperType = ElementType | 'div' | 'span'
|
|
8
|
+
|
|
9
|
+
type ChildrenType = Element | ElementType | ReactNode
|
|
10
|
+
|
|
11
|
+
type EventsType = 'hover' | 'click'
|
|
12
|
+
|
|
13
|
+
type PositionStrategy = 'absolute' | 'fixed'
|
|
2
14
|
|
|
3
15
|
interface ITooltipController {
|
|
4
16
|
className?: string
|
|
@@ -13,13 +25,15 @@ interface ITooltipController {
|
|
|
13
25
|
wrapper?: WrapperType
|
|
14
26
|
children?: ChildrenType
|
|
15
27
|
events?: EventsType[]
|
|
28
|
+
positionStrategy?: PositionStrategy
|
|
16
29
|
delayShow?: number
|
|
17
30
|
delayHide?: number
|
|
18
|
-
getContent?:
|
|
31
|
+
getContent?: (value) => string
|
|
32
|
+
style?: CSSProperties
|
|
19
33
|
isOpen?: boolean
|
|
20
34
|
setIsOpen?: (value: boolean) => void
|
|
21
35
|
}
|
|
22
36
|
|
|
23
|
-
declare const TooltipController: ({ id, anchorId, content, html, className, classNameArrow, variant, place, offset, wrapper, children, events, delayShow, delayHide, getContent, isOpen, setIsOpen, }: ITooltipController) => JSX.Element;
|
|
37
|
+
declare const TooltipController: ({ id, anchorId, content, html, className, classNameArrow, variant, place, offset, wrapper, children, events, positionStrategy, delayShow, delayHide, style, getContent, isOpen, setIsOpen, }: ITooltipController) => JSX.Element;
|
|
24
38
|
|
|
25
39
|
export { TooltipController as Tooltip };
|
|
@@ -2600,7 +2600,7 @@ const computePosition = (reference, floating, options) => computePosition$1(refe
|
|
|
2600
2600
|
...options
|
|
2601
2601
|
});
|
|
2602
2602
|
|
|
2603
|
-
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, }) => {
|
|
2603
|
+
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
|
|
2604
2604
|
if (!elementReference) {
|
|
2605
2605
|
// elementReference can be null or undefined and we will not compute the position
|
|
2606
2606
|
// eslint-disable-next-line no-console
|
|
@@ -2615,6 +2615,7 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2615
2615
|
middleware.push(arrow({ element: tooltipArrowReference }));
|
|
2616
2616
|
return computePosition(elementReference, tooltipReference, {
|
|
2617
2617
|
placement: place,
|
|
2618
|
+
strategy,
|
|
2618
2619
|
middleware,
|
|
2619
2620
|
}).then(({ x, y, placement, middlewareData }) => {
|
|
2620
2621
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2639,6 +2640,7 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2639
2640
|
}
|
|
2640
2641
|
return computePosition(elementReference, tooltipReference, {
|
|
2641
2642
|
placement: 'bottom',
|
|
2643
|
+
strategy,
|
|
2642
2644
|
middleware,
|
|
2643
2645
|
}).then(({ x, y }) => {
|
|
2644
2646
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2646,11 +2648,11 @@ const computeToolTipPosition = async ({ elementReference = null, tooltipReferenc
|
|
|
2646
2648
|
});
|
|
2647
2649
|
};
|
|
2648
2650
|
|
|
2649
|
-
var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2651
|
+
var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fixed__7ciUi","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2650
2652
|
|
|
2651
2653
|
const Tooltip = ({
|
|
2652
2654
|
// props
|
|
2653
|
-
id = useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0,
|
|
2655
|
+
id = useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, style: externalStyles,
|
|
2654
2656
|
// props handled by controller
|
|
2655
2657
|
isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
2656
2658
|
const tooltipRef = createRef();
|
|
@@ -2755,6 +2757,7 @@ isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
|
2755
2757
|
elementReference,
|
|
2756
2758
|
tooltipReference: tooltipRef.current,
|
|
2757
2759
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2760
|
+
strategy: positionStrategy,
|
|
2758
2761
|
}).then((computedStylesData) => {
|
|
2759
2762
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
2760
2763
|
setInlineStyles(computedStylesData.tooltipStyles);
|
|
@@ -2770,7 +2773,8 @@ isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
|
2770
2773
|
}, [show, isOpen, anchorId]);
|
|
2771
2774
|
return (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames(styles['tooltip'], styles[variant], className, {
|
|
2772
2775
|
[styles['show']]: isOpen || show,
|
|
2773
|
-
|
|
2776
|
+
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2777
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [children || (isHtmlContent ? jsxRuntime.exports.jsx(TooltipContent, { content: content }) : content), jsxRuntime.exports.jsx("div", { className: classNames(styles['arrow'], classNameArrow), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
2774
2778
|
};
|
|
2775
2779
|
|
|
2776
2780
|
const dataAttributesKeys = [
|
|
@@ -2785,7 +2789,7 @@ const dataAttributesKeys = [
|
|
|
2785
2789
|
'delay-hide', // delay to hide tooltip
|
|
2786
2790
|
];
|
|
2787
2791
|
|
|
2788
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], delayShow = 0, delayHide = 0, getContent, isOpen, setIsOpen, }) => {
|
|
2792
|
+
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, style, getContent, isOpen, setIsOpen, }) => {
|
|
2789
2793
|
const [tooltipContent, setTooltipContent] = useState(content || html);
|
|
2790
2794
|
const [tooltipPlace, setTooltipPlace] = useState(place);
|
|
2791
2795
|
const [tooltipVariant, setTooltipVariant] = useState(variant);
|
|
@@ -2794,6 +2798,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2794
2798
|
const [tooltipDelayHide, setTooltipDelayHide] = useState(delayHide);
|
|
2795
2799
|
const [tooltipWrapper, setTooltipWrapper] = useState(wrapper);
|
|
2796
2800
|
const [tooltipEvents, setTooltipEvents] = useState(events);
|
|
2801
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy);
|
|
2797
2802
|
const [isHtmlContent, setIsHtmlContent] = useState(Boolean(html));
|
|
2798
2803
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
2799
2804
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
@@ -2842,6 +2847,9 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2842
2847
|
const parsedEvents = value.split(' ');
|
|
2843
2848
|
setTooltipEvents(parsedEvents);
|
|
2844
2849
|
},
|
|
2850
|
+
positionStrategy: (value) => {
|
|
2851
|
+
setTooltipPositionStrategy(value);
|
|
2852
|
+
},
|
|
2845
2853
|
'delay-show': (value) => {
|
|
2846
2854
|
setTooltipDelayShow(Number(value));
|
|
2847
2855
|
},
|
|
@@ -2910,8 +2918,10 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
2910
2918
|
offset: tooltipOffset,
|
|
2911
2919
|
wrapper: tooltipWrapper,
|
|
2912
2920
|
events: tooltipEvents,
|
|
2921
|
+
positionStrategy: tooltipPositionStrategy,
|
|
2913
2922
|
delayShow: tooltipDelayShow,
|
|
2914
2923
|
delayHide: tooltipDelayHide,
|
|
2924
|
+
style,
|
|
2915
2925
|
isOpen,
|
|
2916
2926
|
setIsOpen,
|
|
2917
2927
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e,{createRef as t,useRef as n,useState as r,useEffect as o,useId as i}from"react";var a={exports:{}},l={};!function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),h=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];b("error",e,n)}function b(e,t,n){var r=g.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}var w;function x(e){return e.displayName||"Context"}function _(e){if(null==e)return null;if("number"==typeof e.tag&&v("Received an unexpected object in getComponentNameFromType(). 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 o:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return x(e)+".Consumer";case s:return x(e._context)+".Provider";case u:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:_(e.type)||"Memo";case y:var n=e,l=n._payload,m=n._init;try{return _(m(l))}catch(e){return null}}return null}w=Symbol.for("react.module.reference");var S,R,k,T,O,j,E,P=Object.assign,A=0;function N(){}N.__reactDisabledLog=!0;var L,C=g.ReactCurrentDispatcher;function $(e,t,n){if(void 0===L)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);L=r&&r[1]||""}return"\n"+L+e}var D,F=!1,I="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||F)return"";var n,r=D.get(e);if(void 0!==r)return r;F=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=C.current,C.current=null,function(){if(0===A){S=console.log,R=console.info,k=console.warn,T=console.error,O=console.group,j=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:N,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var l=t.stack.split("\n"),s=n.stack.split("\n"),c=l.length-1,u=s.length-1;c>=1&&u>=0&&l[c]!==s[u];)u--;for(;c>=1&&u>=0;c--,u--)if(l[c]!==s[u]){if(1!==c||1!==u)do{if(c--,--u<0||l[c]!==s[u]){var f="\n"+l[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&D.set(e,f),f}}while(c>=1&&u>=0);break}}}finally{F=!1,C.current=o,function(){if(0==--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:S}),info:P({},e,{value:R}),warn:P({},e,{value:k}),error:P({},e,{value:T}),group:P({},e,{value:O}),groupCollapsed:P({},e,{value:j}),groupEnd:P({},e,{value:E})})}A<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var p=e?e.displayName||e.name:"",d=p?$(p):"";return"function"==typeof e&&D.set(e,d),d}function H(e,t,n){if(null==e)return"";if("function"==typeof e)return W(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return $(e);switch(e){case f:return $("Suspense");case p:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return W(e.render,!1);case d:return H(e.type,t,n);case y:var o=e,i=o._payload,a=o._init;try{return H(a(i),t,n)}catch(e){}}return""}D=new I;var M=Object.prototype.hasOwnProperty,U={},B=g.ReactDebugCurrentFrame;function V(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var z=Array.isArray;function Y(e){return z(e)}function q(e){return""+e}function X(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}var J,K,Z,G=g.ReactCurrentOwner,Q={key:!0,ref:!0,__self:!0,__source:!0};Z={};function ee(e,t,r,o,i){var a,l={},s=null,c=null;for(a in void 0!==r&&(X(r),s=""+r),function(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(X(t.key),s=""+t.key),function(e){if(M.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e,t){if("string"==typeof e.ref&&G.current&&t&&G.current.stateNode!==t){var n=_(G.current.type);Z[n]||(v('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',_(G.current.type),e.ref),Z[n]=!0)}}(t,i)),t)M.call(t,a)&&!Q.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===l[a]&&(l[a]=u[a])}if(s||c){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){J||(J=!0,v("%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})}(l,f),c&&function(e,t){var n=function(){K||(K=!0,v("%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})}(l,f)}return function(e,t,r,o,i,a,l){var s={$$typeof:n,type:e,key:t,ref:r,props:l,_owner:a,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}(e,s,c,i,o,G.current,l)}var te,ne=g.ReactCurrentOwner,re=g.ReactDebugCurrentFrame;function oe(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);re.setExtraStackFrame(n)}else re.setExtraStackFrame(null)}function ie(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ae(){if(ne.current){var e=_(ne.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}te=!1;var le={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ae();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(!le[n]){le[n]=!0;var r="";e&&e._owner&&e._owner!==ne.current&&(r=" It was passed a child from "+_(e._owner.type)+"."),oe(e),v('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),oe(null)}}}function ce(e,t){if("object"==typeof e)if(Y(e))for(var n=0;n<e.length;n++){var r=e[n];ie(r)&&se(r,t)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)ie(i.value)&&se(i.value,t)}}function ue(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!==u&&n.$$typeof!==d)return;t=n.propTypes}if(t){var r=_(n);!function(e,t,n,r,o){var i=Function.call.bind(M);for(var a in e)if(i(e,a)){var l=void 0;try{if("function"!=typeof e[a]){var s=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}l=e[a](t,a,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){l=e}!l||l instanceof Error||(V(o),v("%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,a,typeof l),V(null)),l instanceof Error&&!(l.message in U)&&(U[l.message]=!0,V(o),v("Failed %s type: %s",n,l.message),V(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!te){te=!0,v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fe(e,t,r,l,h,g){var b=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===a||e===i||e===f||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===u||e.$$typeof===w||void 0!==e.getModuleId)}(e);if(!b){var x="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(x+=" 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,R=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(h);x+=R||ae(),null===e?S="null":Y(e)?S="array":void 0!==e&&e.$$typeof===n?(S="<"+(_(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,x)}var k=ee(e,t,r,h,g);if(null==k)return k;if(b){var T=t.children;if(void 0!==T)if(l)if(Y(T)){for(var O=0;O<T.length;O++)ce(T[O],e);Object.freeze&&Object.freeze(T)}else v("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 ce(T,e)}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){oe(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),oe(null);break}}null!==e.ref&&(oe(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}(k):ue(k),k}var pe=function(e,t,n){return fe(e,t,n,!1)},de=function(e,t,n){return fe(e,t,n,!0)};l.Fragment=o,l.jsx=pe,l.jsxs=de}(),a.exports=l;var s,c={exports:{}};
|
|
1
|
+
import e,{createRef as t,useRef as n,useState as r,useEffect as o,useId as i}from"react";var a={exports:{}},l={};!function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),h=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];b("error",e,n)}function b(e,t,n){var r=g.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}var w;function x(e){return e.displayName||"Context"}function _(e){if(null==e)return null;if("number"==typeof e.tag&&v("Received an unexpected object in getComponentNameFromType(). 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 o:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return x(e)+".Consumer";case s:return x(e._context)+".Provider";case u:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:_(e.type)||"Memo";case y:var n=e,l=n._payload,m=n._init;try{return _(m(l))}catch(e){return null}}return null}w=Symbol.for("react.module.reference");var S,R,k,T,O,j,E,P=Object.assign,A=0;function N(){}N.__reactDisabledLog=!0;var L,C=g.ReactCurrentDispatcher;function $(e,t,n){if(void 0===L)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);L=r&&r[1]||""}return"\n"+L+e}var D,F=!1,I="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||F)return"";var n,r=D.get(e);if(void 0!==r)return r;F=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=C.current,C.current=null,function(){if(0===A){S=console.log,R=console.info,k=console.warn,T=console.error,O=console.group,j=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:N,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var l=t.stack.split("\n"),s=n.stack.split("\n"),c=l.length-1,u=s.length-1;c>=1&&u>=0&&l[c]!==s[u];)u--;for(;c>=1&&u>=0;c--,u--)if(l[c]!==s[u]){if(1!==c||1!==u)do{if(c--,--u<0||l[c]!==s[u]){var f="\n"+l[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&D.set(e,f),f}}while(c>=1&&u>=0);break}}}finally{F=!1,C.current=o,function(){if(0==--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:S}),info:P({},e,{value:R}),warn:P({},e,{value:k}),error:P({},e,{value:T}),group:P({},e,{value:O}),groupCollapsed:P({},e,{value:j}),groupEnd:P({},e,{value:E})})}A<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var p=e?e.displayName||e.name:"",d=p?$(p):"";return"function"==typeof e&&D.set(e,d),d}function H(e,t,n){if(null==e)return"";if("function"==typeof e)return W(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return $(e);switch(e){case f:return $("Suspense");case p:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return W(e.render,!1);case d:return H(e.type,t,n);case y:var o=e,i=o._payload,a=o._init;try{return H(a(i),t,n)}catch(e){}}return""}D=new I;var U=Object.prototype.hasOwnProperty,M={},B=g.ReactDebugCurrentFrame;function V(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var z=Array.isArray;function Y(e){return z(e)}function q(e){return""+e}function X(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}var J,K,Z,G=g.ReactCurrentOwner,Q={key:!0,ref:!0,__self:!0,__source:!0};Z={};function ee(e,t,r,o,i){var a,l={},s=null,c=null;for(a in void 0!==r&&(X(r),s=""+r),function(e){if(U.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(X(t.key),s=""+t.key),function(e){if(U.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e,t){if("string"==typeof e.ref&&G.current&&t&&G.current.stateNode!==t){var n=_(G.current.type);Z[n]||(v('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',_(G.current.type),e.ref),Z[n]=!0)}}(t,i)),t)U.call(t,a)&&!Q.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===l[a]&&(l[a]=u[a])}if(s||c){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){J||(J=!0,v("%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})}(l,f),c&&function(e,t){var n=function(){K||(K=!0,v("%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})}(l,f)}return function(e,t,r,o,i,a,l){var s={$$typeof:n,type:e,key:t,ref:r,props:l,_owner:a,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}(e,s,c,i,o,G.current,l)}var te,ne=g.ReactCurrentOwner,re=g.ReactDebugCurrentFrame;function oe(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);re.setExtraStackFrame(n)}else re.setExtraStackFrame(null)}function ie(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ae(){if(ne.current){var e=_(ne.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}te=!1;var le={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ae();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(!le[n]){le[n]=!0;var r="";e&&e._owner&&e._owner!==ne.current&&(r=" It was passed a child from "+_(e._owner.type)+"."),oe(e),v('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),oe(null)}}}function ce(e,t){if("object"==typeof e)if(Y(e))for(var n=0;n<e.length;n++){var r=e[n];ie(r)&&se(r,t)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)ie(i.value)&&se(i.value,t)}}function ue(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!==u&&n.$$typeof!==d)return;t=n.propTypes}if(t){var r=_(n);!function(e,t,n,r,o){var i=Function.call.bind(U);for(var a in e)if(i(e,a)){var l=void 0;try{if("function"!=typeof e[a]){var s=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}l=e[a](t,a,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){l=e}!l||l instanceof Error||(V(o),v("%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,a,typeof l),V(null)),l instanceof Error&&!(l.message in M)&&(M[l.message]=!0,V(o),v("Failed %s type: %s",n,l.message),V(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!te){te=!0,v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fe(e,t,r,l,h,g){var b=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===a||e===i||e===f||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===u||e.$$typeof===w||void 0!==e.getModuleId)}(e);if(!b){var x="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(x+=" 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,R=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(h);x+=R||ae(),null===e?S="null":Y(e)?S="array":void 0!==e&&e.$$typeof===n?(S="<"+(_(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,x)}var k=ee(e,t,r,h,g);if(null==k)return k;if(b){var T=t.children;if(void 0!==T)if(l)if(Y(T)){for(var O=0;O<T.length;O++)ce(T[O],e);Object.freeze&&Object.freeze(T)}else v("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 ce(T,e)}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){oe(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),oe(null);break}}null!==e.ref&&(oe(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}(k):ue(k),k}var pe=function(e,t,n){return fe(e,t,n,!1)},de=function(e,t,n){return fe(e,t,n,!0)};l.Fragment=o,l.jsx=pe,l.jsxs=de}(),a.exports=l;var s,c={exports:{}};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/s=c,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 a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var l in o)e.call(o,l)&&o[l]&&n.push(l)}}}return n.join(" ")}s.exports?(t.default=t,s.exports=t):window.classNames=t}();var u=c.exports;const f=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},p=({content:e})=>a.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function d(e){return e.split("-")[0]}function y(e){return e.split("-")[1]}function m(e){return["top","bottom"].includes(d(e))?"x":"y"}function h(e){return"y"===e?"height":"width"}function g(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=m(t),s=h(l),c=r[s]/2-o[s]/2,u="x"===l;let f;switch(d(t)){case"top":f={x:i,y:r.y-o.height};break;case"bottom":f={x:i,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:a};break;case"left":f={x:r.x-o.width,y:a};break;default:f={x:r.x,y:r.y}}switch(y(t)){case"start":f[l]-=c*(n&&u?-1:1);break;case"end":f[l]+=c*(n&&u?-1:1)}return f}function v(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 b(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function w(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=v(d),m=l[p?"floating"===f?"reference":"floating":f],h=b(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),g=b(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:h.top-g.top+y.top,bottom:g.bottom-h.bottom+y.bottom,left:h.left-g.left+y.left,right:g.right-h.right+y.right}}const x=Math.min,_=Math.max;function S(e,t,n){return _(e,x(t,n))}const R={left:"right",right:"left",bottom:"top",top:"bottom"};function k(e){return e.replace(/left|right|bottom|top/g,(e=>R[e]))}const T={start:"end",end:"start"};function O(e){return e.replace(/start|end/g,(e=>T[e]))}const j=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",flipAlignment:g=!0,...v}=e,b=d(r),x=f||(b===a||!g?[k(a)]:function(e){const t=k(e);return[O(e),t,O(t)]}(a)),_=[a,...x],S=await w(t,v),R=[];let T=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&R.push(S[b]),u){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=y(e),o=m(e),i=h(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=k(a)),{main:a,cross:k(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));R.push(S[e],S[t])}if(T=[...T,{placement:r,overflows:R}],!R.every((e=>e<=0))){var j,E;const e=(null!=(j=null==(E=o.flip)?void 0:E.index)?j:0)+1,t=_[e];if(t)return{data:{index:e,overflows:T},reset:{placement:t}};let n="bottom";switch(p){case"bestFit":{var P;const e=null==(P=T.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};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)),a=d(n),l=y(n),s="x"===m(n),c=["left","top"].includes(a)?-1:1,u=i&&s?-1:1,f="function"==typeof t?t(e):t;let{mainAxis:p,crossAxis:h,alignmentAxis:g}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*u,y:p*c}:{x:p*c,y:h*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function P(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function A(e){if(null==e)return window;if(!P(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function N(e){return A(e).getComputedStyle(e)}function L(e){return P(e)?"":e?(e.nodeName||"").toLowerCase():""}function C(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function $(e){return e instanceof A(e).HTMLElement}function D(e){return e instanceof A(e).Element}function F(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof A(e).ShadowRoot||e instanceof ShadowRoot}function I(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=N(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function W(e){return["table","td","th"].includes(L(e))}function H(e){const t=/firefox/i.test(C()),n=N(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 M(){return!/^((?!chrome|android).)*safari/i.test(C())}function U(e){return["html","body","#document"].includes(L(e))}const B=Math.min,V=Math.max,z=Math.round;function Y(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&$(e)&&(s=e.offsetWidth>0&&z(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&z(l.height)/e.offsetHeight||1);const u=D(e)?A(e):window,f=!M()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function q(e){return(t=e,(t instanceof A(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function X(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function J(e){return Y(q(e)).left+X(e).scrollLeft}function K(e,t,n){const r=$(t),o=q(t),i=Y(e,r&&function(e){const t=Y(e);return z(t.width)!==e.offsetWidth||z(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==L(t)||I(o))&&(a=X(t)),$(t)){const e=Y(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=J(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function Z(e){if("html"===L(e))return e;const t=e.assignedSlot||e.parentNode||(F(e)?e.host:null)||q(e);return F(t)?t.host:t}function G(e){return $(e)&&"fixed"!==N(e).position?e.offsetParent:null}function Q(e){const t=A(e);let n=G(e);for(;n&&W(n)&&"static"===N(n).position;)n=G(n);return n&&("html"===L(n)||"body"===L(n)&&"static"===N(n).position&&!H(n))?t:n||function(e){let t=Z(e);for(;$(t)&&!U(t);){if(H(t))return t;t=Z(t)}return null}(e)||t}function ee(e){if($(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Y(e);return{width:t.width,height:t.height}}function te(e){const t=Z(e);return U(t)?e.ownerDocument.body:$(t)&&I(t)?t:te(t)}function ne(e,t){var n;void 0===t&&(t=[]);const r=te(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=A(r),a=o?[i].concat(i.visualViewport||[],I(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(ne(a))}function re(e,t,n){return"viewport"===t?b(function(e,t){const n=A(e),r=q(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=M();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):D(t)?function(e,t){const n=Y(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):b(function(e){var t;const n=q(e),r=X(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=V(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=V(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+J(e);const s=-r.scrollTop;return"rtl"===N(o||n).direction&&(l+=V(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(q(e)))}const oe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=ne(e).filter((e=>D(e)&&"body"!==L(e))),n=e,r=null;for(;D(n)&&!U(n);){const e=N(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!H(n)?t=t.filter((e=>e!==n)):r=e,n=Z(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=re(t,n,o);return e.top=V(r.top,e.top),e.right=B(r.right,e.right),e.bottom=B(r.bottom,e.bottom),e.left=V(r.left,e.left),e}),re(t,l,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=$(n),i=q(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==L(n)||I(i))&&(a=X(n)),$(n))){const e=Y(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:D,getDimensions:ee,getOffsetParent:Q,getDocumentElement:q,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:K(t,Q(n),r),floating:{...ee(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===N(e).direction},ie=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=g(c,r,s),p=r,d={},y=0;for(let n=0;n<l.length;n++){const{name:i,fn:m}=l[n],{x:h,y:v,data:b,reset:w}=await m({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=h?h:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&y<=50&&(y++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=g(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:oe,...n}),ae=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const i=[E(Number(o)),j(),(a={padding:5},void 0===a&&(a={}),{name:"shift",options:a,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=a,c={x:t,y:n},u=await w(e,s),f=m(d(r)),p="x"===f?"y":"x";let y=c[f],h=c[p];if(o){const e="y"===f?"bottom":"right";y=S(y+u["y"===f?"top":"left"],y,y-u[e])}if(i){const e="y"===p?"bottom":"right";h=S(h+u["y"===p?"top":"left"],h,h-u[e])}const g=l.fn({...e,[f]:y,[p]:h});return{...g,data:{x:g.x-t,y:g.y-n}}}})];var a;return n?(i.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=v(r),u={x:o,y:i},f=m(a),p=y(a),d=h(f),g=await s.getDimensions(n),b="y"===f?"top":"left",w="y"===f?"bottom":"right",x=l.reference[d]+l.reference[f]-u[f]-l.floating[d],_=u[f]-l.reference[f],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===f?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[d]);const T=x/2-_/2,O=c[b],j=k-g[d]-c[w],E=k/2-g[d]/2+T,P=S(O,E,j),A=("start"===p?c[b]:c[w])>0&&E!==P&&l.reference[d]<=l.floating[d];return{[f]:u[f]-(A?E<O?O-E:j-E:0),data:{[f]:P,centerOffset:E-P}}}}))({element:n})),ie(e,t,{placement:r,middleware:i}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ie(e,t,{placement:"bottom",middleware:i}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var le={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",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 se=({id:e=i(),className:l,classNameArrow:s,variant:c="dark",anchorId:d,place:y="top",offset:m=10,events:h=["hover"],wrapper:g="div",children:v=null,delayShow:b=0,delayHide:w=0,isHtmlContent:x=!1,content:_,isOpen:S,setIsOpen:R})=>{const k=t(),T=t(),O=n(),j=n(),[E,P]=r({}),[A,N]=r({}),[L,C]=r(!1),$=e=>{R?R(e):void 0===S&&C(e)},D=()=>{R?R(!S):void 0===S&&C((e=>!e))},F=f((()=>{b?(O.current&&clearTimeout(O.current),O.current=setTimeout((()=>{$(!0)}),b)):$(!0),j.current&&clearTimeout(j.current)}),50),I=f((()=>{w?(j.current&&clearTimeout(j.current),j.current=setTimeout((()=>{$(!1)}),w)):$(!1),L&&O.current?clearTimeout(O.current):!L&&O.current&&(j.current=setTimeout((()=>{$(!1)}),2*b))}),50);return o((()=>{const e=document.querySelector(`#${d}`);if(!e)return()=>{};const t=[];return h.find((e=>"click"===e))&&t.push({event:"click",listener:D}),h.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:F},{event:"mouseleave",listener:I},{event:"focus",listener:F},{event:"blur",listener:I}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[d,h,w,b]),o((()=>{const e=document.querySelector(`#${d}`);return ae({place:y,offset:m,elementReference:e,tooltipReference:k.current,tooltipArrowReference:T.current}).then((e=>{Object.keys(e.tooltipStyles).length&&P(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&N(e.tooltipArrowStyles)})),()=>{O.current=void 0,j.current=void 0}}),[L,S,d]),a.exports.jsxs(g,{id:e,role:"tooltip",className:u(le.tooltip,le[c],l,{[le.show]:S||L}),style:E,ref:k,children:[v||(x?a.exports.jsx(p,{content:_}):_),a.exports.jsx("div",{className:u(le.arrow,s),style:A,ref:T})]})},ce=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"],ue=({id:e,anchorId:t,content:n,html:i,className:l,classNameArrow:s,variant:c="dark",place:u="top",offset:f=10,wrapper:p="div",children:d=null,events:y=["hover"],delayShow:m=0,delayHide:h=0,getContent:g,isOpen:v,setIsOpen:b})=>{const[w,x]=r(n||i),[_,S]=r(u),[R,k]=r(c),[T,O]=r(f),[j,E]=r(m),[P,A]=r(h),[N,L]=r(p),[C,$]=r(y),[D,F]=r(Boolean(i)),I=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{S(e)},content:e=>{F(!0),x(g?g(e):e)},html:e=>{F(!0),x(g?g(e):e)},variant:e=>{k(e)},offset:e=>{O(e)},wrapper:e=>{L(e)},events:e=>{const t=e.split(" ");$(t)},"delay-show":e=>{E(Number(e))},"delay-hide":e=>{A(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ce.includes(n)&&r[n](e[t])}))};o((()=>{if(!t)return()=>{};const e=document.querySelector(`#${t}`);if(!e)return()=>{};n&&g&&x(g(n));const r=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});I(n)}}))}));r.observe(e,{attributes:!0,childList:!1,subtree:!1});const o=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return I(o),()=>{r.disconnect()}}),[t]);const W={id:e,anchorId:t,className:l,classNameArrow:s,content:w,isHtmlContent:D,place:_,variant:R,offset:T,wrapper:N,events:C,delayShow:j,delayHide:P,isOpen:v,setIsOpen:b};return d?a.exports.jsx(se,{...W,children:d}):a.exports.jsx(se,{...W})};export{ue as Tooltip};
|
|
6
|
+
*/s=c,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 a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var l in o)e.call(o,l)&&o[l]&&n.push(l)}}}return n.join(" ")}s.exports?(t.default=t,s.exports=t):window.classNames=t}();var u=c.exports;const f=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},p=({content:e})=>a.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function d(e){return e.split("-")[0]}function y(e){return e.split("-")[1]}function m(e){return["top","bottom"].includes(d(e))?"x":"y"}function h(e){return"y"===e?"height":"width"}function g(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=m(t),s=h(l),c=r[s]/2-o[s]/2,u="x"===l;let f;switch(d(t)){case"top":f={x:i,y:r.y-o.height};break;case"bottom":f={x:i,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:a};break;case"left":f={x:r.x-o.width,y:a};break;default:f={x:r.x,y:r.y}}switch(y(t)){case"start":f[l]-=c*(n&&u?-1:1);break;case"end":f[l]+=c*(n&&u?-1:1)}return f}function v(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 b(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function w(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=v(d),m=l[p?"floating"===f?"reference":"floating":f],h=b(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),g=b(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:h.top-g.top+y.top,bottom:g.bottom-h.bottom+y.bottom,left:h.left-g.left+y.left,right:g.right-h.right+y.right}}const x=Math.min,_=Math.max;function S(e,t,n){return _(e,x(t,n))}const R={left:"right",right:"left",bottom:"top",top:"bottom"};function k(e){return e.replace(/left|right|bottom|top/g,(e=>R[e]))}const T={start:"end",end:"start"};function O(e){return e.replace(/start|end/g,(e=>T[e]))}const j=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",flipAlignment:g=!0,...v}=e,b=d(r),x=f||(b===a||!g?[k(a)]:function(e){const t=k(e);return[O(e),t,O(t)]}(a)),_=[a,...x],S=await w(t,v),R=[];let T=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&R.push(S[b]),u){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=y(e),o=m(e),i=h(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=k(a)),{main:a,cross:k(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));R.push(S[e],S[t])}if(T=[...T,{placement:r,overflows:R}],!R.every((e=>e<=0))){var j,E;const e=(null!=(j=null==(E=o.flip)?void 0:E.index)?j:0)+1,t=_[e];if(t)return{data:{index:e,overflows:T},reset:{placement:t}};let n="bottom";switch(p){case"bestFit":{var P;const e=null==(P=T.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};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)),a=d(n),l=y(n),s="x"===m(n),c=["left","top"].includes(a)?-1:1,u=i&&s?-1:1,f="function"==typeof t?t(e):t;let{mainAxis:p,crossAxis:h,alignmentAxis:g}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*u,y:p*c}:{x:p*c,y:h*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function P(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function A(e){if(null==e)return window;if(!P(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function N(e){return A(e).getComputedStyle(e)}function L(e){return P(e)?"":e?(e.nodeName||"").toLowerCase():""}function C(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function $(e){return e instanceof A(e).HTMLElement}function D(e){return e instanceof A(e).Element}function F(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof A(e).ShadowRoot||e instanceof ShadowRoot}function I(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=N(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function W(e){return["table","td","th"].includes(L(e))}function H(e){const t=/firefox/i.test(C()),n=N(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 U(){return!/^((?!chrome|android).)*safari/i.test(C())}function M(e){return["html","body","#document"].includes(L(e))}const B=Math.min,V=Math.max,z=Math.round;function Y(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&$(e)&&(s=e.offsetWidth>0&&z(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&z(l.height)/e.offsetHeight||1);const u=D(e)?A(e):window,f=!U()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function q(e){return(t=e,(t instanceof A(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function X(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function J(e){return Y(q(e)).left+X(e).scrollLeft}function K(e,t,n){const r=$(t),o=q(t),i=Y(e,r&&function(e){const t=Y(e);return z(t.width)!==e.offsetWidth||z(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==L(t)||I(o))&&(a=X(t)),$(t)){const e=Y(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=J(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function Z(e){if("html"===L(e))return e;const t=e.assignedSlot||e.parentNode||(F(e)?e.host:null)||q(e);return F(t)?t.host:t}function G(e){return $(e)&&"fixed"!==N(e).position?e.offsetParent:null}function Q(e){const t=A(e);let n=G(e);for(;n&&W(n)&&"static"===N(n).position;)n=G(n);return n&&("html"===L(n)||"body"===L(n)&&"static"===N(n).position&&!H(n))?t:n||function(e){let t=Z(e);for(;$(t)&&!M(t);){if(H(t))return t;t=Z(t)}return null}(e)||t}function ee(e){if($(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Y(e);return{width:t.width,height:t.height}}function te(e){const t=Z(e);return M(t)?e.ownerDocument.body:$(t)&&I(t)?t:te(t)}function ne(e,t){var n;void 0===t&&(t=[]);const r=te(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=A(r),a=o?[i].concat(i.visualViewport||[],I(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(ne(a))}function re(e,t,n){return"viewport"===t?b(function(e,t){const n=A(e),r=q(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=U();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):D(t)?function(e,t){const n=Y(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):b(function(e){var t;const n=q(e),r=X(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=V(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=V(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+J(e);const s=-r.scrollTop;return"rtl"===N(o||n).direction&&(l+=V(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(q(e)))}const oe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=ne(e).filter((e=>D(e)&&"body"!==L(e))),n=e,r=null;for(;D(n)&&!M(n);){const e=N(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!H(n)?t=t.filter((e=>e!==n)):r=e,n=Z(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=re(t,n,o);return e.top=V(r.top,e.top),e.right=B(r.right,e.right),e.bottom=B(r.bottom,e.bottom),e.left=V(r.left,e.left),e}),re(t,l,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=$(n),i=q(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==L(n)||I(i))&&(a=X(n)),$(n))){const e=Y(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:D,getDimensions:ee,getOffsetParent:Q,getDocumentElement:q,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:K(t,Q(n),r),floating:{...ee(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===N(e).direction},ie=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=g(c,r,s),p=r,d={},y=0;for(let n=0;n<l.length;n++){const{name:i,fn:m}=l[n],{x:h,y:v,data:b,reset:w}=await m({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=h?h:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&y<=50&&(y++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=g(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:oe,...n}),ae=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute"})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const a=[E(Number(o)),j(),(l={padding:5},void 0===l&&(l={}),{name:"shift",options:l,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=l,c={x:t,y:n},u=await w(e,s),f=m(d(r)),p="x"===f?"y":"x";let y=c[f],h=c[p];if(o){const e="y"===f?"bottom":"right";y=S(y+u["y"===f?"top":"left"],y,y-u[e])}if(i){const e="y"===p?"bottom":"right";h=S(h+u["y"===p?"top":"left"],h,h-u[e])}const g=a.fn({...e,[f]:y,[p]:h});return{...g,data:{x:g.x-t,y:g.y-n}}}})];var l;return n?(a.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=v(r),u={x:o,y:i},f=m(a),p=y(a),d=h(f),g=await s.getDimensions(n),b="y"===f?"top":"left",w="y"===f?"bottom":"right",x=l.reference[d]+l.reference[f]-u[f]-l.floating[d],_=u[f]-l.reference[f],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===f?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[d]);const T=x/2-_/2,O=c[b],j=k-g[d]-c[w],E=k/2-g[d]/2+T,P=S(O,E,j),A=("start"===p?c[b]:c[w])>0&&E!==P&&l.reference[d]<=l.floating[d];return{[f]:u[f]-(A?E<O?O-E:j-E:0),data:{[f]:P,centerOffset:E-P}}}}))({element:n})),ie(e,t,{placement:r,strategy:i,middleware:a}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ie(e,t,{placement:"bottom",strategy:i,middleware:a}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var le={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T",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 se=({id:e=i(),className:l,classNameArrow:s,variant:c="dark",anchorId:d,place:y="top",offset:m=10,events:h=["hover"],positionStrategy:g="absolute",wrapper:v="div",children:b=null,delayShow:w=0,delayHide:x=0,style:_,isHtmlContent:S=!1,content:R,isOpen:k,setIsOpen:T})=>{const O=t(),j=t(),E=n(),P=n(),[A,N]=r({}),[L,C]=r({}),[$,D]=r(!1),F=e=>{T?T(e):void 0===k&&D(e)},I=()=>{T?T(!k):void 0===k&&D((e=>!e))},W=f((()=>{w?(E.current&&clearTimeout(E.current),E.current=setTimeout((()=>{F(!0)}),w)):F(!0),P.current&&clearTimeout(P.current)}),50),H=f((()=>{x?(P.current&&clearTimeout(P.current),P.current=setTimeout((()=>{F(!1)}),x)):F(!1),$&&E.current?clearTimeout(E.current):!$&&E.current&&(P.current=setTimeout((()=>{F(!1)}),2*w))}),50);return o((()=>{const e=document.querySelector(`#${d}`);if(!e)return()=>{};const t=[];return h.find((e=>"click"===e))&&t.push({event:"click",listener:I}),h.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:W},{event:"mouseleave",listener:H},{event:"focus",listener:W},{event:"blur",listener:H}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[d,h,x,w]),o((()=>{const e=document.querySelector(`#${d}`);return ae({place:y,offset:m,elementReference:e,tooltipReference:O.current,tooltipArrowReference:j.current,strategy:g}).then((e=>{Object.keys(e.tooltipStyles).length&&N(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&C(e.tooltipArrowStyles)})),()=>{E.current=void 0,P.current=void 0}}),[$,k,d]),a.exports.jsxs(v,{id:e,role:"tooltip",className:u(le.tooltip,le[c],l,{[le.show]:k||$,[le.fixed]:"fixed"===g}),style:{..._,...A},ref:O,children:[b||(S?a.exports.jsx(p,{content:R}):R),a.exports.jsx("div",{className:u(le.arrow,s),style:L,ref:j})]})},ce=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"],ue=({id:e,anchorId:t,content:n,html:i,className:l,classNameArrow:s,variant:c="dark",place:u="top",offset:f=10,wrapper:p="div",children:d=null,events:y=["hover"],positionStrategy:m="absolute",delayShow:h=0,delayHide:g=0,style:v,getContent:b,isOpen:w,setIsOpen:x})=>{const[_,S]=r(n||i),[R,k]=r(u),[T,O]=r(c),[j,E]=r(f),[P,A]=r(h),[N,L]=r(g),[C,$]=r(p),[D,F]=r(y),[I,W]=r(m),[H,U]=r(Boolean(i)),M=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{k(e)},content:e=>{U(!0),S(b?b(e):e)},html:e=>{U(!0),S(b?b(e):e)},variant:e=>{O(e)},offset:e=>{E(e)},wrapper:e=>{$(e)},events:e=>{const t=e.split(" ");F(t)},positionStrategy:e=>{W(e)},"delay-show":e=>{A(Number(e))},"delay-hide":e=>{L(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ce.includes(n)&&r[n](e[t])}))};o((()=>{if(!t)return()=>{};const e=document.querySelector(`#${t}`);if(!e)return()=>{};n&&b&&S(b(n));const r=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});M(n)}}))}));r.observe(e,{attributes:!0,childList:!1,subtree:!1});const o=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return M(o),()=>{r.disconnect()}}),[t]);const B={id:e,anchorId:t,className:l,classNameArrow:s,content:_,isHtmlContent:H,place:R,variant:T,offset:j,wrapper:C,events:D,positionStrategy:I,delayShow:P,delayHide:N,style:v,isOpen:w,setIsOpen:x};return d?a.exports.jsx(se,{...B,children:d}):a.exports.jsx(se,{...B})};export{ue as Tooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7}.styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.styles-module_arrow__K0L3T{background:
|
|
1
|
+
:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7}.styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.styles-module_fixed__7ciUi{position:fixed}.styles-module_arrow__K0L3T{background:inherit;height:8px;position:absolute;transform:rotate(45deg);width:8px}.styles-module_show__2NboJ{opacity:.9;visibility:visible}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}
|
|
@@ -2608,7 +2608,7 @@
|
|
|
2608
2608
|
...options
|
|
2609
2609
|
});
|
|
2610
2610
|
|
|
2611
|
-
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, }) => {
|
|
2611
|
+
const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
|
|
2612
2612
|
if (!elementReference) {
|
|
2613
2613
|
// elementReference can be null or undefined and we will not compute the position
|
|
2614
2614
|
// eslint-disable-next-line no-console
|
|
@@ -2623,6 +2623,7 @@
|
|
|
2623
2623
|
middleware.push(arrow({ element: tooltipArrowReference }));
|
|
2624
2624
|
return computePosition(elementReference, tooltipReference, {
|
|
2625
2625
|
placement: place,
|
|
2626
|
+
strategy,
|
|
2626
2627
|
middleware,
|
|
2627
2628
|
}).then(({ x, y, placement, middlewareData }) => {
|
|
2628
2629
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2647,6 +2648,7 @@
|
|
|
2647
2648
|
}
|
|
2648
2649
|
return computePosition(elementReference, tooltipReference, {
|
|
2649
2650
|
placement: 'bottom',
|
|
2651
|
+
strategy,
|
|
2650
2652
|
middleware,
|
|
2651
2653
|
}).then(({ x, y }) => {
|
|
2652
2654
|
const styles = { left: `${x}px`, top: `${y}px` };
|
|
@@ -2654,11 +2656,11 @@
|
|
|
2654
2656
|
});
|
|
2655
2657
|
};
|
|
2656
2658
|
|
|
2657
|
-
var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2659
|
+
var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fixed__7ciUi","arrow":"styles-module_arrow__K0L3T","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"};
|
|
2658
2660
|
|
|
2659
2661
|
const Tooltip = ({
|
|
2660
2662
|
// props
|
|
2661
|
-
id = require$$0.useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0,
|
|
2663
|
+
id = require$$0.useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, style: externalStyles,
|
|
2662
2664
|
// props handled by controller
|
|
2663
2665
|
isHtmlContent = false, content, isOpen, setIsOpen, }) => {
|
|
2664
2666
|
const tooltipRef = require$$0.createRef();
|
|
@@ -2763,6 +2765,7 @@
|
|
|
2763
2765
|
elementReference,
|
|
2764
2766
|
tooltipReference: tooltipRef.current,
|
|
2765
2767
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2768
|
+
strategy: positionStrategy,
|
|
2766
2769
|
}).then((computedStylesData) => {
|
|
2767
2770
|
if (Object.keys(computedStylesData.tooltipStyles).length) {
|
|
2768
2771
|
setInlineStyles(computedStylesData.tooltipStyles);
|
|
@@ -2778,7 +2781,8 @@
|
|
|
2778
2781
|
}, [show, isOpen, anchorId]);
|
|
2779
2782
|
return (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames(styles['tooltip'], styles[variant], className, {
|
|
2780
2783
|
[styles['show']]: isOpen || show,
|
|
2781
|
-
|
|
2784
|
+
[styles['fixed']]: positionStrategy === 'fixed',
|
|
2785
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [children || (isHtmlContent ? jsxRuntime.exports.jsx(TooltipContent, { content: content }) : content), jsxRuntime.exports.jsx("div", { className: classNames(styles['arrow'], classNameArrow), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
|
|
2782
2786
|
};
|
|
2783
2787
|
|
|
2784
2788
|
const dataAttributesKeys = [
|
|
@@ -2793,7 +2797,7 @@
|
|
|
2793
2797
|
'delay-hide', // delay to hide tooltip
|
|
2794
2798
|
];
|
|
2795
2799
|
|
|
2796
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], delayShow = 0, delayHide = 0, getContent, isOpen, setIsOpen, }) => {
|
|
2800
|
+
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, style, getContent, isOpen, setIsOpen, }) => {
|
|
2797
2801
|
const [tooltipContent, setTooltipContent] = require$$0.useState(content || html);
|
|
2798
2802
|
const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
|
|
2799
2803
|
const [tooltipVariant, setTooltipVariant] = require$$0.useState(variant);
|
|
@@ -2802,6 +2806,7 @@
|
|
|
2802
2806
|
const [tooltipDelayHide, setTooltipDelayHide] = require$$0.useState(delayHide);
|
|
2803
2807
|
const [tooltipWrapper, setTooltipWrapper] = require$$0.useState(wrapper);
|
|
2804
2808
|
const [tooltipEvents, setTooltipEvents] = require$$0.useState(events);
|
|
2809
|
+
const [tooltipPositionStrategy, setTooltipPositionStrategy] = require$$0.useState(positionStrategy);
|
|
2805
2810
|
const [isHtmlContent, setIsHtmlContent] = require$$0.useState(Boolean(html));
|
|
2806
2811
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
2807
2812
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
@@ -2850,6 +2855,9 @@
|
|
|
2850
2855
|
const parsedEvents = value.split(' ');
|
|
2851
2856
|
setTooltipEvents(parsedEvents);
|
|
2852
2857
|
},
|
|
2858
|
+
positionStrategy: (value) => {
|
|
2859
|
+
setTooltipPositionStrategy(value);
|
|
2860
|
+
},
|
|
2853
2861
|
'delay-show': (value) => {
|
|
2854
2862
|
setTooltipDelayShow(Number(value));
|
|
2855
2863
|
},
|
|
@@ -2918,8 +2926,10 @@
|
|
|
2918
2926
|
offset: tooltipOffset,
|
|
2919
2927
|
wrapper: tooltipWrapper,
|
|
2920
2928
|
events: tooltipEvents,
|
|
2929
|
+
positionStrategy: tooltipPositionStrategy,
|
|
2921
2930
|
delayShow: tooltipDelayShow,
|
|
2922
2931
|
delayHide: tooltipDelayHide,
|
|
2932
|
+
style,
|
|
2923
2933
|
isOpen,
|
|
2924
2934
|
setIsOpen,
|
|
2925
2935
|
};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&e.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){e.push(o.toString());continue}for(var l in o)t.call(o,l)&&o[l]&&e.push(l)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(a);var l=a.exports;const s=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},c=({content:e})=>o.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function u(e){return e.split("-")[0]}function f(e){return e.split("-")[1]}function p(e){return["top","bottom"].includes(u(e))?"x":"y"}function d(e){return"y"===e?"height":"width"}function y(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=p(t),s=d(l),c=r[s]/2-o[s]/2,y="x"===l;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:a};break;case"left":m={x:r.x-o.width,y:a};break;default:m={x:r.x,y:r.y}}switch(f(t)){case"start":m[l]-=c*(n&&y?-1:1);break;case"end":m[l]+=c*(n&&y?-1:1)}return m}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 h(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function g(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=m(d),g=l[p?"floating"===f?"reference":"floating":f],v=h(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(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b=h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:v.top-b.top+y.top,bottom:b.bottom-v.bottom+y.bottom,left:v.left-b.left+y.left,right:b.right-v.right+y.right}}const v=Math.min,b=Math.max;function w(e,t,n){return b(e,v(t,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function S(e){return e.replace(/left|right|bottom|top/g,(e=>x[e]))}const _={start:"end",end:"start"};function R(e){return e.replace(/start|end/g,(e=>_[e]))}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:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:y=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",flipAlignment:v=!0,...b}=e,w=u(r),x=m||(w===a||!v?[S(a)]:function(e){const t=S(e);return[R(e),t,R(t)]}(a)),_=[a,...x],k=await g(t,b),T=[];let j=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&T.push(k[w]),y){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=f(e),o=p(e),i=d(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=S(a)),{main:a,cross:S(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));T.push(k[e],k[t])}if(j=[...j,{placement:r,overflows:T}],!T.every((e=>e<=0))){var O,E;const e=(null!=(O=null==(E=o.flip)?void 0:E.index)?O:0)+1,t=_[e];if(t)return{data:{index:e,overflows:j},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var P;const e=null==(P=j.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const T=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)),a=u(n),l=f(n),s="x"===p(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-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 l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*d,y:m*c}:{x:m*c,y:h*d}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function j(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function O(e){if(null==e)return window;if(!j(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function E(e){return O(e).getComputedStyle(e)}function P(e){return j(e)?"":e?(e.nodeName||"").toLowerCase():""}function A(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function N(e){return e instanceof O(e).HTMLElement}function L(e){return e instanceof O(e).Element}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof O(e).ShadowRoot||e instanceof ShadowRoot}function $(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function D(e){return["table","td","th"].includes(P(e))}function F(e){const t=/firefox/i.test(A()),n=E(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 I(){return!/^((?!chrome|android).)*safari/i.test(A())}function W(e){return["html","body","#document"].includes(P(e))}const H=Math.min,M=Math.max,U=Math.round;function B(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&N(e)&&(s=e.offsetWidth>0&&U(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&U(l.height)/e.offsetHeight||1);const u=L(e)?O(e):window,f=!I()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function V(e){return(t=e,(t instanceof O(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function q(e){return L(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function z(e){return B(V(e)).left+q(e).scrollLeft}function Y(e,t,n){const r=N(t),o=V(t),i=B(e,r&&function(e){const t=B(e);return U(t.width)!==e.offsetWidth||U(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==P(t)||$(o))&&(a=q(t)),N(t)){const e=B(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=z(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function X(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||(C(e)?e.host:null)||V(e);return C(t)?t.host:t}function J(e){return N(e)&&"fixed"!==E(e).position?e.offsetParent:null}function K(e){const t=O(e);let n=J(e);for(;n&&D(n)&&"static"===E(n).position;)n=J(n);return n&&("html"===P(n)||"body"===P(n)&&"static"===E(n).position&&!F(n))?t:n||function(e){let t=X(e);for(;N(t)&&!W(t);){if(F(t))return t;t=X(t)}return null}(e)||t}function Z(e){if(N(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=B(e);return{width:t.width,height:t.height}}function G(e){const t=X(e);return W(t)?e.ownerDocument.body:N(t)&&$(t)?t:G(t)}function Q(e,t){var n;void 0===t&&(t=[]);const r=G(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=O(r),a=o?[i].concat(i.visualViewport||[],$(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(Q(a))}function ee(e,t,n){return"viewport"===t?h(function(e,t){const n=O(e),r=V(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=I();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):L(t)?function(e,t){const n=B(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):h(function(e){var t;const n=V(e),r=q(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=M(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=M(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+z(e);const s=-r.scrollTop;return"rtl"===E(o||n).direction&&(l+=M(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(V(e)))}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=Q(e).filter((e=>L(e)&&"body"!==P(e))),n=e,r=null;for(;L(n)&&!W(n);){const e=E(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!F(n)?t=t.filter((e=>e!==n)):r=e,n=X(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=ee(t,n,o);return e.top=M(r.top,e.top),e.right=H(r.right,e.right),e.bottom=H(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),ee(t,l,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=N(n),i=V(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==P(n)||$(i))&&(a=q(n)),N(n))){const e=B(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:L,getDimensions:Z,getOffsetParent:K,getDocumentElement:V,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Y(t,K(n),r),floating:{...Z(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===E(e).direction},ne=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=y(c,r,s),p=r,d={},m=0;for(let n=0;n<l.length;n++){const{name:i,fn:h}=l[n],{x:g,y:v,data:b,reset:w}=await h({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=y(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:te,...n}),re=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const i=[T(Number(o)),k(),(a={padding:5},void 0===a&&(a={}),{name:"shift",options:a,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=a,c={x:t,y:n},f=await g(e,s),d=p(u(r)),y="x"===d?"y":"x";let m=c[d],h=c[y];if(o){const e="y"===d?"bottom":"right";m=w(m+f["y"===d?"top":"left"],m,m-f[e])}if(i){const e="y"===y?"bottom":"right";h=w(h+f["y"===y?"top":"left"],h,h-f[e])}const v=l.fn({...e,[d]:m,[y]:h});return{...v,data:{x:v.x-t,y:v.y-n}}}})];var a;return n?(i.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=m(r),u={x:o,y:i},y=p(a),h=f(a),g=d(y),v=await s.getDimensions(n),b="y"===y?"top":"left",x="y"===y?"bottom":"right",S=l.reference[g]+l.reference[y]-u[y]-l.floating[g],_=u[y]-l.reference[y],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===y?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[g]);const T=S/2-_/2,j=c[b],O=k-v[g]-c[x],E=k/2-v[g]/2+T,P=w(j,E,O),A=("start"===h?c[b]:c[x])>0&&E!==P&&l.reference[g]<=l.floating[g];return{[y]:u[y]-(A?E<j?j-E:O-E:0),data:{[y]:P,centerOffset:E-P}}}}))({element:n})),ne(e,t,{placement:r,middleware:i}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ne(e,t,{placement:"bottom",middleware:i}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var oe={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",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 ie=({id:e=t.useId(),className:n,classNameArrow:r,variant:i="dark",anchorId:a,place:u="top",offset:f=10,events:p=["hover"],wrapper:d="div",children:y=null,delayShow:m=0,delayHide:h=0,isHtmlContent:g=!1,content:v,isOpen:b,setIsOpen:w})=>{const x=t.createRef(),S=t.createRef(),_=t.useRef(),R=t.useRef(),[k,T]=t.useState({}),[j,O]=t.useState({}),[E,P]=t.useState(!1),A=e=>{w?w(e):void 0===b&&P(e)},N=()=>{w?w(!b):void 0===b&&P((e=>!e))},L=s((()=>{m?(_.current&&clearTimeout(_.current),_.current=setTimeout((()=>{A(!0)}),m)):A(!0),R.current&&clearTimeout(R.current)}),50),C=s((()=>{h?(R.current&&clearTimeout(R.current),R.current=setTimeout((()=>{A(!1)}),h)):A(!1),E&&_.current?clearTimeout(_.current):!E&&_.current&&(R.current=setTimeout((()=>{A(!1)}),2*m))}),50);return t.useEffect((()=>{const e=document.querySelector(`#${a}`);if(!e)return()=>{};const t=[];return p.find((e=>"click"===e))&&t.push({event:"click",listener:N}),p.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:L},{event:"mouseleave",listener:C},{event:"focus",listener:L},{event:"blur",listener:C}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[a,p,h,m]),t.useEffect((()=>{const e=document.querySelector(`#${a}`);return re({place:u,offset:f,elementReference:e,tooltipReference:x.current,tooltipArrowReference:S.current}).then((e=>{Object.keys(e.tooltipStyles).length&&T(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&O(e.tooltipArrowStyles)})),()=>{_.current=void 0,R.current=void 0}}),[E,b,a]),o.exports.jsxs(d,{id:e,role:"tooltip",className:l(oe.tooltip,oe[i],n,{[oe.show]:b||E}),style:k,ref:x,children:[y||(g?o.exports.jsx(c,{content:v}):v),o.exports.jsx("div",{className:l(oe.arrow,r),style:j,ref:S})]})},ae=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"];e.Tooltip=({id:e,anchorId:n,content:r,html:i,className:a,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],delayShow:y=0,delayHide:m=0,getContent:h,isOpen:g,setIsOpen:v})=>{const[b,w]=t.useState(r||i),[x,S]=t.useState(c),[_,R]=t.useState(s),[k,T]=t.useState(u),[j,O]=t.useState(y),[E,P]=t.useState(m),[A,N]=t.useState(f),[L,C]=t.useState(d),[$,D]=t.useState(Boolean(i)),F=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{S(e)},content:e=>{D(!0),w(h?h(e):e)},html:e=>{D(!0),w(h?h(e):e)},variant:e=>{R(e)},offset:e=>{T(e)},wrapper:e=>{N(e)},events:e=>{const t=e.split(" ");C(t)},"delay-show":e=>{O(Number(e))},"delay-hide":e=>{P(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ae.includes(n)&&r[n](e[t])}))};t.useEffect((()=>{if(!n)return()=>{};const e=document.querySelector(`#${n}`);if(!e)return()=>{};r&&h&&w(h(r));const t=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});F(n)}}))}));t.observe(e,{attributes:!0,childList:!1,subtree:!1});const o=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return F(o),()=>{t.disconnect()}}),[n]);const I={id:e,anchorId:n,className:a,classNameArrow:l,content:b,isHtmlContent:$,place:x,variant:_,offset:k,wrapper:A,events:L,delayShow:j,delayHide:E,isOpen:g,setIsOpen:v};return p?o.exports.jsx(ie,{...I,children:p}):o.exports.jsx(ie,{...I})},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
6
|
+
*/!function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&e.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){e.push(o.toString());continue}for(var l in o)t.call(o,l)&&o[l]&&e.push(l)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(a);var l=a.exports;const s=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)};clearTimeout(r),r=setTimeout(a,t)}},c=({content:e})=>o.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function u(e){return e.split("-")[0]}function f(e){return e.split("-")[1]}function p(e){return["top","bottom"].includes(u(e))?"x":"y"}function d(e){return"y"===e?"height":"width"}function y(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=p(t),s=d(l),c=r[s]/2-o[s]/2,y="x"===l;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:a};break;case"left":m={x:r.x-o.width,y:a};break;default:m={x:r.x,y:r.y}}switch(f(t)){case"start":m[l]-=c*(n&&y?-1:1);break;case"end":m[l]+=c*(n&&y?-1:1)}return m}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 h(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function g(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=m(d),g=l[p?"floating"===f?"reference":"floating":f],v=h(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(l.floating)),boundary:c,rootBoundary:u,strategy:s})),b=h(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:v.top-b.top+y.top,bottom:b.bottom-v.bottom+y.bottom,left:v.left-b.left+y.left,right:b.right-v.right+y.right}}const v=Math.min,b=Math.max;function w(e,t,n){return b(e,v(t,n))}const x={left:"right",right:"left",bottom:"top",top:"bottom"};function S(e){return e.replace(/left|right|bottom|top/g,(e=>x[e]))}const _={start:"end",end:"start"};function R(e){return e.replace(/start|end/g,(e=>_[e]))}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:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:y=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",flipAlignment:v=!0,...b}=e,w=u(r),x=m||(w===a||!v?[S(a)]:function(e){const t=S(e);return[R(e),t,R(t)]}(a)),_=[a,...x],k=await g(t,b),T=[];let j=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&T.push(k[w]),y){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=f(e),o=p(e),i=d(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=S(a)),{main:a,cross:S(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));T.push(k[e],k[t])}if(j=[...j,{placement:r,overflows:T}],!T.every((e=>e<=0))){var O,E;const e=(null!=(O=null==(E=o.flip)?void 0:E.index)?O:0)+1,t=_[e];if(t)return{data:{index:e,overflows:j},reset:{placement:t}};let n="bottom";switch(h){case"bestFit":{var P;const e=null==(P=j.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const T=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)),a=u(n),l=f(n),s="x"===p(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-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 l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*d,y:m*c}:{x:m*c,y:h*d}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function j(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function O(e){if(null==e)return window;if(!j(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function E(e){return O(e).getComputedStyle(e)}function P(e){return j(e)?"":e?(e.nodeName||"").toLowerCase():""}function A(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function N(e){return e instanceof O(e).HTMLElement}function L(e){return e instanceof O(e).Element}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof O(e).ShadowRoot||e instanceof ShadowRoot}function $(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=E(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function D(e){return["table","td","th"].includes(P(e))}function F(e){const t=/firefox/i.test(A()),n=E(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 I(){return!/^((?!chrome|android).)*safari/i.test(A())}function W(e){return["html","body","#document"].includes(P(e))}const H=Math.min,M=Math.max,U=Math.round;function B(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&N(e)&&(s=e.offsetWidth>0&&U(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&U(l.height)/e.offsetHeight||1);const u=L(e)?O(e):window,f=!I()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function V(e){return(t=e,(t instanceof O(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function q(e){return L(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function z(e){return B(V(e)).left+q(e).scrollLeft}function Y(e,t,n){const r=N(t),o=V(t),i=B(e,r&&function(e){const t=B(e);return U(t.width)!==e.offsetWidth||U(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==P(t)||$(o))&&(a=q(t)),N(t)){const e=B(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=z(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function X(e){if("html"===P(e))return e;const t=e.assignedSlot||e.parentNode||(C(e)?e.host:null)||V(e);return C(t)?t.host:t}function J(e){return N(e)&&"fixed"!==E(e).position?e.offsetParent:null}function K(e){const t=O(e);let n=J(e);for(;n&&D(n)&&"static"===E(n).position;)n=J(n);return n&&("html"===P(n)||"body"===P(n)&&"static"===E(n).position&&!F(n))?t:n||function(e){let t=X(e);for(;N(t)&&!W(t);){if(F(t))return t;t=X(t)}return null}(e)||t}function Z(e){if(N(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=B(e);return{width:t.width,height:t.height}}function G(e){const t=X(e);return W(t)?e.ownerDocument.body:N(t)&&$(t)?t:G(t)}function Q(e,t){var n;void 0===t&&(t=[]);const r=G(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=O(r),a=o?[i].concat(i.visualViewport||[],$(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(Q(a))}function ee(e,t,n){return"viewport"===t?h(function(e,t){const n=O(e),r=V(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=I();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):L(t)?function(e,t){const n=B(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):h(function(e){var t;const n=V(e),r=q(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=M(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=M(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+z(e);const s=-r.scrollTop;return"rtl"===E(o||n).direction&&(l+=M(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(V(e)))}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=Q(e).filter((e=>L(e)&&"body"!==P(e))),n=e,r=null;for(;L(n)&&!W(n);){const e=E(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!F(n)?t=t.filter((e=>e!==n)):r=e,n=X(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=ee(t,n,o);return e.top=M(r.top,e.top),e.right=H(r.right,e.right),e.bottom=H(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),ee(t,l,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=N(n),i=V(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==P(n)||$(i))&&(a=q(n)),N(n))){const e=B(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:L,getDimensions:Z,getOffsetParent:K,getDocumentElement:V,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:Y(t,K(n),r),floating:{...Z(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===E(e).direction},ne=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&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(" ")),l.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 a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=y(c,r,s),p=r,d={},m=0;for(let n=0;n<l.length;n++){const{name:i,fn:h}=l[n],{x:g,y:v,data:b,reset:w}=await h({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},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(" ")),w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=y(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:te,...n}),re=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute"})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const a=[T(Number(o)),k(),(l={padding:5},void 0===l&&(l={}),{name:"shift",options:l,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=l,c={x:t,y:n},f=await g(e,s),d=p(u(r)),y="x"===d?"y":"x";let m=c[d],h=c[y];if(o){const e="y"===d?"bottom":"right";m=w(m+f["y"===d?"top":"left"],m,m-f[e])}if(i){const e="y"===y?"bottom":"right";h=w(h+f["y"===y?"top":"left"],h,h-f[e])}const v=a.fn({...e,[d]:m,[y]:h});return{...v,data:{x:v.x-t,y:v.y-n}}}})];var l;return n?(a.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=m(r),u={x:o,y:i},y=p(a),h=f(a),g=d(y),v=await s.getDimensions(n),b="y"===y?"top":"left",x="y"===y?"bottom":"right",S=l.reference[g]+l.reference[y]-u[y]-l.floating[g],_=u[y]-l.reference[y],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===y?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[g]);const T=S/2-_/2,j=c[b],O=k-v[g]-c[x],E=k/2-v[g]/2+T,P=w(j,E,O),A=("start"===h?c[b]:c[x])>0&&E!==P&&l.reference[g]<=l.floating[g];return{[y]:u[y]-(A?E<j?j-E:O-E:0),data:{[y]:P,centerOffset:E-P}}}}))({element:n})),ne(e,t,{placement:r,strategy:i,middleware:a}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ne(e,t,{placement:"bottom",strategy:i,middleware:a}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var oe={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T",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 ie=({id:e=t.useId(),className:n,classNameArrow:r,variant:i="dark",anchorId:a,place:u="top",offset:f=10,events:p=["hover"],positionStrategy:d="absolute",wrapper:y="div",children:m=null,delayShow:h=0,delayHide:g=0,style:v,isHtmlContent:b=!1,content:w,isOpen:x,setIsOpen:S})=>{const _=t.createRef(),R=t.createRef(),k=t.useRef(),T=t.useRef(),[j,O]=t.useState({}),[E,P]=t.useState({}),[A,N]=t.useState(!1),L=e=>{S?S(e):void 0===x&&N(e)},C=()=>{S?S(!x):void 0===x&&N((e=>!e))},$=s((()=>{h?(k.current&&clearTimeout(k.current),k.current=setTimeout((()=>{L(!0)}),h)):L(!0),T.current&&clearTimeout(T.current)}),50),D=s((()=>{g?(T.current&&clearTimeout(T.current),T.current=setTimeout((()=>{L(!1)}),g)):L(!1),A&&k.current?clearTimeout(k.current):!A&&k.current&&(T.current=setTimeout((()=>{L(!1)}),2*h))}),50);return t.useEffect((()=>{const e=document.querySelector(`#${a}`);if(!e)return()=>{};const t=[];return p.find((e=>"click"===e))&&t.push({event:"click",listener:C}),p.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:$},{event:"mouseleave",listener:D},{event:"focus",listener:$},{event:"blur",listener:D}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[a,p,g,h]),t.useEffect((()=>{const e=document.querySelector(`#${a}`);return re({place:u,offset:f,elementReference:e,tooltipReference:_.current,tooltipArrowReference:R.current,strategy:d}).then((e=>{Object.keys(e.tooltipStyles).length&&O(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&P(e.tooltipArrowStyles)})),()=>{k.current=void 0,T.current=void 0}}),[A,x,a]),o.exports.jsxs(y,{id:e,role:"tooltip",className:l(oe.tooltip,oe[i],n,{[oe.show]:x||A,[oe.fixed]:"fixed"===d}),style:{...v,...j},ref:_,children:[m||(b?o.exports.jsx(c,{content:w}):w),o.exports.jsx("div",{className:l(oe.arrow,r),style:E,ref:R})]})},ae=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"];e.Tooltip=({id:e,anchorId:n,content:r,html:i,className:a,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],positionStrategy:y="absolute",delayShow:m=0,delayHide:h=0,style:g,getContent:v,isOpen:b,setIsOpen:w})=>{const[x,S]=t.useState(r||i),[_,R]=t.useState(c),[k,T]=t.useState(s),[j,O]=t.useState(u),[E,P]=t.useState(m),[A,N]=t.useState(h),[L,C]=t.useState(f),[$,D]=t.useState(d),[F,I]=t.useState(y),[W,H]=t.useState(Boolean(i)),M=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{R(e)},content:e=>{H(!0),S(v?v(e):e)},html:e=>{H(!0),S(v?v(e):e)},variant:e=>{T(e)},offset:e=>{O(e)},wrapper:e=>{C(e)},events:e=>{const t=e.split(" ");D(t)},positionStrategy:e=>{I(e)},"delay-show":e=>{P(Number(e))},"delay-hide":e=>{N(Number(e))}};t.forEach((t=>{n=t.replace("data-tooltip-",""),ae.includes(n)&&r[n](e[t])}))};t.useEffect((()=>{if(!n)return()=>{};const e=document.querySelector(`#${n}`);if(!e)return()=>{};r&&v&&S(v(r));const t=new MutationObserver((t=>{t.forEach((t=>{if("attributes"===t.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:e,attributeName:t.attributeName});M(n)}}))}));t.observe(e,{attributes:!0,childList:!1,subtree:!1});const o=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-tooltip-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(e);return M(o),()=>{t.disconnect()}}),[n]);const U={id:e,anchorId:n,className:a,classNameArrow:l,content:x,isHtmlContent:W,place:_,variant:k,offset:j,wrapper:L,events:$,positionStrategy:F,delayShow:E,delayHide:A,style:g,isOpen:b,setIsOpen:w};return p?o.exports.jsx(ie,{...U,children:p}):o.exports.jsx(ie,{...U})},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-tooltip",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.1.0-beta.1",
|
|
4
4
|
"description": "react tooltip component",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "node ./cli.js --env=development && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.dev.js --watch",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
86
86
|
"rollup-plugin-browsersync": "^1.3.3",
|
|
87
87
|
"rollup-plugin-copy": "^3.4.0",
|
|
88
|
-
"rollup-plugin-dts": "
|
|
88
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
89
89
|
"rollup-plugin-filesize": "^9.1.1",
|
|
90
90
|
"rollup-plugin-html-scaffold": "^0.2.0",
|
|
91
91
|
"rollup-plugin-postcss": "^4.0.1",
|
package/rollup.config.types.js
CHANGED
|
@@ -6,12 +6,16 @@ export default {
|
|
|
6
6
|
output: [{ file: 'dist/react-tooltip.d.ts', format: 'es' }],
|
|
7
7
|
plugins: [
|
|
8
8
|
postcss({
|
|
9
|
-
extract: 'react-tooltip-tokens.css', // this will generate a specific file
|
|
9
|
+
extract: 'react-tooltip-tokens.css', // this will generate a specific file not being used, but we need this part of code
|
|
10
10
|
autoModules: true,
|
|
11
11
|
include: '**/*.css',
|
|
12
12
|
extensions: ['.css'],
|
|
13
13
|
plugins: [],
|
|
14
14
|
}),
|
|
15
|
-
dts(
|
|
15
|
+
dts({
|
|
16
|
+
compilerOptions: {
|
|
17
|
+
baseUrl: 'src',
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
16
20
|
],
|
|
17
21
|
}
|