@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.
- package/CHANGELOG.md +15 -4
- package/dist/components/UTAlert/README.md +100 -0
- package/dist/components/UTAlert/stories/UTAlert.stories.js +239 -0
- package/dist/components/UTAlert/stories/storiesConstants.js +107 -0
- package/dist/components/UTBanner/index.js +11 -5
- package/dist/components/UTBanner/stories/UTBanner.stories.js +8 -0
- package/dist/components/UTBaseInputField/UTBaseInputField.stories.js +393 -0
- package/dist/components/UTSnackbar/README.md +105 -0
- package/dist/components/UTSnackbar/constants.js +134 -0
- package/dist/components/UTSnackbar/index.js +134 -0
- package/dist/components/UTSnackbar/stories/UTSnackbar.stories.js +350 -0
- package/dist/components/UTSnackbar/stories/storiesConstants.js +169 -0
- package/dist/components/UTSnackbar/styles.module.scss +82 -0
- package/dist/components/UTSnackbar/theme.js +57 -0
- package/dist/components/UTSnackbar/types.js +20 -0
- package/dist/components/UTSnackbar/utils.js +53 -0
- package/dist/components/UTTextArea/UTTextArea.stories.js +342 -0
- package/dist/components/UTTextInput/UTTextInput.stories.js +439 -0
- package/dist/constants/testIds.js +9 -0
- package/dist/esm/components/UTAlert/README.md +100 -0
- package/dist/esm/components/UTAlert/stories/UTAlert.stories.js +231 -0
- package/dist/esm/components/UTAlert/stories/storiesConstants.js +101 -0
- package/dist/esm/components/UTBanner/index.js +11 -5
- package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +8 -0
- package/dist/esm/components/UTBaseInputField/UTBaseInputField.stories.js +385 -0
- package/dist/esm/components/UTSnackbar/README.md +105 -0
- package/dist/esm/components/UTSnackbar/constants.js +128 -0
- package/dist/esm/components/UTSnackbar/index.js +127 -0
- package/dist/esm/components/UTSnackbar/stories/UTSnackbar.stories.js +342 -0
- package/dist/esm/components/UTSnackbar/stories/storiesConstants.js +163 -0
- package/dist/esm/components/UTSnackbar/styles.module.scss +82 -0
- package/dist/esm/components/UTSnackbar/theme.js +50 -0
- package/dist/esm/components/UTSnackbar/types.js +14 -0
- package/dist/esm/components/UTSnackbar/utils.js +46 -0
- package/dist/esm/components/UTTextArea/UTTextArea.stories.js +334 -0
- package/dist/esm/components/UTTextInput/UTTextInput.stories.js +431 -0
- package/dist/esm/constants/testIds.js +9 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +9 -0
- package/dist/index.js +7 -0
- package/dist/utils/hooks/useCSSVariables/constants.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.VarianteTransparente = exports.VarianteGris = exports.SoloLectura = exports.Playground = exports.Pequeno = exports.MultipleAdornos = exports.Multilinea = exports.Deshabilitado = exports.Default = exports.ConTooltip = exports.ConSuffix = exports.ConPrefix = exports.ConIconoIzquierdo = exports.ConIconoDerecho = exports.ConError = exports.ConContadorDeCaracteres = exports.ConAccion = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Search = _interopRequireDefault(require("@material-ui/icons/Search"));
|
|
9
|
+
var _Visibility = _interopRequireDefault(require("@material-ui/icons/Visibility"));
|
|
10
|
+
var _constants = require("./constants");
|
|
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/UTBaseInputField',
|
|
17
|
+
component: _.default,
|
|
18
|
+
args: {
|
|
19
|
+
placeholder: 'Ingresá un valor...',
|
|
20
|
+
value: ''
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
placeholder: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Texto de placeholder.',
|
|
26
|
+
table: {
|
|
27
|
+
defaultValue: {
|
|
28
|
+
summary: 'undefined'
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
summary: 'string'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
value: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Valor actual del campo.',
|
|
38
|
+
table: {
|
|
39
|
+
defaultValue: {
|
|
40
|
+
summary: 'null'
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
summary: 'string'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onChange: {
|
|
48
|
+
action: 'onChange',
|
|
49
|
+
description: 'Callback al cambiar el valor. Recibe el string del nuevo valor.',
|
|
50
|
+
table: {
|
|
51
|
+
type: {
|
|
52
|
+
summary: 'func'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
control: 'boolean',
|
|
58
|
+
description: 'Deshabilita el campo.',
|
|
59
|
+
table: {
|
|
60
|
+
defaultValue: {
|
|
61
|
+
summary: 'false'
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
summary: 'bool'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
readOnly: {
|
|
69
|
+
control: 'boolean',
|
|
70
|
+
description: 'Campo de solo lectura. No aplica estilos de borde ni fondo.',
|
|
71
|
+
table: {
|
|
72
|
+
defaultValue: {
|
|
73
|
+
summary: 'false'
|
|
74
|
+
},
|
|
75
|
+
type: {
|
|
76
|
+
summary: 'bool'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
error: {
|
|
81
|
+
control: 'boolean',
|
|
82
|
+
description: 'Aplica los estilos de error al campo.',
|
|
83
|
+
table: {
|
|
84
|
+
defaultValue: {
|
|
85
|
+
summary: 'false'
|
|
86
|
+
},
|
|
87
|
+
type: {
|
|
88
|
+
summary: 'bool | string'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
variant: {
|
|
93
|
+
control: 'select',
|
|
94
|
+
description: 'Variante visual. `default` tiene fondo blanco con borde, `gray` tiene fondo gris sin borde, `transparent` no tiene fondo ni borde.',
|
|
95
|
+
options: ['default', 'gray', 'transparent'],
|
|
96
|
+
table: {
|
|
97
|
+
defaultValue: {
|
|
98
|
+
summary: 'default'
|
|
99
|
+
},
|
|
100
|
+
type: {
|
|
101
|
+
summary: "'default' | 'gray' | 'transparent'"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
inputSize: {
|
|
106
|
+
control: 'select',
|
|
107
|
+
description: 'Tamaño del campo. Afecta el padding interno.',
|
|
108
|
+
options: ['medium', 'small'],
|
|
109
|
+
table: {
|
|
110
|
+
defaultValue: {
|
|
111
|
+
summary: 'medium'
|
|
112
|
+
},
|
|
113
|
+
type: {
|
|
114
|
+
summary: "'medium' | 'small'"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
maxLength: {
|
|
119
|
+
control: 'number',
|
|
120
|
+
description: 'Límite de caracteres.',
|
|
121
|
+
table: {
|
|
122
|
+
defaultValue: {
|
|
123
|
+
summary: 'undefined'
|
|
124
|
+
},
|
|
125
|
+
type: {
|
|
126
|
+
summary: 'number'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
showCharacterCount: {
|
|
131
|
+
control: 'boolean',
|
|
132
|
+
description: 'Muestra el contador de caracteres a la izquierda (requiere `maxLength`).',
|
|
133
|
+
table: {
|
|
134
|
+
defaultValue: {
|
|
135
|
+
summary: 'false'
|
|
136
|
+
},
|
|
137
|
+
type: {
|
|
138
|
+
summary: 'bool'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
maxRows: {
|
|
143
|
+
control: 'number',
|
|
144
|
+
description: 'Cantidad de filas. Si es mayor a 1, el campo se vuelve multilínea.',
|
|
145
|
+
table: {
|
|
146
|
+
defaultValue: {
|
|
147
|
+
summary: '1'
|
|
148
|
+
},
|
|
149
|
+
type: {
|
|
150
|
+
summary: 'number'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
type: {
|
|
155
|
+
control: 'select',
|
|
156
|
+
description: 'Tipo de input. `numeric` filtra solo dígitos.',
|
|
157
|
+
options: ['text', 'password', 'email', 'numeric'],
|
|
158
|
+
table: {
|
|
159
|
+
defaultValue: {
|
|
160
|
+
summary: 'text'
|
|
161
|
+
},
|
|
162
|
+
type: {
|
|
163
|
+
summary: 'string'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
leftAdornments: {
|
|
168
|
+
control: 'object',
|
|
169
|
+
description: 'Arreglo de adornos para el lado izquierdo. Cada item tiene `{ name, props }` usando los nombres de `COMPONENT_KEYS`.',
|
|
170
|
+
table: {
|
|
171
|
+
defaultValue: {
|
|
172
|
+
summary: '[]'
|
|
173
|
+
},
|
|
174
|
+
type: {
|
|
175
|
+
summary: 'Array<{ name: string, props: object }>'
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
rightAdornments: {
|
|
180
|
+
control: 'object',
|
|
181
|
+
description: 'Arreglo de adornos para el lado derecho.',
|
|
182
|
+
table: {
|
|
183
|
+
defaultValue: {
|
|
184
|
+
summary: '[]'
|
|
185
|
+
},
|
|
186
|
+
type: {
|
|
187
|
+
summary: 'Array<{ name: string, props: object }>'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
parameters: {
|
|
193
|
+
docs: {
|
|
194
|
+
description: {
|
|
195
|
+
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.'
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const Stateful = args => {
|
|
201
|
+
var _args$value;
|
|
202
|
+
const [value, setValue] = (0, _react.useState)((_args$value = args.value) !== null && _args$value !== void 0 ? _args$value : '');
|
|
203
|
+
return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, args, {
|
|
204
|
+
value: value,
|
|
205
|
+
onChange: setValue
|
|
206
|
+
}));
|
|
207
|
+
};
|
|
208
|
+
const Playground = exports.Playground = {
|
|
209
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
210
|
+
args: {
|
|
211
|
+
placeholder: 'Escribí algo...'
|
|
212
|
+
},
|
|
213
|
+
name: 'Playground'
|
|
214
|
+
};
|
|
215
|
+
const Default = exports.Default = {
|
|
216
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
217
|
+
args: {
|
|
218
|
+
placeholder: 'Ingresá un valor...'
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const VarianteGris = exports.VarianteGris = {
|
|
222
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
223
|
+
args: {
|
|
224
|
+
placeholder: 'Variante gris',
|
|
225
|
+
variant: 'gray'
|
|
226
|
+
},
|
|
227
|
+
name: 'Variante gris'
|
|
228
|
+
};
|
|
229
|
+
const VarianteTransparente = exports.VarianteTransparente = {
|
|
230
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
231
|
+
args: {
|
|
232
|
+
placeholder: 'Variante transparente',
|
|
233
|
+
variant: 'transparent'
|
|
234
|
+
},
|
|
235
|
+
name: 'Variante transparente'
|
|
236
|
+
};
|
|
237
|
+
const ConError = exports.ConError = {
|
|
238
|
+
args: {
|
|
239
|
+
placeholder: 'Campo con error',
|
|
240
|
+
value: 'valor inválido',
|
|
241
|
+
error: true
|
|
242
|
+
},
|
|
243
|
+
name: 'Con error'
|
|
244
|
+
};
|
|
245
|
+
const Deshabilitado = exports.Deshabilitado = {
|
|
246
|
+
args: {
|
|
247
|
+
placeholder: 'Campo deshabilitado',
|
|
248
|
+
disabled: true
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
const SoloLectura = exports.SoloLectura = {
|
|
252
|
+
args: {
|
|
253
|
+
value: 'Valor de solo lectura',
|
|
254
|
+
readOnly: true
|
|
255
|
+
},
|
|
256
|
+
name: 'Solo lectura'
|
|
257
|
+
};
|
|
258
|
+
const Pequeno = exports.Pequeno = {
|
|
259
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
260
|
+
args: {
|
|
261
|
+
placeholder: 'Campo pequeño',
|
|
262
|
+
inputSize: 'small'
|
|
263
|
+
},
|
|
264
|
+
name: 'Pequeño'
|
|
265
|
+
};
|
|
266
|
+
const ConIconoIzquierdo = exports.ConIconoIzquierdo = {
|
|
267
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
268
|
+
args: {
|
|
269
|
+
placeholder: 'Buscá...',
|
|
270
|
+
leftAdornments: [{
|
|
271
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
272
|
+
props: {
|
|
273
|
+
Icon: _Search.default
|
|
274
|
+
}
|
|
275
|
+
}]
|
|
276
|
+
},
|
|
277
|
+
name: 'Con ícono izquierdo'
|
|
278
|
+
};
|
|
279
|
+
const ConIconoDerecho = exports.ConIconoDerecho = {
|
|
280
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
281
|
+
args: {
|
|
282
|
+
placeholder: '••••••••',
|
|
283
|
+
type: 'password',
|
|
284
|
+
rightAdornments: [{
|
|
285
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
286
|
+
props: {
|
|
287
|
+
Icon: _Visibility.default
|
|
288
|
+
}
|
|
289
|
+
}]
|
|
290
|
+
},
|
|
291
|
+
name: 'Con ícono derecho'
|
|
292
|
+
};
|
|
293
|
+
const ConPrefix = exports.ConPrefix = {
|
|
294
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
295
|
+
args: {
|
|
296
|
+
placeholder: '0,00',
|
|
297
|
+
leftAdornments: [{
|
|
298
|
+
name: _constants.COMPONENT_KEYS.PREFIX,
|
|
299
|
+
props: {
|
|
300
|
+
text: '$'
|
|
301
|
+
}
|
|
302
|
+
}]
|
|
303
|
+
},
|
|
304
|
+
name: 'Con prefijo'
|
|
305
|
+
};
|
|
306
|
+
const ConSuffix = exports.ConSuffix = {
|
|
307
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
308
|
+
args: {
|
|
309
|
+
placeholder: '0',
|
|
310
|
+
rightAdornments: [{
|
|
311
|
+
name: _constants.COMPONENT_KEYS.SUFFIX,
|
|
312
|
+
props: {
|
|
313
|
+
text: 'kg'
|
|
314
|
+
}
|
|
315
|
+
}]
|
|
316
|
+
},
|
|
317
|
+
name: 'Con sufijo'
|
|
318
|
+
};
|
|
319
|
+
const ConTooltip = exports.ConTooltip = {
|
|
320
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
321
|
+
args: {
|
|
322
|
+
placeholder: 'CUIT sin guiones',
|
|
323
|
+
rightAdornments: [{
|
|
324
|
+
name: _constants.COMPONENT_KEYS.TOOLTIP,
|
|
325
|
+
props: {
|
|
326
|
+
tooltip: 'Ingresá el CUIT sin guiones. Ej: 20123456789'
|
|
327
|
+
}
|
|
328
|
+
}]
|
|
329
|
+
},
|
|
330
|
+
name: 'Con tooltip'
|
|
331
|
+
};
|
|
332
|
+
const ConAccion = exports.ConAccion = {
|
|
333
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
334
|
+
args: {
|
|
335
|
+
placeholder: 'Ingresá un domicilio...',
|
|
336
|
+
rightAdornments: [{
|
|
337
|
+
name: _constants.COMPONENT_KEYS.ACTION,
|
|
338
|
+
props: {
|
|
339
|
+
action: {
|
|
340
|
+
title: 'Buscar',
|
|
341
|
+
variant: 'text',
|
|
342
|
+
colorTheme: 'accent',
|
|
343
|
+
size: 'small',
|
|
344
|
+
onClick: () => {}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}]
|
|
348
|
+
},
|
|
349
|
+
name: 'Con acción'
|
|
350
|
+
};
|
|
351
|
+
const ConContadorDeCaracteres = exports.ConContadorDeCaracteres = {
|
|
352
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
353
|
+
args: {
|
|
354
|
+
placeholder: 'Límite de 80 caracteres',
|
|
355
|
+
maxLength: 80,
|
|
356
|
+
showCharacterCount: true
|
|
357
|
+
},
|
|
358
|
+
name: 'Con contador de caracteres'
|
|
359
|
+
};
|
|
360
|
+
const MultipleAdornos = exports.MultipleAdornos = {
|
|
361
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
362
|
+
args: {
|
|
363
|
+
placeholder: 'Monto en dólares',
|
|
364
|
+
leftAdornments: [{
|
|
365
|
+
name: _constants.COMPONENT_KEYS.PREFIX,
|
|
366
|
+
props: {
|
|
367
|
+
text: 'USD'
|
|
368
|
+
}
|
|
369
|
+
}],
|
|
370
|
+
rightAdornments: [{
|
|
371
|
+
name: _constants.COMPONENT_KEYS.SUFFIX,
|
|
372
|
+
props: {
|
|
373
|
+
text: '.00'
|
|
374
|
+
}
|
|
375
|
+
}, {
|
|
376
|
+
name: _constants.COMPONENT_KEYS.TOOLTIP,
|
|
377
|
+
props: {
|
|
378
|
+
tooltip: 'Ingresá el monto en dólares estadounidenses.'
|
|
379
|
+
}
|
|
380
|
+
}]
|
|
381
|
+
},
|
|
382
|
+
name: 'Múltiples adornos'
|
|
383
|
+
};
|
|
384
|
+
const Multilinea = exports.Multilinea = {
|
|
385
|
+
render: args => /*#__PURE__*/_react.default.createElement(Stateful, args),
|
|
386
|
+
args: {
|
|
387
|
+
placeholder: 'Escribí aquí...',
|
|
388
|
+
maxRows: 4,
|
|
389
|
+
maxLength: 200,
|
|
390
|
+
showCharacterCount: true
|
|
391
|
+
},
|
|
392
|
+
name: 'Multilínea'
|
|
393
|
+
};
|
|
@@ -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
|
+
| `position` | `'bottomLeft' \| 'bottomRight' \| 'topLeft' \| 'topRight'` | `'bottomLeft'` | Posición del snackbar en la pantalla. Determina también la dirección del slide de entrada. |
|
|
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,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VARIANT_CLASS_MAP = exports.VARIANTS = exports.POSITIONS = exports.LABEL_COLOR_MAP = exports.ICON_NAME_MAP = exports.DEFAULT_PROPS = exports.COLOR_THEMES = exports.ACTION_BUTTON_CONFIG_MAP = void 0;
|
|
7
|
+
var _Palette = require("../../constants/Palette");
|
|
8
|
+
const COLOR_THEMES = exports.COLOR_THEMES = {
|
|
9
|
+
error: 'error',
|
|
10
|
+
info: 'info',
|
|
11
|
+
success: 'success',
|
|
12
|
+
warning: 'warning',
|
|
13
|
+
white: 'white'
|
|
14
|
+
};
|
|
15
|
+
const VARIANTS = exports.VARIANTS = {
|
|
16
|
+
dark: 'dark',
|
|
17
|
+
light: 'light'
|
|
18
|
+
};
|
|
19
|
+
const POSITIONS = exports.POSITIONS = {
|
|
20
|
+
bottomLeft: 'bottomLeft',
|
|
21
|
+
bottomRight: 'bottomRight',
|
|
22
|
+
topLeft: 'topLeft',
|
|
23
|
+
topRight: 'topRight'
|
|
24
|
+
};
|
|
25
|
+
const DEFAULT_PROPS = exports.DEFAULT_PROPS = {
|
|
26
|
+
colorTheme: COLOR_THEMES.success,
|
|
27
|
+
open: false,
|
|
28
|
+
position: POSITIONS.bottomLeft,
|
|
29
|
+
variant: VARIANTS.dark
|
|
30
|
+
};
|
|
31
|
+
const VARIANT_CLASS_MAP = exports.VARIANT_CLASS_MAP = {
|
|
32
|
+
["".concat(COLOR_THEMES.success, "-").concat(VARIANTS.dark)]: 'successDark',
|
|
33
|
+
["".concat(COLOR_THEMES.error, "-").concat(VARIANTS.dark)]: 'errorDark',
|
|
34
|
+
["".concat(COLOR_THEMES.warning, "-").concat(VARIANTS.dark)]: 'warningDark',
|
|
35
|
+
["".concat(COLOR_THEMES.info, "-").concat(VARIANTS.dark)]: 'infoDark',
|
|
36
|
+
["".concat(COLOR_THEMES.success, "-").concat(VARIANTS.light)]: 'successLight',
|
|
37
|
+
["".concat(COLOR_THEMES.error, "-").concat(VARIANTS.light)]: 'errorLight',
|
|
38
|
+
["".concat(COLOR_THEMES.warning, "-").concat(VARIANTS.light)]: 'warningLight',
|
|
39
|
+
["".concat(COLOR_THEMES.info, "-").concat(VARIANTS.light)]: 'infoLight',
|
|
40
|
+
["".concat(COLOR_THEMES.white, "-").concat(VARIANTS.light)]: 'whiteLight',
|
|
41
|
+
["".concat(COLOR_THEMES.white, "-").concat(VARIANTS.dark)]: 'whiteDark'
|
|
42
|
+
};
|
|
43
|
+
const LABEL_COLOR_MAP = exports.LABEL_COLOR_MAP = {
|
|
44
|
+
successDark: {
|
|
45
|
+
colorTheme: _Palette.COLOR_THEMES.light,
|
|
46
|
+
shade: _Palette.COLOR_SHADES.shade01
|
|
47
|
+
},
|
|
48
|
+
errorDark: {
|
|
49
|
+
colorTheme: _Palette.COLOR_THEMES.light,
|
|
50
|
+
shade: _Palette.COLOR_SHADES.shade01
|
|
51
|
+
},
|
|
52
|
+
warningDark: {
|
|
53
|
+
colorTheme: _Palette.COLOR_THEMES.light,
|
|
54
|
+
shade: _Palette.COLOR_SHADES.shade01
|
|
55
|
+
},
|
|
56
|
+
infoDark: {
|
|
57
|
+
colorTheme: _Palette.COLOR_THEMES.light,
|
|
58
|
+
shade: _Palette.COLOR_SHADES.shade01
|
|
59
|
+
},
|
|
60
|
+
successLight: {
|
|
61
|
+
colorTheme: _Palette.COLOR_THEMES.success,
|
|
62
|
+
shade: _Palette.COLOR_SHADES.shade05
|
|
63
|
+
},
|
|
64
|
+
errorLight: {
|
|
65
|
+
colorTheme: _Palette.COLOR_THEMES.error,
|
|
66
|
+
shade: _Palette.COLOR_SHADES.shade05
|
|
67
|
+
},
|
|
68
|
+
warningLight: {
|
|
69
|
+
colorTheme: _Palette.COLOR_THEMES.warning,
|
|
70
|
+
shade: _Palette.COLOR_SHADES.shade05
|
|
71
|
+
},
|
|
72
|
+
infoLight: {
|
|
73
|
+
colorTheme: _Palette.COLOR_THEMES.information,
|
|
74
|
+
shade: _Palette.COLOR_SHADES.shade05
|
|
75
|
+
},
|
|
76
|
+
whiteLight: {
|
|
77
|
+
colorTheme: _Palette.COLOR_THEMES.dark,
|
|
78
|
+
shade: _Palette.COLOR_SHADES.shade05
|
|
79
|
+
},
|
|
80
|
+
whiteDark: {
|
|
81
|
+
colorTheme: _Palette.COLOR_THEMES.light,
|
|
82
|
+
shade: _Palette.COLOR_SHADES.shade01
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const ACTION_BUTTON_CONFIG_MAP = exports.ACTION_BUTTON_CONFIG_MAP = {
|
|
86
|
+
successDark: {
|
|
87
|
+
colorTheme: _Palette.COLOR_THEMES.negative,
|
|
88
|
+
variant: 'text'
|
|
89
|
+
},
|
|
90
|
+
errorDark: {
|
|
91
|
+
colorTheme: _Palette.COLOR_THEMES.negative,
|
|
92
|
+
variant: 'text'
|
|
93
|
+
},
|
|
94
|
+
warningDark: {
|
|
95
|
+
colorTheme: _Palette.COLOR_THEMES.negative,
|
|
96
|
+
variant: 'text'
|
|
97
|
+
},
|
|
98
|
+
infoDark: {
|
|
99
|
+
colorTheme: _Palette.COLOR_THEMES.negative,
|
|
100
|
+
variant: 'text'
|
|
101
|
+
},
|
|
102
|
+
successLight: {
|
|
103
|
+
colorTheme: _Palette.COLOR_THEMES.success,
|
|
104
|
+
variant: 'text'
|
|
105
|
+
},
|
|
106
|
+
errorLight: {
|
|
107
|
+
colorTheme: _Palette.COLOR_THEMES.error,
|
|
108
|
+
variant: 'text'
|
|
109
|
+
},
|
|
110
|
+
warningLight: {
|
|
111
|
+
colorTheme: _Palette.COLOR_THEMES.warning,
|
|
112
|
+
variant: 'text'
|
|
113
|
+
},
|
|
114
|
+
infoLight: {
|
|
115
|
+
colorTheme: _Palette.COLOR_THEMES.information,
|
|
116
|
+
variant: 'text'
|
|
117
|
+
},
|
|
118
|
+
whiteLight: {
|
|
119
|
+
colorTheme: _Palette.COLOR_THEMES.primary,
|
|
120
|
+
closeColorTheme: _Palette.COLOR_THEMES.neutral,
|
|
121
|
+
variant: 'text'
|
|
122
|
+
},
|
|
123
|
+
whiteDark: {
|
|
124
|
+
colorTheme: _Palette.COLOR_THEMES.negative,
|
|
125
|
+
variant: 'text'
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const ICON_NAME_MAP = exports.ICON_NAME_MAP = {
|
|
129
|
+
[COLOR_THEMES.error]: 'IconCircleX',
|
|
130
|
+
[COLOR_THEMES.info]: 'IconInfoCircle',
|
|
131
|
+
[COLOR_THEMES.success]: 'IconCircleCheck',
|
|
132
|
+
[COLOR_THEMES.warning]: 'IconAlertTriangle',
|
|
133
|
+
[COLOR_THEMES.white]: 'IconInfoCircle'
|
|
134
|
+
};
|