@widergy/energy-ui 3.156.0 → 3.157.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 +17 -2
- package/dist/components/UTAttachmentList/UTAttachmentList.stories.js +29 -1
- package/dist/components/UTAttachmentList/index.js +3 -0
- package/dist/components/UTAttachmentList/layout.js +8 -6
- package/dist/components/UTAttachmentList/theme.js +4 -1
- package/dist/components/UTAttachmentList/utils.js +10 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
# [3.
|
|
1
|
+
# [3.157.0](https://github.com/widergy/energy-ui/compare/v3.156.0...v3.157.0) (2026-05-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* lint ([17b0e7a](https://github.com/widergy/energy-ui/commit/17b0e7a040c4ebe7502e090cbc5de07ddfd173d0))
|
|
2
7
|
|
|
3
8
|
|
|
4
9
|
### Features
|
|
5
10
|
|
|
6
|
-
*
|
|
11
|
+
* add readonly ([fc534cd](https://github.com/widergy/energy-ui/commit/fc534cde072457bbeae7279e50508e196a84c6f2))
|
|
12
|
+
|
|
13
|
+
# [3.156.0](https://github.com/widergy/energy-ui/compare/v3.155.0...v3.156.0) (2026-05-14)
|
|
14
|
+
|
|
15
|
+
### Novedades y Mejoras
|
|
16
|
+
|
|
17
|
+
* Se incorporó un nuevo selector de fechas con diseño renovado, manteniendo toda la funcionalidad disponible previamente. [#792](https://github.com/widergy/Energy-UI/pull/792) [AXCH-1404](https://widergy.atlassian.net/browse/AXCH-1404)
|
|
18
|
+
|
|
19
|
+
### Correcciones
|
|
20
|
+
|
|
21
|
+
* Mejoras internas de la plataforma. [`1487639`](https://github.com/widergy/Energy-UI/commit/1487639) [`99e3c95`](https://github.com/widergy/Energy-UI/commit/99e3c95)
|
|
7
22
|
|
|
8
23
|
# [3.155.0](https://github.com/widergy/energy-ui/compare/v3.154.0...v3.155.0) (2026-05-13)
|
|
9
24
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.Playground = void 0;
|
|
6
|
+
exports.default = exports.ReadOnly = exports.Playground = void 0;
|
|
7
7
|
var _utils = require("stories/utils");
|
|
8
8
|
var _ = _interopRequireDefault(require("."));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -119,6 +119,18 @@ var _default = exports.default = {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
|
+
readOnly: {
|
|
123
|
+
control: 'boolean',
|
|
124
|
+
description: 'Modo solo lectura. Oculta el área de carga y el ícono de eliminar. Muestra los archivos con preview y botón de descarga.',
|
|
125
|
+
table: {
|
|
126
|
+
defaultValue: {
|
|
127
|
+
summary: 'false'
|
|
128
|
+
},
|
|
129
|
+
type: {
|
|
130
|
+
summary: 'boolean'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
122
134
|
disableResize: {
|
|
123
135
|
control: 'boolean',
|
|
124
136
|
description: 'Deshabilita el redimensionamiento automático de imágenes.',
|
|
@@ -291,4 +303,20 @@ var _default = exports.default = {
|
|
|
291
303
|
};
|
|
292
304
|
const Playground = exports.Playground = {
|
|
293
305
|
name: 'Playground'
|
|
306
|
+
};
|
|
307
|
+
const ReadOnly = exports.ReadOnly = {
|
|
308
|
+
args: {
|
|
309
|
+
readOnly: true,
|
|
310
|
+
input: {
|
|
311
|
+
value: [{
|
|
312
|
+
url: 'https://picsum.photos/seed/energy/200/200',
|
|
313
|
+
name: 'imagen-ejemplo.jpg'
|
|
314
|
+
}, {
|
|
315
|
+
url: 'https://invalid-url-to-test-error.example/doc.pdf',
|
|
316
|
+
name: 'documento-error.pdf'
|
|
317
|
+
}],
|
|
318
|
+
onChange: () => {}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
name: 'ReadOnly'
|
|
294
322
|
};
|
|
@@ -41,6 +41,7 @@ const AttachmentListContainer = _ref => {
|
|
|
41
41
|
maxFileSize: defaultMaxFileSize = 99999999,
|
|
42
42
|
onLoaded,
|
|
43
43
|
previewDataTestId,
|
|
44
|
+
readOnly = false,
|
|
44
45
|
resizeConfig,
|
|
45
46
|
sanitize,
|
|
46
47
|
titleVariant
|
|
@@ -252,6 +253,7 @@ const AttachmentListContainer = _ref => {
|
|
|
252
253
|
onChange: onChange,
|
|
253
254
|
preview: preview,
|
|
254
255
|
previewDataTestId: previewDataTestId,
|
|
256
|
+
readOnly: readOnly,
|
|
255
257
|
titleVariant: titleVariant
|
|
256
258
|
});
|
|
257
259
|
};
|
|
@@ -286,6 +288,7 @@ AttachmentListContainer.propTypes = {
|
|
|
286
288
|
maxFileSize: _propTypes.number,
|
|
287
289
|
onLoaded: _propTypes.func,
|
|
288
290
|
previewDataTestId: _propTypes.string,
|
|
291
|
+
readOnly: _propTypes.bool,
|
|
289
292
|
resizeConfig: (0, _propTypes.shape)({
|
|
290
293
|
type: _propTypes.string,
|
|
291
294
|
maxWidth: _propTypes.number,
|
|
@@ -42,6 +42,7 @@ const AttachmentList = _ref => {
|
|
|
42
42
|
onChange,
|
|
43
43
|
preview,
|
|
44
44
|
previewDataTestId,
|
|
45
|
+
readOnly,
|
|
45
46
|
RemoveIcon,
|
|
46
47
|
titleVariant
|
|
47
48
|
} = _ref;
|
|
@@ -65,7 +66,7 @@ const AttachmentList = _ref => {
|
|
|
65
66
|
size: titleVariant,
|
|
66
67
|
required: field.required
|
|
67
68
|
}, field === null || field === void 0 ? void 0 : field.title)), /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
-
className: "".concat(_stylesModule.default.container, " ").concat(classes.container, " ").concat(error && classes.errorContainer)
|
|
69
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classes.container, " ").concat(error && classes.errorContainer, " ").concat(readOnly && classes.readOnlyContainer)
|
|
69
70
|
}, !previewIsEmpty && preview.map(previewItem => /*#__PURE__*/_react.default.createElement("div", {
|
|
70
71
|
className: "".concat(_stylesModule.default.previewContainer, " ").concat(classes.previewContainer),
|
|
71
72
|
"data-testid": previewDataTestId
|
|
@@ -112,24 +113,24 @@ const AttachmentList = _ref => {
|
|
|
112
113
|
},
|
|
113
114
|
size: "small",
|
|
114
115
|
variant: "text"
|
|
115
|
-
}), (0, _utils.isDownloadable)(previewItem) && previewItem.src && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
116
|
+
}), ((0, _utils.isDownloadable)(previewItem) || readOnly && (0, _utils.isImage)(previewItem)) && previewItem.src && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
116
117
|
Icon: "IconDownload",
|
|
117
118
|
onClick: () => (0, _downloadjs.default)(previewItem.src, previewItem.name, previewItem.type),
|
|
118
119
|
size: "small",
|
|
119
120
|
variant: "text"
|
|
120
|
-
}), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
121
|
+
}), !readOnly && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
121
122
|
dataTestId: deleteDataTestId,
|
|
122
123
|
disabled: disabled,
|
|
123
124
|
Icon: Icon,
|
|
124
125
|
onClick: previewItem.onClick,
|
|
125
126
|
size: "small",
|
|
126
127
|
variant: "text"
|
|
127
|
-
})))), previewIsEmpty && /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
|
|
128
|
+
})))), !readOnly && previewIsEmpty && /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
|
|
128
129
|
name: "IconCloudUpload",
|
|
129
130
|
className: "".concat(_stylesModule.default.filesIcon, " ").concat(classes.filesIcon),
|
|
130
131
|
colorTheme: "accent",
|
|
131
132
|
size: _constants.ICON_SIZE
|
|
132
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
133
|
+
}), !readOnly && /*#__PURE__*/_react.default.createElement("div", {
|
|
133
134
|
className: "".concat(_stylesModule.default.labelAndInputContainer, " ").concat(!previewIsEmpty && _stylesModule.default.positionRelative)
|
|
134
135
|
}, previewIsEmpty && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
135
136
|
colorTheme: "accent"
|
|
@@ -150,7 +151,7 @@ const AttachmentList = _ref => {
|
|
|
150
151
|
onChange: onChange,
|
|
151
152
|
disabled: disabled,
|
|
152
153
|
multiple: true
|
|
153
|
-
})), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
154
|
+
})), !readOnly && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
154
155
|
colorTheme: "gray",
|
|
155
156
|
variant: "small",
|
|
156
157
|
className: _stylesModule.default.aclaration
|
|
@@ -200,6 +201,7 @@ AttachmentList.propTypes = {
|
|
|
200
201
|
})),
|
|
201
202
|
previewDataTestId: _propTypes.string,
|
|
202
203
|
previewProps: _constants.previewPropType,
|
|
204
|
+
readOnly: _propTypes.bool,
|
|
203
205
|
RemoveIcon: _propTypes.elementType,
|
|
204
206
|
titleVariant: _propTypes.string
|
|
205
207
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.retrieveStyle = void 0;
|
|
7
7
|
const retrieveStyle = _ref => {
|
|
8
|
-
var _theme$Palette, _theme$Palette2, _theme$Palette3, _theme$Palette4;
|
|
8
|
+
var _theme$Palette, _theme$Palette2, _theme$Palette3, _theme$Palette4, _theme$Palette5;
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
@@ -19,6 +19,9 @@ const retrieveStyle = _ref => {
|
|
|
19
19
|
},
|
|
20
20
|
previewContainer: {
|
|
21
21
|
backgroundColor: (_theme$Palette4 = theme.Palette) === null || _theme$Palette4 === void 0 ? void 0 : _theme$Palette4.light['01']
|
|
22
|
+
},
|
|
23
|
+
readOnlyContainer: {
|
|
24
|
+
border: "1px solid ".concat((_theme$Palette5 = theme.Palette) === null || _theme$Palette5 === void 0 ? void 0 : _theme$Palette5.light['04'])
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
27
|
};
|
|
@@ -14,7 +14,16 @@ const getImage = async imageUrl => fetch(imageUrl, {
|
|
|
14
14
|
const getBlobFromUrl = async (imageUrl, callback) => {
|
|
15
15
|
if (!imageUrl || !callback) return false;
|
|
16
16
|
const response = await getImage(imageUrl);
|
|
17
|
-
if (response !== null && response !== void 0 && response.ok)
|
|
17
|
+
if (response !== null && response !== void 0 && response.ok) {
|
|
18
|
+
try {
|
|
19
|
+
const blob = await response.blob();
|
|
20
|
+
callback(blob);
|
|
21
|
+
} catch {
|
|
22
|
+
callback(null);
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
callback(null);
|
|
26
|
+
}
|
|
18
27
|
};
|
|
19
28
|
exports.getBlobFromUrl = getBlobFromUrl;
|
|
20
29
|
const lengthMatches = (length1, length2, toleranceInPercentage) => {
|