@ttoss/google-maps 2.1.11 → 2.1.13
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/dist/esm/index.js +44 -44
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
4
|
+
value,
|
|
5
|
+
configurable: true
|
|
6
|
+
});
|
|
2
7
|
|
|
3
8
|
// src/GoogleMapsProvider.tsx
|
|
4
9
|
import * as React from "react";
|
|
5
10
|
import { useScript } from "@ttoss/react-hooks";
|
|
6
|
-
|
|
7
|
-
var GoogleMapsContext = React.createContext({
|
|
11
|
+
var GoogleMapsContext = /* @__PURE__ */React.createContext({
|
|
8
12
|
status: "idle",
|
|
9
13
|
google: {
|
|
10
14
|
maps: null
|
|
11
15
|
}
|
|
12
16
|
});
|
|
13
|
-
var DefaultScript = ({
|
|
17
|
+
var DefaultScript = /* @__PURE__ */__name(({
|
|
14
18
|
src,
|
|
15
19
|
onReady
|
|
16
20
|
}) => {
|
|
@@ -23,8 +27,8 @@ var DefaultScript = ({
|
|
|
23
27
|
}
|
|
24
28
|
}, [status, onReady]);
|
|
25
29
|
return null;
|
|
26
|
-
};
|
|
27
|
-
var GoogleMapsProvider = ({
|
|
30
|
+
}, "DefaultScript");
|
|
31
|
+
var GoogleMapsProvider = /* @__PURE__ */__name(({
|
|
28
32
|
children,
|
|
29
33
|
apiKey,
|
|
30
34
|
loading = "async",
|
|
@@ -69,40 +73,35 @@ var GoogleMapsProvider = ({
|
|
|
69
73
|
}
|
|
70
74
|
};
|
|
71
75
|
}, [google, status]);
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})]
|
|
83
|
-
});
|
|
84
|
-
};
|
|
76
|
+
return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Script, {
|
|
77
|
+
src,
|
|
78
|
+
onReady: /* @__PURE__ */__name(() => {
|
|
79
|
+
return setStatus("ready");
|
|
80
|
+
}, "onReady"),
|
|
81
|
+
onError
|
|
82
|
+
}), /* @__PURE__ */React.createElement(GoogleMapsContext.Provider, {
|
|
83
|
+
value
|
|
84
|
+
}, children));
|
|
85
|
+
}, "GoogleMapsProvider");
|
|
85
86
|
|
|
86
87
|
// src/MapProvider.tsx
|
|
87
88
|
import * as React2 from "react";
|
|
88
|
-
|
|
89
|
-
var MapContext = React2.createContext({
|
|
89
|
+
var MapContext = /* @__PURE__ */React2.createContext({
|
|
90
90
|
map: null,
|
|
91
91
|
ref: {
|
|
92
92
|
current: null
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
|
-
var MapProvider = React2.forwardRef(({
|
|
95
|
+
var MapProvider = /* @__PURE__ */React2.forwardRef(({
|
|
96
96
|
children,
|
|
97
97
|
map
|
|
98
98
|
}, ref) => {
|
|
99
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */React2.createElement(MapContext.Provider, {
|
|
100
100
|
value: {
|
|
101
101
|
map,
|
|
102
102
|
ref
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
});
|
|
103
|
+
}
|
|
104
|
+
}, children);
|
|
106
105
|
});
|
|
107
106
|
MapProvider.displayName = "MapProvider";
|
|
108
107
|
|
|
@@ -111,7 +110,7 @@ import * as React4 from "react";
|
|
|
111
110
|
|
|
112
111
|
// src/useGoogleMaps.ts
|
|
113
112
|
import * as React3 from "react";
|
|
114
|
-
var useGoogleMaps = () => {
|
|
113
|
+
var useGoogleMaps = /* @__PURE__ */__name(() => {
|
|
115
114
|
const {
|
|
116
115
|
status,
|
|
117
116
|
google
|
|
@@ -122,14 +121,14 @@ var useGoogleMaps = () => {
|
|
|
122
121
|
status,
|
|
123
122
|
google,
|
|
124
123
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
* @deprecated Use google.maps instead.
|
|
125
|
+
*/
|
|
127
126
|
googleMaps: google.maps
|
|
128
127
|
};
|
|
129
|
-
};
|
|
128
|
+
}, "useGoogleMaps");
|
|
130
129
|
|
|
131
130
|
// src/useGeocoder.ts
|
|
132
|
-
var useGeocoder = () => {
|
|
131
|
+
var useGeocoder = /* @__PURE__ */__name(() => {
|
|
133
132
|
const {
|
|
134
133
|
google
|
|
135
134
|
} = useGoogleMaps();
|
|
@@ -146,12 +145,12 @@ var useGeocoder = () => {
|
|
|
146
145
|
geocoder,
|
|
147
146
|
isGeocoderInitialized
|
|
148
147
|
};
|
|
149
|
-
};
|
|
148
|
+
}, "useGeocoder");
|
|
150
149
|
|
|
151
150
|
// src/useMap.ts
|
|
152
151
|
import * as React5 from "react";
|
|
153
152
|
import { useCallbackRef } from "use-callback-ref";
|
|
154
|
-
var useMap = (options = {}) => {
|
|
153
|
+
var useMap = /* @__PURE__ */__name((options = {}) => {
|
|
155
154
|
const [, forceUpdate] = React5.useState(0);
|
|
156
155
|
const ref = useCallbackRef(null, () => {
|
|
157
156
|
return forceUpdate(n => {
|
|
@@ -188,30 +187,30 @@ var useMap = (options = {}) => {
|
|
|
188
187
|
}, [optionsStringify, map]);
|
|
189
188
|
return {
|
|
190
189
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
* Returns the map object which provides access to the [Google Maps API](https://developers.google.com/maps/documentation/javascript/overview).
|
|
191
|
+
*/
|
|
193
192
|
map,
|
|
194
193
|
/**
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
* Returns the ref object which provides access to the HTMLDivElement element
|
|
195
|
+
* that the map is rendered in.
|
|
196
|
+
*/
|
|
198
197
|
ref
|
|
199
198
|
};
|
|
200
|
-
};
|
|
199
|
+
}, "useMap");
|
|
201
200
|
|
|
202
201
|
// src/usePlacesAutocomplete/index.ts
|
|
203
202
|
import * as React7 from "react";
|
|
204
203
|
|
|
205
204
|
// src/usePlacesAutocomplete/useLatest.ts
|
|
206
205
|
import * as React6 from "react";
|
|
207
|
-
var useLatest = val => {
|
|
206
|
+
var useLatest = /* @__PURE__ */__name(val => {
|
|
208
207
|
const ref = React6.useRef(val);
|
|
209
208
|
ref.current = val;
|
|
210
209
|
return ref;
|
|
211
|
-
};
|
|
210
|
+
}, "useLatest");
|
|
212
211
|
|
|
213
212
|
// src/usePlacesAutocomplete/debounce.ts
|
|
214
|
-
var debounce = (fn, delay) => {
|
|
213
|
+
var debounce = /* @__PURE__ */__name((fn, delay) => {
|
|
215
214
|
let timer;
|
|
216
215
|
function debounceFn(...args) {
|
|
217
216
|
if (timer !== null) {
|
|
@@ -220,12 +219,13 @@ var debounce = (fn, delay) => {
|
|
|
220
219
|
}
|
|
221
220
|
timer = setTimeout(() => fn.apply(this, args), delay);
|
|
222
221
|
}
|
|
222
|
+
__name(debounceFn, "debounceFn");
|
|
223
223
|
return debounceFn;
|
|
224
|
-
};
|
|
224
|
+
}, "debounce");
|
|
225
225
|
var debounce_default = debounce;
|
|
226
226
|
|
|
227
227
|
// src/usePlacesAutocomplete/index.ts
|
|
228
|
-
var usePlacesAutocomplete = ({
|
|
228
|
+
var usePlacesAutocomplete = /* @__PURE__ */__name(({
|
|
229
229
|
requestOptions,
|
|
230
230
|
debounce: debounce2 = 200,
|
|
231
231
|
cache = 24 * 60 * 60,
|
|
@@ -360,5 +360,5 @@ var usePlacesAutocomplete = ({
|
|
|
360
360
|
clearCache,
|
|
361
361
|
init
|
|
362
362
|
};
|
|
363
|
-
};
|
|
363
|
+
}, "usePlacesAutocomplete");
|
|
364
364
|
export { GoogleMapsProvider, MapProvider, useGeocoder, useGoogleMaps, useMap, usePlacesAutocomplete };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/google-maps",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"use-callback-ref": "^1.3.2",
|
|
27
|
-
"@ttoss/react-hooks": "^2.1.
|
|
27
|
+
"@ttoss/react-hooks": "^2.1.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.8.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"jest": "^30.0.4",
|
|
37
37
|
"react": "^19.1.0",
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
|
-
"@ttoss/
|
|
40
|
-
"@ttoss/
|
|
39
|
+
"@ttoss/test-utils": "^2.1.28",
|
|
40
|
+
"@ttoss/config": "^1.35.8"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"Google",
|