@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.
Files changed (66) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/button.d.ts +2 -0
  3. package/dist/button.js +20 -5
  4. package/dist/button.js.flow +2 -0
  5. package/dist/callout.js +37 -26
  6. package/dist/carousel.js +16 -4
  7. package/dist/hooks.d.ts +7 -0
  8. package/dist/hooks.js +30 -1
  9. package/dist/hooks.js.flow +11 -0
  10. package/dist/image.d.ts +3 -0
  11. package/dist/image.js +35 -4
  12. package/dist/image.js.flow +3 -0
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +13 -0
  15. package/dist/index.js.flow +2 -0
  16. package/dist/package-version.js +1 -1
  17. package/dist/popover.js +5 -4
  18. package/dist/skins/blau.js +0 -2
  19. package/dist/skins/o2-classic.js +0 -4
  20. package/dist/skins/o2.js +0 -4
  21. package/dist/skins/telefonica.js +1 -5
  22. package/dist/skins/vivo.js +0 -4
  23. package/dist/tag.d.ts +2 -1
  24. package/dist/tag.js +33 -3
  25. package/dist/tag.js.flow +2 -1
  26. package/dist/text-link.d.ts +1 -0
  27. package/dist/text-link.js +8 -0
  28. package/dist/text-link.js.flow +1 -0
  29. package/dist/text.d.ts +2 -0
  30. package/dist/text.js +4 -3
  31. package/dist/text.js.flow +2 -0
  32. package/dist/theme-context-provider.js +8 -5
  33. package/dist/utils/analytics.d.ts +6 -0
  34. package/dist/utils/analytics.js +13 -0
  35. package/dist/utils/analytics.js.flow +8 -0
  36. package/dist/utils/common.d.ts +1 -0
  37. package/dist/utils/common.js +11 -1
  38. package/dist/utils/common.js.flow +1 -0
  39. package/dist/utils/document-visibility.d.ts +8 -0
  40. package/dist/utils/document-visibility.js +121 -0
  41. package/dist/utils/document-visibility.js.flow +10 -0
  42. package/dist/video.d.ts +2 -0
  43. package/dist/video.js +37 -5
  44. package/dist/video.js.flow +2 -0
  45. package/dist-es/button.js +20 -5
  46. package/dist-es/callout.js +38 -27
  47. package/dist-es/carousel.js +17 -5
  48. package/dist-es/hooks.js +28 -0
  49. package/dist-es/image.js +34 -4
  50. package/dist-es/index.js +2 -1
  51. package/dist-es/package-version.js +1 -1
  52. package/dist-es/popover.js +5 -4
  53. package/dist-es/skins/blau.js +0 -2
  54. package/dist-es/skins/o2-classic.js +0 -4
  55. package/dist-es/skins/o2.js +0 -4
  56. package/dist-es/skins/telefonica.js +1 -5
  57. package/dist-es/skins/vivo.js +0 -4
  58. package/dist-es/tag.js +32 -3
  59. package/dist-es/text-link.js +8 -0
  60. package/dist-es/text.js +4 -3
  61. package/dist-es/theme-context-provider.js +8 -5
  62. package/dist-es/utils/analytics.js +6 -0
  63. package/dist-es/utils/common.js +9 -0
  64. package/dist-es/utils/document-visibility.js +93 -0
  65. package/dist-es/video.js +36 -5
  66. 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
  };
@@ -1,6 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import Stack from './stack';
4
+ import Inline from './inline';
5
+ import Box from './box';
4
6
  import { useTheme } from './hooks';
5
7
  import { ThemeVariant, useIsInverseVariant } from './theme-variant-context';
6
8
  import { createUseStyles } from './jss';
@@ -63,8 +65,8 @@ var Callout = function(param) {
63
65
  children: /*#__PURE__*/ _jsxs(ThemeVariant, {
64
66
  isInverse: false,
65
67
  children: [
66
- icon && /*#__PURE__*/ _jsx("div", {
67
- className: classes.icon,
68
+ icon && /*#__PURE__*/ _jsx(Box, {
69
+ paddingRight: 16,
68
70
  children: icon
69
71
  }),
70
72
  /*#__PURE__*/ _jsx("div", {
@@ -72,18 +74,41 @@ var Callout = function(param) {
72
74
  children: /*#__PURE__*/ _jsxs(Stack, {
73
75
  space: 16,
74
76
  children: [
75
- /*#__PURE__*/ _jsxs(_Fragment, {
77
+ /*#__PURE__*/ _jsxs(Inline, {
78
+ fullWidth: true,
79
+ alignItems: "flex-start",
80
+ space: "between",
76
81
  children: [
77
- /*#__PURE__*/ _jsx(Text3, {
78
- as: "h2",
79
- regular: true,
80
- children: title
82
+ /*#__PURE__*/ _jsxs(Stack, {
83
+ space: 4,
84
+ children: [
85
+ /*#__PURE__*/ _jsx(Text3, {
86
+ as: "h2",
87
+ regular: true,
88
+ children: title
89
+ }),
90
+ /*#__PURE__*/ _jsx(Text2, {
91
+ as: "p",
92
+ regular: true,
93
+ color: colors.textSecondary,
94
+ children: description
95
+ })
96
+ ]
81
97
  }),
82
- /*#__PURE__*/ _jsx(Text2, {
83
- as: "p",
84
- regular: true,
85
- color: colors.textSecondary,
86
- children: description
98
+ onClose && /*#__PURE__*/ _jsx(IconButton, {
99
+ size: 40,
100
+ style: {
101
+ display: 'flex',
102
+ margin: '-8px -12px',
103
+ alignItems: 'center',
104
+ justifyContent: 'center'
105
+ },
106
+ onPress: onClose,
107
+ "aria-label": texts.closeButtonLabel,
108
+ children: /*#__PURE__*/ _jsx(IconCloseRegular, {
109
+ size: 24,
110
+ color: colors.neutralHigh
111
+ })
87
112
  })
88
113
  ]
89
114
  }),
@@ -94,20 +119,6 @@ var Callout = function(param) {
94
119
  })
95
120
  ]
96
121
  })
97
- }),
98
- onClose && /*#__PURE__*/ _jsx(IconButton, {
99
- size: 40,
100
- style: {
101
- display: 'flex',
102
- margin: '-8px -12px -8px 0',
103
- alignItems: 'center',
104
- justifyContent: 'center'
105
- },
106
- onPress: onClose,
107
- "aria-label": texts.closeButtonLabel,
108
- children: /*#__PURE__*/ _jsx(IconCloseRegular, {
109
- color: colors.neutralHigh
110
- })
111
122
  })
112
123
  ]
113
124
  })
@@ -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) {
@@ -492,8 +500,9 @@ var BaseCarousel = function(param) {
492
500
  }, [
493
501
  scrollPositions
494
502
  ]);
503
+ var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
495
504
  React.useEffect(function() {
496
- if (autoplay) {
505
+ if (shouldAutoplay && autoplay) {
497
506
  var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
498
507
  var loop = typeof autoplay === 'object' && autoplay.loop;
499
508
  var interval = setInterval(function() {
@@ -514,7 +523,8 @@ var BaseCarousel = function(param) {
514
523
  }, [
515
524
  autoplay,
516
525
  goNext,
517
- scrollRight1
526
+ scrollRight1,
527
+ shouldAutoplay
518
528
  ]);
519
529
  var currentPageIndex = calcCurrentPageIndex(scrollLeft1, pagesScrollPositions);
520
530
  React.useEffect(function() {
@@ -721,8 +731,9 @@ export var Slideshow = function(param) {
721
731
  }, [
722
732
  items.length
723
733
  ]);
734
+ var shouldAutoplay = useShouldAutoplay(!!autoplay, carouselRef);
724
735
  React.useEffect(function() {
725
- if (autoplay) {
736
+ if (shouldAutoplay && autoplay) {
726
737
  var time = typeof autoplay === 'boolean' ? DEFAULT_AUTOPLAY_TIME : autoplay.time;
727
738
  var loop = typeof autoplay === 'object' && autoplay.loop;
728
739
  var interval = setInterval(function() {
@@ -743,7 +754,8 @@ export var Slideshow = function(param) {
743
754
  }, [
744
755
  autoplay,
745
756
  goNext,
746
- scrollRight2
757
+ scrollRight2,
758
+ shouldAutoplay
747
759
  ]);
748
760
  React.useEffect(function() {
749
761
  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.25.0';
2
+ export var PACKAGE_VERSION = '10.28.0';
@@ -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
- return isTabletOrSmaller ? window.innerWidth - marginLeftRightMobile * 2 : getWidthDesktop(width);
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
  });
@@ -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,
@@ -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.coral80,
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,
@@ -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;
@@ -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(AriaIdGetterContext.Provider, {
200
- value: getAriaId,
201
- children: /*#__PURE__*/ _jsx(ScreenSizeContextProvider, {
202
- children: /*#__PURE__*/ _jsx(DialogRoot, {
203
- children: 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
  })
@@ -0,0 +1,6 @@
1
+ export var eventCategories = {
2
+ userInteraction: 'user_interaction'
3
+ };
4
+ export var eventActions = {
5
+ linkTapped: 'link_tapped'
6
+ };