react-block-ui
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -0,1 +1,12 @@ | ||
<a name="1.1.4"></a> | ||
## [1.1.4](https://github.com/Availity/react-block-ui/compare/v1.1.3...v1.1.4) (2019-06-18) | ||
### Bug Fixes | ||
* **BlockUI:** allow tag to be components ([#27](https://github.com/Availity/react-block-ui/issues/27)) ([7b51125](https://github.com/Availity/react-block-ui/commit/7b51125)), closes [#8](https://github.com/Availity/react-block-ui/issues/8) | ||
* **focus:** ensure elm can be focused/blurred ([#22](https://github.com/Availity/react-block-ui/issues/22)) ([4ad7107](https://github.com/Availity/react-block-ui/commit/4ad7107)) | ||
<a name="1.1.3"></a> | ||
@@ -2,0 +13,0 @@ ## [1.1.3](https://github.com/Availity/react-block-ui/compare/v1.1.2...v1.1.3) (2018-09-07) |
@@ -185,3 +185,3 @@ 'use strict'; | ||
(window.setImmediate || setTimeout)(function () { | ||
return _this2.focused && _this2.focused.blur(); | ||
return _this2.focused && typeof _this2.focused.blur === 'function' && _this2.focused.blur(); | ||
}); | ||
@@ -194,3 +194,5 @@ } | ||
if (this.focused && (!ae || ae === document.body || ae === this.topFocus)) { | ||
this.focused.focus(); | ||
if (typeof this.focused.focus === 'function') { | ||
this.focused.focus(); | ||
} | ||
this.focused = null; | ||
@@ -314,3 +316,3 @@ } | ||
Tag, | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking, ref: this.setContainer }), | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking }), | ||
blocking && React__default.createElement('div', { tabIndex: '0', onKeyUp: this.tabbedUpTop, onKeyDown: this.tabbedDownTop, ref: this.setTopFocus }), | ||
@@ -326,3 +328,3 @@ renderChilds && children, | ||
}, | ||
React__default.createElement('div', { className: 'block-ui-overlay' }), | ||
React__default.createElement('div', { className: 'block-ui-overlay', ref: this.setContainer }), | ||
React__default.createElement( | ||
@@ -329,0 +331,0 @@ 'div', |
@@ -180,3 +180,3 @@ import React, { Component } from 'react'; | ||
(window.setImmediate || setTimeout)(function () { | ||
return _this2.focused && _this2.focused.blur(); | ||
return _this2.focused && typeof _this2.focused.blur === 'function' && _this2.focused.blur(); | ||
}); | ||
@@ -189,3 +189,5 @@ } | ||
if (this.focused && (!ae || ae === document.body || ae === this.topFocus)) { | ||
this.focused.focus(); | ||
if (typeof this.focused.focus === 'function') { | ||
this.focused.focus(); | ||
} | ||
this.focused = null; | ||
@@ -309,3 +311,3 @@ } | ||
Tag, | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking, ref: this.setContainer }), | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking }), | ||
blocking && React.createElement('div', { tabIndex: '0', onKeyUp: this.tabbedUpTop, onKeyDown: this.tabbedDownTop, ref: this.setTopFocus }), | ||
@@ -321,3 +323,3 @@ renderChilds && children, | ||
}, | ||
React.createElement('div', { className: 'block-ui-overlay' }), | ||
React.createElement('div', { className: 'block-ui-overlay', ref: this.setContainer }), | ||
React.createElement( | ||
@@ -324,0 +326,0 @@ 'div', |
@@ -1,2 +0,2 @@ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('react')):'function'==typeof define&&define.amd?define(['react'],b):a.ReactBlockUi=b(a.React)})(this,function(a){'use strict';function b(a){a=a||document;var b;try{b=document.activeElement,b&&b.nodeName||(b=a.body)}catch(c){b=a.body}return b}var c='default'in a?a['default']:a,d=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},e=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}}(),f=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},g=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)},h=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},i=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},j=function(a){function j(a){d(this,j);var b=i(this,(j.__proto__||Object.getPrototypeOf(j)).call(this,a));return b.tabbedUpTop=b.tabbedUpTop.bind(b),b.tabbedDownTop=b.tabbedDownTop.bind(b),b.tabbedUpBottom=b.tabbedUpBottom.bind(b),b.tabbedDownBottom=b.tabbedDownBottom.bind(b),b.setHelper=b.setRef.bind(b,'helper'),b.setBlocker=b.setRef.bind(b,'blocker'),b.setTopFocus=b.setRef.bind(b,'topFocus'),b.setContainer=b.setRef.bind(b,'container'),b.setMessageContainer=b.setRef.bind(b,'messageContainer'),b.handleScroll=b.handleScroll.bind(b),b.state={top:'50%'},b}return g(j,a),e(j,[{key:'componentWillReceiveProps',value:function(a){var c=this;if(a.blocking!==this.props.blocking)if(a.blocking)this.helper&&this.helper.parentNode&&this.helper.parentNode.contains&&this.helper.parentNode.contains(b())&&(this.focused=b(),this.focused&&this.focused!==document.body&&(window.setImmediate||setTimeout)(function(){return c.focused&&c.focused.blur()}));else{this.detachListeners();var d=b();this.focused&&(!d||d===document.body||d===this.topFocus)&&(this.focused.focus(),this.focused=null)}a.keepInView&&(a.keepInView!==this.props.keepInView||a.blocking&&a.blocking!==this.props.blocking)&&(this.attachListeners(),this.keepInView(a))}},{key:'componentWillUnmount',value:function(){this.detachListeners()}},{key:'setRef',value:function(a,b){this[a]=b}},{key:'attachListeners',value:function(){window.addEventListener('scroll',this.handleScroll)}},{key:'detachListeners',value:function(){window.removeEventListener('scroll',this.handleScroll)}},{key:'blockingTab',value:function(a){var b=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return this.props.blocking&&('Tab'===a.key||9===a.keyCode)&&a.shiftKey==b}},{key:'tabbedUpTop',value:function(a){this.blockingTab(a)&&this.blocker.focus()}},{key:'tabbedDownTop',value:function(a){this.blockingTab(a)&&(a.preventDefault(),this.blocker.focus())}},{key:'tabbedUpBottom',value:function(a){this.blockingTab(a,!0)&&this.topFocus.focus()}},{key:'tabbedDownBottom',value:function(a){this.blockingTab(a,!0)&&(a.preventDefault(),this.topFocus.focus())}},{key:'keepInView',value:function(){var a=Math.max,b=Math.min,c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.props;if(c.blocking&&c.keepInView&&this.container){var d=this.container.getBoundingClientRect(),e=window.innerHeight;if(d.top>e||0>d.bottom)return;if(0<=d.top&&d.bottom<=e)return void('50%'!==this.state.top&&this.setState({top:'50%'}));var f=this.messageContainer?this.messageContainer.getBoundingClientRect().height:0,g=a(b(e,d.bottom)-a(d.top,0),f)/2;0>d.top&&(g=b(g-d.top,d.height-f/2)),this.state.top!==g&&this.setState({top:g})}}},{key:'handleScroll',value:function(){this.keepInView()}},{key:'render',value:function(){var a=this.props,b=a.tag,d=a.blocking,e=a.className,g=a.children,i=a.message,j=a.loader,k=a.renderChildren,l=a.keepInView,m=h(a,['tag','blocking','className','children','message','loader','renderChildren','keepInView']),n=d?'block-ui '+e:e;return c.createElement(b,f({},m,{className:n,"aria-busy":d,ref:this.setContainer}),d&&c.createElement('div',{tabIndex:'0',onKeyUp:this.tabbedUpTop,onKeyDown:this.tabbedDownTop,ref:this.setTopFocus}),(!d||k)&&g,d&&c.createElement('div',{className:'block-ui-container',tabIndex:'0',ref:this.setBlocker,onKeyUp:this.tabbedUpBottom,onKeyDown:this.tabbedDownBottom},c.createElement('div',{className:'block-ui-overlay'}),c.createElement('div',{className:'block-ui-message-container',ref:this.setMessageContainer,style:{top:l?this.state.top:void 0}},c.createElement('div',{className:'block-ui-message'},i,c.isValidElement(j)?j:c.createElement(j,null)))),c.createElement('span',{ref:this.setHelper}))}}]),j}(a.Component);return j.defaultProps={tag:'div',renderChildren:!0,loader:function(){return c.createElement('div',{className:'loading-indicator'},c.createElement('span',{className:'loading-bullet'},'\u2022'),' ',c.createElement('span',{className:'loading-bullet'},'\u2022'),' ',c.createElement('span',{className:'loading-bullet'},'\u2022'))}},j}); | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('react')):'function'==typeof define&&define.amd?define(['react'],b):a.ReactBlockUi=b(a.React)})(this,function(a){'use strict';function b(a){a=a||document;var b;try{b=document.activeElement,b&&b.nodeName||(b=a.body)}catch(c){b=a.body}return b}var c='default'in a?a['default']:a,d=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},e=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}}(),f=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},g=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)},h=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},i=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},j=function(a){function j(a){d(this,j);var b=i(this,(j.__proto__||Object.getPrototypeOf(j)).call(this,a));return b.tabbedUpTop=b.tabbedUpTop.bind(b),b.tabbedDownTop=b.tabbedDownTop.bind(b),b.tabbedUpBottom=b.tabbedUpBottom.bind(b),b.tabbedDownBottom=b.tabbedDownBottom.bind(b),b.setHelper=b.setRef.bind(b,'helper'),b.setBlocker=b.setRef.bind(b,'blocker'),b.setTopFocus=b.setRef.bind(b,'topFocus'),b.setContainer=b.setRef.bind(b,'container'),b.setMessageContainer=b.setRef.bind(b,'messageContainer'),b.handleScroll=b.handleScroll.bind(b),b.state={top:'50%'},b}return g(j,a),e(j,[{key:'componentWillReceiveProps',value:function(a){var c=this;if(a.blocking!==this.props.blocking)if(a.blocking)this.helper&&this.helper.parentNode&&this.helper.parentNode.contains&&this.helper.parentNode.contains(b())&&(this.focused=b(),this.focused&&this.focused!==document.body&&(window.setImmediate||setTimeout)(function(){return c.focused&&'function'==typeof c.focused.blur&&c.focused.blur()}));else{this.detachListeners();var d=b();this.focused&&(!d||d===document.body||d===this.topFocus)&&('function'==typeof this.focused.focus&&this.focused.focus(),this.focused=null)}a.keepInView&&(a.keepInView!==this.props.keepInView||a.blocking&&a.blocking!==this.props.blocking)&&(this.attachListeners(),this.keepInView(a))}},{key:'componentWillUnmount',value:function(){this.detachListeners()}},{key:'setRef',value:function(a,b){this[a]=b}},{key:'attachListeners',value:function(){window.addEventListener('scroll',this.handleScroll)}},{key:'detachListeners',value:function(){window.removeEventListener('scroll',this.handleScroll)}},{key:'blockingTab',value:function(a){var b=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return this.props.blocking&&('Tab'===a.key||9===a.keyCode)&&a.shiftKey==b}},{key:'tabbedUpTop',value:function(a){this.blockingTab(a)&&this.blocker.focus()}},{key:'tabbedDownTop',value:function(a){this.blockingTab(a)&&(a.preventDefault(),this.blocker.focus())}},{key:'tabbedUpBottom',value:function(a){this.blockingTab(a,!0)&&this.topFocus.focus()}},{key:'tabbedDownBottom',value:function(a){this.blockingTab(a,!0)&&(a.preventDefault(),this.topFocus.focus())}},{key:'keepInView',value:function(){var a=Math.max,b=Math.min,c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.props;if(c.blocking&&c.keepInView&&this.container){var d=this.container.getBoundingClientRect(),e=window.innerHeight;if(d.top>e||0>d.bottom)return;if(0<=d.top&&d.bottom<=e)return void('50%'!==this.state.top&&this.setState({top:'50%'}));var f=this.messageContainer?this.messageContainer.getBoundingClientRect().height:0,g=a(b(e,d.bottom)-a(d.top,0),f)/2;0>d.top&&(g=b(g-d.top,d.height-f/2)),this.state.top!==g&&this.setState({top:g})}}},{key:'handleScroll',value:function(){this.keepInView()}},{key:'render',value:function(){var a=this.props,b=a.tag,d=a.blocking,e=a.className,g=a.children,i=a.message,j=a.loader,k=a.renderChildren,l=a.keepInView,m=h(a,['tag','blocking','className','children','message','loader','renderChildren','keepInView']),n=d?'block-ui '+e:e;return c.createElement(b,f({},m,{className:n,"aria-busy":d}),d&&c.createElement('div',{tabIndex:'0',onKeyUp:this.tabbedUpTop,onKeyDown:this.tabbedDownTop,ref:this.setTopFocus}),(!d||k)&&g,d&&c.createElement('div',{className:'block-ui-container',tabIndex:'0',ref:this.setBlocker,onKeyUp:this.tabbedUpBottom,onKeyDown:this.tabbedDownBottom},c.createElement('div',{className:'block-ui-overlay',ref:this.setContainer}),c.createElement('div',{className:'block-ui-message-container',ref:this.setMessageContainer,style:{top:l?this.state.top:void 0}},c.createElement('div',{className:'block-ui-message'},i,c.isValidElement(j)?j:c.createElement(j,null)))),c.createElement('span',{ref:this.setHelper}))}}]),j}(a.Component);return j.defaultProps={tag:'div',renderChildren:!0,loader:function(){return c.createElement('div',{className:'loading-indicator'},c.createElement('span',{className:'loading-bullet'},'\u2022'),' ',c.createElement('span',{className:'loading-bullet'},'\u2022'),' ',c.createElement('span',{className:'loading-bullet'},'\u2022'))}},j}); | ||
//# sourceMappingURL=reactblockui.min.js.map |
@@ -75,3 +75,3 @@ 'use strict'; | ||
(window.setImmediate || setTimeout)(function () { | ||
return _this2.focused && _this2.focused.blur(); | ||
return _this2.focused && typeof _this2.focused.blur === 'function' && _this2.focused.blur(); | ||
}); | ||
@@ -84,3 +84,5 @@ } | ||
if (this.focused && (!ae || ae === document.body || ae === this.topFocus)) { | ||
this.focused.focus(); | ||
if (typeof this.focused.focus === 'function') { | ||
this.focused.focus(); | ||
} | ||
this.focused = null; | ||
@@ -203,3 +205,3 @@ } | ||
Tag, | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking, ref: this.setContainer }), | ||
_extends({}, attributes, { className: classes, 'aria-busy': blocking }), | ||
blocking && _react2.default.createElement('div', { tabIndex: '0', onKeyUp: this.tabbedUpTop, onKeyDown: this.tabbedDownTop, ref: this.setTopFocus }), | ||
@@ -215,3 +217,3 @@ renderChilds && children, | ||
}, | ||
_react2.default.createElement('div', { className: 'block-ui-overlay' }), | ||
_react2.default.createElement('div', { className: 'block-ui-overlay', ref: this.setContainer }), | ||
_react2.default.createElement( | ||
@@ -218,0 +220,0 @@ 'div', |
{ | ||
"name": "react-block-ui", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"author": "Evan Sharp <evan.sharp@availity.com>", | ||
@@ -79,3 +79,2 @@ "description": "Block UI for react", | ||
"babel-register": "^6.11.6", | ||
"bootstrap": "4.0.0-alpha.6", | ||
"chai": "^3.5.0", | ||
@@ -82,0 +81,0 @@ "chai-enzyme": "^0.6.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
103519
64
1572
20
1