@abcagency/hc-ui-components 1.8.6 → 1.8.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
2
3
|
import { GoogleMap } from '@react-google-maps/api';
|
|
3
4
|
import ShowAllButton from '../buttons/show-all-button.js';
|
|
4
5
|
|
|
@@ -17,8 +18,17 @@ var Map = function Map(_ref) {
|
|
|
17
18
|
filteredListingsLength = _ref.filteredListingsLength,
|
|
18
19
|
setSelectedFilters = _ref.setSelectedFilters,
|
|
19
20
|
children = _ref.children;
|
|
20
|
-
//
|
|
21
|
-
var
|
|
21
|
+
// Use state to avoid hydration mismatch
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
isGoogleMapsAvailable = _useState2[0],
|
|
25
|
+
setIsGoogleMapsAvailable = _useState2[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
// Check if Google Maps is available after mount (client-side only)
|
|
28
|
+
if (window.google && window.google.maps && window.google.maps.Map) {
|
|
29
|
+
setIsGoogleMapsAvailable(true);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
22
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
23
33
|
ref: mapContainerRef,
|
|
24
34
|
className: "hc-h-full hc-relative"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","sources":["../../../../src/components/modules/maps/map.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"map.js","sources":["../../../../src/components/modules/maps/map.js"],"sourcesContent":["\"use client\";\n\nimport React, { useState, useEffect } from 'react';\nimport { GoogleMap, useLoadScript } from \"@react-google-maps/api\";\nimport ShowAllButton from \"~/components/modules/buttons/show-all-button\";\n\nconst Map = ({\n\tzoom,\n\tcenter,\n\tmapContainerRef,\n\tonLoad,\n\tonIdle,\n\tmapInteracted,\n\tpinIconUrl,\n\tsetMapInteracted,\n\tfitBounds,\n\tmapRef,\n\tsetQuery,\n\tfilteredListingsLength,\n\tsetSelectedFilters,\n\tchildren\n}) => {\n\t// Use state to avoid hydration mismatch\n\tconst [isGoogleMapsAvailable, setIsGoogleMapsAvailable] = useState(false);\n\t\n\tuseEffect(() => {\n\t\t// Check if Google Maps is available after mount (client-side only)\n\t\tif (window.google && window.google.maps && window.google.maps.Map) {\n\t\t\tsetIsGoogleMapsAvailable(true);\n\t\t}\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t<div ref={mapContainerRef} className=\"hc-h-full hc-relative\">\n\t\t\t\t{isGoogleMapsAvailable && (\n\t\t\t\t\t<GoogleMap\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tonLoad={onLoad}\n\t\t\t\t\t\tonIdle={onIdle}\n\t\t\t\t\t\tcenter={center}\n\t\t\t\t\t\tmapContainerStyle={{\n\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\theight: \"100%\"\n\t\t\t\t\t\t}}\n\t\t\t\t\t\toptions={{\n\t\t\t\t\t\t\tstyles: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfeatureType: \"poi\",\n\t\t\t\t\t\t\t\t\telementType: \"labels\",\n\t\t\t\t\t\t\t\t\tstylers: [{ visibility: \"off\" }]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</GoogleMap>\n\t\t\t\t)}\n\t\t\t\t{mapInteracted && (\n\t\t\t\t\t<ShowAllButton\n\t\t\t\t\t\tmapInteracted={mapInteracted}\n\t\t\t\t\t\tsetMapInteracted={setMapInteracted}\n\t\t\t\t\t\tfitBounds={fitBounds}\n\t\t\t\t\t\tmapRef={mapRef}\n\t\t\t\t\t\tpinIconUrl={pinIconUrl}\n\t\t\t\t\t\tsetQuery={setQuery}\n\t\t\t\t\t\tlistingCount={filteredListingsLength}\n\t\t\t\t\t\tsetSelectedFilters={setSelectedFilters}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\nexport default Map;\n"],"names":["Map","_ref","zoom","center","mapContainerRef","onLoad","onIdle","mapInteracted","pinIconUrl","setMapInteracted","fitBounds","mapRef","setQuery","filteredListingsLength","setSelectedFilters","children","_useState","useState","_useState2","_slicedToArray","isGoogleMapsAvailable","setIsGoogleMapsAvailable","useEffect","window","google","maps","React","createElement","Fragment","ref","className","GoogleMap","mapContainerStyle","width","height","options","styles","featureType","elementType","stylers","visibility","ShowAllButton","listingCount"],"mappings":";;;;;AAMA,IAAMA,GAAG,GAAG,SAANA,GAAGA,CAAAC,IAAA,EAeH;AAAA,EAAA,IAdLC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,aAAa,GAAAN,IAAA,CAAbM,aAAa;IACbC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,gBAAgB,GAAAR,IAAA,CAAhBQ,gBAAgB;IAChBC,SAAS,GAAAT,IAAA,CAATS,SAAS;IACTC,MAAM,GAAAV,IAAA,CAANU,MAAM;IACNC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,sBAAsB,GAAAZ,IAAA,CAAtBY,sBAAsB;IACtBC,kBAAkB,GAAAb,IAAA,CAAlBa,kBAAkB;IAClBC,QAAQ,GAAAd,IAAA,CAARc,QAAQ,CAAA;AAER;AACA,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAA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IAAAA,aAAa,EAAEA,aAAc;AAC7BE,IAAAA,gBAAgB,EAAEA,gBAAiB;AACnCC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,MAAM,EAAEA,MAAO;AACfH,IAAAA,UAAU,EAAEA,UAAW;AACvBI,IAAAA,QAAQ,EAAEA,QAAS;AACnB8B,IAAAA,YAAY,EAAE7B,sBAAuB;AACrCC,IAAAA,kBAAkB,EAAEA,kBAAAA;GACpB,CAEE,CACJ,CAAC,CAAA;AAEL;;;;"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
2
4
|
import { GoogleMap, useLoadScript } from "@react-google-maps/api";
|
|
3
5
|
import ShowAllButton from "~/components/modules/buttons/show-all-button";
|
|
4
6
|
|
|
@@ -18,8 +20,15 @@ const Map = ({
|
|
|
18
20
|
setSelectedFilters,
|
|
19
21
|
children
|
|
20
22
|
}) => {
|
|
21
|
-
//
|
|
22
|
-
const isGoogleMapsAvailable =
|
|
23
|
+
// Use state to avoid hydration mismatch
|
|
24
|
+
const [isGoogleMapsAvailable, setIsGoogleMapsAvailable] = useState(false);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
// Check if Google Maps is available after mount (client-side only)
|
|
28
|
+
if (window.google && window.google.maps && window.google.maps.Map) {
|
|
29
|
+
setIsGoogleMapsAvailable(true);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
23
32
|
|
|
24
33
|
return (
|
|
25
34
|
<>
|