@wix/editor-react-components 1.2446.0 → 1.2447.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.
- package/dist/site/components/TextMarquee/TextMarquee.types.d.ts +3 -0
- package/dist/site/components/TextMarquee/component.js +49 -6
- package/dist/site/components/TextMarquee/components/PlayPauseButton.d.ts +4 -1
- package/dist/site/components/TextMarquee/components/constants.d.ts +10 -0
- package/dist/site/components/TextMarquee/manifest.js +11 -1
- package/package.json +2 -2
|
@@ -41,8 +41,11 @@ export type TextMarqueeProps = {
|
|
|
41
41
|
font?: string;
|
|
42
42
|
spaceBetweenItems?: string;
|
|
43
43
|
} & Record<string, unknown>;
|
|
44
|
+
useNewA11y?: boolean;
|
|
44
45
|
translations: {
|
|
45
46
|
ariaLabel?: string;
|
|
47
|
+
playAnimation?: string;
|
|
48
|
+
pauseAnimation?: string;
|
|
46
49
|
};
|
|
47
50
|
tagName?: TagName;
|
|
48
51
|
isPreviewAnimationActive?: boolean;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
|
+
import { useService } from "@wix/services-manager-react";
|
|
5
|
+
import { E as EnvironmentDefinition } from "../chunks/index2.js";
|
|
6
|
+
import { T as TranslationsDefinition } from "../chunks/index6.js";
|
|
4
7
|
import { c as clsx } from "../chunks/clsx.js";
|
|
5
8
|
import { L as Link } from "../chunks/Link.js";
|
|
6
9
|
import { f as formatClassNames } from "../chunks/classNames.js";
|
|
7
10
|
import { p as parseSvg } from "../chunks/parseSvg.js";
|
|
11
|
+
import { g as getTranslation } from "../chunks/getTranslation.js";
|
|
8
12
|
const PauseSmall = ({ 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: "M7.5,5 C8.32842712,5 9,5.67157288 9,6.5 L9,11.5 C9,12.3284271 8.32842712,13 7.5,13 C6.67157288,13 6,12.3284271 6,11.5 L6,6.5 C6,5.67157288 6.67157288,5 7.5,5 Z M11.5,5 C12.3284271,5 13,5.67157288 13,6.5 L13,11.5 C13,12.3284271 12.3284271,13 11.5,13 C10.6715729,13 10,12.3284271 10,11.5 L10,6.5 C10,5.67157288 10.6715729,5 11.5,5 Z M7.5,6 C7.22385763,6 7,6.22385763 7,6.5 L7,11.5 C7,11.7761424 7.22385763,12 7.5,12 C7.77614237,12 8,11.7761424 8,11.5 L8,6.5 C8,6.22385763 7.77614237,6 7.5,6 Z M11.5,6 C11.2238576,6 11,6.22385763 11,6.5 L11,11.5 C11,11.7761424 11.2238576,12 11.5,12 C11.7761424,12 12,11.7761424 12,11.5 L12,6.5 C12,6.22385763 11.7761424,6 11.5,6 Z" }));
|
|
9
13
|
PauseSmall.displayName = "PauseSmall";
|
|
10
14
|
var PauseSmall_default = PauseSmall;
|
|
@@ -53,9 +57,20 @@ const TestIds = {
|
|
|
53
57
|
marqueeUnit: "marquee-unit",
|
|
54
58
|
headingTag: "heading-tag"
|
|
55
59
|
};
|
|
60
|
+
const PLAY_PAUSE_A11Y_EXPERIMENT = "TextMarqueePlayPauseA11y";
|
|
61
|
+
const TRANSLATIONS_NAMESPACE = "ariaLabels";
|
|
62
|
+
const TranslationKeys = {
|
|
63
|
+
playAnimation: "textMarquee_aria_label_play",
|
|
64
|
+
pauseAnimation: "textMarquee_aria_label_pause"
|
|
65
|
+
};
|
|
66
|
+
const DefaultTranslations = {
|
|
67
|
+
playAnimation: "Play animation",
|
|
68
|
+
pauseAnimation: "Pause animation"
|
|
69
|
+
};
|
|
56
70
|
const PlayPauseButton = ({
|
|
57
71
|
isPlaying,
|
|
58
72
|
onToggle,
|
|
73
|
+
useNewA11y = false,
|
|
59
74
|
translations,
|
|
60
75
|
className
|
|
61
76
|
}) => {
|
|
@@ -65,13 +80,14 @@ const PlayPauseButton = ({
|
|
|
65
80
|
e.preventDefault();
|
|
66
81
|
}
|
|
67
82
|
};
|
|
83
|
+
const actionLabel = isPlaying ? translations.pauseAnimation : translations.playAnimation;
|
|
68
84
|
return /* @__PURE__ */ jsx(
|
|
69
85
|
"button",
|
|
70
86
|
{
|
|
71
87
|
className,
|
|
72
88
|
onKeyDown: handleKeyDown,
|
|
73
|
-
"aria-label": translations.ariaLabel,
|
|
74
|
-
"aria-pressed": isPlaying,
|
|
89
|
+
"aria-label": useNewA11y ? actionLabel : translations.ariaLabel,
|
|
90
|
+
...useNewA11y ? {} : { "aria-pressed": isPlaying },
|
|
75
91
|
children: isPlaying ? /* @__PURE__ */ jsx(PauseSmall_default, {}) : /* @__PURE__ */ jsx(PlaySmall_default, {})
|
|
76
92
|
}
|
|
77
93
|
);
|
|
@@ -236,6 +252,7 @@ const TextMarquee$1 = (props) => {
|
|
|
236
252
|
speed,
|
|
237
253
|
movementDirection,
|
|
238
254
|
translations,
|
|
255
|
+
useNewA11y = false,
|
|
239
256
|
customClassNames = [],
|
|
240
257
|
isPreviewAnimationActive = false,
|
|
241
258
|
isBuilder
|
|
@@ -353,6 +370,7 @@ const TextMarquee$1 = (props) => {
|
|
|
353
370
|
{
|
|
354
371
|
isPlaying: animationState === "running",
|
|
355
372
|
onToggle: pauseOnClick,
|
|
373
|
+
useNewA11y,
|
|
356
374
|
translations,
|
|
357
375
|
className: clsx(styles.playButton, styles.visuallyHidden)
|
|
358
376
|
}
|
|
@@ -366,9 +384,33 @@ const SPEED_PANEL_RANGE = [0, 100];
|
|
|
366
384
|
const panelToDataSpeed = (speed) => SPEED_DATA_RANGE[0] + (speed - SPEED_PANEL_RANGE[0]) * (SPEED_DATA_RANGE[1] - SPEED_DATA_RANGE[0]) / (SPEED_PANEL_RANGE[1] - SPEED_PANEL_RANGE[0]);
|
|
367
385
|
const TextMarquee = React__default.forwardRef(
|
|
368
386
|
(props, ref) => {
|
|
387
|
+
var _a;
|
|
369
388
|
const DEFAULT_SPEED = 9;
|
|
389
|
+
const env = useService(EnvironmentDefinition);
|
|
390
|
+
const useNewA11y = ((_a = env == null ? void 0 : env.isExperimentOpen) == null ? void 0 : _a.call(env, PLAY_PAUSE_A11Y_EXPERIMENT)) ?? false;
|
|
391
|
+
const { translate } = useService(TranslationsDefinition);
|
|
392
|
+
const translations = useMemo(() => {
|
|
393
|
+
if (!useNewA11y) {
|
|
394
|
+
return { ariaLabel: "TextMarquee" };
|
|
395
|
+
}
|
|
396
|
+
const tr = translate(TRANSLATIONS_NAMESPACE);
|
|
397
|
+
return {
|
|
398
|
+
playAnimation: getTranslation(
|
|
399
|
+
tr,
|
|
400
|
+
"playAnimation",
|
|
401
|
+
TranslationKeys,
|
|
402
|
+
DefaultTranslations
|
|
403
|
+
),
|
|
404
|
+
pauseAnimation: getTranslation(
|
|
405
|
+
tr,
|
|
406
|
+
"pauseAnimation",
|
|
407
|
+
TranslationKeys,
|
|
408
|
+
DefaultTranslations
|
|
409
|
+
)
|
|
410
|
+
};
|
|
411
|
+
}, [useNewA11y, translate]);
|
|
370
412
|
const memoizedProps = useMemo(() => {
|
|
371
|
-
var
|
|
413
|
+
var _a2, _b, _c, _d;
|
|
372
414
|
const shouldAllowColorOverride = (svg) => {
|
|
373
415
|
if ((svg == null ? void 0 : svg.contentType) !== "color") {
|
|
374
416
|
return true;
|
|
@@ -389,8 +431,9 @@ const TextMarquee = React__default.forwardRef(
|
|
|
389
431
|
text: props.text || "Text Marquee",
|
|
390
432
|
resolvedLink: props.link
|
|
391
433
|
},
|
|
392
|
-
tagName: ((
|
|
393
|
-
|
|
434
|
+
tagName: ((_a2 = props.a11y) == null ? void 0 : _a2.tag) || "p",
|
|
435
|
+
useNewA11y,
|
|
436
|
+
translations,
|
|
394
437
|
className: `${props.className || ""} text-marquee`,
|
|
395
438
|
svgString: (_b = props == null ? void 0 : props.svg) == null ? void 0 : _b.svgContent,
|
|
396
439
|
allowColorOverride: shouldAllowColorOverride(props == null ? void 0 : props.svg),
|
|
@@ -400,7 +443,7 @@ const TextMarquee = React__default.forwardRef(
|
|
|
400
443
|
isInEditor: props.isInEditor || false,
|
|
401
444
|
ariaHidden: (_d = props.a11y) == null ? void 0 : _d.ariaHidden
|
|
402
445
|
};
|
|
403
|
-
}, [props]);
|
|
446
|
+
}, [props, useNewA11y, translations]);
|
|
404
447
|
return /* @__PURE__ */ jsx(TextMarquee$1, { ...memoizedProps, rootRef: ref });
|
|
405
448
|
}
|
|
406
449
|
);
|
|
@@ -2,10 +2,13 @@ import { default as React } from 'react';
|
|
|
2
2
|
type PlayPauseButtonProps = {
|
|
3
3
|
isPlaying: boolean;
|
|
4
4
|
onToggle: () => void;
|
|
5
|
+
useNewA11y?: boolean;
|
|
5
6
|
translations: {
|
|
6
7
|
ariaLabel?: string;
|
|
8
|
+
playAnimation?: string;
|
|
9
|
+
pauseAnimation?: string;
|
|
7
10
|
};
|
|
8
11
|
className?: string;
|
|
9
12
|
};
|
|
10
|
-
export declare const PlayPauseButton: ({ isPlaying, onToggle, translations, className, }: PlayPauseButtonProps) => React.JSX.Element;
|
|
13
|
+
export declare const PlayPauseButton: ({ isPlaying, onToggle, useNewA11y, translations, className, }: PlayPauseButtonProps) => React.JSX.Element;
|
|
11
14
|
export {};
|
|
@@ -4,3 +4,13 @@ export declare const TestIds: {
|
|
|
4
4
|
marqueeUnit: string;
|
|
5
5
|
headingTag: string;
|
|
6
6
|
};
|
|
7
|
+
export declare const PLAY_PAUSE_A11Y_EXPERIMENT = "TextMarqueePlayPauseA11y";
|
|
8
|
+
export declare const TRANSLATIONS_NAMESPACE = "ariaLabels";
|
|
9
|
+
export declare const TranslationKeys: {
|
|
10
|
+
readonly playAnimation: "textMarquee_aria_label_play";
|
|
11
|
+
readonly pauseAnimation: "textMarquee_aria_label_pause";
|
|
12
|
+
};
|
|
13
|
+
export declare const DefaultTranslations: {
|
|
14
|
+
readonly playAnimation: "Play animation";
|
|
15
|
+
readonly pauseAnimation: "Pause animation";
|
|
16
|
+
};
|
|
@@ -162,7 +162,17 @@ const manifest = {
|
|
|
162
162
|
resources: {
|
|
163
163
|
client: {
|
|
164
164
|
componentUrl: "./site/components/TextMarquee/component.tsx",
|
|
165
|
-
moduleSpecifier: "@wix/editor-react-components/TextMarquee"
|
|
165
|
+
moduleSpecifier: "@wix/editor-react-components/TextMarquee",
|
|
166
|
+
serviceDependencies: [
|
|
167
|
+
"@wix/viewer-service-environment",
|
|
168
|
+
"@wix/viewer-service-translations"
|
|
169
|
+
],
|
|
170
|
+
dependencies: {
|
|
171
|
+
serviceDependencies: [
|
|
172
|
+
"@wix/viewer-service-environment",
|
|
173
|
+
"@wix/viewer-service-translations"
|
|
174
|
+
]
|
|
175
|
+
}
|
|
166
176
|
},
|
|
167
177
|
editor: {
|
|
168
178
|
componentUrl: "./site/components/TextMarquee/component.preview.tsx",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2447.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": "
|
|
200
|
+
"falconPackageHash": "c2c560804b08a14c1ed0caba9014056c45883716d0bef03e4841601e"
|
|
201
201
|
}
|