@ttoss/google-maps 1.24.5 → 1.24.7

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.
Files changed (2) hide show
  1. package/dist/index.d.mts +78 -0
  2. package/package.json +6 -6
@@ -0,0 +1,78 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { ScriptStatus } from '@ttoss/react-hooks';
4
+
5
+ type Extends<T, U extends T> = U;
6
+ type GoogleMaps = typeof google.maps;
7
+ type LoadedMapsStatus = Extends<ScriptStatus, 'ready'>;
8
+ type NotLoadedMapStatus = Extends<ScriptStatus, 'idle' | 'error' | 'loading'>;
9
+ type Libraries = 'places' | 'visualization' | 'drawing' | 'geometry';
10
+ declare const GoogleMapsProvider: ({ children, apiKey, libraries, language, }: {
11
+ children: React.ReactNode;
12
+ apiKey: string;
13
+ libraries?: Libraries[] | undefined;
14
+ /**
15
+ * https://developers.google.com/maps/faq#languagesupport
16
+ */
17
+ language?: string | undefined;
18
+ }) => react_jsx_runtime.JSX.Element;
19
+ /**
20
+ *
21
+ * @returns param.googleMaps: GoogleMaps - returns the google maps object which
22
+ * provides access to the [Google Maps API](https://developers.google.com/maps/documentation/javascript/overview).
23
+ */
24
+ declare const useGoogleMaps: () => {
25
+ status: LoadedMapsStatus;
26
+ googleMaps: GoogleMaps;
27
+ } | {
28
+ status: NotLoadedMapStatus;
29
+ googleMaps: null;
30
+ };
31
+
32
+ declare const useGeocoder: () => {
33
+ geocoder: google.maps.Geocoder | null;
34
+ isGeocoderInitialized: boolean;
35
+ };
36
+
37
+ declare const useMap: (options?: google.maps.MapOptions) => {
38
+ /**
39
+ * asss
40
+ */
41
+ map: google.maps.Map | null;
42
+ /**
43
+ * hhhh
44
+ */
45
+ ref: React.MutableRefObject<HTMLDivElement | null>;
46
+ };
47
+
48
+ interface HookArgs {
49
+ requestOptions?: Omit<google.maps.places.AutocompletionRequest, 'input'>;
50
+ debounce?: number;
51
+ cache?: number | false;
52
+ cacheKey?: string;
53
+ callbackName?: string;
54
+ defaultValue?: string;
55
+ initOnMount?: boolean;
56
+ }
57
+ type Suggestion = google.maps.places.AutocompletePrediction;
58
+ type Status = `${google.maps.places.PlacesServiceStatus}` | '';
59
+ interface Suggestions {
60
+ readonly loading: boolean;
61
+ readonly status: Status;
62
+ data: Suggestion[];
63
+ }
64
+ interface SetValue {
65
+ (val: string, shouldFetchData?: boolean): void;
66
+ }
67
+ interface HookReturn {
68
+ ready: boolean;
69
+ value: string;
70
+ suggestions: Suggestions;
71
+ setValue: SetValue;
72
+ clearSuggestions: () => void;
73
+ clearCache: () => void;
74
+ init: () => void;
75
+ }
76
+ declare const usePlacesAutocomplete: ({ requestOptions, debounce, cache, cacheKey, callbackName, defaultValue, initOnMount, }?: HookArgs) => HookReturn;
77
+
78
+ export { GoogleMapsProvider, useGeocoder, useGoogleMaps, useMap, usePlacesAutocomplete };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/google-maps",
3
- "version": "1.24.5",
3
+ "version": "1.24.7",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@types/google.maps": "^3.49.2",
24
24
  "use-callback-ref": "^1.3.0",
25
- "@ttoss/react-hooks": "^1.23.5"
25
+ "@ttoss/react-hooks": "^1.23.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.8.0",
@@ -30,10 +30,10 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^18.2.12",
33
- "jest": "^29.5.0",
34
- "tsup": "^7.0.0",
35
- "@ttoss/config": "^1.30.4",
36
- "@ttoss/test-utils": "^1.23.5"
33
+ "jest": "^29.6.2",
34
+ "tsup": "^7.1.0",
35
+ "@ttoss/config": "^1.30.6",
36
+ "@ttoss/test-utils": "^1.23.7"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public",