@widergy/energy-ui 3.82.2 → 3.83.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 +14 -0
- package/dist/components/UTBadge/theme.js +1 -0
- package/dist/components/UTDatePicker/index.js +16 -13
- package/dist/components/UTDatePicker/utils.js +10 -19
- package/dist/components/UTPanel/versions/V1/constants.js +2 -1
- package/dist/components/UTPanel/versions/V1/index.js +29 -20
- package/dist/components/UTPanel/versions/V1/styles.module.scss +45 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.83.1](https://github.com/widergy/energy-ui/compare/v3.83.0...v3.83.1) (2025-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [OAG-1369] date search error ([#621](https://github.com/widergy/energy-ui/issues/621)) ([7133f09](https://github.com/widergy/energy-ui/commit/7133f09385cd3bee092abf55b2b05cd99b64a4db))
|
|
7
|
+
|
|
8
|
+
# [3.83.0](https://github.com/widergy/energy-ui/compare/v3.82.2...v3.83.0) (2025-06-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* [AGCE-760] panel update ([#629](https://github.com/widergy/energy-ui/issues/629)) ([682b88c](https://github.com/widergy/energy-ui/commit/682b88c1d711a95e2cf8b47865761b93855a0b5c))
|
|
14
|
+
|
|
1
15
|
## [3.82.2](https://github.com/widergy/energy-ui/compare/v3.82.1...v3.82.2) (2025-06-18)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -11,6 +11,7 @@ var _dayjs = _interopRequireDefault(require("@date-io/dayjs"));
|
|
|
11
11
|
var _dayjs2 = _interopRequireDefault(require("dayjs"));
|
|
12
12
|
var _es = _interopRequireDefault(require("dayjs/locale/es"));
|
|
13
13
|
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
14
|
+
var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
|
|
14
15
|
var _form = require("@widergy/web-utils/lib/form");
|
|
15
16
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
16
17
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
@@ -51,6 +52,7 @@ CalendarIcon.defaultProps = {
|
|
|
51
52
|
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
52
53
|
};
|
|
53
54
|
_dayjs2.default.extend(_customParseFormat.default);
|
|
55
|
+
_dayjs2.default.extend(_isBetween.default);
|
|
54
56
|
class CustomUtils extends _dayjs.default {
|
|
55
57
|
constructor() {
|
|
56
58
|
super(...arguments);
|
|
@@ -90,20 +92,20 @@ const UTDatePicker = _ref => {
|
|
|
90
92
|
const onlyPastMonth = (field === null || field === void 0 || (_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 || (_field$configuration2 = _field$configuration2.customDateValidations) === null || _field$configuration2 === void 0 || (_field$configuration2 = _field$configuration2.onlyPastMonth) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.active) || false;
|
|
91
93
|
const avoidFutureDates = (field === null || field === void 0 || (_field$configuration3 = field.configuration) === null || _field$configuration3 === void 0 || (_field$configuration3 = _field$configuration3.customDateValidations) === null || _field$configuration3 === void 0 || (_field$configuration3 = _field$configuration3.avoidFutureDates) === null || _field$configuration3 === void 0 ? void 0 : _field$configuration3.active) || false;
|
|
92
94
|
const {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} =
|
|
95
|
+
maxDate,
|
|
96
|
+
minDate
|
|
97
|
+
} = onlyPastMonth ? (0, _utils2.getPastMonthDates)() : avoidFutureDates ? (0, _utils2.getMaxDate)() : range || pickerProps || {};
|
|
96
98
|
const [pickedDate, setPickedDate] = (0, _react.useState)(null);
|
|
97
99
|
const [internalError, setInternalError] = (0, _react.useState)(null);
|
|
98
100
|
const handleChange = date => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
const finalDate = (0, _utils2.getFinalDate)({
|
|
102
|
+
date,
|
|
103
|
+
maxDate,
|
|
104
|
+
minDate
|
|
105
|
+
});
|
|
106
|
+
setPickedDate(finalDate);
|
|
107
|
+
const newValue = (0, _dayjs2.default)(finalDate, _constants.OUTPUT_LABEL_MASK, true);
|
|
108
|
+
if (newValue.isValid()) input.onChange(newValue.format(configMask));else input.onChange('');
|
|
107
109
|
};
|
|
108
110
|
(0, _react.useEffect)(() => {
|
|
109
111
|
if (!input.value && pickedDate !== null && pickedDate !== void 0 && pickedDate.isValid()) setPickedDate(null);else if ((0, _utils2.dateMatchesFormat)(input.value, configMask)) setPickedDate((0, _dayjs2.default)(input.value, configMask));
|
|
@@ -172,10 +174,11 @@ const UTDatePicker = _ref => {
|
|
|
172
174
|
PopoverProps: {
|
|
173
175
|
...(iconAnchor ? (0, _constants.iconAnchorProps)(operenerIconReference) : {}),
|
|
174
176
|
...popoverProps
|
|
175
|
-
}
|
|
177
|
+
}
|
|
178
|
+
}, pickerProps, {
|
|
176
179
|
minDate: minDate,
|
|
177
180
|
maxDate: maxDate
|
|
178
|
-
}
|
|
181
|
+
}))));
|
|
179
182
|
};
|
|
180
183
|
UTDatePicker.propTypes = {
|
|
181
184
|
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.isSelected = exports.getPastMonthDates = exports.getMaxDate = exports.getFinalDate = exports.dateMatchesFormat = void 0;
|
|
7
7
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const isSelected = (date, selectedDate) => selectedDate && date.isSame(selectedDate, 'day');
|
|
@@ -27,24 +27,15 @@ const getMaxDate = () => {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
exports.getMaxDate = getMaxDate;
|
|
30
|
-
const
|
|
31
|
-
const rangeValidation = (date, range) => {
|
|
32
|
-
const {
|
|
33
|
-
minDate,
|
|
34
|
-
maxDate
|
|
35
|
-
} = range;
|
|
36
|
-
return date.isBetween(minDate, maxDate, null, '[]');
|
|
37
|
-
};
|
|
38
|
-
const isValidDate = _ref => {
|
|
30
|
+
const getFinalDate = _ref => {
|
|
39
31
|
let {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
range
|
|
32
|
+
date,
|
|
33
|
+
maxDate,
|
|
34
|
+
minDate
|
|
44
35
|
} = _ref;
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
48
|
-
return
|
|
36
|
+
const formattedDate = (0, _dayjs.default)(date);
|
|
37
|
+
if (maxDate && formattedDate !== null && formattedDate !== void 0 && formattedDate.isAfter(maxDate)) return (0, _dayjs.default)(maxDate);
|
|
38
|
+
if (minDate && formattedDate !== null && formattedDate !== void 0 && formattedDate.isBefore(minDate)) return (0, _dayjs.default)(minDate);
|
|
39
|
+
return formattedDate;
|
|
49
40
|
};
|
|
50
|
-
exports.
|
|
41
|
+
exports.getFinalDate = getFinalDate;
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.SIZES = exports.MENU_LABEL = exports.ACCEPT_BUTTON_TEXT = void 0;
|
|
7
7
|
const SIZES = exports.SIZES = {
|
|
8
8
|
L: 'large',
|
|
9
|
-
M: 'medium'
|
|
9
|
+
M: 'medium',
|
|
10
|
+
S: 'small'
|
|
10
11
|
};
|
|
11
12
|
const ACCEPT_BUTTON_TEXT = exports.ACCEPT_BUTTON_TEXT = 'Aceptar';
|
|
12
13
|
const MENU_LABEL = exports.MENU_LABEL = 'Más';
|
|
@@ -36,6 +36,7 @@ const UTPanel = _ref => {
|
|
|
36
36
|
classNames,
|
|
37
37
|
closeButtonDataTestId = panel.closeButton,
|
|
38
38
|
collapsableHeader = false,
|
|
39
|
+
collapsablePanel = false,
|
|
39
40
|
currentStep = 1,
|
|
40
41
|
disableScrollbar = false,
|
|
41
42
|
HeaderComponent,
|
|
@@ -45,6 +46,7 @@ const UTPanel = _ref => {
|
|
|
45
46
|
hideCloseButton = false,
|
|
46
47
|
hideHeader = false,
|
|
47
48
|
hideMainButton = false,
|
|
49
|
+
inline = false,
|
|
48
50
|
isWorkflow = false,
|
|
49
51
|
mainActionDataTestId = panel.mainAction,
|
|
50
52
|
mainButton = {},
|
|
@@ -71,6 +73,8 @@ const UTPanel = _ref => {
|
|
|
71
73
|
const openMenu = event => setAnchor(event.currentTarget);
|
|
72
74
|
const closeMenu = () => setAnchor();
|
|
73
75
|
const secondaryActionAsMenu = (0, _isArray.default)(headerSecondaryActionButton);
|
|
76
|
+
const panelIsCollapsible = collapsablePanel && inline;
|
|
77
|
+
const panelIsCollapsed = panelIsCollapsible && !open;
|
|
74
78
|
const {
|
|
75
79
|
closeButton: closeButtonClass,
|
|
76
80
|
headerContainer: headerContainerClass,
|
|
@@ -81,38 +85,41 @@ const UTPanel = _ref => {
|
|
|
81
85
|
} = classes;
|
|
82
86
|
return /*#__PURE__*/_react.default.createElement(_SwipeableDrawer.default, _extends({
|
|
83
87
|
anchor: panelSide,
|
|
88
|
+
BackdropProps: {
|
|
89
|
+
...BackdropProps,
|
|
90
|
+
classes: {
|
|
91
|
+
root: drawerClasses.backdrop,
|
|
92
|
+
...(BackdropProps === null || BackdropProps === void 0 ? void 0 : BackdropProps.classes)
|
|
93
|
+
}
|
|
94
|
+
},
|
|
84
95
|
classes: {
|
|
85
96
|
...drawerClasses,
|
|
86
|
-
paper: "".concat(_stylesModule.default.paper, " ").concat(drawerClasses.paper, "
|
|
87
|
-
root: drawerClasses.root
|
|
97
|
+
paper: "\n ".concat(_stylesModule.default.paper, "\n ").concat(panelIsCollapsible && open && _stylesModule.default.collapsedPaper, "\n ").concat(drawerClasses.paper, "\n ").concat(_stylesModule.default[_constants.SIZES[size]], "\n "),
|
|
98
|
+
root: drawerClasses.root,
|
|
99
|
+
docked: "\n ".concat(_stylesModule.default[_constants.SIZES[size]], "\n ").concat(_stylesModule.default.docked, "\n ").concat(panelIsCollapsed && _stylesModule.default.collapsed, "\n ").concat(!open && !collapsablePanel && _stylesModule.default.closedPersistentPanel, "\n ")
|
|
88
100
|
},
|
|
101
|
+
disablePortal: inline,
|
|
89
102
|
disableSwipeToOpen: true,
|
|
90
103
|
ModalProps: {
|
|
91
104
|
...modalProps
|
|
92
105
|
},
|
|
93
106
|
onClose: onClose,
|
|
94
107
|
onOpen: onOpen,
|
|
95
|
-
open: open,
|
|
108
|
+
open: panelIsCollapsible || open,
|
|
96
109
|
swipeAreaWidth: 0,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
classes: {
|
|
100
|
-
root: drawerClasses.backdrop,
|
|
101
|
-
...(BackdropProps === null || BackdropProps === void 0 ? void 0 : BackdropProps.classes)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
+
variant: inline ? collapsablePanel ? 'permanent' : 'persistent' : 'temporary'
|
|
111
|
+
}, props), (!hideCloseButton || isWorkflow || panelIsCollapsible) && /*#__PURE__*/_react.default.createElement("div", {
|
|
105
112
|
className: _stylesModule.default.controlAreaContainer
|
|
106
113
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
107
114
|
className: _stylesModule.default.controlAreaBar
|
|
108
|
-
}, !hideCloseButton && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
115
|
+
}, (panelIsCollapsible || !hideCloseButton) && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
109
116
|
classNames: {
|
|
110
117
|
icon: iconCloseClass,
|
|
111
118
|
root: closeButtonClass
|
|
112
119
|
},
|
|
113
120
|
dataTestId: closeButtonDataTestId,
|
|
114
|
-
Icon:
|
|
115
|
-
onClick: onClose,
|
|
121
|
+
Icon: panelIsCollapsible ? 'IconLayoutSidebarRight' : 'IconX',
|
|
122
|
+
onClick: panelIsCollapsible && !open ? onOpen : onClose,
|
|
116
123
|
variant: "text"
|
|
117
124
|
})), isWorkflow && /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
118
125
|
classNames: {
|
|
@@ -121,7 +128,7 @@ const UTPanel = _ref => {
|
|
|
121
128
|
colorPrimary: classes.colorPrimary
|
|
122
129
|
},
|
|
123
130
|
value: currentStep * 100 / stepsCount
|
|
124
|
-
})), !hideHeader && /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
})), !hideHeader && !panelIsCollapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
125
132
|
className: "".concat(_stylesModule.default.headerContainer, " ").concat(headerContainerClass)
|
|
126
133
|
}, HeaderComponent || /*#__PURE__*/_react.default.createElement("div", {
|
|
127
134
|
className: _stylesModule.default.headerArea
|
|
@@ -162,10 +169,10 @@ const UTPanel = _ref => {
|
|
|
162
169
|
colorTheme: "success",
|
|
163
170
|
dataTestId: mainActionDataTestId,
|
|
164
171
|
variant: "filled"
|
|
165
|
-
}, headerMainActionButton), headerMainActionButton.text)))), !(0, _isEmpty.default)(headerItems) && /*#__PURE__*/_react.default.createElement("div", {
|
|
172
|
+
}, headerMainActionButton), headerMainActionButton.text)))), !(0, _isEmpty.default)(headerItems) && !panelIsCollapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
166
173
|
className: "".concat(_stylesModule.default.headerItemsContainer, " \n ").concat(collapseHeader ? _stylesModule.default.expandedContainer : _stylesModule.default.collapsedContainer, " \n ").concat(singleHeaderItemsColumn && _stylesModule.default.singleHeaderItemsColumn || '')
|
|
167
|
-
}, headerItems.map(_DataItem.default)), /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
className: "".concat(_stylesModule.default.bodyContainer, " ").concat(!hideMainButton && _stylesModule.default.bodyOffset, " ").concat(classes.bodyContainer)
|
|
174
|
+
}, headerItems.map(_DataItem.default)), !panelIsCollapsed && /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
className: "".concat(_stylesModule.default.bodyContainer, " ").concat(inline && _stylesModule.default.inlineBodyContainer, " ").concat(!hideMainButton && _stylesModule.default.bodyOffset, " ").concat(classes.bodyContainer)
|
|
169
176
|
}, disableScrollbar ? children : /*#__PURE__*/_react.default.createElement(_reactPerfectScrollbar.default, {
|
|
170
177
|
className: "".concat(_stylesModule.default.perfectScrollbar, " ").concat(perfectScrollbarClass),
|
|
171
178
|
onYReachEnd: onEndReachedCallback,
|
|
@@ -173,7 +180,7 @@ const UTPanel = _ref => {
|
|
|
173
180
|
suppressScrollX: true,
|
|
174
181
|
...perfectScrollbarOptions
|
|
175
182
|
}
|
|
176
|
-
}, children)), !hideMainButton && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
183
|
+
}, children)), !hideMainButton && !panelIsCollapsed && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
177
184
|
classNames: {
|
|
178
185
|
root: _stylesModule.default.mainButton
|
|
179
186
|
},
|
|
@@ -186,6 +193,7 @@ UTPanel.propTypes = {
|
|
|
186
193
|
classNames: _propTypes.object,
|
|
187
194
|
closeButtonDataTestId: _propTypes.string,
|
|
188
195
|
collapsableHeader: _propTypes.bool,
|
|
196
|
+
collapsablePanel: _propTypes.bool,
|
|
189
197
|
currentStep: _propTypes.number,
|
|
190
198
|
disableScrollbar: _propTypes.bool,
|
|
191
199
|
HeaderComponent: (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.elementType]),
|
|
@@ -209,6 +217,7 @@ UTPanel.propTypes = {
|
|
|
209
217
|
hideCloseButton: _propTypes.bool,
|
|
210
218
|
hideHeader: _propTypes.bool,
|
|
211
219
|
hideMainButton: _propTypes.bool,
|
|
220
|
+
inline: _propTypes.bool,
|
|
212
221
|
isWorkflow: _propTypes.bool,
|
|
213
222
|
mainActionDataTestId: _propTypes.string,
|
|
214
223
|
mainButton: _propTypes.object,
|
|
@@ -221,7 +230,7 @@ UTPanel.propTypes = {
|
|
|
221
230
|
perfectScrollbarOptions: _propTypes.object,
|
|
222
231
|
secondaryActionDataTestId: _propTypes.string,
|
|
223
232
|
singleHeaderItemsColumn: _propTypes.bool,
|
|
224
|
-
size: _propTypes.
|
|
233
|
+
size: (0, _propTypes.oneOf)(Object.keys(_constants.SIZES)),
|
|
225
234
|
stepsCount: _propTypes.number,
|
|
226
235
|
subtitle: _propTypes.string,
|
|
227
236
|
title: _propTypes.string,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
$large-panel-size: 600px;
|
|
2
2
|
$medium-panel-size: 450px;
|
|
3
|
+
$small-panel-size: 300px;
|
|
4
|
+
$collapsed-panel-size: 58px;
|
|
3
5
|
|
|
4
6
|
.paper {
|
|
5
7
|
display: flex;
|
|
6
8
|
height: 100%;
|
|
7
|
-
position: absolute;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.controlAreaBar {
|
|
@@ -77,6 +78,10 @@ $medium-panel-size: 450px;
|
|
|
77
78
|
margin-top: -16px;
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
.small {
|
|
82
|
+
width: $small-panel-size;
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
.large {
|
|
81
86
|
width: $large-panel-size;
|
|
82
87
|
}
|
|
@@ -115,3 +120,42 @@ $medium-panel-size: 450px;
|
|
|
115
120
|
position: fixed;
|
|
116
121
|
width: inherit;
|
|
117
122
|
}
|
|
123
|
+
|
|
124
|
+
.docked {
|
|
125
|
+
height: 100%;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
position: relative;
|
|
128
|
+
transition: width 0.3s ease;
|
|
129
|
+
|
|
130
|
+
.bodyContainer {
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.paper {
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
position: relative;
|
|
137
|
+
z-index: 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.mainButton {
|
|
141
|
+
position: sticky;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.closedPersistentPanel {
|
|
146
|
+
width: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.collapsed {
|
|
150
|
+
width: $collapsed-panel-size;
|
|
151
|
+
|
|
152
|
+
.small,
|
|
153
|
+
.medium,
|
|
154
|
+
.large {
|
|
155
|
+
width: $collapsed-panel-size;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.collapsedPaper {
|
|
160
|
+
transition: width 0.3s ease;
|
|
161
|
+
}
|