@telefonica/mistica 11.7.0 → 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 (41) hide show
  1. package/dist/button.js +35 -10
  2. package/dist/image.d.ts +2 -0
  3. package/dist/image.js +68 -5
  4. package/dist/image.js.flow +2 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +13 -0
  7. package/dist/index.js.flow +1 -0
  8. package/dist/package-version.js +1 -1
  9. package/dist/password-field.js +9 -8
  10. package/dist/section-title.d.ts +3 -0
  11. package/dist/section-title.js +3 -1
  12. package/dist/section-title.js.flow +3 -0
  13. package/dist/text-link.js +18 -5
  14. package/dist/theme-context-provider.js +2 -1
  15. package/dist/theme.d.ts +2 -0
  16. package/dist/theme.js.flow +2 -0
  17. package/dist/title.d.ts +13 -0
  18. package/dist/title.js +87 -0
  19. package/dist/title.js.flow +18 -0
  20. package/dist/utils/analytics.d.ts +3 -0
  21. package/dist/utils/analytics.js +5 -1
  22. package/dist/utils/analytics.js.flow +3 -0
  23. package/dist-es/button.js +36 -11
  24. package/dist-es/image.js +69 -5
  25. package/dist-es/index.js +1 -0
  26. package/dist-es/package-version.js +1 -1
  27. package/dist-es/password-field.js +9 -8
  28. package/dist-es/section-title.js +3 -1
  29. package/dist-es/text-link.js +19 -6
  30. package/dist-es/theme-context-provider.js +2 -1
  31. package/dist-es/title.js +54 -0
  32. package/dist-es/utils/analytics.js +5 -0
  33. package/package.json +3 -3
  34. package/dist/icons/icon-visibility-off.d.ts +0 -7
  35. package/dist/icons/icon-visibility-off.js +0 -49
  36. package/dist/icons/icon-visibility-off.js.flow +0 -9
  37. package/dist/icons/icon-visibility.d.ts +0 -7
  38. package/dist/icons/icon-visibility.js +0 -49
  39. package/dist/icons/icon-visibility.js.flow +0 -9
  40. package/dist-es/icons/icon-visibility-off.js +0 -22
  41. package/dist-es/icons/icon-visibility.js +0 -22
package/dist/button.js CHANGED
@@ -16,6 +16,7 @@ var _text = require("./text");
16
16
  var _box = _interopRequireDefault(require("./box"));
17
17
  var _common = require("./utils/common");
18
18
  var _analytics = require("./utils/analytics");
19
+ var _hooks = require("./hooks");
19
20
  function _interopRequireDefault(obj) {
20
21
  return obj && obj.__esModule ? obj : {
21
22
  default: obj
@@ -305,6 +306,7 @@ var useDangerButtonStyles = (0, _jss).createUseStyles(function(theme) {
305
306
  });
306
307
  });
307
308
  var Button = function Button(props) {
309
+ var analytics = (0, _hooks).useTheme().analytics;
308
310
  var ref = (0, _formContext).useForm(), formStatus = ref.formStatus, formId = ref.formId;
309
311
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
310
312
  var classes = props.classes, loadingText = props.loadingText;
@@ -343,6 +345,21 @@ var Button = function Button(props) {
343
345
  children: text
344
346
  });
345
347
  };
348
+ var createDefaultTrackingEvent = function createDefaultTrackingEvent() {
349
+ if (analytics.eventFormat === "google-analytics-4") {
350
+ return {
351
+ name: _analytics.eventNames.userInteraction,
352
+ component_type: "".concat(props.type, "_button"),
353
+ component_copy: (0, _common).getTextFromChildren(props.children)
354
+ };
355
+ } else {
356
+ return {
357
+ category: _analytics.eventCategories.userInteraction,
358
+ action: "".concat(props.type, "_button_tapped"),
359
+ label: (0, _common).getTextFromChildren(props.children)
360
+ };
361
+ }
362
+ };
346
363
  var _trackingEvent;
347
364
  var _obj;
348
365
  var commonProps = {
@@ -350,11 +367,7 @@ var Button = function Button(props) {
350
367
  style: _objectSpread({
351
368
  cursor: props.fake ? "pointer" : undefined
352
369
  }, props.style),
353
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
354
- category: _analytics.eventCategories.userInteraction,
355
- action: "".concat(props.type, "_button_tapped"),
356
- label: (0, _common).getTextFromChildren(props.children)
357
- } : undefined,
370
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
358
371
  dataAttributes: props.dataAttributes,
359
372
  "aria-controls": props["aria-controls"],
360
373
  "aria-expanded": props["aria-expanded"],
@@ -496,15 +509,27 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
496
509
  var formStatus = (0, _formContext).useForm().formStatus;
497
510
  var classes = useButtonLinkStyles();
498
511
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
512
+ var analytics = (0, _hooks).useTheme().analytics;
513
+ var createDefaultTrackingEvent = function createDefaultTrackingEvent() {
514
+ if (analytics.eventFormat === "google-analytics-4") {
515
+ return {
516
+ name: _analytics.eventNames.userInteraction,
517
+ component_type: "link",
518
+ component_copy: (0, _common).getTextFromChildren(props.children)
519
+ };
520
+ } else {
521
+ return {
522
+ category: _analytics.eventCategories.userInteraction,
523
+ action: _analytics.eventActions.linkTapped,
524
+ label: (0, _common).getTextFromChildren(props.children)
525
+ };
526
+ }
527
+ };
499
528
  var _trackingEvent;
500
529
  var _obj;
501
530
  var commonProps = {
502
531
  className: (0, _classnames).default(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
503
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
504
- category: _analytics.eventCategories.userInteraction,
505
- action: _analytics.eventActions.linkTapped,
506
- label: (0, _common).getTextFromChildren(props.children)
507
- } : undefined,
532
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
508
533
  dataAttributes: props.dataAttributes,
509
534
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
510
535
  medium: true,
package/dist/image.d.ts CHANGED
@@ -21,6 +21,8 @@ export declare type ImageProps = {
21
21
  children?: void;
22
22
  dataAttributes?: DataAttributes;
23
23
  noBorderRadius?: boolean;
24
+ onError?: (event: React.SyntheticEvent) => void;
25
+ onLoad?: (event: React.SyntheticEvent) => void;
24
26
  };
25
27
  declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
26
28
  export default Image;
package/dist/image.js CHANGED
@@ -29,6 +29,14 @@ function _interopRequireWildcard(obj) {
29
29
  return newObj;
30
30
  }
31
31
  }
32
+ function _arrayLikeToArray(arr, len) {
33
+ if (len == null || len > arr.length) len = arr.length;
34
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
35
+ return arr2;
36
+ }
37
+ function _arrayWithHoles(arr) {
38
+ if (Array.isArray(arr)) return arr;
39
+ }
32
40
  function _defineProperty(obj, key, value) {
33
41
  if (key in obj) {
34
42
  Object.defineProperty(obj, key, {
@@ -42,6 +50,33 @@ function _defineProperty(obj, key, value) {
42
50
  }
43
51
  return obj;
44
52
  }
53
+ function _iterableToArrayLimit(arr, i) {
54
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
55
+ if (_i == null) return;
56
+ var _arr = [];
57
+ var _n = true;
58
+ var _d = false;
59
+ var _s, _e;
60
+ try {
61
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
62
+ _arr.push(_s.value);
63
+ if (i && _arr.length === i) break;
64
+ }
65
+ } catch (err) {
66
+ _d = true;
67
+ _e = err;
68
+ } finally{
69
+ try {
70
+ if (!_n && _i["return"] != null) _i["return"]();
71
+ } finally{
72
+ if (_d) throw _e;
73
+ }
74
+ }
75
+ return _arr;
76
+ }
77
+ function _nonIterableRest() {
78
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
79
+ }
45
80
  function _objectSpread(target) {
46
81
  var _arguments = arguments, _loop = function(i) {
47
82
  var source = _arguments[i] != null ? _arguments[i] : {};
@@ -85,6 +120,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
85
120
  }
86
121
  return target;
87
122
  }
123
+ function _slicedToArray(arr, i) {
124
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
125
+ }
126
+ function _unsupportedIterableToArray(o, minLen) {
127
+ if (!o) return;
128
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
129
+ var n = Object.prototype.toString.call(o).slice(8, -1);
130
+ if (n === "Object" && o.constructor) n = o.constructor.name;
131
+ if (n === "Map" || n === "Set") return Array.from(n);
132
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
133
+ }
88
134
  /**
89
135
  * This context is used internally to disable the border radius. This is useful for example
90
136
  * when using the Image component inside a Card
@@ -125,6 +171,10 @@ var useStyles = (0, _jss).createUseStyles(function() {
125
171
  height: "100%",
126
172
  top: 0,
127
173
  left: 0
174
+ },
175
+ opacity: function opacity(param) {
176
+ var isError = param.isError;
177
+ return isError ? 0 : 1;
128
178
  }
129
179
  },
130
180
  wrapper: {
@@ -157,16 +207,19 @@ var RATIO = {
157
207
  };
158
208
  exports.RATIO = RATIO;
159
209
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
160
- 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, [
210
+ 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, [
161
211
  "aspectRatio",
162
212
  "alt",
163
213
  "dataAttributes",
164
214
  "noBorderRadius",
165
- "src"
215
+ "src",
216
+ "onError",
217
+ "onLoad"
166
218
  ]);
167
219
  var supportsAspectRatio = (0, _aspectRatioSupport).useSupportsAspectRatio();
168
220
  var noBorderRadiusContext = useDisableBorderRadius();
169
221
  var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
222
+ var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
170
223
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
171
224
  // if width or height are numeric, we can calculate the other with the ratio without css.
172
225
  // if aspect ratio is 0, we use the original image proportions
@@ -174,7 +227,8 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
174
227
  var classes = useStyles({
175
228
  noBorderRadius: noBorderSetting,
176
229
  aspectRatio: withCssAspectRatio ? ratio : undefined,
177
- width: props.width
230
+ width: props.width,
231
+ isError: isError
178
232
  });
179
233
  var width = props.width;
180
234
  var height = props.height;
@@ -189,11 +243,20 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
189
243
  width = props.width || "100%";
190
244
  }
191
245
  var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
192
- var img = /*#__PURE__*/ (0, _jsxRuntime).jsx("img", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
246
+ var img = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
247
+ /*#__PURE__*/ (0, _jsxRuntime).jsx("img", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
193
248
  ref: ref,
194
249
  src: src,
195
250
  className: classes.image,
196
- alt: alt
251
+ alt: alt,
252
+ onError: function onError1(event) {
253
+ setIsError(true);
254
+ onError === null || onError === void 0 ? void 0 : onError(event);
255
+ },
256
+ onLoad: function onLoad1(event) {
257
+ setIsError(false);
258
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
259
+ }
197
260
  }, !needsWrapper ? {
198
261
  width: width,
199
262
  height: height
@@ -28,6 +28,8 @@ export type ImageProps = {
28
28
  alt?: string,
29
29
  dataAttributes?: DataAttributes,
30
30
  noBorderRadius?: boolean,
31
+ onError?: (event: SyntheticEvent<any>) => void,
32
+ onLoad?: (event: SyntheticEvent<any>) => void,
31
33
  };
32
34
  declare var Image: React.AbstractComponent<ImageProps, HTMLImageElement>;
33
35
  declare export default typeof Image;
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { default as Text, Text1, Text2, Text3, Text4, Text5, Text6, Text7, Text8
37
37
  export { default as Tag } from './tag';
38
38
  export type { TagType } from './tag';
39
39
  export { default as SectionTitle } from './section-title';
40
+ export { Title1, Title2 } from './title';
40
41
  export { Placeholder, AvatarPlaceholder } from './placeholder';
41
42
  export { RowList, Row, BoxedRowList, BoxedRow } from './list';
42
43
  export { default as Switch } from './switch-component';
package/dist/index.js CHANGED
@@ -374,6 +374,18 @@ Object.defineProperty(exports, "SectionTitle", {
374
374
  return _sectionTitle.default;
375
375
  }
376
376
  });
377
+ Object.defineProperty(exports, "Title1", {
378
+ enumerable: true,
379
+ get: function() {
380
+ return _title.Title1;
381
+ }
382
+ });
383
+ Object.defineProperty(exports, "Title2", {
384
+ enumerable: true,
385
+ get: function() {
386
+ return _title.Title2;
387
+ }
388
+ });
377
389
  Object.defineProperty(exports, "Placeholder", {
378
390
  enumerable: true,
379
391
  get: function() {
@@ -10768,6 +10780,7 @@ var _navigationBreadcrumbs = _interopRequireDefault(require("./navigation-breadc
10768
10780
  var _text = _interopRequireWildcard(require("./text"));
10769
10781
  var _tag = _interopRequireDefault(require("./tag"));
10770
10782
  var _sectionTitle = _interopRequireDefault(require("./section-title"));
10783
+ var _title = require("./title");
10771
10784
  var _placeholder = require("./placeholder");
10772
10785
  var _list = require("./list");
10773
10786
  var _switchComponent = _interopRequireDefault(require("./switch-component"));
@@ -73,6 +73,7 @@ declare export {
73
73
  declare export { default as Tag } from "./tag";
74
74
  export type { TagType } from "./tag";
75
75
  declare export { default as SectionTitle } from "./section-title";
76
+ declare export { Title1, Title2 } from "./title";
76
77
  declare export { Placeholder, AvatarPlaceholder } from "./placeholder";
77
78
  declare export { RowList, Row, BoxedRowList, BoxedRow } from "./list";
78
79
  declare export { default as Switch } from "./switch-component";
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.PACKAGE_VERSION = void 0;
6
- var PACKAGE_VERSION = "11.7.0";
6
+ var PACKAGE_VERSION = "11.8.0";
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -9,8 +9,8 @@ var _formContext = require("./form-context");
9
9
  var _textFieldBase = require("./text-field-base");
10
10
  var _hooks = require("./hooks");
11
11
  var _iconButton = _interopRequireDefault(require("./icon-button"));
12
- var _iconVisibility = _interopRequireDefault(require("./icons/icon-visibility"));
13
- var _iconVisibilityOff = _interopRequireDefault(require("./icons/icon-visibility-off"));
12
+ var _iconAccesibilityRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-accesibility-regular"));
13
+ var _iconEyeRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-eye-regular"));
14
14
  var _jss = require("./jss");
15
15
  function _interopRequireDefault(obj) {
16
16
  return obj && obj.__esModule ? obj : {
@@ -144,7 +144,7 @@ var usePasswordAdornmentStyles = (0, _jss).createUseStyles(function(theme) {
144
144
  return {
145
145
  shadow: _defineProperty({}, theme.mq.supportsHover, {
146
146
  "&:hover": {
147
- backgroundColor: "rgba(0, 0, 0, 0.08)"
147
+ backgroundColor: theme.colors.backgroundAlternative
148
148
  }
149
149
  })
150
150
  };
@@ -155,10 +155,11 @@ var PasswordAdornment = function PasswordAdornment(param) {
155
155
  var classes = usePasswordAdornmentStyles();
156
156
  var style = {
157
157
  backgroundSize: "200%",
158
- padding: 12,
159
- margin: -12,
158
+ padding: 8,
159
+ margin: -8,
160
160
  borderRadius: "50%",
161
- backgroundColor: undefined
161
+ backgroundColor: undefined,
162
+ transition: "background-color 0.2s ease-in-out"
162
163
  };
163
164
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
164
165
  "aria-label": texts.togglePasswordVisibilityLabel,
@@ -166,10 +167,10 @@ var PasswordAdornment = function PasswordAdornment(param) {
166
167
  setVisibility(!isVisible);
167
168
  focus();
168
169
  },
169
- size: 48,
170
+ size: 40,
170
171
  className: classes.shadow,
171
172
  style: style,
172
- children: isVisible ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconVisibilityOff.default, {}) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconVisibility.default, {})
173
+ children: isVisible ? /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconAccesibilityRegular.default, {}) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconEyeRegular.default, {})
173
174
  });
174
175
  };
175
176
  var PasswordField = function PasswordField(_param) {
@@ -5,5 +5,8 @@ declare type Props = {
5
5
  right?: React.ReactNode;
6
6
  as?: 'h1' | 'h2' | 'h3' | 'h4';
7
7
  };
8
+ /**
9
+ * @deprecated use Title1 instead
10
+ */
8
11
  declare const SectionTitle: React.FC<Props>;
9
12
  export default SectionTitle;
@@ -61,7 +61,9 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
61
61
  })
62
62
  };
63
63
  });
64
- var SectionTitle = function SectionTitle(param) {
64
+ /**
65
+ * @deprecated use Title1 instead
66
+ */ var SectionTitle = function SectionTitle(param) {
65
67
  var children = param.children, id = param.id, right = param.right, _as = param.as, as = _as === void 0 ? "h3" : _as;
66
68
  var classes = useStyles();
67
69
  var theme = (0, _hooks).useTheme();
@@ -7,5 +7,8 @@ declare type Props = {
7
7
  right?: React.Node,
8
8
  as?: "h1" | "h2" | "h3" | "h4",
9
9
  };
10
+ /**
11
+ * @deprecated use Title1 instead
12
+ */
10
13
  declare var SectionTitle: React.ComponentType<Props>;
11
14
  declare export default typeof SectionTitle;
package/dist/text-link.js CHANGED
@@ -12,6 +12,7 @@ var _themeVariantContext = require("./theme-variant-context");
12
12
  var _formContext = require("./form-context");
13
13
  var _common = require("./utils/common");
14
14
  var _analytics = require("./utils/analytics");
15
+ var _hooks = require("./hooks");
15
16
  function _interopRequireDefault(obj) {
16
17
  return obj && obj.__esModule ? obj : {
17
18
  default: obj
@@ -128,14 +129,26 @@ var TextLink = function TextLink(_param) {
128
129
  var classes = useStyles();
129
130
  var isInverse = (0, _themeVariantContext).useIsInverseVariant();
130
131
  var formStatus = (0, _formContext).useForm().formStatus;
132
+ var analytics = (0, _hooks).useTheme().analytics;
133
+ var createDefaultTrackingEvent = function createDefaultTrackingEvent() {
134
+ if (analytics.eventFormat === "google-analytics-4") {
135
+ return {
136
+ name: _analytics.eventNames.userInteraction,
137
+ component_type: "link",
138
+ component_copy: (0, _common).getTextFromChildren(children)
139
+ };
140
+ } else {
141
+ return {
142
+ category: _analytics.eventCategories.userInteraction,
143
+ action: _analytics.eventActions.linkTapped,
144
+ label: (0, _common).getTextFromChildren(children)
145
+ };
146
+ }
147
+ };
131
148
  var _trackingEvent;
132
149
  var _obj;
133
150
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({}, props, {
134
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
135
- category: _analytics.eventCategories.userInteraction,
136
- action: _analytics.eventActions.linkTapped,
137
- label: (0, _common).getTextFromChildren(children)
138
- } : undefined,
151
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
139
152
  disabled: disabled || formStatus === "sending",
140
153
  className: (0, _classnames).default(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
141
154
  children: children
@@ -206,7 +206,8 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
206
206
  analytics: _objectSpread({
207
207
  logEvent: function logEvent() {
208
208
  return Promise.resolve();
209
- }
209
+ },
210
+ eventFormat: "universal-analytics"
210
211
  }, theme.analytics),
211
212
  dimensions: _objectSpread({}, _theme.dimensions, theme.dimensions),
212
213
  mq: (0, _mediaQueries).createMediaQueries((_mediaQueries1 = theme.mediaQueries) !== null && _mediaQueries1 !== void 0 ? _mediaQueries1 : _theme.mediaQueriesConfig),
package/dist/theme.d.ts CHANGED
@@ -89,6 +89,7 @@ export declare type ThemeConfig = {
89
89
  texts?: Partial<ThemeTexts>;
90
90
  analytics?: {
91
91
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>;
92
+ eventFormat?: 'universal-analytics' | 'google-analytics-4';
92
93
  };
93
94
  dimensions?: {
94
95
  headerMobileHeight: number;
@@ -117,6 +118,7 @@ export declare type Theme = {
117
118
  texts: ThemeTexts;
118
119
  analytics: {
119
120
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>;
121
+ eventFormat: 'universal-analytics' | 'google-analytics-4';
120
122
  };
121
123
  dimensions: {
122
124
  headerMobileHeight: number;
@@ -93,6 +93,7 @@ export type ThemeConfig = {
93
93
  texts?: $Shape<ThemeTexts>,
94
94
  analytics?: {
95
95
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>,
96
+ eventFormat?: "universal-analytics" | "google-analytics-4",
96
97
  },
97
98
  dimensions?: {
98
99
  headerMobileHeight: number,
@@ -121,6 +122,7 @@ export type Theme = {
121
122
  texts: ThemeTexts,
122
123
  analytics: {
123
124
  logEvent: (trackingEvent: TrackingEvent) => Promise<void>,
125
+ eventFormat: "universal-analytics" | "google-analytics-4",
124
126
  },
125
127
  dimensions: {
126
128
  headerMobileHeight: number,
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import type { DataAttributes } from './utils/types';
3
+ declare type TitleProps = {
4
+ children: React.ReactNode;
5
+ id?: string;
6
+ right?: React.ReactNode;
7
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
8
+ /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
9
+ dataAttributes?: DataAttributes;
10
+ };
11
+ export declare const Title1: ({ children, as, id, right, dataAttributes }: TitleProps) => React.ReactElement;
12
+ export declare const Title2: ({ children, as, id, right, dataAttributes }: TitleProps) => React.ReactElement;
13
+ export {};
package/dist/title.js ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.Title2 = exports.Title1 = void 0;
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _text = require("./text");
9
+ var _hooks = require("./hooks");
10
+ var _inline = _interopRequireDefault(require("./inline"));
11
+ var _box = _interopRequireDefault(require("./box"));
12
+ function _interopRequireDefault(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function _interopRequireWildcard(obj) {
18
+ if (obj && obj.__esModule) {
19
+ return obj;
20
+ } else {
21
+ var newObj = {};
22
+ if (obj != null) {
23
+ for(var key in obj){
24
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
25
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
26
+ if (desc.get || desc.set) {
27
+ Object.defineProperty(newObj, key, desc);
28
+ } else {
29
+ newObj[key] = obj[key];
30
+ }
31
+ }
32
+ }
33
+ }
34
+ newObj.default = obj;
35
+ return newObj;
36
+ }
37
+ }
38
+ var TitleLayout = function TitleLayout(param) {
39
+ var title = param.title, right = param.right;
40
+ if (!right) {
41
+ return title;
42
+ }
43
+ return /*#__PURE__*/ (0, _jsxRuntime).jsxs(_inline.default, {
44
+ space: "between",
45
+ alignItems: "baseline",
46
+ children: [
47
+ title,
48
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
49
+ paddingLeft: 16,
50
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
51
+ regular: true,
52
+ children: right
53
+ })
54
+ })
55
+ ]
56
+ });
57
+ };
58
+ var Title1 = function Title1(param) {
59
+ var children = param.children, _as = param.as, as = _as === void 0 ? "h3" : _as, id = param.id, right = param.right, dataAttributes = param.dataAttributes;
60
+ var theme = (0, _hooks).useTheme();
61
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx(TitleLayout, {
62
+ title: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text1, {
63
+ color: theme.colors.textSecondary,
64
+ transform: "uppercase",
65
+ medium: true,
66
+ as: as,
67
+ id: id,
68
+ dataAttributes: dataAttributes,
69
+ children: children
70
+ }),
71
+ right: right
72
+ });
73
+ };
74
+ exports.Title1 = Title1;
75
+ var Title2 = function Title2(param) {
76
+ var children = param.children, _as = param.as, as = _as === void 0 ? "h3" : _as, id = param.id, right = param.right, dataAttributes = param.dataAttributes;
77
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx(TitleLayout, {
78
+ title: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text5, {
79
+ as: as,
80
+ id: id,
81
+ dataAttributes: dataAttributes,
82
+ children: children
83
+ }),
84
+ right: right
85
+ });
86
+ };
87
+ exports.Title2 = Title2;
@@ -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-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"],
@@ -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,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.7.0";
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) {
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "11.7.0",
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;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = void 0;
6
- var _jsxRuntime = require("react/jsx-runtime");
7
- var React = _interopRequireWildcard(require("react"));
8
- function _interopRequireWildcard(obj) {
9
- if (obj && obj.__esModule) {
10
- return obj;
11
- } else {
12
- var newObj = {};
13
- if (obj != null) {
14
- for(var key in obj){
15
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
16
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
17
- if (desc.get || desc.set) {
18
- Object.defineProperty(newObj, key, desc);
19
- } else {
20
- newObj[key] = obj[key];
21
- }
22
- }
23
- }
24
- }
25
- newObj.default = obj;
26
- return newObj;
27
- }
28
- }
29
- var IconVisibilityOff = function IconVisibilityOff(param) {
30
- var _role = param.role, role = _role === void 0 ? "presentation" : _role, _size = param.size, size = _size === void 0 ? 24 : _size;
31
- return /*#__PURE__*/ (0, _jsxRuntime).jsxs("svg", {
32
- role: role,
33
- width: size,
34
- height: size,
35
- viewBox: "0 0 ".concat(size, " ").concat(size),
36
- children: [
37
- /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
38
- d: "M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z",
39
- fill: "none"
40
- }),
41
- /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
42
- fill: "#757575",
43
- d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
44
- })
45
- ]
46
- });
47
- };
48
- var _default = IconVisibilityOff;
49
- exports.default = _default;
@@ -1,9 +0,0 @@
1
- // @flow
2
-
3
- import * as React from "react";
4
- declare type Props = {
5
- role?: string,
6
- size?: number,
7
- };
8
- declare var IconVisibilityOff: React.ComponentType<Props>;
9
- declare export default typeof IconVisibilityOff;
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- declare type Props = {
3
- role?: string;
4
- size?: number;
5
- };
6
- declare const IconVisibility: React.FC<Props>;
7
- export default IconVisibility;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- exports.default = void 0;
6
- var _jsxRuntime = require("react/jsx-runtime");
7
- var React = _interopRequireWildcard(require("react"));
8
- function _interopRequireWildcard(obj) {
9
- if (obj && obj.__esModule) {
10
- return obj;
11
- } else {
12
- var newObj = {};
13
- if (obj != null) {
14
- for(var key in obj){
15
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
16
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
17
- if (desc.get || desc.set) {
18
- Object.defineProperty(newObj, key, desc);
19
- } else {
20
- newObj[key] = obj[key];
21
- }
22
- }
23
- }
24
- }
25
- newObj.default = obj;
26
- return newObj;
27
- }
28
- }
29
- var IconVisibility = function IconVisibility(param) {
30
- var _role = param.role, role = _role === void 0 ? "presentation" : _role, _size = param.size, size = _size === void 0 ? 24 : _size;
31
- return /*#__PURE__*/ (0, _jsxRuntime).jsxs("svg", {
32
- role: role,
33
- width: size,
34
- height: size,
35
- viewBox: "0 0 ".concat(size, " ").concat(size),
36
- children: [
37
- /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
38
- d: "M0 0h24v24H0z",
39
- fill: "none"
40
- }),
41
- /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
42
- fill: "#757575",
43
- d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
44
- })
45
- ]
46
- });
47
- };
48
- var _default = IconVisibility;
49
- exports.default = _default;
@@ -1,9 +0,0 @@
1
- // @flow
2
-
3
- import * as React from "react";
4
- declare type Props = {
5
- role?: string,
6
- size?: number,
7
- };
8
- declare var IconVisibility: React.ComponentType<Props>;
9
- declare export default typeof IconVisibility;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- var IconVisibilityOff = function(param) {
4
- var _role = param.role, role = _role === void 0 ? "presentation" : _role, _size = param.size, size = _size === void 0 ? 24 : _size;
5
- return /*#__PURE__*/ _jsxs("svg", {
6
- role: role,
7
- width: size,
8
- height: size,
9
- viewBox: "0 0 ".concat(size, " ").concat(size),
10
- children: [
11
- /*#__PURE__*/ _jsx("path", {
12
- d: "M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z",
13
- fill: "none"
14
- }),
15
- /*#__PURE__*/ _jsx("path", {
16
- fill: "#757575",
17
- d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
18
- })
19
- ]
20
- });
21
- };
22
- export default IconVisibilityOff;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from "react";
3
- var IconVisibility = function(param) {
4
- var _role = param.role, role = _role === void 0 ? "presentation" : _role, _size = param.size, size = _size === void 0 ? 24 : _size;
5
- return /*#__PURE__*/ _jsxs("svg", {
6
- role: role,
7
- width: size,
8
- height: size,
9
- viewBox: "0 0 ".concat(size, " ").concat(size),
10
- children: [
11
- /*#__PURE__*/ _jsx("path", {
12
- d: "M0 0h24v24H0z",
13
- fill: "none"
14
- }),
15
- /*#__PURE__*/ _jsx("path", {
16
- fill: "#757575",
17
- d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
18
- })
19
- ]
20
- });
21
- };
22
- export default IconVisibility;