@opensite/ui 3.11.2 → 3.12.0

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.
@@ -417,7 +417,10 @@ var CAPTION_SCRIM_STYLE = {
417
417
  background: "linear-gradient(180deg, rgba(8,12,24,0) 0%, rgba(8,12,24,0.55) 45%, rgba(8,12,24,0.78) 100%)",
418
418
  borderBottomLeftRadius: IG_TILE_RADIUS,
419
419
  borderBottomRightRadius: IG_TILE_RADIUS,
420
- pointerEvents: "none"
420
+ pointerEvents: "none",
421
+ // Hiding captions for now until we build in
422
+ // the dynamic behavior that clients can dictate
423
+ display: "none"
421
424
  };
422
425
  var CAPTION_TEXT_STYLE = {
423
426
  color: "#fff",
@@ -497,7 +500,7 @@ function likeBadge(likeCount) {
497
500
  letterSpacing: "0.01em"
498
501
  },
499
502
  children: [
500
- /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/heart", size: 15, "aria-hidden": "true" }),
503
+ /* @__PURE__ */ jsx(DynamicIcon, { name: "mdi/cards-heart", size: 15, "aria-hidden": "true" }),
501
504
  /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: likeCount.toLocaleString() })
502
505
  ]
503
506
  }
@@ -506,157 +509,148 @@ function likeBadge(likeCount) {
506
509
  var VIEWER_ACTIONS = [
507
510
  {
508
511
  id: "open-in-instagram",
509
- icon: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/external-link", size: 22, "aria-hidden": "true" }),
512
+ icon: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/instagram", size: 22, "aria-hidden": "true" }),
510
513
  label: "Instagram",
511
514
  ariaLabel: "Open in Instagram",
512
515
  onPress: (item) => openPermalink(item)
513
516
  }
514
517
  ];
515
- function RailStat({
516
- iconName,
517
- count,
518
- label,
519
- onPress
520
- }) {
521
- return /* @__PURE__ */ jsxs(
522
- "button",
518
+ function InstagramViewerRail({ item }) {
519
+ const meta = item.meta ?? {};
520
+ return /* @__PURE__ */ jsx(
521
+ "div",
523
522
  {
524
- type: "button",
525
- "aria-label": `${count.toLocaleString()} ${label}`,
526
- onClick: (e) => {
527
- e.stopPropagation();
528
- onPress();
529
- },
530
523
  style: {
524
+ position: "absolute",
525
+ right: 11,
526
+ bottom: 135,
531
527
  display: "flex",
532
528
  flexDirection: "column",
533
529
  alignItems: "center",
534
- gap: 5,
535
- padding: 0,
536
- border: "none",
537
- background: "transparent",
538
- color: "inherit",
539
- cursor: "pointer",
540
- font: "inherit"
530
+ gap: 18,
531
+ color: "var(--psmi-chrome-fg, #fff)",
532
+ zIndex: 3
541
533
  },
542
- children: [
543
- /* @__PURE__ */ jsx(
544
- "span",
545
- {
546
- style: {
547
- width: 46,
548
- height: 46,
549
- borderRadius: "50%",
550
- background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
551
- backdropFilter: "blur(6px)",
552
- WebkitBackdropFilter: "blur(6px)",
553
- display: "flex",
554
- alignItems: "center",
555
- justifyContent: "center"
556
- },
557
- children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, size: 22, "aria-hidden": "true" })
558
- }
559
- ),
560
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: count.toLocaleString() })
561
- ]
534
+ children: meta.href ? /* @__PURE__ */ jsx(
535
+ "a",
536
+ {
537
+ href: meta.href,
538
+ target: "_blank",
539
+ rel: "noopener noreferrer",
540
+ "aria-label": "Open in Instagram",
541
+ onClick: (e) => e.stopPropagation(),
542
+ style: {
543
+ display: "flex",
544
+ flexDirection: "column",
545
+ alignItems: "center",
546
+ padding: 0,
547
+ border: "none",
548
+ background: "transparent",
549
+ color: "inherit",
550
+ cursor: "pointer",
551
+ font: "inherit",
552
+ textDecoration: "none"
553
+ },
554
+ children: /* @__PURE__ */ jsx(
555
+ "span",
556
+ {
557
+ style: {
558
+ width: 46,
559
+ height: 46,
560
+ borderRadius: "50%",
561
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
562
+ backdropFilter: "blur(6px)",
563
+ WebkitBackdropFilter: "blur(6px)",
564
+ display: "flex",
565
+ alignItems: "center",
566
+ justifyContent: "center"
567
+ },
568
+ children: /* @__PURE__ */ jsx(
569
+ DynamicIcon,
570
+ {
571
+ name: "lucide/instagram",
572
+ size: 22,
573
+ "aria-hidden": "true"
574
+ }
575
+ )
576
+ }
577
+ )
578
+ }
579
+ ) : null
562
580
  }
563
581
  );
564
582
  }
565
- function InstagramViewerRail({ item }) {
566
- const meta = item.meta ?? {};
567
- const open = () => openPermalink(item);
583
+ function profileUrl(username) {
584
+ return `https://www.instagram.com/${username.replace(/^@+/, "")}/`;
585
+ }
586
+ var USERNAME_BADGE_STYLE = {
587
+ display: "inline-flex",
588
+ alignItems: "center",
589
+ gap: 7,
590
+ marginBottom: 10,
591
+ padding: "7px 12px",
592
+ borderRadius: 999,
593
+ background: "var(--psmi-chrome-bg, rgba(255,255,255,0.16))",
594
+ backdropFilter: "blur(8px)",
595
+ WebkitBackdropFilter: "blur(8px)",
596
+ border: "1px solid rgba(255, 255, 255, 0.18)",
597
+ color: "inherit",
598
+ fontSize: 13,
599
+ fontWeight: 700,
600
+ lineHeight: 1,
601
+ letterSpacing: "0.01em",
602
+ textDecoration: "none",
603
+ pointerEvents: "auto"
604
+ };
605
+ var VIEWER_TITLE_STYLE = {
606
+ fontSize: 16,
607
+ fontWeight: 700,
608
+ lineHeight: 1.35,
609
+ textShadow: "0 1px 2px rgba(0, 0, 0, 0.4)",
610
+ display: "-webkit-box",
611
+ WebkitLineClamp: 2,
612
+ WebkitBoxOrient: "vertical",
613
+ overflow: "hidden"
614
+ };
615
+ function InstagramViewerCaption({
616
+ item,
617
+ username
618
+ }) {
619
+ const handle = username?.replace(/^@+/, "");
620
+ const badgeContent = /* @__PURE__ */ jsxs(Fragment, { children: [
621
+ /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/instagram", size: 14, "aria-hidden": "true" }),
622
+ /* @__PURE__ */ jsx("span", { children: handle ? `@${handle}` : "Instagram" })
623
+ ] });
568
624
  return /* @__PURE__ */ jsxs(
569
625
  "div",
570
626
  {
571
627
  style: {
572
628
  position: "absolute",
573
- right: 11,
574
- bottom: 135,
575
- display: "flex",
576
- flexDirection: "column",
577
- alignItems: "center",
578
- gap: 18,
629
+ left: 16,
630
+ // Mirrors the library caption card's clearance for the actions rail.
631
+ right: 78,
632
+ bottom: 34,
579
633
  color: "var(--psmi-chrome-fg, #fff)",
580
- zIndex: 3
634
+ zIndex: 2
581
635
  },
582
636
  children: [
583
- typeof meta.likeCount === "number" ? /* @__PURE__ */ jsx(
584
- RailStat,
585
- {
586
- iconName: "lucide/heart",
587
- count: meta.likeCount,
588
- label: "likes",
589
- onPress: open
590
- }
591
- ) : null,
592
- typeof meta.commentCount === "number" ? /* @__PURE__ */ jsx(
593
- RailStat,
594
- {
595
- iconName: "lucide/message-circle",
596
- count: meta.commentCount,
597
- label: "comments",
598
- onPress: open
599
- }
600
- ) : null,
601
- typeof meta.viewCount === "number" ? /* @__PURE__ */ jsx(
602
- RailStat,
603
- {
604
- iconName: "lucide/eye",
605
- count: meta.viewCount,
606
- label: "views",
607
- onPress: open
608
- }
609
- ) : null,
610
- meta.href ? /* @__PURE__ */ jsxs(
637
+ handle ? /* @__PURE__ */ jsx(
611
638
  "a",
612
639
  {
613
- href: meta.href,
640
+ href: profileUrl(handle),
614
641
  target: "_blank",
615
642
  rel: "noopener noreferrer",
616
- "aria-label": "Open in Instagram",
643
+ "aria-label": `Open @${handle} on Instagram`,
617
644
  onClick: (e) => e.stopPropagation(),
618
- style: {
619
- display: "flex",
620
- flexDirection: "column",
621
- alignItems: "center",
622
- gap: 5,
623
- padding: 0,
624
- border: "none",
625
- background: "transparent",
626
- color: "inherit",
627
- cursor: "pointer",
628
- font: "inherit",
629
- textDecoration: "none"
630
- },
631
- children: [
632
- /* @__PURE__ */ jsx(
633
- "span",
634
- {
635
- style: {
636
- width: 46,
637
- height: 46,
638
- borderRadius: "50%",
639
- background: "var(--psmi-chrome-bg, rgba(255,255,255,0.14))",
640
- backdropFilter: "blur(6px)",
641
- WebkitBackdropFilter: "blur(6px)",
642
- display: "flex",
643
- alignItems: "center",
644
- justifyContent: "center"
645
- },
646
- children: /* @__PURE__ */ jsx(
647
- DynamicIcon,
648
- {
649
- name: "lucide/external-link",
650
- size: 22,
651
- "aria-hidden": "true"
652
- }
653
- )
654
- }
655
- ),
656
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { fontSize: 11, fontWeight: 600 }, children: "Instagram" })
657
- ]
645
+ style: { ...USERNAME_BADGE_STYLE, cursor: "pointer" },
646
+ children: badgeContent
658
647
  }
659
- ) : null
648
+ ) : (
649
+ // No username supplied: never fabricate a handle — degrade to a
650
+ // non-interactive "Instagram" chip in the same position.
651
+ /* @__PURE__ */ jsx("span", { style: USERNAME_BADGE_STYLE, children: badgeContent })
652
+ ),
653
+ /* @__PURE__ */ jsx("div", { style: VIEWER_TITLE_STYLE, children: item.title })
660
654
  ]
661
655
  }
662
656
  );
@@ -666,7 +660,8 @@ function InstagramFeedGrid({
666
660
  gridClassName,
667
661
  itemClassName,
668
662
  imageClassName,
669
- optixFlowConfig
663
+ optixFlowConfig,
664
+ showLikeBadges = false
670
665
  }) {
671
666
  const { open } = useImmersiveFeed();
672
667
  const posterImgProps = useMemo(() => {
@@ -703,7 +698,7 @@ function InstagramFeedGrid({
703
698
  showDuration: false,
704
699
  glyphMode: "hover",
705
700
  posterImgProps,
706
- badgeSlot: typeof likeCount === "number" ? likeBadge(likeCount) : void 0
701
+ badgeSlot: showLikeBadges && typeof likeCount === "number" ? likeBadge(likeCount) : void 0
707
702
  }
708
703
  ),
709
704
  mediaItem.title ? (
@@ -733,6 +728,8 @@ function InstagramPostGrid({
733
728
  itemClassName,
734
729
  imageClassName,
735
730
  optixFlowConfig,
731
+ username,
732
+ showLikeBadges = false,
736
733
  background,
737
734
  pattern,
738
735
  patternOpacity,
@@ -741,7 +738,7 @@ function InstagramPostGrid({
741
738
  const mediaItems = useMemo(() => {
742
739
  if (itemsSlot || !items) return [];
743
740
  const withImage = items.filter((item) => Boolean(item.image));
744
- if (process.env.NODE_ENV !== "production" && withImage.length < items.length) {
741
+ if (typeof process !== "undefined" && process.env.NODE_ENV !== "production" && withImage.length < items.length) {
745
742
  const skipped = items.filter((item) => !item.image);
746
743
  const skippedIds = skipped.map((item) => item.id).join(", ");
747
744
  console.warn(
@@ -770,7 +767,7 @@ function InstagramPostGrid({
770
767
  "h2",
771
768
  {
772
769
  className: cn(
773
- "text-xl font-medium tracking-tight md:text-2xl lg:text-3xl text-balance",
770
+ "text-xl font-medium tracking-tight md:text-3xl lg:text-5xl text-balance",
774
771
  headingClassName
775
772
  ),
776
773
  children: heading
@@ -780,7 +777,7 @@ function InstagramPostGrid({
780
777
  "p",
781
778
  {
782
779
  className: cn(
783
- "max-w-2xl text-balance text-muted-foreground",
780
+ "max-w-full md:max-w-2xl text-balance opacity-75",
784
781
  subheadingClassName
785
782
  ),
786
783
  children: subheading
@@ -804,14 +801,16 @@ function InstagramPostGrid({
804
801
  gridClassName,
805
802
  itemClassName,
806
803
  imageClassName,
807
- optixFlowConfig
804
+ optixFlowConfig,
805
+ showLikeBadges
808
806
  }
809
807
  ),
810
808
  /* @__PURE__ */ jsx(
811
809
  ImmersiveViewer,
812
810
  {
813
811
  ariaLabel: "Instagram post viewer",
814
- renderActions: ({ item }) => /* @__PURE__ */ jsx(InstagramViewerRail, { item })
812
+ renderActions: ({ item }) => /* @__PURE__ */ jsx(InstagramViewerRail, { item }),
813
+ renderCaption: (item) => /* @__PURE__ */ jsx(InstagramViewerCaption, { item, username })
815
814
  }
816
815
  )
817
816
  ] })