@react-email/section 0.0.3 → 0.0.6

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/index.js CHANGED
@@ -44,6 +44,13 @@ var Section = React.forwardRef(
44
44
  gridAutoColumns: "minmax(0, 1fr)",
45
45
  gridAutoFlow: "column"
46
46
  };
47
+ const arrayChildren = React.Children.toArray(children);
48
+ const hasTdElement = (child) => {
49
+ return React.isValidElement(child) && (child.type === "td" || child.type.displayName === "Column");
50
+ };
51
+ const finalChildren = arrayChildren.map((child, index) => {
52
+ return hasTdElement(child) ? child : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: child }, index);
53
+ });
47
54
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
55
  "table",
49
56
  {
@@ -55,7 +62,7 @@ var Section = React.forwardRef(
55
62
  cellSpacing: 0,
56
63
  role: "presentation",
57
64
  ...props,
58
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: styleDefaultTr, children }) })
65
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: styleDefaultTr, children: finalChildren }) })
59
66
  }
60
67
  );
61
68
  }
package/dist/index.mjs CHANGED
@@ -12,6 +12,13 @@ var Section = React.forwardRef(
12
12
  gridAutoColumns: "minmax(0, 1fr)",
13
13
  gridAutoFlow: "column"
14
14
  };
15
+ const arrayChildren = React.Children.toArray(children);
16
+ const hasTdElement = (child) => {
17
+ return React.isValidElement(child) && (child.type === "td" || child.type.displayName === "Column");
18
+ };
19
+ const finalChildren = arrayChildren.map((child, index) => {
20
+ return hasTdElement(child) ? child : /* @__PURE__ */ jsx("td", { children: child }, index);
21
+ });
15
22
  return /* @__PURE__ */ jsx(
16
23
  "table",
17
24
  {
@@ -23,7 +30,7 @@ var Section = React.forwardRef(
23
30
  cellSpacing: 0,
24
31
  role: "presentation",
25
32
  ...props,
26
- children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { style: styleDefaultTr, children }) })
33
+ children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { style: styleDefaultTr, children: finalChildren }) })
27
34
  }
28
35
  );
29
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-email/section",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "Display a section that can be formatted using columns",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://github.com/zenorocha/react-email.git",
25
+ "url": "https://github.com/resendlabs/react-email.git",
26
26
  "directory": "packages/section"
27
27
  },
28
28
  "keywords": [
@@ -30,7 +30,7 @@
30
30
  "email"
31
31
  ],
32
32
  "engines": {
33
- "node": ">=18.0.0"
33
+ "node": ">=16.0.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "react": "18.2.0"
@@ -52,4 +52,4 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  }
55
- }
55
+ }
package/readme.md CHANGED
@@ -6,7 +6,7 @@
6
6
  <div align="center">
7
7
  <a href="https://react.email">Website</a>
8
8
  <span> · </span>
9
- <a href="https://github.com/zenorocha/react-email">GitHub</a>
9
+ <a href="https://github.com/resendlabs/react-email">GitHub</a>
10
10
  <span> · </span>
11
11
  <a href="https://react.email/discord">Discord</a>
12
12
  </div>
@@ -33,10 +33,13 @@ Add the component to your email template. Include styles where needed.
33
33
 
34
34
  ```jsx
35
35
  import { Section } from '@react-email/section';
36
+ import { Text } from '@react-email/text';
36
37
 
37
38
  const Section = () => {
38
39
  return (
39
- <Section>{/* Any column. */}<Section />
40
+ <Section>
41
+ <Text>Hello World</Text>
42
+ <Section />
40
43
  );
41
44
  };
42
45
  ```