@micromag/element-image 0.3.420 → 0.3.429

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.
Files changed (2) hide show
  1. package/lib/index.js +16 -25
  2. package/package.json +9 -3
package/lib/index.js CHANGED
@@ -10,31 +10,22 @@ var React = require('react');
10
10
  var core = require('@micromag/core');
11
11
  var utils = require('@micromag/core/utils');
12
12
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
16
- var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
17
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
18
- var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
19
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
20
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
-
22
13
  var styles = {"container":"micromag-element-image-container","showEmpty":"micromag-element-image-showEmpty","img":"micromag-element-image-img"};
23
14
 
24
15
  var propTypes = {
25
16
  media: core.PropTypes.imageMedia,
26
- alt: PropTypes__default["default"].string,
27
- width: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
28
- height: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
29
- resolution: PropTypes__default["default"].number,
17
+ alt: PropTypes.string,
18
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
19
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
20
+ resolution: PropTypes.number,
30
21
  objectFit: core.PropTypes.objectFit,
31
22
  containerStyle: core.PropTypes.containerStyle,
32
23
  imageStyle: core.PropTypes.containerStyle,
33
- className: PropTypes__default["default"].string,
34
- imageClassName: PropTypes__default["default"].string,
35
- onLoaded: PropTypes__default["default"].func,
36
- loadingMode: PropTypes__default["default"].string,
37
- shouldLoad: PropTypes__default["default"].bool
24
+ className: PropTypes.string,
25
+ imageClassName: PropTypes.string,
26
+ onLoaded: PropTypes.func,
27
+ loadingMode: PropTypes.string,
28
+ shouldLoad: PropTypes.bool
38
29
  };
39
30
  var defaultProps = {
40
31
  media: null,
@@ -81,7 +72,7 @@ var Image = function Image(_ref) {
81
72
  width: mediaWidth,
82
73
  height: mediaHeight
83
74
  }),
84
- _useState2 = _slicedToArray__default["default"](_useState, 2),
75
+ _useState2 = _slicedToArray(_useState, 2),
85
76
  _useState2$ = _useState2[0],
86
77
  _useState2$$width = _useState2$.width,
87
78
  realWidth = _useState2$$width === void 0 ? 0 : _useState2$$width,
@@ -179,8 +170,8 @@ var Image = function Image(_ref) {
179
170
  };
180
171
  finalContainerStyle = finalImageStyle;
181
172
  }
182
- finalContainerStyle = _objectSpread__default["default"](_objectSpread__default["default"]({}, finalContainerStyle), containerStyle);
183
- finalImageStyle = _objectSpread__default["default"](_objectSpread__default["default"]({}, finalImageStyle), imageStyle);
173
+ finalContainerStyle = _objectSpread(_objectSpread({}, finalContainerStyle), containerStyle);
174
+ finalImageStyle = _objectSpread(_objectSpread({}, finalImageStyle), imageStyle);
184
175
  var _finalImageStyle = finalImageStyle,
185
176
  _finalImageStyle$widt = _finalImageStyle.width,
186
177
  finalWidth = _finalImageStyle$widt === void 0 ? null : _finalImageStyle$widt,
@@ -189,13 +180,13 @@ var Image = function Image(_ref) {
189
180
  var finalUrl = utils.getOptimalImageUrl(media, finalWidth, finalHeight, {
190
181
  resolution: resolution
191
182
  });
192
- return /*#__PURE__*/React__default["default"].createElement("div", {
193
- className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
183
+ return /*#__PURE__*/React.createElement("div", {
184
+ className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
194
185
  style: finalContainerStyle
195
- }, finalUrl !== null && finalShouldLoad ? /*#__PURE__*/React__default["default"].createElement("img", {
186
+ }, finalUrl !== null && finalShouldLoad ? /*#__PURE__*/React.createElement("img", {
196
187
  src: finalUrl,
197
188
  alt: alt || description,
198
- className: classNames__default["default"]([styles.img, _defineProperty__default["default"]({}, imageClassName, imageClassName !== null)]),
189
+ className: classNames([styles.img, _defineProperty({}, imageClassName, imageClassName !== null)]),
199
190
  style: finalImageStyle,
200
191
  onLoad: onImageLoaded,
201
192
  loading: loadingMode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-image",
3
- "version": "0.3.420",
3
+ "version": "0.3.429",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -32,6 +32,12 @@
32
32
  "license": "ISC",
33
33
  "main": "lib/index.js",
34
34
  "module": "es/index.js",
35
+ "exports": {
36
+ ".": {
37
+ "require": "./lib/index.js",
38
+ "import": "./es/index.js"
39
+ }
40
+ },
35
41
  "files": [
36
42
  "lib",
37
43
  "es",
@@ -51,7 +57,7 @@
51
57
  "dependencies": {
52
58
  "@babel/runtime": "^7.13.10",
53
59
  "@folklore/size": "^0.1.20",
54
- "@micromag/core": "^0.3.420",
60
+ "@micromag/core": "^0.3.429",
55
61
  "classnames": "^2.2.6",
56
62
  "prop-types": "^15.7.2",
57
63
  "react-intl": "^5.12.1",
@@ -61,5 +67,5 @@
61
67
  "access": "public",
62
68
  "registry": "https://registry.npmjs.org/"
63
69
  },
64
- "gitHead": "5b0f037a41c3bca07a5bce8f0dce205242f7ad17"
70
+ "gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
65
71
  }