@widergy/energy-ui 3.167.1 → 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.
- package/CHANGELOG.md +7 -0
- package/dist/components/UTLoading/README.md +85 -0
- package/dist/components/UTLoading/components/Spinner/index.js +1 -1
- package/dist/components/UTLoading/index.js +17 -7
- package/dist/components/UTLoading/versions/V0/index.js +32 -0
- package/dist/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +65 -0
- package/dist/components/UTLoading/versions/V1/components/LogoLoader/constants.js +14 -0
- package/dist/components/UTLoading/versions/V1/components/LogoLoader/index.js +54 -0
- package/dist/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
- package/dist/components/UTLoading/versions/V1/components/LogoLoader/theme.js +18 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +7 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +57 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/constants.js +12 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/index.js +56 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
- package/dist/components/UTLoading/versions/V1/components/Spinner/theme.js +21 -0
- package/dist/components/UTLoading/versions/V1/constants.js +11 -0
- package/dist/components/UTLoading/versions/V1/index.js +30 -0
- package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
- package/dist/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +369 -0
- package/dist/constants/testIds.js +4 -0
- package/dist/esm/components/UTLoading/README.md +85 -0
- package/dist/esm/components/UTLoading/components/Spinner/index.js +1 -1
- package/dist/esm/components/UTLoading/index.js +18 -8
- package/dist/esm/components/UTLoading/versions/V0/index.js +25 -0
- package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/components/GradientTrack/index.js +58 -0
- package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/constants.js +8 -0
- package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/index.js +47 -0
- package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/styles.module.scss +107 -0
- package/dist/esm/components/UTLoading/versions/V1/components/LogoLoader/theme.js +11 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/constants.js +1 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/components/SpinnerTrack/index.js +50 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/constants.js +6 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/index.js +49 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/styles.module.scss +39 -0
- package/dist/esm/components/UTLoading/versions/V1/components/Spinner/theme.js +14 -0
- package/dist/esm/components/UTLoading/versions/V1/constants.js +5 -0
- package/dist/esm/components/UTLoading/versions/V1/index.js +23 -0
- package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.mdx +67 -0
- package/dist/esm/components/UTLoading/versions/V1/stories/UTLoadingV1.stories.js +362 -0
- package/dist/esm/constants/testIds.js +4 -0
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +16 -1
- package/dist/utils/hooks/useCSSVariables/constants.js +16 -1
- package/package.json +1 -1
|
@@ -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,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,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`).
|