react-tooltip 5.7.5 → 5.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -19
- package/dist/react-tooltip.cjs.js +129 -35
- package/dist/react-tooltip.cjs.min.js +3 -3
- package/dist/react-tooltip.d.ts +19 -1
- package/dist/react-tooltip.esm.js +130 -36
- package/dist/react-tooltip.esm.min.js +3 -3
- package/dist/react-tooltip.umd.js +129 -35
- package/dist/react-tooltip.umd.min.js +3 -3
- package/package.json +10 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function r(e){return e.split("-")[1]}function o(e){return"y"===e?"height":"width"}function i(e){return e.split("-")[0]}function l(e){return["top","bottom"].includes(i(e))?"x":"y"}function a(e,t,n){let{reference:a,floating:s}=e;const c=a.x+a.width/2-s.width/2,u=a.y+a.height/2-s.height/2,f=l(t),p=o(f),d=a[p]/2-s[p]/2,y="x"===f;let m;switch(i(t)){case"top":m={x:c,y:a.y-s.height};break;case"bottom":m={x:c,y:a.y+a.height};break;case"right":m={x:a.x+a.width,y:u};break;case"left":m={x:a.x-s.width,y:u};break;default:m={x:a.x,y:a.y}}switch(r(t)){case"start":m[f]-=d*(n&&y?-1:1);break;case"end":m[f]+=d*(n&&y?-1:1)}return m}function s(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 c(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function u(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:y=!1,padding:m=0}=t,h=s(m),g=a[y?"floating"===d?"reference":"floating":d],v=c(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:p,strategy:u})),w="floating"===d?{...l.floating,x:r,y:o}:l.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),x=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},R=c(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:b,strategy:u}):w);return{top:(v.top-R.top+h.top)/x.y,bottom:(R.bottom-v.bottom+h.bottom)/x.y,left:(v.left-R.left+h.left)/x.x,right:(R.right-v.right+h.right)/x.x}}const f=Math.min,p=Math.max;function d(e,t,n){return p(e,f(t,n))}const y=["top","right","bottom","left"].reduce(((e,t)=>e.concat(t,t+"-start",t+"-end")),[]),m={left:"right",right:"left",bottom:"top",top:"bottom"};function h(e){return e.replace(/left|right|bottom|top/g,(e=>m[e]))}function g(e,t,n){void 0===n&&(n=!1);const i=r(e),a=l(e),s=o(a);let c="x"===a?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=h(c)),{main:c,cross:h(c)}}const v={start:"end",end:"start"};function w(e){return e.replace(/start|end/g,(e=>v[e]))}const b=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:o,middlewareData:l,rects:a,initialPlacement:s,platform:c,elements:f}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:y,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=e,R=i(o),_=i(s)===s,S=await(null==c.isRTL?void 0:c.isRTL(f.floating)),T=y||(_||!b?[h(s)]:function(e){const t=h(e);return[w(e),t,w(t)]}(s));y||"none"===v||T.push(...function(e,t,n,o){const l=r(e);let a=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(i(e),"start"===n,o);return l&&(a=a.map((e=>e+"-"+l)),t&&(a=a.concat(a.map(w)))),a}(s,b,v,S));const O=[s,...T],k=await u(t,x),E=[];let A=(null==(n=l.flip)?void 0:n.overflows)||[];if(p&&E.push(k[R]),d){const{main:e,cross:t}=g(o,a,S);E.push(k[e],k[t])}if(A=[...A,{placement:o,overflows:E}],!E.every((e=>e<=0))){var j,P;const e=((null==(j=l.flip)?void 0:j.index)||0)+1,t=O[e];if(t)return{data:{index:e,overflows:A},reset:{placement:t}};let n=null==(P=A.find((e=>e.overflows[0]<=0)))?void 0:P.placement;if(!n)switch(m){case"bestFit":{var L;const e=null==(L=A.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:L[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}};const x=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:o}=t,a=await async function(e,t){const{placement:n,platform:o,elements:a}=e,s=await(null==o.isRTL?void 0:o.isRTL(a.floating)),c=i(n),u=r(n),f="x"===l(n),p=["left","top"].includes(c)?-1:1,d=s&&f?-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 u&&"number"==typeof g&&(h="end"===u?-1*g:g),f?{x:h*d,y:m*p}:{x:m*p,y:h*d}}(t,e);return{x:n+a.x,y:o+a.y,data:a}}}};const R=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=e,p={x:n,y:r},y=await u(t,f),m=l(i(o)),h="x"===m?"y":"x";let g=p[m],v=p[h];if(a){const e="y"===m?"bottom":"right";g=d(g+y["y"===m?"top":"left"],g,g-y[e])}if(s){const e="y"===h?"bottom":"right";v=d(v+y["y"===h?"top":"left"],v,v-y[e])}const w=c.fn({...t,[m]:g,[h]:v});return{...w,data:{x:w.x-n,y:w.y-r}}}}};function _(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function S(e){return _(e).getComputedStyle(e)}const T=Math.min,O=Math.max,k=Math.round;function E(e){const t=S(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,l=k(n)!==o||k(r)!==i;return l&&(n=o,r=i),{width:n,height:r,fallback:l}}function A(e){return N(e)?(e.nodeName||"").toLowerCase():""}let j;function P(){if(j)return j;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(j=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),j):navigator.userAgent}function L(e){return e instanceof _(e).HTMLElement}function D(e){return e instanceof _(e).Element}function N(e){return e instanceof _(e).Node}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof _(e).ShadowRoot||e instanceof ShadowRoot}function F(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=S(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function I(e){return["table","td","th"].includes(A(e))}function $(e){const t=/firefox/i.test(P()),n=S(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 W(){return!/^((?!chrome|android).)*safari/i.test(P())}function B(e){return["html","body","#document"].includes(A(e))}function H(e){return D(e)?e:e.contextElement}const U={x:1,y:1};function M(e){const t=H(e);if(!L(t))return U;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=E(t);let l=(i?k(n.width):n.width)/r,a=(i?k(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}function V(e,t,n,r){var o,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect(),a=H(e);let s=U;t&&(r?D(r)&&(s=M(r)):s=M(e));const c=a?_(a):window,u=!W()&&n;let f=(l.left+(u&&(null==(o=c.visualViewport)?void 0:o.offsetLeft)||0))/s.x,p=(l.top+(u&&(null==(i=c.visualViewport)?void 0:i.offsetTop)||0))/s.y,d=l.width/s.x,y=l.height/s.y;if(a){const e=_(a),t=r&&D(r)?_(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=M(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.paddingTop))*e.y,f*=e.x,p*=e.y,d*=e.x,y*=e.y,f+=t.x,p+=t.y,n=_(n).frameElement}}return{width:d,height:y,top:p,right:f+d,bottom:p+y,left:f,x:f,y:p}}function z(e){return((N(e)?e.ownerDocument:e.document)||window.document).documentElement}function q(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Y(e){return V(z(e)).left+q(e).scrollLeft}function X(e){if("html"===A(e))return e;const t=e.assignedSlot||e.parentNode||C(e)&&e.host||z(e);return C(t)?t.host:t}function K(e){const t=X(e);return B(t)?t.ownerDocument.body:L(t)&&F(t)?t:K(t)}function J(e,t){var n;void 0===t&&(t=[]);const r=K(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=_(r);return o?t.concat(i,i.visualViewport||[],F(r)?r:[]):t.concat(r,J(r))}function Z(e,t,n){return"viewport"===t?c(function(e,t){const n=_(e),r=z(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=W();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n)):D(t)?c(function(e,t){const n=V(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=L(e)?M(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n)):c(function(e){const t=z(e),n=q(e),r=e.ownerDocument.body,o=O(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=O(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Y(e);const a=-n.scrollTop;return"rtl"===S(r).direction&&(l+=O(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(z(e)))}function G(e){return L(e)&&"fixed"!==S(e).position?e.offsetParent:null}function Q(e){const t=_(e);let n=G(e);for(;n&&I(n)&&"static"===S(n).position;)n=G(n);return n&&("html"===A(n)||"body"===A(n)&&"static"===S(n).position&&!$(n))?t:n||function(e){let t=X(e);for(;L(t)&&!B(t);){if($(t))return t;t=X(t)}return null}(e)||t}function ee(e,t,n){const r=L(t),o=z(t),i=V(e,!0,"fixed"===n,t);let l={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==A(t)||F(o))&&(l=q(t)),L(t)){const e=V(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=Y(o));return{x:i.left+l.scrollLeft-a.x,y:i.top+l.scrollTop-a.y,width:i.width,height:i.height}}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=J(e).filter((e=>D(e)&&"body"!==A(e))),o=null;const i="fixed"===S(e).position;let l=i?X(e):e;for(;D(l)&&!B(l);){const e=S(l),t=$(l);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==l)),l=X(l)}return t.set(e,r),r}(t,this._c):[].concat(n),l=[...i,r],a=l[0],s=l.reduce(((e,n)=>{const r=Z(t,n,o);return e.top=O(r.top,e.top),e.right=T(r.right,e.right),e.bottom=T(r.bottom,e.bottom),e.left=O(r.left,e.left),e}),Z(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=L(n),i=z(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},a={x:1,y:1};const s={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==A(n)||F(i))&&(l=q(n)),L(n))){const e=V(n);a=M(n),s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-l.scrollLeft*a.x+s.x,y:t.y*a.y-l.scrollTop*a.y+s.y}},isElement:D,getDimensions:function(e){return L(e)?E(e):e.getBoundingClientRect()},getOffsetParent:Q,getDocumentElement:z,getScale:M,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||Q,i=this.getDimensions;return{reference:ee(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===S(e).direction},ne=(e,t,n)=>{const r=new Map,o={platform:te,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));if(null==l&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),s.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 u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=a(u,r,c),d=r,y={},m=0;for(let n=0;n<s.length;n++){const{name:i,fn:h}=s[n],{x:g,y:v,data:w,reset:b}=await h({x:f,y:p,initialPlacement:r,placement:d,strategy:o,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});f=null!=g?g:f,p=null!=v?v:p,y={...y,[i]:{...y[i],...w}},m>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(u=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:p}=a(u,d,c))),n=-1)}return{x:f,y:p,placement:d,strategy:o,middlewareData:y}})(e,t,{...o,platform:i})};var re={exports:{}},oe={};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function r(e){return e.split("-")[1]}function o(e){return"y"===e?"height":"width"}function i(e){return e.split("-")[0]}function l(e){return["top","bottom"].includes(i(e))?"x":"y"}function a(e,t,n){let{reference:a,floating:s}=e;const c=a.x+a.width/2-s.width/2,u=a.y+a.height/2-s.height/2,f=l(t),p=o(f),d=a[p]/2-s[p]/2,y="x"===f;let m;switch(i(t)){case"top":m={x:c,y:a.y-s.height};break;case"bottom":m={x:c,y:a.y+a.height};break;case"right":m={x:a.x+a.width,y:u};break;case"left":m={x:a.x-s.width,y:u};break;default:m={x:a.x,y:a.y}}switch(r(t)){case"start":m[f]-=d*(n&&y?-1:1);break;case"end":m[f]+=d*(n&&y?-1:1)}return m}function s(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 c(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function u(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:y=!1,padding:m=0}=t,h=s(m),g=a[y?"floating"===d?"reference":"floating":d],v=c(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:f,rootBoundary:p,strategy:u})),w="floating"===d?{...l.floating,x:r,y:o}:l.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),x=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},R=c(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:b,strategy:u}):w);return{top:(v.top-R.top+h.top)/x.y,bottom:(R.bottom-v.bottom+h.bottom)/x.y,left:(v.left-R.left+h.left)/x.x,right:(R.right-v.right+h.right)/x.x}}const f=Math.min,p=Math.max;function d(e,t,n){return p(e,f(t,n))}const y=["top","right","bottom","left"].reduce(((e,t)=>e.concat(t,t+"-start",t+"-end")),[]),m={left:"right",right:"left",bottom:"top",top:"bottom"};function h(e){return e.replace(/left|right|bottom|top/g,(e=>m[e]))}function g(e,t,n){void 0===n&&(n=!1);const i=r(e),a=l(e),s=o(a);let c="x"===a?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=h(c)),{main:c,cross:h(c)}}const v={start:"end",end:"start"};function w(e){return e.replace(/start|end/g,(e=>v[e]))}const b=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:o,middlewareData:l,rects:a,initialPlacement:s,platform:c,elements:f}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:y,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=e,R=i(o),S=i(s)===s,_=await(null==c.isRTL?void 0:c.isRTL(f.floating)),T=y||(S||!b?[h(s)]:function(e){const t=h(e);return[w(e),t,w(t)]}(s));y||"none"===v||T.push(...function(e,t,n,o){const l=r(e);let a=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(i(e),"start"===n,o);return l&&(a=a.map((e=>e+"-"+l)),t&&(a=a.concat(a.map(w)))),a}(s,b,v,_));const O=[s,...T],E=await u(t,x),A=[];let k=(null==(n=l.flip)?void 0:n.overflows)||[];if(p&&A.push(E[R]),d){const{main:e,cross:t}=g(o,a,_);A.push(E[e],E[t])}if(k=[...k,{placement:o,overflows:A}],!A.every((e=>e<=0))){var j,P;const e=((null==(j=l.flip)?void 0:j.index)||0)+1,t=O[e];if(t)return{data:{index:e,overflows:k},reset:{placement:t}};let n=null==(P=k.find((e=>e.overflows[0]<=0)))?void 0:P.placement;if(!n)switch(m){case"bestFit":{var L;const e=null==(L=k.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:L[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}};const x=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:o}=t,a=await async function(e,t){const{placement:n,platform:o,elements:a}=e,s=await(null==o.isRTL?void 0:o.isRTL(a.floating)),c=i(n),u=r(n),f="x"===l(n),p=["left","top"].includes(c)?-1:1,d=s&&f?-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 u&&"number"==typeof g&&(h="end"===u?-1*g:g),f?{x:h*d,y:m*p}:{x:m*p,y:h*d}}(t,e);return{x:n+a.x,y:o+a.y,data:a}}}};const R=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=e,p={x:n,y:r},y=await u(t,f),m=l(i(o)),h="x"===m?"y":"x";let g=p[m],v=p[h];if(a){const e="y"===m?"bottom":"right";g=d(g+y["y"===m?"top":"left"],g,g-y[e])}if(s){const e="y"===h?"bottom":"right";v=d(v+y["y"===h?"top":"left"],v,v-y[e])}const w=c.fn({...t,[m]:g,[h]:v});return{...w,data:{x:w.x-n,y:w.y-r}}}}};function S(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function _(e){return S(e).getComputedStyle(e)}const T=Math.min,O=Math.max,E=Math.round;function A(e){const t=_(e);let n=parseFloat(t.width),r=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,l=E(n)!==o||E(r)!==i;return l&&(n=o,r=i),{width:n,height:r,fallback:l}}function k(e){return N(e)?(e.nodeName||"").toLowerCase():""}let j;function P(){if(j)return j;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(j=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),j):navigator.userAgent}function L(e){return e instanceof S(e).HTMLElement}function D(e){return e instanceof S(e).Element}function N(e){return e instanceof S(e).Node}function C(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof S(e).ShadowRoot||e instanceof ShadowRoot}function F(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=_(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function $(e){return["table","td","th"].includes(k(e))}function I(e){const t=/firefox/i.test(P()),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 W(){return!/^((?!chrome|android).)*safari/i.test(P())}function H(e){return["html","body","#document"].includes(k(e))}function U(e){return D(e)?e:e.contextElement}const B={x:1,y:1};function M(e){const t=U(e);if(!L(t))return B;const n=t.getBoundingClientRect(),{width:r,height:o,fallback:i}=A(t);let l=(i?E(n.width):n.width)/r,a=(i?E(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}function V(e,t,n,r){var o,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect(),a=U(e);let s=B;t&&(r?D(r)&&(s=M(r)):s=M(e));const c=a?S(a):window,u=!W()&&n;let f=(l.left+(u&&(null==(o=c.visualViewport)?void 0:o.offsetLeft)||0))/s.x,p=(l.top+(u&&(null==(i=c.visualViewport)?void 0:i.offsetTop)||0))/s.y,d=l.width/s.x,y=l.height/s.y;if(a){const e=S(a),t=r&&D(r)?S(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=M(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.paddingTop))*e.y,f*=e.x,p*=e.y,d*=e.x,y*=e.y,f+=t.x,p+=t.y,n=S(n).frameElement}}return{width:d,height:y,top:p,right:f+d,bottom:p+y,left:f,x:f,y:p}}function q(e){return((N(e)?e.ownerDocument:e.document)||window.document).documentElement}function z(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Y(e){return V(q(e)).left+z(e).scrollLeft}function X(e){if("html"===k(e))return e;const t=e.assignedSlot||e.parentNode||C(e)&&e.host||q(e);return C(t)?t.host:t}function K(e){const t=X(e);return H(t)?t.ownerDocument.body:L(t)&&F(t)?t:K(t)}function J(e,t){var n;void 0===t&&(t=[]);const r=K(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=S(r);return o?t.concat(i,i.visualViewport||[],F(r)?r:[]):t.concat(r,J(r))}function Z(e,t,n){return"viewport"===t?c(function(e,t){const n=S(e),r=q(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=W();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n)):D(t)?c(function(e,t){const n=V(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=L(e)?M(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n)):c(function(e){const t=q(e),n=z(e),r=e.ownerDocument.body,o=O(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=O(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Y(e);const a=-n.scrollTop;return"rtl"===_(r).direction&&(l+=O(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(q(e)))}function G(e){return L(e)&&"fixed"!==_(e).position?e.offsetParent:null}function Q(e){const t=S(e);let n=G(e);for(;n&&$(n)&&"static"===_(n).position;)n=G(n);return n&&("html"===k(n)||"body"===k(n)&&"static"===_(n).position&&!I(n))?t:n||function(e){let t=X(e);for(;L(t)&&!H(t);){if(I(t))return t;t=X(t)}return null}(e)||t}function ee(e,t,n){const r=L(t),o=q(t),i=V(e,!0,"fixed"===n,t);let l={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==k(t)||F(o))&&(l=z(t)),L(t)){const e=V(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=Y(o));return{x:i.left+l.scrollLeft-a.x,y:i.top+l.scrollTop-a.y,width:i.width,height:i.height}}const te={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=J(e).filter((e=>D(e)&&"body"!==k(e))),o=null;const i="fixed"===_(e).position;let l=i?X(e):e;for(;D(l)&&!H(l);){const e=_(l),t=I(l);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==l)),l=X(l)}return t.set(e,r),r}(t,this._c):[].concat(n),l=[...i,r],a=l[0],s=l.reduce(((e,n)=>{const r=Z(t,n,o);return e.top=O(r.top,e.top),e.right=T(r.right,e.right),e.bottom=T(r.bottom,e.bottom),e.left=O(r.left,e.left),e}),Z(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=L(n),i=q(n);if(n===i)return t;let l={scrollLeft:0,scrollTop:0},a={x:1,y:1};const s={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==k(n)||F(i))&&(l=z(n)),L(n))){const e=V(n);a=M(n),s.x=e.x+n.clientLeft,s.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-l.scrollLeft*a.x+s.x,y:t.y*a.y-l.scrollTop*a.y+s.y}},isElement:D,getDimensions:function(e){return L(e)?A(e):e.getBoundingClientRect()},getOffsetParent:Q,getDocumentElement:q,getScale:M,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||Q,i=this.getDimensions;return{reference:ee(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===_(e).direction},ne=(e,t,n)=>{const r=new Map,o={platform:te,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));if(null==l&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),s.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 u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=a(u,r,c),d=r,y={},m=0;for(let n=0;n<s.length;n++){const{name:i,fn:h}=s[n],{x:g,y:v,data:w,reset:b}=await h({x:f,y:p,initialPlacement:r,placement:d,strategy:o,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});f=null!=g?g:f,p=null!=v?v:p,y={...y,[i]:{...y[i],...w}},m>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(u=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:f,y:p}=a(u,d,c))),n=-1)}return{x:f,y:p,placement:d,strategy:o,middlewareData:y}})(e,t,{...o,platform:i})};var re={exports:{}},oe={};
|
|
2
2
|
/** @license React v16.14.0
|
|
3
3
|
* react-jsx-runtime.development.js
|
|
4
4
|
*
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
!function(e){!function(){var t=n.default,r=60103,o=60106;e.Fragment=60107;var i=60108,l=60114,a=60109,s=60110,c=60112,u=60113,f=60120,p=60115,d=60116,y=60121,m=60122,h=60117,g=60129,v=60131;if("function"==typeof Symbol&&Symbol.for){var w=Symbol.for;r=w("react.element"),o=w("react.portal"),e.Fragment=w("react.fragment"),i=w("react.strict_mode"),l=w("react.profiler"),a=w("react.provider"),s=w("react.context"),c=w("react.forward_ref"),u=w("react.suspense"),f=w("react.suspense_list"),p=w("react.memo"),d=w("react.lazy"),y=w("react.block"),m=w("react.server.block"),h=w("react.fundamental"),w("react.scope"),w("react.opaque.id"),g=w("react.debug_trace_mode"),w("react.offscreen"),v=w("react.legacy_hidden")}var b="function"==typeof Symbol&&Symbol.iterator;var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];
|
|
10
|
+
!function(e){!function(){var t=n.default,r=60103,o=60106;e.Fragment=60107;var i=60108,l=60114,a=60109,s=60110,c=60112,u=60113,f=60120,p=60115,d=60116,y=60121,m=60122,h=60117,g=60129,v=60131;if("function"==typeof Symbol&&Symbol.for){var w=Symbol.for;r=w("react.element"),o=w("react.portal"),e.Fragment=w("react.fragment"),i=w("react.strict_mode"),l=w("react.profiler"),a=w("react.provider"),s=w("react.context"),c=w("react.forward_ref"),u=w("react.suspense"),f=w("react.suspense_list"),p=w("react.memo"),d=w("react.lazy"),y=w("react.block"),m=w("react.server.block"),h=w("react.fundamental"),w("react.scope"),w("react.opaque.id"),g=w("react.debug_trace_mode"),w("react.offscreen"),v=w("react.legacy_hidden")}var b="function"==typeof Symbol&&Symbol.iterator;var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];S("error",e,n)}function S(e,t,n){var r=x.ReactDebugCurrentFrame,o="";if(E){var i=T(E.type),l=E._owner;o+=function(e,t,n){var r="";if(t){var o=t.fileName,i=o.replace(_,"");if(/^index\./.test(i)){var l=o.match(_);if(l){var a=l[1];if(a)i=a.replace(_,"")+"/"+i}}r=" (at "+i+":"+t.lineNumber+")"}else n&&(r=" (created by "+n+")");return"\n in "+(e||"Unknown")+r}(i,E._source,l&&T(l.type))}""!==(o+=r.getStackAddendum())&&(t+="%s",n=n.concat([o]));var a=n.map((function(e){return""+e}));a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}var _=/^(.*)[\\\/]/;function T(t){if(null==t)return null;if("number"==typeof t.tag&&R("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case e.Fragment:return"Fragment";case o:return"Portal";case l:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case f:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case s:return"Context.Consumer";case a:return"Context.Provider";case c:return m=t,h=t.render,g="ForwardRef",v=h.displayName||h.name||"",m.displayName||(""!==v?g+"("+v+")":g);case p:return T(t.type);case y:return T(t.render);case d:var n=1===(r=t)._status?r._result:null;if(n)return T(n)}var r,m,h,g,v;return null}var O={};x.ReactDebugCurrentFrame;var E=null;function A(e){E=e}var k,j,P,L=x.ReactCurrentOwner,D=Object.prototype.hasOwnProperty,N={key:!0,ref:!0,__self:!0,__source:!0};P={};function C(e,t,n,o,i){var l,a={},s=null,c=null;for(l in void 0!==n&&(s=""+n),function(e){if(D.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(s=""+t.key),function(e){if(D.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&&L.current&&t&&L.current.stateNode!==t){var n=T(L.current.type);P[n]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',T(L.current.type),e.ref),P[n]=!0)}}(t,i)),t)D.call(t,l)&&!N.hasOwnProperty(l)&&(a[l]=t[l]);if(e&&e.defaultProps){var u=e.defaultProps;for(l in u)void 0===a[l]&&(a[l]=u[l])}if(s||c){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){k||(k=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,f),c&&function(e,t){var n=function(){j||(j=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,f)}return function(e,t,n,o,i,l,a){var s={$$typeof:r,type:e,key:t,ref:n,props:a,_owner:l,_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,L.current,a)}var F,$=x.ReactCurrentOwner;function I(e){E=e}function W(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function H(){if($.current){var e=T($.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}x.ReactDebugCurrentFrame,F=!1;var U={};function B(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=H();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(!U[n]){U[n]=!0;var r="";e&&e._owner&&e._owner!==$.current&&(r=" It was passed a child from "+T(e._owner.type)+"."),I(e),R('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),I(null)}}}function M(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];W(r)&&B(r,t)}else if(W(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=b&&e[b]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,l=o.call(e);!(i=l.next()).done;)W(i.value)&&B(i.value,t)}}function V(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==p)return;t=n.propTypes}if(t){var r=T(n);!function(e,t,n,r,o){var i=Function.call.bind(Object.prototype.hasOwnProperty);for(var l in e)if(i(e,l)){var a=void 0;try{if("function"!=typeof e[l]){var s=Error((r||"React class")+": "+n+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}a=e[l](t,l,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){a=e}!a||a instanceof Error||(A(o),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,l,typeof a),A(null)),a instanceof Error&&!(a.message in O)&&(O[a.message]=!0,A(o),R("Failed %s type: %s",n,a.message),A(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!F){F=!0,R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function q(t,n,o,w,b,x){var S=function(t){return"string"==typeof t||"function"==typeof t||t===e.Fragment||t===l||t===g||t===i||t===u||t===f||t===v||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===a||t.$$typeof===s||t.$$typeof===c||t.$$typeof===h||t.$$typeof===y||t[0]===m)}(t);if(!S){var _="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O,E=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(b);_+=E||H(),null===t?O="null":Array.isArray(t)?O="array":void 0!==t&&t.$$typeof===r?(O="<"+(T(t.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):O=typeof t,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,_)}var A=C(t,n,o,b,x);if(null==A)return A;if(S){var k=n.children;if(void 0!==k)if(w)if(Array.isArray(k)){for(var j=0;j<k.length;j++)M(k[j],t);Object.freeze&&Object.freeze(k)}else R("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 M(k,t)}return t===e.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){I(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),I(null);break}}null!==e.ref&&(I(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}(A):V(A),A}var z=function(e,t,n){return q(e,t,n,!1)},Y=function(e,t,n){return q(e,t,n,!0)};e.jsx=z,e.jsxs=Y}()}(oe),re.exports=oe;var ie,le={exports:{}};
|
|
11
11
|
/*!
|
|
12
12
|
Copyright (c) 2018 Jed Watson.
|
|
13
13
|
Licensed under the MIT License (MIT), see
|
|
14
14
|
http://jedwatson.github.io/classnames
|
|
15
|
-
*/ie=le,function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var l=t.apply(null,o);l&&n.push(l)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var a in o)e.call(o,a)&&o[a]&&n.push(a)}}}return n.join(" ")}ie.exports?(t.default=t,ie.exports=t):window.classNames=t}();var ae=le.exports;const se=(e,t,n)=>{let r=null;return function(...o){r&&clearTimeout(r),r=setTimeout((()=>{r=null,n||e.apply(this,o)}),t)}},ce=({content:e})=>re.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}}),ue={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},fe={getTooltipData:()=>ue},pe=e.createContext(fe);function de(t="DEFAULT_TOOLTIP_ID"){return e.useContext(pe).getTooltipData(t)}const ye=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:i="top",offset:a=10,strategy:c="absolute",middlewares:u=[x(Number(a)),b(),R({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const f=u;return n?(f.push({name:"arrow",options:p={element:n,padding:5},async fn(e){const{element:t,padding:n=0}=p||{},{x:i,y:a,placement:c,rects:u,platform:f}=e;if(null==t)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const y=s(n),m={x:i,y:a},h=l(c),g=o(h),v=await f.getDimensions(t),w="y"===h?"top":"left",b="y"===h?"bottom":"right",x=u.reference[g]+u.reference[h]-m[h]-u.floating[g],R=m[h]-u.reference[h],_=await(null==f.getOffsetParent?void 0:f.getOffsetParent(t));let S=_?"y"===h?_.clientHeight||0:_.clientWidth||0:0;0===S&&(S=u.floating[g]);const T=x/2-R/2,O=y[w],k=S-v[g]-y[b],E=S/2-v[g]/2+T,A=d(O,E,k),j=null!=r(c)&&E!=A&&u.reference[g]/2-(E<O?y[w]:y[b])-v[g]/2<0;return{[h]:m[h]-(j?E<O?O-E:k-E:0),data:{[h]:A,centerOffset:E-A}}}}),ne(e,t,{placement:i,strategy:c,middleware:f}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var o,i;const l={left:`${e}px`,top:`${t}px`},{x:a,y:s}=null!==(o=r.arrow)&&void 0!==o?o:{x:0,y:0};return{tooltipStyles:l,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",[null!==(i={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==i?i:"bottom"]:"-4px"}}}))):ne(e,t,{placement:"bottom",strategy:c,middleware:f}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})));var p};var me={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T","no-arrow":"styles-module_no-arrow__KcFZN",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const he=({id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,place:l="top",offset:a=10,events:s=["hover"],positionStrategy:c="absolute",middlewares:u,wrapper:f,children:p=null,delayShow:d=0,delayHide:y=0,float:m=!1,noArrow:h=!1,clickable:g=!1,closeOnEsc:v=!1,style:w,position:b,afterShow:x,afterHide:R,content:_,html:S,isOpen:T,setIsOpen:O})=>{const k=e.useRef(null),E=e.useRef(null),A=e.useRef(null),j=e.useRef(null),[P,L]=e.useState({}),[D,N]=e.useState({}),[C,F]=e.useState(!1),[I,$]=e.useState(!1),W=e.useRef(!1),B=e.useRef(null),{anchorRefs:H,setActiveAnchor:U}=de(t),[M,V]=e.useState({current:null}),z=e.useRef(!1);e.useEffect((()=>{C||$(!1)}),[C]);const q=e=>{$(!0),setTimeout((()=>{null==O||O(e),void 0===T&&F(e)}),10)};e.useEffect((()=>{if(void 0===T)return()=>null;T&&$(!0);const e=setTimeout((()=>{F(T)}),10);return()=>{clearTimeout(e)}}),[T]),e.useEffect((()=>{C!==W.current&&(W.current=C,C?null==x||x():null==R||R())}),[C]);const Y=(e=y)=>{j.current&&clearTimeout(j.current),j.current=setTimeout((()=>{z.current||q(!1)}),e)},X=e=>{var t;if(!e)return;d?(A.current&&clearTimeout(A.current),A.current=setTimeout((()=>{q(!0)}),d)):q(!0);const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;V((e=>e.current===n?e:{current:n})),U({current:n}),j.current&&clearTimeout(j.current)},K=()=>{g?Y(y||100):y?Y():q(!1),A.current&&clearTimeout(A.current)},J=({x:e,y:t})=>{ye({place:l,offset:a,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:k.current,tooltipArrowReference:E.current,strategy:c,middlewares:u}).then((e=>{Object.keys(e.tooltipStyles).length&&L(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&N(e.tooltipArrowStyles)}))},Z=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};J(n),B.current=n},G=e=>{X(e),y&&Y()},Q=e=>{var t;(null===(t=M.current)||void 0===t?void 0:t.contains(e.target))||q(!1)},ee=e=>{"Escape"===e.key&&q(!1)},te=se(X,50),ne=se(K,50);e.useEffect((()=>{var e,t;const n=new Set(H),r=document.querySelector(`[id='${i}']`);if(r&&(V((e=>e.current===r?e:{current:r})),n.add({current:r})),!n.size)return()=>null;v&&window.addEventListener("keydown",ee);const o=[];s.find((e=>"click"===e))&&(window.addEventListener("click",Q),o.push({event:"click",listener:G})),s.find((e=>"hover"===e))&&(o.push({event:"mouseenter",listener:te},{event:"mouseleave",listener:ne},{event:"focus",listener:te},{event:"blur",listener:ne}),m&&o.push({event:"mousemove",listener:Z}));const l=()=>{z.current=!0},a=()=>{z.current=!1,K()};g&&(null===(e=k.current)||void 0===e||e.addEventListener("mouseenter",l),null===(t=k.current)||void 0===t||t.addEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))}));const c=null!=r?r:M.current,u=new MutationObserver((e=>{c&&e.some((e=>"childList"===e.type&&[...e.removedNodes].some((e=>!!e.contains(c)&&(q(!1),!0)))))}));return u.observe(document.body,{attributes:!1,childList:!0,subtree:!0}),()=>{var e,t;s.find((e=>"click"===e))&&window.removeEventListener("click",Q),v&&window.removeEventListener("keydown",ee),g&&(null===(e=k.current)||void 0===e||e.removeEventListener("mouseenter",l),null===(t=k.current)||void 0===t||t.removeEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))})),u.disconnect()}}),[I,H,M,v,i,s,y,d]),e.useEffect((()=>{if(b)return J(b),()=>null;if(m)return B.current&&J(B.current),()=>null;let e=M.current;i&&(e=document.querySelector(`[id='${i}']`));let t=!0;return ye({place:l,offset:a,elementReference:e,tooltipReference:k.current,tooltipArrowReference:E.current,strategy:c,middlewares:u}).then((e=>{t&&(Object.keys(e.tooltipStyles).length&&L(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&N(e.tooltipArrowStyles))})),()=>{t=!1}}),[C,i,M,_,S,l,a,c,b]),e.useEffect((()=>()=>{A.current&&clearTimeout(A.current),j.current&&clearTimeout(j.current)}),[]);const oe=Boolean(S||_||p),ie=Boolean(oe&&C&&Object.keys(P).length>0);return I?re.exports.jsxs(f,{id:t,role:"tooltip",className:ae("react-tooltip",me.tooltip,me[o],n,{[me.show]:ie,[me.fixed]:"fixed"===c,[me.clickable]:g}),style:{...w,...P},ref:k,children:[p||S&&re.exports.jsx(ce,{content:S})||_,re.exports.jsx(f,{className:ae("react-tooltip-arrow",me.arrow,r,{[me["no-arrow"]]:h}),style:D,ref:E})]}):null};exports.Tooltip=({id:t,anchorId:n,content:r,html:o,className:i,classNameArrow:l,variant:a="dark",place:s="top",offset:c=10,wrapper:u="div",children:f=null,events:p=["hover"],positionStrategy:d="absolute",middlewares:y,delayShow:m=0,delayHide:h=0,float:g=!1,noArrow:v=!1,clickable:w=!1,closeOnEsc:b=!1,style:x,position:R,isOpen:_,setIsOpen:S,afterShow:T,afterHide:O})=>{const[k,E]=e.useState(r),[A,j]=e.useState(o),[P,L]=e.useState(s),[D,N]=e.useState(a),[C,F]=e.useState(c),[I,$]=e.useState(m),[W,B]=e.useState(h),[H,U]=e.useState(g),[M,V]=e.useState(u),[z,q]=e.useState(p),[Y,X]=e.useState(d),{anchorRefs:K,activeAnchor:J}=de(t),Z=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;if(n.startsWith("data-tooltip-")){t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null}return t}),{}),G=e=>{const t={place:e=>{var t;L(null!==(t=e)&&void 0!==t?t:s)},content:e=>{E(null!=e?e:r)},html:e=>{j(null!=e?e:o)},variant:e=>{var t;N(null!==(t=e)&&void 0!==t?t:a)},offset:e=>{F(null===e?c:Number(e))},wrapper:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},events:e=>{const t=null==e?void 0:e.split(" ");q(null!=t?t:p)},"position-strategy":e=>{var t;X(null!==(t=e)&&void 0!==t?t:d)},"delay-show":e=>{$(null===e?m:Number(e))},"delay-hide":e=>{B(null===e?h:Number(e))},float:e=>{U(null===e?g:Boolean(e))}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};e.useEffect((()=>{E(r)}),[r]),e.useEffect((()=>{j(o)}),[o]),e.useEffect((()=>{var e;const t=new Set(K),r=document.querySelector(`[id='${n}']`);if(r&&t.add({current:r}),!t.size)return()=>null;const o=null!==(e=J.current)&&void 0!==e?e:r,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!o||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=Z(o);G(n)}))})),l={attributes:!0,childList:!1,subtree:!1};if(o){const e=Z(o);G(e),i.observe(o,l)}return()=>{i.disconnect()}}),[K,J,n]);const Q={id:t,anchorId:n,className:i,classNameArrow:l,content:k,html:A,place:P,variant:D,offset:C,wrapper:M,events:z,positionStrategy:Y,middlewares:y,delayShow:I,delayHide:W,float:H,noArrow:v,clickable:w,closeOnEsc:b,style:x,position:R,isOpen:_,setIsOpen:S,afterShow:T,afterHide:O};return f?re.exports.jsx(he,{...Q,children:f}):re.exports.jsx(he,{...Q})},exports.TooltipProvider=({children:t})=>{const[n,r]=e.useState({DEFAULT_TOOLTIP_ID:new Set}),[o,i]=e.useState({DEFAULT_TOOLTIP_ID:{current:null}}),l=(e,...t)=>{r((n=>{var r;const o=null!==(r=n[e])&&void 0!==r?r:new Set;return t.forEach((e=>o.add(e))),{...n,[e]:new Set(o)}}))},a=(e,...t)=>{r((n=>{const r=n[e];return r?(t.forEach((e=>r.delete(e))),{...n}):n}))},s=e.useCallback(((e="DEFAULT_TOOLTIP_ID")=>{var t,r;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=o[e])&&void 0!==r?r:{current:null},attach:(...t)=>l(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{i((n=>{var r;return(null===(r=n[e])||void 0===r?void 0:r.current)===t.current?n:{...n,[e]:t}}))})(e,t)}}),[n,o,l,a]),c=e.useMemo((()=>({getTooltipData:s})),[s]);return re.exports.jsx(pe.Provider,{value:c,children:t})},exports.TooltipWrapper=({tooltipId:t,children:n,className:r,place:o,content:i,html:l,variant:a,offset:s,wrapper:c,events:u,positionStrategy:f,delayShow:p,delayHide:d})=>{const{attach:y,detach:m}=de(t),h=e.useRef(null);return e.useEffect((()=>(y(h),()=>{m(h)})),[]),re.exports.jsx("span",{ref:h,className:ae("react-tooltip-wrapper",r),"data-tooltip-place":o,"data-tooltip-content":i,"data-tooltip-html":l,"data-tooltip-variant":a,"data-tooltip-offset":s,"data-tooltip-wrapper":c,"data-tooltip-events":u,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":p,"data-tooltip-delay-hide":d,children:n})},exports.autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,o,l;const{rects:a,middlewareData:s,placement:c,platform:f,elements:p}=t,{alignment:d,allowedPlacements:m=y,autoAlignment:h=!0,...v}=e,b=void 0!==d||m===y?function(e,t,n){return(e?[...n.filter((t=>r(t)===e)),...n.filter((t=>r(t)!==e))]:n.filter((e=>i(e)===e))).filter((n=>!e||r(n)===e||!!t&&w(n)!==n))}(d||null,h,m):m,x=await u(t,v),R=(null==(n=s.autoPlacement)?void 0:n.index)||0,_=b[R];if(null==_)return{};const{main:S,cross:T}=g(_,a,await(null==f.isRTL?void 0:f.isRTL(p.floating)));if(c!==_)return{reset:{placement:b[0]}};const O=[x[i(_)],x[S],x[T]],k=[...(null==(o=s.autoPlacement)?void 0:o.overflows)||[],{placement:_,overflows:O}],E=b[R+1];if(E)return{data:{index:R+1,overflows:k},reset:{placement:E}};const A=k.slice().sort(((e,t)=>e.overflows[0]-t.overflows[0])),j=null==(l=A.find((e=>{let{overflows:t}=e;return t.every((e=>e<=0))})))?void 0:l.placement,P=j||A[0].placement;return P!==c?{data:{index:R+1,overflows:k},reset:{placement:P}}:{}}}},exports.flip=b,exports.inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:a,strategy:u}=t,{padding:d=2,x:y,y:m}=e,h=c(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({rect:o.reference,offsetParent:await(null==a.getOffsetParent?void 0:a.getOffsetParent(r.floating)),strategy:u}):o.reference),g=await(null==a.getClientRects?void 0:a.getClientRects(r.reference))||[],v=s(d);const w=await a.getElementRects({reference:{getBoundingClientRect:function(){if(2===g.length&&g[0].left>g[1].right&&null!=y&&null!=m)return g.find((e=>y>e.left-v.left&&y<e.right+v.right&&m>e.top-v.top&&m<e.bottom+v.bottom))||h;if(g.length>=2){if("x"===l(n)){const e=g[0],t=g[g.length-1],r="top"===i(n),o=e.top,l=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:l,left:a,right:s,width:s-a,height:l-o,x:a,y:o}}const e="left"===i(n),t=p(...g.map((e=>e.right))),r=f(...g.map((e=>e.left))),o=g.filter((n=>e?n.left===r:n.right===t)),a=o[0].top,s=o[o.length-1].bottom;return{top:a,bottom:s,left:r,right:t,width:t-r,height:s-a,x:r,y:a}}return h}},floating:r.floating,strategy:u});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},exports.offset=x,exports.shift=R,exports.size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:l,elements:a}=t,{apply:s=(()=>{}),...c}=e,f=await u(t,c),d=i(n),y=r(n);let m,h;"top"===d||"bottom"===d?(m=d,h=y===(await(null==l.isRTL?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(h=d,m="end"===y?"top":"bottom");const g=p(f.left,0),v=p(f.right,0),w=p(f.top,0),b=p(f.bottom,0),x={availableHeight:o.floating.height-(["left","right"].includes(n)?2*(0!==w||0!==b?w+b:p(f.top,f.bottom)):f[m]),availableWidth:o.floating.width-(["top","bottom"].includes(n)?2*(0!==g||0!==v?g+v:p(f.left,f.right)):f[h])};await s({...t,...x});const R=await l.getDimensions(a.floating);return o.floating.width!==R.width||o.floating.height!==R.height?{reset:{rects:!0}}:{}}}};
|
|
15
|
+
*/ie=le,function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var l=t.apply(null,o);l&&n.push(l)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var a in o)e.call(o,a)&&o[a]&&n.push(a)}}}return n.join(" ")}ie.exports?(t.default=t,ie.exports=t):window.classNames=t}();var ae=le.exports;const se=(e,t,n)=>{let r=null;return function(...o){r&&clearTimeout(r),r=setTimeout((()=>{r=null,n||e.apply(this,o)}),t)}},ce=({content:e})=>re.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}}),ue={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},fe={getTooltipData:()=>ue},pe=e.createContext(fe);function de(t="DEFAULT_TOOLTIP_ID"){return e.useContext(pe).getTooltipData(t)}const ye=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:i="top",offset:a=10,strategy:c="absolute",middlewares:u=[x(Number(a)),b(),R({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const f=u;return n?(f.push({name:"arrow",options:p={element:n,padding:5},async fn(e){const{element:t,padding:n=0}=p||{},{x:i,y:a,placement:c,rects:u,platform:f}=e;if(null==t)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const y=s(n),m={x:i,y:a},h=l(c),g=o(h),v=await f.getDimensions(t),w="y"===h?"top":"left",b="y"===h?"bottom":"right",x=u.reference[g]+u.reference[h]-m[h]-u.floating[g],R=m[h]-u.reference[h],S=await(null==f.getOffsetParent?void 0:f.getOffsetParent(t));let _=S?"y"===h?S.clientHeight||0:S.clientWidth||0:0;0===_&&(_=u.floating[g]);const T=x/2-R/2,O=y[w],E=_-v[g]-y[b],A=_/2-v[g]/2+T,k=d(O,A,E),j=null!=r(c)&&A!=k&&u.reference[g]/2-(A<O?y[w]:y[b])-v[g]/2<0;return{[h]:m[h]-(j?A<O?O-A:E-A:0),data:{[h]:k,centerOffset:A-k}}}}),ne(e,t,{placement:i,strategy:c,middleware:f}).then((({x:e,y:t,placement:n,middlewareData:r})=>{var o,i;const l={left:`${e}px`,top:`${t}px`},{x:a,y:s}=null!==(o=r.arrow)&&void 0!==o?o:{x:0,y:0};return{tooltipStyles:l,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",[null!==(i={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]])&&void 0!==i?i:"bottom"]:"-4px"}}}))):ne(e,t,{placement:"bottom",strategy:c,middleware:f}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})));var p};var me={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T","no-arrow":"styles-module_no-arrow__KcFZN",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const he=({id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:l,place:a="top",offset:s=10,events:c=["hover"],positionStrategy:u="absolute",middlewares:f,wrapper:p,children:d=null,delayShow:y=0,delayHide:m=0,float:h=!1,noArrow:g=!1,clickable:v=!1,closeOnEsc:w=!1,style:b,position:x,afterShow:R,afterHide:S,content:_,html:T,isOpen:O,setIsOpen:E,activeAnchor:A,setActiveAnchor:k})=>{const j=e.useRef(null),P=e.useRef(null),L=e.useRef(null),D=e.useRef(null),[N,C]=e.useState({}),[F,$]=e.useState({}),[I,W]=e.useState(!1),[H,U]=e.useState(!1),B=e.useRef(!1),M=e.useRef(null),{anchorRefs:V,setActiveAnchor:q}=de(t),z=e.useRef(!1),[Y,X]=e.useState([]),K=e.useRef(!1);e.useEffect((()=>{let e=l;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));X(t)}catch(e){X([])}}),[l]),e.useLayoutEffect((()=>(K.current=!0,()=>{K.current=!1})),[]),e.useEffect((()=>{if(!I){const e=setTimeout((()=>{U(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[I]);const J=e=>{K.current&&(U(!0),setTimeout((()=>{K.current&&(null==E||E(e),void 0===O&&W(e))}),10))};e.useEffect((()=>{if(void 0===O)return()=>null;O&&U(!0);const e=setTimeout((()=>{W(O)}),10);return()=>{clearTimeout(e)}}),[O]),e.useEffect((()=>{I!==B.current&&(B.current=I,I?null==R||R():null==S||S())}),[I]);const Z=(e=m)=>{D.current&&clearTimeout(D.current),D.current=setTimeout((()=>{z.current||J(!1)}),e)},G=e=>{var t;if(!e)return;y?(L.current&&clearTimeout(L.current),L.current=setTimeout((()=>{J(!0)}),y)):J(!0);const n=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;k(n),q({current:n}),D.current&&clearTimeout(D.current)},Q=()=>{v?Z(m||100):m?Z():J(!1),L.current&&clearTimeout(L.current)},ee=({x:e,y:t})=>{ye({place:a,offset:s,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:j.current,tooltipArrowReference:P.current,strategy:u,middlewares:f}).then((e=>{Object.keys(e.tooltipStyles).length&&C(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&$(e.tooltipArrowStyles)}))},te=e=>{if(!e)return;const t=e,n={x:t.clientX,y:t.clientY};ee(n),M.current=n},ne=e=>{G(e),m&&Z()},oe=e=>{const t=document.querySelector(`[id='${i}']`);(null==t?void 0:t.contains(e.target))||Y.some((t=>t.contains(e.target)))||J(!1)},ie=e=>{"Escape"===e.key&&J(!1)},le=se(G,50),ue=se(Q,50);e.useEffect((()=>{var e,t;const n=new Set(V);Y.forEach((e=>{n.add({current:e})}));const r=document.querySelector(`[id='${i}']`);if(r&&n.add({current:r}),!n.size)return()=>null;w&&window.addEventListener("keydown",ie);const o=[];c.find((e=>"click"===e))&&(window.addEventListener("click",oe),o.push({event:"click",listener:ne})),c.find((e=>"hover"===e))&&(o.push({event:"mouseenter",listener:le},{event:"mouseleave",listener:ue},{event:"focus",listener:le},{event:"blur",listener:ue}),h&&o.push({event:"mousemove",listener:te}));const l=()=>{z.current=!0},a=()=>{z.current=!1,Q()};v&&(null===(e=j.current)||void 0===e||e.addEventListener("mouseenter",l),null===(t=j.current)||void 0===t||t.addEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.addEventListener(e,t)}))}));const s=new MutationObserver((e=>{A&&e.some((e=>"childList"===e.type&&[...e.removedNodes].some((e=>!!e.contains(A)&&(J(!1),!0)))))}));return s.observe(document.body,{attributes:!1,childList:!0,subtree:!0}),()=>{var e,t;c.find((e=>"click"===e))&&window.removeEventListener("click",oe),w&&window.removeEventListener("keydown",ie),v&&(null===(e=j.current)||void 0===e||e.removeEventListener("mouseenter",l),null===(t=j.current)||void 0===t||t.removeEventListener("mouseleave",a)),o.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;null===(r=n.current)||void 0===r||r.removeEventListener(e,t)}))})),s.disconnect()}}),[H,V,A,w,c,m,y]),e.useEffect((()=>{x?ee(x):h?M.current&&ee(M.current):ye({place:a,offset:s,elementReference:A,tooltipReference:j.current,tooltipArrowReference:P.current,strategy:u,middlewares:f}).then((e=>{K.current&&(Object.keys(e.tooltipStyles).length&&C(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&$(e.tooltipArrowStyles))}))}),[I,A,_,T,a,s,u,x]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),n=[...Y,t];A&&n.includes(A)||k(null!==(e=Y[0])&&void 0!==e?e:t)}),[i,Y,A]),e.useEffect((()=>()=>{L.current&&clearTimeout(L.current),D.current&&clearTimeout(D.current)}),[]);const fe=Boolean(T||_||d)&&I&&Object.keys(N).length>0;return H?re.exports.jsxs(p,{id:t,role:"tooltip",className:ae("react-tooltip",me.tooltip,me[o],n,{[me.show]:fe,[me.fixed]:"fixed"===u,[me.clickable]:v}),style:{...b,...N},ref:j,children:[T&&re.exports.jsx(ce,{content:T})||_||d,re.exports.jsx(p,{className:ae("react-tooltip-arrow",me.arrow,r,{[me["no-arrow"]]:g}),style:F,ref:P})]}):null};exports.Tooltip=({id:t,anchorId:n,anchorSelect:r,content:o,html:i,className:l,classNameArrow:a,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],positionStrategy:y="absolute",middlewares:m,delayShow:h=0,delayHide:g=0,float:v=!1,noArrow:w=!1,clickable:b=!1,closeOnEsc:x=!1,style:R,position:S,isOpen:_,setIsOpen:T,afterShow:O,afterHide:E})=>{const[A,k]=e.useState(o),[j,P]=e.useState(i),[L,D]=e.useState(c),[N,C]=e.useState(s),[F,$]=e.useState(u),[I,W]=e.useState(h),[H,U]=e.useState(g),[B,M]=e.useState(v),[V,q]=e.useState(f),[z,Y]=e.useState(d),[X,K]=e.useState(y),[J,Z]=e.useState(null),{anchorRefs:G,activeAnchor:Q}=de(t),ee=e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>{var r;if(n.startsWith("data-tooltip-")){t[n.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(n))&&void 0!==r?r:null}return t}),{}),te=e=>{const t={place:e=>{var t;D(null!==(t=e)&&void 0!==t?t:c)},content:e=>{k(null!=e?e:o)},html:e=>{P(null!=e?e:i)},variant:e=>{var t;C(null!==(t=e)&&void 0!==t?t:s)},offset:e=>{$(null===e?u:Number(e))},wrapper:e=>{var t;q(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");Y(null!=t?t:d)},"position-strategy":e=>{var t;K(null!==(t=e)&&void 0!==t?t:y)},"delay-show":e=>{W(null===e?h:Number(e))},"delay-hide":e=>{U(null===e?g:Number(e))},float:e=>{M(null===e?v:Boolean(e))}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;null===(r=t[e])||void 0===r||r.call(t,n)}))};e.useEffect((()=>{k(o)}),[o]),e.useEffect((()=>{P(i)}),[i]),e.useEffect((()=>{D(c)}),[c]),e.useEffect((()=>{var e;const o=new Set(G);let i=r;if(!i&&t&&(i=`[data-tooltip-id='${t}']`),i)try{document.querySelectorAll(i).forEach((e=>{o.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${r}" is not a valid CSS selector`)}const l=document.querySelector(`[id='${n}']`);if(l&&o.add({current:l}),!o.size)return()=>null;const a=null!==(e=null!=J?J:l)&&void 0!==e?e:Q.current,s=new MutationObserver((e=>{e.forEach((e=>{var t;if(!a||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const n=ee(a);te(n)}))})),c={attributes:!0,childList:!1,subtree:!1};if(a){const e=ee(a);te(e),s.observe(a,c)}return()=>{s.disconnect()}}),[G,Q,J,n,r]);const ne={id:t,anchorId:n,anchorSelect:r,className:l,classNameArrow:a,content:A,html:j,place:L,variant:N,offset:F,wrapper:V,events:z,positionStrategy:X,middlewares:m,delayShow:I,delayHide:H,float:B,noArrow:w,clickable:b,closeOnEsc:x,style:R,position:S,isOpen:_,setIsOpen:T,afterShow:O,afterHide:E,activeAnchor:J,setActiveAnchor:e=>Z(e)};return p?re.exports.jsx(he,{...ne,children:p}):re.exports.jsx(he,{...ne})},exports.TooltipProvider=({children:t})=>{const[n,r]=e.useState({DEFAULT_TOOLTIP_ID:new Set}),[o,i]=e.useState({DEFAULT_TOOLTIP_ID:{current:null}}),l=(e,...t)=>{r((n=>{var r;const o=null!==(r=n[e])&&void 0!==r?r:new Set;return t.forEach((e=>o.add(e))),{...n,[e]:new Set(o)}}))},a=(e,...t)=>{r((n=>{const r=n[e];return r?(t.forEach((e=>r.delete(e))),{...n}):n}))},s=e.useCallback(((e="DEFAULT_TOOLTIP_ID")=>{var t,r;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=o[e])&&void 0!==r?r:{current:null},attach:(...t)=>l(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{i((n=>{var r;return(null===(r=n[e])||void 0===r?void 0:r.current)===t.current?n:{...n,[e]:t}}))})(e,t)}}),[n,o,l,a]),c=e.useMemo((()=>({getTooltipData:s})),[s]);return re.exports.jsx(pe.Provider,{value:c,children:t})},exports.TooltipWrapper=({tooltipId:t,children:n,className:r,place:o,content:i,html:l,variant:a,offset:s,wrapper:c,events:u,positionStrategy:f,delayShow:p,delayHide:d})=>{const{attach:y,detach:m}=de(t),h=e.useRef(null);return e.useEffect((()=>(y(h),()=>{m(h)})),[]),re.exports.jsx("span",{ref:h,className:ae("react-tooltip-wrapper",r),"data-tooltip-place":o,"data-tooltip-content":i,"data-tooltip-html":l,"data-tooltip-variant":a,"data-tooltip-offset":s,"data-tooltip-wrapper":c,"data-tooltip-events":u,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":p,"data-tooltip-delay-hide":d,children:n})},exports.autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,o,l;const{rects:a,middlewareData:s,placement:c,platform:f,elements:p}=t,{alignment:d,allowedPlacements:m=y,autoAlignment:h=!0,...v}=e,b=void 0!==d||m===y?function(e,t,n){return(e?[...n.filter((t=>r(t)===e)),...n.filter((t=>r(t)!==e))]:n.filter((e=>i(e)===e))).filter((n=>!e||r(n)===e||!!t&&w(n)!==n))}(d||null,h,m):m,x=await u(t,v),R=(null==(n=s.autoPlacement)?void 0:n.index)||0,S=b[R];if(null==S)return{};const{main:_,cross:T}=g(S,a,await(null==f.isRTL?void 0:f.isRTL(p.floating)));if(c!==S)return{reset:{placement:b[0]}};const O=[x[i(S)],x[_],x[T]],E=[...(null==(o=s.autoPlacement)?void 0:o.overflows)||[],{placement:S,overflows:O}],A=b[R+1];if(A)return{data:{index:R+1,overflows:E},reset:{placement:A}};const k=E.slice().sort(((e,t)=>e.overflows[0]-t.overflows[0])),j=null==(l=k.find((e=>{let{overflows:t}=e;return t.every((e=>e<=0))})))?void 0:l.placement,P=j||k[0].placement;return P!==c?{data:{index:R+1,overflows:E},reset:{placement:P}}:{}}}},exports.flip=b,exports.inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:a,strategy:u}=t,{padding:d=2,x:y,y:m}=e,h=c(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({rect:o.reference,offsetParent:await(null==a.getOffsetParent?void 0:a.getOffsetParent(r.floating)),strategy:u}):o.reference),g=await(null==a.getClientRects?void 0:a.getClientRects(r.reference))||[],v=s(d);const w=await a.getElementRects({reference:{getBoundingClientRect:function(){if(2===g.length&&g[0].left>g[1].right&&null!=y&&null!=m)return g.find((e=>y>e.left-v.left&&y<e.right+v.right&&m>e.top-v.top&&m<e.bottom+v.bottom))||h;if(g.length>=2){if("x"===l(n)){const e=g[0],t=g[g.length-1],r="top"===i(n),o=e.top,l=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:l,left:a,right:s,width:s-a,height:l-o,x:a,y:o}}const e="left"===i(n),t=p(...g.map((e=>e.right))),r=f(...g.map((e=>e.left))),o=g.filter((n=>e?n.left===r:n.right===t)),a=o[0].top,s=o[o.length-1].bottom;return{top:a,bottom:s,left:r,right:t,width:t-r,height:s-a,x:r,y:a}}return h}},floating:r.floating,strategy:u});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},exports.offset=x,exports.shift=R,exports.size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:l,elements:a}=t,{apply:s=(()=>{}),...c}=e,f=await u(t,c),d=i(n),y=r(n);let m,h;"top"===d||"bottom"===d?(m=d,h=y===(await(null==l.isRTL?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(h=d,m="end"===y?"top":"bottom");const g=p(f.left,0),v=p(f.right,0),w=p(f.top,0),b=p(f.bottom,0),x={availableHeight:o.floating.height-(["left","right"].includes(n)?2*(0!==w||0!==b?w+b:p(f.top,f.bottom)):f[m]),availableWidth:o.floating.width-(["top","bottom"].includes(n)?2*(0!==g||0!==v?g+v:p(f.left,f.right)):f[h])};await s({...t,...x});const R=await l.getDimensions(a.floating);return o.floating.width!==R.width||o.floating.height!==R.height?{reset:{rects:!0}}:{}}}};
|
package/dist/react-tooltip.d.ts
CHANGED
|
@@ -41,7 +41,12 @@ interface ITooltipController {
|
|
|
41
41
|
offset?: number
|
|
42
42
|
id?: string
|
|
43
43
|
variant?: VariantType
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
46
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
47
|
+
*/
|
|
44
48
|
anchorId?: string
|
|
49
|
+
anchorSelect?: string
|
|
45
50
|
wrapper?: WrapperType
|
|
46
51
|
children?: ChildrenType
|
|
47
52
|
events?: EventsType[]
|
|
@@ -63,6 +68,7 @@ interface ITooltipController {
|
|
|
63
68
|
|
|
64
69
|
declare module 'react' {
|
|
65
70
|
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
|
71
|
+
'data-tooltip-id'?: string
|
|
66
72
|
'data-tooltip-place'?: PlacesType
|
|
67
73
|
'data-tooltip-content'?: string
|
|
68
74
|
'data-tooltip-html'?: string
|
|
@@ -77,6 +83,10 @@ declare module 'react' {
|
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
88
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
89
|
+
*/
|
|
80
90
|
interface ITooltipWrapper {
|
|
81
91
|
tooltipId?: string
|
|
82
92
|
children: ReactNode
|
|
@@ -94,10 +104,18 @@ interface ITooltipWrapper {
|
|
|
94
104
|
delayHide?: ITooltipController['delayHide']
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
declare const TooltipController: ({ id, anchorId, content, html, className, classNameArrow, variant, place, offset, wrapper, children, events, positionStrategy, middlewares, delayShow, delayHide, float, noArrow, clickable, closeOnEsc, style, position, isOpen, setIsOpen, afterShow, afterHide, }: ITooltipController) => JSX.Element;
|
|
107
|
+
declare const TooltipController: ({ id, anchorId, anchorSelect, content, html, className, classNameArrow, variant, place, offset, wrapper, children, events, positionStrategy, middlewares, delayShow, delayHide, float, noArrow, clickable, closeOnEsc, style, position, isOpen, setIsOpen, afterShow, afterHide, }: ITooltipController) => JSX.Element;
|
|
98
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
111
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
112
|
+
*/
|
|
99
113
|
declare const TooltipProvider: React.FC<PropsWithChildren>;
|
|
100
114
|
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
117
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
118
|
+
*/
|
|
101
119
|
declare const TooltipWrapper: ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }: ITooltipWrapper) => JSX.Element;
|
|
102
120
|
|
|
103
121
|
export { ChildrenType, DataAttribute, EventsType, IPosition, ITooltipController as ITooltip, ITooltipWrapper, PlacesType, PositionStrategy, TooltipController as Tooltip, TooltipProvider, TooltipWrapper, VariantType, WrapperType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
1
|
+
import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
function getAlignment(placement) {
|
|
4
4
|
return placement.split('-')[1];
|
|
@@ -2535,6 +2535,10 @@ const DEFAULT_CONTEXT_DATA_WRAPPER = {
|
|
|
2535
2535
|
getTooltipData: () => DEFAULT_CONTEXT_DATA,
|
|
2536
2536
|
};
|
|
2537
2537
|
const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
|
|
2538
|
+
/**
|
|
2539
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2540
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
2541
|
+
*/
|
|
2538
2542
|
const TooltipProvider = ({ children }) => {
|
|
2539
2543
|
const [anchorRefMap, setAnchorRefMap] = useState({
|
|
2540
2544
|
[DEFAULT_TOOLTIP_ID]: new Set(),
|
|
@@ -2595,6 +2599,10 @@ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
|
|
|
2595
2599
|
return useContext(TooltipContext).getTooltipData(tooltipId);
|
|
2596
2600
|
}
|
|
2597
2601
|
|
|
2602
|
+
/**
|
|
2603
|
+
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
2604
|
+
* See https://react-tooltip.com/docs/getting-started
|
|
2605
|
+
*/
|
|
2598
2606
|
const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
|
|
2599
2607
|
const { attach, detach } = useTooltip(tooltipId);
|
|
2600
2608
|
const anchorRef = useRef(null);
|
|
@@ -2658,9 +2666,9 @@ var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fi
|
|
|
2658
2666
|
|
|
2659
2667
|
const Tooltip = ({
|
|
2660
2668
|
// props
|
|
2661
|
-
id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2669
|
+
id, className, classNameArrow, variant = 'dark', anchorId, anchorSelect, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement, children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style: externalStyles, position, afterShow, afterHide,
|
|
2662
2670
|
// props handled by controller
|
|
2663
|
-
content, html, isOpen, setIsOpen, }) => {
|
|
2671
|
+
content, html, isOpen, setIsOpen, activeAnchor, setActiveAnchor, }) => {
|
|
2664
2672
|
const tooltipRef = useRef(null);
|
|
2665
2673
|
const tooltipArrowRef = useRef(null);
|
|
2666
2674
|
const tooltipShowDelayTimerRef = useRef(null);
|
|
@@ -2671,21 +2679,71 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2671
2679
|
const [rendered, setRendered] = useState(false);
|
|
2672
2680
|
const wasShowing = useRef(false);
|
|
2673
2681
|
const lastFloatPosition = useRef(null);
|
|
2682
|
+
/**
|
|
2683
|
+
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
2684
|
+
*/
|
|
2674
2685
|
const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id);
|
|
2675
|
-
const [activeAnchor, setActiveAnchor] = useState({ current: null });
|
|
2676
2686
|
const hoveringTooltip = useRef(false);
|
|
2687
|
+
const [anchorsBySelect, setAnchorsBySelect] = useState([]);
|
|
2688
|
+
const mounted = useRef(false);
|
|
2689
|
+
useEffect(() => {
|
|
2690
|
+
let selector = anchorSelect;
|
|
2691
|
+
if (!selector && id) {
|
|
2692
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
2693
|
+
}
|
|
2694
|
+
if (!selector) {
|
|
2695
|
+
return;
|
|
2696
|
+
}
|
|
2697
|
+
try {
|
|
2698
|
+
const anchors = Array.from(document.querySelectorAll(selector));
|
|
2699
|
+
setAnchorsBySelect(anchors);
|
|
2700
|
+
}
|
|
2701
|
+
catch (_a) {
|
|
2702
|
+
// warning was already issued in the controller
|
|
2703
|
+
setAnchorsBySelect([]);
|
|
2704
|
+
}
|
|
2705
|
+
}, [anchorSelect]);
|
|
2706
|
+
/**
|
|
2707
|
+
* useLayoutEffect runs before useEffect,
|
|
2708
|
+
* but should be used carefully because of caveats
|
|
2709
|
+
* https://beta.reactjs.org/reference/react/useLayoutEffect#caveats
|
|
2710
|
+
*/
|
|
2711
|
+
useLayoutEffect(() => {
|
|
2712
|
+
mounted.current = true;
|
|
2713
|
+
return () => {
|
|
2714
|
+
mounted.current = false;
|
|
2715
|
+
};
|
|
2716
|
+
}, []);
|
|
2677
2717
|
useEffect(() => {
|
|
2678
2718
|
if (!show) {
|
|
2679
|
-
|
|
2719
|
+
/**
|
|
2720
|
+
* this fixes weird behavior when switching between two anchor elements very quickly
|
|
2721
|
+
* remove the timeout and switch quickly between two adjancent anchor elements to see it
|
|
2722
|
+
*
|
|
2723
|
+
* in practice, this means the tooltip is not immediately removed from the DOM on hide
|
|
2724
|
+
*/
|
|
2725
|
+
const timeout = setTimeout(() => {
|
|
2726
|
+
setRendered(false);
|
|
2727
|
+
}, 150);
|
|
2728
|
+
return () => {
|
|
2729
|
+
clearTimeout(timeout);
|
|
2730
|
+
};
|
|
2680
2731
|
}
|
|
2732
|
+
return () => null;
|
|
2681
2733
|
}, [show]);
|
|
2682
2734
|
const handleShow = (value) => {
|
|
2735
|
+
if (!mounted.current) {
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2683
2738
|
setRendered(true);
|
|
2684
2739
|
/**
|
|
2685
2740
|
* wait for the component to render and calculate position
|
|
2686
2741
|
* before actually showing
|
|
2687
2742
|
*/
|
|
2688
2743
|
setTimeout(() => {
|
|
2744
|
+
if (!mounted.current) {
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2689
2747
|
setIsOpen === null || setIsOpen === void 0 ? void 0 : setIsOpen(value);
|
|
2690
2748
|
if (isOpen === undefined) {
|
|
2691
2749
|
setShow(value);
|
|
@@ -2753,7 +2811,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2753
2811
|
handleShow(true);
|
|
2754
2812
|
}
|
|
2755
2813
|
const target = (_a = event.currentTarget) !== null && _a !== void 0 ? _a : event.target;
|
|
2756
|
-
setActiveAnchor(
|
|
2814
|
+
setActiveAnchor(target);
|
|
2757
2815
|
setProviderActiveAnchor({ current: target });
|
|
2758
2816
|
if (tooltipHideDelayTimerRef.current) {
|
|
2759
2817
|
clearTimeout(tooltipHideDelayTimerRef.current);
|
|
@@ -2824,9 +2882,12 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2824
2882
|
handleHideTooltipDelayed();
|
|
2825
2883
|
}
|
|
2826
2884
|
};
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2829
|
-
if (
|
|
2885
|
+
const handleClickOutsideAnchors = (event) => {
|
|
2886
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
2887
|
+
if (anchorById === null || anchorById === void 0 ? void 0 : anchorById.contains(event.target)) {
|
|
2888
|
+
return;
|
|
2889
|
+
}
|
|
2890
|
+
if (anchorsBySelect.some((anchor) => anchor.contains(event.target))) {
|
|
2830
2891
|
return;
|
|
2831
2892
|
}
|
|
2832
2893
|
handleShow(false);
|
|
@@ -2844,9 +2905,11 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2844
2905
|
useEffect(() => {
|
|
2845
2906
|
var _a, _b;
|
|
2846
2907
|
const elementRefs = new Set(anchorRefs);
|
|
2908
|
+
anchorsBySelect.forEach((anchor) => {
|
|
2909
|
+
elementRefs.add({ current: anchor });
|
|
2910
|
+
});
|
|
2847
2911
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
2848
2912
|
if (anchorById) {
|
|
2849
|
-
setActiveAnchor((anchor) => anchor.current === anchorById ? anchor : { current: anchorById });
|
|
2850
2913
|
elementRefs.add({ current: anchorById });
|
|
2851
2914
|
}
|
|
2852
2915
|
if (!elementRefs.size) {
|
|
@@ -2857,7 +2920,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2857
2920
|
}
|
|
2858
2921
|
const enabledEvents = [];
|
|
2859
2922
|
if (events.find((event) => event === 'click')) {
|
|
2860
|
-
window.addEventListener('click',
|
|
2923
|
+
window.addEventListener('click', handleClickOutsideAnchors);
|
|
2861
2924
|
enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
|
|
2862
2925
|
}
|
|
2863
2926
|
if (events.find((event) => event === 'hover')) {
|
|
@@ -2886,9 +2949,8 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2886
2949
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener(event, listener);
|
|
2887
2950
|
});
|
|
2888
2951
|
});
|
|
2889
|
-
const anchorElement = anchorById !== null && anchorById !== void 0 ? anchorById : activeAnchor.current;
|
|
2890
2952
|
const parentObserverCallback = (mutationList) => {
|
|
2891
|
-
if (!
|
|
2953
|
+
if (!activeAnchor) {
|
|
2892
2954
|
return;
|
|
2893
2955
|
}
|
|
2894
2956
|
mutationList.some((mutation) => {
|
|
@@ -2896,7 +2958,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2896
2958
|
return false;
|
|
2897
2959
|
}
|
|
2898
2960
|
return [...mutation.removedNodes].some((node) => {
|
|
2899
|
-
if (node.contains(
|
|
2961
|
+
if (node.contains(activeAnchor)) {
|
|
2900
2962
|
handleShow(false);
|
|
2901
2963
|
return true;
|
|
2902
2964
|
}
|
|
@@ -2910,7 +2972,7 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2910
2972
|
return () => {
|
|
2911
2973
|
var _a, _b;
|
|
2912
2974
|
if (events.find((event) => event === 'click')) {
|
|
2913
|
-
window.removeEventListener('click',
|
|
2975
|
+
window.removeEventListener('click', handleClickOutsideAnchors);
|
|
2914
2976
|
}
|
|
2915
2977
|
if (closeOnEsc) {
|
|
2916
2978
|
window.removeEventListener('keydown', handleEsc);
|
|
@@ -2931,12 +2993,12 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2931
2993
|
* rendered is also a dependency to ensure anchor observers are re-registered
|
|
2932
2994
|
* since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM
|
|
2933
2995
|
*/
|
|
2934
|
-
}, [rendered, anchorRefs, activeAnchor, closeOnEsc,
|
|
2996
|
+
}, [rendered, anchorRefs, activeAnchor, closeOnEsc, events, delayHide, delayShow]);
|
|
2935
2997
|
useEffect(() => {
|
|
2936
2998
|
if (position) {
|
|
2937
2999
|
// if `position` is set, override regular and `float` positioning
|
|
2938
3000
|
handleTooltipPosition(position);
|
|
2939
|
-
return
|
|
3001
|
+
return;
|
|
2940
3002
|
}
|
|
2941
3003
|
if (float) {
|
|
2942
3004
|
if (lastFloatPosition.current) {
|
|
@@ -2950,24 +3012,18 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2950
3012
|
handleTooltipPosition(lastFloatPosition.current);
|
|
2951
3013
|
}
|
|
2952
3014
|
// if `float` is set, override regular positioning
|
|
2953
|
-
return
|
|
2954
|
-
}
|
|
2955
|
-
let elementReference = activeAnchor.current;
|
|
2956
|
-
if (anchorId) {
|
|
2957
|
-
// `anchorId` element takes precedence
|
|
2958
|
-
elementReference = document.querySelector(`[id='${anchorId}']`);
|
|
3015
|
+
return;
|
|
2959
3016
|
}
|
|
2960
|
-
let mounted = true;
|
|
2961
3017
|
computeTooltipPosition({
|
|
2962
3018
|
place,
|
|
2963
3019
|
offset,
|
|
2964
|
-
elementReference,
|
|
3020
|
+
elementReference: activeAnchor,
|
|
2965
3021
|
tooltipReference: tooltipRef.current,
|
|
2966
3022
|
tooltipArrowReference: tooltipArrowRef.current,
|
|
2967
3023
|
strategy: positionStrategy,
|
|
2968
3024
|
middlewares,
|
|
2969
3025
|
}).then((computedStylesData) => {
|
|
2970
|
-
if (!mounted) {
|
|
3026
|
+
if (!mounted.current) {
|
|
2971
3027
|
// invalidate computed positions after remount
|
|
2972
3028
|
return;
|
|
2973
3029
|
}
|
|
@@ -2978,10 +3034,20 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2978
3034
|
setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
|
|
2979
3035
|
}
|
|
2980
3036
|
});
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3037
|
+
}, [show, activeAnchor, content, html, place, offset, positionStrategy, position]);
|
|
3038
|
+
useEffect(() => {
|
|
3039
|
+
var _a;
|
|
3040
|
+
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3041
|
+
const anchors = [...anchorsBySelect, anchorById];
|
|
3042
|
+
if (!activeAnchor || !anchors.includes(activeAnchor)) {
|
|
3043
|
+
/**
|
|
3044
|
+
* if there is no active anchor,
|
|
3045
|
+
* or if the current active anchor is not amongst the allowed ones,
|
|
3046
|
+
* reset it
|
|
3047
|
+
*/
|
|
3048
|
+
setActiveAnchor((_a = anchorsBySelect[0]) !== null && _a !== void 0 ? _a : anchorById);
|
|
3049
|
+
}
|
|
3050
|
+
}, [anchorId, anchorsBySelect, activeAnchor]);
|
|
2985
3051
|
useEffect(() => {
|
|
2986
3052
|
return () => {
|
|
2987
3053
|
if (tooltipShowDelayTimerRef.current) {
|
|
@@ -2993,17 +3059,17 @@ content, html, isOpen, setIsOpen, }) => {
|
|
|
2993
3059
|
};
|
|
2994
3060
|
}, []);
|
|
2995
3061
|
const hasContentOrChildren = Boolean(html || content || children);
|
|
2996
|
-
const canShow =
|
|
3062
|
+
const canShow = hasContentOrChildren && show && Object.keys(inlineStyles).length > 0;
|
|
2997
3063
|
return rendered ? (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames('react-tooltip', styles['tooltip'], styles[variant], className, {
|
|
2998
3064
|
[styles['show']]: canShow,
|
|
2999
3065
|
[styles['fixed']]: positionStrategy === 'fixed',
|
|
3000
3066
|
[styles['clickable']]: clickable,
|
|
3001
|
-
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [
|
|
3067
|
+
}), style: { ...externalStyles, ...inlineStyles }, ref: tooltipRef, children: [(html && jsxRuntime.exports.jsx(TooltipContent, { content: html })) || content || children, jsxRuntime.exports.jsx(WrapperElement, { className: classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {
|
|
3002
3068
|
[styles['no-arrow']]: noArrow,
|
|
3003
3069
|
}), style: inlineArrowStyles, ref: tooltipArrowRef })] })) : null;
|
|
3004
3070
|
};
|
|
3005
3071
|
|
|
3006
|
-
const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
3072
|
+
const TooltipController = ({ id, anchorId, anchorSelect, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, closeOnEsc = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
|
|
3007
3073
|
const [tooltipContent, setTooltipContent] = useState(content);
|
|
3008
3074
|
const [tooltipHtml, setTooltipHtml] = useState(html);
|
|
3009
3075
|
const [tooltipPlace, setTooltipPlace] = useState(place);
|
|
@@ -3015,7 +3081,11 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3015
3081
|
const [tooltipWrapper, setTooltipWrapper] = useState(wrapper);
|
|
3016
3082
|
const [tooltipEvents, setTooltipEvents] = useState(events);
|
|
3017
3083
|
const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy);
|
|
3018
|
-
const
|
|
3084
|
+
const [activeAnchor, setActiveAnchor] = useState(null);
|
|
3085
|
+
/**
|
|
3086
|
+
* @todo Remove this in a future version (provider/wrapper method is deprecated)
|
|
3087
|
+
*/
|
|
3088
|
+
const { anchorRefs, activeAnchor: providerActiveAnchor } = useTooltip(id);
|
|
3019
3089
|
const getDataAttributesFromAnchorElement = (elementReference) => {
|
|
3020
3090
|
const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
|
|
3021
3091
|
var _a;
|
|
@@ -3082,9 +3152,30 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3082
3152
|
useEffect(() => {
|
|
3083
3153
|
setTooltipHtml(html);
|
|
3084
3154
|
}, [html]);
|
|
3155
|
+
useEffect(() => {
|
|
3156
|
+
setTooltipPlace(place);
|
|
3157
|
+
}, [place]);
|
|
3085
3158
|
useEffect(() => {
|
|
3086
3159
|
var _a;
|
|
3087
3160
|
const elementRefs = new Set(anchorRefs);
|
|
3161
|
+
let selector = anchorSelect;
|
|
3162
|
+
if (!selector && id) {
|
|
3163
|
+
selector = `[data-tooltip-id='${id}']`;
|
|
3164
|
+
}
|
|
3165
|
+
if (selector) {
|
|
3166
|
+
try {
|
|
3167
|
+
const anchorsBySelect = document.querySelectorAll(selector);
|
|
3168
|
+
anchorsBySelect.forEach((anchor) => {
|
|
3169
|
+
elementRefs.add({ current: anchor });
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
catch (_b) {
|
|
3173
|
+
{
|
|
3174
|
+
// eslint-disable-next-line no-console
|
|
3175
|
+
console.warn(`[react-tooltip] "${anchorSelect}" is not a valid CSS selector`);
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3088
3179
|
const anchorById = document.querySelector(`[id='${anchorId}']`);
|
|
3089
3180
|
if (anchorById) {
|
|
3090
3181
|
elementRefs.add({ current: anchorById });
|
|
@@ -3092,7 +3183,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3092
3183
|
if (!elementRefs.size) {
|
|
3093
3184
|
return () => null;
|
|
3094
3185
|
}
|
|
3095
|
-
const anchorElement = (_a = activeAnchor
|
|
3186
|
+
const anchorElement = (_a = activeAnchor !== null && activeAnchor !== void 0 ? activeAnchor : anchorById) !== null && _a !== void 0 ? _a : providerActiveAnchor.current;
|
|
3096
3187
|
const observerCallback = (mutationList) => {
|
|
3097
3188
|
mutationList.forEach((mutation) => {
|
|
3098
3189
|
var _a;
|
|
@@ -3121,10 +3212,11 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3121
3212
|
// Remove the observer when the tooltip is destroyed
|
|
3122
3213
|
observer.disconnect();
|
|
3123
3214
|
};
|
|
3124
|
-
}, [anchorRefs, activeAnchor, anchorId]);
|
|
3215
|
+
}, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect]);
|
|
3125
3216
|
const props = {
|
|
3126
3217
|
id,
|
|
3127
3218
|
anchorId,
|
|
3219
|
+
anchorSelect,
|
|
3128
3220
|
className,
|
|
3129
3221
|
classNameArrow,
|
|
3130
3222
|
content: tooltipContent,
|
|
@@ -3148,6 +3240,8 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
|
|
|
3148
3240
|
setIsOpen,
|
|
3149
3241
|
afterShow,
|
|
3150
3242
|
afterHide,
|
|
3243
|
+
activeAnchor,
|
|
3244
|
+
setActiveAnchor: (anchor) => setActiveAnchor(anchor),
|
|
3151
3245
|
};
|
|
3152
3246
|
return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
|
|
3153
3247
|
};
|