@sheinx/base 3.9.5 → 3.9.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/checkbox/simple-checkbox.d.ts.map +1 -1
- package/cjs/checkbox/simple-checkbox.js +3 -2
- package/cjs/radio/simple-radio.d.ts.map +1 -1
- package/cjs/radio/simple-radio.js +3 -2
- package/cjs/switch/switch.d.ts.map +1 -1
- package/cjs/switch/switch.js +8 -3
- package/esm/checkbox/simple-checkbox.d.ts.map +1 -1
- package/esm/checkbox/simple-checkbox.js +3 -2
- package/esm/radio/simple-radio.d.ts.map +1 -1
- package/esm/radio/simple-radio.js +4 -3
- package/esm/switch/switch.d.ts.map +1 -1
- package/esm/switch/switch.js +9 -4
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-checkbox.d.ts","sourceRoot":"","sources":["simple-checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,QAAA,MAAM,QAAQ,UAAW,mBAAmB,
|
|
1
|
+
{"version":3,"file":"simple-checkbox.d.ts","sourceRoot":"","sources":["simple-checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,QAAA,MAAM,QAAQ,UAAW,mBAAmB,4CAiE3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -32,6 +32,7 @@ var Checkbox = function Checkbox(props) {
|
|
|
32
32
|
size = props.size,
|
|
33
33
|
theme = props.theme,
|
|
34
34
|
rest = _objectWithoutProperties(props, _excluded);
|
|
35
|
+
var mouseEvents = _hooks.util.extractProps(rest, 'mouse');
|
|
35
36
|
var _useContext = (0, _react.useContext)(_formFieldContext.FormFieldContext),
|
|
36
37
|
fieldId = _useContext.fieldId;
|
|
37
38
|
var checkboxStyle = jssStyle === null || jssStyle === void 0 || (_jssStyle$checkbox = jssStyle.checkbox) === null || _jssStyle$checkbox === void 0 ? void 0 : _jssStyle$checkbox.call(jssStyle);
|
|
@@ -47,9 +48,9 @@ var Checkbox = function Checkbox(props) {
|
|
|
47
48
|
var rootClass = (0, _classnames.default)(className, checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.rootClass, checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapper, size === 'small' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperSmall), size === 'large' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperLarge), !!disabled && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperDisabled), !!checked && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperChecked), props.checked === 'indeterminate' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperIndeterminate));
|
|
48
49
|
var indicatorClass = (0, _classnames.default)(checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.indicatorWrapper, theme === 'dark' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.darkIndicatorWrapper));
|
|
49
50
|
var inputProps = getInputProps();
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread(_objectSpread({
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
51
52
|
id: fieldId
|
|
52
|
-
}, getRootProps({
|
|
53
|
+
}, mouseEvents), getRootProps({
|
|
53
54
|
className: rootClass,
|
|
54
55
|
style: style,
|
|
55
56
|
needStopPropagation: props.needStopPropagation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-radio.d.ts","sourceRoot":"","sources":["simple-radio.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,QAAA,MAAM,KAAK,UAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"simple-radio.d.ts","sourceRoot":"","sources":["simple-radio.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,QAAA,MAAM,KAAK,UAAW,gBAAgB,4CAgErC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -31,6 +31,7 @@ var Radio = function Radio(props) {
|
|
|
31
31
|
size = props.size,
|
|
32
32
|
theme = props.theme,
|
|
33
33
|
rest = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
var mouseEvents = _hooks.util.extractProps(rest, 'mouse');
|
|
34
35
|
var _useContext = (0, _react.useContext)(_formFieldContext.FormFieldContext),
|
|
35
36
|
fieldId = _useContext.fieldId;
|
|
36
37
|
var radioClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$radio = jssStyle.radio) === null || _jssStyle$radio === void 0 ? void 0 : _jssStyle$radio.call(jssStyle);
|
|
@@ -43,11 +44,11 @@ var Radio = function Radio(props) {
|
|
|
43
44
|
var rootClass = (0, _classnames.default)([radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.rootClass, radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapper, className, !!disabled && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperDisabled), !!checked && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperChecked), size === 'small' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperSmall), size === 'large' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperLarge)]);
|
|
44
45
|
var indicatorClass = (0, _classnames.default)(radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.indicatorWrapper, theme === 'dark' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.darkIndicatorWrapper));
|
|
45
46
|
var inputProps = getInputProps();
|
|
46
|
-
var rootProps = getRootProps({
|
|
47
|
+
var rootProps = _objectSpread(_objectSpread({}, mouseEvents), getRootProps({
|
|
47
48
|
className: rootClass,
|
|
48
49
|
style: style,
|
|
49
50
|
needStopPropagation: true
|
|
50
|
-
});
|
|
51
|
+
}));
|
|
51
52
|
var indicatorProps = getIndicatorProps();
|
|
52
53
|
var indicator = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
53
54
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,QAAA,MAAM,MAAM,WAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,QAAA,MAAM,MAAM,WAAY,WAAW,4CA+DlC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/cjs/switch/switch.js
CHANGED
|
@@ -13,6 +13,7 @@ var _icons = _interopRequireDefault(require("../icons"));
|
|
|
13
13
|
var _useWithFormConfig = _interopRequireDefault(require("../common/use-with-form-config"));
|
|
14
14
|
var _formFieldContext = require("../form/form-field-context");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _excluded = ["jssStyle", "content", "size", "loading", "className", "style"];
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -27,6 +28,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
27
28
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
28
29
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
30
33
|
var Switch = function Switch(props0) {
|
|
31
34
|
var _jssStyle$switch;
|
|
32
35
|
var props = (0, _useWithFormConfig.default)(props0);
|
|
@@ -35,7 +38,9 @@ var Switch = function Switch(props0) {
|
|
|
35
38
|
size = props.size,
|
|
36
39
|
loading = props.loading,
|
|
37
40
|
className = props.className,
|
|
38
|
-
style = props.style
|
|
41
|
+
style = props.style,
|
|
42
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
43
|
+
var mouseEvents = _hooks.util.extractProps(rest, 'mouse');
|
|
39
44
|
var config = (0, _config.useConfig)();
|
|
40
45
|
var _useContext = (0, _react.useContext)(_formFieldContext.FormFieldContext),
|
|
41
46
|
fieldId = _useContext.fieldId;
|
|
@@ -71,10 +76,10 @@ var Switch = function Switch(props0) {
|
|
|
71
76
|
checkedContent = _ref2[0],
|
|
72
77
|
unCheckedContent = _ref2[1];
|
|
73
78
|
var rootClassName = (0, _classnames.default)(className, switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.rootClass, switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapper, !!checked && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperChecked), disabled && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperDisabled), size === 'small' && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperSmall), size === 'large' && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperLarge));
|
|
74
|
-
var rootProps = getRootProps({
|
|
79
|
+
var rootProps = _objectSpread(_objectSpread({}, mouseEvents), getRootProps({
|
|
75
80
|
className: rootClassName,
|
|
76
81
|
style: style
|
|
77
|
-
});
|
|
82
|
+
}));
|
|
78
83
|
var inputProps = getInputProps();
|
|
79
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", _objectSpread(_objectSpread({
|
|
80
85
|
type: 'button',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-checkbox.d.ts","sourceRoot":"","sources":["simple-checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,QAAA,MAAM,QAAQ,UAAW,mBAAmB,
|
|
1
|
+
{"version":3,"file":"simple-checkbox.d.ts","sourceRoot":"","sources":["simple-checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,QAAA,MAAM,QAAQ,UAAW,mBAAmB,4CAiE3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -24,6 +24,7 @@ var Checkbox = function Checkbox(props) {
|
|
|
24
24
|
size = props.size,
|
|
25
25
|
theme = props.theme,
|
|
26
26
|
rest = _objectWithoutProperties(props, _excluded);
|
|
27
|
+
var mouseEvents = util.extractProps(rest, 'mouse');
|
|
27
28
|
var _useContext = useContext(FormFieldContext),
|
|
28
29
|
fieldId = _useContext.fieldId;
|
|
29
30
|
var checkboxStyle = jssStyle === null || jssStyle === void 0 || (_jssStyle$checkbox = jssStyle.checkbox) === null || _jssStyle$checkbox === void 0 ? void 0 : _jssStyle$checkbox.call(jssStyle);
|
|
@@ -39,9 +40,9 @@ var Checkbox = function Checkbox(props) {
|
|
|
39
40
|
var rootClass = classNames(className, checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.rootClass, checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapper, size === 'small' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperSmall), size === 'large' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperLarge), !!disabled && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperDisabled), !!checked && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperChecked), props.checked === 'indeterminate' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.wrapperIndeterminate));
|
|
40
41
|
var indicatorClass = classNames(checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.indicatorWrapper, theme === 'dark' && (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.darkIndicatorWrapper));
|
|
41
42
|
var inputProps = getInputProps();
|
|
42
|
-
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread(_objectSpread({
|
|
43
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
43
44
|
id: fieldId
|
|
44
|
-
}, getRootProps({
|
|
45
|
+
}, mouseEvents), getRootProps({
|
|
45
46
|
className: rootClass,
|
|
46
47
|
style: style,
|
|
47
48
|
needStopPropagation: props.needStopPropagation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-radio.d.ts","sourceRoot":"","sources":["simple-radio.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,QAAA,MAAM,KAAK,UAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"simple-radio.d.ts","sourceRoot":"","sources":["simple-radio.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,QAAA,MAAM,KAAK,UAAW,gBAAgB,4CAgErC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -7,7 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
import { useCheck } from '@sheinx/hooks';
|
|
10
|
+
import { useCheck, util } from '@sheinx/hooks';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import React, { useContext } from 'react';
|
|
13
13
|
import { FormFieldContext } from "../form/form-field-context";
|
|
@@ -24,6 +24,7 @@ var Radio = function Radio(props) {
|
|
|
24
24
|
size = props.size,
|
|
25
25
|
theme = props.theme,
|
|
26
26
|
rest = _objectWithoutProperties(props, _excluded);
|
|
27
|
+
var mouseEvents = util.extractProps(rest, 'mouse');
|
|
27
28
|
var _useContext = useContext(FormFieldContext),
|
|
28
29
|
fieldId = _useContext.fieldId;
|
|
29
30
|
var radioClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$radio = jssStyle.radio) === null || _jssStyle$radio === void 0 ? void 0 : _jssStyle$radio.call(jssStyle);
|
|
@@ -36,11 +37,11 @@ var Radio = function Radio(props) {
|
|
|
36
37
|
var rootClass = classNames([radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.rootClass, radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapper, className, !!disabled && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperDisabled), !!checked && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperChecked), size === 'small' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperSmall), size === 'large' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.wrapperLarge)]);
|
|
37
38
|
var indicatorClass = classNames(radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.indicatorWrapper, theme === 'dark' && (radioClasses === null || radioClasses === void 0 ? void 0 : radioClasses.darkIndicatorWrapper));
|
|
38
39
|
var inputProps = getInputProps();
|
|
39
|
-
var rootProps = getRootProps({
|
|
40
|
+
var rootProps = _objectSpread(_objectSpread({}, mouseEvents), getRootProps({
|
|
40
41
|
className: rootClass,
|
|
41
42
|
style: style,
|
|
42
43
|
needStopPropagation: true
|
|
43
|
-
});
|
|
44
|
+
}));
|
|
44
45
|
var indicatorProps = getIndicatorProps();
|
|
45
46
|
var indicator = /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
47
|
children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,QAAA,MAAM,MAAM,WAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,QAAA,MAAM,MAAM,WAAY,WAAW,4CA+DlC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/switch/switch.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["jssStyle", "content", "size", "loading", "className", "style"];
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -10,7 +11,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
12
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
import { useCheck, useInputAble, util } from '@sheinx/hooks';
|
|
14
17
|
import classNames from 'classnames';
|
|
15
18
|
import React, { useContext } from 'react';
|
|
16
19
|
import { useConfig } from "../config";
|
|
@@ -27,7 +30,9 @@ var Switch = function Switch(props0) {
|
|
|
27
30
|
size = props.size,
|
|
28
31
|
loading = props.loading,
|
|
29
32
|
className = props.className,
|
|
30
|
-
style = props.style
|
|
33
|
+
style = props.style,
|
|
34
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
35
|
+
var mouseEvents = util.extractProps(rest, 'mouse');
|
|
31
36
|
var config = useConfig();
|
|
32
37
|
var _useContext = useContext(FormFieldContext),
|
|
33
38
|
fieldId = _useContext.fieldId;
|
|
@@ -63,10 +68,10 @@ var Switch = function Switch(props0) {
|
|
|
63
68
|
checkedContent = _ref2[0],
|
|
64
69
|
unCheckedContent = _ref2[1];
|
|
65
70
|
var rootClassName = classNames(className, switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.rootClass, switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapper, !!checked && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperChecked), disabled && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperDisabled), size === 'small' && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperSmall), size === 'large' && (switchClasses === null || switchClasses === void 0 ? void 0 : switchClasses.wrapperLarge));
|
|
66
|
-
var rootProps = getRootProps({
|
|
71
|
+
var rootProps = _objectSpread(_objectSpread({}, mouseEvents), getRootProps({
|
|
67
72
|
className: rootClassName,
|
|
68
73
|
style: style
|
|
69
|
-
});
|
|
74
|
+
}));
|
|
70
75
|
var inputProps = getInputProps();
|
|
71
76
|
return /*#__PURE__*/_jsxs("button", _objectSpread(_objectSpread({
|
|
72
77
|
type: 'button',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.6-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"module": "./esm/index.js",
|
|
11
11
|
"typings": "./cjs/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@sheinx/hooks": "3.9.
|
|
13
|
+
"@sheinx/hooks": "3.9.6-beta.1",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.3.3"
|