@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.
- package/dist/button.js +35 -43
- package/dist/card.d.ts +43 -1
- package/dist/card.js +212 -10
- package/dist/card.js.flow +44 -0
- package/dist/carousel.js +4 -6
- 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/image.js +9 -4
- 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/skins/types.d.ts +15 -0
- package/dist/skins/types.js.flow +23 -0
- package/dist/text.d.ts +1 -1
- package/dist/text.js +14 -7
- package/dist/text.js.flow +1 -1
- package/dist/theme-context-provider.js +31 -2
- package/dist/theme.d.ts +4 -11
- package/dist/theme.js.flow +4 -11
- package/dist/utils/media-queries.d.ts +9 -7
- package/dist/utils/media-queries.js +5 -1
- package/dist/utils/media-queries.js.flow +9 -7
- package/dist/utils/platform.d.ts +8 -1
- package/dist/utils/platform.js +5 -1
- package/dist/utils/platform.js.flow +8 -1
- package/dist/video.js +22 -8
- package/dist-es/button.js +35 -43
- package/dist-es/card.js +211 -9
- package/dist-es/carousel.js +5 -6
- package/dist-es/highlighted-card.js +17 -70
- package/dist-es/image.js +10 -4
- 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/text.js +14 -7
- package/dist-es/theme-context-provider.js +31 -2
- package/dist-es/utils/media-queries.js +5 -1
- package/dist-es/utils/platform.js +8 -0
- package/dist-es/video.js +23 -8
- package/package.json +1 -1
package/dist/button.js
CHANGED
|
@@ -212,13 +212,12 @@ var usePrimaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
212
212
|
// - Make sure that in FF hover still has it's proper styles
|
|
213
213
|
// - Media query with "coarse" (mobile), avoids that in devices that have coarse implemented, focus style doesn't get stuck
|
|
214
214
|
// Must be always declared for Firefox
|
|
215
|
-
"&:hover:not([disabled])": {
|
|
216
|
-
backgroundColor: theme.colors.buttonPrimaryBackgroundHover
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
215
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
216
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundHover
|
|
217
|
+
}, theme.mq.touchableOnly, {
|
|
218
|
+
// Revert hover background in touch devices
|
|
219
|
+
backgroundColor: theme.colors.buttonPrimaryBackground
|
|
220
|
+
})
|
|
222
221
|
},
|
|
223
222
|
inverse: {
|
|
224
223
|
color: theme.colors.textButtonPrimaryInverse,
|
|
@@ -228,14 +227,13 @@ var usePrimaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
228
227
|
color: theme.colors.textButtonPrimaryInverseSelected
|
|
229
228
|
},
|
|
230
229
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
231
|
-
"&:hover:not([disabled])": {
|
|
230
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
232
231
|
color: theme.colors.textButtonPrimaryInverseSelected,
|
|
233
|
-
backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
232
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
|
|
233
|
+
}, theme.mq.touchableOnly, {
|
|
234
|
+
color: theme.colors.textButtonPrimaryInverse,
|
|
235
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
|
|
236
|
+
})
|
|
239
237
|
}
|
|
240
238
|
});
|
|
241
239
|
});
|
|
@@ -257,9 +255,7 @@ var useSecondaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
257
255
|
light: _objectSpread({}, buttonSecondaryLightStyle(theme), {
|
|
258
256
|
"&:enabled:active": _objectSpread({}, buttonSecondaryHoverLightStyle(theme)),
|
|
259
257
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
260
|
-
"&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), {
|
|
261
|
-
"@media (pointer: coarse)": _objectSpread({}, buttonSecondaryLightStyle(theme))
|
|
262
|
-
})
|
|
258
|
+
"&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), _defineProperty({}, theme.mq.touchableOnly, _objectSpread({}, buttonSecondaryLightStyle(theme))))
|
|
263
259
|
}),
|
|
264
260
|
inverse: {
|
|
265
261
|
borderColor: theme.colors.buttonSecondaryBorderInverse,
|
|
@@ -269,14 +265,13 @@ var useSecondaryButtonStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
269
265
|
color: theme.colors.textButtonSecondaryInverseSelected
|
|
270
266
|
},
|
|
271
267
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
272
|
-
"&:hover:not([disabled])": {
|
|
268
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
273
269
|
borderColor: theme.colors.buttonSecondaryBorderSelectedInverse,
|
|
274
|
-
color: theme.colors.textButtonSecondaryInverseSelected
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
270
|
+
color: theme.colors.textButtonSecondaryInverseSelected
|
|
271
|
+
}, theme.mq.touchableOnly, {
|
|
272
|
+
borderColor: theme.colors.buttonSecondaryBorderInverse,
|
|
273
|
+
color: theme.colors.textButtonSecondaryInverse
|
|
274
|
+
})
|
|
280
275
|
}
|
|
281
276
|
});
|
|
282
277
|
});
|
|
@@ -290,13 +285,12 @@ var dangerButtonStyles = function dangerButtonStyles(theme) {
|
|
|
290
285
|
"&[disabled]:not($isLoading)": {
|
|
291
286
|
opacity: 0.5
|
|
292
287
|
},
|
|
293
|
-
"&:hover:not([disabled])": {
|
|
294
|
-
backgroundColor: theme.colors.buttonDangerBackgroundHover
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
288
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
289
|
+
backgroundColor: theme.colors.buttonDangerBackgroundHover
|
|
290
|
+
}, theme.mq.touchableOnly, {
|
|
291
|
+
// Revert hover background in touch devices
|
|
292
|
+
backgroundColor: theme.colors.buttonDangerBackground
|
|
293
|
+
})
|
|
300
294
|
};
|
|
301
295
|
};
|
|
302
296
|
var useDangerButtonStyles = (0, _jss).createUseStyles(function(theme) {
|
|
@@ -480,12 +474,11 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
480
474
|
"&:enabled:active": {
|
|
481
475
|
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
482
476
|
},
|
|
483
|
-
"&:hover:not([disabled])": {
|
|
484
|
-
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
},
|
|
477
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
478
|
+
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
479
|
+
}, theme.mq.touchableOnly, {
|
|
480
|
+
backgroundColor: "initial"
|
|
481
|
+
}),
|
|
489
482
|
"&[disabled]": disabledStyle
|
|
490
483
|
},
|
|
491
484
|
inverse: {
|
|
@@ -493,12 +486,11 @@ var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
|
|
|
493
486
|
"&:enabled:active": {
|
|
494
487
|
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
495
488
|
},
|
|
496
|
-
"&:hover:not([disabled])": {
|
|
497
|
-
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
489
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
490
|
+
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
491
|
+
}, theme.mq.touchableOnly, {
|
|
492
|
+
backgroundColor: "initial"
|
|
493
|
+
})
|
|
502
494
|
},
|
|
503
495
|
aligned: {
|
|
504
496
|
marginLeft: -padding
|
package/dist/card.d.ts
CHANGED
|
@@ -3,18 +3,23 @@ import Tag from './tag';
|
|
|
3
3
|
import { ButtonLink, ButtonPrimary } from './button';
|
|
4
4
|
import Video from './video';
|
|
5
5
|
import Image from './image';
|
|
6
|
-
import type { DataAttributes, RendersElement, RendersNullableElement } from './utils/types';
|
|
6
|
+
import type { DataAttributes, RendersElement, RendersNullableElement, TrackingEvent } from './utils/types';
|
|
7
7
|
declare type MediaCardProps = {
|
|
8
8
|
media: RendersElement<typeof Image> | RendersElement<typeof Video>;
|
|
9
9
|
headline?: string | RendersNullableElement<typeof Tag>;
|
|
10
10
|
pretitle?: string;
|
|
11
|
+
pretitleLinesMax?: number;
|
|
11
12
|
title?: string;
|
|
13
|
+
titleLinesMax?: number;
|
|
12
14
|
description?: string;
|
|
15
|
+
descriptionLinesMax?: number;
|
|
13
16
|
extra?: React.ReactNode;
|
|
14
17
|
button?: RendersNullableElement<typeof ButtonPrimary>;
|
|
15
18
|
buttonLink?: RendersNullableElement<typeof ButtonLink>;
|
|
16
19
|
children?: void;
|
|
20
|
+
dataAttributes?: DataAttributes;
|
|
17
21
|
'aria-label'?: string;
|
|
22
|
+
onClose?: () => void;
|
|
18
23
|
};
|
|
19
24
|
export declare const MediaCard: React.ForwardRefExoticComponent<MediaCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
25
|
interface DataCardProps {
|
|
@@ -24,8 +29,11 @@ interface DataCardProps {
|
|
|
24
29
|
icon?: React.ReactElement;
|
|
25
30
|
headline?: string | RendersNullableElement<typeof Tag>;
|
|
26
31
|
title?: string;
|
|
32
|
+
titleLinesMax?: number;
|
|
27
33
|
subtitle?: string;
|
|
34
|
+
subtitleLinesMax?: number;
|
|
28
35
|
description?: string;
|
|
36
|
+
descriptionLinesMax?: number;
|
|
29
37
|
extra?: React.ReactNode;
|
|
30
38
|
button?: RendersNullableElement<typeof ButtonPrimary>;
|
|
31
39
|
buttonLink?: RendersNullableElement<typeof ButtonLink>;
|
|
@@ -33,6 +41,40 @@ interface DataCardProps {
|
|
|
33
41
|
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
34
42
|
dataAttributes?: DataAttributes;
|
|
35
43
|
'aria-label'?: string;
|
|
44
|
+
onClose?: () => void;
|
|
36
45
|
}
|
|
37
46
|
export declare const DataCard: React.ForwardRefExoticComponent<DataCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
interface SnapCardBaseProps {
|
|
48
|
+
icon?: React.ReactElement;
|
|
49
|
+
title?: string;
|
|
50
|
+
titleLinesMax?: number;
|
|
51
|
+
subtitle?: string;
|
|
52
|
+
subtitleLinesMax?: number;
|
|
53
|
+
/** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
|
|
54
|
+
dataAttributes?: DataAttributes;
|
|
55
|
+
'aria-label'?: string;
|
|
56
|
+
extra?: React.ReactNode;
|
|
57
|
+
isInverse?: boolean;
|
|
58
|
+
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
59
|
+
children?: void;
|
|
60
|
+
}
|
|
61
|
+
interface SnapCardToProps extends SnapCardBaseProps {
|
|
62
|
+
to?: string;
|
|
63
|
+
fullPageOnWebView?: boolean;
|
|
64
|
+
href?: undefined;
|
|
65
|
+
onPress?: undefined;
|
|
66
|
+
}
|
|
67
|
+
interface SnapCardHrefProps extends SnapCardBaseProps {
|
|
68
|
+
href?: string;
|
|
69
|
+
newTab?: boolean;
|
|
70
|
+
onPress?: undefined;
|
|
71
|
+
to?: undefined;
|
|
72
|
+
}
|
|
73
|
+
interface SnapCardOnPressProps extends SnapCardBaseProps {
|
|
74
|
+
onPress?: () => void;
|
|
75
|
+
href?: undefined;
|
|
76
|
+
to?: undefined;
|
|
77
|
+
}
|
|
78
|
+
declare type SnapCardProps = SnapCardToProps | SnapCardHrefProps | SnapCardOnPressProps;
|
|
79
|
+
export declare const SnapCard: React.ForwardRefExoticComponent<SnapCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
80
|
export {};
|
package/dist/card.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.DataCard = exports.MediaCard = void 0;
|
|
5
|
+
exports.SnapCard = exports.DataCard = exports.MediaCard = void 0;
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _tag = _interopRequireDefault(require("./tag"));
|
|
@@ -14,6 +14,8 @@ var _jss = require("./jss");
|
|
|
14
14
|
var _boxed = require("./boxed");
|
|
15
15
|
var _buttonGroup = _interopRequireDefault(require("./button-group"));
|
|
16
16
|
var _image = require("./image");
|
|
17
|
+
var _maybeDismissable = _interopRequireWildcard(require("./maybe-dismissable"));
|
|
18
|
+
var _touchable = _interopRequireDefault(require("./touchable"));
|
|
17
19
|
function _interopRequireDefault(obj) {
|
|
18
20
|
return obj && obj.__esModule ? obj : {
|
|
19
21
|
default: obj
|
|
@@ -40,6 +42,62 @@ function _interopRequireWildcard(obj) {
|
|
|
40
42
|
return newObj;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
45
|
+
function _defineProperty(obj, key, value) {
|
|
46
|
+
if (key in obj) {
|
|
47
|
+
Object.defineProperty(obj, key, {
|
|
48
|
+
value: value,
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
obj[key] = value;
|
|
55
|
+
}
|
|
56
|
+
return obj;
|
|
57
|
+
}
|
|
58
|
+
function _objectSpread(target) {
|
|
59
|
+
var _arguments = arguments, _loop = function(i) {
|
|
60
|
+
var source = _arguments[i] != null ? _arguments[i] : {};
|
|
61
|
+
var ownKeys = Object.keys(source);
|
|
62
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
63
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
64
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
ownKeys.forEach(function(key) {
|
|
68
|
+
_defineProperty(target, key, source[key]);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
for(var i = 1; i < arguments.length; i++)_loop(i);
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
function _objectWithoutProperties(source, excluded) {
|
|
75
|
+
if (source == null) return {};
|
|
76
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
77
|
+
var key, i;
|
|
78
|
+
if (Object.getOwnPropertySymbols) {
|
|
79
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
80
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
81
|
+
key = sourceSymbolKeys[i];
|
|
82
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
83
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
84
|
+
target[key] = source[key];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
90
|
+
if (source == null) return {};
|
|
91
|
+
var target = {};
|
|
92
|
+
var sourceKeys = Object.keys(source);
|
|
93
|
+
var key, i;
|
|
94
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
95
|
+
key = sourceKeys[i];
|
|
96
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
97
|
+
target[key] = source[key];
|
|
98
|
+
}
|
|
99
|
+
return target;
|
|
100
|
+
}
|
|
43
101
|
var useCardContentStyles = (0, _jss).createUseStyles(function() {
|
|
44
102
|
return {
|
|
45
103
|
actions: {
|
|
@@ -50,7 +108,7 @@ var useCardContentStyles = (0, _jss).createUseStyles(function() {
|
|
|
50
108
|
};
|
|
51
109
|
});
|
|
52
110
|
var CardContent = function CardContent(param) {
|
|
53
|
-
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;
|
|
111
|
+
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;
|
|
54
112
|
var theme = (0, _hooks).useTheme();
|
|
55
113
|
var classes = useCardContentStyles();
|
|
56
114
|
var renderHeadline = function renderHeadline() {
|
|
@@ -80,16 +138,24 @@ var CardContent = function CardContent(param) {
|
|
|
80
138
|
space: 4,
|
|
81
139
|
children: [
|
|
82
140
|
pretitle && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text1, {
|
|
141
|
+
wordBreak: true,
|
|
142
|
+
truncate: pretitleLinesMax,
|
|
143
|
+
as: "div",
|
|
83
144
|
regular: true,
|
|
84
145
|
transform: "uppercase",
|
|
85
146
|
children: pretitle
|
|
86
147
|
}),
|
|
87
148
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text4, {
|
|
149
|
+
wordBreak: true,
|
|
150
|
+
truncate: titleLinesMax,
|
|
88
151
|
as: "h1",
|
|
89
152
|
regular: true,
|
|
90
153
|
children: title
|
|
91
154
|
}),
|
|
92
155
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
156
|
+
wordBreak: true,
|
|
157
|
+
truncate: subtitleLinesMax,
|
|
158
|
+
as: "div",
|
|
93
159
|
regular: true,
|
|
94
160
|
children: subtitle
|
|
95
161
|
})
|
|
@@ -99,6 +165,8 @@ var CardContent = function CardContent(param) {
|
|
|
99
165
|
})
|
|
100
166
|
}),
|
|
101
167
|
description && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
168
|
+
wordBreak: true,
|
|
169
|
+
truncate: descriptionLinesMax,
|
|
102
170
|
as: "p",
|
|
103
171
|
regular: true,
|
|
104
172
|
color: theme.colors.textSecondary,
|
|
@@ -119,10 +187,27 @@ var CardContent = function CardContent(param) {
|
|
|
119
187
|
]
|
|
120
188
|
});
|
|
121
189
|
};
|
|
190
|
+
var MaybeSection = function MaybeSection(param) {
|
|
191
|
+
var ariaLabel = param["aria-label"], className = param.className, children = param.children;
|
|
192
|
+
var isDismissable = (0, _maybeDismissable).useIsDismissable();
|
|
193
|
+
if (isDismissable) {
|
|
194
|
+
return /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
195
|
+
className: className,
|
|
196
|
+
children: children
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
return /*#__PURE__*/ (0, _jsxRuntime).jsx("section", {
|
|
200
|
+
className: className,
|
|
201
|
+
"aria-label": ariaLabel,
|
|
202
|
+
children: children
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
122
206
|
var useMediaCardStyles = (0, _jss).createUseStyles(function() {
|
|
123
207
|
return {
|
|
124
208
|
boxed: {
|
|
125
|
-
height: "100%"
|
|
209
|
+
height: "100%",
|
|
210
|
+
width: "100%"
|
|
126
211
|
},
|
|
127
212
|
mediaCard: {
|
|
128
213
|
display: "flex",
|
|
@@ -139,14 +224,15 @@ var useMediaCardStyles = (0, _jss).createUseStyles(function() {
|
|
|
139
224
|
};
|
|
140
225
|
});
|
|
141
226
|
var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
142
|
-
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"];
|
|
227
|
+
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;
|
|
143
228
|
var classes = useMediaCardStyles({
|
|
144
229
|
media: media
|
|
145
230
|
});
|
|
146
|
-
|
|
231
|
+
var content = /*#__PURE__*/ (0, _jsxRuntime).jsx(_boxed.Boxed, {
|
|
147
232
|
className: classes.boxed,
|
|
233
|
+
dataAttributes: dataAttributes,
|
|
148
234
|
ref: ref,
|
|
149
|
-
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(
|
|
235
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(MaybeSection, {
|
|
150
236
|
className: classes.mediaCard,
|
|
151
237
|
"aria-label": ariaLabel,
|
|
152
238
|
children: [
|
|
@@ -158,8 +244,11 @@ var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
158
244
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(CardContent, {
|
|
159
245
|
headline: headline,
|
|
160
246
|
pretitle: pretitle,
|
|
247
|
+
pretitleLinesMax: pretitleLinesMax,
|
|
161
248
|
title: title,
|
|
249
|
+
titleLinesMax: titleLinesMax,
|
|
162
250
|
description: description,
|
|
251
|
+
descriptionLinesMax: descriptionLinesMax,
|
|
163
252
|
extra: extra,
|
|
164
253
|
button: button,
|
|
165
254
|
buttonLink: buttonLink
|
|
@@ -168,12 +257,18 @@ var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
168
257
|
]
|
|
169
258
|
})
|
|
170
259
|
});
|
|
260
|
+
return /*#__PURE__*/ (0, _jsxRuntime).jsx(_maybeDismissable.default, {
|
|
261
|
+
onClose: onClose,
|
|
262
|
+
"aria-label": ariaLabel,
|
|
263
|
+
children: content
|
|
264
|
+
});
|
|
171
265
|
});
|
|
172
266
|
exports.MediaCard = MediaCard;
|
|
173
267
|
var useDataCardStyles = (0, _jss).createUseStyles(function() {
|
|
174
268
|
return {
|
|
175
269
|
boxed: {
|
|
176
|
-
height: "100%"
|
|
270
|
+
height: "100%",
|
|
271
|
+
width: "100%"
|
|
177
272
|
},
|
|
178
273
|
dataCard: {
|
|
179
274
|
display: "flex",
|
|
@@ -184,13 +279,13 @@ var useDataCardStyles = (0, _jss).createUseStyles(function() {
|
|
|
184
279
|
};
|
|
185
280
|
});
|
|
186
281
|
var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
187
|
-
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"];
|
|
282
|
+
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;
|
|
188
283
|
var classes = useDataCardStyles();
|
|
189
|
-
|
|
284
|
+
var content = /*#__PURE__*/ (0, _jsxRuntime).jsx(_boxed.Boxed, {
|
|
190
285
|
className: classes.boxed,
|
|
191
286
|
dataAttributes: dataAttributes,
|
|
192
287
|
ref: ref,
|
|
193
|
-
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(
|
|
288
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(MaybeSection, {
|
|
194
289
|
className: classes.dataCard,
|
|
195
290
|
"aria-label": ariaLabel,
|
|
196
291
|
children: [
|
|
@@ -201,8 +296,11 @@ var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
201
296
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(CardContent, {
|
|
202
297
|
headline: headline,
|
|
203
298
|
title: title,
|
|
299
|
+
titleLinesMax: titleLinesMax,
|
|
204
300
|
subtitle: subtitle,
|
|
301
|
+
subtitleLinesMax: subtitleLinesMax,
|
|
205
302
|
description: description,
|
|
303
|
+
descriptionLinesMax: descriptionLinesMax,
|
|
206
304
|
extra: extra,
|
|
207
305
|
button: button,
|
|
208
306
|
buttonLink: buttonLink
|
|
@@ -210,5 +308,109 @@ var DataCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
210
308
|
]
|
|
211
309
|
})
|
|
212
310
|
});
|
|
311
|
+
return /*#__PURE__*/ (0, _jsxRuntime).jsx(_maybeDismissable.default, {
|
|
312
|
+
"aria-label": ariaLabel,
|
|
313
|
+
onClose: onClose,
|
|
314
|
+
children: content
|
|
315
|
+
});
|
|
213
316
|
});
|
|
214
317
|
exports.DataCard = DataCard;
|
|
318
|
+
var useSnapCardStyles = (0, _jss).createUseStyles(function(theme) {
|
|
319
|
+
return {
|
|
320
|
+
boxed: {
|
|
321
|
+
height: "100%"
|
|
322
|
+
},
|
|
323
|
+
touchable: _defineProperty({
|
|
324
|
+
display: "flex",
|
|
325
|
+
height: "100%"
|
|
326
|
+
}, theme.mq.supportsHover, {
|
|
327
|
+
"&:hover": {
|
|
328
|
+
backgroundColor: function backgroundColor(param) {
|
|
329
|
+
var isTouchable = param.isTouchable, isInverse = param.isInverse;
|
|
330
|
+
return isTouchable && !isInverse && !theme.isDarkMode ? theme.colors.backgroundAlternative : "transparent";
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}),
|
|
334
|
+
snapCard: _defineProperty({
|
|
335
|
+
height: "100%",
|
|
336
|
+
display: "flex",
|
|
337
|
+
flexDirection: "column",
|
|
338
|
+
justifyContent: "space-between",
|
|
339
|
+
padding: 16,
|
|
340
|
+
minHeight: 80,
|
|
341
|
+
minWidth: 104
|
|
342
|
+
}, theme.mq.desktopOrBigger, {
|
|
343
|
+
padding: 24
|
|
344
|
+
})
|
|
345
|
+
};
|
|
346
|
+
});
|
|
347
|
+
var SnapCard = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
348
|
+
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, [
|
|
349
|
+
"icon",
|
|
350
|
+
"title",
|
|
351
|
+
"titleLinesMax",
|
|
352
|
+
"subtitle",
|
|
353
|
+
"subtitleLinesMax",
|
|
354
|
+
"dataAttributes",
|
|
355
|
+
"aria-label",
|
|
356
|
+
"extra",
|
|
357
|
+
"isInverse"
|
|
358
|
+
]);
|
|
359
|
+
var isTouchable = Boolean(touchableProps.to || touchableProps.href || touchableProps.onPress);
|
|
360
|
+
var classes = useSnapCardStyles({
|
|
361
|
+
isTouchable: isTouchable,
|
|
362
|
+
isInverse: isInverse,
|
|
363
|
+
hasIcon: !!icon
|
|
364
|
+
});
|
|
365
|
+
var colors = (0, _hooks).useTheme().colors;
|
|
366
|
+
return /*#__PURE__*/ (0, _jsxRuntime).jsx(_boxed.Boxed, {
|
|
367
|
+
className: classes.boxed,
|
|
368
|
+
dataAttributes: dataAttributes,
|
|
369
|
+
ref: ref,
|
|
370
|
+
isInverse: isInverse,
|
|
371
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
372
|
+
maybe: true
|
|
373
|
+
}, touchableProps, {
|
|
374
|
+
className: classes.touchable,
|
|
375
|
+
"aria-label": ariaLabel,
|
|
376
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs("section", {
|
|
377
|
+
className: classes.snapCard,
|
|
378
|
+
children: [
|
|
379
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs("div", {
|
|
380
|
+
children: [
|
|
381
|
+
icon && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
382
|
+
paddingBottom: 16,
|
|
383
|
+
children: icon
|
|
384
|
+
}),
|
|
385
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
386
|
+
space: 4,
|
|
387
|
+
children: [
|
|
388
|
+
title && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
389
|
+
wordBreak: true,
|
|
390
|
+
truncate: titleLinesMax,
|
|
391
|
+
as: "h1",
|
|
392
|
+
regular: true,
|
|
393
|
+
children: title
|
|
394
|
+
}),
|
|
395
|
+
subtitle && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
396
|
+
wordBreak: true,
|
|
397
|
+
truncate: subtitleLinesMax,
|
|
398
|
+
regular: true,
|
|
399
|
+
color: colors.textSecondary,
|
|
400
|
+
as: "p",
|
|
401
|
+
children: subtitle
|
|
402
|
+
})
|
|
403
|
+
]
|
|
404
|
+
})
|
|
405
|
+
]
|
|
406
|
+
}),
|
|
407
|
+
extra && /*#__PURE__*/ (0, _jsxRuntime).jsx(_box.default, {
|
|
408
|
+
paddingTop: 16,
|
|
409
|
+
children: extra
|
|
410
|
+
})
|
|
411
|
+
]
|
|
412
|
+
})
|
|
413
|
+
}))
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
exports.SnapCard = SnapCard;
|
package/dist/card.js.flow
CHANGED
|
@@ -9,17 +9,23 @@ import type {
|
|
|
9
9
|
DataAttributes,
|
|
10
10
|
RendersElement,
|
|
11
11
|
RendersNullableElement,
|
|
12
|
+
TrackingEvent,
|
|
12
13
|
} from "./utils/types";
|
|
13
14
|
declare type MediaCardProps = {
|
|
14
15
|
media: RendersElement<typeof Image> | RendersElement<typeof Video>,
|
|
15
16
|
headline?: string | RendersNullableElement<typeof Tag>,
|
|
16
17
|
pretitle?: string,
|
|
18
|
+
pretitleLinesMax?: number,
|
|
17
19
|
title?: string,
|
|
20
|
+
titleLinesMax?: number,
|
|
18
21
|
description?: string,
|
|
22
|
+
descriptionLinesMax?: number,
|
|
19
23
|
extra?: React.Node,
|
|
20
24
|
button?: RendersNullableElement<typeof ButtonPrimary>,
|
|
21
25
|
buttonLink?: RendersNullableElement<typeof ButtonLink>,
|
|
26
|
+
dataAttributes?: DataAttributes,
|
|
22
27
|
"aria-label"?: string,
|
|
28
|
+
onClose?: () => void,
|
|
23
29
|
};
|
|
24
30
|
declare export var MediaCard: React.AbstractComponent<MediaCardProps, HTMLDivElement>;
|
|
25
31
|
declare type DataCardProps = {
|
|
@@ -29,8 +35,11 @@ declare type DataCardProps = {
|
|
|
29
35
|
icon?: React.Element<any>,
|
|
30
36
|
headline?: string | RendersNullableElement<typeof Tag>,
|
|
31
37
|
title?: string,
|
|
38
|
+
titleLinesMax?: number,
|
|
32
39
|
subtitle?: string,
|
|
40
|
+
subtitleLinesMax?: number,
|
|
33
41
|
description?: string,
|
|
42
|
+
descriptionLinesMax?: number,
|
|
34
43
|
extra?: React.Node,
|
|
35
44
|
button?: RendersNullableElement<typeof ButtonPrimary>,
|
|
36
45
|
buttonLink?: RendersNullableElement<typeof ButtonLink>,
|
|
@@ -39,6 +48,41 @@ declare type DataCardProps = {
|
|
|
39
48
|
*/
|
|
40
49
|
dataAttributes?: DataAttributes,
|
|
41
50
|
"aria-label"?: string,
|
|
51
|
+
onClose?: () => void,
|
|
42
52
|
};
|
|
43
53
|
declare export var DataCard: React.AbstractComponent<DataCardProps, HTMLDivElement>;
|
|
54
|
+
declare type SnapCardBaseProps = {
|
|
55
|
+
icon?: React.Element<any>,
|
|
56
|
+
title?: string,
|
|
57
|
+
titleLinesMax?: number,
|
|
58
|
+
subtitle?: string,
|
|
59
|
+
subtitleLinesMax?: number,
|
|
60
|
+
/**
|
|
61
|
+
* "data-" prefix is automatically added. For example, use "testid" instead of "data-testid"
|
|
62
|
+
*/
|
|
63
|
+
dataAttributes?: DataAttributes,
|
|
64
|
+
"aria-label"?: string,
|
|
65
|
+
extra?: React.Node,
|
|
66
|
+
isInverse?: boolean,
|
|
67
|
+
trackingEvent?: TrackingEvent | $ReadOnlyArray<TrackingEvent>,
|
|
68
|
+
};
|
|
69
|
+
declare type SnapCardToProps = {
|
|
70
|
+
...$Exact<SnapCardBaseProps>,
|
|
71
|
+
to?: string,
|
|
72
|
+
fullPageOnWebView?: boolean,
|
|
73
|
+
};
|
|
74
|
+
declare type SnapCardHrefProps = {
|
|
75
|
+
...$Exact<SnapCardBaseProps>,
|
|
76
|
+
href?: string,
|
|
77
|
+
newTab?: boolean,
|
|
78
|
+
};
|
|
79
|
+
declare type SnapCardOnPressProps = {
|
|
80
|
+
...$Exact<SnapCardBaseProps>,
|
|
81
|
+
onPress?: () => void,
|
|
82
|
+
};
|
|
83
|
+
declare type SnapCardProps =
|
|
84
|
+
| SnapCardToProps
|
|
85
|
+
| SnapCardHrefProps
|
|
86
|
+
| SnapCardOnPressProps;
|
|
87
|
+
declare export var SnapCard: React.AbstractComponent<SnapCardProps, HTMLDivElement>;
|
|
44
88
|
declare export {};
|
package/dist/carousel.js
CHANGED
|
@@ -201,7 +201,7 @@ var hideScrollbar = {
|
|
|
201
201
|
};
|
|
202
202
|
var arrowButtonSize = 40;
|
|
203
203
|
var arrowButtonStyle = function arrowButtonStyle(theme) {
|
|
204
|
-
return {
|
|
204
|
+
return _defineProperty({
|
|
205
205
|
display: "flex",
|
|
206
206
|
alignItems: "center",
|
|
207
207
|
justifyContent: "center",
|
|
@@ -213,12 +213,10 @@ var arrowButtonStyle = function arrowButtonStyle(theme) {
|
|
|
213
213
|
transition: "opacity 0.2s",
|
|
214
214
|
"&[disabled]": {
|
|
215
215
|
opacity: 0
|
|
216
|
-
},
|
|
217
|
-
// don't show carrousel arrow buttons in touch devices, just regular horizontal scroll
|
|
218
|
-
"@media (pointer: coarse)": {
|
|
219
|
-
display: "none"
|
|
220
216
|
}
|
|
221
|
-
}
|
|
217
|
+
}, theme.mq.touchableOnly, {
|
|
218
|
+
display: "none"
|
|
219
|
+
});
|
|
222
220
|
};
|
|
223
221
|
var useStyles = (0, _jss).createUseStyles(function(theme) {
|
|
224
222
|
var _obj, _obj1, _obj2;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonLink } from './button';
|
|
3
|
-
import type { RendersNullableElement, TrackingEvent } from './utils/types';
|
|
3
|
+
import type { DataAttributes, RendersNullableElement, TrackingEvent } from './utils/types';
|
|
4
4
|
import type { NullableButtonElement } from './button';
|
|
5
5
|
interface CommonProps {
|
|
6
6
|
title: string;
|
|
7
|
+
titleLinesMax?: number;
|
|
7
8
|
description: string;
|
|
9
|
+
descriptionLinesMax?: number;
|
|
8
10
|
imageUrl?: string;
|
|
9
11
|
imageFit?: 'fit' | 'fill';
|
|
10
|
-
backgroundImageUrl?: string;
|
|
11
12
|
onClose?: () => void;
|
|
12
13
|
trackingEvent?: TrackingEvent | ReadonlyArray<TrackingEvent>;
|
|
13
14
|
isInverse?: boolean;
|
|
14
15
|
children?: void;
|
|
15
16
|
'aria-label'?: string;
|
|
16
17
|
width?: string | number;
|
|
18
|
+
dataAttributes?: DataAttributes;
|
|
17
19
|
}
|
|
18
20
|
interface BasicProps extends CommonProps {
|
|
19
21
|
button?: undefined;
|