react-element-popper
Advanced tools
Comparing version 1.0.8 to 1.0.10
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ElementPopper=e(t.React)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=e(t);function r(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function n(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,r)}return o}function i(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?n(Object(o),!0).forEach((function(e){r(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var o=[],r=!0,n=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(o.push(l.value),!e||o.length!==e);r=!0);}catch(t){n=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,r=new Array(e);o<e;o++)r[o]=t[o];return r}function c(e,r){var n=e.element,l=e.popper,a=e.position,c=void 0===a?"bottom-center":a,f=e.containerStyle,s=e.containerClassName,d=void 0===s?"":s,p=e.arrow,h=e.arrowStyle,m=void 0===h?{}:h,b=e.arrowClassName,v=void 0===b?"":b,y=e.fixMainPosition,g=e.fixRelativePosition,w=e.offsetY,O=e.offsetX,x=e.animation,j=e.zIndex,E=void 0===j?0:j,P=e.popperShadow,M=e.onChange,S=e.active,C=void 0===S||S,N=t.useRef(),T=t.useRef(),L=t.useRef(),A={visibility:"hidden",left:"0",top:"0",position:"absolute"},R=t.useMemo((function(){return!0===p}),[p]),z=t.useMemo((function(){return l&&!0===C}),[l,C]),I=t.useCallback((function(){return{position:c,fixMainPosition:y,fixRelativePosition:g,offsetY:w,offsetX:O,defaultArrow:R,animation:x,zIndex:E,onChange:M}}),[c,y,g,w,O,R,x,M,E]),X=t.useCallback((function(){L.current&&(L.current.style.transition=""),T.current&&(T.current.parentNode.style.transition="")}),[]);return t.useEffect((function(){if(!z)return X(),T.current.parentNode.style.visibility="hidden",void(L.current&&(L.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(N.current)||(t&&X(),u(N,T,L,I(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[z,I,X]),o.default.createElement("div",{ref:function(t){if(t&&(t.removeTransition=X,t.refreshPosition=function(){return setTimeout((function(){return u(N,T,L,I(),{})}),10)}),N.current=t,r instanceof Function)return r(t);r&&(r.current=t)},className:d,style:i({display:"inline-block",height:"max-content"},f)},n,!0===p&&z?o.default.createElement("div",{ref:L,className:"ep-arrow ".concat(P?"ep-shadow":""," ").concat(v),style:i(i({},A),m)}):t.isValidElement(p)&&z?o.default.createElement("div",{ref:L,style:i(i({},A),m)},p):null,o.default.createElement("div",{className:P?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:E}},o.default.createElement("div",{ref:T},l)))}function u(t,e,o,r,n){var i=r.position,a=r.fixMainPosition,c=r.fixRelativePosition,u=r.offsetY,p=void 0===u?0:u,h=r.offsetX,m=void 0===h?0:h,b=r.defaultArrow,v=r.animation,y=r.zIndex,g=r.onChange;if(t.current&&e.current){var w,O,x,j,E=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),P=E.scrollLeft,M=E.scrollTop,S=f(t.current,P,M),C=S.top,N=S.left,T=S.height,L=S.width,A=S.right,R=S.bottom,z=f(e.current,P,M),I=z.top,X=z.left,Y=z.height,k=z.width,D=document.documentElement,H=D.clientHeight,W=D.clientWidth,F=e.current.parentNode,q=function(t){if(!t)return[0,0];var e=l((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),o=e[1],r=void 0===o?0:o,n=e[2];return[r,void 0===n?0:n]}(F),B=l(q,2),U=B[0],V=B[1],$=function(t){var e=l(t.split("-"),2),o=e[0],r=void 0===o?"bottom":o,n=e[1],i=void 0===n?"center":n;"auto"===r&&(r="bottom");"auto"===i&&(i="center");var a="top"===r||"bottom"===r,c="left"===r||"right"===r;c&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));a&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[r,i,a,c]}(i),G=l($,4),J=G[0],K=G[1],Q=G[2],Z=G[3],_=J,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=L-k,ot=T-Y,rt="left"===K?0:"right"===K?et:et/2,nt=et-rt,it="top"===K?0:"bottom"===K?ot:ot/2,lt=ot-it,at=N-X+U,ct=C-I+V,ut=0,ft=0,st=s(t.current),dt=[],pt=o.current,ht=f(pt,P,M)||{},mt=ht.height,bt=void 0===mt?0:mt,vt=ht.width,yt=void 0===vt?0:vt,gt=at,wt=ct,Ot=0,xt=0;for(Q&&(at+=rt,ct+="top"===J?-Y:T,b&&(bt=11,yt=20)),Z&&(at+="left"===J?-k:L,ct+=it,b&&(bt=20,yt=11));st;)dt.push(st),jt(f(st,P,M)),st=s(st.parentNode);if(jt({top:M,bottom:M+H,left:P,right:P+W,height:H,width:W}),Q&&(ct+="bottom"===_?p:-p),Z&&(at+="right"===_?m:-m),v&&!n&&(Q&&(xt="bottom"===_?10:-10),Z&&(Ot="right"===_?10:-10)),at=at-ut+Ot,ct=ct-ft+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[_],pt)Q&&((j=L<k)?gt+=L/2:gt=at+k/2,gt-=yt/2,"bottom"===_&&(wt=ct,ct+=bt),"top"===_&&(wt=(ct-=bt)+Y),ut<0&&ut-rt<0&&(j?gt+=(rt-ut)/2:L-rt+ut<k&&(gt+=(L-rt+ut-k)/2)),ut>0&&ut+nt>0&&(j?gt-=(ut+nt)/2:L-ut-nt<k&&(gt-=(L-ut-nt-k)/2))),Z&&((j=T<Y)?wt+=T/2:wt=ct+Y/2,wt-=bt/2,"left"===_&&(gt=(at-=yt)+k),"right"===_&&(gt=at,at+=yt),ft<0&&ft-it<0&&(j?wt+=(it-ft)/2:T-it+ft<Y&&(wt+=(T-it+ft-Y)/2)),ft>0&&ft+lt>0&&(j?wt-=(ft+lt)/2:T-ft-lt<Y&&(wt-=(T-ft-lt-Y)/2))),pt.setAttribute("direction",w),pt.style.height=bt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;F.style.transform=tt(at,ct),F.style.visibility="visible",!n&&v&&setTimeout((function(){F.style.transition=".4s",F.style.transform=tt(at-Ot,ct-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),g instanceof Function&&g({popper:{top:ct,bottom:ct+Y,left:at,right:at+k,height:Y,width:k},element:{top:C,bottom:R,left:N,right:A,height:T,width:L},arrow:{top:wt,bottom:wt+bt,left:gt,right:gt+yt,height:bt,width:yt,direction:w},position:_+"-"+(0!==ut?"auto":K),scroll:{scrollLeft:P,scrollTop:M},scrollableParents:dt,event:n})}function jt(t){var e=t.top,o=t.bottom,r=t.left,n=t.right,i=t.height,l=t.width;if(Q){var u=Math.round(C-e+T/2),f=Math.round(i/2);a||(C-(Y+p+bt)<e&&u<=f&&"top"===_?(ct+=Y+T,_="bottom"):R+Y+p+bt>i+e&&u>=f&&"bottom"===_&&(ct-=Y+T,_="top")),c||(N+rt<r&&(ut=d(A-yt>r?N+rt-r:-L+rt+yt,ut)),A-nt>n&&(ut=d(N+yt<n?A-nt-n:L-nt-yt,ut)))}if(Z){var s=Math.round(N-r+L/2),h=Math.round(l/2);a||(N-(k+m+yt)<r&&s<h&&"left"===_?(at+=L+k,_="right"):A+k+m+yt>n&&s>h&&"right"===_&&(at-=L+k,_="left")),c||(C+it<e&&(ft=d(R-bt>e?C+it-e:-T+it+bt,ft)),R-lt>o&&(ft=d(C+bt<o?R-lt-o:T-lt-bt,ft)))}}}function f(t,e,o){if(t){var r=t.getBoundingClientRect(),n=r.top,i=r.left,l=r.width,a=r.height,c=n+o,u=i+e;return{top:c,bottom:c+a,left:u,right:u+l,width:l,height:a}}}function s(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),o=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&o(e.overflowX)||t.clientWidth<t.scrollWidth&&o(e.overflowY)?t:s(t.parentNode)}}function d(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}return t.forwardRef(c)})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ElementPopper=e(t.React)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=e(t);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==r)return;var o,n,i=[],l=!0,a=!1;try{for(r=r.call(t);!(l=(o=r.next()).done)&&(i.push(o.value),!e||i.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function u(e,o){var i=e.element,l=e.popper,a=e.position,u=void 0===a?"bottom-center":a,f=e.containerStyle,s=e.containerClassName,d=void 0===s?"":s,p=e.arrow,h=e.arrowStyle,m=void 0===h?{}:h,b=e.arrowClassName,v=void 0===b?"":b,y=e.fixMainPosition,g=e.fixRelativePosition,w=e.offsetY,O=e.offsetX,x=e.animation,E=e.zIndex,P=void 0===E?0:E,j=e.popperShadow,M=e.onChange,C=e.active,S=void 0===C||C,N=t.useRef(),T=t.useRef(),L=t.useRef(),A={visibility:"hidden",left:"0",top:"0",position:"absolute"},R=t.useMemo((function(){return!0===p}),[p]),z=t.useMemo((function(){return l&&!0===S}),[l,S]),I=t.useCallback((function(){return{position:u,fixMainPosition:y,fixRelativePosition:g,offsetY:w,offsetX:O,defaultArrow:R,animation:x,zIndex:P,onChange:M}}),[u,y,g,w,O,R,x,M,P]),X=t.useCallback((function(){L.current&&(L.current.style.transition=""),T.current&&(T.current.parentNode.style.transition="")}),[]);return t.useEffect((function(){if(!z)return X(),T.current.parentNode.style.visibility="hidden",void(L.current&&(L.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(N.current)||(t&&X(),c(N,T,L,I(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[z,I,X]),r.default.createElement("div",{ref:function(t){if(t&&(t.removeTransition=X,t.refreshPosition=function(){return setTimeout((function(){return c(N,T,L,I(),{})}),10)}),N.current=t,o instanceof Function)return o(t);o&&(o.current=t)},className:d,style:n({display:"inline-block",height:"max-content"},f)},i,!0===p&&z?r.default.createElement("div",{ref:L,className:"ep-arrow ".concat(j?"ep-shadow":""," ").concat(v),style:n(n({},A),m)}):t.isValidElement(p)&&z?r.default.createElement("div",{ref:L,style:n(n({},A),m)},p):null,r.default.createElement("div",{className:j?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:P}},r.default.createElement("div",{ref:T},l)))}function c(t,e,r,o,n){var i=o.position,a=o.fixMainPosition,u=o.fixRelativePosition,c=o.offsetY,p=void 0===c?0:c,h=o.offsetX,m=void 0===h?0:h,b=o.defaultArrow,v=o.animation,y=o.zIndex,g=o.onChange;if(t.current&&e.current){var w,O,x,E,P=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),j=P.scrollLeft,M=P.scrollTop,C=f(t.current,j,M),S=C.top,N=C.left,T=C.height,L=C.width,A=C.right,R=C.bottom,z=f(e.current,j,M),I=z.top,X=z.left,Y=z.height,k=z.width,D=document.documentElement,H=D.clientHeight,W=D.clientWidth,q=e.current.parentNode,B=function(t){if(!t)return[0,0];var e=l((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),r=e[1],o=void 0===r?0:r,n=e[2];return[o,void 0===n?0:n]}(q),F=l(B,2),U=F[0],V=F[1],$=function(t){var e=l(t.split("-"),2),r=e[0],o=void 0===r?"bottom":r,n=e[1],i=void 0===n?"center":n;"auto"===o&&(o="bottom");"auto"===i&&(i="center");var a="top"===o||"bottom"===o,u="left"===o||"right"===o;u&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));a&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[o,i,a,u]}(i),G=l($,4),J=G[0],K=G[1],Q=G[2],Z=G[3],_=J,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=L-k,rt=T-Y,ot="left"===K?0:"right"===K?et:et/2,nt=et-ot,it="top"===K?0:"bottom"===K?rt:rt/2,lt=rt-it,at=N-X+U,ut=S-I+V,ct=0,ft=0,st=s(t.current),dt=[],pt=r.current,ht=f(pt,j,M)||{},mt=ht.height,bt=void 0===mt?0:mt,vt=ht.width,yt=void 0===vt?0:vt,gt=at,wt=ut,Ot=0,xt=0;for(Q&&(at+=ot,ut+="top"===J?-Y:T,b&&(bt=11,yt=20)),Z&&(at+="left"===J?-k:L,ut+=it,b&&(bt=20,yt=11));st;)dt.push(st),Et(f(st,j,M)),st=s(st.parentNode);if(Et({top:M,bottom:M+H,left:j,right:j+W,height:H,width:W}),Q&&(ut+="bottom"===_?p:-p),Z&&(at+="right"===_?m:-m),v&&!n&&(Q&&(xt="bottom"===_?10:-10),Z&&(Ot="right"===_?10:-10)),at=at-ct+Ot,ut=ut-ft+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[_],pt)Q&&((E=L<k)?gt+=L/2:gt=at+k/2,gt-=yt/2,"bottom"===_&&(wt=ut,ut+=bt),"top"===_&&(wt=(ut-=bt)+Y),ct<0&&ct-ot<0&&(E?gt+=(ot-ct)/2:L-ot+ct<k&&(gt+=(L-ot+ct-k)/2)),ct>0&&ct+nt>0&&(E?gt-=(ct+nt)/2:L-ct-nt<k&&(gt-=(L-ct-nt-k)/2))),Z&&((E=T<Y)?wt+=T/2:wt=ut+Y/2,wt-=bt/2,"left"===_&&(gt=(at-=yt)+k),"right"===_&&(gt=at,at+=yt),ft<0&&ft-it<0&&(E?wt+=(it-ft)/2:T-it+ft<Y&&(wt+=(T-it+ft-Y)/2)),ft>0&&ft+lt>0&&(E?wt-=(ft+lt)/2:T-ft-lt<Y&&(wt-=(T-ft-lt-Y)/2))),pt.setAttribute("direction",w),pt.style.height=bt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;q.style.transform=tt(at,ut),q.style.visibility="visible",!n&&v&&setTimeout((function(){q.style.transition=".4s",q.style.transform=tt(at-Ot,ut-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),null==g||g({popper:{top:ut,bottom:ut+Y,left:at,right:at+k,height:Y,width:k},element:{top:S,bottom:R,left:N,right:A,height:T,width:L},arrow:{top:wt,bottom:wt+bt,left:gt,right:gt+yt,height:bt,width:yt,direction:w},position:_+"-"+(0!==ct?"auto":K),scroll:{scrollLeft:j,scrollTop:M},scrollableParents:dt,event:n})}function Et(t){var e=t.top,r=t.bottom,o=t.left,n=t.right,i=t.height,l=t.width;if(Q){var c=Math.round(S-e+T/2),f=Math.round(i/2);a||(S-(Y+p+bt)<e&&c<=f&&"top"===_?(ut+=Y+T,_="bottom"):R+Y+p+bt>i+e&&c>=f&&"bottom"===_&&(ut-=Y+T,_="top")),u||(N+ot<o&&(ct=d(A-yt>o?N+ot-o:-L+ot+yt,ct)),A-nt>n&&(ct=d(N+yt<n?A-nt-n:L-nt-yt,ct)))}if(Z){var s=Math.round(N-o+L/2),h=Math.round(l/2);a||(N-(k+m+yt)<o&&s<h&&"left"===_?(at+=L+k,_="right"):A+k+m+yt>n&&s>h&&"right"===_&&(at-=L+k,_="left")),u||(S+it<e&&(ft=d(R-bt>e?S+it-e:-T+it+bt,ft)),R-lt>r&&(ft=d(S+bt<r?R-lt-r:T-lt-bt,ft)))}}}function f(t,e,r){if(t){var o=t.getBoundingClientRect(),n=o.top,i=o.left,l=o.width,a=o.height,u=n+r,c=i+e;return{top:u,bottom:u+a,left:c,right:c+l,width:l,height:a}}}function s(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),r=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&r(e.overflowX)||t.clientWidth<t.scrollWidth&&r(e.overflowY)?t:s(t.parentNode)}}function d(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}return t.forwardRef(u)})); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=e(t);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],o=!0,n=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(o=(l=a.next()).done)&&(r.push(l.value),!e||r.length!==e);o=!0);}catch(t){n=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(n)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function c(e,o){var n=e.element,l=e.popper,a=e.position,c=void 0===a?"bottom-center":a,u=e.containerStyle,f=e.containerClassName,d=void 0===f?"":f,p=e.arrow,h=e.arrowStyle,m=void 0===h?{}:h,b=e.arrowClassName,v=void 0===b?"":b,y=e.fixMainPosition,g=e.fixRelativePosition,w=e.offsetY,O=e.offsetX,x=e.animation,j=e.zIndex,P=void 0===j?0:j,E=e.popperShadow,M=e.onChange,S=e.active,C=void 0===S||S,N=t.useRef(),L=t.useRef(),T=t.useRef(),A={visibility:"hidden",left:"0",top:"0",position:"absolute"},z=t.useMemo((function(){return!0===p}),[p]),I=t.useMemo((function(){return l&&!0===C}),[l,C]),R=t.useCallback((function(){return{position:c,fixMainPosition:y,fixRelativePosition:g,offsetY:w,offsetX:O,defaultArrow:z,animation:x,zIndex:P,onChange:M}}),[c,y,g,w,O,z,x,M,P]),X=t.useCallback((function(){T.current&&(T.current.style.transition=""),L.current&&(L.current.parentNode.style.transition="")}),[]);return t.useEffect((function(){if(!I)return X(),L.current.parentNode.style.visibility="hidden",void(T.current&&(T.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(N.current)||(t&&X(),s(N,L,T,R(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[I,R,X]),r.default.createElement("div",{ref:function(t){if(t&&(t.removeTransition=X,t.refreshPosition=function(){return setTimeout((function(){return s(N,L,T,R(),{})}),10)}),N.current=t,o instanceof Function)return o(t);o&&(o.current=t)},className:d,style:i({display:"inline-block",height:"max-content"},u)},n,!0===p&&I?r.default.createElement("div",{ref:T,className:"ep-arrow ".concat(E?"ep-shadow":""," ").concat(v),style:i(i({},A),m)}):t.isValidElement(p)&&I?r.default.createElement("div",{ref:T,style:i(i({},A),m)},p):null,r.default.createElement("div",{className:E?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:P}},r.default.createElement("div",{ref:L},l)))}var u=t.forwardRef(c);function s(t,e,r,o,n){var i=o.position,a=o.fixMainPosition,c=o.fixRelativePosition,u=o.offsetY,s=void 0===u?0:u,h=o.offsetX,m=void 0===h?0:h,b=o.defaultArrow,v=o.animation,y=o.zIndex,g=o.onChange;if(t.current&&e.current){var w,O,x,j,P=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),E=P.scrollLeft,M=P.scrollTop,S=f(t.current,E,M),C=S.top,N=S.left,L=S.height,T=S.width,A=S.right,z=S.bottom,I=f(e.current,E,M),R=I.top,X=I.left,Y=I.height,k=I.width,D=document.documentElement,H=D.clientHeight,W=D.clientWidth,F=e.current.parentNode,_=function(t){if(!t)return[0,0];var e=l((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),r=e[1],o=void 0===r?0:r,n=e[2];return[o,void 0===n?0:n]}(F),q=l(_,2),B=q[0],U=q[1],V=function(t){var e=l(t.split("-"),2),r=e[0],o=void 0===r?"bottom":r,n=e[1],i=void 0===n?"center":n;"auto"===o&&(o="bottom");"auto"===i&&(i="center");var a="top"===o||"bottom"===o,c="left"===o||"right"===o;c&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));a&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[o,i,a,c]}(i),$=l(V,4),G=$[0],J=$[1],K=$[2],Q=$[3],Z=G,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=T-k,rt=L-Y,ot="left"===J?0:"right"===J?et:et/2,nt=et-ot,it="top"===J?0:"bottom"===J?rt:rt/2,lt=rt-it,at=N-X+B,ct=C-R+U,ut=0,st=0,ft=d(t.current),dt=[],pt=r.current,ht=f(pt,E,M)||{},mt=ht.height,bt=void 0===mt?0:mt,vt=ht.width,yt=void 0===vt?0:vt,gt=at,wt=ct,Ot=0,xt=0;for(K&&(at+=ot,ct+="top"===G?-Y:L,b&&(bt=11,yt=20)),Q&&(at+="left"===G?-k:T,ct+=it,b&&(bt=20,yt=11));ft;)dt.push(ft),jt(f(ft,E,M)),ft=d(ft.parentNode);if(jt({top:M,bottom:M+H,left:E,right:E+W,height:H,width:W}),K&&(ct+="bottom"===Z?s:-s),Q&&(at+="right"===Z?m:-m),v&&!n&&(K&&(xt="bottom"===Z?10:-10),Q&&(Ot="right"===Z?10:-10)),at=at-ut+Ot,ct=ct-st+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[Z],pt)K&&((j=T<k)?gt+=T/2:gt=at+k/2,gt-=yt/2,"bottom"===Z&&(wt=ct,ct+=bt),"top"===Z&&(wt=(ct-=bt)+Y),ut<0&&ut-ot<0&&(j?gt+=(ot-ut)/2:T-ot+ut<k&&(gt+=(T-ot+ut-k)/2)),ut>0&&ut+nt>0&&(j?gt-=(ut+nt)/2:T-ut-nt<k&&(gt-=(T-ut-nt-k)/2))),Q&&((j=L<Y)?wt+=L/2:wt=ct+Y/2,wt-=bt/2,"left"===Z&&(gt=(at-=yt)+k),"right"===Z&&(gt=at,at+=yt),st<0&&st-it<0&&(j?wt+=(it-st)/2:L-it+st<Y&&(wt+=(L-it+st-Y)/2)),st>0&&st+lt>0&&(j?wt-=(st+lt)/2:L-st-lt<Y&&(wt-=(L-st-lt-Y)/2))),pt.setAttribute("direction",w),pt.style.height=bt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;F.style.transform=tt(at,ct),F.style.visibility="visible",!n&&v&&setTimeout((function(){F.style.transition=".4s",F.style.transform=tt(at-Ot,ct-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),g instanceof Function&&g({popper:{top:ct,bottom:ct+Y,left:at,right:at+k,height:Y,width:k},element:{top:C,bottom:z,left:N,right:A,height:L,width:T},arrow:{top:wt,bottom:wt+bt,left:gt,right:gt+yt,height:bt,width:yt,direction:w},position:Z+"-"+(0!==ut?"auto":J),scroll:{scrollLeft:E,scrollTop:M},scrollableParents:dt,event:n})}function jt(t){var e=t.top,r=t.bottom,o=t.left,n=t.right,i=t.height,l=t.width;if(K){var u=Math.round(C-e+L/2),f=Math.round(i/2);a||(C-(Y+s+bt)<e&&u<=f&&"top"===Z?(ct+=Y+L,Z="bottom"):z+Y+s+bt>i+e&&u>=f&&"bottom"===Z&&(ct-=Y+L,Z="top")),c||(N+ot<o&&(ut=p(A-yt>o?N+ot-o:-T+ot+yt,ut)),A-nt>n&&(ut=p(N+yt<n?A-nt-n:T-nt-yt,ut)))}if(Q){var d=Math.round(N-o+T/2),h=Math.round(l/2);a||(N-(k+m+yt)<o&&d<h&&"left"===Z?(at+=T+k,Z="right"):A+k+m+yt>n&&d>h&&"right"===Z&&(at-=T+k,Z="left")),c||(C+it<e&&(st=p(z-bt>e?C+it-e:-L+it+bt,st)),z-lt>r&&(st=p(C+bt<r?z-lt-r:L-lt-bt,st)))}}}function f(t,e,r){if(t){var o=t.getBoundingClientRect(),n=o.top,i=o.left,l=o.width,a=o.height,c=n+r,u=i+e;return{top:c,bottom:c+a,left:u,right:u+l,width:l,height:a}}}function d(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),r=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&r(e.overflowX)||t.clientWidth<t.scrollWidth&&r(e.overflowY)?t:d(t.parentNode)}}function p(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}exports.default=u; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=e(t);function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==r)return;var o,n,i=[],l=!0,a=!1;try{for(r=r.call(t);!(l=(o=r.next()).done)&&(i.push(o.value),!e||i.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function u(e,o){var i=e.element,l=e.popper,a=e.position,u=void 0===a?"bottom-center":a,c=e.containerStyle,f=e.containerClassName,d=void 0===f?"":f,p=e.arrow,h=e.arrowStyle,m=void 0===h?{}:h,v=e.arrowClassName,b=void 0===v?"":v,y=e.fixMainPosition,g=e.fixRelativePosition,w=e.offsetY,O=e.offsetX,x=e.animation,P=e.zIndex,j=void 0===P?0:P,E=e.popperShadow,M=e.onChange,C=e.active,S=void 0===C||C,N=t.useRef(),L=t.useRef(),T=t.useRef(),A={visibility:"hidden",left:"0",top:"0",position:"absolute"},z=t.useMemo((function(){return!0===p}),[p]),I=t.useMemo((function(){return l&&!0===S}),[l,S]),R=t.useCallback((function(){return{position:u,fixMainPosition:y,fixRelativePosition:g,offsetY:w,offsetX:O,defaultArrow:z,animation:x,zIndex:j,onChange:M}}),[u,y,g,w,O,z,x,M,j]),X=t.useCallback((function(){T.current&&(T.current.style.transition=""),L.current&&(L.current.parentNode.style.transition="")}),[]);return t.useEffect((function(){if(!I)return X(),L.current.parentNode.style.visibility="hidden",void(T.current&&(T.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(N.current)||(t&&X(),s(N,L,T,R(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[I,R,X]),r.default.createElement("div",{ref:function(t){if(t&&(t.removeTransition=X,t.refreshPosition=function(){return setTimeout((function(){return s(N,L,T,R(),{})}),10)}),N.current=t,o instanceof Function)return o(t);o&&(o.current=t)},className:d,style:n({display:"inline-block",height:"max-content"},c)},i,!0===p&&I?r.default.createElement("div",{ref:T,className:"ep-arrow ".concat(E?"ep-shadow":""," ").concat(b),style:n(n({},A),m)}):t.isValidElement(p)&&I?r.default.createElement("div",{ref:T,style:n(n({},A),m)},p):null,r.default.createElement("div",{className:E?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:j}},r.default.createElement("div",{ref:L},l)))}var c=t.forwardRef(u);function s(t,e,r,o,n){var i=o.position,a=o.fixMainPosition,u=o.fixRelativePosition,c=o.offsetY,s=void 0===c?0:c,h=o.offsetX,m=void 0===h?0:h,v=o.defaultArrow,b=o.animation,y=o.zIndex,g=o.onChange;if(t.current&&e.current){var w,O,x,P,j=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),E=j.scrollLeft,M=j.scrollTop,C=f(t.current,E,M),S=C.top,N=C.left,L=C.height,T=C.width,A=C.right,z=C.bottom,I=f(e.current,E,M),R=I.top,X=I.left,Y=I.height,k=I.width,D=document.documentElement,H=D.clientHeight,W=D.clientWidth,_=e.current.parentNode,q=function(t){if(!t)return[0,0];var e=l((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),r=e[1],o=void 0===r?0:r,n=e[2];return[o,void 0===n?0:n]}(_),B=l(q,2),F=B[0],U=B[1],V=function(t){var e=l(t.split("-"),2),r=e[0],o=void 0===r?"bottom":r,n=e[1],i=void 0===n?"center":n;"auto"===o&&(o="bottom");"auto"===i&&(i="center");var a="top"===o||"bottom"===o,u="left"===o||"right"===o;u&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));a&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[o,i,a,u]}(i),$=l(V,4),G=$[0],J=$[1],K=$[2],Q=$[3],Z=G,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=T-k,rt=L-Y,ot="left"===J?0:"right"===J?et:et/2,nt=et-ot,it="top"===J?0:"bottom"===J?rt:rt/2,lt=rt-it,at=N-X+F,ut=S-R+U,ct=0,st=0,ft=d(t.current),dt=[],pt=r.current,ht=f(pt,E,M)||{},mt=ht.height,vt=void 0===mt?0:mt,bt=ht.width,yt=void 0===bt?0:bt,gt=at,wt=ut,Ot=0,xt=0;for(K&&(at+=ot,ut+="top"===G?-Y:L,v&&(vt=11,yt=20)),Q&&(at+="left"===G?-k:T,ut+=it,v&&(vt=20,yt=11));ft;)dt.push(ft),Pt(f(ft,E,M)),ft=d(ft.parentNode);if(Pt({top:M,bottom:M+H,left:E,right:E+W,height:H,width:W}),K&&(ut+="bottom"===Z?s:-s),Q&&(at+="right"===Z?m:-m),b&&!n&&(K&&(xt="bottom"===Z?10:-10),Q&&(Ot="right"===Z?10:-10)),at=at-ct+Ot,ut=ut-st+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[Z],pt)K&&((P=T<k)?gt+=T/2:gt=at+k/2,gt-=yt/2,"bottom"===Z&&(wt=ut,ut+=vt),"top"===Z&&(wt=(ut-=vt)+Y),ct<0&&ct-ot<0&&(P?gt+=(ot-ct)/2:T-ot+ct<k&&(gt+=(T-ot+ct-k)/2)),ct>0&&ct+nt>0&&(P?gt-=(ct+nt)/2:T-ct-nt<k&&(gt-=(T-ct-nt-k)/2))),Q&&((P=L<Y)?wt+=L/2:wt=ut+Y/2,wt-=vt/2,"left"===Z&&(gt=(at-=yt)+k),"right"===Z&&(gt=at,at+=yt),st<0&&st-it<0&&(P?wt+=(it-st)/2:L-it+st<Y&&(wt+=(L-it+st-Y)/2)),st>0&&st+lt>0&&(P?wt-=(st+lt)/2:L-st-lt<Y&&(wt-=(L-st-lt-Y)/2))),pt.setAttribute("direction",w),pt.style.height=vt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;_.style.transform=tt(at,ut),_.style.visibility="visible",!n&&b&&setTimeout((function(){_.style.transition=".4s",_.style.transform=tt(at-Ot,ut-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),null==g||g({popper:{top:ut,bottom:ut+Y,left:at,right:at+k,height:Y,width:k},element:{top:S,bottom:z,left:N,right:A,height:L,width:T},arrow:{top:wt,bottom:wt+vt,left:gt,right:gt+yt,height:vt,width:yt,direction:w},position:Z+"-"+(0!==ct?"auto":J),scroll:{scrollLeft:E,scrollTop:M},scrollableParents:dt,event:n})}function Pt(t){var e=t.top,r=t.bottom,o=t.left,n=t.right,i=t.height,l=t.width;if(K){var c=Math.round(S-e+L/2),f=Math.round(i/2);a||(S-(Y+s+vt)<e&&c<=f&&"top"===Z?(ut+=Y+L,Z="bottom"):z+Y+s+vt>i+e&&c>=f&&"bottom"===Z&&(ut-=Y+L,Z="top")),u||(N+ot<o&&(ct=p(A-yt>o?N+ot-o:-T+ot+yt,ct)),A-nt>n&&(ct=p(N+yt<n?A-nt-n:T-nt-yt,ct)))}if(Q){var d=Math.round(N-o+T/2),h=Math.round(l/2);a||(N-(k+m+yt)<o&&d<h&&"left"===Z?(at+=T+k,Z="right"):A+k+m+yt>n&&d>h&&"right"===Z&&(at-=T+k,Z="left")),u||(S+it<e&&(st=p(z-vt>e?S+it-e:-L+it+vt,st)),z-lt>r&&(st=p(S+vt<r?z-lt-r:L-lt-vt,st)))}}}function f(t,e,r){if(t){var o=t.getBoundingClientRect(),n=o.top,i=o.left,l=o.width,a=o.height,u=n+r,c=i+e;return{top:u,bottom:u+a,left:c,right:c+l,width:l,height:a}}}function d(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),r=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&r(e.overflowX)||t.clientWidth<t.scrollWidth&&r(e.overflowY)?t:d(t.parentNode)}}function p(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}exports.default=c; |
@@ -1,1 +0,1 @@ | ||
import t,{forwardRef as e,useRef as r,useMemo as o,useCallback as n,useEffect as i,isValidElement as l}from"react";function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],o=!0,n=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(o=(l=a.next()).done)&&(r.push(l.value),!e||r.length!==e);o=!0);}catch(t){n=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(n)throw i}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function d(e,a){var c=e.element,u=e.popper,f=e.position,d=void 0===f?"bottom-center":f,p=e.containerStyle,m=e.containerClassName,v=void 0===m?"":m,b=e.arrow,y=e.arrowStyle,g=void 0===y?{}:y,w=e.arrowClassName,O=void 0===w?"":w,x=e.fixMainPosition,P=e.fixRelativePosition,j=e.offsetY,E=e.offsetX,M=e.animation,S=e.zIndex,N=void 0===S?0:S,C=e.popperShadow,L=e.onChange,T=e.active,A=void 0===T||T,z=r(),I=r(),X=r(),Y={visibility:"hidden",left:"0",top:"0",position:"absolute"},D=o((function(){return!0===b}),[b]),H=o((function(){return u&&!0===A}),[u,A]),R=n((function(){return{position:d,fixMainPosition:x,fixRelativePosition:P,offsetY:j,offsetX:E,defaultArrow:D,animation:M,zIndex:N,onChange:L}}),[d,x,P,j,E,D,M,L,N]),W=n((function(){X.current&&(X.current.style.transition=""),I.current&&(I.current.parentNode.style.transition="")}),[]);return i((function(){if(!H)return W(),I.current.parentNode.style.visibility="hidden",void(X.current&&(X.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(z.current)||(t&&W(),h(z,I,X,R(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[H,R,W]),t.createElement("div",{ref:function(t){if(t&&(t.removeTransition=W,t.refreshPosition=function(){return setTimeout((function(){return h(z,I,X,R(),{})}),10)}),z.current=t,a instanceof Function)return a(t);a&&(a.current=t)},className:v,style:s({display:"inline-block",height:"max-content"},p)},c,!0===b&&H?t.createElement("div",{ref:X,className:"ep-arrow ".concat(C?"ep-shadow":""," ").concat(O),style:s(s({},Y),g)}):l(b)&&H?t.createElement("div",{ref:X,style:s(s({},Y),g)},b):null,t.createElement("div",{className:C?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:N}},t.createElement("div",{ref:I},u)))}var p=e(d);function h(t,e,r,o,n){var i=o.position,l=o.fixMainPosition,a=o.fixRelativePosition,c=o.offsetY,s=void 0===c?0:c,f=o.offsetX,d=void 0===f?0:f,p=o.defaultArrow,h=o.animation,y=o.zIndex,g=o.onChange;if(t.current&&e.current){var w,O,x,P,j=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),E=j.scrollLeft,M=j.scrollTop,S=m(t.current,E,M),N=S.top,C=S.left,L=S.height,T=S.width,A=S.right,z=S.bottom,I=m(e.current,E,M),X=I.top,Y=I.left,D=I.height,H=I.width,R=document.documentElement,W=R.clientHeight,k=R.clientWidth,F=e.current.parentNode,B=function(t){if(!t)return[0,0];var e=u((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),r=e[1],o=void 0===r?0:r,n=e[2];return[o,void 0===n?0:n]}(F),U=u(B,2),$=U[0],q=U[1],G=function(t){var e=u(t.split("-"),2),r=e[0],o=void 0===r?"bottom":r,n=e[1],i=void 0===n?"center":n;"auto"===o&&(o="bottom");"auto"===i&&(i="center");var l="top"===o||"bottom"===o,a="left"===o||"right"===o;a&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));l&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[o,i,l,a]}(i),J=u(G,4),K=J[0],Q=J[1],V=J[2],Z=J[3],_=K,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=T-H,rt=L-D,ot="left"===Q?0:"right"===Q?et:et/2,nt=et-ot,it="top"===Q?0:"bottom"===Q?rt:rt/2,lt=rt-it,at=C-Y+$,ct=N-X+q,st=0,ut=0,ft=v(t.current),dt=[],pt=r.current,ht=m(pt,E,M)||{},mt=ht.height,vt=void 0===mt?0:mt,bt=ht.width,yt=void 0===bt?0:bt,gt=at,wt=ct,Ot=0,xt=0;for(V&&(at+=ot,ct+="top"===K?-D:L,p&&(vt=11,yt=20)),Z&&(at+="left"===K?-H:T,ct+=it,p&&(vt=20,yt=11));ft;)dt.push(ft),Pt(m(ft,E,M)),ft=v(ft.parentNode);if(Pt({top:M,bottom:M+W,left:E,right:E+k,height:W,width:k}),V&&(ct+="bottom"===_?s:-s),Z&&(at+="right"===_?d:-d),h&&!n&&(V&&(xt="bottom"===_?10:-10),Z&&(Ot="right"===_?10:-10)),at=at-st+Ot,ct=ct-ut+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[_],pt)V&&((P=T<H)?gt+=T/2:gt=at+H/2,gt-=yt/2,"bottom"===_&&(wt=ct,ct+=vt),"top"===_&&(wt=(ct-=vt)+D),st<0&&st-ot<0&&(P?gt+=(ot-st)/2:T-ot+st<H&&(gt+=(T-ot+st-H)/2)),st>0&&st+nt>0&&(P?gt-=(st+nt)/2:T-st-nt<H&&(gt-=(T-st-nt-H)/2))),Z&&((P=L<D)?wt+=L/2:wt=ct+D/2,wt-=vt/2,"left"===_&&(gt=(at-=yt)+H),"right"===_&&(gt=at,at+=yt),ut<0&&ut-it<0&&(P?wt+=(it-ut)/2:L-it+ut<D&&(wt+=(L-it+ut-D)/2)),ut>0&&ut+lt>0&&(P?wt-=(ut+lt)/2:L-ut-lt<D&&(wt-=(L-ut-lt-D)/2))),pt.setAttribute("direction",w),pt.style.height=vt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;F.style.transform=tt(at,ct),F.style.visibility="visible",!n&&h&&setTimeout((function(){F.style.transition=".4s",F.style.transform=tt(at-Ot,ct-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),g instanceof Function&&g({popper:{top:ct,bottom:ct+D,left:at,right:at+H,height:D,width:H},element:{top:N,bottom:z,left:C,right:A,height:L,width:T},arrow:{top:wt,bottom:wt+vt,left:gt,right:gt+yt,height:vt,width:yt,direction:w},position:_+"-"+(0!==st?"auto":Q),scroll:{scrollLeft:E,scrollTop:M},scrollableParents:dt,event:n})}function Pt(t){var e=t.top,r=t.bottom,o=t.left,n=t.right,i=t.height,c=t.width;if(V){var u=Math.round(N-e+L/2),f=Math.round(i/2);l||(N-(D+s+vt)<e&&u<=f&&"top"===_?(ct+=D+L,_="bottom"):z+D+s+vt>i+e&&u>=f&&"bottom"===_&&(ct-=D+L,_="top")),a||(C+ot<o&&(st=b(A-yt>o?C+ot-o:-T+ot+yt,st)),A-nt>n&&(st=b(C+yt<n?A-nt-n:T-nt-yt,st)))}if(Z){var p=Math.round(C-o+T/2),h=Math.round(c/2);l||(C-(H+d+yt)<o&&p<h&&"left"===_?(at+=T+H,_="right"):A+H+d+yt>n&&p>h&&"right"===_&&(at-=T+H,_="left")),a||(N+it<e&&(ut=b(z-vt>e?N+it-e:-L+it+vt,ut)),z-lt>r&&(ut=b(N+vt<r?z-lt-r:L-lt-vt,ut)))}}}function m(t,e,r){if(t){var o=t.getBoundingClientRect(),n=o.top,i=o.left,l=o.width,a=o.height,c=n+r,s=i+e;return{top:c,bottom:c+a,left:s,right:s+l,width:l,height:a}}}function v(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),r=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&r(e.overflowX)||t.clientWidth<t.scrollWidth&&r(e.overflowY)?t:v(t.parentNode)}}function b(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}export default p; | ||
import t,{forwardRef as e,useRef as r,useMemo as o,useCallback as n,useEffect as i,isValidElement as l}from"react";function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==r)return;var o,n,i=[],l=!0,a=!1;try{for(r=r.call(t);!(l=(o=r.next()).done)&&(i.push(o.value),!e||i.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function d(e,a){var s=e.element,u=e.popper,f=e.position,d=void 0===f?"bottom-center":f,p=e.containerStyle,m=e.containerClassName,v=void 0===m?"":m,b=e.arrow,y=e.arrowStyle,g=void 0===y?{}:y,w=e.arrowClassName,O=void 0===w?"":w,x=e.fixMainPosition,P=e.fixRelativePosition,j=e.offsetY,E=e.offsetX,M=e.animation,S=e.zIndex,N=void 0===S?0:S,C=e.popperShadow,L=e.onChange,T=e.active,A=void 0===T||T,z=r(),I=r(),X=r(),Y={visibility:"hidden",left:"0",top:"0",position:"absolute"},D=o((function(){return!0===b}),[b]),H=o((function(){return u&&!0===A}),[u,A]),R=n((function(){return{position:d,fixMainPosition:x,fixRelativePosition:P,offsetY:j,offsetX:E,defaultArrow:D,animation:M,zIndex:N,onChange:L}}),[d,x,P,j,E,D,M,L,N]),W=n((function(){X.current&&(X.current.style.transition=""),I.current&&(I.current.parentNode.style.transition="")}),[]);return i((function(){if(!H)return W(),I.current.parentNode.style.visibility="hidden",void(X.current&&(X.current.style.visibility="hidden"));function t(t){t&&"resize"!==t.type&&!t.target.contains(z.current)||(t&&W(),h(z,I,X,R(),t))}return t(),document.addEventListener("scroll",t,!0),window.addEventListener("resize",t),function(){document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}}),[H,R,W]),t.createElement("div",{ref:function(t){if(t&&(t.removeTransition=W,t.refreshPosition=function(){return setTimeout((function(){return h(z,I,X,R(),{})}),10)}),z.current=t,a instanceof Function)return a(t);a&&(a.current=t)},className:v,style:c({display:"inline-block",height:"max-content"},p)},s,!0===b&&H?t.createElement("div",{ref:X,className:"ep-arrow ".concat(C?"ep-shadow":""," ").concat(O),style:c(c({},Y),g)}):l(b)&&H?t.createElement("div",{ref:X,style:c(c({},Y),g)},b):null,t.createElement("div",{className:C?"ep-popper-shadow":"",style:{position:"absolute",left:"0",top:"0",willChange:"transform",visibility:"hidden",zIndex:N}},t.createElement("div",{ref:I},u)))}var p=e(d);function h(t,e,r,o,n){var i=o.position,l=o.fixMainPosition,a=o.fixRelativePosition,c=o.offsetY,s=void 0===c?0:c,f=o.offsetX,d=void 0===f?0:f,p=o.defaultArrow,h=o.animation,y=o.zIndex,g=o.onChange;if(t.current&&e.current){var w,O,x,P,j=(O=void 0!==window.pageXOffset,x="CSS1Compat"===(document.compatMode||""),{scrollLeft:O?window.pageXOffset:x?document.documentElement.scrollLeft:document.body.scrollLeft,scrollTop:O?window.pageYOffset:x?document.documentElement.scrollTop:document.body.scrollTop}),E=j.scrollLeft,M=j.scrollTop,S=m(t.current,E,M),N=S.top,C=S.left,L=S.height,T=S.width,A=S.right,z=S.bottom,I=m(e.current,E,M),X=I.top,Y=I.left,D=I.height,H=I.width,R=document.documentElement,W=R.clientHeight,k=R.clientWidth,B=e.current.parentNode,F=function(t){if(!t)return[0,0];var e=u((t.style.transform.match(/translate\((.*?)px,\s(.*?)px\)/)||[]).map((function(t){return Number(t)})),3),r=e[1],o=void 0===r?0:r,n=e[2];return[o,void 0===n?0:n]}(B),U=u(F,2),$=U[0],q=U[1],G=function(t){var e=u(t.split("-"),2),r=e[0],o=void 0===r?"bottom":r,n=e[1],i=void 0===n?"center":n;"auto"===o&&(o="bottom");"auto"===i&&(i="center");var l="top"===o||"bottom"===o,a="left"===o||"right"===o;a&&("start"===i&&(i="top"),"end"===i&&(i="bottom"));l&&("start"===i&&(i="left"),"end"===i&&(i="right"));return[o,i,l,a]}(i),J=u(G,4),K=J[0],Q=J[1],V=J[2],Z=J[3],_=K,tt=function(t,e){return"translate(".concat(t,"px, ").concat(e,"px)")},et=T-H,rt=L-D,ot="left"===Q?0:"right"===Q?et:et/2,nt=et-ot,it="top"===Q?0:"bottom"===Q?rt:rt/2,lt=rt-it,at=C-Y+$,ct=N-X+q,st=0,ut=0,ft=v(t.current),dt=[],pt=r.current,ht=m(pt,E,M)||{},mt=ht.height,vt=void 0===mt?0:mt,bt=ht.width,yt=void 0===bt?0:bt,gt=at,wt=ct,Ot=0,xt=0;for(V&&(at+=ot,ct+="top"===K?-D:L,p&&(vt=11,yt=20)),Z&&(at+="left"===K?-H:T,ct+=it,p&&(vt=20,yt=11));ft;)dt.push(ft),Pt(m(ft,E,M)),ft=v(ft.parentNode);if(Pt({top:M,bottom:M+W,left:E,right:E+k,height:W,width:k}),V&&(ct+="bottom"===_?s:-s),Z&&(at+="right"===_?d:-d),h&&!n&&(V&&(xt="bottom"===_?10:-10),Z&&(Ot="right"===_?10:-10)),at=at-st+Ot,ct=ct-ut+xt,w={top:"bottom",bottom:"top",left:"right",right:"left"}[_],pt)V&&((P=T<H)?gt+=T/2:gt=at+H/2,gt-=yt/2,"bottom"===_&&(wt=ct,ct+=vt),"top"===_&&(wt=(ct-=vt)+D),st<0&&st-ot<0&&(P?gt+=(ot-st)/2:T-ot+st<H&&(gt+=(T-ot+st-H)/2)),st>0&&st+nt>0&&(P?gt-=(st+nt)/2:T-st-nt<H&&(gt-=(T-st-nt-H)/2))),Z&&((P=L<D)?wt+=L/2:wt=ct+D/2,wt-=vt/2,"left"===_&&(gt=(at-=yt)+H),"right"===_&&(gt=at,at+=yt),ut<0&&ut-it<0&&(P?wt+=(it-ut)/2:L-it+ut<D&&(wt+=(L-it+ut-D)/2)),ut>0&&ut+lt>0&&(P?wt-=(ut+lt)/2:L-ut-lt<D&&(wt-=(L-ut-lt-D)/2))),pt.setAttribute("direction",w),pt.style.height=vt+"px",pt.style.width=yt+"px",pt.style.transform=tt(gt,wt),pt.style.visibility="visible",pt.style.zIndex=y+1;B.style.transform=tt(at,ct),B.style.visibility="visible",!n&&h&&setTimeout((function(){B.style.transition=".4s",B.style.transform=tt(at-Ot,ct-xt),pt&&(pt.style.transition=".4s",pt.style.transform=tt(gt-Ot,wt-xt))}),18),null==g||g({popper:{top:ct,bottom:ct+D,left:at,right:at+H,height:D,width:H},element:{top:N,bottom:z,left:C,right:A,height:L,width:T},arrow:{top:wt,bottom:wt+vt,left:gt,right:gt+yt,height:vt,width:yt,direction:w},position:_+"-"+(0!==st?"auto":Q),scroll:{scrollLeft:E,scrollTop:M},scrollableParents:dt,event:n})}function Pt(t){var e=t.top,r=t.bottom,o=t.left,n=t.right,i=t.height,c=t.width;if(V){var u=Math.round(N-e+L/2),f=Math.round(i/2);l||(N-(D+s+vt)<e&&u<=f&&"top"===_?(ct+=D+L,_="bottom"):z+D+s+vt>i+e&&u>=f&&"bottom"===_&&(ct-=D+L,_="top")),a||(C+ot<o&&(st=b(A-yt>o?C+ot-o:-T+ot+yt,st)),A-nt>n&&(st=b(C+yt<n?A-nt-n:T-nt-yt,st)))}if(Z){var p=Math.round(C-o+T/2),h=Math.round(c/2);l||(C-(H+d+yt)<o&&p<h&&"left"===_?(at+=T+H,_="right"):A+H+d+yt>n&&p>h&&"right"===_&&(at-=T+H,_="left")),a||(N+it<e&&(ut=b(z-vt>e?N+it-e:-L+it+vt,ut)),z-lt>r&&(ut=b(N+vt<r?z-lt-r:L-lt-vt,ut)))}}}function m(t,e,r){if(t){var o=t.getBoundingClientRect(),n=o.top,i=o.left,l=o.width,a=o.height,c=n+r,s=i+e;return{top:c,bottom:c+a,left:s,right:s+l,width:l,height:a}}}function v(t){if(t&&"HTML"!==t.tagName){var e=window.getComputedStyle(t),r=function(t){return["auto","scroll"].includes(t)};return t.clientHeight<t.scrollHeight&&r(e.overflowX)||t.clientWidth<t.scrollWidth&&r(e.overflowY)?t:v(t.parentNode)}}function b(t,e){return Math.round(Math.abs(t))>Math.round(Math.abs(e))?t:e}export default p; |
{ | ||
"name": "react-element-popper", | ||
"version": "1.0.8", | ||
"version": "1.0.10", | ||
"description": "A small React component to create a variety of elements that require Popper, such as dropdowns, modals, multiselects, and more.", | ||
@@ -22,5 +22,3 @@ "main": "./build/index.min.js", | ||
"component", | ||
"dropdown", | ||
"modal", | ||
"multi select" | ||
"dropdown" | ||
], | ||
@@ -34,11 +32,11 @@ "author": "shahab yazdi <sh.yazdi@gmail.com>", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.10", | ||
"@babel/preset-env": "^7.13.12", | ||
"@babel/preset-react": "^7.12.13", | ||
"@babel/core": "^7.14.3", | ||
"@babel/preset-env": "^7.14.2", | ||
"@babel/preset-react": "^7.13.13", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"rollup": "^2.42.3", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"rollup": "^2.50.1", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
@@ -45,0 +43,0 @@ "rollup-plugin-terser": "^7.0.2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35566