react-tooltip 5.13.2 → 5.15.0-beta.1041.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-tooltip.cjs +153 -39
- package/dist/react-tooltip.cjs.map +1 -1
- package/dist/react-tooltip.css +14 -9
- package/dist/react-tooltip.d.ts +15 -2
- package/dist/react-tooltip.min.cjs +2 -2
- package/dist/react-tooltip.min.cjs.map +1 -1
- package/dist/react-tooltip.min.css +1 -1
- package/dist/react-tooltip.min.mjs +2 -2
- package/dist/react-tooltip.min.mjs.map +1 -1
- package/dist/react-tooltip.mjs +153 -40
- package/dist/react-tooltip.mjs.map +1 -1
- package/dist/react-tooltip.umd.js +1043 -929
- 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
- package/esbuild.config.dev.mjs +0 -30
- package/esbuild.config.prod.mjs +0 -99
- package/jest.config.ts +0 -214
- package/prebuild.js +0 -33
package/dist/react-tooltip.css
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--rt-opacity: 0.9;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.styles-
|
|
11
|
+
.core-styles-module_tooltip__3vRRp {
|
|
12
12
|
visibility: hidden;
|
|
13
13
|
width: max-content;
|
|
14
14
|
position: absolute;
|
|
@@ -23,31 +23,36 @@
|
|
|
23
23
|
will-change: opacity, visibility;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.styles-
|
|
26
|
+
.core-styles-module_fixed__pcSol {
|
|
27
27
|
position: fixed;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.styles-
|
|
30
|
+
.core-styles-module_arrow__cvMwQ {
|
|
31
31
|
position: absolute;
|
|
32
32
|
background: inherit;
|
|
33
|
-
width: 8px;
|
|
34
|
-
height: 8px;
|
|
35
|
-
transform: rotate(45deg);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
.styles-
|
|
35
|
+
.core-styles-module_noArrow__xock6 {
|
|
39
36
|
display: none;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
.styles-
|
|
39
|
+
.core-styles-module_clickable__ZuTTB {
|
|
43
40
|
pointer-events: auto;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
.styles-
|
|
43
|
+
.core-styles-module_show__Nt9eE {
|
|
47
44
|
visibility: visible;
|
|
48
45
|
opacity: var(--rt-opacity);
|
|
49
46
|
}
|
|
50
47
|
|
|
48
|
+
/** end - core styles **/
|
|
49
|
+
|
|
50
|
+
.styles-module_arrow__K0L3T {
|
|
51
|
+
width: 8px;
|
|
52
|
+
height: 8px;
|
|
53
|
+
transform: rotate(45deg);
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
/** Types variant **/
|
|
52
57
|
.styles-module_dark__xNqje {
|
|
53
58
|
background: var(--rt-color-dark);
|
package/dist/react-tooltip.d.ts
CHANGED
|
@@ -71,7 +71,18 @@ interface ITooltipController {
|
|
|
71
71
|
hidden?: boolean
|
|
72
72
|
noArrow?: boolean
|
|
73
73
|
clickable?: boolean
|
|
74
|
+
/**
|
|
75
|
+
* @todo refactor to `hideOnEsc` for naming consistency
|
|
76
|
+
*/
|
|
74
77
|
closeOnEsc?: boolean
|
|
78
|
+
/**
|
|
79
|
+
* @todo refactor to `hideOnScroll` for naming consistency
|
|
80
|
+
*/
|
|
81
|
+
closeOnScroll?: boolean
|
|
82
|
+
/**
|
|
83
|
+
* @todo refactor to `hideOnResize` for naming consistency
|
|
84
|
+
*/
|
|
85
|
+
closeOnResize?: boolean
|
|
75
86
|
style?: CSSProperties
|
|
76
87
|
position?: IPosition
|
|
77
88
|
isOpen?: boolean
|
|
@@ -122,7 +133,7 @@ interface ITooltipWrapper {
|
|
|
122
133
|
delayHide?: ITooltipController['delayHide']
|
|
123
134
|
}
|
|
124
135
|
|
|
125
|
-
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, style, position, isOpen, setIsOpen, afterShow, afterHide, }: ITooltipController) => JSX.Element;
|
|
136
|
+
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, setIsOpen, afterShow, afterHide, }: ITooltipController) => JSX.Element;
|
|
126
137
|
|
|
127
138
|
/**
|
|
128
139
|
* @deprecated Use the `data-tooltip-id` attribute, or the `anchorSelect` prop instead.
|
|
@@ -136,4 +147,6 @@ declare const TooltipProvider: React.FC<PropsWithChildren<void>>;
|
|
|
136
147
|
*/
|
|
137
148
|
declare const TooltipWrapper: ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }: ITooltipWrapper) => JSX.Element;
|
|
138
149
|
|
|
139
|
-
|
|
150
|
+
declare function removeStyle(id?: string): void;
|
|
151
|
+
|
|
152
|
+
export { ChildrenType, DataAttribute, EventsType, IPosition, ITooltipController as ITooltip, ITooltipWrapper, Middleware, PlacesType, PositionStrategy, TooltipController as Tooltip, TooltipProvider, TooltipWrapper, VariantType, WrapperType, removeStyle };
|
|
@@ -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("classnames"),r=require("@floating-ui/dom");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e),n=o(t);function a(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===r&&o.firstChild?o.insertBefore(l,o.firstChild):o.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}a(":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}");const c=(e,t,r)=>{let o=null;return function(...l){const n=()=>{o=null,r||e.apply(this,l)};r&&!o&&(e.apply(this,l),o=setTimeout(n,t)),r||(o&&clearTimeout(o),o=setTimeout(n,t))}},s="DEFAULT_TOOLTIP_ID",i={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},u={getTooltipData:()=>i},d=e.createContext(u);function f(t=s){return e.useContext(d).getTooltipData(t)}const p="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,v=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:l="top",offset:n=10,strategy:a="absolute",middlewares:c=[r.offset(Number(n)),r.flip(),r.shift({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const s=c;return o?(s.push(r.arrow({element:o,padding:5})),r.computePosition(e,t,{placement:l,strategy:a,middleware:s}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const a={left:`${e}px`,top:`${t}px`},{x:c,y:s}=null!==(l=o.arrow)&&void 0!==l?l:{x:0,y:0};return{tooltipStyles:a,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=s?`${s}px`:"",right:"",bottom:"",[null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==n?n:"bottom"]:"-4px"},place:r}}))):r.computePosition(e,t,{placement:"bottom",strategy:a,middleware:s}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var m={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T",noArrow:"styles-module_noArrow__T8y2L",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",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"};a(".styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.styles-module_fixed__7ciUi{position:fixed}.styles-module_arrow__K0L3T{background:inherit;height:8px;position:absolute;transform:rotate(45deg);width:8px}.styles-module_noArrow__T8y2L{display:none}.styles-module_clickable__Bv9o7{pointer-events:auto}.styles-module_show__2NboJ{opacity:var(--rt-opacity);visibility:visible}.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)}");const h=({id:t,className:r,classNameArrow:o,variant:a="dark",anchorId:s,anchorSelect:i,place:u="top",offset:d=10,events:h=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:_,wrapper:S,delayShow:b=0,delayHide:g=0,float:E=!1,hidden:A=!1,noArrow:k=!1,clickable:x=!1,closeOnEsc:T=!1,style:R,position:N,afterShow:O,afterHide:L,content:C,contentWrapperRef:$,isOpen:q,setIsOpen:j,activeAnchor:W,setActiveAnchor:H})=>{const I=e.useRef(null),D=e.useRef(null),B=e.useRef(null),K=e.useRef(null),[M,P]=e.useState(u),[X,J]=e.useState({}),[z,U]=e.useState({}),[F,Z]=e.useState(!1),[Y,G]=e.useState(!1),Q=e.useRef(!1),V=e.useRef(null),{anchorRefs:ee,setActiveAnchor:te}=f(t),re=e.useRef(!1),[oe,le]=e.useState([]),ne=e.useRef(!1),ae=y||h.includes("click");p((()=>(ne.current=!0,()=>{ne.current=!1})),[]),e.useEffect((()=>{if(!F){const e=setTimeout((()=>{G(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[F]);const ce=e=>{ne.current&&(e&&G(!0),setTimeout((()=>{ne.current&&(null==j||j(e),void 0===q&&Z(e))}),10))};e.useEffect((()=>{if(void 0===q)return()=>null;q&&G(!0);const e=setTimeout((()=>{Z(q)}),10);return()=>{clearTimeout(e)}}),[q]),e.useEffect((()=>{F!==Q.current&&(Q.current=F,F?null==O||O():null==L||L())}),[F]);const se=(e=g)=>{K.current&&clearTimeout(K.current),K.current=setTimeout((()=>{re.current||ce(!1)}),e)},ie=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return H(null),void te({current:null});b?(B.current&&clearTimeout(B.current),B.current=setTimeout((()=>{ce(!0)}),b)):ce(!0),H(r),te({current:r}),K.current&&clearTimeout(K.current)},ue=()=>{x?se(g||100):g?se():ce(!1),B.current&&clearTimeout(B.current)},de=({x:e,y:t})=>{v({place:u,offset:d,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:I.current,tooltipArrowReference:D.current,strategy:w,middlewares:_}).then((e=>{Object.keys(e.tooltipStyles).length&&J(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&U(e.tooltipArrowStyles),P(e.place)}))},fe=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};de(r),V.current=r},pe=e=>{ie(e),g&&se()},ve=e=>{var t;[document.querySelector(`[id='${s}']`),...oe].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=I.current)||void 0===t?void 0:t.contains(e.target))||ce(!1)},me=e=>{"Escape"===e.key&&ce(!1)},he=c(ie,50,!0),ye=c(ue,50,!0);e.useEffect((()=>{var e,t;const r=new Set(ee);oe.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${s}']`);o&&r.add({current:o}),T&&window.addEventListener("keydown",me);const l=[];ae?(window.addEventListener("click",ve),l.push({event:"click",listener:pe})):(l.push({event:"mouseenter",listener:he},{event:"mouseleave",listener:ye},{event:"focus",listener:he},{event:"blur",listener:ye}),E&&l.push({event:"mousemove",listener:fe}));const n=()=>{re.current=!0},a=()=>{re.current=!1,ue()};return x&&!ae&&(null===(e=I.current)||void 0===e||e.addEventListener("mouseenter",n),null===(t=I.current)||void 0===t||t.addEventListener("mouseleave",a)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;ae&&window.removeEventListener("click",ve),T&&window.removeEventListener("keydown",me),x&&!ae&&(null===(e=I.current)||void 0===e||e.removeEventListener("mouseenter",n),null===(t=I.current)||void 0===t||t.removeEventListener("mouseleave",a)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[Y,ee,oe,T,h]),e.useEffect((()=>{let e=null!=i?i:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type&&(W&&[...r.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,W))&&(G(!1),ce(!1),H(null),!0)})),e))try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&le((e=>[...e,...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,i,W]);const we=()=>{N?de(N):E?V.current&&de(V.current):v({place:u,offset:d,elementReference:W,tooltipReference:I.current,tooltipArrowReference:D.current,strategy:w,middlewares:_}).then((e=>{ne.current&&(Object.keys(e.tooltipStyles).length&&J(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&U(e.tooltipArrowStyles),P(e.place))}))};e.useEffect((()=>{we()}),[F,W,C,R,u,d,w,N]),e.useEffect((()=>{if(!(null==$?void 0:$.current))return()=>null;const e=new ResizeObserver((()=>{we()}));return e.observe($.current),()=>{e.disconnect()}}),[C,null==$?void 0:$.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${s}']`),r=[...oe,t];W&&r.includes(W)||H(null!==(e=oe[0])&&void 0!==e?e:t)}),[s,oe,W]),e.useEffect((()=>()=>{B.current&&clearTimeout(B.current),K.current&&clearTimeout(K.current)}),[]),e.useEffect((()=>{let e=i;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));le(t)}catch(e){le([])}}),[t,i]);const _e=!A&&C&&F&&Object.keys(X).length>0;return Y?l.default.createElement(S,{id:t,role:"tooltip",className:n.default("react-tooltip",m.tooltip,m[a],r,`react-tooltip__place-${M}`,{[m.show]:_e,[m.fixed]:"fixed"===w,[m.clickable]:x}),style:{...R,...X},ref:I},C,l.default.createElement(S,{className:n.default("react-tooltip-arrow",m.arrow,o,{[m.noArrow]:k}),style:z,ref:D})):null},y=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});exports.Tooltip=({id:t,anchorId:r,anchorSelect:o,content:n,html:a,render:c,className:s,classNameArrow:i,variant:u="dark",place:d="top",offset:p=10,wrapper:v="div",children:m=null,events:w=["hover"],openOnClick:_=!1,positionStrategy:S="absolute",middlewares:b,delayShow:g=0,delayHide:E=0,float:A=!1,hidden:k=!1,noArrow:x=!1,clickable:T=!1,closeOnEsc:R=!1,style:N,position:O,isOpen:L,setIsOpen:C,afterShow:$,afterHide:q})=>{const[j,W]=e.useState(n),[H,I]=e.useState(a),[D,B]=e.useState(d),[K,M]=e.useState(u),[P,X]=e.useState(p),[J,z]=e.useState(g),[U,F]=e.useState(E),[Z,Y]=e.useState(A),[G,Q]=e.useState(k),[V,ee]=e.useState(v),[te,re]=e.useState(w),[oe,le]=e.useState(S),[ne,ae]=e.useState(null),{anchorRefs:ce,activeAnchor:se}=f(t),ie=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),ue=e=>{const t={place:e=>{var t;B(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:n)},html:e=>{I(null!=e?e:a)},variant:e=>{var t;M(null!==(t=e)&&void 0!==t?t:u)},offset:e=>{X(null===e?p:Number(e))},wrapper:e=>{var t;ee(null!==(t=e)&&void 0!==t?t:v)},events:e=>{const t=null==e?void 0:e.split(" ");re(null!=t?t:w)},"position-strategy":e=>{var t;le(null!==(t=e)&&void 0!==t?t:S)},"delay-show":e=>{z(null===e?g:Number(e))},"delay-hide":e=>{F(null===e?E:Number(e))},float:e=>{Y(null===e?A:"true"===e)},hidden:e=>{Q(null===e?k:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};e.useEffect((()=>{W(n)}),[n]),e.useEffect((()=>{I(a)}),[a]),e.useEffect((()=>{B(d)}),[d]),e.useEffect((()=>{M(u)}),[u]),e.useEffect((()=>{X(p)}),[p]),e.useEffect((()=>{z(g)}),[g]),e.useEffect((()=>{F(E)}),[E]),e.useEffect((()=>{Y(A)}),[A]),e.useEffect((()=>{Q(k)}),[k]),e.useEffect((()=>{le(S)}),[S]),e.useEffect((()=>{var e;const l=new Set(ce);let n=o;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),n)try{document.querySelectorAll(n).forEach((e=>{l.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const a=document.querySelector(`[id='${r}']`);if(a&&l.add({current:a}),!l.size)return()=>null;const c=null!==(e=null!=ne?ne:a)&&void 0!==e?e:se.current,s=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const r=ie(c);ue(r)}))})),i={attributes:!0,childList:!1,subtree:!1};if(c){const e=ie(c);ue(e),s.observe(c,i)}return()=>{s.disconnect()}}),[ce,se,ne,r,o]);let de=m;const fe=e.useRef(null);if(c){const e=c({content:null!=j?j:null,activeAnchor:ne});de=e?l.default.createElement("div",{ref:fe,className:"react-tooltip-content-wrapper"},e):null}else j&&(de=j);H&&(de=l.default.createElement(y,{content:H}));const pe={id:t,anchorId:r,anchorSelect:o,className:s,classNameArrow:i,content:de,contentWrapperRef:fe,place:D,variant:K,offset:P,wrapper:V,events:te,openOnClick:_,positionStrategy:oe,middlewares:b,delayShow:J,delayHide:U,float:Z,hidden:G,noArrow:x,clickable:T,closeOnEsc:R,style:N,position:O,isOpen:L,setIsOpen:C,afterShow:$,afterHide:q,activeAnchor:ne,setActiveAnchor:e=>ae(e)};return l.default.createElement(h,{...pe})},exports.TooltipProvider=({children:t})=>{const[r,o]=e.useState({[s]:new Set}),[n,a]=e.useState({[s]:{current:null}}),c=(e,...t)=>{o((r=>{var o;const l=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>l.add(e))),{...r,[e]:new Set(l)}}))},i=(e,...t)=>{o((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},u=e.useCallback(((e=s)=>{var t,o;return{anchorRefs:null!==(t=r[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=n[e])&&void 0!==o?o:{current:null},attach:(...t)=>c(e,...t),detach:(...t)=>i(e,...t),setActiveAnchor:t=>((e,t)=>{a((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[r,n,c,i]),f=e.useMemo((()=>({getTooltipData:u})),[u]);return l.default.createElement(d.Provider,{value:f},t)},exports.TooltipWrapper=({tooltipId:t,children:r,className:o,place:a,content:c,html:s,variant:i,offset:u,wrapper:d,events:p,positionStrategy:v,delayShow:m,delayHide:h})=>{const{attach:y,detach:w}=f(t),_=e.useRef(null);return e.useEffect((()=>(y(_),()=>{w(_)})),[]),l.default.createElement("span",{ref:_,className:n.default("react-tooltip-wrapper",o),"data-tooltip-place":a,"data-tooltip-content":c,"data-tooltip-html":s,"data-tooltip-variant":i,"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":h},r)};
|
|
8
|
-
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("classnames"),r=require("@floating-ui/dom");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e),n=o(t);const c="react-tooltip-styles";function s(e,t=c,r){r||(r={});const{insertAt:o}=r;if(!e||"undefined"==typeof document||document.getElementById(c))return;const l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id=t,n.type="text/css","top"===o&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const a=(e,t,r)=>{let o=null;return function(...l){const n=()=>{o=null,r||e.apply(this,l)};r&&!o&&(e.apply(this,l),o=setTimeout(n,t)),r||(o&&clearTimeout(o),o=setTimeout(n,t))}},u="DEFAULT_TOOLTIP_ID",i={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},d={getTooltipData:()=>i},f=e.createContext(d);function p(t=u){return e.useContext(f).getTooltipData(t)}const v="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,m=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:l="top",offset:n=10,strategy:c="absolute",middlewares:s=[r.offset(Number(n)),r.flip(),r.shift({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:l};const a=s;return o?(a.push(r.arrow({element:o,padding:5})),r.computePosition(e,t,{placement:l,strategy:c,middleware:a}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const c={left:`${e}px`,top:`${t}px`},{x:s,y:a}=null!==(l=o.arrow)&&void 0!==l?l:{x:0,y:0};return{tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==n?n:"bottom"]:"-4px"},place:r}}))):r.computePosition(e,t,{placement:"bottom",strategy:c,middleware:a}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var h="core-styles-module_tooltip__3vRRp",y="core-styles-module_fixed__pcSol",w="core-styles-module_arrow__cvMwQ",S="core-styles-module_noArrow__xock6",E="core-styles-module_clickable__ZuTTB",g="core-styles-module_show__Nt9eE",b={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 _=({id:t,className:r,classNameArrow:o,variant:c="dark",anchorId:s,anchorSelect:u,place:i="top",offset:d=10,events:f=["hover"],openOnClick:_=!1,positionStrategy:A="absolute",middlewares:T,wrapper:R,delayShow:O=0,delayHide:x=0,float:k=!1,hidden:N=!1,noArrow:L=!1,clickable:$=!1,closeOnEsc:C=!1,closeOnScroll:I=!1,closeOnResize:q=!1,style:j,position:H,afterShow:W,afterHide:z,content:B,contentWrapperRef:D,isOpen:M,setIsOpen:P,activeAnchor:K,setActiveAnchor:X})=>{const F=e.useRef(null),Z=e.useRef(null),J=e.useRef(null),Q=e.useRef(null),[U,Y]=e.useState(i),[G,V]=e.useState({}),[ee,te]=e.useState({}),[re,oe]=e.useState(!1),[le,ne]=e.useState(!1),ce=e.useRef(!1),se=e.useRef(null),{anchorRefs:ae,setActiveAnchor:ue}=p(t),ie=e.useRef(!1),[de,fe]=e.useState([]),pe=e.useRef(!1),ve=_||f.includes("click");v((()=>(pe.current=!0,()=>{pe.current=!1})),[]),e.useEffect((()=>{if(!re){const e=setTimeout((()=>{ne(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[re]);const me=e=>{pe.current&&(e&&ne(!0),setTimeout((()=>{pe.current&&(null==P||P(e),void 0===M&&oe(e))}),10))};e.useEffect((()=>{if(void 0===M)return()=>null;M&&ne(!0);const e=setTimeout((()=>{oe(M)}),10);return()=>{clearTimeout(e)}}),[M]),e.useEffect((()=>{re!==ce.current&&(ce.current=re,re?null==W||W():null==z||z())}),[re]);const he=(e=x)=>{Q.current&&clearTimeout(Q.current),Q.current=setTimeout((()=>{ie.current||me(!1)}),e)},ye=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return X(null),void ue({current:null});O?(J.current&&clearTimeout(J.current),J.current=setTimeout((()=>{me(!0)}),O)):me(!0),X(r),ue({current:r}),Q.current&&clearTimeout(Q.current)},we=()=>{$?he(x||100):x?he():me(!1),J.current&&clearTimeout(J.current)},Se=({x:e,y:t})=>{m({place:i,offset:d,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:F.current,tooltipArrowReference:Z.current,strategy:A,middlewares:T}).then((e=>{Object.keys(e.tooltipStyles).length&&V(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&te(e.tooltipArrowStyles),Y(e.place)}))},Ee=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Se(r),se.current=r},ge=e=>{ye(e),x&&he()},be=e=>{var t;[document.querySelector(`[id='${s}']`),...de].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=F.current)||void 0===t?void 0:t.contains(e.target))||me(!1)},_e=e=>{"Escape"===e.key&&me(!1)},Ae=a(ye,50,!0),Te=a(we,50,!0);e.useEffect((()=>{var e,t;const r=new Set(ae);de.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${s}']`);o&&r.add({current:o}),I&&window.addEventListener("scroll",Te),q&&window.addEventListener("resize",Te),C&&window.addEventListener("keydown",_e);const l=[];ve?(window.addEventListener("click",be),l.push({event:"click",listener:ge})):(l.push({event:"mouseenter",listener:Ae},{event:"mouseleave",listener:Te},{event:"focus",listener:Ae},{event:"blur",listener:Te}),k&&l.push({event:"mousemove",listener:Ee}));const n=()=>{ie.current=!0},c=()=>{ie.current=!1,we()};return $&&!ve&&(null===(e=F.current)||void 0===e||e.addEventListener("mouseenter",n),null===(t=F.current)||void 0===t||t.addEventListener("mouseleave",c)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;I&&window.removeEventListener("scroll",Te),q&&window.removeEventListener("resize",Te),ve&&window.removeEventListener("click",be),C&&window.removeEventListener("keydown",_e),$&&!ve&&(null===(e=F.current)||void 0===e||e.removeEventListener("mouseenter",n),null===(t=F.current)||void 0===t||t.removeEventListener("mouseleave",c)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[le,ae,de,C,f]),e.useEffect((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type&&(K&&[...r.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,K))&&(ne(!1),me(!1),X(null),!0)})),e))try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&fe((e=>[...e,...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,u,K]);const Re=()=>{H?Se(H):k?se.current&&Se(se.current):m({place:i,offset:d,elementReference:K,tooltipReference:F.current,tooltipArrowReference:Z.current,strategy:A,middlewares:T}).then((e=>{pe.current&&(Object.keys(e.tooltipStyles).length&&V(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&te(e.tooltipArrowStyles),Y(e.place))}))};e.useEffect((()=>{Re()}),[re,K,B,j,i,d,A,H]),e.useEffect((()=>{if(!(null==D?void 0:D.current))return()=>null;const e=new ResizeObserver((()=>{Re()}));return e.observe(D.current),()=>{e.disconnect()}}),[B,null==D?void 0:D.current]),e.useEffect((()=>{var e;const t=document.querySelector(`[id='${s}']`),r=[...de,t];K&&r.includes(K)||X(null!==(e=de[0])&&void 0!==e?e:t)}),[s,de,K]),e.useEffect((()=>()=>{J.current&&clearTimeout(J.current),Q.current&&clearTimeout(Q.current)}),[]),e.useEffect((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));fe(t)}catch(e){fe([])}}),[t,u]);const Oe=!N&&B&&re&&Object.keys(G).length>0;return le?l.default.createElement(R,{id:t,role:"tooltip",className:n.default("react-tooltip",h,b[c],r,`react-tooltip__place-${U}`,{[g]:Oe,[y]:"fixed"===A,[E]:$}),style:{...j,...G},ref:F},B,l.default.createElement(R,{className:n.default("react-tooltip-arrow",w,b.arrow,o,{[S]:L}),style:ee,ref:Z})):null},A=({content:e})=>l.default.createElement("span",{dangerouslySetInnerHTML:{__html:e}});s(`: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;width:max-content;position:absolute;top:0;left:0;padding:8px 16px;border-radius:3px;font-size:90%;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)}`,"react-tooltip-core-styles"),s(`
|
|
8
|
+
.styles-module_arrow__K0L3T{width:8px;height:8px;transform:rotate(45deg)}.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)}`),exports.Tooltip=({id:t,anchorId:r,anchorSelect:o,content:n,html:c,render:s,className:a,classNameArrow:u,variant:i="dark",place:d="top",offset:f=10,wrapper:v="div",children:m=null,events:h=["hover"],openOnClick:y=!1,positionStrategy:w="absolute",middlewares:S,delayShow:E=0,delayHide:g=0,float:b=!1,hidden:T=!1,noArrow:R=!1,clickable:O=!1,closeOnEsc:x=!1,closeOnScroll:k=!1,closeOnResize:N=!1,style:L,position:$,isOpen:C,setIsOpen:I,afterShow:q,afterHide:j})=>{const[H,W]=e.useState(n),[z,B]=e.useState(c),[D,M]=e.useState(d),[P,K]=e.useState(i),[X,F]=e.useState(f),[Z,J]=e.useState(E),[Q,U]=e.useState(g),[Y,G]=e.useState(b),[V,ee]=e.useState(T),[te,re]=e.useState(v),[oe,le]=e.useState(h),[ne,ce]=e.useState(w),[se,ae]=e.useState(null),{anchorRefs:ue,activeAnchor:ie}=p(t),de=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),fe=e=>{const t={place:e=>{var t;M(null!==(t=e)&&void 0!==t?t:d)},content:e=>{W(null!=e?e:n)},html:e=>{B(null!=e?e:c)},variant:e=>{var t;K(null!==(t=e)&&void 0!==t?t:i)},offset:e=>{F(null===e?f:Number(e))},wrapper:e=>{var t;re(null!==(t=e)&&void 0!==t?t:v)},events:e=>{const t=null==e?void 0:e.split(" ");le(null!=t?t:h)},"position-strategy":e=>{var t;ce(null!==(t=e)&&void 0!==t?t:w)},"delay-show":e=>{J(null===e?E:Number(e))},"delay-hide":e=>{U(null===e?g:Number(e))},float:e=>{G(null===e?b:"true"===e)},hidden:e=>{ee(null===e?T:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};e.useEffect((()=>{W(n)}),[n]),e.useEffect((()=>{B(c)}),[c]),e.useEffect((()=>{M(d)}),[d]),e.useEffect((()=>{K(i)}),[i]),e.useEffect((()=>{F(f)}),[f]),e.useEffect((()=>{J(E)}),[E]),e.useEffect((()=>{U(g)}),[g]),e.useEffect((()=>{G(b)}),[b]),e.useEffect((()=>{ee(T)}),[T]),e.useEffect((()=>{ce(w)}),[w]),e.useEffect((()=>{var e;const l=new Set(ue);let n=o;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),n)try{document.querySelectorAll(n).forEach((e=>{l.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${n}" is not a valid CSS selector`)}const c=document.querySelector(`[id='${r}']`);if(c&&l.add({current:c}),!l.size)return()=>null;const s=null!==(e=null!=se?se:c)&&void 0!==e?e:ie.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 r=de(s);fe(r)}))})),u={attributes:!0,childList:!1,subtree:!1};if(s){const e=de(s);fe(e),a.observe(s,u)}return()=>{a.disconnect()}}),[ue,ie,se,r,o]);let pe=m;const ve=e.useRef(null);if(s){const e=s({content:null!=H?H:null,activeAnchor:se});pe=e?l.default.createElement("div",{ref:ve,className:"react-tooltip-content-wrapper"},e):null}else H&&(pe=H);z&&(pe=l.default.createElement(A,{content:z}));const me={id:t,anchorId:r,anchorSelect:o,className:a,classNameArrow:u,content:pe,contentWrapperRef:ve,place:D,variant:P,offset:X,wrapper:te,events:oe,openOnClick:y,positionStrategy:ne,middlewares:S,delayShow:Z,delayHide:Q,float:Y,hidden:V,noArrow:R,clickable:O,closeOnEsc:x,closeOnScroll:k,closeOnResize:N,style:L,position:$,isOpen:C,setIsOpen:I,afterShow:q,afterHide:j,activeAnchor:se,setActiveAnchor:e=>ae(e)};return l.default.createElement(_,{...me})},exports.TooltipProvider=({children:t})=>{const[r,o]=e.useState({[u]:new Set}),[n,c]=e.useState({[u]:{current:null}}),s=(e,...t)=>{o((r=>{var o;const l=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>l.add(e))),{...r,[e]:new Set(l)}}))},a=(e,...t)=>{o((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},i=e.useCallback(((e=u)=>{var t,o;return{anchorRefs:null!==(t=r[e])&&void 0!==t?t:new Set,activeAnchor:null!==(o=n[e])&&void 0!==o?o:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>a(e,...t),setActiveAnchor:t=>((e,t)=>{c((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[r,n,s,a]),d=e.useMemo((()=>({getTooltipData:i})),[i]);return l.default.createElement(f.Provider,{value:d},t)},exports.TooltipWrapper=({tooltipId:t,children:r,className:o,place:c,content:s,html:a,variant:u,offset:i,wrapper:d,events:f,positionStrategy:v,delayShow:m,delayHide:h})=>{const{attach:y,detach:w}=p(t),S=e.useRef(null);return e.useEffect((()=>(y(S),()=>{w(S)})),[]),l.default.createElement("span",{ref:S,className:n.default("react-tooltip-wrapper",o),"data-tooltip-place":c,"data-tooltip-content":s,"data-tooltip-html":a,"data-tooltip-variant":u,"data-tooltip-offset":i,"data-tooltip-wrapper":d,"data-tooltip-events":f,"data-tooltip-position-strategy":v,"data-tooltip-delay-show":m,"data-tooltip-delay-hide":h},r)},exports.removeStyle=function(e=c){const t=document.getElementById(e);null==t||t.remove()};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-tooltip.min.cjs","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/utils/debounce.ts","../src/components/TooltipProvider/TooltipProvider.tsx","../src/components/TooltipProvider/TooltipWrapper.tsx","../src/utils/use-isomorphic-layout-effect.ts","../src/utils/compute-positions.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/TooltipContent/TooltipContent.tsx","../src/components/TooltipController/TooltipController.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\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\nexport default styleInject;\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?: true) => {\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","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}: 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` }\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 arrowStyle = {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n [staticSide]: '-4px',\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 } from 'react'\nimport classNames from 'classnames'\nimport debounce from 'utils/debounce'\nimport { useTooltip } from 'components/TooltipProvider'\nimport useIsomorphicLayoutEffect from 'utils/use-isomorphic-layout-effect'\nimport { computeTooltipPosition } from '../../utils/compute-positions'\nimport styles from './styles.module.css'\nimport type { IPosition, ITooltip, PlacesType } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n 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}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const wasShowing = useRef(false)\n const lastFloatPosition = useRef<IPosition | null>(null)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id)\n const hoveringTooltip = useRef(false)\n const [anchorsBySelect, setAnchorsBySelect] = useState<HTMLElement[]>([])\n const mounted = useRef(false)\n\n const shouldOpenOnClick = openOnClick || events.includes('click')\n\n /**\n * useLayoutEffect runs before useEffect,\n * but should be used carefully because of caveats\n * https://beta.reactjs.org/reference/react/useLayoutEffect#caveats\n */\n useIsomorphicLayoutEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n\n useEffect(() => {\n if (!show) {\n /**\n * this fixes weird behavior when switching between two anchor elements very quickly\n * remove the timeout and switch quickly between two adjancent anchor elements to see it\n *\n * in practice, this means the tooltip is not immediately removed from the DOM on hide\n */\n const timeout = setTimeout(() => {\n setRendered(false)\n }, 150)\n return () => {\n clearTimeout(timeout)\n }\n }\n return () => null\n }, [show])\n\n const handleShow = (value: boolean) => {\n if (!mounted.current) {\n return\n }\n if (value) {\n setRendered(true)\n }\n /**\n * wait for the component to render and calculate position\n * before actually showing\n */\n setTimeout(() => {\n if (!mounted.current) {\n return\n }\n setIsOpen?.(value)\n if (isOpen === undefined) {\n setShow(value)\n }\n }, 10)\n }\n\n /**\n * this replicates the effect from `handleShow()`\n * when `isOpen` is changed from outside\n */\n useEffect(() => {\n if (isOpen === undefined) {\n return () => null\n }\n if (isOpen) {\n setRendered(true)\n }\n const timeout = setTimeout(() => {\n setShow(isOpen)\n }, 10)\n return () => {\n clearTimeout(timeout)\n }\n }, [isOpen])\n\n useEffect(() => {\n if (show === wasShowing.current) {\n return\n }\n wasShowing.current = show\n if (show) {\n afterShow?.()\n } else {\n afterHide?.()\n }\n }, [show])\n\n const handleShowTooltipDelayed = () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n\n tooltipShowDelayTimerRef.current = setTimeout(() => {\n handleShow(true)\n }, delayShow)\n }\n\n const handleHideTooltipDelayed = (delay = delayHide) => {\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n\n tooltipHideDelayTimerRef.current = setTimeout(() => {\n if (hoveringTooltip.current) {\n return\n }\n handleShow(false)\n }, delay)\n }\n\n const handleShowTooltip = (event?: Event) => {\n if (!event) {\n return\n }\n const target = (event.currentTarget ?? event.target) as HTMLElement | null\n if (!target?.isConnected) {\n /**\n * this happens when the target is removed from the DOM\n * at the same time the tooltip gets triggered\n */\n setActiveAnchor(null)\n setProviderActiveAnchor({ current: null })\n return\n }\n if (delayShow) {\n handleShowTooltipDelayed()\n } else {\n handleShow(true)\n }\n setActiveAnchor(target)\n setProviderActiveAnchor({ current: target })\n\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n\n const handleHideTooltip = () => {\n if (clickable) {\n // allow time for the mouse to reach the tooltip, in case there's a gap\n handleHideTooltipDelayed(delayHide || 100)\n } else if (delayHide) {\n handleHideTooltipDelayed()\n } else {\n handleShow(false)\n }\n\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n const handleTooltipPosition = ({ x, y }: IPosition) => {\n const virtualElement = {\n getBoundingClientRect() {\n return {\n x,\n y,\n width: 0,\n height: 0,\n top: y,\n left: x,\n right: x,\n bottom: y,\n }\n },\n } as Element\n computeTooltipPosition({\n place,\n offset,\n elementReference: virtualElement,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n }).then((computedStylesData) => {\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }\n\n const handleMouseMove = (event?: Event) => {\n if (!event) {\n return\n }\n const mouseEvent = event as MouseEvent\n const mousePosition = {\n x: mouseEvent.clientX,\n y: mouseEvent.clientY,\n }\n handleTooltipPosition(mousePosition)\n lastFloatPosition.current = mousePosition\n }\n\n const handleClickTooltipAnchor = (event?: Event) => {\n handleShowTooltip(event)\n if (delayHide) {\n handleHideTooltipDelayed()\n }\n }\n\n const handleClickOutsideAnchors = (event: MouseEvent) => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [anchorById, ...anchorsBySelect]\n if (anchors.some((anchor) => anchor?.contains(event.target as HTMLElement))) {\n return\n }\n if (tooltipRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n handleShow(false)\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\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\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 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 (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 }, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events])\n\n useEffect(() => {\n let selector = anchorSelect ?? ''\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n const documentObserverCallback: MutationCallback = (mutationList) => {\n const newAnchors: HTMLElement[] = []\n mutationList.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {\n const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')\n if (newId === id) {\n newAnchors.push(mutation.target as HTMLElement)\n }\n }\n if (mutation.type !== 'childList') {\n return\n }\n if (activeAnchor) {\n ;[...mutation.removedNodes].some((node) => {\n if (node?.contains?.(activeAnchor)) {\n setRendered(false)\n handleShow(false)\n setActiveAnchor(null)\n return true\n }\n return false\n })\n }\n if (!selector) {\n return\n }\n try {\n const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1)\n newAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n newAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n })\n if (newAnchors.length) {\n setAnchorsBySelect((anchors) => [...anchors, ...newAnchors])\n }\n }\n const documentObserver = new MutationObserver(documentObserverCallback)\n // watch for anchor being removed from the DOM\n documentObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-tooltip-id'],\n })\n return () => {\n documentObserver.disconnect()\n }\n }, [id, anchorSelect, activeAnchor])\n\n const updateTooltipPosition = () => {\n if (position) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(position)\n return\n }\n\n if (float) {\n if (lastFloatPosition.current) {\n /*\n Without this, changes to `content`, `place`, `offset`, ..., will only\n trigger a position calculation after a `mousemove` event.\n\n To see why this matters, comment this line, run `yarn dev` and click the\n \"Hover me!\" anchor.\n */\n handleTooltipPosition(lastFloatPosition.current)\n }\n // if `float` is set, override regular positioning\n return\n }\n\n computeTooltipPosition({\n place,\n offset,\n elementReference: activeAnchor,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n }).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\n useEffect(() => {\n updateTooltipPosition()\n }, [show, activeAnchor, content, externalStyles, place, offset, positionStrategy, position])\n\n useEffect(() => {\n if (!contentWrapperRef?.current) {\n return () => null\n }\n const contentObserver = new ResizeObserver(() => {\n updateTooltipPosition()\n })\n contentObserver.observe(contentWrapperRef.current)\n return () => {\n contentObserver.disconnect()\n }\n }, [content, contentWrapperRef?.current])\n\n useEffect(() => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [...anchorsBySelect, anchorById]\n if (!activeAnchor || !anchors.includes(activeAnchor)) {\n /**\n * if there is no active anchor,\n * or if the current active anchor is not amongst the allowed ones,\n * reset it\n */\n setActiveAnchor(anchorsBySelect[0] ?? anchorById)\n }\n }, [anchorId, anchorsBySelect, activeAnchor])\n\n useEffect(() => {\n return () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n }, [])\n\n useEffect(() => {\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (!selector) {\n return\n }\n try {\n const anchors = Array.from(document.querySelectorAll<HTMLElement>(selector))\n setAnchorsBySelect(anchors)\n } catch {\n // warning was already issued in the controller\n setAnchorsBySelect([])\n }\n }, [id, anchorSelect])\n\n const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0\n\n return rendered ? (\n <WrapperElement\n id={id}\n role=\"tooltip\"\n className={classNames(\n 'react-tooltip',\n styles['tooltip'],\n styles[variant],\n className,\n `react-tooltip__place-${actualPlacement}`,\n {\n [styles['show']]: canShow,\n [styles['fixed']]: positionStrategy === 'fixed',\n [styles['clickable']]: clickable,\n },\n )}\n style={{ ...externalStyles, ...inlineStyles }}\n ref={tooltipRef}\n >\n {content}\n <WrapperElement\n className={classNames('react-tooltip-arrow', styles['arrow'], classNameArrow, {\n /**\n * changed from dash `no-arrow` to camelcase because of:\n * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42\n */\n [styles['noArrow']]: noArrow,\n })}\n style={inlineArrowStyles}\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} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = ({\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n style,\n position,\n isOpen,\n setIsOpen,\n afterShow,\n afterHide,\n}: ITooltipController) => {\n const [tooltipContent, setTooltipContent] = useState(content)\n const [tooltipHtml, setTooltipHtml] = useState(html)\n const [tooltipPlace, setTooltipPlace] = useState(place)\n const [tooltipVariant, setTooltipVariant] = useState(variant)\n const [tooltipOffset, setTooltipOffset] = useState(offset)\n const [tooltipDelayShow, setTooltipDelayShow] = useState(delayShow)\n const [tooltipDelayHide, setTooltipDelayHide] = useState(delayHide)\n const [tooltipFloat, setTooltipFloat] = useState(float)\n const [tooltipHidden, setTooltipHidden] = useState(hidden)\n const [tooltipWrapper, setTooltipWrapper] = useState<WrapperType>(wrapper)\n const [tooltipEvents, setTooltipEvents] = useState(events)\n const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy)\n const [activeAnchor, setActiveAnchor] = useState<HTMLElement | null>(null)\n /**\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 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 /**\n * content priority: children < render or content < html\n * children should be lower priority so that it can be used as the \"default\" content\n */\n let renderedContent: ChildrenType = children\n const contentWrapperRef = useRef<HTMLDivElement>(null)\n if (render) {\n const rendered = render({ content: tooltipContent ?? null, activeAnchor }) as React.ReactNode\n renderedContent = rendered ? (\n <div ref={contentWrapperRef} className=\"react-tooltip-content-wrapper\">\n {rendered}\n </div>\n ) : null\n } else if (tooltipContent) {\n renderedContent = tooltipContent\n }\n if (tooltipHtml) {\n renderedContent = <TooltipContent content={tooltipHtml} />\n }\n\n const props: ITooltip = {\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n style,\n position,\n isOpen,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n}\n\nexport default TooltipController\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","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","computeTooltipPosition","async","elementReference","tooltipReference","tooltipArrowReference","place","offset","offsetValue","strategy","middlewares","Number","flip","shift","padding","tooltipStyles","tooltipArrowStyles","middleware","push","arrow","element","computePosition","placement","then","x","y","middlewareData","styles","left","top","arrowX","arrowY","_a","right","bottom","_b","split","Tooltip","id","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","wasShowing","lastFloatPosition","setProviderActiveAnchor","hoveringTooltip","anchorsBySelect","setAnchorsBySelect","mounted","shouldOpenOnClick","includes","handleShow","value","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","some","anchor","contains","handleEsc","key","debouncedHandleShowTooltip","debouncedHandleHideTooltip","elementRefs","forEach","add","anchorById","addEventListener","enabledEvents","listener","handleMouseEnterTooltip","handleMouseLeaveTooltip","removeEventListener","selector","documentObserver","MutationObserver","mutationList","newAnchors","mutation","attributeName","getAttribute","removedNodes","node","call","elements","addedNodes","filter","nodeType","matches","flatMap","querySelectorAll","anchors","observe","body","childList","subtree","attributes","attributeFilter","disconnect","updateTooltipPosition","contentObserver","ResizeObserver","Array","from","canShow","React","role","classNames","TooltipContent","dangerouslySetInnerHTML","__html","html","render","children","tooltipContent","setTooltipContent","tooltipHtml","setTooltipHtml","tooltipPlace","setTooltipPlace","tooltipVariant","setTooltipVariant","tooltipOffset","setTooltipOffset","tooltipDelayShow","setTooltipDelayShow","tooltipDelayHide","setTooltipDelayHide","tooltipFloat","setTooltipFloat","tooltipHidden","setTooltipHidden","tooltipWrapper","setTooltipWrapper","tooltipEvents","setTooltipEvents","tooltipPositionStrategy","setTooltipPositionStrategy","providerActiveAnchor","getDataAttributesFromAnchorElement","getAttributeNames","reduce","acc","name","startsWith","replace","applyAllDataAttributesFromAnchorElement","dataAttributes","handleDataAttributes","parsed","values","handler","entries","console","warn","size","anchorElement","observer","observerConfig","renderedContent","props","anchorRefMap","setAnchorRefMap","activeAnchorMap","setActiveAnchorMap","refs","oldMap","tooltipRefs","delete","useCallback","context","useMemo","Provider","anchorRef"],"mappings":";;;;;;2OAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D,gLClBA,MAAM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AAN,IAAKqR,EACLlM,UAAWgI,EAAAA,QAAW,wBAAyBhI,GAC3B,qBAAAjC,yBACEsD,EAAO,oBACV+G,EAAI,uBACDlI,EACD,sBAAAlC,EACC,uBAAAwC,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExB2H,EAEJ"}
|
|
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/compute-positions.ts","../src/components/Tooltip/Tooltip.tsx","../src/components/TooltipContent/TooltipContent.tsx","../src/index.tsx","../src/components/TooltipController/TooltipController.tsx"],"sourcesContent":["const REACT_TOOLTIP_STYLES_ID = 'react-tooltip-styles'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, default-param-last\nfunction injectStyle(css: string, id = REACT_TOOLTIP_STYLES_ID, ref?: any) {\n if (!ref) {\n // eslint-disable-next-line no-param-reassign\n ref = {}\n }\n const { insertAt } = ref\n\n if (!css || typeof document === 'undefined' || document.getElementById(REACT_TOOLTIP_STYLES_ID)) {\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\nfunction removeStyle(id = REACT_TOOLTIP_STYLES_ID) {\n const style = document.getElementById(id)\n style?.remove()\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?: true) => {\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","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}: 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` }\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 arrowStyle = {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n [staticSide]: '-4px',\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 } from 'react'\nimport classNames from 'classnames'\nimport debounce from 'utils/debounce'\nimport { useTooltip } from 'components/TooltipProvider'\nimport useIsomorphicLayoutEffect from 'utils/use-isomorphic-layout-effect'\nimport { computeTooltipPosition } from '../../utils/compute-positions'\nimport coreStyles from './core-styles.module.css'\nimport styles from './styles.module.css'\nimport type { IPosition, ITooltip, PlacesType } from './TooltipTypes'\n\nconst Tooltip = ({\n // props\n id,\n className,\n classNameArrow,\n variant = 'dark',\n anchorId,\n anchorSelect,\n place = 'top',\n offset = 10,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n wrapper: WrapperElement,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style: externalStyles,\n position,\n afterShow,\n afterHide,\n // props handled by controller\n content,\n contentWrapperRef,\n isOpen,\n setIsOpen,\n activeAnchor,\n setActiveAnchor,\n}: ITooltip) => {\n const tooltipRef = useRef<HTMLElement>(null)\n const tooltipArrowRef = useRef<HTMLElement>(null)\n const tooltipShowDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const tooltipHideDelayTimerRef = useRef<NodeJS.Timeout | null>(null)\n const [actualPlacement, setActualPlacement] = useState(place)\n const [inlineStyles, setInlineStyles] = useState({})\n const [inlineArrowStyles, setInlineArrowStyles] = useState({})\n const [show, setShow] = useState(false)\n const [rendered, setRendered] = useState(false)\n const wasShowing = useRef(false)\n const lastFloatPosition = useRef<IPosition | null>(null)\n /**\n * @todo Remove this in a future version (provider/wrapper method is deprecated)\n */\n const { anchorRefs, setActiveAnchor: setProviderActiveAnchor } = useTooltip(id)\n const hoveringTooltip = useRef(false)\n const [anchorsBySelect, setAnchorsBySelect] = useState<HTMLElement[]>([])\n const mounted = useRef(false)\n\n const shouldOpenOnClick = openOnClick || events.includes('click')\n\n /**\n * useLayoutEffect runs before useEffect,\n * but should be used carefully because of caveats\n * https://beta.reactjs.org/reference/react/useLayoutEffect#caveats\n */\n useIsomorphicLayoutEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n\n useEffect(() => {\n if (!show) {\n /**\n * this fixes weird behavior when switching between two anchor elements very quickly\n * remove the timeout and switch quickly between two adjancent anchor elements to see it\n *\n * in practice, this means the tooltip is not immediately removed from the DOM on hide\n */\n const timeout = setTimeout(() => {\n setRendered(false)\n }, 150)\n return () => {\n clearTimeout(timeout)\n }\n }\n return () => null\n }, [show])\n\n const handleShow = (value: boolean) => {\n if (!mounted.current) {\n return\n }\n if (value) {\n setRendered(true)\n }\n /**\n * wait for the component to render and calculate position\n * before actually showing\n */\n setTimeout(() => {\n if (!mounted.current) {\n return\n }\n setIsOpen?.(value)\n if (isOpen === undefined) {\n setShow(value)\n }\n }, 10)\n }\n\n /**\n * this replicates the effect from `handleShow()`\n * when `isOpen` is changed from outside\n */\n useEffect(() => {\n if (isOpen === undefined) {\n return () => null\n }\n if (isOpen) {\n setRendered(true)\n }\n const timeout = setTimeout(() => {\n setShow(isOpen)\n }, 10)\n return () => {\n clearTimeout(timeout)\n }\n }, [isOpen])\n\n useEffect(() => {\n if (show === wasShowing.current) {\n return\n }\n wasShowing.current = show\n if (show) {\n afterShow?.()\n } else {\n afterHide?.()\n }\n }, [show])\n\n const handleShowTooltipDelayed = () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n\n tooltipShowDelayTimerRef.current = setTimeout(() => {\n handleShow(true)\n }, delayShow)\n }\n\n const handleHideTooltipDelayed = (delay = delayHide) => {\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n\n tooltipHideDelayTimerRef.current = setTimeout(() => {\n if (hoveringTooltip.current) {\n return\n }\n handleShow(false)\n }, delay)\n }\n\n const handleShowTooltip = (event?: Event) => {\n if (!event) {\n return\n }\n const target = (event.currentTarget ?? event.target) as HTMLElement | null\n if (!target?.isConnected) {\n /**\n * this happens when the target is removed from the DOM\n * at the same time the tooltip gets triggered\n */\n setActiveAnchor(null)\n setProviderActiveAnchor({ current: null })\n return\n }\n if (delayShow) {\n handleShowTooltipDelayed()\n } else {\n handleShow(true)\n }\n setActiveAnchor(target)\n setProviderActiveAnchor({ current: target })\n\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n\n const handleHideTooltip = () => {\n if (clickable) {\n // allow time for the mouse to reach the tooltip, in case there's a gap\n handleHideTooltipDelayed(delayHide || 100)\n } else if (delayHide) {\n handleHideTooltipDelayed()\n } else {\n handleShow(false)\n }\n\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n }\n\n const handleTooltipPosition = ({ x, y }: IPosition) => {\n const virtualElement = {\n getBoundingClientRect() {\n return {\n x,\n y,\n width: 0,\n height: 0,\n top: y,\n left: x,\n right: x,\n bottom: y,\n }\n },\n } as Element\n computeTooltipPosition({\n place,\n offset,\n elementReference: virtualElement,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n }).then((computedStylesData) => {\n if (Object.keys(computedStylesData.tooltipStyles).length) {\n setInlineStyles(computedStylesData.tooltipStyles)\n }\n if (Object.keys(computedStylesData.tooltipArrowStyles).length) {\n setInlineArrowStyles(computedStylesData.tooltipArrowStyles)\n }\n setActualPlacement(computedStylesData.place as PlacesType)\n })\n }\n\n const handleMouseMove = (event?: Event) => {\n if (!event) {\n return\n }\n const mouseEvent = event as MouseEvent\n const mousePosition = {\n x: mouseEvent.clientX,\n y: mouseEvent.clientY,\n }\n handleTooltipPosition(mousePosition)\n lastFloatPosition.current = mousePosition\n }\n\n const handleClickTooltipAnchor = (event?: Event) => {\n handleShowTooltip(event)\n if (delayHide) {\n handleHideTooltipDelayed()\n }\n }\n\n const handleClickOutsideAnchors = (event: MouseEvent) => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [anchorById, ...anchorsBySelect]\n if (anchors.some((anchor) => anchor?.contains(event.target as HTMLElement))) {\n return\n }\n if (tooltipRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n handleShow(false)\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') {\n return\n }\n handleShow(false)\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\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 if (closeOnScroll) {\n window.addEventListener('scroll', debouncedHandleHideTooltip)\n }\n if (closeOnResize) {\n window.addEventListener('resize', debouncedHandleHideTooltip)\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', debouncedHandleHideTooltip)\n }\n if (closeOnResize) {\n window.removeEventListener('resize', debouncedHandleHideTooltip)\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 }, [rendered, anchorRefs, anchorsBySelect, closeOnEsc, events])\n\n useEffect(() => {\n let selector = anchorSelect ?? ''\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n const documentObserverCallback: MutationCallback = (mutationList) => {\n const newAnchors: HTMLElement[] = []\n mutationList.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'data-tooltip-id') {\n const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')\n if (newId === id) {\n newAnchors.push(mutation.target as HTMLElement)\n }\n }\n if (mutation.type !== 'childList') {\n return\n }\n if (activeAnchor) {\n ;[...mutation.removedNodes].some((node) => {\n if (node?.contains?.(activeAnchor)) {\n setRendered(false)\n handleShow(false)\n setActiveAnchor(null)\n return true\n }\n return false\n })\n }\n if (!selector) {\n return\n }\n try {\n const elements = [...mutation.addedNodes].filter((node) => node.nodeType === 1)\n newAnchors.push(\n // the element itself is an anchor\n ...(elements.filter((element) =>\n (element as HTMLElement).matches(selector),\n ) as HTMLElement[]),\n )\n newAnchors.push(\n // the element has children which are anchors\n ...elements.flatMap(\n (element) =>\n [...(element as HTMLElement).querySelectorAll(selector)] as HTMLElement[],\n ),\n )\n } catch {\n /**\n * invalid CSS selector.\n * already warned on tooltip controller\n */\n }\n })\n if (newAnchors.length) {\n setAnchorsBySelect((anchors) => [...anchors, ...newAnchors])\n }\n }\n const documentObserver = new MutationObserver(documentObserverCallback)\n // watch for anchor being removed from the DOM\n documentObserver.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-tooltip-id'],\n })\n return () => {\n documentObserver.disconnect()\n }\n }, [id, anchorSelect, activeAnchor])\n\n const updateTooltipPosition = () => {\n if (position) {\n // if `position` is set, override regular and `float` positioning\n handleTooltipPosition(position)\n return\n }\n\n if (float) {\n if (lastFloatPosition.current) {\n /*\n Without this, changes to `content`, `place`, `offset`, ..., will only\n trigger a position calculation after a `mousemove` event.\n\n To see why this matters, comment this line, run `yarn dev` and click the\n \"Hover me!\" anchor.\n */\n handleTooltipPosition(lastFloatPosition.current)\n }\n // if `float` is set, override regular positioning\n return\n }\n\n computeTooltipPosition({\n place,\n offset,\n elementReference: activeAnchor,\n tooltipReference: tooltipRef.current,\n tooltipArrowReference: tooltipArrowRef.current,\n strategy: positionStrategy,\n middlewares,\n }).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\n useEffect(() => {\n updateTooltipPosition()\n }, [show, activeAnchor, content, externalStyles, place, offset, positionStrategy, position])\n\n useEffect(() => {\n if (!contentWrapperRef?.current) {\n return () => null\n }\n const contentObserver = new ResizeObserver(() => {\n updateTooltipPosition()\n })\n contentObserver.observe(contentWrapperRef.current)\n return () => {\n contentObserver.disconnect()\n }\n }, [content, contentWrapperRef?.current])\n\n useEffect(() => {\n const anchorById = document.querySelector<HTMLElement>(`[id='${anchorId}']`)\n const anchors = [...anchorsBySelect, anchorById]\n if (!activeAnchor || !anchors.includes(activeAnchor)) {\n /**\n * if there is no active anchor,\n * or if the current active anchor is not amongst the allowed ones,\n * reset it\n */\n setActiveAnchor(anchorsBySelect[0] ?? anchorById)\n }\n }, [anchorId, anchorsBySelect, activeAnchor])\n\n useEffect(() => {\n return () => {\n if (tooltipShowDelayTimerRef.current) {\n clearTimeout(tooltipShowDelayTimerRef.current)\n }\n if (tooltipHideDelayTimerRef.current) {\n clearTimeout(tooltipHideDelayTimerRef.current)\n }\n }\n }, [])\n\n useEffect(() => {\n let selector = anchorSelect\n if (!selector && id) {\n selector = `[data-tooltip-id='${id}']`\n }\n if (!selector) {\n return\n }\n try {\n const anchors = Array.from(document.querySelectorAll<HTMLElement>(selector))\n setAnchorsBySelect(anchors)\n } catch {\n // warning was already issued in the controller\n setAnchorsBySelect([])\n }\n }, [id, anchorSelect])\n\n const canShow = !hidden && content && show && Object.keys(inlineStyles).length > 0\n\n return rendered ? (\n <WrapperElement\n id={id}\n role=\"tooltip\"\n className={classNames(\n 'react-tooltip',\n coreStyles['tooltip'],\n styles[variant],\n className,\n `react-tooltip__place-${actualPlacement}`,\n {\n [coreStyles['show']]: canShow,\n [coreStyles['fixed']]: positionStrategy === 'fixed',\n [coreStyles['clickable']]: clickable,\n },\n )}\n style={{ ...externalStyles, ...inlineStyles }}\n ref={tooltipRef}\n >\n {content}\n <WrapperElement\n className={classNames(\n 'react-tooltip-arrow',\n coreStyles['arrow'],\n styles['arrow'],\n classNameArrow,\n {\n /**\n * changed from dash `no-arrow` to camelcase because of:\n * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42\n */\n [coreStyles['noArrow']]: noArrow,\n },\n )}\n style={inlineArrowStyles}\n ref={tooltipArrowRef}\n />\n </WrapperElement>\n ) : null\n}\n\nexport default Tooltip\n","/* eslint-disable react/no-danger */\nimport React from 'react'\nimport type { ITooltipContent } from './TooltipContentTypes'\n\nconst TooltipContent = ({ content }: ITooltipContent) => {\n return <span dangerouslySetInnerHTML={{ __html: content }} />\n}\n\nexport default TooltipContent\n","import './tokens.css'\n\nimport { injectStyle } from 'utils/handle-style'\n\nimport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n IPosition,\n Middleware,\n} from './components/Tooltip/TooltipTypes'\nimport type { ITooltipController } from './components/TooltipController/TooltipControllerTypes'\nimport type { ITooltipWrapper } from './components/TooltipProvider/TooltipProviderTypes'\n\n// those content will be replaced in build time with the `react-tooltip.css` builded content\nconst TooltipCoreStyles = 'react-tooltip-core-css-placeholder'\nconst TooltipStyles = 'react-tooltip-css-placeholder'\n\ninjectStyle(TooltipCoreStyles, 'react-tooltip-core-styles')\ninjectStyle(TooltipStyles)\n\nexport { TooltipController as Tooltip } from './components/TooltipController'\nexport { TooltipProvider, TooltipWrapper } from './components/TooltipProvider'\nexport type {\n ChildrenType,\n DataAttribute,\n EventsType,\n PlacesType,\n PositionStrategy,\n VariantType,\n WrapperType,\n ITooltipController as ITooltip,\n ITooltipWrapper,\n IPosition,\n Middleware,\n}\n\nexport { removeStyle } from './utils/handle-style'\n","import React, { useEffect, useRef, useState } from 'react'\nimport { Tooltip } from 'components/Tooltip'\nimport type {\n EventsType,\n PositionStrategy,\n PlacesType,\n VariantType,\n WrapperType,\n DataAttribute,\n ITooltip,\n ChildrenType,\n} from 'components/Tooltip/TooltipTypes'\nimport { useTooltip } from 'components/TooltipProvider'\nimport { TooltipContent } from 'components/TooltipContent'\nimport type { ITooltipController } from './TooltipControllerTypes'\n\nconst TooltipController = ({\n id,\n anchorId,\n anchorSelect,\n content,\n html,\n render,\n className,\n classNameArrow,\n variant = 'dark',\n place = 'top',\n offset = 10,\n wrapper = 'div',\n children = null,\n events = ['hover'],\n openOnClick = false,\n positionStrategy = 'absolute',\n middlewares,\n delayShow = 0,\n delayHide = 0,\n float = false,\n hidden = false,\n noArrow = false,\n clickable = false,\n closeOnEsc = false,\n closeOnScroll = false,\n closeOnResize = false,\n style,\n position,\n isOpen,\n setIsOpen,\n afterShow,\n afterHide,\n}: ITooltipController) => {\n const [tooltipContent, setTooltipContent] = useState(content)\n const [tooltipHtml, setTooltipHtml] = useState(html)\n const [tooltipPlace, setTooltipPlace] = useState(place)\n const [tooltipVariant, setTooltipVariant] = useState(variant)\n const [tooltipOffset, setTooltipOffset] = useState(offset)\n const [tooltipDelayShow, setTooltipDelayShow] = useState(delayShow)\n const [tooltipDelayHide, setTooltipDelayHide] = useState(delayHide)\n const [tooltipFloat, setTooltipFloat] = useState(float)\n const [tooltipHidden, setTooltipHidden] = useState(hidden)\n const [tooltipWrapper, setTooltipWrapper] = useState<WrapperType>(wrapper)\n const [tooltipEvents, setTooltipEvents] = useState(events)\n const [tooltipPositionStrategy, setTooltipPositionStrategy] = useState(positionStrategy)\n const [activeAnchor, setActiveAnchor] = useState<HTMLElement | null>(null)\n /**\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 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 /**\n * content priority: children < render or content < html\n * children should be lower priority so that it can be used as the \"default\" content\n */\n let renderedContent: ChildrenType = children\n const contentWrapperRef = useRef<HTMLDivElement>(null)\n if (render) {\n const rendered = render({ content: tooltipContent ?? null, activeAnchor }) as React.ReactNode\n renderedContent = rendered ? (\n <div ref={contentWrapperRef} className=\"react-tooltip-content-wrapper\">\n {rendered}\n </div>\n ) : null\n } else if (tooltipContent) {\n renderedContent = tooltipContent\n }\n if (tooltipHtml) {\n renderedContent = <TooltipContent content={tooltipHtml} />\n }\n\n const props: ITooltip = {\n id,\n anchorId,\n anchorSelect,\n className,\n classNameArrow,\n content: renderedContent,\n contentWrapperRef,\n place: tooltipPlace,\n variant: tooltipVariant,\n offset: tooltipOffset,\n wrapper: tooltipWrapper,\n events: tooltipEvents,\n openOnClick,\n positionStrategy: tooltipPositionStrategy,\n middlewares,\n delayShow: tooltipDelayShow,\n delayHide: tooltipDelayHide,\n float: tooltipFloat,\n hidden: tooltipHidden,\n noArrow,\n clickable,\n closeOnEsc,\n closeOnScroll,\n closeOnResize,\n style,\n position,\n isOpen,\n setIsOpen,\n afterShow,\n afterHide,\n activeAnchor,\n setActiveAnchor: (anchor: HTMLElement | null) => setActiveAnchor(anchor),\n }\n\n return <Tooltip {...props} />\n}\n\nexport default TooltipController\n"],"names":["REACT_TOOLTIP_STYLES_ID","injectStyle","css","id","ref","insertAt","document","getElementById","head","getElementsByTagName","style","createElement","type","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","computeTooltipPosition","async","elementReference","tooltipReference","tooltipArrowReference","place","offset","offsetValue","strategy","middlewares","Number","flip","shift","padding","tooltipStyles","tooltipArrowStyles","middleware","push","arrow","element","computePosition","placement","then","x","y","middlewareData","styles","left","top","arrowX","arrowY","_a","right","bottom","_b","split","Tooltip","className","classNameArrow","variant","anchorId","anchorSelect","events","openOnClick","positionStrategy","wrapper","WrapperElement","delayShow","delayHide","float","hidden","noArrow","clickable","closeOnEsc","closeOnScroll","closeOnResize","externalStyles","position","afterShow","afterHide","content","contentWrapperRef","isOpen","setIsOpen","tooltipRef","useRef","tooltipArrowRef","tooltipShowDelayTimerRef","tooltipHideDelayTimerRef","actualPlacement","setActualPlacement","useState","inlineStyles","setInlineStyles","inlineArrowStyles","setInlineArrowStyles","show","setShow","rendered","setRendered","wasShowing","lastFloatPosition","setProviderActiveAnchor","hoveringTooltip","anchorsBySelect","setAnchorsBySelect","mounted","shouldOpenOnClick","includes","handleShow","value","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","some","anchor","contains","handleEsc","key","debouncedHandleShowTooltip","debouncedHandleHideTooltip","elementRefs","forEach","add","anchorById","addEventListener","enabledEvents","listener","handleMouseEnterTooltip","handleMouseLeaveTooltip","removeEventListener","selector","documentObserver","MutationObserver","mutationList","newAnchors","mutation","attributeName","getAttribute","removedNodes","node","call","elements","addedNodes","filter","nodeType","matches","flatMap","querySelectorAll","anchors","observe","body","childList","subtree","attributes","attributeFilter","disconnect","updateTooltipPosition","contentObserver","ResizeObserver","Array","from","canShow","React","role","classNames","coreStyles","coreStyles_show","coreStyles_fixed","coreStyles_clickable","coreStyles_noArrow","TooltipContent","dangerouslySetInnerHTML","__html","html","render","children","tooltipContent","setTooltipContent","tooltipHtml","setTooltipHtml","tooltipPlace","setTooltipPlace","tooltipVariant","setTooltipVariant","tooltipOffset","setTooltipOffset","tooltipDelayShow","setTooltipDelayShow","tooltipDelayHide","setTooltipDelayHide","tooltipFloat","setTooltipFloat","tooltipHidden","setTooltipHidden","tooltipWrapper","setTooltipWrapper","tooltipEvents","setTooltipEvents","tooltipPositionStrategy","setTooltipPositionStrategy","providerActiveAnchor","getDataAttributesFromAnchorElement","getAttributeNames","reduce","acc","name","startsWith","replace","applyAllDataAttributesFromAnchorElement","dataAttributes","handleDataAttributes","parsed","values","handler","entries","console","warn","size","anchorElement","observer","observerConfig","renderedContent","props","anchorRefMap","setAnchorRefMap","activeAnchorMap","setActiveAnchorMap","refs","oldMap","tooltipRefs","delete","useCallback","context","useMemo","Provider","anchorRef","remove"],"mappings":";;;;;;2OAAA,MAAMA,EAA0B,uBAGhC,SAASC,EAAYC,EAAaC,EAAKH,EAAyBI,GACzDA,IAEHA,EAAM,CAAA,GAER,MAAMC,SAAEA,GAAaD,EAErB,IAAKF,GAA2B,oBAAbI,UAA4BA,SAASC,eAAeP,GACrE,OAGF,MAAMQ,EAAOF,SAASE,MAAQF,SAASG,qBAAqB,QAAQ,GAE9DC,EAAaJ,SAASK,cAAc,SAC1CD,EAAMP,GAAKA,EACXO,EAAME,KAAO,WAEI,QAAbP,GACEG,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUf,EAE3BQ,EAAMK,YAAYT,SAASY,eAAehB,GAE9C,CC5BA,MAAMiB,EAAW,CAACC,EAAgCC,EAAeC,KAC/D,IAAIC,EAAiC,KAErC,OAAO,YAAyCC,GAC9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YACAC,gBAEA,MAAM9D,OAAEA,EAAMC,OAAEA,GAAWM,EAAWC,GAChCoP,EAAY7K,SAA2B,MAS7C,OAPAlE,EAAAA,WAAU,KACRb,EAAO4P,GACA,KACL3P,EAAO2P,EAAU,IAElB,IAGDzE,EAAAA,QACE5M,cAAA,OAAA,CAAAP,IAAK4R,EACLzM,UAAWkI,EAAAA,QAAW,wBAAyBlI,GAC3B,qBAAAhC,yBACEuD,EAAO,oBACVoH,EAAI,uBACDzI,EACD,sBAAAjC,EACC,uBAAAuC,wBACDH,EAAM,iCACKE,EAAgB,0BACvBG,EACA,0BAAAC,GAExBkI,EAEJ,sBHdH,SAAqBjO,EAAKH,GACxB,MAAMU,EAAQJ,SAASC,eAAeJ,GACtCO,SAAAA,EAAOuR,QACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
: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}.styles-
|
|
1
|
+
: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{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{background:inherit;position:absolute}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);visibility:visible}.styles-module_arrow__K0L3T{height:8px;transform:rotate(45deg);width:8px}.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)}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @copyright ReactTooltip Team
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import e,{createContext as t,useState as r,useCallback as o,useMemo as l,useContext as n,useRef as i,useEffect as c,useLayoutEffect as a}from"react";import s from"classnames";import{arrow as u,computePosition as d,offset as p,flip as v,shift as m}from"@floating-ui/dom";function h(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===r&&o.firstChild?o.insertBefore(l,o.firstChild):o.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}h(":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}");const f=(e,t,r)=>{let o=null;return function(...l){const n=()=>{o=null,r||e.apply(this,l)};r&&!o&&(e.apply(this,l),o=setTimeout(n,t)),r||(o&&clearTimeout(o),o=setTimeout(n,t))}},y="DEFAULT_TOOLTIP_ID",w={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},_=t({getTooltipData:()=>w}),b=({children:t})=>{const[n,i]=r({[y]:new Set}),[c,a]=r({[y]:{current:null}}),s=(e,...t)=>{i((r=>{var o;const l=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>l.add(e))),{...r,[e]:new Set(l)}}))},u=(e,...t)=>{i((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},d=o(((e=y)=>{var t,r;return{anchorRefs:null!==(t=n[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=c[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{a((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[n,c,s,u]),p=l((()=>({getTooltipData:d})),[d]);return e.createElement(_.Provider,{value:p},t)};function g(e=y){return n(_).getTooltipData(e)}const S=({tooltipId:t,children:r,className:o,place:l,content:n,html:a,variant:u,offset:d,wrapper:p,events:v,positionStrategy:m,delayShow:h,delayHide:f})=>{const{attach:y,detach:w}=g(t),_=i(null);return c((()=>(y(_),()=>{w(_)})),[]),e.createElement("span",{ref:_,className:s("react-tooltip-wrapper",o),"data-tooltip-place":l,"data-tooltip-content":n,"data-tooltip-html":a,"data-tooltip-variant":u,"data-tooltip-offset":d,"data-tooltip-wrapper":p,"data-tooltip-events":v,"data-tooltip-position-strategy":m,"data-tooltip-delay-show":h,"data-tooltip-delay-hide":f},r)},A="undefined"!=typeof window?a:c,k=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:o="top",offset:l=10,strategy:n="absolute",middlewares:i=[p(Number(l)),v(),m({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};const c=i;return r?(c.push(u({element:r,padding:5})),d(e,t,{placement:o,strategy:n,middleware:c}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var l,n;const i={left:`${e}px`,top:`${t}px`},{x:c,y:a}=null!==(l=o.arrow)&&void 0!==l?l:{x:0,y:0};return{tooltipStyles:i,tooltipArrowStyles:{left:null!=c?`${c}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==n?n:"bottom"]:"-4px"},place:r}}))):d(e,t,{placement:"bottom",strategy:n,middleware:c}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var E={tooltip:"styles-module_tooltip__mnnfp",fixed:"styles-module_fixed__7ciUi",arrow:"styles-module_arrow__K0L3T",noArrow:"styles-module_noArrow__T8y2L",clickable:"styles-module_clickable__Bv9o7",show:"styles-module_show__2NboJ",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"};h(".styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.styles-module_fixed__7ciUi{position:fixed}.styles-module_arrow__K0L3T{background:inherit;height:8px;position:absolute;transform:rotate(45deg);width:8px}.styles-module_noArrow__T8y2L{display:none}.styles-module_clickable__Bv9o7{pointer-events:auto}.styles-module_show__2NboJ{opacity:var(--rt-opacity);visibility:visible}.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)}");const T=({id:t,className:o,classNameArrow:l,variant:n="dark",anchorId:a,anchorSelect:u,place:d="top",offset:p=10,events:v=["hover"],openOnClick:m=!1,positionStrategy:h="absolute",middlewares:y,wrapper:w,delayShow:_=0,delayHide:b=0,float:S=!1,hidden:T=!1,noArrow:x=!1,clickable:N=!1,closeOnEsc:O=!1,style:L,position:R,afterShow:$,afterHide:C,content:H,contentWrapperRef:I,isOpen:W,setIsOpen:j,activeAnchor:q,setActiveAnchor:D})=>{const B=i(null),K=i(null),X=i(null),J=i(null),[M,z]=r(d),[U,F]=r({}),[P,Z]=r({}),[Y,G]=r(!1),[Q,V]=r(!1),ee=i(!1),te=i(null),{anchorRefs:re,setActiveAnchor:oe}=g(t),le=i(!1),[ne,ie]=r([]),ce=i(!1),ae=m||v.includes("click");A((()=>(ce.current=!0,()=>{ce.current=!1})),[]),c((()=>{if(!Y){const e=setTimeout((()=>{V(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[Y]);const se=e=>{ce.current&&(e&&V(!0),setTimeout((()=>{ce.current&&(null==j||j(e),void 0===W&&G(e))}),10))};c((()=>{if(void 0===W)return()=>null;W&&V(!0);const e=setTimeout((()=>{G(W)}),10);return()=>{clearTimeout(e)}}),[W]),c((()=>{Y!==ee.current&&(ee.current=Y,Y?null==$||$():null==C||C())}),[Y]);const ue=(e=b)=>{J.current&&clearTimeout(J.current),J.current=setTimeout((()=>{le.current||se(!1)}),e)},de=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return D(null),void oe({current:null});_?(X.current&&clearTimeout(X.current),X.current=setTimeout((()=>{se(!0)}),_)):se(!0),D(r),oe({current:r}),J.current&&clearTimeout(J.current)},pe=()=>{N?ue(b||100):b?ue():se(!1),X.current&&clearTimeout(X.current)},ve=({x:e,y:t})=>{k({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:B.current,tooltipArrowReference:K.current,strategy:h,middlewares:y}).then((e=>{Object.keys(e.tooltipStyles).length&&F(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&Z(e.tooltipArrowStyles),z(e.place)}))},me=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};ve(r),te.current=r},he=e=>{de(e),b&&ue()},fe=e=>{var t;[document.querySelector(`[id='${a}']`),...ne].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=B.current)||void 0===t?void 0:t.contains(e.target))||se(!1)},ye=e=>{"Escape"===e.key&&se(!1)},we=f(de,50,!0),_e=f(pe,50,!0);c((()=>{var e,t;const r=new Set(re);ne.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${a}']`);o&&r.add({current:o}),O&&window.addEventListener("keydown",ye);const l=[];ae?(window.addEventListener("click",fe),l.push({event:"click",listener:he})):(l.push({event:"mouseenter",listener:we},{event:"mouseleave",listener:_e},{event:"focus",listener:we},{event:"blur",listener:_e}),S&&l.push({event:"mousemove",listener:me}));const n=()=>{le.current=!0},i=()=>{le.current=!1,pe()};return N&&!ae&&(null===(e=B.current)||void 0===e||e.addEventListener("mouseenter",n),null===(t=B.current)||void 0===t||t.addEventListener("mouseleave",i)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;ae&&window.removeEventListener("click",fe),O&&window.removeEventListener("keydown",ye),N&&!ae&&(null===(e=B.current)||void 0===e||e.removeEventListener("mouseenter",n),null===(t=B.current)||void 0===t||t.removeEventListener("mouseleave",i)),l.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[Q,re,ne,O,v]),c((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type&&(q&&[...r.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,q))&&(V(!1),se(!1),D(null),!0)})),e))try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&ie((e=>[...e,...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,u,q]);const be=()=>{R?ve(R):S?te.current&&ve(te.current):k({place:d,offset:p,elementReference:q,tooltipReference:B.current,tooltipArrowReference:K.current,strategy:h,middlewares:y}).then((e=>{ce.current&&(Object.keys(e.tooltipStyles).length&&F(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&Z(e.tooltipArrowStyles),z(e.place))}))};c((()=>{be()}),[Y,q,H,L,d,p,h,R]),c((()=>{if(!(null==I?void 0:I.current))return()=>null;const e=new ResizeObserver((()=>{be()}));return e.observe(I.current),()=>{e.disconnect()}}),[H,null==I?void 0:I.current]),c((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...ne,t];q&&r.includes(q)||D(null!==(e=ne[0])&&void 0!==e?e:t)}),[a,ne,q]),c((()=>()=>{X.current&&clearTimeout(X.current),J.current&&clearTimeout(J.current)}),[]),c((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));ie(t)}catch(e){ie([])}}),[t,u]);const ge=!T&&H&&Y&&Object.keys(U).length>0;return Q?e.createElement(w,{id:t,role:"tooltip",className:s("react-tooltip",E.tooltip,E[n],o,`react-tooltip__place-${M}`,{[E.show]:ge,[E.fixed]:"fixed"===h,[E.clickable]:N}),style:{...L,...U},ref:B},H,e.createElement(w,{className:s("react-tooltip-arrow",E.arrow,l,{[E.noArrow]:x}),style:P,ref:K})):null},x=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),N=({id:t,anchorId:o,anchorSelect:l,content:n,html:a,render:s,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:h="div",children:f=null,events:y=["hover"],openOnClick:w=!1,positionStrategy:_="absolute",middlewares:b,delayShow:S=0,delayHide:A=0,float:k=!1,hidden:E=!1,noArrow:N=!1,clickable:O=!1,closeOnEsc:L=!1,style:R,position:$,isOpen:C,setIsOpen:H,afterShow:I,afterHide:W})=>{const[j,q]=r(n),[D,B]=r(a),[K,X]=r(v),[J,M]=r(p),[z,U]=r(m),[F,P]=r(S),[Z,Y]=r(A),[G,Q]=r(k),[V,ee]=r(E),[te,re]=r(h),[oe,le]=r(y),[ne,ie]=r(_),[ce,ae]=r(null),{anchorRefs:se,activeAnchor:ue}=g(t),de=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),pe=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:v)},content:e=>{q(null!=e?e:n)},html:e=>{B(null!=e?e:a)},variant:e=>{var t;M(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{U(null===e?m:Number(e))},wrapper:e=>{var t;re(null!==(t=e)&&void 0!==t?t:h)},events:e=>{const t=null==e?void 0:e.split(" ");le(null!=t?t:y)},"position-strategy":e=>{var t;ie(null!==(t=e)&&void 0!==t?t:_)},"delay-show":e=>{P(null===e?S:Number(e))},"delay-hide":e=>{Y(null===e?A:Number(e))},float:e=>{Q(null===e?k:"true"===e)},hidden:e=>{ee(null===e?E:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};c((()=>{q(n)}),[n]),c((()=>{B(a)}),[a]),c((()=>{X(v)}),[v]),c((()=>{M(p)}),[p]),c((()=>{U(m)}),[m]),c((()=>{P(S)}),[S]),c((()=>{Y(A)}),[A]),c((()=>{Q(k)}),[k]),c((()=>{ee(E)}),[E]),c((()=>{ie(_)}),[_]),c((()=>{var e;const r=new Set(se);let n=l;if(!n&&t&&(n=`[data-tooltip-id='${t}']`),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 i=document.querySelector(`[id='${o}']`);if(i&&r.add({current:i}),!r.size)return()=>null;const c=null!==(e=null!=ce?ce:i)&&void 0!==e?e:ue.current,a=new MutationObserver((e=>{e.forEach((e=>{var t;if(!c||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const r=de(c);pe(r)}))})),s={attributes:!0,childList:!1,subtree:!1};if(c){const e=de(c);pe(e),a.observe(c,s)}return()=>{a.disconnect()}}),[se,ue,ce,o,l]);let ve=f;const me=i(null);if(s){const t=s({content:null!=j?j:null,activeAnchor:ce});ve=t?e.createElement("div",{ref:me,className:"react-tooltip-content-wrapper"},t):null}else j&&(ve=j);D&&(ve=e.createElement(x,{content:D}));const he={id:t,anchorId:o,anchorSelect:l,className:u,classNameArrow:d,content:ve,contentWrapperRef:me,place:K,variant:J,offset:z,wrapper:te,events:oe,openOnClick:w,positionStrategy:ne,middlewares:b,delayShow:F,delayHide:Z,float:G,hidden:V,noArrow:N,clickable:O,closeOnEsc:L,style:R,position:$,isOpen:C,setIsOpen:H,afterShow:I,afterHide:W,activeAnchor:ce,setActiveAnchor:e=>ae(e)};return e.createElement(T,{...he})};export{N as Tooltip,b as TooltipProvider,S as TooltipWrapper};
|
|
8
|
-
|
|
7
|
+
import e,{createContext as t,useState as r,useCallback as o,useMemo as n,useContext as l,useRef as c,useEffect as i,useLayoutEffect as a}from"react";import s from"classnames";import{arrow as u,computePosition as d,offset as p,flip as v,shift as m}from"@floating-ui/dom";const h="react-tooltip-styles";function f(e,t=h,r){r||(r={});const{insertAt:o}=r;if(!e||"undefined"==typeof document||document.getElementById(h))return;const n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css","top"===o&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}function y(e=h){const t=document.getElementById(e);null==t||t.remove()}const w=(e,t,r)=>{let o=null;return function(...n){const l=()=>{o=null,r||e.apply(this,n)};r&&!o&&(e.apply(this,n),o=setTimeout(l,t)),r||(o&&clearTimeout(o),o=setTimeout(l,t))}},S="DEFAULT_TOOLTIP_ID",g={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},A=t({getTooltipData:()=>g}),_=({children:t})=>{const[l,c]=r({[S]:new Set}),[i,a]=r({[S]:{current:null}}),s=(e,...t)=>{c((r=>{var o;const n=null!==(o=r[e])&&void 0!==o?o:new Set;return t.forEach((e=>n.add(e))),{...r,[e]:new Set(n)}}))},u=(e,...t)=>{c((r=>{const o=r[e];return o?(t.forEach((e=>o.delete(e))),{...r}):r}))},d=o(((e=S)=>{var t,r;return{anchorRefs:null!==(t=l[e])&&void 0!==t?t:new Set,activeAnchor:null!==(r=i[e])&&void 0!==r?r:{current:null},attach:(...t)=>s(e,...t),detach:(...t)=>u(e,...t),setActiveAnchor:t=>((e,t)=>{a((r=>{var o;return(null===(o=r[e])||void 0===o?void 0:o.current)===t.current?r:{...r,[e]:t}}))})(e,t)}}),[l,i,s,u]),p=n((()=>({getTooltipData:d})),[d]);return e.createElement(A.Provider,{value:p},t)};function b(e=S){return l(A).getTooltipData(e)}const E=({tooltipId:t,children:r,className:o,place:n,content:l,html:a,variant:u,offset:d,wrapper:p,events:v,positionStrategy:m,delayShow:h,delayHide:f})=>{const{attach:y,detach:w}=b(t),S=c(null);return i((()=>(y(S),()=>{w(S)})),[]),e.createElement("span",{ref:S,className:s("react-tooltip-wrapper",o),"data-tooltip-place":n,"data-tooltip-content":l,"data-tooltip-html":a,"data-tooltip-variant":u,"data-tooltip-offset":d,"data-tooltip-wrapper":p,"data-tooltip-events":v,"data-tooltip-position-strategy":m,"data-tooltip-delay-show":h,"data-tooltip-delay-hide":f},r)},T="undefined"!=typeof window?a:i,O=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:r=null,place:o="top",offset:n=10,strategy:l="absolute",middlewares:c=[p(Number(n)),v(),m({padding:5})]})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{},place:o};const i=c;return r?(i.push(u({element:r,padding:5})),d(e,t,{placement:o,strategy:l,middleware:i}).then((({x:e,y:t,placement:r,middlewareData:o})=>{var n,l;const c={left:`${e}px`,top:`${t}px`},{x:i,y:a}=null!==(n=o.arrow)&&void 0!==n?n:{x:0,y:0};return{tooltipStyles:c,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[null!==(l={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]])&&void 0!==l?l:"bottom"]:"-4px"},place:r}}))):d(e,t,{placement:"bottom",strategy:l,middleware:i}).then((({x:e,y:t,placement:r})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:r})))};var k="core-styles-module_tooltip__3vRRp",N="core-styles-module_fixed__pcSol",x="core-styles-module_arrow__cvMwQ",R="core-styles-module_noArrow__xock6",L="core-styles-module_clickable__ZuTTB",$="core-styles-module_show__Nt9eE",I={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 C=({id:t,className:o,classNameArrow:n,variant:l="dark",anchorId:a,anchorSelect:u,place:d="top",offset:p=10,events:v=["hover"],openOnClick:m=!1,positionStrategy:h="absolute",middlewares:f,wrapper:y,delayShow:S=0,delayHide:g=0,float:A=!1,hidden:_=!1,noArrow:E=!1,clickable:C=!1,closeOnEsc:H=!1,closeOnScroll:j=!1,closeOnResize:q=!1,style:z,position:B,afterShow:D,afterHide:W,content:M,contentWrapperRef:K,isOpen:X,setIsOpen:F,activeAnchor:P,setActiveAnchor:Z})=>{const J=c(null),Q=c(null),U=c(null),Y=c(null),[G,V]=r(d),[ee,te]=r({}),[re,oe]=r({}),[ne,le]=r(!1),[ce,ie]=r(!1),ae=c(!1),se=c(null),{anchorRefs:ue,setActiveAnchor:de}=b(t),pe=c(!1),[ve,me]=r([]),he=c(!1),fe=m||v.includes("click");T((()=>(he.current=!0,()=>{he.current=!1})),[]),i((()=>{if(!ne){const e=setTimeout((()=>{ie(!1)}),150);return()=>{clearTimeout(e)}}return()=>null}),[ne]);const ye=e=>{he.current&&(e&&ie(!0),setTimeout((()=>{he.current&&(null==F||F(e),void 0===X&&le(e))}),10))};i((()=>{if(void 0===X)return()=>null;X&&ie(!0);const e=setTimeout((()=>{le(X)}),10);return()=>{clearTimeout(e)}}),[X]),i((()=>{ne!==ae.current&&(ae.current=ne,ne?null==D||D():null==W||W())}),[ne]);const we=(e=g)=>{Y.current&&clearTimeout(Y.current),Y.current=setTimeout((()=>{pe.current||ye(!1)}),e)},Se=e=>{var t;if(!e)return;const r=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==r?void 0:r.isConnected))return Z(null),void de({current:null});S?(U.current&&clearTimeout(U.current),U.current=setTimeout((()=>{ye(!0)}),S)):ye(!0),Z(r),de({current:r}),Y.current&&clearTimeout(Y.current)},ge=()=>{C?we(g||100):g?we():ye(!1),U.current&&clearTimeout(U.current)},Ae=({x:e,y:t})=>{O({place:d,offset:p,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:J.current,tooltipArrowReference:Q.current,strategy:h,middlewares:f}).then((e=>{Object.keys(e.tooltipStyles).length&&te(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&oe(e.tooltipArrowStyles),V(e.place)}))},_e=e=>{if(!e)return;const t=e,r={x:t.clientX,y:t.clientY};Ae(r),se.current=r},be=e=>{Se(e),g&&we()},Ee=e=>{var t;[document.querySelector(`[id='${a}']`),...ve].some((t=>null==t?void 0:t.contains(e.target)))||(null===(t=J.current)||void 0===t?void 0:t.contains(e.target))||ye(!1)},Te=e=>{"Escape"===e.key&&ye(!1)},Oe=w(Se,50,!0),ke=w(ge,50,!0);i((()=>{var e,t;const r=new Set(ue);ve.forEach((e=>{r.add({current:e})}));const o=document.querySelector(`[id='${a}']`);o&&r.add({current:o}),j&&window.addEventListener("scroll",ke),q&&window.addEventListener("resize",ke),H&&window.addEventListener("keydown",Te);const n=[];fe?(window.addEventListener("click",Ee),n.push({event:"click",listener:be})):(n.push({event:"mouseenter",listener:Oe},{event:"mouseleave",listener:ke},{event:"focus",listener:Oe},{event:"blur",listener:ke}),A&&n.push({event:"mousemove",listener:_e}));const l=()=>{pe.current=!0},c=()=>{pe.current=!1,ge()};return C&&!fe&&(null===(e=J.current)||void 0===e||e.addEventListener("mouseenter",l),null===(t=J.current)||void 0===t||t.addEventListener("mouseleave",c)),n.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.addEventListener(e,t)}))})),()=>{var e,t;j&&window.removeEventListener("scroll",ke),q&&window.removeEventListener("resize",ke),fe&&window.removeEventListener("click",Ee),H&&window.removeEventListener("keydown",Te),C&&!fe&&(null===(e=J.current)||void 0===e||e.removeEventListener("mouseenter",l),null===(t=J.current)||void 0===t||t.removeEventListener("mouseleave",c)),n.forEach((({event:e,listener:t})=>{r.forEach((r=>{var o;null===(o=r.current)||void 0===o||o.removeEventListener(e,t)}))}))}}),[ce,ue,ve,H,v]),i((()=>{let e=null!=u?u:"";!e&&t&&(e=`[data-tooltip-id='${t}']`);const r=new MutationObserver((r=>{const o=[];r.forEach((r=>{if("attributes"===r.type&&"data-tooltip-id"===r.attributeName){r.target.getAttribute("data-tooltip-id")===t&&o.push(r.target)}if("childList"===r.type&&(P&&[...r.removedNodes].some((e=>{var t;return!!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,P))&&(ie(!1),ye(!1),Z(null),!0)})),e))try{const t=[...r.addedNodes].filter((e=>1===e.nodeType));o.push(...t.filter((t=>t.matches(e)))),o.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch(e){}})),o.length&&me((e=>[...e,...o]))}));return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"]}),()=>{r.disconnect()}}),[t,u,P]);const Ne=()=>{B?Ae(B):A?se.current&&Ae(se.current):O({place:d,offset:p,elementReference:P,tooltipReference:J.current,tooltipArrowReference:Q.current,strategy:h,middlewares:f}).then((e=>{he.current&&(Object.keys(e.tooltipStyles).length&&te(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&oe(e.tooltipArrowStyles),V(e.place))}))};i((()=>{Ne()}),[ne,P,M,z,d,p,h,B]),i((()=>{if(!(null==K?void 0:K.current))return()=>null;const e=new ResizeObserver((()=>{Ne()}));return e.observe(K.current),()=>{e.disconnect()}}),[M,null==K?void 0:K.current]),i((()=>{var e;const t=document.querySelector(`[id='${a}']`),r=[...ve,t];P&&r.includes(P)||Z(null!==(e=ve[0])&&void 0!==e?e:t)}),[a,ve,P]),i((()=>()=>{U.current&&clearTimeout(U.current),Y.current&&clearTimeout(Y.current)}),[]),i((()=>{let e=u;if(!e&&t&&(e=`[data-tooltip-id='${t}']`),e)try{const t=Array.from(document.querySelectorAll(e));me(t)}catch(e){me([])}}),[t,u]);const xe=!_&&M&&ne&&Object.keys(ee).length>0;return ce?e.createElement(y,{id:t,role:"tooltip",className:s("react-tooltip",k,I[l],o,`react-tooltip__place-${G}`,{[$]:xe,[N]:"fixed"===h,[L]:C}),style:{...z,...ee},ref:J},M,e.createElement(y,{className:s("react-tooltip-arrow",x,I.arrow,n,{[R]:E}),style:re,ref:Q})):null},H=({content:t})=>e.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),j=({id:t,anchorId:o,anchorSelect:n,content:l,html:a,render:s,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:h="div",children:f=null,events:y=["hover"],openOnClick:w=!1,positionStrategy:S="absolute",middlewares:g,delayShow:A=0,delayHide:_=0,float:E=!1,hidden:T=!1,noArrow:O=!1,clickable:k=!1,closeOnEsc:N=!1,closeOnScroll:x=!1,closeOnResize:R=!1,style:L,position:$,isOpen:I,setIsOpen:j,afterShow:q,afterHide:z})=>{const[B,D]=r(l),[W,M]=r(a),[K,X]=r(v),[F,P]=r(p),[Z,J]=r(m),[Q,U]=r(A),[Y,G]=r(_),[V,ee]=r(E),[te,re]=r(T),[oe,ne]=r(h),[le,ce]=r(y),[ie,ae]=r(S),[se,ue]=r(null),{anchorRefs:de,activeAnchor:pe}=b(t),ve=e=>null==e?void 0:e.getAttributeNames().reduce(((t,r)=>{var o;if(r.startsWith("data-tooltip-")){t[r.replace(/^data-tooltip-/,"")]=null!==(o=null==e?void 0:e.getAttribute(r))&&void 0!==o?o:null}return t}),{}),me=e=>{const t={place:e=>{var t;X(null!==(t=e)&&void 0!==t?t:v)},content:e=>{D(null!=e?e:l)},html:e=>{M(null!=e?e:a)},variant:e=>{var t;P(null!==(t=e)&&void 0!==t?t:p)},offset:e=>{J(null===e?m:Number(e))},wrapper:e=>{var t;ne(null!==(t=e)&&void 0!==t?t:h)},events:e=>{const t=null==e?void 0:e.split(" ");ce(null!=t?t:y)},"position-strategy":e=>{var t;ae(null!==(t=e)&&void 0!==t?t:S)},"delay-show":e=>{U(null===e?A:Number(e))},"delay-hide":e=>{G(null===e?_:Number(e))},float:e=>{ee(null===e?E:"true"===e)},hidden:e=>{re(null===e?T:"true"===e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,r])=>{var o;null===(o=t[e])||void 0===o||o.call(t,r)}))};i((()=>{D(l)}),[l]),i((()=>{M(a)}),[a]),i((()=>{X(v)}),[v]),i((()=>{P(p)}),[p]),i((()=>{J(m)}),[m]),i((()=>{U(A)}),[A]),i((()=>{G(_)}),[_]),i((()=>{ee(E)}),[E]),i((()=>{re(T)}),[T]),i((()=>{ae(S)}),[S]),i((()=>{var e;const r=new Set(de);let l=n;if(!l&&t&&(l=`[data-tooltip-id='${t}']`),l)try{document.querySelectorAll(l).forEach((e=>{r.add({current:e})}))}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`)}const c=document.querySelector(`[id='${o}']`);if(c&&r.add({current:c}),!r.size)return()=>null;const i=null!==(e=null!=se?se:c)&&void 0!==e?e:pe.current,a=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 r=ve(i);me(r)}))})),s={attributes:!0,childList:!1,subtree:!1};if(i){const e=ve(i);me(e),a.observe(i,s)}return()=>{a.disconnect()}}),[de,pe,se,o,n]);let he=f;const fe=c(null);if(s){const t=s({content:null!=B?B:null,activeAnchor:se});he=t?e.createElement("div",{ref:fe,className:"react-tooltip-content-wrapper"},t):null}else B&&(he=B);W&&(he=e.createElement(H,{content:W}));const ye={id:t,anchorId:o,anchorSelect:n,className:u,classNameArrow:d,content:he,contentWrapperRef:fe,place:K,variant:F,offset:Z,wrapper:oe,events:le,openOnClick:w,positionStrategy:ie,middlewares:g,delayShow:Q,delayHide:Y,float:V,hidden:te,noArrow:O,clickable:k,closeOnEsc:N,closeOnScroll:x,closeOnResize:R,style:L,position:$,isOpen:I,setIsOpen:j,afterShow:q,afterHide:z,activeAnchor:se,setActiveAnchor:e=>ue(e)};return e.createElement(C,{...ye})};f(`: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;width:max-content;position:absolute;top:0;left:0;padding:8px 16px;border-radius:3px;font-size:90%;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)}`,"react-tooltip-core-styles"),f(`
|
|
8
|
+
.styles-module_arrow__K0L3T{width:8px;height:8px;transform:rotate(45deg)}.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)}`);export{j as Tooltip,_ as TooltipProvider,E as TooltipWrapper,y as removeStyle};
|