@widergy/energy-ui 3.144.1 → 3.145.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,22 @@
1
+ # [3.145.0](https://github.com/widergy/energy-ui/compare/v3.144.2...v3.145.0) (2026-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * button group stories fixes ([#784](https://github.com/widergy/energy-ui/issues/784)) ([2db8673](https://github.com/widergy/energy-ui/commit/2db86737b00a8ab5854411cb1c74c4d9f17a155a))
7
+
8
+
9
+ ### Features
10
+
11
+ * buttongroup and button styles update ([#783](https://github.com/widergy/energy-ui/issues/783)) ([f778838](https://github.com/widergy/energy-ui/commit/f7788385508b7c9b591420f26232fe345dbf2654))
12
+
13
+ ## [3.144.2](https://github.com/widergy/energy-ui/compare/v3.144.1...v3.144.2) (2026-04-24)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * updated ia docs ([#782](https://github.com/widergy/energy-ui/issues/782)) ([879f4eb](https://github.com/widergy/energy-ui/commit/879f4eb884a12ac8026a9256469e07cd9af67ba9))
19
+
1
20
  ## [3.144.1](https://github.com/widergy/energy-ui/compare/v3.144.0...v3.144.1) (2026-04-22)
2
21
 
3
22
 
@@ -50,7 +50,7 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
50
50
  }
51
51
  },
52
52
  [_constants.VARIANTS_NAMES.outlined]: {
53
- border: "1px solid ".concat(colorTheme === _constants.COLORS_MAPPER.gray ? actionTheme['04'] : actionTheme['05']),
53
+ border: "1px solid ".concat(actionColorName === _constants.COLORS_MAPPER.secondary ? neutralTheme['05'] : lightTheme['04']),
54
54
  fill: colorTheme === _constants.COLORS_MAPPER.gray ? actionTheme['04'] : actionTheme['05'],
55
55
  '&:hover': {
56
56
  backgroundColor: colorTheme === _constants.COLORS_MAPPER.gray ? lightTheme['03'] : actionTheme['01'],
@@ -63,7 +63,7 @@ const variantsColorTheme = (theme, colorTheme, variant) => {
63
63
  },
64
64
  [_constants.VARIANTS_NAMES.text]: {
65
65
  border: '1px solid transparent',
66
- fill: actionTheme['05'],
66
+ fill: colorTheme === _constants.COLORS_MAPPER.gray ? actionTheme['04'] : actionTheme['05'],
67
67
  '&:hover': {
68
68
  backgroundColor: colorTheme === _constants.COLORS_MAPPER.gray ? lightTheme['03'] : actionTheme['01'],
69
69
  boxShadow: 'none'
@@ -1,13 +1,30 @@
1
1
  # UTButtonGroup
2
2
 
3
- A component that renders a group of buttons with consistent styling and behavior. The selected button is highlighted with a filled variant while others remain as text variants.
3
+ A component that renders a group of buttons with consistent styling and behavior. The selected button is highlighted with a `shadow` variant (for `primary` and `neutral` color themes) or `filled` variant (for `negative`), while inactive buttons use the `text` variant.
4
+
5
+ The container applies padding and border-radius via design tokens (`--UT-buttonGroup-padding`, `--UT-buttonGroup-radius`), making both values overridable per utility.
4
6
 
5
7
  ## Props
6
8
 
7
9
  | Name | Type | Default | Required | Description |
8
10
  | ---------- | :-------------- | --------- | -------- | ---------------------------------------------------------------------------------------------- |
9
11
  | actions | array | - | Yes | Array of action objects to render. Each action must include `Icon`, `id`, and `onClick` props. |
10
- | colorTheme | string | 'primary' | No | The color theme to use. One of: `primary`, `secondary`, `negative`, `neutral`. |
12
+ | colorTheme | string | 'primary' | No | The color theme to use. One of: `primary`, `neutral`, `negative`. |
11
13
  | selected | string / number | - | Yes | ID of the currently active/selected button. |
12
14
  | shape | string | 'square' | No | Shape of the button group. One of: `square`, `circle`. |
13
- | size | string | 'large' | No | Size of the buttons. One of: `small`, `medium`, `large`. |
15
+ | size | string | 'small' | No | Size of the buttons. One of: `small`, `medium`, `large`. |
16
+
17
+ ## Active variant by colorTheme
18
+
19
+ | colorTheme | Active variant |
20
+ | ---------- | -------------- |
21
+ | primary | shadow |
22
+ | neutral | shadow |
23
+ | negative | filled |
24
+
25
+ ## Design tokens
26
+
27
+ | Token | Default | Semantic token | Description |
28
+ | ------------------------ | -------- | --------------- | ---------------------------------------------- |
29
+ | `--UT-buttonGroup-padding` | `0.25rem` | `padding-2xs` | Padding del contenedor principal |
30
+ | `--UT-buttonGroup-radius` | `8px` | `radius-md` | Border-radius del contenedor (variante square) |
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SQUARE_TYPE = exports.DEFAULT_TYPE = exports.DEFAULT_SIZE = exports.DEFAULT_COLOR_THEME = exports.CIRCLE_TYPE = exports.BACKGROUND_COLOR_MAPPER = void 0;
6
+ exports.SQUARE_TYPE = exports.SHADOW_ACTIVE_COLOR_THEMES = exports.DEFAULT_TYPE = exports.DEFAULT_SIZE = exports.DEFAULT_COLOR_THEME = exports.CIRCLE_TYPE = exports.BACKGROUND_COLOR_MAPPER = void 0;
7
7
  const BACKGROUND_COLOR_MAPPER = theme => ({
8
8
  primary: theme.lightBackground,
9
9
  negative: theme.negativeBackground,
@@ -14,4 +14,5 @@ const CIRCLE_TYPE = exports.CIRCLE_TYPE = 'circle';
14
14
  const SQUARE_TYPE = exports.SQUARE_TYPE = 'square';
15
15
  const DEFAULT_TYPE = exports.DEFAULT_TYPE = SQUARE_TYPE;
16
16
  const DEFAULT_COLOR_THEME = exports.DEFAULT_COLOR_THEME = 'primary';
17
- const DEFAULT_SIZE = exports.DEFAULT_SIZE = 'large';
17
+ const DEFAULT_SIZE = exports.DEFAULT_SIZE = 'small';
18
+ const SHADOW_ACTIVE_COLOR_THEMES = exports.SHADOW_ACTIVE_COLOR_THEMES = ['primary', 'neutral'];
@@ -22,6 +22,8 @@ const UTButtonGroup = _ref => {
22
22
  size = _constants.DEFAULT_SIZE
23
23
  } = _ref;
24
24
  const backgroundColor = (0, _constants.BACKGROUND_COLOR_MAPPER)(theme)[colorTheme] || (0, _constants.BACKGROUND_COLOR_MAPPER)(theme).primary;
25
+ const activeVariant = _constants.SHADOW_ACTIVE_COLOR_THEMES.includes(colorTheme) ? 'shadow' : 'filled';
26
+ const inactiveColorTheme = _constants.SHADOW_ACTIVE_COLOR_THEMES.includes(colorTheme) ? 'gray' : colorTheme;
25
27
  return /*#__PURE__*/_react.default.createElement("div", {
26
28
  className: "".concat(_stylesModule.default["".concat(type, "Container")], " ").concat(backgroundColor)
27
29
  }, actions.map(_ref2 => {
@@ -33,13 +35,13 @@ const UTButtonGroup = _ref => {
33
35
  label
34
36
  } = _ref2;
35
37
  return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
36
- colorTheme: colorTheme,
38
+ colorTheme: selected === id ? colorTheme : inactiveColorTheme,
37
39
  dataTestId: dataTestId,
38
40
  Icon: Icon,
39
41
  key: id,
40
42
  onClick: onClick,
41
43
  size: size,
42
- variant: selected === id ? 'filled' : 'text'
44
+ variant: selected === id ? activeVariant : 'text'
43
45
  }, label);
44
46
  }));
45
47
  };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Primary = exports.Playground = exports.Neutral = exports.Negative = exports.Circle = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _ = _interopRequireDefault(require(".."));
9
+ var _storiesConstants = require("./storiesConstants");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ 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); }
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); }
13
+ const InteractiveButtonGroup = args => {
14
+ const [selected, setSelected] = (0, _react.useState)(args.selected);
15
+ const actions = args.actions.map(action => ({
16
+ ...action,
17
+ onClick: () => setSelected(action.id)
18
+ }));
19
+ return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
20
+ actions: actions,
21
+ selected: selected
22
+ }));
23
+ };
24
+ var _default = exports.default = {
25
+ title: 'Energy-UI/UTButtonGroup',
26
+ component: _.default,
27
+ args: {
28
+ actions: _storiesConstants.COMMON_ACTIONS,
29
+ ..._storiesConstants.COMMON_ARGS
30
+ },
31
+ argTypes: {
32
+ ..._storiesConstants.COMMON_ARG_TYPES
33
+ },
34
+ parameters: {
35
+ docs: {
36
+ description: {
37
+ component: 'Grupo de botones con selección activa. El botón activo usa variante `shadow` (primary/neutral) o `filled` (negative). El contenedor aplica padding y border-radius via design tokens.'
38
+ }
39
+ }
40
+ }
41
+ };
42
+ const Playground = exports.Playground = {
43
+ name: 'Playground',
44
+ render: InteractiveButtonGroup
45
+ };
46
+ const Primary = exports.Primary = {
47
+ args: {
48
+ colorTheme: 'primary',
49
+ selected: _storiesConstants.COMMON_ACTIONS[0].id
50
+ },
51
+ render: InteractiveButtonGroup
52
+ };
53
+ const Neutral = exports.Neutral = {
54
+ args: {
55
+ colorTheme: 'neutral',
56
+ selected: _storiesConstants.COMMON_ACTIONS[0].id
57
+ },
58
+ render: InteractiveButtonGroup
59
+ };
60
+ const Negative = exports.Negative = {
61
+ args: {
62
+ colorTheme: 'negative',
63
+ selected: _storiesConstants.COMMON_ACTIONS[0].id
64
+ },
65
+ parameters: {
66
+ backgrounds: {
67
+ default: 'Oscuro'
68
+ }
69
+ },
70
+ render: InteractiveButtonGroup
71
+ };
72
+ const Circle = exports.Circle = {
73
+ args: {
74
+ shape: 'circle',
75
+ selected: _storiesConstants.COMMON_ACTIONS[0].id
76
+ },
77
+ render: InteractiveButtonGroup
78
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SIZE_OPTIONS = exports.SHAPE_OPTIONS = exports.COMMON_ARG_TYPES = exports.COMMON_ARGS = exports.COMMON_ACTIONS = exports.COLOR_THEME_OPTIONS = void 0;
7
+ var _constants = require("../constants");
8
+ const COMMON_ACTIONS = exports.COMMON_ACTIONS = [{
9
+ Icon: 'IconPencil',
10
+ id: 'edit',
11
+ label: 'Editar'
12
+ }, {
13
+ Icon: 'IconTrash',
14
+ id: 'delete',
15
+ label: 'Eliminar'
16
+ }, {
17
+ Icon: 'IconEye',
18
+ id: 'view',
19
+ label: 'Ver'
20
+ }];
21
+ const COLOR_THEME_OPTIONS = exports.COLOR_THEME_OPTIONS = ['primary', 'neutral', 'negative'];
22
+ const SHAPE_OPTIONS = exports.SHAPE_OPTIONS = [_constants.SQUARE_TYPE, _constants.CIRCLE_TYPE];
23
+ const SIZE_OPTIONS = exports.SIZE_OPTIONS = ['small', 'medium', 'large'];
24
+ const COMMON_ARG_TYPES = exports.COMMON_ARG_TYPES = {
25
+ actions: {
26
+ control: 'object',
27
+ description: 'Array de acciones. Cada item acepta: id (string), label (string), Icon (nombre de icono Tabler).'
28
+ },
29
+ colorTheme: {
30
+ control: 'select',
31
+ options: COLOR_THEME_OPTIONS
32
+ },
33
+ selected: {
34
+ control: 'text',
35
+ description: 'ID del botón activo. Debe coincidir con el id de uno de los actions.'
36
+ },
37
+ shape: {
38
+ control: 'inline-radio',
39
+ options: SHAPE_OPTIONS
40
+ },
41
+ size: {
42
+ control: 'inline-radio',
43
+ options: SIZE_OPTIONS
44
+ }
45
+ };
46
+ const COMMON_ARGS = exports.COMMON_ARGS = {
47
+ colorTheme: _constants.DEFAULT_COLOR_THEME,
48
+ selected: COMMON_ACTIONS[0].id,
49
+ shape: _constants.DEFAULT_TYPE,
50
+ size: _constants.DEFAULT_SIZE
51
+ };
@@ -1,28 +1,17 @@
1
- $default-border-radius: 8px;
2
- $square-border-radius: calc(#{$default-border-radius} - 1px);
3
1
  $rounded-border-radius: 100px;
4
2
 
5
3
  %container {
6
4
  display: flex;
5
+ padding: var(--UT-buttonGroup-padding, 0.25rem);
7
6
  width: fit-content;
8
7
  }
9
8
 
10
9
  .squareContainer {
11
10
  @extend %container;
12
- border-radius: $default-border-radius;
11
+ border-radius: var(--UT-buttonGroup-radius, 8px);
13
12
 
14
13
  & > button {
15
- border-radius: 0 !important;
16
- }
17
-
18
- & > button:first-child {
19
- border-bottom-left-radius: $square-border-radius !important;
20
- border-top-left-radius: $square-border-radius !important;
21
- }
22
-
23
- & > button:last-child {
24
- border-bottom-right-radius: $square-border-radius !important;
25
- border-top-right-radius: $square-border-radius !important;
14
+ border: none !important;
26
15
  }
27
16
  }
28
17
 
@@ -31,6 +20,7 @@ $rounded-border-radius: 100px;
31
20
  border-radius: $rounded-border-radius;
32
21
 
33
22
  & > button {
23
+ border: none !important;
34
24
  border-radius: $rounded-border-radius !important;
35
25
  }
36
26
  }
@@ -176,6 +176,8 @@ const baseTokens = exports.baseTokens = {
176
176
  'UT-button-radius': 'radius-sm',
177
177
  'UT-button-icon-size-sm': 'size-icon-xs',
178
178
  'UT-button-icon-size-md': 'size-icon-md',
179
+ 'UT-buttonGroup-padding': 'padding-2xs',
180
+ 'UT-buttonGroup-radius': 'radius-md',
179
181
  'UT-label-size-title-1': 'font-heading-size-1',
180
182
  'UT-label-size-title-2': 'font-heading-size-2',
181
183
  'UT-label-size-title-3': 'font-heading-size-3',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.144.1",
3
+ "version": "3.145.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",