@sanity/google-maps-input 3.0.0-studio-v3.0 → 3.0.0-v3-studio.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/README.md +7 -0
- package/lib/cjs/index.js +188 -187
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +185 -184
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/index.tsx +12 -11
- package/src/input/GeopointInput.tsx +5 -7
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,82 @@ 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
|
-
const { value: value , readOnly: readOnly ,
|
|
538
|
+
const { value: value , readOnly: readOnly , geoConfig: config , path: path , changed: changed , focused: focused } = 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, $
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
alt: "Map location"
|
|
580
|
-
})
|
|
572
|
+
value && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanity_unstable.ChangeIndicator), {
|
|
573
|
+
path: path,
|
|
574
|
+
isChanged: changed,
|
|
575
|
+
hasFocus: !!focused,
|
|
576
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $116268a9005e03a0$export$1c4ad7c095d42d37), {
|
|
577
|
+
src: $6c4d418093d85b71$var$getStaticImageUrl(value, config.apiKey),
|
|
578
|
+
alt: "Map location"
|
|
581
579
|
})
|
|
582
580
|
}),
|
|
583
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
581
|
+
!readOnly && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Box), {
|
|
584
582
|
marginTop: 4,
|
|
585
|
-
children: /*#__PURE__*/ (0, $
|
|
583
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$sanityui.Grid), {
|
|
586
584
|
columns: 2,
|
|
587
585
|
gap: 2,
|
|
588
586
|
children: [
|
|
589
|
-
/*#__PURE__*/ (0, $
|
|
587
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
|
|
590
588
|
mode: "ghost",
|
|
591
|
-
icon: value && (0, $
|
|
589
|
+
icon: value && (0, $dyHF6$sanityicons.EditIcon),
|
|
592
590
|
padding: 3,
|
|
593
591
|
ref: this.setEditButton,
|
|
594
592
|
text: value ? "Edit" : "Set location",
|
|
595
593
|
onClick: this.handleToggleModal
|
|
596
594
|
}),
|
|
597
|
-
value && /*#__PURE__*/ (0, $
|
|
595
|
+
value && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Button), {
|
|
598
596
|
tone: "critical",
|
|
599
|
-
icon: (0, $
|
|
597
|
+
icon: (0, $dyHF6$sanityicons.TrashIcon),
|
|
600
598
|
padding: 3,
|
|
601
599
|
mode: "ghost",
|
|
602
600
|
text: "Remove",
|
|
@@ -605,15 +603,15 @@ class $8db4b9a0111ad863$var$GeopointInput extends (0, ($parcel$interopDefault($7
|
|
|
605
603
|
]
|
|
606
604
|
})
|
|
607
605
|
}),
|
|
608
|
-
modalOpen && /*#__PURE__*/ (0, $
|
|
606
|
+
modalOpen && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanityui.Dialog), {
|
|
609
607
|
id: `${this._geopointInputId}_dialog`,
|
|
610
608
|
onClose: this.handleCloseModal,
|
|
611
609
|
header: "Place the marker on the map",
|
|
612
610
|
width: 1,
|
|
613
|
-
children: /*#__PURE__*/ (0, $
|
|
614
|
-
children: /*#__PURE__*/ (0, $
|
|
615
|
-
config: (0, $
|
|
616
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
611
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $116268a9005e03a0$export$ffa61c425f593078), {
|
|
612
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
613
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
614
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a24f16af03c18a4b$export$9a2476e65b6b92a7), {
|
|
617
615
|
api: api,
|
|
618
616
|
value: value || undefined,
|
|
619
617
|
onChange: readOnly ? undefined : this.handleChange,
|
|
@@ -627,7 +625,7 @@ class $8db4b9a0111ad863$var$GeopointInput extends (0, ($parcel$interopDefault($7
|
|
|
627
625
|
});
|
|
628
626
|
}
|
|
629
627
|
}
|
|
630
|
-
var $
|
|
628
|
+
var $6c4d418093d85b71$export$2e2bcd8739ae039 = $6c4d418093d85b71$var$GeopointInput;
|
|
631
629
|
|
|
632
630
|
|
|
633
631
|
|
|
@@ -641,7 +639,7 @@ var $8db4b9a0111ad863$export$2e2bcd8739ae039 = $8db4b9a0111ad863$var$GeopointInp
|
|
|
641
639
|
|
|
642
640
|
|
|
643
641
|
|
|
644
|
-
class $
|
|
642
|
+
class $2336979407935278$export$21b07c8f274aebd5 extends $dyHF6$react.PureComponent {
|
|
645
643
|
eventHandlers = {};
|
|
646
644
|
componentDidMount() {
|
|
647
645
|
const { from: from , to: to , api: api , map: map , zIndex: zIndex , onClick: onClick , color: color , arrowRef: arrowRef } = this.props;
|
|
@@ -670,7 +668,7 @@ class $4b644fd7176653a0$export$21b07c8f274aebd5 extends $7xGut$react.PureCompone
|
|
|
670
668
|
componentDidUpdate(prevProps) {
|
|
671
669
|
if (!this.line) return;
|
|
672
670
|
const { from: from , to: to , map: map } = this.props;
|
|
673
|
-
if (!(0, $
|
|
671
|
+
if (!(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.from, from) || !(0, $97ec7b8b370674b5$export$ad553d4d3a617f20)(prevProps.to, to)) this.line.setPath([
|
|
674
672
|
from,
|
|
675
673
|
to
|
|
676
674
|
]);
|
|
@@ -687,15 +685,15 @@ class $4b644fd7176653a0$export$21b07c8f274aebd5 extends $7xGut$react.PureCompone
|
|
|
687
685
|
}
|
|
688
686
|
|
|
689
687
|
|
|
690
|
-
function $
|
|
688
|
+
function $a4e9fc866b2a477c$export$f432217b31ec4a77({ diff: diff , api: api , map: map , label: label }) {
|
|
691
689
|
const { fromValue: from , toValue: to } = diff;
|
|
692
690
|
const annotation = diff.isChanged ? diff.annotation : undefined;
|
|
693
|
-
const userColor = (0, $
|
|
694
|
-
const fromRef = $
|
|
695
|
-
const toRef = $
|
|
696
|
-
return /*#__PURE__*/ (0, $
|
|
691
|
+
const userColor = (0, $dyHF6$sanity_unstable.useUserColor)(annotation ? annotation.author : null) || undefined;
|
|
692
|
+
const fromRef = $dyHF6$react.useRef();
|
|
693
|
+
const toRef = $dyHF6$react.useRef();
|
|
694
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsxs)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
697
695
|
children: [
|
|
698
|
-
from && /*#__PURE__*/ (0, $
|
|
696
|
+
from && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $03ff3d51ebf52598$export$e98856a975cab58e), {
|
|
699
697
|
api: api,
|
|
700
698
|
map: map,
|
|
701
699
|
position: from,
|
|
@@ -704,7 +702,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
704
702
|
markerRef: fromRef,
|
|
705
703
|
color: userColor
|
|
706
704
|
}),
|
|
707
|
-
from && to && /*#__PURE__*/ (0, $
|
|
705
|
+
from && to && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $2336979407935278$export$21b07c8f274aebd5), {
|
|
708
706
|
api: api,
|
|
709
707
|
map: map,
|
|
710
708
|
from: from,
|
|
@@ -712,7 +710,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
712
710
|
zIndex: 1,
|
|
713
711
|
color: userColor
|
|
714
712
|
}),
|
|
715
|
-
to && /*#__PURE__*/ (0, $
|
|
713
|
+
to && /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $03ff3d51ebf52598$export$e98856a975cab58e), {
|
|
716
714
|
api: api,
|
|
717
715
|
map: map,
|
|
718
716
|
position: to,
|
|
@@ -727,7 +725,7 @@ function $b34aac1f51c2458a$export$f432217b31ec4a77({ diff: diff , api: api , map
|
|
|
727
725
|
|
|
728
726
|
|
|
729
727
|
|
|
730
|
-
const $
|
|
728
|
+
const $c02dd8e49e4bafdc$export$35b4f62b8f8d707c = (0, ($parcel$interopDefault($dyHF6$styledcomponents))).div`
|
|
731
729
|
position: relative;
|
|
732
730
|
min-height: 200px;
|
|
733
731
|
|
|
@@ -748,11 +746,11 @@ const $a77259f4ed6ec9ac$export$35b4f62b8f8d707c = (0, ($parcel$interopDefault($7
|
|
|
748
746
|
|
|
749
747
|
|
|
750
748
|
|
|
751
|
-
const $
|
|
752
|
-
return /*#__PURE__*/ (0, $
|
|
753
|
-
children: /*#__PURE__*/ (0, $
|
|
754
|
-
config: (0, $
|
|
755
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
749
|
+
const $5245dd3554e263be$export$2d0695678527b4cc = ({ diff: diff , schemaType: schemaType })=>{
|
|
750
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $c02dd8e49e4bafdc$export$35b4f62b8f8d707c), {
|
|
751
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
752
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
753
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($5245dd3554e263be$var$GeopointDiff, {
|
|
756
754
|
api: api,
|
|
757
755
|
diff: diff,
|
|
758
756
|
schemaType: schemaType
|
|
@@ -760,21 +758,21 @@ const $877f5a72c2824857$export$2d0695678527b4cc = ({ diff: diff , schemaType: sc
|
|
|
760
758
|
})
|
|
761
759
|
});
|
|
762
760
|
};
|
|
763
|
-
function $
|
|
764
|
-
const fromValue = (diff.fromValue || []).filter($
|
|
765
|
-
const toValue = (diff.toValue || []).filter($
|
|
761
|
+
function $5245dd3554e263be$var$GeopointDiff({ api: api , diff: diff }) {
|
|
762
|
+
const fromValue = (diff.fromValue || []).filter($5245dd3554e263be$var$hasCoordinates);
|
|
763
|
+
const toValue = (diff.toValue || []).filter($5245dd3554e263be$var$hasCoordinates);
|
|
766
764
|
if (fromValue.length === 0 && toValue.length === 0) return null;
|
|
767
|
-
const bounds = $
|
|
768
|
-
return /*#__PURE__*/ (0, $
|
|
765
|
+
const bounds = $5245dd3554e263be$var$getBounds(fromValue, toValue, api);
|
|
766
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $b4ba0a9d820dad94$export$4ad1bae46276c5ce), {
|
|
769
767
|
api: api,
|
|
770
768
|
location: bounds.getCenter().toJSON(),
|
|
771
769
|
mapTypeControl: false,
|
|
772
770
|
controlSize: 20,
|
|
773
771
|
bounds: bounds,
|
|
774
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
772
|
+
children: (map)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
775
773
|
children: diff.items.map(({ toIndex: toIndex , diff: pointDiff })=>{
|
|
776
|
-
if (!$
|
|
777
|
-
return /*#__PURE__*/ (0, $
|
|
774
|
+
if (!$5245dd3554e263be$var$isChangeDiff(pointDiff)) return null;
|
|
775
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a4e9fc866b2a477c$export$f432217b31ec4a77), {
|
|
778
776
|
api: api,
|
|
779
777
|
map: map,
|
|
780
778
|
diff: pointDiff,
|
|
@@ -784,13 +782,13 @@ function $877f5a72c2824857$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
784
782
|
})
|
|
785
783
|
});
|
|
786
784
|
}
|
|
787
|
-
function $
|
|
785
|
+
function $5245dd3554e263be$var$isChangeDiff(diff) {
|
|
788
786
|
return diff.action !== "unchanged" && diff.type === "object";
|
|
789
787
|
}
|
|
790
|
-
function $
|
|
788
|
+
function $5245dd3554e263be$var$hasCoordinates(point) {
|
|
791
789
|
return typeof point.lat === "number" && typeof point.lng === "number";
|
|
792
790
|
}
|
|
793
|
-
function $
|
|
791
|
+
function $5245dd3554e263be$var$getBounds(fromValue, toValue, api) {
|
|
794
792
|
const bounds = new api.LatLngBounds();
|
|
795
793
|
const points = [
|
|
796
794
|
...fromValue || [],
|
|
@@ -809,11 +807,11 @@ function $877f5a72c2824857$var$getBounds(fromValue, toValue, api) {
|
|
|
809
807
|
|
|
810
808
|
|
|
811
809
|
|
|
812
|
-
const $
|
|
813
|
-
return /*#__PURE__*/ (0, $
|
|
814
|
-
children: /*#__PURE__*/ (0, $
|
|
815
|
-
config: (0, $
|
|
816
|
-
children: (api)=>/*#__PURE__*/ (0, $
|
|
810
|
+
const $59d44c8f30c12966$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: schemaType })=>{
|
|
811
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $c02dd8e49e4bafdc$export$35b4f62b8f8d707c), {
|
|
812
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $ffeb69a200895c22$export$a628545bcf173896), {
|
|
813
|
+
config: (0, $28797477c09ece12$export$ee3fba7cd2f8c355)(),
|
|
814
|
+
children: (api)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)($59d44c8f30c12966$var$GeopointDiff, {
|
|
817
815
|
api: api,
|
|
818
816
|
diff: diff,
|
|
819
817
|
schemaType: schemaType
|
|
@@ -821,29 +819,29 @@ const $0d2428b0f4f06ed5$export$6b7bf6aeccd8ac3f = ({ diff: diff , schemaType: sc
|
|
|
821
819
|
})
|
|
822
820
|
});
|
|
823
821
|
};
|
|
824
|
-
function $
|
|
822
|
+
function $59d44c8f30c12966$var$GeopointDiff({ api: api , diff: diff }) {
|
|
825
823
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
826
|
-
const annotation = (0, $
|
|
824
|
+
const annotation = (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, [
|
|
827
825
|
"lat"
|
|
828
|
-
]) || (0, $
|
|
826
|
+
]) || (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, [
|
|
829
827
|
"lng"
|
|
830
|
-
]) || (0, $
|
|
831
|
-
const center = $
|
|
832
|
-
const bounds = fromValue && toValue ? $
|
|
833
|
-
return /*#__PURE__*/ (0, $
|
|
828
|
+
]) || (0, $dyHF6$sanity_unstable.getAnnotationAtPath)(diff, []);
|
|
829
|
+
const center = $59d44c8f30c12966$var$getCenter(diff, api);
|
|
830
|
+
const bounds = fromValue && toValue ? $59d44c8f30c12966$var$getBounds(fromValue, toValue, api) : undefined;
|
|
831
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$sanity_unstable.DiffTooltip), {
|
|
834
832
|
annotations: annotation ? [
|
|
835
833
|
annotation
|
|
836
834
|
] : [],
|
|
837
|
-
description: $
|
|
838
|
-
children: /*#__PURE__*/ (0, $
|
|
839
|
-
children: /*#__PURE__*/ (0, $
|
|
835
|
+
description: $59d44c8f30c12966$var$getAction(diff),
|
|
836
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("div", {
|
|
837
|
+
children: /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $b4ba0a9d820dad94$export$4ad1bae46276c5ce), {
|
|
840
838
|
api: api,
|
|
841
839
|
location: center,
|
|
842
840
|
mapTypeControl: false,
|
|
843
841
|
controlSize: 20,
|
|
844
842
|
bounds: bounds,
|
|
845
843
|
scrollWheel: false,
|
|
846
|
-
children: (map)=>/*#__PURE__*/ (0, $
|
|
844
|
+
children: (map)=>/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $a4e9fc866b2a477c$export$f432217b31ec4a77), {
|
|
847
845
|
api: api,
|
|
848
846
|
map: map,
|
|
849
847
|
diff: diff
|
|
@@ -852,17 +850,17 @@ function $0d2428b0f4f06ed5$var$GeopointDiff({ api: api , diff: diff }) {
|
|
|
852
850
|
})
|
|
853
851
|
});
|
|
854
852
|
}
|
|
855
|
-
function $
|
|
853
|
+
function $59d44c8f30c12966$var$getBounds(fromValue, toValue, api) {
|
|
856
854
|
return new api.LatLngBounds().extend(fromValue).extend(toValue);
|
|
857
855
|
}
|
|
858
|
-
function $
|
|
856
|
+
function $59d44c8f30c12966$var$getCenter(diff, api) {
|
|
859
857
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
860
|
-
if (fromValue && toValue) return $
|
|
858
|
+
if (fromValue && toValue) return $59d44c8f30c12966$var$getBounds(fromValue, toValue, api).getCenter().toJSON();
|
|
861
859
|
if (fromValue) return fromValue;
|
|
862
860
|
if (toValue) return toValue;
|
|
863
861
|
throw new Error("Neither a from or a to value present");
|
|
864
862
|
}
|
|
865
|
-
function $
|
|
863
|
+
function $59d44c8f30c12966$var$getAction(diff) {
|
|
866
864
|
const { fromValue: fromValue , toValue: toValue } = diff;
|
|
867
865
|
if (fromValue && toValue) return "Moved";
|
|
868
866
|
else if (fromValue) return "Removed";
|
|
@@ -871,28 +869,31 @@ function $0d2428b0f4f06ed5$var$getAction(diff) {
|
|
|
871
869
|
}
|
|
872
870
|
|
|
873
871
|
|
|
874
|
-
const $
|
|
875
|
-
|
|
876
|
-
...props,
|
|
877
|
-
geoConfig: config
|
|
878
|
-
});
|
|
879
|
-
(0, $0848d639be0f4989$export$a9c6c3563e9053d)(config);
|
|
872
|
+
const $329a1cedcedb1349$export$626ae7d0cf8f9143 = (0, $dyHF6$sanity.createPlugin)((config)=>{
|
|
873
|
+
(0, $28797477c09ece12$export$a9c6c3563e9053d)(config);
|
|
880
874
|
return {
|
|
881
875
|
name: "google-maps-input",
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
return
|
|
876
|
+
form: {
|
|
877
|
+
renderInput: (props)=>{
|
|
878
|
+
if ($329a1cedcedb1349$var$isGeopoint(props.schemaType)) {
|
|
879
|
+
const castedProps = props;
|
|
880
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $6c4d418093d85b71$export$2e2bcd8739ae039), {
|
|
881
|
+
...castedProps,
|
|
882
|
+
geoConfig: config
|
|
883
|
+
});
|
|
887
884
|
}
|
|
885
|
+
return undefined;
|
|
888
886
|
}
|
|
889
887
|
}
|
|
890
888
|
};
|
|
891
889
|
});
|
|
892
|
-
function $
|
|
890
|
+
function $329a1cedcedb1349$var$isGeopoint(schemaType) {
|
|
891
|
+
return $329a1cedcedb1349$var$isType("geopoint", schemaType);
|
|
892
|
+
}
|
|
893
|
+
function $329a1cedcedb1349$var$isType(name, schema) {
|
|
893
894
|
if (schema?.name === name) return true;
|
|
894
895
|
else if (!schema?.name) return false;
|
|
895
|
-
return $
|
|
896
|
+
return $329a1cedcedb1349$var$isType(name, schema?.type);
|
|
896
897
|
}
|
|
897
898
|
|
|
898
899
|
|