@zohodesk/dot 1.0.0-temp-187.3 → 1.0.0-temp-201
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 +10 -0
- package/es/form/fields/Fields.module.css +1 -1
- package/es/form/fields/RadioField/RadioField.js +69 -6
- package/es/form/fields/RadioField/props/defaultProps.js +1 -0
- package/es/form/fields/RadioField/props/propTypes.js +3 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
- 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/RadioField/RadioField.js +3 -2
- package/lib/form/fields/Fields.module.css +1 -1
- package/lib/form/fields/RadioField/RadioField.js +100 -31
- package/lib/form/fields/RadioField/props/defaultProps.js +1 -0
- package/lib/form/fields/RadioField/props/propTypes.js +3 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
- 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/RadioField/RadioField.js +3 -2
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.7.3
|
|
6
|
+
|
|
7
|
+
- **RadioField**
|
|
8
|
+
- `getRef`, `isBoxStyle` props supported
|
|
9
|
+
- Fixed the Radio box hover style applying when disabled
|
|
10
|
+
|
|
11
|
+
# 1.7.2
|
|
12
|
+
|
|
13
|
+
- **Lookup - Search** - renderChildren, isActive, hasSeparator & customStyle props supported & Some customization also opened for this compoenent.
|
|
14
|
+
|
|
5
15
|
# 1.7.1
|
|
6
16
|
|
|
7
17
|
- **Drawer** - The customDrawerClass prop is now supported to customize the drawer size.
|
|
@@ -14,7 +14,40 @@ import style from "../Fields.module.css";
|
|
|
14
14
|
export default class RadioField extends PureComponent {
|
|
15
15
|
constructor(props) {
|
|
16
16
|
super(props);
|
|
17
|
+
this.data = {
|
|
18
|
+
radios: {},
|
|
19
|
+
focus: this.handleFocus
|
|
20
|
+
};
|
|
17
21
|
this.handleChange = this.handleChange.bind(this);
|
|
22
|
+
this.updateData = this.updateData.bind(this);
|
|
23
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
componentDidMount() {
|
|
27
|
+
const {
|
|
28
|
+
getRef,
|
|
29
|
+
id
|
|
30
|
+
} = this.props;
|
|
31
|
+
getRef && getRef(this.data, id);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
componentDidUpdate(prevProps) {
|
|
35
|
+
const {
|
|
36
|
+
getRef,
|
|
37
|
+
id
|
|
38
|
+
} = this.props;
|
|
39
|
+
|
|
40
|
+
if (getRef !== prevProps.getRef) {
|
|
41
|
+
getRef && getRef(this.data, id);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
componentWillUnmount() {
|
|
46
|
+
const {
|
|
47
|
+
getRef,
|
|
48
|
+
id
|
|
49
|
+
} = this.props;
|
|
50
|
+
getRef && getRef(null, id);
|
|
18
51
|
}
|
|
19
52
|
|
|
20
53
|
handleChange(value) {
|
|
@@ -25,6 +58,24 @@ export default class RadioField extends PureComponent {
|
|
|
25
58
|
onChange && onChange(id, value);
|
|
26
59
|
}
|
|
27
60
|
|
|
61
|
+
updateData(ele, val) {
|
|
62
|
+
this.data.radios[val] = ele;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
handleFocus() {
|
|
66
|
+
const {
|
|
67
|
+
selectedValue,
|
|
68
|
+
options
|
|
69
|
+
} = this.props;
|
|
70
|
+
const firstRadioValue = options[0].value;
|
|
71
|
+
|
|
72
|
+
if (selectedValue) {
|
|
73
|
+
this.data.radios[selectedValue].focus();
|
|
74
|
+
} else {
|
|
75
|
+
this.data.radios[firstRadioValue].focus();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
28
79
|
render() {
|
|
29
80
|
let {
|
|
30
81
|
labelName,
|
|
@@ -46,6 +97,7 @@ export default class RadioField extends PureComponent {
|
|
|
46
97
|
validationRuleMessage,
|
|
47
98
|
validationRulePalette,
|
|
48
99
|
isReadOnly,
|
|
100
|
+
isBoxStyle,
|
|
49
101
|
variant,
|
|
50
102
|
customProps
|
|
51
103
|
} = this.props;
|
|
@@ -69,7 +121,7 @@ export default class RadioField extends PureComponent {
|
|
|
69
121
|
dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`,
|
|
70
122
|
...LabelProps
|
|
71
123
|
}), /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: `${style.fieldContainer} ${labelName ? style.fieldMargin_medium : ''} ${style.radioContainer}`
|
|
124
|
+
className: `${style.fieldContainer} ${isBoxStyle ? style.radiosWrapper : ''} ${labelName ? style.fieldMargin_medium : ''} ${style.radioContainer}`
|
|
73
125
|
}, options.map((option, index) => {
|
|
74
126
|
let {
|
|
75
127
|
text,
|
|
@@ -78,9 +130,11 @@ export default class RadioField extends PureComponent {
|
|
|
78
130
|
tooltip,
|
|
79
131
|
infoTooltip
|
|
80
132
|
} = option;
|
|
133
|
+
let isDisabledState = disabled || isDisabled;
|
|
134
|
+
let isChecked = selectedValue == value;
|
|
81
135
|
return /*#__PURE__*/React.createElement("span", {
|
|
82
136
|
key: index,
|
|
83
|
-
className: `${style.radio}`
|
|
137
|
+
className: `${!isBoxStyle ? style.radio : ''} ${style.radioWrap}`
|
|
84
138
|
}, /*#__PURE__*/React.createElement(Radio, {
|
|
85
139
|
id: index,
|
|
86
140
|
value: value,
|
|
@@ -88,17 +142,26 @@ export default class RadioField extends PureComponent {
|
|
|
88
142
|
text: text,
|
|
89
143
|
labelPalette: labelPalette,
|
|
90
144
|
labelSize: labelSize,
|
|
91
|
-
active: isActive,
|
|
92
|
-
disabled:
|
|
145
|
+
active: isActive || isBoxStyle && isChecked,
|
|
146
|
+
disabled: isDisabledState,
|
|
93
147
|
disabledTitle: tooltip,
|
|
94
148
|
title: tooltip,
|
|
95
149
|
onChange: this.handleChange,
|
|
150
|
+
getRef: this.updateData,
|
|
96
151
|
size: size,
|
|
97
|
-
checked:
|
|
152
|
+
checked: isChecked,
|
|
98
153
|
dataId: dataId,
|
|
99
154
|
isReadOnly: isReadOnly,
|
|
100
155
|
variant: variant,
|
|
101
|
-
...RadioProps
|
|
156
|
+
...RadioProps,
|
|
157
|
+
a11y: {
|
|
158
|
+
tabIndex: !!selectedValue ? isChecked ? '0' : '-1' : index === 0 ? '0' : '-1',
|
|
159
|
+
...RadioProps.a11y
|
|
160
|
+
},
|
|
161
|
+
customClass: {
|
|
162
|
+
customRadioWrap: isBoxStyle ? `${style.radioBox} ${!isDisabledState ? style.hoverableRadioBox : ''} ${isChecked ? style.radioBoxActive : ''}` : '',
|
|
163
|
+
...RadioProps.customClass
|
|
164
|
+
}
|
|
102
165
|
}, !!infoTooltip ? /*#__PURE__*/React.createElement(Icon, {
|
|
103
166
|
name: "ZD-GN-info",
|
|
104
167
|
size: "16",
|
|
@@ -2,8 +2,10 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
export const propTypes = {
|
|
3
3
|
dataId: PropTypes.string,
|
|
4
4
|
errorType: PropTypes.oneOf(['primary', 'secondary']),
|
|
5
|
+
getRef: PropTypes.func,
|
|
5
6
|
id: PropTypes.string,
|
|
6
7
|
isActive: PropTypes.bool,
|
|
8
|
+
isBoxStyle: PropTypes.bool,
|
|
7
9
|
isDisabled: PropTypes.bool,
|
|
8
10
|
isMandatory: PropTypes.bool,
|
|
9
11
|
isReadOnly: PropTypes.bool,
|
|
@@ -23,6 +25,7 @@ export const propTypes = {
|
|
|
23
25
|
customProps: PropTypes.shape({
|
|
24
26
|
LabelProps: PropTypes.object,
|
|
25
27
|
RadioProps: PropTypes.object,
|
|
28
|
+
InfoIconProps: PropTypes.object,
|
|
26
29
|
ValidationMessageProps1: PropTypes.object,
|
|
27
30
|
ValidationMessageProps2: PropTypes.object
|
|
28
31
|
}),
|
|
@@ -164,8 +164,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
164
164
|
const {
|
|
165
165
|
TextBoxIconProps = {},
|
|
166
166
|
TagWrapperProps = {},
|
|
167
|
-
TagProps = {}
|
|
168
|
-
listProps = {}
|
|
167
|
+
TagProps = {}
|
|
169
168
|
} = customProps;
|
|
170
169
|
return /*#__PURE__*/React.createElement("div", {
|
|
171
170
|
className: `${style.container} ${!isReadOnly ? ` ${needBorder ? style.hasBorder : ''}
|
|
@@ -299,8 +298,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
299
298
|
getRef: this.getSelectedItemRef,
|
|
300
299
|
isDisabled: listDisabled,
|
|
301
300
|
customProps: listItemProps,
|
|
302
|
-
customClass: listItemClass
|
|
303
|
-
...listProps
|
|
301
|
+
customClass: listItemClass
|
|
304
302
|
}, isNew ? /*#__PURE__*/React.createElement(Container, {
|
|
305
303
|
alignBox: "row",
|
|
306
304
|
align: "vertical"
|
|
@@ -48,12 +48,8 @@ class DepartmentDropDown extends Component {
|
|
|
48
48
|
onSearch,
|
|
49
49
|
needSearchFetching,
|
|
50
50
|
searchStr,
|
|
51
|
-
i18nKeys
|
|
52
|
-
customProps
|
|
51
|
+
i18nKeys
|
|
53
52
|
} = this.props;
|
|
54
|
-
const {
|
|
55
|
-
toggleDropDownProps = {}
|
|
56
|
-
} = customProps;
|
|
57
53
|
let {
|
|
58
54
|
title = 'Move Department',
|
|
59
55
|
searchEmptyText = 'No results found',
|
|
@@ -88,8 +84,7 @@ class DepartmentDropDown extends Component {
|
|
|
88
84
|
getNextOptions: getNextOptions,
|
|
89
85
|
isNextOptions: isNextOptions,
|
|
90
86
|
onSearch: onSearch,
|
|
91
|
-
needSearchFetching: needSearchFetching
|
|
92
|
-
...toggleDropDownProps
|
|
87
|
+
needSearchFetching: needSearchFetching
|
|
93
88
|
});
|
|
94
89
|
}
|
|
95
90
|
|
|
@@ -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: 3;
|
|
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:
|
|
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
|
-
.
|
|
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
|
|