@widergy/energy-ui 1.126.0 → 1.127.0

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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.127.0](https://github.com/widergy/energy-ui/compare/v1.126.0...v1.127.0) (2022-06-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * customIcon ([#299](https://github.com/widergy/energy-ui/issues/299)) ([bcc1659](https://github.com/widergy/energy-ui/commit/bcc1659663e57414179b3ebd3eb971cdba4726f4))
7
+
1
8
  # [1.126.0](https://github.com/widergy/energy-ui/compare/v1.125.2...v1.126.0) (2022-06-22)
2
9
 
3
10
 
@@ -120,12 +120,13 @@ var Legend = function Legend(_ref) {
120
120
 
121
121
  var referenceRenderer = function referenceRenderer(reference) {
122
122
  var label = reference.label,
123
- className = reference.className;
123
+ className = reference.className,
124
+ CustomIcon = reference.CustomIcon;
124
125
  return /*#__PURE__*/_react.default.createElement("div", {
125
126
  className: _stylesModule.default["item".concat(displayAs)]
126
127
  }, /*#__PURE__*/_react.default.createElement("div", {
127
128
  className: className
128
- }), /*#__PURE__*/_react.default.createElement(_.UTLabel, {
129
+ }, CustomIcon && /*#__PURE__*/_react.default.createElement(CustomIcon, null)), /*#__PURE__*/_react.default.createElement(_.UTLabel, {
129
130
  className: "".concat(_stylesModule.default.itemLabel, " ").concat(classes.legendItemLabel)
130
131
  }, label));
131
132
  };
@@ -8,19 +8,19 @@ exports.xAxisDefinitionType = exports.referencesType = exports.linearType = expo
8
8
  var _propTypes = require("prop-types");
9
9
 
10
10
  var barType = (0, _propTypes.shape)({
11
- value: _propTypes.number,
12
- tooltipContent: _propTypes.string,
13
- color: _propTypes.string,
14
11
  clickable: _propTypes.bool,
15
- highlighted: _propTypes.string,
12
+ color: _propTypes.string,
16
13
  highlightColor: _propTypes.string,
14
+ highlighted: _propTypes.string,
15
+ tooltipContent: _propTypes.string,
16
+ value: _propTypes.number,
17
17
  values: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
18
- value: _propTypes.number,
19
- tooltipContent: _propTypes.string,
20
- color: _propTypes.string,
21
18
  clickable: _propTypes.bool,
19
+ color: _propTypes.string,
20
+ highlightColor: _propTypes.string,
22
21
  highlighted: _propTypes.string,
23
- highlightColor: _propTypes.string
22
+ tooltipContent: _propTypes.string,
23
+ value: _propTypes.number
24
24
  }))
25
25
  });
26
26
  exports.barType = barType;
@@ -31,13 +31,13 @@ var linearMarkersType = (0, _propTypes.shape)({
31
31
  });
32
32
  exports.linearMarkersType = linearMarkersType;
33
33
  var linearType = (0, _propTypes.shape)({
34
+ color: _propTypes.string,
34
35
  data: (0, _propTypes.arrayOf)({
35
36
  xCoodrinate: _propTypes.number,
36
37
  value: _propTypes.number
37
38
  }),
38
- type: _propTypes.string,
39
- color: _propTypes.string,
40
- marker: linearMarkersType
39
+ marker: linearMarkersType,
40
+ type: _propTypes.string
41
41
  });
42
42
  exports.linearType = linearType;
43
43
  var linearDataType = (0, _propTypes.arrayOf)(linearType);
@@ -49,17 +49,18 @@ var levelsType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
49
49
  }));
50
50
  exports.levelsType = levelsType;
51
51
  var referencesType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
52
- id: _propTypes.string,
53
- className: _propTypes.string,
54
52
  check: _propTypes.func,
53
+ className: _propTypes.string,
54
+ CustomIcon: _propTypes.elementType,
55
+ id: _propTypes.string,
55
56
  label: _propTypes.string,
56
57
  orderFunction: _propTypes.func
57
58
  }));
58
59
  exports.referencesType = referencesType;
59
60
  var xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
61
+ labelBackgroundPadding: _propTypes.number,
60
62
  mainLabel: _propTypes.string,
61
63
  secondaryLabel: _propTypes.string,
62
- selectedLabelBackground: _propTypes.string,
63
- labelBackgroundPadding: _propTypes.number
64
+ selectedLabelBackground: _propTypes.string
64
65
  }));
65
66
  exports.xAxisDefinitionType = xAxisDefinitionType;
@@ -52,25 +52,26 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
52
52
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
53
53
 
54
54
  var UTPieChart = function UTPieChart(_ref) {
55
- var className = _ref.className,
55
+ var animationLength = _ref.animationLength,
56
+ classes = _ref.classes,
57
+ className = _ref.className,
56
58
  _ref$classNames = _ref.classNames,
57
59
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
58
- classes = _ref.classes,
59
60
  data = _ref.data,
60
- width = _ref.width,
61
+ gradientGenerator = _ref.gradientGenerator,
61
62
  height = _ref.height,
63
+ initialAngle = _ref.initialAngle,
62
64
  innerRadius = _ref.innerRadius,
63
- outerRadius = _ref.outerRadius,
64
- animationLength = _ref.animationLength,
65
65
  legend = _ref.legend,
66
- transition = _ref.transition,
67
- withLegend = _ref.withLegend,
68
- withLabels = _ref.withLabels,
66
+ minAngle = _ref.minAngle,
67
+ outerRadius = _ref.outerRadius,
69
68
  outlined = _ref.outlined,
70
69
  paddingAngle = _ref.paddingAngle,
71
70
  showPercentageInLegend = _ref.showPercentageInLegend,
72
- initialAngle = _ref.initialAngle,
73
- minAngle = _ref.minAngle;
71
+ transition = _ref.transition,
72
+ width = _ref.width,
73
+ withLabels = _ref.withLabels,
74
+ withLegend = _ref.withLegend;
74
75
  var totalSum = data.reduce(function (acc, _ref2) {
75
76
  var value = _ref2.value;
76
77
  return acc + value;
@@ -117,9 +118,9 @@ var UTPieChart = function UTPieChart(_ref) {
117
118
  className: "".concat(_stylesModule.default["".concat(position.split('-')[0], "LegendWrapper")], " ").concat(_stylesModule.default[position])
118
119
  }, withLegend && /*#__PURE__*/_react.default.createElement(_Legend.default, {
119
120
  classes: classes,
120
- showPercentage: showPercentageInLegend,
121
121
  data: data,
122
122
  legend: legend,
123
+ showPercentage: showPercentageInLegend,
123
124
  totalConsumption: totalSum
124
125
  })), /*#__PURE__*/_react.default.createElement("div", {
125
126
  className: "".concat(_stylesModule.default["".concat(position.split('-')[0], "PieWrapper")], " ").concat(classNames.chartContainer),
@@ -128,7 +129,7 @@ var UTPieChart = function UTPieChart(_ref) {
128
129
  viewBox: "".concat(-containerWidth / 2, " ").concat(-containerHeight / 2, " ").concat(containerWidth, " ").concat(containerHeight),
129
130
  width: containerWidth,
130
131
  height: containerHeight
131
- }, pie.map(function (slice) {
132
+ }, gradientGenerator === null || gradientGenerator === void 0 ? void 0 : gradientGenerator(), pie.map(function (slice) {
132
133
  return /*#__PURE__*/_react.default.createElement("path", {
133
134
  d: arcGenerator(slice),
134
135
  fill: slice.data.color
@@ -147,55 +148,56 @@ var UTPieChart = function UTPieChart(_ref) {
147
148
  value = _slice$data.value,
148
149
  id = _slice$data.id;
149
150
  return !id && (label || value) && /*#__PURE__*/_react.default.createElement(_ArrowLabel.default, {
150
- label: label,
151
151
  color: color,
152
- value: value / totalSum,
152
+ label: label,
153
153
  midAngle: (endAngle - startAngle) / 2 + startAngle,
154
- outerRadius: outerRadius + (outlined ? _constants.OUTLINE_SEPARATION + _constants.OUTLINE_WIDTH : 0)
154
+ outerRadius: outerRadius + (outlined ? _constants.OUTLINE_SEPARATION + _constants.OUTLINE_WIDTH : 0),
155
+ value: value / totalSum
155
156
  });
156
157
  })))));
157
158
  };
158
159
 
159
160
  UTPieChart.propTypes = {
161
+ animationLength: _propTypes.number,
162
+ classes: _commonTypes.classesType,
163
+ className: _propTypes.string,
164
+ classNames: (0, _propTypes.shape)({
165
+ chartContainer: _propTypes.string
166
+ }),
160
167
  data: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
161
168
  color: _propTypes.string,
162
169
  label: _propTypes.string,
163
170
  value: _propTypes.number
164
171
  })),
165
- width: _propTypes.number,
172
+ gradientGenerator: _propTypes.func,
166
173
  height: _propTypes.number,
174
+ initialAngle: _propTypes.number,
167
175
  innerRadius: _propTypes.number,
168
- outerRadius: _propTypes.number,
169
- animationLength: _propTypes.number,
170
176
  legend: (0, _propTypes.shape)({
171
177
  position: _propTypes.string,
172
178
  type: _propTypes.string
173
179
  }),
174
- transition: _propTypes.string,
175
- withLegend: _propTypes.bool,
180
+ minAngle: _propTypes.number,
181
+ outerRadius: _propTypes.number,
176
182
  outlined: _propTypes.bool,
177
- withLabels: _propTypes.bool,
178
183
  paddingAngle: _propTypes.number,
179
- className: _propTypes.string,
180
- classNames: (0, _propTypes.shape)({
181
- chartContainer: _propTypes.string
182
- }),
183
184
  showPercentageInLegend: _propTypes.bool,
184
- classes: _commonTypes.classesType,
185
- initialAngle: _propTypes.number,
186
- minAngle: _propTypes.number
185
+ transition: _propTypes.string,
186
+ width: _propTypes.number,
187
+ withLabels: _propTypes.bool,
188
+ withLegend: _propTypes.bool
187
189
  };
188
190
  UTPieChart.defaultProps = {
191
+ animationLength: _constants.DEFAULT_ANIMATION_LENGTH,
192
+ classes: {},
189
193
  data: _constants.DEFAULT_DATA,
194
+ initialAngle: _constants.DEFAULT_INITIAL_ANGLE,
190
195
  innerRadius: _constants.DEFAULT_INNER_RADIUS,
191
- outerRadius: _constants.DEFAULT_OUTER_RADIUS,
192
- animationLength: _constants.DEFAULT_ANIMATION_LENGTH,
193
196
  legend: _constants.DEFAULT_LEGEND,
194
- transition: _constants.DEFAULT_TRANSITION,
195
- paddingAngle: _constants.DEFAULT_PADDING_ANGLE,
196
- initialAngle: _constants.DEFAULT_INITIAL_ANGLE,
197
197
  minAngle: _constants.DEFAULT_MIN_ANGLE,
198
- classes: {}
198
+ outerRadius: _constants.DEFAULT_OUTER_RADIUS,
199
+ paddingAngle: _constants.DEFAULT_PADDING_ANGLE,
200
+ transition: _constants.DEFAULT_TRANSITION
199
201
  };
200
202
 
201
203
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTPieChart);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "1.126.0",
3
+ "version": "1.127.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",