@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.
Files changed (51) hide show
  1. package/build/index.esm.js +29 -90
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +32 -93
  4. package/build/index.js.map +1 -1
  5. package/build/types/avatarWrapper/AvatarWrapper.d.ts +18 -28
  6. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  7. package/build/types/avatarWrapper/index.d.ts +1 -1
  8. package/build/types/avatarWrapper/index.d.ts.map +1 -1
  9. package/build/types/badge/Badge.d.ts +2 -2
  10. package/build/types/badge/Badge.d.ts.map +1 -1
  11. package/build/types/badge/index.d.ts +2 -1
  12. package/build/types/badge/index.d.ts.map +1 -1
  13. package/build/types/common/index.d.ts +1 -1
  14. package/build/types/common/propsValues/profileType.d.ts +2 -0
  15. package/build/types/common/propsValues/profileType.d.ts.map +1 -1
  16. package/build/types/common/propsValues/sentiment.d.ts +1 -0
  17. package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
  18. package/build/types/image/Image.d.ts +17 -21
  19. package/build/types/image/Image.d.ts.map +1 -1
  20. package/build/types/image/index.d.ts +1 -1
  21. package/build/types/image/index.d.ts.map +1 -1
  22. package/build/types/inlineAlert/InlineAlert.d.ts +12 -15
  23. package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
  24. package/build/types/inlineAlert/index.d.ts +1 -1
  25. package/build/types/inlineAlert/index.d.ts.map +1 -1
  26. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/avatarWrapper/AvatarWrapper.spec.tsx +105 -0
  29. package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -41
  30. package/src/avatarWrapper/{AvatarWrapper.js → AvatarWrapper.tsx} +25 -56
  31. package/src/avatarWrapper/__snapshots__/{AvatarWrapper.spec.js.snap → AvatarWrapper.spec.tsx.snap} +76 -76
  32. package/src/badge/Badge.tsx +2 -2
  33. package/src/badge/index.ts +2 -0
  34. package/src/common/index.js +1 -1
  35. package/src/common/propsValues/profileType.ts +3 -0
  36. package/src/common/propsValues/sentiment.ts +10 -0
  37. package/src/image/{Image.spec.js → Image.spec.tsx} +5 -5
  38. package/src/image/{Image.story.js → Image.story.tsx} +3 -3
  39. package/src/image/Image.tsx +65 -0
  40. package/src/inlineAlert/{InlineAlert.story.js → InlineAlert.story.tsx} +3 -2
  41. package/src/inlineAlert/InlineAlert.tsx +59 -0
  42. package/src/promoCard/PromoCard.tsx +1 -6
  43. package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -2
  44. package/src/avatarWrapper/AvatarWrapper.spec.js +0 -81
  45. package/src/badge/index.js +0 -1
  46. package/src/image/Image.js +0 -78
  47. package/src/inlineAlert/InlineAlert.js +0 -62
  48. /package/src/avatarWrapper/{index.js → index.ts} +0 -0
  49. /package/src/image/{index.js → index.ts} +0 -0
  50. /package/src/inlineAlert/{InlineAlert.spec.js → InlineAlert.spec.tsx} +0 -0
  51. /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