Skip to content

Commit a70bb45

Browse files
authored
chore: update to React 19 (#332)
1 parent 4c0f410 commit a70bb45

File tree

29 files changed

+799
-1857
lines changed

29 files changed

+799
-1857
lines changed

package-lock.json

Lines changed: 681 additions & 1797 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"devDependencies": {
5555
"@babel/preset-env": "^7.20.2",
5656
"@babel/preset-typescript": "^7.18.6",
57-
"@commitlint/cli": "^17.0.0",
58-
"@commitlint/config-conventional": "^17.0.0",
57+
"@commitlint/cli": "^20.1.0",
58+
"@commitlint/config-conventional": "^20.0.0",
5959
"@gravity-ui/eslint-config": "^3.3.0",
6060
"@gravity-ui/prettier-config": "^1.1.0",
6161
"@gravity-ui/stylelint-config": "^4.0.1",
@@ -75,8 +75,8 @@
7575
"@testing-library/user-event": "^14.4.3",
7676
"@types/jest": "^29.5.0",
7777
"@types/lodash": "^4.14.180",
78-
"@types/react": "^18.0.28",
79-
"@types/react-dom": "^18.0.11",
78+
"@types/react": "^19.0.0",
79+
"@types/react-dom": "^19.0.0",
8080
"@types/react-is": "^17.0.3",
8181
"@types/uuid": "^9.0.4",
8282
"@vitejs/plugin-react": "^4.2.0",
@@ -99,10 +99,10 @@
9999
"postcss": "^8.4.19",
100100
"prettier": "^3.0.3",
101101
"randexp": "^0.5.3",
102-
"react": "^18.2.0",
103-
"react-dom": "^18.2.0",
102+
"react": "^19.2.0",
103+
"react-dom": "^19.2.0",
104104
"react-final-form": "^6.5.3",
105-
"react-is": "^18.2.0",
105+
"react-is": "^19.2.0",
106106
"react-monaco-editor": "^0.46.0",
107107
"rimraf": "5.0.5",
108108
"sass": "^1.57.1",
@@ -112,16 +112,16 @@
112112
"stylelint": "^15.10.3",
113113
"stylelint-scss": "^5.1.0",
114114
"ts-jest": "^29.0.5",
115-
"typescript": "^4.9.5",
115+
"typescript": "^5.8.4",
116116
"uuid": "^9.0.1"
117117
},
118118
"peerDependencies": {
119119
"@gravity-ui/uikit": "^7.0.0",
120120
"final-form": "^4.20.2",
121-
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
122-
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
121+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
122+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
123123
"react-final-form": "^6.5.3",
124-
"react-is": "^16.0.0 || ^17.0.0 || ^18.0.0"
124+
"react-is": "^17.0.0 || ^18.0.0 || ^19.0.0"
125125
},
126126
"nano-staged": {
127127
"*.{scss}": [

playwright/core/DynamicForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import noop from 'lodash/noop';
44
import {Form} from 'react-final-form';
55

66
import {DynamicField} from '../../src/lib/core/components/Form/DynamicField';
7-
import {Spec} from '../../src/lib/core/types/specs';
7+
import type {Spec} from '../../src/lib/core/types/specs';
88
import {dynamicConfig} from '../../src/lib/kit/constants/config';
99

1010
export const DynamicForm = ({spec}: {spec: Spec}) => {

playwright/core/DynamicView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22

33
import {DynamicView as DynamicViewBase} from '../../src/lib/core/components/View/DynamicView';
4-
import {Spec} from '../../src/lib/core/types/specs';
5-
import {FormValue} from '../../src/lib/core/types/value';
4+
import type {Spec} from '../../src/lib/core/types/specs';
5+
import type {FormValue} from '../../src/lib/core/types/value';
66
import {dynamicViewConfig} from '../../src/lib/kit/constants/config';
77

88
export const DynamicView = ({

playwright/core/mountFixture.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import type {MountOptions} from '@playwright/experimental-ct-react';
66

77
import type {MountFixture, PlaywrightFixture} from './types';
88

9-
export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, use) => {
9+
export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, run) => {
1010
const mount = async (
11-
component: JSX.Element,
11+
component: React.JSX.Element,
1212
options?: MountOptions<JsonObject> | undefined,
1313
style?: React.CSSProperties | undefined,
1414
) => {
@@ -31,5 +31,5 @@ export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: base
3131
);
3232
};
3333

34-
await use(mount);
34+
await run(mount);
3535
};

playwright/core/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {MountOptions} from '@playwright/experimental-ct-react';
12
import type {
23
Locator,
34
PageScreenshotOptions,
@@ -7,7 +8,6 @@ import type {
78
PlaywrightWorkerOptions,
89
TestFixture,
910
} from '@playwright/test';
10-
import type {MountOptions} from '@playwright/experimental-ct-react';
1111

1212
type JsonPrimitive = string | number | boolean | null;
1313
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
@@ -17,12 +17,12 @@ type JsonObject = {[Key in string]?: JsonValue};
1717

1818
interface MountResult extends Locator {
1919
unmount(): Promise<void>;
20-
update(component: JSX.Element): Promise<void>;
20+
update(component: React.JSX.Element): Promise<void>;
2121
}
2222

2323
interface ComponentFixtures {
2424
mount<HooksConfig extends JsonObject>(
25-
component: JSX.Element,
25+
component: React.JSX.Element,
2626
options?: MountOptions<HooksConfig>,
2727
style?: React.CSSProperties | undefined,
2828
): Promise<MountResult>;

src/lib/core/components/Form/Controller/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type React from 'react';
2+
13
import type {FormValue, Spec} from '../../../types';
24
import type {
35
DynamicFormConfig,
@@ -123,7 +125,7 @@ export interface ControllerStore<
123125
config: DynamicFormConfig;
124126
tools: DynamicFormsContext['tools'];
125127
mutatorsStore: DynamicFormMutatorsStore;
126-
render: (props: FieldRenderProps<DirtyValue>) => JSX.Element | null;
128+
render: (props: FieldRenderProps<DirtyValue>) => React.JSX.Element | null;
127129
validate: (value?: Value) => ValidateError;
128130
parentOnChange:
129131
| ((

src/lib/core/components/Form/hooks/useSearch/useSearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const useSearch = (spec: Spec, value: FieldValue, name: string) => {
2020
const hidden = React.useMemo(() => isHiddenField(name), [isHiddenField, name]);
2121

2222
const withSearch = React.useCallback(
23-
(children: JSX.Element | null) =>
23+
(children: React.JSX.Element | null) =>
2424
children ? <div className={b({hidden: hidden})}>{children}</div> : null,
2525
[hidden],
2626
);

src/lib/core/components/Form/types/input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type InputType<
3232
SpecType extends Spec<undefined, InputComponentProps, LayoutComponentProps> = Spec,
3333
> = (
3434
props: InputProps<Value, InputComponentProps, LayoutComponentProps, SpecType>,
35-
) => React.ReactElement | null;
35+
) => React.ReactNode | Promise<React.ReactNode>;
3636

3737
export type IndependentInputType<
3838
Value extends FieldValue,
@@ -41,7 +41,7 @@ export type IndependentInputType<
4141
SpecType extends Spec<undefined, InputComponentProps, LayoutComponentProps> = Spec,
4242
> = (
4343
props: IndependentInputProps<Value, InputComponentProps, LayoutComponentProps, SpecType>,
44-
) => React.ReactElement | null;
44+
) => React.ReactNode | Promise<React.ReactNode>;
4545

4646
export type InputEntity<
4747
Value extends FieldValue,

src/lib/core/components/Form/types/layout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type LayoutProps<
1010
LayoutComponentProps extends Record<string, any> | undefined = undefined,
1111
SpecType extends Spec<undefined, InputComponentProps, LayoutComponentProps> = Spec,
1212
> = {
13-
children: React.ReactElement;
13+
children: React.ReactNode;
1414
layoutProps?: LayoutComponentProps;
1515
} & Omit<InputProps<Value, InputComponentProps, LayoutComponentProps, SpecType>, 'inputProps'>;
1616

@@ -21,7 +21,7 @@ export type LayoutType<
2121
SpecType extends Spec<undefined, InputComponentProps, LayoutComponentProps> = Spec,
2222
> = (
2323
props: LayoutProps<Value, InputComponentProps, LayoutComponentProps, SpecType>,
24-
) => React.ReactElement | null;
24+
) => React.ReactNode | Promise<React.ReactNode>;
2525

2626
export type LayoutsMap<
2727
Value extends FieldValue,

0 commit comments

Comments
 (0)