@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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# [10.28.0](https://github.com/Telefonica/mistica-web/compare/v10.27.0...v10.28.0) (2022-03-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **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))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **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))
|
|
12
|
+
|
|
13
|
+
# [10.27.0](https://github.com/Telefonica/mistica-web/compare/v10.26.0...v10.27.0) (2022-02-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **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))
|
|
19
|
+
* **skins:** remove deprecated constants ([#418](https://github.com/Telefonica/mistica-web/issues/418)) ([822960f](https://github.com/Telefonica/mistica-web/commit/822960f2ecf629b4e5de0ac3224e2026332c0f14))
|
|
20
|
+
* **Telefonica skin:** change badge color ([#424](https://github.com/Telefonica/mistica-web/issues/424)) ([0976c24](https://github.com/Telefonica/mistica-web/commit/0976c246f295d4be61426d33ff93b65c9bae0598))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **Button:** default tracking events ([#425](https://github.com/Telefonica/mistica-web/issues/425)) ([5fc2576](https://github.com/Telefonica/mistica-web/commit/5fc25768f71cd8a0318b47266511694e6024e49e))
|
|
26
|
+
* **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))
|
|
27
|
+
|
|
28
|
+
# [10.26.0](https://github.com/Telefonica/mistica-web/compare/v10.25.0...v10.26.0) (2022-02-23)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **Callout:** Changed element distribution so link has more space ([#414](https://github.com/Telefonica/mistica-web/issues/414)) ([bf3c1cf](https://github.com/Telefonica/mistica-web/commit/bf3c1cfc30db7f5df498743b414599635582910e))
|
|
34
|
+
|
|
1
35
|
# [10.25.0](https://github.com/Telefonica/mistica-web/compare/v10.24.2...v10.25.0) (2022-02-23)
|
|
2
36
|
|
|
3
37
|
|
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/callout.js
CHANGED
|
@@ -6,6 +6,8 @@ exports.default = void 0;
|
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _stack = _interopRequireDefault(require("./stack"));
|
|
9
|
+
var _inline = _interopRequireDefault(require("./inline"));
|
|
10
|
+
var _box = _interopRequireDefault(require("./box"));
|
|
9
11
|
var _hooks = require("./hooks");
|
|
10
12
|
var _themeVariantContext = require("./theme-variant-context");
|
|
11
13
|
var _jss = require("./jss");
|
|
@@ -94,8 +96,8 @@ var Callout = function Callout(param) {
|
|
|
94
96
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(_themeVariantContext.ThemeVariant, {
|
|
95
97
|
isInverse: false,
|
|
96
98
|
children: [
|
|
97
|
-
icon && /*#__PURE__*/ (0, _jsxRuntime).jsx(
|
|
98
|
-
|
|
99
|
+
icon && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
100
|
+
paddingRight: 16,
|
|
99
101
|
children: icon
|
|
100
102
|
}),
|
|
101
103
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
@@ -103,18 +105,41 @@ var Callout = function Callout(param) {
|
|
|
103
105
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
104
106
|
space: 16,
|
|
105
107
|
children: [
|
|
106
|
-
/*#__PURE__*/ (0, _jsxRuntime).jsxs(
|
|
108
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_inline.default, {
|
|
109
|
+
fullWidth: true,
|
|
110
|
+
alignItems: "flex-start",
|
|
111
|
+
space: "between",
|
|
107
112
|
children: [
|
|
108
|
-
/*#__PURE__*/ (0, _jsxRuntime).
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
114
|
+
space: 4,
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text3, {
|
|
117
|
+
as: "h2",
|
|
118
|
+
regular: true,
|
|
119
|
+
children: title
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
122
|
+
as: "p",
|
|
123
|
+
regular: true,
|
|
124
|
+
color: colors.textSecondary,
|
|
125
|
+
children: description
|
|
126
|
+
})
|
|
127
|
+
]
|
|
112
128
|
}),
|
|
113
|
-
/*#__PURE__*/ (0, _jsxRuntime).jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
onClose && /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
|
|
130
|
+
size: 40,
|
|
131
|
+
style: {
|
|
132
|
+
display: 'flex',
|
|
133
|
+
margin: '-8px -12px',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
justifyContent: 'center'
|
|
136
|
+
},
|
|
137
|
+
onPress: onClose,
|
|
138
|
+
"aria-label": texts.closeButtonLabel,
|
|
139
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
|
|
140
|
+
size: 24,
|
|
141
|
+
color: colors.neutralHigh
|
|
142
|
+
})
|
|
118
143
|
})
|
|
119
144
|
]
|
|
120
145
|
}),
|
|
@@ -125,20 +150,6 @@ var Callout = function Callout(param) {
|
|
|
125
150
|
})
|
|
126
151
|
]
|
|
127
152
|
})
|
|
128
|
-
}),
|
|
129
|
-
onClose && /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
|
|
130
|
-
size: 40,
|
|
131
|
-
style: {
|
|
132
|
-
display: 'flex',
|
|
133
|
-
margin: '-8px -12px -8px 0',
|
|
134
|
-
alignItems: 'center',
|
|
135
|
-
justifyContent: 'center'
|
|
136
|
-
},
|
|
137
|
-
onPress: onClose,
|
|
138
|
-
"aria-label": texts.closeButtonLabel,
|
|
139
|
-
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
|
|
140
|
-
color: colors.neutralHigh
|
|
141
|
-
})
|
|
142
153
|
})
|
|
143
154
|
]
|
|
144
155
|
})
|
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) {
|
|
@@ -525,8 +533,9 @@ var BaseCarousel = function BaseCarousel(param) {
|
|
|
525
533
|
}, [
|
|
526
534
|
scrollPositions
|
|
527
535
|
]);
|
|
536
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
528
537
|
React.useEffect(function() {
|
|
529
|
-
if (autoplay) {
|
|
538
|
+
if (shouldAutoplay && autoplay) {
|
|
530
539
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
531
540
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
532
541
|
var interval = setInterval(function() {
|
|
@@ -547,7 +556,8 @@ var BaseCarousel = function BaseCarousel(param) {
|
|
|
547
556
|
}, [
|
|
548
557
|
autoplay,
|
|
549
558
|
goNext,
|
|
550
|
-
scrollRight1
|
|
559
|
+
scrollRight1,
|
|
560
|
+
shouldAutoplay
|
|
551
561
|
]);
|
|
552
562
|
var currentPageIndex = calcCurrentPageIndex(scrollLeft1, pagesScrollPositions);
|
|
553
563
|
React.useEffect(function() {
|
|
@@ -756,8 +766,9 @@ var Slideshow = function Slideshow(param) {
|
|
|
756
766
|
}, [
|
|
757
767
|
items.length
|
|
758
768
|
]);
|
|
769
|
+
var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
|
|
759
770
|
React.useEffect(function() {
|
|
760
|
-
if (autoplay) {
|
|
771
|
+
if (shouldAutoplay && autoplay) {
|
|
761
772
|
var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
|
|
762
773
|
var loop = typeof autoplay === 'object' && autoplay.loop;
|
|
763
774
|
var interval = setInterval(function() {
|
|
@@ -778,7 +789,8 @@ var Slideshow = function Slideshow(param) {
|
|
|
778
789
|
}, [
|
|
779
790
|
autoplay,
|
|
780
791
|
goNext,
|
|
781
|
-
scrollRight2
|
|
792
|
+
scrollRight2,
|
|
793
|
+
shouldAutoplay
|
|
782
794
|
]);
|
|
783
795
|
React.useEffect(function() {
|
|
784
796
|
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
|
@@ -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/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,
|