@telefonica/mistica 12.6.0 → 12.7.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.
Files changed (59) hide show
  1. package/dist/carousel.js +5 -3
  2. package/dist/fixed-footer-layout.js +31 -9
  3. package/dist/generated/mistica-icons/icon-buy-data-light.js +5 -11
  4. package/dist/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  5. package/dist/generated/mistica-icons/icon-eco-light.js +1 -1
  6. package/dist/generated/mistica-icons/icon-justice-regular.js +1 -1
  7. package/dist/generated/mistica-icons/icon-tokens-filled.d.ts +4 -0
  8. package/dist/generated/mistica-icons/icon-tokens-filled.js +109 -0
  9. package/dist/generated/mistica-icons/icon-tokens-filled.js.flow +6 -0
  10. package/dist/generated/mistica-icons/icon-tokens-light.d.ts +4 -0
  11. package/dist/generated/mistica-icons/icon-tokens-light.js +109 -0
  12. package/dist/generated/mistica-icons/icon-tokens-light.js.flow +6 -0
  13. package/dist/generated/mistica-icons/icon-tokens-regular.d.ts +4 -0
  14. package/dist/generated/mistica-icons/icon-tokens-regular.js +109 -0
  15. package/dist/generated/mistica-icons/icon-tokens-regular.js.flow +6 -0
  16. package/dist/hooks.d.ts +3 -0
  17. package/dist/hooks.js +16 -3
  18. package/dist/hooks.js.flow +3 -0
  19. package/dist/image.d.ts +2 -0
  20. package/dist/image.js +118 -80
  21. package/dist/image.js.flow +2 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.js +21 -0
  24. package/dist/index.js.flow +3 -0
  25. package/dist/package-version.js +1 -1
  26. package/dist/skeletons.d.ts +5 -2
  27. package/dist/skeletons.js +50 -87
  28. package/dist/skeletons.js.flow +4 -4
  29. package/dist/skins/o2.js +1 -1
  30. package/dist/text-field-base.d.ts +0 -1
  31. package/dist/text-field-base.js +2 -0
  32. package/dist/text-field-base.js.flow +0 -1
  33. package/dist/text-field-components.d.ts +1 -0
  34. package/dist/text-field-components.js +7 -3
  35. package/dist/text-field-components.js.flow +1 -0
  36. package/dist/utils/aspect-ratio-support.d.ts +10 -0
  37. package/dist/utils/aspect-ratio-support.js +115 -1
  38. package/dist/utils/aspect-ratio-support.js.flow +14 -0
  39. package/dist/video.js +20 -79
  40. package/dist-es/carousel.js +5 -3
  41. package/dist-es/fixed-footer-layout.js +32 -10
  42. package/dist-es/generated/mistica-icons/icon-buy-data-light.js +6 -12
  43. package/dist-es/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  44. package/dist-es/generated/mistica-icons/icon-eco-light.js +1 -1
  45. package/dist-es/generated/mistica-icons/icon-justice-regular.js +1 -1
  46. package/dist-es/generated/mistica-icons/icon-tokens-filled.js +85 -0
  47. package/dist-es/generated/mistica-icons/icon-tokens-light.js +85 -0
  48. package/dist-es/generated/mistica-icons/icon-tokens-regular.js +85 -0
  49. package/dist-es/hooks.js +14 -2
  50. package/dist-es/image.js +115 -83
  51. package/dist-es/index.js +3 -0
  52. package/dist-es/package-version.js +1 -1
  53. package/dist-es/skeletons.js +50 -87
  54. package/dist-es/skins/o2.js +1 -1
  55. package/dist-es/text-field-base.js +2 -0
  56. package/dist-es/text-field-components.js +7 -3
  57. package/dist-es/utils/aspect-ratio-support.js +112 -0
  58. package/dist-es/video.js +21 -81
  59. package/package.json +1 -1
@@ -32,12 +32,13 @@ import * as React from "react";
32
32
  import SkeletonBase from "./skeleton-base";
33
33
  import { createUseStyles } from "./jss";
34
34
  import Stack from "./stack";
35
- import classNames from "classnames";
36
35
  import { getPrefixedDataAttributes } from "./utils/dom";
37
36
  var transition = "1.5s linear";
38
37
  var useAnimation = createUseStyles(function() {
39
38
  return {
40
39
  animation: {
40
+ width: "100%",
41
+ height: "100%",
41
42
  animation: "$pulse ".concat(transition, " infinite")
42
43
  },
43
44
  "@keyframes pulse": {
@@ -53,73 +54,50 @@ var useAnimation = createUseStyles(function() {
53
54
  }
54
55
  };
55
56
  });
56
- var useSkeletonStyles = createUseStyles(function() {
57
- return {
58
- wrap: {
59
- borderRadius: 8,
60
- height: function(param) {
61
- var _height = param.height, height = _height === void 0 ? 8 : _height;
62
- return height;
63
- },
64
- width: function(param) {
65
- var _width = param.width, width = _width === void 0 ? "100%" : _width;
66
- return width;
67
- }
68
- }
69
- };
70
- });
71
- export var SkeletonLine = function(param) {
72
- var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
57
+ var SkeletonAnimation = function(param) {
58
+ var children = param.children, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
73
59
  var animationClasses = useAnimation();
74
- var styleClass = useSkeletonStyles({
75
- width: width
76
- });
77
60
  return /*#__PURE__*/ _jsx("div", _objectSpread({
78
- className: "".concat(animationClasses.animation, " ").concat(styleClass.wrap),
61
+ className: animationClasses.animation,
79
62
  role: "status",
63
+ "aria-busy": true,
80
64
  "aria-hidden": ariaLabel === undefined,
81
- "aria-busy": ariaLabel !== undefined,
82
65
  "aria-label": ariaLabel
83
66
  }, getPrefixedDataAttributes(dataAttributes), {
84
- children: /*#__PURE__*/ _jsx(SkeletonBase, {})
67
+ children: children
68
+ }));
69
+ };
70
+ export var SkeletonLine = function(param) {
71
+ var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
72
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
73
+ ariaLabel: ariaLabel
74
+ }, getPrefixedDataAttributes(dataAttributes), {
75
+ children: /*#__PURE__*/ _jsx(SkeletonBase, {
76
+ width: width
77
+ })
85
78
  }));
86
79
  };
87
80
  export var SkeletonText = function(param) {
88
81
  var ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
89
- var animationClasses = useAnimation();
90
- var styleClass = useSkeletonStyles({
91
- height: "fit-content"
92
- });
93
- return /*#__PURE__*/ _jsxs(Stack, _objectSpread({
94
- className: "".concat(animationClasses.animation, " ").concat(styleClass.wrap),
95
- space: 16,
96
- role: "status",
97
- "aria-hidden": ariaLabel === undefined,
98
- "aria-busy": ariaLabel !== undefined,
99
- "aria-label": ariaLabel
82
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
83
+ ariaLabel: ariaLabel
100
84
  }, getPrefixedDataAttributes(dataAttributes), {
101
- children: [
102
- /*#__PURE__*/ _jsx(SkeletonBase, {}),
103
- /*#__PURE__*/ _jsx(SkeletonBase, {}),
104
- /*#__PURE__*/ _jsx(SkeletonBase, {
105
- width: "75%"
106
- })
107
- ]
85
+ children: /*#__PURE__*/ _jsxs(Stack, {
86
+ space: 16,
87
+ children: [
88
+ /*#__PURE__*/ _jsx(SkeletonBase, {}),
89
+ /*#__PURE__*/ _jsx(SkeletonBase, {}),
90
+ /*#__PURE__*/ _jsx(SkeletonBase, {
91
+ width: "75%"
92
+ })
93
+ ]
94
+ })
108
95
  }));
109
96
  };
110
97
  export var SkeletonCircle = function(param) {
111
98
  var ariaLabel = param.ariaLabel, _size = param.size, size = _size === void 0 ? 40 : _size, dataAttributes = param.dataAttributes;
112
- var animationClasses = useAnimation();
113
- var styleClass = useSkeletonStyles({
114
- width: size,
115
- height: size
116
- });
117
- return /*#__PURE__*/ _jsx("div", _objectSpread({
118
- className: classNames(animationClasses.animation, styleClass.wrap),
119
- role: "status",
120
- "aria-hidden": ariaLabel === undefined,
121
- "aria-busy": ariaLabel !== undefined,
122
- "aria-label": ariaLabel
99
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
100
+ ariaLabel: ariaLabel
123
101
  }, getPrefixedDataAttributes(dataAttributes), {
124
102
  children: /*#__PURE__*/ _jsx(SkeletonBase, {
125
103
  height: size,
@@ -147,46 +125,31 @@ var useSkeletonRowStyles = createUseStyles(function() {
147
125
  });
148
126
  export var SkeletonRow = function(param) {
149
127
  var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
150
- var animationClasses = useAnimation();
151
- var styleClass = useSkeletonStyles({
152
- width: width,
153
- height: "100%"
154
- });
155
128
  var rowClass = useSkeletonRowStyles();
156
- return /*#__PURE__*/ _jsxs("div", _objectSpread({
157
- className: classNames(animationClasses.animation, styleClass.wrap, rowClass.row),
158
- role: "status",
159
- "aria-hidden": ariaLabel === undefined,
160
- "aria-busy": ariaLabel !== undefined,
161
- "aria-label": ariaLabel
129
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
130
+ ariaLabel: ariaLabel
162
131
  }, getPrefixedDataAttributes(dataAttributes), {
163
- children: [
164
- /*#__PURE__*/ _jsx(SkeletonBase, {
165
- height: 40,
166
- width: 40,
167
- radius: "50%",
168
- className: rowClass.circle
169
- }),
170
- /*#__PURE__*/ _jsx(SkeletonBase, {
171
- width: width,
172
- className: rowClass.line
173
- })
174
- ]
132
+ children: /*#__PURE__*/ _jsxs("div", {
133
+ className: rowClass.row,
134
+ children: [
135
+ /*#__PURE__*/ _jsx(SkeletonBase, {
136
+ height: 40,
137
+ width: 40,
138
+ radius: "50%",
139
+ className: rowClass.circle
140
+ }),
141
+ /*#__PURE__*/ _jsx(SkeletonBase, {
142
+ width: width,
143
+ className: rowClass.line
144
+ })
145
+ ]
146
+ })
175
147
  }));
176
148
  };
177
149
  export var SkeletonRectangle = function(param) {
178
150
  var _width = param.width, width = _width === void 0 ? "100%" : _width, _height = param.height, height = _height === void 0 ? "100%" : _height, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
179
- var animationClasses = useAnimation();
180
- var styleClass = useSkeletonStyles({
181
- width: width,
182
- height: "100%"
183
- });
184
- return /*#__PURE__*/ _jsx("div", _objectSpread({
185
- className: classNames(animationClasses.animation, styleClass.wrap),
186
- role: "status",
187
- "aria-hidden": true,
188
- "aria-busy": true,
189
- "aria-label": ariaLabel
151
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
152
+ ariaLabel: ariaLabel
190
153
  }, getPrefixedDataAttributes(dataAttributes), {
191
154
  children: /*#__PURE__*/ _jsx(SkeletonBase, {
192
155
  height: height,
@@ -69,7 +69,7 @@ export var getO2Skin = function() {
69
69
  buttonDangerBackground: palette.pepper,
70
70
  buttonDangerBackgroundSelected: palette.pepper60,
71
71
  buttonDangerBackgroundHover: palette.pepper60,
72
- buttonLinkBackgroundSelected: palette.o2BluePrimary15,
72
+ buttonLinkBackgroundSelected: palette.o2BluePrimary10,
73
73
  buttonLinkBackgroundSelectedInverse: applyAlpha(palette.white, 0.2),
74
74
  buttonPrimaryBackground: palette.o2BluePrimary,
75
75
  buttonPrimaryBackgroundInverse: palette.white,
@@ -173,6 +173,7 @@ var useStyles = createUseStyles(function(theme) {
173
173
  },
174
174
  textArea: _objectSpread((_obj = {
175
175
  resize: "none",
176
+ padding: 0,
176
177
  marginTop: function(param) {
177
178
  var hasLabel = param.hasLabel;
178
179
  return hasLabel ? 28 : 16;
@@ -409,6 +410,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
409
410
  multiline: multiline,
410
411
  fullWidth: fullWidth,
411
412
  fieldRef: fieldRef,
413
+ readOnly: rest.readOnly,
412
414
  children: [
413
415
  startIcon && /*#__PURE__*/ _jsx("div", {
414
416
  className: classes.startIcon,
@@ -260,15 +260,19 @@ var useFieldContainerStyles = createUseStyles(function(theme) {
260
260
  var multiline = param.multiline;
261
261
  return multiline ? 152 : 56;
262
262
  }
263
- }), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor", theme.colors.backgroundContainer), _obj1)
263
+ }), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor", function(param) {
264
+ var readOnly = param.readOnly;
265
+ return readOnly ? theme.colors.neutralLow : theme.colors.backgroundContainer;
266
+ }), _obj1)
264
267
  };
265
268
  });
266
269
  export var FieldContainer = function(param) {
267
- var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth;
270
+ var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth, readOnly = param.readOnly;
268
271
  var classes = useFieldContainerStyles({
269
272
  multiline: multiline,
270
273
  fullWidth: fullWidth,
271
- disabled: disabled
274
+ disabled: disabled,
275
+ readOnly: readOnly
272
276
  });
273
277
  return /*#__PURE__*/ _jsxs("div", {
274
278
  className: classes.fieldContainer,
@@ -6,6 +6,19 @@ function _arrayLikeToArray(arr, len) {
6
6
  function _arrayWithHoles(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
+ function _defineProperty(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value: value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
19
+ }
20
+ return obj;
21
+ }
9
22
  function _iterableToArrayLimit(arr, i) {
10
23
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
24
  if (_i == null) return;
@@ -33,6 +46,21 @@ function _iterableToArrayLimit(arr, i) {
33
46
  function _nonIterableRest() {
34
47
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
48
  }
49
+ function _objectSpread(target) {
50
+ for(var i = 1; i < arguments.length; i++){
51
+ var source = arguments[i] != null ? arguments[i] : {};
52
+ var ownKeys = Object.keys(source);
53
+ if (typeof Object.getOwnPropertySymbols === "function") {
54
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
55
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
56
+ }));
57
+ }
58
+ ownKeys.forEach(function(key) {
59
+ _defineProperty(target, key, source[key]);
60
+ });
61
+ }
62
+ return target;
63
+ }
36
64
  function _slicedToArray(arr, i) {
37
65
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
38
66
  }
@@ -47,6 +75,7 @@ function _unsupportedIterableToArray(o, minLen) {
47
75
  import { jsx as _jsx } from "react/jsx-runtime";
48
76
  import * as React from "react";
49
77
  import { useIsomorphicLayoutEffect } from "../hooks";
78
+ import { createUseStyles } from "../jss";
50
79
  var AspectRatioSupport = /*#__PURE__*/ React.createContext(true);
51
80
  export var AspectRatioSupportProvider = function(param) {
52
81
  var children = param.children;
@@ -70,3 +99,86 @@ export var AspectRatioSupportProvider = function(param) {
70
99
  export var useSupportsAspectRatio = function() {
71
100
  return React.useContext(AspectRatioSupport);
72
101
  };
102
+ var useAspectRatioStyles = createUseStyles(function() {
103
+ return {
104
+ container: {
105
+ "@supports (aspect-ratio: 1 / 1)": {
106
+ aspectRatio: function(param) {
107
+ var aspectRatio = param.aspectRatio;
108
+ return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
109
+ }
110
+ },
111
+ "$wrapper &": {
112
+ position: function(param) {
113
+ var aspectRatio = param.aspectRatio;
114
+ return aspectRatio ? "absolute" : "static";
115
+ },
116
+ width: "100%",
117
+ height: "100%",
118
+ top: 0,
119
+ left: 0
120
+ }
121
+ },
122
+ wrapper: {
123
+ overflow: "hidden",
124
+ maxWidth: "100%",
125
+ maxHeight: "100%",
126
+ position: "relative",
127
+ paddingTop: function(param) {
128
+ var aspectRatio = param.aspectRatio, width = param.width;
129
+ if (!aspectRatio) {
130
+ return 0;
131
+ }
132
+ if (width && typeof width === "string" && width.endsWith("%")) {
133
+ return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
134
+ }
135
+ return "".concat(100 / aspectRatio, "%");
136
+ }
137
+ }
138
+ };
139
+ });
140
+ export var AspectRatioElement = function(props) {
141
+ var supportsAspectRatio = useSupportsAspectRatio();
142
+ // if width or height are numeric, we can calculate the other with the ratio without css.
143
+ // if aspect ratio is 0, we use the original image proportions
144
+ var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && props.aspectRatio !== 0;
145
+ var classes = useAspectRatioStyles({
146
+ aspectRatio: withCssAspectRatio ? props.aspectRatio : undefined,
147
+ width: props.width
148
+ });
149
+ var width = props.width;
150
+ var height = props.height;
151
+ if (props.width !== undefined && props.height !== undefined) {
152
+ width = props.width;
153
+ height = props.height;
154
+ } else if (typeof props.width === "number") {
155
+ height = props.aspectRatio !== 0 ? props.width / props.aspectRatio : undefined;
156
+ } else if (typeof props.height === "number") {
157
+ width = props.aspectRatio !== 0 ? props.height * props.aspectRatio : undefined;
158
+ } else {
159
+ width = props.width || "100%";
160
+ }
161
+ var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
162
+ var _as;
163
+ var container = /*#__PURE__*/ React.createElement((_as = props.as) !== null && _as !== void 0 ? _as : "div", {
164
+ className: props.className ? "".concat(props.className, " ").concat(classes.container) : classes.container,
165
+ style: _objectSpread({}, needsWrapper ? _objectSpread({}, props.style, {
166
+ width: "100%"
167
+ }) : _objectSpread({}, props.style, {
168
+ width: width,
169
+ height: height
170
+ }))
171
+ }, props.children);
172
+ if (needsWrapper) {
173
+ return /*#__PURE__*/ _jsx("div", {
174
+ style: {
175
+ width: width,
176
+ height: height
177
+ },
178
+ className: classes.wrapper,
179
+ children: container
180
+ });
181
+ } else {
182
+ return container;
183
+ }
184
+ };
package/dist-es/video.js CHANGED
@@ -57,7 +57,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
57
57
  import * as React from "react";
58
58
  import { useDisableBorderRadius } from "./image";
59
59
  import { createUseStyles } from "./jss";
60
- import { useSupportsAspectRatio } from "./utils/aspect-ratio-support";
60
+ import { AspectRatioElement } from "./utils/aspect-ratio-support";
61
61
  import { combineRefs } from "./utils/common";
62
62
  import { getPrefixedDataAttributes } from "./utils/dom";
63
63
  import { isRunningAcceptanceTest, isSafari } from "./utils/platform";
@@ -70,45 +70,13 @@ export var RATIO = {
70
70
  var useStyles = createUseStyles(function() {
71
71
  return {
72
72
  video: {
73
+ width: "100%",
74
+ height: "100%",
73
75
  background: "transparent",
74
76
  display: "block",
75
77
  objectFit: "cover",
76
78
  maxWidth: "100%",
77
- maxHeight: "100%",
78
- "@supports (aspect-ratio: 1 / 1)": {
79
- aspectRatio: function(param) {
80
- var aspectRatio = param.aspectRatio;
81
- return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
82
- }
83
- },
84
- "$wrapper &": {
85
- borderRadius: 0,
86
- position: function(param) {
87
- var aspectRatio = param.aspectRatio;
88
- return(// when aspectRatio is 0, we want the video to use the original aspect ratio
89
- aspectRatio ? "absolute" : "static");
90
- },
91
- width: "100%",
92
- height: "100%",
93
- top: 0,
94
- left: 0
95
- }
96
- },
97
- wrapper: {
98
- overflow: "hidden",
99
- maxWidth: "100%",
100
- maxHeight: "100%",
101
- position: "relative",
102
- paddingTop: function(param) {
103
- var aspectRatio = param.aspectRatio, width = param.width;
104
- if (!aspectRatio) {
105
- return 0;
106
- }
107
- if (width && typeof width === "string" && width.endsWith("%")) {
108
- return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
109
- }
110
- return "".concat(100 / aspectRatio, "%");
111
- }
79
+ maxHeight: "100%"
112
80
  }
113
81
  };
114
82
  });
@@ -124,16 +92,9 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
124
92
  "aspectRatio",
125
93
  "dataAttributes"
126
94
  ]);
127
- var supportsAspectRatio = useSupportsAspectRatio();
128
95
  var noBorderRadius = useDisableBorderRadius();
129
96
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
130
- // if width or height are numeric, we can calculate the other with the ratio without css
131
- // if aspect ratio is 0, we use the original video proportions
132
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
133
- var classes = useStyles({
134
- aspectRatio: withCssAspectRatio ? ratio : undefined,
135
- width: props.width
136
- });
97
+ var classes = useStyles();
137
98
  var videoRef = React.useRef(null);
138
99
  React.useEffect(function() {
139
100
  var video = videoRef.current;
@@ -155,23 +116,6 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
155
116
  return source;
156
117
  }
157
118
  });
158
- var width = props.width;
159
- var height = props.height;
160
- if (props.width !== undefined && props.height !== undefined) {
161
- width = props.width;
162
- height = props.height;
163
- } else if (typeof props.width === "number") {
164
- height = ratio ? props.width / ratio : undefined;
165
- } else if (typeof props.height === "number") {
166
- width = ratio ? props.height * ratio : undefined;
167
- } else {
168
- width = props.width || "100%";
169
- }
170
- /**
171
- * In safari, when using a video with poster, the transition from pause to play does a flicker,
172
- * To avoid this, in Safari browsers, instead of using the poster attribute, we use a
173
- * wrapper with the poster as background image
174
- */ var needsWrapper = isSafari() || withCssAspectRatio && !supportsAspectRatio;
175
119
  var video1 = /*#__PURE__*/ _jsx("video", _objectSpread({
176
120
  ref: combineRefs(ref, videoRef),
177
121
  playsInline: true,
@@ -179,13 +123,7 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
179
123
  disableRemotePlayback: true,
180
124
  autoPlay: autoPlay,
181
125
  muted: muted,
182
- loop: loop
183
- }, needsWrapper ? {
184
- width: "100%"
185
- } : {
186
- width: width,
187
- height: height
188
- }, {
126
+ loop: loop,
189
127
  className: classes.video,
190
128
  preload: preload,
191
129
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
@@ -203,22 +141,24 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
203
141
  }, index);
204
142
  })
205
143
  }));
206
- if (needsWrapper) {
207
- return /*#__PURE__*/ _jsx("div", {
144
+ return /*#__PURE__*/ _jsx(AspectRatioElement, {
145
+ aspectRatio: ratio,
146
+ width: props.width,
147
+ height: props.height,
148
+ children: isSafari() ? /*#__PURE__*/ _jsx("div", {
208
149
  style: {
209
- width: width,
210
- height: height,
211
- // adding the poster as background image avoids the flicker in Safari
212
- backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
150
+ width: "100%",
151
+ height: "100%",
152
+ /**
153
+ * In safari, when using a video with poster, the transition from pause to play does a flicker,
154
+ * To avoid this, in Safari browsers, instead of using the poster attribute, we use a
155
+ * wrapper with the poster as background image
156
+ */ backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
213
157
  backgroundSize: "cover",
214
- backgroundPosition: "50% 50%",
215
- borderRadius: noBorderRadius ? 0 : 8
158
+ backgroundPosition: "50% 50%"
216
159
  },
217
- className: classes.wrapper,
218
160
  children: video1
219
- });
220
- } else {
221
- return video1;
222
- }
161
+ }) : video1
162
+ });
223
163
  });
224
164
  export default Video;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "12.6.0",
3
+ "version": "12.7.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",