Skip to content

Commit 6e37f9d

Browse files
authored
feat!: Upgrade to React 19 (#1999)
1 parent be8ca51 commit 6e37f9d

72 files changed

Lines changed: 956 additions & 895 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/floppy-icons-retire.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@rocket.chat/storybook-dark-mode': minor
3+
'@rocket.chat/fuselage-toastbar': minor
4+
'@rocket.chat/fuselage-forms': minor
5+
'@rocket.chat/fuselage-hooks': minor
6+
'@rocket.chat/onboarding-ui': minor
7+
'@rocket.chat/fuselage': minor
8+
'@rocket.chat/layout': minor
9+
'@rocket.chat/styled': minor
10+
'@rocket.chat/logo': minor
11+
---
12+
13+
feat!: Upgrade to React 19
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/types.d.ts b/types.d.ts
2+
index 498bb694de2e6a62f14d3fe998dc538aff920fc6..76e4b5500ec30b814d00d28a8f878ca4d2c153a5 100644
3+
--- a/types.d.ts
4+
+++ b/types.d.ts
5+
@@ -1,8 +1,7 @@
6+
// Internal helper types
7+
8+
-/**
9+
- * This is the global JSX.ElementType if it’s defined, otherwise never.
10+
- */
11+
+import { JSX } from 'react/jsx-runtime';
12+
+
13+
// @ts-ignore JSX runtimes may optionally define JSX.ElementType. The MDX types need to work regardless whether this is
14+
// defined or not.
15+
type ElementType = any extends JSX.ElementType ? never : JSX.ElementType;

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@
5454
"volta": {
5555
"node": "22.22.3",
5656
"yarn": "4.12.0"
57+
},
58+
"resolutions": {
59+
"@types/mdx@npm:^2.0.0": "patch:@types/mdx@npm%3A2.0.13#~/.yarn/patches/@types-mdx-npm-2.0.13-52981f86f6.patch"
5760
}
5861
}

packages/fuselage-forms/fuselage-forms.api.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import { FieldRow } from '@rocket.chat/fuselage';
2525
import { ForwardRefExoticComponent } from 'react';
2626
import { IconProps } from '@rocket.chat/fuselage';
2727
import { InputBoxProps } from '@rocket.chat/fuselage';
28-
import { JSX as JSX_2 } from 'react/jsx-runtime';
28+
import { JSX } from 'react';
2929
import { Key } from 'react';
30+
import { MouseEventHandler } from 'react';
3031
import { MultiSelectAnchorParams } from '@rocket.chat/fuselage';
3132
import { NumberInputProps } from '@rocket.chat/fuselage';
3233
import { PasswordInputProps } from '@rocket.chat/fuselage';
@@ -54,7 +55,7 @@ error?: string;
5455
} & RefAttributes<HTMLElement>, "ref"> & RefAttributes<HTMLElement>>;
5556

5657
// @public (undocumented)
57-
export function Field(input: FieldProps): JSX_2.Element;
58+
export function Field(input: FieldProps): JSX.Element;
5859

5960
// @public (undocumented)
6061
export const FieldContext: Context<FieldContextValue>;
@@ -73,15 +74,15 @@ export type FieldContextValue = {
7374
};
7475

7576
// @public (undocumented)
76-
export const FieldDescription: (input: FieldDescriptionProps) => JSX_2.Element;
77+
export const FieldDescription: (input: FieldDescriptionProps) => JSX.Element;
7778

7879
// @public (undocumented)
7980
export type FieldDescriptionProps = {
8081
children: ReactNode;
8182
} & ComponentProps<typeof FieldDescription_2>;
8283

8384
// @public (undocumented)
84-
export const FieldError: (input: FieldErrorProps) => JSX_2.Element;
85+
export const FieldError: (input: FieldErrorProps) => JSX.Element;
8586

8687
// @public (undocumented)
8788
export type FieldErrorProps = {
@@ -91,15 +92,15 @@ export type FieldErrorProps = {
9192
export { FieldGroup }
9293

9394
// @public (undocumented)
94-
export const FieldHint: (input: FieldHintProps) => JSX_2.Element;
95+
export const FieldHint: (input: FieldHintProps) => JSX.Element;
9596

9697
// @public (undocumented)
9798
export type FieldHintProps = {
9899
children: ReactNode;
99100
} & ComponentProps<typeof FieldHint_2>;
100101

101102
// @public (undocumented)
102-
export const FieldLabel: (props: FieldLabelProps) => JSX_2.Element;
103+
export const FieldLabel: (props: FieldLabelProps) => JSX.Element;
103104

104105
export { FieldLabelInfo }
105106

@@ -114,7 +115,7 @@ export type FieldProps = {
114115
} & ComponentProps<typeof Field_2>;
115116

116117
// @public (undocumented)
117-
export function FieldProvider(input: FieldProviderProps): JSX_2.Element;
118+
export function FieldProvider(input: FieldProviderProps): JSX.Element;
118119

119120
// @public (undocumented)
120121
export type FieldProviderProps = {
@@ -127,13 +128,13 @@ export { FieldRow }
127128
export type FieldType = 'wrappedByLabel' | 'referencedByLabel' | 'referencedByInput';
128129

129130
// @public (undocumented)
130-
export const HiddenLabel: (input: HiddenLabelProps) => JSX_2.Element;
131+
export const HiddenLabel: (input: HiddenLabelProps) => JSX.Element;
131132

132133
// @public (undocumented)
133134
export type HiddenLabelProps = ComponentProps<typeof FieldLabel_2>;
134135

135136
// @public (undocumented)
136-
export const LabelFor: (input: LabelForProps) => JSX_2.Element;
137+
export const LabelFor: (input: LabelForProps) => JSX.Element;
137138

138139
// @public (undocumented)
139140
export type LabelForProps = ComponentProps<typeof FieldLabel_2>;
@@ -153,7 +154,12 @@ customEmpty?: string;
153154
anchor?: ElementType<MultiSelectAnchorParams> | ((params: MultiSelectAnchorParams) => ReactNode);
154155
renderOptions?: ElementType;
155156
renderItem?: ElementType;
156-
renderSelected?: ElementType;
157+
renderSelected?: ElementType< {
158+
value: SelectOption[0];
159+
label: SelectOption[1];
160+
onMouseDown: MouseEventHandler;
161+
children: ReactNode;
162+
}>;
157163
addonIcon?: IconProps["name"];
158164
setFilter?: (filter: string) => void;
159165
} & RefAttributes<HTMLInputElement>, "ref"> & RefAttributes<HTMLInputElement>>;
@@ -170,7 +176,12 @@ customEmpty?: string;
170176
anchor?: ElementType<MultiSelectAnchorParams> | ((params: MultiSelectAnchorParams) => ReactNode);
171177
renderOptions?: ElementType;
172178
renderItem?: ElementType;
173-
renderSelected?: ElementType;
179+
renderSelected?: ElementType< {
180+
value: SelectOption[0];
181+
label: SelectOption[1];
182+
onMouseDown: MouseEventHandler;
183+
children: ReactNode;
184+
}>;
174185
addonIcon?: IconProps["name"];
175186
setFilter?: (filter: string) => void;
176187
} & {
@@ -191,7 +202,7 @@ labelChildren?: ReactNode;
191202
} & RefAttributes<HTMLInputElement>, "ref"> & RefAttributes<HTMLInputElement>>;
192203

193204
// @public (undocumented)
194-
export const ReferencedLabel: (input: ReferencedLabelProps) => JSX_2.Element;
205+
export const ReferencedLabel: (input: ReferencedLabelProps) => JSX.Element;
195206

196207
// @public (undocumented)
197208
export type ReferencedLabelProps = ComponentProps<typeof FieldLabel_2>;
@@ -203,7 +214,7 @@ error?: string;
203214
} & RefAttributes<HTMLInputElement>, "ref"> & RefAttributes<HTMLInputElement>>;
204215

205216
// @public (undocumented)
206-
export const Select: ForwardRefExoticComponent<Omit<Omit<AriaSelectProps<object>, "value" | "children" | "onChange"> & {
217+
export const Select: ForwardRefExoticComponent<Omit<Omit<AriaSelectProps<object>, "children" | "value" | "onChange"> & {
207218
error?: string;
208219
placeholder?: string;
209220
value?: Key | null | undefined;

packages/fuselage-forms/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@
4949
"@testing-library/user-event": "~14.6.1",
5050
"@types/jest": "~30.0.0",
5151
"@types/jest-axe": "~3.5.9",
52-
"@types/react": "~18.3.29",
53-
"@types/react-dom": "~18.3.7",
52+
"@types/react": "~19.2.16",
53+
"@types/react-dom": "~19.2.3",
5454
"eslint": "~9.39.4",
5555
"jest": "~30.4.2",
5656
"jest-axe": "~10.0.0",
5757
"jest-environment-jsdom": "~30.4.1",
5858
"lint-all": "workspace:~",
5959
"prettier": "~3.6.2",
60-
"react": "~18.3.1",
61-
"react-dom": "~18.3.1",
60+
"react": "~19.2.7",
61+
"react-dom": "~19.2.7",
6262
"rimraf": "~6.1.3",
6363
"storybook": "~9.1.20",
6464
"ts-jest": "~29.4.11",

0 commit comments

Comments
 (0)