Skip to content

Commit 395046e

Browse files
committed
[BUILD]: create build for V.2.8.1
1 parent 102bddf commit 395046e

File tree

74 files changed

+1628
-3821
lines changed

Some content is hidden

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

74 files changed

+1628
-3821
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: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
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 { FileValidated } from "../utils/validation.utils";
5+
export interface DropzoneProps extends OverridableProps {
6+
/**
7+
* What to do when Drop event is triggered
8+
* In most cases is to retrieve the list of files validated
9+
*/
10+
onDrop?: Function;
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) => boolean;
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+
* if true, shows the dropzone footer
106+
*/
107+
footer?: boolean;
108+
/**
109+
* if true, shows the dropzone footer
110+
*/
111+
header?: boolean;
112+
/**
113+
* Just like any other input component
114+
* the value prop is the current value
115+
*/
116+
value?: FileValidated[];
117+
/**
118+
* In both cases of uploading (onDropUpload, or with clicking upload button)
119+
* This event is the result one by one of the uploading process
120+
*/
121+
onUploading?: (files: FileValidated[]) => void;
122+
/**
123+
* A message to show in the footer when the uploading process happens
124+
*/
125+
uploadingMessage?: string;
126+
/**
127+
* The onChange Event occurs when the value is changed
128+
*/
129+
onChange?: (files: FileValidated[]) => void;
130+
/**
131+
* The behaviuor on drop files
132+
*/
133+
behaviour?: "add" | "replace";
134+
/**
135+
* Label to place when no files selected
136+
*/
137+
label?: string;
138+
/**
139+
* Use this prop only in development mode
140+
* This will make dropzone to simulate a server upload
141+
*/
142+
fakeUploading?: boolean;
143+
/**
144+
* language to be used
145+
* for now
146+
* only English, French and Spanish are supported
147+
*/
148+
localization?: Localization;
149+
}
150+
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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
handleReset: Function;
10+
view: FileItemContainerProps["view"];
11+
onChangeView?: Function;
12+
onUploadStart?: Function;
13+
urlPresent?: boolean;
14+
/**
15+
* language to be used
16+
* for now
17+
* only English and Spanish is supported
18+
*/
19+
localization?: Localization;
20+
}
21+
declare const DropzoneHeader: FC<DropzoneHeaderProps>;
22+
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: 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+
*/
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+
export declare const ERROR_MAX_SIZE: (maxSize: number) => string;
2+
export declare const ERROR_ACCEPT = "File's type is not allowed";

0 commit comments

Comments
 (0)