@micromag/element-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 +55 -50
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
5
5
|
import { useGoogleMapsClient } from '@micromag/core/contexts';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
6
8
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
7
9
|
import { useDimensionObserver } from '@micromag/core/hooks';
|
|
8
10
|
import isObject from 'lodash/isObject';
|
|
@@ -390,16 +392,18 @@ function Map$1(_ref) {
|
|
|
390
392
|
}),
|
|
391
393
|
map = _useGoogleMap.map,
|
|
392
394
|
mapRef = _useGoogleMap.ref;
|
|
393
|
-
return /*#__PURE__*/
|
|
395
|
+
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
394
396
|
className: classNames([styles$1.container, className, _defineProperty({}, styles$1.preventScroll, !draggable)])
|
|
395
|
-
}, stopDragEventsPropagation),
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
}, stopDragEventsPropagation), {}, {
|
|
398
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
399
|
+
ref: mapRef,
|
|
400
|
+
className: styles$1.map,
|
|
401
|
+
tabIndex: focusable ? '0' : '-1'
|
|
402
|
+
}), React.Children.map(children, function (child) {
|
|
403
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
404
|
+
map: map
|
|
405
|
+
});
|
|
406
|
+
})]
|
|
403
407
|
}));
|
|
404
408
|
}
|
|
405
409
|
|
|
@@ -601,47 +605,48 @@ function Map(_ref) {
|
|
|
601
605
|
onTilesLoaded: onTilesLoaded
|
|
602
606
|
};
|
|
603
607
|
}, [onClick, onCenterChanged, onBoundsChanged, onDrag, onDragEnd, onTilesLoaded]);
|
|
604
|
-
return /*#__PURE__*/
|
|
605
|
-
className: classNames([styles.container, className])
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
608
|
+
return /*#__PURE__*/jsx("div", {
|
|
609
|
+
className: classNames([styles.container, className]),
|
|
610
|
+
children: /*#__PURE__*/jsx(Map$1, {
|
|
611
|
+
center: center,
|
|
612
|
+
zoom: zoom,
|
|
613
|
+
withoutStyle: withoutStyle,
|
|
614
|
+
bounds: bounds,
|
|
615
|
+
draggable: draggable,
|
|
616
|
+
events: events,
|
|
617
|
+
fitBounds: fitBounds,
|
|
618
|
+
zoomControl: zoomControl,
|
|
619
|
+
mapTypeControl: mapTypeControl,
|
|
620
|
+
scaleControl: scaleControl,
|
|
621
|
+
streetViewControl: streetViewControl,
|
|
622
|
+
rotateControl: rotateControl,
|
|
623
|
+
fullscreenControl: fullscreenControl,
|
|
624
|
+
focusable: focusable,
|
|
625
|
+
children: markers !== null ? markers.map(function (_ref4, index) {
|
|
626
|
+
var _ref4$active = _ref4.active,
|
|
627
|
+
active = _ref4$active === void 0 ? true : _ref4$active,
|
|
628
|
+
_ref4$geoPosition = _ref4.geoPosition,
|
|
629
|
+
geoPosition = _ref4$geoPosition === void 0 ? null : _ref4$geoPosition,
|
|
630
|
+
_ref4$image = _ref4.image,
|
|
631
|
+
image = _ref4$image === void 0 ? null : _ref4$image,
|
|
632
|
+
_ref4$title = _ref4.title,
|
|
633
|
+
title = _ref4$title === void 0 ? null : _ref4$title;
|
|
634
|
+
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/jsx(Marker, {
|
|
635
|
+
active: active,
|
|
636
|
+
title: title !== null && _typeof(title.body) ? title.body : null,
|
|
637
|
+
image: image,
|
|
638
|
+
position: geoPosition,
|
|
639
|
+
events: {
|
|
640
|
+
onClick: onClickMarker !== null ? function (e) {
|
|
641
|
+
return onClickMarker(e, index);
|
|
642
|
+
} : function () {
|
|
643
|
+
return console.log(index);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}, "marker-".concat(index)) : /*#__PURE__*/jsx("div", {});
|
|
647
|
+
}) : null
|
|
648
|
+
})
|
|
649
|
+
});
|
|
645
650
|
}
|
|
646
651
|
|
|
647
652
|
export { Pin, Map as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-map",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.51",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/runtime": "^7.28.6",
|
|
63
|
-
"@micromag/core": "^0.4.
|
|
63
|
+
"@micromag/core": "^0.4.51",
|
|
64
64
|
"classnames": "^2.2.6",
|
|
65
65
|
"lodash": "^4.17.23",
|
|
66
66
|
"react-intl": "^8.1.3 || ^10.0.0",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"access": "public",
|
|
71
71
|
"registry": "https://registry.npmjs.org/"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "985a2370829c9ac8901ea97bf20bfc98ab158439",
|
|
74
74
|
"types": "es/index.d.ts"
|
|
75
75
|
}
|