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

rc-switch

Package Overview
Dependencies
Maintainers
6
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.9.0 to 1.9.1

32

es/Switch.js

@@ -13,6 +13,2 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -22,4 +18,12 @@

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -33,7 +37,7 @@

var Switch =
/*#__PURE__*/
function (_Component) {
var Switch = /*#__PURE__*/function (_Component) {
_inherits(Switch, _Component);
var _super = _createSuper(Switch);
function Switch(props) {

@@ -44,5 +48,5 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this, props));
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleClick", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
var checked = _this.state.checked;

@@ -59,3 +63,3 @@ var onClick = _this.props.onClick;

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
if (e.keyCode === 37) {

@@ -70,3 +74,3 @@ // Left

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseUp", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleMouseUp", function (e) {
var onMouseUp = _this.props.onMouseUp;

@@ -83,3 +87,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveNode", function (node) {
_defineProperty(_assertThisInitialized(_this), "saveNode", function (node) {
_this.node = node;

@@ -160,3 +164,3 @@ });

var switchClassName = classNames((_classNames = {}, _defineProperty(_classNames, className, !!className), _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
return React.createElement("button", _extends({}, restProps, {
return /*#__PURE__*/React.createElement("button", _extends({}, restProps, {
type: "button",

@@ -171,3 +175,3 @@ role: "switch",

onMouseUp: this.handleMouseUp
}), loadingIcon, React.createElement("span", {
}), loadingIcon, /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-inner")

@@ -174,0 +178,0 @@ }, checked ? checkedChildren : unCheckedChildren));

@@ -16,4 +16,6 @@ "use strict";

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

@@ -31,6 +33,2 @@

function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -40,4 +38,12 @@

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -47,7 +53,7 @@

var Switch =
/*#__PURE__*/
function (_Component) {
var Switch = /*#__PURE__*/function (_Component) {
_inherits(Switch, _Component);
var _super = _createSuper(Switch);
function Switch(props) {

@@ -58,5 +64,5 @@ var _this;

_this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this, props));
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleClick", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
var checked = _this.state.checked;

@@ -73,3 +79,3 @@ var onClick = _this.props.onClick;

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
if (e.keyCode === 37) {

@@ -84,3 +90,3 @@ // Left

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseUp", function (e) {
_defineProperty(_assertThisInitialized(_this), "handleMouseUp", function (e) {
var onMouseUp = _this.props.onMouseUp;

@@ -97,3 +103,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveNode", function (node) {
_defineProperty(_assertThisInitialized(_this), "saveNode", function (node) {
_this.node = node;

@@ -174,3 +180,3 @@ });

var switchClassName = classNames((_classNames = {}, _defineProperty(_classNames, className, !!className), _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
return _react["default"].createElement("button", _extends({}, restProps, {
return /*#__PURE__*/_react["default"].createElement("button", _extends({}, restProps, {
type: "button",

@@ -185,3 +191,3 @@ role: "switch",

onMouseUp: this.handleMouseUp
}), loadingIcon, _react["default"].createElement("span", {
}), loadingIcon, /*#__PURE__*/_react["default"].createElement("span", {
className: "".concat(prefixCls, "-inner")

@@ -188,0 +194,0 @@ }, checked ? checkedChildren : unCheckedChildren));

{
"name": "rc-switch",
"version": "1.9.0",
"version": "1.9.1",
"description": "switch ui component for react",

@@ -13,2 +13,3 @@ "keywords": [

"module": "./es/index",
"typings": "./index.d.ts",
"files": [

@@ -15,0 +16,0 @@ "assets/*.css",

Sorry, the diff of this file is not supported yet

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