@telefonica/mistica 11.7.0 → 11.10.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 (57) hide show
  1. package/dist/avatar.d.ts +14 -0
  2. package/dist/avatar.js +239 -0
  3. package/dist/avatar.js.flow +16 -0
  4. package/dist/badge.d.ts +2 -0
  5. package/dist/badge.js +24 -7
  6. package/dist/badge.js.flow +2 -0
  7. package/dist/button.js +35 -10
  8. package/dist/image.d.ts +2 -0
  9. package/dist/image.js +68 -5
  10. package/dist/image.js.flow +2 -0
  11. package/dist/index.d.ts +5 -2
  12. package/dist/index.js +29 -2
  13. package/dist/index.js.flow +5 -2
  14. package/dist/package-version.js +1 -1
  15. package/dist/password-field.js +9 -8
  16. package/dist/placeholder.d.ts +0 -4
  17. package/dist/placeholder.js +1 -13
  18. package/dist/placeholder.js.flow +0 -4
  19. package/dist/section-title.d.ts +3 -0
  20. package/dist/section-title.js +3 -1
  21. package/dist/section-title.js.flow +3 -0
  22. package/dist/text-link.js +17 -5
  23. package/dist/text.js +8 -2
  24. package/dist/theme-context-provider.js +13 -8
  25. package/dist/theme.d.ts +3 -0
  26. package/dist/theme.js.flow +3 -0
  27. package/dist/title.d.ts +13 -0
  28. package/dist/title.js +87 -0
  29. package/dist/title.js.flow +18 -0
  30. package/dist/utils/__tests__/analytics-test.js +74 -0
  31. package/dist/utils/analytics.d.ts +14 -0
  32. package/dist/utils/analytics.js +50 -1
  33. package/dist/utils/analytics.js.flow +14 -0
  34. package/dist-es/avatar.js +208 -0
  35. package/dist-es/badge.js +24 -7
  36. package/dist-es/button.js +36 -11
  37. package/dist-es/image.js +69 -5
  38. package/dist-es/index.js +4 -1
  39. package/dist-es/package-version.js +1 -1
  40. package/dist-es/password-field.js +9 -8
  41. package/dist-es/placeholder.js +0 -11
  42. package/dist-es/section-title.js +3 -1
  43. package/dist-es/text-link.js +18 -6
  44. package/dist-es/text.js +8 -2
  45. package/dist-es/theme-context-provider.js +13 -8
  46. package/dist-es/title.js +54 -0
  47. package/dist-es/utils/__tests__/analytics-test.js +47 -0
  48. package/dist-es/utils/analytics.js +27 -0
  49. package/package.json +3 -3
  50. package/dist/icons/icon-visibility-off.d.ts +0 -7
  51. package/dist/icons/icon-visibility-off.js +0 -49
  52. package/dist/icons/icon-visibility-off.js.flow +0 -9
  53. package/dist/icons/icon-visibility.d.ts +0 -7
  54. package/dist/icons/icon-visibility.js +0 -49
  55. package/dist/icons/icon-visibility.js.flow +0 -9
  56. package/dist-es/icons/icon-visibility-off.js +0 -22
  57. package/dist-es/icons/icon-visibility.js +0 -22
@@ -1,8 +1,22 @@
1
1
  // @flow
2
2
 
3
+ import * as React from "react";
4
+ import type { EventFormat } from "../theme";
3
5
  declare export var eventCategories: {
4
6
  +userInteraction: "user_interaction",
5
7
  };
6
8
  declare export var eventActions: {
7
9
  +linkTapped: "link_tapped",
8
10
  };
11
+ declare export var eventNames: {
12
+ +userInteraction: "user_interaction",
13
+ };
14
+ declare type TrackingConfigProps = {
15
+ children: React.Node,
16
+ eventFormat: EventFormat,
17
+ };
18
+ declare export var TrackingConfig: (x: TrackingConfigProps) => React.Node;
19
+ declare export var useTrackingConfig: () => {
20
+ eventFormat: EventFormat,
21
+ };
22
+ declare export {};
@@ -0,0 +1,208 @@
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
+ }
9
+ function _iterableToArrayLimit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _nonIterableRest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _objectWithoutProperties(source, excluded) {
37
+ if (source == null) return {};
38
+ var target = _objectWithoutPropertiesLoose(source, excluded);
39
+ var key, i;
40
+ if (Object.getOwnPropertySymbols) {
41
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
42
+ for(i = 0; i < sourceSymbolKeys.length; i++){
43
+ key = sourceSymbolKeys[i];
44
+ if (excluded.indexOf(key) >= 0) continue;
45
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
46
+ target[key] = source[key];
47
+ }
48
+ }
49
+ return target;
50
+ }
51
+ function _objectWithoutPropertiesLoose(source, excluded) {
52
+ if (source == null) return {};
53
+ var target = {};
54
+ var sourceKeys = Object.keys(source);
55
+ var key, i;
56
+ for(i = 0; i < sourceKeys.length; i++){
57
+ key = sourceKeys[i];
58
+ if (excluded.indexOf(key) >= 0) continue;
59
+ target[key] = source[key];
60
+ }
61
+ return target;
62
+ }
63
+ function _slicedToArray(arr, i) {
64
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
65
+ }
66
+ function _unsupportedIterableToArray(o, minLen) {
67
+ if (!o) return;
68
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
69
+ var n = Object.prototype.toString.call(o).slice(8, -1);
70
+ if (n === "Object" && o.constructor) n = o.constructor.name;
71
+ if (n === "Map" || n === "Set") return Array.from(n);
72
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
73
+ }
74
+ import { jsx as _jsx } from "react/jsx-runtime";
75
+ // https://www.figma.com/file/U4ipIXOk64bdM5tSvaqPKS/%5BREADY%5D--Avatar?node-id=2%3A61
76
+ import * as React from "react";
77
+ import Badge from "./badge";
78
+ import IconUserAccountRegular from "./generated/mistica-icons/icon-user-account-regular";
79
+ import { useTheme } from "./hooks";
80
+ import { createUseStyles } from "./jss";
81
+ import { useIsInverseVariant } from "./theme-variant-context";
82
+ var useStyles = createUseStyles(function() {
83
+ return {
84
+ avatar: {
85
+ borderRadius: "50%",
86
+ display: "flex",
87
+ alignItems: "center",
88
+ justifyContent: "center",
89
+ color: function(param) {
90
+ var textColor = param.textColor;
91
+ return textColor;
92
+ },
93
+ background: function(param) {
94
+ var backgroundColor = param.backgroundColor;
95
+ return backgroundColor;
96
+ },
97
+ width: function(param) {
98
+ var size = param.size;
99
+ return size;
100
+ },
101
+ height: function(param) {
102
+ var size = param.size;
103
+ return size;
104
+ },
105
+ overflow: "hidden"
106
+ },
107
+ image: {
108
+ width: function(param) {
109
+ var size = param.size;
110
+ return size;
111
+ },
112
+ height: function(param) {
113
+ var size = param.size;
114
+ return size;
115
+ },
116
+ objectFit: "cover"
117
+ }
118
+ };
119
+ });
120
+ /**
121
+ * Returns a right/top distance for the badge.
122
+ * The badge will be placed over the avatar's edge
123
+ * This is calculated using the `radius * (1 - sin(45deg))` distance minus a
124
+ * constant offset that depends on the badge size
125
+ */ var getBadgeDistance = function(size, badge) {
126
+ if (!badge) {
127
+ return 0;
128
+ }
129
+ var radius = size / 2;
130
+ var badgeOffset = badge === true ? 5 : 10; // badge=true renders a small circle
131
+ return radius * (1 - Math.sin(Math.PI / 4)) - badgeOffset;
132
+ };
133
+ /**
134
+ * Not using TextPresets here because we don't want to scale the avatar text with the device settings
135
+ */ var renderText = function(size, text) {
136
+ if (!text) {
137
+ return null;
138
+ }
139
+ var fontSize;
140
+ if (size <= 40) {
141
+ fontSize = 14;
142
+ } else if (size <= 64) {
143
+ fontSize = 16;
144
+ } else {
145
+ fontSize = 18;
146
+ }
147
+ return /*#__PURE__*/ _jsx("span", {
148
+ style: {
149
+ fontSize: fontSize,
150
+ textTransform: "uppercase"
151
+ },
152
+ children: text
153
+ });
154
+ };
155
+ var Avatar = function(_param) {
156
+ var size = _param.size, src = _param.src, _Icon = _param.Icon, Icon = _Icon === void 0 ? IconUserAccountRegular : _Icon, badge = _param.badge, _initials = _param.initials, initials = _initials === void 0 ? "" : _initials, ariaLabel = _param["aria-label"], props = _objectWithoutProperties(_param, [
157
+ "size",
158
+ "src",
159
+ "Icon",
160
+ "badge",
161
+ "initials",
162
+ "aria-label"
163
+ ]);
164
+ var colors = useTheme().colors;
165
+ var isInverse = useIsInverseVariant();
166
+ var _backgroundColor;
167
+ var backgroundColor = (_backgroundColor = props.backgroundColor) !== null && _backgroundColor !== void 0 ? _backgroundColor : isInverse ? colors.brandDark : colors.tagBackgroundActive;
168
+ var _textColor;
169
+ var textColor = (_textColor = props.textColor) !== null && _textColor !== void 0 ? _textColor : isInverse ? colors.textPrimaryInverse : colors.textTagActive;
170
+ var ref = _slicedToArray(React.useState(false), 2), imgLoadError = ref[0], setImgLoadError = ref[1];
171
+ var classes = useStyles({
172
+ textColor: textColor,
173
+ backgroundColor: backgroundColor,
174
+ size: size
175
+ });
176
+ React.useEffect(function() {
177
+ setImgLoadError(false); // reset error state when url changes
178
+ }, [
179
+ src
180
+ ]);
181
+ var letters = initials.trim().slice(0, 2);
182
+ var badgePosition = getBadgeDistance(size, badge);
183
+ var badgeValue = badge === true ? undefined : badge || 0;
184
+ var shouldRenderImage = !!src && !imgLoadError;
185
+ var iconSize = size <= 40 ? 16 : 24;
186
+ return /*#__PURE__*/ _jsx(Badge, {
187
+ value: badgeValue,
188
+ top: badgePosition,
189
+ right: badgePosition,
190
+ children: /*#__PURE__*/ _jsx("div", {
191
+ className: classes.avatar,
192
+ role: "img",
193
+ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : initials,
194
+ children: shouldRenderImage ? /*#__PURE__*/ _jsx("img", {
195
+ src: src,
196
+ className: classes.image,
197
+ onError: function() {
198
+ return setImgLoadError(true);
199
+ },
200
+ role: "none"
201
+ }) : renderText(size, letters) || /*#__PURE__*/ _jsx(Icon, {
202
+ size: iconSize,
203
+ color: "currentColor"
204
+ })
205
+ })
206
+ });
207
+ };
208
+ export default Avatar;
package/dist-es/badge.js CHANGED
@@ -26,8 +26,14 @@ var useStyles = createUseStyles(function(theme) {
26
26
  var hasChildren = param.hasChildren;
27
27
  return hasChildren ? "absolute" : "static";
28
28
  },
29
- top: -2,
30
- right: -6,
29
+ top: function(param) {
30
+ var top = param.top;
31
+ return top !== null && top !== void 0 ? top : -2;
32
+ },
33
+ right: function(param) {
34
+ var right = param.right;
35
+ return right !== null && right !== void 0 ? right : -6;
36
+ },
31
37
  width: 8,
32
38
  height: 8,
33
39
  background: theme.colors.badge,
@@ -38,8 +44,14 @@ var useStyles = createUseStyles(function(theme) {
38
44
  display: "flex",
39
45
  alignItems: "center",
40
46
  justifyContent: "center",
41
- top: -8,
42
- right: -9,
47
+ top: function(param) {
48
+ var top = param.top;
49
+ return top !== null && top !== void 0 ? top : -8;
50
+ },
51
+ right: function(param) {
52
+ var right = param.right;
53
+ return right !== null && right !== void 0 ? right : -9;
54
+ },
43
55
  width: 18,
44
56
  height: 18,
45
57
  fontSize: 12,
@@ -47,7 +59,10 @@ var useStyles = createUseStyles(function(theme) {
47
59
  color: theme.colors.textPrimaryInverse
48
60
  },
49
61
  badgeBigNumber: {
50
- right: -14,
62
+ right: function(param) {
63
+ var right = param.right;
64
+ return right !== null && right !== void 0 ? right : -14;
65
+ },
51
66
  width: 24,
52
67
  borderRadius: 24
53
68
  }
@@ -63,10 +78,12 @@ var useStyles = createUseStyles(function(theme) {
63
78
  * </IconButton>
64
79
  * </Badge>
65
80
  */ var Badge = function(param) {
66
- var children = param.children, value = param.value;
81
+ var children = param.children, value = param.value, right = param.right, top = param.top;
67
82
  var hasChildren = !!children;
68
83
  var classes = useStyles({
69
- hasChildren: hasChildren
84
+ hasChildren: hasChildren,
85
+ right: right,
86
+ top: top
70
87
  });
71
88
  if (children && value === 0) {
72
89
  return /*#__PURE__*/ _jsx(_Fragment, {
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, useTrackingConfig } 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 eventFormat = useTrackingConfig().eventFormat;
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 (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"],
@@ -463,15 +476,27 @@ export var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
463
476
  var formStatus = useForm().formStatus;
464
477
  var classes = useButtonLinkStyles();
465
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
+ };
466
495
  var _trackingEvent;
467
496
  var _obj;
468
497
  var commonProps = {
469
498
  className: classnames(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
470
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
471
- category: eventCategories.userInteraction,
472
- action: eventActions.linkTapped,
473
- label: getTextFromChildren(props.children)
474
- } : undefined,
499
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
475
500
  dataAttributes: props.dataAttributes,
476
501
  children: /*#__PURE__*/ _jsx(Text2, {
477
502
  medium: true,
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";
@@ -96,6 +142,10 @@ var useStyles = createUseStyles(function() {
96
142
  height: "100%",
97
143
  top: 0,
98
144
  left: 0
145
+ },
146
+ opacity: function(param) {
147
+ var isError = param.isError;
148
+ return isError ? 0 : 1;
99
149
  }
100
150
  },
101
151
  wrapper: {
@@ -127,16 +177,19 @@ export var RATIO = {
127
177
  "4:3": 4 / 3
128
178
  };
129
179
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
130
- 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, [
131
181
  "aspectRatio",
132
182
  "alt",
133
183
  "dataAttributes",
134
184
  "noBorderRadius",
135
- "src"
185
+ "src",
186
+ "onError",
187
+ "onLoad"
136
188
  ]);
137
189
  var supportsAspectRatio = useSupportsAspectRatio();
138
190
  var noBorderRadiusContext = useDisableBorderRadius();
139
191
  var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
192
+ var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
140
193
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
141
194
  // if width or height are numeric, we can calculate the other with the ratio without css.
142
195
  // if aspect ratio is 0, we use the original image proportions
@@ -144,7 +197,8 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
144
197
  var classes = useStyles({
145
198
  noBorderRadius: noBorderSetting,
146
199
  aspectRatio: withCssAspectRatio ? ratio : undefined,
147
- width: props.width
200
+ width: props.width,
201
+ isError: isError
148
202
  });
149
203
  var width = props.width;
150
204
  var height = props.height;
@@ -159,11 +213,21 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
159
213
  width = props.width || "100%";
160
214
  }
161
215
  var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
162
- 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), {
163
219
  ref: ref,
164
220
  src: src,
165
221
  className: classes.image,
166
- 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
+ }
167
231
  }, !needsWrapper ? {
168
232
  width: width,
169
233
  height: height
package/dist-es/index.js CHANGED
@@ -36,7 +36,8 @@ 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 { Placeholder, AvatarPlaceholder } from "./placeholder";
39
+ export { Placeholder } from "./placeholder";
40
+ export { Title1, Title2 } from "./title";
40
41
  export { RowList, Row, BoxedRowList, BoxedRow } from "./list";
41
42
  export { default as Switch } from "./switch-component";
42
43
  export { default as Checkbox } from "./checkbox";
@@ -53,6 +54,7 @@ export { default as Menu } from "./menu";
53
54
  export { default as EmptyState } from "./empty-state";
54
55
  export { default as EmptyStateCard } from "./empty-state-card";
55
56
  export { default as Callout } from "./callout";
57
+ export { default as Avatar } from "./avatar";
56
58
  export { useModalState } from "./modal-context-provider";
57
59
  export { NavigationBar, MainNavigationBar, FunnelNavigationBar, NavigationBarActionGroup, NavigationBarAction, NavigationBarLogo } from "./navigation-bar";
58
60
  export { default as Image } from "./image";
@@ -88,6 +90,7 @@ export { default as IconSuccess } from "./icons/icon-success";
88
90
  export { default as IconSuccessVivo } from "./icons/icon-success-vivo";
89
91
  export { default as Circle } from "./circle";
90
92
  export { useTheme, useScreenSize, useElementDimensions, useAriaId, useWindowSize, useWindowHeight, useWindowWidth, useIsInViewport } from "./hooks";
93
+ export { TrackingConfig, useTrackingConfig } from "./utils/analytics";
91
94
  export { useDocumentVisibility } from "./utils/document-visibility";
92
95
  export { ThemeVariant, useIsInverseVariant } from "./theme-variant-context";
93
96
  export { VIVO_SKIN, O2_CLASSIC_SKIN, O2_SKIN, MOVISTAR_SKIN, TELEFONICA_SKIN, BLAU_SKIN } from "./skins/constants";
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = "11.7.0";
2
+ export var PACKAGE_VERSION = "11.10.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) {
@@ -2,17 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { applyAlpha } from "./utils/color";
4
4
  import { useTheme } from "./hooks";
5
- export var AvatarPlaceholder = function(param) {
6
- var _size = param.size, size = _size === void 0 ? "100%" : _size;
7
- return /*#__PURE__*/ _jsx("div", {
8
- style: {
9
- width: size,
10
- height: size,
11
- borderRadius: "50%",
12
- background: "gray"
13
- }
14
- });
15
- };
16
5
  export var Placeholder = function(param) {
17
6
  var _width = param.width, width = _width === void 0 ? "auto" : _width, _height = param.height, height = _height === void 0 ? 120 : _height;
18
7
  var colors = useTheme().colors;
@@ -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,7 @@ 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, useTrackingConfig } from "./utils/analytics";
65
65
  var useStyles = createUseStyles(function(theme) {
66
66
  var _obj;
67
67
  return {
@@ -96,14 +96,26 @@ var TextLink = function(_param) {
96
96
  var classes = useStyles();
97
97
  var isInverse = useIsInverseVariant();
98
98
  var formStatus = useForm().formStatus;
99
+ var eventFormat = useTrackingConfig().eventFormat;
100
+ var createDefaultTrackingEvent = function() {
101
+ if (eventFormat === "google-analytics-4") {
102
+ return {
103
+ name: eventNames.userInteraction,
104
+ component_type: "link",
105
+ component_copy: getTextFromChildren(children)
106
+ };
107
+ } else {
108
+ return {
109
+ category: eventCategories.userInteraction,
110
+ action: eventActions.linkTapped,
111
+ label: getTextFromChildren(children)
112
+ };
113
+ }
114
+ };
99
115
  var _trackingEvent;
100
116
  var _obj;
101
117
  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,
118
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
107
119
  disabled: disabled || formStatus === "sending",
108
120
  className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
109
121
  children: children
package/dist-es/text.js CHANGED
@@ -101,8 +101,14 @@ var useStyles = createUseStyles(function(theme) {
101
101
  "-webkit-line-clamp": lineClamp,
102
102
  lineClamp: lineClamp,
103
103
  wordBreak: function(param) {
104
- var truncate = param.truncate;
105
- return truncate === 1 || truncate === true ? "break-all" : "normal";
104
+ var wordBreak = param.wordBreak;
105
+ return wordBreak ? "break-all" : "normal";
106
+ },
107
+ "@supports (overflow-wrap: anywhere)": {
108
+ wordBreak: function(param) {
109
+ var truncate = param.truncate;
110
+ return truncate === 1 || truncate === true ? "break-all" : "normal";
111
+ }
106
112
  },
107
113
  display: "box",
108
114
  boxOrient: "vertical",