@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
package/dist-es/card.js CHANGED
@@ -1,3 +1,58 @@
1
+ function _defineProperty(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _objectSpread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _defineProperty(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ function _objectWithoutProperties(source, excluded) {
30
+ if (source == null) return {};
31
+ var target = _objectWithoutPropertiesLoose(source, excluded);
32
+ var key, i;
33
+ if (Object.getOwnPropertySymbols) {
34
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
35
+ for(i = 0; i < sourceSymbolKeys.length; i++){
36
+ key = sourceSymbolKeys[i];
37
+ if (excluded.indexOf(key) >= 0) continue;
38
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
39
+ target[key] = source[key];
40
+ }
41
+ }
42
+ return target;
43
+ }
44
+ function _objectWithoutPropertiesLoose(source, excluded) {
45
+ if (source == null) return {};
46
+ var target = {};
47
+ var sourceKeys = Object.keys(source);
48
+ var key, i;
49
+ for(i = 0; i < sourceKeys.length; i++){
50
+ key = sourceKeys[i];
51
+ if (excluded.indexOf(key) >= 0) continue;
52
+ target[key] = source[key];
53
+ }
54
+ return target;
55
+ }
1
56
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
57
  import * as React from "react";
3
58
  import Tag from "./tag";
@@ -9,6 +64,8 @@ import { createUseStyles } from "./jss";
9
64
  import { Boxed } from "./boxed";
10
65
  import ButtonGroup from "./button-group";
11
66
  import { DisableBorderRadiusProvider } from "./image";
67
+ import MaybeDismissable, { useIsDismissable } from "./maybe-dismissable";
68
+ import Touchable from "./touchable";
12
69
  var useCardContentStyles = createUseStyles(function() {
13
70
  return {
14
71
  actions: {
@@ -19,7 +76,7 @@ var useCardContentStyles = createUseStyles(function() {
19
76
  };
20
77
  });
21
78
  var CardContent = function(param) {
22
- var headline = param.headline, pretitle = param.pretitle, title = param.title, subtitle = param.subtitle, description = param.description, extra = param.extra, button = param.button, buttonLink = param.buttonLink;
79
+ var headline = param.headline, pretitle = param.pretitle, pretitleLinesMax = param.pretitleLinesMax, title = param.title, titleLinesMax = param.titleLinesMax, subtitle = param.subtitle, subtitleLinesMax = param.subtitleLinesMax, description = param.description, descriptionLinesMax = param.descriptionLinesMax, extra = param.extra, button = param.button, buttonLink = param.buttonLink;
23
80
  var theme = useTheme();
24
81
  var classes = useCardContentStyles();
25
82
  var renderHeadline = function() {
@@ -49,16 +106,24 @@ var CardContent = function(param) {
49
106
  space: 4,
50
107
  children: [
51
108
  pretitle && /*#__PURE__*/ _jsx(Text1, {
109
+ wordBreak: true,
110
+ truncate: pretitleLinesMax,
111
+ as: "div",
52
112
  regular: true,
53
113
  transform: "uppercase",
54
114
  children: pretitle
55
115
  }),
56
116
  /*#__PURE__*/ _jsx(Text4, {
117
+ wordBreak: true,
118
+ truncate: titleLinesMax,
57
119
  as: "h1",
58
120
  regular: true,
59
121
  children: title
60
122
  }),
61
123
  /*#__PURE__*/ _jsx(Text2, {
124
+ wordBreak: true,
125
+ truncate: subtitleLinesMax,
126
+ as: "div",
62
127
  regular: true,
63
128
  children: subtitle
64
129
  })
@@ -68,6 +133,8 @@ var CardContent = function(param) {
68
133
  })
69
134
  }),
70
135
  description && /*#__PURE__*/ _jsx(Text2, {
136
+ wordBreak: true,
137
+ truncate: descriptionLinesMax,
71
138
  as: "p",
72
139
  regular: true,
73
140
  color: theme.colors.textSecondary,
@@ -88,10 +155,27 @@ var CardContent = function(param) {
88
155
  ]
89
156
  });
90
157
  };
158
+ var MaybeSection = function(param) {
159
+ var ariaLabel = param["aria-label"], className = param.className, children = param.children;
160
+ var isDismissable = useIsDismissable();
161
+ if (isDismissable) {
162
+ return /*#__PURE__*/ _jsx("div", {
163
+ className: className,
164
+ children: children
165
+ });
166
+ } else {
167
+ return /*#__PURE__*/ _jsx("section", {
168
+ className: className,
169
+ "aria-label": ariaLabel,
170
+ children: children
171
+ });
172
+ }
173
+ };
91
174
  var useMediaCardStyles = createUseStyles(function() {
92
175
  return {
93
176
  boxed: {
94
- height: "100%"
177
+ height: "100%",
178
+ width: "100%"
95
179
  },
96
180
  mediaCard: {
97
181
  display: "flex",
@@ -108,14 +192,15 @@ var useMediaCardStyles = createUseStyles(function() {
108
192
  };
109
193
  });
110
194
  export var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
111
- var media = param.media, headline = param.headline, pretitle = param.pretitle, title = param.title, description = param.description, extra = param.extra, button = param.button, buttonLink = param.buttonLink, ariaLabel = param["aria-label"];
195
+ var media = param.media, headline = param.headline, pretitle = param.pretitle, pretitleLinesMax = param.pretitleLinesMax, title = param.title, titleLinesMax = param.titleLinesMax, description = param.description, descriptionLinesMax = param.descriptionLinesMax, extra = param.extra, button = param.button, buttonLink = param.buttonLink, dataAttributes = param.dataAttributes, ariaLabel = param["aria-label"], onClose = param.onClose;
112
196
  var classes = useMediaCardStyles({
113
197
  media: media
114
198
  });
115
- return /*#__PURE__*/ _jsx(Boxed, {
199
+ var content = /*#__PURE__*/ _jsx(Boxed, {
116
200
  className: classes.boxed,
201
+ dataAttributes: dataAttributes,
117
202
  ref: ref,
118
- children: /*#__PURE__*/ _jsxs("section", {
203
+ children: /*#__PURE__*/ _jsxs(MaybeSection, {
119
204
  className: classes.mediaCard,
120
205
  "aria-label": ariaLabel,
121
206
  children: [
@@ -127,8 +212,11 @@ export var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
127
212
  children: /*#__PURE__*/ _jsx(CardContent, {
128
213
  headline: headline,
129
214
  pretitle: pretitle,
215
+ pretitleLinesMax: pretitleLinesMax,
130
216
  title: title,
217
+ titleLinesMax: titleLinesMax,
131
218
  description: description,
219
+ descriptionLinesMax: descriptionLinesMax,
132
220
  extra: extra,
133
221
  button: button,
134
222
  buttonLink: buttonLink
@@ -137,11 +225,17 @@ export var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
137
225
  ]
138
226
  })
139
227
  });
228
+ return /*#__PURE__*/ _jsx(MaybeDismissable, {
229
+ onClose: onClose,
230
+ "aria-label": ariaLabel,
231
+ children: content
232
+ });
140
233
  });
141
234
  var useDataCardStyles = createUseStyles(function() {
142
235
  return {
143
236
  boxed: {
144
- height: "100%"
237
+ height: "100%",
238
+ width: "100%"
145
239
  },
146
240
  dataCard: {
147
241
  display: "flex",
@@ -152,13 +246,13 @@ var useDataCardStyles = createUseStyles(function() {
152
246
  };
153
247
  });
154
248
  export var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
155
- var icon = param.icon, headline = param.headline, title = param.title, subtitle = param.subtitle, description = param.description, extra = param.extra, button = param.button, buttonLink = param.buttonLink, dataAttributes = param.dataAttributes, ariaLabel = param["aria-label"];
249
+ var icon = param.icon, headline = param.headline, title = param.title, titleLinesMax = param.titleLinesMax, subtitle = param.subtitle, subtitleLinesMax = param.subtitleLinesMax, description = param.description, descriptionLinesMax = param.descriptionLinesMax, extra = param.extra, button = param.button, buttonLink = param.buttonLink, dataAttributes = param.dataAttributes, ariaLabel = param["aria-label"], onClose = param.onClose;
156
250
  var classes = useDataCardStyles();
157
- return /*#__PURE__*/ _jsx(Boxed, {
251
+ var content = /*#__PURE__*/ _jsx(Boxed, {
158
252
  className: classes.boxed,
159
253
  dataAttributes: dataAttributes,
160
254
  ref: ref,
161
- children: /*#__PURE__*/ _jsxs("section", {
255
+ children: /*#__PURE__*/ _jsxs(MaybeSection, {
162
256
  className: classes.dataCard,
163
257
  "aria-label": ariaLabel,
164
258
  children: [
@@ -169,8 +263,11 @@ export var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
169
263
  /*#__PURE__*/ _jsx(CardContent, {
170
264
  headline: headline,
171
265
  title: title,
266
+ titleLinesMax: titleLinesMax,
172
267
  subtitle: subtitle,
268
+ subtitleLinesMax: subtitleLinesMax,
173
269
  description: description,
270
+ descriptionLinesMax: descriptionLinesMax,
174
271
  extra: extra,
175
272
  button: button,
176
273
  buttonLink: buttonLink
@@ -178,4 +275,109 @@ export var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
178
275
  ]
179
276
  })
180
277
  });
278
+ return /*#__PURE__*/ _jsx(MaybeDismissable, {
279
+ "aria-label": ariaLabel,
280
+ onClose: onClose,
281
+ children: content
282
+ });
283
+ });
284
+ var useSnapCardStyles = createUseStyles(function(theme) {
285
+ return {
286
+ boxed: {
287
+ height: "100%"
288
+ },
289
+ touchable: _defineProperty({
290
+ display: "flex",
291
+ height: "100%"
292
+ }, theme.mq.supportsHover, {
293
+ "&:hover": {
294
+ backgroundColor: function(param) {
295
+ var isTouchable = param.isTouchable, isInverse = param.isInverse;
296
+ return(// @todo: define hover background color for inverse and for dark mode
297
+ isTouchable && !isInverse && !theme.isDarkMode ? theme.colors.backgroundAlternative : "transparent");
298
+ }
299
+ }
300
+ }),
301
+ snapCard: _defineProperty({
302
+ height: "100%",
303
+ display: "flex",
304
+ flexDirection: "column",
305
+ justifyContent: "space-between",
306
+ padding: 16,
307
+ minHeight: 80,
308
+ minWidth: 104
309
+ }, theme.mq.desktopOrBigger, {
310
+ padding: 24
311
+ })
312
+ };
313
+ });
314
+ var SnapCard = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
315
+ var icon = _param.icon, title = _param.title, titleLinesMax = _param.titleLinesMax, subtitle = _param.subtitle, subtitleLinesMax = _param.subtitleLinesMax, dataAttributes = _param.dataAttributes, ariaLabel = _param["aria-label"], extra = _param.extra, _isInverse = _param.isInverse, isInverse = _isInverse === void 0 ? false : _isInverse, touchableProps = _objectWithoutProperties(_param, [
316
+ "icon",
317
+ "title",
318
+ "titleLinesMax",
319
+ "subtitle",
320
+ "subtitleLinesMax",
321
+ "dataAttributes",
322
+ "aria-label",
323
+ "extra",
324
+ "isInverse"
325
+ ]);
326
+ var isTouchable = Boolean(touchableProps.to || touchableProps.href || touchableProps.onPress);
327
+ var classes = useSnapCardStyles({
328
+ isTouchable: isTouchable,
329
+ isInverse: isInverse,
330
+ hasIcon: !!icon
331
+ });
332
+ var colors = useTheme().colors;
333
+ return /*#__PURE__*/ _jsx(Boxed, {
334
+ className: classes.boxed,
335
+ dataAttributes: dataAttributes,
336
+ ref: ref,
337
+ isInverse: isInverse,
338
+ children: /*#__PURE__*/ _jsx(Touchable, _objectSpread({
339
+ maybe: true
340
+ }, touchableProps, {
341
+ className: classes.touchable,
342
+ "aria-label": ariaLabel,
343
+ children: /*#__PURE__*/ _jsxs("section", {
344
+ className: classes.snapCard,
345
+ children: [
346
+ /*#__PURE__*/ _jsxs("div", {
347
+ children: [
348
+ icon && /*#__PURE__*/ _jsx(Box, {
349
+ paddingBottom: 16,
350
+ children: icon
351
+ }),
352
+ /*#__PURE__*/ _jsxs(Stack, {
353
+ space: 4,
354
+ children: [
355
+ title && /*#__PURE__*/ _jsx(Text2, {
356
+ wordBreak: true,
357
+ truncate: titleLinesMax,
358
+ as: "h1",
359
+ regular: true,
360
+ children: title
361
+ }),
362
+ subtitle && /*#__PURE__*/ _jsx(Text2, {
363
+ wordBreak: true,
364
+ truncate: subtitleLinesMax,
365
+ regular: true,
366
+ color: colors.textSecondary,
367
+ as: "p",
368
+ children: subtitle
369
+ })
370
+ ]
371
+ })
372
+ ]
373
+ }),
374
+ extra && /*#__PURE__*/ _jsx(Box, {
375
+ paddingTop: 16,
376
+ children: extra
377
+ })
378
+ ]
379
+ })
380
+ }))
381
+ });
181
382
  });
383
+ export { SnapCard };
@@ -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;
@@ -59,12 +59,10 @@ import { createUseStyles } from "./jss";
59
59
  import { useIsInverseVariant } from "./theme-variant-context";
60
60
  import Box from "./box";
61
61
  import Touchable from "./touchable";
62
- import IconCloseRegular from "./generated/mistica-icons/icon-close-regular";
63
- import { applyAlpha } from "./utils/color";
64
62
  import { useTheme } from "./hooks";
65
63
  import { Text4, Text2 } from "./text";
66
- import IconButton from "./icon-button";
67
64
  import { Boxed } from "./boxed";
65
+ import MaybeDismissable, { useIsDismissable } from "./maybe-dismissable";
68
66
  var useStyles = createUseStyles(function(theme) {
69
67
  var _obj;
70
68
  return {
@@ -85,35 +83,6 @@ var useStyles = createUseStyles(function(theme) {
85
83
  minWidth: 100,
86
84
  height: "inherit"
87
85
  },
88
- dismissableContainer: {
89
- position: "relative",
90
- display: "flex",
91
- flexShrink: 0,
92
- width: function(param) {
93
- var width = param.width;
94
- return width || "100%";
95
- }
96
- },
97
- dismissableButton: {
98
- position: "absolute",
99
- top: 0,
100
- right: 0,
101
- width: 48,
102
- height: 48,
103
- display: "flex",
104
- alignItems: "center",
105
- justifyContent: "center"
106
- },
107
- dismissableCircleContainer: {
108
- display: "flex",
109
- alignItems: "center",
110
- justifyContent: "center",
111
- width: 24,
112
- height: 24,
113
- margin: "0 0 8px 8px",
114
- borderRadius: "50%",
115
- backgroundColor: applyAlpha(theme.colors.background, 0.7)
116
- },
117
86
  textContainer: (_obj = {
118
87
  paddingLeft: 16,
119
88
  paddingTop: 24,
@@ -139,37 +108,6 @@ var useStyles = createUseStyles(function(theme) {
139
108
  }
140
109
  };
141
110
  });
142
- var Dismissable = function(param) {
143
- var children = param.children, width = param.width, _onClose = param.onClose, onClose = _onClose === void 0 ? function() {} : _onClose;
144
- var isInverse = useIsInverseVariant();
145
- var classes = useStyles({
146
- isInverse: isInverse,
147
- width: width
148
- });
149
- var ref = useTheme(), colors = ref.colors, texts = ref.texts;
150
- return /*#__PURE__*/ _jsxs("section", {
151
- className: classes.dismissableContainer,
152
- children: [
153
- children,
154
- /*#__PURE__*/ _jsx(IconButton, {
155
- className: classes.dismissableButton,
156
- onPress: onClose,
157
- "aria-label": texts.closeButtonLabel,
158
- style: {
159
- display: "flex",
160
- width: 48,
161
- height: 48
162
- },
163
- children: /*#__PURE__*/ _jsx("div", {
164
- className: classes.dismissableCircleContainer,
165
- children: /*#__PURE__*/ _jsx(IconCloseRegular, {
166
- color: colors.neutralHigh
167
- })
168
- })
169
- })
170
- ]
171
- });
172
- };
173
111
  var Content = function(props) {
174
112
  var title = props.title, description = props.description, imageUrl = props.imageUrl, imageFit = props.imageFit;
175
113
  var isInverseOutside = useIsInverseVariant();
@@ -181,18 +119,24 @@ var Content = function(props) {
181
119
  width: props.width
182
120
  });
183
121
  var theme = useTheme();
122
+ var isDismissable = useIsDismissable();
184
123
  var content = /*#__PURE__*/ _jsxs(Boxed, {
185
124
  isInverse: isInverse,
186
125
  className: classes.container,
126
+ dataAttributes: props.dataAttributes,
187
127
  children: [
188
128
  /*#__PURE__*/ _jsxs("div", {
189
129
  // don't create another region when the Content is inside a Dismissable wrapper
190
- role: props["aria-label"] ? "region" : undefined,
130
+ role: !isDismissable ? "region" : undefined,
191
131
  className: classes.textContainer,
192
- "aria-label": props["aria-label"],
132
+ // aria-label is already in Dismisable wrapper
133
+ "aria-label": !isDismissable ? props["aria-label"] : undefined,
193
134
  children: [
194
135
  /*#__PURE__*/ _jsx(Text4, {
136
+ as: "h1",
195
137
  regular: true,
138
+ wordBreak: true,
139
+ truncate: props.titleLinesMax,
196
140
  children: title
197
141
  }),
198
142
  /*#__PURE__*/ _jsx(Box, {
@@ -200,6 +144,9 @@ var Content = function(props) {
200
144
  children: /*#__PURE__*/ _jsx(Text2, {
201
145
  regular: true,
202
146
  color: theme.colors.textSecondary,
147
+ wordBreak: true,
148
+ truncate: props.descriptionLinesMax,
149
+ as: "p",
203
150
  children: description
204
151
  })
205
152
  }),
@@ -262,13 +209,13 @@ var HighlightedCard = function(_param) {
262
209
  "aria-label"
263
210
  ]);
264
211
  var label = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : props.title;
265
- return props.onClose ? /*#__PURE__*/ _jsx(Dismissable, {
212
+ return /*#__PURE__*/ _jsx(MaybeDismissable, {
266
213
  onClose: props.onClose,
267
214
  "aria-label": label,
268
215
  width: props.width,
269
- children: /*#__PURE__*/ _jsx(Content, _objectSpread({}, props))
270
- }) : /*#__PURE__*/ _jsx(Content, _objectSpread({}, props, {
271
- "aria-label": label
272
- }));
216
+ children: /*#__PURE__*/ _jsx(Content, _objectSpread({}, props, {
217
+ "aria-label": label
218
+ }))
219
+ });
273
220
  };
274
221
  export default HighlightedCard;
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, "%");
@@ -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: {
package/dist-es/index.js CHANGED
@@ -48,7 +48,7 @@ export { default as Inline } from "./inline";
48
48
  export { default as HighlightedCard } from "./highlighted-card";
49
49
  export { default as Stepper } from "./stepper";
50
50
  export { default as ProgressBar } from "./progress-bar";
51
- export { MediaCard, DataCard } from "./card";
51
+ export { MediaCard, DataCard, SnapCard } from "./card";
52
52
  export { default as Divider } from "./divider";
53
53
  export { default as Menu } from "./menu";
54
54
  export { default as EmptyState } from "./empty-state";
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { createUseStyles } from "./jss";
4
+ import IconCloseRegular from "./generated/mistica-icons/icon-close-regular";
5
+ import { useTheme } from "./hooks";
6
+ import IconButton from "./icon-button";
7
+ import { useIsInverseVariant } from "./theme-variant-context";
8
+ import { applyAlpha } from "./utils/color";
9
+ var DismissableContext = /*#__PURE__*/ React.createContext(false);
10
+ export var useIsDismissable = function() {
11
+ return React.useContext(DismissableContext);
12
+ };
13
+ var useStyles = createUseStyles(function(theme) {
14
+ return {
15
+ dismissableContainer: {
16
+ position: "relative",
17
+ display: "flex",
18
+ flexShrink: 0,
19
+ width: function(param) {
20
+ var width = param.width;
21
+ return width || "100%";
22
+ }
23
+ },
24
+ dismissableButton: {
25
+ position: "absolute",
26
+ top: 0,
27
+ right: 0,
28
+ width: 48,
29
+ height: 48,
30
+ display: "flex",
31
+ alignItems: "center",
32
+ justifyContent: "center"
33
+ },
34
+ dismissableCircleContainer: {
35
+ display: "flex",
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ width: 24,
39
+ height: 24,
40
+ margin: "0 0 8px 8px",
41
+ borderRadius: "50%",
42
+ backgroundColor: applyAlpha(theme.colors.background, 0.7)
43
+ }
44
+ };
45
+ });
46
+ var MaybeDismissable = function(param) {
47
+ var children = param.children, width = param.width, onClose = param.onClose, ariaLabel = param["aria-label"];
48
+ var isInverse = useIsInverseVariant();
49
+ var classes = useStyles({
50
+ isInverse: isInverse,
51
+ width: width
52
+ });
53
+ var ref = useTheme(), colors = ref.colors, texts = ref.texts;
54
+ if (!onClose) {
55
+ return /*#__PURE__*/ _jsx(_Fragment, {
56
+ children: children
57
+ });
58
+ }
59
+ return /*#__PURE__*/ _jsxs("section", {
60
+ className: classes.dismissableContainer,
61
+ "aria-label": ariaLabel,
62
+ children: [
63
+ /*#__PURE__*/ _jsx(DismissableContext.Provider, {
64
+ value: true,
65
+ children: children
66
+ }),
67
+ /*#__PURE__*/ _jsx(IconButton, {
68
+ className: classes.dismissableButton,
69
+ onPress: onClose,
70
+ "aria-label": texts.closeButtonLabel,
71
+ style: {
72
+ display: "flex",
73
+ width: 48,
74
+ height: 48
75
+ },
76
+ children: /*#__PURE__*/ _jsx("div", {
77
+ className: classes.dismissableCircleContainer,
78
+ children: /*#__PURE__*/ _jsx(IconCloseRegular, {
79
+ color: colors.neutralHigh
80
+ })
81
+ })
82
+ })
83
+ ]
84
+ });
85
+ };
86
+ export default MaybeDismissable;
@@ -1,2 +1,2 @@
1
1
  // DO NOT EDIT THIS FILE. It's autogenerated by set-version.js
2
- export var PACKAGE_VERSION = "11.10.2";
2
+ export var PACKAGE_VERSION = "11.12.0";