@widergy/energy-ui 3.7.3 → 3.7.5
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 +14 -0
- package/dist/components/UTBadge/README.md +44 -0
- package/dist/components/UTBadge/constants.js +18 -0
- package/dist/components/UTBadge/index.js +40 -0
- package/dist/components/UTBadge/theme.js +60 -0
- package/dist/components/UTBreadcrumbs/index.js +2 -0
- package/dist/components/UTWorkflowContainer/versions/V1/index.js +1 -1
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.7.5](https://github.com/widergy/energy-ui/compare/v3.7.4...v3.7.5) (2024-06-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* progress bar count ([#454](https://github.com/widergy/energy-ui/issues/454)) ([831bdcc](https://github.com/widergy/energy-ui/commit/831bdccb95e242aa65743e538f730abccb07a0e8))
|
|
7
|
+
|
|
8
|
+
## [3.7.4](https://github.com/widergy/energy-ui/compare/v3.7.3...v3.7.4) (2024-06-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add UTBadge ([#452](https://github.com/widergy/energy-ui/issues/452)) ([99e137a](https://github.com/widergy/energy-ui/commit/99e137ad5a6825aae30ac6588af06c3b9c956087))
|
|
14
|
+
|
|
1
15
|
## [3.7.3](https://github.com/widergy/energy-ui/compare/v3.7.2...v3.7.3) (2024-05-27)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# UTBadge
|
|
2
|
+
|
|
3
|
+
### Description
|
|
4
|
+
|
|
5
|
+
Basic badge component for displaying labels with various color themes.
|
|
6
|
+
|
|
7
|
+
### Color Themes
|
|
8
|
+
|
|
9
|
+
The color themes are defined by the UX team and are:
|
|
10
|
+
|
|
11
|
+
- `alert`: Consumes the error variant.
|
|
12
|
+
- `identity`: Consumes the accent variant.
|
|
13
|
+
- `identitySecondary`: Consumes the neutral variant.
|
|
14
|
+
- `negative`: Consumes the negative variant.
|
|
15
|
+
- `information`: Consumes the information variant.
|
|
16
|
+
- `warning`: Consumes the warning variant.
|
|
17
|
+
- `success`: Consumes the success variant.
|
|
18
|
+
|
|
19
|
+
These color themes will change how the badge looks.
|
|
20
|
+
|
|
21
|
+
### Props
|
|
22
|
+
|
|
23
|
+
| Name | Type | Default | Description |
|
|
24
|
+
| ---------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| children | string | | The text content to be displayed inside the badge. |
|
|
26
|
+
| colorTheme | string | | The color theme to use. One of: `alert`, `identity`, `identitySecondary`, `negative`, `information`, `warning`, `success`. |
|
|
27
|
+
|
|
28
|
+
### Example
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import UTBadge from '@widergy/energy-ui';
|
|
33
|
+
|
|
34
|
+
const App = () => (
|
|
35
|
+
<div>
|
|
36
|
+
<UTBadge />
|
|
37
|
+
<UTBadge colorTheme="identity">0</UTBadge>
|
|
38
|
+
<UTBadge colorTheme="information">999+</UTBadge>
|
|
39
|
+
<UTBadge colorTheme="success">Success Badge</UTBadge>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export default App;
|
|
44
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_PROPS = exports.COLORS_MAPPER = void 0;
|
|
7
|
+
const COLORS_MAPPER = exports.COLORS_MAPPER = {
|
|
8
|
+
alert: 'error',
|
|
9
|
+
identity: 'accent',
|
|
10
|
+
identitySecondary: 'neutral',
|
|
11
|
+
information: 'information',
|
|
12
|
+
negative: 'negative',
|
|
13
|
+
success: 'success',
|
|
14
|
+
warning: 'warning'
|
|
15
|
+
};
|
|
16
|
+
const DEFAULT_PROPS = exports.DEFAULT_PROPS = {
|
|
17
|
+
colorTheme: 'alert'
|
|
18
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
10
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
11
|
+
var _theme = require("./theme");
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
const UTBadge = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
classes,
|
|
19
|
+
className,
|
|
20
|
+
colorTheme
|
|
21
|
+
} = _ref;
|
|
22
|
+
const textColorTheme = colorTheme === 'negative' ? 'dark' : 'negative';
|
|
23
|
+
const Component = children ? _UTLabel.default : 'span';
|
|
24
|
+
const componentProps = children ? {
|
|
25
|
+
colorTheme: textColorTheme,
|
|
26
|
+
variant: 'xsmall',
|
|
27
|
+
weight: 'medium'
|
|
28
|
+
} : {};
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
30
|
+
className: "".concat(classes.root, " ").concat(className)
|
|
31
|
+
}, componentProps), children);
|
|
32
|
+
};
|
|
33
|
+
UTBadge.defaultProps = _constants.DEFAULT_PROPS;
|
|
34
|
+
UTBadge.propTypes = {
|
|
35
|
+
children: _propTypes.string,
|
|
36
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
37
|
+
className: _propTypes.string,
|
|
38
|
+
colorTheme: _propTypes.string
|
|
39
|
+
};
|
|
40
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBadge);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.variantsColorTheme = exports.retrieveStyle = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
const variantsColorTheme = (theme, colorTheme) => {
|
|
9
|
+
const colorName = _constants.COLORS_MAPPER[colorTheme] || _constants.COLORS_MAPPER[_constants.DEFAULT_PROPS.colorTheme];
|
|
10
|
+
const paletteTheme = theme.Palette[colorName] || theme.Palette.actions[colorName];
|
|
11
|
+
const backgroundColorMapper = {
|
|
12
|
+
alert: paletteTheme['04'],
|
|
13
|
+
information: paletteTheme['05'],
|
|
14
|
+
warning: paletteTheme['05'],
|
|
15
|
+
success: paletteTheme['05'],
|
|
16
|
+
identity: paletteTheme['05'],
|
|
17
|
+
identitySecondary: paletteTheme['05'],
|
|
18
|
+
negative: paletteTheme['04']
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
backgroundColor: backgroundColorMapper[colorTheme]
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.variantsColorTheme = variantsColorTheme;
|
|
25
|
+
const baseButtonTheme = () => ({
|
|
26
|
+
root: {
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
borderRadius: '100px',
|
|
29
|
+
display: 'inline-flex',
|
|
30
|
+
height: 'fit-content',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
margin: 10,
|
|
33
|
+
minHeight: '10px',
|
|
34
|
+
minWidth: '10px',
|
|
35
|
+
verticalAlign: 'middle'
|
|
36
|
+
},
|
|
37
|
+
text: {
|
|
38
|
+
height: '20px',
|
|
39
|
+
padding: '0 6px',
|
|
40
|
+
textAlign: 'center'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const retrieveStyle = _ref => {
|
|
44
|
+
let {
|
|
45
|
+
theme,
|
|
46
|
+
colorTheme,
|
|
47
|
+
children
|
|
48
|
+
} = _ref;
|
|
49
|
+
const baseTheme = baseButtonTheme();
|
|
50
|
+
const textTheme = children ? baseTheme.text : {};
|
|
51
|
+
const variantTheme = variantsColorTheme(theme, colorTheme);
|
|
52
|
+
return {
|
|
53
|
+
root: {
|
|
54
|
+
...baseTheme.root,
|
|
55
|
+
...textTheme,
|
|
56
|
+
...variantTheme
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -149,6 +149,7 @@ const UTBreadcrumbs = _ref => {
|
|
|
149
149
|
key: "".concat(route, "-").concat(label)
|
|
150
150
|
}, !route && !menuItems || disableMenu ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
151
151
|
className: _stylesModule.default.label,
|
|
152
|
+
variant: "small",
|
|
152
153
|
weight: "medium"
|
|
153
154
|
}, colorThemesDefinition.label), label) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
154
155
|
classNames: {
|
|
@@ -161,6 +162,7 @@ const UTBreadcrumbs = _ref => {
|
|
|
161
162
|
variant: "text"
|
|
162
163
|
}, colorThemesDefinition.button), "".concat(label)), !isLast && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
163
164
|
className: classes.separator,
|
|
165
|
+
variant: "small",
|
|
164
166
|
weight: "medium"
|
|
165
167
|
}, colorThemesDefinition.label), separator));
|
|
166
168
|
}), !disableMenu && /*#__PURE__*/_react.default.createElement(_UTMenu.default, _extends({
|
|
@@ -94,7 +94,7 @@ const UTWorkflowContainer = _ref => {
|
|
|
94
94
|
label: _stylesModule.default.progressBarLabel,
|
|
95
95
|
root: _stylesModule.default.progress
|
|
96
96
|
},
|
|
97
|
-
value: currentStep * 100 /
|
|
97
|
+
value: currentStep * 100 / stepsCount
|
|
98
98
|
}), /*#__PURE__*/_react.default.createElement(_NavActions.default, {
|
|
99
99
|
backButton: backButton,
|
|
100
100
|
checkbox: checkbox,
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "UTAvatar", {
|
|
|
45
45
|
return _UTAvatar.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "UTBadge", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _UTBadge.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "UTBarChart", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function () {
|
|
@@ -383,6 +389,7 @@ var _UTAttachment = _interopRequireDefault(require("./components/UTAttachment"))
|
|
|
383
389
|
var _UTAttachmentList = _interopRequireDefault(require("./components/UTAttachmentList"));
|
|
384
390
|
var _UTAutocomplete = _interopRequireDefault(require("./components/UTAutocomplete"));
|
|
385
391
|
var _UTAvatar = _interopRequireDefault(require("./components/UTAvatar"));
|
|
392
|
+
var _UTBadge = _interopRequireDefault(require("./components/UTBadge"));
|
|
386
393
|
var _UTBarChart = _interopRequireDefault(require("./components/UTBarChart"));
|
|
387
394
|
var _UTBreadcrumbs = _interopRequireDefault(require("./components/UTBreadcrumbs"));
|
|
388
395
|
var _UTButton = _interopRequireDefault(require("./components/UTButton"));
|