@transferwise/components 0.0.0-experimental-eec707b → 0.0.0-experimental-dc27730
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/build/index.esm.js +29 -90
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -93
- package/build/index.js.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +18 -28
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/avatarWrapper/index.d.ts +1 -1
- package/build/types/avatarWrapper/index.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/index.d.ts +2 -1
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -1
- package/build/types/common/propsValues/profileType.d.ts +2 -0
- package/build/types/common/propsValues/profileType.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +1 -0
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +17 -21
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/image/index.d.ts +1 -1
- package/build/types/image/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +12 -15
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inlineAlert/index.d.ts +1 -1
- package/build/types/inlineAlert/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +105 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -41
- package/src/avatarWrapper/{AvatarWrapper.js → AvatarWrapper.tsx} +25 -56
- package/src/avatarWrapper/__snapshots__/{AvatarWrapper.spec.js.snap → AvatarWrapper.spec.tsx.snap} +76 -76
- package/src/badge/Badge.tsx +2 -2
- package/src/badge/index.ts +2 -0
- package/src/common/index.js +1 -1
- package/src/common/propsValues/profileType.ts +3 -0
- package/src/common/propsValues/sentiment.ts +10 -0
- package/src/image/{Image.spec.js → Image.spec.tsx} +5 -5
- package/src/image/{Image.story.js → Image.story.tsx} +3 -3
- package/src/image/Image.tsx +65 -0
- package/src/inlineAlert/{InlineAlert.story.js → InlineAlert.story.tsx} +3 -2
- package/src/inlineAlert/InlineAlert.tsx +59 -0
- package/src/promoCard/PromoCard.tsx +1 -6
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -2
- package/src/avatarWrapper/AvatarWrapper.spec.js +0 -81
- package/src/badge/index.js +0 -1
- package/src/image/Image.js +0 -78
- package/src/inlineAlert/InlineAlert.js +0 -62
- /package/src/avatarWrapper/{index.js → index.ts} +0 -0
- /package/src/image/{index.js → index.ts} +0 -0
- /package/src/inlineAlert/{InlineAlert.spec.js → InlineAlert.spec.tsx} +0 -0
- /package/src/inlineAlert/{index.js → index.ts} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { AlertCircle as AlertCircleIcon } from '@transferwise/icons';
|
|
2
|
-
import { useTheme } from '@wise/components-theming';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
|
|
6
|
-
import withArrow, { AlertArrowPosition } from '../alert/withArrow';
|
|
7
|
-
import { Sentiment } from '../common';
|
|
8
|
-
|
|
9
|
-
const typeClassMap = {
|
|
10
|
-
[Sentiment.ERROR]: 'danger',
|
|
11
|
-
[Sentiment.NEGATIVE]: 'danger',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const InlineAlert = (props) => {
|
|
15
|
-
const { isModern } = useTheme();
|
|
16
|
-
|
|
17
|
-
const typeClass = `alert-${typeClassMap[props.type] || props.type}`;
|
|
18
|
-
|
|
19
|
-
if (isModern) {
|
|
20
|
-
return (
|
|
21
|
-
<div
|
|
22
|
-
role="alert"
|
|
23
|
-
id={props.id}
|
|
24
|
-
className={classNames('alert alert-detach', typeClass, props.className)}
|
|
25
|
-
>
|
|
26
|
-
{(props.type === 'error' || props.type === 'negative') && <AlertCircleIcon />}
|
|
27
|
-
<div>{props.children}</div>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const getAlertContents = ({ children, className }) => {
|
|
33
|
-
return (
|
|
34
|
-
<div
|
|
35
|
-
role="alert"
|
|
36
|
-
id={props.id}
|
|
37
|
-
className={classNames('alert alert-detach p-x-2 p-y-1', typeClass, className)}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const AlertWithArrow = withArrow(getAlertContents, AlertArrowPosition.TOP_LEFT);
|
|
45
|
-
|
|
46
|
-
return <AlertWithArrow {...props} />;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
InlineAlert.propTypes = {
|
|
50
|
-
children: PropTypes.node.isRequired,
|
|
51
|
-
className: PropTypes.string,
|
|
52
|
-
id: PropTypes.string,
|
|
53
|
-
type: PropTypes.oneOf(['positive', 'negative', 'warning', 'neutral', 'success', 'info', 'error']),
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
InlineAlert.defaultProps = {
|
|
57
|
-
className: undefined,
|
|
58
|
-
id: undefined,
|
|
59
|
-
type: Sentiment.NEUTRAL,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default InlineAlert;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|