Skip to content

Commit 2ce3653

Browse files
committed
[REF]: misising build
1 parent 4759ed5 commit 2ce3653

71 files changed

Lines changed: 943 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from "react";
2+
import "./Dropzone.scss";
3+
import { DropzoneProps } from "./DropzoneProps";
4+
declare const Dropzone: React.FC<DropzoneProps>;
5+
export default Dropzone;
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import { OverridableProps } from "@unlimited-react-components/kernel";
2+
import { FileItemContainerProps } from "../../../file-item/components/FileItemContainer/FileItemContainerProps";
3+
import { FileValidated } from "../utils/validation.utils";
4+
export interface DropzoneProps extends OverridableProps {
5+
/**
6+
* What to do when Drop event is triggered
7+
* In most cases is to retrieve the list of files validated
8+
*/
9+
onDrop?: Function;
10+
/**
11+
* Upload Url or endpoint
12+
*/
13+
url?: string;
14+
/**
15+
* upload method, can be POST | PUT | PATCH
16+
*/
17+
method?: "POST" | "PUT" | "PATCH";
18+
/**
19+
* Extra configuration for uploading
20+
* e.g. headers or token bearer
21+
*/
22+
config?: Object;
23+
/**
24+
* If true, onDrop event will return the list of files, but also
25+
* will upload the files if url was set, and also config
26+
*/
27+
uploadOnDrop?: boolean;
28+
/**
29+
* Max number of files to be accepted.
30+
*/
31+
maxFiles?: number;
32+
/**
33+
* max file size allowed in bytes
34+
*/
35+
maxFileSize?: number;
36+
/**
37+
* If true, the dropzone component itself will be clickable
38+
*/
39+
clickable?: boolean;
40+
/**
41+
* Extra featur to perform on click
42+
* Only if clickable was set to true
43+
*/
44+
onClick?: Function;
45+
/**
46+
* The default implementation of accept
47+
* checks the file's mime type or extension
48+
* against this list. This is a comma
49+
* separated list of mime types or file extensions.
50+
* Eg.: image/*,application/pdf,.psd
51+
*/
52+
accept?: string;
53+
/**
54+
* If true, files that does not match accept
55+
* criteria will be ignored
56+
*/
57+
removeOnDrop?: boolean;
58+
/**
59+
* If present, delete all butoon will be visible
60+
* and will trigger this function onClick
61+
*/
62+
onReset?: Function;
63+
/**
64+
* if true, will show a ripple everytime
65+
* the user drops files os selects files
66+
*/
67+
disableRipple?: boolean;
68+
/**
69+
* The background color for dropzone,
70+
* by default is linear-gradient(to bottom, aliceblue,#b7a8a8)
71+
*/
72+
backgroundColor?: string;
73+
/**
74+
* custom validator
75+
* must be a function that recieves as first parameter a File Object
76+
* and must return a boolean value
77+
*/
78+
validator?: (f: File) => boolean;
79+
/**
80+
* The current number of valid files
81+
*/
82+
/**
83+
* If present will make change view visible
84+
* and also return the selected view mode
85+
*/
86+
onChangeView?: Function;
87+
/**
88+
* The current view
89+
*/
90+
view?: FileItemContainerProps["view"];
91+
/**
92+
* The max height of the container
93+
* in string format
94+
* by default "500px"
95+
*
96+
* examples:
97+
* "50vh"
98+
* "20%"
99+
* "40em"
100+
* "1rem"
101+
*/
102+
maxHeight?: string;
103+
/**
104+
* if true, shows the dropzone footer
105+
*/
106+
footer?: boolean;
107+
/**
108+
* if true, shows the dropzone footer
109+
*/
110+
header?: boolean;
111+
/**
112+
* Just like any other input component
113+
* the value prop is the current value
114+
*/
115+
value?: FileValidated[];
116+
/**
117+
* In both cases of uploading (onDropUpload, or with clicking upload button)
118+
* This event is the result one by one of the uploading process
119+
*/
120+
onUploading?: (files: FileValidated[]) => void;
121+
/**
122+
* A message to show in the footer when the uploading process happens
123+
*/
124+
uploadingMessage?: string;
125+
/**
126+
* The onChange Event occurs when the value is changed
127+
*/
128+
onChange?: (files: FileValidated[]) => void;
129+
/**
130+
* The behaviuor on drop files
131+
*/
132+
behaviour?: "add" | "replace";
133+
/**
134+
* Label to place when no files selected
135+
*/
136+
label?: string;
137+
/**
138+
* Use this prop only in development mode
139+
* This will make dropzone to simulate a server upload
140+
*/
141+
fakeUploading?: boolean;
142+
}
143+
export declare const DropzonePropsDefault: DropzoneProps;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { FC } from "react";
2+
import { DropzoneFooterProps } from "./DropzoneFooterProps";
3+
declare const DropzoneFooter: FC<DropzoneFooterProps>;
4+
export default DropzoneFooter;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface DropzoneFooterProps {
2+
accept?: string;
3+
message?: string;
4+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { FC } from "react";
2+
import { FileItemContainerProps } from "../../../file-item/components/FileItemContainer/FileItemContainerProps";
3+
export interface DropzoneHeaderProps {
4+
maxFileSize?: number;
5+
numberOfValidFiles?: number;
6+
maxFiles?: number;
7+
onReset?: Function;
8+
handleReset: Function;
9+
view: FileItemContainerProps["view"];
10+
onChangeView?: Function;
11+
onUploadStart?: Function;
12+
urlPresent?: boolean;
13+
}
14+
declare const DropzoneHeader: FC<DropzoneHeaderProps>;
15+
export default DropzoneHeader;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React, { FC } from "react";
2+
export interface DropzoneLabelProps {
3+
children: React.ReactNode | string;
4+
}
5+
declare const DropzoneLabel: FC<DropzoneLabelProps>;
6+
export default DropzoneLabel;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { FC } from "react";
2+
import { DropzoneUIProps } from "./DropzoneUIProps";
3+
declare const DropzoneUI: FC<DropzoneUIProps>;
4+
export default DropzoneUI;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { FileItemProps } from "../../../file-item/components/FileItem/FileItemProps";
2+
import { FileItemContainerProps } from "../../../file-item/components/FileItemContainer/FileItemContainerProps";
3+
import { DropzoneProps } from "../Dropzone/DropzoneProps";
4+
export interface DropzoneUIProps extends DropzoneProps, FileItemProps, FileItemContainerProps {
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
*
3+
* @param color The color theme
4+
* @param backgroundColor the background Color
5+
* @param maxHeight the max heith for dropzone container
6+
* @returns a valid classnname for the component
7+
*/
8+
declare const useDropzoneStyles: (color: string | undefined, backgroundColor: string | undefined, maxHeight: string | undefined) => string;
9+
export default useDropzoneStyles;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { DropzoneProps } from "../Dropzone/DropzoneProps";
2+
import { FileValidated } from "./validation.utils";
3+
export declare const uploadPromiseAxios: (file: FileValidated, url: string, method: DropzoneProps["method"], config: any) => Promise<FileValidated>;
4+
/**
5+
* In construction
6+
*/

0 commit comments

Comments
 (0)