@propellerads/icon 5.19.0 → 5.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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## `5.21.0`
2
+ * Do not add a hover effect if hoverColor is not specified.
3
+
4
+ ## `5.20.0`
5
+ * Icon types are extended using native SVG interface.
6
+
1
7
  ## `5.19.0`
2
8
  * Added `ArrowLeftFull` and `Cursor` icons
3
9
 
@@ -3,5 +3,5 @@ import { IconProps } from './types';
3
3
  interface Props extends IconProps {
4
4
  children: React.ReactNode;
5
5
  }
6
- declare const Icon: ({ children, size, color, hoverColor, onMouseEnter, onMouseLeave, className, }: Props) => JSX.Element;
6
+ declare const Icon: ({ children, size, color, hoverColor, ...rest }: Props) => JSX.Element;
7
7
  export { Icon };
@@ -10,6 +10,21 @@ var styled = require('styled-components');
10
10
  var styled__default = _interopDefault(styled);
11
11
  var stylevariables = require('@propellerads/stylevariables');
12
12
 
13
+ function _objectWithoutPropertiesLoose(source, excluded) {
14
+ if (source == null) return {};
15
+ var target = {};
16
+ var sourceKeys = Object.keys(source);
17
+ var key, i;
18
+
19
+ for (i = 0; i < sourceKeys.length; i++) {
20
+ key = sourceKeys[i];
21
+ if (excluded.indexOf(key) >= 0) continue;
22
+ target[key] = source[key];
23
+ }
24
+
25
+ return target;
26
+ }
27
+
13
28
  function _taggedTemplateLiteralLoose(strings, raw) {
14
29
  if (!raw) {
15
30
  raw = strings.slice(0);
@@ -58,6 +73,8 @@ var StyledIcon = /*#__PURE__*/styled__default.svg(_templateObject || (_templateO
58
73
  return props.hoverColor && "\n &:hover {\n fill: " + props.hoverColor + ";\n }\n ";
59
74
  });
60
75
 
76
+ var _excluded = ["children", "size", "color", "hoverColor"];
77
+
61
78
  var getColor = function getColor(color, theme) {
62
79
  var _theme$actionColor, _theme$successColor, _theme$errorColor, _theme$warningColor;
63
80
 
@@ -97,21 +114,16 @@ var Icon = function Icon(_ref) {
97
114
  size = _ref$size === void 0 ? exports.SIZE.MEDIUM : _ref$size,
98
115
  _ref$color = _ref.color,
99
116
  color = _ref$color === void 0 ? exports.COLOR.BLACK : _ref$color,
100
- _ref$hoverColor = _ref.hoverColor,
101
- hoverColor = _ref$hoverColor === void 0 ? exports.COLOR.BLACK : _ref$hoverColor,
102
- onMouseEnter = _ref.onMouseEnter,
103
- onMouseLeave = _ref.onMouseLeave,
104
- className = _ref.className;
117
+ hoverColor = _ref.hoverColor,
118
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
119
+
105
120
  var themeContext = React.useContext(styled.ThemeContext);
106
- return React__default.createElement(StyledIcon, {
107
- className: className,
121
+ return React__default.createElement(StyledIcon, Object.assign({
108
122
  size: size,
109
123
  color: getColor(color, themeContext),
110
124
  hoverColor: getColor(hoverColor, themeContext),
111
- onMouseEnter: onMouseEnter,
112
- onMouseLeave: onMouseLeave,
113
125
  viewBox: "0 0 24 24"
114
- }, children);
126
+ }, rest), children);
115
127
  };
116
128
 
117
129
  /* eslint max-len: off */