@wix/editor-react-components 1.2427.0 → 1.2429.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/Slideshow/component.js +34 -2
- package/dist/site/components/SocialPlayerFacebook/manifest.js +6 -0
- package/dist/site/components/SocialPlayerInstagram/manifest.js +6 -0
- package/dist/site/components/SocialPlayerSnapchat/manifest.js +6 -0
- package/dist/site/components/SocialPlayerTikTok/manifest.js +6 -0
- package/dist/site/components/SocialPlayerVimeo/manifest.js +6 -0
- package/dist/site/components/SocialPlayerYoutube/manifest.js +6 -0
- package/dist/site/components/chunks/useResizeObserver.js +6 -2
- package/package.json +2 -2
|
@@ -2,6 +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
6
|
import { B as Button } from "../chunks/Button.js";
|
|
6
7
|
import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
|
|
7
8
|
import { d as directionStyles } from "../chunks/direction.module.js";
|
|
@@ -514,6 +515,7 @@ const PauseButton = ({
|
|
|
514
515
|
}
|
|
515
516
|
);
|
|
516
517
|
};
|
|
518
|
+
const isDisplayed = (element) => !!element && getComputedStyle(element).display !== "none";
|
|
517
519
|
const Slideshow = (props) => {
|
|
518
520
|
var _a, _b;
|
|
519
521
|
const {
|
|
@@ -549,6 +551,7 @@ const Slideshow = (props) => {
|
|
|
549
551
|
const { translate } = useService(TranslationsDefinition);
|
|
550
552
|
const translateByKey = translate(ARIA_LABEL_NAMESPACE);
|
|
551
553
|
const t = (key) => getTranslation(translateByKey, key, TranslationKeys, DefaultTranslations);
|
|
554
|
+
const reducedMotion = environmentService.reducedMotion ?? false;
|
|
552
555
|
const siteDirection = environmentService.getLanguageDirection();
|
|
553
556
|
const isSlideLtrDirectionOpen = ((_a = environmentService == null ? void 0 : environmentService.isExperimentOpen) == null ? void 0 : _a.call(
|
|
554
557
|
environmentService,
|
|
@@ -558,10 +561,39 @@ const Slideshow = (props) => {
|
|
|
558
561
|
const visibilityProps = useVisibilityProps({ isHidden, hidden });
|
|
559
562
|
const navigationButtonsProps = elementProps == null ? void 0 : elementProps.navigationButtons;
|
|
560
563
|
const slideIndicatorsProps = elementProps == null ? void 0 : elementProps.slideIndicators;
|
|
564
|
+
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]);
|
|
561
589
|
const [autoplayState, setAutoplayState] = useState(
|
|
562
590
|
autoplay ? AUTOPLAY_STATE.RUNNING : AUTOPLAY_STATE.PAUSED
|
|
563
591
|
);
|
|
564
592
|
const [isPaused, setIsPaused] = useState(false);
|
|
593
|
+
useEffect(() => {
|
|
594
|
+
setIsPaused(reducedMotion);
|
|
595
|
+
}, [reducedMotion]);
|
|
596
|
+
const shouldShowPauseButton = rawAutoplay && (showPauseButton || autoplay && forcePauseButton);
|
|
565
597
|
const {
|
|
566
598
|
activeSlideIndex,
|
|
567
599
|
lastActiveSlideIndex,
|
|
@@ -718,7 +750,7 @@ const Slideshow = (props) => {
|
|
|
718
750
|
{
|
|
719
751
|
className: styles.controlsWrapper,
|
|
720
752
|
...direction && { dir: direction },
|
|
721
|
-
children: /* @__PURE__ */ jsxs("div", { className: styles.controlsWrapperContent, children: [
|
|
753
|
+
children: /* @__PURE__ */ jsxs("div", { ref: controlsRef, className: styles.controlsWrapperContent, children: [
|
|
722
754
|
/* @__PURE__ */ jsx(
|
|
723
755
|
NavigationButtons,
|
|
724
756
|
{
|
|
@@ -747,7 +779,7 @@ const Slideshow = (props) => {
|
|
|
747
779
|
] })
|
|
748
780
|
}
|
|
749
781
|
),
|
|
750
|
-
|
|
782
|
+
shouldShowPauseButton && /* @__PURE__ */ jsx(
|
|
751
783
|
PauseButton,
|
|
752
784
|
{
|
|
753
785
|
isPaused,
|
|
@@ -120,6 +120,12 @@ const manifest = {
|
|
|
120
120
|
[DATA.DATA_TYPE.text]: {
|
|
121
121
|
maxLength: 256
|
|
122
122
|
}
|
|
123
|
+
},
|
|
124
|
+
a11y: {
|
|
125
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
126
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
127
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
128
|
+
}
|
|
123
129
|
}
|
|
124
130
|
},
|
|
125
131
|
displayFilters: {
|
|
@@ -120,6 +120,12 @@ const manifest = {
|
|
|
120
120
|
[DATA.DATA_TYPE.text]: {
|
|
121
121
|
maxLength: 256
|
|
122
122
|
}
|
|
123
|
+
},
|
|
124
|
+
a11y: {
|
|
125
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
126
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
127
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
128
|
+
}
|
|
123
129
|
}
|
|
124
130
|
},
|
|
125
131
|
displayFilters: {
|
|
@@ -71,6 +71,12 @@ const manifest = {
|
|
|
71
71
|
maxLength: 256
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
+
a11y: {
|
|
75
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
76
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
77
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
74
80
|
autoPlay: {
|
|
75
81
|
dataType: DATA.DATA_TYPE.booleanValue,
|
|
76
82
|
displayName: "Play automatically"
|
|
@@ -71,6 +71,12 @@ const manifest = {
|
|
|
71
71
|
maxLength: 256
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
+
a11y: {
|
|
75
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
76
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
77
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
74
80
|
autoPlay: {
|
|
75
81
|
dataType: DATA.DATA_TYPE.booleanValue,
|
|
76
82
|
displayName: "Play automatically"
|
|
@@ -121,6 +121,12 @@ const manifest = {
|
|
|
121
121
|
maxLength: 256
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
|
+
a11y: {
|
|
125
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
126
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
127
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
124
130
|
autoPlay: {
|
|
125
131
|
dataType: DATA.DATA_TYPE.booleanValue,
|
|
126
132
|
displayName: "Play automatically"
|
|
@@ -2,9 +2,13 @@ import { useEffect } from "react";
|
|
|
2
2
|
const useResizeObserver = ({
|
|
3
3
|
callback,
|
|
4
4
|
ref,
|
|
5
|
-
elem
|
|
5
|
+
elem,
|
|
6
|
+
enabled = true
|
|
6
7
|
}) => {
|
|
7
8
|
useEffect(() => {
|
|
9
|
+
if (!enabled) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
8
12
|
const observer = new ResizeObserver(callback);
|
|
9
13
|
if (ref == null ? void 0 : ref.current) {
|
|
10
14
|
observer.observe(ref.current);
|
|
@@ -15,7 +19,7 @@ const useResizeObserver = ({
|
|
|
15
19
|
return () => {
|
|
16
20
|
observer.disconnect();
|
|
17
21
|
};
|
|
18
|
-
}, [ref, elem, callback]);
|
|
22
|
+
}, [ref, elem, callback, enabled]);
|
|
19
23
|
};
|
|
20
24
|
export {
|
|
21
25
|
useResizeObserver as u
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2429.0",
|
|
4
4
|
"description": "React components for the Wix Editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -196,5 +196,5 @@
|
|
|
196
196
|
"registry": "https://registry.npmjs.org/",
|
|
197
197
|
"access": "public"
|
|
198
198
|
},
|
|
199
|
-
"falconPackageHash": "
|
|
199
|
+
"falconPackageHash": "8cae54aded15ec7895d83adf7c984948c4f35693fd3cda3b11243737"
|
|
200
200
|
}
|