@opensite/ui 3.0.6 → 3.0.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.
- package/README.md +1 -1
- 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/components.cjs +171 -0
- package/dist/components.d.cts +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +170 -1
- 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-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/index.cjs +171 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +170 -1
- 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 +244 -108
- package/dist/registry.js +243 -107
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { AnimatePresence, motion } from 'framer-motion';
|
|
|
8
8
|
import { useOnClickOutside } from '@opensite/hooks/useOnClickOutside';
|
|
9
9
|
import { AnimatePresence as AnimatePresence$1, motion as motion$1 } from 'motion/react';
|
|
10
10
|
import { Img } from '@page-speed/img';
|
|
11
|
+
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
|
11
12
|
import { Slot } from '@radix-ui/react-slot';
|
|
12
13
|
import { Pressable, buttonVariants } from '@page-speed/pressable';
|
|
13
14
|
export { Pressable } from '@page-speed/pressable';
|
|
@@ -957,6 +958,174 @@ var ImageSlider = ({
|
|
|
957
958
|
}
|
|
958
959
|
);
|
|
959
960
|
};
|
|
961
|
+
function AspectRatio({
|
|
962
|
+
...props
|
|
963
|
+
}) {
|
|
964
|
+
return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
|
|
965
|
+
}
|
|
966
|
+
var DEFAULT_DEVICE_ASPECT_RATIOS = {
|
|
967
|
+
desktop: "square",
|
|
968
|
+
mobile: "square"
|
|
969
|
+
};
|
|
970
|
+
var DEFAULT_MEDIA_CLASS_NAME = "size-full object-cover";
|
|
971
|
+
var DEFAULT_FRAME_CLASS_NAME = "overflow-hidden";
|
|
972
|
+
var DEFAULT_BREAKPOINT = "lg";
|
|
973
|
+
var BREAKPOINT_VISIBILITY_CLASSES = {
|
|
974
|
+
sm: {
|
|
975
|
+
desktop: "hidden sm:block",
|
|
976
|
+
mobile: "sm:hidden"
|
|
977
|
+
},
|
|
978
|
+
md: {
|
|
979
|
+
desktop: "hidden md:block",
|
|
980
|
+
mobile: "md:hidden"
|
|
981
|
+
},
|
|
982
|
+
lg: {
|
|
983
|
+
desktop: "hidden lg:block",
|
|
984
|
+
mobile: "lg:hidden"
|
|
985
|
+
},
|
|
986
|
+
xl: {
|
|
987
|
+
desktop: "hidden xl:block",
|
|
988
|
+
mobile: "xl:hidden"
|
|
989
|
+
},
|
|
990
|
+
"2xl": {
|
|
991
|
+
desktop: "hidden 2xl:block",
|
|
992
|
+
mobile: "2xl:hidden"
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
var MEDIA_ASPECT_RATIOS = {
|
|
996
|
+
square: 1,
|
|
997
|
+
horizontal: 16 / 9,
|
|
998
|
+
vertical: 355 / 520
|
|
999
|
+
};
|
|
1000
|
+
function resolveAspectRatio(ratio, fallback) {
|
|
1001
|
+
const resolvedRatio = ratio ?? fallback;
|
|
1002
|
+
if (typeof resolvedRatio === "number" && Number.isFinite(resolvedRatio) && resolvedRatio > 0) {
|
|
1003
|
+
return resolvedRatio;
|
|
1004
|
+
}
|
|
1005
|
+
return MEDIA_ASPECT_RATIOS[resolvedRatio];
|
|
1006
|
+
}
|
|
1007
|
+
function hasRenderableMedia(mediaItem) {
|
|
1008
|
+
return Boolean(mediaItem?.image?.src || mediaItem?.video?.src);
|
|
1009
|
+
}
|
|
1010
|
+
function renderMediaElement({
|
|
1011
|
+
mediaItem,
|
|
1012
|
+
optixFlowConfig,
|
|
1013
|
+
mediaClassName,
|
|
1014
|
+
imageClassName,
|
|
1015
|
+
videoClassName
|
|
1016
|
+
}) {
|
|
1017
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
1018
|
+
return null;
|
|
1019
|
+
}
|
|
1020
|
+
if (mediaItem.video?.src) {
|
|
1021
|
+
const { className: inlineVideoClassName, poster, ...videoProps } = mediaItem.video;
|
|
1022
|
+
const posterFallback = poster ?? (typeof mediaItem.image?.src === "string" ? mediaItem.image.src : void 0);
|
|
1023
|
+
return /* @__PURE__ */ jsx(
|
|
1024
|
+
"video",
|
|
1025
|
+
{
|
|
1026
|
+
...videoProps,
|
|
1027
|
+
poster: posterFallback,
|
|
1028
|
+
className: cn(
|
|
1029
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
1030
|
+
mediaClassName,
|
|
1031
|
+
videoClassName,
|
|
1032
|
+
inlineVideoClassName
|
|
1033
|
+
)
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
if (mediaItem.image?.src) {
|
|
1038
|
+
const { className: inlineImageClassName, alt, src, ...imageProps } = mediaItem.image;
|
|
1039
|
+
return /* @__PURE__ */ jsx(
|
|
1040
|
+
Img,
|
|
1041
|
+
{
|
|
1042
|
+
...imageProps,
|
|
1043
|
+
src,
|
|
1044
|
+
alt: alt ?? "",
|
|
1045
|
+
className: cn(
|
|
1046
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
1047
|
+
mediaClassName,
|
|
1048
|
+
imageClassName,
|
|
1049
|
+
inlineImageClassName
|
|
1050
|
+
),
|
|
1051
|
+
optixFlowConfig
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
return null;
|
|
1056
|
+
}
|
|
1057
|
+
function MediaAspectRatio({
|
|
1058
|
+
containerClassName,
|
|
1059
|
+
mobileClassName,
|
|
1060
|
+
desktopClassName,
|
|
1061
|
+
frameClassName,
|
|
1062
|
+
mobileFrameClassName,
|
|
1063
|
+
desktopFrameClassName,
|
|
1064
|
+
mediaClassName,
|
|
1065
|
+
imageClassName,
|
|
1066
|
+
videoClassName,
|
|
1067
|
+
mediaItem,
|
|
1068
|
+
optixFlowConfig,
|
|
1069
|
+
deviceAspectRatios = DEFAULT_DEVICE_ASPECT_RATIOS,
|
|
1070
|
+
breakpoint = DEFAULT_BREAKPOINT
|
|
1071
|
+
}) {
|
|
1072
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
1073
|
+
return null;
|
|
1074
|
+
}
|
|
1075
|
+
const ratios = {
|
|
1076
|
+
desktop: resolveAspectRatio(
|
|
1077
|
+
deviceAspectRatios.desktop,
|
|
1078
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.desktop
|
|
1079
|
+
),
|
|
1080
|
+
mobile: resolveAspectRatio(
|
|
1081
|
+
deviceAspectRatios.mobile,
|
|
1082
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.mobile
|
|
1083
|
+
)
|
|
1084
|
+
};
|
|
1085
|
+
const sharedFrameClassName = cn(
|
|
1086
|
+
DEFAULT_FRAME_CLASS_NAME,
|
|
1087
|
+
frameClassName,
|
|
1088
|
+
mediaItem.containerClassName
|
|
1089
|
+
);
|
|
1090
|
+
const visibilityClasses = BREAKPOINT_VISIBILITY_CLASSES[breakpoint];
|
|
1091
|
+
return /* @__PURE__ */ jsxs("div", { className: containerClassName, "data-slot": "media-aspect-ratio", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx("div", { className: cn("relative", visibilityClasses.mobile, mobileClassName), children: /* @__PURE__ */ jsx(
|
|
1093
|
+
AspectRatio,
|
|
1094
|
+
{
|
|
1095
|
+
ratio: ratios.mobile,
|
|
1096
|
+
className: cn(sharedFrameClassName, mobileFrameClassName),
|
|
1097
|
+
children: renderMediaElement({
|
|
1098
|
+
mediaItem,
|
|
1099
|
+
optixFlowConfig,
|
|
1100
|
+
mediaClassName,
|
|
1101
|
+
imageClassName,
|
|
1102
|
+
videoClassName
|
|
1103
|
+
})
|
|
1104
|
+
}
|
|
1105
|
+
) }),
|
|
1106
|
+
/* @__PURE__ */ jsx(
|
|
1107
|
+
"div",
|
|
1108
|
+
{
|
|
1109
|
+
className: cn(visibilityClasses.desktop, desktopClassName),
|
|
1110
|
+
style: { aspectRatio: String(ratios.desktop) },
|
|
1111
|
+
children: /* @__PURE__ */ jsx(
|
|
1112
|
+
"div",
|
|
1113
|
+
{
|
|
1114
|
+
className: cn("size-full", sharedFrameClassName, desktopFrameClassName),
|
|
1115
|
+
"data-slot": "media-aspect-ratio-frame",
|
|
1116
|
+
children: renderMediaElement({
|
|
1117
|
+
mediaItem,
|
|
1118
|
+
optixFlowConfig,
|
|
1119
|
+
mediaClassName,
|
|
1120
|
+
imageClassName,
|
|
1121
|
+
videoClassName
|
|
1122
|
+
})
|
|
1123
|
+
}
|
|
1124
|
+
)
|
|
1125
|
+
}
|
|
1126
|
+
)
|
|
1127
|
+
] });
|
|
1128
|
+
}
|
|
960
1129
|
function Button({
|
|
961
1130
|
className,
|
|
962
1131
|
variant = "default",
|
|
@@ -6653,4 +6822,4 @@ var useResponsiveLayout = ({
|
|
|
6653
6822
|
return { responsiveClassName };
|
|
6654
6823
|
};
|
|
6655
6824
|
|
|
6656
|
-
export { AboutCultureTabs, AboutExpandableValues, AboutMissionPrinciples, AboutSplitHero, AlternatingBlocks, AnimatedDialog, Badge, BannerAnnouncementDismissible, BannerCountdownSale, BannerDeliveryCountdown, BannerEventPromo, BannerFloatingOffer, BannerGdprRights, BannerPrivacyNotice, BannerPromoCta, BannerSocialFollow, BannerSurveyIncentive, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CarouselPagination, CommunityInitiatives, Container, DynamicIcon, FooterAnimatedSocial, FooterBackgroundCard, FooterBrandDescription, FooterContactCard, FooterCtaBanner, FooterCtaSocial, FooterLinksGrid, FooterNavSocial, FooterNewsletterGrid, FooterNewsletterMinimal, FooterSimpleCentered, FooterSocialApps, FooterSocialNewsletter, ImageSlider, MediaHoverCtas, PageHeroBanner, PaymentPlatformIcon, Popover, PopoverContent, PopoverTrigger, Section, SocialLinkIcon, StarRating, cn, getAccentColor, getBorderColor, getNestedCardBg, getNestedCardTextColor, getTextColor, useResponsiveLayout };
|
|
6825
|
+
export { AboutCultureTabs, AboutExpandableValues, AboutMissionPrinciples, AboutSplitHero, AlternatingBlocks, AnimatedDialog, Badge, BannerAnnouncementDismissible, BannerCountdownSale, BannerDeliveryCountdown, BannerEventPromo, BannerFloatingOffer, BannerGdprRights, BannerPrivacyNotice, BannerPromoCta, BannerSocialFollow, BannerSurveyIncentive, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CarouselPagination, CommunityInitiatives, Container, DynamicIcon, FooterAnimatedSocial, FooterBackgroundCard, FooterBrandDescription, FooterContactCard, FooterCtaBanner, FooterCtaSocial, FooterLinksGrid, FooterNavSocial, FooterNewsletterGrid, FooterNewsletterMinimal, FooterSimpleCentered, FooterSocialApps, FooterSocialNewsletter, ImageSlider, MediaAspectRatio, MediaHoverCtas, PageHeroBanner, PaymentPlatformIcon, Popover, PopoverContent, PopoverTrigger, Section, SocialLinkIcon, StarRating, cn, getAccentColor, getBorderColor, getNestedCardBg, getNestedCardTextColor, getTextColor, useResponsiveLayout };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var img = require('@page-speed/img');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
var AspectRatioPrimitive = require('@radix-ui/react-aspect-ratio');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var AspectRatioPrimitive__namespace = /*#__PURE__*/_interopNamespace(AspectRatioPrimitive);
|
|
28
|
+
|
|
29
|
+
// components/ui/media-aspect-ratio.tsx
|
|
30
|
+
function cn(...inputs) {
|
|
31
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
32
|
+
}
|
|
33
|
+
function AspectRatio({
|
|
34
|
+
...props
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AspectRatioPrimitive__namespace.Root, { "data-slot": "aspect-ratio", ...props });
|
|
37
|
+
}
|
|
38
|
+
var DEFAULT_DEVICE_ASPECT_RATIOS = {
|
|
39
|
+
desktop: "square",
|
|
40
|
+
mobile: "square"
|
|
41
|
+
};
|
|
42
|
+
var DEFAULT_MEDIA_CLASS_NAME = "size-full object-cover";
|
|
43
|
+
var DEFAULT_FRAME_CLASS_NAME = "overflow-hidden";
|
|
44
|
+
var DEFAULT_BREAKPOINT = "lg";
|
|
45
|
+
var BREAKPOINT_VISIBILITY_CLASSES = {
|
|
46
|
+
sm: {
|
|
47
|
+
desktop: "hidden sm:block",
|
|
48
|
+
mobile: "sm:hidden"
|
|
49
|
+
},
|
|
50
|
+
md: {
|
|
51
|
+
desktop: "hidden md:block",
|
|
52
|
+
mobile: "md:hidden"
|
|
53
|
+
},
|
|
54
|
+
lg: {
|
|
55
|
+
desktop: "hidden lg:block",
|
|
56
|
+
mobile: "lg:hidden"
|
|
57
|
+
},
|
|
58
|
+
xl: {
|
|
59
|
+
desktop: "hidden xl:block",
|
|
60
|
+
mobile: "xl:hidden"
|
|
61
|
+
},
|
|
62
|
+
"2xl": {
|
|
63
|
+
desktop: "hidden 2xl:block",
|
|
64
|
+
mobile: "2xl:hidden"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var MEDIA_ASPECT_RATIOS = {
|
|
68
|
+
square: 1,
|
|
69
|
+
horizontal: 16 / 9,
|
|
70
|
+
vertical: 355 / 520
|
|
71
|
+
};
|
|
72
|
+
function resolveAspectRatio(ratio, fallback) {
|
|
73
|
+
const resolvedRatio = ratio ?? fallback;
|
|
74
|
+
if (typeof resolvedRatio === "number" && Number.isFinite(resolvedRatio) && resolvedRatio > 0) {
|
|
75
|
+
return resolvedRatio;
|
|
76
|
+
}
|
|
77
|
+
return MEDIA_ASPECT_RATIOS[resolvedRatio];
|
|
78
|
+
}
|
|
79
|
+
function hasRenderableMedia(mediaItem) {
|
|
80
|
+
return Boolean(mediaItem?.image?.src || mediaItem?.video?.src);
|
|
81
|
+
}
|
|
82
|
+
function renderMediaElement({
|
|
83
|
+
mediaItem,
|
|
84
|
+
optixFlowConfig,
|
|
85
|
+
mediaClassName,
|
|
86
|
+
imageClassName,
|
|
87
|
+
videoClassName
|
|
88
|
+
}) {
|
|
89
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (mediaItem.video?.src) {
|
|
93
|
+
const { className: inlineVideoClassName, poster, ...videoProps } = mediaItem.video;
|
|
94
|
+
const posterFallback = poster ?? (typeof mediaItem.image?.src === "string" ? mediaItem.image.src : void 0);
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
"video",
|
|
97
|
+
{
|
|
98
|
+
...videoProps,
|
|
99
|
+
poster: posterFallback,
|
|
100
|
+
className: cn(
|
|
101
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
102
|
+
mediaClassName,
|
|
103
|
+
videoClassName,
|
|
104
|
+
inlineVideoClassName
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
if (mediaItem.image?.src) {
|
|
110
|
+
const { className: inlineImageClassName, alt, src, ...imageProps } = mediaItem.image;
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
112
|
+
img.Img,
|
|
113
|
+
{
|
|
114
|
+
...imageProps,
|
|
115
|
+
src,
|
|
116
|
+
alt: alt ?? "",
|
|
117
|
+
className: cn(
|
|
118
|
+
DEFAULT_MEDIA_CLASS_NAME,
|
|
119
|
+
mediaClassName,
|
|
120
|
+
imageClassName,
|
|
121
|
+
inlineImageClassName
|
|
122
|
+
),
|
|
123
|
+
optixFlowConfig
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
function MediaAspectRatio({
|
|
130
|
+
containerClassName,
|
|
131
|
+
mobileClassName,
|
|
132
|
+
desktopClassName,
|
|
133
|
+
frameClassName,
|
|
134
|
+
mobileFrameClassName,
|
|
135
|
+
desktopFrameClassName,
|
|
136
|
+
mediaClassName,
|
|
137
|
+
imageClassName,
|
|
138
|
+
videoClassName,
|
|
139
|
+
mediaItem,
|
|
140
|
+
optixFlowConfig,
|
|
141
|
+
deviceAspectRatios = DEFAULT_DEVICE_ASPECT_RATIOS,
|
|
142
|
+
breakpoint = DEFAULT_BREAKPOINT
|
|
143
|
+
}) {
|
|
144
|
+
if (!hasRenderableMedia(mediaItem)) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
const ratios = {
|
|
148
|
+
desktop: resolveAspectRatio(
|
|
149
|
+
deviceAspectRatios.desktop,
|
|
150
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.desktop
|
|
151
|
+
),
|
|
152
|
+
mobile: resolveAspectRatio(
|
|
153
|
+
deviceAspectRatios.mobile,
|
|
154
|
+
DEFAULT_DEVICE_ASPECT_RATIOS.mobile
|
|
155
|
+
)
|
|
156
|
+
};
|
|
157
|
+
const sharedFrameClassName = cn(
|
|
158
|
+
DEFAULT_FRAME_CLASS_NAME,
|
|
159
|
+
frameClassName,
|
|
160
|
+
mediaItem.containerClassName
|
|
161
|
+
);
|
|
162
|
+
const visibilityClasses = BREAKPOINT_VISIBILITY_CLASSES[breakpoint];
|
|
163
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerClassName, "data-slot": "media-aspect-ratio", children: [
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative", visibilityClasses.mobile, mobileClassName), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
165
|
+
AspectRatio,
|
|
166
|
+
{
|
|
167
|
+
ratio: ratios.mobile,
|
|
168
|
+
className: cn(sharedFrameClassName, mobileFrameClassName),
|
|
169
|
+
children: renderMediaElement({
|
|
170
|
+
mediaItem,
|
|
171
|
+
optixFlowConfig,
|
|
172
|
+
mediaClassName,
|
|
173
|
+
imageClassName,
|
|
174
|
+
videoClassName
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
) }),
|
|
178
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
className: cn(visibilityClasses.desktop, desktopClassName),
|
|
182
|
+
style: { aspectRatio: String(ratios.desktop) },
|
|
183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: cn("size-full", sharedFrameClassName, desktopFrameClassName),
|
|
187
|
+
"data-slot": "media-aspect-ratio-frame",
|
|
188
|
+
children: renderMediaElement({
|
|
189
|
+
mediaItem,
|
|
190
|
+
optixFlowConfig,
|
|
191
|
+
mediaClassName,
|
|
192
|
+
imageClassName,
|
|
193
|
+
videoClassName
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
exports.MEDIA_ASPECT_RATIOS = MEDIA_ASPECT_RATIOS;
|
|
203
|
+
exports.MediaAspectRatio = MediaAspectRatio;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { M as MediaItem, O as OptixFlowConfig } from './blocks-DL92rOxr.cjs';
|
|
3
|
+
import 'class-variance-authority';
|
|
4
|
+
import '@page-speed/pressable';
|
|
5
|
+
import '@opensite/hooks/usePlatformFromUrl';
|
|
6
|
+
|
|
7
|
+
type MediaAspectRatioVariant = "square" | "horizontal" | "vertical" | number;
|
|
8
|
+
type MediaAspectRatioBreakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
9
|
+
interface ResponsiveMediaAspectRatioProps {
|
|
10
|
+
desktop?: MediaAspectRatioVariant;
|
|
11
|
+
mobile?: MediaAspectRatioVariant;
|
|
12
|
+
}
|
|
13
|
+
interface MediaAspectRatioProps {
|
|
14
|
+
/**
|
|
15
|
+
* Shared wrapper for the mobile + desktop viewport containers.
|
|
16
|
+
*/
|
|
17
|
+
containerClassName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Mobile-only viewport wrapper classes.
|
|
20
|
+
*/
|
|
21
|
+
mobileClassName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Desktop-only viewport wrapper classes.
|
|
24
|
+
*/
|
|
25
|
+
desktopClassName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Shared frame classes applied to the aspect-ratio container for both viewports.
|
|
28
|
+
* Useful for radius, shadow, borders, and overflow behavior.
|
|
29
|
+
*/
|
|
30
|
+
frameClassName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Mobile-only frame classes.
|
|
33
|
+
*/
|
|
34
|
+
mobileFrameClassName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Desktop-only frame classes.
|
|
37
|
+
*/
|
|
38
|
+
desktopFrameClassName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Shared image/video element classes.
|
|
41
|
+
* Defaults are applied first so overrides can be passed here or through `mediaItem`.
|
|
42
|
+
*/
|
|
43
|
+
mediaClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional image-only classes.
|
|
46
|
+
*/
|
|
47
|
+
imageClassName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Additional video-only classes.
|
|
50
|
+
*/
|
|
51
|
+
videoClassName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Standardized media payload used across blocks.
|
|
54
|
+
*/
|
|
55
|
+
mediaItem?: MediaItem;
|
|
56
|
+
/**
|
|
57
|
+
* Optional OptixFlow image optimization config.
|
|
58
|
+
*/
|
|
59
|
+
optixFlowConfig?: OptixFlowConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Responsive aspect-ratio values.
|
|
62
|
+
* @default { desktop: "square", mobile: "square" }
|
|
63
|
+
*/
|
|
64
|
+
deviceAspectRatios?: ResponsiveMediaAspectRatioProps;
|
|
65
|
+
/**
|
|
66
|
+
* Breakpoint where the component switches from the mobile viewport wrapper
|
|
67
|
+
* to the desktop viewport wrapper.
|
|
68
|
+
* @default "lg"
|
|
69
|
+
*/
|
|
70
|
+
breakpoint?: MediaAspectRatioBreakpoint;
|
|
71
|
+
}
|
|
72
|
+
declare const MEDIA_ASPECT_RATIOS: Record<Exclude<MediaAspectRatioVariant, number>, number>;
|
|
73
|
+
declare function MediaAspectRatio({ containerClassName, mobileClassName, desktopClassName, frameClassName, mobileFrameClassName, desktopFrameClassName, mediaClassName, imageClassName, videoClassName, mediaItem, optixFlowConfig, deviceAspectRatios, breakpoint, }: MediaAspectRatioProps): React.JSX.Element | null;
|
|
74
|
+
|
|
75
|
+
export { MEDIA_ASPECT_RATIOS, MediaAspectRatio, type MediaAspectRatioBreakpoint, type MediaAspectRatioProps, type MediaAspectRatioVariant, type ResponsiveMediaAspectRatioProps };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { M as MediaItem, O as OptixFlowConfig } from './blocks-DL92rOxr.js';
|
|
3
|
+
import 'class-variance-authority';
|
|
4
|
+
import '@page-speed/pressable';
|
|
5
|
+
import '@opensite/hooks/usePlatformFromUrl';
|
|
6
|
+
|
|
7
|
+
type MediaAspectRatioVariant = "square" | "horizontal" | "vertical" | number;
|
|
8
|
+
type MediaAspectRatioBreakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
9
|
+
interface ResponsiveMediaAspectRatioProps {
|
|
10
|
+
desktop?: MediaAspectRatioVariant;
|
|
11
|
+
mobile?: MediaAspectRatioVariant;
|
|
12
|
+
}
|
|
13
|
+
interface MediaAspectRatioProps {
|
|
14
|
+
/**
|
|
15
|
+
* Shared wrapper for the mobile + desktop viewport containers.
|
|
16
|
+
*/
|
|
17
|
+
containerClassName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Mobile-only viewport wrapper classes.
|
|
20
|
+
*/
|
|
21
|
+
mobileClassName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Desktop-only viewport wrapper classes.
|
|
24
|
+
*/
|
|
25
|
+
desktopClassName?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Shared frame classes applied to the aspect-ratio container for both viewports.
|
|
28
|
+
* Useful for radius, shadow, borders, and overflow behavior.
|
|
29
|
+
*/
|
|
30
|
+
frameClassName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Mobile-only frame classes.
|
|
33
|
+
*/
|
|
34
|
+
mobileFrameClassName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Desktop-only frame classes.
|
|
37
|
+
*/
|
|
38
|
+
desktopFrameClassName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Shared image/video element classes.
|
|
41
|
+
* Defaults are applied first so overrides can be passed here or through `mediaItem`.
|
|
42
|
+
*/
|
|
43
|
+
mediaClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Additional image-only classes.
|
|
46
|
+
*/
|
|
47
|
+
imageClassName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Additional video-only classes.
|
|
50
|
+
*/
|
|
51
|
+
videoClassName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Standardized media payload used across blocks.
|
|
54
|
+
*/
|
|
55
|
+
mediaItem?: MediaItem;
|
|
56
|
+
/**
|
|
57
|
+
* Optional OptixFlow image optimization config.
|
|
58
|
+
*/
|
|
59
|
+
optixFlowConfig?: OptixFlowConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Responsive aspect-ratio values.
|
|
62
|
+
* @default { desktop: "square", mobile: "square" }
|
|
63
|
+
*/
|
|
64
|
+
deviceAspectRatios?: ResponsiveMediaAspectRatioProps;
|
|
65
|
+
/**
|
|
66
|
+
* Breakpoint where the component switches from the mobile viewport wrapper
|
|
67
|
+
* to the desktop viewport wrapper.
|
|
68
|
+
* @default "lg"
|
|
69
|
+
*/
|
|
70
|
+
breakpoint?: MediaAspectRatioBreakpoint;
|
|
71
|
+
}
|
|
72
|
+
declare const MEDIA_ASPECT_RATIOS: Record<Exclude<MediaAspectRatioVariant, number>, number>;
|
|
73
|
+
declare function MediaAspectRatio({ containerClassName, mobileClassName, desktopClassName, frameClassName, mobileFrameClassName, desktopFrameClassName, mediaClassName, imageClassName, videoClassName, mediaItem, optixFlowConfig, deviceAspectRatios, breakpoint, }: MediaAspectRatioProps): React.JSX.Element | null;
|
|
74
|
+
|
|
75
|
+
export { MEDIA_ASPECT_RATIOS, MediaAspectRatio, type MediaAspectRatioBreakpoint, type MediaAspectRatioProps, type MediaAspectRatioVariant, type ResponsiveMediaAspectRatioProps };
|