@telefonica/mistica 11.11.1 → 11.12.2

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.
package/dist/image.js CHANGED
@@ -166,7 +166,10 @@ var useStyles = (0, _jss).createUseStyles(function() {
166
166
  },
167
167
  "$wrapper &": {
168
168
  borderRadius: 0,
169
- position: "absolute",
169
+ position: function position(param) {
170
+ var aspectRatio = param.aspectRatio;
171
+ return aspectRatio ? "absolute" : "static";
172
+ },
170
173
  width: "100%",
171
174
  height: "100%",
172
175
  top: 0,
@@ -189,7 +192,7 @@ var useStyles = (0, _jss).createUseStyles(function() {
189
192
  paddingTop: function paddingTop(param) {
190
193
  var aspectRatio = param.aspectRatio, width = param.width;
191
194
  if (!aspectRatio) {
192
- return "initial";
195
+ return 0;
193
196
  }
194
197
  if (width && typeof width === "string" && width.endsWith("%")) {
195
198
  return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
@@ -236,9 +239,9 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
236
239
  width = props.width;
237
240
  height = props.height;
238
241
  } else if (typeof props.width === "number") {
239
- height = props.width / ratio;
242
+ height = ratio ? props.width / ratio : undefined;
240
243
  } else if (typeof props.height === "number") {
241
- width = props.height * ratio;
244
+ width = ratio ? props.height * ratio : undefined;
242
245
  } else {
243
246
  width = props.width || "100%";
244
247
  }
@@ -257,10 +260,12 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
257
260
  setIsError(false);
258
261
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
259
262
  }
260
- }, !needsWrapper ? {
263
+ }, needsWrapper ? {
264
+ width: "100%"
265
+ } : {
261
266
  width: width,
262
267
  height: height
263
- } : {}));
268
+ }));
264
269
  if (needsWrapper) {
265
270
  return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
266
271
  style: {
@@ -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.11.1";
6
+ var PACKAGE_VERSION = "11.12.2";
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -2,15 +2,29 @@ export declare type SkinVariant = 'prominent';
2
2
  export declare type KnownSkinName = 'Movistar' | 'O2' | 'O2-classic' | 'Vivo' | 'Telefonica' | 'Blau';
3
3
  export declare type SkinName = KnownSkinName | string;
4
4
  export declare type GetKnownSkin = (variant?: SkinVariant) => KnownSkin;
5
+ export declare type FontWeight = 'light' | 'regular' | 'medium';
6
+ declare type TextPresetName = 'text5' | 'text6' | 'text7' | 'text8' | 'text9' | 'text10';
7
+ export declare type TextPresetsConfig = {
8
+ [preset in TextPresetName]: {
9
+ weight: FontWeight;
10
+ };
11
+ };
12
+ declare type PartialTextPresetsConfig = {
13
+ [preset in TextPresetName]?: {
14
+ weight?: FontWeight;
15
+ };
16
+ };
5
17
  export declare type Skin = {
6
18
  name: SkinName;
7
19
  colors: Colors;
8
20
  darkModeColors?: Partial<Colors>;
21
+ textPresets?: PartialTextPresetsConfig;
9
22
  };
10
23
  export declare type KnownSkin = {
11
24
  name: KnownSkinName;
12
25
  colors: Colors;
13
26
  darkModeColors?: Partial<Colors>;
27
+ textPresets?: PartialTextPresetsConfig;
14
28
  };
15
29
  export declare type Colors = {
16
30
  appBarBackground: string;
@@ -102,3 +116,4 @@ export declare type Colors = {
102
116
  textTagActive: string;
103
117
  textTagInactive: string;
104
118
  };
119
+ export {};
@@ -10,15 +10,37 @@ export type KnownSkinName =
10
10
  | "Blau";
11
11
  export type SkinName = KnownSkinName | string;
12
12
  export type GetKnownSkin = (variant?: SkinVariant) => KnownSkin;
13
+ export type FontWeight = "light" | "regular" | "medium";
14
+ declare type TextPresetName =
15
+ | "text5"
16
+ | "text6"
17
+ | "text7"
18
+ | "text8"
19
+ | "text9"
20
+ | "text10";
21
+ export type TextPresetsConfig = $ObjMapi<
22
+ { [k: TextPresetName]: any },
23
+ <preset>(preset) => {
24
+ weight: FontWeight,
25
+ }
26
+ >;
27
+ declare type PartialTextPresetsConfig = $ObjMapi<
28
+ { [k: TextPresetName]: any },
29
+ <preset>(preset) => {
30
+ weight?: FontWeight,
31
+ }
32
+ >;
13
33
  export type Skin = {
14
34
  name: SkinName,
15
35
  colors: Colors,
16
36
  darkModeColors?: $Shape<Colors>,
37
+ textPresets?: PartialTextPresetsConfig,
17
38
  };
18
39
  export type KnownSkin = {
19
40
  name: KnownSkinName,
20
41
  colors: Colors,
21
42
  darkModeColors?: $Shape<Colors>,
43
+ textPresets?: PartialTextPresetsConfig,
22
44
  };
23
45
  export type Colors = {
24
46
  appBarBackground: string,
@@ -110,3 +132,4 @@ export type Colors = {
110
132
  textTagActive: string,
111
133
  textTagInactive: string,
112
134
  };
135
+ declare export {};
package/dist/text.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
+ import type { FontWeight } from './skins/types';
2
3
  import type { DataAttributes } from './utils/types';
3
- declare type FontWeight = 'light' | 'regular' | 'medium';
4
4
  export interface TextPresetProps {
5
5
  color?: string;
6
6
  decoration?: 'underline' | 'line-through' | 'inherit' | 'none';
package/dist/text.js CHANGED
@@ -10,6 +10,7 @@ var _jss = require("./jss");
10
10
  var _themeVariantContext = require("./theme-variant-context");
11
11
  var _css = require("./utils/css");
12
12
  var _dom = require("./utils/dom");
13
+ var _hooks = require("./hooks");
13
14
  function _interopRequireDefault(obj) {
14
15
  return obj && obj.__esModule ? obj : {
15
16
  default: obj
@@ -118,9 +119,12 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
118
119
  return wordBreak ? "anywhere" : "inherit";
119
120
  },
120
121
  "@supports not (overflow-wrap: anywhere)": {
122
+ // "overflow-wrap: anywhere" is not supported in Safari
123
+ // "word-break: break-word" has the same effect as "word-break: normal" and "overflow-wrap: anywhere",
124
+ // regardless of the actual value of the overflow-wrap property.
121
125
  wordBreak: function wordBreak(param) {
122
126
  var wordBreak1 = param.wordBreak;
123
- return wordBreak1 ? "break-all" : "inherit";
127
+ return wordBreak1 ? "break-word" : "inherit";
124
128
  }
125
129
  },
126
130
  // Needed to reset the default browser margin that adds to p, h1, h2... elements.
@@ -139,10 +143,11 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
139
143
  "-webkit-line-clamp": lineClamp,
140
144
  lineClamp: lineClamp,
141
145
  wordBreak: function wordBreak(param) {
142
- var wordBreak2 = param.wordBreak;
143
- return wordBreak2 ? "break-all" : "normal";
146
+ var truncate = param.truncate;
147
+ return truncate === 1 || truncate === true ? "break-all" : "break-word";
144
148
  },
145
149
  "@supports (overflow-wrap: anywhere)": {
150
+ overflowWrap: "anywhere",
146
151
  wordBreak: function wordBreak(param) {
147
152
  var truncate = param.truncate;
148
153
  return truncate === 1 || truncate === true ? "break-all" : "normal";
@@ -190,72 +195,78 @@ var getWeight = function getWeight(props) {
190
195
  return props.light && "light" || props.regular && "regular" || props.medium && "medium";
191
196
  };
192
197
  var Text10 = function Text10(props) {
198
+ var textPresets = (0, _hooks).useTheme().textPresets;
193
199
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
194
200
  mobileSize: 32,
195
201
  mobileLineHeight: "40px",
196
202
  desktopSize: 64,
197
203
  desktopLineHeight: "72px",
198
- weight: "light"
204
+ weight: textPresets.text10.weight
199
205
  }, props, {
200
206
  children: props.children
201
207
  }));
202
208
  };
203
209
  exports.Text10 = Text10;
204
210
  var Text9 = function Text9(props) {
211
+ var textPresets = (0, _hooks).useTheme().textPresets;
205
212
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
206
213
  mobileSize: 32,
207
214
  mobileLineHeight: "40px",
208
215
  desktopSize: 56,
209
216
  desktopLineHeight: "64px",
210
- weight: "light"
217
+ weight: textPresets.text9.weight
211
218
  }, props, {
212
219
  children: props.children
213
220
  }));
214
221
  };
215
222
  exports.Text9 = Text9;
216
223
  var Text8 = function Text8(props) {
224
+ var textPresets = (0, _hooks).useTheme().textPresets;
217
225
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
218
226
  mobileSize: 32,
219
227
  mobileLineHeight: "40px",
220
228
  desktopSize: 40,
221
229
  desktopLineHeight: "48px",
222
- weight: "light"
230
+ weight: textPresets.text8.weight
223
231
  }, props, {
224
232
  children: props.children
225
233
  }));
226
234
  };
227
235
  exports.Text8 = Text8;
228
236
  var Text7 = function Text7(props) {
237
+ var textPresets = (0, _hooks).useTheme().textPresets;
229
238
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
230
239
  mobileSize: 28,
231
240
  mobileLineHeight: "32px",
232
241
  desktopSize: 40,
233
242
  desktopLineHeight: "48px",
234
- weight: "light"
243
+ weight: textPresets.text7.weight
235
244
  }, props, {
236
245
  children: props.children
237
246
  }));
238
247
  };
239
248
  exports.Text7 = Text7;
240
249
  var Text6 = function Text6(props) {
250
+ var textPresets = (0, _hooks).useTheme().textPresets;
241
251
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
242
252
  mobileSize: 24,
243
253
  mobileLineHeight: "32px",
244
254
  desktopSize: 32,
245
255
  desktopLineHeight: "40px",
246
- weight: "light"
256
+ weight: textPresets.text6.weight
247
257
  }, props, {
248
258
  children: props.children
249
259
  }));
250
260
  };
251
261
  exports.Text6 = Text6;
252
262
  var Text5 = function Text5(props) {
263
+ var textPresets = (0, _hooks).useTheme().textPresets;
253
264
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
254
265
  mobileSize: 22,
255
266
  mobileLineHeight: "24px",
256
267
  desktopSize: 28,
257
268
  desktopLineHeight: "32px",
258
- weight: "light"
269
+ weight: textPresets.text5.weight
259
270
  }, props, {
260
271
  children: props.children
261
272
  }));
package/dist/text.js.flow CHANGED
@@ -1,8 +1,8 @@
1
1
  // @flow
2
2
 
3
3
  import * as React from "react";
4
+ import type { FontWeight } from "./skins/types";
4
5
  import type { DataAttributes } from "./utils/types";
5
- declare type FontWeight = "light" | "regular" | "medium";
6
6
  export type TextPresetProps = {
7
7
  color?: string,
8
8
  decoration?: "underline" | "line-through" | "inherit" | "none",
@@ -167,15 +167,35 @@ var useDefaultHrefDecorator = function useDefaultHrefDecorator() {
167
167
  return href;
168
168
  };
169
169
  };
170
+ var defaultTextPresetsConfig = {
171
+ text5: {
172
+ weight: "light"
173
+ },
174
+ text6: {
175
+ weight: "light"
176
+ },
177
+ text7: {
178
+ weight: "light"
179
+ },
180
+ text8: {
181
+ weight: "light"
182
+ },
183
+ text9: {
184
+ weight: "light"
185
+ },
186
+ text10: {
187
+ weight: "light"
188
+ }
189
+ };
170
190
  var ThemeContextProvider = function ThemeContextProvider(param) {
171
191
  var theme = param.theme, children = param.children, providerId = param.providerId;
172
- var ref = _slicedToArray(React.useState(function() {
192
+ var ref6 = _slicedToArray(React.useState(function() {
173
193
  if (providerId) {
174
194
  return providerId;
175
195
  } else {
176
196
  return (0, _environment).isServerSide() ? 0 : nextJssInstanceId++;
177
197
  }
178
- }), 1), instanceId = ref[0];
198
+ }), 1), instanceId = ref6[0];
179
199
  var classNamePrefix = React.useMemo(function() {
180
200
  return process.env.NODE_ENV === "test" ? "" : "mistica-".concat(_packageVersion.PACKAGE_VERSION.replace(/\./g, "-"), "_").concat(instanceId, "_");
181
201
  }, [
@@ -187,6 +207,7 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
187
207
  }, []);
188
208
  var isOsDarkModeEnabled = useIsOsDarkModeEnabled();
189
209
  var contextTheme = React.useMemo(function() {
210
+ var ref, ref1, ref2, ref3, ref4, ref5;
190
211
  var _colorScheme;
191
212
  // TODO: In next major version we could change this to "auto" by default
192
213
  var colorScheme = (_colorScheme = theme.colorScheme) !== null && _colorScheme !== void 0 ? _colorScheme : "light";
@@ -213,6 +234,14 @@ var ThemeContextProvider = function ThemeContextProvider(param) {
213
234
  dimensions: _objectSpread({}, _theme.dimensions, theme.dimensions),
214
235
  mq: (0, _mediaQueries).createMediaQueries((_mediaQueries1 = theme.mediaQueries) !== null && _mediaQueries1 !== void 0 ? _mediaQueries1 : _theme.mediaQueriesConfig),
215
236
  colors: colors,
237
+ textPresets: {
238
+ text5: _objectSpread({}, defaultTextPresetsConfig.text5, (ref = theme.skin.textPresets) === null || ref === void 0 ? void 0 : ref.text5),
239
+ text6: _objectSpread({}, defaultTextPresetsConfig.text6, (ref1 = theme.skin.textPresets) === null || ref1 === void 0 ? void 0 : ref1.text6),
240
+ text7: _objectSpread({}, defaultTextPresetsConfig.text7, (ref2 = theme.skin.textPresets) === null || ref2 === void 0 ? void 0 : ref2.text7),
241
+ text8: _objectSpread({}, defaultTextPresetsConfig.text8, (ref3 = theme.skin.textPresets) === null || ref3 === void 0 ? void 0 : ref3.text8),
242
+ text9: _objectSpread({}, defaultTextPresetsConfig.text9, (ref4 = theme.skin.textPresets) === null || ref4 === void 0 ? void 0 : ref4.text9),
243
+ text10: _objectSpread({}, defaultTextPresetsConfig.text10, (ref5 = theme.skin.textPresets) === null || ref5 === void 0 ? void 0 : ref5.text10)
244
+ },
216
245
  Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : _theme.AnchorLink,
217
246
  isDarkMode: isDarkModeEnabled,
218
247
  isIos: (0, _platform).getPlatform(platformOverrides) === "ios",
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { RegionCode } from './utils/region-code';
3
3
  import type { Locale } from './utils/locale';
4
- import type { Skin, Colors, SkinName } from './skins/types';
4
+ import type { Skin, Colors, SkinName, TextPresetsConfig } from './skins/types';
5
5
  import type { TrackingEvent } from './utils/types';
6
6
  import type { MediaQueries } from './utils/media-queries';
7
7
  export declare type ThemeTexts = typeof TEXTS_ES;
@@ -127,6 +127,7 @@ export declare type Theme = {
127
127
  };
128
128
  mq: MediaQueries;
129
129
  colors: Colors;
130
+ textPresets: TextPresetsConfig;
130
131
  Link: LinkComponent;
131
132
  isDarkMode: boolean;
132
133
  isIos: boolean;
@@ -3,7 +3,7 @@
3
3
  import * as React from "react";
4
4
  import type { RegionCode } from "./utils/region-code";
5
5
  import type { Locale } from "./utils/locale";
6
- import type { Skin, Colors, SkinName } from "./skins/types";
6
+ import type { Skin, Colors, SkinName, TextPresetsConfig } from "./skins/types";
7
7
  import type { TrackingEvent } from "./utils/types";
8
8
  import type { MediaQueries } from "./utils/media-queries";
9
9
  export type ThemeTexts = typeof TEXTS_ES;
@@ -131,6 +131,7 @@ export type Theme = {
131
131
  },
132
132
  mq: MediaQueries,
133
133
  colors: Colors,
134
+ textPresets: TextPresetsConfig,
134
135
  Link: LinkComponent,
135
136
  isDarkMode: boolean,
136
137
  isIos: boolean,
package/dist/video.js CHANGED
@@ -103,10 +103,6 @@ var useStyles = (0, _jss).createUseStyles(function() {
103
103
  objectFit: "cover",
104
104
  maxWidth: "100%",
105
105
  maxHeight: "100%",
106
- borderRadius: function borderRadius(param) {
107
- var noBorderRadius = param.noBorderRadius;
108
- return noBorderRadius ? 0 : 4;
109
- },
110
106
  "@supports (aspect-ratio: 1 / 1)": {
111
107
  aspectRatio: function aspectRatio(param) {
112
108
  var aspectRatio1 = param.aspectRatio;
@@ -115,7 +111,10 @@ var useStyles = (0, _jss).createUseStyles(function() {
115
111
  },
116
112
  "$wrapper &": {
117
113
  borderRadius: 0,
118
- position: "absolute",
114
+ position: function position(param) {
115
+ var aspectRatio = param.aspectRatio;
116
+ return aspectRatio ? "absolute" : "static";
117
+ },
119
118
  width: "100%",
120
119
  height: "100%",
121
120
  top: 0,
@@ -123,10 +122,6 @@ var useStyles = (0, _jss).createUseStyles(function() {
123
122
  }
124
123
  },
125
124
  wrapper: {
126
- borderRadius: function borderRadius(param) {
127
- var noBorderRadius = param.noBorderRadius;
128
- return noBorderRadius ? 0 : 4;
129
- },
130
125
  overflow: "hidden",
131
126
  maxWidth: "100%",
132
127
  maxHeight: "100%",
@@ -134,7 +129,7 @@ var useStyles = (0, _jss).createUseStyles(function() {
134
129
  paddingTop: function paddingTop(param) {
135
130
  var aspectRatio = param.aspectRatio, width = param.width;
136
131
  if (!aspectRatio) {
137
- return "initial";
132
+ return 0;
138
133
  }
139
134
  if (width && typeof width === "string" && width.endsWith("%")) {
140
135
  return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
@@ -146,7 +141,7 @@ var useStyles = (0, _jss).createUseStyles(function() {
146
141
  });
147
142
  /** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC";
148
143
  var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
149
- var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? "none" : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
144
+ var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? !(0, _platform).isRunningAcceptanceTest() : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? "none" : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
150
145
  "src",
151
146
  "poster",
152
147
  "autoPlay",
@@ -163,7 +158,6 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
163
158
  // if aspect ratio is 0, we use the original video proportions
164
159
  var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
165
160
  var classes = useStyles({
166
- noBorderRadius: noBorderRadius,
167
161
  aspectRatio: withCssAspectRatio ? ratio : undefined,
168
162
  width: props.width
169
163
  });
@@ -194,9 +188,9 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
194
188
  width = props.width;
195
189
  height = props.height;
196
190
  } else if (typeof props.width === "number") {
197
- height = props.width / ratio;
191
+ height = ratio ? props.width / ratio : undefined;
198
192
  } else if (typeof props.height === "number") {
199
- width = props.height * ratio;
193
+ width = ratio ? props.height * ratio : undefined;
200
194
  } else {
201
195
  width = props.width || "100%";
202
196
  }
@@ -213,15 +207,21 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
213
207
  autoPlay: autoPlay,
214
208
  muted: muted,
215
209
  loop: loop
216
- }, needsWrapper ? {} : {
210
+ }, needsWrapper ? {
211
+ width: "100%"
212
+ } : {
217
213
  width: width,
218
214
  height: height
219
215
  }, {
220
216
  className: classes.video,
221
217
  preload: preload,
222
218
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
223
- poster: needsWrapper ? TRANSPARENT_PIXEL : poster || TRANSPARENT_PIXEL
219
+ poster: poster || TRANSPARENT_PIXEL
224
220
  }, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
221
+ style: {
222
+ // For some reason adding this style with JSS doesn't add the border radius in safari
223
+ borderRadius: noBorderRadius ? 0 : 4
224
+ },
225
225
  children: sources.map(function(param, index) {
226
226
  var src = param.src, type = param.type;
227
227
  return /*#__PURE__*/ (0, _jsxRuntime).jsx("source", {
@@ -235,9 +235,11 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
235
235
  style: {
236
236
  width: width,
237
237
  height: height,
238
+ // adding the poster as background image avoids the flicker in Safari
238
239
  backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
239
240
  backgroundSize: "cover",
240
- backgroundPosition: "50% 50%"
241
+ backgroundPosition: "50% 50%",
242
+ borderRadius: noBorderRadius ? 0 : 4
241
243
  },
242
244
  className: classes.wrapper,
243
245
  children: video1
package/dist-es/image.js CHANGED
@@ -137,7 +137,11 @@ var useStyles = createUseStyles(function() {
137
137
  },
138
138
  "$wrapper &": {
139
139
  borderRadius: 0,
140
- position: "absolute",
140
+ position: function(param) {
141
+ var aspectRatio = param.aspectRatio;
142
+ return(// when aspectRatio is 0, we want the video to use the original aspect ratio
143
+ aspectRatio ? "absolute" : "static");
144
+ },
141
145
  width: "100%",
142
146
  height: "100%",
143
147
  top: 0,
@@ -160,7 +164,7 @@ var useStyles = createUseStyles(function() {
160
164
  paddingTop: function(param) {
161
165
  var aspectRatio = param.aspectRatio, width = param.width;
162
166
  if (!aspectRatio) {
163
- return "initial";
167
+ return 0;
164
168
  }
165
169
  if (width && typeof width === "string" && width.endsWith("%")) {
166
170
  return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
@@ -206,9 +210,9 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
206
210
  width = props.width;
207
211
  height = props.height;
208
212
  } else if (typeof props.width === "number") {
209
- height = props.width / ratio;
213
+ height = ratio ? props.width / ratio : undefined;
210
214
  } else if (typeof props.height === "number") {
211
- width = props.height * ratio;
215
+ width = ratio ? props.height * ratio : undefined;
212
216
  } else {
213
217
  width = props.width || "100%";
214
218
  }
@@ -228,10 +232,12 @@ var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
228
232
  setIsError(false);
229
233
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(event);
230
234
  }
231
- }, !needsWrapper ? {
235
+ }, needsWrapper ? {
236
+ width: "100%"
237
+ } : {
232
238
  width: width,
233
239
  height: height
234
- } : {}));
240
+ }));
235
241
  if (needsWrapper) {
236
242
  return /*#__PURE__*/ _jsx("div", {
237
243
  style: {
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = "11.11.1";
2
+ export var PACKAGE_VERSION = "11.12.2";
package/dist-es/text.js CHANGED
@@ -33,6 +33,7 @@ import { createUseStyles } from "./jss";
33
33
  import { useIsInverseVariant } from "./theme-variant-context";
34
34
  import { pxToRem } from "./utils/css";
35
35
  import { getPrefixedDataAttributes } from "./utils/dom";
36
+ import { useTheme } from "./hooks";
36
37
  var useStyles = createUseStyles(function(theme) {
37
38
  var mapToWeight = {
38
39
  light: 300,
@@ -86,9 +87,12 @@ var useStyles = createUseStyles(function(theme) {
86
87
  return wordBreak ? "anywhere" : "inherit";
87
88
  },
88
89
  "@supports not (overflow-wrap: anywhere)": {
90
+ // "overflow-wrap: anywhere" is not supported in Safari
91
+ // "word-break: break-word" has the same effect as "word-break: normal" and "overflow-wrap: anywhere",
92
+ // regardless of the actual value of the overflow-wrap property.
89
93
  wordBreak: function(param) {
90
94
  var wordBreak = param.wordBreak;
91
- return wordBreak ? "break-all" : "inherit";
95
+ return wordBreak ? "break-word" : "inherit";
92
96
  }
93
97
  },
94
98
  // Needed to reset the default browser margin that adds to p, h1, h2... elements.
@@ -107,10 +111,11 @@ var useStyles = createUseStyles(function(theme) {
107
111
  "-webkit-line-clamp": lineClamp,
108
112
  lineClamp: lineClamp,
109
113
  wordBreak: function(param) {
110
- var wordBreak = param.wordBreak;
111
- return wordBreak ? "break-all" : "normal";
114
+ var truncate = param.truncate;
115
+ return truncate === 1 || truncate === true ? "break-all" : "break-word";
112
116
  },
113
117
  "@supports (overflow-wrap: anywhere)": {
118
+ overflowWrap: "anywhere",
114
119
  wordBreak: function(param) {
115
120
  var truncate = param.truncate;
116
121
  return truncate === 1 || truncate === true ? "break-all" : "normal";
@@ -157,67 +162,73 @@ var getWeight = function(props) {
157
162
  return props.light && "light" || props.regular && "regular" || props.medium && "medium";
158
163
  };
159
164
  export var Text10 = function(props) {
165
+ var textPresets = useTheme().textPresets;
160
166
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
161
167
  mobileSize: 32,
162
168
  mobileLineHeight: "40px",
163
169
  desktopSize: 64,
164
170
  desktopLineHeight: "72px",
165
- weight: "light"
171
+ weight: textPresets.text10.weight
166
172
  }, props, {
167
173
  children: props.children
168
174
  }));
169
175
  };
170
176
  export var Text9 = function(props) {
177
+ var textPresets = useTheme().textPresets;
171
178
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
172
179
  mobileSize: 32,
173
180
  mobileLineHeight: "40px",
174
181
  desktopSize: 56,
175
182
  desktopLineHeight: "64px",
176
- weight: "light"
183
+ weight: textPresets.text9.weight
177
184
  }, props, {
178
185
  children: props.children
179
186
  }));
180
187
  };
181
188
  export var Text8 = function(props) {
189
+ var textPresets = useTheme().textPresets;
182
190
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
183
191
  mobileSize: 32,
184
192
  mobileLineHeight: "40px",
185
193
  desktopSize: 40,
186
194
  desktopLineHeight: "48px",
187
- weight: "light"
195
+ weight: textPresets.text8.weight
188
196
  }, props, {
189
197
  children: props.children
190
198
  }));
191
199
  };
192
200
  export var Text7 = function(props) {
201
+ var textPresets = useTheme().textPresets;
193
202
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
194
203
  mobileSize: 28,
195
204
  mobileLineHeight: "32px",
196
205
  desktopSize: 40,
197
206
  desktopLineHeight: "48px",
198
- weight: "light"
207
+ weight: textPresets.text7.weight
199
208
  }, props, {
200
209
  children: props.children
201
210
  }));
202
211
  };
203
212
  export var Text6 = function(props) {
213
+ var textPresets = useTheme().textPresets;
204
214
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
205
215
  mobileSize: 24,
206
216
  mobileLineHeight: "32px",
207
217
  desktopSize: 32,
208
218
  desktopLineHeight: "40px",
209
- weight: "light"
219
+ weight: textPresets.text6.weight
210
220
  }, props, {
211
221
  children: props.children
212
222
  }));
213
223
  };
214
224
  export var Text5 = function(props) {
225
+ var textPresets = useTheme().textPresets;
215
226
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
216
227
  mobileSize: 22,
217
228
  mobileLineHeight: "24px",
218
229
  desktopSize: 28,
219
230
  desktopLineHeight: "32px",
220
- weight: "light"
231
+ weight: textPresets.text5.weight
221
232
  }, props, {
222
233
  children: props.children
223
234
  }));
@@ -134,15 +134,35 @@ var useDefaultHrefDecorator = function() {
134
134
  return href;
135
135
  };
136
136
  };
137
+ var defaultTextPresetsConfig = {
138
+ text5: {
139
+ weight: "light"
140
+ },
141
+ text6: {
142
+ weight: "light"
143
+ },
144
+ text7: {
145
+ weight: "light"
146
+ },
147
+ text8: {
148
+ weight: "light"
149
+ },
150
+ text9: {
151
+ weight: "light"
152
+ },
153
+ text10: {
154
+ weight: "light"
155
+ }
156
+ };
137
157
  var ThemeContextProvider = function(param) {
138
158
  var theme = param.theme, children = param.children, providerId = param.providerId;
139
- var ref = _slicedToArray(React.useState(function() {
159
+ var ref6 = _slicedToArray(React.useState(function() {
140
160
  if (providerId) {
141
161
  return providerId;
142
162
  } else {
143
163
  return isServerSide() ? 0 : nextJssInstanceId++;
144
164
  }
145
- }), 1), instanceId = ref[0];
165
+ }), 1), instanceId = ref6[0];
146
166
  var classNamePrefix = React.useMemo(function() {
147
167
  return process.env.NODE_ENV === "test" ? "" : "mistica-".concat(PACKAGE_VERSION.replace(/\./g, "-"), "_").concat(instanceId, "_");
148
168
  }, [
@@ -154,6 +174,7 @@ var ThemeContextProvider = function(param) {
154
174
  }, []);
155
175
  var isOsDarkModeEnabled = useIsOsDarkModeEnabled();
156
176
  var contextTheme = React.useMemo(function() {
177
+ var ref, ref1, ref2, ref3, ref4, ref5;
157
178
  var _colorScheme;
158
179
  // TODO: In next major version we could change this to "auto" by default
159
180
  var colorScheme = (_colorScheme = theme.colorScheme) !== null && _colorScheme !== void 0 ? _colorScheme : "light";
@@ -180,6 +201,14 @@ var ThemeContextProvider = function(param) {
180
201
  dimensions: _objectSpread({}, dimensions, theme.dimensions),
181
202
  mq: createMediaQueries((_mediaQueries = theme.mediaQueries) !== null && _mediaQueries !== void 0 ? _mediaQueries : mediaQueriesConfig),
182
203
  colors: colors,
204
+ textPresets: {
205
+ text5: _objectSpread({}, defaultTextPresetsConfig.text5, (ref = theme.skin.textPresets) === null || ref === void 0 ? void 0 : ref.text5),
206
+ text6: _objectSpread({}, defaultTextPresetsConfig.text6, (ref1 = theme.skin.textPresets) === null || ref1 === void 0 ? void 0 : ref1.text6),
207
+ text7: _objectSpread({}, defaultTextPresetsConfig.text7, (ref2 = theme.skin.textPresets) === null || ref2 === void 0 ? void 0 : ref2.text7),
208
+ text8: _objectSpread({}, defaultTextPresetsConfig.text8, (ref3 = theme.skin.textPresets) === null || ref3 === void 0 ? void 0 : ref3.text8),
209
+ text9: _objectSpread({}, defaultTextPresetsConfig.text9, (ref4 = theme.skin.textPresets) === null || ref4 === void 0 ? void 0 : ref4.text9),
210
+ text10: _objectSpread({}, defaultTextPresetsConfig.text10, (ref5 = theme.skin.textPresets) === null || ref5 === void 0 ? void 0 : ref5.text10)
211
+ },
183
212
  Link: (_Link = theme.Link) !== null && _Link !== void 0 ? _Link : AnchorLink,
184
213
  isDarkMode: isDarkModeEnabled,
185
214
  isIos: getPlatform(platformOverrides) === "ios",
package/dist-es/video.js CHANGED
@@ -60,7 +60,7 @@ import { createUseStyles } from "./jss";
60
60
  import { useSupportsAspectRatio } from "./utils/aspect-ratio-support";
61
61
  import { combineRefs } from "./utils/common";
62
62
  import { getPrefixedDataAttributes } from "./utils/dom";
63
- import { isSafari } from "./utils/platform";
63
+ import { isRunningAcceptanceTest, isSafari } from "./utils/platform";
64
64
  export var RATIO = {
65
65
  "1:1": 1,
66
66
  "16:9": 16 / 9,
@@ -75,10 +75,6 @@ var useStyles = createUseStyles(function() {
75
75
  objectFit: "cover",
76
76
  maxWidth: "100%",
77
77
  maxHeight: "100%",
78
- borderRadius: function(param) {
79
- var noBorderRadius = param.noBorderRadius;
80
- return noBorderRadius ? 0 : 4;
81
- },
82
78
  "@supports (aspect-ratio: 1 / 1)": {
83
79
  aspectRatio: function(param) {
84
80
  var aspectRatio = param.aspectRatio;
@@ -87,7 +83,11 @@ var useStyles = createUseStyles(function() {
87
83
  },
88
84
  "$wrapper &": {
89
85
  borderRadius: 0,
90
- position: "absolute",
86
+ position: function(param) {
87
+ var aspectRatio = param.aspectRatio;
88
+ return(// when aspectRatio is 0, we want the video to use the original aspect ratio
89
+ aspectRatio ? "absolute" : "static");
90
+ },
91
91
  width: "100%",
92
92
  height: "100%",
93
93
  top: 0,
@@ -95,10 +95,6 @@ var useStyles = createUseStyles(function() {
95
95
  }
96
96
  },
97
97
  wrapper: {
98
- borderRadius: function(param) {
99
- var noBorderRadius = param.noBorderRadius;
100
- return noBorderRadius ? 0 : 4;
101
- },
102
98
  overflow: "hidden",
103
99
  maxWidth: "100%",
104
100
  maxHeight: "100%",
@@ -106,7 +102,7 @@ var useStyles = createUseStyles(function() {
106
102
  paddingTop: function(param) {
107
103
  var aspectRatio = param.aspectRatio, width = param.width;
108
104
  if (!aspectRatio) {
109
- return "initial";
105
+ return 0;
110
106
  }
111
107
  if (width && typeof width === "string" && width.endsWith("%")) {
112
108
  return "".concat(Number(width.replace("%", "")) / aspectRatio, "%");
@@ -118,7 +114,7 @@ var useStyles = createUseStyles(function() {
118
114
  });
119
115
  /** Transparent 1x1px PNG */ var TRANSPARENT_PIXEL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAtJREFUGFdjYAACAAAFAAGq1chRAAAAAElFTkSuQmCC";
120
116
  var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
121
- var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? true : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? "none" : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
117
+ var src1 = _param.src, poster = _param.poster, _autoPlay = _param.autoPlay, autoPlay = _autoPlay === void 0 ? !isRunningAcceptanceTest() : _autoPlay, _muted = _param.muted, muted = _muted === void 0 ? true : _muted, _loop = _param.loop, loop = _loop === void 0 ? true : _loop, _preload = _param.preload, preload = _preload === void 0 ? "none" : _preload, _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? "1:1" : _aspectRatio, dataAttributes = _param.dataAttributes, props = _objectWithoutProperties(_param, [
122
118
  "src",
123
119
  "poster",
124
120
  "autoPlay",
@@ -135,7 +131,6 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
135
131
  // if aspect ratio is 0, we use the original video proportions
136
132
  var withCssAspectRatio = typeof props.width !== "number" && typeof props.height !== "number" && ratio !== 0;
137
133
  var classes = useStyles({
138
- noBorderRadius: noBorderRadius,
139
134
  aspectRatio: withCssAspectRatio ? ratio : undefined,
140
135
  width: props.width
141
136
  });
@@ -166,9 +161,9 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
166
161
  width = props.width;
167
162
  height = props.height;
168
163
  } else if (typeof props.width === "number") {
169
- height = props.width / ratio;
164
+ height = ratio ? props.width / ratio : undefined;
170
165
  } else if (typeof props.height === "number") {
171
- width = props.height * ratio;
166
+ width = ratio ? props.height * ratio : undefined;
172
167
  } else {
173
168
  width = props.width || "100%";
174
169
  }
@@ -185,15 +180,21 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
185
180
  autoPlay: autoPlay,
186
181
  muted: muted,
187
182
  loop: loop
188
- }, needsWrapper ? {} : {
183
+ }, needsWrapper ? {
184
+ width: "100%"
185
+ } : {
189
186
  width: width,
190
187
  height: height
191
188
  }, {
192
189
  className: classes.video,
193
190
  preload: preload,
194
191
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
195
- poster: needsWrapper ? TRANSPARENT_PIXEL : poster || TRANSPARENT_PIXEL
192
+ poster: poster || TRANSPARENT_PIXEL
196
193
  }, getPrefixedDataAttributes(dataAttributes), {
194
+ style: {
195
+ // For some reason adding this style with JSS doesn't add the border radius in safari
196
+ borderRadius: noBorderRadius ? 0 : 4
197
+ },
197
198
  children: sources.map(function(param, index) {
198
199
  var src = param.src, type = param.type;
199
200
  return /*#__PURE__*/ _jsx("source", {
@@ -207,9 +208,11 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
207
208
  style: {
208
209
  width: width,
209
210
  height: height,
211
+ // adding the poster as background image avoids the flicker in Safari
210
212
  backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
211
213
  backgroundSize: "cover",
212
- backgroundPosition: "50% 50%"
214
+ backgroundPosition: "50% 50%",
215
+ borderRadius: noBorderRadius ? 0 : 4
213
216
  },
214
217
  className: classes.wrapper,
215
218
  children: video1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "11.11.1",
3
+ "version": "11.12.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",