@micromag/screen-ranking 0.4.49 → 0.4.51

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.
Files changed (2) hide show
  1. package/es/index.js +116 -101
  2. 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 React, { useState, useCallback } from 'react';
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__*/React.createElement(ScreenElement, {
89
+ var titleElement = /*#__PURE__*/jsx(ScreenElement, {
89
90
  placeholder: "Title",
90
- emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
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
- }, hasTitle ? /*#__PURE__*/React.createElement(Heading, Object.assign({
100
- className: styles.title
101
- }, title)) : null);
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__*/React.createElement("div", {
117
- className: styles.itemTitle
118
- }, /*#__PURE__*/React.createElement(ScreenElement, {
119
- placeholder: "title",
120
- emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
121
- id: "bmO4Ss",
122
- defaultMessage: [{
123
- "type": 0,
124
- "value": "Entry Title"
125
- }]
126
- }),
127
- emptyClassName: styles.empty,
128
- isEmpty: !hasItemTitle
129
- }, hasItemTitle ? /*#__PURE__*/React.createElement(Heading, Object.assign({}, itemTitle, {
130
- textStyle: _objectSpread(_objectSpread({}, itemTitleStyle || null), titleTextStyle)
131
- })) : null));
132
- var descriptionElement = /*#__PURE__*/React.createElement("div", {
133
- className: styles.description
134
- }, /*#__PURE__*/React.createElement(ScreenElement, {
135
- placeholder: "text",
136
- emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
137
- id: "507VAi",
138
- defaultMessage: [{
139
- "type": 0,
140
- "value": "Description"
141
- }]
142
- }),
143
- emptyClassName: styles.empty,
144
- isEmpty: !hasDescription
145
- }, hasDescription ? /*#__PURE__*/React.createElement(Text, Object.assign({}, description, {
146
- textStyle: _objectSpread(_objectSpread({}, itemDescriptionStyle || null), descriptionTextStyle)
147
- })) : null));
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__*/React.createElement("div", {
155
+ return /*#__PURE__*/jsxs("div", {
150
156
  className: styles.item,
151
- key: "item-".concat(itemI)
152
- }, /*#__PURE__*/React.createElement("div", {
153
- className: styles.rank
154
- }, isPlaceholder ? rankText : /*#__PURE__*/React.createElement(Text, {
155
- className: styles.rankText,
156
- body: rankText,
157
- textStyle: numbersStyle
158
- })), /*#__PURE__*/React.createElement("div", {
159
- className: styles.label
160
- }, itemTitleElement, descriptionElement));
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__*/React.createElement("div", {
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
- }, /*#__PURE__*/React.createElement(Container, {
204
- width: width,
205
- height: height,
206
- className: styles.content
207
- }, /*#__PURE__*/React.createElement(Scroll, {
208
- className: styles.scroll,
209
- verticalAlign: "middle",
210
- disabled: scrollingDisabled,
211
- onScrolledTrigger: onScrolledTrigger,
212
- onScrolledBottom: onScrolledBottom,
213
- onScrolledNotBottom: onScrolledNotBottom,
214
- withShadow: true
215
- }, !isPlaceholder && hasHeader ? /*#__PURE__*/React.createElement("div", {
216
- style: {
217
- paddingTop: spacing / 2 + viewerTopHeight,
218
- paddingLeft: spacing,
219
- paddingRight: spacing
220
- }
221
- }, /*#__PURE__*/React.createElement(Header, header)) : null, /*#__PURE__*/React.createElement(Layout, {
222
- className: styles.layout,
223
- style: !isPlaceholder ? {
224
- padding: spacing,
225
- paddingTop: !isPlaceholder && hasHeader ? spacing : (!isPreview ? viewerTopHeight : 0) + spacing,
226
- paddingBottom: (current && !isPreview ? viewerBottomHeight : 0) + (foterHeight || spacing)
227
- } : null
228
- }, titleElement, /*#__PURE__*/React.createElement("div", {
229
- className: styles.elementsContainer
230
- }, elements))), !isPlaceholder && hasFooter ? /*#__PURE__*/React.createElement("div", {
231
- ref: footerRef,
232
- className: classNames([styles.callToAction, _defineProperty({}, styles.disabled, !scrolledBottom)]),
233
- style: {
234
- transform: current && !isPreview ? "translate(0, -".concat(viewerBottomHeight, "px)") : null,
235
- paddingLeft: Math.max(spacing / 2, viewerBottomSidesWidth),
236
- paddingRight: Math.max(spacing / 2, viewerBottomSidesWidth),
237
- paddingTop: spacing / 2,
238
- paddingBottom: spacing / 2
239
- }
240
- }, /*#__PURE__*/React.createElement(Footer, footerProps)) : null), !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
241
- background: background,
242
- width: width,
243
- height: height,
244
- resolution: resolution,
245
- playing: backgroundPlaying,
246
- muted: muted,
247
- shouldLoad: mediaShouldLoad,
248
- mediaRef: mediaRef,
249
- withoutVideo: isPreview,
250
- className: styles.background
251
- }) : null);
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.49",
3
+ "version": "0.4.51",
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.49",
65
- "@micromag/data": "^0.4.49",
66
- "@micromag/element-background": "^0.4.49",
67
- "@micromag/element-container": "^0.4.49",
68
- "@micromag/element-footer": "^0.4.49",
69
- "@micromag/element-header": "^0.4.49",
70
- "@micromag/element-heading": "^0.4.49",
71
- "@micromag/element-layout": "^0.4.49",
72
- "@micromag/element-scroll": "^0.4.49",
73
- "@micromag/element-text": "^0.4.49",
74
- "@micromag/transforms": "^0.4.49",
64
+ "@micromag/core": "^0.4.51",
65
+ "@micromag/data": "^0.4.51",
66
+ "@micromag/element-background": "^0.4.51",
67
+ "@micromag/element-container": "^0.4.51",
68
+ "@micromag/element-footer": "^0.4.51",
69
+ "@micromag/element-header": "^0.4.51",
70
+ "@micromag/element-heading": "^0.4.51",
71
+ "@micromag/element-layout": "^0.4.51",
72
+ "@micromag/element-scroll": "^0.4.51",
73
+ "@micromag/element-text": "^0.4.51",
74
+ "@micromag/transforms": "^0.4.51",
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": "0a225ff29387217cccb0fcc5a731e23c74bd202e",
84
+ "gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439",
85
85
  "types": "es/index.d.ts"
86
86
  }