@zohodesk/components 1.0.0-temp-199.5 → 1.0.0-temp-215

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 (112) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +19 -0
  3. package/es/CheckBox/CheckBox.js +6 -5
  4. package/es/CheckBox/CheckBox.module.css +5 -2
  5. package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
  6. package/es/DateTime/DateTime.js +8 -4
  7. package/es/DateTime/DateWidget.js +8 -1
  8. package/es/DateTime/props/propTypes.js +5 -0
  9. package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -0
  10. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -48
  11. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +4 -4
  12. package/es/ListItem/ListItem.js +2 -2
  13. package/es/ListItem/ListItem.module.css +18 -85
  14. package/es/ListItem/ListItemWithAvatar.js +3 -3
  15. package/es/ListItem/ListItemWithIcon.js +2 -2
  16. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
  17. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
  18. package/es/MultiSelect/AdvancedGroupMultiSelect.js +4 -7
  19. package/es/MultiSelect/AdvancedMultiSelect.js +5 -4
  20. package/es/MultiSelect/MultiSelect.js +6 -9
  21. package/es/MultiSelect/Suggestions.js +4 -8
  22. package/es/MultiSelect/props/defaultProps.js +4 -6
  23. package/es/MultiSelect/props/propTypes.js +7 -7
  24. package/es/Popup/Popup.js +173 -35
  25. package/es/Popup/intersectionObserver.js +33 -23
  26. package/es/Popup/props/propTypes.js +1 -1
  27. package/es/Radio/Radio.js +9 -7
  28. package/es/Radio/Radio.module.css +1 -1
  29. package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
  30. package/es/Select/GroupSelect.js +9 -7
  31. package/es/Select/SelectWithAvatar.js +2 -7
  32. package/es/Select/SelectWithIcon.js +2 -4
  33. package/es/Select/props/defaultProps.js +1 -2
  34. package/es/Select/props/propTypes.js +5 -3
  35. package/es/Textarea/Textarea.js +4 -2
  36. package/es/Textarea/Textarea.module.css +1 -1
  37. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
  38. package/es/Textarea/props/propTypes.js +2 -1
  39. package/es/Typography/Typography.js +38 -0
  40. package/es/Typography/css/Typography.module.css +489 -0
  41. package/es/Typography/css/cssJSLogic.js +56 -0
  42. package/es/Typography/props/defaultProps.js +8 -0
  43. package/es/Typography/props/propTypes.js +27 -0
  44. package/es/Typography/utils/index.js +50 -0
  45. package/es/index.js +1 -1
  46. package/es/v1/MultiSelect/AdvancedMultiSelect.js +1 -2
  47. package/es/v1/MultiSelect/MultiSelect.js +2 -7
  48. package/es/v1/MultiSelect/Suggestions.js +4 -8
  49. package/es/v1/MultiSelect/props/defaultProps.js +2 -4
  50. package/es/v1/MultiSelect/props/propTypes.js +2 -6
  51. package/es/v1/Select/GroupSelect.js +2 -7
  52. package/es/v1/Select/SelectWithAvatar.js +2 -7
  53. package/es/v1/Select/props/defaultProps.js +2 -4
  54. package/es/v1/Select/props/propTypes.js +2 -6
  55. package/es/v1/Typography/Typography.js +1 -1
  56. package/lib/CheckBox/CheckBox.js +5 -4
  57. package/lib/CheckBox/CheckBox.module.css +5 -2
  58. package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
  59. package/lib/DateTime/DateTime.js +11 -5
  60. package/lib/DateTime/DateWidget.js +8 -1
  61. package/lib/DateTime/props/propTypes.js +5 -0
  62. package/lib/DropBox/DropBoxElement/DropBoxElement.js +1 -0
  63. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -48
  64. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +2 -2
  65. package/lib/ListItem/ListItem.js +2 -2
  66. package/lib/ListItem/ListItem.module.css +18 -85
  67. package/lib/ListItem/ListItemWithAvatar.js +3 -3
  68. package/lib/ListItem/ListItemWithIcon.js +2 -2
  69. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
  70. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
  71. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +5 -7
  72. package/lib/MultiSelect/AdvancedMultiSelect.js +5 -5
  73. package/lib/MultiSelect/MultiSelect.js +7 -8
  74. package/lib/MultiSelect/Suggestions.js +4 -8
  75. package/lib/MultiSelect/props/defaultProps.js +4 -6
  76. package/lib/MultiSelect/props/propTypes.js +7 -7
  77. package/lib/Popup/Popup.js +212 -74
  78. package/lib/Popup/intersectionObserver.js +35 -25
  79. package/lib/Popup/props/propTypes.js +1 -1
  80. package/lib/Radio/Radio.js +10 -7
  81. package/lib/Radio/Radio.module.css +1 -1
  82. package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
  83. package/lib/Select/GroupSelect.js +10 -8
  84. package/lib/Select/SelectWithAvatar.js +3 -8
  85. package/lib/Select/SelectWithIcon.js +3 -5
  86. package/lib/Select/props/defaultProps.js +1 -2
  87. package/lib/Select/props/propTypes.js +5 -3
  88. package/lib/Textarea/Textarea.js +4 -2
  89. package/lib/Textarea/Textarea.module.css +1 -1
  90. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
  91. package/lib/Textarea/props/propTypes.js +2 -1
  92. package/lib/Typography/Typography.js +56 -0
  93. package/lib/Typography/css/Typography.module.css +489 -0
  94. package/lib/Typography/css/cssJSLogic.js +48 -0
  95. package/lib/Typography/props/defaultProps.js +15 -0
  96. package/lib/Typography/props/propTypes.js +38 -0
  97. package/lib/Typography/utils/index.js +59 -0
  98. package/lib/index.js +1 -1
  99. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +1 -3
  100. package/lib/v1/MultiSelect/MultiSelect.js +3 -8
  101. package/lib/v1/MultiSelect/Suggestions.js +4 -8
  102. package/lib/v1/MultiSelect/props/defaultProps.js +2 -4
  103. package/lib/v1/MultiSelect/props/propTypes.js +2 -6
  104. package/lib/v1/Select/GroupSelect.js +3 -8
  105. package/lib/v1/Select/SelectWithAvatar.js +3 -8
  106. package/lib/v1/Select/props/defaultProps.js +2 -4
  107. package/lib/v1/Select/props/propTypes.js +2 -6
  108. package/lib/v1/Typography/Typography.js +2 -2
  109. package/package.json +4 -4
  110. package/result.json +1 -1
  111. /package/es/v1/Typography/css/{Typography.module.css → v1_Typography.module.css} +0 -0
  112. /package/lib/v1/Typography/css/{Typography.module.css → v1_Typography.module.css} +0 -0
@@ -440,7 +440,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
440
440
  isAbsolutePositioningNeeded = _this$props5.isAbsolutePositioningNeeded,
441
441
  positionsOffset = _this$props5.positionsOffset,
442
442
  targetOffset = _this$props5.targetOffset,
443
- isRestrictScroll = _this$props5.isRestrictScroll;
443
+ isRestrictScroll = _this$props5.isRestrictScroll,
444
+ isFocus = _this$props5.isFocus;
444
445
  var _customProps$Suggesti = customProps.SuggestionsProps,
445
446
  SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti,
446
447
  _customProps$DropBoxP = customProps.DropBoxProps,
@@ -479,6 +480,7 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
479
480
  isShowClear = _this$getIsShowClearI.isShowClearIcon;
480
481
 
481
482
  var isShowClearIcon = !isReadOnly && !isDisabled && isShowClear;
483
+ var isEditable = !(isReadOnly || isDisabled);
482
484
  return /*#__PURE__*/_react["default"].createElement("div", {
483
485
  className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(borderColor === 'transparent' ? _MultiSelectModule["default"].transparentContainer : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : '', " ").concat(containerClass),
484
486
  "data-id": dataIdMultiSelectComp,
@@ -489,7 +491,7 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
489
491
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
490
492
  align: "vertical",
491
493
  alignBox: "row",
492
- className: "".concat(_MultiSelectModule["default"].container, " ").concat(_MultiSelectModule["default"][size], " ").concat(isActive && needBorder ? _MultiSelectModule["default"].active : '', " ").concat(needBorder ? _MultiSelectModule["default"].hasBorder : '', " ").concat(needBorder ? !isDisabled ? _MultiSelectModule["default"]["borderColor_".concat(borderColor)] : _MultiSelectModule["default"].borderColor_transparent : ''),
494
+ className: "".concat(_MultiSelectModule["default"].container, " ").concat(_MultiSelectModule["default"][size], " ").concat(isActive && needBorder || isEditable && isFocus && needBorder ? _MultiSelectModule["default"].active : '', " ").concat(needBorder ? _MultiSelectModule["default"].hasBorder : '', " ").concat(needBorder ? !isDisabled ? _MultiSelectModule["default"]["borderColor_".concat(borderColor)] : _MultiSelectModule["default"].borderColor_transparent : ''),
493
495
  eleRef: this.selectedOptionContainerRef,
494
496
  wrap: "wrap"
495
497
  }, /*#__PURE__*/_react["default"].createElement(_SelectedOptions["default"], {
@@ -611,9 +613,7 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
611
613
  role: 'option'
612
614
  },
613
615
  dataId: "".concat(dataIdMultiSelectComp, "_Options")
614
- }, SuggestionsProps, {
615
- needMultiLineText: true
616
- })) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
616
+ }, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
617
617
  isLoading: isFetchingOptions,
618
618
  options: options,
619
619
  searchString: searchStr,
@@ -960,7 +960,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
960
960
  setAriaId = _this$props14.setAriaId,
961
961
  isPopupOpen = _this$props14.isPopupOpen,
962
962
  ariaErrorId = _this$props14.ariaErrorId,
963
- customProps = _this$props14.customProps;
963
+ customProps = _this$props14.customProps,
964
+ isFocus = _this$props14.isFocus;
964
965
  var _this$state8 = this.state,
965
966
  isActive = _this$state8.isActive,
966
967
  selectedOptions = _this$state8.selectedOptions,
@@ -979,12 +980,13 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
979
980
  isShowClear = _this$getIsShowClearI.isShowClearIcon;
980
981
 
981
982
  var isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
983
+ var isEditable = !(isReadOnly || isDisabled || disableAction);
982
984
  var _customProps$TextBoxI = customProps.TextBoxIconProps,
983
985
  TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI;
984
986
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
985
987
  align: "vertical",
986
988
  alignBox: "row",
987
- className: "".concat(_MultiSelectModule["default"].container, " ").concat(_MultiSelectModule["default"][size], " ").concat(needBorder ? !disableAction ? _MultiSelectModule["default"]["borderColor_".concat(borderColor)] : _MultiSelectModule["default"].borderColor_transparent : '', " ").concat(isActive && needBorder || isResponsive ? _MultiSelectModule["default"].active : '', " ").concat(textBoxClass, " ").concat(needBorder ? _MultiSelectModule["default"].hasBorder : ''),
989
+ className: "".concat(_MultiSelectModule["default"].container, " ").concat(_MultiSelectModule["default"][size], " ").concat(needBorder ? !disableAction ? _MultiSelectModule["default"]["borderColor_".concat(borderColor)] : _MultiSelectModule["default"].borderColor_transparent : '', " ").concat(isActive && needBorder || isResponsive || isEditable && isFocus && needBorder ? _MultiSelectModule["default"].active : '', " ").concat(textBoxClass, " ").concat(needBorder ? _MultiSelectModule["default"].hasBorder : ''),
988
990
  eleRef: this.selectedOptionContainerRef,
989
991
  wrap: "wrap"
990
992
  }, /*#__PURE__*/_react["default"].createElement(_SelectedOptions["default"], {
@@ -1093,10 +1095,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1093
1095
  boxSize = _this$props15.boxSize,
1094
1096
  isLoading = _this$props15.isLoading,
1095
1097
  selectAllText = _this$props15.selectAllText,
1096
- needSelectAll = _this$props15.needSelectAll,
1097
- customProps = _this$props15.customProps;
1098
- var _customProps$suggesti = customProps.suggestionsProps,
1099
- suggestionsProps = _customProps$suggesti === void 0 ? {} : _customProps$suggesti;
1098
+ needSelectAll = _this$props15.needSelectAll;
1100
1099
  var _this$state9 = this.state,
1101
1100
  selectedOptions = _this$state9.selectedOptions,
1102
1101
  searchStr = _this$state9.searchStr,
@@ -1173,7 +1172,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1173
1172
  eleRef: this.suggestionContainerRef
1174
1173
  }, isSearching ? /*#__PURE__*/_react["default"].createElement("div", {
1175
1174
  className: _MultiSelectModule["default"][palette]
1176
- }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
1175
+ }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
1177
1176
  suggestions: suggestions,
1178
1177
  getRef: this.suggestionItemRef,
1179
1178
  hoverOption: hoverOption,
@@ -1186,7 +1185,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1186
1185
  a11y: {
1187
1186
  role: 'option'
1188
1187
  }
1189
- }, suggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1188
+ }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1190
1189
  isLoading: isFetchingOptions,
1191
1190
  options: options,
1192
1191
  searchString: searchStr,
@@ -83,8 +83,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
83
83
  avatarPalette = _this$props.avatarPalette,
84
84
  palette = _this$props.palette,
85
85
  htmlId = _this$props.htmlId,
86
- a11y = _this$props.a11y,
87
- needMultiLineText = _this$props.needMultiLineText;
86
+ a11y = _this$props.a11y;
88
87
  var ariaParentRole = a11y.ariaParentRole,
89
88
  ariaMultiselectable = a11y.ariaMultiselectable;
90
89
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
@@ -144,8 +143,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
144
143
  size: listItemSize,
145
144
  avatarPalette: avatarPalette,
146
145
  palette: palette,
147
- a11y: list_a11y,
148
- needMultiLineText: needMultiLineText
146
+ a11y: list_a11y
149
147
  }));
150
148
  } else if (optionType === 'icon') {
151
149
  return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({}, commonProps, {
@@ -165,8 +163,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
165
163
  iconSize: iconSize,
166
164
  size: listItemSize,
167
165
  palette: palette,
168
- a11y: list_a11y,
169
- needMultiLineText: needMultiLineText
166
+ a11y: list_a11y
170
167
  }));
171
168
  }
172
169
 
@@ -185,8 +182,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
185
182
  active: isActive,
186
183
  size: listItemSize,
187
184
  palette: palette,
188
- a11y: list_a11y,
189
- needMultiLineText: needMultiLineText
185
+ a11y: list_a11y
190
186
  }));
191
187
  })));
192
188
  }
@@ -45,8 +45,7 @@ var AdvancedGroupMultiSelect_defaultProps = {
45
45
  needEffect: true,
46
46
  palette: 'default',
47
47
  isLoading: false,
48
- dataSelectorId: 'advancedGroupMultiSelect',
49
- customProps: {}
48
+ dataSelectorId: 'advancedGroupMultiSelect'
50
49
  };
51
50
  exports.AdvancedGroupMultiSelect_defaultProps = AdvancedGroupMultiSelect_defaultProps;
52
51
  var AdvancedMultiSelect_defaultProps = {
@@ -168,8 +167,8 @@ var MultiSelectWithAvatar_defaultProps = {
168
167
  isLoading: false,
169
168
  dataSelectorId: 'multiSelectWithAvatar',
170
169
  keepSelectedOptions: false,
171
- needResponsive: true,
172
- customProps: {}
170
+ customProps: {},
171
+ needResponsive: true
173
172
  };
174
173
  exports.MultiSelectWithAvatar_defaultProps = MultiSelectWithAvatar_defaultProps;
175
174
  var SelectedOptions_defaultProps = {
@@ -178,7 +177,6 @@ var SelectedOptions_defaultProps = {
178
177
  };
179
178
  exports.SelectedOptions_defaultProps = SelectedOptions_defaultProps;
180
179
  var Suggestions_defaultProps = {
181
- a11y: {},
182
- needMultiLineText: false
180
+ a11y: {}
183
181
  };
184
182
  exports.Suggestions_defaultProps = Suggestions_defaultProps;
@@ -129,9 +129,9 @@ var MultiSelect_propTypes = {
129
129
  setAriaId: _propTypes["default"].string,
130
130
  ariaErrorId: _propTypes["default"].string,
131
131
  customProps: _propTypes["default"].shape({
132
- TextBoxIconProps: _propTypes["default"].object,
133
- suggestionsProps: _propTypes["default"].object
134
- })
132
+ TextBoxIconProps: _propTypes["default"].object
133
+ }),
134
+ isFocus: _propTypes["default"].bool
135
135
  };
136
136
  exports.MultiSelect_propTypes = MultiSelect_propTypes;
137
137
  var MultiSelectHeader_propTypes = {
@@ -201,8 +201,7 @@ var Suggestions_propTypes = {
201
201
  logo: _propTypes["default"].string,
202
202
  optionType: _propTypes["default"].string,
203
203
  listItemProps: _propTypes["default"].object
204
- })),
205
- needMultiLineText: _propTypes["default"].bool
204
+ }))
206
205
  };
207
206
  exports.Suggestions_propTypes = Suggestions_propTypes;
208
207
  var AdvancedGroupMultiSelect_propTypes = (_AdvancedGroupMultiSe = {
@@ -273,7 +272,7 @@ var AdvancedGroupMultiSelect_propTypes = (_AdvancedGroupMultiSe = {
273
272
  needToCloseOnSelect: _propTypes["default"].func,
274
273
  searchStr: _propTypes["default"].string,
275
274
  children: _propTypes["default"].node
276
- }, _defineProperty(_AdvancedGroupMultiSe, "dataSelectorId", _propTypes["default"].string), _defineProperty(_AdvancedGroupMultiSe, "customProps", _propTypes["default"].string), _AdvancedGroupMultiSe);
275
+ }, _defineProperty(_AdvancedGroupMultiSe, "dataSelectorId", _propTypes["default"].string), _defineProperty(_AdvancedGroupMultiSe, "isFocus", _propTypes["default"].bool), _AdvancedGroupMultiSe);
277
276
  exports.AdvancedGroupMultiSelect_propTypes = AdvancedGroupMultiSelect_propTypes;
278
277
 
279
278
  var AdvancedMultiSelect_propTypes = _objectSpread(_objectSpread({}, MultiSelect_propTypes), {}, {
@@ -349,7 +348,8 @@ var AdvancedMultiSelect_propTypes = _objectSpread(_objectSpread({}, MultiSelect_
349
348
  }),
350
349
  isLoading: _propTypes["default"].bool,
351
350
  dataSelectorId: _propTypes["default"].string,
352
- customClass: _propTypes["default"].object
351
+ customClass: _propTypes["default"].object,
352
+ isFocus: _propTypes["default"].bool
353
353
  });
354
354
 
355
355
  exports.AdvancedMultiSelect_propTypes = AdvancedMultiSelect_propTypes;
@@ -23,6 +23,8 @@ var _ResizeObserver = _interopRequireDefault(require("@zohodesk/virtualizer/lib/
23
23
 
24
24
  var _intersectionObserver = require("./intersectionObserver");
25
25
 
26
+ var _DropBoxPositionMapping = require("../DropBox/DropBoxPositionMapping.js");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
29
 
28
30
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -158,7 +160,15 @@ var Popup = function Popup(Component) {
158
160
  _this.preventKeyboardScroll = _this.preventKeyboardScroll.bind(_assertThisInitialized(_this));
159
161
  _this.addScrollBlockListeners = _this.addScrollBlockListeners.bind(_assertThisInitialized(_this));
160
162
  _this.removeScrollBlockListeners = _this.removeScrollBlockListeners.bind(_assertThisInitialized(_this));
163
+ _this.handleAddingScrollBlock = _this.handleAddingScrollBlock.bind(_assertThisInitialized(_this));
164
+ _this.handleRemovingScrollBlock = _this.handleRemovingScrollBlock.bind(_assertThisInitialized(_this));
161
165
  _this.handleIntersectionObserver = _this.handleIntersectionObserver.bind(_assertThisInitialized(_this));
166
+ _this.updateVisibilityOnIntersection = _this.updateVisibilityOnIntersection.bind(_assertThisInitialized(_this));
167
+ _this.handleAddingScrollToUpdatePosition = _this.handleAddingScrollToUpdatePosition.bind(_assertThisInitialized(_this));
168
+ _this.handleRemovingScrollToUpdatePosition = _this.handleRemovingScrollToUpdatePosition.bind(_assertThisInitialized(_this));
169
+ _this.updatePositionOnScroll = _this.updatePositionOnScroll.bind(_assertThisInitialized(_this));
170
+ _this.setContainerDynamicPositioning = _this.setContainerDynamicPositioning.bind(_assertThisInitialized(_this));
171
+ _this.positionRef = /*#__PURE__*/_react["default"].createRef();
162
172
  _this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize); //dropBoxSize
163
173
 
164
174
  _this.size = null;
@@ -216,10 +226,7 @@ var Popup = function Popup(Component) {
216
226
  oldStateOpen = _ref2$isPopupReady === void 0 ? false : _ref2$isPopupReady;
217
227
 
218
228
  var dropElement = this.dropElement;
219
- var _this$props = this.props,
220
- propResizeHandling = _this$props.needResizeHandling,
221
- isAbsolutePositioningNeeded = _this$props.isAbsolutePositioningNeeded,
222
- isOutsideScrollBlocked = _this$props.isOutsideScrollBlocked;
229
+ var propResizeHandling = this.props.needResizeHandling;
223
230
 
224
231
  if (oldStateOpen !== isPopupReady) {
225
232
  if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
@@ -229,14 +236,12 @@ var Popup = function Popup(Component) {
229
236
  this.popupObserver.disconnect();
230
237
  }
231
238
 
232
- if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
233
- if (isPopupReady) {
234
- (0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
235
- this.addScrollBlockListeners();
236
- } else {
237
- (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
238
- this.removeScrollBlockListeners();
239
- }
239
+ if (isPopupReady) {
240
+ this.handleAddingScrollBlock();
241
+ this.handleAddingScrollToUpdatePosition();
242
+ } else {
243
+ this.handleRemovingScrollBlock();
244
+ this.handleRemovingScrollToUpdatePosition();
240
245
  }
241
246
  }
242
247
  }
@@ -258,8 +263,7 @@ var Popup = function Popup(Component) {
258
263
 
259
264
  return res;
260
265
  }, popups);
261
- (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
262
- this.removeScrollBlockListeners();
266
+ this.handleRemovingScrollBlock();
263
267
  var noPopups = true;
264
268
 
265
269
  for (var i in popups) {
@@ -283,6 +287,113 @@ var Popup = function Popup(Component) {
283
287
  document.removeEventListener('focus', this.handleDocumentFocus, true);
284
288
  }
285
289
  }
290
+ }, {
291
+ key: "handleAddingScrollBlock",
292
+ value: function handleAddingScrollBlock() {
293
+ var _this$props = this.props,
294
+ isAbsolutePositioningNeeded = _this$props.isAbsolutePositioningNeeded,
295
+ fixedPopupScrollBehavior = _this$props.fixedPopupScrollBehavior;
296
+
297
+ if (fixedPopupScrollBehavior === 'block' && !isAbsolutePositioningNeeded) {
298
+ (0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
299
+ this.addScrollBlockListeners();
300
+ }
301
+ }
302
+ }, {
303
+ key: "handleRemovingScrollBlock",
304
+ value: function handleRemovingScrollBlock() {
305
+ var _this$props2 = this.props,
306
+ isAbsolutePositioningNeeded = _this$props2.isAbsolutePositioningNeeded,
307
+ fixedPopupScrollBehavior = _this$props2.fixedPopupScrollBehavior;
308
+
309
+ if (fixedPopupScrollBehavior === 'block' && !isAbsolutePositioningNeeded) {
310
+ (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
311
+ this.removeScrollBlockListeners();
312
+ }
313
+ }
314
+ }, {
315
+ key: "handleAddingScrollToUpdatePosition",
316
+ value: function handleAddingScrollToUpdatePosition() {
317
+ var _this$props3 = this.props,
318
+ isAbsolutePositioningNeeded = _this$props3.isAbsolutePositioningNeeded,
319
+ fixedPopupScrollBehavior = _this$props3.fixedPopupScrollBehavior;
320
+
321
+ if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
322
+ (0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.updateVisibilityOnIntersection);
323
+ document.addEventListener('scroll', this.updatePositionOnScroll, {
324
+ capture: true,
325
+ passive: false
326
+ });
327
+ }
328
+ }
329
+ }, {
330
+ key: "handleRemovingScrollToUpdatePosition",
331
+ value: function handleRemovingScrollToUpdatePosition() {
332
+ var _this$props4 = this.props,
333
+ isAbsolutePositioningNeeded = _this$props4.isAbsolutePositioningNeeded,
334
+ fixedPopupScrollBehavior = _this$props4.fixedPopupScrollBehavior;
335
+
336
+ if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
337
+ (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.updateVisibilityOnIntersection);
338
+ document.removeEventListener('scroll', this.updatePositionOnScroll, {
339
+ capture: true,
340
+ passive: false
341
+ });
342
+ }
343
+ }
344
+ }, {
345
+ key: "setContainerDynamicPositioning",
346
+ value: function setContainerDynamicPositioning() {
347
+ var _this3 = this;
348
+
349
+ var placeHolderElement = this.placeHolderElement,
350
+ dropElement = this.dropElement,
351
+ defaultPosition = this.defaultPosition;
352
+
353
+ if (!dropElement) {
354
+ return;
355
+ }
356
+
357
+ var needArrow = this.getNeedArrow(this);
358
+ var isAbsolute = this.getIsAbsolutePopup(this);
359
+ var customOrder = this.getCustomPositionOrder(this);
360
+ var styleToApply = {
361
+ top: '',
362
+ left: '',
363
+ right: '',
364
+ bottom: ''
365
+ };
366
+ requestAnimationFrame(function () {
367
+ var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, '', {
368
+ needArrow: needArrow,
369
+ isAbsolute: isAbsolute,
370
+ customOrder: customOrder
371
+ });
372
+
373
+ var _ref3 = betterPosition || {},
374
+ view = _ref3.view,
375
+ viewsOffset = _ref3.viewsOffset;
376
+
377
+ Object.assign(styleToApply, viewsOffset[view]);
378
+ Object.assign(dropElement.style, {
379
+ inset: "".concat(styleToApply.top !== '' ? "".concat(styleToApply.top, "px") : 'auto', " ").concat(styleToApply.right !== '' ? "".concat(styleToApply.right, "px") : 'auto', " ").concat(styleToApply.bottom !== '' ? "".concat(styleToApply.bottom, "px") : 'auto', " ").concat(styleToApply.left !== '' ? "".concat(styleToApply.left, "px") : 'auto')
380
+ });
381
+
382
+ if (_this3.positionRef.current !== view) {
383
+ dropElement.setAttribute('data-position', "".concat(view));
384
+ dropElement.setAttribute('data-direction', "".concat(_DropBoxPositionMapping.positionMapping[view].direction));
385
+ }
386
+ });
387
+ }
388
+ }, {
389
+ key: "updatePositionOnScroll",
390
+ value: function updatePositionOnScroll(e) {
391
+ if (e.target.contains(this.placeHolderElement)) {
392
+ // Set position for the dropbox
393
+ this.setContainerDynamicPositioning();
394
+ return;
395
+ }
396
+ }
286
397
  }, {
287
398
  key: "addScrollBlockListeners",
288
399
  value: function addScrollBlockListeners() {
@@ -365,6 +476,19 @@ var Popup = function Popup(Component) {
365
476
  this.closePopupOnly();
366
477
  }
367
478
  }
479
+ }, {
480
+ key: "updateVisibilityOnIntersection",
481
+ value: function updateVisibilityOnIntersection(entry) {
482
+ var dropElement = this.dropElement;
483
+
484
+ if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
485
+ dropElement.setAttribute('data-visible', 'hidden');
486
+ }
487
+
488
+ if (entry.isIntersecting === true) {
489
+ dropElement.setAttribute('data-visible', 'visible');
490
+ }
491
+ }
368
492
  }, {
369
493
  key: "getGroup",
370
494
  value: function getGroup() {
@@ -410,7 +534,7 @@ var Popup = function Popup(Component) {
410
534
  }, {
411
535
  key: "togglePopup",
412
536
  value: function togglePopup(e, defaultPosition) {
413
- var _this3 = this;
537
+ var _this4 = this;
414
538
 
415
539
  var group = this.getGroup();
416
540
  this.removeClose(e);
@@ -419,7 +543,7 @@ var Popup = function Popup(Component) {
419
543
  lastOpenedGroup = !isPopupOpen && lastOpenedGroup.indexOf(group) === -1 ? [group].concat(_toConsumableArray(lastOpenedGroup)) : lastOpenedGroup;
420
544
  isPopupOpen && lastOpenedGroup.splice(0, 1);
421
545
  groupPopups.forEach(function (popup) {
422
- if (popup !== _this3 && popup.state.isPopupOpen) {
546
+ if (popup !== _this4 && popup.state.isPopupOpen) {
423
547
  popup.setState({
424
548
  isPopupOpen: false,
425
549
  isPopupReady: false
@@ -574,17 +698,20 @@ var Popup = function Popup(Component) {
574
698
  }, {
575
699
  key: "handlePopupPosition",
576
700
  value: function handlePopupPosition() {
577
- var _this4 = this;
701
+ var _this5 = this;
578
702
 
579
703
  var defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
580
704
  var isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
581
705
 
582
706
  // isResizeHandling --->>> Window resize and dropBox resize
583
- var _ref3 = this.context || {},
584
- direction = _ref3.direction;
707
+ var _ref4 = this.context || {},
708
+ direction = _ref4.direction;
585
709
 
586
710
  var placeHolderElement = this.placeHolderElement,
587
711
  dropElement = this.dropElement;
712
+ var _this$props5 = this.props,
713
+ fixedPopupScrollBehavior = _this$props5.fixedPopupScrollBehavior,
714
+ isAbsolutePositioningNeeded = _this$props5.isAbsolutePositioningNeeded;
588
715
  var needArrow = this.getNeedArrow(this);
589
716
  var isAbsolute = this.getIsAbsolutePopup(this);
590
717
  var customOrder = this.getCustomPositionOrder(this);
@@ -605,36 +732,47 @@ var Popup = function Popup(Component) {
605
732
 
606
733
  var setPosition = function setPosition() {
607
734
  requestAnimationFrame(function () {
608
- var placeHolderElement = _this4.placeHolderElement,
609
- dropElement = _this4.dropElement;
610
- var _this4$state = _this4.state,
611
- position = _this4$state.position,
612
- isPopupReady = _this4$state.isPopupReady;
735
+ var placeHolderElement = _this5.placeHolderElement,
736
+ dropElement = _this5.dropElement;
737
+ var _this5$state = _this5.state,
738
+ position = _this5$state.position,
739
+ isPopupReady = _this5$state.isPopupReady;
613
740
  var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
614
741
 
615
- var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
616
- needArrow: needArrow,
617
- isAbsolute: isAbsolute,
618
- customOrder: customOrder
619
- });
742
+ if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
743
+ if (!isPopupReady) {
744
+ _this5.setState({
745
+ isPopupReady: true,
746
+ isAbsolutePositioningNeeded: isAbsolute
747
+ });
748
+ }
620
749
 
621
- var _ref4 = betterPosition || {},
622
- view = _ref4.view,
623
- views = _ref4.views,
624
- viewsOffset = _ref4.viewsOffset,
625
- targetOffset = _ref4.targetOffset,
626
- popupOffset = _ref4.popupOffset;
627
-
628
- if (position !== view || !isPopupReady) {
629
- _this4.setState({
630
- isPopupReady: true,
631
- position: view,
632
- positions: views,
633
- positionsOffset: viewsOffset,
634
- targetOffset: targetOffset,
635
- popupOffset: popupOffset,
636
- isAbsolutePositioningNeeded: isAbsolute
750
+ _this5.setContainerDynamicPositioning();
751
+ } else {
752
+ var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
753
+ needArrow: needArrow,
754
+ isAbsolute: isAbsolute,
755
+ customOrder: customOrder
637
756
  });
757
+
758
+ var _ref5 = betterPosition || {},
759
+ view = _ref5.view,
760
+ views = _ref5.views,
761
+ viewsOffset = _ref5.viewsOffset,
762
+ targetOffset = _ref5.targetOffset,
763
+ popupOffset = _ref5.popupOffset;
764
+
765
+ if (position !== view || !isPopupReady) {
766
+ _this5.setState({
767
+ isPopupReady: true,
768
+ position: view,
769
+ positions: views,
770
+ positionsOffset: viewsOffset,
771
+ targetOffset: targetOffset,
772
+ popupOffset: popupOffset,
773
+ isAbsolutePositioningNeeded: isAbsolute
774
+ });
775
+ }
638
776
  }
639
777
  });
640
778
  };
@@ -652,7 +790,7 @@ var Popup = function Popup(Component) {
652
790
  }, {
653
791
  key: "handleOpenPopupPositionChange",
654
792
  value: function handleOpenPopupPositionChange() {
655
- var _this5 = this;
793
+ var _this6 = this;
656
794
 
657
795
  Object.keys(popups).forEach(function (groupName) {
658
796
  var groupPopups = popups[groupName] || [];
@@ -669,11 +807,11 @@ var Popup = function Popup(Component) {
669
807
  if (placeHolderElement && dropElement) {
670
808
  var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
671
809
  requestAnimationFrame(function () {
672
- var needArrow = _this5.getNeedArrow(popup);
810
+ var needArrow = _this6.getNeedArrow(popup);
673
811
 
674
- var isAbsolute = _this5.getIsAbsolutePopup(popup);
812
+ var isAbsolute = _this6.getIsAbsolutePopup(popup);
675
813
 
676
- var customOrder = _this5.getCustomPositionOrder(popup);
814
+ var customOrder = _this6.getCustomPositionOrder(popup);
677
815
 
678
816
  var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
679
817
  needArrow: needArrow,
@@ -681,29 +819,29 @@ var Popup = function Popup(Component) {
681
819
  customOrder: customOrder
682
820
  });
683
821
 
684
- var _ref5 = betterPosition || {},
685
- view = _ref5.view,
686
- views = _ref5.views,
687
- _ref5$viewsOffset = _ref5.viewsOffset,
688
- viewsOffset = _ref5$viewsOffset === void 0 ? {} : _ref5$viewsOffset,
689
- targetOffset = _ref5.targetOffset,
690
- popupOffset = _ref5.popupOffset;
691
-
692
- var _ref6 = positionsOffset[position] || {},
693
- _ref6$left = _ref6.left,
694
- oldLeft = _ref6$left === void 0 ? '' : _ref6$left,
695
- _ref6$top = _ref6.top,
696
- oldTop = _ref6$top === void 0 ? '' : _ref6$top,
697
- _ref6$bottom = _ref6.bottom,
698
- oldBottom = _ref6$bottom === void 0 ? '' : _ref6$bottom;
699
-
700
- var _ref7 = viewsOffset[view] || {},
822
+ var _ref6 = betterPosition || {},
823
+ view = _ref6.view,
824
+ views = _ref6.views,
825
+ _ref6$viewsOffset = _ref6.viewsOffset,
826
+ viewsOffset = _ref6$viewsOffset === void 0 ? {} : _ref6$viewsOffset,
827
+ targetOffset = _ref6.targetOffset,
828
+ popupOffset = _ref6.popupOffset;
829
+
830
+ var _ref7 = positionsOffset[position] || {},
701
831
  _ref7$left = _ref7.left,
702
- left = _ref7$left === void 0 ? '' : _ref7$left,
832
+ oldLeft = _ref7$left === void 0 ? '' : _ref7$left,
703
833
  _ref7$top = _ref7.top,
704
- top = _ref7$top === void 0 ? '' : _ref7$top,
834
+ oldTop = _ref7$top === void 0 ? '' : _ref7$top,
705
835
  _ref7$bottom = _ref7.bottom,
706
- bottom = _ref7$bottom === void 0 ? '' : _ref7$bottom;
836
+ oldBottom = _ref7$bottom === void 0 ? '' : _ref7$bottom;
837
+
838
+ var _ref8 = viewsOffset[view] || {},
839
+ _ref8$left = _ref8.left,
840
+ left = _ref8$left === void 0 ? '' : _ref8$left,
841
+ _ref8$top = _ref8.top,
842
+ top = _ref8$top === void 0 ? '' : _ref8$top,
843
+ _ref8$bottom = _ref8.bottom,
844
+ bottom = _ref8$bottom === void 0 ? '' : _ref8$bottom;
707
845
 
708
846
  var changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
709
847
  // placeHolderElement,
@@ -767,11 +905,11 @@ var Popup = function Popup(Component) {
767
905
  var height = popupSize.height,
768
906
  width = popupSize.width;
769
907
 
770
- var _ref8 = this.size || {},
771
- _ref8$height = _ref8.height,
772
- oldHeight = _ref8$height === void 0 ? 0 : _ref8$height,
773
- _ref8$width = _ref8.width,
774
- oldWidth = _ref8$width === void 0 ? 0 : _ref8$width;
908
+ var _ref9 = this.size || {},
909
+ _ref9$height = _ref9.height,
910
+ oldHeight = _ref9$height === void 0 ? 0 : _ref9$height,
911
+ _ref9$width = _ref9.width,
912
+ oldWidth = _ref9$width === void 0 ? 0 : _ref9$width;
775
913
 
776
914
  var _this$state = this.state,
777
915
  isPopupReady = _this$state.isPopupReady,