@cloud-ru/uikit-product-charts 0.13.12 → 0.13.13

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 (156) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/cjs/components/BagelChart/BagelChart.d.ts +9 -0
  3. package/dist/cjs/components/BagelChart/BagelChart.js +31 -0
  4. package/dist/cjs/components/BagelChart/index.d.ts +1 -0
  5. package/dist/cjs/components/BagelChart/index.js +17 -0
  6. package/dist/cjs/components/BagelChart/styles.module.css +39 -0
  7. package/dist/cjs/components/BagelChart/utils.d.ts +4 -0
  8. package/dist/cjs/components/BagelChart/utils.js +15 -0
  9. package/dist/cjs/components/HeatMapChart/HeatMapChart.d.ts +7 -0
  10. package/dist/cjs/components/HeatMapChart/HeatMapChart.js +89 -0
  11. package/dist/cjs/components/HeatMapChart/constants.d.ts +4 -0
  12. package/dist/cjs/components/HeatMapChart/constants.js +8 -0
  13. package/dist/cjs/components/HeatMapChart/helpers/constants.d.ts +6 -0
  14. package/dist/cjs/components/HeatMapChart/helpers/constants.js +9 -0
  15. package/dist/cjs/components/HeatMapChart/helpers/getComputedColor.d.ts +1 -0
  16. package/dist/cjs/components/HeatMapChart/helpers/getComputedColor.js +7 -0
  17. package/dist/cjs/components/HeatMapChart/helpers/getContrastColor.d.ts +5 -0
  18. package/dist/cjs/components/HeatMapChart/helpers/getContrastColor.js +11 -0
  19. package/dist/cjs/components/HeatMapChart/helpers/getStyles.d.ts +3 -0
  20. package/dist/cjs/components/HeatMapChart/helpers/getStyles.js +33 -0
  21. package/dist/cjs/components/HeatMapChart/helpers/getTickValues.d.ts +2 -0
  22. package/dist/cjs/components/HeatMapChart/helpers/getTickValues.js +68 -0
  23. package/dist/cjs/components/HeatMapChart/helpers/index.d.ts +4 -0
  24. package/dist/cjs/components/HeatMapChart/helpers/index.js +20 -0
  25. package/dist/cjs/components/HeatMapChart/index.d.ts +2 -0
  26. package/dist/cjs/components/HeatMapChart/index.js +5 -0
  27. package/dist/cjs/components/HeatMapChart/styles.module.css +98 -0
  28. package/dist/cjs/components/HeatMapChart/types.d.ts +35 -0
  29. package/dist/cjs/components/HeatMapChart/types.js +2 -0
  30. package/dist/cjs/components/InteractiveChart/InteractiveChart.d.ts +12 -0
  31. package/dist/cjs/components/InteractiveChart/InteractiveChart.js +48 -0
  32. package/dist/cjs/components/InteractiveChart/configurations/boxPlot.d.ts +5 -0
  33. package/dist/cjs/components/InteractiveChart/configurations/boxPlot.js +75 -0
  34. package/dist/cjs/components/InteractiveChart/configurations/defaultPlot.d.ts +5 -0
  35. package/dist/cjs/components/InteractiveChart/configurations/defaultPlot.js +66 -0
  36. package/dist/cjs/components/InteractiveChart/configurations/index.d.ts +2 -0
  37. package/dist/cjs/components/InteractiveChart/configurations/index.js +18 -0
  38. package/dist/cjs/components/InteractiveChart/constants.d.ts +17 -0
  39. package/dist/cjs/components/InteractiveChart/constants.js +20 -0
  40. package/dist/cjs/components/InteractiveChart/helpers/pathRenderer.d.ts +3 -0
  41. package/dist/cjs/components/InteractiveChart/helpers/pathRenderer.js +45 -0
  42. package/dist/cjs/components/InteractiveChart/hooks/useComputedColors.d.ts +2 -0
  43. package/dist/cjs/components/InteractiveChart/hooks/useComputedColors.js +24 -0
  44. package/dist/cjs/components/InteractiveChart/hooks/useLayer.d.ts +12 -0
  45. package/dist/cjs/components/InteractiveChart/hooks/useLayer.js +22 -0
  46. package/dist/cjs/components/InteractiveChart/index.d.ts +2 -0
  47. package/dist/cjs/components/InteractiveChart/index.js +18 -0
  48. package/dist/cjs/components/InteractiveChart/plugins/boxPlotPlugin.d.ts +12 -0
  49. package/dist/cjs/components/InteractiveChart/plugins/boxPlotPlugin.js +90 -0
  50. package/dist/cjs/components/InteractiveChart/plugins/columnHighlightPlugin.d.ts +12 -0
  51. package/dist/cjs/components/InteractiveChart/plugins/columnHighlightPlugin.js +65 -0
  52. package/dist/cjs/components/InteractiveChart/plugins/legendAsTooltipPlugin.d.ts +11 -0
  53. package/dist/cjs/components/InteractiveChart/plugins/legendAsTooltipPlugin.js +58 -0
  54. package/dist/cjs/components/InteractiveChart/plugins/wheelZoomPlugin.d.ts +5 -0
  55. package/dist/cjs/components/InteractiveChart/plugins/wheelZoomPlugin.js +96 -0
  56. package/dist/cjs/components/InteractiveChart/styles.module.css +25 -0
  57. package/dist/cjs/components/InteractiveChart/types.d.ts +5 -0
  58. package/dist/cjs/components/InteractiveChart/types.js +2 -0
  59. package/dist/cjs/components/PieChart/Legend/Legend.d.ts +21 -0
  60. package/dist/cjs/components/PieChart/Legend/Legend.js +18 -0
  61. package/dist/cjs/components/PieChart/Legend/index.d.ts +1 -0
  62. package/dist/cjs/components/PieChart/Legend/index.js +17 -0
  63. package/dist/cjs/components/PieChart/Legend/styles.module.css +50 -0
  64. package/dist/cjs/components/PieChart/Pie.d.ts +17 -0
  65. package/dist/cjs/components/PieChart/Pie.js +24 -0
  66. package/dist/cjs/components/PieChart/PieChart.d.ts +3 -0
  67. package/dist/cjs/components/PieChart/PieChart.js +68 -0
  68. package/dist/cjs/components/PieChart/index.d.ts +2 -0
  69. package/dist/cjs/components/PieChart/index.js +17 -0
  70. package/dist/cjs/components/PieChart/styles.module.css +52 -0
  71. package/dist/cjs/components/PieChart/types.d.ts +36 -0
  72. package/dist/cjs/components/PieChart/types.js +2 -0
  73. package/dist/cjs/components/index.d.ts +4 -0
  74. package/dist/cjs/components/index.js +20 -0
  75. package/dist/cjs/constants/colors.d.ts +36 -0
  76. package/dist/cjs/constants/colors.js +59 -0
  77. package/dist/cjs/index.d.ts +1 -0
  78. package/dist/cjs/index.js +17 -0
  79. package/dist/esm/components/BagelChart/BagelChart.d.ts +9 -0
  80. package/dist/esm/components/BagelChart/BagelChart.js +25 -0
  81. package/dist/esm/components/BagelChart/index.d.ts +1 -0
  82. package/dist/esm/components/BagelChart/index.js +1 -0
  83. package/dist/esm/components/BagelChart/styles.module.css +39 -0
  84. package/dist/esm/components/BagelChart/utils.d.ts +4 -0
  85. package/dist/esm/components/BagelChart/utils.js +12 -0
  86. package/dist/esm/components/HeatMapChart/HeatMapChart.d.ts +7 -0
  87. package/dist/esm/components/HeatMapChart/HeatMapChart.js +83 -0
  88. package/dist/esm/components/HeatMapChart/constants.d.ts +4 -0
  89. package/dist/esm/components/HeatMapChart/constants.js +5 -0
  90. package/dist/esm/components/HeatMapChart/helpers/constants.d.ts +6 -0
  91. package/dist/esm/components/HeatMapChart/helpers/constants.js +6 -0
  92. package/dist/esm/components/HeatMapChart/helpers/getComputedColor.d.ts +1 -0
  93. package/dist/esm/components/HeatMapChart/helpers/getComputedColor.js +4 -0
  94. package/dist/esm/components/HeatMapChart/helpers/getContrastColor.d.ts +5 -0
  95. package/dist/esm/components/HeatMapChart/helpers/getContrastColor.js +7 -0
  96. package/dist/esm/components/HeatMapChart/helpers/getStyles.d.ts +3 -0
  97. package/dist/esm/components/HeatMapChart/helpers/getStyles.js +29 -0
  98. package/dist/esm/components/HeatMapChart/helpers/getTickValues.d.ts +2 -0
  99. package/dist/esm/components/HeatMapChart/helpers/getTickValues.js +61 -0
  100. package/dist/esm/components/HeatMapChart/helpers/index.d.ts +4 -0
  101. package/dist/esm/components/HeatMapChart/helpers/index.js +4 -0
  102. package/dist/esm/components/HeatMapChart/index.d.ts +2 -0
  103. package/dist/esm/components/HeatMapChart/index.js +1 -0
  104. package/dist/esm/components/HeatMapChart/styles.module.css +98 -0
  105. package/dist/esm/components/HeatMapChart/types.d.ts +35 -0
  106. package/dist/esm/components/HeatMapChart/types.js +1 -0
  107. package/dist/esm/components/InteractiveChart/InteractiveChart.d.ts +12 -0
  108. package/dist/esm/components/InteractiveChart/InteractiveChart.js +42 -0
  109. package/dist/esm/components/InteractiveChart/configurations/boxPlot.d.ts +5 -0
  110. package/dist/esm/components/InteractiveChart/configurations/boxPlot.js +71 -0
  111. package/dist/esm/components/InteractiveChart/configurations/defaultPlot.d.ts +5 -0
  112. package/dist/esm/components/InteractiveChart/configurations/defaultPlot.js +59 -0
  113. package/dist/esm/components/InteractiveChart/configurations/index.d.ts +2 -0
  114. package/dist/esm/components/InteractiveChart/configurations/index.js +2 -0
  115. package/dist/esm/components/InteractiveChart/constants.d.ts +17 -0
  116. package/dist/esm/components/InteractiveChart/constants.js +17 -0
  117. package/dist/esm/components/InteractiveChart/helpers/pathRenderer.d.ts +3 -0
  118. package/dist/esm/components/InteractiveChart/helpers/pathRenderer.js +39 -0
  119. package/dist/esm/components/InteractiveChart/hooks/useComputedColors.d.ts +2 -0
  120. package/dist/esm/components/InteractiveChart/hooks/useComputedColors.js +21 -0
  121. package/dist/esm/components/InteractiveChart/hooks/useLayer.d.ts +12 -0
  122. package/dist/esm/components/InteractiveChart/hooks/useLayer.js +16 -0
  123. package/dist/esm/components/InteractiveChart/index.d.ts +2 -0
  124. package/dist/esm/components/InteractiveChart/index.js +2 -0
  125. package/dist/esm/components/InteractiveChart/plugins/boxPlotPlugin.d.ts +12 -0
  126. package/dist/esm/components/InteractiveChart/plugins/boxPlotPlugin.js +84 -0
  127. package/dist/esm/components/InteractiveChart/plugins/columnHighlightPlugin.d.ts +12 -0
  128. package/dist/esm/components/InteractiveChart/plugins/columnHighlightPlugin.js +59 -0
  129. package/dist/esm/components/InteractiveChart/plugins/legendAsTooltipPlugin.d.ts +11 -0
  130. package/dist/esm/components/InteractiveChart/plugins/legendAsTooltipPlugin.js +52 -0
  131. package/dist/esm/components/InteractiveChart/plugins/wheelZoomPlugin.d.ts +5 -0
  132. package/dist/esm/components/InteractiveChart/plugins/wheelZoomPlugin.js +93 -0
  133. package/dist/esm/components/InteractiveChart/styles.module.css +25 -0
  134. package/dist/esm/components/InteractiveChart/types.d.ts +5 -0
  135. package/dist/esm/components/InteractiveChart/types.js +1 -0
  136. package/dist/esm/components/PieChart/Legend/Legend.d.ts +21 -0
  137. package/dist/esm/components/PieChart/Legend/Legend.js +12 -0
  138. package/dist/esm/components/PieChart/Legend/index.d.ts +1 -0
  139. package/dist/esm/components/PieChart/Legend/index.js +1 -0
  140. package/dist/esm/components/PieChart/Legend/styles.module.css +50 -0
  141. package/dist/esm/components/PieChart/Pie.d.ts +17 -0
  142. package/dist/esm/components/PieChart/Pie.js +21 -0
  143. package/dist/esm/components/PieChart/PieChart.d.ts +3 -0
  144. package/dist/esm/components/PieChart/PieChart.js +62 -0
  145. package/dist/esm/components/PieChart/index.d.ts +2 -0
  146. package/dist/esm/components/PieChart/index.js +1 -0
  147. package/dist/esm/components/PieChart/styles.module.css +52 -0
  148. package/dist/esm/components/PieChart/types.d.ts +36 -0
  149. package/dist/esm/components/PieChart/types.js +1 -0
  150. package/dist/esm/components/index.d.ts +4 -0
  151. package/dist/esm/components/index.js +4 -0
  152. package/dist/esm/constants/colors.d.ts +36 -0
  153. package/dist/esm/constants/colors.js +56 -0
  154. package/dist/esm/index.d.ts +1 -0
  155. package/dist/esm/index.js +1 -0
  156. package/package.json +5 -4
@@ -0,0 +1,50 @@
1
+ .legend{
2
+ display:flex;
3
+ flex-direction:column;
4
+ color:var(--sys-neutral-text-support, #6d707f);
5
+ padding-right:8px;
6
+ }
7
+
8
+ .legendItemWrapper{
9
+ color:var(--sys-neutral-text-main, #41424e);
10
+ display:flex;
11
+ align-items:center;
12
+ flex-direction:row;
13
+ gap:8px;
14
+ justify-content:space-between;
15
+ }
16
+
17
+ .dot{
18
+ display:inline-block;
19
+ min-width:8px;
20
+ min-height:8px;
21
+ width:8px;
22
+ height:8px;
23
+ border-radius:100%;
24
+ margin-right:12px;
25
+ background-color:var(--color);
26
+ }
27
+
28
+ .legendDividerWrapper{
29
+ margin:16px 0;
30
+ }
31
+
32
+ .legendItemTitle{
33
+ font-family:var(--sans-body-m-font-family, SB Sans Interface);
34
+ font-weight:var(--sans-body-m-font-weight, Regular);
35
+ line-height:var(--sans-body-m-line-height, 20px);
36
+ font-size:var(--sans-body-m-font-size, 14px);
37
+ letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
38
+ paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
39
+ display:flex;
40
+ align-items:center;
41
+ }
42
+
43
+ .legendValue{
44
+ font-family:var(--sans-label-l-font-family, SB Sans Interface);
45
+ font-weight:var(--sans-label-l-font-weight, Semibold);
46
+ line-height:var(--sans-label-l-line-height, 20px);
47
+ font-size:var(--sans-label-l-font-size, 14px);
48
+ letter-spacing:var(--sans-label-l-letter-spacing, 0px);
49
+ paragraph-spacing:var(--sans-label-l-paragraph-spacing, 7.7px);
50
+ }
@@ -0,0 +1,17 @@
1
+ import { CSSProperties, MouseEvent } from 'react';
2
+ import { DataType, LabelRenderFunction } from './types';
3
+ type PieProps = {
4
+ data: DataType[];
5
+ label: LabelRenderFunction<DataType>;
6
+ onMouseOut: () => void;
7
+ onMouseOver: (event: MouseEvent<SVGPathElement>, dataIndex: number) => void;
8
+ onMouseDown: (event: MouseEvent<SVGPathElement>, dataIndex: number) => void;
9
+ radius: number;
10
+ innerRadius: number;
11
+ segmentsShift: number;
12
+ segmentsStyle: CSSProperties;
13
+ hoveredIndex?: number;
14
+ style: CSSProperties;
15
+ };
16
+ export declare function Pie({ data, hoveredIndex, radius, innerRadius, segmentsShift, onMouseOut, label, style, segmentsStyle, onMouseOver, onMouseDown, }: PieProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { arc, pie } from 'd3-shape';
3
+ import { Fragment } from 'react';
4
+ export function Pie({ data, hoveredIndex, radius, innerRadius, segmentsShift, onMouseOut, label, style, segmentsStyle, onMouseOver, onMouseDown, }) {
5
+ const pieSegments = pie()
6
+ .sort(null)
7
+ .value((d) => d.value)(data);
8
+ const getHoveredPath = arc()
9
+ .outerRadius(radius + 1)
10
+ .innerRadius(innerRadius + 1)
11
+ .startAngle(d => d.startAngle + Math.PI / 2)
12
+ .endAngle(d => d.endAngle + Math.PI / 2)
13
+ .padAngle(segmentsShift);
14
+ const getPath = arc()
15
+ .outerRadius(radius)
16
+ .innerRadius(innerRadius)
17
+ .startAngle(d => d.startAngle + Math.PI / 2)
18
+ .endAngle(d => d.endAngle + Math.PI / 2)
19
+ .padAngle(segmentsShift);
20
+ return (_jsx("svg", { viewBox: '0 0 100 100', width: '100%', height: '100%', style: style, children: _jsx("g", { transform: 'translate(50,50)', children: pieSegments.map((segment, index) => (_jsxs(Fragment, { children: [_jsx("path", { onMouseOver: e => onMouseOver(e, index), onMouseOut: onMouseOut, onMouseDown: e => onMouseDown(e, index), fill: segment.data.color, d: hoveredIndex === index ? String(getHoveredPath(segment)) : String(getPath(segment)), style: segmentsStyle }), label({ dataEntry: segment.data, dataIndex: index })] }, index))) }) }));
21
+ }
@@ -0,0 +1,3 @@
1
+ import { WithSupportProps } from '@sbercloud/uikit-product-utils';
2
+ import { PieChartProps } from './types';
3
+ export declare function PieChart({ options: { width, height, title, legendTitle, typographySize }, data, aggregatedLegend, onPieSegmentClick, onLegendItemClick, className, ...rest }: WithSupportProps<PieChartProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,62 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { truncateString } from '@cloud-ru/ft-formatters';
14
+ import cn from 'classnames';
15
+ import { useCallback, useMemo, useState } from 'react';
16
+ import { extractSupportProps } from '@sbercloud/uikit-product-utils';
17
+ import { Scroll } from '@snack-uikit/scroll';
18
+ import { Typography } from '@snack-uikit/typography';
19
+ import { CHART_SERIES_COLORS, SERIES_COLORS } from '../../constants/colors';
20
+ import { Legend } from './Legend';
21
+ import { Pie } from './Pie';
22
+ import styles from './styles.module.css';
23
+ export function PieChart(_a) {
24
+ var { options: { width, height, title, legendTitle, typographySize = 'l' }, data, aggregatedLegend, onPieSegmentClick, onLegendItemClick, className } = _a, rest = __rest(_a, ["options", "data", "aggregatedLegend", "onPieSegmentClick", "onLegendItemClick", "className"]);
25
+ const [hovered, setHovered] = useState(undefined);
26
+ const colorizedData = useMemo(() => data.map((x, index) => {
27
+ const colorsKey = Object.values(SERIES_COLORS);
28
+ const chartColor = CHART_SERIES_COLORS[colorsKey[index % colorsKey.length]];
29
+ return Object.assign(Object.assign({}, x), { color: x.color || chartColor });
30
+ }), [data]);
31
+ const pieStyles = useMemo(() => ({ overflow: 'overlay' }), []);
32
+ const segmentStyles = useMemo(() => ({ transition: 'all .3s', cursor: 'pointer' }), []);
33
+ const onMouseOverCallback = useCallback((_, index) => setHovered(index), []);
34
+ const onMouseOutCallback = useCallback(() => setHovered(undefined), []);
35
+ const onMouseDownCallback = useCallback((event, index) => {
36
+ event.preventDefault();
37
+ if (onPieSegmentClick) {
38
+ onPieSegmentClick(data[index]);
39
+ }
40
+ }, [data, onPieSegmentClick]);
41
+ const onColorizedLegendItemClick = useMemo(() => {
42
+ if (!onLegendItemClick) {
43
+ return undefined;
44
+ }
45
+ return (event, item) => {
46
+ event.preventDefault();
47
+ onLegendItemClick(item);
48
+ };
49
+ }, [onLegendItemClick]);
50
+ const onAggregatedItemClick = useMemo(() => {
51
+ const handleClick = aggregatedLegend === null || aggregatedLegend === void 0 ? void 0 : aggregatedLegend.onAggregatedLegendItemClick;
52
+ if (!handleClick) {
53
+ return undefined;
54
+ }
55
+ return (event, item) => {
56
+ event.preventDefault();
57
+ handleClick(item);
58
+ };
59
+ }, [aggregatedLegend]);
60
+ const labelRenderer = useCallback(({ dataEntry, dataIndex }) => (_jsxs(_Fragment, { children: [_jsx("text", { className: styles.svgText, x: 0, y: -4, "data-hovered": hovered === dataIndex || undefined, children: truncateString(String(dataEntry.label), 15) }, `${dataIndex}_label`), _jsx("text", { className: styles.svgText, x: 0, y: 4, "data-hovered": hovered === dataIndex || undefined, "data-bolder": 'true', children: dataEntry.value }, `${dataIndex}_value`)] })), [hovered]);
61
+ return (_jsxs("div", Object.assign({}, extractSupportProps(rest), { className: cn(className, styles.wrapper), style: { '--width': width ? `${width}px` : undefined, '--height': height ? `${height}px` : undefined }, children: [_jsx(Typography, { purpose: 'title', family: 'sans', size: typographySize, className: styles.title, children: title }), _jsxs("div", { className: styles.contentWrapper, children: [_jsx("div", { className: styles.legendWrapper, children: _jsx(Scroll, { size: 's', children: _jsx(Legend, { data: colorizedData, legendTitle: legendTitle, onItemClick: onColorizedLegendItemClick, typographySize: typographySize }) }) }), _jsx("div", { className: styles.pieWrapper, children: _jsx(Pie, { style: pieStyles, radius: 46, innerRadius: 23, label: labelRenderer, data: colorizedData, segmentsStyle: segmentStyles, segmentsShift: 0.015, hoveredIndex: hovered, onMouseOver: onMouseOverCallback, onMouseOut: onMouseOutCallback, onMouseDown: onMouseDownCallback }) }), aggregatedLegend && (_jsx("div", { className: styles.legendWrapper, children: _jsx(Scroll, { size: 's', children: _jsx(Legend, { data: aggregatedLegend.data, legendTitle: aggregatedLegend.title, onItemClick: onAggregatedItemClick, typographySize: typographySize }) }) }))] })] })));
62
+ }
@@ -0,0 +1,2 @@
1
+ export * from './PieChart';
2
+ export type { PieChartProps } from './types';
@@ -0,0 +1 @@
1
+ export * from './PieChart';
@@ -0,0 +1,52 @@
1
+ .wrapper{
2
+ display:flex;
3
+ width:var(--width, 100%);
4
+ height:var(--height, 100%);
5
+ flex-direction:column;
6
+ box-sizing:border-box;
7
+ background-color:var(--sys-neutral-background1-level, #fdfdfd);
8
+ border-radius:8px;
9
+ padding:24px;
10
+ }
11
+
12
+ .title{
13
+ padding-bottom:24px;
14
+ color:var(--sys-neutral-text-main, #41424e);
15
+ }
16
+
17
+ .contentWrapper{
18
+ display:flex;
19
+ flex-direction:row;
20
+ gap:24px;
21
+ height:calc(100% - 50px);
22
+ justify-content:space-between;
23
+ }
24
+
25
+ .legendWrapper{
26
+ min-width:25%;
27
+ max-width:33%;
28
+ }
29
+
30
+ .pieWrapper{
31
+ height:100%;
32
+ text-align:center;
33
+ display:flex;
34
+ align-items:center;
35
+ justify-content:center;
36
+ }
37
+
38
+ .svgText{
39
+ text-anchor:middle;
40
+ visibility:hidden;
41
+ width:30px;
42
+ font-size:5px;
43
+ word-break:break-all;
44
+ white-space:nowrap;
45
+ fill:var(--sys-neutral-text-main, #41424e);
46
+ }
47
+ .svgText[data-hovered]{
48
+ visibility:visible;
49
+ }
50
+ .svgText[data-bolder]{
51
+ font-weight:700;
52
+ }
@@ -0,0 +1,36 @@
1
+ import { ReactNode } from 'react';
2
+ export type TextLike = string | number;
3
+ export type LegendType = {
4
+ label: TextLike;
5
+ value: TextLike;
6
+ id?: string;
7
+ };
8
+ export type DataType = {
9
+ label: TextLike;
10
+ value: number;
11
+ id?: string;
12
+ color?: string;
13
+ };
14
+ export type PieChartProps = {
15
+ data: DataType[];
16
+ options: {
17
+ title: string;
18
+ width?: number;
19
+ height?: number;
20
+ legendTitle?: string;
21
+ typographySize?: 's' | 'm' | 'l';
22
+ };
23
+ onPieSegmentClick?: (data: DataType) => void;
24
+ onLegendItemClick?: (data: LegendType) => void;
25
+ aggregatedLegend?: {
26
+ data: LegendType[];
27
+ title: string;
28
+ onAggregatedLegendItemClick?: (data: LegendType) => void;
29
+ };
30
+ className?: string;
31
+ };
32
+ export type LabelRenderProps<DataType> = {
33
+ dataEntry: DataType;
34
+ dataIndex: number;
35
+ };
36
+ export type LabelRenderFunction<DataType> = (labelRenderProps: LabelRenderProps<DataType>) => ReactNode;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './InteractiveChart';
2
+ export * from './PieChart';
3
+ export * from './HeatMapChart';
4
+ export * from './BagelChart';
@@ -0,0 +1,4 @@
1
+ export * from './InteractiveChart';
2
+ export * from './PieChart';
3
+ export * from './HeatMapChart';
4
+ export * from './BagelChart';
@@ -0,0 +1,36 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+ export declare const COLOR_CONTAINER_CLASSNAME = "interactive-chart-wrapper";
3
+ export declare const SERIES_COLORS: {
4
+ Green1: string;
5
+ Blue1: string;
6
+ Violet1: string;
7
+ Crimson1: string;
8
+ Green2: string;
9
+ Blue2: string;
10
+ Violet2: string;
11
+ Crimson2: string;
12
+ Green3: string;
13
+ Blue3: string;
14
+ Violet3: string;
15
+ Crimson3: string;
16
+ Green4: string;
17
+ Blue4: string;
18
+ Violet4: string;
19
+ Crimson4: string;
20
+ };
21
+ export type SeriesColor = ValueOf<typeof SERIES_COLORS>;
22
+ export type SeriesColorMap = Record<SeriesColor, string>;
23
+ export declare const CHART_SERIES_COLORS: SeriesColorMap;
24
+ export declare const OTHER_COLORS: {
25
+ ShadowColor: string;
26
+ LineColor: string;
27
+ TooltipBackgroundColor: string;
28
+ TooltipColor: string;
29
+ ColumnHighlightColor: string;
30
+ AxisColor: string;
31
+ LabelColor: string;
32
+ };
33
+ export type OtherColor = ValueOf<typeof OTHER_COLORS>;
34
+ export type OtherColorMap = Record<OtherColor, string>;
35
+ export declare const CHART_OTHER_COLORS: OtherColorMap;
36
+ export type ColorMap = SeriesColorMap & OtherColorMap;
@@ -0,0 +1,56 @@
1
+ import { themeVars } from '@sbercloud/figma-tokens-cloud-platform';
2
+ export const COLOR_CONTAINER_CLASSNAME = 'interactive-chart-wrapper';
3
+ export const SERIES_COLORS = {
4
+ Green1: 'green1',
5
+ Blue1: 'blue1',
6
+ Violet1: 'violet1',
7
+ Crimson1: 'crimson1',
8
+ Green2: 'green2',
9
+ Blue2: 'blue2',
10
+ Violet2: 'violet2',
11
+ Crimson2: 'crimson2',
12
+ Green3: 'green3',
13
+ Blue3: 'blue3',
14
+ Violet3: 'violet3',
15
+ Crimson3: 'crimson3',
16
+ Green4: 'green4',
17
+ Blue4: 'blue4',
18
+ Violet4: 'violet4',
19
+ Crimson4: 'crimson4',
20
+ };
21
+ export const CHART_SERIES_COLORS = {
22
+ [SERIES_COLORS.Green1]: themeVars.sys.green.accentDefault,
23
+ [SERIES_COLORS.Green2]: themeVars.sys.green.textLight,
24
+ [SERIES_COLORS.Green3]: themeVars.sys.green.textDisabled,
25
+ [SERIES_COLORS.Green4]: themeVars.sys.green.decorActivated,
26
+ [SERIES_COLORS.Blue1]: themeVars.sys.blue.accentDefault,
27
+ [SERIES_COLORS.Blue2]: themeVars.sys.blue.textLight,
28
+ [SERIES_COLORS.Blue3]: themeVars.sys.blue.textDisabled,
29
+ [SERIES_COLORS.Blue4]: themeVars.sys.blue.decorActivated,
30
+ [SERIES_COLORS.Violet1]: themeVars.sys.violet.accentDefault,
31
+ [SERIES_COLORS.Violet2]: themeVars.sys.violet.textLight,
32
+ [SERIES_COLORS.Violet3]: themeVars.sys.violet.textDisabled,
33
+ [SERIES_COLORS.Violet4]: themeVars.sys.violet.decorActivated,
34
+ [SERIES_COLORS.Crimson1]: themeVars.sys.pink.accentDefault,
35
+ [SERIES_COLORS.Crimson2]: themeVars.sys.pink.textLight,
36
+ [SERIES_COLORS.Crimson3]: themeVars.sys.pink.textDisabled,
37
+ [SERIES_COLORS.Crimson4]: themeVars.sys.pink.decorActivated,
38
+ };
39
+ export const OTHER_COLORS = {
40
+ ShadowColor: 'shadowColor',
41
+ LineColor: 'lineColor',
42
+ TooltipBackgroundColor: 'tooltipBackgroundColor',
43
+ TooltipColor: 'tooltipColor',
44
+ ColumnHighlightColor: 'columnHighlightColor',
45
+ AxisColor: 'axisColor',
46
+ LabelColor: 'labelColor',
47
+ };
48
+ export const CHART_OTHER_COLORS = {
49
+ [OTHER_COLORS.ShadowColor]: themeVars.sys.neutral.accentDefault,
50
+ [OTHER_COLORS.LineColor]: themeVars.sys.neutral.onAccent,
51
+ [OTHER_COLORS.TooltipBackgroundColor]: themeVars.sys.invertNeutral.background,
52
+ [OTHER_COLORS.TooltipColor]: themeVars.sys.invertNeutral.textMain,
53
+ [OTHER_COLORS.ColumnHighlightColor]: themeVars.sys.neutral.decorDefault,
54
+ [OTHER_COLORS.AxisColor]: themeVars.sys.neutral.decorDefault,
55
+ [OTHER_COLORS.LabelColor]: themeVars.sys.neutral.textSupport,
56
+ };
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1 @@
1
+ export * from './components';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-charts",
3
3
  "title": "React Charts",
4
- "version": "0.13.12",
4
+ "version": "0.13.13",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.scss",
@@ -31,6 +31,7 @@
31
31
  "name": "Akhremenko Grigorii",
32
32
  "url": "https://github.com/AGrigorii"
33
33
  },
34
+ "contributors": [],
34
35
  "license": "Apache-2.0",
35
36
  "publishConfig": {
36
37
  "access": "public"
@@ -38,8 +39,8 @@
38
39
  "scripts": {},
39
40
  "dependencies": {
40
41
  "@cloud-ru/ft-formatters": "1.0.1",
41
- "@cloud-ru/uikit-product-localization": "0.13.12",
42
- "@cloud-ru/uikit-product-utils": "7.0.0",
42
+ "@cloud-ru/uikit-product-localization": "0.13.13",
43
+ "@cloud-ru/uikit-product-utils": "7.0.1",
43
44
  "@snack-uikit/divider": "3.2.3",
44
45
  "@snack-uikit/link": "0.15.9",
45
46
  "@snack-uikit/scroll": "0.9.3",
@@ -63,5 +64,5 @@
63
64
  "@types/lodash.merge": "4.6.6",
64
65
  "@types/lodash.range": "3.2.6"
65
66
  },
66
- "gitHead": "e8bd79bc92b26a8f52611972eec98a867536ccd3"
67
+ "gitHead": "9c11b1e33e716c874534a1c162266c8591f2ed03"
67
68
  }