From afb230036bb26573159e5f03e0972653b6692d86 Mon Sep 17 00:00:00 2001 From: "Mr.Dr.Professor Patrick" Date: Sat, 1 Oct 2022 16:02:50 +0600 Subject: [PATCH] feat: use gravity-ui/uikit instead of yandex-cloud/uikit (#46) --- .storybook/contextDecorator.tsx | 2 +- .storybook/preview.js | 2 +- README.md | 4 +- package-lock.json | 87 ++++++++++--------- package.json | 4 +- src/components/ChartKit.tsx | 2 +- src/components/Loader/Loader.tsx | 2 +- src/libs/settings/settings.ts | 2 + .../__stories__/Indicator.stories.tsx | 2 +- src/plugins/yagr/__stories__/Yagr.stories.tsx | 2 +- src/plugins/yagr/renderer/YagrWidget.tsx | 2 +- 11 files changed, 57 insertions(+), 54 deletions(-) diff --git a/.storybook/contextDecorator.tsx b/.storybook/contextDecorator.tsx index 8f9cac97..907955ba 100644 --- a/.storybook/contextDecorator.tsx +++ b/.storybook/contextDecorator.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {Story as StoryType, StoryContext} from '@storybook/react'; -import {ThemeProvider, MobileProvider, useTheme, useMobile} from '@yandex-cloud/uikit'; +import {ThemeProvider, MobileProvider, useTheme, useMobile} from '@gravity-ui/uikit'; import {settings} from '../src/libs'; export function withContext(Story: StoryType, context: StoryContext) { diff --git a/.storybook/preview.js b/.storybook/preview.js index bda58332..abee26a6 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,7 +1,7 @@ import {MINIMAL_VIEWPORTS} from '@storybook/addon-viewport'; import {withContext} from './contextDecorator'; -import '@yandex-cloud/uikit/styles/styles.scss'; +import '@gravity-ui/uikit/styles/styles.scss'; export const decorators = [withContext]; diff --git a/README.md b/README.md index b666fd7d..80061e57 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ React component used to render charts based on any sources you need ## Install ```shell -npm i --save-dev @yandex-cloud/chartkit @yandex-cloud/uikit @yandex-cloud/i18n +npm i --save-dev @yandex-cloud/chartkit @gravity-ui/uikit @yandex-cloud/i18n ``` ## Usage ```typescript -import {ThemeProvider} from '@yandex-cloud/uikit'; +import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@yandex-cloud/chartkit'; import {YagrPlugin, YagrWidgetData} from '@yandex-cloud/chartkit/build/plugins'; diff --git a/package-lock.json b/package-lock.json index d267c569..4ef8bfa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2528,6 +2528,50 @@ "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "dev": true }, + "@gravity-ui/i18n": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@gravity-ui/i18n/-/i18n-1.0.0.tgz", + "integrity": "sha512-KNYNhQjA9XqLo0RVEwNRqdA7/Lx5LLrNDtqWCvOGzXTwKU0GFNlWJaoSvk7u97apag23nTxgmpk551FlRCfehA==", + "dev": true + }, + "@gravity-ui/uikit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@gravity-ui/uikit/-/uikit-3.0.2.tgz", + "integrity": "sha512-BTkAPgvltxSdrOACkXec4IBpF5eHofHyMgV9oC7+Hj0U7oy4kmvpxVX0syGjM04EoPtThlDjNdPQuQh9q7AtDw==", + "dev": true, + "requires": { + "@gravity-ui/i18n": "^1.0.0", + "@popperjs/core": "2.11.2", + "bem-cn-lite": "4.0.0", + "focus-trap": "6.7.2", + "lodash": "4.17.21", + "react-copy-to-clipboard": "5.0.4", + "react-popper": "2.2.5", + "react-sortable-hoc": "2.0.0", + "react-virtualized-auto-sizer": "1.0.6", + "react-window": "1.8.6", + "resize-observer-polyfill": "1.5.1", + "tslib": "2.3.1", + "utility-types": "3.10.0" + }, + "dependencies": { + "bem-cn-lite": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/bem-cn-lite/-/bem-cn-lite-4.0.0.tgz", + "integrity": "sha512-ylyWbX63PqhJvm9xGcLAoiKYi87T5g4r5g6sx0dZHcvCtgYvnOWvVTZOQp+uB2DF8ZXsejnPkySvzKnsQhuOAg==", + "dev": true, + "requires": { + "bem-cn": "^3.0.1" + } + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", + "dev": true + } + } + }, "@humanwhocodes/config-array": { "version": "0.9.5", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", @@ -8009,49 +8053,6 @@ "integrity": "sha512-fBMHxFHypWHa+IRzhLTcpSv9pg8sAyUhMqWkilhp/3M7PQ3pjAufkFGyqp6CSdb7a0u4p8pYL8CqG6ePV5OJRQ==", "dev": true }, - "@yandex-cloud/uikit": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@yandex-cloud/uikit/-/uikit-2.7.0.tgz", - "integrity": "sha512-FH3bgtoTlFfYl6fkmqUcVs17aGDPzM192UUVoz//pjdNy2zhjzvB+VApFzUcrSOudyqjRrabpC0jNhglMqcvKQ==", - "dev": true, - "requires": { - "@popperjs/core": "2.11.2", - "bem-cn-lite": "4.0.0", - "focus-trap": "6.7.2", - "lodash": "4.17.21", - "react-copy-to-clipboard": "5.0.4", - "react-popper": "2.2.5", - "react-sortable-hoc": "2.0.0", - "react-virtualized-auto-sizer": "1.0.6", - "react-window": "1.8.6", - "resize-observer-polyfill": "1.5.1", - "tslib": "2.3.1", - "utility-types": "3.10.0" - }, - "dependencies": { - "bem-cn-lite": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/bem-cn-lite/-/bem-cn-lite-4.0.0.tgz", - "integrity": "sha512-ylyWbX63PqhJvm9xGcLAoiKYi87T5g4r5g6sx0dZHcvCtgYvnOWvVTZOQp+uB2DF8ZXsejnPkySvzKnsQhuOAg==", - "dev": true, - "requires": { - "bem-cn": "^3.0.1" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", - "dev": true - } - } - }, "abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", diff --git a/package.json b/package.json index f9b8e9be..6526a970 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "yagr": "1.3.7" }, "devDependencies": { + "@gravity-ui/uikit": "^3.0.2", "@storybook/addon-essentials": "^6.5.9", "@storybook/addon-knobs": "^6.4.0", "@storybook/preset-scss": "^1.0.3", @@ -33,7 +34,6 @@ "@yandex-cloud/prettier-config": "^1.0.0", "@yandex-cloud/stylelint-config": "^1.2.0", "@yandex-cloud/tsconfig": "^1.0.0", - "@yandex-cloud/uikit": "^2.7.0", "eslint": "^8.11.0", "gulp": "^4.0.2", "gulp-cli": "^2.3.0", @@ -59,7 +59,7 @@ "peerDependencies": { "react": "^16.0.0 || ^17.0.0", "moment": "^2.19.3", - "@yandex-cloud/uikit": "^2.0.0", + "@gravity-ui/uikit": "^3.0.0", "@yandex-cloud/i18n": "^0.5.0" }, "scripts": { diff --git a/src/components/ChartKit.tsx b/src/components/ChartKit.tsx index c7be6670..c1be72dc 100644 --- a/src/components/ChartKit.tsx +++ b/src/components/ChartKit.tsx @@ -7,7 +7,7 @@ import type {ChartkitType, ChartKitRef, ChartKitWidgetRef, ChartKitProps} from ' import {ErrorBoundary} from './ErrorBoundary/ErrorBoundary'; import {Loader} from './Loader/Loader'; -import '@yandex-cloud/uikit/styles/styles.scss'; +import '@gravity-ui/uikit/styles/styles.scss'; import './ChartKit.scss'; const b = block('chartkit'); diff --git a/src/components/Loader/Loader.tsx b/src/components/Loader/Loader.tsx index 09440c5b..b92065e5 100644 --- a/src/components/Loader/Loader.tsx +++ b/src/components/Loader/Loader.tsx @@ -1,6 +1,6 @@ import React from 'react'; import block from 'bem-cn-lite'; -import {Loader as BaseLoader, LoaderProps as BaseLoaderProps} from '@yandex-cloud/uikit'; +import {Loader as BaseLoader, LoaderProps as BaseLoaderProps} from '@gravity-ui/uikit'; import './Loader.scss'; diff --git a/src/libs/settings/settings.ts b/src/libs/settings/settings.ts index 9ebbb5b7..08ba1401 100644 --- a/src/libs/settings/settings.ts +++ b/src/libs/settings/settings.ts @@ -1,4 +1,5 @@ import moment from 'moment'; +import {configure} from '@gravity-ui/uikit'; import {i18nFactory} from '../../i18n'; import type {ChartKitPlugin, ChartKitLang} from '../../types'; @@ -29,6 +30,7 @@ const updateLocale = (args: {lang: ChartKitLang; locale?: moment.LocaleSpecifica } moment.locale(lang); + configure({lang}); i18nFactory.setLang(lang); }; diff --git a/src/plugins/indicator/__stories__/Indicator.stories.tsx b/src/plugins/indicator/__stories__/Indicator.stories.tsx index 8d0a578e..c7611b77 100644 --- a/src/plugins/indicator/__stories__/Indicator.stories.tsx +++ b/src/plugins/indicator/__stories__/Indicator.stories.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {Meta, Story} from '@storybook/react'; import {withKnobs, boolean, color as colorKnob, radios, text} from '@storybook/addon-knobs'; import {cloneDeep} from 'lodash'; -import {Button} from '@yandex-cloud/uikit'; +import {Button} from '@gravity-ui/uikit'; import {settings} from '../../../libs'; import {ChartKit} from '../../../components/ChartKit'; import type {ChartKitRef} from '../../../types'; diff --git a/src/plugins/yagr/__stories__/Yagr.stories.tsx b/src/plugins/yagr/__stories__/Yagr.stories.tsx index 7a7a81a9..88136bb2 100644 --- a/src/plugins/yagr/__stories__/Yagr.stories.tsx +++ b/src/plugins/yagr/__stories__/Yagr.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {Meta, Story} from '@storybook/react'; -import {Button} from '@yandex-cloud/uikit'; +import {Button} from '@gravity-ui/uikit'; import {settings} from '../../../libs'; import {YagrPlugin} from '../../../plugins'; import {ChartKit} from '../../../components/ChartKit'; diff --git a/src/plugins/yagr/renderer/YagrWidget.tsx b/src/plugins/yagr/renderer/YagrWidget.tsx index 32dd07b0..2de8bfbe 100644 --- a/src/plugins/yagr/renderer/YagrWidget.tsx +++ b/src/plugins/yagr/renderer/YagrWidget.tsx @@ -1,7 +1,7 @@ import React from 'react'; import moment from 'moment'; import debounce from 'lodash/debounce'; -import {useThemeValue} from '@yandex-cloud/uikit'; +import {useThemeValue} from '@gravity-ui/uikit'; import YagrComponent, {YagrChartProps} from 'yagr/dist/react'; import { YagrConfig,