@groupeactual/ui-kit 1.7.0-beta.4 → 1.7.0-beta.5
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/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.ts +23 -67
- package/dist/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/es/src/components/UploadDocument/FileUploader.d.ts +25 -0
- package/dist/es/src/components/UploadDocument/fileuploader.interface.d.ts +19 -0
- package/dist/es/src/components/UploadDocument/index.d.ts +1 -1
- package/dist/es/src/components/index.d.ts +2 -1
- package/package.json +3 -2
- package/src/components/Form/Checkbox/Checkbox.tsx +1 -1
- package/src/components/UploadDocument/FileUploader.tsx +690 -0
- package/src/components/UploadDocument/fileuploader.interface.ts +21 -0
- package/src/components/UploadDocument/index.ts +1 -1
- package/src/components/index.ts +5 -1
- package/dist/es/src/components/UploadDocument/FileUploaderSingle.d.ts +0 -77
- package/dist/es/src/components/UploadDocument/fileuploadersingle.interface.d.ts +0 -5
- package/src/components/UploadDocument/FileUploaderSingle.tsx +0 -661
- package/src/components/UploadDocument/fileuploadersingle.interface.ts +0 -5
package/src/components/index.ts
CHANGED
|
@@ -17,7 +17,11 @@ export { default as EmbeddedNotification } from './EmbbededNotification/Embedded
|
|
|
17
17
|
export { default as Tooltip } from './Tooltip/Tooltip';
|
|
18
18
|
export { default as AutoCompleteSingle } from './Form/AutoCompleteSingle';
|
|
19
19
|
export { default as AutoCompleteMulti } from './Form/AutoCompleteMulti';
|
|
20
|
-
export { default as
|
|
20
|
+
export { default as FileUploader } from './UploadDocument/FileUploader';
|
|
21
|
+
export type {
|
|
22
|
+
AcceptTextType,
|
|
23
|
+
FileDataType,
|
|
24
|
+
} from './UploadDocument/fileuploader.interface';
|
|
21
25
|
export { default as MenuItem } from './MenuItem/MenuItem';
|
|
22
26
|
export { default as Snackbar } from './Snackbar/Snackbar';
|
|
23
27
|
export { default as NotistackAdapter } from './NotistackAdapter/NotistackAdapter';
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { acceptText } from './fileuploadersingle.interface';
|
|
3
|
-
export interface Props {
|
|
4
|
-
setFile: (_file: File | null) => void;
|
|
5
|
-
title?: string;
|
|
6
|
-
titleTooltip?: string;
|
|
7
|
-
enableGoogleDrive?: boolean;
|
|
8
|
-
googleAuthClientId?: string;
|
|
9
|
-
googleApiKey?: string;
|
|
10
|
-
error?: boolean;
|
|
11
|
-
helperText?: string;
|
|
12
|
-
fileUrl?: string | null;
|
|
13
|
-
fileName?: string | null;
|
|
14
|
-
accept?: string[];
|
|
15
|
-
acceptText?: acceptText;
|
|
16
|
-
disabledInput?: boolean;
|
|
17
|
-
children?: JSX.Element | null;
|
|
18
|
-
titleAddButton?: string;
|
|
19
|
-
_isDroppingFile?: boolean;
|
|
20
|
-
validateFile?: (_size: number, _type: string, _accept: string[], _setUploadFileError: React.Dispatch<React.SetStateAction<boolean | string>>) => boolean;
|
|
21
|
-
removeExistingFile?: () => void;
|
|
22
|
-
onTouched?: () => void;
|
|
23
|
-
onFileDataChange?: (_fileData: {
|
|
24
|
-
name: string;
|
|
25
|
-
size: number;
|
|
26
|
-
type?: string;
|
|
27
|
-
driveFileId?: string;
|
|
28
|
-
driveAccessToken?: string;
|
|
29
|
-
} | null) => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* A single file uploader component that supports file selection from local storage or Google Drive.
|
|
33
|
-
*
|
|
34
|
-
* @param {string[]} accept - Array of accepted file types, will display acceptText message
|
|
35
|
-
* but not verify size or type of your file.
|
|
36
|
-
*
|
|
37
|
-
* Example:
|
|
38
|
-
* ```js
|
|
39
|
-
* accept={[
|
|
40
|
-
'application/pdf',
|
|
41
|
-
'image/png',
|
|
42
|
-
'image/jpeg',
|
|
43
|
-
'image/jpg',
|
|
44
|
-
]}
|
|
45
|
-
* ```
|
|
46
|
-
* @param {Object} acceptText - Object containing text for accepted file format, max size, and additional subtext.
|
|
47
|
-
*
|
|
48
|
-
* Example:
|
|
49
|
-
* ```js
|
|
50
|
-
* acceptText={{
|
|
51
|
-
maxSize: '10 Mo',
|
|
52
|
-
subText: 'Sélectionnez un fichier',
|
|
53
|
-
}}
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @param {Function} validateFile - Function to validate the file size and type.
|
|
57
|
-
*
|
|
58
|
-
* Example:
|
|
59
|
-
* ```js
|
|
60
|
-
* validateFile={(size, type, accept, setUploadFileError) => {
|
|
61
|
-
* if (size > 10 * 1024 * 1024) {
|
|
62
|
-
* setUploadFileError('Le fichier doit être inférieur à 10 Mo');
|
|
63
|
-
* return true;
|
|
64
|
-
* }
|
|
65
|
-
* if (!accept.includes(type)) {
|
|
66
|
-
* setUploadFileError('Le fichier doit être au format PDF, PNG, JPEG ou JPG');
|
|
67
|
-
* return true;
|
|
68
|
-
* }
|
|
69
|
-
* return false;
|
|
70
|
-
* }}
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @param {Function} onFileDataChange - Callback function to handle file data changes and give you all informations you need
|
|
74
|
-
* to handle google drive file.
|
|
75
|
-
*/
|
|
76
|
-
declare const FileUploaderSingle: ({ enableGoogleDrive, googleAuthClientId, googleApiKey, error, helperText, accept, acceptText, title, titleTooltip, disabledInput, children, fileUrl, fileName, titleAddButton, _isDroppingFile, validateFile, setFile, removeExistingFile, onTouched, onFileDataChange, }: Props) => React.JSX.Element;
|
|
77
|
-
export default FileUploaderSingle;
|