@wix/editor-react-components 1.2438.0 → 1.2440.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,20 @@
1
1
  .mapContainer__E0LTn {
2
2
  width: 100%;
3
3
  height: 100%;
4
+ }
5
+ .mapContainer__E0LTn .gm-style a:focus-visible {
6
+ outline: auto;
7
+ }
8
+ .mapContainer__E0LTn .gm-ui-hover-effect:focus-visible {
9
+ outline: 2px solid #116dff;
10
+ outline-offset: 1px;
11
+ box-shadow: 0 0 1px 2px #ffffff;
12
+ outline-offset: -4px;
13
+ }
14
+
15
+ #SITE_CONTAINER.focus-ring-active.keyboard-tabbing-on .mapContainer__E0LTn .gm-style a:focus,
16
+ #SITE_CONTAINER.focus-ring-active.keyboard-tabbing-on .mapContainer__E0LTn .gm-style-iw *:focus {
17
+ box-shadow: none !important;
4
18
  }.title__jE00O {
5
19
  font-size: 14px;
6
20
  font-weight: 500;
@@ -15,11 +29,25 @@
15
29
 
16
30
  .link__AM1ap {
17
31
  display: block;
32
+ width: fit-content;
18
33
  font-size: 13px;
19
34
  font-weight: 400;
20
35
  color: var(--wst-links-and-actions-color, #1a73e8);
21
36
  text-decoration: underline;
22
37
  }
38
+ #SITE_CONTAINER.focus-ring-active.keyboard-tabbing-on .link__AM1ap:focus {
39
+ outline: 2px solid #116dff;
40
+ outline-offset: 1px;
41
+ box-shadow: 0 0 1px 2px #ffffff;
42
+ outline-offset: -2px;
43
+ }
44
+ @media (forced-colors: active) {
45
+ .link__AM1ap:focus {
46
+ outline: 3px solid Highlight !important;
47
+ outline-offset: -3px !important;
48
+ box-shadow: none;
49
+ }
50
+ }
23
51
 
24
52
  .pinIcon__PgsnW svg {
25
53
  width: 32px;
@@ -1,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key2, value2) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key2] = value2;
3
- var __publicField = (obj, key2, value2) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value2);
4
1
  import { jsx, jsxs } from "react/jsx-runtime";
5
2
  import { c as clsx } from "../chunks/clsx.js";
6
3
  import { useService } from "@wix/services-manager-react";
@@ -8,11 +5,12 @@ import { T as TranslationsDefinition } from "../chunks/index6.js";
8
5
  import { d as directionStyles } from "../chunks/direction.module.js";
9
6
  import { g as getTranslation } from "../chunks/getTranslation.js";
10
7
  import { B as Button } from "../chunks/Button.js";
11
- import { s as semanticSelectors, r as rootDataDefaults, d as displayPropertyToObserve, A as ARIA_LABEL_NAMESPACE, t as testIds, p as pauseIconSvg, a as playIconSvg, b as showButtonOnHoverDefaults, D as DefaultTranslations, T as TranslationKeys } from "../chunks/constants28.js";
8
+ import { r as rootDataDefaults, s as semanticSelectors, A as ARIA_LABEL_NAMESPACE, t as testIds, p as pauseIconSvg, a as playIconSvg, b as showButtonOnHoverDefaults, D as DefaultTranslations, T as TranslationKeys } from "../chunks/constants28.js";
12
9
  import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
13
10
  import React__default, { useEffect, useState, useRef, useMemo } from "react";
14
11
  import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
15
12
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
13
+ import { u as useHasDisplayedElement } from "../chunks/useHasDisplayedElement.js";
16
14
  var lottie$2 = { exports: {} };
17
15
  var lottie$1 = lottie$2.exports;
18
16
  var hasRequiredLottie;
@@ -16773,189 +16771,11 @@ const LottieAnimation = ({ a11y, animationData, ...playerProps }) => animationDa
16773
16771
  ...a11y && convertA11yKeysToHtmlFormat(a11y)
16774
16772
  }
16775
16773
  ) : null;
16776
- class StyleObserver {
16777
- /**
16778
- * Create a new (detached) instance of CSS variable observer.
16779
- *
16780
- * @param observedVariables list of CSS variables to observe
16781
- * @param callback callback that will be invoked every time any of listed CSS variables change
16782
- * @param options configuration options
16783
- */
16784
- constructor(callback, config = { propertiesToObserve: [] }) {
16785
- // List of elements that are being observed
16786
- __publicField(this, "_observedElements", /* @__PURE__ */ new Set());
16787
- // Value cache per observed element
16788
- __publicField(this, "_cachedValues", /* @__PURE__ */ new WeakMap());
16789
- /*
16790
- * Observer CSS variables and their internal identifiers.
16791
- */
16792
- __publicField(this, "_observedVariables");
16793
- /*
16794
- * User supplied callback that receives CSS variable values.
16795
- */
16796
- __publicField(this, "_callback");
16797
- /*
16798
- * Event handler that is used to invoke callback.
16799
- */
16800
- __publicField(this, "_eventHandler", this._handleUpdate.bind(this));
16801
- /*
16802
- * Mode to determine whether to observe all properties or only the changed ones
16803
- */
16804
- __publicField(this, "_notificationMode");
16805
- /*
16806
- * Format to determine how to return the observed values
16807
- */
16808
- __publicField(this, "_returnFormat");
16809
- this._callback = callback;
16810
- this._observedVariables = config.propertiesToObserve;
16811
- this._notificationMode = config.notificationMode ?? "changed_only";
16812
- this._returnFormat = config.returnFormat ?? "object";
16813
- }
16814
- setPropertiesToObserve(propertiesToObserve) {
16815
- this._observedVariables = propertiesToObserve;
16816
- }
16817
- /**
16818
- * Attach observer to target element. Callback will be invoked immediately with the current assigned values.
16819
- *
16820
- * @param targetElement target element
16821
- */
16822
- observe(targetElement) {
16823
- if (!this._observedElements.has(targetElement)) {
16824
- this._observedElements.add(targetElement);
16825
- this._cachedValues.set(targetElement, {});
16826
- this._setTargetElementStyles(targetElement);
16827
- targetElement.addEventListener("transitionrun", this._eventHandler);
16828
- }
16829
- }
16830
- /**
16831
- * Detach observer from given targetElement
16832
- * If no argument is passed, then all are detached
16833
- */
16834
- unobserve(targetElement) {
16835
- let elementsToUnobserve;
16836
- if (targetElement) {
16837
- if (this._observedElements.has(targetElement)) {
16838
- elementsToUnobserve = /* @__PURE__ */ new Set([targetElement]);
16839
- } else {
16840
- elementsToUnobserve = /* @__PURE__ */ new Set();
16841
- }
16842
- } else {
16843
- elementsToUnobserve = this._observedElements;
16844
- }
16845
- if (!elementsToUnobserve.size) {
16846
- return;
16847
- }
16848
- elementsToUnobserve.forEach((elementToUnobserve) => {
16849
- this._unsetTargetElementStyles(elementToUnobserve);
16850
- elementToUnobserve.removeEventListener(
16851
- "transitionrun",
16852
- this._eventHandler
16853
- );
16854
- this._observedElements.delete(elementToUnobserve);
16855
- this._cachedValues.delete(elementToUnobserve);
16856
- });
16857
- }
16858
- /**
16859
- * Attach the styles necessary to track the changes to the given element
16860
- *
16861
- * @param targetElement The element to track
16862
- */
16863
- _setTargetElementStyles(targetElement) {
16864
- const cssTransitionValue = this._observedVariables.map((value2) => `${value2} 0.001ms step-start`).join(", ");
16865
- targetElement.style.setProperty("transition", cssTransitionValue);
16866
- targetElement.style.setProperty("transition-behavior", "allow-discrete");
16867
- }
16868
- /**
16869
- * Remove the styles that track the property changes
16870
- *
16871
- * @param targetElement The element to track
16872
- */
16873
- _unsetTargetElementStyles(targetElement) {
16874
- targetElement.style.removeProperty("transition");
16875
- targetElement.style.removeProperty("transition-behavior");
16876
- }
16877
- /**
16878
- * Process the computed style and collect the changes
16879
- *
16880
- * @param computedStyle The computed style of the target element
16881
- * @returns Collected changes
16882
- */
16883
- _processComputedStyle(computedStyle, targetElement) {
16884
- const changes = {};
16885
- const cachedValuesForElement = this._cachedValues.get(targetElement) ?? {};
16886
- this._observedVariables.forEach((propertyName) => {
16887
- const currentValue = computedStyle.getPropertyValue(propertyName);
16888
- const previousValue = cachedValuesForElement[propertyName];
16889
- const hasChanged = currentValue !== previousValue;
16890
- if (this._notificationMode === "all" || hasChanged) {
16891
- changes[propertyName] = {
16892
- value: currentValue,
16893
- previousValue,
16894
- changed: hasChanged,
16895
- element: targetElement
16896
- };
16897
- cachedValuesForElement[propertyName] = currentValue;
16898
- }
16899
- });
16900
- return changes;
16901
- }
16902
- /**
16903
- * Returns the formatter to use
16904
- */
16905
- _getFormatter(format) {
16906
- switch (format) {
16907
- case "object":
16908
- return (changes) => {
16909
- return changes;
16910
- };
16911
- case "value_only":
16912
- default:
16913
- return (changes) => {
16914
- const formattedChanges = {};
16915
- Object.keys(changes).forEach((key2) => {
16916
- formattedChanges[key2] = changes[key2].value;
16917
- });
16918
- return formattedChanges;
16919
- };
16920
- }
16921
- }
16922
- /**
16923
- * Collect CSS variable values and invoke callback.
16924
- */
16925
- _handleUpdate(e) {
16926
- const targetElement = e instanceof HTMLElement ? e : e.target;
16927
- if (this._observedElements.has(targetElement)) {
16928
- const computedStyle = getComputedStyle(targetElement);
16929
- const changes = this._processComputedStyle(computedStyle, targetElement);
16930
- if (Object.keys(changes).length === 0) {
16931
- return;
16932
- }
16933
- const formatter = this._getFormatter(this._returnFormat);
16934
- this._callback(formatter(changes));
16935
- }
16936
- }
16937
- }
16938
- function useStyleRefreshKey(element, propertiesToObserve = []) {
16939
- const [refreshKey, setRefreshKey] = useState(0);
16940
- const refreshComponent = () => setRefreshKey((oldRefreshKey) => oldRefreshKey + 1);
16941
- const styleObserverRef = useRef(
16942
- new StyleObserver(refreshComponent, { propertiesToObserve })
16943
- );
16944
- useEffect(() => {
16945
- const styleObserver = styleObserverRef.current;
16946
- styleObserver.setPropertiesToObserve(propertiesToObserve);
16947
- if (!element) {
16948
- return;
16949
- }
16950
- styleObserver.observe(element);
16951
- return () => styleObserver.unobserve(element);
16952
- }, [element, propertiesToObserve]);
16953
- return refreshKey;
16954
- }
16955
16774
  function useLottie({
16956
16775
  animationUrl,
16957
16776
  autoplay = true,
16958
- speed = rootDataDefaults.speed
16777
+ speed = rootDataDefaults.speed,
16778
+ allowClickToStop = rootDataDefaults.allowClickToStop
16959
16779
  }) {
16960
16780
  var _a;
16961
16781
  const environment = useService(EnvironmentDefinition);
@@ -16967,19 +16787,11 @@ function useLottie({
16967
16787
  []
16968
16788
  );
16969
16789
  const containerRef = useRef(null);
16970
- const [playButtonElement, setPlayButtonElement] = useState(null);
16971
- useEffect(() => {
16972
- var _a2;
16973
- const el = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelector(
16974
- `.${semanticSelectors.playButton}`
16975
- );
16976
- setPlayButtonElement(el ?? null);
16977
- }, []);
16978
- useStyleRefreshKey(
16979
- playButtonElement,
16980
- displayPropertyToObserve
16790
+ const isPlayButtonHidden = !useHasDisplayedElement(
16791
+ containerRef,
16792
+ [`.${semanticSelectors.playButton}`],
16793
+ allowClickToStop
16981
16794
  );
16982
- const isPlayButtonHidden = !isSSR && playButtonElement ? window.getComputedStyle(playButtonElement).display === "none" : false;
16983
16795
  const lottieRef = useRef(null);
16984
16796
  const [animationData, setAnimationData] = useState(null);
16985
16797
  const [isPlaying, setIsPlaying] = useState(
@@ -17127,7 +16939,7 @@ const Lottie = (props) => {
17127
16939
  handleComplete,
17128
16940
  handlePause,
17129
16941
  handleResume
17130
- } = useLottie({ animationUrl, autoplay, speed });
16942
+ } = useLottie({ animationUrl, autoplay, speed, allowClickToStop });
17131
16943
  return /* @__PURE__ */ jsx(
17132
16944
  "div",
17133
16945
  {
@@ -47,7 +47,6 @@ export declare const editorOverrides: {
47
47
  readonly showButtonOnHover: "always";
48
48
  readonly allowClickToStop: false;
49
49
  };
50
- export declare const displayPropertyToObserve: string[];
51
50
  export declare const testIds: {
52
51
  readonly animationClickWrapper: "lottie-animation-click-wrapper";
53
52
  };
@@ -1,6 +1,6 @@
1
1
  import { LottieRefCurrentProps } from 'lottie-react';
2
2
  import { UseLottieParams } from '../types';
3
- export declare function useLottie({ animationUrl, autoplay, speed, }: UseLottieParams): {
3
+ export declare function useLottie({ animationUrl, autoplay, speed, allowClickToStop, }: UseLottieParams): {
4
4
  containerRef: import('react').RefObject<HTMLDivElement>;
5
5
  lottieRef: import('react').MutableRefObject<LottieRefCurrentProps | null>;
6
6
  animationData: unknown;
@@ -1,6 +1,6 @@
1
1
  import { b as DISPLAY_GROUPS, E as ELEMENTS, D as DATA, L as LAYOUT, A as Archetype } from "../chunks/chunk-V7QOLP3D.js";
2
2
  import { g as getSelector } from "../chunks/manifest.js";
3
- import { c as speedConstraints, e as playButtonDefaults, f as DisplayNames, r as rootDataDefaults, b as showButtonOnHoverDefaults, g as borderDefaultValue, i as initialSize, s as semanticSelectors } from "../chunks/constants28.js";
3
+ import { c as speedConstraints, d as playButtonDefaults, e as DisplayNames, r as rootDataDefaults, b as showButtonOnHoverDefaults, f as borderDefaultValue, i as initialSize, s as semanticSelectors } from "../chunks/constants28.js";
4
4
  import { m as manifestFocusable, c as manifestMouseHover, d as manifestClickable } from "../chunks/manifestSdkMixins.js";
5
5
  const manifest = {
6
6
  id: "13165477-8205-4050-b078-424a1479159e",
@@ -29,6 +29,7 @@ export interface UseLottieParams {
29
29
  animationUrl?: string;
30
30
  autoplay?: boolean;
31
31
  speed?: number;
32
+ allowClickToStop?: boolean;
32
33
  }
33
34
  export type LottiePlayerAnyRendererProps = Omit<LottieComponentProps, 'renderer' | 'rendererSettings'> & {
34
35
  renderer?: RendererType;
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback, useMemo } from "react";
3
3
  import { c as clsx } from "../chunks/clsx.js";
4
4
  import { M as MOVEMENT_DIRECTION, A as AUTOPLAY_STATE, s as slideshowDataDefaults, a as semanticClassNames, b as ARIA_LABEL_NAMESPACE, S as SLIDESHOW_SLIDE_LTR_DIRECTION_EXPERIMENT, D as DefaultTranslations, T as TranslationKeys } from "../chunks/Slideshow.semanticClassNames.js";
5
- import { u as useResizeObserver } from "../chunks/useResizeObserver.js";
5
+ import { u as useHasDisplayedElement } from "../chunks/useHasDisplayedElement.js";
6
6
  import { B as Button } from "../chunks/Button.js";
7
7
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
8
8
  import { d as directionStyles } from "../chunks/direction.module.js";
@@ -515,7 +515,11 @@ const PauseButton = ({
515
515
  }
516
516
  );
517
517
  };
518
- const isDisplayed = (element) => !!element && getComputedStyle(element).display !== "none";
518
+ const SLIDE_CHANGING_CONTROL_SELECTORS = [
519
+ ".animated-icon",
520
+ ".label",
521
+ `.${semanticClassNames.pagination}`
522
+ ];
519
523
  const Slideshow = (props) => {
520
524
  var _a, _b;
521
525
  const {
@@ -562,30 +566,11 @@ const Slideshow = (props) => {
562
566
  const navigationButtonsProps = elementProps == null ? void 0 : elementProps.navigationButtons;
563
567
  const slideIndicatorsProps = elementProps == null ? void 0 : elementProps.slideIndicators;
564
568
  const controlsRef = useRef(null);
565
- const [forcePauseButton, setForcePauseButton] = useState(false);
566
- const evaluateSlideChangingControls = useCallback(() => {
567
- const container = controlsRef.current;
568
- if (!reducedMotion || !container) {
569
- setForcePauseButton(false);
570
- return;
571
- }
572
- const icon = container.querySelector(".animated-icon");
573
- const label = container.querySelector(".label");
574
- const indicators = container.querySelector(
575
- `.${semanticClassNames.pagination}`
576
- );
577
- setForcePauseButton(
578
- !isDisplayed(icon) && !isDisplayed(label) && !isDisplayed(indicators)
579
- );
580
- }, [reducedMotion]);
581
- useResizeObserver({
582
- callback: evaluateSlideChangingControls,
583
- ref: controlsRef,
584
- enabled: reducedMotion
585
- });
586
- useEffect(() => {
587
- evaluateSlideChangingControls();
588
- }, [evaluateSlideChangingControls]);
569
+ const forcePauseButton = !useHasDisplayedElement(
570
+ controlsRef,
571
+ SLIDE_CHANGING_CONTROL_SELECTORS,
572
+ reducedMotion
573
+ );
589
574
  const [autoplayState, setAutoplayState] = useState(
590
575
  autoplay ? AUTOPLAY_STATE.RUNNING : AUTOPLAY_STATE.PAUSED
591
576
  );
@@ -42,7 +42,6 @@ const showButtonOnHoverDefaults = {
42
42
  displayName: "On hover"
43
43
  }
44
44
  };
45
- const displayPropertyToObserve = ["display"];
46
45
  const testIds = {
47
46
  animationClickWrapper: "lottie-animation-click-wrapper"
48
47
  };
@@ -83,10 +82,9 @@ export {
83
82
  playIconSvg as a,
84
83
  showButtonOnHoverDefaults as b,
85
84
  speedConstraints as c,
86
- displayPropertyToObserve as d,
87
- playButtonDefaults as e,
88
- DisplayNames as f,
89
- borderDefaultValue as g,
85
+ playButtonDefaults as d,
86
+ DisplayNames as e,
87
+ borderDefaultValue as f,
90
88
  initialSize as i,
91
89
  pauseIconSvg as p,
92
90
  rootDataDefaults as r,
@@ -0,0 +1,26 @@
1
+ import { useState, useCallback, useEffect } from "react";
2
+ import { u as useResizeObserver } from "./useResizeObserver.js";
3
+ const isDisplayed = (element) => getComputedStyle(element).display !== "none";
4
+ function useHasDisplayedElement(containerRef, selectors, enabled = true) {
5
+ const [hasDisplayedElement, setHasDisplayedElement] = useState(true);
6
+ const selectorList = selectors.join(", ");
7
+ const evaluate = useCallback(() => {
8
+ const container = containerRef.current;
9
+ if (!enabled || !container) {
10
+ setHasDisplayedElement(true);
11
+ return;
12
+ }
13
+ const elements = Array.from(
14
+ container.querySelectorAll(selectorList)
15
+ );
16
+ setHasDisplayedElement(elements.some(isDisplayed));
17
+ }, [containerRef, selectorList, enabled]);
18
+ useResizeObserver({ callback: evaluate, ref: containerRef, enabled });
19
+ useEffect(() => {
20
+ evaluate();
21
+ }, [evaluate]);
22
+ return hasDisplayedElement;
23
+ }
24
+ export {
25
+ useHasDisplayedElement as u
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2438.0",
3
+ "version": "1.2440.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": "d82d11b87fcf12780a9013df58b95f5dabccd3ac2828ca6e58fa3e19"
200
+ "falconPackageHash": "05bfdc5d1e1c70b3571049d1109e49b13806fb2867a2430442f10219"
201
201
  }