@sanity/google-maps-input 3.0.0-studio-v3.0 → 3.0.0-studio-v3.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/lib/cjs/index.js +184 -181
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +181 -178
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/index.tsx +12 -11
package/lib/cjs/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
9
|
-
var $
|
|
10
|
-
var $
|
|
1
|
+
var $dyHF6$reactjsxruntime = require("react/jsx-runtime");
|
|
2
|
+
var $dyHF6$react = require("react");
|
|
3
|
+
var $dyHF6$sanity = require("sanity");
|
|
4
|
+
var $dyHF6$lodash = require("lodash");
|
|
5
|
+
var $dyHF6$sanityui = require("@sanity/ui");
|
|
6
|
+
var $dyHF6$sanityicons = require("@sanity/icons");
|
|
7
|
+
var $dyHF6$sanity_unstable = require("sanity/_unstable");
|
|
8
|
+
var $dyHF6$sanityform = require("sanity/form");
|
|
9
|
+
var $dyHF6$rxjs = require("rxjs");
|
|
10
|
+
var $dyHF6$styledcomponents = require("styled-components");
|
|
11
11
|
|
|
12
12
|
function $parcel$export(e, n, v, s) {
|
|
13
13
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -16,10 +16,10 @@ function $parcel$interopDefault(a) {
|
|
|
16
16
|
return a && a.__esModule ? a.default : a;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
$parcel$export(module.exports, "googleMapsInput", () => $
|
|
20
|
-
$parcel$export(module.exports, "GeopointArrayDiff", () => $
|
|
21
|
-
$parcel$export(module.exports, "GeopointFieldDiff", () => $
|
|
22
|
-
$parcel$export(module.exports, "GeopointInput", () => $
|
|
19
|
+
$parcel$export(module.exports, "googleMapsInput", () => $329a1cedcedb1349$export$626ae7d0cf8f9143);
|
|
20
|
+
$parcel$export(module.exports, "GeopointArrayDiff", () => $5245dd3554e263be$export$2d0695678527b4cc);
|
|
21
|
+
$parcel$export(module.exports, "GeopointFieldDiff", () => $59d44c8f30c12966$export$6b7bf6aeccd8ac3f);
|
|
22
|
+
$parcel$export(module.exports, "GeopointInput", () => $6c4d418093d85b71$export$2e2bcd8739ae039);
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
@@ -33,44 +33,44 @@ $parcel$export(module.exports, "GeopointInput", () => $8db4b9a0111ad863$export$2
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
const $
|
|
37
|
-
const $
|
|
38
|
-
const $
|
|
39
|
-
let $
|
|
40
|
-
function $
|
|
41
|
-
const selectedLocale = config.defaultLocale || $
|
|
42
|
-
if ($
|
|
43
|
-
$
|
|
36
|
+
const $f83c917b838af6fc$var$callbackName = "___sanity_googleMapsApiCallback";
|
|
37
|
+
const $f83c917b838af6fc$var$authFailureCallbackName = "gm_authFailure";
|
|
38
|
+
const $f83c917b838af6fc$var$locale = typeof window !== "undefined" && window.navigator.language || "en";
|
|
39
|
+
let $f83c917b838af6fc$var$subject;
|
|
40
|
+
function $f83c917b838af6fc$export$616f2ff2d07a5991(config) {
|
|
41
|
+
const selectedLocale = config.defaultLocale || $f83c917b838af6fc$var$locale || "en-US";
|
|
42
|
+
if ($f83c917b838af6fc$var$subject) return $f83c917b838af6fc$var$subject;
|
|
43
|
+
$f83c917b838af6fc$var$subject = new (0, $dyHF6$rxjs.BehaviorSubject)({
|
|
44
44
|
loadState: "loading"
|
|
45
45
|
});
|
|
46
|
-
window[$
|
|
47
|
-
delete window[$
|
|
48
|
-
$
|
|
46
|
+
window[$f83c917b838af6fc$var$authFailureCallbackName] = ()=>{
|
|
47
|
+
delete window[$f83c917b838af6fc$var$authFailureCallbackName];
|
|
48
|
+
$f83c917b838af6fc$var$subject.next({
|
|
49
49
|
loadState: "authError"
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
window[$
|
|
53
|
-
delete window[$
|
|
54
|
-
$
|
|
52
|
+
window[$f83c917b838af6fc$var$callbackName] = ()=>{
|
|
53
|
+
delete window[$f83c917b838af6fc$var$callbackName];
|
|
54
|
+
$f83c917b838af6fc$var$subject.next({
|
|
55
55
|
loadState: "loaded",
|
|
56
56
|
api: window.google.maps
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
const script = document.createElement("script");
|
|
60
|
-
script.onerror = (event, source, lineno, colno, error)=>$
|
|
60
|
+
script.onerror = (event, source, lineno, colno, error)=>$f83c917b838af6fc$var$subject.next({
|
|
61
61
|
loadState: "loadError",
|
|
62
|
-
error: $
|
|
62
|
+
error: $f83c917b838af6fc$var$coeerceError(event, error)
|
|
63
63
|
});
|
|
64
|
-
script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${$
|
|
64
|
+
script.src = `https://maps.googleapis.com/maps/api/js?key=${config.apiKey}&libraries=places&callback=${$f83c917b838af6fc$var$callbackName}&language=${selectedLocale}`;
|
|
65
65
|
document.getElementsByTagName("head")[0].appendChild(script);
|
|
66
|
-
return $
|
|
66
|
+
return $f83c917b838af6fc$var$subject;
|
|
67
67
|
}
|
|
68
|
-
function $
|
|
68
|
+
function $f83c917b838af6fc$var$coeerceError(event, error) {
|
|
69
69
|
if (error) return error;
|
|
70
70
|
if (typeof event === "string") return new Error(event);
|
|
71
|
-
return new Error($
|
|
71
|
+
return new Error($f83c917b838af6fc$var$isErrorEvent(event) ? event.message : "Failed to load Google Maps API");
|
|
72
72
|
}
|
|
73
|
-
function $
|
|
73
|
+
function $f83c917b838af6fc$var$isErrorEvent(event) {
|
|
74
74
|
if (typeof event !== "object" || event === null) return false;
|
|
75
75
|
if (!("message" in event)) return false;
|
|
76
76
|
return typeof event.message === "string";
|
|
@@ -80,34 +80,34 @@ function $6aae22eba4fbb049$var$isErrorEvent(event) {
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
function $
|
|
84
|
-
return /*#__PURE__*/ (0, $
|
|
83
|
+
function $53fff27a5374fe8c$export$58a097931cd8d64d(props) {
|
|
84
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Card), {
|
|
85
85
|
tone: "critical",
|
|
86
86
|
radius: 1,
|
|
87
87
|
children: [
|
|
88
|
-
/*#__PURE__*/ (0, $
|
|
88
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Box), {
|
|
89
89
|
as: "header",
|
|
90
90
|
paddingX: 4,
|
|
91
91
|
paddingTop: 4,
|
|
92
92
|
paddingBottom: 1,
|
|
93
|
-
children: /*#__PURE__*/ (0, $
|
|
93
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Text), {
|
|
94
94
|
as: "h2",
|
|
95
95
|
weight: "bold",
|
|
96
96
|
children: "Google Maps failed to load"
|
|
97
97
|
})
|
|
98
98
|
}),
|
|
99
|
-
/*#__PURE__*/ (0, $
|
|
99
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Box), {
|
|
100
100
|
paddingX: 4,
|
|
101
101
|
paddingTop: 4,
|
|
102
102
|
paddingBottom: 1,
|
|
103
|
-
children: props.isAuthError ? /*#__PURE__*/ (0, $
|
|
103
|
+
children: props.isAuthError ? /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($53fff27a5374fe8c$var$AuthError, {}) : /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
104
104
|
children: [
|
|
105
|
-
/*#__PURE__*/ (0, $
|
|
105
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Text), {
|
|
106
106
|
as: "h3",
|
|
107
107
|
children: "Error details:"
|
|
108
108
|
}),
|
|
109
|
-
/*#__PURE__*/ (0, $
|
|
110
|
-
children: /*#__PURE__*/ (0, $
|
|
109
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("pre", {
|
|
110
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Code), {
|
|
111
111
|
size: 1,
|
|
112
112
|
children: "error" in props && props.error?.message
|
|
113
113
|
})
|
|
@@ -118,29 +118,29 @@ function $f2574380dfc44bc2$export$58a097931cd8d64d(props) {
|
|
|
118
118
|
]
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
function $
|
|
122
|
-
return /*#__PURE__*/ (0, $
|
|
121
|
+
function $53fff27a5374fe8c$var$AuthError() {
|
|
122
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Text), {
|
|
123
123
|
children: [
|
|
124
|
-
/*#__PURE__*/ (0, $
|
|
124
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("p", {
|
|
125
125
|
children: "The error appears to be related to authentication"
|
|
126
126
|
}),
|
|
127
|
-
/*#__PURE__*/ (0, $
|
|
127
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("p", {
|
|
128
128
|
children: "Common causes include:"
|
|
129
129
|
}),
|
|
130
|
-
/*#__PURE__*/ (0, $
|
|
130
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)("ul", {
|
|
131
131
|
children: [
|
|
132
|
-
/*#__PURE__*/ (0, $
|
|
132
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
133
133
|
children: "Incorrect API key"
|
|
134
134
|
}),
|
|
135
|
-
/*#__PURE__*/ (0, $
|
|
135
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
136
136
|
children: "Referer not allowed"
|
|
137
137
|
}),
|
|
138
|
-
/*#__PURE__*/ (0, $
|
|
138
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
139
139
|
children: "Missing authentication scope"
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
}),
|
|
143
|
-
/*#__PURE__*/ (0, $
|
|
143
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("p", {
|
|
144
144
|
children: "Check the browser developer tools for more information."
|
|
145
145
|
})
|
|
146
146
|
]
|
|
@@ -148,14 +148,14 @@ function $f2574380dfc44bc2$var$AuthError() {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
class $
|
|
151
|
+
class $ffeb69a200895c22$export$a628545bcf173896 extends (0, ($parcel$interopDefault($dyHF6$react))).Component {
|
|
152
152
|
constructor(props){
|
|
153
153
|
super(props);
|
|
154
154
|
this.state = {
|
|
155
155
|
loadState: "loading"
|
|
156
156
|
};
|
|
157
157
|
let sync = true;
|
|
158
|
-
this.loadSubscription = (0, $
|
|
158
|
+
this.loadSubscription = (0, $f83c917b838af6fc$export$616f2ff2d07a5991)(props.config).subscribe((loadState)=>{
|
|
159
159
|
if (sync) this.state = loadState;
|
|
160
160
|
else this.setState(loadState);
|
|
161
161
|
});
|
|
@@ -167,16 +167,16 @@ class $11aa3bd25a0439fb$export$a628545bcf173896 extends (0, ($parcel$interopDefa
|
|
|
167
167
|
render() {
|
|
168
168
|
switch(this.state.loadState){
|
|
169
169
|
case "loadError":
|
|
170
|
-
return /*#__PURE__*/ (0, $
|
|
170
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $53fff27a5374fe8c$export$58a097931cd8d64d), {
|
|
171
171
|
error: this.state.error,
|
|
172
172
|
isAuthError: false
|
|
173
173
|
});
|
|
174
174
|
case "authError":
|
|
175
|
-
return /*#__PURE__*/ (0, $
|
|
175
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $53fff27a5374fe8c$export$58a097931cd8d64d), {
|
|
176
176
|
isAuthError: true
|
|
177
177
|
});
|
|
178
178
|
case "loading":
|
|
179
|
-
return /*#__PURE__*/ (0, $
|
|
179
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("div", {
|
|
180
180
|
children: "Loading Google Maps API"
|
|
181
181
|
});
|
|
182
182
|
case "loaded":
|
|
@@ -194,7 +194,7 @@ class $11aa3bd25a0439fb$export$a628545bcf173896 extends (0, ($parcel$interopDefa
|
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
|
|
197
|
-
const $
|
|
197
|
+
const $d1c3432f7dd52338$export$be3daefb18c346ac = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).div`
|
|
198
198
|
position: absolute;
|
|
199
199
|
right: 10px;
|
|
200
200
|
top: 10px;
|
|
@@ -202,8 +202,8 @@ const $43b32e64e2386b9f$export$be3daefb18c346ac = (0, ($parcel$interopDefault($7
|
|
|
202
202
|
`;
|
|
203
203
|
|
|
204
204
|
|
|
205
|
-
class $
|
|
206
|
-
searchInputRef = /*#__PURE__*/ $
|
|
205
|
+
class $06ee1f282087006d$export$55d7609a8f1eccd2 extends $dyHF6$react.PureComponent {
|
|
206
|
+
searchInputRef = /*#__PURE__*/ $dyHF6$react.createRef();
|
|
207
207
|
handleChange = ()=>{
|
|
208
208
|
if (!this.autoComplete) return;
|
|
209
209
|
this.props.onChange(this.autoComplete.getPlace());
|
|
@@ -225,8 +225,8 @@ class $df4b0d486bd5e2ba$export$55d7609a8f1eccd2 extends $7xGut$react.PureCompone
|
|
|
225
225
|
event.addListener(this.autoComplete, "place_changed", this.handleChange);
|
|
226
226
|
}
|
|
227
227
|
render() {
|
|
228
|
-
return /*#__PURE__*/ (0, $
|
|
229
|
-
children: /*#__PURE__*/ (0, $
|
|
228
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $d1c3432f7dd52338$export$be3daefb18c346ac), {
|
|
229
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.TextInput), {
|
|
230
230
|
name: "place",
|
|
231
231
|
ref: this.searchInputRef,
|
|
232
232
|
placeholder: "Search for place or address",
|
|
@@ -239,7 +239,7 @@ class $df4b0d486bd5e2ba$export$55d7609a8f1eccd2 extends $7xGut$react.PureCompone
|
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
|
|
242
|
-
function $
|
|
242
|
+
function $97ec7b8b370674b5$export$ad553d4d3a617f20(latLng1, latLng2) {
|
|
243
243
|
const lat1 = typeof latLng1.lat === "function" ? latLng1.lat() : latLng1.lat;
|
|
244
244
|
const lng1 = typeof latLng1.lng === "function" ? latLng1.lng() : latLng1.lng;
|
|
245
245
|
const lat2 = typeof latLng2.lat === "function" ? latLng2.lat() : latLng2.lat;
|
|
@@ -249,7 +249,7 @@ function $0d62bd7f26f3721d$export$ad553d4d3a617f20(latLng1, latLng2) {
|
|
|
249
249
|
|
|
250
250
|
|
|
251
251
|
|
|
252
|
-
const $
|
|
252
|
+
const $c49746d4a5875a1e$export$23f3dfd47374502b = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).div`
|
|
253
253
|
position: absolute;
|
|
254
254
|
top: 0;
|
|
255
255
|
left: 0;
|
|
@@ -259,7 +259,7 @@ const $40d21989722920a7$export$23f3dfd47374502b = (0, ($parcel$interopDefault($7
|
|
|
259
259
|
`;
|
|
260
260
|
|
|
261
261
|
|
|
262
|
-
class $
|
|
262
|
+
class $b4ba0a9d820dad94$export$4ad1bae46276c5ce extends (0, ($parcel$interopDefault($dyHF6$react))).PureComponent {
|
|
263
263
|
static defaultProps = {
|
|
264
264
|
defaultZoom: 8,
|
|
265
265
|
scrollWheel: true
|
|
@@ -267,7 +267,7 @@ class $e4af9ccb6a5bf799$export$4ad1bae46276c5ce extends (0, ($parcel$interopDefa
|
|
|
267
267
|
state = {
|
|
268
268
|
map: undefined
|
|
269
269
|
};
|
|
270
|
-
mapRef = /*#__PURE__*/ (0, ($parcel$interopDefault($
|
|
270
|
+
mapRef = /*#__PURE__*/ (0, ($parcel$interopDefault($dyHF6$react))).createRef();
|
|
271
271
|
mapEl = null;
|
|
272
272
|
componentDidMount() {
|
|
273
273
|
this.attachClickHandler();
|
|
@@ -285,7 +285,7 @@ class $e4af9ccb6a5bf799$export$4ad1bae46276c5ce extends (0, ($parcel$interopDefa
|
|
|
285
285
|
if (!map) return;
|
|
286
286
|
const { onClick: onClick , location: location , bounds: bounds } = this.props;
|
|
287
287
|
if (prevProps.onClick !== onClick) this.attachClickHandler();
|
|
288
|
-
if (!(0, $
|
|
288
|
+
if (!(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.location, location)) map.panTo(this.getCenter());
|
|
289
289
|
if (bounds && (!prevProps.bounds || !bounds.equals(prevProps.bounds))) map.fitBounds(bounds);
|
|
290
290
|
}
|
|
291
291
|
componentWillUnmount() {
|
|
@@ -320,9 +320,9 @@ class $e4af9ccb6a5bf799$export$4ad1bae46276c5ce extends (0, ($parcel$interopDefa
|
|
|
320
320
|
render() {
|
|
321
321
|
const { children: children } = this.props;
|
|
322
322
|
const { map: map } = this.state;
|
|
323
|
-
return /*#__PURE__*/ (0, $
|
|
323
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
324
324
|
children: [
|
|
325
|
-
/*#__PURE__*/ (0, $
|
|
325
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $c49746d4a5875a1e$export$23f3dfd47374502b), {
|
|
326
326
|
ref: this.setMapElement
|
|
327
327
|
}),
|
|
328
328
|
children && map ? children(map) : null
|
|
@@ -334,15 +334,15 @@ class $e4af9ccb6a5bf799$export$4ad1bae46276c5ce extends (0, ($parcel$interopDefa
|
|
|
334
334
|
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
const $
|
|
338
|
-
class $
|
|
337
|
+
const $03ff3d51ebf52598$var$markerPath = "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";
|
|
338
|
+
class $03ff3d51ebf52598$export$e98856a975cab58e extends $dyHF6$react.PureComponent {
|
|
339
339
|
eventHandlers = {};
|
|
340
340
|
componentDidMount() {
|
|
341
341
|
const { position: position , api: api , map: map , onMove: onMove , zIndex: zIndex , opacity: opacity , label: label , markerRef: markerRef , color: color } = this.props;
|
|
342
342
|
const { Marker: GMarker } = api;
|
|
343
343
|
let icon;
|
|
344
344
|
if (color) icon = {
|
|
345
|
-
path: $
|
|
345
|
+
path: $03ff3d51ebf52598$var$markerPath,
|
|
346
346
|
fillOpacity: 1,
|
|
347
347
|
fillColor: color.background,
|
|
348
348
|
strokeColor: color.border,
|
|
@@ -367,7 +367,7 @@ class $4d51186e62dfaea7$export$e98856a975cab58e extends $7xGut$react.PureCompone
|
|
|
367
367
|
if (!this.marker) return;
|
|
368
368
|
const { position: position , onMove: onMove , label: label , zIndex: zIndex , opacity: opacity , map: map } = this.props;
|
|
369
369
|
if (prevProps.onMove !== onMove) this.attachMoveHandler();
|
|
370
|
-
if (!(0, $
|
|
370
|
+
if (!(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.position, position)) this.marker.setPosition(position);
|
|
371
371
|
if (prevProps.label !== label) this.marker.setLabel(label || null);
|
|
372
372
|
if (prevProps.zIndex !== zIndex) this.marker.setZIndex(zIndex || null);
|
|
373
373
|
if (prevProps.opacity !== opacity) this.marker.setOpacity(opacity || null);
|
|
@@ -394,11 +394,11 @@ class $4d51186e62dfaea7$export$e98856a975cab58e extends $7xGut$react.PureCompone
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
|
|
397
|
-
const $
|
|
397
|
+
const $a24f16af03c18a4b$var$fallbackLatLng = {
|
|
398
398
|
lat: 40.7058254,
|
|
399
399
|
lng: -74.1180863
|
|
400
400
|
};
|
|
401
|
-
class $
|
|
401
|
+
class $a24f16af03c18a4b$export$9a2476e65b6b92a7 extends (0, ($parcel$interopDefault($dyHF6$react))).PureComponent {
|
|
402
402
|
static defaultProps = {
|
|
403
403
|
defaultZoom: 8,
|
|
404
404
|
defaultLocation: {
|
|
@@ -406,11 +406,11 @@ class $63b9788415952804$export$9a2476e65b6b92a7 extends (0, ($parcel$interopDefa
|
|
|
406
406
|
lat: 59.91273
|
|
407
407
|
}
|
|
408
408
|
};
|
|
409
|
-
mapRef = /*#__PURE__*/ (0, ($parcel$interopDefault($
|
|
409
|
+
mapRef = /*#__PURE__*/ (0, ($parcel$interopDefault($dyHF6$react))).createRef();
|
|
410
410
|
getCenter() {
|
|
411
411
|
const { value: value = {} , defaultLocation: defaultLocation = {} } = this.props;
|
|
412
412
|
const point = {
|
|
413
|
-
...$
|
|
413
|
+
...$a24f16af03c18a4b$var$fallbackLatLng,
|
|
414
414
|
...defaultLocation,
|
|
415
415
|
...value
|
|
416
416
|
};
|
|
@@ -431,19 +431,19 @@ class $63b9788415952804$export$9a2476e65b6b92a7 extends (0, ($parcel$interopDefa
|
|
|
431
431
|
}
|
|
432
432
|
render() {
|
|
433
433
|
const { api: api , defaultZoom: defaultZoom , value: value , onChange: onChange } = this.props;
|
|
434
|
-
return /*#__PURE__*/ (0, $
|
|
434
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $b4ba0a9d820dad94$export$4ad1bae46276c5ce), {
|
|
435
435
|
api: api,
|
|
436
436
|
location: this.getCenter(),
|
|
437
437
|
onClick: this.handleMapClick,
|
|
438
438
|
defaultZoom: defaultZoom,
|
|
439
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
439
|
+
children: (map)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
440
440
|
children: [
|
|
441
|
-
/*#__PURE__*/ (0, $
|
|
441
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $06ee1f282087006d$export$55d7609a8f1eccd2), {
|
|
442
442
|
api: api,
|
|
443
443
|
map: map,
|
|
444
444
|
onChange: this.handlePlaceChanged
|
|
445
445
|
}),
|
|
446
|
-
value && /*#__PURE__*/ (0, $
|
|
446
|
+
value && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $03ff3d51ebf52598$export$e98856a975cab58e), {
|
|
447
447
|
api: api,
|
|
448
448
|
map: map,
|
|
449
449
|
position: value,
|
|
@@ -457,27 +457,27 @@ class $63b9788415952804$export$9a2476e65b6b92a7 extends (0, ($parcel$interopDefa
|
|
|
457
457
|
|
|
458
458
|
|
|
459
459
|
|
|
460
|
-
const $
|
|
460
|
+
const $116268a9005e03a0$export$1c4ad7c095d42d37 = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).img`
|
|
461
461
|
width: 100%;
|
|
462
462
|
height: auto;
|
|
463
463
|
vertical-align: top;
|
|
464
464
|
`;
|
|
465
|
-
const $
|
|
465
|
+
const $116268a9005e03a0$export$ffa61c425f593078 = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).div`
|
|
466
466
|
height: 40rem;
|
|
467
467
|
width: 50rem;
|
|
468
468
|
`;
|
|
469
469
|
|
|
470
470
|
|
|
471
|
-
let $
|
|
472
|
-
function $
|
|
473
|
-
return $
|
|
471
|
+
let $28797477c09ece12$var$config;
|
|
472
|
+
function $28797477c09ece12$export$ee3fba7cd2f8c355() {
|
|
473
|
+
return $28797477c09ece12$var$config;
|
|
474
474
|
}
|
|
475
|
-
function $
|
|
476
|
-
$
|
|
475
|
+
function $28797477c09ece12$export$a9c6c3563e9053d(newConfig) {
|
|
476
|
+
$28797477c09ece12$var$config = newConfig;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
|
|
480
|
-
const $
|
|
480
|
+
const $6c4d418093d85b71$var$getStaticImageUrl = (value, apiKey)=>{
|
|
481
481
|
const loc = `${value.lat},${value.lng}`;
|
|
482
482
|
const params = {
|
|
483
483
|
key: apiKey,
|
|
@@ -492,8 +492,8 @@ const $8db4b9a0111ad863$var$getStaticImageUrl = (value, apiKey)=>{
|
|
|
492
492
|
}, []);
|
|
493
493
|
return `https://maps.googleapis.com/maps/api/staticmap?${qs.join("&")}`;
|
|
494
494
|
};
|
|
495
|
-
class $
|
|
496
|
-
_geopointInputId = (0, $
|
|
495
|
+
class $6c4d418093d85b71$var$GeopointInput extends (0, ($parcel$interopDefault($dyHF6$react))).PureComponent {
|
|
496
|
+
_geopointInputId = (0, $dyHF6$lodash.uniqueId)("GeopointInput");
|
|
497
497
|
constructor(props){
|
|
498
498
|
super(props);
|
|
499
499
|
this.state = {
|
|
@@ -519,84 +519,84 @@ class $8db4b9a0111ad863$var$GeopointInput extends (0, ($parcel$interopDefault($7
|
|
|
519
519
|
handleChange = (latLng)=>{
|
|
520
520
|
const { schemaType: schemaType , onChange: onChange } = this.props;
|
|
521
521
|
onChange([
|
|
522
|
-
(0, $
|
|
522
|
+
(0, $dyHF6$sanityform.setIfMissing)({
|
|
523
523
|
_type: schemaType.name
|
|
524
524
|
}),
|
|
525
|
-
(0, $
|
|
525
|
+
(0, $dyHF6$sanityform.set)(latLng.lat(), [
|
|
526
526
|
"lat"
|
|
527
527
|
]),
|
|
528
|
-
(0, $
|
|
528
|
+
(0, $dyHF6$sanityform.set)(latLng.lng(), [
|
|
529
529
|
"lng"
|
|
530
530
|
]),
|
|
531
531
|
]);
|
|
532
532
|
};
|
|
533
533
|
handleClear = ()=>{
|
|
534
534
|
const { onChange: onChange } = this.props;
|
|
535
|
-
onChange((0, $
|
|
535
|
+
onChange((0, $dyHF6$sanityform.unset)());
|
|
536
536
|
};
|
|
537
537
|
render() {
|
|
538
538
|
const { value: value , readOnly: readOnly , compareValue: compareValue , geoConfig: config } = this.props;
|
|
539
539
|
const { modalOpen: modalOpen } = this.state;
|
|
540
|
-
if (!config || !config.apiKey) return /*#__PURE__*/ (0, $
|
|
540
|
+
if (!config || !config.apiKey) return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)("div", {
|
|
541
541
|
children: [
|
|
542
|
-
/*#__PURE__*/ (0, $
|
|
542
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)("p", {
|
|
543
543
|
children: [
|
|
544
544
|
"The ",
|
|
545
|
-
/*#__PURE__*/ (0, $
|
|
545
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("a", {
|
|
546
546
|
href: "https://sanity.io/docs/schema-types/geopoint-type",
|
|
547
547
|
children: "Geopoint type"
|
|
548
548
|
}),
|
|
549
549
|
" needs a Google Maps API key with access to:"
|
|
550
550
|
]
|
|
551
551
|
}),
|
|
552
|
-
/*#__PURE__*/ (0, $
|
|
552
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)("ul", {
|
|
553
553
|
children: [
|
|
554
|
-
/*#__PURE__*/ (0, $
|
|
554
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
555
555
|
children: "Google Maps JavaScript API"
|
|
556
556
|
}),
|
|
557
|
-
/*#__PURE__*/ (0, $
|
|
557
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
558
558
|
children: "Google Places API Web Service"
|
|
559
559
|
}),
|
|
560
|
-
/*#__PURE__*/ (0, $
|
|
560
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("li", {
|
|
561
561
|
children: "Google Static Maps API"
|
|
562
562
|
})
|
|
563
563
|
]
|
|
564
564
|
}),
|
|
565
|
-
/*#__PURE__*/ (0, $
|
|
565
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("p", {
|
|
566
566
|
children: "Please enter the API key with access to these services in your googleMapsInput plugin config."
|
|
567
567
|
})
|
|
568
568
|
]
|
|
569
569
|
});
|
|
570
|
-
return /*#__PURE__*/ (0, $
|
|
570
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
571
571
|
children: [
|
|
572
|
-
value && /*#__PURE__*/ (0, $
|
|
572
|
+
value && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanity_unstable.ChangeIndicatorCompareValueProvider), {
|
|
573
573
|
value: value,
|
|
574
574
|
compareValue: compareValue,
|
|
575
|
-
children: /*#__PURE__*/ (0, $
|
|
575
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanity_unstable.ChangeIndicator), {
|
|
576
576
|
compareDeep: true,
|
|
577
|
-
children: /*#__PURE__*/ (0, $
|
|
578
|
-
src: $
|
|
577
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $116268a9005e03a0$export$1c4ad7c095d42d37), {
|
|
578
|
+
src: $6c4d418093d85b71$var$getStaticImageUrl(value, config.apiKey),
|
|
579
579
|
alt: "Map location"
|
|
580
580
|
})
|
|
581
581
|
})
|
|
582
582
|
}),
|
|
583
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
583
|
+
!readOnly && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Box), {
|
|
584
584
|
marginTop: 4,
|
|
585
|
-
children: /*#__PURE__*/ (0, $
|
|
585
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Grid), {
|
|
586
586
|
columns: 2,
|
|
587
587
|
gap: 2,
|
|
588
588
|
children: [
|
|
589
|
-
/*#__PURE__*/ (0, $
|
|
589
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
|
|
590
590
|
mode: "ghost",
|
|
591
|
-
icon: value && (0, $
|
|
591
|
+
icon: value && (0, $dyHF6$sanityicons.EditIcon),
|
|
592
592
|
padding: 3,
|
|
593
593
|
ref: this.setEditButton,
|
|
594
594
|
text: value ? "Edit" : "Set location",
|
|
595
595
|
onClick: this.handleToggleModal
|
|
596
596
|
}),
|
|
597
|
-
value && /*#__PURE__*/ (0, $
|
|
597
|
+
value && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
|
|
598
598
|
tone: "critical",
|
|
599
|
-
icon: (0, $
|
|
599
|
+
icon: (0, $dyHF6$sanityicons.TrashIcon),
|
|
600
600
|
padding: 3,
|
|
601
601
|
mode: "ghost",
|
|
602
602
|
text: "Remove",
|
|
@@ -605,15 +605,15 @@ class $8db4b9a0111ad863$var$GeopointInput extends (0, ($parcel$interopDefault($7
|
|
|
605
605
|
]
|
|
606
606
|
})
|
|
607
607
|
}),
|
|
608
|
-
modalOpen && /*#__PURE__*/ (0, $
|
|
608
|
+
modalOpen && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Dialog), {
|
|
609
609
|
id: `${this._geopointInputId}_dialog`,
|
|
610
610
|
onClose: this.handleCloseModal,
|
|
611
611
|
header: "Place the marker on the map",
|
|
612
612
|
width: 1,
|
|
613
|
-
children: /*#__PURE__*/ (0, $
|
|
614
|
-
children: /*#__PURE__*/ (0, $
|
|
615
|
-
config: (0, $
|
|
616
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
613
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $116268a9005e03a0$export$ffa61c425f593078), {
|
|
614
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
615
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
616
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a24f16af03c18a4b$export$9a2476e65b6b92a7), {
|
|
617
617
|
api: api,
|
|
618
618
|
value: value || undefined,
|
|
619
619
|
onChange: readOnly ? undefined : this.handleChange,
|
|
@@ -627,7 +627,7 @@ class $8db4b9a0111ad863$var$GeopointInput extends (0, ($parcel$interopDefault($7
|
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
var $
|
|
630
|
+
var $6c4d418093d85b71$export$2e2bcd8739ae039 = $6c4d418093d85b71$var$GeopointInput;
|
|
631
631
|
|
|
632
632
|
|
|
633
633
|
|
|
@@ -641,7 +641,7 @@ var $8db4b9a0111ad863$export$2e2bcd8739ae039 = $8db4b9a0111ad863$var$GeopointInp
|
|
|
641
641
|
|
|
642
642
|
|
|
643
643
|
|
|
644
|
-
class $
|
|
644
|
+
class $2336979407935278$export$21b07c8f274aebd5 extends $dyHF6$react.PureComponent {
|
|
645
645
|
eventHandlers = {};
|
|
646
646
|
componentDidMount() {
|
|
647
647
|
const { from: from , to: to , api: api , map: map , zIndex: zIndex , onClick: onClick , color: color , arrowRef: arrowRef } = this.props;
|
|
@@ -670,7 +670,7 @@ class $4b644fd7176653a0$export$21b07c8f274aebd5 extends $7xGut$react.PureCompone
|
|
|
670
670
|
componentDidUpdate(prevProps) {
|
|
671
671
|
if (!this.line) return;
|
|
672
672
|
const { from: from , to: to , map: map } = this.props;
|
|
673
|
-
if (!(0, $
|
|
673
|
+
if (!(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.from, from) || !(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.to, to)) this.line.setPath([
|
|
674
674
|
from,
|
|
675
675
|
to
|
|
676
676
|
]);
|
|
@@ -687,15 +687,15 @@ class $4b644fd7176653a0$export$21b07c8f274aebd5 extends $7xGut$react.PureCompone
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
function $
|
|
690
|
+
function $a4e9fc866b2a477c$export$f432217b31ec4a77({ diff: diff , api: api , map: map , label: label }) {
|
|
691
691
|
const { fromValue: from , toValue: to } = diff;
|
|
692
692
|
const annotation = diff.isChanged ? diff.annotation : undefined;
|
|
693
|
-
const userColor = (0, $
|
|
694
|
-
const fromRef = $
|
|
695
|
-
const toRef = $
|
|
696
|
-
return /*#__PURE__*/ (0, $
|
|
693
|
+
const userColor = (0, $dyHF6$sanity_unstable.useUserColor)(annotation ? annotation.author : null) || undefined;
|
|
694
|
+
const fromRef = $dyHF6$react.useRef();
|
|
695
|
+
const toRef = $dyHF6$react.useRef();
|
|
696
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
697
697
|
children: [
|
|
698
|
-
from && /*#__PURE__*/ (0, $
|
|
698
|
+
from && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $03ff3d51ebf52598$export$e98856a975cab58e), {
|
|
699
699
|
api: api,
|
|
700
700
|
map: map,
|
|
701
701
|
position: from,
|
|
@@ -704,7 +704,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
704
704
|
markerRef: fromRef,
|
|
705
705
|
color: userColor
|
|
706
706
|
}),
|
|
707
|
-
from && to && /*#__PURE__*/ (0, $
|
|
707
|
+
from && to && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $2336979407935278$export$21b07c8f274aebd5), {
|
|
708
708
|
api: api,
|
|
709
709
|
map: map,
|
|
710
710
|
from: from,
|
|
@@ -712,7 +712,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
712
712
|
zIndex: 1,
|
|
713
713
|
color: userColor
|
|
714
714
|
}),
|
|
715
|
-
to && /*#__PURE__*/ (0, $
|
|
715
|
+
to && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $03ff3d51ebf52598$export$e98856a975cab58e), {
|
|
716
716
|
api: api,
|
|
717
717
|
map: map,
|
|
718
718
|
position: to,
|
|
@@ -727,7 +727,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
727
727
|
|
|
728
728
|
|
|
729
729
|
|
|
730
|
-
const $
|
|
730
|
+
const $c02dd8e49e4bafdc$export$35b4f62b8f8d707c = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).div`
|
|
731
731
|
position: relative;
|
|
732
732
|
min-height: 200px;
|
|
733
733
|
|
|
@@ -748,11 +748,11 @@ const $a77259f4ed6ec9ac$export$35b4f62b8f8d707c = (0, ($parcel$interopDefault($7
|
|
|
748
748
|
|
|
749
749
|
|
|
750
750
|
|
|
751
|
-
const $
|
|
752
|
-
return /*#__PURE__*/ (0, $
|
|
753
|
-
children: /*#__PURE__*/ (0, $
|
|
754
|
-
config: (0, $
|
|
755
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
751
|
+
const $5245dd3554e263be$export$2d0695678527b4cc = ({ diff: diff , schemaType: schemaType })=>{
|
|
752
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $c02dd8e49e4bafdc$export$35b4f62b8f8d707c), {
|
|
753
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
754
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
755
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($5245dd3554e263be$var$GeopointDiff, {
|
|
756
756
|
api: api,
|
|
757
757
|
diff: diff,
|
|
758
758
|
schemaType: schemaType
|
|
@@ -760,21 +760,21 @@ const $877f5a72c2824857$export$2d0695678527b4cc = ({ diff: diff , schemaType: sc
|
|
|
760
760
|
})
|
|
761
761
|
});
|
|
762
762
|
};
|
|
763
|
-
function $
|
|
764
|
-
const fromValue = (diff.fromValue || []).filter($
|
|
765
|
-
const toValue = (diff.toValue || []).filter($
|
|
763
|
+
function $5245dd3554e263be$var$GeopointDiff({ api: api , diff: diff }) {
|
|
764
|
+
const fromValue = (diff.fromValue || []).filter($5245dd3554e263be$var$hasCoordinates);
|
|
765
|
+
const toValue = (diff.toValue || []).filter($5245dd3554e263be$var$hasCoordinates);
|
|
766
766
|
if (fromValue.length === 0 && toValue.length === 0) return null;
|
|
767
|
-
const bounds = $
|
|
768
|
-
return /*#__PURE__*/ (0, $
|
|
767
|
+
const bounds = $5245dd3554e263be$var$getBounds(fromValue, toValue, api);
|
|
768
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $b4ba0a9d820dad94$export$4ad1bae46276c5ce), {
|
|
769
769
|
api: api,
|
|
770
770
|
location: bounds.getCenter().toJSON(),
|
|
771
771
|
mapTypeControl: false,
|
|
772
772
|
controlSize: 20,
|
|
773
773
|
bounds: bounds,
|
|
774
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
774
|
+
children: (map)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
775
775
|
children: diff.items.map(({ toIndex: toIndex , diff: pointDiff })=>{
|
|
776
|
-
if (!$
|
|
777
|
-
return /*#__PURE__*/ (0, $
|
|
776
|
+
if (!$5245dd3554e263be$var$isChangeDiff(pointDiff)) return null;
|
|
777
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a4e9fc866b2a477c$export$f432217b31ec4a77), {
|
|
778
778
|
api: api,
|
|
779
779
|
map: map,
|
|
780
780
|
diff: pointDiff,
|
|
@@ -784,13 +784,13 @@ function $877f5a72c2824857$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
784
784
|
})
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
-
function $
|
|
787
|
+
function $5245dd3554e263be$var$isChangeDiff(diff) {
|
|
788
788
|
return diff.action !== "unchanged" && diff.type === "object";
|
|
789
789
|
}
|
|
790
|
-
function $
|
|
790
|
+
function $5245dd3554e263be$var$hasCoordinates(point) {
|
|
791
791
|
return typeof point.lat === "number" && typeof point.lng === "number";
|
|
792
792
|
}
|
|
793
|
-
function $
|
|
793
|
+
function $5245dd3554e263be$var$getBounds(fromValue, toValue, api) {
|
|
794
794
|
const bounds = new api.LatLngBounds();
|
|
795
795
|
const points = [
|
|
796
796
|
...fromValue || [],
|
|
@@ -809,11 +809,11 @@ function $877f5a72c2824857$var$getBounds(fromValue, toValue, api) {
|
|
|
809
809
|
|
|
810
810
|
|
|
811
811
|
|
|
812
|
-
const $
|
|
813
|
-
return /*#__PURE__*/ (0, $
|
|
814
|
-
children: /*#__PURE__*/ (0, $
|
|
815
|
-
config: (0, $
|
|
816
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
812
|
+
const $59d44c8f30c12966$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: schemaType })=>{
|
|
813
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $c02dd8e49e4bafdc$export$35b4f62b8f8d707c), {
|
|
814
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
815
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
816
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($59d44c8f30c12966$var$GeopointDiff, {
|
|
817
817
|
api: api,
|
|
818
818
|
diff: diff,
|
|
819
819
|
schemaType: schemaType
|
|
@@ -821,29 +821,29 @@ const $0d2428b0f4f06ed5$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: sc
|
|
|
821
821
|
})
|
|
822
822
|
});
|
|
823
823
|
};
|
|
824
|
-
function $
|
|
824
|
+
function $59d44c8f30c12966$var$GeopointDiff({ api: api , diff: diff }) {
|
|
825
825
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
826
|
-
const annotation = (0, $
|
|
826
|
+
const annotation = (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, [
|
|
827
827
|
"lat"
|
|
828
|
-
]) || (0, $
|
|
828
|
+
]) || (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, [
|
|
829
829
|
"lng"
|
|
830
|
-
]) || (0, $
|
|
831
|
-
const center = $
|
|
832
|
-
const bounds = fromValue && toValue ? $
|
|
833
|
-
return /*#__PURE__*/ (0, $
|
|
830
|
+
]) || (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, []);
|
|
831
|
+
const center = $59d44c8f30c12966$var$getCenter(diff, api);
|
|
832
|
+
const bounds = fromValue && toValue ? $59d44c8f30c12966$var$getBounds(fromValue, toValue, api) : undefined;
|
|
833
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanity_unstable.DiffTooltip), {
|
|
834
834
|
annotations: annotation ? [
|
|
835
835
|
annotation
|
|
836
836
|
] : [],
|
|
837
|
-
description: $
|
|
838
|
-
children: /*#__PURE__*/ (0, $
|
|
839
|
-
children: /*#__PURE__*/ (0, $
|
|
837
|
+
description: $59d44c8f30c12966$var$getAction(diff),
|
|
838
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("div", {
|
|
839
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $b4ba0a9d820dad94$export$4ad1bae46276c5ce), {
|
|
840
840
|
api: api,
|
|
841
841
|
location: center,
|
|
842
842
|
mapTypeControl: false,
|
|
843
843
|
controlSize: 20,
|
|
844
844
|
bounds: bounds,
|
|
845
845
|
scrollWheel: false,
|
|
846
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
846
|
+
children: (map)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a4e9fc866b2a477c$export$f432217b31ec4a77), {
|
|
847
847
|
api: api,
|
|
848
848
|
map: map,
|
|
849
849
|
diff: diff
|
|
@@ -852,17 +852,17 @@ function $0d2428b0f4f06ed5$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
852
852
|
})
|
|
853
853
|
});
|
|
854
854
|
}
|
|
855
|
-
function $
|
|
855
|
+
function $59d44c8f30c12966$var$getBounds(fromValue, toValue, api) {
|
|
856
856
|
return new api.LatLngBounds().extend(fromValue).extend(toValue);
|
|
857
857
|
}
|
|
858
|
-
function $
|
|
858
|
+
function $59d44c8f30c12966$var$getCenter(diff, api) {
|
|
859
859
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
860
|
-
if (fromValue && toValue) return $
|
|
860
|
+
if (fromValue && toValue) return $59d44c8f30c12966$var$getBounds(fromValue, toValue, api).getCenter().toJSON();
|
|
861
861
|
if (fromValue) return fromValue;
|
|
862
862
|
if (toValue) return toValue;
|
|
863
863
|
throw new Error("Neither a from or a to value present");
|
|
864
864
|
}
|
|
865
|
-
function $
|
|
865
|
+
function $59d44c8f30c12966$var$getAction(diff) {
|
|
866
866
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
867
867
|
if (fromValue && toValue) return "Moved";
|
|
868
868
|
else if (fromValue) return "Removed";
|
|
@@ -871,28 +871,31 @@ function $0d2428b0f4f06ed5$var$getAction(diff) {
|
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
|
|
874
|
-
const $
|
|
875
|
-
|
|
876
|
-
...props,
|
|
877
|
-
geoConfig: config
|
|
878
|
-
});
|
|
879
|
-
(0, $0848d639be0f4989$export$a9c6c3563e9053d)(config);
|
|
874
|
+
const $329a1cedcedb1349$export$626ae7d0cf8f9143 = (0, $dyHF6$sanity.createPlugin)((config)=>{
|
|
875
|
+
(0, $28797477c09ece12$export$a9c6c3563e9053d)(config);
|
|
880
876
|
return {
|
|
881
877
|
name: "google-maps-input",
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
return
|
|
878
|
+
form: {
|
|
879
|
+
renderInput: (props)=>{
|
|
880
|
+
if ($329a1cedcedb1349$var$isGeopoint(props.schemaType)) {
|
|
881
|
+
const castedProps = props;
|
|
882
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $6c4d418093d85b71$export$2e2bcd8739ae039), {
|
|
883
|
+
...castedProps,
|
|
884
|
+
geoConfig: config
|
|
885
|
+
});
|
|
887
886
|
}
|
|
887
|
+
return undefined;
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
890
|
};
|
|
891
891
|
});
|
|
892
|
-
function $
|
|
892
|
+
function $329a1cedcedb1349$var$isGeopoint(schemaType) {
|
|
893
|
+
return $329a1cedcedb1349$var$isType("geopoint", schemaType);
|
|
894
|
+
}
|
|
895
|
+
function $329a1cedcedb1349$var$isType(name, schema) {
|
|
893
896
|
if (schema?.name === name) return true;
|
|
894
897
|
else if (!schema?.name) return false;
|
|
895
|
-
return $
|
|
898
|
+
return $329a1cedcedb1349$var$isType(name, schema?.type);
|
|
896
899
|
}
|
|
897
900
|
|
|
898
901
|
|