@zohodesk/components 1.2.25 → 1.2.26

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.
@@ -17,8 +17,8 @@ import MultiSelectHeader from './MultiSelectHeader';
17
17
  import CssProvider from '../../Provider/CssProvider';
18
18
  import { getUniqueId } from '../../Provider/IdProvider';
19
19
  import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
20
- import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
21
20
  import Loader from '@zohodesk/svg/lib/Loader/Loader';
21
+ import isMobilePopover from '../DropBox/utils/isMobilePopover';
22
22
  /**** Icons ****/
23
23
 
24
24
  import { Icon } from '@zohodesk/icons';
@@ -28,8 +28,8 @@ import style from '../../MultiSelect/MultiSelect.module.css';
28
28
  /**** Methods ****/
29
29
 
30
30
  import { debounce, scrollTo, bind, getIsEmptyValue, getSearchString, findScrollEnd } from '../../utils/Common.js';
31
- import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from '../../utils/dropDownUtils';
32
- import { getLibraryConfig } from '../../Provider/Config';
31
+ import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from '../../utils/dropDownUtils'; // import { getLibraryConfig } from '../../Provider/Config';
32
+
33
33
  /* eslint-disable react/forbid-component-props */
34
34
 
35
35
  /* eslint-disable react/no-unused-prop-types */
@@ -840,17 +840,6 @@ export class MultiSelectComponent extends React.Component {
840
840
  });
841
841
  }
842
842
 
843
- responsiveFunc(_ref) {
844
- let {
845
- mediaQueryOR
846
- } = _ref;
847
- return {
848
- tabletMode: mediaQueryOR([{
849
- maxWidth: 700
850
- }])
851
- };
852
- }
853
-
854
843
  getSelectionUI() {
855
844
  let isResponsive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
856
845
  let {
@@ -1023,6 +1012,7 @@ export class MultiSelectComponent extends React.Component {
1023
1012
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
1024
1013
  noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
1025
1014
  });
1015
+ let isModel = isMobilePopover(needResponsive);
1026
1016
  return /*#__PURE__*/React.createElement("div", {
1027
1017
  className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
1028
1018
  "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
@@ -1030,85 +1020,77 @@ export class MultiSelectComponent extends React.Component {
1030
1020
  "data-title": isDisabled ? title : null,
1031
1021
  onClick: this.handleInputFocus,
1032
1022
  "data-selector-id": dataSelectorId
1033
- }, this.getSelectionUI(), !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
1034
- query: this.responsiveFunc,
1035
- responsiveId: "Helmet"
1036
- }, _ref2 => {
1037
- let {
1038
- tabletMode
1039
- } = _ref2;
1040
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
1041
- animationStyle: animationStyle,
1042
- boxPosition: position || `${defaultDropBoxPosition}`,
1043
- getRef: getContainerRef,
1044
- isActive: isPopupReady,
1045
- isAnimate: isAnimate,
1046
- isArrow: false,
1047
- onClick: removeClose,
1048
- needResponsive: needResponsive,
1049
- isPadding: false,
1050
- isBoxPaddingNeed: isBoxPaddingNeed,
1051
- palette: palette,
1052
- htmlId: setAriaId,
1053
- a11y: {
1054
- role: 'listbox',
1055
- ariaMultiselectable: true
1056
- },
1057
- size: boxSize,
1058
- alignBox: "row",
1059
- isResponsivePadding: getFooter ? false : true
1060
- }, /*#__PURE__*/React.createElement(Box, {
1061
- flexible: true
1062
- }, /*#__PURE__*/React.createElement(Card, {
1063
- customClass: `${style.box} ${style[`${palette}Box`]}`,
1064
- onScroll: this.handleScroll
1065
- }, tabletMode && /*#__PURE__*/React.createElement(MobileHeader, {
1066
- selectedOptions: selectedOptions,
1067
- i18nKeys: i18nKeys,
1068
- onClick: this.handlePopupClose
1069
- }, /*#__PURE__*/React.createElement("div", {
1070
- className: style.effect
1071
- }, this.getSelectionUI(true))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1072
- onSelect: this.handleSelectAll,
1073
- selectAllText: selectAllText,
1074
- suggestions: suggestions,
1075
- dataId: dataId
1076
- })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
1077
- align: "both",
1078
- className: style.loader
1079
- }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
1080
- shrink: true,
1081
- customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
1082
- eleRef: this.suggestionContainerRef
1083
- }, isSearching ? /*#__PURE__*/React.createElement("div", {
1084
- className: style[palette]
1085
- }, searchText) : suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
1086
- suggestions: suggestions,
1087
- getRef: this.suggestionItemRef,
1088
- hoverOption: hoverOption,
1089
- onClick: this.handleSelectOption,
1090
- onMouseEnter: this.handleMouseEnter,
1091
- needBorder: false,
1092
- dataId: `${dataId}_Options`,
1093
- palette: palette,
1094
- selectedOptions: selectedOptionIds,
1095
- a11y: {
1096
- role: 'option'
1097
- }
1098
- }) : /*#__PURE__*/React.createElement(EmptyState, {
1099
- isLoading: isFetchingOptions,
1100
- options: options,
1101
- searchString: searchStr,
1102
- suggestions: suggestions,
1103
- dataId: dataId,
1104
- palette: palette,
1105
- i18nKeys: i18nKeys,
1106
- htmlId: ariaErrorId
1107
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
1108
- isCover: false,
1109
- align: "both"
1110
- }, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null)));
1111
- }) : null);
1023
+ }, this.getSelectionUI(), !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveDropBox, {
1024
+ animationStyle: animationStyle,
1025
+ boxPosition: position || `${defaultDropBoxPosition}`,
1026
+ getRef: getContainerRef,
1027
+ isActive: isPopupReady,
1028
+ isAnimate: isAnimate,
1029
+ isArrow: false,
1030
+ onClick: removeClose,
1031
+ needResponsive: needResponsive,
1032
+ isPadding: false,
1033
+ isBoxPaddingNeed: isBoxPaddingNeed,
1034
+ palette: palette,
1035
+ htmlId: setAriaId,
1036
+ a11y: {
1037
+ role: 'listbox',
1038
+ ariaMultiselectable: true
1039
+ },
1040
+ size: boxSize,
1041
+ alignBox: "row",
1042
+ isResponsivePadding: getFooter ? false : true
1043
+ }, /*#__PURE__*/React.createElement(Box, {
1044
+ flexible: true
1045
+ }, /*#__PURE__*/React.createElement(Card, {
1046
+ customClass: `${style.box} ${style[`${palette}Box`]}`,
1047
+ onScroll: this.handleScroll
1048
+ }, isModel && /*#__PURE__*/React.createElement(MobileHeader, {
1049
+ selectedOptions: selectedOptions,
1050
+ i18nKeys: i18nKeys,
1051
+ onClick: this.handlePopupClose
1052
+ }, /*#__PURE__*/React.createElement("div", {
1053
+ className: style.effect
1054
+ }, this.getSelectionUI(true))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1055
+ onSelect: this.handleSelectAll,
1056
+ selectAllText: selectAllText,
1057
+ suggestions: suggestions,
1058
+ dataId: dataId
1059
+ })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
1060
+ align: "both",
1061
+ className: style.loader
1062
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
1063
+ shrink: true,
1064
+ customClass: !isModel && dropBoxSize ? style[dropBoxSize] : '',
1065
+ eleRef: this.suggestionContainerRef
1066
+ }, isSearching ? /*#__PURE__*/React.createElement("div", {
1067
+ className: style[palette]
1068
+ }, searchText) : suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
1069
+ suggestions: suggestions,
1070
+ getRef: this.suggestionItemRef,
1071
+ hoverOption: hoverOption,
1072
+ onClick: this.handleSelectOption,
1073
+ onMouseEnter: this.handleMouseEnter,
1074
+ needBorder: false,
1075
+ dataId: `${dataId}_Options`,
1076
+ palette: palette,
1077
+ selectedOptions: selectedOptionIds,
1078
+ a11y: {
1079
+ role: 'option'
1080
+ }
1081
+ }) : /*#__PURE__*/React.createElement(EmptyState, {
1082
+ isLoading: isFetchingOptions,
1083
+ options: options,
1084
+ searchString: searchStr,
1085
+ suggestions: suggestions,
1086
+ dataId: dataId,
1087
+ palette: palette,
1088
+ i18nKeys: i18nKeys,
1089
+ htmlId: ariaErrorId
1090
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
1091
+ isCover: false,
1092
+ align: "both"
1093
+ }, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null))) : null);
1112
1094
  }
1113
1095
 
1114
1096
  }
@@ -17,12 +17,13 @@ import MobileHeader from './MobileHeader/MobileHeader';
17
17
  import MultiSelectHeader from './MultiSelectHeader';
18
18
  import CssProvider from '../../Provider/CssProvider';
19
19
  import { getUniqueId } from '../../Provider/IdProvider';
20
- import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
21
- import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
20
+ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox'; // import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
21
+
22
22
  import Loader from '@zohodesk/svg/lib/Loader/Loader';
23
+ import isMobilePopover from '../DropBox/utils/isMobilePopover';
23
24
  /**** Icons ****/
25
+ // import { Icon } from '@zohodesk/icons';
24
26
 
25
- import { Icon } from '@zohodesk/icons';
26
27
  /**** CSS ****/
27
28
 
28
29
  import style from '../../MultiSelect/MultiSelect.module.css';
@@ -57,17 +58,6 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
57
58
  });
58
59
  }
59
60
 
60
- responsiveFunc(_ref) {
61
- let {
62
- mediaQueryOR
63
- } = _ref;
64
- return {
65
- tabletMode: mediaQueryOR([{
66
- maxWidth: 700
67
- }])
68
- };
69
- }
70
-
71
61
  render() {
72
62
  let {
73
63
  isReadOnly,
@@ -108,6 +98,7 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
108
98
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
109
99
  noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
110
100
  });
101
+ let isModel = isMobilePopover(needResponsive);
111
102
  const {
112
103
  selectedOptions,
113
104
  searchStr,
@@ -127,83 +118,75 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
127
118
  "data-title": isDisabled ? title : null,
128
119
  onClick: this.handleInputFocus,
129
120
  "data-selector-id": dataSelectorId
130
- }, this.getSelectionUI(), popUpState ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
131
- query: this.responsiveFunc,
132
- responsiveId: "Helmet"
133
- }, _ref2 => {
134
- let {
135
- tabletMode
136
- } = _ref2;
137
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
138
- animationStyle: animationStyle,
139
- boxPosition: position || `${defaultDropBoxPosition}Center`,
140
- getRef: getContainerRef,
141
- isActive: isPopupReady,
142
- isAnimate: isAnimate,
143
- isArrow: false,
144
- onClick: removeClose,
145
- needResponsive: needResponsive,
146
- isPadding: false,
147
- isBoxPaddingNeed: isBoxPaddingNeed,
148
- palette: palette,
149
- htmlId: setAriaId,
150
- a11y: {
151
- ariaMultiselectable: true,
152
- role: 'listbox'
153
- },
154
- isResponsivePadding: true,
155
- alignBox: "row"
156
- }, /*#__PURE__*/React.createElement(Box, {
157
- flexible: true
158
- }, /*#__PURE__*/React.createElement(Card, {
159
- customClass: `${style.box} ${style[`${palette}Box`]}`,
160
- onScroll: this.handleScroll
161
- }, tabletMode && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileHeader, {
162
- selectedOptions: selectedOptions,
163
- i18nKeys: i18nKeys,
164
- onClick: this.handlePopupClose
165
- }, /*#__PURE__*/React.createElement("div", {
166
- className: style.effect
167
- }, this.getSelectionUI(true)))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
168
- onSelect: this.handleSelectAll,
169
- selectAllText: selectAllText,
170
- suggestions: suggestions,
171
- dataId: dataId
172
- })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
173
- align: "both",
174
- className: style.loader
175
- }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
176
- shrink: true,
177
- customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
178
- eleRef: this.suggestionContainerRef
179
- }, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
180
- needTick: keepSelectedOptions,
181
- suggestions: suggestions,
182
- getRef: this.suggestionItemRef,
183
- hoverOption: hoverOption,
184
- onClick: this.handleSelectOption,
185
- onMouseEnter: this.handleMouseEnter,
186
- needBorder: false,
187
- dataId: `${dataId}_Options`,
188
- palette: palette,
189
- selectedOptions: selectedOptionIds,
190
- a11y: {
191
- role: 'option'
192
- }
193
- }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
194
- isLoading: isFetchingOptions,
195
- options: options,
196
- searchString: searchStr,
197
- suggestions: suggestions,
198
- dataId: dataId,
199
- palette: palette,
200
- i18nKeys: i18nKeys,
201
- htmlId: ariaErrorId
202
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
203
- isCover: false,
204
- align: "both"
205
- }, /*#__PURE__*/React.createElement(Loader, null))))));
206
- }) : null);
121
+ }, this.getSelectionUI(), popUpState ? /*#__PURE__*/React.createElement(ResponsiveDropBox, {
122
+ animationStyle: animationStyle,
123
+ boxPosition: position || `${defaultDropBoxPosition}Center`,
124
+ getRef: getContainerRef,
125
+ isActive: isPopupReady,
126
+ isAnimate: isAnimate,
127
+ isArrow: false,
128
+ onClick: removeClose,
129
+ needResponsive: needResponsive,
130
+ isPadding: false,
131
+ isBoxPaddingNeed: isBoxPaddingNeed,
132
+ palette: palette,
133
+ htmlId: setAriaId,
134
+ a11y: {
135
+ ariaMultiselectable: true,
136
+ role: 'listbox'
137
+ },
138
+ isResponsivePadding: true,
139
+ alignBox: "row"
140
+ }, /*#__PURE__*/React.createElement(Box, {
141
+ flexible: true
142
+ }, /*#__PURE__*/React.createElement(Card, {
143
+ customClass: `${style.box} ${style[`${palette}Box`]}`,
144
+ onScroll: this.handleScroll
145
+ }, isModel && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileHeader, {
146
+ selectedOptions: selectedOptions,
147
+ i18nKeys: i18nKeys,
148
+ onClick: this.handlePopupClose
149
+ }, /*#__PURE__*/React.createElement("div", {
150
+ className: style.effect
151
+ }, this.getSelectionUI(true)))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
152
+ onSelect: this.handleSelectAll,
153
+ selectAllText: selectAllText,
154
+ suggestions: suggestions,
155
+ dataId: dataId
156
+ })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
157
+ align: "both",
158
+ className: style.loader
159
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
160
+ shrink: true,
161
+ customClass: !isModel && dropBoxSize ? style[dropBoxSize] : '',
162
+ eleRef: this.suggestionContainerRef
163
+ }, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
164
+ needTick: keepSelectedOptions,
165
+ suggestions: suggestions,
166
+ getRef: this.suggestionItemRef,
167
+ hoverOption: hoverOption,
168
+ onClick: this.handleSelectOption,
169
+ onMouseEnter: this.handleMouseEnter,
170
+ needBorder: false,
171
+ dataId: `${dataId}_Options`,
172
+ palette: palette,
173
+ selectedOptions: selectedOptionIds,
174
+ a11y: {
175
+ role: 'option'
176
+ }
177
+ }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
178
+ isLoading: isFetchingOptions,
179
+ options: options,
180
+ searchString: searchStr,
181
+ suggestions: suggestions,
182
+ dataId: dataId,
183
+ palette: palette,
184
+ i18nKeys: i18nKeys,
185
+ htmlId: ariaErrorId
186
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
187
+ isCover: false,
188
+ align: "both"
189
+ }, /*#__PURE__*/React.createElement(Loader, null)))))) : null);
207
190
  }
208
191
 
209
192
  }
package/es/v1/Tag/Tag.js CHANGED
@@ -115,7 +115,7 @@ function Tag(props) {
115
115
  ${rounded ? style.lgRadiusClose : style.smRadiusClose} ${isDarkPalette ? style.darkTagClose : ''}
116
116
  ${customTagClose} ${style[`close${closePalette}`]}`,
117
117
  dataId: `${dataId}_RemoveTag`,
118
- "data-title": closeTitle,
118
+ title: closeTitle,
119
119
  onClick: handleRemove,
120
120
  a11y: {
121
121
  ariaLabel: clearLabel
@@ -13,8 +13,6 @@ var _FocusScope = _interopRequireDefault(require("@zohodesk/a11y/es/FocusScope/F
13
13
 
14
14
  var _Modal = _interopRequireDefault(require("../Modal/Modal"));
15
15
 
16
- var _Config = require("../Provider/Config");
17
-
18
16
  var _LibraryContextInit = _interopRequireDefault(require("../Provider/LibraryContextInit"));
19
17
 
20
18
  var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
@@ -27,6 +25,8 @@ var _propTypes = require("./props/propTypes");
27
25
 
28
26
  var _Common = require("./../utils/Common");
29
27
 
28
+ var _isMobilePopover = _interopRequireDefault(require("./utils/isMobilePopover"));
29
+
30
30
  var _DropBoxModule = _interopRequireDefault(require("./css/DropBox.module.css"));
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -64,17 +64,7 @@ function DropBox(props) {
64
64
  var _ref = DropBoxContext || {},
65
65
  direction = _ref.direction;
66
66
 
67
- var windowWidth,
68
- mobileWidth = (0, _Config.getLibraryConfig)('mobileWidth'),
69
- isModel = false;
70
-
71
- if (needResponsive) {
72
- windowWidth = window.innerWidth;
73
-
74
- if (windowWidth <= mobileWidth) {
75
- isModel = true;
76
- }
77
- }
67
+ var isModel = (0, _isMobilePopover["default"])(needResponsive);
78
68
 
79
69
  var _cssJSLogic = (0, _cssJSLogic2["default"])(props),
80
70
  zIndexStyle = _cssJSLogic.zIndexStyle;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = isMobilePopover;
7
+
8
+ var _Config = require("../../Provider/Config");
9
+
10
+ function isMobilePopover(needResponsive) {
11
+ // let { needResponsive } = props;
12
+ var windowWidth,
13
+ mobileWidth = (0, _Config.getLibraryConfig)('mobileWidth'),
14
+ isModel = false;
15
+
16
+ if (needResponsive) {
17
+ windowWidth = window.innerWidth;
18
+
19
+ if (windowWidth <= mobileWidth) {
20
+ isModel = true;
21
+ }
22
+ }
23
+
24
+ return isModel ? true : false;
25
+ }