@widergy/energy-ui 3.161.0 → 3.162.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -2
- package/dist/components/UTBanner/README.md +41 -8
- package/dist/components/UTBanner/constants.js +36 -0
- package/dist/components/UTBanner/index.js +118 -15
- package/dist/components/UTBanner/stories/UTBanner.stories.js +164 -0
- package/dist/components/UTBanner/styles.module.scss +149 -5
- package/dist/components/UTBanner/types.js +20 -0
- package/dist/components/UTBanner/utils.js +148 -0
- package/dist/components/UTGraph/index.js +1 -1
- package/dist/components/UTHeader/index.js +3 -2
- package/dist/components/UTIcon/components/FlagsIcons/flagsComponents/index.js +61 -0
- package/dist/components/UTIcon/theme.js +5 -3
- package/dist/constants/testIds.js +2 -0
- package/dist/esm/components/UTBanner/README.md +41 -8
- package/dist/esm/components/UTBanner/constants.js +30 -0
- package/dist/esm/components/UTBanner/index.js +120 -16
- package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +157 -0
- package/dist/esm/components/UTBanner/styles.module.scss +149 -5
- package/dist/esm/components/UTBanner/types.js +14 -0
- package/dist/esm/components/UTBanner/utils.js +137 -0
- package/dist/esm/components/UTGraph/index.js +2 -2
- package/dist/esm/components/UTHeader/index.js +3 -2
- package/dist/esm/components/UTIcon/components/FlagsIcons/flagsComponents/index.js +54 -0
- package/dist/esm/components/UTIcon/theme.js +4 -2
- package/dist/esm/constants/testIds.js +2 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +13 -0
- package/dist/index.js +7 -0
- package/dist/utils/hooks/useCSSVariables/constants.js +13 -0
- package/package.json +1 -1
- package/dist/components/UTBanner/theme.js +0 -18
- package/dist/esm/components/UTBanner/theme.js +0 -11
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/* eslint-disable no-alert */
|
|
2
|
+
import UTBanner from '..';
|
|
3
|
+
import { COLOR_THEMES, PLACEMENTS, SIZES, VARIANTS } from '../constants';
|
|
4
|
+
export default {
|
|
5
|
+
args: {
|
|
6
|
+
buttonPlacement: PLACEMENTS.HORIZONTAL,
|
|
7
|
+
colorTheme: COLOR_THEMES.GRAY,
|
|
8
|
+
iconPlacement: PLACEMENTS.HORIZONTAL,
|
|
9
|
+
size: SIZES.MEDIUM,
|
|
10
|
+
title: 'Your account information has been updated successfully.',
|
|
11
|
+
variant: VARIANTS.LIGHT
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
button: {
|
|
15
|
+
control: 'object',
|
|
16
|
+
description: 'Primary action button. Accepts all UTButton props.',
|
|
17
|
+
table: {
|
|
18
|
+
type: {
|
|
19
|
+
summary: 'object'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
buttonPlacement: {
|
|
24
|
+
control: {
|
|
25
|
+
type: 'select'
|
|
26
|
+
},
|
|
27
|
+
options: Object.values(PLACEMENTS)
|
|
28
|
+
},
|
|
29
|
+
category: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Optional category label shown above the title (xsmall, uppercase, gray).'
|
|
32
|
+
},
|
|
33
|
+
colorTheme: {
|
|
34
|
+
control: {
|
|
35
|
+
type: 'select'
|
|
36
|
+
},
|
|
37
|
+
options: Object.values(COLOR_THEMES)
|
|
38
|
+
},
|
|
39
|
+
description: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: 'Optional body text shown below the title (small).'
|
|
42
|
+
},
|
|
43
|
+
helpText: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Optional secondary text shown below the description (small, gray).'
|
|
46
|
+
},
|
|
47
|
+
iconPlacement: {
|
|
48
|
+
control: {
|
|
49
|
+
type: 'select'
|
|
50
|
+
},
|
|
51
|
+
options: Object.values(PLACEMENTS)
|
|
52
|
+
},
|
|
53
|
+
Icon: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'Nombre del ícono (string) o componente React. Ej: "IconAlertCircle".'
|
|
56
|
+
},
|
|
57
|
+
iconProps: {
|
|
58
|
+
control: false
|
|
59
|
+
},
|
|
60
|
+
onClose: {
|
|
61
|
+
control: false
|
|
62
|
+
},
|
|
63
|
+
secondaryButton: {
|
|
64
|
+
control: 'object',
|
|
65
|
+
description: 'Secondary action button. Renders as variant="text" by default.'
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
control: {
|
|
69
|
+
type: 'select'
|
|
70
|
+
},
|
|
71
|
+
options: Object.values(SIZES)
|
|
72
|
+
},
|
|
73
|
+
title: {
|
|
74
|
+
control: 'text',
|
|
75
|
+
description: 'Main text of the banner.'
|
|
76
|
+
},
|
|
77
|
+
variant: {
|
|
78
|
+
control: {
|
|
79
|
+
type: 'select'
|
|
80
|
+
},
|
|
81
|
+
options: Object.values(VARIANTS)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
component: UTBanner,
|
|
85
|
+
title: 'Energy-UI/UTBanner'
|
|
86
|
+
};
|
|
87
|
+
export const Playground = {};
|
|
88
|
+
export const WithClose = {
|
|
89
|
+
args: {
|
|
90
|
+
colorTheme: COLOR_THEMES.WARNING,
|
|
91
|
+
onClose: () => alert('closed'),
|
|
92
|
+
title: 'Session will expire in 5 minutes.'
|
|
93
|
+
},
|
|
94
|
+
name: 'With Close Button'
|
|
95
|
+
};
|
|
96
|
+
export const WithActions = {
|
|
97
|
+
args: {
|
|
98
|
+
button: {
|
|
99
|
+
title: 'Retry',
|
|
100
|
+
onClick: () => alert('retry')
|
|
101
|
+
},
|
|
102
|
+
colorTheme: COLOR_THEMES.ERROR,
|
|
103
|
+
secondaryButton: {
|
|
104
|
+
title: 'Dismiss',
|
|
105
|
+
onClick: () => alert('dismiss')
|
|
106
|
+
},
|
|
107
|
+
title: 'Something went wrong while loading your data.'
|
|
108
|
+
},
|
|
109
|
+
name: 'With Actions'
|
|
110
|
+
};
|
|
111
|
+
export const WithCategoryAndHelpText = {
|
|
112
|
+
args: {
|
|
113
|
+
category: 'Notice',
|
|
114
|
+
colorTheme: COLOR_THEMES.INFORMATION,
|
|
115
|
+
helpText: 'Contact billing if you have any questions.',
|
|
116
|
+
title: 'Your invoice is due in 3 days.'
|
|
117
|
+
},
|
|
118
|
+
name: 'With Category and Help Text'
|
|
119
|
+
};
|
|
120
|
+
export const WithDescription = {
|
|
121
|
+
args: {
|
|
122
|
+
colorTheme: COLOR_THEMES.INFORMATION,
|
|
123
|
+
description: 'This action cannot be undone. All associated data will be permanently removed.',
|
|
124
|
+
title: 'Are you sure you want to delete this account?'
|
|
125
|
+
},
|
|
126
|
+
name: 'With Description'
|
|
127
|
+
};
|
|
128
|
+
export const VerticalLayout = {
|
|
129
|
+
args: {
|
|
130
|
+
button: {
|
|
131
|
+
title: 'View Details',
|
|
132
|
+
onClick: () => alert('details')
|
|
133
|
+
},
|
|
134
|
+
buttonPlacement: PLACEMENTS.VERTICAL,
|
|
135
|
+
category: 'Update',
|
|
136
|
+
colorTheme: COLOR_THEMES.PRIMARY,
|
|
137
|
+
description: 'This update includes performance improvements and bug fixes.',
|
|
138
|
+
helpText: 'Restart the app to apply changes.',
|
|
139
|
+
iconPlacement: PLACEMENTS.VERTICAL,
|
|
140
|
+
secondaryButton: {
|
|
141
|
+
title: 'Later',
|
|
142
|
+
onClick: () => alert('later')
|
|
143
|
+
},
|
|
144
|
+
size: SIZES.LARGE,
|
|
145
|
+
title: 'A new version is available.'
|
|
146
|
+
},
|
|
147
|
+
name: 'Vertical Layout'
|
|
148
|
+
};
|
|
149
|
+
export const DarkVariant = {
|
|
150
|
+
args: {
|
|
151
|
+
colorTheme: COLOR_THEMES.NEGATIVE,
|
|
152
|
+
onClose: () => alert('closed'),
|
|
153
|
+
title: 'Critical maintenance scheduled for tonight.',
|
|
154
|
+
variant: VARIANTS.DARK
|
|
155
|
+
},
|
|
156
|
+
name: 'Dark Variant'
|
|
157
|
+
};
|
|
@@ -1,7 +1,151 @@
|
|
|
1
1
|
.bannerContainer {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
align-items: flex-start;
|
|
3
|
+
border-radius: var(--UT-banner-radius, 8px);
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.contentContainer {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.contentHorizontal {
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.contentVertical {
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.iconTextContainer {
|
|
23
|
+
display: flex;
|
|
24
|
+
grid-gap: var(--UT-banner-icon-gap, 12px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.iconHorizontal {
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.iconVertical {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iconFlex {
|
|
37
|
+
flex: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.textContainer {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
grid-gap: var(--UT-banner-text-gap, 8px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.textFlex {
|
|
47
|
+
flex: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.buttonsContainer {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
grid-gap: var(--UT-banner-buttons-gap, 8px);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.buttonsVertical {
|
|
58
|
+
align-self: flex-start;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.gapSmall {
|
|
62
|
+
grid-gap: var(--UT-banner-gap-sm, 8px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.gapMedium {
|
|
66
|
+
grid-gap: var(--UT-banner-gap-md, 16px);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.gapLarge {
|
|
70
|
+
grid-gap: var(--UT-banner-gap-lg, 24px);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.paddingSmall {
|
|
74
|
+
padding: var(--UT-banner-padding-y-sm, 8px) var(--UT-banner-padding-x-sm, 12px);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.paddingMedium {
|
|
78
|
+
padding: var(--UT-banner-padding-md, 16px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.paddingLarge {
|
|
82
|
+
padding: var(--UT-banner-padding-lg, 24px);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.errorLight {
|
|
86
|
+
background-color: var(--actionError01);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.errorDark {
|
|
90
|
+
background-color: var(--actionError04);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.grayLight {
|
|
94
|
+
background-color: var(--light02);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.grayDark {
|
|
98
|
+
background-color: var(--gray05);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.informationLight {
|
|
102
|
+
background-color: var(--semanticInformation01);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.informationDark {
|
|
106
|
+
background-color: var(--semanticInformation04);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.negativeLight {
|
|
110
|
+
background-color: var(--actionNegative02);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.negativeDark {
|
|
114
|
+
background-color: var(--actionNegative04);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.primaryLight {
|
|
118
|
+
background-color: var(--actionAccent01);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.primaryDark {
|
|
122
|
+
background-color: var(--actionAccent04);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.successLight {
|
|
126
|
+
background-color: var(--semanticSuccess01);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.successDark {
|
|
130
|
+
background-color: var(--semanticSuccess04);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.warningLight {
|
|
134
|
+
background-color: var(--semanticWarning01);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.warningDark {
|
|
138
|
+
background-color: var(--semanticWarning04);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.whiteLight {
|
|
142
|
+
background-color: var(--light01);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.whiteDark {
|
|
146
|
+
background-color: var(--dark04);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.uppercase {
|
|
150
|
+
text-transform: uppercase;
|
|
7
151
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { bool, func, node, oneOfType, shape, string } from 'prop-types';
|
|
2
|
+
export const buttonType = shape({
|
|
3
|
+
colorTheme: string,
|
|
4
|
+
dataTestId: string,
|
|
5
|
+
disabled: bool,
|
|
6
|
+
Icon: oneOfType([string, func]),
|
|
7
|
+
iconPlacement: string,
|
|
8
|
+
loading: bool,
|
|
9
|
+
onClick: func,
|
|
10
|
+
size: string,
|
|
11
|
+
title: node,
|
|
12
|
+
type: string,
|
|
13
|
+
variant: string
|
|
14
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { COLOR_THEMES, SIZES, VARIANTS } from './constants';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the default UTIcon colorTheme and shade for the banner icon based on the
|
|
5
|
+
* banner's colorTheme and variant. Matches the mobile implementation.
|
|
6
|
+
* @param {string} colorTheme - Banner color theme.
|
|
7
|
+
* @param {string} variant - Banner variant ('light' | 'dark').
|
|
8
|
+
* @returns {{ colorTheme: string, shade: string }}
|
|
9
|
+
*/
|
|
10
|
+
export const getDefaultIconTheme = (colorTheme, variant) => {
|
|
11
|
+
var _COLOR_THEMES$ERROR$C;
|
|
12
|
+
if (variant === VARIANTS.DARK) {
|
|
13
|
+
return colorTheme === COLOR_THEMES.NEGATIVE ? {
|
|
14
|
+
colorTheme: 'dark',
|
|
15
|
+
shade: '05'
|
|
16
|
+
} : {
|
|
17
|
+
colorTheme: 'light',
|
|
18
|
+
shade: '01'
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return (_COLOR_THEMES$ERROR$C = {
|
|
22
|
+
[COLOR_THEMES.ERROR]: {
|
|
23
|
+
colorTheme: 'error',
|
|
24
|
+
shade: '04'
|
|
25
|
+
},
|
|
26
|
+
[COLOR_THEMES.GRAY]: {
|
|
27
|
+
colorTheme: 'accent',
|
|
28
|
+
shade: '04'
|
|
29
|
+
},
|
|
30
|
+
[COLOR_THEMES.INFORMATION]: {
|
|
31
|
+
colorTheme: 'information',
|
|
32
|
+
shade: '04'
|
|
33
|
+
},
|
|
34
|
+
[COLOR_THEMES.NEGATIVE]: {
|
|
35
|
+
colorTheme: 'light',
|
|
36
|
+
shade: '01'
|
|
37
|
+
},
|
|
38
|
+
[COLOR_THEMES.PRIMARY]: {
|
|
39
|
+
colorTheme: 'accent',
|
|
40
|
+
shade: '04'
|
|
41
|
+
},
|
|
42
|
+
[COLOR_THEMES.SUCCESS]: {
|
|
43
|
+
colorTheme: 'success',
|
|
44
|
+
shade: '04'
|
|
45
|
+
},
|
|
46
|
+
[COLOR_THEMES.WARNING]: {
|
|
47
|
+
colorTheme: 'warning',
|
|
48
|
+
shade: '04'
|
|
49
|
+
},
|
|
50
|
+
[COLOR_THEMES.WHITE]: {
|
|
51
|
+
colorTheme: 'accent',
|
|
52
|
+
shade: '04'
|
|
53
|
+
}
|
|
54
|
+
}[colorTheme]) !== null && _COLOR_THEMES$ERROR$C !== void 0 ? _COLOR_THEMES$ERROR$C : {
|
|
55
|
+
colorTheme: 'accent',
|
|
56
|
+
shade: '04'
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the default icon size in pixels based on the banner size.
|
|
62
|
+
* @param {string} size - One of SIZES values.
|
|
63
|
+
* @returns {number}
|
|
64
|
+
*/
|
|
65
|
+
export const getDefaultIconSize = size => size === SIZES.LARGE ? 24 : 20;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the default colorTheme for buttons and the close button based on the
|
|
69
|
+
* banner variant. Dark variant uses 'negative'; light variant uses standard colors.
|
|
70
|
+
* @param {string} variant - Banner variant ('light' | 'dark').
|
|
71
|
+
* @returns {{ button: string, onClose: string, secondaryButton: string }}
|
|
72
|
+
*/
|
|
73
|
+
export const getDefaultButtonColorTheme = variant => {
|
|
74
|
+
const isDark = variant === VARIANTS.DARK;
|
|
75
|
+
return {
|
|
76
|
+
button: isDark ? 'negative' : 'secondary',
|
|
77
|
+
onClose: isDark ? 'negative' : 'gray',
|
|
78
|
+
secondaryButton: isDark ? 'negative' : 'secondary'
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the UTLabel variant and weight for the main text (children) based on
|
|
84
|
+
* the banner size.
|
|
85
|
+
* @param {string} size - One of SIZES values.
|
|
86
|
+
* @returns {{ variant: string, weight: string }}
|
|
87
|
+
*/
|
|
88
|
+
export const getLabelStyles = size => {
|
|
89
|
+
var _SIZES$LARGE$SIZES$ME;
|
|
90
|
+
return (_SIZES$LARGE$SIZES$ME = {
|
|
91
|
+
[SIZES.LARGE]: {
|
|
92
|
+
titleVariant: 'title3',
|
|
93
|
+
descriptionVariant: 'body'
|
|
94
|
+
},
|
|
95
|
+
[SIZES.MEDIUM]: {
|
|
96
|
+
titleVariant: 'subtitle1',
|
|
97
|
+
descriptionVariant: 'small'
|
|
98
|
+
},
|
|
99
|
+
[SIZES.SMALL]: {
|
|
100
|
+
titleVariant: 'small',
|
|
101
|
+
descriptionVariant: 'small'
|
|
102
|
+
}
|
|
103
|
+
}[size]) !== null && _SIZES$LARGE$SIZES$ME !== void 0 ? _SIZES$LARGE$SIZES$ME : {
|
|
104
|
+
titleVariant: 'small',
|
|
105
|
+
descriptionVariant: 'small'
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the UTLabel colorTheme for the banner's main text content based on the
|
|
111
|
+
* banner's colorTheme and variant. Negative+light and any dark variant use light
|
|
112
|
+
* (white) text; all other combinations use dark text.
|
|
113
|
+
* @param {string} colorTheme - Banner color theme.
|
|
114
|
+
* @param {string} variant - Banner variant ('light' | 'dark').
|
|
115
|
+
* @returns {string} UTLabel colorTheme value.
|
|
116
|
+
*/
|
|
117
|
+
export const getLabelColorTheme = (colorTheme, variant) => {
|
|
118
|
+
if (colorTheme === COLOR_THEMES.NEGATIVE) {
|
|
119
|
+
return variant === VARIANTS.LIGHT ? 'light' : 'dark';
|
|
120
|
+
}
|
|
121
|
+
return variant === VARIANTS.LIGHT ? 'dark' : 'light';
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Returns the UTLabel colorTheme for the banner's secondary text content based on the
|
|
126
|
+
* banner's colorTheme and variant. Negative+light and any dark variant use light
|
|
127
|
+
* (white) text; all other combinations use gray text.
|
|
128
|
+
* @param {string} colorTheme - Banner color theme.
|
|
129
|
+
* @param {string} variant - Banner variant ('light' | 'gray').
|
|
130
|
+
* @returns {string} UTLabel colorTheme value.
|
|
131
|
+
*/
|
|
132
|
+
export const getSecondaryLabelColorTheme = (colorTheme, variant) => {
|
|
133
|
+
if (colorTheme === COLOR_THEMES.NEGATIVE) {
|
|
134
|
+
return variant === VARIANTS.LIGHT ? 'light' : 'gray';
|
|
135
|
+
}
|
|
136
|
+
return variant === VARIANTS.LIGHT ? 'gray' : 'light';
|
|
137
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import * as d3 from 'd3';
|
|
3
3
|
import { array, object, objectOf, string } from 'prop-types';
|
|
4
4
|
import { mergeMultipleClassNames } from '../../utils/classesUtils';
|
|
@@ -168,7 +168,7 @@ const UTGraph = _ref => {
|
|
|
168
168
|
crossAxisLeft,
|
|
169
169
|
crossAxisRight
|
|
170
170
|
} = _ref2;
|
|
171
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Bars, {
|
|
171
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Bars, {
|
|
172
172
|
crossAxisLeft: crossAxisLeft,
|
|
173
173
|
crossAxisRight: crossAxisRight,
|
|
174
174
|
dataset: dataset,
|
|
@@ -146,8 +146,9 @@ const UTHeader = _ref => {
|
|
|
146
146
|
height: BANNER_ICON_SIZE,
|
|
147
147
|
width: BANNER_ICON_SIZE
|
|
148
148
|
},
|
|
149
|
-
Icon: banner.Icon
|
|
150
|
-
|
|
149
|
+
Icon: banner.Icon,
|
|
150
|
+
title: banner.text
|
|
151
|
+
})));
|
|
151
152
|
};
|
|
152
153
|
UTHeader.propTypes = {
|
|
153
154
|
actions: arrayOf(object),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const flagComponentMap = {
|
|
2
|
+
AG: () => import('./AG'),
|
|
3
|
+
AI: () => import('./AI'),
|
|
4
|
+
AR: () => import('./AR'),
|
|
5
|
+
AW: () => import('./AW'),
|
|
6
|
+
BB: () => import('./BB'),
|
|
7
|
+
BL: () => import('./BL'),
|
|
8
|
+
BM: () => import('./BM'),
|
|
9
|
+
BO: () => import('./BO'),
|
|
10
|
+
BR: () => import('./BR'),
|
|
11
|
+
BS: () => import('./BS'),
|
|
12
|
+
BZ: () => import('./BZ'),
|
|
13
|
+
CA: () => import('./CA'),
|
|
14
|
+
CL: () => import('./CL'),
|
|
15
|
+
CO: () => import('./CO'),
|
|
16
|
+
CR: () => import('./CR'),
|
|
17
|
+
CU: () => import('./CU'),
|
|
18
|
+
CW: () => import('./CW'),
|
|
19
|
+
DM: () => import('./DM'),
|
|
20
|
+
DO: () => import('./DO'),
|
|
21
|
+
EC: () => import('./EC'),
|
|
22
|
+
ES: () => import('./ES'),
|
|
23
|
+
GD: () => import('./GD'),
|
|
24
|
+
GF: () => import('./GF'),
|
|
25
|
+
GL: () => import('./GL'),
|
|
26
|
+
GP: () => import('./GP'),
|
|
27
|
+
GT: () => import('./GT'),
|
|
28
|
+
GY: () => import('./GY'),
|
|
29
|
+
HN: () => import('./HN'),
|
|
30
|
+
HT: () => import('./HT'),
|
|
31
|
+
JM: () => import('./JM'),
|
|
32
|
+
LC: () => import('./LC'),
|
|
33
|
+
MF: () => import('./MF'),
|
|
34
|
+
MQ: () => import('./MQ'),
|
|
35
|
+
MS: () => import('./MS'),
|
|
36
|
+
MX: () => import('./MX'),
|
|
37
|
+
NI: () => import('./NI'),
|
|
38
|
+
PA: () => import('./PA'),
|
|
39
|
+
PE: () => import('./PE'),
|
|
40
|
+
PM: () => import('./PM'),
|
|
41
|
+
PR: () => import('./PR'),
|
|
42
|
+
PY: () => import('./PY'),
|
|
43
|
+
SR: () => import('./SR'),
|
|
44
|
+
SV: () => import('./SV'),
|
|
45
|
+
TC: () => import('./TC'),
|
|
46
|
+
TT: () => import('./TT'),
|
|
47
|
+
US: () => import('./US'),
|
|
48
|
+
UY: () => import('./UY'),
|
|
49
|
+
VC: () => import('./VC'),
|
|
50
|
+
VE: () => import('./VE'),
|
|
51
|
+
VG: () => import('./VG'),
|
|
52
|
+
VI: () => import('./VI')
|
|
53
|
+
};
|
|
54
|
+
export default flagComponentMap;
|
|
@@ -4,6 +4,7 @@ import { capitalize, getDefaultColorShade } from '../../utils/componentUtils';
|
|
|
4
4
|
import countries from '../../constants/countries';
|
|
5
5
|
import { ENERGY_ICONS, ENERGY_ICON_PREFIX, FILLED_ICON_COLOR, FILLED_ICON_SUFIX, DEFAULT_INTERNAL_SHADE, DEFAULT_COLOR_THEME } from './constants';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
|
+
import flagComponentMap from './components/FlagsIcons/flagsComponents';
|
|
7
8
|
const FLAG_CODES = new Set(countries.map(_ref => {
|
|
8
9
|
let {
|
|
9
10
|
code
|
|
@@ -12,8 +13,9 @@ const FLAG_CODES = new Set(countries.map(_ref => {
|
|
|
12
13
|
}));
|
|
13
14
|
const flagComponentCache = {};
|
|
14
15
|
const getFlagComponent = code => {
|
|
15
|
-
if (!flagComponentCache
|
|
16
|
-
|
|
16
|
+
if (!(code in flagComponentCache)) {
|
|
17
|
+
const loader = flagComponentMap[code];
|
|
18
|
+
flagComponentCache[code] = loader ? /*#__PURE__*/React.lazy(loader) : null;
|
|
17
19
|
}
|
|
18
20
|
return flagComponentCache[code];
|
|
19
21
|
};
|
|
@@ -47,6 +47,7 @@ export const ID_CONSTANTS = {
|
|
|
47
47
|
PINNED: 'pinned',
|
|
48
48
|
POPPER: 'popper',
|
|
49
49
|
SEARCH_BUTTON: 'searchButton',
|
|
50
|
+
SECONDARY_ACTION: 'secondaryAction',
|
|
50
51
|
SEARCH_BUTTON_TOOLTIP: 'searchButtonTooltip',
|
|
51
52
|
SEARCH_FIELD: 'searchField',
|
|
52
53
|
SELECTION_COMPONENT: 'selectionComponent',
|
|
@@ -54,6 +55,7 @@ export const ID_CONSTANTS = {
|
|
|
54
55
|
SIDEBAR_BUTTON: 'sidebarButton',
|
|
55
56
|
STATUS_MESSAGE: 'statusMessage',
|
|
56
57
|
TABLE: 'table',
|
|
58
|
+
TERTIARY_ACTION: 'tertiaryAction',
|
|
57
59
|
TABLE_ROW: 'tableRow',
|
|
58
60
|
TITLE: 'title',
|
|
59
61
|
USER_FILTER: 'userFilter',
|
package/dist/esm/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import AttachmentContainer from './deprecated/UTAttachment';
|
|
|
9
9
|
import UTAutocomplete from './deprecated/UTAutocomplete';
|
|
10
10
|
import UTAvatar from './components/UTAvatar';
|
|
11
11
|
import UTBadge from './components/UTBadge';
|
|
12
|
+
import UTBanner from './components/UTBanner';
|
|
12
13
|
import UTBarChart from './deprecated/UTBarChart';
|
|
13
14
|
import UTBreadcrumbs from './components/UTBreadcrumbs';
|
|
14
15
|
import UTButton from './components/UTButton';
|
|
@@ -106,4 +107,4 @@ export { UTList };
|
|
|
106
107
|
export { UTPieChart };
|
|
107
108
|
/** @deprecated */
|
|
108
109
|
export { UTToggle };
|
|
109
|
-
export { AlertHandler, componentUtils, ThemeProvider as EnergyThemeProvider, keyboardUtils, stylesDeduplicationUtils, useCSSVariables, UTCalendar, UTActionCard, UTAlert, UTAttachmentList, UTAvatar, UTBadge, UTBreadcrumbs, UTButton, UTButtonGroup, UTCaptcha, UTCarousel, UTCBUInput, UTCheckbox, UTCheckList, UTChip, UTConsumptionBar, UTCreditCard, UTCuit, UTDataCategory, UTDataElement, UTDatePicker, UTDocumentWizard, UTDotMenu, UTEmojiPicker, UTExternalLink, UTFileInputContainer as UTFileInput, UTShortcutPanel, UTGoogleAutocomplete, UTGraph, UTIcon, UTImageRadio, UTKpi, UTLabel, UTLoading, UTMap, UTMenu, UTModal, UTOnboarding, UTPagination, UTPanel, UTPasswordField, UTPhoneInput, UTPopper, UTPopUp, UTProductItem, UTProgressBar, UTRadioGroup, UTRatingContainer as UTRating, UTSearchField, UTSelect, UTSelectableCard, UTSidebar, UTSignature, Skeleton as UTSkeleton, UTStatus, UTStatusMessage, UTSwitch, UTTable, UTTabs, UTTextArea, UTTextInput, UTThirdPartyCookieChecker, UTTooltip, UTTopbar, UTTouchableWithoutFeedback, UTTracker, UTValidation, UTVirtualizedList, UTVirtualKeyboard, UTWorkflowContainer, UTWrapperObservation, WithLoading, WithTouch, useScrollBasedMenu };
|
|
110
|
+
export { AlertHandler, componentUtils, ThemeProvider as EnergyThemeProvider, keyboardUtils, stylesDeduplicationUtils, useCSSVariables, UTCalendar, UTActionCard, UTAlert, UTAttachmentList, UTAvatar, UTBadge, UTBanner, UTBreadcrumbs, UTButton, UTButtonGroup, UTCaptcha, UTCarousel, UTCBUInput, UTCheckbox, UTCheckList, UTChip, UTConsumptionBar, UTCreditCard, UTCuit, UTDataCategory, UTDataElement, UTDatePicker, UTDocumentWizard, UTDotMenu, UTEmojiPicker, UTExternalLink, UTFileInputContainer as UTFileInput, UTShortcutPanel, UTGoogleAutocomplete, UTGraph, UTIcon, UTImageRadio, UTKpi, UTLabel, UTLoading, UTMap, UTMenu, UTModal, UTOnboarding, UTPagination, UTPanel, UTPasswordField, UTPhoneInput, UTPopper, UTPopUp, UTProductItem, UTProgressBar, UTRadioGroup, UTRatingContainer as UTRating, UTSearchField, UTSelect, UTSelectableCard, UTSidebar, UTSignature, Skeleton as UTSkeleton, UTStatus, UTStatusMessage, UTSwitch, UTTable, UTTabs, UTTextArea, UTTextInput, UTThirdPartyCookieChecker, UTTooltip, UTTopbar, UTTouchableWithoutFeedback, UTTracker, UTValidation, UTVirtualizedList, UTVirtualKeyboard, UTWorkflowContainer, UTWrapperObservation, WithLoading, WithTouch, useScrollBasedMenu };
|
|
@@ -163,6 +163,19 @@ export const baseTokens = {
|
|
|
163
163
|
'radius-xl': 'radius-500'
|
|
164
164
|
},
|
|
165
165
|
component: {
|
|
166
|
+
'UT-banner-buttons-gap': 'gap-sm',
|
|
167
|
+
'UT-banner-gap-lg': 'gap-xl',
|
|
168
|
+
'UT-banner-gap-md': 'gap-lg',
|
|
169
|
+
'UT-banner-gap-sm': 'gap-sm',
|
|
170
|
+
'UT-banner-icon-gap': 'gap-md',
|
|
171
|
+
'UT-banner-icon-size-lg': 'size-icon-md',
|
|
172
|
+
'UT-banner-icon-size-sm': 'size-icon-xs',
|
|
173
|
+
'UT-banner-padding-lg': 'padding-lg',
|
|
174
|
+
'UT-banner-padding-md': 'padding-md',
|
|
175
|
+
'UT-banner-padding-x-sm': 'padding-sm',
|
|
176
|
+
'UT-banner-padding-y-sm': 'padding-xs',
|
|
177
|
+
'UT-banner-radius': 'radius-md',
|
|
178
|
+
'UT-banner-text-gap': 'gap-sm',
|
|
166
179
|
'UT-button-height-sm': 'size-control-sm',
|
|
167
180
|
'UT-button-height-md': 'size-control-md',
|
|
168
181
|
'UT-button-height-lg': 'size-control-lg',
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "UTBadge", {
|
|
|
57
57
|
return _UTBadge.default;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "UTBanner", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _UTBanner.default;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "UTBarChart", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function () {
|
|
@@ -548,6 +554,7 @@ var _UTAttachment = _interopRequireDefault(require("./deprecated/UTAttachment"))
|
|
|
548
554
|
var _UTAutocomplete = _interopRequireDefault(require("./deprecated/UTAutocomplete"));
|
|
549
555
|
var _UTAvatar = _interopRequireDefault(require("./components/UTAvatar"));
|
|
550
556
|
var _UTBadge = _interopRequireDefault(require("./components/UTBadge"));
|
|
557
|
+
var _UTBanner = _interopRequireDefault(require("./components/UTBanner"));
|
|
551
558
|
var _UTBarChart = _interopRequireDefault(require("./deprecated/UTBarChart"));
|
|
552
559
|
var _UTBreadcrumbs = _interopRequireDefault(require("./components/UTBreadcrumbs"));
|
|
553
560
|
var _UTButton = _interopRequireDefault(require("./components/UTButton"));
|
|
@@ -169,6 +169,19 @@ const baseTokens = exports.baseTokens = {
|
|
|
169
169
|
'radius-xl': 'radius-500'
|
|
170
170
|
},
|
|
171
171
|
component: {
|
|
172
|
+
'UT-banner-buttons-gap': 'gap-sm',
|
|
173
|
+
'UT-banner-gap-lg': 'gap-xl',
|
|
174
|
+
'UT-banner-gap-md': 'gap-lg',
|
|
175
|
+
'UT-banner-gap-sm': 'gap-sm',
|
|
176
|
+
'UT-banner-icon-gap': 'gap-md',
|
|
177
|
+
'UT-banner-icon-size-lg': 'size-icon-md',
|
|
178
|
+
'UT-banner-icon-size-sm': 'size-icon-xs',
|
|
179
|
+
'UT-banner-padding-lg': 'padding-lg',
|
|
180
|
+
'UT-banner-padding-md': 'padding-md',
|
|
181
|
+
'UT-banner-padding-x-sm': 'padding-sm',
|
|
182
|
+
'UT-banner-padding-y-sm': 'padding-xs',
|
|
183
|
+
'UT-banner-radius': 'radius-md',
|
|
184
|
+
'UT-banner-text-gap': 'gap-sm',
|
|
172
185
|
'UT-button-height-sm': 'size-control-sm',
|
|
173
186
|
'UT-button-height-md': 'size-control-md',
|
|
174
187
|
'UT-button-height-lg': 'size-control-lg',
|