@gravity-ui/chartkit 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.13.0](https://github.com/gravity-ui/chartkit/compare/v0.12.3...v0.13.0) (2022-12-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * remove direct import @gravity-ui/uikit styles in ChartKit component ([#80](https://github.com/gravity-ui/chartkit/issues/80)) ([49642d7](https://github.com/gravity-ui/chartkit/commit/49642d7cfbd358a399ead674b2d3a040b05bf669))
9
+
10
+ ## [0.12.3](https://github.com/gravity-ui/chartkit/compare/v0.12.2...v0.12.3) (2022-12-01)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **Yagr:** added common no-data case handling ([#78](https://github.com/gravity-ui/chartkit/issues/78)) ([100efaa](https://github.com/gravity-ui/chartkit/commit/100efaaff20e03048146ca084ee91c2be2568640))
16
+
3
17
  ## [0.12.2](https://github.com/gravity-ui/chartkit/compare/v0.12.1...v0.12.2) (2022-11-30)
4
18
 
5
19
 
package/README.md CHANGED
@@ -8,6 +8,12 @@ React component used to render charts based on any sources you need
8
8
  npm i --save-dev @gravity-ui/chartkit @gravity-ui/uikit
9
9
  ```
10
10
 
11
+ Make sure you have `@gravity-ui/uikit` styles enabled in your project.
12
+
13
+ ```typescript
14
+ import '@gravity-ui/uikit/styles/styles.scss';
15
+ ```
16
+
11
17
  ## Usage
12
18
 
13
19
  ```typescript
@@ -15,6 +21,8 @@ import {ThemeProvider} from '@gravity-ui/uikit';
15
21
  import ChartKit, {settings} from '@gravity-ui/chartkit';
16
22
  import {YagrPlugin, YagrWidgetData} from '@gravity-ui/chartkit/build/plugins';
17
23
 
24
+ import '@gravity-ui/uikit/styles/styles.scss';
25
+
18
26
  settings.set({plugins: [YagrPlugin]});
19
27
 
20
28
  const data: YagrWidgetData = {
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { ChartKitType, ChartKitRef, ChartKitProps } from '../types';
3
- import '@gravity-ui/uikit/styles/styles.css';
4
3
  import './ChartKit.css';
5
4
  declare type ChartKitComponentProps<T extends ChartKitType> = Omit<ChartKitProps<T>, 'onError'> & {
6
5
  instanceRef?: React.ForwardedRef<ChartKitRef | undefined>;
@@ -6,7 +6,6 @@ import { CHARTKIT_ERROR_CODE, ChartKitError, settings } from '../libs';
6
6
  import { getRandomCKId, typedMemo } from '../utils';
7
7
  import { ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
8
8
  import { Loader } from './Loader/Loader';
9
- import '@gravity-ui/uikit/styles/styles.css';
10
9
  import './ChartKit.css';
11
10
  const b = block('chartkit');
12
11
  const ChartKitComponent = (props) => {
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import moment from 'moment';
3
3
  import debounce from 'lodash/debounce';
4
+ import isEmpty from 'lodash/isEmpty';
4
5
  import { useThemeType } from '@gravity-ui/uikit';
5
6
  import YagrComponent from 'yagr/dist/react';
6
7
  import { defaults, } from 'yagr';
7
- import { settings } from '../../../libs';
8
+ import { i18n } from '../../../i18n';
9
+ import { settings, CHARTKIT_ERROR_CODE, ChartKitError } from '../../../libs';
8
10
  import { formatTooltip } from './tooltip/tooltip';
9
11
  import { synchronizeTooltipTablesCellsWidth } from './synchronizeTooltipTablesCellsWidth';
10
12
  import './polyfills';
@@ -81,6 +83,12 @@ const YagrWidget = React.forwardRef((props, forwardedRef) => {
81
83
  const { data, libraryConfig } = props.data;
82
84
  const { id, onLoad } = props;
83
85
  const theme = useThemeType();
86
+ if (!data || isEmpty(data)) {
87
+ throw new ChartKitError({
88
+ code: CHARTKIT_ERROR_CODE.NO_DATA,
89
+ message: i18n('error', 'label_no-data'),
90
+ });
91
+ }
84
92
  const handlers = {
85
93
  mouseMove: null,
86
94
  mouseDown: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "description": "React component used to render charts based on any sources you need",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:gravity-ui/ChartKit.git",