@gravity-ui/chartkit 3.0.0-beta.1 → 3.0.0-beta.11

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 (86) hide show
  1. package/build/components/ChartKit.css +19 -19
  2. package/build/components/ChartKit.d.ts +6 -4
  3. package/build/components/ChartKit.js +2 -2
  4. package/build/components/ErrorBoundary/ErrorBoundary.d.ts +2 -2
  5. package/build/components/Loader/Loader.d.ts +3 -3
  6. package/build/i18n/index.d.ts +2 -2
  7. package/build/libs/chartkit-error/chartkit-error.d.ts +1 -1
  8. package/build/libs/settings/__tests__/settings.test.js +2 -9
  9. package/build/libs/settings/eventEmitter.d.ts +11 -0
  10. package/build/libs/settings/eventEmitter.js +25 -0
  11. package/build/libs/settings/settings.d.ts +7 -4
  12. package/build/libs/settings/settings.js +8 -13
  13. package/build/plugins/highcharts/__stories__/Line.stories.d.ts +2 -3
  14. package/build/plugins/highcharts/__stories__/Pie.stories.d.ts +2 -3
  15. package/build/plugins/highcharts/__stories__/area/Range.stories.d.ts +2 -3
  16. package/build/plugins/highcharts/__stories__/area/Stacked.stories.d.ts +2 -3
  17. package/build/plugins/highcharts/__stories__/column/HorizontalStacked.stories.d.ts +2 -3
  18. package/build/plugins/highcharts/__stories__/column/Vertical.stories.d.ts +2 -3
  19. package/build/plugins/highcharts/__stories__/column/VerticalStacked.stories.d.ts +2 -3
  20. package/build/plugins/highcharts/__stories__/combined/ComboChartWithSameLegendValues.stories.d.ts +2 -3
  21. package/build/plugins/highcharts/__stories__/complex/TwoAxis.stories.d.ts +2 -3
  22. package/build/plugins/highcharts/__stories__/components/ChartStory.d.ts +1 -1
  23. package/build/plugins/highcharts/__stories__/custom-error-render/custom-error-render.stories.d.ts +2 -3
  24. package/build/plugins/highcharts/__stories__/no-data/no-data.stories.d.ts +2 -3
  25. package/build/plugins/highcharts/__stories__/pie/WithTotals.stories.d.ts +2 -3
  26. package/build/plugins/highcharts/mocks/complex.js +1 -1
  27. package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +3 -1
  28. package/build/plugins/highcharts/renderer/components/HighchartsComponent.d.ts +3 -3
  29. package/build/plugins/highcharts/renderer/components/HighchartsComponent.js +6 -0
  30. package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.css +1 -1
  31. package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.d.ts +3 -3
  32. package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +2 -5
  33. package/build/plugins/highcharts/renderer/helpers/config/config.d.ts +0 -1
  34. package/build/plugins/highcharts/renderer/helpers/config/config.js +14 -14
  35. package/build/plugins/highcharts/renderer/helpers/config/options.js +1 -1
  36. package/build/plugins/highcharts/renderer/helpers/config/types.d.ts +2 -2
  37. package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.d.ts +1 -1
  38. package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.d.ts +1 -1
  39. package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.d.ts +1 -1
  40. package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.d.ts +1 -1
  41. package/build/plugins/highcharts/renderer/helpers/config/utils/index.d.ts +33 -0
  42. package/build/plugins/highcharts/renderer/helpers/config/utils/index.js +8 -0
  43. package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.d.ts +1 -1
  44. package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.d.ts +1 -1
  45. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.d.ts +2 -2
  46. package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.js +2 -2
  47. package/build/plugins/highcharts/renderer/helpers/graph.css +4 -4
  48. package/build/plugins/highcharts/renderer/helpers/graph.d.ts +1 -1
  49. package/build/plugins/highcharts/renderer/helpers/graph.js +2 -2
  50. package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.d.ts +1 -0
  51. package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +5 -2
  52. package/build/plugins/highcharts/renderer/helpers/prepare-data.js +3 -3
  53. package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.d.ts +0 -2
  54. package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.js +0 -9
  55. package/build/plugins/highcharts/renderer/helpers/tooltip/index.d.ts +1 -1
  56. package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +4 -5
  57. package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.d.ts +1 -1
  58. package/build/plugins/highcharts/renderer/helpers/tooltip/tooltip.css +5 -5
  59. package/build/plugins/highcharts/renderer/helpers/tooltip/types.d.ts +3 -12
  60. package/build/plugins/highcharts/renderer/helpers/types.d.ts +2 -2
  61. package/build/plugins/highcharts/types/comments.d.ts +1 -1
  62. package/build/plugins/highcharts/types/misc.d.ts +4 -4
  63. package/build/plugins/highcharts/types/widget.d.ts +13 -5
  64. package/build/plugins/indicator/__stories__/Indicator.stories.d.ts +2 -2
  65. package/build/plugins/indicator/renderer/IndicatorItem.d.ts +2 -2
  66. package/build/plugins/indicator/renderer/IndicatorWidget.css +1 -1
  67. package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +3 -1
  68. package/build/plugins/indicator/types.d.ts +2 -2
  69. package/build/plugins/shared/format-number/i18n/i18n.d.ts +1 -1
  70. package/build/plugins/shared/format-number/types.d.ts +2 -2
  71. package/build/plugins/yagr/__stories__/Yagr.stories.d.ts +3 -4
  72. package/build/plugins/yagr/__stories__/Yagr.stories.js +3 -1
  73. package/build/plugins/yagr/renderer/YagrWidget.css +1 -1
  74. package/build/plugins/yagr/renderer/YagrWidget.d.ts +4 -1
  75. package/build/plugins/yagr/renderer/YagrWidget.js +13 -12
  76. package/build/plugins/yagr/renderer/tooltip/renderTooltip.js +2 -2
  77. package/build/plugins/yagr/renderer/tooltip/tooltip.css +14 -14
  78. package/build/plugins/yagr/renderer/tooltip/types.d.ts +4 -4
  79. package/build/plugins/yagr/renderer/utils.d.ts +1 -1
  80. package/build/plugins/yagr/renderer/utils.js +3 -3
  81. package/build/plugins/yagr/types.d.ts +2 -1
  82. package/build/types/index.d.ts +22 -22
  83. package/build/types/misc.d.ts +1 -1
  84. package/build/types/widget.d.ts +5 -1
  85. package/package.json +16 -11
  86. package/CHANGELOG.md +0 -489
@@ -1,5 +1,5 @@
1
1
  import { NavigatorLinesMode } from '../../constants';
2
- declare type AddShowInNavigatorToSeriesArgs = {
2
+ type AddShowInNavigatorToSeriesArgs = {
3
3
  linesMode: NavigatorLinesMode;
4
4
  graphs: Record<string, any>[];
5
5
  baseSeriesName: string;
@@ -1 +1 @@
1
- export declare const buildNavigatorFallback: (graphs: Record<string, any>[], baseSeriesName?: string | undefined) => void;
1
+ export declare const buildNavigatorFallback: (graphs: Record<string, any>[], baseSeriesName?: string) => void;
@@ -2,4 +2,4 @@ export declare const calculatePrecision: (alternativePrecision: number | null, o
2
2
  normalizeDiv: boolean;
3
3
  normalizeSub: boolean;
4
4
  precision?: number;
5
- }, originalValue?: number | undefined) => number | null | undefined;
5
+ }, originalValue?: number) => number | undefined;
@@ -1,3 +1,3 @@
1
1
  import type { FormatNumberOptions } from '../../../../../shared';
2
2
  import type { TooltipLine } from '../../tooltip/types';
3
- export declare const getFormatOptionsFromLine: (line?: Partial<TooltipLine> | undefined) => FormatNumberOptions | undefined;
3
+ export declare const getFormatOptionsFromLine: (line?: Partial<TooltipLine>) => FormatNumberOptions | undefined;
@@ -1,3 +1,4 @@
1
+ import type { HighchartsSortData } from '../../../../types/widget';
1
2
  export { addShowInNavigatorToSeries } from './addShowInNavigatorToSeries';
2
3
  export { buildNavigatorFallback } from './buildNavigatorFallback';
3
4
  export { calculatePrecision } from './calculatePrecision';
@@ -11,3 +12,35 @@ export { isSafari } from './isSafari';
11
12
  export { mergeArrayWithObject } from './mergeArrayWithObject';
12
13
  export { numberFormat } from './numberFormat';
13
14
  export { setNavigatorDefaultPeriod } from './setNavigatorDefaultPeriod';
15
+ export declare const getSortedData: <T extends Record<string, any>>(data: T[], sort?: HighchartsSortData) => (number | T | (() => IterableIterator<T>) | (() => {
16
+ copyWithin: boolean;
17
+ entries: boolean;
18
+ fill: boolean;
19
+ find: boolean;
20
+ findIndex: boolean;
21
+ keys: boolean;
22
+ values: boolean;
23
+ }) | (() => string) | (() => string) | (() => T | undefined) | ((...items: T[]) => number) | {
24
+ (...items: ConcatArray<T>[]): T[];
25
+ (...items: (T | ConcatArray<T>)[]): T[];
26
+ } | ((separator?: string | undefined) => string) | (() => T[]) | (() => T | undefined) | ((start?: number | undefined, end?: number | undefined) => T[]) | ((compareFn?: ((a: T, b: T) => number) | undefined) => T[]) | {
27
+ (start: number, deleteCount?: number | undefined): T[];
28
+ (start: number, deleteCount: number, ...items: T[]): T[];
29
+ } | ((...items: T[]) => number) | ((searchElement: T, fromIndex?: number | undefined) => number) | ((searchElement: T, fromIndex?: number | undefined) => number) | {
30
+ <S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[];
31
+ (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
32
+ } | ((predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any) => boolean) | ((callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any) => void) | (<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]) | {
33
+ <S_1 extends T>(predicate: (value: T, index: number, array: T[]) => value is S_1, thisArg?: any): S_1[];
34
+ (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
35
+ } | {
36
+ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
37
+ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
38
+ <U_1>(callbackfn: (previousValue: U_1, currentValue: T, currentIndex: number, array: T[]) => U_1, initialValue: U_1): U_1;
39
+ } | {
40
+ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
41
+ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
42
+ <U_2>(callbackfn: (previousValue: U_2, currentValue: T, currentIndex: number, array: T[]) => U_2, initialValue: U_2): U_2;
43
+ } | {
44
+ <S_2 extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S_2, thisArg?: any): S_2 | undefined;
45
+ (predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
46
+ } | ((predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any) => number) | ((value: T, start?: number | undefined, end?: number | undefined) => T[]) | ((target: number, start: number, end?: number | undefined) => T[]) | (() => IterableIterator<[number, T]>) | (() => IterableIterator<number>) | (() => IterableIterator<T>) | ((searchElement: T, fromIndex?: number | undefined) => boolean) | (<U_3, This = undefined>(callback: (this: This, value: T, index: number, array: T[]) => U_3 | readonly U_3[], thisArg?: This | undefined) => U_3[]) | (<A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[]) | ((index: number) => T | undefined))[];
@@ -1,3 +1,4 @@
1
+ import orderBy from 'lodash/orderBy';
1
2
  export { addShowInNavigatorToSeries } from './addShowInNavigatorToSeries';
2
3
  export { buildNavigatorFallback } from './buildNavigatorFallback';
3
4
  export { calculatePrecision } from './calculatePrecision';
@@ -11,3 +12,10 @@ export { isSafari } from './isSafari';
11
12
  export { mergeArrayWithObject } from './mergeArrayWithObject';
12
13
  export { numberFormat } from './numberFormat';
13
14
  export { setNavigatorDefaultPeriod } from './setNavigatorDefaultPeriod';
15
+ export const getSortedData = (data, sort = {}) => {
16
+ const { enabled = true, order = 'desc', iteratee = 'y' } = sort;
17
+ if (!enabled) {
18
+ return [...data];
19
+ }
20
+ return orderBy(data, iteratee, order);
21
+ };
@@ -1,2 +1,2 @@
1
1
  import type { Highcharts } from '../../../../types';
2
- export declare const isNavigatorSeries: (series?: Highcharts.Point | Highcharts.Series | undefined) => boolean;
2
+ export declare const isNavigatorSeries: (series?: Highcharts.Series | Highcharts.Point) => boolean;
@@ -1,2 +1,2 @@
1
1
  import type { FormatNumberOptions } from '../../../../../shared';
2
- export declare const numberFormat: (val: number, round?: number | undefined, options?: FormatNumberOptions) => string | null;
2
+ export declare const numberFormat: (val: number, round?: number, options?: FormatNumberOptions) => string | null;
@@ -1,10 +1,10 @@
1
1
  import type { Highcharts } from '../../../../types';
2
2
  import type { NavigatorPeriod } from '../types';
3
- declare type SetNavigatorDefaultPeriod = {
3
+ type SetNavigatorDefaultPeriod = {
4
4
  params: Record<string, any>;
5
5
  periodSettings: NavigatorPeriod;
6
6
  };
7
- declare type NavigatorPeriodInMS = {
7
+ type NavigatorPeriodInMS = {
8
8
  minRange: number;
9
9
  range: number;
10
10
  };
@@ -1,4 +1,4 @@
1
- import moment from 'moment';
1
+ import { dateTime } from '@gravity-ui/date-utils';
2
2
  import { getXAxisThresholdValue } from './getXAxisThresholdValue';
3
3
  const HOUR_IN_MS = 1000 * 60 * 60;
4
4
  const DAY_IN_MS = HOUR_IN_MS * 24;
@@ -18,7 +18,7 @@ export const getDefaultPeriodInMS = (periodSettings, series) => {
18
18
  if (maxXValue === null) {
19
19
  return null;
20
20
  }
21
- const minXValue = moment(maxXValue).subtract(value, period);
21
+ const minXValue = dateTime({ input: maxXValue }).subtract(value, period);
22
22
  const range = maxXValue - minXValue.valueOf();
23
23
  return {
24
24
  minRange,
@@ -8,12 +8,12 @@
8
8
  }
9
9
 
10
10
  .chartkit-graph .highcharts-legend .highcharts-coloraxis-labels text {
11
- fill: var(--yc-color-text-secondary) !important;
12
- color: var(--yc-color-text-secondary) !important;
11
+ fill: var(--g-color-text-secondary) !important;
12
+ color: var(--g-color-text-secondary) !important;
13
13
  }
14
14
 
15
15
  .chartkit-graph .highcharts-legend .highcharts-coloraxis-grid path {
16
- stroke: var(--yc-color-base-background);
16
+ stroke: var(--g-color-base-background);
17
17
  }
18
18
 
19
19
  .chartkit-tooltip {
@@ -31,7 +31,7 @@
31
31
  border: none;
32
32
  border-radius: 0;
33
33
  box-shadow: none;
34
- border-bottom: 1px solid var(--yc-color-line-generic);
34
+ border-bottom: 1px solid var(--g-color-line-generic);
35
35
  }
36
36
 
37
37
  .chartkit-tooltip_yandex-map {
@@ -2,7 +2,7 @@ import type { ChartKitHolidays } from '../../../../types';
2
2
  import type { Highcharts, HighchartsWidgetData, HighchartsComment, ExtendedHChart } from '../../types';
3
3
  import type { ConfigOptions } from './types';
4
4
  import './graph.css';
5
- declare type GetGraphArgs = {
5
+ type GetGraphArgs = {
6
6
  options: ConfigOptions;
7
7
  data: HighchartsWidgetData['data'];
8
8
  comments?: HighchartsComment[];
@@ -14,7 +14,7 @@ function getGraph({ options, data, comments, isMobile, holidays }) {
14
14
  return {
15
15
  config: Object.assign({ _externalComments: (!options.disableExternalComments && comments) || [], _internalComments: data.comments || [] }, prepareConfig(data, options, isMobile, holidays)),
16
16
  callback: (chart) => {
17
- var _a, _b, _c;
17
+ var _a, _b;
18
18
  if (!chart) {
19
19
  console.error('CHARTKIT_NO_CHART_CALLBACK');
20
20
  return;
@@ -63,7 +63,7 @@ function getGraph({ options, data, comments, isMobile, holidays }) {
63
63
  xAxis !== chart.navigator.xAxis) || ((_a = chart.navigator) === null || _a === void 0 ? void 0 : _a.xAxis);
64
64
  extmin = Math.max((_b = chart.xAxis[0]) === null || _b === void 0 ? void 0 : _b.dataMin, extmin);
65
65
  extmax = Math.min(chart.xAxis[0].dataMax, extmax);
66
- (_c = xAxis) === null || _c === void 0 ? void 0 : _c.setExtremes(extmin, extmax, false, false);
66
+ xAxis === null || xAxis === void 0 ? void 0 : xAxis.setExtremes(extmin, extmax, false, false);
67
67
  needRedraw = true;
68
68
  }
69
69
  }
@@ -2,3 +2,4 @@ export function initHighcharts({ isMobile }: {
2
2
  isMobile: any;
3
3
  }): void;
4
4
  export function initHighchartsMap(): void;
5
+ export function initHighchartsLangOptions(): void;
@@ -113,7 +113,7 @@ Highcharts.setOptions({
113
113
  },
114
114
  },
115
115
  });
116
- function initHighcharts({ isMobile }) {
116
+ function initHighchartsLangOptions() {
117
117
  Highcharts.setOptions({
118
118
  lang: {
119
119
  resetZoom: '⟲',
@@ -159,6 +159,9 @@ function initHighcharts({ isMobile }) {
159
159
  thousandsSep: i18n('highcharts', 'thousands-sep'),
160
160
  },
161
161
  });
162
+ }
163
+ function initHighcharts({ isMobile }) {
164
+ initHighchartsLangOptions();
162
165
  // https://github.com/highcharts/highcharts/issues/11494
163
166
  (function (H) {
164
167
  H.wrap(H.Tooltip.prototype, 'getLabel', function (proceed, ...rest) {
@@ -347,4 +350,4 @@ function initHighchartsMap() {
347
350
  }
348
351
  });
349
352
  }
350
- export { initHighcharts, initHighchartsMap };
353
+ export { initHighcharts, initHighchartsMap, initHighchartsLangOptions };
@@ -1,5 +1,5 @@
1
- import moment from 'moment';
2
1
  import lodashMin from 'lodash/min';
2
+ import { dateTime } from '@gravity-ui/date-utils';
3
3
  import { i18n } from '../../../../i18n';
4
4
  import { ChartKitError, CHARTKIT_ERROR_CODE } from '../../../../libs';
5
5
  import { DEFAULT_LINES_LIMIT } from './constants';
@@ -70,9 +70,9 @@ function removeHolidays(data, options, holidays) {
70
70
  graphsData[i] = [];
71
71
  });
72
72
  data.categories_ms.forEach((ts, i) => {
73
- const datetime = moment(ts).format('YYYYMMDD');
73
+ const key = dateTime({ input: ts }).format('YYYYMMDD');
74
74
  const region = (options.region && options.region.toLowerCase()) || 'tot';
75
- const holiday = holidays.holiday[region][datetime] || holidays.weekend[region][datetime];
75
+ const holiday = holidays.holiday[region][key] || holidays.weekend[region][key];
76
76
  if (!holiday) {
77
77
  timeline.push(ts);
78
78
  data.graphs.forEach((graph, j) => graphsData[j].push(graph.data[i]));
@@ -1,3 +1 @@
1
- import type { TooltipData, TooltipLine } from './types';
2
1
  export declare const escapeHTML: (html?: string) => string;
3
- export declare const getSortedLines: (lines: TooltipLine[], sort?: TooltipData['sort']) => TooltipLine[];
@@ -1,14 +1,5 @@
1
- import orderBy from 'lodash/orderBy';
2
1
  export const escapeHTML = (html = '') => {
3
2
  const elem = document.createElement('span');
4
3
  elem.innerText = html;
5
4
  return elem.innerHTML;
6
5
  };
7
- export const getSortedLines = (lines, sort = {}) => {
8
- // set eneabled to true after https://github.com/gravity-ui/chartkit/issues/171
9
- const { enabled = false, order = 'desc', iteratee = 'originalValue' } = sort;
10
- if (!enabled) {
11
- return [...lines];
12
- }
13
- return orderBy(lines, iteratee, order);
14
- };
@@ -9,5 +9,5 @@ export declare const TOOLTIP_ROW_CLASS_NAME = "_tooltip-row";
9
9
  export declare const TOOLTIP_HEADER_CLASS_NAME = "_tooltip-header";
10
10
  export declare const TOOLTIP_LIST_CLASS_NAME = "_tooltip-list";
11
11
  export declare const TOOLTIP_FOOTER_CLASS_NAME = "_tooltip-footer";
12
- export declare const formatTooltip: (data: TooltipData, tooltip: Highcharts.Tooltip, isMobile?: boolean | undefined) => string;
12
+ export declare const formatTooltip: (data: TooltipData, tooltip: Highcharts.Tooltip, isMobile?: boolean) => string;
13
13
  export default formatTooltip;
@@ -2,7 +2,7 @@
2
2
  import _escape from 'lodash/escape';
3
3
  import { i18n } from '../../../../../i18n';
4
4
  import { renderShapeIcon } from './render-shape-icon';
5
- import { escapeHTML, getSortedLines } from './helpers';
5
+ import { escapeHTML } from './helpers';
6
6
  import './tooltip.css';
7
7
  export const SERIES_NAME_DATA_ATTRIBUTE = 'data-series-name';
8
8
  export const SERIES_IDX_DATA_ATTRIBUTE = 'data-series-idx';
@@ -129,9 +129,8 @@ export const formatTooltip = (data, tooltip, isMobile) => {
129
129
  var _a, _b, _c;
130
130
  const { splitTooltip, activeRowAlwaysFirstInTooltip } = data;
131
131
  const lines = data.lines.slice(0, (tooltip.lastVisibleRowIndex || data.lines.length) + 1);
132
- const sortedLines = getSortedLines(lines, data.sort);
133
- const selectedLineIndex = sortedLines.findIndex(({ selectedSeries }) => selectedSeries);
134
- const selectedLine = sortedLines[selectedLineIndex];
132
+ const selectedLineIndex = lines.findIndex(({ selectedSeries }) => selectedSeries);
133
+ const selectedLine = lines[selectedLineIndex];
135
134
  const withShapes = lines.every((line) => line.seriesShape);
136
135
  const unsafe = data.unsafe;
137
136
  const tooltipHeaderRaw = (_a = data.tooltipHeader) === null || _a === void 0 ? void 0 : _a.trim();
@@ -213,7 +212,7 @@ export const formatTooltip = (data, tooltip, isMobile) => {
213
212
  .join('')}</tr>
214
213
  </thead>`}
215
214
  <tbody class="${TOOLTIP_LIST_CLASS_NAME}">
216
- ${sortedLines
215
+ ${lines
217
216
  .map((line, index) => renderRow(line, getRowRenderConfig(index)))
218
217
  .join('')}
219
218
  </tbody>
@@ -1,4 +1,4 @@
1
- export declare type CommonIconProps = {
1
+ export type CommonIconProps = {
2
2
  width: string;
3
3
  height: string;
4
4
  };
@@ -4,19 +4,19 @@
4
4
  }
5
5
 
6
6
  .chartkit-highcharts-tooltip-container._tooltip-with-scroll ._tooltip-header td:last-child {
7
- padding-right: calc(18px + var(--yc-scrollbar-width, 15px));
7
+ padding-right: calc(18px + var(--g-scrollbar-width, 15px));
8
8
  }
9
9
 
10
10
  .chartkit-highcharts-tooltip-container._tooltip-with-scroll ._tooltip-footer td:last-child {
11
- padding-right: calc(18px + var(--yc-scrollbar-width, 15px));
11
+ padding-right: calc(18px + var(--g-scrollbar-width, 15px));
12
12
  }
13
13
 
14
14
  .chartkit-highcharts-tooltip-container._tooltip-with-scroll-in-safari ._tooltip-row td:last-child {
15
- padding-right: calc(18px + var(--yc-scrollbar-width, 15px));
15
+ padding-right: calc(18px + var(--g-scrollbar-width, 15px));
16
16
  }
17
17
 
18
18
  .chartkit-highcharts-tooltip-container._tooltip-with-scroll-in-safari ._tooltip-rows__summ-tr td:last-child {
19
- padding-right: calc(18px + var(--yc-scrollbar-width, 15px));
19
+ padding-right: calc(18px + var(--g-scrollbar-width, 15px));
20
20
  }
21
21
 
22
22
  ._tooltip {
@@ -347,7 +347,7 @@
347
347
  }
348
348
 
349
349
  ._tooltip-right__traf-div_for-split-tooltip {
350
- color: var(--yc-color-text-secondary);
350
+ color: var(--g-color-text-secondary);
351
351
  padding-left: 8px;
352
352
  border-top: none;
353
353
  border-left: 2px solid;
@@ -1,6 +1,6 @@
1
1
  import type { FormatNumberOptions } from '../../../../shared';
2
2
  import type { LineShapeType } from './constants';
3
- export declare type TooltipData = {
3
+ export type TooltipData = {
4
4
  /** Tooltip lines data */
5
5
  lines: Array<TooltipLine>;
6
6
  /** Tooltip comments */
@@ -38,17 +38,8 @@ export declare type TooltipData = {
38
38
  /** Sum of the values of the hidden ("not fit" in the tooltip) rows */
39
39
  hiddenRowsSum?: number | string;
40
40
  unsafe?: boolean;
41
- /** Used to manage tooltip lines sorting */
42
- sort?: {
43
- /** Enable tooltip lines sorting. `false` by default */
44
- enabled?: boolean;
45
- /** The sort orders. `'desc'` by default */
46
- order?: 'asc' | 'desc';
47
- /** The iteratees to sort by key(s) from `TooltipLine`. `'originalValue'` by default */
48
- iteratee?: keyof TooltipLine | keyof TooltipLine[] | ((line: TooltipLine) => TooltipLine[keyof TooltipLine] | TooltipLine[keyof TooltipLine][]);
49
- };
50
41
  };
51
- export declare type TooltipLine = {
42
+ export type TooltipLine = {
52
43
  /** Color displayed in a separate cell */
53
44
  seriesColor: string;
54
45
  /** Series name */
@@ -84,7 +75,7 @@ export declare type TooltipLine = {
84
75
  chartKitShowRankDelimiter?: FormatNumberOptions['showRankDelimiter'];
85
76
  chartKitUnit?: FormatNumberOptions['unit'];
86
77
  };
87
- export declare type RowRenderingConfig = {
78
+ export type RowRenderingConfig = {
88
79
  cellsRenderers: Array<(line: TooltipLine) => string>;
89
80
  isSelectedLine?: boolean;
90
81
  allowComment?: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { FormatNumberOptions } from '../../../shared';
2
2
  import type { DrillDownConfig, HighchartsWidgetData } from '../../types';
3
- export declare type ConfigOptions = {
3
+ export type ConfigOptions = {
4
4
  highcharts: HighchartsWidgetData['libraryConfig'];
5
5
  nonBodyScroll?: boolean;
6
6
  splitTooltip?: boolean;
@@ -10,7 +10,7 @@ export declare type ConfigOptions = {
10
10
  max?: number;
11
11
  };
12
12
  } & HighchartsWidgetData['config'];
13
- export declare type ChartKitFormatNumberSettings = {
13
+ export type ChartKitFormatNumberSettings = {
14
14
  chartKitFormatting?: boolean;
15
15
  chartKitFormat?: FormatNumberOptions['format'];
16
16
  chartKitPostfix?: FormatNumberOptions['postfix'];
@@ -47,5 +47,5 @@ interface CommentFlagX extends CommentBase {
47
47
  shape: string;
48
48
  };
49
49
  }
50
- export declare type HighchartsComment = CommentDotXY | CommentBandX | CommentLineX | CommentFlagX;
50
+ export type HighchartsComment = CommentDotXY | CommentBandX | CommentLineX | CommentFlagX;
51
51
  export {};
@@ -1,14 +1,14 @@
1
1
  import type { HighchartsComment } from './comments';
2
- export declare type StringParams = Record<string, string | string[]>;
3
- export declare type DrillDownConfig = {
2
+ export type StringParams = Record<string, string | string[]>;
3
+ export type DrillDownConfig = {
4
4
  breadcrumbs: string[];
5
5
  };
6
- export declare type XAxisItem = Highcharts.Axis & {
6
+ export type XAxisItem = Highcharts.Axis & {
7
7
  dataMin: number;
8
8
  dataMax: number;
9
9
  setExtremes: (...args: any[]) => void;
10
10
  };
11
- export declare type ExtendedHChart = Highcharts.Chart & {
11
+ export type ExtendedHChart = Highcharts.Chart & {
12
12
  userOptions: Highcharts.Options & {
13
13
  _internalComments: HighchartsComment[];
14
14
  _externalComments: HighchartsComment[];
@@ -2,12 +2,12 @@ import type { Highcharts } from './lib';
2
2
  import type { HighchartsComment } from './comments';
3
3
  import type { DrillDownConfig, StringParams } from './misc';
4
4
  import type { TooltipData, TooltipLine } from '../renderer/helpers/tooltip/types';
5
- export declare type CkHighchartsSeriesOptionsType = Highcharts.SeriesOptionsType & {
5
+ export type CkHighchartsSeriesOptionsType = Highcharts.SeriesOptionsType & {
6
6
  title?: string;
7
7
  sname?: string;
8
8
  fname?: string;
9
9
  };
10
- export declare type HighchartsManageTooltipConfigOptions = {
10
+ export type HighchartsManageTooltipConfigOptions = {
11
11
  count: number;
12
12
  lines: TooltipLine[];
13
13
  shared: boolean;
@@ -26,8 +26,16 @@ export declare type HighchartsManageTooltipConfigOptions = {
26
26
  withPercent?: boolean;
27
27
  xComments?: TooltipData['xComments'];
28
28
  };
29
- export declare type HighchartsManageTooltipConfig = (options: HighchartsManageTooltipConfigOptions, chart: Highcharts.Chart) => HighchartsManageTooltipConfigOptions;
30
- export declare type HighchartsWidgetData = {
29
+ export type HighchartsManageTooltipConfig = (options: HighchartsManageTooltipConfigOptions, chart: Highcharts.Chart) => HighchartsManageTooltipConfigOptions;
30
+ export type HighchartsSortData = {
31
+ /** Enable tooltip lines sorting. `false` by default */
32
+ enabled?: boolean;
33
+ /** The sort orders. `'desc'` by default */
34
+ order?: 'asc' | 'desc';
35
+ /** The iteratees to sort by key(s) from `TooltipLine`. `'originalValue'` by default */
36
+ iteratee?: keyof TooltipLine | keyof TooltipLine[] | ((line: TooltipLine) => TooltipLine[keyof TooltipLine] | TooltipLine[keyof TooltipLine][]);
37
+ };
38
+ export type HighchartsWidgetData = {
31
39
  data: (CkHighchartsSeriesOptionsType[] | {
32
40
  graphs: CkHighchartsSeriesOptionsType[];
33
41
  categories_ms: number[];
@@ -95,7 +103,7 @@ export declare type HighchartsWidgetData = {
95
103
  metaKey?: boolean;
96
104
  };
97
105
  /** Used to manage tooltip lines sorting */
98
- sort?: TooltipData['sort'];
106
+ sort?: HighchartsSortData;
99
107
  };
100
108
  /**
101
109
  * Used to modify tooltip data
@@ -1,4 +1,4 @@
1
- import { Meta, Story } from '@storybook/react';
2
- export declare const Showcase: Story<import("@storybook/react").Args>;
1
+ import { Meta } from '@storybook/react';
2
+ export declare const Showcase: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
3
3
  declare const meta: Meta;
4
4
  export default meta;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { ChartKitProps } from '../../../types';
3
3
  import type { IndicatorWidgetDataItem } from '../types';
4
4
  export declare const IndicatorItem: (props: IndicatorWidgetDataItem & {
5
5
  defaultColor?: string;
6
6
  formatNumber?: ChartKitProps<'indicator'>['formatNumber'];
7
- }) => JSX.Element;
7
+ }) => React.JSX.Element;
@@ -49,7 +49,7 @@
49
49
  .chartkit-indicator__item-title {
50
50
  font-weight: 500;
51
51
  line-height: 1.2;
52
- color: var(--yc-color-text-primary);
52
+ color: var(--g-color-text-primary);
53
53
  font-size: 16px;
54
54
  padding-bottom: 0.125em;
55
55
  }
@@ -4,13 +4,15 @@ import './IndicatorWidget.css';
4
4
  declare const IndicatorWidget: React.ForwardRefExoticComponent<{
5
5
  type: "indicator";
6
6
  data: import("../types").IndicatorWidgetData;
7
+ pluginRef?: undefined;
7
8
  id?: string | undefined;
8
9
  isMobile?: boolean | undefined;
9
10
  onLoad?: ((data?: import("../../../types").ChartKitOnLoadData<"indicator"> | undefined) => void) | undefined;
10
11
  onRender?: ((data: import("../../../types").ChartKitOnRenderData) => void) | undefined;
11
12
  onChartLoad?: ((data: import("../../../types").ChartKitOnChartLoad<"indicator">) => void) | undefined;
12
- renderError?: import("../../../types").RenderError | undefined;
13
13
  onError?: import("../../../types").ChartKitOnError | undefined;
14
+ renderError?: import("../../../types").RenderError | undefined;
15
+ renderPluginLoader?: (() => React.ReactNode) | undefined;
14
16
  } & {
15
17
  formatNumber?: (<T = any>(value: number, options?: T | undefined) => string) | undefined;
16
18
  } & React.RefAttributes<ChartKitWidgetRef | undefined>>;
@@ -1,4 +1,4 @@
1
- export declare type IndicatorWidgetDataItem = {
1
+ export type IndicatorWidgetDataItem = {
2
2
  content: {
3
3
  current: {
4
4
  value: string | number;
@@ -9,7 +9,7 @@ export declare type IndicatorWidgetDataItem = {
9
9
  title?: string;
10
10
  nowrap?: boolean;
11
11
  };
12
- export declare type IndicatorWidgetData = {
12
+ export type IndicatorWidgetData = {
13
13
  data?: IndicatorWidgetDataItem[];
14
14
  defaultColor?: string;
15
15
  };
@@ -1,5 +1,5 @@
1
1
  import { I18N } from '@gravity-ui/i18n';
2
- declare type KeysetData = Parameters<InstanceType<typeof I18N>['registerKeysets']>[1];
2
+ type KeysetData = Parameters<InstanceType<typeof I18N>['registerKeysets']>[1];
3
3
  declare const i18nInstance: I18N;
4
4
  declare const makeInstance: (keysetName: string, keysetsData: Record<string, KeysetData>) => (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
5
5
  export { i18nInstance, makeInstance };
@@ -1,11 +1,11 @@
1
- export declare type FormatOptions = {
1
+ export type FormatOptions = {
2
2
  precision?: number | 'auto';
3
3
  unitRate?: number;
4
4
  showRankDelimiter?: boolean;
5
5
  lang?: string;
6
6
  labelMode?: string;
7
7
  };
8
- export declare type FormatNumberOptions = FormatOptions & {
8
+ export type FormatNumberOptions = FormatOptions & {
9
9
  format?: 'number' | 'percent';
10
10
  multiplier?: number;
11
11
  prefix?: string;
@@ -1,6 +1,5 @@
1
- import { Meta, Story } from '@storybook/react';
2
1
  import '@gravity-ui/yagr/dist/index.css';
3
- declare const _default: Meta<import("@storybook/react").Args>;
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
4
3
  export default _default;
5
- export declare const Line: Story<any>;
6
- export declare const Updates: Story<any>;
4
+ export declare const Line: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
5
+ export declare const Updates: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
@@ -12,12 +12,14 @@ export default {
12
12
  const LineTemplate = () => {
13
13
  const [shown, setShown] = React.useState(false);
14
14
  const chartkitRef = React.useRef();
15
+ // Example of usage pluginRef property
16
+ const yagrPluginRef = React.useRef(null);
15
17
  if (!shown) {
16
18
  settings.set({ plugins: [YagrPlugin] });
17
19
  return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
18
20
  }
19
21
  return (React.createElement("div", { style: { height: 300, width: '100%' } },
20
- React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "yagr", data: line10 })));
22
+ React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "yagr", data: line10, pluginRef: yagrPluginRef })));
21
23
  };
22
24
  const UpdatesTemplate = () => {
23
25
  const [shown, setShown] = React.useState(false);
@@ -1,4 +1,4 @@
1
1
  .yagr-tooltip {
2
- background-color: var(--yc-color-infographics-tooltip-bg);
2
+ background-color: var(--g-color-infographics-tooltip-bg);
3
3
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
4
4
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { YagrReactRef } from '@gravity-ui/yagr/dist/react';
2
3
  import type { ChartKitWidgetRef } from '../../../types';
3
4
  import './polyfills';
4
5
  import '@gravity-ui/yagr/dist/index.css';
@@ -6,13 +7,15 @@ import './YagrWidget.css';
6
7
  declare const YagrWidget: React.ForwardRefExoticComponent<{
7
8
  type: "yagr";
8
9
  data: import("../types").YagrWidgetData;
10
+ pluginRef?: React.MutableRefObject<YagrReactRef | null> | undefined;
9
11
  id?: string | undefined;
10
12
  isMobile?: boolean | undefined;
11
13
  onLoad?: ((data?: import("../../../types").ChartKitOnLoadData<"yagr"> | undefined) => void) | undefined;
12
14
  onRender?: ((data: import("../../../types").ChartKitOnRenderData) => void) | undefined;
13
15
  onChartLoad?: ((data: import("../../../types").ChartKitOnChartLoad<"yagr">) => void) | undefined;
14
- renderError?: import("../../../types").RenderError | undefined;
15
16
  onError?: import("../../../types").ChartKitOnError | undefined;
17
+ renderError?: import("../../../types").RenderError | undefined;
18
+ renderPluginLoader?: (() => React.ReactNode) | undefined;
16
19
  } & {} & {
17
20
  id: string;
18
21
  } & React.RefAttributes<ChartKitWidgetRef | undefined>>;