@ttoss/google-maps 1.24.4 → 1.24.6
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 +1 -3
- package/dist/index.d.mts +78 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
Install `@ttoss/google-maps` in your project:
|
|
8
8
|
|
|
9
9
|
```shell
|
|
10
|
-
$
|
|
11
|
-
# or
|
|
12
|
-
$ npm install @ttoss/google-maps
|
|
10
|
+
$ pnpm install @ttoss/google-maps
|
|
13
11
|
```
|
|
14
12
|
|
|
15
13
|
If you use TypeScript, add the following to a declaration file (generally `typings.d.ts`):
|
package/dist/index.d.mts
ADDED
|
@@ -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.
|
|
3
|
+
"version": "1.24.6",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -22,18 +22,18 @@
|
|
|
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.
|
|
25
|
+
"@ttoss/react-hooks": "^1.23.6"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.8.0",
|
|
29
29
|
"react-dom": ">=16.8.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "^18.2.
|
|
33
|
-
"jest": "^29.
|
|
34
|
-
"tsup": "^
|
|
35
|
-
"@ttoss/config": "^1.30.
|
|
36
|
-
"@ttoss/test-utils": "^1.23.
|
|
32
|
+
"@types/react": "^18.2.12",
|
|
33
|
+
"jest": "^29.6.1",
|
|
34
|
+
"tsup": "^7.1.0",
|
|
35
|
+
"@ttoss/config": "^1.30.5",
|
|
36
|
+
"@ttoss/test-utils": "^1.23.6"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public",
|