@sanity/google-maps-input 4.1.1 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -3
- package/dist/index.cjs +483 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +484 -74
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/diff/GeopointMove.tsx +2 -2
- package/src/diff/GeopointRadiusFieldDiff.tsx +136 -0
- package/src/diff/GeopointRadiusMove.tsx +92 -0
- package/src/diff/resolver.ts +5 -0
- package/src/index.ts +13 -1
- package/src/input/GeopointRadiusInput.tsx +258 -0
- package/src/input/GeopointRadiusSelect.tsx +193 -0
- package/src/plugin.tsx +57 -1
- package/src/types.ts +17 -0
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
Plugin for [Sanity Studio](https://www.sanity.io) providing input handlers for geo-related input types using Google Maps.
|
|
8
8
|
|
|
9
|
-
This plugin will replace the default `geopoint` input component.
|
|
9
|
+
This plugin will replace the default `geopoint` input component and adds support for `geopointRadius` fields with circle visualization.
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Known issues in Studio V3
|
|
14
14
|
|
|
15
15
|
- Diff-preview is not implemented.
|
|
16
16
|
|
|
@@ -34,6 +34,9 @@ yarn add @sanity/google-maps-input
|
|
|
34
34
|
|
|
35
35
|
Add it as a plugin in sanity.config.ts (or .js), with a valid [Google Maps API key](https://developers.google.com/maps/documentation/javascript/get-api-key):
|
|
36
36
|
|
|
37
|
+
> [!WARNING]
|
|
38
|
+
> This plugin will replace the default `geopoint` input component.
|
|
39
|
+
|
|
37
40
|
```js
|
|
38
41
|
import {googleMapsInput} from '@sanity/google-maps-input'
|
|
39
42
|
|
|
@@ -55,7 +58,62 @@ Ensure that the key has access to:
|
|
|
55
58
|
|
|
56
59
|
And that the key allows web-access from the Studio URL(s) you are using the plugin in.
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
### Configuration Options
|
|
62
|
+
|
|
63
|
+
You can also configure additional options:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import {googleMapsInput} from '@sanity/google-maps-input'
|
|
67
|
+
|
|
68
|
+
export default defineConfig({
|
|
69
|
+
// ...
|
|
70
|
+
plugins: [
|
|
71
|
+
googleMapsInput({
|
|
72
|
+
apiKey: 'my-api-key',
|
|
73
|
+
defaultZoom: 8,
|
|
74
|
+
defaultRadiusZoom: 15, // zoom level for radius editing
|
|
75
|
+
defaultLocation: {lat: 59.91273, lng: 10.74609},
|
|
76
|
+
defaultRadius: 1000, // for geopointRadius fields
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Field Types
|
|
83
|
+
|
|
84
|
+
#### Basic Geopoint Field
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// In your schema
|
|
90
|
+
export default {
|
|
91
|
+
name: 'location',
|
|
92
|
+
title: 'Location',
|
|
93
|
+
type: 'geopoint',
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Geopoint Radius Field
|
|
98
|
+
|
|
99
|
+

|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// In your schema
|
|
103
|
+
export default {
|
|
104
|
+
name: 'serviceArea',
|
|
105
|
+
title: 'Service Area',
|
|
106
|
+
type: 'geopointRadius',
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The `geopointRadius` field type extends the basic geopoint with:
|
|
111
|
+
|
|
112
|
+
- A radius property (in meters)
|
|
113
|
+
- Visual circle overlay on the map
|
|
114
|
+
- Editable radius input field
|
|
115
|
+
- Draggable circle for radius adjustment
|
|
116
|
+
- Enhanced diff visualization showing radius changes
|
|
59
117
|
|
|
60
118
|
## Stuck? Get help
|
|
61
119
|
|