@transferwise/components 0.0.0-experimental-4553cce → 0.0.0-experimental-03e1dec

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 (38) hide show
  1. package/build/index.js +133 -290
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +135 -292
  4. package/build/index.mjs.map +1 -1
  5. package/build/types/alert/Alert.d.ts +47 -58
  6. package/build/types/alert/Alert.d.ts.map +1 -1
  7. package/build/types/alert/index.d.ts +2 -1
  8. package/build/types/alert/index.d.ts.map +1 -1
  9. package/build/types/common/propsValues/sentiment.d.ts +0 -1
  10. package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
  11. package/build/types/index.d.ts +1 -1
  12. package/build/types/index.d.ts.map +1 -1
  13. package/build/types/inlineAlert/InlineAlert.d.ts +2 -4
  14. package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
  15. package/build/types/statusIcon/StatusIcon.d.ts +1 -1
  16. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  17. package/package.json +2 -2
  18. package/src/alert/{Alert.spec.js → Alert.spec.tsx} +42 -44
  19. package/src/alert/Alert.story.tsx +1 -2
  20. package/src/alert/Alert.tsx +222 -0
  21. package/src/alert/index.ts +2 -0
  22. package/src/common/propsValues/sentiment.ts +0 -10
  23. package/src/index.ts +1 -1
  24. package/src/inlineAlert/InlineAlert.spec.tsx +0 -7
  25. package/src/inlineAlert/InlineAlert.tsx +19 -47
  26. package/src/statusIcon/StatusIcon.tsx +14 -14
  27. package/build/types/alert/withArrow/alertArrowPositions.d.ts +0 -9
  28. package/build/types/alert/withArrow/alertArrowPositions.d.ts.map +0 -1
  29. package/build/types/alert/withArrow/index.d.ts +0 -3
  30. package/build/types/alert/withArrow/index.d.ts.map +0 -1
  31. package/build/types/alert/withArrow/withArrow.d.ts +0 -11
  32. package/build/types/alert/withArrow/withArrow.d.ts.map +0 -1
  33. package/src/alert/Alert.js +0 -196
  34. package/src/alert/index.js +0 -1
  35. package/src/alert/withArrow/alertArrowPositions.ts +0 -9
  36. package/src/alert/withArrow/index.js +0 -2
  37. package/src/alert/withArrow/withArrow.js +0 -50
  38. package/src/alert/withArrow/withArrow.spec.js +0 -51
@@ -1,50 +0,0 @@
1
- import classNames from 'classnames';
2
- import PropTypes from 'prop-types';
3
-
4
- import { ArrowPosition } from './alertArrowPositions';
5
-
6
- function withArrow(Alert, arrow) {
7
- const AlertWithArrow = (props) => (
8
- <Alert
9
- {...props}
10
- className={classNames(props.className, arrowClasses(arrow))}
11
- arrow={undefined}
12
- />
13
- );
14
-
15
- AlertWithArrow.propTypes = {
16
- className: PropTypes.string,
17
- };
18
-
19
- AlertWithArrow.defaultProps = {
20
- className: undefined,
21
- };
22
-
23
- return AlertWithArrow;
24
- }
25
-
26
- function arrowClasses(arrow) {
27
- if (arrow) {
28
- const classes = ['arrow'];
29
- const { BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, TOP, TOP_RIGHT, TOP_LEFT } = ArrowPosition;
30
-
31
- switch (arrow) {
32
- case BOTTOM:
33
- return classes.concat('arrow-bottom', 'arrow-center');
34
- case BOTTOM_LEFT:
35
- return classes.concat('arrow-bottom', 'arrow-left');
36
- case BOTTOM_RIGHT:
37
- return classes.concat('arrow-bottom', 'arrow-right');
38
- case TOP:
39
- return classes.concat('arrow-center');
40
- case TOP_RIGHT:
41
- return classes.concat('arrow-right');
42
- case TOP_LEFT:
43
- default:
44
- return classes;
45
- }
46
- }
47
- return '';
48
- }
49
-
50
- export default withArrow;
@@ -1,51 +0,0 @@
1
- import { render, screen } from '../../test-utils';
2
- import Alert from '../Alert';
3
-
4
- import { ArrowPosition } from './alertArrowPositions';
5
- import withArrow from './withArrow';
6
-
7
- describe('withArrow', () => {
8
- const message = 'I hope you have a nice day today';
9
-
10
- describe('default props', () => {
11
- it(`returns an arrowless alert if you don't pass an arrow`, () => {
12
- const ArrowLessAlert = withArrow(Alert);
13
-
14
- render(<ArrowLessAlert message={message} />);
15
- const component = screen.getByTestId('alert');
16
-
17
- expect(component).not.toHaveClass('arrow');
18
- });
19
-
20
- it(`ignores the arrow prop passed to the new alert`, () => {
21
- const AlertTopArrow = withArrow(Alert, ArrowPosition.TOP_LEFT);
22
-
23
- render(<AlertTopArrow message={message} arrow={ArrowPosition.BOTTOM_LEFT} />);
24
- const component = screen.getByTestId('alert');
25
- expect(component).toHaveClass('arrow');
26
- expect(component).not.toHaveClass('arrow-bottom');
27
- });
28
- });
29
-
30
- describe('renders arrows', () => {
31
- const getPointyAlert = (arrow) => withArrow(Alert, arrow);
32
-
33
- it(`returns an bottom arrowed alert if you pass a bottom arrow`, () => {
34
- const BottomArrowAlert = getPointyAlert(ArrowPosition.BOTTOM);
35
- render(<BottomArrowAlert message={message} />);
36
- const component = screen.getByTestId('alert');
37
-
38
- expect(component).toHaveClass('arrow');
39
- expect(component).toHaveClass('arrow-bottom');
40
- });
41
-
42
- it(`returns an top-right arrowed alert if you pass a top right arrow`, () => {
43
- const BottomArrowAlert = getPointyAlert(ArrowPosition.TOP_RIGHT);
44
- render(<BottomArrowAlert message={message} />);
45
- const component = screen.getByTestId('alert');
46
-
47
- expect(component).toHaveClass('arrow');
48
- expect(component).toHaveClass('arrow-right');
49
- });
50
- });
51
- });