@widergy/energy-ui 3.133.1 → 3.135.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 +20 -0
- package/dist/components/UTDataElement/README.md +22 -21
- package/dist/components/UTDataElement/UTDataElement.stories.js +63 -1
- package/dist/components/UTDataElement/constants.js +4 -1
- package/dist/components/UTDataElement/index.js +31 -12
- package/dist/components/UTDataElement/styles.module.scss +21 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [3.135.0](https://github.com/widergy/energy-ui/compare/v3.134.0...v3.135.0) (2026-02-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [AXCH-799] new build step ([#743](https://github.com/widergy/energy-ui/issues/743)) ([b637fbc](https://github.com/widergy/energy-ui/commit/b637fbc0f5246d2c411905a0e5cdf1301b25f173))
|
|
7
|
+
* ci version ([102a74f](https://github.com/widergy/energy-ui/commit/102a74f03b4cab60cec619d565e1966d374fe30a))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* [BRILLA-213] dynamic height in UTDataElement ([#754](https://github.com/widergy/energy-ui/issues/754)) ([6e4d4d5](https://github.com/widergy/energy-ui/commit/6e4d4d55caad3dbe18b4fe22c2b352511bef11e4))
|
|
13
|
+
|
|
14
|
+
# [3.134.0](https://github.com/widergy/energy-ui/compare/v3.133.1...v3.134.0) (2026-02-04)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* [AXCH-799] sb tests in gh actions ([#747](https://github.com/widergy/energy-ui/issues/747)) ([cee8893](https://github.com/widergy/energy-ui/commit/cee88936ce45c771dddaed880e8f4f0e45958f93))
|
|
20
|
+
|
|
1
21
|
## [3.133.1](https://github.com/widergy/energy-ui/compare/v3.133.0...v3.133.1) (2026-01-27)
|
|
2
22
|
|
|
3
23
|
|
|
@@ -4,27 +4,28 @@ A versatile data component that can be customized with various themes, sizes, ic
|
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
6
|
|
|
7
|
-
| Name
|
|
8
|
-
|
|
|
9
|
-
| action
|
|
10
|
-
| area
|
|
11
|
-
| badge
|
|
12
|
-
| badgeProps
|
|
13
|
-
| children
|
|
14
|
-
| classes
|
|
15
|
-
| classNames
|
|
16
|
-
| Data
|
|
17
|
-
| dataProps
|
|
18
|
-
| forceShowBadge
|
|
19
|
-
| Icon
|
|
20
|
-
| iconProps
|
|
21
|
-
| orientation
|
|
22
|
-
| paddingVertical
|
|
23
|
-
| prefix
|
|
24
|
-
| prefixProps
|
|
25
|
-
| spacing
|
|
26
|
-
| title
|
|
27
|
-
| titleProps
|
|
7
|
+
| Name | Type | Default | Description |
|
|
8
|
+
| ------------------ | ----------------- | ------------ | ------------------------------------------------------------------ |
|
|
9
|
+
| action | object | | Action configuration for button or switch. See Action Types below. |
|
|
10
|
+
| area | bool | `false` | Specifies whether the component has a background area. |
|
|
11
|
+
| badge | string \| number | | Displays a badge with text or number. |
|
|
12
|
+
| badgeProps | object | `{}` | Additional props for customizing the badge. |
|
|
13
|
+
| children | element | | Collapsible content displayed below the main component. |
|
|
14
|
+
| classes | objectOf(string) | | Theme classes for styling. |
|
|
15
|
+
| classNames | objectOf(string) | | Additional class names for custom styling. |
|
|
16
|
+
| Data | element \| string | | Data content to display (can be a React element or string). |
|
|
17
|
+
| dataProps | object | `{}` | Additional props for configuring the data element. |
|
|
18
|
+
| forceShowBadge | bool | `false` | Forces the badge to be displayed even when empty. |
|
|
19
|
+
| Icon | element \| string | | Icon to display (can be a UTIcon name or custom React element). |
|
|
20
|
+
| iconProps | object | `{}` | Additional props for the icon element. |
|
|
21
|
+
| orientation | string | `horizontal` | Defines the layout orientation. |
|
|
22
|
+
| paddingVertical | string | `medium` | Vertical padding applied to the component. |
|
|
23
|
+
| prefix | string | | Text or symbol displayed before the title. |
|
|
24
|
+
| prefixProps | object | `{}` | Additional props for customizing the prefix. |
|
|
25
|
+
| spacing | string | `medium` | Defines the spacing between elements. |
|
|
26
|
+
| title | string | | Title text displayed in the component. |
|
|
27
|
+
| titleProps | object | `{}` | Additional props for customizing the title. |
|
|
28
|
+
| transitionDuration | number | `300` | Duration of the transition animation in milliseconds. |
|
|
28
29
|
|
|
29
30
|
## Action Types
|
|
30
31
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.WithTooltip = exports.WithSwitchAction = exports.WithPrefix = exports.WithNumericBadge = exports.WithIcon = exports.WithExpandableContent = exports.WithButtonAction = exports.WithBadge = exports.VerticalOrientation = exports.SmallSpacing = exports.SmallPadding = exports.Playground = exports.ForcedBadge = exports.Default = exports.CustomDataTestId = exports.ComplexExample = exports.AreaMode = void 0;
|
|
6
|
+
exports.default = exports.WithTooltip = exports.WithSwitchAction = exports.WithPrefix = exports.WithNumericBadge = exports.WithIcon = exports.WithExpandableContent = exports.WithButtonAction = exports.WithBadge = exports.VerticalOrientation = exports.SmallSpacing = exports.SmallPadding = exports.Playground = exports.NestedExample = exports.ForcedBadge = exports.Default = exports.CustomDataTestId = exports.ComplexExample = exports.AreaMode = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _utils = require("stories/utils");
|
|
9
9
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
@@ -457,6 +457,68 @@ const ComplexExample = exports.ComplexExample = {
|
|
|
457
457
|
},
|
|
458
458
|
name: 'Ejemplo Complejo'
|
|
459
459
|
};
|
|
460
|
+
const NestedExample = exports.NestedExample = {
|
|
461
|
+
args: {
|
|
462
|
+
title: 'Prueba anidamiento',
|
|
463
|
+
prefix: 'Nivel 1',
|
|
464
|
+
Data: /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
465
|
+
variant: "h6",
|
|
466
|
+
weight: "bold",
|
|
467
|
+
colorTheme: "primary"
|
|
468
|
+
}, "$10,000.00"),
|
|
469
|
+
Icon: 'IconBuildingBank',
|
|
470
|
+
badge: 'Master',
|
|
471
|
+
children: /*#__PURE__*/_react.default.createElement("div", {
|
|
472
|
+
style: {
|
|
473
|
+
padding: '16px 0'
|
|
474
|
+
}
|
|
475
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
476
|
+
title: "Este elemento es hijo del primero",
|
|
477
|
+
prefix: "Nivel 2",
|
|
478
|
+
Data: /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
479
|
+
variant: "body1",
|
|
480
|
+
weight: "medium",
|
|
481
|
+
colorTheme: "secondary"
|
|
482
|
+
}, "$7,500.00"),
|
|
483
|
+
Icon: "IconPigMoney",
|
|
484
|
+
badge: "Active",
|
|
485
|
+
orientation: _constants.ORIENTATION.HORIZONTAL,
|
|
486
|
+
paddingVertical: _constants.PADDING.SMALL,
|
|
487
|
+
spacing: _constants.SPACING.SMALL
|
|
488
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
489
|
+
style: {
|
|
490
|
+
padding: '12px 0'
|
|
491
|
+
}
|
|
492
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
493
|
+
title: "Este elemento es hijo del segundo",
|
|
494
|
+
prefix: "Nivel 3",
|
|
495
|
+
Data: /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
496
|
+
variant: "body2",
|
|
497
|
+
weight: "regular",
|
|
498
|
+
colorTheme: "success"
|
|
499
|
+
}, "$2,500.00"),
|
|
500
|
+
Icon: "IconShield",
|
|
501
|
+
badge: "3",
|
|
502
|
+
orientation: _constants.ORIENTATION.HORIZONTAL,
|
|
503
|
+
paddingVertical: _constants.PADDING.SMALL,
|
|
504
|
+
spacing: _constants.SPACING.SMALL
|
|
505
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
506
|
+
style: {
|
|
507
|
+
padding: '8px 0'
|
|
508
|
+
}
|
|
509
|
+
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
510
|
+
variant: "caption",
|
|
511
|
+
colorTheme: "gray"
|
|
512
|
+
}, "\xDAltimo dep\xF3sito: $500.00 - 15 Ene 2024"), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
513
|
+
variant: "caption",
|
|
514
|
+
colorTheme: "gray"
|
|
515
|
+
}, "Meta: $5,000.00 (50% completado)")))))),
|
|
516
|
+
orientation: _constants.ORIENTATION.HORIZONTAL,
|
|
517
|
+
paddingVertical: _constants.PADDING.MEDIUM,
|
|
518
|
+
spacing: _constants.SPACING.MEDIUM
|
|
519
|
+
},
|
|
520
|
+
name: 'Ejemplo de Anidamiento y contenido dinámico'
|
|
521
|
+
};
|
|
460
522
|
const AreaMode = exports.AreaMode = {
|
|
461
523
|
args: {
|
|
462
524
|
title: 'Elemento con Área Completa',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TOOLTIP_PROPS = exports.SPACING = exports.PADDING = exports.ORIENTATION = exports.ACTION_TYPE = void 0;
|
|
6
|
+
exports.TOOLTIP_PROPS = exports.SPACING = exports.PADDING = exports.ORIENTATION = exports.ANIMATION = exports.ACTION_TYPE = void 0;
|
|
7
7
|
const ORIENTATION = exports.ORIENTATION = {
|
|
8
8
|
HORIZONTAL: 'horizontal',
|
|
9
9
|
VERTICAL: 'vertical'
|
|
@@ -24,4 +24,7 @@ const ACTION_TYPE = exports.ACTION_TYPE = {
|
|
|
24
24
|
const TOOLTIP_PROPS = exports.TOOLTIP_PROPS = {
|
|
25
25
|
appendTo: () => document.body,
|
|
26
26
|
interactive: false
|
|
27
|
+
};
|
|
28
|
+
const ANIMATION = exports.ANIMATION = {
|
|
29
|
+
TRANSITION_DURATION: 300
|
|
27
30
|
};
|
|
@@ -49,19 +49,37 @@ const UTDataElement = _ref => {
|
|
|
49
49
|
prefixProps = {},
|
|
50
50
|
spacing = _constants.SPACING.MEDIUM,
|
|
51
51
|
title,
|
|
52
|
-
titleProps = {}
|
|
52
|
+
titleProps = {},
|
|
53
|
+
transitionDuration = _constants.ANIMATION.TRANSITION_DURATION
|
|
53
54
|
} = _ref;
|
|
54
55
|
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeMultipleClassNames)(_stylesModule.default, theme, classNames), [classNames, theme]);
|
|
55
56
|
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(true);
|
|
56
|
-
const [
|
|
57
|
+
const [isTransitioning, setIsTransitioning] = (0, _react.useState)(false);
|
|
58
|
+
const [contentHeight, setContentHeight] = (0, _react.useState)('0px');
|
|
57
59
|
const childrenRef = (0, _react.useRef)(null);
|
|
58
|
-
const toggleCollapsed = (0, _react.useCallback)(() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const toggleCollapsed = (0, _react.useCallback)(() => {
|
|
61
|
+
if (isCollapsed) {
|
|
62
|
+
if (childrenRef.current) {
|
|
63
|
+
const height = childrenRef.current.scrollHeight;
|
|
64
|
+
setContentHeight("".concat(height, "px"));
|
|
65
|
+
setIsTransitioning(true);
|
|
66
|
+
setIsCollapsed(false);
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
setIsTransitioning(false);
|
|
69
|
+
setContentHeight('none');
|
|
70
|
+
}, transitionDuration);
|
|
71
|
+
}
|
|
72
|
+
} else if (childrenRef.current) {
|
|
73
|
+
const height = childrenRef.current.scrollHeight;
|
|
74
|
+
setContentHeight("".concat(height, "px"));
|
|
75
|
+
setIsTransitioning(true);
|
|
76
|
+
requestAnimationFrame(() => {
|
|
77
|
+
setContentHeight('0px');
|
|
78
|
+
setIsCollapsed(true);
|
|
79
|
+
setTimeout(() => setIsTransitioning(false), transitionDuration);
|
|
80
|
+
});
|
|
63
81
|
}
|
|
64
|
-
}, [
|
|
82
|
+
}, [isCollapsed]);
|
|
65
83
|
const IconComponent = (0, _componentUtils.isUTIcon)(Icon) ? _UTIcon.default : Icon;
|
|
66
84
|
const DataComponent = (0, _componentUtils.isUTLabel)(Data) ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, dataProps, Data) : Data;
|
|
67
85
|
const showBadge = forceShowBadge || (0, _isString.default)(badge) && !(0, _isEmpty.default)(badge) || (0, _isFinite.default)(badge);
|
|
@@ -73,6 +91,7 @@ const UTDataElement = _ref => {
|
|
|
73
91
|
const contentClasses = "".concat(classes.content, " ").concat(_stylesModule.default["spacing".concat((0, _componentUtils.capitalize)(spacing))]);
|
|
74
92
|
const infoClasses = "".concat(classes.info, " ").concat(orientation === _constants.ORIENTATION.VERTICAL && classes.vertical);
|
|
75
93
|
const iconCollapseButtonClasses = "".concat(classes.iconCollapseButton, " ").concat(isCollapsed && classes.collapsed);
|
|
94
|
+
const childrenClasses = "".concat(classes.children, " ").concat(isCollapsed ? classes.childrenCollapsed : classes.childrenExpanded, " ").concat(isTransitioning ? classes.childrenTransitioning : classes.childrenStatic);
|
|
76
95
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
96
|
className: "".concat(classes.container, " ").concat(area ? classes.area : '', " ").concat(classes["padding".concat((0, _componentUtils.capitalize)(paddingVertical))]),
|
|
78
97
|
"data-testid": dataTestId ? "".concat(dataTestId, ".").concat(dataElement.container) : undefined
|
|
@@ -108,10 +127,9 @@ const UTDataElement = _ref => {
|
|
|
108
127
|
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(dataElement.collapseButton) : undefined
|
|
109
128
|
})), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
110
129
|
style: {
|
|
111
|
-
maxHeight:
|
|
112
|
-
marginTop: isCollapsed ? 0 : 16
|
|
130
|
+
maxHeight: contentHeight
|
|
113
131
|
},
|
|
114
|
-
className:
|
|
132
|
+
className: childrenClasses
|
|
115
133
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
116
134
|
ref: childrenRef
|
|
117
135
|
}, children)));
|
|
@@ -135,6 +153,7 @@ UTDataElement.propTypes = {
|
|
|
135
153
|
prefixProps: _propTypes.object,
|
|
136
154
|
spacing: _propTypes.string,
|
|
137
155
|
title: _propTypes.string,
|
|
138
|
-
titleProps: _propTypes.object
|
|
156
|
+
titleProps: _propTypes.object,
|
|
157
|
+
transitionDuration: _propTypes.number
|
|
139
158
|
};
|
|
140
159
|
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTDataElement);
|
|
@@ -62,8 +62,27 @@
|
|
|
62
62
|
.children {
|
|
63
63
|
overflow: hidden;
|
|
64
64
|
transition:
|
|
65
|
-
max-height 0.3s ease,
|
|
66
|
-
margin-top 0.3s ease;
|
|
65
|
+
max-height 0.3s ease-out,
|
|
66
|
+
margin-top 0.3s ease-out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.childrenCollapsed {
|
|
70
|
+
max-height: 0;
|
|
71
|
+
margin-top: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.childrenExpanded {
|
|
75
|
+
margin-top: 16px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.childrenTransitioning {
|
|
79
|
+
transition:
|
|
80
|
+
max-height 0.3s ease-out,
|
|
81
|
+
margin-top 0.3s ease-out;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.childrenStatic {
|
|
85
|
+
transition: none;
|
|
67
86
|
}
|
|
68
87
|
|
|
69
88
|
.badge {
|