@telefonica/mistica 11.10.1 → 11.11.1
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/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 +2 -2
- package/dist/theme.d.ts +2 -10
- package/dist/theme.js.flow +2 -10
- 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 +14 -5
- 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/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 +2 -2
- package/dist-es/utils/media-queries.js +5 -1
- package/dist-es/utils/platform.js +8 -0
- package/dist-es/video.js +14 -5
- package/package.json +2 -2
package/dist-es/button.js
CHANGED
|
@@ -179,13 +179,12 @@ var usePrimaryButtonStyles = createUseStyles(function(theme) {
|
|
|
179
179
|
// - Make sure that in FF hover still has it's proper styles
|
|
180
180
|
// - Media query with "coarse" (mobile), avoids that in devices that have coarse implemented, focus style doesn't get stuck
|
|
181
181
|
// Must be always declared for Firefox
|
|
182
|
-
"&:hover:not([disabled])": {
|
|
183
|
-
backgroundColor: theme.colors.buttonPrimaryBackgroundHover
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
182
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
183
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundHover
|
|
184
|
+
}, theme.mq.touchableOnly, {
|
|
185
|
+
// Revert hover background in touch devices
|
|
186
|
+
backgroundColor: theme.colors.buttonPrimaryBackground
|
|
187
|
+
})
|
|
189
188
|
},
|
|
190
189
|
inverse: {
|
|
191
190
|
color: theme.colors.textButtonPrimaryInverse,
|
|
@@ -195,14 +194,13 @@ var usePrimaryButtonStyles = createUseStyles(function(theme) {
|
|
|
195
194
|
color: theme.colors.textButtonPrimaryInverseSelected
|
|
196
195
|
},
|
|
197
196
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
198
|
-
"&:hover:not([disabled])": {
|
|
197
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
199
198
|
color: theme.colors.textButtonPrimaryInverseSelected,
|
|
200
|
-
backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
199
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundSelectedInverse
|
|
200
|
+
}, theme.mq.touchableOnly, {
|
|
201
|
+
color: theme.colors.textButtonPrimaryInverse,
|
|
202
|
+
backgroundColor: theme.colors.buttonPrimaryBackgroundInverse
|
|
203
|
+
})
|
|
206
204
|
}
|
|
207
205
|
});
|
|
208
206
|
});
|
|
@@ -224,9 +222,7 @@ var useSecondaryButtonStyles = createUseStyles(function(theme) {
|
|
|
224
222
|
light: _objectSpread({}, buttonSecondaryLightStyle(theme), {
|
|
225
223
|
"&:enabled:active": _objectSpread({}, buttonSecondaryHoverLightStyle(theme)),
|
|
226
224
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
227
|
-
"&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), {
|
|
228
|
-
"@media (pointer: coarse)": _objectSpread({}, buttonSecondaryLightStyle(theme))
|
|
229
|
-
})
|
|
225
|
+
"&:hover:not([disabled])": _objectSpread({}, buttonSecondaryHoverLightStyle(theme), _defineProperty({}, theme.mq.touchableOnly, _objectSpread({}, buttonSecondaryLightStyle(theme))))
|
|
230
226
|
}),
|
|
231
227
|
inverse: {
|
|
232
228
|
borderColor: theme.colors.buttonSecondaryBorderInverse,
|
|
@@ -236,14 +232,13 @@ var useSecondaryButtonStyles = createUseStyles(function(theme) {
|
|
|
236
232
|
color: theme.colors.textButtonSecondaryInverseSelected
|
|
237
233
|
},
|
|
238
234
|
"&[disabled]:not($isLoading)": disabledStyle,
|
|
239
|
-
"&:hover:not([disabled])": {
|
|
235
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
240
236
|
borderColor: theme.colors.buttonSecondaryBorderSelectedInverse,
|
|
241
|
-
color: theme.colors.textButtonSecondaryInverseSelected
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
237
|
+
color: theme.colors.textButtonSecondaryInverseSelected
|
|
238
|
+
}, theme.mq.touchableOnly, {
|
|
239
|
+
borderColor: theme.colors.buttonSecondaryBorderInverse,
|
|
240
|
+
color: theme.colors.textButtonSecondaryInverse
|
|
241
|
+
})
|
|
247
242
|
}
|
|
248
243
|
});
|
|
249
244
|
});
|
|
@@ -257,13 +252,12 @@ var dangerButtonStyles = function(theme) {
|
|
|
257
252
|
"&[disabled]:not($isLoading)": {
|
|
258
253
|
opacity: 0.5
|
|
259
254
|
},
|
|
260
|
-
"&:hover:not([disabled])": {
|
|
261
|
-
backgroundColor: theme.colors.buttonDangerBackgroundHover
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
255
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
256
|
+
backgroundColor: theme.colors.buttonDangerBackgroundHover
|
|
257
|
+
}, theme.mq.touchableOnly, {
|
|
258
|
+
// Revert hover background in touch devices
|
|
259
|
+
backgroundColor: theme.colors.buttonDangerBackground
|
|
260
|
+
})
|
|
267
261
|
};
|
|
268
262
|
};
|
|
269
263
|
var useDangerButtonStyles = createUseStyles(function(theme) {
|
|
@@ -447,12 +441,11 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
|
|
|
447
441
|
"&:enabled:active": {
|
|
448
442
|
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
449
443
|
},
|
|
450
|
-
"&:hover:not([disabled])": {
|
|
451
|
-
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
},
|
|
444
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
445
|
+
backgroundColor: theme.colors.buttonLinkBackgroundSelected
|
|
446
|
+
}, theme.mq.touchableOnly, {
|
|
447
|
+
backgroundColor: "initial"
|
|
448
|
+
}),
|
|
456
449
|
"&[disabled]": disabledStyle
|
|
457
450
|
},
|
|
458
451
|
inverse: {
|
|
@@ -460,12 +453,11 @@ var useButtonLinkStyles = createUseStyles(function(theme) {
|
|
|
460
453
|
"&:enabled:active": {
|
|
461
454
|
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
462
455
|
},
|
|
463
|
-
"&:hover:not([disabled])": {
|
|
464
|
-
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
456
|
+
"&:hover:not([disabled])": _defineProperty({
|
|
457
|
+
backgroundColor: theme.colors.buttonLinkBackgroundSelectedInverse
|
|
458
|
+
}, theme.mq.touchableOnly, {
|
|
459
|
+
backgroundColor: "initial"
|
|
460
|
+
})
|
|
469
461
|
},
|
|
470
462
|
aligned: {
|
|
471
463
|
marginLeft: -padding
|
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 };
|
package/dist-es/carousel.js
CHANGED
|
@@ -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:
|
|
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";
|