@zohodesk/dot 1.0.0-temp-187.17 → 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.
Files changed (28) hide show
  1. package/README.md +4 -0
  2. package/es/form/fields/Fields.module.css +9 -7
  3. package/es/form/fields/RadioField/RadioField.js +29 -10
  4. package/es/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
  5. package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +562 -66
  6. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +6 -10
  7. package/es/form/fields/TagsMultiSelect/props/propTypes.js +1 -2
  8. package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -6
  9. package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
  10. package/es/list/DepartmentDropDown/props/propTypes.js +0 -3
  11. package/es/list/status/StatusDropdown/StatusDropdown.js +2 -7
  12. package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
  13. package/es/list/status/StatusDropdown/props/propTypes.js +1 -4
  14. package/es/list/status/StatusListItem/StatusListItem.module.css +3 -6
  15. package/lib/form/fields/Fields.module.css +9 -7
  16. package/lib/form/fields/RadioField/RadioField.js +26 -11
  17. package/lib/form/fields/RadioField/__tests__/RadioField.spec.js +33 -0
  18. package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +562 -66
  19. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +7 -12
  20. package/lib/form/fields/TagsMultiSelect/props/propTypes.js +1 -2
  21. package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
  22. package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
  23. package/lib/list/DepartmentDropDown/props/propTypes.js +0 -2
  24. package/lib/list/status/StatusDropdown/StatusDropdown.js +2 -6
  25. package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
  26. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -3
  27. package/lib/list/status/StatusListItem/StatusListItem.module.css +3 -6
  28. package/package.json +3 -3
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`
@@ -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)
@@ -221,10 +226,7 @@ position: relative;
221
226
  [dir=rtl] .rightPlaceholder{
222
227
  left:var(--zd_size15)
223
228
  }
229
+
224
230
  .phoneField{
225
231
  composes: ltr-zone from '~@zohodesk/components/es/common/common.module.css';
226
- }
227
-
228
- .lineClampPickListItem{
229
- --line-clamp: var(--picklist-field-line-clamp,3);
230
232
  }
@@ -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: isBoxStyle ? `${style.radioBox} ${!isDisabledState ? style.hoverableRadioBox : ''} ${isChecked ? style.radioBoxActive : ''}` : '',
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
- }, !!infoTooltip ? /*#__PURE__*/React.createElement(Icon, {
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
  });