react-progressbar
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -25,4 +27,10 @@ | ||
var PropTypes = { | ||
completed: _react2.default.PropTypes.number, | ||
completed: function completed(props, propName) { | ||
if (typeof props[propName] !== 'number') return Progress.throwError('Invalid Props: "completed" should ∈ ℝ '); | ||
if (props[propName] < 0 || props[propName] > 100) { | ||
return Progress.throwError('Invalid Props: "completed" should be between 0 and 100'); | ||
} | ||
}, | ||
color: _react2.default.PropTypes.string, | ||
animation: _react2.default.PropTypes.number, | ||
height: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]) | ||
@@ -34,2 +42,3 @@ }; | ||
color: '#0BD318', | ||
animation: 200, | ||
height: 10 | ||
@@ -52,10 +61,13 @@ }; | ||
color = _props.color, | ||
completed = _props.completed, | ||
animation = _props.animation, | ||
height = _props.height, | ||
className = _props.className, | ||
children = _props.children, | ||
rest = _objectWithoutProperties(_props, ['color', 'height', 'children']); | ||
rest = _objectWithoutProperties(_props, ['color', 'completed', 'animation', 'height', 'className', 'children']); | ||
var style = { | ||
backgroundColor: color, | ||
width: this.completed + '%', | ||
transition: "width 200ms", | ||
width: completed + '%', | ||
transition: 'width ' + animation + 'ms', | ||
height: height | ||
@@ -66,3 +78,3 @@ }; | ||
'div', | ||
{ className: 'progressbar-container' }, | ||
_extends({ className: className || "progressbar-container" }, rest), | ||
_react2.default.createElement( | ||
@@ -75,9 +87,2 @@ 'div', | ||
} | ||
}, { | ||
key: 'completed', | ||
get: function get() { | ||
if (this.props.completed < 0) return 0; | ||
if (this.props.completed > 100) return 100; | ||
return this.props.completed; | ||
} | ||
}]); | ||
@@ -91,4 +96,7 @@ | ||
Progress.propTypes = PropTypes; | ||
Progress.throwError = function () { | ||
return new (Function.prototype.bind.apply(Error, [null].concat(Array.prototype.slice.call(arguments))))(); | ||
}; | ||
Progress.defaultProps = defaultProps; | ||
exports.default = Progress; |
{ | ||
"name": "react-progressbar", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "Basic progress bar in React", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
8337
74