@micromag/screen-keypad 0.4.56 → 0.4.57
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/es/index.js +20 -8
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { animated } from '@react-spring/web';
|
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import isEmpty from 'lodash/isEmpty';
|
|
8
8
|
import isString from 'lodash/isString';
|
|
9
|
-
import { useRef, useState, useMemo,
|
|
9
|
+
import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
10
10
|
import { Close, ScreenElement } from '@micromag/core/components';
|
|
11
11
|
import { usePlaybackContext, usePlaybackMediaRef, useScreenState, useScreenSize, useViewerContext, useViewerWebView, useViewerInteraction, useScreenRenderContext } from '@micromag/core/contexts';
|
|
12
12
|
import { useTrackScreenEvent, useDimensionObserver, useDragProgress } from '@micromag/core/hooks';
|
|
@@ -227,6 +227,18 @@ function KeypadScreen(_ref) {
|
|
|
227
227
|
popupInWebView = _ref10$inWebView === void 0 ? false : _ref10$inWebView,
|
|
228
228
|
_ref10$boxStyle = _ref10.boxStyle,
|
|
229
229
|
popupButtonBoxStyle = _ref10$boxStyle === void 0 ? null : _ref10$boxStyle;
|
|
230
|
+
|
|
231
|
+
// Skips a render loop when opening a popup
|
|
232
|
+
var _useState7 = useState(false),
|
|
233
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
234
|
+
showNextPopup = _useState8[0],
|
|
235
|
+
setShowNextPopup = _useState8[1];
|
|
236
|
+
useEffect(function () {
|
|
237
|
+
if (showNextPopup) {
|
|
238
|
+
setShowNextPopup(false);
|
|
239
|
+
setShowPopup(true);
|
|
240
|
+
}
|
|
241
|
+
}, [showNextPopup, setShowPopup, setShowNextPopup]);
|
|
230
242
|
var onItemClick = useCallback(function (e, item, index) {
|
|
231
243
|
e.stopPropagation();
|
|
232
244
|
if (isNotInteractive) {
|
|
@@ -247,7 +259,7 @@ function KeypadScreen(_ref) {
|
|
|
247
259
|
});
|
|
248
260
|
} else {
|
|
249
261
|
setPopup(item);
|
|
250
|
-
|
|
262
|
+
setShowNextPopup(true);
|
|
251
263
|
}
|
|
252
264
|
var _ref12 = heading || {},
|
|
253
265
|
_ref12$body = _ref12.body,
|
|
@@ -285,10 +297,10 @@ function KeypadScreen(_ref) {
|
|
|
285
297
|
e.stopPropagation();
|
|
286
298
|
}
|
|
287
299
|
}, []);
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
popupDragDirection =
|
|
291
|
-
setPopupDragDirection =
|
|
300
|
+
var _useState9 = useState(null),
|
|
301
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
302
|
+
popupDragDirection = _useState0[0],
|
|
303
|
+
setPopupDragDirection = _useState0[1];
|
|
292
304
|
var onPopupScrollHeightChange = useCallback(function (_ref13) {
|
|
293
305
|
var _ref13$scrolleeHeight = _ref13.scrolleeHeight,
|
|
294
306
|
scrolleeHeight = _ref13$scrolleeHeight === void 0 ? 0 : _ref13$scrolleeHeight;
|
|
@@ -594,7 +606,7 @@ function KeypadScreen(_ref) {
|
|
|
594
606
|
spacing: isPlaceholder ? 2 : columnSpacing,
|
|
595
607
|
items: gridItems
|
|
596
608
|
})]
|
|
597
|
-
}),
|
|
609
|
+
}), /*#__PURE__*/jsxs(Fragment, {
|
|
598
610
|
children: [/*#__PURE__*/jsx(animated.div, {
|
|
599
611
|
className: classNames([styles.popupBackdrop]),
|
|
600
612
|
style: {
|
|
@@ -704,7 +716,7 @@ function KeypadScreen(_ref) {
|
|
|
704
716
|
})
|
|
705
717
|
})
|
|
706
718
|
}))]
|
|
707
|
-
})
|
|
719
|
+
}) ]
|
|
708
720
|
}), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
709
721
|
ref: footerRef,
|
|
710
722
|
className: styles.footer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-keypad",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.57",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -94,6 +94,6 @@
|
|
|
94
94
|
"access": "public",
|
|
95
95
|
"registry": "https://registry.npmjs.org/"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "fbe8859ecf20634ed5591afb432ff4869eb37352",
|
|
98
98
|
"types": "es/index.d.ts"
|
|
99
99
|
}
|