@zohodesk/components 1.2.4 → 1.2.6
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/README.md +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/AppContainer/AppContainer.js +3 -0
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +137 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/AppContainer/AppContainer.js +5 -0
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +209 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**** Libraries ****/
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SelectWithAvatar_defaultProps } from '../../Select/props/defaultProps';
|
|
4
|
+
import { SelectWithAvatar_propTypes } from '../../Select/props/propTypes';
|
|
5
|
+
/**** Components ****/
|
|
6
|
+
|
|
7
|
+
import { SelectComponent } from './Select';
|
|
8
|
+
import Popup from '../Popup/Popup';
|
|
9
|
+
import Tag from '../Tag/Tag';
|
|
10
|
+
import Textbox from '../TextBox/TextBox';
|
|
11
|
+
import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
|
|
12
|
+
import { Container, Box } from '../Layout';
|
|
13
|
+
import Card, { CardContent, CardHeader } from '../Card/Card';
|
|
14
|
+
import Suggestions from '../MultiSelect/Suggestions';
|
|
15
|
+
import EmptyState from '../MultiSelect/EmptyState';
|
|
16
|
+
import DropDownHeading from '../DropDown/DropDownHeading';
|
|
17
|
+
import { getUniqueId } from '../../Provider/IdProvider';
|
|
18
|
+
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
19
|
+
import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
20
|
+
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
21
|
+
/**** CSS ****/
|
|
22
|
+
|
|
23
|
+
import style from '../../MultiSelect/MultiSelect.module.css';
|
|
24
|
+
import selectStyle from '../../Select/Select.module.css';
|
|
25
|
+
|
|
26
|
+
class SelectWithAvatarComponent extends SelectComponent {
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.isSelectWithAvatarComponent = true;
|
|
30
|
+
this.handleFormatOptions = this.handleFormatOptions.bind(this);
|
|
31
|
+
this.handleActive = this.handleActive.bind(this);
|
|
32
|
+
this.handleInactive = this.handleInactive.bind(this);
|
|
33
|
+
this.handleSearchChange = this.handleSearchChange.bind(this);
|
|
34
|
+
this.handleRemoveOption = this.handleRemoveOption.bind(this);
|
|
35
|
+
this.getNextAriaId = getUniqueId(this);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
handleFormatOptions(props) {
|
|
39
|
+
let {
|
|
40
|
+
options,
|
|
41
|
+
valueField,
|
|
42
|
+
textField,
|
|
43
|
+
imageField
|
|
44
|
+
} = props;
|
|
45
|
+
return this.formatOptions({
|
|
46
|
+
options,
|
|
47
|
+
valueField,
|
|
48
|
+
textField,
|
|
49
|
+
imageField,
|
|
50
|
+
optionType: 'avatar'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
handleActive(e) {
|
|
55
|
+
let {
|
|
56
|
+
isActive
|
|
57
|
+
} = this.state;
|
|
58
|
+
|
|
59
|
+
if (!isActive) {
|
|
60
|
+
this.setState({
|
|
61
|
+
isActive: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let {
|
|
66
|
+
target
|
|
67
|
+
} = e || {};
|
|
68
|
+
target && target.setSelectionRange(target, 0);
|
|
69
|
+
let {
|
|
70
|
+
onFocus
|
|
71
|
+
} = this.props;
|
|
72
|
+
onFocus && onFocus(this.state.searchStr);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
handleInactive() {
|
|
76
|
+
let {
|
|
77
|
+
isActive
|
|
78
|
+
} = this.state;
|
|
79
|
+
|
|
80
|
+
if (isActive) {
|
|
81
|
+
this.setState({
|
|
82
|
+
isActive: false
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
handleSearchChange(e) {
|
|
88
|
+
let {
|
|
89
|
+
isPopupOpen
|
|
90
|
+
} = this.props;
|
|
91
|
+
!isPopupOpen && this.togglePopup(e);
|
|
92
|
+
this.handleSearch(e);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
handleRemoveOption(e) {
|
|
96
|
+
let {
|
|
97
|
+
keyCode
|
|
98
|
+
} = e;
|
|
99
|
+
let {
|
|
100
|
+
searchStr = ''
|
|
101
|
+
} = this.state;
|
|
102
|
+
let {
|
|
103
|
+
isDefaultSelectValue
|
|
104
|
+
} = this.props;
|
|
105
|
+
|
|
106
|
+
if (keyCode === 8 && searchStr.length === 0 && !isDefaultSelectValue) {
|
|
107
|
+
this.handleChange('');
|
|
108
|
+
} else {
|
|
109
|
+
this.handleKeyDown(e);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
responsiveFunc(_ref) {
|
|
114
|
+
let {
|
|
115
|
+
mediaQueryOR
|
|
116
|
+
} = _ref;
|
|
117
|
+
return {
|
|
118
|
+
tabletMode: mediaQueryOR([{
|
|
119
|
+
maxWidth: 700
|
|
120
|
+
}])
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
render() {
|
|
125
|
+
let {
|
|
126
|
+
dropBoxSize,
|
|
127
|
+
emptyMessage,
|
|
128
|
+
searchEmptyMessage,
|
|
129
|
+
needBorder,
|
|
130
|
+
position,
|
|
131
|
+
defaultDropBoxPosition,
|
|
132
|
+
getContainerRef,
|
|
133
|
+
isPopupOpen,
|
|
134
|
+
removeClose,
|
|
135
|
+
isPopupReady,
|
|
136
|
+
animationStyle,
|
|
137
|
+
textBoxSize,
|
|
138
|
+
textBoxVariant,
|
|
139
|
+
maxLength,
|
|
140
|
+
isDisabled,
|
|
141
|
+
title,
|
|
142
|
+
size,
|
|
143
|
+
isReadOnly,
|
|
144
|
+
placeHolder,
|
|
145
|
+
className,
|
|
146
|
+
needResponsive,
|
|
147
|
+
dataId,
|
|
148
|
+
borderColor,
|
|
149
|
+
searchBoxPlaceHolder,
|
|
150
|
+
searchBoxSize,
|
|
151
|
+
needSearch,
|
|
152
|
+
textBoxClass,
|
|
153
|
+
onRemove,
|
|
154
|
+
avatarPalette,
|
|
155
|
+
tagSize,
|
|
156
|
+
groupName,
|
|
157
|
+
i18nKeys,
|
|
158
|
+
htmlId,
|
|
159
|
+
needEffect,
|
|
160
|
+
isLoading,
|
|
161
|
+
dataSelectorId
|
|
162
|
+
} = this.props;
|
|
163
|
+
i18nKeys = Object.assign({}, i18nKeys, {
|
|
164
|
+
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
165
|
+
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
166
|
+
});
|
|
167
|
+
let {
|
|
168
|
+
hoverIndex,
|
|
169
|
+
searchStr,
|
|
170
|
+
isFetchingOptions,
|
|
171
|
+
selectedId,
|
|
172
|
+
isActive,
|
|
173
|
+
options
|
|
174
|
+
} = this.state;
|
|
175
|
+
let suggestions = this.handleFilterSuggestions();
|
|
176
|
+
let {
|
|
177
|
+
id,
|
|
178
|
+
value: text,
|
|
179
|
+
photoURL
|
|
180
|
+
} = this.normalizedFormatOptions[selectedId] || {};
|
|
181
|
+
let setAriaId = this.getNextAriaId();
|
|
182
|
+
let ariaErrorId = this.getNextAriaId();
|
|
183
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
184
|
+
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''} ${className ? className : ''}`,
|
|
185
|
+
"data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
186
|
+
"data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
187
|
+
"data-title": isDisabled ? title : null,
|
|
188
|
+
"data-selector-id": dataSelectorId
|
|
189
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
190
|
+
align: "vertical",
|
|
191
|
+
alignBox: "row",
|
|
192
|
+
className: `${style.container} ${style[size]} ${style[`borderColor_${borderColor}`]} ${isActive && needBorder ? style.active : ''} ${textBoxClass ? textBoxClass : ''} ${needBorder ? style.hasBorder : ''}`,
|
|
193
|
+
eleRef: this.getTargetRef,
|
|
194
|
+
onClick: !isDisabled && this.togglePopup
|
|
195
|
+
}, selectedId ? /*#__PURE__*/React.createElement(Box, {
|
|
196
|
+
className: style.tag,
|
|
197
|
+
"data-id": `${dataId}_SelectTag`,
|
|
198
|
+
"data-test-id": `${dataId}_SelectTag`,
|
|
199
|
+
key: `${id}tag`
|
|
200
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
201
|
+
avatarPalette: avatarPalette,
|
|
202
|
+
hasAvatar: true,
|
|
203
|
+
id: id,
|
|
204
|
+
imageURL: photoURL,
|
|
205
|
+
initial: text,
|
|
206
|
+
onRemove: onRemove,
|
|
207
|
+
text: text,
|
|
208
|
+
disabled: isReadOnly || isDisabled,
|
|
209
|
+
size: tagSize
|
|
210
|
+
})) : null, /*#__PURE__*/React.createElement(Box, {
|
|
211
|
+
flexible: true,
|
|
212
|
+
className: style.textBox
|
|
213
|
+
}, /*#__PURE__*/React.createElement(Textbox, {
|
|
214
|
+
a11y: {
|
|
215
|
+
ariaActivedescendant: selectedId,
|
|
216
|
+
role: 'combobox',
|
|
217
|
+
ariaControls: setAriaId,
|
|
218
|
+
ariaOwns: setAriaId,
|
|
219
|
+
ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
|
|
220
|
+
ariaHaspopup: true,
|
|
221
|
+
ariaReadonly: true
|
|
222
|
+
},
|
|
223
|
+
isDisabled: isDisabled,
|
|
224
|
+
needEffect: isReadOnly || isDisabled ? false : true,
|
|
225
|
+
inputRef: this.valueInputRef,
|
|
226
|
+
maxLength: maxLength,
|
|
227
|
+
needBorder: false,
|
|
228
|
+
onBlur: this.handleInactive,
|
|
229
|
+
onChange: this.handleSearchChange,
|
|
230
|
+
onFocus: this.handleActive,
|
|
231
|
+
onKeyDown: this.handleRemoveOption,
|
|
232
|
+
onKeyPress: this.handleValueInputChange,
|
|
233
|
+
placeHolder: !selectedId ? placeHolder : '',
|
|
234
|
+
size: textBoxSize,
|
|
235
|
+
variant: textBoxVariant,
|
|
236
|
+
needReadOnlyStyle: isReadOnly ? true : false,
|
|
237
|
+
isReadOnly: true,
|
|
238
|
+
isClickable: isReadOnly || isDisabled ? false : true,
|
|
239
|
+
borderColor: borderColor,
|
|
240
|
+
htmlId: htmlId,
|
|
241
|
+
autoComplete: false
|
|
242
|
+
}))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
243
|
+
query: this.responsiveFunc,
|
|
244
|
+
responsiveId: "Helmet"
|
|
245
|
+
}, _ref2 => {
|
|
246
|
+
let {
|
|
247
|
+
tabletMode
|
|
248
|
+
} = _ref2;
|
|
249
|
+
return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
|
|
250
|
+
animationStyle: animationStyle,
|
|
251
|
+
boxPosition: position || `${defaultDropBoxPosition}Center`,
|
|
252
|
+
getRef: getContainerRef,
|
|
253
|
+
isActive: isPopupReady,
|
|
254
|
+
isAnimate: true,
|
|
255
|
+
isArrow: false,
|
|
256
|
+
onClick: removeClose,
|
|
257
|
+
needResponsive: needResponsive,
|
|
258
|
+
isPadding: false,
|
|
259
|
+
isResponsivePadding: true,
|
|
260
|
+
alignBox: "row"
|
|
261
|
+
}, isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
262
|
+
align: "both",
|
|
263
|
+
className: style.loader
|
|
264
|
+
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(Box, {
|
|
265
|
+
flexible: true
|
|
266
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
267
|
+
onScroll: this.handleScroll
|
|
268
|
+
}, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
|
|
269
|
+
className: `${selectStyle.search} ${selectStyle[size]}`
|
|
270
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
271
|
+
inputRef: this.searchInputRef,
|
|
272
|
+
maxLength: maxLength,
|
|
273
|
+
onChange: this.handleSearch,
|
|
274
|
+
onKeyDown: this.handleKeyDown,
|
|
275
|
+
placeHolder: searchBoxPlaceHolder,
|
|
276
|
+
size: searchBoxSize,
|
|
277
|
+
value: searchStr,
|
|
278
|
+
onClear: this.handleClearSearch,
|
|
279
|
+
dataId: `${dataId}_search`,
|
|
280
|
+
a11y: {
|
|
281
|
+
ariaAutocomplete: 'list',
|
|
282
|
+
ariaControls: setAriaId,
|
|
283
|
+
ariaDescribedby: ariaErrorId
|
|
284
|
+
},
|
|
285
|
+
autoComplete: false
|
|
286
|
+
}))) : null, /*#__PURE__*/React.createElement(CardContent, {
|
|
287
|
+
shrink: true,
|
|
288
|
+
customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
|
|
289
|
+
eleRef: this.suggestionContainerRef
|
|
290
|
+
}, groupName ? /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: style.title
|
|
292
|
+
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
293
|
+
text: groupName,
|
|
294
|
+
a11y: {
|
|
295
|
+
role: 'heading'
|
|
296
|
+
}
|
|
297
|
+
})) : null, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
|
|
298
|
+
activeId: selectedId,
|
|
299
|
+
suggestions: suggestions,
|
|
300
|
+
getRef: this.suggestionItemRef,
|
|
301
|
+
hoverOption: hoverIndex,
|
|
302
|
+
onClick: this.handleChange,
|
|
303
|
+
onMouseEnter: this.handleMouseEnter,
|
|
304
|
+
needTick: true,
|
|
305
|
+
needBorder: false,
|
|
306
|
+
selectedOptions: [selectedId],
|
|
307
|
+
className: selectStyle.listItemContainer,
|
|
308
|
+
htmlId: setAriaId,
|
|
309
|
+
a11y: {
|
|
310
|
+
ariaParentRole: 'listbox',
|
|
311
|
+
role: 'option'
|
|
312
|
+
}
|
|
313
|
+
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
314
|
+
isLoading: isFetchingOptions,
|
|
315
|
+
options: options,
|
|
316
|
+
searchString: searchStr,
|
|
317
|
+
suggestions: suggestions,
|
|
318
|
+
dataId: dataId,
|
|
319
|
+
i18nKeys: i18nKeys,
|
|
320
|
+
htmlId: ariaErrorId
|
|
321
|
+
}), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
|
|
322
|
+
isCover: false,
|
|
323
|
+
align: "both"
|
|
324
|
+
}, /*#__PURE__*/React.createElement(Loader, null))))));
|
|
325
|
+
}) : null);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
SelectWithAvatarComponent.propTypes = SelectWithAvatar_propTypes;
|
|
331
|
+
SelectWithAvatarComponent.defaultProps = SelectWithAvatar_defaultProps;
|
|
332
|
+
SelectWithAvatarComponent.displayName = 'SelectWithAvatar';
|
|
333
|
+
let SelectWithAvatar = Popup(SelectWithAvatarComponent);
|
|
334
|
+
SelectWithAvatar.defaultProps = SelectWithAvatarComponent.defaultProps;
|
|
335
|
+
SelectWithAvatar.propTypes = SelectWithAvatarComponent.propTypes; // if (__DOCS__) {
|
|
336
|
+
// SelectWithAvatar.docs = {
|
|
337
|
+
// componentGroup: 'Form Elements',
|
|
338
|
+
// folderName: 'Style Guide'
|
|
339
|
+
// };
|
|
340
|
+
// // eslint-disable-next-line react/forbid-foreign-prop-types
|
|
341
|
+
// SelectWithAvatar.propTypes = SelectWithAvatarComponent.propTypes;
|
|
342
|
+
// }
|
|
343
|
+
|
|
344
|
+
export default SelectWithAvatar;
|