@digital-b2c/coreui-kit 0.29.2 → 0.29.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/index.d.cts CHANGED
@@ -653,7 +653,7 @@ interface ContactModuleProps {
653
653
  image?: IPicture;
654
654
  title?: ReactNode;
655
655
  subtitle?: ReactNode;
656
- ctas?: ICta[];
656
+ ctas?: ICtaLogo[];
657
657
  blurred?: boolean;
658
658
  animateBlur?: boolean;
659
659
  }
package/dist/index.d.ts CHANGED
@@ -653,7 +653,7 @@ interface ContactModuleProps {
653
653
  image?: IPicture;
654
654
  title?: ReactNode;
655
655
  subtitle?: ReactNode;
656
- ctas?: ICta[];
656
+ ctas?: ICtaLogo[];
657
657
  blurred?: boolean;
658
658
  animateBlur?: boolean;
659
659
  }
package/dist/index.mjs CHANGED
@@ -601,7 +601,7 @@ var BrandsStrip = ({
601
601
  }) => {
602
602
  const [show, setShow] = useState(false);
603
603
  const [shouldAnimate, setShouldAnimate] = useState(false);
604
- const { is } = useViewPort_default();
604
+ const { is, device } = useViewPort_default();
605
605
  const isTabletBelow = is("tablet", "below");
606
606
  const containerRef = useRef(null);
607
607
  const marqueeRef = useRef(null);
@@ -659,33 +659,42 @@ var BrandsStrip = ({
659
659
  };
660
660
  useGSAP(
661
661
  () => {
662
+ let frameId;
662
663
  const refreshCalculations = () => {
664
+ var _a;
663
665
  if (!marqueeRef.current || !containerRef.current || logos.length === 0) return;
664
666
  const items = gsap.utils.toArray(marqueeRef.current.children);
665
667
  if (items.length === 0) return;
668
+ (_a = timeline.current) == null ? void 0 : _a.kill();
669
+ timeline.current = null;
670
+ gsap.set(items, { x: 0, xPercent: 0 });
666
671
  const itemWidth = items[0].clientWidth;
667
- const calculatedTotalWidth = shouldAnimate ? itemWidth * items.length + 120 * (items.length - 1) / 2 : itemWidth * items.length + 120 * (items.length - 1);
668
672
  const containerWidth = containerRef.current.clientWidth;
669
673
  if (containerWidth === 0) {
670
- requestAnimationFrame(refreshCalculations);
674
+ frameId = requestAnimationFrame(refreshCalculations);
671
675
  return;
672
676
  }
673
- if (containerWidth < calculatedTotalWidth) {
674
- setShouldAnimate(true);
675
- const ctx = gsap.context(() => {
676
- const loop = horizontalLoop(items, {
677
- repeat: -1,
678
- speed: 1,
679
- paddingRight: 120
680
- });
681
- timeline.current = loop;
682
- }, containerRef);
683
- return () => ctx.revert();
677
+ const calculatedTotalWidth = itemWidth * logos.length + 120 * (logos.length - 1);
678
+ const needsAnimation = containerWidth < calculatedTotalWidth;
679
+ if (needsAnimation !== shouldAnimate) {
680
+ setShouldAnimate(needsAnimation);
681
+ return;
684
682
  }
683
+ timeline.current = needsAnimation ? horizontalLoop(items, {
684
+ repeat: -1,
685
+ speed: 1,
686
+ paddingRight: 120
687
+ }) : null;
685
688
  };
686
689
  refreshCalculations();
690
+ return () => {
691
+ var _a;
692
+ if (frameId) cancelAnimationFrame(frameId);
693
+ (_a = timeline.current) == null ? void 0 : _a.kill();
694
+ timeline.current = null;
695
+ };
687
696
  },
688
- { scope: containerRef, dependencies: [logos] }
697
+ { scope: containerRef, dependencies: [logos, device, shouldAnimate] }
689
698
  );
690
699
  const handleMouseEnter = () => {
691
700
  setShow(true);
@@ -703,7 +712,7 @@ var BrandsStrip = ({
703
712
  if (logos.length === 0) return [];
704
713
  if (!shouldAnimate) return [...logos];
705
714
  return [...logos, ...logos];
706
- }, [logos]);
715
+ }, [logos, shouldAnimate]);
707
716
  return /* @__PURE__ */ jsxs(
708
717
  "div",
709
718
  {
@@ -3007,6 +3016,7 @@ var ContactModule = ({
3007
3016
  href: cta.url,
3008
3017
  isExternal: cta.isExternal,
3009
3018
  variant: ctas.length === 1 || key % 2 === 1 ? "primary" : "secondary",
3019
+ logo: cta.logo,
3010
3020
  children: cta.label
3011
3021
  },
3012
3022
  key