@widergy/energy-ui 3.164.0 → 3.165.1

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 +15 -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/UTSnackbar/README.md +105 -0
  9. package/dist/components/UTSnackbar/constants.js +134 -0
  10. package/dist/components/UTSnackbar/index.js +134 -0
  11. package/dist/components/UTSnackbar/stories/UTSnackbar.stories.js +350 -0
  12. package/dist/components/UTSnackbar/stories/storiesConstants.js +169 -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/UTSnackbar/utils.js +53 -0
  17. package/dist/components/UTTextArea/UTTextArea.stories.js +342 -0
  18. package/dist/components/UTTextInput/UTTextInput.stories.js +439 -0
  19. package/dist/constants/testIds.js +9 -0
  20. package/dist/esm/components/UTAlert/README.md +100 -0
  21. package/dist/esm/components/UTAlert/stories/UTAlert.stories.js +231 -0
  22. package/dist/esm/components/UTAlert/stories/storiesConstants.js +101 -0
  23. package/dist/esm/components/UTBanner/index.js +11 -5
  24. package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +8 -0
  25. package/dist/esm/components/UTBaseInputField/UTBaseInputField.stories.js +385 -0
  26. package/dist/esm/components/UTSnackbar/README.md +105 -0
  27. package/dist/esm/components/UTSnackbar/constants.js +128 -0
  28. package/dist/esm/components/UTSnackbar/index.js +127 -0
  29. package/dist/esm/components/UTSnackbar/stories/UTSnackbar.stories.js +342 -0
  30. package/dist/esm/components/UTSnackbar/stories/storiesConstants.js +163 -0
  31. package/dist/esm/components/UTSnackbar/styles.module.scss +82 -0
  32. package/dist/esm/components/UTSnackbar/theme.js +50 -0
  33. package/dist/esm/components/UTSnackbar/types.js +14 -0
  34. package/dist/esm/components/UTSnackbar/utils.js +46 -0
  35. package/dist/esm/components/UTTextArea/UTTextArea.stories.js +334 -0
  36. package/dist/esm/components/UTTextInput/UTTextInput.stories.js +431 -0
  37. package/dist/esm/constants/testIds.js +9 -0
  38. package/dist/esm/index.js +2 -1
  39. package/dist/esm/utils/hooks/useCSSVariables/constants.js +9 -0
  40. package/dist/index.js +7 -0
  41. package/dist/utils/hooks/useCSSVariables/constants.js +9 -0
  42. package/package.json +1 -1
@@ -0,0 +1,127 @@
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 from 'react';
3
+ import { bool, func, number, oneOf, string } from 'prop-types';
4
+ import Slide from '@material-ui/core/Slide';
5
+ import Snackbar from '@material-ui/core/Snackbar';
6
+ import UTButton from '../UTButton';
7
+ import UTIcon from '../UTIcon';
8
+ import UTLabel from '../UTLabel';
9
+ import WithTheme from '../WithTheme';
10
+ import { ID_CONSTANTS } from '../../constants/testIds';
11
+ import { ACTION_BUTTON_CONFIG_MAP, COLOR_THEMES, DEFAULT_PROPS, ICON_NAME_MAP, LABEL_COLOR_MAP, POSITIONS, VARIANT_CLASS_MAP, VARIANTS } from './constants';
12
+ import { getAnchorAndTransition } from './utils';
13
+ import { retrieveMuiTheme } from './theme';
14
+ import { buttonType } from './types';
15
+ import styles from './styles.module.scss';
16
+ const UTSnackbar = _ref => {
17
+ let {
18
+ button,
19
+ colorTheme = DEFAULT_PROPS.colorTheme,
20
+ dataTestId,
21
+ description,
22
+ icon,
23
+ message,
24
+ onClose,
25
+ open = DEFAULT_PROPS.open,
26
+ position = DEFAULT_PROPS.position,
27
+ secondaryButton,
28
+ timeDuration,
29
+ variant = DEFAULT_PROPS.variant,
30
+ withoutIcon
31
+ } = _ref;
32
+ const handleClose = (_, reason) => {
33
+ if (reason === 'clickaway') return;
34
+ onClose === null || onClose === void 0 || onClose();
35
+ };
36
+ const variantKey = "".concat(colorTheme, "-").concat(variant);
37
+ const variantClassKey = VARIANT_CLASS_MAP[variantKey];
38
+ const variantClass = styles[variantClassKey] || '';
39
+ const labelColorConfig = LABEL_COLOR_MAP[variantClassKey] || LABEL_COLOR_MAP.successDark;
40
+ const actionButtonConfig = ACTION_BUTTON_CONFIG_MAP[variantClassKey];
41
+ const iconName = withoutIcon ? null : icon || ICON_NAME_MAP[colorTheme];
42
+ const {
43
+ anchor,
44
+ transition
45
+ } = getAnchorAndTransition(position);
46
+ const testIds = {
47
+ close: dataTestId ? "".concat(dataTestId, ".close") : undefined,
48
+ description: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.DESCRIPTION, ".").concat(ID_CONSTANTS.LABEL) : undefined,
49
+ icon: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.ICON) : undefined,
50
+ label: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.LABEL) : undefined,
51
+ primaryButton: dataTestId ? "".concat(dataTestId, ".button.").concat(ID_CONSTANTS.SECONDARY_ACTION) : undefined,
52
+ secondaryButton: dataTestId ? "".concat(dataTestId, ".secondaryButton.").concat(ID_CONSTANTS.TERTIARY_ACTION) : undefined
53
+ };
54
+ return /*#__PURE__*/React.createElement(Snackbar, {
55
+ action: [!!secondaryButton && /*#__PURE__*/React.createElement(UTButton, _extends({
56
+ key: "secondary",
57
+ colorTheme: actionButtonConfig.colorTheme
58
+ }, secondaryButton, {
59
+ dataTestId: testIds.secondaryButton
60
+ }), secondaryButton.title), !!button && /*#__PURE__*/React.createElement(UTButton, _extends({
61
+ key: "primary",
62
+ colorTheme: actionButtonConfig.colorTheme
63
+ }, button, {
64
+ dataTestId: testIds.primaryButton
65
+ }), button.title), /*#__PURE__*/React.createElement(UTButton, {
66
+ key: "close",
67
+ colorTheme: actionButtonConfig.closeColorTheme || actionButtonConfig.colorTheme,
68
+ dataTestId: testIds.close,
69
+ Icon: "IconX",
70
+ onClick: handleClose,
71
+ variant: actionButtonConfig.variant
72
+ })],
73
+ anchorOrigin: anchor,
74
+ autoHideDuration: timeDuration,
75
+ ContentProps: {
76
+ className: "".concat(styles.snackbarContent, " ").concat(variantClass),
77
+ classes: {
78
+ action: styles.action,
79
+ message: styles.message
80
+ }
81
+ },
82
+ message: /*#__PURE__*/React.createElement("div", {
83
+ className: styles.messageContent
84
+ }, iconName && /*#__PURE__*/React.createElement(UTIcon, {
85
+ className: styles.icon,
86
+ colorTheme: labelColorConfig.colorTheme,
87
+ dataTestId: testIds.icon,
88
+ name: iconName,
89
+ shade: labelColorConfig.shade,
90
+ size: 20
91
+ }), /*#__PURE__*/React.createElement("div", {
92
+ className: styles.textContent
93
+ }, /*#__PURE__*/React.createElement(UTLabel, {
94
+ colorTheme: labelColorConfig.colorTheme,
95
+ dataTestId: testIds.label,
96
+ shade: labelColorConfig.shade,
97
+ variant: "body",
98
+ weight: "medium",
99
+ withMarkdown: true
100
+ }, message), description && /*#__PURE__*/React.createElement(UTLabel, {
101
+ colorTheme: labelColorConfig.colorTheme,
102
+ dataTestId: testIds.description,
103
+ shade: labelColorConfig.shade,
104
+ variant: "small"
105
+ }, description))),
106
+ onClose: handleClose,
107
+ open: open,
108
+ TransitionComponent: Slide,
109
+ TransitionProps: transition
110
+ });
111
+ };
112
+ UTSnackbar.propTypes = {
113
+ button: buttonType,
114
+ colorTheme: oneOf(Object.values(COLOR_THEMES)),
115
+ dataTestId: string,
116
+ description: string,
117
+ icon: string,
118
+ message: string,
119
+ onClose: func,
120
+ open: bool,
121
+ position: oneOf(Object.values(POSITIONS)),
122
+ secondaryButton: buttonType,
123
+ timeDuration: number,
124
+ variant: oneOf(Object.values(VARIANTS)),
125
+ withoutIcon: bool
126
+ };
127
+ export default WithTheme(undefined, retrieveMuiTheme)(UTSnackbar);
@@ -0,0 +1,342 @@
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 UTButton from '../../UTButton';
4
+ import UTSnackbar from '..';
5
+ import { COLOR_THEMES, DEFAULT_PROPS, POSITIONS, VARIANTS } from '../constants';
6
+ import { ARG_TYPES } from './storiesConstants';
7
+ const SEMANTIC_COLOR_THEMES = [COLOR_THEMES.success, COLOR_THEMES.error, COLOR_THEMES.warning, COLOR_THEMES.info];
8
+ const AllTypesDemo = () => {
9
+ const [snackState, setSnackState] = useState({
10
+ open: false
11
+ });
12
+ const show = function (colorTheme) {
13
+ let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : VARIANTS.dark;
14
+ return setSnackState({
15
+ colorTheme,
16
+ message: "Alerta de tipo: ".concat(colorTheme),
17
+ open: true,
18
+ variant
19
+ });
20
+ };
21
+ const handleClose = () => setSnackState(prev => ({
22
+ ...prev,
23
+ open: false
24
+ }));
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ style: {
27
+ display: 'flex',
28
+ flexDirection: 'column',
29
+ gap: '8px',
30
+ maxWidth: '400px'
31
+ }
32
+ }, /*#__PURE__*/React.createElement("p", {
33
+ style: {
34
+ fontSize: '12px',
35
+ fontWeight: 600,
36
+ margin: '0 0 4px'
37
+ }
38
+ }, "Dark"), /*#__PURE__*/React.createElement("div", {
39
+ style: {
40
+ display: 'flex',
41
+ gap: '8px',
42
+ flexWrap: 'wrap'
43
+ }
44
+ }, SEMANTIC_COLOR_THEMES.map(colorTheme => /*#__PURE__*/React.createElement(UTButton, {
45
+ key: colorTheme,
46
+ onClick: () => show(colorTheme),
47
+ size: "small",
48
+ variant: "outlined"
49
+ }, colorTheme)), /*#__PURE__*/React.createElement(UTButton, {
50
+ onClick: () => show(COLOR_THEMES.white),
51
+ size: "small",
52
+ variant: "outlined"
53
+ }, "white")), /*#__PURE__*/React.createElement("p", {
54
+ style: {
55
+ fontSize: '12px',
56
+ fontWeight: 600,
57
+ margin: '8px 0 4px'
58
+ }
59
+ }, "Light"), /*#__PURE__*/React.createElement("div", {
60
+ style: {
61
+ display: 'flex',
62
+ gap: '8px',
63
+ flexWrap: 'wrap'
64
+ }
65
+ }, SEMANTIC_COLOR_THEMES.map(colorTheme => /*#__PURE__*/React.createElement(UTButton, {
66
+ key: colorTheme,
67
+ onClick: () => show(colorTheme, VARIANTS.light),
68
+ size: "small",
69
+ variant: "outlined"
70
+ }, colorTheme, " light")), /*#__PURE__*/React.createElement(UTButton, {
71
+ onClick: () => show(COLOR_THEMES.white, VARIANTS.light),
72
+ size: "small",
73
+ variant: "outlined"
74
+ }, "white light")), /*#__PURE__*/React.createElement(UTSnackbar, _extends({}, snackState, {
75
+ onClose: handleClose
76
+ })));
77
+ };
78
+ export default {
79
+ args: {
80
+ message: 'Operación realizada exitosamente.',
81
+ open: true,
82
+ colorTheme: DEFAULT_PROPS.colorTheme,
83
+ position: DEFAULT_PROPS.position,
84
+ variant: DEFAULT_PROPS.variant,
85
+ withoutIcon: false,
86
+ icon: undefined,
87
+ timeDuration: undefined,
88
+ button: undefined,
89
+ secondaryButton: undefined,
90
+ description: undefined
91
+ },
92
+ argTypes: ARG_TYPES,
93
+ component: UTSnackbar,
94
+ parameters: {
95
+ controls: {
96
+ exclude: ['dataTestId', 'onClose']
97
+ },
98
+ docs: {
99
+ description: {
100
+ component: '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.'
101
+ }
102
+ }
103
+ },
104
+ title: 'Energy-UI/UTSnackbar'
105
+ };
106
+ export const Playground = {
107
+ name: 'Playground'
108
+ };
109
+ export const AllVariants = {
110
+ name: 'Todas las Variantes',
111
+ parameters: {
112
+ docs: {
113
+ description: {
114
+ story: 'Hacé clic en cada botón para ver la variante correspondiente.'
115
+ }
116
+ }
117
+ },
118
+ render: () => /*#__PURE__*/React.createElement(AllTypesDemo, null)
119
+ };
120
+ export const SemanticDark = {
121
+ args: {
122
+ message: 'El archivo fue guardado correctamente.',
123
+ open: true,
124
+ colorTheme: COLOR_THEMES.success,
125
+ variant: VARIANTS.dark
126
+ },
127
+ name: 'Semántico / Dark',
128
+ parameters: {
129
+ docs: {
130
+ description: {
131
+ story: 'Fondo con el color semántico saturado y texto blanco. Cambiá `colorTheme` en el panel de controls para ver los cuatro tipos semánticos.'
132
+ }
133
+ }
134
+ }
135
+ };
136
+ export const SemanticLight = {
137
+ args: {
138
+ message: 'El archivo fue guardado correctamente.',
139
+ open: true,
140
+ colorTheme: COLOR_THEMES.success,
141
+ variant: VARIANTS.light
142
+ },
143
+ name: 'Semántico / Light',
144
+ parameters: {
145
+ docs: {
146
+ description: {
147
+ story: 'Fondo claro con texto oscuro accesible. Cambiá `colorTheme` para ver los cuatro tipos semánticos.'
148
+ }
149
+ }
150
+ }
151
+ };
152
+ export const WhiteVariants = {
153
+ args: {
154
+ message: 'Notificación sin semántica asociada.',
155
+ open: true,
156
+ colorTheme: COLOR_THEMES.white,
157
+ variant: VARIANTS.light
158
+ },
159
+ name: 'White',
160
+ parameters: {
161
+ docs: {
162
+ description: {
163
+ story: 'Variante neutra sin semántica de color. Con `variant="light"` el fondo es blanco; con `variant="dark"` el fondo es oscuro.'
164
+ }
165
+ }
166
+ }
167
+ };
168
+ export const ConAccionPrimaria = {
169
+ args: {
170
+ button: {
171
+ title: 'Deshacer'
172
+ },
173
+ message: 'Se eliminaron 3 elementos.',
174
+ open: true,
175
+ colorTheme: COLOR_THEMES.error,
176
+ variant: VARIANTS.dark
177
+ },
178
+ name: 'Con Acción Primaria',
179
+ parameters: {
180
+ docs: {
181
+ description: {
182
+ story: 'La prop `button` agrega un botón de texto a la derecha del mensaje. Pasar `onClick` dentro del objeto para manejar el evento.'
183
+ }
184
+ }
185
+ }
186
+ };
187
+ export const ConAcciones = {
188
+ args: {
189
+ button: {
190
+ title: 'Confirmar'
191
+ },
192
+ secondaryButton: {
193
+ title: 'Cancelar'
194
+ },
195
+ message: 'Se eliminaron 3 elementos.',
196
+ open: true,
197
+ colorTheme: COLOR_THEMES.error,
198
+ variant: VARIANTS.dark
199
+ },
200
+ name: 'Con Acciones Primaria y Secundaria',
201
+ parameters: {
202
+ docs: {
203
+ description: {
204
+ story: 'Con `button` y `secondaryButton` se muestran dos botones de acción. Cualquier prop de `UTButton` puede pasarse dentro del objeto para personalizar su comportamiento.'
205
+ }
206
+ }
207
+ }
208
+ };
209
+ export const ConDescripcion = {
210
+ args: {
211
+ message: 'El archivo fue guardado correctamente.',
212
+ description: 'Los cambios se aplicarán en la próxima sesión.',
213
+ open: true,
214
+ colorTheme: COLOR_THEMES.success,
215
+ variant: VARIANTS.light
216
+ },
217
+ name: 'Con Descripción',
218
+ parameters: {
219
+ docs: {
220
+ description: {
221
+ story: 'La prop `description` agrega un texto secundario debajo del mensaje principal con tipografía `small`.'
222
+ }
223
+ }
224
+ }
225
+ };
226
+ export const ConMarkdown = {
227
+ args: {
228
+ message: 'El archivo **reporte_enero.pdf** fue generado *exitosamente*.',
229
+ open: true,
230
+ colorTheme: COLOR_THEMES.success,
231
+ variant: VARIANTS.light
232
+ },
233
+ name: 'Con Markdown',
234
+ parameters: {
235
+ docs: {
236
+ description: {
237
+ story: 'El campo `message` soporta sintaxis markdown a través de `UTLabel`.'
238
+ }
239
+ }
240
+ }
241
+ };
242
+ export const TopRight = {
243
+ args: {
244
+ message: 'Esta notificación aparece en la esquina superior derecha.',
245
+ open: true,
246
+ colorTheme: COLOR_THEMES.info,
247
+ position: POSITIONS.topRight,
248
+ variant: VARIANTS.dark
249
+ },
250
+ name: 'Posición Superior Derecha',
251
+ parameters: {
252
+ docs: {
253
+ description: {
254
+ story: 'Con `position="topRight"` el snackbar aparece en la esquina superior derecha con slide desde la derecha.'
255
+ }
256
+ }
257
+ }
258
+ };
259
+ export const BottomRight = {
260
+ args: {
261
+ message: 'Esta notificación aparece en la esquina inferior derecha.',
262
+ open: true,
263
+ colorTheme: COLOR_THEMES.success,
264
+ position: POSITIONS.bottomRight,
265
+ variant: VARIANTS.dark
266
+ },
267
+ name: 'Posición Inferior Derecha',
268
+ parameters: {
269
+ docs: {
270
+ description: {
271
+ story: 'Con `position="bottomRight"` el snackbar aparece en la esquina inferior derecha con slide desde abajo.'
272
+ }
273
+ }
274
+ }
275
+ };
276
+ export const TopLeft = {
277
+ args: {
278
+ message: 'Esta notificación aparece en la esquina superior izquierda.',
279
+ open: true,
280
+ colorTheme: COLOR_THEMES.warning,
281
+ position: POSITIONS.topLeft,
282
+ variant: VARIANTS.dark
283
+ },
284
+ name: 'Posición Superior Izquierda',
285
+ parameters: {
286
+ docs: {
287
+ description: {
288
+ story: 'Con `position="topLeft"` el snackbar aparece en la esquina superior izquierda con slide desde arriba.'
289
+ }
290
+ }
291
+ }
292
+ };
293
+ export const SinIcono = {
294
+ args: {
295
+ message: 'Notificación sin ícono.',
296
+ open: true,
297
+ colorTheme: COLOR_THEMES.warning,
298
+ variant: VARIANTS.dark,
299
+ withoutIcon: true
300
+ },
301
+ name: 'Sin Ícono',
302
+ parameters: {
303
+ docs: {
304
+ description: {
305
+ story: 'Con `withoutIcon: true` se oculta el ícono.'
306
+ }
307
+ }
308
+ }
309
+ };
310
+ export const Test = {
311
+ name: 'Test',
312
+ parameters: {
313
+ docs: {
314
+ description: {
315
+ story: 'Story para el Storybook Test Runner. Renderiza variantes simultáneas para verificar el correcto renderizado.'
316
+ }
317
+ }
318
+ },
319
+ render: () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UTSnackbar, {
320
+ colorTheme: COLOR_THEMES.success,
321
+ message: "success dark",
322
+ open: true
323
+ }), /*#__PURE__*/React.createElement(UTSnackbar, {
324
+ colorTheme: COLOR_THEMES.error,
325
+ message: "error light",
326
+ open: true,
327
+ variant: VARIANTS.light
328
+ }), /*#__PURE__*/React.createElement(UTSnackbar, {
329
+ colorTheme: COLOR_THEMES.white,
330
+ message: "white dark",
331
+ open: true,
332
+ variant: VARIANTS.dark
333
+ }), /*#__PURE__*/React.createElement(UTSnackbar, {
334
+ button: {
335
+ title: 'Acción'
336
+ },
337
+ colorTheme: COLOR_THEMES.info,
338
+ description: "Texto secundario de descripci\xF3n",
339
+ message: "Con descripci\xF3n",
340
+ open: true
341
+ }))
342
+ };
@@ -0,0 +1,163 @@
1
+ import { joinArgTypes } from 'stories/utils';
2
+ import { COLOR_THEMES, POSITIONS, VARIANTS } from '../constants';
3
+ export const ARG_TYPES = {
4
+ button: {
5
+ control: 'object',
6
+ description: 'Configuración del botón de acción primaria. Se hace spread en UTButton — incluir `title` como label y `onClick` como callback.',
7
+ table: {
8
+ defaultValue: {
9
+ summary: 'undefined'
10
+ },
11
+ type: {
12
+ summary: 'shape'
13
+ }
14
+ }
15
+ },
16
+ colorTheme: {
17
+ control: 'select',
18
+ description: 'Tipo de color de la notificación. `success`, `error`, `warning` e `info` usan colores semánticos con ícono asociado. `white` usa colores neutros sin semántica.',
19
+ options: Object.values(COLOR_THEMES),
20
+ table: {
21
+ defaultValue: {
22
+ summary: COLOR_THEMES.success
23
+ },
24
+ type: {
25
+ summary: joinArgTypes(Object.values(COLOR_THEMES))
26
+ }
27
+ }
28
+ },
29
+ icon: {
30
+ control: 'text',
31
+ description: 'Nombre del ícono Tabler para sobreescribir el ícono por defecto (ej: `IconStar`). Si no se indica, se usa el ícono correspondiente al `colorTheme`.',
32
+ table: {
33
+ defaultValue: {
34
+ summary: 'undefined'
35
+ },
36
+ type: {
37
+ summary: 'string'
38
+ }
39
+ }
40
+ },
41
+ description: {
42
+ control: 'text',
43
+ description: 'Texto secundario debajo del mensaje principal.',
44
+ table: {
45
+ defaultValue: {
46
+ summary: 'undefined'
47
+ },
48
+ type: {
49
+ summary: 'string'
50
+ }
51
+ }
52
+ },
53
+ dataTestId: {
54
+ control: false,
55
+ description: 'Identificador de test raíz. Los sub-elementos derivan su testId automáticamente: `.icon`, `.label`, `.description.label`, `.close`, `.button.secondaryAction`, `.secondaryButton.tertiaryAction`.',
56
+ table: {
57
+ defaultValue: {
58
+ summary: 'undefined'
59
+ },
60
+ type: {
61
+ summary: 'string'
62
+ }
63
+ }
64
+ },
65
+ message: {
66
+ control: 'text',
67
+ description: 'Mensaje principal a mostrar. Soporta markdown.',
68
+ table: {
69
+ defaultValue: {
70
+ summary: 'undefined'
71
+ },
72
+ type: {
73
+ summary: 'string'
74
+ }
75
+ }
76
+ },
77
+ onClose: {
78
+ control: false,
79
+ description: 'Callback ejecutado al cerrar el snackbar.',
80
+ table: {
81
+ defaultValue: {
82
+ summary: 'undefined'
83
+ },
84
+ type: {
85
+ summary: 'function'
86
+ }
87
+ }
88
+ },
89
+ open: {
90
+ control: 'boolean',
91
+ description: 'Controla si el snackbar está visible.',
92
+ table: {
93
+ defaultValue: {
94
+ summary: 'false'
95
+ },
96
+ type: {
97
+ summary: 'boolean'
98
+ }
99
+ }
100
+ },
101
+ secondaryButton: {
102
+ control: 'object',
103
+ description: 'Configuración del botón de acción secundaria. Se hace spread en UTButton — incluir `title` como label y `onClick` como callback.',
104
+ table: {
105
+ defaultValue: {
106
+ summary: 'undefined'
107
+ },
108
+ type: {
109
+ summary: 'shape'
110
+ }
111
+ }
112
+ },
113
+ timeDuration: {
114
+ control: 'number',
115
+ description: 'Duración en milisegundos antes del cierre automático.',
116
+ table: {
117
+ defaultValue: {
118
+ summary: 'undefined'
119
+ },
120
+ type: {
121
+ summary: 'number'
122
+ }
123
+ }
124
+ },
125
+ position: {
126
+ control: 'select',
127
+ description: 'Posición del snackbar en la pantalla.',
128
+ options: Object.values(POSITIONS),
129
+ table: {
130
+ defaultValue: {
131
+ summary: POSITIONS.bottomLeft
132
+ },
133
+ type: {
134
+ summary: joinArgTypes(Object.values(POSITIONS))
135
+ }
136
+ }
137
+ },
138
+ variant: {
139
+ control: 'inline-radio',
140
+ description: '`dark` usa el color del `colorTheme` como fondo con texto blanco; `light` usa una versión clara con texto oscuro accesible.',
141
+ options: Object.values(VARIANTS),
142
+ table: {
143
+ defaultValue: {
144
+ summary: VARIANTS.dark
145
+ },
146
+ type: {
147
+ summary: joinArgTypes(Object.values(VARIANTS))
148
+ }
149
+ }
150
+ },
151
+ withoutIcon: {
152
+ control: 'boolean',
153
+ description: 'Si es `true`, oculta el ícono.',
154
+ table: {
155
+ defaultValue: {
156
+ summary: 'undefined'
157
+ },
158
+ type: {
159
+ summary: 'boolean'
160
+ }
161
+ }
162
+ }
163
+ };
@@ -0,0 +1,82 @@
1
+ .snackbarContent {
2
+ flex-wrap: nowrap;
3
+ }
4
+
5
+ .message {
6
+ display: flex;
7
+ align-items: center;
8
+ min-width: 0;
9
+ }
10
+
11
+ .messageContent {
12
+ display: flex;
13
+ align-items: flex-start;
14
+ gap: var(--UT-snackbar-gap-icon, 8px);
15
+ }
16
+
17
+ .icon {
18
+ flex-shrink: 0;
19
+ margin-top: var(--UT-snackbar-icon-offset, 2px);
20
+ }
21
+
22
+ .textContent {
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: var(--UT-snackbar-gap-description, 4px);
26
+ min-width: 0;
27
+ }
28
+
29
+ .action {
30
+ flex-shrink: 0;
31
+ gap: var(--UT-snackbar-gap-actions, 4px);
32
+ }
33
+
34
+ .successDark {
35
+ background-color: var(--semanticSuccess04);
36
+ color: var(--light01);
37
+ }
38
+
39
+ .errorDark {
40
+ background-color: var(--actionError04);
41
+ color: var(--light01);
42
+ }
43
+
44
+ .warningDark {
45
+ background-color: var(--semanticWarning04);
46
+ color: var(--light01);
47
+ }
48
+
49
+ .infoDark {
50
+ background-color: var(--semanticInformation04);
51
+ color: var(--light01);
52
+ }
53
+
54
+ .successLight {
55
+ background-color: var(--semanticSuccess01);
56
+ color: var(--semanticSuccess05);
57
+ }
58
+
59
+ .errorLight {
60
+ background-color: var(--actionError01);
61
+ color: var(--actionError05);
62
+ }
63
+
64
+ .warningLight {
65
+ background-color: var(--semanticWarning01);
66
+ color: var(--semanticWarning05);
67
+ }
68
+
69
+ .infoLight {
70
+ background-color: var(--semanticInformation01);
71
+ color: var(--semanticInformation05);
72
+ }
73
+
74
+ .whiteLight {
75
+ background-color: var(--light01);
76
+ color: var(--dark05);
77
+ }
78
+
79
+ .whiteDark {
80
+ background-color: var(--dark04);
81
+ color: var(--light01);
82
+ }