@widergy/energy-ui 3.70.0 → 3.71.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
+ # [3.71.0](https://github.com/widergy/energy-ui/compare/v3.70.0...v3.71.0) (2025-05-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * add hide amount ([#605](https://github.com/widergy/energy-ui/issues/605)) ([cd7a226](https://github.com/widergy/energy-ui/commit/cd7a22622e0f7b5c924f9190b2f500fb5e567747))
7
+
1
8
  # [3.70.0](https://github.com/widergy/energy-ui/compare/v3.69.7...v3.70.0) (2025-05-05)
2
9
 
3
10
 
@@ -0,0 +1,28 @@
1
+ # UTConsumptionBar
2
+
3
+ ## Description
4
+
5
+ `UTConsumptionBar` is a dynamic and customizable component designed to visually represent different consumption levels within a continuous bar. It allows users to easily identify their current consumption relative to predefined thresholds, including subsidy limits or critical consumption points.
6
+ This component is ideal for displaying energy usage, resource consumption, or similar progressive metrics in a clear and user-friendly way.
7
+
8
+ ## Props
9
+
10
+ | Name | Type | Default | Description |
11
+ | ------------- | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
12
+ | categoryLines | object | | Defines the segments or categories shown in the bar, including their labels. |
13
+ | classes | object | | Custom class names to apply to different elements of the `UTConsumptionBar`. |
14
+ | hideAmount | bool | | If `true`, hides the numeric total value (e.g., cost of consumption) displayed on the bar, while keeping the current consumption value and visual indicators visible. |
15
+ | values | arrayOf(shape) | false | Array of indicators or key values to be displayed on the bar. |
16
+ | |
17
+
18
+ ### Values Object
19
+
20
+ The `values` prop is an array of objects, each representing an indicator:
21
+
22
+ | Name | Type | Description |
23
+ | -------- | ------ | ------------------------------------------------------------ |
24
+ | position | string | Position or reference point of the indicator within the bar. |
25
+ | subtitle | string | A subtitle providing additional context for the indicator. |
26
+ | title | string | The main title describing the indicator. |
27
+ | total | number | The total value associated with this indicator. |
28
+ | value | number | The current value for this indicator. |
@@ -16,7 +16,8 @@ const ConsumptionBarIndicator = _ref => {
16
16
  value,
17
17
  unit = 'kWh',
18
18
  total,
19
- classes
19
+ classes,
20
+ hideAmount
20
21
  } = _ref;
21
22
  return /*#__PURE__*/_react.default.createElement("div", {
22
23
  className: _stylesModule.default.indicator,
@@ -31,7 +32,7 @@ const ConsumptionBarIndicator = _ref => {
31
32
  className: _stylesModule.default.alignCenter,
32
33
  colorTheme: "information",
33
34
  weight: "bold"
34
- }, "".concat(Math.round(value), " ").concat(unit)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
35
+ }, "".concat(Math.round(value), " ").concat(unit)), !hideAmount && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
35
36
  className: _stylesModule.default.lightGray,
36
37
  colorTheme: "gray",
37
38
  weight: "bold"
@@ -39,9 +40,10 @@ const ConsumptionBarIndicator = _ref => {
39
40
  };
40
41
  ConsumptionBarIndicator.propTypes = {
41
42
  classes: _propTypes.object,
43
+ hideAmount: _propTypes.bool,
42
44
  left: _propTypes.number,
43
- value: _propTypes.number,
45
+ total: _propTypes.number,
44
46
  unit: _propTypes.string,
45
- total: _propTypes.number
47
+ value: _propTypes.number
46
48
  };
47
49
  var _default = exports.default = ConsumptionBarIndicator;
@@ -16,10 +16,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
17
  const UTConsumptionBar = _ref => {
18
18
  let {
19
- small,
20
- values,
21
19
  categoryLines,
22
- classes
20
+ classes,
21
+ hideAmount = false,
22
+ values
23
23
  } = _ref;
24
24
  const widthRef = (0, _react.useRef)();
25
25
  const [showLabel, setShowLabel] = (0, _react.useState)(true);
@@ -92,9 +92,9 @@ const UTConsumptionBar = _ref => {
92
92
  })), categoryLines.rates.map(renderCategoryLines), downIndicators.map(indicator => /*#__PURE__*/_react.default.createElement(_ConsumptionBarIndicator.default, {
93
93
  classes: classes,
94
94
  className: _stylesModule.default.indicator,
95
+ hideAmount: hideAmount,
95
96
  key: indicator.title,
96
97
  left: getIndicatorPosition(indicator.value),
97
- small: small,
98
98
  total: indicator.total,
99
99
  unit: indicator.title,
100
100
  value: indicator.value
@@ -105,7 +105,7 @@ const UTConsumptionBar = _ref => {
105
105
  UTConsumptionBar.propTypes = {
106
106
  categoryLines: _propTypes.object,
107
107
  classes: _propTypes.object,
108
- small: _propTypes.bool,
108
+ hideAmount: _propTypes.bool,
109
109
  values: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
110
110
  position: _propTypes.string,
111
111
  subtitle: _propTypes.string,
@@ -77,7 +77,7 @@
77
77
  background-color: $gray-3;
78
78
  height: 23px;
79
79
  min-width: 26px;
80
- width: 26px;
80
+ width: 15%;
81
81
  }
82
82
 
83
83
  .colorizedLine {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.70.0",
3
+ "version": "3.71.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",