@zohodesk/components 1.4.8 → 1.4.10-exp.1
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 +11 -0
- package/es/AppContainer/AppContainer.js +1 -0
- package/es/AppContainer/AppContainer.module.css +3 -2
- package/es/Button/css/Button.module.css +13 -4
- package/es/DateTime/DateTime.module.css +12 -9
- package/es/DateTime/YearView.module.css +1 -1
- package/es/Heading/Heading.module.css +0 -1
- package/es/Label/Label.module.css +8 -8
- 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/MultiSelect.module.css +1 -1
- 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/Select/SelectWithIcon.js +1 -1
- package/es/Select/__tests__/Select.spec.js +16 -8
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +281 -0
- package/es/Tab/Tabs.module.css +1 -1
- package/es/TextBox/TextBox.module.css +4 -4
- package/es/Textarea/Textarea.module.css +1 -1
- package/es/Tooltip/Tooltip.module.css +1 -1
- package/es/Typography/css/Typography.module.css +4 -4
- package/es/common/basic.module.css +39 -6
- package/es/common/basicReset.module.css +2 -2
- package/es/common/common.module.css +5 -5
- package/es/utils/Common.js +1 -1
- package/es/utils/dropDownUtils.js +25 -6
- package/es/v1/Tab/v1Tabs.module.css +1 -1
- package/es/v1/Typography/css/v1_Typography.module.css +4 -4
- package/lib/AppContainer/AppContainer.js +2 -0
- package/lib/AppContainer/AppContainer.module.css +3 -2
- package/lib/Button/css/Button.module.css +13 -4
- package/lib/DateTime/DateTime.module.css +12 -9
- package/lib/DateTime/YearView.module.css +1 -1
- package/lib/Heading/Heading.module.css +0 -1
- package/lib/Label/Label.module.css +8 -8
- 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/MultiSelect.module.css +1 -1
- 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/Select/SelectWithIcon.js +1 -1
- package/lib/Select/__tests__/Select.spec.js +165 -155
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +281 -0
- package/lib/Tab/Tabs.module.css +1 -1
- package/lib/TextBox/TextBox.module.css +4 -4
- package/lib/Textarea/Textarea.module.css +1 -1
- package/lib/Tooltip/Tooltip.module.css +1 -1
- package/lib/Typography/css/Typography.module.css +4 -4
- package/lib/common/basic.module.css +39 -6
- package/lib/common/basicReset.module.css +2 -2
- package/lib/common/common.module.css +5 -5
- package/lib/utils/Common.js +1 -1
- package/lib/utils/dropDownUtils.js +24 -3
- package/lib/v1/Tab/v1Tabs.module.css +1 -1
- package/lib/v1/Typography/css/v1_Typography.module.css +4 -4
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
|
|
4
4
|
|
|
5
|
+
# 1.4.10
|
|
6
|
+
|
|
7
|
+
- **Select, MultiSelect**
|
|
8
|
+
- Searching with leading spaces is not reflected the results correctly. Issue Fixed.
|
|
9
|
+
|
|
10
|
+
# 1.4.9
|
|
11
|
+
|
|
12
|
+
- **MultiSelect , MultiSelectWithAvatar, AdvancedMultiSelect, AdvancedGroupMultiSelect**
|
|
13
|
+
- `limit` prop supported
|
|
14
|
+
- `limitReachedMessage` prop supported in i18nKeys
|
|
15
|
+
|
|
5
16
|
# 1.4.8
|
|
6
17
|
|
|
7
18
|
- Added UNSAFE_ prefix to deprecated lifecycle methods: componentWillMount, componentWillReceiveProps, and componentWillUpdate.
|
|
@@ -9,6 +9,7 @@ import '@zohodesk/variables/assets/dotVariables.module.css';
|
|
|
9
9
|
import '@zohodesk/variables/assets/sizeVariables.module.css';
|
|
10
10
|
import '@zohodesk/variables/assets/fontsizeVariables.module.css';
|
|
11
11
|
import '@zohodesk/variables/es/fontFamilyVariables.module.css';
|
|
12
|
+
import '@zohodesk/variables/es/fontWeightVariables.module.css';
|
|
12
13
|
import '@zohodesk/variables/assets/transitionVariables.module.css';
|
|
13
14
|
import '@zohodesk/variables/assets/no_transitionVariables.module.css';
|
|
14
15
|
import "../common/a11y.module.css";
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
-moz-box-sizing: border-box;
|
|
9
9
|
-ms-box-sizing: border-box;
|
|
10
10
|
}
|
|
11
|
-
.container {
|
|
12
|
-
font-family: var(--zd_regular);
|
|
11
|
+
.container, .container button, .container input, .container textarea ,.container select {
|
|
12
|
+
/* font-family: var(--zd_regular); */
|
|
13
|
+
font-family: var(--zd-font-family, ZDLato);
|
|
13
14
|
}
|
|
14
15
|
.tooltip {
|
|
15
16
|
height: 0 ;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--button_cursor: pointer;
|
|
6
6
|
--button_font_size: var(--zd_font_size13);
|
|
7
7
|
--button_text_color: var(--zdt_button_default_text);
|
|
8
|
-
--
|
|
8
|
+
--button_font_weight: var(--zd-fw-normal);
|
|
9
9
|
--button_text_transform: capitalize;
|
|
10
10
|
--button_bg_color: var(--zdt_button_default_bg);
|
|
11
11
|
--button_border_radius: 4px;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
position: relative;
|
|
50
50
|
font-size: var(--button_font_size);
|
|
51
51
|
color: var(--button_text_color);
|
|
52
|
-
font-
|
|
52
|
+
font-weight: var(--button_font_weight);
|
|
53
53
|
text-transform: var(--button_text_transform);
|
|
54
54
|
min-width: var(--button_min_width);
|
|
55
55
|
height: var(--button_height);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.bold {
|
|
66
|
-
--
|
|
66
|
+
--button_font_weight: var(--zd-fw-semibold);
|
|
67
67
|
composes: ftsmooth from '../../common/common.module.css';
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -569,7 +569,7 @@
|
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
.loader {
|
|
572
|
-
color: var(--dot_mirror)
|
|
572
|
+
color: var(--dot_mirror);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
[dir=ltr] .strike {
|
|
@@ -579,34 +579,43 @@
|
|
|
579
579
|
[dir=rtl] .strike {
|
|
580
580
|
background-image: repeating-linear-gradient(-120deg, var(--button_strike_color) 0 1px, transparent 1px 8px);
|
|
581
581
|
}
|
|
582
|
+
|
|
582
583
|
.primaryStrike {
|
|
583
584
|
--button_strike_color: var(--zdt_button_primary_strike);
|
|
584
585
|
}
|
|
586
|
+
|
|
585
587
|
.primaryfilledStrike {
|
|
586
588
|
--button_strike_color: var(--zdt_button_primaryFilled_strike);
|
|
587
589
|
--button_border_color: var(--zdt_button_primaryfill_bg);
|
|
588
590
|
}
|
|
591
|
+
|
|
589
592
|
.dangerStrike {
|
|
590
593
|
--button_strike_color: var(--zdt_button_danger_strike);
|
|
591
594
|
}
|
|
595
|
+
|
|
592
596
|
.dangerfilledStrike {
|
|
593
597
|
--button_strike_color: var(--zdt_button_dangerFilled_strike);
|
|
594
598
|
--button_border_color: var(--zdt_button_dangerfill_bg);
|
|
595
599
|
}
|
|
600
|
+
|
|
596
601
|
.secondaryStrike {
|
|
597
602
|
--button_strike_color: var(--zdt_button_secondary_border);
|
|
598
603
|
}
|
|
604
|
+
|
|
599
605
|
.secondaryfilledStrike {
|
|
600
606
|
--button_strike_color: var(--zdt_button_secondaryFilled_strike);
|
|
601
607
|
--button_border_color: var(--zdt_button_secondaryfill_bg);
|
|
602
608
|
}
|
|
609
|
+
|
|
603
610
|
.tertiaryfilledStrike {
|
|
604
611
|
--button_strike_color: var(--zdt_button_tertiaryFilled_strike);
|
|
605
612
|
--button_border_color: var(--zdt_button_tertiaryfill_bg);
|
|
606
613
|
}
|
|
614
|
+
|
|
607
615
|
.successStrike {
|
|
608
616
|
--button_strike_color: var(--zdt_button_success_strike);
|
|
609
617
|
}
|
|
618
|
+
|
|
610
619
|
.successfilledStrike {
|
|
611
620
|
--button_strike_color: var(--zdt_button_successFilled_strike);
|
|
612
621
|
--button_border_color: var(--zdt_button_successfill_bg);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.semibold {
|
|
2
|
-
font-
|
|
2
|
+
font-weight: var(--zd-fw-semibold);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
[dir=ltr] .boxPadding {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.datesStr {
|
|
32
|
-
font-
|
|
32
|
+
font-weight: var(--zd-fw-normal);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.grid {
|
|
@@ -122,7 +122,8 @@
|
|
|
122
122
|
color: var(--zdt_datetime_invalid_text);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.invalidDate.holiday
|
|
125
|
+
.invalidDate.holiday,
|
|
126
|
+
.inActiveDate.holiday:hover {
|
|
126
127
|
color: var(--zdt_datetime_invaliddate_text);
|
|
127
128
|
}
|
|
128
129
|
|
|
@@ -147,15 +148,17 @@
|
|
|
147
148
|
background-color: var(--zdt_datetime_selected_bg);
|
|
148
149
|
border-radius: 50%;
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
|
|
152
|
+
.inActiveDate {
|
|
153
|
+
color: var(--zdt_datetime_invalid_text);
|
|
154
|
+
cursor: no-drop;
|
|
153
155
|
}
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
+
|
|
157
|
+
.inActiveDate:hover {
|
|
156
158
|
color: var(--zdt_datetime_invalid_text);
|
|
157
159
|
}
|
|
158
|
-
|
|
160
|
+
|
|
161
|
+
.inActiveDate:hover, .inActiveDate.holiday:hover {
|
|
159
162
|
background-color: var(--zdt_datetime_inactivedate_hover_bg);
|
|
160
163
|
|
|
161
164
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* label default variables */
|
|
3
3
|
--label_font_size: var(--zd_font_size14);
|
|
4
4
|
--label_text_color: var(--zdt_label_default_text);
|
|
5
|
-
--
|
|
5
|
+
--label_font_weight: var(--zd-fw-normal);
|
|
6
6
|
--label_cursor: default;
|
|
7
7
|
--label_line_height: 1.286;
|
|
8
8
|
}
|
|
@@ -13,24 +13,24 @@
|
|
|
13
13
|
line-height: var(--label_line_height);
|
|
14
14
|
font-size: var(--label_font_size);
|
|
15
15
|
color: var(--label_text_color);
|
|
16
|
-
font-
|
|
16
|
+
font-weight: var(--label_font_weight);
|
|
17
17
|
cursor: var(--label_cursor);
|
|
18
18
|
}
|
|
19
19
|
.xsmall {
|
|
20
20
|
--label_font_size: var(--zd_font_size12);
|
|
21
|
-
--label_line_height:1.5;
|
|
21
|
+
--label_line_height: 1.5;
|
|
22
22
|
}
|
|
23
23
|
.small {
|
|
24
24
|
--label_font_size: var(--zd_font_size13);
|
|
25
|
-
--label_line_height:1.385;
|
|
25
|
+
--label_line_height: 1.385;
|
|
26
26
|
}
|
|
27
27
|
.medium {
|
|
28
28
|
--label_font_size: var(--zd_font_size14);
|
|
29
|
-
--label_line_height:1.286;
|
|
29
|
+
--label_line_height: 1.286;
|
|
30
30
|
}
|
|
31
31
|
.large {
|
|
32
32
|
--label_font_size: var(--zd_font_size26);
|
|
33
|
-
--label_line_height:0.6923;
|
|
33
|
+
--label_line_height: 0.6923;
|
|
34
34
|
composes: semibold from '../common/common.module.css';
|
|
35
35
|
}
|
|
36
36
|
.pointer {
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
display: inline-block;
|
|
47
47
|
}
|
|
48
48
|
.font_default {
|
|
49
|
-
--
|
|
49
|
+
--label_font_weight: var(--zd-fw-normal);
|
|
50
50
|
}
|
|
51
51
|
.font_primary {
|
|
52
|
-
--
|
|
52
|
+
--label_font_weight: var(--zd-fw-semibold);
|
|
53
53
|
composes: ftsmooth from '../common/common.module.css';
|
|
54
54
|
}
|
|
55
55
|
.dotted {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AdvancedGroupMultiSelect_propTypes } from "./props/propTypes";
|
|
3
3
|
import { AdvancedGroupMultiSelect_defaultProps } from "./props/defaultProps";
|
|
4
|
+
import { MULTISELECT_I18N_KEYS } from "./constants";
|
|
4
5
|
/**** Components ****/
|
|
5
6
|
|
|
6
7
|
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
@@ -185,7 +186,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
185
186
|
|
|
186
187
|
handleSelectedOptionIdChange(selectedGroupOptions, normalizedFormatOptions, normalizedSelectedOptions) {
|
|
187
188
|
const {
|
|
188
|
-
allowValueFallback
|
|
189
|
+
allowValueFallback,
|
|
190
|
+
limit
|
|
189
191
|
} = this.props;
|
|
190
192
|
let newSelectedOptions = selectedGroupOptions.map(option => optionIdGrouping(option.id, option.groupId));
|
|
191
193
|
let selectedOptionsLength = newSelectedOptions.length;
|
|
@@ -197,7 +199,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
197
199
|
selectedOptions: newSelectedOptions,
|
|
198
200
|
normalizedFormatOptions: formatOptions,
|
|
199
201
|
selectedOptionsLength,
|
|
200
|
-
allowValueFallback
|
|
202
|
+
allowValueFallback,
|
|
203
|
+
limit
|
|
201
204
|
});
|
|
202
205
|
}
|
|
203
206
|
|
|
@@ -390,7 +393,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
390
393
|
getNextOptions,
|
|
391
394
|
isPopupOpen,
|
|
392
395
|
isPopupOpenOnEnter,
|
|
393
|
-
onKeyDown
|
|
396
|
+
onKeyDown,
|
|
397
|
+
limit
|
|
394
398
|
} = this.props;
|
|
395
399
|
let highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
396
400
|
|
|
@@ -442,7 +446,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
442
446
|
hoverIndex: hoverIndex + 1
|
|
443
447
|
});
|
|
444
448
|
}
|
|
445
|
-
} else if (keyCode === 13) {
|
|
449
|
+
} else if (keyCode === 13 && selectedOptions.length < limit) {
|
|
446
450
|
//enter key
|
|
447
451
|
let id = suggestions[hoverIndex] || {};
|
|
448
452
|
isPopupOpen && !getIsEmptyValue(id) && this.handleSelectOption(id, null, null, e);
|
|
@@ -884,13 +888,15 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
884
888
|
needEffect,
|
|
885
889
|
autoComplete,
|
|
886
890
|
getTargetRef,
|
|
887
|
-
isFocus
|
|
891
|
+
isFocus,
|
|
892
|
+
limit
|
|
888
893
|
} = this.props;
|
|
889
894
|
let {
|
|
890
|
-
clearText =
|
|
895
|
+
clearText = MULTISELECT_I18N_KEYS.clearText,
|
|
896
|
+
limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
|
|
891
897
|
} = i18nKeys;
|
|
892
898
|
let {
|
|
893
|
-
clearLabel =
|
|
899
|
+
clearLabel = MULTISELECT_I18N_KEYS.clearText
|
|
894
900
|
} = a11y;
|
|
895
901
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
896
902
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
@@ -1026,7 +1032,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
1026
1032
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
1027
1033
|
customClass: `${style.box} ${style[`${palette}Box`]}`,
|
|
1028
1034
|
onScroll: this.handleScroll
|
|
1029
|
-
}, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
1035
|
+
}, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
1030
1036
|
onSelect: this.handleSelectAll,
|
|
1031
1037
|
selectAllText: selectAllText,
|
|
1032
1038
|
suggestions: suggestionOptionIds,
|
|
@@ -1065,6 +1071,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
1065
1071
|
a11y: {
|
|
1066
1072
|
role: 'option'
|
|
1067
1073
|
},
|
|
1074
|
+
limit: limit,
|
|
1075
|
+
limitReachedMessage: limitReachedMessage,
|
|
1068
1076
|
dataId: `${dataId}_Options`
|
|
1069
1077
|
}));
|
|
1070
1078
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AdvancedMultiSelect_propTypes } from "./props/propTypes";
|
|
4
4
|
import { AdvancedMultiSelect_defaultProps } from "./props/defaultProps";
|
|
5
|
+
import { MULTISELECT_I18N_KEYS } from "./constants";
|
|
5
6
|
/**** Components ****/
|
|
6
7
|
|
|
7
8
|
import { MultiSelectComponent } from "./MultiSelect";
|
|
@@ -177,7 +178,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
177
178
|
const {
|
|
178
179
|
selectedOptionsLimit,
|
|
179
180
|
selectedOptionDetails,
|
|
180
|
-
allowValueFallback
|
|
181
|
+
allowValueFallback,
|
|
182
|
+
limit
|
|
181
183
|
} = props;
|
|
182
184
|
showedSelectedOptionsCount = getIsEmptyValue(showedSelectedOptionsCount) ? selectedOptionsLimit : showedSelectedOptionsCount;
|
|
183
185
|
const {
|
|
@@ -191,7 +193,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
191
193
|
selectedOptions,
|
|
192
194
|
normalizedFormatOptions: formatOptions,
|
|
193
195
|
selectedOptionsLength: showedSelectedOptionsCount,
|
|
194
|
-
allowValueFallback
|
|
196
|
+
allowValueFallback,
|
|
197
|
+
limit
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
200
|
|
|
@@ -385,7 +388,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
385
388
|
positionsOffset,
|
|
386
389
|
targetOffset,
|
|
387
390
|
isRestrictScroll,
|
|
388
|
-
isFocus
|
|
391
|
+
isFocus,
|
|
392
|
+
limit
|
|
389
393
|
} = this.props;
|
|
390
394
|
let {
|
|
391
395
|
SuggestionsProps = {},
|
|
@@ -395,10 +399,11 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
395
399
|
containerClass = ''
|
|
396
400
|
} = customClass;
|
|
397
401
|
const {
|
|
398
|
-
clearText =
|
|
402
|
+
clearText = MULTISELECT_I18N_KEYS.clearText,
|
|
403
|
+
limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
|
|
399
404
|
} = i18nKeys;
|
|
400
405
|
const {
|
|
401
|
-
clearLabel =
|
|
406
|
+
clearLabel = MULTISELECT_I18N_KEYS.clearText
|
|
402
407
|
} = a11y;
|
|
403
408
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
404
409
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
@@ -541,7 +546,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
541
546
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
542
547
|
customClass: style.box,
|
|
543
548
|
onScroll: this.handleScroll
|
|
544
|
-
}, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
549
|
+
}, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
545
550
|
onSelect: this.handleSelectAll,
|
|
546
551
|
selectAllText: selectAllText,
|
|
547
552
|
suggestions: suggestions,
|
|
@@ -563,6 +568,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
563
568
|
role: 'option'
|
|
564
569
|
},
|
|
565
570
|
dataId: `${dataIdMultiSelectComp}_Options`,
|
|
571
|
+
limit: limit,
|
|
572
|
+
limitReachedMessage: limitReachedMessage,
|
|
566
573
|
...SuggestionsProps
|
|
567
574
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
568
575
|
isLoading: isFetchingOptions,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { EmptyState_propTypes } from "./props/propTypes";
|
|
4
4
|
import { EmptyState_defaultProps } from "./props/defaultProps";
|
|
5
|
+
import { MULTISELECT_I18N_KEYS } from "./constants";
|
|
5
6
|
/**** CSS ****/
|
|
6
7
|
|
|
7
8
|
import style from "./MultiSelect.module.css";
|
|
@@ -23,7 +24,7 @@ export default class EmptyState extends React.PureComponent {
|
|
|
23
24
|
a11y
|
|
24
25
|
} = this.props;
|
|
25
26
|
let {
|
|
26
|
-
loadingText =
|
|
27
|
+
loadingText = MULTISELECT_I18N_KEYS.loadingText,
|
|
27
28
|
emptyText = emptyMessage,
|
|
28
29
|
noMoreText = noMoreOptionsMessage,
|
|
29
30
|
searchEmptyText = searchEmptyMessage
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { MultiSelect_propTypes } from "./props/propTypes";
|
|
4
4
|
import { MultiSelect_defaultProps } from "./props/defaultProps";
|
|
5
5
|
import { defaultProps as MobileHeader_defaultProps } from "./MobileHeader/props/defaultProps";
|
|
6
|
+
import { MULTISELECT_I18N_KEYS } from "./constants";
|
|
6
7
|
/**** Components ****/
|
|
7
8
|
|
|
8
9
|
import Popup from "../Popup/Popup";
|
|
@@ -234,12 +235,14 @@ export class MultiSelectComponent extends React.Component {
|
|
|
234
235
|
|
|
235
236
|
handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, props) {
|
|
236
237
|
const {
|
|
237
|
-
allowValueFallback
|
|
238
|
+
allowValueFallback,
|
|
239
|
+
limit
|
|
238
240
|
} = props;
|
|
239
241
|
return this.getSelectedOptions({
|
|
240
242
|
selectedOptions,
|
|
241
243
|
normalizedFormatOptions,
|
|
242
|
-
allowValueFallback
|
|
244
|
+
allowValueFallback,
|
|
245
|
+
limit
|
|
243
246
|
});
|
|
244
247
|
}
|
|
245
248
|
|
|
@@ -313,8 +316,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
313
316
|
getNextOptions,
|
|
314
317
|
isPopupOpen,
|
|
315
318
|
isPopupOpenOnEnter,
|
|
316
|
-
onKeyDown
|
|
319
|
+
onKeyDown,
|
|
320
|
+
limit
|
|
317
321
|
} = this.props;
|
|
322
|
+
const allowKeyboardActions = !limit || limit && selectedOptions.length < limit;
|
|
318
323
|
const highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
319
324
|
|
|
320
325
|
if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
|
|
@@ -334,7 +339,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
334
339
|
|
|
335
340
|
const suggestionsLen = suggestions.length;
|
|
336
341
|
|
|
337
|
-
if (suggestionsLen && isPopupOpen && keyCode === 38) {
|
|
342
|
+
if (suggestionsLen && isPopupOpen && keyCode === 38 && allowKeyboardActions) {
|
|
338
343
|
//up arrow
|
|
339
344
|
|
|
340
345
|
/*if (hoverOption === 0) { //disable first to last option higlight
|
|
@@ -345,7 +350,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
345
350
|
hoverOption: hoverOption - 1
|
|
346
351
|
});
|
|
347
352
|
}
|
|
348
|
-
} else if (suggestionsLen && isPopupOpen && keyCode === 40) {
|
|
353
|
+
} else if (suggestionsLen && isPopupOpen && keyCode === 40 && allowKeyboardActions) {
|
|
349
354
|
//down arrow
|
|
350
355
|
|
|
351
356
|
/*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
|
|
@@ -362,8 +367,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
362
367
|
hoverOption: hoverOption + 1
|
|
363
368
|
});
|
|
364
369
|
}
|
|
365
|
-
} else if (keyCode === 13) {
|
|
366
|
-
//enter
|
|
370
|
+
} else if (keyCode === 13 && allowKeyboardActions) {
|
|
371
|
+
//enter ke
|
|
367
372
|
const selectedOption = suggestions[hoverOption] || {};
|
|
368
373
|
const {
|
|
369
374
|
id
|
|
@@ -727,14 +732,16 @@ export class MultiSelectComponent extends React.Component {
|
|
|
727
732
|
needToCloseOnSelect,
|
|
728
733
|
togglePopup,
|
|
729
734
|
selectedOptions: propSelectedOptions,
|
|
730
|
-
disabledOptions = dummyArray
|
|
735
|
+
disabledOptions = dummyArray,
|
|
736
|
+
limit
|
|
731
737
|
} = this.props;
|
|
732
738
|
const {
|
|
733
739
|
newSelectedOptions
|
|
734
740
|
} = filterSelectedOptions({
|
|
735
741
|
selectedOptions,
|
|
736
742
|
propSelectedOptions,
|
|
737
|
-
disabledOptions
|
|
743
|
+
disabledOptions,
|
|
744
|
+
limit
|
|
738
745
|
});
|
|
739
746
|
const selectedOptionsLen = newSelectedOptions.length;
|
|
740
747
|
const allSelectedOptionsDetails = [];
|
|
@@ -894,10 +901,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
894
901
|
searchStr
|
|
895
902
|
} = this.state;
|
|
896
903
|
const {
|
|
897
|
-
clearText =
|
|
904
|
+
clearText = MULTISELECT_I18N_KEYS.clearText
|
|
898
905
|
} = i18nKeys;
|
|
899
906
|
const {
|
|
900
|
-
clearLabel =
|
|
907
|
+
clearLabel = MULTISELECT_I18N_KEYS.clearLabel,
|
|
901
908
|
ariaLabelledby
|
|
902
909
|
} = a11y;
|
|
903
910
|
let {
|
|
@@ -1034,7 +1041,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1034
1041
|
boxSize,
|
|
1035
1042
|
isLoading,
|
|
1036
1043
|
selectAllText,
|
|
1037
|
-
needSelectAll
|
|
1044
|
+
needSelectAll,
|
|
1045
|
+
limit
|
|
1038
1046
|
} = this.props;
|
|
1039
1047
|
const {
|
|
1040
1048
|
selectedOptions,
|
|
@@ -1045,7 +1053,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1045
1053
|
selectedOptionIds
|
|
1046
1054
|
} = this.state;
|
|
1047
1055
|
const {
|
|
1048
|
-
searchText =
|
|
1056
|
+
searchText = MULTISELECT_I18N_KEYS.searchText,
|
|
1057
|
+
limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
|
|
1049
1058
|
} = i18nKeys;
|
|
1050
1059
|
const suggestions = this.handleFilterSuggestions();
|
|
1051
1060
|
const setAriaId = this.getNextAriaId();
|
|
@@ -1099,7 +1108,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1099
1108
|
onClick: this.handlePopupClose
|
|
1100
1109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1101
1110
|
className: style.effect
|
|
1102
|
-
}, this.getSelectionUI(true))) : null, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
1111
|
+
}, this.getSelectionUI(true))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
1103
1112
|
onSelect: this.handleSelectAll,
|
|
1104
1113
|
selectAllText: selectAllText,
|
|
1105
1114
|
suggestions: suggestions,
|
|
@@ -1125,7 +1134,9 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1125
1134
|
selectedOptions: selectedOptionIds,
|
|
1126
1135
|
a11y: {
|
|
1127
1136
|
role: 'option'
|
|
1128
|
-
}
|
|
1137
|
+
},
|
|
1138
|
+
limit: limit,
|
|
1139
|
+
limitReachedMessage: limitReachedMessage
|
|
1129
1140
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
1130
1141
|
isLoading: isFetchingOptions,
|
|
1131
1142
|
options: options,
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
.more {
|
|
197
197
|
font-size: var(--zd_font_size14) ;
|
|
198
198
|
color: var(--zdt_multiselect_more_text);
|
|
199
|
-
font-
|
|
199
|
+
font-weight: var(--zd-fw-normal);
|
|
200
200
|
cursor: pointer;
|
|
201
201
|
margin-top: var(--zd_size5) ;
|
|
202
202
|
background-color: var(--zdt_multiselect_delete_bg);
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { MultiSelectWithAvatar_propTypes } from "./props/propTypes";
|
|
4
4
|
import { MultiSelectWithAvatar_defaultProps } from "./props/defaultProps";
|
|
5
5
|
import { defaultProps as MobileHeader_defaultProps } from "./MobileHeader/props/defaultProps";
|
|
6
|
+
import { MULTISELECT_I18N_KEYS } from "./constants";
|
|
6
7
|
/**** Components ****/
|
|
7
8
|
|
|
8
9
|
import { MultiSelectComponent } from "./MultiSelect";
|
|
@@ -93,11 +94,15 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
93
94
|
needEffect,
|
|
94
95
|
isLoading,
|
|
95
96
|
keepSelectedOptions,
|
|
96
|
-
customProps
|
|
97
|
+
customProps,
|
|
98
|
+
limit
|
|
97
99
|
} = this.props;
|
|
98
100
|
let {
|
|
99
101
|
SuggestionsProps = {}
|
|
100
102
|
} = customProps;
|
|
103
|
+
let {
|
|
104
|
+
limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
|
|
105
|
+
} = i18nKeys;
|
|
101
106
|
i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
|
|
102
107
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
103
108
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
@@ -158,7 +163,7 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
158
163
|
onClick: this.handlePopupClose
|
|
159
164
|
}, /*#__PURE__*/React.createElement("div", {
|
|
160
165
|
className: style.effect
|
|
161
|
-
}, this.getSelectionUI(true)))) : null, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
166
|
+
}, this.getSelectionUI(true)))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
162
167
|
onSelect: this.handleSelectAll,
|
|
163
168
|
selectAllText: selectAllText,
|
|
164
169
|
suggestions: suggestions,
|
|
@@ -184,6 +189,8 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
184
189
|
a11y: {
|
|
185
190
|
role: 'option'
|
|
186
191
|
},
|
|
192
|
+
limit: limit,
|
|
193
|
+
limitReachedMessage: limitReachedMessage,
|
|
187
194
|
...SuggestionsProps
|
|
188
195
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
189
196
|
isLoading: isFetchingOptions,
|
|
@@ -22,10 +22,12 @@ export default class SelectedOptions extends React.PureComponent {
|
|
|
22
22
|
onSelect,
|
|
23
23
|
size,
|
|
24
24
|
palette,
|
|
25
|
-
dataId
|
|
25
|
+
dataId,
|
|
26
|
+
limit
|
|
26
27
|
} = this.props;
|
|
27
28
|
const isDarkPalette = palette === 'dark' ? 'dark' : 'danger';
|
|
28
|
-
|
|
29
|
+
const selectedData = limit && limit > 0 ? selectedOptions.slice(0, limit) : selectedOptions;
|
|
30
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, selectedData.map(option => {
|
|
29
31
|
const {
|
|
30
32
|
id,
|
|
31
33
|
value,
|
|
@@ -28,12 +28,15 @@ export default class Suggestions extends React.PureComponent {
|
|
|
28
28
|
palette,
|
|
29
29
|
htmlId,
|
|
30
30
|
a11y,
|
|
31
|
-
needMultiLineText
|
|
31
|
+
needMultiLineText,
|
|
32
|
+
limit,
|
|
33
|
+
limitReachedMessage
|
|
32
34
|
} = this.props;
|
|
33
35
|
const {
|
|
34
36
|
ariaParentRole,
|
|
35
37
|
ariaMultiselectable
|
|
36
38
|
} = a11y;
|
|
39
|
+
const selectedOptionsLength = selectedOptions.length;
|
|
37
40
|
return /*#__PURE__*/React.createElement(Container, {
|
|
38
41
|
isCover: false,
|
|
39
42
|
role: ariaParentRole,
|
|
@@ -58,13 +61,14 @@ export default class Suggestions extends React.PureComponent {
|
|
|
58
61
|
} = suggestion;
|
|
59
62
|
const isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
|
|
60
63
|
const isHighlight = hoverOption === index || id === hoverId ? true : false;
|
|
64
|
+
const isLimitReached = selectedOptionsLength >= limit && !isActive;
|
|
61
65
|
const list_a11y = Object.assign({}, a11y, {
|
|
62
66
|
ariaSelected: isActive,
|
|
63
67
|
ariaLabel: value,
|
|
64
68
|
'data-a11y-list-active': isHighlight
|
|
65
69
|
});
|
|
66
70
|
const commonProps = {
|
|
67
|
-
isDisabled,
|
|
71
|
+
isDisabled: isDisabled ? isDisabled : isLimitReached,
|
|
68
72
|
needMultiLineText,
|
|
69
73
|
...listItemCustomProps
|
|
70
74
|
};
|
|
@@ -76,6 +80,10 @@ export default class Suggestions extends React.PureComponent {
|
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
if (isLimitReached) {
|
|
84
|
+
commonProps.disableTitle = limitReachedMessage;
|
|
85
|
+
}
|
|
86
|
+
|
|
79
87
|
if (optionType === 'avatar') {
|
|
80
88
|
return /*#__PURE__*/React.createElement(ListItemWithAvatar, { ...commonProps,
|
|
81
89
|
autoHover: false,
|