@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 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
  ![Google maps input](assets/google-maps-input.png)
12
12
 
13
- ## Know issues in Studio V3
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
- Note: This plugin will replace the default `geopoint` input component.
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
+ ![Google maps input](assets/google-maps-input.png)
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
+ ![Google maps input](assets/google-maps-radius-input.png)
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