@widergy/energy-ui 3.164.0 → 3.165.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 (40) hide show
  1. package/CHANGELOG.md +10 -5
  2. package/dist/components/UTAlert/README.md +100 -0
  3. package/dist/components/UTAlert/stories/UTAlert.stories.js +239 -0
  4. package/dist/components/UTAlert/stories/storiesConstants.js +107 -0
  5. package/dist/components/UTBanner/index.js +11 -5
  6. package/dist/components/UTBanner/stories/UTBanner.stories.js +8 -0
  7. package/dist/components/UTBaseInputField/UTBaseInputField.stories.js +393 -0
  8. package/dist/components/UTSnackbar/README.md +105 -0
  9. package/dist/components/UTSnackbar/constants.js +128 -0
  10. package/dist/components/UTSnackbar/index.js +136 -0
  11. package/dist/components/UTSnackbar/stories/UTSnackbar.stories.js +316 -0
  12. package/dist/components/UTSnackbar/stories/storiesConstants.js +168 -0
  13. package/dist/components/UTSnackbar/styles.module.scss +82 -0
  14. package/dist/components/UTSnackbar/theme.js +57 -0
  15. package/dist/components/UTSnackbar/types.js +20 -0
  16. package/dist/components/UTTextArea/UTTextArea.stories.js +342 -0
  17. package/dist/components/UTTextInput/UTTextInput.stories.js +439 -0
  18. package/dist/constants/testIds.js +9 -0
  19. package/dist/esm/components/UTAlert/README.md +100 -0
  20. package/dist/esm/components/UTAlert/stories/UTAlert.stories.js +231 -0
  21. package/dist/esm/components/UTAlert/stories/storiesConstants.js +101 -0
  22. package/dist/esm/components/UTBanner/index.js +11 -5
  23. package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +8 -0
  24. package/dist/esm/components/UTBaseInputField/UTBaseInputField.stories.js +385 -0
  25. package/dist/esm/components/UTSnackbar/README.md +105 -0
  26. package/dist/esm/components/UTSnackbar/constants.js +122 -0
  27. package/dist/esm/components/UTSnackbar/index.js +129 -0
  28. package/dist/esm/components/UTSnackbar/stories/UTSnackbar.stories.js +308 -0
  29. package/dist/esm/components/UTSnackbar/stories/storiesConstants.js +162 -0
  30. package/dist/esm/components/UTSnackbar/styles.module.scss +82 -0
  31. package/dist/esm/components/UTSnackbar/theme.js +50 -0
  32. package/dist/esm/components/UTSnackbar/types.js +14 -0
  33. package/dist/esm/components/UTTextArea/UTTextArea.stories.js +334 -0
  34. package/dist/esm/components/UTTextInput/UTTextInput.stories.js +431 -0
  35. package/dist/esm/constants/testIds.js +9 -0
  36. package/dist/esm/index.js +2 -1
  37. package/dist/esm/utils/hooks/useCSSVariables/constants.js +9 -0
  38. package/dist/index.js +7 -0
  39. package/dist/utils/hooks/useCSSVariables/constants.js +9 -0
  40. package/package.json +1 -1
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SoloNumeros = exports.SoloLectura = exports.Requerido = exports.Playground = exports.Pequeno = exports.Deshabilitado = exports.Default = exports.Contrasena = exports.ConTooltip = exports.ConTitulo = exports.ConTextoDeAyuda = exports.ConSuffix = exports.ConPrefix = exports.ConIconoIzquierdo = exports.ConIconoDerecho = exports.ConError = exports.ConContadorDeCaracteres = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
9
+ var _Lock = _interopRequireDefault(require("@material-ui/icons/Lock"));
10
+ var _Visibility = _interopRequireDefault(require("@material-ui/icons/Visibility"));
11
+ var _ = _interopRequireDefault(require("."));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ 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); }
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
+ var _default = exports.default = {
16
+ title: 'Energy-UI/UTTextInput',
17
+ component: _.default,
18
+ args: {
19
+ version: 'V1',
20
+ placeholder: 'Ingresá un valor...'
21
+ },
22
+ argTypes: {
23
+ version: {
24
+ control: 'select',
25
+ description: 'Versión del componente.',
26
+ options: ['V0', 'V1'],
27
+ table: {
28
+ defaultValue: {
29
+ summary: 'V0'
30
+ },
31
+ type: {
32
+ summary: "'V0' | 'V1'"
33
+ }
34
+ }
35
+ },
36
+ title: {
37
+ control: 'text',
38
+ description: 'Texto del label que aparece sobre el campo.',
39
+ table: {
40
+ defaultValue: {
41
+ summary: 'undefined'
42
+ },
43
+ type: {
44
+ summary: 'string'
45
+ }
46
+ }
47
+ },
48
+ placeholder: {
49
+ control: 'text',
50
+ description: 'Texto de placeholder.',
51
+ table: {
52
+ defaultValue: {
53
+ summary: 'undefined'
54
+ },
55
+ type: {
56
+ summary: 'string'
57
+ }
58
+ }
59
+ },
60
+ value: {
61
+ control: 'text',
62
+ description: 'Valor actual del campo.',
63
+ table: {
64
+ defaultValue: {
65
+ summary: 'null'
66
+ },
67
+ type: {
68
+ summary: 'string'
69
+ }
70
+ }
71
+ },
72
+ onChange: {
73
+ action: 'onChange',
74
+ description: 'Callback al cambiar el valor.',
75
+ table: {
76
+ type: {
77
+ summary: 'func'
78
+ }
79
+ }
80
+ },
81
+ disabled: {
82
+ control: 'boolean',
83
+ description: 'Deshabilita el campo.',
84
+ table: {
85
+ defaultValue: {
86
+ summary: 'false'
87
+ },
88
+ type: {
89
+ summary: 'bool'
90
+ }
91
+ }
92
+ },
93
+ readOnly: {
94
+ control: 'boolean',
95
+ description: 'Muestra el valor sin permitir edición.',
96
+ table: {
97
+ defaultValue: {
98
+ summary: 'false'
99
+ },
100
+ type: {
101
+ summary: 'bool'
102
+ }
103
+ }
104
+ },
105
+ required: {
106
+ control: 'boolean',
107
+ description: 'Muestra el indicador `*` junto al label.',
108
+ table: {
109
+ defaultValue: {
110
+ summary: 'false'
111
+ },
112
+ type: {
113
+ summary: 'bool'
114
+ }
115
+ }
116
+ },
117
+ error: {
118
+ control: 'text',
119
+ description: 'Mensaje de error o `true` para mostrar estado de error.',
120
+ table: {
121
+ defaultValue: {
122
+ summary: 'undefined'
123
+ },
124
+ type: {
125
+ summary: 'string | bool'
126
+ }
127
+ }
128
+ },
129
+ helpText: {
130
+ control: 'text',
131
+ description: 'Texto de ayuda debajo del campo.',
132
+ table: {
133
+ defaultValue: {
134
+ summary: 'undefined'
135
+ },
136
+ type: {
137
+ summary: 'string'
138
+ }
139
+ }
140
+ },
141
+ maxLength: {
142
+ control: 'number',
143
+ description: 'Límite de caracteres. Si se combina con `showCharacterCount`, muestra el contador.',
144
+ table: {
145
+ defaultValue: {
146
+ summary: 'undefined'
147
+ },
148
+ type: {
149
+ summary: 'number'
150
+ }
151
+ }
152
+ },
153
+ showCharacterCount: {
154
+ control: 'boolean',
155
+ description: 'Muestra el contador de caracteres (requiere `maxLength`).',
156
+ table: {
157
+ defaultValue: {
158
+ summary: 'false'
159
+ },
160
+ type: {
161
+ summary: 'bool'
162
+ }
163
+ }
164
+ },
165
+ inputSize: {
166
+ control: 'select',
167
+ description: 'Tamaño del campo. Afecta el padding interno.',
168
+ options: ['medium', 'small'],
169
+ table: {
170
+ defaultValue: {
171
+ summary: 'medium'
172
+ },
173
+ type: {
174
+ summary: "'medium' | 'small'"
175
+ }
176
+ }
177
+ },
178
+ titleVariant: {
179
+ control: 'select',
180
+ description: 'Tamaño del label.',
181
+ options: ['large', 'small'],
182
+ table: {
183
+ defaultValue: {
184
+ summary: 'large'
185
+ },
186
+ type: {
187
+ summary: "'large' | 'small'"
188
+ }
189
+ }
190
+ },
191
+ prefix: {
192
+ control: 'text',
193
+ description: 'Texto prefijo dentro del campo (ej: `$`, `+54`).',
194
+ table: {
195
+ defaultValue: {
196
+ summary: 'undefined'
197
+ },
198
+ type: {
199
+ summary: 'string'
200
+ }
201
+ }
202
+ },
203
+ suffix: {
204
+ control: 'text',
205
+ description: 'Texto sufijo dentro del campo (ej: `kg`, `m²`).',
206
+ table: {
207
+ defaultValue: {
208
+ summary: 'undefined'
209
+ },
210
+ type: {
211
+ summary: 'string'
212
+ }
213
+ }
214
+ },
215
+ tooltip: {
216
+ control: 'text',
217
+ description: 'Tooltip de ayuda sobre el ícono de información.',
218
+ table: {
219
+ defaultValue: {
220
+ summary: 'undefined'
221
+ },
222
+ type: {
223
+ summary: 'string'
224
+ }
225
+ }
226
+ },
227
+ type: {
228
+ control: 'select',
229
+ description: 'Tipo de input HTML. `numeric` filtra solo números.',
230
+ options: ['text', 'password', 'email', 'numeric'],
231
+ table: {
232
+ defaultValue: {
233
+ summary: 'text'
234
+ },
235
+ type: {
236
+ summary: 'string'
237
+ }
238
+ }
239
+ },
240
+ LeftIcon: {
241
+ control: false,
242
+ description: 'Componente ícono que se muestra a la izquierda.',
243
+ table: {
244
+ defaultValue: {
245
+ summary: 'undefined'
246
+ },
247
+ type: {
248
+ summary: 'elementType'
249
+ }
250
+ }
251
+ },
252
+ RightIcon: {
253
+ control: false,
254
+ description: 'Componente ícono que se muestra a la derecha.',
255
+ table: {
256
+ defaultValue: {
257
+ summary: 'undefined'
258
+ },
259
+ type: {
260
+ summary: 'elementType'
261
+ }
262
+ }
263
+ }
264
+ },
265
+ parameters: {
266
+ docs: {
267
+ description: {
268
+ component: 'UTTextInput es el campo de texto estándar del design system. V1 combina UTFieldLabel + UTBaseInputField con soporte completo para adornos, validaciones y tokens de diseño.'
269
+ }
270
+ }
271
+ }
272
+ };
273
+ const Stateful = args => {
274
+ var _args$value;
275
+ const [value, setValue] = (0, _react.useState)((_args$value = args.value) !== null && _args$value !== void 0 ? _args$value : '');
276
+ return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
277
+ value: value,
278
+ onChange: setValue
279
+ }));
280
+ };
281
+ const Playground = exports.Playground = {
282
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
283
+ args: {
284
+ title: 'Email',
285
+ placeholder: 'usuario@empresa.com',
286
+ version: 'V1'
287
+ },
288
+ name: 'Playground'
289
+ };
290
+ const Default = exports.Default = {
291
+ args: {
292
+ placeholder: 'Ingresá un valor...',
293
+ version: 'V1'
294
+ }
295
+ };
296
+ const ConTitulo = exports.ConTitulo = {
297
+ args: {
298
+ title: 'Nombre completo',
299
+ placeholder: 'Ej: Juan Pérez',
300
+ version: 'V1'
301
+ },
302
+ name: 'Con título'
303
+ };
304
+ const Requerido = exports.Requerido = {
305
+ args: {
306
+ title: 'Email',
307
+ placeholder: 'usuario@empresa.com',
308
+ required: true,
309
+ version: 'V1'
310
+ }
311
+ };
312
+ const ConError = exports.ConError = {
313
+ args: {
314
+ title: 'Email',
315
+ value: 'correo-invalido',
316
+ error: 'El formato del email no es válido.',
317
+ version: 'V1'
318
+ },
319
+ name: 'Con error'
320
+ };
321
+ const Deshabilitado = exports.Deshabilitado = {
322
+ args: {
323
+ title: 'Email',
324
+ placeholder: 'Campo deshabilitado',
325
+ disabled: true,
326
+ version: 'V1'
327
+ }
328
+ };
329
+ const SoloLectura = exports.SoloLectura = {
330
+ args: {
331
+ title: 'Email',
332
+ value: 'usuario@empresa.com',
333
+ readOnly: true,
334
+ version: 'V1'
335
+ },
336
+ name: 'Solo lectura'
337
+ };
338
+ const ConTextoDeAyuda = exports.ConTextoDeAyuda = {
339
+ args: {
340
+ title: 'Contraseña',
341
+ placeholder: 'Mínimo 8 caracteres',
342
+ helpText: 'Usá mayúsculas, minúsculas y al menos un número.',
343
+ version: 'V1'
344
+ },
345
+ name: 'Con texto de ayuda'
346
+ };
347
+ const ConContadorDeCaracteres = exports.ConContadorDeCaracteres = {
348
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
349
+ args: {
350
+ title: 'Nombre',
351
+ placeholder: 'Ingresá tu nombre',
352
+ maxLength: 50,
353
+ showCharacterCount: true,
354
+ version: 'V1'
355
+ },
356
+ name: 'Con contador de caracteres'
357
+ };
358
+ const ConPrefix = exports.ConPrefix = {
359
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
360
+ args: {
361
+ title: 'Monto',
362
+ placeholder: '0,00',
363
+ prefix: '$',
364
+ version: 'V1'
365
+ },
366
+ name: 'Con prefijo'
367
+ };
368
+ const ConSuffix = exports.ConSuffix = {
369
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
370
+ args: {
371
+ title: 'Peso',
372
+ placeholder: '0',
373
+ suffix: 'kg',
374
+ version: 'V1'
375
+ },
376
+ name: 'Con sufijo'
377
+ };
378
+ const ConIconoIzquierdo = exports.ConIconoIzquierdo = {
379
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
380
+ args: {
381
+ title: 'Búsqueda',
382
+ placeholder: 'Buscá...',
383
+ LeftIcon: _Search.default,
384
+ version: 'V1'
385
+ },
386
+ name: 'Con ícono izquierdo'
387
+ };
388
+ const ConIconoDerecho = exports.ConIconoDerecho = {
389
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
390
+ args: {
391
+ title: 'Contraseña',
392
+ placeholder: '••••••••',
393
+ type: 'password',
394
+ RightIcon: _Visibility.default,
395
+ version: 'V1'
396
+ },
397
+ name: 'Con ícono derecho'
398
+ };
399
+ const ConTooltip = exports.ConTooltip = {
400
+ args: {
401
+ title: 'CUIT',
402
+ placeholder: '20-12345678-9',
403
+ tooltip: 'Ingresá tu CUIT sin guiones. Se validará el formato automáticamente.',
404
+ version: 'V1'
405
+ },
406
+ name: 'Con tooltip'
407
+ };
408
+ const Pequeno = exports.Pequeno = {
409
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
410
+ args: {
411
+ title: 'Código',
412
+ placeholder: 'ABC-123',
413
+ inputSize: 'small',
414
+ titleVariant: 'small',
415
+ version: 'V1'
416
+ },
417
+ name: 'Pequeño'
418
+ };
419
+ const Contrasena = exports.Contrasena = {
420
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
421
+ args: {
422
+ title: 'Contraseña',
423
+ placeholder: 'Ingresá tu contraseña',
424
+ type: 'password',
425
+ RightIcon: _Lock.default,
426
+ version: 'V1'
427
+ },
428
+ name: 'Contraseña'
429
+ };
430
+ const SoloNumeros = exports.SoloNumeros = {
431
+ render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
432
+ args: {
433
+ title: 'Número de teléfono',
434
+ placeholder: '11 1234-5678',
435
+ type: 'numeric',
436
+ version: 'V1'
437
+ },
438
+ name: 'Solo números'
439
+ };
@@ -65,6 +65,7 @@ const ID_CONSTANTS = exports.ID_CONSTANTS = {
65
65
  TABLE_ROW: 'tableRow',
66
66
  TITLE: 'title',
67
67
  USER_FILTER: 'userFilter',
68
+ UT_SNACKBAR: 'UTSnackbar',
68
69
  VALIDATION_DATA: 'validationData',
69
70
  WORKFLOW_CONTAINER: 'workflowContainer'
70
71
  };
@@ -168,6 +169,14 @@ const TEST_IDS = exports.TEST_IDS = {
168
169
  wrapperObservation: {
169
170
  actionIcon: 'wrapperObservation.actionIcon.'
170
171
  },
172
+ UTSnackbar: {
173
+ closeButton: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".closeButton"),
174
+ description: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".description"),
175
+ label: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".label"),
176
+ primaryActionButton: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".primaryActionButton"),
177
+ root: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".root"),
178
+ secondaryActionButton: "".concat(ID_CONSTANTS.UT_SNACKBAR, ".secondaryActionButton")
179
+ },
171
180
  UTDatePickerV1TestID: {
172
181
  calendar: 'UTDatePickerV1.calendar',
173
182
  calendarPrevBtn: 'UTDatePickerV1.calendarPrevBtn',
@@ -0,0 +1,100 @@
1
+ # UTAlert
2
+
3
+ Componente de alerta tipo Snackbar para mostrar notificaciones al usuario. Soporta cuatro tipos (success, error, info, warning), markdown en el mensaje y posicionamiento configurable. Se usa habitualmente junto al `AlertHandler` singleton para disparar alertas desde cualquier lugar de la aplicación.
4
+
5
+ ---
6
+
7
+ ## Props
8
+
9
+ ### `content` (shape)
10
+
11
+ Objeto que controla el estado y la apariencia de la alerta.
12
+
13
+ | Campo | Tipo | Default | Descripción |
14
+ | ----- | ---- | ------- | ----------- |
15
+ | `message` | `string` | `undefined` | Mensaje a mostrar. Soporta markdown. |
16
+ | `open` | `boolean` | `false` | Controla si la alerta está visible. |
17
+ | `type` | `'error' \| 'info' \| 'success' \| 'warning'` | `undefined` | Tipo de alerta. Determina el ícono y el color. |
18
+ | `timeDuration` | `number` | `undefined` | Duración en ms antes del cierre automático. |
19
+ | `topRight` | `boolean` | `false` | Si es `true`, aparece en la esquina superior derecha. Si es `false`, en la inferior izquierda. |
20
+ | `onClose` | `function` | `undefined` | Callback ejecutado al cerrar la alerta. |
21
+
22
+ ### Props de nivel superior
23
+
24
+ | Prop | Tipo | Default | Descripción |
25
+ | ---- | ---- | ------- | ----------- |
26
+ | `withoutIcon` | `boolean` | `undefined` | Si es `true`, oculta el ícono del tipo de alerta. |
27
+ | `classes` | `object` | `{}` | Clases CSS personalizadas para sobrescribir estilos del tema. |
28
+ | `closeDataTestId` | `string` | `undefined` | Identificador de test para el botón de cierre. |
29
+ | `labelDataTestId` | `string` | `undefined` | Identificador de test para el label del mensaje. |
30
+
31
+ ---
32
+
33
+ ## Uso básico
34
+
35
+ ```jsx
36
+ import { UTAlert } from '@widergy/energy-ui';
37
+
38
+ const MiComponente = () => (
39
+ <UTAlert
40
+ content={{
41
+ message: 'Operación completada exitosamente.',
42
+ open: true,
43
+ type: 'success'
44
+ }}
45
+ />
46
+ );
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Uso con AlertHandler
52
+
53
+ El patrón recomendado es inicializar `AlertHandler` una sola vez en el componente raíz y luego llamarlo desde cualquier parte de la aplicación.
54
+
55
+ ```jsx
56
+ import { useEffect, useState } from 'react';
57
+ import { UTAlert, AlertHandler } from '@widergy/energy-ui';
58
+
59
+ const AppRoot = () => {
60
+ const [alert, setAlert] = useState();
61
+
62
+ useEffect(() => {
63
+ AlertHandler.init({ setState: setAlert });
64
+ }, []);
65
+
66
+ return (
67
+ <>
68
+ <UTAlert content={alert} />
69
+ {/* resto de la app */}
70
+ </>
71
+ );
72
+ };
73
+
74
+ // Desde cualquier otro componente o servicio:
75
+ AlertHandler.success('Guardado correctamente.');
76
+ AlertHandler.error('Ocurrió un error. Intentá nuevamente.');
77
+ AlertHandler.info('Hay actualizaciones disponibles.');
78
+ AlertHandler.warning('Esta acción no se puede deshacer.');
79
+ ```
80
+
81
+ ### Métodos de AlertHandler
82
+
83
+ | Método | Descripción |
84
+ | ------ | ----------- |
85
+ | `init({ setState, duration })` | Inicializa el handler. `setState` es el setter de React. `duration` es la duración por defecto en ms (default: 5000). |
86
+ | `success(message, topRight?, timeDuration?)` | Muestra una alerta de éxito. |
87
+ | `error(message, topRight?, timeDuration?)` | Muestra una alerta de error. |
88
+ | `info(message, topRight?, timeDuration?)` | Muestra una alerta informativa. |
89
+ | `warning(message, topRight?, timeDuration?)` | Muestra una alerta de advertencia. |
90
+
91
+ ---
92
+
93
+ ## Variantes de tipo
94
+
95
+ | Tipo | Ícono | Descripción |
96
+ | ---- | ----- | ----------- |
97
+ | `success` | CheckCircle | Para operaciones exitosas. |
98
+ | `error` | Error | Para fallas o errores críticos. |
99
+ | `info` | Info | Para notificaciones informativas. |
100
+ | `warning` | Warning | Para acciones que requieren atención. |