react-email 6.3.0 → 6.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # react-email
2
2
 
3
+ ## 6.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c610dc0: fix: padding in Container/Section failing on Klaviyo and Outlook desktop
8
+
3
9
  ## 6.3.0
4
10
 
5
11
  ## 6.2.0
@@ -6523,7 +6523,7 @@ const getEmailsDirectoryMetadata = async (absolutePathToEmailsDirectory, keepFil
6523
6523
  //#region package.json
6524
6524
  var package_default = {
6525
6525
  name: "react-email",
6526
- version: "6.3.0",
6526
+ version: "6.3.1",
6527
6527
  description: "A live preview of your emails right in your browser.",
6528
6528
  bin: { "email": "./dist/cli/index.mjs" },
6529
6529
  type: "module",
package/dist/index.cjs CHANGED
@@ -17461,7 +17461,16 @@ const Column = react.forwardRef(({ children, style, ...props }, ref) => {
17461
17461
  Column.displayName = "Column";
17462
17462
  //#endregion
17463
17463
  //#region src/components/container/container.tsx
17464
- const Container = react.forwardRef(({ children, style, ...props }, ref) => {
17464
+ const Container = react.forwardRef(({ children, style = {}, ...props }, ref) => {
17465
+ const tdStyle = {};
17466
+ const tableStyle = {};
17467
+ const styleRecord = style;
17468
+ for (const key in styleRecord) {
17469
+ if (!Object.hasOwn(styleRecord, key)) continue;
17470
+ const value = styleRecord[key];
17471
+ if (key === "padding" || key === "paddingTop" || key === "paddingRight" || key === "paddingBottom" || key === "paddingLeft") tdStyle[key] = value;
17472
+ else tableStyle[key] = value;
17473
+ }
17465
17474
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
17466
17475
  align: "center",
17467
17476
  width: "100%",
@@ -17473,11 +17482,14 @@ const Container = react.forwardRef(({ children, style, ...props }, ref) => {
17473
17482
  role: "presentation",
17474
17483
  style: {
17475
17484
  maxWidth: "37.5em",
17476
- ...style
17485
+ ...tableStyle
17477
17486
  },
17478
17487
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
17479
17488
  style: { width: "100%" },
17480
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children })
17489
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
17490
+ style: tdStyle,
17491
+ children
17492
+ })
17481
17493
  }) })
17482
17494
  });
17483
17495
  });
@@ -17911,7 +17923,16 @@ const Row = react.forwardRef(({ children, style, ...props }, ref) => {
17911
17923
  Row.displayName = "Row";
17912
17924
  //#endregion
17913
17925
  //#region src/components/section/section.tsx
17914
- const Section = react.forwardRef(({ children, style, ...props }, ref) => {
17926
+ const Section = react.forwardRef(({ children, style = {}, ...props }, ref) => {
17927
+ const tdStyle = {};
17928
+ const tableStyle = {};
17929
+ const styleRecord = style;
17930
+ for (const key in styleRecord) {
17931
+ if (!Object.hasOwn(styleRecord, key)) continue;
17932
+ const value = styleRecord[key];
17933
+ if (key === "padding" || key === "paddingTop" || key === "paddingRight" || key === "paddingBottom" || key === "paddingLeft") tdStyle[key] = value;
17934
+ else tableStyle[key] = value;
17935
+ }
17915
17936
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
17916
17937
  align: "center",
17917
17938
  width: "100%",
@@ -17921,8 +17942,11 @@ const Section = react.forwardRef(({ children, style, ...props }, ref) => {
17921
17942
  role: "presentation",
17922
17943
  ...props,
17923
17944
  ref,
17924
- style,
17925
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children }) }) })
17945
+ style: tableStyle,
17946
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
17947
+ style: tdStyle,
17948
+ children
17949
+ }) }) })
17926
17950
  });
17927
17951
  });
17928
17952
  Section.displayName = "Section";
package/dist/index.mjs CHANGED
@@ -17440,7 +17440,16 @@ const Column = React$1.forwardRef(({ children, style, ...props }, ref) => {
17440
17440
  Column.displayName = "Column";
17441
17441
  //#endregion
17442
17442
  //#region src/components/container/container.tsx
17443
- const Container = React$1.forwardRef(({ children, style, ...props }, ref) => {
17443
+ const Container = React$1.forwardRef(({ children, style = {}, ...props }, ref) => {
17444
+ const tdStyle = {};
17445
+ const tableStyle = {};
17446
+ const styleRecord = style;
17447
+ for (const key in styleRecord) {
17448
+ if (!Object.hasOwn(styleRecord, key)) continue;
17449
+ const value = styleRecord[key];
17450
+ if (key === "padding" || key === "paddingTop" || key === "paddingRight" || key === "paddingBottom" || key === "paddingLeft") tdStyle[key] = value;
17451
+ else tableStyle[key] = value;
17452
+ }
17444
17453
  return /* @__PURE__ */ jsx("table", {
17445
17454
  align: "center",
17446
17455
  width: "100%",
@@ -17452,11 +17461,14 @@ const Container = React$1.forwardRef(({ children, style, ...props }, ref) => {
17452
17461
  role: "presentation",
17453
17462
  style: {
17454
17463
  maxWidth: "37.5em",
17455
- ...style
17464
+ ...tableStyle
17456
17465
  },
17457
17466
  children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", {
17458
17467
  style: { width: "100%" },
17459
- children: /* @__PURE__ */ jsx("td", { children })
17468
+ children: /* @__PURE__ */ jsx("td", {
17469
+ style: tdStyle,
17470
+ children
17471
+ })
17460
17472
  }) })
17461
17473
  });
17462
17474
  });
@@ -17890,7 +17902,16 @@ const Row = React$1.forwardRef(({ children, style, ...props }, ref) => {
17890
17902
  Row.displayName = "Row";
17891
17903
  //#endregion
17892
17904
  //#region src/components/section/section.tsx
17893
- const Section = React$1.forwardRef(({ children, style, ...props }, ref) => {
17905
+ const Section = React$1.forwardRef(({ children, style = {}, ...props }, ref) => {
17906
+ const tdStyle = {};
17907
+ const tableStyle = {};
17908
+ const styleRecord = style;
17909
+ for (const key in styleRecord) {
17910
+ if (!Object.hasOwn(styleRecord, key)) continue;
17911
+ const value = styleRecord[key];
17912
+ if (key === "padding" || key === "paddingTop" || key === "paddingRight" || key === "paddingBottom" || key === "paddingLeft") tdStyle[key] = value;
17913
+ else tableStyle[key] = value;
17914
+ }
17894
17915
  return /* @__PURE__ */ jsx("table", {
17895
17916
  align: "center",
17896
17917
  width: "100%",
@@ -17900,8 +17921,11 @@ const Section = React$1.forwardRef(({ children, style, ...props }, ref) => {
17900
17921
  role: "presentation",
17901
17922
  ...props,
17902
17923
  ref,
17903
- style,
17904
- children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { children }) }) })
17924
+ style: tableStyle,
17925
+ children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
17926
+ style: tdStyle,
17927
+ children
17928
+ }) }) })
17905
17929
  });
17906
17930
  });
17907
17931
  Section.displayName = "Section";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./dist/cli/index.mjs"
@@ -3,7 +3,35 @@ import * as React from 'react';
3
3
  export type ContainerProps = Readonly<React.ComponentPropsWithoutRef<'table'>>;
4
4
 
5
5
  export const Container = React.forwardRef<HTMLTableElement, ContainerProps>(
6
- ({ children, style, ...props }, ref) => {
6
+ ({ children, style = {}, ...props }, ref) => {
7
+ // Split padding styles to improve compatibility with Klaviyo and Outlook,
8
+ // while preserving user-provided style property order without allocating
9
+ // entry arrays on each render.
10
+ const tdStyle: React.CSSProperties = {};
11
+ const tableStyle: React.CSSProperties = {};
12
+
13
+ const styleRecord = style as Record<string, unknown>;
14
+
15
+ for (const key in styleRecord) {
16
+ if (!Object.hasOwn(styleRecord, key)) {
17
+ continue;
18
+ }
19
+
20
+ const value = styleRecord[key];
21
+
22
+ if (
23
+ key === 'padding' ||
24
+ key === 'paddingTop' ||
25
+ key === 'paddingRight' ||
26
+ key === 'paddingBottom' ||
27
+ key === 'paddingLeft'
28
+ ) {
29
+ (tdStyle as Record<string, unknown>)[key] = value;
30
+ } else {
31
+ (tableStyle as Record<string, unknown>)[key] = value;
32
+ }
33
+ }
34
+
7
35
  return (
8
36
  <table
9
37
  align="center"
@@ -14,11 +42,11 @@ export const Container = React.forwardRef<HTMLTableElement, ContainerProps>(
14
42
  cellSpacing="0"
15
43
  ref={ref}
16
44
  role="presentation"
17
- style={{ maxWidth: '37.5em', ...style }}
45
+ style={{ maxWidth: '37.5em', ...tableStyle }}
18
46
  >
19
47
  <tbody>
20
48
  <tr style={{ width: '100%' }}>
21
- <td>{children}</td>
49
+ <td style={tdStyle}>{children}</td>
22
50
  </tr>
23
51
  </tbody>
24
52
  </table>
@@ -3,7 +3,35 @@ import * as React from 'react';
3
3
  export type SectionProps = Readonly<React.ComponentPropsWithoutRef<'table'>>;
4
4
 
5
5
  export const Section = React.forwardRef<HTMLTableElement, SectionProps>(
6
- ({ children, style, ...props }, ref) => {
6
+ ({ children, style = {}, ...props }, ref) => {
7
+ // Split padding styles to improve compatibility with Klaviyo and Outlook,
8
+ // while preserving user-provided style property order without allocating
9
+ // entry arrays on each render.
10
+ const tdStyle: React.CSSProperties = {};
11
+ const tableStyle: React.CSSProperties = {};
12
+
13
+ const styleRecord = style as Record<string, unknown>;
14
+
15
+ for (const key in styleRecord) {
16
+ if (!Object.hasOwn(styleRecord, key)) {
17
+ continue;
18
+ }
19
+
20
+ const value = styleRecord[key];
21
+
22
+ if (
23
+ key === 'padding' ||
24
+ key === 'paddingTop' ||
25
+ key === 'paddingRight' ||
26
+ key === 'paddingBottom' ||
27
+ key === 'paddingLeft'
28
+ ) {
29
+ (tdStyle as Record<string, unknown>)[key] = value;
30
+ } else {
31
+ (tableStyle as Record<string, unknown>)[key] = value;
32
+ }
33
+ }
34
+
7
35
  return (
8
36
  <table
9
37
  align="center"
@@ -14,11 +42,11 @@ export const Section = React.forwardRef<HTMLTableElement, SectionProps>(
14
42
  role="presentation"
15
43
  {...props}
16
44
  ref={ref}
17
- style={style}
45
+ style={tableStyle}
18
46
  >
19
47
  <tbody>
20
48
  <tr>
21
- <td>{children}</td>
49
+ <td style={tdStyle}>{children}</td>
22
50
  </tr>
23
51
  </tbody>
24
52
  </table>