@moontra/moonui-pro 3.4.15 → 3.4.17
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/cdn/index.global.js +107 -107
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -95542,8 +95542,10 @@ var NumberTickerInternal = ({
|
|
|
95542
95542
|
const [currentValue, setCurrentValue] = useState(startValue);
|
|
95543
95543
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
95544
95544
|
const [hasAnimated, setHasAnimated] = useState(false);
|
|
95545
|
+
const [isInViewport, setIsInViewport] = useState(false);
|
|
95545
95546
|
const elementRef = useRef(null);
|
|
95546
95547
|
const animationRef = useRef(null);
|
|
95548
|
+
const hasAnimatedRef = useRef(false);
|
|
95547
95549
|
const getEasingFunction = (t2) => {
|
|
95548
95550
|
switch (easing) {
|
|
95549
95551
|
case "linear":
|
|
@@ -95581,7 +95583,7 @@ var NumberTickerInternal = ({
|
|
|
95581
95583
|
return `${prefix}${formatted}${suffix}`;
|
|
95582
95584
|
};
|
|
95583
95585
|
const startAnimation = () => {
|
|
95584
|
-
if (isAnimating ||
|
|
95586
|
+
if (isAnimating || hasAnimatedRef.current && !repeat)
|
|
95585
95587
|
return;
|
|
95586
95588
|
setIsAnimating(true);
|
|
95587
95589
|
const startTime = performance.now();
|
|
@@ -95599,6 +95601,7 @@ var NumberTickerInternal = ({
|
|
|
95599
95601
|
} else {
|
|
95600
95602
|
setIsAnimating(false);
|
|
95601
95603
|
setHasAnimated(true);
|
|
95604
|
+
hasAnimatedRef.current = true;
|
|
95602
95605
|
setCurrentValue(endVal);
|
|
95603
95606
|
onComplete?.();
|
|
95604
95607
|
}
|
|
@@ -95615,8 +95618,12 @@ var NumberTickerInternal = ({
|
|
|
95615
95618
|
return;
|
|
95616
95619
|
const observer = new IntersectionObserver(
|
|
95617
95620
|
([entry]) => {
|
|
95618
|
-
|
|
95621
|
+
setIsInViewport(entry.isIntersecting);
|
|
95622
|
+
if (entry.isIntersecting && (!hasAnimatedRef.current || repeat)) {
|
|
95619
95623
|
startAnimation();
|
|
95624
|
+
} else if (!entry.isIntersecting && isAnimating && animationRef.current) {
|
|
95625
|
+
cancelAnimationFrame(animationRef.current);
|
|
95626
|
+
setIsAnimating(false);
|
|
95620
95627
|
}
|
|
95621
95628
|
},
|
|
95622
95629
|
{ threshold }
|
|
@@ -95628,12 +95635,12 @@ var NumberTickerInternal = ({
|
|
|
95628
95635
|
cancelAnimationFrame(animationRef.current);
|
|
95629
95636
|
}
|
|
95630
95637
|
};
|
|
95631
|
-
}, [useIntersectionObserver, threshold
|
|
95638
|
+
}, [useIntersectionObserver, threshold]);
|
|
95632
95639
|
useEffect(() => {
|
|
95633
|
-
if (!useIntersectionObserver && (repeat || !
|
|
95640
|
+
if (!useIntersectionObserver && (repeat || !hasAnimatedRef.current)) {
|
|
95634
95641
|
startAnimation();
|
|
95635
95642
|
}
|
|
95636
|
-
}, [value, repeat]);
|
|
95643
|
+
}, [value, repeat, useIntersectionObserver]);
|
|
95637
95644
|
return /* @__PURE__ */ jsxs(
|
|
95638
95645
|
"span",
|
|
95639
95646
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.17",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|