react-switch
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -8,2 +8,8 @@ # Changelog | ||
## [2.3.1 - 2018-04-08] | ||
### Added | ||
* Devs now receive a console warning if they have passed an invalid color prop. | ||
## [2.3.0 - 2017-12-27] | ||
@@ -10,0 +16,0 @@ |
@@ -23,2 +23,6 @@ "use strict"; | ||
var _hexColorPropType = require("./hexColorPropType"); | ||
var _hexColorPropType2 = _interopRequireDefault(_hexColorPropType); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -32,9 +36,9 @@ | ||
var Switch = function (_Component) { | ||
_inherits(Switch, _Component); | ||
var ReactSwitch = function (_Component) { | ||
_inherits(ReactSwitch, _Component); | ||
function Switch(props) { | ||
_classCallCheck(this, Switch); | ||
function ReactSwitch(props) { | ||
_classCallCheck(this, ReactSwitch); | ||
var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (ReactSwitch.__proto__ || Object.getPrototypeOf(ReactSwitch)).call(this, props)); | ||
@@ -60,3 +64,3 @@ _initialiseProps.call(_this); | ||
_createClass(Switch, [{ | ||
_createClass(ReactSwitch, [{ | ||
key: "componentWillReceiveProps", | ||
@@ -216,5 +220,44 @@ value: function componentWillReceiveProps(_ref) { | ||
return Switch; | ||
return ReactSwitch; | ||
}(_react.Component); | ||
ReactSwitch.propTypes = { | ||
checked: _propTypes2.default.bool.isRequired, | ||
onChange: _propTypes2.default.func.isRequired, | ||
disabled: _propTypes2.default.bool, | ||
offColor: _hexColorPropType2.default, | ||
onColor: _hexColorPropType2.default, | ||
offHandleColor: _hexColorPropType2.default, | ||
onHandleColor: _hexColorPropType2.default, | ||
handleDiameter: _propTypes2.default.number, | ||
uncheckedIcon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.element]), | ||
checkedIcon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.element]), | ||
boxShadow: _propTypes2.default.string, | ||
activeBoxShadow: _propTypes2.default.string, | ||
height: _propTypes2.default.number, | ||
width: _propTypes2.default.number, | ||
className: _propTypes2.default.string, | ||
id: _propTypes2.default.string, | ||
"aria-labelledby": _propTypes2.default.string, | ||
"aria-label": _propTypes2.default.string | ||
}; | ||
ReactSwitch.defaultProps = { | ||
disabled: false, | ||
offColor: "#888", | ||
onColor: "#080", | ||
offHandleColor: "#fff", | ||
onHandleColor: "#fff", | ||
handleDiameter: null, | ||
uncheckedIcon: _icons.uncheckedIcon, | ||
checkedIcon: _icons.checkedIcon, | ||
boxShadow: null, | ||
activeBoxShadow: "0px 0px 2px 3px #33bbff", | ||
height: 28, | ||
width: 56, | ||
className: null, | ||
id: null, | ||
"aria-labelledby": null, | ||
"aria-label": null | ||
}; | ||
var _initialiseProps = function _initialiseProps() { | ||
@@ -343,42 +386,2 @@ var _this3 = this; | ||
Switch.propTypes = { | ||
checked: _propTypes2.default.bool.isRequired, | ||
onChange: _propTypes2.default.func.isRequired, | ||
disabled: _propTypes2.default.bool, | ||
offColor: _propTypes2.default.string, | ||
onColor: _propTypes2.default.string, | ||
offHandleColor: _propTypes2.default.string, | ||
onHandleColor: _propTypes2.default.string, | ||
handleDiameter: _propTypes2.default.number, | ||
uncheckedIcon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.element]), | ||
checkedIcon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.element]), | ||
boxShadow: _propTypes2.default.string, | ||
activeBoxShadow: _propTypes2.default.string, | ||
height: _propTypes2.default.number, | ||
width: _propTypes2.default.number, | ||
className: _propTypes2.default.string, | ||
id: _propTypes2.default.string, | ||
"aria-labelledby": _propTypes2.default.string, | ||
"aria-label": _propTypes2.default.string | ||
}; | ||
Switch.defaultProps = { | ||
disabled: false, | ||
offColor: "#888", | ||
onColor: "#080", | ||
offHandleColor: "#fff", | ||
onHandleColor: "#fff", | ||
handleDiameter: null, | ||
uncheckedIcon: _icons.uncheckedIcon, | ||
checkedIcon: _icons.checkedIcon, | ||
boxShadow: null, | ||
activeBoxShadow: "0px 0px 2px 3px #33bbff", | ||
height: 28, | ||
width: 56, | ||
className: null, | ||
id: null, | ||
"aria-labelledby": null, | ||
"aria-label": null | ||
}; | ||
exports.default = Switch; | ||
exports.default = ReactSwitch; |
{ | ||
"name": "react-switch", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Draggable toggle-switch component for react", | ||
@@ -8,11 +8,11 @@ "main": "dist/index.js", | ||
"build": "babel src -d dist", | ||
"build:watch": "babel src -w -d dist", | ||
"build:dev": "babel src -w -d dist", | ||
"examples:dev": "webpack-dev-server --mode development", | ||
"examples:prod": "webpack --mode production", | ||
"push-examples": "npm run examples:prod && git subtree push --prefix examples/dist origin gh-pages", | ||
"format": "prettier --write '**/*.{js,jsx,json}'", | ||
"push-examples": "webpack -p && git subtree push --prefix examples/dist origin gh-pages", | ||
"lint": "eslint --ext .js,.jsx src/ examples/src", | ||
"prepublishOnly": "npm run build", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"start": "webpack-dev-server", | ||
"stats": "webpack -p --profile --json > stats.json && webpack-bundle-analyzer stats.json examples/dist -s gzip" | ||
"analyze-bundle": "webpack -p --profile --json > stats.json && webpack-bundle-analyzer stats.json examples/dist -s gzip" | ||
}, | ||
@@ -51,4 +51,4 @@ "repository": { | ||
"eslint-plugin-react": "^7.4.0", | ||
"html-webpack-plugin": "^2.30.1", | ||
"jest": "^21.2.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
"jest": "^22.4.3", | ||
"prettier": "^1.9.2", | ||
@@ -59,6 +59,7 @@ "raf": "^3.4.0", | ||
"react-test-renderer": "^16.0.0", | ||
"style-loader": "^0.19.0", | ||
"webpack": "^3.7.1", | ||
"style-loader": "^0.20.3", | ||
"webpack": "^4.5.0", | ||
"webpack-bundle-analyzer": "^2.9.0", | ||
"webpack-dev-server": "^2.9.1" | ||
"webpack-cli": "^2.0.14", | ||
"webpack-dev-server": "^3.1.2" | ||
}, | ||
@@ -65,0 +66,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# react-switch | ||
A draggable toggle-switch component for React. | ||
@@ -97,4 +97,36 @@ [![npm](https://img.shields.io/npm/v/react-switch.svg)](https://www.npmjs.com/package/react-switch) | ||
## Development | ||
You're welcome to contribute to react-switch. | ||
To set up the project: | ||
1. Fork and clone the repository | ||
2. `$ npm install` | ||
3. `$ npm run build:dev` | ||
4. `$ npm run examples:dev` in a separate terminal window | ||
The demo page will then be served on http://localhost:8000/ in watch mode, meaning you don't have refresh the page to see your changes. | ||
## Contributors | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<img src="https://avatars3.githubusercontent.com/u/22945927?s=150&v=4" width="120"> | ||
<br /> | ||
<a href="https://github.com/yogaboll">Markus Englund<a/> | ||
</td> | ||
<td align="center"> | ||
<img src="https://avatars0.githubusercontent.com/u/4565854?v=4" width="120"> | ||
<br /> | ||
<a href="https://github.com/timothymclane">Timothy McLane<a/> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
## License | ||
MIT |
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
40305
9
552
132
29