@telefonica/mistica 11.10.2 → 11.12.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 (45) hide show
  1. package/dist/button.js +35 -43
  2. package/dist/card.d.ts +43 -1
  3. package/dist/card.js +212 -10
  4. package/dist/card.js.flow +44 -0
  5. package/dist/carousel.js +4 -6
  6. package/dist/highlighted-card.d.ts +4 -2
  7. package/dist/highlighted-card.js +19 -72
  8. package/dist/highlighted-card.js.flow +8 -2
  9. package/dist/image.js +9 -4
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +6 -0
  12. package/dist/index.js.flow +1 -1
  13. package/dist/maybe-dismissable.d.ts +10 -0
  14. package/dist/maybe-dismissable.js +119 -0
  15. package/dist/maybe-dismissable.js.flow +12 -0
  16. package/dist/package-version.js +1 -1
  17. package/dist/skins/types.d.ts +15 -0
  18. package/dist/skins/types.js.flow +23 -0
  19. package/dist/text.d.ts +1 -1
  20. package/dist/text.js +14 -7
  21. package/dist/text.js.flow +1 -1
  22. package/dist/theme-context-provider.js +31 -2
  23. package/dist/theme.d.ts +4 -11
  24. package/dist/theme.js.flow +4 -11
  25. package/dist/utils/media-queries.d.ts +9 -7
  26. package/dist/utils/media-queries.js +5 -1
  27. package/dist/utils/media-queries.js.flow +9 -7
  28. package/dist/utils/platform.d.ts +8 -1
  29. package/dist/utils/platform.js +5 -1
  30. package/dist/utils/platform.js.flow +8 -1
  31. package/dist/video.js +22 -8
  32. package/dist-es/button.js +35 -43
  33. package/dist-es/card.js +211 -9
  34. package/dist-es/carousel.js +5 -6
  35. package/dist-es/highlighted-card.js +17 -70
  36. package/dist-es/image.js +10 -4
  37. package/dist-es/index.js +1 -1
  38. package/dist-es/maybe-dismissable.js +86 -0
  39. package/dist-es/package-version.js +1 -1
  40. package/dist-es/text.js +14 -7
  41. package/dist-es/theme-context-provider.js +31 -2
  42. package/dist-es/utils/media-queries.js +5 -1
  43. package/dist-es/utils/platform.js +8 -0
  44. package/dist-es/video.js +23 -8
  45. package/package.json +1 -1
@@ -9,12 +9,10 @@ var _jss = require("./jss");
9
9
  var _themeVariantContext = require("./theme-variant-context");
10
10
  var _box = _interopRequireDefault(require("./box"));
11
11
  var _touchable = _interopRequireDefault(require("./touchable"));
12
- var _iconCloseRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-close-regular"));
13
- var _color = require("./utils/color");
14
12
  var _hooks = require("./hooks");
15
13
  var _text = require("./text");
16
- var _iconButton = _interopRequireDefault(require("./icon-button"));
17
14
  var _boxed = require("./boxed");
15
+ var _maybeDismissable = _interopRequireWildcard(require("./maybe-dismissable"));
18
16
  function _interopRequireDefault(obj) {
19
17
  return obj && obj.__esModule ? obj : {
20
18
  default: obj
@@ -117,35 +115,6 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
117
115
  minWidth: 100,
118
116
  height: "inherit"
119
117
  },
120
- dismissableContainer: {
121
- position: "relative",
122
- display: "flex",
123
- flexShrink: 0,
124
- width: function width(param) {
125
- var width2 = param.width;
126
- return width2 || "100%";
127
- }
128
- },
129
- dismissableButton: {
130
- position: "absolute",
131
- top: 0,
132
- right: 0,
133
- width: 48,
134
- height: 48,
135
- display: "flex",
136
- alignItems: "center",
137
- justifyContent: "center"
138
- },
139
- dismissableCircleContainer: {
140
- display: "flex",
141
- alignItems: "center",
142
- justifyContent: "center",
143
- width: 24,
144
- height: 24,
145
- margin: "0 0 8px 8px",
146
- borderRadius: "50%",
147
- backgroundColor: (0, _color).applyAlpha(theme.colors.background, 0.7)
148
- },
149
118
  textContainer: (_obj = {
150
119
  paddingLeft: 16,
151
120
  paddingTop: 24,
@@ -165,43 +134,12 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
165
134
  display: "flex",
166
135
  flexShrink: 0,
167
136
  width: function width(param) {
168
- var width3 = param.width;
169
- return width3 || "100%";
137
+ var width2 = param.width;
138
+ return width2 || "100%";
170
139
  }
171
140
  }
172
141
  };
173
142
  });
174
- var Dismissable = function Dismissable(param) {
175
- var children = param.children, width = param.width, _onClose = param.onClose, onClose = _onClose === void 0 ? function onClose() {} : _onClose;
176
- var isInverse = (0, _themeVariantContext).useIsInverseVariant();
177
- var classes = useStyles({
178
- isInverse: isInverse,
179
- width: width
180
- });
181
- var ref = (0, _hooks).useTheme(), colors = ref.colors, texts = ref.texts;
182
- return /*#__PURE__*/ (0, _jsxRuntime).jsxs("section", {
183
- className: classes.dismissableContainer,
184
- children: [
185
- children,
186
- /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
187
- className: classes.dismissableButton,
188
- onPress: onClose,
189
- "aria-label": texts.closeButtonLabel,
190
- style: {
191
- display: "flex",
192
- width: 48,
193
- height: 48
194
- },
195
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
196
- className: classes.dismissableCircleContainer,
197
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
198
- color: colors.neutralHigh
199
- })
200
- })
201
- })
202
- ]
203
- });
204
- };
205
143
  var Content = function Content(props) {
206
144
  var title = props.title, description = props.description, imageUrl = props.imageUrl, imageFit = props.imageFit;
207
145
  var isInverseOutside = (0, _themeVariantContext).useIsInverseVariant();
@@ -213,18 +151,24 @@ var Content = function Content(props) {
213
151
  width: props.width
214
152
  });
215
153
  var theme = (0, _hooks).useTheme();
154
+ var isDismissable = (0, _maybeDismissable).useIsDismissable();
216
155
  var content = /*#__PURE__*/ (0, _jsxRuntime).jsxs(_boxed.Boxed, {
217
156
  isInverse: isInverse,
218
157
  className: classes.container,
158
+ dataAttributes: props.dataAttributes,
219
159
  children: [
220
160
  /*#__PURE__*/ (0, _jsxRuntime).jsxs("div", {
221
161
  // don't create another region when the Content is inside a Dismissable wrapper
222
- role: props["aria-label"] ? "region" : undefined,
162
+ role: !isDismissable ? "region" : undefined,
223
163
  className: classes.textContainer,
224
- "aria-label": props["aria-label"],
164
+ // aria-label is already in Dismisable wrapper
165
+ "aria-label": !isDismissable ? props["aria-label"] : undefined,
225
166
  children: [
226
167
  /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text4, {
168
+ as: "h1",
227
169
  regular: true,
170
+ wordBreak: true,
171
+ truncate: props.titleLinesMax,
228
172
  children: title
229
173
  }),
230
174
  /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
@@ -232,6 +176,9 @@ var Content = function Content(props) {
232
176
  children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
233
177
  regular: true,
234
178
  color: theme.colors.textSecondary,
179
+ wordBreak: true,
180
+ truncate: props.descriptionLinesMax,
181
+ as: "p",
235
182
  children: description
236
183
  })
237
184
  }),
@@ -294,14 +241,14 @@ var HighlightedCard = function HighlightedCard(_param) {
294
241
  "aria-label"
295
242
  ]);
296
243
  var label = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : props.title;
297
- return props.onClose ? /*#__PURE__*/ (0, _jsxRuntime).jsx(Dismissable, {
244
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx(_maybeDismissable.default, {
298
245
  onClose: props.onClose,
299
246
  "aria-label": label,
300
247
  width: props.width,
301
- children: /*#__PURE__*/ (0, _jsxRuntime).jsx(Content, _objectSpread({}, props))
302
- }) : /*#__PURE__*/ (0, _jsxRuntime).jsx(Content, _objectSpread({}, props, {
303
- "aria-label": label
304
- }));
248
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(Content, _objectSpread({}, props, {
249
+ "aria-label": label
250
+ }))
251
+ });
305
252
  };
306
253
  var _default = HighlightedCard;
307
254
  exports.default = _default;
@@ -2,19 +2,25 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import { ButtonLink } from "./button";
5
- import type { RendersNullableElement, TrackingEvent } from "./utils/types";
5
+ import type {
6
+ DataAttributes,
7
+ RendersNullableElement,
8
+ TrackingEvent,
9
+ } from "./utils/types";
6
10
  import type { NullableButtonElement } from "./button";
7
11
  declare type CommonProps = {
8
12
  title: string,
13
+ titleLinesMax?: number,
9
14
  description: string,
15
+ descriptionLinesMax?: number,
10
16
  imageUrl?: string,
11
17
  imageFit?: "fit" | "fill",
12
- backgroundImageUrl?: string,
13
18
  onClose?: () => void,
14
19
  trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
15
20
  isInverse?: boolean,
16
21
  "aria-label"?: string,
17
22
  width?: string | number,
23
+ dataAttributes?: DataAttributes,
18
24
  };
19
25
  declare type BasicProps = { ...$Exact<CommonProps> };
20
26
  declare type ButtonProps = {
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, "%");
@@ -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: {
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ export { default as Inline } from './inline';
49
49
  export { default as HighlightedCard } from './highlighted-card';
50
50
  export { default as Stepper } from './stepper';
51
51
  export { default as ProgressBar } from './progress-bar';
52
- export { MediaCard, DataCard } from './card';
52
+ export { MediaCard, DataCard, SnapCard } from './card';
53
53
  export { default as Divider } from './divider';
54
54
  export { default as Menu } from './menu';
55
55
  export { default as EmptyState } from './empty-state';
package/dist/index.js CHANGED
@@ -488,6 +488,12 @@ Object.defineProperty(exports, "DataCard", {
488
488
  return _card.DataCard;
489
489
  }
490
490
  });
491
+ Object.defineProperty(exports, "SnapCard", {
492
+ enumerable: true,
493
+ get: function() {
494
+ return _card.SnapCard;
495
+ }
496
+ });
491
497
  Object.defineProperty(exports, "Divider", {
492
498
  enumerable: true,
493
499
  get: function() {
@@ -85,7 +85,7 @@ declare export { default as Inline } from "./inline";
85
85
  declare export { default as HighlightedCard } from "./highlighted-card";
86
86
  declare export { default as Stepper } from "./stepper";
87
87
  declare export { default as ProgressBar } from "./progress-bar";
88
- declare export { MediaCard, DataCard } from "./card";
88
+ declare export { MediaCard, DataCard, SnapCard } from "./card";
89
89
  declare export { default as Divider } from "./divider";
90
90
  declare export { default as Menu } from "./menu";
91
91
  declare export { default as EmptyState } from "./empty-state";
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ export declare const useIsDismissable: () => boolean;
3
+ declare type MaybeDismissableProps = {
4
+ children: React.ReactNode;
5
+ onClose?: () => void;
6
+ width?: string | number;
7
+ 'aria-label'?: string;
8
+ };
9
+ declare const MaybeDismissable: ({ children, width, onClose, "aria-label": ariaLabel, }: MaybeDismissableProps) => JSX.Element;
10
+ export default MaybeDismissable;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = exports.useIsDismissable = void 0;
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _jss = require("./jss");
9
+ var _iconCloseRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-close-regular"));
10
+ var _hooks = require("./hooks");
11
+ var _iconButton = _interopRequireDefault(require("./icon-button"));
12
+ var _themeVariantContext = require("./theme-variant-context");
13
+ var _color = require("./utils/color");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ function _interopRequireWildcard(obj) {
20
+ if (obj && obj.__esModule) {
21
+ return obj;
22
+ } else {
23
+ var newObj = {};
24
+ if (obj != null) {
25
+ for(var key in obj){
26
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
27
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
28
+ if (desc.get || desc.set) {
29
+ Object.defineProperty(newObj, key, desc);
30
+ } else {
31
+ newObj[key] = obj[key];
32
+ }
33
+ }
34
+ }
35
+ }
36
+ newObj.default = obj;
37
+ return newObj;
38
+ }
39
+ }
40
+ var DismissableContext = /*#__PURE__*/ React.createContext(false);
41
+ var useIsDismissable = function useIsDismissable() {
42
+ return React.useContext(DismissableContext);
43
+ };
44
+ exports.useIsDismissable = useIsDismissable;
45
+ var useStyles = (0, _jss).createUseStyles(function(theme) {
46
+ return {
47
+ dismissableContainer: {
48
+ position: "relative",
49
+ display: "flex",
50
+ flexShrink: 0,
51
+ width: function width(param) {
52
+ var width1 = param.width;
53
+ return width1 || "100%";
54
+ }
55
+ },
56
+ dismissableButton: {
57
+ position: "absolute",
58
+ top: 0,
59
+ right: 0,
60
+ width: 48,
61
+ height: 48,
62
+ display: "flex",
63
+ alignItems: "center",
64
+ justifyContent: "center"
65
+ },
66
+ dismissableCircleContainer: {
67
+ display: "flex",
68
+ alignItems: "center",
69
+ justifyContent: "center",
70
+ width: 24,
71
+ height: 24,
72
+ margin: "0 0 8px 8px",
73
+ borderRadius: "50%",
74
+ backgroundColor: (0, _color).applyAlpha(theme.colors.background, 0.7)
75
+ }
76
+ };
77
+ });
78
+ var MaybeDismissable = function MaybeDismissable(param) {
79
+ var children = param.children, width = param.width, onClose = param.onClose, ariaLabel = param["aria-label"];
80
+ var isInverse = (0, _themeVariantContext).useIsInverseVariant();
81
+ var classes = useStyles({
82
+ isInverse: isInverse,
83
+ width: width
84
+ });
85
+ var ref = (0, _hooks).useTheme(), colors = ref.colors, texts = ref.texts;
86
+ if (!onClose) {
87
+ return /*#__PURE__*/ (0, _jsxRuntime).jsx(_jsxRuntime.Fragment, {
88
+ children: children
89
+ });
90
+ }
91
+ return /*#__PURE__*/ (0, _jsxRuntime).jsxs("section", {
92
+ className: classes.dismissableContainer,
93
+ "aria-label": ariaLabel,
94
+ children: [
95
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(DismissableContext.Provider, {
96
+ value: true,
97
+ children: children
98
+ }),
99
+ /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconButton.default, {
100
+ className: classes.dismissableButton,
101
+ onPress: onClose,
102
+ "aria-label": texts.closeButtonLabel,
103
+ style: {
104
+ display: "flex",
105
+ width: 48,
106
+ height: 48
107
+ },
108
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
109
+ className: classes.dismissableCircleContainer,
110
+ children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_iconCloseRegular.default, {
111
+ color: colors.neutralHigh
112
+ })
113
+ })
114
+ })
115
+ ]
116
+ });
117
+ };
118
+ var _default = MaybeDismissable;
119
+ exports.default = _default;
@@ -0,0 +1,12 @@
1
+ // @flow
2
+
3
+ import * as React from "react";
4
+ declare export var useIsDismissable: () => boolean;
5
+ declare type MaybeDismissableProps = {
6
+ children: React.Node,
7
+ onClose?: () => void,
8
+ width?: string | number,
9
+ "aria-label"?: string,
10
+ };
11
+ declare var MaybeDismissable: (x: MaybeDismissableProps) => React.Node;
12
+ declare export default typeof MaybeDismissable;
@@ -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.10.2";
6
+ var PACKAGE_VERSION = "11.12.0";
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
@@ -148,7 +149,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
148
149
  return truncate === 1 || truncate === true ? "break-all" : "normal";
149
150
  }
150
151
  },
151
- display: "box",
152
+ display: "-webkit-box",
152
153
  boxOrient: "vertical",
153
154
  overflow: "hidden"
154
155
  }
@@ -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",