@widergy/energy-ui 3.163.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 (46) hide show
  1. package/CHANGELOG.md +23 -4
  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/UTDatePicker/versions/V0/index.js +3 -0
  9. package/dist/components/UTDatePicker/versions/V1/index.js +5 -8
  10. package/dist/components/UTSnackbar/README.md +105 -0
  11. package/dist/components/UTSnackbar/constants.js +128 -0
  12. package/dist/components/UTSnackbar/index.js +136 -0
  13. package/dist/components/UTSnackbar/stories/UTSnackbar.stories.js +316 -0
  14. package/dist/components/UTSnackbar/stories/storiesConstants.js +168 -0
  15. package/dist/components/UTSnackbar/styles.module.scss +82 -0
  16. package/dist/components/UTSnackbar/theme.js +57 -0
  17. package/dist/components/UTSnackbar/types.js +20 -0
  18. package/dist/components/UTTextArea/UTTextArea.stories.js +342 -0
  19. package/dist/components/UTTextInput/UTTextInput.stories.js +439 -0
  20. package/dist/components/UTTextInput/versions/V0/index.js +1 -0
  21. package/dist/constants/testIds.js +10 -4
  22. package/dist/esm/components/UTAlert/README.md +100 -0
  23. package/dist/esm/components/UTAlert/stories/UTAlert.stories.js +231 -0
  24. package/dist/esm/components/UTAlert/stories/storiesConstants.js +101 -0
  25. package/dist/esm/components/UTBanner/index.js +11 -5
  26. package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +8 -0
  27. package/dist/esm/components/UTBaseInputField/UTBaseInputField.stories.js +385 -0
  28. package/dist/esm/components/UTDatePicker/versions/V0/index.js +3 -0
  29. package/dist/esm/components/UTDatePicker/versions/V1/index.js +5 -8
  30. package/dist/esm/components/UTSnackbar/README.md +105 -0
  31. package/dist/esm/components/UTSnackbar/constants.js +122 -0
  32. package/dist/esm/components/UTSnackbar/index.js +129 -0
  33. package/dist/esm/components/UTSnackbar/stories/UTSnackbar.stories.js +308 -0
  34. package/dist/esm/components/UTSnackbar/stories/storiesConstants.js +162 -0
  35. package/dist/esm/components/UTSnackbar/styles.module.scss +82 -0
  36. package/dist/esm/components/UTSnackbar/theme.js +50 -0
  37. package/dist/esm/components/UTSnackbar/types.js +14 -0
  38. package/dist/esm/components/UTTextArea/UTTextArea.stories.js +334 -0
  39. package/dist/esm/components/UTTextInput/UTTextInput.stories.js +431 -0
  40. package/dist/esm/components/UTTextInput/versions/V0/index.js +1 -0
  41. package/dist/esm/constants/testIds.js +10 -4
  42. package/dist/esm/index.js +2 -1
  43. package/dist/esm/utils/hooks/useCSSVariables/constants.js +9 -0
  44. package/dist/index.js +7 -0
  45. package/dist/utils/hooks/useCSSVariables/constants.js +9 -0
  46. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ import { createTheme } from '@material-ui/core/styles';
2
+ export const retrieveMuiTheme = theme => {
3
+ var _theme$Fonts;
4
+ return createTheme({
5
+ typography: {
6
+ fontFamily: theme === null || theme === void 0 || (_theme$Fonts = theme.Fonts) === null || _theme$Fonts === void 0 ? void 0 : _theme$Fonts.fontFamily
7
+ },
8
+ overrides: {
9
+ MuiSnackbarContent: {
10
+ root: {
11
+ minWidth: 288,
12
+ maxWidth: 568,
13
+ padding: 'var(--UT-snackbar-padding-y, 8px) var(--UT-snackbar-padding-x, 12px)',
14
+ borderRadius: 'var(--UT-snackbar-radius, 4px)',
15
+ '@media (max-width : 767px)': {
16
+ borderRadius: 0,
17
+ maxWidth: 'initial',
18
+ width: '100%'
19
+ }
20
+ },
21
+ message: {
22
+ flex: 1,
23
+ padding: 0
24
+ },
25
+ action: {
26
+ marginLeft: 'var(--UT-snackbar-gap-action-area, 12px)',
27
+ marginRight: 0,
28
+ paddingLeft: 0
29
+ }
30
+ },
31
+ MuiSnackbar: {
32
+ root: {
33
+ '@media (max-width : 767px)': {
34
+ left: 0,
35
+ maxWidth: 'initial',
36
+ right: 0,
37
+ width: '100%'
38
+ }
39
+ },
40
+ anchorOriginBottomLeft: {
41
+ bottom: 0,
42
+ '@media (max-width : 767px)': {
43
+ bottom: 0,
44
+ left: 0
45
+ }
46
+ }
47
+ }
48
+ }
49
+ });
50
+ };
@@ -0,0 +1,14 @@
1
+ import { bool, func, node, oneOfType, shape, string } from 'prop-types';
2
+ export const buttonType = shape({
3
+ colorTheme: string,
4
+ dataTestId: string,
5
+ disabled: bool,
6
+ Icon: oneOfType([string, func]),
7
+ iconPlacement: string,
8
+ loading: bool,
9
+ onClick: func,
10
+ size: string,
11
+ title: node,
12
+ type: string,
13
+ variant: string
14
+ });
@@ -0,0 +1,334 @@
1
+ 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); }
2
+ import React, { useState } from 'react';
3
+ import UTTextArea from '.';
4
+ export default {
5
+ title: 'Energy-UI/UTTextArea',
6
+ component: UTTextArea,
7
+ args: {
8
+ version: 'V1',
9
+ placeholder: 'Escribí tu texto aquí...'
10
+ },
11
+ argTypes: {
12
+ version: {
13
+ control: 'select',
14
+ description: 'Versión del componente. V1 extiende UTTextInput con soporte para design tokens.',
15
+ options: ['V0', 'V1'],
16
+ table: {
17
+ defaultValue: {
18
+ summary: 'V0'
19
+ },
20
+ type: {
21
+ summary: "'V0' | 'V1'"
22
+ }
23
+ }
24
+ },
25
+ title: {
26
+ control: 'text',
27
+ description: 'Texto del label que aparece sobre el campo. (solo V1)',
28
+ table: {
29
+ defaultValue: {
30
+ summary: 'undefined'
31
+ },
32
+ type: {
33
+ summary: 'string'
34
+ }
35
+ }
36
+ },
37
+ placeholder: {
38
+ control: 'text',
39
+ description: 'Texto de placeholder que se muestra cuando el campo está vacío.',
40
+ table: {
41
+ defaultValue: {
42
+ summary: 'undefined'
43
+ },
44
+ type: {
45
+ summary: 'string'
46
+ }
47
+ }
48
+ },
49
+ value: {
50
+ control: 'text',
51
+ description: 'Valor actual del campo de texto.',
52
+ table: {
53
+ defaultValue: {
54
+ summary: 'undefined'
55
+ },
56
+ type: {
57
+ summary: 'string'
58
+ }
59
+ }
60
+ },
61
+ onChange: {
62
+ action: 'onChange',
63
+ description: 'Callback que se ejecuta al cambiar el valor del campo.',
64
+ table: {
65
+ defaultValue: {
66
+ summary: 'undefined'
67
+ },
68
+ type: {
69
+ summary: 'func'
70
+ }
71
+ }
72
+ },
73
+ disabled: {
74
+ control: 'boolean',
75
+ description: 'Si es `true`, el campo está deshabilitado y no acepta interacciones.',
76
+ table: {
77
+ defaultValue: {
78
+ summary: 'false'
79
+ },
80
+ type: {
81
+ summary: 'bool'
82
+ }
83
+ }
84
+ },
85
+ readOnly: {
86
+ control: 'boolean',
87
+ description: 'Si es `true`, el campo muestra el valor pero no permite editarlo.',
88
+ table: {
89
+ defaultValue: {
90
+ summary: 'false'
91
+ },
92
+ type: {
93
+ summary: 'bool'
94
+ }
95
+ }
96
+ },
97
+ required: {
98
+ control: 'boolean',
99
+ description: 'Si es `true`, muestra un indicador `*` junto al label. (solo V1)',
100
+ table: {
101
+ defaultValue: {
102
+ summary: 'false'
103
+ },
104
+ type: {
105
+ summary: 'bool'
106
+ }
107
+ }
108
+ },
109
+ error: {
110
+ control: 'text',
111
+ description: 'Mensaje de error. Si se pasa un string, se muestra como validación debajo del campo. (solo V1)',
112
+ table: {
113
+ defaultValue: {
114
+ summary: 'undefined'
115
+ },
116
+ type: {
117
+ summary: 'string | bool'
118
+ }
119
+ }
120
+ },
121
+ helpText: {
122
+ control: 'text',
123
+ description: 'Texto de ayuda que se muestra debajo del campo en color gris. (solo V1)',
124
+ table: {
125
+ defaultValue: {
126
+ summary: 'undefined'
127
+ },
128
+ type: {
129
+ summary: 'string'
130
+ }
131
+ }
132
+ },
133
+ maxLength: {
134
+ control: 'number',
135
+ description: 'Límite máximo de caracteres. En V1 habilita el contador de caracteres automáticamente.',
136
+ table: {
137
+ defaultValue: {
138
+ summary: 'undefined'
139
+ },
140
+ type: {
141
+ summary: 'number'
142
+ }
143
+ }
144
+ },
145
+ maxRows: {
146
+ control: 'number',
147
+ description: 'Cantidad máxima de filas visibles antes de activar el scroll.',
148
+ table: {
149
+ defaultValue: {
150
+ summary: '4'
151
+ },
152
+ type: {
153
+ summary: 'number'
154
+ }
155
+ }
156
+ },
157
+ inputSize: {
158
+ control: 'select',
159
+ description: 'Tamaño del campo de texto. Afecta el padding interno. (solo V1)',
160
+ options: ['medium', 'small'],
161
+ table: {
162
+ defaultValue: {
163
+ summary: 'medium'
164
+ },
165
+ type: {
166
+ summary: "'medium' | 'small'"
167
+ }
168
+ }
169
+ },
170
+ titleVariant: {
171
+ control: 'select',
172
+ description: 'Tamaño del label del campo. (solo V1)',
173
+ options: ['large', 'small'],
174
+ table: {
175
+ defaultValue: {
176
+ summary: 'large'
177
+ },
178
+ type: {
179
+ summary: "'large' | 'small'"
180
+ }
181
+ }
182
+ },
183
+ tooltip: {
184
+ control: 'text',
185
+ description: 'Texto del tooltip que aparece al hacer hover sobre el ícono de ayuda. (V0)',
186
+ table: {
187
+ defaultValue: {
188
+ summary: 'undefined'
189
+ },
190
+ type: {
191
+ summary: 'string'
192
+ }
193
+ }
194
+ }
195
+ },
196
+ parameters: {
197
+ docs: {
198
+ description: {
199
+ component: 'UTTextArea es un campo de texto multilínea. La versión V1 extiende UTTextInput con `showCharacterCount=true` y `maxRows=4` por defecto. La versión V0 es la implementación legada con estilos propios.'
200
+ }
201
+ }
202
+ }
203
+ };
204
+ const StatefulTextArea = args => {
205
+ var _args$value;
206
+ const [value, setValue] = useState((_args$value = args.value) !== null && _args$value !== void 0 ? _args$value : '');
207
+ return /*#__PURE__*/React.createElement(UTTextArea, _extends({}, args, {
208
+ value: value,
209
+ onChange: setValue
210
+ }));
211
+ };
212
+ export const Playground = {
213
+ render: args => /*#__PURE__*/React.createElement(StatefulTextArea, args),
214
+ args: {
215
+ title: 'Descripción',
216
+ placeholder: 'Escribí tu texto aquí...',
217
+ maxLength: 200,
218
+ maxRows: 4,
219
+ version: 'V1'
220
+ },
221
+ name: 'Playground'
222
+ };
223
+ export const Default = {
224
+ args: {
225
+ placeholder: 'Escribí tu texto aquí...',
226
+ version: 'V1'
227
+ }
228
+ };
229
+ export const ConTitulo = {
230
+ args: {
231
+ title: 'Motivo de contacto',
232
+ placeholder: 'Describí tu consulta...',
233
+ version: 'V1'
234
+ },
235
+ name: 'Con título'
236
+ };
237
+ export const Requerido = {
238
+ args: {
239
+ title: 'Motivo de contacto',
240
+ placeholder: 'Este campo es obligatorio',
241
+ required: true,
242
+ version: 'V1'
243
+ }
244
+ };
245
+ export const ConError = {
246
+ args: {
247
+ title: 'Descripción',
248
+ placeholder: 'Escribí tu texto aquí...',
249
+ value: 'Texto con error',
250
+ error: 'El texto ingresado no cumple con el formato requerido.',
251
+ version: 'V1'
252
+ },
253
+ name: 'Con error'
254
+ };
255
+ export const Deshabilitado = {
256
+ args: {
257
+ title: 'Descripción',
258
+ placeholder: 'Campo deshabilitado',
259
+ disabled: true,
260
+ version: 'V1'
261
+ }
262
+ };
263
+ export const SoloLectura = {
264
+ args: {
265
+ title: 'Observaciones',
266
+ value: 'Este es un texto de solo lectura que no puede ser editado por el usuario, solo visualizado.',
267
+ readOnly: true,
268
+ version: 'V1'
269
+ },
270
+ name: 'Solo lectura'
271
+ };
272
+ export const ConTextoDeAyuda = {
273
+ args: {
274
+ title: 'Descripción',
275
+ placeholder: 'Escribí una breve descripción...',
276
+ helpText: 'Máximo 500 caracteres. No incluyas datos personales.',
277
+ version: 'V1'
278
+ },
279
+ name: 'Con texto de ayuda'
280
+ };
281
+ export const ConLimiteDeCaracteres = {
282
+ render: args => /*#__PURE__*/React.createElement(StatefulTextArea, args),
283
+ args: {
284
+ title: 'Descripción',
285
+ placeholder: 'Escribí tu texto aquí...',
286
+ maxLength: 100,
287
+ maxRows: 4,
288
+ version: 'V1'
289
+ },
290
+ name: 'Con límite de caracteres'
291
+ };
292
+ export const Pequeno = {
293
+ args: {
294
+ title: 'Comentario',
295
+ placeholder: 'Comentario corto...',
296
+ inputSize: 'small',
297
+ titleVariant: 'small',
298
+ maxLength: 80,
299
+ version: 'V1'
300
+ },
301
+ name: 'Pequeño'
302
+ };
303
+ export const MasFilas = {
304
+ render: args => /*#__PURE__*/React.createElement(StatefulTextArea, args),
305
+ args: {
306
+ title: 'Descripción extendida',
307
+ placeholder: 'El área crece hasta 8 filas...',
308
+ maxRows: 8,
309
+ maxLength: 500,
310
+ version: 'V1'
311
+ },
312
+ name: 'Más filas (maxRows=8)'
313
+ };
314
+ export const V0Legado = {
315
+ args: {
316
+ title: 'Descripción',
317
+ placeholder: 'Versión legada V0...',
318
+ version: 'V0',
319
+ value: '',
320
+ onChange: () => {}
321
+ },
322
+ name: 'V0 (legado)'
323
+ };
324
+ export const V0ConTooltip = {
325
+ args: {
326
+ title: 'Observaciones',
327
+ placeholder: 'Escribí tus observaciones...',
328
+ tooltip: 'Este campo se usa para registrar observaciones adicionales sobre el caso.',
329
+ version: 'V0',
330
+ value: '',
331
+ onChange: () => {}
332
+ },
333
+ name: 'V0 con tooltip'
334
+ };