@telefonica/mistica 12.6.0 → 12.8.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/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +23 -6
- package/dist/carousel.js.flow +2 -0
- package/dist/fixed-footer-layout.js +31 -9
- package/dist/generated/mistica-icons/icon-buy-data-light.js +5 -11
- package/dist/generated/mistica-icons/icon-buy-data-regular.js +1 -1
- package/dist/generated/mistica-icons/icon-eco-light.js +1 -1
- package/dist/generated/mistica-icons/icon-justice-regular.js +1 -1
- package/dist/generated/mistica-icons/icon-tokens-filled.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-filled.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-filled.js.flow +6 -0
- package/dist/generated/mistica-icons/icon-tokens-light.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-light.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-light.js.flow +6 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.d.ts +4 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.js +109 -0
- package/dist/generated/mistica-icons/icon-tokens-regular.js.flow +6 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +16 -3
- package/dist/hooks.js.flow +3 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +118 -80
- package/dist/image.js.flow +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/index.js.flow +3 -0
- package/dist/list.d.ts +1 -0
- package/dist/list.js +4 -2
- package/dist/list.js.flow +1 -0
- package/dist/package-version.js +1 -1
- package/dist/skeletons.d.ts +5 -2
- package/dist/skeletons.js +50 -87
- package/dist/skeletons.js.flow +4 -4
- package/dist/skins/o2.js +1 -1
- package/dist/text-field-base.d.ts +0 -1
- package/dist/text-field-base.js +2 -0
- package/dist/text-field-base.js.flow +0 -1
- package/dist/text-field-components.d.ts +1 -0
- package/dist/text-field-components.js +7 -3
- package/dist/text-field-components.js.flow +1 -0
- package/dist/utils/aspect-ratio-support.d.ts +10 -0
- package/dist/utils/aspect-ratio-support.js +115 -1
- package/dist/utils/aspect-ratio-support.js.flow +14 -0
- package/dist/video.js +20 -79
- package/dist-es/carousel.js +23 -6
- package/dist-es/fixed-footer-layout.js +32 -10
- package/dist-es/generated/mistica-icons/icon-buy-data-light.js +6 -12
- package/dist-es/generated/mistica-icons/icon-buy-data-regular.js +1 -1
- package/dist-es/generated/mistica-icons/icon-eco-light.js +1 -1
- package/dist-es/generated/mistica-icons/icon-justice-regular.js +1 -1
- package/dist-es/generated/mistica-icons/icon-tokens-filled.js +85 -0
- package/dist-es/generated/mistica-icons/icon-tokens-light.js +85 -0
- package/dist-es/generated/mistica-icons/icon-tokens-regular.js +85 -0
- package/dist-es/hooks.js +14 -2
- package/dist-es/image.js +115 -83
- package/dist-es/index.js +3 -0
- package/dist-es/list.js +4 -2
- package/dist-es/package-version.js +1 -1
- package/dist-es/skeletons.js +50 -87
- package/dist-es/skins/o2.js +1 -1
- package/dist-es/text-field-base.js +2 -0
- package/dist-es/text-field-components.js +7 -3
- package/dist-es/utils/aspect-ratio-support.js +112 -0
- package/dist-es/video.js +21 -81
- package/package.json +1 -1
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
207
|
-
|
|
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:
|
|
210
|
-
height:
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
}
|
|
221
|
-
return video1;
|
|
222
|
-
}
|
|
161
|
+
}) : video1
|
|
162
|
+
});
|
|
223
163
|
});
|
|
224
164
|
export default Video;
|