@widergy/energy-ui 3.171.0 → 3.171.2
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 +19 -3
- package/dist/components/UTBanner/stories/UTBanner.stories.js +16 -1
- package/dist/components/UTBaseInputField/theme.js +6 -5
- package/dist/components/UTButton/styles.module.scss +11 -11
- package/dist/components/UTButton/theme.js +1 -1
- package/dist/components/UTButtonGroup/styles.module.scss +1 -1
- package/dist/components/UTCheckbox/versions/V1/theme.js +4 -1
- package/dist/components/UTDataCategory/styles.module.scss +1 -1
- package/dist/components/UTDataCategory/theme.js +1 -1
- package/dist/components/UTDataElement/index.js +1 -1
- package/dist/components/UTDataElement/styles.module.scss +9 -9
- package/dist/components/UTDatePicker/versions/V1/stories/UTDatePickerV1.stories.js +59 -1
- package/dist/components/UTLabel/UTLabel.stories.js +81 -1
- package/dist/components/UTLabel/constants.js +10 -10
- package/dist/components/UTLabel/theme.js +4 -4
- package/dist/components/UTRadioGroup/versions/V1/index.js +12 -3
- package/dist/components/UTSelect/UTSelect.stories.js +897 -0
- package/dist/components/UTSelect/versions/V1/components/InputComponent/index.js +13 -3
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/index.js +7 -6
- package/dist/components/UTSelect/versions/V1/constants.js +10 -0
- package/dist/components/UTSelect/versions/V1/index.js +41 -68
- package/dist/components/UTSelect/versions/V1/types.js +54 -0
- package/dist/components/UTSelect/versions/V1/utils.js +10 -9
- package/dist/components/UTShortcutPanel/styles.module.scss +10 -10
- package/dist/components/UTStatus/theme.js +26 -26
- package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +16 -1
- package/dist/esm/components/UTBaseInputField/theme.js +6 -5
- package/dist/esm/components/UTButton/styles.module.scss +11 -11
- package/dist/esm/components/UTButton/theme.js +1 -1
- package/dist/esm/components/UTButtonGroup/styles.module.scss +1 -1
- package/dist/esm/components/UTCheckbox/versions/V1/theme.js +4 -1
- package/dist/esm/components/UTDataCategory/styles.module.scss +1 -1
- package/dist/esm/components/UTDataCategory/theme.js +1 -1
- package/dist/esm/components/UTDataElement/index.js +1 -1
- package/dist/esm/components/UTDataElement/styles.module.scss +9 -9
- package/dist/esm/components/UTDatePicker/versions/V1/stories/UTDatePickerV1.stories.js +58 -0
- package/dist/esm/components/UTLabel/UTLabel.stories.js +80 -0
- package/dist/esm/components/UTLabel/constants.js +10 -10
- package/dist/esm/components/UTLabel/theme.js +4 -4
- package/dist/esm/components/UTRadioGroup/versions/V1/index.js +12 -3
- package/dist/esm/components/UTSelect/UTSelect.stories.js +889 -0
- package/dist/esm/components/UTSelect/versions/V1/components/InputComponent/index.js +14 -4
- package/dist/esm/components/UTSelect/versions/V1/components/ListboxComponent/index.js +4 -3
- package/dist/esm/components/UTSelect/versions/V1/constants.js +4 -0
- package/dist/esm/components/UTSelect/versions/V1/index.js +41 -68
- package/dist/esm/components/UTSelect/versions/V1/types.js +48 -0
- package/dist/esm/components/UTSelect/versions/V1/utils.js +7 -6
- package/dist/esm/components/UTShortcutPanel/styles.module.scss +10 -10
- package/dist/esm/components/UTStatus/theme.js +26 -26
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +11 -9
- package/dist/utils/hooks/useCSSVariables/constants.js +11 -9
- package/package.json +10 -9
- package/dist/components/UTSelect/versions/V1/UTSelectV1.mdx +0 -13
- package/dist/components/UTSelect/versions/V1/UTSelectV1.stories.js +0 -741
- package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.mdx +0 -13
- package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.stories.js +0 -733
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.VariantSelect = exports.VariantPicker = exports.TestSite = exports.SoloLectura = exports.SinOpciones = exports.Simple = exports.Playground = exports.PickerConSeleccion = exports.Multiple = exports.Disabled = exports.ConTitulo = exports.ConTextoDeAyuda = exports.ConFilaPersonalizada = exports.ConError = exports.ConCategorias = exports.ClearableSelect = exports.ClearablePicker = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _inputs = require("../../constants/inputs");
|
|
10
|
+
var _ = _interopRequireDefault(require("."));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
const OPTIONS = [{
|
|
15
|
+
name: 'Electricidad',
|
|
16
|
+
value: 'electricity'
|
|
17
|
+
}, {
|
|
18
|
+
name: 'Gas natural',
|
|
19
|
+
value: 'gas'
|
|
20
|
+
}, {
|
|
21
|
+
name: 'Agua potable',
|
|
22
|
+
value: 'water'
|
|
23
|
+
}, {
|
|
24
|
+
name: 'Energía solar',
|
|
25
|
+
value: 'solar'
|
|
26
|
+
}, {
|
|
27
|
+
name: 'Biomasa',
|
|
28
|
+
value: 'biomass'
|
|
29
|
+
}];
|
|
30
|
+
const OPTIONS_WITH_CATEGORIES = [{
|
|
31
|
+
name: 'Residencial bajo',
|
|
32
|
+
value: 'res-low',
|
|
33
|
+
category: 'Residencial'
|
|
34
|
+
}, {
|
|
35
|
+
name: 'Residencial medio',
|
|
36
|
+
value: 'res-mid',
|
|
37
|
+
category: 'Residencial'
|
|
38
|
+
}, {
|
|
39
|
+
name: 'Residencial alto',
|
|
40
|
+
value: 'res-high',
|
|
41
|
+
category: 'Residencial'
|
|
42
|
+
}, {
|
|
43
|
+
name: 'Comercial pequeño',
|
|
44
|
+
value: 'com-sm',
|
|
45
|
+
category: 'Comercial'
|
|
46
|
+
}, {
|
|
47
|
+
name: 'Comercial grande',
|
|
48
|
+
value: 'com-lg',
|
|
49
|
+
category: 'Comercial'
|
|
50
|
+
}, {
|
|
51
|
+
name: 'Industrial',
|
|
52
|
+
value: 'industrial',
|
|
53
|
+
category: 'Industrial'
|
|
54
|
+
}];
|
|
55
|
+
const PERSON_OPTIONS = [{
|
|
56
|
+
name: 'Alice García',
|
|
57
|
+
value: '1'
|
|
58
|
+
}, {
|
|
59
|
+
name: 'Bob Martínez',
|
|
60
|
+
value: '2'
|
|
61
|
+
}, {
|
|
62
|
+
name: 'Carol Rodríguez',
|
|
63
|
+
value: '3'
|
|
64
|
+
}, {
|
|
65
|
+
name: 'David López',
|
|
66
|
+
value: '4'
|
|
67
|
+
}, {
|
|
68
|
+
name: 'Elena Sánchez',
|
|
69
|
+
value: '5'
|
|
70
|
+
}];
|
|
71
|
+
const AvatarCustomRow = _ref => {
|
|
72
|
+
let {
|
|
73
|
+
isChecked,
|
|
74
|
+
item
|
|
75
|
+
} = _ref;
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
style: {
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
gap: 8
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
+
style: {
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
background: isChecked ? '#285AFF' : '#E4E6EA',
|
|
86
|
+
borderRadius: '50%',
|
|
87
|
+
color: isChecked ? '#FFFFFF' : '#091E42',
|
|
88
|
+
display: 'flex',
|
|
89
|
+
fontSize: 12,
|
|
90
|
+
fontWeight: 700,
|
|
91
|
+
height: 28,
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
width: 28
|
|
94
|
+
}
|
|
95
|
+
}, item.name[0]), /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
+
style: {
|
|
97
|
+
fontWeight: isChecked ? 700 : 400
|
|
98
|
+
}
|
|
99
|
+
}, item.name));
|
|
100
|
+
};
|
|
101
|
+
AvatarCustomRow.propTypes = {
|
|
102
|
+
isChecked: _propTypes.bool,
|
|
103
|
+
item: (0, _propTypes.shape)({
|
|
104
|
+
name: _propTypes.string,
|
|
105
|
+
value: _propTypes.string
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
const wrapperStyle = {
|
|
109
|
+
maxWidth: '360px',
|
|
110
|
+
padding: '1rem'
|
|
111
|
+
};
|
|
112
|
+
var _default = exports.default = {
|
|
113
|
+
args: {
|
|
114
|
+
variant: 'select',
|
|
115
|
+
placeholder: 'Seleccioná una opción',
|
|
116
|
+
options: OPTIONS,
|
|
117
|
+
clearable: true,
|
|
118
|
+
disabled: false,
|
|
119
|
+
readOnly: false,
|
|
120
|
+
multiple: false,
|
|
121
|
+
required: false,
|
|
122
|
+
withAutoReset: true,
|
|
123
|
+
disableFilterOptions: false,
|
|
124
|
+
freeWidth: false,
|
|
125
|
+
menuWidth: ''
|
|
126
|
+
},
|
|
127
|
+
argTypes: {
|
|
128
|
+
options: {
|
|
129
|
+
control: false,
|
|
130
|
+
description: 'Array de opciones. Cada opción debe tener `name` y `value`.',
|
|
131
|
+
table: {
|
|
132
|
+
defaultValue: {
|
|
133
|
+
summary: '[]'
|
|
134
|
+
},
|
|
135
|
+
type: {
|
|
136
|
+
summary: 'Array<{ name: string, value: string | number }>'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
value: {
|
|
141
|
+
control: false,
|
|
142
|
+
description: 'Valor seleccionado actualmente.',
|
|
143
|
+
table: {
|
|
144
|
+
defaultValue: {
|
|
145
|
+
summary: 'null'
|
|
146
|
+
},
|
|
147
|
+
type: {
|
|
148
|
+
summary: 'string | Array<string | number>'
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
onChange: {
|
|
153
|
+
control: false,
|
|
154
|
+
description: 'Callback ejecutado al cambiar la selección.',
|
|
155
|
+
table: {
|
|
156
|
+
defaultValue: {
|
|
157
|
+
summary: 'undefined'
|
|
158
|
+
},
|
|
159
|
+
type: {
|
|
160
|
+
summary: 'function'
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
placeholder: {
|
|
165
|
+
control: 'text',
|
|
166
|
+
description: 'Texto de placeholder del input.',
|
|
167
|
+
table: {
|
|
168
|
+
defaultValue: {
|
|
169
|
+
summary: 'undefined'
|
|
170
|
+
},
|
|
171
|
+
type: {
|
|
172
|
+
summary: 'string'
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
title: {
|
|
177
|
+
control: 'text',
|
|
178
|
+
description: 'Etiqueta superior del campo.',
|
|
179
|
+
table: {
|
|
180
|
+
defaultValue: {
|
|
181
|
+
summary: 'undefined'
|
|
182
|
+
},
|
|
183
|
+
type: {
|
|
184
|
+
summary: 'string'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
titleVariant: {
|
|
189
|
+
control: 'inline-radio',
|
|
190
|
+
description: 'Variante tipográfica del título.',
|
|
191
|
+
options: Object.values(_inputs.TITLE_VARIANTS),
|
|
192
|
+
table: {
|
|
193
|
+
defaultValue: {
|
|
194
|
+
summary: _inputs.TITLE_VARIANTS.large
|
|
195
|
+
},
|
|
196
|
+
type: {
|
|
197
|
+
summary: "'body' | 'small'"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
helpText: {
|
|
202
|
+
control: 'text',
|
|
203
|
+
description: 'Texto de ayuda que se muestra debajo del input.',
|
|
204
|
+
table: {
|
|
205
|
+
defaultValue: {
|
|
206
|
+
summary: 'undefined'
|
|
207
|
+
},
|
|
208
|
+
type: {
|
|
209
|
+
summary: 'string'
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
error: {
|
|
214
|
+
control: 'text',
|
|
215
|
+
description: 'Mensaje de error a mostrar debajo del input.',
|
|
216
|
+
table: {
|
|
217
|
+
defaultValue: {
|
|
218
|
+
summary: 'undefined'
|
|
219
|
+
},
|
|
220
|
+
type: {
|
|
221
|
+
summary: 'string'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
disabled: {
|
|
226
|
+
control: 'boolean',
|
|
227
|
+
description: 'Deshabilita el input.',
|
|
228
|
+
table: {
|
|
229
|
+
defaultValue: {
|
|
230
|
+
summary: false
|
|
231
|
+
},
|
|
232
|
+
type: {
|
|
233
|
+
summary: 'boolean'
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
readOnly: {
|
|
238
|
+
control: 'boolean',
|
|
239
|
+
description: 'Pone el input en modo solo lectura.',
|
|
240
|
+
table: {
|
|
241
|
+
defaultValue: {
|
|
242
|
+
summary: false
|
|
243
|
+
},
|
|
244
|
+
type: {
|
|
245
|
+
summary: 'boolean'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
clearable: {
|
|
250
|
+
control: 'boolean',
|
|
251
|
+
description: 'Muestra el botón para limpiar la selección.',
|
|
252
|
+
table: {
|
|
253
|
+
defaultValue: {
|
|
254
|
+
summary: true
|
|
255
|
+
},
|
|
256
|
+
type: {
|
|
257
|
+
summary: 'boolean'
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
multiple: {
|
|
262
|
+
control: 'boolean',
|
|
263
|
+
description: 'Permite seleccionar múltiples opciones.',
|
|
264
|
+
table: {
|
|
265
|
+
defaultValue: {
|
|
266
|
+
summary: false
|
|
267
|
+
},
|
|
268
|
+
type: {
|
|
269
|
+
summary: 'boolean'
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
required: {
|
|
274
|
+
control: 'boolean',
|
|
275
|
+
description: 'Marca el campo como requerido en el título.',
|
|
276
|
+
table: {
|
|
277
|
+
defaultValue: {
|
|
278
|
+
summary: false
|
|
279
|
+
},
|
|
280
|
+
type: {
|
|
281
|
+
summary: 'boolean'
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
icon: {
|
|
286
|
+
control: 'text',
|
|
287
|
+
description: 'Nombre de icono Tabler a mostrar a la izquierda del input.',
|
|
288
|
+
table: {
|
|
289
|
+
defaultValue: {
|
|
290
|
+
summary: 'undefined'
|
|
291
|
+
},
|
|
292
|
+
type: {
|
|
293
|
+
summary: 'string'
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
prefix: {
|
|
298
|
+
control: 'text',
|
|
299
|
+
description: 'Texto prefijo a mostrar dentro del input.',
|
|
300
|
+
table: {
|
|
301
|
+
defaultValue: {
|
|
302
|
+
summary: 'undefined'
|
|
303
|
+
},
|
|
304
|
+
type: {
|
|
305
|
+
summary: 'string'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
suffix: {
|
|
310
|
+
control: 'text',
|
|
311
|
+
description: 'Texto sufijo a mostrar dentro del input.',
|
|
312
|
+
table: {
|
|
313
|
+
defaultValue: {
|
|
314
|
+
summary: 'undefined'
|
|
315
|
+
},
|
|
316
|
+
type: {
|
|
317
|
+
summary: 'string'
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
variant: {
|
|
322
|
+
control: 'inline-radio',
|
|
323
|
+
description: 'Variante visual del input. `select` usa fondo blanco, `picker` usa fondo transparente (para usar sobre otros fondos).',
|
|
324
|
+
options: ['select', 'picker'],
|
|
325
|
+
table: {
|
|
326
|
+
defaultValue: {
|
|
327
|
+
summary: 'select'
|
|
328
|
+
},
|
|
329
|
+
type: {
|
|
330
|
+
summary: "'select' | 'picker'"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
noOptionsText: {
|
|
335
|
+
control: 'text',
|
|
336
|
+
description: 'Texto cuando no hay opciones disponibles.',
|
|
337
|
+
table: {
|
|
338
|
+
defaultValue: {
|
|
339
|
+
summary: 'No hay opciones disponibles'
|
|
340
|
+
},
|
|
341
|
+
type: {
|
|
342
|
+
summary: 'string'
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
noMatchesText: {
|
|
347
|
+
control: 'text',
|
|
348
|
+
description: 'Texto cuando la búsqueda no encuentra resultados.',
|
|
349
|
+
table: {
|
|
350
|
+
defaultValue: {
|
|
351
|
+
summary: 'No hay coincidencias con tu búsqueda'
|
|
352
|
+
},
|
|
353
|
+
type: {
|
|
354
|
+
summary: 'string'
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
disableFilterOptions: {
|
|
359
|
+
control: 'boolean',
|
|
360
|
+
description: 'Deshabilita el filtrado interno de opciones por búsqueda.',
|
|
361
|
+
table: {
|
|
362
|
+
defaultValue: {
|
|
363
|
+
summary: false
|
|
364
|
+
},
|
|
365
|
+
type: {
|
|
366
|
+
summary: 'boolean'
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
withAutoReset: {
|
|
371
|
+
control: 'boolean',
|
|
372
|
+
description: 'Resetea el valor si la opción seleccionada deja de existir en `options`.',
|
|
373
|
+
table: {
|
|
374
|
+
defaultValue: {
|
|
375
|
+
summary: true
|
|
376
|
+
},
|
|
377
|
+
type: {
|
|
378
|
+
summary: 'boolean'
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
freeWidth: {
|
|
383
|
+
control: 'boolean',
|
|
384
|
+
description: 'Permite que el dropdown supere el ancho del input.',
|
|
385
|
+
table: {
|
|
386
|
+
defaultValue: {
|
|
387
|
+
summary: false
|
|
388
|
+
},
|
|
389
|
+
type: {
|
|
390
|
+
summary: 'boolean'
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
menuWidth: {
|
|
395
|
+
control: 'text',
|
|
396
|
+
description: 'Ancho fijo del dropdown. Acepta cualquier valor CSS válido (`"300px"`, `"20rem"`, `"50vw"`). Si no se pasa, el menú hereda el ancho del input.',
|
|
397
|
+
table: {
|
|
398
|
+
defaultValue: {
|
|
399
|
+
summary: 'undefined'
|
|
400
|
+
},
|
|
401
|
+
type: {
|
|
402
|
+
summary: 'string'
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
className: {
|
|
407
|
+
control: false,
|
|
408
|
+
description: 'Clase CSS adicional para el contenedor.',
|
|
409
|
+
table: {
|
|
410
|
+
defaultValue: {
|
|
411
|
+
summary: 'undefined'
|
|
412
|
+
},
|
|
413
|
+
type: {
|
|
414
|
+
summary: 'string'
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
CustomRow: {
|
|
419
|
+
control: false,
|
|
420
|
+
description: 'Componente React personalizado para renderizar cada opción del dropdown. Recibe `{ item, isChecked }` donde `item` es el objeto de la opción e `isChecked` indica si está seleccionada.',
|
|
421
|
+
table: {
|
|
422
|
+
defaultValue: {
|
|
423
|
+
summary: 'undefined'
|
|
424
|
+
},
|
|
425
|
+
type: {
|
|
426
|
+
summary: 'elementType'
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
dataTestId: {
|
|
431
|
+
control: 'text',
|
|
432
|
+
description: 'Test ID para el input.',
|
|
433
|
+
table: {
|
|
434
|
+
defaultValue: {
|
|
435
|
+
summary: 'undefined'
|
|
436
|
+
},
|
|
437
|
+
type: {
|
|
438
|
+
summary: 'string'
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
errorDataTestId: {
|
|
443
|
+
control: false,
|
|
444
|
+
description: 'Test ID para el componente de validación de error.',
|
|
445
|
+
table: {
|
|
446
|
+
defaultValue: {
|
|
447
|
+
summary: 'undefined'
|
|
448
|
+
},
|
|
449
|
+
type: {
|
|
450
|
+
summary: 'string'
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
inputSize: {
|
|
455
|
+
control: {
|
|
456
|
+
type: 'select'
|
|
457
|
+
},
|
|
458
|
+
description: 'Tamaño del input.',
|
|
459
|
+
options: ['small', 'large'],
|
|
460
|
+
table: {
|
|
461
|
+
defaultValue: {
|
|
462
|
+
summary: 'undefined'
|
|
463
|
+
},
|
|
464
|
+
type: {
|
|
465
|
+
summary: "'small' | 'large'"
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
itemDataTestId: {
|
|
470
|
+
control: false,
|
|
471
|
+
description: 'Test ID para cada ítem del dropdown.',
|
|
472
|
+
table: {
|
|
473
|
+
defaultValue: {
|
|
474
|
+
summary: 'undefined'
|
|
475
|
+
},
|
|
476
|
+
type: {
|
|
477
|
+
summary: 'string'
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
listDataTestId: {
|
|
482
|
+
control: false,
|
|
483
|
+
description: 'Test ID para el contenedor de la lista.',
|
|
484
|
+
table: {
|
|
485
|
+
defaultValue: {
|
|
486
|
+
summary: 'undefined'
|
|
487
|
+
},
|
|
488
|
+
type: {
|
|
489
|
+
summary: 'string'
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
action: {
|
|
494
|
+
control: 'object',
|
|
495
|
+
description: 'Botón de acción en el adornment derecho. Recibe `{ Icon, onClick, size }`.',
|
|
496
|
+
table: {
|
|
497
|
+
defaultValue: {
|
|
498
|
+
summary: 'undefined'
|
|
499
|
+
},
|
|
500
|
+
type: {
|
|
501
|
+
summary: 'object'
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
alwaysShowPlaceholder: {
|
|
506
|
+
control: 'boolean',
|
|
507
|
+
description: 'Muestra el placeholder incluso cuando hay un valor seleccionado.',
|
|
508
|
+
table: {
|
|
509
|
+
defaultValue: {
|
|
510
|
+
summary: true
|
|
511
|
+
},
|
|
512
|
+
type: {
|
|
513
|
+
summary: 'boolean'
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
actions: {
|
|
518
|
+
control: false,
|
|
519
|
+
description: 'Acciones adicionales que se muestran junto al título.',
|
|
520
|
+
table: {
|
|
521
|
+
defaultValue: {
|
|
522
|
+
summary: 'undefined'
|
|
523
|
+
},
|
|
524
|
+
type: {
|
|
525
|
+
summary: 'Array<buttonTypes>'
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
autocompleteProps: {
|
|
530
|
+
control: false,
|
|
531
|
+
description: 'Props adicionales pasadas directamente al componente Autocomplete de MUI.',
|
|
532
|
+
table: {
|
|
533
|
+
defaultValue: {
|
|
534
|
+
summary: '{}'
|
|
535
|
+
},
|
|
536
|
+
type: {
|
|
537
|
+
summary: 'object'
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
listProps: {
|
|
542
|
+
control: false,
|
|
543
|
+
description: 'Props adicionales para el componente ListboxComponent.',
|
|
544
|
+
table: {
|
|
545
|
+
defaultValue: {
|
|
546
|
+
summary: '{}'
|
|
547
|
+
},
|
|
548
|
+
type: {
|
|
549
|
+
summary: 'object'
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
onChangeSearchTerm: {
|
|
554
|
+
control: false,
|
|
555
|
+
description: 'Callback ejecutado al cambiar el texto de búsqueda.',
|
|
556
|
+
table: {
|
|
557
|
+
defaultValue: {
|
|
558
|
+
summary: 'undefined'
|
|
559
|
+
},
|
|
560
|
+
type: {
|
|
561
|
+
summary: 'function'
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
component: _.default,
|
|
567
|
+
parameters: {
|
|
568
|
+
controls: {
|
|
569
|
+
exclude: ['onChange', 'onChangeSearchTerm', 'actions', 'autocompleteProps', 'listProps', 'className', 'CustomRow', 'dataTestId', 'errorDataTestId', 'itemDataTestId', 'listDataTestId', 'version']
|
|
570
|
+
},
|
|
571
|
+
docs: {
|
|
572
|
+
description: {
|
|
573
|
+
component: 'Componente de selección con búsqueda integrada (V1) y versión legacy compatible con Redux Form (V0). V1 soporta selección simple y múltiple, categorías, adornments y búsqueda filtrada.'
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
title: 'Energy-UI/UTSelect'
|
|
578
|
+
};
|
|
579
|
+
const SelectWrapper = _ref2 => {
|
|
580
|
+
let {
|
|
581
|
+
menuWidth,
|
|
582
|
+
multiple,
|
|
583
|
+
...props
|
|
584
|
+
} = _ref2;
|
|
585
|
+
const [value, setValue] = (0, _react.useState)(multiple ? [] : null);
|
|
586
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
587
|
+
style: wrapperStyle
|
|
588
|
+
}, /*#__PURE__*/_react.default.createElement(_.default, _extends({}, props, {
|
|
589
|
+
menuWidth: menuWidth || undefined,
|
|
590
|
+
multiple: multiple,
|
|
591
|
+
onChange: setValue,
|
|
592
|
+
value: value,
|
|
593
|
+
version: "V1"
|
|
594
|
+
})));
|
|
595
|
+
};
|
|
596
|
+
SelectWrapper.propTypes = {
|
|
597
|
+
menuWidth: _propTypes.string,
|
|
598
|
+
multiple: _propTypes.bool
|
|
599
|
+
};
|
|
600
|
+
const PreselectedWrapper = _ref3 => {
|
|
601
|
+
let {
|
|
602
|
+
initialValue = 'gas',
|
|
603
|
+
...props
|
|
604
|
+
} = _ref3;
|
|
605
|
+
const [value, setValue] = (0, _react.useState)(initialValue);
|
|
606
|
+
return /*#__PURE__*/_react.default.createElement(_.default, _extends({}, props, {
|
|
607
|
+
onChange: setValue,
|
|
608
|
+
value: value,
|
|
609
|
+
version: "V1"
|
|
610
|
+
}));
|
|
611
|
+
};
|
|
612
|
+
PreselectedWrapper.propTypes = {
|
|
613
|
+
initialValue: _propTypes.string
|
|
614
|
+
};
|
|
615
|
+
const rowStyle = {
|
|
616
|
+
display: 'flex',
|
|
617
|
+
flexDirection: 'column',
|
|
618
|
+
gap: '1.5rem',
|
|
619
|
+
maxWidth: '360px',
|
|
620
|
+
padding: '1rem'
|
|
621
|
+
};
|
|
622
|
+
const labelStyle = {
|
|
623
|
+
fontSize: '0.7rem',
|
|
624
|
+
color: '#94a3b8',
|
|
625
|
+
fontFamily: 'monospace'
|
|
626
|
+
};
|
|
627
|
+
const Playground = exports.Playground = {
|
|
628
|
+
name: 'Playground',
|
|
629
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
630
|
+
};
|
|
631
|
+
const Simple = exports.Simple = {
|
|
632
|
+
name: 'Simple',
|
|
633
|
+
args: {
|
|
634
|
+
placeholder: 'Seleccioná un servicio'
|
|
635
|
+
},
|
|
636
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
637
|
+
};
|
|
638
|
+
const ConTitulo = exports.ConTitulo = {
|
|
639
|
+
name: 'Con título',
|
|
640
|
+
args: {
|
|
641
|
+
helpText: 'El tipo de servicio determina el método de facturación.',
|
|
642
|
+
placeholder: 'Seleccioná un servicio',
|
|
643
|
+
required: true,
|
|
644
|
+
title: 'Tipo de servicio'
|
|
645
|
+
},
|
|
646
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
647
|
+
};
|
|
648
|
+
const Multiple = exports.Multiple = {
|
|
649
|
+
name: 'Múltiple',
|
|
650
|
+
args: {
|
|
651
|
+
clearable: false,
|
|
652
|
+
multiple: true,
|
|
653
|
+
placeholder: 'Seleccioná uno o más servicios',
|
|
654
|
+
title: 'Servicios activos'
|
|
655
|
+
},
|
|
656
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
657
|
+
};
|
|
658
|
+
const ConCategorias = exports.ConCategorias = {
|
|
659
|
+
name: 'Con categorías',
|
|
660
|
+
args: {
|
|
661
|
+
options: OPTIONS_WITH_CATEGORIES,
|
|
662
|
+
placeholder: 'Seleccioná una tarifa',
|
|
663
|
+
title: 'Categoría tarifaria'
|
|
664
|
+
},
|
|
665
|
+
parameters: {
|
|
666
|
+
docs: {
|
|
667
|
+
description: {
|
|
668
|
+
story: 'Las opciones se agrupan automáticamente por la propiedad `category`. Las opciones seleccionadas se mueven al tope de su categoría al abrir el dropdown.'
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
673
|
+
};
|
|
674
|
+
const Disabled = exports.Disabled = {
|
|
675
|
+
name: 'Deshabilitado',
|
|
676
|
+
args: {
|
|
677
|
+
disabled: true,
|
|
678
|
+
placeholder: 'Seleccioná un servicio',
|
|
679
|
+
title: 'Tipo de servicio'
|
|
680
|
+
},
|
|
681
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
682
|
+
};
|
|
683
|
+
const SoloLectura = exports.SoloLectura = {
|
|
684
|
+
name: 'Solo lectura',
|
|
685
|
+
args: {
|
|
686
|
+
placeholder: 'Seleccioná un servicio',
|
|
687
|
+
readOnly: true,
|
|
688
|
+
title: 'Tipo de servicio'
|
|
689
|
+
},
|
|
690
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
691
|
+
style: wrapperStyle
|
|
692
|
+
}, /*#__PURE__*/_react.default.createElement(PreselectedWrapper, args))
|
|
693
|
+
};
|
|
694
|
+
const VariantSelect = exports.VariantSelect = {
|
|
695
|
+
name: 'Variant — Select',
|
|
696
|
+
args: {
|
|
697
|
+
placeholder: 'Seleccioná un servicio',
|
|
698
|
+
title: 'Tipo de servicio',
|
|
699
|
+
variant: 'select'
|
|
700
|
+
},
|
|
701
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
702
|
+
};
|
|
703
|
+
const VariantPicker = exports.VariantPicker = {
|
|
704
|
+
name: 'Variant — Picker',
|
|
705
|
+
args: {
|
|
706
|
+
placeholder: 'Seleccioná un servicio',
|
|
707
|
+
title: 'Tipo de servicio',
|
|
708
|
+
variant: 'picker'
|
|
709
|
+
},
|
|
710
|
+
parameters: {
|
|
711
|
+
docs: {
|
|
712
|
+
description: {
|
|
713
|
+
story: 'Variante con fondo transparente. Ideal para usar sobre cards o fondos con color.'
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
718
|
+
style: {
|
|
719
|
+
background: '#f1f5f9',
|
|
720
|
+
borderRadius: '0.5rem',
|
|
721
|
+
padding: '1.5rem',
|
|
722
|
+
maxWidth: '360px'
|
|
723
|
+
}
|
|
724
|
+
}, /*#__PURE__*/_react.default.createElement(SelectWrapper, args))
|
|
725
|
+
};
|
|
726
|
+
const ClearableSelect = exports.ClearableSelect = {
|
|
727
|
+
name: 'Clearable — Select',
|
|
728
|
+
args: {
|
|
729
|
+
placeholder: 'Seleccioná un servicio',
|
|
730
|
+
title: 'Tipo de servicio',
|
|
731
|
+
variant: 'select'
|
|
732
|
+
},
|
|
733
|
+
parameters: {
|
|
734
|
+
docs: {
|
|
735
|
+
description: {
|
|
736
|
+
story: 'Comparación de `clearable={true}` (muestra la X al completar) vs `clearable={false}` (oculta la X) en variant select.'
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
741
|
+
style: rowStyle
|
|
742
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
|
|
743
|
+
style: labelStyle
|
|
744
|
+
}, "clearable=true (default)"), /*#__PURE__*/_react.default.createElement(PreselectedWrapper, _extends({}, args, {
|
|
745
|
+
clearable: true
|
|
746
|
+
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
|
|
747
|
+
style: labelStyle
|
|
748
|
+
}, "clearable=false"), /*#__PURE__*/_react.default.createElement(PreselectedWrapper, _extends({}, args, {
|
|
749
|
+
clearable: false
|
|
750
|
+
}))))
|
|
751
|
+
};
|
|
752
|
+
const ClearablePicker = exports.ClearablePicker = {
|
|
753
|
+
name: 'Clearable — Picker',
|
|
754
|
+
args: {
|
|
755
|
+
placeholder: 'Seleccioná un servicio',
|
|
756
|
+
title: 'Tipo de servicio',
|
|
757
|
+
variant: 'picker'
|
|
758
|
+
},
|
|
759
|
+
parameters: {
|
|
760
|
+
docs: {
|
|
761
|
+
description: {
|
|
762
|
+
story: 'Comparación de `clearable={true}` vs `clearable={false}` en variant picker. Útil para dropdowns embebidos donde el borrado puede no tener sentido.'
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
767
|
+
style: {
|
|
768
|
+
background: '#f1f5f9',
|
|
769
|
+
borderRadius: '0.5rem',
|
|
770
|
+
padding: '1.5rem',
|
|
771
|
+
maxWidth: '360px'
|
|
772
|
+
}
|
|
773
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
774
|
+
style: {
|
|
775
|
+
display: 'flex',
|
|
776
|
+
flexDirection: 'column',
|
|
777
|
+
gap: '1.5rem'
|
|
778
|
+
}
|
|
779
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
|
|
780
|
+
style: labelStyle
|
|
781
|
+
}, "clearable=true (default)"), /*#__PURE__*/_react.default.createElement(PreselectedWrapper, _extends({}, args, {
|
|
782
|
+
clearable: true
|
|
783
|
+
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
|
|
784
|
+
style: labelStyle
|
|
785
|
+
}, "clearable=false"), /*#__PURE__*/_react.default.createElement(PreselectedWrapper, _extends({}, args, {
|
|
786
|
+
clearable: false
|
|
787
|
+
})))))
|
|
788
|
+
};
|
|
789
|
+
const ConError = exports.ConError = {
|
|
790
|
+
name: 'Con error',
|
|
791
|
+
args: {
|
|
792
|
+
error: 'Este campo es requerido.',
|
|
793
|
+
placeholder: 'Seleccioná un servicio',
|
|
794
|
+
title: 'Tipo de servicio'
|
|
795
|
+
},
|
|
796
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
797
|
+
};
|
|
798
|
+
const PickerConSeleccion = exports.PickerConSeleccion = {
|
|
799
|
+
name: 'Picker — con selección previa',
|
|
800
|
+
args: {
|
|
801
|
+
placeholder: 'Seleccioná un servicio',
|
|
802
|
+
title: 'Tipo de servicio',
|
|
803
|
+
variant: 'picker'
|
|
804
|
+
},
|
|
805
|
+
parameters: {
|
|
806
|
+
docs: {
|
|
807
|
+
description: {
|
|
808
|
+
story: 'En `variant="picker"` al hacer foco se muestran todas las opciones aunque haya una seleccionada. El filtrado solo aplica si el usuario empieza a escribir.'
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
813
|
+
style: {
|
|
814
|
+
background: '#f1f5f9',
|
|
815
|
+
borderRadius: '0.5rem',
|
|
816
|
+
padding: '1.5rem',
|
|
817
|
+
maxWidth: '360px'
|
|
818
|
+
}
|
|
819
|
+
}, /*#__PURE__*/_react.default.createElement(PreselectedWrapper, args))
|
|
820
|
+
};
|
|
821
|
+
const ConFilaPersonalizada = exports.ConFilaPersonalizada = {
|
|
822
|
+
name: 'Con fila personalizada (CustomRow)',
|
|
823
|
+
args: {
|
|
824
|
+
multiple: true,
|
|
825
|
+
options: PERSON_OPTIONS,
|
|
826
|
+
placeholder: 'Seleccioná usuarios',
|
|
827
|
+
title: 'Con fila personalizada (CustomRow)'
|
|
828
|
+
},
|
|
829
|
+
parameters: {
|
|
830
|
+
docs: {
|
|
831
|
+
description: {
|
|
832
|
+
story: 'La prop `CustomRow` recibe un componente React con `{ item, isChecked }` y reemplaza el renderizado por defecto de cada opción del dropdown.'
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
837
|
+
CustomRow: AvatarCustomRow
|
|
838
|
+
}))
|
|
839
|
+
};
|
|
840
|
+
const ConTextoDeAyuda = exports.ConTextoDeAyuda = {
|
|
841
|
+
name: 'Con texto de ayuda',
|
|
842
|
+
args: {
|
|
843
|
+
helpText: 'Podés buscar escribiendo en el campo.',
|
|
844
|
+
placeholder: 'Seleccioná una opción',
|
|
845
|
+
title: 'Con texto de ayuda'
|
|
846
|
+
},
|
|
847
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
848
|
+
};
|
|
849
|
+
const SinOpciones = exports.SinOpciones = {
|
|
850
|
+
name: 'Sin opciones',
|
|
851
|
+
args: {
|
|
852
|
+
options: [],
|
|
853
|
+
placeholder: 'Sin opciones',
|
|
854
|
+
title: 'Sin opciones disponibles'
|
|
855
|
+
},
|
|
856
|
+
render: args => /*#__PURE__*/_react.default.createElement(SelectWrapper, args)
|
|
857
|
+
};
|
|
858
|
+
const TestSite = exports.TestSite = {
|
|
859
|
+
name: 'Test Site',
|
|
860
|
+
parameters: {
|
|
861
|
+
docs: {
|
|
862
|
+
description: {
|
|
863
|
+
story: 'Casos de prueba para el Storybook Test Runner: single, múltiple, CustomRow, disabled, error.'
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
render: args => /*#__PURE__*/_react.default.createElement("div", {
|
|
868
|
+
style: {
|
|
869
|
+
display: 'flex',
|
|
870
|
+
flexDirection: 'column',
|
|
871
|
+
gap: 24,
|
|
872
|
+
maxWidth: 400
|
|
873
|
+
}
|
|
874
|
+
}, /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
875
|
+
placeholder: "Selecci\xF3n simple",
|
|
876
|
+
title: "Single"
|
|
877
|
+
})), /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
878
|
+
multiple: true,
|
|
879
|
+
placeholder: "Selecci\xF3n m\xFAltiple",
|
|
880
|
+
title: "Multiple"
|
|
881
|
+
})), /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
882
|
+
CustomRow: AvatarCustomRow,
|
|
883
|
+
multiple: true,
|
|
884
|
+
options: PERSON_OPTIONS,
|
|
885
|
+
placeholder: "Custom row",
|
|
886
|
+
title: "Custom Row"
|
|
887
|
+
})), /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
888
|
+
disabled: true,
|
|
889
|
+
placeholder: "Deshabilitado",
|
|
890
|
+
title: "Disabled"
|
|
891
|
+
})), /*#__PURE__*/_react.default.createElement(SelectWrapper, _extends({}, args, {
|
|
892
|
+
error: "Campo requerido",
|
|
893
|
+
placeholder: "Con error",
|
|
894
|
+
required: true,
|
|
895
|
+
title: "Error"
|
|
896
|
+
})))
|
|
897
|
+
};
|