@widergy/energy-ui 3.167.1 → 3.169.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 (54) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/UTLoading/README.md +85 -0
  3. package/dist/components/UTLoading/components/Spinner/index.js +1 -1
  4. package/dist/components/UTLoading/index.js +17 -7
  5. package/dist/components/UTLoading/versions/V0/index.js +32 -0
  6. package/dist/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +65 -0
  7. package/dist/components/UTLoading/versions/V1/components/LogoLoader/constants.js +14 -0
  8. package/dist/components/UTLoading/versions/V1/components/LogoLoader/index.js +54 -0
  9. package/dist/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
  10. package/dist/components/UTLoading/versions/V1/components/LogoLoader/theme.js +18 -0
  11. package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +7 -0
  12. package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +57 -0
  13. package/dist/components/UTLoading/versions/V1/components/Spinner/constants.js +12 -0
  14. package/dist/components/UTLoading/versions/V1/components/Spinner/index.js +56 -0
  15. package/dist/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
  16. package/dist/components/UTLoading/versions/V1/components/Spinner/theme.js +21 -0
  17. package/dist/components/UTLoading/versions/V1/constants.js +11 -0
  18. package/dist/components/UTLoading/versions/V1/index.js +30 -0
  19. package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
  20. package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +369 -0
  21. package/dist/components/UTSelect/versions/V1/README.md +35 -0
  22. package/dist/components/UTSelect/versions/V1/UTSelectV1.mdx +13 -0
  23. package/dist/components/UTSelect/versions/V1/UTSelectV1.stories.js +741 -0
  24. package/dist/components/UTSelect/versions/V1/components/ListboxComponent/index.js +3 -0
  25. package/dist/components/UTSelect/versions/V1/index.js +4 -1
  26. package/dist/constants/testIds.js +4 -0
  27. package/dist/esm/components/UTLoading/README.md +85 -0
  28. package/dist/esm/components/UTLoading/components/Spinner/index.js +1 -1
  29. package/dist/esm/components/UTLoading/index.js +18 -8
  30. package/dist/esm/components/UTLoading/versions/V0/index.js +25 -0
  31. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +58 -0
  32. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/constants.js +8 -0
  33. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/index.js +47 -0
  34. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
  35. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/theme.js +11 -0
  36. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +1 -0
  37. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +50 -0
  38. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/constants.js +6 -0
  39. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/index.js +49 -0
  40. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
  41. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/theme.js +14 -0
  42. package/dist/esm/components/UTLoading/versions/V1/constants.js +5 -0
  43. package/dist/esm/components/UTLoading/versions/V1/index.js +23 -0
  44. package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
  45. package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +362 -0
  46. package/dist/esm/components/UTSelect/versions/V1/README.md +35 -0
  47. package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.mdx +13 -0
  48. package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.stories.js +733 -0
  49. package/dist/esm/components/UTSelect/versions/V1/components/ListboxComponent/index.js +4 -1
  50. package/dist/esm/components/UTSelect/versions/V1/index.js +5 -2
  51. package/dist/esm/constants/testIds.js +4 -0
  52. package/dist/esm/utils/hooks/useCSSVariables/constants.js +16 -1
  53. package/dist/utils/hooks/useCSSVariables/constants.js +16 -1
  54. package/package.json +1 -1
@@ -0,0 +1,67 @@
1
+ import { Canvas, Controls, Meta, Story } from '@storybook/blocks';
2
+ import * as UTLoadingV1Stories from './UTLoadingV1.stories';
3
+
4
+ <Meta of={UTLoadingV1Stories} />
5
+
6
+ # UTLoading — V1
7
+
8
+ Nueva versión del componente de carga. Incluye un Spinner custom con línea más gruesa y un LogoLoader con track de gradiente animado usando los colores de identidad del cliente.
9
+
10
+ ## Cómo activar V1
11
+
12
+ Pasar la prop `version="V1"` al componente. Sin esta prop el comportamiento es idéntico al actual (V0).
13
+
14
+ ```jsx
15
+ <UTLoading version="V1" loading useUtilityLoading={false} />
16
+ ```
17
+
18
+ ## Spinner
19
+
20
+ Spinner circular CSS puro. Muestra una línea circular con track de fondo y arco superior en el color de acento del tema. Soporta un label de texto opcional debajo.
21
+
22
+ <Canvas of={UTLoadingV1Stories.SpinnerPlayground} />
23
+ <Controls of={UTLoadingV1Stories.SpinnerPlayground} />
24
+
25
+ ## LogoLoader
26
+
27
+ Loader con track circular de gradiente de 2 colores (colores de identidad del cliente). El logo/isologo del cliente se muestra centrado con una animación de escala sincronizada con la rotación del track.
28
+
29
+ ### Full Screen
30
+
31
+ Cuando `fullScreen=true` el contenedor ocupa toda la pantalla con `position: fixed` y `z-index: 999`.
32
+
33
+ <Canvas of={UTLoadingV1Stories.LogoLoaderFullScreen} />
34
+
35
+ ### En contenedor
36
+
37
+ Cuando `fullScreen=false` el loader se adapta al contenedor padre y se centra dentro de él.
38
+
39
+ <Canvas of={UTLoadingV1Stories.LogoLoaderEnContenedor} />
40
+
41
+ ### Con logo del cliente
42
+
43
+ <Canvas of={UTLoadingV1Stories.LogoLoaderConLogo} />
44
+
45
+ ## Props
46
+
47
+ | Prop | Tipo | Default | Descripción |
48
+ |------|------|---------|-------------|
49
+ | `version` | `string` | `'V0'` | `'V0'` o `'V1'` — versión a renderizar |
50
+ | `loading` | `bool` | — | Muestra el loader cuando `true`, los `children` cuando `false` |
51
+ | `useUtilityLoading` | `bool` | — | `true` → LogoLoader; `false` → Spinner |
52
+ | `fullScreen` | `bool` | `true` | Full screen (`position: fixed`) o adaptado al contenedor |
53
+ | `Logo` | `string` | — | URL del SVG del logo/isologo del cliente |
54
+ | `text` | `string` | `'Cargando...'` | Texto de carga. Pasar `''` para ocultarlo |
55
+ | `dataTestId` | `string` | — | `data-testid` del elemento raíz |
56
+ | `preventUnmount` | `bool` | `false` | Mantiene los children en el DOM cuando `loading=true` (solo Spinner) |
57
+ | `wrapperClassName` | `string` | — | Clase del wrapper de children (solo Spinner) |
58
+
59
+ ## Design tokens
60
+
61
+ | Token | Propiedad | Fallback |
62
+ |-------|-----------|---------|
63
+ | `--UT-loading-track-color-start` | Color inicial del gradiente del track | Color de identidad 1 del cliente |
64
+ | `--UT-loading-track-color-end` | Color final del gradiente del track | Color de identidad 2 del cliente |
65
+ | `--UT-loading-gap` | Gap entre track/spinner y label | `8px` |
66
+
67
+ > Los tokens de color del gradiente se inyectan automáticamente desde los colores de identidad del cliente (`identitySolidTone1` y `identitySolidTone2`).
@@ -0,0 +1,362 @@
1
+ import React from 'react';
2
+ import UTLoading from '../../../index';
3
+ export default {
4
+ args: {
5
+ loading: true,
6
+ version: 'V1'
7
+ },
8
+ argTypes: {
9
+ colors: {
10
+ control: 'object',
11
+ description: 'Array de colores para el Spinner. 2 colores → gradiente lineal. 1 color → sólido. Sin prop → usa el color del tema.',
12
+ table: {
13
+ defaultValue: {
14
+ summary: 'undefined'
15
+ },
16
+ type: {
17
+ summary: 'string[]'
18
+ }
19
+ }
20
+ },
21
+ dataTestId: {
22
+ control: 'text',
23
+ description: 'Identificador para pruebas automatizadas.',
24
+ table: {
25
+ defaultValue: {
26
+ summary: 'undefined'
27
+ },
28
+ type: {
29
+ summary: 'string'
30
+ }
31
+ }
32
+ },
33
+ fullScreen: {
34
+ control: 'boolean',
35
+ description: 'Cuando es true el loader ocupa toda la pantalla (position fixed). Cuando es false se adapta al contenedor padre.',
36
+ table: {
37
+ defaultValue: {
38
+ summary: 'true'
39
+ },
40
+ type: {
41
+ summary: 'boolean'
42
+ }
43
+ }
44
+ },
45
+ loading: {
46
+ control: 'boolean',
47
+ description: 'Controla si se muestra el loader o los children.',
48
+ table: {
49
+ defaultValue: {
50
+ summary: 'undefined'
51
+ },
52
+ type: {
53
+ summary: 'boolean'
54
+ }
55
+ }
56
+ },
57
+ Logo: {
58
+ control: 'text',
59
+ description: 'URL del asset SVG del logo/isologo del cliente.',
60
+ table: {
61
+ defaultValue: {
62
+ summary: 'undefined'
63
+ },
64
+ type: {
65
+ summary: 'string'
66
+ }
67
+ }
68
+ },
69
+ text: {
70
+ control: 'text',
71
+ description: 'Texto de carga opcional.',
72
+ table: {
73
+ defaultValue: {
74
+ summary: 'Cargando...'
75
+ },
76
+ type: {
77
+ summary: 'string'
78
+ }
79
+ }
80
+ },
81
+ useUtilityLoading: {
82
+ control: 'boolean',
83
+ description: 'Cuando es true muestra el LogoLoader. Cuando es false muestra el Spinner nuevo.',
84
+ table: {
85
+ defaultValue: {
86
+ summary: 'false'
87
+ },
88
+ type: {
89
+ summary: 'boolean'
90
+ }
91
+ }
92
+ },
93
+ version: {
94
+ control: 'select',
95
+ description: 'Versión del componente a utilizar.',
96
+ options: ['V0', 'V1'],
97
+ table: {
98
+ defaultValue: {
99
+ summary: 'V0'
100
+ },
101
+ type: {
102
+ summary: "'V0' | 'V1'"
103
+ }
104
+ }
105
+ }
106
+ },
107
+ component: UTLoading,
108
+ parameters: {
109
+ controls: {
110
+ exclude: ['classes', 'className', 'color', 'size', 'textClassName', 'thickness', 'wrapperClassName']
111
+ },
112
+ docs: {
113
+ description: {
114
+ component: 'UTLoading V1 — Nueva versión del componente de carga. Incluye un Spinner custom con línea gruesa y un LogoLoader con track de gradiente animado y logo del cliente.'
115
+ }
116
+ }
117
+ },
118
+ title: 'Energy-UI/UTLoading/V1'
119
+ };
120
+ export const SpinnerPlayground = {
121
+ args: {
122
+ loading: true,
123
+ text: 'Cargando...',
124
+ useUtilityLoading: false,
125
+ version: 'V1'
126
+ },
127
+ name: 'Spinner — Playground',
128
+ parameters: {
129
+ docs: {
130
+ description: {
131
+ story: 'Spinner circular custom con línea gruesa y label de texto opcional.'
132
+ }
133
+ }
134
+ }
135
+ };
136
+ export const SpinnerConGradiente = {
137
+ args: {
138
+ colors: ['var(--UT-loading-color-start)', 'var(--UT-loading-color-end)'],
139
+ loading: true,
140
+ text: 'Cargando...',
141
+ useUtilityLoading: false,
142
+ version: 'V1'
143
+ },
144
+ decorators: [Story => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("style", null, "\n :root {\n --identitySolidTone3: #4D97FA;\n --identitySolidTone2: #7BB8FF;\n --UT-loading-color-start: var(--identitySolidTone3);\n --UT-loading-color-end: var(--identitySolidTone2);\n }\n "), /*#__PURE__*/React.createElement(Story, null))],
145
+ name: 'Spinner — Con gradiente',
146
+ parameters: {
147
+ docs: {
148
+ description: {
149
+ story: 'Spinner con gradiente lineal. Se pasan 2 colores vía prop `colors`. En producción se inyectan desde los design tokens `--UT-loading-color-start` y `--UT-loading-color-end`.'
150
+ }
151
+ }
152
+ }
153
+ };
154
+ export const SpinnerSinTexto = {
155
+ args: {
156
+ loading: true,
157
+ text: '',
158
+ useUtilityLoading: false,
159
+ version: 'V1'
160
+ },
161
+ name: 'Spinner — Sin texto',
162
+ parameters: {
163
+ docs: {
164
+ description: {
165
+ story: 'Spinner sin label de texto.'
166
+ }
167
+ }
168
+ }
169
+ };
170
+ export const LogoLoaderFullScreen = {
171
+ args: {
172
+ fullScreen: true,
173
+ loading: true,
174
+ Logo: 'https://utilitygo-demo-qa-ev.widergydev.com/favicon.png',
175
+ text: '',
176
+ useUtilityLoading: true,
177
+ version: 'V1'
178
+ },
179
+ name: 'LogoLoader — Full Screen',
180
+ parameters: {
181
+ docs: {
182
+ description: {
183
+ story: 'LogoLoader en modo full screen (position fixed, z-index 999). Muestra el track con gradiente de identidad del cliente rotando.'
184
+ }
185
+ }
186
+ }
187
+ };
188
+ export const LogoLoaderEnContenedor = {
189
+ args: {
190
+ fullScreen: false,
191
+ loading: true,
192
+ Logo: 'https://utilitygo-demo-qa-ev.widergydev.com/favicon.png',
193
+ text: 'Cargando...',
194
+ useUtilityLoading: true,
195
+ version: 'V1'
196
+ },
197
+ decorators: [Story => /*#__PURE__*/React.createElement("div", {
198
+ style: {
199
+ border: '1px dashed #C1C7D0',
200
+ height: '300px',
201
+ position: 'relative',
202
+ width: '100%'
203
+ }
204
+ }, /*#__PURE__*/React.createElement(Story, null))],
205
+ name: 'LogoLoader — En contenedor',
206
+ parameters: {
207
+ docs: {
208
+ description: {
209
+ story: 'LogoLoader adaptado al contenedor padre (fullScreen=false). Se centra dentro del div contenedor.'
210
+ }
211
+ }
212
+ }
213
+ };
214
+ export const LogoLoaderConLogo = {
215
+ args: {
216
+ fullScreen: false,
217
+ loading: true,
218
+ Logo: 'https://utilitygo-demo-qa-ev.widergydev.com/favicon.png',
219
+ text: 'Cargando...',
220
+ useUtilityLoading: true,
221
+ version: 'V1'
222
+ },
223
+ decorators: [Story => /*#__PURE__*/React.createElement("div", {
224
+ style: {
225
+ border: '1px dashed #C1C7D0',
226
+ height: '300px',
227
+ position: 'relative',
228
+ width: '100%'
229
+ }
230
+ }, /*#__PURE__*/React.createElement(Story, null))],
231
+ name: 'LogoLoader — Con logo',
232
+ parameters: {
233
+ docs: {
234
+ description: {
235
+ story: 'LogoLoader con logo SVG del cliente centrado dentro del track.'
236
+ }
237
+ }
238
+ }
239
+ };
240
+ export const LogoLoaderSinTexto = {
241
+ args: {
242
+ fullScreen: false,
243
+ loading: true,
244
+ Logo: 'https://utilitygo-demo-qa-ev.widergydev.com/favicon.png',
245
+ text: '',
246
+ useUtilityLoading: true,
247
+ version: 'V1'
248
+ },
249
+ decorators: [Story => /*#__PURE__*/React.createElement("div", {
250
+ style: {
251
+ border: '1px dashed #C1C7D0',
252
+ height: '300px',
253
+ position: 'relative',
254
+ width: '100%'
255
+ }
256
+ }, /*#__PURE__*/React.createElement(Story, null))],
257
+ name: 'LogoLoader — Sin texto',
258
+ parameters: {
259
+ docs: {
260
+ description: {
261
+ story: 'LogoLoader sin label de texto debajo del track.'
262
+ }
263
+ }
264
+ }
265
+ };
266
+ export const TestSite = {
267
+ render: () => /*#__PURE__*/React.createElement("div", {
268
+ style: {
269
+ display: 'flex',
270
+ flexDirection: 'column',
271
+ gap: '32px'
272
+ }
273
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
274
+ style: {
275
+ fontFamily: 'sans-serif',
276
+ fontSize: '12px',
277
+ marginBottom: '8px'
278
+ }
279
+ }, "Spinner \u2014 loading true"), /*#__PURE__*/React.createElement("div", {
280
+ style: {
281
+ height: '120px',
282
+ position: 'relative'
283
+ }
284
+ }, /*#__PURE__*/React.createElement(UTLoading, {
285
+ loading: true,
286
+ useUtilityLoading: false,
287
+ version: "V1"
288
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
289
+ style: {
290
+ fontFamily: 'sans-serif',
291
+ fontSize: '12px',
292
+ marginBottom: '8px'
293
+ }
294
+ }, "Spinner \u2014 sin texto"), /*#__PURE__*/React.createElement("div", {
295
+ style: {
296
+ height: '120px',
297
+ position: 'relative'
298
+ }
299
+ }, /*#__PURE__*/React.createElement(UTLoading, {
300
+ loading: true,
301
+ text: "",
302
+ useUtilityLoading: false,
303
+ version: "V1"
304
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
305
+ style: {
306
+ fontFamily: 'sans-serif',
307
+ fontSize: '12px',
308
+ marginBottom: '8px'
309
+ }
310
+ }, "Spinner \u2014 loading false (muestra children)"), /*#__PURE__*/React.createElement("div", {
311
+ style: {
312
+ height: '120px',
313
+ position: 'relative'
314
+ }
315
+ }, /*#__PURE__*/React.createElement(UTLoading, {
316
+ loading: false,
317
+ useUtilityLoading: false,
318
+ version: "V1"
319
+ }, /*#__PURE__*/React.createElement("span", null, "Contenido cargado")))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
320
+ style: {
321
+ fontFamily: 'sans-serif',
322
+ fontSize: '12px',
323
+ marginBottom: '8px'
324
+ }
325
+ }, "LogoLoader \u2014 en contenedor (fullScreen=false)"), /*#__PURE__*/React.createElement("div", {
326
+ style: {
327
+ border: '1px dashed #C1C7D0',
328
+ height: '200px',
329
+ position: 'relative'
330
+ }
331
+ }, /*#__PURE__*/React.createElement(UTLoading, {
332
+ fullScreen: false,
333
+ loading: true,
334
+ Logo: "https://utilitygo-demo-qa-ev.widergydev.com/favicon.png",
335
+ useUtilityLoading: true,
336
+ version: "V1"
337
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
338
+ style: {
339
+ fontFamily: 'sans-serif',
340
+ fontSize: '12px',
341
+ marginBottom: '8px'
342
+ }
343
+ }, "LogoLoader \u2014 loading false (muestra children)"), /*#__PURE__*/React.createElement("div", {
344
+ style: {
345
+ height: '80px',
346
+ position: 'relative'
347
+ }
348
+ }, /*#__PURE__*/React.createElement(UTLoading, {
349
+ fullScreen: false,
350
+ loading: false,
351
+ useUtilityLoading: true,
352
+ version: "V1"
353
+ }, /*#__PURE__*/React.createElement("span", null, "Contenido cargado"))))),
354
+ name: 'Test Site',
355
+ parameters: {
356
+ docs: {
357
+ description: {
358
+ story: 'Casos de prueba para el Storybook Test Runner.'
359
+ }
360
+ }
361
+ }
362
+ };
@@ -14,6 +14,7 @@
14
14
  | autocompleteProps | object | {} | Additional props to pass to the underlying Material-UI Autocomplete component. |
15
15
  | className | string | | Additional CSS class name for the component container. |
16
16
  | clearable | bool | true | Determines whether a button to clear the current selection should be shown. |
17
+ | CustomRow | elementType | | Custom React component to render each option row. Receives `{ item, isChecked }` as props, where `item` is the option object and `isChecked` indicates if the option is selected. |
17
18
  | dataTestId | string | | Test ID for the main input component. |
18
19
  | disabled | bool | false | Disables the select input. |
19
20
  | disableFilterOptions | bool | false | Disables option filtering, showing all options even when typing in the search field. |
@@ -231,6 +232,40 @@ const ReadOnlyExample = () => {
231
232
  };
232
233
  ```
233
234
 
235
+ ### With Custom Row Renderer
236
+
237
+ ```jsx
238
+ import React, { useState } from 'react';
239
+ import UTSelect from './UTSelect';
240
+
241
+ const options = [
242
+ { name: 'Alice', value: '1', subtitle: 'Admin' },
243
+ { name: 'Bob', value: '2', subtitle: 'Editor' },
244
+ { name: 'Carol', value: '3', subtitle: 'Viewer' }
245
+ ];
246
+
247
+ const MyCustomRow = ({ item, isChecked }) => (
248
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
249
+ <span style={{ fontWeight: isChecked ? 'bold' : 'normal' }}>{item.name}</span>
250
+ <span style={{ color: 'gray', fontSize: 12 }}>{item.subtitle}</span>
251
+ </div>
252
+ );
253
+
254
+ const CustomRowExample = () => {
255
+ const [value, setValue] = useState(null);
256
+
257
+ return (
258
+ <UTSelect
259
+ CustomRow={MyCustomRow}
260
+ onChange={setValue}
261
+ options={options}
262
+ placeholder="Select a user"
263
+ value={value}
264
+ />
265
+ );
266
+ };
267
+ ```
268
+
234
269
  ### With Search Term Handling
235
270
 
236
271
  ```jsx
@@ -0,0 +1,13 @@
1
+ import { ArgTypes, Canvas, Description, Meta, Title } from '@storybook/blocks';
2
+
3
+ import * as UTSelectV1Stories from './UTSelectV1.stories.js';
4
+
5
+ <Meta of={UTSelectV1Stories} />
6
+
7
+ <Title>UTSelect V1</Title>
8
+
9
+ <Description of={UTSelectV1Stories} />
10
+
11
+ <Canvas of={UTSelectV1Stories.Playground} withToolbar />
12
+
13
+ <ArgTypes exclude={['classes']} />