@telefonica/mistica 11.10.0 → 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.
- package/dist/card.d.ts +43 -1
- package/dist/card.js +212 -10
- package/dist/card.js.flow +44 -0
- package/dist/highlighted-card.d.ts +4 -2
- package/dist/highlighted-card.js +19 -72
- package/dist/highlighted-card.js.flow +8 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.flow +1 -1
- package/dist/maybe-dismissable.d.ts +10 -0
- package/dist/maybe-dismissable.js +119 -0
- package/dist/maybe-dismissable.js.flow +12 -0
- package/dist/package-version.js +1 -1
- package/dist/select.js +1 -1
- package/dist/text.js +9 -3
- package/dist/utils/platform.d.ts +7 -0
- package/dist/utils/platform.js +5 -1
- package/dist/utils/platform.js.flow +7 -0
- package/dist/video.js +14 -5
- package/dist-es/card.js +211 -9
- package/dist-es/highlighted-card.js +17 -70
- package/dist-es/index.js +1 -1
- package/dist-es/maybe-dismissable.js +86 -0
- package/dist-es/package-version.js +1 -1
- package/dist-es/select.js +1 -1
- package/dist-es/text.js +7 -1
- package/dist-es/utils/platform.js +8 -0
- package/dist-es/video.js +14 -5
- package/package.json +3 -3
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
|
-
|
|
199
|
+
var content = /*#__PURE__*/ _jsx(Boxed, {
|
|
116
200
|
className: classes.boxed,
|
|
201
|
+
dataAttributes: dataAttributes,
|
|
117
202
|
ref: ref,
|
|
118
|
-
children: /*#__PURE__*/ _jsxs(
|
|
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
|
-
|
|
251
|
+
var content = /*#__PURE__*/ _jsx(Boxed, {
|
|
158
252
|
className: classes.boxed,
|
|
159
253
|
dataAttributes: dataAttributes,
|
|
160
254
|
ref: ref,
|
|
161
|
-
children: /*#__PURE__*/ _jsxs(
|
|
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 };
|
|
@@ -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:
|
|
130
|
+
role: !isDismissable ? "region" : undefined,
|
|
191
131
|
className: classes.textContainer,
|
|
192
|
-
|
|
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
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
})
|
|
216
|
+
children: /*#__PURE__*/ _jsx(Content, _objectSpread({}, props, {
|
|
217
|
+
"aria-label": label
|
|
218
|
+
}))
|
|
219
|
+
});
|
|
273
220
|
};
|
|
274
221
|
export default HighlightedCard;
|
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.
|
|
2
|
+
export var PACKAGE_VERSION = "11.11.0";
|
package/dist-es/select.js
CHANGED
|
@@ -200,7 +200,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
200
200
|
},
|
|
201
201
|
menuItem: (_obj1 = {
|
|
202
202
|
color: theme.colors.textPrimary,
|
|
203
|
-
padding: "
|
|
203
|
+
padding: "8px 16px",
|
|
204
204
|
height: 48,
|
|
205
205
|
transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
|
|
206
206
|
}, _defineProperty(_obj1, theme.mq.supportsHover, {
|
package/dist-es/text.js
CHANGED
|
@@ -85,6 +85,12 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
85
85
|
var wordBreak = param.wordBreak;
|
|
86
86
|
return wordBreak ? "anywhere" : "inherit";
|
|
87
87
|
},
|
|
88
|
+
"@supports not (overflow-wrap: anywhere)": {
|
|
89
|
+
wordBreak: function(param) {
|
|
90
|
+
var wordBreak = param.wordBreak;
|
|
91
|
+
return wordBreak ? "break-all" : "inherit";
|
|
92
|
+
}
|
|
93
|
+
},
|
|
88
94
|
// Needed to reset the default browser margin that adds to p, h1, h2... elements.
|
|
89
95
|
margin: 0
|
|
90
96
|
}, theme.mq.tabletOrSmaller, {
|
|
@@ -110,7 +116,7 @@ var useStyles = createUseStyles(function(theme) {
|
|
|
110
116
|
return truncate === 1 || truncate === true ? "break-all" : "normal";
|
|
111
117
|
}
|
|
112
118
|
},
|
|
113
|
-
display: "box",
|
|
119
|
+
display: "-webkit-box",
|
|
114
120
|
boxOrient: "vertical",
|
|
115
121
|
overflow: "hidden"
|
|
116
122
|
}
|
|
@@ -82,6 +82,14 @@ export var isIos = function(platformOverrides) {
|
|
|
82
82
|
}
|
|
83
83
|
return false;
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Returns true if the browser is a safari browser:
|
|
87
|
+
* webview, mobile, desktop or a browser like Chrome for iOS which is just a safari with a skin
|
|
88
|
+
*
|
|
89
|
+
* Note that this function checks the navigator vendor. It doesn't use platformOverrides or userAgent.
|
|
90
|
+
*/ export var isSafari = function() {
|
|
91
|
+
return navigator.vendor.includes("Apple");
|
|
92
|
+
};
|
|
85
93
|
export var isFirefox = function(platformOverrides) {
|
|
86
94
|
return !!getUserAgent(platformOverrides).match(/Firefox\/([0-9]+)\./);
|
|
87
95
|
};
|
package/dist-es/video.js
CHANGED
|
@@ -60,6 +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
64
|
export var RATIO = {
|
|
64
65
|
"1:1": 1,
|
|
65
66
|
"16:9": 16 / 9,
|
|
@@ -69,6 +70,7 @@ export var RATIO = {
|
|
|
69
70
|
var useStyles = createUseStyles(function() {
|
|
70
71
|
return {
|
|
71
72
|
video: {
|
|
73
|
+
background: "transparent",
|
|
72
74
|
display: "block",
|
|
73
75
|
objectFit: "cover",
|
|
74
76
|
maxWidth: "100%",
|
|
@@ -170,7 +172,11 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
170
172
|
} else {
|
|
171
173
|
width = props.width || "100%";
|
|
172
174
|
}
|
|
173
|
-
|
|
175
|
+
/**
|
|
176
|
+
* In safari, when using a video with poster, the transition from pause to play does a flicker,
|
|
177
|
+
* To avoid this, in Safari browsers, instead of using the poster attribute, we use a
|
|
178
|
+
* wrapper with the poster as background image
|
|
179
|
+
*/ var needsWrapper = isSafari() || withCssAspectRatio && !supportsAspectRatio;
|
|
174
180
|
var video1 = /*#__PURE__*/ _jsx("video", _objectSpread({
|
|
175
181
|
ref: combineRefs(ref, videoRef),
|
|
176
182
|
playsInline: true,
|
|
@@ -179,14 +185,14 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
179
185
|
autoPlay: autoPlay,
|
|
180
186
|
muted: muted,
|
|
181
187
|
loop: loop
|
|
182
|
-
},
|
|
188
|
+
}, needsWrapper ? {} : {
|
|
183
189
|
width: width,
|
|
184
190
|
height: height
|
|
185
|
-
}
|
|
191
|
+
}, {
|
|
186
192
|
className: classes.video,
|
|
187
193
|
preload: preload,
|
|
188
194
|
// This transparent pixel fallback avoids showing the ugly "play" image in android webviews
|
|
189
|
-
poster: poster || TRANSPARENT_PIXEL
|
|
195
|
+
poster: needsWrapper ? TRANSPARENT_PIXEL : poster || TRANSPARENT_PIXEL
|
|
190
196
|
}, getPrefixedDataAttributes(dataAttributes), {
|
|
191
197
|
children: sources.map(function(param, index) {
|
|
192
198
|
var src = param.src, type = param.type;
|
|
@@ -200,7 +206,10 @@ var Video = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
|
200
206
|
return /*#__PURE__*/ _jsx("div", {
|
|
201
207
|
style: {
|
|
202
208
|
width: width,
|
|
203
|
-
height: height
|
|
209
|
+
height: height,
|
|
210
|
+
backgroundImage: poster ? 'url("'.concat(poster, '")') : undefined,
|
|
211
|
+
backgroundSize: "cover",
|
|
212
|
+
backgroundPosition: "50% 50%"
|
|
204
213
|
},
|
|
205
214
|
className: classes.wrapper,
|
|
206
215
|
children: video1
|