@zohodesk/components 1.0.0-temp-199.9 → 1.0.0-temp-216.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +0 -9
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +9 -5
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +9 -5
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +9 -5
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/es/Button/Button.js +0 -2
- package/es/Button/css/Button.module.css +37 -1
- package/es/Button/css/cssJSLogic.js +10 -1
- package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -3
- package/es/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +2 -4
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -56
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +4 -4
- package/es/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +2 -4
- package/es/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +1 -3
- package/es/ListItem/ListItem.js +2 -2
- package/es/ListItem/ListItem.module.css +2 -15
- package/es/ListItem/ListItemWithAvatar.js +3 -3
- package/es/ListItem/ListItemWithIcon.js +2 -2
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -7
- package/es/MultiSelect/MultiSelect.js +2 -7
- package/es/MultiSelect/Suggestions.js +5 -14
- package/es/MultiSelect/props/defaultProps.js +4 -9
- package/es/MultiSelect/props/propTypes.js +3 -9
- package/es/Popup/Popup.js +83 -232
- package/es/Provider/LibraryContext.js +3 -1
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +2 -4
- package/es/Select/GroupSelect.js +1 -5
- package/es/Select/SelectWithAvatar.js +2 -7
- package/es/Select/SelectWithIcon.js +2 -4
- package/es/Select/props/defaultProps.js +1 -2
- package/es/Select/props/propTypes.js +2 -4
- package/es/common/common.module.css +0 -5
- package/es/utils/Common.js +1 -2
- package/es/v1/ListItem/ListItem.js +1 -1
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +1 -2
- package/es/v1/MultiSelect/MultiSelect.js +2 -7
- package/es/v1/MultiSelect/Suggestions.js +4 -8
- package/es/v1/MultiSelect/props/defaultProps.js +2 -4
- package/es/v1/MultiSelect/props/propTypes.js +2 -6
- package/es/v1/Select/GroupSelect.js +2 -7
- package/es/v1/Select/SelectWithAvatar.js +2 -7
- package/es/v1/Select/props/defaultProps.js +2 -4
- package/es/v1/Select/props/propTypes.js +2 -6
- package/lib/Button/Button.js +0 -2
- package/lib/Button/css/Button.module.css +37 -1
- package/lib/Button/css/cssJSLogic.js +15 -2
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +1 -3
- package/lib/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +2 -4
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -56
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +2 -2
- package/lib/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +2 -4
- package/lib/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +1 -3
- package/lib/ListItem/ListItem.js +2 -2
- package/lib/ListItem/ListItem.module.css +2 -15
- package/lib/ListItem/ListItemWithAvatar.js +3 -3
- package/lib/ListItem/ListItemWithIcon.js +2 -2
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -7
- package/lib/MultiSelect/MultiSelect.js +3 -6
- package/lib/MultiSelect/Suggestions.js +5 -12
- package/lib/MultiSelect/props/defaultProps.js +4 -9
- package/lib/MultiSelect/props/propTypes.js +3 -8
- package/lib/Popup/Popup.js +114 -282
- package/lib/Provider/LibraryContext.js +3 -1
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +2 -4
- package/lib/Select/GroupSelect.js +2 -4
- package/lib/Select/SelectWithAvatar.js +3 -8
- package/lib/Select/SelectWithIcon.js +3 -5
- package/lib/Select/props/defaultProps.js +1 -2
- package/lib/Select/props/propTypes.js +2 -4
- package/lib/common/common.module.css +0 -5
- package/lib/utils/Common.js +1 -5
- package/lib/v1/ListItem/ListItem.js +1 -1
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +1 -3
- package/lib/v1/MultiSelect/MultiSelect.js +3 -8
- package/lib/v1/MultiSelect/Suggestions.js +4 -8
- package/lib/v1/MultiSelect/props/defaultProps.js +2 -4
- package/lib/v1/MultiSelect/props/propTypes.js +2 -6
- package/lib/v1/Select/GroupSelect.js +3 -8
- package/lib/v1/Select/SelectWithAvatar.js +3 -8
- package/lib/v1/Select/props/defaultProps.js +2 -4
- package/lib/v1/Select/props/propTypes.js +2 -6
- package/package.json +2 -2
- package/result.json +1 -1
package/es/Popup/Popup.js
CHANGED
|
@@ -4,14 +4,11 @@ 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
|
|
7
|
+
import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } 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';
|
|
15
12
|
let lastOpenedGroup = [];
|
|
16
13
|
let popups = {};
|
|
17
14
|
|
|
@@ -50,8 +47,7 @@ const Popup = function (Component) {
|
|
|
50
47
|
isArrow: needPopupArrow = false,
|
|
51
48
|
customOrder: customPositionOrder = [],
|
|
52
49
|
scrollDebounceTime: popupScrollDebounceTime = 0,
|
|
53
|
-
closeOnScroll: closeOnScrollPopup = false
|
|
54
|
-
isOutsideScrollBlocked: isOutsideScrollBlock = false
|
|
50
|
+
closeOnScroll: closeOnScrollPopup = false
|
|
55
51
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
56
52
|
|
|
57
53
|
class Popup extends React.Component {
|
|
@@ -70,8 +66,7 @@ const Popup = function (Component) {
|
|
|
70
66
|
//{height: ‘’, width: ‘’,}
|
|
71
67
|
popupOffset: {},
|
|
72
68
|
//{height: ‘’, width: ‘’,}
|
|
73
|
-
isAbsolutePositioningNeeded: true
|
|
74
|
-
isMobile: false
|
|
69
|
+
isAbsolutePositioningNeeded: true
|
|
75
70
|
};
|
|
76
71
|
this.togglePopup = this.togglePopup.bind(this);
|
|
77
72
|
this.documentClickHandler = this.documentClickHandler.bind(this);
|
|
@@ -86,11 +81,10 @@ const Popup = function (Component) {
|
|
|
86
81
|
this.handleResize = debounce(this.handleResize.bind(this), 300);
|
|
87
82
|
this.handlePopupResize = this.handlePopupResize.bind(this);
|
|
88
83
|
this.getIsAbsolutePopup = this.getIsAbsolutePopup.bind(this);
|
|
89
|
-
this.getIsOutsideScrollBlocked = this.getIsOutsideScrollBlocked.bind(this);
|
|
90
84
|
this.getNeedArrow = this.getNeedArrow.bind(this);
|
|
91
85
|
this.getCustomPositionOrder = this.getCustomPositionOrder.bind(this);
|
|
92
|
-
this.handleOpenPopupPositionChange = this.handleOpenPopupPositionChange.bind(this);
|
|
93
|
-
|
|
86
|
+
this.handleOpenPopupPositionChange = this.handleOpenPopupPositionChange.bind(this);
|
|
87
|
+
this.getScrollDebounceTime = this.getScrollDebounceTime.bind(this);
|
|
94
88
|
this.getCloseOnScrollPopup = this.getCloseOnScrollPopup.bind(this);
|
|
95
89
|
this.handleCloseLastOpenedGroup = this.handleCloseLastOpenedGroup.bind(this);
|
|
96
90
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
@@ -104,26 +98,19 @@ const Popup = function (Component) {
|
|
|
104
98
|
this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
|
|
105
99
|
this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
|
|
106
100
|
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();
|
|
116
101
|
this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
|
|
117
102
|
|
|
118
103
|
this.size = null;
|
|
119
|
-
this.isTargetElementVisible = false;
|
|
120
104
|
this.isAbsolutePopup = isAbsolutePopup;
|
|
121
105
|
this.needPopupArrow = needPopupArrow;
|
|
122
106
|
this.customPositionOrder = customPositionOrder;
|
|
123
107
|
this.scrollDebounceTime = popupScrollDebounceTime;
|
|
124
108
|
this.closeOnScroll = closeOnScrollPopup;
|
|
125
|
-
|
|
126
|
-
|
|
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);
|
|
127
114
|
}
|
|
128
115
|
|
|
129
116
|
componentDidMount() {
|
|
@@ -156,24 +143,12 @@ const Popup = function (Component) {
|
|
|
156
143
|
}
|
|
157
144
|
}
|
|
158
145
|
|
|
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
|
-
|
|
169
146
|
componentDidUpdate(prevProps, prevState) {
|
|
170
147
|
const {
|
|
171
|
-
isPopupReady
|
|
172
|
-
isMobile
|
|
148
|
+
isPopupReady
|
|
173
149
|
} = this.state;
|
|
174
150
|
const {
|
|
175
|
-
isPopupReady: oldStateOpen = false
|
|
176
|
-
isMobile: oldIsMobileState
|
|
151
|
+
isPopupReady: oldStateOpen = false
|
|
177
152
|
} = prevState || {};
|
|
178
153
|
const {
|
|
179
154
|
dropElement
|
|
@@ -189,10 +164,12 @@ const Popup = function (Component) {
|
|
|
189
164
|
this.size = null;
|
|
190
165
|
this.popupObserver.disconnect();
|
|
191
166
|
}
|
|
192
|
-
}
|
|
193
167
|
|
|
194
|
-
|
|
195
|
-
|
|
168
|
+
if (isPopupReady) {
|
|
169
|
+
this.handleAddingScrollBlock();
|
|
170
|
+
} else {
|
|
171
|
+
this.handleRemovingScrollBlock();
|
|
172
|
+
}
|
|
196
173
|
}
|
|
197
174
|
}
|
|
198
175
|
|
|
@@ -209,7 +186,6 @@ const Popup = function (Component) {
|
|
|
209
186
|
return res;
|
|
210
187
|
}, popups);
|
|
211
188
|
this.handleRemovingScrollBlock();
|
|
212
|
-
this.handleRemovingScrollToUpdatePosition();
|
|
213
189
|
let noPopups = true;
|
|
214
190
|
|
|
215
191
|
for (const i in popups) {
|
|
@@ -235,8 +211,10 @@ const Popup = function (Component) {
|
|
|
235
211
|
}
|
|
236
212
|
|
|
237
213
|
handleAddingScrollBlock() {
|
|
238
|
-
const
|
|
239
|
-
|
|
214
|
+
const {
|
|
215
|
+
isAbsolutePositioningNeeded,
|
|
216
|
+
isOutsideScrollBlocked
|
|
217
|
+
} = this.props;
|
|
240
218
|
|
|
241
219
|
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
242
220
|
addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
@@ -245,8 +223,10 @@ const Popup = function (Component) {
|
|
|
245
223
|
}
|
|
246
224
|
|
|
247
225
|
handleRemovingScrollBlock() {
|
|
248
|
-
const
|
|
249
|
-
|
|
226
|
+
const {
|
|
227
|
+
isAbsolutePositioningNeeded,
|
|
228
|
+
isOutsideScrollBlocked
|
|
229
|
+
} = this.props;
|
|
250
230
|
|
|
251
231
|
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
252
232
|
removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
@@ -254,98 +234,6 @@ const Popup = function (Component) {
|
|
|
254
234
|
}
|
|
255
235
|
}
|
|
256
236
|
|
|
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
|
-
|
|
349
237
|
addScrollBlockListeners() {
|
|
350
238
|
document.addEventListener('wheel', this.handleBlockScroll, {
|
|
351
239
|
capture: true,
|
|
@@ -355,7 +243,7 @@ const Popup = function (Component) {
|
|
|
355
243
|
capture: true,
|
|
356
244
|
passive: false
|
|
357
245
|
});
|
|
358
|
-
document.addEventListener('scroll', this.
|
|
246
|
+
document.addEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
359
247
|
capture: true,
|
|
360
248
|
passive: false
|
|
361
249
|
});
|
|
@@ -374,7 +262,7 @@ const Popup = function (Component) {
|
|
|
374
262
|
capture: true,
|
|
375
263
|
passive: false
|
|
376
264
|
});
|
|
377
|
-
document.removeEventListener('scroll', this.
|
|
265
|
+
document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
378
266
|
capture: true,
|
|
379
267
|
passive: false
|
|
380
268
|
});
|
|
@@ -403,7 +291,7 @@ const Popup = function (Component) {
|
|
|
403
291
|
const containerElement = this.dropElement;
|
|
404
292
|
|
|
405
293
|
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
|
|
406
|
-
this.handlePopupPosition(this.state.position
|
|
294
|
+
this.handlePopupPosition(this.state.position); // this.closePopupOnly(event);
|
|
407
295
|
}
|
|
408
296
|
}
|
|
409
297
|
|
|
@@ -417,25 +305,11 @@ const Popup = function (Component) {
|
|
|
417
305
|
}
|
|
418
306
|
|
|
419
307
|
handleIntersectionObserver(entry) {
|
|
420
|
-
if (entry.intersectionRatio === 0
|
|
308
|
+
if (entry.intersectionRatio === 0) {
|
|
421
309
|
this.closePopupOnly();
|
|
422
310
|
}
|
|
423
311
|
}
|
|
424
312
|
|
|
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
|
-
|
|
439
313
|
getGroup() {
|
|
440
314
|
const {
|
|
441
315
|
popupGroup
|
|
@@ -451,12 +325,17 @@ const Popup = function (Component) {
|
|
|
451
325
|
needPopupArrow
|
|
452
326
|
} = popup;
|
|
453
327
|
return isArrow !== undefined ? isArrow : needPopupArrow;
|
|
454
|
-
}
|
|
455
|
-
// const { scrollDebounceTime } = popup.props;
|
|
456
|
-
// const { scrollDebounceTime: popupScrollDebounceTime } = popup;
|
|
457
|
-
// return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
|
|
458
|
-
// }
|
|
328
|
+
}
|
|
459
329
|
|
|
330
|
+
getScrollDebounceTime(popup) {
|
|
331
|
+
const {
|
|
332
|
+
scrollDebounceTime
|
|
333
|
+
} = popup.props;
|
|
334
|
+
const {
|
|
335
|
+
scrollDebounceTime: popupScrollDebounceTime
|
|
336
|
+
} = popup;
|
|
337
|
+
return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
|
|
338
|
+
}
|
|
460
339
|
|
|
461
340
|
getCloseOnScrollPopup(popup) {
|
|
462
341
|
const {
|
|
@@ -478,16 +357,6 @@ const Popup = function (Component) {
|
|
|
478
357
|
return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
|
|
479
358
|
}
|
|
480
359
|
|
|
481
|
-
getIsOutsideScrollBlocked(popup) {
|
|
482
|
-
const {
|
|
483
|
-
isOutsideScrollBlocked
|
|
484
|
-
} = popup.props;
|
|
485
|
-
const {
|
|
486
|
-
isOutsideScrollBlock
|
|
487
|
-
} = popup;
|
|
488
|
-
return isOutsideScrollBlocked !== undefined ? isOutsideScrollBlocked : isOutsideScrollBlock;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
360
|
getCustomPositionOrder(popup) {
|
|
492
361
|
const {
|
|
493
362
|
customOrder = []
|
|
@@ -658,24 +527,10 @@ const Popup = function (Component) {
|
|
|
658
527
|
cancelBubblingEffect(e);
|
|
659
528
|
}
|
|
660
529
|
|
|
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
|
-
|
|
675
530
|
handlePopupPosition() {
|
|
676
531
|
let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
|
|
677
|
-
let
|
|
678
|
-
//
|
|
532
|
+
let isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
|
|
533
|
+
// isResizeHandling --->>> Window resize and dropBox resize
|
|
679
534
|
const {
|
|
680
535
|
direction
|
|
681
536
|
} = this.context || {};
|
|
@@ -694,11 +549,9 @@ const Popup = function (Component) {
|
|
|
694
549
|
}
|
|
695
550
|
|
|
696
551
|
if (!placeHolderElement && !dropElement) {
|
|
697
|
-
const isMobile = isMobilePopover(true);
|
|
698
552
|
this.setState({
|
|
699
553
|
isPopupOpen: true,
|
|
700
|
-
isPopupReady: true
|
|
701
|
-
isMobile: isMobile
|
|
554
|
+
isPopupReady: true
|
|
702
555
|
});
|
|
703
556
|
return;
|
|
704
557
|
}
|
|
@@ -725,27 +578,23 @@ const Popup = function (Component) {
|
|
|
725
578
|
viewsOffset,
|
|
726
579
|
targetOffset,
|
|
727
580
|
popupOffset
|
|
728
|
-
} = betterPosition ||
|
|
729
|
-
|
|
730
|
-
if (!
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
} else {
|
|
741
|
-
if (position !== view || !isPopupReady) {
|
|
742
|
-
this.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
|
|
743
|
-
}
|
|
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
|
+
});
|
|
744
593
|
}
|
|
745
594
|
});
|
|
746
595
|
};
|
|
747
596
|
|
|
748
|
-
if (
|
|
597
|
+
if (isResizeHandling) {
|
|
749
598
|
setPosition();
|
|
750
599
|
} else {
|
|
751
600
|
this.defaultPosition = defaultPosition;
|
|
@@ -777,7 +626,6 @@ const Popup = function (Component) {
|
|
|
777
626
|
const needArrow = this.getNeedArrow(popup);
|
|
778
627
|
const isAbsolute = this.getIsAbsolutePopup(popup);
|
|
779
628
|
const customOrder = this.getCustomPositionOrder(popup);
|
|
780
|
-
const isMobile = isMobilePopover(true);
|
|
781
629
|
const betterPosition = viewPort.betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
|
|
782
630
|
needArrow,
|
|
783
631
|
isAbsolute,
|
|
@@ -793,16 +641,14 @@ const Popup = function (Component) {
|
|
|
793
641
|
const {
|
|
794
642
|
left: oldLeft = '',
|
|
795
643
|
top: oldTop = '',
|
|
796
|
-
bottom: oldBottom = ''
|
|
797
|
-
right: oldRight = ''
|
|
644
|
+
bottom: oldBottom = ''
|
|
798
645
|
} = positionsOffset[position] || {};
|
|
799
646
|
const {
|
|
800
647
|
left = '',
|
|
801
648
|
top = '',
|
|
802
|
-
bottom = ''
|
|
803
|
-
right = ''
|
|
649
|
+
bottom = ''
|
|
804
650
|
} = viewsOffset[view] || {};
|
|
805
|
-
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom
|
|
651
|
+
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
|
|
806
652
|
// placeHolderElement,
|
|
807
653
|
// scrollContainer
|
|
808
654
|
// );
|
|
@@ -814,8 +660,7 @@ const Popup = function (Component) {
|
|
|
814
660
|
positionsOffset: viewsOffset,
|
|
815
661
|
targetOffset,
|
|
816
662
|
popupOffset,
|
|
817
|
-
isAbsolutePositioningNeeded: isAbsolute
|
|
818
|
-
isMobile: isMobile
|
|
663
|
+
isAbsolutePositioningNeeded: isAbsolute
|
|
819
664
|
});
|
|
820
665
|
} // if (!isInViewPort && !isAbsolute) {
|
|
821
666
|
// popup.setState({ isPopupOpen: false, isPopupReady: false });
|
|
@@ -839,19 +684,26 @@ const Popup = function (Component) {
|
|
|
839
684
|
|
|
840
685
|
handleResize() {
|
|
841
686
|
this.handleOpenPopupPositionChange();
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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
|
+
}
|
|
854
701
|
|
|
702
|
+
if (isPopupReady && closeOnScroll) {
|
|
703
|
+
console.log(this, 'handle Scroll');
|
|
704
|
+
this.togglePopup(e);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
855
707
|
|
|
856
708
|
handlePopupResize(popupSize) {
|
|
857
709
|
const {
|
|
@@ -883,14 +735,13 @@ const Popup = function (Component) {
|
|
|
883
735
|
}
|
|
884
736
|
|
|
885
737
|
render() {
|
|
886
|
-
// const { isPopupReady, isPopupOpen } = this.state;
|
|
887
738
|
const {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
} = this.state;
|
|
891
|
-
|
|
739
|
+
isPopupReady,
|
|
740
|
+
isPopupOpen
|
|
741
|
+
} = this.state;
|
|
742
|
+
const localState = isPopupReady ? this.state : {};
|
|
892
743
|
return /*#__PURE__*/React.createElement(Component, { ...this.props,
|
|
893
|
-
...
|
|
744
|
+
...this.state,
|
|
894
745
|
openPopupOnly: this.openPopupOnly,
|
|
895
746
|
closePopupOnly: this.closePopupOnly,
|
|
896
747
|
togglePopup: this.togglePopup,
|
|
@@ -9,13 +9,15 @@ const LibraryContextProvider = _ref => {
|
|
|
9
9
|
direction,
|
|
10
10
|
coloredTagVariant,
|
|
11
11
|
hasTagColorInheritedToText,
|
|
12
|
+
shouldStrikeThroughDisabledButton,
|
|
12
13
|
children
|
|
13
14
|
} = _ref;
|
|
14
15
|
const [value, setValue] = useState({
|
|
15
16
|
isReducedMotion,
|
|
16
17
|
direction,
|
|
17
18
|
coloredTagVariant,
|
|
18
|
-
hasTagColorInheritedToText
|
|
19
|
+
hasTagColorInheritedToText,
|
|
20
|
+
shouldStrikeThroughDisabledButton
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
function setGlobalContext(key, data) {
|
|
@@ -5,8 +5,6 @@ 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"
|
|
10
8
|
data-id="dropBox"
|
|
11
9
|
data-position="bottomStart"
|
|
12
10
|
data-selector-id="dropBox"
|
|
@@ -14,14 +12,14 @@ exports[`ResponsiveDropBox rendering the defult props 1`] = `
|
|
|
14
12
|
dot-ui-element="dropbox"
|
|
15
13
|
>
|
|
16
14
|
<div
|
|
17
|
-
class="subContainer
|
|
15
|
+
class="subContainer bottom_shadow radius defaultPalette"
|
|
18
16
|
data-id="dropBox_subcontainer"
|
|
19
17
|
data-selector-id="dropBox_subcontainer"
|
|
20
18
|
data-test-id="dropBox_subcontainer"
|
|
21
19
|
tabindex="-1"
|
|
22
20
|
>
|
|
23
21
|
<div
|
|
24
|
-
class="
|
|
22
|
+
class="end"
|
|
25
23
|
data-id="dropBox_arrow"
|
|
26
24
|
data-selector-id="dropBox_arrow"
|
|
27
25
|
data-test-id="dropBox_arrow"
|
package/es/Select/GroupSelect.js
CHANGED
|
@@ -591,9 +591,6 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
591
591
|
dataSelectorId,
|
|
592
592
|
customProps
|
|
593
593
|
} = this.props;
|
|
594
|
-
const {
|
|
595
|
-
suggestionsProps = {}
|
|
596
|
-
} = customProps;
|
|
597
594
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
598
595
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
599
596
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
@@ -792,8 +789,7 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
792
789
|
ariaParentRole: 'listbox',
|
|
793
790
|
role: 'option'
|
|
794
791
|
},
|
|
795
|
-
dataId: `${dataId}_Options
|
|
796
|
-
...suggestionsProps
|
|
792
|
+
dataId: `${dataId}_Options`
|
|
797
793
|
}));
|
|
798
794
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
799
795
|
options: revampedGroups,
|
|
@@ -163,12 +163,8 @@ class SelectWithAvatarComponent extends SelectComponent {
|
|
|
163
163
|
needEffect,
|
|
164
164
|
isLoading,
|
|
165
165
|
dataSelectorId,
|
|
166
|
-
getTargetRef
|
|
167
|
-
customProps
|
|
166
|
+
getTargetRef
|
|
168
167
|
} = this.props;
|
|
169
|
-
const {
|
|
170
|
-
suggestionsProps = {}
|
|
171
|
-
} = customProps;
|
|
172
168
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
173
169
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
174
170
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
@@ -325,8 +321,7 @@ class SelectWithAvatarComponent extends SelectComponent {
|
|
|
325
321
|
a11y: {
|
|
326
322
|
ariaParentRole: 'listbox',
|
|
327
323
|
role: 'option'
|
|
328
|
-
}
|
|
329
|
-
...suggestionsProps
|
|
324
|
+
}
|
|
330
325
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
331
326
|
isLoading: isFetchingOptions,
|
|
332
327
|
options: options,
|
|
@@ -367,8 +367,7 @@ class SelectWithIcon extends Component {
|
|
|
367
367
|
let {
|
|
368
368
|
TextBoxProps = {},
|
|
369
369
|
DropdownSearchTextBoxProps = {},
|
|
370
|
-
TextBoxIconProps = {}
|
|
371
|
-
listItemProps = {}
|
|
370
|
+
TextBoxIconProps = {}
|
|
372
371
|
} = customProps;
|
|
373
372
|
return /*#__PURE__*/React.createElement("div", {
|
|
374
373
|
className: `${style.container} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''}`,
|
|
@@ -531,8 +530,7 @@ class SelectWithIcon extends Component {
|
|
|
531
530
|
role: 'option',
|
|
532
531
|
ariaSelected: selectedId === options[idKey],
|
|
533
532
|
ariaLabel: options[valueKey]
|
|
534
|
-
}
|
|
535
|
-
...listItemProps
|
|
533
|
+
}
|
|
536
534
|
});
|
|
537
535
|
})) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
538
536
|
isLoading: isFetchingOptions,
|
|
@@ -177,8 +177,7 @@ export const GroupSelect_propTypes = {
|
|
|
177
177
|
isDefaultSelectValue: PropTypes.bool,
|
|
178
178
|
customProps: PropTypes.shape({
|
|
179
179
|
TextBoxProps: PropTypes.object,
|
|
180
|
-
TextBoxIconProps: PropTypes.object
|
|
181
|
-
suggestionsProps: PropTypes.object
|
|
180
|
+
TextBoxIconProps: PropTypes.object
|
|
182
181
|
})
|
|
183
182
|
};
|
|
184
183
|
export const SelectWithAvatar_propTypes = { ...Select_propTypes,
|
|
@@ -240,8 +239,7 @@ export const SelectWithAvatar_propTypes = { ...Select_propTypes,
|
|
|
240
239
|
htmlId: PropTypes.string,
|
|
241
240
|
needEffect: PropTypes.bool,
|
|
242
241
|
isLoading: PropTypes.bool,
|
|
243
|
-
dataSelectorId: PropTypes.string
|
|
244
|
-
customProps: PropTypes.string
|
|
242
|
+
dataSelectorId: PropTypes.string
|
|
245
243
|
};
|
|
246
244
|
export const SelectWithIcon_propTypes = {
|
|
247
245
|
animationStyle: PropTypes.oneOf(['default', 'bounce']),
|
package/es/utils/Common.js
CHANGED