Socket
Socket
Sign inDemoInstall

reactjs-popup

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactjs-popup - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

index.d.ts

2

package.json
{
"name": "reactjs-popup",
"version": "1.2.0",
"version": "1.3.0",
"description": "React Popup Component - Modals,Tooltips and Menus —  All in one",

@@ -5,0 +5,0 @@ "main": "reactjs-popup.cjs.js",

/*!
* reactjs-popup v1.2.0
* reactjs-popup v1.3.0
* (c) 2018-present Youssouf EL AZIZI <youssoufelazizi@gmail.com>

@@ -387,3 +387,4 @@ * Released under the MIT License.

offsetY = _this$props.offsetY,
keepTooltipInside = _this$props.keepTooltipInside;
keepTooltipInside = _this$props.keepTooltipInside,
arrowStyle = _this$props.arrowStyle;
var modal = _this.state.modal;

@@ -414,4 +415,4 @@ if (modal) return;

_this.ArrowEl.style["-webkit-transform"] = cords.transform;
_this.ArrowEl.style.top = cords.arrowTop;
_this.ArrowEl.style.left = cords.arrowLeft;
_this.ArrowEl.style.top = arrowStyle.top || cords.arrowTop;
_this.ArrowEl.style.left = arrowStyle.left || cords.arrowLeft;
}

@@ -460,2 +461,3 @@

triggerProps.onMouseLeave = _this.onMouseLeave;
break;

@@ -541,3 +543,6 @@ case "focus":

var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip;
return [this.state.isOpen && React.createElement("div", {
return [!!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger()), this.state.isOpen && React.createElement("div", {
key: "H",

@@ -555,6 +560,3 @@ style: {

onClick: closeOnDocumentClick ? this.closePopup : undefined
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger())];
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent()];
}

@@ -561,0 +563,0 @@ }]);

/*!
* reactjs-popup v1.2.0
* reactjs-popup v1.3.0
* (c) 2018-present Youssouf EL AZIZI <youssoufelazizi@gmail.com>

@@ -383,3 +383,4 @@ * Released under the MIT License.

offsetY = _this$props.offsetY,
keepTooltipInside = _this$props.keepTooltipInside;
keepTooltipInside = _this$props.keepTooltipInside,
arrowStyle = _this$props.arrowStyle;
var modal = _this.state.modal;

@@ -410,4 +411,4 @@ if (modal) return;

_this.ArrowEl.style["-webkit-transform"] = cords.transform;
_this.ArrowEl.style.top = cords.arrowTop;
_this.ArrowEl.style.left = cords.arrowLeft;
_this.ArrowEl.style.top = arrowStyle.top || cords.arrowTop;
_this.ArrowEl.style.left = arrowStyle.left || cords.arrowLeft;
}

@@ -456,2 +457,3 @@

triggerProps.onMouseLeave = _this.onMouseLeave;
break;

@@ -537,3 +539,6 @@ case "focus":

var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip;
return [this.state.isOpen && React.createElement("div", {
return [!!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger()), this.state.isOpen && React.createElement("div", {
key: "H",

@@ -551,6 +556,3 @@ style: {

onClick: closeOnDocumentClick ? this.closePopup : undefined
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger())];
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent()];
}

@@ -557,0 +559,0 @@ }]);

/*!
* reactjs-popup v1.2.0
* reactjs-popup v1.3.0
* (c) 2018-present Youssouf EL AZIZI <youssoufelazizi@gmail.com>

@@ -388,3 +388,4 @@ * Released under the MIT License.

offsetY = _this$props.offsetY,
keepTooltipInside = _this$props.keepTooltipInside;
keepTooltipInside = _this$props.keepTooltipInside,
arrowStyle = _this$props.arrowStyle;
var modal = _this.state.modal;

@@ -415,4 +416,4 @@ if (modal) return;

_this.ArrowEl.style["-webkit-transform"] = cords.transform;
_this.ArrowEl.style.top = cords.arrowTop;
_this.ArrowEl.style.left = cords.arrowLeft;
_this.ArrowEl.style.top = arrowStyle.top || cords.arrowTop;
_this.ArrowEl.style.left = arrowStyle.left || cords.arrowLeft;
}

@@ -461,2 +462,3 @@

triggerProps.onMouseLeave = _this.onMouseLeave;
break;

@@ -542,3 +544,6 @@ case "focus":

var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip;
return [this.state.isOpen && React.createElement("div", {
return [!!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger()), this.state.isOpen && React.createElement("div", {
key: "H",

@@ -556,6 +561,3 @@ style: {

onClick: closeOnDocumentClick ? this.closePopup : undefined
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, {
innerRef: this.setTriggerRef,
key: "R"
}, this.renderTrigger())];
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent()];
}

@@ -562,0 +564,0 @@ }]);

/*!
* reactjs-popup v1.2.0
* reactjs-popup v1.3.0
* (c) 2018-present Youssouf EL AZIZI <youssoufelazizi@gmail.com>
* Released under the MIT License.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.reactjsPopup=t(e.React,e.reactDom)}(this,function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");a(e.prototype,t&&t.prototype),t&&a(e,t)}function l(e){return(l=Object.getPrototypeOf||function(e){return e.__proto__})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?u(e):t}function f(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function d(e,t,o,n,r){var i=r.offsetX,p=r.offsetY,s=n?8:0,l=o.split(" "),a=e.top+e.height/2,u=e.left+e.width/2,c=t.height,f=t.width,d=a-c/2,h=u-f/2,g="",m="0%",y="0%";switch(l[0]){case"top":d-=c/2+e.height/2+s,g="rotate(45deg)",m="100%",y="50%";break;case"bottom":d+=c/2+e.height/2+s,g="rotate(225deg)",y="50%";break;case"left":h-=f/2+e.width/2+s,g=" rotate(-45deg)",y="100%",m="50%";break;case"right":h+=f/2+e.width/2+s,g="rotate(135deg)",m="50%"}switch(l[1]){case"top":d=e.top,m=e.height/2+"px";break;case"bottom":d=e.top-c+e.height,m=c-e.height/2+"px";break;case"left":h=e.left,y=e.width/2+"px";break;case"right":h=e.left-f+e.width,y=f-e.width/2+"px"}return{top:d="top"===l[0]?d-p:d+p,left:h="left"===l[0]?h-i:h+i,transform:g,arrowLeft:y,arrowTop:m}}var h={popupContent:{tooltip:{position:"absolute",zIndex:"2",width:"200px",background:"rgb(255, 255, 255)",border:"1px solid rgb(187, 187, 187)",boxShadow:"rgba(0, 0, 0, 0.2) 0px 1px 3px",padding:"5px"},modal:{position:"relative",background:"rgb(255, 255, 255)",width:"50%",margin:"auto",border:"1px solid rgb(187, 187, 187)",padding:"5px"}},popupArrow:{height:"10px",width:"10px",position:"absolute",background:"rgb(255, 255, 255)",transform:"rotate(45deg)",margin:"-5px",zIndex:"-1",boxShadow:"rgba(0, 0, 0, 0.2) 1px 1px 1px"},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0"},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",background:"rgba(0, 0, 0,0.5)",display:"flex",zIndex:"999"}}},g=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],m=function(t){function n(t){var r;return o(this,n),i(i(i(i(i(i(i(i(i(i(i(i(i(u(u(r=c(this,l(n).call(this,t)))),"state",{isOpen:r.props.open||r.props.defaultOpen,modal:!!r.props.modal||!r.props.trigger}),"lockScroll",function(){r.state.modal&&r.props.lockScroll&&(document.getElementsByTagName("body")[0].style.overflow="hidden")}),"resetScroll",function(){r.state.modal&&r.props.lockScroll&&(document.getElementsByTagName("body")[0].style.overflow="auto")}),"togglePopup",function(){r.state.isOpen?r.closePopup():r.openPopup()}),"openPopup",function(){r.state.isOpen||r.setState({isOpen:!0},function(){r.setPosition(),r.props.onOpen(),r.lockScroll()})}),"closePopup",function(){r.state.isOpen&&(r.props.onClose(),r.setState({isOpen:!1},function(){r.resetScroll()}))}),"onMouseEnter",function(){clearTimeout(r.timeOut);var e=r.props.mouseEnterDelay;r.timeOut=setTimeout(function(){return r.openPopup()},e)}),"onMouseLeave",function(){clearTimeout(r.timeOut);var e=r.props.mouseLeaveDelay;r.timeOut=setTimeout(function(){return r.closePopup()},e)}),"getTooltipBoundary",function(){var e=r.props.keepTooltipInside,t={top:0,left:0,width:window.innerWidth,height:window.innerHeight};"string"==typeof e&&(t=document.querySelector(e).getBoundingClientRect());return t}),"setPosition",function(){var e=r.props,t=e.arrow,o=e.position,n=e.offsetX,i=e.offsetY,p=e.keepTooltipInside;if(!r.state.modal){var s=r.HelperEl.getBoundingClientRect(),l=r.TriggerEl.getBoundingClientRect(),a=r.ContentEl.getBoundingClientRect(),u=r.getTooltipBoundary(),c=Array.isArray(o)?o:[o];(p||Array.isArray(o))&&(c=f(c).concat(g));var h=function(e,t,o,n,r,i){for(var p,s=r.offsetX,l=r.offsetY,a=0;a<o.length;){var u={top:(p=d(e,t,o[a],n,{offsetX:s,offsetY:l})).top,left:p.left,width:t.width,height:t.height};if(!(u.top<=i.top||u.left<=i.left||u.top+u.height>=i.top+i.height||u.left+u.width>=i.left+i.width))break;a++}return p}(l,a,c,t,{offsetX:n,offsetY:i},u);r.ContentEl.style.top=h.top-s.top+"px",r.ContentEl.style.left=h.left-s.left+"px",t&&(r.ArrowEl.style.transform=h.transform,r.ArrowEl.style["-ms-transform"]=h.transform,r.ArrowEl.style["-webkit-transform"]=h.transform,r.ArrowEl.style.top=h.arrowTop,r.ArrowEl.style.left=h.arrowLeft),"static"!=window.getComputedStyle(r.TriggerEl,null).getPropertyValue("position")&&""!=window.getComputedStyle(r.TriggerEl,null).getPropertyValue("position")||(r.TriggerEl.style.position="relative")}}),"addWarperAction",function(){var e=r.props,t=e.contentStyle,o=e.className,n=e.on,i=r.state.modal,p=i?h.popupContent.modal:h.popupContent.tooltip,s={className:"popup-content ".concat(o),style:Object.assign({},p,t),ref:r.setContentRef,onClick:function(e){e.stopPropagation()}};return!i&&n.indexOf("hover")>=0&&(s.onMouseEnter=r.onMouseEnter,s.onMouseLeave=r.onMouseLeave),s}),"renderTrigger",function(){for(var t={key:"T"},o=r.props,n=o.on,i=o.trigger,p=Array.isArray(n)?n:[n],s=0,l=p.length;s<l;s++)switch(p[s]){case"click":t.onClick=r.togglePopup;break;case"hover":t.onMouseEnter=r.onMouseEnter,t.onMouseLeave=r.onMouseLeave;case"focus":t.onFocus=r.onMouseEnter}return"function"==typeof i?e.cloneElement(i(r.state.isOpen),t):e.cloneElement(i,t)}),"renderContent",function(){var t=r.props,o=t.arrow,n=t.arrowStyle,i=r.state.modal;return e.createElement("div",p({},r.addWarperAction(),{key:"C"}),o&&!i&&e.createElement("div",{ref:r.setArrowRef,style:Object.assign({},h.popupArrow,n)}),"function"==typeof r.props.children?r.props.children(r.closePopup,r.state.isOpen):r.props.children)}),r.setTriggerRef=function(e){return r.TriggerEl=e},r.setContentRef=function(e){return r.ContentEl=e},r.setArrowRef=function(e){return r.ArrowEl=e},r.setHelperRef=function(e){return r.HelperEl=e},r.timeOut=0,r}return r(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props,o=t.closeOnEscape;t.defaultOpen&&this.setPosition(),o&&window.addEventListener("keyup",function(t){"Escape"===t.key&&e.closePopup()})}},{key:"componentWillReceiveProps",value:function(e){this.props.open!==e.open&&(e.open?this.openPopup():this.closePopup())}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeOut)}},{key:"render",value:function(){var t=this.props,o=t.overlayStyle,n=t.closeOnDocumentClick,r=t.on,i=this.state.modal,p=this.state.isOpen&&!(r.indexOf("hover")>=0),s=i?h.overlay.modal:h.overlay.tooltip;return[this.state.isOpen&&e.createElement("div",{key:"H",style:{position:"absolute",top:"0px",left:"0px"},ref:this.setHelperRef}),p&&e.createElement("div",{key:"O",className:"popup-overlay",style:Object.assign({},s,o),onClick:n?this.closePopup:void 0},i&&this.renderContent()),this.state.isOpen&&!i&&this.renderContent(),!!this.props.trigger&&e.createElement(y,{innerRef:this.setTriggerRef,key:"R"},this.renderTrigger())]}}]),s(n,t),n}((e=e&&e.hasOwnProperty("default")?e.default:e).PureComponent);i(m,"defaultProps",{children:function(){return e.createElement("span",null," Your Content Here !!")},trigger:null,onOpen:function(){},onClose:function(){},defaultOpen:!1,open:!1,closeOnDocumentClick:!0,closeOnEscape:!0,on:["click"],contentStyle:{},arrowStyle:{},overlayStyle:{},className:"",position:"bottom center",modal:!1,lockScroll:!1,arrow:!0,offsetX:0,offsetY:0,mouseEnterDelay:100,mouseLeaveDelay:100,keepTooltipInside:!1});var y=function(n){function i(e){return o(this,i),c(this,l(i).call(this,e))}return r(i,[{key:"componentDidMount",value:function(){var e=this.props.innerRef;e&&e(t.findDOMNode(this))}},{key:"render",value:function(){var t=this.props.children;return e.Children.only(t)}}]),s(i,n),i}(e.PureComponent);return m});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.reactjsPopup=t(e.React,e.reactDom)}(this,function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");a(e.prototype,t&&t.prototype),t&&a(e,t)}function l(e){return(l=Object.getPrototypeOf||function(e){return e.__proto__})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?u(e):t}function f(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function d(e,t,o,n,r){var i=r.offsetX,p=r.offsetY,s=n?8:0,l=o.split(" "),a=e.top+e.height/2,u=e.left+e.width/2,c=t.height,f=t.width,d=a-c/2,h=u-f/2,g="",m="0%",y="0%";switch(l[0]){case"top":d-=c/2+e.height/2+s,g="rotate(45deg)",m="100%",y="50%";break;case"bottom":d+=c/2+e.height/2+s,g="rotate(225deg)",y="50%";break;case"left":h-=f/2+e.width/2+s,g=" rotate(-45deg)",y="100%",m="50%";break;case"right":h+=f/2+e.width/2+s,g="rotate(135deg)",m="50%"}switch(l[1]){case"top":d=e.top,m=e.height/2+"px";break;case"bottom":d=e.top-c+e.height,m=c-e.height/2+"px";break;case"left":h=e.left,y=e.width/2+"px";break;case"right":h=e.left-f+e.width,y=f-e.width/2+"px"}return{top:d="top"===l[0]?d-p:d+p,left:h="left"===l[0]?h-i:h+i,transform:g,arrowLeft:y,arrowTop:m}}var h={popupContent:{tooltip:{position:"absolute",zIndex:"2",width:"200px",background:"rgb(255, 255, 255)",border:"1px solid rgb(187, 187, 187)",boxShadow:"rgba(0, 0, 0, 0.2) 0px 1px 3px",padding:"5px"},modal:{position:"relative",background:"rgb(255, 255, 255)",width:"50%",margin:"auto",border:"1px solid rgb(187, 187, 187)",padding:"5px"}},popupArrow:{height:"10px",width:"10px",position:"absolute",background:"rgb(255, 255, 255)",transform:"rotate(45deg)",margin:"-5px",zIndex:"-1",boxShadow:"rgba(0, 0, 0, 0.2) 1px 1px 1px"},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0"},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",background:"rgba(0, 0, 0,0.5)",display:"flex",zIndex:"999"}}},g=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],m=function(t){function n(t){var r;return o(this,n),i(i(i(i(i(i(i(i(i(i(i(i(i(u(u(r=c(this,l(n).call(this,t)))),"state",{isOpen:r.props.open||r.props.defaultOpen,modal:!!r.props.modal||!r.props.trigger}),"lockScroll",function(){r.state.modal&&r.props.lockScroll&&(document.getElementsByTagName("body")[0].style.overflow="hidden")}),"resetScroll",function(){r.state.modal&&r.props.lockScroll&&(document.getElementsByTagName("body")[0].style.overflow="auto")}),"togglePopup",function(){r.state.isOpen?r.closePopup():r.openPopup()}),"openPopup",function(){r.state.isOpen||r.setState({isOpen:!0},function(){r.setPosition(),r.props.onOpen(),r.lockScroll()})}),"closePopup",function(){r.state.isOpen&&(r.props.onClose(),r.setState({isOpen:!1},function(){r.resetScroll()}))}),"onMouseEnter",function(){clearTimeout(r.timeOut);var e=r.props.mouseEnterDelay;r.timeOut=setTimeout(function(){return r.openPopup()},e)}),"onMouseLeave",function(){clearTimeout(r.timeOut);var e=r.props.mouseLeaveDelay;r.timeOut=setTimeout(function(){return r.closePopup()},e)}),"getTooltipBoundary",function(){var e=r.props.keepTooltipInside,t={top:0,left:0,width:window.innerWidth,height:window.innerHeight};"string"==typeof e&&(t=document.querySelector(e).getBoundingClientRect());return t}),"setPosition",function(){var e=r.props,t=e.arrow,o=e.position,n=e.offsetX,i=e.offsetY,p=e.keepTooltipInside,s=e.arrowStyle;if(!r.state.modal){var l=r.HelperEl.getBoundingClientRect(),a=r.TriggerEl.getBoundingClientRect(),u=r.ContentEl.getBoundingClientRect(),c=r.getTooltipBoundary(),h=Array.isArray(o)?o:[o];(p||Array.isArray(o))&&(h=f(h).concat(g));var m=function(e,t,o,n,r,i){for(var p,s=r.offsetX,l=r.offsetY,a=0;a<o.length;){var u={top:(p=d(e,t,o[a],n,{offsetX:s,offsetY:l})).top,left:p.left,width:t.width,height:t.height};if(!(u.top<=i.top||u.left<=i.left||u.top+u.height>=i.top+i.height||u.left+u.width>=i.left+i.width))break;a++}return p}(a,u,h,t,{offsetX:n,offsetY:i},c);r.ContentEl.style.top=m.top-l.top+"px",r.ContentEl.style.left=m.left-l.left+"px",t&&(r.ArrowEl.style.transform=m.transform,r.ArrowEl.style["-ms-transform"]=m.transform,r.ArrowEl.style["-webkit-transform"]=m.transform,r.ArrowEl.style.top=s.top||m.arrowTop,r.ArrowEl.style.left=s.left||m.arrowLeft),"static"!=window.getComputedStyle(r.TriggerEl,null).getPropertyValue("position")&&""!=window.getComputedStyle(r.TriggerEl,null).getPropertyValue("position")||(r.TriggerEl.style.position="relative")}}),"addWarperAction",function(){var e=r.props,t=e.contentStyle,o=e.className,n=e.on,i=r.state.modal,p=i?h.popupContent.modal:h.popupContent.tooltip,s={className:"popup-content ".concat(o),style:Object.assign({},p,t),ref:r.setContentRef,onClick:function(e){e.stopPropagation()}};return!i&&n.indexOf("hover")>=0&&(s.onMouseEnter=r.onMouseEnter,s.onMouseLeave=r.onMouseLeave),s}),"renderTrigger",function(){for(var t={key:"T"},o=r.props,n=o.on,i=o.trigger,p=Array.isArray(n)?n:[n],s=0,l=p.length;s<l;s++)switch(p[s]){case"click":t.onClick=r.togglePopup;break;case"hover":t.onMouseEnter=r.onMouseEnter,t.onMouseLeave=r.onMouseLeave;break;case"focus":t.onFocus=r.onMouseEnter}return"function"==typeof i?e.cloneElement(i(r.state.isOpen),t):e.cloneElement(i,t)}),"renderContent",function(){var t=r.props,o=t.arrow,n=t.arrowStyle,i=r.state.modal;return e.createElement("div",p({},r.addWarperAction(),{key:"C"}),o&&!i&&e.createElement("div",{ref:r.setArrowRef,style:Object.assign({},h.popupArrow,n)}),"function"==typeof r.props.children?r.props.children(r.closePopup,r.state.isOpen):r.props.children)}),r.setTriggerRef=function(e){return r.TriggerEl=e},r.setContentRef=function(e){return r.ContentEl=e},r.setArrowRef=function(e){return r.ArrowEl=e},r.setHelperRef=function(e){return r.HelperEl=e},r.timeOut=0,r}return r(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props,o=t.closeOnEscape;t.defaultOpen&&this.setPosition(),o&&window.addEventListener("keyup",function(t){"Escape"===t.key&&e.closePopup()})}},{key:"componentWillReceiveProps",value:function(e){this.props.open!==e.open&&(e.open?this.openPopup():this.closePopup())}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeOut)}},{key:"render",value:function(){var t=this.props,o=t.overlayStyle,n=t.closeOnDocumentClick,r=t.on,i=this.state.modal,p=this.state.isOpen&&!(r.indexOf("hover")>=0),s=i?h.overlay.modal:h.overlay.tooltip;return[!!this.props.trigger&&e.createElement(y,{innerRef:this.setTriggerRef,key:"R"},this.renderTrigger()),this.state.isOpen&&e.createElement("div",{key:"H",style:{position:"absolute",top:"0px",left:"0px"},ref:this.setHelperRef}),p&&e.createElement("div",{key:"O",className:"popup-overlay",style:Object.assign({},s,o),onClick:n?this.closePopup:void 0},i&&this.renderContent()),this.state.isOpen&&!i&&this.renderContent()]}}]),s(n,t),n}((e=e&&e.hasOwnProperty("default")?e.default:e).PureComponent);i(m,"defaultProps",{children:function(){return e.createElement("span",null," Your Content Here !!")},trigger:null,onOpen:function(){},onClose:function(){},defaultOpen:!1,open:!1,closeOnDocumentClick:!0,closeOnEscape:!0,on:["click"],contentStyle:{},arrowStyle:{},overlayStyle:{},className:"",position:"bottom center",modal:!1,lockScroll:!1,arrow:!0,offsetX:0,offsetY:0,mouseEnterDelay:100,mouseLeaveDelay:100,keepTooltipInside:!1});var y=function(n){function i(e){return o(this,i),c(this,l(i).call(this,e))}return r(i,[{key:"componentDidMount",value:function(){var e=this.props.innerRef;e&&e(t.findDOMNode(this))}},{key:"render",value:function(){var t=this.props.children;return e.Children.only(t)}}]),s(i,n),i}(e.PureComponent);return m});
//# sourceMappingURL=reactjs-popup.min.js.map

@@ -28,3 +28,4 @@ # Reactjs-popup

- Easy to use. 🚀
- IE Support.
- IE Support.🚀
- TypeScript Support 👌
- All these clocks in at around 3 kB zipped. ⚡️

@@ -31,0 +32,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc