@cashub/ui 0.48.7 → 0.48.9

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
@@ -9,6 +9,7 @@ var _styledComponents = require("styled-components");
9
9
  var _reactChartjs = require("react-chartjs-2");
10
10
  var _customTooltip = _interopRequireDefault(require("./utils/customTooltip"));
11
11
  var _padEmptyChartBar = _interopRequireDefault(require("./utils/padEmptyChartBar"));
12
+ var _yAxisTopTitlePlugin = _interopRequireDefault(require("./utils/yAxisTopTitlePlugin"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  const _excluded = ["height", "data", "options"];
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -35,6 +36,7 @@ const BarChart = _ref => {
35
36
  _reactChartjs.defaults.plugins.tooltip.external = (0, _customTooltip.default)(theme);
36
37
  const customOptions = (0, _react.useMemo)(() => {
37
38
  const {
39
+ yAxisTopTitle,
38
40
  tooltips = {}
39
41
  } = options;
40
42
  return {
@@ -44,6 +46,7 @@ const BarChart = _ref => {
44
46
  suggestedMax: options.suggestedMax === undefined ? 10 : options.suggestedMax,
45
47
  showLegend: options.showLegend === undefined ? false : options.showLegend,
46
48
  rotateLabel: options.rotateLabel === undefined ? true : options.rotateLabel,
49
+ yAxisTopTitle: yAxisTopTitle ? yAxisTopTitle : '',
47
50
  tooltipLabelPostfix: tooltips.labelPostfix || ''
48
51
  };
49
52
  }, [options]);
@@ -99,6 +102,9 @@ const BarChart = _ref => {
99
102
  return color;
100
103
  }
101
104
  }
105
+ },
106
+ yAxisTopTitle: {
107
+ title: customOptions.yAxisTopTitle
102
108
  }
103
109
  },
104
110
  scales: {
@@ -132,6 +138,11 @@ const BarChart = _ref => {
132
138
  }
133
139
  }
134
140
  }
141
+ },
142
+ layout: {
143
+ padding: {
144
+ top: 32
145
+ }
135
146
  }
136
147
  };
137
148
  }, [customOptions, theme.fontOnPrimary]);
@@ -139,7 +150,7 @@ const BarChart = _ref => {
139
150
  height: height,
140
151
  data: data,
141
152
  options: defaultOptions,
142
- plugins: [_padEmptyChartBar.default]
153
+ plugins: [_padEmptyChartBar.default, _yAxisTopTitlePlugin.default]
143
154
  }, props));
144
155
  };
145
156
  var _default = exports.default = BarChart;
@@ -78,12 +78,13 @@ const LineChart = _ref => {
78
78
  },
79
79
  label(context) {
80
80
  var _context$dataset$tool;
81
+ const datasetLabel = context.dataset.label || '';
81
82
  const tooltipLabel = (_context$dataset$tool = context.dataset.tooltipLabels) === null || _context$dataset$tool === void 0 ? void 0 : _context$dataset$tool[context.dataIndex];
82
83
  if (tooltipLabel !== undefined) {
83
- return "".concat(context.dataset.label, ": ").concat(tooltipLabel);
84
+ return datasetLabel ? "".concat(datasetLabel, ": ").concat(tooltipLabel) : "".concat(tooltipLabel);
84
85
  }
85
86
  const content = context.dataset.data[context.dataIndex].toString();
86
- return "".concat(context.dataset.label, ": ").concat(customOptions.tooltipLabelPrefix).concat(content).concat(customOptions.tooltipLabelPostfix);
87
+ return datasetLabel ? "".concat(datasetLabel, ": ").concat(customOptions.tooltipLabelPrefix).concat(content).concat(customOptions.tooltipLabelPostfix) : "".concat(customOptions.tooltipLabelPrefix).concat(content).concat(customOptions.tooltipLabelPostfix);
87
88
  },
88
89
  labelColor(context) {
89
90
  const {
@@ -58,7 +58,8 @@ const ModalContent = _ref2 => {
58
58
  onConfirm,
59
59
  onCancel,
60
60
  allowDismiss = true,
61
- cancelButtonType = 'danger'
61
+ cancelButtonType = 'danger',
62
+ confirmButtonType = 'success'
62
63
  } = _ref2;
63
64
  const refWrapper = (0, _react.useRef)(null);
64
65
  const [id] = (0, _react.useState)((0, _lodash.default)('SD-'));
@@ -103,11 +104,14 @@ const ModalContent = _ref2 => {
103
104
  }), {}, {
104
105
  onClick: handleCancel,
105
106
  children: cancelButtonText || 'Cancel'
106
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
107
- success: true,
107
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread(_objectSpread({}, confirmButtonType === 'success' && {
108
+ success: true
109
+ }), confirmButtonType === 'warning' && {
110
+ warning: true
111
+ }), {}, {
108
112
  onClick: handleConfirm,
109
113
  children: confirmButtonText || 'Confirm'
110
- })]
114
+ }))]
111
115
  })]
112
116
  })
113
117
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.48.7",
3
+ "version": "0.48.9",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB UI components library",