google-maps-react-markers 1.0.0 → 1.0.1
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/README.md +67 -44
- package/dist/index.js +30 -27
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +5 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# google-maps-react-markers
|
|
2
2
|
|
|
3
|
-
> Google Maps library
|
|
3
|
+
> Google Maps library that accept markers as react components and it's working with React 18+.
|
|
4
|
+
|
|
5
|
+
It supports a small set of the props of [Google Map React](https://github.com/google-map-react/google-map-react). Clustering also is possible.
|
|
6
|
+
The library implements [Google Maps Custom Overlays](https://developers.google.com/maps/documentation/javascript/customoverlays) official library.
|
|
4
7
|
|
|
5
8
|
[](https://www.npmjs.com/package/google-maps-react-markers) [](https://standardjs.com)
|
|
6
9
|
|
|
@@ -19,34 +22,41 @@ npm install --save google-maps-react-markers
|
|
|
19
22
|
## Usage
|
|
20
23
|
|
|
21
24
|
```jsx
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
const App = () => {
|
|
26
|
+
const mapRef = useRef(null);
|
|
27
|
+
const [mapReady, setMapReady] = useState(false);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description This function is called when the map is ready
|
|
31
|
+
* @param {Object} map - reference to the map instance
|
|
32
|
+
* @param {Object} maps - reference to the maps library
|
|
33
|
+
*/
|
|
34
|
+
const onGoogleApiLoaded = ({ map, maps }) => {
|
|
35
|
+
mapRef.current = map;
|
|
36
|
+
setMapReady(true);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const onMarkerClick = (markerId) => {
|
|
40
|
+
console.log("This is ->", markerId);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<GoogleMap
|
|
46
|
+
defaultCenter={{ lat: 45.4046987, lng: 12.2472504 }}
|
|
47
|
+
defaultZoom={5}
|
|
48
|
+
options={mapOptions}
|
|
49
|
+
mapMinHeight="100vh"
|
|
50
|
+
onGoogleApiLoaded={onGoogleApiLoaded}
|
|
51
|
+
onChange={(map) => console.log("Map moved", map)}
|
|
52
|
+
>
|
|
53
|
+
{coordinates.map(({ lat, lng, name }, index) => (
|
|
54
|
+
<Marker key={index} lat={lat} lng={lng} markerId={name} onClick={onMarkerClick} />
|
|
55
|
+
))}
|
|
56
|
+
</GoogleMap>
|
|
57
|
+
{mapReady && alert("Map is ready")}
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
50
60
|
};
|
|
51
61
|
|
|
52
62
|
export default Map;
|
|
@@ -54,21 +64,34 @@ export default Map;
|
|
|
54
64
|
|
|
55
65
|
## Props
|
|
56
66
|
|
|
57
|
-
| Prop
|
|
58
|
-
|
|
|
59
|
-
| apiKey
|
|
60
|
-
| defaultCenter
|
|
61
|
-
| defaultZoom
|
|
62
|
-
| libraries
|
|
63
|
-
| options
|
|
64
|
-
| onGoogleApiLoaded
|
|
65
|
-
| onChange
|
|
66
|
-
| children
|
|
67
|
-
| loadingContent
|
|
68
|
-
| idleContent
|
|
69
|
-
| errorContent
|
|
70
|
-
| mapMinHeight
|
|
71
|
-
| containerProps
|
|
67
|
+
| Prop | Type | Required | Default | Description |
|
|
68
|
+
| ----------------- | -------- | -------- | --------------------------- | ----------------------------------------- |
|
|
69
|
+
| apiKey | string | **yes** | `''` | Api Key to load Google Maps |
|
|
70
|
+
| defaultCenter | object | **yes** | `{ lat: 0, lng: 0 }` | Default center of the map |
|
|
71
|
+
| defaultZoom | number | **yes** | `1-20` | Default zoom of the map |
|
|
72
|
+
| libraries | array | no | `['places', 'geometry']` | Libraries to load |
|
|
73
|
+
| options | object | no | `{}` | Options for the map |
|
|
74
|
+
| onGoogleApiLoaded | function | no | `() => {}` | Callback when the map is loaded |
|
|
75
|
+
| onChange | function | no | `() => {}` | Callback when the map has changed |
|
|
76
|
+
| children | node | no | `null` | Markers of the map |
|
|
77
|
+
| loadingContent | node | no | `'Google Maps is loading'` | Content to show while the map is loading |
|
|
78
|
+
| idleContent | node | no | `'Google Maps is on idle'` | Content to show when the map is idle |
|
|
79
|
+
| errorContent | node | no | `'Google Maps is on error'` | Content to show when the map has an error |
|
|
80
|
+
| mapMinHeight | string | no | `'unset'` | Min height of the map |
|
|
81
|
+
| containerProps | object | no | `{}` | Props for the div container of the map |
|
|
82
|
+
|
|
83
|
+
## Clustering
|
|
84
|
+
|
|
85
|
+
For clustering, follow this [guide](https://www.leighhalliday.com/google-maps-clustering) using [useSupercluster Hook](https://github.com/leighhalliday/use-supercluster), but use bounds in this way:
|
|
86
|
+
|
|
87
|
+
```jsx
|
|
88
|
+
const onMapChange = ({ bounds, zoom }) => {
|
|
89
|
+
const ne = bounds.getNorthEast();
|
|
90
|
+
const sw = bounds.getSouthWest();
|
|
91
|
+
// useSupercluster accepts bounds in the form of [westLng, southLat, eastLng, northLat]
|
|
92
|
+
setMapBounds({ ...mapBounds, bounds: [sw.lng(), sw.lat(), ne.lng(), ne.lat()], zoom });
|
|
93
|
+
};
|
|
94
|
+
```
|
|
72
95
|
|
|
73
96
|
## License
|
|
74
97
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
2
|
+
|
|
1
3
|
var propTypes = require('prop-types');
|
|
2
|
-
var
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var React__default = _interopDefault(React);
|
|
3
6
|
var reactDom = require('react-dom');
|
|
4
7
|
|
|
5
8
|
function _extends() {
|
|
@@ -53,10 +56,10 @@ var useScript = function useScript(script) {
|
|
|
53
56
|
elementIdToAppend: null
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
|
-
var _useState =
|
|
59
|
+
var _useState = React.useState(script.src ? 'loading' : 'idle'),
|
|
57
60
|
status = _useState[0],
|
|
58
61
|
setStatus = _useState[1];
|
|
59
|
-
|
|
62
|
+
React.useEffect(function () {
|
|
60
63
|
var _script$callbacks, _script$callbacks2;
|
|
61
64
|
if (!script.src) {
|
|
62
65
|
setStatus('idle');
|
|
@@ -198,12 +201,12 @@ var OverlayView = function OverlayView(_ref) {
|
|
|
198
201
|
maps = _ref.maps,
|
|
199
202
|
zIndex = _ref.zIndex,
|
|
200
203
|
children = _ref.children;
|
|
201
|
-
var container =
|
|
204
|
+
var container = React.useMemo(function () {
|
|
202
205
|
var div = document.createElement('div');
|
|
203
206
|
div.style.position = 'absolute';
|
|
204
207
|
return div;
|
|
205
208
|
}, []);
|
|
206
|
-
var overlay =
|
|
209
|
+
var overlay = React.useMemo(function () {
|
|
207
210
|
return createOverlay({
|
|
208
211
|
container: container,
|
|
209
212
|
pane: pane,
|
|
@@ -211,7 +214,7 @@ var OverlayView = function OverlayView(_ref) {
|
|
|
211
214
|
maps: maps
|
|
212
215
|
});
|
|
213
216
|
}, [container, maps, pane, position]);
|
|
214
|
-
|
|
217
|
+
React.useEffect(function () {
|
|
215
218
|
if (!overlay.map) {
|
|
216
219
|
overlay === null || overlay === void 0 ? void 0 : overlay.setMap(map);
|
|
217
220
|
return function () {
|
|
@@ -220,25 +223,25 @@ var OverlayView = function OverlayView(_ref) {
|
|
|
220
223
|
}
|
|
221
224
|
}, [map]);
|
|
222
225
|
|
|
223
|
-
|
|
226
|
+
React.useEffect(function () {
|
|
224
227
|
container.style.zIndex = "" + zIndex;
|
|
225
228
|
}, [zIndex, container]);
|
|
226
|
-
return reactDom.createPortal(children, container);
|
|
229
|
+
return /*#__PURE__*/reactDom.createPortal(children, container);
|
|
227
230
|
};
|
|
228
231
|
|
|
229
232
|
var MapMarkers = function MapMarkers(_ref) {
|
|
230
233
|
var children = _ref.children,
|
|
231
234
|
map = _ref.map,
|
|
232
235
|
maps = _ref.maps;
|
|
233
|
-
var markers =
|
|
236
|
+
var markers = React.useMemo(function () {
|
|
234
237
|
if (!map || !maps) return [];
|
|
235
|
-
return
|
|
236
|
-
if (
|
|
238
|
+
return React.Children.map(children, function (child) {
|
|
239
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
237
240
|
var latLng = {
|
|
238
241
|
lat: child.props.lat,
|
|
239
242
|
lng: child.props.lng
|
|
240
243
|
};
|
|
241
|
-
return /*#__PURE__*/
|
|
244
|
+
return /*#__PURE__*/React__default.createElement(OverlayView, {
|
|
242
245
|
position: latLng,
|
|
243
246
|
map: map,
|
|
244
247
|
maps: maps
|
|
@@ -246,7 +249,7 @@ var MapMarkers = function MapMarkers(_ref) {
|
|
|
246
249
|
}
|
|
247
250
|
});
|
|
248
251
|
}, [children, map, maps]);
|
|
249
|
-
return /*#__PURE__*/
|
|
252
|
+
return /*#__PURE__*/React__default.createElement("div", null, markers);
|
|
250
253
|
};
|
|
251
254
|
MapMarkers.propTypes = {
|
|
252
255
|
children: propTypes.node.isRequired,
|
|
@@ -264,18 +267,18 @@ var MapComponent = function MapComponent(_ref) {
|
|
|
264
267
|
onGoogleApiLoaded = _ref.onGoogleApiLoaded,
|
|
265
268
|
onChange = _ref.onChange,
|
|
266
269
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
267
|
-
var mapRef =
|
|
268
|
-
var prevBoundsRef =
|
|
269
|
-
var _useState =
|
|
270
|
+
var mapRef = React.useRef(null);
|
|
271
|
+
var prevBoundsRef = React.useRef(null);
|
|
272
|
+
var _useState = React.useState(null),
|
|
270
273
|
map = _useState[0],
|
|
271
274
|
setMap = _useState[1];
|
|
272
|
-
var _useState2 =
|
|
275
|
+
var _useState2 = React.useState(null),
|
|
273
276
|
maps = _useState2[0],
|
|
274
277
|
setMaps = _useState2[1];
|
|
275
|
-
var _useState3 =
|
|
278
|
+
var _useState3 = React.useState(false),
|
|
276
279
|
googleApiCalled = _useState3[0],
|
|
277
280
|
setGoogleApiCalled = _useState3[1];
|
|
278
|
-
var onIdle =
|
|
281
|
+
var onIdle = React.useCallback(function () {
|
|
279
282
|
var zoom = map.getZoom();
|
|
280
283
|
var bounds = map.getBounds();
|
|
281
284
|
var centerLatLng = map.getCenter();
|
|
@@ -293,7 +296,7 @@ var MapComponent = function MapComponent(_ref) {
|
|
|
293
296
|
prevBoundsRef.current = boundsArray;
|
|
294
297
|
}
|
|
295
298
|
}, [map, onChange]);
|
|
296
|
-
|
|
299
|
+
React.useEffect(function () {
|
|
297
300
|
if (mapRef.current && !map) {
|
|
298
301
|
setMap(new window.google.maps.Map(mapRef.current, _extends({
|
|
299
302
|
center: defaultCenter,
|
|
@@ -302,7 +305,7 @@ var MapComponent = function MapComponent(_ref) {
|
|
|
302
305
|
setMaps(window.google.maps);
|
|
303
306
|
}
|
|
304
307
|
}, [defaultCenter, defaultZoom, map, mapRef, props]);
|
|
305
|
-
|
|
308
|
+
React.useEffect(function () {
|
|
306
309
|
if (map) {
|
|
307
310
|
if (!googleApiCalled) {
|
|
308
311
|
onGoogleApiLoaded({
|
|
@@ -316,18 +319,18 @@ var MapComponent = function MapComponent(_ref) {
|
|
|
316
319
|
window.google.maps.event.addListener(map, 'idle', onIdle);
|
|
317
320
|
}
|
|
318
321
|
}, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle]);
|
|
319
|
-
|
|
322
|
+
React.useEffect(function () {
|
|
320
323
|
return function () {
|
|
321
324
|
if (map) {
|
|
322
325
|
window.google.maps.event.clearListeners(map, 'idle');
|
|
323
326
|
}
|
|
324
327
|
};
|
|
325
328
|
}, [map]);
|
|
326
|
-
return /*#__PURE__*/
|
|
329
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
327
330
|
ref: mapRef,
|
|
328
331
|
style: style,
|
|
329
332
|
className: "google-map"
|
|
330
|
-
}), children && map && maps && /*#__PURE__*/
|
|
333
|
+
}), children && map && maps && /*#__PURE__*/React__default.createElement(MapMarkers, {
|
|
331
334
|
map: map,
|
|
332
335
|
maps: maps
|
|
333
336
|
}, children));
|
|
@@ -355,7 +358,7 @@ MapComponent.propTypes = {
|
|
|
355
358
|
};
|
|
356
359
|
|
|
357
360
|
var _excluded$1 = ["apiKey", "libraries", "children", "loadingContent", "idleContent", "errorContent", "mapMinHeight", "containerProps"];
|
|
358
|
-
var GoogleMap =
|
|
361
|
+
var GoogleMap = /*#__PURE__*/React.forwardRef(function GoogleMap(_ref, ref) {
|
|
359
362
|
var apiKey = _ref.apiKey,
|
|
360
363
|
libraries = _ref.libraries,
|
|
361
364
|
children = _ref.children,
|
|
@@ -369,7 +372,7 @@ var GoogleMap = react.forwardRef(function GoogleMap(_ref, ref) {
|
|
|
369
372
|
apiKey: apiKey,
|
|
370
373
|
libraries: libraries
|
|
371
374
|
});
|
|
372
|
-
return /*#__PURE__*/
|
|
375
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
373
376
|
style: {
|
|
374
377
|
height: '100%',
|
|
375
378
|
width: '100%',
|
|
@@ -378,7 +381,7 @@ var GoogleMap = react.forwardRef(function GoogleMap(_ref, ref) {
|
|
|
378
381
|
minHeight: mapMinHeight
|
|
379
382
|
},
|
|
380
383
|
ref: ref
|
|
381
|
-
}, containerProps), status === 'ready' ? /*#__PURE__*/
|
|
384
|
+
}, containerProps), status === 'ready' ? /*#__PURE__*/React__default.createElement(MapComponent, props, children) : status === 'loading' ? loadingContent : status === 'idle' ? idleContent : status === 'error' ? errorContent : null);
|
|
382
385
|
});
|
|
383
386
|
GoogleMap.defaultProps = _extends({}, MapComponent.defaultProps, {
|
|
384
387
|
loadingContent: 'Google Maps is loading',
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/map/overlay.js","../src/map/overlay-view.js","../src/map/markers.js","../src/map/map.js","../src/google-map.js"],"sourcesContent":["/* eslint-disable no-unused-expressions */\nimport { useState, useEffect } from 'react'\n\n/**\n * @description Hook to load external script.\n * @param {Object} script - Script to load.\n * @param {string} script.src - Script source.\n * @param {Object} [script.attributes] - Attributes to add to the script tag.\n * @param {Object} [script.callbacks] - Callbacks executed on completion.\n * @param {Function} [script.callbacks.onLoadCallback] - Callback executed on completion in case of success.\n * @param {Function} [script.callbacks.onErrorCallback] - Callbacks executed on completion in case of error.\n * @param {string} [script.elementIdToAppend] - HTML element id to append the script to. Default is HTML HEAD.\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n *\n * @example\n * const status = useScript({\n * \t\tsrc: \"https://script-to-load.js\",\n * \t\tattributes: { id: \"scriptId\", class: \"script-class\" },\n * \t\tcallbacks: {\n * \t\t\tonLoadCallback: onLoadFunc,\n * \t\t\tonErrorCallback: onErrorFunc,\n * \t\t},\n * \t\telementIdToAppend: \"script-container\"\n * })\n */\n\nexport const useScript = (\n\tscript = {\n\t\tsrc: '',\n\t\tattributes: {},\n\t\tcallbacks: { onLoadCallback: null, onErrorCallback: null },\n\t\telementIdToAppend: null,\n\t}\n) => {\n\t// Keep track of script status (\"idle\", \"loading\", \"ready\", \"error\")\n\tconst [status, setStatus] = useState(script.src ? 'loading' : 'idle')\n\n\tuseEffect(\n\t\t() => {\n\t\t\t// Allow falsy src value if waiting on other data needed for\n\t\t\t// constructing the script URL passed to this hook.\n\t\t\tif (!script.src) {\n\t\t\t\tsetStatus('idle')\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Fetch existing script element by src\n\t\t\t// It may have been added by another instance of this hook\n\t\t\tlet scriptToAdd = document.querySelector(`script[src=\"${script.src}\"]`)\n\t\t\tif (!scriptToAdd) {\n\t\t\t\t// Create script\n\t\t\t\tscriptToAdd = document.createElement('script')\n\t\t\t\tscriptToAdd.src = script.src\n\t\t\t\tscriptToAdd.async = true\n\t\t\t\tscriptToAdd.setAttribute('data-status', 'loading')\n\t\t\t\t// Add other script attributes, if they exist\n\t\t\t\tscript.attributes && Object.entries(script.attributes).length > 0\n\t\t\t\t\t? Object.entries(script.attributes).map(([key, value]) => scriptToAdd.setAttribute(key, value))\n\t\t\t\t\t: null\n\t\t\t\t// Add script to document body\n\t\t\t\tif (script.elementIdToAppend && document.getElementById(script.elementIdToAppend)) {\n\t\t\t\t\tdocument.getElementById(script.elementIdToAppend).appendChild(scriptToAdd)\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.appendChild(scriptToAdd)\n\t\t\t\t}\n\t\t\t\t// Store status in attribute on script\n\t\t\t\t// This can be read by other instances of this hook\n\t\t\t\tconst setAttributeFromEvent = (event) => {\n\t\t\t\t\tscriptToAdd.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error')\n\t\t\t\t}\n\t\t\t\tscriptToAdd.addEventListener('load', setAttributeFromEvent)\n\t\t\t\tscriptToAdd.addEventListener('error', setAttributeFromEvent)\n\t\t\t} else {\n\t\t\t\t// Grab existing script status from attribute and set to state.\n\t\t\t\tconst currentScriptStatus = scriptToAdd.getAttribute('data-status')\n\t\t\t\tswitch (currentScriptStatus) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'ready':\n\t\t\t\t\t\tscript.callbacks?.onLoadCallback ? script.callbacks.onLoadCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\tscript.callbacks?.onErrorCallback ? script.callbacks.onErrorCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// loading: do nothing\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tsetStatus(currentScriptStatus)\n\t\t\t}\n\t\t\t// Script event handler to update status in state\n\t\t\t// Note: Even if the script already exists we still need to add\n\t\t\t// event handlers to update the state for this hook instance.\n\t\t\tconst setStateFromEvent = (event) => {\n\t\t\t\tevent.type === 'load'\n\t\t\t\t\t? script.callbacks?.onLoadCallback\n\t\t\t\t\t\t? script.callbacks.onLoadCallback()\n\t\t\t\t\t\t: null\n\t\t\t\t\t: script.callbacks?.onErrorCallback\n\t\t\t\t\t? script.callbacks.onErrorCallback()\n\t\t\t\t\t: null\n\t\t\t\tsetStatus(event.type === 'load' ? 'ready' : 'error')\n\t\t\t}\n\t\t\t// Add event listeners\n\t\t\tscriptToAdd.addEventListener('load', setStateFromEvent)\n\t\t\tscriptToAdd.addEventListener('error', setStateFromEvent)\n\t\t\t// Remove event listeners on cleanup\n\t\t\treturn () => {\n\t\t\t\tif (scriptToAdd) {\n\t\t\t\t\tscriptToAdd.removeEventListener('load', setStateFromEvent)\n\t\t\t\t\tscriptToAdd.removeEventListener('error', setStateFromEvent)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Re-run useEffect if script changes\n\t\t[script]\n\t)\n\treturn status\n}\n","import { useScript } from \"./useScript\";\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [] }) => {\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t }\n\t\t: {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t};\n\n\treturn useScript(script);\n};\n","export const isArraysEqualEps = (arrayA, arrayB, eps) => {\n\tif (arrayA && arrayB) {\n\t\tfor (let i = 0; i !== arrayA.length; ++i) {\n\t\t\tif (Math.abs(arrayA[i] - arrayB[i]) > eps) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n","import { element, number, object, shape, string } from 'prop-types'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @param {google.maps} maps\n * @returns {void}\n */\nconst createOverlay = ({ container, pane, position, maps }) => {\n\tclass Overlay extends maps.OverlayView {\n\t\tconstructor(container, pane, position) {\n\t\t\tsuper()\n\t\t\tthis.container = container\n\t\t\tthis.pane = pane\n\t\t\tthis.position = position\n\t\t}\n\n\t\t/**\n\t\t * onAdd is called when the map's panes are ready and the overlay has been\n\t\t * added to the map.\n\t\t */\n\t\tonAdd = () => {\n\t\t\t// Add the element to the pane.\n\t\t\tconst pane = this.getPanes()[this.pane]\n\t\t\tpane?.classList.add('google-map-markers-overlay')\n\t\t\tpane?.appendChild(this.container)\n\t\t}\n\n\t\tdraw = () => {\n\t\t\tconst projection = this.getProjection()\n\t\t\t// Computes the pixel coordinates of the given geographical location in the DOM element that holds the draggable map.\n\t\t\tconst point = projection.fromLatLngToDivPixel(this.position)\n\t\t\tif (point === null) return\n\t\t\tthis.container.style.transform = `translate(${point.x}px, ${point.y}px)`\n\t\t}\n\n\t\t/**\n\t\t * The onRemove() method will be called automatically from the API if\n\t\t * we ever set the overlay's map property to 'null'.\n\t\t */\n\t\tonRemove = () => {\n\t\t\tif (this.container.parentNode !== null) {\n\t\t\t\tthis.container.parentNode.removeChild(this.container)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn new Overlay(container, pane, position)\n}\n\ncreateOverlay.propTypes = {\n\tcontainer: element.isRequired,\n\tpane: string.isRequired,\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport createOverlay from './overlay'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane - The pane on which to display the overlay. This is the Pane name, not the Pane itself. Defaults to floatPane.\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @returns {void}\n * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n */\nconst OverlayView = ({ position, pane = 'floatPane', map, maps, zIndex, children }) => {\n\tconst container = useMemo(() => {\n\t\tconst div = document.createElement('div')\n\t\tdiv.style.position = 'absolute'\n\t\treturn div\n\t}, [])\n\n\tconst overlay = useMemo(() => {\n\t\treturn createOverlay({ container, pane, position, maps })\n\t}, [container, maps, pane, position])\n\n\tuseEffect(() => {\n\t\tif (!overlay.map) {\n\t\t\toverlay?.setMap(map)\n\t\t\treturn () => {\n\t\t\t\toverlay?.setMap(null)\n\t\t\t}\n\t\t}\n\t\t// overlay depends on map, so we don't need to add it to the dependency array\n\t\t// otherwise, it will re-render the overlay every time the map changes\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map])\n\n\t// to move the container to the foreground and background\n\tuseEffect(() => {\n\t\tcontainer.style.zIndex = `${zIndex}`\n\t}, [zIndex, container])\n\n\treturn createPortal(children, container)\n}\n\nexport default OverlayView\n","import { node, object } from 'prop-types'\nimport { Children, isValidElement, useMemo } from 'react'\nimport OverlayView from './overlay-view'\n\nconst MapMarkers = ({ children, map, maps }) => {\n\tconst markers = useMemo(() => {\n\t\tif (!map || !maps) return []\n\n\t\treturn Children.map(children, (child) => {\n\t\t\tif (isValidElement(child)) {\n\t\t\t\tconst latLng = { lat: child.props.lat, lng: child.props.lng }\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t<OverlayView position={latLng} map={map} maps={maps}>\n\t\t\t\t\t\t{child}\n\t\t\t\t\t</OverlayView>\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn <div>{markers}</div>\n}\n\nMapMarkers.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t * @type {ReactNode}\n\t * @required\n\t */\n\tchildren: node.isRequired,\n\t/**\n\t * The Google Maps instance.\n\t * @type {object}\n\t * @required\n\t */\n\tmap: object,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default MapMarkers\n","import { arrayOf, func, node, number, object, oneOfType } from 'prop-types'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { isArraysEqualEps } from '../utils/utils'\nimport MapMarkers from './markers'\n\nconst EPS = 0.00001\n\nconst MapComponent = ({ children, style, defaultCenter, defaultZoom, onGoogleApiLoaded, onChange, ...props }) => {\n\tconst mapRef = useRef(null)\n\tconst prevBoundsRef = useRef(null)\n\tconst [map, setMap] = useState(null)\n\tconst [maps, setMaps] = useState(null)\n\tconst [googleApiCalled, setGoogleApiCalled] = useState(false)\n\n\tconst onIdle = useCallback(() => {\n\t\tconst zoom = map.getZoom()\n\t\tconst bounds = map.getBounds()\n\t\tconst centerLatLng = map.getCenter()\n\n\t\tconst ne = bounds.getNorthEast()\n\t\tconst sw = bounds.getSouthWest()\n\t\tconst boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]\n\n\t\tif (!isArraysEqualEps(boundsArray, prevBoundsRef.current, EPS)) {\n\t\t\tif (onChange) {\n\t\t\t\tonChange({\n\t\t\t\t\tzoom,\n\t\t\t\t\tcenter: [centerLatLng.lng(), centerLatLng.lat()],\n\t\t\t\t\tbounds,\n\t\t\t\t})\n\t\t\t}\n\t\t\tprevBoundsRef.current = boundsArray\n\t\t}\n\t}, [map, onChange])\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && !map) {\n\t\t\tsetMap(\n\t\t\t\tnew window.google.maps.Map(mapRef.current, {\n\t\t\t\t\tcenter: defaultCenter,\n\t\t\t\t\tzoom: defaultZoom,\n\t\t\t\t\t...props,\n\t\t\t\t})\n\t\t\t)\n\t\t\tsetMaps(window.google.maps)\n\t\t}\n\t}, [defaultCenter, defaultZoom, map, mapRef, props])\n\n\tuseEffect(() => {\n\t\tif (map) {\n\t\t\tif (!googleApiCalled) {\n\t\t\t\tonGoogleApiLoaded({ map, maps, ref: mapRef.current })\n\t\t\t\tsetGoogleApiCalled(true)\n\t\t\t}\n\n\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t// Idle event is fired when the map becomes idle after panning or zooming.\n\t\t\twindow.google.maps.event.addListener(map, 'idle', onIdle)\n\t\t}\n\t}, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle])\n\n\tuseEffect(() => {\n\t\t// clear listeners on unmount\n\t\treturn () => {\n\t\t\tif (map) {\n\t\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t}\n\t\t}\n\t}, [map])\n\n\treturn (\n\t\t<>\n\t\t\t<div ref={mapRef} style={style} className=\"google-map\" />\n\t\t\t{children && map && maps && (\n\t\t\t\t<MapMarkers map={map} maps={maps}>\n\t\t\t\t\t{children}\n\t\t\t\t</MapMarkers>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nMapComponent.defaultProps = {\n\tstyle: {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tmargin: 0,\n\t\tpadding: 0,\n\t\tposition: 'absolute',\n\t},\n\tonGoogleApiLoaded: () => {},\n\tonChange: () => {},\n}\n\nMapComponent.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([arrayOf(node), node]),\n\tstyle: object,\n\tdefaultCenter: object.isRequired,\n\tdefaultZoom: number.isRequired,\n\tonGoogleApiLoaded: func,\n\tonChange: func,\n}\n\nexport default MapComponent\n","import { arrayOf, node, number, object, oneOfType, string } from 'prop-types'\nimport { forwardRef } from 'react'\nimport { useGoogleMaps } from './hooks/useGoogleMaps'\nimport MapComponent from './map/map'\n\nconst GoogleMap = forwardRef(function GoogleMap(\n\t{ apiKey, libraries, children, loadingContent, idleContent, errorContent, mapMinHeight, containerProps, ...props },\n\tref\n) {\n\tconst status = useGoogleMaps({ apiKey, libraries })\n\treturn (\n\t\t<div\n\t\t\tstyle={{ height: '100%', width: '100%', overflow: 'hidden', position: 'relative', minHeight: mapMinHeight }}\n\t\t\tref={ref}\n\t\t\t{...containerProps}\n\t\t>\n\t\t\t{status === 'ready' ? (\n\t\t\t\t<MapComponent {...props}>{children}</MapComponent>\n\t\t\t) : status === 'loading' ? (\n\t\t\t\tloadingContent\n\t\t\t) : status === 'idle' ? (\n\t\t\t\tidleContent\n\t\t\t) : status === 'error' ? (\n\t\t\t\terrorContent\n\t\t\t) : null}\n\t\t</div>\n\t)\n})\n\nGoogleMap.defaultProps = {\n\t...MapComponent.defaultProps,\n\tloadingContent: 'Google Maps is loading',\n\tidleContent: 'Google Maps is on idle',\n\terrorContent: 'Google Maps is on error',\n\tmapMinHeight: 'unset',\n\tapiKey: '',\n\tlibraries: ['places', 'geometry'],\n}\n\nGoogleMap.propTypes = {\n\t...MapComponent.propTypes,\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([node, arrayOf(node)]),\n\t/**\n\t * Content to be displayed while the map is loading.\n\t */\n\tloadingContent: node,\n\t/**\n\t * Content to be displayed while the map is idle.\n\t */\n\tidleContent: node,\n\t/**\n\t * Content to be displayed when there is an error loading the map.\n\t */\n\terrorContent: node,\n\t/**\n\t * The minimum height of the map.\n\t */\n\tmapMinHeight: oneOfType([number, string]),\n\t/**\n\t * Props to be passed to the container div.\n\t */\n\tcontainerProps: object,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","useState","status","setStatus","useEffect","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","removeEventListener","useGoogleMaps","apiKey","libraries","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","createOverlay","container","pane","position","maps","Overlay","onAdd","getPanes","classList","add","draw","projection","getProjection","point","fromLatLngToDivPixel","style","transform","x","y","onRemove","parentNode","removeChild","OverlayView","propTypes","element","isRequired","string","shape","lat","number","lng","object","zIndex","children","useMemo","div","overlay","setMap","createPortal","MapMarkers","markers","Children","child","isValidElement","latLng","props","node","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","mapRef","useRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","current","center","window","google","Map","ref","clearListeners","addListener","defaultProps","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","overflow","minHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAMA,SAAS,GAAG,SAAZA,SAAS,CACrBC,MAAM,EAMF;EAAA,IANJA,MAAM;IAANA,MAAM,GAAG;MACRC,GAAG,EAAE,EAAE;MACPC,UAAU,EAAE,EAAE;MACdC,SAAS,EAAE;QAAEC,cAAc,EAAE,IAAI;QAAEC,eAAe,EAAE;OAAM;MAC1DC,iBAAiB,EAAE;KACnB;;EAGD,gBAA4BC,cAAQ,CAACP,MAAM,CAACC,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;IAA9DO,MAAM;IAAEC,SAAS;EAExBC,eAAS,CACR,YAAM;IAAA;IAGL,IAAI,CAACV,MAAM,CAACC,GAAG,EAAE;MAChBQ,SAAS,CAAC,MAAM,CAAC;MACjB;;IAID,IAAIE,WAAW,GAAGC,QAAQ,CAACC,aAAa,mBAAgBb,MAAM,CAACC,GAAG,SAAK;IACvE,IAAI,CAACU,WAAW,EAAE;MAEjBA,WAAW,GAAGC,QAAQ,CAACE,aAAa,CAAC,QAAQ,CAAC;MAC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MAAM,KAAK,OAAO,GACrBoI,YAAY,GACT,IAAI,CACH;AAER,CAAC,CAAC;AAEFJ,SAAS,CAACV,YAAY,gBAClBhC,YAAY,CAACgC,YAAY;EAC5BY,cAAc,EAAE,wBAAwB;EACxCC,WAAW,EAAE,wBAAwB;EACrCC,YAAY,EAAE,yBAAyB;EACvCC,YAAY,EAAE,OAAO;EACrB1G,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,CAAC,QAAQ,EAAE,UAAU;AAAC,EACjC;AAEDoG,SAAS,CAACnE,SAAS,gBACfyB,YAAY,CAACzB,SAAS;EAIzBU,QAAQ,EAAEsD,mBAAS,CAAC,CAACzC,cAAI,EAAE0C,iBAAO,CAAC1C,cAAI,CAAC,CAAC,CAAC;EAI1C8C,cAAc,EAAE9C,cAAI;EAIpB+C,WAAW,EAAE/C,cAAI;EAIjBgD,YAAY,EAAEhD,cAAI;EAIlBiD,YAAY,EAAER,mBAAS,CAAC,CAAC1D,gBAAM,EAAEH,gBAAM,CAAC,CAAC;EAIzCsE,cAAc,EAAEjE;AAAM,EACtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/map/overlay.js","../src/map/overlay-view.js","../src/map/markers.js","../src/map/map.js","../src/google-map.js"],"sourcesContent":["/* eslint-disable no-unused-expressions */\nimport { useState, useEffect } from 'react'\n\n/**\n * @description Hook to load external script.\n * @param {Object} script - Script to load.\n * @param {string} script.src - Script source.\n * @param {Object} [script.attributes] - Attributes to add to the script tag.\n * @param {Object} [script.callbacks] - Callbacks executed on completion.\n * @param {Function} [script.callbacks.onLoadCallback] - Callback executed on completion in case of success.\n * @param {Function} [script.callbacks.onErrorCallback] - Callbacks executed on completion in case of error.\n * @param {string} [script.elementIdToAppend] - HTML element id to append the script to. Default is HTML HEAD.\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n *\n * @example\n * const status = useScript({\n * \t\tsrc: \"https://script-to-load.js\",\n * \t\tattributes: { id: \"scriptId\", class: \"script-class\" },\n * \t\tcallbacks: {\n * \t\t\tonLoadCallback: onLoadFunc,\n * \t\t\tonErrorCallback: onErrorFunc,\n * \t\t},\n * \t\telementIdToAppend: \"script-container\"\n * })\n */\n\nexport const useScript = (\n\tscript = {\n\t\tsrc: '',\n\t\tattributes: {},\n\t\tcallbacks: { onLoadCallback: null, onErrorCallback: null },\n\t\telementIdToAppend: null,\n\t}\n) => {\n\t// Keep track of script status (\"idle\", \"loading\", \"ready\", \"error\")\n\tconst [status, setStatus] = useState(script.src ? 'loading' : 'idle')\n\n\tuseEffect(\n\t\t() => {\n\t\t\t// Allow falsy src value if waiting on other data needed for\n\t\t\t// constructing the script URL passed to this hook.\n\t\t\tif (!script.src) {\n\t\t\t\tsetStatus('idle')\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Fetch existing script element by src\n\t\t\t// It may have been added by another instance of this hook\n\t\t\tlet scriptToAdd = document.querySelector(`script[src=\"${script.src}\"]`)\n\t\t\tif (!scriptToAdd) {\n\t\t\t\t// Create script\n\t\t\t\tscriptToAdd = document.createElement('script')\n\t\t\t\tscriptToAdd.src = script.src\n\t\t\t\tscriptToAdd.async = true\n\t\t\t\tscriptToAdd.setAttribute('data-status', 'loading')\n\t\t\t\t// Add other script attributes, if they exist\n\t\t\t\tscript.attributes && Object.entries(script.attributes).length > 0\n\t\t\t\t\t? Object.entries(script.attributes).map(([key, value]) => scriptToAdd.setAttribute(key, value))\n\t\t\t\t\t: null\n\t\t\t\t// Add script to document body\n\t\t\t\tif (script.elementIdToAppend && document.getElementById(script.elementIdToAppend)) {\n\t\t\t\t\tdocument.getElementById(script.elementIdToAppend).appendChild(scriptToAdd)\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.appendChild(scriptToAdd)\n\t\t\t\t}\n\t\t\t\t// Store status in attribute on script\n\t\t\t\t// This can be read by other instances of this hook\n\t\t\t\tconst setAttributeFromEvent = (event) => {\n\t\t\t\t\tscriptToAdd.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error')\n\t\t\t\t}\n\t\t\t\tscriptToAdd.addEventListener('load', setAttributeFromEvent)\n\t\t\t\tscriptToAdd.addEventListener('error', setAttributeFromEvent)\n\t\t\t} else {\n\t\t\t\t// Grab existing script status from attribute and set to state.\n\t\t\t\tconst currentScriptStatus = scriptToAdd.getAttribute('data-status')\n\t\t\t\tswitch (currentScriptStatus) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'ready':\n\t\t\t\t\t\tscript.callbacks?.onLoadCallback ? script.callbacks.onLoadCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\tscript.callbacks?.onErrorCallback ? script.callbacks.onErrorCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// loading: do nothing\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tsetStatus(currentScriptStatus)\n\t\t\t}\n\t\t\t// Script event handler to update status in state\n\t\t\t// Note: Even if the script already exists we still need to add\n\t\t\t// event handlers to update the state for this hook instance.\n\t\t\tconst setStateFromEvent = (event) => {\n\t\t\t\tevent.type === 'load'\n\t\t\t\t\t? script.callbacks?.onLoadCallback\n\t\t\t\t\t\t? script.callbacks.onLoadCallback()\n\t\t\t\t\t\t: null\n\t\t\t\t\t: script.callbacks?.onErrorCallback\n\t\t\t\t\t? script.callbacks.onErrorCallback()\n\t\t\t\t\t: null\n\t\t\t\tsetStatus(event.type === 'load' ? 'ready' : 'error')\n\t\t\t}\n\t\t\t// Add event listeners\n\t\t\tscriptToAdd.addEventListener('load', setStateFromEvent)\n\t\t\tscriptToAdd.addEventListener('error', setStateFromEvent)\n\t\t\t// Remove event listeners on cleanup\n\t\t\treturn () => {\n\t\t\t\tif (scriptToAdd) {\n\t\t\t\t\tscriptToAdd.removeEventListener('load', setStateFromEvent)\n\t\t\t\t\tscriptToAdd.removeEventListener('error', setStateFromEvent)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Re-run useEffect if script changes\n\t\t[script]\n\t)\n\treturn status\n}\n","import { useScript } from \"./useScript\";\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [] }) => {\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t }\n\t\t: {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t};\n\n\treturn useScript(script);\n};\n","export const isArraysEqualEps = (arrayA, arrayB, eps) => {\n\tif (arrayA && arrayB) {\n\t\tfor (let i = 0; i !== arrayA.length; ++i) {\n\t\t\tif (Math.abs(arrayA[i] - arrayB[i]) > eps) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n","import { element, number, object, shape, string } from 'prop-types'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @param {google.maps} maps\n * @returns {void}\n */\nconst createOverlay = ({ container, pane, position, maps }) => {\n\tclass Overlay extends maps.OverlayView {\n\t\tconstructor(container, pane, position) {\n\t\t\tsuper()\n\t\t\tthis.container = container\n\t\t\tthis.pane = pane\n\t\t\tthis.position = position\n\t\t}\n\n\t\t/**\n\t\t * onAdd is called when the map's panes are ready and the overlay has been\n\t\t * added to the map.\n\t\t */\n\t\tonAdd = () => {\n\t\t\t// Add the element to the pane.\n\t\t\tconst pane = this.getPanes()[this.pane]\n\t\t\tpane?.classList.add('google-map-markers-overlay')\n\t\t\tpane?.appendChild(this.container)\n\t\t}\n\n\t\tdraw = () => {\n\t\t\tconst projection = this.getProjection()\n\t\t\t// Computes the pixel coordinates of the given geographical location in the DOM element that holds the draggable map.\n\t\t\tconst point = projection.fromLatLngToDivPixel(this.position)\n\t\t\tif (point === null) return\n\t\t\tthis.container.style.transform = `translate(${point.x}px, ${point.y}px)`\n\t\t}\n\n\t\t/**\n\t\t * The onRemove() method will be called automatically from the API if\n\t\t * we ever set the overlay's map property to 'null'.\n\t\t */\n\t\tonRemove = () => {\n\t\t\tif (this.container.parentNode !== null) {\n\t\t\t\tthis.container.parentNode.removeChild(this.container)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn new Overlay(container, pane, position)\n}\n\ncreateOverlay.propTypes = {\n\tcontainer: element.isRequired,\n\tpane: string.isRequired,\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport createOverlay from './overlay'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane - The pane on which to display the overlay. This is the Pane name, not the Pane itself. Defaults to floatPane.\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @returns {void}\n * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n */\nconst OverlayView = ({ position, pane = 'floatPane', map, maps, zIndex, children }) => {\n\tconst container = useMemo(() => {\n\t\t// eslint-disable-next-line no-undef\n\t\tconst div = document.createElement('div')\n\t\tdiv.style.position = 'absolute'\n\t\treturn div\n\t}, [])\n\n\tconst overlay = useMemo(() => {\n\t\treturn createOverlay({ container, pane, position, maps })\n\t}, [container, maps, pane, position])\n\n\tuseEffect(() => {\n\t\tif (!overlay.map) {\n\t\t\toverlay?.setMap(map)\n\t\t\treturn () => {\n\t\t\t\toverlay?.setMap(null)\n\t\t\t}\n\t\t}\n\t\t// overlay depends on map, so we don't need to add it to the dependency array\n\t\t// otherwise, it will re-render the overlay every time the map changes\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map])\n\n\t// to move the container to the foreground and background\n\tuseEffect(() => {\n\t\tcontainer.style.zIndex = `${zIndex}`\n\t}, [zIndex, container])\n\n\treturn createPortal(children, container)\n}\n\nexport default OverlayView\n","import { node, object } from 'prop-types'\nimport React, { Children, isValidElement, useMemo } from 'react'\nimport OverlayView from './overlay-view'\n\nconst MapMarkers = ({ children, map, maps }) => {\n\tconst markers = useMemo(() => {\n\t\tif (!map || !maps) return []\n\n\t\treturn Children.map(children, (child) => {\n\t\t\tif (isValidElement(child)) {\n\t\t\t\tconst latLng = { lat: child.props.lat, lng: child.props.lng }\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t<OverlayView position={latLng} map={map} maps={maps}>\n\t\t\t\t\t\t{child}\n\t\t\t\t\t</OverlayView>\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn <div>{markers}</div>\n}\n\nMapMarkers.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t * @type {ReactNode}\n\t * @required\n\t */\n\tchildren: node.isRequired,\n\t/**\n\t * The Google Maps instance.\n\t * @type {object}\n\t * @required\n\t */\n\tmap: object,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default MapMarkers\n","import { arrayOf, func, node, number, object, oneOfType } from 'prop-types'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { isArraysEqualEps } from '../utils/utils'\nimport MapMarkers from './markers'\n\nconst EPS = 0.00001\n\nconst MapComponent = ({ children, style, defaultCenter, defaultZoom, onGoogleApiLoaded, onChange, ...props }) => {\n\tconst mapRef = useRef(null)\n\tconst prevBoundsRef = useRef(null)\n\tconst [map, setMap] = useState(null)\n\tconst [maps, setMaps] = useState(null)\n\tconst [googleApiCalled, setGoogleApiCalled] = useState(false)\n\n\tconst onIdle = useCallback(() => {\n\t\tconst zoom = map.getZoom()\n\t\tconst bounds = map.getBounds()\n\t\tconst centerLatLng = map.getCenter()\n\n\t\tconst ne = bounds.getNorthEast()\n\t\tconst sw = bounds.getSouthWest()\n\t\tconst boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]\n\n\t\tif (!isArraysEqualEps(boundsArray, prevBoundsRef.current, EPS)) {\n\t\t\tif (onChange) {\n\t\t\t\tonChange({\n\t\t\t\t\tzoom,\n\t\t\t\t\tcenter: [centerLatLng.lng(), centerLatLng.lat()],\n\t\t\t\t\tbounds,\n\t\t\t\t})\n\t\t\t}\n\t\t\tprevBoundsRef.current = boundsArray\n\t\t}\n\t}, [map, onChange])\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && !map) {\n\t\t\tsetMap(\n\t\t\t\tnew window.google.maps.Map(mapRef.current, {\n\t\t\t\t\tcenter: defaultCenter,\n\t\t\t\t\tzoom: defaultZoom,\n\t\t\t\t\t...props,\n\t\t\t\t})\n\t\t\t)\n\t\t\tsetMaps(window.google.maps)\n\t\t}\n\t}, [defaultCenter, defaultZoom, map, mapRef, props])\n\n\tuseEffect(() => {\n\t\tif (map) {\n\t\t\tif (!googleApiCalled) {\n\t\t\t\tonGoogleApiLoaded({ map, maps, ref: mapRef.current })\n\t\t\t\tsetGoogleApiCalled(true)\n\t\t\t}\n\n\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t// Idle event is fired when the map becomes idle after panning or zooming.\n\t\t\twindow.google.maps.event.addListener(map, 'idle', onIdle)\n\t\t}\n\t}, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle])\n\n\tuseEffect(() => {\n\t\t// clear listeners on unmount\n\t\treturn () => {\n\t\t\tif (map) {\n\t\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t}\n\t\t}\n\t}, [map])\n\n\treturn (\n\t\t<React.Fragment>\n\t\t\t<div ref={mapRef} style={style} className=\"google-map\" />\n\t\t\t{children && map && maps && (\n\t\t\t\t<MapMarkers map={map} maps={maps}>\n\t\t\t\t\t{children}\n\t\t\t\t</MapMarkers>\n\t\t\t)}\n\t\t</React.Fragment>\n\t)\n}\n\nMapComponent.defaultProps = {\n\tstyle: {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tmargin: 0,\n\t\tpadding: 0,\n\t\tposition: 'absolute',\n\t},\n\tonGoogleApiLoaded: () => {},\n\tonChange: () => {},\n}\n\nMapComponent.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([arrayOf(node), node]),\n\tstyle: object,\n\tdefaultCenter: object.isRequired,\n\tdefaultZoom: number.isRequired,\n\tonGoogleApiLoaded: func,\n\tonChange: func,\n}\n\nexport default MapComponent\n","import { arrayOf, node, number, object, oneOfType, string } from 'prop-types'\nimport React, { forwardRef } from 'react'\nimport { useGoogleMaps } from './hooks/useGoogleMaps'\nimport MapComponent from './map/map'\n\nconst GoogleMap = forwardRef(function GoogleMap(\n\t{ apiKey, libraries, children, loadingContent, idleContent, errorContent, mapMinHeight, containerProps, ...props },\n\tref\n) {\n\tconst status = useGoogleMaps({ apiKey, libraries })\n\treturn (\n\t\t<div\n\t\t\tstyle={{ height: '100%', width: '100%', overflow: 'hidden', position: 'relative', minHeight: mapMinHeight }}\n\t\t\tref={ref}\n\t\t\t{...containerProps}\n\t\t>\n\t\t\t{status === 'ready' ? (\n\t\t\t\t<MapComponent {...props}>{children}</MapComponent>\n\t\t\t) : status === 'loading' ? (\n\t\t\t\tloadingContent\n\t\t\t) : status === 'idle' ? (\n\t\t\t\tidleContent\n\t\t\t) : status === 'error' ? (\n\t\t\t\terrorContent\n\t\t\t) : null}\n\t\t</div>\n\t)\n})\n\nGoogleMap.defaultProps = {\n\t...MapComponent.defaultProps,\n\tloadingContent: 'Google Maps is loading',\n\tidleContent: 'Google Maps is on idle',\n\terrorContent: 'Google Maps is on error',\n\tmapMinHeight: 'unset',\n\tapiKey: '',\n\tlibraries: ['places', 'geometry'],\n}\n\nGoogleMap.propTypes = {\n\t...MapComponent.propTypes,\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([node, arrayOf(node)]),\n\t/**\n\t * Content to be displayed while the map is loading.\n\t */\n\tloadingContent: node,\n\t/**\n\t * Content to be displayed while the map is idle.\n\t */\n\tidleContent: node,\n\t/**\n\t * Content to be displayed when there is an error loading the map.\n\t */\n\terrorContent: node,\n\t/**\n\t * The minimum height of the map.\n\t */\n\tmapMinHeight: oneOfType([number, string]),\n\t/**\n\t * Props to be passed to the container div.\n\t */\n\tcontainerProps: object,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","useState","status","setStatus","useEffect","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","removeEventListener","useGoogleMaps","apiKey","libraries","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","createOverlay","container","pane","position","maps","Overlay","onAdd","getPanes","classList","add","draw","projection","getProjection","point","fromLatLngToDivPixel","style","transform","x","y","onRemove","parentNode","removeChild","OverlayView","propTypes","element","isRequired","string","shape","lat","number","lng","object","zIndex","children","useMemo","div","overlay","setMap","createPortal","MapMarkers","markers","Children","child","isValidElement","latLng","props","React","node","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","mapRef","useRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","current","center","window","google","Map","ref","clearListeners","addListener","defaultProps","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","overflow","minHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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hD,cAAI;EAIlBiD,YAAY,EAAER,mBAAS,CAAC,CAAC3D,gBAAM,EAAEH,gBAAM,CAAC,CAAC;EAIzCuE,cAAc,EAAElE;AAAM,EACtB;;;;"}
|
package/dist/index.modern.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { element, string, shape, number, object, node, oneOfType, arrayOf, func } from 'prop-types';
|
|
2
|
-
import { useState, useEffect, useMemo, Children, isValidElement, useRef, useCallback, forwardRef } from 'react';
|
|
2
|
+
import React, { useState, useEffect, useMemo, Children, isValidElement, useRef, useCallback, forwardRef } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
|
|
5
5
|
function _extends() {
|
|
@@ -223,7 +223,7 @@ var OverlayView = function OverlayView(_ref) {
|
|
|
223
223
|
useEffect(function () {
|
|
224
224
|
container.style.zIndex = "" + zIndex;
|
|
225
225
|
}, [zIndex, container]);
|
|
226
|
-
return createPortal(children, container);
|
|
226
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
var MapMarkers = function MapMarkers(_ref) {
|
|
@@ -233,7 +233,7 @@ var MapMarkers = function MapMarkers(_ref) {
|
|
|
233
233
|
var markers = useMemo(function () {
|
|
234
234
|
if (!map || !maps) return [];
|
|
235
235
|
return Children.map(children, function (child) {
|
|
236
|
-
if (isValidElement(child)) {
|
|
236
|
+
if ( /*#__PURE__*/isValidElement(child)) {
|
|
237
237
|
var latLng = {
|
|
238
238
|
lat: child.props.lat,
|
|
239
239
|
lng: child.props.lng
|
|
@@ -323,7 +323,7 @@ var MapComponent = function MapComponent(_ref) {
|
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
325
|
}, [map]);
|
|
326
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
327
327
|
ref: mapRef,
|
|
328
328
|
style: style,
|
|
329
329
|
className: "google-map"
|
|
@@ -355,7 +355,7 @@ MapComponent.propTypes = {
|
|
|
355
355
|
};
|
|
356
356
|
|
|
357
357
|
var _excluded$1 = ["apiKey", "libraries", "children", "loadingContent", "idleContent", "errorContent", "mapMinHeight", "containerProps"];
|
|
358
|
-
var GoogleMap = forwardRef(function GoogleMap(_ref, ref) {
|
|
358
|
+
var GoogleMap = /*#__PURE__*/forwardRef(function GoogleMap(_ref, ref) {
|
|
359
359
|
var apiKey = _ref.apiKey,
|
|
360
360
|
libraries = _ref.libraries,
|
|
361
361
|
children = _ref.children,
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/map/overlay.js","../src/map/overlay-view.js","../src/map/markers.js","../src/map/map.js","../src/google-map.js"],"sourcesContent":["/* eslint-disable no-unused-expressions */\nimport { useState, useEffect } from 'react'\n\n/**\n * @description Hook to load external script.\n * @param {Object} script - Script to load.\n * @param {string} script.src - Script source.\n * @param {Object} [script.attributes] - Attributes to add to the script tag.\n * @param {Object} [script.callbacks] - Callbacks executed on completion.\n * @param {Function} [script.callbacks.onLoadCallback] - Callback executed on completion in case of success.\n * @param {Function} [script.callbacks.onErrorCallback] - Callbacks executed on completion in case of error.\n * @param {string} [script.elementIdToAppend] - HTML element id to append the script to. Default is HTML HEAD.\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n *\n * @example\n * const status = useScript({\n * \t\tsrc: \"https://script-to-load.js\",\n * \t\tattributes: { id: \"scriptId\", class: \"script-class\" },\n * \t\tcallbacks: {\n * \t\t\tonLoadCallback: onLoadFunc,\n * \t\t\tonErrorCallback: onErrorFunc,\n * \t\t},\n * \t\telementIdToAppend: \"script-container\"\n * })\n */\n\nexport const useScript = (\n\tscript = {\n\t\tsrc: '',\n\t\tattributes: {},\n\t\tcallbacks: { onLoadCallback: null, onErrorCallback: null },\n\t\telementIdToAppend: null,\n\t}\n) => {\n\t// Keep track of script status (\"idle\", \"loading\", \"ready\", \"error\")\n\tconst [status, setStatus] = useState(script.src ? 'loading' : 'idle')\n\n\tuseEffect(\n\t\t() => {\n\t\t\t// Allow falsy src value if waiting on other data needed for\n\t\t\t// constructing the script URL passed to this hook.\n\t\t\tif (!script.src) {\n\t\t\t\tsetStatus('idle')\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Fetch existing script element by src\n\t\t\t// It may have been added by another instance of this hook\n\t\t\tlet scriptToAdd = document.querySelector(`script[src=\"${script.src}\"]`)\n\t\t\tif (!scriptToAdd) {\n\t\t\t\t// Create script\n\t\t\t\tscriptToAdd = document.createElement('script')\n\t\t\t\tscriptToAdd.src = script.src\n\t\t\t\tscriptToAdd.async = true\n\t\t\t\tscriptToAdd.setAttribute('data-status', 'loading')\n\t\t\t\t// Add other script attributes, if they exist\n\t\t\t\tscript.attributes && Object.entries(script.attributes).length > 0\n\t\t\t\t\t? Object.entries(script.attributes).map(([key, value]) => scriptToAdd.setAttribute(key, value))\n\t\t\t\t\t: null\n\t\t\t\t// Add script to document body\n\t\t\t\tif (script.elementIdToAppend && document.getElementById(script.elementIdToAppend)) {\n\t\t\t\t\tdocument.getElementById(script.elementIdToAppend).appendChild(scriptToAdd)\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.appendChild(scriptToAdd)\n\t\t\t\t}\n\t\t\t\t// Store status in attribute on script\n\t\t\t\t// This can be read by other instances of this hook\n\t\t\t\tconst setAttributeFromEvent = (event) => {\n\t\t\t\t\tscriptToAdd.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error')\n\t\t\t\t}\n\t\t\t\tscriptToAdd.addEventListener('load', setAttributeFromEvent)\n\t\t\t\tscriptToAdd.addEventListener('error', setAttributeFromEvent)\n\t\t\t} else {\n\t\t\t\t// Grab existing script status from attribute and set to state.\n\t\t\t\tconst currentScriptStatus = scriptToAdd.getAttribute('data-status')\n\t\t\t\tswitch (currentScriptStatus) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'ready':\n\t\t\t\t\t\tscript.callbacks?.onLoadCallback ? script.callbacks.onLoadCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\tscript.callbacks?.onErrorCallback ? script.callbacks.onErrorCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// loading: do nothing\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tsetStatus(currentScriptStatus)\n\t\t\t}\n\t\t\t// Script event handler to update status in state\n\t\t\t// Note: Even if the script already exists we still need to add\n\t\t\t// event handlers to update the state for this hook instance.\n\t\t\tconst setStateFromEvent = (event) => {\n\t\t\t\tevent.type === 'load'\n\t\t\t\t\t? script.callbacks?.onLoadCallback\n\t\t\t\t\t\t? script.callbacks.onLoadCallback()\n\t\t\t\t\t\t: null\n\t\t\t\t\t: script.callbacks?.onErrorCallback\n\t\t\t\t\t? script.callbacks.onErrorCallback()\n\t\t\t\t\t: null\n\t\t\t\tsetStatus(event.type === 'load' ? 'ready' : 'error')\n\t\t\t}\n\t\t\t// Add event listeners\n\t\t\tscriptToAdd.addEventListener('load', setStateFromEvent)\n\t\t\tscriptToAdd.addEventListener('error', setStateFromEvent)\n\t\t\t// Remove event listeners on cleanup\n\t\t\treturn () => {\n\t\t\t\tif (scriptToAdd) {\n\t\t\t\t\tscriptToAdd.removeEventListener('load', setStateFromEvent)\n\t\t\t\t\tscriptToAdd.removeEventListener('error', setStateFromEvent)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Re-run useEffect if script changes\n\t\t[script]\n\t)\n\treturn status\n}\n","import { useScript } from \"./useScript\";\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [] }) => {\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t }\n\t\t: {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t};\n\n\treturn useScript(script);\n};\n","export const isArraysEqualEps = (arrayA, arrayB, eps) => {\n\tif (arrayA && arrayB) {\n\t\tfor (let i = 0; i !== arrayA.length; ++i) {\n\t\t\tif (Math.abs(arrayA[i] - arrayB[i]) > eps) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n","import { element, number, object, shape, string } from 'prop-types'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @param {google.maps} maps\n * @returns {void}\n */\nconst createOverlay = ({ container, pane, position, maps }) => {\n\tclass Overlay extends maps.OverlayView {\n\t\tconstructor(container, pane, position) {\n\t\t\tsuper()\n\t\t\tthis.container = container\n\t\t\tthis.pane = pane\n\t\t\tthis.position = position\n\t\t}\n\n\t\t/**\n\t\t * onAdd is called when the map's panes are ready and the overlay has been\n\t\t * added to the map.\n\t\t */\n\t\tonAdd = () => {\n\t\t\t// Add the element to the pane.\n\t\t\tconst pane = this.getPanes()[this.pane]\n\t\t\tpane?.classList.add('google-map-markers-overlay')\n\t\t\tpane?.appendChild(this.container)\n\t\t}\n\n\t\tdraw = () => {\n\t\t\tconst projection = this.getProjection()\n\t\t\t// Computes the pixel coordinates of the given geographical location in the DOM element that holds the draggable map.\n\t\t\tconst point = projection.fromLatLngToDivPixel(this.position)\n\t\t\tif (point === null) return\n\t\t\tthis.container.style.transform = `translate(${point.x}px, ${point.y}px)`\n\t\t}\n\n\t\t/**\n\t\t * The onRemove() method will be called automatically from the API if\n\t\t * we ever set the overlay's map property to 'null'.\n\t\t */\n\t\tonRemove = () => {\n\t\t\tif (this.container.parentNode !== null) {\n\t\t\t\tthis.container.parentNode.removeChild(this.container)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn new Overlay(container, pane, position)\n}\n\ncreateOverlay.propTypes = {\n\tcontainer: element.isRequired,\n\tpane: string.isRequired,\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport createOverlay from './overlay'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane - The pane on which to display the overlay. This is the Pane name, not the Pane itself. Defaults to floatPane.\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @returns {void}\n * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n */\nconst OverlayView = ({ position, pane = 'floatPane', map, maps, zIndex, children }) => {\n\tconst container = useMemo(() => {\n\t\tconst div = document.createElement('div')\n\t\tdiv.style.position = 'absolute'\n\t\treturn div\n\t}, [])\n\n\tconst overlay = useMemo(() => {\n\t\treturn createOverlay({ container, pane, position, maps })\n\t}, [container, maps, pane, position])\n\n\tuseEffect(() => {\n\t\tif (!overlay.map) {\n\t\t\toverlay?.setMap(map)\n\t\t\treturn () => {\n\t\t\t\toverlay?.setMap(null)\n\t\t\t}\n\t\t}\n\t\t// overlay depends on map, so we don't need to add it to the dependency array\n\t\t// otherwise, it will re-render the overlay every time the map changes\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map])\n\n\t// to move the container to the foreground and background\n\tuseEffect(() => {\n\t\tcontainer.style.zIndex = `${zIndex}`\n\t}, [zIndex, container])\n\n\treturn createPortal(children, container)\n}\n\nexport default OverlayView\n","import { node, object } from 'prop-types'\nimport { Children, isValidElement, useMemo } from 'react'\nimport OverlayView from './overlay-view'\n\nconst MapMarkers = ({ children, map, maps }) => {\n\tconst markers = useMemo(() => {\n\t\tif (!map || !maps) return []\n\n\t\treturn Children.map(children, (child) => {\n\t\t\tif (isValidElement(child)) {\n\t\t\t\tconst latLng = { lat: child.props.lat, lng: child.props.lng }\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t<OverlayView position={latLng} map={map} maps={maps}>\n\t\t\t\t\t\t{child}\n\t\t\t\t\t</OverlayView>\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn <div>{markers}</div>\n}\n\nMapMarkers.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t * @type {ReactNode}\n\t * @required\n\t */\n\tchildren: node.isRequired,\n\t/**\n\t * The Google Maps instance.\n\t * @type {object}\n\t * @required\n\t */\n\tmap: object,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default MapMarkers\n","import { arrayOf, func, node, number, object, oneOfType } from 'prop-types'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { isArraysEqualEps } from '../utils/utils'\nimport MapMarkers from './markers'\n\nconst EPS = 0.00001\n\nconst MapComponent = ({ children, style, defaultCenter, defaultZoom, onGoogleApiLoaded, onChange, ...props }) => {\n\tconst mapRef = useRef(null)\n\tconst prevBoundsRef = useRef(null)\n\tconst [map, setMap] = useState(null)\n\tconst [maps, setMaps] = useState(null)\n\tconst [googleApiCalled, setGoogleApiCalled] = useState(false)\n\n\tconst onIdle = useCallback(() => {\n\t\tconst zoom = map.getZoom()\n\t\tconst bounds = map.getBounds()\n\t\tconst centerLatLng = map.getCenter()\n\n\t\tconst ne = bounds.getNorthEast()\n\t\tconst sw = bounds.getSouthWest()\n\t\tconst boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]\n\n\t\tif (!isArraysEqualEps(boundsArray, prevBoundsRef.current, EPS)) {\n\t\t\tif (onChange) {\n\t\t\t\tonChange({\n\t\t\t\t\tzoom,\n\t\t\t\t\tcenter: [centerLatLng.lng(), centerLatLng.lat()],\n\t\t\t\t\tbounds,\n\t\t\t\t})\n\t\t\t}\n\t\t\tprevBoundsRef.current = boundsArray\n\t\t}\n\t}, [map, onChange])\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && !map) {\n\t\t\tsetMap(\n\t\t\t\tnew window.google.maps.Map(mapRef.current, {\n\t\t\t\t\tcenter: defaultCenter,\n\t\t\t\t\tzoom: defaultZoom,\n\t\t\t\t\t...props,\n\t\t\t\t})\n\t\t\t)\n\t\t\tsetMaps(window.google.maps)\n\t\t}\n\t}, [defaultCenter, defaultZoom, map, mapRef, props])\n\n\tuseEffect(() => {\n\t\tif (map) {\n\t\t\tif (!googleApiCalled) {\n\t\t\t\tonGoogleApiLoaded({ map, maps, ref: mapRef.current })\n\t\t\t\tsetGoogleApiCalled(true)\n\t\t\t}\n\n\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t// Idle event is fired when the map becomes idle after panning or zooming.\n\t\t\twindow.google.maps.event.addListener(map, 'idle', onIdle)\n\t\t}\n\t}, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle])\n\n\tuseEffect(() => {\n\t\t// clear listeners on unmount\n\t\treturn () => {\n\t\t\tif (map) {\n\t\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t}\n\t\t}\n\t}, [map])\n\n\treturn (\n\t\t<>\n\t\t\t<div ref={mapRef} style={style} className=\"google-map\" />\n\t\t\t{children && map && maps && (\n\t\t\t\t<MapMarkers map={map} maps={maps}>\n\t\t\t\t\t{children}\n\t\t\t\t</MapMarkers>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nMapComponent.defaultProps = {\n\tstyle: {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tmargin: 0,\n\t\tpadding: 0,\n\t\tposition: 'absolute',\n\t},\n\tonGoogleApiLoaded: () => {},\n\tonChange: () => {},\n}\n\nMapComponent.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([arrayOf(node), node]),\n\tstyle: object,\n\tdefaultCenter: object.isRequired,\n\tdefaultZoom: number.isRequired,\n\tonGoogleApiLoaded: func,\n\tonChange: func,\n}\n\nexport default MapComponent\n","import { arrayOf, node, number, object, oneOfType, string } from 'prop-types'\nimport { forwardRef } from 'react'\nimport { useGoogleMaps } from './hooks/useGoogleMaps'\nimport MapComponent from './map/map'\n\nconst GoogleMap = forwardRef(function GoogleMap(\n\t{ apiKey, libraries, children, loadingContent, idleContent, errorContent, mapMinHeight, containerProps, ...props },\n\tref\n) {\n\tconst status = useGoogleMaps({ apiKey, libraries })\n\treturn (\n\t\t<div\n\t\t\tstyle={{ height: '100%', width: '100%', overflow: 'hidden', position: 'relative', minHeight: mapMinHeight }}\n\t\t\tref={ref}\n\t\t\t{...containerProps}\n\t\t>\n\t\t\t{status === 'ready' ? (\n\t\t\t\t<MapComponent {...props}>{children}</MapComponent>\n\t\t\t) : status === 'loading' ? (\n\t\t\t\tloadingContent\n\t\t\t) : status === 'idle' ? (\n\t\t\t\tidleContent\n\t\t\t) : status === 'error' ? (\n\t\t\t\terrorContent\n\t\t\t) : null}\n\t\t</div>\n\t)\n})\n\nGoogleMap.defaultProps = {\n\t...MapComponent.defaultProps,\n\tloadingContent: 'Google Maps is loading',\n\tidleContent: 'Google Maps is on idle',\n\terrorContent: 'Google Maps is on error',\n\tmapMinHeight: 'unset',\n\tapiKey: '',\n\tlibraries: ['places', 'geometry'],\n}\n\nGoogleMap.propTypes = {\n\t...MapComponent.propTypes,\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([node, arrayOf(node)]),\n\t/**\n\t * Content to be displayed while the map is loading.\n\t */\n\tloadingContent: node,\n\t/**\n\t * Content to be displayed while the map is idle.\n\t */\n\tidleContent: node,\n\t/**\n\t * Content to be displayed when there is an error loading the map.\n\t */\n\terrorContent: node,\n\t/**\n\t * The minimum height of the map.\n\t */\n\tmapMinHeight: oneOfType([number, string]),\n\t/**\n\t * Props to be passed to the container div.\n\t */\n\tcontainerProps: object,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","useState","status","setStatus","useEffect","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","removeEventListener","useGoogleMaps","apiKey","libraries","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","createOverlay","container","pane","position","maps","Overlay","onAdd","getPanes","classList","add","draw","projection","getProjection","point","fromLatLngToDivPixel","style","transform","x","y","onRemove","parentNode","removeChild","OverlayView","propTypes","element","isRequired","string","shape","lat","number","lng","object","zIndex","children","useMemo","div","overlay","setMap","createPortal","MapMarkers","markers","Children","child","isValidElement","latLng","props","node","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","mapRef","useRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","current","center","window","google","Map","ref","clearListeners","addListener","defaultProps","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","overflow","minHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAMA,SAAS,GAAG,SAAZA,SAAS,CACrBC,MAAM,EAMF;EAAA,IANJA,MAAM;IAANA,MAAM,GAAG;MACRC,GAAG,EAAE,EAAE;MACPC,UAAU,EAAE,EAAE;MACdC,SAAS,EAAE;QAAEC,cAAc,EAAE,IAAI;QAAEC,eAAe,EAAE;OAAM;MAC1DC,iBAAiB,EAAE;KACnB;;EAGD,gBAA4BC,QAAQ,CAACP,MAAM,CAACC,GAAG,GAAG,SAA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ED,KAAK,EAAE,MAAM;MAAEgB,QAAQ,EAAE,QAAQ;MAAE9F,QAAQ,EAAE,UAAU;MAAE+F,SAAS,EAAEH;KAAe;IAC5G,GAAG,EAAElB;KACDmB,cAAc,GAEjBtI,MAAM,KAAK,OAAO,gBAClB,oBAAC,YAAY,EAAKmF,KAAK,EAAGZ,QAAQ,CAAgB,GAC/CvE,MAAM,KAAK,SAAS,GACvBkI,cAAc,GACXlI,MAAM,KAAK,MAAM,GACpBmI,WAAW,GACRnI,MAAM,KAAK,OAAO,GACrBoI,YAAY,GACT,IAAI,CACH;AAER,CAAC,CAAC;AAEFJ,SAAS,CAACV,YAAY,gBAClBhC,YAAY,CAACgC,YAAY;EAC5BY,cAAc,EAAE,wBAAwB;EACxCC,WAAW,EAAE,wBAAwB;EACrCC,YAAY,EAAE,yBAAyB;EACvCC,YAAY,EAAE,OAAO;EACrB1G,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,CAAC,QAAQ,EAAE,UAAU;AAAC,EACjC;AAEDoG,SAAS,CAACnE,SAAS,gBACfyB,YAAY,CAACzB,SAAS;EAIzBU,QAAQ,EAAEsD,SAAS,CAAC,CAACzC,IAAI,EAAE0C,OAAO,CAAC1C,IAAI,CAAC,CAAC,CAAC;EAI1C8C,cAAc,EAAE9C,IAAI;EAIpB+C,WAAW,EAAE/C,IAAI;EAIjBgD,YAAY,EAAEhD,IAAI;EAIlBiD,YAAY,EAAER,SAAS,CAAC,CAAC1D,MAAM,EAAEH,MAAM,CAAC,CAAC;EAIzCsE,cAAc,EAAEjE;AAAM,EACtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/map/overlay.js","../src/map/overlay-view.js","../src/map/markers.js","../src/map/map.js","../src/google-map.js"],"sourcesContent":["/* eslint-disable no-unused-expressions */\nimport { useState, useEffect } from 'react'\n\n/**\n * @description Hook to load external script.\n * @param {Object} script - Script to load.\n * @param {string} script.src - Script source.\n * @param {Object} [script.attributes] - Attributes to add to the script tag.\n * @param {Object} [script.callbacks] - Callbacks executed on completion.\n * @param {Function} [script.callbacks.onLoadCallback] - Callback executed on completion in case of success.\n * @param {Function} [script.callbacks.onErrorCallback] - Callbacks executed on completion in case of error.\n * @param {string} [script.elementIdToAppend] - HTML element id to append the script to. Default is HTML HEAD.\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n *\n * @example\n * const status = useScript({\n * \t\tsrc: \"https://script-to-load.js\",\n * \t\tattributes: { id: \"scriptId\", class: \"script-class\" },\n * \t\tcallbacks: {\n * \t\t\tonLoadCallback: onLoadFunc,\n * \t\t\tonErrorCallback: onErrorFunc,\n * \t\t},\n * \t\telementIdToAppend: \"script-container\"\n * })\n */\n\nexport const useScript = (\n\tscript = {\n\t\tsrc: '',\n\t\tattributes: {},\n\t\tcallbacks: { onLoadCallback: null, onErrorCallback: null },\n\t\telementIdToAppend: null,\n\t}\n) => {\n\t// Keep track of script status (\"idle\", \"loading\", \"ready\", \"error\")\n\tconst [status, setStatus] = useState(script.src ? 'loading' : 'idle')\n\n\tuseEffect(\n\t\t() => {\n\t\t\t// Allow falsy src value if waiting on other data needed for\n\t\t\t// constructing the script URL passed to this hook.\n\t\t\tif (!script.src) {\n\t\t\t\tsetStatus('idle')\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Fetch existing script element by src\n\t\t\t// It may have been added by another instance of this hook\n\t\t\tlet scriptToAdd = document.querySelector(`script[src=\"${script.src}\"]`)\n\t\t\tif (!scriptToAdd) {\n\t\t\t\t// Create script\n\t\t\t\tscriptToAdd = document.createElement('script')\n\t\t\t\tscriptToAdd.src = script.src\n\t\t\t\tscriptToAdd.async = true\n\t\t\t\tscriptToAdd.setAttribute('data-status', 'loading')\n\t\t\t\t// Add other script attributes, if they exist\n\t\t\t\tscript.attributes && Object.entries(script.attributes).length > 0\n\t\t\t\t\t? Object.entries(script.attributes).map(([key, value]) => scriptToAdd.setAttribute(key, value))\n\t\t\t\t\t: null\n\t\t\t\t// Add script to document body\n\t\t\t\tif (script.elementIdToAppend && document.getElementById(script.elementIdToAppend)) {\n\t\t\t\t\tdocument.getElementById(script.elementIdToAppend).appendChild(scriptToAdd)\n\t\t\t\t} else {\n\t\t\t\t\tdocument.body.appendChild(scriptToAdd)\n\t\t\t\t}\n\t\t\t\t// Store status in attribute on script\n\t\t\t\t// This can be read by other instances of this hook\n\t\t\t\tconst setAttributeFromEvent = (event) => {\n\t\t\t\t\tscriptToAdd.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error')\n\t\t\t\t}\n\t\t\t\tscriptToAdd.addEventListener('load', setAttributeFromEvent)\n\t\t\t\tscriptToAdd.addEventListener('error', setAttributeFromEvent)\n\t\t\t} else {\n\t\t\t\t// Grab existing script status from attribute and set to state.\n\t\t\t\tconst currentScriptStatus = scriptToAdd.getAttribute('data-status')\n\t\t\t\tswitch (currentScriptStatus) {\n\t\t\t\t\tcase 'load':\n\t\t\t\t\tcase 'ready':\n\t\t\t\t\t\tscript.callbacks?.onLoadCallback ? script.callbacks.onLoadCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\tscript.callbacks?.onErrorCallback ? script.callbacks.onErrorCallback() : null\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// loading: do nothing\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tsetStatus(currentScriptStatus)\n\t\t\t}\n\t\t\t// Script event handler to update status in state\n\t\t\t// Note: Even if the script already exists we still need to add\n\t\t\t// event handlers to update the state for this hook instance.\n\t\t\tconst setStateFromEvent = (event) => {\n\t\t\t\tevent.type === 'load'\n\t\t\t\t\t? script.callbacks?.onLoadCallback\n\t\t\t\t\t\t? script.callbacks.onLoadCallback()\n\t\t\t\t\t\t: null\n\t\t\t\t\t: script.callbacks?.onErrorCallback\n\t\t\t\t\t? script.callbacks.onErrorCallback()\n\t\t\t\t\t: null\n\t\t\t\tsetStatus(event.type === 'load' ? 'ready' : 'error')\n\t\t\t}\n\t\t\t// Add event listeners\n\t\t\tscriptToAdd.addEventListener('load', setStateFromEvent)\n\t\t\tscriptToAdd.addEventListener('error', setStateFromEvent)\n\t\t\t// Remove event listeners on cleanup\n\t\t\treturn () => {\n\t\t\t\tif (scriptToAdd) {\n\t\t\t\t\tscriptToAdd.removeEventListener('load', setStateFromEvent)\n\t\t\t\t\tscriptToAdd.removeEventListener('error', setStateFromEvent)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Re-run useEffect if script changes\n\t\t[script]\n\t)\n\treturn status\n}\n","import { useScript } from \"./useScript\";\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [] }) => {\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t }\n\t\t: {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?libraries=${libraries?.join(\",\")}`,\n\t\t\t\tattributes: { id: \"googleMapsApi\" },\n\t\t};\n\n\treturn useScript(script);\n};\n","export const isArraysEqualEps = (arrayA, arrayB, eps) => {\n\tif (arrayA && arrayB) {\n\t\tfor (let i = 0; i !== arrayA.length; ++i) {\n\t\t\tif (Math.abs(arrayA[i] - arrayB[i]) > eps) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}\n","import { element, number, object, shape, string } from 'prop-types'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @param {google.maps} maps\n * @returns {void}\n */\nconst createOverlay = ({ container, pane, position, maps }) => {\n\tclass Overlay extends maps.OverlayView {\n\t\tconstructor(container, pane, position) {\n\t\t\tsuper()\n\t\t\tthis.container = container\n\t\t\tthis.pane = pane\n\t\t\tthis.position = position\n\t\t}\n\n\t\t/**\n\t\t * onAdd is called when the map's panes are ready and the overlay has been\n\t\t * added to the map.\n\t\t */\n\t\tonAdd = () => {\n\t\t\t// Add the element to the pane.\n\t\t\tconst pane = this.getPanes()[this.pane]\n\t\t\tpane?.classList.add('google-map-markers-overlay')\n\t\t\tpane?.appendChild(this.container)\n\t\t}\n\n\t\tdraw = () => {\n\t\t\tconst projection = this.getProjection()\n\t\t\t// Computes the pixel coordinates of the given geographical location in the DOM element that holds the draggable map.\n\t\t\tconst point = projection.fromLatLngToDivPixel(this.position)\n\t\t\tif (point === null) return\n\t\t\tthis.container.style.transform = `translate(${point.x}px, ${point.y}px)`\n\t\t}\n\n\t\t/**\n\t\t * The onRemove() method will be called automatically from the API if\n\t\t * we ever set the overlay's map property to 'null'.\n\t\t */\n\t\tonRemove = () => {\n\t\t\tif (this.container.parentNode !== null) {\n\t\t\t\tthis.container.parentNode.removeChild(this.container)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn new Overlay(container, pane, position)\n}\n\ncreateOverlay.propTypes = {\n\tcontainer: element.isRequired,\n\tpane: string.isRequired,\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport createOverlay from './overlay'\n\n/**\n * @param {HTMLElement} container\n * @param {google.maps.MapPanes} pane - The pane on which to display the overlay. This is the Pane name, not the Pane itself. Defaults to floatPane.\n * @param {google.maps.LatLng | google.maps.LatLngLiteral} position\n * @returns {void}\n * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n */\nconst OverlayView = ({ position, pane = 'floatPane', map, maps, zIndex, children }) => {\n\tconst container = useMemo(() => {\n\t\t// eslint-disable-next-line no-undef\n\t\tconst div = document.createElement('div')\n\t\tdiv.style.position = 'absolute'\n\t\treturn div\n\t}, [])\n\n\tconst overlay = useMemo(() => {\n\t\treturn createOverlay({ container, pane, position, maps })\n\t}, [container, maps, pane, position])\n\n\tuseEffect(() => {\n\t\tif (!overlay.map) {\n\t\t\toverlay?.setMap(map)\n\t\t\treturn () => {\n\t\t\t\toverlay?.setMap(null)\n\t\t\t}\n\t\t}\n\t\t// overlay depends on map, so we don't need to add it to the dependency array\n\t\t// otherwise, it will re-render the overlay every time the map changes\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map])\n\n\t// to move the container to the foreground and background\n\tuseEffect(() => {\n\t\tcontainer.style.zIndex = `${zIndex}`\n\t}, [zIndex, container])\n\n\treturn createPortal(children, container)\n}\n\nexport default OverlayView\n","import { node, object } from 'prop-types'\nimport React, { Children, isValidElement, useMemo } from 'react'\nimport OverlayView from './overlay-view'\n\nconst MapMarkers = ({ children, map, maps }) => {\n\tconst markers = useMemo(() => {\n\t\tif (!map || !maps) return []\n\n\t\treturn Children.map(children, (child) => {\n\t\t\tif (isValidElement(child)) {\n\t\t\t\tconst latLng = { lat: child.props.lat, lng: child.props.lng }\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t<OverlayView position={latLng} map={map} maps={maps}>\n\t\t\t\t\t\t{child}\n\t\t\t\t\t</OverlayView>\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn <div>{markers}</div>\n}\n\nMapMarkers.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t * @type {ReactNode}\n\t * @required\n\t */\n\tchildren: node.isRequired,\n\t/**\n\t * The Google Maps instance.\n\t * @type {object}\n\t * @required\n\t */\n\tmap: object,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default MapMarkers\n","import { arrayOf, func, node, number, object, oneOfType } from 'prop-types'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { isArraysEqualEps } from '../utils/utils'\nimport MapMarkers from './markers'\n\nconst EPS = 0.00001\n\nconst MapComponent = ({ children, style, defaultCenter, defaultZoom, onGoogleApiLoaded, onChange, ...props }) => {\n\tconst mapRef = useRef(null)\n\tconst prevBoundsRef = useRef(null)\n\tconst [map, setMap] = useState(null)\n\tconst [maps, setMaps] = useState(null)\n\tconst [googleApiCalled, setGoogleApiCalled] = useState(false)\n\n\tconst onIdle = useCallback(() => {\n\t\tconst zoom = map.getZoom()\n\t\tconst bounds = map.getBounds()\n\t\tconst centerLatLng = map.getCenter()\n\n\t\tconst ne = bounds.getNorthEast()\n\t\tconst sw = bounds.getSouthWest()\n\t\tconst boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]\n\n\t\tif (!isArraysEqualEps(boundsArray, prevBoundsRef.current, EPS)) {\n\t\t\tif (onChange) {\n\t\t\t\tonChange({\n\t\t\t\t\tzoom,\n\t\t\t\t\tcenter: [centerLatLng.lng(), centerLatLng.lat()],\n\t\t\t\t\tbounds,\n\t\t\t\t})\n\t\t\t}\n\t\t\tprevBoundsRef.current = boundsArray\n\t\t}\n\t}, [map, onChange])\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && !map) {\n\t\t\tsetMap(\n\t\t\t\tnew window.google.maps.Map(mapRef.current, {\n\t\t\t\t\tcenter: defaultCenter,\n\t\t\t\t\tzoom: defaultZoom,\n\t\t\t\t\t...props,\n\t\t\t\t})\n\t\t\t)\n\t\t\tsetMaps(window.google.maps)\n\t\t}\n\t}, [defaultCenter, defaultZoom, map, mapRef, props])\n\n\tuseEffect(() => {\n\t\tif (map) {\n\t\t\tif (!googleApiCalled) {\n\t\t\t\tonGoogleApiLoaded({ map, maps, ref: mapRef.current })\n\t\t\t\tsetGoogleApiCalled(true)\n\t\t\t}\n\n\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t// Idle event is fired when the map becomes idle after panning or zooming.\n\t\t\twindow.google.maps.event.addListener(map, 'idle', onIdle)\n\t\t}\n\t}, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle])\n\n\tuseEffect(() => {\n\t\t// clear listeners on unmount\n\t\treturn () => {\n\t\t\tif (map) {\n\t\t\t\twindow.google.maps.event.clearListeners(map, 'idle')\n\t\t\t}\n\t\t}\n\t}, [map])\n\n\treturn (\n\t\t<React.Fragment>\n\t\t\t<div ref={mapRef} style={style} className=\"google-map\" />\n\t\t\t{children && map && maps && (\n\t\t\t\t<MapMarkers map={map} maps={maps}>\n\t\t\t\t\t{children}\n\t\t\t\t</MapMarkers>\n\t\t\t)}\n\t\t</React.Fragment>\n\t)\n}\n\nMapComponent.defaultProps = {\n\tstyle: {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t\tleft: 0,\n\t\ttop: 0,\n\t\tmargin: 0,\n\t\tpadding: 0,\n\t\tposition: 'absolute',\n\t},\n\tonGoogleApiLoaded: () => {},\n\tonChange: () => {},\n}\n\nMapComponent.propTypes = {\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([arrayOf(node), node]),\n\tstyle: object,\n\tdefaultCenter: object.isRequired,\n\tdefaultZoom: number.isRequired,\n\tonGoogleApiLoaded: func,\n\tonChange: func,\n}\n\nexport default MapComponent\n","import { arrayOf, node, number, object, oneOfType, string } from 'prop-types'\nimport React, { forwardRef } from 'react'\nimport { useGoogleMaps } from './hooks/useGoogleMaps'\nimport MapComponent from './map/map'\n\nconst GoogleMap = forwardRef(function GoogleMap(\n\t{ apiKey, libraries, children, loadingContent, idleContent, errorContent, mapMinHeight, containerProps, ...props },\n\tref\n) {\n\tconst status = useGoogleMaps({ apiKey, libraries })\n\treturn (\n\t\t<div\n\t\t\tstyle={{ height: '100%', width: '100%', overflow: 'hidden', position: 'relative', minHeight: mapMinHeight }}\n\t\t\tref={ref}\n\t\t\t{...containerProps}\n\t\t>\n\t\t\t{status === 'ready' ? (\n\t\t\t\t<MapComponent {...props}>{children}</MapComponent>\n\t\t\t) : status === 'loading' ? (\n\t\t\t\tloadingContent\n\t\t\t) : status === 'idle' ? (\n\t\t\t\tidleContent\n\t\t\t) : status === 'error' ? (\n\t\t\t\terrorContent\n\t\t\t) : null}\n\t\t</div>\n\t)\n})\n\nGoogleMap.defaultProps = {\n\t...MapComponent.defaultProps,\n\tloadingContent: 'Google Maps is loading',\n\tidleContent: 'Google Maps is on idle',\n\terrorContent: 'Google Maps is on error',\n\tmapMinHeight: 'unset',\n\tapiKey: '',\n\tlibraries: ['places', 'geometry'],\n}\n\nGoogleMap.propTypes = {\n\t...MapComponent.propTypes,\n\t/**\n\t * The Markers on the Map.\n\t */\n\tchildren: oneOfType([node, arrayOf(node)]),\n\t/**\n\t * Content to be displayed while the map is loading.\n\t */\n\tloadingContent: node,\n\t/**\n\t * Content to be displayed while the map is idle.\n\t */\n\tidleContent: node,\n\t/**\n\t * Content to be displayed when there is an error loading the map.\n\t */\n\terrorContent: node,\n\t/**\n\t * The minimum height of the map.\n\t */\n\tmapMinHeight: oneOfType([number, string]),\n\t/**\n\t * Props to be passed to the container div.\n\t */\n\tcontainerProps: object,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","useState","status","setStatus","useEffect","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","removeEventListener","useGoogleMaps","apiKey","libraries","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","createOverlay","container","pane","position","maps","Overlay","onAdd","getPanes","classList","add","draw","projection","getProjection","point","fromLatLngToDivPixel","style","transform","x","y","onRemove","parentNode","removeChild","OverlayView","propTypes","element","isRequired","string","shape","lat","number","lng","object","zIndex","children","useMemo","div","overlay","setMap","createPortal","MapMarkers","markers","Children","child","isValidElement","latLng","props","node","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","mapRef","useRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","current","center","window","google","Map","ref","clearListeners","addListener","defaultProps","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","overflow","minHeight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAMA,SAAS,GAAG,SAAZA,SAAS,CACrBC,MAAM,EAMF;EAAA,IANJA,MAAM;IAANA,MAAM,GAAG;MACRC,GAAG,EAAE,EAAE;MACPC,UAAU,EAAE,EAAE;MACdC,SAAS,EAAE;QAAEC,cAAc,EAAE,IAAI;QAAEC,eAAe,EAAE;OAAM;MAC1DC,iBAAiB,EAAE;KACnB;;EAGD,gBAA4BC,QAAQ,CAACP,MAAM,CAACC,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;IAA9DO,MAAM;IAAEC,SAAS;EAExBC,SAAS,CACR,YAAM;IAAA;IAGL,IAAI,CAACV,MAAM,CAACC,GAAG,EAAE;MAChBQ,SAAS,CAAC,MAAM,CAAC;MACjB;;IAID,IAAIE,WAAW,GAAGC,QAAQ,CAACC,aAAa,mBAAgBb,MAAM,CAACC,GAAG,SAAK;IACvE,IAAI,CAACU,WAAW,EAAE;MAEjBA,WAAW,GAAGC,QAAQ,CAACE,aAAa,CAAC,QAAQ,CAAC;MAC9CH,WAAW,CAACV,GAAG,GAAGD,MAAM,CAACC,GAAG;MAC5BU,WAAW,CAACI,KAAK,GAAG,IAAI;MACxBJ,WAAW,CAACK,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC;MAElDhB,MAAM,CAACE,UAAU,IAAIe,MAAM,CAACC,OAAO,CAAClB,MAAM,CAACE,UAAU,CAAC,CAACiB,MAAM,GAAG,CAAC,GAC9DF,MAAM,CAACC,OAAO,CAAClB,MAAM,CA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AAQ,EAAE,UAAU;AAAC,EACjC;AAEDoG,SAAS,CAACnE,SAAS,gBACfyB,YAAY,CAACzB,SAAS;EAIzBU,QAAQ,EAAEsD,SAAS,CAAC,CAACzC,IAAI,EAAE0C,OAAO,CAAC1C,IAAI,CAAC,CAAC,CAAC;EAI1C8C,cAAc,EAAE9C,IAAI;EAIpB+C,WAAW,EAAE/C,IAAI;EAIjBgD,YAAY,EAAEhD,IAAI;EAIlBiD,YAAY,EAAER,SAAS,CAAC,CAAC1D,MAAM,EAAEH,MAAM,CAAC,CAAC;EAIzCsE,cAAc,EAAEjE;AAAM,EACtB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-maps-react-markers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Google Maps library with markers as react components",
|
|
5
5
|
"author": "Giorgia Bosello",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"react-dom": "^18.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@babel/
|
|
43
|
+
"@babel/core": "^7.20.2",
|
|
44
|
+
"@babel/preset-env": "^7.20.2",
|
|
44
45
|
"@babel/preset-react": "^7.18.6",
|
|
45
46
|
"babel-eslint": "^10.0.3",
|
|
46
47
|
"cross-env": "^7.0.2",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"eslint-plugin-prettier": "^4.2.1",
|
|
54
55
|
"eslint-plugin-promise": "^6.1.1",
|
|
55
56
|
"eslint-plugin-react": "^7.17.0",
|
|
57
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
56
58
|
"eslint-plugin-standard": "^5.0.0",
|
|
57
59
|
"gh-pages": "^4.0.0",
|
|
58
60
|
"microbundle-crl": "^0.13.10",
|