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