@geotab/zenith 3.9.0-beta.ssr.1 → 3.9.0-beta.ssr.2
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/dist/chart/pieChart/centerTextPlugin.js +1 -2
- package/dist/chart/pieChart.js +10 -3
- package/dist/commonStyles/common.less +1 -11
- package/dist/commonStyles/pillStyles/pillContent.less +3 -2
- package/dist/commonStyles/pillStyles/pillStyles.less +2 -1
- package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
- package/dist/commonStyles/typography/typography.less +305 -436
- package/dist/index.css +2132 -2305
- package/esm/chart/pieChart/centerTextPlugin.js +1 -2
- package/esm/chart/pieChart.js +11 -4
- package/package.json +2 -2
|
@@ -6,7 +6,6 @@ const getCssVar = (el, name) => { var _a, _b; return (_b = (_a = zen_1.zen.getCo
|
|
|
6
6
|
const centerTextPlugin = (centerText) => ({
|
|
7
7
|
id: "zenithPieCenterText",
|
|
8
8
|
afterDraw(chart) {
|
|
9
|
-
var _a;
|
|
10
9
|
if (!centerText || centerText.value === undefined) {
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
@@ -15,7 +14,7 @@ const centerTextPlugin = (centerText) => ({
|
|
|
15
14
|
const centerX = left + width / 2;
|
|
16
15
|
const centerY = top + height / 2;
|
|
17
16
|
const css = (name) => getCssVar(chart.canvas, name);
|
|
18
|
-
const fontFamily = (
|
|
17
|
+
const fontFamily = css("--main-font");
|
|
19
18
|
const hasLabel = !!centerText.label;
|
|
20
19
|
const valueY = hasLabel ? centerY - 14 : centerY;
|
|
21
20
|
ctx.textAlign = "center";
|
package/dist/chart/pieChart.js
CHANGED
|
@@ -18,6 +18,7 @@ const typedCharts_1 = require("../react-chartjs/typedCharts");
|
|
|
18
18
|
const auto_1 = require("chart.js/auto");
|
|
19
19
|
require("../react-chartjs/dateAdapter");
|
|
20
20
|
const utils_1 = require("../commonHelpers/utils");
|
|
21
|
+
const zen_1 = require("../utils/zen");
|
|
21
22
|
const useDrive_1 = require("../utils/theme/useDrive");
|
|
22
23
|
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
23
24
|
const themeContext_1 = require("../utils/theme/themeContext");
|
|
@@ -43,12 +44,18 @@ const PieChart = (_a) => {
|
|
|
43
44
|
const { dark } = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
44
45
|
const legendId = (0, react_1.useId)();
|
|
45
46
|
const tooltipId = (0, react_1.useId)();
|
|
47
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
46
48
|
(0, react_1.useEffect)(() => {
|
|
49
|
+
var _a;
|
|
50
|
+
const el = containerRef.current;
|
|
51
|
+
const styles = el ? (_a = zen_1.zen.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, el) : undefined;
|
|
52
|
+
const fontFamily = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--main-font").trim()) || "Roboto";
|
|
53
|
+
const color = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--text-primary").trim()) || "";
|
|
47
54
|
auto_1.Chart.defaults.font = {
|
|
48
|
-
family:
|
|
55
|
+
family: fontFamily,
|
|
49
56
|
size: fontSize
|
|
50
57
|
};
|
|
51
|
-
auto_1.Chart.defaults.color =
|
|
58
|
+
auto_1.Chart.defaults.color = color;
|
|
52
59
|
}, [fontSize, dark]);
|
|
53
60
|
const defOptions = (0, react_1.useMemo)(() => (0, getDefaultOptions_1.getDefaultOptions)(), []);
|
|
54
61
|
const chartOptions = (0, utils_1.deepMerge)(defOptions, options);
|
|
@@ -82,6 +89,6 @@ const PieChart = (_a) => {
|
|
|
82
89
|
const chartPlugins = (0, react_1.useMemo)(() => [...(plugins || []), chartLegend, chartTooltip, chartCenterText], [chartLegend, chartTooltip, chartCenterText, plugins]);
|
|
83
90
|
const intSummary = (0, useSummary_1.useSummary)(summary, chartData);
|
|
84
91
|
const legendRight = isHorizontal;
|
|
85
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-chart", legendRight ? "zen-chart--legend-right" : "", className || ""]), children: [insight ? (0, jsx_runtime_1.jsx)(chartInsight_1.ChartInsight, Object.assign({}, insight)) : null, summary ? (0, jsx_runtime_1.jsx)(summary_1.Summary, Object.assign({}, intSummary)) : null, (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__chart", children: (0, jsx_runtime_1.jsx)(typedCharts_1.Pie, Object.assign({ options: chartOptions, data: chartData, plugins: chartPlugins }, rest, { "aria-hidden": true })) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__legend", id: legendId }), (0, jsx_runtime_1.jsx)(accessibleChart_1.AccessibleChart, { type: "pie", data: chartData })] }));
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, className: (0, classNames_1.classNames)(["zen-chart", legendRight ? "zen-chart--legend-right" : "", className || ""]), children: [insight ? (0, jsx_runtime_1.jsx)(chartInsight_1.ChartInsight, Object.assign({}, insight)) : null, summary ? (0, jsx_runtime_1.jsx)(summary_1.Summary, Object.assign({}, intSummary)) : null, (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__chart", children: (0, jsx_runtime_1.jsx)(typedCharts_1.Pie, Object.assign({ options: chartOptions, data: chartData, plugins: chartPlugins }, rest, { "aria-hidden": true })) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__legend", id: legendId }), (0, jsx_runtime_1.jsx)(accessibleChart_1.AccessibleChart, { type: "pie", data: chartData })] }));
|
|
86
93
|
};
|
|
87
94
|
exports.PieChart = PieChart;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
// do not update the order of imports, as some of the files depend on variables defined in other files
|
|
2
|
-
// only variables that are used in multiple files should be defined here, and they should not depend on any other variables
|
|
3
1
|
@import "fonts/roboto.less";
|
|
4
2
|
@import "fonts/robotomono.less";
|
|
5
|
-
@main-font-family: Roboto, "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
|
|
6
|
-
@driver-font-family: "Roboto Mono", "Segoe UI", Segoe, "Helvetica Neue", Helvetica, sans-serif;
|
|
7
|
-
@rem: 16rem;
|
|
8
|
-
|
|
9
|
-
@import "typography/typography.less";
|
|
10
|
-
|
|
11
3
|
@import "colors/colors.less";
|
|
4
|
+
@import "typography/typography.less";
|
|
12
5
|
@import "caption/caption.less";
|
|
13
6
|
@import "ellipsis.less";
|
|
14
7
|
@import "notSelectable.less";
|
|
@@ -20,9 +13,6 @@
|
|
|
20
13
|
@import "zIndex.less";
|
|
21
14
|
@import "rangeFieldMixin.less";
|
|
22
15
|
|
|
23
|
-
// do not set variables or styles here,
|
|
24
|
-
// as this file is imported in all other files and it may cause circular dependencies
|
|
25
|
-
|
|
26
16
|
@border-width-default: 1px;
|
|
27
17
|
@border-radius-default: 4px;
|
|
28
18
|
@padding-top-bottom: 8px;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../common.less";
|
|
2
|
+
@import "../typography/typography.less";
|
|
2
3
|
|
|
3
4
|
@pill-min-width-default: 30px;
|
|
4
5
|
@pill-max-width-default: 200px;
|
|
@@ -97,9 +98,9 @@
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
&.zen-pill-new-content--drive {
|
|
100
|
-
.body-04-drive();
|
|
101
|
+
.body-04-mobile-drive();
|
|
101
102
|
}
|
|
102
103
|
&.zen-pill-new-content--drive-tablet {
|
|
103
|
-
.body-04-drive();
|
|
104
|
+
.body-04-tablet-drive();
|
|
104
105
|
}
|
|
105
106
|
}
|