@telefonica/mistica 12.6.0 → 12.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 (65) hide show
  1. package/dist/carousel.d.ts +2 -0
  2. package/dist/carousel.js +23 -6
  3. package/dist/carousel.js.flow +2 -0
  4. package/dist/fixed-footer-layout.js +31 -9
  5. package/dist/generated/mistica-icons/icon-buy-data-light.js +5 -11
  6. package/dist/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  7. package/dist/generated/mistica-icons/icon-eco-light.js +1 -1
  8. package/dist/generated/mistica-icons/icon-justice-regular.js +1 -1
  9. package/dist/generated/mistica-icons/icon-tokens-filled.d.ts +4 -0
  10. package/dist/generated/mistica-icons/icon-tokens-filled.js +109 -0
  11. package/dist/generated/mistica-icons/icon-tokens-filled.js.flow +6 -0
  12. package/dist/generated/mistica-icons/icon-tokens-light.d.ts +4 -0
  13. package/dist/generated/mistica-icons/icon-tokens-light.js +109 -0
  14. package/dist/generated/mistica-icons/icon-tokens-light.js.flow +6 -0
  15. package/dist/generated/mistica-icons/icon-tokens-regular.d.ts +4 -0
  16. package/dist/generated/mistica-icons/icon-tokens-regular.js +109 -0
  17. package/dist/generated/mistica-icons/icon-tokens-regular.js.flow +6 -0
  18. package/dist/hooks.d.ts +3 -0
  19. package/dist/hooks.js +16 -3
  20. package/dist/hooks.js.flow +3 -0
  21. package/dist/image.d.ts +2 -0
  22. package/dist/image.js +118 -80
  23. package/dist/image.js.flow +2 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.js +21 -0
  26. package/dist/index.js.flow +3 -0
  27. package/dist/list.d.ts +1 -0
  28. package/dist/list.js +4 -2
  29. package/dist/list.js.flow +1 -0
  30. package/dist/package-version.js +1 -1
  31. package/dist/skeletons.d.ts +5 -2
  32. package/dist/skeletons.js +50 -87
  33. package/dist/skeletons.js.flow +4 -4
  34. package/dist/skins/o2.js +1 -1
  35. package/dist/text-field-base.d.ts +0 -1
  36. package/dist/text-field-base.js +2 -0
  37. package/dist/text-field-base.js.flow +0 -1
  38. package/dist/text-field-components.d.ts +1 -0
  39. package/dist/text-field-components.js +7 -3
  40. package/dist/text-field-components.js.flow +1 -0
  41. package/dist/utils/aspect-ratio-support.d.ts +10 -0
  42. package/dist/utils/aspect-ratio-support.js +115 -1
  43. package/dist/utils/aspect-ratio-support.js.flow +14 -0
  44. package/dist/video.js +20 -79
  45. package/dist-es/carousel.js +23 -6
  46. package/dist-es/fixed-footer-layout.js +32 -10
  47. package/dist-es/generated/mistica-icons/icon-buy-data-light.js +6 -12
  48. package/dist-es/generated/mistica-icons/icon-buy-data-regular.js +1 -1
  49. package/dist-es/generated/mistica-icons/icon-eco-light.js +1 -1
  50. package/dist-es/generated/mistica-icons/icon-justice-regular.js +1 -1
  51. package/dist-es/generated/mistica-icons/icon-tokens-filled.js +85 -0
  52. package/dist-es/generated/mistica-icons/icon-tokens-light.js +85 -0
  53. package/dist-es/generated/mistica-icons/icon-tokens-regular.js +85 -0
  54. package/dist-es/hooks.js +14 -2
  55. package/dist-es/image.js +115 -83
  56. package/dist-es/index.js +3 -0
  57. package/dist-es/list.js +4 -2
  58. package/dist-es/package-version.js +1 -1
  59. package/dist-es/skeletons.js +50 -87
  60. package/dist-es/skins/o2.js +1 -1
  61. package/dist-es/text-field-base.js +2 -0
  62. package/dist-es/text-field-components.js +7 -3
  63. package/dist-es/utils/aspect-ratio-support.js +112 -0
  64. package/dist-es/video.js +21 -81
  65. package/package.json +1 -1
@@ -0,0 +1,109 @@
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
+ var _hooks = require("../../hooks");
9
+ var _themeVariantContext = require("../../theme-variant-context");
10
+ function _interopRequireWildcard(obj) {
11
+ if (obj && obj.__esModule) {
12
+ return obj;
13
+ } else {
14
+ var newObj = {};
15
+ if (obj != null) {
16
+ for(var key in obj){
17
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
18
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
19
+ if (desc.get || desc.set) {
20
+ Object.defineProperty(newObj, key, desc);
21
+ } else {
22
+ newObj[key] = obj[key];
23
+ }
24
+ }
25
+ }
26
+ }
27
+ newObj.default = obj;
28
+ return newObj;
29
+ }
30
+ }
31
+ function _defineProperty(obj, key, value) {
32
+ if (key in obj) {
33
+ Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
38
+ });
39
+ } else {
40
+ obj[key] = value;
41
+ }
42
+ return obj;
43
+ }
44
+ function _objectSpread(target) {
45
+ var _arguments = arguments, _loop = function(i) {
46
+ var source = _arguments[i] != null ? _arguments[i] : {};
47
+ var ownKeys = Object.keys(source);
48
+ if (typeof Object.getOwnPropertySymbols === "function") {
49
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
50
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
51
+ }));
52
+ }
53
+ ownKeys.forEach(function(key) {
54
+ _defineProperty(target, key, source[key]);
55
+ });
56
+ };
57
+ for(var i = 1; i < arguments.length; i++)_loop(i);
58
+ return target;
59
+ }
60
+ function _objectWithoutProperties(source, excluded) {
61
+ if (source == null) return {};
62
+ var target = _objectWithoutPropertiesLoose(source, excluded);
63
+ var key, i;
64
+ if (Object.getOwnPropertySymbols) {
65
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
66
+ for(i = 0; i < sourceSymbolKeys.length; i++){
67
+ key = sourceSymbolKeys[i];
68
+ if (excluded.indexOf(key) >= 0) continue;
69
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
70
+ target[key] = source[key];
71
+ }
72
+ }
73
+ return target;
74
+ }
75
+ function _objectWithoutPropertiesLoose(source, excluded) {
76
+ if (source == null) return {};
77
+ var target = {};
78
+ var sourceKeys = Object.keys(source);
79
+ var key, i;
80
+ for(i = 0; i < sourceKeys.length; i++){
81
+ key = sourceKeys[i];
82
+ if (excluded.indexOf(key) >= 0) continue;
83
+ target[key] = source[key];
84
+ }
85
+ return target;
86
+ }
87
+ var IconTokensRegular = function IconTokensRegular(_param) {
88
+ var color = _param.color, _size = _param.size, size = _size === void 0 ? 24 : _size, children = _param.children, rest = _objectWithoutProperties(_param, [
89
+ "color",
90
+ "size",
91
+ "children"
92
+ ]);
93
+ var colors = (0, _hooks).useTheme().colors;
94
+ var isInverse = (0, _themeVariantContext).useIsInverseVariant();
95
+ var fillColor = color !== null && color !== void 0 ? color : isInverse ? colors.inverse : colors.neutralHigh;
96
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx("svg", _objectSpread({
97
+ width: size,
98
+ height: size,
99
+ viewBox: "0 0 24 24",
100
+ role: "presentation"
101
+ }, rest, {
102
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
103
+ d: "M22 10.254a2.482 2.482 0 00-2.276-2.472l-.034-.003a.438.438 0 01-.051-.004h-.013a6.373 6.373 0 01-5.305-3.721 2.483 2.483 0 00-4.614 0l-.002.006-.004.01v.003a6.371 6.371 0 01-5.297 3.7h-.005a2.481 2.481 0 00-1.56 4.34l.006.006a6.312 6.312 0 011.797 2.923 6.46 6.46 0 01.074 3.246c-.026.085-.048.17-.065.258l-.007.035a2.485 2.485 0 003.744 2.565l.02-.012.006-.005.108-.072.005-.002.003-.003a6.388 6.388 0 016.982.022h.002l.007.005.008.006.029.018.01.007a2.48 2.48 0 002.435.154 2.486 2.486 0 001.313-2.905 6.443 6.443 0 011.425-5.814 5.91 5.91 0 01.37-.381l.002-.003a4.014 4.014 0 01.124-.115l.014-.016A2.474 2.474 0 0022 10.254zm-3.16-1.433c.233.04.471.07.708.088h.01l.068.005a1.344 1.344 0 01-.108 2.683c-.023 0-.047 0-.07-.002h-.037a10.135 10.135 0 01-3.04-.692 10.275 10.275 0 01-3.6-2.422c.587-.735 1.08-1.54 1.468-2.397a7.497 7.497 0 004.6 2.737zm-4.575 6.471a11.408 11.408 0 00-4.515-.004 11.468 11.468 0 00-1.1-3.572 11.436 11.436 0 003.364-2.38c.965.987 2.101 1.79 3.353 2.373a11.467 11.467 0 00-1.103 3.583zM10.416 5.164a7.045 7.045 0 00.343-.674l.004-.01a1.346 1.346 0 012.449-.117v.002l.042.095.02.042c.117.313.114.66-.01.97-.013.028-.026.06-.04.088a.074.074 0 00-.003.009v.001a10.193 10.193 0 01-1.635 2.553 10.283 10.283 0 01-3.499 2.597 11.303 11.303 0 00-1.8-2.178 7.454 7.454 0 001.94-.983 7.601 7.601 0 002.189-2.397v.002zM4.132 11.81a7.397 7.397 0 00-.512-.522l-.004-.004a4.177 4.177 0 00-.066-.06l-.004-.004a1.344 1.344 0 01.785-2.3l.127-.008a1.337 1.337 0 01.974.393.612.612 0 00.057.05c.74.69 1.37 1.488 1.874 2.366a10.287 10.287 0 011.277 3.85c-.918.285-1.797.686-2.613 1.193a7.539 7.539 0 00-1.895-4.954zm4.308 7.974a7.701 7.701 0 00-.54.32l-.008.005a1.348 1.348 0 01-2.128-1.324l.048-.186c.08-.24.226-.453.422-.614l.23-.153.01-.006a10.17 10.17 0 012.923-1.29 10.26 10.26 0 014.772-.102c-.033.96.057 1.921.267 2.859a7.531 7.531 0 00-5.996.491zm9.842-5.06a7.616 7.616 0 00-.07 3.912 1.348 1.348 0 01-2.015 1.528l-.039-.026-.01-.006a1.36 1.36 0 01-.49-.64c-.027-.096-.051-.192-.074-.284l-.002-.008c-.57-2.379-.27-4.884.845-7.062.893.309 1.82.504 2.762.581a7.592 7.592 0 00-.907 2.005z",
104
+ fill: fillColor
105
+ })
106
+ }));
107
+ };
108
+ var _default = IconTokensRegular;
109
+ exports.default = _default;
@@ -0,0 +1,6 @@
1
+ // @flow
2
+
3
+ import * as React from "react";
4
+ import type { IconProps } from "../../utils/types";
5
+ declare var IconTokensRegular: React.ComponentType<IconProps>;
6
+ declare export default typeof IconTokensRegular;
package/dist/hooks.d.ts CHANGED
@@ -13,9 +13,12 @@ export declare const useAriaId: (id?: string | undefined) => string;
13
13
  export declare const useWindowSize: () => {
14
14
  height: number;
15
15
  width: number;
16
+ screenHeight: number;
17
+ screenWidth: number;
16
18
  };
17
19
  export declare const useWindowHeight: () => number;
18
20
  export declare const useWindowWidth: () => number;
21
+ export declare const useScreenHeight: () => number;
19
22
  export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
20
23
  declare type IntersectionObserverOptions = {
21
24
  root?: Element | Document | null;
package/dist/hooks.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.useIsInViewport = exports.useIsomorphicLayoutEffect = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = exports.useAriaId = exports.useElementDimensions = exports.useScreenSize = exports.useDisableBodyScroll = exports.useTheme = void 0;
5
+ exports.useIsInViewport = exports.useIsomorphicLayoutEffect = exports.useScreenHeight = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = exports.useAriaId = exports.useElementDimensions = exports.useScreenSize = exports.useDisableBodyScroll = exports.useTheme = void 0;
6
6
  var React = _interopRequireWildcard(require("react"));
7
7
  var _themeContext = _interopRequireDefault(require("./theme-context"));
8
8
  var _screenSizeContext = _interopRequireDefault(require("./screen-size-context"));
@@ -183,10 +183,14 @@ var useWindowSize = function useWindowSize() {
183
183
  ), 2), windowHeight = ref[0], setWindowHeight = ref[1];
184
184
  var ref6 = _slicedToArray(React.useState(typeof window !== "undefined" ? window.innerWidth : 800 // Best guess
185
185
  ), 2), windowWidth = ref6[0], setWindowWidth = ref6[1];
186
+ var ref7 = _slicedToArray(React.useState(typeof window !== "undefined" ? window.screen.availHeight : 1200), 2), screenHeight = ref7[0], setScreenHeight = ref7[1];
187
+ var ref8 = _slicedToArray(React.useState(typeof window !== "undefined" ? window.screen.availWidth : 800), 2), screenWidth = ref8[0], setScreenWidth = ref8[1];
186
188
  React.useEffect(function() {
187
189
  var handleResize = function handleResize() {
188
190
  setWindowHeight(window.innerHeight);
189
191
  setWindowWidth(window.innerWidth);
192
+ setScreenHeight(window.screen.availHeight);
193
+ setScreenWidth(window.screen.availWidth);
190
194
  };
191
195
  window.addEventListener("resize", handleResize);
192
196
  return function() {
@@ -197,11 +201,15 @@ var useWindowSize = function useWindowSize() {
197
201
  return React.useMemo(function() {
198
202
  return {
199
203
  height: windowHeight,
200
- width: windowWidth
204
+ width: windowWidth,
205
+ screenHeight: screenHeight,
206
+ screenWidth: screenWidth
201
207
  };
202
208
  }, [
203
209
  windowHeight,
204
- windowWidth
210
+ windowWidth,
211
+ screenHeight,
212
+ screenWidth
205
213
  ]);
206
214
  };
207
215
  exports.useWindowSize = useWindowSize;
@@ -215,6 +223,11 @@ var useWindowWidth = function useWindowWidth() {
215
223
  return width;
216
224
  };
217
225
  exports.useWindowWidth = useWindowWidth;
226
+ var useScreenHeight = function useScreenHeight() {
227
+ var screenHeight = useWindowSize().screenHeight;
228
+ return screenHeight;
229
+ };
230
+ exports.useScreenHeight = useScreenHeight;
218
231
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
219
232
  exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
220
233
  var useIsInViewport = function useIsInViewport(ref, defaultValue, options) {
@@ -15,9 +15,12 @@ declare export var useAriaId: (id?: string | void) => string;
15
15
  declare export var useWindowSize: () => {
16
16
  height: number,
17
17
  width: number,
18
+ screenHeight: number,
19
+ screenWidth: number,
18
20
  };
19
21
  declare export var useWindowHeight: () => number;
20
22
  declare export var useWindowWidth: () => number;
23
+ declare export var useScreenHeight: () => number;
21
24
  declare export var useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
22
25
  declare type IntersectionObserverOptions = {
23
26
  root?: Element | Document | null,
package/dist/image.d.ts CHANGED
@@ -23,6 +23,8 @@ export declare type ImageProps = {
23
23
  noBorderRadius?: boolean;
24
24
  onError?: (event: React.SyntheticEvent) => void;
25
25
  onLoad?: (event: React.SyntheticEvent) => void;
26
+ loadingFallback?: boolean;
27
+ errorFallback?: boolean;
26
28
  };
27
29
  declare const Image: React.ForwardRefExoticComponent<ImageProps & React.RefAttributes<HTMLImageElement>>;
28
30
  export default Image;
package/dist/image.js CHANGED
@@ -6,8 +6,18 @@ exports.default = exports.RATIO = exports.DisableBorderRadiusProvider = exports.
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _jss = require("./jss");
9
+ var _skeletons = require("./skeletons");
9
10
  var _aspectRatioSupport = require("./utils/aspect-ratio-support");
10
11
  var _dom = require("./utils/dom");
12
+ var _iconImageRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-image-regular"));
13
+ var _themeVariantContext = require("./theme-variant-context");
14
+ var _hooks = require("./hooks");
15
+ var _constants = require("./skins/constants");
16
+ function _interopRequireDefault(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
11
21
  function _interopRequireWildcard(obj) {
12
22
  if (obj && obj.__esModule) {
13
23
  return obj;
@@ -131,6 +141,7 @@ function _unsupportedIterableToArray(o, minLen) {
131
141
  if (n === "Map" || n === "Set") return Array.from(n);
132
142
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
133
143
  }
144
+ var FADE_IN_DURATION_MS = 300;
134
145
  /**
135
146
  * This context is used internally to disable the border radius. This is useful for example
136
147
  * when using the Image component inside a Card
@@ -147,58 +158,74 @@ var DisableBorderRadiusProvider = function DisableBorderRadiusProvider(param) {
147
158
  });
148
159
  };
149
160
  exports.DisableBorderRadiusProvider = DisableBorderRadiusProvider;
161
+ var VivoLogo = function VivoLogo(param) {
162
+ var style = param.style;
163
+ var colors = (0, _hooks).useTheme().colors;
164
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx("svg", {
165
+ width: "48",
166
+ height: "48",
167
+ viewBox: "0 0 48 48",
168
+ fill: "none",
169
+ style: style,
170
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx("path", {
171
+ d: "M24.021 35.7235C24.8145 35.7694 25.0467 36.1913 25.3157 36.5138C25.586 36.8362 29.515 41.551 29.7823 41.8569C30.0475 42.1662 30.7822 42.7329 31.5901 42.8405C32.3967 42.9473 33.282 42.7842 33.8484 42.3748C34.4135 41.965 35.1313 41.4073 35.3833 41.0356C35.6337 40.6638 36.061 40.1302 35.9823 39.2534C35.9028 38.3783 35.7112 37.9204 35.0268 37.1691C34.3433 36.4185 30.2992 31.6657 29.5382 30.7537C29.5382 30.7537 28.8467 29.9423 28.9469 28.7956C29.0476 27.6468 29.567 27.1343 30.6608 26.8487C31.7534 26.5647 36.0267 25.5306 36.0267 25.5306C36.0267 25.5306 38.4728 24.3723 37.9182 22.0776L37.5997 20.904C37.5997 20.904 37.0672 18.2264 33.5519 19.0556C30.0344 19.8869 28.0803 20.377 28.0803 20.377C28.0803 20.377 26.9602 20.4838 26.7999 19.744C26.6417 19.0038 26.8494 18.6218 27.3443 18.4156C27.8387 18.209 30.9611 16.7175 31.3617 12.6853C31.7652 8.65158 28.3882 5.06573 24.0091 5.08104C19.6288 5.0976 16.4594 8.39988 16.4725 11.8185C16.4856 15.2387 18.7033 17.5144 20.4079 18.3638C21.3752 18.8453 21.0656 19.7122 21.0656 19.7122C21.0656 19.7122 20.8334 20.5554 19.8153 20.3311C18.7972 20.1025 13.8657 18.9736 13.8657 18.9736C13.8657 18.9736 10.8914 18.4226 10.1732 21.359C9.4541 24.2978 11.1261 25.4143 12.3532 25.6908C13.5798 25.9669 17.7296 26.9716 17.7296 26.9716C17.7296 26.9716 18.9643 27.581 19.0125 28.8308C19.0425 29.5697 19.0438 30.1824 18.266 31.2832C17.4894 32.3835 12.6598 38.0148 12.6598 38.0148C12.6598 38.0148 10.9997 39.9862 13.4051 41.763C15.8106 43.5401 17.1641 43.1262 18.5921 41.4889C20.0188 39.852 22.8383 36.4243 22.8383 36.4243C22.8383 36.4243 23.2275 35.6788 24.021 35.7235Z",
172
+ stroke: colors.brand,
173
+ strokeWidth: "2"
174
+ })
175
+ });
176
+ };
177
+ var ImageError = function ImageError() {
178
+ var isInverse = (0, _themeVariantContext).useIsInverseVariant();
179
+ var ref = (0, _hooks).useTheme(), colors = ref.colors, skinName = ref.skinName;
180
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
181
+ style: {
182
+ height: "100%",
183
+ width: "100%",
184
+ display: "flex",
185
+ alignItems: "center",
186
+ justifyContent: "center",
187
+ backgroundColor: isInverse ? colors.backgroundSkeletonInverse : colors.backgroundSkeleton,
188
+ borderRadius: 8
189
+ },
190
+ children: skinName === _constants.VIVO_SKIN ? /*#__PURE__*/ (0, _jsxRuntime).jsx(VivoLogo, {
191
+ style: {
192
+ width: "10%",
193
+ minWidth: 24,
194
+ maxWidth: 48
195
+ }
196
+ }) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconImageRegular.default, {
197
+ color: isInverse ? colors.inverse : colors.neutralMedium,
198
+ size: "",
199
+ style: {
200
+ width: "10%",
201
+ minWidth: 24,
202
+ maxWidth: 48
203
+ }
204
+ })
205
+ });
206
+ };
150
207
  var useStyles = (0, _jss).createUseStyles(function() {
151
208
  return {
152
209
  image: {
210
+ // needeed because images with aspect-ratio 0 and position absolute does not work
211
+ position: function position(param) {
212
+ var ratio = param.ratio;
213
+ return ratio !== 0 ? "absolute" : "static";
214
+ },
215
+ top: 0,
216
+ left: 0,
153
217
  display: "block",
154
218
  objectFit: "cover",
219
+ width: "100%",
220
+ height: "100%",
155
221
  maxWidth: "100%",
156
222
  maxHeight: "100%",
157
223
  borderRadius: function borderRadius(param) {
158
224
  var noBorderRadius = param.noBorderRadius;
159
225
  return noBorderRadius ? 0 : 8;
160
226
  },
161
- "@supports (aspect-ratio: 1 / 1)": {
162
- aspectRatio: function aspectRatio(param) {
163
- var aspectRatio1 = param.aspectRatio;
164
- return aspectRatio1 !== null && aspectRatio1 !== void 0 ? aspectRatio1 : "unset";
165
- }
166
- },
167
- "$wrapper &": {
168
- borderRadius: 0,
169
- position: function position(param) {
170
- var aspectRatio = param.aspectRatio;
171
- return aspectRatio ? "absolute" : "static";
172
- },
173
- width: "100%",
174
- height: "100%",
175
- top: 0,
176
- left: 0
177
- },
178
- opacity: function opacity(param) {
179
- var isError = param.isError;
180
- return isError ? 0 : 1;
181
- }
182
- },
183
- wrapper: {
184
- borderRadius: function borderRadius(param) {
185
- var noBorderRadius = param.noBorderRadius;
186
- return noBorderRadius ? 0 : 8;
187
- },
188
- overflow: "hidden",
189
- maxWidth: "100%",
190
- maxHeight: "100%",
191
- position: "relative",
192
- paddingTop: function paddingTop(param) {
193
- var aspectRatio = param.aspectRatio, width = param.width;
194
- if (!aspectRatio) {
195
- return 0;
196
- }
197
- if (width && typeof width === "string" && width.endsWith("%")) {
198
- return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
199
- }
200
- return "".concat(100 / aspectRatio, "%");
201
- }
227
+ transition: "opacity ".concat(FADE_IN_DURATION_MS, "ms"),
228
+ zIndex: 1
202
229
  }
203
230
  };
204
231
  });
@@ -210,74 +237,85 @@ var RATIO = {
210
237
  };
211
238
  exports.RATIO = RATIO;
212
239
  var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
213
- 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, [
240
+ 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, _loadingFallback = _param.loadingFallback, loadingFallback = _loadingFallback === void 0 ? true : _loadingFallback, _errorFallback = _param.errorFallback, errorFallback = _errorFallback === void 0 ? true : _errorFallback, props = _objectWithoutProperties(_param, [
214
241
  "aspectRatio",
215
242
  "alt",
216
243
  "dataAttributes",
217
244
  "noBorderRadius",
218
245
  "src",
219
246
  "onError",
220
- "onLoad"
247
+ "onLoad",
248
+ "loadingFallback",
249
+ "errorFallback"
221
250
  ]);
222
- var supportsAspectRatio = (0, _aspectRatioSupport).useSupportsAspectRatio();
223
251
  var noBorderRadiusContext = useDisableBorderRadius();
224
252
  var noBorderSetting = noBorderRadius !== null && noBorderRadius !== void 0 ? noBorderRadius : noBorderRadiusContext;
225
253
  var _$ref = _slicedToArray(React.useState(false), 2), isError = _$ref[0], setIsError = _$ref[1];
254
+ var _$ref1 = _slicedToArray(React.useState(true), 2), isLoading = _$ref1[0], setIsLoading = _$ref1[1];
255
+ var _$ref2 = _slicedToArray(React.useState(false), 2), hideLoadingFallback = _$ref2[0], setHideLoadingFallback = _$ref2[1];
226
256
  var ratio = typeof aspectRatio === "number" ? aspectRatio : RATIO[aspectRatio];
227
- // if width or height are numeric, we can calculate the other with the ratio without css.
228
- // if aspect ratio is 0, we use the original image proportions
229
- var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
230
257
  var classes = useStyles({
231
258
  noBorderRadius: noBorderSetting,
232
- aspectRatio: withCssAspectRatio ? ratio : undefined,
233
- width: props.width,
234
- isError: isError
259
+ ratio: ratio
235
260
  });
236
- var width = props.width;
237
- var height = props.height;
238
- if (props.width !== undefined && props.height !== undefined) {
239
- width = props.width;
240
- height = props.height;
241
- } else if (typeof props.width === "number") {
242
- height = ratio ? props.width / ratio : undefined;
243
- } else if (typeof props.height === "number") {
244
- width = ratio ? props.height * ratio : undefined;
245
- } else {
246
- width = props.width || "100%";
247
- }
248
- var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
261
+ var withLoadingFallback = loadingFallback && !!(ratio !== 0 || props.width && props.height);
262
+ var withErrorFallback = errorFallback && !!(ratio !== 0 || props.width && props.height);
249
263
  var img = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
250
264
  /*#__PURE__*/ (0, _jsxRuntime).jsx("img", _objectSpread({}, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
265
+ style: _objectSpread({}, isLoading && withLoadingFallback ? {
266
+ opacity: 0
267
+ } : {
268
+ opacity: 1
269
+ }),
251
270
  ref: ref,
252
271
  src: src,
253
272
  className: classes.image,
254
273
  alt: alt,
255
274
  onError: function onError1(event) {
256
275
  setIsError(true);
276
+ setIsLoading(false);
277
+ setHideLoadingFallback(true);
257
278
  onError === null || onError === void 0 ? void 0 : onError(event);
258
279
  },
259
280
  onLoad: function onLoad1(event) {
260
281
  setIsError(false);
282
+ setIsLoading(false);
283
+ setTimeout(function() {
284
+ setHideLoadingFallback(true);
285
+ }, FADE_IN_DURATION_MS);
261
286
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
262
287
  }
263
- }, needsWrapper ? {
264
- width: "100%"
265
- } : {
266
- width: width,
267
- height: height
268
288
  }));
269
- if (needsWrapper) {
270
- return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
271
- style: {
272
- width: width,
273
- height: height
274
- },
275
- className: classes.wrapper,
276
- children: img
277
- });
278
- } else {
279
- return img;
280
- }
289
+ return /*#__PURE__*/ (0, _jsxRuntime).jsxs(_aspectRatioSupport.AspectRatioElement, {
290
+ style: {
291
+ position: "relative"
292
+ },
293
+ aspectRatio: ratio,
294
+ width: props.width,
295
+ height: props.height,
296
+ children: [
297
+ withLoadingFallback && !hideLoadingFallback && /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
298
+ style: {
299
+ position: "absolute",
300
+ width: "100%",
301
+ height: "100%"
302
+ },
303
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_skeletons.SkeletonRectangle, {
304
+ width: props.width,
305
+ height: props.height
306
+ })
307
+ }),
308
+ isError && withErrorFallback && /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
309
+ style: {
310
+ position: "absolute",
311
+ width: "100%",
312
+ height: "100%"
313
+ },
314
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(ImageError, {})
315
+ }),
316
+ !isError && img
317
+ ]
318
+ });
281
319
  });
282
320
  var _default = Image;
283
321
  exports.default = _default;
@@ -30,6 +30,8 @@ export type ImageProps = {
30
30
  noBorderRadius?: boolean,
31
31
  onError?: (event: SyntheticEvent<any>) => void,
32
32
  onLoad?: (event: SyntheticEvent<any>) => void,
33
+ loadingFallback?: boolean,
34
+ errorFallback?: boolean,
33
35
  };
34
36
  declare var Image: React.AbstractComponent<ImageProps, HTMLImageElement>;
35
37
  declare export default typeof Image;
package/dist/index.d.ts CHANGED
@@ -1594,6 +1594,9 @@ export { default as IconTipsAndTricksRegular } from './generated/mistica-icons/i
1594
1594
  export { default as IconTkFilled } from './generated/mistica-icons/icon-tk-filled';
1595
1595
  export { default as IconTkLight } from './generated/mistica-icons/icon-tk-light';
1596
1596
  export { default as IconTkRegular } from './generated/mistica-icons/icon-tk-regular';
1597
+ export { default as IconTokensFilled } from './generated/mistica-icons/icon-tokens-filled';
1598
+ export { default as IconTokensLight } from './generated/mistica-icons/icon-tokens-light';
1599
+ export { default as IconTokensRegular } from './generated/mistica-icons/icon-tokens-regular';
1597
1600
  export { default as IconTongueFilled } from './generated/mistica-icons/icon-tongue-filled';
1598
1601
  export { default as IconTongueLight } from './generated/mistica-icons/icon-tongue-light';
1599
1602
  export { default as IconTongueRegular } from './generated/mistica-icons/icon-tongue-regular';
package/dist/index.js CHANGED
@@ -9890,6 +9890,24 @@ Object.defineProperty(exports, "IconTkRegular", {
9890
9890
  return _iconTkRegular.default;
9891
9891
  }
9892
9892
  });
9893
+ Object.defineProperty(exports, "IconTokensFilled", {
9894
+ enumerable: true,
9895
+ get: function() {
9896
+ return _iconTokensFilled.default;
9897
+ }
9898
+ });
9899
+ Object.defineProperty(exports, "IconTokensLight", {
9900
+ enumerable: true,
9901
+ get: function() {
9902
+ return _iconTokensLight.default;
9903
+ }
9904
+ });
9905
+ Object.defineProperty(exports, "IconTokensRegular", {
9906
+ enumerable: true,
9907
+ get: function() {
9908
+ return _iconTokensRegular.default;
9909
+ }
9910
+ });
9893
9911
  Object.defineProperty(exports, "IconTongueFilled", {
9894
9912
  enumerable: true,
9895
9913
  get: function() {
@@ -12367,6 +12385,9 @@ var _iconTipsAndTricksRegular = _interopRequireDefault(require("./generated/mist
12367
12385
  var _iconTkFilled = _interopRequireDefault(require("./generated/mistica-icons/icon-tk-filled"));
12368
12386
  var _iconTkLight = _interopRequireDefault(require("./generated/mistica-icons/icon-tk-light"));
12369
12387
  var _iconTkRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-tk-regular"));
12388
+ var _iconTokensFilled = _interopRequireDefault(require("./generated/mistica-icons/icon-tokens-filled"));
12389
+ var _iconTokensLight = _interopRequireDefault(require("./generated/mistica-icons/icon-tokens-light"));
12390
+ var _iconTokensRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-tokens-regular"));
12370
12391
  var _iconTongueFilled = _interopRequireDefault(require("./generated/mistica-icons/icon-tongue-filled"));
12371
12392
  var _iconTongueLight = _interopRequireDefault(require("./generated/mistica-icons/icon-tongue-light"));
12372
12393
  var _iconTongueRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-tongue-regular"));
@@ -1667,6 +1667,9 @@ declare export { default as IconTipsAndTricksRegular } from "./generated/mistica
1667
1667
  declare export { default as IconTkFilled } from "./generated/mistica-icons/icon-tk-filled";
1668
1668
  declare export { default as IconTkLight } from "./generated/mistica-icons/icon-tk-light";
1669
1669
  declare export { default as IconTkRegular } from "./generated/mistica-icons/icon-tk-regular";
1670
+ declare export { default as IconTokensFilled } from "./generated/mistica-icons/icon-tokens-filled";
1671
+ declare export { default as IconTokensLight } from "./generated/mistica-icons/icon-tokens-light";
1672
+ declare export { default as IconTokensRegular } from "./generated/mistica-icons/icon-tokens-regular";
1670
1673
  declare export { default as IconTongueFilled } from "./generated/mistica-icons/icon-tongue-filled";
1671
1674
  declare export { default as IconTongueLight } from "./generated/mistica-icons/icon-tongue-light";
1672
1675
  declare export { default as IconTongueRegular } from "./generated/mistica-icons/icon-tongue-regular";
package/dist/list.d.ts CHANGED
@@ -113,6 +113,7 @@ declare type RowListProps = {
113
113
  children: React.ReactNode;
114
114
  ariaLabelledby?: string;
115
115
  role?: string;
116
+ noLastDivider?: boolean;
116
117
  dataAttributes?: DataAttributes;
117
118
  };
118
119
  export declare const RowList: React.FC<RowListProps>;
package/dist/list.js CHANGED
@@ -564,7 +564,9 @@ var Row = /*#__PURE__*/ React.forwardRef(function(props, ref) {
564
564
  });
565
565
  exports.Row = Row;
566
566
  var RowList = function RowList(param) {
567
- var children = param.children, ariaLabelledby = param.ariaLabelledby, role = param.role, dataAttributes = param.dataAttributes;
567
+ var children = param.children, ariaLabelledby = param.ariaLabelledby, role = param.role, dataAttributes = param.dataAttributes, noLastDivider = param.noLastDivider;
568
+ var lastIndex = React.Children.count(children) - 1;
569
+ var showLastDivider = !noLastDivider;
568
570
  return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", _objectSpread({
569
571
  role: role,
570
572
  "aria-labelledby": ariaLabelledby
@@ -573,7 +575,7 @@ var RowList = function RowList(param) {
573
575
  return /*#__PURE__*/ (0, _jsxRuntime).jsxs(React.Fragment, {
574
576
  children: [
575
577
  child,
576
- /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
578
+ (index < lastIndex || showLastDivider) && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
577
579
  paddingX: 16,
578
580
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_divider.default, {})
579
581
  })
package/dist/list.js.flow CHANGED
@@ -82,6 +82,7 @@ declare type RowListProps = {
82
82
  children: React.Node,
83
83
  ariaLabelledby?: string,
84
84
  role?: string,
85
+ noLastDivider?: boolean,
85
86
  dataAttributes?: DataAttributes,
86
87
  };
87
88
  declare export var RowList: React.ComponentType<RowListProps>;
@@ -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 = "12.6.0";
6
+ var PACKAGE_VERSION = "12.8.0";
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -14,8 +14,11 @@ declare type SkeletonCircleProps = Omit<SkeletonLineProps, 'width'> & {
14
14
  export declare const SkeletonCircle: ({ ariaLabel, size, dataAttributes }: SkeletonCircleProps) => JSX.Element;
15
15
  declare type SkeletonRowProps = SkeletonLineProps;
16
16
  export declare const SkeletonRow: ({ width, ariaLabel, dataAttributes }: SkeletonRowProps) => JSX.Element;
17
- declare type SkeletonRectangleProps = SkeletonLineProps & {
18
- height: number | string;
17
+ declare type SkeletonRectangleProps = {
18
+ ariaLabel?: string;
19
+ dataAttributes?: DataAttributes;
20
+ width?: number | string;
21
+ height?: number | string;
19
22
  };
20
23
  export declare const SkeletonRectangle: ({ width, height, ariaLabel, dataAttributes, }: SkeletonRectangleProps) => JSX.Element;
21
24
  export {};