@ttoss/google-maps 1.21.1 → 1.22.0

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 CHANGED
@@ -46,10 +46,7 @@ var GoogleMapsProvider = ({
46
46
  googleMaps: null
47
47
  };
48
48
  }, [googleMaps, status]);
49
- return /* @__PURE__ */ jsx(GoogleMapsContext.Provider, {
50
- value,
51
- children
52
- });
49
+ return /* @__PURE__ */ jsx(GoogleMapsContext.Provider, { value, children });
53
50
  };
54
51
  var useGoogleMaps = () => React2.useContext(GoogleMapsContext);
55
52
 
@@ -152,7 +149,7 @@ var usePlacesAutocomplete = ({
152
149
  return;
153
150
  }
154
151
  const { current: gMaps } = googleMapsRef;
155
- const placesLib = (gMaps == null ? void 0 : gMaps.places) || googleMaps.places;
152
+ const placesLib = gMaps?.places || googleMaps.places;
156
153
  if (!placesLib) {
157
154
  return;
158
155
  }
@@ -170,7 +167,6 @@ var usePlacesAutocomplete = ({
170
167
  }, []);
171
168
  const fetchPredictions = useCallback(
172
169
  debounce_default((val) => {
173
- var _a;
174
170
  if (!val) {
175
171
  clearSuggestions();
176
172
  return;
@@ -199,7 +195,7 @@ var usePlacesAutocomplete = ({
199
195
  return;
200
196
  }
201
197
  }
202
- (_a = asRef == null ? void 0 : asRef.current) == null ? void 0 : _a.getPlacePredictions(
198
+ asRef?.current?.getPlacePredictions(
203
199
  { ...requestOptionsRef.current, input: val },
204
200
  (data, status) => {
205
201
  setSuggestions({ loading: false, status, data: data || [] });
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { ScriptStatus } from '@ttoss/hooks';
3
3
 
4
- declare type Extends<T, U extends T> = U;
5
- declare type GoogleMaps = typeof google.maps;
6
- declare type LoadedMapsStatus = Extends<ScriptStatus, 'ready'>;
7
- declare type NotLoadedMapStatus = Extends<ScriptStatus, 'idle' | 'error' | 'loading'>;
8
- declare type Libraries = 'places' | 'visualization' | 'drawing' | 'geometry';
4
+ type Extends<T, U extends T> = U;
5
+ type GoogleMaps = typeof google.maps;
6
+ type LoadedMapsStatus = Extends<ScriptStatus, 'ready'>;
7
+ type NotLoadedMapStatus = Extends<ScriptStatus, 'idle' | 'error' | 'loading'>;
8
+ type Libraries = 'places' | 'visualization' | 'drawing' | 'geometry';
9
9
  declare const GoogleMapsProvider: ({ children, apiKey, libraries, language, }: {
10
10
  children: React.ReactNode;
11
11
  apiKey: string;
@@ -53,8 +53,8 @@ interface HookArgs {
53
53
  defaultValue?: string;
54
54
  initOnMount?: boolean;
55
55
  }
56
- declare type Suggestion = google.maps.places.AutocompletePrediction;
57
- declare type Status = `${google.maps.places.PlacesServiceStatus}` | '';
56
+ type Suggestion = google.maps.places.AutocompletePrediction;
57
+ type Status = `${google.maps.places.PlacesServiceStatus}` | '';
58
58
  interface Suggestions {
59
59
  readonly loading: boolean;
60
60
  readonly status: Status;
package/dist/index.js CHANGED
@@ -81,10 +81,7 @@ var GoogleMapsProvider = ({
81
81
  googleMaps: null
82
82
  };
83
83
  }, [googleMaps, status]);
84
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GoogleMapsContext.Provider, {
85
- value,
86
- children
87
- });
84
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GoogleMapsContext.Provider, { value, children });
88
85
  };
89
86
  var useGoogleMaps = () => React2.useContext(GoogleMapsContext);
90
87
 
@@ -187,7 +184,7 @@ var usePlacesAutocomplete = ({
187
184
  return;
188
185
  }
189
186
  const { current: gMaps } = googleMapsRef;
190
- const placesLib = (gMaps == null ? void 0 : gMaps.places) || googleMaps.places;
187
+ const placesLib = gMaps?.places || googleMaps.places;
191
188
  if (!placesLib) {
192
189
  return;
193
190
  }
@@ -205,7 +202,6 @@ var usePlacesAutocomplete = ({
205
202
  }, []);
206
203
  const fetchPredictions = (0, import_react2.useCallback)(
207
204
  debounce_default((val) => {
208
- var _a;
209
205
  if (!val) {
210
206
  clearSuggestions();
211
207
  return;
@@ -234,7 +230,7 @@ var usePlacesAutocomplete = ({
234
230
  return;
235
231
  }
236
232
  }
237
- (_a = asRef == null ? void 0 : asRef.current) == null ? void 0 : _a.getPlacePredictions(
233
+ asRef?.current?.getPlacePredictions(
238
234
  { ...requestOptionsRef.current, input: val },
239
235
  (data, status) => {
240
236
  setSuggestions({ loading: false, status, data: data || [] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/google-maps",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "typings": "dist/index.d.ts",
21
21
  "dependencies": {
22
- "@ttoss/hooks": "^1.20.11",
22
+ "@ttoss/hooks": "^1.21.0",
23
23
  "@types/google.maps": "^3.49.2",
24
24
  "use-callback-ref": "^1.3.0"
25
25
  },
@@ -28,11 +28,11 @@
28
28
  "react-dom": ">=16.8.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@ttoss/config": "^1.22.0",
32
- "@ttoss/test-utils": "^1.18.2"
31
+ "@ttoss/config": "^1.26.0",
32
+ "@ttoss/test-utils": "^1.19.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "cc3a87107b90fd346c908783beb6481f883e3f1a"
37
+ "gitHead": "98cf227311c2f28ab73520c793bfe0bf0df27530"
38
38
  }