@zohodesk/dot 1.0.0-temp-187.2 → 1.0.0-temp-200

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 (44) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +4 -0
  3. package/es/Attachment/Attachment.js +2 -1
  4. package/es/Attachment/Attachment.module.css +7 -3
  5. package/es/AttachmentViewer/Attachment.js +60 -1
  6. package/es/AttachmentViewer/AttachmentViewer.js +146 -12
  7. package/es/AttachmentViewer/AttachmentViewer.module.css +124 -4
  8. package/es/DotProvider/__tests__/DotProvider.spec.js +174 -0
  9. package/es/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
  10. package/es/common/dot_common.module.css +35 -0
  11. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
  12. package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
  13. package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
  14. package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
  15. package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
  16. package/es/lookup/header/Search/LookupSearch.module.css +33 -27
  17. package/es/lookup/header/Search/Search.js +58 -40
  18. package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
  19. package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
  20. package/es/lookup/header/Search/props/defaultProps.js +3 -1
  21. package/es/lookup/header/Search/props/propTypes.js +6 -1
  22. package/lib/Attachment/Attachment.js +3 -1
  23. package/lib/Attachment/Attachment.module.css +7 -3
  24. package/lib/AttachmentViewer/Attachment.js +88 -1
  25. package/lib/AttachmentViewer/AttachmentViewer.js +147 -13
  26. package/lib/AttachmentViewer/AttachmentViewer.module.css +124 -4
  27. package/lib/DotProvider/__tests__/DotProvider.spec.js +441 -0
  28. package/lib/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
  29. package/lib/common/dot_common.module.css +35 -0
  30. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
  31. package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
  32. package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
  33. package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
  34. package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
  35. package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
  36. package/lib/lookup/header/Search/Search.js +76 -66
  37. package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
  38. package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
  39. package/lib/lookup/header/Search/props/defaultProps.js +3 -1
  40. package/lib/lookup/header/Search/props/propTypes.js +6 -1
  41. package/package.json +8 -8
  42. package/result.json +1 -1
  43. package/unittest/index.html +2 -6
  44. /package/images/{audio_thumbnail.png → audio_thumbnail_old.png} +0 -0
@@ -6,58 +6,43 @@
6
6
  min-height: var(--zd_size35) ;
7
7
  cursor: pointer;
8
8
  }
9
-
10
9
  [dir=ltr] .withBorder {
11
10
  border-left: 1px solid var(--zdt_statuslistitem_default_border);
12
11
  }
13
-
14
12
  [dir=rtl] .withBorder {
15
13
  border-right: 1px solid var(--zdt_statuslistitem_default_border);
16
14
  }
17
-
18
15
  [dir=ltr] .small {
19
16
  padding: var(--zd_size7) var(--zd_size3) var(--zd_size7) var(--zd_size5) ;
20
17
  }
21
-
22
18
  [dir=rtl] .small {
23
19
  padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3) ;
24
20
  }
25
-
26
21
  .medium {
27
22
  padding: var(--zd_size7) var(--zd_size20) ;
28
23
  }
29
-
30
24
  .large {
31
25
  height: var(--zd_size48) ;
32
26
  }
33
-
34
27
  [dir=ltr] .large {
35
28
  padding: var(--zd_size10) var(--zd_size3) var(--zd_size10) var(--zd_size25) ;
36
29
  }
37
-
38
30
  [dir=rtl] .large {
39
31
  padding: var(--zd_size10) var(--zd_size25) var(--zd_size10) var(--zd_size3) ;
40
32
  }
41
-
42
- .value,
43
- .multiLineValue {
33
+ .value,.multiLineValue {
44
34
  line-height: 1.5385;
45
35
  }
46
-
47
36
  .value {
48
37
  composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
49
38
  }
50
-
51
- .multiLineValue {
39
+ .multiLineValue{
52
40
  word-break: break-word;
53
- -webkit-line-clamp: 2;
54
41
  composes: clamp from '~@zohodesk/components/lib/common/common.module.css';
55
42
  }
56
-
57
43
  [dir=ltr] .withBorder.active {
58
44
  border-left-color: var(--zdt_statuslistitem_default_active_border);
59
45
  }
60
-
61
46
  [dir=rtl] .withBorder.active {
62
47
  border-right-color: var(--zdt_statuslistitem_default_active_border);
63
48
  }
@@ -65,56 +50,44 @@
65
50
  .default.hover, .default.effect:hover {
66
51
  background-color: var(--zdt_statuslistitem_default_effect_bg);
67
52
  }
68
-
69
53
  .primary.hover, .primary.effect:hover, .selected {
70
54
  background-color: var(--zdt_statuslistitem_primary_efffect_bg);
71
55
  }
72
-
73
56
  .secondary.hover, .secondary.effect:hover {
74
57
  background-color: var(--zdt_statuslistitem_secondary_effect_bg);
75
58
  }
76
-
77
59
  .list.active.default, .list.active.primary {
78
60
  background-color: var(--zdt_statuslistitem_primary_efffect_bg);
79
61
  }
80
-
81
62
  .list.active.secondary {
82
63
  background-color: var(--zdt_statuslistitem_secondary_effect_bg);
83
64
  }
84
-
85
65
  .secondary.hover,
86
66
  .secondary.effect:hover,
87
67
  .list.active.secondary {
88
68
  color: var(--zdt_statuslistitem_secondary_effect_text);
89
69
  }
90
-
91
70
  .tickIcon {
92
71
  color: var(--zdt_statuslistitem_tickicon);
93
72
  position: absolute;
94
- top: 50% ;
73
+ top:50% ;
95
74
  transform: translateY(-50%);
96
75
  }
97
-
98
76
  [dir=ltr] .tickIcon {
99
77
  right: var(--zd_size20) ;
100
78
  }
101
-
102
79
  [dir=rtl] .tickIcon {
103
80
  left: var(--zd_size20) ;
104
81
  }
105
-
106
- .tickIcon>i {
82
+ .tickIcon > i {
107
83
  display: block;
108
84
  }
109
-
110
85
  [dir=ltr] .active.withTick {
111
86
  padding-right: var(--zd_size39) ;
112
87
  }
113
-
114
88
  [dir=rtl] .active.withTick {
115
89
  padding-left: var(--zd_size39) ;
116
90
  }
117
-
118
91
  /* Status Type */
119
92
  .statusType {
120
93
  width: var(--zd_size8) ;
@@ -127,15 +100,12 @@
127
100
  [dir=rtl] .statusType {
128
101
  margin-left: var(--zd_size13) ;
129
102
  }
130
-
131
103
  .black {
132
104
  background-color: var(--zdt_statuslistitem_black_bg);
133
105
  }
134
-
135
106
  .orange {
136
107
  background-color: var(--zdt_statuslistitem_orange_bg);
137
108
  }
138
-
139
109
  .green {
140
110
  background-color: var(--zdt_statuslistitem_green_bg);
141
- }
111
+ }
@@ -1,20 +1,25 @@
1
- .searchStyle,
2
- .boxStyle {
1
+ .wrapper {
3
2
  transition: var(--zd_transition1);
4
- width: var(--zd_size96) ;
3
+ width: var(--zd_size160) ;
5
4
  height: var(--zd_size28) ;
6
5
  position: relative;
7
- }.searchStyle, .boxStyle {
8
- background: none;
9
6
  }
10
- .boxStyle {
11
- width: var(--zd_size160) ;
7
+ .boxType {
8
+ border: 1px solid transparent;
12
9
  border-radius: 4px;
13
- border: 1px solid var(--zdt_lookupsearch_boxstyle_border);
14
10
  }
15
- .searchStyle:hover, .boxStyle:hover {
11
+ .borderType {
12
+ border-bottom: 1px solid transparent;
13
+ }
14
+ .boxType, .borderType {
15
+ border-color: var(--zdt_lookupsearch_boxstyle_border);
16
+ }
17
+ .boxType:hover, .borderType:hover {
16
18
  border-color: var(--zdt_lookupsearch_boxstyle_hover_border);
17
19
  }
20
+ .boxType.active, .borderType.active {
21
+ border-color: var(--zdt_lookupsearch_boxstyle_activer_border);
22
+ }
18
23
  .focusWidth {
19
24
  width: var(--zd_size220) ;
20
25
  }
@@ -23,35 +28,36 @@
23
28
  height: var(--zd_size28) ;
24
29
  cursor: pointer;
25
30
  }
26
- .drpSearchBox::after {
27
- content: '';
28
- position: absolute;
29
- top: var(--zd_size8) ;
30
- bottom: var(--zd_size8) ;
31
+ [dir=ltr] .drpSearchBox {
32
+ padding-left: var(--zd_size12) ;
31
33
  }
32
- [dir=ltr] .drpSearchBox::after {
33
- right: calc( var(--zd_size1) * -1 ) ;
34
- border-right: 1px solid var(--zdt_lookupsearch_boxstyle_border);
34
+ [dir=rtl] .drpSearchBox {
35
+ padding-right: var(--zd_size12) ;
35
36
  }
36
- [dir=rtl] .drpSearchBox::after {
37
- left: calc( var(--zd_size1) * -1 ) ;
38
- border-left: 1px solid var(--zdt_lookupsearch_boxstyle_border);
37
+ [dir=ltr] .searchIcon {
38
+ padding-right: var(--zd_size8) ;
39
39
  }
40
- .inputBox, .drpSearchBox {
41
- padding: 0 var(--zd_size9) ;
40
+ [dir=rtl] .searchIcon {
41
+ padding-left: var(--zd_size8) ;
42
42
  }
43
43
  [dir=ltr] .searchIconBox {
44
- padding: var(--zd_size4) 0 var(--zd_size4) var(--zd_size9) ;
44
+ padding-left: var(--zd_size12) ;
45
45
  }
46
46
  [dir=rtl] .searchIconBox {
47
- padding: var(--zd_size4) var(--zd_size9) var(--zd_size4) 0 ;
47
+ padding-right: var(--zd_size12) ;
48
48
  }
49
49
  .active, .boxStyle.active, .lineActive.drpSearchBox::after {
50
50
  border-color: var(--zdt_lookupsearch_boxstyle_activer_border);
51
51
  }
52
52
  [dir=ltr] .iconArrow {
53
- margin-left: var(--zd_size5) ;
53
+ margin-left: var(--zd_size6) ;
54
54
  }
55
55
  [dir=rtl] .iconArrow {
56
- margin-right: var(--zd_size5) ;
57
- }
56
+ margin-right: var(--zd_size6) ;
57
+ }
58
+ .separator {
59
+ width: var(--zd_size1) ;
60
+ height: var(--zd_size16) ;
61
+ margin: 0 var(--zd_size12) ;
62
+ background-color: var(--zdt_lookupsearch_boxstyle_border);
63
+ }
@@ -8,6 +8,7 @@ import { Search_propTypes, SearchUI_propTypes } from "./props/propTypes";
8
8
 
9
9
  import TextBoxIcon from '@zohodesk/components/lib/TextBoxIcon/TextBoxIcon';
10
10
  import { Container, Box } from '@zohodesk/components/lib/Layout';
11
+ import { mergeStyle } from '@zohodesk/utils';
11
12
  import { Icon } from '@zohodesk/icons';
12
13
  import ToggleDropDown from "../../../dropdown/ToggleDropDown/ToggleDropDown";
13
14
  /** * Methods ** */
@@ -16,33 +17,19 @@ import { debounce } from '@zohodesk/components/lib/utils/debounce';
16
17
  import { cancelBubblingEffect } from '@zohodesk/components/es/utils/Common';
17
18
  /** * CSS ** */
18
19
 
19
- import style from "./LookupSearch.module.css";
20
+ import defaultStyle from "./LookupSearch.module.css";
20
21
  export default class Search extends Component {
21
22
  constructor(props) {
22
23
  super(props);
23
- this.handleDropDownOpen = this.handleDropDownOpen.bind(this);
24
- this.handleDropDownClose = this.handleDropDownClose.bind(this);
25
24
  this.handleTextBoxFocus = this.handleTextBoxFocus.bind(this);
26
25
  this.handleTextBoxBlur = this.handleTextBoxBlur.bind(this);
27
26
  this.handleGetTextBoxRef = this.handleGetTextBoxRef.bind(this);
27
+ this.handleRenderChildren = this.handleRenderChildren.bind(this);
28
28
  this.state = {
29
- isFocus: false,
30
- isDropDownOpen: false
29
+ isFocus: false
31
30
  };
32
31
  }
33
32
 
34
- handleDropDownOpen() {
35
- this.setState({
36
- isDropDownOpen: true
37
- });
38
- }
39
-
40
- handleDropDownClose() {
41
- this.setState({
42
- isDropDownOpen: false
43
- });
44
- }
45
-
46
33
  handleTextBoxFocus(e) {
47
34
  const {
48
35
  onFocus
@@ -71,22 +58,42 @@ export default class Search extends Component {
71
58
  getRef && getRef(el);
72
59
  }
73
60
 
61
+ handleRenderChildren(_ref) {
62
+ let {
63
+ isActive,
64
+ isFocus
65
+ } = _ref;
66
+ const {
67
+ value,
68
+ selectedId,
69
+ renderChildren
70
+ } = this.props;
71
+ return renderChildren({
72
+ isActive,
73
+ isFocus,
74
+ value,
75
+ selectedId
76
+ });
77
+ }
78
+
74
79
  render() {
75
80
  const {
76
81
  options,
77
82
  onSelect,
78
83
  value,
79
- selectedId
84
+ selectedId,
85
+ renderChildren
80
86
  } = this.props;
81
87
  const {
82
- isFocus,
83
- isDropDownOpen
88
+ isFocus
84
89
  } = this.state;
85
90
  const searchUIExtraProps = {
86
- isFocus: isFocus || isDropDownOpen,
91
+ isFocus: isFocus,
87
92
  onFocus: this.handleTextBoxFocus,
88
93
  onBlur: this.handleTextBoxBlur,
89
- getRef: this.handleGetTextBoxRef
94
+ getRef: this.handleGetTextBoxRef,
95
+ value: value,
96
+ renderChildren: typeof renderChildren == 'function' ? this.handleRenderChildren : undefined
90
97
  };
91
98
  return options ? /*#__PURE__*/React.createElement(ToggleDropDown, {
92
99
  value: value,
@@ -95,9 +102,7 @@ export default class Search extends Component {
95
102
  needTick: true,
96
103
  isArrow: false,
97
104
  isToggleStateNeeded: true,
98
- selectedId: selectedId,
99
- onDropDownOpen: this.handleDropDownOpen,
100
- onDropDownClose: this.handleDropDownClose
105
+ selectedId: selectedId
101
106
  }, /*#__PURE__*/React.createElement(SearchUI, { ...this.props,
102
107
  ...searchUIExtraProps
103
108
  })) : /*#__PURE__*/React.createElement(SearchUI, { ...this.props,
@@ -171,15 +176,29 @@ class SearchUI extends Component {
171
176
  activeClass,
172
177
  isFocus,
173
178
  onFocus,
174
- onBlur
179
+ onBlur,
180
+ renderChildren,
181
+ isActive,
182
+ hasSeparator,
183
+ customStyle
175
184
  } = this.props;
185
+ const isActiveState = isFocus || isActive;
186
+ const isFocusWidth = isActiveState || searchStr;
187
+ const style = mergeStyle(defaultStyle, customStyle);
176
188
  return /*#__PURE__*/React.createElement(Container, {
177
189
  isCover: false,
178
190
  alignBox: "row",
179
191
  align: "vertical",
180
- className: `${style.searchStyle} ${isBoxed ? style.boxStyle : ''} ${isFocus ? `${style.active} ${activeClass ? activeClass : ''} ` : ''} ${searchStr || isFocus ? style.focusWidth : ''}`
181
- }, options && /*#__PURE__*/React.createElement(Container, {
182
- className: `${style.drpSearchBox} ${isFocus ? style.lineActive : ''}`,
192
+ className: `
193
+ ${style.wrapper} ${isBoxed ? style.boxType : style.borderType}
194
+ ${isActiveState ? `${style.active} ${activeClass || ''}` : ''}
195
+ ${isFocusWidth ? style.focusWidth : ''}
196
+ `
197
+ }, typeof renderChildren == 'function' ? renderChildren({
198
+ isActive,
199
+ isFocus
200
+ }) : options ? /*#__PURE__*/React.createElement(Container, {
201
+ className: `${style.drpSearchBox} ${isActiveState ? style.lineActive : ''}`,
183
202
  isCover: false,
184
203
  align: "vertical",
185
204
  alignBox: "row",
@@ -191,17 +210,16 @@ class SearchUI extends Component {
191
210
  name: "ZD-down",
192
211
  size: "7",
193
212
  iconClass: style.iconArrow
194
- })), isSearchIconNeed && /*#__PURE__*/React.createElement(Box, {
195
- className: style.searchIconBox
196
- }, /*#__PURE__*/React.createElement(Icon, {
213
+ })) : isSearchIconNeed ? /*#__PURE__*/React.createElement(Icon, {
197
214
  name: "ZD-search",
198
- size: "11"
199
- })), /*#__PURE__*/React.createElement(Box, {
200
- flexible: true
215
+ size: "11",
216
+ iconClass: `${style.searchIcon} ${isBoxed ? style.searchIconBox : ''}`
217
+ }) : null, hasSeparator ? /*#__PURE__*/React.createElement("div", {
218
+ className: style.separator
219
+ }) : null, /*#__PURE__*/React.createElement(Box, {
220
+ flexible: true,
221
+ onClick: cancelBubblingEffect
201
222
  }, /*#__PURE__*/React.createElement(TextBoxIcon, {
202
- customClass: {
203
- customTextBox: `${isBoxed ? style.inputBox : ''}`
204
- },
205
223
  customProps: {
206
224
  TextBoxProps: {
207
225
  'data-a11y-autofocus': true
@@ -210,7 +228,6 @@ class SearchUI extends Component {
210
228
  placeHolder: placeHolder,
211
229
  value: searchStr,
212
230
  onChange: this.handleChange,
213
- onClick: cancelBubblingEffect,
214
231
  onFocus: onFocus,
215
232
  onBlur: onBlur,
216
233
  onKeyDown: this.handleKeyDown,
@@ -219,7 +236,8 @@ class SearchUI extends Component {
219
236
  size: "small",
220
237
  inputRef: getRef,
221
238
  onClear: this.handleClear,
222
- onClearMouseDown: cancelBubblingEffect
239
+ onClearMouseDown: cancelBubblingEffect,
240
+ needBorder: false
223
241
  })));
224
242
  }
225
243
 
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
3
  import Search from "../Search";
4
+ afterEach(cleanup);
4
5
  describe('Search', () => {
5
6
  test('rendering the defult props', () => {
6
7
  const {
@@ -8,4 +9,69 @@ describe('Search', () => {
8
9
  } = render( /*#__PURE__*/React.createElement(Search, null));
9
10
  expect(asFragment()).toMatchSnapshot();
10
11
  });
12
+ test('rendering the search active', () => {
13
+ const {
14
+ asFragment,
15
+ getByRole
16
+ } = render( /*#__PURE__*/React.createElement(Search, null));
17
+ fireEvent.focus(getByRole('textbox'));
18
+ expect(asFragment()).toMatchSnapshot();
19
+ });
20
+ test('rendering the prop hasSeparator is true', () => {
21
+ const {
22
+ asFragment
23
+ } = render( /*#__PURE__*/React.createElement(Search, {
24
+ hasSeparator: true
25
+ }));
26
+ expect(asFragment()).toMatchSnapshot();
27
+ });
28
+ test('rendering the prop hasSeparator is false', () => {
29
+ const {
30
+ asFragment
31
+ } = render( /*#__PURE__*/React.createElement(Search, {
32
+ hasSeparator: false
33
+ }));
34
+ expect(asFragment()).toMatchSnapshot();
35
+ });
36
+ test('rendering the renderChildren props via function', () => {
37
+ const options = [{
38
+ value: 'All Fields',
39
+ id: '1'
40
+ }, {
41
+ value: 'Account',
42
+ id: '3'
43
+ }, {
44
+ value: 'Customer Place',
45
+ id: '4'
46
+ }, {
47
+ value: 'Conatct ID',
48
+ id: '5'
49
+ }];
50
+
51
+ function renderChildren(_ref) {
52
+ let {
53
+ value
54
+ } = _ref;
55
+ return /*#__PURE__*/React.createElement("div", null, value);
56
+ }
57
+
58
+ const {
59
+ asFragment
60
+ } = render( /*#__PURE__*/React.createElement(Search, {
61
+ value: "All Fields",
62
+ renderChildren: renderChildren,
63
+ options: options
64
+ }));
65
+ expect(asFragment()).toMatchSnapshot();
66
+ });
67
+ test('rendering the customized style search', () => {
68
+ const {
69
+ asFragment
70
+ } = render( /*#__PURE__*/React.createElement(Search, {
71
+ customStyle: {
72
+ wrapper: "searchWrapperClass"
73
+ }
74
+ }));
75
+ expect(asFragment()).toMatchSnapshot();
76
+ });
11
77
  });