@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
package/dist/button.d.ts CHANGED
@@ -59,6 +59,7 @@ export interface SubmitButtonProps extends CommonProps {
59
59
  export declare type ButtonProps = FakeButtonProps | SubmitButtonProps | ToButtonProps | OnPressButtonProps | HrefButtonProps;
60
60
  interface ButtonLinkCommonProps {
61
61
  children: React.ReactNode;
62
+ disabled?: boolean;
62
63
  trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
63
64
  trackEvent?: boolean;
64
65
  /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
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"],
@@ -472,7 +485,8 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
472
485
  "@media (pointer: coarse)": {
473
486
  backgroundColor: "initial"
474
487
  }
475
- }
488
+ },
489
+ "&[disabled]": disabledStyle
476
490
  },
477
491
  inverse: {
478
492
  color: theme.colors.textLinkInverse,
@@ -492,24 +506,38 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
492
506
  };
493
507
  });
494
508
  var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
509
+ var formStatus = (0, _formContext).useForm().formStatus;
495
510
  var classes = useButtonLinkStyles();
496
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
+ };
497
528
  var _trackingEvent;
498
529
  var _obj;
499
530
  var commonProps = {
500
531
  className: (0, _classnames).default(classes.link, (_obj = {}, _defineProperty(_obj, classes.inverse, isInverse), _defineProperty(_obj, classes.aligned, props.aligned), _obj)),
501
- trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? {
502
- category: _analytics.eventCategories.userInteraction,
503
- action: _analytics.eventActions.linkTapped,
504
- label: (0, _common).getTextFromChildren(props.children)
505
- } : undefined,
532
+ trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
506
533
  dataAttributes: props.dataAttributes,
507
534
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
508
535
  medium: true,
509
536
  truncate: 1,
510
537
  color: "inherit",
511
538
  children: props.children
512
- })
539
+ }),
540
+ disabled: props.disabled || formStatus === "sending"
513
541
  };
514
542
  if (process.env.NODE_ENV !== "production") {
515
543
  if (props.to === "" || props.href === "") {
@@ -59,6 +59,7 @@ export type ButtonProps =
59
59
  | HrefButtonProps;
60
60
  declare type ButtonLinkCommonProps = {
61
61
  children: React.Node,
62
+ disabled?: boolean,
62
63
  trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
63
64
  trackEvent?: boolean,
64
65
 
package/dist/image.d.ts CHANGED
@@ -14,13 +14,15 @@ export declare type ImageProps = {
14
14
  /** defaults to 100% when no width and no height are given */
15
15
  width?: string | number;
16
16
  height?: string | number;
17
- /** defaults to 1:1, if both width and height are given, aspectRatio is ignored */
17
+ /** defaults to 1:1, if both width and height are given, aspectRatio is ignored. To use original image proportions, set aspectRatio to 0 */
18
18
  aspectRatio?: AspectRatio | number;
19
19
  /** defaults to empty string */
20
20
  alt?: string;
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
@@ -108,22 +154,27 @@ var useStyles = (0, _jss).createUseStyles(function() {
108
154
  objectFit: "cover",
109
155
  maxWidth: "100%",
110
156
  maxHeight: "100%",
157
+ borderRadius: function borderRadius(param) {
158
+ var noBorderRadius = param.noBorderRadius;
159
+ return noBorderRadius ? 0 : 4;
160
+ },
111
161
  "@supports (aspect-ratio: 1 / 1)": {
112
- borderRadius: function borderRadius(param) {
113
- var noBorderRadius = param.noBorderRadius;
114
- return noBorderRadius ? 0 : 4;
115
- },
116
162
  aspectRatio: function aspectRatio(param) {
117
163
  var aspectRatio1 = param.aspectRatio;
118
164
  return aspectRatio1 !== null && aspectRatio1 !== void 0 ? aspectRatio1 : "unset";
119
165
  }
120
166
  },
121
167
  "$wrapper &": {
168
+ borderRadius: 0,
122
169
  position: "absolute",
123
170
  width: "100%",
124
171
  height: "100%",
125
172
  top: 0,
126
173
  left: 0
174
+ },
175
+ opacity: function opacity(param) {
176
+ var isError = param.isError;
177
+ return isError ? 0 : 1;
127
178
  }
128
179
  },
129
180
  wrapper: {
@@ -156,23 +207,28 @@ var RATIO = {
156
207
  };
157
208
  exports.RATIO = RATIO;
158
209
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
159
- 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, [
160
211
  "aspectRatio",
161
212
  "alt",
162
213
  "dataAttributes",
163
214
  "noBorderRadius",
164
- "src"
215
+ "src",
216
+ "onError",
217
+ "onLoad"
165
218
  ]);
166
219
  var supportsAspectRatio = (0, _aspectRatioSupport).useSupportsAspectRatio();
167
220
  var noBorderRadiusContext = useDisableBorderRadius();
168
221
  var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
169
- // if width or height are numeric, we can calculate the other with the ratio without css
170
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number";
222
+ var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
171
223
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
224
+ // if width or height are numeric, we can calculate the other with the ratio without css.
225
+ // if aspect ratio is 0, we use the original image proportions
226
+ var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
172
227
  var classes = useStyles({
173
228
  noBorderRadius: noBorderSetting,
174
229
  aspectRatio: withCssAspectRatio ? ratio : undefined,
175
- width: props.width
230
+ width: props.width,
231
+ isError: isError
176
232
  });
177
233
  var width = props.width;
178
234
  var height = props.height;
@@ -187,11 +243,20 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
187
243
  width = props.width || "100%";
188
244
  }
189
245
  var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
190
- 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), {
191
248
  ref: ref,
192
249
  src: src,
193
250
  className: classes.image,
194
- 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
+ }
195
260
  }, !needsWrapper ? {
196
261
  width: width,
197
262
  height: height
@@ -19,7 +19,7 @@ export type ImageProps = {
19
19
  width?: string | number,
20
20
  height?: string | number,
21
21
  /**
22
- * defaults to 1:1, if both width and height are given, aspectRatio is ignored
22
+ * defaults to 1:1, if both width and height are given, aspectRatio is ignored. To use original image proportions, set aspectRatio to 0
23
23
  */
24
24
  aspectRatio?: AspectRatio | number,
25
25
  /**
@@ -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.5.1";
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) {
@@ -58,7 +58,9 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
58
58
  width: "100%"
59
59
  },
60
60
  layout: (_obj = {
61
- margin: "auto"
61
+ margin: "auto",
62
+ paddingLeft: "env(safe-area-inset-left)",
63
+ paddingRight: "env(safe-area-inset-right)"
62
64
  }, _defineProperty(_obj, theme.mq.largeDesktop, {
63
65
  width: LARGE_DESKTOP_MAX_WIDTH
64
66
  }), _defineProperty(_obj, theme.mq.desktop, {
@@ -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;