@vkontakte/vkui 7.6.3 → 7.6.4
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/components/CarouselBase/CarouselBase.d.ts.map +1 -1
- package/dist/components/CarouselBase/CarouselBase.js +6 -1
- package/dist/components/CarouselBase/CarouselBase.js.map +1 -1
- package/dist/components/CarouselBase/hooks.d.ts +1 -0
- package/dist/components/CarouselBase/hooks.d.ts.map +1 -1
- package/dist/components/CarouselBase/hooks.js +4 -0
- package/dist/components/CarouselBase/hooks.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js +4 -2
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/CarouselBase/CarouselBase.js +6 -1
- package/dist/cssm/components/CarouselBase/CarouselBase.js.map +1 -1
- package/dist/cssm/components/CarouselBase/hooks.js +4 -0
- package/dist/cssm/components/CarouselBase/hooks.js.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.js +4 -2
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/Slider/SliderThumb/SliderThumb.module.css +2 -2
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/CarouselBase/CarouselBase.tsx +9 -1
- package/src/components/CarouselBase/hooks.ts +6 -0
- package/src/components/CustomSelect/CustomSelect.tsx +4 -2
- package/src/components/Slider/SliderThumb/SliderThumb.module.css +1 -1
package/package.json
CHANGED
|
@@ -83,7 +83,8 @@ export const CarouselBase = ({
|
|
|
83
83
|
const shiftXCurrentRef = React.useRef<number>(0);
|
|
84
84
|
const shiftXDeltaRef = React.useRef<number>(0);
|
|
85
85
|
const initialized = React.useRef<boolean>(false);
|
|
86
|
-
const { addToAnimationQueue, getAnimateFunction, startAnimation } =
|
|
86
|
+
const { animationInQueue, addToAnimationQueue, getAnimateFunction, startAnimation } =
|
|
87
|
+
useSlideAnimation();
|
|
87
88
|
const isDragging = React.useRef(false);
|
|
88
89
|
|
|
89
90
|
const [controlElementsState, setControlElementsState] =
|
|
@@ -195,6 +196,7 @@ export const CarouselBase = ({
|
|
|
195
196
|
shiftXCurrentRef.current = Math.abs(shiftXDeltaRef.current) + snaps[0];
|
|
196
197
|
}
|
|
197
198
|
transformCssStyles(shiftX, animation);
|
|
199
|
+
animationFrameRef.current = null;
|
|
198
200
|
});
|
|
199
201
|
};
|
|
200
202
|
|
|
@@ -308,6 +310,12 @@ export const CarouselBase = ({
|
|
|
308
310
|
);
|
|
309
311
|
}
|
|
310
312
|
|
|
313
|
+
const isAnimationInProgress = animationInQueue() || animationFrameRef.current !== null;
|
|
314
|
+
|
|
315
|
+
if (isAnimationInProgress) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
311
319
|
shiftXCurrentRef.current = snaps[slideIndex];
|
|
312
320
|
initialized.current = true;
|
|
313
321
|
|
|
@@ -9,6 +9,7 @@ export function useSlideAnimation(): {
|
|
|
9
9
|
getAnimateFunction: (drawFunction: DrawInterface) => () => void;
|
|
10
10
|
addToAnimationQueue: (func: VoidFunction) => void;
|
|
11
11
|
startAnimation: () => void;
|
|
12
|
+
animationInQueue: () => boolean;
|
|
12
13
|
} {
|
|
13
14
|
const animationQueue = React.useRef<VoidFunction[]>([]);
|
|
14
15
|
|
|
@@ -33,7 +34,12 @@ export function useSlideAnimation(): {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
function animationInQueue() {
|
|
38
|
+
return !!animationQueue.current.length;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
return {
|
|
42
|
+
animationInQueue,
|
|
37
43
|
getAnimateFunction,
|
|
38
44
|
addToAnimationQueue,
|
|
39
45
|
startAnimation,
|
|
@@ -94,8 +94,10 @@ const FetchingStatus = ({
|
|
|
94
94
|
if (fetching) {
|
|
95
95
|
setStatus('fetching');
|
|
96
96
|
} else {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (status === 'fetching') {
|
|
98
|
+
setStatus('loaded');
|
|
99
|
+
setTimeout(() => setStatus('none'), FETCH_STATUS_RESET_DELAY);
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
102
|
},
|
|
101
103
|
[fetching],
|