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