@micromag/screen-map 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.
- package/es/index.js +162 -149
- package/package.json +14 -14
package/es/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
3
3
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import
|
|
6
|
+
import { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
|
7
7
|
import { PlaceholderMap, Button, ScreenElement } from '@micromag/core/components';
|
|
8
8
|
import { useGoogleKeys, useScreenSize, usePlaybackContext, usePlaybackMediaRef, useScreenRenderContext, useScreenState, useViewerInteraction } from '@micromag/core/contexts';
|
|
9
9
|
import { useTrackScreenEvent, useDimensionObserver } from '@micromag/core/hooks';
|
|
@@ -16,6 +16,7 @@ import ImageElement from '@micromag/element-image';
|
|
|
16
16
|
import Map from '@micromag/element-map';
|
|
17
17
|
import Scroll from '@micromag/element-scroll';
|
|
18
18
|
import Text from '@micromag/element-text';
|
|
19
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
19
20
|
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
|
|
20
21
|
import _extends from '@babel/runtime/helpers/extends';
|
|
21
22
|
|
|
@@ -323,159 +324,171 @@ function MapScreen(_ref) {
|
|
|
323
324
|
var hasTitle = isTextFilled(title);
|
|
324
325
|
var hasDescription = isTextFilled(description);
|
|
325
326
|
var hasButton = isTextFilled(button);
|
|
326
|
-
return /*#__PURE__*/
|
|
327
|
+
return /*#__PURE__*/jsxs("div", {
|
|
327
328
|
className: classNames([styles.container, className, _defineProperty(_defineProperty(_defineProperty({}, styles["".concat(layout, "Layout")], layout !== null), styles.opened, opened || isPreview && screenState !== 'intro'), styles.hasSelectedMarker, hasSelectedMarker)]),
|
|
328
|
-
"data-screen-ready": finalReady
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
329
|
+
"data-screen-ready": finalReady,
|
|
330
|
+
children: [/*#__PURE__*/jsx(Container, {
|
|
331
|
+
width: width,
|
|
332
|
+
height: height,
|
|
333
|
+
className: styles.content,
|
|
334
|
+
children: isPlaceholder ? /*#__PURE__*/jsx(PlaceholderMap, {
|
|
335
|
+
className: styles.placeholder,
|
|
336
|
+
withImages: withMarkerImages
|
|
337
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
338
|
+
children: [isPreview ? /*#__PURE__*/jsx(ImageElement, {
|
|
339
|
+
media: staticUrl !== null ? {
|
|
340
|
+
url: staticUrl,
|
|
341
|
+
metadata: {
|
|
342
|
+
width: Math.min(640, width),
|
|
343
|
+
height: Math.min(640, height)
|
|
344
|
+
}
|
|
345
|
+
} : null,
|
|
346
|
+
width: width,
|
|
347
|
+
height: height,
|
|
348
|
+
resolution: resolution,
|
|
349
|
+
objectFit: {
|
|
350
|
+
fit: 'cover'
|
|
351
|
+
}
|
|
352
|
+
}) : /*#__PURE__*/jsx(Map, {
|
|
353
|
+
center: center,
|
|
354
|
+
zoom: zoom,
|
|
355
|
+
draggable: draggable,
|
|
356
|
+
markers: finalMarkers,
|
|
357
|
+
fitBounds: fitBounds,
|
|
358
|
+
onClickMarker: onClickMarker,
|
|
359
|
+
onReady: onMapReady,
|
|
360
|
+
onDragEnd: onMapDragEnd
|
|
361
|
+
}, "map"), /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
362
|
+
className: styles.markerOverlayContainer
|
|
363
|
+
}, stopDragEventsPropagation), {}, {
|
|
364
|
+
children: /*#__PURE__*/jsx("div", {
|
|
365
|
+
className: styles.markerOverlayScrollable,
|
|
366
|
+
children: /*#__PURE__*/jsxs(Scroll, {
|
|
367
|
+
fullscreen: true,
|
|
368
|
+
disabled: scrollingDisabled,
|
|
369
|
+
onScrolledBottom: onScrolledBottom,
|
|
370
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
371
|
+
className: styles.markerOverlaySafe,
|
|
372
|
+
onClick: onClickMap,
|
|
373
|
+
withoutStyle: true,
|
|
374
|
+
style: {
|
|
375
|
+
height: height * openedMarkerSpacerHeight
|
|
376
|
+
},
|
|
377
|
+
disabled: isPreview,
|
|
378
|
+
focusable: current && isView
|
|
379
|
+
}), /*#__PURE__*/jsx("div", {
|
|
380
|
+
className: styles.markerOverlay,
|
|
381
|
+
style: {
|
|
382
|
+
minHeight: height * (1 - openedMarkerSpacerHeight)
|
|
383
|
+
},
|
|
384
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
385
|
+
className: styles.markerOverlayContent,
|
|
386
|
+
style: markerOverlayContentStyle,
|
|
387
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
388
|
+
className: styles.swipeIndicator
|
|
389
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
390
|
+
className: styles.markerOverlayContentInner,
|
|
391
|
+
ref: markerOverContentInnerRef,
|
|
392
|
+
children: [hasMarkerImage ? /*#__PURE__*/jsx(ImageElement, {
|
|
393
|
+
className: styles.markerImage,
|
|
394
|
+
media: markerImage,
|
|
395
|
+
width: markerOverContentInnerWidth,
|
|
396
|
+
resolution: resolution
|
|
397
|
+
}) : null, hasMarkerTitle ? /*#__PURE__*/jsx(Heading, _objectSpread({
|
|
398
|
+
className: styles.markerTitle
|
|
399
|
+
}, markerTitle)) : null, hasMarkerSubtitle ? /*#__PURE__*/jsx(Heading, _objectSpread({
|
|
400
|
+
size: 3,
|
|
401
|
+
className: styles.markerSubtitle
|
|
402
|
+
}, markerSubtitle)) : null, hasMarkerDescription ? /*#__PURE__*/jsx(Text, _objectSpread({
|
|
403
|
+
className: styles.markerDescription
|
|
404
|
+
}, markerDescription)) : null]
|
|
405
|
+
}, "markerContent-".concat(selectedMarkerIndex))]
|
|
406
|
+
})
|
|
407
|
+
})]
|
|
408
|
+
})
|
|
409
|
+
})
|
|
410
|
+
}), "marker-overlay"), /*#__PURE__*/jsxs("div", {
|
|
411
|
+
className: classNames([styles.splash]),
|
|
412
|
+
children: [/*#__PURE__*/jsx(ScreenElement, {
|
|
413
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
414
|
+
id: "2ZOPe+",
|
|
415
|
+
defaultMessage: [{
|
|
416
|
+
"type": 0,
|
|
417
|
+
"value": "Title"
|
|
418
|
+
}]
|
|
419
|
+
}),
|
|
420
|
+
emptyClassName: styles.emptyTitle,
|
|
421
|
+
isEmpty: !hasTitle,
|
|
422
|
+
children: /*#__PURE__*/jsx(Heading, _objectSpread({
|
|
423
|
+
className: styles.title
|
|
424
|
+
}, title))
|
|
425
|
+
}), /*#__PURE__*/jsx(ScreenElement, {
|
|
426
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
427
|
+
id: "507VAi",
|
|
428
|
+
defaultMessage: [{
|
|
429
|
+
"type": 0,
|
|
430
|
+
"value": "Description"
|
|
431
|
+
}]
|
|
432
|
+
}),
|
|
433
|
+
emptyClassName: styles.emptyDescription,
|
|
434
|
+
isEmpty: !hasDescription,
|
|
435
|
+
children: /*#__PURE__*/jsx(Text, _objectSpread({
|
|
436
|
+
className: styles.description
|
|
437
|
+
}, description))
|
|
438
|
+
}), /*#__PURE__*/jsx(ScreenElement, {
|
|
439
|
+
emptyLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
440
|
+
id: "bv3rRe",
|
|
441
|
+
defaultMessage: [{
|
|
442
|
+
"type": 0,
|
|
443
|
+
"value": "Button"
|
|
444
|
+
}]
|
|
445
|
+
}),
|
|
446
|
+
emptyClassName: styles.emptyButton,
|
|
447
|
+
isEmpty: !hasButton,
|
|
448
|
+
children: /*#__PURE__*/jsx(ButtonElement, {
|
|
449
|
+
className: styles.splashButton,
|
|
450
|
+
onClick: onButtonClick,
|
|
451
|
+
buttonStyle: button !== null ? button.buttonStyle : null,
|
|
452
|
+
focusable: current && isView,
|
|
453
|
+
children: hasButton ? /*#__PURE__*/jsx(Text, _objectSpread(_objectSpread({}, button), {}, {
|
|
454
|
+
className: styles.button
|
|
455
|
+
})) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
456
|
+
id: "sXfFFw",
|
|
457
|
+
defaultMessage: [{
|
|
458
|
+
"type": 0,
|
|
459
|
+
"value": "Enter"
|
|
460
|
+
}]
|
|
461
|
+
})
|
|
462
|
+
})
|
|
463
|
+
})]
|
|
464
|
+
}, "splash"), !isStatic && !isCapture && !isPreview && !isEdit ? /*#__PURE__*/jsx(Button, {
|
|
465
|
+
className: styles.closeButton,
|
|
466
|
+
onClick: onCloseClick,
|
|
467
|
+
focusable: current && isView,
|
|
468
|
+
children: "\xD7"
|
|
469
|
+
}, "close-button") : null]
|
|
470
|
+
})
|
|
471
|
+
}), !isPlaceholder ? /*#__PURE__*/jsx(Background, {
|
|
472
|
+
color: {
|
|
473
|
+
color: '#FFFFFF',
|
|
474
|
+
alpha: 1
|
|
475
|
+
},
|
|
476
|
+
width: width,
|
|
477
|
+
height: height,
|
|
478
|
+
resolution: resolution,
|
|
479
|
+
playing: backgroundPlaying,
|
|
480
|
+
muted: muted,
|
|
481
|
+
shouldLoad: backgroundShouldLoad,
|
|
482
|
+
mediaRef: mediaRef,
|
|
483
|
+
withoutVideo: isPreview,
|
|
484
|
+
className: styles.background
|
|
485
|
+
}) : null]
|
|
486
|
+
});
|
|
474
487
|
}
|
|
475
488
|
|
|
476
489
|
function MapImagesScreen(_ref) {
|
|
477
490
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
478
|
-
return /*#__PURE__*/
|
|
491
|
+
return /*#__PURE__*/jsx(MapScreen, _objectSpread(_objectSpread({}, props), {}, {
|
|
479
492
|
withMarkerImages: true
|
|
480
493
|
}));
|
|
481
494
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-map",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.51",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@babel/runtime": "^7.28.6",
|
|
64
|
-
"@micromag/core": "^0.4.
|
|
65
|
-
"@micromag/element-background": "^0.4.
|
|
66
|
-
"@micromag/element-button": "^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-image": "^0.4.
|
|
72
|
-
"@micromag/element-map": "^0.4.
|
|
73
|
-
"@micromag/element-scroll": "^0.4.
|
|
74
|
-
"@micromag/element-text": "^0.4.
|
|
75
|
-
"@micromag/transforms": "^0.4.
|
|
64
|
+
"@micromag/core": "^0.4.51",
|
|
65
|
+
"@micromag/element-background": "^0.4.51",
|
|
66
|
+
"@micromag/element-button": "^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-image": "^0.4.51",
|
|
72
|
+
"@micromag/element-map": "^0.4.51",
|
|
73
|
+
"@micromag/element-scroll": "^0.4.51",
|
|
74
|
+
"@micromag/element-text": "^0.4.51",
|
|
75
|
+
"@micromag/transforms": "^0.4.51",
|
|
76
76
|
"classnames": "^2.2.6",
|
|
77
77
|
"lodash": "^4.17.23",
|
|
78
78
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -82,6 +82,6 @@
|
|
|
82
82
|
"access": "public",
|
|
83
83
|
"registry": "https://registry.npmjs.org/"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439",
|
|
86
86
|
"types": "es/index.d.ts"
|
|
87
87
|
}
|