@telefonica/mistica 11.10.2 → 11.11.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.
@@ -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/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.11.0";
7
7
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
package/dist/text.js CHANGED
@@ -148,7 +148,7 @@ var useStyles = (0, _jss).createUseStyles(function(theme) {
148
148
  return truncate === 1 || truncate === true ? "break-all" : "normal";
149
149
  }
150
150
  },
151
- display: "box",
151
+ display: "-webkit-box",
152
152
  boxOrient: "vertical",
153
153
  overflow: "hidden"
154
154
  }
@@ -3,6 +3,13 @@ export declare const isInsideNovumNativeApp: (platformOverrides?: Theme['platfor
3
3
  export declare const isRunningAcceptanceTest: (platformOverrides?: Theme['platformOverrides']) => boolean;
4
4
  export declare const isAndroid: (platformOverrides: Theme['platformOverrides']) => boolean;
5
5
  export declare const isIos: (platformOverrides: Theme['platformOverrides']) => boolean;
6
+ /**
7
+ * Returns true if the browser is a safari browser:
8
+ * webview, mobile, desktop or a browser like Chrome for iOS which is just a safari with a skin
9
+ *
10
+ * Note that this function checks the navigator vendor. It doesn't use platformOverrides or userAgent.
11
+ */
12
+ export declare const isSafari: () => boolean;
6
13
  export declare const isFirefox: (platformOverrides?: {
7
14
  platform?: "ios" | "android" | "desktop" | undefined;
8
15
  insideNovumNativeApp?: boolean | undefined;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.getPlatform = exports.getIosVersion = exports.isOldChrome = exports.isChrome = exports.isFirefox = exports.isIos = exports.isAndroid = exports.isRunningAcceptanceTest = exports.isInsideNovumNativeApp = void 0;
5
+ exports.getPlatform = exports.getIosVersion = exports.isOldChrome = exports.isChrome = exports.isFirefox = exports.isSafari = exports.isIos = exports.isAndroid = exports.isRunningAcceptanceTest = exports.isInsideNovumNativeApp = void 0;
6
6
  var _webviewBridge = require("@tef-novum/webview-bridge");
7
7
  function _arrayLikeToArray(arr, len) {
8
8
  if (len == null || len > arr.length) len = arr.length;
@@ -91,6 +91,10 @@ var isIos = function isIos(platformOverrides) {
91
91
  return false;
92
92
  };
93
93
  exports.isIos = isIos;
94
+ var isSafari = function isSafari() {
95
+ return navigator.vendor.includes("Apple");
96
+ };
97
+ exports.isSafari = isSafari;
94
98
  var isFirefox = function isFirefox(platformOverrides) {
95
99
  return !!getUserAgent(platformOverrides).match(/Firefox\/([0-9]+)\./);
96
100
  };
@@ -13,6 +13,13 @@ declare export var isAndroid: (
13
13
  declare export var isIos: (
14
14
  platformOverrides: $PropertyType<Theme, "platformOverrides">
15
15
  ) => boolean;
16
+ /**
17
+ * Returns true if the browser is a safari browser:
18
+ * webview, mobile, desktop or a browser like Chrome for iOS which is just a safari with a skin
19
+ *
20
+ * Note that this function checks the navigator vendor. It doesn't use platformOverrides or userAgent.
21
+ */
22
+ declare export var isSafari: () => boolean;
16
23
  declare export var isFirefox: (
17
24
  platformOverrides?: {
18
25
  platform?: "ios" | "android" | "desktop" | void,
package/dist/video.js CHANGED
@@ -10,6 +10,7 @@ var _jss = require("./jss");
10
10
  var _aspectRatioSupport = require("./utils/aspect-ratio-support");
11
11
  var _common = require("./utils/common");
12
12
  var _dom = require("./utils/dom");
13
+ var _platform = require("./utils/platform");
13
14
  function _interopRequireWildcard(obj) {
14
15
  if (obj && obj.__esModule) {
15
16
  return obj;
@@ -97,6 +98,7 @@ exports.RATIO = RATIO;
97
98
  var useStyles = (0, _jss).createUseStyles(function() {
98
99
  return {
99
100
  video: {
101
+ background: "transparent",
100
102
  display: "block",
101
103
  objectFit: "cover",
102
104
  maxWidth: "100%",
@@ -198,7 +200,11 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
198
200
  } else {
199
201
  width = props.width || "100%";
200
202
  }
201
- var needsWrapper = withCssAspectRatio && !supportsAspectRatio;
203
+ /**
204
+ * In safari, when using a video with poster, the transition from pause to play does a flicker,
205
+ * To avoid this, in Safari browsers, instead of using the poster attribute, we use a
206
+ * wrapper with the poster as background image
207
+ */ var needsWrapper = (0, _platform).isSafari() || withCssAspectRatio && !supportsAspectRatio;
202
208
  var video1 = /*#__PURE__*/ (0, _jsxRuntime).jsx("video", _objectSpread({
203
209
  ref: (0, _common).combineRefs(ref, videoRef),
204
210
  playsInline: true,
@@ -207,14 +213,14 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
207
213
  autoPlay: autoPlay,
208
214
  muted: muted,
209
215
  loop: loop
210
- }, !needsWrapper ? {
216
+ }, needsWrapper ? {} : {
211
217
  width: width,
212
218
  height: height
213
- } : {}, {
219
+ }, {
214
220
  className: classes.video,
215
221
  preload: preload,
216
222
  // This transparent pixel fallback avoids showing the ugly "play" image in android webviews
217
- poster: poster || TRANSPARENT_PIXEL
223
+ poster: needsWrapper ? TRANSPARENT_PIXEL : poster || TRANSPARENT_PIXEL
218
224
  }, (0, _dom).getPrefixedDataAttributes(dataAttributes), {
219
225
  children: sources.map(function(param, index) {
220
226
  var src = param.src, type = param.type;
@@ -228,7 +234,10 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
228
234
  return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
229
235
  style: {
230
236
  width: width,
231
- height: height
237
+ height: height,
238
+ backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
239
+ backgroundSize: "cover",
240
+ backgroundPosition: "50% 50%"
232
241
  },
233
242
  className: classes.wrapper,
234
243
  children: video1
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 };