@widergy/energy-ui 3.161.0 → 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 +7 -0
- 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/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/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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.162.0](https://github.com/widergy/energy-ui/compare/v3.161.0...v3.162.0) (2026-06-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [DIS-1105] upgrade utbanner ([#806](https://github.com/widergy/energy-ui/issues/806)) ([64c509b](https://github.com/widergy/energy-ui/commit/64c509b93faf3bddc0ce1909727f4eac28b27b59))
|
|
7
|
+
|
|
1
8
|
# [3.161.0](https://github.com/widergy/energy-ui/compare/v3.160.1...v3.161.0) (2026-06-05)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -2,14 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
### Description
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Displays a banner with contextual information. Supports multiple color themes, sizes, icon/button placement, and optional close action.
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
|
|
9
|
-
| Name
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| ----------------- | --------------------------------------------------------------------------------- | -------------- | --------------------------------------------------------------------------- |
|
|
11
|
+
| button | object (UTButton props) | | Primary action button. All UTButton props are accepted. |
|
|
12
|
+
| buttonPlacement | `'horizontal'` \| `'vertical'` | `'horizontal'` | Alignment between the text group and the buttons group. |
|
|
13
|
+
| category | string | | Optional category label shown above the main text (xsmall, uppercase, gray). |
|
|
14
|
+
| children | node | | Main text content rendered inside the banner. |
|
|
15
|
+
| classes | object of string | | Classes returned by UTBanner's own [theme](./theme.js) `retrieveStyle`. |
|
|
16
|
+
| classNames | object of string | | Additional classes merged with the themed classes. |
|
|
17
|
+
| colorTheme | `'error'` \| `'gray'` \| `'information'` \| `'negative'` \| `'primary'` \| `'success'` \| `'warning'` \| `'white'` | `'gray'` | Color theme that determines the banner background. |
|
|
18
|
+
| helpText | string | | Optional secondary text shown below the main content (small, gray). |
|
|
19
|
+
| Icon | element type | | Icon component rendered at the start of the banner. |
|
|
20
|
+
| iconPlacement | `'horizontal'` \| `'vertical'` | `'horizontal'` | Alignment between the icon and the text group. |
|
|
21
|
+
| iconProps | object | | Props passed to the `Icon` component. |
|
|
22
|
+
| onClose | func | | If provided, renders a close button (gray, small, IconX) at the end. |
|
|
23
|
+
| secondaryButton | object (UTButton props) | | Secondary action button. Renders as `variant="text"` by default. |
|
|
24
|
+
| size | `'small'` \| `'medium'` \| `'large'` | `'medium'` | Controls padding, gap, and icon size. |
|
|
25
|
+
| variant | `'light'` \| `'dark'` | `'light'` | Light or dark tint of the color theme. |
|
|
26
|
+
|
|
27
|
+
## Usage examples
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
// Basic
|
|
31
|
+
<UTBanner>Your account has been updated.</UTBanner>
|
|
32
|
+
|
|
33
|
+
// With color theme and close
|
|
34
|
+
<UTBanner colorTheme="success" onClose={() => dismiss()}>
|
|
35
|
+
Your changes were saved successfully.
|
|
36
|
+
</UTBanner>
|
|
37
|
+
|
|
38
|
+
// With category, helpText and actions
|
|
39
|
+
<UTBanner
|
|
40
|
+
category="Alert"
|
|
41
|
+
colorTheme="warning"
|
|
42
|
+
helpText="Contact support if the issue persists."
|
|
43
|
+
button={{ children: 'Retry', onClick: handleRetry }}
|
|
44
|
+
secondaryButton={{ children: 'Dismiss', onClick: handleDismiss }}
|
|
45
|
+
>
|
|
46
|
+
Something went wrong while loading your data.
|
|
47
|
+
</UTBanner>
|
|
48
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VARIANTS = exports.SIZES = exports.PLACEMENTS = exports.DEFAULT_PROPS = exports.COLOR_THEMES = void 0;
|
|
7
|
+
const SIZES = exports.SIZES = {
|
|
8
|
+
SMALL: 'small',
|
|
9
|
+
MEDIUM: 'medium',
|
|
10
|
+
LARGE: 'large'
|
|
11
|
+
};
|
|
12
|
+
const COLOR_THEMES = exports.COLOR_THEMES = {
|
|
13
|
+
ERROR: 'error',
|
|
14
|
+
GRAY: 'gray',
|
|
15
|
+
INFORMATION: 'information',
|
|
16
|
+
NEGATIVE: 'negative',
|
|
17
|
+
PRIMARY: 'primary',
|
|
18
|
+
SUCCESS: 'success',
|
|
19
|
+
WARNING: 'warning',
|
|
20
|
+
WHITE: 'white'
|
|
21
|
+
};
|
|
22
|
+
const VARIANTS = exports.VARIANTS = {
|
|
23
|
+
DARK: 'dark',
|
|
24
|
+
LIGHT: 'light'
|
|
25
|
+
};
|
|
26
|
+
const PLACEMENTS = exports.PLACEMENTS = {
|
|
27
|
+
HORIZONTAL: 'horizontal',
|
|
28
|
+
VERTICAL: 'vertical'
|
|
29
|
+
};
|
|
30
|
+
const DEFAULT_PROPS = exports.DEFAULT_PROPS = {
|
|
31
|
+
buttonPlacement: PLACEMENTS.HORIZONTAL,
|
|
32
|
+
colorTheme: COLOR_THEMES.GRAY,
|
|
33
|
+
iconPlacement: PLACEMENTS.HORIZONTAL,
|
|
34
|
+
size: SIZES.MEDIUM,
|
|
35
|
+
variant: VARIANTS.LIGHT
|
|
36
|
+
};
|
|
@@ -4,34 +4,137 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
10
|
+
var _UTIcon = _interopRequireDefault(require("../UTIcon"));
|
|
9
11
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
12
|
+
var _componentUtils = require("../../utils/componentUtils");
|
|
10
13
|
var _classesUtils = require("../../utils/classesUtils");
|
|
11
|
-
var
|
|
14
|
+
var _testIds = require("../../constants/testIds");
|
|
12
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
|
-
var
|
|
16
|
+
var _types = require("./types");
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
var _constants = require("./constants");
|
|
14
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function
|
|
20
|
+
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); }
|
|
16
21
|
const UTBanner = _ref => {
|
|
17
22
|
let {
|
|
18
|
-
|
|
23
|
+
button,
|
|
24
|
+
buttonPlacement = _constants.DEFAULT_PROPS.buttonPlacement,
|
|
25
|
+
category,
|
|
19
26
|
classNames,
|
|
20
|
-
|
|
27
|
+
colorTheme = _constants.DEFAULT_PROPS.colorTheme,
|
|
28
|
+
dataTestId,
|
|
29
|
+
description,
|
|
30
|
+
helpText,
|
|
31
|
+
Icon,
|
|
32
|
+
iconPlacement = _constants.DEFAULT_PROPS.iconPlacement,
|
|
21
33
|
iconProps,
|
|
22
|
-
|
|
34
|
+
onClose,
|
|
35
|
+
secondaryButton,
|
|
36
|
+
size = _constants.DEFAULT_PROPS.size,
|
|
37
|
+
title,
|
|
38
|
+
variant = _constants.DEFAULT_PROPS.variant
|
|
23
39
|
} = _ref;
|
|
24
|
-
const
|
|
40
|
+
const isVerticalButton = buttonPlacement === _constants.PLACEMENTS.VERTICAL;
|
|
41
|
+
const isVerticalIcon = iconPlacement === _constants.PLACEMENTS.VERTICAL;
|
|
42
|
+
const labelColorTheme = (0, _utils.getLabelColorTheme)(colorTheme, variant);
|
|
43
|
+
const secondaryLabelColorTheme = (0, _utils.getSecondaryLabelColorTheme)(colorTheme, variant);
|
|
44
|
+
const {
|
|
45
|
+
titleVariant,
|
|
46
|
+
descriptionVariant
|
|
47
|
+
} = (0, _utils.getLabelStyles)(size);
|
|
48
|
+
const iconTheme = (0, _utils.getDefaultIconTheme)(colorTheme, variant);
|
|
49
|
+
const iconSize = (0, _utils.getDefaultIconSize)(size);
|
|
50
|
+
const buttonColorTheme = (0, _utils.getDefaultButtonColorTheme)(variant);
|
|
51
|
+
const gapClass = _stylesModule.default["gap".concat((0, _componentUtils.capitalize)(size))];
|
|
52
|
+
const paddingClass = _stylesModule.default["padding".concat((0, _componentUtils.capitalize)(size))];
|
|
53
|
+
const colorClass = _stylesModule.default["".concat(colorTheme).concat((0, _componentUtils.capitalize)(variant))];
|
|
54
|
+
const dynamicClasses = {
|
|
55
|
+
bannerContainer: [colorClass, paddingClass, gapClass].filter(Boolean).join(' '),
|
|
56
|
+
contentContainer: [isVerticalButton ? _stylesModule.default.contentVertical : _stylesModule.default.contentHorizontal, gapClass].filter(Boolean).join(' '),
|
|
57
|
+
iconTextContainer: [isVerticalIcon ? _stylesModule.default.iconVertical : _stylesModule.default.iconHorizontal, !isVerticalButton ? _stylesModule.default.iconFlex : ''].filter(Boolean).join(' '),
|
|
58
|
+
textContainer: !isVerticalIcon ? _stylesModule.default.textFlex : '',
|
|
59
|
+
buttonsContainer: isVerticalButton ? _stylesModule.default.buttonsVertical : ''
|
|
60
|
+
};
|
|
61
|
+
const normalizedClassNames = classNames ? {
|
|
62
|
+
...classNames,
|
|
63
|
+
bannerContainer: classNames.infoContainer
|
|
64
|
+
} : undefined;
|
|
65
|
+
const classes = (0, _classesUtils.mergeMultipleClassNames)(_stylesModule.default, dynamicClasses, normalizedClassNames);
|
|
25
66
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
-
className:
|
|
27
|
-
|
|
67
|
+
className: classes.bannerContainer,
|
|
68
|
+
"data-testid": dataTestId
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
className: classes.contentContainer
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: classes.iconTextContainer
|
|
73
|
+
}, !!Icon && (0, _componentUtils.isUTIcon)(Icon) ? /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
74
|
+
colorTheme: iconTheme.colorTheme,
|
|
75
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.ICON) : undefined,
|
|
76
|
+
name: Icon,
|
|
77
|
+
shade: iconTheme.shade,
|
|
78
|
+
size: iconSize
|
|
79
|
+
}, iconProps)) : !!Icon && /*#__PURE__*/_react.default.createElement(Icon, _extends({}, iconProps, {
|
|
80
|
+
"data-testId": dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.ICON) : undefined
|
|
81
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: classes.textContainer
|
|
83
|
+
}, !!category && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
84
|
+
className: _stylesModule.default.uppercase,
|
|
85
|
+
colorTheme: secondaryLabelColorTheme,
|
|
86
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".category.").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
87
|
+
variant: "xsmall",
|
|
88
|
+
weight: "medium"
|
|
89
|
+
}, category), !!title && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
90
|
+
colorTheme: labelColorTheme,
|
|
91
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.TITLE, ".").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
92
|
+
variant: titleVariant,
|
|
93
|
+
weight: "medium"
|
|
94
|
+
}, title), !!description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
95
|
+
colorTheme: labelColorTheme,
|
|
96
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.DESCRIPTION, ".").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
97
|
+
variant: descriptionVariant
|
|
98
|
+
}, description), !!helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
99
|
+
colorTheme: secondaryLabelColorTheme,
|
|
100
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(_testIds.ID_CONSTANTS.HELP_TEXT, ".").concat(_testIds.ID_CONSTANTS.LABEL) : undefined,
|
|
28
101
|
variant: "small"
|
|
29
|
-
},
|
|
102
|
+
}, helpText))), !!(button || secondaryButton) && /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: classes.buttonsContainer
|
|
104
|
+
}, !!button && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
105
|
+
colorTheme: buttonColorTheme.button
|
|
106
|
+
}, button, {
|
|
107
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".button.").concat(_testIds.ID_CONSTANTS.SECONDARY_ACTION) : undefined
|
|
108
|
+
}), button.title), !!secondaryButton && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
109
|
+
colorTheme: buttonColorTheme.secondaryButton,
|
|
110
|
+
variant: "text"
|
|
111
|
+
}, secondaryButton, {
|
|
112
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".secondaryButton.").concat(_testIds.ID_CONSTANTS.TERTIARY_ACTION) : undefined
|
|
113
|
+
}), secondaryButton.title))), !!onClose && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
114
|
+
colorTheme: buttonColorTheme.onClose,
|
|
115
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".close") : undefined,
|
|
116
|
+
Icon: "IconX",
|
|
117
|
+
onClick: onClose,
|
|
118
|
+
size: "small",
|
|
119
|
+
variant: "text"
|
|
120
|
+
}));
|
|
30
121
|
};
|
|
31
122
|
UTBanner.propTypes = {
|
|
32
|
-
|
|
123
|
+
button: _types.buttonType,
|
|
124
|
+
buttonPlacement: (0, _propTypes.oneOf)(Object.values(_constants.PLACEMENTS)),
|
|
125
|
+
category: _propTypes.string,
|
|
33
126
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
34
|
-
|
|
35
|
-
|
|
127
|
+
colorTheme: (0, _propTypes.oneOf)(Object.values(_constants.COLOR_THEMES)),
|
|
128
|
+
dataTestId: _propTypes.string,
|
|
129
|
+
description: _propTypes.string,
|
|
130
|
+
helpText: _propTypes.string,
|
|
131
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
132
|
+
iconPlacement: (0, _propTypes.oneOf)(Object.values(_constants.PLACEMENTS)),
|
|
133
|
+
iconProps: _propTypes.object,
|
|
134
|
+
onClose: _propTypes.func,
|
|
135
|
+
secondaryButton: _types.buttonType,
|
|
136
|
+
size: (0, _propTypes.oneOf)(Object.values(_constants.SIZES)),
|
|
137
|
+
title: _propTypes.string,
|
|
138
|
+
variant: (0, _propTypes.oneOf)(Object.values(_constants.VARIANTS))
|
|
36
139
|
};
|
|
37
|
-
var _default = exports.default =
|
|
140
|
+
var _default = exports.default = UTBanner;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithDescription = exports.WithClose = exports.WithCategoryAndHelpText = exports.WithActions = exports.VerticalLayout = exports.Playground = exports.DarkVariant = void 0;
|
|
7
|
+
var _ = _interopRequireDefault(require(".."));
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/* eslint-disable no-alert */
|
|
11
|
+
var _default = exports.default = {
|
|
12
|
+
args: {
|
|
13
|
+
buttonPlacement: _constants.PLACEMENTS.HORIZONTAL,
|
|
14
|
+
colorTheme: _constants.COLOR_THEMES.GRAY,
|
|
15
|
+
iconPlacement: _constants.PLACEMENTS.HORIZONTAL,
|
|
16
|
+
size: _constants.SIZES.MEDIUM,
|
|
17
|
+
title: 'Your account information has been updated successfully.',
|
|
18
|
+
variant: _constants.VARIANTS.LIGHT
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
button: {
|
|
22
|
+
control: 'object',
|
|
23
|
+
description: 'Primary action button. Accepts all UTButton props.',
|
|
24
|
+
table: {
|
|
25
|
+
type: {
|
|
26
|
+
summary: 'object'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
buttonPlacement: {
|
|
31
|
+
control: {
|
|
32
|
+
type: 'select'
|
|
33
|
+
},
|
|
34
|
+
options: Object.values(_constants.PLACEMENTS)
|
|
35
|
+
},
|
|
36
|
+
category: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'Optional category label shown above the title (xsmall, uppercase, gray).'
|
|
39
|
+
},
|
|
40
|
+
colorTheme: {
|
|
41
|
+
control: {
|
|
42
|
+
type: 'select'
|
|
43
|
+
},
|
|
44
|
+
options: Object.values(_constants.COLOR_THEMES)
|
|
45
|
+
},
|
|
46
|
+
description: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'Optional body text shown below the title (small).'
|
|
49
|
+
},
|
|
50
|
+
helpText: {
|
|
51
|
+
control: 'text',
|
|
52
|
+
description: 'Optional secondary text shown below the description (small, gray).'
|
|
53
|
+
},
|
|
54
|
+
iconPlacement: {
|
|
55
|
+
control: {
|
|
56
|
+
type: 'select'
|
|
57
|
+
},
|
|
58
|
+
options: Object.values(_constants.PLACEMENTS)
|
|
59
|
+
},
|
|
60
|
+
Icon: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
description: 'Nombre del ícono (string) o componente React. Ej: "IconAlertCircle".'
|
|
63
|
+
},
|
|
64
|
+
iconProps: {
|
|
65
|
+
control: false
|
|
66
|
+
},
|
|
67
|
+
onClose: {
|
|
68
|
+
control: false
|
|
69
|
+
},
|
|
70
|
+
secondaryButton: {
|
|
71
|
+
control: 'object',
|
|
72
|
+
description: 'Secondary action button. Renders as variant="text" by default.'
|
|
73
|
+
},
|
|
74
|
+
size: {
|
|
75
|
+
control: {
|
|
76
|
+
type: 'select'
|
|
77
|
+
},
|
|
78
|
+
options: Object.values(_constants.SIZES)
|
|
79
|
+
},
|
|
80
|
+
title: {
|
|
81
|
+
control: 'text',
|
|
82
|
+
description: 'Main text of the banner.'
|
|
83
|
+
},
|
|
84
|
+
variant: {
|
|
85
|
+
control: {
|
|
86
|
+
type: 'select'
|
|
87
|
+
},
|
|
88
|
+
options: Object.values(_constants.VARIANTS)
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
component: _.default,
|
|
92
|
+
title: 'Energy-UI/UTBanner'
|
|
93
|
+
};
|
|
94
|
+
const Playground = exports.Playground = {};
|
|
95
|
+
const WithClose = exports.WithClose = {
|
|
96
|
+
args: {
|
|
97
|
+
colorTheme: _constants.COLOR_THEMES.WARNING,
|
|
98
|
+
onClose: () => alert('closed'),
|
|
99
|
+
title: 'Session will expire in 5 minutes.'
|
|
100
|
+
},
|
|
101
|
+
name: 'With Close Button'
|
|
102
|
+
};
|
|
103
|
+
const WithActions = exports.WithActions = {
|
|
104
|
+
args: {
|
|
105
|
+
button: {
|
|
106
|
+
title: 'Retry',
|
|
107
|
+
onClick: () => alert('retry')
|
|
108
|
+
},
|
|
109
|
+
colorTheme: _constants.COLOR_THEMES.ERROR,
|
|
110
|
+
secondaryButton: {
|
|
111
|
+
title: 'Dismiss',
|
|
112
|
+
onClick: () => alert('dismiss')
|
|
113
|
+
},
|
|
114
|
+
title: 'Something went wrong while loading your data.'
|
|
115
|
+
},
|
|
116
|
+
name: 'With Actions'
|
|
117
|
+
};
|
|
118
|
+
const WithCategoryAndHelpText = exports.WithCategoryAndHelpText = {
|
|
119
|
+
args: {
|
|
120
|
+
category: 'Notice',
|
|
121
|
+
colorTheme: _constants.COLOR_THEMES.INFORMATION,
|
|
122
|
+
helpText: 'Contact billing if you have any questions.',
|
|
123
|
+
title: 'Your invoice is due in 3 days.'
|
|
124
|
+
},
|
|
125
|
+
name: 'With Category and Help Text'
|
|
126
|
+
};
|
|
127
|
+
const WithDescription = exports.WithDescription = {
|
|
128
|
+
args: {
|
|
129
|
+
colorTheme: _constants.COLOR_THEMES.INFORMATION,
|
|
130
|
+
description: 'This action cannot be undone. All associated data will be permanently removed.',
|
|
131
|
+
title: 'Are you sure you want to delete this account?'
|
|
132
|
+
},
|
|
133
|
+
name: 'With Description'
|
|
134
|
+
};
|
|
135
|
+
const VerticalLayout = exports.VerticalLayout = {
|
|
136
|
+
args: {
|
|
137
|
+
button: {
|
|
138
|
+
title: 'View Details',
|
|
139
|
+
onClick: () => alert('details')
|
|
140
|
+
},
|
|
141
|
+
buttonPlacement: _constants.PLACEMENTS.VERTICAL,
|
|
142
|
+
category: 'Update',
|
|
143
|
+
colorTheme: _constants.COLOR_THEMES.PRIMARY,
|
|
144
|
+
description: 'This update includes performance improvements and bug fixes.',
|
|
145
|
+
helpText: 'Restart the app to apply changes.',
|
|
146
|
+
iconPlacement: _constants.PLACEMENTS.VERTICAL,
|
|
147
|
+
secondaryButton: {
|
|
148
|
+
title: 'Later',
|
|
149
|
+
onClick: () => alert('later')
|
|
150
|
+
},
|
|
151
|
+
size: _constants.SIZES.LARGE,
|
|
152
|
+
title: 'A new version is available.'
|
|
153
|
+
},
|
|
154
|
+
name: 'Vertical Layout'
|
|
155
|
+
};
|
|
156
|
+
const DarkVariant = exports.DarkVariant = {
|
|
157
|
+
args: {
|
|
158
|
+
colorTheme: _constants.COLOR_THEMES.NEGATIVE,
|
|
159
|
+
onClose: () => alert('closed'),
|
|
160
|
+
title: 'Critical maintenance scheduled for tonight.',
|
|
161
|
+
variant: _constants.VARIANTS.DARK
|
|
162
|
+
},
|
|
163
|
+
name: 'Dark Variant'
|
|
164
|
+
};
|
|
@@ -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,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buttonType = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
const buttonType = exports.buttonType = (0, _propTypes.shape)({
|
|
9
|
+
colorTheme: _propTypes.string,
|
|
10
|
+
dataTestId: _propTypes.string,
|
|
11
|
+
disabled: _propTypes.bool,
|
|
12
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.func]),
|
|
13
|
+
iconPlacement: _propTypes.string,
|
|
14
|
+
loading: _propTypes.bool,
|
|
15
|
+
onClick: _propTypes.func,
|
|
16
|
+
size: _propTypes.string,
|
|
17
|
+
title: _propTypes.node,
|
|
18
|
+
type: _propTypes.string,
|
|
19
|
+
variant: _propTypes.string
|
|
20
|
+
});
|