@telefonica/mistica 11.11.0 → 11.12.1

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/button.js CHANGED
@@ -212,13 +212,12 @@ var usePrimaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
212
212
  // - Make sure that in FF hover still has it's proper styles
213
213
  // - Media query with "coarse" (mobile), avoids that in devices that have coarse implemented, focus style doesn't get stuck
214
214
  // Must be always declared for Firefox
215
- "&:hover:not([disabled])": {
216
- backgroundColor: theme.colors.buttonPrimaryBackgroundHover,
217
- "@media (pointer: coarse)": {
218
- // Revert hover background in touch devices
219
- backgroundColor: theme.colors.buttonPrimaryBackground
220
- }
221
- }
215
+ "&:hover:not([disabled])": _defineProperty({
216
+ backgroundColor: theme.colors.buttonPrimaryBackgroundHover
217
+ }, theme.mq.touchableOnly, {
218
+ // Revert hover background in touch devices
219
+ backgroundColor: theme.colors.buttonPrimaryBackground
220
+ })
222
221
  },
223
222
  inverse: {
224
223
  color: theme.colors.textButtonPrimaryInverse,
@@ -228,14 +227,13 @@ var usePrimaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
228
227
  color: theme.colors.textButtonPrimaryInverseSelected
229
228
  },
230
229
  "&[disabled]:not($isLoading)": disabledStyle,
231
- "&:hover:not([disabled])": {
230
+ "&:hover:not([disabled])": _defineProperty({
232
231
  color: theme.colors.textButtonPrimaryInverseSelected,
233
- backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse,
234
- "@media (pointer: coarse)": {
235
- color: theme.colors.textButtonPrimaryInverse,
236
- backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
237
- }
238
- }
232
+ backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
233
+ }, theme.mq.touchableOnly, {
234
+ color: theme.colors.textButtonPrimaryInverse,
235
+ backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
236
+ })
239
237
  }
240
238
  });
241
239
  });
@@ -257,9 +255,7 @@ var useSecondaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
257
255
  light: _objectSpread({}, buttonSecondaryLightStyle(theme), {
258
256
  "&:enabled:active": _objectSpread({}, buttonSecondaryHoverLightStyle(theme)),
259
257
  "&[disabled]:not($isLoading)": disabledStyle,
260
- "&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), {
261
- "@media (pointer: coarse)": _objectSpread({}, buttonSecondaryLightStyle(theme))
262
- })
258
+ "&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), _defineProperty({}, theme.mq.touchableOnly, _objectSpread({}, buttonSecondaryLightStyle(theme))))
263
259
  }),
264
260
  inverse: {
265
261
  borderColor: theme.colors.buttonSecondaryBorderInverse,
@@ -269,14 +265,13 @@ var useSecondaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
269
265
  color: theme.colors.textButtonSecondaryInverseSelected
270
266
  },
271
267
  "&[disabled]:not($isLoading)": disabledStyle,
272
- "&:hover:not([disabled])": {
268
+ "&:hover:not([disabled])": _defineProperty({
273
269
  borderColor: theme.colors.buttonSecondaryBorderSelectedInverse,
274
- color: theme.colors.textButtonSecondaryInverseSelected,
275
- "@media (pointer: coarse)": {
276
- borderColor: theme.colors.buttonSecondaryBorderInverse,
277
- color: theme.colors.textButtonSecondaryInverse
278
- }
279
- }
270
+ color: theme.colors.textButtonSecondaryInverseSelected
271
+ }, theme.mq.touchableOnly, {
272
+ borderColor: theme.colors.buttonSecondaryBorderInverse,
273
+ color: theme.colors.textButtonSecondaryInverse
274
+ })
280
275
  }
281
276
  });
282
277
  });
@@ -290,13 +285,12 @@ var dangerButtonStyles = function dangerButtonStyles(theme) {
290
285
  "&[disabled]:not($isLoading)": {
291
286
  opacity: 0.5
292
287
  },
293
- "&:hover:not([disabled])": {
294
- backgroundColor: theme.colors.buttonDangerBackgroundHover,
295
- "@media (pointer: coarse)": {
296
- // Revert hover background in touch devices
297
- backgroundColor: theme.colors.buttonDangerBackground
298
- }
299
- }
288
+ "&:hover:not([disabled])": _defineProperty({
289
+ backgroundColor: theme.colors.buttonDangerBackgroundHover
290
+ }, theme.mq.touchableOnly, {
291
+ // Revert hover background in touch devices
292
+ backgroundColor: theme.colors.buttonDangerBackground
293
+ })
300
294
  };
301
295
  };
302
296
  var useDangerButtonStyles = (0, _jss).createUseStyles(function(theme) {
@@ -480,12 +474,11 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
480
474
  "&:enabled:active": {
481
475
  backgroundColor: theme.colors.buttonLinkBackgroundSelected
482
476
  },
483
- "&:hover:not([disabled])": {
484
- backgroundColor: theme.colors.buttonLinkBackgroundSelected,
485
- "@media (pointer: coarse)": {
486
- backgroundColor: "initial"
487
- }
488
- },
477
+ "&:hover:not([disabled])": _defineProperty({
478
+ backgroundColor: theme.colors.buttonLinkBackgroundSelected
479
+ }, theme.mq.touchableOnly, {
480
+ backgroundColor: "initial"
481
+ }),
489
482
  "&[disabled]": disabledStyle
490
483
  },
491
484
  inverse: {
@@ -493,12 +486,11 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
493
486
  "&:enabled:active": {
494
487
  backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
495
488
  },
496
- "&:hover:not([disabled])": {
497
- backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse,
498
- "@media (pointer: coarse)": {
499
- backgroundColor: "initial"
500
- }
501
- }
489
+ "&:hover:not([disabled])": _defineProperty({
490
+ backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
491
+ }, theme.mq.touchableOnly, {
492
+ backgroundColor: "initial"
493
+ })
502
494
  },
503
495
  aligned: {
504
496
  marginLeft: -padding
package/dist/carousel.js CHANGED
@@ -201,7 +201,7 @@ var hideScrollbar = {
201
201
  };
202
202
  var arrowButtonSize = 40;
203
203
  var arrowButtonStyle = function arrowButtonStyle(theme) {
204
- return {
204
+ return _defineProperty({
205
205
  display: "flex",
206
206
  alignItems: "center",
207
207
  justifyContent: "center",
@@ -213,12 +213,10 @@ var arrowButtonStyle = function arrowButtonStyle(theme) {
213
213
  transition: "opacity 0.2s",
214
214
  "&[disabled]": {
215
215
  opacity: 0
216
- },
217
- // don't show carrousel arrow buttons in touch devices, just regular horizontal scroll
218
- "@media (pointer: coarse)": {
219
- display: "none"
220
216
  }
221
- };
217
+ }, theme.mq.touchableOnly, {
218
+ display: "none"
219
+ });
222
220
  };
223
221
  var useStyles = (0, _jss).createUseStyles(function(theme) {
224
222
  var _obj, _obj1, _obj2;
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.0";
6
+ var PACKAGE_VERSION = "11.12.1";
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
@@ -190,72 +191,78 @@ var getWeight = function getWeight(props) {
190
191
  return props.light && "light" || props.regular && "regular" || props.medium && "medium";
191
192
  };
192
193
  var Text10 = function Text10(props) {
194
+ var textPresets = (0, _hooks).useTheme().textPresets;
193
195
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
194
196
  mobileSize: 32,
195
197
  mobileLineHeight: "40px",
196
198
  desktopSize: 64,
197
199
  desktopLineHeight: "72px",
198
- weight: "light"
200
+ weight: textPresets.text10.weight
199
201
  }, props, {
200
202
  children: props.children
201
203
  }));
202
204
  };
203
205
  exports.Text10 = Text10;
204
206
  var Text9 = function Text9(props) {
207
+ var textPresets = (0, _hooks).useTheme().textPresets;
205
208
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
206
209
  mobileSize: 32,
207
210
  mobileLineHeight: "40px",
208
211
  desktopSize: 56,
209
212
  desktopLineHeight: "64px",
210
- weight: "light"
213
+ weight: textPresets.text9.weight
211
214
  }, props, {
212
215
  children: props.children
213
216
  }));
214
217
  };
215
218
  exports.Text9 = Text9;
216
219
  var Text8 = function Text8(props) {
220
+ var textPresets = (0, _hooks).useTheme().textPresets;
217
221
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
218
222
  mobileSize: 32,
219
223
  mobileLineHeight: "40px",
220
224
  desktopSize: 40,
221
225
  desktopLineHeight: "48px",
222
- weight: "light"
226
+ weight: textPresets.text8.weight
223
227
  }, props, {
224
228
  children: props.children
225
229
  }));
226
230
  };
227
231
  exports.Text8 = Text8;
228
232
  var Text7 = function Text7(props) {
233
+ var textPresets = (0, _hooks).useTheme().textPresets;
229
234
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
230
235
  mobileSize: 28,
231
236
  mobileLineHeight: "32px",
232
237
  desktopSize: 40,
233
238
  desktopLineHeight: "48px",
234
- weight: "light"
239
+ weight: textPresets.text7.weight
235
240
  }, props, {
236
241
  children: props.children
237
242
  }));
238
243
  };
239
244
  exports.Text7 = Text7;
240
245
  var Text6 = function Text6(props) {
246
+ var textPresets = (0, _hooks).useTheme().textPresets;
241
247
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
242
248
  mobileSize: 24,
243
249
  mobileLineHeight: "32px",
244
250
  desktopSize: 32,
245
251
  desktopLineHeight: "40px",
246
- weight: "light"
252
+ weight: textPresets.text6.weight
247
253
  }, props, {
248
254
  children: props.children
249
255
  }));
250
256
  };
251
257
  exports.Text6 = Text6;
252
258
  var Text5 = function Text5(props) {
259
+ var textPresets = (0, _hooks).useTheme().textPresets;
253
260
  return /*#__PURE__*/ (0, _jsxRuntime).jsx(Text, _objectSpread({
254
261
  mobileSize: 22,
255
262
  mobileLineHeight: "24px",
256
263
  desktopSize: 28,
257
264
  desktopLineHeight: "32px",
258
- weight: "light"
265
+ weight: textPresets.text5.weight
259
266
  }, props, {
260
267
  children: props.children
261
268
  }));
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,8 +1,9 @@
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
+ import type { MediaQueries } from './utils/media-queries';
6
7
  export declare type ThemeTexts = typeof TEXTS_ES;
7
8
  declare const TEXTS_ES: {
8
9
  expirationDatePlaceholder: string;
@@ -124,17 +125,9 @@ export declare type Theme = {
124
125
  dimensions: {
125
126
  headerMobileHeight: number;
126
127
  };
127
- mq: {
128
- mobile: string;
129
- tablet: string;
130
- desktop: string;
131
- largeDesktop: string;
132
- tabletOrBigger: string;
133
- tabletOrSmaller: string;
134
- desktopOrBigger: string;
135
- supportsHover: string;
136
- };
128
+ mq: MediaQueries;
137
129
  colors: Colors;
130
+ textPresets: TextPresetsConfig;
138
131
  Link: LinkComponent;
139
132
  isDarkMode: boolean;
140
133
  isIos: boolean;
@@ -3,8 +3,9 @@
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
+ import type { MediaQueries } from "./utils/media-queries";
8
9
  export type ThemeTexts = typeof TEXTS_ES;
9
10
  declare var TEXTS_ES: {
10
11
  expirationDatePlaceholder: string,
@@ -128,17 +129,9 @@ export type Theme = {
128
129
  dimensions: {
129
130
  headerMobileHeight: number,
130
131
  },
131
- mq: {
132
- mobile: string,
133
- tablet: string,
134
- desktop: string,
135
- largeDesktop: string,
136
- tabletOrBigger: string,
137
- tabletOrSmaller: string,
138
- desktopOrBigger: string,
139
- supportsHover: string,
140
- },
132
+ mq: MediaQueries,
141
133
  colors: Colors,
134
+ textPresets: TextPresetsConfig,
142
135
  Link: LinkComponent,
143
136
  isDarkMode: boolean,
144
137
  isIos: boolean,
@@ -1,9 +1,4 @@
1
- export declare const createMediaQueries: ({ desktopOrTabletMinHeight, tabletMinWidth, desktopMinWidth, largeDesktopMinWidth, }: {
2
- tabletMinWidth: number;
3
- desktopMinWidth: number;
4
- largeDesktopMinWidth: number;
5
- desktopOrTabletMinHeight: number;
6
- }) => {
1
+ export declare type MediaQueries = Readonly<{
7
2
  mobile: string;
8
3
  tablet: string;
9
4
  desktop: string;
@@ -12,4 +7,11 @@ export declare const createMediaQueries: ({ desktopOrTabletMinHeight, tabletMinW
12
7
  tabletOrSmaller: string;
13
8
  desktopOrBigger: string;
14
9
  supportsHover: string;
15
- };
10
+ touchableOnly: string;
11
+ }>;
12
+ export declare const createMediaQueries: ({ desktopOrTabletMinHeight, tabletMinWidth, desktopMinWidth, largeDesktopMinWidth, }: {
13
+ tabletMinWidth: number;
14
+ desktopMinWidth: number;
15
+ largeDesktopMinWidth: number;
16
+ desktopOrTabletMinHeight: number;
17
+ }) => MediaQueries;
@@ -17,7 +17,11 @@ var createMediaQueries = function createMediaQueries(param) {
17
17
  // Also enabled for (pointer: none) for acceptance tests, where (pointer: fine) doesn't match.
18
18
  // WARNING: you may be tempted to use @media (hover: hover) instead, but that doesn't work as expected in some android browsers.
19
19
  // See: https://hover-pointer-media-query.glitch.me/ and https://github.com/mui-org/material-ui/issues/15736
20
- supportsHover: "@media (pointer: fine), (pointer: none)"
20
+ supportsHover: "@media (pointer: fine), (pointer: none)",
21
+ /**
22
+ * Scopes the styles to touchable devices.
23
+ * See: https://stackoverflow.com/questions/12469875/how-to-code-css-media-queries-targeting-all-mobile-devices-and-tablets/42835826#42835826
24
+ */ touchableOnly: "@media (pointer: coarse), @media (hover: none)"
21
25
  };
22
26
  };
23
27
  exports.createMediaQueries = createMediaQueries;
@@ -1,11 +1,6 @@
1
1
  // @flow
2
2
 
3
- declare export var createMediaQueries: (x: {
4
- tabletMinWidth: number,
5
- desktopMinWidth: number,
6
- largeDesktopMinWidth: number,
7
- desktopOrTabletMinHeight: number,
8
- }) => {
3
+ export type MediaQueries = $ReadOnly<{
9
4
  mobile: string,
10
5
  tablet: string,
11
6
  desktop: string,
@@ -14,4 +9,11 @@ declare export var createMediaQueries: (x: {
14
9
  tabletOrSmaller: string,
15
10
  desktopOrBigger: string,
16
11
  supportsHover: string,
17
- };
12
+ touchableOnly: string,
13
+ }>;
14
+ declare export var createMediaQueries: (x: {
15
+ tabletMinWidth: number,
16
+ desktopMinWidth: number,
17
+ largeDesktopMinWidth: number,
18
+ desktopOrTabletMinHeight: number,
19
+ }) => MediaQueries;
@@ -11,7 +11,7 @@ export declare const isIos: (platformOverrides: Theme['platformOverrides']) => b
11
11
  */
12
12
  export declare const isSafari: () => boolean;
13
13
  export declare const isFirefox: (platformOverrides?: {
14
- platform?: "ios" | "android" | "desktop" | undefined;
14
+ platform?: "desktop" | "ios" | "android" | undefined;
15
15
  insideNovumNativeApp?: boolean | undefined;
16
16
  userAgent?: string | undefined;
17
17
  } | undefined) => boolean;
@@ -22,7 +22,7 @@ declare export var isIos: (
22
22
  declare export var isSafari: () => boolean;
23
23
  declare export var isFirefox: (
24
24
  platformOverrides?: {
25
- platform?: "ios" | "android" | "desktop" | void,
25
+ platform?: "desktop" | "ios" | "android" | void,
26
26
  insideNovumNativeApp?: boolean | void,
27
27
  userAgent?: string | void,
28
28
  } | void
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/button.js CHANGED
@@ -179,13 +179,12 @@ var usePrimaryButtonStyles = createUseStyles(function(theme) {
179
179
  // - Make sure that in FF hover still has it's proper styles
180
180
  // - Media query with "coarse" (mobile), avoids that in devices that have coarse implemented, focus style doesn't get stuck
181
181
  // Must be always declared for Firefox
182
- "&:hover:not([disabled])": {
183
- backgroundColor: theme.colors.buttonPrimaryBackgroundHover,
184
- "@media (pointer: coarse)": {
185
- // Revert hover background in touch devices
186
- backgroundColor: theme.colors.buttonPrimaryBackground
187
- }
188
- }
182
+ "&:hover:not([disabled])": _defineProperty({
183
+ backgroundColor: theme.colors.buttonPrimaryBackgroundHover
184
+ }, theme.mq.touchableOnly, {
185
+ // Revert hover background in touch devices
186
+ backgroundColor: theme.colors.buttonPrimaryBackground
187
+ })
189
188
  },
190
189
  inverse: {
191
190
  color: theme.colors.textButtonPrimaryInverse,
@@ -195,14 +194,13 @@ var usePrimaryButtonStyles = createUseStyles(function(theme) {
195
194
  color: theme.colors.textButtonPrimaryInverseSelected
196
195
  },
197
196
  "&[disabled]:not($isLoading)": disabledStyle,
198
- "&:hover:not([disabled])": {
197
+ "&:hover:not([disabled])": _defineProperty({
199
198
  color: theme.colors.textButtonPrimaryInverseSelected,
200
- backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse,
201
- "@media (pointer: coarse)": {
202
- color: theme.colors.textButtonPrimaryInverse,
203
- backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
204
- }
205
- }
199
+ backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
200
+ }, theme.mq.touchableOnly, {
201
+ color: theme.colors.textButtonPrimaryInverse,
202
+ backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
203
+ })
206
204
  }
207
205
  });
208
206
  });
@@ -224,9 +222,7 @@ var useSecondaryButtonStyles = createUseStyles(function(theme) {
224
222
  light: _objectSpread({}, buttonSecondaryLightStyle(theme), {
225
223
  "&:enabled:active": _objectSpread({}, buttonSecondaryHoverLightStyle(theme)),
226
224
  "&[disabled]:not($isLoading)": disabledStyle,
227
- "&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), {
228
- "@media (pointer: coarse)": _objectSpread({}, buttonSecondaryLightStyle(theme))
229
- })
225
+ "&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), _defineProperty({}, theme.mq.touchableOnly, _objectSpread({}, buttonSecondaryLightStyle(theme))))
230
226
  }),
231
227
  inverse: {
232
228
  borderColor: theme.colors.buttonSecondaryBorderInverse,
@@ -236,14 +232,13 @@ var useSecondaryButtonStyles = createUseStyles(function(theme) {
236
232
  color: theme.colors.textButtonSecondaryInverseSelected
237
233
  },
238
234
  "&[disabled]:not($isLoading)": disabledStyle,
239
- "&:hover:not([disabled])": {
235
+ "&:hover:not([disabled])": _defineProperty({
240
236
  borderColor: theme.colors.buttonSecondaryBorderSelectedInverse,
241
- color: theme.colors.textButtonSecondaryInverseSelected,
242
- "@media (pointer: coarse)": {
243
- borderColor: theme.colors.buttonSecondaryBorderInverse,
244
- color: theme.colors.textButtonSecondaryInverse
245
- }
246
- }
237
+ color: theme.colors.textButtonSecondaryInverseSelected
238
+ }, theme.mq.touchableOnly, {
239
+ borderColor: theme.colors.buttonSecondaryBorderInverse,
240
+ color: theme.colors.textButtonSecondaryInverse
241
+ })
247
242
  }
248
243
  });
249
244
  });
@@ -257,13 +252,12 @@ var dangerButtonStyles = function(theme) {
257
252
  "&[disabled]:not($isLoading)": {
258
253
  opacity: 0.5
259
254
  },
260
- "&:hover:not([disabled])": {
261
- backgroundColor: theme.colors.buttonDangerBackgroundHover,
262
- "@media (pointer: coarse)": {
263
- // Revert hover background in touch devices
264
- backgroundColor: theme.colors.buttonDangerBackground
265
- }
266
- }
255
+ "&:hover:not([disabled])": _defineProperty({
256
+ backgroundColor: theme.colors.buttonDangerBackgroundHover
257
+ }, theme.mq.touchableOnly, {
258
+ // Revert hover background in touch devices
259
+ backgroundColor: theme.colors.buttonDangerBackground
260
+ })
267
261
  };
268
262
  };
269
263
  var useDangerButtonStyles = createUseStyles(function(theme) {
@@ -447,12 +441,11 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
447
441
  "&:enabled:active": {
448
442
  backgroundColor: theme.colors.buttonLinkBackgroundSelected
449
443
  },
450
- "&:hover:not([disabled])": {
451
- backgroundColor: theme.colors.buttonLinkBackgroundSelected,
452
- "@media (pointer: coarse)": {
453
- backgroundColor: "initial"
454
- }
455
- },
444
+ "&:hover:not([disabled])": _defineProperty({
445
+ backgroundColor: theme.colors.buttonLinkBackgroundSelected
446
+ }, theme.mq.touchableOnly, {
447
+ backgroundColor: "initial"
448
+ }),
456
449
  "&[disabled]": disabledStyle
457
450
  },
458
451
  inverse: {
@@ -460,12 +453,11 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
460
453
  "&:enabled:active": {
461
454
  backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
462
455
  },
463
- "&:hover:not([disabled])": {
464
- backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse,
465
- "@media (pointer: coarse)": {
466
- backgroundColor: "initial"
467
- }
468
- }
456
+ "&:hover:not([disabled])": _defineProperty({
457
+ backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
458
+ }, theme.mq.touchableOnly, {
459
+ backgroundColor: "initial"
460
+ })
469
461
  },
470
462
  aligned: {
471
463
  marginLeft: -padding
@@ -168,7 +168,8 @@ var hideScrollbar = {
168
168
  };
169
169
  var arrowButtonSize = 40;
170
170
  var arrowButtonStyle = function(theme) {
171
- return {
171
+ return(// don't show carrousel arrow buttons in touch devices, just regular horizontal scroll
172
+ _defineProperty({
172
173
  display: "flex",
173
174
  alignItems: "center",
174
175
  justifyContent: "center",
@@ -180,12 +181,10 @@ var arrowButtonStyle = function(theme) {
180
181
  transition: "opacity 0.2s",
181
182
  "&[disabled]": {
182
183
  opacity: 0
183
- },
184
- // don't show carrousel arrow buttons in touch devices, just regular horizontal scroll
185
- "@media (pointer: coarse)": {
186
- display: "none"
187
184
  }
188
- };
185
+ }, theme.mq.touchableOnly, {
186
+ display: "none"
187
+ }));
189
188
  };
190
189
  var useStyles = createUseStyles(function(theme) {
191
190
  var _obj, _obj1, _obj2;
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.0";
2
+ export var PACKAGE_VERSION = "11.12.1";
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,
@@ -157,67 +158,73 @@ var getWeight = function(props) {
157
158
  return props.light && "light" || props.regular && "regular" || props.medium && "medium";
158
159
  };
159
160
  export var Text10 = function(props) {
161
+ var textPresets = useTheme().textPresets;
160
162
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
161
163
  mobileSize: 32,
162
164
  mobileLineHeight: "40px",
163
165
  desktopSize: 64,
164
166
  desktopLineHeight: "72px",
165
- weight: "light"
167
+ weight: textPresets.text10.weight
166
168
  }, props, {
167
169
  children: props.children
168
170
  }));
169
171
  };
170
172
  export var Text9 = function(props) {
173
+ var textPresets = useTheme().textPresets;
171
174
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
172
175
  mobileSize: 32,
173
176
  mobileLineHeight: "40px",
174
177
  desktopSize: 56,
175
178
  desktopLineHeight: "64px",
176
- weight: "light"
179
+ weight: textPresets.text9.weight
177
180
  }, props, {
178
181
  children: props.children
179
182
  }));
180
183
  };
181
184
  export var Text8 = function(props) {
185
+ var textPresets = useTheme().textPresets;
182
186
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
183
187
  mobileSize: 32,
184
188
  mobileLineHeight: "40px",
185
189
  desktopSize: 40,
186
190
  desktopLineHeight: "48px",
187
- weight: "light"
191
+ weight: textPresets.text8.weight
188
192
  }, props, {
189
193
  children: props.children
190
194
  }));
191
195
  };
192
196
  export var Text7 = function(props) {
197
+ var textPresets = useTheme().textPresets;
193
198
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
194
199
  mobileSize: 28,
195
200
  mobileLineHeight: "32px",
196
201
  desktopSize: 40,
197
202
  desktopLineHeight: "48px",
198
- weight: "light"
203
+ weight: textPresets.text7.weight
199
204
  }, props, {
200
205
  children: props.children
201
206
  }));
202
207
  };
203
208
  export var Text6 = function(props) {
209
+ var textPresets = useTheme().textPresets;
204
210
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
205
211
  mobileSize: 24,
206
212
  mobileLineHeight: "32px",
207
213
  desktopSize: 32,
208
214
  desktopLineHeight: "40px",
209
- weight: "light"
215
+ weight: textPresets.text6.weight
210
216
  }, props, {
211
217
  children: props.children
212
218
  }));
213
219
  };
214
220
  export var Text5 = function(props) {
221
+ var textPresets = useTheme().textPresets;
215
222
  return /*#__PURE__*/ _jsx(Text, _objectSpread({
216
223
  mobileSize: 22,
217
224
  mobileLineHeight: "24px",
218
225
  desktopSize: 28,
219
226
  desktopLineHeight: "32px",
220
- weight: "light"
227
+ weight: textPresets.text5.weight
221
228
  }, props, {
222
229
  children: props.children
223
230
  }));
@@ -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",
@@ -12,6 +12,10 @@ export var createMediaQueries = function(param) {
12
12
  // Also enabled for (pointer: none) for acceptance tests, where (pointer: fine) doesn't match.
13
13
  // WARNING: you may be tempted to use @media (hover: hover) instead, but that doesn't work as expected in some android browsers.
14
14
  // See: https://hover-pointer-media-query.glitch.me/ and https://github.com/mui-org/material-ui/issues/15736
15
- supportsHover: "@media (pointer: fine), (pointer: none)"
15
+ supportsHover: "@media (pointer: fine), (pointer: none)",
16
+ /**
17
+ * Scopes the styles to touchable devices.
18
+ * See: https://stackoverflow.com/questions/12469875/how-to-code-css-media-queries-targeting-all-mobile-devices-and-tablets/42835826#42835826
19
+ */ touchableOnly: "@media (pointer: coarse), @media (hover: none)"
16
20
  };
17
21
  };
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.0",
3
+ "version": "11.12.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",