Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-switch

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-switch - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

19

es/Switch.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc