@zohodesk/components 1.4.5 → 1.4.6

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/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
4
4
 
5
+ # 1.4.6
6
+
7
+ - **Popup**
8
+ - Added fixed popup scroll block behavior support to iframe elements (same-origin only).
9
+
10
+
5
11
  # 1.4.5
6
12
 
7
13
  - **Portal**
@@ -8,7 +8,7 @@ import '@zohodesk/variables/assets/colorVariables.module.css';
8
8
  import '@zohodesk/variables/assets/dotVariables.module.css';
9
9
  import '@zohodesk/variables/assets/sizeVariables.module.css';
10
10
  import '@zohodesk/variables/assets/fontsizeVariables.module.css';
11
- import '@zohodesk/variables/lib/fontFamilyVariables.module.css';
11
+ import '@zohodesk/variables/es/fontFamilyVariables.module.css';
12
12
  import '@zohodesk/variables/assets/transitionVariables.module.css';
13
13
  import '@zohodesk/variables/assets/no_transitionVariables.module.css';
14
14
  import "../common/a11y.module.css";
package/es/Popup/Popup.js CHANGED
@@ -12,11 +12,10 @@ import { addIntersectionObserver, removeIntersectionObserver } from "./intersect
12
12
  import { positionMapping } from "../DropBox/DropBoxPositionMapping.js";
13
13
  import isMobilePopover from "../DropBox/utils/isMobilePopover.js";
14
14
  import selectn from 'selectn';
15
- let lastOpenedGroup = [];
16
- let popups = {};
15
+ import Registry from "./Registry.js";
17
16
 
18
17
  global.closeGroupPopups = function (groupName) {
19
- const groupPopups = popups[groupName] || [];
18
+ const groupPopups = Registry.popups[groupName] || [];
20
19
  groupPopups.forEach(popup => {
21
20
  popup.state.isPopupOpen && popup.setState({
22
21
  isPopupOpen: false,
@@ -38,6 +37,51 @@ const defaultState = {
38
37
  //{height: ‘’, width: ‘’,}
39
38
  isAbsolutePositioningNeeded: true
40
39
  };
40
+ const SCROLL_BLOCK_EVENTS = Object.freeze([{
41
+ name: 'wheel',
42
+ handlerName: 'handleBlockScroll',
43
+ options: {
44
+ capture: true,
45
+ passive: false
46
+ }
47
+ }, {
48
+ name: 'touchmove',
49
+ handlerName: 'handleBlockScroll',
50
+ options: {
51
+ capture: true,
52
+ passive: false
53
+ }
54
+ }, {
55
+ name: 'scroll',
56
+ handlerName: 'handlePositionChange',
57
+ options: {
58
+ capture: true,
59
+ passive: false
60
+ }
61
+ }, {
62
+ name: 'keydown',
63
+ handlerName: 'preventKeyboardScroll',
64
+ options: {
65
+ capture: true,
66
+ passive: false
67
+ }
68
+ }]);
69
+ const IFRAME_SCROLL_BLOCK_EVENTS = Object.freeze(SCROLL_BLOCK_EVENTS.filter(event => event.name !== 'keydown'));
70
+ const CLICK_EVENTS = Object.freeze([{
71
+ name: 'click',
72
+ handlerName: 'documentClickHandler',
73
+ options: {
74
+ capture: false,
75
+ passive: false
76
+ }
77
+ }, {
78
+ name: 'click',
79
+ handlerName: 'documentClickHandler1',
80
+ options: {
81
+ capture: true,
82
+ passive: false
83
+ }
84
+ }]);
41
85
  /* eslint-disable react/no-deprecated */
42
86
 
43
87
  /* eslint-disable react/prop-types */
@@ -99,8 +143,11 @@ const Popup = function (Component) {
99
143
  this.handleBlockScroll = this.handleBlockScroll.bind(this);
100
144
  this.handlePositionChange = this.handlePositionChange.bind(this);
101
145
  this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
146
+ this.updateListeners = this.updateListeners.bind(this);
102
147
  this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
103
148
  this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
149
+ this.addScrollToUpdateListeners = this.addScrollToUpdateListeners.bind(this);
150
+ this.removeScrollToUpdateListeners = this.removeScrollToUpdateListeners.bind(this);
104
151
  this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
105
152
  this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
106
153
  this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
@@ -110,8 +157,10 @@ const Popup = function (Component) {
110
157
  this.setContainerDynamicPositioning = this.setContainerDynamicPositioning.bind(this);
111
158
  this.updatePopupState = this.updatePopupState.bind(this);
112
159
  this.handleScrollAndBlockEvents = this.handleScrollAndBlockEvents.bind(this);
160
+ this.handleIframeEventListeners = this.handleIframeEventListeners.bind(this);
113
161
  this.handleDropElementStyleUpdate = this.handleDropElementStyleUpdate.bind(this);
114
162
  this.positionRef = /*#__PURE__*/React.createRef();
163
+ this.rootElement = Registry.getRootElement();
115
164
  this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
116
165
 
117
166
  this.size = null;
@@ -128,16 +177,15 @@ const Popup = function (Component) {
128
177
 
129
178
  componentDidMount() {
130
179
  const group = this.getGroup();
131
- const groupPopups = popups[group] || [];
180
+ const groupPopups = Registry.popups[group] || [];
132
181
  groupPopups.push(this);
133
- popups[group] = groupPopups;
182
+ Registry.popups[group] = groupPopups;
134
183
 
135
- if (Object.keys(popups).length === 1 && groupPopups.length === 1) {
136
- document.addEventListener('click', this.documentClickHandler, false);
184
+ if (Object.keys(Registry.popups).length === 1 && groupPopups.length === 1) {
185
+ this.updateListeners(true, CLICK_EVENTS, document);
137
186
  document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
138
187
 
139
188
  window.addEventListener('resize', this.handleResize);
140
- document.addEventListener('click', this.documentClickHandler1, true);
141
189
  document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
142
190
  document.addEventListener('focus', this.handleDocumentFocus, true);
143
191
  }
@@ -156,8 +204,8 @@ const Popup = function (Component) {
156
204
  }
157
205
  }
158
206
 
159
- handleScrollAndBlockEvents(isPopupReady, isMobile) {
160
- if (isPopupReady && !isMobile) {
207
+ handleScrollAndBlockEvents(shouldAdd) {
208
+ if (shouldAdd) {
161
209
  this.handleAddingScrollBlock();
162
210
  this.handleAddingScrollToUpdatePosition();
163
211
  } else {
@@ -166,6 +214,16 @@ const Popup = function (Component) {
166
214
  }
167
215
  }
168
216
 
217
+ handleIframeEventListeners(shouldAdd, eventList) {
218
+ this.rootElement.querySelectorAll('iframe').forEach(frame => {
219
+ const frameDocument = frame.contentDocument;
220
+
221
+ if (frameDocument) {
222
+ this.updateListeners(shouldAdd, eventList, frameDocument);
223
+ }
224
+ });
225
+ }
226
+
169
227
  componentDidUpdate(prevProps, prevState) {
170
228
  const {
171
229
  isPopupReady,
@@ -192,28 +250,31 @@ const Popup = function (Component) {
192
250
  }
193
251
 
194
252
  if (oldStateOpen !== isPopupReady && !isMobile || oldIsMobileState !== isMobile) {
195
- this.handleScrollAndBlockEvents(isPopupReady, isMobile);
253
+ const shouldAdd = isPopupReady && !isMobile;
254
+ this.handleScrollAndBlockEvents(shouldAdd);
255
+ this.handleIframeEventListeners(shouldAdd, CLICK_EVENTS);
196
256
  }
197
257
  }
198
258
 
199
259
  componentWillUnmount() {
200
260
  const group = this.getGroup();
201
- popups = Object.keys(popups).reduce((res, groupName) => {
261
+ Registry.popups = Object.keys(Registry.popups).reduce((res, groupName) => {
202
262
  if (groupName === group) {
203
- const groupPopups = popups[group];
263
+ const groupPopups = Registry.popups[group];
204
264
  const newGroupPopups = groupPopups.filter(popup => popup !== this);
205
- newGroupPopups.length === 0 && lastOpenedGroup.indexOf(group) >= 0 && lastOpenedGroup.splice(lastOpenedGroup.indexOf(group), 1);
265
+ newGroupPopups.length === 0 && Registry.lastOpenedGroup.indexOf(group) >= 0 && Registry.lastOpenedGroup.splice(Registry.lastOpenedGroup.indexOf(group), 1);
206
266
  res[group] = newGroupPopups;
207
267
  }
208
268
 
209
269
  return res;
210
- }, popups);
270
+ }, Registry.popups);
211
271
  this.handleRemovingScrollBlock();
212
272
  this.handleRemovingScrollToUpdatePosition();
273
+ this.handleIframeEventListeners(false, CLICK_EVENTS);
213
274
  let noPopups = true;
214
275
 
215
- for (const i in popups) {
216
- if (popups[i].length >= 1) {
276
+ for (const i in Registry.popups) {
277
+ if (Registry.popups[i].length >= 1) {
217
278
  noPopups = false;
218
279
  break;
219
280
  }
@@ -224,11 +285,10 @@ const Popup = function (Component) {
224
285
  }
225
286
 
226
287
  if (noPopups) {
227
- document.removeEventListener('click', this.documentClickHandler);
288
+ this.updateListeners(false, CLICK_EVENTS, document);
228
289
  document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
229
290
 
230
291
  window.removeEventListener('resize', this.handleResize);
231
- document.removeEventListener('click', this.documentClickHandler1, true);
232
292
  document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
233
293
  document.removeEventListener('focus', this.handleDocumentFocus, true);
234
294
  }
@@ -260,10 +320,12 @@ const Popup = function (Component) {
260
320
 
261
321
  if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
262
322
  addIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
263
- document.addEventListener('scroll', this.updatePositionOnScroll, {
264
- capture: true,
265
- passive: false
266
- });
323
+ const shouldAddScrollToUpdatePositionListeners = Registry.getOpenedScrollableFixedPopups().length === 1 && Registry.scrollableListenerPopupRef === undefined;
324
+
325
+ if (shouldAddScrollToUpdatePositionListeners) {
326
+ Registry.scrollableListenerPopupRef = this;
327
+ Registry.scrollableListenerPopupRef.addScrollToUpdateListeners();
328
+ }
267
329
  }
268
330
  }
269
331
 
@@ -273,10 +335,12 @@ const Popup = function (Component) {
273
335
 
274
336
  if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
275
337
  removeIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
276
- document.removeEventListener('scroll', this.updatePositionOnScroll, {
277
- capture: true,
278
- passive: false
279
- });
338
+ const shouldRemoveScrollToUpdatePositionListeners = Registry.getOpenedScrollableFixedPopups().length === 0 && Registry.scrollableListenerPopupRef !== undefined;
339
+
340
+ if (shouldRemoveScrollToUpdatePositionListeners) {
341
+ Registry.scrollableListenerPopupRef.removeScrollToUpdateListeners();
342
+ Registry.scrollableListenerPopupRef = undefined;
343
+ }
280
344
  }
281
345
  }
282
346
 
@@ -335,83 +399,123 @@ const Popup = function (Component) {
335
399
  }
336
400
 
337
401
  updatePositionOnScroll(e) {
338
- const {
339
- placeHolderElement,
340
- defaultPosition,
341
- isTargetElementVisible
342
- } = this;
402
+ const scrollablePopups = Registry.getOpenedScrollableFixedPopups(); // Check if the event target is outside all dropElements
403
+
404
+ scrollablePopups.forEach(_ref2 => {
405
+ let {
406
+ placeHolderElement,
407
+ defaultPosition,
408
+ isTargetElementVisible,
409
+ handlePopupPosition
410
+ } = _ref2;
411
+
412
+ if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
413
+ handlePopupPosition(defaultPosition, true);
414
+ }
415
+ });
416
+ }
343
417
 
344
- if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
345
- this.handlePopupPosition(defaultPosition, true);
346
- }
418
+ updateListeners() {
419
+ let add = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
420
+ let eventList = arguments.length > 1 ? arguments[1] : undefined;
421
+ let element = arguments.length > 2 ? arguments[2] : undefined;
422
+ const method = add ? 'addEventListener' : 'removeEventListener';
423
+ eventList.forEach(_ref3 => {
424
+ let {
425
+ name,
426
+ handlerName,
427
+ options
428
+ } = _ref3;
429
+ const handler = this[handlerName];
430
+
431
+ if (handler) {
432
+ element[method](name, handler, options);
433
+ }
434
+ });
347
435
  }
348
436
 
349
437
  addScrollBlockListeners() {
350
- document.addEventListener('wheel', this.handleBlockScroll, {
351
- capture: true,
352
- passive: false
353
- });
354
- document.addEventListener('touchmove', this.handleBlockScroll, {
355
- capture: true,
356
- passive: false
357
- });
358
- document.addEventListener('scroll', this.handlePositionChange, {
359
- capture: true,
360
- passive: false
361
- });
362
- document.addEventListener('keydown', this.preventKeyboardScroll, {
363
- capture: true,
364
- passive: false
365
- });
438
+ // Only add scroll block listeners if at least one open popup needs outside scroll blocked
439
+ const shouldAddScrollBlockListeners = Registry.getOpenedScrollBlockedFixedPopups().length === 1 && Registry.scrollBlockedListenerPopupRef === undefined;
440
+
441
+ if (shouldAddScrollBlockListeners) {
442
+ Registry.scrollBlockedListenerPopupRef = this; // Main document
443
+
444
+ Registry.scrollBlockedListenerPopupRef.updateListeners(true, SCROLL_BLOCK_EVENTS, document); // Attach event listeners to all iframes within rootElement
445
+
446
+ Registry.scrollBlockedListenerPopupRef.handleIframeEventListeners(true, IFRAME_SCROLL_BLOCK_EVENTS);
447
+ }
366
448
  }
367
449
 
368
450
  removeScrollBlockListeners() {
369
- document.removeEventListener('wheel', this.handleBlockScroll, {
370
- capture: true,
371
- passive: false
372
- });
373
- document.removeEventListener('touchmove', this.handleBlockScroll, {
374
- capture: true,
375
- passive: false
376
- });
377
- document.removeEventListener('scroll', this.handlePositionChange, {
451
+ // Only remove scroll block listeners if at least one open popup needs outside scroll blocked
452
+ const shouldRemoveScrollBlockListeners = Registry.getOpenedScrollBlockedFixedPopups().length === 0 && Registry.scrollBlockedListenerPopupRef !== undefined;
453
+
454
+ if (shouldRemoveScrollBlockListeners) {
455
+ Registry.scrollBlockedListenerPopupRef.updateListeners(false, SCROLL_BLOCK_EVENTS, document);
456
+ Registry.scrollBlockedListenerPopupRef.handleIframeEventListeners(false, IFRAME_SCROLL_BLOCK_EVENTS);
457
+ Registry.scrollBlockedListenerPopupRef = undefined;
458
+ }
459
+ }
460
+
461
+ addScrollToUpdateListeners() {
462
+ document.addEventListener('scroll', this.updatePositionOnScroll, {
378
463
  capture: true,
379
464
  passive: false
380
465
  });
381
- document.removeEventListener('keydown', this.preventKeyboardScroll, {
466
+ }
467
+
468
+ removeScrollToUpdateListeners() {
469
+ document.removeEventListener('scroll', this.updatePositionOnScroll, {
382
470
  capture: true,
383
471
  passive: false
384
472
  });
385
473
  }
386
474
 
387
475
  handleBlockScroll(event) {
388
- // const targetElement = this.placeHolderElement;
389
- const containerElement = this.dropElement;
390
-
391
- if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
392
- // --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
393
- // if(
394
- // (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
395
- // && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
396
- // ) {
476
+ const scrollBlockedPopups = Registry.getOpenedScrollBlockedFixedPopups(); // Check if the event target is outside all dropElements
477
+
478
+ const isOutsideAllDropElements = scrollBlockedPopups.every(_ref4 => {
479
+ let {
480
+ dropElement
481
+ } = _ref4;
482
+ return dropElement && dropElement !== event.target && !dropElement.contains(event.target);
483
+ });
484
+
485
+ if (isOutsideAllDropElements) {
397
486
  event.preventDefault();
398
487
  }
399
488
  }
400
489
 
401
490
  handlePositionChange(event) {
402
- const targetElement = this.placeHolderElement;
403
- const containerElement = this.dropElement;
404
-
405
- 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, true); // this.closePopupOnly(event);
407
- }
491
+ const scrollBlockedPopups = Registry.getOpenedScrollBlockedFixedPopups();
492
+ scrollBlockedPopups.forEach(_ref5 => {
493
+ let {
494
+ placeHolderElement,
495
+ dropElement,
496
+ handlePopupPosition,
497
+ state
498
+ } = _ref5;
499
+
500
+ if (dropElement && dropElement !== event.target && !dropElement.contains(event.target) && placeHolderElement && placeHolderElement !== event.target && !placeHolderElement.contains(event.target) && event.target.contains(placeHolderElement)) {
501
+ handlePopupPosition(state.position, true);
502
+ }
503
+ });
408
504
  }
409
505
 
410
506
  preventKeyboardScroll(event) {
411
- const containerElement = this.dropElement;
412
507
  const keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
413
508
 
414
- if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
509
+ const scrollBlockedPopups = Registry.getOpenedScrollBlockedFixedPopups(); // Check if the event target is outside all dropElements
510
+
511
+ const isOutsideAllDropElements = scrollBlockedPopups.every(_ref6 => {
512
+ let {
513
+ dropElement
514
+ } = _ref6;
515
+ return dropElement && dropElement !== event.target && !dropElement.contains(event.target) && keys.includes(event.keyCode);
516
+ });
517
+
518
+ if (isOutsideAllDropElements) {
415
519
  event.preventDefault();
416
520
  }
417
521
  }
@@ -510,9 +614,9 @@ const Popup = function (Component) {
510
614
  const {
511
615
  isPopupOpen
512
616
  } = this.state;
513
- const groupPopups = popups[group] || [];
514
- lastOpenedGroup = !isPopupOpen && lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
515
- isPopupOpen && lastOpenedGroup.splice(0, 1);
617
+ const groupPopups = Registry.popups[group] || [];
618
+ Registry.lastOpenedGroup = !isPopupOpen && Registry.lastOpenedGroup.indexOf(group) === -1 ? [group, ...Registry.lastOpenedGroup] : Registry.lastOpenedGroup;
619
+ isPopupOpen && Registry.lastOpenedGroup.splice(0, 1);
516
620
  groupPopups.forEach(popup => {
517
621
  if (popup !== this && popup.state.isPopupOpen) {
518
622
  popup.setState({
@@ -535,18 +639,18 @@ const Popup = function (Component) {
535
639
  openPopupOnly(e, defaultPosition) {
536
640
  const group = this.getGroup();
537
641
  this.removeClose(e);
538
- lastOpenedGroup = lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
642
+ Registry.lastOpenedGroup = Registry.lastOpenedGroup.indexOf(group) === -1 ? [group, ...Registry.lastOpenedGroup] : Registry.lastOpenedGroup;
539
643
  this.handlePopupPosition(defaultPosition);
540
644
  }
541
645
 
542
646
  closePopupOnly(e) {
543
647
  this.removeClose(e);
544
- lastOpenedGroup.splice(0, 1);
545
648
  const {
546
649
  isPopupOpen
547
650
  } = this.state;
548
651
 
549
652
  if (isPopupOpen) {
653
+ Registry.lastOpenedGroup.splice(0, 1);
550
654
  this.setState({
551
655
  isPopupOpen: false,
552
656
  isPopupReady: false
@@ -555,8 +659,8 @@ const Popup = function (Component) {
555
659
  }
556
660
 
557
661
  handleCloseLastOpenedGroup() {
558
- const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] || [] : [];
559
- lastOpenedGroup.splice(0, 1);
662
+ const groupPopups = Registry.lastOpenedGroup.length ? Registry.popups[Registry.lastOpenedGroup[0]] || [] : [];
663
+ Registry.lastOpenedGroup.splice(0, 1);
560
664
  groupPopups.forEach(popup => {
561
665
  popup.state.isPopupOpen && popup.setState({
562
666
  isPopupOpen: false,
@@ -584,11 +688,11 @@ const Popup = function (Component) {
584
688
  handleGetNeedPrevent(e) {
585
689
  let needPrevent = false;
586
690
 
587
- if (lastOpenedGroup.length > 1) {
691
+ if (Registry.lastOpenedGroup.length > 1) {
588
692
  const {
589
693
  target
590
694
  } = e;
591
- const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] : [];
695
+ const groupPopups = Registry.lastOpenedGroup.length ? Registry.popups[Registry.lastOpenedGroup[0]] : [];
592
696
  let openedPopup = null; // eslint-disable-next-line guard-for-in
593
697
 
594
698
  for (const i in groupPopups) {
@@ -634,8 +738,8 @@ const Popup = function (Component) {
634
738
 
635
739
  documentClickHandler() {
636
740
  try {
637
- Object.keys(popups).forEach(groupName => {
638
- const groupPopups = popups[groupName] || [];
741
+ Object.keys(Registry.popups).forEach(groupName => {
742
+ const groupPopups = Registry.popups[groupName] || [];
639
743
  groupPopups.forEach(popup => {
640
744
  popup.state.isPopupOpen && (!popup.props.checkBeforeClose || popup.props.checkBeforeClose && popup.props.checkBeforeClose()) && !isTextSelected() && popup.setState({
641
745
  isPopupOpen: false,
@@ -643,7 +747,7 @@ const Popup = function (Component) {
643
747
  });
644
748
  });
645
749
  });
646
- lastOpenedGroup = [];
750
+ Registry.lastOpenedGroup = [];
647
751
  } catch (e) {// eslint-disable-next-line no-console
648
752
  //console.error('popup component not unmounted properly', e);
649
753
  }
@@ -763,8 +867,8 @@ const Popup = function (Component) {
763
867
  }
764
868
 
765
869
  handleOpenPopupPositionChange() {
766
- Object.keys(popups).forEach(groupName => {
767
- const groupPopups = popups[groupName] || [];
870
+ Object.keys(Registry.popups).forEach(groupName => {
871
+ const groupPopups = Registry.popups[groupName] || [];
768
872
  groupPopups.forEach(popup => {
769
873
  if (popup.state.isPopupOpen) {
770
874
  const {
@@ -0,0 +1,35 @@
1
+ import { getLibraryConfig } from "../Provider/Config.js";
2
+ const Registry = {
3
+ lastOpenedGroup: [],
4
+ popups: {},
5
+ scrollBlockedListenerPopupRef: undefined,
6
+ scrollableListenerPopupRef: undefined,
7
+
8
+ getOpenedPopups() {
9
+ return Object.values(Registry.popups).flat().filter(popup => popup.state.isPopupOpen);
10
+ },
11
+
12
+ getOpenedScrollBlockedFixedPopups() {
13
+ return Registry.getOpenedPopups().filter(popup => popup.getIsOutsideScrollBlocked(popup) && !popup.getIsAbsolutePopup(popup));
14
+ },
15
+
16
+ getOpenedScrollableFixedPopups() {
17
+ return Registry.getOpenedPopups().filter(popup => !popup.getIsOutsideScrollBlocked(popup) && !popup.getIsAbsolutePopup(popup));
18
+ },
19
+
20
+ getRootElement() {
21
+ const getRootElement = getLibraryConfig('getRootElement');
22
+
23
+ if (getRootElement && typeof getRootElement === 'function') {
24
+ const parent = getRootElement();
25
+
26
+ if (parent) {
27
+ return parent;
28
+ }
29
+ }
30
+
31
+ return document;
32
+ }
33
+
34
+ };
35
+ export default Registry;
@@ -10,8 +10,8 @@ let id = {
10
10
  getTooltipContainer: () => {},
11
11
  autoComplete: false,
12
12
  portalPrefix: '',
13
- getRootElement: () => {},
14
- getPortalContainer: () => {}
13
+ getPortalContainer: () => {},
14
+ getRootElement: () => {}
15
15
  };
16
16
  export function getLibraryConfig(key) {
17
17
  return id[key];
package/es/css.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "./common/reset.module.css";
2
2
  import "./common/basic.module.css";
3
- import '@zohodesk/variables/lib/colorVariables.module.css';
4
- import '@zohodesk/variables/lib/sizeVariables.module.css';
5
- import '@zohodesk/variables/lib/fontFamilyVariables.module.css';
6
- import '@zohodesk/icons/lib/Icon/Icon.module.css';
3
+ import '@zohodesk/variables/es/colorVariables.module.css';
4
+ import '@zohodesk/variables/es/sizeVariables.module.css';
5
+ import '@zohodesk/variables/es/fontFamilyVariables.module.css';
6
+ import '@zohodesk/icons/es/Icon/Icon.module.css';
7
7
  import "./common/animation.module.css";
8
8
  import "./common/transition.module.css";
9
9
  import "./common/common.module.css";
@@ -27,7 +27,7 @@ require("@zohodesk/variables/assets/sizeVariables.module.css");
27
27
 
28
28
  require("@zohodesk/variables/assets/fontsizeVariables.module.css");
29
29
 
30
- require("@zohodesk/variables/lib/fontFamilyVariables.module.css");
30
+ require("@zohodesk/variables/es/fontFamilyVariables.module.css");
31
31
 
32
32
  require("@zohodesk/variables/assets/transitionVariables.module.css");
33
33