google-maps-react-markers 2.0.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE.md +1 -1
- package/README.md +60 -198
- package/dist/index.d.ts +206 -286
- package/dist/index.js +989 -2
- package/dist/index.js.map +1 -0
- package/package.json +80 -112
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +0 -296
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["isDev","isDev"],"sources":["../src/context.ts","../src/loader.ts","../src/hooks.ts","../src/internal/geometry.ts","../src/internal/marker-handle.ts","../src/internal/map-events.ts","../src/internal/use-latest.ts","../src/google-map.tsx","../src/map-control.tsx","../src/internal/advanced-marker.ts","../src/internal/anchor.ts","../src/internal/a11y.ts","../src/internal/overlay-marker.ts","../src/marker.tsx"],"sourcesContent":["import { createContext, use } from 'react'\nimport type { GoogleMapsStatus } from './types'\n\nexport interface GoogleMapContextValue {\n\tmap: google.maps.Map | null\n\t/** Resolved renderer for markers, `null` until the map exists. */\n\trenderer: 'advanced' | 'overlay' | null\n\tstatus: GoogleMapsStatus\n}\n\nexport const GoogleMapContext = createContext<GoogleMapContextValue | null>(null)\n\nexport const useGoogleMapContext = (component: string): GoogleMapContextValue => {\n\tconst context = use(GoogleMapContext)\n\tif (!context) throw new Error(`[google-maps-react-markers] <${component}> must be rendered inside <GoogleMap>.`)\n\treturn context\n}\n","import { type APIOptions, importLibrary, setOptions } from '@googlemaps/js-api-loader'\nimport type { GoogleMapsLoaderOptions, GoogleMapsStatus } from './types'\n\ntype LibraryName = keyof google.maps.ImportLibraryMap\n\ndeclare global {\n\tinterface Window {\n\t\tgm_authFailure?: () => void\n\t}\n}\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\nlet configured = false\n/** The page loaded the API on its own (script tag or another loader). */\nlet external = false\n/** Resolves once a Maps script added by the page has finished loading. */\nlet externalReady: Promise<void> | null = null\nlet configuredKey: string | undefined\nlet status: GoogleMapsStatus = 'loading'\nlet error: Error | null = null\nlet mapsPromise: Promise<void> | null = null\nconst libraries = new Map<LibraryName, unknown>()\nconst libraryPromises = new Map<LibraryName, Promise<unknown>>()\nconst listeners = new Set<() => void>()\n\nconst emit = () => {\n\tfor (const listener of listeners) listener()\n}\n\nconst setStatus = (next: GoogleMapsStatus, nextError: Error | null = null) => {\n\tstatus = next\n\terror = nextError\n\temit()\n}\n\n/** Subscribes to loader changes (status and loaded libraries). */\nexport const subscribe = (listener: () => void) => {\n\tlisteners.add(listener)\n\treturn () => {\n\t\tlisteners.delete(listener)\n\t}\n}\n\nexport const getStatus = (): GoogleMapsStatus => status\nexport const getServerStatus = (): GoogleMapsStatus => 'loading'\nexport const getError = (): Error | null => error\nexport const isConfigured = () => configured\nexport const getLoadedLibrary = <T extends LibraryName>(name: T) =>\n\t(libraries.get(name) as google.maps.ImportLibraryMap[T] | undefined) ?? null\n\nconst configure = (options: GoogleMapsLoaderOptions) => {\n\tif (configured) {\n\t\tif (isDev && options.apiKey !== configuredKey) {\n\t\t\tconsole.warn(\n\t\t\t\t'[google-maps-react-markers] The Google Maps API is already loaded with other options. ' +\n\t\t\t\t\t'Only the options of the first <GoogleMap> are used.',\n\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\tconfigured = true\n\tconfiguredKey = options.apiKey\n\n\t// Google calls this global when the API key is rejected.\n\tconst previousAuthFailure = window.gm_authFailure\n\twindow.gm_authFailure = () => {\n\t\tpreviousAuthFailure?.()\n\t\tsetStatus('error', new Error('Google Maps rejected the API key. Check the key and its HTTP referrer restrictions.'))\n\t}\n\n\t// If the page already loads the API (script tag or another loader), reuse it.\n\tconst existing = (window as unknown as { google?: { maps?: { importLibrary?: unknown } } }).google\n\tif (existing?.maps?.importLibrary) {\n\t\texternal = true\n\t\treturn\n\t}\n\t// A <script> tag for the API is still loading: wait for it instead of loading a second copy.\n\tconst script = document.querySelector<HTMLScriptElement>('script[src*=\"maps.googleapis.com/maps/api/js\"]')\n\tif (script) {\n\t\texternal = true\n\t\texternalReady = new Promise((resolve, reject) => {\n\t\t\tscript.addEventListener('load', () => resolve(), { once: true })\n\t\t\tscript.addEventListener('error', () => reject(new Error('The Google Maps script on the page failed to load.')), {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t})\n\t\treturn\n\t}\n\n\tconst apiOptions: APIOptions = {\n\t\tkey: options.apiKey,\n\t\tv: options.version ?? 'weekly',\n\t\tlanguage: options.language,\n\t\tregion: options.region,\n\t\tmapIds: options.mapIds?.length ? options.mapIds : undefined,\n\t\tauthReferrerPolicy: options.authReferrerPolicy,\n\t\tchannel: options.channel,\n\t\tsolutionChannel: 'GMP_GMRM_v3',\n\t}\n\t// The bootstrap turns every key into a URL parameter: drop empty ones, or Google receives \"undefined\".\n\tconst defined = Object.fromEntries(\n\t\tObject.entries(apiOptions).filter(([, value]) => value !== undefined && value !== ''),\n\t) as APIOptions\n\tsetOptions(defined)\n\temit()\n}\n\n/**\n * Loads a Maps JavaScript API library once and caches it.\n * Waits for the first `<GoogleMap>` to configure the loader.\n */\nexport const loadLibrary = <T extends LibraryName>(name: T): Promise<google.maps.ImportLibraryMap[T]> => {\n\tlet promise = libraryPromises.get(name)\n\tif (!promise) {\n\t\tconst imported: Promise<unknown> = external\n\t\t\t? (externalReady ?? Promise.resolve()).then(() => google.maps.importLibrary(name))\n\t\t\t: importLibrary(name)\n\t\tpromise = imported.then((library) => {\n\t\t\tlibraries.set(name, library)\n\t\t\temit()\n\t\t\treturn library\n\t\t})\n\t\tlibraryPromises.set(name, promise)\n\t}\n\treturn promise as Promise<google.maps.ImportLibraryMap[T]>\n}\n\n/** Configures the loader with the first options it receives and loads the core and maps libraries. */\nexport const loadGoogleMaps = (options: GoogleMapsLoaderOptions): Promise<void> => {\n\tconfigure(options)\n\tif (!mapsPromise) {\n\t\tconst names: LibraryName[] = ['core', 'maps', ...(options.libraries ?? [])]\n\t\tmapsPromise = Promise.all(names.map((name) => loadLibrary(name))).then(\n\t\t\t() => {\n\t\t\t\t// An auth failure can arrive before the libraries resolve: keep the error.\n\t\t\t\tif (status !== 'error') setStatus('ready')\n\t\t\t},\n\t\t\t(reason: unknown) => {\n\t\t\t\tsetStatus('error', reason instanceof Error ? reason : new Error(String(reason)))\n\t\t\t\tthrow reason\n\t\t\t},\n\t\t)\n\t}\n\treturn mapsPromise\n}\n\n/** @internal Test helper: forgets everything the loader knows. */\nexport const resetLoaderForTests = () => {\n\tconfigured = false\n\texternal = false\n\texternalReady = null\n\tconfiguredKey = undefined\n\tstatus = 'loading'\n\terror = null\n\tmapsPromise = null\n\tlibraries.clear()\n\tlibraryPromises.clear()\n\tlisteners.clear()\n}\n","import { use, useEffect, useSyncExternalStore } from 'react'\nimport { GoogleMapContext } from './context'\nimport { getLoadedLibrary, getServerStatus, getStatus, isConfigured, loadLibrary, subscribe } from './loader'\nimport type { GoogleMapsStatus } from './types'\n\n/**\n * The `google.maps.Map` instance of the closest `<GoogleMap>`, or `null` while it is loading\n * (and on the server). Throws when used outside `<GoogleMap>`: use its `onLoad` prop there.\n */\nexport const useMap = (): google.maps.Map | null => {\n\tconst context = use(GoogleMapContext)\n\tif (!context) {\n\t\tthrow new Error('[google-maps-react-markers] useMap() must be used inside <GoogleMap>. Outside it, use onLoad.')\n\t}\n\treturn context.map\n}\n\n/** Loading status of the Google Maps JavaScript API. Always `'loading'` on the server. */\nexport const useGoogleMapsStatus = (): GoogleMapsStatus => useSyncExternalStore(subscribe, getStatus, getServerStatus)\n\nconst getServerLibrary = () => null\n\n/**\n * Loads a Maps JavaScript API library, for example `useMapsLibrary('places')`.\n * Returns `null` until it is loaded (and on the server). Works anywhere in the page,\n * as soon as a `<GoogleMap>` has configured the loader.\n */\nexport const useMapsLibrary = <T extends keyof google.maps.ImportLibraryMap>(\n\tname: T,\n): google.maps.ImportLibraryMap[T] | null => {\n\tconst library = useSyncExternalStore(subscribe, () => getLoadedLibrary(name), getServerLibrary)\n\tconst configured = useSyncExternalStore(subscribe, isConfigured, () => false)\n\n\tuseEffect(() => {\n\t\tif (configured && !library) {\n\t\t\tloadLibrary(name).catch(() => {\n\t\t\t\t// The status hook reports load errors.\n\t\t\t})\n\t\t}\n\t}, [configured, library, name])\n\n\treturn library\n}\n","import type { BBox, LatLngLiteral } from '../types'\n\n/** Compares two numeric arrays element by element, within `eps`. Empty arrays are never equal. */\nexport const isArraysEqualEps = (arrayA: readonly number[], arrayB: readonly number[], eps = 0.000001): boolean => {\n\tif (!arrayA.length || arrayA.length !== arrayB.length) return false\n\tfor (let i = 0; i < arrayA.length; i++) {\n\t\tif (Math.abs((arrayA[i] as number) - (arrayB[i] as number)) > eps) return false\n\t}\n\treturn true\n}\n\n/** Converts map bounds to `[westLng, southLat, eastLng, northLat]`, the format used by supercluster. */\nexport const boundsToBbox = (bounds: google.maps.LatLngBounds): BBox => {\n\tconst ne = bounds.getNorthEast()\n\tconst sw = bounds.getSouthWest()\n\treturn [sw.lng(), sw.lat(), ne.lng(), ne.lat()]\n}\n\nexport const toLatLngLiteral = (\n\tvalue: google.maps.LatLng | google.maps.LatLngLiteral | google.maps.LatLngAltitudeLiteral | null | undefined,\n): LatLngLiteral | null => {\n\tif (!value) return null\n\tif (typeof (value as google.maps.LatLng).lat === 'function') {\n\t\tconst latLng = value as google.maps.LatLng\n\t\treturn { lat: latLng.lat(), lng: latLng.lng() }\n\t}\n\tconst literal = value as google.maps.LatLngLiteral\n\treturn { lat: literal.lat, lng: literal.lng }\n}\n\n/**\n * Equality for map options: shallow, plus a structural check for nested values\n * (`styles`, `restriction`), so inline objects do not call setOptions on every render.\n */\nexport const optionsEqual = (a: object | undefined, b: object | undefined): boolean => {\n\tif (shallowEqual(a, b)) return true\n\tif (!a || !b) return false\n\tconst keysA = Object.keys(a)\n\tif (keysA.length !== Object.keys(b).length) return false\n\treturn keysA.every((key) => {\n\t\tconst valueA = (a as Record<string, unknown>)[key]\n\t\tconst valueB = (b as Record<string, unknown>)[key]\n\t\tif (Object.is(valueA, valueB)) return true\n\t\tif (typeof valueA !== 'object' || typeof valueB !== 'object' || !valueA || !valueB) return false\n\t\ttry {\n\t\t\treturn JSON.stringify(valueA) === JSON.stringify(valueB)\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t})\n}\n\n/** Shallow equality for plain option objects. */\nexport const shallowEqual = (a: object | undefined, b: object | undefined): boolean => {\n\tif (a === b) return true\n\tif (!a || !b) return false\n\tconst keysA = Object.keys(a)\n\tif (keysA.length !== Object.keys(b).length) return false\n\treturn keysA.every((key) => Object.is((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key]))\n}\n","import type { LatLngLiteral, MarkerProps } from '../types'\nimport type { AnchorPoint } from './anchor'\n\nexport type MarkerHandlers = Pick<MarkerProps, 'onClick' | 'onDrag' | 'onDragEnd' | 'onDragStart'>\n\n/** What `<Marker>` needs from a renderer. Each setter is cheap and never recreates the marker. */\nexport interface MarkerHandle {\n\tdestroy(): void\n\tsetAnchor(anchor: AnchorPoint): void\n\tsetClassName(className: string | undefined): void\n\tsetClickable(clickable: boolean): void\n\tsetCollisionBehavior(behavior: google.maps.CollisionBehaviorString | undefined): void\n\tsetDraggable(draggable: boolean): void\n\tsetPosition(position: LatLngLiteral): void\n\tsetTitle(title: string | undefined): void\n\tsetZIndex(zIndex: number | undefined): void\n}\n\n/** Set on every marker container: map mouse events coming from a marker are ignored. */\nexport const MARKER_ATTRIBUTE = 'data-gmrm-marker'\n\nexport interface MarkerInit {\n\tcontainer: HTMLDivElement\n\t/** Returns the latest handlers from props. */\n\tgetHandlers: () => MarkerHandlers\n\tmap: google.maps.Map\n}\n","import type { MapEventProps } from '../types'\n\n/** Prop name → Google Maps event name. Mouse events receive `(event, map)`, the others `(map)`. */\nexport const MAP_EVENTS = {\n\tonBoundsChanged: 'bounds_changed',\n\tonCenterChanged: 'center_changed',\n\tonClick: 'click',\n\tonContextMenu: 'contextmenu',\n\tonDoubleClick: 'dblclick',\n\tonDrag: 'drag',\n\tonDragEnd: 'dragend',\n\tonDragStart: 'dragstart',\n\tonHeadingChanged: 'heading_changed',\n\tonIdle: 'idle',\n\tonMapTypeIdChanged: 'maptypeid_changed',\n\tonMouseMove: 'mousemove',\n\tonMouseOut: 'mouseout',\n\tonMouseOver: 'mouseover',\n\tonTilesLoaded: 'tilesloaded',\n\tonTiltChanged: 'tilt_changed',\n\tonZoomChanged: 'zoom_changed',\n} as const satisfies Record<keyof MapEventProps, string>\n\nexport const MOUSE_EVENTS = new Set<keyof MapEventProps>([\n\t'onClick',\n\t'onContextMenu',\n\t'onDoubleClick',\n\t'onMouseMove',\n\t'onMouseOut',\n\t'onMouseOver',\n])\n\nexport const MAP_EVENT_PROPS = Object.keys(MAP_EVENTS) as (keyof MapEventProps)[]\n","import { useLayoutEffect, useRef } from 'react'\n\n/** A ref that always holds the latest value. Read it in event handlers, never during render. */\nexport const useLatest = <T>(value: T) => {\n\tconst ref = useRef(value)\n\tuseLayoutEffect(() => {\n\t\tref.current = value\n\t})\n\treturn ref\n}\n","import { type CSSProperties, useEffect, useMemo, useRef, useState } from 'react'\nimport { GoogleMapContext, type GoogleMapContextValue } from './context'\nimport { useGoogleMapsStatus } from './hooks'\nimport { boundsToBbox, isArraysEqualEps, optionsEqual } from './internal/geometry'\nimport { MARKER_ATTRIBUTE } from './internal/marker-handle'\nimport { MAP_EVENTS, MAP_EVENT_PROPS, MOUSE_EVENTS } from './internal/map-events'\nimport { useLatest } from './internal/use-latest'\nimport { loadGoogleMaps, loadLibrary } from './loader'\nimport type { GoogleMapProps } from './types'\n\nconst isDev = process.env.NODE_ENV !== 'production'\n\n/**\n * Whether a map mouse event happened over a marker. Google reports the event on its own\n * layer, so the target is not enough: check what is under the pointer too.\n */\nconst isOnMarker = (event: google.maps.MapMouseEvent | undefined) => {\n\tconst domEvent = event?.domEvent\n\tif (!domEvent) return false\n\tconst selector = `[${MARKER_ATTRIBUTE}]`\n\tif (domEvent.target instanceof Element && domEvent.target.closest(selector)) return true\n\tif (!('clientX' in domEvent) || typeof document.elementsFromPoint !== 'function') return false\n\treturn document\n\t\t.elementsFromPoint(domEvent.clientX, domEvent.clientY)\n\t\t.some((element) => element.closest(selector) !== null)\n}\n\nconst baseStyle: CSSProperties = { position: 'relative', overflow: 'hidden' }\n/** Without a className the map fills its parent. With one, the class decides the size. */\nconst fillStyle: CSSProperties = { ...baseStyle, width: '100%', height: '100%' }\nconst layerStyle: CSSProperties = { position: 'absolute', inset: 0 }\n\n/**\n * A Google Map. Renders `loadingContent` on the server and while the API loads, then the map.\n * Put `<Marker>`, `<MapControl>` and components that use `useMap()` inside it.\n */\nexport const GoogleMap = (props: GoogleMapProps) => {\n\tconst {\n\t\tapiKey,\n\t\tversion,\n\t\tlanguage,\n\t\tregion,\n\t\tlibraries,\n\t\tmapIds,\n\t\tauthReferrerPolicy,\n\t\tchannel,\n\t\tmapId,\n\t\tmarkerRenderer = 'auto',\n\t\tcenter,\n\t\tzoom,\n\t\toptions,\n\t\tloadingContent = null,\n\t\terrorContent = null,\n\t\tclassName,\n\t\tstyle,\n\t\tid,\n\t\tref,\n\t\tchildren,\n\t} = props\n\n\tconst mapDivRef = useRef<HTMLDivElement>(null)\n\tconst latest = useLatest(props)\n\tconst [map, setMap] = useState<google.maps.Map | null>(null)\n\tconst [failed, setFailed] = useState(false)\n\tconst status = useGoogleMapsStatus()\n\n\t// Create the map once per mapId (a map ID cannot change on an existing map).\n\tuseEffect(() => {\n\t\tconst div = mapDivRef.current\n\t\tif (!div) return undefined\n\t\tlet cancelled = false\n\t\tlet instance: google.maps.Map | null = null\n\t\tconst initial = latest.current\n\n\t\tloadGoogleMaps({ apiKey, version, language, region, libraries, mapIds, authReferrerPolicy, channel })\n\t\t\t.then(() => (mapId ? loadLibrary('marker') : undefined))\n\t\t\t.then(() => {\n\t\t\t\tif (cancelled) return\n\t\t\t\tif (\n\t\t\t\t\tisDev &&\n\t\t\t\t\t!(initial.center ?? initial.defaultCenter) &&\n\t\t\t\t\tinitial.zoom === undefined &&\n\t\t\t\t\tinitial.defaultZoom === undefined\n\t\t\t\t) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'[google-maps-react-markers] Pass center/defaultCenter and zoom/defaultZoom, or the map stays blank.',\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tinstance = new google.maps.Map(div, {\n\t\t\t\t\t...initial.options,\n\t\t\t\t\tcenter: initial.center ?? initial.defaultCenter,\n\t\t\t\t\tzoom: initial.zoom ?? initial.defaultZoom,\n\t\t\t\t\tmapId,\n\t\t\t\t})\n\t\t\t\tsetMap(instance)\n\t\t\t\tlatest.current.onLoad?.({ map: instance, maps: google.maps })\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\t// Core load errors also set the global status; a failed `marker` library or map creation only fails this map.\n\t\t\t\tif (cancelled) return\n\t\t\t\tif (isDev) console.error('[google-maps-react-markers] The map could not be created.', error)\n\t\t\t\tsetFailed(true)\n\t\t\t})\n\n\t\treturn () => {\n\t\t\tcancelled = true\n\t\t\tif (instance) {\n\t\t\t\tgoogle.maps.event.clearInstanceListeners(instance)\n\t\t\t\tsetMap(null)\n\t\t\t}\n\t\t}\n\t\t// The loader only uses the options of the first map, so they are not dependencies.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [mapId])\n\n\t// Options: apply only real changes, so an inline object does not call setOptions on every render.\n\tconst appliedOptions = useRef(options)\n\tuseEffect(() => {\n\t\tif (!map || optionsEqual(appliedOptions.current, options)) return\n\t\tappliedOptions.current = options\n\t\tif (options) map.setOptions(options)\n\t}, [map, options])\n\n\t// Controlled center and zoom.\n\tconst centerLat = center?.lat\n\tconst centerLng = center?.lng\n\tuseEffect(() => {\n\t\tif (!map || centerLat === undefined || centerLng === undefined) return\n\t\tconst current = map.getCenter()\n\t\tif (current && isArraysEqualEps([current.lat(), current.lng()], [centerLat, centerLng], 1e-9)) return\n\t\tmap.setCenter({ lat: centerLat, lng: centerLng })\n\t}, [map, centerLat, centerLng])\n\n\tuseEffect(() => {\n\t\tif (!map || zoom === undefined || map.getZoom() === zoom) return\n\t\tmap.setZoom(zoom)\n\t}, [map, zoom])\n\n\t// Event props: one listener per event in use. Handlers are read from the latest props.\n\tconst activeEvents = MAP_EVENT_PROPS.filter((name) => props[name]).join(',')\n\tuseEffect(() => {\n\t\tif (!map || !activeEvents) return undefined\n\t\tconst listeners = activeEvents.split(',').map((name) => {\n\t\t\tconst prop = name as (typeof MAP_EVENT_PROPS)[number]\n\t\t\treturn map.addListener(MAP_EVENTS[prop], (event?: google.maps.MapMouseEvent) => {\n\t\t\t\tconst handler = latest.current[prop]\n\t\t\t\tif (!handler) return\n\t\t\t\t// A click on a marker is the marker's, not the map's.\n\t\t\t\tif (MOUSE_EVENTS.has(prop) && isOnMarker(event)) return\n\t\t\t\tif (MOUSE_EVENTS.has(prop) && event)\n\t\t\t\t\t(handler as (e: google.maps.MapMouseEvent, m: google.maps.Map) => void)(event, map)\n\t\t\t\telse (handler as (m: google.maps.Map) => void)(map)\n\t\t\t})\n\t\t})\n\t\treturn () => {\n\t\t\tfor (const listener of listeners) listener.remove()\n\t\t}\n\t}, [map, activeEvents, latest])\n\n\t// onChange: fired on idle, only when center, zoom or bounds really changed.\n\tuseEffect(() => {\n\t\tif (!map) return undefined\n\t\tlet previous: number[] = []\n\t\tconst listener = map.addListener('idle', () => {\n\t\t\tconst onChange = latest.current.onChange\n\t\t\tconst bounds = map.getBounds()\n\t\t\tconst mapCenter = map.getCenter()\n\t\t\tconst mapZoom = map.getZoom()\n\t\t\tif (!onChange || !bounds || !mapCenter || mapZoom === undefined) return\n\t\t\tconst bbox = boundsToBbox(bounds)\n\t\t\tconst next = [...bbox, mapZoom]\n\t\t\tif (isArraysEqualEps(next, previous)) return\n\t\t\tprevious = next\n\t\t\tonChange({ map, bounds, bbox, zoom: mapZoom, center: { lat: mapCenter.lat(), lng: mapCenter.lng() } })\n\t\t})\n\t\treturn () => listener.remove()\n\t}, [map, latest])\n\n\tconst renderer: GoogleMapContextValue['renderer'] = !map\n\t\t? null\n\t\t: markerRenderer === 'overlay' || !mapId\n\t\t\t? 'overlay'\n\t\t\t: 'advanced'\n\n\tuseEffect(() => {\n\t\tif (isDev && markerRenderer === 'advanced' && !mapId) {\n\t\t\tconsole.warn('[google-maps-react-markers] markerRenderer=\"advanced\" needs a mapId. Falling back to \"overlay\".')\n\t\t}\n\t}, [markerRenderer, mapId])\n\n\tconst contextValue = useMemo<GoogleMapContextValue>(() => ({ map, renderer, status }), [map, renderer, status])\n\n\tconst hasError = status === 'error' || failed\n\tconst loading = !hasError && (status !== 'ready' || !map)\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tid={id}\n\t\t\tclassName={className}\n\t\t\tstyle={{ ...(className ? baseStyle : fillStyle), ...style }}\n\t\t\t// Assistive technology waits for the map instead of reading a half-built one.\n\t\t\taria-busy={loading || undefined}\n\t\t>\n\t\t\t{/* Google draws the map here. The attribute lets tests and styles tell its UI apart. */}\n\t\t\t<div key={mapId ?? ''} ref={mapDivRef} style={layerStyle} data-gmrm-map=\"\" />\n\t\t\t{hasError ? (\n\t\t\t\t// role=\"alert\" is announced as soon as it appears.\n\t\t\t\t<div role=\"alert\" style={layerStyle}>\n\t\t\t\t\t{errorContent}\n\t\t\t\t</div>\n\t\t\t) : loading ? (\n\t\t\t\t<div style={layerStyle}>{loadingContent}</div>\n\t\t\t) : null}\n\t\t\t<GoogleMapContext value={contextValue}>{children}</GoogleMapContext>\n\t\t</div>\n\t)\n}\n","import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useGoogleMapContext } from './context'\nimport type { MapControlProps } from './types'\n\n/** Renders React content as a native map control, for example `<MapControl position=\"TOP_RIGHT\">`. */\nexport const MapControl = ({ position, children }: MapControlProps) => {\n\tconst { map } = useGoogleMapContext('MapControl')\n\tconst [container, setContainer] = useState<HTMLDivElement | null>(null)\n\n\tuseEffect(() => {\n\t\tif (!map) return undefined\n\t\tconst element = document.createElement('div')\n\t\tconst controlPosition = typeof position === 'string' ? google.maps.ControlPosition[position] : position\n\t\tconst controls = map.controls[controlPosition]\n\t\tif (!controls) return undefined\n\t\tcontrols.push(element)\n\t\t// eslint-disable-next-line react-hooks/set-state-in-effect\n\t\tsetContainer(element)\n\t\treturn () => {\n\t\t\tconst index = controls.getArray().indexOf(element)\n\t\t\tif (index !== -1) controls.removeAt(index)\n\t\t\tsetContainer(null)\n\t\t}\n\t}, [map, position])\n\n\treturn container ? createPortal(children, container) : null\n}\n","import type { AnchorPoint } from './anchor'\nimport { toLatLngLiteral } from './geometry'\nimport type { MarkerHandle, MarkerInit } from './marker-handle'\n\n/** A marker backed by `google.maps.marker.AdvancedMarkerElement`. Needs a map with a `mapId`. */\nexport const createAdvancedMarker = ({ map, container, getHandlers }: MarkerInit): MarkerHandle => {\n\tconst marker = new google.maps.marker.AdvancedMarkerElement()\n\t// Older API versions have no anchorLeft/anchorTop: fall back to a transform on the content.\n\tconst supportsAnchor = 'anchorLeft' in marker\n\tmarker.append(container)\n\n\t// Drag events go through addListener: their MapMouseEvent carries the live position,\n\t// while marker.position only updates when the drag ends.\n\tconst dragData = (event: google.maps.MapMouseEvent) => ({\n\t\tlatLng: toLatLngLiteral(event.latLng) ?? toLatLngLiteral(marker.position) ?? { lat: 0, lng: 0 },\n\t})\n\tconst onClick = (event: Event) => getHandlers().onClick?.(event)\n\tconst dragListeners = (\n\t\t[\n\t\t\t['dragstart', 'onDragStart'],\n\t\t\t['drag', 'onDrag'],\n\t\t\t['dragend', 'onDragEnd'],\n\t\t] as const\n\t).map(([name, handler]) =>\n\t\tmarker.addListener(name, (event: google.maps.MapMouseEvent) =>\n\t\t\tgetHandlers()[handler]?.(event.domEvent as Event, dragData(event)),\n\t\t),\n\t)\n\n\tmarker.addEventListener('gmp-click', onClick)\n\tmarker.map = map\n\n\treturn {\n\t\tsetPosition: (position) => {\n\t\t\tmarker.position = position\n\t\t},\n\t\tsetAnchor: ({ x, y }: AnchorPoint) => {\n\t\t\tif (supportsAnchor) {\n\t\t\t\tmarker.anchorLeft = `${-x * 100}%`\n\t\t\t\tmarker.anchorTop = `${-y * 100}%`\n\t\t\t} else {\n\t\t\t\t// The default anchor is bottom center.\n\t\t\t\tcontainer.style.transform = `translate(${(0.5 - x) * 100}%, ${(1 - y) * 100}%)`\n\t\t\t}\n\t\t},\n\t\tsetClassName: (className) => {\n\t\t\tcontainer.className = className ?? ''\n\t\t},\n\t\tsetZIndex: (zIndex) => {\n\t\t\tmarker.zIndex = zIndex ?? null\n\t\t},\n\t\tsetDraggable: (draggable) => {\n\t\t\tmarker.gmpDraggable = draggable\n\t\t},\n\t\tsetTitle: (title) => {\n\t\t\tmarker.title = title ?? ''\n\t\t},\n\t\tsetClickable: (clickable) => {\n\t\t\tmarker.gmpClickable = clickable\n\t\t},\n\t\tsetCollisionBehavior: (behavior) => {\n\t\t\tmarker.collisionBehavior = behavior ?? null\n\t\t},\n\t\tdestroy: () => {\n\t\t\tmarker.removeEventListener('gmp-click', onClick)\n\t\t\tfor (const listener of dragListeners) listener.remove()\n\t\t\tmarker.map = null\n\t\t\tmarker.remove()\n\t\t},\n\t}\n}\n","import type { MarkerAnchor } from '../types'\n\nconst PRESETS = {\n\tcenter: { x: 0.5, y: 0.5 },\n\ttop: { x: 0.5, y: 0 },\n\tbottom: { x: 0.5, y: 1 },\n\tleft: { x: 0, y: 0.5 },\n\tright: { x: 1, y: 0.5 },\n\t'top-left': { x: 0, y: 0 },\n\t'top-right': { x: 1, y: 0 },\n\t'bottom-left': { x: 0, y: 1 },\n\t'bottom-right': { x: 1, y: 1 },\n} as const\n\nexport interface AnchorPoint {\n\tx: number\n\ty: number\n}\n\nexport const resolveAnchor = (anchor: MarkerAnchor = 'center'): AnchorPoint =>\n\ttypeof anchor === 'string' ? PRESETS[anchor] : anchor\n\n/** Stable key for an anchor, so effects re-run only when it really changes. */\nexport const anchorKey = (anchor: MarkerAnchor | undefined): string => {\n\tconst { x, y } = resolveAnchor(anchor)\n\treturn `${x},${y}`\n}\n","import { MARKER_ATTRIBUTE } from './marker-handle'\n\n/** Same wording and keys as Google's advanced markers, so both renderers behave alike. */\nexport const DRAG_HELP =\n\t'To activate drag with keyboard, press Alt + Enter. Once in keyboard drag state, use the arrow keys to move the marker. To complete the drag, press the Enter key. To cancel, press Escape.'\n\nconst HELP_ID = 'gmrm-drag-help'\nconst LIVE_ID = 'gmrm-live'\nconst STYLE_ID = 'gmrm-styles'\n\nconst visuallyHidden =\n\t'position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0'\n\n/**\n * Focus ring for overlay markers: a white ring inside a blue one, visible on light and dark maps\n * (WCAG 2.4.13 Focus Appearance). `:where()` keeps specificity at zero, so any class overrides it.\n */\nconst css = `:where([${MARKER_ATTRIBUTE}][tabindex]):focus-visible{outline:3px solid #0b57d0;outline-offset:2px;box-shadow:0 0 0 2px #fff;border-radius:4px}`\n\nconst ensureElement = (id: string, create: () => HTMLElement) => {\n\tconst existing = document.getElementById(id)\n\tif (existing) return existing\n\tconst element = create()\n\telement.id = id\n\tdocument.body.append(element)\n\treturn element\n}\n\n/** Adds the focus ring style once per document. */\nexport const ensureMarkerStyles = () => {\n\tif (document.getElementById(STYLE_ID)) return\n\tconst style = document.createElement('style')\n\tstyle.id = STYLE_ID\n\tstyle.textContent = css\n\tdocument.head.append(style)\n}\n\n/** The id of a hidden element with the keyboard drag instructions, for aria-describedby. */\nexport const dragHelpId = () => {\n\tensureElement(HELP_ID, () => {\n\t\tconst element = document.createElement('div')\n\t\telement.hidden = true\n\t\telement.textContent = DRAG_HELP\n\t\treturn element\n\t})\n\treturn HELP_ID\n}\n\nlet announceTimer: ReturnType<typeof setTimeout> | undefined\n\n/** Speaks a short message through a shared polite live region. */\nexport const announce = (message: string) => {\n\tconst region = ensureElement(LIVE_ID, () => {\n\t\tconst element = document.createElement('div')\n\t\telement.setAttribute('role', 'status')\n\t\telement.setAttribute('aria-live', 'polite')\n\t\telement.setAttribute('aria-atomic', 'true')\n\t\telement.style.cssText = visuallyHidden\n\t\treturn element\n\t})\n\t// Clearing first makes screen readers repeat a message identical to the previous one.\n\tregion.textContent = ''\n\tclearTimeout(announceTimer)\n\tannounceTimer = setTimeout(() => {\n\t\tregion.textContent = message\n\t}, 50)\n}\n","import type { LatLngLiteral } from '../types'\nimport { announce, dragHelpId, ensureMarkerStyles } from './a11y'\nimport type { AnchorPoint } from './anchor'\nimport type { MarkerHandle, MarkerInit } from './marker-handle'\n\ninterface DragState {\n\tmoved: boolean\n\toriginX: number\n\toriginY: number\n\tpointerId: number\n\tstartX: number\n\tstartY: number\n}\n\n/** Pixels per arrow key press during a keyboard drag; Shift moves five times further. */\nconst KEYBOARD_STEP = 10\n\nconst ARROWS: Record<string, [number, number]> = {\n\tArrowUp: [0, -1],\n\tArrowDown: [0, 1],\n\tArrowLeft: [-1, 0],\n\tArrowRight: [1, 0],\n}\n\nconst FOCUSABLE =\n\t'a[href],button,input,select,textarea,summary,iframe,[contenteditable=\"\"],[contenteditable=\"true\"],[tabindex]:not([tabindex=\"-1\"])'\n\ntype OverlayMarkerClass = new (init: MarkerInit) => MarkerHandle\n\nlet OverlayMarker: OverlayMarkerClass | null = null\nlet OverlayBase: typeof google.maps.OverlayView | null = null\n\n/**\n * `google.maps.OverlayView` only exists once the API is loaded, so the class is created lazily.\n * One instance per marker, created once: props changes go through the setters.\n */\nconst getOverlayMarkerClass = (): OverlayMarkerClass => {\n\t// Re-create the class if the API was reloaded (tests, hot reload).\n\tif (OverlayMarker && OverlayBase === google.maps.OverlayView) return OverlayMarker\n\n\tclass GoogleMapsReactOverlayMarker extends google.maps.OverlayView implements MarkerHandle {\n\t\tprivate readonly container: HTMLDivElement\n\t\tprivate readonly getHandlers: MarkerInit['getHandlers']\n\t\tprivate position: LatLngLiteral = { lat: 0, lng: 0 }\n\t\tprivate anchor: AnchorPoint = { x: 0.5, y: 0.5 }\n\t\tprivate draggable = false\n\t\tprivate drag: DragState | null = null\n\t\t/** Position before a keyboard drag, restored by Escape. */\n\t\tprivate keyboardDrag: LatLngLiteral | null = null\n\t\tprivate suppressClick = false\n\t\tprivate clickable = false\n\t\tprivate title: string | undefined\n\t\t/** Watches the content of interactive markers for focusable elements of their own. */\n\t\tprivate contentObserver: MutationObserver | null = null\n\n\t\tconstructor({ map, container, getHandlers }: MarkerInit) {\n\t\t\tsuper()\n\t\t\tthis.container = container\n\t\t\tthis.getHandlers = getHandlers\n\n\t\t\tcontainer.style.position = 'absolute'\n\t\t\tcontainer.style.left = '0'\n\t\t\tcontainer.style.top = '0'\n\t\t\t// Clicks on a marker must not also fire the map's click.\n\t\t\tgoogle.maps.OverlayView.preventMapHitsFrom(container)\n\n\t\t\tcontainer.addEventListener('pointerdown', this.handlePointerDown)\n\t\t\tcontainer.addEventListener('pointermove', this.handlePointerMove)\n\t\t\tcontainer.addEventListener('pointerup', this.handlePointerUp)\n\t\t\tcontainer.addEventListener('pointercancel', this.handlePointerUp)\n\t\t\t// Capture phase, so a click that ends a drag never reaches the marker content.\n\t\t\tcontainer.addEventListener('click', this.handleClick, true)\n\t\t\t// The map starts panning on mousedown/touchstart: stop them while the marker is draggable.\n\t\t\tcontainer.addEventListener('mousedown', this.stopWhileDraggable)\n\t\t\tcontainer.addEventListener('touchstart', this.stopWhileDraggable, { passive: true })\n\t\t\tcontainer.addEventListener('keydown', this.handleKeyDown)\n\t\t\tcontainer.addEventListener('keyup', this.handleKeyUp)\n\t\t\tcontainer.addEventListener('blur', this.handleBlur)\n\t\t\tensureMarkerStyles()\n\n\t\t\tthis.setMap(map)\n\t\t}\n\n\t\toverride onAdd() {\n\t\t\tthis.getPanes()?.overlayMouseTarget.appendChild(this.container)\n\t\t}\n\n\t\toverride draw() {\n\t\t\tconst point = this.getProjection()?.fromLatLngToDivPixel(this.position)\n\t\t\tif (!point) return\n\t\t\t// Percent translate anchors the marker on its own size, without measuring the DOM.\n\t\t\t// Rounded pixels keep text sharp.\n\t\t\tthis.container.style.transform = `translate(${Math.round(point.x)}px, ${Math.round(point.y)}px) translate(${\n\t\t\t\t-this.anchor.x * 100\n\t\t\t}%, ${-this.anchor.y * 100}%)`\n\t\t}\n\n\t\toverride onRemove() {\n\t\t\tthis.container.remove()\n\t\t}\n\n\t\tsetPosition(position: LatLngLiteral) {\n\t\t\tif (this.drag || this.keyboardDrag) return\n\t\t\tthis.position = position\n\t\t\tthis.draw()\n\t\t}\n\n\t\tsetAnchor(anchor: AnchorPoint) {\n\t\t\tthis.anchor = anchor\n\t\t\tthis.draw()\n\t\t}\n\n\t\tsetClassName(className: string | undefined) {\n\t\t\tthis.container.className = className ?? ''\n\t\t}\n\n\t\tsetZIndex(zIndex: number | undefined) {\n\t\t\tthis.container.style.zIndex = zIndex === undefined ? '' : String(zIndex)\n\t\t}\n\n\t\tsetDraggable(draggable: boolean) {\n\t\t\tthis.draggable = draggable\n\t\t\tthis.container.style.cursor = draggable ? 'grab' : ''\n\t\t\tthis.container.style.touchAction = draggable ? 'none' : ''\n\t\t\tthis.container.style.userSelect = draggable ? 'none' : ''\n\t\t\tif (!draggable && this.keyboardDrag) this.endKeyboardDrag(new KeyboardEvent('keydown'), false)\n\t\t\tthis.updateAccessibility()\n\t\t}\n\n\t\tsetTitle(title: string | undefined) {\n\t\t\tthis.title = title\n\t\t\tif (title) this.container.title = title\n\t\t\telse this.container.removeAttribute('title')\n\t\t\tthis.updateAccessibility()\n\t\t}\n\n\t\tsetClickable(clickable: boolean) {\n\t\t\t// Mouse clicks always reach the content; this decides keyboard access and the role.\n\t\t\tthis.clickable = clickable\n\t\t\tthis.updateAccessibility()\n\t\t}\n\n\t\t/**\n\t\t * Clickable or draggable markers are buttons in the tab order, named by `title`, like\n\t\t * Google's advanced markers. Other markers with a title are named groups; the rest stay plain.\n\t\t */\n\t\tprivate updateAccessibility() {\n\t\t\tconst { container, title } = this\n\t\t\tconst watch = this.clickable || this.draggable\n\t\t\tif (watch && !this.contentObserver && typeof MutationObserver !== 'undefined') {\n\t\t\t\tthis.contentObserver = new MutationObserver(() => this.updateAccessibility())\n\t\t\t\tthis.contentObserver.observe(container, { childList: true, subtree: true })\n\t\t\t} else if (!watch && this.contentObserver) {\n\t\t\t\tthis.contentObserver.disconnect()\n\t\t\t\tthis.contentObserver = null\n\t\t\t}\n\t\t\t// Content with its own button or link handles the keyboard: a button around it would nest\n\t\t\t// interactive elements. Dragging still needs the marker itself in the tab order.\n\t\t\tconst interactive = this.draggable || (this.clickable && !container.querySelector(FOCUSABLE))\n\t\t\tconst set = (name: string, value: string | null) => {\n\t\t\t\tif (value === null) container.removeAttribute(name)\n\t\t\t\telse container.setAttribute(name, value)\n\t\t\t}\n\t\t\tset('role', interactive ? 'button' : title ? 'group' : null)\n\t\t\tset('tabindex', interactive ? '0' : null)\n\t\t\tset('aria-label', title ?? null)\n\t\t\tset('aria-describedby', this.draggable ? dragHelpId() : null)\n\t\t\tset('aria-roledescription', this.draggable ? 'draggable marker' : null)\n\t\t}\n\n\t\tsetCollisionBehavior() {\n\t\t\t// Only advanced markers support collision behavior.\n\t\t}\n\n\t\tdestroy() {\n\t\t\tconst { container } = this\n\t\t\tcontainer.removeEventListener('pointerdown', this.handlePointerDown)\n\t\t\tcontainer.removeEventListener('pointermove', this.handlePointerMove)\n\t\t\tcontainer.removeEventListener('pointerup', this.handlePointerUp)\n\t\t\tcontainer.removeEventListener('pointercancel', this.handlePointerUp)\n\t\t\tcontainer.removeEventListener('click', this.handleClick, true)\n\t\t\tcontainer.removeEventListener('mousedown', this.stopWhileDraggable)\n\t\t\tcontainer.removeEventListener('touchstart', this.stopWhileDraggable)\n\t\t\tcontainer.removeEventListener('keydown', this.handleKeyDown)\n\t\t\tcontainer.removeEventListener('keyup', this.handleKeyUp)\n\t\t\tcontainer.removeEventListener('blur', this.handleBlur)\n\t\t\tthis.contentObserver?.disconnect()\n\t\t\tthis.contentObserver = null\n\t\t\tthis.setMap(null)\n\t\t}\n\n\t\tprivate readonly stopWhileDraggable = (event: Event) => {\n\t\t\tif (this.draggable) event.stopPropagation()\n\t\t}\n\n\t\tprivate readonly handlePointerDown = (event: PointerEvent) => {\n\t\t\tthis.suppressClick = false\n\t\t\tif (!this.draggable || event.button !== 0) return\n\t\t\tconst origin = this.getProjection()?.fromLatLngToDivPixel(this.position)\n\t\t\tif (!origin) return\n\t\t\tevent.stopPropagation()\n\t\t\tthis.container.setPointerCapture?.(event.pointerId)\n\t\t\tthis.drag = {\n\t\t\t\tpointerId: event.pointerId,\n\t\t\t\tstartX: event.clientX,\n\t\t\t\tstartY: event.clientY,\n\t\t\t\toriginX: origin.x,\n\t\t\t\toriginY: origin.y,\n\t\t\t\tmoved: false,\n\t\t\t}\n\t\t}\n\n\t\tprivate readonly handlePointerMove = (event: PointerEvent) => {\n\t\t\tconst { drag } = this\n\t\t\tif (!drag || event.pointerId !== drag.pointerId) return\n\t\t\tconst dx = event.clientX - drag.startX\n\t\t\tconst dy = event.clientY - drag.startY\n\t\t\tif (!drag.moved) {\n\t\t\t\t// A few pixels of tolerance, so a plain click is not a drag.\n\t\t\t\tif (Math.hypot(dx, dy) < 3) return\n\t\t\t\tdrag.moved = true\n\t\t\t\tthis.container.style.cursor = 'grabbing'\n\t\t\t\tthis.getHandlers().onDragStart?.(event, { latLng: this.position })\n\t\t\t}\n\t\t\tconst latLng = this.getProjection()?.fromDivPixelToLatLng(\n\t\t\t\tnew google.maps.Point(drag.originX + dx, drag.originY + dy),\n\t\t\t)\n\t\t\tif (!latLng) return\n\t\t\tthis.position = { lat: latLng.lat(), lng: latLng.lng() }\n\t\t\tthis.draw()\n\t\t\tthis.getHandlers().onDrag?.(event, { latLng: this.position })\n\t\t}\n\n\t\tprivate readonly handlePointerUp = (event: PointerEvent) => {\n\t\t\tconst { drag } = this\n\t\t\tif (!drag || event.pointerId !== drag.pointerId) return\n\t\t\tthis.drag = null\n\t\t\tif (this.container.hasPointerCapture?.(event.pointerId)) this.container.releasePointerCapture(event.pointerId)\n\t\t\tif (!drag.moved) return\n\t\t\tthis.container.style.cursor = this.draggable ? 'grab' : ''\n\t\t\t// The click that ends a mouse drag arrives in this same task; touch drags fire none.\n\t\t\tthis.suppressClick = true\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.suppressClick = false\n\t\t\t}, 0)\n\t\t\tthis.getHandlers().onDragEnd?.(event, { latLng: this.position })\n\t\t}\n\n\t\t/** Keys only act on the marker itself: buttons or inputs inside the content keep their own. */\n\t\tprivate readonly handleKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.target !== this.container) return\n\t\t\tconst handled = () => {\n\t\t\t\tevent.preventDefault()\n\t\t\t\t// The map pans on arrow keys: keep them for the marker.\n\t\t\t\tevent.stopPropagation()\n\t\t\t}\n\n\t\t\tif (this.keyboardDrag) {\n\t\t\t\tconst arrow = ARROWS[event.key]\n\t\t\t\tif (arrow) {\n\t\t\t\t\thandled()\n\t\t\t\t\tthis.moveBy(\n\t\t\t\t\t\tarrow[0] * KEYBOARD_STEP * (event.shiftKey ? 5 : 1),\n\t\t\t\t\t\tarrow[1] * KEYBOARD_STEP * (event.shiftKey ? 5 : 1),\n\t\t\t\t\t\tevent,\n\t\t\t\t\t)\n\t\t\t\t} else if (event.key === 'Enter' || event.key === ' ') {\n\t\t\t\t\thandled()\n\t\t\t\t\tthis.endKeyboardDrag(event, true)\n\t\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\t\thandled()\n\t\t\t\t\tthis.endKeyboardDrag(event, false)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (event.key === 'Enter' && event.altKey && this.draggable) {\n\t\t\t\thandled()\n\t\t\t\tthis.keyboardDrag = this.position\n\t\t\t\tthis.container.style.cursor = 'grabbing'\n\t\t\t\tthis.getHandlers().onDragStart?.(event, { latLng: this.position })\n\t\t\t\tannounce('Marker grabbed. Use the arrow keys to move it, Enter to drop, Escape to cancel.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!this.clickable) return\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\thandled()\n\t\t\t\tthis.getHandlers().onClick?.(event)\n\t\t\t} else if (event.key === ' ') {\n\t\t\t\t// Like a native button: Space clicks on release, and must not scroll the page.\n\t\t\t\thandled()\n\t\t\t}\n\t\t}\n\n\t\tprivate readonly handleKeyUp = (event: KeyboardEvent) => {\n\t\t\tif (event.target !== this.container || event.key !== ' ' || this.keyboardDrag || !this.clickable) return\n\t\t\tevent.preventDefault()\n\t\t\tthis.getHandlers().onClick?.(event)\n\t\t}\n\n\t\t/** Leaving the marker with Tab drops it where it is. */\n\t\tprivate readonly handleBlur = (event: FocusEvent) => {\n\t\t\tif (this.keyboardDrag) this.endKeyboardDrag(event, true)\n\t\t}\n\n\t\tprivate moveBy(dx: number, dy: number, event: Event) {\n\t\t\tconst projection = this.getProjection()\n\t\t\tconst origin = projection?.fromLatLngToDivPixel(this.position)\n\t\t\tif (!projection || !origin) return\n\t\t\tconst latLng = projection.fromDivPixelToLatLng(new google.maps.Point(origin.x + dx, origin.y + dy))\n\t\t\tif (!latLng) return\n\t\t\tthis.position = { lat: latLng.lat(), lng: latLng.lng() }\n\t\t\tthis.draw()\n\t\t\tthis.getHandlers().onDrag?.(event, { latLng: this.position })\n\t\t}\n\n\t\tprivate endKeyboardDrag(event: Event, drop: boolean) {\n\t\t\tconst start = this.keyboardDrag\n\t\t\tif (!start) return\n\t\t\tthis.keyboardDrag = null\n\t\t\tthis.container.style.cursor = this.draggable ? 'grab' : ''\n\t\t\tif (!drop) {\n\t\t\t\tthis.position = start\n\t\t\t\tthis.draw()\n\t\t\t}\n\t\t\tthis.getHandlers().onDragEnd?.(event, { latLng: this.position })\n\t\t\tannounce(drop ? 'Marker dropped.' : 'Drag cancelled.')\n\t\t}\n\n\t\tprivate readonly handleClick = (event: MouseEvent) => {\n\t\t\tif (this.suppressClick) {\n\t\t\t\tthis.suppressClick = false\n\t\t\t\tevent.stopImmediatePropagation()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.getHandlers().onClick?.(event)\n\t\t}\n\t}\n\n\tOverlayMarker = GoogleMapsReactOverlayMarker\n\tOverlayBase = google.maps.OverlayView\n\treturn OverlayMarker\n}\n\nexport const createOverlayMarker = (init: MarkerInit): MarkerHandle => new (getOverlayMarkerClass())(init)\n","import { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useGoogleMapContext } from './context'\nimport { createAdvancedMarker } from './internal/advanced-marker'\nimport { anchorKey, resolveAnchor } from './internal/anchor'\nimport { MARKER_ATTRIBUTE, type MarkerHandle } from './internal/marker-handle'\nimport { createOverlayMarker } from './internal/overlay-marker'\nimport { useLatest } from './internal/use-latest'\nimport type { MarkerProps } from './types'\n\nconst isDev = process.env.NODE_ENV !== 'production'\nlet warnedAboutTitle = false\n\n/**\n * Renders any React content at `lat`/`lng`. Must be inside `<GoogleMap>`.\n * Renders nothing on the server and until the map is ready.\n */\nexport const Marker = (props: MarkerProps) => {\n\tconst { lat, lng, anchor, zIndex, draggable = false, title, className, collisionBehavior, onClick, children } = props\n\tconst { map, renderer } = useGoogleMapContext('Marker')\n\tconst latest = useLatest(props)\n\tconst handleRef = useRef<MarkerHandle | null>(null)\n\tconst [container, setContainer] = useState<HTMLDivElement | null>(null)\n\n\t// One marker per map and renderer. Everything else is updated in place.\n\tuseEffect(() => {\n\t\tif (!map || !renderer) return undefined\n\t\tconst element = document.createElement('div')\n\t\telement.setAttribute(MARKER_ATTRIBUTE, '')\n\t\tconst init = { map, container: element, getHandlers: () => latest.current }\n\t\tconst handle = renderer === 'advanced' ? createAdvancedMarker(init) : createOverlayMarker(init)\n\t\thandleRef.current = handle\n\t\t// The portal target is a DOM node created here, after mount: never on the server.\n\t\t// eslint-disable-next-line react-hooks/set-state-in-effect\n\t\tsetContainer(element)\n\t\treturn () => {\n\t\t\thandle.destroy()\n\t\t\thandleRef.current = null\n\t\t\tsetContainer(null)\n\t\t}\n\t}, [map, renderer, latest])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setPosition({ lat, lng })\n\t}, [container, lat, lng])\n\n\tconst anchorId = anchorKey(anchor)\n\tuseEffect(() => {\n\t\thandleRef.current?.setAnchor(resolveAnchor(anchor))\n\t\t// anchorId captures the anchor value, so an inline { x, y } object does not re-run this.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [container, anchorId])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setZIndex(zIndex)\n\t}, [container, zIndex])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setDraggable(draggable)\n\t}, [container, draggable])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setTitle(title)\n\t}, [container, title])\n\n\tconst clickable = Boolean(onClick)\n\tuseEffect(() => {\n\t\thandleRef.current?.setClickable(clickable)\n\t}, [container, clickable])\n\n\tuseEffect(() => {\n\t\tif (!isDev || warnedAboutTitle || !container || title || !(clickable || draggable)) return\n\t\twarnedAboutTitle = true\n\t\tconsole.warn(\n\t\t\t'[google-maps-react-markers] A clickable or draggable <Marker> has no `title`. ' +\n\t\t\t\t'Screen readers announce it as an unnamed button: pass a short title.',\n\t\t)\n\t}, [container, title, clickable, draggable])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setCollisionBehavior(collisionBehavior)\n\t}, [container, collisionBehavior])\n\n\tuseEffect(() => {\n\t\thandleRef.current?.setClassName(className)\n\t}, [container, className])\n\n\treturn container ? createPortal(children, container) : null\n}\n"],"mappings":";;;;;;AAUA,MAAa,mBAAmB,cAA4C,IAAI;AAEhF,MAAa,uBAAuB,cAA6C;CAChF,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,gCAAgC,UAAU,uCAAuC;CAC/G,OAAO;AACR;;ACLA,MAAMA,UAAQ,QAAQ,IAAI,aAAa;AAEvC,IAAI,aAAa;;AAEjB,IAAI,WAAW;;AAEf,IAAI,gBAAsC;AAC1C,IAAI;AACJ,IAAI,SAA2B;AAE/B,IAAI,cAAoC;AACxC,MAAM,4BAAY,IAAI,I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|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
83
|
-
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
84
|
-
"eslint-plugin-prettier": "5.2.3",
|
|
85
|
-
"eslint-plugin-react": "7.37.4",
|
|
86
|
-
"eslint-plugin-react-hooks": "4.6.2",
|
|
87
|
-
"eslint-plugin-sort-class-members": "^1.21.0",
|
|
88
|
-
"eslint-plugin-typescript-sort-keys": "3.3.0",
|
|
89
|
-
"eslint-plugin-unused-imports": "3.2.0",
|
|
90
|
-
"gh-pages": "^6.3.0",
|
|
91
|
-
"husky": "9.1.7",
|
|
92
|
-
"lint-staged": "15.4.3",
|
|
93
|
-
"prettier": "^3.4.2",
|
|
94
|
-
"prop-types": "15.8.1",
|
|
95
|
-
"react": "^18.3.1",
|
|
96
|
-
"react-dom": "^18.3.1",
|
|
97
|
-
"tsup": "8.3.6",
|
|
98
|
-
"typescript": "^5.7.3",
|
|
99
|
-
"yalc": "1.0.0-pre.53"
|
|
100
|
-
},
|
|
101
|
-
"peerDependencies": {
|
|
102
|
-
"react": ">=18",
|
|
103
|
-
"react-dom": ">=18"
|
|
104
|
-
},
|
|
105
|
-
"resolutions": {
|
|
106
|
-
"glob-parent": ">=5.1.2",
|
|
107
|
-
"parse-url": ">=8.1.0",
|
|
108
|
-
"semver": ">=7.5.2",
|
|
109
|
-
"trim": ">=0.0.3",
|
|
110
|
-
"trim-newlines": ">=3.0.1",
|
|
111
|
-
"yaml": ">=2.2.2"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
2
|
+
"name": "google-maps-react-markers",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Google Maps for React 19: render any React component as a marker. Advanced markers or custom overlays, drag and drop, clustering-ready, SSR safe and fully typed.",
|
|
5
|
+
"author": "Giorgia Bosello",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/giorgiabosello/google-maps-react-markers.git",
|
|
10
|
+
"directory": "packages/google-maps-react-markers"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://giorgiabosello.github.io/google-maps-react-markers/",
|
|
13
|
+
"bugs": "https://github.com/giorgiabosello/google-maps-react-markers/issues",
|
|
14
|
+
"funding": "https://www.buymeacoffee.com/giorgiabosello",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"react-19",
|
|
18
|
+
"nextjs",
|
|
19
|
+
"google-maps",
|
|
20
|
+
"google-maps-react",
|
|
21
|
+
"markers",
|
|
22
|
+
"advanced-markers",
|
|
23
|
+
"overlay",
|
|
24
|
+
"map",
|
|
25
|
+
"clustering"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22.12"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": "^19.0.0",
|
|
45
|
+
"react-dom": "^19.0.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@googlemaps/js-api-loader": "^2.1.3",
|
|
49
|
+
"@types/google.maps": "^3.67.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
53
|
+
"@size-limit/preset-small-lib": "^14.3.0",
|
|
54
|
+
"@testing-library/dom": "^10.4.2",
|
|
55
|
+
"@testing-library/react": "^16.3.3",
|
|
56
|
+
"@types/react": "^19.3.3",
|
|
57
|
+
"@types/react-dom": "^19.3.0",
|
|
58
|
+
"@vitest/coverage-v8": "^5.1.2",
|
|
59
|
+
"jsdom": "^31.0.1",
|
|
60
|
+
"publint": "^0.3.25",
|
|
61
|
+
"react": "^19.3.1",
|
|
62
|
+
"react-dom": "^19.3.1",
|
|
63
|
+
"size-limit": "^14.3.0",
|
|
64
|
+
"tsdown": "^0.23.7",
|
|
65
|
+
"typescript": "~6.0.3",
|
|
66
|
+
"vitest": "^5.1.2"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public",
|
|
70
|
+
"provenance": true
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsdown",
|
|
74
|
+
"dev": "tsdown --watch",
|
|
75
|
+
"typecheck": "tsc --noEmit",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"test:watch": "vitest",
|
|
78
|
+
"check:package": "publint --strict --pack npm && attw --pack . --profile esm-only",
|
|
79
|
+
"size": "size-limit"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');var S={};function W(t){let r=document.querySelector(`script[src="${t}"]`),a=r==null?undefined:r.getAttribute("data-status");return {node:r,status:a}}function Y(t={src:"",attributes:{},callbacks:{onLoadCallback:()=>{},onErrorCallback:()=>{}},elementIdToAppend:""},r,a={removeOnUnmount:false,shouldPreventLoad:false}){let[l,s]=react.useState(()=>!t.src||a!=null&&a.shouldPreventLoad?"idle":typeof window>"u"?"loading":S[t.src]??"loading");return react.useEffect(()=>{var p,o,g;if(r){s(r);return}if(!(t!=null&&t.src)||a!=null&&a.shouldPreventLoad)return;let i=S[t.src];if(i==="ready"||i==="error"){s(i);return}let u=W(t.src),e=u.node;if(e){let c=u.status??i??"loading";switch(c){case "loading":case "ready":(o=t.callbacks)!=null&&o.onLoadCallback&&t.callbacks.onLoadCallback();break;case "error":(g=t.callbacks)!=null&&g.onErrorCallback&&t.callbacks.onErrorCallback();break;}s(c);}else {e=document.createElement("script"),e.src=t.src,e.async=true,e.setAttribute("data-status","loading"),t.attributes&&Object.entries(t.attributes).length>0&&Object.entries(t.attributes).map(([m,d])=>e==null?undefined:e.setAttribute(m,d)),t.elementIdToAppend&&document.getElementById(t.elementIdToAppend)?(p=document.getElementById(t.elementIdToAppend))==null||p.appendChild(e):document.body.appendChild(e);let c=m=>{let d=m.type==="load"?"ready":"error";e==null||e.setAttribute("data-status",d);};e.addEventListener("load",c),e.addEventListener("error",c);}let n=c=>{var d,b;let m=c.type==="load"?"ready":"error";c.type==="load"?(d=t.callbacks)!=null&&d.onLoadCallback&&t.callbacks.onLoadCallback():(b=t.callbacks)!=null&&b.onErrorCallback&&t.callbacks.onErrorCallback(),s(m),S[t.src]=m;};return e.addEventListener("load",n),e.addEventListener("error",n),()=>{e&&(e.removeEventListener("load",n),e.removeEventListener("error",n)),e&&(a!=null&&a.removeOnUnmount)&&e.remove();}},[t,r,l]),l}var H=Y;var O=({apiKey:t,libraries:r=[],loadScriptExternally:a=false,status:l="idle",externalApiParams:s,callback:i})=>{var n;typeof window<"u"&&(window.googleMapsCallback=i);let u=(n=new URLSearchParams(s))==null?undefined:n.toString(),e=t?{src:`https://maps.googleapis.com/maps/api/js?key=${t}&callback=googleMapsCallback&libraries=${r==null?undefined:r.join(",")}${u?`&${u}`:""}`,attributes:{id:"googleMapsApi"}}:{src:`https://maps.googleapis.com/maps/api/js?callback=googleMapsCallback&libraries=${r==null?undefined:r.join(",")}`,attributes:{id:"googleMapsApi"}};return H(e,a?l:undefined)};var T=(t,r,a=1e-6)=>{if(t.length&&r.length){for(let l=0;l!==t.length;++l)if(Math.abs(t[l]-r[l])>a)return false;return true}return false};var _=(t,r)=>{let a=react.useRef(),l=a.current,s=r(l,t);return react.useEffect(()=>{s||(a.current=t);}),s?l:t},x=_;var k=t=>{try{return {lat:t==null?void 0:t.lat(),lng:t==null?void 0:t.lng()}}catch{return t}},K=({container:t,pane:r,position:a,maps:l,drag:s})=>{class i extends google.maps.OverlayView{onAdd=()=>{var p;let e=this;s!=null&&s.draggable&&(this.get("map").getDiv().addEventListener("mouseleave",()=>{google.maps.event.trigger(this.container,"mouseup");}),this.container.addEventListener("mousedown",o=>{var g,c;this.container.style.cursor="grabbing",(g=e.map)==null||g.set("draggable",false),e.set("origin",o),s.onDragStart(o,{latLng:k(this.position)}),e.moveHandler=(c=this.get("map"))==null?undefined:c.getDiv().addEventListener("mousemove",m=>{var M,f;let d=e.get("origin");if(!d)return;let b=d.clientX-m.clientX,y=d.clientY-m.clientY,v=(M=e.getProjection())==null?undefined:M.fromLatLngToDivPixel(e.position);if(!v)return;let E=(f=e.getProjection())==null?undefined:f.fromDivPixelToLatLng(new l.Point(v.x-b,v.y-y));e.set("position",E),e.set("origin",m),e.draw(),s.onDrag(m,{latLng:k(E)});});}),this.container.addEventListener("mouseup",o=>{var g;(g=e.map)==null||g.set("draggable",true),this.container.style.cursor="default",e.moveHandler&&(google.maps.event.removeListener(e.moveHandler),e.moveHandler=null),e.set("position",e.position),e.set("origin",undefined),e.draw(),s.onDragEnd(o,{latLng:k(e.position)});}));let n=(p=this.getPanes())==null?undefined:p[this.pane];n==null||n.classList.add("google-map-markers-overlay"),n==null||n.appendChild(this.container);};draw=()=>{if(!this.container)return;let e=this.getProjection(),n=e==null?undefined:e.fromLatLngToDivPixel(this.position),p={x:this.container.offsetWidth/2,y:this.container.offsetHeight/2};n&&(this.container.style.transform=`translate(${n.x-p.x}px, ${n.y-p.y}px)`);};onRemove=()=>{this.container.parentNode!==null&&(google.maps.event.clearInstanceListeners(this.container),this.container.parentNode.removeChild(this.container));};container;pane;position;map=this.getMap();moveHandler;constructor(e,n,p){super(),this.container=e,this.pane=n,this.position=p,this.moveHandler=null;}}return new i(t,r,a)},U=K;var ee=({pane:t="floatPane",position:r,map:a,maps:l,zIndex:s=0,children:i,drag:u})=>{let e=react.useMemo(()=>{let o=document.createElement("div");return o.style.position="absolute",o},[]),n=react.useMemo(()=>U({container:e,pane:t,position:r,maps:l,drag:u}),[e,u,l,t,r]),p=x(i==null?undefined:i.props,(o,g)=>o&&o.lat===g.lat&&o.lng===g.lng&&o.draggable===g.draggable);return react.useEffect(()=>!n.map&&a?(n==null||n.setMap(a),()=>{n==null||n.setMap(null);}):()=>{},[a,p]),react.useEffect(()=>{e.style.zIndex=`${s}`;},[s,e]),reactDom.createPortal(i,e)},R=ee;var P=()=>{},ae=({children:t,map:r,maps:a})=>{let l=react.useMemo(()=>!r||!a?[]:react.Children.map(t,s=>{if(react.isValidElement(s)){let i={lat:s.props.lat,lng:s.props.lng},{zIndex:u,draggable:e=false,onDragStart:n=P,onDrag:p=P,onDragEnd:o=P}=s.props||{};return s=react.cloneElement(s,{...s.props,onDragStart:undefined,onDrag:undefined,onDragEnd:undefined}),jsxRuntime.jsx(R,{position:new a.LatLng(i.lat,i.lng),map:r,maps:a,zIndex:u,drag:{draggable:e,onDragStart:n,onDrag:p,onDragEnd:o},children:s})}return null}),[t,r,a]);return jsxRuntime.jsx("div",{children:l})},$=ae;function le({children:t=null,style:r={width:"100%",height:"100%",left:0,top:0,margin:0,padding:0,position:"absolute"},defaultCenter:a,defaultZoom:l,onGoogleApiLoaded:s,onChange:i,options:u={},events:e=[]}){let n=react.useRef(null),p=react.useRef([]),[o,g]=react.useState(),[c,m]=react.useState(),[d,b]=react.useState(false),y=react.useCallback(()=>{var v,E;try{if(!o)return;let M=o.getZoom()??l,f=o.getBounds(),F=[(v=o.getCenter())==null?void 0:v.lng(),(E=o.getCenter())==null?void 0:E.lat()],h=f==null?void 0:f.getNorthEast(),L=f==null?void 0:f.getSouthWest();if(!h||!L||!f)return;let D=[L.lng(),L.lat(),h.lng(),h.lat()];T(D,p.current)||(i&&i({zoom:M,center:F,bounds:f}),p.current=D);}catch(M){console.error(M);}},[o,i]);return react.useEffect(()=>{n.current&&!o&&(g(new google.maps.Map(n.current,{center:a,zoom:l,...u})),m(google.maps));},[a,l,o,n,u]),react.useEffect(()=>{o&&!d&&(typeof s=="function"&&c&&s({map:o,maps:c,ref:n.current}),b(true),google.maps.event.hasListeners(o,"idle")&&google.maps.event.clearListeners(o,"idle"),google.maps.event.addListener(o,"idle",y));},[d,o,s]),react.useEffect(()=>()=>{o&&google.maps.event.clearListeners(o,"idle");},[o]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:n,style:r,className:"google-map",...e==null?undefined:e.reduce((v,{name:E,handler:M})=>(v[E]=M,v),{})}),t&&o&&c&&jsxRuntime.jsx($,{map:o,maps:c,children:t})]})}var q=le;var ue=react.forwardRef(({apiKey:t="",libraries:r=["places","geometry"],children:a=null,loadingContent:l="Google Maps is loading",idleContent:s="Google Maps is on idle",errorContent:i="Google Maps is on error",mapMinHeight:u="unset",containerProps:e={},loadScriptExternally:n=false,status:p="idle",scriptCallback:o=()=>{},externalApiParams:g={},...c},m)=>{let d={ready:jsxRuntime.jsx(q,{...c,children:a}),loading:l,idle:s,error:i},b=O({apiKey:t,libraries:r,loadScriptExternally:n,status:p,externalApiParams:g,callback:o});return jsxRuntime.jsx("div",{ref:m,style:{height:"100%",width:"100%",overflow:"hidden",position:"relative",minHeight:u},...e,children:d[b]||null})}),B=ue;var qe=B;
|
|
2
|
-
module.exports=qe;
|