@widergy/energy-ui 3.20.0 → 3.21.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/UTActionCard/README.md +25 -0
- package/dist/components/UTActionCard/components/AdditionalMessage/index.js +49 -0
- package/dist/components/UTActionCard/components/AdditionalMessage/styles.module.scss +13 -0
- package/dist/components/UTActionCard/components/BottomActions/index.js +62 -0
- package/dist/components/UTActionCard/components/BottomActions/styles.module.scss +40 -0
- package/dist/components/UTActionCard/components/Header/constants.js +18 -0
- package/dist/components/UTActionCard/components/Header/index.js +91 -0
- package/dist/components/UTActionCard/components/Header/styles.module.scss +39 -0
- package/dist/components/UTActionCard/components/Header/utils.js +154 -0
- package/dist/components/UTActionCard/components/HeaderActions/constants.js +7 -0
- package/dist/components/UTActionCard/components/HeaderActions/index.js +111 -0
- package/dist/components/UTActionCard/components/HeaderActions/styles.module.scss +22 -0
- package/dist/components/UTActionCard/components/HeaderActions/utils.js +20 -0
- package/dist/components/UTActionCard/constants.js +23 -0
- package/dist/components/UTActionCard/index.js +145 -0
- package/dist/components/UTActionCard/styles.module.scss +79 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.21.0](https://github.com/widergy/energy-ui/compare/v3.20.0...v3.21.0) (2024-09-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* ut action card ([#495](https://github.com/widergy/energy-ui/issues/495)) ([3813a97](https://github.com/widergy/energy-ui/commit/3813a97c14a3e0ef079e0d694916d115c1e702e2))
|
|
7
|
+
|
|
1
8
|
# [3.20.0](https://github.com/widergy/energy-ui/compare/v3.19.0...v3.20.0) (2024-09-23)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# UTButton
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
| Name | Type | Default | Description |
|
|
7
|
+
| :----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------ |
|
|
8
|
+
| `additionalMessage` | `shape({ Icon: elementType, iconProps: shape({ colorTheme: string, size: string }), labelProps: shape({ colorTheme: string, variant: string }), message: string })` | | Additional message information, including icons and labels. |
|
|
9
|
+
| `adornment` | `shape({ alignment: oneOf(['center', 'end', 'start']), position: string, props: object, type: string })` | | Adornment object to customize alignment, position, and type. |
|
|
10
|
+
| `BackgroundImage` | `elementType` | | A React component for the background image. |
|
|
11
|
+
| `bottomActions` | `arrayOf(shape({ colorTheme: string, disabled: bool, Icon: elementType, label: string, loading: bool, onClick: func }))` | | Defines the list of actions to be displayed at the bottom of the card. |
|
|
12
|
+
| `bottomActionsVariant` | `oneOf(['default', 'redirection'])` | | Sets the style variant for bottom actions. |
|
|
13
|
+
| `classNames` | `objectOf(string)` | | Css classes |
|
|
14
|
+
| `description` | `string` | | Description text to be displayed. |
|
|
15
|
+
| `descriptionProps` | `shape({ colorTheme: string, variant: string })` | | Props to customize the description's style. |
|
|
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, type: string }), maxNumberOfPrimaryActions: number, variant: oneOf(['default', 'buttonGroup']) })` | | Props to configure header actions alignment, button group, etc. |
|
|
18
|
+
| `mainAction` | `func` | | Main action function for the card. |
|
|
19
|
+
| `size` | `oneOf(['medium', 'small'])` | `'medium'` | Size of the card, either small or medium. |
|
|
20
|
+
| `status` | `string` | | Status text to be displayed. |
|
|
21
|
+
| `statusLabel` | `string` | | Status label for additional status info. |
|
|
22
|
+
| `statusAlignment` | `oneOf(['center', 'end', 'start'])` | | Alignment of the status element. |
|
|
23
|
+
| `title` | `string.isRequired` | | The title of the card, required. |
|
|
24
|
+
| `titleProps` | `shape({ variant: string, weight: string })` | | Props to configure the title style. |
|
|
25
|
+
| `withBodyPadding` | `bool` | `false` | Adds padding to the card body if`true`. |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
11
|
+
var _constants = require("../../constants");
|
|
12
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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); }
|
|
17
|
+
const AdditionalMessage = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
icon,
|
|
20
|
+
iconProps = {},
|
|
21
|
+
labelProps = {},
|
|
22
|
+
message,
|
|
23
|
+
size
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
className: `${_stylesModule.default.additionalMessageContainer} ${_stylesModule.default[size]}`
|
|
27
|
+
}, icon && /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
28
|
+
colorTheme: "gray",
|
|
29
|
+
name: icon
|
|
30
|
+
}, iconProps)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
31
|
+
colorTheme: "gray",
|
|
32
|
+
variant: "small",
|
|
33
|
+
withMarkdown: true
|
|
34
|
+
}, labelProps), message));
|
|
35
|
+
};
|
|
36
|
+
AdditionalMessage.propTypes = {
|
|
37
|
+
icon: _propTypes.string,
|
|
38
|
+
iconProps: (0, _propTypes.shape)({
|
|
39
|
+
colorTheme: _propTypes.string,
|
|
40
|
+
size: _propTypes.string
|
|
41
|
+
}),
|
|
42
|
+
labelProps: (0, _propTypes.shape)({
|
|
43
|
+
colorTheme: _propTypes.string,
|
|
44
|
+
variant: _propTypes.string
|
|
45
|
+
}),
|
|
46
|
+
message: _propTypes.string,
|
|
47
|
+
size: (0, _propTypes.oneOf)([_constants.SIZES.MEDIUM, _constants.SIZES.SMALL])
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AdditionalMessage);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../../../UTButton"));
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const BottomActions = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
actions = [],
|
|
18
|
+
bottomActionsVariant
|
|
19
|
+
} = _ref;
|
|
20
|
+
const type = actions.length > 2 ? _constants.ACTION_TYPES.REDIRECTION : bottomActionsVariant || _constants.ACTION_TYPES.DEFAULT;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
className: _stylesModule.default.actionsContainer
|
|
23
|
+
}, actions.map(_ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
colorTheme = 'primary',
|
|
26
|
+
disabled,
|
|
27
|
+
Icon,
|
|
28
|
+
label,
|
|
29
|
+
loading,
|
|
30
|
+
onClick
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
|
+
classNames: {
|
|
34
|
+
childrenContainer: `${type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.redirectionChildrenContainer} `,
|
|
35
|
+
root: `${_stylesModule.default.actionButton} ${type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.fullWidth : ''}`,
|
|
36
|
+
text: `${type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.redirectionText : _stylesModule.default.defaultText}`
|
|
37
|
+
},
|
|
38
|
+
colorTheme: colorTheme,
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
Icon: type === _constants.ACTION_TYPES.REDIRECTION ? 'IconChevronRight' : Icon,
|
|
41
|
+
iconPlacement: type === _constants.ACTION_TYPES.REDIRECTION ? 'right' : 'left',
|
|
42
|
+
key: label,
|
|
43
|
+
loading: loading,
|
|
44
|
+
onClick: onClick,
|
|
45
|
+
size: "large",
|
|
46
|
+
variant: "text"
|
|
47
|
+
}, label);
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
BottomActions.propTypes = {
|
|
51
|
+
actions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
52
|
+
colorTheme: _propTypes.string,
|
|
53
|
+
disabled: _propTypes.bool,
|
|
54
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
55
|
+
label: _propTypes.string,
|
|
56
|
+
loading: _propTypes.bool,
|
|
57
|
+
onClick: _propTypes.func,
|
|
58
|
+
type: (0, _propTypes.oneOf)([_constants.ACTION_TYPES.DEFAULT, _constants.ACTION_TYPES.REDIRECTION])
|
|
59
|
+
})),
|
|
60
|
+
bottomActionsVariant: _propTypes.string
|
|
61
|
+
};
|
|
62
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(BottomActions);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
$default-border-color: #E7E7E7;
|
|
2
|
+
|
|
3
|
+
.actionsContainer {
|
|
4
|
+
border-top: 1px solid var(--light04, $default-border-color);
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.actionButton {
|
|
9
|
+
flex: 1;
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
& + .actionButton {
|
|
13
|
+
border-left: 1px solid var(--light04, $default-border-color);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.redirectionChildrenContainer {
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.redirectionText {
|
|
22
|
+
align-items: center;
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.defaultText {
|
|
29
|
+
flex: 1;
|
|
30
|
+
min-width: 50%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.actionsContainer {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.fullWidth {
|
|
39
|
+
flex: 1 0 100%;
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ADORNMENT_COMPONENT_MAPPER = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _UTAvatar = _interopRequireDefault(require("../../../UTAvatar"));
|
|
9
|
+
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
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
|
+
const ADORNMENT_COMPONENT_MAPPER = exports.ADORNMENT_COMPONENT_MAPPER = {
|
|
13
|
+
icon: _UTIcon.default,
|
|
14
|
+
avatar: _UTAvatar.default,
|
|
15
|
+
image: props => /*#__PURE__*/_react.default.createElement("img", _extends({
|
|
16
|
+
alt: ""
|
|
17
|
+
}, props))
|
|
18
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _array = require("@widergy/web-utils/lib/array");
|
|
10
|
+
var _UTStatus = _interopRequireDefault(require("../../../UTStatus"));
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
12
|
+
var _HeaderActions = _interopRequireDefault(require("../HeaderActions"));
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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
|
+
const Header = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
adornment,
|
|
23
|
+
description,
|
|
24
|
+
descriptionProps,
|
|
25
|
+
headerActions,
|
|
26
|
+
headerActionsProps,
|
|
27
|
+
setMainActionHoverVisible,
|
|
28
|
+
size,
|
|
29
|
+
status,
|
|
30
|
+
statusAlignment,
|
|
31
|
+
statusLabel,
|
|
32
|
+
title,
|
|
33
|
+
titleProps
|
|
34
|
+
} = _ref;
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
+
className: `${_stylesModule.default.header} ${_stylesModule.default[size]}`
|
|
37
|
+
}, (0, _utils.renderAdornment)(adornment, 'left', size), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
className: `${_stylesModule.default.headerTitles} ${_stylesModule.default[`gap-${size}`]}`
|
|
39
|
+
}, (0, _utils.renderAdornment)(adornment, 'top', size), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
40
|
+
weight: "medium"
|
|
41
|
+
}, titleProps), title), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
42
|
+
colorTheme: "gray"
|
|
43
|
+
}, descriptionProps), description)), status ? /*#__PURE__*/_react.default.createElement(_UTStatus.default, _extends({
|
|
44
|
+
className: `${_stylesModule.default[`placeSelf-${statusAlignment}`]}`,
|
|
45
|
+
type: "light"
|
|
46
|
+
}, (0, _utils.statusPropsMapper)(status)), statusLabel || status) : null, !(0, _array.isEmpty)(headerActions) && /*#__PURE__*/_react.default.createElement(_HeaderActions.default, {
|
|
47
|
+
headerActions,
|
|
48
|
+
headerActionsProps,
|
|
49
|
+
setMainActionHoverVisible
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
Header.propTypes = {
|
|
53
|
+
adornment: (0, _propTypes.shape)({
|
|
54
|
+
position: _propTypes.string,
|
|
55
|
+
props: _propTypes.object,
|
|
56
|
+
type: _propTypes.string
|
|
57
|
+
}),
|
|
58
|
+
description: _propTypes.string,
|
|
59
|
+
descriptionProps: (0, _propTypes.shape)({
|
|
60
|
+
colorTheme: _propTypes.string,
|
|
61
|
+
variant: _propTypes.string
|
|
62
|
+
}),
|
|
63
|
+
headerActions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
64
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
65
|
+
id: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
66
|
+
isPrimary: _propTypes.bool,
|
|
67
|
+
label: _propTypes.string,
|
|
68
|
+
loading: _propTypes.bool,
|
|
69
|
+
onClick: _propTypes.func
|
|
70
|
+
})),
|
|
71
|
+
headerActionsProps: (0, _propTypes.shape)({
|
|
72
|
+
alignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
73
|
+
buttonGroupProps: (0, _propTypes.shape)({
|
|
74
|
+
colorTheme: _propTypes.string,
|
|
75
|
+
type: _propTypes.string
|
|
76
|
+
}),
|
|
77
|
+
maxNumberOfPrimaryActions: _propTypes.number,
|
|
78
|
+
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
79
|
+
}),
|
|
80
|
+
setMainActionHoverVisible: _propTypes.string,
|
|
81
|
+
size: (0, _propTypes.oneOf)([_constants.SIZES.MEDIUM, _constants.SIZES.SMALL]),
|
|
82
|
+
status: _propTypes.string,
|
|
83
|
+
statusAlignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
84
|
+
statusLabel: _propTypes.string,
|
|
85
|
+
title: _propTypes.string.isRequired,
|
|
86
|
+
titleProps: (0, _propTypes.shape)({
|
|
87
|
+
variant: _propTypes.string,
|
|
88
|
+
weight: _propTypes.string
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(Header);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
display: flex;
|
|
3
|
+
grid-gap: 16px;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.headerTitles {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
margin-right: auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.medium {
|
|
14
|
+
padding: 24px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.gap-medium {
|
|
18
|
+
grid-gap: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.small {
|
|
22
|
+
padding: 16px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gap-small {
|
|
26
|
+
grid-gap: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.placeSelf-center {
|
|
30
|
+
place-self: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.placeSelf-start {
|
|
34
|
+
place-self: flex-start;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.placeSelf-end {
|
|
38
|
+
place-self: flex-end;
|
|
39
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.statusPropsMapper = exports.renderAdornment = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _object = require("@widergy/web-utils/lib/object");
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
var _constants2 = require("./constants");
|
|
11
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
const ACTIVE = 'active';
|
|
15
|
+
const APPROVED = 'approved';
|
|
16
|
+
const CHARGED_BILL = 'factura cobrada';
|
|
17
|
+
const FINISHED = 'finished';
|
|
18
|
+
const INACTIVE = 'inactive';
|
|
19
|
+
const PENDING = 'pending';
|
|
20
|
+
const BILLED = 'cobrada';
|
|
21
|
+
const PAID = 'pagado';
|
|
22
|
+
const ABOUT_TO_EXPIRE = 'por vencer';
|
|
23
|
+
const UNPAID = 'impaga';
|
|
24
|
+
const SUBSCRIBED = 'subscribed_from_utility';
|
|
25
|
+
const UNSUBSCRIBED = 'unsubscribed';
|
|
26
|
+
const CLOSED_STATUS = 'completed';
|
|
27
|
+
const OBSERVED_STATUS = 'observed';
|
|
28
|
+
const ONGOING_STATUS = 'pending';
|
|
29
|
+
const FORM_STATUS = {
|
|
30
|
+
CANCELED: 'cancelled',
|
|
31
|
+
FINISHED: 'finished',
|
|
32
|
+
IN_PROGRESS: 'in_progress',
|
|
33
|
+
ON_HOLD: 'on_hold',
|
|
34
|
+
COMPLETED: 'completed'
|
|
35
|
+
};
|
|
36
|
+
const PAYMENTPLAN_STATUS = {
|
|
37
|
+
ACTIVE: 'active',
|
|
38
|
+
CANCELLED: 'canceled',
|
|
39
|
+
DRAFT: 'draft',
|
|
40
|
+
FINISHED: 'finished',
|
|
41
|
+
PENDING: 'pending',
|
|
42
|
+
PAYMENT_IN_PROGRESS: 'payment_in_progress',
|
|
43
|
+
PENDING_OFFLINE_PAYMENT: 'pending_offline_payment',
|
|
44
|
+
PENDING_PAYMENT: 'pending_payment'
|
|
45
|
+
};
|
|
46
|
+
const statusPropsMapper = status => ({
|
|
47
|
+
[ACTIVE]: {
|
|
48
|
+
variant: 'success',
|
|
49
|
+
withoutIcon: true
|
|
50
|
+
},
|
|
51
|
+
[APPROVED]: {
|
|
52
|
+
variant: 'success',
|
|
53
|
+
withoutIcon: true
|
|
54
|
+
},
|
|
55
|
+
[CHARGED_BILL]: {
|
|
56
|
+
variant: 'success',
|
|
57
|
+
withoutIcon: true
|
|
58
|
+
},
|
|
59
|
+
[CLOSED_STATUS]: {
|
|
60
|
+
variant: 'unassigned',
|
|
61
|
+
withoutIcon: true
|
|
62
|
+
},
|
|
63
|
+
[BILLED]: {
|
|
64
|
+
variant: 'success',
|
|
65
|
+
withoutIcon: true,
|
|
66
|
+
type: 'light'
|
|
67
|
+
},
|
|
68
|
+
[FINISHED]: {
|
|
69
|
+
variant: 'success',
|
|
70
|
+
withoutIcon: true
|
|
71
|
+
},
|
|
72
|
+
[INACTIVE]: {
|
|
73
|
+
variant: 'error',
|
|
74
|
+
withoutIcon: true
|
|
75
|
+
},
|
|
76
|
+
[OBSERVED_STATUS]: {
|
|
77
|
+
variant: 'warning',
|
|
78
|
+
withoutIcon: true
|
|
79
|
+
},
|
|
80
|
+
[ONGOING_STATUS]: {
|
|
81
|
+
variant: 'information',
|
|
82
|
+
withoutIcon: true
|
|
83
|
+
},
|
|
84
|
+
[PAID]: {
|
|
85
|
+
variant: 'success',
|
|
86
|
+
withoutIcon: true,
|
|
87
|
+
type: 'light'
|
|
88
|
+
},
|
|
89
|
+
[PAYMENTPLAN_STATUS.CANCELLED]: {
|
|
90
|
+
variant: 'error',
|
|
91
|
+
withoutIcon: true
|
|
92
|
+
},
|
|
93
|
+
[PAYMENTPLAN_STATUS.DRAFT]: {
|
|
94
|
+
variant: 'unassigned',
|
|
95
|
+
withoutIcon: true
|
|
96
|
+
},
|
|
97
|
+
[PAYMENTPLAN_STATUS.PAYMENT_IN_PROGRESS]: {
|
|
98
|
+
variant: 'warning',
|
|
99
|
+
withoutIcon: true
|
|
100
|
+
},
|
|
101
|
+
[PAYMENTPLAN_STATUS.PENDING_OFFLINE_PAYMENT]: {
|
|
102
|
+
variant: 'warning',
|
|
103
|
+
withoutIcon: true
|
|
104
|
+
},
|
|
105
|
+
[PAYMENTPLAN_STATUS.PENDING_PAYMENT]: {
|
|
106
|
+
variant: 'warning',
|
|
107
|
+
withoutIcon: true
|
|
108
|
+
},
|
|
109
|
+
[PENDING]: {
|
|
110
|
+
variant: 'information',
|
|
111
|
+
withoutIcon: true
|
|
112
|
+
},
|
|
113
|
+
[ABOUT_TO_EXPIRE]: {
|
|
114
|
+
variant: 'unassigned',
|
|
115
|
+
withoutIcon: true,
|
|
116
|
+
type: 'light'
|
|
117
|
+
},
|
|
118
|
+
[SUBSCRIBED]: {
|
|
119
|
+
variant: 'success'
|
|
120
|
+
},
|
|
121
|
+
[UNSUBSCRIBED]: {
|
|
122
|
+
variant: 'error'
|
|
123
|
+
},
|
|
124
|
+
[UNPAID]: {
|
|
125
|
+
variant: 'warning',
|
|
126
|
+
withoutIcon: true,
|
|
127
|
+
type: 'light'
|
|
128
|
+
},
|
|
129
|
+
[FORM_STATUS.CANCELED]: {
|
|
130
|
+
variant: 'error',
|
|
131
|
+
withoutIcon: true
|
|
132
|
+
},
|
|
133
|
+
[FORM_STATUS.IN_PROGRESS]: {
|
|
134
|
+
variant: 'information',
|
|
135
|
+
withoutIcon: true
|
|
136
|
+
},
|
|
137
|
+
[FORM_STATUS.ON_HOLD]: {
|
|
138
|
+
variant: 'warning',
|
|
139
|
+
withoutIcon: true
|
|
140
|
+
}
|
|
141
|
+
})[status?.toLowerCase()] || {
|
|
142
|
+
variant: 'error',
|
|
143
|
+
withoutIcon: true
|
|
144
|
+
};
|
|
145
|
+
exports.statusPropsMapper = statusPropsMapper;
|
|
146
|
+
const renderAdornment = (adornment, position, size) => {
|
|
147
|
+
if ((0, _object.objectIsEmpty)(adornment) || adornment.position !== position) return null;
|
|
148
|
+
const AdornmentComponent = _constants2.ADORNMENT_COMPONENT_MAPPER[adornment.type];
|
|
149
|
+
const defaultPlaceSelf = adornment.position === 'left' ? _constants.PLACE_SELF_TYPES.CENTER : _constants.PLACE_SELF_TYPES.START;
|
|
150
|
+
return /*#__PURE__*/_react.default.createElement(AdornmentComponent, _extends({
|
|
151
|
+
className: `${_stylesModule.default[`placeSelf-${adornment.alignment || defaultPlaceSelf}`]} ${position === 'top' ? _stylesModule.default[`gap-${size}`] : ''}`
|
|
152
|
+
}, adornment.props || {}));
|
|
153
|
+
};
|
|
154
|
+
exports.renderAdornment = renderAdornment;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _UTButton = _interopRequireDefault(require("../../../UTButton"));
|
|
11
|
+
var _UTButtonGroup = _interopRequireDefault(require("../../../UTButtonGroup"));
|
|
12
|
+
var _UTMenu = _interopRequireDefault(require("../../../UTMenu"));
|
|
13
|
+
var _constants = require("../../constants");
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
var _constants2 = require("./constants");
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
+
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); } /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
21
|
+
const HeaderActions = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
headerActions,
|
|
24
|
+
headerActionsProps,
|
|
25
|
+
setMainActionHoverVisible
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [menu, setMenu] = (0, _react.useState)();
|
|
28
|
+
const [selectedAction, setSelectedAction] = (0, _react.useState)(null);
|
|
29
|
+
const showButtonGroup = headerActionsProps.variant === _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP;
|
|
30
|
+
const {
|
|
31
|
+
colorTheme: buttonGroupColorTheme = 'secondary',
|
|
32
|
+
type: buttonGroupType
|
|
33
|
+
} = headerActionsProps?.buttonGroupProps || {};
|
|
34
|
+
const maxNumberOfPrimaryActions = headerActionsProps?.maxNumberOfPrimaryActions || _constants2.DEFAULT_MAX_NUMBER_OF_PRIMARY_ACTIONS;
|
|
35
|
+
const handleSetMainActionHoverVisible = () => setMainActionHoverVisible(true);
|
|
36
|
+
const handleSetMainActionHoverHidden = () => setMainActionHoverVisible(false);
|
|
37
|
+
const openMenu = event => setMenu(event.currentTarget);
|
|
38
|
+
const closeMenu = () => {
|
|
39
|
+
handleSetMainActionHoverVisible();
|
|
40
|
+
setMenu();
|
|
41
|
+
};
|
|
42
|
+
const primaryActions = (0, _utils.mapActions)(headerActions, true).slice(0, maxNumberOfPrimaryActions);
|
|
43
|
+
const secondaryActions = (0, _utils.mapActions)(headerActions, false, !showButtonGroup ? closeMenu : null);
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
className: `${_stylesModule.default.headerActionsContainer} ${_stylesModule.default[`placeSelf-${headerActionsProps.alignment}`]}`,
|
|
46
|
+
onClick: e => e.stopPropagation(),
|
|
47
|
+
onMouseEnter: handleSetMainActionHoverHidden,
|
|
48
|
+
onMouseLeave: handleSetMainActionHoverVisible
|
|
49
|
+
}, primaryActions.map(buttonProps => /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({}, buttonProps, {
|
|
50
|
+
classNames: {
|
|
51
|
+
root: _stylesModule.default.zIndex
|
|
52
|
+
},
|
|
53
|
+
size: "medium",
|
|
54
|
+
variant: "text"
|
|
55
|
+
}))), !(0, _isEmpty.default)(secondaryActions) && (!showButtonGroup ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_UTMenu.default, {
|
|
56
|
+
anchor: menu,
|
|
57
|
+
iconBefore: true,
|
|
58
|
+
items: secondaryActions,
|
|
59
|
+
menuPlacement: "bottom-end",
|
|
60
|
+
onClose: closeMenu,
|
|
61
|
+
scrollBarProps: {
|
|
62
|
+
options: {
|
|
63
|
+
suppressScrollY: true,
|
|
64
|
+
suppressScrollX: true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
68
|
+
classNames: {
|
|
69
|
+
root: _stylesModule.default.zIndex
|
|
70
|
+
},
|
|
71
|
+
Icon: "IconDots",
|
|
72
|
+
onClick: e => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
openMenu(e);
|
|
75
|
+
},
|
|
76
|
+
size: "medium",
|
|
77
|
+
variant: "text"
|
|
78
|
+
})) : /*#__PURE__*/_react.default.createElement(_UTButtonGroup.default, {
|
|
79
|
+
actions: secondaryActions.map(action => ({
|
|
80
|
+
...action,
|
|
81
|
+
onClick: () => {
|
|
82
|
+
setSelectedAction(action.id);
|
|
83
|
+
action.onClick();
|
|
84
|
+
}
|
|
85
|
+
})),
|
|
86
|
+
colorTheme: buttonGroupColorTheme,
|
|
87
|
+
selected: selectedAction || secondaryActions[0]?.id,
|
|
88
|
+
type: buttonGroupType
|
|
89
|
+
})));
|
|
90
|
+
};
|
|
91
|
+
HeaderActions.propTypes = {
|
|
92
|
+
headerActions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
93
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
94
|
+
id: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
95
|
+
isPrimary: _propTypes.bool,
|
|
96
|
+
label: _propTypes.string,
|
|
97
|
+
loading: _propTypes.bool,
|
|
98
|
+
onClick: _propTypes.func
|
|
99
|
+
})),
|
|
100
|
+
headerActionsProps: (0, _propTypes.shape)({
|
|
101
|
+
alignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
102
|
+
buttonGroupProps: (0, _propTypes.shape)({
|
|
103
|
+
colorTheme: _propTypes.string,
|
|
104
|
+
type: _propTypes.string
|
|
105
|
+
}),
|
|
106
|
+
maxNumberOfPrimaryActions: _propTypes.number,
|
|
107
|
+
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
108
|
+
}),
|
|
109
|
+
setMainActionHoverVisible: _propTypes.func
|
|
110
|
+
};
|
|
111
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(HeaderActions);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.headerActionsContainer {
|
|
2
|
+
align-items: center;
|
|
3
|
+
display: flex;
|
|
4
|
+
grid-gap: 8px;
|
|
5
|
+
height: fit-content;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.zIndex {
|
|
9
|
+
z-index: 2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.placeSelf-center {
|
|
13
|
+
place-self: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.placeSelf-start {
|
|
17
|
+
place-self: flex-start;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.placeSelf-end {
|
|
21
|
+
place-self: flex-end;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mapActions = void 0;
|
|
7
|
+
const mapActions = function () {
|
|
8
|
+
let actions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
|
+
let isPrimary = arguments.length > 1 ? arguments[1] : undefined;
|
|
10
|
+
let onClickHandler = arguments.length > 2 ? arguments[2] : undefined;
|
|
11
|
+
return actions.filter(action => (action?.isPrimary || false) === isPrimary).map(action => ({
|
|
12
|
+
...action,
|
|
13
|
+
onClick: e => {
|
|
14
|
+
e?.stopPropagation();
|
|
15
|
+
if (onClickHandler) onClickHandler();
|
|
16
|
+
action.onClick();
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
exports.mapActions = mapActions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SIZES = exports.PLACE_SELF_TYPES = exports.HEADER_ACTIONS_VARIANTS = exports.ACTION_TYPES = void 0;
|
|
7
|
+
const SIZES = exports.SIZES = {
|
|
8
|
+
MEDIUM: 'medium',
|
|
9
|
+
SMALL: 'small'
|
|
10
|
+
};
|
|
11
|
+
const ACTION_TYPES = exports.ACTION_TYPES = {
|
|
12
|
+
DEFAULT: 'default',
|
|
13
|
+
REDIRECTION: 'redirection'
|
|
14
|
+
};
|
|
15
|
+
const HEADER_ACTIONS_VARIANTS = exports.HEADER_ACTIONS_VARIANTS = {
|
|
16
|
+
BUTTON_GROUP: 'buttonGroup',
|
|
17
|
+
DEFAULT: 'default'
|
|
18
|
+
};
|
|
19
|
+
const PLACE_SELF_TYPES = exports.PLACE_SELF_TYPES = {
|
|
20
|
+
CENTER: 'center',
|
|
21
|
+
END: 'end',
|
|
22
|
+
START: 'start'
|
|
23
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _array = require("@widergy/web-utils/lib/array");
|
|
10
|
+
var _object = require("@widergy/web-utils/lib/object");
|
|
11
|
+
var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../UTTouchableWithoutFeedback"));
|
|
12
|
+
var _BottomActions = _interopRequireDefault(require("./components/BottomActions"));
|
|
13
|
+
var _AdditionalMessage = _interopRequireDefault(require("./components/AdditionalMessage"));
|
|
14
|
+
var _Header = _interopRequireDefault(require("./components/Header"));
|
|
15
|
+
var _constants = require("./constants");
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
+
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
|
+
const UTActionCard = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
additionalMessage,
|
|
23
|
+
adornment,
|
|
24
|
+
BackgroundImage,
|
|
25
|
+
bottomActions,
|
|
26
|
+
bottomActionsVariant,
|
|
27
|
+
children,
|
|
28
|
+
classNames = {},
|
|
29
|
+
description,
|
|
30
|
+
descriptionProps = {},
|
|
31
|
+
headerActions,
|
|
32
|
+
headerActionsProps = {
|
|
33
|
+
variant: _constants.HEADER_ACTIONS_VARIANTS.DEFAULT
|
|
34
|
+
},
|
|
35
|
+
mainAction,
|
|
36
|
+
size = _constants.SIZES.MEDIUM,
|
|
37
|
+
status,
|
|
38
|
+
statusAlignment,
|
|
39
|
+
statusLabel,
|
|
40
|
+
title,
|
|
41
|
+
titleProps = {},
|
|
42
|
+
withBodyPadding = true
|
|
43
|
+
} = _ref;
|
|
44
|
+
const [mainActionHoverVisible, setMainActionHoverVisible] = (0, _react.useState)(true);
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
+
className: `${_stylesModule.default.cardContainer} ${classNames.container}`
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
|
|
48
|
+
className: `${_stylesModule.default.innerContainer} ${classNames.innerContainer} ${!mainAction ? _stylesModule.default.withoutMainAction : `${_stylesModule.default.withMainAction} ${mainActionHoverVisible && `${_stylesModule.default.mainActionHover} ${classNames.mainActionHover}`}`}`,
|
|
49
|
+
onClick: () => mainAction?.()
|
|
50
|
+
}, BackgroundImage && /*#__PURE__*/_react.default.createElement(BackgroundImage, {
|
|
51
|
+
className: `${_stylesModule.default.backgroundImage} ${classNames.backgroundImage}`
|
|
52
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
+
className: `${_stylesModule.default.headerAndChildrenContainer} ${classNames.headerAndChildrenContainer}`
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
55
|
+
adornment,
|
|
56
|
+
description,
|
|
57
|
+
descriptionProps,
|
|
58
|
+
headerActions,
|
|
59
|
+
headerActionsProps,
|
|
60
|
+
mainAction,
|
|
61
|
+
setMainActionHoverVisible,
|
|
62
|
+
size,
|
|
63
|
+
status,
|
|
64
|
+
statusAlignment,
|
|
65
|
+
statusLabel,
|
|
66
|
+
title,
|
|
67
|
+
titleProps
|
|
68
|
+
}), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
+
className: `${withBodyPadding ? _stylesModule.default[`bodyPadding-${size}`] : _stylesModule.default[`withoutBodyPadding-${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,
|
|
75
|
+
size: size
|
|
76
|
+
}), !(0, _array.isEmpty)(bottomActions) && /*#__PURE__*/_react.default.createElement(_BottomActions.default, {
|
|
77
|
+
actions: bottomActions,
|
|
78
|
+
bottomActionsVariant: bottomActionsVariant
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
UTActionCard.propTypes = {
|
|
82
|
+
additionalMessage: (0, _propTypes.shape)({
|
|
83
|
+
Icon: _propTypes.elementType,
|
|
84
|
+
iconProps: (0, _propTypes.shape)({
|
|
85
|
+
colorTheme: _propTypes.string,
|
|
86
|
+
size: _propTypes.string
|
|
87
|
+
}),
|
|
88
|
+
labelProps: (0, _propTypes.shape)({
|
|
89
|
+
colorTheme: _propTypes.string,
|
|
90
|
+
variant: _propTypes.string
|
|
91
|
+
}),
|
|
92
|
+
message: _propTypes.string
|
|
93
|
+
}),
|
|
94
|
+
adornment: (0, _propTypes.shape)({
|
|
95
|
+
alignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
96
|
+
position: _propTypes.string,
|
|
97
|
+
props: _propTypes.object,
|
|
98
|
+
type: _propTypes.string
|
|
99
|
+
}),
|
|
100
|
+
BackgroundImage: _propTypes.elementType,
|
|
101
|
+
bottomActions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
102
|
+
colorTheme: _propTypes.string,
|
|
103
|
+
disabled: _propTypes.bool,
|
|
104
|
+
Icon: _propTypes.elementType,
|
|
105
|
+
label: _propTypes.string,
|
|
106
|
+
loading: _propTypes.bool,
|
|
107
|
+
onClick: _propTypes.func
|
|
108
|
+
})),
|
|
109
|
+
bottomActionsVariant: (0, _propTypes.oneOf)([_constants.ACTION_TYPES.DEFAULT, _constants.ACTION_TYPES.REDIRECTION]),
|
|
110
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
111
|
+
description: _propTypes.string,
|
|
112
|
+
descriptionProps: (0, _propTypes.shape)({
|
|
113
|
+
colorTheme: _propTypes.string,
|
|
114
|
+
variant: _propTypes.string
|
|
115
|
+
}),
|
|
116
|
+
headerActions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
117
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
118
|
+
iconProps: _propTypes.string,
|
|
119
|
+
id: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
120
|
+
label: _propTypes.string,
|
|
121
|
+
loading: _propTypes.bool,
|
|
122
|
+
onClick: _propTypes.func
|
|
123
|
+
})),
|
|
124
|
+
headerActionsProps: (0, _propTypes.shape)({
|
|
125
|
+
alignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
126
|
+
buttonGroupProps: (0, _propTypes.shape)({
|
|
127
|
+
colorTheme: _propTypes.string,
|
|
128
|
+
type: _propTypes.string
|
|
129
|
+
}),
|
|
130
|
+
maxNumberOfPrimaryActions: _propTypes.number,
|
|
131
|
+
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
132
|
+
}),
|
|
133
|
+
mainAction: _propTypes.func,
|
|
134
|
+
size: (0, _propTypes.oneOf)([_constants.SIZES.MEDIUM, _constants.SIZES.SMALL]),
|
|
135
|
+
status: _propTypes.string,
|
|
136
|
+
statusLabel: _propTypes.string,
|
|
137
|
+
statusAlignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
138
|
+
title: _propTypes.string.isRequired,
|
|
139
|
+
titleProps: (0, _propTypes.shape)({
|
|
140
|
+
variant: _propTypes.string,
|
|
141
|
+
weight: _propTypes.string
|
|
142
|
+
}),
|
|
143
|
+
withBodyPadding: _propTypes.bool
|
|
144
|
+
};
|
|
145
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(UTActionCard);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
$default-active-color: rgba(0, 0, 0, 0.2);
|
|
2
|
+
$default-card-container-color: #FFFFFF;
|
|
3
|
+
$default-hover-color: rgba(0, 0, 0, 0.08);
|
|
4
|
+
$default-shadow-gray-bottom-1: 0px 3px 6px rgba(24, 44, 73, 0.1);
|
|
5
|
+
|
|
6
|
+
.cardContainer {
|
|
7
|
+
background: var(--light01, $default-card-container-color);
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
box-shadow: var(--shadowGrayBottom1, $default-shadow-gray-bottom-1);
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.bodyPadding-medium {
|
|
14
|
+
padding: 0 24px 24px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.bodyPadding-small {
|
|
18
|
+
padding: 0 16px 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.withoutMainAction {
|
|
22
|
+
cursor: auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.withMainAction {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
display: flex;
|
|
28
|
+
position: relative;
|
|
29
|
+
width: 100%;
|
|
30
|
+
|
|
31
|
+
&::after {
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
content: '';
|
|
34
|
+
height: 100%;
|
|
35
|
+
left: 0;
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
transition: all 0.2s;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.mainActionHover {
|
|
44
|
+
&:hover::after {
|
|
45
|
+
background-color: $default-hover-color;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:active::after {
|
|
49
|
+
background-color: $default-active-color;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.innerContainer {
|
|
54
|
+
height: auto;
|
|
55
|
+
position: relative;
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.backgroundImage {
|
|
60
|
+
height: 100%;
|
|
61
|
+
position: absolute;
|
|
62
|
+
width: 100%;
|
|
63
|
+
z-index: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.headerAndChildrenContainer {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
width: 100%;
|
|
70
|
+
z-index: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.withoutBodyPadding-small {
|
|
74
|
+
padding-bottom: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.withoutBodyPadding-medium {
|
|
78
|
+
padding-bottom: 24px;
|
|
79
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "EnergyThemeProvider", {
|
|
|
15
15
|
return _EnergyThemeProvider.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "UTActionCard", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _UTActionCard.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "UTAlert", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
@@ -408,6 +414,7 @@ Object.defineProperty(exports, "componentUtils", {
|
|
|
408
414
|
var _AlertHandler = _interopRequireDefault(require("./components/UTAlert/AlertHandler"));
|
|
409
415
|
var _componentUtils = _interopRequireDefault(require("./utils/componentUtils"));
|
|
410
416
|
var _EnergyThemeProvider = _interopRequireDefault(require("./components/EnergyThemeProvider"));
|
|
417
|
+
var _UTActionCard = _interopRequireDefault(require("./components/UTActionCard"));
|
|
411
418
|
var _UTAlert = _interopRequireDefault(require("./components/UTAlert"));
|
|
412
419
|
var _UTAttachment = _interopRequireDefault(require("./components/UTAttachment"));
|
|
413
420
|
var _UTAttachmentList = _interopRequireDefault(require("./components/UTAttachmentList"));
|