Comparing version 3.2.2 to 4.0.0-alpha.0
@@ -1,4 +0,6 @@ | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
var _excluded = ["prefixCls", "className", "checked", "defaultChecked", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren", "onClick", "onChange", "onKeyDown"]; | ||
import * as React from 'react'; | ||
@@ -8,3 +10,3 @@ import classNames from 'classnames'; | ||
import KeyCode from "rc-util/es/KeyCode"; | ||
var Switch = React.forwardRef(function (_ref, ref) { | ||
var Switch = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | ||
var _classNames; | ||
@@ -24,3 +26,3 @@ | ||
onKeyDown = _ref.onKeyDown, | ||
restProps = _objectWithoutProperties(_ref, ["prefixCls", "className", "checked", "defaultChecked", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren", "onClick", "onChange", "onKeyDown"]); | ||
restProps = _objectWithoutProperties(_ref, _excluded); | ||
@@ -64,3 +66,3 @@ var _useMergedState = useMergedState(false, { | ||
var switchClassName = classNames(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-checked"), innerChecked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames)); | ||
return React.createElement("button", Object.assign({}, restProps, { | ||
return /*#__PURE__*/React.createElement("button", _extends({}, restProps, { | ||
type: "button", | ||
@@ -74,7 +76,9 @@ role: "switch", | ||
onClick: onInternalClick | ||
}), loadingIcon, React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner") | ||
}, innerChecked ? checkedChildren : unCheckedChildren)); | ||
}), loadingIcon, /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner-checked") | ||
}, checkedChildren), /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner-unchecked") | ||
}, unCheckedChildren)); | ||
}); | ||
Switch.displayName = 'Switch'; | ||
export default Switch; |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _typeof = require("@babel/runtime/helpers/typeof"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,2 +12,4 @@ value: true | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -27,3 +29,9 @@ | ||
var Switch = React.forwardRef(function (_ref, ref) { | ||
var _excluded = ["prefixCls", "className", "checked", "defaultChecked", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren", "onClick", "onChange", "onKeyDown"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; } | ||
var Switch = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | ||
var _classNames; | ||
@@ -43,3 +51,3 @@ | ||
onKeyDown = _ref.onKeyDown, | ||
restProps = (0, _objectWithoutProperties2.default)(_ref, ["prefixCls", "className", "checked", "defaultChecked", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren", "onClick", "onChange", "onKeyDown"]); | ||
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); | ||
@@ -83,3 +91,3 @@ var _useMergedState = (0, _useMergedState3.default)(false, { | ||
var switchClassName = (0, _classnames.default)(prefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-checked"), innerChecked), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames)); | ||
return React.createElement("button", Object.assign({}, restProps, { | ||
return /*#__PURE__*/React.createElement("button", (0, _extends2.default)({}, restProps, { | ||
type: "button", | ||
@@ -93,5 +101,7 @@ role: "switch", | ||
onClick: onInternalClick | ||
}), loadingIcon, React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner") | ||
}, innerChecked ? checkedChildren : unCheckedChildren)); | ||
}), loadingIcon, /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner-checked") | ||
}, checkedChildren), /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-inner-unchecked") | ||
}, unCheckedChildren)); | ||
}); | ||
@@ -98,0 +108,0 @@ Switch.displayName = 'Switch'; |
{ | ||
"name": "rc-switch", | ||
"version": "3.2.2", | ||
"version": "4.0.0-alpha.0", | ||
"description": "switch ui component for react", | ||
@@ -28,15 +28,27 @@ "keywords": [ | ||
"scripts": { | ||
"start": "father doc dev --storybook", | ||
"build": "father doc build --storybook", | ||
"start": "dumi dev", | ||
"docs:build": "dumi build", | ||
"docs:deploy": "gh-pages -d .doc", | ||
"compile": "father build && lessc assets/index.less assets/index.css", | ||
"gh-pages": "father doc deploy", | ||
"gh-pages": "npm run docs:build && npm run docs:deploy", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
"postpublish": "npm run gh-pages", | ||
"lint": "eslint .", | ||
"test": "father test", | ||
"coverage": "father test --coverage" | ||
"lint-staged": "lint-staged", | ||
"test": "umi-test", | ||
"coverage": "father test --coverage", | ||
"prepare": "husky install" | ||
}, | ||
"lint-staged": { | ||
"**/*.{js,jsx,tsx,ts,md,json}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@types/classnames": "^2.2.10", | ||
"@types/jest": "^26.0.4", | ||
"@umijs/fabric": "^3.0.0", | ||
"coveralls": "^3.0.6", | ||
"dumi": "^1.1.0", | ||
"enzyme": "^3.0.0", | ||
@@ -46,8 +58,11 @@ "enzyme-adapter-react-16": "^1.0.1", | ||
"eslint": "^7.0.0", | ||
"father": "^2.13.4", | ||
"father": "^4.0.0", | ||
"husky": "^8.0.1", | ||
"less": "^3.11.1", | ||
"np": "^6.2.3", | ||
"lint-staged": "^13.0.3", | ||
"np": "^7.1.0", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"react-test-renderer": "^16.0.0" | ||
"react-test-renderer": "^16.0.0", | ||
"umi-test": "^1.9.7" | ||
}, | ||
@@ -54,0 +69,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
19616
305
18
8
1
1