@zohodesk/components 1.5.2 → 1.5.3
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 +10 -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/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/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/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/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/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/package.json +9 -9
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { propTypes as TypographyPropTypes } from "../../Typography/props/propTypes";
|
|
2
3
|
export const propTypes = {
|
|
3
4
|
active: PropTypes.bool,
|
|
4
5
|
checked: PropTypes.bool,
|
|
5
6
|
disabled: PropTypes.bool,
|
|
7
|
+
secondaryText: PropTypes.string,
|
|
6
8
|
disabledTitle: PropTypes.string,
|
|
7
9
|
getRef: PropTypes.func,
|
|
8
10
|
id: PropTypes.string,
|
|
@@ -23,7 +25,8 @@ export const propTypes = {
|
|
|
23
25
|
}),
|
|
24
26
|
customProps: PropTypes.exact({
|
|
25
27
|
ContainerProps: PropTypes.object,
|
|
26
|
-
LabelProps: PropTypes.object
|
|
28
|
+
LabelProps: PropTypes.object,
|
|
29
|
+
secondaryTextProps: PropTypes.exact(TypographyPropTypes)
|
|
27
30
|
}),
|
|
28
31
|
a11y: PropTypes.shape({
|
|
29
32
|
ariaChecked: PropTypes.bool,
|
package/lib/CheckBox/CheckBox.js
CHANGED
|
@@ -15,6 +15,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
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"));
|
|
@@ -104,11 +106,14 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
104
106
|
customClass = _this$props3.customClass,
|
|
105
107
|
customProps = _this$props3.customProps,
|
|
106
108
|
dataSelectorId = _this$props3.dataSelectorId,
|
|
107
|
-
renderRightPlaceholderNode = _this$props3.renderRightPlaceholderNode
|
|
109
|
+
renderRightPlaceholderNode = _this$props3.renderRightPlaceholderNode,
|
|
110
|
+
secondaryText = _this$props3.secondaryText;
|
|
108
111
|
var _customProps$CheckBox = customProps.CheckBoxProps,
|
|
109
112
|
CheckBoxProps = _customProps$CheckBox === void 0 ? {} : _customProps$CheckBox,
|
|
110
113
|
_customProps$LabelPro = customProps.LabelProps,
|
|
111
|
-
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro
|
|
114
|
+
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro,
|
|
115
|
+
_customProps$secondar = customProps.secondaryTextProps,
|
|
116
|
+
secondaryTextProps = _customProps$secondar === void 0 ? {} : _customProps$secondar;
|
|
112
117
|
var _customClass$customCh = customClass.customCheckBox,
|
|
113
118
|
customCheckBox = _customClass$customCh === void 0 ? '' : _customClass$customCh,
|
|
114
119
|
_customClass$customLa = customClass.customLabel,
|
|
@@ -116,7 +121,9 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
116
121
|
_customClass$customCB = customClass.customCBoxSize,
|
|
117
122
|
customCBoxSize = _customClass$customCB === void 0 ? '' : _customClass$customCB,
|
|
118
123
|
_customClass$customTi = customClass.customTickSize,
|
|
119
|
-
customTickSize = _customClass$customTi === void 0 ? '' : _customClass$customTi
|
|
124
|
+
customTickSize = _customClass$customTi === void 0 ? '' : _customClass$customTi,
|
|
125
|
+
_customClass$customSe = customClass.customSecondaryText,
|
|
126
|
+
customSecondaryText = _customClass$customSe === void 0 ? '' : _customClass$customSe;
|
|
120
127
|
var accessMode = isReadOnly ? _CheckBoxModule["default"].readonly : disabled ? (0, _CssProvider["default"])('isDisabled') : _CheckBoxModule["default"].pointer;
|
|
121
128
|
var toolTip = disabled ? disabledTitle : title ? title : null;
|
|
122
129
|
var ariaLabel = a11y.ariaLabel,
|
|
@@ -145,7 +152,8 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
145
152
|
"aria-hidden": ariaHidden,
|
|
146
153
|
dataSelectorId: dataSelectorId || id
|
|
147
154
|
}, CheckBoxProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
148
|
-
className: "".concat(_CheckBoxModule["default"].boxContainer, " ").concat(_CheckBoxModule["default"][size], " ").concat(customCBoxSize, " ").concat(isFilled ? _CheckBoxModule["default"].filled : '', " ").concat(!isEditable ? "".concat(_CheckBoxModule["default"]["disabled"]) : '')
|
|
155
|
+
className: "".concat(_CheckBoxModule["default"].boxContainer, " ").concat(secondaryText ? _CheckBoxModule["default"].withSecondaryText : '', " ").concat(_CheckBoxModule["default"][size], " ").concat(customCBoxSize, " ").concat(isFilled ? _CheckBoxModule["default"].filled : '', " ").concat(!isEditable ? "".concat(_CheckBoxModule["default"]["disabled"]) : ''),
|
|
156
|
+
align: secondaryText ? "start" : undefined
|
|
149
157
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
150
158
|
type: "hidden",
|
|
151
159
|
id: id,
|
|
@@ -193,10 +201,10 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
193
201
|
y1: "20",
|
|
194
202
|
x2: "28.53",
|
|
195
203
|
y2: "20"
|
|
196
|
-
}) : null))), text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
204
|
+
}) : null))), (text || secondaryText) && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
197
205
|
flexible: true,
|
|
198
|
-
className: _CheckBoxModule["default"].
|
|
199
|
-
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
206
|
+
className: _CheckBoxModule["default"].labelContainer
|
|
207
|
+
}, text && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
200
208
|
text: text,
|
|
201
209
|
palette: disabled ? 'disable' : labelPalette,
|
|
202
210
|
id: id,
|
|
@@ -204,9 +212,15 @@ var CheckBox = /*#__PURE__*/function (_React$Component) {
|
|
|
204
212
|
type: "title",
|
|
205
213
|
clipped: isClipped,
|
|
206
214
|
variant: variant,
|
|
207
|
-
customClass: "".concat(active && !disabled ? "".concat(_CheckBoxModule["default"]["active".concat(palette, "Label")]) : '', "\n
|
|
215
|
+
customClass: "".concat(active && !disabled ? "".concat(_CheckBoxModule["default"]["active".concat(palette, "Label")]) : '', "\n ").concat(checked && active ? "".concat(_CheckBoxModule["default"]["checked".concat(palette, "Label")]) : '', " \n ").concat(accessMode, " ").concat(customLabel),
|
|
208
216
|
title: toolTip ? toolTip : text
|
|
209
|
-
}, LabelProps))
|
|
217
|
+
}, LabelProps)), secondaryText ? /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
218
|
+
$ui_size: "12",
|
|
219
|
+
$ui_lineHeight: "1.2"
|
|
220
|
+
}, secondaryTextProps, {
|
|
221
|
+
$i18n_dataTitle: toolTip ? null : secondaryText,
|
|
222
|
+
$ui_className: "".concat(_CheckBoxModule["default"].secondaryText, " ").concat(customSecondaryText)
|
|
223
|
+
}), secondaryText) : null), renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
|
|
210
224
|
}
|
|
211
225
|
}]);
|
|
212
226
|
|
|
@@ -90,12 +90,6 @@
|
|
|
90
90
|
[dir=rtl] .linePath {
|
|
91
91
|
animation: lineAnimate var(--zd_transition3) ease forwards;
|
|
92
92
|
}
|
|
93
|
-
[dir=ltr] .text {
|
|
94
|
-
margin-left: var(--zd_size6) ;
|
|
95
|
-
}
|
|
96
|
-
[dir=rtl] .text {
|
|
97
|
-
margin-right: var(--zd_size6) ;
|
|
98
|
-
}
|
|
99
93
|
|
|
100
94
|
.checkedprimary,
|
|
101
95
|
.checkeddanger {
|
|
@@ -141,6 +135,27 @@
|
|
|
141
135
|
.disabled {
|
|
142
136
|
opacity: 0.7
|
|
143
137
|
}
|
|
138
|
+
|
|
139
|
+
.withSecondaryText {
|
|
140
|
+
margin-top: var(--zd_size1) ;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.secondaryText {
|
|
144
|
+
color: var(--zdt_checkbox_secondary_text);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.labelContainer {
|
|
148
|
+
composes: dflex flexcolumn from '../common/common.module.css';
|
|
149
|
+
gap: var(--zd_size4) ;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
[dir=ltr] .labelContainer {
|
|
153
|
+
margin-left: var(--zd_size6) ;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
[dir=rtl] .labelContainer {
|
|
157
|
+
margin-right: var(--zd_size6) ;
|
|
158
|
+
}
|
|
144
159
|
@keyframes tickAnimate {
|
|
145
160
|
0% {
|
|
146
161
|
stroke-dashoffset: 40;
|
|
@@ -168,24 +168,33 @@ describe('CheckBox component', function () {
|
|
|
168
168
|
|
|
169
169
|
expect(asFragment()).toMatchSnapshot();
|
|
170
170
|
});
|
|
171
|
-
test('Should
|
|
171
|
+
test('Should render secondaryText', function () {
|
|
172
172
|
var _render18 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
173
|
-
|
|
173
|
+
text: "checkboxText",
|
|
174
|
+
secondaryText: "secondaryText"
|
|
174
175
|
})),
|
|
175
176
|
asFragment = _render18.asFragment;
|
|
176
177
|
|
|
177
178
|
expect(asFragment()).toMatchSnapshot();
|
|
178
179
|
});
|
|
179
|
-
test('Should be render
|
|
180
|
+
test('Should be render activeStyle is minus', function () {
|
|
180
181
|
var _render19 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
181
|
-
|
|
182
|
+
activeStyle: "minus"
|
|
182
183
|
})),
|
|
183
184
|
asFragment = _render19.asFragment;
|
|
184
185
|
|
|
185
186
|
expect(asFragment()).toMatchSnapshot();
|
|
186
187
|
});
|
|
187
|
-
test('
|
|
188
|
+
test('Should be render dataSelectorId', function () {
|
|
188
189
|
var _render20 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
190
|
+
dataSelectorId: "dataSelectorIdCheck"
|
|
191
|
+
})),
|
|
192
|
+
asFragment = _render20.asFragment;
|
|
193
|
+
|
|
194
|
+
expect(asFragment()).toMatchSnapshot();
|
|
195
|
+
});
|
|
196
|
+
test('rendering the Custom Props', function () {
|
|
197
|
+
var _render21 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
189
198
|
text: "checkboxText",
|
|
190
199
|
customProps: {
|
|
191
200
|
CheckBoxProps: {
|
|
@@ -196,12 +205,12 @@ describe('CheckBox component', function () {
|
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
})),
|
|
199
|
-
asFragment =
|
|
208
|
+
asFragment = _render21.asFragment;
|
|
200
209
|
|
|
201
210
|
expect(asFragment()).toMatchSnapshot();
|
|
202
211
|
});
|
|
203
212
|
test('rendering the Custom class', function () {
|
|
204
|
-
var
|
|
213
|
+
var _render22 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
205
214
|
text: "checkboxText",
|
|
206
215
|
checked: true,
|
|
207
216
|
customClass: {
|
|
@@ -211,12 +220,12 @@ describe('CheckBox component', function () {
|
|
|
211
220
|
customTickSize: 'customTickSizeClass'
|
|
212
221
|
}
|
|
213
222
|
})),
|
|
214
|
-
asFragment =
|
|
223
|
+
asFragment = _render22.asFragment;
|
|
215
224
|
|
|
216
225
|
expect(asFragment()).toMatchSnapshot();
|
|
217
226
|
});
|
|
218
227
|
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role true and entering their values', function () {
|
|
219
|
-
var
|
|
228
|
+
var _render23 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
220
229
|
checked: true,
|
|
221
230
|
a11y: {
|
|
222
231
|
ariaLabel: 'ariaLabelCheckBox',
|
|
@@ -226,12 +235,12 @@ describe('CheckBox component', function () {
|
|
|
226
235
|
role: 'checkBox2'
|
|
227
236
|
}
|
|
228
237
|
})),
|
|
229
|
-
asFragment =
|
|
238
|
+
asFragment = _render23.asFragment;
|
|
230
239
|
|
|
231
240
|
expect(asFragment()).toMatchSnapshot();
|
|
232
241
|
});
|
|
233
242
|
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role false and entering their values', function () {
|
|
234
|
-
var
|
|
243
|
+
var _render24 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
235
244
|
checked: true,
|
|
236
245
|
a11y: {
|
|
237
246
|
ariaLabel: 'ariaLabelCheckBox',
|
|
@@ -241,7 +250,7 @@ describe('CheckBox component', function () {
|
|
|
241
250
|
role: 'checkBox3'
|
|
242
251
|
}
|
|
243
252
|
})),
|
|
244
|
-
asFragment =
|
|
253
|
+
asFragment = _render24.asFragment;
|
|
245
254
|
|
|
246
255
|
expect(asFragment()).toMatchSnapshot();
|
|
247
256
|
});
|