Skip to content

Commit 32a4547

Browse files
authored
feat!: update packages (#172)
1 parent f1997f1 commit 32a4547

File tree

188 files changed

+4104
-2619
lines changed

Some content is hidden

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

188 files changed

+4104
-2619
lines changed

package-lock.json

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

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
},
4545
"dependencies": {
4646
"@bem-react/classname": "^1.6.0",
47-
"@gravity-ui/components": "^2.8.0",
48-
"@gravity-ui/i18n": "^1.1.0",
47+
"@gravity-ui/components": "^3.0.0",
48+
"@gravity-ui/i18n": "^1.2.0",
4949
"@gravity-ui/icons": "^2.8.1",
5050
"lodash": "^4.17.20"
5151
},
@@ -54,11 +54,11 @@
5454
"@babel/preset-typescript": "^7.18.6",
5555
"@commitlint/cli": "^17.0.0",
5656
"@commitlint/config-conventional": "^17.0.0",
57-
"@gravity-ui/eslint-config": "^2.2.0",
57+
"@gravity-ui/eslint-config": "^3.1.1",
5858
"@gravity-ui/prettier-config": "^1.1.0",
59-
"@gravity-ui/stylelint-config": "^2.0.0",
59+
"@gravity-ui/stylelint-config": "^4.0.1",
6060
"@gravity-ui/tsconfig": "^1.0.0",
61-
"@gravity-ui/uikit": "^5.19.1",
61+
"@gravity-ui/uikit": "^6.0.0",
6262
"@playwright/experimental-ct-react": "^1.40.0",
6363
"@playwright/test": "^1.40.0",
6464
"@storybook/addon-essentials": "^7.0.27",
@@ -76,7 +76,7 @@
7676
"@types/uuid": "^9.0.4",
7777
"@vitejs/plugin-react": "^4.2.0",
7878
"css-loader": "^5.2.6",
79-
"eslint": "^8.27.0",
79+
"eslint": "^8.49.0",
8080
"final-form": "^4.20.2",
8181
"gulp": "^4.0.2",
8282
"gulp-cli": "^2.3.0",
@@ -91,7 +91,7 @@
9191
"monaco-editor-webpack-plugin": "^6.0.0",
9292
"npm-run-all": "^4.1.5",
9393
"postcss": "^8.4.19",
94-
"prettier": "^2.7.1",
94+
"prettier": "^3.0.3",
9595
"randexp": "^0.5.3",
9696
"react": "^18.2.0",
9797
"react-dom": "^18.2.0",
@@ -103,14 +103,14 @@
103103
"sass-loader": "^10.1.1",
104104
"storybook": "^7.0.27",
105105
"style-loader": "^2.0.0",
106-
"stylelint": "^14.15.0",
107-
"stylelint-scss": "^4.2.0",
106+
"stylelint": "^15.10.3",
107+
"stylelint-scss": "^5.1.0",
108108
"ts-jest": "^29.0.5",
109109
"typescript": "^4.9.5",
110110
"uuid": "^9.0.1"
111111
},
112112
"peerDependencies": {
113-
"@gravity-ui/uikit": "^5.0.0",
113+
"@gravity-ui/uikit": "^6.0.0",
114114
"final-form": "^4.20.2",
115115
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
116116
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",

playwright/core/DynamicForm.tsx

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

3+
import {MobileProvider, ThemeProvider} from '@gravity-ui/uikit';
4+
35
import _ from 'lodash';
46
import {Form} from 'react-final-form';
57

@@ -11,15 +13,19 @@ export const DynamicForm = ({spec}: {spec: Spec}) => {
1113
const generateRandomValue = () => 'value';
1214

1315
return (
14-
<Form initialValues={{}} onSubmit={_.noop}>
15-
{() => (
16-
<DynamicField
17-
name="input"
18-
spec={spec}
19-
config={dynamicConfig}
20-
generateRandomValue={generateRandomValue}
21-
/>
22-
)}
23-
</Form>
16+
<ThemeProvider>
17+
<MobileProvider>
18+
<Form initialValues={{}} onSubmit={_.noop}>
19+
{() => (
20+
<DynamicField
21+
name="input"
22+
spec={spec}
23+
config={dynamicConfig}
24+
generateRandomValue={generateRandomValue}
25+
/>
26+
)}
27+
</Form>
28+
</MobileProvider>
29+
</ThemeProvider>
2430
);
2531
};

playwright/core/DynamicView.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import React from 'react';
22

3+
import {MobileProvider, ThemeProvider} from '@gravity-ui/uikit';
4+
35
import {DynamicView as DynamicViewBase} from '../../src/lib/core/components/View/DynamicView';
46
import {Spec} from '../../src/lib/core/types/specs';
57
import {FormValue} from '../../src/lib/core/types/value';
68
import {dynamicViewConfig} from '../../src/lib/kit/constants/config';
79

810
export const DynamicView = ({spec, value}: {spec: Spec; value: FormValue}) => {
9-
return <DynamicViewBase spec={spec} value={value} config={dynamicViewConfig} />;
11+
return (
12+
<ThemeProvider>
13+
<MobileProvider>
14+
<DynamicViewBase spec={spec} value={value} config={dynamicViewConfig} />
15+
</MobileProvider>
16+
</ThemeProvider>
17+
);
1018
};

playwright/playwright.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ const config: PlaywrightTestConfig = {
6767
name: 'chromium',
6868
use: {...devices['Desktop Chrome'], deviceScaleFactor: 2},
6969
},
70-
{
71-
name: 'webkit',
72-
use: {...devices['Desktop Safari'], deviceScaleFactor: 2},
73-
},
70+
// {
71+
// name: 'webkit',
72+
// use: {...devices['Desktop Safari'], deviceScaleFactor: 2},
73+
// },
7474
],
7575
};
7676

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,26 @@ export interface GetComponentsParams<SpecType extends Spec> {
2222
config: DynamicFormConfig;
2323
}
2424

25-
export interface GetComponentsReturn<DirtyValue extends FieldValue, SpecType extends Spec> {
26-
inputEntity?: InputEntity<DirtyValue, SpecType> | IndependentInputEntity<DirtyValue, SpecType>;
27-
Layout?: LayoutType<DirtyValue, SpecType>;
25+
export interface GetComponentsReturn<
26+
DirtyValue extends FieldValue,
27+
SpecType extends Spec<undefined, undefined, undefined>,
28+
> {
29+
inputEntity?:
30+
| InputEntity<DirtyValue, undefined, undefined, SpecType>
31+
| IndependentInputEntity<DirtyValue, undefined, undefined, SpecType>;
32+
Layout?: LayoutType<DirtyValue, undefined, undefined, SpecType>;
2833
}
2934

30-
export interface GetRenderParams<DirtyValue extends FieldValue, SpecType extends Spec> {
35+
export interface GetRenderParams<
36+
DirtyValue extends FieldValue,
37+
SpecType extends Spec<undefined, undefined, undefined>,
38+
> {
3139
name: string;
3240
spec: SpecType;
33-
inputEntity?: InputEntity<DirtyValue, SpecType> | IndependentInputEntity<DirtyValue, SpecType>;
34-
Layout?: LayoutType<DirtyValue, SpecType>;
41+
inputEntity?:
42+
| InputEntity<DirtyValue, undefined, undefined, SpecType>
43+
| IndependentInputEntity<DirtyValue, undefined, undefined, SpecType>;
44+
Layout?: LayoutType<DirtyValue, undefined, undefined, SpecType>;
3545
}
3646

3747
export interface GetValidateParams<SpecType extends Spec> {

src/lib/core/components/Form/__tests__/DynamicField.test.tsx

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

3+
import {ThemeProvider} from '@gravity-ui/uikit';
34
import {act, render} from '@testing-library/react';
45
import {FormApi} from 'final-form';
56
import _ from 'lodash';
@@ -139,32 +140,47 @@ const spec: ObjectSpec = {
139140

140141
jest.mock('lodash/debounce', () => (f: Function) => f);
141142

143+
beforeEach(() => {
144+
window.matchMedia = () => ({
145+
media: '',
146+
matches: false,
147+
onchange: () => {},
148+
addListener: () => {},
149+
removeListener: () => {},
150+
addEventListener: () => {},
151+
removeEventListener: () => {},
152+
dispatchEvent: (_) => true,
153+
});
154+
});
155+
142156
test('Form/hooks/DynamicField', () => {
143157
const mirror: WonderMirror = {field: {}, controller: {}};
144158
let form = null as FormApi | null;
145159

146160
render(
147-
<Form initialValues={{}} onSubmit={_.noop}>
148-
{() => {
149-
const Caller = () => {
150-
form = useForm();
151-
152-
return null;
153-
};
154-
155-
return (
156-
<React.Fragment>
157-
<DynamicField
158-
name={name}
159-
spec={spec}
160-
config={dynamicConfig}
161-
__mirror={mirror}
162-
/>
163-
<Caller />
164-
</React.Fragment>
165-
);
166-
}}
167-
</Form>,
161+
<ThemeProvider>
162+
<Form initialValues={{}} onSubmit={_.noop}>
163+
{() => {
164+
const Caller = () => {
165+
form = useForm();
166+
167+
return null;
168+
};
169+
170+
return (
171+
<React.Fragment>
172+
<DynamicField
173+
name={name}
174+
spec={spec}
175+
config={dynamicConfig}
176+
__mirror={mirror}
177+
/>
178+
<Caller />
179+
</React.Fragment>
180+
);
181+
}}
182+
</Form>
183+
</ThemeProvider>,
168184
);
169185

170186
const value = {

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

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,83 @@ import {
1616
ValidatorsMap,
1717
} from './';
1818

19-
export type ArrayInputProps<InputComponentProps extends Record<string, any> = {}> = InputProps<
19+
export type ArrayInputProps<
20+
InputComponentProps extends Record<string, any> | undefined = undefined,
21+
> = InputProps<
2022
FieldArrayValue,
21-
ArraySpec<undefined, InputComponentProps>
23+
InputComponentProps,
24+
undefined,
25+
ArraySpec<undefined, InputComponentProps, undefined>
2226
>;
27+
2328
export type ArrayIndependentInputProps<
24-
InputComponentProps extends Record<string, any> = {},
25-
LayoutComponentProps extends Record<string, any> = {},
29+
InputComponentProps extends Record<string, any> | undefined = undefined,
30+
LayoutComponentProps extends Record<string, any> | undefined = undefined,
2631
> = IndependentInputProps<
2732
FieldArrayValue,
33+
InputComponentProps,
34+
LayoutComponentProps,
2835
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
2936
>;
3037

31-
export type ArrayLayoutProps<LayoutComponentProps extends Record<string, any> = {}> = LayoutProps<
38+
export type ArrayLayoutProps<
39+
InputComponentProps extends Record<string, any> | undefined = undefined,
40+
LayoutComponentProps extends Record<string, any> | undefined = undefined,
41+
> = LayoutProps<
3242
FieldArrayValue,
33-
ArraySpec<undefined, any, LayoutComponentProps>
43+
InputComponentProps,
44+
LayoutComponentProps,
45+
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
3446
>;
3547

36-
export type ArrayInput<InputComponentProps extends Record<string, any> = {}> = InputType<
37-
FieldArrayValue,
38-
ArraySpec<undefined, InputComponentProps>
39-
>;
48+
export type ArrayInput<InputComponentProps extends Record<string, any> | undefined = undefined> =
49+
InputType<
50+
FieldArrayValue,
51+
InputComponentProps,
52+
undefined,
53+
ArraySpec<undefined, InputComponentProps, undefined>
54+
>;
55+
4056
export type ArrayIndependentInput<
41-
InputComponentProps extends Record<string, any> = {},
42-
LayoutComponentProps extends Record<string, any> = {},
57+
InputComponentProps extends Record<string, any> | undefined = undefined,
58+
LayoutComponentProps extends Record<string, any> | undefined = undefined,
4359
> = IndependentInputType<
4460
FieldArrayValue,
61+
InputComponentProps,
62+
LayoutComponentProps,
4563
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
4664
>;
4765

48-
export type ArrayLayout<LayoutComponentProps extends Record<string, any> = {}> = LayoutType<
66+
export type ArrayLayout<
67+
InputComponentProps extends Record<string, any> | undefined = undefined,
68+
LayoutComponentProps extends Record<string, any> | undefined = undefined,
69+
> = LayoutType<
4970
FieldArrayValue,
50-
ArraySpec<undefined, any, LayoutComponentProps>
71+
InputComponentProps,
72+
LayoutComponentProps,
73+
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
5174
>;
5275

53-
export type ArrayInputEntity = InputEntity<FieldArrayValue, ArraySpec>;
54-
export type ArrayIndependentInputEntity = IndependentInputEntity<FieldArrayValue, ArraySpec>;
76+
export type ArrayInputEntity<
77+
InputComponentProps extends Record<string, any> | undefined = undefined,
78+
> = InputEntity<
79+
FieldArrayValue,
80+
InputComponentProps,
81+
undefined,
82+
ArraySpec<undefined, InputComponentProps, undefined>
83+
>;
84+
export type ArrayIndependentInputEntity<
85+
InputComponentProps extends Record<string, any> | undefined = undefined,
86+
LayoutComponentProps extends Record<string, any> | undefined = undefined,
87+
> = IndependentInputEntity<
88+
FieldArrayValue,
89+
InputComponentProps,
90+
LayoutComponentProps,
91+
ArraySpec<undefined, InputComponentProps, LayoutComponentProps>
92+
>;
5593

56-
export type ArrayInputsMap = InputsMap<FieldArrayValue, ArraySpec>;
57-
export type ArrayLayoutsMap = LayoutsMap<FieldArrayValue, ArraySpec>;
58-
export type ArrayValidatorsMap = ValidatorsMap<ArrayValue, ArraySpec>;
94+
export type ArrayInputsMap = InputsMap<FieldArrayValue, ArraySpec<undefined, any, any>>;
95+
export type ArrayLayoutsMap = LayoutsMap<FieldArrayValue, ArraySpec<undefined, any, any>>;
96+
export type ArrayValidatorsMap = ValidatorsMap<ArrayValue, ArraySpec<undefined, any, any>>;
5997

60-
export type ArrayConfig = TypeConfig<FieldArrayValue, ArrayValue, ArraySpec>;
98+
export type ArrayConfig = TypeConfig<FieldArrayValue, ArrayValue, ArraySpec<undefined, any, any>>;

0 commit comments

Comments
 (0)