react-progressbar
Advanced tools
Comparing version 1.3.4 to 1.4.0
@@ -9,2 +9,10 @@ 'use strict'; | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,4 +24,18 @@ | ||
var React = require('react'); | ||
var PropTypes = { | ||
completed: _react2.default.PropTypes.oneOf(Array.from({ | ||
length: 101 | ||
}, function (v, k) { | ||
return k; | ||
})), | ||
color: _react2.default.PropTypes.string, | ||
height: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]) | ||
}; | ||
var defaultProps = { | ||
completed: 0, | ||
color: '#0BD318', | ||
height: 10 | ||
}; | ||
var Progress = function (_React$Component) { | ||
@@ -31,25 +53,23 @@ _inherits(Progress, _React$Component); | ||
value: function render() { | ||
var _props = this.props, | ||
color = _props.color, | ||
completed = _props.completed, | ||
height = _props.height, | ||
children = _props.children, | ||
rest = _objectWithoutProperties(_props, ['color', 'completed', 'height', 'children']); | ||
var completed = +this.props.completed; | ||
if (completed === NaN || completed < 0) { | ||
completed = 0; | ||
}; | ||
if (completed > 100) { | ||
completed = 100; | ||
}; | ||
var style = { | ||
backgroundColor: this.props.color || '#0BD318', | ||
backgroundColor: color, | ||
width: completed + '%', | ||
transition: "width 200ms", | ||
height: this.props.height || 10 | ||
height: height | ||
}; | ||
return React.createElement( | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: 'progressbar-container' }, | ||
React.createElement( | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'progressbar-progress', style: style }, | ||
this.props.children | ||
children | ||
) | ||
@@ -61,5 +81,9 @@ ); | ||
return Progress; | ||
}(React.Component); | ||
}(_react2.default.Component); | ||
exports.default = Progress; | ||
; | ||
; | ||
Progress.propTypes = PropTypes; | ||
Progress.defaultProps = defaultProps; | ||
exports.default = Progress; |
{ | ||
"name": "react-progressbar", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"description": "Basic progress bar in React", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"prepublish": "babel ./src --out-dir ./lib" | ||
"build": "babel -d lib/ src/", | ||
"prepublish": "npm run build", | ||
"test": "node_modules/.bin/babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- test/*.js", | ||
"coverage": "istanbul cover _mocha -- --ui bdd -R spec -t 5000;open ./coverage/lcov-report/index.html", | ||
"cover": "node_modules/.bin/babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha", | ||
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.2.0", | ||
"babel-core": "^6.2.1", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-react": "^6.1.18" | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.18.2", | ||
"babel-istanbul": "^0.11.0", | ||
"babel-polyfill": "^6.16.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-1": "^6.16.0", | ||
"coveralls": "^2.11.15", | ||
"enzyme": "^2.6.0", | ||
"expect": "^1.20.2", | ||
"jsdom": "^9.8.3", | ||
"jsdom-global": "^2.1.0", | ||
"mocha": "^3.2.0", | ||
"mocha-lcov-reporter": "^1.2.0", | ||
"react": "^15.4.1", | ||
"react-addons-test-utils": "^15.4.1", | ||
"react-dom": "^15.4.1", | ||
"sinon": "^1.17.6" | ||
}, | ||
@@ -15,0 +34,0 @@ "babel": { |
@@ -1,9 +0,13 @@ | ||
react-progressbar | ||
# react-progressbar | ||
================= | ||
[![Build Status](https://travis-ci.org/abdennour/react-progressbar.svg?branch=master)](https://travis-ci.org/abdennour/react-progressbar) | ||
[![Coverage Status](https://coveralls.io/repos/github/abdennour/react-progressbar/badge.svg?branch=master)](https://coveralls.io/github/abdennour/react-progressbar?branch=master) | ||
Basic progress bar in React.js. | ||
![Screenshot of progress bar](https://raw.githubusercontent.com/paramaggarwal/react-progressbar/master/screenshot.png) | ||
![Screenshot of progress bar](https://raw.githubusercontent.com/abdennour/react-progressbar/master/screenshot.png) | ||
Demo: http://paramaggarwal.github.io/react-progressbar/ | ||
Demo: http://abdennour.github.io/react-progressbar/ | ||
@@ -13,2 +17,3 @@ Usage | ||
Simply `require('react-progressbar')` and pass in `completed` property as a number between 0 and 100. | ||
@@ -18,3 +23,3 @@ | ||
```jsx | ||
```js | ||
@@ -34,6 +39,3 @@ var Progress = require('react-progressbar'); | ||
Author | ||
====== | ||
Param Aggarwal (paramaggarwal@gmail.com) | ||
@@ -40,0 +42,0 @@ License |
Sorry, the diff of this file is not supported yet
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
7859
9
43
18
65
1