@pagenflow/email 1.3.1 → 1.3.3

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.
@@ -1,5 +1,11 @@
1
1
  import { ReactNode } from "react";
2
2
  import { AlignItems, BorderConfig, JustifyContent } from "../types";
3
+ export interface BackgroundImageType {
4
+ src: string;
5
+ repeat?: "no-repeat" | "repeat" | "repeat-x" | "repeat-y";
6
+ size?: "auto" | "cover" | "contain";
7
+ position?: string;
8
+ }
3
9
  export interface RowConfig {
4
10
  gap?: string;
5
11
  justifyContent?: JustifyContent;
@@ -8,8 +14,13 @@ export interface RowConfig {
8
14
  height?: string;
9
15
  padding?: string;
10
16
  backgroundColor?: string;
17
+ backgroundImage?: BackgroundImageType;
11
18
  borderRadius?: string;
12
19
  border?: BorderConfig;
20
+ mobile?: {
21
+ justifyContent?: JustifyContent;
22
+ alignItems?: AlignItems;
23
+ };
13
24
  }
14
25
  export type RowProps = {
15
26
  children: ReactNode;
package/dist/index.cjs.js CHANGED
@@ -1956,6 +1956,35 @@ function Head({ children, backgroundColor = "#ffffff", title = "Email Preview",
1956
1956
  mso-line-height-rule: exactly;
1957
1957
  }
1958
1958
  }
1959
+
1960
+ @media only screen and (max-width: 600px) {
1961
+ /* 1. Handling Mobile Alignment (Justify) */
1962
+ /* We target the inner table alignment */
1963
+ .responsive-row[data-mobile-justify="center"] .content-table {
1964
+ margin: 0 auto !important;
1965
+ float: none !important;
1966
+ }
1967
+ .responsive-row[data-mobile-justify="start"] .content-table {
1968
+ margin: 0 !important;
1969
+ float: left !important;
1970
+ }
1971
+ .responsive-row[data-mobile-justify="end"] .content-table {
1972
+ margin: 0 0 0 auto !important;
1973
+ float: right !important;
1974
+ }
1975
+
1976
+ /* 2. Handling Mobile Vertical Alignment (Align Items) */
1977
+ /* We target the child cells if they are still side-by-side */
1978
+ .responsive-row[data-mobile-align="center"] .child-cell {
1979
+ vertical-align: middle !important;
1980
+ }
1981
+ .responsive-row[data-mobile-align="start"] .child-cell {
1982
+ vertical-align: top !important;
1983
+ }
1984
+ .responsive-row[data-mobile-align="end"] .child-cell {
1985
+ vertical-align: bottom !important;
1986
+ }
1987
+ }
1959
1988
 
1960
1989
  /* ================================================= */
1961
1990
  /* 🔒 UNIVERSAL LINK RESET */
@@ -2184,10 +2213,15 @@ function getBorderStyle$1(border) {
2184
2213
  return style;
2185
2214
  }
2186
2215
  function Row({ children, config, devNode }) {
2216
+ var _a, _b, _c, _d, _e;
2187
2217
  const childrenArray = (Array.isArray(children) ? children : [children]).filter((child) => child != null);
2188
2218
  const numChildren = childrenArray.length;
2189
2219
  // 1. Outer TD for Background and Border Radius (no border here)
2190
- const backgroundTdStyle = Object.assign({ backgroundColor: config.backgroundColor, borderRadius: config.borderRadius, width: config.width || "100%", height: config.height }, (config.borderRadius && { overflow: "hidden" }));
2220
+ const backgroundTdStyle = Object.assign({ backgroundColor: config.backgroundColor, borderRadius: config.borderRadius, width: config.width || "100%", height: config.height,
2221
+ // Background Image styles
2222
+ backgroundImage: config.backgroundImage
2223
+ ? `url(${config.backgroundImage.src})`
2224
+ : undefined, backgroundRepeat: (_a = config.backgroundImage) === null || _a === void 0 ? void 0 : _a.repeat, backgroundSize: (_b = config.backgroundImage) === null || _b === void 0 ? void 0 : _b.size, backgroundPosition: (_c = config.backgroundImage) === null || _c === void 0 ? void 0 : _c.position }, (config.borderRadius && { overflow: "hidden" }));
2191
2225
  // 2. Inner Table for Border and Border Radius
2192
2226
  const borderTableStyle = Object.assign({ width: "100%", height: "100%", borderCollapse: "separate", borderSpacing: 0, borderRadius: config.borderRadius }, getBorderStyle$1(config.border));
2193
2227
  // 3. TD for Padding
@@ -2220,16 +2254,16 @@ function Row({ children, config, devNode }) {
2220
2254
  width: config.width || "100%",
2221
2255
  height: config.height,
2222
2256
  borderCollapse: "collapse",
2223
- } }, (config.height && { height: config.height }), { children: [jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", Object.assign({ style: backgroundTdStyle }, (config.height && { height: config.height }), { children: jsxRuntime.jsx("table", { "aria-label": "Row Border Wrapper", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: borderTableStyle, children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { style: paddingTdStyle, children: jsxRuntime.jsx("table", { "aria-label": "Row Justification Wrapper", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: {
2257
+ } }, (config.height && { height: config.height }), { "data-mobile-justify": (_d = config.mobile) === null || _d === void 0 ? void 0 : _d.justifyContent, "data-mobile-align": (_e = config.mobile) === null || _e === void 0 ? void 0 : _e.alignItems, className: "responsive-row", children: [jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", Object.assign({ style: backgroundTdStyle }, (config.height && { height: config.height }), { children: jsxRuntime.jsx("table", { "aria-label": "Row Border Wrapper", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: borderTableStyle, children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { style: paddingTdStyle, children: jsxRuntime.jsx("table", { "aria-label": "Row Justification Wrapper", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: {
2224
2258
  width: "100%",
2225
2259
  height: "100%",
2226
2260
  borderCollapse: "collapse",
2227
- }, children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { align: tdAlign, children: jsxRuntime.jsx("table", Object.assign({ "aria-label": "Row Content", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: contentTableStyle }, (config.height && { height: config.height }), { children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: childrenArray.map((child, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("td", { valign: tdValign, style: {
2261
+ }, children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { align: tdAlign, children: jsxRuntime.jsx("table", Object.assign({ "aria-label": "Row Content", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, style: contentTableStyle }, (config.height && { height: config.height }), { className: "content-table", children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { className: "content-tr", children: childrenArray.map((child, index) => (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("td", { valign: tdValign, style: {
2228
2262
  verticalAlign: tdValign,
2229
2263
  textAlign: "left",
2230
2264
  padding: "0",
2231
2265
  margin: "0",
2232
- }, children: child }), index < numChildren - 1 &&
2266
+ }, className: "child-cell", children: child }), index < numChildren - 1 &&
2233
2267
  config.gap && (jsxRuntime.jsx("td", { width: config.gap, style: gapTdStyle, children: "\u00A0" }, `row-gap-${index}`))] }, `row-child-${index}`))) }) }) })) }) }) }) }) }) }) }) }) })) }) }), devNode && (jsxRuntime.jsx("tfoot", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { children: devNode }) }) }))] })));
2234
2268
  }
2235
2269
  var Row_default = React.memo(Row, arePropsEqual);