@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.
- package/CHANGELOG.md +14 -1
- package/dist/cjs/components/BagelChart/BagelChart.d.ts +9 -0
- package/dist/cjs/components/BagelChart/BagelChart.js +31 -0
- package/dist/cjs/components/BagelChart/index.d.ts +1 -0
- package/dist/cjs/components/BagelChart/index.js +17 -0
- package/dist/cjs/components/BagelChart/styles.module.css +39 -0
- package/dist/cjs/components/BagelChart/utils.d.ts +4 -0
- package/dist/cjs/components/BagelChart/utils.js +15 -0
- package/dist/cjs/components/HeatMapChart/HeatMapChart.d.ts +7 -0
- package/dist/cjs/components/HeatMapChart/HeatMapChart.js +89 -0
- package/dist/cjs/components/HeatMapChart/constants.d.ts +4 -0
- package/dist/cjs/components/HeatMapChart/constants.js +8 -0
- package/dist/cjs/components/HeatMapChart/helpers/constants.d.ts +6 -0
- package/dist/cjs/components/HeatMapChart/helpers/constants.js +9 -0
- package/dist/cjs/components/HeatMapChart/helpers/getComputedColor.d.ts +1 -0
- package/dist/cjs/components/HeatMapChart/helpers/getComputedColor.js +7 -0
- package/dist/cjs/components/HeatMapChart/helpers/getContrastColor.d.ts +5 -0
- package/dist/cjs/components/HeatMapChart/helpers/getContrastColor.js +11 -0
- package/dist/cjs/components/HeatMapChart/helpers/getStyles.d.ts +3 -0
- package/dist/cjs/components/HeatMapChart/helpers/getStyles.js +33 -0
- package/dist/cjs/components/HeatMapChart/helpers/getTickValues.d.ts +2 -0
- package/dist/cjs/components/HeatMapChart/helpers/getTickValues.js +68 -0
- package/dist/cjs/components/HeatMapChart/helpers/index.d.ts +4 -0
- package/dist/cjs/components/HeatMapChart/helpers/index.js +20 -0
- package/dist/cjs/components/HeatMapChart/index.d.ts +2 -0
- package/dist/cjs/components/HeatMapChart/index.js +5 -0
- package/dist/cjs/components/HeatMapChart/styles.module.css +98 -0
- package/dist/cjs/components/HeatMapChart/types.d.ts +35 -0
- package/dist/cjs/components/HeatMapChart/types.js +2 -0
- package/dist/cjs/components/InteractiveChart/InteractiveChart.d.ts +12 -0
- package/dist/cjs/components/InteractiveChart/InteractiveChart.js +48 -0
- package/dist/cjs/components/InteractiveChart/configurations/boxPlot.d.ts +5 -0
- package/dist/cjs/components/InteractiveChart/configurations/boxPlot.js +75 -0
- package/dist/cjs/components/InteractiveChart/configurations/defaultPlot.d.ts +5 -0
- package/dist/cjs/components/InteractiveChart/configurations/defaultPlot.js +66 -0
- package/dist/cjs/components/InteractiveChart/configurations/index.d.ts +2 -0
- package/dist/cjs/components/InteractiveChart/configurations/index.js +18 -0
- package/dist/cjs/components/InteractiveChart/constants.d.ts +17 -0
- package/dist/cjs/components/InteractiveChart/constants.js +20 -0
- package/dist/cjs/components/InteractiveChart/helpers/pathRenderer.d.ts +3 -0
- package/dist/cjs/components/InteractiveChart/helpers/pathRenderer.js +45 -0
- package/dist/cjs/components/InteractiveChart/hooks/useComputedColors.d.ts +2 -0
- package/dist/cjs/components/InteractiveChart/hooks/useComputedColors.js +24 -0
- package/dist/cjs/components/InteractiveChart/hooks/useLayer.d.ts +12 -0
- package/dist/cjs/components/InteractiveChart/hooks/useLayer.js +22 -0
- package/dist/cjs/components/InteractiveChart/index.d.ts +2 -0
- package/dist/cjs/components/InteractiveChart/index.js +18 -0
- package/dist/cjs/components/InteractiveChart/plugins/boxPlotPlugin.d.ts +12 -0
- package/dist/cjs/components/InteractiveChart/plugins/boxPlotPlugin.js +90 -0
- package/dist/cjs/components/InteractiveChart/plugins/columnHighlightPlugin.d.ts +12 -0
- package/dist/cjs/components/InteractiveChart/plugins/columnHighlightPlugin.js +65 -0
- package/dist/cjs/components/InteractiveChart/plugins/legendAsTooltipPlugin.d.ts +11 -0
- package/dist/cjs/components/InteractiveChart/plugins/legendAsTooltipPlugin.js +58 -0
- package/dist/cjs/components/InteractiveChart/plugins/wheelZoomPlugin.d.ts +5 -0
- package/dist/cjs/components/InteractiveChart/plugins/wheelZoomPlugin.js +96 -0
- package/dist/cjs/components/InteractiveChart/styles.module.css +25 -0
- package/dist/cjs/components/InteractiveChart/types.d.ts +5 -0
- package/dist/cjs/components/InteractiveChart/types.js +2 -0
- package/dist/cjs/components/PieChart/Legend/Legend.d.ts +21 -0
- package/dist/cjs/components/PieChart/Legend/Legend.js +18 -0
- package/dist/cjs/components/PieChart/Legend/index.d.ts +1 -0
- package/dist/cjs/components/PieChart/Legend/index.js +17 -0
- package/dist/cjs/components/PieChart/Legend/styles.module.css +50 -0
- package/dist/cjs/components/PieChart/Pie.d.ts +17 -0
- package/dist/cjs/components/PieChart/Pie.js +24 -0
- package/dist/cjs/components/PieChart/PieChart.d.ts +3 -0
- package/dist/cjs/components/PieChart/PieChart.js +68 -0
- package/dist/cjs/components/PieChart/index.d.ts +2 -0
- package/dist/cjs/components/PieChart/index.js +17 -0
- package/dist/cjs/components/PieChart/styles.module.css +52 -0
- package/dist/cjs/components/PieChart/types.d.ts +36 -0
- package/dist/cjs/components/PieChart/types.js +2 -0
- package/dist/cjs/components/index.d.ts +4 -0
- package/dist/cjs/components/index.js +20 -0
- package/dist/cjs/constants/colors.d.ts +36 -0
- package/dist/cjs/constants/colors.js +59 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/esm/components/BagelChart/BagelChart.d.ts +9 -0
- package/dist/esm/components/BagelChart/BagelChart.js +25 -0
- package/dist/esm/components/BagelChart/index.d.ts +1 -0
- package/dist/esm/components/BagelChart/index.js +1 -0
- package/dist/esm/components/BagelChart/styles.module.css +39 -0
- package/dist/esm/components/BagelChart/utils.d.ts +4 -0
- package/dist/esm/components/BagelChart/utils.js +12 -0
- package/dist/esm/components/HeatMapChart/HeatMapChart.d.ts +7 -0
- package/dist/esm/components/HeatMapChart/HeatMapChart.js +83 -0
- package/dist/esm/components/HeatMapChart/constants.d.ts +4 -0
- package/dist/esm/components/HeatMapChart/constants.js +5 -0
- package/dist/esm/components/HeatMapChart/helpers/constants.d.ts +6 -0
- package/dist/esm/components/HeatMapChart/helpers/constants.js +6 -0
- package/dist/esm/components/HeatMapChart/helpers/getComputedColor.d.ts +1 -0
- package/dist/esm/components/HeatMapChart/helpers/getComputedColor.js +4 -0
- package/dist/esm/components/HeatMapChart/helpers/getContrastColor.d.ts +5 -0
- package/dist/esm/components/HeatMapChart/helpers/getContrastColor.js +7 -0
- package/dist/esm/components/HeatMapChart/helpers/getStyles.d.ts +3 -0
- package/dist/esm/components/HeatMapChart/helpers/getStyles.js +29 -0
- package/dist/esm/components/HeatMapChart/helpers/getTickValues.d.ts +2 -0
- package/dist/esm/components/HeatMapChart/helpers/getTickValues.js +61 -0
- package/dist/esm/components/HeatMapChart/helpers/index.d.ts +4 -0
- package/dist/esm/components/HeatMapChart/helpers/index.js +4 -0
- package/dist/esm/components/HeatMapChart/index.d.ts +2 -0
- package/dist/esm/components/HeatMapChart/index.js +1 -0
- package/dist/esm/components/HeatMapChart/styles.module.css +98 -0
- package/dist/esm/components/HeatMapChart/types.d.ts +35 -0
- package/dist/esm/components/HeatMapChart/types.js +1 -0
- package/dist/esm/components/InteractiveChart/InteractiveChart.d.ts +12 -0
- package/dist/esm/components/InteractiveChart/InteractiveChart.js +42 -0
- package/dist/esm/components/InteractiveChart/configurations/boxPlot.d.ts +5 -0
- package/dist/esm/components/InteractiveChart/configurations/boxPlot.js +71 -0
- package/dist/esm/components/InteractiveChart/configurations/defaultPlot.d.ts +5 -0
- package/dist/esm/components/InteractiveChart/configurations/defaultPlot.js +59 -0
- package/dist/esm/components/InteractiveChart/configurations/index.d.ts +2 -0
- package/dist/esm/components/InteractiveChart/configurations/index.js +2 -0
- package/dist/esm/components/InteractiveChart/constants.d.ts +17 -0
- package/dist/esm/components/InteractiveChart/constants.js +17 -0
- package/dist/esm/components/InteractiveChart/helpers/pathRenderer.d.ts +3 -0
- package/dist/esm/components/InteractiveChart/helpers/pathRenderer.js +39 -0
- package/dist/esm/components/InteractiveChart/hooks/useComputedColors.d.ts +2 -0
- package/dist/esm/components/InteractiveChart/hooks/useComputedColors.js +21 -0
- package/dist/esm/components/InteractiveChart/hooks/useLayer.d.ts +12 -0
- package/dist/esm/components/InteractiveChart/hooks/useLayer.js +16 -0
- package/dist/esm/components/InteractiveChart/index.d.ts +2 -0
- package/dist/esm/components/InteractiveChart/index.js +2 -0
- package/dist/esm/components/InteractiveChart/plugins/boxPlotPlugin.d.ts +12 -0
- package/dist/esm/components/InteractiveChart/plugins/boxPlotPlugin.js +84 -0
- package/dist/esm/components/InteractiveChart/plugins/columnHighlightPlugin.d.ts +12 -0
- package/dist/esm/components/InteractiveChart/plugins/columnHighlightPlugin.js +59 -0
- package/dist/esm/components/InteractiveChart/plugins/legendAsTooltipPlugin.d.ts +11 -0
- package/dist/esm/components/InteractiveChart/plugins/legendAsTooltipPlugin.js +52 -0
- package/dist/esm/components/InteractiveChart/plugins/wheelZoomPlugin.d.ts +5 -0
- package/dist/esm/components/InteractiveChart/plugins/wheelZoomPlugin.js +93 -0
- package/dist/esm/components/InteractiveChart/styles.module.css +25 -0
- package/dist/esm/components/InteractiveChart/types.d.ts +5 -0
- package/dist/esm/components/InteractiveChart/types.js +1 -0
- package/dist/esm/components/PieChart/Legend/Legend.d.ts +21 -0
- package/dist/esm/components/PieChart/Legend/Legend.js +12 -0
- package/dist/esm/components/PieChart/Legend/index.d.ts +1 -0
- package/dist/esm/components/PieChart/Legend/index.js +1 -0
- package/dist/esm/components/PieChart/Legend/styles.module.css +50 -0
- package/dist/esm/components/PieChart/Pie.d.ts +17 -0
- package/dist/esm/components/PieChart/Pie.js +21 -0
- package/dist/esm/components/PieChart/PieChart.d.ts +3 -0
- package/dist/esm/components/PieChart/PieChart.js +62 -0
- package/dist/esm/components/PieChart/index.d.ts +2 -0
- package/dist/esm/components/PieChart/index.js +1 -0
- package/dist/esm/components/PieChart/styles.module.css +52 -0
- package/dist/esm/components/PieChart/types.d.ts +36 -0
- package/dist/esm/components/PieChart/types.js +1 -0
- package/dist/esm/components/index.d.ts +4 -0
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/constants/colors.d.ts +36 -0
- package/dist/esm/constants/colors.js +56 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.wheelZoomPlugin = wheelZoomPlugin;
|
|
7
|
+
function wheelZoomPlugin(opts) {
|
|
8
|
+
const factor = opts.factor || 0.75;
|
|
9
|
+
let xMin, xMax, yMin, yMax, xRange, yRange;
|
|
10
|
+
function clamp(nRange, nMin, nMax, fRange, fMin, fMax) {
|
|
11
|
+
if (nRange > fRange) {
|
|
12
|
+
nMin = fMin;
|
|
13
|
+
nMax = fMax;
|
|
14
|
+
}
|
|
15
|
+
else if (nMin < fMin) {
|
|
16
|
+
nMin = fMin;
|
|
17
|
+
nMax = fMin + nRange;
|
|
18
|
+
}
|
|
19
|
+
else if (nMax > fMax) {
|
|
20
|
+
nMax = fMax;
|
|
21
|
+
nMin = fMax - nRange;
|
|
22
|
+
}
|
|
23
|
+
return [nMin, nMax];
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
hooks: {
|
|
27
|
+
ready: u => {
|
|
28
|
+
xMin = u.scales.x.min;
|
|
29
|
+
xMax = u.scales.x.max;
|
|
30
|
+
yMin = u.scales.y.min;
|
|
31
|
+
yMax = u.scales.y.max;
|
|
32
|
+
xRange = xMax - xMin;
|
|
33
|
+
yRange = yMax - yMin;
|
|
34
|
+
const plot = u.root.querySelector('.u-over');
|
|
35
|
+
const rect = plot.getBoundingClientRect();
|
|
36
|
+
// wheel drag pan
|
|
37
|
+
plot.addEventListener('mousedown', e => {
|
|
38
|
+
if (e.button == 1) {
|
|
39
|
+
// plot.style.cursor = "move";
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
const left0 = e.clientX;
|
|
42
|
+
// let top0 = e.clientY;
|
|
43
|
+
const scXMin0 = u.scales.x.min;
|
|
44
|
+
const scXMax0 = u.scales.x.max;
|
|
45
|
+
const xUnitsPerPx = u.posToVal(1, 'x') - u.posToVal(0, 'x');
|
|
46
|
+
function onmove(e) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
const left1 = e.clientX;
|
|
49
|
+
// let top1 = e.clientY;
|
|
50
|
+
const dx = xUnitsPerPx * (left1 - left0);
|
|
51
|
+
u.setScale('x', {
|
|
52
|
+
min: scXMin0 - dx,
|
|
53
|
+
max: scXMax0 - dx,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function onup(e) {
|
|
57
|
+
document.removeEventListener('mousemove', onmove);
|
|
58
|
+
document.removeEventListener('mouseup', onup);
|
|
59
|
+
}
|
|
60
|
+
document.addEventListener('mousemove', onmove);
|
|
61
|
+
document.addEventListener('mouseup', onup);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// wheel scroll zoom
|
|
65
|
+
plot.addEventListener('wheel', e => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
const { left, top } = u.cursor;
|
|
68
|
+
const leftPct = left / rect.width;
|
|
69
|
+
const btmPct = 1 - top / rect.height;
|
|
70
|
+
const xVal = u.posToVal(left, 'x');
|
|
71
|
+
const yVal = u.posToVal(top, 'y');
|
|
72
|
+
const oxRange = u.scales.x.max - u.scales.x.min;
|
|
73
|
+
const oyRange = u.scales.y.max - u.scales.y.min;
|
|
74
|
+
const nxRange = e.deltaY < 0 ? oxRange * factor : oxRange / factor;
|
|
75
|
+
let nxMin = xVal - leftPct * nxRange;
|
|
76
|
+
let nxMax = nxMin + nxRange;
|
|
77
|
+
[nxMin, nxMax] = clamp(nxRange, nxMin, nxMax, xRange, xMin, xMax);
|
|
78
|
+
const nyRange = e.deltaY < 0 ? oyRange * factor : oyRange / factor;
|
|
79
|
+
let nyMin = yVal - btmPct * nyRange;
|
|
80
|
+
let nyMax = nyMin + nyRange;
|
|
81
|
+
[nyMin, nyMax] = clamp(nyRange, nyMin, nyMax, yRange, yMin, yMax);
|
|
82
|
+
u.batch(() => {
|
|
83
|
+
u.setScale('x', {
|
|
84
|
+
min: nxMin,
|
|
85
|
+
max: nxMax,
|
|
86
|
+
});
|
|
87
|
+
u.setScale('y', {
|
|
88
|
+
min: nyMin,
|
|
89
|
+
max: nyMax,
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
:global .interactive-chart-wrapper{
|
|
2
|
+
}
|
|
3
|
+
:global .interactive-chart-wrapper .uplot{
|
|
4
|
+
font-family:inherit;
|
|
5
|
+
background-color:var(--sys-neutral-background1-level, #fdfdfd);
|
|
6
|
+
padding:16px 0;
|
|
7
|
+
border-radius:8px;
|
|
8
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
9
|
+
}
|
|
10
|
+
:global .interactive-chart-wrapper .uplot .u-title{
|
|
11
|
+
font-size:20px;
|
|
12
|
+
text-align:unset;
|
|
13
|
+
padding-left:24px;
|
|
14
|
+
}
|
|
15
|
+
:global .interactive-chart-wrapper .u-hz .u-cursor-x, :global .interactive-chart-wrapper .u-vt .u-cursor-y, :global .interactive-chart-wrapper .u-hz .u-cursor-y, :global .interactive-chart-wrapper .u-vt .u-cursor-x{
|
|
16
|
+
border-color:var(--sys-neutral-decor-default, #dde0ea);
|
|
17
|
+
}
|
|
18
|
+
:global .interactive-chart-wrapper .u-select{
|
|
19
|
+
background-color:var(--sys-neutral-decor-disabled, #e6e8ef);
|
|
20
|
+
}
|
|
21
|
+
:global .interactive-chart-wrapper table .u-series .u-marker{
|
|
22
|
+
width:16px;
|
|
23
|
+
height:16px;
|
|
24
|
+
border-radius:16px;
|
|
25
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ValueOf } from '@snack-uikit/utils';
|
|
2
|
+
import { DRAW_STYLES, LINE_INTERPOLATIONS, PLOT_TYPES } from './constants';
|
|
3
|
+
export type PlotType = ValueOf<typeof PLOT_TYPES>;
|
|
4
|
+
export type LineInterpolation = ValueOf<typeof LINE_INTERPOLATIONS>;
|
|
5
|
+
export type DrawStyle = ValueOf<typeof DRAW_STYLES>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { TextLike } from '../types';
|
|
3
|
+
type LegendItem = {
|
|
4
|
+
label: TextLike;
|
|
5
|
+
value: TextLike;
|
|
6
|
+
color?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
};
|
|
9
|
+
type LegendItemProps = LegendItem & {
|
|
10
|
+
size: 's' | 'm' | 'l';
|
|
11
|
+
onItemClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
12
|
+
};
|
|
13
|
+
declare function LegendItem({ color, label, value, size, onItemClick }: LegendItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
type LegendProps = {
|
|
15
|
+
data: Array<LegendItem>;
|
|
16
|
+
typographySize: 's' | 'm' | 'l';
|
|
17
|
+
legendTitle?: string;
|
|
18
|
+
onItemClick?: (event: MouseEvent<HTMLAnchorElement>, data: LegendItem) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare function Legend({ data, legendTitle, typographySize, onItemClick }: LegendProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Legend = Legend;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const divider_1 = require("@snack-uikit/divider");
|
|
10
|
+
const link_1 = require("@snack-uikit/link");
|
|
11
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
12
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
|
+
function LegendItem({ color, label, value, size, onItemClick }) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.legendItemWrapper, children: [(0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.legendItemTitle, children: [color && (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.dot, style: { '--color': color } }), (0, jsx_runtime_1.jsx)(link_1.Link, { onClick: onItemClick, text: String(label), size: size })] }), (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.legendValue, children: value })] }));
|
|
15
|
+
}
|
|
16
|
+
function Legend({ data, legendTitle, typographySize, onItemClick }) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.legend, children: [legendTitle && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { purpose: 'label', family: 'sans', size: typographySize, children: legendTitle }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.legendDividerWrapper, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) })] })), data.map((item, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LegendItem, Object.assign({}, item, { size: typographySize, onItemClick: onItemClick ? event => onItemClick(event, item) : undefined })), index !== data.length - 1 && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.legendDividerWrapper, children: (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) }))] }, `legend_${item.label}_${index}`)))] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Legend';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Legend"), exports);
|
|
@@ -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,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pie = Pie;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const d3_shape_1 = require("d3-shape");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
function Pie({ data, hoveredIndex, radius, innerRadius, segmentsShift, onMouseOut, label, style, segmentsStyle, onMouseOver, onMouseDown, }) {
|
|
8
|
+
const pieSegments = (0, d3_shape_1.pie)()
|
|
9
|
+
.sort(null)
|
|
10
|
+
.value((d) => d.value)(data);
|
|
11
|
+
const getHoveredPath = (0, d3_shape_1.arc)()
|
|
12
|
+
.outerRadius(radius + 1)
|
|
13
|
+
.innerRadius(innerRadius + 1)
|
|
14
|
+
.startAngle(d => d.startAngle + Math.PI / 2)
|
|
15
|
+
.endAngle(d => d.endAngle + Math.PI / 2)
|
|
16
|
+
.padAngle(segmentsShift);
|
|
17
|
+
const getPath = (0, d3_shape_1.arc)()
|
|
18
|
+
.outerRadius(radius)
|
|
19
|
+
.innerRadius(innerRadius)
|
|
20
|
+
.startAngle(d => d.startAngle + Math.PI / 2)
|
|
21
|
+
.endAngle(d => d.endAngle + Math.PI / 2)
|
|
22
|
+
.padAngle(segmentsShift);
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("svg", { viewBox: '0 0 100 100', width: '100%', height: '100%', style: style, children: (0, jsx_runtime_1.jsx)("g", { transform: 'translate(50,50)', children: pieSegments.map((segment, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.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))) }) }));
|
|
24
|
+
}
|
|
@@ -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,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PieChart = PieChart;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const ft_formatters_1 = require("@cloud-ru/ft-formatters");
|
|
20
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
21
|
+
const react_1 = require("react");
|
|
22
|
+
const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
|
|
23
|
+
const scroll_1 = require("@snack-uikit/scroll");
|
|
24
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
25
|
+
const colors_1 = require("../../constants/colors");
|
|
26
|
+
const Legend_1 = require("./Legend");
|
|
27
|
+
const Pie_1 = require("./Pie");
|
|
28
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
29
|
+
function PieChart(_a) {
|
|
30
|
+
var { options: { width, height, title, legendTitle, typographySize = 'l' }, data, aggregatedLegend, onPieSegmentClick, onLegendItemClick, className } = _a, rest = __rest(_a, ["options", "data", "aggregatedLegend", "onPieSegmentClick", "onLegendItemClick", "className"]);
|
|
31
|
+
const [hovered, setHovered] = (0, react_1.useState)(undefined);
|
|
32
|
+
const colorizedData = (0, react_1.useMemo)(() => data.map((x, index) => {
|
|
33
|
+
const colorsKey = Object.values(colors_1.SERIES_COLORS);
|
|
34
|
+
const chartColor = colors_1.CHART_SERIES_COLORS[colorsKey[index % colorsKey.length]];
|
|
35
|
+
return Object.assign(Object.assign({}, x), { color: x.color || chartColor });
|
|
36
|
+
}), [data]);
|
|
37
|
+
const pieStyles = (0, react_1.useMemo)(() => ({ overflow: 'overlay' }), []);
|
|
38
|
+
const segmentStyles = (0, react_1.useMemo)(() => ({ transition: 'all .3s', cursor: 'pointer' }), []);
|
|
39
|
+
const onMouseOverCallback = (0, react_1.useCallback)((_, index) => setHovered(index), []);
|
|
40
|
+
const onMouseOutCallback = (0, react_1.useCallback)(() => setHovered(undefined), []);
|
|
41
|
+
const onMouseDownCallback = (0, react_1.useCallback)((event, index) => {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
if (onPieSegmentClick) {
|
|
44
|
+
onPieSegmentClick(data[index]);
|
|
45
|
+
}
|
|
46
|
+
}, [data, onPieSegmentClick]);
|
|
47
|
+
const onColorizedLegendItemClick = (0, react_1.useMemo)(() => {
|
|
48
|
+
if (!onLegendItemClick) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return (event, item) => {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
onLegendItemClick(item);
|
|
54
|
+
};
|
|
55
|
+
}, [onLegendItemClick]);
|
|
56
|
+
const onAggregatedItemClick = (0, react_1.useMemo)(() => {
|
|
57
|
+
const handleClick = aggregatedLegend === null || aggregatedLegend === void 0 ? void 0 : aggregatedLegend.onAggregatedLegendItemClick;
|
|
58
|
+
if (!handleClick) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return (event, item) => {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
handleClick(item);
|
|
64
|
+
};
|
|
65
|
+
}, [aggregatedLegend]);
|
|
66
|
+
const labelRenderer = (0, react_1.useCallback)(({ dataEntry, dataIndex }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("text", { className: styles_module_scss_1.default.svgText, x: 0, y: -4, "data-hovered": hovered === dataIndex || undefined, children: (0, ft_formatters_1.truncateString)(String(dataEntry.label), 15) }, `${dataIndex}_label`), (0, jsx_runtime_1.jsx)("text", { className: styles_module_scss_1.default.svgText, x: 0, y: 4, "data-hovered": hovered === dataIndex || undefined, "data-bolder": 'true', children: dataEntry.value }, `${dataIndex}_value`)] })), [hovered]);
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, (0, uikit_product_utils_1.extractSupportProps)(rest), { className: (0, classnames_1.default)(className, styles_module_scss_1.default.wrapper), style: { '--width': width ? `${width}px` : undefined, '--height': height ? `${height}px` : undefined }, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { purpose: 'title', family: 'sans', size: typographySize, className: styles_module_scss_1.default.title, children: title }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentWrapper, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.legendWrapper, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { size: 's', children: (0, jsx_runtime_1.jsx)(Legend_1.Legend, { data: colorizedData, legendTitle: legendTitle, onItemClick: onColorizedLegendItemClick, typographySize: typographySize }) }) }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.pieWrapper, children: (0, jsx_runtime_1.jsx)(Pie_1.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 && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.legendWrapper, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { size: 's', children: (0, jsx_runtime_1.jsx)(Legend_1.Legend, { data: aggregatedLegend.data, legendTitle: aggregatedLegend.title, onItemClick: onAggregatedItemClick, typographySize: typographySize }) }) }))] })] })));
|
|
68
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PieChart"), exports);
|
|
@@ -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,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./InteractiveChart"), exports);
|
|
18
|
+
__exportStar(require("./PieChart"), exports);
|
|
19
|
+
__exportStar(require("./HeatMapChart"), exports);
|
|
20
|
+
__exportStar(require("./BagelChart"), exports);
|
|
@@ -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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHART_OTHER_COLORS = exports.OTHER_COLORS = exports.CHART_SERIES_COLORS = exports.SERIES_COLORS = exports.COLOR_CONTAINER_CLASSNAME = void 0;
|
|
4
|
+
const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
|
|
5
|
+
exports.COLOR_CONTAINER_CLASSNAME = 'interactive-chart-wrapper';
|
|
6
|
+
exports.SERIES_COLORS = {
|
|
7
|
+
Green1: 'green1',
|
|
8
|
+
Blue1: 'blue1',
|
|
9
|
+
Violet1: 'violet1',
|
|
10
|
+
Crimson1: 'crimson1',
|
|
11
|
+
Green2: 'green2',
|
|
12
|
+
Blue2: 'blue2',
|
|
13
|
+
Violet2: 'violet2',
|
|
14
|
+
Crimson2: 'crimson2',
|
|
15
|
+
Green3: 'green3',
|
|
16
|
+
Blue3: 'blue3',
|
|
17
|
+
Violet3: 'violet3',
|
|
18
|
+
Crimson3: 'crimson3',
|
|
19
|
+
Green4: 'green4',
|
|
20
|
+
Blue4: 'blue4',
|
|
21
|
+
Violet4: 'violet4',
|
|
22
|
+
Crimson4: 'crimson4',
|
|
23
|
+
};
|
|
24
|
+
exports.CHART_SERIES_COLORS = {
|
|
25
|
+
[exports.SERIES_COLORS.Green1]: figma_tokens_cloud_platform_1.themeVars.sys.green.accentDefault,
|
|
26
|
+
[exports.SERIES_COLORS.Green2]: figma_tokens_cloud_platform_1.themeVars.sys.green.textLight,
|
|
27
|
+
[exports.SERIES_COLORS.Green3]: figma_tokens_cloud_platform_1.themeVars.sys.green.textDisabled,
|
|
28
|
+
[exports.SERIES_COLORS.Green4]: figma_tokens_cloud_platform_1.themeVars.sys.green.decorActivated,
|
|
29
|
+
[exports.SERIES_COLORS.Blue1]: figma_tokens_cloud_platform_1.themeVars.sys.blue.accentDefault,
|
|
30
|
+
[exports.SERIES_COLORS.Blue2]: figma_tokens_cloud_platform_1.themeVars.sys.blue.textLight,
|
|
31
|
+
[exports.SERIES_COLORS.Blue3]: figma_tokens_cloud_platform_1.themeVars.sys.blue.textDisabled,
|
|
32
|
+
[exports.SERIES_COLORS.Blue4]: figma_tokens_cloud_platform_1.themeVars.sys.blue.decorActivated,
|
|
33
|
+
[exports.SERIES_COLORS.Violet1]: figma_tokens_cloud_platform_1.themeVars.sys.violet.accentDefault,
|
|
34
|
+
[exports.SERIES_COLORS.Violet2]: figma_tokens_cloud_platform_1.themeVars.sys.violet.textLight,
|
|
35
|
+
[exports.SERIES_COLORS.Violet3]: figma_tokens_cloud_platform_1.themeVars.sys.violet.textDisabled,
|
|
36
|
+
[exports.SERIES_COLORS.Violet4]: figma_tokens_cloud_platform_1.themeVars.sys.violet.decorActivated,
|
|
37
|
+
[exports.SERIES_COLORS.Crimson1]: figma_tokens_cloud_platform_1.themeVars.sys.pink.accentDefault,
|
|
38
|
+
[exports.SERIES_COLORS.Crimson2]: figma_tokens_cloud_platform_1.themeVars.sys.pink.textLight,
|
|
39
|
+
[exports.SERIES_COLORS.Crimson3]: figma_tokens_cloud_platform_1.themeVars.sys.pink.textDisabled,
|
|
40
|
+
[exports.SERIES_COLORS.Crimson4]: figma_tokens_cloud_platform_1.themeVars.sys.pink.decorActivated,
|
|
41
|
+
};
|
|
42
|
+
exports.OTHER_COLORS = {
|
|
43
|
+
ShadowColor: 'shadowColor',
|
|
44
|
+
LineColor: 'lineColor',
|
|
45
|
+
TooltipBackgroundColor: 'tooltipBackgroundColor',
|
|
46
|
+
TooltipColor: 'tooltipColor',
|
|
47
|
+
ColumnHighlightColor: 'columnHighlightColor',
|
|
48
|
+
AxisColor: 'axisColor',
|
|
49
|
+
LabelColor: 'labelColor',
|
|
50
|
+
};
|
|
51
|
+
exports.CHART_OTHER_COLORS = {
|
|
52
|
+
[exports.OTHER_COLORS.ShadowColor]: figma_tokens_cloud_platform_1.themeVars.sys.neutral.accentDefault,
|
|
53
|
+
[exports.OTHER_COLORS.LineColor]: figma_tokens_cloud_platform_1.themeVars.sys.neutral.onAccent,
|
|
54
|
+
[exports.OTHER_COLORS.TooltipBackgroundColor]: figma_tokens_cloud_platform_1.themeVars.sys.invertNeutral.background,
|
|
55
|
+
[exports.OTHER_COLORS.TooltipColor]: figma_tokens_cloud_platform_1.themeVars.sys.invertNeutral.textMain,
|
|
56
|
+
[exports.OTHER_COLORS.ColumnHighlightColor]: figma_tokens_cloud_platform_1.themeVars.sys.neutral.decorDefault,
|
|
57
|
+
[exports.OTHER_COLORS.AxisColor]: figma_tokens_cloud_platform_1.themeVars.sys.neutral.decorDefault,
|
|
58
|
+
[exports.OTHER_COLORS.LabelColor]: figma_tokens_cloud_platform_1.themeVars.sys.neutral.textSupport,
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WithSupportProps } from '@sbercloud/uikit-product-utils';
|
|
3
|
+
export type BagelChartProps = WithSupportProps<{
|
|
4
|
+
className: string;
|
|
5
|
+
value: number;
|
|
6
|
+
total: number;
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function BagelChart({ value, total, title, className, ...rest }: BagelChartProps): import("react/jsx-runtime").JSX.Element;
|