@transferwise/components 0.0.0-experimental-0df7ed4 → 0.0.0-experimental-75135c1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../../src/upload/Upload.js"],"names":[],"mappings":";;;;AA2BA;IACE,wBAeC;IAbC,oBAAoB;IACpB,gCAAoB;IAEpB;;;;;;;;;MASC;IAGH,kCAiBC;IAED,8BAMC;IAED,8BAQC;IAED,yBAUC;IAED,qDA6BE;IAEF,4CAQE;IAEF,kDASE;IAEF,8CAKE;IAEF,oCAQE;IAEF,kBASE;IAEF,sCAOE;IAEF,6CAyEE;IAEF,sCA2GC;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAzVD,wCAAiC"}
1
+ {"version":3,"file":"Upload.d.ts","sourceRoot":"","sources":["../../../src/upload/Upload.js"],"names":[],"mappings":";;;;AA2BA;IACE,wBAeC;IAbC,oBAAoB;IACpB,gCAAoB;IAEpB;;;;;;;;;MASC;IAGH,kCAiBC;IAED,8BAMC;IAED,8BAQC;IAED,yBAUC;IAED,qDAwBE;IAEF,4CAQE;IAEF,kDASE;IAEF,8CAKE;IAEF,oCAQE;IAEF,kBASE;IAEF,sCAOE;IAEF,6CAyEE;IAEF,sCA2GC;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApVD,wCAAiC"}
@@ -1 +1 @@
1
- {"version":3,"file":"processingStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/processingStep/processingStep.js"],"names":[],"mappings":";AASA,yEAkDC"}
1
+ {"version":3,"file":"processingStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/processingStep/processingStep.js"],"names":[],"mappings":";AAQA,yEAyCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-0df7ed4",
3
+ "version": "0.0.0-experimental-75135c1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -95,31 +95,26 @@ class Upload extends Component {
95
95
  onAnimationCompleted = async (status) => {
96
96
  const { response, isProcessing, fileName } = this.state;
97
97
  // Success.
98
- const { animationDelay } = this.props;
99
98
  if (isProcessing && status === Status.SUCCEEDED) {
100
99
  const { onSuccess } = this.props;
101
- this.timeouts = setTimeout(() => {
102
- this.setState(
103
- {
104
- isProcessing: false,
105
- isComplete: true,
106
- },
107
- () => (onSuccess ? onSuccess(response, fileName) : {}),
108
- );
109
- }, animationDelay);
100
+ this.setState(
101
+ {
102
+ isProcessing: false,
103
+ isComplete: true,
104
+ },
105
+ () => (onSuccess ? onSuccess(response, fileName) : {}),
106
+ );
110
107
  }
111
108
  // Failure.
112
109
  if (isProcessing && status === Status.FAILED) {
113
110
  const { onFailure } = this.props;
114
- this.timeouts = setTimeout(() => {
115
- this.setState(
116
- {
117
- isProcessing: false,
118
- isComplete: true,
119
- },
120
- () => (onFailure ? onFailure(response) : {}),
121
- );
122
- }, animationDelay);
111
+ this.setState(
112
+ {
113
+ isProcessing: false,
114
+ isComplete: true,
115
+ },
116
+ () => (onFailure ? onFailure(response) : {}),
117
+ );
123
118
  }
124
119
  };
125
120
 
@@ -409,7 +404,7 @@ Upload.propTypes = {
409
404
  };
410
405
 
411
406
  Upload.defaultProps = {
412
- animationDelay: 700,
407
+ animationDelay: 0,
413
408
  csButtonText: undefined,
414
409
  csFailureText: undefined,
415
410
  csSuccessText: undefined,
@@ -1,6 +1,5 @@
1
- import { useTheme } from '@wise/components-theming';
2
- import classNames from 'classnames';
3
1
  import PropTypes from 'prop-types';
2
+ import { useEffect } from 'react';
4
3
 
5
4
  import Button from '../../../button';
6
5
  import { Status, Size, Typography } from '../../../common';
@@ -19,8 +18,6 @@ const ProcessingStep = (props) => {
19
18
  psButtonDisabled,
20
19
  } = props;
21
20
 
22
- const { isModern } = useTheme();
23
-
24
21
  let processStatus = Status.PROCESSING;
25
22
  if (isError) {
26
23
  processStatus = Status.FAILED;
@@ -29,24 +26,17 @@ const ProcessingStep = (props) => {
29
26
  processStatus = Status.SUCCEEDED;
30
27
  }
31
28
 
29
+ useEffect(() => {
30
+ if (processStatus !== Status.PROCESSING) {
31
+ onAnimationCompleted(processStatus);
32
+ }
33
+ }, [processStatus, onAnimationCompleted]);
34
+
32
35
  return (
33
36
  <div className="droppable-processing-card droppable-card" aria-hidden={isComplete}>
34
37
  <div className="droppable-card-content">
35
- <ProcessIndicator
36
- size={Size.Small}
37
- status={processStatus}
38
- onAnimationCompleted={(status) => onAnimationCompleted(status)}
39
- />
40
- <Title
41
- className={classNames({
42
- 'm-t-3': !isModern,
43
- 'm-b-3': !isModern,
44
- 'm-t-2': isModern,
45
- 'm-b-2': isModern,
46
- })}
47
- type={Typography.TITLE_BODY}
48
- aria-live="polite"
49
- >
38
+ <ProcessIndicator size={Size.SMALL} status={processStatus} />
39
+ <Title className="m-t-2 m-b-2" type={Typography.TITLE_BODY} aria-live="polite">
50
40
  {psProcessingText}
51
41
  </Title>
52
42
  {psButtonText && (