@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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## [10.28.1](https://github.com/Telefonica/mistica-web/compare/v10.28.0...v10.28.1) (2022-03-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Carousel:** undefined is not an object error in iOS 14 ([#439](https://github.com/Telefonica/mistica-web/issues/439)) ([ef1cf63](https://github.com/Telefonica/mistica-web/commit/ef1cf63a1e7b9009cab28a0bb23b3dd6540defbb))
|
|
7
|
+
* **FixedFooterLayout:** shadow style ([#437](https://github.com/Telefonica/mistica-web/issues/437)) ([d9d9641](https://github.com/Telefonica/mistica-web/commit/d9d9641b101484f8e1d3e5bf9476821cdef517e3))
|
|
8
|
+
* **Popover:** arrow border radius ([#435](https://github.com/Telefonica/mistica-web/issues/435)) ([42eb25e](https://github.com/Telefonica/mistica-web/commit/42eb25ea9e071a38a3b44c1934aef949cfc7c9a5))
|
|
9
|
+
* **Popover:** text styles ([#436](https://github.com/Telefonica/mistica-web/issues/436)) ([4c156cb](https://github.com/Telefonica/mistica-web/commit/4c156cbebae937175a66cf3afb5abfca8051cfd0))
|
|
10
|
+
* **select:** issue with cropped text ([#426](https://github.com/Telefonica/mistica-web/issues/426)) ([2c6e027](https://github.com/Telefonica/mistica-web/commit/2c6e027f643b3458359e6866bc6d9a10afb1e5b4))
|
|
11
|
+
* **Slideshow:** scroll snap stop on android ([#434](https://github.com/Telefonica/mistica-web/issues/434)) ([4ccb6a6](https://github.com/Telefonica/mistica-web/commit/4ccb6a6822a936ae185470bf8bf01bb4224a6626))
|
|
12
|
+
|
|
13
|
+
# [10.28.0](https://github.com/Telefonica/mistica-web/compare/v10.27.0...v10.28.0) (2022-03-01)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **popover:** Fix size in iOS when rendered offscreen ([#431](https://github.com/Telefonica/mistica-web/issues/431)) ([9cb3a29](https://github.com/Telefonica/mistica-web/commit/9cb3a290ea2b6c434c715bb7c18bca9678c5a006))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **Carousel:** autoplay only move when carousel is visible ([#430](https://github.com/Telefonica/mistica-web/issues/430)) ([fa74b04](https://github.com/Telefonica/mistica-web/commit/fa74b04e1d6171809ea8a5c1522cb0622b9dfc01))
|
|
24
|
+
|
|
25
|
+
# [10.27.0](https://github.com/Telefonica/mistica-web/compare/v10.26.0...v10.27.0) (2022-02-25)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **playroom:** dark mode in Blau & Telefonica ios ([#423](https://github.com/Telefonica/mistica-web/issues/423)) ([a630625](https://github.com/Telefonica/mistica-web/commit/a630625379cdb486abd916ad05c0d3fd4974e5cd))
|
|
31
|
+
* **skins:** remove deprecated constants ([#418](https://github.com/Telefonica/mistica-web/issues/418)) ([822960f](https://github.com/Telefonica/mistica-web/commit/822960f2ecf629b4e5de0ac3224e2026332c0f14))
|
|
32
|
+
* **Telefonica skin:** change badge color ([#424](https://github.com/Telefonica/mistica-web/issues/424)) ([0976c24](https://github.com/Telefonica/mistica-web/commit/0976c246f295d4be61426d33ff93b65c9bae0598))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* **Button:** default tracking events ([#425](https://github.com/Telefonica/mistica-web/issues/425)) ([5fc2576](https://github.com/Telefonica/mistica-web/commit/5fc25768f71cd8a0318b47266511694e6024e49e))
|
|
38
|
+
* **Image, Text, Video, Tag:** add dataAttributes prop ([#429](https://github.com/Telefonica/mistica-web/issues/429)) ([730a0db](https://github.com/Telefonica/mistica-web/commit/730a0dbb80abe9a47260b21e29fe1cbf2c9cc206))
|
|
39
|
+
|
|
1
40
|
# [10.26.0](https://github.com/Telefonica/mistica-web/compare/v10.25.0...v10.26.0) (2022-02-23)
|
|
2
41
|
|
|
3
42
|
|
package/dist/button.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface CommonProps {
|
|
|
11
11
|
loadingText?: string;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
14
|
+
trackEvent?: boolean;
|
|
14
15
|
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
15
16
|
dataAttributes?: DataAttributes;
|
|
16
17
|
'aria-controls'?: string;
|
|
@@ -58,6 +59,7 @@ export declare type ButtonProps = FakeButtonProps | SubmitButtonProps | ToButton
|
|
|
58
59
|
interface ButtonLinkCommonProps {
|
|
59
60
|
children: React.ReactNode;
|
|
60
61
|
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
62
|
+
trackEvent?: boolean;
|
|
61
63
|
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
62
64
|
dataAttributes?: DataAttributes;
|
|
63
65
|
aligned?: boolean;
|
package/dist/button.js
CHANGED
|
@@ -14,6 +14,8 @@ var _formContext = require("./form-context");
|
|
|
14
14
|
var _css = require("./utils/css");
|
|
15
15
|
var _text = require("./text");
|
|
16
16
|
var _box = _interopRequireDefault(require("./box"));
|
|
17
|
+
var _common = require("./utils/common");
|
|
18
|
+
var _analytics = require("./utils/analytics");
|
|
17
19
|
function _interopRequireDefault(obj) {
|
|
18
20
|
return obj && obj.__esModule ? obj : {
|
|
19
21
|
default: obj
|
|
@@ -341,13 +343,18 @@ var Button = function Button(props) {
|
|
|
341
343
|
children: text
|
|
342
344
|
});
|
|
343
345
|
};
|
|
346
|
+
var _trackingEvent;
|
|
344
347
|
var _obj;
|
|
345
348
|
var commonProps = {
|
|
346
349
|
className: (0, _classnames).default(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)),
|
|
347
350
|
style: _objectSpread({
|
|
348
351
|
cursor: props.fake ? 'pointer' : undefined
|
|
349
352
|
}, props.style),
|
|
350
|
-
trackingEvent: props.trackingEvent
|
|
353
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
|
|
354
|
+
category: _analytics.eventCategories.userInteraction,
|
|
355
|
+
action: "".concat(props.type, "_button_tapped"),
|
|
356
|
+
label: (0, _common).getTextFromChildren(props.children)
|
|
357
|
+
} : undefined,
|
|
351
358
|
dataAttributes: props.dataAttributes,
|
|
352
359
|
'aria-controls': props['aria-controls'],
|
|
353
360
|
'aria-expanded': props['aria-expanded'],
|
|
@@ -486,10 +493,15 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
486
493
|
var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
487
494
|
var classes = useButtonLinkStyles();
|
|
488
495
|
var isInverse = (0, _themeVariantContext).useIsInverseVariant();
|
|
496
|
+
var _trackingEvent;
|
|
489
497
|
var _obj;
|
|
490
498
|
var commonProps = {
|
|
491
499
|
className: (0, _classnames).default(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
|
|
492
|
-
trackingEvent: props.trackingEvent
|
|
500
|
+
trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
|
|
501
|
+
category: _analytics.eventCategories.userInteraction,
|
|
502
|
+
action: _analytics.eventActions.linkTapped,
|
|
503
|
+
label: (0, _common).getTextFromChildren(props.children)
|
|
504
|
+
} : undefined,
|
|
493
505
|
dataAttributes: props.dataAttributes,
|
|
494
506
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
495
507
|
medium: true,
|
|
@@ -536,21 +548,24 @@ exports.ButtonLink = ButtonLink;
|
|
|
536
548
|
var ButtonPrimary = function ButtonPrimary(props) {
|
|
537
549
|
var classes = usePrimaryButtonStyles();
|
|
538
550
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
539
|
-
classes: classes
|
|
551
|
+
classes: classes,
|
|
552
|
+
type: "primary"
|
|
540
553
|
})));
|
|
541
554
|
};
|
|
542
555
|
exports.ButtonPrimary = ButtonPrimary;
|
|
543
556
|
var ButtonSecondary = function ButtonSecondary(props) {
|
|
544
557
|
var classes = useSecondaryButtonStyles();
|
|
545
558
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
546
|
-
classes: classes
|
|
559
|
+
classes: classes,
|
|
560
|
+
type: "secondary"
|
|
547
561
|
})));
|
|
548
562
|
};
|
|
549
563
|
exports.ButtonSecondary = ButtonSecondary;
|
|
550
564
|
var ButtonDanger = function ButtonDanger(props) {
|
|
551
565
|
var classes = useDangerButtonStyles();
|
|
552
566
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(Button, _objectSpread({}, props, {
|
|
553
|
-
classes: classes
|
|
567
|
+
classes: classes,
|
|
568
|
+
type: "danger"
|
|
554
569
|
})));
|
|
555
570
|
};
|
|
556
571
|
exports.ButtonDanger = ButtonDanger;
|
package/dist/button.js.flow
CHANGED
|
@@ -18,6 +18,7 @@ declare type CommonProps = {
|
|
|
18
18
|
loadingText?: string,
|
|
19
19
|
disabled?: boolean,
|
|
20
20
|
trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
|
|
21
|
+
trackEvent?: boolean,
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
|
|
@@ -58,6 +59,7 @@ export type ButtonProps =
|
|
|
58
59
|
declare type ButtonLinkCommonProps = {
|
|
59
60
|
children: React.Node,
|
|
60
61
|
trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
|
|
62
|
+
trackEvent?: boolean,
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
|
package/dist/carousel.js
CHANGED
|
@@ -18,6 +18,8 @@ var _themeVariantContext = require("./theme-variant-context");
|
|
|
18
18
|
var _color = require("./utils/color");
|
|
19
19
|
var _image = require("./image");
|
|
20
20
|
var _dom = require("./utils/dom");
|
|
21
|
+
var _platform = require("./utils/platform");
|
|
22
|
+
var _documentVisibility = require("./utils/document-visibility");
|
|
21
23
|
function _interopRequireDefault(obj) {
|
|
22
24
|
return obj && obj.__esModule ? obj : {
|
|
23
25
|
default: obj
|
|
@@ -131,6 +133,11 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
131
133
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
132
134
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
133
135
|
}
|
|
136
|
+
var useShouldAutoplay = function useShouldAutoplay(autoplay, ref) {
|
|
137
|
+
var isDocumentVisible = (0, _documentVisibility).useDocumentVisibility();
|
|
138
|
+
var isInViewport = (0, _hooks).useIsInViewport(ref, false);
|
|
139
|
+
return isInViewport && isDocumentVisible && !!autoplay;
|
|
140
|
+
};
|
|
134
141
|
var useBulletsStyles = (0, _jss).createUseStyles(function(theme) {
|
|
135
142
|
return {
|
|
136
143
|
bullet: _defineProperty({
|
|
@@ -268,6 +275,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
268
275
|
}
|
|
269
276
|
})),
|
|
270
277
|
item: (_obj2 = {
|
|
278
|
+
scrollSnapStop: (0, _platform).isAndroid(theme.platformOverrides) ? 'always' : 'normal',
|
|
271
279
|
scrollSnapAlign: 'start',
|
|
272
280
|
flexShrink: 0,
|
|
273
281
|
width: function width(param) {
|
|
@@ -448,12 +456,24 @@ var BaseCarousel = function BaseCarousel(param) {
|
|
|
448
456
|
};
|
|
449
457
|
var calcItemScrollPositions = function calcItemScrollPositions() {
|
|
450
458
|
var maxScroll = carouselEl.scrollWidth - carouselEl.clientWidth;
|
|
459
|
+
var getItemScrollMargin = function getItemScrollMargin(itemIndex) {
|
|
460
|
+
if (centered) {
|
|
461
|
+
return 0;
|
|
462
|
+
}
|
|
463
|
+
if (itemIndex === 0) {
|
|
464
|
+
return 0;
|
|
465
|
+
}
|
|
466
|
+
if (isDesktopOrBigger) {
|
|
467
|
+
return -gap;
|
|
468
|
+
}
|
|
469
|
+
return mobilePageOffsetConfig.prev;
|
|
470
|
+
};
|
|
451
471
|
setItemScrollPositions(Array.from(carouselEl.querySelectorAll('[data-item]')).map(function(itemEl, idx) {
|
|
452
472
|
if (idx === items.length - 1) {
|
|
453
473
|
return maxScroll;
|
|
454
474
|
}
|
|
455
475
|
var offsetLeft = itemEl.offsetLeft;
|
|
456
|
-
var scrollMargin =
|
|
476
|
+
var scrollMargin = getItemScrollMargin(idx);
|
|
457
477
|
var scrollPosition = centered && !isDesktopOrBigger ? offsetLeft - itemEl.clientWidth / 2 : offsetLeft;
|
|
458
478
|
return Math.min(scrollPosition - scrollMargin - carouselEl.offsetLeft, maxScroll);
|
|
459
479
|
}));
|
|
@@ -525,8 +545,9 @@ var BaseCarousel = function BaseCarousel(param) {
|
|
|
525
545
|
}, [
|
|
526
546
|
scrollPositions
|
|
527
547
|
]);
|
|
548
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
528
549
|
React.useEffect(function() {
|
|
529
|
-
if (autoplay) {
|
|
550
|
+
if (shouldAutoplay && autoplay) {
|
|
530
551
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
531
552
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
532
553
|
var interval = setInterval(function() {
|
|
@@ -547,7 +568,8 @@ var BaseCarousel = function BaseCarousel(param) {
|
|
|
547
568
|
}, [
|
|
548
569
|
autoplay,
|
|
549
570
|
goNext,
|
|
550
|
-
scrollRight1
|
|
571
|
+
scrollRight1,
|
|
572
|
+
shouldAutoplay
|
|
551
573
|
]);
|
|
552
574
|
var currentPageIndex = calcCurrentPageIndex(scrollLeft1, pagesScrollPositions);
|
|
553
575
|
React.useEffect(function() {
|
|
@@ -672,6 +694,7 @@ var useSlideshowStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
672
694
|
})),
|
|
673
695
|
item: {
|
|
674
696
|
width: '100%',
|
|
697
|
+
scrollSnapStop: (0, _platform).isAndroid(theme.platformOverrides) ? 'always' : 'normal',
|
|
675
698
|
scrollSnapAlign: 'start',
|
|
676
699
|
flexShrink: 0
|
|
677
700
|
},
|
|
@@ -756,8 +779,9 @@ var Slideshow = function Slideshow(param) {
|
|
|
756
779
|
}, [
|
|
757
780
|
items.length
|
|
758
781
|
]);
|
|
782
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
759
783
|
React.useEffect(function() {
|
|
760
|
-
if (autoplay) {
|
|
784
|
+
if (shouldAutoplay && autoplay) {
|
|
761
785
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
762
786
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
763
787
|
var interval = setInterval(function() {
|
|
@@ -778,7 +802,8 @@ var Slideshow = function Slideshow(param) {
|
|
|
778
802
|
}, [
|
|
779
803
|
autoplay,
|
|
780
804
|
goNext,
|
|
781
|
-
scrollRight2
|
|
805
|
+
scrollRight2,
|
|
806
|
+
shouldAutoplay
|
|
782
807
|
]);
|
|
783
808
|
React.useEffect(function() {
|
|
784
809
|
if (onPageChange) {
|
package/dist/hooks.d.ts
CHANGED
|
@@ -17,3 +17,10 @@ export declare const useWindowSize: () => {
|
|
|
17
17
|
export declare const useWindowHeight: () => number;
|
|
18
18
|
export declare const useWindowWidth: () => number;
|
|
19
19
|
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
20
|
+
declare type IntersectionObserverOptions = {
|
|
21
|
+
root?: Element | Document | null;
|
|
22
|
+
rootMargin?: string;
|
|
23
|
+
threshold?: number | number[];
|
|
24
|
+
};
|
|
25
|
+
export declare const useIsInViewport: (ref: React.RefObject<HTMLElement>, defaultValue: boolean, options?: IntersectionObserverOptions | undefined) => boolean;
|
|
26
|
+
export {};
|
package/dist/hooks.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.useIsomorphicLayoutEffect = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = exports.useAriaId = exports.useElementDimensions = exports.useScreenSize = exports.useDisableBodyScroll = exports.useTheme = void 0;
|
|
5
|
+
exports.useIsInViewport = exports.useIsomorphicLayoutEffect = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = exports.useAriaId = exports.useElementDimensions = exports.useScreenSize = exports.useDisableBodyScroll = exports.useTheme = void 0;
|
|
6
6
|
var React = _interopRequireWildcard(require("react"));
|
|
7
7
|
var _themeContext = _interopRequireDefault(require("./theme-context"));
|
|
8
8
|
var _screenSizeContext = _interopRequireDefault(require("./screen-size-context"));
|
|
@@ -217,3 +217,32 @@ var useWindowWidth = function useWindowWidth() {
|
|
|
217
217
|
exports.useWindowWidth = useWindowWidth;
|
|
218
218
|
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
219
219
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
220
|
+
var useIsInViewport = function useIsInViewport(ref, defaultValue, options) {
|
|
221
|
+
var ref7 = _slicedToArray(React.useState(defaultValue), 2), isInViewport = ref7[0], setIsInViewport = ref7[1];
|
|
222
|
+
React.useEffect(function() {
|
|
223
|
+
if (!ref.current) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (typeof window.IntersectionObserver === 'undefined') {
|
|
227
|
+
return function() {};
|
|
228
|
+
}
|
|
229
|
+
var observer = new IntersectionObserver(function(entries) {
|
|
230
|
+
setIsInViewport(entries[0].isIntersecting);
|
|
231
|
+
}, {
|
|
232
|
+
root: options === null || options === void 0 ? void 0 : options.root,
|
|
233
|
+
rootMargin: options === null || options === void 0 ? void 0 : options.rootMargin,
|
|
234
|
+
threshold: options === null || options === void 0 ? void 0 : options.threshold
|
|
235
|
+
});
|
|
236
|
+
observer.observe(ref.current);
|
|
237
|
+
return function() {
|
|
238
|
+
observer.disconnect();
|
|
239
|
+
};
|
|
240
|
+
}, [
|
|
241
|
+
ref,
|
|
242
|
+
options === null || options === void 0 ? void 0 : options.root,
|
|
243
|
+
options === null || options === void 0 ? void 0 : options.rootMargin,
|
|
244
|
+
options === null || options === void 0 ? void 0 : options.threshold
|
|
245
|
+
]);
|
|
246
|
+
return isInViewport;
|
|
247
|
+
};
|
|
248
|
+
exports.useIsInViewport = useIsInViewport;
|
package/dist/hooks.js.flow
CHANGED
|
@@ -19,3 +19,14 @@ declare export var useWindowSize: () => {
|
|
|
19
19
|
declare export var useWindowHeight: () => number;
|
|
20
20
|
declare export var useWindowWidth: () => number;
|
|
21
21
|
declare export var useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
22
|
+
declare type IntersectionObserverOptions = {
|
|
23
|
+
root?: Element | Document | null,
|
|
24
|
+
rootMargin?: string,
|
|
25
|
+
threshold?: number | Array<number>,
|
|
26
|
+
};
|
|
27
|
+
declare export var useIsInViewport: (
|
|
28
|
+
ref: React.Ref<HTMLElement>,
|
|
29
|
+
defaultValue: boolean,
|
|
30
|
+
options?: IntersectionObserverOptions | void
|
|
31
|
+
) => boolean;
|
|
32
|
+
declare export {};
|
package/dist/image.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { DataAttributes } from './utils/types';
|
|
2
3
|
export declare const useDisableBorderRadius: () => boolean;
|
|
3
4
|
export declare const DisableBorderRadiusProvider: React.FC;
|
|
4
5
|
export declare type AspectRatio = '1:1' | '16:9' | '7:10' | '4:3';
|
|
@@ -19,6 +20,7 @@ export declare type ImageProps = {
|
|
|
19
20
|
/** defaults to empty string */
|
|
20
21
|
alt?: string;
|
|
21
22
|
children?: void;
|
|
23
|
+
dataAttributes?: DataAttributes;
|
|
22
24
|
};
|
|
23
25
|
/** @deprecated */
|
|
24
26
|
declare type DeprecatedImageProps = {
|
|
@@ -31,6 +33,7 @@ declare type DeprecatedImageProps = {
|
|
|
31
33
|
/** defaults to empty string */
|
|
32
34
|
alt?: string;
|
|
33
35
|
children?: void;
|
|
36
|
+
dataAttributes?: DataAttributes;
|
|
34
37
|
};
|
|
35
38
|
declare const Image: React.ForwardRefExoticComponent<(ImageProps | DeprecatedImageProps) & React.RefAttributes<HTMLImageElement>>;
|
|
36
39
|
export default Image;
|
package/dist/image.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.default = exports.RATIO = exports.DisableBorderRadiusProvider = exports.
|
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _jss = require("./jss");
|
|
9
|
+
var _dom = require("./utils/dom");
|
|
9
10
|
function _interopRequireWildcard(obj) {
|
|
10
11
|
if (obj && obj.__esModule) {
|
|
11
12
|
return obj;
|
|
@@ -27,6 +28,35 @@ function _interopRequireWildcard(obj) {
|
|
|
27
28
|
return newObj;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
function _defineProperty(obj, key, value) {
|
|
32
|
+
if (key in obj) {
|
|
33
|
+
Object.defineProperty(obj, key, {
|
|
34
|
+
value: value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
function _objectSpread(target) {
|
|
45
|
+
var _arguments = arguments, _loop = function(i) {
|
|
46
|
+
var source = _arguments[i] != null ? _arguments[i] : {};
|
|
47
|
+
var ownKeys = Object.keys(source);
|
|
48
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
49
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
ownKeys.forEach(function(key) {
|
|
54
|
+
_defineProperty(target, key, source[key]);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
for(var i = 1; i < arguments.length; i++)_loop(i);
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
30
60
|
function _objectWithoutProperties(source, excluded) {
|
|
31
61
|
if (source == null) return {};
|
|
32
62
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -96,9 +126,10 @@ var RATIO = {
|
|
|
96
126
|
};
|
|
97
127
|
exports.RATIO = RATIO;
|
|
98
128
|
var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
99
|
-
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
|
|
129
|
+
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, [
|
|
100
130
|
"aspectRatio",
|
|
101
|
-
"alt"
|
|
131
|
+
"alt",
|
|
132
|
+
"dataAttributes"
|
|
102
133
|
]);
|
|
103
134
|
var noBorderRadius = useDisableBorderRadius();
|
|
104
135
|
var classes = useStyles({
|
|
@@ -118,14 +149,14 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
118
149
|
} else {
|
|
119
150
|
width = '100%';
|
|
120
151
|
}
|
|
121
|
-
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", {
|
|
152
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
|
|
122
153
|
ref: ref,
|
|
123
154
|
src: url,
|
|
124
155
|
className: classes.image,
|
|
125
156
|
alt: alt,
|
|
126
157
|
width: width,
|
|
127
158
|
height: height
|
|
128
|
-
}));
|
|
159
|
+
})));
|
|
129
160
|
});
|
|
130
161
|
var _default = Image;
|
|
131
162
|
exports.default = _default;
|
package/dist/image.js.flow
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import type { DataAttributes } from "./utils/types";
|
|
4
5
|
declare export var useDisableBorderRadius: () => boolean;
|
|
5
6
|
declare export var DisableBorderRadiusProvider: React.ComponentType<{}>;
|
|
6
7
|
export type AspectRatio = "1:1" | "16:9" | "7:10" | "4:3";
|
|
@@ -25,6 +26,7 @@ export type ImageProps = {
|
|
|
25
26
|
* defaults to empty string
|
|
26
27
|
*/
|
|
27
28
|
alt?: string,
|
|
29
|
+
dataAttributes?: DataAttributes,
|
|
28
30
|
};
|
|
29
31
|
/**
|
|
30
32
|
* @deprecated
|
|
@@ -41,6 +43,7 @@ declare type DeprecatedImageProps = {
|
|
|
41
43
|
* defaults to empty string
|
|
42
44
|
*/
|
|
43
45
|
alt?: string,
|
|
46
|
+
dataAttributes?: DataAttributes,
|
|
44
47
|
};
|
|
45
48
|
declare var Image: React.ComponentType<{
|
|
46
49
|
...ImageProps | DeprecatedImageProps,
|
package/dist/index.d.ts
CHANGED
|
@@ -87,8 +87,9 @@ export { default as IconError } from './icons/icon-error';
|
|
|
87
87
|
export { default as IconSuccess } from './icons/icon-success';
|
|
88
88
|
export { default as IconSuccessVivo } from './icons/icon-success-vivo';
|
|
89
89
|
export { default as Circle } from './circle';
|
|
90
|
-
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, } from './hooks';
|
|
90
|
+
export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport, } from './hooks';
|
|
91
91
|
export type { ThemeConfig, ColorScheme } from './theme';
|
|
92
|
+
export { useDocumentVisibility } from './utils/document-visibility';
|
|
92
93
|
export { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
|
|
93
94
|
export type { Skin, SkinName } from './skins/types';
|
|
94
95
|
export { VIVO_SKIN, O2_CLASSIC_SKIN, O2_SKIN, MOVISTAR_SKIN, TELEFONICA_SKIN, BLAU_SKIN, } from './skins/constants';
|
package/dist/index.js
CHANGED
|
@@ -818,6 +818,18 @@ Object.defineProperty(exports, "useWindowWidth", {
|
|
|
818
818
|
return _hooks.useWindowWidth;
|
|
819
819
|
}
|
|
820
820
|
});
|
|
821
|
+
Object.defineProperty(exports, "useIsInViewport", {
|
|
822
|
+
enumerable: true,
|
|
823
|
+
get: function() {
|
|
824
|
+
return _hooks.useIsInViewport;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
Object.defineProperty(exports, "useDocumentVisibility", {
|
|
828
|
+
enumerable: true,
|
|
829
|
+
get: function() {
|
|
830
|
+
return _documentVisibility.useDocumentVisibility;
|
|
831
|
+
}
|
|
832
|
+
});
|
|
821
833
|
Object.defineProperty(exports, "ThemeVariant", {
|
|
822
834
|
enumerable: true,
|
|
823
835
|
get: function() {
|
|
@@ -8366,6 +8378,7 @@ var _iconSuccess = _interopRequireDefault(require("./icons/icon-success"));
|
|
|
8366
8378
|
var _iconSuccessVivo = _interopRequireDefault(require("./icons/icon-success-vivo"));
|
|
8367
8379
|
var _circle = _interopRequireDefault(require("./circle"));
|
|
8368
8380
|
var _hooks = require("./hooks");
|
|
8381
|
+
var _documentVisibility = require("./utils/document-visibility");
|
|
8369
8382
|
var _themeVariantContext = require("./theme-variant-context");
|
|
8370
8383
|
var _constants = require("./skins/constants");
|
|
8371
8384
|
var _utils = require("./skins/utils");
|
package/dist/index.js.flow
CHANGED
|
@@ -143,8 +143,10 @@ declare export {
|
|
|
143
143
|
useWindowSize,
|
|
144
144
|
useWindowHeight,
|
|
145
145
|
useWindowWidth,
|
|
146
|
+
useIsInViewport,
|
|
146
147
|
} from "./hooks";
|
|
147
148
|
export type { ThemeConfig, ColorScheme } from "./theme";
|
|
149
|
+
declare export { useDocumentVisibility } from "./utils/document-visibility";
|
|
148
150
|
declare export {
|
|
149
151
|
ThemeVariant,
|
|
150
152
|
useIsInverseVariant,
|
package/dist/package-version.js
CHANGED
package/dist/popover.js
CHANGED
|
@@ -132,7 +132,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
132
132
|
left: '50%',
|
|
133
133
|
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
134
134
|
border: "1px solid ".concat(theme.colors.divider),
|
|
135
|
-
borderRadius:
|
|
135
|
+
borderRadius: 2,
|
|
136
136
|
boxShadow: function boxShadow(param) {
|
|
137
137
|
var position = param.position;
|
|
138
138
|
return position === 'bottom' ? 'initial' : "0 0 4px 0 rgba(0, 0, 0, ".concat(shadowAlpha, ")");
|
|
@@ -160,7 +160,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
160
160
|
title: {
|
|
161
161
|
marginBottom: 4,
|
|
162
162
|
color: theme.colors.textPrimary,
|
|
163
|
-
fontWeight:
|
|
163
|
+
fontWeight: 400,
|
|
164
164
|
lineHeight: 1.5,
|
|
165
165
|
fontSize: 16
|
|
166
166
|
},
|
|
@@ -186,7 +186,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
186
186
|
marginRight: 0
|
|
187
187
|
},
|
|
188
188
|
text: {
|
|
189
|
-
color: theme.colors.
|
|
189
|
+
color: theme.colors.textSecondary,
|
|
190
190
|
textAlign: 'left',
|
|
191
191
|
lineHeight: 1.42857142,
|
|
192
192
|
fontSize: 14
|
|
@@ -204,8 +204,9 @@ var getPosition = function getPosition() {
|
|
|
204
204
|
var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultPositionDesktop, isTabletOrSmaller = arguments.length > 1 ? arguments[1] : void 0;
|
|
205
205
|
return isTabletOrSmaller && (position === 'left' || position === 'right') ? defaultPositionMobile : position;
|
|
206
206
|
};
|
|
207
|
-
var getWidth = function getWidth(isTabletOrSmaller, width) {
|
|
208
|
-
|
|
207
|
+
var getWidth = function getWidth(isTabletOrSmaller, isIos, width) {
|
|
208
|
+
// in iOS, when the webview is rendered offscreen (eg. acccount tab), window.innerWidth value is wrong, it returns strange values like 0 or 80.
|
|
209
|
+
return isTabletOrSmaller ? (isIos ? window.screen.width : window.innerWidth) - marginLeftRightMobile * 2 : getWidthDesktop(width);
|
|
209
210
|
};
|
|
210
211
|
var getPositionStyles = function getPositionStyles(position, width, targetPosition, isTabletOrSmaller) {
|
|
211
212
|
var containerStylesByPos = {
|
|
@@ -278,12 +279,12 @@ var getTargetPosition = function getTargetPosition(targetWrapper) {
|
|
|
278
279
|
};
|
|
279
280
|
var Popover = function Popover(param) {
|
|
280
281
|
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;
|
|
281
|
-
var ref = (0, _hooks).useTheme(), texts = ref.texts, colors = ref.colors;
|
|
282
|
+
var ref = (0, _hooks).useTheme(), texts = ref.texts, colors = ref.colors, isIos = ref.isIos;
|
|
282
283
|
var isTabletOrSmaller = (0, _hooks).useScreenSize().isTabletOrSmaller;
|
|
283
284
|
var ref1 = _slicedToArray(React.useState(null), 2), targetPosition = ref1[0], setTargetPosition = ref1[1];
|
|
284
285
|
var targetWrapperRef = React.useRef(null);
|
|
285
286
|
position = getPosition(position, isTabletOrSmaller);
|
|
286
|
-
var innerWidth = getWidth(isTabletOrSmaller, width);
|
|
287
|
+
var innerWidth = getWidth(isTabletOrSmaller, isIos, width);
|
|
287
288
|
var classes = useStyles({
|
|
288
289
|
position: position
|
|
289
290
|
});
|
package/dist/select.js
CHANGED
package/dist/skins/blau.js
CHANGED
|
@@ -98,8 +98,6 @@ var getBlauSkin = function getBlauSkin() {
|
|
|
98
98
|
controlError: palette.blauRed,
|
|
99
99
|
loadingBar: palette.blauBlueSecondary,
|
|
100
100
|
loadingBarBackground: palette.blauBlueSecondary10,
|
|
101
|
-
loadingBarInverse: palette.blauBlueSecondary,
|
|
102
|
-
loadingBarBackgroundInverse: palette.blauBlueSecondary10,
|
|
103
101
|
toggleAndroidInactive: palette.grey2,
|
|
104
102
|
toggleAndroidBackgroundActive: palette.blauBlueSecondary10,
|
|
105
103
|
iosControlKnob: palette.white,
|
package/dist/skins/o2-classic.js
CHANGED
|
@@ -111,8 +111,6 @@ var getO2ClassicSkin = function getO2ClassicSkin() {
|
|
|
111
111
|
controlError: palette.pepper,
|
|
112
112
|
loadingBar: palette.o2Gem,
|
|
113
113
|
loadingBarBackground: palette.o2GemLight30,
|
|
114
|
-
loadingBarBackgroundInverse: palette.o2GemLight30,
|
|
115
|
-
loadingBarInverse: palette.o2Gem,
|
|
116
114
|
toggleAndroidInactive: palette.grey2,
|
|
117
115
|
toggleAndroidBackgroundActive: palette.o2GemLight30,
|
|
118
116
|
iosControlKnob: palette.white,
|
|
@@ -199,8 +197,6 @@ var getO2ClassicSkin = function getO2ClassicSkin() {
|
|
|
199
197
|
controlActivated: palette.o2Gem,
|
|
200
198
|
loadingBar: palette.o2Gem,
|
|
201
199
|
loadingBarBackground: palette.darkModeGrey6,
|
|
202
|
-
loadingBarBackgroundInverse: palette.darkModeGrey,
|
|
203
|
-
loadingBarInverse: palette.o2SkyBlue,
|
|
204
200
|
toggleAndroidInactive: palette.grey4,
|
|
205
201
|
toggleAndroidBackgroundActive: palette.o2GemLight30,
|
|
206
202
|
iosControlKnob: palette.grey2,
|
package/dist/skins/o2.js
CHANGED
|
@@ -101,8 +101,6 @@ var getO2Skin = function getO2Skin() {
|
|
|
101
101
|
controlError: palette.pepper,
|
|
102
102
|
loadingBar: palette.o2BluePrimary,
|
|
103
103
|
loadingBarBackground: palette.grey1,
|
|
104
|
-
loadingBarBackgroundInverse: palette.grey1,
|
|
105
|
-
loadingBarInverse: palette.o2BluePrimary,
|
|
106
104
|
toggleAndroidInactive: palette.grey2,
|
|
107
105
|
toggleAndroidBackgroundActive: palette.o2BluePrimary15,
|
|
108
106
|
iosControlKnob: palette.white,
|
|
@@ -193,8 +191,6 @@ var getO2Skin = function getO2Skin() {
|
|
|
193
191
|
controlActivated: palette.o2BluePrimary30,
|
|
194
192
|
loadingBar: palette.darkModeO2BluePrimary,
|
|
195
193
|
loadingBarBackground: palette.darkModeGrey6,
|
|
196
|
-
loadingBarBackgroundInverse: palette.grey1,
|
|
197
|
-
loadingBarInverse: palette.darkModeO2BluePrimary,
|
|
198
194
|
toggleAndroidInactive: palette.grey4,
|
|
199
195
|
toggleAndroidBackgroundActive: palette.o2BlueLight30,
|
|
200
196
|
iosControlKnob: palette.grey2,
|
package/dist/skins/telefonica.js
CHANGED
|
@@ -96,8 +96,6 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
|
|
|
96
96
|
controlError: palette.coral,
|
|
97
97
|
loadingBar: palette.telefonicaBlue30,
|
|
98
98
|
loadingBarBackground: palette.telefonicaBlue70,
|
|
99
|
-
loadingBarBackgroundInverse: palette.telefonicaBlue70,
|
|
100
|
-
loadingBarInverse: palette.telefonicaBlue30,
|
|
101
99
|
toggleAndroidInactive: palette.grey2,
|
|
102
100
|
toggleAndroidBackgroundActive: palette.grey2,
|
|
103
101
|
iosControlKnob: palette.white,
|
|
@@ -106,7 +104,7 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
|
|
|
106
104
|
dividerInverse: (0, _color).applyAlpha(palette.white, 0.2),
|
|
107
105
|
navigationBarDivider: palette.telefonicaBlue,
|
|
108
106
|
// FEEDBACKS
|
|
109
|
-
badge: palette.
|
|
107
|
+
badge: palette.coral70,
|
|
110
108
|
feedbackErrorBackground: palette.coral,
|
|
111
109
|
feedbackInfoBackground: palette.grey9,
|
|
112
110
|
// GLOBAL
|
|
@@ -186,8 +184,6 @@ var getTelefonicaSkin = function getTelefonicaSkin() {
|
|
|
186
184
|
controlActivated: palette.telefonicaBlue,
|
|
187
185
|
loadingBar: palette.telefonicaBlue,
|
|
188
186
|
loadingBarBackground: (0, _color).applyAlpha(palette.white, 0.05),
|
|
189
|
-
loadingBarBackgroundInverse: palette.telefonicaBlue70,
|
|
190
|
-
loadingBarInverse: palette.telefonicaBlue30,
|
|
191
187
|
toggleAndroidInactive: palette.grey4,
|
|
192
188
|
toggleAndroidBackgroundActive: palette.grey1,
|
|
193
189
|
iosControlKnob: palette.grey2,
|