@enadhq/enad-react-sdk 1.2.0 → 1.3.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.
- package/dist/client/storefront/blocks/card-video.mjs +1 -1
- package/dist/client/storefront/blocks/card-video.mjs.map +1 -1
- package/dist/client/storefront/blocks/gallery-with-link-blocks.d.ts.map +1 -1
- package/dist/client/storefront/blocks/gallery-with-link-blocks.mjs +13 -5
- package/dist/client/storefront/blocks/gallery-with-link-blocks.mjs.map +1 -1
- package/dist/client/storefront/blocks/gallery.d.ts +10 -1
- package/dist/client/storefront/blocks/gallery.d.ts.map +1 -1
- package/dist/client/storefront/blocks/gallery.mjs +51 -27
- package/dist/client/storefront/blocks/gallery.mjs.map +1 -1
- package/dist/client/storefront/blocks/hero.d.ts +12 -1
- package/dist/client/storefront/blocks/hero.d.ts.map +1 -1
- package/dist/client/storefront/blocks/hero.mjs +143 -145
- package/dist/client/storefront/blocks/hero.mjs.map +1 -1
- package/dist/client/storefront/blocks/link-block-small.d.ts.map +1 -1
- package/dist/client/storefront/blocks/link-block-small.mjs +1 -1
- package/dist/client/storefront/blocks/link-block-small.mjs.map +1 -1
- package/dist/client/storefront/blocks/link-block.d.ts.map +1 -1
- package/dist/client/storefront/blocks/link-block.mjs +4 -4
- package/dist/client/storefront/blocks/link-block.mjs.map +1 -1
- package/dist/client/storefront/blocks/product-card-parts.d.ts +1 -1
- package/dist/client/storefront/blocks/product-card-parts.d.ts.map +1 -1
- package/dist/client/storefront/blocks/product-card-parts.mjs +2 -2
- package/dist/client/storefront/blocks/product-card-parts.mjs.map +1 -1
- package/dist/client/storefront/blocks/product-card.d.ts +10 -1
- package/dist/client/storefront/blocks/product-card.d.ts.map +1 -1
- package/dist/client/storefront/blocks/product-card.mjs +122 -116
- package/dist/client/storefront/blocks/product-card.mjs.map +1 -1
- package/dist/client/storefront/blocks/product-image.mjs +2 -2
- package/dist/client/storefront/blocks/product-image.mjs.map +1 -1
- package/dist/client/storefront/blocks/text-content-with-image.d.ts +14 -1
- package/dist/client/storefront/blocks/text-content-with-image.d.ts.map +1 -1
- package/dist/client/storefront/blocks/text-content-with-image.mjs +141 -164
- package/dist/client/storefront/blocks/text-content-with-image.mjs.map +1 -1
- package/dist/client/storefront/carousel/swipeable-carousel.d.ts +5 -1
- package/dist/client/storefront/carousel/swipeable-carousel.d.ts.map +1 -1
- package/dist/client/storefront/carousel/swipeable-carousel.mjs +2 -1
- package/dist/client/storefront/carousel/swipeable-carousel.mjs.map +1 -1
- package/dist/client/storefront/components/product-recommendations.d.ts.map +1 -1
- package/dist/client/storefront/components/product-recommendations.mjs +29 -37
- package/dist/client/storefront/components/product-recommendations.mjs.map +1 -1
- package/dist/client/storefront/filters/filter-chip.d.ts +5 -2
- package/dist/client/storefront/filters/filter-chip.d.ts.map +1 -1
- package/dist/client/storefront/filters/filter-chip.mjs +5 -3
- package/dist/client/storefront/filters/filter-chip.mjs.map +1 -1
- package/dist/client/storefront/filters/filter-panel.mjs +1 -1
- package/dist/client/storefront/index.d.ts +12 -1
- package/dist/client/storefront/index.mjs +12 -1
- package/dist/client/storefront/layout/header.d.ts.map +1 -1
- package/dist/client/storefront/layout/header.mjs +1 -1
- package/dist/client/storefront/layout/header.mjs.map +1 -1
- package/dist/client/storefront/layout/mobile-menu-drawer.mjs +1 -1
- package/dist/client/storefront/primitives/block-heading.d.ts +40 -0
- package/dist/client/storefront/primitives/block-heading.d.ts.map +1 -0
- package/dist/client/storefront/primitives/block-heading.mjs +43 -0
- package/dist/client/storefront/primitives/block-heading.mjs.map +1 -0
- package/dist/client/storefront/primitives/cta-group.d.ts +25 -0
- package/dist/client/storefront/primitives/cta-group.d.ts.map +1 -0
- package/dist/client/storefront/primitives/cta-group.mjs +27 -0
- package/dist/client/storefront/primitives/cta-group.mjs.map +1 -0
- package/dist/client/storefront/primitives/image-with-hover.d.ts +18 -0
- package/dist/client/storefront/primitives/image-with-hover.d.ts.map +1 -0
- package/dist/client/storefront/primitives/image-with-hover.mjs +16 -0
- package/dist/client/storefront/primitives/image-with-hover.mjs.map +1 -0
- package/dist/client/storefront/primitives/index.d.ts +4 -1
- package/dist/client/storefront/primitives/index.mjs +4 -1
- package/dist/client/theme/apply.d.ts +1 -1
- package/dist/client/theme/apply.d.ts.map +1 -1
- package/dist/client/theme/apply.mjs +0 -12
- package/dist/client/theme/apply.mjs.map +1 -1
- package/dist/client/theme/cli.mjs +0 -16
- package/dist/client/theme/cli.mjs.map +1 -1
- package/dist/client/theme/codec.d.ts.map +1 -1
- package/dist/client/theme/codec.mjs +0 -2
- package/dist/client/theme/codec.mjs.map +1 -1
- package/dist/client/theme/defaults.d.ts +0 -2
- package/dist/client/theme/defaults.mjs +0 -2
- package/dist/client/theme/defaults.mjs.map +1 -1
- package/dist/client/ui/carousel.d.ts +9 -1
- package/dist/client/ui/carousel.d.ts.map +1 -1
- package/dist/client/ui/carousel.mjs +18 -2
- package/dist/client/ui/carousel.mjs.map +1 -1
- package/dist/client/ui-resolver/index.d.ts +2 -2
- package/dist/client/ui-resolver/index.mjs +2 -2
- package/dist/styles.css +1 -1
- package/package.json +3 -2
|
@@ -1,23 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../ui/utils.mjs";
|
|
3
|
+
import { defineSlotRecipe } from "../../ui-resolver/recipe.mjs";
|
|
3
4
|
import { useVariantDefault } from "../../ui-resolver/context.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHeading } from "../primitives/block-heading.mjs";
|
|
6
|
+
import { CTAGroup } from "../primitives/cta-group.mjs";
|
|
6
7
|
import { colorThemeClasses, isThemeDark } from "../types.mjs";
|
|
7
8
|
import "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
//#region src/client/storefront/blocks/hero.tsx
|
|
11
|
+
const heroRecipe = defineSlotRecipe({
|
|
12
|
+
slots: [
|
|
13
|
+
"root",
|
|
14
|
+
"background",
|
|
15
|
+
"overlay",
|
|
16
|
+
"content"
|
|
17
|
+
],
|
|
18
|
+
base: {
|
|
19
|
+
root: "",
|
|
20
|
+
background: "size-full object-cover",
|
|
21
|
+
overlay: "absolute inset-0",
|
|
22
|
+
content: ""
|
|
23
|
+
},
|
|
24
|
+
variants: {
|
|
25
|
+
layout: {
|
|
26
|
+
overlay: { root: "relative overflow-hidden" },
|
|
27
|
+
split: { root: "grid" },
|
|
28
|
+
minimal: { root: "px-[var(--enad-hero-px,2rem)] py-[var(--enad-hero-py,4rem)] md:py-[calc(var(--enad-hero-py,4rem)*1.5)] lg:py-[calc(var(--enad-hero-py,4rem)*2)]" },
|
|
29
|
+
banner: { root: "relative max-h-64 overflow-hidden" },
|
|
30
|
+
"image-only": { root: "relative overflow-hidden bg-muted" }
|
|
31
|
+
},
|
|
32
|
+
contentWidth: {
|
|
33
|
+
sm: { content: "max-w-sm" },
|
|
34
|
+
md: { content: "max-w-xl" },
|
|
35
|
+
lg: { content: "max-w-3xl" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
layout: "overlay",
|
|
40
|
+
contentWidth: "md"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
10
43
|
const aspectClasses = {
|
|
11
44
|
"9:16": "aspect-[9/16]",
|
|
12
45
|
"4:5": "aspect-[4/5]",
|
|
13
46
|
"1:1": "aspect-square",
|
|
14
47
|
"16:9": "aspect-video"
|
|
15
48
|
};
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
md: "max-w-xl",
|
|
19
|
-
lg: "max-w-3xl"
|
|
20
|
-
};
|
|
49
|
+
const overlayGradientStyle = (direction) => ({ background: `linear-gradient(${direction}, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))` });
|
|
50
|
+
const centerOverlayStyle = { background: "color-mix(in oklch, var(--enad-overlay-color) 30%, transparent)" };
|
|
21
51
|
const alignItemsMap = {
|
|
22
52
|
top: "items-start",
|
|
23
53
|
center: "items-center",
|
|
@@ -38,7 +68,6 @@ function getTextAlign(position) {
|
|
|
38
68
|
if (horizontal === "right") return "right";
|
|
39
69
|
return "left";
|
|
40
70
|
}
|
|
41
|
-
const overlayGradientStyle = (direction) => ({ background: `linear-gradient(${direction}, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))` });
|
|
42
71
|
function getGradientDirection(position) {
|
|
43
72
|
const [vertical, horizontal] = position.split("-");
|
|
44
73
|
if (vertical === "bottom") return "to top";
|
|
@@ -47,88 +76,120 @@ function getGradientDirection(position) {
|
|
|
47
76
|
if (horizontal === "right") return "to left";
|
|
48
77
|
return null;
|
|
49
78
|
}
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
textTransform: "var(--enad-heading-transform)"
|
|
55
|
-
};
|
|
56
|
-
function HeroCTA({ buttonLabel, buttonHref, textLinkLabel, textLinkHref, dark }) {
|
|
57
|
-
if (!buttonLabel && !textLinkLabel) return null;
|
|
58
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className: "mt-6 flex flex-wrap items-center gap-4",
|
|
60
|
-
children: [buttonLabel && buttonHref && /* @__PURE__ */ jsx(StorefrontButton, {
|
|
61
|
-
href: buttonHref,
|
|
62
|
-
variant: dark ? "outline" : "primary",
|
|
63
|
-
children: buttonLabel
|
|
64
|
-
}), textLinkLabel && textLinkHref && /* @__PURE__ */ jsx(StorefrontTextLink, {
|
|
65
|
-
href: textLinkHref,
|
|
66
|
-
className: dark ? "text-white" : void 0,
|
|
67
|
-
children: textLinkLabel
|
|
68
|
-
})]
|
|
79
|
+
function HeroWithImage({ layout, image, aspectRatio = "16:9", contentPosition = "bottom-center", contentWidth = "md", preheader, heading, buttonLabel, buttonHref, textLinkLabel, textLinkHref, dark, themeClasses, align, className }) {
|
|
80
|
+
const classes = heroRecipe({
|
|
81
|
+
layout,
|
|
82
|
+
contentWidth
|
|
69
83
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const hasImage = Boolean(image?.src);
|
|
85
|
+
const hasContent = preheader || heading || buttonLabel || textLinkLabel;
|
|
86
|
+
const position = contentPosition ?? "bottom-center";
|
|
87
|
+
if (layout === "split") return /* @__PURE__ */ jsxs("section", {
|
|
88
|
+
className: cn(classes.root, hasImage && "lg:grid-cols-2", themeClasses, className),
|
|
89
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
90
|
+
className: "flex min-w-0 flex-col justify-center px-8 py-12 lg:px-16 lg:py-20",
|
|
91
|
+
children: [/* @__PURE__ */ jsx(BlockHeading, {
|
|
92
|
+
preheader,
|
|
93
|
+
heading,
|
|
94
|
+
dark,
|
|
95
|
+
align,
|
|
96
|
+
headingTag: "h1",
|
|
97
|
+
headingSize: "lg",
|
|
98
|
+
headingClamp: "line-clamp-4",
|
|
99
|
+
className: classes.content
|
|
100
|
+
}), /* @__PURE__ */ jsx(CTAGroup, {
|
|
85
101
|
buttonLabel,
|
|
86
102
|
buttonHref,
|
|
87
103
|
textLinkLabel,
|
|
88
104
|
textLinkHref,
|
|
89
105
|
dark
|
|
106
|
+
})]
|
|
107
|
+
}), hasImage && /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: cn("relative overflow-hidden bg-muted", aspectClasses[aspectRatio]),
|
|
109
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
110
|
+
src: image?.src,
|
|
111
|
+
alt: image?.alt ?? "",
|
|
112
|
+
className: classes.background,
|
|
113
|
+
loading: "lazy"
|
|
114
|
+
})
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
const gradientDirection = getGradientDirection(position);
|
|
118
|
+
const overlayStyle = gradientDirection ? overlayGradientStyle(gradientDirection) : centerOverlayStyle;
|
|
119
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
120
|
+
className: cn(classes.root, hasImage ? "bg-muted" : "bg-primary", aspectClasses[aspectRatio], themeClasses, className),
|
|
121
|
+
children: [
|
|
122
|
+
hasImage && /* @__PURE__ */ jsx("img", {
|
|
123
|
+
src: image?.src,
|
|
124
|
+
alt: image?.alt ?? "",
|
|
125
|
+
className: classes.background,
|
|
126
|
+
loading: "lazy"
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ jsx("div", {
|
|
129
|
+
className: classes.overlay,
|
|
130
|
+
style: overlayStyle
|
|
131
|
+
}),
|
|
132
|
+
hasContent && /* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: getPositionClasses(position),
|
|
134
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: cn("flex min-w-0 flex-col", classes.content),
|
|
136
|
+
children: [/* @__PURE__ */ jsx(BlockHeading, {
|
|
137
|
+
preheader,
|
|
138
|
+
heading,
|
|
139
|
+
dark,
|
|
140
|
+
align,
|
|
141
|
+
headingTag: "h1",
|
|
142
|
+
headingSize: "lg",
|
|
143
|
+
headingClamp: "line-clamp-3"
|
|
144
|
+
}), /* @__PURE__ */ jsx(CTAGroup, {
|
|
145
|
+
buttonLabel,
|
|
146
|
+
buttonHref,
|
|
147
|
+
textLinkLabel,
|
|
148
|
+
textLinkHref,
|
|
149
|
+
dark
|
|
150
|
+
})]
|
|
151
|
+
})
|
|
90
152
|
})
|
|
91
153
|
]
|
|
92
154
|
});
|
|
93
155
|
}
|
|
94
|
-
function
|
|
156
|
+
function HeroTextOnly({ preheader, heading, buttonLabel, buttonHref, textLinkLabel, textLinkHref, dark, themeClasses, className }) {
|
|
95
157
|
return /* @__PURE__ */ jsx("section", {
|
|
96
|
-
className: cn(
|
|
158
|
+
className: cn(heroRecipe({ layout: "minimal" }).root, themeClasses || "bg-background", className),
|
|
97
159
|
children: /* @__PURE__ */ jsxs("div", {
|
|
98
160
|
className: "mx-auto flex max-w-4xl flex-col items-center text-center",
|
|
99
|
-
children: [
|
|
100
|
-
preheader
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
})
|
|
116
|
-
]
|
|
161
|
+
children: [/* @__PURE__ */ jsx(BlockHeading, {
|
|
162
|
+
preheader,
|
|
163
|
+
heading,
|
|
164
|
+
dark,
|
|
165
|
+
align: "center",
|
|
166
|
+
headingTag: "h1",
|
|
167
|
+
headingSize: "xl",
|
|
168
|
+
headingClamp: "line-clamp-3",
|
|
169
|
+
className: "max-w-prose"
|
|
170
|
+
}), /* @__PURE__ */ jsx(CTAGroup, {
|
|
171
|
+
buttonLabel,
|
|
172
|
+
buttonHref,
|
|
173
|
+
textLinkLabel,
|
|
174
|
+
textLinkHref,
|
|
175
|
+
dark
|
|
176
|
+
})]
|
|
117
177
|
})
|
|
118
178
|
});
|
|
119
179
|
}
|
|
120
|
-
function
|
|
180
|
+
function HeroCompact({ image, preheader, heading, buttonLabel, buttonHref, textLinkLabel, textLinkHref, themeClasses, className }) {
|
|
181
|
+
const classes = heroRecipe({ layout: "banner" });
|
|
121
182
|
return /* @__PURE__ */ jsxs("section", {
|
|
122
|
-
className: cn(
|
|
183
|
+
className: cn(classes.root, image?.src ? "bg-muted" : "bg-primary", themeClasses, className),
|
|
123
184
|
children: [
|
|
124
185
|
image?.src && /* @__PURE__ */ jsx("img", {
|
|
125
186
|
src: image?.src,
|
|
126
187
|
alt: image?.alt ?? "",
|
|
127
|
-
className:
|
|
188
|
+
className: classes.background,
|
|
128
189
|
loading: "lazy"
|
|
129
190
|
}),
|
|
130
191
|
/* @__PURE__ */ jsx("div", {
|
|
131
|
-
className:
|
|
192
|
+
className: classes.overlay,
|
|
132
193
|
style: overlayGradientStyle("to right")
|
|
133
194
|
}),
|
|
134
195
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -142,10 +203,14 @@ function HeroBanner({ image, preheader, heading, buttonLabel, buttonHref, textLi
|
|
|
142
203
|
children: preheader
|
|
143
204
|
}), heading && /* @__PURE__ */ jsx("h2", {
|
|
144
205
|
className: "min-w-0 truncate text-xl font-heading text-white md:text-2xl lg:text-3xl",
|
|
145
|
-
style:
|
|
206
|
+
style: {
|
|
207
|
+
fontWeight: "var(--enad-heading-weight)",
|
|
208
|
+
letterSpacing: "var(--enad-heading-tracking)",
|
|
209
|
+
textTransform: "var(--enad-heading-transform)"
|
|
210
|
+
},
|
|
146
211
|
children: heading
|
|
147
212
|
})]
|
|
148
|
-
}), /* @__PURE__ */ jsx(
|
|
213
|
+
}), /* @__PURE__ */ jsx(CTAGroup, {
|
|
149
214
|
buttonLabel,
|
|
150
215
|
buttonHref,
|
|
151
216
|
textLinkLabel,
|
|
@@ -157,87 +222,18 @@ function HeroBanner({ image, preheader, heading, buttonLabel, buttonHref, textLi
|
|
|
157
222
|
]
|
|
158
223
|
});
|
|
159
224
|
}
|
|
160
|
-
function HeroSplit({ image, aspectRatio = "16:9", preheader, heading, buttonLabel, buttonHref, textLinkLabel, textLinkHref, contentWidth = "md", dark, themeClasses, align, className }) {
|
|
161
|
-
const hasImage = Boolean(image?.src);
|
|
162
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
163
|
-
className: cn("grid", hasImage && "lg:grid-cols-2", themeClasses, className),
|
|
164
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
165
|
-
className: "flex min-w-0 items-center px-8 py-12 lg:px-16 lg:py-20",
|
|
166
|
-
children: /* @__PURE__ */ jsx(HeroTextBlock, {
|
|
167
|
-
preheader,
|
|
168
|
-
heading,
|
|
169
|
-
buttonLabel,
|
|
170
|
-
buttonHref,
|
|
171
|
-
textLinkLabel,
|
|
172
|
-
textLinkHref,
|
|
173
|
-
contentWidth,
|
|
174
|
-
dark,
|
|
175
|
-
align,
|
|
176
|
-
headingClamp: "line-clamp-4"
|
|
177
|
-
})
|
|
178
|
-
}), hasImage && /* @__PURE__ */ jsx("div", {
|
|
179
|
-
className: cn("relative overflow-hidden bg-muted", aspectClasses[aspectRatio]),
|
|
180
|
-
children: /* @__PURE__ */ jsx("img", {
|
|
181
|
-
src: image?.src,
|
|
182
|
-
alt: image?.alt ?? "",
|
|
183
|
-
className: "size-full object-cover",
|
|
184
|
-
loading: "lazy"
|
|
185
|
-
})
|
|
186
|
-
})]
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
225
|
function HeroImageOnly({ image, aspectRatio = "16:9", className }) {
|
|
226
|
+
const classes = heroRecipe({ layout: "image-only" });
|
|
190
227
|
return /* @__PURE__ */ jsx("section", {
|
|
191
|
-
className: cn(
|
|
228
|
+
className: cn(classes.root, aspectClasses[aspectRatio], className),
|
|
192
229
|
children: image?.src && /* @__PURE__ */ jsx("img", {
|
|
193
230
|
src: image?.src,
|
|
194
231
|
alt: image?.alt ?? "",
|
|
195
|
-
className:
|
|
232
|
+
className: classes.background,
|
|
196
233
|
loading: "lazy"
|
|
197
234
|
})
|
|
198
235
|
});
|
|
199
236
|
}
|
|
200
|
-
function resolveOverlayGradient(position) {
|
|
201
|
-
const direction = getGradientDirection(position);
|
|
202
|
-
return direction ? overlayGradientStyle(direction) : centerOverlayStyle;
|
|
203
|
-
}
|
|
204
|
-
function resolveOverlayBg(imageSrc) {
|
|
205
|
-
return imageSrc ? "bg-muted" : "bg-primary";
|
|
206
|
-
}
|
|
207
|
-
function HeroOverlay({ image, aspectRatio = "16:9", contentPosition = "bottom-center", contentWidth = "md", preheader, heading, buttonLabel, buttonHref, textLinkLabel, textLinkHref, dark, themeClasses, align, className }) {
|
|
208
|
-
const hasContent = preheader || heading || buttonLabel || textLinkLabel;
|
|
209
|
-
const position = contentPosition ?? "bottom-center";
|
|
210
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
211
|
-
className: cn("relative overflow-hidden", resolveOverlayBg(image?.src), aspectClasses[aspectRatio], themeClasses, className),
|
|
212
|
-
children: [
|
|
213
|
-
image?.src && /* @__PURE__ */ jsx("img", {
|
|
214
|
-
src: image?.src,
|
|
215
|
-
alt: image?.alt ?? "",
|
|
216
|
-
className: "size-full object-cover",
|
|
217
|
-
loading: "lazy"
|
|
218
|
-
}),
|
|
219
|
-
/* @__PURE__ */ jsx("div", {
|
|
220
|
-
className: "absolute inset-0",
|
|
221
|
-
style: resolveOverlayGradient(position)
|
|
222
|
-
}),
|
|
223
|
-
hasContent && /* @__PURE__ */ jsx("div", {
|
|
224
|
-
className: getPositionClasses(position),
|
|
225
|
-
children: /* @__PURE__ */ jsx(HeroTextBlock, {
|
|
226
|
-
preheader,
|
|
227
|
-
heading,
|
|
228
|
-
buttonLabel,
|
|
229
|
-
buttonHref,
|
|
230
|
-
textLinkLabel,
|
|
231
|
-
textLinkHref,
|
|
232
|
-
contentWidth,
|
|
233
|
-
dark,
|
|
234
|
-
align,
|
|
235
|
-
headingClamp: "line-clamp-3"
|
|
236
|
-
})
|
|
237
|
-
})
|
|
238
|
-
]
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
237
|
function Hero(props) {
|
|
242
238
|
const heroDefault = useVariantDefault("hero");
|
|
243
239
|
const { layout = heroDefault ?? "overlay", contentPosition = "bottom-center", textAlign, colorTheme } = props;
|
|
@@ -252,14 +248,16 @@ function Hero(props) {
|
|
|
252
248
|
align
|
|
253
249
|
};
|
|
254
250
|
switch (layout) {
|
|
255
|
-
case "minimal": return /* @__PURE__ */ jsx(
|
|
256
|
-
case "banner": return /* @__PURE__ */ jsx(
|
|
257
|
-
case "split": return /* @__PURE__ */ jsx(HeroSplit, { ...layoutProps });
|
|
251
|
+
case "minimal": return /* @__PURE__ */ jsx(HeroTextOnly, { ...layoutProps });
|
|
252
|
+
case "banner": return /* @__PURE__ */ jsx(HeroCompact, { ...layoutProps });
|
|
258
253
|
case "image-only": return /* @__PURE__ */ jsx(HeroImageOnly, { ...layoutProps });
|
|
259
|
-
default: return /* @__PURE__ */ jsx(
|
|
254
|
+
default: return /* @__PURE__ */ jsx(HeroWithImage, {
|
|
255
|
+
...layoutProps,
|
|
256
|
+
layout
|
|
257
|
+
});
|
|
260
258
|
}
|
|
261
259
|
}
|
|
262
260
|
//#endregion
|
|
263
|
-
export { Hero };
|
|
261
|
+
export { Hero, heroRecipe };
|
|
264
262
|
|
|
265
263
|
//# sourceMappingURL=hero.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/hero.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"../../ui/utils\";\nimport { useVariantDefault } from \"../../ui-resolver/context\";\nimport { StorefrontButton } from \"../primitives/button\";\nimport { StorefrontTextLink } from \"../primitives/text-link\";\nimport {\n colorThemeClasses,\n isThemeDark,\n type HeroProps,\n type HeroContentPosition,\n type HeroContentWidth,\n type HeroTextAlign,\n} from \"../types\";\n\nconst aspectClasses: Record<string, string> = {\n \"9:16\": \"aspect-[9/16]\",\n \"4:5\": \"aspect-[4/5]\",\n \"1:1\": \"aspect-square\",\n \"16:9\": \"aspect-video\",\n};\n\nconst contentWidthClasses: Record<HeroContentWidth, string> = {\n sm: \"max-w-sm\",\n md: \"max-w-xl\",\n lg: \"max-w-3xl\",\n};\n\n/* ─── 3×3 content positioning (overlay only) ─── */\n\nconst alignItemsMap: Record<string, string> = {\n top: \"items-start\",\n center: \"items-center\",\n bottom: \"items-end\",\n};\n\nconst justifyMap: Record<string, string> = {\n left: \"justify-start\",\n center: \"justify-center\",\n right: \"justify-end\",\n};\n\nfunction getPositionClasses(position: HeroContentPosition): string {\n const [vertical, horizontal] = position.split(\"-\") as [string, string];\n return cn(\n \"absolute inset-0 flex p-8 md:p-12 lg:p-16\",\n alignItemsMap[vertical],\n justifyMap[horizontal],\n );\n}\n\nfunction getTextAlign(position: HeroContentPosition): \"left\" | \"center\" | \"right\" {\n const horizontal = position.split(\"-\")[1];\n if (horizontal === \"center\") return \"center\";\n if (horizontal === \"right\") return \"right\";\n return \"left\";\n}\n\n/* ─── Directional gradient based on content position ─── */\n\nconst overlayGradientStyle = (direction: string): React.CSSProperties => ({\n background: `linear-gradient(${direction}, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))`,\n});\n\nfunction getGradientDirection(position: HeroContentPosition): string | null {\n const [vertical, horizontal] = position.split(\"-\") as [string, string];\n\n if (vertical === \"bottom\") return \"to top\";\n if (vertical === \"top\") return \"to bottom\";\n if (horizontal === \"left\") return \"to right\";\n if (horizontal === \"right\") return \"to left\";\n\n return null; // center-center fallback\n}\n\nconst centerOverlayStyle: React.CSSProperties = {\n background: \"color-mix(in oklch, var(--enad-overlay-color) 30%, transparent)\",\n};\n\nconst headingStyle = {\n fontWeight: \"var(--enad-heading-weight)\",\n letterSpacing: \"var(--enad-heading-tracking)\",\n textTransform: \"var(--enad-heading-transform)\",\n} as unknown as React.CSSProperties;\n\n/* ─── Shared sub-components ─── */\n\nfunction HeroCTA({\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n dark,\n}: {\n buttonLabel?: string;\n buttonHref?: string;\n textLinkLabel?: string;\n textLinkHref?: string;\n dark?: boolean;\n}) {\n if (!buttonLabel && !textLinkLabel) return null;\n return (\n <div className=\"mt-6 flex flex-wrap items-center gap-4\">\n {buttonLabel && buttonHref && (\n <StorefrontButton href={buttonHref} variant={dark ? \"outline\" : \"primary\"}>\n {buttonLabel}\n </StorefrontButton>\n )}\n {textLinkLabel && textLinkHref && (\n <StorefrontTextLink href={textLinkHref} className={dark ? \"text-white\" : undefined}>\n {textLinkLabel}\n </StorefrontTextLink>\n )}\n </div>\n );\n}\n\nfunction HeroTextBlock({\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n contentWidth = \"md\",\n dark = false,\n align = \"left\",\n headingClamp,\n}: {\n preheader?: string;\n heading?: string;\n buttonLabel?: string;\n buttonHref?: string;\n textLinkLabel?: string;\n textLinkHref?: string;\n contentWidth?: HeroContentWidth;\n dark?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n headingClamp?: string;\n}) {\n return (\n <div\n className={cn(\n \"flex min-w-0 flex-col\",\n contentWidthClasses[contentWidth],\n align === \"center\" && \"items-center text-center\",\n align === \"right\" && \"items-end text-end\",\n align === \"left\" && \"items-start text-start\",\n )}\n >\n {preheader && (\n <p\n className={cn(\n \"mb-2 text-sm uppercase tracking-widest line-clamp-2\",\n dark ? \"text-white/70\" : \"text-muted-foreground\",\n )}\n >\n {preheader}\n </p>\n )}\n {heading && (\n <h1\n className={cn(\n \"text-3xl font-heading md:text-4xl lg:text-5xl\",\n dark ? \"text-white\" : \"text-foreground\",\n headingClamp,\n )}\n style={headingStyle}\n >\n {heading}\n </h1>\n )}\n <HeroCTA\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark={dark}\n />\n </div>\n );\n}\n\n/* ─── Shared layout prop types ─── */\n\ntype HeroLayoutProps = HeroProps & {\n dark: boolean;\n themeClasses: string;\n align: HeroTextAlign;\n};\n\n/* ─── Layout: Minimal ─── */\n\nfunction HeroMinimal({\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n dark,\n themeClasses,\n className,\n}: HeroLayoutProps) {\n return (\n <section\n className={cn(\"px-8 py-16 md:py-24 lg:py-32\", themeClasses || \"bg-background\", className)}\n >\n <div className=\"mx-auto flex max-w-4xl flex-col items-center text-center\">\n {preheader && (\n <p\n className={cn(\n \"mb-2 text-sm uppercase tracking-widest\",\n dark ? \"text-white/70\" : \"text-muted-foreground\",\n )}\n >\n {preheader}\n </p>\n )}\n {heading && (\n <h1\n className={cn(\n \"max-w-prose text-3xl font-heading line-clamp-3 md:text-5xl lg:text-6xl\",\n dark ? \"text-white\" : \"text-foreground\",\n )}\n style={headingStyle}\n >\n {heading}\n </h1>\n )}\n <HeroCTA\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark={dark}\n />\n </div>\n </section>\n );\n}\n\n/* ─── Layout: Banner ─── */\n\nfunction HeroBanner({\n image,\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n themeClasses,\n className,\n}: HeroLayoutProps) {\n return (\n <section\n className={cn(\n \"relative max-h-64 overflow-hidden\",\n image?.src ? \"bg-muted\" : \"bg-primary\",\n themeClasses,\n className,\n )}\n >\n {image?.src && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className=\"size-full object-cover\"\n loading=\"lazy\"\n />\n )}\n <div className=\"absolute inset-0\" style={overlayGradientStyle(\"to right\")} />\n <div className=\"absolute inset-0 flex items-center px-8 md:px-12 lg:px-16\">\n <div className=\"flex w-full min-w-0 flex-wrap items-center justify-between gap-4\">\n <div className=\"flex min-w-0 items-center gap-4\">\n {preheader && (\n <span className=\"shrink-0 text-sm uppercase tracking-widest text-white/70\">\n {preheader}\n </span>\n )}\n {heading && (\n <h2\n className=\"min-w-0 truncate text-xl font-heading text-white md:text-2xl lg:text-3xl\"\n style={headingStyle}\n >\n {heading}\n </h2>\n )}\n </div>\n <HeroCTA\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark\n />\n </div>\n </div>\n </section>\n );\n}\n\n/* ─── Layout: Split ─── */\n\nfunction HeroSplit({\n image,\n aspectRatio = \"16:9\",\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n contentWidth = \"md\",\n dark,\n themeClasses,\n align,\n className,\n}: HeroLayoutProps) {\n const hasImage = Boolean(image?.src);\n return (\n <section className={cn(\"grid\", hasImage && \"lg:grid-cols-2\", themeClasses, className)}>\n <div className=\"flex min-w-0 items-center px-8 py-12 lg:px-16 lg:py-20\">\n <HeroTextBlock\n preheader={preheader}\n heading={heading}\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n contentWidth={contentWidth}\n dark={dark}\n align={align}\n headingClamp=\"line-clamp-4\"\n />\n </div>\n {hasImage && (\n <div className={cn(\"relative overflow-hidden bg-muted\", aspectClasses[aspectRatio])}>\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className=\"size-full object-cover\"\n loading=\"lazy\"\n />\n </div>\n )}\n </section>\n );\n}\n\n/* ─── Layout: Image only ─── */\n\nfunction HeroImageOnly({ image, aspectRatio = \"16:9\", className }: HeroLayoutProps) {\n return (\n <section\n className={cn(\"relative overflow-hidden bg-muted\", aspectClasses[aspectRatio], className)}\n >\n {image?.src && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className=\"size-full object-cover\"\n loading=\"lazy\"\n />\n )}\n </section>\n );\n}\n\n/* ─── Overlay background helper ─── */\n\nfunction resolveOverlayGradient(position: HeroContentPosition): React.CSSProperties {\n const direction = getGradientDirection(position);\n return direction ? overlayGradientStyle(direction) : centerOverlayStyle;\n}\n\nfunction resolveOverlayBg(imageSrc?: string): string {\n return imageSrc ? \"bg-muted\" : \"bg-primary\";\n}\n\n/* ─── Layout: Overlay ─── */\n\nfunction HeroOverlay({\n image,\n aspectRatio = \"16:9\",\n contentPosition = \"bottom-center\",\n contentWidth = \"md\",\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n dark,\n themeClasses,\n align,\n className,\n}: HeroLayoutProps) {\n const hasContent = preheader || heading || buttonLabel || textLinkLabel;\n const position = contentPosition ?? \"bottom-center\";\n\n return (\n <section\n className={cn(\n \"relative overflow-hidden\",\n resolveOverlayBg(image?.src),\n aspectClasses[aspectRatio],\n themeClasses,\n className,\n )}\n >\n {image?.src && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className=\"size-full object-cover\"\n loading=\"lazy\"\n />\n )}\n <div className=\"absolute inset-0\" style={resolveOverlayGradient(position)} />\n {hasContent && (\n <div className={getPositionClasses(position)}>\n <HeroTextBlock\n preheader={preheader}\n heading={heading}\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n contentWidth={contentWidth}\n dark={dark}\n align={align}\n headingClamp=\"line-clamp-3\"\n />\n </div>\n )}\n </section>\n );\n}\n\n/* ─── Main component (dispatcher) ─── */\n\nfunction Hero(props: HeroProps) {\n const heroDefault = useVariantDefault(\"hero\");\n const {\n layout = heroDefault ?? \"overlay\",\n contentPosition = \"bottom-center\",\n textAlign,\n colorTheme,\n } = props;\n\n const dark = isThemeDark(colorTheme) || layout === \"overlay\";\n const themeClasses = colorThemeClasses(colorTheme);\n const defaultAlign: HeroTextAlign =\n layout === \"overlay\" ? getTextAlign(contentPosition ?? \"bottom-center\") : \"left\";\n const align = textAlign ?? defaultAlign;\n\n const layoutProps: HeroLayoutProps = {\n ...props,\n dark,\n themeClasses,\n align,\n };\n\n switch (layout) {\n case \"minimal\":\n return <HeroMinimal {...layoutProps} />;\n case \"banner\":\n return <HeroBanner {...layoutProps} />;\n case \"split\":\n return <HeroSplit {...layoutProps} />;\n case \"image-only\":\n return <HeroImageOnly {...layoutProps} />;\n default:\n return <HeroOverlay {...layoutProps} />;\n }\n}\n\nexport { Hero, type HeroProps };\n"],"mappings":";;;;;;;;;AAgBA,MAAM,gBAAwC;CAC5C,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACT;AAED,MAAM,sBAAwD;CAC5D,IAAI;CACJ,IAAI;C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MAAM,WAAW,mBAAmB;AAEpC,QACE,qBAAC,WAAD;EACE,WAAW,GACT,4BACA,iBAAiB,OAAO,IAAI,EAC5B,cAAc,cACd,cACA,UACD;YAPH;GASG,OAAO,OACN,oBAAC,OAAD;IACE,KAAK,OAAO;IACZ,KAAK,OAAO,OAAO;IACnB,WAAU;IACV,SAAQ;IACR,CAAA;GAEJ,oBAAC,OAAD;IAAK,WAAU;IAAmB,OAAO,uBAAuB,SAAS;IAAI,CAAA;GAC5E,cACC,oBAAC,OAAD;IAAK,WAAW,mBAAmB,SAAS;cAC1C,oBAAC,eAAD;KACa;KACF;KACI;KACD;KACG;KACD;KACA;KACR;KACC;KACP,cAAa;KACb,CAAA;IACE,CAAA;GAEA;;;AAMd,SAAS,KAAK,OAAkB;CAC9B,MAAM,cAAc,kBAAkB,OAAO;CAC7C,MAAM,EACJ,SAAS,eAAe,WACxB,kBAAkB,iBAClB,WACA,eACE;CAEJ,MAAM,OAAO,YAAY,WAAW,IAAI,WAAW;CACnD,MAAM,eAAe,kBAAkB,WAAW;CAClD,MAAM,eACJ,WAAW,YAAY,aAAa,mBAAmB,gBAAgB,GAAG;CAC5E,MAAM,QAAQ,aAAa;CAE3B,MAAM,cAA+B;EACnC,GAAG;EACH;EACA;EACA;EACD;AAED,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,oBAAC,aAAD,EAAa,GAAI,aAAe,CAAA;EACzC,KAAK,SACH,QAAO,oBAAC,YAAD,EAAY,GAAI,aAAe,CAAA;EACxC,KAAK,QACH,QAAO,oBAAC,WAAD,EAAW,GAAI,aAAe,CAAA;EACvC,KAAK,aACH,QAAO,oBAAC,eAAD,EAAe,GAAI,aAAe,CAAA;EAC3C,QACE,QAAO,oBAAC,aAAD,EAAa,GAAI,aAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"hero.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/hero.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"../../ui/utils\";\nimport { defineSlotRecipe } from \"../../ui-resolver/recipe\";\nimport { useVariantDefault } from \"../../ui-resolver/context\";\nimport { BlockHeading } from \"../primitives/block-heading\";\nimport { CTAGroup } from \"../primitives/cta-group\";\nimport {\n colorThemeClasses,\n isThemeDark,\n type HeroProps,\n type HeroContentPosition,\n type HeroTextAlign,\n} from \"../types\";\n\n/* ─── Recipe ─── */\n\nconst heroRecipe = defineSlotRecipe({\n slots: [\"root\", \"background\", \"overlay\", \"content\"] as const,\n base: {\n root: \"\",\n background: \"size-full object-cover\",\n overlay: \"absolute inset-0\",\n content: \"\",\n },\n variants: {\n layout: {\n overlay: {\n root: \"relative overflow-hidden\",\n },\n split: {\n root: \"grid\",\n },\n minimal: {\n root: \"px-[var(--enad-hero-px,2rem)] py-[var(--enad-hero-py,4rem)] md:py-[calc(var(--enad-hero-py,4rem)*1.5)] lg:py-[calc(var(--enad-hero-py,4rem)*2)]\",\n },\n banner: {\n root: \"relative max-h-64 overflow-hidden\",\n },\n \"image-only\": {\n root: \"relative overflow-hidden bg-muted\",\n },\n },\n contentWidth: {\n sm: { content: \"max-w-sm\" },\n md: { content: \"max-w-xl\" },\n lg: { content: \"max-w-3xl\" },\n },\n },\n defaultVariants: {\n layout: \"overlay\",\n contentWidth: \"md\",\n },\n});\n\n/* ─── Aspect ratio map ─── */\n\nconst aspectClasses: Record<string, string> = {\n \"9:16\": \"aspect-[9/16]\",\n \"4:5\": \"aspect-[4/5]\",\n \"1:1\": \"aspect-square\",\n \"16:9\": \"aspect-video\",\n};\n\n/* ─── Overlay gradient ─── */\n\nconst overlayGradientStyle = (direction: string): React.CSSProperties => ({\n background: `linear-gradient(${direction}, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))`,\n});\n\nconst centerOverlayStyle: React.CSSProperties = {\n background: \"color-mix(in oklch, var(--enad-overlay-color) 30%, transparent)\",\n};\n\n/* ─── Position helpers ─── */\n\nconst alignItemsMap: Record<string, string> = {\n top: \"items-start\",\n center: \"items-center\",\n bottom: \"items-end\",\n};\n\nconst justifyMap: Record<string, string> = {\n left: \"justify-start\",\n center: \"justify-center\",\n right: \"justify-end\",\n};\n\nfunction getPositionClasses(position: HeroContentPosition): string {\n const [vertical, horizontal] = position.split(\"-\") as [string, string];\n return cn(\n \"absolute inset-0 flex p-8 md:p-12 lg:p-16\",\n alignItemsMap[vertical],\n justifyMap[horizontal],\n );\n}\n\nfunction getTextAlign(position: HeroContentPosition): \"left\" | \"center\" | \"right\" {\n const horizontal = position.split(\"-\")[1];\n if (horizontal === \"center\") return \"center\";\n if (horizontal === \"right\") return \"right\";\n return \"left\";\n}\n\nfunction getGradientDirection(position: HeroContentPosition): string | null {\n const [vertical, horizontal] = position.split(\"-\") as [string, string];\n if (vertical === \"bottom\") return \"to top\";\n if (vertical === \"top\") return \"to bottom\";\n if (horizontal === \"left\") return \"to right\";\n if (horizontal === \"right\") return \"to left\";\n return null;\n}\n\n/* ─── Layout prop types ─── */\n\ntype HeroLayoutProps = HeroProps & {\n dark: boolean;\n themeClasses: string;\n align: HeroTextAlign;\n};\n\n/* ─── Layout: WithImage (overlay + split) ─── */\n\nfunction HeroWithImage({\n layout,\n image,\n aspectRatio = \"16:9\",\n contentPosition = \"bottom-center\",\n contentWidth = \"md\",\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n dark,\n themeClasses,\n align,\n className,\n}: HeroLayoutProps) {\n const classes = heroRecipe({ layout, contentWidth });\n const hasImage = Boolean(image?.src);\n const hasContent = preheader || heading || buttonLabel || textLinkLabel;\n const position = contentPosition ?? \"bottom-center\";\n\n if (layout === \"split\") {\n return (\n <section className={cn(classes.root, hasImage && \"lg:grid-cols-2\", themeClasses, className)}>\n <div className=\"flex min-w-0 flex-col justify-center px-8 py-12 lg:px-16 lg:py-20\">\n <BlockHeading\n preheader={preheader}\n heading={heading}\n dark={dark}\n align={align}\n headingTag=\"h1\"\n headingSize=\"lg\"\n headingClamp=\"line-clamp-4\"\n className={classes.content}\n />\n <CTAGroup\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark={dark}\n />\n </div>\n {hasImage && (\n <div className={cn(\"relative overflow-hidden bg-muted\", aspectClasses[aspectRatio])}>\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className={classes.background}\n loading=\"lazy\"\n />\n </div>\n )}\n </section>\n );\n }\n\n /* Overlay */\n const gradientDirection = getGradientDirection(position);\n const overlayStyle = gradientDirection\n ? overlayGradientStyle(gradientDirection)\n : centerOverlayStyle;\n\n return (\n <section\n className={cn(\n classes.root,\n hasImage ? \"bg-muted\" : \"bg-primary\",\n aspectClasses[aspectRatio],\n themeClasses,\n className,\n )}\n >\n {hasImage && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className={classes.background}\n loading=\"lazy\"\n />\n )}\n <div className={classes.overlay} style={overlayStyle} />\n {hasContent && (\n <div className={getPositionClasses(position)}>\n <div className={cn(\"flex min-w-0 flex-col\", classes.content)}>\n <BlockHeading\n preheader={preheader}\n heading={heading}\n dark={dark}\n align={align}\n headingTag=\"h1\"\n headingSize=\"lg\"\n headingClamp=\"line-clamp-3\"\n />\n <CTAGroup\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark={dark}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n\n/* ─── Layout: TextOnly (minimal) ─── */\n\nfunction HeroTextOnly({\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n dark,\n themeClasses,\n className,\n}: HeroLayoutProps) {\n const classes = heroRecipe({ layout: \"minimal\" });\n\n return (\n <section className={cn(classes.root, themeClasses || \"bg-background\", className)}>\n <div className=\"mx-auto flex max-w-4xl flex-col items-center text-center\">\n <BlockHeading\n preheader={preheader}\n heading={heading}\n dark={dark}\n align=\"center\"\n headingTag=\"h1\"\n headingSize=\"xl\"\n headingClamp=\"line-clamp-3\"\n className=\"max-w-prose\"\n />\n <CTAGroup\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark={dark}\n />\n </div>\n </section>\n );\n}\n\n/* ─── Layout: Compact (banner) ─── */\n\nfunction HeroCompact({\n image,\n preheader,\n heading,\n buttonLabel,\n buttonHref,\n textLinkLabel,\n textLinkHref,\n themeClasses,\n className,\n}: HeroLayoutProps) {\n const classes = heroRecipe({ layout: \"banner\" });\n\n return (\n <section\n className={cn(classes.root, image?.src ? \"bg-muted\" : \"bg-primary\", themeClasses, className)}\n >\n {image?.src && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className={classes.background}\n loading=\"lazy\"\n />\n )}\n <div className={classes.overlay} style={overlayGradientStyle(\"to right\")} />\n <div className=\"absolute inset-0 flex items-center px-8 md:px-12 lg:px-16\">\n <div className=\"flex w-full min-w-0 flex-wrap items-center justify-between gap-4\">\n <div className=\"flex min-w-0 items-center gap-4\">\n {preheader && (\n <span className=\"shrink-0 text-sm uppercase tracking-widest text-white/70\">\n {preheader}\n </span>\n )}\n {heading && (\n <h2\n className=\"min-w-0 truncate text-xl font-heading text-white md:text-2xl lg:text-3xl\"\n style={\n {\n fontWeight: \"var(--enad-heading-weight)\",\n letterSpacing: \"var(--enad-heading-tracking)\",\n textTransform: \"var(--enad-heading-transform)\",\n } as unknown as React.CSSProperties\n }\n >\n {heading}\n </h2>\n )}\n </div>\n <CTAGroup\n buttonLabel={buttonLabel}\n buttonHref={buttonHref}\n textLinkLabel={textLinkLabel}\n textLinkHref={textLinkHref}\n dark\n />\n </div>\n </div>\n </section>\n );\n}\n\n/* ─── Layout: ImageOnly ─── */\n\nfunction HeroImageOnly({ image, aspectRatio = \"16:9\", className }: HeroLayoutProps) {\n const classes = heroRecipe({ layout: \"image-only\" });\n\n return (\n <section className={cn(classes.root, aspectClasses[aspectRatio], className)}>\n {image?.src && (\n <img\n src={image?.src}\n alt={image?.alt ?? \"\"}\n className={classes.background}\n loading=\"lazy\"\n />\n )}\n </section>\n );\n}\n\n/* ─── Main component (dispatcher) ─── */\n\nfunction Hero(props: HeroProps) {\n const heroDefault = useVariantDefault(\"hero\");\n const {\n layout = heroDefault ?? \"overlay\",\n contentPosition = \"bottom-center\",\n textAlign,\n colorTheme,\n } = props;\n\n const dark = isThemeDark(colorTheme) || layout === \"overlay\";\n const themeClasses = colorThemeClasses(colorTheme);\n const defaultAlign: HeroTextAlign =\n layout === \"overlay\" ? getTextAlign(contentPosition ?? \"bottom-center\") : \"left\";\n const align = textAlign ?? defaultAlign;\n\n const layoutProps: HeroLayoutProps = {\n ...props,\n dark,\n themeClasses,\n align,\n };\n\n switch (layout) {\n case \"minimal\":\n return <HeroTextOnly {...layoutProps} />;\n case \"banner\":\n return <HeroCompact {...layoutProps} />;\n case \"image-only\":\n return <HeroImageOnly {...layoutProps} />;\n case \"split\":\n default:\n return <HeroWithImage {...layoutProps} layout={layout} />;\n }\n}\n\nexport { Hero, heroRecipe, type HeroProps };\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,aAAa,iBAAiB;CAClC,OAAO;EAAC;EAAQ;EAAc;EAAW;EAAU;CACnD,MAAM;EACJ,MAAM;EACN,YAAY;EACZ,SAAS;EACT,SAAS;EACV;CACD,UAAU;EACR,QAAQ;GACN,SAAS,EACP,MAAM,4BACP;GACD,OAAO,EACL,MAAM,QACP;GACD,SAAS,EACP,MAAM,mJACP;GACD,QAAQ,EACN,MAAM,qCACP;GACD,cAAc,EACZ,MAAM,qCACP;GACF;EACD,cAAc;GACZ,IAAI,EAAE,SAAS,YAAY;GAC3B,IAAI,EAAE,SAAS,YAAY;GAC3B,IAAI,EAAE,SAAS,aAAa;GAC7B;EACF;CACD,iBAAiB;EACf,QAAQ;EACR,cAAc;EACf;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eAAe,WACxB,kBAAkB,iBAClB,WACA,eACE;CAEJ,MAAM,OAAO,YAAY,WAAW,IAAI,WAAW;CACnD,MAAM,eAAe,kBAAkB,WAAW;CAClD,MAAM,eACJ,WAAW,YAAY,aAAa,mBAAmB,gBAAgB,GAAG;CAC5E,MAAM,QAAQ,aAAa;CAE3B,MAAM,cAA+B;EACnC,GAAG;EACH;EACA;EACA;EACD;AAED,SAAQ,QAAR;EACE,KAAK,UACH,QAAO,oBAAC,cAAD,EAAc,GAAI,aAAe,CAAA;EAC1C,KAAK,SACH,QAAO,oBAAC,aAAD,EAAa,GAAI,aAAe,CAAA;EACzC,KAAK,aACH,QAAO,oBAAC,eAAD,EAAe,GAAI,aAAe,CAAA;EAE3C,QACE,QAAO,oBAAC,eAAD;GAAe,GAAI;GAAqB;GAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-block-small.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/link-block-small.tsx"],"mappings":";;;;iBAIS,cAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"link-block-small.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/link-block-small.tsx"],"mappings":";;;;iBAIS,cAAA,CAAA;EAAiB,KAAA;EAAO,KAAA;EAAO,IAAA;EAAM;AAAA,GAAa,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -9,7 +9,7 @@ function LinkBlockSmall({ image, title, href, className }) {
|
|
|
9
9
|
image?.src ? /* @__PURE__ */ jsx("img", {
|
|
10
10
|
src: image.src,
|
|
11
11
|
alt: image.alt ?? title ?? "",
|
|
12
|
-
className: "size-full object-cover
|
|
12
|
+
className: "size-full object-cover"
|
|
13
13
|
}) : /* @__PURE__ */ jsx("div", { className: "size-full bg-muted" }),
|
|
14
14
|
/* @__PURE__ */ jsx("div", {
|
|
15
15
|
className: "absolute inset-0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-block-small.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/link-block-small.tsx"],"sourcesContent":["import * as React from \"react\"
|
|
1
|
+
{"version":3,"file":"link-block-small.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/link-block-small.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../ui/utils\";\nimport type { LinkBlockSmallProps } from \"../types\";\n\nfunction LinkBlockSmall({ image, title, href, className }: LinkBlockSmallProps) {\n const card = (\n <div\n className={cn(\n \"enad-interactive group relative aspect-[3/4] overflow-hidden rounded-[var(--enad-card-radius)]\",\n className,\n )}\n >\n {image?.src ? (\n <img src={image.src} alt={image.alt ?? title ?? \"\"} className=\"size-full object-cover\" />\n ) : (\n <div className=\"size-full bg-muted\" />\n )}\n <div\n className=\"absolute inset-0\"\n style={{\n background:\n \"linear-gradient(to top, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))\",\n }}\n />\n {title && (\n <p className=\"absolute inset-x-0 bottom-0 p-3 text-sm font-medium text-white\">{title}</p>\n )}\n </div>\n );\n\n if (href) {\n return (\n <a href={href} className=\"block\">\n {card}\n </a>\n );\n }\n\n return card;\n}\n\nexport { LinkBlockSmall, type LinkBlockSmallProps };\n"],"mappings":";;;;AAIA,SAAS,eAAe,EAAE,OAAO,OAAO,MAAM,aAAkC;CAC9E,MAAM,OACJ,qBAAC,OAAD;EACE,WAAW,GACT,kGACA,UACD;YAJH;GAMG,OAAO,MACN,oBAAC,OAAD;IAAK,KAAK,MAAM;IAAK,KAAK,MAAM,OAAO,SAAS;IAAI,WAAU;IAA2B,CAAA,GAEzF,oBAAC,OAAD,EAAK,WAAU,sBAAuB,CAAA;GAExC,oBAAC,OAAD;IACE,WAAU;IACV,OAAO,EACL,YACE,+OACH;IACD,CAAA;GACD,SACC,oBAAC,KAAD;IAAG,WAAU;cAAkE;IAAU,CAAA;GAEvF;;AAGR,KAAI,KACF,QACE,oBAAC,KAAD;EAAS;EAAM,WAAU;YACtB;EACC,CAAA;AAIR,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-block.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/link-block.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"link-block.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/link-block.tsx"],"mappings":";;;;iBAqPS,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -21,14 +21,14 @@ function CardVariant({ image, eyebrow, title, buttonLabel, buttonHref, dark, the
|
|
|
21
21
|
href: buttonHref,
|
|
22
22
|
radiusClass: "rounded-[var(--enad-card-radius)]",
|
|
23
23
|
children: /* @__PURE__ */ jsxs("div", {
|
|
24
|
-
className: cn("enad-interactive group overflow-hidden rounded-[var(--enad-card-radius)]", "shadow-[var(--enad-card-shadow)]
|
|
24
|
+
className: cn("enad-interactive group overflow-hidden rounded-[var(--enad-card-radius)]", "shadow-[var(--enad-card-shadow)]", themeClasses || "bg-background", className),
|
|
25
25
|
children: [image?.src ? /* @__PURE__ */ jsx("div", {
|
|
26
26
|
className: "overflow-hidden rounded-t-[var(--enad-image-radius)] bg-muted",
|
|
27
27
|
children: /* @__PURE__ */ jsx("img", {
|
|
28
28
|
src: image.src,
|
|
29
29
|
alt: image.alt ?? title ?? "",
|
|
30
30
|
loading: "lazy",
|
|
31
|
-
className: "aspect-[3/2] w-full object-cover
|
|
31
|
+
className: "aspect-[3/2] w-full object-cover"
|
|
32
32
|
})
|
|
33
33
|
}) : /* @__PURE__ */ jsx("div", {
|
|
34
34
|
className: "aspect-[3/2] w-full bg-muted",
|
|
@@ -59,7 +59,7 @@ function TextOnlyVariant({ eyebrow, title, buttonLabel, buttonHref, dark, themeC
|
|
|
59
59
|
href: buttonHref,
|
|
60
60
|
radiusClass: "rounded-[var(--enad-card-radius)]",
|
|
61
61
|
children: /* @__PURE__ */ jsxs("div", {
|
|
62
|
-
className: cn("
|
|
62
|
+
className: cn("rounded-[var(--enad-card-radius)] border transition-colors duration-[var(--enad-motion-duration)]", "border-[length:var(--enad-border-width)] px-6 py-5", dark ? "border-white/20 hover:bg-white/10" : "border-border hover:bg-accent", themeClasses, className),
|
|
63
63
|
children: [
|
|
64
64
|
eyebrow && /* @__PURE__ */ jsx("p", {
|
|
65
65
|
className: cn("mb-1 text-sm uppercase tracking-widest", dark ? "text-white/70" : "text-muted-foreground"),
|
|
@@ -88,7 +88,7 @@ function OverlayVariant({ image, eyebrow, title, buttonLabel, buttonHref, classN
|
|
|
88
88
|
src: image.src,
|
|
89
89
|
alt: image.alt ?? title ?? "",
|
|
90
90
|
loading: "lazy",
|
|
91
|
-
className: "size-full object-cover
|
|
91
|
+
className: "size-full object-cover"
|
|
92
92
|
}) : /* @__PURE__ */ jsx("div", {
|
|
93
93
|
className: "size-full bg-primary",
|
|
94
94
|
"aria-hidden": "true"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-block.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/link-block.tsx"],"sourcesContent":["import * as React from \"react\"
|
|
1
|
+
{"version":3,"file":"link-block.mjs","names":[],"sources":["../../../../src/client/storefront/blocks/link-block.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../ui/utils\";\nimport { colorThemeClasses, isThemeDark, type LinkBlockProps } from \"../types\";\n\n/* ─── Shared types ─── */\n\ntype VariantProps = LinkBlockProps & {\n dark: boolean;\n themeClasses: string;\n};\n\nconst headingStyle = {\n fontWeight: \"var(--enad-heading-weight)\",\n letterSpacing: \"var(--enad-heading-tracking)\",\n textTransform: \"var(--enad-heading-transform)\",\n} as unknown as React.CSSProperties;\n\n/* ─── Shared link wrapper ─── */\n\nfunction OptionalLink({\n href,\n radiusClass,\n children,\n}: {\n href?: string;\n radiusClass?: string;\n children: React.ReactNode;\n}) {\n if (!href) return children;\n return (\n <a\n href={href}\n className={cn(\n \"block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n radiusClass,\n )}\n >\n {children}\n </a>\n );\n}\n\n/* ─── Card variant ─── */\n\nfunction CardVariant({\n image,\n eyebrow,\n title,\n buttonLabel,\n buttonHref,\n dark,\n themeClasses,\n className,\n}: VariantProps) {\n const content = (\n <div\n className={cn(\n \"enad-interactive group overflow-hidden rounded-[var(--enad-card-radius)]\",\n \"shadow-[var(--enad-card-shadow)]\",\n themeClasses || \"bg-background\",\n className,\n )}\n >\n {/* Image top */}\n {image?.src ? (\n <div className=\"overflow-hidden rounded-t-[var(--enad-image-radius)] bg-muted\">\n <img\n src={image.src}\n alt={image.alt ?? title ?? \"\"}\n loading=\"lazy\"\n className=\"aspect-[3/2] w-full object-cover\"\n />\n </div>\n ) : (\n <div className=\"aspect-[3/2] w-full bg-muted\" aria-hidden=\"true\" />\n )}\n\n {/* Text content below */}\n <div className=\"min-w-0 p-6\">\n {eyebrow && (\n <p\n className={cn(\n \"mb-1 text-sm uppercase tracking-widest\",\n dark ? \"text-white/70\" : \"text-muted-foreground\",\n )}\n >\n {eyebrow}\n </p>\n )}\n {title && (\n <h3\n className={cn(\n \"line-clamp-2 text-xl font-heading\",\n dark ? \"text-white\" : \"text-foreground\",\n )}\n style={headingStyle}\n >\n {title}\n </h3>\n )}\n {buttonLabel && (\n <span\n className={cn(\n \"mt-3 inline-block text-sm font-medium line-clamp-3\",\n dark ? \"text-white/80\" : \"text-foreground\",\n )}\n >\n {buttonLabel}\n </span>\n )}\n </div>\n </div>\n );\n\n return (\n <OptionalLink href={buttonHref} radiusClass=\"rounded-[var(--enad-card-radius)]\">\n {content}\n </OptionalLink>\n );\n}\n\n/* ─── Text-only variant ─── */\n\nfunction TextOnlyVariant({\n eyebrow,\n title,\n buttonLabel,\n buttonHref,\n dark,\n themeClasses,\n className,\n}: VariantProps) {\n const content = (\n <div\n className={cn(\n \"rounded-[var(--enad-card-radius)] border transition-colors duration-[var(--enad-motion-duration)]\",\n \"border-[length:var(--enad-border-width)] px-6 py-5\",\n dark ? \"border-white/20 hover:bg-white/10\" : \"border-border hover:bg-accent\",\n themeClasses,\n className,\n )}\n >\n {eyebrow && (\n <p\n className={cn(\n \"mb-1 text-sm uppercase tracking-widest\",\n dark ? \"text-white/70\" : \"text-muted-foreground\",\n )}\n >\n {eyebrow}\n </p>\n )}\n {title && (\n <h3\n className={cn(\"truncate text-lg font-heading\", dark ? \"text-white\" : \"text-foreground\")}\n style={headingStyle}\n >\n {title}\n </h3>\n )}\n {buttonLabel && (\n <span\n className={cn(\n \"mt-2 inline-block text-sm font-medium\",\n dark ? \"text-white/80\" : \"text-muted-foreground\",\n )}\n >\n {buttonLabel}\n </span>\n )}\n </div>\n );\n\n return (\n <OptionalLink href={buttonHref} radiusClass=\"rounded-[var(--enad-card-radius)]\">\n {content}\n </OptionalLink>\n );\n}\n\n/* ─── Overlay variant (default) ─── */\n\nfunction OverlayVariant({\n image,\n eyebrow,\n title,\n buttonLabel,\n buttonHref,\n className,\n}: VariantProps) {\n const content = (\n <div\n className={cn(\n \"enad-interactive group relative aspect-[3/4] overflow-hidden md:aspect-[2/1]\",\n className,\n )}\n >\n {/* Background image */}\n {image?.src ? (\n <img\n src={image.src}\n alt={image.alt ?? title ?? \"\"}\n loading=\"lazy\"\n className=\"size-full object-cover\"\n />\n ) : (\n <div className=\"size-full bg-primary\" aria-hidden=\"true\" />\n )}\n\n {/* Gradient overlay */}\n <div\n className=\"absolute inset-0\"\n style={{\n background:\n \"linear-gradient(to top, color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-from-opacity) * 100%), transparent), color-mix(in oklch, var(--enad-overlay-color) calc(var(--enad-overlay-to-opacity) * 100%), transparent))\",\n }}\n />\n\n {/* Text content */}\n <div className=\"absolute inset-x-0 bottom-0 min-w-0 p-6 md:p-8\">\n {eyebrow && (\n <p className=\"mb-1 text-sm uppercase tracking-widest text-white/70\">{eyebrow}</p>\n )}\n {title && (\n <h3\n className=\"line-clamp-2 text-xl font-heading text-white md:text-2xl\"\n style={headingStyle}\n >\n {title}\n </h3>\n )}\n {buttonLabel && (\n <span className=\"mt-3 inline-block border-b border-white/50 pb-0.5 text-sm text-white transition-colors group-hover:border-white\">\n {buttonLabel}\n </span>\n )}\n </div>\n </div>\n );\n\n return <OptionalLink href={buttonHref}>{content}</OptionalLink>;\n}\n\n/* ─── Main component (dispatcher) ─── */\n\nfunction LinkBlock(props: LinkBlockProps) {\n const dark = isThemeDark(props.colorTheme);\n const themeClasses = colorThemeClasses(props.colorTheme);\n const variantProps: VariantProps = { ...props, dark, themeClasses };\n\n switch (props.variant ?? \"overlay\") {\n case \"card\":\n return <CardVariant {...variantProps} />;\n case \"text-only\":\n return <TextOnlyVariant {...variantProps} />;\n default:\n return <OverlayVariant {...variantProps} />;\n }\n}\n\nexport { LinkBlock, type LinkBlockProps };\n"],"mappings":";;;;;AAWA,MAAM,eAAe;CACnB,YAAY;CACZ,eAAe;CACf,eAAe;CAChB;AAID,SAAS,aAAa,EACpB,MACA,aACA,YAKC;AACD,KAAI,CAAC,KAAM,QAAO;AAClB,QACE,oBAAC,KAAD;EACQ;EACN,WAAW,GACT,6GACA,YACD;EAEA;EACC,CAAA;;AAMR,SAAS,YAAY,EACnB,OACA,SACA,OACA,aACA,YACA,MACA,cACA,aACe;AA6Df,QACE,oBAAC,cAAD;EAAc,MAAM;EAAY,aAAY;YA5D5C,qBAAC,OAAD;GACE,WAAW,GACT,4EACA,oCACA,gBAAgB,iBAChB,UACD;aANH,CASG,OAAO,MACN,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,OAAD;KACE,KAAK,MAAM;KACX,KAAK,MAAM,OAAO,SAAS;KAC3B,SAAQ;KACR,WAAU;KACV,CAAA;IACE,CAAA,GAEN,oBAAC,OAAD;IAAK,WAAU;IAA+B,eAAY;IAAS,CAAA,EAIrE,qBAAC,OAAD;IAAK,WAAU;c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G,WAAU;iBAAwD;OAAY,CAAA;MAElF,SACC,oBAAC,MAAD;OACE,WAAU;OACV,OAAO;iBAEN;OACE,CAAA;MAEN,eACC,oBAAC,QAAD;OAAM,WAAU;iBACb;OACI,CAAA;MAEL;;IACF;;EAGuD,CAAA;;AAKjE,SAAS,UAAU,OAAuB;CACxC,MAAM,OAAO,YAAY,MAAM,WAAW;CAC1C,MAAM,eAAe,kBAAkB,MAAM,WAAW;CACxD,MAAM,eAA6B;EAAE,GAAG;EAAO;EAAM;EAAc;AAEnE,SAAQ,MAAM,WAAW,WAAzB;EACE,KAAK,OACH,QAAO,oBAAC,aAAD,EAAa,GAAI,cAAgB,CAAA;EAC1C,KAAK,YACH,QAAO,oBAAC,iBAAD,EAAiB,GAAI,cAAgB,CAAA;EAC9C,QACE,QAAO,oBAAC,gBAAD,EAAgB,GAAI,cAAgB,CAAA"}
|
|
@@ -4,7 +4,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
4
4
|
//#region src/client/storefront/blocks/product-card-parts.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Root container for a composable product card.
|
|
7
|
-
* Provides
|
|
7
|
+
* Provides grouping and overflow handling for composed layouts.
|
|
8
8
|
*/
|
|
9
9
|
declare function ProductCardRoot({
|
|
10
10
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card-parts.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/product-card-parts.tsx"],"mappings":";;;;;;;AAE+B;iBAStB,eAAA,CAAA;EAAkB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;
|
|
1
|
+
{"version":3,"file":"product-card-parts.d.ts","names":[],"sources":["../../../../src/client/storefront/blocks/product-card-parts.tsx"],"mappings":";;;;;;;AAE+B;iBAStB,eAAA,CAAA;EAAkB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;iBAcpE,oBAAA,CAAA;EAAuB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAazE,gBAAA,CAAA;EACP,SAAA;EACA,GAAA;EACA,OAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;iBAgBrB,cAAA,CAAA;EAAiB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,WAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AAhDA;;;iBAiEpE,yBAAA,CAAA;EACP,SAAA;EACA,OAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,aAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAuBxB,kBAAA,CAAA;EAAqB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAavE,gBAAA,CAAA;EAAmB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBAanE,mBAAA,CAAA;EAAsB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;AAxGG;;iBAqHzE,gBAAA,CAAA;EAAmB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,WAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -5,12 +5,12 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/client/storefront/blocks/product-card-parts.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Root container for a composable product card.
|
|
8
|
-
* Provides
|
|
8
|
+
* Provides grouping and overflow handling for composed layouts.
|
|
9
9
|
*/
|
|
10
10
|
function ProductCardRoot({ className, ...props }) {
|
|
11
11
|
return /* @__PURE__ */ jsx("div", {
|
|
12
12
|
"data-slot": "product-card",
|
|
13
|
-
className: cn("
|
|
13
|
+
className: cn("group overflow-hidden rounded-[var(--enad-card-radius)]", className),
|
|
14
14
|
...props
|
|
15
15
|
});
|
|
16
16
|
}
|