@widergy/energy-ui 3.170.0 → 3.171.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 +13 -0
- package/dist/components/UTPanel/UTPanel.stories.js +49 -1
- package/dist/components/UTPanel/versions/V1/README.md +14 -0
- package/dist/components/UTPanel/versions/V1/components/AdditionalContentModule/index.js +2 -0
- package/dist/components/UTRadioGroup/versions/V1/index.js +12 -3
- package/dist/esm/components/UTPanel/UTPanel.stories.js +48 -0
- package/dist/esm/components/UTPanel/versions/V1/README.md +14 -0
- package/dist/esm/components/UTPanel/versions/V1/components/AdditionalContentModule/index.js +3 -1
- package/dist/esm/components/UTRadioGroup/versions/V1/index.js +12 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [3.171.1](https://github.com/widergy/energy-ui/compare/v3.171.0...v3.171.1) (2026-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [OUG] radio group error ([#827](https://github.com/widergy/energy-ui/issues/827)) ([8b3224a](https://github.com/widergy/energy-ui/commit/8b3224a97d184dbc3ca37bb182c8b84e3cbb157a))
|
|
7
|
+
|
|
8
|
+
# [3.171.0](https://github.com/widergy/energy-ui/compare/v3.170.0...v3.171.0) (2026-06-22)
|
|
9
|
+
|
|
10
|
+
### Novedades y Mejoras
|
|
11
|
+
|
|
12
|
+
* Ahora es posible deshabilitar elementos individuales del panel lateral, impidiendo su acceso cuando no están disponibles o no corresponden al contexto del usuario. [#826](https://github.com/widergy/Energy-UI/pull/826) [AXCH-1778](https://widergy.atlassian.net/browse/AXCH-1778)
|
|
13
|
+
|
|
1
14
|
# [3.170.0](https://github.com/widergy/energy-ui/compare/v3.169.0...v3.170.0) (2026-06-22)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.V1Workflow = exports.V1WithStatus = exports.V1WithPretitle = exports.V1WithPagination = exports.V1WithHeaderItems = exports.V1WithAdditionalContentBadge = exports.V1WithAdditionalContent = exports.V1WithActions = exports.V1LargeSize = exports.V1Inline = exports.V1Default = exports.V1Collapsible = exports.V0WithCustomTitle = exports.V0LeftSide = exports.V0Default = exports.Playground = void 0;
|
|
6
|
+
exports.default = exports.V1Workflow = exports.V1WithStatus = exports.V1WithPretitle = exports.V1WithPagination = exports.V1WithHeaderItems = exports.V1WithAdditionalContentDisabled = exports.V1WithAdditionalContentBadge = exports.V1WithAdditionalContent = exports.V1WithActions = exports.V1LargeSize = exports.V1Inline = exports.V1Default = exports.V1Collapsible = exports.V0WithCustomTitle = exports.V0LeftSide = exports.V0Default = exports.Playground = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _utils = require("stories/utils");
|
|
9
9
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
@@ -945,6 +945,54 @@ const V1WithAdditionalContentBadge = exports.V1WithAdditionalContentBadge = {
|
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
};
|
|
948
|
+
const V1WithAdditionalContentDisabled = exports.V1WithAdditionalContentDisabled = {
|
|
949
|
+
args: {
|
|
950
|
+
version: 'V1',
|
|
951
|
+
open: false,
|
|
952
|
+
title: 'Panel con Item Deshabilitado',
|
|
953
|
+
subtitle: 'Sidebar con un ítem inaccesible',
|
|
954
|
+
panelSide: 'right',
|
|
955
|
+
size: 'M',
|
|
956
|
+
additionalContent: [{
|
|
957
|
+
id: 'settings',
|
|
958
|
+
Icon: 'IconSettings',
|
|
959
|
+
BodyComponent: SettingsBodyComponent,
|
|
960
|
+
tooltipProps: {
|
|
961
|
+
content: 'Configuración'
|
|
962
|
+
}
|
|
963
|
+
}, {
|
|
964
|
+
id: 'notifications',
|
|
965
|
+
Icon: 'IconBell',
|
|
966
|
+
disabled: true,
|
|
967
|
+
BodyComponent: NotificationsBodyComponent,
|
|
968
|
+
tooltipProps: {
|
|
969
|
+
content: 'Notificaciones (no disponible)'
|
|
970
|
+
}
|
|
971
|
+
}, {
|
|
972
|
+
id: 'help',
|
|
973
|
+
Icon: 'IconHelpCircle',
|
|
974
|
+
BodyComponent: HelpBodyComponent,
|
|
975
|
+
tooltipProps: {
|
|
976
|
+
content: 'Ayuda'
|
|
977
|
+
}
|
|
978
|
+
}],
|
|
979
|
+
children: /*#__PURE__*/_react.default.createElement("div", {
|
|
980
|
+
style: {
|
|
981
|
+
padding: '16px'
|
|
982
|
+
}
|
|
983
|
+
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
984
|
+
variant: "body1"
|
|
985
|
+
}, "El \xEDcono de Notificaciones tiene ", /*#__PURE__*/_react.default.createElement("code", null, "disabled: true"), " y no puede seleccionarse."))
|
|
986
|
+
},
|
|
987
|
+
name: 'V1 - Sidebar con Item Deshabilitado',
|
|
988
|
+
parameters: {
|
|
989
|
+
docs: {
|
|
990
|
+
description: {
|
|
991
|
+
story: 'Usa `disabled: true` en un item de `additionalContent` para deshabilitar el botón de ese item en la sidebar. Los demás items funcionan normalmente.'
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
};
|
|
948
996
|
const Playground = exports.Playground = {
|
|
949
997
|
args: {
|
|
950
998
|
version: 'V1',
|
|
@@ -44,3 +44,17 @@ Component used for displaying a side panel.
|
|
|
44
44
|
| showBackButton | boolean | false | Shows a go back arrow button |
|
|
45
45
|
| showTag | bool | false | Shows a tag indicator in the header area. When true, the tagProps object is passed to the UTStatus component to render a tag. |
|
|
46
46
|
| tagProps | object | {} | Object containing props for the UTStatus component used as a tag in the header. Supports all [UTStatus props](https://github.com/widergy/Energy-UI/tree/master/src/lib/components/UTStatus) |
|
|
47
|
+
| additionalContent | array | | Array of sidebar items rendered in a collapsible side panel. See structure below. |
|
|
48
|
+
|
|
49
|
+
### `additionalContent` item structure
|
|
50
|
+
|
|
51
|
+
Each object in the array can contain:
|
|
52
|
+
|
|
53
|
+
| Field | Type | Required | Description |
|
|
54
|
+
| :-------------- | ------------- | -------- | ------------------------------------------------------------------------------------------------ |
|
|
55
|
+
| `id` | `string` | ✅ | Unique identifier for the item. Used as the active key and as part of the sidebar button testId. |
|
|
56
|
+
| `Icon` | `string` | ✅ | Tabler icon name for the sidebar button (e.g. `'IconSettings'`). |
|
|
57
|
+
| `BodyComponent` | `elementType` | ✅ | React component rendered in the expanded content area when this item is active. |
|
|
58
|
+
| `tooltipProps` | `object` | ✅ | Props passed to the `UTTooltip` wrapping the sidebar button. Must include `content`. |
|
|
59
|
+
| `count` | `number` | — | When greater than 0, shows a numeric badge over the sidebar icon. |
|
|
60
|
+
| `disabled` | `bool` | — | When `true`, the sidebar button is disabled and the item cannot be selected. |
|
|
@@ -78,6 +78,7 @@ const AdditionalContentModule = _ref => {
|
|
|
78
78
|
colorTheme: activeId === item.id ? 'primary' : 'gray',
|
|
79
79
|
className: _stylesModule.default.sidebarButton,
|
|
80
80
|
dataTestId: "".concat(panel.additionalContent.sidebarButton).concat(item.id),
|
|
81
|
+
disabled: item.disabled,
|
|
81
82
|
Icon: item.Icon,
|
|
82
83
|
onClick: () => onSelectItem(activeId === item.id ? null : item.id),
|
|
83
84
|
size: "medium",
|
|
@@ -95,6 +96,7 @@ const AdditionalContentModule = _ref => {
|
|
|
95
96
|
};
|
|
96
97
|
AdditionalContentModule.propTypes = {
|
|
97
98
|
additionalContent: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
99
|
+
disabled: _propTypes.bool,
|
|
98
100
|
id: _propTypes.string.isRequired,
|
|
99
101
|
Icon: _propTypes.string.isRequired,
|
|
100
102
|
count: _propTypes.number,
|
|
@@ -10,6 +10,8 @@ var _RadioGroup = _interopRequireDefault(require("@material-ui/core/RadioGroup")
|
|
|
10
10
|
var _buttonTypes = require("../../../../types/buttonTypes");
|
|
11
11
|
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
12
12
|
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
13
|
+
var _utils = require("../../../UTValidation/utils");
|
|
14
|
+
var _UTValidation = _interopRequireDefault(require("../../../UTValidation"));
|
|
13
15
|
var _Radio = _interopRequireDefault(require("./components/Radio"));
|
|
14
16
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
17
|
var _constants = require("./constants");
|
|
@@ -21,9 +23,13 @@ const UTRadioGroup = _ref => {
|
|
|
21
23
|
actions,
|
|
22
24
|
classNames = {},
|
|
23
25
|
dataTestId,
|
|
26
|
+
descriptionProps,
|
|
24
27
|
disabled,
|
|
28
|
+
error,
|
|
29
|
+
errorDataTestId,
|
|
25
30
|
horizontalSpacing = 'medium',
|
|
26
31
|
itemDataTestId,
|
|
32
|
+
nameProps,
|
|
27
33
|
onChange = () => {},
|
|
28
34
|
options,
|
|
29
35
|
required,
|
|
@@ -31,8 +37,6 @@ const UTRadioGroup = _ref => {
|
|
|
31
37
|
title,
|
|
32
38
|
value = null,
|
|
33
39
|
variant,
|
|
34
|
-
nameProps,
|
|
35
|
-
descriptionProps,
|
|
36
40
|
verticalSpacing = 'medium'
|
|
37
41
|
} = _ref;
|
|
38
42
|
const categorizedOptions = (0, _react.useMemo)(() => {
|
|
@@ -55,6 +59,7 @@ const UTRadioGroup = _ref => {
|
|
|
55
59
|
return categoryA === _constants.NO_CATEGORY ? -1 : categoryB === _constants.NO_CATEGORY ? 1 : 0;
|
|
56
60
|
});
|
|
57
61
|
}, [options]);
|
|
62
|
+
const validationData = (0, _react.useMemo)(() => error && (0, _utils.formatErrorToValidation)(error), [error]);
|
|
58
63
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
59
64
|
className: "".concat(_stylesModule.default.container, " ").concat(classNames.root),
|
|
60
65
|
"data-testid": dataTestId
|
|
@@ -88,7 +93,10 @@ const UTRadioGroup = _ref => {
|
|
|
88
93
|
spacing: horizontalSpacing,
|
|
89
94
|
variant: variant
|
|
90
95
|
}, (item === null || item === void 0 ? void 0 : item.configuration) || {}, item))));
|
|
91
|
-
}))
|
|
96
|
+
})), validationData && /*#__PURE__*/_react.default.createElement(_UTValidation.default, {
|
|
97
|
+
dataTestId: errorDataTestId,
|
|
98
|
+
validationData: validationData
|
|
99
|
+
}));
|
|
92
100
|
};
|
|
93
101
|
UTRadioGroup.propTypes = {
|
|
94
102
|
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
@@ -97,6 +105,7 @@ UTRadioGroup.propTypes = {
|
|
|
97
105
|
descriptionProps: _propTypes.object,
|
|
98
106
|
disabled: _propTypes.bool,
|
|
99
107
|
error: _propTypes.string,
|
|
108
|
+
errorDataTestId: _propTypes.string,
|
|
100
109
|
horizontalSpacing: _propTypes.string,
|
|
101
110
|
itemDataTestId: _propTypes.string,
|
|
102
111
|
nameProps: _propTypes.object,
|
|
@@ -939,6 +939,54 @@ export const V1WithAdditionalContentBadge = {
|
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
};
|
|
942
|
+
export const V1WithAdditionalContentDisabled = {
|
|
943
|
+
args: {
|
|
944
|
+
version: 'V1',
|
|
945
|
+
open: false,
|
|
946
|
+
title: 'Panel con Item Deshabilitado',
|
|
947
|
+
subtitle: 'Sidebar con un ítem inaccesible',
|
|
948
|
+
panelSide: 'right',
|
|
949
|
+
size: 'M',
|
|
950
|
+
additionalContent: [{
|
|
951
|
+
id: 'settings',
|
|
952
|
+
Icon: 'IconSettings',
|
|
953
|
+
BodyComponent: SettingsBodyComponent,
|
|
954
|
+
tooltipProps: {
|
|
955
|
+
content: 'Configuración'
|
|
956
|
+
}
|
|
957
|
+
}, {
|
|
958
|
+
id: 'notifications',
|
|
959
|
+
Icon: 'IconBell',
|
|
960
|
+
disabled: true,
|
|
961
|
+
BodyComponent: NotificationsBodyComponent,
|
|
962
|
+
tooltipProps: {
|
|
963
|
+
content: 'Notificaciones (no disponible)'
|
|
964
|
+
}
|
|
965
|
+
}, {
|
|
966
|
+
id: 'help',
|
|
967
|
+
Icon: 'IconHelpCircle',
|
|
968
|
+
BodyComponent: HelpBodyComponent,
|
|
969
|
+
tooltipProps: {
|
|
970
|
+
content: 'Ayuda'
|
|
971
|
+
}
|
|
972
|
+
}],
|
|
973
|
+
children: /*#__PURE__*/React.createElement("div", {
|
|
974
|
+
style: {
|
|
975
|
+
padding: '16px'
|
|
976
|
+
}
|
|
977
|
+
}, /*#__PURE__*/React.createElement(UTLabel, {
|
|
978
|
+
variant: "body1"
|
|
979
|
+
}, "El \xEDcono de Notificaciones tiene ", /*#__PURE__*/React.createElement("code", null, "disabled: true"), " y no puede seleccionarse."))
|
|
980
|
+
},
|
|
981
|
+
name: 'V1 - Sidebar con Item Deshabilitado',
|
|
982
|
+
parameters: {
|
|
983
|
+
docs: {
|
|
984
|
+
description: {
|
|
985
|
+
story: 'Usa `disabled: true` en un item de `additionalContent` para deshabilitar el botón de ese item en la sidebar. Los demás items funcionan normalmente.'
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
};
|
|
942
990
|
export const Playground = {
|
|
943
991
|
args: {
|
|
944
992
|
version: 'V1',
|
|
@@ -44,3 +44,17 @@ Component used for displaying a side panel.
|
|
|
44
44
|
| showBackButton | boolean | false | Shows a go back arrow button |
|
|
45
45
|
| showTag | bool | false | Shows a tag indicator in the header area. When true, the tagProps object is passed to the UTStatus component to render a tag. |
|
|
46
46
|
| tagProps | object | {} | Object containing props for the UTStatus component used as a tag in the header. Supports all [UTStatus props](https://github.com/widergy/Energy-UI/tree/master/src/lib/components/UTStatus) |
|
|
47
|
+
| additionalContent | array | | Array of sidebar items rendered in a collapsible side panel. See structure below. |
|
|
48
|
+
|
|
49
|
+
### `additionalContent` item structure
|
|
50
|
+
|
|
51
|
+
Each object in the array can contain:
|
|
52
|
+
|
|
53
|
+
| Field | Type | Required | Description |
|
|
54
|
+
| :-------------- | ------------- | -------- | ------------------------------------------------------------------------------------------------ |
|
|
55
|
+
| `id` | `string` | ✅ | Unique identifier for the item. Used as the active key and as part of the sidebar button testId. |
|
|
56
|
+
| `Icon` | `string` | ✅ | Tabler icon name for the sidebar button (e.g. `'IconSettings'`). |
|
|
57
|
+
| `BodyComponent` | `elementType` | ✅ | React component rendered in the expanded content area when this item is active. |
|
|
58
|
+
| `tooltipProps` | `object` | ✅ | Props passed to the `UTTooltip` wrapping the sidebar button. Must include `content`. |
|
|
59
|
+
| `count` | `number` | — | When greater than 0, shows a numeric badge over the sidebar icon. |
|
|
60
|
+
| `disabled` | `bool` | — | When `true`, the sidebar button is disabled and the item cannot be selected. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import { arrayOf, elementType, func, number, object, shape, string } from 'prop-types';
|
|
3
|
+
import { arrayOf, bool, elementType, func, number, object, shape, string } from 'prop-types';
|
|
4
4
|
import 'react-perfect-scrollbar/dist/css/styles.css';
|
|
5
5
|
import PerfectScrollbar from 'react-perfect-scrollbar';
|
|
6
6
|
import UTButton from '../../../../../UTButton';
|
|
@@ -70,6 +70,7 @@ const AdditionalContentModule = _ref => {
|
|
|
70
70
|
colorTheme: activeId === item.id ? 'primary' : 'gray',
|
|
71
71
|
className: styles.sidebarButton,
|
|
72
72
|
dataTestId: "".concat(panel.additionalContent.sidebarButton).concat(item.id),
|
|
73
|
+
disabled: item.disabled,
|
|
73
74
|
Icon: item.Icon,
|
|
74
75
|
onClick: () => onSelectItem(activeId === item.id ? null : item.id),
|
|
75
76
|
size: "medium",
|
|
@@ -87,6 +88,7 @@ const AdditionalContentModule = _ref => {
|
|
|
87
88
|
};
|
|
88
89
|
AdditionalContentModule.propTypes = {
|
|
89
90
|
additionalContent: arrayOf(shape({
|
|
91
|
+
disabled: bool,
|
|
90
92
|
id: string.isRequired,
|
|
91
93
|
Icon: string.isRequired,
|
|
92
94
|
count: number,
|
|
@@ -5,6 +5,8 @@ import RadioGroup from '@material-ui/core/RadioGroup';
|
|
|
5
5
|
import { buttonTypes } from '../../../../types/buttonTypes';
|
|
6
6
|
import UTFieldLabel from '../../../UTFieldLabel';
|
|
7
7
|
import UTLabel from '../../../UTLabel';
|
|
8
|
+
import { formatErrorToValidation } from '../../../UTValidation/utils';
|
|
9
|
+
import UTValidation from '../../../UTValidation';
|
|
8
10
|
import Radio from './components/Radio';
|
|
9
11
|
import styles from './styles.module.scss';
|
|
10
12
|
import { NO_CATEGORY } from './constants';
|
|
@@ -13,9 +15,13 @@ const UTRadioGroup = _ref => {
|
|
|
13
15
|
actions,
|
|
14
16
|
classNames = {},
|
|
15
17
|
dataTestId,
|
|
18
|
+
descriptionProps,
|
|
16
19
|
disabled,
|
|
20
|
+
error,
|
|
21
|
+
errorDataTestId,
|
|
17
22
|
horizontalSpacing = 'medium',
|
|
18
23
|
itemDataTestId,
|
|
24
|
+
nameProps,
|
|
19
25
|
onChange = () => {},
|
|
20
26
|
options,
|
|
21
27
|
required,
|
|
@@ -23,8 +29,6 @@ const UTRadioGroup = _ref => {
|
|
|
23
29
|
title,
|
|
24
30
|
value = null,
|
|
25
31
|
variant,
|
|
26
|
-
nameProps,
|
|
27
|
-
descriptionProps,
|
|
28
32
|
verticalSpacing = 'medium'
|
|
29
33
|
} = _ref;
|
|
30
34
|
const categorizedOptions = useMemo(() => {
|
|
@@ -47,6 +51,7 @@ const UTRadioGroup = _ref => {
|
|
|
47
51
|
return categoryA === NO_CATEGORY ? -1 : categoryB === NO_CATEGORY ? 1 : 0;
|
|
48
52
|
});
|
|
49
53
|
}, [options]);
|
|
54
|
+
const validationData = useMemo(() => error && formatErrorToValidation(error), [error]);
|
|
50
55
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
56
|
className: "".concat(styles.container, " ").concat(classNames.root),
|
|
52
57
|
"data-testid": dataTestId
|
|
@@ -80,7 +85,10 @@ const UTRadioGroup = _ref => {
|
|
|
80
85
|
spacing: horizontalSpacing,
|
|
81
86
|
variant: variant
|
|
82
87
|
}, (item === null || item === void 0 ? void 0 : item.configuration) || {}, item))));
|
|
83
|
-
}))
|
|
88
|
+
})), validationData && /*#__PURE__*/React.createElement(UTValidation, {
|
|
89
|
+
dataTestId: errorDataTestId,
|
|
90
|
+
validationData: validationData
|
|
91
|
+
}));
|
|
84
92
|
};
|
|
85
93
|
UTRadioGroup.propTypes = {
|
|
86
94
|
actions: arrayOf(buttonTypes),
|
|
@@ -89,6 +97,7 @@ UTRadioGroup.propTypes = {
|
|
|
89
97
|
descriptionProps: object,
|
|
90
98
|
disabled: bool,
|
|
91
99
|
error: string,
|
|
100
|
+
errorDataTestId: string,
|
|
92
101
|
horizontalSpacing: string,
|
|
93
102
|
itemDataTestId: string,
|
|
94
103
|
nameProps: object,
|