@micromag/element-map 0.3.423 → 0.3.429
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 +1 -2
- package/lib/index.js +75 -86
- package/package.json +9 -3
package/es/index.js
CHANGED
|
@@ -384,7 +384,6 @@ var defaultProps$2 = {
|
|
|
384
384
|
focusable: true
|
|
385
385
|
};
|
|
386
386
|
var Map$1 = function Map(_ref) {
|
|
387
|
-
var _ref2;
|
|
388
387
|
var center = _ref.center,
|
|
389
388
|
zoom = _ref.zoom,
|
|
390
389
|
maxZoom = _ref.maxZoom,
|
|
@@ -421,7 +420,7 @@ var Map$1 = function Map(_ref) {
|
|
|
421
420
|
map = _useGoogleMap.map,
|
|
422
421
|
mapRef = _useGoogleMap.ref;
|
|
423
422
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
424
|
-
className: classNames([styles$1.container, (
|
|
423
|
+
className: classNames([styles$1.container, _defineProperty(_defineProperty({}, className, className !== null), styles$1.preventScroll, !draggable)])
|
|
425
424
|
}, stopDragEventsPropagation), /*#__PURE__*/React.createElement("div", {
|
|
426
425
|
ref: mapRef,
|
|
427
426
|
className: styles$1.map,
|
package/lib/index.js
CHANGED
|
@@ -13,16 +13,6 @@ var hooks = require('@micromag/core/hooks');
|
|
|
13
13
|
var core = require('@micromag/core');
|
|
14
14
|
var isObject = require('lodash/isObject');
|
|
15
15
|
|
|
16
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
-
|
|
18
|
-
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
19
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
21
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
22
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
-
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
25
|
-
|
|
26
16
|
var styles$2 = [{
|
|
27
17
|
elementType: 'geometry',
|
|
28
18
|
stylers: [{
|
|
@@ -228,7 +218,7 @@ function useGoogleMap(_ref) {
|
|
|
228
218
|
fullscreenControl = _ref.fullscreenControl;
|
|
229
219
|
var client = contexts.useGoogleMapsClient();
|
|
230
220
|
var _useState = React.useState(false),
|
|
231
|
-
_useState2 =
|
|
221
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
232
222
|
ready = _useState2[0],
|
|
233
223
|
setReady = _useState2[1];
|
|
234
224
|
var containerRef = React.useRef(null);
|
|
@@ -354,29 +344,29 @@ var stopDragEventsPropagation = {
|
|
|
354
344
|
}
|
|
355
345
|
};
|
|
356
346
|
var propTypes$2 = {
|
|
357
|
-
center:
|
|
358
|
-
lat:
|
|
359
|
-
lng:
|
|
347
|
+
center: PropTypes.shape({
|
|
348
|
+
lat: PropTypes.number,
|
|
349
|
+
lng: PropTypes.number
|
|
360
350
|
}),
|
|
361
|
-
zoom:
|
|
362
|
-
maxZoom:
|
|
363
|
-
bounds:
|
|
351
|
+
zoom: PropTypes.number,
|
|
352
|
+
maxZoom: PropTypes.number,
|
|
353
|
+
bounds: PropTypes.object,
|
|
364
354
|
// eslint-disable-line
|
|
365
|
-
draggable:
|
|
366
|
-
withoutStyle:
|
|
355
|
+
draggable: PropTypes.bool,
|
|
356
|
+
withoutStyle: PropTypes.bool,
|
|
367
357
|
// Global maps events
|
|
368
|
-
events:
|
|
358
|
+
events: PropTypes.object,
|
|
369
359
|
// eslint-disable-line
|
|
370
|
-
fitBounds:
|
|
371
|
-
zoomControl:
|
|
372
|
-
mapTypeControl:
|
|
373
|
-
scaleControl:
|
|
374
|
-
streetViewControl:
|
|
375
|
-
rotateControl:
|
|
376
|
-
fullscreenControl:
|
|
377
|
-
className:
|
|
378
|
-
children:
|
|
379
|
-
focusable:
|
|
360
|
+
fitBounds: PropTypes.bool,
|
|
361
|
+
zoomControl: PropTypes.bool,
|
|
362
|
+
mapTypeControl: PropTypes.bool,
|
|
363
|
+
scaleControl: PropTypes.bool,
|
|
364
|
+
streetViewControl: PropTypes.bool,
|
|
365
|
+
rotateControl: PropTypes.bool,
|
|
366
|
+
fullscreenControl: PropTypes.bool,
|
|
367
|
+
className: PropTypes.string,
|
|
368
|
+
children: PropTypes.node,
|
|
369
|
+
focusable: PropTypes.bool
|
|
380
370
|
};
|
|
381
371
|
var defaultProps$2 = {
|
|
382
372
|
center: null,
|
|
@@ -398,7 +388,6 @@ var defaultProps$2 = {
|
|
|
398
388
|
focusable: true
|
|
399
389
|
};
|
|
400
390
|
var Map$1 = function Map(_ref) {
|
|
401
|
-
var _ref2;
|
|
402
391
|
var center = _ref.center,
|
|
403
392
|
zoom = _ref.zoom,
|
|
404
393
|
maxZoom = _ref.maxZoom,
|
|
@@ -434,14 +423,14 @@ var Map$1 = function Map(_ref) {
|
|
|
434
423
|
}),
|
|
435
424
|
map = _useGoogleMap.map,
|
|
436
425
|
mapRef = _useGoogleMap.ref;
|
|
437
|
-
return /*#__PURE__*/
|
|
438
|
-
className:
|
|
439
|
-
}, stopDragEventsPropagation), /*#__PURE__*/
|
|
426
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
427
|
+
className: classNames([styles$1.container, _defineProperty(_defineProperty({}, className, className !== null), styles$1.preventScroll, !draggable)])
|
|
428
|
+
}, stopDragEventsPropagation), /*#__PURE__*/React.createElement("div", {
|
|
440
429
|
ref: mapRef,
|
|
441
430
|
className: styles$1.map,
|
|
442
431
|
tabIndex: focusable ? '0' : '-1'
|
|
443
|
-
}),
|
|
444
|
-
return /*#__PURE__*/
|
|
432
|
+
}), React.Children.map(children, function (child) {
|
|
433
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
445
434
|
map: map
|
|
446
435
|
});
|
|
447
436
|
}));
|
|
@@ -475,7 +464,7 @@ function useGoogleMapMarker(map) {
|
|
|
475
464
|
if (client === null) {
|
|
476
465
|
return;
|
|
477
466
|
}
|
|
478
|
-
if (
|
|
467
|
+
if (isObject(newIcon)) {
|
|
479
468
|
var _ref2 = newIcon || {},
|
|
480
469
|
_ref2$url = _ref2.url,
|
|
481
470
|
iconUrl = _ref2$url === void 0 ? null : _ref2$url;
|
|
@@ -522,22 +511,22 @@ var PinInactive = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAArCAYAAAC
|
|
|
522
511
|
|
|
523
512
|
var propTypes$1 = {
|
|
524
513
|
// map: PropTypes.object.isRequired, // eslint-disable-line
|
|
525
|
-
map:
|
|
514
|
+
map: PropTypes.object,
|
|
526
515
|
// eslint-disable-line
|
|
527
|
-
position:
|
|
528
|
-
lat:
|
|
529
|
-
lng:
|
|
516
|
+
position: PropTypes.shape({
|
|
517
|
+
lat: PropTypes.number,
|
|
518
|
+
lng: PropTypes.number
|
|
530
519
|
}).isRequired,
|
|
531
|
-
type:
|
|
520
|
+
type: PropTypes.string,
|
|
532
521
|
// .isRequired,
|
|
533
|
-
events:
|
|
522
|
+
events: PropTypes.object,
|
|
534
523
|
// eslint-disable-line
|
|
535
|
-
active:
|
|
536
|
-
title:
|
|
524
|
+
active: PropTypes.bool,
|
|
525
|
+
title: PropTypes.string,
|
|
537
526
|
image: core.PropTypes.imageMedia,
|
|
538
|
-
iconSize:
|
|
539
|
-
width:
|
|
540
|
-
height:
|
|
527
|
+
iconSize: PropTypes.shape({
|
|
528
|
+
width: PropTypes.number,
|
|
529
|
+
height: PropTypes.number
|
|
541
530
|
})
|
|
542
531
|
};
|
|
543
532
|
var defaultProps$1 = {
|
|
@@ -575,49 +564,49 @@ Marker.defaultProps = defaultProps$1;
|
|
|
575
564
|
|
|
576
565
|
// import { useEffect } from 'react';
|
|
577
566
|
({
|
|
578
|
-
map:
|
|
567
|
+
map: PropTypes.object,
|
|
579
568
|
// eslint-disable-line
|
|
580
|
-
coords:
|
|
581
|
-
lat:
|
|
582
|
-
lng:
|
|
569
|
+
coords: PropTypes.arrayOf(PropTypes.shape({
|
|
570
|
+
lat: PropTypes.number,
|
|
571
|
+
lng: PropTypes.number
|
|
583
572
|
})).isRequired,
|
|
584
|
-
events:
|
|
573
|
+
events: PropTypes.object // eslint-disable-line
|
|
585
574
|
});
|
|
586
575
|
|
|
587
576
|
({
|
|
588
|
-
map:
|
|
577
|
+
map: PropTypes.object,
|
|
589
578
|
// eslint-disable-line
|
|
590
|
-
enabled:
|
|
579
|
+
enabled: PropTypes.bool
|
|
591
580
|
});
|
|
592
581
|
|
|
593
582
|
var styles = {"container":"micromag-element-map-container"};
|
|
594
583
|
|
|
595
584
|
var propTypes = {
|
|
596
|
-
center:
|
|
597
|
-
lat:
|
|
598
|
-
lng:
|
|
585
|
+
center: PropTypes.shape({
|
|
586
|
+
lat: PropTypes.number,
|
|
587
|
+
lng: PropTypes.number
|
|
599
588
|
}),
|
|
600
|
-
zoom:
|
|
601
|
-
draggable:
|
|
602
|
-
markers:
|
|
589
|
+
zoom: PropTypes.number,
|
|
590
|
+
draggable: PropTypes.bool,
|
|
591
|
+
markers: PropTypes.arrayOf(PropTypes.object),
|
|
603
592
|
// eslint-disable-line react/forbid-prop-types
|
|
604
|
-
onClickMap:
|
|
605
|
-
onClickMarker:
|
|
606
|
-
className:
|
|
607
|
-
onReady:
|
|
608
|
-
onCenterChanged:
|
|
609
|
-
onBoundsChanged:
|
|
610
|
-
onDrag:
|
|
611
|
-
onDragEnd:
|
|
612
|
-
withoutStyle:
|
|
613
|
-
fitBounds:
|
|
614
|
-
zoomControl:
|
|
615
|
-
mapTypeControl:
|
|
616
|
-
scaleControl:
|
|
617
|
-
streetViewControl:
|
|
618
|
-
rotateControl:
|
|
619
|
-
fullscreenControl:
|
|
620
|
-
focusable:
|
|
593
|
+
onClickMap: PropTypes.func,
|
|
594
|
+
onClickMarker: PropTypes.func,
|
|
595
|
+
className: PropTypes.string,
|
|
596
|
+
onReady: PropTypes.func,
|
|
597
|
+
onCenterChanged: PropTypes.func,
|
|
598
|
+
onBoundsChanged: PropTypes.func,
|
|
599
|
+
onDrag: PropTypes.func,
|
|
600
|
+
onDragEnd: PropTypes.func,
|
|
601
|
+
withoutStyle: PropTypes.bool,
|
|
602
|
+
fitBounds: PropTypes.bool,
|
|
603
|
+
zoomControl: PropTypes.bool,
|
|
604
|
+
mapTypeControl: PropTypes.bool,
|
|
605
|
+
scaleControl: PropTypes.bool,
|
|
606
|
+
streetViewControl: PropTypes.bool,
|
|
607
|
+
rotateControl: PropTypes.bool,
|
|
608
|
+
fullscreenControl: PropTypes.bool,
|
|
609
|
+
focusable: PropTypes.bool
|
|
621
610
|
};
|
|
622
611
|
var defaultProps = {
|
|
623
612
|
center: null,
|
|
@@ -693,7 +682,7 @@ var Map = function Map(_ref) {
|
|
|
693
682
|
return markersBounds;
|
|
694
683
|
}, [client, markers]);
|
|
695
684
|
var _useState = React.useState(false),
|
|
696
|
-
_useState2 =
|
|
685
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
697
686
|
loaded = _useState2[0],
|
|
698
687
|
setLoaded = _useState2[1];
|
|
699
688
|
React.useEffect(function () {
|
|
@@ -716,9 +705,9 @@ var Map = function Map(_ref) {
|
|
|
716
705
|
onTilesLoaded: onTilesLoaded
|
|
717
706
|
};
|
|
718
707
|
}, [onClick, onCenterChanged, onBoundsChanged, onDrag, onDragEnd, onTilesLoaded]);
|
|
719
|
-
return /*#__PURE__*/
|
|
720
|
-
className:
|
|
721
|
-
}, /*#__PURE__*/
|
|
708
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
709
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
710
|
+
}, /*#__PURE__*/React.createElement(Map$1, {
|
|
722
711
|
center: center,
|
|
723
712
|
zoom: zoom,
|
|
724
713
|
withoutStyle: withoutStyle,
|
|
@@ -742,10 +731,10 @@ var Map = function Map(_ref) {
|
|
|
742
731
|
image = _ref5$image === void 0 ? null : _ref5$image,
|
|
743
732
|
_ref5$title = _ref5.title,
|
|
744
733
|
title = _ref5$title === void 0 ? null : _ref5$title;
|
|
745
|
-
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/
|
|
734
|
+
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/React.createElement(Marker, {
|
|
746
735
|
key: "marker-".concat(index),
|
|
747
736
|
active: active,
|
|
748
|
-
title: title !== null &&
|
|
737
|
+
title: title !== null && _typeof(title.body) ? title.body : null,
|
|
749
738
|
image: image,
|
|
750
739
|
position: geoPosition,
|
|
751
740
|
events: {
|
|
@@ -755,11 +744,11 @@ var Map = function Map(_ref) {
|
|
|
755
744
|
return console.log(index);
|
|
756
745
|
} // eslint-disable-line no-console
|
|
757
746
|
}
|
|
758
|
-
}) : /*#__PURE__*/
|
|
747
|
+
}) : /*#__PURE__*/React.createElement("div", null);
|
|
759
748
|
}) : null));
|
|
760
749
|
};
|
|
761
750
|
Map.propTypes = propTypes;
|
|
762
751
|
Map.defaultProps = defaultProps;
|
|
763
752
|
|
|
764
753
|
exports.Pin = Pin;
|
|
765
|
-
exports
|
|
754
|
+
exports.default = Map;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-map",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.429",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -50,7 +56,7 @@
|
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
58
|
"@babel/runtime": "^7.13.10",
|
|
53
|
-
"@micromag/core": "^0.3.
|
|
59
|
+
"@micromag/core": "^0.3.429",
|
|
54
60
|
"classnames": "^2.2.6",
|
|
55
61
|
"lodash": "^4.17.21",
|
|
56
62
|
"prop-types": "^15.7.2",
|
|
@@ -61,5 +67,5 @@
|
|
|
61
67
|
"access": "public",
|
|
62
68
|
"registry": "https://registry.npmjs.org/"
|
|
63
69
|
},
|
|
64
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
|
|
65
71
|
}
|