@zohodesk/components 1.0.0-temp-219.3 → 1.0.0-temp-229.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/.cli/config/variables/variableMapping.json +8 -1
- package/.cli/propValidation_report.html +1 -1
- package/README.md +13 -0
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +11 -0
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +11 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +11 -0
- package/es/AppContainer/AppContainer.js +5 -4
- package/es/Card/Card.js +39 -10
- package/es/Card/props/defaultProps.js +2 -1
- package/es/Card/props/propTypes.js +2 -1
- package/es/CheckBox/CheckBox.js +2 -9
- package/es/Label/Label.js +2 -9
- package/es/Provider/LibraryContext.js +7 -3
- package/es/deprecated/Switch/Switch.js +94 -0
- package/es/deprecated/Switch/props/defaultProps.js +11 -0
- package/es/deprecated/Switch/props/propTypes.js +28 -0
- package/es/v1/Switch/Switch.js +122 -78
- package/es/v1/Switch/__tests__/Switch.spec.js +30 -0
- package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +135 -0
- package/es/v1/Switch/contants/index.js +24 -0
- package/es/v1/Switch/css/Switch_v1.module.css +134 -0
- package/es/v1/Switch/css/cssJSLogic.js +48 -0
- package/es/v1/Switch/props/defaultProps.js +8 -8
- package/es/v1/Switch/props/propTypes.js +30 -22
- package/es/v1/Switch/useSwitch.js +33 -0
- package/lib/AppContainer/AppContainer.js +7 -6
- package/lib/Card/Card.js +54 -25
- package/lib/Card/props/defaultProps.js +2 -1
- package/lib/Card/props/propTypes.js +2 -1
- package/lib/CheckBox/CheckBox.js +2 -9
- package/lib/Label/Label.js +2 -9
- package/lib/Provider/LibraryContext.js +7 -3
- package/lib/deprecated/Switch/Switch.js +108 -0
- package/lib/deprecated/Switch/props/defaultProps.js +18 -0
- package/lib/deprecated/Switch/props/propTypes.js +39 -0
- package/lib/v1/Switch/Switch.js +130 -79
- package/lib/v1/Switch/__tests__/Switch.spec.js +37 -0
- package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +135 -0
- package/lib/v1/Switch/contants/index.js +34 -0
- package/lib/v1/Switch/css/Switch_v1.module.css +134 -0
- package/lib/v1/Switch/css/cssJSLogic.js +37 -0
- package/lib/v1/Switch/props/defaultProps.js +10 -10
- package/lib/v1/Switch/props/propTypes.js +32 -24
- package/lib/v1/Switch/useSwitch.js +56 -0
- package/package.json +10 -8
- package/result.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.THUMB_RADIUS = exports.OFF_LABEL_RADIUS = exports.ITEMS_DIRECTION = exports.ALIGN_ITEMS = void 0;
|
|
7
|
+
var OFF_LABEL_RADIUS = {
|
|
8
|
+
small: '35.7%',
|
|
9
|
+
medium: '37.5%',
|
|
10
|
+
large: '38.9%',
|
|
11
|
+
xlarge: '40%'
|
|
12
|
+
};
|
|
13
|
+
exports.OFF_LABEL_RADIUS = OFF_LABEL_RADIUS;
|
|
14
|
+
var THUMB_RADIUS = {
|
|
15
|
+
small: '40%',
|
|
16
|
+
medium: '42.85%',
|
|
17
|
+
large: '44.45%',
|
|
18
|
+
xlarge: '45.45%'
|
|
19
|
+
};
|
|
20
|
+
exports.THUMB_RADIUS = THUMB_RADIUS;
|
|
21
|
+
var ITEMS_DIRECTION = {
|
|
22
|
+
start: 'row',
|
|
23
|
+
end: 'rowReverse',
|
|
24
|
+
top: 'column',
|
|
25
|
+
bottom: 'columnReverse'
|
|
26
|
+
};
|
|
27
|
+
exports.ITEMS_DIRECTION = ITEMS_DIRECTION;
|
|
28
|
+
var ALIGN_ITEMS = {
|
|
29
|
+
start: 'center',
|
|
30
|
+
end: 'center',
|
|
31
|
+
top: 'start',
|
|
32
|
+
bottom: 'start'
|
|
33
|
+
};
|
|
34
|
+
exports.ALIGN_ITEMS = ALIGN_ITEMS;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
--local-switch-cursor: pointer;
|
|
3
|
+
--local-switch-offLabel-stroke: var(--zdt_v1_switch_offLabel);
|
|
4
|
+
gap: var(--zd_size6) ;
|
|
5
|
+
}
|
|
6
|
+
.small {
|
|
7
|
+
--local-switch-track-width: var(--zd_size22);
|
|
8
|
+
--local-switch-track-height: var(--zd_size12);
|
|
9
|
+
--local-switch-track-border-radius: 8px;
|
|
10
|
+
--local-switch-thumb-size: var(--zd_size10);
|
|
11
|
+
--local-switch-onLabel-height: var(--zd_size6);
|
|
12
|
+
--local-switch-onLabel-left: var(--zd_size5);
|
|
13
|
+
--local-switch-offLabel-size: var(--zd_size7);
|
|
14
|
+
--local-switch-offLabel-right: var(--zd_size2);
|
|
15
|
+
--local-switch-onLabel-scaleX: 1.2;
|
|
16
|
+
}
|
|
17
|
+
.medium {
|
|
18
|
+
--local-switch-track-width: var(--zd_size28);
|
|
19
|
+
--local-switch-track-height: var(--zd_size16);
|
|
20
|
+
--local-switch-track-border-radius: 16px;
|
|
21
|
+
--local-switch-thumb-size: var(--zd_size14);
|
|
22
|
+
--local-switch-onLabel-height: var(--zd_size8);
|
|
23
|
+
--local-switch-onLabel-left: var(--zd_size6);
|
|
24
|
+
--local-switch-offLabel-size: var(--zd_size8);
|
|
25
|
+
--local-switch-offLabel-right: var(--zd_size3);
|
|
26
|
+
--local-switch-onLabel-scaleX: 1.4;
|
|
27
|
+
}
|
|
28
|
+
.large {
|
|
29
|
+
--local-switch-track-width: var(--zd_size34);
|
|
30
|
+
--local-switch-track-height: var(--zd_size20);
|
|
31
|
+
--local-switch-track-border-radius: 10px;
|
|
32
|
+
--local-switch-thumb-size: var(--zd_size18);
|
|
33
|
+
--local-switch-onLabel-height: var(--zd_size10);
|
|
34
|
+
--local-switch-onLabel-left: var(--zd_size7);
|
|
35
|
+
--local-switch-offLabel-size: var(--zd_size9);
|
|
36
|
+
--local-switch-offLabel-right: var(--zd_size4);
|
|
37
|
+
--local-switch-onLabel-scaleX: 1.6;
|
|
38
|
+
}
|
|
39
|
+
.xlarge {
|
|
40
|
+
--local-switch-track-width: var(--zd_size40);
|
|
41
|
+
--local-switch-track-height: var(--zd_size24);
|
|
42
|
+
--local-switch-track-border-radius: 12px;
|
|
43
|
+
--local-switch-thumb-size: var(--zd_size22);
|
|
44
|
+
--local-switch-onLabel-height: var(--zd_size12);
|
|
45
|
+
--local-switch-onLabel-left: var(--zd_size8);
|
|
46
|
+
--local-switch-offLabel-size: var(--zd_size10);
|
|
47
|
+
--local-switch-offLabel-right: var(--zd_size5);
|
|
48
|
+
--local-switch-onLabel-scaleX: 1.8;
|
|
49
|
+
}
|
|
50
|
+
.disabled, .readonly {
|
|
51
|
+
--local-switch-cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
.checked.enabled > .trackWrapper:hover {
|
|
54
|
+
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_hover_bg);
|
|
55
|
+
}
|
|
56
|
+
.unChecked.enabled > .trackWrapper:hover {
|
|
57
|
+
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_hover_bg);
|
|
58
|
+
}
|
|
59
|
+
.enabled > .trackWrapper:hover {
|
|
60
|
+
--local-switch-offLabel-stroke: var(--zdt_v1_switch_offLabel_hover);
|
|
61
|
+
}
|
|
62
|
+
.trackWrapper {
|
|
63
|
+
position: relative;
|
|
64
|
+
}
|
|
65
|
+
.disabled > .trackWrapper {
|
|
66
|
+
opacity: 0.4;
|
|
67
|
+
}
|
|
68
|
+
.track {
|
|
69
|
+
appearance: none;
|
|
70
|
+
display: block;
|
|
71
|
+
position: relative;
|
|
72
|
+
height: var(--local-switch-track-height);
|
|
73
|
+
width: var(--local-switch-track-width);
|
|
74
|
+
margin: 0 ;
|
|
75
|
+
border-radius: var(--local-switch-track-border-radius);
|
|
76
|
+
background-color: var(--local-switch-track-background-color);
|
|
77
|
+
cursor: var(--local-switch-cursor);
|
|
78
|
+
}
|
|
79
|
+
.commonSvg {
|
|
80
|
+
display: block;
|
|
81
|
+
position: absolute;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
top: 50% ;
|
|
84
|
+
}
|
|
85
|
+
.thumb {
|
|
86
|
+
transition: transform var(--zd_transition2) cubic-bezier(0.4, 0, 0.2, 1);
|
|
87
|
+
fill: var(--zdt_v1_switch_thumb_bg);
|
|
88
|
+
height: var(--local-switch-thumb-size);
|
|
89
|
+
width: var(--local-switch-thumb-size);
|
|
90
|
+
transform: translateX(var(--local-switch-thumb-translateX)) translateY(-50%);
|
|
91
|
+
}
|
|
92
|
+
[dir=ltr] .thumb {
|
|
93
|
+
left: var(--zd_size1) ;
|
|
94
|
+
}
|
|
95
|
+
[dir=rtl] .thumb {
|
|
96
|
+
right: var(--zd_size1) ;
|
|
97
|
+
}
|
|
98
|
+
.label {
|
|
99
|
+
max-width: 100% ;
|
|
100
|
+
cursor: var(--local-switch-cursor);
|
|
101
|
+
}
|
|
102
|
+
.onLabel {
|
|
103
|
+
height: var(--local-switch-onLabel-height);
|
|
104
|
+
fill: var(--zdt_v1_switch_onLabel);
|
|
105
|
+
width: var(--zd_size1) ;
|
|
106
|
+
transform: translateY(-50%) scaleX(var(--local-switch-onLabel-scaleX));
|
|
107
|
+
}
|
|
108
|
+
[dir=ltr] .onLabel {
|
|
109
|
+
left: var(--local-switch-onLabel-left);
|
|
110
|
+
}
|
|
111
|
+
[dir=rtl] .onLabel {
|
|
112
|
+
right: var(--local-switch-onLabel-left);
|
|
113
|
+
}
|
|
114
|
+
.offLabel {
|
|
115
|
+
height: var(--local-switch-offLabel-size);
|
|
116
|
+
width: var(--local-switch-offLabel-size);
|
|
117
|
+
fill: transparent;
|
|
118
|
+
stroke: var(--local-switch-offLabel-stroke);
|
|
119
|
+
transform: translateY(-50%);
|
|
120
|
+
}
|
|
121
|
+
[dir=ltr] .offLabel {
|
|
122
|
+
right: var(--local-switch-offLabel-right);
|
|
123
|
+
}
|
|
124
|
+
[dir=rtl] .offLabel {
|
|
125
|
+
left: var(--local-switch-offLabel-right);
|
|
126
|
+
}
|
|
127
|
+
.checked {
|
|
128
|
+
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_bg);
|
|
129
|
+
--local-switch-thumb-translateX: calc(var(--local-switch-track-width) - var(--local-switch-thumb-size) - 2px)
|
|
130
|
+
}
|
|
131
|
+
.unChecked {
|
|
132
|
+
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_bg);
|
|
133
|
+
--local-switch-thumb-translateX: 0;
|
|
134
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = cssJSLogic;
|
|
7
|
+
|
|
8
|
+
var _compileClassNames7 = _interopRequireDefault(require("@zohodesk/utils/es/compileClassNames"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function cssJSLogic(_ref) {
|
|
15
|
+
var _compileClassNames, _compileClassNames5, _compileClassNames6;
|
|
16
|
+
|
|
17
|
+
var props = _ref.props,
|
|
18
|
+
style = _ref.style;
|
|
19
|
+
var size = props.size,
|
|
20
|
+
isChecked = props.isChecked,
|
|
21
|
+
isDisabled = props.isDisabled,
|
|
22
|
+
isReadOnly = props.isReadOnly;
|
|
23
|
+
var containerClass = (0, _compileClassNames7["default"])((_compileClassNames = {}, _defineProperty(_compileClassNames, style.container, true), _defineProperty(_compileClassNames, style[size], !!style[size]), _defineProperty(_compileClassNames, style.checked, isChecked), _defineProperty(_compileClassNames, style.unChecked, !isChecked), _defineProperty(_compileClassNames, style.disabled, isDisabled), _defineProperty(_compileClassNames, style.enabled, !isDisabled), _defineProperty(_compileClassNames, style.readonly, isReadOnly), _compileClassNames));
|
|
24
|
+
var trackClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.track, true));
|
|
25
|
+
var labelClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.label, true));
|
|
26
|
+
var trackWrapperClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.trackWrapper, true));
|
|
27
|
+
var thumbClass = (0, _compileClassNames7["default"])((_compileClassNames5 = {}, _defineProperty(_compileClassNames5, style.thumb, true), _defineProperty(_compileClassNames5, style.commonSvg, true), _compileClassNames5));
|
|
28
|
+
var labelIndicationClass = (0, _compileClassNames7["default"])((_compileClassNames6 = {}, _defineProperty(_compileClassNames6, style.onLabel, isChecked), _defineProperty(_compileClassNames6, style.offLabel, !isChecked), _defineProperty(_compileClassNames6, style.commonSvg, true), _compileClassNames6));
|
|
29
|
+
return {
|
|
30
|
+
containerClass: containerClass,
|
|
31
|
+
trackClass: trackClass,
|
|
32
|
+
labelClass: labelClass,
|
|
33
|
+
trackWrapperClass: trackWrapperClass,
|
|
34
|
+
thumbClass: thumbClass,
|
|
35
|
+
labelIndicationClass: labelIndicationClass
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
checked: false,
|
|
9
|
-
disabled: false,
|
|
10
|
-
labelPalette: 'primary',
|
|
11
|
-
labelSize: 'medium',
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
12
8
|
size: 'medium',
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
hasStateIndication: true,
|
|
10
|
+
labelPlacement: 'start',
|
|
11
|
+
labelSize: 'medium',
|
|
15
12
|
customProps: {},
|
|
16
|
-
|
|
13
|
+
tagAttributes: {},
|
|
14
|
+
a11yAttributes: {},
|
|
15
|
+
i18nKeys: {},
|
|
16
|
+
customStyle: {}
|
|
17
17
|
};
|
|
18
|
-
exports
|
|
18
|
+
exports["default"] = _default;
|
|
@@ -3,37 +3,45 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
checked: _propTypes["default"].bool,
|
|
14
|
-
dataId: _propTypes["default"].string,
|
|
15
|
-
dataSelectorId: _propTypes["default"].string,
|
|
16
|
-
disableTitle: _propTypes["default"].string,
|
|
17
|
-
disabled: _propTypes["default"].bool,
|
|
18
|
-
id: _propTypes["default"].string.isRequired,
|
|
19
|
-
isReadOnly: _propTypes["default"].bool,
|
|
20
|
-
labelPalette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'danger', 'mandatory']),
|
|
21
|
-
labelSize: _propTypes["default"].oneOf(['small', 'medium', 'large']),
|
|
12
|
+
var _default = {
|
|
22
13
|
name: _propTypes["default"].string,
|
|
14
|
+
value: _propTypes["default"].string,
|
|
15
|
+
id: _propTypes["default"].string,
|
|
16
|
+
size: _propTypes["default"].oneOf(['small', 'medium', 'large', 'xlarge']),
|
|
17
|
+
isChecked: _propTypes["default"].bool,
|
|
18
|
+
isDefaultChecked: _propTypes["default"].bool,
|
|
19
|
+
isDisabled: _propTypes["default"].bool,
|
|
20
|
+
isReadOnly: _propTypes["default"].bool,
|
|
23
21
|
onChange: _propTypes["default"].func,
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
hasStateIndication: _propTypes["default"].bool,
|
|
23
|
+
label: _propTypes["default"].string,
|
|
24
|
+
labelPlacement: _propTypes["default"].oneOf(['start', 'end', 'top', 'bottom']),
|
|
25
|
+
labelSize: _propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large']),
|
|
26
26
|
title: _propTypes["default"].string,
|
|
27
|
-
value: _propTypes["default"].bool,
|
|
28
|
-
customClass: _propTypes["default"].shape({
|
|
29
|
-
customSwitchWrap: _propTypes["default"].string,
|
|
30
|
-
customSwitch: _propTypes["default"].string,
|
|
31
|
-
customSwitchSize: _propTypes["default"].string,
|
|
32
|
-
customLabel: _propTypes["default"].string
|
|
33
|
-
}),
|
|
34
27
|
customProps: _propTypes["default"].shape({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
28
|
+
container: _propTypes["default"].object,
|
|
29
|
+
label: _propTypes["default"].object
|
|
30
|
+
}),
|
|
31
|
+
tagAttributes: _propTypes["default"].shape({
|
|
32
|
+
container: _propTypes["default"].object,
|
|
33
|
+
"switch": _propTypes["default"].object
|
|
34
|
+
}),
|
|
35
|
+
a11yAttributes: _propTypes["default"].shape({
|
|
36
|
+
container: _propTypes["default"].object,
|
|
37
|
+
"switch": _propTypes["default"].object,
|
|
38
|
+
label: _propTypes["default"].object
|
|
39
|
+
}),
|
|
40
|
+
i18nKeys: _propTypes["default"].shape({
|
|
41
|
+
readOnlyAriaLabel: _propTypes["default"].string
|
|
42
|
+
}),
|
|
43
|
+
customId: _propTypes["default"].string,
|
|
44
|
+
testId: _propTypes["default"].string,
|
|
45
|
+
customStyle: _propTypes["default"].object
|
|
38
46
|
};
|
|
39
|
-
exports
|
|
47
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
19
|
+
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
|
|
22
|
+
var useSwitch = function useSwitch(props) {
|
|
23
|
+
var isCheckedProp = props.isChecked,
|
|
24
|
+
isDefaultChecked = props.isDefaultChecked,
|
|
25
|
+
onChange = props.onChange,
|
|
26
|
+
isReadOnly = props.isReadOnly,
|
|
27
|
+
isDisabled = props.isDisabled;
|
|
28
|
+
var isControlled = isCheckedProp !== undefined;
|
|
29
|
+
|
|
30
|
+
var _useState = (0, _react.useState)(isDefaultChecked),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
internalChecked = _useState2[0],
|
|
33
|
+
setInternalChecked = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var isChecked = isControlled ? isCheckedProp : internalChecked;
|
|
36
|
+
|
|
37
|
+
var handleChange = function handleChange(e) {
|
|
38
|
+
if (isReadOnly || isDisabled) return;
|
|
39
|
+
|
|
40
|
+
if (!isControlled) {
|
|
41
|
+
setInternalChecked(!isChecked);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
45
|
+
isChecked: !isChecked
|
|
46
|
+
}, e);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
isChecked: isChecked,
|
|
51
|
+
handleChange: handleChange
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var _default = useSwitch;
|
|
56
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-229.1",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"build:css:umd": "npm run clean && npm run init && react-cli build:css:umd",
|
|
39
39
|
"coverage": "react-cli coverage",
|
|
40
40
|
"prepare": "npm run init && npm run build && npm run rtl && npm run cssVariableConvert ",
|
|
41
|
-
"prepublishOnly": "node prePublish.js
|
|
41
|
+
"prepublishOnly": "node prePublish.js && npm run css:review ",
|
|
42
42
|
"postpublish": "node postPublish.js",
|
|
43
43
|
"report": "react-cli publish:report",
|
|
44
44
|
"test": "react-cli test",
|
|
45
|
-
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest",
|
|
45
|
+
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest react-cli clean ./es && react-cli clean ./lib && react-cli clean ./package-lock.json && react-cli clean ./result.json ",
|
|
46
46
|
"snap-update": "npm run test-clean && npm run test -- -u",
|
|
47
47
|
"sstest": "npm run init && react-cli sstest",
|
|
48
48
|
"build:external": "npm run clean && npm run init && npm run docsjs:build && npm run build:externalDocCopy && react-cli build:component:umd && npm run externalDocHTMLChange",
|
|
@@ -70,9 +70,10 @@
|
|
|
70
70
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
71
71
|
"@zohodesk/a11y": "2.3.4",
|
|
72
72
|
"@zohodesk/docstool": "1.0.0-alpha-2",
|
|
73
|
-
"@zohodesk/dotkit": "1.0.
|
|
73
|
+
"@zohodesk/dotkit": "1.0.2",
|
|
74
74
|
"@zohodesk/hooks": "2.0.5",
|
|
75
|
-
"@zohodesk/icons": "1.0.
|
|
75
|
+
"@zohodesk/icons": "1.0.79",
|
|
76
|
+
"@zohodesk/layout": "3.1.0",
|
|
76
77
|
"@zohodesk/svg": "1.1.22",
|
|
77
78
|
"@zohodesk/utils": "1.3.14",
|
|
78
79
|
"@zohodesk/variables": "1.0.0",
|
|
@@ -87,8 +88,7 @@
|
|
|
87
88
|
"selectn": "1.1.2"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
|
-
"@zohodesk/
|
|
91
|
-
"@zohodesk/icons": "1.0.78",
|
|
91
|
+
"@zohodesk/icons": "1.0.79",
|
|
92
92
|
"@zohodesk/variables": "1.0.0",
|
|
93
93
|
"@zohodesk/svg": "1.1.22",
|
|
94
94
|
"@zohodesk/virtualizer": "1.0.3",
|
|
@@ -96,6 +96,8 @@
|
|
|
96
96
|
"react-sortable-hoc": "^0.8.3",
|
|
97
97
|
"@zohodesk/hooks": "2.0.5",
|
|
98
98
|
"@zohodesk/utils": "1.3.14",
|
|
99
|
-
"@zohodesk/a11y": "2.3.4"
|
|
99
|
+
"@zohodesk/a11y": "2.3.4",
|
|
100
|
+
"@zohodesk/layout": "3.1.0",
|
|
101
|
+
"@zohodesk/dotkit": "1.0.2"
|
|
100
102
|
}
|
|
101
103
|
}
|