@telefonica/mistica 12.5.0 → 12.7.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 (79) hide show
  1. package/dist/carousel.js +5 -3
  2. package/dist/dialog.d.ts +20 -5
  3. package/dist/dialog.js +39 -14
  4. package/dist/dialog.js.flow +24 -7
  5. package/dist/fixed-footer-layout.js +31 -9
  6. package/dist/generated/mistica-icons/icon-buy-data-light.js +5 -11
  7. package/dist/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  8. package/dist/generated/mistica-icons/icon-eco-light.js +1 -1
  9. package/dist/generated/mistica-icons/icon-justice-regular.js +1 -1
  10. package/dist/generated/mistica-icons/icon-tokens-filled.d.ts +4 -0
  11. package/dist/generated/mistica-icons/icon-tokens-filled.js +109 -0
  12. package/dist/generated/mistica-icons/icon-tokens-filled.js.flow +6 -0
  13. package/dist/generated/mistica-icons/icon-tokens-light.d.ts +4 -0
  14. package/dist/generated/mistica-icons/icon-tokens-light.js +109 -0
  15. package/dist/generated/mistica-icons/icon-tokens-light.js.flow +6 -0
  16. package/dist/generated/mistica-icons/icon-tokens-regular.d.ts +4 -0
  17. package/dist/generated/mistica-icons/icon-tokens-regular.js +109 -0
  18. package/dist/generated/mistica-icons/icon-tokens-regular.js.flow +6 -0
  19. package/dist/hooks.d.ts +3 -0
  20. package/dist/hooks.js +16 -3
  21. package/dist/hooks.js.flow +3 -0
  22. package/dist/image.d.ts +2 -0
  23. package/dist/image.js +118 -80
  24. package/dist/image.js.flow +2 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +28 -0
  27. package/dist/index.js.flow +4 -0
  28. package/dist/navigation-bar.js +7 -9
  29. package/dist/package-version.js +1 -1
  30. package/dist/skeletons.d.ts +5 -2
  31. package/dist/skeletons.js +50 -87
  32. package/dist/skeletons.js.flow +4 -4
  33. package/dist/skins/o2.js +1 -1
  34. package/dist/text-field-base.d.ts +0 -1
  35. package/dist/text-field-base.js +23 -5
  36. package/dist/text-field-base.js.flow +0 -1
  37. package/dist/text-field-components.d.ts +1 -0
  38. package/dist/text-field-components.js +7 -3
  39. package/dist/text-field-components.js.flow +1 -0
  40. package/dist/text-link.js +2 -1
  41. package/dist/theme.d.ts +2 -0
  42. package/dist/theme.js +2 -1
  43. package/dist/theme.js.flow +2 -0
  44. package/dist/tooltip.d.ts +2 -0
  45. package/dist/tooltip.js +234 -78
  46. package/dist/tooltip.js.flow +2 -0
  47. package/dist/touchable.d.ts +1 -0
  48. package/dist/touchable.js +6 -1
  49. package/dist/touchable.js.flow +1 -0
  50. package/dist/utils/aspect-ratio-support.d.ts +10 -0
  51. package/dist/utils/aspect-ratio-support.js +115 -1
  52. package/dist/utils/aspect-ratio-support.js.flow +14 -0
  53. package/dist/video.js +20 -79
  54. package/dist-es/carousel.js +5 -3
  55. package/dist-es/dialog.js +40 -15
  56. package/dist-es/fixed-footer-layout.js +32 -10
  57. package/dist-es/generated/mistica-icons/icon-buy-data-light.js +6 -12
  58. package/dist-es/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  59. package/dist-es/generated/mistica-icons/icon-eco-light.js +1 -1
  60. package/dist-es/generated/mistica-icons/icon-justice-regular.js +1 -1
  61. package/dist-es/generated/mistica-icons/icon-tokens-filled.js +85 -0
  62. package/dist-es/generated/mistica-icons/icon-tokens-light.js +85 -0
  63. package/dist-es/generated/mistica-icons/icon-tokens-regular.js +85 -0
  64. package/dist-es/hooks.js +14 -2
  65. package/dist-es/image.js +115 -83
  66. package/dist-es/index.js +4 -0
  67. package/dist-es/navigation-bar.js +7 -9
  68. package/dist-es/package-version.js +1 -1
  69. package/dist-es/skeletons.js +50 -87
  70. package/dist-es/skins/o2.js +1 -1
  71. package/dist-es/text-field-base.js +25 -7
  72. package/dist-es/text-field-components.js +7 -3
  73. package/dist-es/text-link.js +3 -1
  74. package/dist-es/theme.js +2 -1
  75. package/dist-es/tooltip.js +234 -78
  76. package/dist-es/touchable.js +6 -1
  77. package/dist-es/utils/aspect-ratio-support.js +112 -0
  78. package/dist-es/video.js +21 -81
  79. package/package.json +2 -1
@@ -32,12 +32,13 @@ import * as React from "react";
32
32
  import SkeletonBase from "./skeleton-base";
33
33
  import { createUseStyles } from "./jss";
34
34
  import Stack from "./stack";
35
- import classNames from "classnames";
36
35
  import { getPrefixedDataAttributes } from "./utils/dom";
37
36
  var transition = "1.5s linear";
38
37
  var useAnimation = createUseStyles(function() {
39
38
  return {
40
39
  animation: {
40
+ width: "100%",
41
+ height: "100%",
41
42
  animation: "$pulse ".concat(transition, " infinite")
42
43
  },
43
44
  "@keyframes pulse": {
@@ -53,73 +54,50 @@ var useAnimation = createUseStyles(function() {
53
54
  }
54
55
  };
55
56
  });
56
- var useSkeletonStyles = createUseStyles(function() {
57
- return {
58
- wrap: {
59
- borderRadius: 8,
60
- height: function(param) {
61
- var _height = param.height, height = _height === void 0 ? 8 : _height;
62
- return height;
63
- },
64
- width: function(param) {
65
- var _width = param.width, width = _width === void 0 ? "100%" : _width;
66
- return width;
67
- }
68
- }
69
- };
70
- });
71
- export var SkeletonLine = function(param) {
72
- var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
57
+ var SkeletonAnimation = function(param) {
58
+ var children = param.children, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
73
59
  var animationClasses = useAnimation();
74
- var styleClass = useSkeletonStyles({
75
- width: width
76
- });
77
60
  return /*#__PURE__*/ _jsx("div", _objectSpread({
78
- className: "".concat(animationClasses.animation, " ").concat(styleClass.wrap),
61
+ className: animationClasses.animation,
79
62
  role: "status",
63
+ "aria-busy": true,
80
64
  "aria-hidden": ariaLabel === undefined,
81
- "aria-busy": ariaLabel !== undefined,
82
65
  "aria-label": ariaLabel
83
66
  }, getPrefixedDataAttributes(dataAttributes), {
84
- children: /*#__PURE__*/ _jsx(SkeletonBase, {})
67
+ children: children
68
+ }));
69
+ };
70
+ export var SkeletonLine = function(param) {
71
+ var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
72
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
73
+ ariaLabel: ariaLabel
74
+ }, getPrefixedDataAttributes(dataAttributes), {
75
+ children: /*#__PURE__*/ _jsx(SkeletonBase, {
76
+ width: width
77
+ })
85
78
  }));
86
79
  };
87
80
  export var SkeletonText = function(param) {
88
81
  var ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
89
- var animationClasses = useAnimation();
90
- var styleClass = useSkeletonStyles({
91
- height: "fit-content"
92
- });
93
- return /*#__PURE__*/ _jsxs(Stack, _objectSpread({
94
- className: "".concat(animationClasses.animation, " ").concat(styleClass.wrap),
95
- space: 16,
96
- role: "status",
97
- "aria-hidden": ariaLabel === undefined,
98
- "aria-busy": ariaLabel !== undefined,
99
- "aria-label": ariaLabel
82
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
83
+ ariaLabel: ariaLabel
100
84
  }, getPrefixedDataAttributes(dataAttributes), {
101
- children: [
102
- /*#__PURE__*/ _jsx(SkeletonBase, {}),
103
- /*#__PURE__*/ _jsx(SkeletonBase, {}),
104
- /*#__PURE__*/ _jsx(SkeletonBase, {
105
- width: "75%"
106
- })
107
- ]
85
+ children: /*#__PURE__*/ _jsxs(Stack, {
86
+ space: 16,
87
+ children: [
88
+ /*#__PURE__*/ _jsx(SkeletonBase, {}),
89
+ /*#__PURE__*/ _jsx(SkeletonBase, {}),
90
+ /*#__PURE__*/ _jsx(SkeletonBase, {
91
+ width: "75%"
92
+ })
93
+ ]
94
+ })
108
95
  }));
109
96
  };
110
97
  export var SkeletonCircle = function(param) {
111
98
  var ariaLabel = param.ariaLabel, _size = param.size, size = _size === void 0 ? 40 : _size, dataAttributes = param.dataAttributes;
112
- var animationClasses = useAnimation();
113
- var styleClass = useSkeletonStyles({
114
- width: size,
115
- height: size
116
- });
117
- return /*#__PURE__*/ _jsx("div", _objectSpread({
118
- className: classNames(animationClasses.animation, styleClass.wrap),
119
- role: "status",
120
- "aria-hidden": ariaLabel === undefined,
121
- "aria-busy": ariaLabel !== undefined,
122
- "aria-label": ariaLabel
99
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
100
+ ariaLabel: ariaLabel
123
101
  }, getPrefixedDataAttributes(dataAttributes), {
124
102
  children: /*#__PURE__*/ _jsx(SkeletonBase, {
125
103
  height: size,
@@ -147,46 +125,31 @@ var useSkeletonRowStyles = createUseStyles(function() {
147
125
  });
148
126
  export var SkeletonRow = function(param) {
149
127
  var _width = param.width, width = _width === void 0 ? "100%" : _width, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
150
- var animationClasses = useAnimation();
151
- var styleClass = useSkeletonStyles({
152
- width: width,
153
- height: "100%"
154
- });
155
128
  var rowClass = useSkeletonRowStyles();
156
- return /*#__PURE__*/ _jsxs("div", _objectSpread({
157
- className: classNames(animationClasses.animation, styleClass.wrap, rowClass.row),
158
- role: "status",
159
- "aria-hidden": ariaLabel === undefined,
160
- "aria-busy": ariaLabel !== undefined,
161
- "aria-label": ariaLabel
129
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
130
+ ariaLabel: ariaLabel
162
131
  }, getPrefixedDataAttributes(dataAttributes), {
163
- children: [
164
- /*#__PURE__*/ _jsx(SkeletonBase, {
165
- height: 40,
166
- width: 40,
167
- radius: "50%",
168
- className: rowClass.circle
169
- }),
170
- /*#__PURE__*/ _jsx(SkeletonBase, {
171
- width: width,
172
- className: rowClass.line
173
- })
174
- ]
132
+ children: /*#__PURE__*/ _jsxs("div", {
133
+ className: rowClass.row,
134
+ children: [
135
+ /*#__PURE__*/ _jsx(SkeletonBase, {
136
+ height: 40,
137
+ width: 40,
138
+ radius: "50%",
139
+ className: rowClass.circle
140
+ }),
141
+ /*#__PURE__*/ _jsx(SkeletonBase, {
142
+ width: width,
143
+ className: rowClass.line
144
+ })
145
+ ]
146
+ })
175
147
  }));
176
148
  };
177
149
  export var SkeletonRectangle = function(param) {
178
150
  var _width = param.width, width = _width === void 0 ? "100%" : _width, _height = param.height, height = _height === void 0 ? "100%" : _height, ariaLabel = param.ariaLabel, dataAttributes = param.dataAttributes;
179
- var animationClasses = useAnimation();
180
- var styleClass = useSkeletonStyles({
181
- width: width,
182
- height: "100%"
183
- });
184
- return /*#__PURE__*/ _jsx("div", _objectSpread({
185
- className: classNames(animationClasses.animation, styleClass.wrap),
186
- role: "status",
187
- "aria-hidden": true,
188
- "aria-busy": true,
189
- "aria-label": ariaLabel
151
+ return /*#__PURE__*/ _jsx(SkeletonAnimation, _objectSpread({
152
+ ariaLabel: ariaLabel
190
153
  }, getPrefixedDataAttributes(dataAttributes), {
191
154
  children: /*#__PURE__*/ _jsx(SkeletonBase, {
192
155
  height: height,
@@ -69,7 +69,7 @@ export var getO2Skin = function() {
69
69
  buttonDangerBackground: palette.pepper,
70
70
  buttonDangerBackgroundSelected: palette.pepper60,
71
71
  buttonDangerBackgroundHover: palette.pepper60,
72
- buttonLinkBackgroundSelected: palette.o2BluePrimary15,
72
+ buttonLinkBackgroundSelected: palette.o2BluePrimary10,
73
73
  buttonLinkBackgroundSelectedInverse: applyAlpha(palette.white, 0.2),
74
74
  buttonPrimaryBackground: palette.o2BluePrimary,
75
75
  buttonPrimaryBackgroundInverse: palette.white,
@@ -104,8 +104,8 @@ import * as React from "react";
104
104
  import { createUseStyles } from "./jss";
105
105
  import { Label, HelperText, FieldContainer, LABEL_LEFT_POSITION, LABEL_SCALE_MOBILE, LABEL_SCALE_DESKTOP } from "./text-field-components";
106
106
  import { Text3 } from "./text";
107
- import { isIos, isRunningAcceptanceTest, isFirefox } from "./utils/platform";
108
- import { useAriaId, useTheme, useScreenSize } from "./hooks";
107
+ import { isIos, isRunningAcceptanceTest, isFirefox, isSafari } from "./utils/platform";
108
+ import { useAriaId, useTheme, useScreenSize, useIsomorphicLayoutEffect } from "./hooks";
109
109
  import classNames from "classnames";
110
110
  import { combineRefs } from "./utils/common";
111
111
  var commonInputStyles = function(theme) {
@@ -173,6 +173,7 @@ var useStyles = createUseStyles(function(theme) {
173
173
  },
174
174
  textArea: _objectSpread((_obj = {
175
175
  resize: "none",
176
+ padding: 0,
176
177
  marginTop: function(param) {
177
178
  var hasLabel = param.hasLabel;
178
179
  return hasLabel ? 28 : 16;
@@ -270,7 +271,10 @@ var useStyles = createUseStyles(function(theme) {
270
271
  position: "absolute"
271
272
  },
272
273
  prefix: (_obj2 = {
273
- alignSelf: "baseline",
274
+ alignSelf: function(param) {
275
+ var prefixAlignSelf = param.prefixAlignSelf;
276
+ return prefixAlignSelf;
277
+ },
274
278
  paddingTop: function(param) {
275
279
  var hasLabel = param.hasLabel;
276
280
  return hasLabel ? 28 : 16;
@@ -315,7 +319,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
315
319
  "fullWidth"
316
320
  ]);
317
321
  var id = useAriaId(idProp);
318
- var _$ref3 = _slicedToArray(React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) ? "filled" : "default"), 2), inputState = _$ref3[0], setInputState = _$ref3[1];
322
+ var _$ref4 = _slicedToArray(React.useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) ? "filled" : "default"), 2), inputState = _$ref4[0], setInputState = _$ref4[1];
319
323
  var colors = useTheme().colors;
320
324
  var isTabletOrSmaller = useScreenSize().isTabletOrSmaller;
321
325
  var _$ref1;
@@ -324,6 +328,18 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
324
328
  // this shrinkLabel override is a workaround because I was unable to find a way to hide date
325
329
  // and date-time native placeholders when the input is not required
326
330
  var shrinkLabel = shrinkLabelProp || (rest.type === "date" || rest.type === "datetime-local" || rest.type === "month") && !rest.required;
331
+ var _$ref3 = _slicedToArray(React.useState("baseline"), 2), prefixAlignSelf = _$ref3[0], setPrefixAlignSelf = _$ref3[1];
332
+ useIsomorphicLayoutEffect(function() {
333
+ /**
334
+ * Safari check to workaround https://jira.tid.es/browse/WEB-648
335
+ * For some reason it is super hard to align the prefix text with the input text
336
+ * and get the same result in chrome and safari
337
+ *
338
+ * Using an effect to set the style to avoid problems with SSR
339
+ */ if (isSafari()) {
340
+ setPrefixAlignSelf("initial");
341
+ }
342
+ }, []);
327
343
  var classes = useStyles({
328
344
  inputState: inputState,
329
345
  error: error,
@@ -334,7 +350,8 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
334
350
  prefix: prefix,
335
351
  multiline: multiline,
336
352
  type: rest.type,
337
- disabled: rest.disabled
353
+ disabled: rest.disabled,
354
+ prefixAlignSelf: prefixAlignSelf
338
355
  });
339
356
  React.useEffect(function() {
340
357
  if (inputState !== "focused" && (value === null || value === void 0 ? void 0 : value.length)) {
@@ -393,6 +410,7 @@ var TextFieldBase = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
393
410
  multiline: multiline,
394
411
  fullWidth: fullWidth,
395
412
  fieldRef: fieldRef,
413
+ readOnly: rest.readOnly,
396
414
  children: [
397
415
  startIcon && /*#__PURE__*/ _jsx("div", {
398
416
  className: classes.startIcon,
@@ -500,10 +518,10 @@ var TextFieldBaseAutosuggest = /*#__PURE__*/ React.forwardRef(function(_param, r
500
518
  "getSuggestions",
501
519
  "id"
502
520
  ]);
503
- var _$ref5 = _slicedToArray(React.useState([]), 2), suggestions = _$ref5[0], setSuggestions = _$ref5[1];
521
+ var _$ref6 = _slicedToArray(React.useState([]), 2), suggestions = _$ref6[0], setSuggestions = _$ref6[1];
504
522
  var inputRef = React.useRef(null);
505
523
  var classes = useSuggestionsStyles();
506
- var _$ref4 = useTheme(), platformOverrides = _$ref4.platformOverrides, texts = _$ref4.texts;
524
+ var _$ref5 = useTheme(), platformOverrides = _$ref5.platformOverrides, texts = _$ref5.texts;
507
525
  var id = useAriaId(idProp);
508
526
  var autoSuggestId = useAriaId();
509
527
  if (getSuggestions && (props.value === undefined || props.defaultValue !== undefined)) {
@@ -260,15 +260,19 @@ var useFieldContainerStyles = createUseStyles(function(theme) {
260
260
  var multiline = param.multiline;
261
261
  return multiline ? 152 : 56;
262
262
  }
263
- }), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor", theme.colors.backgroundContainer), _obj1)
263
+ }), _defineProperty(_obj1, "display", "flex"), _defineProperty(_obj1, "position", "relative"), _defineProperty(_obj1, "backgroundColor", function(param) {
264
+ var readOnly = param.readOnly;
265
+ return readOnly ? theme.colors.neutralLow : theme.colors.backgroundContainer;
266
+ }), _obj1)
264
267
  };
265
268
  });
266
269
  export var FieldContainer = function(param) {
267
- var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth;
270
+ var multiline = param.multiline, disabled = param.disabled, children = param.children, helperText = param.helperText, className = param.className, fieldRef = param.fieldRef, fullWidth = param.fullWidth, readOnly = param.readOnly;
268
271
  var classes = useFieldContainerStyles({
269
272
  multiline: multiline,
270
273
  fullWidth: fullWidth,
271
- disabled: disabled
274
+ disabled: disabled,
275
+ readOnly: readOnly
272
276
  });
273
277
  return /*#__PURE__*/ _jsxs("div", {
274
278
  className: classes.fieldContainer,
@@ -54,6 +54,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
54
54
  return target;
55
55
  }
56
56
  import { jsx as _jsx } from "react/jsx-runtime";
57
+ // Specs: https://www.figma.com/file/koROdh3HpEPG2O8jG52Emh/Buttons-Component-Specs?node-id=0%3A1
57
58
  import * as React from "react";
58
59
  import { createUseStyles } from "./jss";
59
60
  import Touchable from "./touchable";
@@ -69,7 +70,7 @@ var useStyles = createUseStyles(function(param) {
69
70
  textLink: (_obj = {
70
71
  width: "auto",
71
72
  lineHeight: "inherit",
72
- display: "inline-block",
73
+ display: "inline",
73
74
  color: colors.textLink,
74
75
  wordBreak: "break-word",
75
76
  cursor: "pointer"
@@ -123,6 +124,7 @@ var TextLink = function(_param) {
123
124
  var _trackingEvent;
124
125
  var _obj;
125
126
  return /*#__PURE__*/ _jsx(Touchable, _objectSpread({}, props, {
127
+ as: props.onPress ? "a" : undefined,
126
128
  trackingEvent: (_trackingEvent = props.trackingEvent) !== null && _trackingEvent !== void 0 ? _trackingEvent : props.trackEvent ? createDefaultTrackingEvent() : undefined,
127
129
  disabled: disabled || formStatus === "sending",
128
130
  className: classnames(classes.textLink, className, (_obj = {}, _defineProperty(_obj, classes.small, small), _defineProperty(_obj, classes.inverse, isInverse), _obj)),
package/dist-es/theme.js CHANGED
@@ -204,7 +204,8 @@ export var getTexts = function(locale) {
204
204
  }
205
205
  };
206
206
  export var dimensions = {
207
- headerMobileHeight: 56
207
+ headerMobileHeight: 56,
208
+ headerDesktopHeight: 80
208
209
  };
209
210
  export var mediaQueriesConfig = {
210
211
  tabletMinWidth: 768,