@widergy/energy-ui 3.139.1 → 3.141.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,17 @@
1
+ # [3.141.0](https://github.com/widergy/energy-ui/compare/v3.140.0...v3.141.0) (2026-03-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * [AXCH-1339] abbreviations in avatar component ([#769](https://github.com/widergy/energy-ui/issues/769)) ([1604f31](https://github.com/widergy/energy-ui/commit/1604f313981bcdbf64ea23fac687943e30dbefc5))
7
+
8
+ # [3.140.0](https://github.com/widergy/energy-ui/compare/v3.139.1...v3.140.0) (2026-03-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * add index to test id ([#768](https://github.com/widergy/energy-ui/issues/768)) ([7331fa1](https://github.com/widergy/energy-ui/commit/7331fa1bfeb8d6f1523253d930b6eea69f9f0ca6))
14
+
1
15
  ## [3.139.1](https://github.com/widergy/energy-ui/compare/v3.139.0...v3.139.1) (2026-02-27)
2
16
 
3
17
 
@@ -17,6 +17,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
17
17
  const UTAvatar = _ref => {
18
18
  var _iconProps$name;
19
19
  let {
20
+ abbreviation,
20
21
  areaShape = _constants.SHAPE.CIRCLE,
21
22
  className,
22
23
  iconProps,
@@ -32,12 +33,12 @@ const UTAvatar = _ref => {
32
33
  getFirstLetter,
33
34
  getAvatarColors
34
35
  } = _componentUtils.default;
35
- const firstNameLetter = getFirstLetter(userName);
36
36
  const {
37
37
  colorTheme,
38
38
  ...styles
39
- } = getAvatarColors(type === _constants.TYPE.LETTER ? userName : (_iconProps$name = iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) !== null && _iconProps$name !== void 0 ? _iconProps$name : _constants.DEFAULT_ICON, palette || _constants.defaultPalette);
39
+ } = getAvatarColors(type === _constants.TYPE.LETTER ? userName || abbreviation : (_iconProps$name = iconProps === null || iconProps === void 0 ? void 0 : iconProps.name) !== null && _iconProps$name !== void 0 ? _iconProps$name : _constants.DEFAULT_ICON, palette || _constants.defaultPalette);
40
40
  const sizeVariant = _constants.SIZE_VARIANTS[size][type];
41
+ const textToShow = abbreviation || getFirstLetter(userName);
41
42
  return /*#__PURE__*/_react.default.createElement(_Avatar.default, {
42
43
  className: "".concat(className !== null && className !== void 0 ? className : '', " ").concat(size ? _stylesModule.default[size] : ''),
43
44
  style: manualColors ? {} : styles,
@@ -47,13 +48,14 @@ const UTAvatar = _ref => {
47
48
  colorTheme: colorTheme,
48
49
  variant: sizeVariant,
49
50
  weight: "medium"
50
- }, labelProps), firstNameLetter) : /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
51
+ }, labelProps), textToShow) : /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
51
52
  colorTheme: colorTheme,
52
53
  name: _constants.DEFAULT_ICON,
53
54
  size: sizeVariant
54
55
  }, iconProps)));
55
56
  };
56
57
  UTAvatar.propTypes = {
58
+ abbreviation: _propTypes.string,
57
59
  className: _propTypes.string,
58
60
  iconProps: (0, _propTypes.shape)({
59
61
  className: _propTypes.string,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.LetterVsIcon = exports.Letter = exports.Icon = void 0;
6
+ exports.default = exports.WithAbbreviation = exports.LetterVsIcon = exports.Letter = exports.Icon = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _index = _interopRequireDefault(require("../index"));
9
9
  var _constants = require("../constants");
@@ -28,6 +28,14 @@ const Letter = exports.Letter = {
28
28
  type: _constants.TYPE.LETTER
29
29
  }
30
30
  };
31
+ const WithAbbreviation = exports.WithAbbreviation = {
32
+ args: {
33
+ userName: 'John Doe',
34
+ abbreviation: 'JD',
35
+ type: _constants.TYPE.LETTER
36
+ },
37
+ name: 'With Abbreviation'
38
+ };
31
39
  const Icon = exports.Icon = {
32
40
  args: {
33
41
  userName: 'Icon Avatar',
@@ -7,6 +7,18 @@ exports.COMMON_PARAMETERS = exports.COMMON_ARG_TYPES = exports.COMMON_ARGS = voi
7
7
  var _constants = require("../constants");
8
8
  // Common argTypes used across multiple stories files
9
9
  const COMMON_ARG_TYPES = exports.COMMON_ARG_TYPES = {
10
+ abbreviation: {
11
+ control: 'text',
12
+ description: 'The abbreviation to display instead of the initial letter',
13
+ table: {
14
+ defaultValue: {
15
+ summary: 'undefined'
16
+ },
17
+ type: {
18
+ summary: 'string'
19
+ }
20
+ }
21
+ },
10
22
  userName: {
11
23
  control: 'text',
12
24
  description: 'The name of the user to display (first letter will be shown)',
@@ -65,7 +65,7 @@ class UTRadioGroup extends _react.PureComponent {
65
65
  checked: "".concat(classes.checked, " ").concat(classes.checkedIconRoot)
66
66
  },
67
67
  inputProps: {
68
- 'data-testid': dataTestId ? "".concat(dataTestId, ".input") : null
68
+ 'data-testid': dataTestId ? "".concat(dataTestId, ".input.").concat(index) : null
69
69
  }
70
70
  }),
71
71
  className: "".concat(classes.formControlLabel, " \n ").concat(this.props.divider && index === 0 && classes.topDivider, " \n ").concat(this.props.divider && classes.divider, "\n ").concat(className)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.139.1",
3
+ "version": "3.141.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",