@transferwise/components 0.0.0-experimental-c8fc1dc → 0.0.0-experimental-10c3d0b
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 +16 -24
- package/build/index.esm.js.map +1 -1
- package/build/index.js +16 -24
- package/build/index.js.map +1 -1
- package/build/types/instructionsList/InstructionsList.d.ts +2 -4
- package/build/types/instructionsList/InstructionsList.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/package.json +16 -19
- package/src/button/Button.story.tsx +3 -3
- package/src/common/fakeEvents.js +18 -0
- package/src/dateInput/DateInput.story.tsx +4 -3
- package/src/dateLookup/DateLookup.story.js +4 -3
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +3 -2
- package/src/info/Info.story.tsx +3 -3
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +2 -7
- package/src/inputs/SelectInput.story.tsx +7 -7
- package/src/instructionsList/InstructionList.story.tsx +0 -1
- package/src/instructionsList/InstructionsList.tsx +12 -41
- package/src/logo/Logo.js +4 -4
- package/src/moneyInput/MoneyInput.story.tsx +3 -3
- package/src/snackbar/Snackbar.story.tsx +3 -3
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +5 -4
- package/src/tooltip/Tooltip.story.tsx +3 -3
- package/src/typeahead/Typeahead.js +5 -6
- package/src/typeahead/Typeahead.spec.js +0 -2
- package/src/typeahead/Typeahead.story.js +3 -4
|
@@ -4,15 +4,13 @@ type InstructionNode = {
|
|
|
4
4
|
content: ReactNode;
|
|
5
5
|
['aria-label']: string;
|
|
6
6
|
};
|
|
7
|
-
type Props = CommonProps & {
|
|
8
|
-
overrideCircleFillIcons?: boolean;
|
|
9
|
-
} & ({
|
|
7
|
+
type Props = CommonProps & ({
|
|
10
8
|
dos?: ReactNode[];
|
|
11
9
|
donts?: ReactNode[];
|
|
12
10
|
} | {
|
|
13
11
|
dos?: InstructionNode[];
|
|
14
12
|
donts?: InstructionNode[];
|
|
15
13
|
});
|
|
16
|
-
declare const InstructionsList: ({ dos, donts
|
|
14
|
+
declare const InstructionsList: ({ dos, donts }: Props) => import("react").JSX.Element;
|
|
17
15
|
export default InstructionsList;
|
|
18
16
|
//# sourceMappingURL=InstructionsList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstructionsList.d.ts","sourceRoot":"","sources":["../../../src/instructionsList/InstructionsList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InstructionsList.d.ts","sourceRoot":"","sources":["../../../src/instructionsList/InstructionsList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAc,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC;IACnB,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,KAAK,GAAG,WAAW,GACtB,CACI;IACE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,GACD;IACE,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;CAC3B,CACJ,CAAC;AAEJ,QAAA,MAAM,gBAAgB,mBAAoB,KAAK,gCAe9C,CAAC;AAsBF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../../src/typeahead/Typeahead.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../../src/typeahead/Typeahead.js"],"names":[],"mappings":"AAyBA;IACE,wBAWC;IARC,2BAAqE;IAErE;;;;;MAKC;IAGH,uDAeC;IAED,6BAEC;IAED,0BAOE;IAEF,kDAGE;IAEF,qCAoBE;IAEF,oCAiBE;IAEF,sCAmCE;IAEF,qCAYC;IAED,gCAiBE;IAEF,sCAME;IAEF,mCASE;IAEF,gCAgBE;IAEF,qBAWE;IAEF,qBAWE;IAEF,6CAOE;IAEF,4BASE;IAEF,kCAME;IAEF,mEAcE;IAEF;;;;;;;;;sCA0CE;IAEF,sCAmGC;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqEe,0CAAU;;;;;;;;;;AAle1B,gCAAyB;AADzB,0CAAmC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-10c3d0b",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -28,25 +28,22 @@
|
|
|
28
28
|
"@babel/preset-typescript": "^7.22.15",
|
|
29
29
|
"@formatjs/cli": "^4.8.3",
|
|
30
30
|
"@rollup/plugin-babel": "^6.0.3",
|
|
31
|
-
"@rollup/plugin-image": "^3.0.2",
|
|
32
31
|
"@rollup/plugin-json": "^6.0.0",
|
|
33
32
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
34
33
|
"@rollup/plugin-typescript": "^11.1.3",
|
|
35
|
-
"@
|
|
36
|
-
"@storybook/addon-
|
|
37
|
-
"@storybook/addon-
|
|
38
|
-
"@storybook/addon-
|
|
34
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
35
|
+
"@storybook/addon-a11y": "^7.6.17",
|
|
36
|
+
"@storybook/addon-actions": "^7.6.17",
|
|
37
|
+
"@storybook/addon-essentials": "^7.6.17",
|
|
38
|
+
"@storybook/addon-interactions": "^7.6.17",
|
|
39
39
|
"@storybook/addon-knobs": "^7.0.2",
|
|
40
|
-
"@storybook/addon-viewport": "^7.
|
|
41
|
-
"@storybook/
|
|
42
|
-
"@storybook/
|
|
43
|
-
"@storybook/
|
|
44
|
-
"@storybook/
|
|
45
|
-
"@storybook/
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/testing-library": "^0.1.0",
|
|
48
|
-
"@storybook/theming": "^7.4.5",
|
|
49
|
-
"@storybook/types": "^7.4.5",
|
|
40
|
+
"@storybook/addon-viewport": "^7.6.17",
|
|
41
|
+
"@storybook/manager-api": "^7.6.17",
|
|
42
|
+
"@storybook/react": "^7.6.17",
|
|
43
|
+
"@storybook/react-webpack5": "^7.6.17",
|
|
44
|
+
"@storybook/test": "^7.6.17",
|
|
45
|
+
"@storybook/theming": "^7.6.17",
|
|
46
|
+
"@storybook/types": "^7.6.17",
|
|
50
47
|
"@testing-library/dom": "^7.21.4",
|
|
51
48
|
"@testing-library/jest-dom": "^5.14.1",
|
|
52
49
|
"@testing-library/react": "^12.0.0",
|
|
@@ -74,16 +71,16 @@
|
|
|
74
71
|
"lodash.times": "^4.3.2",
|
|
75
72
|
"react-intl": "^5.10.0",
|
|
76
73
|
"rollup": "^3.28.1",
|
|
77
|
-
"storybook": "^7.
|
|
74
|
+
"storybook": "^7.6.17",
|
|
78
75
|
"@transferwise/less-config": "3.1.0",
|
|
79
76
|
"@transferwise/neptune-css": "14.9.5",
|
|
80
|
-
"@wise/components-theming": "
|
|
77
|
+
"@wise/components-theming": "1.0.0"
|
|
81
78
|
},
|
|
82
79
|
"peerDependencies": {
|
|
83
80
|
"@transferwise/icons": "^3.7.0",
|
|
84
81
|
"@transferwise/neptune-css": "^14.9.5",
|
|
85
82
|
"@wise/art": "^2.7.0",
|
|
86
|
-
"@wise/components-theming": "
|
|
83
|
+
"@wise/components-theming": "^1.0.0",
|
|
87
84
|
"react": ">=16.14",
|
|
88
85
|
"react-dom": ">=16.14",
|
|
89
86
|
"react-intl": "^5.10.0 || ^6"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within } from '@storybook/
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
3
3
|
|
|
4
4
|
import { ControlType, Priority } from '../common';
|
|
5
5
|
import { storyConfig } from '../test-utils';
|
|
@@ -34,9 +34,9 @@ export const Focused = storyConfig<Story>(
|
|
|
34
34
|
delay: 1000,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
play: ({ canvasElement }) => {
|
|
37
|
+
play: async ({ canvasElement }) => {
|
|
38
38
|
const canvas = within(canvasElement);
|
|
39
|
-
userEvent.click(canvas.getByRole('button'));
|
|
39
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
{
|
package/src/common/fakeEvents.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
import keyCodes from './keyCodes';
|
|
2
|
+
|
|
1
3
|
export const fakeEvent = () => ({
|
|
2
4
|
nativeEvent: { stopImmediatePropagation() {} },
|
|
3
5
|
stopPropagation() {},
|
|
4
6
|
preventDefault() {},
|
|
5
7
|
});
|
|
6
8
|
|
|
9
|
+
const keyByKeyCode = {
|
|
10
|
+
[keyCodes.DOWN]: 'ArrowDown',
|
|
11
|
+
[keyCodes.UP]: 'ArrowUp',
|
|
12
|
+
[keyCodes.LEFT]: 'ArrowLeft',
|
|
13
|
+
[keyCodes.RIGHT]: 'ArrowRight',
|
|
14
|
+
[keyCodes.ENTER]: 'Enter',
|
|
15
|
+
[keyCodes.ESCAPE]: 'Escape',
|
|
16
|
+
[keyCodes.TAB]: 'Tab',
|
|
17
|
+
[keyCodes.SPACE]: ' ',
|
|
18
|
+
[keyCodes.BACKSPACE]: 'Backspace',
|
|
19
|
+
[keyCodes.DELETE]: 'Delete',
|
|
20
|
+
[keyCodes.COMMA]: ',',
|
|
21
|
+
[keyCodes.PERIOD]: '.',
|
|
22
|
+
};
|
|
23
|
+
|
|
7
24
|
export const fakeKeyDownEventForKey = (keyCode) => ({
|
|
8
25
|
...fakeEvent(),
|
|
9
26
|
keyCode,
|
|
27
|
+
key: keyByKeyCode[keyCode],
|
|
10
28
|
});
|
|
11
29
|
|
|
12
30
|
export const fakeKeyDownEvent = (eventAttribute = {}) => ({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
3
|
|
|
3
4
|
import { DateInput, Info, InlineAlert, Title, Typography } from '..';
|
|
4
|
-
import { lorem10, storyConfig
|
|
5
|
+
import { lorem10, storyConfig } from '../test-utils';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
component: DateInput,
|
|
@@ -25,9 +26,9 @@ type Story = StoryObj<typeof DateInput>;
|
|
|
25
26
|
|
|
26
27
|
export const Basic: Story = {};
|
|
27
28
|
|
|
28
|
-
Basic.play = ({ canvasElement }) => {
|
|
29
|
+
Basic.play = async ({ canvasElement }) => {
|
|
29
30
|
const canvas = within(canvasElement);
|
|
30
|
-
userEvent.click(canvas.getByRole('button'));
|
|
31
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
export const WithLabel: Story = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { boolean, select, date, text } from '@storybook/addon-knobs';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
|
|
4
5
|
import { Size } from '../common';
|
|
5
|
-
import {
|
|
6
|
+
import { storyConfig } from '../test-utils';
|
|
6
7
|
|
|
7
8
|
import DateLookup from './DateLookup';
|
|
8
9
|
|
|
@@ -48,8 +49,8 @@ export const Basic = () => {
|
|
|
48
49
|
Basic.play = async ({ canvasElement }) => {
|
|
49
50
|
// testing focus state on keyboard nav
|
|
50
51
|
const canvas = within(canvasElement);
|
|
51
|
-
userEvent.tab(canvas.getByRole('button'));
|
|
52
|
-
userEvent.keyboard('
|
|
52
|
+
await userEvent.tab(canvas.getByRole('button'));
|
|
53
|
+
await userEvent.keyboard(' ');
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
export const Basic400Zoom = storyConfig(
|
|
@@ -3,6 +3,7 @@ import { shallow } from 'enzyme';
|
|
|
3
3
|
|
|
4
4
|
import Chevron from '../../chevron';
|
|
5
5
|
import { fakeKeyDownEventForKey } from '../../common/fakeEvents';
|
|
6
|
+
import keyCodes from '../../common/keyCodes';
|
|
6
7
|
|
|
7
8
|
import DateTrigger from '.';
|
|
8
9
|
|
|
@@ -111,14 +112,14 @@ describe('DateTrigger', () => {
|
|
|
111
112
|
it('calls onClear when user press Space', () => {
|
|
112
113
|
const onClear = jest.fn();
|
|
113
114
|
component.setProps({ onClear });
|
|
114
|
-
clearButton().simulate('keypress', fakeKeyDownEventForKey(
|
|
115
|
+
clearButton().simulate('keypress', fakeKeyDownEventForKey(keyCodes.SPACE));
|
|
115
116
|
expect(onClear).toHaveBeenCalledTimes(1);
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
it('calls onClear when user press Enter', () => {
|
|
119
120
|
const onClear = jest.fn();
|
|
120
121
|
component.setProps({ onClear });
|
|
121
|
-
clearButton().simulate('keypress', fakeKeyDownEventForKey(
|
|
122
|
+
clearButton().simulate('keypress', fakeKeyDownEventForKey(keyCodes.ENTER));
|
|
122
123
|
expect(onClear).toHaveBeenCalledTimes(1);
|
|
123
124
|
});
|
|
124
125
|
|
package/src/info/Info.story.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within } from '@storybook/
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
3
3
|
|
|
4
4
|
import { lorem10, storyConfig } from '../test-utils';
|
|
5
5
|
|
|
@@ -35,9 +35,9 @@ export const OpenedPopover: Story = {
|
|
|
35
35
|
delay: 1000,
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
-
play: ({ canvasElement }) => {
|
|
38
|
+
play: async ({ canvasElement }) => {
|
|
39
39
|
const canvas = within(canvasElement);
|
|
40
|
-
userEvent.click(canvas.getByRole('button'));
|
|
40
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { text } from '@storybook/addon-knobs';
|
|
2
|
-
|
|
3
|
-
import { within, userEvent } from '../test-utils';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
4
3
|
|
|
5
4
|
import InputWithDisplayFormat from '.';
|
|
6
5
|
|
|
@@ -86,9 +85,5 @@ SecurityPinPlay.args = {
|
|
|
86
85
|
|
|
87
86
|
SecurityPinPlay.play = async ({ canvasElement }) => {
|
|
88
87
|
const canvas = within(canvasElement);
|
|
89
|
-
|
|
90
|
-
while (i < 6) {
|
|
91
|
-
await userEvent.type(canvas.getByPlaceholderText('*-*-*-*-*-*'), `${i + 1}`, { delay: 5000 });
|
|
92
|
-
i++;
|
|
93
|
-
}
|
|
88
|
+
await userEvent.type(canvas.getByPlaceholderText('*-*-*-*-*-*'), '123456');
|
|
94
89
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
3
|
import { Calendar, ChevronDown } from '@transferwise/icons';
|
|
3
4
|
import { Flag } from '@wise/art';
|
|
4
5
|
import classNames from 'classnames';
|
|
@@ -7,7 +8,6 @@ import { useState } from 'react';
|
|
|
7
8
|
import { getMonthNames } from '../common/dateUtils';
|
|
8
9
|
import Drawer from '../drawer';
|
|
9
10
|
import Modal from '../modal';
|
|
10
|
-
import { within, userEvent } from '../test-utils';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
SelectInput,
|
|
@@ -131,9 +131,9 @@ export const Basic: StoryObj<{
|
|
|
131
131
|
action: 'cleared',
|
|
132
132
|
},
|
|
133
133
|
},
|
|
134
|
-
play: ({ canvasElement }) => {
|
|
134
|
+
play: async ({ canvasElement }) => {
|
|
135
135
|
const triggerButton = within(canvasElement).getByRole('button');
|
|
136
|
-
userEvent.click(triggerButton);
|
|
136
|
+
await userEvent.click(triggerButton);
|
|
137
137
|
},
|
|
138
138
|
};
|
|
139
139
|
|
|
@@ -184,9 +184,9 @@ export const Months: StoryObj<{
|
|
|
184
184
|
action: 'cleared',
|
|
185
185
|
},
|
|
186
186
|
},
|
|
187
|
-
play: ({ canvasElement }) => {
|
|
187
|
+
play: async ({ canvasElement }) => {
|
|
188
188
|
const triggerButton = within(canvasElement).getByText('January');
|
|
189
|
-
userEvent.click(triggerButton);
|
|
189
|
+
await userEvent.click(triggerButton);
|
|
190
190
|
},
|
|
191
191
|
};
|
|
192
192
|
|
|
@@ -402,9 +402,9 @@ export const CustomTrigger: StoryObj = {
|
|
|
402
402
|
</div>
|
|
403
403
|
);
|
|
404
404
|
},
|
|
405
|
-
play: ({ canvasElement }) => {
|
|
405
|
+
play: async ({ canvasElement }) => {
|
|
406
406
|
const triggerButton = within(canvasElement).getByRole('button');
|
|
407
|
-
userEvent.click(triggerButton);
|
|
407
|
+
await userEvent.click(triggerButton);
|
|
408
408
|
},
|
|
409
409
|
};
|
|
410
410
|
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
CrossCircleFill as DontCheckCircleIcon,
|
|
4
|
-
CheckCircleFill as DoCheckCircleIcon,
|
|
5
|
-
Cross as DontCrossIcon,
|
|
6
|
-
Check as DoCheckIcon,
|
|
7
|
-
} from '@transferwise/icons';
|
|
1
|
+
import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';
|
|
8
2
|
import { ReactNode, isValidElement } from 'react';
|
|
9
3
|
|
|
10
4
|
import Body from '../body/Body';
|
|
@@ -15,7 +9,8 @@ type InstructionNode = {
|
|
|
15
9
|
['aria-label']: string;
|
|
16
10
|
};
|
|
17
11
|
|
|
18
|
-
type Props = CommonProps &
|
|
12
|
+
type Props = CommonProps &
|
|
13
|
+
(
|
|
19
14
|
| {
|
|
20
15
|
dos?: ReactNode[];
|
|
21
16
|
donts?: ReactNode[];
|
|
@@ -26,42 +21,24 @@ type Props = CommonProps & { overrideCircleFillIcons?: boolean } & (
|
|
|
26
21
|
}
|
|
27
22
|
);
|
|
28
23
|
|
|
29
|
-
const InstructionsList = ({ dos, donts
|
|
24
|
+
const InstructionsList = ({ dos, donts }: Props) => {
|
|
30
25
|
return (
|
|
31
26
|
<div className="tw-instructions">
|
|
32
27
|
{dos &&
|
|
33
28
|
dos.map((doThis, index) => (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
key={index}
|
|
37
|
-
item={doThis}
|
|
38
|
-
type="do"
|
|
39
|
-
overrideCircleFillIcons={overrideCircleFillIcons}
|
|
40
|
-
/>
|
|
29
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
30
|
+
<Instruction key={index} item={doThis} type="do" />
|
|
41
31
|
))}
|
|
42
32
|
{donts &&
|
|
43
33
|
donts.map((dont, index) => (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
key={index}
|
|
47
|
-
item={dont}
|
|
48
|
-
type="dont"
|
|
49
|
-
overrideCircleFillIcons={overrideCircleFillIcons}
|
|
50
|
-
/>
|
|
34
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
35
|
+
<Instruction key={index} item={dont} type="dont" />
|
|
51
36
|
))}
|
|
52
37
|
</div>
|
|
53
38
|
);
|
|
54
39
|
};
|
|
55
40
|
|
|
56
|
-
function Instruction({
|
|
57
|
-
item,
|
|
58
|
-
type,
|
|
59
|
-
overrideCircleFillIcons,
|
|
60
|
-
}: {
|
|
61
|
-
item: ReactNode | InstructionNode;
|
|
62
|
-
type: 'do' | 'dont';
|
|
63
|
-
overrideCircleFillIcons: boolean;
|
|
64
|
-
}) {
|
|
41
|
+
function Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {
|
|
65
42
|
const isInstructionNode =
|
|
66
43
|
typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
|
|
67
44
|
return (
|
|
@@ -69,16 +46,10 @@ function Instruction({
|
|
|
69
46
|
className="instruction"
|
|
70
47
|
aria-label={isInstructionNode ? (item['aria-label'] as string) : undefined}
|
|
71
48
|
>
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
<DoCheckIcon size={24} className={type} />
|
|
75
|
-
) : (
|
|
76
|
-
<DontCrossIcon size={24} className={type} />
|
|
77
|
-
)
|
|
78
|
-
) : type === 'do' ? (
|
|
79
|
-
<DoCheckCircleIcon size={24} className={type} />
|
|
49
|
+
{type === 'do' ? (
|
|
50
|
+
<DoIcon size={24} className={type} />
|
|
80
51
|
) : (
|
|
81
|
-
<
|
|
52
|
+
<DontIcon size={24} className={type} />
|
|
82
53
|
)}
|
|
83
54
|
<Body className="text-primary" type={Typography.BODY_LARGE}>
|
|
84
55
|
{isInstructionNode ? item.content : item}
|
package/src/logo/Logo.js
CHANGED
|
@@ -2,10 +2,10 @@ import classNames from 'classnames';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import { LogoType } from './logoTypes';
|
|
5
|
-
import { LogoFlagInverse } from './svg/flag-inverse.svg';
|
|
6
|
-
import { LogoFlag } from './svg/flag.svg';
|
|
7
|
-
import { LogoWiseInverse } from './svg/logo-inverse.svg';
|
|
8
|
-
import { LogoWise } from './svg/logo.svg';
|
|
5
|
+
import { ReactComponent as LogoFlagInverse } from './svg/flag-inverse.svg';
|
|
6
|
+
import { ReactComponent as LogoFlag } from './svg/flag.svg';
|
|
7
|
+
import { ReactComponent as LogoWiseInverse } from './svg/logo-inverse.svg';
|
|
8
|
+
import { ReactComponent as LogoWise } from './svg/logo.svg';
|
|
9
9
|
|
|
10
10
|
const svgPaths = {
|
|
11
11
|
WISE: LogoWise,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { within, userEvent } from '@storybook/
|
|
2
|
+
import { within, userEvent } from '@storybook/test';
|
|
3
3
|
import { Lock } from '@transferwise/icons';
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
|
|
@@ -150,9 +150,9 @@ export const BalanceCurrencies: Story = {
|
|
|
150
150
|
|
|
151
151
|
export const OpenedInput: Story = {
|
|
152
152
|
...MultipleCurrencies,
|
|
153
|
-
play: ({ canvasElement }) => {
|
|
153
|
+
play: async ({ canvasElement }) => {
|
|
154
154
|
const canvas = within(canvasElement);
|
|
155
|
-
userEvent.click(canvas.getByRole('button'));
|
|
155
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
156
156
|
},
|
|
157
157
|
};
|
|
158
158
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { number } from '@storybook/addon-knobs';
|
|
3
3
|
import { StoryContext } from '@storybook/react';
|
|
4
|
+
import { userEvent, within } from '@storybook/test';
|
|
4
5
|
import { Mobile, Theme, Switch, Bulb, Info, Coins } from '@transferwise/icons';
|
|
5
6
|
|
|
6
7
|
import Button from '../button';
|
|
7
8
|
import CheckboxOption from '../checkboxOption/CheckboxOption';
|
|
8
|
-
import { within, userEvent } from '../test-utils';
|
|
9
9
|
|
|
10
10
|
import { Snackbar } from './Snackbar';
|
|
11
11
|
import { SnackbarConsumer } from './SnackbarContext';
|
|
@@ -121,7 +121,7 @@ export const basic = () => {
|
|
|
121
121
|
);
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
basic.play = ({ canvasElement }: StoryContext) => {
|
|
124
|
+
basic.play = async ({ canvasElement }: StoryContext) => {
|
|
125
125
|
const canvas = within(canvasElement);
|
|
126
|
-
userEvent.click(canvas.getByRole('button'));
|
|
126
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
127
127
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { userEvent, within } from '../test-utils';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
4
3
|
|
|
5
4
|
import TextareaWithDisplayFormat from './TextareaWithDisplayFormat';
|
|
6
5
|
|
|
@@ -25,8 +24,10 @@ export const Basic: Story = {
|
|
|
25
24
|
},
|
|
26
25
|
// intentionally use interactive typing (over init value via `value` prop)
|
|
27
26
|
// to trigger event handlers in the component
|
|
28
|
-
play: ({ canvasElement }) => {
|
|
27
|
+
play: async ({ canvasElement }) => {
|
|
29
28
|
const canvas = within(canvasElement);
|
|
30
|
-
userEvent.type(canvas.getByRole('textbox'), '111122223333'
|
|
29
|
+
await userEvent.type(canvas.getByRole('textbox'), '111122223333', {
|
|
30
|
+
initialSelectionStart: Number.MAX_SAFE_INTEGER,
|
|
31
|
+
});
|
|
31
32
|
},
|
|
32
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within } from '@storybook/
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
3
3
|
|
|
4
4
|
import Button from '../button';
|
|
5
5
|
import { storyConfig } from '../test-utils';
|
|
@@ -33,9 +33,9 @@ export const OpenedTooltip: Story = {
|
|
|
33
33
|
delay: 1000,
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
|
-
play: ({ canvasElement }) => {
|
|
36
|
+
play: async ({ canvasElement }) => {
|
|
37
37
|
const canvas = within(canvasElement);
|
|
38
|
-
userEvent.hover(canvas.getByRole('button'));
|
|
38
|
+
await userEvent.hover(canvas.getByRole('button'));
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
addClickClassToDocumentOnIos,
|
|
16
16
|
removeClickClassFromDocumentOnIos,
|
|
17
17
|
} from '../common/domHelpers';
|
|
18
|
-
import KeyCodes from '../common/keyCodes';
|
|
19
18
|
import InlineAlert from '../inlineAlert';
|
|
20
19
|
|
|
21
20
|
import TypeaheadInput from './typeaheadInput/TypeaheadInput';
|
|
@@ -123,16 +122,16 @@ export default class Typeahead extends Component {
|
|
|
123
122
|
event.preventDefault();
|
|
124
123
|
this.selectItem({ label: query });
|
|
125
124
|
} else {
|
|
126
|
-
switch (event.
|
|
127
|
-
case
|
|
125
|
+
switch (event.key) {
|
|
126
|
+
case 'ArrowDown':
|
|
128
127
|
event.preventDefault();
|
|
129
128
|
this.moveFocusedOption(1);
|
|
130
129
|
break;
|
|
131
|
-
case
|
|
130
|
+
case 'ArrowUp':
|
|
132
131
|
event.preventDefault();
|
|
133
132
|
this.moveFocusedOption(-1);
|
|
134
133
|
break;
|
|
135
|
-
case
|
|
134
|
+
case 'Enter':
|
|
136
135
|
event.preventDefault();
|
|
137
136
|
if (options[keyboardFocusedOptionIndex]) {
|
|
138
137
|
this.selectItem(options[keyboardFocusedOptionIndex]);
|
|
@@ -140,7 +139,7 @@ export default class Typeahead extends Component {
|
|
|
140
139
|
this.selectItem({ label: query });
|
|
141
140
|
}
|
|
142
141
|
break;
|
|
143
|
-
case
|
|
142
|
+
case 'Backspace':
|
|
144
143
|
if (multiple && !query && selected.length > 0) {
|
|
145
144
|
this.updateSelectedValue(selected.slice(0, -1));
|
|
146
145
|
}
|
|
@@ -94,7 +94,6 @@ describe('Typeahead', () => {
|
|
|
94
94
|
it('removes last selected value when backspace clicked on empty input', () => {
|
|
95
95
|
const event = {
|
|
96
96
|
key: 'Backspace',
|
|
97
|
-
keyCode: KeyCodes.BACKSPACE,
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
component.setProps({
|
|
@@ -116,7 +115,6 @@ describe('Typeahead', () => {
|
|
|
116
115
|
it('does not remove last selected value when backspace clicked on non-empty input', () => {
|
|
117
116
|
const event = {
|
|
118
117
|
key: 'Backspace',
|
|
119
|
-
keyCode: KeyCodes.BACKSPACE,
|
|
120
118
|
};
|
|
121
119
|
|
|
122
120
|
component.setProps({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { select, boolean } from '@storybook/addon-knobs';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
3
|
import { Search as SearchIcon } from '@transferwise/icons';
|
|
3
4
|
import { useState } from 'react';
|
|
4
5
|
|
|
5
6
|
import { Sentiment } from '../common';
|
|
6
|
-
import { within, userEvent } from '../test-utils';
|
|
7
7
|
|
|
8
8
|
import Typeahead from './Typeahead';
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ export const createable = () => {
|
|
|
45
45
|
|
|
46
46
|
createable.play = async ({ canvasElement }) => {
|
|
47
47
|
const canvas = within(canvasElement);
|
|
48
|
-
userEvent.type(canvas.getByRole('combobox'), 'chip{
|
|
48
|
+
await userEvent.type(canvas.getByRole('combobox'), 'chip{Enter}chip2{Enter}');
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export const Basic = () => {
|
|
@@ -117,6 +117,5 @@ export const Basic = () => {
|
|
|
117
117
|
|
|
118
118
|
Basic.play = async ({ canvasElement }) => {
|
|
119
119
|
const canvas = within(canvasElement);
|
|
120
|
-
userEvent.type(canvas.getByRole('combobox'), 'abc');
|
|
121
|
-
userEvent.type(canvas.getByRole('combobox'), '{arrowDown}');
|
|
120
|
+
await userEvent.type(canvas.getByRole('combobox'), 'abc{ArrowDown}');
|
|
122
121
|
};
|