@wix/editor-react-components 1.2443.0 → 1.2445.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.
@@ -6,8 +6,8 @@ import { d as directionStyles } from "../chunks/direction.module.js";
6
6
  import { g as getTranslation } from "../chunks/getTranslation.js";
7
7
  import { B as Button } from "../chunks/Button.js";
8
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";
9
- import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
10
9
  import React__default, { useEffect, useState, useRef, useMemo } from "react";
10
+ import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
11
11
  import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
12
12
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
13
13
  import { u as useHasDisplayedElement } from "../chunks/useHasDisplayedElement.js";
@@ -16747,6 +16747,31 @@ var Lottie$1 = function Lottie2(props) {
16747
16747
  mode: (_c = interactivity === null || interactivity === void 0 ? void 0 : interactivity.mode) !== null && _c !== void 0 ? _c : "scroll"
16748
16748
  });
16749
16749
  };
16750
+ const applyLottieA11y = (container, a11y) => {
16751
+ const animEl = (container == null ? void 0 : container.querySelector("svg")) ?? (container == null ? void 0 : container.querySelector("canvas"));
16752
+ if (!animEl) {
16753
+ return;
16754
+ }
16755
+ if (a11y == null ? void 0 : a11y.ariaLabel) {
16756
+ animEl.setAttribute("aria-label", a11y.ariaLabel);
16757
+ animEl.setAttribute("role", "img");
16758
+ } else {
16759
+ animEl.removeAttribute("role");
16760
+ animEl.removeAttribute("aria-label");
16761
+ }
16762
+ if (a11y == null ? void 0 : a11y.ariaHidden) {
16763
+ animEl.setAttribute("aria-hidden", "true");
16764
+ } else {
16765
+ animEl.removeAttribute("aria-hidden");
16766
+ }
16767
+ };
16768
+ const toContainerA11y = (a11y) => {
16769
+ const attrs = convertA11yKeysToHtmlFormat(a11y);
16770
+ delete attrs["aria-label"];
16771
+ delete attrs["aria-hidden"];
16772
+ delete attrs["role"];
16773
+ return attrs;
16774
+ };
16750
16775
  const root = "root__qcSXu";
16751
16776
  const lottieContainer = "lottieContainer__2ucBB";
16752
16777
  const animation = "animation__x5-6f";
@@ -16762,15 +16787,28 @@ const styles = {
16762
16787
  animationClickWrapper
16763
16788
  };
16764
16789
  const TypedLottiePlayer = Lottie$1;
16765
- const LottieAnimation = ({ a11y, animationData, ...playerProps }) => animationData !== null ? /* @__PURE__ */ jsx(
16766
- TypedLottiePlayer,
16767
- {
16768
- className: styles.animation,
16769
- animationData,
16770
- ...playerProps,
16771
- ...a11y && convertA11yKeysToHtmlFormat(a11y)
16772
- }
16773
- ) : null;
16790
+ const LottieAnimation = ({ a11y, animationData, lottieRef, onDOMLoaded, ...playerProps }) => {
16791
+ const handleDOMLoaded = (event) => {
16792
+ var _a, _b;
16793
+ applyLottieA11y((_b = (_a = lottieRef == null ? void 0 : lottieRef.current) == null ? void 0 : _a.animationContainerRef) == null ? void 0 : _b.current, a11y);
16794
+ onDOMLoaded == null ? void 0 : onDOMLoaded(event);
16795
+ };
16796
+ useEffect(() => {
16797
+ var _a, _b;
16798
+ applyLottieA11y((_b = (_a = lottieRef == null ? void 0 : lottieRef.current) == null ? void 0 : _a.animationContainerRef) == null ? void 0 : _b.current, a11y);
16799
+ }, [a11y, lottieRef]);
16800
+ return animationData !== null ? /* @__PURE__ */ jsx(
16801
+ TypedLottiePlayer,
16802
+ {
16803
+ className: styles.animation,
16804
+ animationData,
16805
+ lottieRef,
16806
+ onDOMLoaded: handleDOMLoaded,
16807
+ ...playerProps,
16808
+ ...a11y && toContainerA11y(a11y)
16809
+ }
16810
+ ) : null;
16811
+ };
16774
16812
  function useLottie({
16775
16813
  animationUrl,
16776
16814
  autoplay = true,
@@ -0,0 +1,3 @@
1
+ import { LottieProps } from '../types';
2
+ export declare const applyLottieA11y: (container: HTMLDivElement | null | undefined, a11y: LottieProps["a11y"]) => void;
3
+ export declare const toContainerA11y: (a11y: NonNullable<LottieProps["a11y"]>) => Record<string, string | number | boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2443.0",
3
+ "version": "1.2445.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -82,7 +82,7 @@
82
82
  "@wix/sdk": "^1.21.13",
83
83
  "@wix/services-manager-react": "^0.1.27",
84
84
  "@wix/site-service-rendering-context": "^1.0.1",
85
- "@wix/site-ui": "1.191.0",
85
+ "@wix/site-ui": "1.192.0",
86
86
  "@wix/video": "^1.85.0",
87
87
  "@wix/viewer-service-consent-policy": "^1.0.100",
88
88
  "@wix/web-bi-logger": "^2.1.26",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "46ae1fbe924e1d979e3e1f23fc20a16506c636ffa2f9b369b56f2aa3"
200
+ "falconPackageHash": "fb22e8c05ce26a57255ba8adfa67c91f00ae3d1a19b7ff0f710a37b0"
201
201
  }