react-tooltip
Advanced tools
Comparing version 5.21.3 to 5.22.0-beta.1091.0
@@ -102,2 +102,3 @@ import React, { ElementType, ReactNode, CSSProperties, PropsWithChildren } from 'react'; | ||
disableStyleInjection?: boolean | 'core' | ||
holdPositionOnRender?: boolean | ||
/** | ||
@@ -159,3 +160,3 @@ * @description see https://developer.mozilla.org/en-US/docs/Web/CSS/border. | ||
declare const TooltipController: ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant, place, offset, wrapper, children, events, openOnClick, positionStrategy, middlewares, delayShow, delayHide, float, hidden, noArrow, clickable, closeOnEsc, closeOnScroll, closeOnResize, style, position, isOpen, disableStyleInjection, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }: ITooltipController) => React.JSX.Element; | ||
declare const TooltipController: ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant, place, offset, wrapper, children, events, openOnClick, positionStrategy, middlewares, delayShow, delayHide, float, hidden, noArrow, clickable, closeOnEsc, closeOnScroll, closeOnResize, style, position, isOpen, disableStyleInjection, holdPositionOnRender, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }: ITooltipController) => React.JSX.Element; | ||
@@ -162,0 +163,0 @@ /** |
@@ -336,3 +336,3 @@ | ||
// props handled by controller | ||
content, contentWrapperRef, isOpen, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => { | ||
content, contentWrapperRef, isOpen, holdPositionOnRender, setIsOpen, activeAnchor, setActiveAnchor, border, opacity, arrowColor, }) => { | ||
const tooltipRef = React.useRef(null); | ||
@@ -588,2 +588,5 @@ const tooltipArrowRef = React.useRef(null); | ||
} | ||
if (!(activeAnchor === null || activeAnchor === void 0 ? void 0 : activeAnchor.isConnected)) { | ||
return; | ||
} | ||
computeTooltipPosition({ | ||
@@ -646,3 +649,3 @@ place, | ||
} | ||
else if (activeAnchor && tooltipRef.current) { | ||
else if (activeAnchor && tooltipRef.current && !holdPositionOnRender) { | ||
updateTooltipCleanup = dom.autoUpdate(activeAnchor, tooltipRef.current, updateTooltipPosition, { | ||
@@ -744,2 +747,3 @@ ancestorResize: true, | ||
const newAnchors = []; | ||
const removedAnchors = []; | ||
mutationList.forEach((mutation) => { | ||
@@ -756,3 +760,12 @@ if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') { | ||
if (activeAnchor) { | ||
[...mutation.removedNodes].some((node) => { | ||
const elements = [...mutation.removedNodes].filter((node) => node.nodeType === 1); | ||
if (selector) { | ||
removedAnchors.push( | ||
// the element itself is an anchor | ||
...elements.filter((element) => element.matches(selector))); | ||
removedAnchors.push( | ||
// the element has children which are anchors | ||
...elements.flatMap((element) => [...element.querySelectorAll(selector)])); | ||
} | ||
elements.some((node) => { | ||
var _a; | ||
@@ -794,3 +807,6 @@ if ((_a = node === null || node === void 0 ? void 0 : node.contains) === null || _a === void 0 ? void 0 : _a.call(node, activeAnchor)) { | ||
if (newAnchors.length) { | ||
setAnchorsBySelect((anchors) => [...anchors, ...newAnchors]); | ||
setAnchorsBySelect((anchors) => [ | ||
...anchors.filter((anchor) => removedAnchors.includes(anchor)), | ||
...newAnchors, | ||
]); | ||
} | ||
@@ -866,3 +882,3 @@ }; | ||
const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0; | ||
return rendered ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, { | ||
return rendered || (wasShowing.current && holdPositionOnRender) ? (React__default["default"].createElement(WrapperElement, { id: id, role: "tooltip", className: classNames__default["default"]('react-tooltip', coreStyles['tooltip'], styles['tooltip'], styles[variant], className, `react-tooltip__place-${actualPlacement}`, { | ||
'react-tooltip__show': canShow, | ||
@@ -897,3 +913,3 @@ [coreStyles['show']]: canShow, | ||
const TooltipController = ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style, position, isOpen, disableStyleInjection = false, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }) => { | ||
const TooltipController = ({ id, anchorId, anchorSelect, content, html, render, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], openOnClick = false, positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, hidden = false, noArrow = false, clickable = false, closeOnEsc = false, closeOnScroll = false, closeOnResize = false, style, position, isOpen, disableStyleInjection = false, holdPositionOnRender, border, opacity, arrowColor, setIsOpen, afterShow, afterHide, }) => { | ||
const [tooltipContent, setTooltipContent] = React.useState(content); | ||
@@ -1149,2 +1165,3 @@ const [tooltipHtml, setTooltipHtml] = React.useState(html); | ||
isOpen, | ||
holdPositionOnRender, | ||
border, | ||
@@ -1151,0 +1168,0 @@ opacity, |
@@ -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,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t),s=n(r);const c="react-tooltip-core-styles",a="react-tooltip-base-styles",i={core:!1,base:!1};function u({css:e,id:t=a,type:o="base",ref:r}){var n,l;if(!e||"undefined"==typeof document||i[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),r||(r={});const{insertAt:s}=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"===s&&u.firstChild?u.insertBefore(d,u.firstChild):u.appendChild(d),d.styleSheet?d.styleSheet.cssText=e:d.appendChild(document.createTextNode(e)),i[o]=!0}const d=(e,t,o)=>{let r=null;return function(...n){const l=()=>{r=null,o||e.apply(this,n)};o&&!r&&(e.apply(this,n),r=setTimeout(l,t)),o||(r&&clearTimeout(r),r=setTimeout(l,t))}},p="DEFAULT_TOOLTIP_ID",f={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},v={getTooltipData:()=>f},m=t.createContext(v);function y(e=p){return t.useContext(m).getTooltipData(e)}const h="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,w=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}))},S=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(w(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},E=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:n="top",offset:l=10,strategy:s="absolute",middlewares:c=[o.offset(Number(l)),o.flip(),o.shift({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:n};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:n};const i=c;return r?(i.push(o.arrow({element:r,padding:5})),o.computePosition(e,t,{placement:n,strategy:s,middleware:i}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var n,l;const s={left:`${e}px`,top:`${t}px`,border:a},{x:c,y:i}=null!==(n=r.arrow)&&void 0!==n?n:{x:0,y:0},u=null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==l?l:"bottom",d=a&&{borderBottom:a,borderRight:a};let p=0;if(a){const e=`${a}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1}return{tooltipStyles:s,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=i?`${i}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):o.computePosition(e,t,{placement:"bottom",strategy:s,middleware:i}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))};var b="core-styles-module_tooltip__3vRRp",g="core-styles-module_fixed__pcSol",_="core-styles-module_arrow__cvMwQ",A="core-styles-module_noArrow__xock6",T="core-styles-module_clickable__ZuTTB",R="core-styles-module_show__Nt9eE",O={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const L=({id:e,className:r,classNameArrow:n,variant:c="dark",anchorId:a,anchorSelect:i,place:u="top",offset:p=10,events:f=["hover"],openOnClick:v=!1,positionStrategy:m="absolute",middlewares:w,wrapper:L,delayShow:x=0,delayHide:C=0,float:k=!1,hidden:N=!1,noArrow:$=!1,clickable:I=!1,closeOnEsc:j=!1,closeOnScroll:B=!1,closeOnResize:D=!1,style:q,position:H,afterShow:z,afterHide:M,content:P,contentWrapperRef:W,isOpen:U,setIsOpen:F,activeAnchor:K,setActiveAnchor:X,border:Y,opacity:V,arrowColor:Z})=>{const G=t.useRef(null),J=t.useRef(null),Q=t.useRef(null),ee=t.useRef(null),[te,oe]=t.useState(u),[re,ne]=t.useState({}),[le,se]=t.useState({}),[ce,ae]=t.useState(!1),[ie,ue]=t.useState(!1),de=t.useRef(!1),pe=t.useRef(null),{anchorRefs:fe,setActiveAnchor:ve}=y(e),me=t.useRef(!1),[ye,he]=t.useState([]),we=t.useRef(!1),Se=v||f.includes("click");h((()=>(we.current=!0,()=>{we.current=!1})),[]),t.useEffect((()=>{if(!ce){const e=setTimeout((()=>{ue(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ce]);const Ee=e=>{we.current&&(e&&ue(!0),setTimeout((()=>{we.current&&(null==F||F(e),void 0===U&&ae(e))}),10))};t.useEffect((()=>{if(void 0===U)return()=>null;U&&ue(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),t.useEffect((()=>{ce!==de.current&&(de.current=ce,ce?null==z||z():null==M||M())}),[ce]);const be=(e=C)=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout((()=>{me.current||Ee(!1)}),e)},ge=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 X(null),void ve({current:null});x?(Q.current&&clearTimeout(Q.current),Q.current=setTimeout((()=>{Ee(!0)}),x)):Ee(!0),X(o),ve({current:o}),ee.current&&clearTimeout(ee.current)},_e=()=>{I?be(C||100):C?be():Ee(!1),Q.current&&clearTimeout(Q.current)},Ae=({x:e,y:t})=>{E({place:u,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:G.current,tooltipArrowReference:J.current,strategy:m,middlewares:w,border:Y}).then((e=>{Object.keys(e.tooltipStyles).length&&ne(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),oe(e.place)}))},Te=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Ae(o),pe.current=o},Re=e=>{ge(e),C&&be()},Oe=e=>{var t;[document.querySelector(`[id='${a}']`),...ye].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=G.current)||void 0===t?void 0:t.contains(e.target))||(Ee(!1),Q.current&&clearTimeout(Q.current))},Le=d(ge,50,!0),xe=d(_e,50,!0),Ce=t.useCallback((()=>{H?Ae(H):k?pe.current&&Ae(pe.current):E({place:u,offset:p,elementReference:K,tooltipReference:G.current,tooltipArrowReference:J.current,strategy:m,middlewares:w,border:Y}).then((e=>{we.current&&(Object.keys(e.tooltipStyles).length&&ne(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&se(e.tooltipArrowStyles),oe(e.place))}))}),[ce,K,P,q,u,p,m,H,k]);t.useEffect((()=>{var e,t;const r=new Set(fe);ye.forEach((e=>{r.add({current:e})}));const n=document.querySelector(`[id='${a}']`);n&&r.add({current:n});const l=()=>{Ee(!1)},s=S(K),c=S(G.current);B&&(window.addEventListener("scroll",l),null==s||s.addEventListener("scroll",l),null==c||c.addEventListener("scroll",l));let i=null;D?window.addEventListener("resize",l):K&&G.current&&(i=o.autoUpdate(K,G.current,Ce,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&Ee(!1)};j&&window.addEventListener("keydown",u);const d=[];Se?(window.addEventListener("click",Oe),d.push({event:"click",listener:Re})):(d.push({event:"mouseenter",listener:Le},{event:"mouseleave",listener:xe},{event:"focus",listener:Le},{event:"blur",listener:xe}),k&&d.push({event:"mousemove",listener:Te}));const p=()=>{me.current=!0},f=()=>{me.current=!1,_e()};return I&&!Se&&(null===(e=G.current)||void 0===e||e.addEventListener("mouseenter",p),null===(t=G.current)||void 0===t||t.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;B&&(window.removeEventListener("scroll",l),null==s||s.removeEventListener("scroll",l),null==c||c.removeEventListener("scroll",l)),D?window.removeEventListener("resize",l):null==i||i(),Se&&window.removeEventListener("click",Oe),j&&window.removeEventListener("keydown",u),I&&!Se&&(null===(e=G.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=G.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[K,Ce,ie,fe,ye,j,f]),t.useEffect((()=>{let t=null!=i?i:"";!t&&e&&(t=`[data-tooltip-id='${e}']`);const o=new MutationObserver((o=>{const r=[];o.forEach((o=>{if("attributes"===o.type&&"data-tooltip-id"===o.attributeName){o.target.getAttribute("data-tooltip-id")===e&&r.push(o.target)}if("childList"===o.type&&(K&&[...o.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,K))&&(ue(!1),Ee(!1),X(null),Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current),!0)})),t))try{const e=[...o.addedNodes].filter((e=>1===e.nodeType));r.push(...e.filter((e=>e.matches(t)))),r.push(...e.flatMap((e=>[...e.querySelectorAll(t)])))}catch(e){}})),r.length&&he((e=>[...e,...r]))}));return o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{o.disconnect()}}),[e,i,K]),t.useEffect((()=>{Ce()}),[Ce]),t.useEffect((()=>{if(!(null==W?void 0:W.current))return()=>null;const e=new ResizeObserver((()=>{Ce()}));return e.observe(W.current),()=>{e.disconnect()}}),[P,null==W?void 0:W.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${a}']`),o=[...ye,t];K&&o.includes(K)||X(null!==(e=ye[0])&&void 0!==e?e:t)}),[a,ye,K]),t.useEffect((()=>()=>{Q.current&&clearTimeout(Q.current),ee.current&&clearTimeout(ee.current)}),[]),t.useEffect((()=>{let t=i;if(!t&&e&&(t=`[data-tooltip-id='${e}']`),t)try{const e=Array.from(document.querySelectorAll(t));he(e)}catch(e){he([])}}),[e,i]);const ke=!N&&P&&ce&&Object.keys(re).length>0;return ie?l.default.createElement(L,{id:e,role:"tooltip",className:s.default("react-tooltip",b,O.tooltip,O[c],r,`react-tooltip__place-${te}`,{"react-tooltip__show":ke,[R]:ke,[g]:"fixed"===m,[T]:I}),style:{...q,...re,opacity:void 0!==V&&ke?V:void 0},ref:G},P,l.default.createElement(L,{className:s.default("react-tooltip-arrow",_,O.arrow,n,{[A]:$}),style:{...le,background:Z?`linear-gradient(to right bottom, transparent 50%, ${Z} 50%)`:void 0},ref:J})):null},x=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"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}.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||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=({id:e,anchorId:o,anchorSelect:r,content:n,html:s,render:c,className:a,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:m=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:g=!1,hidden:_=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:O=!1,closeOnResize:C=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,border:j,opacity:B,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:z})=>{const[M,P]=t.useState(n),[W,U]=t.useState(s),[F,K]=t.useState(d),[X,Y]=t.useState(u),[V,Z]=t.useState(p),[G,J]=t.useState(E),[Q,ee]=t.useState(b),[te,oe]=t.useState(g),[re,ne]=t.useState(_),[le,se]=t.useState(f),[ce,ae]=t.useState(m),[ie,ue]=t.useState(w),[de,pe]=t.useState(null),fe=t.useRef(I),{anchorRefs:ve,activeAnchor:me}=y(e),ye=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}),{}),he=e=>{const t={place:e=>{var t;K(null!==(t=e)&&void 0!==t?t:d)},content:e=>{P(null!=e?e:n)},html:e=>{U(null!=e?e:s)},variant:e=>{var t;Y(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{Z(null===e?p:Number(e))},wrapper:e=>{var t;se(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ae(null!=t?t:m)},"position-strategy":e=>{var t;ue(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{J(null===e?E:Number(e))},"delay-hide":e=>{ee(null===e?b:Number(e))},float:e=>{oe(null===e?g:"true"===e)},hidden:e=>{ne(null===e?_:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};t.useEffect((()=>{P(n)}),[n]),t.useEffect((()=>{U(s)}),[s]),t.useEffect((()=>{K(d)}),[d]),t.useEffect((()=>{Y(u)}),[u]),t.useEffect((()=>{Z(p)}),[p]),t.useEffect((()=>{J(E)}),[E]),t.useEffect((()=>{ee(b)}),[b]),t.useEffect((()=>{oe(g)}),[g]),t.useEffect((()=>{ne(_)}),[_]),t.useEffect((()=>{ue(w)}),[w]),t.useEffect((()=>{fe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),t.useEffect((()=>{var t;const n=new Set(ve);let l=r;if(!l&&e&&(l=`[data-tooltip-id='${e}']`),l)try{document.querySelectorAll(l).forEach((e=>{n.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`)}const s=document.querySelector(`[id='${o}']`);if(s&&n.add({current:s}),!n.size)return()=>null;const c=null!==(t=null!=de?de:s)&&void 0!==t?t:me.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=ye(c);he(o)}))})),i={attributes:!0,childList:!1,subtree:!1};if(c){const e=ye(c);he(e),a.observe(c,i)}return()=>{a.disconnect()}}),[ve,me,de,o,r]),t.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),j&&!CSS.supports("border",`${j}`)&&console.warn(`[react-tooltip] "${j}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),B&&!CSS.supports("opacity",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`opacity\`.`)}),[]);let we=v;const Se=t.useRef(null);if(c){const e=c({content:null!=M?M:null,activeAnchor:de});we=e?l.default.createElement("div",{ref:Se,className:"react-tooltip-content-wrapper"},e):null}else M&&(we=M);W&&(we=l.default.createElement(x,{content:W}));const Ee={id:e,anchorId:o,anchorSelect:r,className:a,classNameArrow:i,content:we,contentWrapperRef:Se,place:F,variant:X,offset:V,wrapper:le,events:ce,openOnClick:h,positionStrategy:ie,middlewares:S,delayShow:G,delayHide:Q,float:te,hidden:re,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:O,closeOnResize:C,style:k,position:N,isOpen:$,border:j,opacity:B,arrowColor:D,setIsOpen:q,afterShow:H,afterHide:z,activeAnchor:de,setActiveAnchor:e=>pe(e)};return l.default.createElement(L,{...Ee})},e.TooltipProvider=({children:e})=>{const[o,r]=t.useState({[p]:new Set}),[n,s]=t.useState({[p]:{current:null}}),c=(e,...t)=>{r((o=>{var r;const n=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>n.add(e))),{...o,[e]:new Set(n)}}))},a=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},i=t.useCallback(((e=p)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=n[e])&&void 0!==r?r:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,n,c,a]),u=t.useMemo((()=>({getTooltipData:i})),[i]);return l.default.createElement(m.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:r,place:n,content:c,html:a,variant:i,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:h,detach:w}=y(e),S=t.useRef(null);return t.useEffect((()=>(h(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:s.default("react-tooltip-wrapper",r),"data-tooltip-place":n,"data-tooltip-content":c,"data-tooltip-html":a,"data-tooltip-variant":i,"data-tooltip-offset":u,"data-tooltip-wrapper":d,"data-tooltip-events":p,"data-tooltip-position-strategy":f,"data-tooltip-delay-show":v,"data-tooltip-delay-hide":m},o)},e.removeStyle=function({type:e="base",id:t=a}={}){if(!i[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`),i[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,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t),s=n(r);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:r}){var n,l;if(!e||"undefined"==typeof document||a[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=c),r||(r={});const{insertAt:s}=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"===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=(e,t,o)=>{let r=null;return function(...n){const l=()=>{r=null,o||e.apply(this,n)};o&&!r&&(e.apply(this,n),r=setTimeout(l,t)),o||(r&&clearTimeout(r),r=setTimeout(l,t))}},p="DEFAULT_TOOLTIP_ID",f={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},v={getTooltipData:()=>f},m=t.createContext(v);function y(e=p){return t.useContext(m).getTooltipData(e)}const h="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,w=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}))},S=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(w(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},E=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:n="top",offset:l=10,strategy:s="absolute",middlewares:c=[o.offset(Number(l)),o.flip(),o.shift({padding:5})],border:i})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:n};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:n};const a=c;return r?(a.push(o.arrow({element:r,padding:5})),o.computePosition(e,t,{placement:n,strategy:s,middleware:a}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var n,l;const s={left:`${e}px`,top:`${t}px`,border:i},{x:c,y:a}=null!==(n=r.arrow)&&void 0!==n?n:{x:0,y:0},u=null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==l?l:"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})))};var b="core-styles-module_tooltip__3vRRp",g="core-styles-module_fixed__pcSol",_="core-styles-module_arrow__cvMwQ",A="core-styles-module_noArrow__xock6",T="core-styles-module_clickable__ZuTTB",R="core-styles-module_show__Nt9eE",O={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const L=({id:e,className:r,classNameArrow:n,variant:c="dark",anchorId:i,anchorSelect:a,place:u="top",offset:p=10,events:f=["hover"],openOnClick:v=!1,positionStrategy:m="absolute",middlewares:w,wrapper:L,delayShow:C=0,delayHide:x=0,float:k=!1,hidden:N=!1,noArrow:$=!1,clickable:I=!1,closeOnEsc:j=!1,closeOnScroll:B=!1,closeOnResize:D=!1,style:q,position:P,afterShow:H,afterHide:M,content:z,contentWrapperRef:W,isOpen:U,holdPositionOnRender:F,setIsOpen:K,activeAnchor:X,setActiveAnchor:Y,border:V,opacity:Z,arrowColor:G})=>{const J=t.useRef(null),Q=t.useRef(null),ee=t.useRef(null),te=t.useRef(null),[oe,re]=t.useState(u),[ne,le]=t.useState({}),[se,ce]=t.useState({}),[ie,ae]=t.useState(!1),[ue,de]=t.useState(!1),pe=t.useRef(!1),fe=t.useRef(null),{anchorRefs:ve,setActiveAnchor:me}=y(e),ye=t.useRef(!1),[he,we]=t.useState([]),Se=t.useRef(!1),Ee=v||f.includes("click");h((()=>(Se.current=!0,()=>{Se.current=!1})),[]),t.useEffect((()=>{if(!ie){const e=setTimeout((()=>{de(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ie]);const be=e=>{Se.current&&(e&&de(!0),setTimeout((()=>{Se.current&&(null==K||K(e),void 0===U&&ae(e))}),10))};t.useEffect((()=>{if(void 0===U)return()=>null;U&&de(!0);const e=setTimeout((()=>{ae(U)}),10);return()=>{clearTimeout(e)}}),[U]),t.useEffect((()=>{ie!==pe.current&&(pe.current=ie,ie?null==H||H():null==M||M())}),[ie]);const ge=(e=x)=>{te.current&&clearTimeout(te.current),te.current=setTimeout((()=>{ye.current||be(!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 Y(null),void me({current:null});C?(ee.current&&clearTimeout(ee.current),ee.current=setTimeout((()=>{be(!0)}),C)):be(!0),Y(o),me({current:o}),te.current&&clearTimeout(te.current)},Ae=()=>{I?ge(x||100):x?ge():be(!1),ee.current&&clearTimeout(ee.current)},Te=({x:e,y:t})=>{E({place:u,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:J.current,tooltipArrowReference:Q.current,strategy:m,middlewares:w,border:V}).then((e=>{Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ce(e.tooltipArrowStyles),re(e.place)}))},Re=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};Te(o),fe.current=o},Oe=e=>{_e(e),x&&ge()},Le=e=>{var t;[document.querySelector(`[id='${i}']`),...he].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=J.current)||void 0===t?void 0:t.contains(e.target))||(be(!1),ee.current&&clearTimeout(ee.current))},Ce=d(_e,50,!0),xe=d(Ae,50,!0),ke=t.useCallback((()=>{P?Te(P):k?fe.current&&Te(fe.current):(null==X?void 0:X.isConnected)&&E({place:u,offset:p,elementReference:X,tooltipReference:J.current,tooltipArrowReference:Q.current,strategy:m,middlewares:w,border:V}).then((e=>{Se.current&&(Object.keys(e.tooltipStyles).length&&le(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&ce(e.tooltipArrowStyles),re(e.place))}))}),[ie,X,z,q,u,p,m,P,k]);t.useEffect((()=>{var e,t;const r=new Set(ve);he.forEach((e=>{r.add({current:e})}));const n=document.querySelector(`[id='${i}']`);n&&r.add({current:n});const l=()=>{be(!1)},s=S(X),c=S(J.current);B&&(window.addEventListener("scroll",l),null==s||s.addEventListener("scroll",l),null==c||c.addEventListener("scroll",l));let a=null;D?window.addEventListener("resize",l):X&&J.current&&!F&&(a=o.autoUpdate(X,J.current,ke,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const u=e=>{"Escape"===e.key&&be(!1)};j&&window.addEventListener("keydown",u);const d=[];Ee?(window.addEventListener("click",Le),d.push({event:"click",listener:Oe})):(d.push({event:"mouseenter",listener:Ce},{event:"mouseleave",listener:xe},{event:"focus",listener:Ce},{event:"blur",listener:xe}),k&&d.push({event:"mousemove",listener:Re}));const p=()=>{ye.current=!0},f=()=>{ye.current=!1,Ae()};return I&&!Ee&&(null===(e=J.current)||void 0===e||e.addEventListener("mouseenter",p),null===(t=J.current)||void 0===t||t.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;B&&(window.removeEventListener("scroll",l),null==s||s.removeEventListener("scroll",l),null==c||c.removeEventListener("scroll",l)),D?window.removeEventListener("resize",l):null==a||a(),Ee&&window.removeEventListener("click",Le),j&&window.removeEventListener("keydown",u),I&&!Ee&&(null===(e=J.current)||void 0===e||e.removeEventListener("mouseenter",p),null===(t=J.current)||void 0===t||t.removeEventListener("mouseleave",f)),d.forEach((({event:e,listener:t})=>{r.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t)}))}))}}),[X,ke,ue,ve,he,j,f]),t.useEffect((()=>{let t=null!=a?a:"";!t&&e&&(t=`[data-tooltip-id='${e}']`);const o=new MutationObserver((o=>{const r=[],n=[];o.forEach((o=>{if("attributes"===o.type&&"data-tooltip-id"===o.attributeName){o.target.getAttribute("data-tooltip-id")===e&&r.push(o.target)}if("childList"===o.type){if(X){const e=[...o.removedNodes].filter((e=>1===e.nodeType));t&&(n.push(...e.filter((e=>e.matches(t)))),n.push(...e.flatMap((e=>[...e.querySelectorAll(t)])))),e.some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,X))&&(de(!1),be(!1),Y(null),ee.current&&clearTimeout(ee.current),te.current&&clearTimeout(te.current),!0)}))}if(t)try{const e=[...o.addedNodes].filter((e=>1===e.nodeType));r.push(...e.filter((e=>e.matches(t)))),r.push(...e.flatMap((e=>[...e.querySelectorAll(t)])))}catch(e){}}})),r.length&&we((e=>[...e.filter((e=>n.includes(e))),...r]))}));return o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{o.disconnect()}}),[e,a,X]),t.useEffect((()=>{ke()}),[ke]),t.useEffect((()=>{if(!(null==W?void 0:W.current))return()=>null;const e=new ResizeObserver((()=>{ke()}));return e.observe(W.current),()=>{e.disconnect()}}),[z,null==W?void 0:W.current]),t.useEffect((()=>{var e;const t=document.querySelector(`[id='${i}']`),o=[...he,t];X&&o.includes(X)||Y(null!==(e=he[0])&&void 0!==e?e:t)}),[i,he,X]),t.useEffect((()=>()=>{ee.current&&clearTimeout(ee.current),te.current&&clearTimeout(te.current)}),[]),t.useEffect((()=>{let t=a;if(!t&&e&&(t=`[data-tooltip-id='${e}']`),t)try{const e=Array.from(document.querySelectorAll(t));we(e)}catch(e){we([])}}),[e,a]);const Ne=!N&&z&&ie&&Object.keys(ne).length>0;return ue||pe.current&&F?l.default.createElement(L,{id:e,role:"tooltip",className:s.default("react-tooltip",b,O.tooltip,O[c],r,`react-tooltip__place-${oe}`,{"react-tooltip__show":Ne,[R]:Ne,[g]:"fixed"===m,[T]:I}),style:{...q,...ne,opacity:void 0!==Z&&Ne?Z:void 0},ref:J},z,l.default.createElement(L,{className:s.default("react-tooltip-arrow",_,O.arrow,n,{[A]:$}),style:{...se,background:G?`linear-gradient(to right bottom, transparent 50%, ${G} 50%)`:void 0},ref:Q})):null},C=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});"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}.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||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=({id:e,anchorId:o,anchorSelect:r,content:n,html:s,render:c,className:i,classNameArrow:a,variant:u="dark",place:d="top",offset:p=10,wrapper:f="div",children:v=null,events:m=["hover"],openOnClick:h=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:b=0,float:g=!1,hidden:_=!1,noArrow:A=!1,clickable:T=!1,closeOnEsc:R=!1,closeOnScroll:O=!1,closeOnResize:x=!1,style:k,position:N,isOpen:$,disableStyleInjection:I=!1,holdPositionOnRender:j,border:B,opacity:D,arrowColor:q,setIsOpen:P,afterShow:H,afterHide:M})=>{const[z,W]=t.useState(n),[U,F]=t.useState(s),[K,X]=t.useState(d),[Y,V]=t.useState(u),[Z,G]=t.useState(p),[J,Q]=t.useState(E),[ee,te]=t.useState(b),[oe,re]=t.useState(g),[ne,le]=t.useState(_),[se,ce]=t.useState(f),[ie,ae]=t.useState(m),[ue,de]=t.useState(w),[pe,fe]=t.useState(null),ve=t.useRef(I),{anchorRefs:me,activeAnchor:ye}=y(e),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:s)},variant:e=>{var t;V(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{G(null===e?p:Number(e))},wrapper:e=>{var t;ce(null!==(t=e)&&void 0!==t?t:f)},events:e=>{const t=null==e?void 0:e.split(" ");ae(null!=t?t:m)},"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?g:"true"===e)},hidden:e=>{le(null===e?_:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o)}))};t.useEffect((()=>{W(n)}),[n]),t.useEffect((()=>{F(s)}),[s]),t.useEffect((()=>{X(d)}),[d]),t.useEffect((()=>{V(u)}),[u]),t.useEffect((()=>{G(p)}),[p]),t.useEffect((()=>{Q(E)}),[E]),t.useEffect((()=>{te(b)}),[b]),t.useEffect((()=>{re(g)}),[g]),t.useEffect((()=>{le(_)}),[_]),t.useEffect((()=>{de(w)}),[w]),t.useEffect((()=>{ve.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),t.useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===I,disableBase:I}}))}),[]),t.useEffect((()=>{var t;const n=new Set(me);let l=r;if(!l&&e&&(l=`[data-tooltip-id='${e}']`),l)try{document.querySelectorAll(l).forEach((e=>{n.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`)}const s=document.querySelector(`[id='${o}']`);if(s&&n.add({current:s}),!n.size)return()=>null;const c=null!==(t=null!=pe?pe:s)&&void 0!==t?t:ye.current,i=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=he(c);we(o)}))})),a={attributes:!0,childList:!1,subtree:!1};if(c){const e=he(c);we(e),i.observe(c,a)}return()=>{i.disconnect()}}),[me,ye,pe,o,r]),t.useEffect((()=>{(null==k?void 0:k.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),B&&!CSS.supports("border",`${B}`)&&console.warn(`[react-tooltip] "${B}" is not a valid \`border\`.`),(null==k?void 0:k.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),D&&!CSS.supports("opacity",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`opacity\`.`)}),[]);let Se=v;const Ee=t.useRef(null);if(c){const e=c({content:null!=z?z:null,activeAnchor:pe});Se=e?l.default.createElement("div",{ref:Ee,className:"react-tooltip-content-wrapper"},e):null}else z&&(Se=z);U&&(Se=l.default.createElement(C,{content:U}));const be={id:e,anchorId:o,anchorSelect:r,className:i,classNameArrow:a,content:Se,contentWrapperRef:Ee,place:K,variant:Y,offset:Z,wrapper:se,events:ie,openOnClick:h,positionStrategy:ue,middlewares:S,delayShow:J,delayHide:ee,float:oe,hidden:ne,noArrow:A,clickable:T,closeOnEsc:R,closeOnScroll:O,closeOnResize:x,style:k,position:N,isOpen:$,holdPositionOnRender:j,border:B,opacity:D,arrowColor:q,setIsOpen:P,afterShow:H,afterHide:M,activeAnchor:pe,setActiveAnchor:e=>fe(e)};return l.default.createElement(L,{...be})},e.TooltipProvider=({children:e})=>{const[o,r]=t.useState({[p]:new Set}),[n,s]=t.useState({[p]:{current:null}}),c=(e,...t)=>{r((o=>{var r;const n=null!==(r=o[e])&&void 0!==r?r:new Set;return t.forEach((e=>n.add(e))),{...o,[e]:new Set(n)}}))},i=(e,...t)=>{r((o=>{const r=o[e];return r?(t.forEach((e=>r.delete(e))),{...o}):o}))},a=t.useCallback(((e=p)=>{var t,r;return{anchorRefs:null!==(t=o[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=n[e])&&void 0!==r?r:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{s((o=>{var r;return(null===(r=o[e])||void 0===r?void 0:r.current)===t.current?o:{...o,[e]:t}}))})(e,t)}}),[o,n,c,i]),u=t.useMemo((()=>({getTooltipData:a})),[a]);return l.default.createElement(m.Provider,{value:u},e)},e.TooltipWrapper=({tooltipId:e,children:o,className:r,place:n,content:c,html:i,variant:a,offset:u,wrapper:d,events:p,positionStrategy:f,delayShow:v,delayHide:m})=>{const{attach:h,detach:w}=y(e),S=t.useRef(null);return t.useEffect((()=>(h(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:s.default("react-tooltip-wrapper",r),"data-tooltip-place":n,"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})})); |
{ | ||
"name": "react-tooltip", | ||
"version": "5.21.3", | ||
"version": "5.22.0-beta.1091.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 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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
720941
4514
1
3