@zohodesk/components 1.0.0-temp-217.5 → 1.0.0-temp-199.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.
Files changed (87) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +9 -0
  3. package/es/DropBox/DropBoxElement/DropBoxElement.js +3 -1
  4. package/es/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +4 -2
  5. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +56 -53
  6. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +4 -4
  7. package/es/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +4 -2
  8. package/es/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +3 -1
  9. package/es/ListItem/ListItem.js +2 -2
  10. package/es/ListItem/ListItem.module.css +15 -2
  11. package/es/ListItem/ListItemWithAvatar.js +3 -3
  12. package/es/ListItem/ListItemWithIcon.js +2 -2
  13. package/es/MultiSelect/AdvancedGroupMultiSelect.js +7 -2
  14. package/es/MultiSelect/MultiSelect.js +7 -2
  15. package/es/MultiSelect/Suggestions.js +14 -5
  16. package/es/MultiSelect/props/defaultProps.js +9 -4
  17. package/es/MultiSelect/props/propTypes.js +9 -3
  18. package/es/Popup/Popup.js +232 -83
  19. package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +4 -2
  20. package/es/Select/GroupSelect.js +5 -1
  21. package/es/Select/SelectWithAvatar.js +7 -2
  22. package/es/Select/SelectWithIcon.js +4 -2
  23. package/es/Select/props/defaultProps.js +2 -1
  24. package/es/Select/props/propTypes.js +4 -2
  25. package/es/common/common.module.css +5 -0
  26. package/es/utils/Common.js +2 -1
  27. package/es/v1/ListItem/ListItem.js +1 -1
  28. package/es/v1/MultiSelect/AdvancedMultiSelect.js +2 -1
  29. package/es/v1/MultiSelect/MultiSelect.js +7 -2
  30. package/es/v1/MultiSelect/Suggestions.js +8 -4
  31. package/es/v1/MultiSelect/props/defaultProps.js +4 -2
  32. package/es/v1/MultiSelect/props/propTypes.js +6 -2
  33. package/es/v1/Select/GroupSelect.js +7 -2
  34. package/es/v1/Select/SelectWithAvatar.js +7 -2
  35. package/es/v1/Select/props/defaultProps.js +4 -2
  36. package/es/v1/Select/props/propTypes.js +6 -2
  37. package/lib/DropBox/DropBoxElement/DropBoxElement.js +3 -1
  38. package/lib/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +4 -2
  39. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +56 -53
  40. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +2 -2
  41. package/lib/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +4 -2
  42. package/lib/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +3 -1
  43. package/lib/ListItem/ListItem.js +2 -2
  44. package/lib/ListItem/ListItem.module.css +15 -2
  45. package/lib/ListItem/ListItemWithAvatar.js +3 -3
  46. package/lib/ListItem/ListItemWithIcon.js +2 -2
  47. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +7 -3
  48. package/lib/MultiSelect/MultiSelect.js +6 -3
  49. package/lib/MultiSelect/Suggestions.js +12 -5
  50. package/lib/MultiSelect/props/defaultProps.js +9 -4
  51. package/lib/MultiSelect/props/propTypes.js +8 -3
  52. package/lib/Popup/Popup.js +282 -114
  53. package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +4 -2
  54. package/lib/Select/GroupSelect.js +4 -2
  55. package/lib/Select/SelectWithAvatar.js +8 -3
  56. package/lib/Select/SelectWithIcon.js +5 -3
  57. package/lib/Select/props/defaultProps.js +2 -1
  58. package/lib/Select/props/propTypes.js +4 -2
  59. package/lib/common/common.module.css +5 -0
  60. package/lib/utils/Common.js +5 -1
  61. package/lib/v1/ListItem/ListItem.js +1 -1
  62. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +3 -1
  63. package/lib/v1/MultiSelect/MultiSelect.js +8 -3
  64. package/lib/v1/MultiSelect/Suggestions.js +8 -4
  65. package/lib/v1/MultiSelect/props/defaultProps.js +4 -2
  66. package/lib/v1/MultiSelect/props/propTypes.js +6 -2
  67. package/lib/v1/Select/GroupSelect.js +8 -3
  68. package/lib/v1/Select/SelectWithAvatar.js +8 -3
  69. package/lib/v1/Select/props/defaultProps.js +4 -2
  70. package/lib/v1/Select/props/propTypes.js +6 -2
  71. package/package.json +2 -2
  72. package/result.json +1 -1
  73. package/assets/Appearance/dark/mode/Component_v2_DarkMode.module.css +0 -10
  74. package/assets/Appearance/light/mode/Component_v2_LightMode.module.css +0 -10
  75. package/assets/Appearance/pureDark/mode/Component_v2_PureDarkMode.module.css +0 -10
  76. package/es/components-v2/Switch/Switch.js +0 -124
  77. package/es/components-v2/Switch/contants/index.js +0 -10
  78. package/es/components-v2/Switch/css/Switch_v2.module.css +0 -121
  79. package/es/components-v2/Switch/css/cssJSLogic.js +0 -45
  80. package/es/components-v2/Switch/props/defaultProps.js +0 -19
  81. package/es/components-v2/Switch/props/propTypes.js +0 -27
  82. package/lib/components-v2/Switch/Switch.js +0 -138
  83. package/lib/components-v2/Switch/contants/index.js +0 -18
  84. package/lib/components-v2/Switch/css/Switch_v2.module.css +0 -121
  85. package/lib/components-v2/Switch/css/cssJSLogic.js +0 -36
  86. package/lib/components-v2/Switch/props/defaultProps.js +0 -26
  87. package/lib/components-v2/Switch/props/propTypes.js +0 -38
package/es/Popup/Popup.js CHANGED
@@ -4,11 +4,14 @@ import hoistStatics from 'hoist-non-react-statics';
4
4
  import { PopupPropTypes, ContextTypes } from "./props/propTypes";
5
5
  /**** Methods ****/
6
6
 
7
- import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from "../utils/Common.js";
7
+ import { debounce, isDescendant, isTextSelected, cancelBubblingEffect, DUMMY_OBJECT } from "../utils/Common.js";
8
8
  import viewPort from "./viewPort";
9
9
  import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from "./PositionMapping.js";
10
10
  import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
11
11
  import { addIntersectionObserver, removeIntersectionObserver } from "./intersectionObserver";
12
+ import { positionMapping } from "../DropBox/DropBoxPositionMapping.js";
13
+ import isMobilePopover from "../DropBox/utils/isMobilePopover.js";
14
+ import selectn from 'selectn';
12
15
  let lastOpenedGroup = [];
13
16
  let popups = {};
14
17
 
@@ -47,7 +50,8 @@ const Popup = function (Component) {
47
50
  isArrow: needPopupArrow = false,
48
51
  customOrder: customPositionOrder = [],
49
52
  scrollDebounceTime: popupScrollDebounceTime = 0,
50
- closeOnScroll: closeOnScrollPopup = false
53
+ closeOnScroll: closeOnScrollPopup = false,
54
+ isOutsideScrollBlocked: isOutsideScrollBlock = false
51
55
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
52
56
 
53
57
  class Popup extends React.Component {
@@ -66,7 +70,8 @@ const Popup = function (Component) {
66
70
  //{height: ‘’, width: ‘’,}
67
71
  popupOffset: {},
68
72
  //{height: ‘’, width: ‘’,}
69
- isAbsolutePositioningNeeded: true
73
+ isAbsolutePositioningNeeded: true,
74
+ isMobile: false
70
75
  };
71
76
  this.togglePopup = this.togglePopup.bind(this);
72
77
  this.documentClickHandler = this.documentClickHandler.bind(this);
@@ -81,10 +86,11 @@ const Popup = function (Component) {
81
86
  this.handleResize = debounce(this.handleResize.bind(this), 300);
82
87
  this.handlePopupResize = this.handlePopupResize.bind(this);
83
88
  this.getIsAbsolutePopup = this.getIsAbsolutePopup.bind(this);
89
+ this.getIsOutsideScrollBlocked = this.getIsOutsideScrollBlocked.bind(this);
84
90
  this.getNeedArrow = this.getNeedArrow.bind(this);
85
91
  this.getCustomPositionOrder = this.getCustomPositionOrder.bind(this);
86
- this.handleOpenPopupPositionChange = this.handleOpenPopupPositionChange.bind(this);
87
- this.getScrollDebounceTime = this.getScrollDebounceTime.bind(this);
92
+ this.handleOpenPopupPositionChange = this.handleOpenPopupPositionChange.bind(this); // this.getScrollDebounceTime = this.getScrollDebounceTime.bind(this);
93
+
88
94
  this.getCloseOnScrollPopup = this.getCloseOnScrollPopup.bind(this);
89
95
  this.handleCloseLastOpenedGroup = this.handleCloseLastOpenedGroup.bind(this);
90
96
  this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
@@ -98,19 +104,26 @@ const Popup = function (Component) {
98
104
  this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
99
105
  this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
100
106
  this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
107
+ this.updateVisibilityOnIntersection = this.updateVisibilityOnIntersection.bind(this);
108
+ this.handleAddingScrollToUpdatePosition = this.handleAddingScrollToUpdatePosition.bind(this);
109
+ this.handleRemovingScrollToUpdatePosition = this.handleRemovingScrollToUpdatePosition.bind(this);
110
+ this.updatePositionOnScroll = this.updatePositionOnScroll.bind(this);
111
+ this.setContainerDynamicPositioning = this.setContainerDynamicPositioning.bind(this);
112
+ this.updatePopupState = this.updatePopupState.bind(this);
113
+ this.handleScrollAndBlockEvents = this.handleScrollAndBlockEvents.bind(this);
114
+ this.handleDropElementStyleUpdate = this.handleDropElementStyleUpdate.bind(this);
115
+ this.positionRef = /*#__PURE__*/React.createRef();
101
116
  this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
102
117
 
103
118
  this.size = null;
119
+ this.isTargetElementVisible = false;
104
120
  this.isAbsolutePopup = isAbsolutePopup;
105
121
  this.needPopupArrow = needPopupArrow;
106
122
  this.customPositionOrder = customPositionOrder;
107
123
  this.scrollDebounceTime = popupScrollDebounceTime;
108
124
  this.closeOnScroll = closeOnScrollPopup;
109
- const {
110
- scrollDebounceTime
111
- } = this.getScrollDebounceTime(this);
112
- this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
113
- this.handleDebouncedPositionChange = debounce(this.handlePositionChange.bind(this), 100);
125
+ this.isOutsideScrollBlock = isOutsideScrollBlock; // const { scrollDebounceTime } = this.getScrollDebounceTime(this);
126
+ // this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
114
127
  }
115
128
 
116
129
  componentDidMount() {
@@ -143,12 +156,24 @@ const Popup = function (Component) {
143
156
  }
144
157
  }
145
158
 
159
+ handleScrollAndBlockEvents(isPopupReady, isMobile) {
160
+ if (isPopupReady && !isMobile) {
161
+ this.handleAddingScrollBlock();
162
+ this.handleAddingScrollToUpdatePosition();
163
+ } else {
164
+ this.handleRemovingScrollBlock();
165
+ this.handleRemovingScrollToUpdatePosition();
166
+ }
167
+ }
168
+
146
169
  componentDidUpdate(prevProps, prevState) {
147
170
  const {
148
- isPopupReady
171
+ isPopupReady,
172
+ isMobile
149
173
  } = this.state;
150
174
  const {
151
- isPopupReady: oldStateOpen = false
175
+ isPopupReady: oldStateOpen = false,
176
+ isMobile: oldIsMobileState
152
177
  } = prevState || {};
153
178
  const {
154
179
  dropElement
@@ -164,12 +189,10 @@ const Popup = function (Component) {
164
189
  this.size = null;
165
190
  this.popupObserver.disconnect();
166
191
  }
192
+ }
167
193
 
168
- if (isPopupReady) {
169
- this.handleAddingScrollBlock();
170
- } else {
171
- this.handleRemovingScrollBlock();
172
- }
194
+ if (oldStateOpen !== isPopupReady && !isMobile || oldIsMobileState !== isMobile) {
195
+ this.handleScrollAndBlockEvents(isPopupReady, isMobile);
173
196
  }
174
197
  }
175
198
 
@@ -186,6 +209,7 @@ const Popup = function (Component) {
186
209
  return res;
187
210
  }, popups);
188
211
  this.handleRemovingScrollBlock();
212
+ this.handleRemovingScrollToUpdatePosition();
189
213
  let noPopups = true;
190
214
 
191
215
  for (const i in popups) {
@@ -211,10 +235,8 @@ const Popup = function (Component) {
211
235
  }
212
236
 
213
237
  handleAddingScrollBlock() {
214
- const {
215
- isAbsolutePositioningNeeded,
216
- isOutsideScrollBlocked
217
- } = this.props;
238
+ const isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
239
+ const isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);
218
240
 
219
241
  if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
220
242
  addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
@@ -223,10 +245,8 @@ const Popup = function (Component) {
223
245
  }
224
246
 
225
247
  handleRemovingScrollBlock() {
226
- const {
227
- isAbsolutePositioningNeeded,
228
- isOutsideScrollBlocked
229
- } = this.props;
248
+ const isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
249
+ const isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);
230
250
 
231
251
  if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
232
252
  removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
@@ -234,6 +254,98 @@ const Popup = function (Component) {
234
254
  }
235
255
  }
236
256
 
257
+ handleAddingScrollToUpdatePosition() {
258
+ const isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
259
+ const isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);
260
+
261
+ if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
262
+ addIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
263
+ document.addEventListener('scroll', this.updatePositionOnScroll, {
264
+ capture: true,
265
+ passive: false
266
+ });
267
+ }
268
+ }
269
+
270
+ handleRemovingScrollToUpdatePosition() {
271
+ const isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
272
+ const isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);
273
+
274
+ if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
275
+ removeIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
276
+ document.removeEventListener('scroll', this.updatePositionOnScroll, {
277
+ capture: true,
278
+ passive: false
279
+ });
280
+ }
281
+ }
282
+
283
+ handleDropElementStyleUpdate(_ref) {
284
+ let {
285
+ top = '',
286
+ left = '',
287
+ bottom = '',
288
+ right = ''
289
+ } = _ref;
290
+ const {
291
+ dropElement
292
+ } = this;
293
+ Object.assign(dropElement.style, {
294
+ top: top ? `${top}px` : '',
295
+ left: left ? `${left}px` : '',
296
+ right: right ? `${right}px` : '',
297
+ bottom: bottom ? `${bottom}px` : ''
298
+ });
299
+ }
300
+
301
+ setContainerDynamicPositioning(betterPosition, needArrow) {
302
+ const {
303
+ dropElement
304
+ } = this;
305
+ const {
306
+ isMobile
307
+ } = this.state;
308
+ const {
309
+ view,
310
+ viewsOffset
311
+ } = betterPosition || DUMMY_OBJECT;
312
+ const styleToApply = selectn(`${view}`, viewsOffset);
313
+
314
+ if (isMobile) {
315
+ this.handleDropElementStyleUpdate({
316
+ top: '',
317
+ left: '',
318
+ right: '',
319
+ bottom: ''
320
+ });
321
+ } else {
322
+ this.handleDropElementStyleUpdate(styleToApply);
323
+
324
+ if (this.positionRef.current !== view) {
325
+ dropElement.setAttribute('data-position', `${view}`);
326
+ dropElement.setAttribute('data-box-direction', selectn(`${view}.direction`, positionMapping));
327
+
328
+ if (needArrow) {
329
+ dropElement.setAttribute('data-arrow-position', selectn(`${view}.arrowPosition`, positionMapping));
330
+ }
331
+
332
+ this.positionRef.current = view;
333
+ }
334
+ }
335
+ }
336
+
337
+ updatePositionOnScroll(e) {
338
+ const {
339
+ placeHolderElement,
340
+ defaultPosition,
341
+ isTargetElementVisible
342
+ } = this;
343
+
344
+ if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
345
+ this.handlePopupPosition(defaultPosition, true);
346
+ }
347
+ }
348
+
237
349
  addScrollBlockListeners() {
238
350
  document.addEventListener('wheel', this.handleBlockScroll, {
239
351
  capture: true,
@@ -243,7 +355,7 @@ const Popup = function (Component) {
243
355
  capture: true,
244
356
  passive: false
245
357
  });
246
- document.addEventListener('scroll', this.handleDebouncedPositionChange, {
358
+ document.addEventListener('scroll', this.handlePositionChange, {
247
359
  capture: true,
248
360
  passive: false
249
361
  });
@@ -262,7 +374,7 @@ const Popup = function (Component) {
262
374
  capture: true,
263
375
  passive: false
264
376
  });
265
- document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
377
+ document.removeEventListener('scroll', this.handlePositionChange, {
266
378
  capture: true,
267
379
  passive: false
268
380
  });
@@ -291,7 +403,7 @@ const Popup = function (Component) {
291
403
  const containerElement = this.dropElement;
292
404
 
293
405
  if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
294
- this.handlePopupPosition(this.state.position); // this.closePopupOnly(event);
406
+ this.handlePopupPosition(this.state.position, true); // this.closePopupOnly(event);
295
407
  }
296
408
  }
297
409
 
@@ -305,11 +417,25 @@ const Popup = function (Component) {
305
417
  }
306
418
 
307
419
  handleIntersectionObserver(entry) {
308
- if (entry.intersectionRatio === 0) {
420
+ if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
309
421
  this.closePopupOnly();
310
422
  }
311
423
  }
312
424
 
425
+ updateVisibilityOnIntersection(entry) {
426
+ const {
427
+ dropElement
428
+ } = this;
429
+
430
+ if (entry.isIntersecting === true) {
431
+ this.isTargetElementVisible = true;
432
+ dropElement.setAttribute('data-visible', 'visible');
433
+ } else if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
434
+ this.isTargetElementVisible = false;
435
+ dropElement.setAttribute('data-visible', 'hidden');
436
+ }
437
+ }
438
+
313
439
  getGroup() {
314
440
  const {
315
441
  popupGroup
@@ -325,17 +451,12 @@ const Popup = function (Component) {
325
451
  needPopupArrow
326
452
  } = popup;
327
453
  return isArrow !== undefined ? isArrow : needPopupArrow;
328
- }
454
+ } // getScrollDebounceTime(popup) {
455
+ // const { scrollDebounceTime } = popup.props;
456
+ // const { scrollDebounceTime: popupScrollDebounceTime } = popup;
457
+ // return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
458
+ // }
329
459
 
330
- getScrollDebounceTime(popup) {
331
- const {
332
- scrollDebounceTime
333
- } = popup.props;
334
- const {
335
- scrollDebounceTime: popupScrollDebounceTime
336
- } = popup;
337
- return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
338
- }
339
460
 
340
461
  getCloseOnScrollPopup(popup) {
341
462
  const {
@@ -357,6 +478,16 @@ const Popup = function (Component) {
357
478
  return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
358
479
  }
359
480
 
481
+ getIsOutsideScrollBlocked(popup) {
482
+ const {
483
+ isOutsideScrollBlocked
484
+ } = popup.props;
485
+ const {
486
+ isOutsideScrollBlock
487
+ } = popup;
488
+ return isOutsideScrollBlocked !== undefined ? isOutsideScrollBlocked : isOutsideScrollBlock;
489
+ }
490
+
360
491
  getCustomPositionOrder(popup) {
361
492
  const {
362
493
  customOrder = []
@@ -527,10 +658,24 @@ const Popup = function (Component) {
527
658
  cancelBubblingEffect(e);
528
659
  }
529
660
 
661
+ updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute) {
662
+ const isMobile = isMobilePopover(true);
663
+ this.setState({
664
+ isPopupReady: true,
665
+ position: view,
666
+ positions: views,
667
+ positionsOffset: viewsOffset,
668
+ targetOffset,
669
+ popupOffset,
670
+ isAbsolutePositioningNeeded: isAbsolute,
671
+ isMobile: isMobile
672
+ });
673
+ }
674
+
530
675
  handlePopupPosition() {
531
676
  let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
532
- let isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
533
- // isResizeHandling --->>> Window resize and dropBox resize
677
+ let isUpdatePosition = arguments.length > 1 ? arguments[1] : undefined;
678
+ // isUpdatePosition --->>> Window resize and dropBox resize and to update the position
534
679
  const {
535
680
  direction
536
681
  } = this.context || {};
@@ -549,9 +694,11 @@ const Popup = function (Component) {
549
694
  }
550
695
 
551
696
  if (!placeHolderElement && !dropElement) {
697
+ const isMobile = isMobilePopover(true);
552
698
  this.setState({
553
699
  isPopupOpen: true,
554
- isPopupReady: true
700
+ isPopupReady: true,
701
+ isMobile: isMobile
555
702
  });
556
703
  return;
557
704
  }
@@ -578,23 +725,27 @@ const Popup = function (Component) {
578
725
  viewsOffset,
579
726
  targetOffset,
580
727
  popupOffset
581
- } = betterPosition || {};
582
-
583
- if (position !== view || !isPopupReady) {
584
- this.setState({
585
- isPopupReady: true,
586
- position: view,
587
- positions: views,
588
- positionsOffset: viewsOffset,
589
- targetOffset,
590
- popupOffset,
591
- isAbsolutePositioningNeeded: isAbsolute
592
- });
728
+ } = betterPosition || DUMMY_OBJECT;
729
+
730
+ if (!isAbsolute) {
731
+ if (!isPopupReady) {
732
+ this.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
733
+ }
734
+
735
+ if (!dropElement) {
736
+ return;
737
+ }
738
+
739
+ this.setContainerDynamicPositioning(betterPosition, needArrow);
740
+ } else {
741
+ if (position !== view || !isPopupReady) {
742
+ this.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
743
+ }
593
744
  }
594
745
  });
595
746
  };
596
747
 
597
- if (isResizeHandling) {
748
+ if (isUpdatePosition) {
598
749
  setPosition();
599
750
  } else {
600
751
  this.defaultPosition = defaultPosition;
@@ -626,6 +777,7 @@ const Popup = function (Component) {
626
777
  const needArrow = this.getNeedArrow(popup);
627
778
  const isAbsolute = this.getIsAbsolutePopup(popup);
628
779
  const customOrder = this.getCustomPositionOrder(popup);
780
+ const isMobile = isMobilePopover(true);
629
781
  const betterPosition = viewPort.betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
630
782
  needArrow,
631
783
  isAbsolute,
@@ -641,14 +793,16 @@ const Popup = function (Component) {
641
793
  const {
642
794
  left: oldLeft = '',
643
795
  top: oldTop = '',
644
- bottom: oldBottom = ''
796
+ bottom: oldBottom = '',
797
+ right: oldRight = ''
645
798
  } = positionsOffset[position] || {};
646
799
  const {
647
800
  left = '',
648
801
  top = '',
649
- bottom = ''
802
+ bottom = '',
803
+ right = ''
650
804
  } = viewsOffset[view] || {};
651
- const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
805
+ const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom || oldRight !== right; // let isInViewPort = viewPort.isInViewPort(
652
806
  // placeHolderElement,
653
807
  // scrollContainer
654
808
  // );
@@ -660,7 +814,8 @@ const Popup = function (Component) {
660
814
  positionsOffset: viewsOffset,
661
815
  targetOffset,
662
816
  popupOffset,
663
- isAbsolutePositioningNeeded: isAbsolute
817
+ isAbsolutePositioningNeeded: isAbsolute,
818
+ isMobile: isMobile
664
819
  });
665
820
  } // if (!isInViewPort && !isAbsolute) {
666
821
  // popup.setState({ isPopupOpen: false, isPopupReady: false });
@@ -684,26 +839,19 @@ const Popup = function (Component) {
684
839
 
685
840
  handleResize() {
686
841
  this.handleOpenPopupPositionChange();
687
- }
688
-
689
- handleScroll(e) {
690
- // this.handleOpenPopupPositionChange();
691
- const {
692
- closeOnScroll
693
- } = this.getCloseOnScrollPopup(this);
694
- const {
695
- isPopupReady
696
- } = this.state;
697
-
698
- if (isPopupReady) {
699
- console.log('onscrollPopupREady');
700
- }
842
+ } // handleScroll(e) {
843
+ // // this.handleOpenPopupPositionChange();
844
+ // const { closeOnScroll } = this.getCloseOnScrollPopup(this);
845
+ // const { isPopupReady } = this.state;
846
+ // if (isPopupReady) {
847
+ // console.log('onscrollPopupREady');
848
+ // }
849
+ // if (isPopupReady && closeOnScroll) {
850
+ // console.log(this, 'handle Scroll');
851
+ // this.togglePopup(e);
852
+ // }
853
+ // }
701
854
 
702
- if (isPopupReady && closeOnScroll) {
703
- console.log(this, 'handle Scroll');
704
- this.togglePopup(e);
705
- }
706
- }
707
855
 
708
856
  handlePopupResize(popupSize) {
709
857
  const {
@@ -735,13 +883,14 @@ const Popup = function (Component) {
735
883
  }
736
884
 
737
885
  render() {
886
+ // const { isPopupReady, isPopupOpen } = this.state;
738
887
  const {
739
- isPopupReady,
740
- isPopupOpen
741
- } = this.state;
742
- const localState = isPopupReady ? this.state : {};
888
+ isMobile,
889
+ ...restState
890
+ } = this.state; // const localState = isPopupReady ? this.state : {};
891
+
743
892
  return /*#__PURE__*/React.createElement(Component, { ...this.props,
744
- ...this.state,
893
+ ...restState,
745
894
  openPopupOnly: this.openPopupOnly,
746
895
  closePopupOnly: this.closePopupOnly,
747
896
  togglePopup: this.togglePopup,
@@ -5,6 +5,8 @@ exports[`ResponsiveDropBox rendering the defult props 1`] = `
5
5
  <div
6
6
  class="main hidden container bottomStart default"
7
7
  data-a11y-focus-main-area="true"
8
+ data-arrow-position="end"
9
+ data-box-direction="bottom"
8
10
  data-id="dropBox"
9
11
  data-position="bottomStart"
10
12
  data-selector-id="dropBox"
@@ -12,14 +14,14 @@ exports[`ResponsiveDropBox rendering the defult props 1`] = `
12
14
  dot-ui-element="dropbox"
13
15
  >
14
16
  <div
15
- class="subContainer bottom_shadow radius defaultPalette"
17
+ class="subContainer shadow radius defaultPalette"
16
18
  data-id="dropBox_subcontainer"
17
19
  data-selector-id="dropBox_subcontainer"
18
20
  data-test-id="dropBox_subcontainer"
19
21
  tabindex="-1"
20
22
  >
21
23
  <div
22
- class="end"
24
+ class="arrowPosition"
23
25
  data-id="dropBox_arrow"
24
26
  data-selector-id="dropBox_arrow"
25
27
  data-test-id="dropBox_arrow"
@@ -591,6 +591,9 @@ export class GroupSelectComponent extends PureComponent {
591
591
  dataSelectorId,
592
592
  customProps
593
593
  } = this.props;
594
+ const {
595
+ suggestionsProps = {}
596
+ } = customProps;
594
597
  i18nKeys = Object.assign({}, i18nKeys, {
595
598
  emptyText: i18nKeys.emptyText || emptyMessage,
596
599
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
@@ -789,7 +792,8 @@ export class GroupSelectComponent extends PureComponent {
789
792
  ariaParentRole: 'listbox',
790
793
  role: 'option'
791
794
  },
792
- dataId: `${dataId}_Options`
795
+ dataId: `${dataId}_Options`,
796
+ ...suggestionsProps
793
797
  }));
794
798
  }) : /*#__PURE__*/React.createElement(EmptyState, {
795
799
  options: revampedGroups,
@@ -163,8 +163,12 @@ class SelectWithAvatarComponent extends SelectComponent {
163
163
  needEffect,
164
164
  isLoading,
165
165
  dataSelectorId,
166
- getTargetRef
166
+ getTargetRef,
167
+ customProps
167
168
  } = this.props;
169
+ const {
170
+ suggestionsProps = {}
171
+ } = customProps;
168
172
  i18nKeys = Object.assign({}, i18nKeys, {
169
173
  emptyText: i18nKeys.emptyText || emptyMessage,
170
174
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
@@ -321,7 +325,8 @@ class SelectWithAvatarComponent extends SelectComponent {
321
325
  a11y: {
322
326
  ariaParentRole: 'listbox',
323
327
  role: 'option'
324
- }
328
+ },
329
+ ...suggestionsProps
325
330
  }) : /*#__PURE__*/React.createElement(EmptyState, {
326
331
  isLoading: isFetchingOptions,
327
332
  options: options,
@@ -367,7 +367,8 @@ class SelectWithIcon extends Component {
367
367
  let {
368
368
  TextBoxProps = {},
369
369
  DropdownSearchTextBoxProps = {},
370
- TextBoxIconProps = {}
370
+ TextBoxIconProps = {},
371
+ listItemProps = {}
371
372
  } = customProps;
372
373
  return /*#__PURE__*/React.createElement("div", {
373
374
  className: `${style.container} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''}`,
@@ -530,7 +531,8 @@ class SelectWithIcon extends Component {
530
531
  role: 'option',
531
532
  ariaSelected: selectedId === options[idKey],
532
533
  ariaLabel: options[valueKey]
533
- }
534
+ },
535
+ ...listItemProps
534
536
  });
535
537
  })) : /*#__PURE__*/React.createElement(EmptyState, {
536
538
  isLoading: isFetchingOptions,
@@ -96,7 +96,8 @@ export const SelectWithAvatar_defaultProps = {
96
96
  isRestrictScroll: false,
97
97
  i18nKeys: {},
98
98
  needEffect: true,
99
- isLoading: false
99
+ isLoading: false,
100
+ customProps: {}
100
101
  };
101
102
  export const SelectWithIcon_defaultProps = {
102
103
  isReadOnly: false,
@@ -177,7 +177,8 @@ export const GroupSelect_propTypes = {
177
177
  isDefaultSelectValue: PropTypes.bool,
178
178
  customProps: PropTypes.shape({
179
179
  TextBoxProps: PropTypes.object,
180
- TextBoxIconProps: PropTypes.object
180
+ TextBoxIconProps: PropTypes.object,
181
+ suggestionsProps: PropTypes.object
181
182
  })
182
183
  };
183
184
  export const SelectWithAvatar_propTypes = { ...Select_propTypes,
@@ -239,7 +240,8 @@ export const SelectWithAvatar_propTypes = { ...Select_propTypes,
239
240
  htmlId: PropTypes.string,
240
241
  needEffect: PropTypes.bool,
241
242
  isLoading: PropTypes.bool,
242
- dataSelectorId: PropTypes.string
243
+ dataSelectorId: PropTypes.string,
244
+ customProps: PropTypes.string
243
245
  };
244
246
  export const SelectWithIcon_propTypes = {
245
247
  animationStyle: PropTypes.oneOf(['default', 'bounce']),
@@ -494,6 +494,11 @@
494
494
  overflow: hidden;
495
495
  }
496
496
 
497
+ .listItemClamp {
498
+ composes: wbreak clamp;
499
+ -webkit-line-clamp: var(--line-clamp-count,3);
500
+ }
501
+
497
502
  .offSelection {
498
503
  -webkit-user-select: none;
499
504
  -moz-user-select: none;
@@ -412,4 +412,5 @@ export function isTextSelected() {
412
412
  }
413
413
 
414
414
  return false;
415
- }
415
+ }
416
+ export const DUMMY_OBJECT = {};
@@ -81,7 +81,7 @@ const ListItem = props => {
81
81
  autoHover: autoHover,
82
82
  needTick: needTick,
83
83
  needBorder: needBorder,
84
- customClass: customListItem,
84
+ customClass: `${customListItem} ${needMultiLineText ? style.txtAlignBaseLine + ' ' + style.autoHeight : ''} ${customListItem}`,
85
85
  dataId: dataIdString,
86
86
  dataSelectorId: `${dataSelectorId}`,
87
87
  isLink: isLink,