@cashub/ui 0.13.3 → 0.13.4

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 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
- return theme.fontOnPrimary;
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,
@@ -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,
@@ -88,8 +88,18 @@ var LineChart = function LineChart(_ref) {
88
88
  backgroundColor: borderColor
89
89
  };
90
90
  },
91
- labelTextColor: function labelTextColor() {
92
- return theme.fontOnPrimary;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "private": false,
5
5
  "author": "CASHUB Team",
6
6
  "description": "CASHUB UI components library",