@widergy/energy-ui 3.22.4 → 3.22.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 +7 -0
- package/dist/components/UTActionCard/README.md +2 -2
- package/dist/components/UTActionCard/components/AdditionalMessage/index.js +3 -1
- package/dist/components/UTActionCard/components/BottomActions/index.js +5 -3
- package/dist/components/UTActionCard/components/BottomActions/styles.module.scss +4 -0
- package/dist/components/UTActionCard/components/Header/constants.js +14 -1
- package/dist/components/UTActionCard/components/Header/index.js +5 -3
- package/dist/components/UTActionCard/components/Header/styles.module.scss +6 -8
- package/dist/components/UTActionCard/components/HeaderActions/index.js +9 -6
- package/dist/components/UTActionCard/components/HeaderActions/utils.js +26 -15
- package/dist/components/UTActionCard/index.js +7 -9
- package/dist/components/UTIcon/styles.module.scss +0 -1
- package/package.json +1 -1
- package/dist/components/UTActionCard/components/HeaderActions/constants.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.22.5](https://github.com/widergy/energy-ui/compare/v3.22.4...v3.22.5) (2024-10-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ut action card minor fixes ([#502](https://github.com/widergy/energy-ui/issues/502)) ([a0b41b5](https://github.com/widergy/energy-ui/commit/a0b41b5b7bc9608892b87af8c6946d37aa56e782))
|
|
7
|
+
|
|
1
8
|
## [3.22.4](https://github.com/widergy/energy-ui/compare/v3.22.3...v3.22.4) (2024-10-02)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
| `description` | `string` | | Description text to be displayed. |
|
|
15
15
|
| `descriptionProps` | `shape({ colorTheme: string, variant: string })` | | Props to customize the description's style. |
|
|
16
16
|
| `headerActions` | `arrayOf(shape({ Icon: oneOfType([elementType, string]), iconProps: string, id: oneOfType([number, string]), label: string, loading: bool, onClick: func }))` | | List of actions available in the header section. |
|
|
17
|
-
| `headerActionsProps` | `shape({ alignment: oneOf(['center', 'end', 'start']), buttonGroupProps: shape({ colorTheme: string, shape: string }),
|
|
17
|
+
| `headerActionsProps` | `shape({ alignment: oneOf(['center', 'end', 'start']), buttonGroupProps: shape({ colorTheme: string, shape: string }), variant: oneOf(['default', 'buttonGroup']) })` | | Props to configure header actions alignment, button group, etc. |
|
|
18
18
|
| `mainAction` | `func` | | Main action function for the card. |
|
|
19
19
|
| `size` | `oneOf(['medium', 'small'])` | `'medium'` | Size of the card, either small or medium. |
|
|
20
20
|
| `status` | `string` | | Status text to be displayed. |
|
|
21
21
|
| `statusLabel` | `string` | | Status label for additional status info. |
|
|
22
22
|
| `statusAlignment` | `oneOf(['center', 'end', 'start'])` | | Alignment of the status element. |
|
|
23
|
-
| `title` | `string
|
|
23
|
+
| `title` | `string` | | The title of the card. |
|
|
24
24
|
| `titleProps` | `shape({ variant: string, weight: string })` | | Props to configure the title style. |
|
|
25
25
|
| `withBodyPadding` | `bool` | `false` | Adds padding to the card body if`true`. |
|
|
@@ -25,8 +25,10 @@ const AdditionalMessage = _ref => {
|
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
26
|
className: "".concat(_stylesModule.default.additionalMessageContainer, " ").concat(_stylesModule.default[size])
|
|
27
27
|
}, icon && /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
28
|
+
area: true,
|
|
28
29
|
colorTheme: "gray",
|
|
29
|
-
name: icon
|
|
30
|
+
name: icon,
|
|
31
|
+
size: 16
|
|
30
32
|
}, iconProps)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
31
33
|
colorTheme: "gray",
|
|
32
34
|
variant: "small",
|
|
@@ -15,7 +15,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
15
15
|
const BottomActions = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
actions = [],
|
|
18
|
-
bottomActionsVariant
|
|
18
|
+
bottomActionsVariant,
|
|
19
|
+
size
|
|
19
20
|
} = _ref;
|
|
20
21
|
const type = actions.length > 2 ? _constants.ACTION_TYPES.REDIRECTION : bottomActionsVariant || _constants.ACTION_TYPES.DEFAULT;
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -32,7 +33,7 @@ const BottomActions = _ref => {
|
|
|
32
33
|
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
34
|
classNames: {
|
|
34
35
|
childrenContainer: "".concat(type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.redirectionChildrenContainer, " "),
|
|
35
|
-
root: "".concat(_stylesModule.default.actionButton, " ").concat(type === _constants.ACTION_TYPES.REDIRECTION
|
|
36
|
+
root: "".concat(_stylesModule.default.actionButton, " ").concat(type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.fullWidth, " ").concat(size === _constants.SIZES.MEDIUM && _stylesModule.default.mediumPadding),
|
|
36
37
|
text: "".concat(type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.redirectionText : _stylesModule.default.defaultText)
|
|
37
38
|
},
|
|
38
39
|
colorTheme: colorTheme,
|
|
@@ -56,6 +57,7 @@ BottomActions.propTypes = {
|
|
|
56
57
|
loading: _propTypes.bool,
|
|
57
58
|
onClick: _propTypes.func
|
|
58
59
|
})),
|
|
59
|
-
bottomActionsVariant: _propTypes.string
|
|
60
|
+
bottomActionsVariant: _propTypes.string,
|
|
61
|
+
size: _propTypes.string
|
|
60
62
|
};
|
|
61
63
|
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(BottomActions);
|
|
@@ -7,11 +7,24 @@ exports.ADORNMENT_COMPONENT_MAPPER = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _UTAvatar = _interopRequireDefault(require("../../../UTAvatar"));
|
|
9
9
|
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
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); }
|
|
12
13
|
const ADORNMENT_COMPONENT_MAPPER = exports.ADORNMENT_COMPONENT_MAPPER = {
|
|
13
14
|
icon: _UTIcon.default,
|
|
14
|
-
avatar:
|
|
15
|
+
avatar: _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_UTAvatar.default, _extends({
|
|
21
|
+
className: "".concat(_stylesModule.default.defaultAvatar, " ").concat(className),
|
|
22
|
+
labelProps: {
|
|
23
|
+
variant: 'title1',
|
|
24
|
+
weight: 'medium'
|
|
25
|
+
}
|
|
26
|
+
}, props));
|
|
27
|
+
},
|
|
15
28
|
image: props => /*#__PURE__*/_react.default.createElement("img", _extends({
|
|
16
29
|
alt: ""
|
|
17
30
|
}, props))
|
|
@@ -20,6 +20,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
20
20
|
const Header = _ref => {
|
|
21
21
|
let {
|
|
22
22
|
adornment,
|
|
23
|
+
classNames,
|
|
23
24
|
description,
|
|
24
25
|
descriptionProps,
|
|
25
26
|
headerActions,
|
|
@@ -33,10 +34,11 @@ const Header = _ref => {
|
|
|
33
34
|
titleProps
|
|
34
35
|
} = _ref;
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
-
className: "".concat(_stylesModule.default.header, " ").concat(_stylesModule.default[size])
|
|
37
|
+
className: "".concat(_stylesModule.default.header, " ").concat(_stylesModule.default[size], " ").concat(classNames.header)
|
|
37
38
|
}, (0, _utils.renderAdornment)(adornment, 'left', size), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
-
className:
|
|
39
|
+
className: _stylesModule.default.headerTitles
|
|
39
40
|
}, (0, _utils.renderAdornment)(adornment, 'top', size), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
41
|
+
variant: "title3",
|
|
40
42
|
weight: "medium"
|
|
41
43
|
}, titleProps), title), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
42
44
|
colorTheme: "gray"
|
|
@@ -55,6 +57,7 @@ Header.propTypes = {
|
|
|
55
57
|
props: _propTypes.object,
|
|
56
58
|
type: _propTypes.string
|
|
57
59
|
}),
|
|
60
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
58
61
|
description: _propTypes.string,
|
|
59
62
|
descriptionProps: (0, _propTypes.shape)({
|
|
60
63
|
colorTheme: _propTypes.string,
|
|
@@ -74,7 +77,6 @@ Header.propTypes = {
|
|
|
74
77
|
colorTheme: _propTypes.string,
|
|
75
78
|
shape: _propTypes.string
|
|
76
79
|
}),
|
|
77
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
78
80
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
79
81
|
}),
|
|
80
82
|
setMainActionHoverVisible: _propTypes.string,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.headerTitles {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
+
grid-gap: 8px;
|
|
10
11
|
margin-right: auto;
|
|
11
12
|
overflow-wrap: anywhere;
|
|
12
13
|
}
|
|
@@ -15,18 +16,10 @@
|
|
|
15
16
|
padding: 24px;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
.gap-medium {
|
|
19
|
-
grid-gap: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
19
|
.small {
|
|
23
20
|
padding: 16px;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
.gap-small {
|
|
27
|
-
grid-gap: 8px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
.placeSelf-center {
|
|
31
24
|
place-self: center;
|
|
32
25
|
}
|
|
@@ -38,3 +31,8 @@
|
|
|
38
31
|
.placeSelf-end {
|
|
39
32
|
place-self: flex-end;
|
|
40
33
|
}
|
|
34
|
+
|
|
35
|
+
.defaultAvatar {
|
|
36
|
+
height: 64px;
|
|
37
|
+
width: 64px;
|
|
38
|
+
}
|
|
@@ -12,7 +12,6 @@ var _UTButtonGroup = _interopRequireDefault(require("../../../UTButtonGroup"));
|
|
|
12
12
|
var _UTMenu = _interopRequireDefault(require("../../../UTMenu"));
|
|
13
13
|
var _constants = require("../../constants");
|
|
14
14
|
var _utils = require("./utils");
|
|
15
|
-
var _constants2 = require("./constants");
|
|
16
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -32,7 +31,6 @@ const HeaderActions = _ref => {
|
|
|
32
31
|
colorTheme: buttonGroupColorTheme = 'secondary',
|
|
33
32
|
shape: buttonGroupShape
|
|
34
33
|
} = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.buttonGroupProps) || {};
|
|
35
|
-
const maxNumberOfPrimaryActions = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.maxNumberOfPrimaryActions) || _constants2.DEFAULT_MAX_NUMBER_OF_PRIMARY_ACTIONS;
|
|
36
34
|
const handleSetMainActionHoverVisible = () => setMainActionHoverVisible(true);
|
|
37
35
|
const handleSetMainActionHoverHidden = () => setMainActionHoverVisible(false);
|
|
38
36
|
const openMenu = event => setMenu(event.currentTarget);
|
|
@@ -40,8 +38,10 @@ const HeaderActions = _ref => {
|
|
|
40
38
|
handleSetMainActionHoverVisible();
|
|
41
39
|
setMenu();
|
|
42
40
|
};
|
|
43
|
-
const
|
|
44
|
-
|
|
41
|
+
const {
|
|
42
|
+
primaryActions,
|
|
43
|
+
secondaryActions
|
|
44
|
+
} = (0, _utils.processActions)(headerActions, !showButtonGroup ? closeMenu : null);
|
|
45
45
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
46
|
className: "".concat(_stylesModule.default.headerActionsContainer, " ").concat(_stylesModule.default["placeSelf-".concat(headerActionsProps.alignment)]),
|
|
47
47
|
onClick: e => e.stopPropagation(),
|
|
@@ -72,7 +72,11 @@ const HeaderActions = _ref => {
|
|
|
72
72
|
Icon: "IconDots",
|
|
73
73
|
onClick: e => {
|
|
74
74
|
e.stopPropagation();
|
|
75
|
-
|
|
75
|
+
if (menu) {
|
|
76
|
+
setMenu();
|
|
77
|
+
} else {
|
|
78
|
+
openMenu(e);
|
|
79
|
+
}
|
|
76
80
|
},
|
|
77
81
|
size: "medium",
|
|
78
82
|
variant: "text"
|
|
@@ -104,7 +108,6 @@ HeaderActions.propTypes = {
|
|
|
104
108
|
colorTheme: _propTypes.string,
|
|
105
109
|
shape: _propTypes.string
|
|
106
110
|
}),
|
|
107
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
108
111
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
109
112
|
}),
|
|
110
113
|
setMainActionHoverVisible: _propTypes.func
|
|
@@ -3,18 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
exports.processActions = void 0;
|
|
7
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const mapAction = (action, onClickHandler) => ({
|
|
10
|
+
...action,
|
|
11
|
+
onClick: e => {
|
|
12
|
+
var _action$onClick;
|
|
13
|
+
e === null || e === void 0 || e.stopPropagation();
|
|
14
|
+
if (onClickHandler) onClickHandler();
|
|
15
|
+
action === null || action === void 0 || (_action$onClick = action.onClick) === null || _action$onClick === void 0 || _action$onClick.call(action);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const processActions = (headerActions, onClickHandler) => headerActions.reduce((final, current) => {
|
|
19
|
+
if (current.isPrimary && (0, _isEmpty.default)(final.primaryActions)) return {
|
|
20
|
+
...final,
|
|
21
|
+
primaryActions: [current]
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
...final,
|
|
25
|
+
secondaryActions: [...final.secondaryActions, mapAction(current, onClickHandler)]
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
primaryActions: [],
|
|
29
|
+
secondaryActions: []
|
|
30
|
+
});
|
|
31
|
+
exports.processActions = processActions;
|
|
@@ -17,6 +17,7 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
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); }
|
|
20
21
|
const UTActionCard = _ref => {
|
|
21
22
|
let {
|
|
22
23
|
additionalMessage,
|
|
@@ -53,6 +54,7 @@ const UTActionCard = _ref => {
|
|
|
53
54
|
className: "".concat(_stylesModule.default.headerAndChildrenContainer, " ").concat(classNames.headerAndChildrenContainer)
|
|
54
55
|
}, /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
55
56
|
adornment,
|
|
57
|
+
classNames,
|
|
56
58
|
description,
|
|
57
59
|
descriptionProps,
|
|
58
60
|
headerActions,
|
|
@@ -67,15 +69,12 @@ const UTActionCard = _ref => {
|
|
|
67
69
|
titleProps
|
|
68
70
|
}), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
69
71
|
className: "".concat(withBodyPadding ? _stylesModule.default["bodyPadding-".concat(size)] : _stylesModule.default["withoutBodyPadding-".concat(size)])
|
|
70
|
-
}, children))), !(0, _object.objectIsEmpty)(additionalMessage) && /*#__PURE__*/_react.default.createElement(_AdditionalMessage.default, {
|
|
71
|
-
icon: additionalMessage.icon,
|
|
72
|
-
iconProps: additionalMessage.iconProps,
|
|
73
|
-
labelProps: additionalMessage.labelProps,
|
|
74
|
-
message: additionalMessage.message,
|
|
72
|
+
}, children))), !(0, _object.objectIsEmpty)(additionalMessage) && /*#__PURE__*/_react.default.createElement(_AdditionalMessage.default, _extends({}, additionalMessage, {
|
|
75
73
|
size: size
|
|
76
|
-
}), !(0, _array.isEmpty)(bottomActions) && /*#__PURE__*/_react.default.createElement(_BottomActions.default, {
|
|
74
|
+
})), !(0, _array.isEmpty)(bottomActions) && /*#__PURE__*/_react.default.createElement(_BottomActions.default, {
|
|
77
75
|
actions: bottomActions,
|
|
78
|
-
bottomActionsVariant: bottomActionsVariant
|
|
76
|
+
bottomActionsVariant: bottomActionsVariant,
|
|
77
|
+
size: size
|
|
79
78
|
}));
|
|
80
79
|
};
|
|
81
80
|
UTActionCard.propTypes = {
|
|
@@ -127,7 +126,6 @@ UTActionCard.propTypes = {
|
|
|
127
126
|
colorTheme: _propTypes.string,
|
|
128
127
|
shape: _propTypes.string
|
|
129
128
|
}),
|
|
130
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
131
129
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
132
130
|
}),
|
|
133
131
|
mainAction: _propTypes.func,
|
|
@@ -135,7 +133,7 @@ UTActionCard.propTypes = {
|
|
|
135
133
|
status: _propTypes.string,
|
|
136
134
|
statusLabel: _propTypes.string,
|
|
137
135
|
statusAlignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
138
|
-
title: _propTypes.string
|
|
136
|
+
title: _propTypes.string,
|
|
139
137
|
titleProps: (0, _propTypes.shape)({
|
|
140
138
|
variant: _propTypes.string,
|
|
141
139
|
weight: _propTypes.string
|
package/package.json
CHANGED