@widergy/energy-ui 2.1.0 → 2.1.1

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,10 @@
1
+ ## [2.1.1](https://github.com/widergy/energy-ui/compare/v2.1.0...v2.1.1) (2023-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixes on utbutton styles ([3c3dc8c](https://github.com/widergy/energy-ui/commit/3c3dc8c371e395a6a9bf597fff1885893c002ff7))
7
+
1
8
  # [2.1.0](https://github.com/widergy/energy-ui/compare/v2.0.2...v2.1.0) (2023-02-07)
2
9
 
3
10
 
@@ -14,7 +14,7 @@ var _classesUtils = require("../../utils/classesUtils");
14
14
  var _constants = require("./constants");
15
15
  var _theme = require("./theme");
16
16
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
17
- var _excluded = ["childrenContainer", "circularProgress", "icon", "leftIcon", "rightIcon"];
17
+ var _excluded = ["childrenContainer", "circularProgress", "icon"];
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  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); }
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -40,17 +40,16 @@ var UTButton = function UTButton(_ref) {
40
40
  var childrenContainer = classes.childrenContainer,
41
41
  circularProgress = classes.circularProgress,
42
42
  icon = classes.icon,
43
- leftIcon = classes.leftIcon,
44
- rightIcon = classes.rightIcon,
45
43
  materialButtonClasses = _objectWithoutProperties(classes, _excluded);
44
+ var iconClassname = "\n ".concat(_stylesModule.default.baseIcon, "\n ").concat(icon, "\n ").concat(children ? _stylesModule.default.icon : _stylesModule.default.iconOnly, "\n ").concat(hideTextOnResponsive && _stylesModule.default.adaptableIcon, "\n ");
46
45
  var RenderedChildren = /*#__PURE__*/_react.default.createElement("div", {
47
- className: "\n ".concat(childrenContainer, "\n ").concat(_stylesModule.default.childrenContainer, "\n ").concat(hideTextOnResponsive && _stylesModule.default.hideTextOnResponsive, "\n ")
46
+ className: "\n ".concat(childrenContainer, "\n ").concat(_stylesModule.default.childrenContainer, "\n ")
48
47
  }, iconPlacement === _constants.ICON_PLACEMENTS.left && Icon && /*#__PURE__*/_react.default.createElement(Icon, {
49
- className: "".concat(icon, " ").concat(leftIcon, " ").concat(children ? _stylesModule.default.icon : _stylesModule.default.iconOnly)
48
+ className: iconClassname
50
49
  }), children && /*#__PURE__*/_react.default.createElement("div", {
51
- className: "".concat(_stylesModule.default.text, " ").concat(classes.text)
50
+ className: "".concat(_stylesModule.default.text, " ").concat(hideTextOnResponsive && _stylesModule.default.hideTextOnResponsive, " ").concat(classes.text)
52
51
  }, children), iconPlacement !== _constants.ICON_PLACEMENTS.left && Icon && /*#__PURE__*/_react.default.createElement(Icon, {
53
- className: "".concat(icon, " ").concat(rightIcon, " ").concat(children ? _stylesModule.default.icon : _stylesModule.default.iconOnly)
52
+ className: iconClassname
54
53
  }));
55
54
  return /*#__PURE__*/_react.default.createElement(_Button.default, {
56
55
  disabled: disabled || loading,
@@ -1,32 +1,46 @@
1
1
  @import '../../scss/variables/mediaQueries';
2
2
 
3
+ $big-icon: 1.5rem;
4
+ $small-icon: 1.25rem;
5
+
3
6
  .hideTextOnResponsive {
4
7
  @media #{$mobile} {
5
- .text {
6
- display: none;
7
- }
8
+ display: none;
9
+ }
10
+ }
8
11
 
9
- .icon {
10
- margin: 0 -4px;
11
- }
12
+ .text {
13
+ .baseIcon + &,
14
+ & + .baseIcon {
15
+ margin-left: 8px;
12
16
  }
13
17
  }
14
18
 
15
- .icon {
19
+ .baseIcon {
16
20
  box-sizing: border-box;
17
21
  flex-shrink: 0;
18
- font-size: 1.25rem;
19
- height: 1.25rem;
20
- width: 1.25rem;
22
+ }
23
+
24
+ .icon {
25
+ font-size: $small-icon;
26
+ height: $small-icon;
27
+ width: $small-icon;
21
28
  }
22
29
 
23
30
  .iconOnly {
24
- box-sizing: border-box;
25
- flex-shrink: 0;
26
- font-size: 1.5rem;
27
- height: 1.5rem;
31
+ font-size: $big-icon;
32
+ height: $big-icon;
28
33
  margin: 0 -4px;
29
- width: 1.5rem;
34
+ width: $big-icon;
35
+ }
36
+
37
+ .adaptableIcon {
38
+ @media #{$mobile} {
39
+ font-size: $big-icon;
40
+ height: $big-icon;
41
+ margin: 0 -4px;
42
+ width: $big-icon;
43
+ }
30
44
  }
31
45
 
32
46
  .childrenContainer {
@@ -147,12 +147,6 @@ var baseButtonTheme = function baseButtonTheme(theme) {
147
147
  fontWeight: '500',
148
148
  padding: '4px 8px'
149
149
  },
150
- leftIcon: {
151
- marginRight: '8px'
152
- },
153
- rightIcon: {
154
- marginLeft: '8px'
155
- },
156
150
  circularProgress: {
157
151
  color: ((_theme$UTButton = theme.UTButton) === null || _theme$UTButton === void 0 ? void 0 : (_theme$UTButton$circu = _theme$UTButton.circularProgress) === null || _theme$UTButton$circu === void 0 ? void 0 : _theme$UTButton$circu.color) || '484848'
158
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",