@micromag/screen-game-sort 0.3.738 → 0.3.739
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 +15 -8
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useIntl, FormattedMessage, defineMessage } from 'react-intl';
|
|
2
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
6
6
|
import { useSprings, animated } from '@react-spring/web';
|
|
7
7
|
import { useDrag } from '@use-gesture/react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import isString from 'lodash/isString';
|
|
10
10
|
import shuffle from 'lodash/shuffle';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
12
|
+
import React, { useMemo, useState, useRef, useEffect, useCallback } from 'react';
|
|
13
13
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
14
14
|
import { ScreenElement } from '@micromag/core/components';
|
|
15
15
|
import { useScreenSize, useScreenRenderContext, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef } from '@micromag/core/contexts';
|
|
@@ -74,10 +74,10 @@ var defaultProps = {
|
|
|
74
74
|
active: true,
|
|
75
75
|
className: null
|
|
76
76
|
};
|
|
77
|
-
var
|
|
77
|
+
var GameSort = function GameSort(_ref) {
|
|
78
78
|
var layout = _ref.layout,
|
|
79
79
|
heading = _ref.heading,
|
|
80
|
-
|
|
80
|
+
initialItems = _ref.items,
|
|
81
81
|
spacing = _ref.spacing,
|
|
82
82
|
itemsLayout = _ref.itemsLayout,
|
|
83
83
|
itemsBoxStyle = _ref.itemsBoxStyle,
|
|
@@ -135,6 +135,13 @@ var zzzz = function zzzz(_ref) {
|
|
|
135
135
|
footerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
136
136
|
var trackingEnabled = isView;
|
|
137
137
|
var trackEvent = useTrackScreenEvent('game-sort');
|
|
138
|
+
var items = useMemo(function () {
|
|
139
|
+
return (initialItems || []).map(function (item, itemIndex) {
|
|
140
|
+
return _objectSpread({
|
|
141
|
+
id: itemIndex
|
|
142
|
+
}, item);
|
|
143
|
+
});
|
|
144
|
+
}, [initialItems]);
|
|
138
145
|
var _useState = useState(isView ? shuffle(items || []) : items || []),
|
|
139
146
|
_useState2 = _slicedToArray(_useState, 2),
|
|
140
147
|
sortedItems = _useState2[0],
|
|
@@ -514,8 +521,8 @@ var zzzz = function zzzz(_ref) {
|
|
|
514
521
|
className: styles.background
|
|
515
522
|
}) : null);
|
|
516
523
|
};
|
|
517
|
-
|
|
518
|
-
|
|
524
|
+
GameSort.propTypes = propTypes;
|
|
525
|
+
GameSort.defaultProps = defaultProps;
|
|
519
526
|
|
|
520
527
|
// import * as transforms from './transforms/index';
|
|
521
528
|
|
|
@@ -539,7 +546,7 @@ var definition = {
|
|
|
539
546
|
"value": "Sort game"
|
|
540
547
|
}]
|
|
541
548
|
}),
|
|
542
|
-
component:
|
|
549
|
+
component: GameSort,
|
|
543
550
|
layouts: ['top', 'middle', 'bottom'],
|
|
544
551
|
// transforms,
|
|
545
552
|
fields: [{
|
|
@@ -772,4 +779,4 @@ var definition = {
|
|
|
772
779
|
}]
|
|
773
780
|
};
|
|
774
781
|
|
|
775
|
-
export {
|
|
782
|
+
export { GameSort as GameSortScreen, definition as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-game-sort",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.739",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"access": "public",
|
|
88
88
|
"registry": "https://registry.npmjs.org/"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "3808fe7b593aaed071a4cf42039c17e5a90cc596"
|
|
91
91
|
}
|