react-tooltip 5.22.0-beta.1109.0 → 5.22.0-beta.1109.1
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/dist/react-tooltip.cjs +20 -8
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.d.ts +13 -1
- package/dist/react-tooltip.min.cjs +1 -1
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.mjs +1 -1
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +20 -8
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +20 -8
- 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"),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 c="react-tooltip-core-styles",s="react-tooltip-base-styles",a={core:!1,base:!1};function i({css:e,id:t=s,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),r||(r={});const{insertAt:i}=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"===i&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[o]=!0}const 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},S=async({elementReference:e=null,tooltipReference:o=null,tooltipArrowReference:r=null,place:l="top",offset:n=10,strategy:c="absolute",middlewares:s=[t.offset(Number(n)),t.flip(),t.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===o)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const i=s;return r?(i.push(t.arrow({element:r,padding:5})),t.computePosition(e,o,{placement:l,strategy:c,middleware:i}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:a},{x:s,y:i}=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=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):t.computePosition(e,o,{placement:"bottom",strategy:c,middleware:i}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};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=({forwardRef:o,id:r,className:c,classNameArrow:s,variant:a="dark",anchorId:i,anchorSelect:d,place:p="top",offset:f=10,events:v=["hover"],openOnClick:h=!1,positionStrategy:O="absolute",middlewares:L,wrapper:x,delayShow:C=0,delayHide:k=0,float:N=!1,hidden:$=!1,noArrow:I=!1,clickable:j=!1,closeOnEsc:B=!1,closeOnScroll:q=!1,closeOnResize:D=!1,style:H,position:z,afterShow:M,afterHide:P,content:W,contentWrapperRef:U,isOpen:F,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:V,opacity:Z,arrowColor:G})=>{var J;const Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),oe=e.useRef(null),[re,le]=e.useState(p),[ne,ce]=e.useState({}),[se,ae]=e.useState({}),[ie,ue]=e.useState(!1),[de,pe]=e.useState(!1),[fe,ve]=e.useState(null),me=e.useRef(!1),ye=e.useRef(null),{anchorRefs:he,setActiveAnchor:we}=m(r),Se=e.useRef(!1),[Ee,be]=e.useState([]),_e=e.useRef(!1),ge=h||v.includes("click");y((()=>(_e.current=!0,()=>{_e.current=!1})),[]),e.useEffect((()=>{if(!ie){const e=setTimeout((()=>{pe(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ie]);const Ae=e=>{_e.current&&(e&&pe(!0),setTimeout((()=>{_e.current&&(null==K||K(e),void 0===F&&ue(e))}),10))};e.useEffect((()=>{if(void 0===F)return()=>null;F&&pe(!0);const e=setTimeout((()=>{ue(F)}),10);return()=>{clearTimeout(e)}}),[F]),e.useEffect((()=>{ie!==me.current&&(me.current=ie,ie?null==M||M():(ve(null),null==P||P()))}),[ie]);const Te=(e=k)=>{oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{Se.current||Ae(!1)}),e)},Re=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Y(null),void we({current:null});C?(te.current&&clearTimeout(te.current),te.current=setTimeout((()=>{Ae(!0)}),C)):Ae(!0),Y(o),we({current:o}),oe.current&&clearTimeout(oe.current)},Oe=()=>{j?Te(k||100):k?Te():Ae(!1),te.current&&clearTimeout(te.current)},Le=({x:e,y:t})=>{S({place:p,offset:f,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:O,middlewares:L,border:V}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place)}))},xe=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Le(o),ye.current=o},Ce=e=>{Re(e),k&&Te()},ke=e=>{var t;if(!ie)return;[document.querySelector(`[id='${i}']`),...Ee].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=Q.current)||void 0===t?void 0:t.contains(e.target))||(Ae(!1),te.current&&clearTimeout(te.current))},Ne=u(Re,50,!0),$e=u(Oe,50,!0),Ie=e.useCallback((()=>{var e;const t=null!==(e=null==fe?void 0:fe.position)&&void 0!==e?e:z;t?Le(t):N?ye.current&&Le(ye.current):(null==X?void 0:X.isConnected)&&S({place:p,offset:f,elementReference:X,tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:O,middlewares:L,border:V}).then((e=>{_e.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place))}))}),[ie,X,W,H,p,f,O,z,null==fe?void 0:fe.position,N]);e.useEffect((()=>{var e,o;const r=new Set(he);Ee.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&r.add({current:l});const n=()=>{Ae(!1)},c=w(X),s=w(Q.current);q&&(window.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n));let a=null;D?window.addEventListener("resize",n):X&&Q.current&&(a=t.autoUpdate(X,Q.current,Ie,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ae(!1)};B&&window.addEventListener("keydown",u);const d=[];ge?(window.addEventListener("click",ke),d.push({event:"click",listener:Ce})):(d.push({event:"mouseenter",listener:Ne},{event:"mouseleave",listener:$e},{event:"focus",listener:Ne},{event:"blur",listener:$e}),N&&d.push({event:"mousemove",listener:xe}));const p=()=>{Se.current=!0},f=()=>{Se.current=!1,Oe()};return j&&!ge&&(null===(e=Q.current)||void 0===e||e.addEventListener("mouseenter",p),null===(o=Q.current)||void 0===o||o.addEventListener("mouseleave",f)),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;q&&(window.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n)),D?window.removeEventListener("resize",n):null==a||a(),ge&&window.removeEventListener("click",ke),B&&window.removeEventListener("keydown",u),j&&!ge&&(null===(e=Q.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=Q.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[X,Ie,de,he,Ee,B,v]),e.useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:d)&&void 0!==t?t:"";!o&&r&&(o=`[data-tooltip-id='${r}']`);const l=new MutationObserver((e=>{const t=[],l=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===r&&t.push(e.target)}if("childList"===e.type){if(X){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{l.push(...t.filter((e=>e.matches(o)))),l.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(pe(!1),Ae(!1),Y(null),te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||l.length)&&be((e=>[...e.filter((e=>l.includes(e))),...t]))}));return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{l.disconnect()}}),[r,d,null==fe?void 0:fe.anchorSelect,X]),e.useEffect((()=>{Ie()}),[Ie]),e.useEffect((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{Ie()}));return e.observe(U.current),()=>{e.disconnect()}}),[W,null==U?void 0:U.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...Ee,t];X&&o.includes(X)||Y(null!==(e=Ee[0])&&void 0!==e?e:t)}),[i,Ee,X]),e.useEffect((()=>()=>{te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current)}),[]),e.useEffect((()=>{var e;let t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:d;if(!t&&r&&(t=`[data-tooltip-id='${r}']`),t)try{const e=Array.from(document.querySelectorAll(t));be(e)}catch(e){be([])}}),[r,d,null==fe?void 0:fe.anchorSelect]);const je=null!==(J=null==fe?void 0:fe.content)&&void 0!==J?J:W,Be=Boolean(!$&&je&&ie&&Object.keys(ne).length>0);return e.useImperativeHandle(o,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}ve(null!=e?e:null),Ae(!0)},close:()=>{Ae(!1)},activeAnchor:X,place:re,isOpen:de&&Be}))),de?l.default.createElement(x,{id:r,role:"tooltip",className:n.default("react-tooltip",E,R.tooltip,R[a],c,`react-tooltip__place-${re}`,{"react-tooltip__show":Be,[T]:Be,[b]:"fixed"===O,[A]:j}),style:{...H,...ne,opacity:void 0!==Z&&Be?Z:void 0},ref:Q},je,l.default.createElement(x,{className:n.default("react-tooltip-arrow",_,R.arrow,s,{[g]:I}),style:{...se,background:G?`linear-gradient(to right bottom, transparent 50%, ${G} 50%)`:void 0},ref:ee})):null},L=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),x=l.default.forwardRef((({id:t,anchorId:o,anchorSelect:r,content:n,html:c,render:s,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:y=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:_=!1,hidden:g=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:x=!1,closeOnResize:C=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z},M)=>{const[P,W]=e.useState(n),[U,F]=e.useState(c),[K,X]=e.useState(d),[Y,V]=e.useState(u),[Z,G]=e.useState(p),[J,Q]=e.useState(E),[ee,te]=e.useState(b),[oe,re]=e.useState(_),[le,ne]=e.useState(g),[ce,se]=e.useState(f),[ae,ie]=e.useState(y),[ue,de]=e.useState(w),[pe,fe]=e.useState(null),ve=e.useRef(I),{anchorRefs:me,activeAnchor:ye}=m(t),he=e=>null==e?void 0:e.getAttributeNames().reduce(((t,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}),{}),we=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:n)},html:e=>{F(null!=e?e:c)},variant:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{G(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ie(null!=t?t:y)},"position-strategy":e=>{var t;de(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{Q(null===e?E:Number(e))},"delay-hide":e=>{te(null===e?b:Number(e))},float:e=>{re(null===e?_:"true"===e)},hidden:e=>{ne(null===e?g:"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((()=>{W(n)}),[n]),e.useEffect((()=>{F(c)}),[c]),e.useEffect((()=>{X(d)}),[d]),e.useEffect((()=>{V(u)}),[u]),e.useEffect((()=>{G(p)}),[p]),e.useEffect((()=>{Q(E)}),[E]),e.useEffect((()=>{te(b)}),[b]),e.useEffect((()=>{re(_)}),[_]),e.useEffect((()=>{ne(g)}),[g]),e.useEffect((()=>{de(w)}),[w]),e.useEffect((()=>{ve.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),e.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),e.useEffect((()=>{var e;const l=new Set(me);let n=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 c=document.querySelector(`[id='${o}']`);if(c&&l.add({current:c}),!l.size)return()=>null;const s=null!==(e=null!=pe?pe:c)&&void 0!==e?e:ye.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!s||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=he(s);we(o)}))})),i={attributes:!0,childList:!1,subtree:!1};if(s){const e=he(s);we(e),a.observe(s,i)}return()=>{a.disconnect()}}),[me,ye,pe,o,r]),e.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let Se=v;const Ee=e.useRef(null);if(s){const e=s({content:null!=P?P:null,activeAnchor:pe});Se=e?l.default.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},e):null}else P&&(Se=P);U&&(Se=l.default.createElement(L,{content:U}));const be={forwardRef:M,id:t,anchorId:o,anchorSelect:r,className:a,classNameArrow:i,content:Se,contentWrapperRef:Ee,place:K,variant:Y,offset:Z,wrapper:ce,events:ae,openOnClick:h,positionStrategy:ue,middlewares:S,delayShow:J,delayHide:ee,float:oe,hidden:le,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:x,closeOnResize:C,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z,activeAnchor:pe,setActiveAnchor:e=>fe(e)};return l.default.createElement(O,{...be})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||i({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||i({css:`
|
|
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 c="react-tooltip-core-styles",s="react-tooltip-base-styles",a={core:!1,base:!1};function i({css:e,id:t=s,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),r||(r={});const{insertAt:i}=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"===i&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),a[o]=!0}const 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},S=async({elementReference:e=null,tooltipReference:o=null,tooltipArrowReference:r=null,place:l="top",offset:n=10,strategy:c="absolute",middlewares:s=[t.offset(Number(n)),t.flip(),t.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===o)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const i=s;return r?(i.push(t.arrow({element:r,padding:5})),t.computePosition(e,o,{placement:l,strategy:c,middleware:i}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:a},{x:s,y:i}=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=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):t.computePosition(e,o,{placement:"bottom",strategy:c,middleware:i}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};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=({forwardRef:o,id:r,className:c,classNameArrow:s,variant:a="dark",anchorId:i,anchorSelect:d,place:p="top",offset:f=10,events:v=["hover"],openOnClick:h=!1,positionStrategy:O="absolute",middlewares:L,wrapper:x,delayShow:C=0,delayHide:k=0,float:N=!1,hidden:$=!1,noArrow:I=!1,clickable:j=!1,closeOnEsc:B=!1,closeOnScroll:q=!1,closeOnResize:D=!1,style:H,position:z,afterShow:M,afterHide:P,content:W,contentWrapperRef:U,isOpen:F,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:V,opacity:Z,arrowColor:G})=>{var J;const Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),oe=e.useRef(null),[re,le]=e.useState(p),[ne,ce]=e.useState({}),[se,ae]=e.useState({}),[ie,ue]=e.useState(!1),[de,pe]=e.useState(!1),[fe,ve]=e.useState(null),me=e.useRef(!1),ye=e.useRef(null),{anchorRefs:he,setActiveAnchor:we}=m(r),Se=e.useRef(!1),[Ee,be]=e.useState([]),_e=e.useRef(!1),ge=h||v.includes("click");y((()=>(_e.current=!0,()=>{_e.current=!1})),[]),e.useEffect((()=>{if(!ie){const e=setTimeout((()=>{pe(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ie]);const Ae=e=>{_e.current&&(e&&pe(!0),setTimeout((()=>{_e.current&&(null==K||K(e),void 0===F&&ue(e))}),10))};e.useEffect((()=>{if(void 0===F)return()=>null;F&&pe(!0);const e=setTimeout((()=>{ue(F)}),10);return()=>{clearTimeout(e)}}),[F]),e.useEffect((()=>{ie!==me.current&&(me.current=ie,ie?null==M||M():(ve(null),null==P||P()))}),[ie]);const Te=(e=C)=>{te.current&&clearTimeout(te.current),te.current=setTimeout((()=>{Ae(!0)}),e)},Re=(e=k)=>{oe.current&&clearTimeout(oe.current),oe.current=setTimeout((()=>{Se.current||Ae(!1)}),e)},Oe=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Y(null),void we({current:null});C?Te():Ae(!0),Y(o),we({current:o}),oe.current&&clearTimeout(oe.current)},Le=()=>{j?Re(k||100):k?Re():Ae(!1),te.current&&clearTimeout(te.current)},xe=({x:e,y:t})=>{var o;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};S({place:null!==(o=null==fe?void 0:fe.place)&&void 0!==o?o:p,offset:f,elementReference:r,tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:O,middlewares:L,border:V}).then((e=>{Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place)}))},Ce=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};xe(o),ye.current=o},ke=e=>{Oe(e),k&&Re()},Ne=e=>{var t;if(!ie)return;[document.querySelector(`[id='${i}']`),...Ee].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=Q.current)||void 0===t?void 0:t.contains(e.target))||(Ae(!1),te.current&&clearTimeout(te.current))},$e=u(Oe,50,!0),Ie=u(Le,50,!0),je=e.useCallback((()=>{var e,t;const o=null!==(e=null==fe?void 0:fe.position)&&void 0!==e?e:z;o?xe(o):N?ye.current&&xe(ye.current):(null==X?void 0:X.isConnected)&&S({place:null!==(t=null==fe?void 0:fe.place)&&void 0!==t?t:p,offset:f,elementReference:X,tooltipReference:Q.current,tooltipArrowReference:ee.current,strategy:O,middlewares:L,border:V}).then((e=>{_e.current&&(Object.keys(e.tooltipStyles).length&&ce(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ae(e.tooltipArrowStyles),le(e.place))}))}),[ie,X,W,H,p,null==fe?void 0:fe.place,f,O,z,null==fe?void 0:fe.position,N]);e.useEffect((()=>{var e,o;const r=new Set(he);Ee.forEach((e=>{r.add({current:e})}));const l=document.querySelector(`[id='${i}']`);l&&r.add({current:l});const n=()=>{Ae(!1)},c=w(X),s=w(Q.current);q&&(window.addEventListener("scroll",n),null==c||c.addEventListener("scroll",n),null==s||s.addEventListener("scroll",n));let a=null;D?window.addEventListener("resize",n):X&&Q.current&&(a=t.autoUpdate(X,Q.current,je,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ae(!1)};B&&window.addEventListener("keydown",u);const d=[];ge?(window.addEventListener("click",Ne),d.push({event:"click",listener:ke})):(d.push({event:"mouseenter",listener:$e},{event:"mouseleave",listener:Ie},{event:"focus",listener:$e},{event:"blur",listener:Ie}),N&&d.push({event:"mousemove",listener:Ce}));const p=()=>{Se.current=!0},f=()=>{Se.current=!1,Le()};return j&&!ge&&(null===(e=Q.current)||void 0===e||e.addEventListener("mouseenter",p),null===(o=Q.current)||void 0===o||o.addEventListener("mouseleave",f)),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;q&&(window.removeEventListener("scroll",n),null==c||c.removeEventListener("scroll",n),null==s||s.removeEventListener("scroll",n)),D?window.removeEventListener("resize",n):null==a||a(),ge&&window.removeEventListener("click",Ne),B&&window.removeEventListener("keydown",u),j&&!ge&&(null===(e=Q.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=Q.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[X,je,de,he,Ee,B,v]),e.useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:d)&&void 0!==t?t:"";!o&&r&&(o=`[data-tooltip-id='${r}']`);const l=new MutationObserver((e=>{const t=[],l=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===r&&t.push(e.target)}if("childList"===e.type){if(X){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{l.push(...t.filter((e=>e.matches(o)))),l.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(pe(!1),Ae(!1),Y(null),te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||l.length)&&be((e=>[...e.filter((e=>l.includes(e))),...t]))}));return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{l.disconnect()}}),[r,d,null==fe?void 0:fe.anchorSelect,X]),e.useEffect((()=>{je()}),[je]),e.useEffect((()=>{if(!(null==U?void 0:U.current))return()=>null;const e=new ResizeObserver((()=>{je()}));return e.observe(U.current),()=>{e.disconnect()}}),[W,null==U?void 0:U.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...Ee,t];X&&o.includes(X)||Y(null!==(e=Ee[0])&&void 0!==e?e:t)}),[i,Ee,X]),e.useEffect((()=>()=>{te.current&&clearTimeout(te.current),oe.current&&clearTimeout(oe.current)}),[]),e.useEffect((()=>{var e;let t=null!==(e=null==fe?void 0:fe.anchorSelect)&&void 0!==e?e:d;if(!t&&r&&(t=`[data-tooltip-id='${r}']`),t)try{const e=Array.from(document.querySelectorAll(t));be(e)}catch(e){be([])}}),[r,d,null==fe?void 0:fe.anchorSelect]);const Be=null!==(J=null==fe?void 0:fe.content)&&void 0!==J?J:W,qe=Boolean(!$&&Be&&ie&&Object.keys(ne).length>0);return e.useImperativeHandle(o,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}ve(null!=e?e:null),(null==e?void 0:e.delay)?Te(e.delay):Ae(!0)},close:e=>{(null==e?void 0:e.delay)?Re(e.delay):Ae(!1)},activeAnchor:X,place:re,isOpen:de&&qe}))),de?l.default.createElement(x,{id:r,role:"tooltip",className:n.default("react-tooltip",E,R.tooltip,R[a],c,`react-tooltip__place-${re}`,{"react-tooltip__show":qe,[T]:qe,[b]:"fixed"===O,[A]:j}),style:{...H,...ne,opacity:void 0!==Z&&qe?Z:void 0},ref:Q},Be,l.default.createElement(x,{className:n.default("react-tooltip-arrow",_,R.arrow,s,{[g]:I}),style:{...se,background:G?`linear-gradient(to right bottom, transparent 50%, ${G} 50%)`:void 0},ref:ee})):null},L=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),x=l.default.forwardRef((({id:t,anchorId:o,anchorSelect:r,content:n,html:c,render:s,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:y=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:_=!1,hidden:g=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:x=!1,closeOnResize:C=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z},M)=>{const[P,W]=e.useState(n),[U,F]=e.useState(c),[K,X]=e.useState(d),[Y,V]=e.useState(u),[Z,G]=e.useState(p),[J,Q]=e.useState(E),[ee,te]=e.useState(b),[oe,re]=e.useState(_),[le,ne]=e.useState(g),[ce,se]=e.useState(f),[ae,ie]=e.useState(y),[ue,de]=e.useState(w),[pe,fe]=e.useState(null),ve=e.useRef(I),{anchorRefs:me,activeAnchor:ye}=m(t),he=e=>null==e?void 0:e.getAttributeNames().reduce(((t,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}),{}),we=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:n)},html:e=>{F(null!=e?e:c)},variant:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{G(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ie(null!=t?t:y)},"position-strategy":e=>{var t;de(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{Q(null===e?E:Number(e))},"delay-hide":e=>{te(null===e?b:Number(e))},float:e=>{re(null===e?_:"true"===e)},hidden:e=>{ne(null===e?g:"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((()=>{W(n)}),[n]),e.useEffect((()=>{F(c)}),[c]),e.useEffect((()=>{X(d)}),[d]),e.useEffect((()=>{V(u)}),[u]),e.useEffect((()=>{G(p)}),[p]),e.useEffect((()=>{Q(E)}),[E]),e.useEffect((()=>{te(b)}),[b]),e.useEffect((()=>{re(_)}),[_]),e.useEffect((()=>{ne(g)}),[g]),e.useEffect((()=>{de(w)}),[w]),e.useEffect((()=>{ve.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),e.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),e.useEffect((()=>{var e;const l=new Set(me);let n=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 c=document.querySelector(`[id='${o}']`);if(c&&l.add({current:c}),!l.size)return()=>null;const s=null!==(e=null!=pe?pe:c)&&void 0!==e?e:ye.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!s||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=he(s);we(o)}))})),i={attributes:!0,childList:!1,subtree:!1};if(s){const e=he(s);we(e),a.observe(s,i)}return()=>{a.disconnect()}}),[me,ye,pe,o,r]),e.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let Se=v;const Ee=e.useRef(null);if(s){const e=s({content:null!=P?P:null,activeAnchor:pe});Se=e?l.default.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},e):null}else P&&(Se=P);U&&(Se=l.default.createElement(L,{content:U}));const be={forwardRef:M,id:t,anchorId:o,anchorSelect:r,className:a,classNameArrow:i,content:Se,contentWrapperRef:Ee,place:K,variant:Y,offset:Z,wrapper:ce,events:ae,openOnClick:h,positionStrategy:ue,middlewares:S,delayShow:J,delayHide:ee,float:oe,hidden:le,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:x,closeOnResize:C,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:q,setIsOpen:D,afterShow:H,afterHide:z,activeAnchor:pe,setActiveAnchor:e=>fe(e)};return l.default.createElement(O,{...be})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||i({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||i({css:`
|
|
8
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=x,exports.TooltipProvider=({children:t})=>{const[o,r]=e.useState({[d]:new Set}),[n,c]=e.useState({[d]:{current:null}}),s=(e,...t)=>{r((o=>{var r;const l=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>l.add(e))),{...o,[e]:new Set(l)}}))},a=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},i=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)=>s(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{c((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,n,s,a]),u=e.useMemo((()=>({getTooltipData:i})),[i]);return l.default.createElement(v.Provider,{value:u},t)},exports.TooltipWrapper=({tooltipId:t,children:o,className:r,place:c,content:s,html:a,variant:i,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:y})=>{const{attach:h,detach:w}=m(t),S=e.useRef(null);return e.useEffect((()=>(h(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:n.default("react-tooltip-wrapper",r),"data-tooltip-place":c,"data-tooltip-content":s,"data-tooltip-html":a,"data-tooltip-variant":i,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":y},o)},exports.removeStyle=function({type:e="base",id:t=s}={}){if(!a[e])return;"core"===e&&(t=c);const o=document.getElementById(t);"style"===(null==o?void 0:o.tagName)?null==o||o.remove():console.warn(`[react-tooltip] Failed to remove 'style' element with id '${t}'. Call \`injectStyle()\` first`),a[e]=!1};
|
|
@@ -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/components/TooltipController/TooltipController.tsx","../src/index.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, useImperativeHandle } 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, TooltipImperativeOpenOptions } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n forwardRef,\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style: externalStyles,\n position,\n afterShow,\n afterHide,\n // props handled by controller\n content,\n contentWrapperRef,\n isOpen,\n setIsOpen,\n activeAnchor,\n setActiveAnchor,\n border,\n opacity,\n arrowColor,\n}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const [imperativeOptions, setImperativeOptions] = useState<TooltipImperativeOpenOptions | null>(\n null,\n )\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 setImperativeOptions(null)\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 if (!show) {\n return\n }\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 const actualPosition = imperativeOptions?.position ?? position\n if (actualPosition) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(actualPosition)\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 imperativeOptions?.position,\n float,\n ])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n const handleScrollResize = () => {\n handleShow(false)\n }\n\n const anchorScrollParent = getScrollParent(activeAnchor)\n const tooltipScrollParent = getScrollParent(tooltipRef.current)\n\n if (closeOnScroll) {\n window.addEventListener('scroll', handleScrollResize)\n anchorScrollParent?.addEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.addEventListener('scroll', handleScrollResize)\n }\n let updateTooltipCleanup: null | (() => void) = null\n if (closeOnResize) {\n window.addEventListener('resize', handleScrollResize)\n } else if (activeAnchor && tooltipRef.current) {\n updateTooltipCleanup = autoUpdate(\n activeAnchor as HTMLElement,\n tooltipRef.current as HTMLElement,\n updateTooltipPosition,\n {\n ancestorResize: true,\n elementResize: true,\n layoutShift: true,\n },\n )\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\n }\n\n if (closeOnEsc) {\n window.addEventListener('keydown', handleEsc)\n }\n\n const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []\n\n if (shouldOpenOnClick) {\n window.addEventListener('click', handleClickOutsideAnchors)\n enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor })\n } else {\n enabledEvents.push(\n { event: 'mouseenter', listener: debouncedHandleShowTooltip },\n { event: 'mouseleave', listener: debouncedHandleHideTooltip },\n { event: 'focus', listener: debouncedHandleShowTooltip },\n { event: 'blur', listener: debouncedHandleHideTooltip },\n )\n if (float) {\n enabledEvents.push({\n event: 'mousemove',\n listener: handleMouseMove,\n })\n }\n }\n\n const handleMouseEnterTooltip = () => {\n hoveringTooltip.current = true\n }\n const handleMouseLeaveTooltip = () => {\n hoveringTooltip.current = false\n handleHideTooltip()\n }\n\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.addEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.addEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.addEventListener(event, listener)\n })\n })\n\n return () => {\n if (closeOnScroll) {\n window.removeEventListener('scroll', handleScrollResize)\n anchorScrollParent?.removeEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.removeEventListener('scroll', handleScrollResize)\n }\n if (closeOnResize) {\n window.removeEventListener('resize', handleScrollResize)\n } else {\n updateTooltipCleanup?.()\n }\n if (shouldOpenOnClick) {\n window.removeEventListener('click', handleClickOutsideAnchors)\n }\n if (closeOnEsc) {\n window.removeEventListener('keydown', handleEsc)\n }\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.removeEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.removeEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.removeEventListener(event, listener)\n })\n })\n }\n /**\n * rendered is also a dependency to ensure anchor observers are re-registered\n * since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM\n */\n }, [\n activeAnchor,\n updateTooltipPosition,\n rendered,\n anchorRefs,\n anchorsBySelect,\n closeOnEsc,\n events,\n ])\n\n useEffect(() => {\n let selector = imperativeOptions?.anchorSelect ?? 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, imperativeOptions?.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 = imperativeOptions?.anchorSelect ?? 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, imperativeOptions?.anchorSelect])\n\n const actualContent = imperativeOptions?.content ?? content\n const canShow = Boolean(!hidden && actualContent && show && Object.keys(inlineStyles).length > 0)\n\n useImperativeHandle(forwardRef, () => ({\n open: (options) => {\n if (options?.anchorSelect) {\n try {\n document.querySelector(options.anchorSelect)\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] \"${options.anchorSelect}\" is not a valid CSS selector`)\n }\n return\n }\n }\n setImperativeOptions(options ?? null)\n handleShow(true)\n },\n close: () => {\n handleShow(false)\n },\n activeAnchor,\n place: actualPlacement,\n isOpen: rendered && canShow,\n }))\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 {actualContent}\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 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 TooltipImperativeProps,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = React.forwardRef<TooltipImperativeProps, ITooltipController>(\n (\n {\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style,\n position,\n isOpen,\n disableStyleInjection = false,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n }: ITooltipController,\n ref,\n ) => {\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 forwardRef: ref,\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n closeOnScroll,\n closeOnResize,\n style,\n position,\n isOpen,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n },\n)\n\nexport default TooltipController\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 TooltipImperativeProps,\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 TooltipImperativeProps as TooltipRefProps,\n}\n\nexport { removeStyle } from './utils/handle-style'\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","forwardRef","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","closeOnScroll","closeOnResize","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","opacity","arrowColor","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","imperativeOptions","setImperativeOptions","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","actualPosition","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","actualContent","canShow","Boolean","useImperativeHandle","open","options","close","React","role","classNames","coreStyles","coreStyles_show","coreStyles_fixed","coreStyles_clickable","coreStyles_noArrow","background","TooltipContent","dangerouslySetInnerHTML","__html","TooltipController","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","detail","disableCore","disableBase","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,G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S,SAAQ,CAACpR,MAAOkR,GAAU/D,EAAmC,yBCzF/D,EACrBhO,YACAgO,WACAjK,YACAtC,QACA6D,UACAwI,OACA7J,UACAvC,SACA6C,UACAH,SACAE,mBACAG,YACAC,gBAEA,MAAMlF,OAAEA,EAAMC,OAAEA,GAAWM,EAAWC,GAChCkS,EAAYrM,SAA2B,MAS7C,OAPAxF,EAAAA,WAAU,KACRb,EAAO0S,GACA,KACLzS,EAAOyS,EAAU,IAElB,IAGDjF,EAAAA,QACEjP,cAAA,OAAA,CAAAf,IAAKiV,EACLnO,UAAWoJ,EAAAA,QAAW,wBAAyBpJ,GAC3B,qBAAAtC,yBACE6D,EAAO,oBACVwI,EAAI,uBACD7J,EACD,sBAAAvC,EACC,uBAAA6C,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExBsJ,EAEJ,sBH0CH,UAAqBhR,KACnBA,EAAO,OAAMD,GACbA,EAAKN,GAIH,IACF,IAAKC,EAASM,GACZ,OAGW,SAATA,IAEFD,EAAKP,GAGP,MAAMuB,EAAQb,SAASQ,eAAeX,GACf,WAAnBgB,aAAK,EAALA,EAAOoU,SACTpU,SAAAA,EAAOqU,SAGPzU,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/components/TooltipController/TooltipController.tsx","../src/index.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, useImperativeHandle } 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, TooltipImperativeOpenOptions } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n forwardRef,\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style: externalStyles,\n position,\n afterShow,\n afterHide,\n // props handled by controller\n content,\n contentWrapperRef,\n isOpen,\n setIsOpen,\n activeAnchor,\n setActiveAnchor,\n border,\n opacity,\n arrowColor,\n}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const [imperativeOptions, setImperativeOptions] = useState<TooltipImperativeOpenOptions | null>(\n null,\n )\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 setImperativeOptions(null)\n afterHide?.()\n }\n }, [show])\n\n const handleShowTooltipDelayed = (delay = delayShow) => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n\n tooltipShowDelayTimerRef.current = setTimeout(() => {\n handleShow(true)\n }, delay)\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: imperativeOptions?.place ?? 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 if (!show) {\n return\n }\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 const actualPosition = imperativeOptions?.position ?? position\n if (actualPosition) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(actualPosition)\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: imperativeOptions?.place ?? 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 imperativeOptions?.place,\n offset,\n positionStrategy,\n position,\n imperativeOptions?.position,\n float,\n ])\n\n useEffect(() => {\n const elementRefs = new Set(anchorRefs)\n\n anchorsBySelect.forEach((anchor) => {\n elementRefs.add({ current: anchor })\n })\n\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n if (anchorById) {\n elementRefs.add({ current: anchorById })\n }\n\n const handleScrollResize = () => {\n handleShow(false)\n }\n\n const anchorScrollParent = getScrollParent(activeAnchor)\n const tooltipScrollParent = getScrollParent(tooltipRef.current)\n\n if (closeOnScroll) {\n window.addEventListener('scroll', handleScrollResize)\n anchorScrollParent?.addEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.addEventListener('scroll', handleScrollResize)\n }\n let updateTooltipCleanup: null | (() => void) = null\n if (closeOnResize) {\n window.addEventListener('resize', handleScrollResize)\n } else if (activeAnchor && tooltipRef.current) {\n updateTooltipCleanup = autoUpdate(\n activeAnchor as HTMLElement,\n tooltipRef.current as HTMLElement,\n updateTooltipPosition,\n {\n ancestorResize: true,\n elementResize: true,\n layoutShift: true,\n },\n )\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\n }\n\n if (closeOnEsc) {\n window.addEventListener('keydown', handleEsc)\n }\n\n const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []\n\n if (shouldOpenOnClick) {\n window.addEventListener('click', handleClickOutsideAnchors)\n enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor })\n } else {\n enabledEvents.push(\n { event: 'mouseenter', listener: debouncedHandleShowTooltip },\n { event: 'mouseleave', listener: debouncedHandleHideTooltip },\n { event: 'focus', listener: debouncedHandleShowTooltip },\n { event: 'blur', listener: debouncedHandleHideTooltip },\n )\n if (float) {\n enabledEvents.push({\n event: 'mousemove',\n listener: handleMouseMove,\n })\n }\n }\n\n const handleMouseEnterTooltip = () => {\n hoveringTooltip.current = true\n }\n const handleMouseLeaveTooltip = () => {\n hoveringTooltip.current = false\n handleHideTooltip()\n }\n\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.addEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.addEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.addEventListener(event, listener)\n })\n })\n\n return () => {\n if (closeOnScroll) {\n window.removeEventListener('scroll', handleScrollResize)\n anchorScrollParent?.removeEventListener('scroll', handleScrollResize)\n tooltipScrollParent?.removeEventListener('scroll', handleScrollResize)\n }\n if (closeOnResize) {\n window.removeEventListener('resize', handleScrollResize)\n } else {\n updateTooltipCleanup?.()\n }\n if (shouldOpenOnClick) {\n window.removeEventListener('click', handleClickOutsideAnchors)\n }\n if (closeOnEsc) {\n window.removeEventListener('keydown', handleEsc)\n }\n if (clickable && !shouldOpenOnClick) {\n tooltipRef.current?.removeEventListener('mouseenter', handleMouseEnterTooltip)\n tooltipRef.current?.removeEventListener('mouseleave', handleMouseLeaveTooltip)\n }\n enabledEvents.forEach(({ event, listener }) => {\n elementRefs.forEach((ref) => {\n ref.current?.removeEventListener(event, listener)\n })\n })\n }\n /**\n * rendered is also a dependency to ensure anchor observers are re-registered\n * since `tooltipRef` becomes stale after removing/adding the tooltip to the DOM\n */\n }, [\n activeAnchor,\n updateTooltipPosition,\n rendered,\n anchorRefs,\n anchorsBySelect,\n closeOnEsc,\n events,\n ])\n\n useEffect(() => {\n let selector = imperativeOptions?.anchorSelect ?? 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, imperativeOptions?.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 = imperativeOptions?.anchorSelect ?? 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, imperativeOptions?.anchorSelect])\n\n const actualContent = imperativeOptions?.content ?? content\n const canShow = Boolean(!hidden && actualContent && show && Object.keys(inlineStyles).length > 0)\n\n useImperativeHandle(forwardRef, () => ({\n open: (options) => {\n if (options?.anchorSelect) {\n try {\n document.querySelector(options.anchorSelect)\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] \"${options.anchorSelect}\" is not a valid CSS selector`)\n }\n return\n }\n }\n setImperativeOptions(options ?? null)\n if (options?.delay) {\n handleShowTooltipDelayed(options.delay)\n } else {\n handleShow(true)\n }\n },\n close: (options) => {\n if (options?.delay) {\n handleHideTooltipDelayed(options.delay)\n } else {\n handleShow(false)\n }\n },\n activeAnchor,\n place: actualPlacement,\n isOpen: rendered && canShow,\n }))\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 {actualContent}\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 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 TooltipImperativeProps,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = React.forwardRef<TooltipImperativeProps, ITooltipController>(\n (\n {\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style,\n position,\n isOpen,\n disableStyleInjection = false,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n }: ITooltipController,\n ref,\n ) => {\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 forwardRef: ref,\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n closeOnScroll,\n closeOnResize,\n style,\n position,\n isOpen,\n border,\n opacity,\n arrowColor,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n },\n)\n\nexport default TooltipController\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 TooltipImperativeProps,\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 TooltipImperativeProps as TooltipRefProps,\n}\n\nexport { removeStyle } from './utils/handle-style'\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","forwardRef","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","closeOnScroll","closeOnResize","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","opacity","arrowColor","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","imperativeOptions","setImperativeOptions","wasShowing","lastFloatPosition","setProviderActiveAnchor","hoveringTooltip","anchorsBySelect","setAnchorsBySelect","mounted","shouldOpenOnClick","includes","handleShow","undefined","handleShowTooltipDelayed","delay","handleHideTooltipDelayed","handleShowTooltip","event","target","currentTarget","isConnected","handleHideTooltip","handleTooltipPosition","virtualElement","getBoundingClientRect","width","height","computedStylesData","Object","keys","length","handleMouseMove","mouseEvent","mousePosition","clientX","clientY","handleClickTooltipAnchor","handleClickOutsideAnchors","querySelector","anchor","contains","debouncedHandleShowTooltip","debouncedHandleHideTooltip","updateTooltipPosition","useCallback","actualPosition","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","actualContent","canShow","Boolean","useImperativeHandle","open","options","close","React","role","classNames","coreStyles","coreStyles_show","coreStyles_fixed","coreStyles_clickable","coreStyles_noArrow","background","TooltipContent","dangerouslySetInnerHTML","__html","TooltipController","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","detail","disableCore","disableBase","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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useState as o,useCallback as r,useMemo as l,useContext as n,useRef as i,useEffect as c,useLayoutEffect as a,useImperativeHandle as s}from"react";import{arrow as u,computePosition as d,offset as p,flip as v,shift as m,autoUpdate as f}from"@floating-ui/dom";import y from"classnames";const h="react-tooltip-core-styles",w="react-tooltip-base-styles",S={core:!1,base:!1};function b({css:e,id:t=w,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||S[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=h),r||(r={});const{insertAt:i}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const c=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.id=t,a.type="text/css","top"===i&&c.firstChild?c.insertBefore(a,c.firstChild):c.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e)),S[o]=!0}function E({type:e="base",id:t=w}={}){if(!S[e])return;"core"===e&&(t=h);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`),S[e]=!1}const g=(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))}},_="DEFAULT_TOOLTIP_ID",A={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},T=t({getTooltipData:()=>A}),O=({children:t})=>{const[n,i]=o({[_]:new Set}),[c,a]=o({[_]:{current:null}}),s=(e,...t)=>{i((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)=>{i((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},d=r(((e=_)=>{var t,o;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=c[e])&&void 0!==o?o:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{a((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[n,c,s,u]),p=l((()=>({getTooltipData:d})),[d]);return e.createElement(T.Provider,{value:p},t)};function L(e=_){return n(T).getTooltipData(e)}const R=({tooltipId:t,children:o,className:r,place:l,content:n,html:a,variant:s,offset:u,wrapper:d,events:p,positionStrategy:v,delayShow:m,delayHide:f})=>{const{attach:h,detach:w}=L(t),S=i(null);return c((()=>(h(S),()=>{w(S)})),[]),e.createElement("span",{ref:S,className:y("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":n,"data-tooltip-html":a,"data-tooltip-variant":s,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":v,"data-tooltip-delay-show":m,"data-tooltip-delay-hide":f},o)},C="undefined"!=typeof window?a:c,N=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},k=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(N(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},x=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:r="top",offset:l=10,strategy:n="absolute",middlewares:i=[p(Number(l)),v(),m({padding:5})],border:c})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const a=i;return o?(a.push(u({element:o,padding:5})),d(e,t,{placement:r,strategy:n,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const i={left:`${e}px`,top:`${t}px`,border:c},{x:a,y:s}=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=c&&{borderBottom:c,borderRight:c};let p=0;if(c){const e=`${c}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:null!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):d(e,t,{placement:"bottom",strategy:n,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var $="core-styles-module_tooltip__3vRRp",I="core-styles-module_fixed__pcSol",B="core-styles-module_arrow__cvMwQ",j="core-styles-module_noArrow__xock6",D="core-styles-module_clickable__ZuTTB",q="core-styles-module_show__Nt9eE",H={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const z=({forwardRef:t,id:l,className:n,classNameArrow:a,variant:u="dark",anchorId:d,anchorSelect:p,place:v="top",offset:m=10,events:h=["hover"],openOnClick:w=!1,positionStrategy:S="absolute",middlewares:b,wrapper:E,delayShow:_=0,delayHide:A=0,float:T=!1,hidden:O=!1,noArrow:R=!1,clickable:N=!1,closeOnEsc:z=!1,closeOnScroll:M=!1,closeOnResize:W=!1,style:P,position:F,afterShow:K,afterHide:U,content:X,contentWrapperRef:Y,isOpen:V,setIsOpen:Z,activeAnchor:G,setActiveAnchor:J,border:Q,opacity:ee,arrowColor:te})=>{var oe;const re=i(null),le=i(null),ne=i(null),ie=i(null),[ce,ae]=o(v),[se,ue]=o({}),[de,pe]=o({}),[ve,me]=o(!1),[fe,ye]=o(!1),[he,we]=o(null),Se=i(!1),be=i(null),{anchorRefs:Ee,setActiveAnchor:ge}=L(l),_e=i(!1),[Ae,Te]=o([]),Oe=i(!1),Le=w||h.includes("click");C((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]),c((()=>{if(!ve){const e=setTimeout((()=>{ye(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ve]);const Re=e=>{Oe.current&&(e&&ye(!0),setTimeout((()=>{Oe.current&&(null==Z||Z(e),void 0===V&&me(e))}),10))};c((()=>{if(void 0===V)return()=>null;V&&ye(!0);const e=setTimeout((()=>{me(V)}),10);return()=>{clearTimeout(e)}}),[V]),c((()=>{ve!==Se.current&&(Se.current=ve,ve?null==K||K():(we(null),null==U||U()))}),[ve]);const Ce=(e=A)=>{ie.current&&clearTimeout(ie.current),ie.current=setTimeout((()=>{_e.current||Re(!1)}),e)},Ne=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return J(null),void ge({current:null});_?(ne.current&&clearTimeout(ne.current),ne.current=setTimeout((()=>{Re(!0)}),_)):Re(!0),J(o),ge({current:o}),ie.current&&clearTimeout(ie.current)},ke=()=>{N?Ce(A||100):A?Ce():Re(!1),ne.current&&clearTimeout(ne.current)},xe=({x:e,y:t})=>{x({place:v,offset:m,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:S,middlewares:b,border:Q}).then((e=>{Object.keys(e.tooltipStyles).length&&ue(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),ae(e.place)}))},$e=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};xe(o),be.current=o},Ie=e=>{Ne(e),A&&Ce()},Be=e=>{var t;if(!ve)return;[document.querySelector(`[id='${d}']`),...Ae].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))},je=g(Ne,50,!0),De=g(ke,50,!0),qe=r((()=>{var e;const t=null!==(e=null==he?void 0:he.position)&&void 0!==e?e:F;t?xe(t):T?be.current&&xe(be.current):(null==G?void 0:G.isConnected)&&x({place:v,offset:m,elementReference:G,tooltipReference:re.current,tooltipArrowReference:le.current,strategy:S,middlewares:b,border:Q}).then((e=>{Oe.current&&(Object.keys(e.tooltipStyles).length&&ue(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),ae(e.place))}))}),[ve,G,X,P,v,m,S,F,null==he?void 0:he.position,T]);c((()=>{var e,t;const o=new Set(Ee);Ae.forEach((e=>{o.add({current:e})}));const r=document.querySelector(`[id='${d}']`);r&&o.add({current:r});const l=()=>{Re(!1)},n=k(G),i=k(re.current);M&&(window.addEventListener("scroll",l),null==n||n.addEventListener("scroll",l),null==i||i.addEventListener("scroll",l));let c=null;W?window.addEventListener("resize",l):G&&re.current&&(c=f(G,re.current,qe,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const a=e=>{"Escape"===e.key&&Re(!1)};z&&window.addEventListener("keydown",a);const s=[];Le?(window.addEventListener("click",Be),s.push({event:"click",listener:Ie})):(s.push({event:"mouseenter",listener:je},{event:"mouseleave",listener:De},{event:"focus",listener:je},{event:"blur",listener:De}),T&&s.push({event:"mousemove",listener:$e}));const u=()=>{_e.current=!0},p=()=>{_e.current=!1,ke()};return N&&!Le&&(null===(e=re.current)||void 0===e||e.addEventListener("mouseenter",u),null===(t=re.current)||void 0===t||t.addEventListener("mouseleave",p)),s.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;M&&(window.removeEventListener("scroll",l),null==n||n.removeEventListener("scroll",l),null==i||i.removeEventListener("scroll",l)),W?window.removeEventListener("resize",l):null==c||c(),Le&&window.removeEventListener("click",Be),z&&window.removeEventListener("keydown",a),N&&!Le&&(null===(e=re.current)||void 0===e||e.removeEventListener("mouseenter",u),null===(t=re.current)||void 0===t||t.removeEventListener("mouseleave",p)),s.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[G,qe,fe,Ee,Ae,z,h]),c((()=>{var e,t;let o=null!==(t=null!==(e=null==he?void 0:he.anchorSelect)&&void 0!==e?e:p)&&void 0!==t?t:"";!o&&l&&(o=`[data-tooltip-id='${l}']`);const r=new MutationObserver((e=>{const t=[],r=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===l&&t.push(e.target)}if("childList"===e.type){if(G){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{r.push(...t.filter((e=>e.matches(o)))),r.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,G))&&(ye(!1),Re(!1),J(null),ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||r.length)&&Te((e=>[...e.filter((e=>r.includes(e))),...t]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[l,p,null==he?void 0:he.anchorSelect,G]),c((()=>{qe()}),[qe]),c((()=>{if(!(null==Y?void 0:Y.current))return()=>null;const e=new ResizeObserver((()=>{qe()}));return e.observe(Y.current),()=>{e.disconnect()}}),[X,null==Y?void 0:Y.current]),c((()=>{var e;const t=document.querySelector(`[id='${d}']`),o=[...Ae,t];G&&o.includes(G)||J(null!==(e=Ae[0])&&void 0!==e?e:t)}),[d,Ae,G]),c((()=>()=>{ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current)}),[]),c((()=>{var e;let t=null!==(e=null==he?void 0:he.anchorSelect)&&void 0!==e?e:p;if(!t&&l&&(t=`[data-tooltip-id='${l}']`),t)try{const e=Array.from(document.querySelectorAll(t));Te(e)}catch(e){Te([])}}),[l,p,null==he?void 0:he.anchorSelect]);const He=null!==(oe=null==he?void 0:he.content)&&void 0!==oe?oe:X,ze=Boolean(!O&&He&&ve&&Object.keys(se).length>0);return s(t,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}we(null!=e?e:null),Re(!0)},close:()=>{Re(!1)},activeAnchor:G,place:ce,isOpen:fe&&ze}))),fe?e.createElement(E,{id:l,role:"tooltip",className:y("react-tooltip",$,H.tooltip,H[u],n,`react-tooltip__place-${ce}`,{"react-tooltip__show":ze,[q]:ze,[I]:"fixed"===S,[D]:N}),style:{...P,...se,opacity:void 0!==ee&&ze?ee:void 0},ref:re},He,e.createElement(E,{className:y("react-tooltip-arrow",B,H.arrow,a,{[j]:R}),style:{...de,background:te?`linear-gradient(to right bottom, transparent 50%, ${te} 50%)`:void 0},ref:le})):null},M=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),W=e.forwardRef((({id:t,anchorId:r,anchorSelect:l,content:n,html:a,render:s,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:S="absolute",middlewares:b,delayShow:E=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:O=!1,closeOnEsc:R=!1,closeOnScroll:C=!1,closeOnResize:N=!1,style:k,position:x,isOpen:$,disableStyleInjection:I=!1,border:B,opacity:j,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:W},P)=>{const[F,K]=o(n),[U,X]=o(a),[Y,V]=o(v),[Z,G]=o(p),[J,Q]=o(m),[ee,te]=o(E),[oe,re]=o(g),[le,ne]=o(_),[ie,ce]=o(A),[ae,se]=o(f),[ue,de]=o(h),[pe,ve]=o(S),[me,fe]=o(null),ye=i(I),{anchorRefs:he,activeAnchor:we}=L(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}),{}),be=e=>{const t={place:e=>{var t;V(null!==(t=e)&&void 0!==t?t:v)},content:e=>{K(null!=e?e:n)},html:e=>{X(null!=e?e:a)},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;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");de(null!=t?t:h)},"position-strategy":e=>{var t;ve(null!==(t=e)&&void 0!==t?t:S)},"delay-show":e=>{te(null===e?E:Number(e))},"delay-hide":e=>{re(null===e?g:Number(e))},float:e=>{ne(null===e?_:"true"===e)},hidden:e=>{ce(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)}))};c((()=>{K(n)}),[n]),c((()=>{X(a)}),[a]),c((()=>{V(v)}),[v]),c((()=>{G(p)}),[p]),c((()=>{Q(m)}),[m]),c((()=>{te(E)}),[E]),c((()=>{re(g)}),[g]),c((()=>{ne(_)}),[_]),c((()=>{ce(A)}),[A]),c((()=>{ve(S)}),[S]),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 o=new Set(he);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 i=document.querySelector(`[id='${r}']`);if(i&&o.add({current:i}),!o.size)return()=>null;const c=null!==(e=null!=me?me:i)&&void 0!==e?e:we.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Se(c);be(o)}))})),s={attributes:!0,childList:!1,subtree:!1};if(c){const e=Se(c);be(e),a.observe(c,s)}return()=>{a.disconnect()}}),[he,we,me,r,l]),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."),j&&!CSS.supports("opacity",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`opacity\`.`)}),[]);let Ee=y;const ge=i(null);if(s){const t=s({content:null!=F?F:null,activeAnchor:me});Ee=t?e.createElement("div",{ref:ge,className:"react-tooltip-content-wrapper"},t):null}else F&&(Ee=F);U&&(Ee=e.createElement(M,{content:U}));const _e={forwardRef:P,id:t,anchorId:r,anchorSelect:l,className:u,classNameArrow:d,content:Ee,contentWrapperRef:ge,place:Y,variant:Z,offset:J,wrapper:ae,events:ue,openOnClick:w,positionStrategy:pe,middlewares:b,delayShow:ee,delayHide:oe,float:le,hidden:ie,noArrow:T,clickable:O,closeOnEsc:R,closeOnScroll:C,closeOnResize:N,style:k,position:x,isOpen:$,border:B,opacity:j,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:W,activeAnchor:me,setActiveAnchor:e=>fe(e)};return e.createElement(z,{..._e})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||b({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||b({css:`
|
|
7
|
+
import e,{createContext as t,useState as o,useCallback as r,useMemo as l,useContext as n,useRef as i,useEffect as c,useLayoutEffect as a,useImperativeHandle as s}from"react";import{arrow as d,computePosition as u,offset as p,flip as v,shift as m,autoUpdate as f}from"@floating-ui/dom";import y from"classnames";const h="react-tooltip-core-styles",w="react-tooltip-base-styles",S={core:!1,base:!1};function b({css:e,id:t=w,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||S[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=h),r||(r={});const{insertAt:i}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const c=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.id=t,a.type="text/css","top"===i&&c.firstChild?c.insertBefore(a,c.firstChild):c.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e)),S[o]=!0}function E({type:e="base",id:t=w}={}){if(!S[e])return;"core"===e&&(t=h);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`),S[e]=!1}const g=(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))}},_="DEFAULT_TOOLTIP_ID",A={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},T=t({getTooltipData:()=>A}),O=({children:t})=>{const[n,i]=o({[_]:new Set}),[c,a]=o({[_]:{current:null}}),s=(e,...t)=>{i((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)}}))},d=(e,...t)=>{i((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},u=r(((e=_)=>{var t,o;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=c[e])&&void 0!==o?o:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>d(e,...t),setActiveAnchor:t=>((e,t)=>{a((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[n,c,s,d]),p=l((()=>({getTooltipData:u})),[u]);return e.createElement(T.Provider,{value:p},t)};function L(e=_){return n(T).getTooltipData(e)}const R=({tooltipId:t,children:o,className:r,place:l,content:n,html:a,variant:s,offset:d,wrapper:u,events:p,positionStrategy:v,delayShow:m,delayHide:f})=>{const{attach:h,detach:w}=L(t),S=i(null);return c((()=>(h(S),()=>{w(S)})),[]),e.createElement("span",{ref:S,className:y("react-tooltip-wrapper",r),"data-tooltip-place":l,"data-tooltip-content":n,"data-tooltip-html":a,"data-tooltip-variant":s,"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":f},o)},C="undefined"!=typeof window?a:c,N=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return"auto"===o||"scroll"===o}))},k=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(N(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},x=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:r="top",offset:l=10,strategy:n="absolute",middlewares:i=[p(Number(l)),v(),m({padding:5})],border:c})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const a=i;return o?(a.push(d({element:o,padding:5})),u(e,t,{placement:r,strategy:n,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const i={left:`${e}px`,top:`${t}px`,border:c},{x:a,y:s}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},d=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"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!=a?`${a}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",...u,[d]:`-${4+p}px`},place:o}}))):u(e,t,{placement:"bottom",strategy:n,middleware:a}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var $="core-styles-module_tooltip__3vRRp",I="core-styles-module_fixed__pcSol",B="core-styles-module_arrow__cvMwQ",j="core-styles-module_noArrow__xock6",D="core-styles-module_clickable__ZuTTB",q="core-styles-module_show__Nt9eE",H={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const z=({forwardRef:t,id:l,className:n,classNameArrow:a,variant:d="dark",anchorId:u,anchorSelect:p,place:v="top",offset:m=10,events:h=["hover"],openOnClick:w=!1,positionStrategy:S="absolute",middlewares:b,wrapper:E,delayShow:_=0,delayHide:A=0,float:T=!1,hidden:O=!1,noArrow:R=!1,clickable:N=!1,closeOnEsc:z=!1,closeOnScroll:M=!1,closeOnResize:W=!1,style:P,position:F,afterShow:K,afterHide:U,content:X,contentWrapperRef:Y,isOpen:V,setIsOpen:Z,activeAnchor:G,setActiveAnchor:J,border:Q,opacity:ee,arrowColor:te})=>{var oe;const re=i(null),le=i(null),ne=i(null),ie=i(null),[ce,ae]=o(v),[se,de]=o({}),[ue,pe]=o({}),[ve,me]=o(!1),[fe,ye]=o(!1),[he,we]=o(null),Se=i(!1),be=i(null),{anchorRefs:Ee,setActiveAnchor:ge}=L(l),_e=i(!1),[Ae,Te]=o([]),Oe=i(!1),Le=w||h.includes("click");C((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]),c((()=>{if(!ve){const e=setTimeout((()=>{ye(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ve]);const Re=e=>{Oe.current&&(e&&ye(!0),setTimeout((()=>{Oe.current&&(null==Z||Z(e),void 0===V&&me(e))}),10))};c((()=>{if(void 0===V)return()=>null;V&&ye(!0);const e=setTimeout((()=>{me(V)}),10);return()=>{clearTimeout(e)}}),[V]),c((()=>{ve!==Se.current&&(Se.current=ve,ve?null==K||K():(we(null),null==U||U()))}),[ve]);const Ce=(e=_)=>{ne.current&&clearTimeout(ne.current),ne.current=setTimeout((()=>{Re(!0)}),e)},Ne=(e=A)=>{ie.current&&clearTimeout(ie.current),ie.current=setTimeout((()=>{_e.current||Re(!1)}),e)},ke=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 J(null),void ge({current:null});_?Ce():Re(!0),J(o),ge({current:o}),ie.current&&clearTimeout(ie.current)},xe=()=>{N?Ne(A||100):A?Ne():Re(!1),ne.current&&clearTimeout(ne.current)},$e=({x:e,y:t})=>{var o;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};x({place:null!==(o=null==he?void 0:he.place)&&void 0!==o?o:v,offset:m,elementReference:r,tooltipReference:re.current,tooltipArrowReference:le.current,strategy:S,middlewares:b,border:Q}).then((e=>{Object.keys(e.tooltipStyles).length&&de(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),ae(e.place)}))},Ie=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};$e(o),be.current=o},Be=e=>{ke(e),A&&Ne()},je=e=>{var t;if(!ve)return;[document.querySelector(`[id='${u}']`),...Ae].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))},De=g(ke,50,!0),qe=g(xe,50,!0),He=r((()=>{var e,t;const o=null!==(e=null==he?void 0:he.position)&&void 0!==e?e:F;o?$e(o):T?be.current&&$e(be.current):(null==G?void 0:G.isConnected)&&x({place:null!==(t=null==he?void 0:he.place)&&void 0!==t?t:v,offset:m,elementReference:G,tooltipReference:re.current,tooltipArrowReference:le.current,strategy:S,middlewares:b,border:Q}).then((e=>{Oe.current&&(Object.keys(e.tooltipStyles).length&&de(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&pe(e.tooltipArrowStyles),ae(e.place))}))}),[ve,G,X,P,v,null==he?void 0:he.place,m,S,F,null==he?void 0:he.position,T]);c((()=>{var e,t;const o=new Set(Ee);Ae.forEach((e=>{o.add({current:e})}));const r=document.querySelector(`[id='${u}']`);r&&o.add({current:r});const l=()=>{Re(!1)},n=k(G),i=k(re.current);M&&(window.addEventListener("scroll",l),null==n||n.addEventListener("scroll",l),null==i||i.addEventListener("scroll",l));let c=null;W?window.addEventListener("resize",l):G&&re.current&&(c=f(G,re.current,He,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const a=e=>{"Escape"===e.key&&Re(!1)};z&&window.addEventListener("keydown",a);const s=[];Le?(window.addEventListener("click",je),s.push({event:"click",listener:Be})):(s.push({event:"mouseenter",listener:De},{event:"mouseleave",listener:qe},{event:"focus",listener:De},{event:"blur",listener:qe}),T&&s.push({event:"mousemove",listener:Ie}));const d=()=>{_e.current=!0},p=()=>{_e.current=!1,xe()};return N&&!Le&&(null===(e=re.current)||void 0===e||e.addEventListener("mouseenter",d),null===(t=re.current)||void 0===t||t.addEventListener("mouseleave",p)),s.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t)}))})),()=>{var e,t;M&&(window.removeEventListener("scroll",l),null==n||n.removeEventListener("scroll",l),null==i||i.removeEventListener("scroll",l)),W?window.removeEventListener("resize",l):null==c||c(),Le&&window.removeEventListener("click",je),z&&window.removeEventListener("keydown",a),N&&!Le&&(null===(e=re.current)||void 0===e||e.removeEventListener("mouseenter",d),null===(t=re.current)||void 0===t||t.removeEventListener("mouseleave",p)),s.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[G,He,fe,Ee,Ae,z,h]),c((()=>{var e,t;let o=null!==(t=null!==(e=null==he?void 0:he.anchorSelect)&&void 0!==e?e:p)&&void 0!==t?t:"";!o&&l&&(o=`[data-tooltip-id='${l}']`);const r=new MutationObserver((e=>{const t=[],r=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===l&&t.push(e.target)}if("childList"===e.type){if(G){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{r.push(...t.filter((e=>e.matches(o)))),r.push(...t.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}t.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,G))&&(ye(!1),Re(!1),J(null),ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current),!0)}))}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])))}catch(e){}}})),(t.length||r.length)&&Te((e=>[...e.filter((e=>r.includes(e))),...t]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[l,p,null==he?void 0:he.anchorSelect,G]),c((()=>{He()}),[He]),c((()=>{if(!(null==Y?void 0:Y.current))return()=>null;const e=new ResizeObserver((()=>{He()}));return e.observe(Y.current),()=>{e.disconnect()}}),[X,null==Y?void 0:Y.current]),c((()=>{var e;const t=document.querySelector(`[id='${u}']`),o=[...Ae,t];G&&o.includes(G)||J(null!==(e=Ae[0])&&void 0!==e?e:t)}),[u,Ae,G]),c((()=>()=>{ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current)}),[]),c((()=>{var e;let t=null!==(e=null==he?void 0:he.anchorSelect)&&void 0!==e?e:p;if(!t&&l&&(t=`[data-tooltip-id='${l}']`),t)try{const e=Array.from(document.querySelectorAll(t));Te(e)}catch(e){Te([])}}),[l,p,null==he?void 0:he.anchorSelect]);const ze=null!==(oe=null==he?void 0:he.content)&&void 0!==oe?oe:X,Me=Boolean(!O&&ze&&ve&&Object.keys(se).length>0);return s(t,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect)}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}we(null!=e?e:null),(null==e?void 0:e.delay)?Ce(e.delay):Re(!0)},close:e=>{(null==e?void 0:e.delay)?Ne(e.delay):Re(!1)},activeAnchor:G,place:ce,isOpen:fe&&Me}))),fe?e.createElement(E,{id:l,role:"tooltip",className:y("react-tooltip",$,H.tooltip,H[d],n,`react-tooltip__place-${ce}`,{"react-tooltip__show":Me,[q]:Me,[I]:"fixed"===S,[D]:N}),style:{...P,...se,opacity:void 0!==ee&&Me?ee:void 0},ref:re},ze,e.createElement(E,{className:y("react-tooltip-arrow",B,H.arrow,a,{[j]:R}),style:{...ue,background:te?`linear-gradient(to right bottom, transparent 50%, ${te} 50%)`:void 0},ref:le})):null},M=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),W=e.forwardRef((({id:t,anchorId:r,anchorSelect:l,content:n,html:a,render:s,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:S="absolute",middlewares:b,delayShow:E=0,delayHide:g=0,float:_=!1,hidden:A=!1,noArrow:T=!1,clickable:O=!1,closeOnEsc:R=!1,closeOnScroll:C=!1,closeOnResize:N=!1,style:k,position:x,isOpen:$,disableStyleInjection:I=!1,border:B,opacity:j,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:W},P)=>{const[F,K]=o(n),[U,X]=o(a),[Y,V]=o(v),[Z,G]=o(p),[J,Q]=o(m),[ee,te]=o(E),[oe,re]=o(g),[le,ne]=o(_),[ie,ce]=o(A),[ae,se]=o(f),[de,ue]=o(h),[pe,ve]=o(S),[me,fe]=o(null),ye=i(I),{anchorRefs:he,activeAnchor:we}=L(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}),{}),be=e=>{const t={place:e=>{var t;V(null!==(t=e)&&void 0!==t?t:v)},content:e=>{K(null!=e?e:n)},html:e=>{X(null!=e?e:a)},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;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ue(null!=t?t:h)},"position-strategy":e=>{var t;ve(null!==(t=e)&&void 0!==t?t:S)},"delay-show":e=>{te(null===e?E:Number(e))},"delay-hide":e=>{re(null===e?g:Number(e))},float:e=>{ne(null===e?_:"true"===e)},hidden:e=>{ce(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)}))};c((()=>{K(n)}),[n]),c((()=>{X(a)}),[a]),c((()=>{V(v)}),[v]),c((()=>{G(p)}),[p]),c((()=>{Q(m)}),[m]),c((()=>{te(E)}),[E]),c((()=>{re(g)}),[g]),c((()=>{ne(_)}),[_]),c((()=>{ce(A)}),[A]),c((()=>{ve(S)}),[S]),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 o=new Set(he);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 i=document.querySelector(`[id='${r}']`);if(i&&o.add({current:i}),!o.size)return()=>null;const c=null!==(e=null!=me?me:i)&&void 0!==e?e:we.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Se(c);be(o)}))})),s={attributes:!0,childList:!1,subtree:!1};if(c){const e=Se(c);be(e),a.observe(c,s)}return()=>{a.disconnect()}}),[he,we,me,r,l]),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."),j&&!CSS.supports("opacity",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`opacity\`.`)}),[]);let Ee=y;const ge=i(null);if(s){const t=s({content:null!=F?F:null,activeAnchor:me});Ee=t?e.createElement("div",{ref:ge,className:"react-tooltip-content-wrapper"},t):null}else F&&(Ee=F);U&&(Ee=e.createElement(M,{content:U}));const _e={forwardRef:P,id:t,anchorId:r,anchorSelect:l,className:d,classNameArrow:u,content:Ee,contentWrapperRef:ge,place:Y,variant:Z,offset:J,wrapper:ae,events:de,openOnClick:w,positionStrategy:pe,middlewares:b,delayShow:ee,delayHide:oe,float:le,hidden:ie,noArrow:T,clickable:O,closeOnEsc:R,closeOnScroll:C,closeOnResize:N,style:k,position:x,isOpen:$,border:B,opacity:j,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:W,activeAnchor:me,setActiveAnchor:e=>fe(e)};return e.createElement(z,{..._e})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||b({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9}.core-styles-module_tooltip__3vRRp{visibility:hidden;position:absolute;top:0;left:0;pointer-events:none;opacity:0;transition:opacity 0.3s ease-out;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{visibility:visible;opacity:var(--rt-opacity)}`,type:"core"}),e.detail.disableBase||b({css:`
|
|
8
8
|
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})}));export{W as Tooltip,O as TooltipProvider,R as TooltipWrapper,E as removeStyle};
|