@widergy/energy-ui 3.172.2 → 3.173.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +20 -6
  2. package/dist/components/UTDataCategory/README.md +3 -1
  3. package/dist/components/UTDataCategory/UTDataCategory.stories.js +405 -0
  4. package/dist/components/UTDataCategory/components/MainAction/index.js +47 -0
  5. package/dist/components/UTDataCategory/constants.js +6 -2
  6. package/dist/components/UTDataCategory/index.js +46 -16
  7. package/dist/components/UTDataCategory/styles.module.scss +11 -0
  8. package/dist/components/UTDataElement/README.md +15 -2
  9. package/dist/components/UTDataElement/UTDataElement.stories.js +29 -1
  10. package/dist/components/UTDataElement/index.js +96 -49
  11. package/dist/components/UTDataElement/styles.module.scss +5 -0
  12. package/dist/components/UTDataElement/theme.js +11 -9
  13. package/dist/components/UTRadioGroup/UTRadioGroup.stories.js +124 -4
  14. package/dist/components/UTRadioGroup/versions/V1/components/Radio/index.js +12 -6
  15. package/dist/components/UTRadioGroup/versions/V1/constants.js +1 -0
  16. package/dist/components/UTRadioGroup/versions/V1/index.js +23 -7
  17. package/dist/components/UTRadioGroup/versions/V1/styles.module.scss +5 -0
  18. package/dist/components/UTRadioGroup/versions/V1/utils.js +40 -0
  19. package/dist/constants/Palette.js +18 -2
  20. package/dist/esm/components/UTDataCategory/README.md +3 -1
  21. package/dist/esm/components/UTDataCategory/UTDataCategory.stories.js +400 -0
  22. package/dist/esm/components/UTDataCategory/components/MainAction/index.js +40 -0
  23. package/dist/esm/components/UTDataCategory/constants.js +5 -1
  24. package/dist/esm/components/UTDataCategory/index.js +48 -18
  25. package/dist/esm/components/UTDataCategory/styles.module.scss +11 -0
  26. package/dist/esm/components/UTDataElement/README.md +15 -2
  27. package/dist/esm/components/UTDataElement/UTDataElement.stories.js +28 -0
  28. package/dist/esm/components/UTDataElement/index.js +98 -51
  29. package/dist/esm/components/UTDataElement/styles.module.scss +5 -0
  30. package/dist/esm/components/UTDataElement/theme.js +12 -10
  31. package/dist/esm/components/UTRadioGroup/UTRadioGroup.stories.js +123 -3
  32. package/dist/esm/components/UTRadioGroup/versions/V1/components/Radio/index.js +12 -6
  33. package/dist/esm/components/UTRadioGroup/versions/V1/constants.js +1 -0
  34. package/dist/esm/components/UTRadioGroup/versions/V1/index.js +25 -9
  35. package/dist/esm/components/UTRadioGroup/versions/V1/styles.module.scss +5 -0
  36. package/dist/esm/components/UTRadioGroup/versions/V1/utils.js +34 -0
  37. package/dist/esm/constants/Palette.js +17 -1
  38. package/dist/esm/utils/colorUtils.js +15 -0
  39. package/dist/esm/utils/hooks/useCSSVariables/constants.js +1 -0
  40. package/dist/utils/colorUtils.js +16 -1
  41. package/dist/utils/hooks/useCSSVariables/constants.js +1 -0
  42. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,16 +1,30 @@
1
- ## [3.172.2](https://github.com/widergy/energy-ui/compare/v3.172.1...v3.172.2) (2026-07-03)
1
+ # [3.173.0](https://github.com/widergy/energy-ui/compare/v3.172.3...v3.173.0) (2026-07-06)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * [PQRR-146] UTStatusMessage icon size and color adjustments ([#833](https://github.com/widergy/energy-ui/issues/833)) ([9ecabd1](https://github.com/widergy/energy-ui/commit/9ecabd142a86540f35a10f1fdc1435b27bcc5e13))
6
+ * [CX-2739] datacategory - dataelement - radiogroup ([#832](https://github.com/widergy/energy-ui/issues/832)) ([8cb7619](https://github.com/widergy/energy-ui/commit/8cb7619983d17b1c39b7347aa8b3ed25e3cb0c81))
7
7
 
8
- ## [3.172.1](https://github.com/widergy/energy-ui/compare/v3.172.0...v3.172.1) (2026-07-03)
8
+ ## [3.172.3](https://github.com/widergy/energy-ui/compare/v3.172.2...v3.172.3) (2026-07-03)
9
9
 
10
+ ### Novedades y Mejoras
10
11
 
11
- ### Bug Fixes
12
+ * Mejoras internas de la plataforma. [#834](https://github.com/widergy/Energy-UI/pull/834) [DEV-9999](https://widergy.atlassian.net/browse/DEV-9999)
13
+
14
+ ## [3.172.2](https://github.com/widergy/energy-ui/compare/v3.172.1...v3.172.2) (2026-07-03)
15
+
16
+ ### Correcciones
17
+
18
+ * Se ajustó la apariencia de los mensajes de estado: el ícono ahora tiene un tamaño uniforme y proporcional, el espaciado interno es más compacto y los colores de fondo de los estados informativos, exitosos y de advertencia lucen con mayor contraste y consistencia visual. [#833](https://github.com/widergy/Energy-UI/pull/833) [PQRR-146](https://widergy.atlassian.net/browse/PQRR-146)
19
+
20
+ ## [3.172.1](https://github.com/widergy/energy-ui/compare/v3.172.0...v3.172.1) (2026-07-03)
21
+
22
+ ### Correcciones
12
23
 
13
- * [DIS-1108] ajustes utbutton ([#824](https://github.com/widergy/energy-ui/issues/824)) ([46b1ef8](https://github.com/widergy/energy-ui/commit/46b1ef8e07217bd75451b962236f98790c544f4b))
24
+ * Se ajustaron las opciones de tamaño de los botones, permitiendo que ocupen el ancho o alto disponible según el contexto. [#824](https://github.com/widergy/Energy-UI/pull/824) [DIS-1108](https://widergy.atlassian.net/browse/DIS-1108)
25
+ * Se unificó el comportamiento visual de los íconos dentro de los botones para lograr mayor consistencia en la interfaz. [#824](https://github.com/widergy/Energy-UI/pull/824) [DIS-1108](https://widergy.atlassian.net/browse/DIS-1108)
26
+ * Se normalizó el comportamiento de varios componentes de formulario e indicadores, mejorando la consistencia visual y de interacción en toda la plataforma. [#824](https://github.com/widergy/Energy-UI/pull/824) [DIS-1108](https://widergy.atlassian.net/browse/DIS-1108)
27
+ * Mejoras internas de la plataforma. [`e53dc85`](https://github.com/widergy/Energy-UI/commit/e53dc85)
14
28
 
15
29
  # [3.172.0](https://github.com/widergy/energy-ui/compare/v3.171.3...v3.172.0) (2026-07-02)
16
30
 
@@ -12,6 +12,8 @@ A collapsible container component that displays a list of data elements with an
12
12
  | classNames | object | | Custom CSS class names for styling the component. |
13
13
  | collapsable | bool | `true` | Specifies if the data list is collapsible. |
14
14
  | dataTestId | string | | Test ID for testing purposes. |
15
+ | description | string | | Description text displayed below the title. |
16
+ | descriptionProps | object | | Additional props for customizing the description UTLabel component. |
15
17
  | elements | array | `[]` | Array of objects to be rendered as UTDataElement components. |
16
18
  | elementsProps | object | `{}` | Additional props that apply to all UTDataElement components. |
17
19
  | expanded | bool | `false` | Controls the initial expanded state of the component. |
@@ -21,7 +23,7 @@ A collapsible container component that displays a list of data elements with an
21
23
 
22
24
  ## Behavior
23
25
 
24
- - **Collapsible**: The component is only collapsible if it has a `title` and `collapsable` is `true`
26
+ - **Collapsible**: The component is only collapsible if it has a `title` and `collapsable` is `true`. Clicking anywhere on the header (title, description) toggles it; the chevron next to the title is only a visual indicator. Clicks on `action` don't affect the toggle.
25
27
  - **Initial State**: The component starts collapsed by default unless `expanded` is `true`
26
28
  - **Area Styling**: When `area` is `true`, the component gets background color and padding
27
29
  - **Smooth Transitions**: Collapse/expand animations use CSS transitions for smooth UX
@@ -0,0 +1,405 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.WithSwitchAction = exports.WithHeaderAction = exports.WithDescription = exports.WithButtonAction = exports.Playground = exports.NonCollapsable = exports.ExpandedByDefault = exports.Default = exports.CustomDataTestId = exports.CollapsableWithActions = exports.AreaModeCustomProps = exports.AreaMode = void 0;
7
+ var _constants = require("./constants");
8
+ var _ = _interopRequireDefault(require("."));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /* eslint-disable no-alert */
11
+
12
+ // Mock data for examples
13
+ const mockElements = [{
14
+ title: 'Plan Mensual',
15
+ Data: '$4.999',
16
+ Icon: 'IconCreditCard',
17
+ badge: 'Activo'
18
+ }, {
19
+ title: 'Almacenamiento',
20
+ Data: '50GB disponibles',
21
+ Icon: 'IconCloud'
22
+ }, {
23
+ title: 'Soporte Prioritario',
24
+ Data: 'Atención 24/7',
25
+ Icon: 'IconHeadset'
26
+ }];
27
+ const mockElementsWithActions = [{
28
+ title: 'Streaming Plus',
29
+ Data: 'Plan mensual',
30
+ Icon: 'IconDeviceTv',
31
+ badge: 'Activo',
32
+ action: {
33
+ type: _constants.ACTION_TYPE.SWITCH,
34
+ checked: true,
35
+ onChange: checked => alert("Streaming Plus ".concat(checked ? 'activado' : 'desactivado'))
36
+ }
37
+ }, {
38
+ title: 'Almacenamiento en la Nube',
39
+ Data: '50GB disponibles',
40
+ Icon: 'IconCloud',
41
+ action: {
42
+ type: _constants.ACTION_TYPE.BUTTON,
43
+ text: 'Editar',
44
+ variant: 'text',
45
+ onClick: () => alert('Editar plan de almacenamiento')
46
+ }
47
+ }, {
48
+ title: 'Soporte Premium',
49
+ Data: 'Atención prioritaria 24/7',
50
+ Icon: 'IconHeadset',
51
+ action: {
52
+ type: _constants.ACTION_TYPE.SWITCH,
53
+ checked: false,
54
+ onChange: checked => alert("Soporte Premium ".concat(checked ? 'activado' : 'desactivado'))
55
+ }
56
+ }];
57
+ var _default = exports.default = {
58
+ args: {
59
+ title: 'Categoría de Datos',
60
+ elements: mockElements,
61
+ collapsable: true,
62
+ expanded: false
63
+ },
64
+ argTypes: {
65
+ title: {
66
+ control: 'text',
67
+ description: 'Título que se muestra en el encabezado de la categoría.',
68
+ table: {
69
+ defaultValue: {
70
+ summary: 'undefined'
71
+ },
72
+ type: {
73
+ summary: 'string'
74
+ }
75
+ }
76
+ },
77
+ description: {
78
+ control: 'text',
79
+ description: 'Descripción que se muestra debajo del título.',
80
+ table: {
81
+ defaultValue: {
82
+ summary: 'undefined'
83
+ },
84
+ type: {
85
+ summary: 'string'
86
+ }
87
+ }
88
+ },
89
+ descriptionProps: {
90
+ control: false,
91
+ description: 'Props adicionales para el UTLabel de la descripción.',
92
+ table: {
93
+ defaultValue: {
94
+ summary: '{}'
95
+ },
96
+ type: {
97
+ summary: 'object'
98
+ }
99
+ }
100
+ },
101
+ Icon: {
102
+ control: 'text',
103
+ description: 'Icono que se muestra al inicio del título. Nombre de icono de UTIcon.',
104
+ table: {
105
+ defaultValue: {
106
+ summary: 'undefined'
107
+ },
108
+ type: {
109
+ summary: 'string'
110
+ }
111
+ }
112
+ },
113
+ iconProps: {
114
+ control: false,
115
+ description: 'Props adicionales para el icono del título.',
116
+ table: {
117
+ defaultValue: {
118
+ summary: 'undefined'
119
+ },
120
+ type: {
121
+ summary: 'object'
122
+ }
123
+ }
124
+ },
125
+ collapsable: {
126
+ control: 'boolean',
127
+ description: 'Determina si la categoría es colapsable. Al hacer clic en el encabezado (título, descripción) se expande/colapsa; el chevron junto al título es solo un indicador visual.',
128
+ table: {
129
+ defaultValue: {
130
+ summary: 'true'
131
+ },
132
+ type: {
133
+ summary: 'boolean'
134
+ }
135
+ }
136
+ },
137
+ expanded: {
138
+ control: 'boolean',
139
+ description: 'Controla el estado inicial expandido del componente.',
140
+ table: {
141
+ defaultValue: {
142
+ summary: 'false'
143
+ },
144
+ type: {
145
+ summary: 'boolean'
146
+ }
147
+ }
148
+ },
149
+ action: {
150
+ control: false,
151
+ description: 'Configuración de la acción principal del encabezado (botón o switch). No dispara el colapso al hacer clic.',
152
+ table: {
153
+ defaultValue: {
154
+ summary: 'undefined'
155
+ },
156
+ type: {
157
+ summary: 'object'
158
+ }
159
+ }
160
+ },
161
+ elements: {
162
+ control: false,
163
+ description: 'Array de objetos que se renderizan como componentes UTDataElement.',
164
+ table: {
165
+ defaultValue: {
166
+ summary: '[]'
167
+ },
168
+ type: {
169
+ summary: 'array'
170
+ }
171
+ }
172
+ },
173
+ elementsProps: {
174
+ control: false,
175
+ description: 'Props adicionales aplicadas a todos los UTDataElement renderizados.',
176
+ table: {
177
+ defaultValue: {
178
+ summary: '{}'
179
+ },
180
+ type: {
181
+ summary: 'object'
182
+ }
183
+ }
184
+ },
185
+ area: {
186
+ control: 'boolean',
187
+ description: 'Cuando es true, aplica color de fondo y padding para dar apariencia de área.',
188
+ table: {
189
+ defaultValue: {
190
+ summary: 'false'
191
+ },
192
+ type: {
193
+ summary: 'boolean'
194
+ }
195
+ }
196
+ },
197
+ areaProps: {
198
+ control: false,
199
+ description: "Personaliza el fondo del área. Acepta `colorTheme` (cualquier valor de COLOR_THEMES) y `shade` ('01'–'05'). Solo aplica cuando `area` es `true`.",
200
+ table: {
201
+ defaultValue: {
202
+ summary: '{}'
203
+ },
204
+ type: {
205
+ summary: 'object'
206
+ }
207
+ }
208
+ },
209
+ dataTestId: {
210
+ control: 'text',
211
+ description: 'ID de test para pruebas automatizadas.',
212
+ table: {
213
+ defaultValue: {
214
+ summary: 'undefined'
215
+ },
216
+ type: {
217
+ summary: 'string'
218
+ }
219
+ }
220
+ },
221
+ titleProps: {
222
+ control: false,
223
+ description: 'Props adicionales para el UTLabel del título.',
224
+ table: {
225
+ defaultValue: {
226
+ summary: 'undefined'
227
+ },
228
+ type: {
229
+ summary: 'object'
230
+ }
231
+ }
232
+ },
233
+ classes: {
234
+ control: false,
235
+ description: 'Clases de tema para estilos.',
236
+ table: {
237
+ defaultValue: {
238
+ summary: 'undefined'
239
+ },
240
+ type: {
241
+ summary: 'object'
242
+ }
243
+ }
244
+ },
245
+ classNames: {
246
+ control: false,
247
+ description: 'Clases CSS personalizadas para diferentes elementos.',
248
+ table: {
249
+ defaultValue: {
250
+ summary: 'undefined'
251
+ },
252
+ type: {
253
+ summary: 'object'
254
+ }
255
+ }
256
+ }
257
+ },
258
+ component: _.default,
259
+ parameters: {
260
+ controls: {
261
+ exclude: []
262
+ },
263
+ docs: {
264
+ description: {
265
+ component: 'Contenedor colapsable que agrupa una lista de UTDataElement bajo un título y descripción opcionales.'
266
+ }
267
+ }
268
+ },
269
+ title: 'Energy-UI/UTDataCategory'
270
+ }; // Basic Stories
271
+ const Default = exports.Default = {
272
+ args: {
273
+ title: 'Información de la Cuenta',
274
+ elements: mockElements
275
+ },
276
+ name: 'Básico'
277
+ };
278
+ const WithDescription = exports.WithDescription = {
279
+ args: {
280
+ title: 'Información de la Cuenta',
281
+ description: 'Datos generales asociados a tu cuenta actual.',
282
+ Icon: 'IconUser',
283
+ elements: mockElements
284
+ },
285
+ name: 'Con Descripción'
286
+ };
287
+ const NonCollapsable = exports.NonCollapsable = {
288
+ args: {
289
+ title: 'Resumen Fijo',
290
+ description: 'Esta categoría siempre está expandida.',
291
+ collapsable: false,
292
+ elements: mockElements
293
+ },
294
+ name: 'No Colapsable'
295
+ };
296
+ const ExpandedByDefault = exports.ExpandedByDefault = {
297
+ args: {
298
+ title: 'Categoría Expandida',
299
+ elements: mockElements,
300
+ expanded: true
301
+ },
302
+ name: 'Expandida por Defecto'
303
+ };
304
+ const WithHeaderAction = exports.WithHeaderAction = {
305
+ args: {
306
+ title: 'Métodos de Pago',
307
+ description: 'Administrá los métodos de pago asociados a tu cuenta.',
308
+ Icon: 'IconWallet',
309
+ action: {
310
+ type: _constants.ACTION_TYPE.BUTTON,
311
+ text: 'Agregar',
312
+ variant: 'text',
313
+ onClick: () => alert('Agregar nuevo método de pago')
314
+ },
315
+ elements: mockElements
316
+ },
317
+ name: 'Con Acción en el Encabezado'
318
+ };
319
+ const WithButtonAction = exports.WithButtonAction = {
320
+ args: {
321
+ title: 'Datos de Facturación',
322
+ description: 'Información asociada a tu método de pago activo.',
323
+ Icon: 'IconCreditCard',
324
+ action: {
325
+ type: _constants.ACTION_TYPE.BUTTON,
326
+ text: 'Editar',
327
+ variant: 'text',
328
+ onClick: () => alert('Editar datos de facturación')
329
+ },
330
+ elements: mockElements
331
+ },
332
+ name: 'Con Acción Botón'
333
+ };
334
+ const WithSwitchAction = exports.WithSwitchAction = {
335
+ args: {
336
+ title: 'Notificaciones Push',
337
+ description: 'Activá o desactivá las notificaciones de tu cuenta.',
338
+ Icon: 'IconBell',
339
+ action: {
340
+ type: _constants.ACTION_TYPE.SWITCH,
341
+ checked: true,
342
+ onChange: checked => alert("Switch ".concat(checked ? 'activado' : 'desactivado'))
343
+ },
344
+ elements: mockElements
345
+ },
346
+ name: 'Con Acción Switch'
347
+ };
348
+ const CollapsableWithActions = exports.CollapsableWithActions = {
349
+ args: {
350
+ title: 'Suscripciones Activas',
351
+ description: 'Gestioná los servicios a los que estás suscripto.',
352
+ Icon: 'IconApps',
353
+ collapsable: true,
354
+ action: {
355
+ type: _constants.ACTION_TYPE.BUTTON,
356
+ text: 'Agregar',
357
+ variant: 'text',
358
+ onClick: () => alert('Agregar nueva suscripción')
359
+ },
360
+ elements: mockElementsWithActions
361
+ },
362
+ name: 'Colapsable con Acciones (Encabezado y Elementos)'
363
+ };
364
+ const AreaMode = exports.AreaMode = {
365
+ args: {
366
+ title: 'Categoría con Área',
367
+ description: 'Esta categoría tiene un fondo destacado.',
368
+ area: true,
369
+ elements: mockElements
370
+ },
371
+ name: 'Modo Área'
372
+ };
373
+ const AreaModeCustomProps = exports.AreaModeCustomProps = {
374
+ args: {
375
+ title: 'Área con Color Personalizado',
376
+ area: true,
377
+ areaProps: {
378
+ colorTheme: 'accent',
379
+ shade: '01'
380
+ },
381
+ elements: mockElements
382
+ },
383
+ name: 'Modo Área — Color Personalizado'
384
+ };
385
+ const CustomDataTestId = exports.CustomDataTestId = {
386
+ args: {
387
+ title: 'Con Test ID',
388
+ elements: mockElements,
389
+ dataTestId: 'custom-data-category'
390
+ },
391
+ name: 'Con Test ID Personalizado'
392
+ };
393
+ const Playground = exports.Playground = {
394
+ args: {
395
+ title: 'Categoría de Datos',
396
+ description: '',
397
+ Icon: 'IconFolder',
398
+ collapsable: true,
399
+ expanded: false,
400
+ area: false,
401
+ elements: mockElementsWithActions,
402
+ dataTestId: 'playground-data-category'
403
+ },
404
+ name: 'Playground'
405
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = require("prop-types");
9
+ var _testIds = require("../../../../constants/testIds");
10
+ var _UTSwitch = _interopRequireDefault(require("../../../UTSwitch"));
11
+ var _UTButton = _interopRequireDefault(require("../../../UTButton"));
12
+ var _constants = require("../../constants");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ 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); }
15
+ const {
16
+ dataElement
17
+ } = _testIds.TEST_IDS;
18
+ const MainAction = _ref => {
19
+ let {
20
+ type = _constants.ACTION_TYPE.BUTTON,
21
+ onChange,
22
+ value,
23
+ onClick,
24
+ dataTestId,
25
+ ...props
26
+ } = _ref;
27
+ return type === _constants.ACTION_TYPE.SWITCH && onChange ? /*#__PURE__*/_react.default.createElement(_UTSwitch.default, _extends({
28
+ onChange: onChange,
29
+ value: value
30
+ }, props, {
31
+ dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(dataElement.switchAction) : undefined,
32
+ version: "V1"
33
+ })) : type === _constants.ACTION_TYPE.BUTTON && onClick ? /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
34
+ dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(dataElement.buttonAction) : undefined,
35
+ variant: "text",
36
+ onClick: onClick
37
+ }, props)) : null;
38
+ };
39
+ MainAction.propTypes = {
40
+ dataTestId: _propTypes.string,
41
+ id: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]),
42
+ onChange: _propTypes.func,
43
+ onClick: _propTypes.func,
44
+ type: (0, _propTypes.oneOf)(Object.values(_constants.ACTION_TYPE)),
45
+ value: _propTypes.bool
46
+ };
47
+ var _default = exports.default = MainAction;
@@ -3,5 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WITHOUT_DATA_TEXT = void 0;
7
- const WITHOUT_DATA_TEXT = exports.WITHOUT_DATA_TEXT = 'Sin datos';
6
+ exports.WITHOUT_DATA_TEXT = exports.ACTION_TYPE = void 0;
7
+ const WITHOUT_DATA_TEXT = exports.WITHOUT_DATA_TEXT = 'Sin datos';
8
+ const ACTION_TYPE = exports.ACTION_TYPE = {
9
+ SWITCH: 'switch',
10
+ BUTTON: 'button'
11
+ };
@@ -10,14 +10,14 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
10
10
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
11
11
  var _UTDataElement = _interopRequireDefault(require("../UTDataElement"));
12
12
  var _UTLabel = _interopRequireDefault(require("../UTLabel"));
13
- var _UTButton = _interopRequireDefault(require("../UTButton"));
13
+ var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../UTTouchableWithoutFeedback"));
14
14
  var _classesUtils = require("../../utils/classesUtils");
15
15
  var _testIds = require("../../constants/testIds");
16
16
  var _UTIcon = _interopRequireDefault(require("../UTIcon"));
17
- var _MainAction = _interopRequireDefault(require("../UTDataElement/components/MainAction"));
18
17
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
18
  var _theme = require("./theme");
20
19
  var _constants = require("./constants");
20
+ var _MainAction = _interopRequireDefault(require("./components/MainAction"));
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  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); }
23
23
  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); }
@@ -32,6 +32,8 @@ const UTDataCategory = _ref => {
32
32
  classNames,
33
33
  collapsable = true,
34
34
  dataTestId,
35
+ description,
36
+ descriptionProps = {},
35
37
  elements = [],
36
38
  elementsProps = {},
37
39
  expanded = false,
@@ -45,13 +47,20 @@ const UTDataCategory = _ref => {
45
47
  const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, classNames), [classNames, theme]);
46
48
  const [isCollapsed, setIsCollapsed] = (0, _react.useState)(showTitle && collapsable && !expanded);
47
49
  const childrenRef = (0, _react.useRef)(null);
50
+ (0, _react.useEffect)(() => {
51
+ setIsCollapsed(showTitle && collapsable && !expanded);
52
+ }, [expanded, showTitle, collapsable]);
48
53
  const toggleCollapsed = () => setIsCollapsed(!isCollapsed);
54
+ const handleHeaderKeyDown = (0, _react.useCallback)(event => {
55
+ if (event.target === event.currentTarget && (event.key === 'Enter' || event.key === ' ')) {
56
+ event.preventDefault();
57
+ toggleCollapsed();
58
+ }
59
+ }, [toggleCollapsed]);
60
+ const stopActionPropagation = (0, _react.useCallback)(event => event.stopPropagation(), []);
49
61
  const containerClasses = "".concat(_stylesModule.default.container, " ").concat(classes.container || '', " ").concat(area ? classes.area : '');
50
- const collapseButtonClasses = "".concat(_stylesModule.default.collapseButton, " ").concat(isCollapsed ? _stylesModule.default.collapsed : '');
51
- return /*#__PURE__*/_react.default.createElement("div", {
52
- className: containerClasses,
53
- "data-testid": dataTestId ? "".concat(dataTestId, ".").concat(dataCategory.container) : undefined
54
- }, title && /*#__PURE__*/_react.default.createElement("div", {
62
+ const collapseIconClasses = "".concat(_stylesModule.default.collapseButton, " ").concat(isCollapsed ? _stylesModule.default.collapsed : '');
63
+ const headerContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
55
64
  className: _stylesModule.default.title
56
65
  }, IconComponent && /*#__PURE__*/_react.default.createElement(IconComponent, _extends({
57
66
  name: Icon,
@@ -59,15 +68,31 @@ const UTDataCategory = _ref => {
59
68
  }, iconProps)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
60
69
  colorTheme: "gray",
61
70
  weight: "medium"
62
- }, titleProps), title), collapsable && /*#__PURE__*/_react.default.createElement("div", {
63
- className: collapseButtonClasses
64
- }, /*#__PURE__*/_react.default.createElement(_UTButton.default, {
65
- Icon: "IconChevronUp",
66
- variant: "text",
67
- onClick: toggleCollapsed,
68
- size: "small",
71
+ }, titleProps), title), collapsable && /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
72
+ className: collapseIconClasses,
73
+ colorTheme: "gray",
74
+ name: "IconChevronUp",
69
75
  dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(dataCategory.collapseButton) : undefined
70
- })), action && /*#__PURE__*/_react.default.createElement(_MainAction.default, action)), /*#__PURE__*/_react.default.createElement("div", {
76
+ }), action &&
77
+ /*#__PURE__*/
78
+ // Sin role="button": este div solo corta la propagación del click/keydown hacia el toggle de colapso, no es un control propio.
79
+ _react.default.createElement("div", {
80
+ onClick: stopActionPropagation,
81
+ onKeyDown: stopActionPropagation
82
+ }, /*#__PURE__*/_react.default.createElement(_MainAction.default, action))), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
83
+ colorTheme: "gray"
84
+ }, descriptionProps), description));
85
+ return /*#__PURE__*/_react.default.createElement("div", {
86
+ className: containerClasses,
87
+ "data-testid": dataTestId ? "".concat(dataTestId, ".").concat(dataCategory.container) : undefined
88
+ }, title && (collapsable ? /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
89
+ className: "".concat(_stylesModule.default.header, " ").concat(_stylesModule.default.clickable),
90
+ onClick: toggleCollapsed,
91
+ onKeyDown: handleHeaderKeyDown,
92
+ "aria-expanded": !isCollapsed
93
+ }, headerContent) : /*#__PURE__*/_react.default.createElement("div", {
94
+ className: _stylesModule.default.header
95
+ }, headerContent)), /*#__PURE__*/_react.default.createElement("div", {
71
96
  style: {
72
97
  gridTemplateRows: isCollapsed ? '0fr' : '1fr',
73
98
  marginTop: isCollapsed || !showTitle ? 0 : 16
@@ -94,11 +119,16 @@ const UTDataCategory = _ref => {
94
119
  UTDataCategory.propTypes = {
95
120
  action: _propTypes.object,
96
121
  area: _propTypes.bool,
97
- areaProps: _propTypes.object,
122
+ areaProps: (0, _propTypes.shape)({
123
+ colorTheme: _propTypes.string,
124
+ shade: _propTypes.string
125
+ }),
98
126
  classes: (0, _propTypes.objectOf)(_propTypes.string),
99
127
  classNames: (0, _propTypes.objectOf)(_propTypes.string),
100
128
  collapsable: _propTypes.bool,
101
129
  dataTestId: _propTypes.string,
130
+ description: _propTypes.string,
131
+ descriptionProps: _propTypes.object,
102
132
  elements: _propTypes.array,
103
133
  elementsProps: _propTypes.object,
104
134
  expanded: _propTypes.bool,
@@ -3,6 +3,17 @@
3
3
  flex-direction: column;
4
4
  }
5
5
 
6
+ .header {
7
+ align-items: stretch;
8
+ display: flex;
9
+ flex-direction: column;
10
+ grid-gap: var(--UT-dataCategory-title-gap, 0.5rem);
11
+ }
12
+
13
+ .clickable {
14
+ cursor: pointer;
15
+ }
16
+
6
17
  .title {
7
18
  align-items: center;
8
19
  display: flex;
@@ -8,6 +8,7 @@ A versatile data component that can be customized with various themes, sizes, ic
8
8
  | ------------------ | ----------------- | ------------ | ------------------------------------------------------------------ |
9
9
  | action | object | | Action configuration for button or switch. See Action Types below. |
10
10
  | area | bool | `false` | Specifies whether the component has a background area. |
11
+ | areaProps | object | `{}` | Customizes the area background. Supports `colorTheme` (any `COLOR_THEMES` value) and `shade` (`'01'`–`'05'`). Only applies when `area` is `true`. |
11
12
  | badge | string \| number | | Displays a badge with text or number. |
12
13
  | badgeProps | object | `{}` | Additional props for customizing the badge. |
13
14
  | children | element | | Collapsible content displayed below the main component. |
@@ -69,7 +70,7 @@ The values of `paddingVertical` and `spacing` must be one of the following:
69
70
 
70
71
  ## Collapsible Content
71
72
 
72
- If the component has any `children`, it will automatically become collapsible with a chevron button to expand/collapse the content.
73
+ If the component has any `children`, it will automatically become collapsible. Clicking anywhere on the title/data area expands/collapses the content; the chevron next to the title is only a visual indicator of the current state. Clicks on `action` (button or switch) don't affect the toggle since it sits outside that clickable area.
73
74
 
74
75
  ## Examples
75
76
 
@@ -134,4 +135,16 @@ If the component has any `children`, it will automatically become collapsible wi
134
135
 
135
136
  ```javascript
136
137
  <UTDataElement area title="Highlighted Item" Data="Important information" Icon="IconStar" />
137
- ```
138
+ ```
139
+
140
+ ### With Custom Area Style
141
+
142
+ ```javascript
143
+ <UTDataElement
144
+ area
145
+ areaProps={{ colorTheme: 'accent', shade: '01' }}
146
+ title="Custom Area"
147
+ Data="Custom background color and shade"
148
+ Icon="IconStar"
149
+ />
150
+ ```