@widergy/energy-ui 1.115.3 → 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 CHANGED
@@ -1,3 +1,24 @@
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
+
8
+ ## [1.115.5](https://github.com/widergy/energy-ui/compare/v1.115.4...v1.115.5) (2022-04-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * adding hideOnClick: true ([#275](https://github.com/widergy/energy-ui/issues/275)) ([6af5cda](https://github.com/widergy/energy-ui/commit/6af5cdae08171ba4b5acb1216db433b9de80d400))
14
+
15
+ ## [1.115.4](https://github.com/widergy/energy-ui/compare/v1.115.3...v1.115.4) (2022-04-05)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * changin hide barchart calculation ([#274](https://github.com/widergy/energy-ui/issues/274)) ([fc8d404](https://github.com/widergy/energy-ui/commit/fc8d40478581edc694d9258706528f47434ca5a2))
21
+
1
22
  ## [1.115.3](https://github.com/widergy/energy-ui/compare/v1.115.2...v1.115.3) (2022-03-22)
2
23
 
3
24
 
@@ -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
  };
@@ -168,12 +168,15 @@ var UTBarChart = function UTBarChart(_ref) {
168
168
  flatBarData = _flattenData.flatBarData,
169
169
  flatLinearData = _flattenData.flatLinearData;
170
170
 
171
+ var _flattenData2 = (0, _utils.flattenData)(barData, linearData),
172
+ fullFlatBarData = _flattenData2.flatBarData;
173
+
171
174
  var _getMaxValues = (0, _utils.getMaxValues)(flattenedAndReducedBarData, flatLinearData, levels),
172
175
  maxBarValue = _getMaxValues.maxBarValue,
173
176
  maxLinearValue = _getMaxValues.maxLinearValue;
174
177
 
175
178
  var withLinearData = !(0, _array.isEmpty)(flatLinearData) && maxLinearValue !== 0;
176
- var withBarData = !(0, _array.isEmpty)(flatBarData) && maxBarValue !== 0;
179
+ var withBarData = !(0, _array.isEmpty)(fullFlatBarData) && maxBarValue !== 0;
177
180
 
178
181
  var _getGraphAttributes = (0, _utils.getGraphAttributes)(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, pagination ? 0 : minBarWidth, formattedData[0].length, barPadding, groups, spacingOptions),
179
182
  TOTAL_HEIGHT = _getGraphAttributes.TOTAL_HEIGHT,
@@ -85,7 +85,10 @@ var ImageRadioCard = function ImageRadioCard(_ref) {
85
85
  };
86
86
 
87
87
  return tooltip ? /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
88
- content: tooltip
88
+ content: tooltip,
89
+ tippyProps: {
90
+ hideOnClick: true
91
+ }
89
92
  }, /*#__PURE__*/_react.default.createElement("span", {
90
93
  className: "".concat(_stylesModule.default.contentContainer, " ").concat(oneColumn ? _stylesModule.default.oneColumn : _stylesModule.default.twoColumns, " ")
91
94
  }, /*#__PURE__*/_react.default.createElement(Content, null))) : /*#__PURE__*/_react.default.createElement(Content, null);
@@ -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
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
-
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
-
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
-
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
45
-
46
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
49
-
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
- var UTTooltip = /*#__PURE__*/function (_Component) {
53
- _inherits(UTTooltip, _Component);
54
-
55
- var _super = _createSuper(UTTooltip);
56
-
57
- function UTTooltip() {
58
- _classCallCheck(this, UTTooltip);
59
-
60
- return _super.apply(this, arguments);
61
- }
62
-
63
- _createClass(UTTooltip, [{
64
- key: "render",
65
- value: function render() {
66
- var _this$props = this.props,
67
- children = _this$props.children,
68
- content = _this$props.content,
69
- stringContentProps = _this$props.stringContentProps,
70
- stringContentClassName = _this$props.stringContentClassName,
71
- _this$props$hideOnCli = _this$props.hideOnClick,
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
- placement: _propTypes.string,
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
- var _default = UTTooltip;
97
+
98
+ var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTTooltip);
99
+
120
100
  exports.default = _default;
@@ -6,3 +6,8 @@
6
6
  text-align: left;
7
7
  }
8
8
 
9
+ .arrow {
10
+ :global .tippy-arrow {
11
+ display: block !important;
12
+ }
13
+ }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "1.115.3",
3
+ "version": "1.116.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",