@wix/editor-react-components 1.2716.0 → 1.2718.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.
@@ -3,6 +3,7 @@
3
3
  }
4
4
 
5
5
  .minHeightFix__syGSC {
6
- display: grid;
6
+ --display: grid;
7
+ display: var(--display);
7
8
  grid-template-rows: minmax(0, 1fr);
8
9
  }
@@ -17,7 +17,7 @@ import { u as useResizeObserver } from "../chunks/useResizeObserver.js";
17
17
  import { D as DismissSmall_default } from "../chunks/DismissSmall.js";
18
18
  import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
19
19
  import { r as requireIsSymbol, a as require_baseSlice } from "../chunks/_baseSlice.js";
20
- import { r as requireIsObject, a as requireEq, b as requireIsArrayLike, c as require_isIndex } from "../chunks/isArrayLike.js";
20
+ import { b as requireIsObject, r as requireEq, e as requireIsArrayLike, d as require_isIndex } from "../chunks/isArrayLike.js";
21
21
  const ConfirmSmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M11.9393398,6 C12.232233,5.70710678 12.7071068,5.70710678 13,6 C13.2928932,6.29289322 13.2928932,6.76776695 13,7.06066017 L7.5,12.5606602 L5,10.0606602 C4.70710678,9.76776695 4.70710678,9.29289322 5,9 C5.29289322,8.70710678 5.76776695,8.70710678 6.06066017,9 L7.5,10.4393398 L11.9393398,6 Z" }));
22
22
  ConfirmSmall.displayName = "ConfirmSmall";
23
23
  var ConfirmSmall_default = ConfirmSmall;
@@ -112,6 +112,7 @@ export type GoogleMapBaseProps = GoogleMapEventHandlers & {
112
112
  openSettingModal?: () => void;
113
113
  hasRequiredConsent?: boolean;
114
114
  componentConsentPolicy?: Record<string, boolean>;
115
+ disableInfoWindow?: boolean;
115
116
  };
116
117
  export type GoogleMapWithConsentProps = Omit<GoogleMapBaseProps, 'translations' | 'consentPolicy' | 'openSettingModal'> & {
117
118
  translations: GoogleMapTranslations & ConsentPolicyWrapperTranslationsValues;
@@ -122,9 +123,10 @@ export type GoogleMapReactProps = GoogleMapBaseProps & {
122
123
  MapContent: React.ComponentType<GoogleMapBaseProps & React.RefAttributes<IGoogleMapsImperativeActions>>;
123
124
  };
124
125
  export type GoogleMapMarkerProps = {
126
+ index: number;
125
127
  location: MapMarkerInterface;
126
128
  infoWindowOpen: boolean;
127
- onMarkerClick: (marker: any) => void;
129
+ onMarkerClick: (index: number, marker: any) => void;
128
130
  onInfoWindowClose: () => void;
129
131
  showDirectionLink: boolean;
130
132
  allyTargetBlankDescription?: string;
@@ -7,6 +7,7 @@ import { a as getDataAttributes } from "../chunks/dataUtils.js";
7
7
  import { e as getTabIndexAttribute, f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
8
8
  import { createPortal } from "react-dom";
9
9
  import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
10
+ import { i as isEqual } from "../chunks/isEqual.js";
10
11
  import { G as GOOGLE_MAPS_DIRECTIONS_BASE_URL, M as MIN_ZOOM, a as MAX_ZOOM, T as TestIds, D as DEFAULT_ZOOM, b as MAP_IDS, c as MAP_TYPES, d as MAP_MOBILE_CONTROL_SIZE, A as API_KEY, e as DEFAULT_LOCATION, f as DefaultTranslations, g as TranslationKeys, h as TRANSLATIONS_NAMESPACES, C as COMPANY_NAME_DEFAULT, i as COMPANY_NAME_KEY, j as COMPONENT_NAME_DEFAULT, k as COMPONENT_NAME_KEY } from "../chunks/consts.js";
11
12
  import { p as parse } from "../chunks/index4.js";
12
13
  import { useService } from "@wix/services-manager-react";
@@ -1394,6 +1395,7 @@ function hasMarkerInfoWindowFields(location, mapData) {
1394
1395
  );
1395
1396
  }
1396
1397
  const GoogleMapMarker = ({
1398
+ index,
1397
1399
  location,
1398
1400
  infoWindowOpen,
1399
1401
  onMarkerClick,
@@ -1406,7 +1408,7 @@ const GoogleMapMarker = ({
1406
1408
  const { isLinkValid, anchorProps } = getLinkInfo(location);
1407
1409
  const handleMarkerClick = () => {
1408
1410
  var _a2;
1409
- onMarkerClick == null ? void 0 : onMarkerClick({
1411
+ onMarkerClick == null ? void 0 : onMarkerClick(index, {
1410
1412
  type: "markerClicked",
1411
1413
  address: location.address,
1412
1414
  location: {
@@ -1489,7 +1491,7 @@ const GoogleMapMarker = ({
1489
1491
  )
1490
1492
  ] });
1491
1493
  };
1492
- const GoogleMapMarker$1 = React.memo(GoogleMapMarker);
1494
+ const GoogleMapMarker$1 = React.memo(GoogleMapMarker, isEqual);
1493
1495
  const createSdkMethods = (mapRef, updateZoom, updateCenter) => {
1494
1496
  return {
1495
1497
  setMapCenter: (longitude, latitude) => {
@@ -1611,6 +1613,7 @@ const GoogleMapReactInner = forwardRef((props, forwardedRef) => {
1611
1613
  const {
1612
1614
  id,
1613
1615
  isMobile,
1616
+ disableInfoWindow,
1614
1617
  mapData,
1615
1618
  translations,
1616
1619
  onUpdateCenter,
@@ -1690,10 +1693,14 @@ const GoogleMapReactInner = forwardRef((props, forwardedRef) => {
1690
1693
  },
1691
1694
  [onMapClicked, id]
1692
1695
  );
1693
- const handleMarkerClicked = (index) => (data) => {
1694
- setOpenInfoWindowIndex(openInfoWindowIndex === index ? null : index);
1695
- onMarkerClicked == null ? void 0 : onMarkerClicked(data);
1696
- };
1696
+ const handleMarkerClicked = useCallback(
1697
+ (index, data) => {
1698
+ setOpenInfoWindowIndex((current) => current === index ? null : index);
1699
+ onMarkerClicked == null ? void 0 : onMarkerClicked(data);
1700
+ },
1701
+ [onMarkerClicked]
1702
+ );
1703
+ const closeInfoWindow = useCallback(() => setOpenInfoWindowIndex(null), []);
1697
1704
  useImperativeHandle(
1698
1705
  forwardedRef,
1699
1706
  () => createImperativeMethods(
@@ -1752,10 +1759,11 @@ const GoogleMapReactInner = forwardRef((props, forwardedRef) => {
1752
1759
  children: mapData.locations.map((location, index) => /* @__PURE__ */ jsx(
1753
1760
  GoogleMapMarker$1,
1754
1761
  {
1762
+ index,
1755
1763
  location,
1756
- infoWindowOpen: openInfoWindowIndex === index && hasMarkerInfoWindowFields(location, mapData),
1757
- onMarkerClick: handleMarkerClicked(index),
1758
- onInfoWindowClose: () => setOpenInfoWindowIndex(null),
1764
+ infoWindowOpen: !disableInfoWindow && openInfoWindowIndex === index && hasMarkerInfoWindowFields(location, mapData),
1765
+ onMarkerClick: handleMarkerClicked,
1766
+ onInfoWindowClose: closeInfoWindow,
1759
1767
  showDirectionLink: mapData.showDirectionsLink,
1760
1768
  allyTargetBlankDescription: translations.allyTargetBlankDescription
1761
1769
  },
@@ -1917,6 +1925,7 @@ const useGoogleMapProps = (props) => {
1917
1925
  onMouseLeave: props.onMouseOut,
1918
1926
  isConsentPolicyActive: cookieConsent.isConsentPolicyActive,
1919
1927
  isMobile: cookieConsent.isMobile,
1928
+ disableInfoWindow: props.disableInfoWindow,
1920
1929
  consentPolicy: cookieConsent.consentPolicy,
1921
1930
  openSettingModal: cookieConsent.openSettingModal,
1922
1931
  hasRequiredConsent: cookieConsent.hasRequiredConsent,
@@ -1936,6 +1945,7 @@ const useGoogleMapProps = (props) => {
1936
1945
  cookieConsent.componentConsentPolicy,
1937
1946
  cookieConsent.translations,
1938
1947
  cookieConsent.isMobile,
1948
+ props.disableInfoWindow,
1939
1949
  cookieConsent.openSettingModal
1940
1950
  ]);
1941
1951
  return { componentProps, mapData };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { default as GoogleMap } from './component';
3
+ export default function GoogleMapPreview(props: React.ComponentProps<typeof GoogleMap>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { GoogleMapMarkerProps } from '../GoogleMap.types';
2
2
  import * as React from 'react';
3
- declare const _default: React.MemoExoticComponent<({ location, infoWindowOpen, onMarkerClick, onInfoWindowClose, showDirectionLink, allyTargetBlankDescription, }: GoogleMapMarkerProps) => React.JSX.Element | null>;
3
+ declare const _default: React.MemoExoticComponent<({ index, location, infoWindowOpen, onMarkerClick, onInfoWindowClose, showDirectionLink, allyTargetBlankDescription, }: GoogleMapMarkerProps) => React.JSX.Element | null>;
4
4
  export default _default;
@@ -31,6 +31,7 @@ declare const GoogleMapReact: React.ForwardRefExoticComponent<{
31
31
  openSettingModal?: () => void;
32
32
  hasRequiredConsent?: boolean;
33
33
  componentConsentPolicy?: Record<string, boolean>;
34
+ disableInfoWindow?: boolean;
34
35
  } & {
35
36
  MapContent: React.ComponentType<import('../GoogleMap.types').GoogleMapBaseProps & React.RefAttributes<IGoogleMapsImperativeActions>>;
36
37
  } & React.RefAttributes<IGoogleMapsImperativeActions>>;
@@ -31,5 +31,6 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
31
31
  openSettingModal?: () => void;
32
32
  hasRequiredConsent?: boolean;
33
33
  componentConsentPolicy?: Record<string, boolean>;
34
+ disableInfoWindow?: boolean;
34
35
  } & React.RefAttributes<IGoogleMapsImperativeActions>>>;
35
36
  export default _default;
@@ -8,6 +8,7 @@ declare const useGoogleMapProps: (props: GoogleMapSettingsProps & {
8
8
  id: string;
9
9
  className?: string;
10
10
  a11y?: A11y;
11
+ disableInfoWindow?: boolean;
11
12
  }) => {
12
13
  componentProps: Omit<GoogleMapPropsWithConsent, "mapData">;
13
14
  mapData: GoogleMapMapData;
@@ -217,6 +217,16 @@ const manifest = {
217
217
  }
218
218
  },
219
219
  resources: {
220
+ editor: {
221
+ componentUrl: "./site/components/GoogleMap/component.preview.tsx",
222
+ dependencies: {
223
+ serviceDependencies: [
224
+ "@wix/viewer-service-consent-policy",
225
+ "@wix/viewer-service-environment",
226
+ "@wix/viewer-service-translations"
227
+ ]
228
+ }
229
+ },
220
230
  client: {
221
231
  componentUrl: "./site/components/GoogleMap/component.tsx",
222
232
  moduleSpecifier: "@wix/editor-react-components/GoogleMap",
@@ -79,10 +79,10 @@ function requireIsArrayLike() {
79
79
  return isArrayLike_1;
80
80
  }
81
81
  export {
82
- requireEq as a,
83
- requireIsArrayLike as b,
84
- require_isIndex as c,
85
- requireIsFunction as d,
86
- requireIsLength as e,
87
- requireIsObject as r
82
+ requireIsFunction as a,
83
+ requireIsObject as b,
84
+ requireIsLength as c,
85
+ require_isIndex as d,
86
+ requireIsArrayLike as e,
87
+ requireEq as r
88
88
  };