From 77a1808a2bb1af551f3d8d4391216adb54ac3386 Mon Sep 17 00:00:00 2001 From: Giorgia Bosellom Date: Mon, 6 Mar 2023 15:56:51 +0100 Subject: [PATCH] :arrow_up: upgrade dependencies --- dist/index.js | 10 +- dist/index.js.map | 2 +- dist/index.modern.js | 371 ++++++++++++++++----------------------- dist/index.modern.js.map | 2 +- docs/package.json | 2 +- package.json | 4 +- 6 files changed, 161 insertions(+), 230 deletions(-) diff --git a/dist/index.js b/dist/index.js index 668922d..b716d98 100644 --- a/dist/index.js +++ b/dist/index.js @@ -66,8 +66,7 @@ var useScript = function useScript(script, forcedStatus) { var _script$callbacks, _script$callbacks2; if (forcedStatus) { setStatus(forcedStatus); - return function () { - }; + return function () {}; } if (!script.src) { setStatus('idle'); @@ -120,8 +119,7 @@ var useScript = function useScript(script, forcedStatus) { scriptToAdd.removeEventListener('error', setStateFromEvent); } }; - }, - [script, forcedStatus, status]); + }, [script, forcedStatus, status]); return status; }; @@ -204,7 +202,6 @@ var createOverlay = function createOverlay(_ref) { _this.position = position; return _this; } - return Overlay; }(maps.OverlayView); return new Overlay(container, pane, position); @@ -240,7 +237,6 @@ var OverlayView = function OverlayView(_ref) { maps: maps }); }, [container, maps, pane, position]); - var childrenProps = useMemoCompare(children === null || children === void 0 ? void 0 : children.props, function (prev, next) { return prev && prev.lat === next.lat && prev.lng === next.lng; }); @@ -252,7 +248,6 @@ var OverlayView = function OverlayView(_ref) { }; } }, [map, childrenProps]); - React.useEffect(function () { container.style.zIndex = "" + zIndex; }, [zIndex, container]); @@ -286,7 +281,6 @@ var MapMarkers = function MapMarkers(_ref) { lng: child.props.lng }; var zIndex = child.props.zIndex || undefined; - return /*#__PURE__*/React__default.createElement(OverlayView, { position: latLng, map: map, diff --git a/dist/index.js.map b/dist/index.js.map index 2677777..56376e3 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/hooks/useMemoCompare.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 { useEffect, useState } 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\tforcedStatus = undefined\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\tif (forcedStatus) {\n\t\t\t\tsetStatus(forcedStatus)\n\t\t\t\treturn () => {\n\t\t\t\t\t// do nothing\n\t\t\t\t}\n\t\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\n\t\t// Re-run useEffect if script changes\n\t\t[script, forcedStatus, status]\n\t)\n\n\treturn status\n}\n","import { useScript } from './useScript'\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [], loadScriptExternally = false, status = 'idle', callback }) => {\n\t// eslint-disable-next-line no-undef\n\tif (typeof window !== \"undefined\") window.googleMapsCallback = callback\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=googleMapsCallback&libraries=${libraries?.join(\n\t\t\t\t\t','\n\t\t\t\t)}`,\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?callback=googleMapsCallback&libraries=${libraries?.join(',')}`,\n\t\t\t\tattributes: { id: 'googleMapsApi' },\n\t\t }\n\n\treturn useScript(script, loadScriptExternally ? status : undefined)\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 { useEffect, useRef } from 'react'\n\n/**\n * A hook that compares the previous and current values of a reference.\n * @param {any} value - the current value of the reference\n * @param {function} compare - a function that compares the previous and current values\n * @returns {any} the previous value of the reference\n * @ref https://usehooks.com/useMemoCompare/\n */\nconst useMemoCompare = (next, compare) => {\n\t// Ref for storing previous value\n\tconst previousRef = useRef()\n\tconst previous = previousRef.current\n\t// Pass previous and next value to compare function\n\t// to determine whether to consider them equal.\n\tconst isEqual = compare(previous, next)\n\t// If not equal update previousRef to next value.\n\t// We only update if not equal so that this hook continues to return\n\t// the same old value if compare keeps returning true.\n\tuseEffect(() => {\n\t\tif (!isEqual) {\n\t\t\tpreviousRef.current = next\n\t\t}\n\t})\n\t// Finally, if equal then return the previous value\n\treturn isEqual ? previous : next\n}\n\nexport default useMemoCompare\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\t/**\n\t * The HTML container element for the overlay.\n\t */\n\tcontainer: element.isRequired,\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t * @required\n\t */\n\tpane: string.isRequired,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The Google Maps API.\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { node, number, object, shape, string } from 'prop-types'\nimport { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport useMemoCompare from '../hooks/useMemoCompare'\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\t// Because React does not do deep comparisons, a custom hook is used.\n\t// This fixes the issue where the overlay is not updated when the position changes.\n\tconst childrenProps = useMemoCompare(children?.props, (prev, next) => {\n\t\treturn prev && prev.lat === next.lat && prev.lng === next.lng\n\t})\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//? added childrenProps to the dependency array to re-render the overlay when the children props change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map, childrenProps])\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\nOverlayView.defaultProps = {\n\tzIndex: 0,\n}\n\nOverlayView.propTypes = {\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t */\n\tpane: string,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The map on which to display the overlay.\n\t * @type {google.maps.Map}\n\t * @required\n\t * @ref [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map)\n\t */\n\tmap: object.isRequired,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t * @ref [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference)\n\t */\n\tmaps: object.isRequired,\n\t/**\n\t * The z-index of the overlay.\n\t * @type {number}\n\t * @default 0\n\t */\n\tzIndex: number,\n\t/**\n\t * The children of the OverlayView.\n\t * @type {ReactNode}\n\t * @required\n\t * @ref [ReactNode](https://reactjs.org/docs/react-api.html#reactnode)\n\t */\n\tchildren: node.isRequired,\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\tconst zIndex = child.props.zIndex || undefined\n\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t\n\t\t\t\t\t\t{child}\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn
{markers}
\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, options }) => {\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...options,\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, options])\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
\n\t\t\t{children && map && maps && (\n\t\t\t\t\n\t\t\t\t\t{children}\n\t\t\t\t\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\toptions: {},\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\toptions: object,\n}\n\nexport default MapComponent\n","import { arrayOf, bool, func, node, number, object, oneOf, 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{\n\t\tapiKey,\n\t\tlibraries,\n\t\tchildren,\n\t\tloadingContent,\n\t\tidleContent,\n\t\terrorContent,\n\t\tmapMinHeight,\n\t\tcontainerProps,\n\t\tloadScriptExternally,\n\t\tstatus,\n\t\tscriptCallback,\n\t\t...props\n\t},\n\tref\n) {\n\tconst renderers = {\n\t\tready: {children},\n\t\tloading: loadingContent,\n\t\tidle: idleContent,\n\t\terror: errorContent,\n\t}\n\n\tconst _status = useGoogleMaps({ apiKey, libraries, loadScriptExternally, status, callback: scriptCallback })\n\n\treturn (\n\t\t\n\t\t\t{renderers[_status] || null}\n\t\t
\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\tloadScriptExternally: false,\n\tstatus: 'idle',\n\tscriptCallback: () => {},\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\t/**\n\t * Whether to load the Google Maps script externally.\n\t * If true, the status prop will be used to control the loading of the script.\n\t * If false, the script will be loaded automatically.\n\t * @default false\n\t */\n\tloadScriptExternally: bool,\n\t/**\n\t * The forced status of the Google Maps script.\n\t * @default 'idle'\n\t */\n\tstatus: oneOf(['idle', 'loading', 'ready', 'error']),\n\t/**\n\t * The callback function to pass to the Google Maps script.\n\t * @default () => {}\n\t */\n\tscriptCallback: func,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","forcedStatus","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","undefined","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","loadScriptExternally","callback","window","googleMapsCallback","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","useMemoCompare","next","compare","previousRef","useRef","previous","current","isEqual","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","childrenProps","props","prev","setMap","createPortal","defaultProps","node","MapMarkers","markers","Children","child","isValidElement","latLng","React","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","options","mapRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","center","google","Map","ref","clearListeners","addListener","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","scriptCallback","renderers","ready","loading","idle","error","_status","overflow","minHeight","bool","oneOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAMA,SAAS,GAAG,SAAZA,SAAS,CACrBC,MAAM,EAMNC,YAAY,EACR;EAAA,IAPJD,MAAM;IAANA,MAAM,GAAG;MACRE,GAAG,EAAE,EAAE;MACPC,UAAU,EAAE,EAAE;MACdC,SAAS,EAAE;QAAEC,cAAc,EAAE,IAAI;QAAEC,eAAe,EAAE;OAAM;MAC1DC,iBAAiB,EAAE;KACnB;;EAAA,IACDN,YAAY;IAAZA,YAAY,GAAGO,SAAS;;EAGxB,gBAA4BC,cAAQ,CAACT,MAAM,CAACE,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;IAA9DQ,MAAM;IAAEC,SAAS;EAExBC,eAAS,CACR,YAAM;IAAA;IACL,IAAIX,YAAY,EAAE;MACjBU,SAAS,CAACV,YAAY,CAAC;MACvB,OAAO,YAAM;OAEZ;;IAIF,IAAI,CAACD,MAAM,CAACE,GAAG,EAAE;MAChBS,SAAS,CAAC,MAAM,CAAC;MACjB;;IAID,IAAIE,WAAW,GAAGC,QAA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C,CAAC,CAAC;EAI1CkD,cAAc,EAAElD,cAAI;EAIpBmD,WAAW,EAAEnD,cAAI;EAIjBoD,YAAY,EAAEpD,cAAI;EAIlBqD,YAAY,EAAER,mBAAS,CAAC,CAAC3D,gBAAM,EAAEH,gBAAM,CAAC,CAAC;EAIzCuE,cAAc,EAAElE,gBAAM;EAOtBpD,oBAAoB,EAAEgI,cAAI;EAK1B7J,MAAM,EAAE8J,eAAK,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EAKpDV,cAAc,EAAER;AAAI,EACpB;;;;"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/hooks/useMemoCompare.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 { useEffect, useState } 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\tforcedStatus = undefined\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\tif (forcedStatus) {\n\t\t\t\tsetStatus(forcedStatus)\n\t\t\t\treturn () => {\n\t\t\t\t\t// do nothing\n\t\t\t\t}\n\t\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\n\t\t// Re-run useEffect if script changes\n\t\t[script, forcedStatus, status]\n\t)\n\n\treturn status\n}\n","import { useScript } from './useScript'\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [], loadScriptExternally = false, status = 'idle', callback }) => {\n\t// eslint-disable-next-line no-undef\n\tif (typeof window !== \"undefined\") window.googleMapsCallback = callback\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=googleMapsCallback&libraries=${libraries?.join(\n\t\t\t\t\t','\n\t\t\t\t)}`,\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?callback=googleMapsCallback&libraries=${libraries?.join(',')}`,\n\t\t\t\tattributes: { id: 'googleMapsApi' },\n\t\t }\n\n\treturn useScript(script, loadScriptExternally ? status : undefined)\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 { useEffect, useRef } from 'react'\n\n/**\n * A hook that compares the previous and current values of a reference.\n * @param {any} value - the current value of the reference\n * @param {function} compare - a function that compares the previous and current values\n * @returns {any} the previous value of the reference\n * @ref https://usehooks.com/useMemoCompare/\n */\nconst useMemoCompare = (next, compare) => {\n\t// Ref for storing previous value\n\tconst previousRef = useRef()\n\tconst previous = previousRef.current\n\t// Pass previous and next value to compare function\n\t// to determine whether to consider them equal.\n\tconst isEqual = compare(previous, next)\n\t// If not equal update previousRef to next value.\n\t// We only update if not equal so that this hook continues to return\n\t// the same old value if compare keeps returning true.\n\tuseEffect(() => {\n\t\tif (!isEqual) {\n\t\t\tpreviousRef.current = next\n\t\t}\n\t})\n\t// Finally, if equal then return the previous value\n\treturn isEqual ? previous : next\n}\n\nexport default useMemoCompare\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\t/**\n\t * The HTML container element for the overlay.\n\t */\n\tcontainer: element.isRequired,\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t * @required\n\t */\n\tpane: string.isRequired,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The Google Maps API.\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { node, number, object, shape, string } from 'prop-types'\nimport { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport useMemoCompare from '../hooks/useMemoCompare'\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\t// Because React does not do deep comparisons, a custom hook is used.\n\t// This fixes the issue where the overlay is not updated when the position changes.\n\tconst childrenProps = useMemoCompare(children?.props, (prev, next) => {\n\t\treturn prev && prev.lat === next.lat && prev.lng === next.lng\n\t})\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//? added childrenProps to the dependency array to re-render the overlay when the children props change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map, childrenProps])\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\nOverlayView.defaultProps = {\n\tzIndex: 0,\n}\n\nOverlayView.propTypes = {\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t */\n\tpane: string,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The map on which to display the overlay.\n\t * @type {google.maps.Map}\n\t * @required\n\t * @ref [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map)\n\t */\n\tmap: object.isRequired,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t * @ref [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference)\n\t */\n\tmaps: object.isRequired,\n\t/**\n\t * The z-index of the overlay.\n\t * @type {number}\n\t * @default 0\n\t */\n\tzIndex: number,\n\t/**\n\t * The children of the OverlayView.\n\t * @type {ReactNode}\n\t * @required\n\t * @ref [ReactNode](https://reactjs.org/docs/react-api.html#reactnode)\n\t */\n\tchildren: node.isRequired,\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\tconst zIndex = child.props.zIndex || undefined\n\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t\n\t\t\t\t\t\t{child}\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn
{markers}
\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, options }) => {\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...options,\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, options])\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
\n\t\t\t{children && map && maps && (\n\t\t\t\t\n\t\t\t\t\t{children}\n\t\t\t\t\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\toptions: {},\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\toptions: object,\n}\n\nexport default MapComponent\n","import { arrayOf, bool, func, node, number, object, oneOf, 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{\n\t\tapiKey,\n\t\tlibraries,\n\t\tchildren,\n\t\tloadingContent,\n\t\tidleContent,\n\t\terrorContent,\n\t\tmapMinHeight,\n\t\tcontainerProps,\n\t\tloadScriptExternally,\n\t\tstatus,\n\t\tscriptCallback,\n\t\t...props\n\t},\n\tref\n) {\n\tconst renderers = {\n\t\tready: {children},\n\t\tloading: loadingContent,\n\t\tidle: idleContent,\n\t\terror: errorContent,\n\t}\n\n\tconst _status = useGoogleMaps({ apiKey, libraries, loadScriptExternally, status, callback: scriptCallback })\n\n\treturn (\n\t\t\n\t\t\t{renderers[_status] || null}\n\t\t
\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\tloadScriptExternally: false,\n\tstatus: 'idle',\n\tscriptCallback: () => {},\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\t/**\n\t * Whether to load the Google Maps script externally.\n\t * If true, the status prop will be used to control the loading of the script.\n\t * If false, the script will be loaded automatically.\n\t * @default false\n\t */\n\tloadScriptExternally: bool,\n\t/**\n\t * The forced status of the Google Maps script.\n\t * @default 'idle'\n\t */\n\tstatus: oneOf(['idle', 'loading', 'ready', 'error']),\n\t/**\n\t * The callback function to pass to the Google Maps script.\n\t * @default () => {}\n\t */\n\tscriptCallback: func,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","forcedStatus","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","undefined","_useState","useState","status","setStatus","useEffect","_script$callbacks","_script$callbacks2","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","_ref","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","_script$callbacks3","_script$callbacks4","removeEventListener","useGoogleMaps","apiKey","_ref$libraries","libraries","_ref$loadScriptExtern","loadScriptExternally","_ref$status","callback","window","googleMapsCallback","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","useMemoCompare","next","compare","previousRef","useRef","previous","current","isEqual","createOverlay","container","pane","position","maps","Overlay","_maps$OverlayView","_inheritsLoose","_this","call","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","_ref$pane","zIndex","children","useMemo","div","overlay","childrenProps","props","prev","setMap","createPortal","defaultProps","node","MapMarkers","markers","Children","child","isValidElement","latLng","React","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","options","mapRef","prevBoundsRef","_useState2","setMaps","_useState3","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","center","google","Map","_extends","ref","clearListeners","addListener","Fragment","className","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","scriptCallback","_objectWithoutPropertiesLoose","_excluded","renderers","ready","loading","idle","error","_status","overflow","minHeight","bool","oneOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO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CAAC,CAACjE,gBAAM,EAAEH,gBAAM,CAAC,CAAC;EAIzC6E,cAAc,EAAExE,gBAAM;EAOtBzD,oBAAoB,EAAE6I,cAAI;EAK1BjL,MAAM,EAAEkL,eAAK,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EAKpDZ,cAAc,EAAER;AAAI,EACpB;;;;"} \ No newline at end of file diff --git a/dist/index.modern.js b/dist/index.modern.js index 56f56cb..01ea362 100644 --- a/dist/index.modern.js +++ b/dist/index.modern.js @@ -2,97 +2,45 @@ import { element, string, shape, number, object, node, oneOfType, arrayOf, func, import React, { useState, useEffect, useRef, useMemo, Children, isValidElement, useCallback, forwardRef } from 'react'; import { createPortal } from 'react-dom'; -function _extends() { - _extends = Object.assign ? Object.assign.bind() : function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - return _extends.apply(this, arguments); -} -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - _setPrototypeOf(subClass, superClass); -} -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); -} -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} - -var useScript = function useScript(script, forcedStatus) { - if (script === void 0) { - script = { - src: '', - attributes: {}, - callbacks: { - onLoadCallback: null, - onErrorCallback: null - }, - elementIdToAppend: null - }; - } - if (forcedStatus === void 0) { - forcedStatus = undefined; - } - var _useState = useState(script.src ? 'loading' : 'idle'), - status = _useState[0], - setStatus = _useState[1]; - useEffect(function () { +const useScript = (script = { + src: '', + attributes: {}, + callbacks: { + onLoadCallback: null, + onErrorCallback: null + }, + elementIdToAppend: null +}, forcedStatus = undefined) => { + const [status, setStatus] = useState(script.src ? 'loading' : 'idle'); + useEffect(() => { var _script$callbacks, _script$callbacks2; if (forcedStatus) { setStatus(forcedStatus); - return function () { - }; + return () => {}; } if (!script.src) { setStatus('idle'); return; } - var scriptToAdd = document.querySelector("script[src=\"" + script.src + "\"]"); + let scriptToAdd = document.querySelector(`script[src="${script.src}"]`); if (!scriptToAdd) { scriptToAdd = document.createElement('script'); scriptToAdd.src = script.src; scriptToAdd.async = true; scriptToAdd.setAttribute('data-status', 'loading'); - script.attributes && Object.entries(script.attributes).length > 0 ? Object.entries(script.attributes).map(function (_ref) { - var key = _ref[0], - value = _ref[1]; - return scriptToAdd.setAttribute(key, value); - }) : null; + script.attributes && Object.entries(script.attributes).length > 0 ? Object.entries(script.attributes).map(([key, value]) => scriptToAdd.setAttribute(key, value)) : null; if (script.elementIdToAppend && document.getElementById(script.elementIdToAppend)) { document.getElementById(script.elementIdToAppend).appendChild(scriptToAdd); } else { document.body.appendChild(scriptToAdd); } - var setAttributeFromEvent = function setAttributeFromEvent(event) { + const setAttributeFromEvent = event => { scriptToAdd.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error'); }; scriptToAdd.addEventListener('load', setAttributeFromEvent); scriptToAdd.addEventListener('error', setAttributeFromEvent); } else { - var currentScriptStatus = scriptToAdd.getAttribute('data-status'); + const currentScriptStatus = scriptToAdd.getAttribute('data-status'); switch (currentScriptStatus) { case 'load': case 'ready': @@ -104,51 +52,48 @@ var useScript = function useScript(script, forcedStatus) { } setStatus(currentScriptStatus); } - var setStateFromEvent = function setStateFromEvent(event) { + const setStateFromEvent = event => { var _script$callbacks3, _script$callbacks4; event.type === 'load' ? (_script$callbacks3 = script.callbacks) !== null && _script$callbacks3 !== void 0 && _script$callbacks3.onLoadCallback ? script.callbacks.onLoadCallback() : null : (_script$callbacks4 = script.callbacks) !== null && _script$callbacks4 !== void 0 && _script$callbacks4.onErrorCallback ? script.callbacks.onErrorCallback() : null; setStatus(event.type === 'load' ? 'ready' : 'error'); }; scriptToAdd.addEventListener('load', setStateFromEvent); scriptToAdd.addEventListener('error', setStateFromEvent); - return function () { + return () => { if (scriptToAdd) { scriptToAdd.removeEventListener('load', setStateFromEvent); scriptToAdd.removeEventListener('error', setStateFromEvent); } }; - }, - [script, forcedStatus, status]); + }, [script, forcedStatus, status]); return status; }; -var useGoogleMaps = function useGoogleMaps(_ref) { - var apiKey = _ref.apiKey, - _ref$libraries = _ref.libraries, - libraries = _ref$libraries === void 0 ? [] : _ref$libraries, - _ref$loadScriptExtern = _ref.loadScriptExternally, - loadScriptExternally = _ref$loadScriptExtern === void 0 ? false : _ref$loadScriptExtern, - _ref$status = _ref.status, - status = _ref$status === void 0 ? 'idle' : _ref$status, - callback = _ref.callback; +const useGoogleMaps = ({ + apiKey, + libraries: _libraries = [], + loadScriptExternally: _loadScriptExternally = false, + status: _status = 'idle', + callback +}) => { if (typeof window !== "undefined") window.googleMapsCallback = callback; - var script = apiKey ? { - src: "https://maps.googleapis.com/maps/api/js?key=" + apiKey + "&callback=googleMapsCallback&libraries=" + (libraries === null || libraries === void 0 ? void 0 : libraries.join(',')), + const script = apiKey ? { + src: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=googleMapsCallback&libraries=${_libraries === null || _libraries === void 0 ? void 0 : _libraries.join(',')}`, attributes: { id: 'googleMapsApi' } } : { - src: "https://maps.googleapis.com/maps/api/js?callback=googleMapsCallback&libraries=" + (libraries === null || libraries === void 0 ? void 0 : libraries.join(',')), + src: `https://maps.googleapis.com/maps/api/js?callback=googleMapsCallback&libraries=${_libraries === null || _libraries === void 0 ? void 0 : _libraries.join(',')}`, attributes: { id: 'googleMapsApi' } }; - return useScript(script, loadScriptExternally ? status : undefined); + return useScript(script, _loadScriptExternally ? _status : undefined); }; -var isArraysEqualEps = function isArraysEqualEps(arrayA, arrayB, eps) { +const isArraysEqualEps = (arrayA, arrayB, eps) => { if (arrayA && arrayB) { - for (var i = 0; i !== arrayA.length; ++i) { + for (let i = 0; i !== arrayA.length; ++i) { if (Math.abs(arrayA[i] - arrayB[i]) > eps) { return false; } @@ -158,11 +103,11 @@ var isArraysEqualEps = function isArraysEqualEps(arrayA, arrayB, eps) { return false; }; -var useMemoCompare = function useMemoCompare(next, compare) { - var previousRef = useRef(); - var previous = previousRef.current; - var isEqual = compare(previous, next); - useEffect(function () { +const useMemoCompare = (next, compare) => { + const previousRef = useRef(); + const previous = previousRef.current; + const isEqual = compare(previous, next); + useEffect(() => { if (!isEqual) { previousRef.current = next; } @@ -170,40 +115,36 @@ var useMemoCompare = function useMemoCompare(next, compare) { return isEqual ? previous : next; }; -var createOverlay = function createOverlay(_ref) { - var container = _ref.container, - pane = _ref.pane, - position = _ref.position, - maps = _ref.maps; - var Overlay = /*#__PURE__*/function (_maps$OverlayView) { - _inheritsLoose(Overlay, _maps$OverlayView); - function Overlay(container, _pane, position) { - var _this; - _this = _maps$OverlayView.call(this) || this; - _this.onAdd = function () { - var pane = _this.getPanes()[_this.pane]; +const createOverlay = ({ + container, + pane, + position, + maps +}) => { + class Overlay extends maps.OverlayView { + constructor(container, _pane, position) { + super(); + this.onAdd = () => { + const pane = this.getPanes()[this.pane]; pane === null || pane === void 0 ? void 0 : pane.classList.add('google-map-markers-overlay'); - pane === null || pane === void 0 ? void 0 : pane.appendChild(_this.container); + pane === null || pane === void 0 ? void 0 : pane.appendChild(this.container); }; - _this.draw = function () { - var projection = _this.getProjection(); - var point = projection.fromLatLngToDivPixel(_this.position); + this.draw = () => { + const projection = this.getProjection(); + const point = projection.fromLatLngToDivPixel(this.position); if (point === null) return; - _this.container.style.transform = "translate(" + point.x + "px, " + point.y + "px)"; + this.container.style.transform = `translate(${point.x}px, ${point.y}px)`; }; - _this.onRemove = function () { - if (_this.container.parentNode !== null) { - _this.container.parentNode.removeChild(_this.container); + this.onRemove = () => { + if (this.container.parentNode !== null) { + this.container.parentNode.removeChild(this.container); } }; - _this.container = container; - _this.pane = _pane; - _this.position = position; - return _this; + this.container = container; + this.pane = _pane; + this.position = position; } - - return Overlay; - }(maps.OverlayView); + } return new Overlay(container, pane, position); }; createOverlay.propTypes = { @@ -216,42 +157,40 @@ createOverlay.propTypes = { maps: object.isRequired }; -var OverlayView = function OverlayView(_ref) { - var position = _ref.position, - _ref$pane = _ref.pane, - pane = _ref$pane === void 0 ? 'floatPane' : _ref$pane, - map = _ref.map, - maps = _ref.maps, - zIndex = _ref.zIndex, - children = _ref.children; - var container = useMemo(function () { - var div = document.createElement('div'); +const OverlayView = ({ + position, + pane: _pane = 'floatPane', + map, + maps, + zIndex, + children +}) => { + const container = useMemo(() => { + const div = document.createElement('div'); div.style.position = 'absolute'; return div; }, []); - var overlay = useMemo(function () { + const overlay = useMemo(() => { return createOverlay({ - container: container, - pane: pane, - position: position, - maps: maps + container, + pane: _pane, + position, + maps }); - }, [container, maps, pane, position]); - - var childrenProps = useMemoCompare(children === null || children === void 0 ? void 0 : children.props, function (prev, next) { + }, [container, maps, _pane, position]); + const childrenProps = useMemoCompare(children === null || children === void 0 ? void 0 : children.props, (prev, next) => { return prev && prev.lat === next.lat && prev.lng === next.lng; }); - useEffect(function () { + useEffect(() => { if (!overlay.map) { overlay === null || overlay === void 0 ? void 0 : overlay.setMap(map); - return function () { + return () => { overlay === null || overlay === void 0 ? void 0 : overlay.setMap(null); }; } }, [map, childrenProps]); - - useEffect(function () { - container.style.zIndex = "" + zIndex; + useEffect(() => { + container.style.zIndex = `${zIndex}`; }, [zIndex, container]); return /*#__PURE__*/createPortal(children, container); }; @@ -270,20 +209,20 @@ OverlayView.propTypes = { children: node.isRequired }; -var MapMarkers = function MapMarkers(_ref) { - var children = _ref.children, - map = _ref.map, - maps = _ref.maps; - var markers = useMemo(function () { +const MapMarkers = ({ + children, + map, + maps +}) => { + const markers = useMemo(() => { if (!map || !maps) return []; - return Children.map(children, function (child) { + return Children.map(children, child => { if ( /*#__PURE__*/isValidElement(child)) { - var latLng = { + const latLng = { lat: child.props.lat, lng: child.props.lng }; - var zIndex = child.props.zIndex || undefined; - + const zIndex = child.props.zIndex || undefined; return /*#__PURE__*/React.createElement(OverlayView, { position: latLng, map: map, @@ -301,59 +240,55 @@ MapMarkers.propTypes = { maps: object.isRequired }; -var EPS = 0.00001; -var MapComponent = function MapComponent(_ref) { - var children = _ref.children, - style = _ref.style, - defaultCenter = _ref.defaultCenter, - defaultZoom = _ref.defaultZoom, - onGoogleApiLoaded = _ref.onGoogleApiLoaded, - onChange = _ref.onChange, - options = _ref.options; - var mapRef = useRef(null); - var prevBoundsRef = useRef(null); - var _useState = useState(null), - map = _useState[0], - setMap = _useState[1]; - var _useState2 = useState(null), - maps = _useState2[0], - setMaps = _useState2[1]; - var _useState3 = useState(false), - googleApiCalled = _useState3[0], - setGoogleApiCalled = _useState3[1]; - var onIdle = useCallback(function () { - var zoom = map.getZoom(); - var bounds = map.getBounds(); - var centerLatLng = map.getCenter(); - var ne = bounds.getNorthEast(); - var sw = bounds.getSouthWest(); - var boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]; +const EPS = 0.00001; +const MapComponent = ({ + children, + style, + defaultCenter, + defaultZoom, + onGoogleApiLoaded, + onChange, + options +}) => { + const mapRef = useRef(null); + const prevBoundsRef = useRef(null); + const [map, setMap] = useState(null); + const [maps, setMaps] = useState(null); + const [googleApiCalled, setGoogleApiCalled] = useState(false); + const onIdle = useCallback(() => { + const zoom = map.getZoom(); + const bounds = map.getBounds(); + const centerLatLng = map.getCenter(); + const ne = bounds.getNorthEast(); + const sw = bounds.getSouthWest(); + const boundsArray = [sw.lng(), sw.lat(), ne.lng(), ne.lat()]; if (!isArraysEqualEps(boundsArray, prevBoundsRef.current, EPS)) { if (onChange) { onChange({ - zoom: zoom, + zoom, center: [centerLatLng.lng(), centerLatLng.lat()], - bounds: bounds + bounds }); } prevBoundsRef.current = boundsArray; } }, [map, onChange]); - useEffect(function () { + useEffect(() => { if (mapRef.current && !map) { - setMap(new window.google.maps.Map(mapRef.current, _extends({ + setMap(new window.google.maps.Map(mapRef.current, { center: defaultCenter, - zoom: defaultZoom - }, options))); + zoom: defaultZoom, + ...options + })); setMaps(window.google.maps); } }, [defaultCenter, defaultZoom, map, mapRef, options]); - useEffect(function () { + useEffect(() => { if (map) { if (!googleApiCalled) { onGoogleApiLoaded({ - map: map, - maps: maps, + map, + maps, ref: mapRef.current }); setGoogleApiCalled(true); @@ -362,8 +297,8 @@ var MapComponent = function MapComponent(_ref) { window.google.maps.event.addListener(map, 'idle', onIdle); } }, [googleApiCalled, map, maps, onChange, onGoogleApiLoaded, onIdle]); - useEffect(function () { - return function () { + useEffect(() => { + return () => { if (map) { window.google.maps.event.clearListeners(map, 'idle'); } @@ -388,8 +323,8 @@ MapComponent.defaultProps = { padding: 0, position: 'absolute' }, - onGoogleApiLoaded: function onGoogleApiLoaded() {}, - onChange: function onChange() {}, + onGoogleApiLoaded: () => {}, + onChange: () => {}, options: {} }; MapComponent.propTypes = { @@ -402,34 +337,34 @@ MapComponent.propTypes = { options: object }; -var _excluded = ["apiKey", "libraries", "children", "loadingContent", "idleContent", "errorContent", "mapMinHeight", "containerProps", "loadScriptExternally", "status", "scriptCallback"]; -var GoogleMap = /*#__PURE__*/forwardRef(function GoogleMap(_ref, ref) { - var apiKey = _ref.apiKey, - libraries = _ref.libraries, - children = _ref.children, - loadingContent = _ref.loadingContent, - idleContent = _ref.idleContent, - errorContent = _ref.errorContent, - mapMinHeight = _ref.mapMinHeight, - containerProps = _ref.containerProps, - loadScriptExternally = _ref.loadScriptExternally, - status = _ref.status, - scriptCallback = _ref.scriptCallback, - props = _objectWithoutPropertiesLoose(_ref, _excluded); - var renderers = { +const GoogleMap = /*#__PURE__*/forwardRef(function GoogleMap({ + apiKey, + libraries, + children, + loadingContent, + idleContent, + errorContent, + mapMinHeight, + containerProps, + loadScriptExternally, + status, + scriptCallback, + ...props +}, ref) { + const renderers = { ready: /*#__PURE__*/React.createElement(MapComponent, props, children), loading: loadingContent, idle: idleContent, error: errorContent }; - var _status = useGoogleMaps({ - apiKey: apiKey, - libraries: libraries, - loadScriptExternally: loadScriptExternally, - status: status, + const _status = useGoogleMaps({ + apiKey, + libraries, + loadScriptExternally, + status, callback: scriptCallback }); - return /*#__PURE__*/React.createElement("div", _extends({ + return /*#__PURE__*/React.createElement("div", Object.assign({ style: { height: '100%', width: '100%', @@ -440,7 +375,8 @@ var GoogleMap = /*#__PURE__*/forwardRef(function GoogleMap(_ref, ref) { ref: ref }, containerProps), renderers[_status] || null); }); -GoogleMap.defaultProps = _extends({}, MapComponent.defaultProps, { +GoogleMap.defaultProps = { + ...MapComponent.defaultProps, loadingContent: 'Google Maps is loading', idleContent: 'Google Maps is on idle', errorContent: 'Google Maps is on error', @@ -449,9 +385,10 @@ GoogleMap.defaultProps = _extends({}, MapComponent.defaultProps, { libraries: ['places', 'geometry'], loadScriptExternally: false, status: 'idle', - scriptCallback: function scriptCallback() {} -}); -GoogleMap.propTypes = _extends({}, MapComponent.propTypes, { + scriptCallback: () => {} +}; +GoogleMap.propTypes = { + ...MapComponent.propTypes, children: oneOfType([node, arrayOf(node)]), loadingContent: node, idleContent: node, @@ -461,7 +398,7 @@ GoogleMap.propTypes = _extends({}, MapComponent.propTypes, { loadScriptExternally: bool, status: oneOf(['idle', 'loading', 'ready', 'error']), scriptCallback: func -}); +}; export default GoogleMap; //# sourceMappingURL=index.modern.js.map diff --git a/dist/index.modern.js.map b/dist/index.modern.js.map index 805139c..f6ab8e0 100644 --- a/dist/index.modern.js.map +++ b/dist/index.modern.js.map @@ -1 +1 @@ -{"version":3,"file":"index.modern.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/hooks/useMemoCompare.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 { useEffect, useState } 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\tforcedStatus = undefined\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\tif (forcedStatus) {\n\t\t\t\tsetStatus(forcedStatus)\n\t\t\t\treturn () => {\n\t\t\t\t\t// do nothing\n\t\t\t\t}\n\t\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\n\t\t// Re-run useEffect if script changes\n\t\t[script, forcedStatus, status]\n\t)\n\n\treturn status\n}\n","import { useScript } from './useScript'\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [], loadScriptExternally = false, status = 'idle', callback }) => {\n\t// eslint-disable-next-line no-undef\n\tif (typeof window !== \"undefined\") window.googleMapsCallback = callback\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=googleMapsCallback&libraries=${libraries?.join(\n\t\t\t\t\t','\n\t\t\t\t)}`,\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?callback=googleMapsCallback&libraries=${libraries?.join(',')}`,\n\t\t\t\tattributes: { id: 'googleMapsApi' },\n\t\t }\n\n\treturn useScript(script, loadScriptExternally ? status : undefined)\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 { useEffect, useRef } from 'react'\n\n/**\n * A hook that compares the previous and current values of a reference.\n * @param {any} value - the current value of the reference\n * @param {function} compare - a function that compares the previous and current values\n * @returns {any} the previous value of the reference\n * @ref https://usehooks.com/useMemoCompare/\n */\nconst useMemoCompare = (next, compare) => {\n\t// Ref for storing previous value\n\tconst previousRef = useRef()\n\tconst previous = previousRef.current\n\t// Pass previous and next value to compare function\n\t// to determine whether to consider them equal.\n\tconst isEqual = compare(previous, next)\n\t// If not equal update previousRef to next value.\n\t// We only update if not equal so that this hook continues to return\n\t// the same old value if compare keeps returning true.\n\tuseEffect(() => {\n\t\tif (!isEqual) {\n\t\t\tpreviousRef.current = next\n\t\t}\n\t})\n\t// Finally, if equal then return the previous value\n\treturn isEqual ? previous : next\n}\n\nexport default useMemoCompare\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\t/**\n\t * The HTML container element for the overlay.\n\t */\n\tcontainer: element.isRequired,\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t * @required\n\t */\n\tpane: string.isRequired,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The Google Maps API.\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { node, number, object, shape, string } from 'prop-types'\nimport { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport useMemoCompare from '../hooks/useMemoCompare'\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\t// Because React does not do deep comparisons, a custom hook is used.\n\t// This fixes the issue where the overlay is not updated when the position changes.\n\tconst childrenProps = useMemoCompare(children?.props, (prev, next) => {\n\t\treturn prev && prev.lat === next.lat && prev.lng === next.lng\n\t})\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//? added childrenProps to the dependency array to re-render the overlay when the children props change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map, childrenProps])\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\nOverlayView.defaultProps = {\n\tzIndex: 0,\n}\n\nOverlayView.propTypes = {\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t */\n\tpane: string,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The map on which to display the overlay.\n\t * @type {google.maps.Map}\n\t * @required\n\t * @ref [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map)\n\t */\n\tmap: object.isRequired,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t * @ref [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference)\n\t */\n\tmaps: object.isRequired,\n\t/**\n\t * The z-index of the overlay.\n\t * @type {number}\n\t * @default 0\n\t */\n\tzIndex: number,\n\t/**\n\t * The children of the OverlayView.\n\t * @type {ReactNode}\n\t * @required\n\t * @ref [ReactNode](https://reactjs.org/docs/react-api.html#reactnode)\n\t */\n\tchildren: node.isRequired,\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\tconst zIndex = child.props.zIndex || undefined\n\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t\n\t\t\t\t\t\t{child}\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn
{markers}
\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, options }) => {\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...options,\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, options])\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
\n\t\t\t{children && map && maps && (\n\t\t\t\t\n\t\t\t\t\t{children}\n\t\t\t\t\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\toptions: {},\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\toptions: object,\n}\n\nexport default MapComponent\n","import { arrayOf, bool, func, node, number, object, oneOf, 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{\n\t\tapiKey,\n\t\tlibraries,\n\t\tchildren,\n\t\tloadingContent,\n\t\tidleContent,\n\t\terrorContent,\n\t\tmapMinHeight,\n\t\tcontainerProps,\n\t\tloadScriptExternally,\n\t\tstatus,\n\t\tscriptCallback,\n\t\t...props\n\t},\n\tref\n) {\n\tconst renderers = {\n\t\tready: {children},\n\t\tloading: loadingContent,\n\t\tidle: idleContent,\n\t\terror: errorContent,\n\t}\n\n\tconst _status = useGoogleMaps({ apiKey, libraries, loadScriptExternally, status, callback: scriptCallback })\n\n\treturn (\n\t\t\n\t\t\t{renderers[_status] || null}\n\t\t
\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\tloadScriptExternally: false,\n\tstatus: 'idle',\n\tscriptCallback: () => {},\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\t/**\n\t * Whether to load the Google Maps script externally.\n\t * If true, the status prop will be used to control the loading of the script.\n\t * If false, the script will be loaded automatically.\n\t * @default false\n\t */\n\tloadScriptExternally: bool,\n\t/**\n\t * The forced status of the Google Maps script.\n\t * @default 'idle'\n\t */\n\tstatus: oneOf(['idle', 'loading', 'ready', 'error']),\n\t/**\n\t * The callback function to pass to the Google Maps script.\n\t * @default () => {}\n\t */\n\tscriptCallback: func,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","forcedStatus","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","undefined","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","loadScriptExternally","callback","window","googleMapsCallback","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","useMemoCompare","next","compare","previousRef","useRef","previous","current","isEqual","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","childrenProps","props","prev","setMap","createPortal","defaultProps","node","MapMarkers","markers","Children","child","isValidElement","latLng","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","options","mapRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","center","google","Map","ref","clearListeners","addListener","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","scriptCallback","renderers","ready","loading","idle","error","_status","overflow","minHeight","bool","oneOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,IAAMA,SAAS,GAAG,SAAZA,SAAS,CACrBC,MAAM,EAMNC,YAAY,EACR;EAAA,IAPJD,MAAM;IAANA,MAAM,GAAG;MACRE,GAAG,EAAE,EAAE;MACPC,UAAU,EAAE,EAAE;MACdC,SAAS,EAAE;QAAEC,cAAc,EAAE,IAAI;QAAEC,eAAe,EAAE;OAAM;MAC1DC,iBAAiB,EAAE;KACnB;;EAAA,IACDN,YAAY;IAAZA,YAAY,GAAGO,SAAS;;EAGxB,gBAA4BC,QAAQ,CAACT,MAAM,CAACE,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;IAA9DQ,MAAM;IAAEC,SAAS;EAExBC,SAAS,CACR,YAAM;IAAA;IACL,IAAIX,YAAY,EAAE;MACjBU,SAAS,CAACV,YAAY,CAAC;MACvB,OAAO,YAAM;OAEZ;;IAIF,IAAI,CAACD,MAAM,CAACE,GAAG,EAAE;MAChBS,SAAS,CAAC,MAAM,CAAC;MACjB;;IAID,IAAIE,WAAW,GAAGC,QAAQ,CAACC,aAAa,mBAAgBf,MAAM,CAACE,GAAG,SAAK;IACvE,IAAI,CAACW,WAAW,EAAE;MAEjBA,WAAW,GAAGC,QAAQ,CAACE,aAAa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MAAM,CAAC,CAAC;EAIzCsE,cAAc,EAAEjE,MAAM;EAOtBpD,oBAAoB,EAAE+H,IAAI;EAK1B5J,MAAM,EAAE6J,KAAK,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EAKpDV,cAAc,EAAER;AAAI,EACpB;;;;"} \ No newline at end of file +{"version":3,"file":"index.modern.js","sources":["../src/hooks/useScript.js","../src/hooks/useGoogleMaps.js","../src/utils/utils.js","../src/hooks/useMemoCompare.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 { useEffect, useState } 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\tforcedStatus = undefined\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\tif (forcedStatus) {\n\t\t\t\tsetStatus(forcedStatus)\n\t\t\t\treturn () => {\n\t\t\t\t\t// do nothing\n\t\t\t\t}\n\t\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\n\t\t// Re-run useEffect if script changes\n\t\t[script, forcedStatus, status]\n\t)\n\n\treturn status\n}\n","import { useScript } from './useScript'\n\n/**\n * @returns {\"idle\" | \"loading\" | \"ready\" | \"error\"} status\n */\nexport const useGoogleMaps = ({ apiKey, libraries = [], loadScriptExternally = false, status = 'idle', callback }) => {\n\t// eslint-disable-next-line no-undef\n\tif (typeof window !== \"undefined\") window.googleMapsCallback = callback\n\tconst script = apiKey\n\t\t? {\n\t\t\t\tsrc: `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=googleMapsCallback&libraries=${libraries?.join(\n\t\t\t\t\t','\n\t\t\t\t)}`,\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?callback=googleMapsCallback&libraries=${libraries?.join(',')}`,\n\t\t\t\tattributes: { id: 'googleMapsApi' },\n\t\t }\n\n\treturn useScript(script, loadScriptExternally ? status : undefined)\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 { useEffect, useRef } from 'react'\n\n/**\n * A hook that compares the previous and current values of a reference.\n * @param {any} value - the current value of the reference\n * @param {function} compare - a function that compares the previous and current values\n * @returns {any} the previous value of the reference\n * @ref https://usehooks.com/useMemoCompare/\n */\nconst useMemoCompare = (next, compare) => {\n\t// Ref for storing previous value\n\tconst previousRef = useRef()\n\tconst previous = previousRef.current\n\t// Pass previous and next value to compare function\n\t// to determine whether to consider them equal.\n\tconst isEqual = compare(previous, next)\n\t// If not equal update previousRef to next value.\n\t// We only update if not equal so that this hook continues to return\n\t// the same old value if compare keeps returning true.\n\tuseEffect(() => {\n\t\tif (!isEqual) {\n\t\t\tpreviousRef.current = next\n\t\t}\n\t})\n\t// Finally, if equal then return the previous value\n\treturn isEqual ? previous : next\n}\n\nexport default useMemoCompare\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\t/**\n\t * The HTML container element for the overlay.\n\t */\n\tcontainer: element.isRequired,\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t * @required\n\t */\n\tpane: string.isRequired,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The Google Maps API.\n\t */\n\tmaps: object.isRequired,\n}\n\nexport default createOverlay\n","import { node, number, object, shape, string } from 'prop-types'\nimport { useEffect, useMemo } from 'react'\nimport { createPortal } from 'react-dom'\nimport useMemoCompare from '../hooks/useMemoCompare'\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\t// Because React does not do deep comparisons, a custom hook is used.\n\t// This fixes the issue where the overlay is not updated when the position changes.\n\tconst childrenProps = useMemoCompare(children?.props, (prev, next) => {\n\t\treturn prev && prev.lat === next.lat && prev.lng === next.lng\n\t})\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//? added childrenProps to the dependency array to re-render the overlay when the children props change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [map, childrenProps])\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\nOverlayView.defaultProps = {\n\tzIndex: 0,\n}\n\nOverlayView.propTypes = {\n\t/**\n\t * The HTML container element for the overlay.\n\t * @ref [MapPanes](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)\n\t * @default 'floatPane'\n\t * @type {google.maps.MapPanes}\n\t */\n\tpane: string,\n\t/**\n\t * The geographical location of the overlay.\n\t * @type {google.maps.LatLng | google.maps.LatLngLiteral}\n\t * @required\n\t * @ref [LatLng](https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng)\n\t */\n\tposition: shape({\n\t\tlat: number.isRequired,\n\t\tlng: number.isRequired,\n\t}).isRequired,\n\t/**\n\t * The map on which to display the overlay.\n\t * @type {google.maps.Map}\n\t * @required\n\t * @ref [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map)\n\t */\n\tmap: object.isRequired,\n\t/**\n\t * The Google Maps API.\n\t * @type {object}\n\t * @required\n\t * @ref [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference)\n\t */\n\tmaps: object.isRequired,\n\t/**\n\t * The z-index of the overlay.\n\t * @type {number}\n\t * @default 0\n\t */\n\tzIndex: number,\n\t/**\n\t * The children of the OverlayView.\n\t * @type {ReactNode}\n\t * @required\n\t * @ref [ReactNode](https://reactjs.org/docs/react-api.html#reactnode)\n\t */\n\tchildren: node.isRequired,\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\tconst zIndex = child.props.zIndex || undefined\n\n\t\t\t\t// set the map prop on the child component\n\t\t\t\treturn (\n\t\t\t\t\t\n\t\t\t\t\t\t{child}\n\t\t\t\t\t\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t}, [children, map, maps])\n\n\treturn
{markers}
\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, options }) => {\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...options,\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, options])\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
\n\t\t\t{children && map && maps && (\n\t\t\t\t\n\t\t\t\t\t{children}\n\t\t\t\t\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\toptions: {},\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\toptions: object,\n}\n\nexport default MapComponent\n","import { arrayOf, bool, func, node, number, object, oneOf, 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{\n\t\tapiKey,\n\t\tlibraries,\n\t\tchildren,\n\t\tloadingContent,\n\t\tidleContent,\n\t\terrorContent,\n\t\tmapMinHeight,\n\t\tcontainerProps,\n\t\tloadScriptExternally,\n\t\tstatus,\n\t\tscriptCallback,\n\t\t...props\n\t},\n\tref\n) {\n\tconst renderers = {\n\t\tready: {children},\n\t\tloading: loadingContent,\n\t\tidle: idleContent,\n\t\terror: errorContent,\n\t}\n\n\tconst _status = useGoogleMaps({ apiKey, libraries, loadScriptExternally, status, callback: scriptCallback })\n\n\treturn (\n\t\t\n\t\t\t{renderers[_status] || null}\n\t\t
\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\tloadScriptExternally: false,\n\tstatus: 'idle',\n\tscriptCallback: () => {},\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\t/**\n\t * Whether to load the Google Maps script externally.\n\t * If true, the status prop will be used to control the loading of the script.\n\t * If false, the script will be loaded automatically.\n\t * @default false\n\t */\n\tloadScriptExternally: bool,\n\t/**\n\t * The forced status of the Google Maps script.\n\t * @default 'idle'\n\t */\n\tstatus: oneOf(['idle', 'loading', 'ready', 'error']),\n\t/**\n\t * The callback function to pass to the Google Maps script.\n\t * @default () => {}\n\t */\n\tscriptCallback: func,\n}\n\nexport default GoogleMap\n"],"names":["useScript","script","src","attributes","callbacks","onLoadCallback","onErrorCallback","elementIdToAppend","forcedStatus","undefined","status","setStatus","useState","useEffect","_script$callbacks","_script$callbacks2","scriptToAdd","document","querySelector","createElement","async","setAttribute","Object","entries","length","map","key","value","getElementById","appendChild","body","setAttributeFromEvent","event","type","addEventListener","currentScriptStatus","getAttribute","setStateFromEvent","_script$callbacks3","_script$callbacks4","removeEventListener","useGoogleMaps","apiKey","libraries","loadScriptExternally","callback","window","googleMapsCallback","join","id","isArraysEqualEps","arrayA","arrayB","eps","i","Math","abs","useMemoCompare","next","compare","previousRef","useRef","previous","current","isEqual","createOverlay","container","pane","position","maps","Overlay","OverlayView","constructor","onAdd","getPanes","classList","add","draw","projection","getProjection","point","fromLatLngToDivPixel","style","transform","x","y","onRemove","parentNode","removeChild","propTypes","element","isRequired","string","shape","lat","number","lng","object","zIndex","children","useMemo","div","overlay","childrenProps","props","prev","setMap","createPortal","defaultProps","node","MapMarkers","markers","Children","child","isValidElement","latLng","React","EPS","MapComponent","defaultCenter","defaultZoom","onGoogleApiLoaded","onChange","options","mapRef","prevBoundsRef","setMaps","googleApiCalled","setGoogleApiCalled","onIdle","useCallback","zoom","getZoom","bounds","getBounds","centerLatLng","getCenter","ne","getNorthEast","sw","getSouthWest","boundsArray","center","google","Map","ref","clearListeners","addListener","Fragment","className","width","height","left","top","margin","padding","oneOfType","arrayOf","func","GoogleMap","forwardRef","loadingContent","idleContent","errorContent","mapMinHeight","containerProps","scriptCallback","renderers","ready","loading","idle","error","_status","assign","overflow","minHeight","bool","oneOf"],"mappings":";;;;AA0BO,MAAMA,SAAS,GAAGA,CACxBC,MAAM,GAAG;EACRC,GAAG,EAAE,EAAE;EACPC,UAAU,EAAE,EAAE;EACdC,SAAS,EAAE;IAAEC,cAAc,EAAE,IAAI;IAAEC,eAAe,EAAE;GAAM;EAC1DC,iBAAiB,EAAE;AACpB,CAAC,EACDC,YAAY,GAAGC,SAAS,KACpB;EAEJ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGC,QAAQ,CAACX,MAAM,CAACC,GAAG,GAAG,SAAS,GAA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EgD,OAAO,CAAChD,IAAI,CAAC,CAAC,CAAC;EAI1CoD,cAAc,EAAEpD,IAAI;EAIpBqD,WAAW,EAAErD,IAAI;EAIjBsD,YAAY,EAAEtD,IAAI;EAIlBuD,YAAY,EAAER,SAAS,CAAC,CAAC7D,MAAM,EAAEH,MAAM,CAAC,CAAC;EAIzCyE,cAAc,EAAEpE,MAAM;EAOtBrD,oBAAoB,EAAEoI,IAAI;EAK1BtK,MAAM,EAAEuK,KAAK,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EAKpDX,cAAc,EAAER;AACjB,CAAC;;;;"} \ No newline at end of file diff --git a/docs/package.json b/docs/package.json index a5999fa..7b5a4a1 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "node ../node_modules/react-scripts/bin/react-scripts.js start", + "dev": "node ../node_modules/react-scripts/bin/react-scripts.js start", "build": "node ../node_modules/react-scripts/bin/react-scripts.js build", "test": "node ../node_modules/react-scripts/bin/react-scripts.js test", "eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject" diff --git a/package.json b/package.json index a4b2cd7..d926e46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "google-maps-react-markers", - "version": "1.1.5", + "version": "1.1.6", "description": "Google Maps library with markers as react components", "author": "Giorgia Bosello", "license": "MIT", @@ -28,7 +28,7 @@ }, "scripts": { "build": "microbundle-crl --no-compress --format modern,cjs", - "start": "microbundle-crl watch --no-compress --format modern,cjs", + "dev": "microbundle-crl watch --no-compress --format modern,cjs", "prepare": "run-s build", "test": "run-s test:unit test:lint test:build", "test:build": "run-s build",