fragment-headless-sdk 2.4.1 → 2.4.4

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.
@@ -18,12 +18,12 @@ export default function DesktopHero({ buttonHref, content, colors, contentWidthC
18
18
  const handleClick = React.useCallback(() => {
19
19
  fireClickMetric(content.measurementId, content.sectionType || SectionType.HeroBanner, content.sectionId);
20
20
  }, [content.measurementId, content.sectionType, content.sectionId]);
21
- return (React.createElement("div", { className: `relative ${height} gap-4 w-full`, style: { backgroundColor: colors.background } },
21
+ return (React.createElement("div", { className: "relative gap-4 w-full", style: { backgroundColor: colors.background, height } },
22
22
  content?.videoUrl ? (React.createElement("video", { src: content.videoUrl, autoPlay: true, muted: true, loop: true, playsInline: true, className: "absolute inset-0 z-0 object-cover w-full h-full" })) : (
23
23
  /* Image Background */
24
24
  content?.imageUrl && (React.createElement("img", { src: content.imageUrl, alt: content.title || "Hero", className: "absolute inset-0 z-0 object-cover w-full h-full" }))),
25
25
  React.createElement("div", { className: `relative z-10 mx-auto flex h-full max-w-screen-xl flex-col justify-center px-10 ${getPositionClasses()} xl:px-4` },
26
- React.createElement("div", { className: joinClassNames("max-w-full flex flex-col", contentSpacing ?? "gap-4", contentWidthClass || DEFAULT_CONTENT_WIDTH_CLASS) },
26
+ React.createElement("div", { className: joinClassNames("max-w-full flex flex-col items-start", contentSpacing ?? "gap-4", contentWidthClass || DEFAULT_CONTENT_WIDTH_CLASS) },
27
27
  renderText({
28
28
  fontSize: typography.title.fontSize,
29
29
  lineHeight: typography.title.lineHeight,
@@ -10,7 +10,7 @@ export interface HeroResolvedColors {
10
10
  }
11
11
  export declare const DEFAULT_COLORS: HeroResolvedColors;
12
12
  export declare const DEFAULT_CONTENT_WIDTH_CLASS = "w-2/5";
13
- export declare const DEFAULT_HEIGHT_CLASS = "h-[400px]";
13
+ export declare const DEFAULT_HEIGHT_CSS = "400px";
14
14
  export declare const FONT_FAMILY_MAP: {
15
15
  readonly geist: "\"Geist\", -apple-system, BlinkMacSystemFont, sans-serif";
16
16
  readonly georgia: "\"Georgia\", \"Times New Roman\", serif";
@@ -8,7 +8,25 @@ export const DEFAULT_COLORS = {
8
8
  background: "#000000",
9
9
  };
10
10
  export const DEFAULT_CONTENT_WIDTH_CLASS = "w-2/5";
11
- export const DEFAULT_HEIGHT_CLASS = "h-[400px]";
11
+ export const DEFAULT_HEIGHT_CSS = "400px";
12
+ /**
13
+ * Converts a Tailwind height class (e.g. "h-[400px]", "h-screen") to a CSS
14
+ * value string so it can be applied via inline style. This avoids Tailwind's
15
+ * static-scan limitation where dynamic class names from the database are never
16
+ * included in the generated CSS bundle.
17
+ */
18
+ function parseTailwindHeight(cls) {
19
+ const match = cls.match(/^h-\[(.+)\]$/);
20
+ if (match)
21
+ return match[1];
22
+ const map = {
23
+ "h-screen": "100vh",
24
+ "h-full": "100%",
25
+ "h-auto": "auto",
26
+ "h-fit": "fit-content",
27
+ };
28
+ return map[cls] ?? DEFAULT_HEIGHT_CSS;
29
+ }
12
30
  export const FONT_FAMILY_MAP = {
13
31
  geist: '"Geist", -apple-system, BlinkMacSystemFont, sans-serif',
14
32
  georgia: '"Georgia", "Times New Roman", serif',
@@ -67,9 +85,9 @@ export function resolveHeight(content) {
67
85
  const layout = content?.styling?.tokens?.layout ?? {};
68
86
  const rawHeight = layout.height;
69
87
  if (typeof rawHeight === "string" && rawHeight.trim().length > 0) {
70
- return rawHeight.trim();
88
+ return parseTailwindHeight(rawHeight.trim());
71
89
  }
72
- return DEFAULT_HEIGHT_CLASS;
90
+ return DEFAULT_HEIGHT_CSS;
73
91
  }
74
92
  const DEFAULT_BUTTON_SPACING = "mt-4";
75
93
  export function resolveButtonSpacing(content) {
@@ -127,16 +145,18 @@ export function renderText({ fontSize, lineHeight, text, className, color, font,
127
145
  if (!text || text.trim().length === 0) {
128
146
  return null;
129
147
  }
130
- const baseClasses = "drop-shadow-lg";
148
+ const baseClasses = "drop-shadow-lg max-w-full";
131
149
  const combinedClasses = className
132
150
  ? `${baseClasses} ${fontSize} ${lineHeight} ${className}`
133
151
  : `${baseClasses} ${fontSize} ${lineHeight}`;
152
+ //   from rich text editors prevents word wrapping; replace with regular spaces.
153
+ const displayHtml = text.replace(/ /g, "\u0020");
134
154
  return React.createElement("div", {
135
155
  className: combinedClasses,
136
156
  style: {
137
157
  color,
138
158
  fontFamily: FONT_FAMILY_MAP[font] ?? FONT_FAMILY_MAP.geist,
139
159
  },
140
- dangerouslySetInnerHTML: { __html: text },
160
+ dangerouslySetInnerHTML: { __html: displayHtml },
141
161
  });
142
162
  }
package/docs/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ### [Unreleased]
9
9
 
10
+ ### [2.4.4] - 2026-04-14
11
+
12
+ #### Fixed
13
+
14
+ - **Hero height ignored for non-default values**: `resolveHeight` now converts stored Tailwind height classes (e.g. `h-[500px]`) to CSS values and applies them via inline `style`. Arbitrary-value classes from the database are never included in Tailwind's generated CSS bundle at build time, so any height other than the 400 px default was silently ignored (`hero-resolvers.ts`, `DesktopHero.tsx`).
15
+ - **Hero text breaking mid-word**: `renderText` now replaces ` ` entities with regular spaces before rendering so words wrap naturally at boundaries. Removed `break-words` which was masking the underlying cause rather than fixing it (`hero-resolvers.ts`).
16
+
17
+ ### [2.4.3] - 2026-04-14
18
+
19
+ #### Fixed
20
+
21
+ - **Desktop hero content alignment**: `DesktopHero` content column now uses `items-start` so child elements (button, countdown) no longer stretch to full column width.
22
+
23
+ ### [2.4.2] - 2026-04-14
24
+
25
+ #### Fixed
26
+
27
+ - **Hero banner text overflow**: Title and description in `DesktopHero` are now clamped to 3 lines with ellipsis (`line-clamp-3`) to prevent layout overflow at narrower viewport widths.
28
+
10
29
  ### [2.4.1] - 2026-04-10
11
30
 
12
31
  #### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fragment-headless-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.4",
4
4
  "description": "Official SDK for Fragment-Shopify CMS: React components, TypeScript types, and utilities for headless Shopify storefronts.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",