@zohodesk/components 1.4.16 → 1.4.18

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 (78) hide show
  1. package/README.md +35 -2
  2. package/es/Card/__tests__/Card.spec.js +48 -0
  3. package/es/Card/__tests__/CardContent.spec.js +61 -0
  4. package/es/Card/__tests__/CardHeader.spec.js +33 -0
  5. package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
  6. package/es/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
  7. package/es/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
  8. package/es/ListItem/ListItem.js +10 -3
  9. package/es/ListItem/ListItemWithAvatar.js +15 -6
  10. package/es/ListItem/ListItemWithCheckBox.js +13 -6
  11. package/es/ListItem/ListItemWithIcon.js +14 -5
  12. package/es/ListItem/ListItemWithRadio.js +13 -6
  13. package/es/ListItem/__tests__/ListItem.spec.js +19 -0
  14. package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +19 -0
  15. package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +19 -0
  16. package/es/ListItem/__tests__/ListItemWithIcon.spec.js +17 -0
  17. package/es/ListItem/__tests__/ListItemWithRadio.spec.js +19 -0
  18. package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  19. package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  20. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  21. package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  22. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  23. package/es/ListItem/props/propTypes.js +15 -5
  24. package/es/MultiSelect/MultiSelect.js +55 -23
  25. package/es/MultiSelect/Suggestions.js +2 -1
  26. package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
  27. package/es/MultiSelect/props/propTypes.js +2 -3
  28. package/es/Select/GroupSelect.js +4 -2
  29. package/es/Select/Select.js +50 -22
  30. package/es/Select/SelectWithAvatar.js +17 -4
  31. package/es/Select/SelectWithIcon.js +15 -5
  32. package/es/Select/props/defaultProps.js +3 -0
  33. package/es/Select/props/propTypes.js +6 -0
  34. package/es/Typography/__tests__/Typography.spec.js +225 -0
  35. package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
  36. package/es/utils/dropDownUtils.js +13 -4
  37. package/es/v1/Switch/__tests__/Switch.spec.js +41 -6
  38. package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
  39. package/es/v1/Switch/css/Switch_v1.module.css +7 -1
  40. package/lib/Card/__tests__/Card.spec.js +54 -6
  41. package/lib/Card/__tests__/CardContent.spec.js +68 -0
  42. package/lib/Card/__tests__/CardHeader.spec.js +40 -0
  43. package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
  44. package/lib/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
  45. package/lib/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
  46. package/lib/ListItem/ListItem.js +10 -3
  47. package/lib/ListItem/ListItemWithAvatar.js +15 -6
  48. package/lib/ListItem/ListItemWithCheckBox.js +15 -6
  49. package/lib/ListItem/ListItemWithIcon.js +13 -5
  50. package/lib/ListItem/ListItemWithRadio.js +15 -6
  51. package/lib/ListItem/__tests__/ListItem.spec.js +23 -0
  52. package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +23 -0
  53. package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +23 -0
  54. package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +21 -0
  55. package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +23 -0
  56. package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  57. package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  58. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  59. package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  60. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  61. package/lib/ListItem/props/propTypes.js +15 -6
  62. package/lib/MultiSelect/MultiSelect.js +50 -24
  63. package/lib/MultiSelect/Suggestions.js +2 -1
  64. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
  65. package/lib/MultiSelect/props/propTypes.js +3 -4
  66. package/lib/Select/GroupSelect.js +4 -3
  67. package/lib/Select/Select.js +45 -20
  68. package/lib/Select/SelectWithAvatar.js +17 -7
  69. package/lib/Select/SelectWithIcon.js +15 -5
  70. package/lib/Select/props/defaultProps.js +3 -1
  71. package/lib/Select/props/propTypes.js +6 -0
  72. package/lib/Typography/__tests__/Typography.spec.js +232 -0
  73. package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
  74. package/lib/utils/dropDownUtils.js +17 -4
  75. package/lib/v1/Switch/__tests__/Switch.spec.js +41 -6
  76. package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
  77. package/lib/v1/Switch/css/Switch_v1.module.css +7 -1
  78. package/package.json +5 -5
@@ -4,6 +4,7 @@ import { ListItemWithCheckBoxDefaultProps } from "./props/defaultProps";
4
4
  import { ListItemWithCheckBox_Props } from "./props/propTypes";
5
5
  import CheckBox from "../CheckBox/CheckBox";
6
6
  import { Box, Container } from "../Layout";
7
+ import { renderNode, isRenderable } from '@zohodesk/utils';
7
8
  import style from "./ListItem.module.css";
8
9
  export default class ListItemWithCheckBox extends React.Component {
9
10
  constructor(props) {
@@ -61,6 +62,7 @@ export default class ListItemWithCheckBox extends React.Component {
61
62
  customProps,
62
63
  needMultiLineText,
63
64
  secondaryValue,
65
+ renderValueRightPlaceholderNode,
64
66
  lhsAlignContent,
65
67
  lhsJustifyContent
66
68
  } = this.props;
@@ -75,7 +77,8 @@ export default class ListItemWithCheckBox extends React.Component {
75
77
  let {
76
78
  customListItem = '',
77
79
  customCheckBox = '',
78
- customLabel = ''
80
+ customLabel = '',
81
+ customValueRightPlaceholder = ''
79
82
  } = customClass;
80
83
  return /*#__PURE__*/React.createElement(ListContainer, {
81
84
  a11y: listA11y,
@@ -112,16 +115,20 @@ export default class ListItemWithCheckBox extends React.Component {
112
115
  }
113
116
  }))), /*#__PURE__*/React.createElement(Box, {
114
117
  flexible: true,
115
- shrink: true
116
- }, /*#__PURE__*/React.createElement(Container, {
117
- alignBox: "column"
118
+ className: style.leftBox
119
+ }, /*#__PURE__*/React.createElement(Box, {
120
+ className: style.titleBox
118
121
  }, value ? /*#__PURE__*/React.createElement(Box, {
122
+ shrink: true,
123
+ adjust: true,
119
124
  "data-title": isDisabled ? null : title,
120
125
  className: needMultiLineText ? style.multiLineValue : style.value
121
- }, value) : null, secondaryValue ? /*#__PURE__*/React.createElement(Box, {
126
+ }, value) : null, isRenderable(renderValueRightPlaceholderNode) ? /*#__PURE__*/React.createElement(Box, {
127
+ className: customValueRightPlaceholder
128
+ }, renderNode(renderValueRightPlaceholderNode)) : null), secondaryValue ? /*#__PURE__*/React.createElement(Box, {
122
129
  "data-title": isDisabled ? null : secondaryValue,
123
130
  className: `${style.secondaryField} ${needMultiLineText ? style.multiLine : style.secondaryValue}`
124
- }, secondaryValue) : null)));
131
+ }, secondaryValue) : null));
125
132
  }
126
133
 
127
134
  }
@@ -5,6 +5,9 @@ import { Icon } from '@zohodesk/icons';
5
5
  import ListContainer from "./ListContainer";
6
6
  import { ListItemWithIconDefaultProps } from "./props/defaultProps";
7
7
  import { ListItemWithIcon_Props } from "./props/propTypes";
8
+ /*** Utils ****/
9
+
10
+ import { renderNode, isRenderable } from '@zohodesk/utils';
8
11
  /**** CSS ****/
9
12
 
10
13
  import style from "./ListItem.module.css";
@@ -69,9 +72,11 @@ export default class ListItemWithIcon extends React.Component {
69
72
  disableTitle,
70
73
  a11y,
71
74
  customClass,
75
+ customValueRightPlaceholderClass,
72
76
  customProps,
73
77
  needMultiLineText,
74
78
  secondaryValue,
79
+ renderValueRightPlaceholderNode,
75
80
  lhsAlignContent,
76
81
  lhsJustifyContent
77
82
  } = this.props;
@@ -127,17 +132,21 @@ export default class ListItemWithIcon extends React.Component {
127
132
  className: iconClass
128
133
  }) : null, /*#__PURE__*/React.createElement(Box, {
129
134
  flexible: true,
130
- shrink: true
131
- }, /*#__PURE__*/React.createElement(Container, {
132
- alignBox: "column"
135
+ className: style.leftBox
136
+ }, /*#__PURE__*/React.createElement(Box, {
137
+ className: style.titleBox
133
138
  }, value ? /*#__PURE__*/React.createElement(Box, {
139
+ shrink: true,
140
+ adjust: true,
134
141
  className: needMultiLineText ? style.multiLineValue : style.value,
135
142
  "data-title": isDisabled ? null : title,
136
143
  dataId: `${dataIdString}_Text`
137
- }, value) : null, secondaryValue ? /*#__PURE__*/React.createElement(Box, {
144
+ }, value) : null, isRenderable(renderValueRightPlaceholderNode) ? /*#__PURE__*/React.createElement(Box, {
145
+ className: customValueRightPlaceholderClass
146
+ }, renderNode(renderValueRightPlaceholderNode)) : null), secondaryValue ? /*#__PURE__*/React.createElement(Box, {
138
147
  "data-title": isDisabled ? null : secondaryValue,
139
148
  className: `${style.secondaryField} ${needMultiLineText ? style.multiLine : style.secondaryValue}`
140
- }, secondaryValue) : null)), needTick && active ? /*#__PURE__*/React.createElement(Box, {
149
+ }, secondaryValue) : null), needTick && active ? /*#__PURE__*/React.createElement(Box, {
141
150
  className: style.tickIcon,
142
151
  "aria-hidden": ariaHidden,
143
152
  dataId: `${dataIdString}_tickIcon`,
@@ -4,6 +4,7 @@ import { Box, Container } from "../Layout";
4
4
  import ListContainer from "./ListContainer";
5
5
  import { ListItemWithRadioDefaultProps } from "./props/defaultProps";
6
6
  import { ListItemWithRadio_Props } from "./props/propTypes";
7
+ import { renderNode, isRenderable } from '@zohodesk/utils';
7
8
  import style from "./ListItem.module.css";
8
9
  export default class ListItemWithRadio extends React.Component {
9
10
  constructor(props) {
@@ -62,6 +63,7 @@ export default class ListItemWithRadio extends React.Component {
62
63
  customProps,
63
64
  needMultiLineText,
64
65
  secondaryValue,
66
+ renderValueRightPlaceholderNode,
65
67
  lhsAlignContent,
66
68
  lhsJustifyContent
67
69
  } = this.props;
@@ -76,7 +78,8 @@ export default class ListItemWithRadio extends React.Component {
76
78
  let {
77
79
  customListItem = '',
78
80
  customRadio = '',
79
- customRadioWrap = ''
81
+ customRadioWrap = '',
82
+ customValueRightPlaceholder = ''
80
83
  } = customClass;
81
84
  return /*#__PURE__*/React.createElement(ListContainer, {
82
85
  a11y: listA11y,
@@ -115,16 +118,20 @@ export default class ListItemWithRadio extends React.Component {
115
118
  }
116
119
  }))), /*#__PURE__*/React.createElement(Box, {
117
120
  flexible: true,
118
- shrink: true
119
- }, /*#__PURE__*/React.createElement(Container, {
120
- alignBox: "column"
121
+ className: style.leftBox
122
+ }, /*#__PURE__*/React.createElement(Box, {
123
+ className: style.titleBox
121
124
  }, value ? /*#__PURE__*/React.createElement(Box, {
125
+ shrink: true,
126
+ adjust: true,
122
127
  "data-title": disableTitle ? null : title,
123
128
  className: needMultiLineText ? style.multiLineValue : style.value
124
- }, value) : null, secondaryValue ? /*#__PURE__*/React.createElement(Box, {
129
+ }, value) : null, isRenderable(renderValueRightPlaceholderNode) ? /*#__PURE__*/React.createElement(Box, {
130
+ className: customValueRightPlaceholder
131
+ }, renderNode(renderValueRightPlaceholderNode)) : null), secondaryValue ? /*#__PURE__*/React.createElement(Box, {
125
132
  "data-title": isDisabled ? null : secondaryValue,
126
133
  className: `${style.secondaryField} ${needMultiLineText ? style.multiLine : style.secondaryValue}`
127
- }, secondaryValue) : null)));
134
+ }, secondaryValue) : null));
128
135
  }
129
136
 
130
137
  }
@@ -8,4 +8,23 @@ describe('ListItem', () => {
8
8
  } = render( /*#__PURE__*/React.createElement(ListItem, null));
9
9
  expect(asFragment()).toMatchSnapshot();
10
10
  });
11
+ test('ListItem with renderValueRightPlaceholderNode', () => {
12
+ const {
13
+ asFragment
14
+ } = render( /*#__PURE__*/React.createElement(ListItem, {
15
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder")
16
+ }));
17
+ expect(asFragment()).toMatchSnapshot();
18
+ });
19
+ test('ListItem with renderValueRightPlaceholderNode & it\'s custom class', () => {
20
+ const {
21
+ asFragment
22
+ } = render( /*#__PURE__*/React.createElement(ListItem, {
23
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder"),
24
+ customClass: {
25
+ customValueRightPlaceholder: "customValueRightPlaceholderClass"
26
+ }
27
+ }));
28
+ expect(asFragment()).toMatchSnapshot();
29
+ });
11
30
  });
@@ -43,4 +43,23 @@ describe('ListItemWithAvatar', () => {
43
43
  }));
44
44
  expect(asFragment()).toMatchSnapshot();
45
45
  });
46
+ test('ListItemWithAvatar with renderValueRightPlaceholderNode', () => {
47
+ const {
48
+ asFragment
49
+ } = render( /*#__PURE__*/React.createElement(ListItemWithAvatar, {
50
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder")
51
+ }));
52
+ expect(asFragment()).toMatchSnapshot();
53
+ });
54
+ test('ListItemWithAvatar with renderValueRightPlaceholderNode & it\'s custom class', () => {
55
+ const {
56
+ asFragment
57
+ } = render( /*#__PURE__*/React.createElement(ListItemWithAvatar, {
58
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder"),
59
+ customClass: {
60
+ customValueRightPlaceholder: "customValueRightPlaceholderClass"
61
+ }
62
+ }));
63
+ expect(asFragment()).toMatchSnapshot();
64
+ });
46
65
  });
@@ -43,4 +43,23 @@ describe('ListItemWithCheckBox', () => {
43
43
  }));
44
44
  expect(asFragment()).toMatchSnapshot();
45
45
  });
46
+ test('ListItemWithCheckBox with renderValueRightPlaceholderNode', () => {
47
+ const {
48
+ asFragment
49
+ } = render( /*#__PURE__*/React.createElement(ListItemWithCheckBox, {
50
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder")
51
+ }));
52
+ expect(asFragment()).toMatchSnapshot();
53
+ });
54
+ test('ListItemWithCheckBox with renderValueRightPlaceholderNode & it\'s custom class', () => {
55
+ const {
56
+ asFragment
57
+ } = render( /*#__PURE__*/React.createElement(ListItemWithCheckBox, {
58
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder"),
59
+ customClass: {
60
+ customValueRightPlaceholder: "customValueRightPlaceholderClass"
61
+ }
62
+ }));
63
+ expect(asFragment()).toMatchSnapshot();
64
+ });
46
65
  });
@@ -43,4 +43,21 @@ describe('ListItemWithIcon', () => {
43
43
  }));
44
44
  expect(asFragment()).toMatchSnapshot();
45
45
  });
46
+ test('ListItemWithIcon with renderValueRightPlaceholderNode', () => {
47
+ const {
48
+ asFragment
49
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
50
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder")
51
+ }));
52
+ expect(asFragment()).toMatchSnapshot();
53
+ });
54
+ test('ListItemWithIcon with renderValueRightPlaceholderNode & it\'s custom class', () => {
55
+ const {
56
+ asFragment
57
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
58
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder"),
59
+ customValueRightPlaceholderClass: "customValueRightPlaceholderClass"
60
+ }));
61
+ expect(asFragment()).toMatchSnapshot();
62
+ });
46
63
  });
@@ -43,4 +43,23 @@ describe('ListItemWithRadio', () => {
43
43
  }));
44
44
  expect(asFragment()).toMatchSnapshot();
45
45
  });
46
+ test('ListItemWithRadio with renderValueRightPlaceholderNode', () => {
47
+ const {
48
+ asFragment
49
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
50
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder")
51
+ }));
52
+ expect(asFragment()).toMatchSnapshot();
53
+ });
54
+ test('ListItemWithRadio with renderValueRightPlaceholderNode & it\'s custom class', () => {
55
+ const {
56
+ asFragment
57
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
58
+ renderValueRightPlaceholderNode: () => /*#__PURE__*/React.createElement("div", null, "Custom Placeholder"),
59
+ customClass: {
60
+ customValueRightPlaceholder: "customValueRightPlaceholderClass"
61
+ }
62
+ }));
63
+ expect(asFragment()).toMatchSnapshot();
64
+ });
46
65
  });
@@ -1,5 +1,83 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`ListItem ListItem with renderValueRightPlaceholderNode & it's custom class 1`] = `
4
+ <DocumentFragment>
5
+ <li
6
+ class="list medium default withBorder flex rowdir vCenter"
7
+ data-a11y-inset-focus="true"
8
+ data-id="listItem"
9
+ data-selector-id="listItem"
10
+ data-test-id="listItem"
11
+ role="option"
12
+ tabindex="0"
13
+ >
14
+ <div
15
+ class="leftBox grow basis shrinkOff"
16
+ data-id="boxComponent"
17
+ data-selector-id="box"
18
+ data-test-id="boxComponent"
19
+ >
20
+ <div
21
+ class="titleBox shrinkOff"
22
+ data-id="boxComponent"
23
+ data-selector-id="box"
24
+ data-test-id="boxComponent"
25
+ >
26
+ <div
27
+ class="customValueRightPlaceholderClass shrinkOff"
28
+ data-id="boxComponent"
29
+ data-selector-id="box"
30
+ data-test-id="boxComponent"
31
+ >
32
+ <div>
33
+ Custom Placeholder
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </li>
39
+ </DocumentFragment>
40
+ `;
41
+
42
+ exports[`ListItem ListItem with renderValueRightPlaceholderNode 1`] = `
43
+ <DocumentFragment>
44
+ <li
45
+ class="list medium default withBorder flex rowdir vCenter"
46
+ data-a11y-inset-focus="true"
47
+ data-id="listItem"
48
+ data-selector-id="listItem"
49
+ data-test-id="listItem"
50
+ role="option"
51
+ tabindex="0"
52
+ >
53
+ <div
54
+ class="leftBox grow basis shrinkOff"
55
+ data-id="boxComponent"
56
+ data-selector-id="box"
57
+ data-test-id="boxComponent"
58
+ >
59
+ <div
60
+ class="titleBox shrinkOff"
61
+ data-id="boxComponent"
62
+ data-selector-id="box"
63
+ data-test-id="boxComponent"
64
+ >
65
+ <div
66
+ class="shrinkOff"
67
+ data-id="boxComponent"
68
+ data-selector-id="box"
69
+ data-test-id="boxComponent"
70
+ >
71
+ <div>
72
+ Custom Placeholder
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </li>
78
+ </DocumentFragment>
79
+ `;
80
+
3
81
  exports[`ListItem rendering the defult props 1`] = `
4
82
  <DocumentFragment>
5
83
  <li