@transferwise/components 46.22.1 → 46.23.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/build/i18n/zh-HK.json +2 -2
- package/build/index.esm.js +5 -6
- package/build/index.esm.js.map +1 -1
- package/build/index.js +5 -6
- package/build/index.js.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +3 -3
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/actionOption/index.d.ts +1 -0
- package/build/types/actionOption/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/index.d.ts +8 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/progress/Progress.d.ts +1 -1
- package/build/types/progress/Progress.d.ts.map +1 -1
- package/build/types/progress/index.d.ts +1 -0
- package/build/types/progress/index.d.ts.map +1 -1
- package/build/types/progressBar/index.d.ts +1 -0
- package/build/types/progressBar/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +3 -3
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/statusIcon/index.d.ts +2 -1
- package/build/types/statusIcon/index.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts +3 -3
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/build/types/switch/index.d.ts +1 -0
- package/build/types/switch/index.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +3 -3
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/build/types/switchOption/index.d.ts +1 -0
- package/build/types/switchOption/index.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts +3 -3
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/tooltip/index.d.ts +2 -2
- package/build/types/tooltip/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionOption/{ActionOption.spec.js → ActionOption.spec.tsx} +2 -2
- package/src/actionOption/ActionOption.tsx +3 -3
- package/src/actionOption/index.ts +1 -0
- package/src/badge/{Badge.story.js → Badge.story.tsx} +1 -1
- package/src/badge/Badge.tsx +2 -2
- package/src/i18n/zh-HK.json +2 -2
- package/src/index.ts +8 -0
- package/src/progress/{Progress.spec.js → Progress.spec.tsx} +4 -3
- package/src/progress/Progress.tsx +1 -1
- package/src/progress/index.ts +1 -0
- package/src/progressBar/index.ts +1 -0
- package/src/statusIcon/StatusIcon.spec.tsx +80 -0
- package/src/statusIcon/StatusIcon.tsx +3 -4
- package/src/statusIcon/index.ts +2 -0
- package/src/switch/Switch.tsx +3 -3
- package/src/switch/index.ts +1 -0
- package/src/switchOption/{SwitchOption.spec.js → SwitchOption.spec.tsx} +8 -3
- package/src/switchOption/SwitchOption.tsx +3 -3
- package/src/switchOption/index.ts +1 -0
- package/src/tooltip/Tooltip.tsx +2 -2
- package/src/tooltip/index.ts +2 -0
- package/src/statusIcon/StatusIcon.spec.js +0 -70
- package/src/statusIcon/index.js +0 -1
- package/src/tooltip/index.js +0 -3
- /package/src/badge/{Badge.spec.js → Badge.spec.tsx} +0 -0
- /package/src/progressBar/{ProgressBar.spec.js → ProgressBar.spec.tsx} +0 -0
- /package/src/switch/{Switch.spec.js → Switch.spec.tsx} +0 -0
- /package/src/switch/__snapshots__/{Switch.spec.js.snap → Switch.spec.tsx.snap} +0 -0
|
@@ -5,6 +5,8 @@ import SwitchOption from '.';
|
|
|
5
5
|
|
|
6
6
|
describe('SwitchOption', () => {
|
|
7
7
|
it('renders the option with the provided content', () => {
|
|
8
|
+
const mockOnChange = jest.fn();
|
|
9
|
+
|
|
8
10
|
render(
|
|
9
11
|
<SwitchOption
|
|
10
12
|
media={<FastFlag data-testid="fast-flag" />}
|
|
@@ -13,7 +15,7 @@ describe('SwitchOption', () => {
|
|
|
13
15
|
aria-label="title"
|
|
14
16
|
content="content"
|
|
15
17
|
checked={false}
|
|
16
|
-
onChange={
|
|
18
|
+
onChange={mockOnChange}
|
|
17
19
|
/>,
|
|
18
20
|
);
|
|
19
21
|
|
|
@@ -97,11 +99,11 @@ describe('SwitchOption', () => {
|
|
|
97
99
|
|
|
98
100
|
expect(mockOnChange).toHaveBeenCalledTimes(0);
|
|
99
101
|
|
|
100
|
-
fireEvent.click(screen.
|
|
102
|
+
fireEvent.click(screen.getByText('title'));
|
|
101
103
|
|
|
102
104
|
expect(mockOnChange).toHaveBeenCalledTimes(1);
|
|
103
105
|
|
|
104
|
-
fireEvent.click(screen.
|
|
106
|
+
fireEvent.click(screen.getByText('content'));
|
|
105
107
|
|
|
106
108
|
expect(mockOnChange).toHaveBeenCalledTimes(2);
|
|
107
109
|
|
|
@@ -111,6 +113,8 @@ describe('SwitchOption', () => {
|
|
|
111
113
|
});
|
|
112
114
|
|
|
113
115
|
it('renders aligned with container content', () => {
|
|
116
|
+
const mockOnChange = jest.fn();
|
|
117
|
+
|
|
114
118
|
render(
|
|
115
119
|
<SwitchOption
|
|
116
120
|
id="id"
|
|
@@ -118,6 +122,7 @@ describe('SwitchOption', () => {
|
|
|
118
122
|
aria-label="title"
|
|
119
123
|
content="content"
|
|
120
124
|
isContainerAligned
|
|
125
|
+
onChange={mockOnChange}
|
|
121
126
|
/>,
|
|
122
127
|
);
|
|
123
128
|
expect(document.querySelector('.np-option__container-aligned')).toBeInTheDocument();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MouseEvent, ReactChild
|
|
1
|
+
import { MouseEvent, ReactChild } from 'react';
|
|
2
2
|
|
|
3
3
|
import Option from '../common/Option';
|
|
4
4
|
import Switch from '../switch';
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
export type SwitchOptionProps = {
|
|
7
7
|
checked?: boolean;
|
|
8
8
|
complex?: boolean;
|
|
9
9
|
content?: ReactChild;
|
|
@@ -41,7 +41,7 @@ const SwitchOption = ({
|
|
|
41
41
|
showMediaAtAllSizes,
|
|
42
42
|
isContainerAligned,
|
|
43
43
|
'aria-label': ariaLabel,
|
|
44
|
-
}:
|
|
44
|
+
}: SwitchOptionProps) => {
|
|
45
45
|
const sharedProps = {
|
|
46
46
|
media,
|
|
47
47
|
title,
|
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
PositionTop,
|
|
21
21
|
} from '../common/propsValues/position';
|
|
22
22
|
|
|
23
|
-
type
|
|
23
|
+
export type TooltipProps = PropsWithChildren<{
|
|
24
24
|
position?: PositionTop | PositionRight | PositionBottom | PositionLeft;
|
|
25
25
|
label: ReactNode;
|
|
26
26
|
id?: string;
|
|
@@ -33,7 +33,7 @@ const Tooltip = ({
|
|
|
33
33
|
label,
|
|
34
34
|
id,
|
|
35
35
|
className,
|
|
36
|
-
}:
|
|
36
|
+
}: TooltipProps) => {
|
|
37
37
|
const [open, setOpen] = useState(false);
|
|
38
38
|
const anchorReference = useRef(null);
|
|
39
39
|
const [arrowElement, setArrowElement] = useState(null);
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Sentiment } from '../common';
|
|
2
|
-
import { render, cleanup, screen } from '../test-utils';
|
|
3
|
-
|
|
4
|
-
import StatusIcon from '.';
|
|
5
|
-
|
|
6
|
-
describe('StatusIcon', () => {
|
|
7
|
-
const renderStatusIcon = (props = {}) => {
|
|
8
|
-
return render(<StatusIcon {...props} />);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
afterEach(cleanup);
|
|
12
|
-
|
|
13
|
-
it('renders the status icon without any props', () => {
|
|
14
|
-
renderStatusIcon();
|
|
15
|
-
|
|
16
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
|
|
17
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders the status icon small if prop is passed in', () => {
|
|
21
|
-
renderStatusIcon({ size: 'sm' });
|
|
22
|
-
|
|
23
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-sm');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('renders the status icon medium if prop is passed in', () => {
|
|
27
|
-
renderStatusIcon({ size: 'md' });
|
|
28
|
-
|
|
29
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('renders the status icon big if prop is passed in', () => {
|
|
33
|
-
renderStatusIcon({ size: 'lg' });
|
|
34
|
-
|
|
35
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-lg');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('renders the status icon with different icons based on sentiment passed in', () => {
|
|
39
|
-
[
|
|
40
|
-
Sentiment.NEGATIVE,
|
|
41
|
-
Sentiment.NEUTRAL,
|
|
42
|
-
Sentiment.PENDING,
|
|
43
|
-
Sentiment.POSITIVE,
|
|
44
|
-
Sentiment.WARNING,
|
|
45
|
-
].forEach((sentiment) => {
|
|
46
|
-
renderStatusIcon({ sentiment: sentiment });
|
|
47
|
-
expect(screen.getByTestId('status-icon')).toHaveClass(sentiment.toString());
|
|
48
|
-
cleanup();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('warning and pending sentiments get dark colored icons', () => {
|
|
53
|
-
renderStatusIcon({ sentiment: Sentiment.WARNING });
|
|
54
|
-
expect(screen.getByTestId('alert-icon')).toHaveClass('dark');
|
|
55
|
-
cleanup();
|
|
56
|
-
renderStatusIcon({ sentiment: Sentiment.PENDING });
|
|
57
|
-
expect(screen.getByTestId('clock-borderless-icon')).toHaveClass('dark');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('positive, negative, and neutral sentiments get light colored icons', () => {
|
|
61
|
-
renderStatusIcon({ sentiment: Sentiment.POSITIVE });
|
|
62
|
-
expect(screen.getByTestId('check-icon')).toHaveClass('light');
|
|
63
|
-
cleanup();
|
|
64
|
-
renderStatusIcon({ sentiment: Sentiment.NEGATIVE });
|
|
65
|
-
expect(screen.getByTestId('cross-icon')).toHaveClass('light');
|
|
66
|
-
cleanup();
|
|
67
|
-
renderStatusIcon({ sentiment: Sentiment.NEUTRAL });
|
|
68
|
-
expect(screen.getByTestId('info-icon')).toHaveClass('light');
|
|
69
|
-
});
|
|
70
|
-
});
|
package/src/statusIcon/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './StatusIcon';
|
package/src/tooltip/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|