@micromag/element-visual 0.3.251 → 0.3.262

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/es/index.js CHANGED
@@ -11,7 +11,7 @@ import Video from '@micromag/element-video';
11
11
 
12
12
  var styles = {"container":"micromag-element-visual-container","videoContainer":"micromag-element-visual-videoContainer"};
13
13
 
14
- var _excluded = ["media", "mediaRef", "width", "height", "resolution", "objectFit", "playing", "muted", "shouldLoad", "videoLoop", "videoInitialMuted", "onLoaded", "className", "imageClassName", "videoClassName"];
14
+ var _excluded = ["media", "mediaRef", "width", "height", "resolution", "objectFit", "playing", "muted", "shouldLoad", "videoLoop", "videoInitialMuted", "onLoaded", "className", "imageClassName", "videoClassName", "withoutVideo"];
15
15
  var propTypes = {
16
16
  media: PropTypes.media,
17
17
  mediaRef: PropTypes$1.oneOfType([PropTypes$1.func, PropTypes$1.shape({
@@ -26,6 +26,7 @@ var propTypes = {
26
26
  muted: PropTypes$1.bool,
27
27
  shouldLoad: PropTypes$1.bool,
28
28
  videoLoop: PropTypes$1.bool,
29
+ withoutVideo: PropTypes$1.bool,
29
30
  videoInitialMuted: PropTypes$1.bool,
30
31
  onLoaded: PropTypes$1.func,
31
32
  className: PropTypes$1.string,
@@ -43,6 +44,7 @@ var defaultProps = {
43
44
  muted: true,
44
45
  shouldLoad: true,
45
46
  videoLoop: true,
47
+ withoutVideo: false,
46
48
  videoInitialMuted: true,
47
49
  onLoaded: null,
48
50
  className: null,
@@ -66,6 +68,7 @@ var Visual = function Visual(_ref) {
66
68
  className = _ref.className,
67
69
  imageClassName = _ref.imageClassName,
68
70
  videoClassName = _ref.videoClassName,
71
+ withoutVideo = _ref.withoutVideo,
69
72
  props = _objectWithoutProperties(_ref, _excluded);
70
73
 
71
74
  var _ref2 = media || {},
@@ -83,12 +86,12 @@ var Visual = function Visual(_ref) {
83
86
  });
84
87
  }, [props, media]);
85
88
  var imageElProps = useMemo(function () {
86
- var tmpProps = !shouldLoad && isVideo ? _objectSpread(_objectSpread({}, elProps), {}, {
89
+ var tmpProps = (!shouldLoad || withoutVideo) && isVideo ? _objectSpread(_objectSpread({}, elProps), {}, {
87
90
  media: {
88
91
  url: thumbnailUrl
89
92
  }
90
93
  }) : elProps;
91
- return shouldLoad ? _objectSpread(_objectSpread({}, elProps), {}, {
94
+ return shouldLoad && !withoutVideo ? _objectSpread(_objectSpread({}, elProps), {}, {
92
95
  media: {
93
96
  url: url
94
97
  }
@@ -132,7 +135,7 @@ var Visual = function Visual(_ref) {
132
135
  onParentLoaded(e);
133
136
  }
134
137
  }, []);
135
- return type !== null ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 'image' || !shouldLoad ? /*#__PURE__*/React.createElement(Image, Object.assign({}, imageElProps, {
138
+ return type !== null ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 'image' || !shouldLoad || withoutVideo ? /*#__PURE__*/React.createElement(Image, Object.assign({}, imageElProps, {
136
139
  objectFit: objectFit,
137
140
  width: width,
138
141
  height: height,
@@ -141,7 +144,7 @@ var Visual = function Visual(_ref) {
141
144
  onLoaded: onLoaded,
142
145
  className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
143
146
  imageClassName: imageClassName
144
- })) : null, type === 'video' && shouldLoad ? /*#__PURE__*/React.createElement("div", {
147
+ })) : null, type === 'video' && shouldLoad && !withoutVideo ? /*#__PURE__*/React.createElement("div", {
145
148
  className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
146
149
  style: {
147
150
  width: width,
package/lib/index.js CHANGED
@@ -24,7 +24,7 @@ var Video__default = /*#__PURE__*/_interopDefaultLegacy(Video);
24
24
 
25
25
  var styles = {"container":"micromag-element-visual-container","videoContainer":"micromag-element-visual-videoContainer"};
26
26
 
27
- var _excluded = ["media", "mediaRef", "width", "height", "resolution", "objectFit", "playing", "muted", "shouldLoad", "videoLoop", "videoInitialMuted", "onLoaded", "className", "imageClassName", "videoClassName"];
27
+ var _excluded = ["media", "mediaRef", "width", "height", "resolution", "objectFit", "playing", "muted", "shouldLoad", "videoLoop", "videoInitialMuted", "onLoaded", "className", "imageClassName", "videoClassName", "withoutVideo"];
28
28
  var propTypes = {
29
29
  media: core.PropTypes.media,
30
30
  mediaRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
@@ -39,6 +39,7 @@ var propTypes = {
39
39
  muted: PropTypes__default["default"].bool,
40
40
  shouldLoad: PropTypes__default["default"].bool,
41
41
  videoLoop: PropTypes__default["default"].bool,
42
+ withoutVideo: PropTypes__default["default"].bool,
42
43
  videoInitialMuted: PropTypes__default["default"].bool,
43
44
  onLoaded: PropTypes__default["default"].func,
44
45
  className: PropTypes__default["default"].string,
@@ -56,6 +57,7 @@ var defaultProps = {
56
57
  muted: true,
57
58
  shouldLoad: true,
58
59
  videoLoop: true,
60
+ withoutVideo: false,
59
61
  videoInitialMuted: true,
60
62
  onLoaded: null,
61
63
  className: null,
@@ -79,6 +81,7 @@ var Visual = function Visual(_ref) {
79
81
  className = _ref.className,
80
82
  imageClassName = _ref.imageClassName,
81
83
  videoClassName = _ref.videoClassName,
84
+ withoutVideo = _ref.withoutVideo,
82
85
  props = _objectWithoutProperties__default["default"](_ref, _excluded);
83
86
 
84
87
  var _ref2 = media || {},
@@ -96,12 +99,12 @@ var Visual = function Visual(_ref) {
96
99
  });
97
100
  }, [props, media]);
98
101
  var imageElProps = React.useMemo(function () {
99
- var tmpProps = !shouldLoad && isVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
102
+ var tmpProps = (!shouldLoad || withoutVideo) && isVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
100
103
  media: {
101
104
  url: thumbnailUrl
102
105
  }
103
106
  }) : elProps;
104
- return shouldLoad ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
107
+ return shouldLoad && !withoutVideo ? _objectSpread__default["default"](_objectSpread__default["default"]({}, elProps), {}, {
105
108
  media: {
106
109
  url: url
107
110
  }
@@ -145,7 +148,7 @@ var Visual = function Visual(_ref) {
145
148
  onParentLoaded(e);
146
149
  }
147
150
  }, []);
148
- return type !== null ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'image' || !shouldLoad ? /*#__PURE__*/React__default["default"].createElement(Image__default["default"], Object.assign({}, imageElProps, {
151
+ return type !== null ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, type === 'image' || !shouldLoad || withoutVideo ? /*#__PURE__*/React__default["default"].createElement(Image__default["default"], Object.assign({}, imageElProps, {
149
152
  objectFit: objectFit,
150
153
  width: width,
151
154
  height: height,
@@ -154,7 +157,7 @@ var Visual = function Visual(_ref) {
154
157
  onLoaded: onLoaded,
155
158
  className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
156
159
  imageClassName: imageClassName
157
- })) : null, type === 'video' && shouldLoad ? /*#__PURE__*/React__default["default"].createElement("div", {
160
+ })) : null, type === 'video' && shouldLoad && !withoutVideo ? /*#__PURE__*/React__default["default"].createElement("div", {
158
161
  className: classNames__default["default"]([styles.container, _defineProperty__default["default"]({}, className, className !== null)]),
159
162
  style: {
160
163
  width: width,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-visual",
3
- "version": "0.3.251",
3
+ "version": "0.3.262",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,9 +50,9 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.13.10",
52
52
  "@folklore/size": "^0.1.20",
53
- "@micromag/core": "^0.3.251",
54
- "@micromag/element-image": "^0.3.251",
55
- "@micromag/element-video": "^0.3.251",
53
+ "@micromag/core": "^0.3.262",
54
+ "@micromag/element-image": "^0.3.262",
55
+ "@micromag/element-video": "^0.3.262",
56
56
  "classnames": "^2.2.6",
57
57
  "prop-types": "^15.7.2",
58
58
  "uuid": "^8.3.2"
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "3b6fb00baaa7f3ab90684a88cbe4c30929b6b27d"
63
+ "gitHead": "2299eaeb150cfdd14b4da321bf9089ab1e6383c2"
64
64
  }