react-popper
Advanced tools
Comparing version 0.9.4 to 0.9.5
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('prop-types'), require('popper.js')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react', 'prop-types', 'popper.js'], factory) : | ||
(factory((global['react-popper'] = {}),global.React,global.PropTypes,global.Popper)); | ||
(factory((global.ReactPopper = {}),global.React,global.PropTypes,global.Popper)); | ||
}(this, (function (exports,react,PropTypes,PopperJS) { 'use strict'; | ||
@@ -6,0 +6,0 @@ |
@@ -1,3 +0,3 @@ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('prop-types'),require('popper.js')):'function'==typeof define&&define.amd?define(['exports','react','prop-types','popper.js'],b):b(a['react-popper']={},a.React,a.PropTypes,a.Popper)})(this,function(a,b,c,d){'use strict';c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d;var e=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},f=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},h=function(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)},i=function(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c},j=function(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a},k=function(a){function c(){var a,b,d,f;e(this,c);for(var g=arguments.length,h=Array(g),i=0;i<g;i++)h[i]=arguments[i];return f=(b=(d=j(this,(a=c.__proto__||Object.getPrototypeOf(c)).call.apply(a,[this].concat(h))),d),d._setTargetNode=function(a){d._targetNode=a},d._getTargetNode=function(){return d._targetNode},b),j(d,f)}return h(c,a),f(c,[{key:'getChildContext',value:function(){return{popperManager:{setTargetNode:this._setTargetNode,getTargetNode:this._getTargetNode}}}},{key:'render',value:function(){var a=this.props,c=a.tag,d=a.children,e=i(a,['tag','children']);return!1===c?d:b.createElement(c,e,d)}}]),c}(b.Component);k.childContextTypes={popperManager:c.object.isRequired},k.defaultProps={tag:'div'},k.propTypes='production'===process.env.NODE_ENV?{}:{tag:c.oneOfType([c.string,c.bool]),children:c.oneOfType([c.node,c.func])};var l=function(a,c){var d=a.component,e=void 0===d?'div':d,f=a.innerRef,h=a.children,j=i(a,['component','innerRef','children']),k=c.popperManager,l=function(a){k.setTargetNode(a),'function'==typeof f&&f(a)};if('function'==typeof h){return h({targetProps:{ref:l},restProps:j})}var m=g({},j);return'string'==typeof e?m.ref=l:m.innerRef=l,b.createElement(e,m,h)};l.contextTypes={popperManager:c.object.isRequired},l.propTypes={component:c.oneOfType([c.node,c.func]),innerRef:c.func,children:c.oneOfType([c.node,c.func])};var m=d.placements,n=function(a){function c(){var a,b,d,f;e(this,c);for(var h=arguments.length,i=Array(h),k=0;k<h;k++)i[k]=arguments[k];return f=(b=(d=j(this,(a=c.__proto__||Object.getPrototypeOf(c)).call.apply(a,[this].concat(i))),d),d.state={},d._setArrowNode=function(a){d._arrowNode=a},d._getTargetNode=function(){if(d.props.target)return d.props.target;if(!d.context.popperManager||!d.context.popperManager.getTargetNode())throw new Error('Target missing. Popper must be given a target from the Popper Manager, or as a prop.');return d.context.popperManager.getTargetNode()},d._getOffsets=function(a){return Object.keys(a.offsets).map(function(b){return a.offsets[b]})},d._isDataDirty=function(a){return!d.state.data||JSON.stringify(d._getOffsets(d.state.data))!==JSON.stringify(d._getOffsets(a))},d._updateStateModifier={enabled:!0,order:900,fn:function(a){return d._isDataDirty(a)&&d.setState({data:a}),a}},d._getPopperStyle=function(){var a=d.state.data;return d._popper&&a?g({position:a.offsets.popper.position},a.styles):{position:'absolute',pointerEvents:'none',opacity:0}},d._getPopperPlacement=function(){return d.state.data?d.state.data.placement:void 0},d._getPopperHide=function(){return!!d.state.data&&d.state.data.hide?'':void 0},d._getArrowStyle=function(){if(!d.state.data||!d.state.data.offsets.arrow)return{};var a=d.state.data.offsets.arrow,b=a.top,c=a.left;return{top:b,left:c}},d._handlePopperRef=function(a){d._popperNode=a,a?d._createPopper():d._destroyPopper(),d.props.innerRef&&d.props.innerRef(a)},d._scheduleUpdate=function(){d._popper&&d._popper.scheduleUpdate()},b),j(d,f)}return h(c,a),f(c,[{key:'getChildContext',value:function(){return{popper:{setArrowNode:this._setArrowNode,getArrowStyle:this._getArrowStyle}}}},{key:'componentDidUpdate',value:function(a){(a.placement!==this.props.placement||a.eventsEnabled!==this.props.eventsEnabled||a.target!==this.props.target)&&(this._destroyPopper(),this._createPopper()),a.children!==this.props.children&&this._scheduleUpdate()}},{key:'componentWillUnmount',value:function(){this._destroyPopper()}},{key:'_createPopper',value:function(){var a=this,b=this.props,c=b.placement,e=b.eventsEnabled,f=g({},this.props.modifiers,{applyStyle:{enabled:!1},updateState:this._updateStateModifier});this._arrowNode&&(f.arrow=g({},this.props.modifiers.arrow||{},{element:this._arrowNode})),this._popper=new d(this._getTargetNode(),this._popperNode,{placement:c,eventsEnabled:e,modifiers:f}),setTimeout(function(){return a._scheduleUpdate()})}},{key:'_destroyPopper',value:function(){this._popper&&this._popper.destroy()}},{key:'render',value:function(){var a=this.props,c=a.component,d=a.innerRef,e=a.placement,f=a.eventsEnabled,h=a.modifiers,j=a.children,k=i(a,['component','innerRef','placement','eventsEnabled','modifiers','children']),l=this._getPopperStyle(),m=this._getPopperPlacement(),n=this._getPopperHide();if('function'==typeof j){var o={ref:this._handlePopperRef,style:l,"data-placement":m,"data-x-out-of-boundaries":n};return j({popperProps:o,restProps:k,scheduleUpdate:this._scheduleUpdate})}var p=g({},k,{style:g({},k.style,l),"data-placement":m,"data-x-out-of-boundaries":n});return'string'==typeof c?p.ref=this._handlePopperRef:p.innerRef=this._handlePopperRef,b.createElement(c,p,j)}}]),c}(b.Component);n.contextTypes={popperManager:c.object},n.childContextTypes={popper:c.object.isRequired},n.defaultProps={component:'div',placement:'bottom',eventsEnabled:!0,modifiers:{}},n.propTypes='production'===process.env.NODE_ENV?{}:{component:c.oneOfType([c.node,c.func]),innerRef:c.func,placement:c.oneOf(m),eventsEnabled:c.bool,modifiers:c.object,children:c.oneOfType([c.node,c.func]),target:c.oneOfType([// the following check is needed for SSR | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('prop-types'),require('popper.js')):'function'==typeof define&&define.amd?define(['exports','react','prop-types','popper.js'],b):b(a.ReactPopper={},a.React,a.PropTypes,a.Popper)})(this,function(a,b,c,d){'use strict';c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d;var e=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},f=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),g=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},h=function(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)},i=function(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c},j=function(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a},k=function(a){function c(){var a,b,d,f;e(this,c);for(var g=arguments.length,h=Array(g),i=0;i<g;i++)h[i]=arguments[i];return f=(b=(d=j(this,(a=c.__proto__||Object.getPrototypeOf(c)).call.apply(a,[this].concat(h))),d),d._setTargetNode=function(a){d._targetNode=a},d._getTargetNode=function(){return d._targetNode},b),j(d,f)}return h(c,a),f(c,[{key:'getChildContext',value:function(){return{popperManager:{setTargetNode:this._setTargetNode,getTargetNode:this._getTargetNode}}}},{key:'render',value:function(){var a=this.props,c=a.tag,d=a.children,e=i(a,['tag','children']);return!1===c?d:b.createElement(c,e,d)}}]),c}(b.Component);k.childContextTypes={popperManager:c.object.isRequired},k.defaultProps={tag:'div'},k.propTypes='production'===process.env.NODE_ENV?{}:{tag:c.oneOfType([c.string,c.bool]),children:c.oneOfType([c.node,c.func])};var l=function(a,c){var d=a.component,e=void 0===d?'div':d,f=a.innerRef,h=a.children,j=i(a,['component','innerRef','children']),k=c.popperManager,l=function(a){k.setTargetNode(a),'function'==typeof f&&f(a)};if('function'==typeof h){return h({targetProps:{ref:l},restProps:j})}var m=g({},j);return'string'==typeof e?m.ref=l:m.innerRef=l,b.createElement(e,m,h)};l.contextTypes={popperManager:c.object.isRequired},l.propTypes={component:c.oneOfType([c.node,c.func]),innerRef:c.func,children:c.oneOfType([c.node,c.func])};var m=d.placements,n=function(a){function c(){var a,b,d,f;e(this,c);for(var h=arguments.length,i=Array(h),k=0;k<h;k++)i[k]=arguments[k];return f=(b=(d=j(this,(a=c.__proto__||Object.getPrototypeOf(c)).call.apply(a,[this].concat(i))),d),d.state={},d._setArrowNode=function(a){d._arrowNode=a},d._getTargetNode=function(){if(d.props.target)return d.props.target;if(!d.context.popperManager||!d.context.popperManager.getTargetNode())throw new Error('Target missing. Popper must be given a target from the Popper Manager, or as a prop.');return d.context.popperManager.getTargetNode()},d._getOffsets=function(a){return Object.keys(a.offsets).map(function(b){return a.offsets[b]})},d._isDataDirty=function(a){return!d.state.data||JSON.stringify(d._getOffsets(d.state.data))!==JSON.stringify(d._getOffsets(a))},d._updateStateModifier={enabled:!0,order:900,fn:function(a){return d._isDataDirty(a)&&d.setState({data:a}),a}},d._getPopperStyle=function(){var a=d.state.data;return d._popper&&a?g({position:a.offsets.popper.position},a.styles):{position:'absolute',pointerEvents:'none',opacity:0}},d._getPopperPlacement=function(){return d.state.data?d.state.data.placement:void 0},d._getPopperHide=function(){return!!d.state.data&&d.state.data.hide?'':void 0},d._getArrowStyle=function(){if(!d.state.data||!d.state.data.offsets.arrow)return{};var a=d.state.data.offsets.arrow,b=a.top,c=a.left;return{top:b,left:c}},d._handlePopperRef=function(a){d._popperNode=a,a?d._createPopper():d._destroyPopper(),d.props.innerRef&&d.props.innerRef(a)},d._scheduleUpdate=function(){d._popper&&d._popper.scheduleUpdate()},b),j(d,f)}return h(c,a),f(c,[{key:'getChildContext',value:function(){return{popper:{setArrowNode:this._setArrowNode,getArrowStyle:this._getArrowStyle}}}},{key:'componentDidUpdate',value:function(a){(a.placement!==this.props.placement||a.eventsEnabled!==this.props.eventsEnabled||a.target!==this.props.target)&&(this._destroyPopper(),this._createPopper()),a.children!==this.props.children&&this._scheduleUpdate()}},{key:'componentWillUnmount',value:function(){this._destroyPopper()}},{key:'_createPopper',value:function(){var a=this,b=this.props,c=b.placement,e=b.eventsEnabled,f=g({},this.props.modifiers,{applyStyle:{enabled:!1},updateState:this._updateStateModifier});this._arrowNode&&(f.arrow=g({},this.props.modifiers.arrow||{},{element:this._arrowNode})),this._popper=new d(this._getTargetNode(),this._popperNode,{placement:c,eventsEnabled:e,modifiers:f}),setTimeout(function(){return a._scheduleUpdate()})}},{key:'_destroyPopper',value:function(){this._popper&&this._popper.destroy()}},{key:'render',value:function(){var a=this.props,c=a.component,d=a.innerRef,e=a.placement,f=a.eventsEnabled,h=a.modifiers,j=a.children,k=i(a,['component','innerRef','placement','eventsEnabled','modifiers','children']),l=this._getPopperStyle(),m=this._getPopperPlacement(),n=this._getPopperHide();if('function'==typeof j){var o={ref:this._handlePopperRef,style:l,"data-placement":m,"data-x-out-of-boundaries":n};return j({popperProps:o,restProps:k,scheduleUpdate:this._scheduleUpdate})}var p=g({},k,{style:g({},k.style,l),"data-placement":m,"data-x-out-of-boundaries":n});return'string'==typeof c?p.ref=this._handlePopperRef:p.innerRef=this._handlePopperRef,b.createElement(c,p,j)}}]),c}(b.Component);n.contextTypes={popperManager:c.object},n.childContextTypes={popper:c.object.isRequired},n.defaultProps={component:'div',placement:'bottom',eventsEnabled:!0,modifiers:{}},n.propTypes='production'===process.env.NODE_ENV?{}:{component:c.oneOfType([c.node,c.func]),innerRef:c.func,placement:c.oneOf(m),eventsEnabled:c.bool,modifiers:c.object,children:c.oneOfType([c.node,c.func]),target:c.oneOfType([// the following check is needed for SSR | ||
c.instanceOf('undefined'==typeof Element?Object:Element),c.shape({getBoundingClientRect:c.func.isRequired,clientWidth:c.number.isRequired,clientHeight:c.number.isRequired})])};var o=function(a,c){var d=a.component,e=void 0===d?'span':d,f=a.innerRef,h=a.children,j=i(a,['component','innerRef','children']),k=c.popper,l=function(a){k.setArrowNode(a),'function'==typeof f&&f(a)},m=k.getArrowStyle();if('function'==typeof h){return h({arrowProps:{ref:l,style:m},restProps:j})}var n=g({},j,{style:g({},m,j.style)});return'string'==typeof e?n.ref=l:n.innerRef=l,b.createElement(e,n,h)};o.contextTypes={popper:c.object.isRequired},o.propTypes={component:c.oneOfType([c.node,c.func]),innerRef:c.func,children:c.oneOfType([c.node,c.func])},a.Manager=k,a.Target=l,a.Popper=n,a.placements=m,a.Arrow=o,Object.defineProperty(a,'__esModule',{value:!0})}); | ||
//# sourceMappingURL=react-popper.umd.min.js.map |
{ | ||
"name": "react-popper", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"description": "React wrapper around PopperJS.", | ||
@@ -21,6 +21,6 @@ "license": "MIT", | ||
"build:es": "babel src --out-dir lib && mv lib/index.js lib/react-popper.js", | ||
"build:umd": "rollup -c --output.format umd --output.name 'react-popper' --output.file dist/react-popper.umd.js", | ||
"build:cjs": "rollup -c --output.format cjs --output.name 'react-popper' --output.file dist/react-popper.js", | ||
"build:umd-min": "MINIFY=true rollup -c --output.format umd --output.name 'react-popper' --output.file dist/react-popper.umd.min.js", | ||
"build:cjs-min": "MINIFY=true rollup -c --output.format cjs --output.name 'react-popper' --output.file dist/react-popper.min.js", | ||
"build:umd": "rollup -c --output.format umd --output.name ReactPopper --output.file dist/react-popper.umd.js", | ||
"build:cjs": "rollup -c --output.format cjs --output.name ReactPopper --output.file dist/react-popper.js", | ||
"build:umd-min": "MINIFY=true rollup -c --output.format umd --output.name ReactPopper --output.file dist/react-popper.umd.min.js", | ||
"build:cjs-min": "MINIFY=true rollup -c --output.format cjs --output.name ReactPopper --output.file dist/react-popper.min.js", | ||
"demo": "parcel --out-dir demo/dist demo/index.html", | ||
@@ -27,0 +27,0 @@ "prepare": "npm run build", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
144821