Skip to content

Commit a6e95d7

Browse files
committed
[BUILD]: generate build for version 5.5.6
1 parent 4ae5f69 commit a6e95d7

File tree

84 files changed

+1835
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1835
-0
lines changed
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: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
import { OverridableProps } from "@unlimited-react-components/kernel";
2+
import { Localization } from "../../../../localization/localization";
3+
import { FileItemContainerProps } from "../../../file-item/components/FileItemContainer/FileItemContainerProps";
4+
import { FileDuiResponse } from "../utils/dropzone-ui.upload.utils";
5+
import { CustomValidateFileResponse, FileValidated } from "../utils/validation.utils";
6+
export interface DropzoneProps extends OverridableProps {
7+
/**
8+
* This event is triggered when files are dropped or selected. Returns as first parameter the list of FileValidate files dropped or selected.
9+
*/
10+
onDrop?: (filesDropped: FileValidated[]) => void;
11+
/**
12+
* Upload Url or endpoint
13+
*/
14+
url?: string;
15+
/**
16+
* upload method, can be POST | PUT | PATCH
17+
*/
18+
method?: "POST" | "PUT" | "PATCH";
19+
/**
20+
* Extra configuration for uploading
21+
* e.g. headers or token bearer
22+
*/
23+
config?: Object;
24+
/**
25+
* If true, onDrop event will return the list of files, but also
26+
* will upload the files if url was set, and also config
27+
*/
28+
uploadOnDrop?: boolean;
29+
/**
30+
* Max number of files to be accepted.
31+
*/
32+
maxFiles?: number;
33+
/**
34+
* max file size allowed in bytes
35+
*/
36+
maxFileSize?: number;
37+
/**
38+
* If true, the dropzone component itself will be clickable
39+
*/
40+
clickable?: boolean;
41+
/**
42+
* Extra featur to perform on click
43+
* Only if clickable was set to true
44+
*/
45+
onClick?: Function;
46+
/**
47+
* The default implementation of accept
48+
* checks the file's mime type or extension
49+
* against this list. This is a comma
50+
* separated list of mime types or file extensions.
51+
* Eg.: image/*,application/pdf,.psd
52+
*/
53+
accept?: string;
54+
/**
55+
* If true, files that does not match accept
56+
* criteria will be ignored
57+
*/
58+
removeOnDrop?: boolean;
59+
/**
60+
* If present, delete all butoon will be visible
61+
* and will trigger this function onClick
62+
*/
63+
onReset?: Function;
64+
/**
65+
* if true, will show a ripple everytime
66+
* the user drops files os selects files
67+
*/
68+
disableRipple?: boolean;
69+
/**
70+
* The background color for dropzone,
71+
* by default is linear-gradient(to bottom, aliceblue,#b7a8a8)
72+
*/
73+
backgroundColor?: string;
74+
/**
75+
* custom validator
76+
* must be a function that recieves as first parameter a File Object
77+
* and must return a boolean value
78+
*/
79+
validator?: (f: File) => CustomValidateFileResponse;
80+
/**
81+
* The current number of valid files
82+
*/
83+
/**
84+
* If present will make change view visible
85+
* and also return the selected view mode
86+
*/
87+
onChangeView?: Function;
88+
/**
89+
* The current view
90+
*/
91+
view?: FileItemContainerProps["view"];
92+
/**
93+
* The max height of the container
94+
* in string format
95+
* by default "500px"
96+
*
97+
* examples:
98+
* "50vh"
99+
* "20%"
100+
* "40em"
101+
* "1rem"
102+
*/
103+
maxHeight?: string;
104+
/**
105+
* The max height of the container
106+
* in string format
107+
* by default "500px"
108+
*
109+
* examples:
110+
* "50vh"
111+
* "20%"
112+
* "40em"
113+
* "1rem"
114+
*/
115+
minHeight?: string;
116+
/**
117+
* if true, shows the dropzone footer
118+
*/
119+
footer?: boolean;
120+
/**
121+
* if true, shows the dropzone footer
122+
*/
123+
header?: boolean;
124+
/**
125+
* Just like any other input component
126+
* the value prop is the current value
127+
*/
128+
value?: FileValidated[];
129+
/**
130+
* This event is triggered when upload process starts
131+
* also returns the list of files that will be uploaded,
132+
* Unlike Onchange, onUploadStart will only return a list of files thta are candidates to be uploaded,
133+
* in case they are valid or upload status is "error"
134+
*/
135+
onUploadStart?: (files: FileValidated[]) => void;
136+
/**
137+
* This event returns as first aparameter the list of responses for each file following the structure:
138+
* responses = [
139+
* {id: <the file id>, serverResponse: the server response}
140+
* ]
141+
*/
142+
onUploadFinish?: (responses: FileDuiResponse[]) => void;
143+
/**
144+
* A message to show in the footer when the uploading process happens
145+
*/
146+
uploadingMessage?: string;
147+
/**
148+
* Probably one of the most important methods.
149+
* Onchange returns as first parameter the list of validated files,
150+
* following the structure:
151+
* file =
152+
* {
153+
* file: File;
154+
* valid: boolean;
155+
* id: number | string | undefined;
156+
* errors?: string[];
157+
* uploadMessage?: string;
158+
* uploadStatus?: undefined | "uploading", success, error;
159+
* }
160+
*
161+
* This event is also triggered when upload starts and when upload
162+
* finishes for each file in order to update the props on very FIleItem
163+
*/
164+
onChange?: (files: FileValidated[]) => void;
165+
/**
166+
* This event is triggered when "clean button is clicked"
167+
* Retuns as first parameter the list of files without not valid files
168+
*/
169+
onClean?: (files: FileValidated[]) => void;
170+
/**
171+
* The behaviuor on drop files
172+
*/
173+
behaviour?: "add" | "replace";
174+
/**
175+
* Label to place when no files selected
176+
*/
177+
label?: string;
178+
/**
179+
* Use this prop only in development mode
180+
* This will make dropzone to simulate a server upload
181+
*/
182+
fakeUploading?: boolean;
183+
/**
184+
* language to be used
185+
* for now
186+
* only English, French , Portuguese and Spanish are supported
187+
*/
188+
localization?: Localization;
189+
}
190+
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Localization } from "../../../../localization/localization";
2+
export interface DropzoneFooterProps {
3+
accept?: string;
4+
message?: string;
5+
/**
6+
* language to be used
7+
* for now
8+
* only English and Spanish is supported
9+
*/
10+
localization?: Localization;
11+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from "react";
2+
import { Localization } from "../../../../localization/localization";
3+
import { FileItemContainerProps } from "../../../file-item/components/FileItemContainer/FileItemContainerProps";
4+
export interface DropzoneHeaderProps {
5+
maxFileSize?: number;
6+
numberOfValidFiles?: number;
7+
maxFiles?: number;
8+
onReset?: Function;
9+
view: FileItemContainerProps["view"];
10+
onChangeView?: Function;
11+
onUploadStart?: Function;
12+
urlPresent?: boolean;
13+
onClean?: Function;
14+
onUploadingStart?: boolean;
15+
/**
16+
* language to be used
17+
* for now
18+
* only English and Spanish is supported
19+
*/
20+
localization?: Localization;
21+
}
22+
declare const DropzoneHeader: FC<DropzoneHeaderProps>;
23+
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
*
3+
* @param color The color theme
4+
* @param backgroundColor the background Color
5+
* @param maxHeight the max heigth for dropzone container
6+
* @param minHeight the min heigth for dropzone container
7+
* @returns a valid classnname for the component
8+
*/
9+
declare const useDropzoneStyles: (color: string | undefined, backgroundColor: string | undefined, maxHeight: string | undefined, minHeight: string | undefined) => string;
10+
export default useDropzoneStyles;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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<UploadPromiseAxiosResponse>;
4+
export interface UploadPromiseAxiosResponse {
5+
serverResponse: FileDuiResponse;
6+
uploadedFile: FileValidated;
7+
}
8+
export interface FileDuiResponse {
9+
id: number | string | undefined;
10+
serverResponse: DropzoneUIResponse | {};
11+
}
12+
export interface DropzoneUIResponse {
13+
status: boolean;
14+
message: string;
15+
payload: any;
16+
}
17+
/**
18+
* In construction
19+
*/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="react" />
2+
export declare function createRipple<T extends HTMLButtonElement | HTMLAnchorElement | HTMLDivElement>(event: React.MouseEvent<T, MouseEvent>, color: string): void;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { createRipple } from "./dropzone-ui.utils";
2+
export { createRipple, };

0 commit comments

Comments
 (0)