@telefonica/mistica 11.5.1 → 11.8.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 (49) hide show
  1. package/dist/button.d.ts +1 -0
  2. package/dist/button.js +40 -12
  3. package/dist/button.js.flow +1 -0
  4. package/dist/image.d.ts +3 -1
  5. package/dist/image.js +76 -11
  6. package/dist/image.js.flow +3 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +13 -0
  9. package/dist/index.js.flow +1 -0
  10. package/dist/package-version.js +1 -1
  11. package/dist/password-field.js +9 -8
  12. package/dist/responsive-layout.js +3 -1
  13. package/dist/section-title.d.ts +3 -0
  14. package/dist/section-title.js +3 -1
  15. package/dist/section-title.js.flow +3 -0
  16. package/dist/text-link.js +18 -5
  17. package/dist/theme-context-provider.js +2 -1
  18. package/dist/theme.d.ts +2 -0
  19. package/dist/theme.js.flow +2 -0
  20. package/dist/title.d.ts +13 -0
  21. package/dist/title.js +87 -0
  22. package/dist/title.js.flow +18 -0
  23. package/dist/utils/analytics.d.ts +3 -0
  24. package/dist/utils/analytics.js +5 -1
  25. package/dist/utils/analytics.js.flow +3 -0
  26. package/dist/video.d.ts +1 -1
  27. package/dist/video.js +8 -6
  28. package/dist/video.js.flow +1 -1
  29. package/dist-es/button.js +41 -13
  30. package/dist-es/image.js +77 -11
  31. package/dist-es/index.js +1 -0
  32. package/dist-es/package-version.js +1 -1
  33. package/dist-es/password-field.js +9 -8
  34. package/dist-es/responsive-layout.js +3 -1
  35. package/dist-es/section-title.js +3 -1
  36. package/dist-es/text-link.js +19 -6
  37. package/dist-es/theme-context-provider.js +2 -1
  38. package/dist-es/title.js +54 -0
  39. package/dist-es/utils/analytics.js +5 -0
  40. package/dist-es/video.js +8 -6
  41. package/package.json +3 -3
  42. package/dist/icons/icon-visibility-off.d.ts +0 -7
  43. package/dist/icons/icon-visibility-off.js +0 -49
  44. package/dist/icons/icon-visibility-off.js.flow +0 -9
  45. package/dist/icons/icon-visibility.d.ts +0 -7
  46. package/dist/icons/icon-visibility.js +0 -49
  47. package/dist/icons/icon-visibility.js.flow +0 -9
  48. package/dist-es/icons/icon-visibility-off.js +0 -22
  49. package/dist-es/icons/icon-visibility.js +0 -22
@@ -0,0 +1,18 @@
1
+ // @flow
2
+
3
+ import * as React from "react";
4
+ import type { DataAttributes } from "./utils/types";
5
+ declare type TitleProps = {
6
+ children: React.Node,
7
+ id?: string,
8
+ right?: React.Node,
9
+ as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6",
10
+
11
+ /**
12
+ * "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
13
+ */
14
+ dataAttributes?: DataAttributes,
15
+ };
16
+ declare export var Title1: (x: TitleProps) => React.Element<any>;
17
+ declare export var Title2: (x: TitleProps) => React.Element<any>;
18
+ declare export {};
@@ -4,3 +4,6 @@ export declare const eventCategories: {
4
4
  export declare const eventActions: {
5
5
  readonly linkTapped: "link_tapped";
6
6
  };
7
+ export declare const eventNames: {
8
+ readonly userInteraction: "user_interaction";
9
+ };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.eventActions = exports.eventCategories = void 0;
5
+ exports.eventNames = exports.eventActions = exports.eventCategories = void 0;
6
6
  var eventCategories = {
7
7
  userInteraction: "user_interaction"
8
8
  };
@@ -11,3 +11,7 @@ var eventActions = {
11
11
  linkTapped: "link_tapped"
12
12
  };
13
13
  exports.eventActions = eventActions;
14
+ var eventNames = {
15
+ userInteraction: "user_interaction"
16
+ };
17
+ exports.eventNames = eventNames;
@@ -6,3 +6,6 @@ declare export var eventCategories: {
6
6
  declare export var eventActions: {
7
7
  +linkTapped: "link_tapped",
8
8
  };
9
+ declare export var eventNames: {
10
+ +userInteraction: "user_interaction",
11
+ };
package/dist/video.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare type VideoProps = {
15
15
  /** defaults to 100% when no width and no height are given */
16
16
  width?: string | number;
17
17
  height?: string | number;
18
- /** defaults to 1:1, if both width and height are given, aspectRatio is ignored */
18
+ /** defaults to 1:1, if both width and height are given, aspectRatio is ignored. To use original video proportions, set aspectRatio to 0 */
19
19
  aspectRatio?: AspectRatio | number;
20
20
  /** accepts multiple sources */
21
21
  src: string | Array<string> | VideoSource | Array<VideoSource>;
package/dist/video.js CHANGED
@@ -101,17 +101,18 @@ var useStyles = (0, _jss).createUseStyles(function() {
101
101
  objectFit: "cover",
102
102
  maxWidth: "100%",
103
103
  maxHeight: "100%",
104
+ borderRadius: function borderRadius(param) {
105
+ var noBorderRadius = param.noBorderRadius;
106
+ return noBorderRadius ? 0 : 4;
107
+ },
104
108
  "@supports (aspect-ratio: 1 / 1)": {
105
- borderRadius: function borderRadius(param) {
106
- var noBorderRadius = param.noBorderRadius;
107
- return noBorderRadius ? 0 : 4;
108
- },
109
109
  aspectRatio: function aspectRatio(param) {
110
110
  var aspectRatio1 = param.aspectRatio;
111
111
  return aspectRatio1 !== null && aspectRatio1 !== void 0 ? aspectRatio1 : "unset";
112
112
  }
113
113
  },
114
114
  "$wrapper &": {
115
+ borderRadius: 0,
115
116
  position: "absolute",
116
117
  width: "100%",
117
118
  height: "100%",
@@ -155,9 +156,10 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
155
156
  ]);
156
157
  var supportsAspectRatio = (0, _aspectRatioSupport).useSupportsAspectRatio();
157
158
  var noBorderRadius = (0, _image).useDisableBorderRadius();
158
- // if width or height are numeric, we can calculate the other with the ratio without css
159
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number";
160
159
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
160
+ // if width or height are numeric, we can calculate the other with the ratio without css
161
+ // if aspect ratio is 0, we use the original video proportions
162
+ var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
161
163
  var classes = useStyles({
162
164
  noBorderRadius: noBorderRadius,
163
165
  aspectRatio: withCssAspectRatio ? ratio : undefined,
@@ -20,7 +20,7 @@ export type VideoProps = {
20
20
  width?: string | number,
21
21
  height?: string | number,
22
22
  /**
23
- * defaults to 1:1, if both width and height are given, aspectRatio is ignored
23
+ * defaults to 1:1, if both width and height are given, aspectRatio is ignored. To use original video proportions, set aspectRatio to 0
24
24
  */
25
25
  aspectRatio?: AspectRatio | number,
26
26
  /**
package/dist-es/button.js CHANGED
@@ -84,7 +84,8 @@ import { pxToRem } from "./utils/css";
84
84
  import { Text, Text2, Text3 } from "./text";
85
85
  import Box from "./box";
86
86
  import { getTextFromChildren } from "./utils/common";
87
- import { eventActions, eventCategories } from "./utils/analytics";
87
+ import { eventActions, eventCategories, eventNames } from "./utils/analytics";
88
+ import { useTheme } from "./hooks";
88
89
  export var BUTTON_MIN_WIDTH = 136;
89
90
  var transitionTiming = "0.3s cubic-bezier(0.77, 0, 0.175, 1)";
90
91
  var BORDER_PX = 1.5;
@@ -272,6 +273,7 @@ var useDangerButtonStyles = createUseStyles(function(theme) {
272
273
  });
273
274
  });
274
275
  var Button = function(props) {
276
+ var analytics = useTheme().analytics;
275
277
  var ref = useForm(), formStatus = ref.formStatus, formId = ref.formId;
276
278
  var isInverse = useIsInverseVariant();
277
279
  var classes = props.classes, loadingText = props.loadingText;
@@ -310,6 +312,21 @@ var Button = function(props) {
310
312
  children: text
311
313
  });
312
314
  };
315
+ var createDefaultTrackingEvent = function() {
316
+ if (analytics.eventFormat === "google-analytics-4") {
317
+ return {
318
+ name: eventNames.userInteraction,
319
+ component_type: "".concat(props.type, "_button"),
320
+ component_copy: getTextFromChildren(props.children)
321
+ };
322
+ } else {
323
+ return {
324
+ category: eventCategories.userInteraction,
325
+ action: "".concat(props.type, "_button_tapped"),
326
+ label: getTextFromChildren(props.children)
327
+ };
328
+ }
329
+ };
313
330
  var _trackingEvent;
314
331
  var _obj;
315
332
  var commonProps = {
@@ -317,11 +334,7 @@ var Button = function(props) {
317
334
  style: _objectSpread({
318
335
  cursor: props.fake ? "pointer" : undefined
319
336
  }, props.style),
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,
337
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
325
338
  dataAttributes: props.dataAttributes,
326
339
  "aria-controls": props["aria-controls"],
327
340
  "aria-expanded": props["aria-expanded"],
@@ -439,7 +452,8 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
439
452
  "@media (pointer: coarse)": {
440
453
  backgroundColor: "initial"
441
454
  }
442
- }
455
+ },
456
+ "&[disabled]": disabledStyle
443
457
  },
444
458
  inverse: {
445
459
  color: theme.colors.textLinkInverse,
@@ -459,24 +473,38 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
459
473
  };
460
474
  });
461
475
  export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
476
+ var formStatus = useForm().formStatus;
462
477
  var classes = useButtonLinkStyles();
463
478
  var isInverse = useIsInverseVariant();
479
+ var analytics = useTheme().analytics;
480
+ var createDefaultTrackingEvent = function() {
481
+ if (analytics.eventFormat === "google-analytics-4") {
482
+ return {
483
+ name: eventNames.userInteraction,
484
+ component_type: "link",
485
+ component_copy: getTextFromChildren(props.children)
486
+ };
487
+ } else {
488
+ return {
489
+ category: eventCategories.userInteraction,
490
+ action: eventActions.linkTapped,
491
+ label: getTextFromChildren(props.children)
492
+ };
493
+ }
494
+ };
464
495
  var _trackingEvent;
465
496
  var _obj;
466
497
  var commonProps = {
467
498
  className: classnames(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
468
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
469
- category: eventCategories.userInteraction,
470
- action: eventActions.linkTapped,
471
- label: getTextFromChildren(props.children)
472
- } : undefined,
499
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
473
500
  dataAttributes: props.dataAttributes,
474
501
  children: /*#__PURE__*/ _jsx(Text2, {
475
502
  medium: true,
476
503
  truncate: 1,
477
504
  color: "inherit",
478
505
  children: props.children
479
- })
506
+ }),
507
+ disabled: props.disabled || formStatus === "sending"
480
508
  };
481
509
  if (process.env.NODE_ENV !== "production") {
482
510
  if (props.to === "" || props.href === "") {
package/dist-es/image.js CHANGED
@@ -1,3 +1,11 @@
1
+ function _arrayLikeToArray(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _arrayWithHoles(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _defineProperty(obj, key, value) {
2
10
  if (key in obj) {
3
11
  Object.defineProperty(obj, key, {
@@ -11,6 +19,33 @@ function _defineProperty(obj, key, value) {
11
19
  }
12
20
  return obj;
13
21
  }
22
+ function _iterableToArrayLimit(arr, i) {
23
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
+ if (_i == null) return;
25
+ var _arr = [];
26
+ var _n = true;
27
+ var _d = false;
28
+ var _s, _e;
29
+ try {
30
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
+ _arr.push(_s.value);
32
+ if (i && _arr.length === i) break;
33
+ }
34
+ } catch (err) {
35
+ _d = true;
36
+ _e = err;
37
+ } finally{
38
+ try {
39
+ if (!_n && _i["return"] != null) _i["return"]();
40
+ } finally{
41
+ if (_d) throw _e;
42
+ }
43
+ }
44
+ return _arr;
45
+ }
46
+ function _nonIterableRest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
14
49
  function _objectSpread(target) {
15
50
  for(var i = 1; i < arguments.length; i++){
16
51
  var source = arguments[i] != null ? arguments[i] : {};
@@ -53,6 +88,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
53
88
  }
54
89
  return target;
55
90
  }
91
+ function _slicedToArray(arr, i) {
92
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
93
+ }
94
+ function _unsupportedIterableToArray(o, minLen) {
95
+ if (!o) return;
96
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
97
+ var n = Object.prototype.toString.call(o).slice(8, -1);
98
+ if (n === "Object" && o.constructor) n = o.constructor.name;
99
+ if (n === "Map" || n === "Set") return Array.from(n);
100
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
101
+ }
56
102
  import { jsx as _jsx } from "react/jsx-runtime";
57
103
  import * as React from "react";
58
104
  import { createUseStyles } from "./jss";
@@ -79,22 +125,27 @@ var useStyles = createUseStyles(function() {
79
125
  objectFit: "cover",
80
126
  maxWidth: "100%",
81
127
  maxHeight: "100%",
128
+ borderRadius: function(param) {
129
+ var noBorderRadius = param.noBorderRadius;
130
+ return noBorderRadius ? 0 : 4;
131
+ },
82
132
  "@supports (aspect-ratio: 1 / 1)": {
83
- borderRadius: function(param) {
84
- var noBorderRadius = param.noBorderRadius;
85
- return noBorderRadius ? 0 : 4;
86
- },
87
133
  aspectRatio: function(param) {
88
134
  var aspectRatio = param.aspectRatio;
89
135
  return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
90
136
  }
91
137
  },
92
138
  "$wrapper &": {
139
+ borderRadius: 0,
93
140
  position: "absolute",
94
141
  width: "100%",
95
142
  height: "100%",
96
143
  top: 0,
97
144
  left: 0
145
+ },
146
+ opacity: function(param) {
147
+ var isError = param.isError;
148
+ return isError ? 0 : 1;
98
149
  }
99
150
  },
100
151
  wrapper: {
@@ -126,23 +177,28 @@ export var RATIO = {
126
177
  "4:3": 4 / 3
127
178
  };
128
179
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
129
- var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, props = _objectWithoutProperties(_param, [
180
+ var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? "" : _alt, dataAttributes = _param.dataAttributes, noBorderRadius = _param.noBorderRadius, src = _param.src, onError = _param.onError, onLoad = _param.onLoad, props = _objectWithoutProperties(_param, [
130
181
  "aspectRatio",
131
182
  "alt",
132
183
  "dataAttributes",
133
184
  "noBorderRadius",
134
- "src"
185
+ "src",
186
+ "onError",
187
+ "onLoad"
135
188
  ]);
136
189
  var supportsAspectRatio = useSupportsAspectRatio();
137
190
  var noBorderRadiusContext = useDisableBorderRadius();
138
191
  var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
139
- // if width or height are numeric, we can calculate the other with the ratio without css
140
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number";
192
+ var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
141
193
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
194
+ // if width or height are numeric, we can calculate the other with the ratio without css.
195
+ // if aspect ratio is 0, we use the original image proportions
196
+ var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
142
197
  var classes = useStyles({
143
198
  noBorderRadius: noBorderSetting,
144
199
  aspectRatio: withCssAspectRatio ? ratio : undefined,
145
- width: props.width
200
+ width: props.width,
201
+ isError: isError
146
202
  });
147
203
  var width = props.width;
148
204
  var height = props.height;
@@ -157,11 +213,21 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
157
213
  width = props.width || "100%";
158
214
  }
159
215
  var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
160
- var img = /*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
216
+ var img = // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/309
217
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
218
+ /*#__PURE__*/ _jsx("img", _objectSpread({}, getPrefixedDataAttributes(dataAttributes), {
161
219
  ref: ref,
162
220
  src: src,
163
221
  className: classes.image,
164
- alt: alt
222
+ alt: alt,
223
+ onError: function(event) {
224
+ setIsError(true);
225
+ onError === null || onError === void 0 ? void 0 : onError(event);
226
+ },
227
+ onLoad: function(event) {
228
+ setIsError(false);
229
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
230
+ }
165
231
  }, !needsWrapper ? {
166
232
  width: width,
167
233
  height: height
package/dist-es/index.js CHANGED
@@ -36,6 +36,7 @@ export { default as NavigationBreadcrumbs } from "./navigation-breadcrumbs";
36
36
  export { default as Text, Text1, Text2, Text3, Text4, Text5, Text6, Text7, Text8, Text9, Text10 } from "./text";
37
37
  export { default as Tag } from "./tag";
38
38
  export { default as SectionTitle } from "./section-title";
39
+ export { Title1, Title2 } from "./title";
39
40
  export { Placeholder, AvatarPlaceholder } from "./placeholder";
40
41
  export { RowList, Row, BoxedRowList, BoxedRow } from "./list";
41
42
  export { default as Switch } from "./switch-component";
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = "11.5.1";
2
+ export var PACKAGE_VERSION = "11.8.0";
@@ -105,14 +105,14 @@ import { useFieldProps } from "./form-context";
105
105
  import { TextFieldBaseAutosuggest } from "./text-field-base";
106
106
  import { useTheme } from "./hooks";
107
107
  import IconButton from "./icon-button";
108
- import Visibility from "./icons/icon-visibility";
109
- import VisibilityOff from "./icons/icon-visibility-off";
108
+ import IconAccesibilityRegular from "./generated/mistica-icons/icon-accesibility-regular";
109
+ import IconEyeRegular from "./generated/mistica-icons/icon-eye-regular";
110
110
  import { createUseStyles } from "./jss";
111
111
  var usePasswordAdornmentStyles = createUseStyles(function(theme) {
112
112
  return {
113
113
  shadow: _defineProperty({}, theme.mq.supportsHover, {
114
114
  "&:hover": {
115
- backgroundColor: "rgba(0, 0, 0, 0.08)"
115
+ backgroundColor: theme.colors.backgroundAlternative
116
116
  }
117
117
  })
118
118
  };
@@ -123,10 +123,11 @@ var PasswordAdornment = function(param) {
123
123
  var classes = usePasswordAdornmentStyles();
124
124
  var style = {
125
125
  backgroundSize: "200%",
126
- padding: 12,
127
- margin: -12,
126
+ padding: 8,
127
+ margin: -8,
128
128
  borderRadius: "50%",
129
- backgroundColor: undefined
129
+ backgroundColor: undefined,
130
+ transition: "background-color 0.2s ease-in-out"
130
131
  };
131
132
  return /*#__PURE__*/ _jsx(IconButton, {
132
133
  "aria-label": texts.togglePasswordVisibilityLabel,
@@ -134,10 +135,10 @@ var PasswordAdornment = function(param) {
134
135
  setVisibility(!isVisible);
135
136
  focus();
136
137
  },
137
- size: 48,
138
+ size: 40,
138
139
  className: classes.shadow,
139
140
  style: style,
140
- children: isVisible ? /*#__PURE__*/ _jsx(VisibilityOff, {}) : /*#__PURE__*/ _jsx(Visibility, {})
141
+ children: isVisible ? /*#__PURE__*/ _jsx(IconAccesibilityRegular, {}) : /*#__PURE__*/ _jsx(IconEyeRegular, {})
141
142
  });
142
143
  };
143
144
  var PasswordField = function(_param) {
@@ -27,7 +27,9 @@ var useStyles = createUseStyles(function(theme) {
27
27
  width: "100%"
28
28
  },
29
29
  layout: (_obj = {
30
- margin: "auto"
30
+ margin: "auto",
31
+ paddingLeft: "env(safe-area-inset-left)",
32
+ paddingRight: "env(safe-area-inset-right)"
31
33
  }, _defineProperty(_obj, theme.mq.largeDesktop, {
32
34
  width: LARGE_DESKTOP_MAX_WIDTH
33
35
  }), _defineProperty(_obj, theme.mq.desktop, {
@@ -30,7 +30,9 @@ var useStyles = createUseStyles(function(theme) {
30
30
  })
31
31
  };
32
32
  });
33
- var SectionTitle = function(param) {
33
+ /**
34
+ * @deprecated use Title1 instead
35
+ */ var SectionTitle = function(param) {
34
36
  var children = param.children, id = param.id, right = param.right, _as = param.as, as = _as === void 0 ? "h3" : _as;
35
37
  var classes = useStyles();
36
38
  var theme = useTheme();
@@ -61,7 +61,8 @@ import classnames from "classnames";
61
61
  import { useIsInverseVariant } from "./theme-variant-context";
62
62
  import { useForm } from "./form-context";
63
63
  import { getTextFromChildren } from "./utils/common";
64
- import { eventActions, eventCategories } from "./utils/analytics";
64
+ import { eventActions, eventCategories, eventNames } from "./utils/analytics";
65
+ import { useTheme } from "./hooks";
65
66
  var useStyles = createUseStyles(function(theme) {
66
67
  var _obj;
67
68
  return {
@@ -96,14 +97,26 @@ var TextLink = function(_param) {
96
97
  var classes = useStyles();
97
98
  var isInverse = useIsInverseVariant();
98
99
  var formStatus = useForm().formStatus;
100
+ var analytics = useTheme().analytics;
101
+ var createDefaultTrackingEvent = function() {
102
+ if (analytics.eventFormat === "google-analytics-4") {
103
+ return {
104
+ name: eventNames.userInteraction,
105
+ component_type: "link",
106
+ component_copy: getTextFromChildren(children)
107
+ };
108
+ } else {
109
+ return {
110
+ category: eventCategories.userInteraction,
111
+ action: eventActions.linkTapped,
112
+ label: getTextFromChildren(children)
113
+ };
114
+ }
115
+ };
99
116
  var _trackingEvent;
100
117
  var _obj;
101
118
  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,
119
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
107
120
  disabled: disabled || formStatus === "sending",
108
121
  className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
109
122
  children: children
@@ -173,7 +173,8 @@ var ThemeContextProvider = function(param) {
173
173
  analytics: _objectSpread({
174
174
  logEvent: function() {
175
175
  return Promise.resolve();
176
- }
176
+ },
177
+ eventFormat: "universal-analytics"
177
178
  }, theme.analytics),
178
179
  dimensions: _objectSpread({}, dimensions, theme.dimensions),
179
180
  mq: createMediaQueries((_mediaQueries = theme.mediaQueries) !== null && _mediaQueries !== void 0 ? _mediaQueries : mediaQueriesConfig),
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Text1, Text2, Text5 } from "./text";
4
+ import { useTheme } from "./hooks";
5
+ import Inline from "./inline";
6
+ import Box from "./box";
7
+ var TitleLayout = function(param) {
8
+ var title = param.title, right = param.right;
9
+ if (!right) {
10
+ return title;
11
+ }
12
+ return /*#__PURE__*/ _jsxs(Inline, {
13
+ space: "between",
14
+ alignItems: "baseline",
15
+ children: [
16
+ title,
17
+ /*#__PURE__*/ _jsx(Box, {
18
+ paddingLeft: 16,
19
+ children: /*#__PURE__*/ _jsx(Text2, {
20
+ regular: true,
21
+ children: right
22
+ })
23
+ })
24
+ ]
25
+ });
26
+ };
27
+ export var Title1 = function(param) {
28
+ var children = param.children, _as = param.as, as = _as === void 0 ? "h3" : _as, id = param.id, right = param.right, dataAttributes = param.dataAttributes;
29
+ var theme = useTheme();
30
+ return /*#__PURE__*/ _jsx(TitleLayout, {
31
+ title: /*#__PURE__*/ _jsx(Text1, {
32
+ color: theme.colors.textSecondary,
33
+ transform: "uppercase",
34
+ medium: true,
35
+ as: as,
36
+ id: id,
37
+ dataAttributes: dataAttributes,
38
+ children: children
39
+ }),
40
+ right: right
41
+ });
42
+ };
43
+ export var Title2 = function(param) {
44
+ var children = param.children, _as = param.as, as = _as === void 0 ? "h3" : _as, id = param.id, right = param.right, dataAttributes = param.dataAttributes;
45
+ return /*#__PURE__*/ _jsx(TitleLayout, {
46
+ title: /*#__PURE__*/ _jsx(Text5, {
47
+ as: as,
48
+ id: id,
49
+ dataAttributes: dataAttributes,
50
+ children: children
51
+ }),
52
+ right: right
53
+ });
54
+ };
@@ -1,6 +1,11 @@
1
+ // Universal Analytics (legacy)
1
2
  export var eventCategories = {
2
3
  userInteraction: "user_interaction"
3
4
  };
4
5
  export var eventActions = {
5
6
  linkTapped: "link_tapped"
6
7
  };
8
+ // Google analytics 4
9
+ export var eventNames = {
10
+ userInteraction: "user_interaction"
11
+ };
package/dist-es/video.js CHANGED
@@ -73,17 +73,18 @@ var useStyles = createUseStyles(function() {
73
73
  objectFit: "cover",
74
74
  maxWidth: "100%",
75
75
  maxHeight: "100%",
76
+ borderRadius: function(param) {
77
+ var noBorderRadius = param.noBorderRadius;
78
+ return noBorderRadius ? 0 : 4;
79
+ },
76
80
  "@supports (aspect-ratio: 1 / 1)": {
77
- borderRadius: function(param) {
78
- var noBorderRadius = param.noBorderRadius;
79
- return noBorderRadius ? 0 : 4;
80
- },
81
81
  aspectRatio: function(param) {
82
82
  var aspectRatio = param.aspectRatio;
83
83
  return aspectRatio !== null && aspectRatio !== void 0 ? aspectRatio : "unset";
84
84
  }
85
85
  },
86
86
  "$wrapper &": {
87
+ borderRadius: 0,
87
88
  position: "absolute",
88
89
  width: "100%",
89
90
  height: "100%",
@@ -127,9 +128,10 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
127
128
  ]);
128
129
  var supportsAspectRatio = useSupportsAspectRatio();
129
130
  var noBorderRadius = useDisableBorderRadius();
130
- // if width or height are numeric, we can calculate the other with the ratio without css
131
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number";
132
131
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
132
+ // if width or height are numeric, we can calculate the other with the ratio without css
133
+ // if aspect ratio is 0, we use the original video proportions
134
+ var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
133
135
  var classes = useStyles({
134
136
  noBorderRadius: noBorderRadius,
135
137
  aspectRatio: withCssAspectRatio ? ratio : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "11.5.1",
3
+ "version": "11.8.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -77,7 +77,7 @@
77
77
  "@swc/core": "^1.2.160",
78
78
  "@swc/jest": "^0.2.20",
79
79
  "@telefonica/acceptance-testing": "^2.7.0",
80
- "@telefonica/eslint-config": "^1.0.3",
80
+ "@telefonica/eslint-config": "^1.0.7",
81
81
  "@telefonica/prettier-config": "^1.1.0",
82
82
  "@telefonica/ts-to-flow": "1.2.0",
83
83
  "@testing-library/jest-dom": "^5.16.3",
@@ -123,7 +123,7 @@
123
123
  },
124
124
  "dependencies": {
125
125
  "@juggle/resize-observer": "^3.3.1",
126
- "@tef-novum/webview-bridge": "^3.4.0",
126
+ "@tef-novum/webview-bridge": "^3.5.0",
127
127
  "@telefonica/libphonenumber": "^2.8.1",
128
128
  "classnames": "^2.3.1",
129
129
  "jss": "^10.9.0",
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- declare type Props = {
3
- role?: string;
4
- size?: number;
5
- };
6
- declare const IconVisibilityOff: React.FC<Props>;
7
- export default IconVisibilityOff;