@opensite/ui 3.3.6 → 3.3.8

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.
@@ -7,6 +7,9 @@ import { Img } from '@page-speed/img';
7
7
  import { Lightbox } from '@page-speed/lightbox';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { Icon } from '@page-speed/icon';
10
+ import { Slot } from '@radix-ui/react-slot';
11
+ import { cva } from 'class-variance-authority';
12
+ import { Pressable } from '@page-speed/pressable';
10
13
 
11
14
  // components/blocks/hero/hero-floating-images.tsx
12
15
  function cn(...inputs) {
@@ -401,9 +404,110 @@ var DynamicIcon = React.memo(function DynamicIcon2({
401
404
  return /* @__PURE__ */ jsx(Icon, { ...props, name, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
402
405
  });
403
406
  DynamicIcon.displayName = "DynamicIcon";
407
+ var badgeVariants = cva(
408
+ "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
409
+ {
410
+ variants: {
411
+ variant: {
412
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
413
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
414
+ destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
415
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
416
+ }
417
+ },
418
+ defaultVariants: {
419
+ variant: "default"
420
+ }
421
+ }
422
+ );
423
+ function Badge({
424
+ className,
425
+ variant,
426
+ asChild = false,
427
+ ...props
428
+ }) {
429
+ const Comp = asChild ? Slot : "span";
430
+ return /* @__PURE__ */ jsx(
431
+ Comp,
432
+ {
433
+ "data-slot": "badge",
434
+ className: cn(badgeVariants({ variant }), className),
435
+ ...props
436
+ }
437
+ );
438
+ }
439
+ var MOBILE_CLASSES = {
440
+ "fit-left": "items-start md:items-center",
441
+ "fit-center": "items-center",
442
+ "fit-right": "items-end md:items-center",
443
+ "full-left": "items-stretch md:items-center",
444
+ "full-center": "items-stretch md:items-center",
445
+ "full-right": "items-stretch md:items-center"
446
+ };
447
+ function BlockActions({
448
+ mobileConfig,
449
+ actionsClassName,
450
+ verticalSpacing = "mt-4 md:mt-8",
451
+ actions,
452
+ actionsSlot
453
+ }) {
454
+ const width = mobileConfig?.width ?? "full";
455
+ const position = mobileConfig?.position ?? "center";
456
+ const mobileLayoutClass = MOBILE_CLASSES[`${width}-${position}`];
457
+ if (actionsSlot) {
458
+ return /* @__PURE__ */ jsx("div", { children: actionsSlot });
459
+ } else if (actions && actions?.length > 0) {
460
+ return /* @__PURE__ */ jsx(
461
+ "div",
462
+ {
463
+ className: cn(
464
+ "flex flex-col md:flex-row flex-wrap gap-4",
465
+ mobileLayoutClass,
466
+ actionsClassName,
467
+ verticalSpacing
468
+ ),
469
+ children: actions.map((action, index) => /* @__PURE__ */ jsx(ActionComponent, { action }, index))
470
+ }
471
+ );
472
+ } else {
473
+ return null;
474
+ }
475
+ }
476
+ function ActionComponent({ action }) {
477
+ const {
478
+ label,
479
+ icon,
480
+ iconAfter,
481
+ children,
482
+ href,
483
+ onClick,
484
+ className: actionClassName,
485
+ ...pressableProps
486
+ } = action;
487
+ return /* @__PURE__ */ jsx(
488
+ Pressable,
489
+ {
490
+ href,
491
+ onClick,
492
+ asButton: action.asButton ?? true,
493
+ className: actionClassName,
494
+ ...pressableProps,
495
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
496
+ icon,
497
+ label,
498
+ iconAfter
499
+ ] })
500
+ }
501
+ );
502
+ }
404
503
  function HeroFloatingImages({
405
504
  sectionId = "hero-floating-images",
406
- children,
505
+ badge,
506
+ badgeIcon,
507
+ heading,
508
+ description,
509
+ actions,
510
+ actionsSlot,
407
511
  images,
408
512
  imagesSlot,
409
513
  zoomIconName = "lucide/zoom-in",
@@ -414,6 +518,10 @@ function HeroFloatingImages({
414
518
  className,
415
519
  gridClassName,
416
520
  contentClassName,
521
+ badgeClassName,
522
+ headingClassName,
523
+ descriptionClassName,
524
+ actionsClassName,
417
525
  galleryClassName,
418
526
  featuredImageClassName,
419
527
  secondaryImageClassName,
@@ -471,7 +579,7 @@ function HeroFloatingImages({
471
579
  "absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
472
580
  zoomIndicatorClassName
473
581
  ),
474
- children: /* @__PURE__ */ jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-background/90 shadow-lg", children: /* @__PURE__ */ jsx(DynamicIcon, { name: zoomIconName, size: 20 }) })
582
+ children: /* @__PURE__ */ jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg", children: /* @__PURE__ */ jsx(DynamicIcon, { name: zoomIconName, size: 20 }) })
475
583
  }
476
584
  ),
477
585
  [zoomIconName, zoomIndicatorClassName]
@@ -589,8 +697,10 @@ function HeroFloatingImages({
589
697
  secondaryImagesContent
590
698
  ]);
591
699
  const hasContent = useMemo(() => {
592
- return children !== void 0 && children !== null;
593
- }, [children]);
700
+ return Boolean(
701
+ badge || badgeIcon || heading || description || actionsSlot || actions && actions.length > 0
702
+ );
703
+ }, [actions, actionsSlot, badge, badgeIcon, description, heading]);
594
704
  const hasGallery = useMemo(() => {
595
705
  return imagesSlot || images && images.length > 0;
596
706
  }, [imagesSlot, images]);
@@ -613,7 +723,45 @@ function HeroFloatingImages({
613
723
  gridClassName
614
724
  ),
615
725
  children: [
616
- hasContent ? /* @__PURE__ */ jsx("div", { className: cn("flex flex-col justify-center", contentClassName), children }) : null,
726
+ hasContent ? /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col justify-center", contentClassName), children: [
727
+ badge && /* @__PURE__ */ jsxs(
728
+ Badge,
729
+ {
730
+ variant: "secondary",
731
+ className: cn("mb-6 w-fit", badgeClassName),
732
+ children: [
733
+ badge,
734
+ badgeIcon
735
+ ]
736
+ }
737
+ ),
738
+ heading && (typeof heading === "string" ? /* @__PURE__ */ jsx(
739
+ "h1",
740
+ {
741
+ className: cn(
742
+ "mb-6 text-4xl font-bold tracking-tight sm:text-5xl md:text-6xl",
743
+ headingClassName
744
+ ),
745
+ children: heading
746
+ }
747
+ ) : heading),
748
+ description && (typeof description === "string" ? /* @__PURE__ */ jsx(
749
+ "p",
750
+ {
751
+ className: cn("mb-8 max-w-lg text-lg", descriptionClassName),
752
+ children: description
753
+ }
754
+ ) : description),
755
+ /* @__PURE__ */ jsx(
756
+ BlockActions,
757
+ {
758
+ actions,
759
+ actionsSlot,
760
+ actionsClassName,
761
+ verticalSpacing: description ? "mt-0" : void 0
762
+ }
763
+ )
764
+ ] }) : null,
617
765
  hasGallery ? galleryContent : null
618
766
  ]
619
767
  }
@@ -547,10 +547,19 @@ function HeroMentorshipVideoSplit({
547
547
  const [skinClasses, setSkinClasses] = React.useState(null);
548
548
  const [skinStyle, setSkinStyle] = React.useState(null);
549
549
  React.useEffect(() => {
550
+ let isMounted = true;
550
551
  skins.loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
552
+ if (!isMounted) return;
551
553
  setSkinClasses(skins.resolveVideoClasses(skin));
552
554
  setSkinStyle(skins.getSkinStyleObject(skin));
555
+ }).catch(() => {
556
+ if (!isMounted) return;
557
+ setSkinClasses(null);
558
+ setSkinStyle(null);
553
559
  });
560
+ return () => {
561
+ isMounted = false;
562
+ };
554
563
  }, []);
555
564
  const renderAction = React.useMemo(() => {
556
565
  if (actionSlot) return actionSlot;
@@ -524,10 +524,19 @@ function HeroMentorshipVideoSplit({
524
524
  const [skinClasses, setSkinClasses] = useState(null);
525
525
  const [skinStyle, setSkinStyle] = useState(null);
526
526
  useEffect(() => {
527
+ let isMounted = true;
527
528
  loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
529
+ if (!isMounted) return;
528
530
  setSkinClasses(resolveVideoClasses(skin));
529
531
  setSkinStyle(getSkinStyleObject(skin));
532
+ }).catch(() => {
533
+ if (!isMounted) return;
534
+ setSkinClasses(null);
535
+ setSkinStyle(null);
530
536
  });
537
+ return () => {
538
+ isMounted = false;
539
+ };
531
540
  }, []);
532
541
  const renderAction = useMemo(() => {
533
542
  if (actionSlot) return actionSlot;
@@ -571,10 +571,19 @@ function HeroSoftwareGrowthVideoDialog({
571
571
  const [skinClasses, setSkinClasses] = React.useState(null);
572
572
  const [skinStyle, setSkinStyle] = React.useState(null);
573
573
  React.useEffect(() => {
574
+ let isMounted = true;
574
575
  skins.loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
576
+ if (!isMounted) return;
575
577
  setSkinClasses(skins.resolveVideoClasses(skin));
576
578
  setSkinStyle(skins.getSkinStyleObject(skin));
579
+ }).catch(() => {
580
+ if (!isMounted) return;
581
+ setSkinClasses(null);
582
+ setSkinStyle(null);
577
583
  });
584
+ return () => {
585
+ isMounted = false;
586
+ };
578
587
  }, []);
579
588
  const handleVideoClick = () => {
580
589
  if (onVideoClick) {
@@ -548,10 +548,19 @@ function HeroSoftwareGrowthVideoDialog({
548
548
  const [skinClasses, setSkinClasses] = useState(null);
549
549
  const [skinStyle, setSkinStyle] = useState(null);
550
550
  useEffect(() => {
551
+ let isMounted = true;
551
552
  loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
553
+ if (!isMounted) return;
552
554
  setSkinClasses(resolveVideoClasses(skin));
553
555
  setSkinStyle(getSkinStyleObject(skin));
556
+ }).catch(() => {
557
+ if (!isMounted) return;
558
+ setSkinClasses(null);
559
+ setSkinStyle(null);
554
560
  });
561
+ return () => {
562
+ isMounted = false;
563
+ };
555
564
  }, []);
556
565
  const handleVideoClick = () => {
557
566
  if (onVideoClick) {
@@ -572,10 +572,19 @@ function HeroVideoDialogGradient({
572
572
  const [skinClasses, setSkinClasses] = React.useState(null);
573
573
  const [skinStyle, setSkinStyle] = React.useState(null);
574
574
  React.useEffect(() => {
575
+ let isMounted = true;
575
576
  skins.loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
577
+ if (!isMounted) return;
576
578
  setSkinClasses(skins.resolveVideoClasses(skin));
577
579
  setSkinStyle(skins.getSkinStyleObject(skin));
580
+ }).catch(() => {
581
+ if (!isMounted) return;
582
+ setSkinClasses(null);
583
+ setSkinStyle(null);
578
584
  });
585
+ return () => {
586
+ isMounted = false;
587
+ };
579
588
  }, []);
580
589
  const handleVideoClick = () => {
581
590
  if (onVideoClick) {
@@ -549,10 +549,19 @@ function HeroVideoDialogGradient({
549
549
  const [skinClasses, setSkinClasses] = useState(null);
550
550
  const [skinStyle, setSkinStyle] = useState(null);
551
551
  useEffect(() => {
552
+ let isMounted = true;
552
553
  loadSkinFromJsDelivr("0.1.2", "skins/video/base.json").then((skin) => {
554
+ if (!isMounted) return;
553
555
  setSkinClasses(resolveVideoClasses(skin));
554
556
  setSkinStyle(getSkinStyleObject(skin));
557
+ }).catch(() => {
558
+ if (!isMounted) return;
559
+ setSkinClasses(null);
560
+ setSkinStyle(null);
555
561
  });
562
+ return () => {
563
+ isMounted = false;
564
+ };
556
565
  }, []);
557
566
  const handleVideoClick = () => {
558
567
  if (onVideoClick) {
@@ -835,7 +835,7 @@ function LinkPageBentoLayout({
835
835
  "div",
836
836
  {
837
837
  className: cn(
838
- "h-20 w-20 overflow-hidden rounded-full ring-2 ring-neutral-200",
838
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
839
839
  avatarClassName
840
840
  ),
841
841
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -843,7 +843,7 @@ function LinkPageBentoLayout({
843
843
  {
844
844
  src: resolvedAvatar.src,
845
845
  alt: resolvedAvatar.alt,
846
- className: "h-full w-full object-cover",
846
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
847
847
  optixFlowConfig
848
848
  }
849
849
  )
@@ -814,7 +814,7 @@ function LinkPageBentoLayout({
814
814
  "div",
815
815
  {
816
816
  className: cn(
817
- "h-20 w-20 overflow-hidden rounded-full ring-2 ring-neutral-200",
817
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
818
818
  avatarClassName
819
819
  ),
820
820
  children: /* @__PURE__ */ jsx(
@@ -822,7 +822,7 @@ function LinkPageBentoLayout({
822
822
  {
823
823
  src: resolvedAvatar.src,
824
824
  alt: resolvedAvatar.alt,
825
- className: "h-full w-full object-cover",
825
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
826
826
  optixFlowConfig
827
827
  }
828
828
  )
@@ -567,7 +567,7 @@ function LinkPageGridCards({
567
567
  "div",
568
568
  {
569
569
  className: cn(
570
- "h-20 w-20 overflow-hidden rounded-2xl shadow-lg ring-2 ring-primary",
570
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
571
571
  avatarClassName
572
572
  ),
573
573
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -575,7 +575,7 @@ function LinkPageGridCards({
575
575
  {
576
576
  src: resolvedAvatar.src,
577
577
  alt: resolvedAvatar.alt,
578
- className: "h-full w-full object-cover",
578
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
579
579
  optixFlowConfig
580
580
  }
581
581
  )
@@ -546,7 +546,7 @@ function LinkPageGridCards({
546
546
  "div",
547
547
  {
548
548
  className: cn(
549
- "h-20 w-20 overflow-hidden rounded-2xl shadow-lg ring-2 ring-primary",
549
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
550
550
  avatarClassName
551
551
  ),
552
552
  children: /* @__PURE__ */ jsx(
@@ -554,7 +554,7 @@ function LinkPageGridCards({
554
554
  {
555
555
  src: resolvedAvatar.src,
556
556
  alt: resolvedAvatar.alt,
557
- className: "h-full w-full object-cover",
557
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
558
558
  optixFlowConfig
559
559
  }
560
560
  )
@@ -564,7 +564,7 @@ function LinkPageMinimalProfile({
564
564
  "div",
565
565
  {
566
566
  className: cn(
567
- "h-20 w-20 overflow-hidden rounded-full",
567
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
568
568
  avatarClassName
569
569
  ),
570
570
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -572,7 +572,7 @@ function LinkPageMinimalProfile({
572
572
  {
573
573
  src: resolvedAvatar.src,
574
574
  alt: resolvedAvatar.alt,
575
- className: "h-full w-full object-cover",
575
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
576
576
  optixFlowConfig
577
577
  }
578
578
  )
@@ -543,7 +543,7 @@ function LinkPageMinimalProfile({
543
543
  "div",
544
544
  {
545
545
  className: cn(
546
- "h-20 w-20 overflow-hidden rounded-full",
546
+ "flex h-20 w-full max-w-56 items-center justify-center sm:h-24 sm:max-w-72",
547
547
  avatarClassName
548
548
  ),
549
549
  children: /* @__PURE__ */ jsx(
@@ -551,7 +551,7 @@ function LinkPageMinimalProfile({
551
551
  {
552
552
  src: resolvedAvatar.src,
553
553
  alt: resolvedAvatar.alt,
554
- className: "h-full w-full object-cover",
554
+ className: "h-auto max-h-20 w-auto max-w-full object-contain sm:max-h-24",
555
555
  optixFlowConfig
556
556
  }
557
557
  )
@@ -594,7 +594,7 @@ function LinkPageNewsletterSocial({
594
594
  "div",
595
595
  {
596
596
  className: cn(
597
- "h-24 w-24 overflow-hidden rounded-full bg-muted ring-4 ring-background shadow-lg",
597
+ "flex h-24 w-full max-w-72 items-center justify-center",
598
598
  avatarClassName
599
599
  ),
600
600
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -602,7 +602,7 @@ function LinkPageNewsletterSocial({
602
602
  {
603
603
  src: resolvedAvatar.src,
604
604
  alt: resolvedAvatar.alt,
605
- className: "h-full w-full object-cover",
605
+ className: "h-auto max-h-24 w-auto max-w-full object-contain",
606
606
  optixFlowConfig
607
607
  }
608
608
  )
@@ -573,7 +573,7 @@ function LinkPageNewsletterSocial({
573
573
  "div",
574
574
  {
575
575
  className: cn(
576
- "h-24 w-24 overflow-hidden rounded-full bg-muted ring-4 ring-background shadow-lg",
576
+ "flex h-24 w-full max-w-72 items-center justify-center",
577
577
  avatarClassName
578
578
  ),
579
579
  children: /* @__PURE__ */ jsx(
@@ -581,7 +581,7 @@ function LinkPageNewsletterSocial({
581
581
  {
582
582
  src: resolvedAvatar.src,
583
583
  alt: resolvedAvatar.alt,
584
- className: "h-full w-full object-cover",
584
+ className: "h-auto max-h-24 w-auto max-w-full object-contain",
585
585
  optixFlowConfig
586
586
  }
587
587
  )
@@ -649,7 +649,7 @@ function LinkTreeBlock({
649
649
  "div",
650
650
  {
651
651
  className: cn(
652
- "h-24 w-24 overflow-hidden rounded-full border-4 border-background bg-muted shadow-xl",
652
+ "flex h-24 w-full max-w-72 items-center justify-center",
653
653
  avatarClassName
654
654
  ),
655
655
  children: resolvedAvatar && /* @__PURE__ */ jsxRuntime.jsx(
@@ -657,7 +657,7 @@ function LinkTreeBlock({
657
657
  {
658
658
  src: resolvedAvatar.src,
659
659
  alt: resolvedAvatar.alt,
660
- className: "h-full w-full object-cover",
660
+ className: "h-auto max-h-24 w-auto max-w-full object-contain",
661
661
  optixFlowConfig
662
662
  }
663
663
  )
@@ -628,7 +628,7 @@ function LinkTreeBlock({
628
628
  "div",
629
629
  {
630
630
  className: cn(
631
- "h-24 w-24 overflow-hidden rounded-full border-4 border-background bg-muted shadow-xl",
631
+ "flex h-24 w-full max-w-72 items-center justify-center",
632
632
  avatarClassName
633
633
  ),
634
634
  children: resolvedAvatar && /* @__PURE__ */ jsx(
@@ -636,7 +636,7 @@ function LinkTreeBlock({
636
636
  {
637
637
  src: resolvedAvatar.src,
638
638
  alt: resolvedAvatar.alt,
639
- className: "h-full w-full object-cover",
639
+ className: "h-auto max-h-24 w-auto max-w-full object-contain",
640
640
  optixFlowConfig
641
641
  }
642
642
  )