@transferwise/components 0.0.0-experimental-ef26b66 → 0.0.0-experimental-d576f44
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.js +22 -42
- package/build/index.js.map +1 -1
- package/build/index.mjs +22 -42
- package/build/index.mjs.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +5 -17
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/index.d.ts +2 -2
- package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -2
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/info/index.d.ts +1 -1
- package/build/types/info/index.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts +9 -18
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/overlayHeader/index.d.ts +2 -1
- package/build/types/overlayHeader/index.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/alert/Alert.story.tsx +5 -6
- package/src/chips/Chips.story.tsx +3 -5
- package/src/common/card/Card.story.tsx +0 -1
- package/src/dateInput/DateInput.story.tsx +16 -21
- package/src/dateLookup/DateLookup.tests.story.tsx +2 -4
- package/src/flowNavigation/backButton/BackButton.tsx +29 -0
- package/src/flowNavigation/backButton/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/info/Info.story.tsx +9 -15
- package/src/info/Info.tsx +2 -2
- package/src/info/index.ts +1 -1
- package/src/moneyInput/MoneyInput.story.tsx +4 -1
- package/src/overlayHeader/{OverlayHeader.spec.js → OverlayHeader.spec.tsx} +1 -1
- package/src/overlayHeader/{OverlayHeader.story.js → OverlayHeader.story.tsx} +10 -2
- package/src/overlayHeader/{OverlayHeader.js → OverlayHeader.tsx} +12 -19
- package/src/overlayHeader/index.ts +2 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +0 -1
- package/src/uploadInput/UploadInput.story.tsx +21 -23
- package/src/flowNavigation/backButton/BackButton.js +0 -32
- package/src/flowNavigation/backButton/BackButton.spec.js +0 -16
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +0 -37
- package/src/flowNavigation/backButton/index.js +0 -3
- package/src/overlayHeader/index.js +0 -1
- /package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import {
|
|
2
|
+
import { Story, Meta } from '@storybook/react';
|
|
3
3
|
|
|
4
4
|
import { Status } from '../common';
|
|
5
5
|
|
|
@@ -14,8 +14,6 @@ const meta: Meta<typeof UploadInput> = {
|
|
|
14
14
|
|
|
15
15
|
export default meta;
|
|
16
16
|
|
|
17
|
-
type Story = StoryFn<UploadInputProps>;
|
|
18
|
-
|
|
19
17
|
const files = [
|
|
20
18
|
{
|
|
21
19
|
id: 1,
|
|
@@ -63,46 +61,46 @@ const createDelayedPromise = async ({
|
|
|
63
61
|
});
|
|
64
62
|
|
|
65
63
|
const props = {
|
|
66
|
-
onUploadFile: async () => {
|
|
64
|
+
onUploadFile: async (formData: FormData) => {
|
|
67
65
|
return createDelayedPromise();
|
|
68
66
|
},
|
|
69
|
-
onDeleteFile: async () => {
|
|
67
|
+
onDeleteFile: async (id: string | number) => {
|
|
70
68
|
return createDelayedPromise();
|
|
71
69
|
},
|
|
72
70
|
};
|
|
73
71
|
|
|
74
|
-
const Template: Story = (args: UploadInputProps) => <UploadInput {...args} />;
|
|
72
|
+
const Template: Story<UploadInputProps> = (args: UploadInputProps) => <UploadInput {...args} />;
|
|
75
73
|
|
|
76
|
-
export const SingleFile: Story = Template.bind({});
|
|
74
|
+
export const SingleFile: Story<UploadInputProps> = Template.bind({});
|
|
77
75
|
SingleFile.args = { ...props };
|
|
78
76
|
|
|
79
|
-
export const MultipleFiles: Story = Template.bind({});
|
|
77
|
+
export const MultipleFiles: Story<UploadInputProps> = Template.bind({});
|
|
80
78
|
MultipleFiles.args = { ...props, multiple: true };
|
|
81
79
|
|
|
82
|
-
export const UploadInputWithDescriptionFromProps: Story = Template.bind({});
|
|
80
|
+
export const UploadInputWithDescriptionFromProps: Story<UploadInputProps> = Template.bind({});
|
|
83
81
|
UploadInputWithDescriptionFromProps.args = {
|
|
84
82
|
...props,
|
|
85
83
|
multiple: true,
|
|
86
84
|
description: 'Custom file description from prop',
|
|
87
85
|
};
|
|
88
86
|
|
|
89
|
-
export const Disabled: Story = Template.bind({});
|
|
87
|
+
export const Disabled: Story<UploadInputProps> = Template.bind({});
|
|
90
88
|
Disabled.args = { ...props, disabled: true };
|
|
91
89
|
|
|
92
|
-
export const WithAnyFileType: Story = Template.bind({});
|
|
90
|
+
export const WithAnyFileType: Story<UploadInputProps> = Template.bind({});
|
|
93
91
|
WithAnyFileType.args = { ...props, fileTypes: '*' };
|
|
94
92
|
|
|
95
|
-
export const WithSingleFileType: Story = Template.bind({});
|
|
93
|
+
export const WithSingleFileType: Story<UploadInputProps> = Template.bind({});
|
|
96
94
|
WithSingleFileType.args = { ...props, fileTypes: '.zip,application/zip' };
|
|
97
95
|
|
|
98
|
-
export const WithMultipleExistingFiles: Story = Template.bind({});
|
|
96
|
+
export const WithMultipleExistingFiles: Story<UploadInputProps> = Template.bind({});
|
|
99
97
|
WithMultipleExistingFiles.args = {
|
|
100
98
|
...props,
|
|
101
99
|
files,
|
|
102
100
|
multiple: true,
|
|
103
101
|
};
|
|
104
102
|
|
|
105
|
-
export const WithFileErrors: Story = Template.bind({});
|
|
103
|
+
export const WithFileErrors: Story<UploadInputProps> = Template.bind({});
|
|
106
104
|
WithFileErrors.args = {
|
|
107
105
|
...props,
|
|
108
106
|
files: [
|
|
@@ -145,7 +143,7 @@ WithFileErrors.args = {
|
|
|
145
143
|
multiple: true,
|
|
146
144
|
};
|
|
147
145
|
|
|
148
|
-
export const WithoutDelete: Story = Template.bind({});
|
|
146
|
+
export const WithoutDelete: Story<UploadInputProps> = Template.bind({});
|
|
149
147
|
WithoutDelete.args = {
|
|
150
148
|
...props,
|
|
151
149
|
files,
|
|
@@ -153,7 +151,7 @@ WithoutDelete.args = {
|
|
|
153
151
|
multiple: true,
|
|
154
152
|
};
|
|
155
153
|
|
|
156
|
-
export const WithUploadFailed: Story = Template.bind({});
|
|
154
|
+
export const WithUploadFailed: Story<UploadInputProps> = Template.bind({});
|
|
157
155
|
WithUploadFailed.args = {
|
|
158
156
|
...props,
|
|
159
157
|
files: files.slice(0),
|
|
@@ -161,7 +159,7 @@ WithUploadFailed.args = {
|
|
|
161
159
|
multiple: true,
|
|
162
160
|
};
|
|
163
161
|
|
|
164
|
-
export const WithDeleteFailed: Story = Template.bind({});
|
|
162
|
+
export const WithDeleteFailed: Story<UploadInputProps> = Template.bind({});
|
|
165
163
|
WithDeleteFailed.args = {
|
|
166
164
|
...props,
|
|
167
165
|
files: files.slice(0),
|
|
@@ -169,7 +167,7 @@ WithDeleteFailed.args = {
|
|
|
169
167
|
multiple: true,
|
|
170
168
|
};
|
|
171
169
|
|
|
172
|
-
export const CustomConfirmMessage: Story = Template.bind({});
|
|
170
|
+
export const CustomConfirmMessage: Story<UploadInputProps> = Template.bind({});
|
|
173
171
|
CustomConfirmMessage.args = {
|
|
174
172
|
...props,
|
|
175
173
|
files: files.slice(0),
|
|
@@ -184,21 +182,21 @@ CustomConfirmMessage.args = {
|
|
|
184
182
|
},
|
|
185
183
|
};
|
|
186
184
|
|
|
187
|
-
export const withManualDownloadHandler: Story = Template.bind({});
|
|
185
|
+
export const withManualDownloadHandler: Story<UploadInputProps> = Template.bind({});
|
|
188
186
|
withManualDownloadHandler.args = {
|
|
189
187
|
...props,
|
|
190
188
|
files,
|
|
191
189
|
onDownload: action('Manual download handler'),
|
|
192
190
|
};
|
|
193
191
|
|
|
194
|
-
export const withFilesChangeHandler: Story = Template.bind({});
|
|
192
|
+
export const withFilesChangeHandler: Story<UploadInputProps> = Template.bind({});
|
|
195
193
|
withFilesChangeHandler.args = {
|
|
196
194
|
...props,
|
|
197
195
|
files,
|
|
198
196
|
onFilesChange: action('Files change handler'),
|
|
199
197
|
};
|
|
200
198
|
|
|
201
|
-
export const withMaxFilesToUploadLimit: Story = Template.bind({});
|
|
199
|
+
export const withMaxFilesToUploadLimit: Story<UploadInputProps> = Template.bind({});
|
|
202
200
|
withMaxFilesToUploadLimit.args = {
|
|
203
201
|
...props,
|
|
204
202
|
multiple: true,
|
|
@@ -206,14 +204,14 @@ withMaxFilesToUploadLimit.args = {
|
|
|
206
204
|
maxFilesErrorMessage: "Can't upload as maximum number of files allowed are already uploaded",
|
|
207
205
|
};
|
|
208
206
|
|
|
209
|
-
export const withFileSizeErrorMessage: Story = Template.bind({});
|
|
207
|
+
export const withFileSizeErrorMessage: Story<UploadInputProps> = Template.bind({});
|
|
210
208
|
withFileSizeErrorMessage.args = {
|
|
211
209
|
...props,
|
|
212
210
|
sizeLimit: 1,
|
|
213
211
|
sizeLimitErrorMessage: 'The file is oversized',
|
|
214
212
|
};
|
|
215
213
|
|
|
216
|
-
export const withCustomUploadButtonTitle: Story = Template.bind({});
|
|
214
|
+
export const withCustomUploadButtonTitle: Story<UploadInputProps> = Template.bind({});
|
|
217
215
|
withCustomUploadButtonTitle.args = {
|
|
218
216
|
...props,
|
|
219
217
|
uploadButtonTitle: 'Upload the VAT receipts for FY 2022-23',
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ArrowLeft as ArrowLeftIcon } from '@transferwise/icons';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import Avatar, { AvatarType } from '../../avatar';
|
|
6
|
-
|
|
7
|
-
const BackButton = ({ className, onClick, 'aria-label': ariaLabel }) => (
|
|
8
|
-
<Avatar type={AvatarType.ICON} size={40}>
|
|
9
|
-
<button
|
|
10
|
-
type="button"
|
|
11
|
-
aria-label={ariaLabel}
|
|
12
|
-
className={classNames('np-back-button', 'btn-unstyled', className)}
|
|
13
|
-
onClick={onClick}
|
|
14
|
-
>
|
|
15
|
-
<ArrowLeftIcon size={24} />
|
|
16
|
-
</button>
|
|
17
|
-
</Avatar>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
BackButton.propTypes = {
|
|
21
|
-
'aria-label': PropTypes.string.isRequired,
|
|
22
|
-
className: PropTypes.string,
|
|
23
|
-
label: PropTypes.element,
|
|
24
|
-
onClick: PropTypes.func,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
BackButton.defaultProps = {
|
|
28
|
-
className: undefined,
|
|
29
|
-
label: undefined,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default BackButton;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { render } from '../../test-utils';
|
|
2
|
-
import messages from '../FlowNavigation.messages';
|
|
3
|
-
|
|
4
|
-
import BackButton from '.';
|
|
5
|
-
|
|
6
|
-
const props = {
|
|
7
|
-
label: <>label</>,
|
|
8
|
-
className: 'className',
|
|
9
|
-
onClick: jest.fn(),
|
|
10
|
-
'aria-label': messages.back.defaultMessage,
|
|
11
|
-
};
|
|
12
|
-
describe('BackButton', () => {
|
|
13
|
-
it(`renders as expected`, () => {
|
|
14
|
-
expect(render(<BackButton {...props} />).container).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`BackButton renders as expected 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="tw-avatar tw-avatar--40 tw-avatar--icon"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="tw-avatar__content"
|
|
10
|
-
>
|
|
11
|
-
<button
|
|
12
|
-
class="np-back-button btn-unstyled className"
|
|
13
|
-
type="button"
|
|
14
|
-
>
|
|
15
|
-
<span
|
|
16
|
-
aria-hidden="true"
|
|
17
|
-
class="tw-icon tw-icon-arrow-left "
|
|
18
|
-
data-testid="arrow-left-icon"
|
|
19
|
-
role="presentation"
|
|
20
|
-
>
|
|
21
|
-
<svg
|
|
22
|
-
fill="currentColor"
|
|
23
|
-
focusable="false"
|
|
24
|
-
height="24"
|
|
25
|
-
viewBox="0 0 24 24"
|
|
26
|
-
width="24"
|
|
27
|
-
>
|
|
28
|
-
<path
|
|
29
|
-
d="M22.286 11.316H4.629l7.114-7.114-1.2-1.2-8.572 8.571a.829.829 0 0 0 0 1.2l8.572 8.572 1.2-1.2-7.114-7.114h17.657v-1.715Z"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
</span>
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './OverlayHeader';
|
/package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap}
RENAMED
|
File without changes
|