@gravity-ui/chartkit 6.1.1 → 7.0.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.
@@ -6,4 +6,4 @@ export * from './types';
6
6
  *
7
7
  * DO NOT USE IT IN YOUR PRODUCTION
8
8
  * */
9
- export declare const D3Plugin: ChartKitPlugin;
9
+ export declare const GravityChartsPlugin: ChartKitPlugin;
@@ -6,8 +6,7 @@ export * from './types';
6
6
  *
7
7
  * DO NOT USE IT IN YOUR PRODUCTION
8
8
  * */
9
- export const D3Plugin = {
10
- // TODO: rename to 'gravity-chart' in the next major
11
- type: 'd3',
12
- renderer: React.lazy(() => import('./renderer/D3Widget')),
9
+ export const GravityChartsPlugin = {
10
+ type: 'gravity-charts',
11
+ renderer: React.lazy(() => import('./renderer/GravityChartsWidget')),
13
12
  };
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { ChartKitWidgetRef } from '../../../types';
3
- declare const D3Widget: React.ForwardRefExoticComponent<{
4
- type: "d3";
3
+ export declare const GravityChartsWidget: React.ForwardRefExoticComponent<{
4
+ type: "gravity-charts";
5
5
  data: import("@gravity-ui/charts").ChartData<any>;
6
6
  id?: string | undefined;
7
7
  isMobile?: boolean | undefined;
8
- onLoad?: ((data?: import("../../../types").ChartKitOnLoadData<"d3"> | undefined) => void) | undefined;
8
+ onLoad?: ((data?: import("../../../types").ChartKitOnLoadData<"gravity-charts"> | undefined) => void) | undefined;
9
9
  onRender?: ((data: import("../../../types").ChartKitOnRenderData) => void) | undefined;
10
- onChartLoad?: ((data: import("../../../types").ChartKitOnChartLoad<"d3">) => void) | undefined;
10
+ onChartLoad?: ((data: import("../../../types").ChartKitOnChartLoad<"gravity-charts">) => void) | undefined;
11
11
  onError?: import("../../../types").ChartKitOnError | undefined;
12
12
  renderError?: import("../../../types").RenderError | undefined;
13
13
  renderPluginLoader?: import("../../../types").ChartKitRenderPluginLoader | undefined;
@@ -16,4 +16,4 @@ declare const D3Widget: React.ForwardRefExoticComponent<{
16
16
  splitted?: boolean | undefined;
17
17
  } | undefined;
18
18
  } & React.RefAttributes<ChartKitWidgetRef | undefined>>;
19
- export default D3Widget;
19
+ export default GravityChartsWidget;
@@ -5,7 +5,7 @@ import { settings } from '../../../libs';
5
5
  import { measurePerformance } from '../../../utils';
6
6
  import { withSplitPane } from './withSplitPane/withSplitPane';
7
7
  const ChartWithSplitPane = withSplitPane(Chart);
8
- const D3Widget = React.forwardRef(function D3Widget(props, forwardedRef) {
8
+ export const GravityChartsWidget = React.forwardRef(function GravityChartsWidget(props, forwardedRef) {
9
9
  const { data, tooltip, onLoad, onRender, onChartLoad } = props;
10
10
  const lang = settings.get('lang');
11
11
  const performanceMeasure = React.useRef(measurePerformance());
@@ -43,4 +43,4 @@ const D3Widget = React.forwardRef(function D3Widget(props, forwardedRef) {
43
43
  }, [onChartLoad]);
44
44
  return React.createElement(ChartComponent, { ref: chartRef, data: data, lang: lang, onResize: handleResize });
45
45
  });
46
- export default D3Widget;
46
+ export default GravityChartsWidget;
@@ -7,6 +7,7 @@ import { usePrevious } from '../../../../hooks';
7
7
  import { isScreenOrientationEventType } from '../../../../utils';
8
8
  import { TooltipContent } from './TooltipContent';
9
9
  import { RESIZER_HEIGHT, getVerticalSize, useWithSplitPaneState } from './useWithSplitPaneState';
10
+ const tooltipPaneStyles = { overflow: 'auto' };
10
11
  export function withSplitPane(ChartComponent) {
11
12
  const componentName = getComponentName(ChartComponent);
12
13
  const component = React.forwardRef(function WithSplitPaneComponent(props, _ref) {
@@ -93,7 +94,7 @@ export function withSplitPane(ChartComponent) {
93
94
  }, [handleOrientationChange, handleScreenOrientationChange]);
94
95
  return (React.createElement("div", { ref: containerRef, style: { position: 'relative', height: '100%' } },
95
96
  React.createElement(StyledSplitPane, { allowResize: allowResize, maxSize: maxSize, minSize: minSize, size: size, split: split, onChange: handleSizeChange, paneOneRender: () => (React.createElement(ChartComponent, Object.assign({}, restProps, { ref: chartRef, data: resultData }))), paneTwoRender: () => (React.createElement("div", { ref: tooltipContainerRef },
96
- React.createElement(TooltipContent, { ref: tooltipRef, renderer: resultData.tooltip.renderer }))) })));
97
+ React.createElement(TooltipContent, { ref: tooltipRef, renderer: resultData.tooltip.renderer }))), pane2Style: tooltipPaneStyles })));
97
98
  });
98
99
  component.displayName = `withSplitPane(${componentName})`;
99
100
  return component;
@@ -1,4 +1,4 @@
1
1
  import type { ChartData } from '@gravity-ui/charts';
2
- export type D3WidgetData = {
2
+ export type GravityChartsWidgetData = {
3
3
  data: ChartData;
4
4
  };
@@ -13,6 +13,7 @@ const CHART_SECTION_PERCENTAGE = 0.6;
13
13
  const MIN_TOOLTIP_SECTION_HEIGHT = 62;
14
14
  const seriesTypesNeedsOnlyHoverState = ['line', 'area', 'arearange', 'bubble', 'map'];
15
15
  const deviceWithNavBarHeight = window.innerHeight;
16
+ const tooltipPaneStyles = { overflow: 'auto' };
16
17
  function getPointsForInitialRefresh(chart) {
17
18
  let minX = Infinity;
18
19
  let points = null;
@@ -202,12 +203,12 @@ export const withSplitPane = (ComposedComponent) => {
202
203
  renderHorizontal() {
203
204
  const { paneSize, maxPaneSize, componentKey } = this.state;
204
205
  const thirdOfViewport = window.innerHeight / 3;
205
- return (React.createElement(StyledSplitPane, { split: "horizontal", onChange: this.debouncedHandlePaneChange, minSize: thirdOfViewport, maxSize: maxPaneSize || undefined, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
206
+ return (React.createElement(StyledSplitPane, { split: "horizontal", onChange: this.debouncedHandlePaneChange, minSize: thirdOfViewport, maxSize: maxPaneSize || undefined, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }), pane2Style: tooltipPaneStyles }));
206
207
  }
207
208
  renderVertical() {
208
209
  const { componentKey } = this.state;
209
210
  const paneSize = window.innerWidth * CHART_SECTION_PERCENTAGE;
210
- return (React.createElement(StyledSplitPane, { split: "vertical", allowResize: false, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
211
+ return (React.createElement(StyledSplitPane, { split: "vertical", allowResize: false, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }), pane2Style: tooltipPaneStyles }));
211
212
  }
212
213
  }
213
214
  return React.forwardRef((props, ref) => {
@@ -32,7 +32,7 @@ export interface ChartKitWidget {
32
32
  forceUpdate: boolean;
33
33
  }, callExternalOnChange?: boolean) => void;
34
34
  };
35
- d3: {
35
+ 'gravity-charts': {
36
36
  data: ChartData;
37
37
  widget: never;
38
38
  tooltip?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "6.1.1",
3
+ "version": "7.0.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",
@@ -8,7 +8,7 @@
8
8
  "types": "build/index.d.ts",
9
9
  "exports": {
10
10
  ".": "./build/index.js",
11
- "./d3": "./build/plugins/d3/index.js",
11
+ "./gravity-charts": "./build/plugins/gravity-charts/index.js",
12
12
  "./highcharts": "./build/plugins/highcharts/index.js",
13
13
  "./indicator": "./build/plugins/indicator/index.js",
14
14
  "./yagr": "./build/plugins/yagr/index.js"
@@ -18,8 +18,8 @@
18
18
  "index.d.ts": [
19
19
  "./build/index.d.ts"
20
20
  ],
21
- "d3": [
22
- "./build/plugins/d3/index.d.ts"
21
+ "gravity-charts": [
22
+ "./build/plugins/gravity-charts/index.d.ts"
23
23
  ],
24
24
  "highcharts": [
25
25
  "./build/plugins/highcharts/index.d.ts"
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@bem-react/classname": "^1.6.0",
50
- "@gravity-ui/charts": "^0.8.0",
50
+ "@gravity-ui/charts": "^1.0.1",
51
51
  "@gravity-ui/date-utils": "^2.1.0",
52
52
  "@gravity-ui/i18n": "^1.0.0",
53
53
  "@gravity-ui/yagr": "^4.7.1",
File without changes