@zohodesk/dot 1.0.0-temp-221 → 1.0.0-temp-222
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 +4 -0
- package/es/form/fields/CheckBoxField/CheckBoxField.js +9 -6
- package/es/form/fields/CurrencyField/CurrencyField.js +5 -5
- package/es/form/fields/DateField/DateField.js +8 -7
- package/es/form/fields/Fields.module.css +8 -3
- package/es/form/fields/MultiSelectField/MultiSelectField.js +6 -5
- package/es/form/fields/RadioField/RadioField.js +29 -10
- package/es/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
- package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +562 -66
- package/es/form/fields/SelectField/SelectField.js +6 -5
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -6
- package/es/form/fields/TextBoxField/TextBoxField.js +7 -7
- package/es/form/fields/TextareaField/TextareaField.js +6 -6
- package/lib/form/fields/CheckBoxField/CheckBoxField.js +10 -6
- package/lib/form/fields/CurrencyField/CurrencyField.js +5 -4
- package/lib/form/fields/DateField/DateField.js +9 -6
- package/lib/form/fields/Fields.module.css +8 -3
- package/lib/form/fields/MultiSelectField/MultiSelectField.js +7 -5
- package/lib/form/fields/RadioField/RadioField.js +26 -11
- package/lib/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
- package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +562 -66
- package/lib/form/fields/SelectField/SelectField.js +7 -5
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -5
- package/lib/form/fields/TextBoxField/TextBoxField.js +8 -6
- package/lib/form/fields/TextareaField/TextareaField.js +6 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.7.27
|
|
6
|
+
- **RadioField**
|
|
7
|
+
- Supports the `secondaryText`, `renderRightPlaceholderNode` & `customProps` via the `option` prop.
|
|
8
|
+
|
|
5
9
|
# 1.7.26
|
|
6
10
|
|
|
7
11
|
- `list/SecondaryText/PhoneNumber.js`
|
|
@@ -3,9 +3,8 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
/**** Components ****/
|
|
6
|
-
// import Label from '@zohodesk/components/es/Label/Label';
|
|
7
6
|
|
|
8
|
-
import Label from '@zohodesk/components/es/
|
|
7
|
+
import Label from '@zohodesk/components/es/Label/Label';
|
|
9
8
|
import CheckBox from '@zohodesk/components/es/CheckBox/CheckBox';
|
|
10
9
|
import ValidationMessage from "../ValidationMessage/ValidationMessage";
|
|
11
10
|
import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
@@ -88,11 +87,15 @@ export default class CheckBoxField extends PureComponent {
|
|
|
88
87
|
renderProps: renderLabelProps
|
|
89
88
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
90
89
|
text: labelName,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
id: id,
|
|
91
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
92
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
93
|
+
infoText: infoText,
|
|
94
|
+
customClass: `${!isDirectCol ? style.checkboxText : ''} ${!isDirectCol ? style[`lineClamp_${lineClamp}`] : ''} ${isReadOnly || isDisabled ? style.cbTextReadonly : style.cbTextPointer} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
95
|
+
title: labelName,
|
|
95
96
|
onClick: !removeEvent ? this.handleLabelClick : null,
|
|
97
|
+
variant: isDirectCol ? 'default' : 'primary',
|
|
98
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
96
99
|
...LabelProps
|
|
97
100
|
}));
|
|
98
101
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -3,9 +3,8 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
/**** Components ****/
|
|
6
|
-
// import Label from '@zohodesk/components/es/Label/Label';
|
|
7
6
|
|
|
8
|
-
import Label from '@zohodesk/components/es/
|
|
7
|
+
import Label from '@zohodesk/components/es/Label/Label';
|
|
9
8
|
import TextBoxIcon from '@zohodesk/components/es/TextBoxIcon/TextBoxIcon';
|
|
10
9
|
import ValidationMessage from "../ValidationMessage/ValidationMessage";
|
|
11
10
|
import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
@@ -130,10 +129,11 @@ export default class CurrencyField extends PureComponent {
|
|
|
130
129
|
renderProps: renderLabelProps
|
|
131
130
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
132
131
|
text: labelName,
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
133
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
134
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
135
135
|
htmlFor: uniqueId,
|
|
136
|
-
|
|
136
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
137
137
|
...LabelProps
|
|
138
138
|
})), /*#__PURE__*/React.createElement("div", {
|
|
139
139
|
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
@@ -3,9 +3,8 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
/**** Components ****/
|
|
6
|
-
// import Label from '@zohodesk/components/es/Label/Label';
|
|
7
6
|
|
|
8
|
-
import Label from '@zohodesk/components/es/
|
|
7
|
+
import Label from '@zohodesk/components/es/Label/Label';
|
|
9
8
|
import DateWidget from '@zohodesk/components/es/DateTime/DateWidget';
|
|
10
9
|
import ValidationMessage from "../ValidationMessage/ValidationMessage";
|
|
11
10
|
import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
@@ -134,12 +133,14 @@ export default class DateField extends PureComponent {
|
|
|
134
133
|
renderProps: renderLabelProps
|
|
135
134
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
136
135
|
text: labelName,
|
|
137
|
-
isRequired: isMandatory,
|
|
138
|
-
customStyle: labelCustomClass,
|
|
139
136
|
htmlFor: getAriaId,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
138
|
+
palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
|
|
139
|
+
onClick: isDisabled || isReadOnly ? null : this.handleLabelClick,
|
|
140
|
+
customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
|
|
141
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
142
|
+
...LabelProps,
|
|
143
|
+
id: labelName
|
|
143
144
|
})), /*#__PURE__*/React.createElement("div", {
|
|
144
145
|
className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
|
|
145
146
|
}, isLocked && lockedValueText ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -71,11 +71,16 @@
|
|
|
71
71
|
}
|
|
72
72
|
.radioBox {
|
|
73
73
|
max-width: 100% ;
|
|
74
|
-
height: var(--zd_size36) ;
|
|
75
74
|
transition: border var(--zd_transition3);
|
|
76
|
-
padding: 0 var(--zd_size10) ;
|
|
77
75
|
border: 1px solid var(--zdt_radiofield_box_border);
|
|
78
|
-
border-radius: 6px
|
|
76
|
+
border-radius: 6px;
|
|
77
|
+
}
|
|
78
|
+
.radioBox.primaryTextOnly {
|
|
79
|
+
height: var(--zd_size36) ;
|
|
80
|
+
padding: 0 var(--zd_size10) ;
|
|
81
|
+
}
|
|
82
|
+
.radioBox.withSecondaryText {
|
|
83
|
+
padding: var(--zd_size18) var(--zd_size16) ;
|
|
79
84
|
}
|
|
80
85
|
.hoverableRadioBox:hover, .radioBoxActive {
|
|
81
86
|
border-color: var(--zdt_radiofield_box_active_border)
|
|
@@ -3,9 +3,8 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { defaultProps } from "./props/defaultProps";
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
/**** Components ****/
|
|
6
|
-
// import Label from '@zohodesk/components/es/Label/Label';
|
|
7
6
|
|
|
8
|
-
import Label from '@zohodesk/components/es/
|
|
7
|
+
import Label from '@zohodesk/components/es/Label/Label';
|
|
9
8
|
import MultiSelect from '@zohodesk/components/es/MultiSelect/MultiSelect';
|
|
10
9
|
import ValidationMessage from "../ValidationMessage/ValidationMessage";
|
|
11
10
|
import { getUniqueId } from '@zohodesk/components/es/Provider/IdProvider';
|
|
@@ -146,11 +145,13 @@ export default class MultiSelectField extends PureComponent {
|
|
|
146
145
|
renderProps: renderLabelProps
|
|
147
146
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
148
147
|
text: labelName,
|
|
149
|
-
|
|
148
|
+
id: id,
|
|
149
|
+
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
150
|
+
palette: isDarkPalette ? 'dark' : isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette // onClick={this.handleLabelClick}
|
|
150
151
|
,
|
|
152
|
+
customClass: `${style.fieldLabel} ${isMandatory ? style.labelMandatory : ''}`,
|
|
153
|
+
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
151
154
|
htmlFor: uniqueId,
|
|
152
|
-
testId: id,
|
|
153
|
-
customId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
154
155
|
...LabelProps
|
|
155
156
|
})), /*#__PURE__*/React.createElement(MultiSelect, {
|
|
156
157
|
options: options,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**** Libraries ****/
|
|
2
2
|
import React, { PureComponent } from 'react';
|
|
3
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
3
4
|
import { defaultProps } from "./props/defaultProps";
|
|
4
5
|
import { propTypes } from "./props/propTypes";
|
|
5
6
|
/**** Components ****/
|
|
@@ -128,14 +129,31 @@ export default class RadioField extends PureComponent {
|
|
|
128
129
|
value,
|
|
129
130
|
disabled = false,
|
|
130
131
|
tooltip,
|
|
131
|
-
infoTooltip
|
|
132
|
+
infoTooltip,
|
|
133
|
+
secondaryText,
|
|
134
|
+
renderRightPlaceholderNode,
|
|
135
|
+
customProps
|
|
132
136
|
} = option;
|
|
133
137
|
let isDisabledState = disabled || isDisabled;
|
|
134
138
|
let isChecked = selectedValue == value;
|
|
139
|
+
const rightPlaceholderNode = !!infoTooltip ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
140
|
+
name: "ZD-GN-info",
|
|
141
|
+
size: "16",
|
|
142
|
+
title: infoTooltip,
|
|
143
|
+
iconClass: style.infoIcon,
|
|
144
|
+
...InfoIconProps
|
|
145
|
+
}), renderRightPlaceholderNode) : renderRightPlaceholderNode;
|
|
146
|
+
const radioBoxClasses = isBoxStyle ? compileClassNames({
|
|
147
|
+
[style.radioBox]: true,
|
|
148
|
+
[style.withSecondaryText]: !!secondaryText,
|
|
149
|
+
[style.primaryTextOnly]: !secondaryText,
|
|
150
|
+
[style.hoverableRadioBox]: !isDisabledState,
|
|
151
|
+
[style.radioBoxActive]: isChecked
|
|
152
|
+
}) : '';
|
|
135
153
|
return /*#__PURE__*/React.createElement("span", {
|
|
136
154
|
key: index,
|
|
137
155
|
className: `${!isBoxStyle ? style.radio : ''} ${style.radioWrap}`
|
|
138
|
-
}, /*#__PURE__*/React.createElement(Radio, {
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Radio, { ...customProps,
|
|
139
157
|
id: index,
|
|
140
158
|
value: value,
|
|
141
159
|
name: id,
|
|
@@ -153,22 +171,23 @@ export default class RadioField extends PureComponent {
|
|
|
153
171
|
dataId: dataId,
|
|
154
172
|
isReadOnly: isReadOnly,
|
|
155
173
|
variant: variant,
|
|
174
|
+
secondaryText: secondaryText,
|
|
156
175
|
...RadioProps,
|
|
157
176
|
a11y: {
|
|
158
177
|
tabIndex: !!selectedValue ? isChecked ? '0' : '-1' : index === 0 ? '0' : '-1',
|
|
159
178
|
...RadioProps.a11y
|
|
160
179
|
},
|
|
161
180
|
customClass: {
|
|
162
|
-
customRadioWrap:
|
|
181
|
+
customRadioWrap: radioBoxClasses,
|
|
163
182
|
...RadioProps.customClass
|
|
183
|
+
},
|
|
184
|
+
customProps: {
|
|
185
|
+
LabelProps: { ...(RadioProps.customProps ? RadioProps.customProps.LabelProps : undefined),
|
|
186
|
+
renderRightPlaceholderNode: rightPlaceholderNode
|
|
187
|
+
},
|
|
188
|
+
...RadioProps.customProps
|
|
164
189
|
}
|
|
165
|
-
}
|
|
166
|
-
name: "ZD-GN-info",
|
|
167
|
-
size: "16",
|
|
168
|
-
title: infoTooltip,
|
|
169
|
-
iconClass: style.infoIcon,
|
|
170
|
-
...InfoIconProps
|
|
171
|
-
}) : null));
|
|
190
|
+
}));
|
|
172
191
|
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
173
192
|
text: validationMessage,
|
|
174
193
|
palette: validationPalette,
|
|
@@ -17,6 +17,22 @@ 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
|
+
}];
|
|
20
36
|
describe('RadioField', () => {
|
|
21
37
|
test('rendering the defult props', () => {
|
|
22
38
|
const {
|
|
@@ -43,4 +59,21 @@ describe('RadioField', () => {
|
|
|
43
59
|
}));
|
|
44
60
|
expect(asFragment()).toMatchSnapshot();
|
|
45
61
|
});
|
|
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
|
+
});
|
|
46
79
|
});
|