mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
3 lines
8.7 KiB
JavaScript
3 lines
8.7 KiB
JavaScript
|
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),o=t(e),n=t(require("react-dom"));function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t}).apply(this,arguments)}var i="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,a={popupContent:{tooltip:{position:"absolute",zIndex:999},modal:{position:"relative",margin:"auto"}},popupArrow:{height:"8px",width:"16px",position:"absolute",background:"transparent",color:"#FFF",zIndex:-1},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",zIndex:999},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",display:"flex",zIndex:999}}},u=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],l=function(t,e,o,n,r){var i=r.offsetX,a=r.offsetY,u=n?8:0,l=o.split(" "),c=e.height,f=e.width,s=t.top+t.height/2-c/2,d=t.left+t.width/2-f/2,p="",v="0%",m="0%";switch(l[0]){case"top":s-=c/2+t.height/2+u,p="rotate(180deg) translateX(50%)",v="100%",m="50%";break;case"bottom":s+=c/2+t.height/2+u,p="rotate(0deg) translateY(-100%) translateX(-50%)",m="50%";break;case"left":d-=f/2+t.width/2+u,p=" rotate(90deg) translateY(50%) translateX(-25%)",m="100%",v="50%";break;case"right":d+=f/2+t.width/2+u,p="rotate(-90deg) translateY(-150%) translateX(25%)",v="50%"}switch(l[1]){case"top":s=t.top,v=t.height/2+"px";break;case"bottom":s=t.top-c+t.height,v=c-t.height/2+"px";break;case"left":d=t.left,m=t.width/2+"px";break;case"right":d=t.left-f+t.width,m=f-t.width/2+"px"}return{top:s="top"===l[0]?s-a:s+a,left:d="left"===l[0]?d-i:d+i,transform:p,arrowLeft:m,arrowTop:v}},c=0,f=e.forwardRef((function(t,f){var s=t.trigger,d=void 0===s?null:s,p=t.onOpen,v=void 0===p?function(){}:p,m=t.onClose,h=void 0===m?function(){}:m,y=t.defaultOpen,g=t.open,w=void 0===g?void 0:g,b=t.disabled,E=void 0!==b&&b,k=t.nested,x=void 0!==k&&k,L=t.closeOnDocumentClick,A=void 0===L||L,C=t.repositionOnResize,T=void 0===C||C,O=t.closeOnEscape,R=void 0===O||O,S=t.on,X=void 0===S?["click"]:S,P=t.contentStyle,Y=void 0===P?{}:P,j=t.arrowStyle,z=void 0===j?{}:j,B=t.overlayStyle,I=void 0===B?{}:B,D=t.className,M=void 0===D?"":D,N=t.position,q=void 0===N?"bottom center":N,F=t.modal,H=void 0!==F&&F,_=t.lockScroll,K=void 0!==_&&_,W=t.arrow,G=void 0===W||W,J=t.offsetX,Q=void 0===J?0:J,U=t.offsetY,V=void 0===U?0:U,Z=t.mouseEnterDelay,$=void 0===Z?100:Z,tt=t.mouseLeaveDelay,et=void 0===tt?100:tt,ot=t.keepTooltipInside,nt=void 0!==ot&&ot,rt=t.children,it=e.useState(w||void 0!==y&&y),at=it[0],ut=it[1],lt=e.useRef(null),ct=e.useRef(null),ft=e.useRef(null),st=e.useRef(null),dt=e.useRef("popup-"+ ++c),pt=!!H||!d,vt=e.useRef(0);i((function(){return at?(st.current=document.activeElement,Ct(),xt(),Et()):kt(),function(){clearTimeout(vt.current)}}),[at]),e.useEffect((function(){"boolean"==typeof w&&(w?mt():ht())}),[w,E]);var mt=function(t){at||E||(ut(!0),setTimeout((function(){return v(t)}),0))},ht=function(t){var e;at&&!E&&(ut(!1),pt&&(null===(e=st.current)||void 0===e||e.focus()),setTimeout((function(){return h(t)}),0))},yt=function(t){null==t||t.stopPropagation(),at?ht(t):mt(t)},gt=function(t){clearTimeout(vt.current),vt.current=setTimeout((function(){return mt(t)}),$)},wt=function(t){null==t||t.preventDefault(),yt()},bt=function(t){clearTimeout(vt.current),vt.current=setTimeout((function(){return ht(t)}),et)},Et=function(){pt&&K&&(document.getElementsByTagName("body")[0].style.overflow="hidden")},kt=function(){pt&&K&&(document.getElementsByTagName("body")[0].style.overflow="auto")},xt=function(){var t,e=null==ct||null===(t=ct.current)||void 0===t?void 0:t.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),o=Array.prototype.slice.call(e)[0];null==o||o.focus()};e.useImperativeHandle(f,(functi
|
||
|
//# sourceMappingURL=reactjs-popup.cjs.production.min.js.map
|