@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.13.13 (2025-11-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PD-3377:** contributors update to publish all packages ([719fd3e](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/719fd3e1249e247443b125c47ea408d92c8395c3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.13.12 (2025-11-12)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -592,7 +603,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
592
603
|
|
|
593
604
|
## [0.8.22](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-product-charts@0.8.21...@cloud-ru/uikit-product-charts@0.8.22) (2022-07-07)
|
|
594
605
|
|
|
595
|
-
|
|
606
|
+
### Only dependencies have been changed
|
|
607
|
+
* [@cloud-ru/uikit-product-localization@0.13.13](https://gitverse.ru/cloud-ru-tech/uikit-product/-/blob/master/packages/localization/CHANGELOG.md)
|
|
608
|
+
* [@cloud-ru/uikit-product-utils@7.0.1](https://gitverse.ru/cloud-ru-tech/uikit-product/-/blob/master/packages/utils/CHANGELOG.md)
|
|
596
609
|
|
|
597
610
|
## [0.8.21](https://gitverse.ru/cloud-ru-tech/uikit-product/compare/@cloud-ru/uikit-product-charts@0.8.20...@cloud-ru/uikit-product-charts@0.8.21) (2022-06-08)
|
|
598
611
|
|
|
@@ -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;
|
|
@@ -0,0 +1,31 @@
|
|
|
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.BagelChart = BagelChart;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const react_minimal_pie_chart_1 = require("react-minimal-pie-chart");
|
|
21
|
+
const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
|
|
22
|
+
const uikit_product_localization_1 = require("@sbercloud/uikit-product-localization");
|
|
23
|
+
const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
|
|
24
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
25
|
+
const utils_1 = require("./utils");
|
|
26
|
+
function BagelChart(_a) {
|
|
27
|
+
var { value, total, title, className } = _a, rest = __rest(_a, ["value", "total", "title", "className"]);
|
|
28
|
+
(0, uikit_product_utils_1.error)('Value is too long', value > 9999999);
|
|
29
|
+
(0, uikit_product_utils_1.error)('Total is too long', total > 999999999);
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.wrapper, className) }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: [title && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.titleWrapper, children: title }), (0, jsx_runtime_1.jsx)(react_minimal_pie_chart_1.PieChart, { data: [{ value, color: (0, utils_1.getSegmentColor)({ value, total }) }], totalValue: total, background: figma_tokens_cloud_platform_1.themeVars.sys.neutral.decorDefault, startAngle: 270, lineWidth: 15, label: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("text", { className: styles_module_scss_1.default.value, x: 50, y: 45, children: (0, jsx_runtime_1.jsx)(uikit_product_localization_1.NumberFormatter, { value: value }) }), (0, jsx_runtime_1.jsx)("text", { className: styles_module_scss_1.default.limit, x: 50, y: 65, children: (0, jsx_runtime_1.jsx)(uikit_product_localization_1.NumberFormatter, { value: total }) })] })), labelPosition: 0 })] })));
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BagelChart';
|
|
@@ -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("./BagelChart"), exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.wrapper{
|
|
2
|
+
min-width:100px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.titleWrapper{
|
|
6
|
+
font-family:var(--sans-title-m-font-family, SB Sans Interface);
|
|
7
|
+
font-weight:var(--sans-title-m-font-weight, Semibold);
|
|
8
|
+
line-height:var(--sans-title-m-line-height, 24px);
|
|
9
|
+
font-size:var(--sans-title-m-font-size, 16px);
|
|
10
|
+
letter-spacing:var(--sans-title-m-letter-spacing, 0.15px);
|
|
11
|
+
paragraph-spacing:var(--sans-title-m-paragraph-spacing, 8.8px);
|
|
12
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
13
|
+
margin-bottom:8px;
|
|
14
|
+
display:flex;
|
|
15
|
+
justify-content:center;
|
|
16
|
+
gap:4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.value{
|
|
20
|
+
font-family:var(--sans-title-m-font-family, SB Sans Interface);
|
|
21
|
+
font-weight:var(--sans-title-m-font-weight, Semibold);
|
|
22
|
+
line-height:var(--sans-title-m-line-height, 24px);
|
|
23
|
+
font-size:var(--sans-title-m-font-size, 16px);
|
|
24
|
+
letter-spacing:var(--sans-title-m-letter-spacing, 0.15px);
|
|
25
|
+
paragraph-spacing:var(--sans-title-m-paragraph-spacing, 8.8px);
|
|
26
|
+
fill:var(--sys-neutral-text-main, #41424e);
|
|
27
|
+
text-anchor:middle;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.limit{
|
|
31
|
+
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
32
|
+
font-weight:var(--sans-body-m-font-weight, Regular);
|
|
33
|
+
line-height:var(--sans-body-m-line-height, 20px);
|
|
34
|
+
font-size:var(--sans-body-m-font-size, 14px);
|
|
35
|
+
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
36
|
+
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
37
|
+
fill:var(--sys-neutral-text-support, #6d707f);
|
|
38
|
+
text-anchor:middle;
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSegmentColor = getSegmentColor;
|
|
4
|
+
const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
|
|
5
|
+
function getSegmentColor({ value, total }) {
|
|
6
|
+
const occupancyPercent = (value / total) * 100;
|
|
7
|
+
let segmentColor = figma_tokens_cloud_platform_1.themeVars.sys.green.accentDefault;
|
|
8
|
+
if (occupancyPercent > 50 && occupancyPercent <= 75) {
|
|
9
|
+
segmentColor = figma_tokens_cloud_platform_1.themeVars.sys.yellow.accentDefault;
|
|
10
|
+
}
|
|
11
|
+
else if (occupancyPercent > 75) {
|
|
12
|
+
segmentColor = figma_tokens_cloud_platform_1.themeVars.sys.red.accentDefault;
|
|
13
|
+
}
|
|
14
|
+
return segmentColor;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WithSupportProps } from '@sbercloud/uikit-product-utils';
|
|
2
|
+
import { XAxisPosition } from './constants';
|
|
3
|
+
import { HeatMapChartProps } from './types';
|
|
4
|
+
export declare function HeatMapChart({ data, options, className, ...rest }: WithSupportProps<HeatMapChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare namespace HeatMapChart {
|
|
6
|
+
var xAxisPositions: typeof XAxisPosition;
|
|
7
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.HeatMapChart = HeatMapChart;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const d3_scale_1 = require("d3-scale");
|
|
21
|
+
const react_1 = require("react");
|
|
22
|
+
const react_grid_heatmap_1 = require("react-grid-heatmap");
|
|
23
|
+
const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
|
|
24
|
+
const uikit_product_utils_1 = require("@sbercloud/uikit-product-utils");
|
|
25
|
+
const divider_1 = require("@snack-uikit/divider");
|
|
26
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
27
|
+
const constants_1 = require("./constants");
|
|
28
|
+
const helpers_1 = require("./helpers");
|
|
29
|
+
const constants_2 = require("./helpers/constants");
|
|
30
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
31
|
+
function HeatMapChart(_a) {
|
|
32
|
+
var _b;
|
|
33
|
+
var { data, options, className } = _a, rest = __rest(_a, ["data", "options", "className"]);
|
|
34
|
+
const { title, height = constants_2.DEFAULT_CHART_HEIGHT, axes = {}, formatter, legend, domain, cellRender, styles: stylesProp, } = options;
|
|
35
|
+
const { xAxis, yAxis } = axes;
|
|
36
|
+
const xAxisPosition = (xAxis === null || xAxis === void 0 ? void 0 : xAxis.position) || constants_1.XAxisPosition.Bottom;
|
|
37
|
+
const isLegendEnabled = (_b = legend === null || legend === void 0 ? void 0 : legend.show) !== null && _b !== void 0 ? _b : true;
|
|
38
|
+
const colorContainerRef = (0, react_1.useRef)(null);
|
|
39
|
+
// TODO https://jira.sbercloud.tech/browse/FF-6024
|
|
40
|
+
const { theme } = (0, uikit_product_utils_1.useTheme)();
|
|
41
|
+
const [colorRange, setColorRange] = (0, react_1.useState)(['#ffffff', '#000000']);
|
|
42
|
+
const [lightTextColor, setLightTextColor] = (0, react_1.useState)('#ffffff');
|
|
43
|
+
const [darkTextColor, setDarkTextColor] = (0, react_1.useState)('#000000');
|
|
44
|
+
(0, utils_1.useLayoutEffect)(() => {
|
|
45
|
+
if (!colorContainerRef.current) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const rangeStart = (0, helpers_1.getComputedColor)(colorContainerRef.current, '--range-start');
|
|
49
|
+
const rangeEnd = (0, helpers_1.getComputedColor)(colorContainerRef.current, '--range-end');
|
|
50
|
+
const lightTextColor = (0, helpers_1.getComputedColor)(colorContainerRef.current, '--light-text');
|
|
51
|
+
const darkTextColor = (0, helpers_1.getComputedColor)(colorContainerRef.current, '--dark-text');
|
|
52
|
+
setColorRange([rangeStart, rangeEnd]);
|
|
53
|
+
setLightTextColor(lightTextColor);
|
|
54
|
+
setDarkTextColor(darkTextColor);
|
|
55
|
+
}, [theme]);
|
|
56
|
+
const colorScale = (0, react_1.useMemo)(() => (0, d3_scale_1.scaleLinear)(colorRange).domain(domain), [colorRange, domain]);
|
|
57
|
+
const commonStyles = (0, react_1.useMemo)(() => (0, helpers_1.getStyles)(colorScale, data), [colorScale, data]);
|
|
58
|
+
const legendTicks = (0, react_1.useMemo)(() => (0, helpers_1.getTickValues)(domain), [domain]);
|
|
59
|
+
const cellHeight = (0, react_1.useMemo)(() => {
|
|
60
|
+
var _a;
|
|
61
|
+
const titleHeight = title ? constants_2.TITLE_HEIGHT : 0;
|
|
62
|
+
const xLabelsHeight = ((_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.ticks) === null || _a === void 0 ? void 0 : _a.length) ? constants_2.TICKS_SIZE : 0;
|
|
63
|
+
const xAxisLabelHeight = (yAxis === null || yAxis === void 0 ? void 0 : yAxis.ticks) ? constants_2.X_AXIS_LABEL_HEIGHT : 0;
|
|
64
|
+
const legendHeight = isLegendEnabled ? constants_2.LEGEND_HEIGHT : 0;
|
|
65
|
+
const chartHeight = height - 48 - titleHeight - xLabelsHeight - xAxisLabelHeight - legendHeight;
|
|
66
|
+
return `${chartHeight / data.length}px`;
|
|
67
|
+
}, [data, height, title, xAxis, yAxis, isLegendEnabled]);
|
|
68
|
+
const gradient = (0, react_1.useMemo)(() => {
|
|
69
|
+
const parts = colorRange.map((color, i) => `${color} ${i * (100 / (colorRange.length - 1))}%`);
|
|
70
|
+
return `linear-gradient(90deg, ${parts})`;
|
|
71
|
+
}, [colorRange]);
|
|
72
|
+
const formatValue = (0, react_1.useCallback)((value) => (formatter && typeof formatter === 'function' ? formatter(value) : value), [formatter]);
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.wrapper, className) }, (0, uikit_product_utils_1.extractSupportProps)(rest), { ref: colorContainerRef, style: {
|
|
74
|
+
'--range-start': figma_tokens_cloud_platform_1.themeVars.sys.primary.decorDisabled,
|
|
75
|
+
'--range-end': figma_tokens_cloud_platform_1.themeVars.sys.primary.accentDefault,
|
|
76
|
+
'--light-text': figma_tokens_cloud_platform_1.themeVars.ref.brand['90'],
|
|
77
|
+
'--dark-text': figma_tokens_cloud_platform_1.themeVars.ref.brand['30'],
|
|
78
|
+
}, children: [title && (0, jsx_runtime_1.jsx)("h3", { className: styles_module_scss_1.default.title, children: title }), (xAxis === null || xAxis === void 0 ? void 0 : xAxis.label) && xAxisPosition === constants_1.XAxisPosition.Top && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.xAxisLabel, children: xAxis.label }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.gridWrapper, "data-grid": Boolean(yAxis === null || yAxis === void 0 ? void 0 : yAxis.label) || undefined, children: [(yAxis === null || yAxis === void 0 ? void 0 : yAxis.label) && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.yAxisLabel, "data-x-axis-position": xAxisPosition, children: yAxis.label })), (0, jsx_runtime_1.jsx)(react_grid_heatmap_1.HeatMapGrid, { data: data, xLabels: xAxis === null || xAxis === void 0 ? void 0 : xAxis.ticks, yLabels: yAxis === null || yAxis === void 0 ? void 0 : yAxis.ticks, xLabelsPos: xAxisPosition, yLabelsPos: 'left', cellRender:
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
+
cellRender ||
|
|
81
|
+
((x, y, value) => ((0, jsx_runtime_1.jsx)("h5", { className: styles_module_scss_1.default.cell, title: String(value), style: {
|
|
82
|
+
'--color': (0, helpers_1.getContrastColor)({
|
|
83
|
+
lightColor: lightTextColor,
|
|
84
|
+
darkColor: darkTextColor,
|
|
85
|
+
rgb: colorScale(value),
|
|
86
|
+
}),
|
|
87
|
+
}, children: formatValue(value) }))), xLabelsStyle: (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.xLabelsStyle) || commonStyles.xLabelsStyle, yLabelsStyle: (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.yLabelsStyle) || commonStyles.yLabelsStyle, cellStyle: (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.cellStyle) || commonStyles.cellStyle, cellHeight: cellHeight })] }), (xAxis === null || xAxis === void 0 ? void 0 : xAxis.label) && xAxisPosition === constants_1.XAxisPosition.Bottom && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.xAxisLabel, children: xAxis.label }), isLegendEnabled && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.legend, children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.gradient, style: { '--gradient': gradient } }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.legendTicksWrapper, children: legendTicks.map((tick) => ((0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.tick, children: tick }, tick))) })] }))] })));
|
|
88
|
+
}
|
|
89
|
+
HeatMapChart.xAxisPositions = constants_1.XAxisPosition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XAxisPosition = void 0;
|
|
4
|
+
var XAxisPosition;
|
|
5
|
+
(function (XAxisPosition) {
|
|
6
|
+
XAxisPosition["Top"] = "top";
|
|
7
|
+
XAxisPosition["Bottom"] = "bottom";
|
|
8
|
+
})(XAxisPosition || (exports.XAxisPosition = XAxisPosition = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const TITLE_HEIGHT = 74;
|
|
2
|
+
export declare const TICKS_SIZE = 34;
|
|
3
|
+
export declare const X_AXIS_LABEL_HEIGHT = 32;
|
|
4
|
+
export declare const LEGEND_HEIGHT = 94;
|
|
5
|
+
export declare const DEFAULT_CHART_HEIGHT = 700;
|
|
6
|
+
export declare const DEFAULT_LEGEND_TICKS_NUM = 5;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_LEGEND_TICKS_NUM = exports.DEFAULT_CHART_HEIGHT = exports.LEGEND_HEIGHT = exports.X_AXIS_LABEL_HEIGHT = exports.TICKS_SIZE = exports.TITLE_HEIGHT = void 0;
|
|
4
|
+
exports.TITLE_HEIGHT = 74;
|
|
5
|
+
exports.TICKS_SIZE = 34;
|
|
6
|
+
exports.X_AXIS_LABEL_HEIGHT = 32;
|
|
7
|
+
exports.LEGEND_HEIGHT = 94;
|
|
8
|
+
exports.DEFAULT_CHART_HEIGHT = 700;
|
|
9
|
+
exports.DEFAULT_LEGEND_TICKS_NUM = 5;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getComputedColor(el: HTMLElement, prop: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContrastColor = void 0;
|
|
4
|
+
const getContrastColor = ({ rgb, darkColor, lightColor, }) => {
|
|
5
|
+
// https://gomakethings.com/dynamically-changing-the-text-color-based-on-background-color-contrast-with-vanilla-js/
|
|
6
|
+
const bgColor = rgb.split(/\(([^)]+)\)/)[1].replace(/ /g, '');
|
|
7
|
+
const [r, g, b] = bgColor.split(',');
|
|
8
|
+
const yiq = (Math.round(parseInt(r) * 299) + Math.round(parseInt(g) * 587) + Math.round(parseInt(b) * 114)) / 1000;
|
|
9
|
+
return yiq >= 152 ? darkColor : lightColor;
|
|
10
|
+
};
|
|
11
|
+
exports.getContrastColor = getContrastColor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStyles = void 0;
|
|
4
|
+
const figma_tokens_cloud_platform_1 = require("@sbercloud/figma-tokens-cloud-platform");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const getStyles = (colorScale, data) => ({
|
|
7
|
+
cellStyle: (x, y) => ({
|
|
8
|
+
backgroundColor: colorScale(data[x][y]),
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
borderRadius: '4px',
|
|
13
|
+
padding: '4px',
|
|
14
|
+
borderColor: figma_tokens_cloud_platform_1.themeVars.sys.neutral.background1Level,
|
|
15
|
+
}),
|
|
16
|
+
xLabelsStyle: () => ({
|
|
17
|
+
fontSize: '12px',
|
|
18
|
+
lineHeight: '10px',
|
|
19
|
+
fontWeight: 400,
|
|
20
|
+
marginTop: '12px',
|
|
21
|
+
color: figma_tokens_cloud_platform_1.themeVars.sys.neutral.textSupport,
|
|
22
|
+
padding: 0,
|
|
23
|
+
height: `${constants_1.TICKS_SIZE - 12}px`,
|
|
24
|
+
}),
|
|
25
|
+
yLabelsStyle: () => ({
|
|
26
|
+
width: `${constants_1.TICKS_SIZE - 8}px`,
|
|
27
|
+
fontSize: '12px',
|
|
28
|
+
marginRight: '8px',
|
|
29
|
+
padding: '0',
|
|
30
|
+
color: figma_tokens_cloud_platform_1.themeVars.sys.neutral.textSupport,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
exports.getStyles = getStyles;
|
|
@@ -0,0 +1,68 @@
|
|
|
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.getTickValues = void 0;
|
|
7
|
+
const lodash_range_1 = __importDefault(require("lodash.range"));
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
/**
|
|
10
|
+
* Returns a "nice" number approximately equal to range Rounds
|
|
11
|
+
* the number if round = true Takes the ceiling if round = false.
|
|
12
|
+
*
|
|
13
|
+
* @param range the data range
|
|
14
|
+
* @param round whether to round the result
|
|
15
|
+
* @return a "nice" number to be used for the data range
|
|
16
|
+
*/
|
|
17
|
+
const niceNum = (range, round) => {
|
|
18
|
+
let niceFraction;
|
|
19
|
+
const exponent = Math.floor(Math.log10(range));
|
|
20
|
+
const fraction = range / Math.pow(10, exponent);
|
|
21
|
+
if (round) {
|
|
22
|
+
if (fraction < 1.5)
|
|
23
|
+
niceFraction = 1;
|
|
24
|
+
else if (fraction < 3)
|
|
25
|
+
niceFraction = 2;
|
|
26
|
+
else if (fraction < 7)
|
|
27
|
+
niceFraction = 5;
|
|
28
|
+
else
|
|
29
|
+
niceFraction = 10;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (fraction <= 1)
|
|
33
|
+
niceFraction = 1;
|
|
34
|
+
else if (fraction <= 2)
|
|
35
|
+
niceFraction = 2;
|
|
36
|
+
else if (fraction <= 5)
|
|
37
|
+
niceFraction = 5;
|
|
38
|
+
else
|
|
39
|
+
niceFraction = 10;
|
|
40
|
+
}
|
|
41
|
+
return niceFraction * Math.pow(10, exponent);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Calculate and update values for tick spacing and nice
|
|
45
|
+
* minimum and maximum data points on the axis.
|
|
46
|
+
*/
|
|
47
|
+
const calculateTicks = (maxTicks, minPoint, maxPoint) => {
|
|
48
|
+
const range = niceNum(maxPoint - minPoint, false);
|
|
49
|
+
const tickSpacing = niceNum(range / (maxTicks - 1), true);
|
|
50
|
+
const niceMin = Math.floor(minPoint / tickSpacing) * tickSpacing;
|
|
51
|
+
const niceMax = Math.ceil(maxPoint / tickSpacing) * tickSpacing;
|
|
52
|
+
return [tickSpacing, niceMin, niceMax];
|
|
53
|
+
};
|
|
54
|
+
const getTickValues = (domain) => {
|
|
55
|
+
const [min, max] = domain;
|
|
56
|
+
const [tickSpacing, niceMin, niceMax] = calculateTicks(constants_1.DEFAULT_LEGEND_TICKS_NUM, min, max);
|
|
57
|
+
const rangeValues = (0, lodash_range_1.default)(niceMin, niceMax, tickSpacing).filter(v => (v > 1 ? Math.floor(v) > min : v > min));
|
|
58
|
+
return [...new Set([min, ...rangeValues, max])].map(value => {
|
|
59
|
+
if (value === 0) {
|
|
60
|
+
return '0';
|
|
61
|
+
}
|
|
62
|
+
if (value < 1) {
|
|
63
|
+
return value.toFixed(1);
|
|
64
|
+
}
|
|
65
|
+
return String(Math.floor(value));
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.getTickValues = getTickValues;
|
|
@@ -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("./getComputedColor"), exports);
|
|
18
|
+
__exportStar(require("./getContrastColor"), exports);
|
|
19
|
+
__exportStar(require("./getStyles"), exports);
|
|
20
|
+
__exportStar(require("./getTickValues"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HeatMapChart = void 0;
|
|
4
|
+
var HeatMapChart_1 = require("./HeatMapChart");
|
|
5
|
+
Object.defineProperty(exports, "HeatMapChart", { enumerable: true, get: function () { return HeatMapChart_1.HeatMapChart; } });
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
.wrapper{
|
|
2
|
+
padding:24px;
|
|
3
|
+
background-color:var(--sys-neutral-background1-level, #fdfdfd);
|
|
4
|
+
border-radius:8px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.gridWrapper{
|
|
8
|
+
position:relative;
|
|
9
|
+
display:block;
|
|
10
|
+
}
|
|
11
|
+
.gridWrapper[data-grid]{
|
|
12
|
+
display:grid;
|
|
13
|
+
grid-auto-rows:minmax(min-content, max-content);
|
|
14
|
+
grid-template-columns:auto 1fr;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.title{
|
|
18
|
+
font-family:var(--sans-title-m-font-family, SB Sans Interface);
|
|
19
|
+
font-weight:var(--sans-title-m-font-weight, Semibold);
|
|
20
|
+
line-height:var(--sans-title-m-line-height, 24px);
|
|
21
|
+
font-size:var(--sans-title-m-font-size, 16px);
|
|
22
|
+
letter-spacing:var(--sans-title-m-letter-spacing, 0.15px);
|
|
23
|
+
paragraph-spacing:var(--sans-title-m-paragraph-spacing, 8.8px);
|
|
24
|
+
margin-bottom:24px;
|
|
25
|
+
font-size:20px;
|
|
26
|
+
font-weight:bold;
|
|
27
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
28
|
+
height:50px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.legend{
|
|
32
|
+
margin-top:24px;
|
|
33
|
+
height:70px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.gradient{
|
|
37
|
+
height:20px;
|
|
38
|
+
margin:24px 0 8px;
|
|
39
|
+
background:var(--gradient);
|
|
40
|
+
background-color:var(--sys-red-accent-default, #cb3f3e) !important;
|
|
41
|
+
border-radius:4px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.legendTicksWrapper{
|
|
45
|
+
display:flex;
|
|
46
|
+
justify-content:space-between;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tick{
|
|
50
|
+
font-family:var(--sans-body-m-font-family, SB Sans Interface);
|
|
51
|
+
font-weight:var(--sans-body-m-font-weight, Regular);
|
|
52
|
+
line-height:var(--sans-body-m-line-height, 20px);
|
|
53
|
+
font-size:var(--sans-body-m-font-size, 14px);
|
|
54
|
+
letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
|
|
55
|
+
paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
|
|
56
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
57
|
+
font-size:12px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cell{
|
|
61
|
+
font-family:var(--sans-body-s-font-family, SB Sans Interface);
|
|
62
|
+
font-weight:var(--sans-body-s-font-weight, Regular);
|
|
63
|
+
line-height:var(--sans-body-s-line-height, 16px);
|
|
64
|
+
font-size:var(--sans-body-s-font-size, 12px);
|
|
65
|
+
letter-spacing:var(--sans-body-s-letter-spacing, 0.1px);
|
|
66
|
+
paragraph-spacing:var(--sans-body-s-paragraph-spacing, 6.6px);
|
|
67
|
+
color:var(--color);
|
|
68
|
+
text-overflow:ellipsis;
|
|
69
|
+
overflow:hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.xAxisLabel{
|
|
73
|
+
display:flex;
|
|
74
|
+
justify-content:center;
|
|
75
|
+
margin-top:8px;
|
|
76
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
77
|
+
font-size:12px;
|
|
78
|
+
font-weight:600;
|
|
79
|
+
height:24px;
|
|
80
|
+
margin-left:6px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.yAxisLabel{
|
|
84
|
+
margin-right:16px;
|
|
85
|
+
transform:rotate(180deg);
|
|
86
|
+
transform-origin:right, top;
|
|
87
|
+
writing-mode:vertical-rl;
|
|
88
|
+
text-align:center;
|
|
89
|
+
font-size:12px;
|
|
90
|
+
font-weight:600;
|
|
91
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
92
|
+
}
|
|
93
|
+
.yAxisLabel[data-x-axis-position=top]{
|
|
94
|
+
margin-top:34px;
|
|
95
|
+
}
|
|
96
|
+
.yAxisLabel[data-x-axis-position=bottom]{
|
|
97
|
+
margin-bottom:34px;
|
|
98
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { XAxisPosition } from './constants';
|
|
3
|
+
export type HeatMapChartAxisOptions = {
|
|
4
|
+
label?: string;
|
|
5
|
+
ticks?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type HeatMapChartLegendOptions = {
|
|
8
|
+
show?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type HeatMapChartAxesOptions = {
|
|
11
|
+
xAxis?: HeatMapChartAxisOptions & {
|
|
12
|
+
position?: XAxisPosition;
|
|
13
|
+
};
|
|
14
|
+
yAxis?: HeatMapChartAxisOptions;
|
|
15
|
+
};
|
|
16
|
+
export type HeatMapChartStyles = {
|
|
17
|
+
xLabelsStyle: (index: number) => Record<string, string | number>;
|
|
18
|
+
yLabelsStyle: (index: number) => Record<string, string | number>;
|
|
19
|
+
cellStyle: (x: number, y: number, ratio: number) => Record<string, string | number>;
|
|
20
|
+
};
|
|
21
|
+
export type HeatMapChartOptions = {
|
|
22
|
+
title?: string;
|
|
23
|
+
height?: number;
|
|
24
|
+
formatter?: (value: number) => string;
|
|
25
|
+
axes?: HeatMapChartAxesOptions;
|
|
26
|
+
domain: [number, number];
|
|
27
|
+
cellRender?: (x: number, y: number, value: number) => ReactNode;
|
|
28
|
+
legend?: HeatMapChartLegendOptions;
|
|
29
|
+
styles?: Partial<HeatMapChartStyles>;
|
|
30
|
+
};
|
|
31
|
+
export type HeatMapChartProps = {
|
|
32
|
+
data: number[][];
|
|
33
|
+
options: HeatMapChartOptions;
|
|
34
|
+
className?: string;
|
|
35
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'uplot/dist/uPlot.min.css';
|
|
2
|
+
import './styles.module.scss';
|
|
3
|
+
import uPlot from 'uplot';
|
|
4
|
+
import { WithSupportProps } from '@sbercloud/uikit-product-utils';
|
|
5
|
+
import { PlotType } from './types';
|
|
6
|
+
export type InteractiveChartProps = {
|
|
7
|
+
data: uPlot.AlignedData;
|
|
8
|
+
options?: Partial<uPlot.Options>;
|
|
9
|
+
type?: PlotType;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function InteractiveChart({ data, options, type, className, ...rest }: WithSupportProps<InteractiveChartProps>): import("react/jsx-runtime").JSX.Element;
|