@widergy/energy-ui 3.160.1 → 3.162.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 +16 -3
- 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/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/index.js +8 -3
- package/dist/components/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/layout.js +33 -3
- package/dist/components/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentHeader/index.js +4 -0
- package/dist/components/UTShortcutPanel/index.js +33 -4
- package/dist/components/UTShortcutPanel/stories/UTShortcutPanel.stories.js +39 -0
- package/dist/components/UTShortcutPanel/stories/constants.json +2 -0
- package/dist/components/UTShortcutPanel/stories/props.schema.json +10 -1
- package/dist/components/UTShortcutPanel/styles.module.scss +11 -3
- package/dist/constants/testIds.js +3 -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/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/index.js +7 -2
- package/dist/esm/components/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentCategory/components/ExpandedPanelContentCategoryItem/layout.js +34 -4
- package/dist/esm/components/UTShortcutPanel/components/GroupingPanel/components/ExpandedPanelContent/components/ExpandedPanelContentHeader/index.js +5 -1
- package/dist/esm/components/UTShortcutPanel/index.js +33 -4
- package/dist/esm/components/UTShortcutPanel/stories/UTShortcutPanel.stories.js +39 -0
- package/dist/esm/components/UTShortcutPanel/stories/constants.json +2 -0
- package/dist/esm/components/UTShortcutPanel/stories/props.schema.json +10 -1
- package/dist/esm/components/UTShortcutPanel/styles.module.scss +11 -3
- package/dist/esm/constants/testIds.js +3 -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,30 @@
|
|
|
1
|
+
export const SIZES = {
|
|
2
|
+
SMALL: 'small',
|
|
3
|
+
MEDIUM: 'medium',
|
|
4
|
+
LARGE: 'large'
|
|
5
|
+
};
|
|
6
|
+
export const COLOR_THEMES = {
|
|
7
|
+
ERROR: 'error',
|
|
8
|
+
GRAY: 'gray',
|
|
9
|
+
INFORMATION: 'information',
|
|
10
|
+
NEGATIVE: 'negative',
|
|
11
|
+
PRIMARY: 'primary',
|
|
12
|
+
SUCCESS: 'success',
|
|
13
|
+
WARNING: 'warning',
|
|
14
|
+
WHITE: 'white'
|
|
15
|
+
};
|
|
16
|
+
export const VARIANTS = {
|
|
17
|
+
DARK: 'dark',
|
|
18
|
+
LIGHT: 'light'
|
|
19
|
+
};
|
|
20
|
+
export const PLACEMENTS = {
|
|
21
|
+
HORIZONTAL: 'horizontal',
|
|
22
|
+
VERTICAL: 'vertical'
|
|
23
|
+
};
|
|
24
|
+
export const DEFAULT_PROPS = {
|
|
25
|
+
buttonPlacement: PLACEMENTS.HORIZONTAL,
|
|
26
|
+
colorTheme: COLOR_THEMES.GRAY,
|
|
27
|
+
iconPlacement: PLACEMENTS.HORIZONTAL,
|
|
28
|
+
size: SIZES.MEDIUM,
|
|
29
|
+
variant: VARIANTS.LIGHT
|
|
30
|
+
};
|
|
@@ -1,29 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { elementType, func, object, objectOf, oneOf, oneOfType, string } from 'prop-types';
|
|
4
|
+
import UTButton from '../UTButton';
|
|
5
|
+
import UTIcon from '../UTIcon';
|
|
3
6
|
import UTLabel from '../UTLabel';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
7
|
+
import { capitalize, isUTIcon } from '../../utils/componentUtils';
|
|
8
|
+
import { mergeMultipleClassNames } from '../../utils/classesUtils';
|
|
9
|
+
import { ID_CONSTANTS } from '../../constants/testIds';
|
|
6
10
|
import styles from './styles.module.scss';
|
|
7
|
-
import {
|
|
11
|
+
import { buttonType } from './types';
|
|
12
|
+
import { getDefaultButtonColorTheme, getDefaultIconSize, getDefaultIconTheme, getLabelColorTheme, getLabelStyles, getSecondaryLabelColorTheme } from './utils';
|
|
13
|
+
import { COLOR_THEMES, DEFAULT_PROPS, PLACEMENTS, SIZES, VARIANTS } from './constants';
|
|
8
14
|
const UTBanner = _ref => {
|
|
9
15
|
let {
|
|
10
|
-
|
|
16
|
+
button,
|
|
17
|
+
buttonPlacement = DEFAULT_PROPS.buttonPlacement,
|
|
18
|
+
category,
|
|
11
19
|
classNames,
|
|
12
|
-
|
|
20
|
+
colorTheme = DEFAULT_PROPS.colorTheme,
|
|
21
|
+
dataTestId,
|
|
22
|
+
description,
|
|
23
|
+
helpText,
|
|
24
|
+
Icon,
|
|
25
|
+
iconPlacement = DEFAULT_PROPS.iconPlacement,
|
|
13
26
|
iconProps,
|
|
14
|
-
|
|
27
|
+
onClose,
|
|
28
|
+
secondaryButton,
|
|
29
|
+
size = DEFAULT_PROPS.size,
|
|
30
|
+
title,
|
|
31
|
+
variant = DEFAULT_PROPS.variant
|
|
15
32
|
} = _ref;
|
|
16
|
-
const
|
|
33
|
+
const isVerticalButton = buttonPlacement === PLACEMENTS.VERTICAL;
|
|
34
|
+
const isVerticalIcon = iconPlacement === PLACEMENTS.VERTICAL;
|
|
35
|
+
const labelColorTheme = getLabelColorTheme(colorTheme, variant);
|
|
36
|
+
const secondaryLabelColorTheme = getSecondaryLabelColorTheme(colorTheme, variant);
|
|
37
|
+
const {
|
|
38
|
+
titleVariant,
|
|
39
|
+
descriptionVariant
|
|
40
|
+
} = getLabelStyles(size);
|
|
41
|
+
const iconTheme = getDefaultIconTheme(colorTheme, variant);
|
|
42
|
+
const iconSize = getDefaultIconSize(size);
|
|
43
|
+
const buttonColorTheme = getDefaultButtonColorTheme(variant);
|
|
44
|
+
const gapClass = styles["gap".concat(capitalize(size))];
|
|
45
|
+
const paddingClass = styles["padding".concat(capitalize(size))];
|
|
46
|
+
const colorClass = styles["".concat(colorTheme).concat(capitalize(variant))];
|
|
47
|
+
const dynamicClasses = {
|
|
48
|
+
bannerContainer: [colorClass, paddingClass, gapClass].filter(Boolean).join(' '),
|
|
49
|
+
contentContainer: [isVerticalButton ? styles.contentVertical : styles.contentHorizontal, gapClass].filter(Boolean).join(' '),
|
|
50
|
+
iconTextContainer: [isVerticalIcon ? styles.iconVertical : styles.iconHorizontal, !isVerticalButton ? styles.iconFlex : ''].filter(Boolean).join(' '),
|
|
51
|
+
textContainer: !isVerticalIcon ? styles.textFlex : '',
|
|
52
|
+
buttonsContainer: isVerticalButton ? styles.buttonsVertical : ''
|
|
53
|
+
};
|
|
54
|
+
const normalizedClassNames = classNames ? {
|
|
55
|
+
...classNames,
|
|
56
|
+
bannerContainer: classNames.infoContainer
|
|
57
|
+
} : undefined;
|
|
58
|
+
const classes = mergeMultipleClassNames(styles, dynamicClasses, normalizedClassNames);
|
|
17
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className:
|
|
19
|
-
|
|
60
|
+
className: classes.bannerContainer,
|
|
61
|
+
"data-testid": dataTestId
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: classes.contentContainer
|
|
64
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: classes.iconTextContainer
|
|
66
|
+
}, !!Icon && isUTIcon(Icon) ? /*#__PURE__*/React.createElement(UTIcon, _extends({
|
|
67
|
+
colorTheme: iconTheme.colorTheme,
|
|
68
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.ICON) : undefined,
|
|
69
|
+
name: Icon,
|
|
70
|
+
shade: iconTheme.shade,
|
|
71
|
+
size: iconSize
|
|
72
|
+
}, iconProps)) : !!Icon && /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
|
|
73
|
+
"data-testId": dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.ICON) : undefined
|
|
74
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: classes.textContainer
|
|
76
|
+
}, !!category && /*#__PURE__*/React.createElement(UTLabel, {
|
|
77
|
+
className: styles.uppercase,
|
|
78
|
+
colorTheme: secondaryLabelColorTheme,
|
|
79
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".category.").concat(ID_CONSTANTS.LABEL) : undefined,
|
|
80
|
+
variant: "xsmall",
|
|
81
|
+
weight: "medium"
|
|
82
|
+
}, category), !!title && /*#__PURE__*/React.createElement(UTLabel, {
|
|
83
|
+
colorTheme: labelColorTheme,
|
|
84
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.TITLE, ".").concat(ID_CONSTANTS.LABEL) : undefined,
|
|
85
|
+
variant: titleVariant,
|
|
86
|
+
weight: "medium"
|
|
87
|
+
}, title), !!description && /*#__PURE__*/React.createElement(UTLabel, {
|
|
88
|
+
colorTheme: labelColorTheme,
|
|
89
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.DESCRIPTION, ".").concat(ID_CONSTANTS.LABEL) : undefined,
|
|
90
|
+
variant: descriptionVariant
|
|
91
|
+
}, description), !!helpText && /*#__PURE__*/React.createElement(UTLabel, {
|
|
92
|
+
colorTheme: secondaryLabelColorTheme,
|
|
93
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(ID_CONSTANTS.HELP_TEXT, ".").concat(ID_CONSTANTS.LABEL) : undefined,
|
|
20
94
|
variant: "small"
|
|
21
|
-
},
|
|
95
|
+
}, helpText))), !!(button || secondaryButton) && /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: classes.buttonsContainer
|
|
97
|
+
}, !!button && /*#__PURE__*/React.createElement(UTButton, _extends({
|
|
98
|
+
colorTheme: buttonColorTheme.button
|
|
99
|
+
}, button, {
|
|
100
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".button.").concat(ID_CONSTANTS.SECONDARY_ACTION) : undefined
|
|
101
|
+
}), button.title), !!secondaryButton && /*#__PURE__*/React.createElement(UTButton, _extends({
|
|
102
|
+
colorTheme: buttonColorTheme.secondaryButton,
|
|
103
|
+
variant: "text"
|
|
104
|
+
}, secondaryButton, {
|
|
105
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".secondaryButton.").concat(ID_CONSTANTS.TERTIARY_ACTION) : undefined
|
|
106
|
+
}), secondaryButton.title))), !!onClose && /*#__PURE__*/React.createElement(UTButton, {
|
|
107
|
+
colorTheme: buttonColorTheme.onClose,
|
|
108
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".close") : undefined,
|
|
109
|
+
Icon: "IconX",
|
|
110
|
+
onClick: onClose,
|
|
111
|
+
size: "small",
|
|
112
|
+
variant: "text"
|
|
113
|
+
}));
|
|
22
114
|
};
|
|
23
115
|
UTBanner.propTypes = {
|
|
24
|
-
|
|
116
|
+
button: buttonType,
|
|
117
|
+
buttonPlacement: oneOf(Object.values(PLACEMENTS)),
|
|
118
|
+
category: string,
|
|
25
119
|
classNames: objectOf(string),
|
|
26
|
-
|
|
27
|
-
|
|
120
|
+
colorTheme: oneOf(Object.values(COLOR_THEMES)),
|
|
121
|
+
dataTestId: string,
|
|
122
|
+
description: string,
|
|
123
|
+
helpText: string,
|
|
124
|
+
Icon: oneOfType([elementType, string]),
|
|
125
|
+
iconPlacement: oneOf(Object.values(PLACEMENTS)),
|
|
126
|
+
iconProps: object,
|
|
127
|
+
onClose: func,
|
|
128
|
+
secondaryButton: buttonType,
|
|
129
|
+
size: oneOf(Object.values(SIZES)),
|
|
130
|
+
title: string,
|
|
131
|
+
variant: oneOf(Object.values(VARIANTS))
|
|
28
132
|
};
|
|
29
|
-
export default
|
|
133
|
+
export default UTBanner;
|
|
@@ -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),
|