Skip to content

Commit fae864b

Browse files
committed
chore: update dependencies
1 parent 1e8c577 commit fae864b

File tree

36 files changed

+14916
-8749
lines changed

36 files changed

+14916
-8749
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 65 deletions
This file was deleted.

.storybook/decorators/withLang.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import {settings} from '@gravity-ui/date-utils';
44
import type {Lang} from '@gravity-ui/uikit';
55
import {configure} from '@gravity-ui/uikit';
6-
import type {Decorator} from '@storybook/react';
6+
import type {Decorator} from '@storybook/react-webpack5';
77

88
export const WithLang: Decorator = (Story, context) => {
99
const lang = context.globals.lang;

.storybook/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import * as sass from 'sass';
44
const config: StorybookConfig = {
55
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
66
addons: [
7-
{name: '@storybook/addon-essentials', options: {backgrounds: false}},
7+
'@storybook/addon-docs',
88
'@storybook/addon-a11y',
99
'./theme-addon/register.tsx',
1010
'@storybook/addon-webpack5-compiler-babel',
11-
'@storybook/addon-storysource',
1211
{
1312
name: '@storybook/addon-styling-webpack',
1413
options: {

.storybook/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {addons} from '@storybook/manager-api';
1+
import {addons} from 'storybook/manager-api';
22

33
import {themes} from './theme';
44

.storybook/preview.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// eslint-disable-next-line import/order
2+
import '@gravity-ui/uikit/styles/fonts.scss';
3+
// eslint-disable-next-line import/order
24
import '@gravity-ui/uikit/styles/styles.css';
35

46
import React from 'react';
@@ -12,8 +14,8 @@ import {
1214
configure,
1315
} from '@gravity-ui/uikit';
1416
import {toaster} from '@gravity-ui/uikit/toaster-singleton';
15-
import {MINIMAL_VIEWPORTS} from '@storybook/addon-viewport';
16-
import type {Decorator, Preview} from '@storybook/react';
17+
import type {Decorator, Preview} from '@storybook/react-webpack5';
18+
import {MINIMAL_VIEWPORTS} from 'storybook/viewport';
1719

1820
import {DocsDecorator} from '../src/demo/DocsDecorator/DocsDecorator';
1921

@@ -47,6 +49,7 @@ const preview: Preview = {
4749
canvas: {
4850
className: 'g-storybook-docs-decorator__canvas',
4951
},
52+
codePanel: true,
5053
},
5154
jsx: {showFunctions: false}, // Do not show functions in sources
5255
viewport: {

.storybook/theme-addon/register.tsx

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

33
import {getThemeType} from '@gravity-ui/uikit';
4-
import {addons, types, useGlobals} from '@storybook/manager-api';
5-
import type {API} from '@storybook/manager-api';
4+
import {addons, types, useGlobals} from 'storybook/manager-api';
5+
import type {API} from 'storybook/manager-api';
66

77
import {themes} from '../theme';
88

9-
const ADDON_ID = 'yc-theme-addon';
9+
const ADDON_ID = 'gravity-theme-addon';
1010
const TOOL_ID = `${ADDON_ID}tool`;
1111

1212
addons.register(ADDON_ID, (api) => {

.storybook/theme.ts

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1-
import {create} from '@storybook/theming';
2-
3-
export const CloudThemeLight = create({
4-
base: 'light',
5-
6-
colorPrimary: '#027bf3',
7-
colorSecondary: 'rgba(2, 123, 243, 0.6)',
8-
1+
import {create} from 'storybook/theming';
2+
import type {ThemeVarsPartial} from 'storybook/theming';
3+
4+
import pkg from '../package.json';
5+
6+
function renderBrandTitle(theme: 'light' | 'dark') {
7+
const titleColor = theme === 'light' ? 'rgba(0, 0, 0, 0.85)' : 'rgba(255, 255, 255, 0.85)';
8+
const descriptionColor = theme === 'light' ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)';
9+
const logo =
10+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 125" width="32" height="32" fill="none"><path fill="url(#a)" fill-rule="evenodd" d="M103.064 103.055c23.649-23.649 23.649-61.991 0-85.64L86.058 34.421c13.898 14.429 13.84 37.285-.254 51.379s-36.95 14.152-51.38.254l-17 17.001c23.649 23.649 61.991 23.649 85.64 0" clip-rule="evenodd"/><mask id="b" width="125" height="126" x="0" y="-1" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#F37" fill-rule="evenodd" d="M17.74 17.736C-2.88 38.356-5.521 70.147 9.817 93.63c1.09 1.733 1.635 2.599 1.95 3.41.727 1.874.832 3.422.363 5.377-.203.846-.721 1.984-1.757 4.26-3.458 7.596-4.205 13.244-1.578 15.87 7.412 7.413 31.148-4.306 70.301-43.459s50.872-62.89 43.46-70.302c-2.627-2.626-8.274-1.879-15.869 1.578-2.286 1.04-3.429 1.56-4.278 1.763-1.946.465-3.484.362-5.35-.357-.805-.31-1.665-.848-3.366-1.916C70.206-5.529 38.378-2.902 17.74 17.736m50.165 50.161c14.261-14.26 23.878-27.765 17.263-34.38-14.396-14.396-37.626-14.505-51.887-.244-14.261 14.26-14.152 37.491.244 51.887 6.615 6.615 20.12-3.002 34.38-17.263" clip-rule="evenodd"/></mask><g mask="url(#b)"><path fill="#F37" fill-rule="evenodd" d="M17.74 17.736C-2.88 38.356-5.521 70.147 9.817 93.63c1.09 1.733 1.635 2.599 1.95 3.41.727 1.874.832 3.422.363 5.377-.203.846-.721 1.984-1.757 4.26-3.458 7.596-4.205 13.244-1.578 15.87 7.412 7.413 31.148-4.306 70.301-43.459s50.872-62.89 43.46-70.302c-2.627-2.626-8.274-1.879-15.869 1.578-2.286 1.04-3.429 1.56-4.278 1.763-1.946.465-3.484.362-5.35-.357-.805-.31-1.665-.848-3.366-1.916C70.206-5.529 38.378-2.902 17.74 17.736m50.165 50.161c14.261-14.26 23.878-27.765 17.263-34.38-14.396-14.396-37.626-14.505-51.887-.244-14.261 14.26-14.152 37.491.244 51.887 6.615 6.615 20.12-3.002 34.38-17.263" clip-rule="evenodd"/><g filter="url(#c)"><path fill="#FF0" d="M19.03 88C6.426 68.68 8.597 42.522 25.543 25.556 42.507 8.572 68.673 6.412 87.978 19.08c1.388.873 2.093 1.313 2.753 1.567 1.533.592 2.797.677 4.396.295.698-.167 1.638-.595 3.516-1.451 6.242-2.845 14.999-8.953 18.072-5.877 4.72 4.726-9.484 29.292-41.662 61.507s-56.716 47.351-61.436 42.626c-3.074-3.077 3.028-12.76 5.87-19.01.852-1.873 1.277-2.81 1.444-3.505.386-1.609.3-2.882-.298-4.425-.259-.667-.707-1.38-1.604-2.805z"/></g></g><defs><radialGradient id="a" cx="0" cy="0" r="1" gradientTransform="rotate(45 -43.592 103.062)scale(59.7564)" gradientUnits="userSpaceOnUse"><stop offset=".646" stop-color="#FF0"/><stop offset="1" stop-color="#F37"/></radialGradient><filter id="c" width="144.672" height="145.669" x="-8.053" y="-8.056" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_1776_29897" stdDeviation="9.509"/></filter></defs></svg>';
11+
12+
return `
13+
<div style="display: flex; align-items: flex-start">
14+
<div style="flex-shrink: 0; line-height: 0">${logo}</div>
15+
<div style="margin-inline-start: 8px">
16+
<div style="font-size: 26px; line-height: 32px; color: ${titleColor}; font-weight: 600;">Gravity&nbsp;UI</div>
17+
<div style="font-size: 14px; color: ${descriptionColor}; font-weight: 400;">Date Components&nbsp;v${pkg.version}</div>
18+
</div>
19+
</div>
20+
`.trim();
21+
}
22+
23+
const common: Omit<ThemeVarsPartial, 'base'> = {
924
// Typography
1025
fontBase: '"Helvetica Neue", Arial, Helvetica, sans-serif',
1126
fontCode:
1227
'"SF Mono", "Menlo", "Monaco", "Consolas", "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", "Courier", monospace',
1328

14-
// Text colors
15-
textColor: 'black',
16-
textInverseColor: 'black',
17-
18-
// Toolbar default and active colors
19-
barTextColor: 'silver',
20-
barSelectedColor: '#027bf3',
21-
// barBg: '#027bf3',
22-
23-
// Form colors
24-
inputBg: 'white',
25-
inputBorder: 'silver',
26-
inputTextColor: 'black',
27-
inputBorderRadius: 4,
29+
brandUrl: 'https://gravity-ui.com/',
30+
};
2831

29-
brandUrl: 'https://github.com/gravity-ui/uikit',
30-
brandTitle: `<div style="font-size: 18px; color: #027bf3; font-weight: 600; margin-top: -6px; margin-bottom: 2px;">Gravity UI</div>
31-
<div style="font-size: 14px;color: #7d7d7d;font-weight: 400;">Date Components</div>`,
32+
export const CloudThemeLight = create({
33+
base: 'light',
34+
...common,
35+
brandTitle: renderBrandTitle('light'),
3236
});
3337

3438
export const CloudThemeDark = create({
3539
base: 'dark',
40+
...common,
41+
brandTitle: renderBrandTitle('dark'),
3642
});
3743

3844
export const themes = {

eslint.config.mjs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import baseConfig from '@gravity-ui/eslint-config';
2+
import a11yConfig from '@gravity-ui/eslint-config/a11y';
3+
import clientConfig from '@gravity-ui/eslint-config/client';
4+
import importOrderConfig from '@gravity-ui/eslint-config/import-order';
5+
import prettierConfig from '@gravity-ui/eslint-config/prettier';
6+
import {defineConfig} from 'eslint/config';
7+
import reactCompiler from 'eslint-plugin-react-compiler';
8+
import storybookPlugin from 'eslint-plugin-storybook';
9+
import testingLibraryPlugin from 'eslint-plugin-testing-library';
10+
import globals from 'globals';
11+
12+
export default defineConfig([
13+
...baseConfig,
14+
...clientConfig,
15+
...prettierConfig,
16+
...importOrderConfig,
17+
...a11yConfig,
18+
...storybookPlugin.configs['flat/recommended'],
19+
{...reactCompiler.configs.recommended, rules: {'react-compiler/react-compiler': 'warn'}},
20+
{
21+
rules: {
22+
complexity: 'off',
23+
'react/jsx-fragments': ['error', 'element'],
24+
'react/react-in-jsx-scope': 'off',
25+
'no-restricted-syntax': [
26+
'error',
27+
{
28+
selector:
29+
"ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportSpecifier)",
30+
message: "Please use import React from 'react' instead.",
31+
},
32+
{
33+
selector: "TSTypeReference>TSQualifiedName[left.name='React'][right.name='FC']",
34+
message: "Don't use React.FC",
35+
},
36+
],
37+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
38+
'jsx-a11y/no-autofocus': ['error', {ignoreNonDOM: true}],
39+
},
40+
},
41+
{
42+
files: ['**/*.ts', '**/*.tsx'],
43+
rules: {
44+
'@typescript-eslint/prefer-ts-expect-error': 'error',
45+
'@typescript-eslint/consistent-type-imports': [
46+
'error',
47+
{prefer: 'type-imports', fixStyle: 'separate-type-imports'},
48+
],
49+
},
50+
},
51+
{
52+
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
53+
ignores: ['**/__tests__/**/*.visual.test.*'],
54+
extends: [testingLibraryPlugin.configs['flat/react']],
55+
languageOptions: {globals: {...globals.node, ...globals.jest}},
56+
},
57+
{files: ['**/__stories__/**/*.[jt]s?(x)'], rules: {'no-console': 'off'}},
58+
{files: ['**/*.js', '!src/**/*'], languageOptions: {globals: {...globals.node}}},
59+
{ignores: ['dist', 'storybook-static', '!/.storybook']},
60+
]);

0 commit comments

Comments
 (0)