@micromag/screen-ranking 0.4.48 → 0.4.50
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 +116 -101
- package/package.json +13 -13
package/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
4
4
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
5
5
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import
|
|
7
|
+
import { useState, useCallback } from 'react';
|
|
8
8
|
import { ScreenElement } from '@micromag/core/components';
|
|
9
9
|
import { useScreenSize, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useScreenRenderContext } from '@micromag/core/contexts';
|
|
10
10
|
import { useTrackScreenEvent, useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -17,6 +17,7 @@ import Heading from '@micromag/element-heading';
|
|
|
17
17
|
import Layout from '@micromag/element-layout';
|
|
18
18
|
import Scroll from '@micromag/element-scroll';
|
|
19
19
|
import Text from '@micromag/element-text';
|
|
20
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
20
21
|
|
|
21
22
|
var styles = {"container":"micromag-screen-ranking-container","background":"micromag-screen-ranking-background","content":"micromag-screen-ranking-content","empty":"micromag-screen-ranking-empty","emptyTitle":"micromag-screen-ranking-emptyTitle","item":"micromag-screen-ranking-item","rankText":"micromag-screen-ranking-rankText","itemTitle":"micromag-screen-ranking-itemTitle","description":"micromag-screen-ranking-description","callToAction":"micromag-screen-ranking-callToAction","disabled":"micromag-screen-ranking-disabled","sideLayout":"micromag-screen-ranking-sideLayout","elementsContainer":"micromag-screen-ranking-elementsContainer","rank":"micromag-screen-ranking-rank","label":"micromag-screen-ranking-label","isPlaceholder":"micromag-screen-ranking-isPlaceholder","scroll":"micromag-screen-ranking-scroll"};
|
|
22
23
|
|
|
@@ -85,9 +86,9 @@ function RankingScreen(_ref) {
|
|
|
85
86
|
var backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
|
|
86
87
|
var mediaShouldLoad = current || preload;
|
|
87
88
|
var hasTitle = isTextFilled(title);
|
|
88
|
-
var titleElement = /*#__PURE__*/
|
|
89
|
+
var titleElement = /*#__PURE__*/jsx(ScreenElement, {
|
|
89
90
|
placeholder: "Title",
|
|
90
|
-
emptyLabel: /*#__PURE__*/
|
|
91
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
91
92
|
id: "BSTWf8",
|
|
92
93
|
defaultMessage: [{
|
|
93
94
|
"type": 0,
|
|
@@ -95,10 +96,11 @@ function RankingScreen(_ref) {
|
|
|
95
96
|
}]
|
|
96
97
|
}),
|
|
97
98
|
emptyClassName: classNames([styles.empty, styles.emptyTitle]),
|
|
98
|
-
isEmpty: !hasTitle
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
isEmpty: !hasTitle,
|
|
100
|
+
children: hasTitle ? /*#__PURE__*/jsx(Heading, _objectSpread({
|
|
101
|
+
className: styles.title
|
|
102
|
+
}, title)) : null
|
|
103
|
+
});
|
|
102
104
|
var elements = (finalItems || []).map(function (item, itemI) {
|
|
103
105
|
var _ref2 = item || {},
|
|
104
106
|
_ref2$title = _ref2.title,
|
|
@@ -113,51 +115,57 @@ function RankingScreen(_ref) {
|
|
|
113
115
|
var _ref4 = description || {},
|
|
114
116
|
_ref4$textStyle = _ref4.textStyle,
|
|
115
117
|
descriptionTextStyle = _ref4$textStyle === void 0 ? null : _ref4$textStyle;
|
|
116
|
-
var itemTitleElement = /*#__PURE__*/
|
|
117
|
-
className: styles.itemTitle
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
118
|
+
var itemTitleElement = /*#__PURE__*/jsx("div", {
|
|
119
|
+
className: styles.itemTitle,
|
|
120
|
+
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
121
|
+
placeholder: "title",
|
|
122
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
123
|
+
id: "bmO4Ss",
|
|
124
|
+
defaultMessage: [{
|
|
125
|
+
"type": 0,
|
|
126
|
+
"value": "Entry Title"
|
|
127
|
+
}]
|
|
128
|
+
}),
|
|
129
|
+
emptyClassName: styles.empty,
|
|
130
|
+
isEmpty: !hasItemTitle,
|
|
131
|
+
children: hasItemTitle ? /*#__PURE__*/jsx(Heading, _objectSpread(_objectSpread({}, itemTitle), {}, {
|
|
132
|
+
textStyle: _objectSpread(_objectSpread({}, itemTitleStyle || null), titleTextStyle)
|
|
133
|
+
})) : null
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
var descriptionElement = /*#__PURE__*/jsx("div", {
|
|
137
|
+
className: styles.description,
|
|
138
|
+
children: /*#__PURE__*/jsx(ScreenElement, {
|
|
139
|
+
placeholder: "text",
|
|
140
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
141
|
+
id: "507VAi",
|
|
142
|
+
defaultMessage: [{
|
|
143
|
+
"type": 0,
|
|
144
|
+
"value": "Description"
|
|
145
|
+
}]
|
|
146
|
+
}),
|
|
147
|
+
emptyClassName: styles.empty,
|
|
148
|
+
isEmpty: !hasDescription,
|
|
149
|
+
children: hasDescription ? /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, description), {}, {
|
|
150
|
+
textStyle: _objectSpread(_objectSpread({}, itemDescriptionStyle || null), descriptionTextStyle)
|
|
151
|
+
})) : null
|
|
152
|
+
})
|
|
153
|
+
});
|
|
148
154
|
var rankText = "".concat(ascending ? itemI + 1 : itemsCount - itemI);
|
|
149
|
-
return /*#__PURE__*/
|
|
155
|
+
return /*#__PURE__*/jsxs("div", {
|
|
150
156
|
className: styles.item,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
158
|
+
className: styles.rank,
|
|
159
|
+
children: isPlaceholder ? rankText : /*#__PURE__*/jsx(Text, {
|
|
160
|
+
className: styles.rankText,
|
|
161
|
+
body: rankText,
|
|
162
|
+
textStyle: numbersStyle
|
|
163
|
+
})
|
|
164
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
165
|
+
className: styles.label,
|
|
166
|
+
children: [itemTitleElement, descriptionElement]
|
|
167
|
+
})]
|
|
168
|
+
}, "item-".concat(itemI));
|
|
161
169
|
});
|
|
162
170
|
|
|
163
171
|
// Call to Action
|
|
@@ -197,58 +205,65 @@ function RankingScreen(_ref) {
|
|
|
197
205
|
});
|
|
198
206
|
}
|
|
199
207
|
}, [trackScreenEvent]);
|
|
200
|
-
return /*#__PURE__*/
|
|
208
|
+
return /*#__PURE__*/jsxs("div", {
|
|
201
209
|
className: classNames([styles.container, className, _defineProperty(_defineProperty({}, styles["".concat(layout, "Layout")], layout !== null), styles.isPlaceholder, isPlaceholder)]),
|
|
202
|
-
"data-screen-ready": true
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
210
|
+
"data-screen-ready": true,
|
|
211
|
+
children: [/*#__PURE__*/jsxs(Container, {
|
|
212
|
+
width: width,
|
|
213
|
+
height: height,
|
|
214
|
+
className: styles.content,
|
|
215
|
+
children: [/*#__PURE__*/jsxs(Scroll, {
|
|
216
|
+
className: styles.scroll,
|
|
217
|
+
verticalAlign: "middle",
|
|
218
|
+
disabled: scrollingDisabled,
|
|
219
|
+
onScrolledTrigger: onScrolledTrigger,
|
|
220
|
+
onScrolledBottom: onScrolledBottom,
|
|
221
|
+
onScrolledNotBottom: onScrolledNotBottom,
|
|
222
|
+
withShadow: true,
|
|
223
|
+
children: [!isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
|
|
224
|
+
style: {
|
|
225
|
+
paddingTop: spacing / 2 + viewerTopHeight,
|
|
226
|
+
paddingLeft: spacing,
|
|
227
|
+
paddingRight: spacing
|
|
228
|
+
},
|
|
229
|
+
children: /*#__PURE__*/jsx(Header, _objectSpread({}, header))
|
|
230
|
+
}) : null, /*#__PURE__*/jsxs(Layout, {
|
|
231
|
+
className: styles.layout,
|
|
232
|
+
style: !isPlaceholder ? {
|
|
233
|
+
padding: spacing,
|
|
234
|
+
paddingTop: !isPlaceholder && hasHeader ? spacing : (!isPreview ? viewerTopHeight : 0) + spacing,
|
|
235
|
+
paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (foterHeight || spacing)
|
|
236
|
+
} : null,
|
|
237
|
+
children: [titleElement, /*#__PURE__*/jsx("div", {
|
|
238
|
+
className: styles.elementsContainer,
|
|
239
|
+
children: elements
|
|
240
|
+
})]
|
|
241
|
+
})]
|
|
242
|
+
}), !isPlaceholder && hasFooter ? /*#__PURE__*/jsx("div", {
|
|
243
|
+
ref: footerRef,
|
|
244
|
+
className: classNames([styles.callToAction, _defineProperty({}, styles.disabled, !scrolledBottom)]),
|
|
245
|
+
style: {
|
|
246
|
+
transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
|
|
247
|
+
paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
248
|
+
paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
|
|
249
|
+
paddingTop: spacing / 2,
|
|
250
|
+
paddingBottom: spacing / 2
|
|
251
|
+
},
|
|
252
|
+
children: /*#__PURE__*/jsx(Footer, _objectSpread({}, footerProps))
|
|
253
|
+
}) : null]
|
|
254
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
255
|
+
background: background,
|
|
256
|
+
width: width,
|
|
257
|
+
height: height,
|
|
258
|
+
resolution: resolution,
|
|
259
|
+
playing: backgroundPlaying,
|
|
260
|
+
muted: muted,
|
|
261
|
+
shouldLoad: mediaShouldLoad,
|
|
262
|
+
mediaRef: mediaRef,
|
|
263
|
+
withoutVideo: isPreview,
|
|
264
|
+
className: styles.background
|
|
265
|
+
}) : null]
|
|
266
|
+
});
|
|
252
267
|
}
|
|
253
268
|
|
|
254
269
|
// import * as transforms from './transforms/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-ranking",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.28.6",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
65
|
-
"@micromag/data": "^0.4.
|
|
66
|
-
"@micromag/element-background": "^0.4.
|
|
67
|
-
"@micromag/element-container": "^0.4.
|
|
68
|
-
"@micromag/element-footer": "^0.4.
|
|
69
|
-
"@micromag/element-header": "^0.4.
|
|
70
|
-
"@micromag/element-heading": "^0.4.
|
|
71
|
-
"@micromag/element-layout": "^0.4.
|
|
72
|
-
"@micromag/element-scroll": "^0.4.
|
|
73
|
-
"@micromag/element-text": "^0.4.
|
|
74
|
-
"@micromag/transforms": "^0.4.
|
|
64
|
+
"@micromag/core": "^0.4.50",
|
|
65
|
+
"@micromag/data": "^0.4.50",
|
|
66
|
+
"@micromag/element-background": "^0.4.50",
|
|
67
|
+
"@micromag/element-container": "^0.4.50",
|
|
68
|
+
"@micromag/element-footer": "^0.4.50",
|
|
69
|
+
"@micromag/element-header": "^0.4.50",
|
|
70
|
+
"@micromag/element-heading": "^0.4.50",
|
|
71
|
+
"@micromag/element-layout": "^0.4.50",
|
|
72
|
+
"@micromag/element-scroll": "^0.4.50",
|
|
73
|
+
"@micromag/element-text": "^0.4.50",
|
|
74
|
+
"@micromag/transforms": "^0.4.50",
|
|
75
75
|
"classnames": "^2.2.6",
|
|
76
76
|
"lodash": "^4.17.23",
|
|
77
77
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "940d5ca98f8f448b79eaa3e2fa685c3ee95185b8",
|
|
85
85
|
"types": "es/index.d.ts"
|
|
86
86
|
}
|