@popsure/dirty-swan 0.27.9 → 0.27.11
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/dist/index.js +27713 -3872
- package/dist/index.js.map +1 -1
- package/dist/lib/components/multiDropzone/index.d.ts +3 -2
- package/dist/lib/index.d.ts +2 -1
- package/package.json +3 -2
- package/src/lib/components/multiDropzone/index.tsx +21 -7
- package/src/lib/index.tsx +3 -1
|
@@ -10,11 +10,12 @@ export interface UploadedFile {
|
|
|
10
10
|
error?: string;
|
|
11
11
|
}
|
|
12
12
|
interface Props {
|
|
13
|
-
onFileSelect: (
|
|
13
|
+
onFileSelect: (files: File[]) => void;
|
|
14
14
|
uploadedFiles: UploadedFile[];
|
|
15
15
|
uploading: boolean;
|
|
16
16
|
onRemoveFile: (id: string) => void;
|
|
17
17
|
isCondensed?: boolean;
|
|
18
|
+
maxFiles?: number;
|
|
18
19
|
}
|
|
19
|
-
declare const _default: ({ uploadedFiles, onFileSelect, uploading, onRemoveFile, isCondensed, }: Props) => JSX.Element;
|
|
20
|
+
declare const _default: ({ uploadedFiles, onFileSelect, uploading, onRemoveFile, isCondensed, maxFiles, }: Props) => JSX.Element;
|
|
20
21
|
export default _default;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ import Chip from './components/chip';
|
|
|
16
16
|
import AutoSuggestInput from './components/input/autoSuggestInput';
|
|
17
17
|
import { ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableInfoButton, TableHeader } from './components/comparisonTable';
|
|
18
18
|
import SegmentedControl from './components/segmentedControl';
|
|
19
|
-
|
|
19
|
+
import Markdown from './components/markdown';
|
|
20
|
+
export { DateSelector, Dropzone, SignaturePad, AutocompleteAddress, Input, MultiDropzone, DownloadRing, DownloadButton, IbanInput, BottomModal, RegularModal, BottomOrRegularModal, CardWithTopLeftIcon, CardWithLeftIcon, CardWithTopIcon, InfoCard, CardButton, Button, CurrencyInput, AutoSuggestMultiSelect, Chip, AutoSuggestInput, ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableInfoButton, SegmentedControl, Markdown, };
|
|
20
21
|
export type { TableHeader };
|
|
21
22
|
export type { DownloadRingDownloadStatus } from './models/downloadRing';
|
|
22
23
|
export type { DownloadStatus } from './models/download';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popsure/dirty-swan",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.11",
|
|
4
4
|
"author": "Vincent Audoire <vincent@getpopsure.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
"hastscript": "^7.0.2",
|
|
27
27
|
"lodash.debounce": "^4.0.8",
|
|
28
28
|
"lodash.isequal": "^4.5.0",
|
|
29
|
+
"react-animate-height": "^3.0.4",
|
|
29
30
|
"react-autosuggest": "^10.1.0",
|
|
30
31
|
"react-day-picker": "^7.4.10",
|
|
31
|
-
"react-dropzone": "^
|
|
32
|
+
"react-dropzone": "^14.2.2",
|
|
32
33
|
"react-markdown": "^8.0.3",
|
|
33
34
|
"react-scroll-sync": "^0.9.0",
|
|
34
35
|
"remark-directive": "^2.0.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useDropzone } from 'react-dropzone';
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useDropzone, FileRejection } from 'react-dropzone';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
|
|
4
|
+
import AnimateHeight from 'react-animate-height';
|
|
5
5
|
import styles from './style.module.scss';
|
|
6
6
|
import icons from './icons/index'; // TODO: inline all of the svgs
|
|
7
7
|
import UploadFileCell from './UploadFileCell';
|
|
@@ -40,11 +40,12 @@ export interface UploadedFile {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
interface Props {
|
|
43
|
-
onFileSelect: (
|
|
43
|
+
onFileSelect: (files: File[]) => void;
|
|
44
44
|
uploadedFiles: UploadedFile[];
|
|
45
45
|
uploading: boolean;
|
|
46
46
|
onRemoveFile: (id: string) => void;
|
|
47
47
|
isCondensed?: boolean;
|
|
48
|
+
maxFiles?: number;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
export default ({
|
|
@@ -53,15 +54,25 @@ export default ({
|
|
|
53
54
|
uploading,
|
|
54
55
|
onRemoveFile,
|
|
55
56
|
isCondensed = false,
|
|
57
|
+
maxFiles = 0,
|
|
56
58
|
}: Props) => {
|
|
59
|
+
const [error, setError] = useState('');
|
|
60
|
+
|
|
57
61
|
const onDrop = useCallback(
|
|
58
|
-
(acceptedFiles) => {
|
|
59
|
-
|
|
62
|
+
(acceptedFiles: File[], filesRejected: FileRejection[]) => {
|
|
63
|
+
setError('');
|
|
64
|
+
|
|
65
|
+
if (filesRejected.length > 0) {
|
|
66
|
+
setError(filesRejected[0].errors[0].message);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onFileSelect(acceptedFiles);
|
|
60
71
|
},
|
|
61
72
|
[onFileSelect]
|
|
62
73
|
);
|
|
63
74
|
|
|
64
|
-
const { getRootProps, getInputProps } = useDropzone({ onDrop });
|
|
75
|
+
const { getRootProps, getInputProps } = useDropzone({ onDrop, maxFiles });
|
|
65
76
|
|
|
66
77
|
return (
|
|
67
78
|
<div className={styles.container}>
|
|
@@ -87,6 +98,9 @@ export default ({
|
|
|
87
98
|
</div>
|
|
88
99
|
<div className="p-p--small tc-grey-500">Supports JPEG, PNG, PDF</div>
|
|
89
100
|
</div>
|
|
101
|
+
<AnimateHeight duration={300} height={error ? 'auto' : 0}>
|
|
102
|
+
<p className="tc-red-500 p-p--small">{error}</p>
|
|
103
|
+
</AnimateHeight>
|
|
90
104
|
{uploadedFiles.length > 0 && (
|
|
91
105
|
<div className="w100 mt16">
|
|
92
106
|
{uploadedFiles.map((file) => {
|
package/src/lib/index.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
TableHeader,
|
|
34
34
|
} from './components/comparisonTable';
|
|
35
35
|
import SegmentedControl from './components/segmentedControl';
|
|
36
|
+
import Markdown from './components/markdown';
|
|
36
37
|
|
|
37
38
|
export {
|
|
38
39
|
DateSelector,
|
|
@@ -63,9 +64,10 @@ export {
|
|
|
63
64
|
TableRowHeader,
|
|
64
65
|
TableInfoButton,
|
|
65
66
|
SegmentedControl,
|
|
67
|
+
Markdown,
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
export type { TableHeader };
|
|
69
71
|
|
|
70
72
|
export type { DownloadRingDownloadStatus } from './models/downloadRing';
|
|
71
|
-
export type { DownloadStatus } from './models/download'
|
|
73
|
+
export type { DownloadStatus } from './models/download';
|