@lax-wp/design-system 0.4.9 → 0.4.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/components/forms/multi-file-upload/MultiFileUpload.d.ts +35 -84
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +932 -988
- package/dist/index.umd.js +26 -26
- package/package.json +1 -1
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* File upload result interface
|
|
3
|
-
*/
|
|
4
|
-
export interface FileUploadResult {
|
|
5
|
-
filename: string;
|
|
6
|
-
content?: string;
|
|
7
|
-
fileUrl?: string;
|
|
8
|
-
fileName?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Union type for file change callback parameter
|
|
12
|
-
*/
|
|
13
|
-
export type FileChangeValue = File | File[] | FileUploadResult | FileUploadResult[] | string | string[] | null;
|
|
1
|
+
import { type FC } from 'react';
|
|
14
2
|
/**
|
|
15
3
|
* File upload service interface
|
|
16
4
|
*/
|
|
@@ -22,92 +10,55 @@ export interface FileUploadService {
|
|
|
22
10
|
deleteFileFromFileServer: (fileName: string, queryParams: string) => Promise<void>;
|
|
23
11
|
}
|
|
24
12
|
/**
|
|
25
|
-
*
|
|
13
|
+
* System messages interface
|
|
26
14
|
*/
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
export interface SystemMessages {
|
|
16
|
+
fileSizeLimit: (size: string, unit: string) => string;
|
|
17
|
+
}
|
|
18
|
+
export type MultiFileUploadProps = {
|
|
19
|
+
/** Callback to receive the uploaded file */
|
|
20
|
+
getFile: (file: any, fileName?: string) => any;
|
|
21
|
+
/** Description text to display */
|
|
33
22
|
description?: string;
|
|
34
23
|
/** Error message to display */
|
|
35
24
|
errorMessage?: string;
|
|
36
25
|
/** Whether the upload is disabled */
|
|
37
26
|
disabled?: boolean;
|
|
38
27
|
/** Default file to display */
|
|
39
|
-
defaultFile?:
|
|
40
|
-
/** Accepted file types
|
|
28
|
+
defaultFile?: any;
|
|
29
|
+
/** Accepted file types */
|
|
41
30
|
acceptedFiles?: string;
|
|
42
|
-
/** Whether
|
|
31
|
+
/** Whether loading state is active */
|
|
43
32
|
isLoading?: boolean;
|
|
44
|
-
/**
|
|
33
|
+
/** Convert file to base64 */
|
|
45
34
|
asBase64?: boolean;
|
|
46
|
-
/**
|
|
35
|
+
/** Upload to file server */
|
|
47
36
|
toFileServer?: boolean;
|
|
48
|
-
/** Whether
|
|
37
|
+
/** Whether file is currently uploading */
|
|
49
38
|
fileUploading?: boolean;
|
|
50
39
|
/** Callback to set file uploading state */
|
|
51
|
-
setFileUploading?: (fileUploading: boolean
|
|
52
|
-
/**
|
|
40
|
+
setFileUploading?: (fileUploading: boolean) => void;
|
|
41
|
+
/** Upload to document server path */
|
|
53
42
|
uploadToDocServer?: boolean;
|
|
54
|
-
/**
|
|
43
|
+
/** Unique identifier for the upload */
|
|
44
|
+
id?: string;
|
|
45
|
+
/** Allow multiple file uploads */
|
|
55
46
|
multiple?: boolean;
|
|
56
|
-
/**
|
|
47
|
+
/** Get original file name */
|
|
57
48
|
getRealFileName?: boolean;
|
|
58
|
-
/**
|
|
49
|
+
/** Callback when file is deleted */
|
|
50
|
+
onDelete?: () => void;
|
|
51
|
+
/** Maximum file size in bytes */
|
|
59
52
|
maxSize?: number;
|
|
60
|
-
/** File upload service
|
|
53
|
+
/** File upload service */
|
|
61
54
|
fileUploadService?: FileUploadService;
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/** Custom file size formatter */
|
|
73
|
-
formatFileSize?: (size: number) => string;
|
|
74
|
-
/** Custom click to upload text */
|
|
75
|
-
clickToUploadText?: string;
|
|
76
|
-
/** Custom drag and drop text */
|
|
77
|
-
dragAndDropText?: string;
|
|
78
|
-
/** Callback when file size exceeds limit */
|
|
79
|
-
onFileSizeError?: (maxSizeMB: number) => void;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A highly customizable multi-file upload component with drag-and-drop support.
|
|
83
|
-
* Features file validation, base64 conversion, server upload, and comprehensive styling options.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* // Using with fileUploadService (recommended for server uploads)
|
|
87
|
-
* ```tsx
|
|
88
|
-
* <MultiFileUpload
|
|
89
|
-
* id="file-upload"
|
|
90
|
-
* description="Upload your documents"
|
|
91
|
-
* onFileChange={(files) => console.log(files)}
|
|
92
|
-
* toFileServer
|
|
93
|
-
* fileUploadService={attachmentServices}
|
|
94
|
-
* multiple
|
|
95
|
-
* maxSize={10 * 1024 * 1024} // 10MB
|
|
96
|
-
* />
|
|
97
|
-
* ```
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* // Using with custom onUpload handler
|
|
101
|
-
* ```tsx
|
|
102
|
-
* <MultiFileUpload
|
|
103
|
-
* id="file-upload"
|
|
104
|
-
* onFileChange={(files) => console.log(files)}
|
|
105
|
-
* toFileServer
|
|
106
|
-
* onUpload={async (files) => {
|
|
107
|
-
* // Custom upload logic
|
|
108
|
-
* return files.map(f => ({ filename: f.name, fileUrl: 'url' }));
|
|
109
|
-
* }}
|
|
110
|
-
* />
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare const MultiFileUpload: import("react").ForwardRefExoticComponent<MultiFileUploadProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
+
/** System messages for error handling */
|
|
56
|
+
systemMessages?: SystemMessages;
|
|
57
|
+
/** Toast function for displaying errors */
|
|
58
|
+
toast?: {
|
|
59
|
+
error: (message: string, options?: {
|
|
60
|
+
toastId?: string;
|
|
61
|
+
}) => void;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const MultiFileUpload: FC<MultiFileUploadProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export type { TToggleDirection } from "./constants/toggle";
|
|
|
45
45
|
export { MdInput } from "./components/forms/md-input/MdInput";
|
|
46
46
|
export type { MdInputProps } from "./components/forms/md-input/MdInput";
|
|
47
47
|
export { MultiFileUpload } from "./components/forms/multi-file-upload/MultiFileUpload";
|
|
48
|
-
export type { MultiFileUploadProps,
|
|
48
|
+
export type { MultiFileUploadProps, FileUploadService as MultiFileUploadService, SystemMessages as MultiFileUploadSystemMessages, } from "./components/forms/multi-file-upload/MultiFileUpload";
|
|
49
49
|
export { IconPicker, IconRenderer } from "./components/forms/icon-picker/IconPicker";
|
|
50
50
|
export type { IconPickerContentProps } from "./components/forms/icon-picker/IconPicker";
|
|
51
51
|
export { StatusColorMapping } from "./components/data-display/status-color-mapping/StatusColorMapping";
|