@delightui/components 0.1.150 → 0.1.151
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.d.ts +2 -2
- package/dist/cjs/components/organisms/Dropzone/Dropzone.presenter.d.ts +5 -4
- package/dist/cjs/components/organisms/Dropzone/Dropzone.types.d.ts +16 -2
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/organisms/Dropzone/Dropzone.d.ts +2 -2
- package/dist/esm/components/organisms/Dropzone/Dropzone.presenter.d.ts +5 -4
- package/dist/esm/components/organisms/Dropzone/Dropzone.types.d.ts +16 -2
- package/dist/esm/library.js +1 -1
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +17 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DropzoneContextType, DropzoneProps } from './Dropzone.types';
|
|
2
|
-
declare const Dropzone: (props: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare const useDropzoneContext: () => DropzoneContextType
|
|
2
|
+
declare const Dropzone: <T extends File | string = File>(props: DropzoneProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const useDropzoneContext: <T extends File | string = File>() => DropzoneContextType<T>;
|
|
4
4
|
export default Dropzone;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DropzoneProps, DropzoneStatus } from './Dropzone.types';
|
|
2
|
-
declare const usePresenter: (props: DropzoneProps) => {
|
|
2
|
+
declare const usePresenter: <T extends File | string = File>(props: DropzoneProps<T>) => {
|
|
3
3
|
variantProps: {
|
|
4
4
|
'component-variant': string;
|
|
5
5
|
};
|
|
6
|
-
files:
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
files: T[] | undefined;
|
|
7
|
+
userSelectedFiles: File[] | undefined;
|
|
8
|
+
getRootProps: <T_1 extends import("react-dropzone").DropzoneRootProps>(props?: T_1) => T_1;
|
|
9
|
+
getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1) => T_1;
|
|
9
10
|
open: () => void;
|
|
10
11
|
empty: import("react").ReactNode;
|
|
11
12
|
loading: import("react").ReactNode;
|
|
@@ -2,6 +2,7 @@ import { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
import { ButtonProps, IconButtonProps, TextProps } from '../../atoms';
|
|
3
3
|
import { ControlledFormComponentProps } from '../../molecules/FormField/FormField.types';
|
|
4
4
|
export type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
|
|
5
|
+
export type DropzoneAcceptTypeEnum = 'File' | 'URL';
|
|
5
6
|
/**
|
|
6
7
|
* Dropzone component props
|
|
7
8
|
* @param empty React.ReactNode - The empty state of the dropzone.
|
|
@@ -13,7 +14,7 @@ export type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
|
|
|
13
14
|
* @param onFilesUpload (file: File) => void - callback when files are selected
|
|
14
15
|
* @param onFilesReset () => void - callback when files are reset
|
|
15
16
|
*/
|
|
16
|
-
export type DropzoneProps = ControlledFormComponentProps<
|
|
17
|
+
export type DropzoneProps<T extends File | string = File> = ControlledFormComponentProps<T[]> & {
|
|
17
18
|
className?: string;
|
|
18
19
|
/**
|
|
19
20
|
* the view when no file is selected.
|
|
@@ -54,6 +55,18 @@ export type DropzoneProps = ControlledFormComponentProps<File[]> & {
|
|
|
54
55
|
* callback when files are reset
|
|
55
56
|
*/
|
|
56
57
|
onFilesReset?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Callback when files are changed for dropzone
|
|
60
|
+
* @param Files updated selected files by user
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
handleFilesChange?: (Files: File[]) => void;
|
|
64
|
+
/**
|
|
65
|
+
* specifies what the component needs to accept as value
|
|
66
|
+
* sync this with Dropzone generics
|
|
67
|
+
* @default 'File'
|
|
68
|
+
*/
|
|
69
|
+
type?: 'File' | 'URL';
|
|
57
70
|
};
|
|
58
71
|
/**
|
|
59
72
|
* Dropzone context type
|
|
@@ -62,7 +75,7 @@ export type DropzoneProps = ControlledFormComponentProps<File[]> & {
|
|
|
62
75
|
* @param selectFile () => void - The function to call when the file is selected.
|
|
63
76
|
* @param resetUpload () => void - The function to call when the file is reset.
|
|
64
77
|
*/
|
|
65
|
-
export type DropzoneContextType = {
|
|
78
|
+
export type DropzoneContextType<T extends File | string = File> = {
|
|
66
79
|
/**
|
|
67
80
|
* The status of the dropzone.
|
|
68
81
|
*/
|
|
@@ -81,6 +94,7 @@ export type DropzoneContextType = {
|
|
|
81
94
|
accept: {
|
|
82
95
|
[key: string]: readonly string[];
|
|
83
96
|
};
|
|
97
|
+
value?: T[];
|
|
84
98
|
/**
|
|
85
99
|
* The function to call to open the file dialog.
|
|
86
100
|
*/
|