Comparing version 1.5.1 to 1.5.2
@@ -46,2 +46,5 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
value: function setChecked(checked) { | ||
if (this.props.disabled) { | ||
return; | ||
} | ||
if (!('checked' in this.props)) { | ||
@@ -100,10 +103,6 @@ this.setState({ | ||
this.toggle = function () { | ||
var _props2 = _this2.props, | ||
disabled = _props2.disabled, | ||
onClick = _props2.onClick; | ||
var onClick = _this2.props.onClick; | ||
var checked = !_this2.state.checked; | ||
if (!disabled) { | ||
_this2.setChecked(checked); | ||
} | ||
_this2.setChecked(checked); | ||
onClick(checked); | ||
@@ -114,6 +113,10 @@ }; | ||
if (e.keyCode === 37) { | ||
// Left | ||
_this2.setChecked(false); | ||
} | ||
if (e.keyCode === 39) { | ||
} else if (e.keyCode === 39) { | ||
// Right | ||
_this2.setChecked(true); | ||
} else if (e.keyCode === 32 || e.keyCode === 13) { | ||
// Space, Enter | ||
_this2.toggle(); | ||
} | ||
@@ -120,0 +123,0 @@ }; |
@@ -81,2 +81,5 @@ 'use strict'; | ||
value: function setChecked(checked) { | ||
if (this.props.disabled) { | ||
return; | ||
} | ||
if (!('checked' in this.props)) { | ||
@@ -134,10 +137,6 @@ this.setState({ | ||
this.toggle = function () { | ||
var _props2 = _this2.props, | ||
disabled = _props2.disabled, | ||
onClick = _props2.onClick; | ||
var onClick = _this2.props.onClick; | ||
var checked = !_this2.state.checked; | ||
if (!disabled) { | ||
_this2.setChecked(checked); | ||
} | ||
_this2.setChecked(checked); | ||
onClick(checked); | ||
@@ -148,6 +147,10 @@ }; | ||
if (e.keyCode === 37) { | ||
// Left | ||
_this2.setChecked(false); | ||
} | ||
if (e.keyCode === 39) { | ||
} else if (e.keyCode === 39) { | ||
// Right | ||
_this2.setChecked(true); | ||
} else if (e.keyCode === 32 || e.keyCode === 13) { | ||
// Space, Enter | ||
_this2.toggle(); | ||
} | ||
@@ -154,0 +157,0 @@ }; |
{ | ||
"name": "rc-switch", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "switch ui component for react", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
}, | ||
"licenses": "MIT", | ||
"license": "MIT", | ||
"config": { | ||
@@ -29,0 +29,0 @@ "port": 8001 |
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
19119
427