@zohodesk/components 1.4.8 → 1.4.9
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 +6 -0
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +16 -8
- package/es/MultiSelect/AdvancedMultiSelect.js +13 -6
- package/es/MultiSelect/EmptyState.js +2 -1
- package/es/MultiSelect/MultiSelect.js +26 -15
- package/es/MultiSelect/MultiSelectWithAvatar.js +9 -2
- package/es/MultiSelect/SelectedOptions.js +4 -2
- package/es/MultiSelect/Suggestions.js +10 -2
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/es/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/es/MultiSelect/constants.js +6 -0
- package/es/MultiSelect/props/propTypes.js +15 -55
- package/es/utils/dropDownUtils.js +25 -6
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +94 -83
- package/lib/MultiSelect/AdvancedMultiSelect.js +16 -7
- package/lib/MultiSelect/EmptyState.js +3 -1
- package/lib/MultiSelect/MultiSelect.js +28 -15
- package/lib/MultiSelect/MultiSelectWithAvatar.js +11 -3
- package/lib/MultiSelect/SelectedOptions.js +4 -2
- package/lib/MultiSelect/Suggestions.js +10 -2
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/lib/MultiSelect/constants.js +13 -0
- package/lib/MultiSelect/props/propTypes.js +14 -55
- package/lib/utils/dropDownUtils.js +24 -3
- package/package.json +7 -6
|
@@ -15,6 +15,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
15
15
|
|
|
16
16
|
var _defaultProps2 = require("./MobileHeader/props/defaultProps");
|
|
17
17
|
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
18
20
|
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
19
21
|
|
|
20
22
|
var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
|
|
@@ -316,11 +318,13 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
316
318
|
}, {
|
|
317
319
|
key: "handleGetSelectedOptions",
|
|
318
320
|
value: function handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, props) {
|
|
319
|
-
var allowValueFallback = props.allowValueFallback
|
|
321
|
+
var allowValueFallback = props.allowValueFallback,
|
|
322
|
+
limit = props.limit;
|
|
320
323
|
return this.getSelectedOptions({
|
|
321
324
|
selectedOptions: selectedOptions,
|
|
322
325
|
normalizedFormatOptions: normalizedFormatOptions,
|
|
323
|
-
allowValueFallback: allowValueFallback
|
|
326
|
+
allowValueFallback: allowValueFallback,
|
|
327
|
+
limit: limit
|
|
324
328
|
});
|
|
325
329
|
}
|
|
326
330
|
}, {
|
|
@@ -393,7 +397,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
393
397
|
getNextOptions = _this$props5.getNextOptions,
|
|
394
398
|
isPopupOpen = _this$props5.isPopupOpen,
|
|
395
399
|
isPopupOpenOnEnter = _this$props5.isPopupOpenOnEnter,
|
|
396
|
-
onKeyDown = _this$props5.onKeyDown
|
|
400
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
401
|
+
limit = _this$props5.limit;
|
|
402
|
+
var allowKeyboardActions = !limit || limit && selectedOptions.length < limit;
|
|
397
403
|
var highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
398
404
|
|
|
399
405
|
if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
|
|
@@ -413,7 +419,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
413
419
|
|
|
414
420
|
var suggestionsLen = suggestions.length;
|
|
415
421
|
|
|
416
|
-
if (suggestionsLen && isPopupOpen && keyCode === 38) {
|
|
422
|
+
if (suggestionsLen && isPopupOpen && keyCode === 38 && allowKeyboardActions) {
|
|
417
423
|
//up arrow
|
|
418
424
|
|
|
419
425
|
/*if (hoverOption === 0) { //disable first to last option higlight
|
|
@@ -424,7 +430,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
424
430
|
hoverOption: hoverOption - 1
|
|
425
431
|
});
|
|
426
432
|
}
|
|
427
|
-
} else if (suggestionsLen && isPopupOpen && keyCode === 40) {
|
|
433
|
+
} else if (suggestionsLen && isPopupOpen && keyCode === 40 && allowKeyboardActions) {
|
|
428
434
|
//down arrow
|
|
429
435
|
|
|
430
436
|
/*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
|
|
@@ -441,8 +447,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
441
447
|
hoverOption: hoverOption + 1
|
|
442
448
|
});
|
|
443
449
|
}
|
|
444
|
-
} else if (keyCode === 13) {
|
|
445
|
-
//enter
|
|
450
|
+
} else if (keyCode === 13 && allowKeyboardActions) {
|
|
451
|
+
//enter ke
|
|
446
452
|
var selectedOption = suggestions[hoverOption] || {};
|
|
447
453
|
var id = selectedOption.id;
|
|
448
454
|
isPopupOpen && !(0, _Common.getIsEmptyValue)(id) && this.handleSelectOption(id, e);
|
|
@@ -809,12 +815,14 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
809
815
|
togglePopup = _this$props10.togglePopup,
|
|
810
816
|
propSelectedOptions = _this$props10.selectedOptions,
|
|
811
817
|
_this$props10$disable = _this$props10.disabledOptions,
|
|
812
|
-
disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable
|
|
818
|
+
disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable,
|
|
819
|
+
limit = _this$props10.limit;
|
|
813
820
|
|
|
814
821
|
var _filterSelectedOption = (0, _dropDownUtils.filterSelectedOptions)({
|
|
815
822
|
selectedOptions: selectedOptions,
|
|
816
823
|
propSelectedOptions: propSelectedOptions,
|
|
817
|
-
disabledOptions: disabledOptions
|
|
824
|
+
disabledOptions: disabledOptions,
|
|
825
|
+
limit: limit
|
|
818
826
|
}),
|
|
819
827
|
newSelectedOptions = _filterSelectedOption.newSelectedOptions;
|
|
820
828
|
|
|
@@ -973,9 +981,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
973
981
|
highLightedSelectOptions = _this$state8.highLightedSelectOptions,
|
|
974
982
|
searchStr = _this$state8.searchStr;
|
|
975
983
|
var _i18nKeys$clearText = i18nKeys.clearText,
|
|
976
|
-
clearText = _i18nKeys$clearText === void 0 ?
|
|
984
|
+
clearText = _i18nKeys$clearText === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _i18nKeys$clearText;
|
|
977
985
|
var _a11y$clearLabel = a11y.clearLabel,
|
|
978
|
-
clearLabel = _a11y$clearLabel === void 0 ?
|
|
986
|
+
clearLabel = _a11y$clearLabel === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearLabel : _a11y$clearLabel,
|
|
979
987
|
ariaLabelledby = a11y.ariaLabelledby;
|
|
980
988
|
|
|
981
989
|
var _this$getIsShowClearI = this.getIsShowClearIcon({
|
|
@@ -1110,7 +1118,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1110
1118
|
boxSize = _this$props15.boxSize,
|
|
1111
1119
|
isLoading = _this$props15.isLoading,
|
|
1112
1120
|
selectAllText = _this$props15.selectAllText,
|
|
1113
|
-
needSelectAll = _this$props15.needSelectAll
|
|
1121
|
+
needSelectAll = _this$props15.needSelectAll,
|
|
1122
|
+
limit = _this$props15.limit;
|
|
1114
1123
|
var _this$state9 = this.state,
|
|
1115
1124
|
selectedOptions = _this$state9.selectedOptions,
|
|
1116
1125
|
searchStr = _this$state9.searchStr,
|
|
@@ -1120,7 +1129,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1120
1129
|
selectedOptionIds = _this$state9.selectedOptionIds;
|
|
1121
1130
|
var _i18nKeys = i18nKeys,
|
|
1122
1131
|
_i18nKeys$searchText = _i18nKeys.searchText,
|
|
1123
|
-
searchText = _i18nKeys$searchText === void 0 ?
|
|
1132
|
+
searchText = _i18nKeys$searchText === void 0 ? _constants.MULTISELECT_I18N_KEYS.searchText : _i18nKeys$searchText,
|
|
1133
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
1134
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
1124
1135
|
var suggestions = this.handleFilterSuggestions();
|
|
1125
1136
|
var setAriaId = this.getNextAriaId();
|
|
1126
1137
|
var ariaErrorId = this.getNextAriaId();
|
|
@@ -1173,7 +1184,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1173
1184
|
onClick: this.handlePopupClose
|
|
1174
1185
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1175
1186
|
className: _MultiSelectModule["default"].effect
|
|
1176
|
-
}, this.getSelectionUI(true))) : null, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1187
|
+
}, this.getSelectionUI(true))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1177
1188
|
onSelect: this.handleSelectAll,
|
|
1178
1189
|
selectAllText: selectAllText,
|
|
1179
1190
|
suggestions: suggestions,
|
|
@@ -1199,7 +1210,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1199
1210
|
selectedOptions: selectedOptionIds,
|
|
1200
1211
|
a11y: {
|
|
1201
1212
|
role: 'option'
|
|
1202
|
-
}
|
|
1213
|
+
},
|
|
1214
|
+
limit: limit,
|
|
1215
|
+
limitReachedMessage: limitReachedMessage
|
|
1203
1216
|
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
1204
1217
|
isLoading: isFetchingOptions,
|
|
1205
1218
|
options: options,
|
|
@@ -15,6 +15,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
15
15
|
|
|
16
16
|
var _defaultProps2 = require("./MobileHeader/props/defaultProps");
|
|
17
17
|
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
18
20
|
var _MultiSelect = require("./MultiSelect");
|
|
19
21
|
|
|
20
22
|
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
@@ -151,9 +153,13 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
151
153
|
needEffect = _this$props.needEffect,
|
|
152
154
|
isLoading = _this$props.isLoading,
|
|
153
155
|
keepSelectedOptions = _this$props.keepSelectedOptions,
|
|
154
|
-
customProps = _this$props.customProps
|
|
156
|
+
customProps = _this$props.customProps,
|
|
157
|
+
limit = _this$props.limit;
|
|
155
158
|
var _customProps$Suggesti = customProps.SuggestionsProps,
|
|
156
159
|
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
|
|
160
|
+
var _i18nKeys = i18nKeys,
|
|
161
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
162
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
157
163
|
i18nKeys = Object.assign({}, _defaultProps2.defaultProps.i18nKeys, i18nKeys, {
|
|
158
164
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
159
165
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
@@ -213,7 +219,7 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
213
219
|
onClick: this.handlePopupClose
|
|
214
220
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
215
221
|
className: _MultiSelectModule["default"].effect
|
|
216
|
-
}, this.getSelectionUI(true)))) : null, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
222
|
+
}, this.getSelectionUI(true)))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
217
223
|
onSelect: this.handleSelectAll,
|
|
218
224
|
selectAllText: selectAllText,
|
|
219
225
|
suggestions: suggestions,
|
|
@@ -238,7 +244,9 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
238
244
|
selectedOptions: selectedOptionIds,
|
|
239
245
|
a11y: {
|
|
240
246
|
role: 'option'
|
|
241
|
-
}
|
|
247
|
+
},
|
|
248
|
+
limit: limit,
|
|
249
|
+
limitReachedMessage: limitReachedMessage
|
|
242
250
|
}, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
243
251
|
isLoading: isFetchingOptions,
|
|
244
252
|
options: options,
|
|
@@ -67,9 +67,11 @@ var SelectedOptions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
67
|
onSelect = _this$props.onSelect,
|
|
68
68
|
size = _this$props.size,
|
|
69
69
|
palette = _this$props.palette,
|
|
70
|
-
dataId = _this$props.dataId
|
|
70
|
+
dataId = _this$props.dataId,
|
|
71
|
+
limit = _this$props.limit;
|
|
71
72
|
var isDarkPalette = palette === 'dark' ? 'dark' : 'danger';
|
|
72
|
-
|
|
73
|
+
var selectedData = limit && limit > 0 ? selectedOptions.slice(0, limit) : selectedOptions;
|
|
74
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedData.map(function (option) {
|
|
73
75
|
var id = option.id,
|
|
74
76
|
value = option.value,
|
|
75
77
|
photoURL = option.photoURL,
|
|
@@ -84,9 +84,12 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
84
84
|
palette = _this$props.palette,
|
|
85
85
|
htmlId = _this$props.htmlId,
|
|
86
86
|
a11y = _this$props.a11y,
|
|
87
|
-
needMultiLineText = _this$props.needMultiLineText
|
|
87
|
+
needMultiLineText = _this$props.needMultiLineText,
|
|
88
|
+
limit = _this$props.limit,
|
|
89
|
+
limitReachedMessage = _this$props.limitReachedMessage;
|
|
88
90
|
var ariaParentRole = a11y.ariaParentRole,
|
|
89
91
|
ariaMultiselectable = a11y.ariaMultiselectable;
|
|
92
|
+
var selectedOptionsLength = selectedOptions.length;
|
|
90
93
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
91
94
|
isCover: false,
|
|
92
95
|
role: ariaParentRole,
|
|
@@ -110,6 +113,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
110
113
|
listItemCustomProps = _suggestion$listItemC === void 0 ? {} : _suggestion$listItemC;
|
|
111
114
|
var isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
|
|
112
115
|
var isHighlight = hoverOption === index || id === hoverId ? true : false;
|
|
116
|
+
var isLimitReached = selectedOptionsLength >= limit && !isActive;
|
|
113
117
|
var list_a11y = Object.assign({}, a11y, {
|
|
114
118
|
ariaSelected: isActive,
|
|
115
119
|
ariaLabel: value,
|
|
@@ -117,7 +121,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
121
|
});
|
|
118
122
|
|
|
119
123
|
var commonProps = _objectSpread({
|
|
120
|
-
isDisabled: isDisabled,
|
|
124
|
+
isDisabled: isDisabled ? isDisabled : isLimitReached,
|
|
121
125
|
needMultiLineText: needMultiLineText
|
|
122
126
|
}, listItemCustomProps);
|
|
123
127
|
|
|
@@ -127,6 +131,10 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
127
131
|
};
|
|
128
132
|
}
|
|
129
133
|
|
|
134
|
+
if (isLimitReached) {
|
|
135
|
+
commonProps.disableTitle = limitReachedMessage;
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
if (optionType === 'avatar') {
|
|
131
139
|
return /*#__PURE__*/_react["default"].createElement(_ListItemWithAvatar["default"], _extends({}, commonProps, {
|
|
132
140
|
autoHover: false,
|
|
@@ -8,6 +8,8 @@ var _MultiSelect = _interopRequireDefault(require("../MultiSelect"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
|
|
11
|
+
var testData = ['text1', 'text2', 'text3', 'text4', 'text5', 'text6', 'text7', 'text8', 'text9', 'text10'];
|
|
12
|
+
var testSelectedData = ['text1', 'text2', 'text3'];
|
|
11
13
|
describe('MultiSelect', function () {
|
|
12
14
|
test('rendering the defult props', function () {
|
|
13
15
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_MultiSelect["default"], null)),
|
|
@@ -15,4 +17,27 @@ describe('MultiSelect', function () {
|
|
|
15
17
|
|
|
16
18
|
expect(asFragment()).toMatchSnapshot();
|
|
17
19
|
});
|
|
20
|
+
test('rendering with limit feature', function () {
|
|
21
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_MultiSelect["default"], {
|
|
22
|
+
valueField: "id",
|
|
23
|
+
textField: "text",
|
|
24
|
+
options: testData,
|
|
25
|
+
selectedOptions: testSelectedData,
|
|
26
|
+
needSelectAll: true,
|
|
27
|
+
selectAllText: "Select All",
|
|
28
|
+
placeHolder: "Select Text",
|
|
29
|
+
i18nKeys: {
|
|
30
|
+
clearText: 'Clear Selected Items',
|
|
31
|
+
loadingText: 'Fetching...',
|
|
32
|
+
emptyText: 'No Options .',
|
|
33
|
+
noMoreText: 'No More Options .',
|
|
34
|
+
searchEmptyText: 'No Matches Found .'
|
|
35
|
+
},
|
|
36
|
+
needResponsive: true,
|
|
37
|
+
limit: 3
|
|
38
|
+
})),
|
|
39
|
+
asFragment = _render2.asFragment;
|
|
40
|
+
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
18
43
|
});
|
|
@@ -8,6 +8,53 @@ var _Suggestions = _interopRequireDefault(require("../Suggestions"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
|
|
11
|
+
var sampleData = [{
|
|
12
|
+
"id": 2,
|
|
13
|
+
"value": "text2",
|
|
14
|
+
"optionType": "default",
|
|
15
|
+
"listItemProps": {
|
|
16
|
+
"style": {
|
|
17
|
+
"color": "red"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
"id": 3,
|
|
22
|
+
"value": "text3",
|
|
23
|
+
"optionType": "default",
|
|
24
|
+
"listItemProps": {
|
|
25
|
+
"style": {
|
|
26
|
+
"color": "blue"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
"id": 4,
|
|
31
|
+
"value": "text4",
|
|
32
|
+
"optionType": "default"
|
|
33
|
+
}, {
|
|
34
|
+
"id": 5,
|
|
35
|
+
"value": "text5",
|
|
36
|
+
"optionType": "default"
|
|
37
|
+
}, {
|
|
38
|
+
"id": 6,
|
|
39
|
+
"value": "text6",
|
|
40
|
+
"optionType": "default"
|
|
41
|
+
}, {
|
|
42
|
+
"id": 7,
|
|
43
|
+
"value": "text7",
|
|
44
|
+
"optionType": "default"
|
|
45
|
+
}, {
|
|
46
|
+
"id": 8,
|
|
47
|
+
"value": "text8",
|
|
48
|
+
"optionType": "default"
|
|
49
|
+
}, {
|
|
50
|
+
"id": 9,
|
|
51
|
+
"value": "text9",
|
|
52
|
+
"optionType": "default"
|
|
53
|
+
}, {
|
|
54
|
+
"id": 10,
|
|
55
|
+
"value": "text10",
|
|
56
|
+
"optionType": "default"
|
|
57
|
+
}];
|
|
11
58
|
describe('Suggestions', function () {
|
|
12
59
|
test('rendering the defult props', function () {
|
|
13
60
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
@@ -17,4 +64,15 @@ describe('Suggestions', function () {
|
|
|
17
64
|
|
|
18
65
|
expect(asFragment()).toMatchSnapshot();
|
|
19
66
|
});
|
|
67
|
+
test('rendering with limit props', function () {
|
|
68
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
69
|
+
selectedOptions: [1, 2, 3, 4],
|
|
70
|
+
suggestions: sampleData,
|
|
71
|
+
limit: 3,
|
|
72
|
+
limitReachedMessage: "Limit Reached"
|
|
73
|
+
})),
|
|
74
|
+
asFragment = _render2.asFragment;
|
|
75
|
+
|
|
76
|
+
expect(asFragment()).toMatchSnapshot();
|
|
77
|
+
});
|
|
20
78
|
});
|
|
@@ -84,3 +84,256 @@ exports[`MultiSelect rendering the defult props 1`] = `
|
|
|
84
84
|
</div>
|
|
85
85
|
</DocumentFragment>
|
|
86
86
|
`;
|
|
87
|
+
|
|
88
|
+
exports[`MultiSelect rendering with limit feature 1`] = `
|
|
89
|
+
<DocumentFragment>
|
|
90
|
+
<div
|
|
91
|
+
class="wrapper effect"
|
|
92
|
+
data-id="multiSelect"
|
|
93
|
+
data-selector-id="multiSelect"
|
|
94
|
+
data-test-id="multiSelect"
|
|
95
|
+
>
|
|
96
|
+
<div
|
|
97
|
+
class="container medium borderColor_default hasBorder flex cover rowdir wrap vCenter"
|
|
98
|
+
data-id="containerComponent"
|
|
99
|
+
data-selector-id="container"
|
|
100
|
+
data-test-id="containerComponent"
|
|
101
|
+
>
|
|
102
|
+
<div
|
|
103
|
+
class="tag medium shrinkOff"
|
|
104
|
+
data-id="multiSelect_selectedOptions"
|
|
105
|
+
data-selector-id="box"
|
|
106
|
+
data-test-id="multiSelect_selectedOptions"
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
aria-labelledby="5"
|
|
110
|
+
class="container effect medium lgRadius danger pointer "
|
|
111
|
+
data-id="tag_Tag"
|
|
112
|
+
data-selector-id="tag"
|
|
113
|
+
data-test-id="tag_Tag"
|
|
114
|
+
data-title="text1"
|
|
115
|
+
tabindex="0"
|
|
116
|
+
>
|
|
117
|
+
<div
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
class="text mediumtext"
|
|
120
|
+
id="5"
|
|
121
|
+
>
|
|
122
|
+
text1
|
|
123
|
+
</div>
|
|
124
|
+
<button
|
|
125
|
+
aria-label="Delete"
|
|
126
|
+
class="buttonReset close
|
|
127
|
+
lgRadiusClose
|
|
128
|
+
closedanger"
|
|
129
|
+
data-id="tag_RemoveTag"
|
|
130
|
+
data-test-id="tag_RemoveTag"
|
|
131
|
+
type="button"
|
|
132
|
+
value="text"
|
|
133
|
+
>
|
|
134
|
+
<div
|
|
135
|
+
class="flex cover coldir both"
|
|
136
|
+
data-id="containerComponent"
|
|
137
|
+
data-selector-id="container"
|
|
138
|
+
data-test-id="containerComponent"
|
|
139
|
+
>
|
|
140
|
+
<i
|
|
141
|
+
aria-hidden="true"
|
|
142
|
+
class="zd_font_icons basic icon-close2 fbold "
|
|
143
|
+
data-id="fontIcon"
|
|
144
|
+
data-selector-id="fontIcon"
|
|
145
|
+
data-test-id="fontIcon"
|
|
146
|
+
style="--zd-iconfont-size: var(--zd_font_size8);"
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</button>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div
|
|
153
|
+
class="tag medium shrinkOff"
|
|
154
|
+
data-id="multiSelect_selectedOptions"
|
|
155
|
+
data-selector-id="box"
|
|
156
|
+
data-test-id="multiSelect_selectedOptions"
|
|
157
|
+
>
|
|
158
|
+
<div
|
|
159
|
+
aria-labelledby="6"
|
|
160
|
+
class="container effect medium lgRadius danger pointer "
|
|
161
|
+
data-id="tag_Tag"
|
|
162
|
+
data-selector-id="tag"
|
|
163
|
+
data-test-id="tag_Tag"
|
|
164
|
+
data-title="text2"
|
|
165
|
+
tabindex="0"
|
|
166
|
+
>
|
|
167
|
+
<div
|
|
168
|
+
aria-hidden="true"
|
|
169
|
+
class="text mediumtext"
|
|
170
|
+
id="6"
|
|
171
|
+
>
|
|
172
|
+
text2
|
|
173
|
+
</div>
|
|
174
|
+
<button
|
|
175
|
+
aria-label="Delete"
|
|
176
|
+
class="buttonReset close
|
|
177
|
+
lgRadiusClose
|
|
178
|
+
closedanger"
|
|
179
|
+
data-id="tag_RemoveTag"
|
|
180
|
+
data-test-id="tag_RemoveTag"
|
|
181
|
+
type="button"
|
|
182
|
+
value="text"
|
|
183
|
+
>
|
|
184
|
+
<div
|
|
185
|
+
class="flex cover coldir both"
|
|
186
|
+
data-id="containerComponent"
|
|
187
|
+
data-selector-id="container"
|
|
188
|
+
data-test-id="containerComponent"
|
|
189
|
+
>
|
|
190
|
+
<i
|
|
191
|
+
aria-hidden="true"
|
|
192
|
+
class="zd_font_icons basic icon-close2 fbold "
|
|
193
|
+
data-id="fontIcon"
|
|
194
|
+
data-selector-id="fontIcon"
|
|
195
|
+
data-test-id="fontIcon"
|
|
196
|
+
style="--zd-iconfont-size: var(--zd_font_size8);"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
<div
|
|
203
|
+
class="tag medium shrinkOff"
|
|
204
|
+
data-id="multiSelect_selectedOptions"
|
|
205
|
+
data-selector-id="box"
|
|
206
|
+
data-test-id="multiSelect_selectedOptions"
|
|
207
|
+
>
|
|
208
|
+
<div
|
|
209
|
+
aria-labelledby="7"
|
|
210
|
+
class="container effect medium lgRadius danger pointer "
|
|
211
|
+
data-id="tag_Tag"
|
|
212
|
+
data-selector-id="tag"
|
|
213
|
+
data-test-id="tag_Tag"
|
|
214
|
+
data-title="text3"
|
|
215
|
+
tabindex="0"
|
|
216
|
+
>
|
|
217
|
+
<div
|
|
218
|
+
aria-hidden="true"
|
|
219
|
+
class="text mediumtext"
|
|
220
|
+
id="7"
|
|
221
|
+
>
|
|
222
|
+
text3
|
|
223
|
+
</div>
|
|
224
|
+
<button
|
|
225
|
+
aria-label="Delete"
|
|
226
|
+
class="buttonReset close
|
|
227
|
+
lgRadiusClose
|
|
228
|
+
closedanger"
|
|
229
|
+
data-id="tag_RemoveTag"
|
|
230
|
+
data-test-id="tag_RemoveTag"
|
|
231
|
+
type="button"
|
|
232
|
+
value="text"
|
|
233
|
+
>
|
|
234
|
+
<div
|
|
235
|
+
class="flex cover coldir both"
|
|
236
|
+
data-id="containerComponent"
|
|
237
|
+
data-selector-id="container"
|
|
238
|
+
data-test-id="containerComponent"
|
|
239
|
+
>
|
|
240
|
+
<i
|
|
241
|
+
aria-hidden="true"
|
|
242
|
+
class="zd_font_icons basic icon-close2 fbold "
|
|
243
|
+
data-id="fontIcon"
|
|
244
|
+
data-selector-id="fontIcon"
|
|
245
|
+
data-test-id="fontIcon"
|
|
246
|
+
style="--zd-iconfont-size: var(--zd_font_size8);"
|
|
247
|
+
/>
|
|
248
|
+
</div>
|
|
249
|
+
</button>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
<div
|
|
253
|
+
class="wrapper grow basisAuto shrinkOn"
|
|
254
|
+
data-id="boxComponent"
|
|
255
|
+
data-selector-id="box"
|
|
256
|
+
data-test-id="boxComponent"
|
|
257
|
+
>
|
|
258
|
+
<span
|
|
259
|
+
class=" custmSpan custmSpanMedium clearIconSpace
|
|
260
|
+
"
|
|
261
|
+
/>
|
|
262
|
+
<div
|
|
263
|
+
class="container effect custmInputWrapper flex rowdir"
|
|
264
|
+
data-id="containerComponent"
|
|
265
|
+
data-selector-id="textBoxIcon"
|
|
266
|
+
data-test-id="containerComponent"
|
|
267
|
+
>
|
|
268
|
+
<div
|
|
269
|
+
class="grow basis shrinkOff"
|
|
270
|
+
data-id="boxComponent"
|
|
271
|
+
data-selector-id="box"
|
|
272
|
+
data-test-id="boxComponent"
|
|
273
|
+
>
|
|
274
|
+
<input
|
|
275
|
+
aria-expanded="false"
|
|
276
|
+
aria-haspopup="true"
|
|
277
|
+
aria-required="true"
|
|
278
|
+
autocomplete="off"
|
|
279
|
+
class=" container medium default effect borderColor_default "
|
|
280
|
+
data-id="multiSelect_textBox"
|
|
281
|
+
data-selector-id="textBoxIcon"
|
|
282
|
+
data-test-id="multiSelect_textBox"
|
|
283
|
+
maxlength="250"
|
|
284
|
+
placeholder=""
|
|
285
|
+
role="combobox"
|
|
286
|
+
type="text"
|
|
287
|
+
value=""
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
<div
|
|
291
|
+
class="iconContainer shrinkOff"
|
|
292
|
+
data-id="boxComponent"
|
|
293
|
+
data-selector-id="box"
|
|
294
|
+
data-test-id="boxComponent"
|
|
295
|
+
>
|
|
296
|
+
<div
|
|
297
|
+
class="flex cover rowdir"
|
|
298
|
+
data-id="containerComponent"
|
|
299
|
+
data-selector-id="container"
|
|
300
|
+
data-test-id="containerComponent"
|
|
301
|
+
>
|
|
302
|
+
<div
|
|
303
|
+
class="icon shrinkOff"
|
|
304
|
+
data-id="boxComponent"
|
|
305
|
+
data-selector-id="box"
|
|
306
|
+
data-test-id="boxComponent"
|
|
307
|
+
>
|
|
308
|
+
<div
|
|
309
|
+
class="rightPlaceholder inflex rowdir vCenter"
|
|
310
|
+
data-id="containerComponent"
|
|
311
|
+
data-selector-id="container"
|
|
312
|
+
data-test-id="containerComponent"
|
|
313
|
+
>
|
|
314
|
+
<button
|
|
315
|
+
class="delete defaultDelete shrinkOff"
|
|
316
|
+
data-id="multiSelect_clearIcon"
|
|
317
|
+
data-selector-id="box"
|
|
318
|
+
data-test-id="multiSelect_clearIcon"
|
|
319
|
+
data-title="Clear Selected Items"
|
|
320
|
+
>
|
|
321
|
+
<i
|
|
322
|
+
aria-hidden="true"
|
|
323
|
+
class="zd_font_icons basic icon-delete rtl "
|
|
324
|
+
data-id="fontIcon"
|
|
325
|
+
data-selector-id="fontIcon"
|
|
326
|
+
data-test-id="fontIcon"
|
|
327
|
+
style="--zd-iconfont-size: var(--zd_font_size15);"
|
|
328
|
+
/>
|
|
329
|
+
</button>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
</DocumentFragment>
|
|
339
|
+
`;
|