@deriv-web-design/ui 0.1.18 → 0.1.20

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.mjs CHANGED
@@ -2568,7 +2568,7 @@ function DotLottieInView({
2568
2568
  }, [rootMargin, threshold]);
2569
2569
  useEffect6(() => {
2570
2570
  if (mounted) return;
2571
- if (!(inView && enabled)) return;
2571
+ if (!inView) return;
2572
2572
  if (typeof window === "undefined") return;
2573
2573
  let cancelled = false;
2574
2574
  const commit = () => {
@@ -2583,15 +2583,23 @@ function DotLottieInView({
2583
2583
  }
2584
2584
  if (timerId !== null) window.clearTimeout(timerId);
2585
2585
  };
2586
- }, [inView, enabled, mounted]);
2586
+ }, [inView, mounted]);
2587
2587
  useEffect6(() => {
2588
2588
  if (!dotLottie) return;
2589
2589
  if (!enabled || !inView) {
2590
2590
  dotLottie.stop();
2591
2591
  return;
2592
2592
  }
2593
- dotLottie.stop();
2594
- dotLottie.play();
2593
+ const start = () => {
2594
+ dotLottie.stop();
2595
+ dotLottie.play();
2596
+ };
2597
+ if (dotLottie.isLoaded) {
2598
+ start();
2599
+ return;
2600
+ }
2601
+ dotLottie.addEventListener("load", start);
2602
+ return () => dotLottie.removeEventListener("load", start);
2595
2603
  }, [dotLottie, enabled, inView]);
2596
2604
  return /* @__PURE__ */ jsx27(
2597
2605
  "div",
@@ -2688,6 +2696,7 @@ var ChevronRight2 = () => /* @__PURE__ */ jsx28(
2688
2696
  )
2689
2697
  }
2690
2698
  );
2699
+ var DEFAULT_MEDIA_SIZES = "(min-width: 992px) 50vw, 100vw";
2691
2700
  function mediaSrc(item) {
2692
2701
  return typeof item.mediaUrl === "string" && item.mediaUrl !== "" ? item.mediaUrl : null;
2693
2702
  }
@@ -2711,6 +2720,10 @@ var MediaRenderer = ({ item, active, rootMargin, threshold }) => {
2711
2720
  "img",
2712
2721
  {
2713
2722
  src: item.posterUrl,
2723
+ ...item.posterSrcSet ? {
2724
+ srcSet: item.posterSrcSet,
2725
+ sizes: item.posterSizes ?? DEFAULT_MEDIA_SIZES
2726
+ } : {},
2714
2727
  alt: "",
2715
2728
  "aria-hidden": "true",
2716
2729
  loading: "lazy",
@@ -2724,6 +2737,7 @@ var MediaRenderer = ({ item, active, rootMargin, threshold }) => {
2724
2737
  "img",
2725
2738
  {
2726
2739
  src,
2740
+ ...item.mediaSrcSet ? { srcSet: item.mediaSrcSet, sizes: item.mediaSizes ?? DEFAULT_MEDIA_SIZES } : {},
2727
2741
  alt: item.title,
2728
2742
  loading: "lazy",
2729
2743
  decoding: "async"