@wix/editor-react-components 1.2425.0 → 1.2426.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.
@@ -1,6 +1,6 @@
1
1
  import { GoogleMapDataProp } from '../../../types/vendored/thunderbolt-components';
2
2
  import { MAP_STYLE_KEYS } from './consts';
3
- import { VectorArt, Link } from '@wix/editor-react-types';
3
+ import { A11y, VectorArt, Link } from '@wix/editor-react-types';
4
4
  import { SdkFunctionMouseHoverProps } from '../../../utils/functions/sdkFunctionCallbackProps';
5
5
  import { ConsentPolicyWrapperTranslationsValues } from '../../../common/components/ConsentPolicyWrapper/ConsentPolicyWrapper.types';
6
6
  export type Location = {
@@ -98,9 +98,9 @@ export type GoogleMapBaseProps = GoogleMapEventHandlers & {
98
98
  className?: string;
99
99
  skin?: GoogleMapSkin;
100
100
  customClassNames?: Array<string>;
101
+ a11y?: A11y;
101
102
  translations: GoogleMapTranslations;
102
103
  lang?: string;
103
- language?: string;
104
104
  onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
105
105
  onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
106
106
  mapData: GoogleMapMapData;
@@ -4,13 +4,16 @@ import React__default, { forwardRef, useState, useCallback, useMemo, useImperati
4
4
  import { c as clsx } from "../chunks/clsx.js";
5
5
  import { f as formatClassNames } from "../chunks/classNames.js";
6
6
  import { a as getDataAttributes } from "../chunks/dataUtils.js";
7
+ import { e as getTabIndexAttribute, f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
7
8
  import { createPortal } from "react-dom";
8
9
  import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
9
- 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, A as API_KEY, d as DEFAULT_LOCATION, C as COMPANY_NAME_DEFAULT, e as COMPANY_NAME_KEY, f as COMPONENT_NAME_DEFAULT, g as COMPONENT_NAME_KEY } from "../chunks/consts.js";
10
+ 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, A as API_KEY, d as DEFAULT_LOCATION, e as DefaultTranslations, f as TranslationKeys, g as TRANSLATIONS_NAMESPACES, C as COMPANY_NAME_DEFAULT, h as COMPANY_NAME_KEY, i as COMPONENT_NAME_DEFAULT, j as COMPONENT_NAME_KEY } from "../chunks/consts.js";
10
11
  import { p as parse } from "../chunks/index5.js";
11
12
  import { useService } from "@wix/services-manager-react";
12
13
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
13
14
  import { u as useConsentPolicyProps, C as ConsentPolicyWrapper } from "../chunks/useConsentPolicyProps.js";
15
+ import { T as TranslationsDefinition } from "../chunks/index6.js";
16
+ import { g as getTranslation } from "../chunks/getTranslation.js";
14
17
  const mapContainer = "mapContainer__E0LTn";
15
18
  const style = {
16
19
  mapContainer
@@ -22,6 +25,7 @@ const GoogleMapReact = forwardRef((props, forwardedRef) => {
22
25
  className,
23
26
  skin,
24
27
  customClassNames = [],
28
+ a11y,
25
29
  translations,
26
30
  lang,
27
31
  onMouseEnter,
@@ -30,6 +34,12 @@ const GoogleMapReact = forwardRef((props, forwardedRef) => {
30
34
  } = props;
31
35
  const [isMapReady, setIsMapReady] = useState(false);
32
36
  const handleMapTilesLoaded = useCallback(() => setIsMapReady(true), []);
37
+ const { tabIndex, ariaLabel, ...restA11y } = a11y || {};
38
+ const a11yAttributes = {
39
+ ...convertA11yKeysToHtmlFormat(restA11y),
40
+ ...getTabIndexAttribute(a11y),
41
+ "aria-label": ariaLabel || translations.title
42
+ };
33
43
  const domSafeProps = {
34
44
  id,
35
45
  className: clsx(
@@ -50,7 +60,7 @@ const GoogleMapReact = forwardRef((props, forwardedRef) => {
50
60
  "div",
51
61
  {
52
62
  className: style.mapContainer,
53
- "aria-label": translations.title,
63
+ ...a11yAttributes,
54
64
  "data-map-ready": isMapReady,
55
65
  role: "region",
56
66
  children: /* @__PURE__ */ jsx(
@@ -1752,7 +1762,7 @@ const GoogleMapReactInner = forwardRef((props, forwardedRef) => {
1752
1762
  );
1753
1763
  });
1754
1764
  const GoogleMapReactInteractiveMap = forwardRef((props, forwardedRef) => {
1755
- return /* @__PURE__ */ jsx(APIProvider, { apiKey: API_KEY, language: props.language, children: /* @__PURE__ */ jsx(GoogleMapReactInner, { ...props, ref: forwardedRef }) });
1765
+ return /* @__PURE__ */ jsx(APIProvider, { apiKey: API_KEY, language: props.lang, children: /* @__PURE__ */ jsx(GoogleMapReactInner, { ...props, ref: forwardedRef }) });
1756
1766
  });
1757
1767
  const GoogleMapReactInteractiveMap$1 = memo(GoogleMapReactInteractiveMap);
1758
1768
  const DEFAULT_TRANSLATIONS = {};
@@ -1813,8 +1823,18 @@ const defaultManifestProps = {
1813
1823
  mapStyleKey: "CLASSIC"
1814
1824
  };
1815
1825
  const defaultPinIcon = '<!--?xml version="1.0" encoding="UTF-8"?--><svg data-bbox="1.6 0 20.7 34" viewBox="0 0 24 34" height="34" width="24" xmlns="http://www.w3.org/2000/svg" data-type="color"><g><path d="M11.9 33.4c-.2 0-.5 0-.6-.2l-.2-.2c-.5-.4-.6-.9-.9-2.2-1-4.2-2.1-6.7-3.1-9-.7-1.4-1.4-2.6-2.1-3.7-1.7-2.8-2.8-4.7-2.8-8 0-2.3.9-4.7 2.5-6.5 1.9-1.8 4.6-3 7.2-3h.2c2.7 0 5.4 1.3 7.3 3.3 1.6 1.7 2.6 4.2 2.5 6.5 0 3.3-1.1 5.1-2.8 7.9-.6 1.1-1.3 2.3-2.1 3.8-.9 2.2-2 4.7-3 8.9-.3 1.3-.4 2-1.3 2.3h-.3c-.1.1-.2.2-.3.2Z" fill="#ff4646" data-color="1"></path><path d="M11.9 1.1h.2c2.5 0 5.1 1.2 6.9 3.2 1.5 1.6 2.4 3.9 2.4 6.1 0 3.1-1.1 4.9-2.7 7.7-.6 1.1-1.4 2.3-2.2 3.8-1 2.2-2 4.8-3.1 9-.3 1.2-.4 1.7-1 1.9h-.3c0 .1-.1.1-.2.1s-.2 0-.3-.1l-.2-.2c-.4-.3-.4-.6-.7-1.9-1-4.2-2.1-6.8-3.1-9.1-.8-1.5-1.5-2.7-2.1-3.7-1.6-2.8-2.7-4.6-2.7-7.7 0-2.2.9-4.5 2.4-6.1C7 2.2 9.5 1 12 1m-.1-1C9.1 0 6.3 1.4 4.3 3.5c-1.7 1.8-2.7 4.4-2.7 6.8 0 3.4 1.2 5.4 2.9 8.2.6 1 1.3 2.2 2.1 3.7 1 2.2 2 4.7 3 8.9.3 1.3.4 1.9 1.1 2.4l.2.2q.45.3.9.3h.8c1.1-.5 1.4-1.4 1.7-2.7 1-4.1 2.1-6.6 3-8.8.8-1.5 1.5-2.7 2.1-3.8 1.6-2.8 2.8-4.8 2.9-8.2 0-2.4-1-5-2.7-6.8C17.7 1.5 14.8.1 12 0h-.2Z" fill="#ffffff" data-color="2"></path><path fill="#590000" d="M15.2 10.4a3.2 3.2 0 1 1-6.4 0 3.2 3.2 0 0 1 6.4 0" data-color="3"></path></g></svg>';
1816
- const directionTitle = "Directions";
1826
+ const noopTranslate = () => () => "";
1827
+ const translateKey = (translate, key, namespace) => getTranslation(
1828
+ translate(namespace),
1829
+ key,
1830
+ TranslationKeys,
1831
+ DefaultTranslations
1832
+ );
1817
1833
  const useGoogleMapProps = (props) => {
1834
+ const translationService = useService(TranslationsDefinition);
1835
+ const translate = (translationService == null ? void 0 : translationService.translate) ?? noopTranslate;
1836
+ const environment = useService(EnvironmentDefinition);
1837
+ const siteLanguage = (environment == null ? void 0 : environment.language) ?? "en";
1818
1838
  const consentPolicyProps = useConsentPolicyProps();
1819
1839
  const cookieConsent = useCookieConsent({
1820
1840
  config: {
@@ -1838,7 +1858,11 @@ const useGoogleMapProps = (props) => {
1838
1858
  return {
1839
1859
  ...location,
1840
1860
  pinIcon: ((_a = props.pinIcon) == null ? void 0 : _a.svgContent) || defaultPinIcon,
1841
- directionTitle
1861
+ directionTitle: translateKey(
1862
+ translate,
1863
+ "directionsLink",
1864
+ TRANSLATIONS_NAMESPACES.googleMaps
1865
+ )
1842
1866
  };
1843
1867
  });
1844
1868
  return {
@@ -1862,7 +1886,8 @@ const useGoogleMapProps = (props) => {
1862
1886
  props.zoom,
1863
1887
  props.pinIcon,
1864
1888
  props.mapStyleKey,
1865
- props.defaultLocation
1889
+ props.defaultLocation,
1890
+ translate
1866
1891
  ]);
1867
1892
  const componentProps = useMemo(() => {
1868
1893
  return {
@@ -1870,13 +1895,21 @@ const useGoogleMapProps = (props) => {
1870
1895
  id: props.id,
1871
1896
  className: `${props.className || ""} google-map`,
1872
1897
  customClassNames: [],
1898
+ a11y: props.a11y,
1873
1899
  translations: {
1874
- title: "Google Map",
1875
- allyTargetBlankDescription: "Opens in a new tab",
1900
+ title: translateKey(
1901
+ translate,
1902
+ "mapAriaLabel",
1903
+ TRANSLATIONS_NAMESPACES.componentLabel
1904
+ ),
1905
+ allyTargetBlankDescription: translateKey(
1906
+ translate,
1907
+ "linkOpensNewTab",
1908
+ TRANSLATIONS_NAMESPACES.googleMaps
1909
+ ),
1876
1910
  ...cookieConsent.translations
1877
1911
  },
1878
- language: "en",
1879
- lang: "en",
1912
+ lang: siteLanguage,
1880
1913
  onMouseEnter: props.onMouseIn,
1881
1914
  onMouseLeave: props.onMouseOut,
1882
1915
  isConsentPolicyActive: cookieConsent.isConsentPolicyActive,
@@ -1889,8 +1922,11 @@ const useGoogleMapProps = (props) => {
1889
1922
  }, [
1890
1923
  props.id,
1891
1924
  props.className,
1925
+ props.a11y,
1892
1926
  props.onMouseIn,
1893
1927
  props.onMouseOut,
1928
+ translate,
1929
+ siteLanguage,
1894
1930
  cookieConsent.hasRequiredConsent,
1895
1931
  cookieConsent.isConsentPolicyActive,
1896
1932
  cookieConsent.consentPolicy,
@@ -17,9 +17,9 @@ declare const GoogleMapReact: React.ForwardRefExoticComponent<{
17
17
  className?: string;
18
18
  skin?: import('../GoogleMap.types').GoogleMapSkin;
19
19
  customClassNames?: Array<string>;
20
+ a11y?: import('@wix/editor-react-types').A11y;
20
21
  translations: import('../GoogleMap.types').GoogleMapTranslations;
21
22
  lang?: string;
22
- language?: string;
23
23
  onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
24
24
  onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
25
25
  mapData: import('../GoogleMap.types').GoogleMapMapData;
@@ -17,9 +17,9 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
17
17
  className?: string;
18
18
  skin?: import('../GoogleMap.types').GoogleMapSkin;
19
19
  customClassNames?: Array<string>;
20
+ a11y?: import('@wix/editor-react-types').A11y;
20
21
  translations: import('../GoogleMap.types').GoogleMapTranslations;
21
22
  lang?: string;
22
- language?: string;
23
23
  onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
24
24
  onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
25
25
  mapData: import('../GoogleMap.types').GoogleMapMapData;
@@ -57,6 +57,21 @@ export declare const DEFAULT_LOCATION: {
57
57
  longitude: number;
58
58
  title: string;
59
59
  };
60
+ export declare const TRANSLATIONS_NAMESPACES: {
61
+ readonly componentLabel: "component_label";
62
+ readonly googleMaps: "GoogleMaps";
63
+ };
64
+ export declare const TranslationKeys: {
65
+ readonly mapAriaLabel: "COMPONENT_LABEL_googleMapsTitle";
66
+ readonly linkOpensNewTab: "googleMaps_ariaLabel_linkOpensNewTab";
67
+ readonly directionsLink: "GoogleMaps_Directions_Link";
68
+ };
69
+ export declare const DefaultTranslations: {
70
+ readonly mapAriaLabel: "Google Maps";
71
+ readonly linkOpensNewTab: "Opens in a new tab";
72
+ readonly directionsLink: "Directions";
73
+ };
74
+ export type TranslationKey = keyof typeof TranslationKeys;
60
75
  export declare const COMPONENT_NAME_KEY = "CookieConsent_Dataset_Component_GoogleMap";
61
76
  export declare const COMPONENT_NAME_DEFAULT = "Google Maps";
62
77
  export declare const COMPANY_NAME_KEY = "CookieConsent_Dataset_Company_Google";
@@ -1,3 +1,4 @@
1
+ import { A11y } from '@wix/editor-react-types';
1
2
  import { GoogleMapSettingsProps, GoogleMapMapData, GoogleMapWithConsentProps } from '../GoogleMap.types';
2
3
  type GoogleMapPropsWithConsent = GoogleMapWithConsentProps & {
3
4
  hasRequiredConsent?: boolean;
@@ -6,6 +7,7 @@ type GoogleMapPropsWithConsent = GoogleMapWithConsentProps & {
6
7
  declare const useGoogleMapProps: (props: GoogleMapSettingsProps & {
7
8
  id: string;
8
9
  className?: string;
10
+ a11y?: A11y;
9
11
  }) => {
10
12
  componentProps: Omit<GoogleMapPropsWithConsent, "mapData">;
11
13
  mapData: GoogleMapMapData;
@@ -1,5 +1,5 @@
1
1
  import { b as DISPLAY_GROUPS, D as DATA, M as MEDIA, a as ACTIONS, I as INTERACTIONS, A as Archetype, L as LAYOUT } from "../chunks/chunk-V7QOLP3D.js";
2
- import { h as DisplayNames, i as MAP_STYLE_KEYS, j as defaultValues, a as MAX_ZOOM, M as MIN_ZOOM } from "../chunks/consts.js";
2
+ import { k as DisplayNames, l as MAP_STYLE_KEYS, m as defaultValues, a as MAX_ZOOM, M as MIN_ZOOM } from "../chunks/consts.js";
3
3
  import { c as manifestMouseHover } from "../chunks/manifestSdkMixins.js";
4
4
  const manifest = {
5
5
  id: "bf8a38af-5784-47d5-92d3-3627a6a60bc6",
@@ -46,6 +46,20 @@ const DEFAULT_LOCATION = {
46
46
  longitude: -122.387301,
47
47
  title: "Wix Office"
48
48
  };
49
+ const TRANSLATIONS_NAMESPACES = {
50
+ componentLabel: "component_label",
51
+ googleMaps: "GoogleMaps"
52
+ };
53
+ const TranslationKeys = {
54
+ mapAriaLabel: "COMPONENT_LABEL_googleMapsTitle",
55
+ linkOpensNewTab: "googleMaps_ariaLabel_linkOpensNewTab",
56
+ directionsLink: "GoogleMaps_Directions_Link"
57
+ };
58
+ const DefaultTranslations = {
59
+ mapAriaLabel: "Google Maps",
60
+ linkOpensNewTab: "Opens in a new tab",
61
+ directionsLink: "Directions"
62
+ };
49
63
  const COMPONENT_NAME_KEY = "CookieConsent_Dataset_Component_GoogleMap";
50
64
  const COMPONENT_NAME_DEFAULT = "Google Maps";
51
65
  const COMPANY_NAME_KEY = "CookieConsent_Dataset_Company_Google";
@@ -89,10 +103,13 @@ export {
89
103
  MAP_IDS as b,
90
104
  MAP_TYPES as c,
91
105
  DEFAULT_LOCATION as d,
92
- COMPANY_NAME_KEY as e,
93
- COMPONENT_NAME_DEFAULT as f,
94
- COMPONENT_NAME_KEY as g,
95
- DisplayNames as h,
96
- MAP_STYLE_KEYS as i,
97
- defaultValues as j
106
+ DefaultTranslations as e,
107
+ TranslationKeys as f,
108
+ TRANSLATIONS_NAMESPACES as g,
109
+ COMPANY_NAME_KEY as h,
110
+ COMPONENT_NAME_DEFAULT as i,
111
+ COMPONENT_NAME_KEY as j,
112
+ DisplayNames as k,
113
+ MAP_STYLE_KEYS as l,
114
+ defaultValues as m
98
115
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2425.0",
3
+ "version": "1.2426.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "5d5c122844efd4c05fa3badafd1a6816306e5ca052ebae5b047337fb"
200
+ "falconPackageHash": "4c4227bc804cd28d297ae1dfb821d2994d406bdfd344c828c35be1f2"
201
201
  }