@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,385 @@
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 Search from '@material-ui/icons/Search';
4
+ import Visibility from '@material-ui/icons/Visibility';
5
+ import { COMPONENT_KEYS } from './constants';
6
+ import UTBaseInputField from '.';
7
+ export default {
8
+ title: 'Energy-UI/UTBaseInputField',
9
+ component: UTBaseInputField,
10
+ args: {
11
+ placeholder: 'Ingresá un valor...',
12
+ value: ''
13
+ },
14
+ argTypes: {
15
+ placeholder: {
16
+ control: 'text',
17
+ description: 'Texto de placeholder.',
18
+ table: {
19
+ defaultValue: {
20
+ summary: 'undefined'
21
+ },
22
+ type: {
23
+ summary: 'string'
24
+ }
25
+ }
26
+ },
27
+ value: {
28
+ control: 'text',
29
+ description: 'Valor actual del campo.',
30
+ table: {
31
+ defaultValue: {
32
+ summary: 'null'
33
+ },
34
+ type: {
35
+ summary: 'string'
36
+ }
37
+ }
38
+ },
39
+ onChange: {
40
+ action: 'onChange',
41
+ description: 'Callback al cambiar el valor. Recibe el string del nuevo valor.',
42
+ table: {
43
+ type: {
44
+ summary: 'func'
45
+ }
46
+ }
47
+ },
48
+ disabled: {
49
+ control: 'boolean',
50
+ description: 'Deshabilita el campo.',
51
+ table: {
52
+ defaultValue: {
53
+ summary: 'false'
54
+ },
55
+ type: {
56
+ summary: 'bool'
57
+ }
58
+ }
59
+ },
60
+ readOnly: {
61
+ control: 'boolean',
62
+ description: 'Campo de solo lectura. No aplica estilos de borde ni fondo.',
63
+ table: {
64
+ defaultValue: {
65
+ summary: 'false'
66
+ },
67
+ type: {
68
+ summary: 'bool'
69
+ }
70
+ }
71
+ },
72
+ error: {
73
+ control: 'boolean',
74
+ description: 'Aplica los estilos de error al campo.',
75
+ table: {
76
+ defaultValue: {
77
+ summary: 'false'
78
+ },
79
+ type: {
80
+ summary: 'bool | string'
81
+ }
82
+ }
83
+ },
84
+ variant: {
85
+ control: 'select',
86
+ description: 'Variante visual. `default` tiene fondo blanco con borde, `gray` tiene fondo gris sin borde, `transparent` no tiene fondo ni borde.',
87
+ options: ['default', 'gray', 'transparent'],
88
+ table: {
89
+ defaultValue: {
90
+ summary: 'default'
91
+ },
92
+ type: {
93
+ summary: "'default' | 'gray' | 'transparent'"
94
+ }
95
+ }
96
+ },
97
+ inputSize: {
98
+ control: 'select',
99
+ description: 'Tamaño del campo. Afecta el padding interno.',
100
+ options: ['medium', 'small'],
101
+ table: {
102
+ defaultValue: {
103
+ summary: 'medium'
104
+ },
105
+ type: {
106
+ summary: "'medium' | 'small'"
107
+ }
108
+ }
109
+ },
110
+ maxLength: {
111
+ control: 'number',
112
+ description: 'Límite de caracteres.',
113
+ table: {
114
+ defaultValue: {
115
+ summary: 'undefined'
116
+ },
117
+ type: {
118
+ summary: 'number'
119
+ }
120
+ }
121
+ },
122
+ showCharacterCount: {
123
+ control: 'boolean',
124
+ description: 'Muestra el contador de caracteres a la izquierda (requiere `maxLength`).',
125
+ table: {
126
+ defaultValue: {
127
+ summary: 'false'
128
+ },
129
+ type: {
130
+ summary: 'bool'
131
+ }
132
+ }
133
+ },
134
+ maxRows: {
135
+ control: 'number',
136
+ description: 'Cantidad de filas. Si es mayor a 1, el campo se vuelve multilínea.',
137
+ table: {
138
+ defaultValue: {
139
+ summary: '1'
140
+ },
141
+ type: {
142
+ summary: 'number'
143
+ }
144
+ }
145
+ },
146
+ type: {
147
+ control: 'select',
148
+ description: 'Tipo de input. `numeric` filtra solo dígitos.',
149
+ options: ['text', 'password', 'email', 'numeric'],
150
+ table: {
151
+ defaultValue: {
152
+ summary: 'text'
153
+ },
154
+ type: {
155
+ summary: 'string'
156
+ }
157
+ }
158
+ },
159
+ leftAdornments: {
160
+ control: 'object',
161
+ description: 'Arreglo de adornos para el lado izquierdo. Cada item tiene `{ name, props }` usando los nombres de `COMPONENT_KEYS`.',
162
+ table: {
163
+ defaultValue: {
164
+ summary: '[]'
165
+ },
166
+ type: {
167
+ summary: 'Array<{ name: string, props: object }>'
168
+ }
169
+ }
170
+ },
171
+ rightAdornments: {
172
+ control: 'object',
173
+ description: 'Arreglo de adornos para el lado derecho.',
174
+ table: {
175
+ defaultValue: {
176
+ summary: '[]'
177
+ },
178
+ type: {
179
+ summary: 'Array<{ name: string, props: object }>'
180
+ }
181
+ }
182
+ }
183
+ },
184
+ parameters: {
185
+ docs: {
186
+ description: {
187
+ component: 'UTBaseInputField es el campo de texto base del design system. Maneja adornos (íconos, prefijos, sufijos, acciones, tooltips, badges), estilos por variante y estado, y el contador de caracteres. Normalmente se usa a través de UTTextInput.'
188
+ }
189
+ }
190
+ }
191
+ };
192
+ const Stateful = args => {
193
+ var _args$value;
194
+ const [value, setValue] = useState((_args$value = args.value) !== null && _args$value !== void 0 ? _args$value : '');
195
+ return /*#__PURE__*/React.createElement(UTBaseInputField, _extends({}, args, {
196
+ value: value,
197
+ onChange: setValue
198
+ }));
199
+ };
200
+ export const Playground = {
201
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
202
+ args: {
203
+ placeholder: 'Escribí algo...'
204
+ },
205
+ name: 'Playground'
206
+ };
207
+ export const Default = {
208
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
209
+ args: {
210
+ placeholder: 'Ingresá un valor...'
211
+ }
212
+ };
213
+ export const VarianteGris = {
214
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
215
+ args: {
216
+ placeholder: 'Variante gris',
217
+ variant: 'gray'
218
+ },
219
+ name: 'Variante gris'
220
+ };
221
+ export const VarianteTransparente = {
222
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
223
+ args: {
224
+ placeholder: 'Variante transparente',
225
+ variant: 'transparent'
226
+ },
227
+ name: 'Variante transparente'
228
+ };
229
+ export const ConError = {
230
+ args: {
231
+ placeholder: 'Campo con error',
232
+ value: 'valor inválido',
233
+ error: true
234
+ },
235
+ name: 'Con error'
236
+ };
237
+ export const Deshabilitado = {
238
+ args: {
239
+ placeholder: 'Campo deshabilitado',
240
+ disabled: true
241
+ }
242
+ };
243
+ export const SoloLectura = {
244
+ args: {
245
+ value: 'Valor de solo lectura',
246
+ readOnly: true
247
+ },
248
+ name: 'Solo lectura'
249
+ };
250
+ export const Pequeno = {
251
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
252
+ args: {
253
+ placeholder: 'Campo pequeño',
254
+ inputSize: 'small'
255
+ },
256
+ name: 'Pequeño'
257
+ };
258
+ export const ConIconoIzquierdo = {
259
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
260
+ args: {
261
+ placeholder: 'Buscá...',
262
+ leftAdornments: [{
263
+ name: COMPONENT_KEYS.ICON,
264
+ props: {
265
+ Icon: Search
266
+ }
267
+ }]
268
+ },
269
+ name: 'Con ícono izquierdo'
270
+ };
271
+ export const ConIconoDerecho = {
272
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
273
+ args: {
274
+ placeholder: '••••••••',
275
+ type: 'password',
276
+ rightAdornments: [{
277
+ name: COMPONENT_KEYS.ICON,
278
+ props: {
279
+ Icon: Visibility
280
+ }
281
+ }]
282
+ },
283
+ name: 'Con ícono derecho'
284
+ };
285
+ export const ConPrefix = {
286
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
287
+ args: {
288
+ placeholder: '0,00',
289
+ leftAdornments: [{
290
+ name: COMPONENT_KEYS.PREFIX,
291
+ props: {
292
+ text: '$'
293
+ }
294
+ }]
295
+ },
296
+ name: 'Con prefijo'
297
+ };
298
+ export const ConSuffix = {
299
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
300
+ args: {
301
+ placeholder: '0',
302
+ rightAdornments: [{
303
+ name: COMPONENT_KEYS.SUFFIX,
304
+ props: {
305
+ text: 'kg'
306
+ }
307
+ }]
308
+ },
309
+ name: 'Con sufijo'
310
+ };
311
+ export const ConTooltip = {
312
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
313
+ args: {
314
+ placeholder: 'CUIT sin guiones',
315
+ rightAdornments: [{
316
+ name: COMPONENT_KEYS.TOOLTIP,
317
+ props: {
318
+ tooltip: 'Ingresá el CUIT sin guiones. Ej: 20123456789'
319
+ }
320
+ }]
321
+ },
322
+ name: 'Con tooltip'
323
+ };
324
+ export const ConAccion = {
325
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
326
+ args: {
327
+ placeholder: 'Ingresá un domicilio...',
328
+ rightAdornments: [{
329
+ name: COMPONENT_KEYS.ACTION,
330
+ props: {
331
+ action: {
332
+ title: 'Buscar',
333
+ variant: 'text',
334
+ colorTheme: 'accent',
335
+ size: 'small',
336
+ onClick: () => {}
337
+ }
338
+ }
339
+ }]
340
+ },
341
+ name: 'Con acción'
342
+ };
343
+ export const ConContadorDeCaracteres = {
344
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
345
+ args: {
346
+ placeholder: 'Límite de 80 caracteres',
347
+ maxLength: 80,
348
+ showCharacterCount: true
349
+ },
350
+ name: 'Con contador de caracteres'
351
+ };
352
+ export const MultipleAdornos = {
353
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
354
+ args: {
355
+ placeholder: 'Monto en dólares',
356
+ leftAdornments: [{
357
+ name: COMPONENT_KEYS.PREFIX,
358
+ props: {
359
+ text: 'USD'
360
+ }
361
+ }],
362
+ rightAdornments: [{
363
+ name: COMPONENT_KEYS.SUFFIX,
364
+ props: {
365
+ text: '.00'
366
+ }
367
+ }, {
368
+ name: COMPONENT_KEYS.TOOLTIP,
369
+ props: {
370
+ tooltip: 'Ingresá el monto en dólares estadounidenses.'
371
+ }
372
+ }]
373
+ },
374
+ name: 'Múltiples adornos'
375
+ };
376
+ export const Multilinea = {
377
+ render: args => /*#__PURE__*/React.createElement(Stateful, args),
378
+ args: {
379
+ placeholder: 'Escribí aquí...',
380
+ maxRows: 4,
381
+ maxLength: 200,
382
+ showCharacterCount: true
383
+ },
384
+ name: 'Multilínea'
385
+ };
@@ -58,6 +58,7 @@ const UTDatePickerV0 = _ref => {
58
58
  classes: themeClasses,
59
59
  classNames,
60
60
  CustomIcon,
61
+ dataTestId,
61
62
  dayFormat,
62
63
  disableToolbar = true,
63
64
  disabled,
@@ -126,6 +127,7 @@ const UTDatePickerV0 = _ref => {
126
127
  locale: es
127
128
  }, /*#__PURE__*/React.createElement(KeyboardDatePicker, _extends({
128
129
  disabled: disabled,
130
+ "data-testid": dataTestId,
129
131
  value: pickedDate,
130
132
  label: inputVariant === 'standard' && (field === null || field === void 0 ? void 0 : field.title),
131
133
  error: shouldShowErrors(meta),
@@ -178,6 +180,7 @@ UTDatePickerV0.propTypes = {
178
180
  classes: classesPropTypes,
179
181
  CustomIcon: node,
180
182
  dayFormat: string,
183
+ dataTestId: string,
181
184
  disableToolbar: bool,
182
185
  disabled: bool,
183
186
  field: fieldType,
@@ -10,15 +10,11 @@ import UTFieldLabel from '../../../UTFieldLabel';
10
10
  import UTLabel from '../../../UTLabel';
11
11
  import UTValidation from '../../../UTValidation';
12
12
  import { COMPONENT_KEYS } from '../../../UTBaseInputField/constants';
13
- import { TEST_IDS } from '../../../../constants/testIds';
14
13
  import Calendar from './components/Calendar';
15
14
  import styles from './styles.module.scss';
16
15
  import { DEFAULT_PROPS, DEFAULT_PLACEHOLDER, OUTPUT_LABEL_MASK, TYPING_ERROR_MESSAGE } from './constants';
17
16
  import { dateMatchesFormat, getFinalDate } from './utils';
18
17
  dayjs.extend(customParseFormat);
19
- const {
20
- UTDatePickerV1TestID
21
- } = TEST_IDS;
22
18
  const CALENDAR_PAPER_PROPS = {
23
19
  onMouseDown: e => e.preventDefault()
24
20
  };
@@ -26,6 +22,7 @@ const UTDatePicker = _ref => {
26
22
  let {
27
23
  classNames = {},
28
24
  CustomIcon,
25
+ dataTestId,
29
26
  disabled,
30
27
  error = '',
31
28
  helpText,
@@ -177,8 +174,7 @@ const UTDatePicker = _ref => {
177
174
  variant: "text"
178
175
  }))) : undefined;
179
176
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
180
- className: styles.root,
181
- "data-testid": UTDatePickerV1TestID.root
177
+ className: styles.root
182
178
  }, title && /*#__PURE__*/React.createElement(UTFieldLabel, {
183
179
  className: classNames === null || classNames === void 0 ? void 0 : classNames.upperTitle,
184
180
  required: required,
@@ -188,7 +184,7 @@ const UTDatePicker = _ref => {
188
184
  }, /*#__PURE__*/React.createElement(UTBaseInputField, {
189
185
  alwaysShowPlaceholder: true,
190
186
  classNames: classNames,
191
- dataTestId: UTDatePickerV1TestID.input,
187
+ dataTestId: dataTestId,
192
188
  inputRef: inputRef,
193
189
  disabled: disabled,
194
190
  error: hasError,
@@ -212,7 +208,7 @@ const UTDatePicker = _ref => {
212
208
  variant: "small",
213
209
  withMarkdown: true
214
210
  }, helpText), variant === 'select' && errorMessage && /*#__PURE__*/React.createElement(UTValidation, {
215
- dataTestId: UTDatePickerV1TestID.errorMessage,
211
+ dataTestId: dataTestId ? "".concat(dataTestId, ".errorMessage") : undefined,
216
212
  validationData: [{
217
213
  items: [{
218
214
  status: 'error',
@@ -245,6 +241,7 @@ const UTDatePicker = _ref => {
245
241
  UTDatePicker.propTypes = {
246
242
  classNames: object,
247
243
  CustomIcon: elementType,
244
+ dataTestId: string,
248
245
  disabled: bool,
249
246
  error: string,
250
247
  helpText: string,
@@ -0,0 +1,105 @@
1
+ # UTSnackbar
2
+
3
+ Componente de notificación tipo Snackbar. Soporta cinco `colorTheme`: los cuatro semánticos (`success`, `error`, `warning`, `info`) y `white` para notificaciones neutras. La prop `variant` controla si el fondo es oscuro o claro.
4
+
5
+ ---
6
+
7
+ ## Props
8
+
9
+ | Prop | Tipo | Default | Descripción |
10
+ | ---- | ---- | ------- | ----------- |
11
+ | `message` | `string` | `undefined` | Mensaje a mostrar. Soporta markdown. |
12
+ | `open` | `boolean` | `false` | Controla si el snackbar está visible. |
13
+ | `colorTheme` | `'success' \| 'error' \| 'warning' \| 'info' \| 'white'` | `'success'` | Color de la notificación. Los valores semánticos determinan ícono y paleta. `white` usa colores neutros sin semántica. |
14
+ | `variant` | `'dark' \| 'light'` | `'dark'` | `dark` usa el color del `colorTheme` como fondo con texto blanco. `light` usa un fondo claro con texto oscuro accesible. |
15
+ | `button` | `object` | `undefined` | Configuración del botón de acción primaria. Se hace spread en `UTButton` — incluir `title` y opcionalmente `onClick`. |
16
+ | `secondaryButton` | `object` | `undefined` | Configuración del botón de acción secundaria. Igual que `button`. |
17
+ | `buttonSize` | `'small' \| 'medium' \| 'large'` | `'medium'` | Tamaño de todos los botones de acción. |
18
+ | `description` | `string` | `undefined` | Texto secundario debajo del mensaje principal. |
19
+ | `icon` | `string` | `undefined` | Nombre de ícono Tabler para sobreescribir el ícono por defecto (ej: `IconStar`). |
20
+ | `withoutIcon` | `boolean` | `undefined` | Oculta el ícono. |
21
+ | `topRight` | `boolean` | `false` | Si es `true`, aparece en la esquina superior derecha. Si es `false`, en la inferior izquierda. |
22
+ | `timeDuration` | `number` | `undefined` | Duración en ms antes del cierre automático. |
23
+ | `onClose` | `function` | `undefined` | Callback al cerrar el snackbar. |
24
+ | `classes` | `object` | `{}` | Clases CSS personalizadas para sobrescribir estilos del tema. |
25
+ | `closeDataTestId` | `string` | `undefined` | Test ID del botón de cierre. |
26
+ | `labelDataTestId` | `string` | `undefined` | Test ID del label del mensaje. |
27
+ | `descriptionDataTestId` | `string` | `undefined` | Test ID del label de descripción. |
28
+
29
+ ---
30
+
31
+ ## Variantes
32
+
33
+ ### Semántico / Dark
34
+ Fondo con el color semántico saturado y texto blanco.
35
+
36
+ | `colorTheme` | Color de fondo | Ícono |
37
+ | ------------ | -------------- | ----- |
38
+ | `success` | `success[04]` (`#118460`) | circle-check |
39
+ | `error` | `error[04]` (`#E80C2C`) | circle-x |
40
+ | `warning` | `warning[04]` (`#A86600`) | alert-triangle |
41
+ | `info` | `information[04]` (`#037DB4`) | info-circle |
42
+
43
+ ### Semántico / Light
44
+ Fondo claro con texto oscuro accesible.
45
+
46
+ | `colorTheme` | Color de fondo | Color de texto |
47
+ | ------------ | -------------- | -------------- |
48
+ | `success` | `success[01]` (`#E6F9F3`) | `success[05]` (`#055F43`) |
49
+ | `error` | `error[01]` (`#FFEBEE`) | `error[05]` (`#A0041B`) |
50
+ | `warning` | `warning[01]` (`#FFF9E6`) | `warning[05]` (`#6F4708`) |
51
+ | `info` | `information[01]` (`#EBF8FD`) | `information[05]` (`#035B83`) |
52
+
53
+ ### White
54
+ Sin semántica de color. Útil para notificaciones neutras.
55
+
56
+ | `variant` | Color de fondo | Color de texto |
57
+ | --------- | -------------- | -------------- |
58
+ | `light` | `#FFFFFF` | `dark[05]` (`#091E42`) |
59
+ | `dark` | `dark[04]` (`#182C49`) | `#FFFFFF` |
60
+
61
+ ---
62
+
63
+ ## Uso básico
64
+
65
+ ```jsx
66
+ import { UTSnackbar } from '@widergy/energy-ui';
67
+
68
+ const MiComponente = () => (
69
+ <UTSnackbar
70
+ colorTheme="success"
71
+ message="Operación completada exitosamente."
72
+ open
73
+ />
74
+ );
75
+ ```
76
+
77
+ ## Con botón de acción
78
+
79
+ ```jsx
80
+ <UTSnackbar
81
+ button={{ title: 'Deshacer', onClick: () => console.log('deshacer') }}
82
+ colorTheme="error"
83
+ message="Se eliminaron 3 elementos."
84
+ onClose={() => setOpen(false)}
85
+ open={open}
86
+ />
87
+ ```
88
+
89
+ ## Variante neutra (white)
90
+
91
+ ```jsx
92
+ <UTSnackbar
93
+ colorTheme="white"
94
+ message="Notificación sin semántica."
95
+ open
96
+ variant="light"
97
+ />
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Notas
103
+
104
+ - Los colores de fondo y texto se resuelven desde `theme.Palette` en tiempo de ejecución, por lo que respetan el tema de cada utility cliente.
105
+ - Los design tokens de componente (`--UT-snackbar-*`) están pendientes de definición por Diseño.
@@ -0,0 +1,122 @@
1
+ import { COLOR_SHADES, COLOR_THEMES as PALETTE_COLOR_THEMES } from '../../constants/Palette';
2
+ export const COLOR_THEMES = {
3
+ error: 'error',
4
+ info: 'info',
5
+ success: 'success',
6
+ warning: 'warning',
7
+ white: 'white'
8
+ };
9
+ export const VARIANTS = {
10
+ dark: 'dark',
11
+ light: 'light'
12
+ };
13
+ export const DEFAULT_PROPS = {
14
+ colorTheme: COLOR_THEMES.success,
15
+ open: false,
16
+ topRight: false,
17
+ variant: VARIANTS.dark
18
+ };
19
+ export const VARIANT_CLASS_MAP = {
20
+ ["".concat(COLOR_THEMES.success, "-").concat(VARIANTS.dark)]: 'successDark',
21
+ ["".concat(COLOR_THEMES.error, "-").concat(VARIANTS.dark)]: 'errorDark',
22
+ ["".concat(COLOR_THEMES.warning, "-").concat(VARIANTS.dark)]: 'warningDark',
23
+ ["".concat(COLOR_THEMES.info, "-").concat(VARIANTS.dark)]: 'infoDark',
24
+ ["".concat(COLOR_THEMES.success, "-").concat(VARIANTS.light)]: 'successLight',
25
+ ["".concat(COLOR_THEMES.error, "-").concat(VARIANTS.light)]: 'errorLight',
26
+ ["".concat(COLOR_THEMES.warning, "-").concat(VARIANTS.light)]: 'warningLight',
27
+ ["".concat(COLOR_THEMES.info, "-").concat(VARIANTS.light)]: 'infoLight',
28
+ ["".concat(COLOR_THEMES.white, "-").concat(VARIANTS.light)]: 'whiteLight',
29
+ ["".concat(COLOR_THEMES.white, "-").concat(VARIANTS.dark)]: 'whiteDark'
30
+ };
31
+ export const LABEL_COLOR_MAP = {
32
+ successDark: {
33
+ colorTheme: PALETTE_COLOR_THEMES.light,
34
+ shade: COLOR_SHADES.shade01
35
+ },
36
+ errorDark: {
37
+ colorTheme: PALETTE_COLOR_THEMES.light,
38
+ shade: COLOR_SHADES.shade01
39
+ },
40
+ warningDark: {
41
+ colorTheme: PALETTE_COLOR_THEMES.light,
42
+ shade: COLOR_SHADES.shade01
43
+ },
44
+ infoDark: {
45
+ colorTheme: PALETTE_COLOR_THEMES.light,
46
+ shade: COLOR_SHADES.shade01
47
+ },
48
+ successLight: {
49
+ colorTheme: PALETTE_COLOR_THEMES.success,
50
+ shade: COLOR_SHADES.shade05
51
+ },
52
+ errorLight: {
53
+ colorTheme: PALETTE_COLOR_THEMES.error,
54
+ shade: COLOR_SHADES.shade05
55
+ },
56
+ warningLight: {
57
+ colorTheme: PALETTE_COLOR_THEMES.warning,
58
+ shade: COLOR_SHADES.shade05
59
+ },
60
+ infoLight: {
61
+ colorTheme: PALETTE_COLOR_THEMES.information,
62
+ shade: COLOR_SHADES.shade05
63
+ },
64
+ whiteLight: {
65
+ colorTheme: PALETTE_COLOR_THEMES.dark,
66
+ shade: COLOR_SHADES.shade05
67
+ },
68
+ whiteDark: {
69
+ colorTheme: PALETTE_COLOR_THEMES.light,
70
+ shade: COLOR_SHADES.shade01
71
+ }
72
+ };
73
+ export const ACTION_BUTTON_CONFIG_MAP = {
74
+ successDark: {
75
+ colorTheme: PALETTE_COLOR_THEMES.negative,
76
+ variant: 'text'
77
+ },
78
+ errorDark: {
79
+ colorTheme: PALETTE_COLOR_THEMES.negative,
80
+ variant: 'text'
81
+ },
82
+ warningDark: {
83
+ colorTheme: PALETTE_COLOR_THEMES.negative,
84
+ variant: 'text'
85
+ },
86
+ infoDark: {
87
+ colorTheme: PALETTE_COLOR_THEMES.negative,
88
+ variant: 'text'
89
+ },
90
+ successLight: {
91
+ colorTheme: PALETTE_COLOR_THEMES.success,
92
+ variant: 'text'
93
+ },
94
+ errorLight: {
95
+ colorTheme: PALETTE_COLOR_THEMES.error,
96
+ variant: 'text'
97
+ },
98
+ warningLight: {
99
+ colorTheme: PALETTE_COLOR_THEMES.warning,
100
+ variant: 'text'
101
+ },
102
+ infoLight: {
103
+ colorTheme: PALETTE_COLOR_THEMES.information,
104
+ variant: 'text'
105
+ },
106
+ whiteLight: {
107
+ colorTheme: PALETTE_COLOR_THEMES.primary,
108
+ closeColorTheme: PALETTE_COLOR_THEMES.neutral,
109
+ variant: 'text'
110
+ },
111
+ whiteDark: {
112
+ colorTheme: PALETTE_COLOR_THEMES.negative,
113
+ variant: 'text'
114
+ }
115
+ };
116
+ export const ICON_NAME_MAP = {
117
+ [COLOR_THEMES.error]: 'IconCircleX',
118
+ [COLOR_THEMES.info]: 'IconInfoCircle',
119
+ [COLOR_THEMES.success]: 'IconCircleCheck',
120
+ [COLOR_THEMES.warning]: 'IconAlertTriangle',
121
+ [COLOR_THEMES.white]: 'IconInfoCircle'
122
+ };