@transferwise/components 0.0.0-experimental-79c0fba → 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.
- package/build/i18n/cs.json +2 -2
- package/build/i18n/de.json +2 -2
- package/build/i18n/en.json +2 -2
- package/build/i18n/es.json +2 -2
- package/build/i18n/hu.json +2 -2
- package/build/i18n/id.json +2 -2
- package/build/i18n/it.json +2 -2
- package/build/i18n/ja.json +2 -2
- package/build/i18n/pl.json +2 -2
- package/build/i18n/pt.json +2 -2
- package/build/i18n/ro.json +2 -2
- package/build/i18n/ru.json +2 -2
- package/build/i18n/th.json +2 -2
- package/build/i18n/tr.json +2 -2
- package/build/i18n/zh-CN.json +2 -2
- package/build/i18n/zh-HK.json +2 -2
- package/build/index.esm.js +130 -111
- package/build/index.esm.js.map +1 -1
- package/build/index.js +131 -112
- package/build/index.js.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +2 -2
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +17 -12
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/slidingPanel/index.d.ts +1 -2
- package/build/types/slidingPanel/index.d.ts.map +1 -1
- package/build/types/sticky/Sticky.d.ts +14 -9
- package/build/types/sticky/Sticky.d.ts.map +1 -1
- package/build/types/sticky/index.d.ts +1 -2
- package/build/types/sticky/index.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/circularButton/CircularButton.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +41 -47
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +33 -37
- package/src/i18n/cs.json +2 -2
- package/src/i18n/de.json +2 -2
- package/src/i18n/en.json +2 -2
- package/src/i18n/es.json +2 -2
- package/src/i18n/hu.json +2 -2
- package/src/i18n/id.json +2 -2
- package/src/i18n/it.json +2 -2
- package/src/i18n/ja.json +2 -2
- package/src/i18n/pl.json +2 -2
- package/src/i18n/pt.json +2 -2
- package/src/i18n/ro.json +2 -2
- package/src/i18n/ru.json +2 -2
- package/src/i18n/th.json +2 -2
- package/src/i18n/tr.json +2 -2
- package/src/i18n/zh-CN.json +2 -2
- package/src/i18n/zh-HK.json +2 -2
- package/src/index.ts +0 -2
- package/src/select/Select.spec.js +1 -1
- package/src/slidingPanel/SlidingPanel.js +73 -0
- package/src/slidingPanel/SlidingPanel.spec.js +19 -9
- package/src/slidingPanel/index.js +1 -0
- package/src/sticky/Sticky.js +23 -0
- package/src/sticky/Sticky.spec.js +1 -0
- package/src/sticky/{Sticky.story.tsx → Sticky.story.js} +3 -2
- package/src/sticky/index.js +1 -0
- package/src/upload/Upload.js +23 -22
- package/src/upload/Upload.messages.js +2 -2
- package/src/upload/Upload.story.js +1 -1
- package/src/upload/steps/processingStep/processingStep.js +9 -19
- package/src/slidingPanel/SlidingPanel.tsx +0 -62
- package/src/slidingPanel/index.ts +0 -2
- package/src/sticky/Sticky.tsx +0 -16
- package/src/sticky/index.ts +0 -2
- /package/src/slidingPanel/{SlidingPanel.story.tsx → SlidingPanel.story.js} +0 -0
package/src/i18n/th.json
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"neptune.Upload.csButtonText": "อัพโหลดไฟล์อื่นหรือไม่",
|
|
30
30
|
"neptune.Upload.csFailureText": "การอัปโหลดล้มเหลว กรุณาลองอีกครั้ง",
|
|
31
31
|
"neptune.Upload.csSuccessText": "อัปโหลดเสร็จสมบูรณ์!",
|
|
32
|
-
"neptune.Upload.csTooLargeMessage": "กรุณาใช้ไฟล์ที่มีขนาดเล็กกว่า
|
|
32
|
+
"neptune.Upload.csTooLargeMessage": "กรุณาใช้ไฟล์ที่มีขนาดเล็กกว่า {maxSize}MB",
|
|
33
33
|
"neptune.Upload.csWrongTypeMessage": "ไม่รองรับประเภทไฟล์ โปรดลองอีกครั้งโดยใช้ไฟล์อื่น",
|
|
34
34
|
"neptune.Upload.psButtonText": "ยกเลิก",
|
|
35
35
|
"neptune.Upload.psProcessingText": "กำลังอัปโหลด...",
|
|
36
36
|
"neptune.Upload.usButtonText": "หรือเลือกไฟล์",
|
|
37
37
|
"neptune.Upload.usDropMessage": "วางไฟล์เพื่อเริ่มการอัปโหลด",
|
|
38
|
-
"neptune.Upload.usPlaceholder": "ลากและวางไฟล์ที่มีขนาดไม่เกิน
|
|
38
|
+
"neptune.Upload.usPlaceholder": "ลากและวางไฟล์ที่มีขนาดไม่เกิน {maxSize}MB",
|
|
39
39
|
"neptune.UploadButton.allFileTypes": "ไฟล์ทุกประเภท",
|
|
40
40
|
"neptune.UploadButton.dropFiles": "วางไฟล์เพื่อเริ่มการอัปโหลด",
|
|
41
41
|
"neptune.UploadButton.instructions": "{fileTypes} น้อยกว่า {size}MB",
|
package/src/i18n/tr.json
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"neptune.Upload.csButtonText": "Başka bir dosya yükleyin?",
|
|
30
30
|
"neptune.Upload.csFailureText": "Yükleme başarısız. Lütfen yine deneyin",
|
|
31
31
|
"neptune.Upload.csSuccessText": "Yükleme tamamlandı!",
|
|
32
|
-
"neptune.Upload.csTooLargeMessage": "Lütfen
|
|
32
|
+
"neptune.Upload.csTooLargeMessage": "Lütfen {maxSize} MB'den hüçük bir dosya sağlayın",
|
|
33
33
|
"neptune.Upload.csWrongTypeMessage": "Desteklenmeyen dosya biçimi. Lütfen başka bir dosyayla tekrar deneyin",
|
|
34
34
|
"neptune.Upload.psButtonText": "İptal edin",
|
|
35
35
|
"neptune.Upload.psProcessingText": "Yükleniyor...",
|
|
36
36
|
"neptune.Upload.usButtonText": "Veya bir dosya seçin",
|
|
37
37
|
"neptune.Upload.usDropMessage": "Yüklemeyi başlatmak için dosyayı bırakın",
|
|
38
|
-
"neptune.Upload.usPlaceholder": "
|
|
38
|
+
"neptune.Upload.usPlaceholder": "{maxSize} MB'den küçük bir dosya sürükleyin ve bırakın",
|
|
39
39
|
"neptune.UploadButton.allFileTypes": "Tüm belge tipleri",
|
|
40
40
|
"neptune.UploadButton.dropFiles": "Yüklemeyi başlatmak için dosyayı bırakın",
|
|
41
41
|
"neptune.UploadButton.instructions": "{fileTypes}, en fazla {size}MB",
|
package/src/i18n/zh-CN.json
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"neptune.Upload.csButtonText": "上传另一个文件?",
|
|
30
30
|
"neptune.Upload.csFailureText": "上传失败。请重试",
|
|
31
31
|
"neptune.Upload.csSuccessText": "上传完毕!",
|
|
32
|
-
"neptune.Upload.csTooLargeMessage": "请提供小于
|
|
32
|
+
"neptune.Upload.csTooLargeMessage": "请提供小于 {maxSize}MB 的文件",
|
|
33
33
|
"neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
|
|
34
34
|
"neptune.Upload.psButtonText": "取消",
|
|
35
35
|
"neptune.Upload.psProcessingText": "正在上传…",
|
|
36
36
|
"neptune.Upload.usButtonText": "或选择文件",
|
|
37
37
|
"neptune.Upload.usDropMessage": "拖放文件开始上传",
|
|
38
|
-
"neptune.Upload.usPlaceholder": "拖放小于
|
|
38
|
+
"neptune.Upload.usPlaceholder": "拖放小于 {maxSize}MB 的文件",
|
|
39
39
|
"neptune.UploadButton.allFileTypes": "所有文件类型",
|
|
40
40
|
"neptune.UploadButton.dropFiles": "拖放文件开始上传",
|
|
41
41
|
"neptune.UploadButton.instructions": "{fileTypes},小于 {size} MB",
|
package/src/i18n/zh-HK.json
CHANGED
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"neptune.Upload.csButtonText": "上載另一個檔案?",
|
|
30
30
|
"neptune.Upload.csFailureText": "上載失敗,請重試。",
|
|
31
31
|
"neptune.Upload.csSuccessText": "上載完成!",
|
|
32
|
-
"neptune.Upload.csTooLargeMessage": "請提供小於
|
|
32
|
+
"neptune.Upload.csTooLargeMessage": "請提供小於{maxSize}MB的檔案",
|
|
33
33
|
"neptune.Upload.csWrongTypeMessage": "不支持檔案類型,請使用其他檔案重試",
|
|
34
34
|
"neptune.Upload.psButtonText": "取消",
|
|
35
35
|
"neptune.Upload.psProcessingText": "上載中...",
|
|
36
36
|
"neptune.Upload.usButtonText": "或者選擇一個檔案",
|
|
37
37
|
"neptune.Upload.usDropMessage": "拖放檔案以開始上載",
|
|
38
|
-
"neptune.Upload.usPlaceholder": "拖放不超過
|
|
38
|
+
"neptune.Upload.usPlaceholder": "拖放不超過{maxSize}MB的檔案",
|
|
39
39
|
"neptune.UploadButton.allFileTypes": "所有檔案類型",
|
|
40
40
|
"neptune.UploadButton.dropFiles": "拖放檔案以開始上載",
|
|
41
41
|
"neptune.UploadButton.instructions": "{fileTypes},小於{size}MB",
|
package/src/index.ts
CHANGED
|
@@ -28,7 +28,6 @@ export type { RadioGroupProps, RadioGroupRadio } from './radioGroup';
|
|
|
28
28
|
export type { RadioOptionProps } from './radioOption';
|
|
29
29
|
export type { SnackbarProps } from './snackbar/Snackbar';
|
|
30
30
|
export type { SnackbarContextType } from './snackbar/SnackbarContext';
|
|
31
|
-
export type { StickyProps } from './sticky';
|
|
32
31
|
export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
|
|
33
32
|
export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
|
|
34
33
|
export type { MarkdownProps } from './markdown';
|
|
@@ -39,7 +38,6 @@ export type {
|
|
|
39
38
|
CurrencyOptionItem,
|
|
40
39
|
MoneyInputProps,
|
|
41
40
|
} from './moneyInput';
|
|
42
|
-
export type { SlidingPanelProps } from './slidingPanel';
|
|
43
41
|
export type {
|
|
44
42
|
LayoutDirection,
|
|
45
43
|
TypographyTypes,
|
|
@@ -278,7 +278,7 @@ describe('Select', () => {
|
|
|
278
278
|
|
|
279
279
|
const bottomSheet = await screen.findByRole('dialog');
|
|
280
280
|
|
|
281
|
-
expect(bottomSheet).
|
|
281
|
+
expect(bottomSheet).toHaveClass('np-bottom-sheet');
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
it('show list of options in Drawer when on mobile and search in enabled', async () => {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { forwardRef, RefObject, useRef } from 'react';
|
|
4
|
+
import mergeRefs from 'react-merge-refs';
|
|
5
|
+
import { CSSTransition } from 'react-transition-group';
|
|
6
|
+
|
|
7
|
+
export const EXIT_ANIMATION = 350;
|
|
8
|
+
|
|
9
|
+
const SlidingPanel = forwardRef(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
open,
|
|
15
|
+
position,
|
|
16
|
+
showSlidingPanelBorder,
|
|
17
|
+
slidingPanelPositionFixed,
|
|
18
|
+
...rest
|
|
19
|
+
},
|
|
20
|
+
reference,
|
|
21
|
+
) => {
|
|
22
|
+
/** @type {RefObject<HTMLDivElement>} */
|
|
23
|
+
const localReference = useRef(null);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<CSSTransition
|
|
27
|
+
{...rest}
|
|
28
|
+
key={`sliding-panel--open-${position}`}
|
|
29
|
+
nodeRef={localReference}
|
|
30
|
+
in={open}
|
|
31
|
+
// Wait for animation to finish before unmount.
|
|
32
|
+
timeout={{ enter: 0, exit: EXIT_ANIMATION }}
|
|
33
|
+
classNames={classNames(
|
|
34
|
+
`sliding-panel--open-${position}`,
|
|
35
|
+
showSlidingPanelBorder && `sliding-panel--border-${position}`,
|
|
36
|
+
{
|
|
37
|
+
'sliding-panel--fixed': slidingPanelPositionFixed,
|
|
38
|
+
},
|
|
39
|
+
'sliding-panel',
|
|
40
|
+
)}
|
|
41
|
+
appear
|
|
42
|
+
unmountOnExit
|
|
43
|
+
>
|
|
44
|
+
<div
|
|
45
|
+
ref={mergeRefs([reference, localReference])}
|
|
46
|
+
className={classNames('sliding-panel', `sliding-panel--open-${position}`, className)}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
</CSSTransition>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
SlidingPanel.propTypes = {
|
|
56
|
+
children: PropTypes.node,
|
|
57
|
+
className: PropTypes.string,
|
|
58
|
+
open: PropTypes.bool,
|
|
59
|
+
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
60
|
+
showSlidingPanelBorder: PropTypes.bool,
|
|
61
|
+
slidingPanelPositionFixed: PropTypes.bool,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
SlidingPanel.defaultProps = {
|
|
65
|
+
children: null,
|
|
66
|
+
className: undefined,
|
|
67
|
+
open: false,
|
|
68
|
+
position: 'left',
|
|
69
|
+
showSlidingPanelBorder: false,
|
|
70
|
+
slidingPanelPositionFixed: false,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default SlidingPanel;
|
|
@@ -24,7 +24,17 @@ describe('SlidingPanel', () => {
|
|
|
24
24
|
|
|
25
25
|
expect(cssTransition()).toHaveLength(1);
|
|
26
26
|
|
|
27
|
-
expect(cssTransition().props()).
|
|
27
|
+
expect(cssTransition().props()).toMatchObject({
|
|
28
|
+
in: true,
|
|
29
|
+
appear: true,
|
|
30
|
+
timeout: {
|
|
31
|
+
enter: 0,
|
|
32
|
+
exit: EXIT_ANIMATION,
|
|
33
|
+
},
|
|
34
|
+
classNames: 'sliding-panel--open-left sliding-panel',
|
|
35
|
+
unmountOnExit: true,
|
|
36
|
+
});
|
|
37
|
+
expect(cssTransition().props().children.props).toStrictEqual({
|
|
28
38
|
className: 'sliding-panel sliding-panel--open-left',
|
|
29
39
|
children: null,
|
|
30
40
|
});
|
|
@@ -32,24 +42,24 @@ describe('SlidingPanel', () => {
|
|
|
32
42
|
|
|
33
43
|
it('adds fixed class', () => {
|
|
34
44
|
component = shallow(<SlidingPanel {...props} slidingPanelPositionFixed />);
|
|
35
|
-
expect(cssTransition().prop('
|
|
36
|
-
'sliding-panel
|
|
45
|
+
expect(cssTransition().prop('classNames')).toBe(
|
|
46
|
+
'sliding-panel--open-left sliding-panel--fixed sliding-panel',
|
|
37
47
|
);
|
|
38
48
|
});
|
|
39
49
|
|
|
40
50
|
it('adds border classes if showSlidingPanelBorder is set to true', () => {
|
|
41
51
|
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder />);
|
|
42
|
-
expect(cssTransition().prop('
|
|
43
|
-
'sliding-panel
|
|
52
|
+
expect(cssTransition().prop('classNames')).toBe(
|
|
53
|
+
'sliding-panel--open-left sliding-panel--border-left sliding-panel',
|
|
44
54
|
);
|
|
45
55
|
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder={false} position="left" />);
|
|
46
|
-
expect(cssTransition().prop('
|
|
56
|
+
expect(cssTransition().prop('classNames')).toBe('sliding-panel--open-left sliding-panel');
|
|
47
57
|
|
|
48
58
|
component = shallow(<SlidingPanel {...props} showSlidingPanelBorder position="top" />);
|
|
49
|
-
expect(cssTransition().prop('
|
|
50
|
-
'sliding-panel
|
|
59
|
+
expect(cssTransition().prop('classNames')).toBe(
|
|
60
|
+
'sliding-panel--open-top sliding-panel--border-top sliding-panel',
|
|
51
61
|
);
|
|
52
62
|
});
|
|
53
63
|
|
|
54
|
-
const cssTransition = () => component.find('
|
|
64
|
+
const cssTransition = () => component.find('CSSTransition');
|
|
55
65
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SlidingPanel';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
import SlidingPanel from '../slidingPanel';
|
|
4
|
+
|
|
5
|
+
const Sticky = ({ open, position, children }) => (
|
|
6
|
+
<SlidingPanel open={open} position={position} slidingPanelPositionFixed showSlidingPanelBorder>
|
|
7
|
+
{children}
|
|
8
|
+
</SlidingPanel>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
Sticky.propTypes = {
|
|
12
|
+
open: PropTypes.bool,
|
|
13
|
+
position: PropTypes.oneOf(['top', 'bottom']),
|
|
14
|
+
children: PropTypes.node,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Sticky.defaultProps = {
|
|
18
|
+
open: true,
|
|
19
|
+
position: 'bottom',
|
|
20
|
+
children: null,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default Sticky;
|
|
@@ -9,9 +9,10 @@ export default {
|
|
|
9
9
|
|
|
10
10
|
export const Basic = () => {
|
|
11
11
|
const open = boolean('open', false);
|
|
12
|
-
const position = select('position', ['top', 'bottom'], 'bottom');
|
|
12
|
+
const position = select('position', ['top', 'right', 'bottom', 'left'], 'bottom');
|
|
13
|
+
const fullParentWidth = boolean('fullParentWidth', true);
|
|
13
14
|
return (
|
|
14
|
-
<Sticky open={open} position={position}>
|
|
15
|
+
<Sticky open={open} position={position} fullParentWidth={fullParentWidth}>
|
|
15
16
|
<div className="d-flex justify-content-start align-items-start flex-wrap p-x-4 p-y-4">
|
|
16
17
|
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
|
|
17
18
|
been the industry standard dummy text ever since the 1500s, when an unknown printer took a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Sticky';
|
package/src/upload/Upload.js
CHANGED
|
@@ -47,7 +47,10 @@ class Upload extends Component {
|
|
|
47
47
|
switch (status) {
|
|
48
48
|
case 413:
|
|
49
49
|
return (
|
|
50
|
-
this.props.csTooLargeMessage ||
|
|
50
|
+
this.props.csTooLargeMessage ||
|
|
51
|
+
this.props.intl.formatMessage(messages.csTooLargeMessage, {
|
|
52
|
+
maxSize: this.props.maxSize / 1000000,
|
|
53
|
+
})
|
|
51
54
|
);
|
|
52
55
|
case 415:
|
|
53
56
|
return (
|
|
@@ -92,31 +95,26 @@ class Upload extends Component {
|
|
|
92
95
|
onAnimationCompleted = async (status) => {
|
|
93
96
|
const { response, isProcessing, fileName } = this.state;
|
|
94
97
|
// Success.
|
|
95
|
-
const { animationDelay } = this.props;
|
|
96
98
|
if (isProcessing && status === Status.SUCCEEDED) {
|
|
97
99
|
const { onSuccess } = this.props;
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
106
|
-
}, animationDelay);
|
|
100
|
+
this.setState(
|
|
101
|
+
{
|
|
102
|
+
isProcessing: false,
|
|
103
|
+
isComplete: true,
|
|
104
|
+
},
|
|
105
|
+
() => (onSuccess ? onSuccess(response, fileName) : {}),
|
|
106
|
+
);
|
|
107
107
|
}
|
|
108
108
|
// Failure.
|
|
109
109
|
if (isProcessing && status === Status.FAILED) {
|
|
110
110
|
const { onFailure } = this.props;
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
}, animationDelay);
|
|
111
|
+
this.setState(
|
|
112
|
+
{
|
|
113
|
+
isProcessing: false,
|
|
114
|
+
isComplete: true,
|
|
115
|
+
},
|
|
116
|
+
() => (onFailure ? onFailure(response) : {}),
|
|
117
|
+
);
|
|
120
118
|
}
|
|
121
119
|
};
|
|
122
120
|
|
|
@@ -312,7 +310,10 @@ class Upload extends Component {
|
|
|
312
310
|
usDisabled={usDisabled}
|
|
313
311
|
usHelpImage={usHelpImage}
|
|
314
312
|
usLabel={usLabel}
|
|
315
|
-
usPlaceholder={
|
|
313
|
+
usPlaceholder={
|
|
314
|
+
usPlaceholder ||
|
|
315
|
+
intl.formatMessage(messages.usPlaceholder, { maxSize: this.props.maxSize / 1000000 })
|
|
316
|
+
}
|
|
316
317
|
/>
|
|
317
318
|
)}
|
|
318
319
|
|
|
@@ -403,7 +404,7 @@ Upload.propTypes = {
|
|
|
403
404
|
};
|
|
404
405
|
|
|
405
406
|
Upload.defaultProps = {
|
|
406
|
-
animationDelay:
|
|
407
|
+
animationDelay: 0,
|
|
407
408
|
csButtonText: undefined,
|
|
408
409
|
csFailureText: undefined,
|
|
409
410
|
csSuccessText: undefined,
|
|
@@ -15,7 +15,7 @@ export default defineMessages({
|
|
|
15
15
|
},
|
|
16
16
|
csTooLargeMessage: {
|
|
17
17
|
id: 'neptune.Upload.csTooLargeMessage',
|
|
18
|
-
defaultMessage: 'Please provide a file smaller than
|
|
18
|
+
defaultMessage: 'Please provide a file smaller than {maxSize}MB',
|
|
19
19
|
},
|
|
20
20
|
csWrongTypeMessage: {
|
|
21
21
|
id: 'neptune.Upload.csWrongTypeMessage',
|
|
@@ -39,6 +39,6 @@ export default defineMessages({
|
|
|
39
39
|
},
|
|
40
40
|
usPlaceholder: {
|
|
41
41
|
id: 'neptune.Upload.usPlaceholder',
|
|
42
|
-
defaultMessage: 'Drag and drop a file less than
|
|
42
|
+
defaultMessage: 'Drag and drop a file less than {maxSize}MB',
|
|
43
43
|
},
|
|
44
44
|
});
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
export const Basic = () => {
|
|
12
12
|
const size = select('size', ['sm', 'md', 'lg'], 'md');
|
|
13
|
-
const maxSize = number('max file size',
|
|
13
|
+
const maxSize = number('max file size', 4000000);
|
|
14
14
|
const usAccept = text('accepted format', '*');
|
|
15
15
|
const usDisabled = boolean('disabled', false);
|
|
16
16
|
const psButtonDisabled = boolean('psButtonDisabled', false);
|
|
@@ -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
|
-
|
|
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 && (
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { forwardRef, useRef } from 'react';
|
|
3
|
-
import mergeRefs from 'react-merge-refs';
|
|
4
|
-
import { CSSTransition } from 'react-transition-group';
|
|
5
|
-
|
|
6
|
-
import { Position } from '../common';
|
|
7
|
-
|
|
8
|
-
export const EXIT_ANIMATION = 350;
|
|
9
|
-
|
|
10
|
-
export interface SlidingPanelProps
|
|
11
|
-
extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {
|
|
12
|
-
position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;
|
|
13
|
-
open: boolean;
|
|
14
|
-
showSlidingPanelBorder?: boolean;
|
|
15
|
-
slidingPanelPositionFixed?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const SlidingPanel = forwardRef(
|
|
19
|
-
(
|
|
20
|
-
{
|
|
21
|
-
position = 'left',
|
|
22
|
-
open,
|
|
23
|
-
showSlidingPanelBorder,
|
|
24
|
-
slidingPanelPositionFixed,
|
|
25
|
-
className,
|
|
26
|
-
children,
|
|
27
|
-
...rest
|
|
28
|
-
}: Omit<SlidingPanelProps, 'ref'>,
|
|
29
|
-
reference: React.ForwardedRef<HTMLDivElement>,
|
|
30
|
-
) => {
|
|
31
|
-
const localReference = useRef<HTMLDivElement>(null);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<CSSTransition
|
|
35
|
-
{...rest}
|
|
36
|
-
key={`sliding-panel--open-${position}`}
|
|
37
|
-
nodeRef={localReference}
|
|
38
|
-
in={open}
|
|
39
|
-
// Wait for animation to finish before unmount.
|
|
40
|
-
timeout={{ enter: 0, exit: EXIT_ANIMATION }}
|
|
41
|
-
classNames="sliding-panel"
|
|
42
|
-
appear
|
|
43
|
-
unmountOnExit
|
|
44
|
-
>
|
|
45
|
-
<div
|
|
46
|
-
ref={mergeRefs([reference, localReference])}
|
|
47
|
-
className={classNames(
|
|
48
|
-
'sliding-panel',
|
|
49
|
-
`sliding-panel--open-${position}`,
|
|
50
|
-
showSlidingPanelBorder && `sliding-panel--border-${position}`,
|
|
51
|
-
slidingPanelPositionFixed && 'sliding-panel--fixed',
|
|
52
|
-
className,
|
|
53
|
-
)}
|
|
54
|
-
>
|
|
55
|
-
{children}
|
|
56
|
-
</div>
|
|
57
|
-
</CSSTransition>
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
export default SlidingPanel;
|
package/src/sticky/Sticky.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Position } from '../common';
|
|
2
|
-
import SlidingPanel from '../slidingPanel';
|
|
3
|
-
|
|
4
|
-
export interface StickyProps {
|
|
5
|
-
open?: boolean;
|
|
6
|
-
position?: `${Position.TOP | Position.BOTTOM}`;
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function Sticky({ open = true, position = 'bottom', children }: StickyProps) {
|
|
11
|
-
return (
|
|
12
|
-
<SlidingPanel open={open} position={position} slidingPanelPositionFixed showSlidingPanelBorder>
|
|
13
|
-
{children}
|
|
14
|
-
</SlidingPanel>
|
|
15
|
-
);
|
|
16
|
-
}
|
package/src/sticky/index.ts
DELETED
|
File without changes
|