@opensite/ui 3.0.7 → 3.0.9
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/README.md +80 -0
- package/dist/aspect-ratio.cjs +33 -0
- package/dist/aspect-ratio.d.cts +6 -0
- package/dist/aspect-ratio.d.ts +6 -0
- package/dist/aspect-ratio.js +11 -0
- package/dist/badge.d.cts +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/components.cjs +172 -1
- package/dist/components.d.cts +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +171 -2
- package/dist/hero-ad-campaign-expert.cjs +181 -73
- package/dist/hero-ad-campaign-expert.d.cts +2 -5
- package/dist/hero-ad-campaign-expert.d.ts +2 -5
- package/dist/hero-ad-campaign-expert.js +181 -73
- package/dist/hero-digital-agency-fullscreen.cjs +1 -1
- package/dist/hero-digital-agency-fullscreen.js +1 -1
- package/dist/hero-image-slider.cjs +1 -1
- package/dist/hero-image-slider.js +1 -1
- package/dist/hero-premium-split-avatars.cjs +231 -33
- package/dist/hero-premium-split-avatars.d.cts +15 -3
- package/dist/hero-premium-split-avatars.d.ts +15 -3
- package/dist/hero-premium-split-avatars.js +230 -33
- package/dist/image-slider.cjs +1 -1
- package/dist/image-slider.js +1 -1
- package/dist/index.cjs +172 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +171 -2
- package/dist/media-aspect-ratio.cjs +203 -0
- package/dist/media-aspect-ratio.d.cts +75 -0
- package/dist/media-aspect-ratio.d.ts +75 -0
- package/dist/media-aspect-ratio.js +180 -0
- package/dist/registry.cjs +246 -110
- package/dist/registry.js +245 -109
- package/dist/social-link-icon.d.cts +1 -1
- package/dist/social-link-icon.d.ts +1 -1
- package/package.json +8 -3
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
var React4 = require('react');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var img = require('@page-speed/img');
|
|
8
9
|
var AspectRatioPrimitive = require('@radix-ui/react-aspect-ratio');
|
|
9
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var pressable = require('@page-speed/pressable');
|
|
11
11
|
|
|
12
12
|
function _interopNamespace(e) {
|
|
@@ -34,11 +34,6 @@ var AspectRatioPrimitive__namespace = /*#__PURE__*/_interopNamespace(AspectRatio
|
|
|
34
34
|
function cn(...inputs) {
|
|
35
35
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
36
36
|
}
|
|
37
|
-
function AspectRatio({
|
|
38
|
-
...props
|
|
39
|
-
}) {
|
|
40
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AspectRatioPrimitive__namespace.Root, { "data-slot": "aspect-ratio", ...props });
|
|
41
|
-
}
|
|
42
37
|
var maxWidthStyles = {
|
|
43
38
|
sm: "max-w-screen-sm",
|
|
44
39
|
md: "max-w-screen-md",
|
|
@@ -447,6 +442,174 @@ var ContentGroup = React4__namespace.forwardRef(
|
|
|
447
442
|
}
|
|
448
443
|
);
|
|
449
444
|
ContentGroup.displayName = "ContentGroup";
|
|
445
|
+
function AspectRatio({
|
|
446
|
+
...props
|
|
447
|
+
}) {
|
|
448
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AspectRatioPrimitive__namespace.Root, { "data-slot": "aspect-ratio", ...props });
|
|
449
|
+
}
|
|
450
|
+
var DEFAULT_DEVICE_ASPECT_RATIOS = {
|
|
451
|
+
desktop: "square",
|
|
452
|
+
mobile: "square"
|
|
453
|
+
};
|
|
454
|
+
var DEFAULT_MEDIA_CLASS_NAME = "size-full object-cover";
|
|
455
|
+
var DEFAULT_FRAME_CLASS_NAME = "overflow-hidden";
|
|
456
|
+
var DEFAULT_BREAKPOINT = "lg";
|
|
457
|
+
var BREAKPOINT_VISIBILITY_CLASSES = {
|
|
458
|
+
sm: {
|
|
459
|
+
desktop: "hidden sm:block",
|
|
460
|
+
mobile: "sm:hidden"
|
|
461
|
+
},
|
|
462
|
+
md: {
|
|
463
|
+
desktop: "hidden md:block",
|
|
464
|
+
mobile: "md:hidden"
|
|
465
|
+
},
|
|
466
|
+
lg: {
|
|
467
|
+
desktop: "hidden lg:block",
|
|
468
|
+
mobile: "lg:hidden"
|
|
469
|
+
},
|
|
470
|
+
xl: {
|
|
471
|
+
desktop: "hidden xl:block",
|
|
472
|
+
mobile: "xl:hidden"
|
|
473
|
+
},
|
|
474
|
+
"2xl": {
|
|
475
|
+
desktop: "hidden 2xl:block",
|
|
476
|
+
mobile: "2xl:hidden"
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
var MEDIA_ASPECT_RATIOS = {
|
|
480
|
+
square: 1,
|
|
481
|
+
horizontal: 16 / 9,
|
|
482
|
+
vertical: 355 / 520
|
|
483
|
+
};
|
|
484
|
+
function resolveAspectRatio(ratio, fallback) {
|
|
485
|
+
const resolvedRatio = ratio ?? fallback;
|
|
486
|
+
if (typeof resolvedRatio === "number" && Number.isFinite(resolvedRatio) && resolvedRatio > 0) {
|
|
487
|
+
return resolvedRatio;
|
|
488
|
+
}
|
|
489
|
+
return MEDIA_ASPECT_RATIOS[resolvedRatio];
|
|
490
|
+
}
|
|
491
|
+
function hasRenderableMedia(mediaItem) {
|
|
492
|
+
return Boolean(mediaItem?.image?.src || mediaItem?.video?.src);
|
|
493
|
+
}
|
|
494
|
+
function renderMediaElement({
|
|
495
|
+
mediaItem,
|
|
496
|
+
optixFlowConfig,
|
|
497
|
+
mediaClassName,
|
|
498
|
+
imageClassName,
|
|
499
|
+
videoClassName
|
|
500
|
+
}) {
|
|
501
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
if (mediaItem.video?.src) {
|
|
505
|
+
const { className: inlineVideoClassName, poster, ...videoProps } = mediaItem.video;
|
|
506
|
+
const posterFallback = poster ?? (typeof mediaItem.image?.src === "string" ? mediaItem.image.src : void 0);
|
|
507
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
508
|
+
"video",
|
|
509
|
+
{
|
|
510
|
+
...videoProps,
|
|
511
|
+
poster: posterFallback,
|
|
512
|
+
className: cn(
|
|
513
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
514
|
+
mediaClassName,
|
|
515
|
+
videoClassName,
|
|
516
|
+
inlineVideoClassName
|
|
517
|
+
)
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
if (mediaItem.image?.src) {
|
|
522
|
+
const { className: inlineImageClassName, alt, src, ...imageProps } = mediaItem.image;
|
|
523
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
img.Img,
|
|
525
|
+
{
|
|
526
|
+
...imageProps,
|
|
527
|
+
src,
|
|
528
|
+
alt: alt ?? "",
|
|
529
|
+
className: cn(
|
|
530
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
531
|
+
mediaClassName,
|
|
532
|
+
imageClassName,
|
|
533
|
+
inlineImageClassName
|
|
534
|
+
),
|
|
535
|
+
optixFlowConfig
|
|
536
|
+
}
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
function MediaAspectRatio({
|
|
542
|
+
containerClassName,
|
|
543
|
+
mobileClassName,
|
|
544
|
+
desktopClassName,
|
|
545
|
+
frameClassName,
|
|
546
|
+
mobileFrameClassName,
|
|
547
|
+
desktopFrameClassName,
|
|
548
|
+
mediaClassName,
|
|
549
|
+
imageClassName,
|
|
550
|
+
videoClassName,
|
|
551
|
+
mediaItem,
|
|
552
|
+
optixFlowConfig,
|
|
553
|
+
deviceAspectRatios = DEFAULT_DEVICE_ASPECT_RATIOS,
|
|
554
|
+
breakpoint = DEFAULT_BREAKPOINT
|
|
555
|
+
}) {
|
|
556
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
const ratios = {
|
|
560
|
+
desktop: resolveAspectRatio(
|
|
561
|
+
deviceAspectRatios.desktop,
|
|
562
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.desktop
|
|
563
|
+
),
|
|
564
|
+
mobile: resolveAspectRatio(
|
|
565
|
+
deviceAspectRatios.mobile,
|
|
566
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.mobile
|
|
567
|
+
)
|
|
568
|
+
};
|
|
569
|
+
const sharedFrameClassName = cn(
|
|
570
|
+
DEFAULT_FRAME_CLASS_NAME,
|
|
571
|
+
frameClassName,
|
|
572
|
+
mediaItem.containerClassName
|
|
573
|
+
);
|
|
574
|
+
const visibilityClasses = BREAKPOINT_VISIBILITY_CLASSES[breakpoint];
|
|
575
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerClassName, "data-slot": "media-aspect-ratio", children: [
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative", visibilityClasses.mobile, mobileClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
577
|
+
AspectRatio,
|
|
578
|
+
{
|
|
579
|
+
ratio: ratios.mobile,
|
|
580
|
+
className: cn(sharedFrameClassName, mobileFrameClassName),
|
|
581
|
+
children: renderMediaElement({
|
|
582
|
+
mediaItem,
|
|
583
|
+
optixFlowConfig,
|
|
584
|
+
mediaClassName,
|
|
585
|
+
imageClassName,
|
|
586
|
+
videoClassName
|
|
587
|
+
})
|
|
588
|
+
}
|
|
589
|
+
) }),
|
|
590
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
591
|
+
"div",
|
|
592
|
+
{
|
|
593
|
+
className: cn(visibilityClasses.desktop, desktopClassName),
|
|
594
|
+
style: { aspectRatio: String(ratios.desktop) },
|
|
595
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
"div",
|
|
597
|
+
{
|
|
598
|
+
className: cn("size-full", sharedFrameClassName, desktopFrameClassName),
|
|
599
|
+
"data-slot": "media-aspect-ratio-frame",
|
|
600
|
+
children: renderMediaElement({
|
|
601
|
+
mediaItem,
|
|
602
|
+
optixFlowConfig,
|
|
603
|
+
mediaClassName,
|
|
604
|
+
imageClassName,
|
|
605
|
+
videoClassName
|
|
606
|
+
})
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] });
|
|
612
|
+
}
|
|
450
613
|
var useResponsiveLayout = ({
|
|
451
614
|
directionConfig = { desktop: "mediaRight", mobile: "mediaTop" }
|
|
452
615
|
}) => {
|
|
@@ -521,11 +684,6 @@ function ActionComponent({ action }) {
|
|
|
521
684
|
}
|
|
522
685
|
);
|
|
523
686
|
}
|
|
524
|
-
var ASPECT_RATIOS = {
|
|
525
|
-
square: 1,
|
|
526
|
-
horizontal: 16 / 9,
|
|
527
|
-
vertical: 355 / 520
|
|
528
|
-
};
|
|
529
687
|
function HeroAdCampaignExpert({
|
|
530
688
|
sectionId = "hero-ad-campaign-expert",
|
|
531
689
|
heading,
|
|
@@ -604,36 +762,6 @@ function HeroAdCampaignExpert({
|
|
|
604
762
|
descriptionClassName,
|
|
605
763
|
renderActions
|
|
606
764
|
]);
|
|
607
|
-
const hasMedia = mediaItem?.image || mediaItem?.video;
|
|
608
|
-
const renderMedia = React4.useMemo(() => {
|
|
609
|
-
if (!mediaItem) return null;
|
|
610
|
-
const { image, video } = mediaItem;
|
|
611
|
-
if (video) {
|
|
612
|
-
const { src, className: videoClassName, ...videoRest } = video;
|
|
613
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
614
|
-
"video",
|
|
615
|
-
{
|
|
616
|
-
src,
|
|
617
|
-
className: cn("size-full object-cover", videoClassName),
|
|
618
|
-
...videoRest
|
|
619
|
-
}
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
if (image) {
|
|
623
|
-
const { src, alt, className: imgClassName, ...imgRest } = image;
|
|
624
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
625
|
-
img.Img,
|
|
626
|
-
{
|
|
627
|
-
src,
|
|
628
|
-
alt,
|
|
629
|
-
className: cn("size-full object-cover", imgClassName),
|
|
630
|
-
optixFlowConfig,
|
|
631
|
-
...imgRest
|
|
632
|
-
}
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
|
-
return null;
|
|
636
|
-
}, [mediaItem, optixFlowConfig]);
|
|
637
765
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
766
|
Section,
|
|
639
767
|
{
|
|
@@ -662,38 +790,18 @@ function HeroAdCampaignExpert({
|
|
|
662
790
|
)
|
|
663
791
|
}
|
|
664
792
|
),
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
678
|
-
"div",
|
|
679
|
-
{
|
|
680
|
-
className: "hidden lg:block max-h-[70dvh] w-auto",
|
|
681
|
-
style: {
|
|
682
|
-
aspectRatio: ASPECT_RATIOS[mediaAspectRatios.desktop]
|
|
683
|
-
},
|
|
684
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
685
|
-
"div",
|
|
686
|
-
{
|
|
687
|
-
className: cn(
|
|
688
|
-
"size-full rounded-xl shadow-2xl overflow-hidden",
|
|
689
|
-
mediaItem?.containerClassName
|
|
690
|
-
),
|
|
691
|
-
children: renderMedia
|
|
692
|
-
}
|
|
693
|
-
)
|
|
694
|
-
}
|
|
695
|
-
)
|
|
696
|
-
] })
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
794
|
+
MediaAspectRatio,
|
|
795
|
+
{
|
|
796
|
+
containerClassName: "relative flex w-full justify-center lg:w-1/2",
|
|
797
|
+
desktopClassName: "max-h-[70dvh] w-auto",
|
|
798
|
+
mobileClassName: "h-auto w-[80%] max-w-[355px]",
|
|
799
|
+
frameClassName: "rounded-xl shadow-2xl",
|
|
800
|
+
mediaItem,
|
|
801
|
+
optixFlowConfig,
|
|
802
|
+
deviceAspectRatios: mediaAspectRatios
|
|
803
|
+
}
|
|
804
|
+
)
|
|
697
805
|
]
|
|
698
806
|
}
|
|
699
807
|
) })
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { S as SectionBackground, s as SectionSpacing, t as PatternName } from './community-initiatives-D8cbIf_y.cjs';
|
|
3
|
+
import { ResponsiveMediaAspectRatioProps } from './media-aspect-ratio.cjs';
|
|
3
4
|
import { A as ActionConfig, M as MediaItem, O as OptixFlowConfig, h as DirectionConfig } from './blocks-DL92rOxr.cjs';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'class-variance-authority';
|
|
6
7
|
import '@page-speed/pressable';
|
|
7
8
|
import '@opensite/hooks/usePlatformFromUrl';
|
|
8
9
|
|
|
9
|
-
type MediaAspectRatio = "square" | "horizontal" | "vertical";
|
|
10
10
|
interface HeroAdCampaignExpertProps {
|
|
11
11
|
/**
|
|
12
12
|
* Main heading content
|
|
@@ -77,10 +77,7 @@ interface HeroAdCampaignExpertProps {
|
|
|
77
77
|
* Media aspect ratios for desktop and mobile breakpoints
|
|
78
78
|
* @default { desktop: "vertical", mobile: "vertical" }
|
|
79
79
|
*/
|
|
80
|
-
mediaAspectRatios?:
|
|
81
|
-
desktop: MediaAspectRatio;
|
|
82
|
-
mobile: MediaAspectRatio;
|
|
83
|
-
};
|
|
80
|
+
mediaAspectRatios?: ResponsiveMediaAspectRatioProps;
|
|
84
81
|
/**
|
|
85
82
|
* Direction configuration for desktop and mobile layouts
|
|
86
83
|
* @default { desktop: 'mediaRight', mobile: 'mediaTop' }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { S as SectionBackground, s as SectionSpacing, t as PatternName } from './community-initiatives-qC2HCInM.js';
|
|
3
|
+
import { ResponsiveMediaAspectRatioProps } from './media-aspect-ratio.js';
|
|
3
4
|
import { A as ActionConfig, M as MediaItem, O as OptixFlowConfig, h as DirectionConfig } from './blocks-DL92rOxr.js';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'class-variance-authority';
|
|
6
7
|
import '@page-speed/pressable';
|
|
7
8
|
import '@opensite/hooks/usePlatformFromUrl';
|
|
8
9
|
|
|
9
|
-
type MediaAspectRatio = "square" | "horizontal" | "vertical";
|
|
10
10
|
interface HeroAdCampaignExpertProps {
|
|
11
11
|
/**
|
|
12
12
|
* Main heading content
|
|
@@ -77,10 +77,7 @@ interface HeroAdCampaignExpertProps {
|
|
|
77
77
|
* Media aspect ratios for desktop and mobile breakpoints
|
|
78
78
|
* @default { desktop: "vertical", mobile: "vertical" }
|
|
79
79
|
*/
|
|
80
|
-
mediaAspectRatios?:
|
|
81
|
-
desktop: MediaAspectRatio;
|
|
82
|
-
mobile: MediaAspectRatio;
|
|
83
|
-
};
|
|
80
|
+
mediaAspectRatios?: ResponsiveMediaAspectRatioProps;
|
|
84
81
|
/**
|
|
85
82
|
* Direction configuration for desktop and mobile layouts
|
|
86
83
|
* @default { desktop: 'mediaRight', mobile: 'mediaTop' }
|
|
@@ -3,20 +3,15 @@ import * as React4 from 'react';
|
|
|
3
3
|
import React4__default, { useMemo } from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
7
|
import { Img } from '@page-speed/img';
|
|
7
8
|
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
8
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { Pressable } from '@page-speed/pressable';
|
|
10
10
|
|
|
11
11
|
// components/blocks/hero/hero-ad-campaign-expert.tsx
|
|
12
12
|
function cn(...inputs) {
|
|
13
13
|
return twMerge(clsx(inputs));
|
|
14
14
|
}
|
|
15
|
-
function AspectRatio({
|
|
16
|
-
...props
|
|
17
|
-
}) {
|
|
18
|
-
return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
|
|
19
|
-
}
|
|
20
15
|
var maxWidthStyles = {
|
|
21
16
|
sm: "max-w-screen-sm",
|
|
22
17
|
md: "max-w-screen-md",
|
|
@@ -425,6 +420,174 @@ var ContentGroup = React4.forwardRef(
|
|
|
425
420
|
}
|
|
426
421
|
);
|
|
427
422
|
ContentGroup.displayName = "ContentGroup";
|
|
423
|
+
function AspectRatio({
|
|
424
|
+
...props
|
|
425
|
+
}) {
|
|
426
|
+
return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
|
|
427
|
+
}
|
|
428
|
+
var DEFAULT_DEVICE_ASPECT_RATIOS = {
|
|
429
|
+
desktop: "square",
|
|
430
|
+
mobile: "square"
|
|
431
|
+
};
|
|
432
|
+
var DEFAULT_MEDIA_CLASS_NAME = "size-full object-cover";
|
|
433
|
+
var DEFAULT_FRAME_CLASS_NAME = "overflow-hidden";
|
|
434
|
+
var DEFAULT_BREAKPOINT = "lg";
|
|
435
|
+
var BREAKPOINT_VISIBILITY_CLASSES = {
|
|
436
|
+
sm: {
|
|
437
|
+
desktop: "hidden sm:block",
|
|
438
|
+
mobile: "sm:hidden"
|
|
439
|
+
},
|
|
440
|
+
md: {
|
|
441
|
+
desktop: "hidden md:block",
|
|
442
|
+
mobile: "md:hidden"
|
|
443
|
+
},
|
|
444
|
+
lg: {
|
|
445
|
+
desktop: "hidden lg:block",
|
|
446
|
+
mobile: "lg:hidden"
|
|
447
|
+
},
|
|
448
|
+
xl: {
|
|
449
|
+
desktop: "hidden xl:block",
|
|
450
|
+
mobile: "xl:hidden"
|
|
451
|
+
},
|
|
452
|
+
"2xl": {
|
|
453
|
+
desktop: "hidden 2xl:block",
|
|
454
|
+
mobile: "2xl:hidden"
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
var MEDIA_ASPECT_RATIOS = {
|
|
458
|
+
square: 1,
|
|
459
|
+
horizontal: 16 / 9,
|
|
460
|
+
vertical: 355 / 520
|
|
461
|
+
};
|
|
462
|
+
function resolveAspectRatio(ratio, fallback) {
|
|
463
|
+
const resolvedRatio = ratio ?? fallback;
|
|
464
|
+
if (typeof resolvedRatio === "number" && Number.isFinite(resolvedRatio) && resolvedRatio > 0) {
|
|
465
|
+
return resolvedRatio;
|
|
466
|
+
}
|
|
467
|
+
return MEDIA_ASPECT_RATIOS[resolvedRatio];
|
|
468
|
+
}
|
|
469
|
+
function hasRenderableMedia(mediaItem) {
|
|
470
|
+
return Boolean(mediaItem?.image?.src || mediaItem?.video?.src);
|
|
471
|
+
}
|
|
472
|
+
function renderMediaElement({
|
|
473
|
+
mediaItem,
|
|
474
|
+
optixFlowConfig,
|
|
475
|
+
mediaClassName,
|
|
476
|
+
imageClassName,
|
|
477
|
+
videoClassName
|
|
478
|
+
}) {
|
|
479
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
if (mediaItem.video?.src) {
|
|
483
|
+
const { className: inlineVideoClassName, poster, ...videoProps } = mediaItem.video;
|
|
484
|
+
const posterFallback = poster ?? (typeof mediaItem.image?.src === "string" ? mediaItem.image.src : void 0);
|
|
485
|
+
return /* @__PURE__ */ jsx(
|
|
486
|
+
"video",
|
|
487
|
+
{
|
|
488
|
+
...videoProps,
|
|
489
|
+
poster: posterFallback,
|
|
490
|
+
className: cn(
|
|
491
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
492
|
+
mediaClassName,
|
|
493
|
+
videoClassName,
|
|
494
|
+
inlineVideoClassName
|
|
495
|
+
)
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
if (mediaItem.image?.src) {
|
|
500
|
+
const { className: inlineImageClassName, alt, src, ...imageProps } = mediaItem.image;
|
|
501
|
+
return /* @__PURE__ */ jsx(
|
|
502
|
+
Img,
|
|
503
|
+
{
|
|
504
|
+
...imageProps,
|
|
505
|
+
src,
|
|
506
|
+
alt: alt ?? "",
|
|
507
|
+
className: cn(
|
|
508
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
509
|
+
mediaClassName,
|
|
510
|
+
imageClassName,
|
|
511
|
+
inlineImageClassName
|
|
512
|
+
),
|
|
513
|
+
optixFlowConfig
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
function MediaAspectRatio({
|
|
520
|
+
containerClassName,
|
|
521
|
+
mobileClassName,
|
|
522
|
+
desktopClassName,
|
|
523
|
+
frameClassName,
|
|
524
|
+
mobileFrameClassName,
|
|
525
|
+
desktopFrameClassName,
|
|
526
|
+
mediaClassName,
|
|
527
|
+
imageClassName,
|
|
528
|
+
videoClassName,
|
|
529
|
+
mediaItem,
|
|
530
|
+
optixFlowConfig,
|
|
531
|
+
deviceAspectRatios = DEFAULT_DEVICE_ASPECT_RATIOS,
|
|
532
|
+
breakpoint = DEFAULT_BREAKPOINT
|
|
533
|
+
}) {
|
|
534
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
const ratios = {
|
|
538
|
+
desktop: resolveAspectRatio(
|
|
539
|
+
deviceAspectRatios.desktop,
|
|
540
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.desktop
|
|
541
|
+
),
|
|
542
|
+
mobile: resolveAspectRatio(
|
|
543
|
+
deviceAspectRatios.mobile,
|
|
544
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.mobile
|
|
545
|
+
)
|
|
546
|
+
};
|
|
547
|
+
const sharedFrameClassName = cn(
|
|
548
|
+
DEFAULT_FRAME_CLASS_NAME,
|
|
549
|
+
frameClassName,
|
|
550
|
+
mediaItem.containerClassName
|
|
551
|
+
);
|
|
552
|
+
const visibilityClasses = BREAKPOINT_VISIBILITY_CLASSES[breakpoint];
|
|
553
|
+
return /* @__PURE__ */ jsxs("div", { className: containerClassName, "data-slot": "media-aspect-ratio", children: [
|
|
554
|
+
/* @__PURE__ */ jsx("div", { className: cn("relative", visibilityClasses.mobile, mobileClassName), children: /* @__PURE__ */ jsx(
|
|
555
|
+
AspectRatio,
|
|
556
|
+
{
|
|
557
|
+
ratio: ratios.mobile,
|
|
558
|
+
className: cn(sharedFrameClassName, mobileFrameClassName),
|
|
559
|
+
children: renderMediaElement({
|
|
560
|
+
mediaItem,
|
|
561
|
+
optixFlowConfig,
|
|
562
|
+
mediaClassName,
|
|
563
|
+
imageClassName,
|
|
564
|
+
videoClassName
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
) }),
|
|
568
|
+
/* @__PURE__ */ jsx(
|
|
569
|
+
"div",
|
|
570
|
+
{
|
|
571
|
+
className: cn(visibilityClasses.desktop, desktopClassName),
|
|
572
|
+
style: { aspectRatio: String(ratios.desktop) },
|
|
573
|
+
children: /* @__PURE__ */ jsx(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
className: cn("size-full", sharedFrameClassName, desktopFrameClassName),
|
|
577
|
+
"data-slot": "media-aspect-ratio-frame",
|
|
578
|
+
children: renderMediaElement({
|
|
579
|
+
mediaItem,
|
|
580
|
+
optixFlowConfig,
|
|
581
|
+
mediaClassName,
|
|
582
|
+
imageClassName,
|
|
583
|
+
videoClassName
|
|
584
|
+
})
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
] });
|
|
590
|
+
}
|
|
428
591
|
var useResponsiveLayout = ({
|
|
429
592
|
directionConfig = { desktop: "mediaRight", mobile: "mediaTop" }
|
|
430
593
|
}) => {
|
|
@@ -499,11 +662,6 @@ function ActionComponent({ action }) {
|
|
|
499
662
|
}
|
|
500
663
|
);
|
|
501
664
|
}
|
|
502
|
-
var ASPECT_RATIOS = {
|
|
503
|
-
square: 1,
|
|
504
|
-
horizontal: 16 / 9,
|
|
505
|
-
vertical: 355 / 520
|
|
506
|
-
};
|
|
507
665
|
function HeroAdCampaignExpert({
|
|
508
666
|
sectionId = "hero-ad-campaign-expert",
|
|
509
667
|
heading,
|
|
@@ -582,36 +740,6 @@ function HeroAdCampaignExpert({
|
|
|
582
740
|
descriptionClassName,
|
|
583
741
|
renderActions
|
|
584
742
|
]);
|
|
585
|
-
const hasMedia = mediaItem?.image || mediaItem?.video;
|
|
586
|
-
const renderMedia = useMemo(() => {
|
|
587
|
-
if (!mediaItem) return null;
|
|
588
|
-
const { image, video } = mediaItem;
|
|
589
|
-
if (video) {
|
|
590
|
-
const { src, className: videoClassName, ...videoRest } = video;
|
|
591
|
-
return /* @__PURE__ */ jsx(
|
|
592
|
-
"video",
|
|
593
|
-
{
|
|
594
|
-
src,
|
|
595
|
-
className: cn("size-full object-cover", videoClassName),
|
|
596
|
-
...videoRest
|
|
597
|
-
}
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
if (image) {
|
|
601
|
-
const { src, alt, className: imgClassName, ...imgRest } = image;
|
|
602
|
-
return /* @__PURE__ */ jsx(
|
|
603
|
-
Img,
|
|
604
|
-
{
|
|
605
|
-
src,
|
|
606
|
-
alt,
|
|
607
|
-
className: cn("size-full object-cover", imgClassName),
|
|
608
|
-
optixFlowConfig,
|
|
609
|
-
...imgRest
|
|
610
|
-
}
|
|
611
|
-
);
|
|
612
|
-
}
|
|
613
|
-
return null;
|
|
614
|
-
}, [mediaItem, optixFlowConfig]);
|
|
615
743
|
return /* @__PURE__ */ jsx(
|
|
616
744
|
Section,
|
|
617
745
|
{
|
|
@@ -640,38 +768,18 @@ function HeroAdCampaignExpert({
|
|
|
640
768
|
)
|
|
641
769
|
}
|
|
642
770
|
),
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
/* @__PURE__ */ jsx(
|
|
656
|
-
"div",
|
|
657
|
-
{
|
|
658
|
-
className: "hidden lg:block max-h-[70dvh] w-auto",
|
|
659
|
-
style: {
|
|
660
|
-
aspectRatio: ASPECT_RATIOS[mediaAspectRatios.desktop]
|
|
661
|
-
},
|
|
662
|
-
children: /* @__PURE__ */ jsx(
|
|
663
|
-
"div",
|
|
664
|
-
{
|
|
665
|
-
className: cn(
|
|
666
|
-
"size-full rounded-xl shadow-2xl overflow-hidden",
|
|
667
|
-
mediaItem?.containerClassName
|
|
668
|
-
),
|
|
669
|
-
children: renderMedia
|
|
670
|
-
}
|
|
671
|
-
)
|
|
672
|
-
}
|
|
673
|
-
)
|
|
674
|
-
] })
|
|
771
|
+
/* @__PURE__ */ jsx(
|
|
772
|
+
MediaAspectRatio,
|
|
773
|
+
{
|
|
774
|
+
containerClassName: "relative flex w-full justify-center lg:w-1/2",
|
|
775
|
+
desktopClassName: "max-h-[70dvh] w-auto",
|
|
776
|
+
mobileClassName: "h-auto w-[80%] max-w-[355px]",
|
|
777
|
+
frameClassName: "rounded-xl shadow-2xl",
|
|
778
|
+
mediaItem,
|
|
779
|
+
optixFlowConfig,
|
|
780
|
+
deviceAspectRatios: mediaAspectRatios
|
|
781
|
+
}
|
|
782
|
+
)
|
|
675
783
|
]
|
|
676
784
|
}
|
|
677
785
|
) })
|