react-tooltip 5.21.3 → 5.22.0-beta.1091.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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",i={core:!1,base:!1};function a({css:e,id:t=c,type:r="base",ref:o}){var l,n;if(!e||"undefined"==typeof document||i[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:a}=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"===a&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),i[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:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===r)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const a=c;return o?(a.push(t.arrow({element:o,padding:5})),t.computePosition(e,r,{placement:l,strategy:s,middleware:a}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const s={left:`${e}px`,top:`${t}px`,border:i},{x:c,y:a}=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=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:s,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:r}}))):t.computePosition(e,r,{placement:"bottom",strategy:s,middleware:a}).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:i,anchorSelect:a,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:P,afterShow:H,afterHide:z,content:M,contentWrapperRef:W,isOpen:U,holdPositionOnRender:F,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:V,opacity:Z,arrowColor:G})=>{const J=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),[re,oe]=e.useState(d),[le,ne]=e.useState({}),[se,ce]=e.useState({}),[ie,ae]=e.useState(!1),[ue,de]=e.useState(!1),pe=e.useRef(!1),fe=e.useRef(null),{anchorRefs:ve,setActiveAnchor:me}=m(r),ye=e.useRef(!1),[he,we]=e.useState([]),Se=e.useRef(!1),Ee=v||f.includes("click");y((()=>(Se.current=!0,()=>{Se.current=!1})),[]),e.useEffect((()=>{if(!ie){const e=setTimeout((()=>{de(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ie]);const be=e=>{Se.current&&(e&&de(!0),setTimeout((()=>{Se.current&&(null==K||K(e),void 0===U&&ae(e))}),10))};e.useEffect((()=>{if(void 0===U)return()=>null;U&&de(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),e.useEffect((()=>{ie!==pe.current&&(pe.current=ie,ie?null==H||H():null==z||z())}),[ie]);const _e=(e=C)=>{te.current&&clearTimeout(te.current),te.current=setTimeout((()=>{ye.current||be(!1)}),e)},ge=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 Y(null),void me({current:null});x?(ee.current&&clearTimeout(ee.current),ee.current=setTimeout((()=>{be(!0)}),x)):be(!0),Y(r),me({current:r}),te.current&&clearTimeout(te.current)},Ae=()=>{I?_e(C||100):C?_e():be(!1),ee.current&&clearTimeout(ee.current)},Te=({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:J.current,tooltipArrowReference:Q.current,strategy:h,middlewares:O,border:V}).then((e=>{Object.keys(e.tooltipStyles).length&&ne(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ce(e.tooltipArrowStyles),oe(e.place)}))},Re=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Te(r),fe.current=r},Oe=e=>{ge(e),C&&_e()},Le=e=>{var t;[document.querySelector(`[id='${i}']`),...he].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=J.current)||void 0===t?void 0:t.contains(e.target))||(be(!1),ee.current&&clearTimeout(ee.current))},xe=u(ge,50,!0),Ce=u(Ae,50,!0),ke=e.useCallback((()=>{P?Te(P):k?fe.current&&Te(fe.current):(null==X?void 0:X.isConnected)&&S({place:d,offset:p,elementReference:X,tooltipReference:J.current,tooltipArrowReference:Q.current,strategy:h,middlewares:O,border:V}).then((e=>{Se.current&&(Object.keys(e.tooltipStyles).length&&ne(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ce(e.tooltipArrowStyles),oe(e.place))}))}),[ie,X,M,D,d,p,h,P,k]);e.useEffect((()=>{var e,r;const o=new Set(ve);he.forEach((e=>{o.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&o.add({current:l});const n=()=>{be(!1)},s=w(X),c=w(J.current);B&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let a=null;q?window.addEventListener("resize",n):X&&J.current&&!F&&(a=t.autoUpdate(X,J.current,ke,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&be(!1)};j&&window.addEventListener("keydown",u);const d=[];Ee?(window.addEventListener("click",Le),d.push({event:"click",listener:Oe})):(d.push({event:"mouseenter",listener:xe},{event:"mouseleave",listener:Ce},{event:"focus",listener:xe},{event:"blur",listener:Ce}),k&&d.push({event:"mousemove",listener:Re}));const p=()=>{ye.current=!0},f=()=>{ye.current=!1,Ae()};return I&&!Ee&&(null===(e=J.current)||void 0===e||e.addEventListener("mouseenter",p),null===(r=J.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==a||a(),Ee&&window.removeEventListener("click",Le),j&&window.removeEventListener("keydown",u),I&&!Ee&&(null===(e=J.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=J.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)}))}))}}),[X,ke,ue,ve,he,j,f]),e.useEffect((()=>{let e=null!=a?a:"";!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(X){const r=[...t.removedNodes].filter((e=>1===e.nodeType));e&&(l.push(...r.filter((t=>t.matches(e)))),l.push(...r.flatMap((t=>[...t.querySelectorAll(e)])))),r.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(de(!1),be(!1),Y(null),ee.current&&clearTimeout(ee.current),te.current&&clearTimeout(te.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&&we((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,a,X]),e.useEffect((()=>{ke()}),[ke]),e.useEffect((()=>{if(!(null==W?void 0:W.current))return()=>null;const e=new ResizeObserver((()=>{ke()}));return e.observe(W.current),()=>{e.disconnect()}}),[M,null==W?void 0:W.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),r=[...he,t];X&&r.includes(X)||Y(null!==(e=he[0])&&void 0!==e?e:t)}),[i,he,X]),e.useEffect((()=>()=>{ee.current&&clearTimeout(ee.current),te.current&&clearTimeout(te.current)}),[]),e.useEffect((()=>{let e=a;if(!e&&r&&(e=`[data-tooltip-id='${r}']`),e)try{const t=Array.from(document.querySelectorAll(e));we(t)}catch(e){we([])}}),[r,a]);const Ne=!N&&M&&ie&&Object.keys(le).length>0;return ue||pe.current&&F?l.default.createElement(L,{id:r,role:"tooltip",className:n.default("react-tooltip",E,R.tooltip,R[c],o,`react-tooltip__place-${re}`,{"react-tooltip__show":Ne,[T]:Ne,[b]:"fixed"===h,[A]:I}),style:{...D,...le,opacity:void 0!==Z&&Ne?Z:void 0},ref:J},M,l.default.createElement(L,{className:n.default("react-tooltip-arrow",_,R.arrow,s,{[g]:$}),style:{...se,background:G?`linear-gradient(to right bottom, transparent 50%, ${G} 50%)`:void 0},ref:Q})):null},L=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||a({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||a({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:i,classNameArrow:a,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,holdPositionOnRender:j,border:B,opacity:q,arrowColor:D,setIsOpen:P,afterShow:H,afterHide:z})=>{const[M,W]=e.useState(n),[U,F]=e.useState(s),[K,X]=e.useState(d),[Y,V]=e.useState(u),[Z,G]=e.useState(p),[J,Q]=e.useState(E),[ee,te]=e.useState(b),[re,oe]=e.useState(_),[le,ne]=e.useState(g),[se,ce]=e.useState(f),[ie,ae]=e.useState(y),[ue,de]=e.useState(w),[pe,fe]=e.useState(null),ve=e.useRef(I),{anchorRefs:me,activeAnchor:ye}=m(t),he=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}),{}),we=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:n)},html:e=>{F(null!=e?e:s)},variant:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{G(null===e?p:Number(e))},wrapper:e=>{var t;ce(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;de(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{Q(null===e?E:Number(e))},"delay-hide":e=>{te(null===e?b:Number(e))},float:e=>{oe(null===e?_:"true"===e)},hidden:e=>{ne(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((()=>{W(n)}),[n]),e.useEffect((()=>{F(s)}),[s]),e.useEffect((()=>{X(d)}),[d]),e.useEffect((()=>{V(u)}),[u]),e.useEffect((()=>{G(p)}),[p]),e.useEffect((()=>{Q(E)}),[E]),e.useEffect((()=>{te(b)}),[b]),e.useEffect((()=>{oe(_)}),[_]),e.useEffect((()=>{ne(g)}),[g]),e.useEffect((()=>{de(w)}),[w]),e.useEffect((()=>{ve.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(me);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!=pe?pe:s)&&void 0!==e?e:ye.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const r=he(c);we(r)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=he(c);we(e),i.observe(c,a)}return()=>{i.disconnect()}}),[me,ye,pe,r,o]),e.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),B&&!CSS.supports("border",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),q&&!CSS.supports("opacity",`${q}`)&&console.warn(`[react-tooltip] "${q}" is not a valid \`opacity\`.`)}),[]);let Se=v;const Ee=e.useRef(null);if(c){const e=c({content:null!=M?M:null,activeAnchor:pe});Se=e?l.default.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},e):null}else M&&(Se=M);U&&(Se=l.default.createElement(L,{content:U}));const be={id:t,anchorId:r,anchorSelect:o,className:i,classNameArrow:a,content:Se,contentWrapperRef:Ee,place:K,variant:Y,offset:Z,wrapper:se,events:ie,openOnClick:h,positionStrategy:ue,middlewares:S,delayShow:J,delayHide:ee,float:re,hidden:le,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:x,closeOnResize:C,style:k,position:N,isOpen:$,holdPositionOnRender:j,border:B,opacity:q,arrowColor:D,setIsOpen:P,afterShow:H,afterHide:z,activeAnchor:pe,setActiveAnchor:e=>fe(e)};return l.default.createElement(O,{...be})},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)}}))},i=(e,...t)=>{o((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},a=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)=>i(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,i]),u=e.useMemo((()=>({getTooltipData:a})),[a]);return l.default.createElement(v.Provider,{value:u},t)},exports.TooltipWrapper=({tooltipId:t,children:r,className:o,place:s,content:c,html:i,variant:a,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":i,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":y},r)},exports.removeStyle=function({type:e="base",id:t=c}={}){if(!i[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`),i[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,EAAS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GACA,KACL7R,EAAO6R,EAAU,IAElB,IAGDhF,EAAAA,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 holdPositionOnRender,\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 && !holdPositionOnRender) {\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 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 }\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) {\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 || (wasShowing.current && holdPositionOnRender) ? (\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 holdPositionOnRender,\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 holdPositionOnRender,\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","holdPositionOnRender","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,aAA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AA,EAAAmC,WAAYtC,EAAIsC,QAC9B2R,EAGF,IAAKA,EAAQlR,CAACA,GAAY/C,EAAK,GACtC,EASqCyC,CAAgBM,EAAW/C,GAChE,GACF,CAAC4T,EAAcE,EAAiBvR,EAAQC,IAGpC4R,EAAUC,EAAAA,SAAQ,KACf,CACL1R,oBAED,CAACA,IAEJ,OAAO4M,EAAA,QAAAxO,cAAC6B,EAAe0R,SAAQ,CAAC1Q,MAAOwQ,GAAU5D,EAAmC,yBCzF/D,EACrBzN,YACAyN,WACA3J,YACArC,QACA4D,UACAkI,OACAvJ,UACAtC,SACA4C,UACAH,SACAE,mBACAG,YACAC,gBAEA,MAAMjF,OAAEA,EAAMC,OAAEA,GAAWM,EAAWC,GAChCwR,EAAY3L,SAA2B,MAS7C,OAPAxF,EAAAA,WAAU,KACRb,EAAOgS,GACA,KACL/R,EAAO+R,EAAU,IAElB,IAGDhF,EAAAA,QACExO,cAAA,OAAA,CAAAf,IAAKuU,EACL1N,UAAW4I,EAAAA,QAAW,wBAAyB5I,GAC3B,qBAAArC,yBACE4D,EAAO,oBACVkI,EAAI,uBACDvJ,EACD,sBAAAtC,EACC,uBAAA4C,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExBgJ,EAEJ,sBH0CH,UAAqBzQ,KACnBA,EAAO,OAAMD,GACbA,EAAKN,GAIH,IACF,IAAKC,EAASM,GACZ,OAGW,SAATA,IAEFD,EAAKP,GAGP,MAAMuB,EAAQb,SAASQ,eAAeX,GACf,WAAnBgB,aAAK,EAALA,EAAO0T,SACT1T,SAAAA,EAAO2T,SAGP/T,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 d,offset as u,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))}},_="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,s]=r({[_]:{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)}}))},d=(e,...t)=>{i((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},u=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)=>a(e,...t),detach:(...t)=>d(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,d]),p=n((()=>({getTooltipData:u})),[u]);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:s,variant:a,offset:d,wrapper:u,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":d,"data-tooltip-wrapper":u,"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=[u(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})),d(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},d=null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==l?l:"bottom",u=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:"",...u,[d]:`-${4+p}px`},place:r}}))):d(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:d,place:u="top",offset:p=10,events:v=["hover"],openOnClick:y=!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:C=!1,closeOnScroll:q=!1,closeOnResize:z=!1,style:P,position:M,afterShow:W,afterHide:F,content:K,contentWrapperRef:U,isOpen:X,holdPositionOnRender:Y,setIsOpen:V,activeAnchor:Z,setActiveAnchor:G,border:J,opacity:Q,arrowColor:ee})=>{const te=i(null),re=i(null),oe=i(null),ne=i(null),[le,ie]=r(u),[ce,se]=r({}),[ae,de]=r({}),[ue,pe]=r(!1),[ve,me]=r(!1),fe=i(!1),ye=i(null),{anchorRefs:he,setActiveAnchor:we}=O(t),be=i(!1),[Se,Ee]=r([]),_e=i(!1),ge=y||v.includes("click");R((()=>(_e.current=!0,()=>{_e.current=!1})),[]),c((()=>{if(!ue){const e=setTimeout((()=>{me(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ue]);const Ae=e=>{_e.current&&(e&&me(!0),setTimeout((()=>{_e.current&&(null==V||V(e),void 0===X&&pe(e))}),10))};c((()=>{if(void 0===X)return()=>null;X&&me(!0);const e=setTimeout((()=>{pe(X)}),10);return()=>{clearTimeout(e)}}),[X]),c((()=>{ue!==fe.current&&(fe.current=ue,ue?null==W||W():null==F||F())}),[ue]);const Te=(e=_)=>{ne.current&&clearTimeout(ne.current),ne.current=setTimeout((()=>{be.current||Ae(!1)}),e)},Oe=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 G(null),void we({current:null});S?(oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{Ae(!0)}),S)):Ae(!0),G(r),we({current:r}),ne.current&&clearTimeout(ne.current)},Le=()=>{L?Te(_||100):_?Te():Ae(!1),oe.current&&clearTimeout(oe.current)},Re=({x:e,y:t})=>{k({place:u,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:te.current,tooltipArrowReference:re.current,strategy:h,middlewares:w,border:J}).then((e=>{Object.keys(e.tooltipStyles).length&&se(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&de(e.tooltipArrowStyles),ie(e.place)}))},Ce=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Re(r),ye.current=r},Ne=e=>{Oe(e),_&&Te()},ke=e=>{var t;[document.querySelector(`[id='${a}']`),...Se].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=te.current)||void 0===t?void 0:t.contains(e.target))||(Ae(!1),oe.current&&clearTimeout(oe.current))},xe=E(Oe,50,!0),$e=E(Le,50,!0),Ie=o((()=>{M?Re(M):g?ye.current&&Re(ye.current):(null==Z?void 0:Z.isConnected)&&k({place:u,offset:p,elementReference:Z,tooltipReference:te.current,tooltipArrowReference:re.current,strategy:h,middlewares:w,border:J}).then((e=>{_e.current&&(Object.keys(e.tooltipStyles).length&&se(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&de(e.tooltipArrowStyles),ie(e.place))}))}),[ue,Z,K,P,u,p,h,M,g]);c((()=>{var e,t;const r=new Set(he);Se.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${a}']`);o&&r.add({current:o});const n=()=>{Ae(!1)},l=N(Z),i=N(te.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):Z&&te.current&&!Y&&(c=m(Z,te.current,Ie,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&Ae(!1)};C&&window.addEventListener("keydown",s);const d=[];ge?(window.addEventListener("click",ke),d.push({event:"click",listener:Ne})):(d.push({event:"mouseenter",listener:xe},{event:"mouseleave",listener:$e},{event:"focus",listener:xe},{event:"blur",listener:$e}),g&&d.push({event:"mousemove",listener:Ce}));const u=()=>{be.current=!0},p=()=>{be.current=!1,Le()};return L&&!ge&&(null===(e=te.current)||void 0===e||e.addEventListener("mouseenter",u),null===(t=te.current)||void 0===t||t.addEventListener("mouseleave",p)),d.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",ke),C&&window.removeEventListener("keydown",s),L&&!ge&&(null===(e=te.current)||void 0===e||e.removeEventListener("mouseenter",u),null===(t=te.current)||void 0===t||t.removeEventListener("mouseleave",p)),d.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[Z,Ie,ve,he,Se,C,v]),c((()=>{let e=null!=d?d:"";!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(Z){const t=[...r.removedNodes].filter((e=>1===e.nodeType));e&&(n.push(...t.filter((t=>t.matches(e)))),n.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))),t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,Z))&&(me(!1),Ae(!1),G(null),oe.current&&clearTimeout(oe.current),ne.current&&clearTimeout(ne.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&&Ee((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,d,Z]),c((()=>{Ie()}),[Ie]),c((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{Ie()}));return e.observe(U.current),()=>{e.disconnect()}}),[K,null==U?void 0:U.current]),c((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...Se,t];Z&&r.includes(Z)||G(null!==(e=Se[0])&&void 0!==e?e:t)}),[a,Se,Z]),c((()=>()=>{oe.current&&clearTimeout(oe.current),ne.current&&clearTimeout(ne.current)}),[]),c((()=>{let e=d;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));Ee(t)}catch(e){Ee([])}}),[t,d]);const je=!A&&K&&ue&&Object.keys(ce).length>0;return ve||fe.current&&Y?e.createElement(b,{id:t,role:"tooltip",className:f("react-tooltip",x,H.tooltip,H[s],n,`react-tooltip__place-${le}`,{"react-tooltip__show":je,[D]:je,[$]:"fixed"===h,[B]:L}),style:{...P,...ce,opacity:void 0!==Q&&je?Q:void 0},ref:te},K,e.createElement(b,{className:f("react-tooltip-arrow",I,H.arrow,l,{[j]:T}),style:{...ae,background:ee?`linear-gradient(to right bottom, transparent 50%, ${ee} 50%)`:void 0},ref:re})):null},z=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),P=({id:t,anchorId:o,anchorSelect:n,content:l,html:s,render:a,className:d,classNameArrow:u,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:_=0,float:g=!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,holdPositionOnRender:j,border:B,opacity:D,arrowColor:H,setIsOpen:P,afterShow:M,afterHide:W})=>{const[F,K]=r(l),[U,X]=r(s),[Y,V]=r(v),[Z,G]=r(p),[J,Q]=r(m),[ee,te]=r(E),[re,oe]=r(_),[ne,le]=r(g),[ie,ce]=r(A),[se,ae]=r(f),[de,ue]=r(h),[pe,ve]=r(b),[me,fe]=r(null),ye=i(I),{anchorRefs:he,activeAnchor:we}=O(t),be=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}),{}),Se=e=>{const t={place:e=>{var t;V(null!==(t=e)&&void 0!==t?t:v)},content:e=>{K(null!=e?e:l)},html:e=>{X(null!=e?e:s)},variant:e=>{var t;G(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{Q(null===e?m:Number(e))},wrapper:e=>{var t;ae(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;ve(null!==(t=e)&&void 0!==t?t:b)},"delay-show":e=>{te(null===e?E:Number(e))},"delay-hide":e=>{oe(null===e?_:Number(e))},float:e=>{le(null===e?g:"true"===e)},hidden:e=>{ce(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((()=>{K(l)}),[l]),c((()=>{X(s)}),[s]),c((()=>{V(v)}),[v]),c((()=>{G(p)}),[p]),c((()=>{Q(m)}),[m]),c((()=>{te(E)}),[E]),c((()=>{oe(_)}),[_]),c((()=>{le(g)}),[g]),c((()=>{ce(A)}),[A]),c((()=>{ve(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(he);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!=me?me:i)&&void 0!==e?e:we.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=be(c);Se(r)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=be(c);Se(e),s.observe(c,a)}return()=>{s.disconnect()}}),[he,we,me,o,n]),c((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),B&&!CSS.supports("border",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),D&&!CSS.supports("opacity",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`opacity\`.`)}),[]);let Ee=y;const _e=i(null);if(a){const t=a({content:null!=F?F:null,activeAnchor:me});Ee=t?e.createElement("div",{ref:_e,className:"react-tooltip-content-wrapper"},t):null}else F&&(Ee=F);U&&(Ee=e.createElement(z,{content:U}));const ge={id:t,anchorId:o,anchorSelect:n,className:d,classNameArrow:u,content:Ee,contentWrapperRef:_e,place:Y,variant:Z,offset:J,wrapper:se,events:de,openOnClick:w,positionStrategy:pe,middlewares:S,delayShow:ee,delayHide:re,float:ne,hidden:ie,noArrow:T,clickable:L,closeOnEsc:R,closeOnScroll:C,closeOnResize:N,style:k,position:x,isOpen:$,holdPositionOnRender:j,border:B,opacity:D,arrowColor:H,setIsOpen:P,afterShow:M,afterHide:W,activeAnchor:me,setActiveAnchor:e=>fe(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{P as Tooltip,T as TooltipProvider,L as TooltipWrapper,S as removeStyle};