@micromag/screen-game-sort 0.3.718 → 0.3.720
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/assets/css/styles.css +1 -1
- package/es/index.js +61 -35
- package/package.json +2 -2
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.micromag-screen-game-sort-layout{scrollbar-width:none}.micromag-screen-game-sort-layout::-webkit-scrollbar{display:none}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelOver .micromag-screen-game-sort-buttonLabel,.micromag-screen-game-sort-container .micromag-screen-game-sort-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-game-sort-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-game-sort-disabled.micromag-screen-game-sort-container{overflow:hidden;pointer-events:none}.micromag-screen-game-sort-hidden.micromag-screen-game-sort-container{display:none;visibility:hidden}.micromag-screen-game-sort-placeholder.micromag-screen-game-sort-container .micromag-screen-game-sort-content{padding:6px;position:relative}.micromag-screen-game-sort-emptyHeading,.micromag-screen-game-sort-emptyItems{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-game-sort-container .micromag-screen-game-sort-background{z-index:0}.micromag-screen-game-sort-container .micromag-screen-game-sort-content{z-index:1}.micromag-screen-game-sort-container .micromag-screen-game-sort-heading{font-size:1rem;font-weight:400;margin-bottom:.5em}.micromag-screen-game-sort-layout{overflow-x:hidden;overflow-y:auto;padding:10px}.micromag-screen-game-sort-emptyHeading,.micromag-screen-game-sort-emptyItems{margin:10px auto;padding:10px;width:100%}.micromag-screen-game-sort-emptyItems{padding:40px}.micromag-screen-game-sort-header{left:0;margin-top:0;position:absolute;top:0;width:100%;z-index:1}.micromag-screen-game-sort-footer{bottom:0;left:0;margin-top:0;position:absolute;width:100%}.micromag-screen-game-sort-items{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.micromag-screen-game-sort-item{border-radius:0;display:block;opacity:0;-
|
|
1
|
+
.micromag-screen-game-sort-layout{scrollbar-width:none}.micromag-screen-game-sort-layout::-webkit-scrollbar{display:none}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelOver .micromag-screen-game-sort-buttonLabel,.micromag-screen-game-sort-container .micromag-screen-game-sort-background{height:100%;left:0;position:absolute;top:0;width:100%}.micromag-screen-game-sort-container{height:100%;overflow:hidden;position:relative;width:100%}.micromag-screen-game-sort-disabled.micromag-screen-game-sort-container{overflow:hidden;pointer-events:none}.micromag-screen-game-sort-hidden.micromag-screen-game-sort-container{display:none;visibility:hidden}.micromag-screen-game-sort-placeholder.micromag-screen-game-sort-container .micromag-screen-game-sort-content{padding:6px;position:relative}.micromag-screen-game-sort-emptyHeading,.micromag-screen-game-sort-emptyItems{border:2px dashed #343434;color:#343434;margin:5px auto}.micromag-screen-game-sort-container .micromag-screen-game-sort-background{z-index:0}.micromag-screen-game-sort-container .micromag-screen-game-sort-content{z-index:1}.micromag-screen-game-sort-container .micromag-screen-game-sort-heading{font-size:1rem;font-weight:400;margin-bottom:.5em}.micromag-screen-game-sort-layout{overflow-x:hidden;overflow-y:auto;padding:10px}.micromag-screen-game-sort-emptyHeading,.micromag-screen-game-sort-emptyItems{margin:10px auto;padding:10px;width:100%}.micromag-screen-game-sort-emptyItems{padding:40px}.micromag-screen-game-sort-header{left:0;margin-top:0;position:absolute;top:0;width:100%;z-index:1}.micromag-screen-game-sort-footer{bottom:0;left:0;margin-top:0;position:absolute;width:100%}.micromag-screen-game-sort-items{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.micromag-screen-game-sort-item{border-radius:0;display:block;opacity:0;-webkit-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%;width:100%}.micromag-screen-game-sort-item .micromag-screen-game-sort-button{margin-bottom:.3em}.micromag-screen-game-sort-sorted .micromag-screen-game-sort-item{opacity:1}.micromag-screen-game-sort-draggable .micromag-screen-game-sort-item{-ms-touch-action:none;touch-action:none}.micromag-screen-game-sort-button{background-clip:padding-box;background-color:hsla(0,0%,100%,.1);display:block;padding:.5em;position:relative;text-align:center;width:100%}.micromag-screen-game-sort-button .micromag-screen-game-sort-buttonLabel{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.micromag-screen-game-sort-button .micromag-screen-game-sort-buttonResults{-webkit-animation:micromag-screen-game-sort-fadeIn .2s ease-in-out;animation:micromag-screen-game-sort-fadeIn .2s ease-in-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;margin-left:auto;padding-left:2em}.micromag-screen-game-sort-button .micromag-screen-game-sort-label{-webkit-transition:text-align .2s ease-in-out;transition:text-align .2s ease-in-out}.micromag-screen-game-sort-isEmpty .micromag-screen-game-sort-button{min-height:2em}.micromag-screen-game-sort-valid .micromag-screen-game-sort-button{background:rgba(0,255,0,.4)}.micromag-screen-game-sort-invalid .micromag-screen-game-sort-button{background:rgba(255,0,0,.4)}.micromag-screen-game-sort-resultsVisible .micromag-screen-game-sort-button .micromag-screen-game-sort-label{text-align:left}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelTop{display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutNoLabel .micromag-screen-game-sort-buttonLabel{display:none}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelOver{min-height:2em}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelOver .micromag-screen-game-sort-buttonVisual{position:relative;z-index:1}.micromag-screen-game-sort-button.micromag-screen-game-sort-layoutLabelOver .micromag-screen-game-sort-buttonLabel{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(28,28,28,0)),to(rgba(28,28,28,.75)));background-image:linear-gradient(180deg,rgba(28,28,28,0),rgba(28,28,28,.75));bottom:0;height:auto;padding:.5em;top:auto;z-index:2}.micromag-screen-game-sort-submitButton{background:#fff;color:#000;margin-top:.3em;padding:.75em}.micromag-screen-game-sort-submitButton:disabled{opacity:.5}.micromag-screen-game-sort-results{-webkit-animation:micromag-screen-game-sort-fadeIn .2s ease-in-out;animation:micromag-screen-game-sort-fadeIn .2s ease-in-out;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;margin-top:.3em}@-webkit-keyframes micromag-screen-game-sort-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes micromag-screen-game-sort-fadeIn{0%{opacity:0}to{opacity:1}}
|
package/es/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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';
|
|
16
16
|
import { useDimensionObserver, useTrackScreenEvent } from '@micromag/core/hooks';
|
|
17
|
-
import { isHeaderFilled, isFooterFilled, getFooterProps,
|
|
17
|
+
import { isHeaderFilled, isFooterFilled, getFooterProps, getStyleFromText, getStyleFromBox } from '@micromag/core/utils';
|
|
18
18
|
import Background from '@micromag/element-background';
|
|
19
19
|
import Button from '@micromag/element-button';
|
|
20
20
|
import Container from '@micromag/element-container';
|
|
@@ -25,7 +25,7 @@ import Layout, { Spacer } from '@micromag/element-layout';
|
|
|
25
25
|
import Text from '@micromag/element-text';
|
|
26
26
|
import Visual from '@micromag/element-visual';
|
|
27
27
|
|
|
28
|
-
var styles = {"layout":"micromag-screen-game-sort-layout","button":"micromag-screen-game-sort-button","layoutLabelOver":"micromag-screen-game-sort-layoutLabelOver","buttonLabel":"micromag-screen-game-sort-buttonLabel","container":"micromag-screen-game-sort-container","background":"micromag-screen-game-sort-background","content":"micromag-screen-game-sort-content","emptyHeading":"micromag-screen-game-sort-emptyHeading","emptyItems":"micromag-screen-game-sort-emptyItems","heading":"micromag-screen-game-sort-heading","header":"micromag-screen-game-sort-header","footer":"micromag-screen-game-sort-footer","items":"micromag-screen-game-sort-items","item":"micromag-screen-game-sort-item","sorted":"micromag-screen-game-sort-sorted","
|
|
28
|
+
var styles = {"layout":"micromag-screen-game-sort-layout","button":"micromag-screen-game-sort-button","layoutLabelOver":"micromag-screen-game-sort-layoutLabelOver","buttonLabel":"micromag-screen-game-sort-buttonLabel","container":"micromag-screen-game-sort-container","background":"micromag-screen-game-sort-background","content":"micromag-screen-game-sort-content","emptyHeading":"micromag-screen-game-sort-emptyHeading","emptyItems":"micromag-screen-game-sort-emptyItems","heading":"micromag-screen-game-sort-heading","header":"micromag-screen-game-sort-header","footer":"micromag-screen-game-sort-footer","items":"micromag-screen-game-sort-items","item":"micromag-screen-game-sort-item","sorted":"micromag-screen-game-sort-sorted","draggable":"micromag-screen-game-sort-draggable","buttonResults":"micromag-screen-game-sort-buttonResults","label":"micromag-screen-game-sort-label","isEmpty":"micromag-screen-game-sort-isEmpty","valid":"micromag-screen-game-sort-valid","invalid":"micromag-screen-game-sort-invalid","resultsVisible":"micromag-screen-game-sort-resultsVisible","layoutLabelTop":"micromag-screen-game-sort-layoutLabelTop","layoutNoLabel":"micromag-screen-game-sort-layoutNoLabel","buttonVisual":"micromag-screen-game-sort-buttonVisual","submitButton":"micromag-screen-game-sort-submitButton","results":"micromag-screen-game-sort-results"};
|
|
29
29
|
|
|
30
30
|
var propTypes = {
|
|
31
31
|
layout: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
@@ -36,13 +36,14 @@ var propTypes = {
|
|
|
36
36
|
itemsLayout: PropTypes.oneOf(['label-bottom', 'label-top', 'no-label', 'label-over']),
|
|
37
37
|
itemsBoxStyle: PropTypes$1.boxStyle,
|
|
38
38
|
itemsTextStyle: PropTypes$1.textStyle,
|
|
39
|
-
|
|
39
|
+
itemsResultsTextStyle: PropTypes$1.textStyle,
|
|
40
40
|
validBoxStyle: PropTypes$1.boxStyle,
|
|
41
41
|
invalidBoxStyle: PropTypes$1.boxStyle,
|
|
42
42
|
submitBoxStyle: PropTypes$1.boxStyle,
|
|
43
43
|
submitTextStyle: PropTypes$1.textStyle,
|
|
44
44
|
submitButtonLabel: PropTypes.string,
|
|
45
|
-
|
|
45
|
+
results: PropTypes$1.textElement,
|
|
46
|
+
resultsBoxStyle: PropTypes$1.boxStyle,
|
|
46
47
|
background: PropTypes$1.backgroundElement,
|
|
47
48
|
header: PropTypes$1.header,
|
|
48
49
|
footer: PropTypes$1.footer,
|
|
@@ -58,13 +59,14 @@ var defaultProps = {
|
|
|
58
59
|
itemsLayout: 'label-bottom',
|
|
59
60
|
itemsBoxStyle: null,
|
|
60
61
|
itemsTextStyle: null,
|
|
61
|
-
|
|
62
|
+
itemsResultsTextStyle: null,
|
|
62
63
|
validBoxStyle: null,
|
|
63
64
|
invalidBoxStyle: null,
|
|
64
65
|
submitBoxStyle: null,
|
|
65
66
|
submitTextStyle: null,
|
|
66
67
|
submitButtonLabel: null,
|
|
67
|
-
|
|
68
|
+
results: null,
|
|
69
|
+
resultsBoxStyle: null,
|
|
68
70
|
background: null,
|
|
69
71
|
header: null,
|
|
70
72
|
footer: null,
|
|
@@ -80,13 +82,14 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
80
82
|
itemsLayout = _ref.itemsLayout,
|
|
81
83
|
itemsBoxStyle = _ref.itemsBoxStyle,
|
|
82
84
|
itemsTextStyle = _ref.itemsTextStyle,
|
|
83
|
-
|
|
85
|
+
itemsResultsTextStyle = _ref.itemsResultsTextStyle,
|
|
84
86
|
validBoxStyle = _ref.validBoxStyle,
|
|
85
87
|
invalidBoxStyle = _ref.invalidBoxStyle,
|
|
86
88
|
submitBoxStyle = _ref.submitBoxStyle,
|
|
87
89
|
submitTextStyle = _ref.submitTextStyle,
|
|
88
90
|
submitButtonLabel = _ref.submitButtonLabel,
|
|
89
|
-
|
|
91
|
+
results = _ref.results,
|
|
92
|
+
resultsBoxStyle = _ref.resultsBoxStyle,
|
|
90
93
|
background = _ref.background,
|
|
91
94
|
header = _ref.header,
|
|
92
95
|
footer = _ref.footer,
|
|
@@ -151,6 +154,7 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
151
154
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
152
155
|
resultsVisible = _useState8[0],
|
|
153
156
|
setResultsVisible = _useState8[1];
|
|
157
|
+
var dragEnabled = isView && active && current && validated === null;
|
|
154
158
|
useEffect(function () {
|
|
155
159
|
if (currentItemsRef.current !== items) {
|
|
156
160
|
var newSortedItems = isView ? shuffle(items || []) : items || [];
|
|
@@ -302,7 +306,7 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
302
306
|
axis: 'y',
|
|
303
307
|
preventDefault: true,
|
|
304
308
|
filterTaps: true,
|
|
305
|
-
enabled:
|
|
309
|
+
enabled: dragEnabled
|
|
306
310
|
});
|
|
307
311
|
var onClickSubmit = useCallback(function () {
|
|
308
312
|
setValidated(items.map(function (it, itemIndex) {
|
|
@@ -325,7 +329,7 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
325
329
|
};
|
|
326
330
|
}, [validated]);
|
|
327
331
|
return /*#__PURE__*/React.createElement("div", {
|
|
328
|
-
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.sorted, initialSorted || !isView), styles.resultsVisible, resultsVisible), styles.isPlaceholder, isPlaceholder)]),
|
|
332
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles.sorted, initialSorted || !isView), styles.draggable, dragEnabled), styles.resultsVisible, resultsVisible), styles.isPlaceholder, isPlaceholder)]),
|
|
329
333
|
"data-screen-ready": true
|
|
330
334
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
331
335
|
width: width,
|
|
@@ -391,7 +395,7 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
391
395
|
_ref7$boxStyle = _ref7.boxStyle,
|
|
392
396
|
boxStyle = _ref7$boxStyle === void 0 ? null : _ref7$boxStyle,
|
|
393
397
|
_ref7$results = _ref7.results,
|
|
394
|
-
|
|
398
|
+
itemResults = _ref7$results === void 0 ? null : _ref7$results;
|
|
395
399
|
var finalLabel = isString(itemLabel) ? {
|
|
396
400
|
body: itemLabel
|
|
397
401
|
} : itemLabel || {};
|
|
@@ -411,7 +415,7 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
411
415
|
transform: y.to(function (yValue) {
|
|
412
416
|
return "translateY(".concat(yValue, ")");
|
|
413
417
|
})
|
|
414
|
-
},
|
|
418
|
+
}, getStyleFromText(itemsTextStyle)), getStyleFromText(labelTextStyle))
|
|
415
419
|
}, bind(itemIndex)), /*#__PURE__*/React.createElement(animated.div, {
|
|
416
420
|
className: classNames([styles.button, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.layoutLabelBottom, itemsLayout === 'label-bottom'), styles.layoutLabelTop, itemsLayout === 'label-top'), styles.layoutNoLabel, itemsLayout === 'no-label'), styles.layoutLabelOver, itemsLayout === 'label-over')]),
|
|
417
421
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
@@ -425,28 +429,25 @@ var ShareScreen = function ShareScreen(_ref) {
|
|
|
425
429
|
imageClassName: styles.thumbnail,
|
|
426
430
|
media: visual,
|
|
427
431
|
width: "auto"
|
|
428
|
-
}) : null, label !== null ||
|
|
432
|
+
}) : null, label !== null || itemResults !== null && resultsVisible ? /*#__PURE__*/React.createElement("div", {
|
|
429
433
|
className: styles.buttonLabel
|
|
430
434
|
}, label !== null ? /*#__PURE__*/React.createElement(Text, Object.assign({}, finalLabel, {
|
|
431
|
-
|
|
435
|
+
textStyle: _objectSpread(_objectSpread({}, itemsTextStyle), labelTextStyle),
|
|
432
436
|
className: styles.label
|
|
433
|
-
})) : null,
|
|
434
|
-
className: styles.
|
|
435
|
-
|
|
437
|
+
})) : null, itemResults !== null && resultsVisible ? /*#__PURE__*/React.createElement(Text, Object.assign({}, itemResults, {
|
|
438
|
+
className: styles.buttonResults,
|
|
439
|
+
textStyle: _objectSpread(_objectSpread({}, itemsResultsTextStyle), itemResults.textStyle)
|
|
436
440
|
})) : null) : null));
|
|
437
|
-
})), /*#__PURE__*/React.createElement(
|
|
441
|
+
})), resultsVisible && results !== null ? /*#__PURE__*/React.createElement("div", {
|
|
442
|
+
className: styles.results,
|
|
443
|
+
style: _objectSpread({}, getStyleFromBox(resultsBoxStyle))
|
|
444
|
+
}, /*#__PURE__*/React.createElement(Text, results)) : /*#__PURE__*/React.createElement(Button, {
|
|
438
445
|
className: styles.submitButton,
|
|
439
446
|
disabled: validated !== null,
|
|
440
447
|
type: "button",
|
|
441
448
|
onClick: onClickSubmit,
|
|
442
449
|
style: _objectSpread(_objectSpread({}, getStyleFromBox(submitBoxStyle)), getStyleFromText(submitTextStyle))
|
|
443
|
-
},
|
|
444
|
-
id: "CTculh",
|
|
445
|
-
defaultMessage: [{
|
|
446
|
-
"type": 0,
|
|
447
|
-
"value": "Validated"
|
|
448
|
-
}]
|
|
449
|
-
}) : submitButtonLabel || intl.formatMessage({
|
|
450
|
+
}, submitButtonLabel || intl.formatMessage({
|
|
450
451
|
id: "IbZVf0",
|
|
451
452
|
defaultMessage: [{
|
|
452
453
|
"type": 0,
|
|
@@ -627,16 +628,6 @@ var definition = {
|
|
|
627
628
|
"value": "Label"
|
|
628
629
|
}]
|
|
629
630
|
})
|
|
630
|
-
}, {
|
|
631
|
-
name: 'validatedButtonLabel',
|
|
632
|
-
type: 'text',
|
|
633
|
-
label: defineMessage({
|
|
634
|
-
id: "wROB6F",
|
|
635
|
-
defaultMessage: [{
|
|
636
|
-
"type": 0,
|
|
637
|
-
"value": "Validated label"
|
|
638
|
-
}]
|
|
639
|
-
})
|
|
640
631
|
}, {
|
|
641
632
|
name: 'submitBoxStyle',
|
|
642
633
|
type: 'box-style-form',
|
|
@@ -658,6 +649,41 @@ var definition = {
|
|
|
658
649
|
}]
|
|
659
650
|
})
|
|
660
651
|
}]
|
|
652
|
+
}, {
|
|
653
|
+
label: defineMessage({
|
|
654
|
+
id: "jINZkT",
|
|
655
|
+
defaultMessage: [{
|
|
656
|
+
"type": 0,
|
|
657
|
+
"value": "Results"
|
|
658
|
+
}]
|
|
659
|
+
}),
|
|
660
|
+
type: 'fields',
|
|
661
|
+
isList: true,
|
|
662
|
+
isSection: true,
|
|
663
|
+
fields: [{
|
|
664
|
+
name: 'results',
|
|
665
|
+
type: 'text-element',
|
|
666
|
+
theme: {
|
|
667
|
+
textStyle: 'text'
|
|
668
|
+
},
|
|
669
|
+
label: defineMessage({
|
|
670
|
+
id: "ZMS1Wv",
|
|
671
|
+
defaultMessage: [{
|
|
672
|
+
"type": 0,
|
|
673
|
+
"value": "Text"
|
|
674
|
+
}]
|
|
675
|
+
})
|
|
676
|
+
}, {
|
|
677
|
+
name: 'resultsBoxStyle',
|
|
678
|
+
type: 'box-style-form',
|
|
679
|
+
label: defineMessage({
|
|
680
|
+
id: "p1pghO",
|
|
681
|
+
defaultMessage: [{
|
|
682
|
+
"type": 0,
|
|
683
|
+
"value": "Box style"
|
|
684
|
+
}]
|
|
685
|
+
})
|
|
686
|
+
}]
|
|
661
687
|
}, {
|
|
662
688
|
name: 'background',
|
|
663
689
|
type: 'background',
|
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.720",
|
|
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": "ed934ee1ce23cfdee83089f1cb4fffcb777381f0"
|
|
91
91
|
}
|