react-tooltip
Advanced tools
Comparing version 5.27.0 to 5.27.1
@@ -7,3 +7,3 @@ /* | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/dom"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/dom","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTooltip={},e.React,e.FloatingUIDOM,e.classNames)}(this,(function(e,t,o,r){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(t),c=l(r);const s="react-tooltip-core-styles",i="react-tooltip-base-styles",a={core:!1,base:!1};function u({css:e,id:t=i,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=s),r||(r={});const{insertAt:c}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const u=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.id=t,d.type="text/css","top"===c&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[o]=!0}const d=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:l="top",offset:n=10,strategy:c="absolute",middlewares:s=[o.offset(Number(n)),o.flip({fallbackAxisSideDirection:"start"}),o.shift({padding:5})],border:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const a=s;return r?(a.push(o.arrow({element:r,padding:5})),o.computePosition(e,t,{placement:l,strategy:c,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:i},{x:s,y:a}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):o.computePosition(e,t,{placement:"bottom",strategy:c,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))},p=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),f=(e,t,o)=>{let r=null;const l=function(...l){const n=()=>{r=null,o||e.apply(this,l)};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t))};return l.cancel=()=>{r&&(clearTimeout(r),r=null)},l},v=e=>null!==e&&!Array.isArray(e)&&"object"==typeof e,m=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,o)=>m(e,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!v(e)||!v(t))return e===t;const o=Object.keys(e),r=Object.keys(t);return o.length===r.length&&o.every((o=>m(e[o],t[o])))},y=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},h=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(y(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},w="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,S="DEFAULT_TOOLTIP_ID",b={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},E={getTooltipData:()=>b},g=t.createContext(E);function A(e=S){return t.useContext(g).getTooltipData(e)}var _={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},T={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const O=({forwardRef:e,id:r,className:l,classNameArrow:s,variant:i="dark",anchorId:a,anchorSelect:u,place:p="top",offset:v=10,events:y=["hover"],openOnClick:S=!1,positionStrategy:b="absolute",middlewares:E,wrapper:g,delayShow:O=0,delayHide:R=0,float:k=!1,hidden:C=!1,noArrow:L=!1,clickable:x=!1,closeOnEsc:N=!1,closeOnScroll:$=!1,closeOnResize:I=!1,openEvents:j,closeEvents:B,globalCloseEvents:D,imperativeModeOnly:q,style:z,position:M,afterShow:H,afterHide:P,content:W,contentWrapperRef:F,isOpen:U,defaultIsOpen:V=!1,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:G,opacity:Z,arrowColor:J,role:Q="tooltip"})=>{var ee;const te=t.useRef(null),oe=t.useRef(null),re=t.useRef(null),le=t.useRef(null),ne=t.useRef(null),[ce,se]=t.useState({tooltipStyles:{},tooltipArrowStyles:{},place:p}),[ie,ae]=t.useState(!1),[ue,de]=t.useState(!1),[pe,fe]=t.useState(null),ve=t.useRef(!1),me=t.useRef(null),{anchorRefs:ye,setActiveAnchor:he}=A(r),we=t.useRef(!1),[Se,be]=t.useState([]),Ee=t.useRef(!1),ge=S||y.includes("click"),Ae=ge||(null==j?void 0:j.click)||(null==j?void 0:j.dblclick)||(null==j?void 0:j.mousedown),_e=j?{...j}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!j&&ge&&Object.assign(_e,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Te=B?{...B}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!B&&ge&&Object.assign(Te,{mouseleave:!1,blur:!1,mouseout:!1});const Oe=D?{...D}:{escape:N||!1,scroll:$||!1,resize:I||!1,clickOutsideAnchor:Ae||!1};q&&(Object.assign(_e,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Te,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Oe,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),w((()=>(Ee.current=!0,()=>{Ee.current=!1})),[]);const Re=e=>{Ee.current&&(e&&de(!0),setTimeout((()=>{Ee.current&&(null==K||K(e),void 0===U&&ae(e))}),10))};t.useEffect((()=>{if(void 0===U)return()=>null;U&&de(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),t.useEffect((()=>{if(ie!==ve.current)if(ne.current&&clearTimeout(ne.current),ve.current=ie,ie)null==H||H();else{const e=(e=>{const t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;const[,o,r]=t;return Number(o)*("ms"===r?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ne.current=setTimeout((()=>{de(!1),fe(null),null==P||P()}),e+25)}}),[ie]);const ke=e=>{se((t=>m(t,e)?t:e))},Ce=(e=O)=>{re.current&&clearTimeout(re.current),ue?Re(!0):re.current=setTimeout((()=>{Re(!0)}),e)},Le=(e=R)=>{le.current&&clearTimeout(le.current),le.current=setTimeout((()=>{we.current||Re(!1)}),e)},xe=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Y(null),void he({current:null});O?Ce():Re(!0),Y(o),he({current:o}),le.current&&clearTimeout(le.current)},Ne=()=>{x?Le(R||100):R?Le():Re(!1),re.current&&clearTimeout(re.current)},$e=({x:e,y:t})=>{var o;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};d({place:null!==(o=null==pe?void 0:pe.place)&&void 0!==o?o:p,offset:v,elementReference:r,tooltipReference:te.current,tooltipArrowReference:oe.current,strategy:b,middlewares:E,border:G}).then((e=>{ke(e)}))},Ie=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};$e(o),me.current=o},je=e=>{var t;if(!ie)return;const o=e.target;if(!o.isConnected)return;if(null===(t=te.current)||void 0===t?void 0:t.contains(o))return;[document.querySelector(`[id='${a}']`),...Se].some((e=>null==e?void 0:e.contains(o)))||(Re(!1),re.current&&clearTimeout(re.current))},Be=f(xe,50,!0),De=f(Ne,50,!0),qe=e=>{De.cancel(),Be(e)},ze=()=>{Be.cancel(),De()},Me=t.useCallback((()=>{var e,t;const o=null!==(e=null==pe?void 0:pe.position)&&void 0!==e?e:M;o?$e(o):k?me.current&&$e(me.current):(null==X?void 0:X.isConnected)&&d({place:null!==(t=null==pe?void 0:pe.place)&&void 0!==t?t:p,offset:v,elementReference:X,tooltipReference:te.current,tooltipArrowReference:oe.current,strategy:b,middlewares:E,border:G}).then((e=>{Ee.current&&ke(e)}))}),[ie,X,W,z,p,null==pe?void 0:pe.place,v,b,M,null==pe?void 0:pe.position,k]);t.useEffect((()=>{var e,t;const r=new Set(ye);Se.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${a}']`);l&&r.add({current:l});const n=()=>{Re(!1)},c=h(X),s=h(te.current);Oe.scroll&&(window.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n));let i=null;Oe.resize?window.addEventListener("resize",n):X&&te.current&&(i=o.autoUpdate(X,te.current,Me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Re(!1)};Oe.escape&&window.addEventListener("keydown",u),Oe.clickOutsideAnchor&&window.addEventListener("click",je);const d=[],p=e=>{ie&&(null==e?void 0:e.target)===X||xe(e)},f=e=>{ie&&(null==e?void 0:e.target)===X&&Ne()},v=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],m=["click","dblclick","mousedown","mouseup"];Object.entries(_e).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:qe}):m.includes(e)&&d.push({event:e,listener:p}))})),Object.entries(Te).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:ze}):m.includes(e)&&d.push({event:e,listener:f}))})),k&&d.push({event:"pointermove",listener:Ie});const y=()=>{we.current=!0},w=()=>{we.current=!1,Ne()};return x&&!Ae&&(null===(e=te.current)||void 0===e||e.addEventListener("mouseenter",y),null===(t=te.current)||void 0===t||t.addEventListener("mouseleave",w)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;Oe.scroll&&(window.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n)),Oe.resize?window.removeEventListener("resize",n):null==i||i(),Oe.clickOutsideAnchor&&window.removeEventListener("click",je),Oe.escape&&window.removeEventListener("keydown",u),x&&!Ae&&(null===(e=te.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=te.current)||void 0===t||t.removeEventListener("mouseleave",w)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[X,Me,ue,ye,Se,j,B,D,ge,O,R]),t.useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==pe?void 0:pe.anchorSelect)&&void 0!==e?e:u)&&void 0!==t?t:"";!o&&r&&(o=`[data-tooltip-id='${r.replace(/'/g,"\\'")}']`);const l=new MutationObserver((e=>{const t=[],l=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===r?t.push(e.target):e.oldValue===r&&l.push(e.target)}if("childList"===e.type){if(X){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{l.push(...t.filter((e=>e.matches(o)))),l.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(de(!1),Re(!1),Y(null),re.current&&clearTimeout(re.current),le.current&&clearTimeout(le.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||l.length)&&be((e=>[...e.filter((e=>!l.includes(e))),...t]))}));return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{l.disconnect()}}),[r,u,null==pe?void 0:pe.anchorSelect,X]),t.useEffect((()=>{Me()}),[Me]),t.useEffect((()=>{if(!(null==F?void 0:F.current))return()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>Me()))}));return e.observe(F.current),()=>{e.disconnect()}}),[W,null==F?void 0:F.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${a}']`),o=[...Se,t];X&&o.includes(X)||Y(null!==(e=Se[0])&&void 0!==e?e:t)}),[a,Se,X]),t.useEffect((()=>(V&&Re(!0),()=>{re.current&&clearTimeout(re.current),le.current&&clearTimeout(le.current)})),[]),t.useEffect((()=>{var e;let t=null!==(e=null==pe?void 0:pe.anchorSelect)&&void 0!==e?e:u;if(!t&&r&&(t=`[data-tooltip-id='${r.replace(/'/g,"\\'")}']`),t)try{const e=Array.from(document.querySelectorAll(t));be(e)}catch(e){be([])}}),[r,u,null==pe?void 0:pe.anchorSelect]),t.useEffect((()=>{re.current&&(clearTimeout(re.current),Ce(O))}),[O]);const He=null!==(ee=null==pe?void 0:pe.content)&&void 0!==ee?ee:W,Pe=ie&&Object.keys(ce.tooltipStyles).length>0;return t.useImperativeHandle(e,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}fe(null!=e?e:null),(null==e?void 0:e.delay)?Ce(e.delay):Re(!0)},close:e=>{(null==e?void 0:e.delay)?Le(e.delay):Re(!1)},activeAnchor:X,place:ce.place,isOpen:Boolean(ue&&!C&&He&&Pe)}))),ue&&!C&&He?n.default.createElement(g,{id:r,role:Q,className:c.default("react-tooltip",_.tooltip,T.tooltip,T[i],l,`react-tooltip__place-${ce.place}`,_[Pe?"show":"closing"],Pe?"react-tooltip__show":"react-tooltip__closing","fixed"===b&&_.fixed,x&&_.clickable),onTransitionEnd:e=>{ne.current&&clearTimeout(ne.current),ie||"opacity"!==e.propertyName||(de(!1),fe(null),null==P||P())},style:{...z,...ce.tooltipStyles,opacity:void 0!==Z&&Pe?Z:void 0},ref:te},He,n.default.createElement(g,{className:c.default("react-tooltip-arrow",_.arrow,T.arrow,s,L&&_.noArrow),style:{...ce.tooltipArrowStyles,background:J?`linear-gradient(to right bottom, transparent 50%, ${J} 50%)`:void 0},ref:oe})):null},R=({content:e})=>n.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),k=n.default.forwardRef((({id:e,anchorId:o,anchorSelect:r,content:l,html:s,render:i,className:a,classNameArrow:u,variant:d="dark",place:f="top",offset:v=10,wrapper:m="div",children:y=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:S="absolute",middlewares:b,delayShow:E=0,delayHide:g=0,float:_=!1,hidden:T=!1,noArrow:k=!1,clickable:C=!1,closeOnEsc:L=!1,closeOnScroll:x=!1,closeOnResize:N=!1,openEvents:$,closeEvents:I,globalCloseEvents:j,imperativeModeOnly:B=!1,style:D,position:q,isOpen:z,defaultIsOpen:M=!1,disableStyleInjection:H=!1,border:P,opacity:W,arrowColor:F,setIsOpen:U,afterShow:V,afterHide:K,role:X="tooltip"},Y)=>{const[G,Z]=t.useState(l),[J,Q]=t.useState(s),[ee,te]=t.useState(f),[oe,re]=t.useState(d),[le,ne]=t.useState(v),[ce,se]=t.useState(E),[ie,ae]=t.useState(g),[ue,de]=t.useState(_),[pe,fe]=t.useState(T),[ve,me]=t.useState(m),[ye,he]=t.useState(h),[we,Se]=t.useState(S),[be,Ee]=t.useState(null),[ge,Ae]=t.useState(null),_e=t.useRef(H),{anchorRefs:Te,activeAnchor:Oe}=A(e),Re=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null}return t}),{}),ke=e=>{const t={place:e=>{var t;te(null!==(t=e)&&void 0!==t?t:f)},content:e=>{Z(null!=e?e:l)},html:e=>{Q(null!=e?e:s)},variant:e=>{var t;re(null!==(t=e)&&void 0!==t?t:d)},offset:e=>{ne(null===e?v:Number(e))},wrapper:e=>{var t;me(null!==(t=e)&&void 0!==t?t:m)},events:e=>{const t=null==e?void 0:e.split(" ");he(null!=t?t:h)},"position-strategy":e=>{var t;Se(null!==(t=e)&&void 0!==t?t:S)},"delay-show":e=>{se(null===e?E:Number(e))},"delay-hide":e=>{ae(null===e?g:Number(e))},float:e=>{de(null===e?_:"true"===e)},hidden:e=>{fe(null===e?T:"true"===e)},"class-name":e=>{Ee(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};t.useEffect((()=>{Z(l)}),[l]),t.useEffect((()=>{Q(s)}),[s]),t.useEffect((()=>{te(f)}),[f]),t.useEffect((()=>{re(d)}),[d]),t.useEffect((()=>{ne(v)}),[v]),t.useEffect((()=>{se(E)}),[E]),t.useEffect((()=>{ae(g)}),[g]),t.useEffect((()=>{de(_)}),[_]),t.useEffect((()=>{fe(T)}),[T]),t.useEffect((()=>{Se(S)}),[S]),t.useEffect((()=>{_e.current!==H&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[H]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===H,disableBase:H}}))}),[]),t.useEffect((()=>{var t;const l=new Set(Te);let n=r;if(!n&&e&&(n=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),n)try{document.querySelectorAll(n).forEach((e=>{l.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const c=document.querySelector(`[id='${o}']`);if(c&&l.add({current:c}),!l.size)return()=>null;const s=null!==(t=null!=ge?ge:c)&&void 0!==t?t:Oe.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!s||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Re(s);ke(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(s){const e=Re(s);ke(e),i.observe(s,a)}return()=>{i.disconnect()}}),[Te,Oe,ge,o,r]),t.useEffect((()=>{(null==D?void 0:D.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),P&&!p("border",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`border\`.`),(null==D?void 0:D.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),W&&!p("opacity",`${W}`)&&console.warn(`[react-tooltip] "${W}" is not a valid \`opacity\`.`)}),[]);let Ce=y;const Le=t.useRef(null);if(i){const e=i({content:(null==ge?void 0:ge.getAttribute("data-tooltip-content"))||G||null,activeAnchor:ge});Ce=e?n.default.createElement("div",{ref:Le,className:"react-tooltip-content-wrapper"},e):null}else G&&(Ce=G);J&&(Ce=n.default.createElement(R,{content:J}));const xe={forwardRef:Y,id:e,anchorId:o,anchorSelect:r,className:c.default(a,be),classNameArrow:u,content:Ce,contentWrapperRef:Le,place:ee,variant:oe,offset:le,wrapper:ve,events:ye,openOnClick:w,positionStrategy:we,middlewares:b,delayShow:ce,delayHide:ie,float:ue,hidden:pe,noArrow:k,clickable:C,closeOnEsc:L,closeOnScroll:x,closeOnResize:N,openEvents:$,closeEvents:I,globalCloseEvents:j,imperativeModeOnly:B,style:D,position:q,isOpen:z,defaultIsOpen:M,border:P,opacity:W,arrowColor:F,setIsOpen:U,afterShow:V,afterHide:K,activeAnchor:ge,setActiveAnchor:e=>Ae(e),role:X};return n.default.createElement(O,{...xe})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||u({css:`: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;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:"core"}),e.detail.disableBase||u({css:` | ||
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.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)}`,type:"base"})})),e.Tooltip=k,e.TooltipProvider=({children:e})=>{const[o,r]=t.useState({[S]:new Set}),[l,c]=t.useState({[S]:{current:null}}),s=(e,...t)=>{r((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},i=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},a=t.useCallback(((e=S)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=l[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{c((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,l,s,i]),u=t.useMemo((()=>({getTooltipData:a})),[a]);return n.default.createElement(g.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:r,place:l,content:s,html:i,variant:a,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:y,detach:h}=A(e),w=t.useRef(null);return t.useEffect((()=>(y(w),()=>{h(w)})),[]),n.default.createElement("span",{ref:w,className:c.default("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":s,"data-tooltip-html":i,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":m},o)},e.removeStyle=function({type:e="base",id:t=i}={}){if(!a[e])return;"core"===e&&(t=s);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/dom"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/dom","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTooltip={},e.React,e.FloatingUIDOM,e.classNames)}(this,(function(e,t,o,l){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),s=r(l);const c="react-tooltip-core-styles",i="react-tooltip-base-styles",a={core:!1,base:!1};function u({css:e,id:t=i,type:o="base",ref:l}){var r,n;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(r=null===process||void 0===process?void 0:process.env)||void 0===r?void 0:r.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),l||(l={});const{insertAt:s}=l;if(document.getElementById(t))return;const u=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.id=t,d.type="text/css","top"===s&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[o]=!0}const d=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:l=null,place:r="top",offset:n=10,strategy:s="absolute",middlewares:c=[o.offset(Number(n)),o.flip({fallbackAxisSideDirection:"start"}),o.shift({padding:5})],border:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const a=c;return l?(a.push(o.arrow({element:l,padding:5})),o.computePosition(e,t,{placement:r,strategy:s,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:l})=>{var r,n;const s={left:`${e}px`,top:`${t}px`,border:i},{x:c,y:a}=null!==(r=l.arrow)&&void 0!==r?r:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:s,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):o.computePosition(e,t,{placement:"bottom",strategy:s,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))},p=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),f=(e,t,o)=>{let l=null;const r=function(...r){const n=()=>{l=null,o||e.apply(this,r)};o&&!l&&(e.apply(this,r),l=setTimeout(n,t)),o||(l&&clearTimeout(l),l=setTimeout(n,t))};return r.cancel=()=>{l&&(clearTimeout(l),l=null)},r},v=e=>null!==e&&!Array.isArray(e)&&"object"==typeof e,m=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,o)=>m(e,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!v(e)||!v(t))return e===t;const o=Object.keys(e),l=Object.keys(t);return o.length===l.length&&o.every((o=>m(e[o],t[o])))},y=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},h=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(y(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},w="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,b=e=>{e.current&&(clearTimeout(e.current),e.current=null)},S="DEFAULT_TOOLTIP_ID",E={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},g={getTooltipData:()=>E},A=t.createContext(g);function _(e=S){return t.useContext(A).getTooltipData(e)}var O={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},R={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const k=({forwardRef:e,id:l,className:r,classNameArrow:c,variant:i="dark",anchorId:a,anchorSelect:u,place:p="top",offset:v=10,events:y=["hover"],openOnClick:S=!1,positionStrategy:E="absolute",middlewares:g,wrapper:A,delayShow:k=0,delayHide:T=0,float:C=!1,hidden:L=!1,noArrow:x=!1,clickable:N=!1,closeOnEsc:$=!1,closeOnScroll:I=!1,closeOnResize:j=!1,openEvents:B,closeEvents:D,globalCloseEvents:q,imperativeModeOnly:z,style:M,position:H,afterShow:P,afterHide:W,content:F,contentWrapperRef:U,isOpen:V,defaultIsOpen:K=!1,setIsOpen:X,activeAnchor:Y,setActiveAnchor:G,border:Z,opacity:J,arrowColor:Q,role:ee="tooltip"})=>{var te;const oe=t.useRef(null),le=t.useRef(null),re=t.useRef(null),ne=t.useRef(null),se=t.useRef(null),[ce,ie]=t.useState({tooltipStyles:{},tooltipArrowStyles:{},place:p}),[ae,ue]=t.useState(!1),[de,pe]=t.useState(!1),[fe,ve]=t.useState(null),me=t.useRef(!1),ye=t.useRef(null),{anchorRefs:he,setActiveAnchor:we}=_(l),be=t.useRef(!1),[Se,Ee]=t.useState([]),ge=t.useRef(!1),Ae=S||y.includes("click"),_e=Ae||(null==B?void 0:B.click)||(null==B?void 0:B.dblclick)||(null==B?void 0:B.mousedown),Oe=B?{...B}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!B&&Ae&&Object.assign(Oe,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Re=D?{...D}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!D&&Ae&&Object.assign(Re,{mouseleave:!1,blur:!1,mouseout:!1});const ke=q?{...q}:{escape:$||!1,scroll:I||!1,resize:j||!1,clickOutsideAnchor:_e||!1};z&&(Object.assign(Oe,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Re,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(ke,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),w((()=>(ge.current=!0,()=>{ge.current=!1})),[]);const Te=e=>{ge.current&&(e&&pe(!0),setTimeout((()=>{ge.current&&(null==X||X(e),void 0===V&&ue(e))}),10))};t.useEffect((()=>{if(void 0===V)return()=>null;V&&pe(!0);const e=setTimeout((()=>{ue(V)}),10);return()=>{clearTimeout(e)}}),[V]),t.useEffect((()=>{if(ae!==me.current)if(b(se),me.current=ae,ae)null==P||P();else{const e=(e=>{const t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;const[,o,l]=t;return Number(o)*("ms"===l?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));se.current=setTimeout((()=>{pe(!1),ve(null),null==W||W()}),e+25)}}),[ae]);const Ce=e=>{ie((t=>m(t,e)?t:e))},Le=(e=k)=>{b(re),de?Te(!0):re.current=setTimeout((()=>{Te(!0)}),e)},xe=(e=T)=>{b(ne),ne.current=setTimeout((()=>{be.current||Te(!1)}),e)},Ne=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return G(null),void we({current:null});k?Le():Te(!0),G(o),we({current:o}),b(ne)},$e=()=>{N?xe(T||100):T?xe():Te(!1),b(re)},Ie=({x:e,y:t})=>{var o;const l={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};d({place:null!==(o=null==fe?void 0:fe.place)&&void 0!==o?o:p,offset:v,elementReference:l,tooltipReference:oe.current,tooltipArrowReference:le.current,strategy:E,middlewares:g,border:Z}).then((e=>{Ce(e)}))},je=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Ie(o),ye.current=o},Be=e=>{var t;if(!ae)return;const o=e.target;if(!o.isConnected)return;if(null===(t=oe.current)||void 0===t?void 0:t.contains(o))return;[document.querySelector(`[id='${a}']`),...Se].some((e=>null==e?void 0:e.contains(o)))||(Te(!1),b(re))},De=f(Ne,50,!0),qe=f($e,50,!0),ze=e=>{qe.cancel(),De(e)},Me=()=>{De.cancel(),qe()},He=t.useCallback((()=>{var e,t;const o=null!==(e=null==fe?void 0:fe.position)&&void 0!==e?e:H;o?Ie(o):C?ye.current&&Ie(ye.current):(null==Y?void 0:Y.isConnected)&&d({place:null!==(t=null==fe?void 0:fe.place)&&void 0!==t?t:p,offset:v,elementReference:Y,tooltipReference:oe.current,tooltipArrowReference:le.current,strategy:E,middlewares:g,border:Z}).then((e=>{ge.current&&Ce(e)}))}),[ae,Y,F,M,p,null==fe?void 0:fe.place,v,E,H,null==fe?void 0:fe.position,C]);t.useEffect((()=>{var e,t;const l=new Set(he);Se.forEach((e=>{l.add({current:e})}));const r=document.querySelector(`[id='${a}']`);r&&l.add({current:r});const n=()=>{Te(!1)},s=h(Y),c=h(oe.current);ke.scroll&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let i=null;ke.resize?window.addEventListener("resize",n):Y&&oe.current&&(i=o.autoUpdate(Y,oe.current,He,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Te(!1)};ke.escape&&window.addEventListener("keydown",u),ke.clickOutsideAnchor&&window.addEventListener("click",Be);const d=[],p=e=>{ae&&(null==e?void 0:e.target)===Y||Ne(e)},f=e=>{ae&&(null==e?void 0:e.target)===Y&&$e()},v=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],m=["click","dblclick","mousedown","mouseup"];Object.entries(Oe).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:ze}):m.includes(e)&&d.push({event:e,listener:p}))})),Object.entries(Re).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:Me}):m.includes(e)&&d.push({event:e,listener:f}))})),C&&d.push({event:"pointermove",listener:je});const y=()=>{be.current=!0},w=()=>{be.current=!1,$e()};return N&&!_e&&(null===(e=oe.current)||void 0===e||e.addEventListener("mouseenter",y),null===(t=oe.current)||void 0===t||t.addEventListener("mouseleave",w)),d.forEach((({event:e,listener:t})=>{l.forEach((o=>{var l;null===(l=o.current)||void 0===l||l.addEventListener(e,t)}))})),()=>{var e,t;ke.scroll&&(window.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n)),ke.resize?window.removeEventListener("resize",n):null==i||i(),ke.clickOutsideAnchor&&window.removeEventListener("click",Be),ke.escape&&window.removeEventListener("keydown",u),N&&!_e&&(null===(e=oe.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=oe.current)||void 0===t||t.removeEventListener("mouseleave",w)),d.forEach((({event:e,listener:t})=>{l.forEach((o=>{var l;null===(l=o.current)||void 0===l||l.removeEventListener(e,t)}))}))}}),[Y,He,de,he,Se,B,D,q,Ae,k,T]),t.useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:u)&&void 0!==t?t:"";!o&&l&&(o=`[data-tooltip-id='${l.replace(/'/g,"\\'")}']`);const r=new MutationObserver((e=>{const t=[],r=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===l?t.push(e.target):e.oldValue===l&&r.push(e.target)}if("childList"===e.type){if(Y){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{r.push(...t.filter((e=>e.matches(o)))),r.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,Y))&&(pe(!1),Te(!1),G(null),b(re),b(ne),!0)}))}if(o)try{const l=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...l.filter((e=>e.matches(o)))),t.push(...l.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||r.length)&&Ee((e=>[...e.filter((e=>!r.includes(e))),...t]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{r.disconnect()}}),[l,u,null==fe?void 0:fe.anchorSelect,Y]),t.useEffect((()=>{He()}),[He]),t.useEffect((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>He()))}));return e.observe(U.current),()=>{e.disconnect()}}),[F,null==U?void 0:U.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${a}']`),o=[...Se,t];Y&&o.includes(Y)||G(null!==(e=Se[0])&&void 0!==e?e:t)}),[a,Se,Y]),t.useEffect((()=>(K&&Te(!0),()=>{b(re),b(ne)})),[]),t.useEffect((()=>{var e;let t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:u;if(!t&&l&&(t=`[data-tooltip-id='${l.replace(/'/g,"\\'")}']`),t)try{const e=Array.from(document.querySelectorAll(t));Ee(e)}catch(e){Ee([])}}),[l,u,null==fe?void 0:fe.anchorSelect]),t.useEffect((()=>{re.current&&(b(re),Le(k))}),[k]);const Pe=null!==(te=null==fe?void 0:fe.content)&&void 0!==te?te:F,We=ae&&Object.keys(ce.tooltipStyles).length>0;return t.useImperativeHandle(e,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}ve(null!=e?e:null),(null==e?void 0:e.delay)?Le(e.delay):Te(!0)},close:e=>{(null==e?void 0:e.delay)?xe(e.delay):Te(!1)},activeAnchor:Y,place:ce.place,isOpen:Boolean(de&&!L&&Pe&&We)}))),de&&!L&&Pe?n.default.createElement(A,{id:l,role:ee,className:s.default("react-tooltip",O.tooltip,R.tooltip,R[i],r,`react-tooltip__place-${ce.place}`,O[We?"show":"closing"],We?"react-tooltip__show":"react-tooltip__closing","fixed"===E&&O.fixed,N&&O.clickable),onTransitionEnd:e=>{b(se),ae||"opacity"!==e.propertyName||(pe(!1),ve(null),null==W||W())},style:{...M,...ce.tooltipStyles,opacity:void 0!==J&&We?J:void 0},ref:oe},Pe,n.default.createElement(A,{className:s.default("react-tooltip-arrow",O.arrow,R.arrow,c,x&&O.noArrow),style:{...ce.tooltipArrowStyles,background:Q?`linear-gradient(to right bottom, transparent 50%, ${Q} 50%)`:void 0},ref:le})):null},T=({content:e})=>n.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),C=n.default.forwardRef((({id:e,anchorId:o,anchorSelect:l,content:r,html:c,render:i,className:a,classNameArrow:u,variant:d="dark",place:f="top",offset:v=10,wrapper:m="div",children:y=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:b="absolute",middlewares:S,delayShow:E=0,delayHide:g=0,float:A=!1,hidden:O=!1,noArrow:R=!1,clickable:C=!1,closeOnEsc:L=!1,closeOnScroll:x=!1,closeOnResize:N=!1,openEvents:$,closeEvents:I,globalCloseEvents:j,imperativeModeOnly:B=!1,style:D,position:q,isOpen:z,defaultIsOpen:M=!1,disableStyleInjection:H=!1,border:P,opacity:W,arrowColor:F,setIsOpen:U,afterShow:V,afterHide:K,role:X="tooltip"},Y)=>{const[G,Z]=t.useState(r),[J,Q]=t.useState(c),[ee,te]=t.useState(f),[oe,le]=t.useState(d),[re,ne]=t.useState(v),[se,ce]=t.useState(E),[ie,ae]=t.useState(g),[ue,de]=t.useState(A),[pe,fe]=t.useState(O),[ve,me]=t.useState(m),[ye,he]=t.useState(h),[we,be]=t.useState(b),[Se,Ee]=t.useState(null),[ge,Ae]=t.useState(null),_e=t.useRef(H),{anchorRefs:Oe,activeAnchor:Re}=_(e),ke=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var l;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(l=null==e?void 0:e.getAttribute(o))&&void 0!==l?l:null}return t}),{}),Te=e=>{const t={place:e=>{var t;te(null!==(t=e)&&void 0!==t?t:f)},content:e=>{Z(null!=e?e:r)},html:e=>{Q(null!=e?e:c)},variant:e=>{var t;le(null!==(t=e)&&void 0!==t?t:d)},offset:e=>{ne(null===e?v:Number(e))},wrapper:e=>{var t;me(null!==(t=e)&&void 0!==t?t:m)},events:e=>{const t=null==e?void 0:e.split(" ");he(null!=t?t:h)},"position-strategy":e=>{var t;be(null!==(t=e)&&void 0!==t?t:b)},"delay-show":e=>{ce(null===e?E:Number(e))},"delay-hide":e=>{ae(null===e?g:Number(e))},float:e=>{de(null===e?A:"true"===e)},hidden:e=>{fe(null===e?O:"true"===e)},"class-name":e=>{Ee(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var l;null===(l=t[e])||void 0===l||l.call(t,o)}))};t.useEffect((()=>{Z(r)}),[r]),t.useEffect((()=>{Q(c)}),[c]),t.useEffect((()=>{te(f)}),[f]),t.useEffect((()=>{le(d)}),[d]),t.useEffect((()=>{ne(v)}),[v]),t.useEffect((()=>{ce(E)}),[E]),t.useEffect((()=>{ae(g)}),[g]),t.useEffect((()=>{de(A)}),[A]),t.useEffect((()=>{fe(O)}),[O]),t.useEffect((()=>{be(b)}),[b]),t.useEffect((()=>{_e.current!==H&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[H]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===H,disableBase:H}}))}),[]),t.useEffect((()=>{var t;const r=new Set(Oe);let n=l;if(!n&&e&&(n=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),n)try{document.querySelectorAll(n).forEach((e=>{r.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const s=document.querySelector(`[id='${o}']`);if(s&&r.add({current:s}),!r.size)return()=>null;const c=null!==(t=null!=ge?ge:s)&&void 0!==t?t:Re.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=ke(c);Te(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=ke(c);Te(e),i.observe(c,a)}return()=>{i.disconnect()}}),[Oe,Re,ge,o,l]),t.useEffect((()=>{(null==D?void 0:D.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),P&&!p("border",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`border\`.`),(null==D?void 0:D.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),W&&!p("opacity",`${W}`)&&console.warn(`[react-tooltip] "${W}" is not a valid \`opacity\`.`)}),[]);let Ce=y;const Le=t.useRef(null);if(i){const e=i({content:(null==ge?void 0:ge.getAttribute("data-tooltip-content"))||G||null,activeAnchor:ge});Ce=e?n.default.createElement("div",{ref:Le,className:"react-tooltip-content-wrapper"},e):null}else G&&(Ce=G);J&&(Ce=n.default.createElement(T,{content:J}));const xe={forwardRef:Y,id:e,anchorId:o,anchorSelect:l,className:s.default(a,Se),classNameArrow:u,content:Ce,contentWrapperRef:Le,place:ee,variant:oe,offset:re,wrapper:ve,events:ye,openOnClick:w,positionStrategy:we,middlewares:S,delayShow:se,delayHide:ie,float:ue,hidden:pe,noArrow:R,clickable:C,closeOnEsc:L,closeOnScroll:x,closeOnResize:N,openEvents:$,closeEvents:I,globalCloseEvents:j,imperativeModeOnly:B,style:D,position:q,isOpen:z,defaultIsOpen:M,border:P,opacity:W,arrowColor:F,setIsOpen:U,afterShow:V,afterHide:K,activeAnchor:ge,setActiveAnchor:e=>Ae(e),role:X};return n.default.createElement(k,{...xe})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||u({css:`: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;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:"core"}),e.detail.disableBase||u({css:` | ||
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.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)}`,type:"base"})})),e.Tooltip=C,e.TooltipProvider=({children:e})=>{const[o,l]=t.useState({[S]:new Set}),[r,s]=t.useState({[S]:{current:null}}),c=(e,...t)=>{l((o=>{var l;const r=null!==(l=o[e])&&void 0!==l?l:new Set;return t.forEach((e=>r.add(e))),{...o,[e]:new Set(r)}}))},i=(e,...t)=>{l((o=>{const l=o[e];return l?(t.forEach((e=>l.delete(e))),{...o}):o}))},a=t.useCallback(((e=S)=>{var t,l;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(l=r[e])&&void 0!==l?l:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var l;return(null===(l=o[e])||void 0===l?void 0:l.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,r,c,i]),u=t.useMemo((()=>({getTooltipData:a})),[a]);return n.default.createElement(A.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:l,place:r,content:c,html:i,variant:a,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:y,detach:h}=_(e),w=t.useRef(null);return t.useEffect((()=>(y(w),()=>{h(w)})),[]),n.default.createElement("span",{ref:w,className:s.default("react-tooltip-wrapper",l),"data-tooltip-place":r,"data-tooltip-content":c,"data-tooltip-html":i,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":m},o)},e.removeStyle=function({type:e="base",id:t=i}={}){if(!a[e])return;"core"===e&&(t=c);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "react-tooltip", | ||
"version": "5.27.0", | ||
"version": "5.27.1", | ||
"description": "react tooltip component", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
869069
5481