cozy-ui 111.15.2 → 111.16.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/package.json +1 -1
- package/react/Icon/index.jsx +17 -2
- package/transpiled/react/Icon/index.js +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [111.16.0](https://github.com/cozy/cozy-ui/compare/v111.15.2...v111.16.0) (2024-10-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Icon:** Add `img` tag and `.png` file support ([c1eeb5d](https://github.com/cozy/cozy-ui/commit/c1eeb5d))
|
|
7
|
+
|
|
1
8
|
## [111.15.2](https://github.com/cozy/cozy-ui/compare/v111.15.1...v111.15.2) (2024-10-09)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/react/Icon/index.jsx
CHANGED
|
@@ -51,8 +51,23 @@ function Icon(props) {
|
|
|
51
51
|
if (!icon) return null
|
|
52
52
|
|
|
53
53
|
const isIconComp = icon.type === Icon
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const isImg = icon.type === 'img'
|
|
55
|
+
|
|
56
|
+
if (isIconComp || isImg) return icon
|
|
57
|
+
|
|
58
|
+
const isPngPath = typeof icon === 'string' && icon.includes('.png')
|
|
59
|
+
|
|
60
|
+
if (isPngPath)
|
|
61
|
+
return (
|
|
62
|
+
<img
|
|
63
|
+
src={icon}
|
|
64
|
+
className={className}
|
|
65
|
+
style={style}
|
|
66
|
+
width={width || size || DEFAULT_SIZE}
|
|
67
|
+
height={height || size || DEFAULT_SIZE}
|
|
68
|
+
{...restProps}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
56
71
|
|
|
57
72
|
const Svg = isFunction(icon) ? icon : makeSvgObject(icon)
|
|
58
73
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["icon", "width", "height", "color", "style", "className", "preserveColor", "rotate", "size", "spin"];
|
|
5
5
|
import cx from 'classnames';
|
|
@@ -56,7 +56,16 @@ function Icon(props) {
|
|
|
56
56
|
|
|
57
57
|
if (!icon) return null;
|
|
58
58
|
var isIconComp = icon.type === Icon;
|
|
59
|
-
|
|
59
|
+
var isImg = icon.type === 'img';
|
|
60
|
+
if (isIconComp || isImg) return icon;
|
|
61
|
+
var isPngPath = typeof icon === 'string' && icon.includes('.png');
|
|
62
|
+
if (isPngPath) return /*#__PURE__*/React.createElement("img", _extends({
|
|
63
|
+
src: icon,
|
|
64
|
+
className: className,
|
|
65
|
+
style: style,
|
|
66
|
+
width: width || size || DEFAULT_SIZE,
|
|
67
|
+
height: height || size || DEFAULT_SIZE
|
|
68
|
+
}, restProps));
|
|
60
69
|
var Svg = isFunction(icon) ? icon : makeSvgObject(icon);
|
|
61
70
|
var selfStyle = style;
|
|
62
71
|
selfStyle = Object.assign({}, selfStyle);
|