@zohodesk/dot 1.0.0-temp-222.1 → 1.0.0-temp-220.5
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 +2 -3
- package/es/form/fields/Fields.module.css +3 -8
- package/es/form/fields/RadioField/RadioField.js +14 -40
- package/es/form/fields/RadioField/__tests__/RadioField.spec.js +0 -33
- package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +66 -562
- package/es/form/fields/RadioField/props/defaultProps.js +0 -1
- package/es/form/fields/RadioField/props/propTypes.js +0 -6
- package/es/version2/GlobalNotification/GlobalNotification.js +46 -7
- package/es/version2/GlobalNotification/__tests__/GlobalNotification.spec.js +9 -0
- package/es/version2/GlobalNotification/props/propTypes.js +4 -3
- package/es/version2/GlobalNotification/utils/constants.js +6 -0
- package/lib/form/fields/Fields.module.css +3 -8
- package/lib/form/fields/RadioField/RadioField.js +15 -39
- package/lib/form/fields/RadioField/__tests__/RadioField.spec.js +0 -33
- package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +66 -562
- package/lib/form/fields/RadioField/props/defaultProps.js +0 -1
- package/lib/form/fields/RadioField/props/propTypes.js +0 -6
- package/lib/version2/GlobalNotification/GlobalNotification.js +68 -18
- package/lib/version2/GlobalNotification/__tests__/GlobalNotification.spec.js +10 -0
- package/lib/version2/GlobalNotification/props/propTypes.js +4 -3
- package/lib/version2/GlobalNotification/utils/constants.js +13 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,9 +4,8 @@ In this Library, we Provide Some Basic Components to Build Your Application
|
|
|
4
4
|
|
|
5
5
|
# 1.8.2
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
|
|
9
|
-
- Supports the `secondaryText`, `renderRightPlaceholderNode` and `customProps` via the `option` prop.
|
|
7
|
+
- **GlobalNotification**
|
|
8
|
+
- `onStatusChange` prop added.
|
|
10
9
|
|
|
11
10
|
# 1.8.1
|
|
12
11
|
|
|
@@ -71,16 +71,11 @@
|
|
|
71
71
|
}
|
|
72
72
|
.radioBox {
|
|
73
73
|
max-width: 100% ;
|
|
74
|
-
transition: border var(--zd_transition3);
|
|
75
|
-
border: 1px solid var(--zdt_radiofield_box_border);
|
|
76
|
-
border-radius: 6px;
|
|
77
|
-
}
|
|
78
|
-
.radioBox.primaryTextOnly {
|
|
79
74
|
height: var(--zd_size36) ;
|
|
75
|
+
transition: border var(--zd_transition3);
|
|
80
76
|
padding: 0 var(--zd_size10) ;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
padding: var(--zd_size18) var(--zd_size16) ;
|
|
77
|
+
border: 1px solid var(--zdt_radiofield_box_border);
|
|
78
|
+
border-radius: 6px
|
|
84
79
|
}
|
|
85
80
|
.hoverableRadioBox:hover, .radioBoxActive {
|
|
86
81
|
border-color: var(--zdt_radiofield_box_active_border)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**** Libraries ****/
|
|
2
2
|
import React, { PureComponent } from 'react';
|
|
3
|
-
import { compileClassNames } from '@zohodesk/utils';
|
|
4
3
|
import { defaultProps } from "./props/defaultProps";
|
|
5
4
|
import { propTypes } from "./props/propTypes";
|
|
6
5
|
/**** Components ****/
|
|
@@ -100,7 +99,6 @@ export default class RadioField extends PureComponent {
|
|
|
100
99
|
isReadOnly,
|
|
101
100
|
isBoxStyle,
|
|
102
101
|
variant,
|
|
103
|
-
customClass,
|
|
104
102
|
customProps
|
|
105
103
|
} = this.props;
|
|
106
104
|
const {
|
|
@@ -110,14 +108,8 @@ export default class RadioField extends PureComponent {
|
|
|
110
108
|
ValidationMessageProps1 = {},
|
|
111
109
|
ValidationMessageProps2 = {}
|
|
112
110
|
} = customProps;
|
|
113
|
-
const {
|
|
114
|
-
customWrapperClass = '',
|
|
115
|
-
customLabelClass = '',
|
|
116
|
-
customRadioWrapperClass = '',
|
|
117
|
-
customRadioClass = ''
|
|
118
|
-
} = customClass;
|
|
119
111
|
return /*#__PURE__*/React.createElement("div", {
|
|
120
|
-
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}
|
|
112
|
+
className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
|
|
121
113
|
"data-title": isDisabled ? title : null,
|
|
122
114
|
"data-selector-id": dataSelectorId
|
|
123
115
|
}, labelName && /*#__PURE__*/React.createElement(Label, {
|
|
@@ -125,7 +117,7 @@ export default class RadioField extends PureComponent {
|
|
|
125
117
|
size: "medium",
|
|
126
118
|
id: id,
|
|
127
119
|
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : 'default',
|
|
128
|
-
customClass: `${style.fieldLabel} ${isMandatory ? style.labelMandatory : ''}
|
|
120
|
+
customClass: `${style.fieldLabel} ${isMandatory ? style.labelMandatory : ''}`,
|
|
129
121
|
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
130
122
|
...LabelProps
|
|
131
123
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -136,32 +128,14 @@ export default class RadioField extends PureComponent {
|
|
|
136
128
|
value,
|
|
137
129
|
disabled = false,
|
|
138
130
|
tooltip,
|
|
139
|
-
infoTooltip
|
|
140
|
-
secondaryText,
|
|
141
|
-
renderRightPlaceholderNode,
|
|
142
|
-
customProps
|
|
131
|
+
infoTooltip
|
|
143
132
|
} = option;
|
|
144
133
|
let isDisabledState = disabled || isDisabled;
|
|
145
134
|
let isChecked = selectedValue == value;
|
|
146
|
-
const rightPlaceholderNode = !!infoTooltip ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
147
|
-
name: "ZD-GN-info",
|
|
148
|
-
size: "16",
|
|
149
|
-
title: infoTooltip,
|
|
150
|
-
iconClass: style.infoIcon,
|
|
151
|
-
...InfoIconProps
|
|
152
|
-
}), renderRightPlaceholderNode) : renderRightPlaceholderNode;
|
|
153
|
-
const radioBoxClasses = isBoxStyle ? compileClassNames({
|
|
154
|
-
[customRadioClass]: !!customRadioClass,
|
|
155
|
-
[style.radioBox]: true,
|
|
156
|
-
[style.withSecondaryText]: !!secondaryText,
|
|
157
|
-
[style.primaryTextOnly]: !secondaryText,
|
|
158
|
-
[style.hoverableRadioBox]: !isDisabledState,
|
|
159
|
-
[style.radioBoxActive]: isChecked
|
|
160
|
-
}) : '';
|
|
161
135
|
return /*#__PURE__*/React.createElement("span", {
|
|
162
|
-
key:
|
|
163
|
-
className: `${!isBoxStyle ? style.radio : ''} ${style.radioWrap}
|
|
164
|
-
}, /*#__PURE__*/React.createElement(Radio, {
|
|
136
|
+
key: index,
|
|
137
|
+
className: `${!isBoxStyle ? style.radio : ''} ${style.radioWrap}`
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Radio, {
|
|
165
139
|
id: index,
|
|
166
140
|
value: value,
|
|
167
141
|
name: id,
|
|
@@ -179,22 +153,22 @@ export default class RadioField extends PureComponent {
|
|
|
179
153
|
dataId: dataId,
|
|
180
154
|
isReadOnly: isReadOnly,
|
|
181
155
|
variant: variant,
|
|
182
|
-
secondaryText: secondaryText,
|
|
183
156
|
...RadioProps,
|
|
184
157
|
a11y: {
|
|
185
158
|
tabIndex: !!selectedValue ? isChecked ? '0' : '-1' : index === 0 ? '0' : '-1',
|
|
186
159
|
...RadioProps.a11y
|
|
187
160
|
},
|
|
188
161
|
customClass: {
|
|
189
|
-
customRadioWrap:
|
|
162
|
+
customRadioWrap: isBoxStyle ? `${style.radioBox} ${!isDisabledState ? style.hoverableRadioBox : ''} ${isChecked ? style.radioBoxActive : ''}` : '',
|
|
190
163
|
...RadioProps.customClass
|
|
191
|
-
},
|
|
192
|
-
customProps: { ...RadioProps.customProps,
|
|
193
|
-
LabelProps: { ...(RadioProps.customProps ? RadioProps.customProps.LabelProps : undefined),
|
|
194
|
-
renderRightPlaceholderNode: rightPlaceholderNode
|
|
195
|
-
}
|
|
196
164
|
}
|
|
197
|
-
}
|
|
165
|
+
}, !!infoTooltip ? /*#__PURE__*/React.createElement(Icon, {
|
|
166
|
+
name: "ZD-GN-info",
|
|
167
|
+
size: "16",
|
|
168
|
+
title: infoTooltip,
|
|
169
|
+
iconClass: style.infoIcon,
|
|
170
|
+
...InfoIconProps
|
|
171
|
+
}) : null));
|
|
198
172
|
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
199
173
|
text: validationMessage,
|
|
200
174
|
palette: validationPalette,
|
|
@@ -17,22 +17,6 @@ const options = [{
|
|
|
17
17
|
text: 'Kolkata',
|
|
18
18
|
value: '4'
|
|
19
19
|
}];
|
|
20
|
-
let optionsWithsecondaryText = [{
|
|
21
|
-
text: 'Chennai',
|
|
22
|
-
value: '1',
|
|
23
|
-
secondaryText: 'Tamil Nadu Capital'
|
|
24
|
-
}, {
|
|
25
|
-
text: 'Mumbai',
|
|
26
|
-
value: '2',
|
|
27
|
-
secondaryText: 'Maharashtra Capital',
|
|
28
|
-
tooltip: 'Disabled Option',
|
|
29
|
-
disabled: true
|
|
30
|
-
}, {
|
|
31
|
-
text: 'Delhi',
|
|
32
|
-
value: '3',
|
|
33
|
-
secondaryText: 'Capital of India',
|
|
34
|
-
infoTooltip: 'Capital of India'
|
|
35
|
-
}];
|
|
36
20
|
describe('RadioField', () => {
|
|
37
21
|
test('rendering the defult props', () => {
|
|
38
22
|
const {
|
|
@@ -59,21 +43,4 @@ describe('RadioField', () => {
|
|
|
59
43
|
}));
|
|
60
44
|
expect(asFragment()).toMatchSnapshot();
|
|
61
45
|
});
|
|
62
|
-
test('rendering with secondaryTextOptions', () => {
|
|
63
|
-
const {
|
|
64
|
-
asFragment
|
|
65
|
-
} = render( /*#__PURE__*/React.createElement(RadioField, {
|
|
66
|
-
options: optionsWithsecondaryText
|
|
67
|
-
}));
|
|
68
|
-
expect(asFragment()).toMatchSnapshot();
|
|
69
|
-
});
|
|
70
|
-
test('rendering with secondaryTextOptions & isBoxStyle', () => {
|
|
71
|
-
const {
|
|
72
|
-
asFragment
|
|
73
|
-
} = render( /*#__PURE__*/React.createElement(RadioField, {
|
|
74
|
-
options: optionsWithsecondaryText,
|
|
75
|
-
isBoxStyle: true
|
|
76
|
-
}));
|
|
77
|
-
expect(asFragment()).toMatchSnapshot();
|
|
78
|
-
});
|
|
79
46
|
});
|