@zohodesk/components 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/PropLessFiles.html +1 -1
- package/.cli/PropValidationExcludeFilesArray.js +10 -2
- package/.cli/propValidation_report.html +1 -1
- package/README.md +10 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +1 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +1 -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 +9 -3
- 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/coverage-final.json +10 -10
- package/coverage/coverage-summary.json +10 -10
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/Button/props/propTypes.js +3 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -3
- package/es/MultiSelect/AdvancedMultiSelect.js +2 -3
- package/es/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/MultiSelect/MobileHeader/MobileHeader.module.css +16 -0
- package/es/MultiSelect/MobileHeader/props/defaultProps.js +7 -0
- package/es/MultiSelect/MobileHeader/props/propTypes.js +7 -0
- package/es/MultiSelect/MultiSelect.js +112 -91
- package/es/MultiSelect/MultiSelect.module.css +2 -5
- package/es/MultiSelect/MultiSelectHeader.js +1 -2
- package/es/MultiSelect/MultiSelectWithAvatar.js +14 -112
- package/es/MultiSelect/props/defaultProps.js +3 -1
- package/es/MultiSelect/props/propTypes.js +9 -57
- package/es/deprecated/PortalLayer/props/propTypes.js +3 -1
- package/es/index.js +2 -1
- package/lib/Button/props/propTypes.js +3 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +2 -3
- package/lib/MultiSelect/AdvancedMultiSelect.js +2 -3
- package/lib/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/MultiSelect/MobileHeader/MobileHeader.module.css +16 -0
- package/lib/MultiSelect/MobileHeader/props/defaultProps.js +14 -0
- package/lib/MultiSelect/MobileHeader/props/propTypes.js +18 -0
- package/lib/MultiSelect/MultiSelect.js +116 -96
- package/lib/MultiSelect/MultiSelect.module.css +2 -5
- package/lib/MultiSelect/MultiSelectHeader.js +1 -2
- package/lib/MultiSelect/MultiSelectWithAvatar.js +17 -113
- package/lib/MultiSelect/props/defaultProps.js +3 -1
- package/lib/MultiSelect/props/propTypes.js +19 -60
- package/lib/deprecated/PortalLayer/props/propTypes.js +3 -1
- package/lib/index.js +10 -1
- package/package.json +11 -11
- package/result.json +1 -1
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MultiSelect_propTypes } from './props/propTypes';
|
|
4
4
|
import { MultiSelect_defaultProps } from './props/defaultProps';
|
|
5
|
+
import { defaultProps as MobileHeader_defaultProps } from './MobileHeader/props/defaultProps';
|
|
5
6
|
/**** Components ****/
|
|
6
7
|
|
|
7
8
|
import Popup from '../Popup/Popup';
|
|
8
9
|
import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
|
|
9
10
|
import { Container, Box } from '../Layout';
|
|
10
|
-
import Card, { CardContent,
|
|
11
|
+
import Card, { CardContent, CardFooter, CardHeader } from '../Card/Card';
|
|
11
12
|
import SelectedOptions from './SelectedOptions';
|
|
12
13
|
import Suggestions from './Suggestions';
|
|
13
14
|
import EmptyState from './EmptyState';
|
|
14
|
-
import MultiSelectHeader from './MultiSelectHeader';
|
|
15
15
|
import CssProvider from '../Provider/CssProvider';
|
|
16
16
|
import { getUniqueId } from '../Provider/IdProvider';
|
|
17
17
|
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
18
18
|
import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
19
|
+
import MultiSelectHeader from './MultiSelectHeader';
|
|
19
20
|
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
20
21
|
/**** Icons ****/
|
|
21
22
|
|
|
@@ -27,7 +28,7 @@ import style from './MultiSelect.module.css';
|
|
|
27
28
|
|
|
28
29
|
import { debounce, scrollTo, bind, getIsEmptyValue, getSearchString, findScrollEnd } from '../utils/Common.js';
|
|
29
30
|
import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from '../utils/dropDownUtils';
|
|
30
|
-
import
|
|
31
|
+
import MobileHeader from './MobileHeader/MobileHeader';
|
|
31
32
|
/* eslint-disable react/forbid-component-props */
|
|
32
33
|
|
|
33
34
|
/* eslint-disable react/no-unused-prop-types */
|
|
@@ -74,7 +75,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
74
75
|
this.allSelectedOptionsDetails = normalizedSelectedOptions;
|
|
75
76
|
this.suggestionsOrder = [];
|
|
76
77
|
this._isMounted = false;
|
|
77
|
-
bind.apply(this, ['handleInputCick', 'handleFilterSuggestions', 'handleKeyDown', 'handleSelectAll', 'handleDeselectAll', 'handleSelectOption', 'handleRemoveOption', 'handleSearch', 'handleClickSelectedOption', 'handleChange', 'handlePopupClose', 'togglePopup', 'selectedOptionRef', 'searchInputRef', 'suggestionContainerRef', 'suggestionItemRef', 'selectedOptionContainerRef', 'handleActive', 'handleInactive', 'handleMouseEnter', 'handleFetchOptions', 'handleFormatOptions', 'handleGetSelectedOptions', 'handleComponentDidUpdate', 'handleInputFocus', 'handleExposedPublicMethods']);
|
|
78
|
+
bind.apply(this, ['handleInputCick', 'handleFilterSuggestions', 'handleKeyDown', 'handleSelectAll', 'handleDeselectAll', 'handleSelectOption', 'handleRemoveOption', 'handleSearch', 'handleClickSelectedOption', 'handleChange', 'handlePopupClose', 'togglePopup', 'selectedOptionRef', 'searchInputRef', 'suggestionContainerRef', 'suggestionItemRef', 'selectedOptionContainerRef', 'handleActive', 'handleInactive', 'handleMouseEnter', 'handleFetchOptions', 'handleFormatOptions', 'handleGetSelectedOptions', 'handleComponentDidUpdate', 'handleInputFocus', 'handleExposedPublicMethods', 'getSelectionUI', 'moveFocusToTextbox']);
|
|
78
79
|
this.handleSearchOptions = debounce(this.handleSearchOptions.bind(this), searchDebounceTime);
|
|
79
80
|
this.handleScroll = this.handleScroll.bind(this);
|
|
80
81
|
this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
|
|
@@ -530,9 +531,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
530
531
|
this.handleChange(newSelectedOptions);
|
|
531
532
|
}
|
|
532
533
|
|
|
533
|
-
this.
|
|
534
|
-
preventScroll: true
|
|
535
|
-
});
|
|
534
|
+
this.moveFocusToTextbox();
|
|
536
535
|
}
|
|
537
536
|
|
|
538
537
|
handleMouseEnter(id, val, hoverOptionIndex, e) {
|
|
@@ -680,9 +679,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
680
679
|
this.setState({
|
|
681
680
|
shiftKeyPressHighLighted: 0
|
|
682
681
|
});
|
|
683
|
-
this.
|
|
684
|
-
preventScroll: true
|
|
685
|
-
});
|
|
682
|
+
this.moveFocusToTextbox();
|
|
686
683
|
}
|
|
687
684
|
|
|
688
685
|
handleScroll(e) {
|
|
@@ -732,9 +729,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
732
729
|
|
|
733
730
|
onChange && onChange(newSelectedOptions, allSelectedOptionsDetails); // this.setState({ searchStr: '' });
|
|
734
731
|
|
|
735
|
-
this.
|
|
736
|
-
preventScroll: true
|
|
737
|
-
});
|
|
732
|
+
this.moveFocusToTextbox();
|
|
738
733
|
|
|
739
734
|
if (needToCloseOnSelect) {
|
|
740
735
|
togglePopup(e);
|
|
@@ -824,7 +819,11 @@ export class MultiSelectComponent extends React.Component {
|
|
|
824
819
|
isDisabled,
|
|
825
820
|
isReadOnly
|
|
826
821
|
} = this.props;
|
|
827
|
-
|
|
822
|
+
!isDisabled && !isReadOnly && this.moveFocusToTextbox();
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
moveFocusToTextbox() {
|
|
826
|
+
this.searchInput && this.searchInput.focus({
|
|
828
827
|
preventScroll: true
|
|
829
828
|
});
|
|
830
829
|
}
|
|
@@ -850,78 +849,46 @@ export class MultiSelectComponent extends React.Component {
|
|
|
850
849
|
};
|
|
851
850
|
}
|
|
852
851
|
|
|
853
|
-
|
|
852
|
+
getSelectionUI() {
|
|
853
|
+
let isResponsive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
854
854
|
let {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
noMoreOptionsMessage,
|
|
860
|
-
dropBoxSize,
|
|
855
|
+
size,
|
|
856
|
+
needBorder,
|
|
857
|
+
disableAction,
|
|
858
|
+
borderColor,
|
|
861
859
|
placeHolder,
|
|
862
|
-
isPopupOpen,
|
|
863
|
-
isPopupReady,
|
|
864
|
-
position,
|
|
865
|
-
defaultDropBoxPosition,
|
|
866
|
-
selectAllText,
|
|
867
|
-
getContainerRef,
|
|
868
|
-
removeClose,
|
|
869
|
-
isAnimate,
|
|
870
|
-
animationStyle,
|
|
871
860
|
textBoxSize,
|
|
872
861
|
variant,
|
|
873
|
-
size,
|
|
874
|
-
isDisabled,
|
|
875
|
-
title,
|
|
876
|
-
needResponsive,
|
|
877
|
-
dataId,
|
|
878
|
-
dataSelectorId,
|
|
879
|
-
isSearching,
|
|
880
|
-
borderColor,
|
|
881
862
|
textBoxClass,
|
|
882
|
-
needBorder,
|
|
883
|
-
disableAction,
|
|
884
|
-
isBoxPaddingNeed,
|
|
885
|
-
palette,
|
|
886
863
|
needAutoFocus,
|
|
887
864
|
htmlId,
|
|
888
|
-
i18nKeys,
|
|
889
|
-
a11y,
|
|
890
865
|
children,
|
|
891
866
|
customChildrenClass,
|
|
892
|
-
getFooter,
|
|
893
|
-
needEffect,
|
|
894
|
-
disabledOptions,
|
|
895
|
-
boxSize,
|
|
896
867
|
autoComplete,
|
|
897
|
-
|
|
868
|
+
a11y,
|
|
869
|
+
disabledOptions,
|
|
870
|
+
i18nKeys,
|
|
871
|
+
isReadOnly,
|
|
872
|
+
isDisabled,
|
|
873
|
+
palette,
|
|
874
|
+
dataId,
|
|
875
|
+
setAriaId,
|
|
876
|
+
isPopupOpen,
|
|
877
|
+
ariaErrorId
|
|
898
878
|
} = this.props;
|
|
879
|
+
let {
|
|
880
|
+
isActive,
|
|
881
|
+
selectedOptions,
|
|
882
|
+
highLightedSelectOptions,
|
|
883
|
+
searchStr
|
|
884
|
+
} = this.state;
|
|
899
885
|
const {
|
|
900
|
-
clearText = 'Clear all'
|
|
901
|
-
searchText = 'Searching...'
|
|
886
|
+
clearText = 'Clear all'
|
|
902
887
|
} = i18nKeys;
|
|
903
888
|
const {
|
|
904
889
|
clearLabel = 'Clear all',
|
|
905
890
|
ariaLabelledby
|
|
906
891
|
} = a11y;
|
|
907
|
-
i18nKeys = Object.assign({}, i18nKeys, {
|
|
908
|
-
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
909
|
-
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
910
|
-
noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
|
|
911
|
-
});
|
|
912
|
-
const {
|
|
913
|
-
selectedOptions,
|
|
914
|
-
searchStr,
|
|
915
|
-
hoverOption,
|
|
916
|
-
highLightedSelectOptions,
|
|
917
|
-
options,
|
|
918
|
-
isFetchingOptions,
|
|
919
|
-
isActive,
|
|
920
|
-
selectedOptionIds
|
|
921
|
-
} = this.state;
|
|
922
|
-
const suggestions = this.handleFilterSuggestions();
|
|
923
|
-
const setAriaId = this.getNextAriaId();
|
|
924
|
-
const ariaErrorId = this.getNextAriaId();
|
|
925
892
|
let {
|
|
926
893
|
isShowClearIcon: isShowClear
|
|
927
894
|
} = this.getIsShowClearIcon({
|
|
@@ -929,17 +896,10 @@ export class MultiSelectComponent extends React.Component {
|
|
|
929
896
|
disabledOptions
|
|
930
897
|
});
|
|
931
898
|
const isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
|
|
932
|
-
return /*#__PURE__*/React.createElement(
|
|
933
|
-
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
|
|
934
|
-
"data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
935
|
-
"data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
936
|
-
"data-title": isDisabled ? title : null,
|
|
937
|
-
onClick: this.handleInputFocus,
|
|
938
|
-
"data-selector-id": dataSelectorId
|
|
939
|
-
}, /*#__PURE__*/React.createElement(Container, {
|
|
899
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
940
900
|
align: "vertical",
|
|
941
901
|
alignBox: "row",
|
|
942
|
-
className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
|
|
902
|
+
className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
|
|
943
903
|
eleRef: this.selectedOptionContainerRef,
|
|
944
904
|
wrap: "wrap"
|
|
945
905
|
}, /*#__PURE__*/React.createElement(SelectedOptions, {
|
|
@@ -958,14 +918,14 @@ export class MultiSelectComponent extends React.Component {
|
|
|
958
918
|
shrink: true
|
|
959
919
|
}, /*#__PURE__*/React.createElement("span", {
|
|
960
920
|
className: ` ${style.custmSpan} ${textBoxSize === 'xmedium' ? style.custmSpanXmedium : style.custmSpanMedium} ${isShowClearIcon ? style.clearIconSpace : ''}
|
|
961
|
-
|
|
921
|
+
${customChildrenClass ? customChildrenClass : ''}`
|
|
962
922
|
}, searchStr), /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
963
923
|
isDisabled: isDisabled,
|
|
964
924
|
inputRef: this.searchInputRef,
|
|
965
925
|
needBorder: false,
|
|
966
926
|
onBlur: this.handleInactive,
|
|
967
927
|
onChange: this.handleSearch,
|
|
968
|
-
onClick: this.handleInputCick,
|
|
928
|
+
onClick: !isResponsive ? this.handleInputCick : undefined,
|
|
969
929
|
onFocus: this.handleActive,
|
|
970
930
|
onKeyDown: this.handleKeyDown,
|
|
971
931
|
autofocus: needAutoFocus,
|
|
@@ -1006,7 +966,69 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1006
966
|
size: "15"
|
|
1007
967
|
})) : null, children ? /*#__PURE__*/React.createElement(Box, {
|
|
1008
968
|
dataId: `${dataId}_children`
|
|
1009
|
-
}, children) : null))))
|
|
969
|
+
}, children) : null))));
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
render() {
|
|
973
|
+
let {
|
|
974
|
+
isReadOnly,
|
|
975
|
+
searchEmptyMessage,
|
|
976
|
+
emptyMessage,
|
|
977
|
+
noMoreOptionsMessage,
|
|
978
|
+
dropBoxSize,
|
|
979
|
+
isPopupOpen,
|
|
980
|
+
isPopupReady,
|
|
981
|
+
position,
|
|
982
|
+
defaultDropBoxPosition,
|
|
983
|
+
getContainerRef,
|
|
984
|
+
removeClose,
|
|
985
|
+
isAnimate,
|
|
986
|
+
animationStyle,
|
|
987
|
+
isDisabled,
|
|
988
|
+
title,
|
|
989
|
+
needResponsive,
|
|
990
|
+
dataId,
|
|
991
|
+
dataSelectorId,
|
|
992
|
+
isSearching,
|
|
993
|
+
borderColor,
|
|
994
|
+
disableAction,
|
|
995
|
+
isBoxPaddingNeed,
|
|
996
|
+
palette,
|
|
997
|
+
i18nKeys,
|
|
998
|
+
getFooter,
|
|
999
|
+
needEffect,
|
|
1000
|
+
boxSize,
|
|
1001
|
+
isLoading,
|
|
1002
|
+
selectAllText,
|
|
1003
|
+
needSelectAll
|
|
1004
|
+
} = this.props;
|
|
1005
|
+
const {
|
|
1006
|
+
selectedOptions,
|
|
1007
|
+
searchStr,
|
|
1008
|
+
hoverOption,
|
|
1009
|
+
options,
|
|
1010
|
+
isFetchingOptions,
|
|
1011
|
+
selectedOptionIds
|
|
1012
|
+
} = this.state;
|
|
1013
|
+
const {
|
|
1014
|
+
searchText = 'Searching...'
|
|
1015
|
+
} = i18nKeys;
|
|
1016
|
+
const suggestions = this.handleFilterSuggestions();
|
|
1017
|
+
const setAriaId = this.getNextAriaId();
|
|
1018
|
+
const ariaErrorId = this.getNextAriaId();
|
|
1019
|
+
i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
|
|
1020
|
+
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
1021
|
+
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
1022
|
+
noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
|
|
1023
|
+
});
|
|
1024
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1025
|
+
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
|
|
1026
|
+
"data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
1027
|
+
"data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
1028
|
+
"data-title": isDisabled ? title : null,
|
|
1029
|
+
onClick: this.handleInputFocus,
|
|
1030
|
+
"data-selector-id": dataSelectorId
|
|
1031
|
+
}, this.getSelectionUI(), !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
1010
1032
|
query: this.responsiveFunc,
|
|
1011
1033
|
responsiveId: "Helmet"
|
|
1012
1034
|
}, _ref2 => {
|
|
@@ -1038,13 +1060,18 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1038
1060
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
1039
1061
|
customClass: `${style.box} ${style[`${palette}Box`]}`,
|
|
1040
1062
|
onScroll: this.handleScroll
|
|
1041
|
-
},
|
|
1042
|
-
|
|
1063
|
+
}, tabletMode && /*#__PURE__*/React.createElement(MobileHeader, {
|
|
1064
|
+
selectedOptions: selectedOptions,
|
|
1065
|
+
i18nKeys: i18nKeys,
|
|
1066
|
+
onClick: this.handlePopupClose
|
|
1067
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1068
|
+
className: style.effect
|
|
1069
|
+
}, this.getSelectionUI(true))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
1043
1070
|
onSelect: this.handleSelectAll,
|
|
1044
1071
|
selectAllText: selectAllText,
|
|
1045
1072
|
suggestions: suggestions,
|
|
1046
1073
|
dataId: dataId
|
|
1047
|
-
})), isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
1074
|
+
})) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
1048
1075
|
align: "both",
|
|
1049
1076
|
className: style.loader
|
|
1050
1077
|
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
|
|
@@ -1084,13 +1111,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1084
1111
|
|
|
1085
1112
|
}
|
|
1086
1113
|
MultiSelectComponent.propTypes = MultiSelect_propTypes;
|
|
1087
|
-
MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
|
|
1088
|
-
// MultiSelectComponent.docs = {
|
|
1089
|
-
// componentGroup: 'Form Elements',
|
|
1090
|
-
// folderName: 'Style Guide'
|
|
1091
|
-
// };
|
|
1092
|
-
// }
|
|
1093
|
-
|
|
1114
|
+
MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
|
|
1094
1115
|
MultiSelectComponent.displayName = 'MultiSelect';
|
|
1095
1116
|
const MultiSelect = Popup(MultiSelectComponent);
|
|
1096
1117
|
MultiSelect.propTypes = MultiSelectComponent.propTypes;
|
|
@@ -192,10 +192,7 @@
|
|
|
192
192
|
[dir=rtl] .clearIconSpace {
|
|
193
193
|
padding-left: var(--zd_size37)
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
/* Variable:Ignore */
|
|
197
|
-
padding: 0px 20px;
|
|
198
|
-
}
|
|
195
|
+
|
|
199
196
|
.more {
|
|
200
197
|
font-size: var(--zd_font_size14) ;
|
|
201
198
|
color: var(--zdt_multiselect_more_text);
|
|
@@ -204,4 +201,4 @@
|
|
|
204
201
|
margin-top: var(--zd_size5) ;
|
|
205
202
|
background-color: var(--zdt_multiselect_delete_bg);
|
|
206
203
|
border: 0;
|
|
207
|
-
}
|
|
204
|
+
}
|
|
@@ -12,12 +12,11 @@ export default class MultiSelectHeader extends React.PureComponent {
|
|
|
12
12
|
render() {
|
|
13
13
|
let {
|
|
14
14
|
dataId,
|
|
15
|
-
needSelectAll,
|
|
16
15
|
onSelect,
|
|
17
16
|
selectAllText,
|
|
18
17
|
suggestions
|
|
19
18
|
} = this.props;
|
|
20
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, suggestions.length > 1
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, suggestions.length > 1 ? /*#__PURE__*/React.createElement(ListItemWithIcon, {
|
|
21
20
|
autoHover: false,
|
|
22
21
|
value: selectAllText,
|
|
23
22
|
iconName: "ZD-androidd",
|
|
@@ -4,28 +4,25 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { MultiSelectWithAvatar_propTypes } from './props/propTypes';
|
|
6
6
|
import { MultiSelectWithAvatar_defaultProps } from './props/defaultProps';
|
|
7
|
+
import { defaultProps as MobileHeader_defaultProps } from './MobileHeader/props/defaultProps';
|
|
7
8
|
/**** Components ****/
|
|
8
9
|
|
|
9
10
|
import { MultiSelectComponent } from './MultiSelect';
|
|
10
11
|
import Popup from '../Popup/Popup';
|
|
11
|
-
import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
|
|
12
12
|
import { Container, Box } from '../Layout';
|
|
13
13
|
import Card, { CardContent, CardHeader } from '../Card/Card';
|
|
14
|
-
import SelectedOptions from './SelectedOptions';
|
|
15
14
|
import Suggestions from './Suggestions';
|
|
16
15
|
import EmptyState from './EmptyState';
|
|
17
|
-
import MultiSelectHeader from './MultiSelectHeader';
|
|
18
16
|
import CssProvider from '../Provider/CssProvider';
|
|
19
17
|
import { getUniqueId } from '../Provider/IdProvider';
|
|
20
18
|
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
21
19
|
import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
22
20
|
import Loader from '@zohodesk/svg/lib/Loader/Loader';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import { Icon } from '@zohodesk/icons';
|
|
21
|
+
import MultiSelectHeader from './MultiSelectHeader';
|
|
26
22
|
/**** CSS ****/
|
|
27
23
|
|
|
28
24
|
import style from './MultiSelect.module.css';
|
|
25
|
+
import MobileHeader from './MobileHeader/MobileHeader';
|
|
29
26
|
/*eslint-disable react/sort-prop-types*/
|
|
30
27
|
|
|
31
28
|
/* eslint-disable react/forbid-component-props */
|
|
@@ -76,7 +73,6 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
76
73
|
emptyMessage,
|
|
77
74
|
noMoreOptionsMessage,
|
|
78
75
|
dropBoxSize,
|
|
79
|
-
placeHolder,
|
|
80
76
|
isPopupOpen,
|
|
81
77
|
isPopupReady,
|
|
82
78
|
position,
|
|
@@ -86,24 +82,15 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
86
82
|
removeClose,
|
|
87
83
|
isAnimate,
|
|
88
84
|
animationStyle,
|
|
89
|
-
textBoxSize,
|
|
90
|
-
variant,
|
|
91
|
-
size,
|
|
92
85
|
isDisabled,
|
|
93
86
|
title,
|
|
94
87
|
dataId,
|
|
95
88
|
dataSelectorId,
|
|
96
89
|
needResponsive,
|
|
97
90
|
borderColor,
|
|
98
|
-
textBoxClass,
|
|
99
|
-
needBorder,
|
|
100
91
|
disableAction,
|
|
101
92
|
palette,
|
|
102
|
-
htmlId,
|
|
103
93
|
i18nKeys,
|
|
104
|
-
a11y,
|
|
105
|
-
children,
|
|
106
|
-
customChildrenClass,
|
|
107
94
|
isBoxPaddingNeed,
|
|
108
95
|
needEffect,
|
|
109
96
|
isLoading,
|
|
@@ -111,16 +98,9 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
111
98
|
customProps
|
|
112
99
|
} = this.props;
|
|
113
100
|
let {
|
|
114
|
-
TextBoxProps = {},
|
|
115
101
|
SuggestionsProps = {}
|
|
116
102
|
} = customProps;
|
|
117
|
-
|
|
118
|
-
clearText = 'Clear all'
|
|
119
|
-
} = i18nKeys;
|
|
120
|
-
const {
|
|
121
|
-
clearLabel = 'Clear all'
|
|
122
|
-
} = a11y;
|
|
123
|
-
i18nKeys = Object.assign({}, i18nKeys, {
|
|
103
|
+
i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
|
|
124
104
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
125
105
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
126
106
|
noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
|
|
@@ -129,17 +109,14 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
129
109
|
selectedOptions,
|
|
130
110
|
searchStr,
|
|
131
111
|
hoverOption,
|
|
132
|
-
highLightedSelectOptions,
|
|
133
112
|
options,
|
|
134
113
|
isFetchingOptions,
|
|
135
|
-
isActive,
|
|
136
114
|
selectedOptionIds
|
|
137
115
|
} = this.state;
|
|
138
116
|
const suggestions = this.handleFilterSuggestions();
|
|
139
117
|
const setAriaId = this.getNextAriaId();
|
|
140
118
|
const ariaErrorId = this.getNextAriaId();
|
|
141
119
|
const popUpState = !isReadOnly && !isDisabled && !disableAction && isPopupOpen;
|
|
142
|
-
const isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && selectedOptions.length > 1;
|
|
143
120
|
return /*#__PURE__*/React.createElement("div", {
|
|
144
121
|
className: ` ${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
|
|
145
122
|
"data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
@@ -147,79 +124,7 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
147
124
|
"data-title": isDisabled ? title : null,
|
|
148
125
|
onClick: this.handleInputFocus,
|
|
149
126
|
"data-selector-id": dataSelectorId
|
|
150
|
-
}, /*#__PURE__*/React.createElement(
|
|
151
|
-
align: "vertical",
|
|
152
|
-
alignBox: "row",
|
|
153
|
-
className: `${style.container} ${style[size]} ${needBorder ? style[`borderColor_${borderColor}`] : ''} ${isActive && needBorder ? style.active : ''} ${textBoxClass ? textBoxClass : ''} ${needBorder ? style.hasBorder : ''}`,
|
|
154
|
-
eleRef: this.selectedOptionContainerRef,
|
|
155
|
-
wrap: "wrap"
|
|
156
|
-
}, /*#__PURE__*/React.createElement(SelectedOptions, {
|
|
157
|
-
selectedOptions: selectedOptions,
|
|
158
|
-
highLightedSelectOptions: highLightedSelectOptions,
|
|
159
|
-
isReadOnly: isReadOnly,
|
|
160
|
-
getRef: this.selectedOptionRef,
|
|
161
|
-
onRemove: this.handleRemoveOption,
|
|
162
|
-
onSelect: this.handleClickSelectedOption,
|
|
163
|
-
size: size,
|
|
164
|
-
palette: palette
|
|
165
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
166
|
-
flexible: true,
|
|
167
|
-
className: style.wrapper,
|
|
168
|
-
adjust: true,
|
|
169
|
-
shrink: true
|
|
170
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
171
|
-
className: ` ${style.custmSpan} ${textBoxSize === 'xmedium' ? style.custmSpanXmedium : style.custmSpanMedium} ${isShowClearIcon ? style.clearIconSpace : ''}
|
|
172
|
-
${customChildrenClass ? customChildrenClass : ''}`
|
|
173
|
-
}, searchStr), /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
174
|
-
isDisabled: isDisabled,
|
|
175
|
-
inputRef: this.searchInputRef,
|
|
176
|
-
needBorder: false,
|
|
177
|
-
onBlur: this.handleInactive,
|
|
178
|
-
onChange: this.handleSearch,
|
|
179
|
-
onClick: this.handleInputCick,
|
|
180
|
-
onFocus: this.handleActive,
|
|
181
|
-
onKeyDown: this.handleKeyDown,
|
|
182
|
-
placeHolder: selectedOptions.length >= 1 ? '' : placeHolder,
|
|
183
|
-
size: textBoxSize,
|
|
184
|
-
value: searchStr,
|
|
185
|
-
variant: variant,
|
|
186
|
-
dataId: `${dataId}_textBox`,
|
|
187
|
-
isReadOnly: isReadOnly,
|
|
188
|
-
tabindex: isDisabled && '-1',
|
|
189
|
-
htmlId: htmlId,
|
|
190
|
-
a11y: {
|
|
191
|
-
ariaExpanded: popUpState ? true : false,
|
|
192
|
-
ariaHaspopup: true,
|
|
193
|
-
role: 'combobox',
|
|
194
|
-
ariaControls: setAriaId,
|
|
195
|
-
ariaOwns: setAriaId,
|
|
196
|
-
ariaDescribedby: ariaErrorId
|
|
197
|
-
},
|
|
198
|
-
customClass: {
|
|
199
|
-
customTBoxWrap: style.custmInputWrapper
|
|
200
|
-
},
|
|
201
|
-
autoComplete: false,
|
|
202
|
-
customProps: {
|
|
203
|
-
TextBoxProps: TextBoxProps
|
|
204
|
-
}
|
|
205
|
-
}, /*#__PURE__*/React.createElement(Container, {
|
|
206
|
-
isCover: false,
|
|
207
|
-
alignBox: "row",
|
|
208
|
-
align: "vertical",
|
|
209
|
-
className: style.iconContainer
|
|
210
|
-
}, children ? /*#__PURE__*/React.createElement(Box, {
|
|
211
|
-
dataId: `${dataId}_children`
|
|
212
|
-
}, children) : null, isShowClearIcon ? /*#__PURE__*/React.createElement(Box, {
|
|
213
|
-
className: `${style.delete} ${style[`${palette}Delete`]}`,
|
|
214
|
-
dataId: `${dataId}_clearIcon`,
|
|
215
|
-
"data-title": clearText,
|
|
216
|
-
onClick: this.handleDeselectAll,
|
|
217
|
-
tagName: "button",
|
|
218
|
-
"aria-label": clearLabel
|
|
219
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
220
|
-
name: "ZD-delete",
|
|
221
|
-
size: "15"
|
|
222
|
-
})) : null)))), popUpState ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
127
|
+
}, this.getSelectionUI(), popUpState ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
223
128
|
query: this.responsiveFunc,
|
|
224
129
|
responsiveId: "Helmet"
|
|
225
130
|
}, _ref2 => {
|
|
@@ -250,13 +155,18 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
|
|
|
250
155
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
251
156
|
customClass: `${style.box} ${style[`${palette}Box`]}`,
|
|
252
157
|
onScroll: this.handleScroll
|
|
253
|
-
}, /*#__PURE__*/React.createElement(
|
|
254
|
-
|
|
158
|
+
}, tabletMode && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileHeader, {
|
|
159
|
+
selectedOptions: selectedOptions,
|
|
160
|
+
i18nKeys: i18nKeys,
|
|
161
|
+
onClick: this.handlePopupClose
|
|
162
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: style.effect
|
|
164
|
+
}, this.getSelectionUI(true)))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
|
|
255
165
|
onSelect: this.handleSelectAll,
|
|
256
166
|
selectAllText: selectAllText,
|
|
257
167
|
suggestions: suggestions,
|
|
258
168
|
dataId: dataId
|
|
259
|
-
})), isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
169
|
+
})) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
260
170
|
align: "both",
|
|
261
171
|
className: style.loader
|
|
262
172
|
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
|
|
@@ -300,13 +210,5 @@ MultiSelectWithAvatarComponent.defaultProps = MultiSelectWithAvatar_defaultProps
|
|
|
300
210
|
MultiSelectWithAvatarComponent.displayName = 'MultiSelectWithAvatar';
|
|
301
211
|
const MultiSelectWithAvatar = Popup(MultiSelectWithAvatarComponent);
|
|
302
212
|
MultiSelectWithAvatar.defaultProps = MultiSelectWithAvatarComponent.defaultProps;
|
|
303
|
-
MultiSelectWithAvatar.propTypes = MultiSelectWithAvatarComponent.propTypes;
|
|
304
|
-
// MultiSelectWithAvatarComponent.docs = {
|
|
305
|
-
// componentGroup: 'Form Elements',
|
|
306
|
-
// folderName: 'Style Guide'
|
|
307
|
-
// };
|
|
308
|
-
// // eslint-disable-next-line react/forbid-foreign-prop-types
|
|
309
|
-
// MultiSelectWithAvatar.propTypes = MultiSelectWithAvatarComponent.propTypes;
|
|
310
|
-
// }
|
|
311
|
-
|
|
213
|
+
MultiSelectWithAvatar.propTypes = MultiSelectWithAvatarComponent.propTypes;
|
|
312
214
|
export default MultiSelectWithAvatar;
|
|
@@ -107,7 +107,9 @@ export const MultiSelect_defaultProps = {
|
|
|
107
107
|
boxSize: 'default',
|
|
108
108
|
isLoading: false,
|
|
109
109
|
dataSelectorId: 'multiSelect',
|
|
110
|
-
keepSelectedOptions: false
|
|
110
|
+
keepSelectedOptions: false,
|
|
111
|
+
selectedOptionsCount: 0,
|
|
112
|
+
cardHeaderName: ''
|
|
111
113
|
};
|
|
112
114
|
export const MultiSelectHeader_defaultProps = {
|
|
113
115
|
dataId: 'MultiSelectHeader'
|