@gravity-ui/charts 1.38.5 → 1.38.7

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.
Files changed (69) hide show
  1. package/dist/cjs/components/AxisX/prepare-axis-data.d.ts +1 -1
  2. package/dist/cjs/components/AxisX/prepare-axis-data.js +10 -9
  3. package/dist/cjs/components/AxisY/prepare-axis-data.d.ts +1 -1
  4. package/dist/cjs/components/AxisY/prepare-axis-data.js +2 -2
  5. package/dist/cjs/components/ChartInner/index.js +8 -3
  6. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +18 -19
  7. package/dist/cjs/components/ChartInner/useChartInnerProps.js +232 -138
  8. package/dist/cjs/components/ChartInner/useChartInnerState.js +2 -1
  9. package/dist/cjs/components/Legend/index.d.ts +1 -1
  10. package/dist/cjs/components/Legend/index.js +1 -1
  11. package/dist/cjs/hooks/useAxis/index.d.ts +40 -5
  12. package/dist/cjs/hooks/useAxis/index.js +55 -41
  13. package/dist/cjs/hooks/useAxis/types.d.ts +0 -2
  14. package/dist/cjs/hooks/useAxisScales/index.d.ts +4 -0
  15. package/dist/cjs/hooks/useAxisScales/index.js +1 -1
  16. package/dist/cjs/hooks/useChartDimensions/index.d.ts +1 -1
  17. package/dist/cjs/hooks/useChartDimensions/index.js +14 -29
  18. package/dist/cjs/hooks/useCrosshair/index.d.ts +1 -1
  19. package/dist/cjs/hooks/useNormalizedOriginalData/index.d.ts +29 -34
  20. package/dist/cjs/hooks/useNormalizedOriginalData/index.js +19 -30
  21. package/dist/cjs/hooks/useSeries/index.d.ts +10 -14
  22. package/dist/cjs/hooks/useSeries/index.js +8 -80
  23. package/dist/cjs/hooks/useShapes/index.d.ts +4 -0
  24. package/dist/cjs/hooks/useShapes/index.js +194 -189
  25. package/dist/cjs/hooks/useSplit/index.d.ts +5 -2
  26. package/dist/cjs/hooks/useSplit/index.js +27 -30
  27. package/dist/cjs/hooks/useYAxisLabelWidth/index.d.ts +39 -6
  28. package/dist/cjs/hooks/useYAxisLabelWidth/index.js +30 -43
  29. package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
  30. package/dist/cjs/hooks/useZoom/index.js +2 -2
  31. package/dist/cjs/utils/chart/axis/common.d.ts +1 -1
  32. package/dist/cjs/utils/chart/axis/common.js +1 -1
  33. package/dist/esm/components/AxisX/prepare-axis-data.d.ts +1 -1
  34. package/dist/esm/components/AxisX/prepare-axis-data.js +10 -9
  35. package/dist/esm/components/AxisY/prepare-axis-data.d.ts +1 -1
  36. package/dist/esm/components/AxisY/prepare-axis-data.js +2 -2
  37. package/dist/esm/components/ChartInner/index.js +8 -3
  38. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +18 -19
  39. package/dist/esm/components/ChartInner/useChartInnerProps.js +232 -138
  40. package/dist/esm/components/ChartInner/useChartInnerState.js +2 -1
  41. package/dist/esm/components/Legend/index.d.ts +1 -1
  42. package/dist/esm/components/Legend/index.js +1 -1
  43. package/dist/esm/hooks/useAxis/index.d.ts +40 -5
  44. package/dist/esm/hooks/useAxis/index.js +55 -41
  45. package/dist/esm/hooks/useAxis/types.d.ts +0 -2
  46. package/dist/esm/hooks/useAxisScales/index.d.ts +4 -0
  47. package/dist/esm/hooks/useAxisScales/index.js +1 -1
  48. package/dist/esm/hooks/useChartDimensions/index.d.ts +1 -1
  49. package/dist/esm/hooks/useChartDimensions/index.js +14 -29
  50. package/dist/esm/hooks/useCrosshair/index.d.ts +1 -1
  51. package/dist/esm/hooks/useNormalizedOriginalData/index.d.ts +29 -34
  52. package/dist/esm/hooks/useNormalizedOriginalData/index.js +19 -30
  53. package/dist/esm/hooks/useSeries/index.d.ts +10 -14
  54. package/dist/esm/hooks/useSeries/index.js +8 -80
  55. package/dist/esm/hooks/useShapes/index.d.ts +4 -0
  56. package/dist/esm/hooks/useShapes/index.js +194 -189
  57. package/dist/esm/hooks/useSplit/index.d.ts +5 -2
  58. package/dist/esm/hooks/useSplit/index.js +27 -30
  59. package/dist/esm/hooks/useYAxisLabelWidth/index.d.ts +39 -6
  60. package/dist/esm/hooks/useYAxisLabelWidth/index.js +30 -43
  61. package/dist/esm/hooks/useZoom/index.d.ts +1 -1
  62. package/dist/esm/hooks/useZoom/index.js +2 -2
  63. package/dist/esm/utils/chart/axis/common.d.ts +1 -1
  64. package/dist/esm/utils/chart/axis/common.js +1 -1
  65. package/package.json +1 -1
  66. package/dist/cjs/components/ChartInner/useLegend.d.ts +0 -14
  67. package/dist/cjs/components/ChartInner/useLegend.js +0 -34
  68. package/dist/esm/components/ChartInner/useLegend.d.ts +0 -14
  69. package/dist/esm/components/ChartInner/useLegend.js +0 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.38.5",
3
+ "version": "1.38.7",
4
4
  "description": "A flexible JavaScript library for data visualization and chart rendering using React",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -1,14 +0,0 @@
1
- import type { LegendItem, PreparedChart, PreparedLegend, PreparedSeries } from '../../hooks';
2
- import type { LegendConfig } from '../../types';
3
- type LegendState = {
4
- legendConfig?: LegendConfig;
5
- legendItems: LegendItem[][];
6
- };
7
- export declare function useLegend({ preparedLegend, preparedChart, preparedSeries, width, height, }: {
8
- preparedLegend: PreparedLegend | null;
9
- preparedChart: PreparedChart;
10
- preparedSeries: PreparedSeries[];
11
- width: number;
12
- height: number;
13
- }): LegendState;
14
- export {};
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import isEqual from 'lodash/isEqual';
3
- import { getLegendComponents } from '../../hooks/useSeries/prepare-legend';
4
- export function useLegend({ preparedLegend, preparedChart, preparedSeries, width, height, }) {
5
- const [legendState, setLegend] = React.useState({
6
- legendConfig: undefined,
7
- legendItems: [],
8
- });
9
- const legendStateRunRef = React.useRef(0);
10
- const prevLegendStateValue = React.useRef(legendState);
11
- React.useEffect(() => {
12
- legendStateRunRef.current++;
13
- const currentRun = legendStateRunRef.current;
14
- if (!preparedLegend) {
15
- return;
16
- }
17
- (async function () {
18
- const newStateValue = await getLegendComponents({
19
- chartWidth: width,
20
- chartHeight: height,
21
- chartMargin: preparedChart.margin,
22
- series: preparedSeries,
23
- preparedLegend,
24
- });
25
- if (legendStateRunRef.current === currentRun) {
26
- if (!isEqual(prevLegendStateValue.current, newStateValue)) {
27
- setLegend(newStateValue);
28
- prevLegendStateValue.current = newStateValue;
29
- }
30
- }
31
- })();
32
- }, [height, preparedChart.margin, preparedLegend, preparedSeries, width]);
33
- return legendState;
34
- }
@@ -1,14 +0,0 @@
1
- import type { LegendItem, PreparedChart, PreparedLegend, PreparedSeries } from '../../hooks';
2
- import type { LegendConfig } from '../../types';
3
- type LegendState = {
4
- legendConfig?: LegendConfig;
5
- legendItems: LegendItem[][];
6
- };
7
- export declare function useLegend({ preparedLegend, preparedChart, preparedSeries, width, height, }: {
8
- preparedLegend: PreparedLegend | null;
9
- preparedChart: PreparedChart;
10
- preparedSeries: PreparedSeries[];
11
- width: number;
12
- height: number;
13
- }): LegendState;
14
- export {};
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import isEqual from 'lodash/isEqual';
3
- import { getLegendComponents } from '../../hooks/useSeries/prepare-legend';
4
- export function useLegend({ preparedLegend, preparedChart, preparedSeries, width, height, }) {
5
- const [legendState, setLegend] = React.useState({
6
- legendConfig: undefined,
7
- legendItems: [],
8
- });
9
- const legendStateRunRef = React.useRef(0);
10
- const prevLegendStateValue = React.useRef(legendState);
11
- React.useEffect(() => {
12
- legendStateRunRef.current++;
13
- const currentRun = legendStateRunRef.current;
14
- if (!preparedLegend) {
15
- return;
16
- }
17
- (async function () {
18
- const newStateValue = await getLegendComponents({
19
- chartWidth: width,
20
- chartHeight: height,
21
- chartMargin: preparedChart.margin,
22
- series: preparedSeries,
23
- preparedLegend,
24
- });
25
- if (legendStateRunRef.current === currentRun) {
26
- if (!isEqual(prevLegendStateValue.current, newStateValue)) {
27
- setLegend(newStateValue);
28
- prevLegendStateValue.current = newStateValue;
29
- }
30
- }
31
- })();
32
- }, [height, preparedChart.margin, preparedLegend, preparedSeries, width]);
33
- return legendState;
34
- }