@widergy/energy-ui 1.115.5 → 1.116.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/UTAlert/index.js +8 -3
- package/dist/components/UTAlert/theme.js +11 -0
- package/dist/components/UTTooltip/index.js +55 -75
- package/dist/components/UTTooltip/styles.module.scss +5 -0
- package/dist/components/UTTooltip/theme.js +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.116.0](https://github.com/widergy/energy-ui/compare/v1.115.5...v1.116.0) (2022-04-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* utalert theme improvements and uttooltip theme ([#276](https://github.com/widergy/energy-ui/issues/276)) ([48778ed](https://github.com/widergy/energy-ui/commit/48778ed14aa0cdc803a4a9e6abdfe3137ca26278))
|
|
7
|
+
|
|
1
8
|
## [1.115.5](https://github.com/widergy/energy-ui/compare/v1.115.4...v1.115.5) (2022-04-07)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -123,7 +123,9 @@ var UTAlert = /*#__PURE__*/function (_PureComponent) {
|
|
|
123
123
|
var _this$props2 = this.props,
|
|
124
124
|
_this$props2$content = _this$props2.content,
|
|
125
125
|
alert = _this$props2$content === void 0 ? {} : _this$props2$content,
|
|
126
|
-
withoutIcon = _this$props2.withoutIcon
|
|
126
|
+
withoutIcon = _this$props2.withoutIcon,
|
|
127
|
+
_this$props2$classes = _this$props2.classes,
|
|
128
|
+
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes;
|
|
127
129
|
var anchor = {
|
|
128
130
|
vertical: alert.topRight ? 'top' : 'bottom',
|
|
129
131
|
horizontal: alert.topRight ? 'right' : 'left'
|
|
@@ -143,20 +145,23 @@ var UTAlert = /*#__PURE__*/function (_PureComponent) {
|
|
|
143
145
|
root: _stylesModule.default.snackbarRoot
|
|
144
146
|
},
|
|
145
147
|
ContentProps: {
|
|
146
|
-
className: "".concat(_stylesModule.default.snackbarContent, " ").concat(this.selectAlertType()),
|
|
148
|
+
className: "".concat(_stylesModule.default.snackbarContent, " ").concat(classes.snackbarContent, " ").concat(this.selectAlertType()),
|
|
147
149
|
classes: {
|
|
148
150
|
action: _stylesModule.default.action,
|
|
149
151
|
message: _stylesModule.default.message
|
|
150
152
|
}
|
|
151
153
|
},
|
|
152
154
|
message: /*#__PURE__*/_react.default.createElement("div", {
|
|
153
|
-
className: _stylesModule.default.content
|
|
155
|
+
className: "".concat(_stylesModule.default.content, " ").concat(classes.content)
|
|
154
156
|
}, !withoutIcon && AlertTypeIcon && /*#__PURE__*/_react.default.createElement(AlertTypeIcon, {
|
|
155
157
|
classes: {
|
|
156
158
|
root: _stylesModule.default.alertTypeIcon
|
|
157
159
|
}
|
|
158
160
|
}), alert.message),
|
|
159
161
|
action: [/*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
162
|
+
classes: {
|
|
163
|
+
root: classes.action
|
|
164
|
+
},
|
|
160
165
|
key: "close",
|
|
161
166
|
color: "inherit",
|
|
162
167
|
onClick: this.handleClose
|
|
@@ -26,6 +26,17 @@ var retrieveStyle = function retrieveStyle(theme) {
|
|
|
26
26
|
},
|
|
27
27
|
warning: {
|
|
28
28
|
backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'warning', 'backgroundColor'], _colors.default.notificationWarning)
|
|
29
|
+
},
|
|
30
|
+
action: {
|
|
31
|
+
padding: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'action', 'padding']),
|
|
32
|
+
margin: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'action', 'margin'])
|
|
33
|
+
},
|
|
34
|
+
snackbarContent: {
|
|
35
|
+
minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'content', 'minWidth'])
|
|
36
|
+
},
|
|
37
|
+
content: {
|
|
38
|
+
fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'content', 'fontSize']),
|
|
39
|
+
fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'content', 'fontWeight'])
|
|
29
40
|
}
|
|
30
41
|
};
|
|
31
42
|
};
|
|
@@ -19,8 +19,14 @@ var _propTypes = require("prop-types");
|
|
|
19
19
|
|
|
20
20
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
21
21
|
|
|
22
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
23
|
+
|
|
24
|
+
var _classesUtils = require("../../utils/classesUtils");
|
|
25
|
+
|
|
22
26
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
23
27
|
|
|
28
|
+
var _theme = require("./theme");
|
|
29
|
+
|
|
24
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
31
|
|
|
26
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -29,92 +35,66 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
29
35
|
|
|
30
36
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
hideOnClick = _this$props$hideOnCli === void 0 ? false : _this$props$hideOnCli,
|
|
73
|
-
_this$props$arrow = _this$props.arrow,
|
|
74
|
-
arrow = _this$props$arrow === void 0 ? true : _this$props$arrow,
|
|
75
|
-
_this$props$duration = _this$props.duration,
|
|
76
|
-
duration = _this$props$duration === void 0 ? [600, 350] : _this$props$duration,
|
|
77
|
-
_this$props$inertia = _this$props.inertia,
|
|
78
|
-
inertia = _this$props$inertia === void 0 ? true : _this$props$inertia,
|
|
79
|
-
tippyProps = _this$props.tippyProps,
|
|
80
|
-
_this$props$interacti = _this$props.interactive,
|
|
81
|
-
interactive = _this$props$interacti === void 0 ? true : _this$props$interacti,
|
|
82
|
-
className = _this$props.className;
|
|
83
|
-
if (!content) return children;
|
|
84
|
-
return /*#__PURE__*/_react.default.createElement(_react2.default, _extends({
|
|
85
|
-
animation: "shift-toward",
|
|
86
|
-
inertia: inertia,
|
|
87
|
-
duration: duration,
|
|
88
|
-
arrow: arrow,
|
|
89
|
-
hideOnClick: hideOnClick,
|
|
90
|
-
className: className,
|
|
91
|
-
interactive: interactive
|
|
92
|
-
}, tippyProps, {
|
|
93
|
-
content: /*#__PURE__*/_react.default.isValidElement(content) ? content : /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({}, stringContentProps, {
|
|
94
|
-
className: "".concat(_stylesModule.default.baseContent, " ").concat(stringContentClassName)
|
|
95
|
-
}), content)
|
|
96
|
-
}), children);
|
|
97
|
-
}
|
|
98
|
-
}]);
|
|
99
|
-
|
|
100
|
-
return UTTooltip;
|
|
101
|
-
}(_react.Component);
|
|
38
|
+
var UTTooltip = function UTTooltip(_ref) {
|
|
39
|
+
var _ref$arrow = _ref.arrow,
|
|
40
|
+
arrow = _ref$arrow === void 0 ? true : _ref$arrow,
|
|
41
|
+
children = _ref.children,
|
|
42
|
+
themeStyles = _ref.classes,
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
content = _ref.content,
|
|
45
|
+
_ref$duration = _ref.duration,
|
|
46
|
+
duration = _ref$duration === void 0 ? [600, 350] : _ref$duration,
|
|
47
|
+
forceArrow = _ref.forceArrow,
|
|
48
|
+
_ref$hideOnClick = _ref.hideOnClick,
|
|
49
|
+
hideOnClick = _ref$hideOnClick === void 0 ? false : _ref$hideOnClick,
|
|
50
|
+
_ref$inertia = _ref.inertia,
|
|
51
|
+
inertia = _ref$inertia === void 0 ? true : _ref$inertia,
|
|
52
|
+
_ref$interactive = _ref.interactive,
|
|
53
|
+
interactive = _ref$interactive === void 0 ? true : _ref$interactive,
|
|
54
|
+
stringContentClassName = _ref.stringContentClassName,
|
|
55
|
+
stringContentProps = _ref.stringContentProps,
|
|
56
|
+
tippyProps = _ref.tippyProps;
|
|
57
|
+
var theme = (0, _react.useMemo)(function () {
|
|
58
|
+
return (0, _classesUtils.mergeClasses)(themeStyles, {
|
|
59
|
+
container: className,
|
|
60
|
+
stringContent: stringContentClassName
|
|
61
|
+
});
|
|
62
|
+
}, [className, stringContentClassName]);
|
|
63
|
+
if (!content) return children;
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_react2.default, _extends({
|
|
65
|
+
animation: "shift-toward",
|
|
66
|
+
inertia: inertia,
|
|
67
|
+
duration: duration,
|
|
68
|
+
arrow: arrow,
|
|
69
|
+
hideOnClick: hideOnClick,
|
|
70
|
+
className: "".concat(theme.container, " ").concat(forceArrow && _stylesModule.default.arrow),
|
|
71
|
+
interactive: interactive
|
|
72
|
+
}, tippyProps, {
|
|
73
|
+
content: /*#__PURE__*/_react.default.isValidElement(content) ? content : /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({}, stringContentProps, {
|
|
74
|
+
className: "".concat(_stylesModule.default.baseContent, " ").concat(theme.stringContent)
|
|
75
|
+
}), content)
|
|
76
|
+
}), children);
|
|
77
|
+
};
|
|
102
78
|
|
|
103
79
|
UTTooltip.propTypes = {
|
|
104
|
-
|
|
80
|
+
arrow: _propTypes.bool,
|
|
81
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
105
82
|
className: _propTypes.string,
|
|
106
|
-
icon: _propTypes.element,
|
|
107
83
|
content: _propTypes.node,
|
|
108
|
-
hideOnClick: _propTypes.bool,
|
|
109
|
-
arrow: _propTypes.bool,
|
|
110
84
|
duration: (0, _propTypes.arrayOf)(_propTypes.number),
|
|
85
|
+
forceArrow: _propTypes.bool,
|
|
86
|
+
hideOnClick: _propTypes.bool,
|
|
87
|
+
icon: _propTypes.element,
|
|
111
88
|
inertia: _propTypes.bool,
|
|
112
89
|
interactive: _propTypes.bool,
|
|
90
|
+
placement: _propTypes.string,
|
|
113
91
|
stringContentClassName: _propTypes.string,
|
|
114
92
|
stringContentProps: _propTypes.any,
|
|
115
93
|
// eslint-disable-line react/forbid-prop-types
|
|
116
94
|
tippyProps: _propTypes.any // eslint-disable-line react/forbid-prop-types
|
|
117
95
|
|
|
118
96
|
};
|
|
119
|
-
|
|
97
|
+
|
|
98
|
+
var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTTooltip);
|
|
99
|
+
|
|
120
100
|
exports.default = _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
|
|
8
|
+
var retrieveStyle = function retrieveStyle(theme) {
|
|
9
|
+
var _theme$UTTooltip, _theme$UTTooltip$cont, _theme$UTTooltip2, _theme$UTTooltip2$con, _theme$UTTooltip3, _theme$UTTooltip3$con, _theme$UTTooltip4, _theme$UTTooltip4$con, _theme$UTTooltip5, _theme$UTTooltip5$arr, _theme$UTTooltip6, _theme$UTTooltip6$str, _theme$UTTooltip7, _theme$UTTooltip7$str, _theme$UTTooltip8, _theme$UTTooltip8$str, _theme$UTTooltip9, _theme$UTTooltip9$str;
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
container: {
|
|
13
|
+
backgroundColor: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip = theme.UTTooltip) === null || _theme$UTTooltip === void 0 ? void 0 : (_theme$UTTooltip$cont = _theme$UTTooltip.container) === null || _theme$UTTooltip$cont === void 0 ? void 0 : _theme$UTTooltip$cont.backgroundColor,
|
|
14
|
+
borderRadius: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip2 = theme.UTTooltip) === null || _theme$UTTooltip2 === void 0 ? void 0 : (_theme$UTTooltip2$con = _theme$UTTooltip2.container) === null || _theme$UTTooltip2$con === void 0 ? void 0 : _theme$UTTooltip2$con.borderRadius,
|
|
15
|
+
boxShadow: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip3 = theme.UTTooltip) === null || _theme$UTTooltip3 === void 0 ? void 0 : (_theme$UTTooltip3$con = _theme$UTTooltip3.container) === null || _theme$UTTooltip3$con === void 0 ? void 0 : _theme$UTTooltip3$con.boxShadow,
|
|
16
|
+
padding: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip4 = theme.UTTooltip) === null || _theme$UTTooltip4 === void 0 ? void 0 : (_theme$UTTooltip4$con = _theme$UTTooltip4.container) === null || _theme$UTTooltip4$con === void 0 ? void 0 : _theme$UTTooltip4$con.padding,
|
|
17
|
+
'& > .tippy-arrow': {
|
|
18
|
+
display: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip5 = theme.UTTooltip) === null || _theme$UTTooltip5 === void 0 ? void 0 : (_theme$UTTooltip5$arr = _theme$UTTooltip5.arrow) === null || _theme$UTTooltip5$arr === void 0 ? void 0 : _theme$UTTooltip5$arr.display
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
stringContent: {
|
|
22
|
+
fontSize: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip6 = theme.UTTooltip) === null || _theme$UTTooltip6 === void 0 ? void 0 : (_theme$UTTooltip6$str = _theme$UTTooltip6.stringContent) === null || _theme$UTTooltip6$str === void 0 ? void 0 : _theme$UTTooltip6$str.fontSize,
|
|
23
|
+
fontWeight: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip7 = theme.UTTooltip) === null || _theme$UTTooltip7 === void 0 ? void 0 : (_theme$UTTooltip7$str = _theme$UTTooltip7.stringContent) === null || _theme$UTTooltip7$str === void 0 ? void 0 : _theme$UTTooltip7$str.fontWeight,
|
|
24
|
+
lineHeight: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip8 = theme.UTTooltip) === null || _theme$UTTooltip8 === void 0 ? void 0 : (_theme$UTTooltip8$str = _theme$UTTooltip8.stringContent) === null || _theme$UTTooltip8$str === void 0 ? void 0 : _theme$UTTooltip8$str.lineHeight,
|
|
25
|
+
color: theme === null || theme === void 0 ? void 0 : (_theme$UTTooltip9 = theme.UTTooltip) === null || _theme$UTTooltip9 === void 0 ? void 0 : (_theme$UTTooltip9$str = _theme$UTTooltip9.stringContent) === null || _theme$UTTooltip9$str === void 0 ? void 0 : _theme$UTTooltip9$str.color
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.retrieveStyle = retrieveStyle;
|