react-tooltip 5.22.0-beta.1091.1 → 5.22.0-beta.1108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/react-tooltip.cjs +125 -41
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.d.ts +38 -6
- package/dist/react-tooltip.min.cjs +2 -2
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.mjs +2 -2
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +125 -41
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +125 -41
- package/dist/react-tooltip.umd.js.map +1 -1
- package/dist/react-tooltip.umd.min.js +2 -2
- package/dist/react-tooltip.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -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",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:
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@floating-ui/dom"),o=require("classnames");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e),n=r(o);const s="react-tooltip-core-styles",c="react-tooltip-base-styles",i={core:!1,base:!1};function a({css:e,id:t=c,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||i[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=s),r||(r={});const{insertAt:a}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const u=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.id=t,d.type="text/css","top"===a&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),i[o]=!0}const u=(e,t,o)=>{let r=null;return function(...l){const n=()=>{r=null,o||e.apply(this,l)};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t))}},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 o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},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},E=async({elementReference:e=null,tooltipReference:o=null,tooltipArrowReference:r=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===o)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const a=c;return r?(a.push(t.arrow({element:r,padding:5})),t.computePosition(e,o,{placement:l,strategy:s,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const s={left:`${e}px`,top:`${t}px`,border:i},{x:c,y:a}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:s,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):t.computePosition(e,o,{placement:"bottom",strategy:s,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var S="core-styles-module_tooltip__3vRRp",b="core-styles-module_fixed__pcSol",g="core-styles-module_arrow__cvMwQ",_="core-styles-module_noArrow__xock6",A="core-styles-module_clickable__ZuTTB",T="core-styles-module_show__Nt9eE",O={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 R=({id:o,className:r,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:R,wrapper:k,delayShow:L=0,delayHide:C=0,float:x=!1,hidden:N=!1,noArrow:$=!1,clickable:j=!1,closeOnEsc:I=!1,closeOnScroll:B=!1,closeOnResize:q=!1,openEvents:z,closeEvents:D,globalCloseEvents:H,style:M,position:P,afterShow:W,afterHide:U,content:F,contentWrapperRef:K,isOpen:X,setIsOpen:Y,activeAnchor:V,setActiveAnchor:Z,border:G,opacity:J,arrowColor:Q})=>{const ee=e.useRef(null),te=e.useRef(null),oe=e.useRef(null),re=e.useRef(null),[le,ne]=e.useState(d),[se,ce]=e.useState({}),[ie,ae]=e.useState({}),[ue,de]=e.useState(!1),[pe,fe]=e.useState(!1),ve=e.useRef(!1),me=e.useRef(null),{anchorRefs:ye,setActiveAnchor:he}=m(o),we=e.useRef(!1),[Ee,Se]=e.useState([]),be=e.useRef(!1),ge=v||f.includes("click"),_e=ge||(null==z?void 0:z.click)||(null==z?void 0:z.dblclick)||(null==z?void 0:z.mousedown),Ae=z?{...z}:{mouseenter:!0,focus:!0,click:!1,dblclick:!1,mousedown:!1};!z&&ge&&Object.assign(Ae,{mouseenter:!1,focus:!1,click:!0});const Te=D?{...D}:{mouseleave:!0,blur:!0,click:!1};!D&&ge&&Object.assign(Te,{mouseleave:!1,blur:!1});const Oe=H?{...H}:{escape:I||!1,scroll:B||!1,resize:q||!1,clickOutsideAnchor:_e||!1};y((()=>(be.current=!0,()=>{be.current=!1})),[]),e.useEffect((()=>{if(!ue){const e=setTimeout((()=>{fe(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ue]);const Re=e=>{be.current&&(e&&fe(!0),setTimeout((()=>{be.current&&(null==Y||Y(e),void 0===X&&de(e))}),10))};e.useEffect((()=>{if(void 0===X)return()=>null;X&&fe(!0);const e=setTimeout((()=>{de(X)}),10);return()=>{clearTimeout(e)}}),[X]),e.useEffect((()=>{ue!==ve.current&&(ve.current=ue,ue?null==W||W():null==U||U())}),[ue]);const ke=(e=C)=>{re.current&&clearTimeout(re.current),re.current=setTimeout((()=>{we.current||Re(!1)}),e)},Le=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Z(null),void he({current:null});L?(oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{Re(!0)}),L)):Re(!0),Z(o),he({current:o}),re.current&&clearTimeout(re.current)},Ce=()=>{j?ke(C||100):C?ke():Re(!1),oe.current&&clearTimeout(oe.current)},xe=({x:e,y:t})=>{E({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:R,border:G}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),ne(e.place)}))},Ne=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};xe(o),me.current=o},$e=e=>{var t;[document.querySelector(`[id='${i}']`),...Ee].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=ee.current)||void 0===t?void 0:t.contains(e.target))||(Re(!1),oe.current&&clearTimeout(oe.current))},je=u(Le,50,!0),Ie=u(Ce,50,!0),Be=e.useCallback((()=>{P?xe(P):x?me.current&&xe(me.current):(null==V?void 0:V.isConnected)&&E({place:d,offset:p,elementReference:V,tooltipReference:ee.current,tooltipArrowReference:te.current,strategy:h,middlewares:R,border:G}).then((e=>{be.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),ne(e.place))}))}),[ue,V,F,M,d,p,h,P,x]);e.useEffect((()=>{var e,o;const r=new Set(ye);Ee.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&r.add({current:l});const n=()=>{Re(!1)},s=w(V),c=w(ee.current);Oe.scroll&&(window.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n));let a=null;Oe.resize?window.addEventListener("resize",n):V&&ee.current&&(a=t.autoUpdate(V,ee.current,Be,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Re(!1)};Oe.escape&&window.addEventListener("keydown",u),Oe.clickOutsideAnchor&&window.addEventListener("click",$e);const d=[],p=e=>{ue||Le(e)},f=()=>{ue&&Ce()},v=["mouseenter","mouseleave","focus","blur"],m=["click","dblclick","mousedown","mouseup"];Object.entries(Ae).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:je}):m.includes(e)&&d.push({event:e,listener:p}))})),Object.entries(Te).forEach((([e,t])=>{t&&(v.includes(e)?d.push({event:e,listener:Ie}):m.includes(e)&&d.push({event:e,listener:f}))})),x&&d.push({event:"mousemove",listener:Ne});const y=()=>{we.current=!0},h=()=>{we.current=!1,Ce()};return j&&!_e&&(null===(e=ee.current)||void 0===e||e.addEventListener("mouseenter",y),null===(o=ee.current)||void 0===o||o.addEventListener("mouseleave",h)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;Oe.scroll&&(window.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n)),Oe.resize?window.removeEventListener("resize",n):null==a||a(),Oe.clickOutsideAnchor&&window.removeEventListener("click",$e),Oe.escape&&window.removeEventListener("keydown",u),j&&!_e&&(null===(e=ee.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=ee.current)||void 0===t||t.removeEventListener("mouseleave",h)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[V,Be,pe,ye,Ee,z,D,H,ge]),e.useEffect((()=>{let e=null!=a?a:"";!e&&o&&(e=`[data-tooltip-id='${o}']`);const t=new MutationObserver((t=>{const r=[],l=[];t.forEach((t=>{if("attributes"===t.type&&"data-tooltip-id"===t.attributeName){t.target.getAttribute("data-tooltip-id")===o&&r.push(t.target)}if("childList"===t.type){if(V){const o=[...t.removedNodes].filter((e=>1===e.nodeType));if(e)try{l.push(...o.filter((t=>t.matches(e)))),l.push(...o.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}o.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,V))&&(fe(!1),Re(!1),Z(null),oe.current&&clearTimeout(oe.current),re.current&&clearTimeout(re.current),!0)}))}if(e)try{const o=[...t.addedNodes].filter((e=>1===e.nodeType));r.push(...o.filter((t=>t.matches(e)))),r.push(...o.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}}})),(r.length||l.length)&&Se((e=>[...e.filter((e=>l.includes(e))),...r]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{t.disconnect()}}),[o,a,V]),e.useEffect((()=>{Be()}),[Be]),e.useEffect((()=>{if(!(null==K?void 0:K.current))return()=>null;const e=new ResizeObserver((()=>{Be()}));return e.observe(K.current),()=>{e.disconnect()}}),[F,null==K?void 0:K.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...Ee,t];V&&o.includes(V)||Z(null!==(e=Ee[0])&&void 0!==e?e:t)}),[i,Ee,V]),e.useEffect((()=>()=>{oe.current&&clearTimeout(oe.current),re.current&&clearTimeout(re.current)}),[]),e.useEffect((()=>{let e=a;if(!e&&o&&(e=`[data-tooltip-id='${o}']`),e)try{const t=Array.from(document.querySelectorAll(e));Se(t)}catch(e){Se([])}}),[o,a]);const qe=!N&&F&&ue&&Object.keys(se).length>0;return pe?l.default.createElement(k,{id:o,role:"tooltip",className:n.default("react-tooltip",S,O.tooltip,O[c],r,`react-tooltip__place-${le}`,{"react-tooltip__show":qe,[T]:qe,[b]:"fixed"===h,[A]:j}),style:{...M,...se,opacity:void 0!==J&&qe?J:void 0},ref:ee},F,l.default.createElement(k,{className:n.default("react-tooltip-arrow",g,O.arrow,s,{[_]:$}),style:{...ie,background:Q?`linear-gradient(to right bottom, transparent 50%, ${Q} 50%)`:void 0},ref:te})):null},k=({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:o,anchorSelect:r,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:E,delayShow:S=0,delayHide:b=0,float:g=!1,hidden:_=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:O=!1,closeOnScroll:L=!1,closeOnResize:C=!1,openEvents:x,closeEvents:N,globalCloseEvents:$,style:j,position:I,isOpen:B,disableStyleInjection:q=!1,border:z,opacity:D,arrowColor:H,setIsOpen:M,afterShow:P,afterHide:W})=>{const[U,F]=e.useState(n),[K,X]=e.useState(s),[Y,V]=e.useState(d),[Z,G]=e.useState(u),[J,Q]=e.useState(p),[ee,te]=e.useState(S),[oe,re]=e.useState(b),[le,ne]=e.useState(g),[se,ce]=e.useState(_),[ie,ae]=e.useState(f),[ue,de]=e.useState(y),[pe,fe]=e.useState(w),[ve,me]=e.useState(null),ye=e.useRef(q),{anchorRefs:he,activeAnchor:we}=m(t),Ee=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null}return t}),{}),Se=e=>{const t={place:e=>{var t;V(null!==(t=e)&&void 0!==t?t:d)},content:e=>{F(null!=e?e:n)},html:e=>{X(null!=e?e:s)},variant:e=>{var t;G(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{Q(null===e?p: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(" ");de(null!=t?t:y)},"position-strategy":e=>{var t;fe(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{te(null===e?S:Number(e))},"delay-hide":e=>{re(null===e?b:Number(e))},float:e=>{ne(null===e?g:"true"===e)},hidden:e=>{ce(null===e?_:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};e.useEffect((()=>{F(n)}),[n]),e.useEffect((()=>{X(s)}),[s]),e.useEffect((()=>{V(d)}),[d]),e.useEffect((()=>{G(u)}),[u]),e.useEffect((()=>{Q(p)}),[p]),e.useEffect((()=>{te(S)}),[S]),e.useEffect((()=>{re(b)}),[b]),e.useEffect((()=>{ne(g)}),[g]),e.useEffect((()=>{ce(_)}),[_]),e.useEffect((()=>{fe(w)}),[w]),e.useEffect((()=>{ye.current!==q&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[q]),e.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===q,disableBase:q}}))}),[]),e.useEffect((()=>{var e;const l=new Set(he);let n=r;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='${o}']`);if(s&&l.add({current:s}),!l.size)return()=>null;const c=null!==(e=null!=ve?ve:s)&&void 0!==e?e:we.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Ee(c);Se(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=Ee(c);Se(e),i.observe(c,a)}return()=>{i.disconnect()}}),[he,we,ve,o,r]),e.useEffect((()=>{(null==j?void 0:j.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),z&&!CSS.supports("border",`${z}`)&&console.warn(`[react-tooltip] "${z}" is not a valid \`border\`.`),(null==j?void 0:j.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 be=v;const ge=e.useRef(null);if(c){const e=c({content:null!=U?U:null,activeAnchor:ve});be=e?l.default.createElement("div",{ref:ge,className:"react-tooltip-content-wrapper"},e):null}else U&&(be=U);K&&(be=l.default.createElement(k,{content:K}));const _e={id:t,anchorId:o,anchorSelect:r,className:i,classNameArrow:a,content:be,contentWrapperRef:ge,place:Y,variant:Z,offset:J,wrapper:ie,events:ue,openOnClick:h,positionStrategy:pe,middlewares:E,delayShow:ee,delayHide:oe,float:le,hidden:se,noArrow:A,clickable:T,closeOnEsc:O,closeOnScroll:L,closeOnResize:C,openEvents:x,closeEvents:N,globalCloseEvents:$,style:j,position:I,isOpen:B,border:z,opacity:D,arrowColor:H,setIsOpen:M,afterShow:P,afterHide:W,activeAnchor:ve,setActiveAnchor:e=>me(e)};return l.default.createElement(R,{..._e})},exports.TooltipProvider=({children:t})=>{const[o,r]=e.useState({[d]:new Set}),[n,s]=e.useState({[d]:{current:null}}),c=(e,...t)=>{r((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},i=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},a=e.useCallback(((e=d)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=n[e])&&void 0!==r?r:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,n,c,i]),u=e.useMemo((()=>({getTooltipData:a})),[a]);return l.default.createElement(v.Provider,{value:u},t)},exports.TooltipWrapper=({tooltipId:t,children:o,className:r,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),E=e.useRef(null);return e.useEffect((()=>(h(E),()=>{w(E)})),[]),l.default.createElement("span",{ref:E,className:n.default("react-tooltip-wrapper",r),"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},o)},exports.removeStyle=function({type:e="base",id:t=c}={}){if(!i[e])return;"core"===e&&(t=s);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),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 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,EAAK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A,EAAAA,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"}
|
|
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 {\n AnchorCloseEvents,\n AnchorOpenEvents,\n GlobalCloseEvents,\n IPosition,\n ITooltip,\n PlacesType,\n} 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 openEvents,\n closeEvents,\n globalCloseEvents,\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 /**\n * @todo Update when deprecated stuff gets removed.\n */\n const shouldOpenOnClick = openOnClick || events.includes('click')\n const hasClickEvent =\n shouldOpenOnClick || openEvents?.click || openEvents?.dblclick || openEvents?.mousedown\n const actualOpenEvents: AnchorOpenEvents = openEvents\n ? { ...openEvents }\n : {\n mouseenter: true,\n focus: true,\n click: false,\n dblclick: false,\n mousedown: false,\n }\n if (!openEvents && shouldOpenOnClick) {\n Object.assign(actualOpenEvents, {\n mouseenter: false,\n focus: false,\n click: true,\n })\n }\n const actualCloseEvents: AnchorCloseEvents = closeEvents\n ? { ...closeEvents }\n : {\n mouseleave: true,\n blur: true,\n click: false,\n }\n if (!closeEvents && shouldOpenOnClick) {\n Object.assign(actualCloseEvents, {\n mouseleave: false,\n blur: false,\n })\n }\n const actualGlobalCloseEvents: GlobalCloseEvents = globalCloseEvents\n ? { ...globalCloseEvents }\n : {\n escape: closeOnEsc || false,\n scroll: closeOnScroll || false,\n resize: closeOnResize || false,\n clickOutsideAnchor: hasClickEvent || false,\n }\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 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 (actualGlobalCloseEvents.scroll) {\n window.addEventListener('scroll', handleScrollResize)\n anchorScrollParent?.addEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.addEventListener('scroll', handleScrollResize)\n }\n let updateTooltipCleanup: null | (() => void) = null\n if (actualGlobalCloseEvents.resize) {\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 if (actualGlobalCloseEvents.escape) {\n window.addEventListener('keydown', handleEsc)\n }\n\n if (actualGlobalCloseEvents.clickOutsideAnchor) {\n window.addEventListener('click', handleClickOutsideAnchors)\n }\n\n const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []\n\n const handleClickOpenTooltipAnchor = (event?: Event) => {\n if (show) {\n return\n }\n handleShowTooltip(event)\n }\n const handleClickCloseTooltipAnchor = () => {\n if (!show) {\n return\n }\n handleHideTooltip()\n }\n\n const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur']\n const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup']\n\n Object.entries(actualOpenEvents).forEach(([event, enabled]) => {\n if (!enabled) {\n return\n }\n if (regularEvents.includes(event)) {\n enabledEvents.push({ event, listener: debouncedHandleShowTooltip })\n } else if (clickEvents.includes(event)) {\n enabledEvents.push({ event, listener: handleClickOpenTooltipAnchor })\n } else {\n // never happens\n }\n })\n\n Object.entries(actualCloseEvents).forEach(([event, enabled]) => {\n if (!enabled) {\n return\n }\n if (regularEvents.includes(event)) {\n enabledEvents.push({ event, listener: debouncedHandleHideTooltip })\n } else if (clickEvents.includes(event)) {\n enabledEvents.push({ event, listener: handleClickCloseTooltipAnchor })\n } else {\n // never happens\n }\n })\n\n if (float) {\n enabledEvents.push({\n event: 'mousemove',\n listener: handleMouseMove,\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 && !hasClickEvent) {\n // used to keep the tooltip open when hovering content.\n // not needed if using click events.\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 (actualGlobalCloseEvents.scroll) {\n window.removeEventListener('scroll', handleScrollResize)\n anchorScrollParent?.removeEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.removeEventListener('scroll', handleScrollResize)\n }\n if (actualGlobalCloseEvents.resize) {\n window.removeEventListener('resize', handleScrollResize)\n } else {\n updateTooltipCleanup?.()\n }\n if (actualGlobalCloseEvents.clickOutsideAnchor) {\n window.removeEventListener('click', handleClickOutsideAnchors)\n }\n if (actualGlobalCloseEvents.escape) {\n window.removeEventListener('keydown', handleEsc)\n }\n if (clickable && !hasClickEvent) {\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 // the effect uses the `actual*Events` objects, but this should work\n openEvents,\n closeEvents,\n globalCloseEvents,\n shouldOpenOnClick,\n ])\n\n useEffect(() => {\n let selector = anchorSelect ?? ''\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n const documentObserverCallback: MutationCallback = (mutationList) => {\n const newAnchors: HTMLElement[] = []\n const removedAnchors: HTMLElement[] = []\n mutationList.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {\n const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')\n if (newId === id) {\n newAnchors.push(mutation.target as HTMLElement)\n }\n }\n if (mutation.type !== 'childList') {\n return\n }\n if (activeAnchor) {\n const elements = [...mutation.removedNodes].filter((node) => node.nodeType === 1)\n if (selector) {\n try {\n removedAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n removedAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n }\n elements.some((node) => {\n if (node?.contains?.(activeAnchor)) {\n setRendered(false)\n handleShow(false)\n setActiveAnchor(null)\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n return true\n }\n return false\n })\n }\n if (!selector) {\n return\n }\n try {\n const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1)\n newAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n newAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n })\n if (newAnchors.length || removedAnchors.length) {\n setAnchorsBySelect((anchors) => [\n ...anchors.filter((anchor) => removedAnchors.includes(anchor)),\n ...newAnchors,\n ])\n }\n }\n const documentObserver = new MutationObserver(documentObserverCallback)\n // watch for anchor being removed from the DOM\n documentObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-tooltip-id'],\n })\n return () => {\n documentObserver.disconnect()\n }\n }, [id, anchorSelect, activeAnchor])\n\n useEffect(() => {\n updateTooltipPosition()\n }, [updateTooltipPosition])\n\n useEffect(() => {\n if (!contentWrapperRef?.current) {\n return () => null\n }\n const contentObserver = new ResizeObserver(() => {\n updateTooltipPosition()\n })\n contentObserver.observe(contentWrapperRef.current)\n return () => {\n contentObserver.disconnect()\n }\n }, [content, contentWrapperRef?.current])\n\n useEffect(() => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [...anchorsBySelect, anchorById]\n if (!activeAnchor || !anchors.includes(activeAnchor)) {\n /**\n * if there is no active anchor,\n * or if the current active anchor is not amongst the allowed ones,\n * reset it\n */\n setActiveAnchor(anchorsBySelect[0] ?? anchorById)\n }\n }, [anchorId, anchorsBySelect, activeAnchor])\n\n useEffect(() => {\n return () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n }, [])\n\n useEffect(() => {\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (!selector) {\n return\n }\n try {\n const anchors = Array.from(document.querySelectorAll<HTMLElement>(selector))\n setAnchorsBySelect(anchors)\n } catch {\n // warning was already issued in the controller\n setAnchorsBySelect([])\n }\n }, [id, anchorSelect])\n\n const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0\n\n return rendered ? (\n <WrapperElement\n id={id}\n role=\"tooltip\"\n className={classNames(\n 'react-tooltip',\n coreStyles['tooltip'],\n styles['tooltip'],\n styles[variant],\n className,\n `react-tooltip__place-${actualPlacement}`,\n {\n 'react-tooltip__show': canShow,\n [coreStyles['show']]: canShow,\n [coreStyles['fixed']]: positionStrategy === 'fixed',\n [coreStyles['clickable']]: clickable,\n },\n )}\n style={{\n ...externalStyles,\n ...inlineStyles,\n opacity: opacity !== undefined && canShow ? opacity : undefined,\n }}\n ref={tooltipRef}\n >\n {content}\n <WrapperElement\n className={classNames(\n 'react-tooltip-arrow',\n coreStyles['arrow'],\n styles['arrow'],\n classNameArrow,\n {\n /**\n * changed from dash `no-arrow` to camelcase because of:\n * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42\n */\n [coreStyles['noArrow']]: noArrow,\n },\n )}\n style={{\n ...inlineArrowStyles,\n background: arrowColor\n ? `linear-gradient(to right bottom, transparent 50%, ${arrowColor} 50%)`\n : undefined,\n }}\n ref={tooltipArrowRef}\n />\n </WrapperElement>\n ) : null\n}\n\nexport default Tooltip\n","/* eslint-disable react/no-danger */\nimport React from 'react'\nimport type { ITooltipContent } from './TooltipContentTypes'\n\nconst TooltipContent = ({ content }: ITooltipContent) => {\n return <span dangerouslySetInnerHTML={{ __html: content }} />\n}\n\nexport default TooltipContent\n","import './tokens.css'\n\nimport { injectStyle } from 'utils/handle-style'\n\nimport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n IPosition,\n Middleware,\n} from './components/Tooltip/TooltipTypes'\nimport type { ITooltipController } from './components/TooltipController/TooltipControllerTypes'\nimport type { ITooltipWrapper } from './components/TooltipProvider/TooltipProviderTypes'\n\n// those content will be replaced in build time with the `react-tooltip.css` builded content\nconst TooltipCoreStyles = 'react-tooltip-core-css-placeholder'\nconst TooltipStyles = 'react-tooltip-css-placeholder'\n\nif (typeof window !== 'undefined') {\n window.addEventListener('react-tooltip-inject-styles', ((\n event: CustomEvent<{ disableCore: boolean; disableBase: boolean }>,\n ) => {\n if (!event.detail.disableCore) {\n injectStyle({ css: TooltipCoreStyles, type: 'core' })\n }\n if (!event.detail.disableBase) {\n injectStyle({ css: TooltipStyles, type: 'base' })\n }\n }) as EventListener)\n}\n\nexport { TooltipController as Tooltip } from './components/TooltipController'\nexport { TooltipProvider, TooltipWrapper } from './components/TooltipProvider'\nexport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n ITooltipController as ITooltip,\n ITooltipWrapper,\n IPosition,\n Middleware,\n}\n\nexport { removeStyle } from './utils/handle-style'\n","import React, { useEffect, useRef, useState } from 'react'\nimport { Tooltip } from 'components/Tooltip'\nimport type {\n EventsType,\n PositionStrategy,\n PlacesType,\n VariantType,\n WrapperType,\n DataAttribute,\n ITooltip,\n ChildrenType,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = ({\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n openEvents,\n closeEvents,\n globalCloseEvents,\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 openEvents,\n closeEvents,\n globalCloseEvents,\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","openEvents","closeEvents","globalCloseEvents","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","hasClickEvent","click","dblclick","mousedown","actualOpenEvents","mouseenter","focus","Object","assign","actualCloseEvents","mouseleave","blur","actualGlobalCloseEvents","escape","scroll","resize","clickOutsideAnchor","handleShow","undefined","handleHideTooltipDelayed","delay","handleShowTooltip","event","target","currentTarget","isConnected","handleHideTooltip","handleTooltipPosition","getBoundingClientRect","width","height","computedStylesData","keys","length","handleMouseMove","mouseEvent","mousePosition","clientX","clientY","handleClickOutsideAnchors","querySelector","anchor","contains","debouncedHandleShowTooltip","debouncedHandleHideTooltip","updateTooltipPosition","useCallback","elementRefs","forEach","add","anchorById","handleScrollResize","anchorScrollParent","tooltipScrollParent","addEventListener","updateTooltipCleanup","autoUpdate","ancestorResize","elementResize","layoutShift","handleEsc","key","enabledEvents","handleClickOpenTooltipAnchor","handleClickCloseTooltipAnchor","regularEvents","clickEvents","entries","enabled","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","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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,EAAO,oBACVsJ,EAAI,uBACD9K,EACD,sBAAAtC,EACC,uBAAA4C,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExBuK,EAEJ,sBH0CH,UAAqBhS,KACnBA,EAAO,OAAMD,GACbA,EAAKN,GAIH,IACF,IAAKC,EAASM,GACZ,OAGW,SAATA,IAEFD,EAAKP,GAGP,MAAMuB,EAAQb,SAASQ,eAAeX,GACf,WAAnBgB,aAAK,EAALA,EAAOgV,SACThV,SAAAA,EAAOiV,SAGPrV,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 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{
|
|
7
|
+
import e,{createContext as t,useState as o,useCallback as r,useMemo as l,useContext as n,useRef as c,useEffect as i,useLayoutEffect as s}from"react";import{arrow as a,computePosition as u,offset as d,flip as p,shift as v,autoUpdate as m}from"@floating-ui/dom";import f from"classnames";const y="react-tooltip-core-styles",h="react-tooltip-base-styles",w={core:!1,base:!1};function b({css:e,id:t=h,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||w[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=y),r||(r={});const{insertAt:c}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.id=t,s.type="text/css","top"===c&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),w[o]=!0}function E({type:e="base",id:t=h}={}){if(!w[e])return;"core"===e&&(t=y);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),w[e]=!1}const S=(e,t,o)=>{let r=null;return function(...l){const n=()=>{r=null,o||e.apply(this,l)};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t))}},g="DEFAULT_TOOLTIP_ID",_={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},A=t({getTooltipData:()=>_}),T=({children:t})=>{const[n,c]=o({[g]:new Set}),[i,s]=o({[g]:{current:null}}),a=(e,...t)=>{c((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},u=(e,...t)=>{c((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},d=r(((e=g)=>{var t,o;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=i[e])&&void 0!==o?o:{current:null},attach:(...t)=>a(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[n,i,a,u]),p=l((()=>({getTooltipData:d})),[d]);return e.createElement(A.Provider,{value:p},t)};function O(e=g){return n(A).getTooltipData(e)}const k=({tooltipId:t,children:o,className:r,place:l,content:n,html:s,variant:a,offset:u,wrapper:d,events:p,positionStrategy:v,delayShow:m,delayHide:y})=>{const{attach:h,detach:w}=O(t),b=c(null);return i((()=>(h(b),()=>{w(b)})),[]),e.createElement("span",{ref:b,className:f("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":n,"data-tooltip-html":s,"data-tooltip-variant":a,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":v,"data-tooltip-delay-show":m,"data-tooltip-delay-hide":y},o)},L="undefined"!=typeof window?s:i,C=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},R=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(C(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},N=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:r="top",offset:l=10,strategy:n="absolute",middlewares:c=[d(Number(l)),p(),v({padding:5})],border:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const s=c;return o?(s.push(a({element:o,padding:5})),u(e,t,{placement:r,strategy:n,middleware:s}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:i},{x:s,y:a}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):u(e,t,{placement:"bottom",strategy:n,middleware:s}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};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",z="core-styles-module_show__Nt9eE",D={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 H=({id:t,className:l,classNameArrow:n,variant:s="dark",anchorId:a,anchorSelect:u,place:d="top",offset:p=10,events:v=["hover"],openOnClick:y=!1,positionStrategy:h="absolute",middlewares:w,wrapper:b,delayShow:E=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:k=!1,closeOnEsc:C=!1,closeOnScroll:H=!1,closeOnResize:q=!1,openEvents:M,closeEvents:W,globalCloseEvents:P,style:F,position:K,afterShow:U,afterHide:X,content:Y,contentWrapperRef:V,isOpen:Z,setIsOpen:G,activeAnchor:J,setActiveAnchor:Q,border:ee,opacity:te,arrowColor:oe})=>{const re=c(null),le=c(null),ne=c(null),ce=c(null),[ie,se]=o(d),[ae,ue]=o({}),[de,pe]=o({}),[ve,me]=o(!1),[fe,ye]=o(!1),he=c(!1),we=c(null),{anchorRefs:be,setActiveAnchor:Ee}=O(t),Se=c(!1),[ge,_e]=o([]),Ae=c(!1),Te=y||v.includes("click"),Oe=Te||(null==M?void 0:M.click)||(null==M?void 0:M.dblclick)||(null==M?void 0:M.mousedown),ke=M?{...M}:{mouseenter:!0,focus:!0,click:!1,dblclick:!1,mousedown:!1};!M&&Te&&Object.assign(ke,{mouseenter:!1,focus:!1,click:!0});const Le=W?{...W}:{mouseleave:!0,blur:!0,click:!1};!W&&Te&&Object.assign(Le,{mouseleave:!1,blur:!1});const Ce=P?{...P}:{escape:C||!1,scroll:H||!1,resize:q||!1,clickOutsideAnchor:Oe||!1};L((()=>(Ae.current=!0,()=>{Ae.current=!1})),[]),i((()=>{if(!ve){const e=setTimeout((()=>{ye(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ve]);const Re=e=>{Ae.current&&(e&&ye(!0),setTimeout((()=>{Ae.current&&(null==G||G(e),void 0===Z&&me(e))}),10))};i((()=>{if(void 0===Z)return()=>null;Z&&ye(!0);const e=setTimeout((()=>{me(Z)}),10);return()=>{clearTimeout(e)}}),[Z]),i((()=>{ve!==he.current&&(he.current=ve,ve?null==U||U():null==X||X())}),[ve]);const Ne=(e=g)=>{ce.current&&clearTimeout(ce.current),ce.current=setTimeout((()=>{Se.current||Re(!1)}),e)},xe=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Q(null),void Ee({current:null});E?(ne.current&&clearTimeout(ne.current),ne.current=setTimeout((()=>{Re(!0)}),E)):Re(!0),Q(o),Ee({current:o}),ce.current&&clearTimeout(ce.current)},$e=()=>{k?Ne(g||100):g?Ne():Re(!1),ne.current&&clearTimeout(ne.current)},Ie=({x:e,y:t})=>{N({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:re.current,tooltipArrowReference:le.current,strategy:h,middlewares:w,border:ee}).then((e=>{Object.keys(e.tooltipStyles).length&&ue(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),se(e.place)}))},je=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Ie(o),we.current=o},Be=e=>{var t;[document.querySelector(`[id='${a}']`),...ge].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=re.current)||void 0===t?void 0:t.contains(e.target))||(Re(!1),ne.current&&clearTimeout(ne.current))},ze=S(xe,50,!0),De=S($e,50,!0),He=r((()=>{K?Ie(K):_?we.current&&Ie(we.current):(null==J?void 0:J.isConnected)&&N({place:d,offset:p,elementReference:J,tooltipReference:re.current,tooltipArrowReference:le.current,strategy:h,middlewares:w,border:ee}).then((e=>{Ae.current&&(Object.keys(e.tooltipStyles).length&&ue(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),se(e.place))}))}),[ve,J,Y,F,d,p,h,K,_]);i((()=>{var e,t;const o=new Set(be);ge.forEach((e=>{o.add({current:e})}));const r=document.querySelector(`[id='${a}']`);r&&o.add({current:r});const l=()=>{Re(!1)},n=R(J),c=R(re.current);Ce.scroll&&(window.addEventListener("scroll",l),null==n||n.addEventListener("scroll",l),null==c||c.addEventListener("scroll",l));let i=null;Ce.resize?window.addEventListener("resize",l):J&&re.current&&(i=m(J,re.current,He,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&Re(!1)};Ce.escape&&window.addEventListener("keydown",s),Ce.clickOutsideAnchor&&window.addEventListener("click",Be);const u=[],d=e=>{ve||xe(e)},p=()=>{ve&&$e()},v=["mouseenter","mouseleave","focus","blur"],f=["click","dblclick","mousedown","mouseup"];Object.entries(ke).forEach((([e,t])=>{t&&(v.includes(e)?u.push({event:e,listener:ze}):f.includes(e)&&u.push({event:e,listener:d}))})),Object.entries(Le).forEach((([e,t])=>{t&&(v.includes(e)?u.push({event:e,listener:De}):f.includes(e)&&u.push({event:e,listener:p}))})),_&&u.push({event:"mousemove",listener:je});const y=()=>{Se.current=!0},h=()=>{Se.current=!1,$e()};return k&&!Oe&&(null===(e=re.current)||void 0===e||e.addEventListener("mouseenter",y),null===(t=re.current)||void 0===t||t.addEventListener("mouseleave",h)),u.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;Ce.scroll&&(window.removeEventListener("scroll",l),null==n||n.removeEventListener("scroll",l),null==c||c.removeEventListener("scroll",l)),Ce.resize?window.removeEventListener("resize",l):null==i||i(),Ce.clickOutsideAnchor&&window.removeEventListener("click",Be),Ce.escape&&window.removeEventListener("keydown",s),k&&!Oe&&(null===(e=re.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=re.current)||void 0===t||t.removeEventListener("mouseleave",h)),u.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[J,He,fe,be,ge,M,W,P,Te]),i((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const o=new MutationObserver((o=>{const r=[],l=[];o.forEach((o=>{if("attributes"===o.type&&"data-tooltip-id"===o.attributeName){o.target.getAttribute("data-tooltip-id")===t&&r.push(o.target)}if("childList"===o.type){if(J){const t=[...o.removedNodes].filter((e=>1===e.nodeType));if(e)try{l.push(...t.filter((t=>t.matches(e)))),l.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,J))&&(ye(!1),Re(!1),Q(null),ne.current&&clearTimeout(ne.current),ce.current&&clearTimeout(ce.current),!0)}))}if(e)try{const t=[...o.addedNodes].filter((e=>1===e.nodeType));r.push(...t.filter((t=>t.matches(e)))),r.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}}})),(r.length||l.length)&&_e((e=>[...e.filter((e=>l.includes(e))),...r]))}));return o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{o.disconnect()}}),[t,u,J]),i((()=>{He()}),[He]),i((()=>{if(!(null==V?void 0:V.current))return()=>null;const e=new ResizeObserver((()=>{He()}));return e.observe(V.current),()=>{e.disconnect()}}),[Y,null==V?void 0:V.current]),i((()=>{var e;const t=document.querySelector(`[id='${a}']`),o=[...ge,t];J&&o.includes(J)||Q(null!==(e=ge[0])&&void 0!==e?e:t)}),[a,ge,J]),i((()=>()=>{ne.current&&clearTimeout(ne.current),ce.current&&clearTimeout(ce.current)}),[]),i((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));_e(t)}catch(e){_e([])}}),[t,u]);const qe=!A&&Y&&ve&&Object.keys(ae).length>0;return fe?e.createElement(b,{id:t,role:"tooltip",className:f("react-tooltip",x,D.tooltip,D[s],l,`react-tooltip__place-${ie}`,{"react-tooltip__show":qe,[z]:qe,[$]:"fixed"===h,[B]:k}),style:{...F,...ae,opacity:void 0!==te&&qe?te:void 0},ref:re},Y,e.createElement(b,{className:f("react-tooltip-arrow",I,D.arrow,n,{[j]:T}),style:{...de,background:oe?`linear-gradient(to right bottom, transparent 50%, ${oe} 50%)`:void 0},ref:le})):null},q=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),M=({id:t,anchorId:r,anchorSelect:l,content:n,html:s,render:a,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:f="div",children:y=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:b="absolute",middlewares:E,delayShow:S=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:k=!1,closeOnEsc:L=!1,closeOnScroll:C=!1,closeOnResize:R=!1,openEvents:N,closeEvents:x,globalCloseEvents:$,style:I,position:j,isOpen:B,disableStyleInjection:z=!1,border:D,opacity:M,arrowColor:W,setIsOpen:P,afterShow:F,afterHide:K})=>{const[U,X]=o(n),[Y,V]=o(s),[Z,G]=o(v),[J,Q]=o(p),[ee,te]=o(m),[oe,re]=o(S),[le,ne]=o(g),[ce,ie]=o(_),[se,ae]=o(A),[ue,de]=o(f),[pe,ve]=o(h),[me,fe]=o(b),[ye,he]=o(null),we=c(z),{anchorRefs:be,activeAnchor:Ee}=O(t),Se=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null}return t}),{}),ge=e=>{const t={place:e=>{var t;G(null!==(t=e)&&void 0!==t?t:v)},content:e=>{X(null!=e?e:n)},html:e=>{V(null!=e?e:s)},variant:e=>{var t;Q(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{te(null===e?m:Number(e))},wrapper:e=>{var t;de(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ve(null!=t?t:h)},"position-strategy":e=>{var t;fe(null!==(t=e)&&void 0!==t?t:b)},"delay-show":e=>{re(null===e?S:Number(e))},"delay-hide":e=>{ne(null===e?g:Number(e))},float:e=>{ie(null===e?_:"true"===e)},hidden:e=>{ae(null===e?A:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};i((()=>{X(n)}),[n]),i((()=>{V(s)}),[s]),i((()=>{G(v)}),[v]),i((()=>{Q(p)}),[p]),i((()=>{te(m)}),[m]),i((()=>{re(S)}),[S]),i((()=>{ne(g)}),[g]),i((()=>{ie(_)}),[_]),i((()=>{ae(A)}),[A]),i((()=>{fe(b)}),[b]),i((()=>{we.current!==z&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[z]),i((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===z,disableBase:z}}))}),[]),i((()=>{var e;const o=new Set(be);let n=l;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),n)try{document.querySelectorAll(n).forEach((e=>{o.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const c=document.querySelector(`[id='${r}']`);if(c&&o.add({current:c}),!o.size)return()=>null;const i=null!==(e=null!=ye?ye:c)&&void 0!==e?e:Ee.current,s=new MutationObserver((e=>{e.forEach((e=>{var t;if(!i||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Se(i);ge(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(i){const e=Se(i);ge(e),s.observe(i,a)}return()=>{s.disconnect()}}),[be,Ee,ye,r,l]),i((()=>{(null==I?void 0:I.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),D&&!CSS.supports("border",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`border\`.`),(null==I?void 0:I.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),M&&!CSS.supports("opacity",`${M}`)&&console.warn(`[react-tooltip] "${M}" is not a valid \`opacity\`.`)}),[]);let _e=y;const Ae=c(null);if(a){const t=a({content:null!=U?U:null,activeAnchor:ye});_e=t?e.createElement("div",{ref:Ae,className:"react-tooltip-content-wrapper"},t):null}else U&&(_e=U);Y&&(_e=e.createElement(q,{content:Y}));const Te={id:t,anchorId:r,anchorSelect:l,className:u,classNameArrow:d,content:_e,contentWrapperRef:Ae,place:Z,variant:J,offset:ee,wrapper:ue,events:pe,openOnClick:w,positionStrategy:me,middlewares:E,delayShow:oe,delayHide:le,float:ce,hidden:se,noArrow:T,clickable:k,closeOnEsc:L,closeOnScroll:C,closeOnResize:R,openEvents:N,closeEvents:x,globalCloseEvents:$,style:I,position:j,isOpen:B,border:D,opacity:M,arrowColor:W,setIsOpen:P,afterShow:F,afterHide:K,activeAnchor:ye,setActiveAnchor:e=>he(e)};return e.createElement(H,{...Te})};"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||b({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||b({css:`
|
|
8
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})}));export{M as Tooltip,T as TooltipProvider,k as TooltipWrapper,E as removeStyle};
|