@sendoutcards/quantum-design-ui 1.7.83 → 1.7.85
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/index.es.js +42 -42
- package/dist/src/organisms/imageUploadWidget/imageUploadWidget.d.ts +9 -2
- package/dist/src/organisms/imageUploader/imageUploader.d.ts +14 -2
- package/package.json +1 -1
- package/dist/src/atoms/companion/companion.d.ts +0 -17
- package/dist/src/hooks/useFileUpload.d.ts +0 -32
package/dist/index.es.js
CHANGED
|
@@ -22767,10 +22767,12 @@ var isDragEventType = function (event) {
|
|
|
22767
22767
|
return 'dataTransfer' in event;
|
|
22768
22768
|
};
|
|
22769
22769
|
|
|
22770
|
-
var
|
|
22771
|
-
var _a
|
|
22772
|
-
|
|
22773
|
-
|
|
22770
|
+
var ImageUploader = function (props) {
|
|
22771
|
+
var _a, _b;
|
|
22772
|
+
|
|
22773
|
+
var _c = React.useState(null),
|
|
22774
|
+
error = _c[0],
|
|
22775
|
+
setError = _c[1];
|
|
22774
22776
|
|
|
22775
22777
|
var onUpload = props.onUpload;
|
|
22776
22778
|
var onDrop = useCallback(function (acceptedFiles, rejectedFiles, event) {
|
|
@@ -22801,34 +22803,19 @@ var useFileUpload = function (props) {
|
|
|
22801
22803
|
var onDragEnter = useCallback(function () {
|
|
22802
22804
|
setError(null);
|
|
22803
22805
|
}, []);
|
|
22804
|
-
|
|
22806
|
+
|
|
22807
|
+
var _d = useDropzone({
|
|
22805
22808
|
onDrop: onDrop,
|
|
22806
22809
|
accept: parseAcceptedFiles(props.acceptedFiles),
|
|
22807
|
-
multiple: props.
|
|
22810
|
+
multiple: props.hasMultiupload,
|
|
22808
22811
|
maxFiles: props.maxAcceptedFiles,
|
|
22809
22812
|
maxSize: props.maxFileSize,
|
|
22810
22813
|
onDragEnter: onDragEnter
|
|
22811
|
-
})
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
};
|
|
22814
|
+
}),
|
|
22815
|
+
getRootProps = _d.getRootProps,
|
|
22816
|
+
getInputProps = _d.getInputProps,
|
|
22817
|
+
isDragActive = _d.isDragActive;
|
|
22816
22818
|
|
|
22817
|
-
var ImageUploader = function (props) {
|
|
22818
|
-
var _a, _b;
|
|
22819
|
-
|
|
22820
|
-
props.uploadTitle;
|
|
22821
|
-
props.backgroundColor;
|
|
22822
|
-
var hookProps = __rest(props, ["uploadTitle", "backgroundColor"]);
|
|
22823
|
-
|
|
22824
|
-
var _c = useFileUpload(hookProps),
|
|
22825
|
-
dropzone = _c[0],
|
|
22826
|
-
error = _c[1];
|
|
22827
|
-
|
|
22828
|
-
var isDragActive = dropzone.isDragActive,
|
|
22829
|
-
getRootProps = dropzone.getRootProps,
|
|
22830
|
-
getInputProps = dropzone.getInputProps,
|
|
22831
|
-
onDragEnter = dropzone.onDragEnter;
|
|
22832
22819
|
return jsx(React.Fragment, null, jsx(Flex, {
|
|
22833
22820
|
inset: "x1",
|
|
22834
22821
|
flexWrap: "wrap",
|
|
@@ -22869,9 +22856,6 @@ var ImageUploader = function (props) {
|
|
|
22869
22856
|
}), jsx(Text, {
|
|
22870
22857
|
type: "largeBody",
|
|
22871
22858
|
content: (_b = props.uploadTitle) !== null && _b !== void 0 ? _b : 'Upload Photo'
|
|
22872
|
-
}), jsx(Text, {
|
|
22873
|
-
type: "footnote",
|
|
22874
|
-
content: "Drag and Drop Image Here"
|
|
22875
22859
|
})))), error && jsx(Text, {
|
|
22876
22860
|
type: "footnote",
|
|
22877
22861
|
content: error,
|
|
@@ -22893,26 +22877,25 @@ var ImageUploadWidget = function (_a) {
|
|
|
22893
22877
|
var _b = _a.title,
|
|
22894
22878
|
title = _b === void 0 ? 'Image Background' : _b,
|
|
22895
22879
|
onFinished = _a.onFinished,
|
|
22880
|
+
onUpload = _a.onUpload,
|
|
22896
22881
|
x = _a.x,
|
|
22897
22882
|
y = _a.y,
|
|
22898
22883
|
isOpen = _a.isOpen,
|
|
22884
|
+
_c = _a.hasMultiUpload,
|
|
22885
|
+
hasMultiUpload = _c === void 0 ? false : _c,
|
|
22899
22886
|
userImages = _a.userImages,
|
|
22900
22887
|
hasMore = _a.hasMore,
|
|
22901
22888
|
loadMore = _a.loadMore,
|
|
22902
22889
|
endMessage = _a.endMessage,
|
|
22903
22890
|
dataLength = _a.dataLength,
|
|
22904
|
-
|
|
22905
|
-
width =
|
|
22906
|
-
hookProps = __rest(_a, ["title", "onFinished", "x", "y", "isOpen", "userImages", "hasMore", "loadMore", "endMessage", "dataLength", "width"]);
|
|
22891
|
+
_d = _a.width,
|
|
22892
|
+
width = _d === void 0 ? 264 : _d;
|
|
22907
22893
|
|
|
22908
|
-
var
|
|
22909
|
-
shouldShowImageGrid =
|
|
22910
|
-
setShouldShowImageGrid =
|
|
22894
|
+
var _e = useState(false),
|
|
22895
|
+
shouldShowImageGrid = _e[0],
|
|
22896
|
+
setShouldShowImageGrid = _e[1];
|
|
22911
22897
|
|
|
22912
22898
|
var inputRef = useRef(null);
|
|
22913
|
-
var dropzone = useFileUpload(hookProps)[0];
|
|
22914
|
-
var getInputProps = dropzone.getInputProps,
|
|
22915
|
-
onDragEnter = dropzone.onDragEnter;
|
|
22916
22899
|
return jsx(AnimatePresence, null, isOpen && jsx(Div, {
|
|
22917
22900
|
initial: {
|
|
22918
22901
|
opacity: 0
|
|
@@ -23021,7 +23004,11 @@ var ImageUploadWidget = function (_a) {
|
|
|
23021
23004
|
url: image.url
|
|
23022
23005
|
}
|
|
23023
23006
|
})));
|
|
23024
|
-
}))))) : jsx(ImageUploader,
|
|
23007
|
+
}))))) : jsx(ImageUploader, {
|
|
23008
|
+
onUpload: onUpload,
|
|
23009
|
+
acceptedFiles: ['gif', 'jpeg', 'jpg', 'png'],
|
|
23010
|
+
hasMultiupload: hasMultiUpload
|
|
23011
|
+
})), jsx(HStack, {
|
|
23025
23012
|
outset: "x1",
|
|
23026
23013
|
justify: "center",
|
|
23027
23014
|
gap: "x1"
|
|
@@ -23041,10 +23028,23 @@ var ImageUploadWidget = function (_a) {
|
|
|
23041
23028
|
size: "small",
|
|
23042
23029
|
type: "smoke",
|
|
23043
23030
|
title: "Upload..."
|
|
23044
|
-
}), jsx("input",
|
|
23031
|
+
}), jsx("input", {
|
|
23045
23032
|
ref: inputRef,
|
|
23046
|
-
|
|
23047
|
-
|
|
23033
|
+
type: "file",
|
|
23034
|
+
accept: "image/*",
|
|
23035
|
+
style: {
|
|
23036
|
+
display: 'none'
|
|
23037
|
+
},
|
|
23038
|
+
onChange: function (e) {
|
|
23039
|
+
var _a, _b;
|
|
23040
|
+
|
|
23041
|
+
var file = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
|
|
23042
|
+
if (file) onUpload({
|
|
23043
|
+
accepted: [file],
|
|
23044
|
+
rejected: []
|
|
23045
|
+
});
|
|
23046
|
+
}
|
|
23047
|
+
})), jsx(Div, {
|
|
23048
23048
|
width: "120px"
|
|
23049
23049
|
}, jsx(Button, {
|
|
23050
23050
|
onClick: function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AcceptedFiles, RejectedFiles } from '../imageUploader/imageUploader';
|
|
3
3
|
export declare type UserImage = {
|
|
4
4
|
url: string;
|
|
5
5
|
onClick: () => void;
|
|
@@ -7,8 +7,15 @@ export declare type UserImage = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare type ImageUploadWidgetProps = {
|
|
9
9
|
title: string;
|
|
10
|
+
maxHeight?: string;
|
|
11
|
+
onClose: () => void;
|
|
10
12
|
onFinished: () => void;
|
|
11
13
|
isOpen: boolean;
|
|
14
|
+
onUpload: (files: {
|
|
15
|
+
accepted: AcceptedFiles;
|
|
16
|
+
rejected: RejectedFiles;
|
|
17
|
+
}, fileList?: FileList | null) => void;
|
|
18
|
+
hasMultiUpload?: boolean;
|
|
12
19
|
userImages?: UserImage[];
|
|
13
20
|
x: number;
|
|
14
21
|
y: number;
|
|
@@ -17,5 +24,5 @@ export declare type ImageUploadWidgetProps = {
|
|
|
17
24
|
hasMore?: boolean;
|
|
18
25
|
endMessage?: string;
|
|
19
26
|
width?: number;
|
|
20
|
-
}
|
|
27
|
+
};
|
|
21
28
|
export declare const ImageUploadWidget: FC<ImageUploadWidgetProps>;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FileRejection } from 'react-dropzone';
|
|
2
3
|
import { BackgroundColor } from "../../helpers/hoc-types/hocBaseUnion";
|
|
3
|
-
|
|
4
|
+
declare type AcceptedFileType = 'jpg' | 'png' | 'gif' | 'jpeg';
|
|
4
5
|
export declare type ImageUploaderProps = {
|
|
6
|
+
onUpload: (files: {
|
|
7
|
+
accepted: File[];
|
|
8
|
+
rejected: FileRejection[];
|
|
9
|
+
}, fileList?: FileList | null) => void;
|
|
10
|
+
acceptedFiles: AcceptedFileType[];
|
|
11
|
+
hasMultiupload?: boolean;
|
|
12
|
+
maxFileSize?: number;
|
|
13
|
+
maxAcceptedFiles?: number;
|
|
5
14
|
uploadTitle?: string;
|
|
6
15
|
backgroundColor?: BackgroundColor;
|
|
7
|
-
}
|
|
16
|
+
};
|
|
17
|
+
export declare type AcceptedFiles = File[];
|
|
18
|
+
export declare type RejectedFiles = FileRejection[];
|
|
8
19
|
export declare const ImageUploader: (props: ImageUploaderProps) => JSX.Element;
|
|
20
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HOCBaseProps } from "../../helpers/hoc-types/hocBasePropTypes";
|
|
3
|
-
import { HOCMotionProps } from "../../helpers/hoc-types/hocMotionTypes";
|
|
4
|
-
export declare type DivProps = {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
outsideClick?: () => void;
|
|
7
|
-
clickElementBypass?: string;
|
|
8
|
-
} & HOCBaseProps & HOCMotionProps;
|
|
9
|
-
export declare const Companion: React.ForwardRefExoticComponent<{
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
outsideClick?: (() => void) | undefined;
|
|
12
|
-
clickElementBypass?: string | undefined;
|
|
13
|
-
} & HOCBaseProps & {
|
|
14
|
-
className?: string | undefined;
|
|
15
|
-
motionKey?: string | number | undefined;
|
|
16
|
-
id?: string | undefined;
|
|
17
|
-
} & import("framer-motion").MotionProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropzoneState, FileRejection } from 'react-dropzone';
|
|
3
|
-
declare type AcceptedFileType = 'jpg' | 'png' | 'gif' | 'jpeg';
|
|
4
|
-
export declare type AcceptedFiles = File[];
|
|
5
|
-
export declare type RejectedFiles = FileRejection[];
|
|
6
|
-
export declare type UseFileUploadProps = {
|
|
7
|
-
onUpload: (files: {
|
|
8
|
-
accepted: File[];
|
|
9
|
-
rejected: FileRejection[];
|
|
10
|
-
}, fileList?: FileList | null) => void;
|
|
11
|
-
acceptedFiles: AcceptedFileType[];
|
|
12
|
-
hasMultiUpload?: boolean;
|
|
13
|
-
maxFileSize?: number;
|
|
14
|
-
maxAcceptedFiles?: number;
|
|
15
|
-
};
|
|
16
|
-
export declare const useFileUpload: (props: UseFileUploadProps) => [import("react-dropzone").DropzoneRef & {
|
|
17
|
-
isFocused: boolean;
|
|
18
|
-
isDragActive: boolean;
|
|
19
|
-
isDragAccept: boolean;
|
|
20
|
-
isDragReject: boolean;
|
|
21
|
-
isFileDialogActive: boolean;
|
|
22
|
-
draggedFiles: File[];
|
|
23
|
-
acceptedFiles: File[];
|
|
24
|
-
fileRejections: FileRejection[];
|
|
25
|
-
rootRef: React.RefObject<HTMLElement>;
|
|
26
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
27
|
-
getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T | undefined) => T;
|
|
28
|
-
getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1 | undefined) => T_1;
|
|
29
|
-
} & {
|
|
30
|
-
onDragEnter: () => void;
|
|
31
|
-
}, string | null];
|
|
32
|
-
export {};
|