@zohodesk/components 1.5.2 → 1.5.4-temp-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/README.md +21 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +2 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +2 -0
- package/es/CheckBox/CheckBox.js +21 -10
- package/es/CheckBox/CheckBox.module.css +21 -6
- package/es/CheckBox/__tests__/CheckBox.spec.js +9 -0
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/es/CheckBox/props/propTypes.js +4 -1
- package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -1
- package/es/DropBox/utils/isMobilePopover.js +3 -14
- package/es/Label/Label.js +19 -1
- package/es/Label/__tests__/Label.spec.js +58 -0
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/es/Label/props/defaultProps.js +1 -0
- package/es/Label/props/propTypes.js +7 -1
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +7 -7
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +7 -7
- package/es/Popup/Popup.js +32 -1045
- package/es/Radio/Radio.js +20 -9
- package/es/Radio/Radio.module.css +38 -5
- package/es/Radio/__tests__/Radio.spec.js +10 -0
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +154 -81
- package/es/Radio/props/propTypes.js +4 -1
- package/es/Tag/Tag.js +5 -2
- package/es/Tag/props/propTypes.js +2 -0
- package/es/utils/Common.js +1 -1
- package/es/v1/Popup/Popup.js +2 -2
- package/lib/CheckBox/CheckBox.js +23 -9
- package/lib/CheckBox/CheckBox.module.css +21 -6
- package/lib/CheckBox/__tests__/CheckBox.spec.js +21 -12
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/lib/CheckBox/props/propTypes.js +5 -1
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +5 -5
- package/lib/DropBox/utils/isMobilePopover.js +4 -14
- package/lib/Label/Label.js +21 -1
- package/lib/Label/__tests__/Label.spec.js +58 -0
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/lib/Label/props/defaultProps.js +1 -0
- package/lib/Label/props/propTypes.js +8 -1
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +7 -7
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +7 -7
- package/lib/Popup/Popup.js +36 -1149
- package/lib/Radio/Radio.js +22 -8
- package/lib/Radio/Radio.module.css +38 -5
- package/lib/Radio/__tests__/Radio.spec.js +10 -0
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +154 -81
- package/lib/Radio/props/propTypes.js +5 -1
- package/lib/Tag/Tag.js +6 -2
- package/lib/Tag/props/propTypes.js +2 -0
- package/lib/utils/Common.js +1 -1
- package/lib/v1/Popup/Popup.js +4 -4
- package/package.json +9 -9
- package/es/DropBox/DropBoxPositionMapping.js +0 -142
- package/es/Popup/PositionMapping.js +0 -72
- package/es/Popup/Registry.js +0 -36
- package/es/Popup/intersectionObserver.js +0 -49
- package/es/Popup/viewPort.js +0 -373
- package/lib/DropBox/DropBoxPositionMapping.js +0 -149
- package/lib/Popup/PositionMapping.js +0 -81
- package/lib/Popup/Registry.js +0 -46
- package/lib/Popup/intersectionObserver.js +0 -72
- package/lib/Popup/viewPort.js +0 -367
package/lib/Radio/Radio.js
CHANGED
|
@@ -15,6 +15,8 @@ var _propTypes = require("./props/propTypes");
|
|
|
15
15
|
|
|
16
16
|
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
17
17
|
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
19
|
+
|
|
18
20
|
var _Layout = require("../Layout");
|
|
19
21
|
|
|
20
22
|
var _CssProvider = _interopRequireDefault(require("../Provider/CssProvider"));
|
|
@@ -101,13 +103,16 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
101
103
|
customProps = _this$props3.customProps,
|
|
102
104
|
children = _this$props3.children,
|
|
103
105
|
a11y = _this$props3.a11y,
|
|
106
|
+
secondaryText = _this$props3.secondaryText,
|
|
104
107
|
renderRightPlaceholderNode = _this$props3.renderRightPlaceholderNode;
|
|
105
108
|
var _customClass$customRa = customClass.customRadioWrap,
|
|
106
109
|
customRadioWrap = _customClass$customRa === void 0 ? '' : _customClass$customRa,
|
|
107
110
|
_customClass$customRa2 = customClass.customRadio,
|
|
108
111
|
customRadio = _customClass$customRa2 === void 0 ? '' : _customClass$customRa2,
|
|
109
112
|
_customClass$customLa = customClass.customLabel,
|
|
110
|
-
customLabel = _customClass$customLa === void 0 ? '' : _customClass$customLa
|
|
113
|
+
customLabel = _customClass$customLa === void 0 ? '' : _customClass$customLa,
|
|
114
|
+
_customClass$customSe = customClass.customSecondaryText,
|
|
115
|
+
customSecondaryText = _customClass$customSe === void 0 ? '' : _customClass$customSe;
|
|
111
116
|
var accessMode = isReadOnly ? _RadioModule["default"].readonly : disabled ? (0, _CssProvider["default"])('isDisabled') : _RadioModule["default"].pointer;
|
|
112
117
|
var toolTip = disabled ? disabledTitle : title ? title : null;
|
|
113
118
|
var isEditable = !(isReadOnly || disabled);
|
|
@@ -124,7 +129,9 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
124
129
|
var _customProps$Containe = customProps.ContainerProps,
|
|
125
130
|
ContainerProps = _customProps$Containe === void 0 ? {} : _customProps$Containe,
|
|
126
131
|
_customProps$LabelPro = customProps.LabelProps,
|
|
127
|
-
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro
|
|
132
|
+
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro,
|
|
133
|
+
_customProps$secondar = customProps.secondaryTextProps,
|
|
134
|
+
secondaryTextProps = _customProps$secondar === void 0 ? {} : _customProps$secondar;
|
|
128
135
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
|
|
129
136
|
dataId: value ? value.toLowerCase() : 'RadioComp',
|
|
130
137
|
isCover: false,
|
|
@@ -143,7 +150,8 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
143
150
|
"aria-labelledby": ariaLabelledby,
|
|
144
151
|
"aria-readonly": ariaReadonly
|
|
145
152
|
}, ContainerProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
146
|
-
className: "".concat(_RadioModule["default"].radio, " ").concat(checked ? "".concat(_RadioModule["default"]["rdBox".concat(palette)]) : '', " \n ").concat(!isEditable ? '' : "".concat(_RadioModule["default"]["hover".concat(palette)]), " ").concat(_RadioModule["default"][size], " ").concat(isFilled ? _RadioModule["default"].filled : '', " ").concat(_RadioModule["default"]["centerPath".concat(palette)], " ").concat(customRadio, " ").concat(!isEditable ? "".concat(_RadioModule["default"].disabled) : '')
|
|
153
|
+
className: "".concat(_RadioModule["default"].radio, " ").concat(checked ? "".concat(_RadioModule["default"]["rdBox".concat(palette)]) : '', " \n ").concat(!isEditable ? '' : "".concat(_RadioModule["default"]["hover".concat(palette)]), " ").concat(_RadioModule["default"][size], " ").concat(isFilled ? _RadioModule["default"].filled : '', " ").concat(_RadioModule["default"]["centerPath".concat(palette)], " ").concat(customRadio, " ").concat(!isEditable ? "".concat(_RadioModule["default"].disabled) : '', " ").concat(secondaryText ? _RadioModule["default"].withSecondaryText : ''),
|
|
154
|
+
align: secondaryText ? "start" : undefined
|
|
147
155
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
148
156
|
type: "hidden",
|
|
149
157
|
id: id,
|
|
@@ -164,10 +172,10 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
164
172
|
cy: "20",
|
|
165
173
|
r: "11.03",
|
|
166
174
|
className: "".concat(_RadioModule["default"].centerPath)
|
|
167
|
-
}) : null))), text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
175
|
+
}) : null))), (text || secondaryText) && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
168
176
|
flexible: true,
|
|
169
|
-
className:
|
|
170
|
-
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
177
|
+
className: _RadioModule["default"].labelContainer
|
|
178
|
+
}, text && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
171
179
|
text: text,
|
|
172
180
|
palette: labelPalette,
|
|
173
181
|
size: labelSize,
|
|
@@ -176,8 +184,14 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
176
184
|
dataId: "".concat(text, "_label"),
|
|
177
185
|
variant: variant,
|
|
178
186
|
title: toolTip ? toolTip : text,
|
|
179
|
-
customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " \n
|
|
180
|
-
}, LabelProps))
|
|
187
|
+
customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " ").concat(disabled ? "".concat(_RadioModule["default"].disabled) : '', "\n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(isEditable ? _RadioModule["default"].pointer : '', " ").concat(isReadOnly ? _RadioModule["default"].readonly : '', " ").concat(customLabel)
|
|
188
|
+
}, LabelProps)), secondaryText ? /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
189
|
+
$ui_size: "12",
|
|
190
|
+
$ui_lineHeight: "1.2"
|
|
191
|
+
}, secondaryTextProps, {
|
|
192
|
+
$i18n_dataTitle: toolTip ? null : secondaryText,
|
|
193
|
+
$ui_className: "".concat(_RadioModule["default"].secondaryText, " ").concat(customSecondaryText)
|
|
194
|
+
}), secondaryText) : null), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
|
|
181
195
|
}
|
|
182
196
|
}]);
|
|
183
197
|
|
|
@@ -10,20 +10,25 @@
|
|
|
10
10
|
}[dir=ltr] .varClass {
|
|
11
11
|
--radio_label_margin: 0 0 0 var(--zd_size6);
|
|
12
12
|
}[dir=rtl] .varClass {
|
|
13
|
-
--radio_label_margin: 0 var(--zd_size6)
|
|
13
|
+
--radio_label_margin: 0 0 0 var(--zd_size6);
|
|
14
14
|
}
|
|
15
|
+
|
|
15
16
|
.container {
|
|
16
17
|
composes: varClass;
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
.pointer {
|
|
19
21
|
cursor: pointer;
|
|
20
22
|
}
|
|
23
|
+
|
|
21
24
|
.readonly, .disabled {
|
|
22
25
|
cursor: default;
|
|
23
26
|
}
|
|
27
|
+
|
|
24
28
|
.disabled {
|
|
25
29
|
opacity: 0.7
|
|
26
30
|
}
|
|
31
|
+
|
|
27
32
|
.radio {
|
|
28
33
|
composes: offSelection from '../common/common.module.css';
|
|
29
34
|
width: var(--radio_width);
|
|
@@ -32,10 +37,12 @@
|
|
|
32
37
|
background: var(--radio_bg_color);
|
|
33
38
|
border-radius: 50%;
|
|
34
39
|
}
|
|
40
|
+
|
|
35
41
|
.radio,
|
|
36
42
|
.centerPath {
|
|
37
43
|
fill: var(--radio_fill);
|
|
38
44
|
}
|
|
45
|
+
|
|
39
46
|
.filled {
|
|
40
47
|
--radio_bg_color: var(--zdt_radio_default_bg);
|
|
41
48
|
}
|
|
@@ -44,48 +51,66 @@
|
|
|
44
51
|
--radio_width: var(--zd_size16);
|
|
45
52
|
--radio_height: var(--zd_size16);
|
|
46
53
|
}
|
|
54
|
+
|
|
47
55
|
.small {
|
|
48
56
|
--radio_width: var(--zd_size13);
|
|
49
57
|
--radio_height: var(--zd_size13);
|
|
50
58
|
}
|
|
59
|
+
|
|
60
|
+
.medium.withSecondaryText {
|
|
61
|
+
margin-top: var(--zd_size1) ;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.small.withSecondaryText {
|
|
65
|
+
margin-top: var(--zd_size3) ;
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
.radioLabel {
|
|
52
69
|
font-size: 0 ;
|
|
53
70
|
display: block;
|
|
54
71
|
}
|
|
72
|
+
|
|
55
73
|
.rdBox {
|
|
56
74
|
fill: none;
|
|
57
75
|
stroke-width: var(--radio_stroke_width);
|
|
58
76
|
stroke-linecap: round;
|
|
59
77
|
stroke: inherit;
|
|
60
78
|
}
|
|
79
|
+
|
|
61
80
|
.centerPath {
|
|
62
81
|
--radio_fill: inherit;
|
|
63
82
|
stroke-width: var(--radio_inner_stroke_width);
|
|
64
83
|
transform-origin: center;
|
|
65
84
|
}
|
|
85
|
+
|
|
66
86
|
[dir=ltr] .checked .centerPath {
|
|
67
87
|
animation: circleAnimate var(--zd_transition3) ease forwards;
|
|
68
88
|
}
|
|
89
|
+
|
|
69
90
|
[dir=rtl] .checked .centerPath {
|
|
70
91
|
animation: circleAnimate var(--zd_transition3) ease forwards;
|
|
71
92
|
}
|
|
93
|
+
|
|
72
94
|
.rdBoxprimary,
|
|
73
95
|
.hoverEfffect:hover .hoverprimary
|
|
96
|
+
|
|
74
97
|
/* .hoverEfffect:focus .hoverprimary */
|
|
75
|
-
{
|
|
98
|
+
{
|
|
76
99
|
--radio_stroke_color: var(--zdt_radio_primary_stroke);
|
|
77
100
|
}
|
|
78
101
|
|
|
79
102
|
.rdBoxdanger,
|
|
80
103
|
.hoverEfffect:hover .hoverdanger
|
|
104
|
+
|
|
81
105
|
/* .hoverEfffect:focus .hoverdanger */
|
|
82
|
-
|
|
106
|
+
{
|
|
83
107
|
--radio_stroke_color: var(--zdt_radio_danger_stroke);
|
|
84
108
|
}
|
|
85
109
|
|
|
86
110
|
.centerPathprimary {
|
|
87
111
|
--radio_fill: var(--zdt_radio_primary_fill);
|
|
88
112
|
}
|
|
113
|
+
|
|
89
114
|
.centerPathdanger {
|
|
90
115
|
--radio_fill: var(--zdt_radio_danger_fill);
|
|
91
116
|
}
|
|
@@ -102,14 +127,22 @@
|
|
|
102
127
|
--label_text_color: var(--zdt_radio_label_danger_text);
|
|
103
128
|
}
|
|
104
129
|
|
|
105
|
-
.
|
|
130
|
+
.secondaryText {
|
|
131
|
+
color: var(--zdt_radio_secondary_text);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.labelContainer {
|
|
135
|
+
composes: dflex flexcolumn from '../common/common.module.css';
|
|
136
|
+
gap: var(--zd_size4) ;
|
|
106
137
|
margin: var(--radio_label_margin);
|
|
107
138
|
}
|
|
139
|
+
|
|
108
140
|
@keyframes circleAnimate {
|
|
109
141
|
0% {
|
|
110
142
|
transform: scale(0);
|
|
111
143
|
}
|
|
144
|
+
|
|
112
145
|
100% {
|
|
113
146
|
transform: scale(1);
|
|
114
147
|
}
|
|
115
|
-
}
|
|
148
|
+
}
|
|
@@ -243,4 +243,14 @@ describe('Radio', function () {
|
|
|
243
243
|
|
|
244
244
|
expect(asFragment()).toMatchSnapshot();
|
|
245
245
|
});
|
|
246
|
+
test('rendering secondaryText with checked state', function () {
|
|
247
|
+
var _render25 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
248
|
+
secondaryText: "Secondary text",
|
|
249
|
+
text: "Radio Text",
|
|
250
|
+
checked: true
|
|
251
|
+
})),
|
|
252
|
+
asFragment = _render25.asFragment;
|
|
253
|
+
|
|
254
|
+
expect(asFragment()).toMatchSnapshot();
|
|
255
|
+
});
|
|
246
256
|
});
|