@sanity/google-maps-input 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -421,7 +421,7 @@ const fallbackLatLng = { lat: 40.7058254, lng: -74.1180863 }, MarkerDragSync = (
421
421
  defaultRadiusZoom = 12,
422
422
  defaultRadius = 1e3
423
423
  }) => {
424
- const circleRef = react.useRef(null), markerRef = react.useRef(), isMarkerDragging = react.useRef(!1), getCenter2 = react.useCallback(() => ({ ...fallbackLatLng, ...defaultLocation, ...value }), [value, defaultLocation]), setValue = react.useCallback(
424
+ const circleRef = react.useRef(null), markerRef = react.useRef(void 0), isMarkerDragging = react.useRef(!1), getCenter2 = react.useCallback(() => ({ ...fallbackLatLng, ...defaultLocation, ...value }), [value, defaultLocation]), setValue = react.useCallback(
425
425
  (geoPoint, radius) => {
426
426
  if (onChange) {
427
427
  const roundedRadius = radius ? Math.round(radius) : void 0;
@@ -700,7 +700,7 @@ class Arrow extends react.PureComponent {
700
700
  }
701
701
  }
702
702
  function GeopointMove({ diff, api, map, label }) {
703
- const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = sanity.useUserColor(annotation ? annotation.author : null) || void 0, fromRef = react.useRef(), toRef = react.useRef();
703
+ const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = sanity.useUserColor(annotation ? annotation.author : null) || void 0, fromRef = react.useRef(void 0), toRef = react.useRef(void 0);
704
704
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
705
705
  from && /* @__PURE__ */ jsxRuntime.jsx(
706
706
  Marker,
@@ -823,7 +823,7 @@ function getAction$1(diff) {
823
823
  return fromValue && toValue ? "Moved" : fromValue ? "Removed" : toValue ? "Added" : "Unchanged";
824
824
  }
825
825
  function GeopointRadiusMove({ diff, api, map, label }) {
826
- const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = sanity.useUserColor(annotation ? annotation.author : null) || void 0, fromRef = react.useRef(), toRef = react.useRef(), fromCircleRef = react.useRef(), toCircleRef = react.useRef();
826
+ const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = sanity.useUserColor(annotation ? annotation.author : null) || void 0, fromRef = react.useRef(void 0), toRef = react.useRef(void 0), fromCircleRef = react.useRef(void 0), toCircleRef = react.useRef(void 0);
827
827
  return react.useEffect(() => {
828
828
  const color = userColor?.background || "#4285F4";
829
829
  return from && from.radius && (fromCircleRef.current = new api.Circle({
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/loader/loadGoogleMapsApi.ts","../src/loader/LoadError.tsx","../src/loader/GoogleMapsLoadProxy.tsx","../src/global-workaround.ts","../src/input/GeopointInput.styles.tsx","../src/map/SearchInput.styles.tsx","../src/map/SearchInput.tsx","../src/map/util.ts","../src/map/Map.styles.tsx","../src/map/Map.tsx","../src/map/Marker.tsx","../src/input/GeopointSelect.tsx","../src/input/GeopointInput.tsx","../src/input/GeopointRadiusSelect.tsx","../src/input/GeopointRadiusInput.tsx","../src/map/Arrow.tsx","../src/diff/GeopointMove.tsx","../src/diff/GeopointFieldDiff.styles.tsx","../src/diff/GeopointArrayDiff.tsx","../src/diff/GeopointFieldDiff.tsx","../src/diff/GeopointRadiusMove.tsx","../src/diff/GeopointRadiusFieldDiff.tsx","../src/plugin.tsx"],"sourcesContent":["declare global {\n // eslint-disable-next-line\n interface Window {\n gm_authFailure: any\n ___sanity_googleMapsApiCallback: any\n }\n}\n\nconst callbackName = '___sanity_googleMapsApiCallback'\nconst authFailureCallbackName = 'gm_authFailure'\n\nexport class AuthError extends Error {}\n\nfunction _loadGoogleMapsApi(config: {locale: string; apiKey: string}) {\n return new Promise<typeof window.google.maps>((resolve, reject) => {\n window[authFailureCallbackName] = () => {\n reject(new AuthError('Authentication error when loading Google Maps API.'))\n }\n\n window[callbackName] = () => {\n resolve(window.google.maps)\n }\n\n const script = document.createElement('script')\n script.onerror = (\n event: Event | string,\n source?: string,\n lineno?: number,\n colno?: number,\n error?: Error,\n ) => reject(new Error(coeerceError(event, error)))\n\n script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${callbackName}&language=${config.locale}`\n document.getElementsByTagName('head')[0].appendChild(script)\n }).finally(() => {\n delete window[callbackName]\n delete window[authFailureCallbackName]\n })\n}\n\nlet memo: Promise<typeof window.google.maps> | null = null\nexport function loadGoogleMapsApi(config: {\n locale: string\n apiKey: string\n}): Promise<typeof window.google.maps> {\n if (memo) {\n return memo\n }\n memo = _loadGoogleMapsApi(config)\n memo.catch(() => {\n memo = null\n })\n return memo\n}\nfunction coeerceError(event: Event | string, error?: Error): string {\n if (error) {\n return error.message\n }\n\n if (typeof event === 'string') {\n return event\n }\n\n return isErrorEvent(event) ? event.message : 'Failed to load Google Maps API'\n}\n\nfunction isErrorEvent(event: unknown): event is ErrorEvent {\n if (typeof event !== 'object' || event === null) {\n return false\n }\n\n if (!('message' in event)) {\n return false\n }\n\n return typeof (event as ErrorEvent).message === 'string'\n}\n","import {Card, Box, Text, Code} from '@sanity/ui'\n\ntype Props = {error: {message?: string}; isAuthError: false} | {isAuthError: true}\n\nexport function LoadError(props: Props) {\n return (\n <Card tone=\"critical\" radius={1}>\n <Box as=\"header\" paddingX={4} paddingTop={4} paddingBottom={1}>\n <Text as=\"h2\" weight=\"bold\">\n Google Maps failed to load\n </Text>\n </Box>\n\n <Box paddingX={4} paddingTop={4} paddingBottom={1}>\n {props.isAuthError ? (\n <AuthError />\n ) : (\n <>\n <Text as=\"h3\">Error details:</Text>\n <pre>\n <Code size={1}>{'error' in props && props.error?.message}</Code>\n </pre>\n </>\n )}\n </Box>\n </Card>\n )\n}\n\nfunction AuthError() {\n return (\n <Text>\n <p>The error appears to be related to authentication</p>\n <p>Common causes include:</p>\n <ul>\n <li>Incorrect API key</li>\n <li>Referer not allowed</li>\n <li>Missing authentication scope</li>\n </ul>\n <p>Check the browser developer tools for more information.</p>\n </Text>\n )\n}\n","import {type ReactElement, useEffect, useState} from 'react'\nimport type {GoogleMapsInputConfig} from '../types'\nimport {AuthError, loadGoogleMapsApi} from './loadGoogleMapsApi'\nimport {LoadError as LoadErrorView} from './LoadError'\n\ninterface LoadProps {\n children: (api: typeof window.google.maps) => ReactElement\n config: GoogleMapsInputConfig\n}\n\nconst browserLocale = (typeof window !== 'undefined' && window.navigator.language) || 'en'\n\ntype LoadState =\n | {\n type: 'loading'\n }\n | {\n type: 'loaded'\n api: typeof window.google.maps\n }\n | {\n type: 'error'\n error: {type: 'loadError' | 'authError'; message: string}\n }\n\nfunction useLoadGoogleMapsApi(config: {defaultLocale?: string; apiKey: string}): LoadState {\n const locale = config.defaultLocale || browserLocale || 'en-US'\n\n const [state, setState] = useState<LoadState>({type: 'loading'})\n\n useEffect(() => {\n if (typeof window === 'undefined') {\n return\n }\n\n loadGoogleMapsApi({locale, apiKey: config.apiKey}).then(\n (api) => setState({type: 'loaded', api}),\n (err) =>\n setState({\n type: 'error',\n error: {type: err instanceof AuthError ? 'authError' : 'loadError', message: err.message},\n }),\n )\n }, [locale, config.apiKey])\n return state\n}\n\nexport function GoogleMapsLoadProxy(props: LoadProps) {\n const loadState = useLoadGoogleMapsApi(props.config)\n switch (loadState.type) {\n case 'error':\n return (\n <LoadErrorView error={loadState.error} isAuthError={loadState.error.type === 'authError'} />\n )\n case 'loading':\n return <div>Loading Google Maps API</div>\n case 'loaded':\n return props.children(loadState.api)\n default:\n return null\n }\n}\n","import type {GoogleMapsInputConfig} from './types'\n\nlet config: GoogleMapsInputConfig\n\nexport function getGeoConfig(): GoogleMapsInputConfig {\n return config as GoogleMapsInputConfig\n}\n\nexport function setGeoConfig(newConfig: GoogleMapsInputConfig): void {\n config = newConfig\n}\n","import {styled} from 'styled-components'\n\nexport const PreviewImage = styled.img`\n width: 100%;\n height: auto;\n vertical-align: top;\n`\n\nexport const DialogInnerContainer = styled.div`\n height: 40rem;\n`\n","import {styled} from 'styled-components'\n\nexport const WrapperContainer = styled.div`\n position: absolute;\n right: 10px;\n top: 10px;\n width: 220px;\n`\n","import {TextInput} from '@sanity/ui'\nimport {WrapperContainer} from './SearchInput.styles'\nimport {createRef, PureComponent} from 'react'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onChange: (result: google.maps.places.PlaceResult) => void\n}\n\nexport class SearchInput extends PureComponent<Props> {\n searchInputRef = createRef<HTMLInputElement>()\n autoComplete: google.maps.places.Autocomplete | undefined\n\n handleChange = () => {\n if (!this.autoComplete) {\n return\n }\n\n this.props.onChange(this.autoComplete.getPlace())\n\n if (this.searchInputRef.current) {\n this.searchInputRef.current.value = ''\n }\n }\n\n componentDidMount() {\n const input = this.searchInputRef.current\n if (!input) {\n return\n }\n\n const {api, map} = this.props\n const {Circle, places, event} = api\n const searchBounds = new Circle({center: map.getCenter(), radius: 100}).getBounds()!\n this.autoComplete = new places.Autocomplete(input, {\n bounds: searchBounds,\n types: [], // return all kinds of places\n })\n\n event.addListener(this.autoComplete, 'place_changed', this.handleChange)\n }\n\n render() {\n return (\n <WrapperContainer>\n <TextInput\n name=\"place\"\n ref={this.searchInputRef}\n placeholder=\"Search for place or address\"\n padding={4}\n />\n </WrapperContainer>\n )\n }\n}\n","import type {LatLng} from '../types'\n\nexport function latLngAreEqual(\n latLng1: LatLng | google.maps.LatLng,\n latLng2: LatLng | google.maps.LatLng,\n): boolean {\n const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat\n const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng\n\n const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat\n const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng\n\n return lat1 === lat2 && lng1 === lng2\n}\n","import {styled} from 'styled-components'\n\nexport const MapContainer = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n`\n","import {createRef, PureComponent, type ReactElement} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\nimport {MapContainer} from './Map.styles'\n\ninterface MapProps {\n api: typeof window.google.maps\n location: LatLng\n bounds?: google.maps.LatLngBounds\n defaultZoom?: number\n mapTypeControl?: boolean\n scrollWheel?: boolean\n controlSize?: number\n onClick?: (event: google.maps.MapMouseEvent) => void\n children?: (map: google.maps.Map) => ReactElement\n}\n\ninterface MapState {\n map: google.maps.Map | undefined\n}\n\nexport class GoogleMap extends PureComponent<MapProps, MapState> {\n static defaultProps = {\n defaultZoom: 8,\n scrollWheel: true,\n }\n\n state: MapState = {map: undefined}\n clickHandler: google.maps.MapsEventListener | undefined\n mapRef = createRef<HTMLDivElement>()\n mapEl: HTMLDivElement | null = null\n\n componentDidMount() {\n this.attachClickHandler()\n }\n\n attachClickHandler = () => {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {api, onClick} = this.props\n const {event} = api\n\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n\n if (onClick) {\n this.clickHandler = event.addListener(map, 'click', onClick)\n }\n }\n\n componentDidUpdate(prevProps: MapProps) {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {onClick, location, bounds} = this.props\n\n if (prevProps.onClick !== onClick) {\n this.attachClickHandler()\n }\n\n if (!latLngAreEqual(prevProps.location, location)) {\n map.panTo(this.getCenter())\n }\n\n if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) {\n map.fitBounds(bounds)\n }\n }\n\n componentWillUnmount() {\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n }\n\n getCenter(): google.maps.LatLng {\n const {location, api} = this.props\n return new api.LatLng(location.lat, location.lng)\n }\n\n constructMap(el: HTMLDivElement) {\n const {defaultZoom, api, mapTypeControl, controlSize, bounds, scrollWheel} = this.props\n\n const map = new api.Map(el, {\n zoom: defaultZoom,\n center: this.getCenter(),\n scrollwheel: scrollWheel,\n streetViewControl: false,\n mapTypeControl,\n controlSize,\n })\n\n if (bounds) {\n map.fitBounds(bounds)\n }\n\n return map\n }\n\n setMapElement = (element: HTMLDivElement | null) => {\n if (element && element !== this.mapEl) {\n const map = this.constructMap(element)\n this.setState({map}, this.attachClickHandler)\n }\n\n this.mapEl = element\n }\n\n render() {\n const {children} = this.props\n const {map} = this.state\n return (\n <>\n <MapContainer ref={this.setMapElement} />\n {children && map ? children(map) : null}\n </>\n )\n }\n}\n","import {PureComponent, type MutableRefObject} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\nconst markerPath =\n 'M 3.052 3.7 C 1.56 5.293 0.626 7.612 0.663 9.793 C 0.738 14.352 2.793 16.077 6.078 22.351 C 7.263 25.111 8.497 28.032 9.672 32.871 C 9.835 33.584 9.994 34.246 10.069 34.305 C 10.143 34.362 10.301 33.697 10.465 32.983 C 11.639 28.145 12.875 25.226 14.059 22.466 C 17.344 16.192 19.398 14.466 19.474 9.908 C 19.511 7.727 18.574 5.405 17.083 3.814 C 15.379 1.994 12.809 0.649 10.069 0.593 C 7.328 0.536 4.756 1.882 3.052 3.7 Z'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onMove?: (event: google.maps.MapMouseEvent) => void\n onClick?: (event: google.maps.MapMouseEvent) => void\n position: LatLng | google.maps.LatLng\n zIndex?: number\n opacity?: number\n label?: string\n markerRef?: MutableRefObject<google.maps.Marker | undefined>\n color?: {background: string; border: string; text: string}\n}\n\nexport class Marker extends PureComponent<Props> {\n marker: google.maps.Marker | undefined\n\n eventHandlers: {\n move?: google.maps.MapsEventListener\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {position, api, map, onMove, zIndex, opacity, label, markerRef, color} = this.props\n const {Marker: GMarker} = api\n\n let icon: google.maps.Symbol | undefined\n if (color) {\n icon = {\n path: markerPath,\n fillOpacity: 1,\n fillColor: color.background,\n strokeColor: color.border,\n strokeWeight: 2,\n anchor: new api.Point(10, 35),\n labelOrigin: new api.Point(10, 11),\n }\n }\n\n this.marker = new GMarker({\n draggable: Boolean(onMove),\n position,\n map,\n zIndex,\n opacity,\n label,\n icon,\n })\n\n if (markerRef) {\n markerRef.current = this.marker\n }\n\n this.attachMoveHandler()\n this.attachClickHandler()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.marker) {\n return\n }\n\n const {position, onMove, label, zIndex, opacity, map} = this.props\n\n if (prevProps.onMove !== onMove) {\n this.attachMoveHandler()\n }\n\n if (!latLngAreEqual(prevProps.position, position)) {\n this.marker.setPosition(position)\n }\n\n if (prevProps.label !== label) {\n this.marker.setLabel(label || null)\n }\n\n if (prevProps.zIndex !== zIndex) {\n this.marker.setZIndex(zIndex || null)\n }\n\n if (prevProps.opacity !== opacity) {\n this.marker.setOpacity(opacity || null)\n }\n\n if (prevProps.map !== map) {\n this.marker.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n\n if (this.marker) {\n this.marker.setMap(null)\n }\n }\n\n attachMoveHandler() {\n const {api, onMove} = this.props\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n if (this.marker && onMove) {\n this.eventHandlers.move = api.event.addListener(this.marker, 'dragend', onMove)\n }\n }\n\n attachClickHandler() {\n const {api, onClick} = this.props\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n if (this.marker && onClick) {\n this.eventHandlers.click = api.event.addListener(this.marker, 'click', onClick)\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {type FC, useCallback} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, Geopoint} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: Geopoint\n onChange?: (latLng: google.maps.LatLng) => void\n defaultLocation?: LatLng\n defaultZoom?: number\n}\n\nexport const GeopointSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultZoom = 8,\n}) => {\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng) => {\n if (onChange) {\n onChange(geoPoint)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location)\n },\n [setValue],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n return (\n <GoogleMap api={api} location={getCenter()} onClick={handleMapClick} defaultZoom={defaultZoom}>\n {(map) => (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n />\n )}\n </>\n )}\n </GoogleMap>\n )\n}\n","import {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {Geopoint, GeopointSchemaType, GoogleMapsInputConfig, LatLng} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointSelect} from './GeopointSelect'\n\nconst EMPTY_PATH: Path = []\n\nconst getStaticImageUrl = (value: LatLng, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: '13',\n scale: '2',\n size: '640x300',\n })\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointInput(props: GeopointInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng) => {\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n ])\n },\n [schemaTypeName, onChange],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint type</a> needs a\n Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultZoom={config.defaultZoom}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import React, {type FC, useCallback, useEffect, useRef} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, GeopointRadius} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\n// Component to sync marker drag with circle position\nconst MarkerDragSync: FC<{\n api: typeof window.google.maps\n marker: google.maps.Marker\n circleRef: React.MutableRefObject<google.maps.Circle | null>\n isMarkerDragging: React.MutableRefObject<boolean>\n}> = ({api, marker, circleRef, isMarkerDragging}) => {\n useEffect(() => {\n const handleDrag = () => {\n isMarkerDragging.current = true\n }\n\n const handleDragEnd = () => {\n isMarkerDragging.current = false\n }\n\n const dragListener = api.event.addListener(marker, 'drag', handleDrag)\n const dragEndListener = api.event.addListener(marker, 'dragend', handleDragEnd)\n\n return () => {\n api.event.removeListener(dragListener)\n api.event.removeListener(dragEndListener)\n }\n }, [api, marker, circleRef, isMarkerDragging])\n\n return null\n}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: GeopointRadius\n onChange?: (latLng: google.maps.LatLng, radius?: number) => void\n defaultLocation?: LatLng\n defaultRadiusZoom?: number\n defaultRadius?: number\n}\n\nexport const GeopointRadiusSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultRadiusZoom = 12,\n defaultRadius = 1000,\n}) => {\n const circleRef = useRef<google.maps.Circle | null>(null)\n const markerRef = useRef<google.maps.Marker | undefined>()\n const isMarkerDragging = useRef(false)\n\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng, radius?: number) => {\n if (onChange) {\n const roundedRadius = radius ? Math.round(radius) : undefined\n onChange(geoPoint, roundedRadius)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location, value?.radius || defaultRadius)\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n // Update circle position when marker drag ends\n if (circleRef.current) {\n circleRef.current.setCenter(event.latLng)\n }\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n // Create or update circle when value changes\n useEffect(() => {\n if (value && circleRef.current) {\n circleRef.current.setCenter({lat: value.lat, lng: value.lng})\n circleRef.current.setRadius(value.radius)\n }\n }, [value])\n\n return (\n <GoogleMap\n api={api}\n location={getCenter()}\n onClick={handleMapClick}\n defaultZoom={defaultRadiusZoom}\n >\n {(map) => {\n // Create circle if it doesn't exist and we have a value\n if (value && !circleRef.current) {\n circleRef.current = new api.Circle({\n map,\n center: {lat: value.lat, lng: value.lng},\n radius: value.radius,\n fillColor: '#4285F4',\n fillOpacity: 0.2,\n strokeColor: '#4285F4',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n editable: true,\n })\n\n // Add event listeners for circle interactions\n circleRef.current.addListener('center_changed', () => {\n if (circleRef.current && markerRef.current && !isMarkerDragging.current) {\n // When circle center is dragged, move the marker to match\n const circleCenter = circleRef.current.getCenter()\n if (circleCenter) {\n markerRef.current.setPosition(circleCenter)\n }\n }\n })\n\n circleRef.current.addListener('radius_changed', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n\n circleRef.current.addListener('dragend', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n }\n\n return (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n markerRef={markerRef}\n />\n )}\n {/* Add drag event listener to marker for circle sync */}\n {value && markerRef.current && (\n <MarkerDragSync\n api={api}\n marker={markerRef.current}\n circleRef={circleRef}\n isMarkerDragging={isMarkerDragging}\n />\n )}\n </>\n )\n }}\n </GoogleMap>\n )\n}\n","import React, {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack, TextInput, Label} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {\n GeopointRadius,\n GeopointRadiusSchemaType,\n GoogleMapsInputConfig,\n LatLng,\n} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointRadiusSelect} from './GeopointRadiusSelect'\n\nconst EMPTY_PATH: Path = []\n\n// Helper function to generate circle points\nconst generateCirclePoints = (\n lat: number,\n lng: number,\n radius: number,\n): Array<{lat: number; lng: number}> => {\n const points = []\n const steps = 32 // Number of points to create the circle\n\n for (let i = 0; i <= steps; i++) {\n const angle = (i / steps) * 2 * Math.PI\n const latOffset = (radius / 111000) * Math.cos(angle) // Rough conversion to degrees\n const lngOffset = (radius / (111000 * Math.cos((lat * Math.PI) / 180))) * Math.sin(angle)\n\n points.push({\n lat: lat + latOffset,\n lng: lng + lngOffset,\n })\n }\n\n return points\n}\n\nconst getStaticImageUrl = (value: LatLng & {radius?: number}, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n\n // Calculate appropriate zoom level based on radius\n let zoom = 13\n if (value.radius) {\n // Use logarithmic formula for better zoom calculation\n // Add padding to ensure circle is fully visible\n const radius = value.radius + value.radius / 2\n const scale = radius / 500\n const calculatedZoom = 16 - Math.log(scale) / Math.log(2)\n // Add small offset to ensure circle fits well in view\n zoom = Math.max(8, Math.min(16, Math.round(calculatedZoom - 0.4)))\n }\n\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: zoom.toString(),\n scale: '2',\n size: '640x300',\n })\n\n // Add circle if radius is present\n if (value.radius) {\n // Create a circle path using multiple points\n const points = generateCirclePoints(value.lat, value.lng, value.radius)\n const path = points.map((p) => `${p.lat},${p.lng}`).join('|')\n qs.append('path', `fillcolor:0x4285F480|color:0x4285F4|weight:2|${path}`)\n }\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointRadiusInputProps = ObjectInputProps<\n GeopointRadius,\n GeopointRadiusSchemaType\n> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointRadiusInput(props: GeopointRadiusInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng, radius?: number) => {\n const currentRadius = radius ?? value?.radius ?? config.defaultRadius ?? 1000\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n set(currentRadius, ['radius']),\n ])\n },\n [schemaTypeName, onChange, value?.radius, config.defaultRadius],\n )\n\n const handleRadiusChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (value) {\n onChange([set(Math.round(Number(event.currentTarget.value)), ['radius'])])\n }\n },\n [onChange, value],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint Radius type</a>{' '}\n needs a Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location with radius\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n {value && (\n <Stack space={2}>\n <Label>Radius (meters)</Label>\n <TextInput\n type=\"number\"\n value={Math.round(value.radius || config.defaultRadius || 1000)}\n onChange={handleRadiusChange}\n disabled={readOnly}\n min={1}\n max={50000}\n step={1}\n />\n </Stack>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location and radius'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker and set radius on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointRadiusSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultRadiusZoom={config.defaultRadiusZoom}\n defaultRadius={config.defaultRadius}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import {type MutableRefObject, PureComponent} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n from: LatLng\n to: LatLng\n color?: {background: string; border: string; text: string}\n zIndex?: number\n arrowRef?: MutableRefObject<google.maps.Polyline | undefined>\n onClick?: (event: google.maps.MapMouseEvent) => void\n}\n\nexport class Arrow extends PureComponent<Props> {\n line: google.maps.Polyline | undefined\n\n eventHandlers: {\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {from, to, api, map, zIndex, onClick, color, arrowRef} = this.props\n const lineSymbol = {\n path: api.SymbolPath.FORWARD_OPEN_ARROW,\n }\n\n this.line = new api.Polyline({\n map,\n zIndex,\n path: [from, to],\n icons: [{icon: lineSymbol, offset: '50%'}],\n strokeOpacity: 0.55,\n strokeColor: color ? color.text : 'black',\n })\n\n if (onClick) {\n this.eventHandlers.click = api.event.addListener(this.line, 'click', onClick)\n }\n\n if (arrowRef) {\n arrowRef.current = this.line\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.line) {\n return\n }\n\n const {from, to, map} = this.props\n if (!latLngAreEqual(prevProps.from, from) || !latLngAreEqual(prevProps.to, to)) {\n this.line.setPath([from, to])\n }\n\n if (prevProps.map !== map) {\n this.line.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.line) {\n this.line.setMap(null)\n }\n\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {useRef} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {Geopoint} from '../types'\n\ninterface GeopointMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<Geopoint>\n label?: string\n}\n\nexport function GeopointMove({diff, api, map, label}: GeopointMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>()\n const toRef = useRef<google.maps.Marker>()\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {styled} from 'styled-components'\n\nexport const RootContainer = styled.div`\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n`\n","import type {\n ArrayDiff,\n Diff,\n DiffComponent,\n DiffProps as GenericDiffProps,\n ObjectDiff,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>\n\nexport const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof google.maps}) {\n const fromValue = (diff.fromValue || []).filter(hasCoordinates)\n const toValue = (diff.toValue || []).filter(hasCoordinates)\n if (fromValue.length === 0 && toValue.length === 0) {\n return null\n }\n\n const bounds = getBounds(fromValue, toValue, api)\n return (\n <GoogleMap\n api={api}\n location={bounds.getCenter().toJSON()}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n >\n {(map) => (\n <>\n {diff.items.map(({toIndex, diff: pointDiff}) => {\n if (!isChangeDiff(pointDiff)) {\n return null\n }\n\n return (\n <GeopointMove\n key={toIndex}\n api={api}\n map={map}\n diff={pointDiff}\n label={`${toIndex}`}\n />\n )\n })}\n </>\n )}\n </GoogleMap>\n )\n}\n\nfunction isChangeDiff(diff: Diff): diff is ObjectDiff<Geopoint> {\n return diff.action !== 'unchanged' && diff.type === 'object'\n}\n\nfunction hasCoordinates(point: Partial<Geopoint>): point is Geopoint {\n return typeof point.lat === 'number' && typeof point.lng === 'number'\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral[] | null | undefined,\n toValue: google.maps.LatLngLiteral[] | null | undefined,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds()\n const points = [...(fromValue || []), ...(toValue || [])]\n points.forEach((point) => bounds.extend(point))\n return bounds\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>\n\nexport const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral,\n toValue: google.maps.LatLngLiteral,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n return new api.LatLngBounds().extend(fromValue).extend(toValue)\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<Geopoint>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return 'Moved'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {useRef, useEffect} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {GeopointRadius} from '../types'\n\ninterface GeopointRadiusMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<GeopointRadius>\n label?: string\n}\n\nexport function GeopointRadiusMove({diff, api, map, label}: GeopointRadiusMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>()\n const toRef = useRef<google.maps.Marker>()\n const fromCircleRef = useRef<google.maps.Circle>()\n const toCircleRef = useRef<google.maps.Circle>()\n\n // Create circles for radius visualization\n useEffect(() => {\n const color = userColor?.background || '#4285F4'\n\n if (from && from.radius) {\n fromCircleRef.current = new api.Circle({\n map,\n center: {lat: from.lat, lng: from.lng},\n radius: from.radius,\n fillColor: color,\n fillOpacity: 0.1,\n strokeColor: color,\n strokeOpacity: 0.3,\n strokeWeight: 1,\n zIndex: 0,\n })\n }\n\n if (to && to.radius) {\n toCircleRef.current = new api.Circle({\n map,\n center: {lat: to.lat, lng: to.lng},\n radius: to.radius,\n fillColor: color,\n fillOpacity: 0.2,\n strokeColor: color,\n strokeOpacity: 0.8,\n strokeWeight: 2,\n zIndex: 2,\n })\n }\n\n return () => {\n if (fromCircleRef.current) {\n fromCircleRef.current.setMap(null)\n }\n if (toCircleRef.current) {\n toCircleRef.current.setMap(null)\n }\n }\n }, [api, map, from, to, userColor])\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {GeopointRadius} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointRadiusMove} from './GeopointRadiusMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<GeopointRadius>>\n\nexport const GeopointRadiusFieldDiff: DiffComponent<ObjectDiff<GeopointRadius>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointRadiusDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointRadiusDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, ['radius']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointRadiusMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral & {radius?: number},\n toValue: google.maps.LatLngLiteral & {radius?: number},\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds().extend(fromValue).extend(toValue)\n\n // Extend bounds to include radius circles\n const fromRadius = fromValue.radius || 0\n const toRadius = toValue.radius || 0\n const maxRadius = Math.max(fromRadius, toRadius)\n\n if (maxRadius > 0) {\n // Convert radius from meters to degrees (approximate)\n const radiusInDegrees = maxRadius / 111000 // Rough conversion\n bounds.extend({\n lat: fromValue.lat + radiusInDegrees,\n lng: fromValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: fromValue.lat - radiusInDegrees,\n lng: fromValue.lng - radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat + radiusInDegrees,\n lng: toValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat - radiusInDegrees,\n lng: toValue.lng - radiusInDegrees,\n })\n }\n\n return bounds\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<GeopointRadius>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n const latChanged = fromValue.lat !== toValue.lat || fromValue.lng !== toValue.lng\n const radiusChanged = fromValue.radius !== toValue.radius\n\n if (latChanged && radiusChanged) {\n return 'Moved and radius changed'\n } else if (latChanged) {\n return 'Moved'\n } else if (radiusChanged) {\n return 'Radius changed'\n }\n return 'Unchanged'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {definePlugin, type SchemaType} from 'sanity'\nimport {GeopointInput, type GeopointInputProps} from './input/GeopointInput'\nimport {GeopointRadiusInput, type GeopointRadiusInputProps} from './input/GeopointRadiusInput'\nimport {setGeoConfig} from './global-workaround'\nimport type {GeopointSchemaType, GeopointRadiusSchemaType, GoogleMapsInputConfig} from './types'\n\nexport const googleMapsInput = definePlugin<GoogleMapsInputConfig>((config) => {\n setGeoConfig(config)\n return {\n name: 'google-maps-input',\n schema: {\n types: [\n {\n name: 'geopointRadius',\n title: 'Geopoint with Radius',\n type: 'object',\n fields: [\n {\n name: 'lat',\n title: 'Latitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-90).max(90),\n },\n {\n name: 'lng',\n title: 'Longitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-180).max(180),\n },\n {\n name: 'alt',\n title: 'Altitude',\n type: 'number',\n },\n {\n name: 'radius',\n title: 'Radius (meters)',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(1).max(50000),\n },\n ],\n preview: {\n select: {\n lat: 'lat',\n lng: 'lng',\n radius: 'radius',\n },\n prepare({lat, lng, radius}: {lat: number; lng: number; radius: number}) {\n return {\n title: `${lat.toFixed(6)}, ${lng.toFixed(6)}`,\n subtitle: radius ? `Radius: ${radius}m` : 'No radius set',\n }\n },\n },\n },\n ],\n },\n form: {\n components: {\n input(props) {\n if (isGeopoint(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointInputProps, 'geoConfig'>\n return <GeopointInput {...castedProps} geoConfig={config} />\n }\n if (isGeopointRadius(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointRadiusInputProps, 'geoConfig'>\n return <GeopointRadiusInput {...castedProps} geoConfig={config} />\n }\n return props.renderDefault(props)\n },\n },\n },\n }\n})\n\nfunction isGeopoint(schemaType: SchemaType): schemaType is GeopointSchemaType {\n return isType('geopoint', schemaType)\n}\n\nfunction isGeopointRadius(schemaType: SchemaType): schemaType is GeopointRadiusSchemaType {\n return isType('geopointRadius', schemaType)\n}\n\nfunction isType(name: string, schema?: SchemaType): boolean {\n if (schema?.name === name) {\n return true\n // eslint-disable-next-line no-negated-condition\n } else if (!schema?.name) {\n return false\n }\n return isType(name, schema?.type)\n}\n"],"names":["config","AuthError","jsxs","Card","jsx","Box","Text","Fragment","Code","useState","useEffect","LoadErrorView","styled","PureComponent","createRef","TextInput","fallbackLatLng","getCenter","useCallback","EMPTY_PATH","getStaticImageUrl","useId","useRef","setIfMissing","set","unset","Stack","ChangeIndicator","Grid","Button","EditIcon","TrashIcon","Dialog","Label","useUserColor","GeopointDiff","getBounds","getAnnotationAtPath","DiffTooltip","getAction","definePlugin"],"mappings":";;;AAQA,MAAM,eAAe,mCACf,0BAA0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,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC;AAAA,cAC3C,UAAU,SAAS,WAAW,MAAM,MAAM;AAAA,YAAA;AAAA,UAE9C;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEF,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,MAAM,OAAO;AACX,eAAI,WAAW,MAAM,UAAU,IAEtBI,2BAAAA,IAAC,iBAAe,GADH,OACmB,WAAWJ,QAAA,CAAQ,IAExD,iBAAiB,MAAM,UAAU,IAE5BI,2BAAAA,IAAC,qBAAA,EAAqB,GADT,OACyB,WAAWJ,SAAQ,IAE3D,MAAM,cAAc,KAAK;AAAA,MAClC;AAAA,IAAA;AAAA,EACF;AAEJ,EACD;AAED,SAAS,WAAW,YAA0D;AAC5E,SAAO,OAAO,YAAY,UAAU;AACtC;AAEA,SAAS,iBAAiB,YAAgE;AACxF,SAAO,OAAO,kBAAkB,UAAU;AAC5C;AAEA,SAAS,OAAO,MAAc,QAA8B;AAC1D,SAAI,QAAQ,SAAS,OACZ,KAEG,QAAQ,OAGb,OAAO,MAAM,QAAQ,IAAI,IAFvB;AAGX;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/loader/loadGoogleMapsApi.ts","../src/loader/LoadError.tsx","../src/loader/GoogleMapsLoadProxy.tsx","../src/global-workaround.ts","../src/input/GeopointInput.styles.tsx","../src/map/SearchInput.styles.tsx","../src/map/SearchInput.tsx","../src/map/util.ts","../src/map/Map.styles.tsx","../src/map/Map.tsx","../src/map/Marker.tsx","../src/input/GeopointSelect.tsx","../src/input/GeopointInput.tsx","../src/input/GeopointRadiusSelect.tsx","../src/input/GeopointRadiusInput.tsx","../src/map/Arrow.tsx","../src/diff/GeopointMove.tsx","../src/diff/GeopointFieldDiff.styles.tsx","../src/diff/GeopointArrayDiff.tsx","../src/diff/GeopointFieldDiff.tsx","../src/diff/GeopointRadiusMove.tsx","../src/diff/GeopointRadiusFieldDiff.tsx","../src/plugin.tsx"],"sourcesContent":["declare global {\n // eslint-disable-next-line\n interface Window {\n gm_authFailure: any\n ___sanity_googleMapsApiCallback: any\n }\n}\n\nconst callbackName = '___sanity_googleMapsApiCallback'\nconst authFailureCallbackName = 'gm_authFailure'\n\nexport class AuthError extends Error {}\n\nfunction _loadGoogleMapsApi(config: {locale: string; apiKey: string}) {\n return new Promise<typeof window.google.maps>((resolve, reject) => {\n window[authFailureCallbackName] = () => {\n reject(new AuthError('Authentication error when loading Google Maps API.'))\n }\n\n window[callbackName] = () => {\n resolve(window.google.maps)\n }\n\n const script = document.createElement('script')\n script.onerror = (\n event: Event | string,\n source?: string,\n lineno?: number,\n colno?: number,\n error?: Error,\n ) => reject(new Error(coeerceError(event, error)))\n\n script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${callbackName}&language=${config.locale}`\n document.getElementsByTagName('head')[0].appendChild(script)\n }).finally(() => {\n delete window[callbackName]\n delete window[authFailureCallbackName]\n })\n}\n\nlet memo: Promise<typeof window.google.maps> | null = null\nexport function loadGoogleMapsApi(config: {\n locale: string\n apiKey: string\n}): Promise<typeof window.google.maps> {\n if (memo) {\n return memo\n }\n memo = _loadGoogleMapsApi(config)\n memo.catch(() => {\n memo = null\n })\n return memo\n}\nfunction coeerceError(event: Event | string, error?: Error): string {\n if (error) {\n return error.message\n }\n\n if (typeof event === 'string') {\n return event\n }\n\n return isErrorEvent(event) ? event.message : 'Failed to load Google Maps API'\n}\n\nfunction isErrorEvent(event: unknown): event is ErrorEvent {\n if (typeof event !== 'object' || event === null) {\n return false\n }\n\n if (!('message' in event)) {\n return false\n }\n\n return typeof (event as ErrorEvent).message === 'string'\n}\n","import {Card, Box, Text, Code} from '@sanity/ui'\n\ntype Props = {error: {message?: string}; isAuthError: false} | {isAuthError: true}\n\nexport function LoadError(props: Props) {\n return (\n <Card tone=\"critical\" radius={1}>\n <Box as=\"header\" paddingX={4} paddingTop={4} paddingBottom={1}>\n <Text as=\"h2\" weight=\"bold\">\n Google Maps failed to load\n </Text>\n </Box>\n\n <Box paddingX={4} paddingTop={4} paddingBottom={1}>\n {props.isAuthError ? (\n <AuthError />\n ) : (\n <>\n <Text as=\"h3\">Error details:</Text>\n <pre>\n <Code size={1}>{'error' in props && props.error?.message}</Code>\n </pre>\n </>\n )}\n </Box>\n </Card>\n )\n}\n\nfunction AuthError() {\n return (\n <Text>\n <p>The error appears to be related to authentication</p>\n <p>Common causes include:</p>\n <ul>\n <li>Incorrect API key</li>\n <li>Referer not allowed</li>\n <li>Missing authentication scope</li>\n </ul>\n <p>Check the browser developer tools for more information.</p>\n </Text>\n )\n}\n","import {type ReactElement, useEffect, useState} from 'react'\nimport type {GoogleMapsInputConfig} from '../types'\nimport {AuthError, loadGoogleMapsApi} from './loadGoogleMapsApi'\nimport {LoadError as LoadErrorView} from './LoadError'\n\ninterface LoadProps {\n children: (api: typeof window.google.maps) => ReactElement\n config: GoogleMapsInputConfig\n}\n\nconst browserLocale = (typeof window !== 'undefined' && window.navigator.language) || 'en'\n\ntype LoadState =\n | {\n type: 'loading'\n }\n | {\n type: 'loaded'\n api: typeof window.google.maps\n }\n | {\n type: 'error'\n error: {type: 'loadError' | 'authError'; message: string}\n }\n\nfunction useLoadGoogleMapsApi(config: {defaultLocale?: string; apiKey: string}): LoadState {\n const locale = config.defaultLocale || browserLocale || 'en-US'\n\n const [state, setState] = useState<LoadState>({type: 'loading'})\n\n useEffect(() => {\n if (typeof window === 'undefined') {\n return\n }\n\n loadGoogleMapsApi({locale, apiKey: config.apiKey}).then(\n (api) => setState({type: 'loaded', api}),\n (err) =>\n setState({\n type: 'error',\n error: {type: err instanceof AuthError ? 'authError' : 'loadError', message: err.message},\n }),\n )\n }, [locale, config.apiKey])\n return state\n}\n\nexport function GoogleMapsLoadProxy(props: LoadProps) {\n const loadState = useLoadGoogleMapsApi(props.config)\n switch (loadState.type) {\n case 'error':\n return (\n <LoadErrorView error={loadState.error} isAuthError={loadState.error.type === 'authError'} />\n )\n case 'loading':\n return <div>Loading Google Maps API</div>\n case 'loaded':\n return props.children(loadState.api)\n default:\n return null\n }\n}\n","import type {GoogleMapsInputConfig} from './types'\n\nlet config: GoogleMapsInputConfig\n\nexport function getGeoConfig(): GoogleMapsInputConfig {\n return config as GoogleMapsInputConfig\n}\n\nexport function setGeoConfig(newConfig: GoogleMapsInputConfig): void {\n config = newConfig\n}\n","import {styled} from 'styled-components'\n\nexport const PreviewImage = styled.img`\n width: 100%;\n height: auto;\n vertical-align: top;\n`\n\nexport const DialogInnerContainer = styled.div`\n height: 40rem;\n`\n","import {styled} from 'styled-components'\n\nexport const WrapperContainer = styled.div`\n position: absolute;\n right: 10px;\n top: 10px;\n width: 220px;\n`\n","import {TextInput} from '@sanity/ui'\nimport {WrapperContainer} from './SearchInput.styles'\nimport {createRef, PureComponent} from 'react'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onChange: (result: google.maps.places.PlaceResult) => void\n}\n\nexport class SearchInput extends PureComponent<Props> {\n searchInputRef = createRef<HTMLInputElement>()\n autoComplete: google.maps.places.Autocomplete | undefined\n\n handleChange = () => {\n if (!this.autoComplete) {\n return\n }\n\n this.props.onChange(this.autoComplete.getPlace())\n\n if (this.searchInputRef.current) {\n this.searchInputRef.current.value = ''\n }\n }\n\n componentDidMount() {\n const input = this.searchInputRef.current\n if (!input) {\n return\n }\n\n const {api, map} = this.props\n const {Circle, places, event} = api\n const searchBounds = new Circle({center: map.getCenter(), radius: 100}).getBounds()!\n this.autoComplete = new places.Autocomplete(input, {\n bounds: searchBounds,\n types: [], // return all kinds of places\n })\n\n event.addListener(this.autoComplete, 'place_changed', this.handleChange)\n }\n\n render() {\n return (\n <WrapperContainer>\n <TextInput\n name=\"place\"\n ref={this.searchInputRef}\n placeholder=\"Search for place or address\"\n padding={4}\n />\n </WrapperContainer>\n )\n }\n}\n","import type {LatLng} from '../types'\n\nexport function latLngAreEqual(\n latLng1: LatLng | google.maps.LatLng,\n latLng2: LatLng | google.maps.LatLng,\n): boolean {\n const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat\n const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng\n\n const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat\n const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng\n\n return lat1 === lat2 && lng1 === lng2\n}\n","import {styled} from 'styled-components'\n\nexport const MapContainer = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n`\n","import {createRef, PureComponent, type ReactElement} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\nimport {MapContainer} from './Map.styles'\n\ninterface MapProps {\n api: typeof window.google.maps\n location: LatLng\n bounds?: google.maps.LatLngBounds\n defaultZoom?: number\n mapTypeControl?: boolean\n scrollWheel?: boolean\n controlSize?: number\n onClick?: (event: google.maps.MapMouseEvent) => void\n children?: (map: google.maps.Map) => ReactElement\n}\n\ninterface MapState {\n map: google.maps.Map | undefined\n}\n\nexport class GoogleMap extends PureComponent<MapProps, MapState> {\n static defaultProps = {\n defaultZoom: 8,\n scrollWheel: true,\n }\n\n state: MapState = {map: undefined}\n clickHandler: google.maps.MapsEventListener | undefined\n mapRef = createRef<HTMLDivElement>()\n mapEl: HTMLDivElement | null = null\n\n componentDidMount() {\n this.attachClickHandler()\n }\n\n attachClickHandler = () => {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {api, onClick} = this.props\n const {event} = api\n\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n\n if (onClick) {\n this.clickHandler = event.addListener(map, 'click', onClick)\n }\n }\n\n componentDidUpdate(prevProps: MapProps) {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {onClick, location, bounds} = this.props\n\n if (prevProps.onClick !== onClick) {\n this.attachClickHandler()\n }\n\n if (!latLngAreEqual(prevProps.location, location)) {\n map.panTo(this.getCenter())\n }\n\n if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) {\n map.fitBounds(bounds)\n }\n }\n\n componentWillUnmount() {\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n }\n\n getCenter(): google.maps.LatLng {\n const {location, api} = this.props\n return new api.LatLng(location.lat, location.lng)\n }\n\n constructMap(el: HTMLDivElement) {\n const {defaultZoom, api, mapTypeControl, controlSize, bounds, scrollWheel} = this.props\n\n const map = new api.Map(el, {\n zoom: defaultZoom,\n center: this.getCenter(),\n scrollwheel: scrollWheel,\n streetViewControl: false,\n mapTypeControl,\n controlSize,\n })\n\n if (bounds) {\n map.fitBounds(bounds)\n }\n\n return map\n }\n\n setMapElement = (element: HTMLDivElement | null) => {\n if (element && element !== this.mapEl) {\n const map = this.constructMap(element)\n this.setState({map}, this.attachClickHandler)\n }\n\n this.mapEl = element\n }\n\n render() {\n const {children} = this.props\n const {map} = this.state\n return (\n <>\n <MapContainer ref={this.setMapElement} />\n {children && map ? children(map) : null}\n </>\n )\n }\n}\n","import {PureComponent, type MutableRefObject} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\nconst markerPath =\n 'M 3.052 3.7 C 1.56 5.293 0.626 7.612 0.663 9.793 C 0.738 14.352 2.793 16.077 6.078 22.351 C 7.263 25.111 8.497 28.032 9.672 32.871 C 9.835 33.584 9.994 34.246 10.069 34.305 C 10.143 34.362 10.301 33.697 10.465 32.983 C 11.639 28.145 12.875 25.226 14.059 22.466 C 17.344 16.192 19.398 14.466 19.474 9.908 C 19.511 7.727 18.574 5.405 17.083 3.814 C 15.379 1.994 12.809 0.649 10.069 0.593 C 7.328 0.536 4.756 1.882 3.052 3.7 Z'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onMove?: (event: google.maps.MapMouseEvent) => void\n onClick?: (event: google.maps.MapMouseEvent) => void\n position: LatLng | google.maps.LatLng\n zIndex?: number\n opacity?: number\n label?: string\n markerRef?: MutableRefObject<google.maps.Marker | undefined>\n color?: {background: string; border: string; text: string}\n}\n\nexport class Marker extends PureComponent<Props> {\n marker: google.maps.Marker | undefined\n\n eventHandlers: {\n move?: google.maps.MapsEventListener\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {position, api, map, onMove, zIndex, opacity, label, markerRef, color} = this.props\n const {Marker: GMarker} = api\n\n let icon: google.maps.Symbol | undefined\n if (color) {\n icon = {\n path: markerPath,\n fillOpacity: 1,\n fillColor: color.background,\n strokeColor: color.border,\n strokeWeight: 2,\n anchor: new api.Point(10, 35),\n labelOrigin: new api.Point(10, 11),\n }\n }\n\n this.marker = new GMarker({\n draggable: Boolean(onMove),\n position,\n map,\n zIndex,\n opacity,\n label,\n icon,\n })\n\n if (markerRef) {\n markerRef.current = this.marker\n }\n\n this.attachMoveHandler()\n this.attachClickHandler()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.marker) {\n return\n }\n\n const {position, onMove, label, zIndex, opacity, map} = this.props\n\n if (prevProps.onMove !== onMove) {\n this.attachMoveHandler()\n }\n\n if (!latLngAreEqual(prevProps.position, position)) {\n this.marker.setPosition(position)\n }\n\n if (prevProps.label !== label) {\n this.marker.setLabel(label || null)\n }\n\n if (prevProps.zIndex !== zIndex) {\n this.marker.setZIndex(zIndex || null)\n }\n\n if (prevProps.opacity !== opacity) {\n this.marker.setOpacity(opacity || null)\n }\n\n if (prevProps.map !== map) {\n this.marker.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n\n if (this.marker) {\n this.marker.setMap(null)\n }\n }\n\n attachMoveHandler() {\n const {api, onMove} = this.props\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n if (this.marker && onMove) {\n this.eventHandlers.move = api.event.addListener(this.marker, 'dragend', onMove)\n }\n }\n\n attachClickHandler() {\n const {api, onClick} = this.props\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n if (this.marker && onClick) {\n this.eventHandlers.click = api.event.addListener(this.marker, 'click', onClick)\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {type FC, useCallback} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, Geopoint} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: Geopoint\n onChange?: (latLng: google.maps.LatLng) => void\n defaultLocation?: LatLng\n defaultZoom?: number\n}\n\nexport const GeopointSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultZoom = 8,\n}) => {\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng) => {\n if (onChange) {\n onChange(geoPoint)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location)\n },\n [setValue],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n return (\n <GoogleMap api={api} location={getCenter()} onClick={handleMapClick} defaultZoom={defaultZoom}>\n {(map) => (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n />\n )}\n </>\n )}\n </GoogleMap>\n )\n}\n","import {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {Geopoint, GeopointSchemaType, GoogleMapsInputConfig, LatLng} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointSelect} from './GeopointSelect'\n\nconst EMPTY_PATH: Path = []\n\nconst getStaticImageUrl = (value: LatLng, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: '13',\n scale: '2',\n size: '640x300',\n })\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointInput(props: GeopointInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng) => {\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n ])\n },\n [schemaTypeName, onChange],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint type</a> needs a\n Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultZoom={config.defaultZoom}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import React, {type FC, useCallback, useEffect, useRef} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, GeopointRadius} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\n// Component to sync marker drag with circle position\nconst MarkerDragSync: FC<{\n api: typeof window.google.maps\n marker: google.maps.Marker\n circleRef: React.MutableRefObject<google.maps.Circle | null>\n isMarkerDragging: React.MutableRefObject<boolean>\n}> = ({api, marker, circleRef, isMarkerDragging}) => {\n useEffect(() => {\n const handleDrag = () => {\n isMarkerDragging.current = true\n }\n\n const handleDragEnd = () => {\n isMarkerDragging.current = false\n }\n\n const dragListener = api.event.addListener(marker, 'drag', handleDrag)\n const dragEndListener = api.event.addListener(marker, 'dragend', handleDragEnd)\n\n return () => {\n api.event.removeListener(dragListener)\n api.event.removeListener(dragEndListener)\n }\n }, [api, marker, circleRef, isMarkerDragging])\n\n return null\n}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: GeopointRadius\n onChange?: (latLng: google.maps.LatLng, radius?: number) => void\n defaultLocation?: LatLng\n defaultRadiusZoom?: number\n defaultRadius?: number\n}\n\nexport const GeopointRadiusSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultRadiusZoom = 12,\n defaultRadius = 1000,\n}) => {\n const circleRef = useRef<google.maps.Circle | null>(null)\n const markerRef = useRef<google.maps.Marker | undefined>(undefined)\n const isMarkerDragging = useRef(false)\n\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng, radius?: number) => {\n if (onChange) {\n const roundedRadius = radius ? Math.round(radius) : undefined\n onChange(geoPoint, roundedRadius)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location, value?.radius || defaultRadius)\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n // Update circle position when marker drag ends\n if (circleRef.current) {\n circleRef.current.setCenter(event.latLng)\n }\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n // Create or update circle when value changes\n useEffect(() => {\n if (value && circleRef.current) {\n circleRef.current.setCenter({lat: value.lat, lng: value.lng})\n circleRef.current.setRadius(value.radius)\n }\n }, [value])\n\n return (\n <GoogleMap\n api={api}\n location={getCenter()}\n onClick={handleMapClick}\n defaultZoom={defaultRadiusZoom}\n >\n {(map) => {\n // Create circle if it doesn't exist and we have a value\n if (value && !circleRef.current) {\n circleRef.current = new api.Circle({\n map,\n center: {lat: value.lat, lng: value.lng},\n radius: value.radius,\n fillColor: '#4285F4',\n fillOpacity: 0.2,\n strokeColor: '#4285F4',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n editable: true,\n })\n\n // Add event listeners for circle interactions\n circleRef.current.addListener('center_changed', () => {\n if (circleRef.current && markerRef.current && !isMarkerDragging.current) {\n // When circle center is dragged, move the marker to match\n const circleCenter = circleRef.current.getCenter()\n if (circleCenter) {\n markerRef.current.setPosition(circleCenter)\n }\n }\n })\n\n circleRef.current.addListener('radius_changed', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n\n circleRef.current.addListener('dragend', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n }\n\n return (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n markerRef={markerRef}\n />\n )}\n {/* Add drag event listener to marker for circle sync */}\n {value && markerRef.current && (\n <MarkerDragSync\n api={api}\n marker={markerRef.current}\n circleRef={circleRef}\n isMarkerDragging={isMarkerDragging}\n />\n )}\n </>\n )\n }}\n </GoogleMap>\n )\n}\n","import React, {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack, TextInput, Label} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {\n GeopointRadius,\n GeopointRadiusSchemaType,\n GoogleMapsInputConfig,\n LatLng,\n} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointRadiusSelect} from './GeopointRadiusSelect'\n\nconst EMPTY_PATH: Path = []\n\n// Helper function to generate circle points\nconst generateCirclePoints = (\n lat: number,\n lng: number,\n radius: number,\n): Array<{lat: number; lng: number}> => {\n const points = []\n const steps = 32 // Number of points to create the circle\n\n for (let i = 0; i <= steps; i++) {\n const angle = (i / steps) * 2 * Math.PI\n const latOffset = (radius / 111000) * Math.cos(angle) // Rough conversion to degrees\n const lngOffset = (radius / (111000 * Math.cos((lat * Math.PI) / 180))) * Math.sin(angle)\n\n points.push({\n lat: lat + latOffset,\n lng: lng + lngOffset,\n })\n }\n\n return points\n}\n\nconst getStaticImageUrl = (value: LatLng & {radius?: number}, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n\n // Calculate appropriate zoom level based on radius\n let zoom = 13\n if (value.radius) {\n // Use logarithmic formula for better zoom calculation\n // Add padding to ensure circle is fully visible\n const radius = value.radius + value.radius / 2\n const scale = radius / 500\n const calculatedZoom = 16 - Math.log(scale) / Math.log(2)\n // Add small offset to ensure circle fits well in view\n zoom = Math.max(8, Math.min(16, Math.round(calculatedZoom - 0.4)))\n }\n\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: zoom.toString(),\n scale: '2',\n size: '640x300',\n })\n\n // Add circle if radius is present\n if (value.radius) {\n // Create a circle path using multiple points\n const points = generateCirclePoints(value.lat, value.lng, value.radius)\n const path = points.map((p) => `${p.lat},${p.lng}`).join('|')\n qs.append('path', `fillcolor:0x4285F480|color:0x4285F4|weight:2|${path}`)\n }\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointRadiusInputProps = ObjectInputProps<\n GeopointRadius,\n GeopointRadiusSchemaType\n> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointRadiusInput(props: GeopointRadiusInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng, radius?: number) => {\n const currentRadius = radius ?? value?.radius ?? config.defaultRadius ?? 1000\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n set(currentRadius, ['radius']),\n ])\n },\n [schemaTypeName, onChange, value?.radius, config.defaultRadius],\n )\n\n const handleRadiusChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (value) {\n onChange([set(Math.round(Number(event.currentTarget.value)), ['radius'])])\n }\n },\n [onChange, value],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint Radius type</a>{' '}\n needs a Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location with radius\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n {value && (\n <Stack space={2}>\n <Label>Radius (meters)</Label>\n <TextInput\n type=\"number\"\n value={Math.round(value.radius || config.defaultRadius || 1000)}\n onChange={handleRadiusChange}\n disabled={readOnly}\n min={1}\n max={50000}\n step={1}\n />\n </Stack>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location and radius'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker and set radius on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointRadiusSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultRadiusZoom={config.defaultRadiusZoom}\n defaultRadius={config.defaultRadius}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import {type MutableRefObject, PureComponent} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n from: LatLng\n to: LatLng\n color?: {background: string; border: string; text: string}\n zIndex?: number\n arrowRef?: MutableRefObject<google.maps.Polyline | undefined>\n onClick?: (event: google.maps.MapMouseEvent) => void\n}\n\nexport class Arrow extends PureComponent<Props> {\n line: google.maps.Polyline | undefined\n\n eventHandlers: {\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {from, to, api, map, zIndex, onClick, color, arrowRef} = this.props\n const lineSymbol = {\n path: api.SymbolPath.FORWARD_OPEN_ARROW,\n }\n\n this.line = new api.Polyline({\n map,\n zIndex,\n path: [from, to],\n icons: [{icon: lineSymbol, offset: '50%'}],\n strokeOpacity: 0.55,\n strokeColor: color ? color.text : 'black',\n })\n\n if (onClick) {\n this.eventHandlers.click = api.event.addListener(this.line, 'click', onClick)\n }\n\n if (arrowRef) {\n arrowRef.current = this.line\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.line) {\n return\n }\n\n const {from, to, map} = this.props\n if (!latLngAreEqual(prevProps.from, from) || !latLngAreEqual(prevProps.to, to)) {\n this.line.setPath([from, to])\n }\n\n if (prevProps.map !== map) {\n this.line.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.line) {\n this.line.setMap(null)\n }\n\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {useRef} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {Geopoint} from '../types'\n\ninterface GeopointMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<Geopoint>\n label?: string\n}\n\nexport function GeopointMove({diff, api, map, label}: GeopointMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>(undefined)\n const toRef = useRef<google.maps.Marker>(undefined)\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {styled} from 'styled-components'\n\nexport const RootContainer = styled.div`\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n`\n","import type {\n ArrayDiff,\n Diff,\n DiffComponent,\n DiffProps as GenericDiffProps,\n ObjectDiff,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>\n\nexport const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof google.maps}) {\n const fromValue = (diff.fromValue || []).filter(hasCoordinates)\n const toValue = (diff.toValue || []).filter(hasCoordinates)\n if (fromValue.length === 0 && toValue.length === 0) {\n return null\n }\n\n const bounds = getBounds(fromValue, toValue, api)\n return (\n <GoogleMap\n api={api}\n location={bounds.getCenter().toJSON()}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n >\n {(map) => (\n <>\n {diff.items.map(({toIndex, diff: pointDiff}) => {\n if (!isChangeDiff(pointDiff)) {\n return null\n }\n\n return (\n <GeopointMove\n key={toIndex}\n api={api}\n map={map}\n diff={pointDiff}\n label={`${toIndex}`}\n />\n )\n })}\n </>\n )}\n </GoogleMap>\n )\n}\n\nfunction isChangeDiff(diff: Diff): diff is ObjectDiff<Geopoint> {\n return diff.action !== 'unchanged' && diff.type === 'object'\n}\n\nfunction hasCoordinates(point: Partial<Geopoint>): point is Geopoint {\n return typeof point.lat === 'number' && typeof point.lng === 'number'\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral[] | null | undefined,\n toValue: google.maps.LatLngLiteral[] | null | undefined,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds()\n const points = [...(fromValue || []), ...(toValue || [])]\n points.forEach((point) => bounds.extend(point))\n return bounds\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>\n\nexport const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral,\n toValue: google.maps.LatLngLiteral,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n return new api.LatLngBounds().extend(fromValue).extend(toValue)\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<Geopoint>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return 'Moved'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {useRef, useEffect} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {GeopointRadius} from '../types'\n\ninterface GeopointRadiusMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<GeopointRadius>\n label?: string\n}\n\nexport function GeopointRadiusMove({diff, api, map, label}: GeopointRadiusMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>(undefined)\n const toRef = useRef<google.maps.Marker>(undefined)\n const fromCircleRef = useRef<google.maps.Circle>(undefined)\n const toCircleRef = useRef<google.maps.Circle>(undefined)\n\n // Create circles for radius visualization\n useEffect(() => {\n const color = userColor?.background || '#4285F4'\n\n if (from && from.radius) {\n fromCircleRef.current = new api.Circle({\n map,\n center: {lat: from.lat, lng: from.lng},\n radius: from.radius,\n fillColor: color,\n fillOpacity: 0.1,\n strokeColor: color,\n strokeOpacity: 0.3,\n strokeWeight: 1,\n zIndex: 0,\n })\n }\n\n if (to && to.radius) {\n toCircleRef.current = new api.Circle({\n map,\n center: {lat: to.lat, lng: to.lng},\n radius: to.radius,\n fillColor: color,\n fillOpacity: 0.2,\n strokeColor: color,\n strokeOpacity: 0.8,\n strokeWeight: 2,\n zIndex: 2,\n })\n }\n\n return () => {\n if (fromCircleRef.current) {\n fromCircleRef.current.setMap(null)\n }\n if (toCircleRef.current) {\n toCircleRef.current.setMap(null)\n }\n }\n }, [api, map, from, to, userColor])\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {GeopointRadius} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointRadiusMove} from './GeopointRadiusMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<GeopointRadius>>\n\nexport const GeopointRadiusFieldDiff: DiffComponent<ObjectDiff<GeopointRadius>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointRadiusDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointRadiusDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, ['radius']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointRadiusMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral & {radius?: number},\n toValue: google.maps.LatLngLiteral & {radius?: number},\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds().extend(fromValue).extend(toValue)\n\n // Extend bounds to include radius circles\n const fromRadius = fromValue.radius || 0\n const toRadius = toValue.radius || 0\n const maxRadius = Math.max(fromRadius, toRadius)\n\n if (maxRadius > 0) {\n // Convert radius from meters to degrees (approximate)\n const radiusInDegrees = maxRadius / 111000 // Rough conversion\n bounds.extend({\n lat: fromValue.lat + radiusInDegrees,\n lng: fromValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: fromValue.lat - radiusInDegrees,\n lng: fromValue.lng - radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat + radiusInDegrees,\n lng: toValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat - radiusInDegrees,\n lng: toValue.lng - radiusInDegrees,\n })\n }\n\n return bounds\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<GeopointRadius>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n const latChanged = fromValue.lat !== toValue.lat || fromValue.lng !== toValue.lng\n const radiusChanged = fromValue.radius !== toValue.radius\n\n if (latChanged && radiusChanged) {\n return 'Moved and radius changed'\n } else if (latChanged) {\n return 'Moved'\n } else if (radiusChanged) {\n return 'Radius changed'\n }\n return 'Unchanged'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {definePlugin, type SchemaType} from 'sanity'\nimport {GeopointInput, type GeopointInputProps} from './input/GeopointInput'\nimport {GeopointRadiusInput, type GeopointRadiusInputProps} from './input/GeopointRadiusInput'\nimport {setGeoConfig} from './global-workaround'\nimport type {GeopointSchemaType, GeopointRadiusSchemaType, GoogleMapsInputConfig} from './types'\n\nexport const googleMapsInput = definePlugin<GoogleMapsInputConfig>((config) => {\n setGeoConfig(config)\n return {\n name: 'google-maps-input',\n schema: {\n types: [\n {\n name: 'geopointRadius',\n title: 'Geopoint with Radius',\n type: 'object',\n fields: [\n {\n name: 'lat',\n title: 'Latitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-90).max(90),\n },\n {\n name: 'lng',\n title: 'Longitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-180).max(180),\n },\n {\n name: 'alt',\n title: 'Altitude',\n type: 'number',\n },\n {\n name: 'radius',\n title: 'Radius (meters)',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(1).max(50000),\n },\n ],\n preview: {\n select: {\n lat: 'lat',\n lng: 'lng',\n radius: 'radius',\n },\n prepare({lat, lng, radius}: {lat: number; lng: number; radius: number}) {\n return {\n title: `${lat.toFixed(6)}, ${lng.toFixed(6)}`,\n subtitle: radius ? `Radius: ${radius}m` : 'No radius set',\n }\n },\n },\n },\n ],\n },\n form: {\n components: {\n input(props) {\n if (isGeopoint(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointInputProps, 'geoConfig'>\n return <GeopointInput {...castedProps} geoConfig={config} />\n }\n if (isGeopointRadius(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointRadiusInputProps, 'geoConfig'>\n return <GeopointRadiusInput {...castedProps} geoConfig={config} />\n }\n return props.renderDefault(props)\n },\n },\n },\n }\n})\n\nfunction isGeopoint(schemaType: SchemaType): schemaType is GeopointSchemaType {\n return isType('geopoint', schemaType)\n}\n\nfunction isGeopointRadius(schemaType: SchemaType): schemaType is GeopointRadiusSchemaType {\n return isType('geopointRadius', schemaType)\n}\n\nfunction isType(name: string, schema?: SchemaType): boolean {\n if (schema?.name === name) {\n return true\n // eslint-disable-next-line no-negated-condition\n } else if (!schema?.name) {\n return false\n }\n return isType(name, schema?.type)\n}\n"],"names":["config","AuthError","jsxs","Card","jsx","Box","Text","Fragment","Code","useState","useEffect","LoadErrorView","styled","PureComponent","createRef","TextInput","fallbackLatLng","getCenter","useCallback","EMPTY_PATH","getStaticImageUrl","useId","useRef","setIfMissing","set","unset","Stack","ChangeIndicator","Grid","Button","EditIcon","TrashIcon","Dialog","Label","useUserColor","GeopointDiff","getBounds","getAnnotationAtPath","DiffTooltip","getAction","definePlugin"],"mappings":";;;AAQA,MAAM,eAAe,mCACf,0BAA0B;kBAEzB,cAAwB,MAAM;AAAC;AAEtC,SAAS,mBAAmBA,SAA0C;AACpE,SAAO,IAAI,QAAmC,CAAC,SAAS,WAAW;AACjE,WAAO,uBAAuB,IAAI,MAAM;AACtC,aAAO,IAAIC,YAAU,oDAAoD,CAAC;AAAA,IAC5E,GAEA,OAAO,YAAY,IAAI,MAAM;AAC3B,cAAQ,OAAO,OAAO,IAAI;AAAA,IAC5B;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,UAAU,CACf,OACA,QACA,QACA,OACA,UACG,OAAO,IAAI,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,GAEjD,OAAO,MAAM,+CAA+CD,QAAO,MAAM,8BAA8B,YAAY,aAAaA,QAAO,MAAM,IAC7I,SAAS,qBAAqB,MAAM,EAAE,CAAC,EAAE,YAAY,MAAM;AAAA,EAC7D,CAAC,EAAE,QAAQ,MAAM;AACf,WAAO,OAAO,YAAY,GAC1B,OAAO,OAAO,uBAAuB;AAAA,EACvC,CAAC;AACH;AAEA,IAAI,OAAkD;AAC/C,SAAS,kBAAkBA,SAGK;AACrC,SAAI,SAGJ,OAAO,mBAAmBA,OAAM,GAChC,KAAK,MAAM,MAAM;AACf,WAAO;AAAA,EACT,CAAC,GACM;AACT;AACA,SAAS,aAAa,OAAuB,OAAuB;AAClE,SAAI,QACK,M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7 @@ import type {ArrayDiff} from 'sanity'
2
2
  import {DiffComponent} from 'sanity'
3
3
  import type {DiffComponentOptions} from 'sanity'
4
4
  import {DiffProps} from 'sanity'
5
- import {JSX as JSX_2} from 'react'
5
+ import {JSX} from 'react'
6
6
  import {ObjectDiff} from 'sanity'
7
7
  import {ObjectInputProps} from 'sanity'
8
8
  import type {ObjectSchemaType} from 'sanity'
@@ -25,7 +25,7 @@ export declare const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>>
25
25
 
26
26
  export declare type GeopointFieldDiffProps = DiffProps<ObjectDiff<Geopoint>>
27
27
 
28
- export declare function GeopointInput(props: GeopointInputProps): JSX_2.Element
28
+ export declare function GeopointInput(props: GeopointInputProps): JSX.Element
29
29
 
30
30
  export declare type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {
31
31
  geoConfig: GoogleMapsInputConfig
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import type {ArrayDiff} from 'sanity'
2
2
  import {DiffComponent} from 'sanity'
3
3
  import type {DiffComponentOptions} from 'sanity'
4
4
  import {DiffProps} from 'sanity'
5
- import {JSX as JSX_2} from 'react'
5
+ import {JSX} from 'react'
6
6
  import {ObjectDiff} from 'sanity'
7
7
  import {ObjectInputProps} from 'sanity'
8
8
  import type {ObjectSchemaType} from 'sanity'
@@ -25,7 +25,7 @@ export declare const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>>
25
25
 
26
26
  export declare type GeopointFieldDiffProps = DiffProps<ObjectDiff<Geopoint>>
27
27
 
28
- export declare function GeopointInput(props: GeopointInputProps): JSX_2.Element
28
+ export declare function GeopointInput(props: GeopointInputProps): JSX.Element
29
29
 
30
30
  export declare type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {
31
31
  geoConfig: GoogleMapsInputConfig
package/dist/index.js CHANGED
@@ -424,7 +424,7 @@ const fallbackLatLng = { lat: 40.7058254, lng: -74.1180863 }, MarkerDragSync = (
424
424
  defaultRadiusZoom = 12,
425
425
  defaultRadius = 1e3
426
426
  }) => {
427
- const circleRef = useRef(null), markerRef = useRef(), isMarkerDragging = useRef(!1), getCenter2 = useCallback(() => ({ ...fallbackLatLng, ...defaultLocation, ...value }), [value, defaultLocation]), setValue = useCallback(
427
+ const circleRef = useRef(null), markerRef = useRef(void 0), isMarkerDragging = useRef(!1), getCenter2 = useCallback(() => ({ ...fallbackLatLng, ...defaultLocation, ...value }), [value, defaultLocation]), setValue = useCallback(
428
428
  (geoPoint, radius) => {
429
429
  if (onChange) {
430
430
  const roundedRadius = radius ? Math.round(radius) : void 0;
@@ -703,7 +703,7 @@ class Arrow extends PureComponent {
703
703
  }
704
704
  }
705
705
  function GeopointMove({ diff, api, map, label }) {
706
- const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = useUserColor(annotation ? annotation.author : null) || void 0, fromRef = useRef(), toRef = useRef();
706
+ const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = useUserColor(annotation ? annotation.author : null) || void 0, fromRef = useRef(void 0), toRef = useRef(void 0);
707
707
  return /* @__PURE__ */ jsxs(Fragment, { children: [
708
708
  from && /* @__PURE__ */ jsx(
709
709
  Marker,
@@ -826,7 +826,7 @@ function getAction$1(diff) {
826
826
  return fromValue && toValue ? "Moved" : fromValue ? "Removed" : toValue ? "Added" : "Unchanged";
827
827
  }
828
828
  function GeopointRadiusMove({ diff, api, map, label }) {
829
- const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = useUserColor(annotation ? annotation.author : null) || void 0, fromRef = useRef(), toRef = useRef(), fromCircleRef = useRef(), toCircleRef = useRef();
829
+ const { fromValue: from, toValue: to } = diff, annotation = diff.isChanged ? diff.annotation : void 0, userColor = useUserColor(annotation ? annotation.author : null) || void 0, fromRef = useRef(void 0), toRef = useRef(void 0), fromCircleRef = useRef(void 0), toCircleRef = useRef(void 0);
830
830
  return useEffect(() => {
831
831
  const color = userColor?.background || "#4285F4";
832
832
  return from && from.radius && (fromCircleRef.current = new api.Circle({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/loader/loadGoogleMapsApi.ts","../src/loader/LoadError.tsx","../src/loader/GoogleMapsLoadProxy.tsx","../src/global-workaround.ts","../src/input/GeopointInput.styles.tsx","../src/map/SearchInput.styles.tsx","../src/map/SearchInput.tsx","../src/map/util.ts","../src/map/Map.styles.tsx","../src/map/Map.tsx","../src/map/Marker.tsx","../src/input/GeopointSelect.tsx","../src/input/GeopointInput.tsx","../src/input/GeopointRadiusSelect.tsx","../src/input/GeopointRadiusInput.tsx","../src/map/Arrow.tsx","../src/diff/GeopointMove.tsx","../src/diff/GeopointFieldDiff.styles.tsx","../src/diff/GeopointArrayDiff.tsx","../src/diff/GeopointFieldDiff.tsx","../src/diff/GeopointRadiusMove.tsx","../src/diff/GeopointRadiusFieldDiff.tsx","../src/plugin.tsx"],"sourcesContent":["declare global {\n // eslint-disable-next-line\n interface Window {\n gm_authFailure: any\n ___sanity_googleMapsApiCallback: any\n }\n}\n\nconst callbackName = '___sanity_googleMapsApiCallback'\nconst authFailureCallbackName = 'gm_authFailure'\n\nexport class AuthError extends Error {}\n\nfunction _loadGoogleMapsApi(config: {locale: string; apiKey: string}) {\n return new Promise<typeof window.google.maps>((resolve, reject) => {\n window[authFailureCallbackName] = () => {\n reject(new AuthError('Authentication error when loading Google Maps API.'))\n }\n\n window[callbackName] = () => {\n resolve(window.google.maps)\n }\n\n const script = document.createElement('script')\n script.onerror = (\n event: Event | string,\n source?: string,\n lineno?: number,\n colno?: number,\n error?: Error,\n ) => reject(new Error(coeerceError(event, error)))\n\n script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${callbackName}&language=${config.locale}`\n document.getElementsByTagName('head')[0].appendChild(script)\n }).finally(() => {\n delete window[callbackName]\n delete window[authFailureCallbackName]\n })\n}\n\nlet memo: Promise<typeof window.google.maps> | null = null\nexport function loadGoogleMapsApi(config: {\n locale: string\n apiKey: string\n}): Promise<typeof window.google.maps> {\n if (memo) {\n return memo\n }\n memo = _loadGoogleMapsApi(config)\n memo.catch(() => {\n memo = null\n })\n return memo\n}\nfunction coeerceError(event: Event | string, error?: Error): string {\n if (error) {\n return error.message\n }\n\n if (typeof event === 'string') {\n return event\n }\n\n return isErrorEvent(event) ? event.message : 'Failed to load Google Maps API'\n}\n\nfunction isErrorEvent(event: unknown): event is ErrorEvent {\n if (typeof event !== 'object' || event === null) {\n return false\n }\n\n if (!('message' in event)) {\n return false\n }\n\n return typeof (event as ErrorEvent).message === 'string'\n}\n","import {Card, Box, Text, Code} from '@sanity/ui'\n\ntype Props = {error: {message?: string}; isAuthError: false} | {isAuthError: true}\n\nexport function LoadError(props: Props) {\n return (\n <Card tone=\"critical\" radius={1}>\n <Box as=\"header\" paddingX={4} paddingTop={4} paddingBottom={1}>\n <Text as=\"h2\" weight=\"bold\">\n Google Maps failed to load\n </Text>\n </Box>\n\n <Box paddingX={4} paddingTop={4} paddingBottom={1}>\n {props.isAuthError ? (\n <AuthError />\n ) : (\n <>\n <Text as=\"h3\">Error details:</Text>\n <pre>\n <Code size={1}>{'error' in props && props.error?.message}</Code>\n </pre>\n </>\n )}\n </Box>\n </Card>\n )\n}\n\nfunction AuthError() {\n return (\n <Text>\n <p>The error appears to be related to authentication</p>\n <p>Common causes include:</p>\n <ul>\n <li>Incorrect API key</li>\n <li>Referer not allowed</li>\n <li>Missing authentication scope</li>\n </ul>\n <p>Check the browser developer tools for more information.</p>\n </Text>\n )\n}\n","import {type ReactElement, useEffect, useState} from 'react'\nimport type {GoogleMapsInputConfig} from '../types'\nimport {AuthError, loadGoogleMapsApi} from './loadGoogleMapsApi'\nimport {LoadError as LoadErrorView} from './LoadError'\n\ninterface LoadProps {\n children: (api: typeof window.google.maps) => ReactElement\n config: GoogleMapsInputConfig\n}\n\nconst browserLocale = (typeof window !== 'undefined' && window.navigator.language) || 'en'\n\ntype LoadState =\n | {\n type: 'loading'\n }\n | {\n type: 'loaded'\n api: typeof window.google.maps\n }\n | {\n type: 'error'\n error: {type: 'loadError' | 'authError'; message: string}\n }\n\nfunction useLoadGoogleMapsApi(config: {defaultLocale?: string; apiKey: string}): LoadState {\n const locale = config.defaultLocale || browserLocale || 'en-US'\n\n const [state, setState] = useState<LoadState>({type: 'loading'})\n\n useEffect(() => {\n if (typeof window === 'undefined') {\n return\n }\n\n loadGoogleMapsApi({locale, apiKey: config.apiKey}).then(\n (api) => setState({type: 'loaded', api}),\n (err) =>\n setState({\n type: 'error',\n error: {type: err instanceof AuthError ? 'authError' : 'loadError', message: err.message},\n }),\n )\n }, [locale, config.apiKey])\n return state\n}\n\nexport function GoogleMapsLoadProxy(props: LoadProps) {\n const loadState = useLoadGoogleMapsApi(props.config)\n switch (loadState.type) {\n case 'error':\n return (\n <LoadErrorView error={loadState.error} isAuthError={loadState.error.type === 'authError'} />\n )\n case 'loading':\n return <div>Loading Google Maps API</div>\n case 'loaded':\n return props.children(loadState.api)\n default:\n return null\n }\n}\n","import type {GoogleMapsInputConfig} from './types'\n\nlet config: GoogleMapsInputConfig\n\nexport function getGeoConfig(): GoogleMapsInputConfig {\n return config as GoogleMapsInputConfig\n}\n\nexport function setGeoConfig(newConfig: GoogleMapsInputConfig): void {\n config = newConfig\n}\n","import {styled} from 'styled-components'\n\nexport const PreviewImage = styled.img`\n width: 100%;\n height: auto;\n vertical-align: top;\n`\n\nexport const DialogInnerContainer = styled.div`\n height: 40rem;\n`\n","import {styled} from 'styled-components'\n\nexport const WrapperContainer = styled.div`\n position: absolute;\n right: 10px;\n top: 10px;\n width: 220px;\n`\n","import {TextInput} from '@sanity/ui'\nimport {WrapperContainer} from './SearchInput.styles'\nimport {createRef, PureComponent} from 'react'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onChange: (result: google.maps.places.PlaceResult) => void\n}\n\nexport class SearchInput extends PureComponent<Props> {\n searchInputRef = createRef<HTMLInputElement>()\n autoComplete: google.maps.places.Autocomplete | undefined\n\n handleChange = () => {\n if (!this.autoComplete) {\n return\n }\n\n this.props.onChange(this.autoComplete.getPlace())\n\n if (this.searchInputRef.current) {\n this.searchInputRef.current.value = ''\n }\n }\n\n componentDidMount() {\n const input = this.searchInputRef.current\n if (!input) {\n return\n }\n\n const {api, map} = this.props\n const {Circle, places, event} = api\n const searchBounds = new Circle({center: map.getCenter(), radius: 100}).getBounds()!\n this.autoComplete = new places.Autocomplete(input, {\n bounds: searchBounds,\n types: [], // return all kinds of places\n })\n\n event.addListener(this.autoComplete, 'place_changed', this.handleChange)\n }\n\n render() {\n return (\n <WrapperContainer>\n <TextInput\n name=\"place\"\n ref={this.searchInputRef}\n placeholder=\"Search for place or address\"\n padding={4}\n />\n </WrapperContainer>\n )\n }\n}\n","import type {LatLng} from '../types'\n\nexport function latLngAreEqual(\n latLng1: LatLng | google.maps.LatLng,\n latLng2: LatLng | google.maps.LatLng,\n): boolean {\n const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat\n const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng\n\n const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat\n const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng\n\n return lat1 === lat2 && lng1 === lng2\n}\n","import {styled} from 'styled-components'\n\nexport const MapContainer = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n`\n","import {createRef, PureComponent, type ReactElement} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\nimport {MapContainer} from './Map.styles'\n\ninterface MapProps {\n api: typeof window.google.maps\n location: LatLng\n bounds?: google.maps.LatLngBounds\n defaultZoom?: number\n mapTypeControl?: boolean\n scrollWheel?: boolean\n controlSize?: number\n onClick?: (event: google.maps.MapMouseEvent) => void\n children?: (map: google.maps.Map) => ReactElement\n}\n\ninterface MapState {\n map: google.maps.Map | undefined\n}\n\nexport class GoogleMap extends PureComponent<MapProps, MapState> {\n static defaultProps = {\n defaultZoom: 8,\n scrollWheel: true,\n }\n\n state: MapState = {map: undefined}\n clickHandler: google.maps.MapsEventListener | undefined\n mapRef = createRef<HTMLDivElement>()\n mapEl: HTMLDivElement | null = null\n\n componentDidMount() {\n this.attachClickHandler()\n }\n\n attachClickHandler = () => {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {api, onClick} = this.props\n const {event} = api\n\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n\n if (onClick) {\n this.clickHandler = event.addListener(map, 'click', onClick)\n }\n }\n\n componentDidUpdate(prevProps: MapProps) {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {onClick, location, bounds} = this.props\n\n if (prevProps.onClick !== onClick) {\n this.attachClickHandler()\n }\n\n if (!latLngAreEqual(prevProps.location, location)) {\n map.panTo(this.getCenter())\n }\n\n if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) {\n map.fitBounds(bounds)\n }\n }\n\n componentWillUnmount() {\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n }\n\n getCenter(): google.maps.LatLng {\n const {location, api} = this.props\n return new api.LatLng(location.lat, location.lng)\n }\n\n constructMap(el: HTMLDivElement) {\n const {defaultZoom, api, mapTypeControl, controlSize, bounds, scrollWheel} = this.props\n\n const map = new api.Map(el, {\n zoom: defaultZoom,\n center: this.getCenter(),\n scrollwheel: scrollWheel,\n streetViewControl: false,\n mapTypeControl,\n controlSize,\n })\n\n if (bounds) {\n map.fitBounds(bounds)\n }\n\n return map\n }\n\n setMapElement = (element: HTMLDivElement | null) => {\n if (element && element !== this.mapEl) {\n const map = this.constructMap(element)\n this.setState({map}, this.attachClickHandler)\n }\n\n this.mapEl = element\n }\n\n render() {\n const {children} = this.props\n const {map} = this.state\n return (\n <>\n <MapContainer ref={this.setMapElement} />\n {children && map ? children(map) : null}\n </>\n )\n }\n}\n","import {PureComponent, type MutableRefObject} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\nconst markerPath =\n 'M 3.052 3.7 C 1.56 5.293 0.626 7.612 0.663 9.793 C 0.738 14.352 2.793 16.077 6.078 22.351 C 7.263 25.111 8.497 28.032 9.672 32.871 C 9.835 33.584 9.994 34.246 10.069 34.305 C 10.143 34.362 10.301 33.697 10.465 32.983 C 11.639 28.145 12.875 25.226 14.059 22.466 C 17.344 16.192 19.398 14.466 19.474 9.908 C 19.511 7.727 18.574 5.405 17.083 3.814 C 15.379 1.994 12.809 0.649 10.069 0.593 C 7.328 0.536 4.756 1.882 3.052 3.7 Z'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onMove?: (event: google.maps.MapMouseEvent) => void\n onClick?: (event: google.maps.MapMouseEvent) => void\n position: LatLng | google.maps.LatLng\n zIndex?: number\n opacity?: number\n label?: string\n markerRef?: MutableRefObject<google.maps.Marker | undefined>\n color?: {background: string; border: string; text: string}\n}\n\nexport class Marker extends PureComponent<Props> {\n marker: google.maps.Marker | undefined\n\n eventHandlers: {\n move?: google.maps.MapsEventListener\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {position, api, map, onMove, zIndex, opacity, label, markerRef, color} = this.props\n const {Marker: GMarker} = api\n\n let icon: google.maps.Symbol | undefined\n if (color) {\n icon = {\n path: markerPath,\n fillOpacity: 1,\n fillColor: color.background,\n strokeColor: color.border,\n strokeWeight: 2,\n anchor: new api.Point(10, 35),\n labelOrigin: new api.Point(10, 11),\n }\n }\n\n this.marker = new GMarker({\n draggable: Boolean(onMove),\n position,\n map,\n zIndex,\n opacity,\n label,\n icon,\n })\n\n if (markerRef) {\n markerRef.current = this.marker\n }\n\n this.attachMoveHandler()\n this.attachClickHandler()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.marker) {\n return\n }\n\n const {position, onMove, label, zIndex, opacity, map} = this.props\n\n if (prevProps.onMove !== onMove) {\n this.attachMoveHandler()\n }\n\n if (!latLngAreEqual(prevProps.position, position)) {\n this.marker.setPosition(position)\n }\n\n if (prevProps.label !== label) {\n this.marker.setLabel(label || null)\n }\n\n if (prevProps.zIndex !== zIndex) {\n this.marker.setZIndex(zIndex || null)\n }\n\n if (prevProps.opacity !== opacity) {\n this.marker.setOpacity(opacity || null)\n }\n\n if (prevProps.map !== map) {\n this.marker.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n\n if (this.marker) {\n this.marker.setMap(null)\n }\n }\n\n attachMoveHandler() {\n const {api, onMove} = this.props\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n if (this.marker && onMove) {\n this.eventHandlers.move = api.event.addListener(this.marker, 'dragend', onMove)\n }\n }\n\n attachClickHandler() {\n const {api, onClick} = this.props\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n if (this.marker && onClick) {\n this.eventHandlers.click = api.event.addListener(this.marker, 'click', onClick)\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {type FC, useCallback} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, Geopoint} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: Geopoint\n onChange?: (latLng: google.maps.LatLng) => void\n defaultLocation?: LatLng\n defaultZoom?: number\n}\n\nexport const GeopointSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultZoom = 8,\n}) => {\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng) => {\n if (onChange) {\n onChange(geoPoint)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location)\n },\n [setValue],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n return (\n <GoogleMap api={api} location={getCenter()} onClick={handleMapClick} defaultZoom={defaultZoom}>\n {(map) => (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n />\n )}\n </>\n )}\n </GoogleMap>\n )\n}\n","import {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {Geopoint, GeopointSchemaType, GoogleMapsInputConfig, LatLng} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointSelect} from './GeopointSelect'\n\nconst EMPTY_PATH: Path = []\n\nconst getStaticImageUrl = (value: LatLng, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: '13',\n scale: '2',\n size: '640x300',\n })\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointInput(props: GeopointInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng) => {\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n ])\n },\n [schemaTypeName, onChange],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint type</a> needs a\n Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultZoom={config.defaultZoom}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import React, {type FC, useCallback, useEffect, useRef} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, GeopointRadius} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\n// Component to sync marker drag with circle position\nconst MarkerDragSync: FC<{\n api: typeof window.google.maps\n marker: google.maps.Marker\n circleRef: React.MutableRefObject<google.maps.Circle | null>\n isMarkerDragging: React.MutableRefObject<boolean>\n}> = ({api, marker, circleRef, isMarkerDragging}) => {\n useEffect(() => {\n const handleDrag = () => {\n isMarkerDragging.current = true\n }\n\n const handleDragEnd = () => {\n isMarkerDragging.current = false\n }\n\n const dragListener = api.event.addListener(marker, 'drag', handleDrag)\n const dragEndListener = api.event.addListener(marker, 'dragend', handleDragEnd)\n\n return () => {\n api.event.removeListener(dragListener)\n api.event.removeListener(dragEndListener)\n }\n }, [api, marker, circleRef, isMarkerDragging])\n\n return null\n}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: GeopointRadius\n onChange?: (latLng: google.maps.LatLng, radius?: number) => void\n defaultLocation?: LatLng\n defaultRadiusZoom?: number\n defaultRadius?: number\n}\n\nexport const GeopointRadiusSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultRadiusZoom = 12,\n defaultRadius = 1000,\n}) => {\n const circleRef = useRef<google.maps.Circle | null>(null)\n const markerRef = useRef<google.maps.Marker | undefined>()\n const isMarkerDragging = useRef(false)\n\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng, radius?: number) => {\n if (onChange) {\n const roundedRadius = radius ? Math.round(radius) : undefined\n onChange(geoPoint, roundedRadius)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location, value?.radius || defaultRadius)\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n // Update circle position when marker drag ends\n if (circleRef.current) {\n circleRef.current.setCenter(event.latLng)\n }\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n // Create or update circle when value changes\n useEffect(() => {\n if (value && circleRef.current) {\n circleRef.current.setCenter({lat: value.lat, lng: value.lng})\n circleRef.current.setRadius(value.radius)\n }\n }, [value])\n\n return (\n <GoogleMap\n api={api}\n location={getCenter()}\n onClick={handleMapClick}\n defaultZoom={defaultRadiusZoom}\n >\n {(map) => {\n // Create circle if it doesn't exist and we have a value\n if (value && !circleRef.current) {\n circleRef.current = new api.Circle({\n map,\n center: {lat: value.lat, lng: value.lng},\n radius: value.radius,\n fillColor: '#4285F4',\n fillOpacity: 0.2,\n strokeColor: '#4285F4',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n editable: true,\n })\n\n // Add event listeners for circle interactions\n circleRef.current.addListener('center_changed', () => {\n if (circleRef.current && markerRef.current && !isMarkerDragging.current) {\n // When circle center is dragged, move the marker to match\n const circleCenter = circleRef.current.getCenter()\n if (circleCenter) {\n markerRef.current.setPosition(circleCenter)\n }\n }\n })\n\n circleRef.current.addListener('radius_changed', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n\n circleRef.current.addListener('dragend', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n }\n\n return (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n markerRef={markerRef}\n />\n )}\n {/* Add drag event listener to marker for circle sync */}\n {value && markerRef.current && (\n <MarkerDragSync\n api={api}\n marker={markerRef.current}\n circleRef={circleRef}\n isMarkerDragging={isMarkerDragging}\n />\n )}\n </>\n )\n }}\n </GoogleMap>\n )\n}\n","import React, {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack, TextInput, Label} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {\n GeopointRadius,\n GeopointRadiusSchemaType,\n GoogleMapsInputConfig,\n LatLng,\n} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointRadiusSelect} from './GeopointRadiusSelect'\n\nconst EMPTY_PATH: Path = []\n\n// Helper function to generate circle points\nconst generateCirclePoints = (\n lat: number,\n lng: number,\n radius: number,\n): Array<{lat: number; lng: number}> => {\n const points = []\n const steps = 32 // Number of points to create the circle\n\n for (let i = 0; i <= steps; i++) {\n const angle = (i / steps) * 2 * Math.PI\n const latOffset = (radius / 111000) * Math.cos(angle) // Rough conversion to degrees\n const lngOffset = (radius / (111000 * Math.cos((lat * Math.PI) / 180))) * Math.sin(angle)\n\n points.push({\n lat: lat + latOffset,\n lng: lng + lngOffset,\n })\n }\n\n return points\n}\n\nconst getStaticImageUrl = (value: LatLng & {radius?: number}, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n\n // Calculate appropriate zoom level based on radius\n let zoom = 13\n if (value.radius) {\n // Use logarithmic formula for better zoom calculation\n // Add padding to ensure circle is fully visible\n const radius = value.radius + value.radius / 2\n const scale = radius / 500\n const calculatedZoom = 16 - Math.log(scale) / Math.log(2)\n // Add small offset to ensure circle fits well in view\n zoom = Math.max(8, Math.min(16, Math.round(calculatedZoom - 0.4)))\n }\n\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: zoom.toString(),\n scale: '2',\n size: '640x300',\n })\n\n // Add circle if radius is present\n if (value.radius) {\n // Create a circle path using multiple points\n const points = generateCirclePoints(value.lat, value.lng, value.radius)\n const path = points.map((p) => `${p.lat},${p.lng}`).join('|')\n qs.append('path', `fillcolor:0x4285F480|color:0x4285F4|weight:2|${path}`)\n }\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointRadiusInputProps = ObjectInputProps<\n GeopointRadius,\n GeopointRadiusSchemaType\n> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointRadiusInput(props: GeopointRadiusInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng, radius?: number) => {\n const currentRadius = radius ?? value?.radius ?? config.defaultRadius ?? 1000\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n set(currentRadius, ['radius']),\n ])\n },\n [schemaTypeName, onChange, value?.radius, config.defaultRadius],\n )\n\n const handleRadiusChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (value) {\n onChange([set(Math.round(Number(event.currentTarget.value)), ['radius'])])\n }\n },\n [onChange, value],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint Radius type</a>{' '}\n needs a Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location with radius\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n {value && (\n <Stack space={2}>\n <Label>Radius (meters)</Label>\n <TextInput\n type=\"number\"\n value={Math.round(value.radius || config.defaultRadius || 1000)}\n onChange={handleRadiusChange}\n disabled={readOnly}\n min={1}\n max={50000}\n step={1}\n />\n </Stack>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location and radius'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker and set radius on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointRadiusSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultRadiusZoom={config.defaultRadiusZoom}\n defaultRadius={config.defaultRadius}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import {type MutableRefObject, PureComponent} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n from: LatLng\n to: LatLng\n color?: {background: string; border: string; text: string}\n zIndex?: number\n arrowRef?: MutableRefObject<google.maps.Polyline | undefined>\n onClick?: (event: google.maps.MapMouseEvent) => void\n}\n\nexport class Arrow extends PureComponent<Props> {\n line: google.maps.Polyline | undefined\n\n eventHandlers: {\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {from, to, api, map, zIndex, onClick, color, arrowRef} = this.props\n const lineSymbol = {\n path: api.SymbolPath.FORWARD_OPEN_ARROW,\n }\n\n this.line = new api.Polyline({\n map,\n zIndex,\n path: [from, to],\n icons: [{icon: lineSymbol, offset: '50%'}],\n strokeOpacity: 0.55,\n strokeColor: color ? color.text : 'black',\n })\n\n if (onClick) {\n this.eventHandlers.click = api.event.addListener(this.line, 'click', onClick)\n }\n\n if (arrowRef) {\n arrowRef.current = this.line\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.line) {\n return\n }\n\n const {from, to, map} = this.props\n if (!latLngAreEqual(prevProps.from, from) || !latLngAreEqual(prevProps.to, to)) {\n this.line.setPath([from, to])\n }\n\n if (prevProps.map !== map) {\n this.line.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.line) {\n this.line.setMap(null)\n }\n\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {useRef} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {Geopoint} from '../types'\n\ninterface GeopointMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<Geopoint>\n label?: string\n}\n\nexport function GeopointMove({diff, api, map, label}: GeopointMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>()\n const toRef = useRef<google.maps.Marker>()\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {styled} from 'styled-components'\n\nexport const RootContainer = styled.div`\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n`\n","import type {\n ArrayDiff,\n Diff,\n DiffComponent,\n DiffProps as GenericDiffProps,\n ObjectDiff,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>\n\nexport const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof google.maps}) {\n const fromValue = (diff.fromValue || []).filter(hasCoordinates)\n const toValue = (diff.toValue || []).filter(hasCoordinates)\n if (fromValue.length === 0 && toValue.length === 0) {\n return null\n }\n\n const bounds = getBounds(fromValue, toValue, api)\n return (\n <GoogleMap\n api={api}\n location={bounds.getCenter().toJSON()}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n >\n {(map) => (\n <>\n {diff.items.map(({toIndex, diff: pointDiff}) => {\n if (!isChangeDiff(pointDiff)) {\n return null\n }\n\n return (\n <GeopointMove\n key={toIndex}\n api={api}\n map={map}\n diff={pointDiff}\n label={`${toIndex}`}\n />\n )\n })}\n </>\n )}\n </GoogleMap>\n )\n}\n\nfunction isChangeDiff(diff: Diff): diff is ObjectDiff<Geopoint> {\n return diff.action !== 'unchanged' && diff.type === 'object'\n}\n\nfunction hasCoordinates(point: Partial<Geopoint>): point is Geopoint {\n return typeof point.lat === 'number' && typeof point.lng === 'number'\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral[] | null | undefined,\n toValue: google.maps.LatLngLiteral[] | null | undefined,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds()\n const points = [...(fromValue || []), ...(toValue || [])]\n points.forEach((point) => bounds.extend(point))\n return bounds\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>\n\nexport const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral,\n toValue: google.maps.LatLngLiteral,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n return new api.LatLngBounds().extend(fromValue).extend(toValue)\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<Geopoint>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return 'Moved'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {useRef, useEffect} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {GeopointRadius} from '../types'\n\ninterface GeopointRadiusMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<GeopointRadius>\n label?: string\n}\n\nexport function GeopointRadiusMove({diff, api, map, label}: GeopointRadiusMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>()\n const toRef = useRef<google.maps.Marker>()\n const fromCircleRef = useRef<google.maps.Circle>()\n const toCircleRef = useRef<google.maps.Circle>()\n\n // Create circles for radius visualization\n useEffect(() => {\n const color = userColor?.background || '#4285F4'\n\n if (from && from.radius) {\n fromCircleRef.current = new api.Circle({\n map,\n center: {lat: from.lat, lng: from.lng},\n radius: from.radius,\n fillColor: color,\n fillOpacity: 0.1,\n strokeColor: color,\n strokeOpacity: 0.3,\n strokeWeight: 1,\n zIndex: 0,\n })\n }\n\n if (to && to.radius) {\n toCircleRef.current = new api.Circle({\n map,\n center: {lat: to.lat, lng: to.lng},\n radius: to.radius,\n fillColor: color,\n fillOpacity: 0.2,\n strokeColor: color,\n strokeOpacity: 0.8,\n strokeWeight: 2,\n zIndex: 2,\n })\n }\n\n return () => {\n if (fromCircleRef.current) {\n fromCircleRef.current.setMap(null)\n }\n if (toCircleRef.current) {\n toCircleRef.current.setMap(null)\n }\n }\n }, [api, map, from, to, userColor])\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {GeopointRadius} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointRadiusMove} from './GeopointRadiusMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<GeopointRadius>>\n\nexport const GeopointRadiusFieldDiff: DiffComponent<ObjectDiff<GeopointRadius>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointRadiusDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointRadiusDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, ['radius']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointRadiusMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral & {radius?: number},\n toValue: google.maps.LatLngLiteral & {radius?: number},\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds().extend(fromValue).extend(toValue)\n\n // Extend bounds to include radius circles\n const fromRadius = fromValue.radius || 0\n const toRadius = toValue.radius || 0\n const maxRadius = Math.max(fromRadius, toRadius)\n\n if (maxRadius > 0) {\n // Convert radius from meters to degrees (approximate)\n const radiusInDegrees = maxRadius / 111000 // Rough conversion\n bounds.extend({\n lat: fromValue.lat + radiusInDegrees,\n lng: fromValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: fromValue.lat - radiusInDegrees,\n lng: fromValue.lng - radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat + radiusInDegrees,\n lng: toValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat - radiusInDegrees,\n lng: toValue.lng - radiusInDegrees,\n })\n }\n\n return bounds\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<GeopointRadius>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n const latChanged = fromValue.lat !== toValue.lat || fromValue.lng !== toValue.lng\n const radiusChanged = fromValue.radius !== toValue.radius\n\n if (latChanged && radiusChanged) {\n return 'Moved and radius changed'\n } else if (latChanged) {\n return 'Moved'\n } else if (radiusChanged) {\n return 'Radius changed'\n }\n return 'Unchanged'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {definePlugin, type SchemaType} from 'sanity'\nimport {GeopointInput, type GeopointInputProps} from './input/GeopointInput'\nimport {GeopointRadiusInput, type GeopointRadiusInputProps} from './input/GeopointRadiusInput'\nimport {setGeoConfig} from './global-workaround'\nimport type {GeopointSchemaType, GeopointRadiusSchemaType, GoogleMapsInputConfig} from './types'\n\nexport const googleMapsInput = definePlugin<GoogleMapsInputConfig>((config) => {\n setGeoConfig(config)\n return {\n name: 'google-maps-input',\n schema: {\n types: [\n {\n name: 'geopointRadius',\n title: 'Geopoint with Radius',\n type: 'object',\n fields: [\n {\n name: 'lat',\n title: 'Latitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-90).max(90),\n },\n {\n name: 'lng',\n title: 'Longitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-180).max(180),\n },\n {\n name: 'alt',\n title: 'Altitude',\n type: 'number',\n },\n {\n name: 'radius',\n title: 'Radius (meters)',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(1).max(50000),\n },\n ],\n preview: {\n select: {\n lat: 'lat',\n lng: 'lng',\n radius: 'radius',\n },\n prepare({lat, lng, radius}: {lat: number; lng: number; radius: number}) {\n return {\n title: `${lat.toFixed(6)}, ${lng.toFixed(6)}`,\n subtitle: radius ? `Radius: ${radius}m` : 'No radius set',\n }\n },\n },\n },\n ],\n },\n form: {\n components: {\n input(props) {\n if (isGeopoint(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointInputProps, 'geoConfig'>\n return <GeopointInput {...castedProps} geoConfig={config} />\n }\n if (isGeopointRadius(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointRadiusInputProps, 'geoConfig'>\n return <GeopointRadiusInput {...castedProps} geoConfig={config} />\n }\n return props.renderDefault(props)\n },\n },\n },\n }\n})\n\nfunction isGeopoint(schemaType: SchemaType): schemaType is GeopointSchemaType {\n return isType('geopoint', schemaType)\n}\n\nfunction isGeopointRadius(schemaType: SchemaType): schemaType is GeopointRadiusSchemaType {\n return isType('geopointRadius', schemaType)\n}\n\nfunction isType(name: string, schema?: SchemaType): boolean {\n if (schema?.name === name) {\n return true\n // eslint-disable-next-line no-negated-condition\n } else if (!schema?.name) {\n return false\n }\n return isType(name, schema?.type)\n}\n"],"names":["config","AuthError","LoadErrorView","fallbackLatLng","getCenter","EMPTY_PATH","getStaticImageUrl","GeopointDiff","getBounds","getAction"],"mappings":";;;;;;AAQA,MAAM,eAAe,mCACf,0BAA0B;kBAEzB,cAAwB,MAAM;AAAC;AAEtC,SAAS,mBAAmBA,SAA0C;AACpE,SAAO,IAAI,QAAmC,CAAC,SAAS,WAAW;AACjE,WAAO,uBAAuB,IAAI,MAAM;AACtC,aAAO,IAAIC,YAAU,oDAAoD,CAAC;AAAA,IAC5E,GAEA,OAAO,YAAY,IAAI,MAAM;AAC3B,cAAQ,OAAO,OAAO,IAAI;AAAA,IAC5B;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,UAAU,CACf,OACA,QACA,QACA,OACA,UACG,OAAO,IAAI,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,GAEjD,OAAO,MAAM,+CAA+CD,QAAO,MAAM,8BAA8B,YAAY,aAAaA,QAAO,MAAM,IAC7I,S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CAAC,SAAc,KAAK,SAAA,EAAW,IAAI,CAAC,EAAE,IAAI,GAAK;AAAA,UAAA;AAAA,QAC7D;AAAA,QAEF,SAAS;AAAA,UACP,QAAQ;AAAA,YACN,KAAK;AAAA,YACL,KAAK;AAAA,YACL,QAAQ;AAAA,UAAA;AAAA,UAEV,QAAQ,EAAC,KAAK,KAAK,UAAqD;AACtE,mBAAO;AAAA,cACL,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC;AAAA,cAC3C,UAAU,SAAS,WAAW,MAAM,MAAM;AAAA,YAAA;AAAA,UAE9C;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEF,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,MAAM,OAAO;AACX,eAAI,WAAW,MAAM,UAAU,IAEtB,oBAAC,iBAAe,GADH,OACmB,WAAWA,QAAA,CAAQ,IAExD,iBAAiB,MAAM,UAAU,IAE5B,oBAAC,qBAAA,EAAqB,GADT,OACyB,WAAWA,SAAQ,IAE3D,MAAM,cAAc,KAAK;AAAA,MAClC;AAAA,IAAA;AAAA,EACF;AAEJ,EACD;AAED,SAAS,WAAW,YAA0D;AAC5E,SAAO,OAAO,YAAY,UAAU;AACtC;AAEA,SAAS,iBAAiB,YAAgE;AACxF,SAAO,OAAO,kBAAkB,UAAU;AAC5C;AAEA,SAAS,OAAO,MAAc,QAA8B;AAC1D,SAAI,QAAQ,SAAS,OACZ,KAEG,QAAQ,OAGb,OAAO,MAAM,QAAQ,IAAI,IAFvB;AAGX;"}
1
+ {"version":3,"file":"index.js","sources":["../src/loader/loadGoogleMapsApi.ts","../src/loader/LoadError.tsx","../src/loader/GoogleMapsLoadProxy.tsx","../src/global-workaround.ts","../src/input/GeopointInput.styles.tsx","../src/map/SearchInput.styles.tsx","../src/map/SearchInput.tsx","../src/map/util.ts","../src/map/Map.styles.tsx","../src/map/Map.tsx","../src/map/Marker.tsx","../src/input/GeopointSelect.tsx","../src/input/GeopointInput.tsx","../src/input/GeopointRadiusSelect.tsx","../src/input/GeopointRadiusInput.tsx","../src/map/Arrow.tsx","../src/diff/GeopointMove.tsx","../src/diff/GeopointFieldDiff.styles.tsx","../src/diff/GeopointArrayDiff.tsx","../src/diff/GeopointFieldDiff.tsx","../src/diff/GeopointRadiusMove.tsx","../src/diff/GeopointRadiusFieldDiff.tsx","../src/plugin.tsx"],"sourcesContent":["declare global {\n // eslint-disable-next-line\n interface Window {\n gm_authFailure: any\n ___sanity_googleMapsApiCallback: any\n }\n}\n\nconst callbackName = '___sanity_googleMapsApiCallback'\nconst authFailureCallbackName = 'gm_authFailure'\n\nexport class AuthError extends Error {}\n\nfunction _loadGoogleMapsApi(config: {locale: string; apiKey: string}) {\n return new Promise<typeof window.google.maps>((resolve, reject) => {\n window[authFailureCallbackName] = () => {\n reject(new AuthError('Authentication error when loading Google Maps API.'))\n }\n\n window[callbackName] = () => {\n resolve(window.google.maps)\n }\n\n const script = document.createElement('script')\n script.onerror = (\n event: Event | string,\n source?: string,\n lineno?: number,\n colno?: number,\n error?: Error,\n ) => reject(new Error(coeerceError(event, error)))\n\n script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${callbackName}&language=${config.locale}`\n document.getElementsByTagName('head')[0].appendChild(script)\n }).finally(() => {\n delete window[callbackName]\n delete window[authFailureCallbackName]\n })\n}\n\nlet memo: Promise<typeof window.google.maps> | null = null\nexport function loadGoogleMapsApi(config: {\n locale: string\n apiKey: string\n}): Promise<typeof window.google.maps> {\n if (memo) {\n return memo\n }\n memo = _loadGoogleMapsApi(config)\n memo.catch(() => {\n memo = null\n })\n return memo\n}\nfunction coeerceError(event: Event | string, error?: Error): string {\n if (error) {\n return error.message\n }\n\n if (typeof event === 'string') {\n return event\n }\n\n return isErrorEvent(event) ? event.message : 'Failed to load Google Maps API'\n}\n\nfunction isErrorEvent(event: unknown): event is ErrorEvent {\n if (typeof event !== 'object' || event === null) {\n return false\n }\n\n if (!('message' in event)) {\n return false\n }\n\n return typeof (event as ErrorEvent).message === 'string'\n}\n","import {Card, Box, Text, Code} from '@sanity/ui'\n\ntype Props = {error: {message?: string}; isAuthError: false} | {isAuthError: true}\n\nexport function LoadError(props: Props) {\n return (\n <Card tone=\"critical\" radius={1}>\n <Box as=\"header\" paddingX={4} paddingTop={4} paddingBottom={1}>\n <Text as=\"h2\" weight=\"bold\">\n Google Maps failed to load\n </Text>\n </Box>\n\n <Box paddingX={4} paddingTop={4} paddingBottom={1}>\n {props.isAuthError ? (\n <AuthError />\n ) : (\n <>\n <Text as=\"h3\">Error details:</Text>\n <pre>\n <Code size={1}>{'error' in props && props.error?.message}</Code>\n </pre>\n </>\n )}\n </Box>\n </Card>\n )\n}\n\nfunction AuthError() {\n return (\n <Text>\n <p>The error appears to be related to authentication</p>\n <p>Common causes include:</p>\n <ul>\n <li>Incorrect API key</li>\n <li>Referer not allowed</li>\n <li>Missing authentication scope</li>\n </ul>\n <p>Check the browser developer tools for more information.</p>\n </Text>\n )\n}\n","import {type ReactElement, useEffect, useState} from 'react'\nimport type {GoogleMapsInputConfig} from '../types'\nimport {AuthError, loadGoogleMapsApi} from './loadGoogleMapsApi'\nimport {LoadError as LoadErrorView} from './LoadError'\n\ninterface LoadProps {\n children: (api: typeof window.google.maps) => ReactElement\n config: GoogleMapsInputConfig\n}\n\nconst browserLocale = (typeof window !== 'undefined' && window.navigator.language) || 'en'\n\ntype LoadState =\n | {\n type: 'loading'\n }\n | {\n type: 'loaded'\n api: typeof window.google.maps\n }\n | {\n type: 'error'\n error: {type: 'loadError' | 'authError'; message: string}\n }\n\nfunction useLoadGoogleMapsApi(config: {defaultLocale?: string; apiKey: string}): LoadState {\n const locale = config.defaultLocale || browserLocale || 'en-US'\n\n const [state, setState] = useState<LoadState>({type: 'loading'})\n\n useEffect(() => {\n if (typeof window === 'undefined') {\n return\n }\n\n loadGoogleMapsApi({locale, apiKey: config.apiKey}).then(\n (api) => setState({type: 'loaded', api}),\n (err) =>\n setState({\n type: 'error',\n error: {type: err instanceof AuthError ? 'authError' : 'loadError', message: err.message},\n }),\n )\n }, [locale, config.apiKey])\n return state\n}\n\nexport function GoogleMapsLoadProxy(props: LoadProps) {\n const loadState = useLoadGoogleMapsApi(props.config)\n switch (loadState.type) {\n case 'error':\n return (\n <LoadErrorView error={loadState.error} isAuthError={loadState.error.type === 'authError'} />\n )\n case 'loading':\n return <div>Loading Google Maps API</div>\n case 'loaded':\n return props.children(loadState.api)\n default:\n return null\n }\n}\n","import type {GoogleMapsInputConfig} from './types'\n\nlet config: GoogleMapsInputConfig\n\nexport function getGeoConfig(): GoogleMapsInputConfig {\n return config as GoogleMapsInputConfig\n}\n\nexport function setGeoConfig(newConfig: GoogleMapsInputConfig): void {\n config = newConfig\n}\n","import {styled} from 'styled-components'\n\nexport const PreviewImage = styled.img`\n width: 100%;\n height: auto;\n vertical-align: top;\n`\n\nexport const DialogInnerContainer = styled.div`\n height: 40rem;\n`\n","import {styled} from 'styled-components'\n\nexport const WrapperContainer = styled.div`\n position: absolute;\n right: 10px;\n top: 10px;\n width: 220px;\n`\n","import {TextInput} from '@sanity/ui'\nimport {WrapperContainer} from './SearchInput.styles'\nimport {createRef, PureComponent} from 'react'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onChange: (result: google.maps.places.PlaceResult) => void\n}\n\nexport class SearchInput extends PureComponent<Props> {\n searchInputRef = createRef<HTMLInputElement>()\n autoComplete: google.maps.places.Autocomplete | undefined\n\n handleChange = () => {\n if (!this.autoComplete) {\n return\n }\n\n this.props.onChange(this.autoComplete.getPlace())\n\n if (this.searchInputRef.current) {\n this.searchInputRef.current.value = ''\n }\n }\n\n componentDidMount() {\n const input = this.searchInputRef.current\n if (!input) {\n return\n }\n\n const {api, map} = this.props\n const {Circle, places, event} = api\n const searchBounds = new Circle({center: map.getCenter(), radius: 100}).getBounds()!\n this.autoComplete = new places.Autocomplete(input, {\n bounds: searchBounds,\n types: [], // return all kinds of places\n })\n\n event.addListener(this.autoComplete, 'place_changed', this.handleChange)\n }\n\n render() {\n return (\n <WrapperContainer>\n <TextInput\n name=\"place\"\n ref={this.searchInputRef}\n placeholder=\"Search for place or address\"\n padding={4}\n />\n </WrapperContainer>\n )\n }\n}\n","import type {LatLng} from '../types'\n\nexport function latLngAreEqual(\n latLng1: LatLng | google.maps.LatLng,\n latLng2: LatLng | google.maps.LatLng,\n): boolean {\n const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat\n const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng\n\n const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat\n const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng\n\n return lat1 === lat2 && lng1 === lng2\n}\n","import {styled} from 'styled-components'\n\nexport const MapContainer = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n`\n","import {createRef, PureComponent, type ReactElement} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\nimport {MapContainer} from './Map.styles'\n\ninterface MapProps {\n api: typeof window.google.maps\n location: LatLng\n bounds?: google.maps.LatLngBounds\n defaultZoom?: number\n mapTypeControl?: boolean\n scrollWheel?: boolean\n controlSize?: number\n onClick?: (event: google.maps.MapMouseEvent) => void\n children?: (map: google.maps.Map) => ReactElement\n}\n\ninterface MapState {\n map: google.maps.Map | undefined\n}\n\nexport class GoogleMap extends PureComponent<MapProps, MapState> {\n static defaultProps = {\n defaultZoom: 8,\n scrollWheel: true,\n }\n\n state: MapState = {map: undefined}\n clickHandler: google.maps.MapsEventListener | undefined\n mapRef = createRef<HTMLDivElement>()\n mapEl: HTMLDivElement | null = null\n\n componentDidMount() {\n this.attachClickHandler()\n }\n\n attachClickHandler = () => {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {api, onClick} = this.props\n const {event} = api\n\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n\n if (onClick) {\n this.clickHandler = event.addListener(map, 'click', onClick)\n }\n }\n\n componentDidUpdate(prevProps: MapProps) {\n const map = this.state.map\n if (!map) {\n return\n }\n\n const {onClick, location, bounds} = this.props\n\n if (prevProps.onClick !== onClick) {\n this.attachClickHandler()\n }\n\n if (!latLngAreEqual(prevProps.location, location)) {\n map.panTo(this.getCenter())\n }\n\n if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) {\n map.fitBounds(bounds)\n }\n }\n\n componentWillUnmount() {\n if (this.clickHandler) {\n this.clickHandler.remove()\n }\n }\n\n getCenter(): google.maps.LatLng {\n const {location, api} = this.props\n return new api.LatLng(location.lat, location.lng)\n }\n\n constructMap(el: HTMLDivElement) {\n const {defaultZoom, api, mapTypeControl, controlSize, bounds, scrollWheel} = this.props\n\n const map = new api.Map(el, {\n zoom: defaultZoom,\n center: this.getCenter(),\n scrollwheel: scrollWheel,\n streetViewControl: false,\n mapTypeControl,\n controlSize,\n })\n\n if (bounds) {\n map.fitBounds(bounds)\n }\n\n return map\n }\n\n setMapElement = (element: HTMLDivElement | null) => {\n if (element && element !== this.mapEl) {\n const map = this.constructMap(element)\n this.setState({map}, this.attachClickHandler)\n }\n\n this.mapEl = element\n }\n\n render() {\n const {children} = this.props\n const {map} = this.state\n return (\n <>\n <MapContainer ref={this.setMapElement} />\n {children && map ? children(map) : null}\n </>\n )\n }\n}\n","import {PureComponent, type MutableRefObject} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\nconst markerPath =\n 'M 3.052 3.7 C 1.56 5.293 0.626 7.612 0.663 9.793 C 0.738 14.352 2.793 16.077 6.078 22.351 C 7.263 25.111 8.497 28.032 9.672 32.871 C 9.835 33.584 9.994 34.246 10.069 34.305 C 10.143 34.362 10.301 33.697 10.465 32.983 C 11.639 28.145 12.875 25.226 14.059 22.466 C 17.344 16.192 19.398 14.466 19.474 9.908 C 19.511 7.727 18.574 5.405 17.083 3.814 C 15.379 1.994 12.809 0.649 10.069 0.593 C 7.328 0.536 4.756 1.882 3.052 3.7 Z'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n onMove?: (event: google.maps.MapMouseEvent) => void\n onClick?: (event: google.maps.MapMouseEvent) => void\n position: LatLng | google.maps.LatLng\n zIndex?: number\n opacity?: number\n label?: string\n markerRef?: MutableRefObject<google.maps.Marker | undefined>\n color?: {background: string; border: string; text: string}\n}\n\nexport class Marker extends PureComponent<Props> {\n marker: google.maps.Marker | undefined\n\n eventHandlers: {\n move?: google.maps.MapsEventListener\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {position, api, map, onMove, zIndex, opacity, label, markerRef, color} = this.props\n const {Marker: GMarker} = api\n\n let icon: google.maps.Symbol | undefined\n if (color) {\n icon = {\n path: markerPath,\n fillOpacity: 1,\n fillColor: color.background,\n strokeColor: color.border,\n strokeWeight: 2,\n anchor: new api.Point(10, 35),\n labelOrigin: new api.Point(10, 11),\n }\n }\n\n this.marker = new GMarker({\n draggable: Boolean(onMove),\n position,\n map,\n zIndex,\n opacity,\n label,\n icon,\n })\n\n if (markerRef) {\n markerRef.current = this.marker\n }\n\n this.attachMoveHandler()\n this.attachClickHandler()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.marker) {\n return\n }\n\n const {position, onMove, label, zIndex, opacity, map} = this.props\n\n if (prevProps.onMove !== onMove) {\n this.attachMoveHandler()\n }\n\n if (!latLngAreEqual(prevProps.position, position)) {\n this.marker.setPosition(position)\n }\n\n if (prevProps.label !== label) {\n this.marker.setLabel(label || null)\n }\n\n if (prevProps.zIndex !== zIndex) {\n this.marker.setZIndex(zIndex || null)\n }\n\n if (prevProps.opacity !== opacity) {\n this.marker.setOpacity(opacity || null)\n }\n\n if (prevProps.map !== map) {\n this.marker.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n\n if (this.marker) {\n this.marker.setMap(null)\n }\n }\n\n attachMoveHandler() {\n const {api, onMove} = this.props\n if (this.eventHandlers.move) {\n this.eventHandlers.move.remove()\n }\n if (this.marker && onMove) {\n this.eventHandlers.move = api.event.addListener(this.marker, 'dragend', onMove)\n }\n }\n\n attachClickHandler() {\n const {api, onClick} = this.props\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n if (this.marker && onClick) {\n this.eventHandlers.click = api.event.addListener(this.marker, 'click', onClick)\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {type FC, useCallback} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, Geopoint} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: Geopoint\n onChange?: (latLng: google.maps.LatLng) => void\n defaultLocation?: LatLng\n defaultZoom?: number\n}\n\nexport const GeopointSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultZoom = 8,\n}) => {\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng) => {\n if (onChange) {\n onChange(geoPoint)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location)\n },\n [setValue],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) setValue(event.latLng)\n },\n [setValue],\n )\n\n return (\n <GoogleMap api={api} location={getCenter()} onClick={handleMapClick} defaultZoom={defaultZoom}>\n {(map) => (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n />\n )}\n </>\n )}\n </GoogleMap>\n )\n}\n","import {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {Geopoint, GeopointSchemaType, GoogleMapsInputConfig, LatLng} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointSelect} from './GeopointSelect'\n\nconst EMPTY_PATH: Path = []\n\nconst getStaticImageUrl = (value: LatLng, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: '13',\n scale: '2',\n size: '640x300',\n })\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointInputProps = ObjectInputProps<Geopoint, GeopointSchemaType> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointInput(props: GeopointInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng) => {\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n ])\n },\n [schemaTypeName, onChange],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint type</a> needs a\n Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultZoom={config.defaultZoom}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import React, {type FC, useCallback, useEffect, useRef} from 'react'\nimport {SearchInput} from '../map/SearchInput'\nimport {GoogleMap} from '../map/Map'\nimport {Marker} from '../map/Marker'\nimport type {LatLng, GeopointRadius} from '../types'\n\nconst fallbackLatLng: LatLng = {lat: 40.7058254, lng: -74.1180863}\n\n// Component to sync marker drag with circle position\nconst MarkerDragSync: FC<{\n api: typeof window.google.maps\n marker: google.maps.Marker\n circleRef: React.MutableRefObject<google.maps.Circle | null>\n isMarkerDragging: React.MutableRefObject<boolean>\n}> = ({api, marker, circleRef, isMarkerDragging}) => {\n useEffect(() => {\n const handleDrag = () => {\n isMarkerDragging.current = true\n }\n\n const handleDragEnd = () => {\n isMarkerDragging.current = false\n }\n\n const dragListener = api.event.addListener(marker, 'drag', handleDrag)\n const dragEndListener = api.event.addListener(marker, 'dragend', handleDragEnd)\n\n return () => {\n api.event.removeListener(dragListener)\n api.event.removeListener(dragEndListener)\n }\n }, [api, marker, circleRef, isMarkerDragging])\n\n return null\n}\n\ninterface SelectProps {\n api: typeof window.google.maps\n value?: GeopointRadius\n onChange?: (latLng: google.maps.LatLng, radius?: number) => void\n defaultLocation?: LatLng\n defaultRadiusZoom?: number\n defaultRadius?: number\n}\n\nexport const GeopointRadiusSelect: FC<SelectProps> = ({\n api,\n value,\n onChange,\n defaultLocation = {lng: 10.74609, lat: 59.91273},\n defaultRadiusZoom = 12,\n defaultRadius = 1000,\n}) => {\n const circleRef = useRef<google.maps.Circle | null>(null)\n const markerRef = useRef<google.maps.Marker | undefined>(undefined)\n const isMarkerDragging = useRef(false)\n\n const getCenter = useCallback(() => {\n const point: LatLng = {...fallbackLatLng, ...defaultLocation, ...value}\n return point\n }, [value, defaultLocation])\n\n const setValue = useCallback(\n (geoPoint: google.maps.LatLng, radius?: number) => {\n if (onChange) {\n const roundedRadius = radius ? Math.round(radius) : undefined\n onChange(geoPoint, roundedRadius)\n }\n },\n [onChange],\n )\n\n const handlePlaceChanged = useCallback(\n (place: google.maps.places.PlaceResult) => {\n if (!place.geometry?.location) {\n return\n }\n setValue(place.geometry.location, value?.radius || defaultRadius)\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMarkerDragEnd = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n // Update circle position when marker drag ends\n if (circleRef.current) {\n circleRef.current.setCenter(event.latLng)\n }\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n const handleMapClick = useCallback(\n (event: google.maps.MapMouseEvent) => {\n if (event.latLng) {\n setValue(event.latLng, value?.radius || defaultRadius)\n }\n },\n [setValue, value?.radius, defaultRadius],\n )\n\n // Create or update circle when value changes\n useEffect(() => {\n if (value && circleRef.current) {\n circleRef.current.setCenter({lat: value.lat, lng: value.lng})\n circleRef.current.setRadius(value.radius)\n }\n }, [value])\n\n return (\n <GoogleMap\n api={api}\n location={getCenter()}\n onClick={handleMapClick}\n defaultZoom={defaultRadiusZoom}\n >\n {(map) => {\n // Create circle if it doesn't exist and we have a value\n if (value && !circleRef.current) {\n circleRef.current = new api.Circle({\n map,\n center: {lat: value.lat, lng: value.lng},\n radius: value.radius,\n fillColor: '#4285F4',\n fillOpacity: 0.2,\n strokeColor: '#4285F4',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n editable: true,\n })\n\n // Add event listeners for circle interactions\n circleRef.current.addListener('center_changed', () => {\n if (circleRef.current && markerRef.current && !isMarkerDragging.current) {\n // When circle center is dragged, move the marker to match\n const circleCenter = circleRef.current.getCenter()\n if (circleCenter) {\n markerRef.current.setPosition(circleCenter)\n }\n }\n })\n\n circleRef.current.addListener('radius_changed', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n\n circleRef.current.addListener('dragend', () => {\n if (circleRef.current) {\n const center = circleRef.current.getCenter()\n const radius = circleRef.current.getRadius()\n if (center) {\n setValue(center, Math.round(radius))\n }\n }\n })\n }\n\n return (\n <>\n <SearchInput api={api} map={map} onChange={handlePlaceChanged} />\n {value && (\n <Marker\n api={api}\n map={map}\n position={value}\n onMove={onChange ? handleMarkerDragEnd : undefined}\n markerRef={markerRef}\n />\n )}\n {/* Add drag event listener to marker for circle sync */}\n {value && markerRef.current && (\n <MarkerDragSync\n api={api}\n marker={markerRef.current}\n circleRef={circleRef}\n isMarkerDragging={isMarkerDragging}\n />\n )}\n </>\n )\n }}\n </GoogleMap>\n )\n}\n","import React, {useCallback, useEffect, useId, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Grid, Stack, TextInput, Label} from '@sanity/ui'\nimport {EditIcon, TrashIcon} from '@sanity/icons'\nimport {ObjectInputProps, set, setIfMissing, unset, ChangeIndicator, Path} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport type {\n GeopointRadius,\n GeopointRadiusSchemaType,\n GoogleMapsInputConfig,\n LatLng,\n} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {DialogInnerContainer, PreviewImage} from './GeopointInput.styles'\nimport {GeopointRadiusSelect} from './GeopointRadiusSelect'\n\nconst EMPTY_PATH: Path = []\n\n// Helper function to generate circle points\nconst generateCirclePoints = (\n lat: number,\n lng: number,\n radius: number,\n): Array<{lat: number; lng: number}> => {\n const points = []\n const steps = 32 // Number of points to create the circle\n\n for (let i = 0; i <= steps; i++) {\n const angle = (i / steps) * 2 * Math.PI\n const latOffset = (radius / 111000) * Math.cos(angle) // Rough conversion to degrees\n const lngOffset = (radius / (111000 * Math.cos((lat * Math.PI) / 180))) * Math.sin(angle)\n\n points.push({\n lat: lat + latOffset,\n lng: lng + lngOffset,\n })\n }\n\n return points\n}\n\nconst getStaticImageUrl = (value: LatLng & {radius?: number}, apiKey: string) => {\n const loc = `${value.lat},${value.lng}`\n\n // Calculate appropriate zoom level based on radius\n let zoom = 13\n if (value.radius) {\n // Use logarithmic formula for better zoom calculation\n // Add padding to ensure circle is fully visible\n const radius = value.radius + value.radius / 2\n const scale = radius / 500\n const calculatedZoom = 16 - Math.log(scale) / Math.log(2)\n // Add small offset to ensure circle fits well in view\n zoom = Math.max(8, Math.min(16, Math.round(calculatedZoom - 0.4)))\n }\n\n const qs = new URLSearchParams({\n key: apiKey,\n center: loc,\n markers: loc,\n zoom: zoom.toString(),\n scale: '2',\n size: '640x300',\n })\n\n // Add circle if radius is present\n if (value.radius) {\n // Create a circle path using multiple points\n const points = generateCirclePoints(value.lat, value.lng, value.radius)\n const path = points.map((p) => `${p.lat},${p.lng}`).join('|')\n qs.append('path', `fillcolor:0x4285F480|color:0x4285F4|weight:2|${path}`)\n }\n\n return `https://maps.googleapis.com/maps/api/staticmap?${qs.toString()}`\n}\n\nexport type GeopointRadiusInputProps = ObjectInputProps<\n GeopointRadius,\n GeopointRadiusSchemaType\n> & {\n geoConfig: GoogleMapsInputConfig\n}\n\nexport function GeopointRadiusInput(props: GeopointRadiusInputProps) {\n const {\n changed,\n elementProps,\n focused,\n geoConfig: config,\n onChange,\n onPathFocus,\n path,\n readOnly,\n schemaType,\n value,\n } = props\n\n const {\n id,\n ref: inputRef,\n onBlur: handleBlur,\n onFocus: handleFocus,\n 'aria-describedby': ariaDescribedBy,\n } = elementProps\n\n const schemaTypeName = schemaType.name\n const dialogId = useId()\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const handleFocusButton = useCallback(() => inputRef?.current?.focus(), [inputRef])\n const [modalOpen, setModalOpen] = useState(false)\n\n const handleCloseModal = useCallback(() => {\n if (dialogRef.current) dialogRef.current.blur()\n setModalOpen(false)\n handleFocusButton()\n }, [setModalOpen, handleFocusButton])\n\n const handleToggleModal = useCallback(\n () => setModalOpen((currentState) => !currentState),\n [setModalOpen],\n )\n\n const handleChange = useCallback(\n (latLng: google.maps.LatLng, radius?: number) => {\n const currentRadius = radius ?? value?.radius ?? config.defaultRadius ?? 1000\n onChange([\n setIfMissing({_type: schemaTypeName}),\n set(latLng.lat(), ['lat']),\n set(latLng.lng(), ['lng']),\n set(currentRadius, ['radius']),\n ])\n },\n [schemaTypeName, onChange, value?.radius, config.defaultRadius],\n )\n\n const handleRadiusChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (value) {\n onChange([set(Math.round(Number(event.currentTarget.value)), ['radius'])])\n }\n },\n [onChange, value],\n )\n\n const handleClear = useCallback(() => {\n onChange(unset())\n }, [onChange])\n\n useEffect(() => {\n if (modalOpen) {\n onPathFocus(EMPTY_PATH)\n }\n }, [modalOpen, onPathFocus])\n\n if (!config || !config.apiKey) {\n return (\n <div>\n <p>\n The <a href=\"https://sanity.io/docs/schema-types/geopoint-type\">Geopoint Radius type</a>{' '}\n needs a Google Maps API key with access to:\n </p>\n <ul>\n <li>Google Maps JavaScript API</li>\n <li>Google Places API Web Service</li>\n <li>Google Static Maps API</li>\n </ul>\n <p>\n Please enter the API key with access to these services in your googleMapsInput plugin\n config.\n </p>\n </div>\n )\n }\n\n return (\n <Stack space={3}>\n {value && (\n <ChangeIndicator path={path} isChanged={changed} hasFocus={!!focused}>\n <PreviewImage\n src={getStaticImageUrl(value, config.apiKey)}\n alt=\"Map location with radius\"\n onClick={handleFocusButton}\n onDoubleClick={handleToggleModal}\n />\n </ChangeIndicator>\n )}\n\n {value && (\n <Stack space={2}>\n <Label>Radius (meters)</Label>\n <TextInput\n type=\"number\"\n value={Math.round(value.radius || config.defaultRadius || 1000)}\n onChange={handleRadiusChange}\n disabled={readOnly}\n min={1}\n max={50000}\n step={1}\n />\n </Stack>\n )}\n\n <Box>\n <Grid columns={value ? 2 : 1} gap={3}>\n <Button\n aria-describedby={ariaDescribedBy}\n disabled={readOnly}\n icon={value && EditIcon}\n id={id}\n mode=\"ghost\"\n onClick={handleToggleModal}\n onFocus={handleFocus}\n padding={3}\n ref={inputRef}\n text={value ? 'Edit' : 'Set location and radius'}\n />\n\n {value && (\n <Button\n disabled={readOnly}\n icon={TrashIcon}\n mode=\"ghost\"\n onClick={handleClear}\n padding={3}\n text=\"Remove\"\n tone=\"critical\"\n />\n )}\n </Grid>\n </Box>\n\n {modalOpen && (\n <Dialog\n header=\"Place the marker and set radius on the map\"\n id={`${dialogId}_dialog`}\n onBlur={handleBlur}\n onClose={handleCloseModal}\n ref={dialogRef}\n width={1}\n >\n <DialogInnerContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => (\n <GeopointRadiusSelect\n api={api}\n value={value || undefined}\n onChange={readOnly ? undefined : handleChange}\n defaultLocation={config.defaultLocation}\n defaultRadiusZoom={config.defaultRadiusZoom}\n defaultRadius={config.defaultRadius}\n />\n )}\n </GoogleMapsLoadProxy>\n </DialogInnerContainer>\n </Dialog>\n )}\n </Stack>\n )\n}\n","import {type MutableRefObject, PureComponent} from 'react'\nimport type {LatLng} from '../types'\nimport {latLngAreEqual} from './util'\n\ninterface Props {\n api: typeof window.google.maps\n map: google.maps.Map\n from: LatLng\n to: LatLng\n color?: {background: string; border: string; text: string}\n zIndex?: number\n arrowRef?: MutableRefObject<google.maps.Polyline | undefined>\n onClick?: (event: google.maps.MapMouseEvent) => void\n}\n\nexport class Arrow extends PureComponent<Props> {\n line: google.maps.Polyline | undefined\n\n eventHandlers: {\n click?: google.maps.MapsEventListener\n } = {}\n\n componentDidMount() {\n const {from, to, api, map, zIndex, onClick, color, arrowRef} = this.props\n const lineSymbol = {\n path: api.SymbolPath.FORWARD_OPEN_ARROW,\n }\n\n this.line = new api.Polyline({\n map,\n zIndex,\n path: [from, to],\n icons: [{icon: lineSymbol, offset: '50%'}],\n strokeOpacity: 0.55,\n strokeColor: color ? color.text : 'black',\n })\n\n if (onClick) {\n this.eventHandlers.click = api.event.addListener(this.line, 'click', onClick)\n }\n\n if (arrowRef) {\n arrowRef.current = this.line\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (!this.line) {\n return\n }\n\n const {from, to, map} = this.props\n if (!latLngAreEqual(prevProps.from, from) || !latLngAreEqual(prevProps.to, to)) {\n this.line.setPath([from, to])\n }\n\n if (prevProps.map !== map) {\n this.line.setMap(map)\n }\n }\n\n componentWillUnmount() {\n if (this.line) {\n this.line.setMap(null)\n }\n\n if (this.eventHandlers.click) {\n this.eventHandlers.click.remove()\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n render(): any {\n return null\n }\n}\n","import {useRef} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {Geopoint} from '../types'\n\ninterface GeopointMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<Geopoint>\n label?: string\n}\n\nexport function GeopointMove({diff, api, map, label}: GeopointMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>(undefined)\n const toRef = useRef<google.maps.Marker>(undefined)\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {styled} from 'styled-components'\n\nexport const RootContainer = styled.div`\n position: relative;\n min-height: 200px;\n\n &:empty {\n background-color: var(--card-skeleton-color-from);\n display: table;\n width: 100%;\n }\n\n &:empty:after {\n content: 'Missing/invalid data';\n display: table-cell;\n vertical-align: middle;\n text-align: center;\n position: relative;\n }\n`\n","import type {\n ArrayDiff,\n Diff,\n DiffComponent,\n DiffProps as GenericDiffProps,\n ObjectDiff,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ArrayDiff<Geopoint>>\n\nexport const GeopointArrayDiff: DiffComponent<ArrayDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof google.maps}) {\n const fromValue = (diff.fromValue || []).filter(hasCoordinates)\n const toValue = (diff.toValue || []).filter(hasCoordinates)\n if (fromValue.length === 0 && toValue.length === 0) {\n return null\n }\n\n const bounds = getBounds(fromValue, toValue, api)\n return (\n <GoogleMap\n api={api}\n location={bounds.getCenter().toJSON()}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n >\n {(map) => (\n <>\n {diff.items.map(({toIndex, diff: pointDiff}) => {\n if (!isChangeDiff(pointDiff)) {\n return null\n }\n\n return (\n <GeopointMove\n key={toIndex}\n api={api}\n map={map}\n diff={pointDiff}\n label={`${toIndex}`}\n />\n )\n })}\n </>\n )}\n </GoogleMap>\n )\n}\n\nfunction isChangeDiff(diff: Diff): diff is ObjectDiff<Geopoint> {\n return diff.action !== 'unchanged' && diff.type === 'object'\n}\n\nfunction hasCoordinates(point: Partial<Geopoint>): point is Geopoint {\n return typeof point.lat === 'number' && typeof point.lng === 'number'\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral[] | null | undefined,\n toValue: google.maps.LatLngLiteral[] | null | undefined,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds()\n const points = [...(fromValue || []), ...(toValue || [])]\n points.forEach((point) => bounds.extend(point))\n return bounds\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {Geopoint} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointMove} from './GeopointMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<Geopoint>>\n\nexport const GeopointFieldDiff: DiffComponent<ObjectDiff<Geopoint>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral,\n toValue: google.maps.LatLngLiteral,\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n return new api.LatLngBounds().extend(fromValue).extend(toValue)\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<Geopoint>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return 'Moved'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {useRef, useEffect} from 'react'\nimport {useUserColor, type ObjectDiff} from 'sanity'\nimport {Marker} from '../map/Marker'\nimport {Arrow} from '../map/Arrow'\nimport type {GeopointRadius} from '../types'\n\ninterface GeopointRadiusMoveProps {\n api: typeof window.google.maps\n map: google.maps.Map\n diff: ObjectDiff<GeopointRadius>\n label?: string\n}\n\nexport function GeopointRadiusMove({diff, api, map, label}: GeopointRadiusMoveProps) {\n const {fromValue: from, toValue: to} = diff\n const annotation = diff.isChanged ? diff.annotation : undefined\n const userColor = useUserColor(annotation ? annotation.author : null) || undefined\n const fromRef = useRef<google.maps.Marker>(undefined)\n const toRef = useRef<google.maps.Marker>(undefined)\n const fromCircleRef = useRef<google.maps.Circle>(undefined)\n const toCircleRef = useRef<google.maps.Circle>(undefined)\n\n // Create circles for radius visualization\n useEffect(() => {\n const color = userColor?.background || '#4285F4'\n\n if (from && from.radius) {\n fromCircleRef.current = new api.Circle({\n map,\n center: {lat: from.lat, lng: from.lng},\n radius: from.radius,\n fillColor: color,\n fillOpacity: 0.1,\n strokeColor: color,\n strokeOpacity: 0.3,\n strokeWeight: 1,\n zIndex: 0,\n })\n }\n\n if (to && to.radius) {\n toCircleRef.current = new api.Circle({\n map,\n center: {lat: to.lat, lng: to.lng},\n radius: to.radius,\n fillColor: color,\n fillOpacity: 0.2,\n strokeColor: color,\n strokeOpacity: 0.8,\n strokeWeight: 2,\n zIndex: 2,\n })\n }\n\n return () => {\n if (fromCircleRef.current) {\n fromCircleRef.current.setMap(null)\n }\n if (toCircleRef.current) {\n toCircleRef.current.setMap(null)\n }\n }\n }, [api, map, from, to, userColor])\n\n return (\n <>\n {from && (\n <Marker\n api={api}\n map={map}\n position={from}\n zIndex={0}\n opacity={0.55}\n markerRef={fromRef}\n color={userColor}\n />\n )}\n {from && to && <Arrow api={api} map={map} from={from} to={to} zIndex={1} color={userColor} />}\n {to && (\n <Marker\n api={api}\n map={map}\n position={to}\n zIndex={2}\n markerRef={toRef}\n label={label}\n color={userColor}\n />\n )}\n </>\n )\n}\n","import {\n type DiffComponent,\n type ObjectDiff,\n type DiffProps as GenericDiffProps,\n DiffTooltip,\n getAnnotationAtPath,\n} from 'sanity'\nimport {GoogleMapsLoadProxy} from '../loader/GoogleMapsLoadProxy'\nimport {GoogleMap} from '../map/Map'\nimport type {GeopointRadius} from '../types'\nimport {getGeoConfig} from '../global-workaround'\nimport {GeopointRadiusMove} from './GeopointRadiusMove'\nimport {RootContainer} from './GeopointFieldDiff.styles'\n\nexport type DiffProps = GenericDiffProps<ObjectDiff<GeopointRadius>>\n\nexport const GeopointRadiusFieldDiff: DiffComponent<ObjectDiff<GeopointRadius>> = ({\n diff,\n schemaType,\n}: DiffProps) => {\n return (\n <RootContainer>\n <GoogleMapsLoadProxy config={getGeoConfig()}>\n {(api) => <GeopointRadiusDiff api={api} diff={diff} schemaType={schemaType} />}\n </GoogleMapsLoadProxy>\n </RootContainer>\n )\n}\n\nfunction GeopointRadiusDiff({api, diff}: DiffProps & {api: typeof window.google.maps}) {\n const {fromValue, toValue} = diff\n const annotation =\n getAnnotationAtPath(diff, ['lat']) ||\n getAnnotationAtPath(diff, ['lng']) ||\n getAnnotationAtPath(diff, ['radius']) ||\n getAnnotationAtPath(diff, [])\n\n const center = getCenter(diff, api)\n const bounds = fromValue && toValue ? getBounds(fromValue, toValue, api) : undefined\n\n return (\n <DiffTooltip annotations={annotation ? [annotation] : []} description={getAction(diff)}>\n <div>\n <GoogleMap\n api={api}\n location={center}\n mapTypeControl={false}\n controlSize={20}\n bounds={bounds}\n scrollWheel={false}\n >\n {(map) => <GeopointRadiusMove api={api} map={map} diff={diff} />}\n </GoogleMap>\n </div>\n </DiffTooltip>\n )\n}\n\nfunction getBounds(\n fromValue: google.maps.LatLngLiteral & {radius?: number},\n toValue: google.maps.LatLngLiteral & {radius?: number},\n api: typeof window.google.maps,\n): google.maps.LatLngBounds {\n const bounds = new api.LatLngBounds().extend(fromValue).extend(toValue)\n\n // Extend bounds to include radius circles\n const fromRadius = fromValue.radius || 0\n const toRadius = toValue.radius || 0\n const maxRadius = Math.max(fromRadius, toRadius)\n\n if (maxRadius > 0) {\n // Convert radius from meters to degrees (approximate)\n const radiusInDegrees = maxRadius / 111000 // Rough conversion\n bounds.extend({\n lat: fromValue.lat + radiusInDegrees,\n lng: fromValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: fromValue.lat - radiusInDegrees,\n lng: fromValue.lng - radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat + radiusInDegrees,\n lng: toValue.lng + radiusInDegrees,\n })\n bounds.extend({\n lat: toValue.lat - radiusInDegrees,\n lng: toValue.lng - radiusInDegrees,\n })\n }\n\n return bounds\n}\n\nfunction getCenter(\n diff: DiffProps['diff'],\n api: typeof window.google.maps,\n): google.maps.LatLngLiteral {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n return getBounds(fromValue, toValue, api).getCenter().toJSON()\n }\n\n if (fromValue) {\n return fromValue\n }\n\n if (toValue) {\n return toValue\n }\n\n throw new Error('Neither a from or a to value present')\n}\n\nfunction getAction(diff: ObjectDiff<GeopointRadius>) {\n const {fromValue, toValue} = diff\n if (fromValue && toValue) {\n const latChanged = fromValue.lat !== toValue.lat || fromValue.lng !== toValue.lng\n const radiusChanged = fromValue.radius !== toValue.radius\n\n if (latChanged && radiusChanged) {\n return 'Moved and radius changed'\n } else if (latChanged) {\n return 'Moved'\n } else if (radiusChanged) {\n return 'Radius changed'\n }\n return 'Unchanged'\n } else if (fromValue) {\n return 'Removed'\n } else if (toValue) {\n return 'Added'\n }\n\n return 'Unchanged'\n}\n","import {definePlugin, type SchemaType} from 'sanity'\nimport {GeopointInput, type GeopointInputProps} from './input/GeopointInput'\nimport {GeopointRadiusInput, type GeopointRadiusInputProps} from './input/GeopointRadiusInput'\nimport {setGeoConfig} from './global-workaround'\nimport type {GeopointSchemaType, GeopointRadiusSchemaType, GoogleMapsInputConfig} from './types'\n\nexport const googleMapsInput = definePlugin<GoogleMapsInputConfig>((config) => {\n setGeoConfig(config)\n return {\n name: 'google-maps-input',\n schema: {\n types: [\n {\n name: 'geopointRadius',\n title: 'Geopoint with Radius',\n type: 'object',\n fields: [\n {\n name: 'lat',\n title: 'Latitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-90).max(90),\n },\n {\n name: 'lng',\n title: 'Longitude',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(-180).max(180),\n },\n {\n name: 'alt',\n title: 'Altitude',\n type: 'number',\n },\n {\n name: 'radius',\n title: 'Radius (meters)',\n type: 'number',\n validation: (Rule: any) => Rule.required().min(1).max(50000),\n },\n ],\n preview: {\n select: {\n lat: 'lat',\n lng: 'lng',\n radius: 'radius',\n },\n prepare({lat, lng, radius}: {lat: number; lng: number; radius: number}) {\n return {\n title: `${lat.toFixed(6)}, ${lng.toFixed(6)}`,\n subtitle: radius ? `Radius: ${radius}m` : 'No radius set',\n }\n },\n },\n },\n ],\n },\n form: {\n components: {\n input(props) {\n if (isGeopoint(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointInputProps, 'geoConfig'>\n return <GeopointInput {...castedProps} geoConfig={config} />\n }\n if (isGeopointRadius(props.schemaType)) {\n const castedProps = props as unknown as Omit<GeopointRadiusInputProps, 'geoConfig'>\n return <GeopointRadiusInput {...castedProps} geoConfig={config} />\n }\n return props.renderDefault(props)\n },\n },\n },\n }\n})\n\nfunction isGeopoint(schemaType: SchemaType): schemaType is GeopointSchemaType {\n return isType('geopoint', schemaType)\n}\n\nfunction isGeopointRadius(schemaType: SchemaType): schemaType is GeopointRadiusSchemaType {\n return isType('geopointRadius', schemaType)\n}\n\nfunction isType(name: string, schema?: SchemaType): boolean {\n if (schema?.name === name) {\n return true\n // eslint-disable-next-line no-negated-condition\n } else if (!schema?.name) {\n return false\n }\n return isType(name, schema?.type)\n}\n"],"names":["config","AuthError","LoadErrorView","fallbackLatLng","getCenter","EMPTY_PATH","getStaticImageUrl","GeopointDiff","getBounds","getAction"],"mappings":";;;;;;AAQA,MAAM,eAAe,mCACf,0BAA0B;kBAEzB,cAAwB,MAAM;AAAC;AAEtC,SAAS,mBAAmBA,SAA0C;AACpE,SAAO,IAAI,QAAmC,CAAC,SAAS,WAAW;AACjE,WAAO,uBAAuB,IAAI,MAAM;AACtC,aAAO,IAAIC,YAAU,oDAAoD,CAAC;AAAA,IAC5E,GAEA,OAAO,YAAY,IAAI,MAAM;AAC3B,cAAQ,OAAO,OAAO,IAAI;AAAA,IAC5B;AAEA,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,UAAU,CACf,OACA,QACA,QACA,OACA,UACG,OAAO,IAAI,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,GAEjD,OAAO,MAAM,+CAA+CD,QAAO,MAAM,8BAA8B,YAAY,aAAaA,QAAO,MAAM,IAC7I,SAAS,qBAAqB,MAAM,EAAE,CAAC,EAAE,YAAY,MAAM;AAAA,EAC7D,CAAC,EAAE,QAAQ,MAAM;AACf,WAAO,OAAO,YAAY,GAC1B,OAAO,OAAO,uBAAuB;AAAA,EACvC,CAAC;AACH;AAEA,IAAI,OAAkD;AAC/C,SAAS,kBAAkBA,SAGK;AACrC,SAAI,SAGJ,OAAO,mBAAmBA,OAAM,GAChC,KAAK,MAAM,MAAM;AACf,WAAO;AAAA,EACT,CAAC,GACM;AACT;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,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC;AAAA,cAC3C,UAAU,SAAS,WAAW,MAAM,MAAM;AAAA,YAAA;AAAA,UAE9C;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEF,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,MAAM,OAAO;AACX,eAAI,WAAW,MAAM,UAAU,IAEtB,oBAAC,iBAAe,GADH,OACmB,WAAWA,QAAA,CAAQ,IAExD,iBAAiB,MAAM,UAAU,IAE5B,oBAAC,qBAAA,EAAqB,GADT,OACyB,WAAWA,SAAQ,IAE3D,MAAM,cAAc,KAAK;AAAA,MAClC;AAAA,IAAA;AAAA,EACF;AAEJ,EACD;AAED,SAAS,WAAW,YAA0D;AAC5E,SAAO,OAAO,YAAY,UAAU;AACtC;AAEA,SAAS,iBAAiB,YAAgE;AACxF,SAAO,OAAO,kBAAkB,UAAU;AAC5C;AAEA,SAAS,OAAO,MAAc,QAA8B;AAC1D,SAAI,QAAQ,SAAS,OACZ,KAEG,QAAQ,OAGb,OAAO,MAAM,QAAQ,IAAI,IAFvB;AAGX;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/google-maps-input",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Sanity plugin providing input handlers for geo-related input types using Google Maps",
5
5
  "keywords": [
6
6
  "sanity",
@@ -66,7 +66,7 @@
66
66
  "@sanity/plugin-kit": "^4.0.18",
67
67
  "@sanity/semantic-release-preset": "^5.0.0",
68
68
  "@types/google.maps": "^3.58.1",
69
- "@types/react": "^18.3.17",
69
+ "@types/react": "^19.2.3",
70
70
  "@typescript-eslint/eslint-plugin": "^6.21.0",
71
71
  "@typescript-eslint/parser": "^6.21.0",
72
72
  "eslint": "^8.57.1",
@@ -79,17 +79,17 @@
79
79
  "lint-staged": "^15.2.11",
80
80
  "prettier": "^3.4.2",
81
81
  "prettier-plugin-packagejson": "^2.5.6",
82
- "react": "^18.3.1",
83
- "react-dom": "^18.3.1",
82
+ "react": "^19.2.3",
83
+ "react-dom": "^19.2.3",
84
84
  "rimraf": "^6.0.1",
85
- "sanity": "^3.67.1",
85
+ "sanity": "^5.0.1",
86
86
  "semantic-release": "^24.2.0",
87
87
  "styled-components": "^6.1.13",
88
88
  "typescript": "^5.7.2"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^18 || ^19",
92
- "sanity": "^3.19.0 || ^4.0.0-0",
92
+ "sanity": "^3.19.0 || ^4.0.0-0 || ^5.0.0",
93
93
  "styled-components": "^6.1"
94
94
  },
95
95
  "engines": {
@@ -15,8 +15,8 @@ export function GeopointMove({diff, api, map, label}: GeopointMoveProps) {
15
15
  const {fromValue: from, toValue: to} = diff
16
16
  const annotation = diff.isChanged ? diff.annotation : undefined
17
17
  const userColor = useUserColor(annotation ? annotation.author : null) || undefined
18
- const fromRef = useRef<google.maps.Marker>()
19
- const toRef = useRef<google.maps.Marker>()
18
+ const fromRef = useRef<google.maps.Marker>(undefined)
19
+ const toRef = useRef<google.maps.Marker>(undefined)
20
20
 
21
21
  return (
22
22
  <>
@@ -15,10 +15,10 @@ export function GeopointRadiusMove({diff, api, map, label}: GeopointRadiusMovePr
15
15
  const {fromValue: from, toValue: to} = diff
16
16
  const annotation = diff.isChanged ? diff.annotation : undefined
17
17
  const userColor = useUserColor(annotation ? annotation.author : null) || undefined
18
- const fromRef = useRef<google.maps.Marker>()
19
- const toRef = useRef<google.maps.Marker>()
20
- const fromCircleRef = useRef<google.maps.Circle>()
21
- const toCircleRef = useRef<google.maps.Circle>()
18
+ const fromRef = useRef<google.maps.Marker>(undefined)
19
+ const toRef = useRef<google.maps.Marker>(undefined)
20
+ const fromCircleRef = useRef<google.maps.Circle>(undefined)
21
+ const toCircleRef = useRef<google.maps.Circle>(undefined)
22
22
 
23
23
  // Create circles for radius visualization
24
24
  useEffect(() => {
@@ -52,7 +52,7 @@ export const GeopointRadiusSelect: FC<SelectProps> = ({
52
52
  defaultRadius = 1000,
53
53
  }) => {
54
54
  const circleRef = useRef<google.maps.Circle | null>(null)
55
- const markerRef = useRef<google.maps.Marker | undefined>()
55
+ const markerRef = useRef<google.maps.Marker | undefined>(undefined)
56
56
  const isMarkerDragging = useRef(false)
57
57
 
58
58
  const getCenter = useCallback(() => {