@zohodesk/components 1.2.52 → 1.2.53

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 (48) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +12 -0
  3. package/es/CheckBox/CheckBox.js +6 -5
  4. package/es/CheckBox/CheckBox.module.css +5 -2
  5. package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
  6. package/es/DateTime/DateTime.js +8 -4
  7. package/es/DateTime/DateWidget.js +8 -1
  8. package/es/DateTime/props/propTypes.js +5 -0
  9. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
  10. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
  11. package/es/MultiSelect/AdvancedGroupMultiSelect.js +4 -2
  12. package/es/MultiSelect/AdvancedMultiSelect.js +4 -2
  13. package/es/MultiSelect/MultiSelect.js +4 -2
  14. package/es/MultiSelect/props/propTypes.js +6 -3
  15. package/es/Radio/Radio.js +9 -7
  16. package/es/Radio/Radio.module.css +1 -1
  17. package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
  18. package/es/Select/GroupSelect.js +10 -3
  19. package/es/Select/props/defaultProps.js +2 -1
  20. package/es/Select/props/propTypes.js +5 -1
  21. package/es/Textarea/Textarea.js +4 -2
  22. package/es/Textarea/Textarea.module.css +1 -1
  23. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
  24. package/es/Textarea/props/propTypes.js +2 -1
  25. package/lib/CheckBox/CheckBox.js +5 -4
  26. package/lib/CheckBox/CheckBox.module.css +5 -2
  27. package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
  28. package/lib/DateTime/DateTime.js +11 -5
  29. package/lib/DateTime/DateWidget.js +8 -1
  30. package/lib/DateTime/props/propTypes.js +5 -0
  31. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
  32. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
  33. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +4 -2
  34. package/lib/MultiSelect/AdvancedMultiSelect.js +4 -2
  35. package/lib/MultiSelect/MultiSelect.js +4 -2
  36. package/lib/MultiSelect/props/propTypes.js +8 -6
  37. package/lib/Radio/Radio.js +10 -7
  38. package/lib/Radio/Radio.module.css +1 -1
  39. package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
  40. package/lib/Select/GroupSelect.js +12 -5
  41. package/lib/Select/props/defaultProps.js +2 -1
  42. package/lib/Select/props/propTypes.js +5 -1
  43. package/lib/Textarea/Textarea.js +4 -2
  44. package/lib/Textarea/Textarea.module.css +1 -1
  45. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
  46. package/lib/Textarea/props/propTypes.js +2 -1
  47. package/package.json +3 -3
  48. package/result.json +1 -1
@@ -128,7 +128,8 @@ class DateWidgetComponent extends React.Component {
128
128
  dateFormat = '',
129
129
  is24Hour,
130
130
  isHideCurrentYear,
131
- getPopupProps
131
+ getPopupProps,
132
+ onDropboxClose
132
133
  } = this.props;
133
134
 
134
135
  if (validation && validation.validate) {
@@ -162,6 +163,8 @@ class DateWidgetComponent extends React.Component {
162
163
  if (prevProps.isPopupReady !== isPopupReady) {
163
164
  if (isPopupReady) {
164
165
  this.resetLocalDate && this.resetLocalDate();
166
+ } else {
167
+ typeof onDropboxClose === 'function' && onDropboxClose();
165
168
  }
166
169
 
167
170
  if (getPopupProps) {
@@ -1004,6 +1007,8 @@ class DateWidgetComponent extends React.Component {
1004
1007
  a11y,
1005
1008
  boxSize,
1006
1009
  onError,
1010
+ renderCustomHeader,
1011
+ renderCustomFooter,
1007
1012
  weekStartDay,
1008
1013
  holidays,
1009
1014
  customProps = {}
@@ -1108,6 +1113,8 @@ class DateWidgetComponent extends React.Component {
1108
1113
  dropBoxPortalId: dropBoxPortalId,
1109
1114
  boxSize: boxSize,
1110
1115
  onError: onError,
1116
+ renderCustomHeader: renderCustomHeader,
1117
+ renderCustomFooter: renderCustomFooter,
1111
1118
  customProps: DateTimeProps,
1112
1119
  weekStartDay: weekStartDay,
1113
1120
  holidays: holidays
@@ -75,6 +75,8 @@ export const DateTime_propTypes = {
75
75
  targetOffset: PropTypes.string,
76
76
  isRestrictScroll: PropTypes.bool,
77
77
  dropBoxPortalId: PropTypes.string,
78
+ renderCustomHeader: PropTypes.node,
79
+ renderCustomFooter: PropTypes.node,
78
80
  customProps: PropTypes.object,
79
81
  weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
80
82
  holidays: PropTypes.arrayOf(PropTypes.number)
@@ -146,6 +148,9 @@ export const DateWidget_propTypes = {
146
148
  dropBoxPortalId: PropTypes.string,
147
149
  a11y: PropTypes.object,
148
150
  getPopupProps: PropTypes.func,
151
+ renderCustomHeader: PropTypes.node,
152
+ renderCustomFooter: PropTypes.node,
153
+ onDropboxClose: PropTypes.func,
149
154
  customProps: PropTypes.object,
150
155
  weekStartDay: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
151
156
  holidays: PropTypes.arrayOf(PropTypes.number)
@@ -21,7 +21,7 @@ exports[`ListItemWithCheckBox rendering the defult props 1`] = `
21
21
  aria-checked="false"
22
22
  aria-hidden="true"
23
23
  class="container pointer primary
24
- inflex rowdir vCenter"
24
+ inflex rowdir vCenter"
25
25
  data-id="checkBox"
26
26
  data-selector-id="container"
27
27
  data-test-id="checkBox"
@@ -29,7 +29,7 @@ exports[`ListItemWithCheckBox rendering the defult props 1`] = `
29
29
  tabindex="-1"
30
30
  >
31
31
  <div
32
- class="boxContainer medium filled shrinkOff"
32
+ class="boxContainer medium filled shrinkOff"
33
33
  data-id="boxComponent"
34
34
  data-selector-id="box"
35
35
  data-test-id="boxComponent"
@@ -30,7 +30,7 @@ exports[`ListItemWithRadio rendering the defult props 1`] = `
30
30
  >
31
31
  <div
32
32
  class="radio
33
- hoverprimary medium filled centerPathprimary shrinkOff"
33
+ hoverprimary medium filled centerPathprimary shrinkOff"
34
34
  data-id="boxComponent"
35
35
  data-selector-id="box"
36
36
  data-test-id="boxComponent"
@@ -875,7 +875,8 @@ class AdvancedGroupMultiSelect extends React.Component {
875
875
  palette,
876
876
  needEffect,
877
877
  autoComplete,
878
- getTargetRef
878
+ getTargetRef,
879
+ isFocus
879
880
  } = this.props;
880
881
  let {
881
882
  clearText = 'Clear all'
@@ -904,6 +905,7 @@ class AdvancedGroupMultiSelect extends React.Component {
904
905
  let setAriaId = this.getNextAriaId();
905
906
  let ariaErrorId = this.getNextAriaId();
906
907
  const isShowClearIcon = !isReadOnly && !isDisabled && selectedGroupOptions.length > 1;
908
+ const isEditable = !(isReadOnly || isDisabled);
907
909
  return /*#__PURE__*/React.createElement("div", {
908
910
  className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
909
911
  "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
@@ -920,7 +922,7 @@ class AdvancedGroupMultiSelect extends React.Component {
920
922
  }, children) : /*#__PURE__*/React.createElement(Container, {
921
923
  align: "vertical",
922
924
  alignBox: "row",
923
- className: `${style.container} ${style[size]} ${isActive && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${style[`borderColor_${borderColor}`]} ${customClass}`,
925
+ className: `${style.container} ${style[size]} ${isActive && needBorder || isEditable && isFocus && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${style[`borderColor_${borderColor}`]} ${customClass}`,
924
926
  eleRef: this.selectedOptionContainerRef,
925
927
  wrap: "wrap"
926
928
  }, /*#__PURE__*/React.createElement(SelectedOptions, {
@@ -372,7 +372,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
372
372
  isAbsolutePositioningNeeded,
373
373
  positionsOffset,
374
374
  targetOffset,
375
- isRestrictScroll
375
+ isRestrictScroll,
376
+ isFocus
376
377
  } = this.props;
377
378
  let {
378
379
  SuggestionsProps = {},
@@ -414,6 +415,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
414
415
  disabledOptions
415
416
  });
416
417
  let isShowClearIcon = !isReadOnly && !isDisabled && isShowClear;
418
+ const isEditable = !(isReadOnly || isDisabled);
417
419
  return /*#__PURE__*/React.createElement("div", {
418
420
  className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''} ${containerClass}`,
419
421
  "data-id": dataIdMultiSelectComp,
@@ -424,7 +426,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
424
426
  }, /*#__PURE__*/React.createElement(Container, {
425
427
  align: "vertical",
426
428
  alignBox: "row",
427
- className: `${style.container} ${style[size]} ${isActive && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${needBorder ? !isDisabled ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''}`,
429
+ className: `${style.container} ${style[size]} ${isActive && needBorder || isEditable && isFocus && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${needBorder ? !isDisabled ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''}`,
428
430
  eleRef: this.selectedOptionContainerRef,
429
431
  wrap: "wrap"
430
432
  }, /*#__PURE__*/React.createElement(SelectedOptions, {
@@ -877,7 +877,8 @@ export class MultiSelectComponent extends React.Component {
877
877
  setAriaId,
878
878
  isPopupOpen,
879
879
  ariaErrorId,
880
- customProps
880
+ customProps,
881
+ isFocus
881
882
  } = this.props;
882
883
  let {
883
884
  isActive,
@@ -899,13 +900,14 @@ export class MultiSelectComponent extends React.Component {
899
900
  disabledOptions
900
901
  });
901
902
  const isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
903
+ const isEditable = !(isReadOnly || isDisabled || disableAction);
902
904
  let {
903
905
  TextBoxIconProps = {}
904
906
  } = customProps;
905
907
  return /*#__PURE__*/React.createElement(Container, {
906
908
  align: "vertical",
907
909
  alignBox: "row",
908
- className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
910
+ className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive || isEditable && isFocus && needBorder ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
909
911
  eleRef: this.selectedOptionContainerRef,
910
912
  wrap: "wrap"
911
913
  }, /*#__PURE__*/React.createElement(SelectedOptions, {
@@ -111,7 +111,8 @@ export const MultiSelect_propTypes = {
111
111
  ariaErrorId: PropTypes.string,
112
112
  customProps: PropTypes.shape({
113
113
  TextBoxIconProps: PropTypes.object
114
- })
114
+ }),
115
+ isFocus: PropTypes.bool
115
116
  };
116
117
  export const MultiSelectHeader_propTypes = {
117
118
  dataId: PropTypes.string,
@@ -246,7 +247,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
246
247
  needToCloseOnSelect: PropTypes.func,
247
248
  searchStr: PropTypes.string,
248
249
  children: PropTypes.node,
249
- dataSelectorId: PropTypes.string
250
+ dataSelectorId: PropTypes.string,
251
+ isFocus: PropTypes.bool
250
252
  };
251
253
  export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
252
254
  selectedOptionDetails: PropTypes.string,
@@ -321,5 +323,6 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
321
323
  }),
322
324
  isLoading: PropTypes.bool,
323
325
  dataSelectorId: PropTypes.string,
324
- customClass: PropTypes.object
326
+ customClass: PropTypes.object,
327
+ isFocus: PropTypes.bool
325
328
  };
package/es/Radio/Radio.js CHANGED
@@ -4,6 +4,7 @@ import { defaultProps } from "./props/defaultProps";
4
4
  import { propTypes } from "./props/propTypes";
5
5
  import Label from "../Label/Label";
6
6
  import { Container, Box } from "../Layout";
7
+ import CssProvider from "../Provider/CssProvider";
7
8
  import style from "./Radio.module.css";
8
9
  export default class Radio extends React.Component {
9
10
  constructor(props) {
@@ -57,8 +58,9 @@ export default class Radio extends React.Component {
57
58
  customRadio = '',
58
59
  customLabel = ''
59
60
  } = customClass;
60
- let accessMode = isReadOnly ? style.readonly : disabled ? style.disabled : style.pointer;
61
+ let accessMode = isReadOnly ? style.readonly : disabled ? CssProvider('isDisabled') : style.pointer;
61
62
  let toolTip = disabled ? disabledTitle : title ? title : null;
63
+ const isEditable = !(isReadOnly || disabled);
62
64
  let {
63
65
  ariaHidden,
64
66
  role = 'radio',
@@ -66,7 +68,7 @@ export default class Radio extends React.Component {
66
68
  ariaChecked = checked,
67
69
  ariaLabel,
68
70
  ariaLabelledby,
69
- ariaReadonly = isReadOnly || disabled ? true : false
71
+ ariaReadonly = !isEditable ? true : false
70
72
  } = a11y;
71
73
  let {
72
74
  ContainerProps = {},
@@ -78,11 +80,11 @@ export default class Radio extends React.Component {
78
80
  isInline: text ? false : true,
79
81
  alignBox: "row",
80
82
  align: "both",
81
- className: `${style.container} ${active && !disabled ? style.active : ''} ${accessMode} ${isReadOnly || disabled ? '' : style.hoverEfffect} ${checked ? style.checked : ''} ${customRadioWrap}`,
83
+ className: `${style.container} ${active && !disabled ? style.active : ''} ${accessMode} ${!isEditable ? '' : style.hoverEfffect} ${checked ? style.checked : ''} ${customRadioWrap}`,
82
84
  "data-title": toolTip,
83
85
  onClick: !isReadOnly && !disabled ? this.onChange : '',
84
86
  "aria-checked": ariaChecked,
85
- tabindex: isReadOnly || disabled || ariaHidden ? '-1' : tabIndex || '0',
87
+ tabindex: !isEditable || ariaHidden ? '-1' : tabIndex || '0',
86
88
  eleRef: this.handleGetRef,
87
89
  role: role,
88
90
  "aria-Hidden": ariaHidden,
@@ -92,7 +94,7 @@ export default class Radio extends React.Component {
92
94
  ...ContainerProps
93
95
  }, /*#__PURE__*/React.createElement(Box, {
94
96
  className: `${style.radio} ${checked ? `${style[`rdBox${palette}`]}` : ''}
95
- ${isReadOnly || disabled ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio}`
97
+ ${!isEditable ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio} ${!isEditable ? `${style.disabled}` : ''}`
96
98
  }, /*#__PURE__*/React.createElement("input", {
97
99
  type: "hidden",
98
100
  id: id,
@@ -115,7 +117,7 @@ export default class Radio extends React.Component {
115
117
  className: `${style.centerPath}`
116
118
  }) : null))), text && /*#__PURE__*/React.createElement(Box, {
117
119
  flexible: true,
118
- className: style.text
120
+ className: `${style.text} ${disabled ? `${style.disabled}` : ''}`
119
121
  }, /*#__PURE__*/React.createElement(Label, {
120
122
  text: text,
121
123
  palette: labelPalette,
@@ -126,7 +128,7 @@ export default class Radio extends React.Component {
126
128
  variant: variant,
127
129
  title: toolTip ? toolTip : text,
128
130
  customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
129
- ${style[`${palette}Label`]} ${accessMode} ${customLabel}`,
131
+ ${style[`${palette}Label`]} ${isEditable ? style.pointer : ''} ${isReadOnly ? style.readonly : ''} ${customLabel}`,
130
132
  ...LabelProps
131
133
  })), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
132
134
  }
@@ -19,7 +19,7 @@
19
19
  cursor: pointer;
20
20
  }
21
21
  .readonly, .disabled {
22
- cursor: not-allowed;
22
+ cursor: default;
23
23
  }
24
24
  .disabled {
25
25
  opacity: 0.7