diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..b5cf683
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,16 @@
+{
+ "sourceType": "unambiguous",
+ "presets": [
+ [
+ "@babel/preset-env",
+ {
+ "targets": {
+ "chrome": 100
+ }
+ }
+ ],
+ "@babel/preset-typescript",
+ "@babel/preset-react"
+ ],
+ "plugins": []
+}
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3c94b5b..e905433 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '14.x'
- cache: 'npm'
+ node-version: 18
+ cache: npm
- name: Install Packages
run: npm ci
- name: Lint Files
@@ -32,14 +32,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: '14.x'
- cache: 'npm'
+ node-version: 18
+ cache: npm
- name: Install Packages
run: npm ci
- name: Unit Tests
diff --git a/.github/workflows/main-preview.yml b/.github/workflows/main-preview.yml
index fd1ed68..861748b 100644
--- a/.github/workflows/main-preview.yml
+++ b/.github/workflows/main-preview.yml
@@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: 14
+ node-version: 18
- name: Install Packages
run: npm ci
shell: bash
diff --git a/.github/workflows/pr-preview-build.yml b/.github/workflows/pr-preview-build.yml
index 7597a14..96e9b26 100644
--- a/.github/workflows/pr-preview-build.yml
+++ b/.github/workflows/pr-preview-build.yml
@@ -9,5 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/preview-build-action@v1
+ with:
+ node-version: 18
env:
TS_NODE_PROJECT: .storybook/tsconfig.json
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7d137e4..f7830c1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,3 +12,4 @@ jobs:
with:
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
+ node-version: 18
diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml
index 20a62b0..b141910 100644
--- a/.github/workflows/sync.yml
+++ b/.github/workflows/sync.yml
@@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v3
with:
- node-version: 14
- cache: 'npm'
+ node-version: 18
+ cache: npm
- name: Install Packages
run: npm ci
- name: Download SVG Files
diff --git a/.nvmrc b/.nvmrc
index 8351c19..3c03207 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-14
+18
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..7293197
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1 @@
+"@gravity-ui/prettier-config"
diff --git a/.prettierrc.js b/.prettierrc.js
deleted file mode 100644
index 5da9c2e..0000000
--- a/.prettierrc.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('@gravity-ui/prettier-config');
diff --git a/.storybook/main.ts b/.storybook/main.ts
index 6ddf9b5..f1dca3b 100644
--- a/.storybook/main.ts
+++ b/.storybook/main.ts
@@ -1,6 +1,10 @@
-import type {StorybookConfig} from '@storybook/core-common';
+import type {StorybookConfig} from '@storybook/react-webpack5';
const config: StorybookConfig = {
+ framework: {
+ name: '@storybook/react-webpack5',
+ options: {fastRefresh: true},
+ },
stories: ['./**/*.stories.@(ts|tsx)'],
addons: [
{name: '@storybook/preset-scss', options: {rule: {sideEffects: true}}},
@@ -17,4 +21,4 @@ const config: StorybookConfig = {
],
};
-module.exports = config;
+export default config;
diff --git a/.storybook/manager.ts b/.storybook/manager.ts
index 114205c..0a09dfa 100644
--- a/.storybook/manager.ts
+++ b/.storybook/manager.ts
@@ -1,5 +1,6 @@
-import {addons} from '@storybook/addons';
+import {addons} from '@storybook/manager-api';
import {create} from '@storybook/theming';
+import packageJson from '../package.json';
addons.setConfig({
showPanel: false,
@@ -30,7 +31,7 @@ addons.setConfig({
inputBorderRadius: 4,
brandTitle: `
Gravity UI
- Icons
`,
+ Icons v${packageJson.version}
`,
brandUrl: 'https://gravity-ui.com',
}),
});
diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html
new file mode 100644
index 0000000..e581afd
--- /dev/null
+++ b/.storybook/preview-head.html
@@ -0,0 +1,2 @@
+
+
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index 7b3a275..a0682d6 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -1,29 +1,22 @@
+// eslint-disable-next-line import/order
+import '@gravity-ui/uikit/styles/fonts.css';
+// eslint-disable-next-line import/order
import '@gravity-ui/uikit/styles/styles.css';
import React from 'react';
-import type {DecoratorFn} from '@storybook/react';
+import type {Decorator, Preview} from '@storybook/react';
import {ThemeProvider} from '@gravity-ui/uikit';
-const withThemeProvider: DecoratorFn = (Story, context) => {
+const withThemeProvider: Decorator = (Story, context) => {
return (
-
+
);
};
-export const decorators = [withThemeProvider];
-
-export const globalTypes = {
- theme: {
- name: 'Theme',
- defaultValue: 'light',
- toolbar: {
- icon: 'mirror',
- items: [
- {value: 'light', right: '☼', title: 'Light'},
- {value: 'dark', right: '☾', title: 'Dark'},
- ],
- },
- },
+const preview: Preview = {
+ decorators: [withThemeProvider],
};
+
+export default preview;
diff --git a/.storybook/src/IconTooltip/IconTooltip.tsx b/.storybook/src/IconTooltip/IconTooltip.tsx
index cd97ad2..475b03d 100644
--- a/.storybook/src/IconTooltip/IconTooltip.tsx
+++ b/.storybook/src/IconTooltip/IconTooltip.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import {cn} from '../cn';
-import {Popover, PopoverInstanceProps, Label} from '@gravity-ui/uikit';
+import {Label, Popover, PopoverInstanceProps} from '@gravity-ui/uikit';
import './IconTooltip.scss';
@@ -21,7 +21,7 @@ export function IconTooltip({
forceOpen,
children,
}: IconTooltipProps) {
- const popoverRef = React.useRef();
+ const popoverRef = React.useRef(null);
const content = React.useMemo(
() => (
diff --git a/.storybook/src/Showcase.stories.tsx b/.storybook/src/Showcase.stories.tsx
index ae419e1..922e8dc 100644
--- a/.storybook/src/Showcase.stories.tsx
+++ b/.storybook/src/Showcase.stories.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import {cn} from './cn';
-import {Meta, Story} from '@storybook/react';
+import {Meta, StoryFn} from '@storybook/react';
import {Button, Icon as IconWrapper} from '@gravity-ui/uikit';
import {IconTooltip} from './IconTooltip/IconTooltip';
import metadata from '../../metadata.json';
@@ -27,10 +27,10 @@ const iconsMetadataByName = (metadata.icons as IconMeta[]).reduce(
{} as Record,
);
-export const Showcase: Story = () => {
+export const Showcase: StoryFn = () => {
const [search, setSearch] = React.useState('');
const items = libContext.keys().map((path) => {
- const module = libContext(path);
+ const module = libContext(path) as any;
const Icon = module.default || module;
const name = path.match(/(\w+)\.tsx$/)?.[1] ?? '';
const meta = iconsMetadataByName[name];
diff --git a/.storybook/tsconfig.json b/.storybook/tsconfig.json
index 82ea031..4def68d 100644
--- a/.storybook/tsconfig.json
+++ b/.storybook/tsconfig.json
@@ -2,10 +2,11 @@
"extends": "..",
"compilerOptions": {
"module": "commonjs",
- "target": "ES2017",
- "resolveJsonModule": true
+ "target": "ES2017"
},
"include": [
- "src"
+ "src",
+ "../node_modules/webpack/module.d.ts",
+ "../package.json"
]
}
diff --git a/commitlint.config.js b/commitlint.config.js
index 3347cb9..0fca76f 100644
--- a/commitlint.config.js
+++ b/commitlint.config.js
@@ -1 +1 @@
-module.exports = {extends: ['@commitlint/config-conventional']};
+export default {extends: ['@commitlint/config-conventional']};
diff --git a/lib/AbbrApi.tsx b/lib/AbbrApi.tsx
index 6c1a366..6de5859 100644
--- a/lib/AbbrApi.tsx
+++ b/lib/AbbrApi.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {SVGProps} from 'react';
+import type {SVGProps} from 'react';
const AbbrApi = (props: SVGProps) => (