@widergy/energy-ui 3.60.2 → 3.61.1

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,17 @@
1
+ ## [3.61.1](https://github.com/widergy/energy-ui/compare/v3.61.0...v3.61.1) (2025-02-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [UGENSA-1411] y axis scale consumption history ([#582](https://github.com/widergy/energy-ui/issues/582)) ([b8af0e4](https://github.com/widergy/energy-ui/commit/b8af0e402e544285473d73a7f7f1d8ac502f5026))
7
+
8
+ # [3.61.0](https://github.com/widergy/energy-ui/compare/v3.60.2...v3.61.0) (2025-02-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * [AUT-423] ut credit card ids ([#580](https://github.com/widergy/energy-ui/issues/580)) ([aa06ca2](https://github.com/widergy/energy-ui/commit/aa06ca22ac4d3d102ec6f5d39f94efbc703d9380))
14
+
1
15
  ## [3.60.2](https://github.com/widergy/energy-ui/compare/v3.60.1...v3.60.2) (2025-02-18)
2
16
 
3
17
 
@@ -3,5 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UNIT_PADDING = void 0;
7
- const UNIT_PADDING = exports.UNIT_PADDING = 40;
6
+ exports.ZERO_FORMAT = exports.UNIT_PADDING = exports.DEFAULT_FORMAT = void 0;
7
+ const UNIT_PADDING = exports.UNIT_PADDING = 40;
8
+ const DEFAULT_FORMAT = exports.DEFAULT_FORMAT = '0,0';
9
+ const ZERO_FORMAT = exports.ZERO_FORMAT = '0,0.00';
@@ -18,20 +18,21 @@ const YAxis = _ref => {
18
18
  var _labelRef$current, _labelRef$current$get;
19
19
  let {
20
20
  classes,
21
+ graphXEnd,
21
22
  graphYEnd,
22
23
  graphYStart,
24
+ linearData,
23
25
  maxValue,
24
26
  setRef,
25
27
  textAnchor,
26
28
  unit,
29
+ unitSubtitle,
27
30
  valueDecorator = value => value,
28
31
  x,
29
32
  yAxis,
30
- yAxisTicks,
31
- graphXEnd,
32
- unitSubtitle,
33
- linearData
33
+ yAxisTicks
34
34
  } = _ref;
35
+ const yAxisTotal = yAxisTicks - 1;
35
36
  const labelRef = (0, _react.useRef)();
36
37
  const height = ((_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 || (_labelRef$current$get = _labelRef$current.getBoundingClientRect) === null || _labelRef$current$get === void 0 ? void 0 : _labelRef$current$get.call(_labelRef$current).height) || 0;
37
38
  const axis = (0, _react.useMemo)(() => new Array(yAxisTicks).fill(0).map((_, index) => index), [yAxisTicks]);
@@ -50,33 +51,33 @@ const YAxis = _ref => {
50
51
  x: x,
51
52
  y: unitSubtitleYPosition
52
53
  }, unitSubtitle), axis.map(index => {
53
- const value = Math.round((maxValue - index * maxValue / (yAxisTicks - 1)) * 100) / 100;
54
+ const value = maxValue * (1 - index / yAxisTotal);
54
55
  return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
55
56
  className: classes.yAxisLabel,
56
- setRef: (0, _utils.applyToIndex)(0, index, labelRef),
57
- yAxis: yAxis,
58
57
  graphYStart: graphYStart,
59
- x: x,
58
+ height: height,
59
+ label: valueDecorator((0, _numeral.default)(value > 10 ? Math.round(value) : Math.fround(value)).format(value < 1 && value > 0 ? _constants.ZERO_FORMAT : _constants.DEFAULT_FORMAT)),
60
+ setRef: (0, _utils.applyToIndex)(0, index, labelRef),
60
61
  value: value,
61
- label: valueDecorator((0, _numeral.default)(value).format(value < 1 && value > 0 ? '0,0.00' : '0,0')),
62
- height: height
62
+ x: x,
63
+ yAxis: yAxis
63
64
  });
64
65
  }));
65
66
  };
66
67
  YAxis.propTypes = {
67
68
  classes: _commonTypes.classesType,
69
+ graphXEnd: _propTypes.number,
68
70
  graphYEnd: _propTypes.number,
69
71
  graphYStart: _propTypes.number,
72
+ linearData: _propTypes.bool,
70
73
  maxValue: _propTypes.number,
71
74
  setRef: _commonTypes.refType,
72
75
  textAnchor: _propTypes.string,
73
76
  unit: _propTypes.string,
77
+ unitSubtitle: _propTypes.string,
74
78
  valueDecorator: _propTypes.func,
75
79
  x: _propTypes.number,
76
80
  yAxis: _propTypes.func,
77
- yAxisTicks: _propTypes.number,
78
- graphXEnd: _propTypes.number,
79
- unitSubtitle: _propTypes.string,
80
- linearData: _propTypes.bool
81
+ yAxisTicks: _propTypes.number
81
82
  };
82
83
  var _default = exports.default = YAxis;
@@ -44,6 +44,7 @@ const UTBarChart = _ref => {
44
44
  fitLegend,
45
45
  fullSizeBars,
46
46
  gradientGenerator,
47
+ gridType = 'grid',
47
48
  hideYAxis,
48
49
  highlightWidth,
49
50
  labelFormatters,
@@ -58,7 +59,6 @@ const UTBarChart = _ref => {
58
59
  selectable,
59
60
  showEmptyGraphic,
60
61
  showGrid,
61
- gridType = 'grid',
62
62
  singleYAxis,
63
63
  spacingOptions,
64
64
  title,
@@ -66,9 +66,13 @@ const UTBarChart = _ref => {
66
66
  units,
67
67
  valuesOnTop,
68
68
  xAxisDefinition,
69
+ yAxisProps = {},
69
70
  yAxisTicks
70
71
  } = _ref;
71
72
  const classes = (0, _classesUtils.mergeClasses)(theme, classNames);
73
+ const {
74
+ useMaxBarValue = false
75
+ } = yAxisProps || {};
72
76
  const [currentPage, setCurrentPage] = (0, _react.useState)(0);
73
77
  const [currentLabel, setCurrentLabel] = (0, _react.useState)();
74
78
  const {
@@ -127,7 +131,7 @@ const UTBarChart = _ref => {
127
131
  GRAPH_Y_START
128
132
  } = (0, _utils.getGraphAttributes)(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, pagination ? 0 : minBarWidth, formattedData[0].length, barPadding, groups, spacingOptions);
129
133
  const [linearLowerBound, linearUpperBound] = (0, _utils.getBounds)(maxLinearValue, yAxisTicks);
130
- const [barLowerBound, barUpperBound] = (0, _utils.getBounds)(maxBarValue, yAxisTicks);
134
+ const [barLowerBound, barUpperBound] = (0, _utils.getBounds)(maxBarValue, yAxisTicks, useMaxBarValue);
131
135
  const maxAbsoluteValue = Math.max(linearUpperBound, barUpperBound);
132
136
  const barMaxValue = singleYAxis ? maxAbsoluteValue : barUpperBound;
133
137
  const yAxis = d3.scaleLinear().domain([barLowerBound, barMaxValue]).range([GRAPH_Y_START, GRAPH_Y_END]);
@@ -337,6 +341,9 @@ UTBarChart.propTypes = {
337
341
  units: (0, _propTypes.objectOf)(_propTypes.string),
338
342
  valuesOnTop: _propTypes.bool,
339
343
  xAxisDefinition: _types.xAxisDefinitionType,
344
+ yAxisProps: (0, _propTypes.objectOf)((0, _propTypes.shape)({
345
+ useMaxBarValue: _propTypes.bool
346
+ })),
340
347
  yAxisTicks: _propTypes.number
341
348
  };
342
349
  UTBarChart.defaultProps = {
@@ -162,6 +162,9 @@ const getGrid = (ticks, maxValue, gridType) => new Array(ticks).fill(0).map((_,
162
162
  return !!value;
163
163
  });
164
164
  exports.getGrid = getGrid;
165
- const yAxisMaxValueRounder = (maxValue, yAxisTicks) => maxValue < _constants.LIMIT_MAX_VALUE_ROUNDER ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / _constants.TICKS_MULTIPLIER_DISTANCE) * _constants.TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
166
- const getBounds = (maxValue, yAxisTicks) => [_constants.LOWER_BOUND_DEFAULT, yAxisMaxValueRounder(maxValue, yAxisTicks)];
165
+ const yAxisMaxValueRounder = (maxValue, yAxisTicks, useMaxBarValue) => maxValue < _constants.LIMIT_MAX_VALUE_ROUNDER || useMaxBarValue ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / _constants.TICKS_MULTIPLIER_DISTANCE) * _constants.TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
166
+ const getBounds = function (maxValue, yAxisTicks) {
167
+ let useMaxBarValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
168
+ return [_constants.LOWER_BOUND_DEFAULT, yAxisMaxValueRounder(maxValue, yAxisTicks, useMaxBarValue)];
169
+ };
167
170
  exports.getBounds = getBounds;
@@ -9,12 +9,19 @@ var _reactCreditCards = _interopRequireDefault(require("react-credit-cards"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _UTPasswordField = _interopRequireDefault(require("../UTPasswordField"));
11
11
  var _UTTextInput = _interopRequireDefault(require("../UTTextInput"));
12
+ var _testIds = require("../../constants/testIds");
12
13
  require("react-credit-cards/es/styles-compiled.css");
13
14
  var _constants = require("./constants");
14
15
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ const {
20
+ nameFieldId,
21
+ expiresId,
22
+ cvcFieldId,
23
+ cardFieldId
24
+ } = _testIds.COMPONENT_IDS.creditCardIds;
18
25
  const UTCreditCard = _ref => {
19
26
  var _value$expYearField;
20
27
  let {
@@ -83,6 +90,7 @@ const UTCreditCard = _ref => {
83
90
  }), /*#__PURE__*/_react.default.createElement("div", {
84
91
  className: _stylesModule.default.fields
85
92
  }, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
93
+ dataTestId: cardFieldId,
86
94
  error: errors[cardField],
87
95
  onChange: onChangeField(cardField),
88
96
  onFocus: () => setFocused(_constants.fields.NUMBER),
@@ -96,6 +104,7 @@ const UTCreditCard = _ref => {
96
104
  classNames: {
97
105
  container: _stylesModule.default.inRow
98
106
  },
107
+ dataTestId: expiresId,
99
108
  error: errors[expires],
100
109
  onChange: onChangeField(expires),
101
110
  onFocus: () => setFocused(_constants.fields.EXPIRY),
@@ -107,6 +116,7 @@ const UTCreditCard = _ref => {
107
116
  classNames: {
108
117
  container: _stylesModule.default.inRow
109
118
  },
119
+ dataTestId: cvcFieldId,
110
120
  error: errors[cvcField],
111
121
  onChange: onChangeField(cvcField),
112
122
  onVisibilityToggle: setCvcVisibility,
@@ -116,6 +126,7 @@ const UTCreditCard = _ref => {
116
126
  value: values[cvcField],
117
127
  version: "V1"
118
128
  })), /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
129
+ dataTestId: nameFieldId,
119
130
  error: errors[nameFiled],
120
131
  onChange: onChangeField(nameFiled),
121
132
  required: true,
@@ -3,12 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TABLE_ROW = exports.TABLE = exports.STATUS_MESSAGE = exports.SELECTION_COMPONENT = exports.HEADER = exports.COMPONENT_IDS = exports.CELL = exports.ACTIONS = void 0;
6
+ exports.TABLE_ROW = exports.TABLE = exports.STATUS_MESSAGE = exports.SELECTION_COMPONENT = exports.HEADER = exports.CREDIT_CARD = exports.COMPONENT_IDS = exports.CELL = exports.ACTIONS = void 0;
7
7
  const BOTTOM_NAV = 'bottomNav';
8
8
  const DIALOG = 'dialog';
9
9
  const WORKFLOW_CONTAINER = 'workflowContainer';
10
10
  const ACTIONS = exports.ACTIONS = 'actions';
11
11
  const CELL = exports.CELL = 'cell';
12
+ const CREDIT_CARD = exports.CREDIT_CARD = 'creditCard';
12
13
  const HEADER = exports.HEADER = 'header';
13
14
  const SELECTION_COMPONENT = exports.SELECTION_COMPONENT = 'selectionComponent';
14
15
  const STATUS_MESSAGE = exports.STATUS_MESSAGE = 'statusMessage';
@@ -18,6 +19,12 @@ const COMPONENT_IDS = exports.COMPONENT_IDS = {
18
19
  breadcrumbsIds: {
19
20
  buttonId: 'breadcrumbs.item'
20
21
  },
22
+ creditCardIds: {
23
+ cardFieldId: "".concat(CREDIT_CARD, ".cardField"),
24
+ cvcFieldId: "".concat(CREDIT_CARD, ".cvcField"),
25
+ expiresId: "".concat(CREDIT_CARD, ".expires"),
26
+ nameFieldId: "".concat(CREDIT_CARD, ".nameField")
27
+ },
21
28
  dialogIds: {
22
29
  acceptButtontId: "".concat(DIALOG, ".acceptButton"),
23
30
  cancelButtonId: "".concat(DIALOG, ".cancelButton"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.60.2",
3
+ "version": "3.61.1",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",