react-tooltip 5.21.5 → 5.21.6

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.
@@ -4,5 +4,5 @@
4
4
  * @copyright ReactTooltip Team
5
5
  * @license MIT
6
6
  */
7
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@floating-ui/dom"),r=require("classnames");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e),n=o(r);const s="react-tooltip-core-styles",c="react-tooltip-base-styles",a={core:!1,base:!1};function i({css:e,id:t=c,type:r="base",ref:o}){var l,n;if(!e||"undefined"==typeof document||a[r])return;if("core"===r&&"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"!==r&&"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"===r&&(t=s),o||(o={});const{insertAt:i}=o;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"===i&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[r]=!0}const u=(e,t,r)=>{let o=null;return function(...l){const n=()=>{o=null,r||e.apply(this,l)};r&&!o&&(e.apply(this,l),o=setTimeout(n,t)),r||(o&&clearTimeout(o),o=setTimeout(n,t))}},d="DEFAULT_TOOLTIP_ID",p={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},f={getTooltipData:()=>p},v=e.createContext(f);function m(t=d){return e.useContext(v).getTooltipData(t)}const y="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,h=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const r=t.getPropertyValue(e);return"auto"===r||"scroll"===r}))},w=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(h(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},S=async({elementReference:e=null,tooltipReference:r=null,tooltipArrowReference:o=null,place:l="top",offset:n=10,strategy:s="absolute",middlewares:c=[t.offset(Number(n)),t.flip(),t.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===r)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const i=c;return o?(i.push(t.arrow({element:o,padding:5})),t.computePosition(e,r,{placement:l,strategy:s,middleware:i}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const s={left:`${e}px`,top:`${t}px`,border:a},{x:c,y:i}=null!==(l=o.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==n?n:"bottom",d=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.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!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:r}}))):t.computePosition(e,r,{placement:"bottom",strategy:s,middleware:i}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var E="core-styles-module_tooltip__3vRRp",b="core-styles-module_fixed__pcSol",_="core-styles-module_arrow__cvMwQ",g="core-styles-module_noArrow__xock6",A="core-styles-module_clickable__ZuTTB",T="core-styles-module_show__Nt9eE",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 O=({id:r,className:o,classNameArrow:s,variant:c="dark",anchorId:a,anchorSelect:i,place:d="top",offset:p=10,events:f=["hover"],openOnClick:v=!1,positionStrategy:h="absolute",middlewares:O,wrapper:L,delayShow:x=0,delayHide:C=0,float:k=!1,hidden:N=!1,noArrow:$=!1,clickable:I=!1,closeOnEsc:j=!1,closeOnScroll:B=!1,closeOnResize:D=!1,style:q,position:H,afterShow:z,afterHide:P,content:M,contentWrapperRef:W,isOpen:U,setIsOpen:F,activeAnchor:K,setActiveAnchor:X,border:Y,opacity:V,arrowColor:Z})=>{const G=e.useRef(null),J=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),[te,re]=e.useState(d),[oe,le]=e.useState({}),[ne,se]=e.useState({}),[ce,ae]=e.useState(!1),[ie,ue]=e.useState(!1),de=e.useRef(!1),pe=e.useRef(null),{anchorRefs:fe,setActiveAnchor:ve}=m(r),me=e.useRef(!1),[ye,he]=e.useState([]),we=e.useRef(!1),Se=v||f.includes("click");y((()=>(we.current=!0,()=>{we.current=!1})),[]),e.useEffect((()=>{if(!ce){const e=setTimeout((()=>{ue(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ce]);const Ee=e=>{we.current&&(e&&ue(!0),setTimeout((()=>{we.current&&(null==F||F(e),void 0===U&&ae(e))}),10))};e.useEffect((()=>{if(void 0===U)return()=>null;U&&ue(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),e.useEffect((()=>{ce!==de.current&&(de.current=ce,ce?null==z||z():null==P||P())}),[ce]);const be=(e=C)=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout((()=>{me.current||Ee(!1)}),e)},_e=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return X(null),void ve({current:null});x?(Q.current&&clearTimeout(Q.current),Q.current=setTimeout((()=>{Ee(!0)}),x)):Ee(!0),X(r),ve({current:r}),ee.current&&clearTimeout(ee.current)},ge=()=>{I?be(C||100):C?be():Ee(!1),Q.current&&clearTimeout(Q.current)},Ae=({x:e,y:t})=>{S({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:G.current,tooltipArrowReference:J.current,strategy:h,middlewares:O,border:Y}).then((e=>{Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),re(e.place)}))},Te=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Ae(r),pe.current=r},Re=e=>{_e(e),C&&be()},Oe=e=>{var t;[document.querySelector(`[id='${a}']`),...ye].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=G.current)||void 0===t?void 0:t.contains(e.target))||(Ee(!1),Q.current&&clearTimeout(Q.current))},Le=u(_e,50,!0),xe=u(ge,50,!0),Ce=e.useCallback((()=>{H?Ae(H):k?pe.current&&Ae(pe.current):S({place:d,offset:p,elementReference:K,tooltipReference:G.current,tooltipArrowReference:J.current,strategy:h,middlewares:O,border:Y}).then((e=>{we.current&&(Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),re(e.place))}))}),[ce,K,M,q,d,p,h,H,k]);e.useEffect((()=>{var e,r;const o=new Set(fe);ye.forEach((e=>{o.add({current:e})}));const l=document.querySelector(`[id='${a}']`);l&&o.add({current:l});const n=()=>{Ee(!1)},s=w(K),c=w(G.current);B&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let i=null;D?window.addEventListener("resize",n):K&&G.current&&(i=t.autoUpdate(K,G.current,Ce,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ee(!1)};j&&window.addEventListener("keydown",u);const d=[];Se?(window.addEventListener("click",Oe),d.push({event:"click",listener:Re})):(d.push({event:"mouseenter",listener:Le},{event:"mouseleave",listener:xe},{event:"focus",listener:Le},{event:"blur",listener:xe}),k&&d.push({event:"mousemove",listener:Te}));const p=()=>{me.current=!0},f=()=>{me.current=!1,ge()};return I&&!Se&&(null===(e=G.current)||void 0===e||e.addEventListener("mouseenter",p),null===(r=G.current)||void 0===r||r.addEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{o.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;B&&(window.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n)),D?window.removeEventListener("resize",n):null==i||i(),Se&&window.removeEventListener("click",Oe),j&&window.removeEventListener("keydown",u),I&&!Se&&(null===(e=G.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=G.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{o.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[K,Ce,ie,fe,ye,j,f]),e.useEffect((()=>{let e=null!=i?i:"";!e&&r&&(e=`[data-tooltip-id='${r}']`);const t=new MutationObserver((t=>{const o=[];t.forEach((t=>{if("attributes"===t.type&&"data-tooltip-id"===t.attributeName){t.target.getAttribute("data-tooltip-id")===r&&o.push(t.target)}if("childList"===t.type&&(K&&[...t.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,K))&&(ue(!1),Ee(!1),X(null),Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current),!0)})),e))try{const r=[...t.addedNodes].filter((e=>1===e.nodeType));o.push(...r.filter((t=>t.matches(e)))),o.push(...r.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&he((e=>[...e,...o]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{t.disconnect()}}),[r,i,K]),e.useEffect((()=>{Ce()}),[Ce]),e.useEffect((()=>{if(!(null==W?void 0:W.current))return()=>null;const e=new ResizeObserver((()=>{Ce()}));return e.observe(W.current),()=>{e.disconnect()}}),[M,null==W?void 0:W.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...ye,t];K&&r.includes(K)||X(null!==(e=ye[0])&&void 0!==e?e:t)}),[a,ye,K]),e.useEffect((()=>()=>{Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current)}),[]),e.useEffect((()=>{let e=i;if(!e&&r&&(e=`[data-tooltip-id='${r}']`),e)try{const t=Array.from(document.querySelectorAll(e));he(t)}catch(e){he([])}}),[r,i]);const ke=!N&&M&&ce&&Object.keys(oe).length>0;return ie?l.default.createElement(L,{id:r,role:"tooltip",className:n.default("react-tooltip",E,R.tooltip,R[c],o,`react-tooltip__place-${te}`,{"react-tooltip__show":ke,[T]:ke,[b]:"fixed"===h,[A]:I}),style:{...q,...oe,opacity:void 0!==V&&ke?V:void 0},ref:G},M,l.default.createElement(L,{className:n.default("react-tooltip-arrow",_,R.arrow,s,{[g]:$}),style:{...ne,background:Z?`linear-gradient(to right bottom, transparent 50%, ${Z} 50%)`:void 0},ref:J})):null},L=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||i({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}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.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{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||i({css:`
8
- .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"})})),exports.Tooltip=({id:t,anchorId:r,anchorSelect:o,content:n,html:s,render:c,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:y=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:_=!1,hidden:g=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:x=!1,closeOnResize:C=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:z})=>{const[P,M]=e.useState(n),[W,U]=e.useState(s),[F,K]=e.useState(d),[X,Y]=e.useState(u),[V,Z]=e.useState(p),[G,J]=e.useState(E),[Q,ee]=e.useState(b),[te,re]=e.useState(_),[oe,le]=e.useState(g),[ne,se]=e.useState(f),[ce,ae]=e.useState(y),[ie,ue]=e.useState(w),[de,pe]=e.useState(null),fe=e.useRef(I),{anchorRefs:ve,activeAnchor:me}=m(t),ye=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),he=e=>{const t={place:e=>{var t;K(null!==(t=e)&&void 0!==t?t:d)},content:e=>{M(null!=e?e:n)},html:e=>{U(null!=e?e:s)},variant:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{Z(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ae(null!=t?t:y)},"position-strategy":e=>{var t;ue(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{J(null===e?E:Number(e))},"delay-hide":e=>{ee(null===e?b:Number(e))},float:e=>{re(null===e?_:"true"===e)},hidden:e=>{le(null===e?g:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};e.useEffect((()=>{M(n)}),[n]),e.useEffect((()=>{U(s)}),[s]),e.useEffect((()=>{K(d)}),[d]),e.useEffect((()=>{Y(u)}),[u]),e.useEffect((()=>{Z(p)}),[p]),e.useEffect((()=>{J(E)}),[E]),e.useEffect((()=>{ee(b)}),[b]),e.useEffect((()=>{re(_)}),[_]),e.useEffect((()=>{le(g)}),[g]),e.useEffect((()=>{ue(w)}),[w]),e.useEffect((()=>{fe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),e.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),e.useEffect((()=>{var e;const l=new Set(ve);let n=o;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),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 s=document.querySelector(`[id='${r}']`);if(s&&l.add({current:s}),!l.size)return()=>null;const c=null!==(e=null!=de?de:s)&&void 0!==e?e:me.current,a=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 r=ye(c);he(r)}))})),i={attributes:!0,childList:!1,subtree:!1};if(c){const e=ye(c);he(e),a.observe(c,i)}return()=>{a.disconnect()}}),[ve,me,de,r,o]),e.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let we=v;const Se=e.useRef(null);if(c){const e=c({content:null!=P?P:null,activeAnchor:de});we=e?l.default.createElement("div",{ref:Se,className:"react-tooltip-content-wrapper"},e):null}else P&&(we=P);W&&(we=l.default.createElement(L,{content:W}));const Ee={id:t,anchorId:r,anchorSelect:o,className:a,classNameArrow:i,content:we,contentWrapperRef:Se,place:F,variant:X,offset:V,wrapper:ne,events:ce,openOnClick:h,positionStrategy:ie,middlewares:S,delayShow:G,delayHide:Q,float:te,hidden:oe,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:x,closeOnResize:C,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:z,activeAnchor:de,setActiveAnchor:e=>pe(e)};return l.default.createElement(O,{...Ee})},exports.TooltipProvider=({children:t})=>{const[r,o]=e.useState({[d]:new Set}),[n,s]=e.useState({[d]:{current:null}}),c=(e,...t)=>{o((r=>{var o;const l=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>l.add(e))),{...r,[e]:new Set(l)}}))},a=(e,...t)=>{o((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},i=e.useCallback(((e=d)=>{var t,o;return{anchorRefs:null!==(t=r[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=n[e])&&void 0!==o?o:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{s((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[r,n,c,a]),u=e.useMemo((()=>({getTooltipData:i})),[i]);return l.default.createElement(v.Provider,{value:u},t)},exports.TooltipWrapper=({tooltipId:t,children:r,className:o,place:s,content:c,html:a,variant:i,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:y})=>{const{attach:h,detach:w}=m(t),S=e.useRef(null);return e.useEffect((()=>(h(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:n.default("react-tooltip-wrapper",o),"data-tooltip-place":s,"data-tooltip-content":c,"data-tooltip-html":a,"data-tooltip-variant":i,"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":y},r)},exports.removeStyle=function({type:e="base",id:t=c}={}){if(!a[e])return;"core"===e&&(t=s);const r=document.getElementById(t);"style"===(null==r?void 0:r.tagName)?null==r||r.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1};
7
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@floating-ui/dom"),r=require("classnames");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e),n=o(r);const s="react-tooltip-core-styles",c="react-tooltip-base-styles",a={core:!1,base:!1};function i({css:e,id:t=c,type:r="base",ref:o}){var l,n;if(!e||"undefined"==typeof document||a[r])return;if("core"===r&&"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"!==r&&"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"===r&&(t=s),o||(o={});const{insertAt:i}=o;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"===i&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[r]=!0}const u=(e,t,r)=>{let o=null;return function(...l){const n=()=>{o=null,r||e.apply(this,l)};r&&!o&&(e.apply(this,l),o=setTimeout(n,t)),r||(o&&clearTimeout(o),o=setTimeout(n,t))}},d="DEFAULT_TOOLTIP_ID",p={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},f={getTooltipData:()=>p},v=e.createContext(f);function m(t=d){return e.useContext(v).getTooltipData(t)}const y="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,h=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const r=t.getPropertyValue(e);return"auto"===r||"scroll"===r}))},w=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(h(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},S=async({elementReference:e=null,tooltipReference:r=null,tooltipArrowReference:o=null,place:l="top",offset:n=10,strategy:s="absolute",middlewares:c=[t.offset(Number(n)),t.flip(),t.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===r)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const i=c;return o?(i.push(t.arrow({element:o,padding:5})),t.computePosition(e,r,{placement:l,strategy:s,middleware:i}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const s={left:`${e}px`,top:`${t}px`,border:a},{x:c,y:i}=null!==(l=o.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==n?n:"bottom",d=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.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!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:r}}))):t.computePosition(e,r,{placement:"bottom",strategy:s,middleware:i}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var E="core-styles-module_tooltip__3vRRp",b="core-styles-module_fixed__pcSol",_="core-styles-module_arrow__cvMwQ",g="core-styles-module_noArrow__xock6",A="core-styles-module_clickable__ZuTTB",T="core-styles-module_show__Nt9eE",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 O=({id:r,className:o,classNameArrow:s,variant:c="dark",anchorId:a,anchorSelect:i,place:d="top",offset:p=10,events:f=["hover"],openOnClick:v=!1,positionStrategy:h="absolute",middlewares:O,wrapper:L,delayShow:x=0,delayHide:C=0,float:k=!1,hidden:N=!1,noArrow:$=!1,clickable:I=!1,closeOnEsc:j=!1,closeOnScroll:B=!1,closeOnResize:q=!1,style:D,position:H,afterShow:z,afterHide:M,content:P,contentWrapperRef:W,isOpen:U,setIsOpen:F,activeAnchor:K,setActiveAnchor:X,border:Y,opacity:V,arrowColor:Z})=>{const G=e.useRef(null),J=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),[te,re]=e.useState(d),[oe,le]=e.useState({}),[ne,se]=e.useState({}),[ce,ae]=e.useState(!1),[ie,ue]=e.useState(!1),de=e.useRef(!1),pe=e.useRef(null),{anchorRefs:fe,setActiveAnchor:ve}=m(r),me=e.useRef(!1),[ye,he]=e.useState([]),we=e.useRef(!1),Se=v||f.includes("click");y((()=>(we.current=!0,()=>{we.current=!1})),[]),e.useEffect((()=>{if(!ce){const e=setTimeout((()=>{ue(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ce]);const Ee=e=>{we.current&&(e&&ue(!0),setTimeout((()=>{we.current&&(null==F||F(e),void 0===U&&ae(e))}),10))};e.useEffect((()=>{if(void 0===U)return()=>null;U&&ue(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),e.useEffect((()=>{ce!==de.current&&(de.current=ce,ce?null==z||z():null==M||M())}),[ce]);const be=(e=C)=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout((()=>{me.current||Ee(!1)}),e)},_e=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return X(null),void ve({current:null});x?(Q.current&&clearTimeout(Q.current),Q.current=setTimeout((()=>{Ee(!0)}),x)):Ee(!0),X(r),ve({current:r}),ee.current&&clearTimeout(ee.current)},ge=()=>{I?be(C||100):C?be():Ee(!1),Q.current&&clearTimeout(Q.current)},Ae=({x:e,y:t})=>{S({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:G.current,tooltipArrowReference:J.current,strategy:h,middlewares:O,border:Y}).then((e=>{Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),re(e.place)}))},Te=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Ae(r),pe.current=r},Re=e=>{_e(e),C&&be()},Oe=e=>{var t;[document.querySelector(`[id='${a}']`),...ye].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=G.current)||void 0===t?void 0:t.contains(e.target))||(Ee(!1),Q.current&&clearTimeout(Q.current))},Le=u(_e,50,!0),xe=u(ge,50,!0),Ce=e.useCallback((()=>{H?Ae(H):k?pe.current&&Ae(pe.current):(null==K?void 0:K.isConnected)&&S({place:d,offset:p,elementReference:K,tooltipReference:G.current,tooltipArrowReference:J.current,strategy:h,middlewares:O,border:Y}).then((e=>{we.current&&(Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),re(e.place))}))}),[ce,K,P,D,d,p,h,H,k]);e.useEffect((()=>{var e,r;const o=new Set(fe);ye.forEach((e=>{o.add({current:e})}));const l=document.querySelector(`[id='${a}']`);l&&o.add({current:l});const n=()=>{Ee(!1)},s=w(K),c=w(G.current);B&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let i=null;q?window.addEventListener("resize",n):K&&G.current&&(i=t.autoUpdate(K,G.current,Ce,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ee(!1)};j&&window.addEventListener("keydown",u);const d=[];Se?(window.addEventListener("click",Oe),d.push({event:"click",listener:Re})):(d.push({event:"mouseenter",listener:Le},{event:"mouseleave",listener:xe},{event:"focus",listener:Le},{event:"blur",listener:xe}),k&&d.push({event:"mousemove",listener:Te}));const p=()=>{me.current=!0},f=()=>{me.current=!1,ge()};return I&&!Se&&(null===(e=G.current)||void 0===e||e.addEventListener("mouseenter",p),null===(r=G.current)||void 0===r||r.addEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{o.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;B&&(window.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n)),q?window.removeEventListener("resize",n):null==i||i(),Se&&window.removeEventListener("click",Oe),j&&window.removeEventListener("keydown",u),I&&!Se&&(null===(e=G.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=G.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{o.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[K,Ce,ie,fe,ye,j,f]),e.useEffect((()=>{let e=null!=i?i:"";!e&&r&&(e=`[data-tooltip-id='${r}']`);const t=new MutationObserver((t=>{const o=[],l=[];t.forEach((t=>{if("attributes"===t.type&&"data-tooltip-id"===t.attributeName){t.target.getAttribute("data-tooltip-id")===r&&o.push(t.target)}if("childList"===t.type){if(K){const r=[...t.removedNodes].filter((e=>1===e.nodeType));if(e)try{l.push(...r.filter((t=>t.matches(e)))),l.push(...r.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}r.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,K))&&(ue(!1),Ee(!1),X(null),Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current),!0)}))}if(e)try{const r=[...t.addedNodes].filter((e=>1===e.nodeType));o.push(...r.filter((t=>t.matches(e)))),o.push(...r.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}}})),(o.length||l.length)&&he((e=>[...e.filter((e=>l.includes(e))),...o]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{t.disconnect()}}),[r,i,K]),e.useEffect((()=>{Ce()}),[Ce]),e.useEffect((()=>{if(!(null==W?void 0:W.current))return()=>null;const e=new ResizeObserver((()=>{Ce()}));return e.observe(W.current),()=>{e.disconnect()}}),[P,null==W?void 0:W.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...ye,t];K&&r.includes(K)||X(null!==(e=ye[0])&&void 0!==e?e:t)}),[a,ye,K]),e.useEffect((()=>()=>{Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current)}),[]),e.useEffect((()=>{let e=i;if(!e&&r&&(e=`[data-tooltip-id='${r}']`),e)try{const t=Array.from(document.querySelectorAll(e));he(t)}catch(e){he([])}}),[r,i]);const ke=!N&&P&&ce&&Object.keys(oe).length>0;return ie?l.default.createElement(L,{id:r,role:"tooltip",className:n.default("react-tooltip",E,R.tooltip,R[c],o,`react-tooltip__place-${te}`,{"react-tooltip__show":ke,[T]:ke,[b]:"fixed"===h,[A]:I}),style:{...D,...oe,opacity:void 0!==V&&ke?V:void 0},ref:G},P,l.default.createElement(L,{className:n.default("react-tooltip-arrow",_,R.arrow,s,{[g]:$}),style:{...ne,background:Z?`linear-gradient(to right bottom, transparent 50%, ${Z} 50%)`:void 0},ref:J})):null},L=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||i({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}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.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{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||i({css:`
8
+ .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"})})),exports.Tooltip=({id:t,anchorId:r,anchorSelect:o,content:n,html:s,render:c,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:y=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:_=!1,hidden:g=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:x=!1,closeOnResize:C=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z})=>{const[M,P]=e.useState(n),[W,U]=e.useState(s),[F,K]=e.useState(d),[X,Y]=e.useState(u),[V,Z]=e.useState(p),[G,J]=e.useState(E),[Q,ee]=e.useState(b),[te,re]=e.useState(_),[oe,le]=e.useState(g),[ne,se]=e.useState(f),[ce,ae]=e.useState(y),[ie,ue]=e.useState(w),[de,pe]=e.useState(null),fe=e.useRef(I),{anchorRefs:ve,activeAnchor:me}=m(t),ye=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),he=e=>{const t={place:e=>{var t;K(null!==(t=e)&&void 0!==t?t:d)},content:e=>{P(null!=e?e:n)},html:e=>{U(null!=e?e:s)},variant:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{Z(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ae(null!=t?t:y)},"position-strategy":e=>{var t;ue(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{J(null===e?E:Number(e))},"delay-hide":e=>{ee(null===e?b:Number(e))},float:e=>{re(null===e?_:"true"===e)},hidden:e=>{le(null===e?g:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};e.useEffect((()=>{P(n)}),[n]),e.useEffect((()=>{U(s)}),[s]),e.useEffect((()=>{K(d)}),[d]),e.useEffect((()=>{Y(u)}),[u]),e.useEffect((()=>{Z(p)}),[p]),e.useEffect((()=>{J(E)}),[E]),e.useEffect((()=>{ee(b)}),[b]),e.useEffect((()=>{re(_)}),[_]),e.useEffect((()=>{le(g)}),[g]),e.useEffect((()=>{ue(w)}),[w]),e.useEffect((()=>{fe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),e.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),e.useEffect((()=>{var e;const l=new Set(ve);let n=o;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),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 s=document.querySelector(`[id='${r}']`);if(s&&l.add({current:s}),!l.size)return()=>null;const c=null!==(e=null!=de?de:s)&&void 0!==e?e:me.current,a=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 r=ye(c);he(r)}))})),i={attributes:!0,childList:!1,subtree:!1};if(c){const e=ye(c);he(e),a.observe(c,i)}return()=>{a.disconnect()}}),[ve,me,de,r,o]),e.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let we=v;const Se=e.useRef(null);if(c){const e=c({content:null!=M?M:null,activeAnchor:de});we=e?l.default.createElement("div",{ref:Se,className:"react-tooltip-content-wrapper"},e):null}else M&&(we=M);W&&(we=l.default.createElement(L,{content:W}));const Ee={id:t,anchorId:r,anchorSelect:o,className:a,classNameArrow:i,content:we,contentWrapperRef:Se,place:F,variant:X,offset:V,wrapper:ne,events:ce,openOnClick:h,positionStrategy:ie,middlewares:S,delayShow:G,delayHide:Q,float:te,hidden:oe,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:x,closeOnResize:C,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z,activeAnchor:de,setActiveAnchor:e=>pe(e)};return l.default.createElement(O,{...Ee})},exports.TooltipProvider=({children:t})=>{const[r,o]=e.useState({[d]:new Set}),[n,s]=e.useState({[d]:{current:null}}),c=(e,...t)=>{o((r=>{var o;const l=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>l.add(e))),{...r,[e]:new Set(l)}}))},a=(e,...t)=>{o((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},i=e.useCallback(((e=d)=>{var t,o;return{anchorRefs:null!==(t=r[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=n[e])&&void 0!==o?o:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{s((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[r,n,c,a]),u=e.useMemo((()=>({getTooltipData:i})),[i]);return l.default.createElement(v.Provider,{value:u},t)},exports.TooltipWrapper=({tooltipId:t,children:r,className:o,place:s,content:c,html:a,variant:i,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:y})=>{const{attach:h,detach:w}=m(t),S=e.useRef(null);return e.useEffect((()=>(h(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:n.default("react-tooltip-wrapper",o),"data-tooltip-place":s,"data-tooltip-content":c,"data-tooltip-html":a,"data-tooltip-variant":i,"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":y},r)},exports.removeStyle=function({type:e="base",id:t=c}={}){if(!a[e])return;"core"===e&&(t=s);const r=document.getElementById(t);"style"===(null==r?void 0:r.tagName)?null==r||r.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1};
@@ -1 +1 @@
1
- {"version":3,"file":"react-tooltip.min.cjs","sources":["../src/utils/handle-style.ts","../src/utils/debounce.ts","../src/components/TooltipProvider/TooltipProvider.tsx","../src/components/TooltipProvider/TooltipWrapper.tsx","../src/utils/use-isomorphic-layout-effect.ts","../src/utils/get-scroll-parent.ts","../src/utils/compute-positions.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/TooltipContent/TooltipContent.tsx","../src/index.tsx","../src/components/TooltipController/TooltipController.tsx"],"sourcesContent":["// This is the ID for the core styles of ReactTooltip\nconst REACT_TOOLTIP_CORE_STYLES_ID = 'react-tooltip-core-styles'\n// This is the ID for the visual styles of ReactTooltip\nconst REACT_TOOLTIP_BASE_STYLES_ID = 'react-tooltip-base-styles'\n\nconst injected = {\n core: false,\n base: false,\n}\n\nfunction injectStyle({\n css,\n id = REACT_TOOLTIP_BASE_STYLES_ID,\n type = 'base',\n ref,\n}: {\n css: string\n id?: string\n type?: 'core' | 'base'\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n}) {\n if (!css || typeof document === 'undefined' || injected[type]) {\n return\n }\n\n if (\n type === 'core' &&\n typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`\n process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES\n ) {\n return\n }\n\n if (\n type !== 'base' &&\n typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`\n process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES\n ) {\n return\n }\n\n if (type === 'core') {\n // eslint-disable-next-line no-param-reassign\n id = REACT_TOOLTIP_CORE_STYLES_ID\n }\n\n if (!ref) {\n // eslint-disable-next-line no-param-reassign\n ref = {}\n }\n const { insertAt } = ref\n\n if (document.getElementById(id)) {\n // this should never happen because of `injected[type]`\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[react-tooltip] Element with id '${id}' already exists. Call \\`removeStyle()\\` first`,\n )\n }\n return\n }\n\n const head = document.head || document.getElementsByTagName('head')[0]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const style: any = document.createElement('style')\n style.id = id\n style.type = 'text/css'\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild)\n } else {\n head.appendChild(style)\n }\n } else {\n head.appendChild(style)\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css\n } else {\n style.appendChild(document.createTextNode(css))\n }\n\n injected[type] = true\n}\n\n/**\n * @deprecated Use the `disableStyleInjection` tooltip prop instead.\n * See https://react-tooltip.com/docs/examples/styling#disabling-reacttooltip-css\n */\nfunction removeStyle({\n type = 'base',\n id = REACT_TOOLTIP_BASE_STYLES_ID,\n}: {\n type?: 'core' | 'base'\n id?: string\n} = {}) {\n if (!injected[type]) {\n return\n }\n\n if (type === 'core') {\n // eslint-disable-next-line no-param-reassign\n id = REACT_TOOLTIP_CORE_STYLES_ID\n }\n\n const style = document.getElementById(id)\n if (style?.tagName === 'style') {\n style?.remove()\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[react-tooltip] Failed to remove 'style' element with id '${id}'. Call \\`injectStyle()\\` first`,\n )\n }\n\n injected[type] = false\n}\n\nexport { injectStyle, removeStyle }\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * This function debounce the received function\n * @param { function } \tfunc\t\t\t\tFunction to be debounced\n * @param { number } \t\twait\t\t\t\tTime to wait before execut the function\n * @param { boolean } \timmediate\t\tParam to define if the function will be executed immediately\n */\nconst debounce = (func: (...args: any[]) => void, wait?: number, immediate?: boolean) => {\n let timeout: NodeJS.Timeout | null = null\n\n return function debounced(this: typeof func, ...args: any[]) {\n const later = () => {\n timeout = null\n if (!immediate) {\n func.apply(this, args)\n }\n }\n\n if (immediate && !timeout) {\n /**\n * there's not need to clear the timeout\n * since we expect it to resolve and set `timeout = null`\n */\n func.apply(this, args)\n timeout = setTimeout(later, wait)\n }\n\n if (!immediate) {\n if (timeout) {\n clearTimeout(timeout)\n }\n timeout = setTimeout(later, wait)\n }\n }\n}\n\nexport default debounce\n","import React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\n\nimport type {\n AnchorRef,\n TooltipContextData,\n TooltipContextDataWrapper,\n} from './TooltipProviderTypes'\n\nconst DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID'\nconst DEFAULT_CONTEXT_DATA: TooltipContextData = {\n anchorRefs: new Set(),\n activeAnchor: { current: null },\n attach: () => {\n /* attach anchor element */\n },\n detach: () => {\n /* detach anchor element */\n },\n setActiveAnchor: () => {\n /* set active anchor */\n },\n}\n\nconst DEFAULT_CONTEXT_DATA_WRAPPER: TooltipContextDataWrapper = {\n getTooltipData: () => DEFAULT_CONTEXT_DATA,\n}\n\nconst TooltipContext = createContext<TooltipContextDataWrapper>(DEFAULT_CONTEXT_DATA_WRAPPER)\n\n/**\n * @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.\n * See https://react-tooltip.com/docs/getting-started\n */\nconst TooltipProvider: React.FC<PropsWithChildren<void>> = ({ children }) => {\n const [anchorRefMap, setAnchorRefMap] = useState<Record<string, Set<AnchorRef>>>({\n [DEFAULT_TOOLTIP_ID]: new Set(),\n })\n const [activeAnchorMap, setActiveAnchorMap] = useState<Record<string, AnchorRef>>({\n [DEFAULT_TOOLTIP_ID]: { current: null },\n })\n\n const attach = (tooltipId: string, ...refs: AnchorRef[]) => {\n setAnchorRefMap((oldMap) => {\n const tooltipRefs = oldMap[tooltipId] ?? new Set()\n refs.forEach((ref) => tooltipRefs.add(ref))\n // create new object to trigger re-render\n return { ...oldMap, [tooltipId]: new Set(tooltipRefs) }\n })\n }\n\n const detach = (tooltipId: string, ...refs: AnchorRef[]) => {\n setAnchorRefMap((oldMap) => {\n const tooltipRefs = oldMap[tooltipId]\n if (!tooltipRefs) {\n // tooltip not found\n // maybe thow error?\n return oldMap\n }\n refs.forEach((ref) => tooltipRefs.delete(ref))\n // create new object to trigger re-render\n return { ...oldMap }\n })\n }\n\n const setActiveAnchor = (tooltipId: string, ref: React.RefObject<HTMLElement>) => {\n setActiveAnchorMap((oldMap) => {\n if (oldMap[tooltipId]?.current === ref.current) {\n return oldMap\n }\n // create new object to trigger re-render\n return { ...oldMap, [tooltipId]: ref }\n })\n }\n\n const getTooltipData = useCallback(\n (tooltipId = DEFAULT_TOOLTIP_ID) => ({\n anchorRefs: anchorRefMap[tooltipId] ?? new Set(),\n activeAnchor: activeAnchorMap[tooltipId] ?? { current: null },\n attach: (...refs: AnchorRef[]) => attach(tooltipId, ...refs),\n detach: (...refs: AnchorRef[]) => detach(tooltipId, ...refs),\n setActiveAnchor: (ref: AnchorRef) => setActiveAnchor(tooltipId, ref),\n }),\n [anchorRefMap, activeAnchorMap, attach, detach],\n )\n\n const context = useMemo(() => {\n return {\n getTooltipData,\n }\n }, [getTooltipData])\n\n return <TooltipContext.Provider value={context}>{children}</TooltipContext.Provider>\n}\n\nexport function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {\n return useContext(TooltipContext).getTooltipData(tooltipId)\n}\n\nexport default TooltipProvider\n","import React, { useEffect, useRef } from 'react'\nimport classNames from 'classnames'\nimport { useTooltip } from './TooltipProvider'\nimport type { ITooltipWrapper } from './TooltipProviderTypes'\n\n/**\n * @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.\n * See https://react-tooltip.com/docs/getting-started\n */\nconst TooltipWrapper = ({\n tooltipId,\n children,\n className,\n place,\n content,\n html,\n variant,\n offset,\n wrapper,\n events,\n positionStrategy,\n delayShow,\n delayHide,\n}: ITooltipWrapper) => {\n const { attach, detach } = useTooltip(tooltipId)\n const anchorRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n attach(anchorRef)\n return () => {\n detach(anchorRef)\n }\n }, [])\n\n return (\n <span\n ref={anchorRef}\n className={classNames('react-tooltip-wrapper', className)}\n data-tooltip-place={place}\n data-tooltip-content={content}\n data-tooltip-html={html}\n data-tooltip-variant={variant}\n data-tooltip-offset={offset}\n data-tooltip-wrapper={wrapper}\n data-tooltip-events={events}\n data-tooltip-position-strategy={positionStrategy}\n data-tooltip-delay-show={delayShow}\n data-tooltip-delay-hide={delayHide}\n >\n {children}\n </span>\n )\n}\n\nexport default TooltipWrapper\n","import { useLayoutEffect, useEffect } from 'react'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport default useIsomorphicLayoutEffect\n","const isScrollable = (node: Element) => {\n if (!(node instanceof HTMLElement || node instanceof SVGElement)) {\n return false\n }\n const style = getComputedStyle(node)\n return ['overflow', 'overflow-x', 'overflow-y'].some((propertyName) => {\n const value = style.getPropertyValue(propertyName)\n return value === 'auto' || value === 'scroll'\n })\n}\n\nexport const getScrollParent = (node: Element | null) => {\n if (!node) {\n return null\n }\n let currentParent = node.parentElement\n while (currentParent) {\n if (isScrollable(currentParent)) {\n return currentParent\n }\n currentParent = currentParent.parentElement\n }\n return document.scrollingElement || document.documentElement\n}\n","import { computePosition, offset, shift, arrow, flip } from '@floating-ui/dom'\nimport type { IComputePositions } from './compute-positions-types'\n\nexport const computeTooltipPosition = async ({\n elementReference = null,\n tooltipReference = null,\n tooltipArrowReference = null,\n place = 'top',\n offset: offsetValue = 10,\n strategy = 'absolute',\n middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })],\n border,\n}: IComputePositions) => {\n if (!elementReference) {\n // elementReference can be null or undefined and we will not compute the position\n // eslint-disable-next-line no-console\n // console.error('The reference element for tooltip was not defined: ', elementReference)\n return { tooltipStyles: {}, tooltipArrowStyles: {}, place }\n }\n\n if (tooltipReference === null) {\n return { tooltipStyles: {}, tooltipArrowStyles: {}, place }\n }\n\n const middleware = middlewares\n\n if (tooltipArrowReference) {\n middleware.push(arrow({ element: tooltipArrowReference as HTMLElement, padding: 5 }))\n\n return computePosition(elementReference as HTMLElement, tooltipReference as HTMLElement, {\n placement: place,\n strategy,\n middleware,\n }).then(({ x, y, placement, middlewareData }) => {\n const styles = { left: `${x}px`, top: `${y}px`, border }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow ?? { x: 0, y: 0 }\n\n const staticSide =\n {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]] ?? 'bottom'\n\n const borderSide = border && {\n borderBottom: border,\n borderRight: border,\n }\n\n let borderWidth = 0\n if (border) {\n const match = `${border}`.match(/(\\d+)px/)\n if (match?.[1]) {\n borderWidth = Number(match[1])\n } else {\n /**\n * this means `border` was set without `width`, or non-px value\n */\n borderWidth = 1\n }\n }\n\n const arrowStyle = {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n ...borderSide,\n [staticSide]: `-${4 + borderWidth}px`,\n }\n\n return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement }\n })\n }\n\n return computePosition(elementReference as HTMLElement, tooltipReference as HTMLElement, {\n placement: 'bottom',\n strategy,\n middleware,\n }).then(({ x, y, placement }) => {\n const styles = { left: `${x}px`, top: `${y}px` }\n\n return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement }\n })\n}\n","import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { autoUpdate } from '@floating-ui/dom'\nimport classNames from 'classnames'\nimport debounce from 'utils/debounce'\nimport { useTooltip } from 'components/TooltipProvider'\nimport useIsomorphicLayoutEffect from 'utils/use-isomorphic-layout-effect'\nimport { getScrollParent } from 'utils/get-scroll-parent'\nimport { computeTooltipPosition } from 'utils/compute-positions'\nimport coreStyles from './core-styles.module.css'\nimport styles from './styles.module.css'\nimport type { IPosition, ITooltip, PlacesType } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style: externalStyles,\n position,\n afterShow,\n afterHide,\n // props handled by controller\n content,\n contentWrapperRef,\n isOpen,\n setIsOpen,\n activeAnchor,\n setActiveAnchor,\n border,\n opacity,\n arrowColor,\n}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const wasShowing = useRef(false)\n const lastFloatPosition = useRef<IPosition | null>(null)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id)\n const hoveringTooltip = useRef(false)\n const [anchorsBySelect, setAnchorsBySelect] = useState<HTMLElement[]>([])\n const mounted = useRef(false)\n\n const shouldOpenOnClick = openOnClick || events.includes('click')\n\n /**\n * useLayoutEffect runs before useEffect,\n * but should be used carefully because of caveats\n * https://beta.reactjs.org/reference/react/useLayoutEffect#caveats\n */\n useIsomorphicLayoutEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n\n useEffect(() => {\n if (!show) {\n /**\n * this fixes weird behavior when switching between two anchor elements very quickly\n * remove the timeout and switch quickly between two adjancent anchor elements to see it\n *\n * in practice, this means the tooltip is not immediately removed from the DOM on hide\n */\n const timeout = setTimeout(() => {\n setRendered(false)\n }, 150)\n return () => {\n clearTimeout(timeout)\n }\n }\n return () => null\n }, [show])\n\n const handleShow = (value: boolean) => {\n if (!mounted.current) {\n return\n }\n if (value) {\n setRendered(true)\n }\n /**\n * wait for the component to render and calculate position\n * before actually showing\n */\n setTimeout(() => {\n if (!mounted.current) {\n return\n }\n setIsOpen?.(value)\n if (isOpen === undefined) {\n setShow(value)\n }\n }, 10)\n }\n\n /**\n * this replicates the effect from `handleShow()`\n * when `isOpen` is changed from outside\n */\n useEffect(() => {\n if (isOpen === undefined) {\n return () => null\n }\n if (isOpen) {\n setRendered(true)\n }\n const timeout = setTimeout(() => {\n setShow(isOpen)\n }, 10)\n return () => {\n clearTimeout(timeout)\n }\n }, [isOpen])\n\n useEffect(() => {\n if (show === wasShowing.current) {\n return\n }\n wasShowing.current = show\n if (show) {\n afterShow?.()\n } else {\n afterHide?.()\n }\n }, [show])\n\n const handleShowTooltipDelayed = () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n\n tooltipShowDelayTimerRef.current = setTimeout(() => {\n handleShow(true)\n }, delayShow)\n }\n\n const handleHideTooltipDelayed = (delay = delayHide) => {\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n\n tooltipHideDelayTimerRef.current = setTimeout(() => {\n if (hoveringTooltip.current) {\n return\n }\n handleShow(false)\n }, delay)\n }\n\n const handleShowTooltip = (event?: Event) => {\n if (!event) {\n return\n }\n const target = (event.currentTarget ?? event.target) as HTMLElement | null\n if (!target?.isConnected) {\n /**\n * this happens when the target is removed from the DOM\n * at the same time the tooltip gets triggered\n */\n setActiveAnchor(null)\n setProviderActiveAnchor({ current: null })\n return\n }\n if (delayShow) {\n handleShowTooltipDelayed()\n } else {\n handleShow(true)\n }\n setActiveAnchor(target)\n setProviderActiveAnchor({ current: target })\n\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n\n const handleHideTooltip = () => {\n if (clickable) {\n // allow time for the mouse to reach the tooltip, in case there's a gap\n handleHideTooltipDelayed(delayHide || 100)\n } else if (delayHide) {\n handleHideTooltipDelayed()\n } else {\n handleShow(false)\n }\n\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n const handleTooltipPosition = ({ x, y }: IPosition) => {\n const virtualElement = {\n getBoundingClientRect() {\n return {\n x,\n y,\n width: 0,\n height: 0,\n top: y,\n left: x,\n right: x,\n bottom: y,\n }\n },\n } as Element\n computeTooltipPosition({\n place,\n offset,\n elementReference: virtualElement,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n border,\n }).then((computedStylesData) => {\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }\n\n const handleMouseMove = (event?: Event) => {\n if (!event) {\n return\n }\n const mouseEvent = event as MouseEvent\n const mousePosition = {\n x: mouseEvent.clientX,\n y: mouseEvent.clientY,\n }\n handleTooltipPosition(mousePosition)\n lastFloatPosition.current = mousePosition\n }\n\n const handleClickTooltipAnchor = (event?: Event) => {\n handleShowTooltip(event)\n if (delayHide) {\n handleHideTooltipDelayed()\n }\n }\n\n const handleClickOutsideAnchors = (event: MouseEvent) => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [anchorById, ...anchorsBySelect]\n if (anchors.some((anchor) => anchor?.contains(event.target as HTMLElement))) {\n return\n }\n if (tooltipRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n handleShow(false)\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n // debounce handler to prevent call twice when\n // mouse enter and focus events being triggered toggether\n const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50, true)\n const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50, true)\n const updateTooltipPosition = useCallback(() => {\n if (position) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(position)\n return\n }\n\n if (float) {\n if (lastFloatPosition.current) {\n /*\n Without this, changes to `content`, `place`, `offset`, ..., will only\n trigger a position calculation after a `mousemove` event.\n\n To see why this matters, comment this line, run `yarn dev` and click the\n \"Hover me!\" anchor.\n */\n handleTooltipPosition(lastFloatPosition.current)\n }\n // if `float` is set, override regular positioning\n return\n }\n\n computeTooltipPosition({\n place,\n offset,\n elementReference: activeAnchor,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n border,\n }).then((computedStylesData) => {\n if (!mounted.current) {\n // invalidate computed positions after remount\n return\n }\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }, [\n show,\n activeAnchor,\n content,\n externalStyles,\n place,\n offset,\n positionStrategy,\n position,\n float,\n ])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n const handleScrollResize = () => {\n handleShow(false)\n }\n\n const anchorScrollParent = getScrollParent(activeAnchor)\n const tooltipScrollParent = getScrollParent(tooltipRef.current)\n\n if (closeOnScroll) {\n window.addEventListener('scroll', handleScrollResize)\n anchorScrollParent?.addEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.addEventListener('scroll', handleScrollResize)\n }\n let updateTooltipCleanup: null | (() => void) = null\n if (closeOnResize) {\n window.addEventListener('resize', handleScrollResize)\n } else if (activeAnchor && tooltipRef.current) {\n updateTooltipCleanup = autoUpdate(\n activeAnchor as HTMLElement,\n tooltipRef.current as HTMLElement,\n updateTooltipPosition,\n {\n ancestorResize: true,\n elementResize: true,\n layoutShift: true,\n },\n )\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\n }\n\n if (closeOnEsc) {\n window.addEventListener('keydown', handleEsc)\n }\n\n const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []\n\n if (shouldOpenOnClick) {\n window.addEventListener('click', handleClickOutsideAnchors)\n enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor })\n } else {\n enabledEvents.push(\n { event: 'mouseenter', listener: debouncedHandleShowTooltip },\n { event: 'mouseleave', listener: debouncedHandleHideTooltip },\n { event: 'focus', listener: debouncedHandleShowTooltip },\n { event: 'blur', listener: debouncedHandleHideTooltip },\n )\n if (float) {\n enabledEvents.push({\n event: 'mousemove',\n listener: handleMouseMove,\n })\n }\n }\n\n const handleMouseEnterTooltip = () => {\n hoveringTooltip.current = true\n }\n const handleMouseLeaveTooltip = () => {\n hoveringTooltip.current = false\n handleHideTooltip()\n }\n\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.addEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.addEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.addEventListener(event, listener)\n })\n })\n\n return () => {\n if (closeOnScroll) {\n window.removeEventListener('scroll', handleScrollResize)\n anchorScrollParent?.removeEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.removeEventListener('scroll', handleScrollResize)\n }\n if (closeOnResize) {\n window.removeEventListener('resize', handleScrollResize)\n } else {\n updateTooltipCleanup?.()\n }\n if (shouldOpenOnClick) {\n window.removeEventListener('click', handleClickOutsideAnchors)\n }\n if (closeOnEsc) {\n window.removeEventListener('keydown', handleEsc)\n }\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.removeEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.removeEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.removeEventListener(event, listener)\n })\n })\n }\n /**\n * rendered is also a dependency to ensure anchor observers are re-registered\n * since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM\n */\n }, [\n activeAnchor,\n updateTooltipPosition,\n rendered,\n anchorRefs,\n anchorsBySelect,\n closeOnEsc,\n events,\n ])\n\n useEffect(() => {\n let selector = anchorSelect ?? ''\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n const documentObserverCallback: MutationCallback = (mutationList) => {\n const newAnchors: HTMLElement[] = []\n mutationList.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {\n const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')\n if (newId === id) {\n newAnchors.push(mutation.target as HTMLElement)\n }\n }\n if (mutation.type !== 'childList') {\n return\n }\n if (activeAnchor) {\n ;[...mutation.removedNodes].some((node) => {\n if (node?.contains?.(activeAnchor)) {\n setRendered(false)\n handleShow(false)\n setActiveAnchor(null)\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n return true\n }\n return false\n })\n }\n if (!selector) {\n return\n }\n try {\n const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1)\n newAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n newAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n })\n if (newAnchors.length) {\n setAnchorsBySelect((anchors) => [...anchors, ...newAnchors])\n }\n }\n const documentObserver = new MutationObserver(documentObserverCallback)\n // watch for anchor being removed from the DOM\n documentObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-tooltip-id'],\n })\n return () => {\n documentObserver.disconnect()\n }\n }, [id, anchorSelect, activeAnchor])\n\n useEffect(() => {\n updateTooltipPosition()\n }, [updateTooltipPosition])\n\n useEffect(() => {\n if (!contentWrapperRef?.current) {\n return () => null\n }\n const contentObserver = new ResizeObserver(() => {\n updateTooltipPosition()\n })\n contentObserver.observe(contentWrapperRef.current)\n return () => {\n contentObserver.disconnect()\n }\n }, [content, contentWrapperRef?.current])\n\n useEffect(() => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [...anchorsBySelect, anchorById]\n if (!activeAnchor || !anchors.includes(activeAnchor)) {\n /**\n * if there is no active anchor,\n * or if the current active anchor is not amongst the allowed ones,\n * reset it\n */\n setActiveAnchor(anchorsBySelect[0] ?? anchorById)\n }\n }, [anchorId, anchorsBySelect, activeAnchor])\n\n useEffect(() => {\n return () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n }, [])\n\n useEffect(() => {\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (!selector) {\n return\n }\n try {\n const anchors = Array.from(document.querySelectorAll<HTMLElement>(selector))\n setAnchorsBySelect(anchors)\n } catch {\n // warning was already issued in the controller\n setAnchorsBySelect([])\n }\n }, [id, anchorSelect])\n\n const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0\n\n return rendered ? (\n <WrapperElement\n id={id}\n role=\"tooltip\"\n className={classNames(\n 'react-tooltip',\n coreStyles['tooltip'],\n styles['tooltip'],\n styles[variant],\n className,\n `react-tooltip__place-${actualPlacement}`,\n {\n 'react-tooltip__show': canShow,\n [coreStyles['show']]: canShow,\n [coreStyles['fixed']]: positionStrategy === 'fixed',\n [coreStyles['clickable']]: clickable,\n },\n )}\n style={{\n ...externalStyles,\n ...inlineStyles,\n opacity: opacity !== undefined && canShow ? opacity : undefined,\n }}\n ref={tooltipRef}\n >\n {content}\n <WrapperElement\n className={classNames(\n 'react-tooltip-arrow',\n coreStyles['arrow'],\n styles['arrow'],\n classNameArrow,\n {\n /**\n * changed from dash `no-arrow` to camelcase because of:\n * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42\n */\n [coreStyles['noArrow']]: noArrow,\n },\n )}\n style={{\n ...inlineArrowStyles,\n background: arrowColor\n ? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`\n : undefined,\n }}\n ref={tooltipArrowRef}\n />\n </WrapperElement>\n ) : null\n}\n\nexport default Tooltip\n","/* eslint-disable react/no-danger */\nimport React from 'react'\nimport type { ITooltipContent } from './TooltipContentTypes'\n\nconst TooltipContent = ({ content }: ITooltipContent) => {\n return <span dangerouslySetInnerHTML={{ __html: content }} />\n}\n\nexport default TooltipContent\n","import './tokens.css'\n\nimport { injectStyle } from 'utils/handle-style'\n\nimport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n IPosition,\n Middleware,\n} from './components/Tooltip/TooltipTypes'\nimport type { ITooltipController } from './components/TooltipController/TooltipControllerTypes'\nimport type { ITooltipWrapper } from './components/TooltipProvider/TooltipProviderTypes'\n\n// those content will be replaced in build time with the `react-tooltip.css` builded content\nconst TooltipCoreStyles = 'react-tooltip-core-css-placeholder'\nconst TooltipStyles = 'react-tooltip-css-placeholder'\n\nif (typeof window !== 'undefined') {\n window.addEventListener('react-tooltip-inject-styles', ((\n event: CustomEvent<{ disableCore: boolean; disableBase: boolean }>,\n ) => {\n if (!event.detail.disableCore) {\n injectStyle({ css: TooltipCoreStyles, type: 'core' })\n }\n if (!event.detail.disableBase) {\n injectStyle({ css: TooltipStyles, type: 'base' })\n }\n }) as EventListener)\n}\n\nexport { TooltipController as Tooltip } from './components/TooltipController'\nexport { TooltipProvider, TooltipWrapper } from './components/TooltipProvider'\nexport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n ITooltipController as ITooltip,\n ITooltipWrapper,\n IPosition,\n Middleware,\n}\n\nexport { removeStyle } from './utils/handle-style'\n","import React, { useEffect, useRef, useState } from 'react'\nimport { Tooltip } from 'components/Tooltip'\nimport type {\n EventsType,\n PositionStrategy,\n PlacesType,\n VariantType,\n WrapperType,\n DataAttribute,\n ITooltip,\n ChildrenType,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = ({\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style,\n position,\n isOpen,\n disableStyleInjection = false,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n}: ITooltipController) => {\n const [tooltipContent, setTooltipContent] = useState(content)\n const [tooltipHtml, setTooltipHtml] = useState(html)\n const [tooltipPlace, setTooltipPlace] = useState(place)\n const [tooltipVariant, setTooltipVariant] = useState(variant)\n const [tooltipOffset, setTooltipOffset] = useState(offset)\n const [tooltipDelayShow, setTooltipDelayShow] = useState(delayShow)\n const [tooltipDelayHide, setTooltipDelayHide] = useState(delayHide)\n const [tooltipFloat, setTooltipFloat] = useState(float)\n const [tooltipHidden, setTooltipHidden] = useState(hidden)\n const [tooltipWrapper, setTooltipWrapper] = useState<WrapperType>(wrapper)\n const [tooltipEvents, setTooltipEvents] = useState(events)\n const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy)\n const [activeAnchor, setActiveAnchor] = useState<HTMLElement | null>(null)\n const styleInjectionRef = useRef(disableStyleInjection)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, activeAnchor: providerActiveAnchor } = useTooltip(id)\n\n const getDataAttributesFromAnchorElement = (elementReference: HTMLElement) => {\n const dataAttributes = elementReference?.getAttributeNames().reduce((acc, name) => {\n if (name.startsWith('data-tooltip-')) {\n const parsedAttribute = name.replace(/^data-tooltip-/, '') as DataAttribute\n acc[parsedAttribute] = elementReference?.getAttribute(name) ?? null\n }\n return acc\n }, {} as Record<DataAttribute, string | null>)\n\n return dataAttributes\n }\n\n const applyAllDataAttributesFromAnchorElement = (\n dataAttributes: Record<string, string | null>,\n ) => {\n const handleDataAttributes: Record<DataAttribute, (value: string | null) => void> = {\n place: (value) => {\n setTooltipPlace((value as PlacesType) ?? place)\n },\n content: (value) => {\n setTooltipContent(value ?? content)\n },\n html: (value) => {\n setTooltipHtml(value ?? html)\n },\n variant: (value) => {\n setTooltipVariant((value as VariantType) ?? variant)\n },\n offset: (value) => {\n setTooltipOffset(value === null ? offset : Number(value))\n },\n wrapper: (value) => {\n setTooltipWrapper((value as WrapperType) ?? wrapper)\n },\n events: (value) => {\n const parsed = value?.split(' ') as EventsType[]\n setTooltipEvents(parsed ?? events)\n },\n 'position-strategy': (value) => {\n setTooltipPositionStrategy((value as PositionStrategy) ?? positionStrategy)\n },\n 'delay-show': (value) => {\n setTooltipDelayShow(value === null ? delayShow : Number(value))\n },\n 'delay-hide': (value) => {\n setTooltipDelayHide(value === null ? delayHide : Number(value))\n },\n float: (value) => {\n setTooltipFloat(value === null ? float : value === 'true')\n },\n hidden: (value) => {\n setTooltipHidden(value === null ? hidden : value === 'true')\n },\n }\n // reset unset data attributes to default values\n // without this, data attributes from the last active anchor will still be used\n Object.values(handleDataAttributes).forEach((handler) => handler(null))\n Object.entries(dataAttributes).forEach(([key, value]) => {\n handleDataAttributes[key as DataAttribute]?.(value)\n })\n }\n\n useEffect(() => {\n setTooltipContent(content)\n }, [content])\n\n useEffect(() => {\n setTooltipHtml(html)\n }, [html])\n\n useEffect(() => {\n setTooltipPlace(place)\n }, [place])\n\n useEffect(() => {\n setTooltipVariant(variant)\n }, [variant])\n\n useEffect(() => {\n setTooltipOffset(offset)\n }, [offset])\n\n useEffect(() => {\n setTooltipDelayShow(delayShow)\n }, [delayShow])\n\n useEffect(() => {\n setTooltipDelayHide(delayHide)\n }, [delayHide])\n\n useEffect(() => {\n setTooltipFloat(float)\n }, [float])\n\n useEffect(() => {\n setTooltipHidden(hidden)\n }, [hidden])\n\n useEffect(() => {\n setTooltipPositionStrategy(positionStrategy)\n }, [positionStrategy])\n\n useEffect(() => {\n if (styleInjectionRef.current === disableStyleInjection) {\n return\n }\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not change `disableStyleInjection` dynamically.')\n }\n }, [disableStyleInjection])\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n window.dispatchEvent(\n new CustomEvent('react-tooltip-inject-styles', {\n detail: {\n disableCore: disableStyleInjection === 'core',\n disableBase: disableStyleInjection,\n },\n }),\n )\n }\n }, [])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (selector) {\n try {\n const anchorsBySelect = document.querySelectorAll<HTMLElement>(selector)\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n } catch {\n if (!process.env.NODE_ENV || process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${selector}\" is not a valid CSS selector`)\n }\n }\n }\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n if (!elementRefs.size) {\n return () => null\n }\n\n const anchorElement = activeAnchor ?? anchorById ?? providerActiveAnchor.current\n\n const observerCallback: MutationCallback = (mutationList) => {\n mutationList.forEach((mutation) => {\n if (\n !anchorElement ||\n mutation.type !== 'attributes' ||\n !mutation.attributeName?.startsWith('data-tooltip-')\n ) {\n return\n }\n // make sure to get all set attributes, since all unset attributes are reset\n const dataAttributes = getDataAttributesFromAnchorElement(anchorElement)\n applyAllDataAttributesFromAnchorElement(dataAttributes)\n })\n }\n\n // Create an observer instance linked to the callback function\n const observer = new MutationObserver(observerCallback)\n\n // do not check for subtree and childrens, we only want to know attribute changes\n // to stay watching `data-attributes-*` from anchor element\n const observerConfig = { attributes: true, childList: false, subtree: false }\n\n if (anchorElement) {\n const dataAttributes = getDataAttributesFromAnchorElement(anchorElement)\n applyAllDataAttributesFromAnchorElement(dataAttributes)\n // Start observing the target node for configured mutations\n observer.observe(anchorElement, observerConfig)\n }\n\n return () => {\n // Remove the observer when the tooltip is destroyed\n observer.disconnect()\n }\n }, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect])\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (style?.border) {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not set `style.border`. Use `border` prop instead.')\n }\n if (border && !CSS.supports('border', `${border}`)) {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${border}\" is not a valid \\`border\\`.`)\n }\n if (style?.opacity) {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.')\n }\n if (opacity && !CSS.supports('opacity', `${opacity}`)) {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${opacity}\" is not a valid \\`opacity\\`.`)\n }\n }, [])\n\n /**\n * content priority: children < render or content < html\n * children should be lower priority so that it can be used as the \"default\" content\n */\n let renderedContent: ChildrenType = children\n const contentWrapperRef = useRef<HTMLDivElement>(null)\n if (render) {\n const rendered = render({ content: tooltipContent ?? null, activeAnchor }) as React.ReactNode\n renderedContent = rendered ? (\n <div ref={contentWrapperRef} className=\"react-tooltip-content-wrapper\">\n {rendered}\n </div>\n ) : null\n } else if (tooltipContent) {\n renderedContent = tooltipContent\n }\n if (tooltipHtml) {\n renderedContent = <TooltipContent content={tooltipHtml} />\n }\n\n const props: ITooltip = {\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n closeOnScroll,\n closeOnResize,\n style,\n position,\n isOpen,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n}\n\nexport default TooltipController\n"],"names":["REACT_TOOLTIP_CORE_STYLES_ID","REACT_TOOLTIP_BASE_STYLES_ID","injected","core","base","injectStyle","css","id","type","ref","document","process","_a","env","REACT_TOOLTIP_DISABLE_CORE_STYLES","_b","REACT_TOOLTIP_DISABLE_BASE_STYLES","insertAt","getElementById","console","warn","head","getElementsByTagName","style","createElement","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","debounce","func","wait","immediate","timeout","args","later","apply","this","setTimeout","clearTimeout","DEFAULT_TOOLTIP_ID","DEFAULT_CONTEXT_DATA","anchorRefs","Set","activeAnchor","current","attach","detach","setActiveAnchor","DEFAULT_CONTEXT_DATA_WRAPPER","getTooltipData","TooltipContext","createContext","useTooltip","tooltipId","useContext","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","isScrollable","node","HTMLElement","SVGElement","getComputedStyle","some","propertyName","value","getPropertyValue","getScrollParent","currentParent","parentElement","scrollingElement","documentElement","computeTooltipPosition","async","elementReference","tooltipReference","tooltipArrowReference","place","offset","offsetValue","strategy","middlewares","Number","flip","shift","padding","border","tooltipStyles","tooltipArrowStyles","middleware","push","arrow","element","computePosition","placement","then","x","y","middlewareData","styles","left","top","arrowX","arrowY","staticSide","right","bottom","split","borderSide","borderBottom","borderRight","borderWidth","match","Tooltip","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","closeOnScroll","closeOnResize","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","opacity","arrowColor","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","wasShowing","lastFloatPosition","setProviderActiveAnchor","hoveringTooltip","anchorsBySelect","setAnchorsBySelect","mounted","shouldOpenOnClick","includes","handleShow","undefined","handleHideTooltipDelayed","delay","handleShowTooltip","event","target","currentTarget","isConnected","handleHideTooltip","handleTooltipPosition","getBoundingClientRect","width","height","computedStylesData","Object","keys","length","handleMouseMove","mouseEvent","mousePosition","clientX","clientY","handleClickTooltipAnchor","handleClickOutsideAnchors","querySelector","anchor","contains","debouncedHandleShowTooltip","debouncedHandleHideTooltip","updateTooltipPosition","useCallback","elementRefs","forEach","add","anchorById","handleScrollResize","anchorScrollParent","tooltipScrollParent","addEventListener","updateTooltipCleanup","autoUpdate","ancestorResize","elementResize","layoutShift","handleEsc","key","enabledEvents","listener","handleMouseEnterTooltip","handleMouseLeaveTooltip","removeEventListener","selector","documentObserver","MutationObserver","mutationList","newAnchors","mutation","attributeName","getAttribute","removedNodes","call","elements","addedNodes","filter","nodeType","matches","flatMap","querySelectorAll","anchors","observe","body","childList","subtree","attributes","attributeFilter","disconnect","contentObserver","ResizeObserver","Array","from","canShow","React","role","classNames","coreStyles","coreStyles_show","coreStyles_fixed","coreStyles_clickable","coreStyles_noArrow","background","TooltipContent","dangerouslySetInnerHTML","__html","detail","disableCore","disableBase","html","render","children","disableStyleInjection","tooltipContent","setTooltipContent","tooltipHtml","setTooltipHtml","tooltipPlace","setTooltipPlace","tooltipVariant","setTooltipVariant","tooltipOffset","setTooltipOffset","tooltipDelayShow","setTooltipDelayShow","tooltipDelayHide","setTooltipDelayHide","tooltipFloat","setTooltipFloat","tooltipHidden","setTooltipHidden","tooltipWrapper","setTooltipWrapper","tooltipEvents","setTooltipEvents","tooltipPositionStrategy","setTooltipPositionStrategy","styleInjectionRef","providerActiveAnchor","getDataAttributesFromAnchorElement","getAttributeNames","reduce","acc","name","startsWith","replace","applyAllDataAttributesFromAnchorElement","dataAttributes","handleDataAttributes","parsed","values","handler","entries","dispatchEvent","CustomEvent","size","anchorElement","observer","observerConfig","CSS","supports","renderedContent","props","anchorRefMap","setAnchorRefMap","activeAnchorMap","setActiveAnchorMap","refs","oldMap","tooltipRefs","delete","context","useMemo","Provider","anchorRef","tagName","remove"],"mappings":";;;;;;2OACA,MAAMA,EAA+B,4BAE/BC,EAA+B,4BAE/BC,EAAW,CACfC,MAAM,EACNC,MAAM,GAGR,SAASC,GAAYC,IACnBA,EAAGC,GACHA,EAAKN,EAA4BO,KACjCA,EAAO,OAAMC,IACbA,YAQA,IAAKH,GAA2B,oBAAbI,UAA4BR,EAASM,GACtD,OAGF,GACW,SAATA,GACmB,oBAAZG,UACK,QAAZC,EAAA,OAAAD,cAAA,IAAAA,aAAA,EAAAA,QAASE,WAAG,IAAAD,OAAA,EAAAA,EAAEE,mCAEd,OAGF,GACW,SAATN,GACmB,oBAAZG,UACK,QAAZI,EAAA,OAAAJ,cAAA,IAAAA,aAAA,EAAAA,QAASE,WAAG,IAAAE,OAAA,EAAAA,EAAEC,mCAEd,OAGW,SAATR,IAEFD,EAAKP,GAGFS,IAEHA,EAAM,CAAA,GAER,MAAMQ,SAAEA,GAAaR,EAErB,GAAIC,SAASQ,eAAeX,GAQ1B,YAJEY,QAAQC,KACN,oCAAoCb,mDAM1C,MAAMc,EAAOX,SAASW,MAAQX,SAASY,qBAAqB,QAAQ,GAE9DC,EAAab,SAASc,cAAc,SAC1CD,EAAMhB,GAAKA,EACXgB,EAAMf,KAAO,WAEI,QAAbS,GACEI,EAAKI,WACPJ,EAAKK,aAAaH,EAAOF,EAAKI,YAKhCJ,EAAKM,YAAYJ,GAGfA,EAAMK,WACRL,EAAMK,WAAWC,QAAUvB,EAE3BiB,EAAMI,YAAYjB,SAASoB,eAAexB,IAG5CJ,EAASM,IAAQ,CACnB,CChFA,MAAMuB,EAAW,CAACC,E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AAA,QACEtO,cAAA,OAAA,CAAAf,IAAKqU,EACLxN,UAAW0I,EAAAA,QAAW,wBAAyB1I,GAC3B,qBAAArC,yBACE4D,EAAO,oBACVgI,EAAI,uBACDrJ,EACD,sBAAAtC,EACC,uBAAA4C,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExB8I,EAEJ,sBH0CH,UAAqBvQ,KACnBA,EAAO,OAAMD,GACbA,EAAKN,GAIH,IACF,IAAKC,EAASM,GACZ,OAGW,SAATA,IAEFD,EAAKP,GAGP,MAAMuB,EAAQb,SAASQ,eAAeX,GACf,WAAnBgB,aAAK,EAALA,EAAOwT,SACTxT,SAAAA,EAAOyT,SAGP7T,QAAQC,KACN,6DAA6Db,oCAIjEL,EAASM,IAAQ,CACnB"}
1
+ {"version":3,"file":"react-tooltip.min.cjs","sources":["../src/utils/handle-style.ts","../src/utils/debounce.ts","../src/components/TooltipProvider/TooltipProvider.tsx","../src/components/TooltipProvider/TooltipWrapper.tsx","../src/utils/use-isomorphic-layout-effect.ts","../src/utils/get-scroll-parent.ts","../src/utils/compute-positions.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/TooltipContent/TooltipContent.tsx","../src/index.tsx","../src/components/TooltipController/TooltipController.tsx"],"sourcesContent":["// This is the ID for the core styles of ReactTooltip\nconst REACT_TOOLTIP_CORE_STYLES_ID = 'react-tooltip-core-styles'\n// This is the ID for the visual styles of ReactTooltip\nconst REACT_TOOLTIP_BASE_STYLES_ID = 'react-tooltip-base-styles'\n\nconst injected = {\n core: false,\n base: false,\n}\n\nfunction injectStyle({\n css,\n id = REACT_TOOLTIP_BASE_STYLES_ID,\n type = 'base',\n ref,\n}: {\n css: string\n id?: string\n type?: 'core' | 'base'\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n}) {\n if (!css || typeof document === 'undefined' || injected[type]) {\n return\n }\n\n if (\n type === 'core' &&\n typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`\n process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES\n ) {\n return\n }\n\n if (\n type !== 'base' &&\n typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`\n process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES\n ) {\n return\n }\n\n if (type === 'core') {\n // eslint-disable-next-line no-param-reassign\n id = REACT_TOOLTIP_CORE_STYLES_ID\n }\n\n if (!ref) {\n // eslint-disable-next-line no-param-reassign\n ref = {}\n }\n const { insertAt } = ref\n\n if (document.getElementById(id)) {\n // this should never happen because of `injected[type]`\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[react-tooltip] Element with id '${id}' already exists. Call \\`removeStyle()\\` first`,\n )\n }\n return\n }\n\n const head = document.head || document.getElementsByTagName('head')[0]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const style: any = document.createElement('style')\n style.id = id\n style.type = 'text/css'\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild)\n } else {\n head.appendChild(style)\n }\n } else {\n head.appendChild(style)\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css\n } else {\n style.appendChild(document.createTextNode(css))\n }\n\n injected[type] = true\n}\n\n/**\n * @deprecated Use the `disableStyleInjection` tooltip prop instead.\n * See https://react-tooltip.com/docs/examples/styling#disabling-reacttooltip-css\n */\nfunction removeStyle({\n type = 'base',\n id = REACT_TOOLTIP_BASE_STYLES_ID,\n}: {\n type?: 'core' | 'base'\n id?: string\n} = {}) {\n if (!injected[type]) {\n return\n }\n\n if (type === 'core') {\n // eslint-disable-next-line no-param-reassign\n id = REACT_TOOLTIP_CORE_STYLES_ID\n }\n\n const style = document.getElementById(id)\n if (style?.tagName === 'style') {\n style?.remove()\n } else if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[react-tooltip] Failed to remove 'style' element with id '${id}'. Call \\`injectStyle()\\` first`,\n )\n }\n\n injected[type] = false\n}\n\nexport { injectStyle, removeStyle }\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * This function debounce the received function\n * @param { function } \tfunc\t\t\t\tFunction to be debounced\n * @param { number } \t\twait\t\t\t\tTime to wait before execut the function\n * @param { boolean } \timmediate\t\tParam to define if the function will be executed immediately\n */\nconst debounce = (func: (...args: any[]) => void, wait?: number, immediate?: boolean) => {\n let timeout: NodeJS.Timeout | null = null\n\n return function debounced(this: typeof func, ...args: any[]) {\n const later = () => {\n timeout = null\n if (!immediate) {\n func.apply(this, args)\n }\n }\n\n if (immediate && !timeout) {\n /**\n * there's not need to clear the timeout\n * since we expect it to resolve and set `timeout = null`\n */\n func.apply(this, args)\n timeout = setTimeout(later, wait)\n }\n\n if (!immediate) {\n if (timeout) {\n clearTimeout(timeout)\n }\n timeout = setTimeout(later, wait)\n }\n }\n}\n\nexport default debounce\n","import React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from 'react'\n\nimport type {\n AnchorRef,\n TooltipContextData,\n TooltipContextDataWrapper,\n} from './TooltipProviderTypes'\n\nconst DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID'\nconst DEFAULT_CONTEXT_DATA: TooltipContextData = {\n anchorRefs: new Set(),\n activeAnchor: { current: null },\n attach: () => {\n /* attach anchor element */\n },\n detach: () => {\n /* detach anchor element */\n },\n setActiveAnchor: () => {\n /* set active anchor */\n },\n}\n\nconst DEFAULT_CONTEXT_DATA_WRAPPER: TooltipContextDataWrapper = {\n getTooltipData: () => DEFAULT_CONTEXT_DATA,\n}\n\nconst TooltipContext = createContext<TooltipContextDataWrapper>(DEFAULT_CONTEXT_DATA_WRAPPER)\n\n/**\n * @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.\n * See https://react-tooltip.com/docs/getting-started\n */\nconst TooltipProvider: React.FC<PropsWithChildren<void>> = ({ children }) => {\n const [anchorRefMap, setAnchorRefMap] = useState<Record<string, Set<AnchorRef>>>({\n [DEFAULT_TOOLTIP_ID]: new Set(),\n })\n const [activeAnchorMap, setActiveAnchorMap] = useState<Record<string, AnchorRef>>({\n [DEFAULT_TOOLTIP_ID]: { current: null },\n })\n\n const attach = (tooltipId: string, ...refs: AnchorRef[]) => {\n setAnchorRefMap((oldMap) => {\n const tooltipRefs = oldMap[tooltipId] ?? new Set()\n refs.forEach((ref) => tooltipRefs.add(ref))\n // create new object to trigger re-render\n return { ...oldMap, [tooltipId]: new Set(tooltipRefs) }\n })\n }\n\n const detach = (tooltipId: string, ...refs: AnchorRef[]) => {\n setAnchorRefMap((oldMap) => {\n const tooltipRefs = oldMap[tooltipId]\n if (!tooltipRefs) {\n // tooltip not found\n // maybe thow error?\n return oldMap\n }\n refs.forEach((ref) => tooltipRefs.delete(ref))\n // create new object to trigger re-render\n return { ...oldMap }\n })\n }\n\n const setActiveAnchor = (tooltipId: string, ref: React.RefObject<HTMLElement>) => {\n setActiveAnchorMap((oldMap) => {\n if (oldMap[tooltipId]?.current === ref.current) {\n return oldMap\n }\n // create new object to trigger re-render\n return { ...oldMap, [tooltipId]: ref }\n })\n }\n\n const getTooltipData = useCallback(\n (tooltipId = DEFAULT_TOOLTIP_ID) => ({\n anchorRefs: anchorRefMap[tooltipId] ?? new Set(),\n activeAnchor: activeAnchorMap[tooltipId] ?? { current: null },\n attach: (...refs: AnchorRef[]) => attach(tooltipId, ...refs),\n detach: (...refs: AnchorRef[]) => detach(tooltipId, ...refs),\n setActiveAnchor: (ref: AnchorRef) => setActiveAnchor(tooltipId, ref),\n }),\n [anchorRefMap, activeAnchorMap, attach, detach],\n )\n\n const context = useMemo(() => {\n return {\n getTooltipData,\n }\n }, [getTooltipData])\n\n return <TooltipContext.Provider value={context}>{children}</TooltipContext.Provider>\n}\n\nexport function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {\n return useContext(TooltipContext).getTooltipData(tooltipId)\n}\n\nexport default TooltipProvider\n","import React, { useEffect, useRef } from 'react'\nimport classNames from 'classnames'\nimport { useTooltip } from './TooltipProvider'\nimport type { ITooltipWrapper } from './TooltipProviderTypes'\n\n/**\n * @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.\n * See https://react-tooltip.com/docs/getting-started\n */\nconst TooltipWrapper = ({\n tooltipId,\n children,\n className,\n place,\n content,\n html,\n variant,\n offset,\n wrapper,\n events,\n positionStrategy,\n delayShow,\n delayHide,\n}: ITooltipWrapper) => {\n const { attach, detach } = useTooltip(tooltipId)\n const anchorRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n attach(anchorRef)\n return () => {\n detach(anchorRef)\n }\n }, [])\n\n return (\n <span\n ref={anchorRef}\n className={classNames('react-tooltip-wrapper', className)}\n data-tooltip-place={place}\n data-tooltip-content={content}\n data-tooltip-html={html}\n data-tooltip-variant={variant}\n data-tooltip-offset={offset}\n data-tooltip-wrapper={wrapper}\n data-tooltip-events={events}\n data-tooltip-position-strategy={positionStrategy}\n data-tooltip-delay-show={delayShow}\n data-tooltip-delay-hide={delayHide}\n >\n {children}\n </span>\n )\n}\n\nexport default TooltipWrapper\n","import { useLayoutEffect, useEffect } from 'react'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport default useIsomorphicLayoutEffect\n","const isScrollable = (node: Element) => {\n if (!(node instanceof HTMLElement || node instanceof SVGElement)) {\n return false\n }\n const style = getComputedStyle(node)\n return ['overflow', 'overflow-x', 'overflow-y'].some((propertyName) => {\n const value = style.getPropertyValue(propertyName)\n return value === 'auto' || value === 'scroll'\n })\n}\n\nexport const getScrollParent = (node: Element | null) => {\n if (!node) {\n return null\n }\n let currentParent = node.parentElement\n while (currentParent) {\n if (isScrollable(currentParent)) {\n return currentParent\n }\n currentParent = currentParent.parentElement\n }\n return document.scrollingElement || document.documentElement\n}\n","import { computePosition, offset, shift, arrow, flip } from '@floating-ui/dom'\nimport type { IComputePositions } from './compute-positions-types'\n\nexport const computeTooltipPosition = async ({\n elementReference = null,\n tooltipReference = null,\n tooltipArrowReference = null,\n place = 'top',\n offset: offsetValue = 10,\n strategy = 'absolute',\n middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })],\n border,\n}: IComputePositions) => {\n if (!elementReference) {\n // elementReference can be null or undefined and we will not compute the position\n // eslint-disable-next-line no-console\n // console.error('The reference element for tooltip was not defined: ', elementReference)\n return { tooltipStyles: {}, tooltipArrowStyles: {}, place }\n }\n\n if (tooltipReference === null) {\n return { tooltipStyles: {}, tooltipArrowStyles: {}, place }\n }\n\n const middleware = middlewares\n\n if (tooltipArrowReference) {\n middleware.push(arrow({ element: tooltipArrowReference as HTMLElement, padding: 5 }))\n\n return computePosition(elementReference as HTMLElement, tooltipReference as HTMLElement, {\n placement: place,\n strategy,\n middleware,\n }).then(({ x, y, placement, middlewareData }) => {\n const styles = { left: `${x}px`, top: `${y}px`, border }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow ?? { x: 0, y: 0 }\n\n const staticSide =\n {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]] ?? 'bottom'\n\n const borderSide = border && {\n borderBottom: border,\n borderRight: border,\n }\n\n let borderWidth = 0\n if (border) {\n const match = `${border}`.match(/(\\d+)px/)\n if (match?.[1]) {\n borderWidth = Number(match[1])\n } else {\n /**\n * this means `border` was set without `width`, or non-px value\n */\n borderWidth = 1\n }\n }\n\n const arrowStyle = {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n ...borderSide,\n [staticSide]: `-${4 + borderWidth}px`,\n }\n\n return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle, place: placement }\n })\n }\n\n return computePosition(elementReference as HTMLElement, tooltipReference as HTMLElement, {\n placement: 'bottom',\n strategy,\n middleware,\n }).then(({ x, y, placement }) => {\n const styles = { left: `${x}px`, top: `${y}px` }\n\n return { tooltipStyles: styles, tooltipArrowStyles: {}, place: placement }\n })\n}\n","import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { autoUpdate } from '@floating-ui/dom'\nimport classNames from 'classnames'\nimport debounce from 'utils/debounce'\nimport { useTooltip } from 'components/TooltipProvider'\nimport useIsomorphicLayoutEffect from 'utils/use-isomorphic-layout-effect'\nimport { getScrollParent } from 'utils/get-scroll-parent'\nimport { computeTooltipPosition } from 'utils/compute-positions'\nimport coreStyles from './core-styles.module.css'\nimport styles from './styles.module.css'\nimport type { IPosition, ITooltip, PlacesType } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style: externalStyles,\n position,\n afterShow,\n afterHide,\n // props handled by controller\n content,\n contentWrapperRef,\n isOpen,\n setIsOpen,\n activeAnchor,\n setActiveAnchor,\n border,\n opacity,\n arrowColor,\n}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const wasShowing = useRef(false)\n const lastFloatPosition = useRef<IPosition | null>(null)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id)\n const hoveringTooltip = useRef(false)\n const [anchorsBySelect, setAnchorsBySelect] = useState<HTMLElement[]>([])\n const mounted = useRef(false)\n\n const shouldOpenOnClick = openOnClick || events.includes('click')\n\n /**\n * useLayoutEffect runs before useEffect,\n * but should be used carefully because of caveats\n * https://beta.reactjs.org/reference/react/useLayoutEffect#caveats\n */\n useIsomorphicLayoutEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n\n useEffect(() => {\n if (!show) {\n /**\n * this fixes weird behavior when switching between two anchor elements very quickly\n * remove the timeout and switch quickly between two adjancent anchor elements to see it\n *\n * in practice, this means the tooltip is not immediately removed from the DOM on hide\n */\n const timeout = setTimeout(() => {\n setRendered(false)\n }, 150)\n return () => {\n clearTimeout(timeout)\n }\n }\n return () => null\n }, [show])\n\n const handleShow = (value: boolean) => {\n if (!mounted.current) {\n return\n }\n if (value) {\n setRendered(true)\n }\n /**\n * wait for the component to render and calculate position\n * before actually showing\n */\n setTimeout(() => {\n if (!mounted.current) {\n return\n }\n setIsOpen?.(value)\n if (isOpen === undefined) {\n setShow(value)\n }\n }, 10)\n }\n\n /**\n * this replicates the effect from `handleShow()`\n * when `isOpen` is changed from outside\n */\n useEffect(() => {\n if (isOpen === undefined) {\n return () => null\n }\n if (isOpen) {\n setRendered(true)\n }\n const timeout = setTimeout(() => {\n setShow(isOpen)\n }, 10)\n return () => {\n clearTimeout(timeout)\n }\n }, [isOpen])\n\n useEffect(() => {\n if (show === wasShowing.current) {\n return\n }\n wasShowing.current = show\n if (show) {\n afterShow?.()\n } else {\n afterHide?.()\n }\n }, [show])\n\n const handleShowTooltipDelayed = () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n\n tooltipShowDelayTimerRef.current = setTimeout(() => {\n handleShow(true)\n }, delayShow)\n }\n\n const handleHideTooltipDelayed = (delay = delayHide) => {\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n\n tooltipHideDelayTimerRef.current = setTimeout(() => {\n if (hoveringTooltip.current) {\n return\n }\n handleShow(false)\n }, delay)\n }\n\n const handleShowTooltip = (event?: Event) => {\n if (!event) {\n return\n }\n const target = (event.currentTarget ?? event.target) as HTMLElement | null\n if (!target?.isConnected) {\n /**\n * this happens when the target is removed from the DOM\n * at the same time the tooltip gets triggered\n */\n setActiveAnchor(null)\n setProviderActiveAnchor({ current: null })\n return\n }\n if (delayShow) {\n handleShowTooltipDelayed()\n } else {\n handleShow(true)\n }\n setActiveAnchor(target)\n setProviderActiveAnchor({ current: target })\n\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n\n const handleHideTooltip = () => {\n if (clickable) {\n // allow time for the mouse to reach the tooltip, in case there's a gap\n handleHideTooltipDelayed(delayHide || 100)\n } else if (delayHide) {\n handleHideTooltipDelayed()\n } else {\n handleShow(false)\n }\n\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n const handleTooltipPosition = ({ x, y }: IPosition) => {\n const virtualElement = {\n getBoundingClientRect() {\n return {\n x,\n y,\n width: 0,\n height: 0,\n top: y,\n left: x,\n right: x,\n bottom: y,\n }\n },\n } as Element\n computeTooltipPosition({\n place,\n offset,\n elementReference: virtualElement,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n border,\n }).then((computedStylesData) => {\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }\n\n const handleMouseMove = (event?: Event) => {\n if (!event) {\n return\n }\n const mouseEvent = event as MouseEvent\n const mousePosition = {\n x: mouseEvent.clientX,\n y: mouseEvent.clientY,\n }\n handleTooltipPosition(mousePosition)\n lastFloatPosition.current = mousePosition\n }\n\n const handleClickTooltipAnchor = (event?: Event) => {\n handleShowTooltip(event)\n if (delayHide) {\n handleHideTooltipDelayed()\n }\n }\n\n const handleClickOutsideAnchors = (event: MouseEvent) => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [anchorById, ...anchorsBySelect]\n if (anchors.some((anchor) => anchor?.contains(event.target as HTMLElement))) {\n return\n }\n if (tooltipRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n handleShow(false)\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n // debounce handler to prevent call twice when\n // mouse enter and focus events being triggered toggether\n const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50, true)\n const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50, true)\n const updateTooltipPosition = useCallback(() => {\n if (position) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(position)\n return\n }\n\n if (float) {\n if (lastFloatPosition.current) {\n /*\n Without this, changes to `content`, `place`, `offset`, ..., will only\n trigger a position calculation after a `mousemove` event.\n\n To see why this matters, comment this line, run `yarn dev` and click the\n \"Hover me!\" anchor.\n */\n handleTooltipPosition(lastFloatPosition.current)\n }\n // if `float` is set, override regular positioning\n return\n }\n\n if (!activeAnchor?.isConnected) {\n return\n }\n\n computeTooltipPosition({\n place,\n offset,\n elementReference: activeAnchor,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n border,\n }).then((computedStylesData) => {\n if (!mounted.current) {\n // invalidate computed positions after remount\n return\n }\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }, [\n show,\n activeAnchor,\n content,\n externalStyles,\n place,\n offset,\n positionStrategy,\n position,\n float,\n ])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n const handleScrollResize = () => {\n handleShow(false)\n }\n\n const anchorScrollParent = getScrollParent(activeAnchor)\n const tooltipScrollParent = getScrollParent(tooltipRef.current)\n\n if (closeOnScroll) {\n window.addEventListener('scroll', handleScrollResize)\n anchorScrollParent?.addEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.addEventListener('scroll', handleScrollResize)\n }\n let updateTooltipCleanup: null | (() => void) = null\n if (closeOnResize) {\n window.addEventListener('resize', handleScrollResize)\n } else if (activeAnchor && tooltipRef.current) {\n updateTooltipCleanup = autoUpdate(\n activeAnchor as HTMLElement,\n tooltipRef.current as HTMLElement,\n updateTooltipPosition,\n {\n ancestorResize: true,\n elementResize: true,\n layoutShift: true,\n },\n )\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\n }\n\n if (closeOnEsc) {\n window.addEventListener('keydown', handleEsc)\n }\n\n const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []\n\n if (shouldOpenOnClick) {\n window.addEventListener('click', handleClickOutsideAnchors)\n enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor })\n } else {\n enabledEvents.push(\n { event: 'mouseenter', listener: debouncedHandleShowTooltip },\n { event: 'mouseleave', listener: debouncedHandleHideTooltip },\n { event: 'focus', listener: debouncedHandleShowTooltip },\n { event: 'blur', listener: debouncedHandleHideTooltip },\n )\n if (float) {\n enabledEvents.push({\n event: 'mousemove',\n listener: handleMouseMove,\n })\n }\n }\n\n const handleMouseEnterTooltip = () => {\n hoveringTooltip.current = true\n }\n const handleMouseLeaveTooltip = () => {\n hoveringTooltip.current = false\n handleHideTooltip()\n }\n\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.addEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.addEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.addEventListener(event, listener)\n })\n })\n\n return () => {\n if (closeOnScroll) {\n window.removeEventListener('scroll', handleScrollResize)\n anchorScrollParent?.removeEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.removeEventListener('scroll', handleScrollResize)\n }\n if (closeOnResize) {\n window.removeEventListener('resize', handleScrollResize)\n } else {\n updateTooltipCleanup?.()\n }\n if (shouldOpenOnClick) {\n window.removeEventListener('click', handleClickOutsideAnchors)\n }\n if (closeOnEsc) {\n window.removeEventListener('keydown', handleEsc)\n }\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.removeEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.removeEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.removeEventListener(event, listener)\n })\n })\n }\n /**\n * rendered is also a dependency to ensure anchor observers are re-registered\n * since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM\n */\n }, [\n activeAnchor,\n updateTooltipPosition,\n rendered,\n anchorRefs,\n anchorsBySelect,\n closeOnEsc,\n events,\n ])\n\n useEffect(() => {\n let selector = anchorSelect ?? ''\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n const documentObserverCallback: MutationCallback = (mutationList) => {\n const newAnchors: HTMLElement[] = []\n const removedAnchors: HTMLElement[] = []\n mutationList.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {\n const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')\n if (newId === id) {\n newAnchors.push(mutation.target as HTMLElement)\n }\n }\n if (mutation.type !== 'childList') {\n return\n }\n if (activeAnchor) {\n const elements = [...mutation.removedNodes].filter((node) => node.nodeType === 1)\n if (selector) {\n try {\n removedAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n removedAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n }\n elements.some((node) => {\n if (node?.contains?.(activeAnchor)) {\n setRendered(false)\n handleShow(false)\n setActiveAnchor(null)\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n return true\n }\n return false\n })\n }\n if (!selector) {\n return\n }\n try {\n const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1)\n newAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n newAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n })\n if (newAnchors.length || removedAnchors.length) {\n setAnchorsBySelect((anchors) => [\n ...anchors.filter((anchor) => removedAnchors.includes(anchor)),\n ...newAnchors,\n ])\n }\n }\n const documentObserver = new MutationObserver(documentObserverCallback)\n // watch for anchor being removed from the DOM\n documentObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-tooltip-id'],\n })\n return () => {\n documentObserver.disconnect()\n }\n }, [id, anchorSelect, activeAnchor])\n\n useEffect(() => {\n updateTooltipPosition()\n }, [updateTooltipPosition])\n\n useEffect(() => {\n if (!contentWrapperRef?.current) {\n return () => null\n }\n const contentObserver = new ResizeObserver(() => {\n updateTooltipPosition()\n })\n contentObserver.observe(contentWrapperRef.current)\n return () => {\n contentObserver.disconnect()\n }\n }, [content, contentWrapperRef?.current])\n\n useEffect(() => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [...anchorsBySelect, anchorById]\n if (!activeAnchor || !anchors.includes(activeAnchor)) {\n /**\n * if there is no active anchor,\n * or if the current active anchor is not amongst the allowed ones,\n * reset it\n */\n setActiveAnchor(anchorsBySelect[0] ?? anchorById)\n }\n }, [anchorId, anchorsBySelect, activeAnchor])\n\n useEffect(() => {\n return () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n }, [])\n\n useEffect(() => {\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (!selector) {\n return\n }\n try {\n const anchors = Array.from(document.querySelectorAll<HTMLElement>(selector))\n setAnchorsBySelect(anchors)\n } catch {\n // warning was already issued in the controller\n setAnchorsBySelect([])\n }\n }, [id, anchorSelect])\n\n const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0\n\n return rendered ? (\n <WrapperElement\n id={id}\n role=\"tooltip\"\n className={classNames(\n 'react-tooltip',\n coreStyles['tooltip'],\n styles['tooltip'],\n styles[variant],\n className,\n `react-tooltip__place-${actualPlacement}`,\n {\n 'react-tooltip__show': canShow,\n [coreStyles['show']]: canShow,\n [coreStyles['fixed']]: positionStrategy === 'fixed',\n [coreStyles['clickable']]: clickable,\n },\n )}\n style={{\n ...externalStyles,\n ...inlineStyles,\n opacity: opacity !== undefined && canShow ? opacity : undefined,\n }}\n ref={tooltipRef}\n >\n {content}\n <WrapperElement\n className={classNames(\n 'react-tooltip-arrow',\n coreStyles['arrow'],\n styles['arrow'],\n classNameArrow,\n {\n /**\n * changed from dash `no-arrow` to camelcase because of:\n * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42\n */\n [coreStyles['noArrow']]: noArrow,\n },\n )}\n style={{\n ...inlineArrowStyles,\n background: arrowColor\n ? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`\n : undefined,\n }}\n ref={tooltipArrowRef}\n />\n </WrapperElement>\n ) : null\n}\n\nexport default Tooltip\n","/* eslint-disable react/no-danger */\nimport React from 'react'\nimport type { ITooltipContent } from './TooltipContentTypes'\n\nconst TooltipContent = ({ content }: ITooltipContent) => {\n return <span dangerouslySetInnerHTML={{ __html: content }} />\n}\n\nexport default TooltipContent\n","import './tokens.css'\n\nimport { injectStyle } from 'utils/handle-style'\n\nimport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n IPosition,\n Middleware,\n} from './components/Tooltip/TooltipTypes'\nimport type { ITooltipController } from './components/TooltipController/TooltipControllerTypes'\nimport type { ITooltipWrapper } from './components/TooltipProvider/TooltipProviderTypes'\n\n// those content will be replaced in build time with the `react-tooltip.css` builded content\nconst TooltipCoreStyles = 'react-tooltip-core-css-placeholder'\nconst TooltipStyles = 'react-tooltip-css-placeholder'\n\nif (typeof window !== 'undefined') {\n window.addEventListener('react-tooltip-inject-styles', ((\n event: CustomEvent<{ disableCore: boolean; disableBase: boolean }>,\n ) => {\n if (!event.detail.disableCore) {\n injectStyle({ css: TooltipCoreStyles, type: 'core' })\n }\n if (!event.detail.disableBase) {\n injectStyle({ css: TooltipStyles, type: 'base' })\n }\n }) as EventListener)\n}\n\nexport { TooltipController as Tooltip } from './components/TooltipController'\nexport { TooltipProvider, TooltipWrapper } from './components/TooltipProvider'\nexport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n ITooltipController as ITooltip,\n ITooltipWrapper,\n IPosition,\n Middleware,\n}\n\nexport { removeStyle } from './utils/handle-style'\n","import React, { useEffect, useRef, useState } from 'react'\nimport { Tooltip } from 'components/Tooltip'\nimport type {\n EventsType,\n PositionStrategy,\n PlacesType,\n VariantType,\n WrapperType,\n DataAttribute,\n ITooltip,\n ChildrenType,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = ({\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style,\n position,\n isOpen,\n disableStyleInjection = false,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n}: ITooltipController) => {\n const [tooltipContent, setTooltipContent] = useState(content)\n const [tooltipHtml, setTooltipHtml] = useState(html)\n const [tooltipPlace, setTooltipPlace] = useState(place)\n const [tooltipVariant, setTooltipVariant] = useState(variant)\n const [tooltipOffset, setTooltipOffset] = useState(offset)\n const [tooltipDelayShow, setTooltipDelayShow] = useState(delayShow)\n const [tooltipDelayHide, setTooltipDelayHide] = useState(delayHide)\n const [tooltipFloat, setTooltipFloat] = useState(float)\n const [tooltipHidden, setTooltipHidden] = useState(hidden)\n const [tooltipWrapper, setTooltipWrapper] = useState<WrapperType>(wrapper)\n const [tooltipEvents, setTooltipEvents] = useState(events)\n const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy)\n const [activeAnchor, setActiveAnchor] = useState<HTMLElement | null>(null)\n const styleInjectionRef = useRef(disableStyleInjection)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, activeAnchor: providerActiveAnchor } = useTooltip(id)\n\n const getDataAttributesFromAnchorElement = (elementReference: HTMLElement) => {\n const dataAttributes = elementReference?.getAttributeNames().reduce((acc, name) => {\n if (name.startsWith('data-tooltip-')) {\n const parsedAttribute = name.replace(/^data-tooltip-/, '') as DataAttribute\n acc[parsedAttribute] = elementReference?.getAttribute(name) ?? null\n }\n return acc\n }, {} as Record<DataAttribute, string | null>)\n\n return dataAttributes\n }\n\n const applyAllDataAttributesFromAnchorElement = (\n dataAttributes: Record<string, string | null>,\n ) => {\n const handleDataAttributes: Record<DataAttribute, (value: string | null) => void> = {\n place: (value) => {\n setTooltipPlace((value as PlacesType) ?? place)\n },\n content: (value) => {\n setTooltipContent(value ?? content)\n },\n html: (value) => {\n setTooltipHtml(value ?? html)\n },\n variant: (value) => {\n setTooltipVariant((value as VariantType) ?? variant)\n },\n offset: (value) => {\n setTooltipOffset(value === null ? offset : Number(value))\n },\n wrapper: (value) => {\n setTooltipWrapper((value as WrapperType) ?? wrapper)\n },\n events: (value) => {\n const parsed = value?.split(' ') as EventsType[]\n setTooltipEvents(parsed ?? events)\n },\n 'position-strategy': (value) => {\n setTooltipPositionStrategy((value as PositionStrategy) ?? positionStrategy)\n },\n 'delay-show': (value) => {\n setTooltipDelayShow(value === null ? delayShow : Number(value))\n },\n 'delay-hide': (value) => {\n setTooltipDelayHide(value === null ? delayHide : Number(value))\n },\n float: (value) => {\n setTooltipFloat(value === null ? float : value === 'true')\n },\n hidden: (value) => {\n setTooltipHidden(value === null ? hidden : value === 'true')\n },\n }\n // reset unset data attributes to default values\n // without this, data attributes from the last active anchor will still be used\n Object.values(handleDataAttributes).forEach((handler) => handler(null))\n Object.entries(dataAttributes).forEach(([key, value]) => {\n handleDataAttributes[key as DataAttribute]?.(value)\n })\n }\n\n useEffect(() => {\n setTooltipContent(content)\n }, [content])\n\n useEffect(() => {\n setTooltipHtml(html)\n }, [html])\n\n useEffect(() => {\n setTooltipPlace(place)\n }, [place])\n\n useEffect(() => {\n setTooltipVariant(variant)\n }, [variant])\n\n useEffect(() => {\n setTooltipOffset(offset)\n }, [offset])\n\n useEffect(() => {\n setTooltipDelayShow(delayShow)\n }, [delayShow])\n\n useEffect(() => {\n setTooltipDelayHide(delayHide)\n }, [delayHide])\n\n useEffect(() => {\n setTooltipFloat(float)\n }, [float])\n\n useEffect(() => {\n setTooltipHidden(hidden)\n }, [hidden])\n\n useEffect(() => {\n setTooltipPositionStrategy(positionStrategy)\n }, [positionStrategy])\n\n useEffect(() => {\n if (styleInjectionRef.current === disableStyleInjection) {\n return\n }\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not change `disableStyleInjection` dynamically.')\n }\n }, [disableStyleInjection])\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n window.dispatchEvent(\n new CustomEvent('react-tooltip-inject-styles', {\n detail: {\n disableCore: disableStyleInjection === 'core',\n disableBase: disableStyleInjection,\n },\n }),\n )\n }\n }, [])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (selector) {\n try {\n const anchorsBySelect = document.querySelectorAll<HTMLElement>(selector)\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n } catch {\n if (!process.env.NODE_ENV || process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${selector}\" is not a valid CSS selector`)\n }\n }\n }\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n if (!elementRefs.size) {\n return () => null\n }\n\n const anchorElement = activeAnchor ?? anchorById ?? providerActiveAnchor.current\n\n const observerCallback: MutationCallback = (mutationList) => {\n mutationList.forEach((mutation) => {\n if (\n !anchorElement ||\n mutation.type !== 'attributes' ||\n !mutation.attributeName?.startsWith('data-tooltip-')\n ) {\n return\n }\n // make sure to get all set attributes, since all unset attributes are reset\n const dataAttributes = getDataAttributesFromAnchorElement(anchorElement)\n applyAllDataAttributesFromAnchorElement(dataAttributes)\n })\n }\n\n // Create an observer instance linked to the callback function\n const observer = new MutationObserver(observerCallback)\n\n // do not check for subtree and childrens, we only want to know attribute changes\n // to stay watching `data-attributes-*` from anchor element\n const observerConfig = { attributes: true, childList: false, subtree: false }\n\n if (anchorElement) {\n const dataAttributes = getDataAttributesFromAnchorElement(anchorElement)\n applyAllDataAttributesFromAnchorElement(dataAttributes)\n // Start observing the target node for configured mutations\n observer.observe(anchorElement, observerConfig)\n }\n\n return () => {\n // Remove the observer when the tooltip is destroyed\n observer.disconnect()\n }\n }, [anchorRefs, providerActiveAnchor, activeAnchor, anchorId, anchorSelect])\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (style?.border) {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not set `style.border`. Use `border` prop instead.')\n }\n if (border && !CSS.supports('border', `${border}`)) {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${border}\" is not a valid \\`border\\`.`)\n }\n if (style?.opacity) {\n // eslint-disable-next-line no-console\n console.warn('[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.')\n }\n if (opacity && !CSS.supports('opacity', `${opacity}`)) {\n // eslint-disable-next-line no-console\n console.warn(`[react-tooltip] \"${opacity}\" is not a valid \\`opacity\\`.`)\n }\n }, [])\n\n /**\n * content priority: children < render or content < html\n * children should be lower priority so that it can be used as the \"default\" content\n */\n let renderedContent: ChildrenType = children\n const contentWrapperRef = useRef<HTMLDivElement>(null)\n if (render) {\n const rendered = render({ content: tooltipContent ?? null, activeAnchor }) as React.ReactNode\n renderedContent = rendered ? (\n <div ref={contentWrapperRef} className=\"react-tooltip-content-wrapper\">\n {rendered}\n </div>\n ) : null\n } else if (tooltipContent) {\n renderedContent = tooltipContent\n }\n if (tooltipHtml) {\n renderedContent = <TooltipContent content={tooltipHtml} />\n }\n\n const props: ITooltip = {\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n closeOnScroll,\n closeOnResize,\n style,\n position,\n isOpen,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n}\n\nexport default TooltipController\n"],"names":["REACT_TOOLTIP_CORE_STYLES_ID","REACT_TOOLTIP_BASE_STYLES_ID","injected","core","base","injectStyle","css","id","type","ref","document","process","_a","env","REACT_TOOLTIP_DISABLE_CORE_STYLES","_b","REACT_TOOLTIP_DISABLE_BASE_STYLES","insertAt","getElementById","console","warn","head","getElementsByTagName","style","createElement","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","debounce","func","wait","immediate","timeout","args","later","apply","this","setTimeout","clearTimeout","DEFAULT_TOOLTIP_ID","DEFAULT_CONTEXT_DATA","anchorRefs","Set","activeAnchor","current","attach","detach","setActiveAnchor","DEFAULT_CONTEXT_DATA_WRAPPER","getTooltipData","TooltipContext","createContext","useTooltip","tooltipId","useContext","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","isScrollable","node","HTMLElement","SVGElement","getComputedStyle","some","propertyName","value","getPropertyValue","getScrollParent","currentParent","parentElement","scrollingElement","documentElement","computeTooltipPosition","async","elementReference","tooltipReference","tooltipArrowReference","place","offset","offsetValue","strategy","middlewares","Number","flip","shift","padding","border","tooltipStyles","tooltipArrowStyles","middleware","push","arrow","element","computePosition","placement","then","x","y","middlewareData","styles","left","top","arrowX","arrowY","staticSide","right","bottom","split","borderSide","borderBottom","borderRight","borderWidth","match","Tooltip","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","closeOnScroll","closeOnResize","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","opacity","arrowColor","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","wasShowing","lastFloatPosition","setProviderActiveAnchor","hoveringTooltip","anchorsBySelect","setAnchorsBySelect","mounted","shouldOpenOnClick","includes","handleShow","undefined","handleHideTooltipDelayed","delay","handleShowTooltip","event","target","currentTarget","isConnected","handleHideTooltip","handleTooltipPosition","getBoundingClientRect","width","height","computedStylesData","Object","keys","length","handleMouseMove","mouseEvent","mousePosition","clientX","clientY","handleClickTooltipAnchor","handleClickOutsideAnchors","querySelector","anchor","contains","debouncedHandleShowTooltip","debouncedHandleHideTooltip","updateTooltipPosition","useCallback","elementRefs","forEach","add","anchorById","handleScrollResize","anchorScrollParent","tooltipScrollParent","addEventListener","updateTooltipCleanup","autoUpdate","ancestorResize","elementResize","layoutShift","handleEsc","key","enabledEvents","listener","handleMouseEnterTooltip","handleMouseLeaveTooltip","removeEventListener","selector","documentObserver","MutationObserver","mutationList","newAnchors","removedAnchors","mutation","attributeName","getAttribute","elements","removedNodes","filter","nodeType","matches","flatMap","querySelectorAll","call","addedNodes","anchors","observe","body","childList","subtree","attributes","attributeFilter","disconnect","contentObserver","ResizeObserver","Array","from","canShow","React","role","classNames","coreStyles","coreStyles_show","coreStyles_fixed","coreStyles_clickable","coreStyles_noArrow","background","TooltipContent","dangerouslySetInnerHTML","__html","detail","disableCore","disableBase","html","render","children","disableStyleInjection","tooltipContent","setTooltipContent","tooltipHtml","setTooltipHtml","tooltipPlace","setTooltipPlace","tooltipVariant","setTooltipVariant","tooltipOffset","setTooltipOffset","tooltipDelayShow","setTooltipDelayShow","tooltipDelayHide","setTooltipDelayHide","tooltipFloat","setTooltipFloat","tooltipHidden","setTooltipHidden","tooltipWrapper","setTooltipWrapper","tooltipEvents","setTooltipEvents","tooltipPositionStrategy","setTooltipPositionStrategy","styleInjectionRef","providerActiveAnchor","getDataAttributesFromAnchorElement","getAttributeNames","reduce","acc","name","startsWith","replace","applyAllDataAttributesFromAnchorElement","dataAttributes","handleDataAttributes","parsed","values","handler","entries","dispatchEvent","CustomEvent","size","anchorElement","observer","observerConfig","CSS","supports","renderedContent","props","anchorRefMap","setAnchorRefMap","activeAnchorMap","setActiveAnchorMap","refs","oldMap","tooltipRefs","delete","context","useMemo","Provider","anchorRef","tagName","remove"],"mappings":";;;;;;2OACA,MAAMA,EAA+B,4BAE/BC,EAA+B,4BAE/BC,EAAW,CACfC,MAAM,EACNC,MAAM,GAGR,SAASC,GAAYC,IACnBA,EAAGC,GACHA,EAAKN,EAA4BO,KACjCA,EAAO,OAAMC,IACbA,YAQA,IAAKH,GAA2B,oBAAbI,UAA4BR,EAASM,GACtD,OAGF,GACW,SAATA,GACmB,oBAAZG,UACK,QAAZC,EAAA,OAAAD,cAAA,IAAAA,aAAA,EAAAA,QAASE,WAAG,IAAAD,OAAA,EAAAA,EAAEE,mCAEd,OAGF,GACW,SAATN,GACmB,oBAAZG,UACK,QAAZI,EAAA,OAAAJ,cAAA,IAAAA,aAAA,EAAAA,QAASE,WAAG,IAAAE,OAAA,EAAAA,EAAEC,mCAEd,OAGW,SAATR,IAEFD,EAAKP,GAGFS,IAEHA,EAAM,CAAA,GAER,MAAMQ,SAAEA,GAAaR,EAErB,GAAIC,SAASQ,eAAeX,GAQ1B,YAJEY,QAAQC,KACN,oCAAoCb,mDAM1C,MAAMc,EAAOX,SAASW,MAAQX,SAASY,qBAAqB,QAAQ,GAE9DC,EAAab,SAASc,cAAc,SAC1CD,EAAMhB,GAAKA,EACXgB,EAAMf,KAAO,WAEI,QAAbS,GACEI,EAAKI,WACPJ,EAAKK,aAAaH,EAAOF,EAAKI,YAKhCJ,EAAKM,YAAYJ,GAGfA,EAAMK,WACRL,EAAMK,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AK,GACtC,EASqCyC,CAAgBM,EAAW/C,GAChE,GACF,CAAC2T,EAAcE,EAAiBtR,EAAQC,IAGpC2R,EAAUC,EAAAA,SAAQ,KACf,CACLzR,oBAED,CAACA,IAEJ,OAAO2M,EAAA,QAAAvO,cAAC6B,EAAeyR,SAAQ,CAACzQ,MAAOuQ,GAAU5D,EAAmC,yBCzF/D,EACrBxN,YACAwN,WACA1J,YACArC,QACA4D,UACAiI,OACAtJ,UACAtC,SACA4C,UACAH,SACAE,mBACAG,YACAC,gBAEA,MAAMjF,OAAEA,EAAMC,OAAEA,GAAWM,EAAWC,GAChCuR,EAAY3L,SAA2B,MAS7C,OAPAvF,EAAAA,WAAU,KACRb,EAAO+R,GACA,KACL9R,EAAO8R,EAAU,IAElB,IAGDhF,EAAAA,QACEvO,cAAA,OAAA,CAAAf,IAAKsU,EACLzN,UAAW2I,EAAAA,QAAW,wBAAyB3I,GAC3B,qBAAArC,yBACE4D,EAAO,oBACViI,EAAI,uBACDtJ,EACD,sBAAAtC,EACC,uBAAA4C,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExB+I,EAEJ,sBH0CH,UAAqBxQ,KACnBA,EAAO,OAAMD,GACbA,EAAKN,GAIH,IACF,IAAKC,EAASM,GACZ,OAGW,SAATA,IAEFD,EAAKP,GAGP,MAAMuB,EAAQb,SAASQ,eAAeX,GACf,WAAnBgB,aAAK,EAALA,EAAOyT,SACTzT,SAAAA,EAAO0T,SAGP9T,QAAQC,KACN,6DAA6Db,oCAIjEL,EAASM,IAAQ,CACnB"}
@@ -4,5 +4,5 @@
4
4
  * @copyright ReactTooltip Team
5
5
  * @license MIT
6
6
  */
7
- import e,{createContext as t,useState as r,useCallback as o,useMemo as n,useContext as l,useRef as i,useEffect as c,useLayoutEffect as a}from"react";import{arrow as s,computePosition as u,offset as d,flip as p,shift as v,autoUpdate as m}from"@floating-ui/dom";import y from"classnames";const f="react-tooltip-core-styles",h="react-tooltip-base-styles",w={core:!1,base:!1};function b({css:e,id:t=h,type:r="base",ref:o}){var n,l;if(!e||"undefined"==typeof document||w[r])return;if("core"===r&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==r&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===r&&(t=f),o||(o={});const{insertAt:i}=o;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const c=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.id=t,a.type="text/css","top"===i&&c.firstChild?c.insertBefore(a,c.firstChild):c.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e)),w[r]=!0}function S({type:e="base",id:t=h}={}){if(!w[e])return;"core"===e&&(t=f);const r=document.getElementById(t);"style"===(null==r?void 0:r.tagName)?null==r||r.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),w[e]=!1}const E=(e,t,r)=>{let o=null;return function(...n){const l=()=>{o=null,r||e.apply(this,n)};r&&!o&&(e.apply(this,n),o=setTimeout(l,t)),r||(o&&clearTimeout(o),o=setTimeout(l,t))}},_="DEFAULT_TOOLTIP_ID",g={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},A=t({getTooltipData:()=>g}),T=({children:t})=>{const[l,i]=r({[_]:new Set}),[c,a]=r({[_]:{current:null}}),s=(e,...t)=>{i((r=>{var o;const n=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>n.add(e))),{...r,[e]:new Set(n)}}))},u=(e,...t)=>{i((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},d=o(((e=_)=>{var t,r;return{anchorRefs:null!==(t=l[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=c[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{a((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[l,c,s,u]),p=n((()=>({getTooltipData:d})),[d]);return e.createElement(A.Provider,{value:p},t)};function O(e=_){return l(A).getTooltipData(e)}const L=({tooltipId:t,children:r,className:o,place:n,content:l,html:a,variant:s,offset:u,wrapper:d,events:p,positionStrategy:v,delayShow:m,delayHide:f})=>{const{attach:h,detach:w}=O(t),b=i(null);return c((()=>(h(b),()=>{w(b)})),[]),e.createElement("span",{ref:b,className:y("react-tooltip-wrapper",o),"data-tooltip-place":n,"data-tooltip-content":l,"data-tooltip-html":a,"data-tooltip-variant":s,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":v,"data-tooltip-delay-show":m,"data-tooltip-delay-hide":f},r)},R="undefined"!=typeof window?a:c,N=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const r=t.getPropertyValue(e);return"auto"===r||"scroll"===r}))},k=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(N(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},x=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:o="top",offset:n=10,strategy:l="absolute",middlewares:i=[d(Number(n)),p(),v({padding:5})],border:c})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};const a=i;return r?(a.push(s({element:r,padding:5})),u(e,t,{placement:o,strategy:l,middleware:a}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var n,l;const i={left:`${e}px`,top:`${t}px`,border:c},{x:a,y:s}=null!==(n=o.arrow)&&void 0!==n?n:{x:0,y:0},u=null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==l?l:"bottom",d=c&&{borderBottom:c,borderRight:c};let p=0;if(c){const e=`${c}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:r}}))):u(e,t,{placement:"bottom",strategy:l,middleware:a}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var C="core-styles-module_tooltip__3vRRp",$="core-styles-module_fixed__pcSol",I="core-styles-module_arrow__cvMwQ",j="core-styles-module_noArrow__xock6",B="core-styles-module_clickable__ZuTTB",D="core-styles-module_show__Nt9eE",H={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 z=({id:t,className:n,classNameArrow:l,variant:a="dark",anchorId:s,anchorSelect:u,place:d="top",offset:p=10,events:v=["hover"],openOnClick:f=!1,positionStrategy:h="absolute",middlewares:w,wrapper:b,delayShow:S=0,delayHide:_=0,float:g=!1,hidden:A=!1,noArrow:T=!1,clickable:L=!1,closeOnEsc:N=!1,closeOnScroll:z=!1,closeOnResize:q=!1,style:W,position:M,afterShow:P,afterHide:F,content:K,contentWrapperRef:U,isOpen:X,setIsOpen:Y,activeAnchor:V,setActiveAnchor:Z,border:G,opacity:J,arrowColor:Q})=>{const ee=i(null),te=i(null),re=i(null),oe=i(null),[ne,le]=r(d),[ie,ce]=r({}),[ae,se]=r({}),[ue,de]=r(!1),[pe,ve]=r(!1),me=i(!1),ye=i(null),{anchorRefs:fe,setActiveAnchor:he}=O(t),we=i(!1),[be,Se]=r([]),Ee=i(!1),_e=f||v.includes("click");R((()=>(Ee.current=!0,()=>{Ee.current=!1})),[]),c((()=>{if(!ue){const e=setTimeout((()=>{ve(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ue]);const ge=e=>{Ee.current&&(e&&ve(!0),setTimeout((()=>{Ee.current&&(null==Y||Y(e),void 0===X&&de(e))}),10))};c((()=>{if(void 0===X)return()=>null;X&&ve(!0);const e=setTimeout((()=>{de(X)}),10);return()=>{clearTimeout(e)}}),[X]),c((()=>{ue!==me.current&&(me.current=ue,ue?null==P||P():null==F||F())}),[ue]);const Ae=(e=_)=>{oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{we.current||ge(!1)}),e)},Te=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return Z(null),void he({current:null});S?(re.current&&clearTimeout(re.current),re.current=setTimeout((()=>{ge(!0)}),S)):ge(!0),Z(r),he({current:r}),oe.current&&clearTimeout(oe.current)},Oe=()=>{L?Ae(_||100):_?Ae():ge(!1),re.current&&clearTimeout(re.current)},Le=({x:e,y:t})=>{x({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:h,middlewares:w,border:G}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),le(e.place)}))},Re=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Le(r),ye.current=r},Ne=e=>{Te(e),_&&Ae()},ke=e=>{var t;[document.querySelector(`[id='${s}']`),...be].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=ee.current)||void 0===t?void 0:t.contains(e.target))||(ge(!1),re.current&&clearTimeout(re.current))},xe=E(Te,50,!0),Ce=E(Oe,50,!0),$e=o((()=>{M?Le(M):g?ye.current&&Le(ye.current):x({place:d,offset:p,elementReference:V,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:h,middlewares:w,border:G}).then((e=>{Ee.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),le(e.place))}))}),[ue,V,K,W,d,p,h,M,g]);c((()=>{var e,t;const r=new Set(fe);be.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${s}']`);o&&r.add({current:o});const n=()=>{ge(!1)},l=k(V),i=k(ee.current);z&&(window.addEventListener("scroll",n),null==l||l.addEventListener("scroll",n),null==i||i.addEventListener("scroll",n));let c=null;q?window.addEventListener("resize",n):V&&ee.current&&(c=m(V,ee.current,$e,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const a=e=>{"Escape"===e.key&&ge(!1)};N&&window.addEventListener("keydown",a);const u=[];_e?(window.addEventListener("click",ke),u.push({event:"click",listener:Ne})):(u.push({event:"mouseenter",listener:xe},{event:"mouseleave",listener:Ce},{event:"focus",listener:xe},{event:"blur",listener:Ce}),g&&u.push({event:"mousemove",listener:Re}));const d=()=>{we.current=!0},p=()=>{we.current=!1,Oe()};return L&&!_e&&(null===(e=ee.current)||void 0===e||e.addEventListener("mouseenter",d),null===(t=ee.current)||void 0===t||t.addEventListener("mouseleave",p)),u.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;z&&(window.removeEventListener("scroll",n),null==l||l.removeEventListener("scroll",n),null==i||i.removeEventListener("scroll",n)),q?window.removeEventListener("resize",n):null==c||c(),_e&&window.removeEventListener("click",ke),N&&window.removeEventListener("keydown",a),L&&!_e&&(null===(e=ee.current)||void 0===e||e.removeEventListener("mouseenter",d),null===(t=ee.current)||void 0===t||t.removeEventListener("mouseleave",p)),u.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[V,$e,pe,fe,be,N,v]),c((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type&&(V&&[...r.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,V))&&(ve(!1),ge(!1),Z(null),re.current&&clearTimeout(re.current),oe.current&&clearTimeout(oe.current),!0)})),e))try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&Se((e=>[...e,...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,u,V]),c((()=>{$e()}),[$e]),c((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{$e()}));return e.observe(U.current),()=>{e.disconnect()}}),[K,null==U?void 0:U.current]),c((()=>{var e;const t=document.querySelector(`[id='${s}']`),r=[...be,t];V&&r.includes(V)||Z(null!==(e=be[0])&&void 0!==e?e:t)}),[s,be,V]),c((()=>()=>{re.current&&clearTimeout(re.current),oe.current&&clearTimeout(oe.current)}),[]),c((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));Se(t)}catch(e){Se([])}}),[t,u]);const Ie=!A&&K&&ue&&Object.keys(ie).length>0;return pe?e.createElement(b,{id:t,role:"tooltip",className:y("react-tooltip",C,H.tooltip,H[a],n,`react-tooltip__place-${ne}`,{"react-tooltip__show":Ie,[D]:Ie,[$]:"fixed"===h,[B]:L}),style:{...W,...ie,opacity:void 0!==J&&Ie?J:void 0},ref:ee},K,e.createElement(b,{className:y("react-tooltip-arrow",I,H.arrow,l,{[j]:T}),style:{...ae,background:Q?`linear-gradient(to right bottom, transparent 50%, ${Q} 50%)`:void 0},ref:te})):null},q=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),W=({id:t,anchorId:o,anchorSelect:n,content:l,html:a,render:s,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:y="div",children:f=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:b="absolute",middlewares:S,delayShow:E=0,delayHide:_=0,float:g=!1,hidden:A=!1,noArrow:T=!1,clickable:L=!1,closeOnEsc:R=!1,closeOnScroll:N=!1,closeOnResize:k=!1,style:x,position:C,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:D,setIsOpen:H,afterShow:W,afterHide:M})=>{const[P,F]=r(l),[K,U]=r(a),[X,Y]=r(v),[V,Z]=r(p),[G,J]=r(m),[Q,ee]=r(E),[te,re]=r(_),[oe,ne]=r(g),[le,ie]=r(A),[ce,ae]=r(y),[se,ue]=r(h),[de,pe]=r(b),[ve,me]=r(null),ye=i(I),{anchorRefs:fe,activeAnchor:he}=O(t),we=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),be=e=>{const t={place:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:v)},content:e=>{F(null!=e?e:l)},html:e=>{U(null!=e?e:a)},variant:e=>{var t;Z(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{J(null===e?m:Number(e))},wrapper:e=>{var t;ae(null!==(t=e)&&void 0!==t?t:y)},events:e=>{const t=null==e?void 0:e.split(" ");ue(null!=t?t:h)},"position-strategy":e=>{var t;pe(null!==(t=e)&&void 0!==t?t:b)},"delay-show":e=>{ee(null===e?E:Number(e))},"delay-hide":e=>{re(null===e?_:Number(e))},float:e=>{ne(null===e?g:"true"===e)},hidden:e=>{ie(null===e?A:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};c((()=>{F(l)}),[l]),c((()=>{U(a)}),[a]),c((()=>{Y(v)}),[v]),c((()=>{Z(p)}),[p]),c((()=>{J(m)}),[m]),c((()=>{ee(E)}),[E]),c((()=>{re(_)}),[_]),c((()=>{ne(g)}),[g]),c((()=>{ie(A)}),[A]),c((()=>{pe(b)}),[b]),c((()=>{ye.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),c((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),c((()=>{var e;const r=new Set(fe);let l=n;if(!l&&t&&(l=`[data-tooltip-id='${t}']`),l)try{document.querySelectorAll(l).forEach((e=>{r.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`)}const i=document.querySelector(`[id='${o}']`);if(i&&r.add({current:i}),!r.size)return()=>null;const c=null!==(e=null!=ve?ve:i)&&void 0!==e?e:he.current,a=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 r=we(c);be(r)}))})),s={attributes:!0,childList:!1,subtree:!1};if(c){const e=we(c);be(e),a.observe(c,s)}return()=>{a.disconnect()}}),[fe,he,ve,o,n]),c((()=>{(null==x?void 0:x.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==x?void 0:x.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let Se=f;const Ee=i(null);if(s){const t=s({content:null!=P?P:null,activeAnchor:ve});Se=t?e.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},t):null}else P&&(Se=P);K&&(Se=e.createElement(q,{content:K}));const _e={id:t,anchorId:o,anchorSelect:n,className:u,classNameArrow:d,content:Se,contentWrapperRef:Ee,place:X,variant:V,offset:G,wrapper:ce,events:se,openOnClick:w,positionStrategy:de,middlewares:S,delayShow:Q,delayHide:te,float:oe,hidden:le,noArrow:T,clickable:L,closeOnEsc:R,closeOnScroll:N,closeOnResize:k,style:x,position:C,isOpen:$,border:j,opacity:B,arrowColor:D,setIsOpen:H,afterShow:W,afterHide:M,activeAnchor:ve,setActiveAnchor:e=>me(e)};return e.createElement(z,{..._e})};"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||b({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}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.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{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||b({css:`
8
- .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"})}));export{W as Tooltip,T as TooltipProvider,L as TooltipWrapper,S as removeStyle};
7
+ import e,{createContext as t,useState as r,useCallback as o,useMemo as n,useContext as l,useRef as i,useEffect as c,useLayoutEffect as s}from"react";import{arrow as a,computePosition as u,offset as d,flip as p,shift as v,autoUpdate as m}from"@floating-ui/dom";import f from"classnames";const y="react-tooltip-core-styles",h="react-tooltip-base-styles",w={core:!1,base:!1};function b({css:e,id:t=h,type:r="base",ref:o}){var n,l;if(!e||"undefined"==typeof document||w[r])return;if("core"===r&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==r&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===r&&(t=y),o||(o={});const{insertAt:i}=o;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const c=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.id=t,s.type="text/css","top"===i&&c.firstChild?c.insertBefore(s,c.firstChild):c.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),w[r]=!0}function S({type:e="base",id:t=h}={}){if(!w[e])return;"core"===e&&(t=y);const r=document.getElementById(t);"style"===(null==r?void 0:r.tagName)?null==r||r.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),w[e]=!1}const E=(e,t,r)=>{let o=null;return function(...n){const l=()=>{o=null,r||e.apply(this,n)};r&&!o&&(e.apply(this,n),o=setTimeout(l,t)),r||(o&&clearTimeout(o),o=setTimeout(l,t))}},g="DEFAULT_TOOLTIP_ID",_={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},A=t({getTooltipData:()=>_}),T=({children:t})=>{const[l,i]=r({[g]:new Set}),[c,s]=r({[g]:{current:null}}),a=(e,...t)=>{i((r=>{var o;const n=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>n.add(e))),{...r,[e]:new Set(n)}}))},u=(e,...t)=>{i((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},d=o(((e=g)=>{var t,r;return{anchorRefs:null!==(t=l[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=c[e])&&void 0!==r?r:{current:null},attach:(...t)=>a(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{s((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[l,c,a,u]),p=n((()=>({getTooltipData:d})),[d]);return e.createElement(A.Provider,{value:p},t)};function O(e=g){return l(A).getTooltipData(e)}const L=({tooltipId:t,children:r,className:o,place:n,content:l,html:s,variant:a,offset:u,wrapper:d,events:p,positionStrategy:v,delayShow:m,delayHide:y})=>{const{attach:h,detach:w}=O(t),b=i(null);return c((()=>(h(b),()=>{w(b)})),[]),e.createElement("span",{ref:b,className:f("react-tooltip-wrapper",o),"data-tooltip-place":n,"data-tooltip-content":l,"data-tooltip-html":s,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":v,"data-tooltip-delay-show":m,"data-tooltip-delay-hide":y},r)},R="undefined"!=typeof window?s:c,C=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const r=t.getPropertyValue(e);return"auto"===r||"scroll"===r}))},N=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(C(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},k=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:o="top",offset:n=10,strategy:l="absolute",middlewares:i=[d(Number(n)),p(),v({padding:5})],border:c})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};const s=i;return r?(s.push(a({element:r,padding:5})),u(e,t,{placement:o,strategy:l,middleware:s}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var n,l;const i={left:`${e}px`,top:`${t}px`,border:c},{x:s,y:a}=null!==(n=o.arrow)&&void 0!==n?n:{x:0,y:0},u=null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==l?l:"bottom",d=c&&{borderBottom:c,borderRight:c};let p=0;if(c){const e=`${c}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:r}}))):u(e,t,{placement:"bottom",strategy:l,middleware:s}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var x="core-styles-module_tooltip__3vRRp",$="core-styles-module_fixed__pcSol",I="core-styles-module_arrow__cvMwQ",j="core-styles-module_noArrow__xock6",B="core-styles-module_clickable__ZuTTB",D="core-styles-module_show__Nt9eE",H={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 q=({id:t,className:n,classNameArrow:l,variant:s="dark",anchorId:a,anchorSelect:u,place:d="top",offset:p=10,events:v=["hover"],openOnClick:y=!1,positionStrategy:h="absolute",middlewares:w,wrapper:b,delayShow:S=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:L=!1,closeOnEsc:C=!1,closeOnScroll:q=!1,closeOnResize:z=!1,style:M,position:W,afterShow:P,afterHide:F,content:K,contentWrapperRef:U,isOpen:X,setIsOpen:Y,activeAnchor:V,setActiveAnchor:Z,border:G,opacity:J,arrowColor:Q})=>{const ee=i(null),te=i(null),re=i(null),oe=i(null),[ne,le]=r(d),[ie,ce]=r({}),[se,ae]=r({}),[ue,de]=r(!1),[pe,ve]=r(!1),me=i(!1),fe=i(null),{anchorRefs:ye,setActiveAnchor:he}=O(t),we=i(!1),[be,Se]=r([]),Ee=i(!1),ge=y||v.includes("click");R((()=>(Ee.current=!0,()=>{Ee.current=!1})),[]),c((()=>{if(!ue){const e=setTimeout((()=>{ve(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ue]);const _e=e=>{Ee.current&&(e&&ve(!0),setTimeout((()=>{Ee.current&&(null==Y||Y(e),void 0===X&&de(e))}),10))};c((()=>{if(void 0===X)return()=>null;X&&ve(!0);const e=setTimeout((()=>{de(X)}),10);return()=>{clearTimeout(e)}}),[X]),c((()=>{ue!==me.current&&(me.current=ue,ue?null==P||P():null==F||F())}),[ue]);const Ae=(e=g)=>{oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{we.current||_e(!1)}),e)},Te=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return Z(null),void he({current:null});S?(re.current&&clearTimeout(re.current),re.current=setTimeout((()=>{_e(!0)}),S)):_e(!0),Z(r),he({current:r}),oe.current&&clearTimeout(oe.current)},Oe=()=>{L?Ae(g||100):g?Ae():_e(!1),re.current&&clearTimeout(re.current)},Le=({x:e,y:t})=>{k({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:h,middlewares:w,border:G}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place)}))},Re=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Le(r),fe.current=r},Ce=e=>{Te(e),g&&Ae()},Ne=e=>{var t;[document.querySelector(`[id='${a}']`),...be].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=ee.current)||void 0===t?void 0:t.contains(e.target))||(_e(!1),re.current&&clearTimeout(re.current))},ke=E(Te,50,!0),xe=E(Oe,50,!0),$e=o((()=>{W?Le(W):_?fe.current&&Le(fe.current):(null==V?void 0:V.isConnected)&&k({place:d,offset:p,elementReference:V,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:h,middlewares:w,border:G}).then((e=>{Ee.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place))}))}),[ue,V,K,M,d,p,h,W,_]);c((()=>{var e,t;const r=new Set(ye);be.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${a}']`);o&&r.add({current:o});const n=()=>{_e(!1)},l=N(V),i=N(ee.current);q&&(window.addEventListener("scroll",n),null==l||l.addEventListener("scroll",n),null==i||i.addEventListener("scroll",n));let c=null;z?window.addEventListener("resize",n):V&&ee.current&&(c=m(V,ee.current,$e,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&_e(!1)};C&&window.addEventListener("keydown",s);const u=[];ge?(window.addEventListener("click",Ne),u.push({event:"click",listener:Ce})):(u.push({event:"mouseenter",listener:ke},{event:"mouseleave",listener:xe},{event:"focus",listener:ke},{event:"blur",listener:xe}),_&&u.push({event:"mousemove",listener:Re}));const d=()=>{we.current=!0},p=()=>{we.current=!1,Oe()};return L&&!ge&&(null===(e=ee.current)||void 0===e||e.addEventListener("mouseenter",d),null===(t=ee.current)||void 0===t||t.addEventListener("mouseleave",p)),u.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;q&&(window.removeEventListener("scroll",n),null==l||l.removeEventListener("scroll",n),null==i||i.removeEventListener("scroll",n)),z?window.removeEventListener("resize",n):null==c||c(),ge&&window.removeEventListener("click",Ne),C&&window.removeEventListener("keydown",s),L&&!ge&&(null===(e=ee.current)||void 0===e||e.removeEventListener("mouseenter",d),null===(t=ee.current)||void 0===t||t.removeEventListener("mouseleave",p)),u.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[V,$e,pe,ye,be,C,v]),c((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[],n=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type){if(V){const t=[...r.removedNodes].filter((e=>1===e.nodeType));if(e)try{n.push(...t.filter((t=>t.matches(e)))),n.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,V))&&(ve(!1),_e(!1),Z(null),re.current&&clearTimeout(re.current),oe.current&&clearTimeout(oe.current),!0)}))}if(e)try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}}})),(o.length||n.length)&&Se((e=>[...e.filter((e=>n.includes(e))),...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,u,V]),c((()=>{$e()}),[$e]),c((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{$e()}));return e.observe(U.current),()=>{e.disconnect()}}),[K,null==U?void 0:U.current]),c((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...be,t];V&&r.includes(V)||Z(null!==(e=be[0])&&void 0!==e?e:t)}),[a,be,V]),c((()=>()=>{re.current&&clearTimeout(re.current),oe.current&&clearTimeout(oe.current)}),[]),c((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));Se(t)}catch(e){Se([])}}),[t,u]);const Ie=!A&&K&&ue&&Object.keys(ie).length>0;return pe?e.createElement(b,{id:t,role:"tooltip",className:f("react-tooltip",x,H.tooltip,H[s],n,`react-tooltip__place-${ne}`,{"react-tooltip__show":Ie,[D]:Ie,[$]:"fixed"===h,[B]:L}),style:{...M,...ie,opacity:void 0!==J&&Ie?J:void 0},ref:ee},K,e.createElement(b,{className:f("react-tooltip-arrow",I,H.arrow,l,{[j]:T}),style:{...se,background:Q?`linear-gradient(to right bottom, transparent 50%, ${Q} 50%)`:void 0},ref:te})):null},z=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),M=({id:t,anchorId:o,anchorSelect:n,content:l,html:s,render:a,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:f="div",children:y=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:b="absolute",middlewares:S,delayShow:E=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:L=!1,closeOnEsc:R=!1,closeOnScroll:C=!1,closeOnResize:N=!1,style:k,position:x,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:D,setIsOpen:H,afterShow:M,afterHide:W})=>{const[P,F]=r(l),[K,U]=r(s),[X,Y]=r(v),[V,Z]=r(p),[G,J]=r(m),[Q,ee]=r(E),[te,re]=r(g),[oe,ne]=r(_),[le,ie]=r(A),[ce,se]=r(f),[ae,ue]=r(h),[de,pe]=r(b),[ve,me]=r(null),fe=i(I),{anchorRefs:ye,activeAnchor:he}=O(t),we=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),be=e=>{const t={place:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:v)},content:e=>{F(null!=e?e:l)},html:e=>{U(null!=e?e:s)},variant:e=>{var t;Z(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{J(null===e?m:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ue(null!=t?t:h)},"position-strategy":e=>{var t;pe(null!==(t=e)&&void 0!==t?t:b)},"delay-show":e=>{ee(null===e?E:Number(e))},"delay-hide":e=>{re(null===e?g:Number(e))},float:e=>{ne(null===e?_:"true"===e)},hidden:e=>{ie(null===e?A:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};c((()=>{F(l)}),[l]),c((()=>{U(s)}),[s]),c((()=>{Y(v)}),[v]),c((()=>{Z(p)}),[p]),c((()=>{J(m)}),[m]),c((()=>{ee(E)}),[E]),c((()=>{re(g)}),[g]),c((()=>{ne(_)}),[_]),c((()=>{ie(A)}),[A]),c((()=>{pe(b)}),[b]),c((()=>{fe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),c((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),c((()=>{var e;const r=new Set(ye);let l=n;if(!l&&t&&(l=`[data-tooltip-id='${t}']`),l)try{document.querySelectorAll(l).forEach((e=>{r.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`)}const i=document.querySelector(`[id='${o}']`);if(i&&r.add({current:i}),!r.size)return()=>null;const c=null!==(e=null!=ve?ve:i)&&void 0!==e?e:he.current,s=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 r=we(c);be(r)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=we(c);be(e),s.observe(c,a)}return()=>{s.disconnect()}}),[ye,he,ve,o,n]),c((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let Se=y;const Ee=i(null);if(a){const t=a({content:null!=P?P:null,activeAnchor:ve});Se=t?e.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},t):null}else P&&(Se=P);K&&(Se=e.createElement(z,{content:K}));const ge={id:t,anchorId:o,anchorSelect:n,className:u,classNameArrow:d,content:Se,contentWrapperRef:Ee,place:X,variant:V,offset:G,wrapper:ce,events:ae,openOnClick:w,positionStrategy:de,middlewares:S,delayShow:Q,delayHide:te,float:oe,hidden:le,noArrow:T,clickable:L,closeOnEsc:R,closeOnScroll:C,closeOnResize:N,style:k,position:x,isOpen:$,border:j,opacity:B,arrowColor:D,setIsOpen:H,afterShow:M,afterHide:W,activeAnchor:ve,setActiveAnchor:e=>me(e)};return e.createElement(q,{...ge})};"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||b({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}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.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{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||b({css:`
8
+ .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"})}));export{M as Tooltip,T as TooltipProvider,L as TooltipWrapper,S as removeStyle};