@widergy/energy-ui 3.129.1 → 3.130.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,15 @@
1
+ # [3.130.0](https://github.com/widergy/energy-ui/compare/v3.129.1...v3.130.0) (2026-01-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removes tests temporarily ([638f77d](https://github.com/widergy/energy-ui/commit/638f77dc7f21ecf16e18492c32afb3d1d47190f1))
7
+
8
+
9
+ ### Features
10
+
11
+ * [UGOVAES-1112] add observable field support to UTAttachmentList ([#742](https://github.com/widergy/energy-ui/issues/742)) ([0edc962](https://github.com/widergy/energy-ui/commit/0edc962dd27e4e7f95ad1e7a1347bc76ab6c27a9))
12
+
1
13
  ## [3.129.1](https://github.com/widergy/energy-ui/compare/v3.129.0...v3.129.1) (2026-01-14)
2
14
 
3
15
 
@@ -0,0 +1,11 @@
1
+ import { ArgTypes, Description, Meta, Title } from '@storybook/addon-docs';
2
+
3
+ import * as UTAttachmentListStories from './UTAttachmentList.stories';
4
+
5
+ <Meta of={UTAttachmentListStories} />
6
+
7
+ <Title>UTAttachmentList</Title>
8
+
9
+ <Description of={UTAttachmentListStories} />
10
+
11
+ <ArgTypes />
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Playground = void 0;
7
+ var _utils = require("stories/utils");
8
+ var _ = _interopRequireDefault(require("."));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ var _default = exports.default = {
11
+ args: {
12
+ acceptedFileTypes: 'image/*,.pdf',
13
+ disabled: false,
14
+ fieldTypes: ['image'],
15
+ input: {
16
+ value: null,
17
+ onChange: () => {}
18
+ },
19
+ maxFileSize: 5242880
20
+ },
21
+ argTypes: {
22
+ acceptedFileTypes: {
23
+ description: 'Tipos de archivo aceptados (MIME types).',
24
+ table: {
25
+ defaultValue: {
26
+ summary: 'image/*,.pdf'
27
+ },
28
+ type: {
29
+ summary: 'string'
30
+ }
31
+ }
32
+ },
33
+ actions: {
34
+ description: 'Array de acciones personalizadas (botones) para agregar al componente.',
35
+ table: {
36
+ defaultValue: {
37
+ summary: 'undefined'
38
+ },
39
+ type: {
40
+ summary: 'array'
41
+ }
42
+ }
43
+ },
44
+ allowedPDFUploadSizes: {
45
+ description: 'Array con las dimensiones permitidas para archivos PDF.',
46
+ table: {
47
+ defaultValue: {
48
+ summary: 'undefined'
49
+ },
50
+ type: {
51
+ summary: (0, _utils.joinArgTypes)(['{ name: string, heightInPt: number, widthInPt: number, tolerance: number }'])
52
+ }
53
+ }
54
+ },
55
+ classes: {
56
+ description: 'Clases personalizadas para los elementos del componente.',
57
+ table: {
58
+ defaultValue: {
59
+ summary: 'undefined'
60
+ },
61
+ type: {
62
+ summary: (0, _utils.joinArgTypes)(['container', 'previewContainer', 'filesIcon', 'errorContainer'])
63
+ }
64
+ }
65
+ },
66
+ containerClassname: {
67
+ description: 'Clase personalizada para el contenedor.',
68
+ table: {
69
+ defaultValue: {
70
+ summary: 'undefined'
71
+ },
72
+ type: {
73
+ summary: 'string'
74
+ }
75
+ }
76
+ },
77
+ customValidation: {
78
+ description: 'Función de validación personalizada para los archivos.',
79
+ table: {
80
+ defaultValue: {
81
+ summary: 'undefined'
82
+ },
83
+ type: {
84
+ summary: 'func'
85
+ }
86
+ }
87
+ },
88
+ dataTestId: {
89
+ description: 'ID de prueba para el input de archivo.',
90
+ table: {
91
+ defaultValue: {
92
+ summary: 'undefined'
93
+ },
94
+ type: {
95
+ summary: 'string'
96
+ }
97
+ }
98
+ },
99
+ deleteDataTestId: {
100
+ description: 'ID de prueba para el botón de eliminar archivo.',
101
+ table: {
102
+ defaultValue: {
103
+ summary: 'undefined'
104
+ },
105
+ type: {
106
+ summary: 'string'
107
+ }
108
+ }
109
+ },
110
+ disabled: {
111
+ control: 'boolean',
112
+ description: 'Si el componente está deshabilitado.',
113
+ table: {
114
+ defaultValue: {
115
+ summary: 'false'
116
+ },
117
+ type: {
118
+ summary: 'boolean'
119
+ }
120
+ }
121
+ },
122
+ disableResize: {
123
+ control: 'boolean',
124
+ description: 'Deshabilita el redimensionamiento automático de imágenes.',
125
+ table: {
126
+ defaultValue: {
127
+ summary: 'false'
128
+ },
129
+ type: {
130
+ summary: 'boolean'
131
+ }
132
+ }
133
+ },
134
+ errorClassname: {
135
+ description: 'Clase personalizada para los mensajes de error.',
136
+ table: {
137
+ defaultValue: {
138
+ summary: 'undefined'
139
+ },
140
+ type: {
141
+ summary: 'string'
142
+ }
143
+ }
144
+ },
145
+ field: {
146
+ description: 'Configuración del campo con propiedades como help_text, max_file_size, accepted_file_types y max_files.',
147
+ table: {
148
+ defaultValue: {
149
+ summary: 'undefined'
150
+ },
151
+ type: {
152
+ summary: 'object'
153
+ }
154
+ }
155
+ },
156
+ fieldTypes: {
157
+ description: 'Array con los tipos de campo permitidos.',
158
+ table: {
159
+ defaultValue: {
160
+ summary: '[]'
161
+ },
162
+ type: {
163
+ summary: 'array'
164
+ }
165
+ }
166
+ },
167
+ hideLabels: {
168
+ description: 'Oculta las etiquetas del componente.',
169
+ table: {
170
+ defaultValue: {
171
+ summary: 'undefined'
172
+ },
173
+ type: {
174
+ summary: 'string'
175
+ }
176
+ }
177
+ },
178
+ icon: {
179
+ description: 'Ícono personalizado para el componente.',
180
+ table: {
181
+ defaultValue: {
182
+ summary: 'undefined'
183
+ },
184
+ type: {
185
+ summary: 'ReactNode'
186
+ }
187
+ }
188
+ },
189
+ input: {
190
+ description: 'Objeto con value (archivos) y onChange (callback).',
191
+ table: {
192
+ defaultValue: {
193
+ summary: '{ value: null, onChange: () => {} }'
194
+ },
195
+ type: {
196
+ summary: '{ value: File | string | array, onChange: function }'
197
+ }
198
+ }
199
+ },
200
+ loadingTextClassname: {
201
+ description: 'Clase personalizada para el texto de carga.',
202
+ table: {
203
+ defaultValue: {
204
+ summary: 'undefined'
205
+ },
206
+ type: {
207
+ summary: 'string'
208
+ }
209
+ }
210
+ },
211
+ maxFileSize: {
212
+ control: 'number',
213
+ description: 'Tamaño máximo de archivo en bytes.',
214
+ table: {
215
+ defaultValue: {
216
+ summary: '99999999'
217
+ },
218
+ type: {
219
+ summary: 'number'
220
+ }
221
+ }
222
+ },
223
+ onLoaded: {
224
+ description: 'Callback que se ejecuta cuando los archivos se han cargado.',
225
+ table: {
226
+ defaultValue: {
227
+ summary: 'undefined'
228
+ },
229
+ type: {
230
+ summary: 'function'
231
+ }
232
+ }
233
+ },
234
+ previewDataTestId: {
235
+ description: 'ID de prueba para el contenedor de vista previa.',
236
+ table: {
237
+ defaultValue: {
238
+ summary: 'undefined'
239
+ },
240
+ type: {
241
+ summary: 'string'
242
+ }
243
+ }
244
+ },
245
+ resizeConfig: {
246
+ description: 'Configuración para el redimensionamiento de imágenes.',
247
+ table: {
248
+ defaultValue: {
249
+ summary: 'undefined'
250
+ },
251
+ type: {
252
+ summary: '{ type: string, maxWidth: number, maxHeight: number }'
253
+ }
254
+ }
255
+ },
256
+ sanitize: {
257
+ description: 'Función para sanitizar archivos antes de procesarlos.',
258
+ table: {
259
+ defaultValue: {
260
+ summary: 'undefined'
261
+ },
262
+ type: {
263
+ summary: 'function'
264
+ }
265
+ }
266
+ },
267
+ titleVariant: {
268
+ description: 'Variante de estilo para el título del componente.',
269
+ table: {
270
+ defaultValue: {
271
+ summary: 'undefined'
272
+ },
273
+ type: {
274
+ summary: 'string'
275
+ }
276
+ }
277
+ }
278
+ },
279
+ component: _.default,
280
+ parameters: {
281
+ controls: {
282
+ exclude: ['classes', 'customValidation', 'field', 'icon', 'input', 'onLoaded', 'resizeConfig', 'sanitize']
283
+ },
284
+ docs: {
285
+ description: {
286
+ component: 'Componente para la carga y gestión de archivos adjuntos. Soporta validación de formato, tamaño, y vista previa de imágenes, videos, audio y PDFs.'
287
+ }
288
+ }
289
+ },
290
+ title: 'Energy-UI/UTAttachmentList'
291
+ };
292
+ const Playground = exports.Playground = {
293
+ name: 'Playground'
294
+ };
@@ -10,6 +10,7 @@ var _validate = require("@widergy/web-utils/lib/validate");
10
10
  var _image = require("@widergy/web-utils/lib/image");
11
11
  var _browser = require("@widergy/web-utils/lib/browser");
12
12
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
13
+ var _buttonTypes = require("../../types/buttonTypes");
13
14
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
14
15
  var _theme = require("./theme");
15
16
  var _constants = require("./constants");
@@ -21,6 +22,7 @@ const AttachmentListContainer = _ref => {
21
22
  var _field$configuration, _field$configuration2, _field$configuration3, _field$configuration4, _input$value;
22
23
  let {
23
24
  acceptedFileTypes: defaultAcceptedFileTypes,
25
+ actions,
24
26
  allowedPDFUploadSizes,
25
27
  classes,
26
28
  containerClassname,
@@ -32,6 +34,7 @@ const AttachmentListContainer = _ref => {
32
34
  errorClassname,
33
35
  field,
34
36
  fieldTypes = [],
37
+ hideLabels,
35
38
  icon,
36
39
  input,
37
40
  loadingTextClassname,
@@ -39,7 +42,8 @@ const AttachmentListContainer = _ref => {
39
42
  onLoaded,
40
43
  previewDataTestId,
41
44
  resizeConfig,
42
- sanitize
45
+ sanitize,
46
+ titleVariant
43
47
  } = _ref;
44
48
  const helpText = field === null || field === void 0 || (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.help_text;
45
49
  const maxFileSize = (field === null || field === void 0 || (_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.max_file_size) || defaultMaxFileSize;
@@ -224,6 +228,7 @@ const AttachmentListContainer = _ref => {
224
228
  }
225
229
  }, [input]);
226
230
  return /*#__PURE__*/_react.default.createElement(_layout.default, {
231
+ actions: actions,
227
232
  acceptedFileTypes: acceptedFileTypes,
228
233
  classes: classes,
229
234
  containerClassname: containerClassname,
@@ -233,20 +238,24 @@ const AttachmentListContainer = _ref => {
233
238
  error: error,
234
239
  errorClassname: errorClassname,
235
240
  errorText: errorText,
241
+ field: field,
236
242
  fieldTypes: fieldTypes,
237
243
  fileInputRef: fileInputRef,
238
244
  helpText: helpText,
245
+ hideLabels: hideLabels,
239
246
  icon: icon,
240
247
  loadingTextClassname: loadingTextClassname,
241
248
  maxFiles: maxFiles,
242
249
  maxFileSize: (0, _utils.getSizeInMB)(maxFileSize),
243
250
  onChange: onChange,
244
251
  preview: preview,
245
- previewDataTestId: previewDataTestId
252
+ previewDataTestId: previewDataTestId,
253
+ titleVariant: titleVariant
246
254
  });
247
255
  };
248
256
  AttachmentListContainer.propTypes = {
249
257
  acceptedFileTypes: _propTypes.string,
258
+ actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
250
259
  allowedPDFUploadSizes: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
251
260
  name: _propTypes.string,
252
261
  heightInPt: _propTypes.number,
@@ -263,6 +272,7 @@ AttachmentListContainer.propTypes = {
263
272
  errorClassname: _propTypes.string,
264
273
  field: _propTypes.any,
265
274
  fieldTypes: (0, _propTypes.arrayOf)(_propTypes.string),
275
+ hideLabels: _propTypes.bool,
266
276
  icon: _propTypes.node,
267
277
  input: (0, _propTypes.shape)({
268
278
  value: (0, _propTypes.oneOfType)([_propTypes.string, (0, _propTypes.shape)({
@@ -279,6 +289,7 @@ AttachmentListContainer.propTypes = {
279
289
  maxWidth: _propTypes.number,
280
290
  maxHeight: _propTypes.number
281
291
  }),
282
- sanitize: _propTypes.func
292
+ sanitize: _propTypes.func,
293
+ titleVariant: _propTypes.string
283
294
  };
284
295
  var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(AttachmentListContainer);
@@ -9,9 +9,11 @@ var _propTypes = require("prop-types");
9
9
  var _files = require("@widergy/web-utils/lib/constants/files");
10
10
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
11
11
  var _downloadjs = _interopRequireDefault(require("downloadjs"));
12
+ var _buttonTypes = require("../../types/buttonTypes");
12
13
  var _UTLabel = _interopRequireDefault(require("../UTLabel"));
13
14
  var _UTButton = _interopRequireDefault(require("../UTButton"));
14
15
  var _UTIcon = _interopRequireDefault(require("../UTIcon"));
16
+ var _UTFieldLabel = _interopRequireDefault(require("../UTFieldLabel"));
15
17
  var _constants = require("./constants");
16
18
  var _Preview = _interopRequireDefault(require("./components/Preview"));
17
19
  var _utils = require("./utils");
@@ -20,7 +22,9 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
20
22
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
23
  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); }
22
24
  const AttachmentList = _ref => {
25
+ var _field$configuration;
23
26
  let {
27
+ actions,
24
28
  acceptedFileTypes,
25
29
  classes,
26
30
  dataTestId,
@@ -28,16 +32,20 @@ const AttachmentList = _ref => {
28
32
  disabled,
29
33
  error,
30
34
  errorText,
35
+ field,
31
36
  fieldTypes = [],
32
37
  fileInputRef,
33
38
  helpText,
39
+ hideLabels,
34
40
  maxFiles,
35
41
  maxFileSize,
36
42
  onChange,
37
43
  preview,
38
44
  previewDataTestId,
39
- RemoveIcon
45
+ RemoveIcon,
46
+ titleVariant
40
47
  } = _ref;
48
+ const shouldShowUpperTitle = ((field === null || field === void 0 || (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) || hideLabels) && (field === null || field === void 0 ? void 0 : field.title);
41
49
  const fieldType = acceptedFileTypes || fieldTypes.map(type => _files.inputFiles[type].inputType).join();
42
50
  const Icon = RemoveIcon || 'IconTrash';
43
51
  const previewIsEmpty = (0, _isEmpty.default)(preview);
@@ -51,7 +59,13 @@ const AttachmentList = _ref => {
51
59
  const closePreviewModal = () => setPreviewModalIsOpen(false);
52
60
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
53
61
  className: "".concat(_stylesModule.default.container, " ").concat(classes.container, " ").concat(error && classes.errorContainer)
54
- }, !previewIsEmpty && preview.map(previewItem => /*#__PURE__*/_react.default.createElement("div", {
62
+ }, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
63
+ actions: actions,
64
+ className: _stylesModule.default.title,
65
+ readOnly: field.read_only,
66
+ size: titleVariant,
67
+ required: field.required
68
+ }, field === null || field === void 0 ? void 0 : field.title), !previewIsEmpty && preview.map(previewItem => /*#__PURE__*/_react.default.createElement("div", {
55
69
  className: "".concat(_stylesModule.default.previewContainer, " ").concat(classes.previewContainer),
56
70
  "data-testid": previewDataTestId
57
71
  }, previewItem.type === _constants.PREVIEW_TYPES.LOADING ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
@@ -162,17 +176,20 @@ const AttachmentList = _ref => {
162
176
  };
163
177
  AttachmentList.propTypes = {
164
178
  acceptedFileTypes: _propTypes.string,
179
+ actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
165
180
  classes: (0, _propTypes.objectOf)(_propTypes.string),
166
181
  dataTestId: _propTypes.string,
167
182
  deleteDataTestId: _propTypes.string,
168
183
  disabled: _propTypes.bool,
169
184
  error: _propTypes.bool,
170
185
  errorText: _propTypes.string,
186
+ field: _propTypes.object,
171
187
  fieldTypes: (0, _propTypes.arrayOf)(_propTypes.string),
172
188
  fileInputRef: (0, _propTypes.objectOf)((0, _propTypes.shape)({
173
189
  current: (0, _propTypes.instanceOf)(Element)
174
190
  })),
175
191
  helpText: _propTypes.string,
192
+ hideLabels: _propTypes.bool,
176
193
  maxFileSize: _propTypes.number,
177
194
  maxFiles: _propTypes.number,
178
195
  onChange: _propTypes.func,
@@ -182,6 +199,7 @@ AttachmentList.propTypes = {
182
199
  })),
183
200
  previewDataTestId: _propTypes.string,
184
201
  previewProps: _constants.previewPropType,
185
- RemoveIcon: _propTypes.elementType
202
+ RemoveIcon: _propTypes.elementType,
203
+ titleVariant: _propTypes.string
186
204
  };
187
205
  var _default = exports.default = AttachmentList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.129.1",
3
+ "version": "3.130.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",