demio-ui 2.5.56 → 2.5.57
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/index.js +5 -5
- package/dist/cjs/types/src/components/Upload/Upload.d.ts +24 -0
- package/dist/cjs/types/src/components/UploadPreview/UploadPreview.d.ts +12 -0
- package/dist/cjs/types/src/components/UploadPreview/index.d.ts +1 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/types/src/components/Upload/Upload.d.ts +24 -0
- package/dist/esm/types/src/components/UploadPreview/UploadPreview.d.ts +12 -0
- package/dist/esm/types/src/components/UploadPreview/index.d.ts +1 -0
- package/dist/types.d.ts +24 -0
- package/package.json +1 -1
- package/dist/cjs/types/src/components/Crop/Crop.utils.d.ts +0 -11
- package/dist/cjs/types/src/components/DnDArea/DnDArea.utils.d.ts +0 -3
- package/dist/cjs/types/src/components/Pagination/Pagination.utils.d.ts +0 -7
- package/dist/cjs/types/src/hooks/useCroppedImage.d.ts +0 -4
- package/dist/esm/types/src/components/Crop/Crop.utils.d.ts +0 -11
- package/dist/esm/types/src/components/DnDArea/DnDArea.utils.d.ts +0 -3
- package/dist/esm/types/src/components/Pagination/Pagination.utils.d.ts +0 -7
- package/dist/esm/types/src/hooks/useCroppedImage.d.ts +0 -4
|
@@ -44,5 +44,29 @@ export interface UploadProps {
|
|
|
44
44
|
previewImageTitle?: string;
|
|
45
45
|
uploadPercent?: number;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
The component has 3 states: **default**, **progress** and **preview** states.
|
|
49
|
+
|
|
50
|
+
- **Default** state is visible when **uploadPercent** prop is **undefined**.
|
|
51
|
+
- When the **uploadPercent** prop becomes a **number** and it is **less than 100** the **Upload** automatically switches to a **progress** state.
|
|
52
|
+
- When the **uploadPercent** prop is **equal to 100** the **Upload** automatically switches to a **preview** mode.
|
|
53
|
+
|
|
54
|
+
One more useful thing is related to a **UploadRef** interface. It consists of all the methods that need to be accessed through the **ref**. For example:
|
|
55
|
+
|
|
56
|
+
````
|
|
57
|
+
const uploadRef = useRef<UploadRef>(null);
|
|
58
|
+
|
|
59
|
+
const handleReset = () => {
|
|
60
|
+
uploadRef.current?.cancelUpload();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<Upload ref={uploadRef} />
|
|
66
|
+
<button onClick={handleReset}>Reset Upload</button>
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
````
|
|
70
|
+
**/
|
|
47
71
|
declare const Upload: FC<UploadProps>;
|
|
48
72
|
export default Upload;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { UploadMenuItem } from '../UploadMenu/UploadMenu';
|
|
3
|
+
export interface UploadPreviewProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
fileName?: string;
|
|
6
|
+
fileInfo?: string;
|
|
7
|
+
imageSrc?: string;
|
|
8
|
+
imageTitle?: string;
|
|
9
|
+
menu?: UploadMenuItem[];
|
|
10
|
+
}
|
|
11
|
+
declare const UploadPreview: FC<UploadPreviewProps>;
|
|
12
|
+
export default UploadPreview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './UploadPreview';
|
package/dist/types.d.ts
CHANGED
|
@@ -562,6 +562,30 @@ interface UploadProps {
|
|
|
562
562
|
previewImageTitle?: string;
|
|
563
563
|
uploadPercent?: number;
|
|
564
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
The component has 3 states: **default**, **progress** and **preview** states.
|
|
567
|
+
|
|
568
|
+
- **Default** state is visible when **uploadPercent** prop is **undefined**.
|
|
569
|
+
- When the **uploadPercent** prop becomes a **number** and it is **less than 100** the **Upload** automatically switches to a **progress** state.
|
|
570
|
+
- When the **uploadPercent** prop is **equal to 100** the **Upload** automatically switches to a **preview** mode.
|
|
571
|
+
|
|
572
|
+
One more useful thing is related to a **UploadRef** interface. It consists of all the methods that need to be accessed through the **ref**. For example:
|
|
573
|
+
|
|
574
|
+
````
|
|
575
|
+
const uploadRef = useRef<UploadRef>(null);
|
|
576
|
+
|
|
577
|
+
const handleReset = () => {
|
|
578
|
+
uploadRef.current?.cancelUpload();
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
return (
|
|
582
|
+
<>
|
|
583
|
+
<Upload ref={uploadRef} />
|
|
584
|
+
<button onClick={handleReset}>Reset Upload</button>
|
|
585
|
+
</>
|
|
586
|
+
);
|
|
587
|
+
````
|
|
588
|
+
**/
|
|
565
589
|
declare const Upload: FC<UploadProps>;
|
|
566
590
|
|
|
567
591
|
interface UploadErrorProps {
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Area } from 'react-easy-crop';
|
|
2
|
-
export declare const createImage: (url: string) => Promise<HTMLImageElement>;
|
|
3
|
-
export declare const getRadianAngle: (degreeValue?: number) => number;
|
|
4
|
-
export declare const rotateSize: (width: number, height: number, rotation: number) => {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const getCroppedImageURL: (imageSrc: string, pixelCrop: Area, rotation?: number, flip?: {
|
|
9
|
-
horizontal: boolean;
|
|
10
|
-
vertical: boolean;
|
|
11
|
-
}) => Promise<string | null>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const isValidFileType: (file?: File | null, acceptableTypePattern?: string) => boolean;
|
|
2
|
-
export declare const isValidFileSize: (file?: File | null, fileSizeMbLimit?: number) => boolean;
|
|
3
|
-
export declare const isValidFileDimension: (file?: File | null, minWidth?: number, minHeight?: number) => Promise<boolean>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Area } from 'react-easy-crop';
|
|
2
|
-
export declare const createImage: (url: string) => Promise<HTMLImageElement>;
|
|
3
|
-
export declare const getRadianAngle: (degreeValue?: number) => number;
|
|
4
|
-
export declare const rotateSize: (width: number, height: number, rotation: number) => {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const getCroppedImageURL: (imageSrc: string, pixelCrop: Area, rotation?: number, flip?: {
|
|
9
|
-
horizontal: boolean;
|
|
10
|
-
vertical: boolean;
|
|
11
|
-
}) => Promise<string | null>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const isValidFileType: (file?: File | null, acceptableTypePattern?: string) => boolean;
|
|
2
|
-
export declare const isValidFileSize: (file?: File | null, fileSizeMbLimit?: number) => boolean;
|
|
3
|
-
export declare const isValidFileDimension: (file?: File | null, minWidth?: number, minHeight?: number) => Promise<boolean>;
|