@sanity/google-maps-input 2.26.0 → 2.26.1-purple-unicorn.560

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.
Files changed (115) hide show
  1. package/diff/resolver.js +7 -0
  2. package/input/GeopointInput.js +7 -0
  3. package/lib/_Marker-20984c4d.cjs +331 -0
  4. package/lib/_Marker-20984c4d.cjs.map +1 -0
  5. package/lib/_Marker-96f5387c.js +302 -0
  6. package/lib/_Marker-96f5387c.js.map +1 -0
  7. package/lib/_reExport.js +19 -0
  8. package/lib/diff/resolver.cjs +204 -0
  9. package/lib/diff/resolver.cjs.map +1 -0
  10. package/lib/diff/resolver.js +169 -17
  11. package/lib/diff/resolver.js.map +1 -0
  12. package/{dist/dts → lib/dts/src}/diff/GeopointArrayDiff.d.ts +4 -4
  13. package/lib/dts/src/diff/GeopointArrayDiff.d.ts.map +1 -0
  14. package/{dist/dts → lib/dts/src}/diff/GeopointFieldDiff.d.ts +4 -4
  15. package/lib/dts/src/diff/GeopointFieldDiff.d.ts.map +1 -0
  16. package/{dist/dts → lib/dts/src}/diff/GeopointFieldDiff.styles.d.ts +1 -1
  17. package/lib/dts/src/diff/GeopointFieldDiff.styles.d.ts.map +1 -0
  18. package/{dist/dts → lib/dts/src}/diff/GeopointMove.d.ts +12 -12
  19. package/lib/dts/src/diff/GeopointMove.d.ts.map +1 -0
  20. package/lib/dts/src/diff/resolver.d.ts +4 -0
  21. package/lib/dts/src/diff/resolver.d.ts.map +1 -0
  22. package/{dist/dts → lib/dts/src}/input/GeopointInput.d.ts +27 -39
  23. package/lib/dts/src/input/GeopointInput.d.ts.map +1 -0
  24. package/{dist/dts → lib/dts/src}/input/GeopointInput.styles.d.ts +2 -2
  25. package/lib/dts/src/input/GeopointInput.styles.d.ts.map +1 -0
  26. package/{dist/dts → lib/dts/src}/input/GeopointSelect.d.ts +27 -27
  27. package/lib/dts/src/input/GeopointSelect.d.ts.map +1 -0
  28. package/{dist/dts → lib/dts/src}/loader/GoogleMapsLoadProxy.d.ts +13 -13
  29. package/lib/dts/src/loader/GoogleMapsLoadProxy.d.ts.map +1 -0
  30. package/{dist/dts → lib/dts/src}/loader/LoadError.d.ts +9 -9
  31. package/lib/dts/src/loader/LoadError.d.ts.map +1 -0
  32. package/{dist/dts → lib/dts/src}/loader/loadGoogleMapsApi.d.ts +17 -17
  33. package/lib/dts/src/loader/loadGoogleMapsApi.d.ts.map +1 -0
  34. package/{dist/dts → lib/dts/src}/map/Arrow.d.ts +28 -28
  35. package/lib/dts/src/map/Arrow.d.ts.map +1 -0
  36. package/{dist/dts → lib/dts/src}/map/Map.d.ts +36 -36
  37. package/lib/dts/src/map/Map.d.ts.map +1 -0
  38. package/{dist/dts → lib/dts/src}/map/Map.styles.d.ts +1 -1
  39. package/lib/dts/src/map/Map.styles.d.ts.map +1 -0
  40. package/{dist/dts → lib/dts/src}/map/Marker.d.ts +33 -35
  41. package/lib/dts/src/map/Marker.d.ts.map +1 -0
  42. package/{dist/dts → lib/dts/src}/map/SearchInput.d.ts +15 -15
  43. package/lib/dts/src/map/SearchInput.d.ts.map +1 -0
  44. package/{dist/dts → lib/dts/src}/map/SearchInput.styles.d.ts +1 -1
  45. package/lib/dts/src/map/SearchInput.styles.d.ts.map +1 -0
  46. package/{dist/dts → lib/dts/src}/map/util.d.ts +3 -3
  47. package/lib/dts/src/map/util.d.ts.map +1 -0
  48. package/lib/dts/src/types.d.ts +17 -0
  49. package/lib/dts/src/types.d.ts.map +1 -0
  50. package/lib/input/GeopointInput.cjs +228 -0
  51. package/lib/input/GeopointInput.cjs.map +1 -0
  52. package/lib/input/GeopointInput.js +198 -190
  53. package/lib/input/GeopointInput.js.map +1 -0
  54. package/package.json +34 -11
  55. package/src/@types/css.d.ts +4 -0
  56. package/src/diff/GeopointArrayDiff.tsx +83 -0
  57. package/src/diff/GeopointFieldDiff.styles.tsx +20 -0
  58. package/src/diff/GeopointFieldDiff.tsx +94 -0
  59. package/src/diff/GeopointMove.tsx +49 -0
  60. package/src/diff/resolver.ts +21 -0
  61. package/src/input/GeopointInput.styles.tsx +12 -0
  62. package/src/input/GeopointInput.tsx +221 -0
  63. package/src/input/GeopointSelect.tsx +78 -0
  64. package/src/loader/GoogleMapsLoadProxy.tsx +49 -0
  65. package/src/loader/LoadError.tsx +44 -0
  66. package/src/loader/loadGoogleMapsApi.ts +93 -0
  67. package/src/map/Arrow.tsx +76 -0
  68. package/src/map/Map.styles.tsx +10 -0
  69. package/src/map/Map.tsx +125 -0
  70. package/src/map/Marker.tsx +130 -0
  71. package/src/map/SearchInput.styles.tsx +8 -0
  72. package/src/map/SearchInput.tsx +56 -0
  73. package/src/map/util.ts +14 -0
  74. package/src/types.ts +19 -0
  75. package/.depcheckignore.json +0 -3
  76. package/dist/dts/diff/GeopointArrayDiff.d.ts.map +0 -1
  77. package/dist/dts/diff/GeopointFieldDiff.d.ts.map +0 -1
  78. package/dist/dts/diff/GeopointFieldDiff.styles.d.ts.map +0 -1
  79. package/dist/dts/diff/GeopointMove.d.ts.map +0 -1
  80. package/dist/dts/diff/resolver.d.ts +0 -4
  81. package/dist/dts/diff/resolver.d.ts.map +0 -1
  82. package/dist/dts/input/GeopointInput.d.ts.map +0 -1
  83. package/dist/dts/input/GeopointInput.styles.d.ts.map +0 -1
  84. package/dist/dts/input/GeopointSelect.d.ts.map +0 -1
  85. package/dist/dts/loader/GoogleMapsLoadProxy.d.ts.map +0 -1
  86. package/dist/dts/loader/LoadError.d.ts.map +0 -1
  87. package/dist/dts/loader/loadGoogleMapsApi.d.ts.map +0 -1
  88. package/dist/dts/map/Arrow.d.ts.map +0 -1
  89. package/dist/dts/map/Map.d.ts.map +0 -1
  90. package/dist/dts/map/Map.styles.d.ts.map +0 -1
  91. package/dist/dts/map/Marker.d.ts.map +0 -1
  92. package/dist/dts/map/SearchInput.d.ts.map +0 -1
  93. package/dist/dts/map/SearchInput.styles.d.ts.map +0 -1
  94. package/dist/dts/map/util.d.ts.map +0 -1
  95. package/dist/dts/types.d.ts +0 -14
  96. package/dist/dts/types.d.ts.map +0 -1
  97. package/lib/@types/css.d.js +0 -1
  98. package/lib/diff/GeopointArrayDiff.js +0 -82
  99. package/lib/diff/GeopointFieldDiff.js +0 -97
  100. package/lib/diff/GeopointFieldDiff.styles.js +0 -18
  101. package/lib/diff/GeopointMove.js +0 -55
  102. package/lib/input/GeopointInput.styles.js +0 -22
  103. package/lib/input/GeopointSelect.js +0 -103
  104. package/lib/loader/GoogleMapsLoadProxy.js +0 -70
  105. package/lib/loader/LoadError.js +0 -43
  106. package/lib/loader/loadGoogleMapsApi.js +0 -81
  107. package/lib/map/Arrow.js +0 -97
  108. package/lib/map/Map.js +0 -147
  109. package/lib/map/Map.styles.js +0 -18
  110. package/lib/map/Marker.js +0 -156
  111. package/lib/map/SearchInput.js +0 -77
  112. package/lib/map/SearchInput.styles.js +0 -18
  113. package/lib/map/util.js +0 -14
  114. package/lib/types.js +0 -5
  115. package/tsconfig.json +0 -20
@@ -0,0 +1,76 @@
1
+ import * as React from 'react'
2
+ import {LatLng} from '../types'
3
+ import {latLngAreEqual} from './util'
4
+
5
+ interface Props {
6
+ api: typeof window.google.maps
7
+ map: google.maps.Map
8
+ from: LatLng
9
+ to: LatLng
10
+ color?: {background: string; border: string; text: string}
11
+ zIndex?: number
12
+ arrowRef?: React.MutableRefObject<google.maps.Polyline | undefined>
13
+ onClick?: (event: google.maps.MapMouseEvent) => void
14
+ }
15
+
16
+ export class Arrow extends React.PureComponent<Props> {
17
+ line: google.maps.Polyline | undefined
18
+
19
+ eventHandlers: {
20
+ click?: google.maps.MapsEventListener
21
+ } = {}
22
+
23
+ componentDidMount() {
24
+ const {from, to, api, map, zIndex, onClick, color, arrowRef} = this.props
25
+ const lineSymbol = {
26
+ path: api.SymbolPath.FORWARD_OPEN_ARROW,
27
+ }
28
+
29
+ this.line = new api.Polyline({
30
+ map,
31
+ zIndex,
32
+ path: [from, to],
33
+ icons: [{icon: lineSymbol, offset: '50%'}],
34
+ strokeOpacity: 0.55,
35
+ strokeColor: color ? color.text : 'black',
36
+ })
37
+
38
+ if (onClick) {
39
+ this.eventHandlers.click = api.event.addListener(this.line, 'click', onClick)
40
+ }
41
+
42
+ if (arrowRef) {
43
+ arrowRef.current = this.line
44
+ }
45
+ }
46
+
47
+ componentDidUpdate(prevProps: Props) {
48
+ if (!this.line) {
49
+ return
50
+ }
51
+
52
+ const {from, to, map} = this.props
53
+ if (!latLngAreEqual(prevProps.from, from) || !latLngAreEqual(prevProps.to, to)) {
54
+ this.line.setPath([from, to])
55
+ }
56
+
57
+ if (prevProps.map !== map) {
58
+ this.line.setMap(map)
59
+ }
60
+ }
61
+
62
+ componentWillUnmount() {
63
+ if (this.line) {
64
+ this.line.setMap(null)
65
+ }
66
+
67
+ if (this.eventHandlers.click) {
68
+ this.eventHandlers.click.remove()
69
+ }
70
+ }
71
+
72
+ // eslint-disable-next-line class-methods-use-this
73
+ render() {
74
+ return null
75
+ }
76
+ }
@@ -0,0 +1,10 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const MapContainer = styled.div`
4
+ position: absolute;
5
+ top: 0;
6
+ left: 0;
7
+ height: 100%;
8
+ width: 100%;
9
+ box-sizing: border-box;
10
+ `
@@ -0,0 +1,125 @@
1
+ import React from 'react'
2
+ import {LatLng} from '../types'
3
+ import {latLngAreEqual} from './util'
4
+ import {MapContainer} from './Map.styles'
5
+
6
+ interface MapProps {
7
+ api: typeof window.google.maps
8
+ location: LatLng
9
+ bounds?: google.maps.LatLngBounds
10
+ defaultZoom?: number
11
+ mapTypeControl?: boolean
12
+ scrollWheel?: boolean
13
+ controlSize?: number
14
+ onClick?: (event: google.maps.MapMouseEvent) => void
15
+ children?: (map: google.maps.Map) => React.ReactElement
16
+ }
17
+
18
+ interface MapState {
19
+ map: google.maps.Map | undefined
20
+ }
21
+
22
+ export class GoogleMap extends React.PureComponent<MapProps, MapState> {
23
+ static defaultProps = {
24
+ defaultZoom: 8,
25
+ scrollWheel: true,
26
+ }
27
+
28
+ state: MapState = {map: undefined}
29
+ clickHandler: google.maps.MapsEventListener | undefined
30
+ mapRef = React.createRef<HTMLDivElement>()
31
+ mapEl: HTMLDivElement | null = null
32
+
33
+ componentDidMount() {
34
+ this.attachClickHandler()
35
+ }
36
+
37
+ attachClickHandler = () => {
38
+ const map = this.state.map
39
+ if (!map) {
40
+ return
41
+ }
42
+
43
+ const {api, onClick} = this.props
44
+ const {event} = api
45
+
46
+ if (this.clickHandler) {
47
+ this.clickHandler.remove()
48
+ }
49
+
50
+ if (onClick) {
51
+ this.clickHandler = event.addListener(map, 'click', onClick)
52
+ }
53
+ }
54
+
55
+ componentDidUpdate(prevProps: MapProps) {
56
+ const map = this.state.map
57
+ if (!map) {
58
+ return
59
+ }
60
+
61
+ const {onClick, location, bounds} = this.props
62
+
63
+ if (prevProps.onClick !== onClick) {
64
+ this.attachClickHandler()
65
+ }
66
+
67
+ if (!latLngAreEqual(prevProps.location, location)) {
68
+ map.panTo(this.getCenter())
69
+ }
70
+
71
+ if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) {
72
+ map.fitBounds(bounds)
73
+ }
74
+ }
75
+
76
+ componentWillUnmount() {
77
+ if (this.clickHandler) {
78
+ this.clickHandler.remove()
79
+ }
80
+ }
81
+
82
+ getCenter(): google.maps.LatLng {
83
+ const {location, api} = this.props
84
+ return new api.LatLng(location.lat, location.lng)
85
+ }
86
+
87
+ constructMap(el: HTMLDivElement) {
88
+ const {defaultZoom, api, mapTypeControl, controlSize, bounds, scrollWheel} = this.props
89
+
90
+ const map = new api.Map(el, {
91
+ zoom: defaultZoom,
92
+ center: this.getCenter(),
93
+ scrollwheel: scrollWheel,
94
+ streetViewControl: false,
95
+ mapTypeControl,
96
+ controlSize,
97
+ })
98
+
99
+ if (bounds) {
100
+ map.fitBounds(bounds)
101
+ }
102
+
103
+ return map
104
+ }
105
+
106
+ setMapElement = (element: HTMLDivElement | null) => {
107
+ if (element && element !== this.mapEl) {
108
+ const map = this.constructMap(element)
109
+ this.setState({map}, this.attachClickHandler)
110
+ }
111
+
112
+ this.mapEl = element
113
+ }
114
+
115
+ render() {
116
+ const {children} = this.props
117
+ const {map} = this.state
118
+ return (
119
+ <>
120
+ <MapContainer ref={this.setMapElement} />
121
+ {children && map ? children(map) : null}
122
+ </>
123
+ )
124
+ }
125
+ }
@@ -0,0 +1,130 @@
1
+ import * as React from 'react'
2
+ import {LatLng} from '../types'
3
+ import {latLngAreEqual} from './util'
4
+
5
+ const markerPath =
6
+ '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'
7
+
8
+ interface Props {
9
+ api: typeof window.google.maps
10
+ map: google.maps.Map
11
+ onMove?: (event: google.maps.MapMouseEvent) => void
12
+ onClick?: (event: google.maps.MapMouseEvent) => void
13
+ position: LatLng | google.maps.LatLng
14
+ zIndex?: number
15
+ opacity?: number
16
+ label?: string
17
+ markerRef?: React.MutableRefObject<google.maps.Marker | undefined>
18
+ color?: {background: string; border: string; text: string}
19
+ }
20
+
21
+ export class Marker extends React.PureComponent<Props> {
22
+ marker: google.maps.Marker | undefined
23
+
24
+ eventHandlers: {
25
+ move?: google.maps.MapsEventListener
26
+ click?: google.maps.MapsEventListener
27
+ } = {}
28
+
29
+ componentDidMount() {
30
+ const {position, api, map, onMove, zIndex, opacity, label, markerRef, color} = this.props
31
+ const {Marker: GMarker} = api
32
+
33
+ let icon: google.maps.ReadonlySymbol | undefined
34
+ if (color) {
35
+ icon = {
36
+ path: markerPath,
37
+ fillOpacity: 1,
38
+ fillColor: color.background,
39
+ strokeColor: color.border,
40
+ strokeWeight: 2,
41
+ anchor: new api.Point(10, 35),
42
+ labelOrigin: new api.Point(10, 11),
43
+ }
44
+ }
45
+
46
+ this.marker = new GMarker({
47
+ draggable: Boolean(onMove),
48
+ position,
49
+ map,
50
+ zIndex,
51
+ opacity,
52
+ label,
53
+ icon,
54
+ })
55
+
56
+ if (markerRef) {
57
+ markerRef.current = this.marker
58
+ }
59
+
60
+ this.attachMoveHandler()
61
+ this.attachClickHandler()
62
+ }
63
+
64
+ componentDidUpdate(prevProps: Props) {
65
+ if (!this.marker) {
66
+ return
67
+ }
68
+
69
+ const {position, onMove, label, zIndex, opacity, map} = this.props
70
+
71
+ if (prevProps.onMove !== onMove) {
72
+ this.attachMoveHandler()
73
+ }
74
+
75
+ if (!latLngAreEqual(prevProps.position, position)) {
76
+ this.marker.setPosition(position)
77
+ }
78
+
79
+ if (prevProps.label !== label) {
80
+ this.marker.setLabel(label || null)
81
+ }
82
+
83
+ if (prevProps.zIndex !== zIndex) {
84
+ this.marker.setZIndex(zIndex || null)
85
+ }
86
+
87
+ if (prevProps.opacity !== opacity) {
88
+ this.marker.setOpacity(opacity || null)
89
+ }
90
+
91
+ if (prevProps.map !== map) {
92
+ this.marker.setMap(map)
93
+ }
94
+ }
95
+
96
+ componentWillUnmount() {
97
+ if (this.eventHandlers.move) {
98
+ this.eventHandlers.move.remove()
99
+ }
100
+
101
+ if (this.marker) {
102
+ this.marker.setMap(null)
103
+ }
104
+ }
105
+
106
+ attachMoveHandler() {
107
+ const {api, onMove} = this.props
108
+ if (this.eventHandlers.move) {
109
+ this.eventHandlers.move.remove()
110
+ }
111
+ if (this.marker && onMove) {
112
+ this.eventHandlers.move = api.event.addListener(this.marker, 'dragend', onMove)
113
+ }
114
+ }
115
+
116
+ attachClickHandler() {
117
+ const {api, onClick} = this.props
118
+ if (this.eventHandlers.click) {
119
+ this.eventHandlers.click.remove()
120
+ }
121
+ if (this.marker && onClick) {
122
+ this.eventHandlers.click = api.event.addListener(this.marker, 'click', onClick)
123
+ }
124
+ }
125
+
126
+ // eslint-disable-next-line class-methods-use-this
127
+ render() {
128
+ return null
129
+ }
130
+ }
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const WrapperContainer = styled.div`
4
+ position: absolute;
5
+ right: 10px;
6
+ top: 10px;
7
+ width: 220px;
8
+ `
@@ -0,0 +1,56 @@
1
+ import * as React from 'react'
2
+ import {TextInput} from '@sanity/ui'
3
+ import {WrapperContainer} from './SearchInput.styles'
4
+
5
+ interface Props {
6
+ api: typeof window.google.maps
7
+ map: google.maps.Map
8
+ onChange: (result: google.maps.places.PlaceResult) => void
9
+ }
10
+
11
+ export class SearchInput extends React.PureComponent<Props> {
12
+ searchInputRef = React.createRef<HTMLInputElement>()
13
+ autoComplete: google.maps.places.Autocomplete | undefined
14
+
15
+ handleChange = () => {
16
+ if (!this.autoComplete) {
17
+ return
18
+ }
19
+
20
+ this.props.onChange(this.autoComplete.getPlace())
21
+
22
+ if (this.searchInputRef.current) {
23
+ this.searchInputRef.current.value = ''
24
+ }
25
+ }
26
+
27
+ componentDidMount() {
28
+ const input = this.searchInputRef.current
29
+ if (!input) {
30
+ return
31
+ }
32
+
33
+ const {api, map} = this.props
34
+ const {Circle, places, event} = api
35
+ const searchBounds = new Circle({center: map.getCenter(), radius: 100}).getBounds()
36
+ this.autoComplete = new places.Autocomplete(input, {
37
+ bounds: searchBounds,
38
+ types: [], // return all kinds of places
39
+ })
40
+
41
+ event.addListener(this.autoComplete, 'place_changed', this.handleChange)
42
+ }
43
+
44
+ render() {
45
+ return (
46
+ <WrapperContainer>
47
+ <TextInput
48
+ name="place"
49
+ ref={this.searchInputRef}
50
+ placeholder="Search for place or address"
51
+ padding={4}
52
+ />
53
+ </WrapperContainer>
54
+ )
55
+ }
56
+ }
@@ -0,0 +1,14 @@
1
+ import {LatLng} from '../types'
2
+
3
+ export function latLngAreEqual(
4
+ latLng1: LatLng | google.maps.LatLng,
5
+ latLng2: LatLng | google.maps.LatLng
6
+ ) {
7
+ const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat
8
+ const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng
9
+
10
+ const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat
11
+ const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng
12
+
13
+ return lat1 === lat2 && lng1 === lng2
14
+ }
package/src/types.ts ADDED
@@ -0,0 +1,19 @@
1
+ import {DiffComponent, DiffComponentOptions, ObjectDiff} from '@sanity/base/field'
2
+ import {ObjectSchemaType} from '@sanity/types'
3
+
4
+ export interface LatLng {
5
+ lat: number
6
+ lng: number
7
+ }
8
+
9
+ export interface Geopoint {
10
+ _type: 'geopoint'
11
+ _key?: string
12
+ lat: number
13
+ lng: number
14
+ alt?: number
15
+ }
16
+
17
+ export interface GeopointSchemaType extends ObjectSchemaType {
18
+ diffComponent?: DiffComponent<ObjectDiff<Geopoint>> | DiffComponentOptions<ObjectDiff<Geopoint>>
19
+ }
@@ -1,3 +0,0 @@
1
- {
2
- "ignore": ["@types/googlemaps"]
3
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointArrayDiff.d.ts","sourceRoot":"","sources":["../../../src/diff/GeopointArrayDiff.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAGT,SAAS,IAAI,gBAAgB,EAC7B,aAAa,EACd,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AAIjC,oBAAY,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE7D,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,CAQhE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointFieldDiff.d.ts","sourceRoot":"","sources":["../../../src/diff/GeopointFieldDiff.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,IAAI,gBAAgB,EAG9B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AAIjC,oBAAY,SAAS,GAAG,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE9D,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAQjE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointFieldDiff.styles.d.ts","sourceRoot":"","sources":["../../../src/diff/GeopointFieldDiff.styles.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,oEAiBzB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointMove.d.ts","sourceRoot":"","sources":["../../../src/diff/GeopointMove.tsx"],"names":[],"mappings":";;AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAG7C,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AAEjC,UAAU,KAAK;IACb,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA;IAC9B,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;IACpB,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,YAAY,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAC,EAAE,KAAK,eAkC1D"}
@@ -1,4 +0,0 @@
1
- import { DiffComponentResolver } from '@sanity/field/diff';
2
- declare const diffResolver: DiffComponentResolver;
3
- export default diffResolver;
4
- //# sourceMappingURL=resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/diff/resolver.ts"],"names":[],"mappings":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,aAET;IAED,iBAAiB,aAYhB;IAED,gBAAgB,aAEf;IAED,YAAY,WAAY,OAAO,IAAI,CAAC,MAAM,UAWzC;IAED,WAAW,aAGV;IAED,MAAM;CAkGP;AAED,eAAe,aAAa,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointInput.styles.d.ts","sourceRoot":"","sources":["../../../src/input/GeopointInput.styles.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,oEAIxB,CAAA;AAED,eAAO,MAAM,oBAAoB,oEAGhC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GeopointSelect.d.ts","sourceRoot":"","sources":["../../../src/input/GeopointSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AAIzC,UAAU,WAAW;IACnB,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA;IAC9B,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAA;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,cAAe,SAAQ,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;IAClE,MAAM,CAAC,YAAY;;;;;;MAGlB;IAED,MAAM,kCAAoC;IAE1C,SAAS;IAMT,kBAAkB,UAAW,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,UAM1D;IAED,mBAAmB,UAAW,OAAO,IAAI,CAAC,aAAa,UAEtD;IAED,cAAc,UAAW,OAAO,IAAI,CAAC,aAAa,UAEjD;IAED,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;IAMrC,MAAM;CAyBP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoogleMapsLoadProxy.d.ts","sourceRoot":"","sources":["../../../src/loader/GoogleMapsLoadProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAA;AACjC,OAAO,EAAoB,eAAe,EAAC,MAAM,qBAAqB,CAAA;AAGtE,UAAU,SAAS;IACjB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,YAAY,CAAA;CACjE;AAED,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,eAAe,CAAC;IAClF,gBAAgB,EAAE,YAAY,GAAG,SAAS,CAAA;gBAE9B,KAAK,EAAE,SAAS;IAgB5B,oBAAoB;IAMpB,MAAM;CAcP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoadError.d.ts","sourceRoot":"","sources":["../../../src/loader/LoadError.tsx"],"names":[],"mappings":";AAGA,aAAK,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,KAAK,CAAA;CAAC,GAAG;IAAC,WAAW,EAAE,IAAI,CAAA;CAAC,CAAA;AAErE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,eAuBrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadGoogleMapsApi.d.ts","sourceRoot":"","sources":["../../../src/loader/loadGoogleMapsApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAkB,MAAM,MAAM,CAAA;AAOhD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,QAAQ,CAAA;IACnB,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,WAAW,CAAA;IAC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C,IAAI,CAAC,MAAM;IAK/B,YAAY,CAAC,EAAE,EAAE,cAAc;IAmB/B,aAAa,YAAa,cAAc,GAAG,IAAI,UAO9C;IAED,MAAM;CAUP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Map.styles.d.ts","sourceRoot":"","sources":["../../../src/map/Map.styles.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,oEAOxB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../src/map/Marker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAM/B,UAAU,KAAK;IACb,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA;IAC9B,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;IACpB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA;IACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA;IACpD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA;IACxD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,IAAI,CAAA;IACvD,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAClE,KAAK,CAAC,EAAE;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAA;CAC3D;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;IAEtC,aAAa,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAA;QACpC,KAAK,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAA;KACtC,CAAK;IAEN,iBAAiB;IAmCjB,kBAAkB,CAAC,SAAS,EAAE,KAAK;IAgCnC,oBAAoB;IAUpB,iBAAiB;IAUjB,kBAAkB;IAWlB,MAAM;CAGP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../../src/map/SearchInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,UAAU,KAAK;IACb,GAAG,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA;IAC9B,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,IAAI,CAAA;CAC3D;AAED,qBAAa,WAAY,SAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;IACzD,cAAc,oCAAsC;IACpD,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAA;IAEzD,YAAY,aAUX;IAED,iBAAiB;IAiBjB,MAAM;CAYP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchInput.styles.d.ts","sourceRoot":"","sources":["../../../src/map/SearchInput.styles.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,oEAK5B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/map/util.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAE/B,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EACpC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,WASrC"}
@@ -1,14 +0,0 @@
1
- import { ObjectSchemaType } from '@sanity/field/diff';
2
- export interface LatLng {
3
- lat: number;
4
- lng: number;
5
- }
6
- export interface Geopoint {
7
- _type: 'geopoint';
8
- _key?: string;
9
- lat: number;
10
- lng: number;
11
- alt?: number;
12
- }
13
- export declare type GeopointSchemaType = ObjectSchemaType<Geopoint>;
14
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,UAAU,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,oBAAY,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,82 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.GeopointArrayDiff = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _GoogleMapsLoadProxy = require("../loader/GoogleMapsLoadProxy");
11
-
12
- var _Map = require("../map/Map");
13
-
14
- var _GeopointMove = require("./GeopointMove");
15
-
16
- var _GeopointFieldDiff = require("./GeopointFieldDiff.styles");
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- var GeopointArrayDiff = _ref => {
23
- var diff = _ref.diff,
24
- schemaType = _ref.schemaType;
25
- return /*#__PURE__*/React.createElement(_GeopointFieldDiff.RootContainer, null, /*#__PURE__*/React.createElement(_GoogleMapsLoadProxy.GoogleMapsLoadProxy, null, api => /*#__PURE__*/React.createElement(GeopointDiff, {
26
- api: api,
27
- diff: diff,
28
- schemaType: schemaType
29
- })));
30
- };
31
-
32
- exports.GeopointArrayDiff = GeopointArrayDiff;
33
-
34
- function GeopointDiff(_ref2) {
35
- var api = _ref2.api,
36
- diff = _ref2.diff;
37
- var fromValue = (diff.fromValue || []).filter(hasCoordinates);
38
- var toValue = (diff.toValue || []).filter(hasCoordinates);
39
-
40
- if (fromValue.length === 0 && toValue.length === 0) {
41
- return null;
42
- }
43
-
44
- var bounds = getBounds(fromValue, toValue, api);
45
- return /*#__PURE__*/React.createElement(_Map.GoogleMap, {
46
- api: api,
47
- location: bounds.getCenter().toJSON(),
48
- mapTypeControl: false,
49
- controlSize: 20,
50
- bounds: bounds
51
- }, map => /*#__PURE__*/React.createElement(React.Fragment, null, diff.items.map(_ref3 => {
52
- var toIndex = _ref3.toIndex,
53
- pointDiff = _ref3.diff;
54
-
55
- if (!isChangeDiff(pointDiff)) {
56
- return null;
57
- }
58
-
59
- return /*#__PURE__*/React.createElement(_GeopointMove.GeopointMove, {
60
- key: toIndex,
61
- api: api,
62
- map: map,
63
- diff: pointDiff,
64
- label: "".concat(toIndex)
65
- });
66
- })));
67
- }
68
-
69
- function isChangeDiff(diff) {
70
- return diff.action !== 'unchanged' && diff.type === 'object';
71
- }
72
-
73
- function hasCoordinates(point) {
74
- return typeof point.lat === 'number' && typeof point.lng === 'number';
75
- }
76
-
77
- function getBounds(fromValue, toValue, api) {
78
- var bounds = new api.LatLngBounds();
79
- var points = [...(fromValue || []), ...(toValue || [])];
80
- points.forEach(point => bounds.extend(point));
81
- return bounds;
82
- }