@zohodesk/dot 1.0.0-temp-187.3 → 1.0.0-temp-187.4
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.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +4 -0
- package/es/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
- package/es/list/DepartmentDropDown/props/propTypes.js +3 -1
- package/es/lookup/header/Search/LookupSearch.module.css +33 -27
- package/es/lookup/header/Search/Search.js +58 -40
- package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
- package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/es/lookup/header/Search/props/defaultProps.js +3 -1
- package/es/lookup/header/Search/props/propTypes.js +6 -1
- package/es/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -2
- package/es/v1/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
- package/es/v1/list/DepartmentDropDown/DepartmentDropDown.js +7 -2
- package/es/v1/list/DepartmentDropDown/props/defaultProps.js +2 -1
- package/es/v1/list/DepartmentDropDown/props/propTypes.js +3 -0
- package/lib/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
- package/lib/list/DepartmentDropDown/props/propTypes.js +3 -1
- package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
- package/lib/lookup/header/Search/Search.js +76 -66
- package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
- package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/lib/lookup/header/Search/props/defaultProps.js +3 -1
- package/lib/lookup/header/Search/props/propTypes.js +6 -1
- package/lib/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +5 -3
- package/lib/v1/form/fields/TagsMultiSelect/props/propTypes.js +2 -1
- package/lib/v1/list/DepartmentDropDown/DepartmentDropDown.js +8 -3
- package/lib/v1/list/DepartmentDropDown/props/defaultProps.js +2 -1
- package/lib/v1/list/DepartmentDropDown/props/propTypes.js +2 -0
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +1 -1
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.2
|
|
6
|
+
|
|
7
|
+
- **Lookup - Search** - renderChildren, isActive, hasSeparator & customStyle props supported & Some customization also opened for this compoenent.
|
|
8
|
+
|
|
5
9
|
# 1.7.1
|
|
6
10
|
|
|
7
11
|
- **Drawer** - The customDrawerClass prop is now supported to customize the drawer size.
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
.
|
|
2
|
-
.boxStyle {
|
|
1
|
+
.wrapper {
|
|
3
2
|
transition: var(--zd_transition1);
|
|
4
|
-
width: var(--
|
|
3
|
+
width: var(--zd_size160) ;
|
|
5
4
|
height: var(--zd_size28) ;
|
|
6
5
|
position: relative;
|
|
7
|
-
}.searchStyle, .boxStyle {
|
|
8
|
-
background: none;
|
|
9
6
|
}
|
|
10
|
-
.
|
|
11
|
-
|
|
7
|
+
.boxType {
|
|
8
|
+
border: 1px solid transparent;
|
|
12
9
|
border-radius: 4px;
|
|
13
|
-
border: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
14
10
|
}
|
|
15
|
-
.
|
|
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
|
|
27
|
-
|
|
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=
|
|
33
|
-
right:
|
|
34
|
-
border-right: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
34
|
+
[dir=rtl] .drpSearchBox {
|
|
35
|
+
padding-right: var(--zd_size12) ;
|
|
35
36
|
}
|
|
36
|
-
[dir=
|
|
37
|
-
|
|
38
|
-
border-left: 1px solid var(--zdt_lookupsearch_boxstyle_border);
|
|
37
|
+
[dir=ltr] .searchIcon {
|
|
38
|
+
padding-right: var(--zd_size8) ;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
padding:
|
|
40
|
+
[dir=rtl] .searchIcon {
|
|
41
|
+
padding-left: var(--zd_size8) ;
|
|
42
42
|
}
|
|
43
43
|
[dir=ltr] .searchIconBox {
|
|
44
|
-
padding: var(--
|
|
44
|
+
padding-left: var(--zd_size12) ;
|
|
45
45
|
}
|
|
46
46
|
[dir=rtl] .searchIconBox {
|
|
47
|
-
padding: var(--
|
|
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(--
|
|
53
|
+
margin-left: var(--zd_size6) ;
|
|
54
54
|
}
|
|
55
55
|
[dir=rtl] .iconArrow {
|
|
56
|
-
margin-right: var(--
|
|
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
|
|
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
|
|
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:
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
}))
|
|
195
|
-
className: style.searchIconBox
|
|
196
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
213
|
+
})) : isSearchIconNeed ? /*#__PURE__*/React.createElement(Icon, {
|
|
197
214
|
name: "ZD-search",
|
|
198
|
-
size: "11"
|
|
199
|
-
|
|
200
|
-
|
|
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
|
});
|