@ttoss/google-maps 1.25.16 → 1.25.17
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 +5 -1
- package/dist/index.js +5 -1
- package/package.json +5 -4
- package/src/GoogleMapsProvider.spec.tsx +7 -5
- package/src/useGeocoder.ts +0 -1
- package/src/useMap.ts +5 -3
package/dist/esm/index.js
CHANGED
|
@@ -80,7 +80,11 @@ import * as React3 from "react";
|
|
|
80
80
|
import { useCallbackRef } from "use-callback-ref";
|
|
81
81
|
var useMap = (options = {}) => {
|
|
82
82
|
const [, forceUpdate] = React3.useState(0);
|
|
83
|
-
const ref = useCallbackRef(null, () =>
|
|
83
|
+
const ref = useCallbackRef(null, () => {
|
|
84
|
+
return forceUpdate(n => {
|
|
85
|
+
return n + 1;
|
|
86
|
+
});
|
|
87
|
+
});
|
|
84
88
|
const {
|
|
85
89
|
googleMaps
|
|
86
90
|
} = useGoogleMaps();
|
package/dist/index.js
CHANGED
|
@@ -126,7 +126,11 @@ var React3 = __toESM(require("react"));
|
|
|
126
126
|
var import_use_callback_ref = require("use-callback-ref");
|
|
127
127
|
var useMap = (options = {}) => {
|
|
128
128
|
const [, forceUpdate] = React3.useState(0);
|
|
129
|
-
const ref = (0, import_use_callback_ref.useCallbackRef)(null, () =>
|
|
129
|
+
const ref = (0, import_use_callback_ref.useCallbackRef)(null, () => {
|
|
130
|
+
return forceUpdate(n => {
|
|
131
|
+
return n + 1;
|
|
132
|
+
});
|
|
133
|
+
});
|
|
130
134
|
const {
|
|
131
135
|
googleMaps
|
|
132
136
|
} = useGoogleMaps();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/google-maps",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.17",
|
|
4
4
|
"author": "ttoss",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)",
|
|
@@ -25,18 +25,19 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/google.maps": "^3.54.10",
|
|
27
27
|
"use-callback-ref": "^1.3.0",
|
|
28
|
-
"@ttoss/react-hooks": "^1.25.
|
|
28
|
+
"@ttoss/react-hooks": "^1.25.10"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=16.8.0",
|
|
32
32
|
"react-dom": ">=16.8.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/react": "^18.
|
|
35
|
+
"@types/react": "^18.3.3",
|
|
36
36
|
"jest": "^29.7.0",
|
|
37
|
+
"react": "^18.3.1",
|
|
37
38
|
"tsup": "^8.0.2",
|
|
38
39
|
"@ttoss/config": "^1.32.4",
|
|
39
|
-
"@ttoss/test-utils": "^2.1.
|
|
40
|
+
"@ttoss/test-utils": "^2.1.8"
|
|
40
41
|
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public",
|
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
// },
|
|
9
9
|
// };
|
|
10
10
|
|
|
11
|
-
import { act, render, screen } from '@ttoss/test-utils';
|
|
12
|
-
|
|
13
11
|
import { GoogleMapsProvider, useGoogleMaps } from './';
|
|
12
|
+
import { act, render, screen } from '@ttoss/test-utils';
|
|
14
13
|
|
|
15
14
|
const mapObject = { map: 'object' };
|
|
16
15
|
const googleMock = {
|
|
17
16
|
maps: {
|
|
18
|
-
Map: jest.fn().mockImplementation(() =>
|
|
17
|
+
Map: jest.fn().mockImplementation(() => {
|
|
18
|
+
return mapObject;
|
|
19
|
+
}),
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -40,7 +41,7 @@ const loadEvent = new Event('load');
|
|
|
40
41
|
|
|
41
42
|
const apiKey = 'apiKey';
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
test('should display correct status', () => {
|
|
44
45
|
render(
|
|
45
46
|
<GoogleMapsProvider apiKey={apiKey}>
|
|
46
47
|
<RenderStatus />
|
|
@@ -56,7 +57,7 @@ it('should display correct status', () => {
|
|
|
56
57
|
expect(screen.getByText('ready')).toBeInTheDocument();
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
test.each([
|
|
60
61
|
[{ apiKey }, `https://maps.googleapis.com/maps/api/js?key=${apiKey}`],
|
|
61
62
|
[
|
|
62
63
|
{ apiKey, language: 'pt-BR' },
|
|
@@ -72,6 +73,7 @@ it.each([
|
|
|
72
73
|
],
|
|
73
74
|
])('Google Maps API src %#', (props, src) => {
|
|
74
75
|
render(
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
77
|
<GoogleMapsProvider {...(props as any)}>
|
|
76
78
|
<RenderStatus />
|
|
77
79
|
</GoogleMapsProvider>
|
package/src/useGeocoder.ts
CHANGED
package/src/useMap.ts
CHANGED
|
@@ -9,9 +9,11 @@ export const useMap = (options: google.maps.MapOptions = {}) => {
|
|
|
9
9
|
*/
|
|
10
10
|
const [, forceUpdate] = React.useState(0);
|
|
11
11
|
|
|
12
|
-
const ref = useCallbackRef<HTMLDivElement>(null, () =>
|
|
13
|
-
forceUpdate((n) =>
|
|
14
|
-
|
|
12
|
+
const ref = useCallbackRef<HTMLDivElement>(null, () => {
|
|
13
|
+
return forceUpdate((n) => {
|
|
14
|
+
return n + 1;
|
|
15
|
+
});
|
|
16
|
+
});
|
|
15
17
|
|
|
16
18
|
const { googleMaps } = useGoogleMaps();
|
|
17
19
|
|