@zohodesk/components 1.4.7 → 1.4.8
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 +11 -4
- package/es/Accordion/Accordion.js +1 -1
- package/es/Card/Card.js +1 -1
- package/es/MultiSelect/MultiSelect.js +1 -1
- package/es/Popup/Popup.js +45 -17
- package/es/Popup/Registry.js +1 -0
- package/es/Select/Select.js +1 -1
- package/es/Select/__tests__/Select.spec.js +8 -1
- package/es/v1/Popup/Popup.js +1 -1
- package/es/v1/Select/Select.js +1 -1
- package/lib/Accordion/Accordion.js +2 -2
- package/lib/Card/Card.js +2 -2
- package/lib/MultiSelect/MultiSelect.js +2 -2
- package/lib/Popup/Popup.js +54 -18
- package/lib/Popup/Registry.js +1 -0
- package/lib/Select/Select.js +2 -2
- package/lib/Select/__tests__/Select.spec.js +8 -1
- package/lib/v1/Popup/Popup.js +2 -2
- package/lib/v1/Select/Select.js +2 -2
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -2,15 +2,22 @@
|
|
|
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.8
|
|
6
|
+
|
|
7
|
+
- Added UNSAFE_ prefix to deprecated lifecycle methods: componentWillMount, componentWillReceiveProps, and componentWillUpdate.
|
|
8
|
+
|
|
9
|
+
- **Popup**
|
|
10
|
+
- Handled potential memory leaks by `event listeners`.
|
|
11
|
+
- Added unmount handling for `requestAnimationFrame` to ensure proper cleanup.
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
# 1.4.7
|
|
6
15
|
|
|
7
|
-
- **Card**
|
|
8
|
-
- Added support for reverse infinite scroll with `isRecentOnBottom`.
|
|
16
|
+
- **Card** - Added support for reverse infinite scroll with `isRecentOnBottom`.
|
|
9
17
|
|
|
10
18
|
# 1.4.6
|
|
11
19
|
|
|
12
|
-
- **Popup**
|
|
13
|
-
- - Added fixed popup scroll block behavior support to iframe elements (same-origin only).
|
|
20
|
+
- **Popup** - Added fixed popup scroll block behavior support to iframe elements (same-origin only).
|
|
14
21
|
|
|
15
22
|
# 1.4.5
|
|
16
23
|
|
|
@@ -25,7 +25,7 @@ export default class Accordion extends React.Component {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
29
29
|
if (this.props.selectedItem !== nextProps.selectedItem && !this.props.disableInternalState) {
|
|
30
30
|
this.setState({
|
|
31
31
|
selectedItem: nextProps.selectedItem
|
package/es/Card/Card.js
CHANGED
|
@@ -102,7 +102,7 @@ export default class Card extends Component {
|
|
|
102
102
|
//this.onClearScroll = debounce(this.setScroll.bind(this, false), 500);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
106
106
|
if (this.from !== nextProps.from) {
|
|
107
107
|
this.from = nextProps.from;
|
|
108
108
|
}
|
|
@@ -89,7 +89,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
89
89
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
93
93
|
const {
|
|
94
94
|
selectedOptions,
|
|
95
95
|
options,
|
package/es/Popup/Popup.js
CHANGED
|
@@ -161,7 +161,11 @@ const Popup = function (Component) {
|
|
|
161
161
|
this.handleDropElementStyleUpdate = this.handleDropElementStyleUpdate.bind(this);
|
|
162
162
|
this.positionRef = /*#__PURE__*/React.createRef();
|
|
163
163
|
this.rootElement = Registry.getRootElement();
|
|
164
|
-
this.popupObserver = new ResizeObserver(this.handlePopupResize);
|
|
164
|
+
this.popupObserver = new ResizeObserver(this.handlePopupResize);
|
|
165
|
+
this.cancelRaf = this.cancelRaf.bind(this);
|
|
166
|
+
this.cancelPendingAnimationFrames = this.cancelPendingAnimationFrames.bind(this);
|
|
167
|
+
this.setPositionRafId = null;
|
|
168
|
+
this.resizePositionRafId = null; //dropBoxSize
|
|
165
169
|
|
|
166
170
|
this.size = null;
|
|
167
171
|
this.isTargetElementVisible = false;
|
|
@@ -181,17 +185,18 @@ const Popup = function (Component) {
|
|
|
181
185
|
groupPopups.push(this);
|
|
182
186
|
Registry.popups[group] = groupPopups;
|
|
183
187
|
|
|
184
|
-
if (Object.keys(Registry.popups).length === 1 && groupPopups.length === 1) {
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
if (Object.keys(Registry.popups).length === 1 && groupPopups.length === 1 && Registry.listenerPopupRef === undefined) {
|
|
189
|
+
Registry.listenerPopupRef = this;
|
|
190
|
+
Registry.listenerPopupRef.updateListeners(true, CLICK_EVENTS, document);
|
|
191
|
+
document.addEventListener('keyup', Registry.listenerPopupRef.documentKeyupHandler, false); // document.addEventListener('scroll', Registry.listenerPopupRef.handleScroll, true);
|
|
187
192
|
|
|
188
|
-
window.addEventListener('resize',
|
|
189
|
-
document.addEventListener('mousedown',
|
|
190
|
-
document.addEventListener('focus',
|
|
193
|
+
window.addEventListener('resize', Registry.listenerPopupRef.handleResize);
|
|
194
|
+
document.addEventListener('mousedown', Registry.listenerPopupRef.handleDocumentMouseDown, true);
|
|
195
|
+
document.addEventListener('focus', Registry.listenerPopupRef.handleDocumentFocus, true);
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
|
|
199
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
195
200
|
const {
|
|
196
201
|
isPopupOpen
|
|
197
202
|
} = this.state;
|
|
@@ -256,6 +261,20 @@ const Popup = function (Component) {
|
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
263
|
|
|
264
|
+
cancelRaf(refName) {
|
|
265
|
+
const id = this[refName];
|
|
266
|
+
|
|
267
|
+
if (id) {
|
|
268
|
+
cancelAnimationFrame(id);
|
|
269
|
+
this[refName] = null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
cancelPendingAnimationFrames() {
|
|
274
|
+
this.cancelRaf('setPositionRafId');
|
|
275
|
+
this.cancelRaf('resizePositionRafId');
|
|
276
|
+
}
|
|
277
|
+
|
|
259
278
|
componentWillUnmount() {
|
|
260
279
|
const group = this.getGroup();
|
|
261
280
|
Registry.popups = Object.keys(Registry.popups).reduce((res, groupName) => {
|
|
@@ -284,14 +303,17 @@ const Popup = function (Component) {
|
|
|
284
303
|
this.popupObserver.disconnect();
|
|
285
304
|
}
|
|
286
305
|
|
|
287
|
-
if (noPopups) {
|
|
288
|
-
|
|
289
|
-
document.removeEventListener('keyup',
|
|
306
|
+
if (noPopups && Registry.listenerPopupRef !== undefined) {
|
|
307
|
+
Registry.listenerPopupRef.updateListeners(false, CLICK_EVENTS, document);
|
|
308
|
+
document.removeEventListener('keyup', Registry.listenerPopupRef.documentKeyupHandler); // document.removeEventListener('scroll', Registry.listenerPopupRef.handleScroll);
|
|
290
309
|
|
|
291
|
-
window.removeEventListener('resize',
|
|
292
|
-
document.removeEventListener('mousedown',
|
|
293
|
-
document.removeEventListener('focus',
|
|
310
|
+
window.removeEventListener('resize', Registry.listenerPopupRef.handleResize);
|
|
311
|
+
document.removeEventListener('mousedown', Registry.listenerPopupRef.handleDocumentMouseDown, true);
|
|
312
|
+
document.removeEventListener('focus', Registry.listenerPopupRef.handleDocumentFocus, true);
|
|
313
|
+
Registry.listenerPopupRef = undefined;
|
|
294
314
|
}
|
|
315
|
+
|
|
316
|
+
this.cancelPendingAnimationFrames();
|
|
295
317
|
}
|
|
296
318
|
|
|
297
319
|
handleAddingScrollBlock() {
|
|
@@ -814,7 +836,8 @@ const Popup = function (Component) {
|
|
|
814
836
|
}
|
|
815
837
|
|
|
816
838
|
const setPosition = () => {
|
|
817
|
-
|
|
839
|
+
this.cancelRaf('setPositionRafId');
|
|
840
|
+
this.setPositionRafId = requestAnimationFrame(() => {
|
|
818
841
|
const {
|
|
819
842
|
placeHolderElement,
|
|
820
843
|
dropElement
|
|
@@ -823,7 +846,7 @@ const Popup = function (Component) {
|
|
|
823
846
|
position,
|
|
824
847
|
isPopupReady
|
|
825
848
|
} = this.state;
|
|
826
|
-
const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
849
|
+
const scrollContainer = placeHolderElement ? placeHolderElement.closest('[data-scroll=true]') || document.body : document.body;
|
|
827
850
|
const betterPosition = viewPort.betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
|
|
828
851
|
needArrow,
|
|
829
852
|
isAbsolute,
|
|
@@ -852,6 +875,8 @@ const Popup = function (Component) {
|
|
|
852
875
|
this.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
|
|
853
876
|
}
|
|
854
877
|
}
|
|
878
|
+
|
|
879
|
+
this.setPositionRafId = null;
|
|
855
880
|
});
|
|
856
881
|
};
|
|
857
882
|
|
|
@@ -883,7 +908,8 @@ const Popup = function (Component) {
|
|
|
883
908
|
|
|
884
909
|
if (placeHolderElement && dropElement) {
|
|
885
910
|
const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
886
|
-
|
|
911
|
+
this.cancelRaf('resizePositionRafId');
|
|
912
|
+
this.resizePositionRafId = requestAnimationFrame(() => {
|
|
887
913
|
const needArrow = this.getNeedArrow(popup);
|
|
888
914
|
const isAbsolute = this.getIsAbsolutePopup(popup);
|
|
889
915
|
const customOrder = this.getCustomPositionOrder(popup);
|
|
@@ -940,6 +966,8 @@ const Popup = function (Component) {
|
|
|
940
966
|
// });
|
|
941
967
|
// }
|
|
942
968
|
|
|
969
|
+
|
|
970
|
+
this.resizePositionRafId = null;
|
|
943
971
|
});
|
|
944
972
|
}
|
|
945
973
|
}
|
package/es/Popup/Registry.js
CHANGED
package/es/Select/Select.js
CHANGED
|
@@ -119,7 +119,7 @@ export class SelectComponent extends Component {
|
|
|
119
119
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
123
123
|
let {
|
|
124
124
|
selectedValue,
|
|
125
125
|
isDefaultSelectValue,
|
|
@@ -246,7 +246,14 @@ describe('Select -', () => {
|
|
|
246
246
|
userEvent.type(within(getByTestId(dropboxTestId)).getByRole('textbox'), '2');
|
|
247
247
|
expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
248
248
|
expect(asFragment()).toMatchSnapshot();
|
|
249
|
-
});
|
|
249
|
+
}); // test('Should render the only options matching search value even with additional spaces before and after', () => {
|
|
250
|
+
// const { getByRole, getAllByRole, asFragment, getByTestId } = render(<Select needSearch options={options} />);
|
|
251
|
+
// userEvent.click(getByRole(selectInputRole));
|
|
252
|
+
// userEvent.type(within(getByTestId(dropboxTestId)).getByRole('textbox'), ' 2 ');
|
|
253
|
+
// expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
254
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
255
|
+
// });
|
|
256
|
+
|
|
250
257
|
test('Should trigger given onSearch, when type on the search input', async () => {
|
|
251
258
|
const mockOnSearch = jest.fn();
|
|
252
259
|
const {
|
package/es/v1/Popup/Popup.js
CHANGED
package/es/v1/Select/Select.js
CHANGED
|
@@ -119,7 +119,7 @@ export class SelectComponent extends Component {
|
|
|
119
119
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
123
123
|
let {
|
|
124
124
|
selectedValue,
|
|
125
125
|
isDefaultSelectValue,
|
|
@@ -69,8 +69,8 @@ var Accordion = /*#__PURE__*/function (_React$Component) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}, {
|
|
72
|
-
key: "
|
|
73
|
-
value: function
|
|
72
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
73
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
74
74
|
if (this.props.selectedItem !== nextProps.selectedItem && !this.props.disableInternalState) {
|
|
75
75
|
this.setState({
|
|
76
76
|
selectedItem: nextProps.selectedItem
|
package/lib/Card/Card.js
CHANGED
|
@@ -184,8 +184,8 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
_createClass(Card, [{
|
|
187
|
-
key: "
|
|
188
|
-
value: function
|
|
187
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
188
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
189
189
|
if (this.from !== nextProps.from) {
|
|
190
190
|
this.from = nextProps.from;
|
|
191
191
|
}
|
|
@@ -172,8 +172,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
172
172
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
173
173
|
}
|
|
174
174
|
}, {
|
|
175
|
-
key: "
|
|
176
|
-
value: function
|
|
175
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
176
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
177
177
|
var _this2 = this;
|
|
178
178
|
|
|
179
179
|
var selectedOptions = nextProps.selectedOptions,
|
package/lib/Popup/Popup.js
CHANGED
|
@@ -236,7 +236,11 @@ var Popup = function Popup(Component) {
|
|
|
236
236
|
_this.handleDropElementStyleUpdate = _this.handleDropElementStyleUpdate.bind(_assertThisInitialized(_this));
|
|
237
237
|
_this.positionRef = /*#__PURE__*/_react["default"].createRef();
|
|
238
238
|
_this.rootElement = _Registry["default"].getRootElement();
|
|
239
|
-
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize);
|
|
239
|
+
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize);
|
|
240
|
+
_this.cancelRaf = _this.cancelRaf.bind(_assertThisInitialized(_this));
|
|
241
|
+
_this.cancelPendingAnimationFrames = _this.cancelPendingAnimationFrames.bind(_assertThisInitialized(_this));
|
|
242
|
+
_this.setPositionRafId = null;
|
|
243
|
+
_this.resizePositionRafId = null; //dropBoxSize
|
|
240
244
|
|
|
241
245
|
_this.size = null;
|
|
242
246
|
_this.isTargetElementVisible = false;
|
|
@@ -262,18 +266,21 @@ var Popup = function Popup(Component) {
|
|
|
262
266
|
groupPopups.push(this);
|
|
263
267
|
_Registry["default"].popups[group] = groupPopups;
|
|
264
268
|
|
|
265
|
-
if (Object.keys(_Registry["default"].popups).length === 1 && groupPopups.length === 1) {
|
|
266
|
-
|
|
267
|
-
document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
|
|
269
|
+
if (Object.keys(_Registry["default"].popups).length === 1 && groupPopups.length === 1 && _Registry["default"].listenerPopupRef === undefined) {
|
|
270
|
+
_Registry["default"].listenerPopupRef = this;
|
|
268
271
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
document.addEventListener('
|
|
272
|
+
_Registry["default"].listenerPopupRef.updateListeners(true, CLICK_EVENTS, document);
|
|
273
|
+
|
|
274
|
+
document.addEventListener('keyup', _Registry["default"].listenerPopupRef.documentKeyupHandler, false); // document.addEventListener('scroll', Registry.listenerPopupRef.handleScroll, true);
|
|
275
|
+
|
|
276
|
+
window.addEventListener('resize', _Registry["default"].listenerPopupRef.handleResize);
|
|
277
|
+
document.addEventListener('mousedown', _Registry["default"].listenerPopupRef.handleDocumentMouseDown, true);
|
|
278
|
+
document.addEventListener('focus', _Registry["default"].listenerPopupRef.handleDocumentFocus, true);
|
|
272
279
|
}
|
|
273
280
|
}
|
|
274
281
|
}, {
|
|
275
|
-
key: "
|
|
276
|
-
value: function
|
|
282
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
283
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
277
284
|
var isPopupOpen = this.state.isPopupOpen;
|
|
278
285
|
|
|
279
286
|
if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
|
|
@@ -337,6 +344,22 @@ var Popup = function Popup(Component) {
|
|
|
337
344
|
this.handleIframeEventListeners(shouldAdd, CLICK_EVENTS);
|
|
338
345
|
}
|
|
339
346
|
}
|
|
347
|
+
}, {
|
|
348
|
+
key: "cancelRaf",
|
|
349
|
+
value: function cancelRaf(refName) {
|
|
350
|
+
var id = this[refName];
|
|
351
|
+
|
|
352
|
+
if (id) {
|
|
353
|
+
cancelAnimationFrame(id);
|
|
354
|
+
this[refName] = null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, {
|
|
358
|
+
key: "cancelPendingAnimationFrames",
|
|
359
|
+
value: function cancelPendingAnimationFrames() {
|
|
360
|
+
this.cancelRaf('setPositionRafId');
|
|
361
|
+
this.cancelRaf('resizePositionRafId');
|
|
362
|
+
}
|
|
340
363
|
}, {
|
|
341
364
|
key: "componentWillUnmount",
|
|
342
365
|
value: function componentWillUnmount() {
|
|
@@ -371,14 +394,18 @@ var Popup = function Popup(Component) {
|
|
|
371
394
|
this.popupObserver.disconnect();
|
|
372
395
|
}
|
|
373
396
|
|
|
374
|
-
if (noPopups) {
|
|
375
|
-
|
|
376
|
-
document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
|
|
397
|
+
if (noPopups && _Registry["default"].listenerPopupRef !== undefined) {
|
|
398
|
+
_Registry["default"].listenerPopupRef.updateListeners(false, CLICK_EVENTS, document);
|
|
377
399
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
400
|
+
document.removeEventListener('keyup', _Registry["default"].listenerPopupRef.documentKeyupHandler); // document.removeEventListener('scroll', Registry.listenerPopupRef.handleScroll);
|
|
401
|
+
|
|
402
|
+
window.removeEventListener('resize', _Registry["default"].listenerPopupRef.handleResize);
|
|
403
|
+
document.removeEventListener('mousedown', _Registry["default"].listenerPopupRef.handleDocumentMouseDown, true);
|
|
404
|
+
document.removeEventListener('focus', _Registry["default"].listenerPopupRef.handleDocumentFocus, true);
|
|
405
|
+
_Registry["default"].listenerPopupRef = undefined;
|
|
381
406
|
}
|
|
407
|
+
|
|
408
|
+
this.cancelPendingAnimationFrames();
|
|
382
409
|
}
|
|
383
410
|
}, {
|
|
384
411
|
key: "handleAddingScrollBlock",
|
|
@@ -906,13 +933,15 @@ var Popup = function Popup(Component) {
|
|
|
906
933
|
}
|
|
907
934
|
|
|
908
935
|
var setPosition = function setPosition() {
|
|
909
|
-
|
|
936
|
+
_this6.cancelRaf('setPositionRafId');
|
|
937
|
+
|
|
938
|
+
_this6.setPositionRafId = requestAnimationFrame(function () {
|
|
910
939
|
var placeHolderElement = _this6.placeHolderElement,
|
|
911
940
|
dropElement = _this6.dropElement;
|
|
912
941
|
var _this6$state = _this6.state,
|
|
913
942
|
position = _this6$state.position,
|
|
914
943
|
isPopupReady = _this6$state.isPopupReady;
|
|
915
|
-
var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
944
|
+
var scrollContainer = placeHolderElement ? placeHolderElement.closest('[data-scroll=true]') || document.body : document.body;
|
|
916
945
|
|
|
917
946
|
var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
|
|
918
947
|
needArrow: needArrow,
|
|
@@ -942,6 +971,8 @@ var Popup = function Popup(Component) {
|
|
|
942
971
|
_this6.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
|
|
943
972
|
}
|
|
944
973
|
}
|
|
974
|
+
|
|
975
|
+
_this6.setPositionRafId = null;
|
|
945
976
|
});
|
|
946
977
|
};
|
|
947
978
|
|
|
@@ -974,7 +1005,10 @@ var Popup = function Popup(Component) {
|
|
|
974
1005
|
|
|
975
1006
|
if (placeHolderElement && dropElement) {
|
|
976
1007
|
var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
977
|
-
|
|
1008
|
+
|
|
1009
|
+
_this7.cancelRaf('resizePositionRafId');
|
|
1010
|
+
|
|
1011
|
+
_this7.resizePositionRafId = requestAnimationFrame(function () {
|
|
978
1012
|
var needArrow = _this7.getNeedArrow(popup);
|
|
979
1013
|
|
|
980
1014
|
var isAbsolute = _this7.getIsAbsolutePopup(popup);
|
|
@@ -1045,6 +1079,8 @@ var Popup = function Popup(Component) {
|
|
|
1045
1079
|
// });
|
|
1046
1080
|
// }
|
|
1047
1081
|
|
|
1082
|
+
|
|
1083
|
+
_this7.resizePositionRafId = null;
|
|
1048
1084
|
});
|
|
1049
1085
|
}
|
|
1050
1086
|
}
|
package/lib/Popup/Registry.js
CHANGED
|
@@ -10,6 +10,7 @@ var _Config = require("../Provider/Config.js");
|
|
|
10
10
|
var Registry = {
|
|
11
11
|
lastOpenedGroup: [],
|
|
12
12
|
popups: {},
|
|
13
|
+
listenerPopupRef: undefined,
|
|
13
14
|
scrollBlockedListenerPopupRef: undefined,
|
|
14
15
|
scrollableListenerPopupRef: undefined,
|
|
15
16
|
getOpenedPopups: function getOpenedPopups() {
|
package/lib/Select/Select.js
CHANGED
|
@@ -184,8 +184,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
184
184
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
185
185
|
}
|
|
186
186
|
}, {
|
|
187
|
-
key: "
|
|
188
|
-
value: function
|
|
187
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
188
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
189
189
|
var selectedValue = nextProps.selectedValue,
|
|
190
190
|
isDefaultSelectValue = nextProps.isDefaultSelectValue,
|
|
191
191
|
valueField = nextProps.valueField,
|
|
@@ -294,7 +294,14 @@ describe('Select -', function () {
|
|
|
294
294
|
|
|
295
295
|
expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
296
296
|
expect(asFragment()).toMatchSnapshot();
|
|
297
|
-
});
|
|
297
|
+
}); // test('Should render the only options matching search value even with additional spaces before and after', () => {
|
|
298
|
+
// const { getByRole, getAllByRole, asFragment, getByTestId } = render(<Select needSearch options={options} />);
|
|
299
|
+
// userEvent.click(getByRole(selectInputRole));
|
|
300
|
+
// userEvent.type(within(getByTestId(dropboxTestId)).getByRole('textbox'), ' 2 ');
|
|
301
|
+
// expect(getAllByRole(listItemRole)).toHaveLength(1);
|
|
302
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
303
|
+
// });
|
|
304
|
+
|
|
298
305
|
test('Should trigger given onSearch, when type on the search input', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
299
306
|
var mockOnSearch, _render15, getByRole, getByTestId;
|
|
300
307
|
|
package/lib/v1/Popup/Popup.js
CHANGED
|
@@ -186,8 +186,8 @@ var Popup = function Popup(Component) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}, {
|
|
189
|
-
key: "
|
|
190
|
-
value: function
|
|
189
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
190
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
191
191
|
var isPopupOpen = this.state.isPopupOpen;
|
|
192
192
|
|
|
193
193
|
if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
|
package/lib/v1/Select/Select.js
CHANGED
|
@@ -185,8 +185,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
185
185
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
186
186
|
}
|
|
187
187
|
}, {
|
|
188
|
-
key: "
|
|
189
|
-
value: function
|
|
188
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
189
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
190
190
|
var selectedValue = nextProps.selectedValue,
|
|
191
191
|
isDefaultSelectValue = nextProps.isDefaultSelectValue,
|
|
192
192
|
valueField = nextProps.valueField,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build:docs": "react-cli build:docs",
|
|
21
|
-
"
|
|
21
|
+
"_lint": "react-cli lint",
|
|
22
22
|
"lintAll": "react-cli lint ./src",
|
|
23
23
|
"lintAllFix": "npm run lintAll --eslint:fix=true",
|
|
24
|
+
"lint": "npx eslint ./src",
|
|
24
25
|
"clean": "react-cli clean build unittest coverage es lib assets && mkdir assets",
|
|
25
26
|
"dubCheck": "node ./node_modules/@zohodesk-private/node-plugins/es/dublication_css_file_finder node_modules/@zohodesk/icons/es node_modules/@zohodesk/variables/es",
|
|
26
27
|
"init": "npm run clean && cd ../assets && npm run componentsassets && cd ../components && npm run build:variables",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"snap-update": "npm run test-clean && npm run test -- -u",
|
|
48
49
|
"sstest": "npm run init && react-cli sstest",
|
|
49
50
|
"build:external": "npm run clean && npm run init && npm run docsjs:build && npm run build:externalDocCopy && react-cli build:component:umd && npm run externalDocHTMLChange",
|
|
50
|
-
"download": "react-cli clean ./node_modules ./package-lock.json && npm install",
|
|
51
|
+
"download": "react-cli clean ./node_modules ./package-lock.json && npm install && cd ../ && npm run download",
|
|
51
52
|
"expublish": "npm publish --tag experimental-version",
|
|
52
53
|
"css:lineheight:validate": "node ./node_modules/@zohodesk-private/node-plugins/es/lineheight_automation/lineHeightErrorCheck.js ./src/",
|
|
53
54
|
"cssVariableConvert": "react-cli variableConverter ./lib ./lib && react-cli variableConverter ./es ./es",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"@testing-library/react-hooks": "^7.0.2",
|
|
74
75
|
"@testing-library/user-event": "^13.0.10",
|
|
75
76
|
"@zohodesk-private/color-variable-preprocessor": "1.2.0",
|
|
76
|
-
"@zohodesk-private/css-variable-migrator": "
|
|
77
|
+
"@zohodesk-private/css-variable-migrator": "1.0.9",
|
|
77
78
|
"@zohodesk-private/node-plugins": "1.1.13",
|
|
78
79
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
79
80
|
"@zohodesk/a11y": "2.3.6",
|