Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add direct support for React 19 #1474

Merged
merged 57 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
49dd6aa
chore: Add forward ref to all relevant components (#1294)
gabrielmfern Jun 25, 2024
84d4c8e
bump all react dependencies to beta
gabrielmfern May 20, 2024
1481dbb
fix types for react-email
gabrielmfern May 20, 2024
a680ea3
update lock file
gabrielmfern May 20, 2024
eb5020a
add missing node modules for react-email's preview server VM
gabrielmfern May 20, 2024
9cb2b9d
add a fallback for the source of the consumed source map
gabrielmfern May 20, 2024
6213438
force installation when building the preview server
gabrielmfern May 20, 2024
1efad95
remove all of our forward refs to using just the `ref` prop :)
gabrielmfern May 20, 2024
7e43bb5
upgrade into React 19 RC
gabrielmfern Jun 4, 2024
4bd5c15
remove unused testing library from tailwind
gabrielmfern Jun 4, 2024
2a987b4
update lock
gabrielmfern Jun 4, 2024
2d8bf9b
update react types
gabrielmfern Jun 4, 2024
50b362c
override react types and update them on other packages
gabrielmfern Jun 4, 2024
02d7b7e
fix override being misconfigured
gabrielmfern Jun 6, 2024
d7ac3cf
manually fix issue with resolution of @types/react on types-react-dom
gabrielmfern Jun 6, 2024
52961d7
update lockfile
gabrielmfern Jun 6, 2024
d785793
fix some tailwind type issues
gabrielmfern Jun 6, 2024
9590dcc
use the React.createElement from the user's React
gabrielmfern Jun 6, 2024
ec4e59a
fix linting issue
gabrielmfern Jun 7, 2024
e7bcc95
pin react types version
gabrielmfern Jun 7, 2024
52bcd1c
format
gabrielmfern Jun 7, 2024
e37f7b7
undo pin react types version
gabrielmfern Jun 7, 2024
d9ec6ea
accept as pinned version that have specifiers npm:*
gabrielmfern Jun 7, 2024
c4d15ff
remove global override for types
gabrielmfern Jun 7, 2024
e48f349
remove unecessary override in render
gabrielmfern Jun 7, 2024
bd12316
manually fix types dependency for types-react-dom
gabrielmfern Jun 7, 2024
baf02e9
add the overrides for React deps[
gabrielmfern Jun 14, 2024
6590851
upgrade the preview server to use React 19 as well
gabrielmfern Jun 14, 2024
0014572
upgrade the landing page web app to use React 19
gabrielmfern Jun 14, 2024
2e4aa3d
update lock
gabrielmfern Jun 14, 2024
af608cc
format
gabrielmfern Jun 14, 2024
ec77f48
update html testing snapshot
gabrielmfern Jun 14, 2024
f75c5fd
allow both ^18.0 and ^19.0 for React
gabrielmfern Jun 25, 2024
650b2da
use latest alpha for framer motion
gabrielmfern Jun 25, 2024
296b2ff
update lock
gabrielmfern Jun 25, 2024
4ada39b
update react-slot on our landing page
gabrielmfern Jun 25, 2024
d75ef7b
update lock
gabrielmfern Jun 25, 2024
ddd7539
format
gabrielmfern Jun 25, 2024
5a8ca8c
update snapshots with React 19 preloading links
gabrielmfern Jun 25, 2024
ba4a113
remove trace events from imported Node modules
gabrielmfern Jun 25, 2024
b2ebbbe
update other snapshots
gabrielmfern Jun 25, 2024
9c3450f
allow for any React 19 release candidate
gabrielmfern Jun 26, 2024
6910f3e
use React 18 for the preview server temporarily
gabrielmfern Jun 26, 2024
d509d04
Revert "remove all of our forward refs to using just the `ref` prop :)"
gabrielmfern Jun 26, 2024
d2531b7
update lock
gabrielmfern Jun 26, 2024
adcf6bb
remove override for react and react-dom
gabrielmfern Jun 26, 2024
4b50fb8
fix resolved version for React/react-dom on all components
gabrielmfern Jun 26, 2024
d2070da
update framer motion to support React 19 types
gabrielmfern Jun 26, 2024
53c482e
set the email export test as failing
gabrielmfern Jun 26, 2024
2ea54bf
fix tests failing for the CLI
gabrielmfern Jun 26, 2024
298f9eb
format
gabrielmfern Jun 26, 2024
9f3dd97
update snapshots
gabrielmfern Jul 15, 2024
72e3d97
fix rebase artifact
gabrielmfern Jul 15, 2024
71936e4
add changeset
gabrielmfern Jul 15, 2024
a3331fd
update testing snapshot for tailwind
gabrielmfern Jul 15, 2024
f11b066
update snapshots for cli
gabrielmfern Jul 15, 2024
7f3040f
update lock
gabrielmfern Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/fast-countries-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"create-email": patch
"@react-email/code-inline": patch
"react-email": patch
"@react-email/code-block": patch
"@react-email/components": patch
"@react-email/container": patch
"@react-email/markdown": patch
"@react-email/tailwind": patch
"@react-email/heading": patch
"@react-email/preview": patch
"@react-email/section": patch
"@react-email/button": patch
"@react-email/column": patch
"@react-email/render": patch
"@react-email/body": patch
"@react-email/font": patch
"@react-email/head": patch
"@react-email/html": patch
"@react-email/link": patch
"@react-email/text": patch
"@react-email/img": patch
"@react-email/row": patch
"@react-email/hr": patch
---

Updated peer dependencies to allow for React 19 release candidated and React 19 itself
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ jobs:
if (version.startsWith("workspace:")) {
return true;
}
if (version.startsWith("npm:")) {
return true;
}
return /^\d+\.\d+\.\d+$|^[a-z]+:[a-z]+@\d+$/.test(version);
}

Expand Down
10 changes: 5 additions & 5 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"@react-email/components": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.0.0-rc.0",
"react-dom": "19.0.0-rc.0",
"react-email": "workspace:*"
},
"devDependencies": {
"next": "14.1.4",
"@types/react": "18.2.47",
"@types/react-dom": "18.2.18",
"next": "14.2.3",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"tsx": "4.9.0"
}
}
8 changes: 4 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"dependencies": {
"@radix-ui/colors": "1.0.1",
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-slot": "1.1.0",
"@sindresorhus/is": "6.1.0",
"@supabase/supabase-js": "2.39.3",
"@vercel/analytics": "1.0.1",
"classnames": "2.3.2",
"next": "14.2.3",
"next": "15.0.0-canary.27",
"prism-react-renderer": "2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.0.0-rc.0",
"react-dom": "19.0.0-rc.0",
"resend": "3.2.0"
},
"devDependencies": {
Expand Down
48 changes: 20 additions & 28 deletions apps/web/src/components/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,27 @@ interface HeadingOwnProps {

type HeadingProps = As<"h1", "h2", "h3", "h4", "h5", "h6"> & HeadingOwnProps;

export const Heading = React.forwardRef<
HTMLHeadingElement,
Readonly<HeadingProps>
>(
(
{
as: Tag = "h1",
size = "3",
export const Heading = ({
as: Tag = "h1",
size = "3",
className,
color = "white",
children,
weight = "bold",
...props
}: HeadingProps) => (
<SlotPrimitive.Slot
className={classnames(
className,
color = "white",
children,
weight = "bold",
...props
},
forwardedRef,
) => (
<SlotPrimitive.Slot
className={classnames(
className,
getSizesClassNames(size),
getColorClassNames(color),
getWeightClassNames(weight),
)}
ref={forwardedRef}
{...props}
>
<Tag>{children}</Tag>
</SlotPrimitive.Slot>
),
getSizesClassNames(size),
getColorClassNames(color),
getWeightClassNames(weight),
)}
{...props}
ref={props.ref as React.Ref<HTMLElement>}
>
<Tag>{children}</Tag>
</SlotPrimitive.Slot>
);

const getSizesClassNames = (size: HeadingSize | undefined) => {
Expand Down
49 changes: 22 additions & 27 deletions apps/web/src/components/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,29 @@ interface TextOwnProps {

type TextProps = As<"span", "div", "p"> & TextOwnProps;

export const Text = React.forwardRef<HTMLSpanElement, Readonly<TextProps>>(
(
{
as: Tag = "span",
size = "2",
color = "gray",
transform,
weight = "normal",
export const Text = ({
as: Tag = "span",
size = "2",
color = "gray",
transform,
weight = "normal",
className,
children,
...props
}: TextProps) => (
<SlotPrimitive.Slot
className={classnames(
className,
children,
...props
},
forwardedRef,
) => (
<SlotPrimitive.Slot
className={classnames(
className,
transform,
getSizesClassNames(size),
getColorClassNames(color),
getWeightClassNames(weight),
)}
ref={forwardedRef}
{...props}
>
<Tag>{children}</Tag>
</SlotPrimitive.Slot>
),
transform,
getSizesClassNames(size),
getColorClassNames(color),
getWeightClassNames(weight),
)}
{...props}
ref={props.ref as React.Ref<HTMLElement>}
>
<Tag>{children}</Tag>
</SlotPrimitive.Slot>
);

const getSizesClassNames = (size: TextSize | undefined) => {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/tailwind-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@react-email/components": "workspace:*",
"@react-email/render": "workspace:*",
"@react-email/tailwind": "workspace:*",
"react": "^18.2.0",
"react": "19.0.0-rc.0",
"tailwind-0.0.12": "npm:@react-email/tailwind@0.0.12",
"tailwind-0.0.15": "npm:@react-email/tailwind@0.0.15",
"tinybench": "2.5.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-ses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@aws-sdk/client-ses": "3.341.0",
"@react-email/components": "*",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/mailersend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@react-email/components": "*",
"mailersend": "^2.0.0",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/nodemailer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@react-email/components": "*",
"nodemailer": "6.9.9",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/plunk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@plunk/node": "1.1.1",
"@react-email/components": "*",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/postmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@react-email/components": "*",
"postmark": "3.0.14",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
8 changes: 4 additions & 4 deletions examples/resend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
},
"dependencies": {
"next": "13.5.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.0.0-rc.0",
"react-dom": "19.0.0-rc.0",
"resend": "^3.2.0"
},
"devDependencies": {
"@types/node": "^20.2.5",
"@types/react": "18.2.23",
"@types/react-dom": "18.2.8",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"typescript": "^5.1.3"
}
}
8 changes: 4 additions & 4 deletions examples/scaleway/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"@react-email/render": "*",
"@scaleway/sdk": "1.5.0",
"next": "13.5.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "19.0.0-rc.0",
"react-dom": "19.0.0-rc.0"
},
"devDependencies": {
"@types/node": "18.14.6",
"@types/react": "18.2.23",
"@types/react-dom": "18.2.8",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"typescript": "4.9.5"
}
}
2 changes: 1 addition & 1 deletion examples/scaleway/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@scaleway/sdk": "1.4.0",
"@react-email/components": "*",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/sendgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@sendgrid/mail": "7.7.0",
"@react-email/components": "*",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"tsup": "6.2.3",
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"devDependencies": {
"@changesets/cli": "2.27.1",
"@types/node": "18.18.0",
"@types/react": "18.2.47",
"@types/react-dom": "18.2.14",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"eslint": "8.50.0",
"happy-dom": "12.2.2",
"prettier": "3.0.3",
Expand All @@ -29,6 +29,10 @@
},
"packageManager": "pnpm@9.1.2",
"pnpm": {
"overrides": {
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
},
"patchedDependencies": {
"postcss-css-variables@0.19.0": "patches/postcss-css-variables@0.19.0.patch",
"process@0.11.10": "patches/process@0.11.10.patch",
Expand Down
2 changes: 1 addition & 1 deletion packages/body/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"test": "vitest run"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/core": "7.23.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/code-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/code-inline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"access": "public"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/column/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@react-email/text": "workspace:0.0.9"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
},
"devDependencies": {
"@babel/preset-react": "7.23.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-email/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"dependencies": {
"@react-email/components": "workspace:0.0.22",
"react-email": "workspace:2.1.6",
"react": "^18.2.0"
"react": "19.0.0-rc.0"
},
"devDependencies": {
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14"
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc"
}
}
Loading
Loading