@zohodesk/components 1.0.0-temp-199.21 → 1.0.0-temp-249

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 (55) hide show
  1. package/README.md +12 -0
  2. package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +6 -0
  3. package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +6 -0
  4. package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +6 -0
  5. package/es/ListItem/ListItem.module.css +18 -17
  6. package/es/ListItem/ListItemWithAvatar.js +2 -4
  7. package/es/ListItem/ListItemWithCheckBox.js +2 -4
  8. package/es/ListItem/ListItemWithIcon.js +2 -4
  9. package/es/ListItem/ListItemWithRadio.js +2 -4
  10. package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -6
  11. package/es/MultiSelect/MultiSelect.js +2 -2
  12. package/es/MultiSelect/Suggestions.js +2 -7
  13. package/es/MultiSelect/props/defaultProps.js +0 -2
  14. package/es/MultiSelect/props/propTypes.js +3 -11
  15. package/es/Provider/LibraryContext.js +11 -3
  16. package/es/Select/GroupSelect.js +1 -1
  17. package/es/Select/SelectWithAvatar.js +3 -3
  18. package/es/Select/SelectWithIcon.js +3 -10
  19. package/es/Select/props/defaultProps.js +2 -4
  20. package/es/Select/props/propTypes.js +3 -11
  21. package/es/common/common.module.css +1 -1
  22. package/es/v1/Label/Label.js +94 -33
  23. package/es/v1/Label/__tests__/Label.spec.js +204 -0
  24. package/es/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +428 -0
  25. package/es/v1/Label/constants/index.js +8 -0
  26. package/es/v1/Label/css/Label_v1.module.css +34 -0
  27. package/es/v1/Label/css/cssJSLogic.js +44 -0
  28. package/es/v1/Label/props/defaultProps.js +14 -9
  29. package/es/v1/Label/props/propTypes.js +34 -14
  30. package/lib/ListItem/ListItem.module.css +18 -17
  31. package/lib/ListItem/ListItemWithAvatar.js +3 -5
  32. package/lib/ListItem/ListItemWithCheckBox.js +2 -4
  33. package/lib/ListItem/ListItemWithIcon.js +3 -5
  34. package/lib/ListItem/ListItemWithRadio.js +2 -4
  35. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -8
  36. package/lib/MultiSelect/MultiSelect.js +2 -2
  37. package/lib/MultiSelect/Suggestions.js +2 -6
  38. package/lib/MultiSelect/props/defaultProps.js +0 -2
  39. package/lib/MultiSelect/props/propTypes.js +5 -13
  40. package/lib/Provider/LibraryContext.js +11 -3
  41. package/lib/Select/GroupSelect.js +1 -2
  42. package/lib/Select/SelectWithAvatar.js +3 -4
  43. package/lib/Select/SelectWithIcon.js +3 -10
  44. package/lib/Select/props/defaultProps.js +3 -5
  45. package/lib/Select/props/propTypes.js +3 -11
  46. package/lib/common/common.module.css +1 -1
  47. package/lib/v1/Label/Label.js +102 -36
  48. package/lib/v1/Label/__tests__/Label.spec.js +211 -0
  49. package/lib/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +428 -0
  50. package/lib/v1/Label/constants/index.js +16 -0
  51. package/lib/v1/Label/css/Label_v1.module.css +34 -0
  52. package/lib/v1/Label/css/cssJSLogic.js +45 -0
  53. package/lib/v1/Label/props/defaultProps.js +16 -11
  54. package/lib/v1/Label/props/propTypes.js +36 -16
  55. package/package.json +7 -7
package/README.md CHANGED
@@ -4,6 +4,18 @@ Dot UI is a customizable React component library built to deliver a clean, acces
4
4
 
5
5
  # 1.5.8
6
6
 
7
+ - **Label Component - v1**
8
+ - The label component of v1 has been updated with accessibility enhancements and few props have been renamed and restructured to align better with accessibility guidelines
9
+ - Mandatory field accessibility has been improved by allowing the mandatory indicator type (asterisk or text) to be handled via user preferences.
10
+ - Explicit boolean props are introduced: isRequired, isDisabled, isReadOnly - These replace earlier state handling that was implicitly managed through the palette prop.
11
+ - Custom Class Structure has been updated to provide separate styling control : Label element, Container wrapper
12
+ - The variant prop has been replaced with textWeight to clearly define typography styling (regular / semibold).
13
+ - The dataId has been replaced with testId, customId
14
+
15
+ - These updates have been applied across all form labels using Label v1
16
+
17
+ # 1.5.8
18
+
7
19
  - Memoized **Portal** logic to improve performance.
8
20
 
9
21
  # 1.5.7
@@ -8,4 +8,10 @@
8
8
  --zdt_v1_switch_onLabel: hsla(217, 23.08%, calc(17.84% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
9
9
  --zdt_v1_switch_offLabel: hsla(217, 13.73%, calc(70.00% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
10
10
  --zdt_v1_switch_offLabel_hover: hsla(210, 7.41%, calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
+
12
+ /* label */
13
+ --zdt_v1_label_text: hsla(210, 7.41%, calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
14
+ --zdt_v1_label_required_text: hsla(0, 100.00%, calc(70.98% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
15
+ --zdt_v1_label_disabled_text: var(--dot_inputDisable);
16
+ --zdt_v1_label_secondary_text: hsla(217, 13.73%, calc(70.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
17
  }
@@ -8,4 +8,10 @@
8
8
  --zdt_v1_switch_onLabel: hsla(0, 0.00%, calc(100.00% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
9
9
  --zdt_v1_switch_offLabel: hsla(220, 10.45%, calc(39.41% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
10
10
  --zdt_v1_switch_offLabel_hover: hsla(0, 0.00%, calc(0.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
+
12
+ /* label */
13
+ --zdt_v1_label_text: hsla(0, 0.00%, calc(0.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
14
+ --zdt_v1_label_required_text: hsla(0, 71.91%, calc(53.92% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
15
+ --zdt_v1_label_disabled_text: var(--dot_inputDisable);
16
+ --zdt_v1_label_secondary_text: hsla(220, 10.45%, calc(39.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
17
  }
@@ -8,4 +8,10 @@
8
8
  --zdt_v1_switch_onLabel: hsla(0, 0.00%, calc(12.94% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
9
9
  --zdt_v1_switch_offLabel: hsla(0, 0.00%, calc(60.00% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
10
10
  --zdt_v1_switch_offLabel_hover: hsla(210, 7.41%, calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
+
12
+ /* label */
13
+ --zdt_v1_label_text: hsla(210, 7.41%, calc(89.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
14
+ --zdt_v1_label_required_text: hsla(0, 100.00%, calc(70.98% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
15
+ --zdt_v1_label_disabled_text: var(--dot_inputDisable);
16
+ --zdt_v1_label_secondary_text: hsla(0, 0.00%, calc(60.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
11
17
  }
@@ -1,4 +1,3 @@
1
- /* css:lineheight-validation:ignore */
2
1
  .varClass {
3
2
  /* listitem default variables */
4
3
  --listitem_font_size: var(--zd_font_size13);
@@ -16,14 +15,9 @@
16
15
 
17
16
  /* listitem tick icon default variables */
18
17
  --listitem_tickicon_color: var(--zdt_listitem_default_tickicon);
19
-
20
- /* multiLine value for list item */
21
- --listitem_multiline_lineheight: 1.5385;
22
- }
23
- [dir=ltr] .varClass {
18
+ }[dir=ltr] .varClass {
24
19
  --listitem_avatar_margin: 0 var(--zd_size15) 0 0;
25
- }
26
- [dir=rtl] .varClass {
20
+ }[dir=rtl] .varClass {
27
21
  --listitem_avatar_margin: 0 0 0 var(--zd_size15);
28
22
  }
29
23
  .list {
@@ -82,9 +76,8 @@
82
76
  [dir=rtl] .beforeChild{
83
77
  margin-left: var(--zd_size10) ;
84
78
  }
85
- /* css:lineheight-validation:ignore */
86
79
  .value, .multiLineValue {
87
- line-height: var(--listitem_multiline_lineheight);
80
+ line-height: 1.5385;
88
81
  }
89
82
  .multiLineValue,.multiLine{
90
83
  composes: lineClamp from '../common/common.module.css';
@@ -122,18 +115,26 @@
122
115
  composes: justifyFend from '../common/common.module.css';
123
116
  }
124
117
 
125
- .contentWrapper {
126
- composes: dflex flexrow alignVertical from '../common/common.module.css';
127
- width: 100% ;
128
- }
129
118
  .lhsBox {
130
119
  composes: dflex from '../common/common.module.css';
131
120
  align-self: stretch;
132
121
  }
133
- .lhsBoxInner{
134
- composes: dflex alignVertical from '../common/common.module.css';
122
+ .lhsBox_small,
123
+ .lhsBox_medium,
124
+ .lhsBox_large{
125
+ composes: varClass;
126
+ --listitem_doubleline_content_height: calc(var(--listitem_font_size) * 2 );
135
127
  height: 100% ;
136
- max-height: calc((var(--listitem_font_size) * var(--listitem_multiline_lineheight)) * 2 );
128
+ composes: dflex alignVertical from '../common/common.module.css';
129
+ }
130
+ .lhsBox_small {
131
+ max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size7)); /* 7px = listitem min-height - (top + bottom padding) - doubleLine content height */
132
+ }
133
+ .lhsBox_medium {
134
+ max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size8)); /* 8px = listitem min-height - (top + bottom padding) - doubleLine content height */
135
+ }
136
+ .lhsBox_large {
137
+ max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size15)); /* 15px = listitem min-height - (top + bottom padding) - doubleLine content height */
137
138
  }
138
139
  .defaultHover, .primaryHover, .dangerHover, .secondaryHover, .darkHover {
139
140
  background-color: var(--listitem_highlight_bg_color);
@@ -124,13 +124,11 @@ export default class ListItemWithAvatar extends React.PureComponent {
124
124
  title: null,
125
125
  customProps: ListItemProps,
126
126
  ...ContainerProps
127
- }, /*#__PURE__*/React.createElement(Box, {
128
- className: style.contentWrapper
129
127
  }, name || imgSrc ? /*#__PURE__*/React.createElement(Box, {
130
128
  className: `${style.leftAvatar} ${lhsAlignContent !== 'center' ? `${style.lhsBox}` : ''}`
131
129
  }, /*#__PURE__*/React.createElement(Box, {
132
130
  align: lhsAlignContent,
133
- className: style.lhsBoxInner
131
+ className: style[`lhsBox_${size}`]
134
132
  }, isTeam ? /*#__PURE__*/React.createElement(AvatarTeam, {
135
133
  name: name,
136
134
  size: "small",
@@ -176,7 +174,7 @@ export default class ListItemWithAvatar extends React.PureComponent {
176
174
  }, /*#__PURE__*/React.createElement(Icon, {
177
175
  name: "ZD-ticknew",
178
176
  size: "8"
179
- })) : null));
177
+ })) : null);
180
178
  }
181
179
 
182
180
  }
@@ -100,14 +100,12 @@ export default class ListItemWithCheckBox extends React.Component {
100
100
  title: null,
101
101
  customProps: ListItemProps,
102
102
  ...ContainerProps
103
- }, /*#__PURE__*/React.createElement(Box, {
104
- className: style.contentWrapper
105
103
  }, /*#__PURE__*/React.createElement(Box, {
106
104
  className: `${style.iconBox} ${style.lhsBox} ${style[`lhsJustifyContent_${lhsJustifyContent}`]}`,
107
105
  dataId: `${dataId ? dataId : value}_checkBox`
108
106
  }, /*#__PURE__*/React.createElement(Box, {
109
107
  align: lhsAlignContent,
110
- className: lhsAlignContent !== 'center' ? style.lhsBoxInner : ''
108
+ className: lhsAlignContent !== 'center' ? style[`lhsBox_${size}`] : ''
111
109
  }, /*#__PURE__*/React.createElement(CheckBox, {
112
110
  checked: checked,
113
111
  a11y: {
@@ -132,7 +130,7 @@ export default class ListItemWithCheckBox extends React.Component {
132
130
  }, renderNode(renderValueRightPlaceholderNode)) : null), secondaryValue ? /*#__PURE__*/React.createElement(Box, {
133
131
  "data-title": isDisabled ? null : secondaryValue,
134
132
  className: `${style.secondaryField} ${needMultiLineText ? style.multiLine : style.secondaryValue}`
135
- }, secondaryValue) : null)));
133
+ }, secondaryValue) : null));
136
134
  }
137
135
 
138
136
  }
@@ -116,8 +116,6 @@ export default class ListItemWithIcon extends React.Component {
116
116
  title: null,
117
117
  customProps: ListItemProps,
118
118
  ...ContainerProps
119
- }, /*#__PURE__*/React.createElement(Box, {
120
- className: style.contentWrapper
121
119
  }, iconName && /*#__PURE__*/React.createElement(Box, {
122
120
  "aria-hidden": true,
123
121
  align: lhsAlignContent,
@@ -125,7 +123,7 @@ export default class ListItemWithIcon extends React.Component {
125
123
  dataId: dataId ? `${dataId}_Icon` : `${value.toLowerCase().replace("'", '_')}_Icon`
126
124
  }, /*#__PURE__*/React.createElement(Box, {
127
125
  align: lhsAlignContent,
128
- className: lhsAlignContent !== 'center' ? style.lhsBoxInner : ''
126
+ className: lhsAlignContent !== 'center' ? style[`lhsBox_${size}`] : ''
129
127
  }, /*#__PURE__*/React.createElement(Icon, {
130
128
  iconClass: iconClass,
131
129
  name: iconName,
@@ -156,7 +154,7 @@ export default class ListItemWithIcon extends React.Component {
156
154
  }, /*#__PURE__*/React.createElement(Icon, {
157
155
  name: "ZD-ticknew",
158
156
  size: "8"
159
- })) : null));
157
+ })) : null);
160
158
  }
161
159
 
162
160
  }
@@ -101,15 +101,13 @@ export default class ListItemWithRadio extends React.Component {
101
101
  title: null,
102
102
  customProps: ListItemProps,
103
103
  ...ContainerProps
104
- }, /*#__PURE__*/React.createElement(Box, {
105
- className: style.contentWrapper
106
104
  }, /*#__PURE__*/React.createElement(Box, {
107
105
  align: lhsAlignContent,
108
106
  className: `${style.iconBox} ${style.lhsBox} ${style[`lhsJustifyContent_${lhsJustifyContent}`]}`,
109
107
  dataId: `${dataId}_radio`
110
108
  }, /*#__PURE__*/React.createElement(Box, {
111
109
  align: lhsAlignContent,
112
- className: lhsAlignContent !== 'center' ? style.lhsBoxInner : ''
110
+ className: lhsAlignContent !== 'center' ? style[`lhsBox_${size}`] : ''
113
111
  }, /*#__PURE__*/React.createElement(Radio, {
114
112
  checked: checked,
115
113
  id: id,
@@ -135,7 +133,7 @@ export default class ListItemWithRadio extends React.Component {
135
133
  }, renderNode(renderValueRightPlaceholderNode)) : null), secondaryValue ? /*#__PURE__*/React.createElement(Box, {
136
134
  "data-title": isDisabled ? null : secondaryValue,
137
135
  className: `${style.secondaryField} ${needMultiLineText ? style.multiLine : style.secondaryValue}`
138
- }, secondaryValue) : null)));
136
+ }, secondaryValue) : null));
139
137
  }
140
138
 
141
139
  }
@@ -889,12 +889,8 @@ class AdvancedGroupMultiSelect extends React.Component {
889
889
  autoComplete,
890
890
  getTargetRef,
891
891
  isFocus,
892
- limit,
893
- customProps
892
+ limit
894
893
  } = this.props;
895
- const {
896
- SuggestionsProps = {}
897
- } = customProps;
898
894
  let {
899
895
  clearText = MULTISELECT_I18N_KEYS.clearText,
900
896
  limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
@@ -1063,7 +1059,7 @@ class AdvancedGroupMultiSelect extends React.Component {
1063
1059
  a11y: {
1064
1060
  role: 'heading'
1065
1061
  }
1066
- })), /*#__PURE__*/React.createElement(Suggestions, { ...SuggestionsProps,
1062
+ })), /*#__PURE__*/React.createElement(Suggestions, {
1067
1063
  suggestions: suggestions,
1068
1064
  selectedOptions: selectedOptionIds,
1069
1065
  getRef: this.suggestionItemRef,
@@ -1095,9 +1095,9 @@ export class MultiSelectComponent extends React.Component {
1095
1095
  isLoading,
1096
1096
  selectAllText,
1097
1097
  needSelectAll,
1098
+ customProps,
1098
1099
  isVirtualizerEnabled,
1099
- limit,
1100
- customProps
1100
+ limit
1101
1101
  } = this.props;
1102
1102
  const {
1103
1103
  selectedOptions,
@@ -193,23 +193,18 @@ export default class Suggestions extends React.PureComponent {
193
193
  htmlId,
194
194
  a11y,
195
195
  getVirtualizerPublicMethods,
196
- setVirtualizerContainerRefFunction,
197
- customClass
196
+ setVirtualizerContainerRefFunction
198
197
  } = this.props;
199
198
  const {
200
199
  ariaParentRole,
201
200
  ariaMultiselectable
202
201
  } = a11y;
203
- const {
204
- containerClass = ''
205
- } = customClass;
206
202
  return /*#__PURE__*/React.createElement(Container, {
207
203
  isCover: false,
208
204
  role: ariaParentRole,
209
205
  id: htmlId,
210
206
  tabindex: "0",
211
- "aria-multiselectable": ariaMultiselectable,
212
- className: containerClass
207
+ "aria-multiselectable": ariaMultiselectable
213
208
  }, /*#__PURE__*/React.createElement(Box, {
214
209
  dataId: `${dataId}`,
215
210
  className: className ? className : ''
@@ -38,7 +38,6 @@ export const AdvancedGroupMultiSelect_defaultProps = {
38
38
  palette: 'default',
39
39
  isLoading: false,
40
40
  dataSelectorId: 'advancedGroupMultiSelect',
41
- customProps: {},
42
41
  allowValueFallback: true
43
42
  };
44
43
  export const AdvancedMultiSelect_defaultProps = {
@@ -170,6 +169,5 @@ export const SelectedOptions_defaultProps = {
170
169
  export const Suggestions_defaultProps = {
171
170
  a11y: {},
172
171
  isVirtualizerEnabled: false,
173
- customClass: {},
174
172
  needMultiLineText: false
175
173
  };
@@ -114,8 +114,7 @@ export const MultiSelect_propTypes = {
114
114
  setAriaId: PropTypes.string,
115
115
  ariaErrorId: PropTypes.string,
116
116
  customProps: PropTypes.shape({
117
- TextBoxIconProps: PropTypes.object,
118
- SuggestionsProps: PropTypes.object
117
+ TextBoxIconProps: PropTypes.object
119
118
  }),
120
119
  isFocus: PropTypes.bool,
121
120
  allowValueFallback: PropTypes.bool,
@@ -200,11 +199,7 @@ export const Suggestions_propTypes = {
200
199
  })),
201
200
  renderBeforeChildren: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
202
201
  limit: PropTypes.number,
203
- limitReachedMessage: PropTypes.string,
204
- customClass: PropTypes.shape({
205
- containerClass: PropTypes.string
206
- }),
207
- needMultiLineText: PropTypes.bool
202
+ limitReachedMessage: PropTypes.string
208
203
  };
209
204
  export const AdvancedGroupMultiSelect_propTypes = {
210
205
  animationStyle: PropTypes.string,
@@ -278,10 +273,7 @@ export const AdvancedGroupMultiSelect_propTypes = {
278
273
  dataSelectorId: PropTypes.string,
279
274
  isFocus: PropTypes.bool,
280
275
  allowValueFallback: PropTypes.bool,
281
- limit: PropTypes.number,
282
- customProps: PropTypes.shape({
283
- SuggestionsProps: PropTypes.object
284
- })
276
+ limit: PropTypes.number
285
277
  };
286
278
  export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
287
279
  selectedOptionDetails: PropTypes.string,
@@ -11,6 +11,8 @@ const LibraryContextProvider = _ref => {
11
11
  hasTagColorInheritedToText,
12
12
  shouldIndicateSwitchState,
13
13
  shouldStrikeThroughDisabledButton,
14
+ labelRequiredType,
15
+ shouldHighlightRequiredLabel,
14
16
  children
15
17
  } = _ref;
16
18
  const [value, setValue] = useState({
@@ -19,7 +21,9 @@ const LibraryContextProvider = _ref => {
19
21
  coloredTagVariant,
20
22
  hasTagColorInheritedToText,
21
23
  shouldIndicateSwitchState,
22
- shouldStrikeThroughDisabledButton
24
+ shouldStrikeThroughDisabledButton,
25
+ labelRequiredType,
26
+ shouldHighlightRequiredLabel
23
27
  });
24
28
 
25
29
  function setGlobalContext(key, data) {
@@ -44,7 +48,9 @@ LibraryContextProvider.propTypes = {
44
48
  hasTagColorInheritedToText: PropTypes.bool,
45
49
  direction: PropTypes.string,
46
50
  shouldIndicateSwitchState: PropTypes.bool,
47
- shouldStrikeThroughDisabledButton: PropTypes.bool
51
+ shouldStrikeThroughDisabledButton: PropTypes.bool,
52
+ labelRequiredType: PropTypes.oneOf(['asterisk', 'text']),
53
+ shouldHighlightRequiredLabel: PropTypes.bool
48
54
  };
49
55
  LibraryContextProvider.defaultProps = {
50
56
  isReducedMotion: getLibraryConfig('isReducedMotion'),
@@ -52,6 +58,8 @@ LibraryContextProvider.defaultProps = {
52
58
  coloredTagVariant: 'bold',
53
59
  hasTagColorInheritedToText: true,
54
60
  shouldIndicateSwitchState: false,
55
- shouldStrikeThroughDisabledButton: false
61
+ shouldStrikeThroughDisabledButton: false,
62
+ labelRequiredType: 'asterisk',
63
+ shouldHighlightRequiredLabel: true
56
64
  };
57
65
  export default LibraryContextProvider;
@@ -623,7 +623,7 @@ export class GroupSelectComponent extends PureComponent {
623
623
  let {
624
624
  TextBoxIconProps = {},
625
625
  TextBoxProps = {},
626
- SuggestionsProps = {}
626
+ SuggestionsProps
627
627
  } = customProps;
628
628
  return /*#__PURE__*/React.createElement("div", {
629
629
  className: `${style.container} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${iconOnHover && (isReadOnly || isDisabled) ? style.iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? style.iconOnHoverStyle : ''}`,
@@ -169,8 +169,8 @@ class SelectWithAvatarComponent extends SelectComponent {
169
169
  needEffect,
170
170
  isLoading,
171
171
  dataSelectorId,
172
- getTargetRef,
173
- customProps
172
+ customProps,
173
+ getTargetRef
174
174
  } = this.props;
175
175
  i18nKeys = Object.assign({}, i18nKeys, {
176
176
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -195,7 +195,7 @@ class SelectWithAvatarComponent extends SelectComponent {
195
195
  let {
196
196
  TextBoxProps,
197
197
  DropdownSearchTextBoxProps,
198
- SuggestionsProps = {}
198
+ SuggestionsProps
199
199
  } = customProps;
200
200
  return /*#__PURE__*/React.createElement("div", {
201
201
  className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''} ${className ? className : ''}`,
@@ -357,8 +357,7 @@ class SelectWithIcon extends Component {
357
357
  htmlId,
358
358
  isLoading,
359
359
  dataSelectorId,
360
- customProps,
361
- customClass
360
+ customProps
362
361
  } = this.props;
363
362
  i18nKeys = Object.assign({}, i18nKeys, {
364
363
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -376,11 +375,8 @@ class SelectWithIcon extends Component {
376
375
  TextBoxProps = {},
377
376
  DropdownSearchTextBoxProps = {},
378
377
  TextBoxIconProps = {},
379
- ListItemProps = {}
378
+ ListItemProps
380
379
  } = customProps;
381
- const {
382
- dropBoxClass = ''
383
- } = customClass;
384
380
  return /*#__PURE__*/React.createElement("div", {
385
381
  className: `${style.container} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''}`,
386
382
  "data-title": isDisabled ? title : null,
@@ -477,10 +473,7 @@ class SelectWithIcon extends Component {
477
473
  size: boxSize,
478
474
  isPadding: false,
479
475
  isResponsivePadding: true,
480
- alignBox: "row",
481
- customClass: {
482
- customDropBox: dropBoxClass
483
- }
476
+ alignBox: "row"
484
477
  }, isLoading ? /*#__PURE__*/React.createElement(Container, {
485
478
  align: "both",
486
479
  className: style.loader
@@ -102,8 +102,7 @@ export const SelectWithAvatar_defaultProps = {
102
102
  i18nKeys: {},
103
103
  customProps: {},
104
104
  needEffect: true,
105
- isLoading: false,
106
- customProps: {}
105
+ isLoading: false
107
106
  };
108
107
  export const SelectWithIcon_defaultProps = {
109
108
  isReadOnly: false,
@@ -132,6 +131,5 @@ export const SelectWithIcon_defaultProps = {
132
131
  isLoading: false,
133
132
  isAbsolutePositioningNeeded: true,
134
133
  isRestrictScroll: false,
135
- customProps: {},
136
- customClass: {}
134
+ customProps: {}
137
135
  };
@@ -186,8 +186,7 @@ export const GroupSelect_propTypes = {
186
186
  isDefaultSelectValue: PropTypes.bool,
187
187
  customProps: PropTypes.shape({
188
188
  TextBoxProps: PropTypes.object,
189
- TextBoxIconProps: PropTypes.object,
190
- SuggestionsProps: PropTypes.object
189
+ TextBoxIconProps: PropTypes.object
191
190
  }),
192
191
  allowValueFallback: PropTypes.bool
193
192
  };
@@ -250,10 +249,7 @@ export const SelectWithAvatar_propTypes = { ...Select_propTypes,
250
249
  htmlId: PropTypes.string,
251
250
  needEffect: PropTypes.bool,
252
251
  isLoading: PropTypes.bool,
253
- dataSelectorId: PropTypes.string,
254
- customProps: PropTypes.shape({
255
- SuggestionsProps: PropTypes.object
256
- })
252
+ dataSelectorId: PropTypes.string
257
253
  };
258
254
  export const SelectWithIcon_propTypes = {
259
255
  animationStyle: PropTypes.oneOf(['default', 'bounce']),
@@ -318,10 +314,6 @@ export const SelectWithIcon_propTypes = {
318
314
  TextBoxProps: PropTypes.object,
319
315
  DropdownSearchTextBoxProps: PropTypes.object,
320
316
  SuggestionsProps: PropTypes.object,
321
- TextBoxIconProps: PropTypes.object,
322
- ListItemProps: PropTypes.object
323
- }),
324
- customClass: PropTypes.shape({
325
- dropBoxClass: PropTypes.string
317
+ TextBoxIconProps: PropTypes.object
326
318
  })
327
319
  };
@@ -501,7 +501,7 @@
501
501
  }
502
502
  .lineClamp {
503
503
  composes: wbreak clamp;
504
- -webkit-line-clamp: var(--line-clamp, 3);
504
+ -webkit-line-clamp: var(--line-clamp,2);
505
505
  }
506
506
 
507
507
  .offSelection {
@@ -1,40 +1,101 @@
1
- import React from 'react';
2
- import { defaultProps } from "./props/defaultProps";
3
- import { propTypes } from "./props/propTypes";
4
- import style from "../../Label/Label.module.css";
5
- import colors from "../../Label/LabelColors.module.css";
6
- export default function Label(props) {
1
+ import React from 'react'; // props
2
+
3
+ import defaultProps from "./props/defaultProps";
4
+ import propTypes from "./props/propTypes"; // methods
5
+
6
+ import cssJSLogic from "./css/cssJSLogic";
7
+ import { renderNode, isRenderable } from '@zohodesk/utils'; // hoc
8
+
9
+ import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry'; // constants
10
+
11
+ import { DISPLAY_MODE, FONT_SIZE } from "./constants"; // components
12
+
13
+ import Flex from '@zohodesk/layout/es/Flex/Flex';
14
+ import Typography from "../../Typography/Typography"; // css
15
+
16
+ import style from "./css/Label_v1.module.css";
17
+
18
+ const Label = props => {
7
19
  const {
8
- text,
9
- type,
10
- palette,
11
- size,
12
- clipped,
13
20
  htmlFor,
14
- title,
15
21
  onClick,
16
- dataId,
17
- dataSelectorId,
18
- variant,
19
- customClass,
20
- id,
21
- a11y = {}
22
+ text,
23
+ customId,
24
+ testId,
25
+ tagAttributes,
26
+ a11yAttributes,
27
+ customProps,
28
+ isRequired,
29
+ requiredType,
30
+ isClipped,
31
+ size,
32
+ textWeight,
33
+ layout,
34
+ renderRightPlaceholderNode,
35
+ renderLeftPlaceholderNode,
36
+ i18nKeys
22
37
  } = props;
23
38
  const {
24
- tabIndex
25
- } = a11y;
26
- return /*#__PURE__*/React.createElement("label", {
27
- className: `${style.label} ${style[type]} ${style[size]} ${colors[palette]} ${style[`font_${variant}`]}
28
- ${clipped ? style.dotted : ''} ${onClick ? style.pointer : style.cursor} ${customClass} `,
29
- htmlFor: htmlFor,
30
- "data-title": title,
31
- "data-id": dataId,
32
- "data-test-id": dataId,
33
- "data-selector-id": dataSelectorId,
34
- onClick: onClick,
35
- id: id,
36
- tabIndex: tabIndex
37
- }, text);
38
- }
39
+ container: tagAttributes_container,
40
+ label: tagAttributes_label
41
+ } = tagAttributes;
42
+ const {
43
+ container: a11yAttributes_container,
44
+ label: a11yAttributes_label
45
+ } = a11yAttributes;
46
+ const {
47
+ container: customProps_container,
48
+ label: customProps_label
49
+ } = customProps;
50
+ const {
51
+ requiredText: i18n_requiredText = 'Required'
52
+ } = i18nKeys;
53
+ const {
54
+ labelClass,
55
+ requiredClass,
56
+ containerClass
57
+ } = cssJSLogic({ ...props,
58
+ style
59
+ });
60
+ const a11yAttributes_requiredText = {
61
+ 'aria-hidden': 'true'
62
+ };
63
+
64
+ const renderRequired = () => /*#__PURE__*/React.createElement(Typography, {
65
+ $ui_tagName: "span",
66
+ $ui_className: requiredClass,
67
+ $a11yAttributes_text: a11yAttributes_requiredText,
68
+ $ui_size: FONT_SIZE[size],
69
+ $ui_weight: textWeight
70
+ }, requiredType === 'text' ? `(${i18n_requiredText})` : '*');
71
+
72
+ return /*#__PURE__*/React.createElement(Flex, { ...customProps_container,
73
+ $tagAttributes_container: { ...tagAttributes_container,
74
+ 'data-selector-id': customId
75
+ },
76
+ $ui_displayMode: DISPLAY_MODE[layout],
77
+ $ui_alignItems: "center",
78
+ $a11yAttributes_container: a11yAttributes_container,
79
+ testId: testId,
80
+ customId: customId,
81
+ $ui_className: containerClass
82
+ }, renderNode(renderLeftPlaceholderNode), /*#__PURE__*/React.createElement(Typography, { ...customProps_label,
83
+ $tagAttributes_text: { ...tagAttributes_label,
84
+ htmlFor,
85
+ onClick
86
+ },
87
+ $ui_tagName: "label",
88
+ $ui_className: labelClass,
89
+ $i18n_dataTitle: text,
90
+ $a11yAttributes_text: a11yAttributes_label,
91
+ $ui_size: FONT_SIZE[size],
92
+ $ui_weight: textWeight,
93
+ $flag_dotted: isClipped
94
+ }, text, isRequired && isClipped ? renderRequired() : null), isRequired ? isClipped && renderRequired() : null, renderNode(renderRightPlaceholderNode));
95
+ };
96
+
97
+ export default withComponentRegistrar(Label, {
98
+ name: 'ZDC_V1_Label'
99
+ });
39
100
  Label.defaultProps = defaultProps;
40
101
  Label.propTypes = propTypes;