@zohodesk/components 1.2.47 → 1.2.49

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
@@ -32,6 +32,21 @@ In this Package, we Provide Some Basic Components to Build Web App
32
32
  - TextBoxIcon
33
33
  - Tooltip
34
34
 
35
+ # 1.2.49 (Yet To Publish)
36
+
37
+ - **Popup**
38
+ - `isOutsideScrollBlocked` prop supported - Scroll blocking behaviours supported
39
+ - Fixed popup re-positioning on window resize not working properly - Issue fixed
40
+ - **DropBoxElement**
41
+ - The dot-ui-element attribute has been added to facilitate the use of component-level CSS selectors
42
+
43
+ # 1.2.48
44
+
45
+ - **ResizeObserver**
46
+
47
+ - The ResizeObserver PolyFill code has been removed, and a separate copy with the PolyFill included is saved under the filename ResizeObserverWithPolyfill.js
48
+
49
+
35
50
  # 1.2.47
36
51
 
37
52
  - **DateTime**
@@ -97,7 +112,7 @@ In this Package, we Provide Some Basic Components to Build Web App
97
112
 
98
113
  - **LibraryContext** - coloredTagVariant, hasTagColorInheritedToText properties added
99
114
  - **Tag** - customAttributes prop supported
100
- - **TextBoxIcon** - needInputFocusOnParentClick prop supported
115
+ - **TextBoxIcon** - needInputFocusOnWrapperClick prop supported
101
116
 
102
117
  # 1.2.38
103
118
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/no-unknown-property */
1
2
  import React from 'react';
2
3
  import useDropboxPosCalc from "./useDropboxPosCalc";
3
4
  import cssJSLogic from "./css/cssJSLogic";
@@ -108,7 +109,8 @@ export default function DropBoxElement(props) {
108
109
  "aria-labelledby": ariaLabelledby,
109
110
  tabIndex: tabIndex,
110
111
  onAnimationEnd: isAnimate && FireOnAnimationEnd,
111
- "data-a11y-focus-main-area": true
112
+ "data-a11y-focus-main-area": true,
113
+ "dot-ui-element": "dropbox"
112
114
  }, /*#__PURE__*/React.createElement("div", {
113
115
  tabIndex: "-1",
114
116
  className: `${subContainerClass} ${style[`${palette}Palette`]}`,
@@ -9,6 +9,7 @@ exports[`DropBoxElement rendering the defult props 1`] = `
9
9
  data-position="bottomStart"
10
10
  data-selector-id="dropBox"
11
11
  data-test-id="dropBox"
12
+ dot-ui-element="dropbox"
12
13
  >
13
14
  <div
14
15
  class="subContainer bottom_shadow radius defaultPalette"
@@ -9,6 +9,7 @@ exports[`DropBox rendering the defult props 1`] = `
9
9
  data-position="bottomStart"
10
10
  data-selector-id="dropBox"
11
11
  data-test-id="dropBox"
12
+ dot-ui-element="dropbox"
12
13
  >
13
14
  <div
14
15
  class="subContainer bottom_shadow radius defaultPalette"
@@ -19,6 +19,7 @@ exports[`DropDown rendering the defult props 1`] = `
19
19
  data-position="bottomMid"
20
20
  data-selector-id="dropBox"
21
21
  data-test-id="dropBox"
22
+ dot-ui-element="dropbox"
22
23
  >
23
24
  <div
24
25
  class="subContainer bottom_shadow radius defaultPalette"
package/es/Popup/Popup.js CHANGED
@@ -1,13 +1,14 @@
1
1
  /**** Libraries ****/
2
2
  import React from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import hoistStatics from 'hoist-non-react-statics';
4
+ import { PopupPropTypes, ContextTypes } from "./props/propTypes";
5
5
  /**** Methods ****/
6
6
 
7
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
+ import { addIntersectionObserver, removeIntersectionObserver } from "./intersectionObserver";
11
12
  let lastOpenedGroup = [];
12
13
  let popups = {};
13
14
 
@@ -89,6 +90,12 @@ const Popup = function (Component) {
89
90
  this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
90
91
  this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
91
92
  this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
93
+ this.handleBlockScroll = this.handleBlockScroll.bind(this);
94
+ this.handlePositionChange = this.handlePositionChange.bind(this);
95
+ this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
96
+ this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
97
+ this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
98
+ this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
92
99
  this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
93
100
 
94
101
  this.size = null;
@@ -101,6 +108,7 @@ const Popup = function (Component) {
101
108
  scrollDebounceTime
102
109
  } = this.getScrollDebounceTime(this);
103
110
  this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
111
+ this.handleDebouncedPositionChange = debounce(this.handlePositionChange.bind(this), 100);
104
112
  }
105
113
 
106
114
  componentDidMount() {
@@ -144,7 +152,9 @@ const Popup = function (Component) {
144
152
  dropElement
145
153
  } = this;
146
154
  const {
147
- needResizeHandling: propResizeHandling
155
+ needResizeHandling: propResizeHandling,
156
+ isAbsolutePositioningNeeded,
157
+ isOutsideScrollBlocked
148
158
  } = this.props;
149
159
 
150
160
  if (oldStateOpen !== isPopupReady) {
@@ -154,6 +164,16 @@ const Popup = function (Component) {
154
164
  this.size = null;
155
165
  this.popupObserver.disconnect();
156
166
  }
167
+
168
+ if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
169
+ if (isPopupReady) {
170
+ addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
171
+ this.addScrollBlockListeners();
172
+ } else {
173
+ removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
174
+ this.removeScrollBlockListeners();
175
+ }
176
+ }
157
177
  }
158
178
  }
159
179
 
@@ -169,6 +189,8 @@ const Popup = function (Component) {
169
189
 
170
190
  return res;
171
191
  }, popups);
192
+ removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
193
+ this.removeScrollBlockListeners();
172
194
  let noPopups = true;
173
195
 
174
196
  for (const i in popups) {
@@ -193,6 +215,82 @@ const Popup = function (Component) {
193
215
  }
194
216
  }
195
217
 
218
+ addScrollBlockListeners() {
219
+ document.addEventListener('wheel', this.handleBlockScroll, {
220
+ capture: true,
221
+ passive: false
222
+ });
223
+ document.addEventListener('touchmove', this.handleBlockScroll, {
224
+ capture: true,
225
+ passive: false
226
+ });
227
+ document.addEventListener('scroll', this.handleDebouncedPositionChange, {
228
+ capture: true,
229
+ passive: false
230
+ });
231
+ document.addEventListener('keydown', this.preventKeyboardScroll, {
232
+ capture: true,
233
+ passive: false
234
+ });
235
+ }
236
+
237
+ removeScrollBlockListeners() {
238
+ document.removeEventListener('wheel', this.handleBlockScroll, {
239
+ capture: true,
240
+ passive: false
241
+ });
242
+ document.removeEventListener('touchmove', this.handleBlockScroll, {
243
+ capture: true,
244
+ passive: false
245
+ });
246
+ document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
247
+ capture: true,
248
+ passive: false
249
+ });
250
+ document.removeEventListener('keydown', this.preventKeyboardScroll, {
251
+ capture: true,
252
+ passive: false
253
+ });
254
+ }
255
+
256
+ handleBlockScroll(event) {
257
+ // const targetElement = this.placeHolderElement;
258
+ const containerElement = this.dropElement;
259
+
260
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
261
+ // --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
262
+ // if(
263
+ // (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
264
+ // && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
265
+ // ) {
266
+ event.preventDefault();
267
+ }
268
+ }
269
+
270
+ handlePositionChange(event) {
271
+ const targetElement = this.placeHolderElement;
272
+ const containerElement = this.dropElement;
273
+
274
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
275
+ this.handlePopupPosition(this.state.position); // this.closePopupOnly(event);
276
+ }
277
+ }
278
+
279
+ preventKeyboardScroll(event) {
280
+ const containerElement = this.dropElement;
281
+ const keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
282
+
283
+ if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
284
+ event.preventDefault();
285
+ }
286
+ }
287
+
288
+ handleIntersectionObserver(entry) {
289
+ if (entry.intersectionRatio === 0) {
290
+ this.closePopupOnly();
291
+ }
292
+ }
293
+
196
294
  getGroup() {
197
295
  const {
198
296
  popupGroup
@@ -523,13 +621,15 @@ const Popup = function (Component) {
523
621
  } = betterPosition || {};
524
622
  const {
525
623
  left: oldLeft = '',
526
- top: oldTop = ''
624
+ top: oldTop = '',
625
+ bottom: oldBottom = ''
527
626
  } = positionsOffset[position] || {};
528
627
  const {
529
628
  left = '',
530
- top = ''
629
+ top = '',
630
+ bottom = ''
531
631
  } = viewsOffset[view] || {};
532
- const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
632
+ const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
533
633
  // placeHolderElement,
534
634
  // scrollContainer
535
635
  // );
@@ -635,9 +735,8 @@ const Popup = function (Component) {
635
735
  }
636
736
 
637
737
  Popup.displayName = Component.displayName || Component.name || Popup.name;
638
- Popup.contextTypes = {
639
- direction: PropTypes.string
640
- };
738
+ Popup.contextTypes = ContextTypes;
739
+ Popup.propTypes = PopupPropTypes;
641
740
  return hoistStatics(Popup, Component);
642
741
  };
643
742
 
@@ -0,0 +1,39 @@
1
+ let observerCallbacks = null;
2
+ let intersectionObserver = null;
3
+
4
+ function handleObserverCallbacks(entries) {
5
+ entries.map((entry, i) => {
6
+ let oldCallbacks = observerCallbacks.get(entry.target);
7
+ oldCallbacks.length && oldCallbacks.forEach(callback => {
8
+ callback && callback(entry);
9
+ });
10
+ });
11
+ }
12
+
13
+ export function addIntersectionObserver(element, callback, options) {
14
+ if (intersectionObserver === null && observerCallbacks === null) {
15
+ intersectionObserver = new IntersectionObserver(entries => {
16
+ handleObserverCallbacks(entries);
17
+ }, options);
18
+ observerCallbacks = new Map();
19
+ }
20
+
21
+ intersectionObserver.observe(element);
22
+ let oldCallbacks = observerCallbacks.get(element) || [];
23
+ observerCallbacks.set(element, [...oldCallbacks, callback]);
24
+ }
25
+ export function removeIntersectionObserver(element, callback) {
26
+ let oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : [];
27
+ oldCallbacks = oldCallbacks.filter(handler => handler !== callback);
28
+
29
+ if (intersectionObserver && oldCallbacks.length === 0) {
30
+ observerCallbacks.delete(element);
31
+ intersectionObserver.unobserve(element);
32
+ }
33
+
34
+ if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
35
+ intersectionObserver.disconnect();
36
+ intersectionObserver = null;
37
+ observerCallbacks = null;
38
+ }
39
+ }
@@ -0,0 +1,30 @@
1
+ import PropTypes from 'prop-types';
2
+ export const ContextTypes = {
3
+ direction: PropTypes.string
4
+ };
5
+ export const PopupPropTypes = {
6
+ popupGroup: PropTypes.string,
7
+ isArrow: PropTypes.bool,
8
+ isPopupOpen: PropTypes.bool,
9
+ closeOnScroll: PropTypes.bool,
10
+ isOutsideScrollBlocked: PropTypes.bool,
11
+ needResizeHandling: PropTypes.bool,
12
+ isAbsolutePositioningNeeded: PropTypes.bool,
13
+ scrollDebounceTime: PropTypes.number,
14
+ customOrder: PropTypes.arrayOf(PropTypes.string),
15
+ checkBeforeClose: PropTypes.func
16
+ };
17
+ export const PopupWrappersPropTypes = {
18
+ openPopupOnly: PropTypes.func,
19
+ closePopupOnly: PropTypes.func,
20
+ togglePopup: PropTypes.func,
21
+ removeClose: PropTypes.func,
22
+ isPopupReady: PropTypes.bool,
23
+ position: PropTypes.oneOf(['bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', 'rightTop', 'rightBottom', 'rightCenter', 'leftTop', 'leftBottom', 'leftCenter']),
24
+ getTargetRef: PropTypes.func,
25
+ getContainerRef: PropTypes.func,
26
+ ...PopupPropTypes,
27
+ isRestrictScroll: PropTypes.bool,
28
+ positionsOffset: PropTypes.object,
29
+ targetOffset: PropTypes.object
30
+ };
@@ -1,68 +1,45 @@
1
- const hasResizeObserver = !!window.ResizeObserver;
2
- const mutationObserverOptions = {
3
- //NOTE: we donot consider child Count
4
- // childList: true,
5
- attributes: true
6
- };
7
-
8
- function getSize(element) {
9
- let {
10
- offsetHeight,
11
- offsetWidth
12
- } = element; // const { height, width } = element.getBoundingClientRect();
1
+ function getBorderBoxSizeFromEntry(entry) {
2
+ const {
3
+ borderBoxSize
4
+ } = entry;
5
+ return borderBoxSize[0];
6
+ }
13
7
 
8
+ function getSize(entry) {
9
+ const borderBoxSize = getBorderBoxSizeFromEntry(entry);
14
10
  return {
15
- height: offsetHeight,
16
- width: offsetWidth
11
+ height: borderBoxSize.blockSize,
12
+ width: borderBoxSize.inlineSize
17
13
  };
18
14
  }
19
15
 
20
- function dispatch() {
21
- let resizeResponsive = new Event('resizeResponsive');
22
- window.dispatchEvent(resizeResponsive);
23
- }
24
-
25
- if (!hasResizeObserver) {
26
- let interval = null;
27
- window.addEventListener('resize', () => {
28
- clearTimeout(interval);
29
- interval = setTimeout(dispatch, 100);
30
- });
31
- } // NOTE: this is not full polyfill , we just wrote what types of changes wlli
32
-
33
-
34
16
  export default class ResizeObserverPolyfill {
35
17
  constructor(onResize) {
36
- // method finding
37
- this.transitionEndHandler = this.transitionEndHandler.bind(this);
38
- this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
39
18
  this.resizeHandler = this.resizeHandler.bind(this);
40
- this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
41
- this.debounce = this.debounce.bind(this);
42
19
  this.onResize = onResize;
43
20
  this.targetNode = null;
44
21
  this.size = {
45
22
  height: 0,
46
23
  width: 0
47
24
  };
48
-
49
- if (hasResizeObserver) {
50
- this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
51
- } else {
52
- this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
53
- }
25
+ this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandler);
54
26
  }
55
27
 
56
28
  replaceResizeHandler(onResize) {
57
29
  this.onResize = onResize;
58
30
  }
59
31
 
60
- resizeHandler() {
61
- if (!this.targetNode) {
32
+ getEntry(entries) {
33
+ return entries[0];
34
+ }
35
+
36
+ resizeHandler(entries) {
37
+ if (!this.targetNode || !entries.length) {
62
38
  return;
63
39
  }
64
40
 
65
- const currentSize = getSize(this.targetNode); // if (this.size && shallowCompare(currentSize, this.size)) {
41
+ const entry = this.getEntry(entries);
42
+ const currentSize = getSize(entry);
66
43
 
67
44
  if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
68
45
  return;
@@ -73,48 +50,9 @@ export default class ResizeObserverPolyfill {
73
50
  return true;
74
51
  }
75
52
 
76
- resizeHandlerDispatch() {
77
- if (!this.resizeHandler() || hasResizeObserver) {
78
- return;
79
- }
80
-
81
- dispatch();
82
- }
83
-
84
- debounce() {
85
- clearTimeout(this.interval);
86
- this.interval = setTimeout(this.resizeHandler, 100);
87
- }
88
-
89
- transitionEndHandler(event) {
90
- if (event.propertyName.indexOf('color') === -1) {
91
- this.resizeHandlerDispatch();
92
- }
93
- }
94
-
95
- addEventListeners(targetNode) {
96
- targetNode.addEventListener('transitionend', this.transitionEndHandler);
97
- window.addEventListener('resizeResponsive', this.debounce);
98
- targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
99
- targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
100
- }
101
-
102
- removeEventListeners(targetNode) {
103
- targetNode.removeEventListener('transitionend', this.transitionEndHandler);
104
- window.removeEventListener('resizeResponsive', this.debounce);
105
- targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
106
- targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
107
- }
108
-
109
53
  observe(targetNode) {
110
54
  this.targetNode = targetNode;
111
-
112
- if (hasResizeObserver) {
113
- this.resizeObserverInstance.observe(targetNode);
114
- } else {
115
- this.addEventListeners(targetNode);
116
- this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
117
- }
55
+ this.resizeObserverInstance.observe(targetNode);
118
56
  }
119
57
 
120
58
  replaceObservationElement(targetNode) {
@@ -124,12 +62,10 @@ export default class ResizeObserverPolyfill {
124
62
 
125
63
  this.targetNode && this.disconnect();
126
64
  targetNode && this.observe(targetNode);
127
- targetNode && this.resizeHandlerDispatch();
128
65
  }
129
66
 
130
67
  disconnect() {
131
- this.targetNode && this.removeEventListeners(this.targetNode);
132
- hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
68
+ this.resizeObserverInstance.disconnect();
133
69
  this.targetNode = null;
134
70
  this.size = {
135
71
  height: 0,
@@ -0,0 +1,140 @@
1
+ const hasResizeObserver = !!window.ResizeObserver;
2
+ const mutationObserverOptions = {
3
+ //NOTE: we donot consider child Count
4
+ // childList: true,
5
+ attributes: true
6
+ };
7
+
8
+ function getSize(element) {
9
+ let {
10
+ offsetHeight,
11
+ offsetWidth
12
+ } = element; // const { height, width } = element.getBoundingClientRect();
13
+
14
+ return {
15
+ height: offsetHeight,
16
+ width: offsetWidth
17
+ };
18
+ }
19
+
20
+ function dispatch() {
21
+ let resizeResponsive = new Event('resizeResponsive');
22
+ window.dispatchEvent(resizeResponsive);
23
+ }
24
+
25
+ if (!hasResizeObserver) {
26
+ let interval = null;
27
+ window.addEventListener('resize', () => {
28
+ clearTimeout(interval);
29
+ interval = setTimeout(dispatch, 100);
30
+ });
31
+ } // NOTE: this is not full polyfill , we just wrote what types of changes wlli
32
+
33
+
34
+ export default class ResizeObserverPolyfill {
35
+ constructor(onResize) {
36
+ // method finding
37
+ this.transitionEndHandler = this.transitionEndHandler.bind(this);
38
+ this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
39
+ this.resizeHandler = this.resizeHandler.bind(this);
40
+ this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
41
+ this.debounce = this.debounce.bind(this);
42
+ this.onResize = onResize;
43
+ this.targetNode = null;
44
+ this.size = {
45
+ height: 0,
46
+ width: 0
47
+ };
48
+
49
+ if (hasResizeObserver) {
50
+ this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
51
+ } else {
52
+ this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
53
+ }
54
+ }
55
+
56
+ replaceResizeHandler(onResize) {
57
+ this.onResize = onResize;
58
+ }
59
+
60
+ resizeHandler() {
61
+ if (!this.targetNode) {
62
+ return;
63
+ }
64
+
65
+ const currentSize = getSize(this.targetNode); // if (this.size && shallowCompare(currentSize, this.size)) {
66
+
67
+ if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
68
+ return;
69
+ }
70
+
71
+ this.size = currentSize;
72
+ this.onResize(this.size, this.targetNode);
73
+ return true;
74
+ }
75
+
76
+ resizeHandlerDispatch() {
77
+ if (!this.resizeHandler() || hasResizeObserver) {
78
+ return;
79
+ }
80
+
81
+ dispatch();
82
+ }
83
+
84
+ debounce() {
85
+ clearTimeout(this.interval);
86
+ this.interval = setTimeout(this.resizeHandler, 100);
87
+ }
88
+
89
+ transitionEndHandler(event) {
90
+ if (event.propertyName.indexOf('color') === -1) {
91
+ this.resizeHandlerDispatch();
92
+ }
93
+ }
94
+
95
+ addEventListeners(targetNode) {
96
+ targetNode.addEventListener('transitionend', this.transitionEndHandler);
97
+ window.addEventListener('resizeResponsive', this.debounce);
98
+ targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
99
+ targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
100
+ }
101
+
102
+ removeEventListeners(targetNode) {
103
+ targetNode.removeEventListener('transitionend', this.transitionEndHandler);
104
+ window.removeEventListener('resizeResponsive', this.debounce);
105
+ targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
106
+ targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
107
+ }
108
+
109
+ observe(targetNode) {
110
+ this.targetNode = targetNode;
111
+
112
+ if (hasResizeObserver) {
113
+ this.resizeObserverInstance.observe(targetNode);
114
+ } else {
115
+ this.addEventListeners(targetNode);
116
+ this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
117
+ }
118
+ }
119
+
120
+ replaceObservationElement(targetNode) {
121
+ if (this.targetNode === targetNode) {
122
+ return;
123
+ }
124
+
125
+ this.targetNode && this.disconnect();
126
+ targetNode && this.observe(targetNode);
127
+ targetNode && this.resizeHandlerDispatch();
128
+ }
129
+
130
+ disconnect() {
131
+ this.targetNode && this.removeEventListeners(this.targetNode);
132
+ hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
133
+ this.targetNode = null;
134
+ this.size = {
135
+ height: 0,
136
+ width: 0
137
+ };
138
+ }
139
+
140
+ }
@@ -9,6 +9,7 @@ exports[`ResponsiveDropBox rendering the defult props 1`] = `
9
9
  data-position="bottomStart"
10
10
  data-selector-id="dropBox"
11
11
  data-test-id="dropBox"
12
+ dot-ui-element="dropbox"
12
13
  >
13
14
  <div
14
15
  class="subContainer bottom_shadow radius defaultPalette"
@@ -169,7 +169,7 @@ export default class TextBox extends React.PureComponent {
169
169
  ref: this.inputRef,
170
170
  type: type,
171
171
  value: value,
172
- onScroll: isScrollPrevent ? this.handlePreventTextBoxScroll : '',
172
+ onScroll: isScrollPrevent ? this.handlePreventTextBoxScroll : null,
173
173
  onKeyPress: onKeyPress,
174
174
  onMouseDown: onMouseDown,
175
175
  ...options,
@@ -23,6 +23,7 @@ var _DropBoxElementModule = _interopRequireDefault(require("./css/DropBoxElement
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
26
+ /* eslint-disable react/no-unknown-property */
26
27
  function DropBoxElement(props) {
27
28
  var children = props.children,
28
29
  isAnimate = props.isAnimate,
@@ -120,7 +121,8 @@ function DropBoxElement(props) {
120
121
  "aria-labelledby": ariaLabelledby,
121
122
  tabIndex: tabIndex,
122
123
  onAnimationEnd: isAnimate && FireOnAnimationEnd,
123
- "data-a11y-focus-main-area": true
124
+ "data-a11y-focus-main-area": true,
125
+ "dot-ui-element": "dropbox"
124
126
  }, /*#__PURE__*/_react["default"].createElement("div", {
125
127
  tabIndex: "-1",
126
128
  className: "".concat(subContainerClass, " ").concat(_DropBoxElementModule["default"]["".concat(palette, "Palette")]),
@@ -9,6 +9,7 @@ exports[`DropBoxElement rendering the defult props 1`] = `
9
9
  data-position="bottomStart"
10
10
  data-selector-id="dropBox"
11
11
  data-test-id="dropBox"
12
+ dot-ui-element="dropbox"
12
13
  >
13
14
  <div
14
15
  class="subContainer bottom_shadow radius defaultPalette"
@@ -9,6 +9,7 @@ exports[`DropBox rendering the defult props 1`] = `
9
9
  data-position="bottomStart"
10
10
  data-selector-id="dropBox"
11
11
  data-test-id="dropBox"
12
+ dot-ui-element="dropbox"
12
13
  >
13
14
  <div
14
15
  class="subContainer bottom_shadow radius defaultPalette"
@@ -19,6 +19,7 @@ exports[`DropDown rendering the defult props 1`] = `
19
19
  data-position="bottomMid"
20
20
  data-selector-id="dropBox"
21
21
  data-test-id="dropBox"
22
+ dot-ui-element="dropbox"
22
23
  >
23
24
  <div
24
25
  class="subContainer bottom_shadow radius defaultPalette"