@telefonica/mistica 10.17.0 → 10.21.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/CHANGELOG.md +36 -0
- package/dist/button-layout.js +28 -17
- package/dist/button.js +24 -8
- package/dist/card.d.ts +10 -1
- package/dist/card.js +29 -29
- package/dist/card.js.flow +16 -1
- package/dist/header.d.ts +2 -0
- package/dist/header.js.flow +5 -0
- package/dist/icons/icon-success.js +14 -6
- package/dist/image.d.ts +25 -4
- package/dist/image.js +67 -9
- package/dist/image.js.flow +33 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/index.js.flow +2 -0
- package/dist/package-version.js +1 -1
- package/dist/section-title.d.ts +1 -3
- package/dist/section-title.js.flow +1 -2
- package/dist/skins/blau.d.ts +6 -3
- package/dist/skins/blau.js +34 -5
- package/dist/skins/blau.js.flow +6 -3
- package/dist/skins/movistar.d.ts +21 -11
- package/dist/skins/movistar.js +76 -40
- package/dist/skins/movistar.js.flow +21 -11
- package/dist/skins/o2-classic.d.ts +21 -9
- package/dist/skins/o2-classic.js +64 -26
- package/dist/skins/o2-classic.js.flow +21 -9
- package/dist/skins/o2.d.ts +19 -17
- package/dist/skins/o2.js +68 -40
- package/dist/skins/o2.js.flow +19 -17
- package/dist/skins/telefonica.d.ts +18 -13
- package/dist/skins/telefonica.js +76 -45
- package/dist/skins/telefonica.js.flow +18 -13
- package/dist/skins/types.d.ts +12 -0
- package/dist/skins/types.js.flow +12 -0
- package/dist/skins/vivo.d.ts +9 -4
- package/dist/skins/vivo.js +37 -6
- package/dist/skins/vivo.js.flow +9 -4
- package/dist/tag.d.ts +6 -1
- package/dist/tag.js +133 -24
- package/dist/tag.js.flow +15 -1
- package/dist/text.d.ts +4 -0
- package/dist/text.js +13 -6
- package/dist/text.js.flow +10 -0
- package/dist/theme-context-provider.js +8 -2
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js.flow +2 -0
- package/dist/touchable.js +3 -2
- package/dist/video.d.ts +32 -0
- package/dist/video.js +161 -0
- package/dist/video.js.flow +50 -0
- package/dist-es/button-layout.js +28 -17
- package/dist-es/button.js +24 -8
- package/dist-es/card.js +30 -30
- package/dist-es/icons/icon-success.js +14 -6
- package/dist-es/image.js +41 -8
- package/dist-es/index.js +1 -0
- package/dist-es/package-version.js +1 -1
- package/dist-es/skins/blau.js +36 -5
- package/dist-es/skins/movistar.js +78 -40
- package/dist-es/skins/o2-classic.js +66 -26
- package/dist-es/skins/o2.js +70 -40
- package/dist-es/skins/telefonica.js +78 -45
- package/dist-es/skins/vivo.js +39 -6
- package/dist-es/tag.js +130 -26
- package/dist-es/text.js +13 -6
- package/dist-es/theme-context-provider.js +8 -2
- package/dist-es/touchable.js +3 -2
- package/dist-es/video.js +123 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
# [10.21.0](https://github.com/Telefonica/mistica-web/compare/v10.20.0...v10.21.0) (2022-01-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ButtonLayout:** missed button press in button layout when gaining focus ([#396](https://github.com/Telefonica/mistica-web/issues/396)) ([9f3bba5](https://github.com/Telefonica/mistica-web/commit/9f3bba57affeac7b89c7dc831d00ce4ef33cdb5f))
|
|
7
|
+
* **ButtonLayout:** unstable in acceptance tests ([#404](https://github.com/Telefonica/mistica-web/issues/404)) ([11d4772](https://github.com/Telefonica/mistica-web/commit/11d4772c49d5f35bfcfa4ead6826782eccde5a18))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **Touchable:** WEB-435 add hrefDecorator to theme ([#401](https://github.com/Telefonica/mistica-web/issues/401)) ([21a45ee](https://github.com/Telefonica/mistica-web/commit/21a45ee84259af4ccca2a5adf2a7242b442d2874))
|
|
13
|
+
|
|
14
|
+
# [10.20.0](https://github.com/Telefonica/mistica-web/compare/v10.19.0...v10.20.0) (2022-01-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **Tags:** Tag component evolution ([#372](https://github.com/Telefonica/mistica-web/issues/372)) ([0db48b1](https://github.com/Telefonica/mistica-web/commit/0db48b15525b67c574b90c8c450b35ef155ca199))
|
|
20
|
+
|
|
21
|
+
# [10.19.0](https://github.com/Telefonica/mistica-web/compare/v10.18.0...v10.19.0) (2022-01-24)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **Feedback:** Update animated success icon for O2 ([#397](https://github.com/Telefonica/mistica-web/issues/397)) ([c0952cd](https://github.com/Telefonica/mistica-web/commit/c0952cdf10779f097359754b8f8d1addccb05713))
|
|
27
|
+
* **Image:** Added forward ref to Image component. ([#399](https://github.com/Telefonica/mistica-web/issues/399)) ([c78008f](https://github.com/Telefonica/mistica-web/commit/c78008f33d0a7979ead1760b01169a3e5bc65c1e))
|
|
28
|
+
* **SectionTitle:** Changed right prop to React.Node ([#398](https://github.com/Telefonica/mistica-web/issues/398)) ([d94b986](https://github.com/Telefonica/mistica-web/commit/d94b98636a834291af46f3b51223de97aaf79e41))
|
|
29
|
+
|
|
30
|
+
# [10.18.0](https://github.com/Telefonica/mistica-web/compare/v10.17.0...v10.18.0) (2022-01-21)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **Video:** Video component and Video support in Media Cards ([#391](https://github.com/Telefonica/mistica-web/issues/391)) ([a830a9b](https://github.com/Telefonica/mistica-web/commit/a830a9b2f364d9f17245aba02cfbbfee678a064b))
|
|
36
|
+
|
|
1
37
|
# [10.17.0](https://github.com/Telefonica/mistica-web/compare/v10.16.0...v10.17.0) (2022-01-18)
|
|
2
38
|
|
|
3
39
|
|
package/dist/button-layout.js
CHANGED
|
@@ -9,6 +9,7 @@ var _jss = require("./jss");
|
|
|
9
9
|
var _hooks = require("./hooks");
|
|
10
10
|
var _button = require("./button");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
13
|
function _interopRequireDefault(obj) {
|
|
13
14
|
return obj && obj.__esModule ? obj : {
|
|
14
15
|
default: obj
|
|
@@ -207,28 +208,29 @@ var buttonsRange = [
|
|
|
207
208
|
var ButtonLayout = function ButtonLayout(param) {
|
|
208
209
|
var children = param.children, _align = param.align, align = _align === void 0 ? 'full-width' : _align, link = param.link, _withMargins = param.withMargins, withMargins = _withMargins === void 0 ? false : _withMargins;
|
|
209
210
|
var ref = (0, _hooks).useScreenSize(), isTabletOrSmaller = ref.isTabletOrSmaller;
|
|
210
|
-
var ref1 = _slicedToArray(React.useState(true), 2), isMeasuring = ref1[0], setIsMeasuring = ref1[1];
|
|
211
211
|
var childrenCount = React.Children.count(children);
|
|
212
|
-
var
|
|
213
|
-
|
|
212
|
+
var ref1 = _slicedToArray(React.useState({
|
|
213
|
+
isMeasuring: true,
|
|
214
|
+
buttonWidth: 0
|
|
215
|
+
}), 2), buttonStatus = ref1[0], setButtonStatus = ref1[1];
|
|
216
|
+
var updateButtonStatus = function updateButtonStatus(param) {
|
|
217
|
+
var isMeasuring = param.isMeasuring, buttonWidth = param.buttonWidth;
|
|
214
218
|
if (process.env.NODE_ENV !== 'test') {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
220
|
-
setIsMeasuring(isMeasuring);
|
|
219
|
+
setButtonStatus({
|
|
220
|
+
isMeasuring: isMeasuring,
|
|
221
|
+
buttonWidth: buttonWidth
|
|
222
|
+
});
|
|
221
223
|
}
|
|
222
224
|
};
|
|
223
225
|
var classes = useStyles({
|
|
224
|
-
buttonWidth: buttonWidth,
|
|
226
|
+
buttonWidth: buttonStatus.buttonWidth,
|
|
225
227
|
isTabletOrSmaller: isTabletOrSmaller,
|
|
226
228
|
align: align,
|
|
227
229
|
childrenCount: childrenCount
|
|
228
230
|
});
|
|
229
231
|
var wrapperElRef = React.useRef(null);
|
|
230
232
|
(0, _hooks).useIsomorphicLayoutEffect(function() {
|
|
231
|
-
if (isMeasuring) {
|
|
233
|
+
if (buttonStatus.isMeasuring) {
|
|
232
234
|
var req = window.requestAnimationFrame(function() {
|
|
233
235
|
if (wrapperElRef.current) {
|
|
234
236
|
var childrenWidths = Array.from(wrapperElRef.current.children).map(function(el) {
|
|
@@ -243,8 +245,10 @@ var ButtonLayout = function ButtonLayout(param) {
|
|
|
243
245
|
var maxChildWidth = Math.ceil((_Math = Math).max.apply(_Math, _toConsumableArray(childrenWidths).concat([
|
|
244
246
|
_button.BUTTON_MIN_WIDTH
|
|
245
247
|
])));
|
|
246
|
-
|
|
247
|
-
|
|
248
|
+
updateButtonStatus({
|
|
249
|
+
isMeasuring: false,
|
|
250
|
+
buttonWidth: maxChildWidth
|
|
251
|
+
});
|
|
248
252
|
}
|
|
249
253
|
});
|
|
250
254
|
return function() {
|
|
@@ -255,11 +259,18 @@ var ButtonLayout = function ButtonLayout(param) {
|
|
|
255
259
|
};
|
|
256
260
|
}, [
|
|
257
261
|
classes.link,
|
|
258
|
-
|
|
262
|
+
buttonStatus
|
|
259
263
|
]);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Multiple calls to calcLayout are debounced to workaround an issue that can be reproduced in chrome when pressing
|
|
266
|
+
* the button during a focus/visibility change. For example, pressing the button having the focus on the devTools.
|
|
267
|
+
*/ var calcLayout = React.useMemo(function() {
|
|
268
|
+
return (0, _debounce).default(function() {
|
|
269
|
+
updateButtonStatus({
|
|
270
|
+
isMeasuring: true,
|
|
271
|
+
buttonWidth: 0
|
|
272
|
+
});
|
|
273
|
+
}, 50);
|
|
263
274
|
}, []);
|
|
264
275
|
useOnChildrenChangeEffect(wrapperElRef.current, calcLayout);
|
|
265
276
|
useOnFontsReadyEffect(calcLayout);
|
package/dist/button.js
CHANGED
|
@@ -396,6 +396,11 @@ var Button = function Button(props) {
|
|
|
396
396
|
disabled: props.disabled || showSpinner || isFormSending,
|
|
397
397
|
role: 'button'
|
|
398
398
|
};
|
|
399
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
400
|
+
if (props.to === '' || props.href === '') {
|
|
401
|
+
throw Error('to or href props are empty strings');
|
|
402
|
+
}
|
|
403
|
+
}
|
|
399
404
|
if (props.fake) {
|
|
400
405
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
401
406
|
maybe: true
|
|
@@ -419,22 +424,25 @@ var Button = function Button(props) {
|
|
|
419
424
|
onPress: props.onPress
|
|
420
425
|
})));
|
|
421
426
|
}
|
|
422
|
-
if (props.to) {
|
|
427
|
+
if (props.to || props.to === '') {
|
|
423
428
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
424
429
|
}, commonProps, {
|
|
425
430
|
to: props.to,
|
|
426
431
|
fullPageOnWebView: props.fullPageOnWebView
|
|
427
432
|
})));
|
|
428
433
|
}
|
|
429
|
-
if (props.href) {
|
|
434
|
+
if (props.href || props.href === '') {
|
|
430
435
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
431
436
|
}, commonProps, {
|
|
432
437
|
href: props.href,
|
|
433
438
|
newTab: props.newTab
|
|
434
439
|
})));
|
|
435
440
|
}
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
442
|
+
// this cannot happen
|
|
443
|
+
throw Error('Bad button props');
|
|
444
|
+
}
|
|
445
|
+
return null;
|
|
438
446
|
};
|
|
439
447
|
var useButtonLinkStyles = (0, _jss).createUseStyles(function(theme) {
|
|
440
448
|
var padding = 6;
|
|
@@ -491,6 +499,11 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
491
499
|
children: props.children
|
|
492
500
|
})
|
|
493
501
|
};
|
|
502
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
503
|
+
if (props.to === '' || props.href === '') {
|
|
504
|
+
throw Error('to or href props are empty strings');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
494
507
|
if (props.onPress) {
|
|
495
508
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
496
509
|
ref: ref
|
|
@@ -498,7 +511,7 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
498
511
|
onPress: props.onPress
|
|
499
512
|
})));
|
|
500
513
|
}
|
|
501
|
-
if (props.to) {
|
|
514
|
+
if (props.to || props.to === '') {
|
|
502
515
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
503
516
|
ref: ref
|
|
504
517
|
}, commonProps, {
|
|
@@ -506,7 +519,7 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
506
519
|
fullPageOnWebView: props.fullPageOnWebView
|
|
507
520
|
})));
|
|
508
521
|
}
|
|
509
|
-
if (props.href) {
|
|
522
|
+
if (props.href || props.href === '') {
|
|
510
523
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_touchable.default, _objectSpread({
|
|
511
524
|
ref: ref
|
|
512
525
|
}, commonProps, {
|
|
@@ -514,8 +527,11 @@ var ButtonLink = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
514
527
|
newTab: props.newTab
|
|
515
528
|
})));
|
|
516
529
|
}
|
|
517
|
-
|
|
518
|
-
|
|
530
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
531
|
+
// this cannot happen
|
|
532
|
+
throw Error('Bad button props');
|
|
533
|
+
}
|
|
534
|
+
return null;
|
|
519
535
|
});
|
|
520
536
|
exports.ButtonLink = ButtonLink;
|
|
521
537
|
var ButtonPrimary = function ButtonPrimary(props) {
|
package/dist/card.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Tag from './tag';
|
|
3
3
|
import { ButtonLink, ButtonPrimary } from './button';
|
|
4
|
+
import Video from './video';
|
|
5
|
+
import Image from './image';
|
|
4
6
|
import type { ButtonProps, ButtonLinkProps } from './button';
|
|
5
7
|
import type { DataAttributes } from './utils/types';
|
|
6
8
|
import type { TagProps } from './tag';
|
|
9
|
+
import type { VideoProps } from './video';
|
|
10
|
+
import type { ImageProps } from './image';
|
|
11
|
+
/** @deprecated */
|
|
7
12
|
declare type CardMedia = {
|
|
8
13
|
src: string;
|
|
9
14
|
aspectRatio: number;
|
|
@@ -18,7 +23,11 @@ declare type CardMedia = {
|
|
|
18
23
|
height?: undefined;
|
|
19
24
|
};
|
|
20
25
|
declare type MediaCardProps = {
|
|
21
|
-
media: CardMedia
|
|
26
|
+
media: CardMedia | (React.ReactElement<ImageProps, typeof Image> & {
|
|
27
|
+
src?: undefined;
|
|
28
|
+
}) | (React.ReactElement<VideoProps, typeof Video> & {
|
|
29
|
+
src?: undefined;
|
|
30
|
+
});
|
|
22
31
|
headline?: string | React.ReactElement<TagProps, typeof Tag>;
|
|
23
32
|
pretitle?: string;
|
|
24
33
|
title?: string;
|
package/dist/card.js
CHANGED
|
@@ -13,6 +13,7 @@ var _text = require("./text");
|
|
|
13
13
|
var _jss = require("./jss");
|
|
14
14
|
var _boxed = require("./boxed");
|
|
15
15
|
var _buttonGroup = _interopRequireDefault(require("./button-group"));
|
|
16
|
+
var _image = require("./image");
|
|
16
17
|
function _interopRequireDefault(obj) {
|
|
17
18
|
return obj && obj.__esModule ? obj : {
|
|
18
19
|
default: obj
|
|
@@ -46,8 +47,7 @@ var useCardContentStyles = (0, _jss).createUseStyles(function() {
|
|
|
46
47
|
actions: {
|
|
47
48
|
flex: 1,
|
|
48
49
|
display: 'flex',
|
|
49
|
-
alignItems: 'flex-end'
|
|
50
|
-
marginTop: 16
|
|
50
|
+
alignItems: 'flex-end'
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
});
|
|
@@ -61,32 +61,30 @@ var CardContent = function CardContent(param) {
|
|
|
61
61
|
}
|
|
62
62
|
if (typeof headline === 'string') {
|
|
63
63
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx(_tag.default, {
|
|
64
|
-
|
|
64
|
+
type: "promo",
|
|
65
65
|
children: headline
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
68
|
return headline;
|
|
69
69
|
};
|
|
70
|
-
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs(
|
|
70
|
+
return(/*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
71
|
+
space: 16,
|
|
71
72
|
children: [
|
|
72
73
|
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
73
|
-
space:
|
|
74
|
+
space: 8,
|
|
74
75
|
children: [
|
|
75
|
-
/*#__PURE__*/ (0, _jsxRuntime).
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
(headline || pretitle || title || subtitle) && /*#__PURE__*/ (0, _jsxRuntime).jsx("header", {
|
|
77
|
+
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
78
|
+
space: 16,
|
|
79
|
+
children: [
|
|
80
|
+
renderHeadline(),
|
|
81
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsxs(_stack.default, {
|
|
80
82
|
space: 4,
|
|
81
83
|
children: [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
children:
|
|
86
|
-
regular: true,
|
|
87
|
-
uppercase: true,
|
|
88
|
-
children: pretitle
|
|
89
|
-
})
|
|
84
|
+
pretitle && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text1, {
|
|
85
|
+
regular: true,
|
|
86
|
+
uppercase: true,
|
|
87
|
+
children: pretitle
|
|
90
88
|
}),
|
|
91
89
|
/*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text4, {
|
|
92
90
|
as: "h1",
|
|
@@ -99,20 +97,20 @@ var CardContent = function CardContent(param) {
|
|
|
99
97
|
})
|
|
100
98
|
]
|
|
101
99
|
})
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
as: "p",
|
|
105
|
-
regular: true,
|
|
106
|
-
color: theme.colors.textSecondary,
|
|
107
|
-
children: description
|
|
108
|
-
})
|
|
109
|
-
]
|
|
100
|
+
]
|
|
101
|
+
})
|
|
110
102
|
}),
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
description && /*#__PURE__*/ (0, _jsxRuntime).jsx(_text.Text2, {
|
|
104
|
+
as: "p",
|
|
105
|
+
regular: true,
|
|
106
|
+
color: theme.colors.textSecondary,
|
|
107
|
+
children: description
|
|
113
108
|
})
|
|
114
109
|
]
|
|
115
110
|
}),
|
|
111
|
+
extra && /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
112
|
+
children: extra
|
|
113
|
+
}),
|
|
116
114
|
(button || buttonLink) && /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
117
115
|
className: classes.actions,
|
|
118
116
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsx(_buttonGroup.default, {
|
|
@@ -174,8 +172,10 @@ var MediaCard = /*#__PURE__*/ React.forwardRef(function(param, ref) {
|
|
|
174
172
|
className: classes.mediaCard,
|
|
175
173
|
"aria-label": ariaLabel,
|
|
176
174
|
children: [
|
|
177
|
-
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
175
|
+
typeof media.src === 'string' ? /*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
178
176
|
className: classes.media
|
|
177
|
+
}) : /*#__PURE__*/ (0, _jsxRuntime).jsx(_image.DisableBorderRadiusProvider, {
|
|
178
|
+
children: media
|
|
179
179
|
}),
|
|
180
180
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("div", {
|
|
181
181
|
className: classes.content,
|
package/dist/card.js.flow
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import Tag from "./tag";
|
|
5
5
|
import { ButtonLink, ButtonPrimary } from "./button";
|
|
6
|
+
import Video from "./video";
|
|
7
|
+
import Image from "./image";
|
|
6
8
|
import type { DataAttributes } from "./utils/types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
7
13
|
declare type CardMedia =
|
|
8
14
|
| {
|
|
9
15
|
src: string,
|
|
@@ -15,7 +21,16 @@ declare type CardMedia =
|
|
|
15
21
|
}
|
|
16
22
|
| { src: string };
|
|
17
23
|
declare type MediaCardProps = {
|
|
18
|
-
media:
|
|
24
|
+
media:
|
|
25
|
+
| CardMedia
|
|
26
|
+
| {
|
|
27
|
+
...React.Element<typeof Image>,
|
|
28
|
+
...{},
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
...React.Element<typeof Video>,
|
|
32
|
+
...{},
|
|
33
|
+
},
|
|
19
34
|
headline?: string | React.Element<typeof Tag>,
|
|
20
35
|
pretitle?: string,
|
|
21
36
|
title?: string,
|
package/dist/header.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import type { TextPresetProps } from './text';
|
|
|
6
6
|
import type { NavigationBreadcrumbsProps } from './navigation-breadcrumbs';
|
|
7
7
|
declare type OverridableTextProps = {
|
|
8
8
|
color?: TextPresetProps['color'];
|
|
9
|
+
/** @deprecated use decoration prop */
|
|
9
10
|
textDecoration?: TextPresetProps['textDecoration'];
|
|
11
|
+
decoration?: TextPresetProps['decoration'];
|
|
10
12
|
truncate?: TextPresetProps['truncate'];
|
|
11
13
|
};
|
|
12
14
|
declare type RichText = string | ({
|
package/dist/header.js.flow
CHANGED
|
@@ -6,7 +6,12 @@ import { ButtonPrimary, ButtonSecondary } from "./button";
|
|
|
6
6
|
import type { TextPresetProps } from "./text";
|
|
7
7
|
declare type OverridableTextProps = {
|
|
8
8
|
color?: $PropertyType<TextPresetProps, "color">,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use decoration prop
|
|
12
|
+
*/
|
|
9
13
|
textDecoration?: $PropertyType<TextPresetProps, "textDecoration">,
|
|
14
|
+
decoration?: $PropertyType<TextPresetProps, "decoration">,
|
|
10
15
|
truncate?: $PropertyType<TextPresetProps, "truncate">,
|
|
11
16
|
};
|
|
12
17
|
declare type RichText =
|
|
@@ -70,21 +70,29 @@ var IconSuccessO2 = function IconSuccessO2(param) {
|
|
|
70
70
|
children: /*#__PURE__*/ (0, _jsxRuntime).jsxs("g", {
|
|
71
71
|
className: (0, _classnames).default(_defineProperty({
|
|
72
72
|
}, classes.iconContainer, !color)),
|
|
73
|
-
strokeWidth: "2",
|
|
74
73
|
strokeLinecap: "round",
|
|
75
74
|
strokeLinejoin: "round",
|
|
76
75
|
children: [
|
|
77
76
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("path", _objectSpread({
|
|
78
77
|
fill: "none",
|
|
78
|
+
strokeWidth: "2",
|
|
79
79
|
stroke: color ? color : undefined,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, !skipAnimation && (0, _animation).mergeProperties((0, _animation).getAnimateDrawLineProps('33', '0.9s', platformOverrides), (0, _animation).getAnimateHopInProps('0.9s', platformOverrides)))),
|
|
80
|
+
d: "M45.64 53.84A25.599 25.599 0 0 1 32 57.75C17.78 57.75 6.25 46.22 6.25 32S17.78 6.25 32 6.25 57.75 17.78 57.75 32c0 5.13-1.5 9.92-4.09 13.93"
|
|
81
|
+
}, !skipAnimation && (0, _animation).getAnimateDrawLineProps('202', '0.3s', platformOverrides))),
|
|
83
82
|
/*#__PURE__*/ (0, _jsxRuntime).jsx("path", _objectSpread({
|
|
84
83
|
fill: "none",
|
|
84
|
+
strokeWidth: "2",
|
|
85
|
+
stroke: color ? color : undefined,
|
|
86
|
+
d: "m19.33 30.39 9.88 10.95 18.13-19.23"
|
|
87
|
+
}, !skipAnimation && (0, _animation).mergeProperties((0, _animation).getAnimateDrawLineProps('44', '0.6s', platformOverrides), (0, _animation).getAnimateHopInProps('0.6', platformOverrides)))),
|
|
88
|
+
/*#__PURE__*/ (0, _jsxRuntime).jsx("circle", _objectSpread({
|
|
89
|
+
fill: "none",
|
|
90
|
+
strokeWidth: "2",
|
|
85
91
|
stroke: color ? color : undefined,
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
cx: "50.18",
|
|
93
|
+
cy: "50.1",
|
|
94
|
+
r: ".89"
|
|
95
|
+
}, !skipAnimation && (0, _animation).getAnimateDrawLineProps('180', '0.2s', platformOverrides)))
|
|
88
96
|
]
|
|
89
97
|
})
|
|
90
98
|
}));
|
package/dist/image.d.ts
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
declare
|
|
2
|
+
export declare const useDisableBorderRadius: () => boolean;
|
|
3
|
+
export declare const DisableBorderRadiusProvider: React.FC;
|
|
4
|
+
export declare type AspectRatio = '1:1' | '16:9' | '7:10';
|
|
5
|
+
export declare const RATIO: {
|
|
6
|
+
'1:1': number;
|
|
7
|
+
'16:9': number;
|
|
8
|
+
'7:10': number;
|
|
9
|
+
};
|
|
10
|
+
export declare type ImageProps = {
|
|
11
|
+
src: string;
|
|
12
|
+
url?: undefined;
|
|
13
|
+
/** defaults to 100% when no width and no height are given */
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
/** defaults to 1:1, if both width and height are given, aspectRatio is ignored */
|
|
17
|
+
aspectRatio?: AspectRatio;
|
|
18
|
+
/** defaults to empty string */
|
|
19
|
+
alt?: string;
|
|
20
|
+
children?: void;
|
|
21
|
+
};
|
|
22
|
+
/** @deprecated */
|
|
23
|
+
declare type DeprecatedImageProps = {
|
|
4
24
|
url: string;
|
|
25
|
+
src?: undefined;
|
|
5
26
|
width?: number;
|
|
6
27
|
height?: number;
|
|
7
|
-
/** defaults to 1:1 */
|
|
28
|
+
/** defaults to 1:1, if both width and height are given, aspectRatio is ignored */
|
|
8
29
|
aspectRatio?: AspectRatio;
|
|
9
30
|
/** defaults to empty string */
|
|
10
31
|
alt?: string;
|
|
11
32
|
children?: void;
|
|
12
33
|
};
|
|
13
|
-
declare const Image: React.
|
|
34
|
+
declare const Image: React.ForwardRefExoticComponent<(ImageProps | DeprecatedImageProps) & React.RefAttributes<HTMLImageElement>>;
|
|
14
35
|
export default Image;
|
package/dist/image.js
CHANGED
|
@@ -2,9 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.default = void 0;
|
|
5
|
+
exports.default = exports.useDisableBorderRadius = exports.RATIO = exports.DisableBorderRadiusProvider = void 0;
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
7
8
|
var _jss = require("./jss");
|
|
9
|
+
function _interopRequireWildcard(obj) {
|
|
10
|
+
if (obj && obj.__esModule) {
|
|
11
|
+
return obj;
|
|
12
|
+
} else {
|
|
13
|
+
var newObj = {
|
|
14
|
+
};
|
|
15
|
+
if (obj != null) {
|
|
16
|
+
for(var key in obj){
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
18
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
19
|
+
};
|
|
20
|
+
if (desc.get || desc.set) {
|
|
21
|
+
Object.defineProperty(newObj, key, desc);
|
|
22
|
+
} else {
|
|
23
|
+
newObj[key] = obj[key];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
newObj.default = obj;
|
|
29
|
+
return newObj;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
8
32
|
function _objectWithoutProperties(source, excluded) {
|
|
9
33
|
if (source == null) return {
|
|
10
34
|
};
|
|
@@ -35,14 +59,37 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
35
59
|
}
|
|
36
60
|
return target;
|
|
37
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* This context is used internally to disable the border radius. This is useful for example
|
|
64
|
+
* when using the Image component inside a Card
|
|
65
|
+
*/ var DisableBorderRadiusContext = /*#__PURE__*/ React.createContext(false);
|
|
66
|
+
var useDisableBorderRadius = function useDisableBorderRadius() {
|
|
67
|
+
return React.useContext(DisableBorderRadiusContext);
|
|
68
|
+
};
|
|
69
|
+
exports.useDisableBorderRadius = useDisableBorderRadius;
|
|
70
|
+
var DisableBorderRadiusProvider = function DisableBorderRadiusProvider(param) {
|
|
71
|
+
var children = param.children;
|
|
72
|
+
/*#__PURE__*/ return (0, _jsxRuntime).jsx(DisableBorderRadiusContext.Provider, {
|
|
73
|
+
value: true,
|
|
74
|
+
children: children
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
exports.DisableBorderRadiusProvider = DisableBorderRadiusProvider;
|
|
38
78
|
var useStyles = (0, _jss).createUseStyles(function() {
|
|
39
79
|
return {
|
|
40
80
|
image: {
|
|
41
|
-
borderRadius:
|
|
81
|
+
borderRadius: function borderRadius(param) {
|
|
82
|
+
var noBorderRadius = param.noBorderRadius;
|
|
83
|
+
return noBorderRadius ? 0 : 4;
|
|
84
|
+
},
|
|
42
85
|
display: 'block',
|
|
43
86
|
objectFit: 'cover',
|
|
44
87
|
maxWidth: '100%',
|
|
45
|
-
maxHeight: '100%'
|
|
88
|
+
maxHeight: '100%',
|
|
89
|
+
aspectRatio: function aspectRatio(param) {
|
|
90
|
+
var aspectRatio1 = param.aspectRatio;
|
|
91
|
+
return aspectRatio1 !== null && aspectRatio1 !== void 0 ? aspectRatio1 : 'unset';
|
|
92
|
+
}
|
|
46
93
|
}
|
|
47
94
|
};
|
|
48
95
|
});
|
|
@@ -51,27 +98,38 @@ var RATIO = {
|
|
|
51
98
|
'16:9': 16 / 9,
|
|
52
99
|
'7:10': 7 / 10
|
|
53
100
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
101
|
+
exports.RATIO = RATIO;
|
|
102
|
+
var Image = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
103
|
+
var _aspectRatio = _param.aspectRatio, aspectRatio = _aspectRatio === void 0 ? '1:1' : _aspectRatio, _alt = _param.alt, alt = _alt === void 0 ? '' : _alt, props = _objectWithoutProperties(_param, [
|
|
57
104
|
"aspectRatio",
|
|
58
105
|
"alt"
|
|
59
106
|
]);
|
|
60
|
-
var
|
|
107
|
+
var noBorderRadius = useDisableBorderRadius();
|
|
108
|
+
var classes = useStyles({
|
|
109
|
+
noBorderRadius: noBorderRadius,
|
|
110
|
+
aspectRatio: !props.width && !props.height ? RATIO[aspectRatio] : undefined
|
|
111
|
+
});
|
|
112
|
+
var url = props.src || props.url;
|
|
61
113
|
var width = props.width;
|
|
62
114
|
var height = props.height;
|
|
63
|
-
if (props.width !== undefined) {
|
|
115
|
+
if (props.width !== undefined && props.height !== undefined) {
|
|
116
|
+
width = props.width;
|
|
117
|
+
height = props.height;
|
|
118
|
+
} else if (props.width !== undefined) {
|
|
64
119
|
height = props.width / RATIO[aspectRatio];
|
|
65
120
|
} else if (props.height !== undefined) {
|
|
66
121
|
width = props.height * RATIO[aspectRatio];
|
|
122
|
+
} else {
|
|
123
|
+
width = '100%';
|
|
67
124
|
}
|
|
68
125
|
return(/*#__PURE__*/ (0, _jsxRuntime).jsx("img", {
|
|
126
|
+
ref: ref,
|
|
69
127
|
src: url,
|
|
70
128
|
className: classes.image,
|
|
71
129
|
alt: alt,
|
|
72
130
|
width: width,
|
|
73
131
|
height: height
|
|
74
132
|
}));
|
|
75
|
-
};
|
|
133
|
+
});
|
|
76
134
|
var _default = Image;
|
|
77
135
|
exports.default = _default;
|
package/dist/image.js.flow
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
declare
|
|
5
|
-
declare
|
|
4
|
+
declare export var useDisableBorderRadius: () => boolean;
|
|
5
|
+
declare export var DisableBorderRadiusProvider: React.ComponentType<{}>;
|
|
6
|
+
export type AspectRatio = "1:1" | "16:9" | "7:10";
|
|
7
|
+
declare export var RATIO: {
|
|
8
|
+
"1:1": number,
|
|
9
|
+
"16:9": number,
|
|
10
|
+
"7:10": number,
|
|
11
|
+
};
|
|
12
|
+
export type ImageProps = {
|
|
13
|
+
src: string,
|
|
14
|
+
/**
|
|
15
|
+
* defaults to 100% when no width and no height are given
|
|
16
|
+
*/
|
|
17
|
+
width?: number,
|
|
18
|
+
height?: number,
|
|
19
|
+
/**
|
|
20
|
+
* defaults to 1:1, if both width and height are given, aspectRatio is ignored
|
|
21
|
+
*/
|
|
22
|
+
aspectRatio?: AspectRatio,
|
|
23
|
+
/**
|
|
24
|
+
* defaults to empty string
|
|
25
|
+
*/
|
|
26
|
+
alt?: string,
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated
|
|
30
|
+
*/
|
|
31
|
+
declare type DeprecatedImageProps = {
|
|
6
32
|
url: string,
|
|
7
33
|
width?: number,
|
|
8
34
|
height?: number,
|
|
9
35
|
/**
|
|
10
|
-
* defaults to 1:1
|
|
36
|
+
* defaults to 1:1, if both width and height are given, aspectRatio is ignored
|
|
11
37
|
*/
|
|
12
38
|
aspectRatio?: AspectRatio,
|
|
13
39
|
/**
|
|
@@ -15,5 +41,8 @@ declare type Props = {
|
|
|
15
41
|
*/
|
|
16
42
|
alt?: string,
|
|
17
43
|
};
|
|
18
|
-
declare var Image: React.ComponentType<
|
|
44
|
+
declare var Image: React.ComponentType<{
|
|
45
|
+
...ImageProps | DeprecatedImageProps,
|
|
46
|
+
ref?: React.Ref<HTMLImageElement>,
|
|
47
|
+
}>;
|
|
19
48
|
declare export default typeof Image;
|