@loafmarkets/ui 0.1.413 → 0.1.415

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
@@ -2550,6 +2550,66 @@ function MobileDepthRow({
2550
2550
  }
2551
2551
  );
2552
2552
  }
2553
+ var isHlsManifest = (url) => /\.m3u8(\?|$)/i.test(url);
2554
+ var HLS_MIME = "application/vnd.apple.mpegurl";
2555
+ var MANIFEST_FAILURES = /* @__PURE__ */ new Set(["manifestLoadError", "manifestLoadTimeOut", "manifestParsingError"]);
2556
+ var HlsVideo = React5.forwardRef(
2557
+ ({ src, capLevelToPlayerSize = true, onError, ...videoProps }, ref) => {
2558
+ const videoRef = React5.useRef(null);
2559
+ React5.useImperativeHandle(ref, () => videoRef.current, []);
2560
+ const primary = typeof src === "string" ? src : src.src;
2561
+ const fallbackSrc = typeof src === "string" ? void 0 : src.fallbackSrc;
2562
+ const [failedSrc, setFailedSrc] = React5.useState(null);
2563
+ const usingFallback = fallbackSrc != null && failedSrc === primary;
2564
+ const activeSrc = usingFallback ? fallbackSrc : primary;
2565
+ const failPrimary = React5.useCallback(() => {
2566
+ if (fallbackSrc == null) return;
2567
+ setFailedSrc(primary);
2568
+ }, [fallbackSrc, primary]);
2569
+ React5.useEffect(() => {
2570
+ const video = videoRef.current;
2571
+ if (!video || !activeSrc) return;
2572
+ if (!isHlsManifest(activeSrc) || video.canPlayType(HLS_MIME)) {
2573
+ video.src = activeSrc;
2574
+ return;
2575
+ }
2576
+ let hls = null;
2577
+ let cancelled = false;
2578
+ void import('hls.js').then(({ default: Hls }) => {
2579
+ if (cancelled) return;
2580
+ if (!Hls.isSupported()) {
2581
+ video.src = activeSrc;
2582
+ return;
2583
+ }
2584
+ const instance = new Hls({
2585
+ capLevelToPlayerSize,
2586
+ startLevel: -1,
2587
+ enableWorker: true,
2588
+ startFragPrefetch: true
2589
+ });
2590
+ hls = instance;
2591
+ instance.on(Hls.Events.ERROR, (_evt, data) => {
2592
+ if (data?.fatal && MANIFEST_FAILURES.has(String(data.details))) failPrimary();
2593
+ });
2594
+ instance.loadSource(activeSrc);
2595
+ instance.attachMedia(video);
2596
+ });
2597
+ return () => {
2598
+ cancelled = true;
2599
+ hls?.destroy();
2600
+ };
2601
+ }, [activeSrc, capLevelToPlayerSize, failPrimary]);
2602
+ const handleError = React5.useCallback(
2603
+ (e) => {
2604
+ if (!usingFallback) failPrimary();
2605
+ onError?.(e);
2606
+ },
2607
+ [usingFallback, failPrimary, onError]
2608
+ );
2609
+ return /* @__PURE__ */ jsx("video", { ref: videoRef, onError: handleError, ...videoProps });
2610
+ }
2611
+ );
2612
+ HlsVideo.displayName = "HlsVideo";
2553
2613
  var PropertyTour = React5.forwardRef(
2554
2614
  ({
2555
2615
  className,
@@ -2564,11 +2624,6 @@ var PropertyTour = React5.forwardRef(
2564
2624
  ...props
2565
2625
  }, ref) => {
2566
2626
  const videoRef = React5.useRef(null);
2567
- React5.useEffect(() => {
2568
- if (videoRef.current && src) {
2569
- videoRef.current.load();
2570
- }
2571
- }, [src]);
2572
2627
  React5.useEffect(() => {
2573
2628
  const video = videoRef.current;
2574
2629
  if (!video) return;
@@ -2633,10 +2688,11 @@ var PropertyTour = React5.forwardRef(
2633
2688
  display: none !important;
2634
2689
  }
2635
2690
  ` }),
2636
- /* @__PURE__ */ jsxs(
2637
- "video",
2691
+ /* @__PURE__ */ jsx(
2692
+ HlsVideo,
2638
2693
  {
2639
2694
  ref: videoRef,
2695
+ src,
2640
2696
  className: "loaf-muted-video absolute inset-0 h-full w-full object-cover object-center",
2641
2697
  controls,
2642
2698
  controlsList: "nodownload noplaybackrate",
@@ -2650,10 +2706,7 @@ var PropertyTour = React5.forwardRef(
2650
2706
  muted,
2651
2707
  playsInline,
2652
2708
  poster,
2653
- children: [
2654
- /* @__PURE__ */ jsx("source", { src }),
2655
- "Your browser does not support the video tag."
2656
- ]
2709
+ children: "Your browser does not support the video tag."
2657
2710
  }
2658
2711
  )
2659
2712
  ] }) })
@@ -5639,7 +5692,7 @@ var Header = ({
5639
5692
  }
5640
5693
  )
5641
5694
  ] }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
5642
- /* @__PURE__ */ jsx(Button2, { className: "signup", onClick: handleSignIn, children: "Join Competition" }),
5695
+ /* @__PURE__ */ jsx(Button2, { className: "signup", onClick: handleSignIn, children: "Access Beta" }),
5643
5696
  /* @__PURE__ */ jsx(
5644
5697
  MobileOnlyButton,
5645
5698
  {
@@ -7184,7 +7237,7 @@ var LoginPopup = ({
7184
7237
  /* @__PURE__ */ jsxs(Title, { children: [
7185
7238
  /* @__PURE__ */ jsxs(LogoContainer3, { children: [
7186
7239
  /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }),
7187
- /* @__PURE__ */ jsx(LogoBeta, { children: "Private Beta" })
7240
+ /* @__PURE__ */ jsx(LogoBeta, { children: "Beta" })
7188
7241
  ] }),
7189
7242
  /* @__PURE__ */ jsx(TitleText, { children: "Welcome to Loaf" })
7190
7243
  ] }),
@@ -7279,7 +7332,7 @@ var LoginPopup = ({
7279
7332
  /* @__PURE__ */ jsxs(GateBrand, { children: [
7280
7333
  /* @__PURE__ */ jsx(GateLogoLink, { href: "https://loafmarkets.com", "aria-label": "Go to loafmarkets.com", children: /* @__PURE__ */ jsx(GateLogo, { src: logoSrc, alt: logoAlt }) }),
7281
7334
  /* @__PURE__ */ jsx(GateBrandDivider, {}),
7282
- /* @__PURE__ */ jsx(GateBetaTag, { children: "Private Beta" })
7335
+ /* @__PURE__ */ jsx(GateBetaTag, { children: "Beta" })
7283
7336
  ] }),
7284
7337
  /* @__PURE__ */ jsxs(GateOtpText, { children: [
7285
7338
  "We sent a code to",
@@ -7618,6 +7671,16 @@ var LoginPopup = ({
7618
7671
  ),
7619
7672
  /* @__PURE__ */ jsx(GateSubmit, { type: "submit", "aria-label": "Continue", disabled: loading || !email, children: loading ? /* @__PURE__ */ jsx(GateSpinner, {}) : /* @__PURE__ */ jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M5 12h14M13 6l6 6-6 6" }) }) })
7620
7673
  ] }),
7674
+ !signInMode && /* @__PURE__ */ jsx(GateHandleRow, { children: /* @__PURE__ */ jsx(
7675
+ GateEmailInput,
7676
+ {
7677
+ type: "text",
7678
+ autoComplete: "username",
7679
+ placeholder: "Claim your username (Optional)",
7680
+ value: handle,
7681
+ onChange: (event) => setHandle(event.target.value)
7682
+ }
7683
+ ) }),
7621
7684
  error && /* @__PURE__ */ jsx(StatusMessage, { $error: true, children: error })
7622
7685
  ] }),
7623
7686
  /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -7636,7 +7699,7 @@ var LoginPopup = ({
7636
7699
  /* @__PURE__ */ jsxs(GateBrand, { children: [
7637
7700
  /* @__PURE__ */ jsx(GateLogoLink, { href: "https://loafmarkets.com", "aria-label": "Go to loafmarkets.com", children: /* @__PURE__ */ jsx(GateLogo, { src: logoSrc, alt: logoAlt }) }),
7638
7701
  /* @__PURE__ */ jsx(GateBrandDivider, {}),
7639
- /* @__PURE__ */ jsx(GateBetaTag, { children: "Private Beta" })
7702
+ /* @__PURE__ */ jsx(GateBetaTag, { children: "Beta" })
7640
7703
  ] }),
7641
7704
  signInMode ? /* @__PURE__ */ jsxs(Fragment, { children: [
7642
7705
  signInStep,
@@ -7688,7 +7751,7 @@ var LoginPopup = ({
7688
7751
  /* @__PURE__ */ jsxs(Title, { children: [
7689
7752
  /* @__PURE__ */ jsxs(LogoContainer3, { children: [
7690
7753
  /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }),
7691
- /* @__PURE__ */ jsx(LogoBeta, { children: "Private Beta" })
7754
+ /* @__PURE__ */ jsx(LogoBeta, { children: "Beta" })
7692
7755
  ] }),
7693
7756
  /* @__PURE__ */ jsx(TitleText, { children: "Enter your access code" })
7694
7757
  ] }),
@@ -8352,6 +8415,9 @@ var GateSubmit = styled10.button`
8352
8415
  cursor: default;
8353
8416
  }
8354
8417
  `;
8418
+ var GateHandleRow = styled10(CodeInputWrapper)`
8419
+ margin-top: 0.6rem;
8420
+ `;
8355
8421
  var GateEmailInput = styled10.input`
8356
8422
  flex: 1;
8357
8423
  min-width: 0;
@@ -9772,8 +9838,9 @@ function GalleryMapSection({
9772
9838
  isMobile ? /* @__PURE__ */ jsx(StackedGallery, { images, onPhotoClick }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9773
9839
  /* @__PURE__ */ jsxs(Carousel, { children: [
9774
9840
  showVideo && videoUrl && /* @__PURE__ */ jsx(VideoOverlay, { children: /* @__PURE__ */ jsx(
9775
- "video",
9841
+ HlsVideo,
9776
9842
  {
9843
+ src: videoUrl,
9777
9844
  autoPlay: true,
9778
9845
  loop: true,
9779
9846
  playsInline: true,
@@ -9782,8 +9849,7 @@ function GalleryMapSection({
9782
9849
  onVolumeChange: (e) => {
9783
9850
  if (!e.currentTarget.muted) e.currentTarget.muted = true;
9784
9851
  },
9785
- style: { width: "100%", height: "100%", objectFit: "cover", borderRadius: 8 },
9786
- children: /* @__PURE__ */ jsx("source", { src: videoUrl, type: "video/mp4" })
9852
+ style: { width: "100%", height: "100%", objectFit: "cover", borderRadius: 8 }
9787
9853
  }
9788
9854
  ) }),
9789
9855
  /* @__PURE__ */ jsx(Track, { style: { transform: `translateX(-${carouselIndex * 100}%)` }, children: images.map((img, idx) => /* @__PURE__ */ jsxs(Slide, { onClick: () => onPhotoClick?.(idx), children: [
@@ -9899,7 +9965,7 @@ function GalleryMapSection({
9899
9965
  showFullVideo && videoUrl && /* @__PURE__ */ jsxs(FullVideoOverlay, { onClick: () => setShowFullVideo(false), children: [
9900
9966
  /* @__PURE__ */ jsx(FullVideoClose, { onClick: () => setShowFullVideo(false), "aria-label": "Close video", children: "\u2715" }),
9901
9967
  /* @__PURE__ */ jsx(
9902
- "video",
9968
+ HlsVideo,
9903
9969
  {
9904
9970
  src: videoUrl,
9905
9971
  autoPlay: true,
@@ -19629,8 +19695,9 @@ function GalleryContent({ galleryImages, startIndex, startWithVideo, title, subt
19629
19695
  }
19630
19696
  ),
19631
19697
  showVideo && videoUrl ? /* @__PURE__ */ jsx(GalleryVideoWrap, { children: /* @__PURE__ */ jsx(
19632
- "video",
19698
+ HlsVideo,
19633
19699
  {
19700
+ src: videoUrl,
19634
19701
  autoPlay: true,
19635
19702
  loop: true,
19636
19703
  playsInline: true,
@@ -19639,8 +19706,7 @@ function GalleryContent({ galleryImages, startIndex, startWithVideo, title, subt
19639
19706
  onVolumeChange: (e) => {
19640
19707
  if (!e.currentTarget.muted) e.currentTarget.muted = true;
19641
19708
  },
19642
- style: { objectFit: "contain", borderRadius: 12, boxShadow: "0 30px 80px rgba(0,0,0,0.55)" },
19643
- children: /* @__PURE__ */ jsx("source", { src: videoUrl, type: "video/mp4" })
19709
+ style: { objectFit: "contain", borderRadius: 12, boxShadow: "0 30px 80px rgba(0,0,0,0.55)" }
19644
19710
  }
19645
19711
  ) }) : galleryImages.map((image, idx) => /* @__PURE__ */ jsx(MainImage, { src: image.src, alt: image.alt, $visible: idx === currentIndex }, image.alt)),
19646
19712
  galleryImages[currentIndex]?.hotspots?.map((hotspot) => /* @__PURE__ */ jsx(
@@ -20650,6 +20716,6 @@ var SparklineChart = React5__default.memo(function SparklineChart2({ data, width
20650
20716
  );
20651
20717
  });
20652
20718
 
20653
- export { AssetSelectorBar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ContactPopup, Header, HousePositionSlider, HousePositionSliderMobile, LoafLiquidityBadge, LoafLiquidityLogo, LoginPopup, MobileTradeNav, OfferingProgressCard, OnboardingGuide, Orderbook, owner_booking_default as OwnerBooking, PaymentPopup, PortfolioActivityPanel, PortfolioSummary, PriceChart, PropertyBuy, PropertyCompareBar, PropertyDocuments, PropertyHeroHeader, PropertyHistory, PropertyInspectionTimes, PropertyMediaRow, PropertyNewsUpdates, PropertyOffers, PropertyOverview, PropertyPhotoGallery, PropertySubheader, PropertyTour, PropertyValuation, SiteFooter, Skeleton, SlideDigit, SparklineChart, ToastProvider, TradeConfirmationModal, TradingSlider, YourOrders, badgeVariants, buttonVariants, extractSparkline, hasPendingActivity, useAdaptivePolling, useToast };
20719
+ export { AssetSelectorBar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ContactPopup, Header, HlsVideo, HousePositionSlider, HousePositionSliderMobile, LoafLiquidityBadge, LoafLiquidityLogo, LoginPopup, MobileTradeNav, OfferingProgressCard, OnboardingGuide, Orderbook, owner_booking_default as OwnerBooking, PaymentPopup, PortfolioActivityPanel, PortfolioSummary, PriceChart, PropertyBuy, PropertyCompareBar, PropertyDocuments, PropertyHeroHeader, PropertyHistory, PropertyInspectionTimes, PropertyMediaRow, PropertyNewsUpdates, PropertyOffers, PropertyOverview, PropertyPhotoGallery, PropertySubheader, PropertyTour, PropertyValuation, SiteFooter, Skeleton, SlideDigit, SparklineChart, ToastProvider, TradeConfirmationModal, TradingSlider, YourOrders, badgeVariants, buttonVariants, extractSparkline, hasPendingActivity, useAdaptivePolling, useToast };
20654
20720
  //# sourceMappingURL=index.mjs.map
20655
20721
  //# sourceMappingURL=index.mjs.map