@telefonica/mistica 10.26.0 → 10.28.1
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 +39 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +20 -5
- package/dist/button.js.flow +2 -0
- package/dist/carousel.js +30 -5
- package/dist/fixed-footer-layout.js +1 -1
- 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 +8 -7
- package/dist/select.js +1 -0
- 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/carousel.js +31 -6
- package/dist-es/fixed-footer-layout.js +1 -1
- 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 +8 -7
- package/dist-es/select.js +1 -0
- 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/button.js
CHANGED
|
@@ -9,6 +9,8 @@ import { useForm } from './form-context';
|
|
|
9
9
|
import { pxToRem } from './utils/css';
|
|
10
10
|
import { Text, Text2, Text3 } from './text';
|
|
11
11
|
import Box from './box';
|
|
12
|
+
import { getTextFromChildren } from './utils/common';
|
|
13
|
+
import { eventActions, eventCategories } from './utils/analytics';
|
|
12
14
|
function _arrayLikeToArray(arr, len) {
|
|
13
15
|
if (len == null || len > arr.length) len = arr.length;
|
|
14
16
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -308,13 +310,18 @@ var Button = function(props) {
|
|
|
308
310
|
children: text
|
|
309
311
|
});
|
|
310
312
|
};
|
|
313
|
+
var _trackingEvent;
|
|
311
314
|
var _obj;
|
|
312
315
|
var commonProps = {
|
|
313
316
|
className: classnames(classes.button, props.className, (_obj = {}, _defineProperty(_obj, classes.small, props.small), _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.light, !isInverse), _defineProperty(_obj, classes.isLoading, showSpinner), _obj)),
|
|
314
317
|
style: _objectSpread({
|
|
315
318
|
cursor: props.fake ? 'pointer' : undefined
|
|
316
319
|
}, props.style),
|
|
317
|
-
trackingEvent: props.trackingEvent
|
|
320
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
|
|
321
|
+
category: eventCategories.userInteraction,
|
|
322
|
+
action: "".concat(props.type, "_button_tapped"),
|
|
323
|
+
label: getTextFromChildren(props.children)
|
|
324
|
+
} : undefined,
|
|
318
325
|
dataAttributes: props.dataAttributes,
|
|
319
326
|
'aria-controls': props['aria-controls'],
|
|
320
327
|
'aria-expanded': props['aria-expanded'],
|
|
@@ -453,10 +460,15 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
|
|
|
453
460
|
export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
454
461
|
var classes = useButtonLinkStyles();
|
|
455
462
|
var isInverse = useIsInverseVariant();
|
|
463
|
+
var _trackingEvent;
|
|
456
464
|
var _obj;
|
|
457
465
|
var commonProps = {
|
|
458
466
|
className: classnames(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
|
|
459
|
-
trackingEvent: props.trackingEvent
|
|
467
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
|
|
468
|
+
category: eventCategories.userInteraction,
|
|
469
|
+
action: eventActions.linkTapped,
|
|
470
|
+
label: getTextFromChildren(props.children)
|
|
471
|
+
} : undefined,
|
|
460
472
|
dataAttributes: props.dataAttributes,
|
|
461
473
|
children: /*#__PURE__*/ _jsx(Text2, {
|
|
462
474
|
medium: true,
|
|
@@ -502,18 +514,21 @@ export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
502
514
|
export var ButtonPrimary = function(props) {
|
|
503
515
|
var classes = usePrimaryButtonStyles();
|
|
504
516
|
return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
|
|
505
|
-
classes: classes
|
|
517
|
+
classes: classes,
|
|
518
|
+
type: "primary"
|
|
506
519
|
})));
|
|
507
520
|
};
|
|
508
521
|
export var ButtonSecondary = function(props) {
|
|
509
522
|
var classes = useSecondaryButtonStyles();
|
|
510
523
|
return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
|
|
511
|
-
classes: classes
|
|
524
|
+
classes: classes,
|
|
525
|
+
type: "secondary"
|
|
512
526
|
})));
|
|
513
527
|
};
|
|
514
528
|
export var ButtonDanger = function(props) {
|
|
515
529
|
var classes = useDangerButtonStyles();
|
|
516
530
|
return(/*#__PURE__*/ _jsx(Button, _objectSpread({}, props, {
|
|
517
|
-
classes: classes
|
|
531
|
+
classes: classes,
|
|
532
|
+
type: "danger"
|
|
518
533
|
})));
|
|
519
534
|
};
|
package/dist-es/carousel.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import IconChevronLeftRegular from './generated/mistica-icons/icon-chevron-left-regular';
|
|
4
4
|
import IconChevronRightRegular from './generated/mistica-icons/icon-chevron-right-regular';
|
|
5
|
-
import { useScreenSize, useTheme } from './hooks';
|
|
5
|
+
import { useIsInViewport, useScreenSize, useTheme } from './hooks';
|
|
6
6
|
import Inline from './inline';
|
|
7
7
|
import { createUseStyles } from './jss';
|
|
8
8
|
import Stack from './stack';
|
|
@@ -13,6 +13,8 @@ import { useIsInverseVariant, ThemeVariant } from './theme-variant-context';
|
|
|
13
13
|
import { applyAlpha } from './utils/color';
|
|
14
14
|
import { DisableBorderRadiusProvider } from './image';
|
|
15
15
|
import { getPrefixedDataAttributes, listenResize } from './utils/dom';
|
|
16
|
+
import { isAndroid } from './utils/platform';
|
|
17
|
+
import { useDocumentVisibility } from './utils/document-visibility';
|
|
16
18
|
function _arrayLikeToArray(arr, len) {
|
|
17
19
|
if (len == null || len > arr.length) len = arr.length;
|
|
18
20
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -99,6 +101,11 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
99
101
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
100
102
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
101
103
|
}
|
|
104
|
+
var useShouldAutoplay = function(autoplay, ref) {
|
|
105
|
+
var isDocumentVisible = useDocumentVisibility();
|
|
106
|
+
var isInViewport = useIsInViewport(ref, false);
|
|
107
|
+
return isInViewport && isDocumentVisible && !!autoplay;
|
|
108
|
+
};
|
|
102
109
|
var useBulletsStyles = createUseStyles(function(theme) {
|
|
103
110
|
return {
|
|
104
111
|
bullet: _defineProperty({
|
|
@@ -235,6 +242,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
235
242
|
}
|
|
236
243
|
})),
|
|
237
244
|
item: (_obj2 = {
|
|
245
|
+
scrollSnapStop: isAndroid(theme.platformOverrides) ? 'always' : 'normal',
|
|
238
246
|
scrollSnapAlign: 'start',
|
|
239
247
|
flexShrink: 0,
|
|
240
248
|
width: function(param) {
|
|
@@ -415,12 +423,24 @@ var BaseCarousel = function(param) {
|
|
|
415
423
|
};
|
|
416
424
|
var calcItemScrollPositions = function() {
|
|
417
425
|
var maxScroll = carouselEl.scrollWidth - carouselEl.clientWidth;
|
|
426
|
+
var getItemScrollMargin = function(itemIndex) {
|
|
427
|
+
if (centered) {
|
|
428
|
+
return 0;
|
|
429
|
+
}
|
|
430
|
+
if (itemIndex === 0) {
|
|
431
|
+
return 0;
|
|
432
|
+
}
|
|
433
|
+
if (isDesktopOrBigger) {
|
|
434
|
+
return -gap;
|
|
435
|
+
}
|
|
436
|
+
return mobilePageOffsetConfig.prev;
|
|
437
|
+
};
|
|
418
438
|
setItemScrollPositions(Array.from(carouselEl.querySelectorAll('[data-item]')).map(function(itemEl, idx) {
|
|
419
439
|
if (idx === items.length - 1) {
|
|
420
440
|
return maxScroll;
|
|
421
441
|
}
|
|
422
442
|
var offsetLeft = itemEl.offsetLeft;
|
|
423
|
-
var scrollMargin =
|
|
443
|
+
var scrollMargin = getItemScrollMargin(idx);
|
|
424
444
|
var scrollPosition = centered && !isDesktopOrBigger ? offsetLeft - itemEl.clientWidth / 2 : offsetLeft;
|
|
425
445
|
return Math.min(scrollPosition - scrollMargin - carouselEl.offsetLeft, maxScroll);
|
|
426
446
|
}));
|
|
@@ -492,8 +512,9 @@ var BaseCarousel = function(param) {
|
|
|
492
512
|
}, [
|
|
493
513
|
scrollPositions
|
|
494
514
|
]);
|
|
515
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
495
516
|
React.useEffect(function() {
|
|
496
|
-
if (autoplay) {
|
|
517
|
+
if (shouldAutoplay && autoplay) {
|
|
497
518
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
498
519
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
499
520
|
var interval = setInterval(function() {
|
|
@@ -514,7 +535,8 @@ var BaseCarousel = function(param) {
|
|
|
514
535
|
}, [
|
|
515
536
|
autoplay,
|
|
516
537
|
goNext,
|
|
517
|
-
scrollRight1
|
|
538
|
+
scrollRight1,
|
|
539
|
+
shouldAutoplay
|
|
518
540
|
]);
|
|
519
541
|
var currentPageIndex = calcCurrentPageIndex(scrollLeft1, pagesScrollPositions);
|
|
520
542
|
React.useEffect(function() {
|
|
@@ -637,6 +659,7 @@ var useSlideshowStyles = createUseStyles(function(theme) {
|
|
|
637
659
|
})),
|
|
638
660
|
item: {
|
|
639
661
|
width: '100%',
|
|
662
|
+
scrollSnapStop: isAndroid(theme.platformOverrides) ? 'always' : 'normal',
|
|
640
663
|
scrollSnapAlign: 'start',
|
|
641
664
|
flexShrink: 0
|
|
642
665
|
},
|
|
@@ -721,8 +744,9 @@ export var Slideshow = function(param) {
|
|
|
721
744
|
}, [
|
|
722
745
|
items.length
|
|
723
746
|
]);
|
|
747
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
724
748
|
React.useEffect(function() {
|
|
725
|
-
if (autoplay) {
|
|
749
|
+
if (shouldAutoplay && autoplay) {
|
|
726
750
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
727
751
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
728
752
|
var interval = setInterval(function() {
|
|
@@ -743,7 +767,8 @@ export var Slideshow = function(param) {
|
|
|
743
767
|
}, [
|
|
744
768
|
autoplay,
|
|
745
769
|
goNext,
|
|
746
|
-
scrollRight2
|
|
770
|
+
scrollRight2,
|
|
771
|
+
shouldAutoplay
|
|
747
772
|
]);
|
|
748
773
|
React.useEffect(function() {
|
|
749
774
|
if (onPageChange) {
|
package/dist-es/hooks.js
CHANGED
|
@@ -180,3 +180,31 @@ export var useWindowWidth = function() {
|
|
|
180
180
|
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
181
181
|
// useLayoutEffect in the browser
|
|
182
182
|
export var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
183
|
+
export var useIsInViewport = function(ref, defaultValue, options) {
|
|
184
|
+
var ref7 = _slicedToArray(React.useState(defaultValue), 2), isInViewport = ref7[0], setIsInViewport = ref7[1];
|
|
185
|
+
React.useEffect(function() {
|
|
186
|
+
if (!ref.current) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (typeof window.IntersectionObserver === 'undefined') {
|
|
190
|
+
return function() {};
|
|
191
|
+
}
|
|
192
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
193
|
+
setIsInViewport(entries[0].isIntersecting);
|
|
194
|
+
}, {
|
|
195
|
+
root: options === null || options === void 0 ? void 0 : options.root,
|
|
196
|
+
rootMargin: options === null || options === void 0 ? void 0 : options.rootMargin,
|
|
197
|
+
threshold: options === null || options === void 0 ? void 0 : options.threshold
|
|
198
|
+
});
|
|
199
|
+
observer.observe(ref.current);
|
|
200
|
+
return function() {
|
|
201
|
+
observer.disconnect();
|
|
202
|
+
};
|
|
203
|
+
}, [
|
|
204
|
+
ref,
|
|
205
|
+
options === null || options === void 0 ? void 0 : options.root,
|
|
206
|
+
options === null || options === void 0 ? void 0 : options.rootMargin,
|
|
207
|
+
options === null || options === void 0 ? void 0 : options.threshold
|
|
208
|
+
]);
|
|
209
|
+
return isInViewport;
|
|
210
|
+
};
|
package/dist-es/image.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { createUseStyles } from './jss';
|
|
4
|
+
import { getPrefixedDataAttributes } from './utils/dom';
|
|
5
|
+
function _defineProperty(obj, key, value) {
|
|
6
|
+
if (key in obj) {
|
|
7
|
+
Object.defineProperty(obj, key, {
|
|
8
|
+
value: value,
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true
|
|
12
|
+
});
|
|
13
|
+
} else {
|
|
14
|
+
obj[key] = value;
|
|
15
|
+
}
|
|
16
|
+
return obj;
|
|
17
|
+
}
|
|
18
|
+
function _objectSpread(target) {
|
|
19
|
+
for(var i = 1; i < arguments.length; i++){
|
|
20
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
21
|
+
var ownKeys = Object.keys(source);
|
|
22
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
23
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
24
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
ownKeys.forEach(function(key) {
|
|
28
|
+
_defineProperty(target, key, source[key]);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
4
33
|
function _objectWithoutProperties(source, excluded) {
|
|
5
34
|
if (source == null) return {};
|
|
6
35
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -67,9 +96,10 @@ export var RATIO = {
|
|
|
67
96
|
'4:3': 4 / 3
|
|
68
97
|
};
|
|
69
98
|
var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
70
|
-
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
|
|
99
|
+
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
|
|
71
100
|
"aspectRatio",
|
|
72
|
-
"alt"
|
|
101
|
+
"alt",
|
|
102
|
+
"dataAttributes"
|
|
73
103
|
]);
|
|
74
104
|
var noBorderRadius = useDisableBorderRadius();
|
|
75
105
|
var classes = useStyles({
|
|
@@ -89,13 +119,13 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
89
119
|
} else {
|
|
90
120
|
width = '100%';
|
|
91
121
|
}
|
|
92
|
-
return(/*#__PURE__*/ _jsx("img", {
|
|
122
|
+
return(/*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
|
|
93
123
|
ref: ref,
|
|
94
124
|
src: url,
|
|
95
125
|
className: classes.image,
|
|
96
126
|
alt: alt,
|
|
97
127
|
width: width,
|
|
98
128
|
height: height
|
|
99
|
-
}));
|
|
129
|
+
})));
|
|
100
130
|
});
|
|
101
131
|
export default Image;
|
package/dist-es/index.js
CHANGED
|
@@ -91,7 +91,8 @@ export { default as IconError } from './icons/icon-error';
|
|
|
91
91
|
export { default as IconSuccess } from './icons/icon-success';
|
|
92
92
|
export { default as IconSuccessVivo } from './icons/icon-success-vivo';
|
|
93
93
|
export { default as Circle } from './circle';
|
|
94
|
-
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth } from './hooks';
|
|
94
|
+
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport } from './hooks';
|
|
95
|
+
export { useDocumentVisibility } from './utils/document-visibility';
|
|
95
96
|
export { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
|
|
96
97
|
export { VIVO_SKIN, O2_CLASSIC_SKIN, O2_SKIN, MOVISTAR_SKIN, TELEFONICA_SKIN, BLAU_SKIN } from './skins/constants';
|
|
97
98
|
export { getSkinByName } from './skins/utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
|
|
2
|
-
export var PACKAGE_VERSION = '10.
|
|
2
|
+
export var PACKAGE_VERSION = '10.28.1';
|
package/dist-es/popover.js
CHANGED
|
@@ -100,7 +100,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
100
100
|
left: '50%',
|
|
101
101
|
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
102
102
|
border: "1px solid ".concat(theme.colors.divider),
|
|
103
|
-
borderRadius:
|
|
103
|
+
borderRadius: 2,
|
|
104
104
|
boxShadow: function(param) {
|
|
105
105
|
var position = param.position;
|
|
106
106
|
return position === 'bottom' ? 'initial' : "0 0 4px 0 rgba(0, 0, 0, ".concat(shadowAlpha, ")");
|
|
@@ -128,7 +128,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
128
128
|
title: {
|
|
129
129
|
marginBottom: 4,
|
|
130
130
|
color: theme.colors.textPrimary,
|
|
131
|
-
fontWeight:
|
|
131
|
+
fontWeight: 400,
|
|
132
132
|
lineHeight: 1.5,
|
|
133
133
|
fontSize: 16
|
|
134
134
|
},
|
|
@@ -154,7 +154,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
154
154
|
marginRight: 0
|
|
155
155
|
},
|
|
156
156
|
text: {
|
|
157
|
-
color: theme.colors.
|
|
157
|
+
color: theme.colors.textSecondary,
|
|
158
158
|
textAlign: 'left',
|
|
159
159
|
lineHeight: 1.42857142,
|
|
160
160
|
fontSize: 14
|
|
@@ -172,8 +172,9 @@ var getPosition = function() {
|
|
|
172
172
|
var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultPositionDesktop, isTabletOrSmaller = arguments.length > 1 ? arguments[1] : void 0;
|
|
173
173
|
return isTabletOrSmaller && (position === 'left' || position === 'right') ? defaultPositionMobile : position;
|
|
174
174
|
};
|
|
175
|
-
var getWidth = function(isTabletOrSmaller, width) {
|
|
176
|
-
|
|
175
|
+
var getWidth = function(isTabletOrSmaller, isIos, width) {
|
|
176
|
+
// in iOS, when the webview is rendered offscreen (eg. acccount tab), window.innerWidth value is wrong, it returns strange values like 0 or 80.
|
|
177
|
+
return isTabletOrSmaller ? (isIos ? window.screen.width : window.innerWidth) - marginLeftRightMobile * 2 : getWidthDesktop(width);
|
|
177
178
|
};
|
|
178
179
|
var getPositionStyles = function(position, width, targetPosition, isTabletOrSmaller) {
|
|
179
180
|
var containerStylesByPos = {
|
|
@@ -246,12 +247,12 @@ var getTargetPosition = function(targetWrapper) {
|
|
|
246
247
|
};
|
|
247
248
|
var Popover = function(param) {
|
|
248
249
|
var description = param.description, title = param.title, onClose = param.onClose, trackingEvent = param.trackingEvent, position = param.position, width = param.width, target = param.target, asset = param.asset, _isVisible = param.isVisible, isVisible = _isVisible === void 0 ? true : _isVisible;
|
|
249
|
-
var ref = useTheme(), texts = ref.texts, colors = ref.colors;
|
|
250
|
+
var ref = useTheme(), texts = ref.texts, colors = ref.colors, isIos = ref.isIos;
|
|
250
251
|
var isTabletOrSmaller = useScreenSize().isTabletOrSmaller;
|
|
251
252
|
var ref1 = _slicedToArray(React.useState(null), 2), targetPosition = ref1[0], setTargetPosition = ref1[1];
|
|
252
253
|
var targetWrapperRef = React.useRef(null);
|
|
253
254
|
position = getPosition(position, isTabletOrSmaller);
|
|
254
|
-
var innerWidth = getWidth(isTabletOrSmaller, width);
|
|
255
|
+
var innerWidth = getWidth(isTabletOrSmaller, isIos, width);
|
|
255
256
|
var classes = useStyles({
|
|
256
257
|
position: position
|
|
257
258
|
});
|
package/dist-es/select.js
CHANGED
package/dist-es/skins/blau.js
CHANGED
|
@@ -94,8 +94,6 @@ export var getBlauSkin = function() {
|
|
|
94
94
|
controlError: palette.blauRed,
|
|
95
95
|
loadingBar: palette.blauBlueSecondary,
|
|
96
96
|
loadingBarBackground: palette.blauBlueSecondary10,
|
|
97
|
-
loadingBarInverse: palette.blauBlueSecondary,
|
|
98
|
-
loadingBarBackgroundInverse: palette.blauBlueSecondary10,
|
|
99
97
|
toggleAndroidInactive: palette.grey2,
|
|
100
98
|
toggleAndroidBackgroundActive: palette.blauBlueSecondary10,
|
|
101
99
|
iosControlKnob: palette.white,
|
|
@@ -107,8 +107,6 @@ export var getO2ClassicSkin = function() {
|
|
|
107
107
|
controlError: palette.pepper,
|
|
108
108
|
loadingBar: palette.o2Gem,
|
|
109
109
|
loadingBarBackground: palette.o2GemLight30,
|
|
110
|
-
loadingBarBackgroundInverse: palette.o2GemLight30,
|
|
111
|
-
loadingBarInverse: palette.o2Gem,
|
|
112
110
|
toggleAndroidInactive: palette.grey2,
|
|
113
111
|
toggleAndroidBackgroundActive: palette.o2GemLight30,
|
|
114
112
|
iosControlKnob: palette.white,
|
|
@@ -195,8 +193,6 @@ export var getO2ClassicSkin = function() {
|
|
|
195
193
|
controlActivated: palette.o2Gem,
|
|
196
194
|
loadingBar: palette.o2Gem,
|
|
197
195
|
loadingBarBackground: palette.darkModeGrey6,
|
|
198
|
-
loadingBarBackgroundInverse: palette.darkModeGrey,
|
|
199
|
-
loadingBarInverse: palette.o2SkyBlue,
|
|
200
196
|
toggleAndroidInactive: palette.grey4,
|
|
201
197
|
toggleAndroidBackgroundActive: palette.o2GemLight30,
|
|
202
198
|
iosControlKnob: palette.grey2,
|
package/dist-es/skins/o2.js
CHANGED
|
@@ -97,8 +97,6 @@ export var getO2Skin = function() {
|
|
|
97
97
|
controlError: palette.pepper,
|
|
98
98
|
loadingBar: palette.o2BluePrimary,
|
|
99
99
|
loadingBarBackground: palette.grey1,
|
|
100
|
-
loadingBarBackgroundInverse: palette.grey1,
|
|
101
|
-
loadingBarInverse: palette.o2BluePrimary,
|
|
102
100
|
toggleAndroidInactive: palette.grey2,
|
|
103
101
|
toggleAndroidBackgroundActive: palette.o2BluePrimary15,
|
|
104
102
|
iosControlKnob: palette.white,
|
|
@@ -189,8 +187,6 @@ export var getO2Skin = function() {
|
|
|
189
187
|
controlActivated: palette.o2BluePrimary30,
|
|
190
188
|
loadingBar: palette.darkModeO2BluePrimary,
|
|
191
189
|
loadingBarBackground: palette.darkModeGrey6,
|
|
192
|
-
loadingBarBackgroundInverse: palette.grey1,
|
|
193
|
-
loadingBarInverse: palette.darkModeO2BluePrimary,
|
|
194
190
|
toggleAndroidInactive: palette.grey4,
|
|
195
191
|
toggleAndroidBackgroundActive: palette.o2BlueLight30,
|
|
196
192
|
iosControlKnob: palette.grey2,
|
|
@@ -92,8 +92,6 @@ export var getTelefonicaSkin = function() {
|
|
|
92
92
|
controlError: palette.coral,
|
|
93
93
|
loadingBar: palette.telefonicaBlue30,
|
|
94
94
|
loadingBarBackground: palette.telefonicaBlue70,
|
|
95
|
-
loadingBarBackgroundInverse: palette.telefonicaBlue70,
|
|
96
|
-
loadingBarInverse: palette.telefonicaBlue30,
|
|
97
95
|
toggleAndroidInactive: palette.grey2,
|
|
98
96
|
toggleAndroidBackgroundActive: palette.grey2,
|
|
99
97
|
iosControlKnob: palette.white,
|
|
@@ -102,7 +100,7 @@ export var getTelefonicaSkin = function() {
|
|
|
102
100
|
dividerInverse: applyAlpha(palette.white, 0.2),
|
|
103
101
|
navigationBarDivider: palette.telefonicaBlue,
|
|
104
102
|
// FEEDBACKS
|
|
105
|
-
badge: palette.
|
|
103
|
+
badge: palette.coral70,
|
|
106
104
|
feedbackErrorBackground: palette.coral,
|
|
107
105
|
feedbackInfoBackground: palette.grey9,
|
|
108
106
|
// GLOBAL
|
|
@@ -182,8 +180,6 @@ export var getTelefonicaSkin = function() {
|
|
|
182
180
|
controlActivated: palette.telefonicaBlue,
|
|
183
181
|
loadingBar: palette.telefonicaBlue,
|
|
184
182
|
loadingBarBackground: applyAlpha(palette.white, 0.05),
|
|
185
|
-
loadingBarBackgroundInverse: palette.telefonicaBlue70,
|
|
186
|
-
loadingBarInverse: palette.telefonicaBlue30,
|
|
187
183
|
toggleAndroidInactive: palette.grey4,
|
|
188
184
|
toggleAndroidBackgroundActive: palette.grey1,
|
|
189
185
|
iosControlKnob: palette.grey2,
|
package/dist-es/skins/vivo.js
CHANGED
|
@@ -91,8 +91,6 @@ export var getVivoSkin = function() {
|
|
|
91
91
|
controlError: palette.pepper,
|
|
92
92
|
loadingBar: palette.pink,
|
|
93
93
|
loadingBarBackground: palette.pepperLight30,
|
|
94
|
-
loadingBarBackgroundInverse: palette.vivoPurpleLight50,
|
|
95
|
-
loadingBarInverse: palette.vivoPurple,
|
|
96
94
|
toggleAndroidInactive: palette.grey2,
|
|
97
95
|
toggleAndroidBackgroundActive: palette.vivoPurpleLight20,
|
|
98
96
|
iosControlKnob: palette.white,
|
|
@@ -183,8 +181,6 @@ export var getVivoSkin = function() {
|
|
|
183
181
|
controlActivated: palette.vivoPurpleLight80,
|
|
184
182
|
loadingBar: palette.vivoPurpleLight80,
|
|
185
183
|
loadingBarBackground: palette.darkModeGrey6,
|
|
186
|
-
loadingBarBackgroundInverse: palette.grey1,
|
|
187
|
-
loadingBarInverse: palette.vivoPurpleLight80,
|
|
188
184
|
toggleAndroidInactive: palette.grey4,
|
|
189
185
|
toggleAndroidBackgroundActive: palette.vivoPurpleLight50,
|
|
190
186
|
iosControlKnob: palette.grey2,
|
package/dist-es/tag.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createUseStyles } from './jss';
|
|
|
6
6
|
import { Text } from './text';
|
|
7
7
|
import { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
|
|
8
8
|
import { pxToRem } from './utils/css';
|
|
9
|
+
import { getPrefixedDataAttributes } from './utils/dom';
|
|
9
10
|
function _arrayLikeToArray(arr, len) {
|
|
10
11
|
if (len == null || len > arr.length) len = arr.length;
|
|
11
12
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -14,6 +15,19 @@ function _arrayLikeToArray(arr, len) {
|
|
|
14
15
|
function _arrayWithHoles(arr) {
|
|
15
16
|
if (Array.isArray(arr)) return arr;
|
|
16
17
|
}
|
|
18
|
+
function _defineProperty(obj, key, value) {
|
|
19
|
+
if (key in obj) {
|
|
20
|
+
Object.defineProperty(obj, key, {
|
|
21
|
+
value: value,
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
obj[key] = value;
|
|
28
|
+
}
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
17
31
|
function _iterableToArrayLimit(arr, i) {
|
|
18
32
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
19
33
|
if (_i == null) return;
|
|
@@ -41,6 +55,21 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
41
55
|
function _nonIterableRest() {
|
|
42
56
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
57
|
}
|
|
58
|
+
function _objectSpread(target) {
|
|
59
|
+
for(var i = 1; i < arguments.length; i++){
|
|
60
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
61
|
+
var ownKeys = Object.keys(source);
|
|
62
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
63
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
64
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
ownKeys.forEach(function(key) {
|
|
68
|
+
_defineProperty(target, key, source[key]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return target;
|
|
72
|
+
}
|
|
44
73
|
function _slicedToArray(arr, i) {
|
|
45
74
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
46
75
|
}
|
|
@@ -74,7 +103,7 @@ var useStyles = createUseStyles(function() {
|
|
|
74
103
|
};
|
|
75
104
|
});
|
|
76
105
|
var Tag = function(param) {
|
|
77
|
-
var Icon = param.Icon, children = param.children, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
|
|
106
|
+
var Icon = param.Icon, children = param.children, dataAttributes = param.dataAttributes, _type = param.type, type = _type === void 0 ? 'promo' : _type, color = param.color;
|
|
78
107
|
var classes = useStyles({
|
|
79
108
|
hasIcon: !!Icon
|
|
80
109
|
});
|
|
@@ -137,7 +166,7 @@ var Tag = function(param) {
|
|
|
137
166
|
};
|
|
138
167
|
var _type1 = _slicedToArray(tagTypeToColors[type], 2), textColor1 = _type1[0], backgroundColor = _type1[1];
|
|
139
168
|
var shouldUseInverseBackground = isInverse && !isDarkMode;
|
|
140
|
-
return(/*#__PURE__*/ _jsxs("span", {
|
|
169
|
+
return(/*#__PURE__*/ _jsxs("span", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
|
|
141
170
|
className: classes.tag,
|
|
142
171
|
style: {
|
|
143
172
|
background: shouldUseInverseBackground ? colors.inverse : backgroundColor
|
|
@@ -162,6 +191,6 @@ var Tag = function(param) {
|
|
|
162
191
|
})
|
|
163
192
|
})
|
|
164
193
|
]
|
|
165
|
-
}));
|
|
194
|
+
})));
|
|
166
195
|
};
|
|
167
196
|
export default Tag;
|
package/dist-es/text-link.js
CHANGED
|
@@ -5,6 +5,8 @@ import Touchable from './touchable';
|
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import { useIsInverseVariant } from './theme-variant-context';
|
|
7
7
|
import { useForm } from './form-context';
|
|
8
|
+
import { getTextFromChildren } from './utils/common';
|
|
9
|
+
import { eventActions, eventCategories } from './utils/analytics';
|
|
8
10
|
function _defineProperty(obj, key, value) {
|
|
9
11
|
if (key in obj) {
|
|
10
12
|
Object.defineProperty(obj, key, {
|
|
@@ -94,8 +96,14 @@ var TextLink = function(_param) {
|
|
|
94
96
|
var classes = useStyles();
|
|
95
97
|
var isInverse = useIsInverseVariant();
|
|
96
98
|
var formStatus = useForm().formStatus;
|
|
99
|
+
var _trackingEvent;
|
|
97
100
|
var _obj;
|
|
98
101
|
return(/*#__PURE__*/ _jsx(Touchable, _objectSpread({}, props, {
|
|
102
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
|
|
103
|
+
category: eventCategories.userInteraction,
|
|
104
|
+
action: eventActions.linkTapped,
|
|
105
|
+
label: getTextFromChildren(children)
|
|
106
|
+
} : undefined,
|
|
99
107
|
disabled: disabled || formStatus === 'sending',
|
|
100
108
|
className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
|
|
101
109
|
children: children
|
package/dist-es/text.js
CHANGED
|
@@ -4,6 +4,7 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { createUseStyles } from './jss';
|
|
5
5
|
import { useIsInverseVariant } from './theme-variant-context';
|
|
6
6
|
import { pxToRem } from './utils/css';
|
|
7
|
+
import { getPrefixedDataAttributes } from './utils/dom';
|
|
7
8
|
function _defineProperty(obj, key, value) {
|
|
8
9
|
if (key in obj) {
|
|
9
10
|
Object.defineProperty(obj, key, {
|
|
@@ -116,7 +117,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
116
117
|
};
|
|
117
118
|
});
|
|
118
119
|
export var Text = function(param) {
|
|
119
|
-
var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'];
|
|
120
|
+
var weight = param.weight, color = param.color, textDecoration = param.textDecoration, _decoration = param.decoration, decoration = _decoration === void 0 ? textDecoration : _decoration, truncate = param.truncate, uppercase = param.uppercase, transform = param.transform, wordBreak = param.wordBreak, _as = param.as, as = _as === void 0 ? 'span' : _as, children = param.children, size = param.size, _mobileSize = param.mobileSize, mobileSize = _mobileSize === void 0 ? size : _mobileSize, _desktopSize = param.desktopSize, desktopSize = _desktopSize === void 0 ? size : _desktopSize, lineHeight = param.lineHeight, _mobileLineHeight = param.mobileLineHeight, mobileLineHeight = _mobileLineHeight === void 0 ? lineHeight : _mobileLineHeight, _desktopLineHeight = param.desktopLineHeight, desktopLineHeight = _desktopLineHeight === void 0 ? lineHeight : _desktopLineHeight, letterSpacing = param.letterSpacing, id = param.id, role = param.role, ariaLevel = param['aria-level'], dataAttributes = param.dataAttributes;
|
|
120
121
|
var isInverse = useIsInverseVariant();
|
|
121
122
|
var classes = useStyles({
|
|
122
123
|
isInverse: isInverse,
|
|
@@ -137,12 +138,12 @@ export var Text = function(param) {
|
|
|
137
138
|
return null;
|
|
138
139
|
}
|
|
139
140
|
var className = classnames(classes.text, _defineProperty({}, classes.truncate, !!truncate));
|
|
140
|
-
return(/*#__PURE__*/ React.createElement(as, {
|
|
141
|
+
return(/*#__PURE__*/ React.createElement(as, _objectSpread({
|
|
141
142
|
className: className,
|
|
142
143
|
id: id,
|
|
143
144
|
role: role,
|
|
144
145
|
'aria-level': ariaLevel
|
|
145
|
-
}, children));
|
|
146
|
+
}, getPrefixedDataAttributes(dataAttributes)), children));
|
|
146
147
|
};
|
|
147
148
|
var getRegularOrMediumWeight = function(props) {
|
|
148
149
|
return props.regular && 'regular' || props.medium && 'medium';
|
|
@@ -16,6 +16,7 @@ import { useIsomorphicLayoutEffect } from './hooks';
|
|
|
16
16
|
import TabFocus from './tab-focus';
|
|
17
17
|
import { PortalNodesProvider } from './portal';
|
|
18
18
|
import ModalContextProvider from './modal-context-provider';
|
|
19
|
+
import { DocumentVisibilityProvider } from './utils/document-visibility';
|
|
19
20
|
function _arrayLikeToArray(arr, len) {
|
|
20
21
|
if (len == null || len > arr.length) len = arr.length;
|
|
21
22
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -196,11 +197,13 @@ var ThemeContextProvider = function(param) {
|
|
|
196
197
|
children: /*#__PURE__*/ _jsx(ModalContextProvider, {
|
|
197
198
|
children: /*#__PURE__*/ _jsx(ThemeContext.Provider, {
|
|
198
199
|
value: contextTheme,
|
|
199
|
-
children: /*#__PURE__*/ _jsx(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
children: /*#__PURE__*/ _jsx(
|
|
203
|
-
children:
|
|
200
|
+
children: /*#__PURE__*/ _jsx(DocumentVisibilityProvider, {
|
|
201
|
+
children: /*#__PURE__*/ _jsx(AriaIdGetterContext.Provider, {
|
|
202
|
+
value: getAriaId,
|
|
203
|
+
children: /*#__PURE__*/ _jsx(ScreenSizeContextProvider, {
|
|
204
|
+
children: /*#__PURE__*/ _jsx(DialogRoot, {
|
|
205
|
+
children: children
|
|
206
|
+
})
|
|
204
207
|
})
|
|
205
208
|
})
|
|
206
209
|
})
|
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
|
+
};
|