@micromag/screen-keypad 0.3.256

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 ADDED
@@ -0,0 +1,748 @@
1
+ import { FormattedMessage, defineMessage } from 'react-intl';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
5
+ import { animated } from '@react-spring/web';
6
+ import camelCase from 'camelcase';
7
+ import classNames from 'classnames';
8
+ import PropTypes from 'prop-types';
9
+ import React, { useMemo, useState, useCallback, useEffect } from 'react';
10
+ import { PropTypes as PropTypes$1 } from '@micromag/core';
11
+ import { PlaceholderImage, PlaceholderText, ScreenElement, PlaceholderButton } from '@micromag/core/components';
12
+ import { usePlaybackContext, usePlaybackMediaRef, useScreenSize, useScreenRenderContext, useScreenState } from '@micromag/core/contexts';
13
+ import { useTrackScreenEvent, useDragProgress } from '@micromag/core/hooks';
14
+ import { getStyleFromBox, getStyleFromText, getStyleFromColor } from '@micromag/core/utils';
15
+ import Background from '@micromag/element-background';
16
+ import Button from '@micromag/element-button';
17
+ import Container from '@micromag/element-container';
18
+ import Heading from '@micromag/element-heading';
19
+ import Keypad$1 from '@micromag/element-keypad';
20
+ import Layout from '@micromag/element-layout';
21
+ import Scroll from '@micromag/element-scroll';
22
+ import Text from '@micromag/element-text';
23
+ import Visual from '@micromag/element-visual';
24
+
25
+ var styles = {"popupButton":"micromag-screen-keypad-popupButton","background":"micromag-screen-keypad-background","layoutLabelOver":"micromag-screen-keypad-layoutLabelOver","buttonLabel":"micromag-screen-keypad-buttonLabel","emptyButtonLabel":"micromag-screen-keypad-emptyButtonLabel","popupBackdrop":"micromag-screen-keypad-popupBackdrop","withSquareItems":"micromag-screen-keypad-withSquareItems","button":"micromag-screen-keypad-button","thumbnail":"micromag-screen-keypad-thumbnail","layoutNoLabel":"micromag-screen-keypad-layoutNoLabel","container":"micromag-screen-keypad-container","disabled":"micromag-screen-keypad-disabled","hidden":"micromag-screen-keypad-hidden","placeholder":"micromag-screen-keypad-placeholder","content":"micromag-screen-keypad-content","emptyText":"micromag-screen-keypad-emptyText","emptyTitle":"micromag-screen-keypad-emptyTitle","isPlaceholder":"micromag-screen-keypad-isPlaceholder","layout":"micromag-screen-keypad-layout","inner":"micromag-screen-keypad-inner","grid":"micromag-screen-keypad-grid","item":"micromag-screen-keypad-item","placeholderItem":"micromag-screen-keypad-placeholderItem","isEmpty":"micromag-screen-keypad-isEmpty","isPopupEmpty":"micromag-screen-keypad-isPopupEmpty","buttonPlaceholder":"micromag-screen-keypad-buttonPlaceholder","imagePlaceholder":"micromag-screen-keypad-imagePlaceholder","buttonVisualPlaceholder":"micromag-screen-keypad-buttonVisualPlaceholder","empty":"micromag-screen-keypad-empty","emptyButtonVisual":"micromag-screen-keypad-emptyButtonVisual","popup":"micromag-screen-keypad-popup","popupInner":"micromag-screen-keypad-popupInner","popupContent":"micromag-screen-keypad-popupContent","popupWrapper":"micromag-screen-keypad-popupWrapper","popupHeading":"micromag-screen-keypad-popupHeading","popupVisual":"micromag-screen-keypad-popupVisual","contentSplit":"micromag-screen-keypad-contentSplit","emptyHeading":"micromag-screen-keypad-emptyHeading","emptyVisual":"micromag-screen-keypad-emptyVisual","emptyContent":"micromag-screen-keypad-emptyContent","contentBottom":"micromag-screen-keypad-contentBottom","layoutLabelTop":"micromag-screen-keypad-layoutLabelTop","buttonVisual":"micromag-screen-keypad-buttonVisual"};
26
+
27
+ var placeholders = [{
28
+ id: '1'
29
+ }, {
30
+ id: '2'
31
+ }, {
32
+ id: '3'
33
+ }, {
34
+ id: '4'
35
+ }, {
36
+ id: '5'
37
+ }, {
38
+ id: '6'
39
+ }, {
40
+ id: '7'
41
+ }, {
42
+ id: '8'
43
+ }, {
44
+ id: '9'
45
+ }];
46
+ var placeholderPopupBoxStyles = {
47
+ padding: {
48
+ left: 30,
49
+ top: 30,
50
+ right: 30,
51
+ bottom: 30
52
+ }
53
+ };
54
+ var stopDragEventsPropagation = {
55
+ onTouchMove: function onTouchMove(e) {
56
+ return e.stopPropagation();
57
+ },
58
+ onTouchStart: function onTouchStart(e) {
59
+ return e.stopPropagation();
60
+ },
61
+ onTouchEnd: function onTouchEnd(e) {
62
+ return e.stopPropagation();
63
+ },
64
+ onPointerMove: function onPointerMove(e) {
65
+ return e.stopPropagation();
66
+ },
67
+ onPointerUp: function onPointerUp(e) {
68
+ return e.stopPropagation();
69
+ },
70
+ onPointerDown: function onPointerDown(e) {
71
+ return e.stopPropagation();
72
+ }
73
+ };
74
+
75
+ var mouseBlocker = _objectSpread(_objectSpread({}, stopDragEventsPropagation), {}, {
76
+ onClick: function onClick(e) {
77
+ return e.stopPropagation();
78
+ },
79
+ style: {
80
+ position: 'fixed',
81
+ zIndex: '1000',
82
+ top: 0,
83
+ right: 0,
84
+ bottom: 0,
85
+ left: 0,
86
+ cursor: 'default'
87
+ }
88
+ });
89
+
90
+ var propTypes = {
91
+ items: PropTypes.arrayOf(PropTypes.shape({
92
+ id: PropTypes.string,
93
+ heading: PropTypes$1.headingElement,
94
+ description: PropTypes$1.textElement,
95
+ visual: PropTypes$1.visualElement,
96
+ boxStyle: PropTypes$1.boxStyle
97
+ })),
98
+ layout: PropTypes.oneOf(['top', 'middle', 'bottom']),
99
+ keypadSettings: PropTypes.shape({
100
+ layout: PropTypes.shape({
101
+ columnAlign: PropTypes.oneOf(['left', 'right', 'middle']),
102
+ columns: PropTypes.number,
103
+ spacing: PropTypes.number,
104
+ withSquareItems: PropTypes.bool
105
+ })
106
+ }),
107
+ buttonStyles: PropTypes.shape({
108
+ layout: PropTypes.string,
109
+ textStyle: PropTypes$1.textStyle,
110
+ boxStyle: PropTypes$1.boxStyle
111
+ }),
112
+ popupStyles: PropTypes.shape({
113
+ layout: PropTypes.oneOf(['content-top', 'content-split', 'content-bottom']),
114
+ textStyle: PropTypes$1.textStyle,
115
+ boxStyle: PropTypes$1.boxStyle
116
+ }),
117
+ background: PropTypes$1.backgroundElement,
118
+ current: PropTypes.bool,
119
+ active: PropTypes.bool,
120
+ className: PropTypes.string
121
+ };
122
+ var defaultProps = {
123
+ items: null,
124
+ layout: null,
125
+ keypadSettings: null,
126
+ buttonStyles: null,
127
+ popupStyles: null,
128
+ background: null,
129
+ current: true,
130
+ active: true,
131
+ className: null
132
+ };
133
+
134
+ var KeypadScreen = function KeypadScreen(_ref) {
135
+ var _ref15;
136
+
137
+ var items = _ref.items,
138
+ layout = _ref.layout,
139
+ keypadSettings = _ref.keypadSettings,
140
+ buttonStyles = _ref.buttonStyles,
141
+ popupStyles = _ref.popupStyles,
142
+ background = _ref.background,
143
+ current = _ref.current,
144
+ active = _ref.active,
145
+ className = _ref.className;
146
+ var trackScreenEvent = useTrackScreenEvent('keypad');
147
+
148
+ var _usePlaybackContext = usePlaybackContext(),
149
+ muted = _usePlaybackContext.muted;
150
+
151
+ var mediaRef = usePlaybackMediaRef(current);
152
+
153
+ var _useScreenSize = useScreenSize(),
154
+ width = _useScreenSize.width,
155
+ height = _useScreenSize.height,
156
+ resolution = _useScreenSize.resolution; // const { topHeight: viewerTopHeight, bottomHeight: viewerBottomHeight } = useViewerContext();
157
+
158
+
159
+ var _useScreenRenderConte = useScreenRenderContext(),
160
+ isView = _useScreenRenderConte.isView,
161
+ isPreview = _useScreenRenderConte.isPreview,
162
+ isPlaceholder = _useScreenRenderConte.isPlaceholder,
163
+ isEdit = _useScreenRenderConte.isEdit;
164
+
165
+ var screenState = useScreenState();
166
+ var backgroundPlaying = current && (isView || isEdit);
167
+ var mediaShouldLoad = !isPlaceholder && (current || active);
168
+ var isInteractivePreview = isEdit && screenState === null;
169
+
170
+ var _ref2 = keypadSettings || {},
171
+ _ref2$layout = _ref2.layout,
172
+ keypadLayout = _ref2$layout === void 0 ? null : _ref2$layout;
173
+
174
+ var _ref3 = keypadLayout || {},
175
+ _ref3$columnAlign = _ref3.columnAlign,
176
+ columnAlign = _ref3$columnAlign === void 0 ? null : _ref3$columnAlign,
177
+ _ref3$columns = _ref3.columns,
178
+ columns = _ref3$columns === void 0 ? null : _ref3$columns,
179
+ _ref3$spacing = _ref3.spacing,
180
+ spacing = _ref3$spacing === void 0 ? null : _ref3$spacing,
181
+ _ref3$withSquareItems = _ref3.withSquareItems,
182
+ withSquareItems = _ref3$withSquareItems === void 0 ? false : _ref3$withSquareItems;
183
+
184
+ var _ref4 = buttonStyles || {},
185
+ _ref4$layout = _ref4.layout,
186
+ buttonLayout = _ref4$layout === void 0 ? null : _ref4$layout,
187
+ _ref4$textStyle = _ref4.textStyle,
188
+ buttonTextStyle = _ref4$textStyle === void 0 ? null : _ref4$textStyle,
189
+ _ref4$boxStyle = _ref4.boxStyle,
190
+ buttonBoxStyle = _ref4$boxStyle === void 0 ? null : _ref4$boxStyle;
191
+
192
+ var _ref5 = popupStyles || {},
193
+ _ref5$layout = _ref5.layout,
194
+ popupLayout = _ref5$layout === void 0 ? null : _ref5$layout,
195
+ _ref5$backdrop = _ref5.backdrop,
196
+ popupBackdrop = _ref5$backdrop === void 0 ? null : _ref5$backdrop,
197
+ _ref5$textStyle = _ref5.textStyle,
198
+ popupTextStyle = _ref5$textStyle === void 0 ? null : _ref5$textStyle,
199
+ _ref5$boxStyle = _ref5.boxStyle,
200
+ popupBoxStyle = _ref5$boxStyle === void 0 ? null : _ref5$boxStyle;
201
+
202
+ var popupLayoutClassName = useMemo(function () {
203
+ return popupLayout !== null ? camelCase(popupLayout) : '';
204
+ }, [popupLayout]);
205
+
206
+ var _useState = useState(false),
207
+ _useState2 = _slicedToArray(_useState, 2),
208
+ showPopup = _useState2[0],
209
+ setShowPopup = _useState2[1];
210
+
211
+ var _useState3 = useState(null),
212
+ _useState4 = _slicedToArray(_useState3, 2),
213
+ popup = _useState4[0],
214
+ setPopup = _useState4[1];
215
+
216
+ var _ref6 = popup || {},
217
+ _ref6$heading = _ref6.heading,
218
+ popupHeading = _ref6$heading === void 0 ? null : _ref6$heading,
219
+ _ref6$content = _ref6.content,
220
+ popupContent = _ref6$content === void 0 ? null : _ref6$content,
221
+ _ref6$largeVisual = _ref6.largeVisual,
222
+ largeVisual = _ref6$largeVisual === void 0 ? null : _ref6$largeVisual;
223
+
224
+ var _ref7 = popupHeading || {},
225
+ _ref7$body = _ref7.body,
226
+ popupHeadingBody = _ref7$body === void 0 ? null : _ref7$body;
227
+
228
+ var _ref8 = popupContent || {},
229
+ _ref8$body = _ref8.body,
230
+ popupContentBody = _ref8$body === void 0 ? null : _ref8$body;
231
+
232
+ var onItemClick = useCallback(function (e, item) {
233
+ e.stopPropagation();
234
+ setPopup(item);
235
+ setShowPopup(1);
236
+ trackScreenEvent('click_item', item);
237
+ }, [setPopup, trackScreenEvent]);
238
+ var onCloseModal = useCallback(function () {
239
+ setShowPopup(0);
240
+ trackScreenEvent('close_modal');
241
+ }, [setShowPopup]);
242
+ var computePopupProgress = useCallback(function (_ref9) {
243
+ var dragActive = _ref9.active,
244
+ _ref9$movement = _slicedToArray(_ref9.movement, 2),
245
+ my = _ref9$movement[1],
246
+ _ref9$velocity = _slicedToArray(_ref9.velocity, 2),
247
+ vy = _ref9$velocity[1];
248
+
249
+ var damper = 0.5;
250
+ var p = Math.max(0, my) / window.innerHeight;
251
+ var progress = p * damper;
252
+ var reachedThreshold = vy > 0.3 || Math.abs(p) > 0.3;
253
+
254
+ if (!dragActive) {
255
+ if (reachedThreshold) {
256
+ onCloseModal();
257
+ }
258
+
259
+ return reachedThreshold ? 0 : 1;
260
+ }
261
+
262
+ return 1 - progress;
263
+ }, [onCloseModal]);
264
+
265
+ var _useDragProgress = useDragProgress({
266
+ disabled: !isView,
267
+ progress: showPopup ? 1 : 0,
268
+ computeProgress: computePopupProgress,
269
+ springParams: {
270
+ config: {
271
+ tension: 300,
272
+ friction: 30
273
+ }
274
+ }
275
+ }),
276
+ bindPopupDrag = _useDragProgress.bind,
277
+ popupSpring = _useDragProgress.progress;
278
+
279
+ var gridItems = useMemo(function () {
280
+ return (items === null || items.length === 0 ? placeholders : items).map(function (item) {
281
+ var _ref14;
282
+
283
+ var _ref10 = item || {},
284
+ _ref10$id = _ref10.id,
285
+ id = _ref10$id === void 0 ? null : _ref10$id,
286
+ _ref10$label = _ref10.label,
287
+ label = _ref10$label === void 0 ? null : _ref10$label,
288
+ _ref10$visual = _ref10.visual,
289
+ visual = _ref10$visual === void 0 ? null : _ref10$visual,
290
+ _ref10$textStyle = _ref10.textStyle,
291
+ textStyle = _ref10$textStyle === void 0 ? null : _ref10$textStyle,
292
+ _ref10$boxStyle = _ref10.boxStyle,
293
+ boxStyle = _ref10$boxStyle === void 0 ? null : _ref10$boxStyle,
294
+ _ref10$heading = _ref10.heading,
295
+ heading = _ref10$heading === void 0 ? null : _ref10$heading,
296
+ _ref10$content = _ref10.content,
297
+ content = _ref10$content === void 0 ? null : _ref10$content,
298
+ _ref10$largeVisual = _ref10.largeVisual,
299
+ popupLargeVisual = _ref10$largeVisual === void 0 ? null : _ref10$largeVisual;
300
+
301
+ var _ref11 = visual || {},
302
+ _ref11$url = _ref11.url,
303
+ visualUrl = _ref11$url === void 0 ? null : _ref11$url;
304
+
305
+ var _ref12 = heading || {},
306
+ _ref12$body = _ref12.body,
307
+ headingBody = _ref12$body === void 0 ? null : _ref12$body;
308
+
309
+ var _ref13 = content || {},
310
+ _ref13$body = _ref13.body,
311
+ contentBody = _ref13$body === void 0 ? null : _ref13$body;
312
+
313
+ var key = label || visualUrl || id;
314
+ var isEmpty = label === null && visual === null;
315
+ var isPopupEmpty = (heading === null || headingBody === '') && (content === null || contentBody === '') && popupLargeVisual === null;
316
+ return /*#__PURE__*/React.createElement("div", {
317
+ key: key,
318
+ className: styles.item
319
+ }, /*#__PURE__*/React.createElement(Button, {
320
+ className: classNames([styles.button, (_ref14 = {}, _defineProperty(_ref14, styles.layoutLabelBottom, buttonLayout === 'label-bottom'), _defineProperty(_ref14, styles.layoutLabelTop, buttonLayout === 'label-top'), _defineProperty(_ref14, styles.layoutNoLabel, buttonLayout === 'no-label'), _defineProperty(_ref14, styles.layoutLabelOver, buttonLayout === 'label-over'), _defineProperty(_ref14, styles.isEmpty, isEmpty), _defineProperty(_ref14, styles.isPopupEmpty, isPopupEmpty), _ref14)]),
321
+ style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getStyleFromBox(buttonBoxStyle)), getStyleFromText(buttonTextStyle)), getStyleFromBox(boxStyle)), getStyleFromText(textStyle)),
322
+ onClick: !isPopupEmpty ? function (e) {
323
+ return onItemClick(e, item);
324
+ } : function (e) {
325
+ return e.preventDefault();
326
+ }
327
+ }, isEmpty && (isInteractivePreview || isPreview) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PlaceholderImage, {
328
+ className: styles.imagePlaceholder
329
+ }), /*#__PURE__*/React.createElement(PlaceholderText, {
330
+ lines: 2
331
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, visual !== null || !isInteractivePreview ? /*#__PURE__*/React.createElement(ScreenElement, {
332
+ emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
333
+ id: "Qanvis",
334
+ defaultMessage: [{
335
+ "type": 0,
336
+ "value": "Visual"
337
+ }]
338
+ }),
339
+ emptyClassName: classNames([styles.empty, styles.buttonVisual, styles.emptyButtonVisual]),
340
+ isEmpty: visual === null
341
+ }, /*#__PURE__*/React.createElement(Visual, {
342
+ className: styles.buttonVisual,
343
+ imageClassName: styles.thumbnail,
344
+ media: visual,
345
+ width: "auto"
346
+ })) : null, label !== null || !isInteractivePreview ? /*#__PURE__*/React.createElement(ScreenElement, {
347
+ placeholder: /*#__PURE__*/React.createElement(PlaceholderButton, null),
348
+ emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
349
+ id: "Zbu5Uk",
350
+ defaultMessage: [{
351
+ "type": 0,
352
+ "value": "Label"
353
+ }]
354
+ }),
355
+ emptyClassName: classNames([styles.empty, styles.emptyButtonLabel]),
356
+ isEmpty: label === null
357
+ }, /*#__PURE__*/React.createElement("div", {
358
+ className: styles.buttonLabel
359
+ }, label)) : null)));
360
+ });
361
+ }, [items, screenState, keypadSettings]);
362
+ useEffect(function () {
363
+ if (screenState === 'popup') {
364
+ setPopup(placeholderPopupBoxStyles); // @note force placeholder
365
+
366
+ setShowPopup(1);
367
+ }
368
+
369
+ if (screenState === 'keypad') {
370
+ setPopup(null);
371
+ setShowPopup(0);
372
+ }
373
+
374
+ if (screenState !== null && screenState.includes('popups')) {
375
+ var index = screenState.split('.').pop();
376
+ var found = items[index];
377
+ setShowPopup(1);
378
+ setPopup(found);
379
+ }
380
+
381
+ if (screenState === null) {
382
+ setShowPopup(0);
383
+ setPopup(null);
384
+ }
385
+ }, [screenState, items]);
386
+ return /*#__PURE__*/React.createElement("div", {
387
+ className: classNames([styles.container, (_ref15 = {}, _defineProperty(_ref15, className, className !== null), _defineProperty(_ref15, styles.isPlaceholder, isPlaceholder), _defineProperty(_ref15, styles.withSquareItems, withSquareItems), _ref15)]),
388
+ "data-screen-ready": true
389
+ }, isEdit && screenState !== null ? /*#__PURE__*/React.createElement("div", mouseBlocker) : null, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
390
+ background: background,
391
+ width: width,
392
+ height: height,
393
+ resolution: resolution,
394
+ playing: backgroundPlaying,
395
+ muted: muted,
396
+ shouldLoad: mediaShouldLoad,
397
+ mediaRef: mediaRef,
398
+ className: styles.background
399
+ }) : null, /*#__PURE__*/React.createElement(Container, {
400
+ width: width,
401
+ height: height,
402
+ className: styles.inner
403
+ }, /*#__PURE__*/React.createElement(Layout, {
404
+ className: styles.layout,
405
+ verticalAlign: layout // style={
406
+ // !isPlaceholder
407
+ // ? {
408
+ // padding: spacing,
409
+ // paddingTop: (!isPreview ? viewerTopHeight : 0) + spacing,
410
+ // paddingBottom:
411
+ // (current && !isPreview ? viewerBottomHeight : 0) + spacing,
412
+ // }
413
+ // : null
414
+ // }
415
+
416
+ }, /*#__PURE__*/React.createElement(Keypad$1, {
417
+ className: classNames([styles.grid, _defineProperty({}, styles.gridPlaceholder, isPlaceholder)]),
418
+ align: columnAlign,
419
+ columns: isPlaceholder ? 3 : columns,
420
+ spacing: isPlaceholder ? 2 : spacing,
421
+ items: gridItems
422
+ })), /*#__PURE__*/React.createElement(animated.div, {
423
+ className: classNames([styles.popupBackdrop]),
424
+ style: _objectSpread(_objectSpread({}, getStyleFromColor(popupBackdrop)), {}, {
425
+ opacity: popupSpring.to(function (p) {
426
+ return p;
427
+ })
428
+ })
429
+ }), /*#__PURE__*/React.createElement(animated.div, Object.assign({
430
+ className: styles.popup,
431
+ style: {
432
+ transform: popupSpring.to(function (p) {
433
+ return "translateY(".concat(100 * (1 - (p < 0.2 ? 0.1 * p + p : p)), "%)");
434
+ }),
435
+ pointerEvents: popupSpring.to(function (p) {
436
+ return p < 0.1 ? 'none' : 'auto';
437
+ })
438
+ }
439
+ }, bindPopupDrag()), /*#__PURE__*/React.createElement(Scroll, null, /*#__PURE__*/React.createElement("button", {
440
+ type: "button",
441
+ className: styles.popupButton,
442
+ onClick: function onClick() {
443
+ if (onCloseModal !== null) {
444
+ onCloseModal();
445
+ }
446
+ }
447
+ }, /*#__PURE__*/React.createElement("div", {
448
+ className: classNames([styles.popupInner, styles[popupLayoutClassName]]),
449
+ style: _objectSpread(_objectSpread(_objectSpread({}, getStyleFromBox(placeholderPopupBoxStyles)), getStyleFromBox(popupBoxStyle)), getStyleFromText(popupTextStyle))
450
+ }, /*#__PURE__*/React.createElement("div", {
451
+ className: styles.popupWrapper
452
+ }, !isInteractivePreview || popupHeading !== null ? /*#__PURE__*/React.createElement(ScreenElement, {
453
+ placeholder: "popupHeading",
454
+ emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
455
+ id: "IE7U/Q",
456
+ defaultMessage: [{
457
+ "type": 0,
458
+ "value": "Heading"
459
+ }]
460
+ }),
461
+ emptyClassName: classNames([styles.empty, styles.emptyHeading]),
462
+ isEmpty: (popupHeading === null || popupHeadingBody === '') && screenState !== 'popup'
463
+ }, /*#__PURE__*/React.createElement(Heading, Object.assign({
464
+ className: styles.popupHeading,
465
+ body: "Lorem ipsum"
466
+ }, popupHeading))) : null, !isInteractivePreview || popupContent !== null ? /*#__PURE__*/React.createElement(ScreenElement, {
467
+ placeholder: "popupContent",
468
+ emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
469
+ id: "JRZoe6",
470
+ defaultMessage: [{
471
+ "type": 0,
472
+ "value": "Content"
473
+ }]
474
+ }),
475
+ emptyClassName: classNames([styles.empty, styles.emptyContent]),
476
+ isEmpty: (popupContent === null || popupContentBody === '') && popupContent === null && screenState !== 'popup'
477
+ }, /*#__PURE__*/React.createElement(Text, Object.assign({
478
+ className: styles.popupContent,
479
+ body: "Lorem ipsum dolor sit amet consectetur adipiscing elit."
480
+ }, popupContent))) : null, !isInteractivePreview || largeVisual !== null ? /*#__PURE__*/React.createElement(ScreenElement, {
481
+ placeholder: "popupVisual",
482
+ emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
483
+ id: "z4Pr+g",
484
+ defaultMessage: [{
485
+ "type": 0,
486
+ "value": "Visual (Image or Video)"
487
+ }]
488
+ }),
489
+ emptyClassName: classNames([styles.empty, styles.emptyVisual]),
490
+ isEmpty: largeVisual === null
491
+ }, /*#__PURE__*/React.createElement(Visual, {
492
+ className: styles.popupVisual,
493
+ media: largeVisual,
494
+ width: "100%"
495
+ })) : null, largeVisual === null && isPreview ? /*#__PURE__*/React.createElement(PlaceholderImage, {
496
+ className: styles.popupVisual
497
+ }) : null)))))));
498
+ };
499
+
500
+ KeypadScreen.propTypes = propTypes;
501
+ KeypadScreen.defaultProps = defaultProps;
502
+ var Keypad = /*#__PURE__*/React.memo(KeypadScreen);
503
+
504
+ var definition = [{
505
+ id: 'keypad',
506
+ type: 'screen',
507
+ group: {
508
+ label: defineMessage({
509
+ id: "cGItoy",
510
+ defaultMessage: [{
511
+ "type": 0,
512
+ "value": "List"
513
+ }]
514
+ }),
515
+ order: 4
516
+ },
517
+ title: defineMessage({
518
+ id: "75nZbY",
519
+ defaultMessage: [{
520
+ "type": 0,
521
+ "value": "Keypad"
522
+ }]
523
+ }),
524
+ layouts: ['top', 'middle', 'bottom'],
525
+ component: Keypad,
526
+ states: [{
527
+ id: 'keypad',
528
+ label: defineMessage({
529
+ id: "Z4f5qh",
530
+ defaultMessage: [{
531
+ "type": 0,
532
+ "value": "Buttons"
533
+ }]
534
+ }),
535
+ fields: [{
536
+ name: 'items',
537
+ type: 'buttons',
538
+ label: defineMessage({
539
+ id: "fbUW2U",
540
+ defaultMessage: [{
541
+ "type": 0,
542
+ "value": "Items"
543
+ }]
544
+ }),
545
+ theme: {
546
+ label: {
547
+ textStyle: 'button'
548
+ }
549
+ },
550
+ isSection: true
551
+ }, {
552
+ name: 'buttonStyles',
553
+ type: 'fields',
554
+ defaultValue: {
555
+ layout: 'label-bottom',
556
+ boxStyle: {
557
+ backgroundColor: {
558
+ alpha: 0.15,
559
+ color: '#000000'
560
+ }
561
+ }
562
+ },
563
+ isList: true,
564
+ fields: [{
565
+ name: 'layout',
566
+ type: 'button-layout',
567
+ isHorizontal: true,
568
+ label: defineMessage({
569
+ id: "OPxJx/",
570
+ defaultMessage: [{
571
+ "type": 0,
572
+ "value": "Layout"
573
+ }]
574
+ })
575
+ }, {
576
+ name: 'textStyle',
577
+ type: 'text-style-form',
578
+ label: defineMessage({
579
+ id: "rzXCu2",
580
+ defaultMessage: [{
581
+ "type": 0,
582
+ "value": "Label style"
583
+ }]
584
+ })
585
+ }, {
586
+ name: 'boxStyle',
587
+ type: 'box-style-form',
588
+ label: defineMessage({
589
+ id: "nno1Pq",
590
+ defaultMessage: [{
591
+ "type": 0,
592
+ "value": "Button style"
593
+ }]
594
+ })
595
+ }]
596
+ }]
597
+ }, {
598
+ id: 'popup',
599
+ label: defineMessage({
600
+ id: "mBYGpP",
601
+ defaultMessage: [{
602
+ "type": 0,
603
+ "value": "Popup"
604
+ }]
605
+ }),
606
+ fields: [{
607
+ name: 'popupStyles',
608
+ type: 'fields',
609
+ defaultValue: {
610
+ layout: 'content-top'
611
+ },
612
+ isList: true,
613
+ fields: [{
614
+ name: 'layout',
615
+ type: 'card-layout',
616
+ // defaultValue: 'content-top',
617
+ label: defineMessage({
618
+ id: "OPxJx/",
619
+ defaultMessage: [{
620
+ "type": 0,
621
+ "value": "Layout"
622
+ }]
623
+ })
624
+ }, {
625
+ name: 'textStyle',
626
+ type: 'text-style-form',
627
+ label: defineMessage({
628
+ id: "OEckOD",
629
+ defaultMessage: [{
630
+ "type": 0,
631
+ "value": "Text style"
632
+ }]
633
+ })
634
+ }, {
635
+ name: 'boxStyle',
636
+ type: 'box-style-form',
637
+ label: defineMessage({
638
+ id: "heeSlL",
639
+ defaultMessage: [{
640
+ "type": 0,
641
+ "value": "Frame and backgound styles"
642
+ }]
643
+ })
644
+ }, {
645
+ name: 'backdrop',
646
+ type: 'color',
647
+ label: defineMessage({
648
+ id: "uv3PH4",
649
+ defaultMessage: [{
650
+ "type": 0,
651
+ "value": "Backdrop color"
652
+ }]
653
+ })
654
+ }]
655
+ }]
656
+ }, {
657
+ id: 'popups',
658
+ label: defineMessage({
659
+ id: "Hyqnww",
660
+ defaultMessage: [{
661
+ "type": 0,
662
+ "value": "Popups"
663
+ }]
664
+ }),
665
+ defaultValue: [],
666
+ repeatable: true,
667
+ fieldName: 'items',
668
+ fields: [{
669
+ name: 'heading',
670
+ type: 'heading-element',
671
+ label: defineMessage({
672
+ id: "6iR9Mt",
673
+ defaultMessage: [{
674
+ "type": 0,
675
+ "value": "Heading"
676
+ }]
677
+ })
678
+ }, {
679
+ name: 'content',
680
+ type: 'text-element',
681
+ label: defineMessage({
682
+ id: "uoF5Pv",
683
+ defaultMessage: [{
684
+ "type": 0,
685
+ "value": "Content"
686
+ }]
687
+ })
688
+ }, {
689
+ name: 'largeVisual',
690
+ type: 'visual',
691
+ label: defineMessage({
692
+ id: "HwqzVR",
693
+ defaultMessage: [{
694
+ "type": 0,
695
+ "value": "Visual"
696
+ }]
697
+ })
698
+ }]
699
+ }],
700
+ fields: [{
701
+ name: 'layout',
702
+ type: 'screen-layout',
703
+ defaultValue: 'middle',
704
+ label: defineMessage({
705
+ id: "4iBXj2",
706
+ defaultMessage: [{
707
+ "type": 0,
708
+ "value": "Layout"
709
+ }]
710
+ })
711
+ }, {
712
+ name: 'keypadSettings',
713
+ type: 'fields',
714
+ isList: true,
715
+ withoutLabel: true,
716
+ defaultValue: {
717
+ layout: {
718
+ columnAlign: 'middle',
719
+ columns: 3,
720
+ spacing: 2,
721
+ withSquareItems: false
722
+ }
723
+ },
724
+ label: defineMessage({
725
+ id: "FjuRaw",
726
+ defaultMessage: [{
727
+ "type": 0,
728
+ "value": "Keypad settings"
729
+ }]
730
+ }),
731
+ fields: [{
732
+ name: 'layout',
733
+ type: 'keypad-layout-form'
734
+ }]
735
+ }, {
736
+ name: 'background',
737
+ type: 'background',
738
+ label: defineMessage({
739
+ id: "+MPZRu",
740
+ defaultMessage: [{
741
+ "type": 0,
742
+ "value": "Background"
743
+ }]
744
+ })
745
+ }]
746
+ }];
747
+
748
+ export { Keypad, definition as default };