@widergy/energy-ui 3.128.1 → 3.129.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,23 @@
1
+ # [3.129.0](https://github.com/widergy/energy-ui/compare/v3.128.2...v3.129.0) (2026-01-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [EVEP-310] barchart linear tooltip ([#741](https://github.com/widergy/energy-ui/issues/741)) ([3bc6fbc](https://github.com/widergy/energy-ui/commit/3bc6fbc9049fa515406aea6666c0faa21162f073))
7
+ * [EVEP-310] fix ([#745](https://github.com/widergy/energy-ui/issues/745)) ([f0f47b0](https://github.com/widergy/energy-ui/commit/f0f47b0aa9e7d21bb1b31a8a499b4265afe4a8f6))
8
+
9
+
10
+ ### Features
11
+
12
+ * [OUG] useCSSvariables ([#744](https://github.com/widergy/energy-ui/issues/744)) ([d7d678e](https://github.com/widergy/energy-ui/commit/d7d678e83c8afbe12785a2299bc88f2be8bf2c9b))
13
+
14
+ ## [3.128.2](https://github.com/widergy/energy-ui/compare/v3.128.1...v3.128.2) (2026-01-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * [AXCH-799] block tests in CI ([#734](https://github.com/widergy/energy-ui/issues/734)) ([1ef1d75](https://github.com/widergy/energy-ui/commit/1ef1d75213c36e899f97b6f85aaa39b2cb0157a5))
20
+
1
21
  ## [3.128.1](https://github.com/widergy/energy-ui/compare/v3.128.0...v3.128.1) (2026-01-07)
2
22
 
3
23
 
@@ -21,7 +21,8 @@ const LinearPlot = _ref => {
21
21
  type,
22
22
  color,
23
23
  customLineProps,
24
- markers
24
+ markers,
25
+ classes
25
26
  } = _ref;
26
27
  const lineGenerator = d3.line().x(_ref2 => {
27
28
  let {
@@ -40,11 +41,12 @@ const LinearPlot = _ref => {
40
41
  return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("path", _extends({
41
42
  d: lineGenerator(data),
42
43
  stroke: color
43
- }, props, customLineProps)), markers && (0, _utils.getMarkers)(data, xAxis, yAxis, barWidth, color, markers));
44
+ }, props, customLineProps)), markers && (0, _utils.getMarkers)(data, xAxis, yAxis, barWidth, color, markers, classes));
44
45
  };
45
46
  LinearPlot.propTypes = {
46
47
  data: _types.linearDataType,
47
48
  barWidth: _propTypes.number,
49
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
48
50
  yAxis: _propTypes.func,
49
51
  xAxis: _propTypes.func,
50
52
  type: _propTypes.string,
@@ -0,0 +1,3 @@
1
+ .tooltip {
2
+ text-align: center;
3
+ }
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getMarkers = exports.getLineConfiguration = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _UTTooltip = _interopRequireDefault(require("../../../UTTooltip"));
8
9
  var _constants = require("./constants");
10
+ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
9
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
10
13
  const DEFAULT_LINE_TYPE = 'solid';
11
14
  const getLineConfiguration = type => ({
12
15
  solid: {
@@ -25,10 +28,12 @@ const getLineConfiguration = type => ({
25
28
  custom: {}
26
29
  })[type || DEFAULT_LINE_TYPE];
27
30
  exports.getLineConfiguration = getLineConfiguration;
28
- const getMarkers = (data, xAxis, yAxis, barWidth, color, markersConfig) => data.map(_ref => {
31
+ const getMarkers = (data, xAxis, yAxis, barWidth, color, markersConfig, classes) => data.map(_ref => {
29
32
  let {
30
33
  xCoordinate,
31
- value
34
+ value,
35
+ tooltipContent,
36
+ tooltipProps
32
37
  } = _ref;
33
38
  const x = xAxis(xCoordinate) + barWidth / 2;
34
39
  const y = yAxis(value);
@@ -36,7 +41,12 @@ const getMarkers = (data, xAxis, yAxis, barWidth, color, markersConfig) => data.
36
41
  if (value === undefined || value === null) {
37
42
  return null;
38
43
  }
39
- return markersConfig.type === _constants.MARKER_TYPES.DOT && /*#__PURE__*/_react.default.createElement("svg", {
44
+ return markersConfig.type === _constants.MARKER_TYPES.DOT && /*#__PURE__*/_react.default.createElement(_UTTooltip.default, _extends({
45
+ className: classes.tooltip,
46
+ content: tooltipContent,
47
+ interactive: false,
48
+ stringContentClassName: _stylesModule.default.tooltip
49
+ }, tooltipProps), /*#__PURE__*/_react.default.createElement("svg", {
40
50
  x: x - size,
41
51
  y: y - size,
42
52
  height: 2 * size,
@@ -46,6 +56,6 @@ const getMarkers = (data, xAxis, yAxis, barWidth, color, markersConfig) => data.
46
56
  cy: size,
47
57
  r: size,
48
58
  fill: color
49
- }));
59
+ })));
50
60
  });
51
61
  exports.getMarkers = getMarkers;
@@ -228,7 +228,8 @@ const UTBarChart = _ref => {
228
228
  markers: markers,
229
229
  type: type,
230
230
  xAxis: xAxis,
231
- yAxis: linearYAxis
231
+ yAxis: linearYAxis,
232
+ classes: classes
232
233
  });
233
234
  }), /*#__PURE__*/_react.default.createElement(_Levels.default, {
234
235
  classes: classes,
package/dist/index.js CHANGED
@@ -513,6 +513,12 @@ Object.defineProperty(exports, "stylesDeduplicationUtils", {
513
513
  return _stylesDeduplicationUtils.default;
514
514
  }
515
515
  });
516
+ Object.defineProperty(exports, "useCSSVariables", {
517
+ enumerable: true,
518
+ get: function () {
519
+ return _useCSSVariables.default;
520
+ }
521
+ });
516
522
  Object.defineProperty(exports, "useScrollBasedMenu", {
517
523
  enumerable: true,
518
524
  get: function () {
@@ -604,5 +610,6 @@ var _WithLoading = _interopRequireDefault(require("./components/WithLoading"));
604
610
  var _WithTouch = _interopRequireDefault(require("./components/WithTouch"));
605
611
  var _stylesDeduplicationUtils = _interopRequireDefault(require("./utils/stylesDeduplicationUtils"));
606
612
  var _useScrollBasedMenu = _interopRequireDefault(require("./utils/hooks/use-scroll-based-menu"));
613
+ var _useCSSVariables = _interopRequireDefault(require("./utils/hooks/useCSSVariables"));
607
614
  var _UTCalendar = _interopRequireDefault(require("./components/UTCalendar"));
608
615
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.baseTokens = void 0;
7
+ const baseTokens = exports.baseTokens = {
8
+ base: {
9
+ 'size-full': '100%',
10
+ 'size-0': '0rem',
11
+ 'size-1': '0.125rem',
12
+ 'size-2': '0.25rem',
13
+ 'size-3': '0.5rem',
14
+ 'size-4': '0.75rem',
15
+ 'size-5': '1rem',
16
+ 'size-6': '1.25rem',
17
+ 'size-7': '1.5rem',
18
+ 'size-8': '2rem',
19
+ 'size-9': '2.5rem',
20
+ 'size-10': '3rem',
21
+ 'size-11': '3.5rem',
22
+ 'size-12': '4rem',
23
+ 'size-13': '6rem',
24
+ 'spacing-0': '0rem',
25
+ 'spacing-1': '0.125rem',
26
+ 'spacing-2': '0.25rem',
27
+ 'spacing-3': '0.5rem',
28
+ 'spacing-4': '0.75rem',
29
+ 'spacing-5': '1rem',
30
+ 'spacing-6': '1.25rem',
31
+ 'spacing-7': '1.5rem',
32
+ 'spacing-8': '2rem',
33
+ 'spacing-9': '2.5rem',
34
+ 'spacing-10': '3rem',
35
+ 'spacing-11': '3.5rem',
36
+ 'spacing-12': '4rem',
37
+ 'spacing-13': '6rem',
38
+ 'spacing-14': '8rem',
39
+ 'font-family': 'Inter',
40
+ 'font-size-100': '0.625rem',
41
+ 'font-size-200': '0.75rem',
42
+ 'font-size-300': '0.875rem',
43
+ 'font-size-400': '1rem',
44
+ 'font-size-500': '1.125rem',
45
+ 'font-size-600': '1.25rem',
46
+ 'font-size-700': '1.5rem',
47
+ 'font-size-800': '1.875rem',
48
+ 'font-size-900': '2.5rem',
49
+ 'font-size-1000': '3rem',
50
+ 'font-size-1100': '4rem',
51
+ 'font-weight-regular': '400',
52
+ 'font-weight-medium': '500',
53
+ 'font-weight-semibold': '600',
54
+ 'font-weight-bold': '700',
55
+ 'font-lh-100': '',
56
+ 'font-lh-110': '',
57
+ 'font-lh-120': '',
58
+ 'font-lh-140': '',
59
+ 'font-lh-150': '',
60
+ 'font-lh-170': ''
61
+ },
62
+ semantic: {
63
+ 'padding-2xs': 'spacing-2',
64
+ 'padding-xs': ' spacing-3',
65
+ 'padding-sm': 'spacing-4',
66
+ 'padding-md': 'spacing-5',
67
+ 'padding-lg': 'spacing-7',
68
+ 'padding-xl': 'spacing-8',
69
+ 'padding-2xl': 'spacing-9',
70
+ 'gap-2xs': 'spacing-1',
71
+ 'gap-xs': 'spacing-2',
72
+ 'gap-sm': 'spacing-3',
73
+ 'gap-md': 'spacing-4',
74
+ 'gap-lg': 'spacing-5',
75
+ 'gap-xl': 'spacing-7',
76
+ 'gap-2xl': 'spacing-8',
77
+ 'gap-3xl': 'spacing-9',
78
+ 'font-heading-size-1': 'font-size-800',
79
+ 'font-heading-size-2': 'font-size-700',
80
+ 'font-heading-size-3': 'font-size-600',
81
+ 'font-heading-size-4': 'font-size-500',
82
+ 'font-heading-size-5': 'font-size-400',
83
+ 'font-heading-size-6': 'font-size-500',
84
+ 'font-heading-weight-regular': 'font-weight-regular',
85
+ 'font-heading-weight-medium': 'font-weight-medium',
86
+ 'font-heading-lh': '',
87
+ 'font-body-size-sm': 'font-size-200',
88
+ 'font-body-size-md': 'font-size-300',
89
+ 'font-body-size-lg': 'font-size-400',
90
+ 'font-body-weight-regular': 'font-weight-regular',
91
+ 'font-body-weight-medium': 'font-weight-medium',
92
+ 'font-body-weight-semibold': 'font-weight-semibold',
93
+ 'font-body-weight-bold': 'font-weight-bold',
94
+ 'font-body-lh-sm': '',
95
+ 'font-body-lh-md': '',
96
+ 'font-body-lh-lg': '',
97
+ 'font-metric-size-sm': 'font-size-300',
98
+ 'font-metric-size-md': 'font-size-400',
99
+ 'font-metric-size-lg': 'font-size-500',
100
+ 'font-metric-weight-regular': 'font-weight-regular',
101
+ 'font-metric-weight-medium': 'font-weight-medium',
102
+ 'font-metric-lh': '',
103
+ 'font-action-size-sm': 'font-size-200',
104
+ 'font-action-size-md': 'font-size-300',
105
+ 'font-action-weight': 'font-weight-medium',
106
+ 'font-action-lh': '',
107
+ 'font-label-size-sm': 'font-size-200',
108
+ 'font-label-size-md': 'font-size-300',
109
+ 'font-label-weight': 'font-weight-regular',
110
+ 'font-label-lh': '',
111
+ 'size-control-2xs': 'size-5',
112
+ 'size-control-xs': 'size-7',
113
+ 'size-control-sm': 'size-8',
114
+ 'size-control-md': 'size-9',
115
+ 'size-control-lg': 'size-10',
116
+ 'size-control-xl': 'size-11',
117
+ 'size-control-2xl': 'size-12',
118
+ 'size-control-3xl': 'size-13'
119
+ },
120
+ component: {
121
+ 'UT-button-height-sm': 'size-control-sm',
122
+ 'UT-button-height-md': 'size-control-md',
123
+ 'UT-button-height-lg': 'size-control-lg'
124
+ }
125
+ };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _mergeWith = _interopRequireDefault(require("lodash/mergeWith"));
9
+ var _constants = require("./constants");
10
+ var _utils = require("./utils");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * Hook that injects CSS variables into the html element
14
+ * The variables will be available for all elements in the document
15
+ *
16
+ * @param {Object} cssVariables - Object with key-value pairs of CSS variables
17
+ * @param {string} tagId - ID for the style tag (default: 'wdrgy-css-variables')
18
+ * @param {string} prefix - Prefix for the variables (default: '')
19
+ * @param {Object} designTokens - Object with {base, semantic, component} tokens
20
+ *
21
+ * @example
22
+ * useCSSVariables({
23
+ * primaryColor: '#007bff',
24
+ * fontSize: '14px',
25
+ * spacing: '8px'
26
+ * });
27
+ * // Generates:
28
+ * // html {
29
+ * // --primaryColor: #007bff;
30
+ * // --fontSize: 14px;
31
+ * // --spacing: 8px;
32
+ * // }
33
+ */
34
+
35
+ const useCSSVariables = function (cssVariables) {
36
+ let tagId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'wdrgy-css-variables';
37
+ let prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
38
+ (0, _react.useEffect)(() => {
39
+ // Validate and build CSS variables safely
40
+ const formattedVariables = Object.entries((0, _utils.mapTokens)((0, _mergeWith.default)(_constants.baseTokens, cssVariables))).filter(cssVar => typeof cssVar[1] === 'string' || typeof cssVar[1] === 'number').map(_ref => {
41
+ let [key, value] = _ref;
42
+ const variableName = prefix ? "--".concat(prefix, "-").concat(key) : "--".concat(key);
43
+ return "".concat(variableName, ": ").concat(value, ";");
44
+ }).join('\n ');
45
+
46
+ // Remove previous style tag if it exists
47
+ const existingStyle = document.getElementById(tagId);
48
+ if (existingStyle) existingStyle.remove();
49
+
50
+ // Create the style tag content
51
+ const styleContent = "html {\n ".concat(formattedVariables, "\n}");
52
+
53
+ // Create and insert the style tag
54
+ const styleTag = document.createElement('style');
55
+ styleTag.id = tagId;
56
+ styleTag.textContent = styleContent;
57
+ document.head.appendChild(styleTag);
58
+
59
+ // Cleanup: remove the style tag on unmount
60
+ return () => {
61
+ const style = document.getElementById(tagId);
62
+ if (style) style.remove();
63
+ };
64
+ }, [cssVariables, prefix, tagId]);
65
+ };
66
+ var _default = exports.default = useCSSVariables;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mapTokens = void 0;
7
+ const mapTokens = tokens => {
8
+ const {
9
+ base = {},
10
+ semantic = {},
11
+ component = {},
12
+ ...other
13
+ } = tokens || {};
14
+ const allTokens = {
15
+ ...base,
16
+ ...other
17
+ };
18
+ Object.entries(semantic).concat(Object.entries(component)).forEach(_ref => {
19
+ let [key, value] = _ref;
20
+ allTokens[key] = allTokens[value];
21
+ });
22
+ return allTokens;
23
+ };
24
+ exports.mapTokens = mapTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.128.1",
3
+ "version": "3.129.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",