@telefonica/mistica 10.25.0 → 10.28.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 +34 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +20 -5
- package/dist/button.js.flow +2 -0
- package/dist/callout.js +37 -26
- package/dist/carousel.js +16 -4
- package/dist/hooks.d.ts +7 -0
- package/dist/hooks.js +30 -1
- package/dist/hooks.js.flow +11 -0
- package/dist/image.d.ts +3 -0
- package/dist/image.js +35 -4
- package/dist/image.js.flow +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -0
- package/dist/index.js.flow +2 -0
- package/dist/package-version.js +1 -1
- package/dist/popover.js +5 -4
- package/dist/skins/blau.js +0 -2
- package/dist/skins/o2-classic.js +0 -4
- package/dist/skins/o2.js +0 -4
- package/dist/skins/telefonica.js +1 -5
- package/dist/skins/vivo.js +0 -4
- package/dist/tag.d.ts +2 -1
- package/dist/tag.js +33 -3
- package/dist/tag.js.flow +2 -1
- package/dist/text-link.d.ts +1 -0
- package/dist/text-link.js +8 -0
- package/dist/text-link.js.flow +1 -0
- package/dist/text.d.ts +2 -0
- package/dist/text.js +4 -3
- package/dist/text.js.flow +2 -0
- package/dist/theme-context-provider.js +8 -5
- package/dist/utils/analytics.d.ts +6 -0
- package/dist/utils/analytics.js +13 -0
- package/dist/utils/analytics.js.flow +8 -0
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/common.js +11 -1
- package/dist/utils/common.js.flow +1 -0
- package/dist/utils/document-visibility.d.ts +8 -0
- package/dist/utils/document-visibility.js +121 -0
- package/dist/utils/document-visibility.js.flow +10 -0
- package/dist/video.d.ts +2 -0
- package/dist/video.js +37 -5
- package/dist/video.js.flow +2 -0
- package/dist-es/button.js +20 -5
- package/dist-es/callout.js +38 -27
- package/dist-es/carousel.js +17 -5
- package/dist-es/hooks.js +28 -0
- package/dist-es/image.js +34 -4
- package/dist-es/index.js +2 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/popover.js +5 -4
- package/dist-es/skins/blau.js +0 -2
- package/dist-es/skins/o2-classic.js +0 -4
- package/dist-es/skins/o2.js +0 -4
- package/dist-es/skins/telefonica.js +1 -5
- package/dist-es/skins/vivo.js +0 -4
- package/dist-es/tag.js +32 -3
- package/dist-es/text-link.js +8 -0
- package/dist-es/text.js +4 -3
- package/dist-es/theme-context-provider.js +8 -5
- package/dist-es/utils/analytics.js +6 -0
- package/dist-es/utils/common.js +9 -0
- package/dist-es/utils/document-visibility.js +93 -0
- package/dist-es/video.js +36 -5
- package/package.json +3 -1
package/dist-es/utils/common.js
CHANGED
|
@@ -16,3 +16,12 @@ export var combineRefs = function() {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
+
export var getTextFromChildren = function(children) {
|
|
20
|
+
var text = '';
|
|
21
|
+
React.Children.forEach(children, function(child) {
|
|
22
|
+
if (typeof child === 'string') {
|
|
23
|
+
text += child;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return text;
|
|
27
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useTheme } from '../hooks';
|
|
4
|
+
import { isAndroid } from './platform';
|
|
5
|
+
function _arrayLikeToArray(arr, len) {
|
|
6
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
8
|
+
return arr2;
|
|
9
|
+
}
|
|
10
|
+
function _arrayWithHoles(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return arr;
|
|
12
|
+
}
|
|
13
|
+
function _iterableToArrayLimit(arr, i) {
|
|
14
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
15
|
+
if (_i == null) return;
|
|
16
|
+
var _arr = [];
|
|
17
|
+
var _n = true;
|
|
18
|
+
var _d = false;
|
|
19
|
+
var _s, _e;
|
|
20
|
+
try {
|
|
21
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
22
|
+
_arr.push(_s.value);
|
|
23
|
+
if (i && _arr.length === i) break;
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
_d = true;
|
|
27
|
+
_e = err;
|
|
28
|
+
} finally{
|
|
29
|
+
try {
|
|
30
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
31
|
+
} finally{
|
|
32
|
+
if (_d) throw _e;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return _arr;
|
|
36
|
+
}
|
|
37
|
+
function _nonIterableRest() {
|
|
38
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39
|
+
}
|
|
40
|
+
function _slicedToArray(arr, i) {
|
|
41
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
42
|
+
}
|
|
43
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
44
|
+
if (!o) return;
|
|
45
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
46
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
47
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
48
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
49
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
50
|
+
}
|
|
51
|
+
var isDocumentVisible = function() {
|
|
52
|
+
return typeof document !== 'undefined' && document.visibilityState === 'visible';
|
|
53
|
+
};
|
|
54
|
+
var DocumentVisibilityContext = /*#__PURE__*/ React.createContext(true);
|
|
55
|
+
export var DocumentVisibilityProvider = function(param) {
|
|
56
|
+
var hidden = param.hidden, children = param.children;
|
|
57
|
+
var platformOverrides = useTheme().platformOverrides;
|
|
58
|
+
var ref = _slicedToArray(React.useState(!hidden), 2), visible = ref[0], setVisible = ref[1];
|
|
59
|
+
React.useEffect(function() {
|
|
60
|
+
var visibilitychangeCallback = function() {
|
|
61
|
+
setVisible(isDocumentVisible());
|
|
62
|
+
};
|
|
63
|
+
var focusCallback = function() {
|
|
64
|
+
setVisible(true);
|
|
65
|
+
};
|
|
66
|
+
var blurCallback = function() {
|
|
67
|
+
setVisible(false);
|
|
68
|
+
};
|
|
69
|
+
setVisible(isDocumentVisible());
|
|
70
|
+
document.addEventListener('visibilitychange', visibilitychangeCallback);
|
|
71
|
+
document.addEventListener('focus', focusCallback);
|
|
72
|
+
document.addEventListener('blur', blurCallback);
|
|
73
|
+
return function() {
|
|
74
|
+
document.removeEventListener('visibilitychange', visibilitychangeCallback);
|
|
75
|
+
document.removeEventListener('focus', focusCallback);
|
|
76
|
+
document.removeEventListener('blur', blurCallback);
|
|
77
|
+
};
|
|
78
|
+
}, []);
|
|
79
|
+
// Workaround for this bug: https://jira.tuenti.io/jira/browse/ACCOUNT-10938
|
|
80
|
+
// In Android, after ~10 minutes of inactivity, when a background webview receives focus (back navigation from another webview),
|
|
81
|
+
// visibility change event is not fired, this causes problems like the navigation bar not being updated
|
|
82
|
+
var isVisibleNow = isDocumentVisible();
|
|
83
|
+
if (isAndroid(platformOverrides) && isVisibleNow !== visible) {
|
|
84
|
+
setVisible(isVisibleNow);
|
|
85
|
+
}
|
|
86
|
+
return(/*#__PURE__*/ _jsx(DocumentVisibilityContext.Provider, {
|
|
87
|
+
value: visible,
|
|
88
|
+
children: children
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
export var useDocumentVisibility = function() {
|
|
92
|
+
return React.useContext(DocumentVisibilityContext);
|
|
93
|
+
};
|
package/dist-es/video.js
CHANGED
|
@@ -3,6 +3,35 @@ import * as React from 'react';
|
|
|
3
3
|
import { useDisableBorderRadius } from './image';
|
|
4
4
|
import { createUseStyles } from './jss';
|
|
5
5
|
import { combineRefs } from './utils/common';
|
|
6
|
+
import { getPrefixedDataAttributes } from './utils/dom';
|
|
7
|
+
function _defineProperty(obj, key, value) {
|
|
8
|
+
if (key in obj) {
|
|
9
|
+
Object.defineProperty(obj, key, {
|
|
10
|
+
value: value,
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
obj[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
function _objectSpread(target) {
|
|
21
|
+
for(var i = 1; i < arguments.length; i++){
|
|
22
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
23
|
+
var ownKeys = Object.keys(source);
|
|
24
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
25
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
26
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
ownKeys.forEach(function(key) {
|
|
30
|
+
_defineProperty(target, key, source[key]);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
6
35
|
function _objectWithoutProperties(source, excluded) {
|
|
7
36
|
if (source == null) return {};
|
|
8
37
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -56,14 +85,15 @@ var useStyles = createUseStyles(function() {
|
|
|
56
85
|
});
|
|
57
86
|
/** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC';
|
|
58
87
|
var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
59
|
-
var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, props = _objectWithoutProperties(_param, [
|
|
88
|
+
var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? 'none' : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
|
|
60
89
|
"src",
|
|
61
90
|
"poster",
|
|
62
91
|
"autoPlay",
|
|
63
92
|
"muted",
|
|
64
93
|
"loop",
|
|
65
94
|
"preload",
|
|
66
|
-
"aspectRatio"
|
|
95
|
+
"aspectRatio",
|
|
96
|
+
"dataAttributes"
|
|
67
97
|
]);
|
|
68
98
|
var noBorderRadius = useDisableBorderRadius();
|
|
69
99
|
var classes = useStyles({
|
|
@@ -103,7 +133,7 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
103
133
|
} else {
|
|
104
134
|
width = '100%';
|
|
105
135
|
}
|
|
106
|
-
return(/*#__PURE__*/ _jsx("video", {
|
|
136
|
+
return(/*#__PURE__*/ _jsx("video", _objectSpread({
|
|
107
137
|
ref: combineRefs(ref, videoRef),
|
|
108
138
|
playsInline: true,
|
|
109
139
|
disablePictureInPicture: true,
|
|
@@ -116,7 +146,8 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
116
146
|
className: classes.video,
|
|
117
147
|
preload: preload,
|
|
118
148
|
// This transparent pixel fallback avoids showing the ugly "play" image in android webviews
|
|
119
|
-
poster: poster || TRANSPARENT_PIXEL
|
|
149
|
+
poster: poster || TRANSPARENT_PIXEL
|
|
150
|
+
}, getPrefixedDataAttributes(dataAttributes), {
|
|
120
151
|
children: sources.map(function(param, index) {
|
|
121
152
|
var src = param.src, type = param.type;
|
|
122
153
|
/*#__PURE__*/ return _jsx("source", {
|
|
@@ -124,6 +155,6 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
124
155
|
type: type
|
|
125
156
|
}, index);
|
|
126
157
|
})
|
|
127
|
-
}));
|
|
158
|
+
})));
|
|
128
159
|
});
|
|
129
160
|
export default Video;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/mistica",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.28.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"lint": "eslint --report-unused-disable-directives .",
|
|
22
22
|
"ts-check": "tsc --project tsconfig.json --noEmit",
|
|
23
23
|
"build": "yarn clean && node scripts/build.js",
|
|
24
|
+
"compile": "node scripts/compile.js",
|
|
24
25
|
"clean": "rimraf dist && rimraf dist-es && rimraf dist-ts && rimraf node_modules/.cache",
|
|
25
26
|
"ci": "yarn lint && yarn prettier-check && yarn ts-check && yarn circular-dependencies && yarn build && yarn storybook-static && yarn test --ci && yarn test-acceptance --ci",
|
|
26
27
|
"prepublishOnly": "node scripts/prepublish-only.js",
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
"node-fetch": "^2.6.1",
|
|
109
110
|
"playroom": "^0.27.9",
|
|
110
111
|
"prettier": "^2.5.1",
|
|
112
|
+
"pretty-bytes": "^5.6.0",
|
|
111
113
|
"prop-types": "^15.7.2",
|
|
112
114
|
"react": "17.0.2",
|
|
113
115
|
"react-dom": "17.0.2",
|