@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/es/Radio/Radio.js
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
import Label from "../Label/Label";
|
|
6
|
+
import Typography from "../Typography/Typography";
|
|
6
7
|
import { Container, Box } from "../Layout";
|
|
7
8
|
import CssProvider from "../Provider/CssProvider";
|
|
8
9
|
import style from "./Radio.module.css";
|
|
@@ -51,12 +52,14 @@ export default class Radio extends React.Component {
|
|
|
51
52
|
customProps,
|
|
52
53
|
children,
|
|
53
54
|
a11y,
|
|
55
|
+
secondaryText,
|
|
54
56
|
renderRightPlaceholderNode
|
|
55
57
|
} = this.props;
|
|
56
58
|
let {
|
|
57
59
|
customRadioWrap = '',
|
|
58
60
|
customRadio = '',
|
|
59
|
-
customLabel = ''
|
|
61
|
+
customLabel = '',
|
|
62
|
+
customSecondaryText = ''
|
|
60
63
|
} = customClass;
|
|
61
64
|
let accessMode = isReadOnly ? style.readonly : disabled ? CssProvider('isDisabled') : style.pointer;
|
|
62
65
|
let toolTip = disabled ? disabledTitle : title ? title : null;
|
|
@@ -72,7 +75,8 @@ export default class Radio extends React.Component {
|
|
|
72
75
|
} = a11y;
|
|
73
76
|
let {
|
|
74
77
|
ContainerProps = {},
|
|
75
|
-
LabelProps = {}
|
|
78
|
+
LabelProps = {},
|
|
79
|
+
secondaryTextProps = {}
|
|
76
80
|
} = customProps;
|
|
77
81
|
return /*#__PURE__*/React.createElement(Container, {
|
|
78
82
|
dataId: value ? value.toLowerCase() : 'RadioComp',
|
|
@@ -94,7 +98,8 @@ export default class Radio extends React.Component {
|
|
|
94
98
|
...ContainerProps
|
|
95
99
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
96
100
|
className: `${style.radio} ${checked ? `${style[`rdBox${palette}`]}` : ''}
|
|
97
|
-
${!isEditable ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio} ${!isEditable ? `${style.disabled}` : ''}
|
|
101
|
+
${!isEditable ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio} ${!isEditable ? `${style.disabled}` : ''} ${secondaryText ? style.withSecondaryText : ''}`,
|
|
102
|
+
align: secondaryText ? "start" : undefined
|
|
98
103
|
}, /*#__PURE__*/React.createElement("input", {
|
|
99
104
|
type: "hidden",
|
|
100
105
|
id: id,
|
|
@@ -115,10 +120,10 @@ export default class Radio extends React.Component {
|
|
|
115
120
|
cy: "20",
|
|
116
121
|
r: "11.03",
|
|
117
122
|
className: `${style.centerPath}`
|
|
118
|
-
}) : null))), text && /*#__PURE__*/React.createElement(Box, {
|
|
123
|
+
}) : null))), (text || secondaryText) && /*#__PURE__*/React.createElement(Box, {
|
|
119
124
|
flexible: true,
|
|
120
|
-
className:
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
125
|
+
className: style.labelContainer
|
|
126
|
+
}, text && /*#__PURE__*/React.createElement(Label, {
|
|
122
127
|
text: text,
|
|
123
128
|
palette: labelPalette,
|
|
124
129
|
size: labelSize,
|
|
@@ -127,10 +132,16 @@ export default class Radio extends React.Component {
|
|
|
127
132
|
dataId: `${text}_label`,
|
|
128
133
|
variant: variant,
|
|
129
134
|
title: toolTip ? toolTip : text,
|
|
130
|
-
customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
|
|
131
|
-
|
|
135
|
+
customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''} ${disabled ? `${style.disabled}` : ''}
|
|
136
|
+
${style[`${palette}Label`]} ${isEditable ? style.pointer : ''} ${isReadOnly ? style.readonly : ''} ${customLabel}`,
|
|
132
137
|
...LabelProps
|
|
133
|
-
})
|
|
138
|
+
}), secondaryText ? /*#__PURE__*/React.createElement(Typography, {
|
|
139
|
+
$ui_size: "12",
|
|
140
|
+
$ui_lineHeight: "1.2",
|
|
141
|
+
...secondaryTextProps,
|
|
142
|
+
$i18n_dataTitle: toolTip ? null : secondaryText,
|
|
143
|
+
$ui_className: `${style.secondaryText} ${customSecondaryText}`
|
|
144
|
+
}, secondaryText) : null), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
}
|
|
@@ -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
|
+
}
|
|
@@ -235,4 +235,14 @@ describe('Radio', () => {
|
|
|
235
235
|
})));
|
|
236
236
|
expect(asFragment()).toMatchSnapshot();
|
|
237
237
|
});
|
|
238
|
+
test('rendering secondaryText with checked state', () => {
|
|
239
|
+
const {
|
|
240
|
+
asFragment
|
|
241
|
+
} = render( /*#__PURE__*/React.createElement(Radio, {
|
|
242
|
+
secondaryText: "Secondary text",
|
|
243
|
+
text: "Radio Text",
|
|
244
|
+
checked: true
|
|
245
|
+
}));
|
|
246
|
+
expect(asFragment()).toMatchSnapshot();
|
|
247
|
+
});
|
|
238
248
|
});
|