@wix/editor-react-components 1.2545.0 → 1.2547.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/AudioPlayer/component.js +0 -3
- package/dist/site/components/AudioPlayer/manifest.js +6 -0
- package/dist/site/components/AudioPlayer/types.d.ts +1 -2
- package/dist/site/components/Repeater/LoadMoreButton.d.ts +1 -0
- package/dist/site/components/Repeater/component.js +50 -51
- package/dist/site/components/Repeater/hooks/useAsyncLoadMore.d.ts +3 -3
- package/dist/site/components/Repeater/hooks/useLoadMoreObserver.d.ts +1 -6
- package/package.json +2 -2
|
@@ -4,7 +4,6 @@ import React__default, { useRef, useCallback, useMemo, useEffect, useState, forw
|
|
|
4
4
|
import { c as clsx } from "../chunks/clsx.js";
|
|
5
5
|
import { useService } from "@wix/services-manager-react";
|
|
6
6
|
import { E as EnvironmentDefinition } from "../chunks/index2.js";
|
|
7
|
-
import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
|
|
8
7
|
import { d as directionStyles } from "../chunks/direction.module.js";
|
|
9
8
|
import Image3 from "../Image3/component.js";
|
|
10
9
|
import { A as ARIA_LABELS, s as selectors, d as dataDefaults } from "../chunks/constants39.js";
|
|
@@ -3564,7 +3563,6 @@ const AudioPlayer = (props) => {
|
|
|
3564
3563
|
id,
|
|
3565
3564
|
className,
|
|
3566
3565
|
direction,
|
|
3567
|
-
a11y,
|
|
3568
3566
|
audio,
|
|
3569
3567
|
coverImage,
|
|
3570
3568
|
displayMode,
|
|
@@ -3613,7 +3611,6 @@ const AudioPlayer = (props) => {
|
|
|
3613
3611
|
{
|
|
3614
3612
|
id,
|
|
3615
3613
|
...direction && { dir: direction },
|
|
3616
|
-
...a11y && convertA11yKeysToHtmlFormat(a11y),
|
|
3617
3614
|
onMouseEnter: onMouseIn,
|
|
3618
3615
|
onMouseLeave: onMouseOut,
|
|
3619
3616
|
className: clsx(
|
|
@@ -238,6 +238,12 @@ const manifest = {
|
|
|
238
238
|
...manifestMediaProgress(),
|
|
239
239
|
...manifestMouseHover()
|
|
240
240
|
},
|
|
241
|
+
displayFilters: {
|
|
242
|
+
data: {
|
|
243
|
+
// a11y is hidden because of ECL-17824. If you need to add a11y in the future, add another dataType.a11y under a different key
|
|
244
|
+
hide: ["a11y"]
|
|
245
|
+
}
|
|
246
|
+
},
|
|
241
247
|
displayGroups: {
|
|
242
248
|
coverArtGroup: {
|
|
243
249
|
displayName: DisplayNames.elements.coverMedia,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Audio, Direction, Image } from '@wix/editor-react-types';
|
|
2
2
|
import { Image3Props } from '../Image3/Image3.types';
|
|
3
3
|
import { SdkFunctionMouseHoverProps } from '../../../utils/functions/sdkFunctionCallbackProps';
|
|
4
4
|
export interface AudioPlayerElementProps {
|
|
@@ -28,7 +28,6 @@ export interface AudioPlayerProps extends SdkFunctionMouseHoverProps {
|
|
|
28
28
|
id?: string;
|
|
29
29
|
className?: string;
|
|
30
30
|
direction?: Direction;
|
|
31
|
-
a11y?: A11y;
|
|
32
31
|
audio?: Audio;
|
|
33
32
|
coverImage?: Image;
|
|
34
33
|
displayMode?: Image3Props['displayMode'];
|
|
@@ -4,65 +4,55 @@ import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
|
|
|
4
4
|
import { d as directionStyles } from "../chunks/direction.module.js";
|
|
5
5
|
import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
|
|
6
6
|
import { D as DEFAULT_ITEMS_PER_ROW, C as COLUMN_COUNT_CSS_VAR, T as TestIds, s as semanticClassNames } from "../chunks/constants23.js";
|
|
7
|
-
import React__default, { useState, useRef,
|
|
8
|
-
const useAsyncLoadMore = (onLoadMore, itemsLength, isLoadingProp) => {
|
|
9
|
-
const [
|
|
10
|
-
const [
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, [itemsLength]);
|
|
21
|
-
const handleLoadMore = useCallback(async () => {
|
|
22
|
-
itemsLengthAtLastLoad.current = itemsLength;
|
|
23
|
-
setIsLoading(true);
|
|
7
|
+
import React__default, { useState, useRef, useCallback, useEffect, forwardRef } from "react";
|
|
8
|
+
const useAsyncLoadMore = (onLoadMore, itemsLength, isIntersecting, isLoadingProp) => {
|
|
9
|
+
const [internalLoading, setInternalLoading] = useState(false);
|
|
10
|
+
const [requested, setRequested] = useState(false);
|
|
11
|
+
const inFlightRef = useRef(false);
|
|
12
|
+
const isLoading = isLoadingProp ?? internalLoading;
|
|
13
|
+
const load = useCallback(async () => {
|
|
14
|
+
if (inFlightRef.current) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
inFlightRef.current = true;
|
|
18
|
+
setRequested(true);
|
|
19
|
+
setInternalLoading(true);
|
|
24
20
|
try {
|
|
25
21
|
await (onLoadMore == null ? void 0 : onLoadMore());
|
|
26
22
|
} catch {
|
|
27
23
|
} finally {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
setHasMore(false);
|
|
31
|
-
itemsLengthAtLastLoad.current = null;
|
|
32
|
-
}
|
|
24
|
+
inFlightRef.current = false;
|
|
25
|
+
setInternalLoading(false);
|
|
33
26
|
}
|
|
34
|
-
}, [onLoadMore, itemsLength]);
|
|
35
|
-
return { isLoading: isLoadingProp ?? isLoading, handleLoadMore, hasMore };
|
|
36
|
-
};
|
|
37
|
-
const useLoadMoreObserver = ({
|
|
38
|
-
enabled,
|
|
39
|
-
onLoadMore
|
|
40
|
-
}) => {
|
|
41
|
-
const sentinelRef = useRef(null);
|
|
42
|
-
const onLoadMoreRef = useRef(onLoadMore);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
onLoadMoreRef.current = onLoadMore;
|
|
45
27
|
}, [onLoadMore]);
|
|
46
28
|
useEffect(() => {
|
|
47
|
-
|
|
29
|
+
setRequested(false);
|
|
30
|
+
}, [itemsLength]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!onLoadMore || !isIntersecting || isLoading || internalLoading || requested) {
|
|
48
33
|
return;
|
|
49
34
|
}
|
|
50
|
-
|
|
35
|
+
load();
|
|
36
|
+
}, [onLoadMore, isIntersecting, isLoading, internalLoading, requested, load]);
|
|
37
|
+
const hasReachedEnd = requested && !isLoading && !internalLoading;
|
|
38
|
+
return { isLoading, load, hasReachedEnd };
|
|
39
|
+
};
|
|
40
|
+
const useLoadMoreObserver = (enabled) => {
|
|
41
|
+
const sentinelRef = useRef(null);
|
|
42
|
+
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!enabled || !sentinelRef.current) {
|
|
45
|
+
setIsIntersecting(false);
|
|
51
46
|
return;
|
|
52
47
|
}
|
|
53
48
|
const observer = new IntersectionObserver(
|
|
54
|
-
([entry]) =>
|
|
55
|
-
var _a;
|
|
56
|
-
if (entry.isIntersecting) {
|
|
57
|
-
(_a = onLoadMoreRef.current) == null ? void 0 : _a.call(onLoadMoreRef);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
49
|
+
([entry]) => setIsIntersecting(entry.isIntersecting),
|
|
60
50
|
{ rootMargin: "200px" }
|
|
61
51
|
);
|
|
62
52
|
observer.observe(sentinelRef.current);
|
|
63
53
|
return () => observer.disconnect();
|
|
64
54
|
}, [enabled]);
|
|
65
|
-
return sentinelRef;
|
|
55
|
+
return [sentinelRef, isIntersecting];
|
|
66
56
|
};
|
|
67
57
|
const useItemsPerRow = (shouldMeasure) => {
|
|
68
58
|
const ref = useRef(null);
|
|
@@ -454,6 +444,7 @@ const LiveAnnouncer = ({
|
|
|
454
444
|
const LoadMoreButton = ({
|
|
455
445
|
onLoadMore,
|
|
456
446
|
isLoading,
|
|
447
|
+
disabled,
|
|
457
448
|
label = "Load more items"
|
|
458
449
|
}) => /* @__PURE__ */ jsx(
|
|
459
450
|
"button",
|
|
@@ -462,7 +453,7 @@ const LoadMoreButton = ({
|
|
|
462
453
|
"data-testid": TestIds.loadMoreButton,
|
|
463
454
|
className: styles.loadMoreTrigger,
|
|
464
455
|
onClick: onLoadMore,
|
|
465
|
-
disabled: isLoading,
|
|
456
|
+
disabled: disabled ?? isLoading,
|
|
466
457
|
"aria-busy": isLoading || void 0,
|
|
467
458
|
children: label
|
|
468
459
|
}
|
|
@@ -488,16 +479,17 @@ const Repeater = (props) => {
|
|
|
488
479
|
emptyState
|
|
489
480
|
} = props;
|
|
490
481
|
const presetsWrapperProps = ((_a = props.wix) == null ? void 0 : _a.presetsWrapperProps) || {};
|
|
491
|
-
const
|
|
482
|
+
const showsEmptyState = items.length === 0 && !!emptyState;
|
|
483
|
+
const [sentinelRef, isIntersecting] = useLoadMoreObserver(
|
|
484
|
+
!!onLoadMore && !showsEmptyState
|
|
485
|
+
);
|
|
486
|
+
const { isLoading, load, hasReachedEnd } = useAsyncLoadMore(
|
|
492
487
|
onLoadMore,
|
|
493
488
|
items.length,
|
|
489
|
+
isIntersecting,
|
|
494
490
|
isLoadingProp
|
|
495
491
|
);
|
|
496
492
|
const [ulRef, itemsPerRow] = useItemsPerRow(!!onLoadMore);
|
|
497
|
-
const sentinelRef = useLoadMoreObserver({
|
|
498
|
-
enabled: !!onLoadMore && hasMore,
|
|
499
|
-
onLoadMore: onLoadMore ? handleLoadMore : void 0
|
|
500
|
-
});
|
|
501
493
|
if (!items.length && emptyState) {
|
|
502
494
|
return null;
|
|
503
495
|
}
|
|
@@ -551,8 +543,15 @@ const Repeater = (props) => {
|
|
|
551
543
|
]
|
|
552
544
|
}
|
|
553
545
|
),
|
|
554
|
-
!!onLoadMore &&
|
|
555
|
-
/* @__PURE__ */ jsx(
|
|
546
|
+
!!onLoadMore && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
547
|
+
/* @__PURE__ */ jsx(
|
|
548
|
+
LoadMoreButton,
|
|
549
|
+
{
|
|
550
|
+
onLoadMore: load,
|
|
551
|
+
isLoading,
|
|
552
|
+
disabled: isLoading || hasReachedEnd
|
|
553
|
+
}
|
|
554
|
+
),
|
|
556
555
|
/* @__PURE__ */ jsx(
|
|
557
556
|
"div",
|
|
558
557
|
{
|
|
@@ -567,7 +566,7 @@ const Repeater = (props) => {
|
|
|
567
566
|
LiveAnnouncer,
|
|
568
567
|
{
|
|
569
568
|
itemCount: items.length,
|
|
570
|
-
hasMore,
|
|
569
|
+
hasMore: !hasReachedEnd,
|
|
571
570
|
onLoadMore
|
|
572
571
|
}
|
|
573
572
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const useAsyncLoadMore: (onLoadMore: (() => Promise<void>) | undefined, itemsLength: number, isLoadingProp?: boolean) => {
|
|
1
|
+
export declare const useAsyncLoadMore: (onLoadMore: (() => Promise<void>) | undefined, itemsLength: number, isIntersecting: boolean, isLoadingProp?: boolean) => {
|
|
2
2
|
isLoading: boolean;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
load: () => Promise<void>;
|
|
4
|
+
hasReachedEnd: boolean;
|
|
5
5
|
};
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
enabled: boolean;
|
|
3
|
-
onLoadMore: (() => void) | undefined;
|
|
4
|
-
};
|
|
5
|
-
export declare const useLoadMoreObserver: ({ enabled, onLoadMore, }: UseLoadMoreObserverArgs) => import('react').RefObject<HTMLDivElement>;
|
|
6
|
-
export {};
|
|
1
|
+
export declare const useLoadMoreObserver: (enabled: boolean) => readonly [import('react').RefObject<HTMLDivElement>, boolean];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/editor-react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2547.0",
|
|
4
4
|
"description": "React components for the Wix Editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -199,5 +199,5 @@
|
|
|
199
199
|
"registry": "https://registry.npmjs.org/",
|
|
200
200
|
"access": "public"
|
|
201
201
|
},
|
|
202
|
-
"falconPackageHash": "
|
|
202
|
+
"falconPackageHash": "c7ba27661995f7a2dd1bc00316e63d251c0775294e71c8fd98523b71"
|
|
203
203
|
}
|