@cashub/ui 0.13.3 → 0.13.5
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/chart/BarChart.js +12 -4
- package/chart/DoughnutChart.js +17 -2
- package/chart/LineChart.js +12 -2
- package/package.json +1 -1
- package/styles/mixin/colorOnBackground.js +2 -2
package/chart/BarChart.js
CHANGED
|
@@ -39,7 +39,6 @@ var BarChart = function BarChart(_ref) {
|
|
|
39
39
|
options = _ref$options === void 0 ? {} : _ref$options,
|
|
40
40
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
41
|
|
|
42
|
-
var chartRef = (0, _react.useRef)();
|
|
43
42
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext); // fix: read value from theme
|
|
44
43
|
|
|
45
44
|
_reactChartjs.defaults.font.family = theme.fontFamily;
|
|
@@ -88,8 +87,18 @@ var BarChart = function BarChart(_ref) {
|
|
|
88
87
|
|
|
89
88
|
return label.toString();
|
|
90
89
|
},
|
|
91
|
-
labelTextColor: function labelTextColor() {
|
|
92
|
-
|
|
90
|
+
labelTextColor: function labelTextColor(context) {
|
|
91
|
+
var color = context.dataset.color;
|
|
92
|
+
|
|
93
|
+
if (!color) {
|
|
94
|
+
return theme.fontOnPrimary;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (color && Array.isArray(color)) {
|
|
98
|
+
return color[context.dataIndex % color.length];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return color;
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
104
|
}
|
|
@@ -130,7 +139,6 @@ var BarChart = function BarChart(_ref) {
|
|
|
130
139
|
};
|
|
131
140
|
}, [customOptions, theme.fontOnPrimary]);
|
|
132
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactChartjs.Bar, _objectSpread({
|
|
133
|
-
ref: chartRef,
|
|
134
142
|
height: height,
|
|
135
143
|
data: data,
|
|
136
144
|
options: defaultOptions,
|
package/chart/DoughnutChart.js
CHANGED
|
@@ -54,11 +54,26 @@ var DoughnutChart = function DoughnutChart(_ref) {
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
tooltip: {
|
|
57
|
-
enabled: false
|
|
57
|
+
enabled: false,
|
|
58
|
+
callbacks: {
|
|
59
|
+
labelTextColor: function labelTextColor(context) {
|
|
60
|
+
var color = context.dataset.color;
|
|
61
|
+
|
|
62
|
+
if (!color) {
|
|
63
|
+
return theme.fontOnPrimary;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (color && Array.isArray(color)) {
|
|
67
|
+
return color[context.dataIndex % color.length];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return color;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
58
73
|
}
|
|
59
74
|
}
|
|
60
75
|
};
|
|
61
|
-
}, []);
|
|
76
|
+
}, [theme.fontOnPrimary]);
|
|
62
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactChartjs.Doughnut, _objectSpread({
|
|
63
78
|
height: height,
|
|
64
79
|
data: data,
|
package/chart/LineChart.js
CHANGED
|
@@ -88,8 +88,18 @@ var LineChart = function LineChart(_ref) {
|
|
|
88
88
|
backgroundColor: borderColor
|
|
89
89
|
};
|
|
90
90
|
},
|
|
91
|
-
labelTextColor: function labelTextColor() {
|
|
92
|
-
|
|
91
|
+
labelTextColor: function labelTextColor(context) {
|
|
92
|
+
var color = context.dataset.color;
|
|
93
|
+
|
|
94
|
+
if (!color) {
|
|
95
|
+
return theme.fontOnPrimary;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (color && Array.isArray(color)) {
|
|
99
|
+
return color[context.dataIndex % color.length];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return color;
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
}
|
package/package.json
CHANGED
|
@@ -19,10 +19,10 @@ var colorOnBackground = (0, _styledComponents.css)(_templateObject || (_template
|
|
|
19
19
|
return success && 'color: var(--font-on-success);';
|
|
20
20
|
}, function (_ref3) {
|
|
21
21
|
var warning = _ref3.warning;
|
|
22
|
-
return warning && 'color: var(--font-on-
|
|
22
|
+
return warning && 'color: var(--font-on-warning);';
|
|
23
23
|
}, function (_ref4) {
|
|
24
24
|
var danger = _ref4.danger;
|
|
25
|
-
return danger && 'color: var(--font-on-
|
|
25
|
+
return danger && 'color: var(--font-on-danger);';
|
|
26
26
|
});
|
|
27
27
|
var _default = colorOnBackground;
|
|
28
28
|
exports.default = _default;
|