Skip to content

Commit

Permalink
Merge branch 'main' into add-smoke-tests/Divider
Browse files Browse the repository at this point in the history
  • Loading branch information
itwillwork authored Dec 26, 2024
2 parents 9661145 + 7a34b64 commit e0d7d04
Show file tree
Hide file tree
Showing 684 changed files with 1,619 additions and 687 deletions.
9 changes: 7 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
}
],
"@babel/preset-typescript",
"@babel/preset-react"
[
"@babel/preset-react",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
}
7 changes: 4 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/import-order",
"@gravity-ui/eslint-config/a11y"
"@gravity-ui/eslint-config/a11y",
"plugin:react/jsx-runtime"
],
"root": true,
"rules": {
Expand All @@ -15,8 +16,8 @@
"no-restricted-syntax": [
"error",
{
"selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportSpecifier)",
"message": "Please use import React from 'react' instead."
"selector": "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportSpecifier)",
"message": "Please use `import * as React from 'react'` instead."
},
{
"selector": "TSTypeReference>TSQualifiedName[left.name='React'][right.name='FC']",
Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withLang.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {configure} from '../../src';
Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {MobileProvider} from '../../src';
Expand Down
2 changes: 1 addition & 1 deletion .storybook/decorators/withStrictMode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {Decorator} from '@storybook/react';

Expand Down
2 changes: 0 additions & 2 deletions .storybook/decorators/withTheme.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Decorator} from '@storybook/react';

import {ThemeProvider} from '../../src';
Expand Down
2 changes: 1 addition & 1 deletion .storybook/theme-addon/register.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {API} from '@storybook/manager-api';
import {addons, types, useGlobals} from '@storybook/manager-api';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@
"typescript": "^5.3.3"
},
"peerDependencies": {
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"nano-staged": {
"*.{scss}": [
Expand Down
2 changes: 0 additions & 2 deletions playwright/core/mountFixture.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

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

export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, use) => {
Expand Down
4 changes: 2 additions & 2 deletions playwright/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type React from 'react';
import type * as React from 'react';

import type {MountOptions, MountResult} from '@playwright/experimental-ct-react';
import type {
Expand All @@ -14,7 +14,7 @@ import type {
interface ComponentFixtures {
mount<HooksConfig>(
component: React.JSX.Element,
options?: MountOptions<HooksConfig> & {width?: number},
options?: MountOptions<HooksConfig> & {width?: number | string},
): Promise<MountResult>;
}

Expand Down
2 changes: 0 additions & 2 deletions playwright/playwright/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {beforeMount} from '@playwright/experimental-ct-react/hooks';

import {ToasterProvider} from '../../src/components/Toaster';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionTooltip/ActionTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {useForkRef} from '../../hooks';
import {useTooltipVisible} from '../../hooks/private';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {StoryFn} from '@storybook/react';

import {Button} from '../../Button';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionTooltip/__tests__/ActionTooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import userEvent from '@testing-library/user-event';

import {createEvent, fireEvent, render, screen} from '../../../../test-utils/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionsPanel/ActionsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Xmark} from '@gravity-ui/icons';

import {Button} from '../Button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Meta, StoryObj} from '@storybook/react';

import {ActionsPanel} from '../../ActionsPanel';
Expand Down
2 changes: 0 additions & 2 deletions src/components/ActionsPanel/__stories__/actions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {ChevronDown, Files, PencilToSquare, TrashBin} from '@gravity-ui/icons';

import type {ActionsPanelProps} from '../../ActionsPanel';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionsPanel/components/CollapseActions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {Ellipsis} from '@gravity-ui/icons';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import type {ActionsPanelItem} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {useDirection} from '../../../theme';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import userEvent from '@testing-library/user-event';

import {render, screen} from '../../../test-utils/utils';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Xmark} from '@gravity-ui/icons';

import {Button} from '../Button';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertAction.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Button} from '../Button';

import type {AlertActionProps} from './types';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertActions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {Flex} from '../layout';

import {AlertAction} from './AlertAction';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/AlertContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {AlertContextType} from './types';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use client';

import React from 'react';

import {AlertContext} from './AlertContext';
import type {AlertContextProviderProps} from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/AlertIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import type * as React from 'react';

import {
CircleCheck,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/AlertTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Text} from '../Text';

import {bAlert} from './constants';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__stories__/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Gear} from '@gravity-ui/icons';
import {action} from '@storybook/addon-actions';
import type {Meta, StoryObj} from '@storybook/react';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__tests__/Alert.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {smokeTest, test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Alert/__tests__/cases.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Cases, CasesWithName} from '../../../stories/tests-factory/models';
import {Alert} from '../Alert';
import type {AlertProps} from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type React from 'react';
import type * as React from 'react';

import type {ButtonProps} from '../Button';
import type {QAProps} from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/useAlertContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {AlertContext} from './AlertContext';

Expand Down
2 changes: 0 additions & 2 deletions src/components/ArrowToggle/ArrowToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {ChevronDown} from '@gravity-ui/icons';

import {Icon} from '../Icon';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {Meta, StoryFn} from '@storybook/react';

import {ArrowToggle} from '../ArrowToggle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import type {Meta, StoryFn} from '@storybook/react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {DocsExample} from '../../../../demo/DocsExample/DocsExample';
import {Button} from '../../../Button';
Expand Down
35 changes: 35 additions & 0 deletions src/components/ArrowToggle/__tests__/ArrowToggle.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {smokeTest, test} from '~playwright/core';

import {createSmokeScenarios} from '../../../stories/tests-factory/create-smoke-scenarios';
import type {ArrowToggleProps} from '../ArrowToggle';
import {ArrowToggle} from '../ArrowToggle';

import {directionCases, sizeCases} from './cases';

test.describe('ArrowToggle', {tag: '@ArrowToggle'}, () => {
smokeTest('smoke', async ({mount, expectScreenshot}) => {
const defaultProps: ArrowToggleProps = {};

const smokeScenarios = createSmokeScenarios(defaultProps, {
size: sizeCases,
direction: directionCases,
});

await mount(
<div>
{smokeScenarios.map(([title, props]) => (
<div key={title}>
<h4>{title}</h4>
<div>
<ArrowToggle {...props} />
</div>
</div>
))}
</div>,
);

await expectScreenshot({
themes: ['light'],
});
});
});
10 changes: 10 additions & 0 deletions src/components/ArrowToggle/__tests__/cases.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type {Cases} from '../../../stories/tests-factory/models';
import type {ArrowToggleProps} from '../ArrowToggle';

export const sizeCases: Cases<ArrowToggleProps['size']> = [10, 20, 30, 40, 50, 100];
export const directionCases: Cases<ArrowToggleProps['direction']> = [
'top',
'left',
'bottom',
'right',
];
2 changes: 1 addition & 1 deletion src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {block} from '../utils/cn';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Avatar/AvatarIcon/AvatarIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import {Icon} from '../../Icon';
import type {AvatarSize} from '../types/common';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Avatar/AvatarImage/AvatarImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React from 'react';
import * as React from 'react';

import {AVATAR_SIZES} from '../constants';

Expand Down
2 changes: 0 additions & 2 deletions src/components/Avatar/AvatarText/AvatarText.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type {AvatarTextProps} from './types';
import {getAvatarDisplayText} from './utils';

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Avatar/__stories__/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import {faker} from '@faker-js/faker/locale/en';
import {FaceRobot} from '@gravity-ui/icons';
Expand Down
Loading

0 comments on commit e0d7d04

Please sign in to comment.