New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-switch

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-switch - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

9

CHANGELOG.md

@@ -7,2 +7,11 @@ # Changelog

## [1.2.0 - 2017-09-29]
### Fixed
- Removed react and react-dom from dependencies.
- Css-file replaced with inline styles to avoid webpack style-loader dependence.
### Changed
- Cursor style of handle changed to pointer instead of grabbing.
## [1.1.0] - 2017-09-26

@@ -9,0 +18,0 @@ ### Fixed

94

dist/index.js

@@ -19,4 +19,2 @@ 'use strict';

require('../styles.css');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -48,3 +46,4 @@

startX: null,
isDragging: false
isDragging: false,
focused: false
};

@@ -174,2 +173,4 @@ return _this;

value: function render() {
var _this2 = this;
var _props6 = this.props,

@@ -193,6 +194,49 @@ checked = _props6.checked,

isDragging = _state2.isDragging,
startX = _state2.startX;
startX = _state2.startX,
focused = _state2.focused;
var checkedLeft = width - height + 1;
var backgroundStyle = {
height: height,
width: width,
background: offColor,
borderRadius: height / 2,
display: 'inline-block',
position: 'relative',
opacity: disabled ? 0.5 : 1,
WebkitTransition: 'all 0.2s',
MozTransition: 'all 0.2s',
transition: 'all 0.2s',
cursor: disabled ? 'default' : 'pointer'
};
var foregroundStyle = {
height: height,
width: width,
opacity: (left - 1) / (checkedLeft - 1),
background: onColor,
WebkitTransition: isDragging ? null : 'opacity 0.2s ease-out',
MozTransition: isDragging ? null : 'opacity 0.2s ease-out',
transition: isDragging ? null : 'opacity 0.2s ease-out',
borderRadius: height / 2
};
var handleStyle = {
height: height - 2,
width: height - 2,
background: startX ? activeHandleColor : handleColor,
WebkitTransition: isDragging ? null : 'left 0.2s ease-out',
MozTransition: isDragging ? null : 'left 0.2s ease-out',
transition: isDragging ? null : 'left 0.2s ease-out',
display: 'inline-block',
borderRadius: '50%',
position: 'absolute',
left: left,
top: 1,
border: 0,
outline: 0,
boxShadow: focused ? '0px 0px 1px 2px #4D90FE' : null
};
return _react2.default.createElement(

@@ -202,28 +246,7 @@ 'div',

className: className,
style: {
height: height,
width: width,
background: offColor,
borderRadius: height / 2,
display: 'inline-block',
position: 'relative',
opacity: disabled ? 0.5 : 1,
WebkitTransition: 'all 0.2s',
MozTransition: 'all 0.2s',
transition: 'all 0.2s'
}
style: backgroundStyle
},
_react2.default.createElement('div', {
className: 'react-switch-fg',
style: {
height: height,
width: width,
opacity: (left - 1) / (checkedLeft - 1),
background: onColor,
WebkitTransition: isDragging ? null : 'opacity 0.2s ease-out',
MozTransition: isDragging ? null : 'opacity 0.2s ease-out',
transition: isDragging ? null : 'opacity 0.2s ease-out',
borderRadius: height / 2,
cursor: disabled ? 'default' : 'pointer'
},
style: foregroundStyle,
onClick: disabled ? null : this.handleClick

@@ -246,13 +269,10 @@ }),

onKeyDown: this.handleKeyDown,
onFocus: function onFocus() {
return _this2.setState({ focused: true });
},
onBlur: function onBlur() {
return _this2.setState({ focused: false });
},
className: 'react-switch-handle',
style: {
left: left,
height: height - 2,
width: height - 2,
background: startX ? activeHandleColor : handleColor,
WebkitTransition: isDragging ? null : 'left 0.2s ease-out',
MozTransition: isDragging ? null : 'left 0.2s ease-out',
transition: isDragging ? null : 'left 0.2s ease-out',
cursor: disabled ? 'default' : null
},
style: handleStyle,
id: id,

@@ -259,0 +279,0 @@ name: name,

{
"name": "react-switch",
"version": "1.1.0",
"version": "1.2.0",
"description": "Draggable toggle-switch component for react",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"build:watch": "babel src -w -d dist",
"build-examples": "webpack -p",
"push-examples": "webpack -p && git subtree push --prefix examples/dist origin gh-pages",
"lint": "eslint --ext .js,.jsx src/",

@@ -48,2 +48,5 @@ "prepublishOnly": "npm run build",

"jest": "^21.1.0",
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^15.6.1",

@@ -55,6 +58,10 @@ "style-loader": "^0.18.2",

"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-draggable": "^3.0.3"
}
},
"keywords": [
"switch",
"toggle",
"react",
"react-component"
]
}
# react-switch
A draggable, customizable and accessible toggle-switch component for React.
[![npm](https://img.shields.io/npm/v/react-switch.svg)]()
[![npm](https://img.shields.io/npm/dm/react-switch.svg)]()
A draggable, customizable and accessible toggle-switch component for React.
<img src="https://media.giphy.com/media/l1J9OD7acbBrtYrWU/giphy.gif" />
## Demo

@@ -5,0 +11,0 @@

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