@widergy/energy-ui 3.167.0 → 3.168.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 (52) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/dist/components/UTDatePicker/assets/calendar.svg +3 -13
  3. package/dist/components/UTDatePicker/versions/V0/assets/calendar.svg +3 -13
  4. package/dist/components/UTDatePicker/versions/V0/index.js +3 -10
  5. package/dist/components/UTDatePicker/versions/V1/index.js +2 -1
  6. package/dist/components/UTLoading/README.md +85 -0
  7. package/dist/components/UTLoading/components/Spinner/index.js +1 -1
  8. package/dist/components/UTLoading/index.js +17 -7
  9. package/dist/components/UTLoading/versions/V0/index.js +32 -0
  10. package/dist/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +65 -0
  11. package/dist/components/UTLoading/versions/V1/components/LogoLoader/constants.js +14 -0
  12. package/dist/components/UTLoading/versions/V1/components/LogoLoader/index.js +54 -0
  13. package/dist/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
  14. package/dist/components/UTLoading/versions/V1/components/LogoLoader/theme.js +18 -0
  15. package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +7 -0
  16. package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +57 -0
  17. package/dist/components/UTLoading/versions/V1/components/Spinner/constants.js +12 -0
  18. package/dist/components/UTLoading/versions/V1/components/Spinner/index.js +56 -0
  19. package/dist/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
  20. package/dist/components/UTLoading/versions/V1/components/Spinner/theme.js +21 -0
  21. package/dist/components/UTLoading/versions/V1/constants.js +11 -0
  22. package/dist/components/UTLoading/versions/V1/index.js +30 -0
  23. package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
  24. package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +369 -0
  25. package/dist/constants/testIds.js +4 -0
  26. package/dist/esm/components/UTDatePicker/assets/calendar.svg +3 -13
  27. package/dist/esm/components/UTDatePicker/versions/V0/assets/calendar.svg +3 -13
  28. package/dist/esm/components/UTDatePicker/versions/V0/index.js +3 -10
  29. package/dist/esm/components/UTDatePicker/versions/V1/index.js +2 -1
  30. package/dist/esm/components/UTLoading/README.md +85 -0
  31. package/dist/esm/components/UTLoading/components/Spinner/index.js +1 -1
  32. package/dist/esm/components/UTLoading/index.js +18 -8
  33. package/dist/esm/components/UTLoading/versions/V0/index.js +25 -0
  34. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +58 -0
  35. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/constants.js +8 -0
  36. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/index.js +47 -0
  37. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
  38. package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/theme.js +11 -0
  39. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +1 -0
  40. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +50 -0
  41. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/constants.js +6 -0
  42. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/index.js +49 -0
  43. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
  44. package/dist/esm/components/UTLoading/versions/V1/components/Spinner/theme.js +14 -0
  45. package/dist/esm/components/UTLoading/versions/V1/constants.js +5 -0
  46. package/dist/esm/components/UTLoading/versions/V1/index.js +23 -0
  47. package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
  48. package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +362 -0
  49. package/dist/esm/constants/testIds.js +4 -0
  50. package/dist/esm/utils/hooks/useCSSVariables/constants.js +16 -1
  51. package/dist/utils/hooks/useCSSVariables/constants.js +16 -1
  52. package/package.json +1 -1
@@ -197,7 +197,8 @@ const UTDatePicker = _ref => {
197
197
  InputProps: {
198
198
  endAdornment
199
199
  },
200
- onChange: handleTextChange
200
+ onChange: handleTextChange,
201
+ fullWidth: true
201
202
  },
202
203
  onBlur: handleTextBlur,
203
204
  onFocus: openCalendar,
@@ -0,0 +1,85 @@
1
+ # UTLoading
2
+
3
+ Componente de carga con soporte de versiones. Muestra un indicador visual de carga mientras se obtienen datos. Soporta dos variantes internas: un Spinner circular y un LogoLoader con el logo/isologo del cliente.
4
+
5
+ ## Versiones
6
+
7
+ ### V0 (default)
8
+
9
+ Comportamiento original. Se activa cuando no se pasa la prop `version` o cuando se pasa `version="V0"`.
10
+
11
+ - `useUtilityLoading=false` → Spinner basado en Material UI `CircularProgress`
12
+ - `useUtilityLoading=true` → AnimatedCircles: logo + 3 puntos animados, siempre full screen
13
+
14
+ ### V1
15
+
16
+ Nueva versión con diseño actualizado. Se activa pasando `version="V1"`.
17
+
18
+ - `useUtilityLoading=false` → Nuevo Spinner CSS puro con línea más gruesa
19
+ - `useUtilityLoading=true` → LogoLoader: track de gradiente animado con logo del cliente, prop `fullScreen` para controlar comportamiento
20
+
21
+ ## Uso básico
22
+
23
+ ```jsx
24
+ import { UTLoading } from '@widergy/energy-ui';
25
+
26
+ // V0 (default — sin cambios)
27
+ <UTLoading loading>
28
+ <MiContenido />
29
+ </UTLoading>
30
+
31
+ // V1 — Spinner
32
+ <UTLoading version="V1" loading useUtilityLoading={false}>
33
+ <MiContenido />
34
+ </UTLoading>
35
+
36
+ // V1 — LogoLoader full screen
37
+ <UTLoading
38
+ version="V1"
39
+ loading
40
+ useUtilityLoading
41
+ Logo="https://mi-dominio.com/logo.svg"
42
+ fullScreen
43
+ />
44
+
45
+ // V1 — LogoLoader en contenedor
46
+ <UTLoading
47
+ version="V1"
48
+ loading
49
+ useUtilityLoading
50
+ fullScreen={false}
51
+ >
52
+ <MiContenido />
53
+ </UTLoading>
54
+ ```
55
+
56
+ ## Props
57
+
58
+ | Prop | Tipo | Default | Descripción |
59
+ |------|------|---------|-------------|
60
+ | `version` | `string` | `'V0'` | `'V0'` o `'V1'` — selecciona la versión a renderizar |
61
+ | `loading` | `bool` | — | Muestra el loader cuando `true`, los `children` cuando `false` |
62
+ | `children` | `node` | — | Contenido a mostrar cuando `loading=false` |
63
+ | `useUtilityLoading` | `bool` | — | `true` → LogoLoader / AnimatedCircles; `false` → Spinner |
64
+ | `fullScreen` | `bool` | `true` | Solo V1 LogoLoader. `true`: `position: fixed` full screen. `false`: adaptado al contenedor |
65
+ | `Logo` | `string` | — | URL del asset SVG del logo/isologo del cliente |
66
+ | `text` | `string` | `'Cargando el contenido...'` | Texto de carga. Pasar `''` para ocultarlo (solo V1) |
67
+ | `dataTestId` | `string` | — | `data-testid` del elemento raíz (solo V1) |
68
+ | `color` | `string` | — | Color CSS explícito del spinner (solo V0 Spinner) |
69
+ | `size` | `number` | — | Tamaño del spinner en px (solo V0) |
70
+ | `thickness` | `number` | — | Grosor del spinner (solo V0) |
71
+ | `preventUnmount` | `bool` | `false` | Mantiene los children en el DOM cuando `loading=true` (Spinner) |
72
+ | `className` | `string` | — | Clase adicional para el spinner (solo V0) |
73
+ | `textClassName` | `string` | — | Clase del texto (solo V0) |
74
+ | `wrapperClassName` | `string` | — | Clase del wrapper de children (Spinner) |
75
+ | `classNames` | `object` | — | Objeto de clases para AnimatedCircles (solo V0) |
76
+
77
+ ## Design tokens — V1
78
+
79
+ | Token | Descripción | Fallback |
80
+ |-------|-------------|---------|
81
+ | `--UT-loading-track-color-start` | Color inicial del gradiente del track | `identitySolidTone1` del cliente |
82
+ | `--UT-loading-track-color-end` | Color final del gradiente del track | `identitySolidTone2` del cliente |
83
+ | `--UT-loading-gap` | Gap entre track/spinner y label | `8px` |
84
+
85
+ > Los tokens de color del gradiente se derivan automáticamente de los colores de identidad de cada cliente. El ajuste de valores exactos queda pendiente de confirmación de Diseño en Figma (CX-2398).
@@ -13,7 +13,7 @@ const Spinner = _ref => {
13
13
  thickness,
14
14
  wrapperClassName
15
15
  } = _ref;
16
- return /*#__PURE__*/React.createElement(Fragment, null, loading && /*#__PURE__*/React.createElement(Loading, {
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loading && /*#__PURE__*/React.createElement(Loading, {
17
17
  className: className,
18
18
  size: size,
19
19
  text: text,
@@ -1,17 +1,26 @@
1
1
  import React from 'react';
2
- import { bool, node, number, string } from 'prop-types';
3
- import AnimatedCircles from './components/AnimatedCircles';
4
- import Spinner from './components/Spinner';
5
- const UTLoading = props => {
6
- const {
7
- useUtilityLoading
8
- } = props || {};
9
- return useUtilityLoading ? /*#__PURE__*/React.createElement(AnimatedCircles, props) : /*#__PURE__*/React.createElement(Spinner, props);
2
+ import { arrayOf, bool, node, number, string } from 'prop-types';
3
+ import V0 from './versions/V0';
4
+ import V1 from './versions/V1';
5
+ const COMPONENTS = {
6
+ V0,
7
+ V1
8
+ };
9
+ const UTLoading = _ref => {
10
+ let {
11
+ version = 'V0',
12
+ ...props
13
+ } = _ref;
14
+ const Component = COMPONENTS[version] || V0;
15
+ return /*#__PURE__*/React.createElement(Component, props);
10
16
  };
11
17
  UTLoading.propTypes = {
12
18
  children: node,
13
19
  className: string,
14
20
  color: string,
21
+ colors: arrayOf(string),
22
+ dataTestId: string,
23
+ fullScreen: bool,
15
24
  loading: bool,
16
25
  Logo: string,
17
26
  preventUnmount: bool,
@@ -20,6 +29,7 @@ UTLoading.propTypes = {
20
29
  textClassName: string,
21
30
  thickness: number,
22
31
  useUtilityLoading: bool,
32
+ version: string,
23
33
  wrapperClassName: string
24
34
  };
25
35
  export default UTLoading;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { bool, node, number, string } from 'prop-types';
3
+ import AnimatedCircles from '../../components/AnimatedCircles';
4
+ import Spinner from '../../components/Spinner';
5
+ const V0 = props => {
6
+ const {
7
+ useUtilityLoading
8
+ } = props;
9
+ return useUtilityLoading ? /*#__PURE__*/React.createElement(AnimatedCircles, props) : /*#__PURE__*/React.createElement(Spinner, props);
10
+ };
11
+ V0.propTypes = {
12
+ children: node,
13
+ className: string,
14
+ color: string,
15
+ loading: bool,
16
+ Logo: string,
17
+ preventUnmount: bool,
18
+ size: number,
19
+ text: string,
20
+ textClassName: string,
21
+ thickness: number,
22
+ useUtilityLoading: bool,
23
+ wrapperClassName: string
24
+ };
25
+ export default V0;
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { GLOW_FILTER_ID, GRADIENT_ID, INNER_CIRCLE_RADIUS, TRACK_CENTER, TRACK_RADIUS, TRACK_STROKE_WIDTH, TRACK_VIEW_BOX_SIZE } from '../../constants';
3
+ import styles from '../../styles.module.scss';
4
+ const GradientTrack = () => /*#__PURE__*/React.createElement("svg", {
5
+ className: styles.track,
6
+ overflow: "visible",
7
+ viewBox: "0 0 ".concat(TRACK_VIEW_BOX_SIZE, " ").concat(TRACK_VIEW_BOX_SIZE),
8
+ xmlns: "http://www.w3.org/2000/svg"
9
+ }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
10
+ id: GRADIENT_ID,
11
+ x1: "0%",
12
+ x2: "100%",
13
+ y1: "0%",
14
+ y2: "100%"
15
+ }, /*#__PURE__*/React.createElement("stop", {
16
+ offset: "0%",
17
+ style: {
18
+ stopColor: 'var(--UT-loading-color-start, #25E0A6)'
19
+ }
20
+ }), /*#__PURE__*/React.createElement("stop", {
21
+ offset: "100%",
22
+ style: {
23
+ stopColor: 'var(--UT-loading-color-end, #20BBFC)'
24
+ }
25
+ })), /*#__PURE__*/React.createElement("filter", {
26
+ id: GLOW_FILTER_ID,
27
+ x: "-50%",
28
+ y: "-50%",
29
+ height: "200%",
30
+ width: "200%"
31
+ }, /*#__PURE__*/React.createElement("feGaussianBlur", {
32
+ result: "blur",
33
+ stdDeviation: "12"
34
+ }))), /*#__PURE__*/React.createElement("circle", {
35
+ className: styles.trackGlow,
36
+ cx: TRACK_CENTER,
37
+ cy: TRACK_CENTER,
38
+ filter: "url(#".concat(GLOW_FILTER_ID, ")"),
39
+ r: TRACK_RADIUS
40
+ }), /*#__PURE__*/React.createElement("circle", {
41
+ className: styles.trackBackground,
42
+ cx: TRACK_CENTER,
43
+ cy: TRACK_CENTER,
44
+ r: TRACK_RADIUS,
45
+ strokeWidth: TRACK_STROKE_WIDTH
46
+ }), /*#__PURE__*/React.createElement("circle", {
47
+ className: styles.innerFill,
48
+ cx: TRACK_CENTER,
49
+ cy: TRACK_CENTER,
50
+ r: INNER_CIRCLE_RADIUS
51
+ }), /*#__PURE__*/React.createElement("circle", {
52
+ className: styles.trackGradient,
53
+ cx: TRACK_CENTER,
54
+ cy: TRACK_CENTER,
55
+ r: TRACK_RADIUS,
56
+ strokeWidth: TRACK_STROKE_WIDTH
57
+ }));
58
+ export default GradientTrack;
@@ -0,0 +1,8 @@
1
+ export const DEFAULT_LOADING_TEXT = 'Cargando...';
2
+ export const TRACK_VIEW_BOX_SIZE = 120;
3
+ export const TRACK_CENTER = 60;
4
+ export const TRACK_RADIUS = 53;
5
+ export const TRACK_STROKE_WIDTH = 11;
6
+ export const INNER_CIRCLE_RADIUS = 47.5;
7
+ export const GRADIENT_ID = 'UTLoadingTrackGradient';
8
+ export const GLOW_FILTER_ID = 'UTLoadingGlow';
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { bool, node, objectOf, string } from 'prop-types';
3
+ import UTLabel from '../../../../../UTLabel';
4
+ import WithTheme from '../../../../../WithTheme';
5
+ import { TEST_IDS } from '../../../../../../constants/testIds';
6
+ import { DEFAULT_LOADING_TEXT } from './constants';
7
+ import GradientTrack from './components/GradientTrack';
8
+ import { retrieveStyle } from './theme';
9
+ import styles from './styles.module.scss';
10
+ const {
11
+ UTLoading: UTLoadingTestIds
12
+ } = TEST_IDS;
13
+ const LogoLoader = _ref => {
14
+ let {
15
+ children,
16
+ classes,
17
+ dataTestId,
18
+ fullScreen,
19
+ loading,
20
+ Logo,
21
+ text = DEFAULT_LOADING_TEXT
22
+ } = _ref;
23
+ return loading ? /*#__PURE__*/React.createElement("div", {
24
+ className: "".concat(styles.container, " ").concat(fullScreen ? styles.fullScreen : styles.contained, " ").concat(classes.root),
25
+ "data-testid": dataTestId || UTLoadingTestIds.logoLoader
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: styles.loaderWrapper
28
+ }, /*#__PURE__*/React.createElement(GradientTrack, null), /*#__PURE__*/React.createElement("div", {
29
+ className: styles.innerCircle
30
+ }, Logo && /*#__PURE__*/React.createElement("img", {
31
+ alt: "",
32
+ className: styles.logo,
33
+ src: Logo
34
+ }))), text && /*#__PURE__*/React.createElement(UTLabel, {
35
+ className: styles.text
36
+ }, text)) : children;
37
+ };
38
+ LogoLoader.propTypes = {
39
+ children: node,
40
+ classes: objectOf(string),
41
+ dataTestId: string,
42
+ fullScreen: bool,
43
+ loading: bool,
44
+ Logo: string,
45
+ text: string
46
+ };
47
+ export default WithTheme(retrieveStyle)(LogoLoader);
@@ -0,0 +1,107 @@
1
+ @use '../../../../../../scss/variables/colors.module.scss' as *;
2
+
3
+ $animation-duration: 1.4s;
4
+ $fade-in-animation: fadeIn 0.7s ease-in-out forwards;
5
+ $default-container-background-color: #ffffff;
6
+
7
+ .contained {
8
+ height: 100%;
9
+ position: relative;
10
+ width: 100%;
11
+ }
12
+
13
+ .container {
14
+ align-items: center;
15
+ background-color: transparent;
16
+ display: flex;
17
+ flex-direction: column;
18
+ justify-content: center;
19
+ }
20
+
21
+ .fullScreen {
22
+ background-color: var(--light01, $default-container-background-color);
23
+ bottom: 0;
24
+ left: 0;
25
+ position: fixed;
26
+ right: 0;
27
+ top: 0;
28
+ z-index: 999;
29
+ }
30
+
31
+ .loaderWrapper {
32
+ align-items: center;
33
+ animation: $fade-in-animation;
34
+ display: flex;
35
+ justify-content: center;
36
+ position: relative;
37
+ }
38
+
39
+ .track {
40
+ animation: spin $animation-duration linear infinite;
41
+ display: block;
42
+ height: var(--UT-loading-size, 7.5rem);
43
+ width: var(--UT-loading-size, 7.5rem);
44
+ }
45
+
46
+ .trackGlow {
47
+ fill: none;
48
+ opacity: 0.72;
49
+ stroke: url('#UTLoadingTrackGradient');
50
+ stroke-width: 18;
51
+ }
52
+
53
+ .trackBackground {
54
+ fill: none;
55
+ stroke: var(--light02);
56
+ stroke-width: 11;
57
+ }
58
+
59
+ .innerFill {
60
+ fill: var(--light01, $white);
61
+ }
62
+
63
+ .trackGradient {
64
+ fill: none;
65
+ stroke: url('#UTLoadingTrackGradient');
66
+ stroke-linecap: round;
67
+ stroke-width: 11;
68
+ }
69
+
70
+ .innerCircle {
71
+ align-items: center;
72
+ display: flex;
73
+ justify-content: center;
74
+ left: 50%;
75
+ position: absolute;
76
+ top: 50%;
77
+ transform: translate(-50%, -50%);
78
+ }
79
+
80
+ .logo {
81
+ display: block;
82
+ height: var(--UT-loading-logo-width, 3.5rem);
83
+ object-fit: contain;
84
+ width: var(--UT-loading-logo-width, 3.5rem);
85
+ }
86
+
87
+ .text {
88
+ animation: $fade-in-animation;
89
+ font-size: var(--UT-loading-text-size, 0.875rem) !important;
90
+ margin-top: var(--UT-loading-gap, 1.5rem) !important;
91
+ }
92
+
93
+ @keyframes fadeIn {
94
+ from {
95
+ opacity: 0;
96
+ }
97
+
98
+ to {
99
+ opacity: 1;
100
+ }
101
+ }
102
+
103
+ @keyframes spin {
104
+ to {
105
+ transform: rotate(360deg);
106
+ }
107
+ }
@@ -0,0 +1,11 @@
1
+ export const retrieveStyle = _ref => {
2
+ var _theme$Palette;
3
+ let {
4
+ theme
5
+ } = _ref;
6
+ return {
7
+ root: {
8
+ backgroundColor: ((_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 || (_theme$Palette = _theme$Palette.light) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette['01']) || '#FFFFFF'
9
+ }
10
+ };
11
+ };
@@ -0,0 +1 @@
1
+ export const GRADIENT_ID = 'ut-spinner-gradient';
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { arrayOf, objectOf, string } from 'prop-types';
3
+ import { SPINNER_ARC_LENGTH, SPINNER_CENTER, SPINNER_CIRCUMFERENCE, SPINNER_RADIUS, SPINNER_VIEW_BOX_SIZE } from '../../constants';
4
+ import styles from '../../styles.module.scss';
5
+ import { GRADIENT_ID } from './constants';
6
+ const SpinnerTrack = _ref => {
7
+ let {
8
+ classes = {},
9
+ colors
10
+ } = _ref;
11
+ const useGradient = colors && colors.length >= 2;
12
+ const solidColor = !useGradient && colors && colors.length === 1 ? colors[0] : undefined;
13
+ const arcStroke = useGradient ? "url(#".concat(GRADIENT_ID, ")") : solidColor;
14
+ return /*#__PURE__*/React.createElement("svg", {
15
+ className: styles.spinner,
16
+ viewBox: "0 0 ".concat(SPINNER_VIEW_BOX_SIZE, " ").concat(SPINNER_VIEW_BOX_SIZE),
17
+ xmlns: "http://www.w3.org/2000/svg"
18
+ }, useGradient && /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
19
+ id: GRADIENT_ID,
20
+ x1: "0%",
21
+ y1: "0%",
22
+ x2: "0%",
23
+ y2: "100%"
24
+ }, /*#__PURE__*/React.createElement("stop", {
25
+ offset: "0%",
26
+ stopColor: colors[0]
27
+ }), /*#__PURE__*/React.createElement("stop", {
28
+ offset: "100%",
29
+ stopColor: colors[1]
30
+ }))), /*#__PURE__*/React.createElement("circle", {
31
+ className: "".concat(styles.track, " ").concat(classes.track || ''),
32
+ cx: SPINNER_CENTER,
33
+ cy: SPINNER_CENTER,
34
+ r: SPINNER_RADIUS
35
+ }), /*#__PURE__*/React.createElement("circle", {
36
+ className: "".concat(styles.arc, " ").concat(!arcStroke ? classes.arc || '' : ''),
37
+ cx: SPINNER_CENTER,
38
+ cy: SPINNER_CENTER,
39
+ r: SPINNER_RADIUS,
40
+ strokeDasharray: "".concat(SPINNER_ARC_LENGTH, " ").concat(SPINNER_CIRCUMFERENCE),
41
+ style: arcStroke ? {
42
+ stroke: arcStroke
43
+ } : undefined
44
+ }));
45
+ };
46
+ SpinnerTrack.propTypes = {
47
+ classes: objectOf(string),
48
+ colors: arrayOf(string)
49
+ };
50
+ export default SpinnerTrack;
@@ -0,0 +1,6 @@
1
+ export const DEFAULT_LOADING_TEXT = 'Cargando...';
2
+ export const SPINNER_VIEW_BOX_SIZE = 50;
3
+ export const SPINNER_CENTER = 25;
4
+ export const SPINNER_RADIUS = 20;
5
+ export const SPINNER_CIRCUMFERENCE = 126;
6
+ export const SPINNER_ARC_LENGTH = 94;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { arrayOf, bool, node, objectOf, string } from 'prop-types';
3
+ import UTLabel from '../../../../../UTLabel';
4
+ import WithTheme from '../../../../../WithTheme';
5
+ import { TEST_IDS } from '../../../../../../constants/testIds';
6
+ import { DEFAULT_LOADING_TEXT } from './constants';
7
+ import SpinnerTrack from './components/SpinnerTrack';
8
+ import { retrieveStyle } from './theme';
9
+ import styles from './styles.module.scss';
10
+ const {
11
+ UTLoading: UTLoadingTestIds
12
+ } = TEST_IDS;
13
+ const Spinner = _ref => {
14
+ let {
15
+ children,
16
+ classes,
17
+ colors,
18
+ dataTestId,
19
+ loading,
20
+ preventUnmount = false,
21
+ text = DEFAULT_LOADING_TEXT,
22
+ wrapperClassName
23
+ } = _ref;
24
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loading && /*#__PURE__*/React.createElement("div", {
25
+ className: styles.container,
26
+ "data-testid": dataTestId || UTLoadingTestIds.spinner
27
+ }, /*#__PURE__*/React.createElement(SpinnerTrack, {
28
+ classes: classes,
29
+ colors: colors
30
+ }), text && /*#__PURE__*/React.createElement(UTLabel, {
31
+ className: styles.text
32
+ }, text)), preventUnmount ? /*#__PURE__*/React.createElement("div", {
33
+ className: wrapperClassName,
34
+ style: loading ? {
35
+ display: 'none'
36
+ } : {}
37
+ }, children) : !loading && children);
38
+ };
39
+ Spinner.propTypes = {
40
+ children: node,
41
+ classes: objectOf(string),
42
+ colors: arrayOf(string),
43
+ dataTestId: string,
44
+ loading: bool,
45
+ preventUnmount: bool,
46
+ text: string,
47
+ wrapperClassName: string
48
+ };
49
+ export default WithTheme(retrieveStyle)(Spinner);
@@ -0,0 +1,39 @@
1
+ .container {
2
+ align-items: center;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ justify-content: center;
7
+ width: 100%;
8
+ }
9
+
10
+ .spinner {
11
+ animation: spin 0.8s linear infinite;
12
+ display: block;
13
+ flex-shrink: 0;
14
+ height: var(--UT-loading-size, 85px);
15
+ width: var(--UT-loading-size, 85px);
16
+ }
17
+
18
+ .track {
19
+ fill: none;
20
+ opacity: 0.15;
21
+ stroke-width: 4;
22
+ }
23
+
24
+ .arc {
25
+ fill: none;
26
+ stroke-dasharray: 94 126;
27
+ stroke-linecap: round;
28
+ stroke-width: 4;
29
+ }
30
+
31
+ .text {
32
+ margin-top: var(--UT-loading-gap, 1.5rem) !important;
33
+ }
34
+
35
+ @keyframes spin {
36
+ to {
37
+ transform: rotate(360deg);
38
+ }
39
+ }
@@ -0,0 +1,14 @@
1
+ export const retrieveStyle = _ref => {
2
+ var _theme$Palette, _theme$Palette2;
3
+ let {
4
+ theme
5
+ } = _ref;
6
+ return {
7
+ arc: {
8
+ stroke: ((_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 || (_theme$Palette = _theme$Palette.accent) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette['05']) || '#0136E7'
9
+ },
10
+ track: {
11
+ stroke: ((_theme$Palette2 = theme.Palette) === null || _theme$Palette2 === void 0 || (_theme$Palette2 = _theme$Palette2.accent) === null || _theme$Palette2 === void 0 ? void 0 : _theme$Palette2['05']) || '#0136E7'
12
+ }
13
+ };
14
+ };
@@ -0,0 +1,5 @@
1
+ export const DEFAULT_LOADING_TEXT = 'Cargando...';
2
+ export const DEFAULT_PROPS = {
3
+ fullScreen: true,
4
+ text: DEFAULT_LOADING_TEXT
5
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { arrayOf, bool, node, string } from 'prop-types';
3
+ import LogoLoader from './components/LogoLoader';
4
+ import Spinner from './components/Spinner';
5
+ const V1 = props => {
6
+ const {
7
+ useUtilityLoading
8
+ } = props;
9
+ return useUtilityLoading ? /*#__PURE__*/React.createElement(LogoLoader, props) : /*#__PURE__*/React.createElement(Spinner, props);
10
+ };
11
+ V1.propTypes = {
12
+ children: node,
13
+ colors: arrayOf(string),
14
+ dataTestId: string,
15
+ fullScreen: bool,
16
+ loading: bool,
17
+ Logo: string,
18
+ preventUnmount: bool,
19
+ text: string,
20
+ useUtilityLoading: bool,
21
+ wrapperClassName: string
22
+ };
23
+ export default V1;
@@ -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`).