@zohodesk/components 1.0.0-temp-217.6 → 1.0.0-temp-221.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/propValidation_report.html +1 -1
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +5 -9
- package/assets/Appearance/dark/mode/Component_v2_DarkMode.module.css +2 -8
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +0 -5
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +0 -5
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +0 -5
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +0 -5
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +0 -5
- package/assets/Appearance/light/mode/Component_LightMode.module.css +5 -9
- package/assets/Appearance/light/mode/Component_v2_LightMode.module.css +2 -8
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +0 -5
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +0 -5
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +0 -5
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +0 -5
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +0 -5
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +5 -9
- package/assets/Appearance/pureDark/mode/Component_v2_PureDarkMode.module.css +2 -8
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +0 -5
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +0 -5
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +0 -5
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +0 -5
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +0 -5
- package/es/Button/Button.js +2 -0
- package/es/Button/css/Button.module.css +2 -38
- package/es/Button/css/cssJSLogic.js +1 -10
- package/es/Provider/LibraryContext.js +1 -3
- package/es/components-v2/Label/Label.js +86 -0
- package/es/components-v2/Label/css/Label_v2.module.css +41 -0
- package/es/components-v2/Label/css/cssJSLogic.js +27 -0
- package/es/components-v2/Label/props/defaultProps.js +8 -0
- package/es/components-v2/Label/props/propTypes.js +26 -0
- package/lib/Button/Button.js +2 -0
- package/lib/Button/css/Button.module.css +2 -38
- package/lib/Button/css/cssJSLogic.js +2 -15
- package/lib/Provider/LibraryContext.js +1 -3
- package/lib/components-v2/Label/Label.js +104 -0
- package/lib/components-v2/Label/css/Label_v2.module.css +41 -0
- package/lib/components-v2/Label/css/cssJSLogic.js +30 -0
- package/lib/components-v2/Label/props/defaultProps.js +15 -0
- package/lib/components-v2/Label/props/propTypes.js +37 -0
- package/package.json +2 -3
- package/result.json +1 -0
- package/es/components-v2/Switch/Switch.js +0 -123
- package/es/components-v2/Switch/contants/index.js +0 -10
- package/es/components-v2/Switch/css/Switch_v2.module.css +0 -123
- package/es/components-v2/Switch/css/cssJSLogic.js +0 -47
- package/es/components-v2/Switch/props/defaultProps.js +0 -17
- package/es/components-v2/Switch/props/propTypes.js +0 -26
- package/lib/components-v2/Switch/Switch.js +0 -137
- package/lib/components-v2/Switch/contants/index.js +0 -18
- package/lib/components-v2/Switch/css/Switch_v2.module.css +0 -123
- package/lib/components-v2/Switch/css/cssJSLogic.js +0 -37
- package/lib/components-v2/Switch/props/defaultProps.js +0 -24
- package/lib/components-v2/Switch/props/propTypes.js +0 -37
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
--switch-cursor: pointer;
|
|
3
|
-
gap: var(--zd_size6) ;
|
|
4
|
-
}
|
|
5
|
-
.small {
|
|
6
|
-
--switch-track-width: var(--zd_size22);
|
|
7
|
-
--switch-track-height: var(--zd_size12);
|
|
8
|
-
--switch-track-border-radius: 8px;
|
|
9
|
-
--switch-thumb-size: var(--zd_size10);
|
|
10
|
-
--switch-onLabel-height: var(--zd_size6);
|
|
11
|
-
--switch-onLabel-left: var(--zd_size5);
|
|
12
|
-
--switch-offLabel-size: var(--zd_size7);
|
|
13
|
-
--switch-offLabel-right: var(--zd_size2);
|
|
14
|
-
}
|
|
15
|
-
.medium {
|
|
16
|
-
--switch-track-width: var(--zd_size28);
|
|
17
|
-
--switch-track-height: var(--zd_size16);
|
|
18
|
-
--switch-track-border-radius: 16px;
|
|
19
|
-
--switch-thumb-size: var(--zd_size14);
|
|
20
|
-
--switch-onLabel-height: var(--zd_size8);
|
|
21
|
-
--switch-onLabel-left: var(--zd_size6);
|
|
22
|
-
--switch-offLabel-size: var(--zd_size8);
|
|
23
|
-
--switch-offLabel-right: var(--zd_size3);
|
|
24
|
-
}
|
|
25
|
-
.large {
|
|
26
|
-
--switch-track-width: var(--zd_size34);
|
|
27
|
-
--switch-track-height: var(--zd_size20);
|
|
28
|
-
--switch-track-border-radius: 10px;
|
|
29
|
-
--switch-thumb-size: var(--zd_size18);
|
|
30
|
-
--switch-onLabel-height: var(--zd_size11);
|
|
31
|
-
--switch-onLabel-left: var(--zd_size7);
|
|
32
|
-
--switch-offLabel-size: var(--zd_size9);
|
|
33
|
-
--switch-offLabel-right: var(--zd_size4);
|
|
34
|
-
}
|
|
35
|
-
.checked {
|
|
36
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_on_bg);
|
|
37
|
-
--switch-thumb-translateX-value: 0
|
|
38
|
-
}
|
|
39
|
-
.unChecked {
|
|
40
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_off_bg);
|
|
41
|
-
--switch-thumb-translateX-value: calc(var(--switch-thumb-size) + 2px - var(--switch-track-width));
|
|
42
|
-
}
|
|
43
|
-
.disabled, .readonly {
|
|
44
|
-
--switch-cursor: not-allowed;
|
|
45
|
-
}
|
|
46
|
-
.trackWrapper {
|
|
47
|
-
position: relative;
|
|
48
|
-
}
|
|
49
|
-
.track {
|
|
50
|
-
appearance: none;
|
|
51
|
-
display: block;
|
|
52
|
-
position: relative;
|
|
53
|
-
height: var(--switch-track-height);
|
|
54
|
-
width: var(--switch-track-width);
|
|
55
|
-
margin: 0 ;
|
|
56
|
-
border-radius: var(--switch-track-border-radius);
|
|
57
|
-
background-color: var(--switch-track-background-color);
|
|
58
|
-
cursor: var(--switch-cursor);
|
|
59
|
-
}
|
|
60
|
-
.checked .track:not(:disabled):hover {
|
|
61
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_on_hover_bg);
|
|
62
|
-
}
|
|
63
|
-
.unChecked .track:not(:disabled):hover {
|
|
64
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_off_hover_bg);
|
|
65
|
-
}
|
|
66
|
-
.commonSvg {
|
|
67
|
-
display: block;
|
|
68
|
-
position: absolute;
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
top: 50% ;
|
|
71
|
-
}
|
|
72
|
-
.thumb {
|
|
73
|
-
transition: transform var(--zd_transition2);
|
|
74
|
-
fill: var(--zdt_v2_switch_thumb_bg);
|
|
75
|
-
height: var(--switch-thumb-size);
|
|
76
|
-
width: var(--switch-thumb-size);
|
|
77
|
-
transform: translateX(var(--switch-thumb-translateX-value)) translateY(-50%);
|
|
78
|
-
}
|
|
79
|
-
[dir=ltr] .thumb {
|
|
80
|
-
right: var(--zd_size1) ;
|
|
81
|
-
}
|
|
82
|
-
[dir=rtl] .thumb {
|
|
83
|
-
left: var(--zd_size1) ;
|
|
84
|
-
}
|
|
85
|
-
.label {
|
|
86
|
-
cursor: var(--switch-cursor);
|
|
87
|
-
}
|
|
88
|
-
.onLabel {
|
|
89
|
-
height: var(--switch-onLabel-height);
|
|
90
|
-
fill: var(--zdt_v2_switch_on_indication_label);
|
|
91
|
-
transform: translateY(-50%);
|
|
92
|
-
}
|
|
93
|
-
[dir=ltr] .onLabel {
|
|
94
|
-
left: var(--switch-onLabel-left);
|
|
95
|
-
}
|
|
96
|
-
[dir=rtl] .onLabel {
|
|
97
|
-
right: var(--switch-onLabel-left);
|
|
98
|
-
}
|
|
99
|
-
.offLabel {
|
|
100
|
-
height: var(--switch-offLabel-size);
|
|
101
|
-
width: var(--switch-offLabel-size);
|
|
102
|
-
fill: transparent;
|
|
103
|
-
stroke: var(--zdt_v2_switch_off_indication_label);
|
|
104
|
-
transform: translateY(-50%);
|
|
105
|
-
}
|
|
106
|
-
[dir=ltr] .offLabel {
|
|
107
|
-
right: var(--switch-offLabel-right);
|
|
108
|
-
}
|
|
109
|
-
[dir=rtl] .offLabel {
|
|
110
|
-
left: var(--switch-offLabel-right);
|
|
111
|
-
}
|
|
112
|
-
.small .onLabel {
|
|
113
|
-
width: 1.2px;
|
|
114
|
-
}
|
|
115
|
-
.medium .onLabel {
|
|
116
|
-
width: 1.4px;
|
|
117
|
-
}
|
|
118
|
-
.large .onLabel {
|
|
119
|
-
width: 1.6px;
|
|
120
|
-
}
|
|
121
|
-
.disabled .trackWrapper {
|
|
122
|
-
opacity: 0.4;
|
|
123
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import compileClassNames from '@zohodesk/utils/es/compileClassNames';
|
|
2
|
-
export default function cssJSLogic(_ref) {
|
|
3
|
-
let {
|
|
4
|
-
props,
|
|
5
|
-
style
|
|
6
|
-
} = _ref;
|
|
7
|
-
const {
|
|
8
|
-
size,
|
|
9
|
-
isChecked,
|
|
10
|
-
isDisabled,
|
|
11
|
-
isReadOnly
|
|
12
|
-
} = props;
|
|
13
|
-
let containerClass = compileClassNames({
|
|
14
|
-
[style.container]: true,
|
|
15
|
-
[style[size]]: true,
|
|
16
|
-
[style.checked]: isChecked,
|
|
17
|
-
[style.unChecked]: !isChecked,
|
|
18
|
-
[style.disabled]: isDisabled,
|
|
19
|
-
[style.readonly]: isReadOnly
|
|
20
|
-
});
|
|
21
|
-
let trackClass = compileClassNames({
|
|
22
|
-
[style.track]: true
|
|
23
|
-
});
|
|
24
|
-
let labelClass = compileClassNames({
|
|
25
|
-
[style.label]: true
|
|
26
|
-
});
|
|
27
|
-
let trackWrapperClass = compileClassNames({
|
|
28
|
-
[style.trackWrapper]: true
|
|
29
|
-
});
|
|
30
|
-
let thumbClass = compileClassNames({
|
|
31
|
-
[style.thumb]: true,
|
|
32
|
-
[style.commonSvg]: true
|
|
33
|
-
});
|
|
34
|
-
let labelIndicationClass = compileClassNames({
|
|
35
|
-
[style.onLabel]: isChecked,
|
|
36
|
-
[style.offLabel]: !isChecked,
|
|
37
|
-
[style.commonSvg]: true
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
containerClass,
|
|
41
|
-
trackClass,
|
|
42
|
-
labelClass,
|
|
43
|
-
trackWrapperClass,
|
|
44
|
-
thumbClass,
|
|
45
|
-
labelIndicationClass
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
size: 'medium',
|
|
3
|
-
isChecked: false,
|
|
4
|
-
isDisabled: false,
|
|
5
|
-
isReadOnly: false,
|
|
6
|
-
hasOnOffIndication: true,
|
|
7
|
-
labelPlacement: 'left',
|
|
8
|
-
labelSize: 'medium',
|
|
9
|
-
customProps_container: {},
|
|
10
|
-
customProps_label: {},
|
|
11
|
-
tagAttributes_container: {},
|
|
12
|
-
tagAttributes_switch: {},
|
|
13
|
-
a11yAttributes_container: {},
|
|
14
|
-
a11yAttributes_switch: {},
|
|
15
|
-
a11yAttributes_label: {},
|
|
16
|
-
customStyle: {}
|
|
17
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export default {
|
|
3
|
-
name: PropTypes.string,
|
|
4
|
-
value: PropTypes.string,
|
|
5
|
-
id: PropTypes.string,
|
|
6
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
7
|
-
isChecked: PropTypes.bool,
|
|
8
|
-
isDisabled: PropTypes.bool,
|
|
9
|
-
isReadOnly: PropTypes.bool,
|
|
10
|
-
onChange: PropTypes.func,
|
|
11
|
-
hasOnOffIndication: PropTypes.bool,
|
|
12
|
-
labelText: PropTypes.string,
|
|
13
|
-
labelPlacement: PropTypes.oneOf(['left', 'right']),
|
|
14
|
-
labelSize: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large']),
|
|
15
|
-
title: PropTypes.string,
|
|
16
|
-
customProps_container: PropTypes.object,
|
|
17
|
-
customProps_label: PropTypes.object,
|
|
18
|
-
tagAttributes_container: PropTypes.object,
|
|
19
|
-
tagAttributes_switch: PropTypes.object,
|
|
20
|
-
a11yAttributes_container: PropTypes.object,
|
|
21
|
-
a11yAttributes_switch: PropTypes.object,
|
|
22
|
-
a11yAttributes_label: PropTypes.object,
|
|
23
|
-
customId: PropTypes.string,
|
|
24
|
-
testId: PropTypes.string,
|
|
25
|
-
customStyle: PropTypes.object
|
|
26
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = require("./props/propTypes");
|
|
13
|
-
|
|
14
|
-
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
15
|
-
|
|
16
|
-
var _utils = require("@zohodesk/utils");
|
|
17
|
-
|
|
18
|
-
var _contants = require("./contants");
|
|
19
|
-
|
|
20
|
-
var _Flex = _interopRequireDefault(require("@zohodesk/layout/es/Flex/Flex"));
|
|
21
|
-
|
|
22
|
-
var _Label = _interopRequireDefault(require("../../Label/Label"));
|
|
23
|
-
|
|
24
|
-
var _Switch_v2Module = _interopRequireDefault(require("./css/Switch_v2.module.css"));
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
29
|
-
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
-
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
var Switch = function Switch(props) {
|
|
37
|
-
var name = props.name,
|
|
38
|
-
value = props.value,
|
|
39
|
-
id = props.id,
|
|
40
|
-
size = props.size,
|
|
41
|
-
isChecked = props.isChecked,
|
|
42
|
-
isDisabled = props.isDisabled,
|
|
43
|
-
isReadOnly = props.isReadOnly,
|
|
44
|
-
onChange = props.onChange,
|
|
45
|
-
hasOnOffIndication = props.hasOnOffIndication,
|
|
46
|
-
labelText = props.labelText,
|
|
47
|
-
labelPlacement = props.labelPlacement,
|
|
48
|
-
labelSize = props.labelSize,
|
|
49
|
-
title = props.title,
|
|
50
|
-
customProps_container = props.customProps_container,
|
|
51
|
-
customProps_label = props.customProps_label,
|
|
52
|
-
tagAttributes_container = props.tagAttributes_container,
|
|
53
|
-
tagAttributes_switch = props.tagAttributes_switch,
|
|
54
|
-
a11yAttributes_container = props.a11yAttributes_container,
|
|
55
|
-
a11yAttributes_switch = props.a11yAttributes_switch,
|
|
56
|
-
a11yAttributes_label = props.a11yAttributes_label,
|
|
57
|
-
customId = props.customId,
|
|
58
|
-
testId = props.testId,
|
|
59
|
-
customStyle = props.customStyle;
|
|
60
|
-
var _a11yAttributes_switc = a11yAttributes_switch.role,
|
|
61
|
-
role = _a11yAttributes_switc === void 0 ? 'switch' : _a11yAttributes_switc,
|
|
62
|
-
extraA11yAttributes_switch = a11yAttributes_switch.extraA11yAttributes_switch;
|
|
63
|
-
var style = (0, _utils.mergeStyle)(_Switch_v2Module["default"], customStyle);
|
|
64
|
-
|
|
65
|
-
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
66
|
-
props: props,
|
|
67
|
-
style: style
|
|
68
|
-
}),
|
|
69
|
-
containerClass = _cssJSLogic.containerClass,
|
|
70
|
-
labelClass = _cssJSLogic.labelClass,
|
|
71
|
-
trackClass = _cssJSLogic.trackClass,
|
|
72
|
-
trackWrapperClass = _cssJSLogic.trackWrapperClass,
|
|
73
|
-
thumbClass = _cssJSLogic.thumbClass,
|
|
74
|
-
labelIndicationClass = _cssJSLogic.labelIndicationClass;
|
|
75
|
-
|
|
76
|
-
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], _extends({
|
|
77
|
-
$ui_displayMode: "inline",
|
|
78
|
-
$ui_direction: labelPlacement === 'left' ? 'row' : 'rowReverse',
|
|
79
|
-
$ui_alignItems: "center",
|
|
80
|
-
$tagAttributes_container: _objectSpread({
|
|
81
|
-
'data-selector-id': customId
|
|
82
|
-
}, tagAttributes_container),
|
|
83
|
-
testId: testId,
|
|
84
|
-
customId: customId,
|
|
85
|
-
customStyle: {
|
|
86
|
-
inlineFlex: containerClass
|
|
87
|
-
},
|
|
88
|
-
$a11yAttributes_container: a11yAttributes_container
|
|
89
|
-
}, customProps_container), labelText && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
90
|
-
text: labelText,
|
|
91
|
-
palette: isDisabled || isReadOnly ? 'primary' : 'default',
|
|
92
|
-
size: labelSize,
|
|
93
|
-
htmlFor: id,
|
|
94
|
-
customClass: labelClass,
|
|
95
|
-
a11y: a11yAttributes_label
|
|
96
|
-
}, customProps_label)), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
97
|
-
$flag_shrink: false,
|
|
98
|
-
customStyle: {
|
|
99
|
-
noShrink: trackWrapperClass
|
|
100
|
-
}
|
|
101
|
-
}, /*#__PURE__*/_react["default"].createElement("input", _extends({
|
|
102
|
-
type: "checkbox",
|
|
103
|
-
id: id,
|
|
104
|
-
name: name,
|
|
105
|
-
value: value,
|
|
106
|
-
checked: isChecked,
|
|
107
|
-
disabled: isDisabled,
|
|
108
|
-
readOnly: isReadOnly,
|
|
109
|
-
onChange: !isDisabled && !isReadOnly ? onChange : null,
|
|
110
|
-
role: role,
|
|
111
|
-
className: trackClass,
|
|
112
|
-
"data-title": title
|
|
113
|
-
}, tagAttributes_switch, extraA11yAttributes_switch)), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
114
|
-
className: thumbClass,
|
|
115
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
116
|
-
}, /*#__PURE__*/_react["default"].createElement("circle", {
|
|
117
|
-
cx: "50%",
|
|
118
|
-
cy: "50%",
|
|
119
|
-
r: _contants.thumbRadius[size]
|
|
120
|
-
})), hasOnOffIndication ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
121
|
-
className: labelIndicationClass,
|
|
122
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
123
|
-
}, isChecked ? /*#__PURE__*/_react["default"].createElement("rect", {
|
|
124
|
-
width: "100%",
|
|
125
|
-
height: "100%",
|
|
126
|
-
rx: "50%"
|
|
127
|
-
}) : /*#__PURE__*/_react["default"].createElement("circle", {
|
|
128
|
-
cx: "50%",
|
|
129
|
-
cy: "50%",
|
|
130
|
-
r: _contants.offLabelRadius[size]
|
|
131
|
-
})) : null));
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
var _default = Switch;
|
|
135
|
-
exports["default"] = _default;
|
|
136
|
-
Switch.defaultProps = _defaultProps["default"];
|
|
137
|
-
Switch.propTypes = _propTypes.propTypes;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.thumbRadius = exports.offLabelRadius = void 0;
|
|
7
|
-
var offLabelRadius = {
|
|
8
|
-
small: '35.7%',
|
|
9
|
-
medium: '37.5%',
|
|
10
|
-
large: '38.9%'
|
|
11
|
-
};
|
|
12
|
-
exports.offLabelRadius = offLabelRadius;
|
|
13
|
-
var thumbRadius = {
|
|
14
|
-
small: '40%',
|
|
15
|
-
medium: '42.85%',
|
|
16
|
-
large: '44.45%'
|
|
17
|
-
};
|
|
18
|
-
exports.thumbRadius = thumbRadius;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
--switch-cursor: pointer;
|
|
3
|
-
gap: var(--zd_size6) ;
|
|
4
|
-
}
|
|
5
|
-
.small {
|
|
6
|
-
--switch-track-width: var(--zd_size22);
|
|
7
|
-
--switch-track-height: var(--zd_size12);
|
|
8
|
-
--switch-track-border-radius: 8px;
|
|
9
|
-
--switch-thumb-size: var(--zd_size10);
|
|
10
|
-
--switch-onLabel-height: var(--zd_size6);
|
|
11
|
-
--switch-onLabel-left: var(--zd_size5);
|
|
12
|
-
--switch-offLabel-size: var(--zd_size7);
|
|
13
|
-
--switch-offLabel-right: var(--zd_size2);
|
|
14
|
-
}
|
|
15
|
-
.medium {
|
|
16
|
-
--switch-track-width: var(--zd_size28);
|
|
17
|
-
--switch-track-height: var(--zd_size16);
|
|
18
|
-
--switch-track-border-radius: 16px;
|
|
19
|
-
--switch-thumb-size: var(--zd_size14);
|
|
20
|
-
--switch-onLabel-height: var(--zd_size8);
|
|
21
|
-
--switch-onLabel-left: var(--zd_size6);
|
|
22
|
-
--switch-offLabel-size: var(--zd_size8);
|
|
23
|
-
--switch-offLabel-right: var(--zd_size3);
|
|
24
|
-
}
|
|
25
|
-
.large {
|
|
26
|
-
--switch-track-width: var(--zd_size34);
|
|
27
|
-
--switch-track-height: var(--zd_size20);
|
|
28
|
-
--switch-track-border-radius: 10px;
|
|
29
|
-
--switch-thumb-size: var(--zd_size18);
|
|
30
|
-
--switch-onLabel-height: var(--zd_size11);
|
|
31
|
-
--switch-onLabel-left: var(--zd_size7);
|
|
32
|
-
--switch-offLabel-size: var(--zd_size9);
|
|
33
|
-
--switch-offLabel-right: var(--zd_size4);
|
|
34
|
-
}
|
|
35
|
-
.checked {
|
|
36
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_on_bg);
|
|
37
|
-
--switch-thumb-translateX-value: 0
|
|
38
|
-
}
|
|
39
|
-
.unChecked {
|
|
40
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_off_bg);
|
|
41
|
-
--switch-thumb-translateX-value: calc(var(--switch-thumb-size) + 2px - var(--switch-track-width));
|
|
42
|
-
}
|
|
43
|
-
.disabled, .readonly {
|
|
44
|
-
--switch-cursor: not-allowed;
|
|
45
|
-
}
|
|
46
|
-
.trackWrapper {
|
|
47
|
-
position: relative;
|
|
48
|
-
}
|
|
49
|
-
.track {
|
|
50
|
-
appearance: none;
|
|
51
|
-
display: block;
|
|
52
|
-
position: relative;
|
|
53
|
-
height: var(--switch-track-height);
|
|
54
|
-
width: var(--switch-track-width);
|
|
55
|
-
margin: 0 ;
|
|
56
|
-
border-radius: var(--switch-track-border-radius);
|
|
57
|
-
background-color: var(--switch-track-background-color);
|
|
58
|
-
cursor: var(--switch-cursor);
|
|
59
|
-
}
|
|
60
|
-
.checked .track:not(:disabled):hover {
|
|
61
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_on_hover_bg);
|
|
62
|
-
}
|
|
63
|
-
.unChecked .track:not(:disabled):hover {
|
|
64
|
-
--switch-track-background-color: var(--zdt_v2_switch_track_off_hover_bg);
|
|
65
|
-
}
|
|
66
|
-
.commonSvg {
|
|
67
|
-
display: block;
|
|
68
|
-
position: absolute;
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
top: 50% ;
|
|
71
|
-
}
|
|
72
|
-
.thumb {
|
|
73
|
-
transition: transform var(--zd_transition2);
|
|
74
|
-
fill: var(--zdt_v2_switch_thumb_bg);
|
|
75
|
-
height: var(--switch-thumb-size);
|
|
76
|
-
width: var(--switch-thumb-size);
|
|
77
|
-
transform: translateX(var(--switch-thumb-translateX-value)) translateY(-50%);
|
|
78
|
-
}
|
|
79
|
-
[dir=ltr] .thumb {
|
|
80
|
-
right: var(--zd_size1) ;
|
|
81
|
-
}
|
|
82
|
-
[dir=rtl] .thumb {
|
|
83
|
-
left: var(--zd_size1) ;
|
|
84
|
-
}
|
|
85
|
-
.label {
|
|
86
|
-
cursor: var(--switch-cursor);
|
|
87
|
-
}
|
|
88
|
-
.onLabel {
|
|
89
|
-
height: var(--switch-onLabel-height);
|
|
90
|
-
fill: var(--zdt_v2_switch_on_indication_label);
|
|
91
|
-
transform: translateY(-50%);
|
|
92
|
-
}
|
|
93
|
-
[dir=ltr] .onLabel {
|
|
94
|
-
left: var(--switch-onLabel-left);
|
|
95
|
-
}
|
|
96
|
-
[dir=rtl] .onLabel {
|
|
97
|
-
right: var(--switch-onLabel-left);
|
|
98
|
-
}
|
|
99
|
-
.offLabel {
|
|
100
|
-
height: var(--switch-offLabel-size);
|
|
101
|
-
width: var(--switch-offLabel-size);
|
|
102
|
-
fill: transparent;
|
|
103
|
-
stroke: var(--zdt_v2_switch_off_indication_label);
|
|
104
|
-
transform: translateY(-50%);
|
|
105
|
-
}
|
|
106
|
-
[dir=ltr] .offLabel {
|
|
107
|
-
right: var(--switch-offLabel-right);
|
|
108
|
-
}
|
|
109
|
-
[dir=rtl] .offLabel {
|
|
110
|
-
left: var(--switch-offLabel-right);
|
|
111
|
-
}
|
|
112
|
-
.small .onLabel {
|
|
113
|
-
width: 1.2px;
|
|
114
|
-
}
|
|
115
|
-
.medium .onLabel {
|
|
116
|
-
width: 1.4px;
|
|
117
|
-
}
|
|
118
|
-
.large .onLabel {
|
|
119
|
-
width: 1.6px;
|
|
120
|
-
}
|
|
121
|
-
.disabled .trackWrapper {
|
|
122
|
-
opacity: 0.4;
|
|
123
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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], true), _defineProperty(_compileClassNames, style.checked, isChecked), _defineProperty(_compileClassNames, style.unChecked, !isChecked), _defineProperty(_compileClassNames, style.disabled, 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
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
size: 'medium',
|
|
9
|
-
isChecked: false,
|
|
10
|
-
isDisabled: false,
|
|
11
|
-
isReadOnly: false,
|
|
12
|
-
hasOnOffIndication: true,
|
|
13
|
-
labelPlacement: 'left',
|
|
14
|
-
labelSize: 'medium',
|
|
15
|
-
customProps_container: {},
|
|
16
|
-
customProps_label: {},
|
|
17
|
-
tagAttributes_container: {},
|
|
18
|
-
tagAttributes_switch: {},
|
|
19
|
-
a11yAttributes_container: {},
|
|
20
|
-
a11yAttributes_switch: {},
|
|
21
|
-
a11yAttributes_label: {},
|
|
22
|
-
customStyle: {}
|
|
23
|
-
};
|
|
24
|
-
exports["default"] = _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = {
|
|
13
|
-
name: _propTypes["default"].string,
|
|
14
|
-
value: _propTypes["default"].string,
|
|
15
|
-
id: _propTypes["default"].string,
|
|
16
|
-
size: _propTypes["default"].oneOf(['small', 'medium', 'large']),
|
|
17
|
-
isChecked: _propTypes["default"].bool,
|
|
18
|
-
isDisabled: _propTypes["default"].bool,
|
|
19
|
-
isReadOnly: _propTypes["default"].bool,
|
|
20
|
-
onChange: _propTypes["default"].func,
|
|
21
|
-
hasOnOffIndication: _propTypes["default"].bool,
|
|
22
|
-
labelText: _propTypes["default"].string,
|
|
23
|
-
labelPlacement: _propTypes["default"].oneOf(['left', 'right']),
|
|
24
|
-
labelSize: _propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large']),
|
|
25
|
-
title: _propTypes["default"].string,
|
|
26
|
-
customProps_container: _propTypes["default"].object,
|
|
27
|
-
customProps_label: _propTypes["default"].object,
|
|
28
|
-
tagAttributes_container: _propTypes["default"].object,
|
|
29
|
-
tagAttributes_switch: _propTypes["default"].object,
|
|
30
|
-
a11yAttributes_container: _propTypes["default"].object,
|
|
31
|
-
a11yAttributes_switch: _propTypes["default"].object,
|
|
32
|
-
a11yAttributes_label: _propTypes["default"].object,
|
|
33
|
-
customId: _propTypes["default"].string,
|
|
34
|
-
testId: _propTypes["default"].string,
|
|
35
|
-
customStyle: _propTypes["default"].object
|
|
36
|
-
};
|
|
37
|
-
exports["default"] = _default;
|