@delightui/components 0.1.157 → 0.1.158
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/components/organisms/Dropzone/Dropzone.presenter.d.ts +1 -1
- package/dist/cjs/components/organisms/Dropzone/Dropzone.types.d.ts +40 -1
- package/dist/cjs/components/organisms/Dropzone/index.d.ts +2 -2
- package/dist/cjs/components/organisms/Form/DropzoneFormExample.d.ts +4 -0
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/organisms/Dropzone/Dropzone.presenter.d.ts +1 -1
- package/dist/esm/components/organisms/Dropzone/Dropzone.types.d.ts +40 -1
- package/dist/esm/components/organisms/Dropzone/index.d.ts +2 -2
- package/dist/esm/components/organisms/Form/DropzoneFormExample.d.ts +4 -0
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +41 -2
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ declare const usePresenter: <T extends File | string = File>(props: DropzoneProp
|
|
|
16
16
|
accept: {
|
|
17
17
|
[key: string]: readonly string[];
|
|
18
18
|
} | undefined;
|
|
19
|
-
resetFiles: () => void
|
|
19
|
+
resetFiles: () => Promise<void>;
|
|
20
20
|
id: string | undefined;
|
|
21
21
|
isDragActive: boolean;
|
|
22
22
|
contextValue: DropzoneContextType<T>;
|
|
@@ -3,6 +3,15 @@ import { ButtonProps, IconButtonProps, TextProps } from '../../atoms';
|
|
|
3
3
|
import { ControlledFormComponentProps } from '../../molecules/FormField/FormField.types';
|
|
4
4
|
export type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
|
|
5
5
|
export type DropzoneAcceptTypeEnum = 'File' | 'URL';
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for uploaded files in URL mode
|
|
8
|
+
*/
|
|
9
|
+
export type UploadedFileMetadata = {
|
|
10
|
+
url: string;
|
|
11
|
+
filename: string;
|
|
12
|
+
size?: number;
|
|
13
|
+
mimetype?: string;
|
|
14
|
+
};
|
|
6
15
|
/**
|
|
7
16
|
* Dropzone component props
|
|
8
17
|
* @param empty React.ReactNode - The empty state of the dropzone.
|
|
@@ -67,6 +76,25 @@ export type DropzoneProps<T extends File | string = File> = ControlledFormCompon
|
|
|
67
76
|
* @default 'File'
|
|
68
77
|
*/
|
|
69
78
|
type?: 'File' | 'URL';
|
|
79
|
+
/**
|
|
80
|
+
* Async callback for uploading files and returning URLs (URL mode only)
|
|
81
|
+
* @param files The files to upload
|
|
82
|
+
* @returns Promise resolving to array of uploaded file URLs
|
|
83
|
+
*/
|
|
84
|
+
onUpload?: (files: File[]) => Promise<string[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Callback when files are deleted/cleared
|
|
87
|
+
* @param value The current value being deleted
|
|
88
|
+
* @returns Promise or void
|
|
89
|
+
*/
|
|
90
|
+
onDelete?: (value: T[]) => Promise<void> | void;
|
|
91
|
+
/**
|
|
92
|
+
* Function to resolve metadata from URLs (URL mode only)
|
|
93
|
+
* Used when loading existing URLs to get display metadata
|
|
94
|
+
* @param urls Array of URLs to resolve metadata for
|
|
95
|
+
* @returns Promise or array of metadata objects
|
|
96
|
+
*/
|
|
97
|
+
resolveMetadata?: (urls: string[]) => Promise<UploadedFileMetadata[]> | UploadedFileMetadata[];
|
|
70
98
|
};
|
|
71
99
|
/**
|
|
72
100
|
* Dropzone context type
|
|
@@ -81,7 +109,11 @@ export type DropzoneContextType<T extends File | string = File> = {
|
|
|
81
109
|
*/
|
|
82
110
|
status: DropzoneStatus;
|
|
83
111
|
/**
|
|
84
|
-
* The
|
|
112
|
+
* The type of the dropzone (File or URL mode).
|
|
113
|
+
*/
|
|
114
|
+
type: 'File' | 'URL';
|
|
115
|
+
/**
|
|
116
|
+
* The files of the dropzone (raw File objects from user selection).
|
|
85
117
|
*/
|
|
86
118
|
files: File[];
|
|
87
119
|
/**
|
|
@@ -94,7 +126,14 @@ export type DropzoneContextType<T extends File | string = File> = {
|
|
|
94
126
|
accept: {
|
|
95
127
|
[key: string]: readonly string[];
|
|
96
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The form value (File[] in File mode, string[] in URL mode).
|
|
131
|
+
*/
|
|
97
132
|
value?: T[];
|
|
133
|
+
/**
|
|
134
|
+
* Metadata for uploaded files (primarily used in URL mode for display).
|
|
135
|
+
*/
|
|
136
|
+
metadata?: UploadedFileMetadata[];
|
|
98
137
|
/**
|
|
99
138
|
* The function to call to open the file dialog.
|
|
100
139
|
*/
|
|
@@ -4,7 +4,7 @@ import DropzoneFilename from "./components/DropzoneFilename";
|
|
|
4
4
|
import DropzoneSupportedFormats from "./components/DropzoneSupportedFormats";
|
|
5
5
|
import DropzoneTrigger from "./components/DropzoneTrigger";
|
|
6
6
|
import { useDropzoneContext } from "./Dropzone";
|
|
7
|
-
import type { DropzoneProps } from './Dropzone.types';
|
|
7
|
+
import type { DropzoneProps, UploadedFileMetadata } from './Dropzone.types';
|
|
8
8
|
export default Dropzone;
|
|
9
9
|
export { DropzoneClear, DropzoneFilename, DropzoneSupportedFormats, DropzoneTrigger, useDropzoneContext };
|
|
10
|
-
export type { DropzoneProps };
|
|
10
|
+
export type { DropzoneProps, UploadedFileMetadata };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
declare const DropzoneFileModeExample: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const DropzoneURLModeExample: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const DropzoneURLModeWithMetadataExample: () => import("react/jsx-runtime").JSX.Element;
|
|
1
4
|
declare const DropzoneFormExample: () => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default DropzoneFormExample;
|
|
6
|
+
export { DropzoneFileModeExample, DropzoneURLModeExample, DropzoneURLModeWithMetadataExample };
|