@osmandvc/react-upload-control 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/README.md +421 -0
  2. package/dist/FileUploadContainer.d.ts +9 -0
  3. package/dist/FileUploadControl.d.ts +5 -0
  4. package/dist/actions/FileDeleteAllButton.d.ts +1 -0
  5. package/dist/actions/FileItemActions.d.ts +7 -0
  6. package/dist/actions/FileUploadAllButton.d.ts +1 -0
  7. package/dist/actions/index.d.ts +3 -0
  8. package/dist/components/camera/custom-react-webcam.d.ts +58 -0
  9. package/dist/components/camera/frames/WebcamFrameA4.d.ts +20 -0
  10. package/dist/components/camera/frames/index.d.ts +1 -0
  11. package/dist/components/camera/index.d.ts +1 -0
  12. package/dist/components/camera/use-webcam.d.ts +34 -0
  13. package/dist/components/file-drop/FileDropArea.d.ts +2 -0
  14. package/dist/components/file-drop/FileDropLarge.d.ts +6 -0
  15. package/dist/components/file-drop/FileDropSmall.d.ts +6 -0
  16. package/dist/components/file-list/FileList.d.ts +2 -0
  17. package/dist/components/file-list/FileListActions.d.ts +1 -0
  18. package/dist/components/file-list/FileListContainer.d.ts +6 -0
  19. package/dist/components/file-list/FileListItem.d.ts +3 -0
  20. package/dist/components/index.d.ts +6 -0
  21. package/dist/hooks/index.d.ts +2 -0
  22. package/dist/hooks/use-mobile-detect.d.ts +9 -0
  23. package/dist/hooks/use-state-machine.d.ts +21 -0
  24. package/dist/index.d.ts +6 -0
  25. package/dist/index.js +2 -0
  26. package/dist/index.js.LICENSE.txt +33 -0
  27. package/dist/loaders/FileLoaderActions.d.ts +2 -0
  28. package/dist/loaders/FileLoaderCamera.d.ts +2 -0
  29. package/dist/loaders/FileLoaderFileSystem.d.ts +2 -0
  30. package/dist/loaders/index.d.ts +3 -0
  31. package/dist/providers/UploadedFilesManager.d.ts +26 -0
  32. package/dist/providers/UploadedFilesProvider.d.ts +3 -0
  33. package/dist/providers/index.d.ts +2 -0
  34. package/dist/stories/FileUploadControlSimple.d.ts +3 -0
  35. package/dist/stories/FileUploadControlSmall.d.ts +3 -0
  36. package/dist/stories/FileUploadControlWithProgress.d.ts +3 -0
  37. package/dist/types.d.ts +162 -0
  38. package/dist/ui/button/Button.d.ts +18 -0
  39. package/dist/ui/button/index.d.ts +1 -0
  40. package/dist/ui/card/Card.d.ts +8 -0
  41. package/dist/ui/card/index.d.ts +1 -0
  42. package/dist/ui/dialog/Dialog.d.ts +19 -0
  43. package/dist/ui/dialog/index.d.ts +1 -0
  44. package/dist/ui/icons/index.d.ts +1 -0
  45. package/dist/ui/image-zoom/index.d.ts +3 -0
  46. package/dist/ui/progress/Progress.d.ts +4 -0
  47. package/dist/ui/progress/index.d.ts +1 -0
  48. package/dist/ui/select/Select.d.ts +13 -0
  49. package/dist/ui/select/index.d.ts +1 -0
  50. package/dist/ui/seperator/Seperator.d.ts +4 -0
  51. package/dist/ui/seperator/index.d.ts +1 -0
  52. package/dist/ui/tooltip/Tooltip.d.ts +7 -0
  53. package/dist/ui/tooltip/index.d.ts +1 -0
  54. package/dist/utils/api-mocker.d.ts +2 -0
  55. package/dist/utils/cn.d.ts +2 -0
  56. package/dist/utils/date/index.d.ts +1 -0
  57. package/dist/utils/error-handling.d.ts +3 -0
  58. package/dist/utils/file-types.d.ts +36 -0
  59. package/dist/utils/image-processing/blob-to-base64.d.ts +1 -0
  60. package/dist/utils/image-processing/canvas-utils.d.ts +7 -0
  61. package/dist/utils/image-processing/index.d.ts +3 -0
  62. package/dist/utils/image-processing/load-image.d.ts +3 -0
  63. package/dist/utils/index.d.ts +6 -0
  64. package/dist/utils/is-filedrop-error.d.ts +2 -0
  65. package/package.json +107 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license @tabler/icons-react v3.24.0 - MIT
3
+ *
4
+ * This source code is licensed under the MIT license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * @license React
10
+ * react-jsx-runtime.production.min.js
11
+ *
12
+ * Copyright (c) Facebook, Inc. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+
18
+ /**
19
+ * filesize
20
+ *
21
+ * @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
22
+ * @license BSD-3-Clause
23
+ * @version 10.1.6
24
+ */
25
+
26
+ /** @license React v16.13.1
27
+ * react-is.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */
@@ -0,0 +1,2 @@
1
+ import { FileLoaderActionsProps } from "../types";
2
+ export declare const FileLoaderActions: (props: FileLoaderActionsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { FileLoaderCameraProps } from "../types";
2
+ export declare const FileLoaderCamera: (props: FileLoaderCameraProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { FileLoaderFileSystemProps } from "../types";
2
+ export declare const FileLoaderFileSystem: (props: FileLoaderFileSystemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from "./FileLoaderActions";
2
+ export * from "./FileLoaderCamera";
3
+ export * from "./FileLoaderFileSystem";
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { UploadedFile, UploadedFileItemStage, UploadedFilesManagerProps } from "../types";
3
+ export interface ContextProps {
4
+ files: UploadedFile[];
5
+ smStatus: string;
6
+ updateFile: (name: string, uploadedFileProps: Partial<UploadedFile>) => void;
7
+ uploadAllFiles: () => Promise<void>;
8
+ deleteFile: (fileId: string) => Promise<void>;
9
+ deleteAllFiles: () => Promise<void>;
10
+ addFiles: (files: File[]) => void;
11
+ removeFile: (fileId: string) => void;
12
+ updateFileStage: (name: string, status: UploadedFileItemStage) => void;
13
+ getFile: (id: string) => UploadedFile | undefined;
14
+ smStatusIs: (...args: string[]) => boolean;
15
+ smStatusIsnt: (...args: string[]) => boolean;
16
+ setFiles: React.Dispatch<React.SetStateAction<UploadedFile[]>>;
17
+ resetControl: (files: UploadedFile[]) => void;
18
+ getValidationInfo: () => {
19
+ types: string[];
20
+ maxFileSizeMb: number;
21
+ };
22
+ disableSorting: boolean;
23
+ }
24
+ declare const UploadedFilesManager: (props: UploadedFilesManagerProps) => import("react/jsx-runtime").JSX.Element;
25
+ declare function useUploadFilesProvider(): ContextProps;
26
+ export { UploadedFilesManager, useUploadFilesProvider };
@@ -0,0 +1,3 @@
1
+ import { UploadedFilesProviderProps } from "../types";
2
+ import "@/src/styles/tailwind.css";
3
+ export declare const UploadedFilesProvider: (props: UploadedFilesProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from "./UploadedFilesManager";
2
+ export * from "./UploadedFilesProvider";
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from "react";
2
+ declare function FileUploadControlSimple(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
3
+ export default FileUploadControlSimple;
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from "react";
2
+ declare function FileUploadControlSmall(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
3
+ export default FileUploadControlSmall;
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from "react";
2
+ declare function FileUploadControlWithProgress(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
3
+ export default FileUploadControlWithProgress;
@@ -0,0 +1,162 @@
1
+ export type FilePreProcessorFunction = (files: UploadedFilePublic[]) => UploadedFilePublic[] | Promise<UploadedFilePublic[] | undefined>;
2
+ interface MimeTypesProcessorMap {
3
+ [key: string]: FilePreProcessorFunction | null;
4
+ }
5
+ export type FilePreProcessor = MimeTypesProcessorMap & {
6
+ other?: FilePreProcessorFunction;
7
+ };
8
+ export interface FileUploadConfig {
9
+ mimeTypes?: string[];
10
+ multiple?: boolean;
11
+ maxFileSizeMb?: number;
12
+ maxFiles?: number;
13
+ resetOnFinish?: boolean;
14
+ disableSorting?: boolean;
15
+ }
16
+ export interface FileUploadHandlers {
17
+ onUpload: (files: UploadedFile[], onProgressChange: (fileId: string, progress: number, error?: {
18
+ text: string;
19
+ code: string;
20
+ }) => void) => Promise<UploadFileResult[]>;
21
+ onDelete?: (files: UploadedFile[]) => Promise<UploadFileResult[]>;
22
+ onFinish: (files: UploadedFile[]) => void;
23
+ onAddFileError?: (error: unknown | FileDropError) => void;
24
+ preProcessFiles?: FilePreProcessor;
25
+ }
26
+ export interface UploadedFilesManagerProps {
27
+ children: React.ReactNode;
28
+ config?: FileUploadConfig;
29
+ handlers: FileUploadHandlers;
30
+ initFiles?: UploadedFile[];
31
+ locale?: string;
32
+ }
33
+ export interface UploadedFilesProviderProps extends UploadedFilesManagerProps {
34
+ }
35
+ export type UploadFileResult = {
36
+ fileId: string;
37
+ success: boolean;
38
+ error?: {
39
+ text: string;
40
+ code: string;
41
+ };
42
+ metadata?: UploadedFileMetadata;
43
+ };
44
+ export type FileDropProps = {
45
+ isMinimal?: boolean;
46
+ children?: React.ReactNode;
47
+ };
48
+ export type FileDropError = {
49
+ error: {
50
+ type: FileDropErrorType;
51
+ text: string;
52
+ };
53
+ };
54
+ export type DndResult = {
55
+ source: {
56
+ index: number;
57
+ };
58
+ destination: {
59
+ index: number;
60
+ };
61
+ };
62
+ export type FileListProps = {
63
+ onDragEnd?: (result: DndResult) => void;
64
+ disableSorting?: boolean;
65
+ };
66
+ export interface FileUploadControlProps extends Omit<FileLoaderActionsProps, "onAddFileError"> {
67
+ className?: string;
68
+ size?: "sm" | "lg" | "auto";
69
+ children?: React.ReactNode;
70
+ }
71
+ export type UploadStatus = {
72
+ stage?: UploadedFileItemStage;
73
+ progress?: number;
74
+ error?: {
75
+ text: string;
76
+ code: string;
77
+ };
78
+ };
79
+ export type FileListItemProps = {
80
+ id: string;
81
+ size?: number;
82
+ name: string;
83
+ previewImgSrc?: string;
84
+ uploadStatus: UploadStatus;
85
+ order?: number;
86
+ count: number;
87
+ disabled?: boolean;
88
+ disableSorting?: boolean;
89
+ };
90
+ export declare enum FileDropErrorType {
91
+ INVALID_FILE = "INVALID_FILE",
92
+ MAXSIZE = "OVER_SIZE_LIMIT",
93
+ MULTIPLE_NOT_ALLOWED = "MULTIPLE_NOT_ALLOWED",
94
+ MAX_FILES_NUMBER = "MAX_FILES_NUMBER"
95
+ }
96
+ export type UploadedFileImage = {
97
+ imgBase64Uri: string;
98
+ width?: number;
99
+ height?: number;
100
+ };
101
+ export declare enum UploadedFileItemStage {
102
+ IDLE = "IDLE",
103
+ FINISHED = "FINISHED",
104
+ FAILED = "FAILED",
105
+ UPLOADING = "UPLOADING",
106
+ REMOVING = "REMOVING"
107
+ }
108
+ export interface UploadedFile extends UploadedFilePublic {
109
+ uploadStatus: UploadStatus;
110
+ order?: number;
111
+ }
112
+ export interface UploadedFilePublic {
113
+ id: string;
114
+ file?: File;
115
+ name: string;
116
+ size?: number;
117
+ type: string;
118
+ base64Uri?: string;
119
+ previewImg?: UploadedFileImage;
120
+ metadata?: UploadedFileMetadata;
121
+ }
122
+ export interface UploadedFileMetadata {
123
+ [key: string]: any;
124
+ }
125
+ export interface FormImage {
126
+ uriBase64: string;
127
+ width: number;
128
+ height: number;
129
+ }
130
+ export interface ScaledImage extends FormImage {
131
+ storeId?: number;
132
+ img?: HTMLImageElement;
133
+ scale: number;
134
+ file?: File;
135
+ mimeType: string;
136
+ }
137
+ export type FileLoaderActionsProps = {
138
+ disableCamera?: boolean;
139
+ disableFileSystem?: boolean;
140
+ isMinimal?: boolean;
141
+ disabled?: boolean;
142
+ };
143
+ export type FileLoaderFileSystemProps = {
144
+ className?: string;
145
+ onlyIcon?: boolean;
146
+ };
147
+ export type FileLoaderCameraProps = {
148
+ className?: string;
149
+ onlyIcon?: boolean;
150
+ };
151
+ export interface ScaledImageBinary extends ScaledImage {
152
+ uri: string;
153
+ img: HTMLImageElement;
154
+ imgBlob?: Blob;
155
+ imgArray?: Uint8Array;
156
+ width: number;
157
+ height: number;
158
+ scale: number;
159
+ mimeType: string;
160
+ hasWatermark?: boolean;
161
+ }
162
+ export {};
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "link" | "success" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
+ size?: "sm" | "lg" | "default" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ startContent?: React.ReactNode;
10
+ endContent?: React.ReactNode;
11
+ isIconOnly?: boolean;
12
+ icon?: string;
13
+ iconSize?: number;
14
+ isLoading?: boolean;
15
+ loadingText?: string;
16
+ }
17
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
18
+ export { Button, buttonVariants };
@@ -0,0 +1 @@
1
+ export * from "./Button";
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
5
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
6
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
@@ -0,0 +1 @@
1
+ export * from "./Card";
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
4
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const DialogHeader: {
10
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
13
+ declare const DialogFooter: {
14
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
18
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
19
+ export { Dialog, DialogPortal, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
@@ -0,0 +1 @@
1
+ export * from "./Dialog";
@@ -0,0 +1 @@
1
+ export { IconUpload as UploadIcon, IconCamera as CameraIcon, IconCheck as CheckIcon, IconRefresh as ResetIcon, IconX as CancelIcon, IconTrash as DeleteIcon, IconArrowsMove as MoveIcon, IconFolder as FolderIcon, IconFlipVertical as MirrorIcon, IconViewportWide as RotateIcon, IconFile as ImagePlaceholderIcon, IconDotsVertical as MoreIcon, } from "@tabler/icons-react";
@@ -0,0 +1,3 @@
1
+ import Zoom from "react-medium-image-zoom";
2
+ import "react-medium-image-zoom/dist/styles.css";
3
+ export { Zoom as ImageZoom };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as ProgressPrimitive from "@radix-ui/react-progress";
3
+ declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export { Progress };
@@ -0,0 +1 @@
1
+ export * from "./Progress";
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+ declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
+ declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
+ declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
6
+ declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
@@ -0,0 +1 @@
1
+ export * from "./Select";
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
+ declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export { Separator };
@@ -0,0 +1 @@
1
+ export * from "./Seperator";
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
+ declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
+ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1 @@
1
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, } from "./Tooltip";
@@ -0,0 +1,2 @@
1
+ import { UploadedFile } from "../types";
2
+ export declare function mockApiCallWithProgress(file: UploadedFile, updateProgress: (id: string, options: Partial<UploadedFile>) => void): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1 @@
1
+ export declare function addUniqueTimestamp(s: string): string;
@@ -0,0 +1,3 @@
1
+ export declare function formatError(e: any, doIncludeStack?: boolean): string;
2
+ export declare function consoleWarn(...args: any): void;
3
+ export declare function consoleError(...args: any): void;
@@ -0,0 +1,36 @@
1
+ export declare const SUPPORTED_EXTENSIONS_OBJECT: {
2
+ ".pdf": string;
3
+ ".jpg": string;
4
+ ".jpeg": string;
5
+ ".png": string;
6
+ ".doc": string;
7
+ ".dot": string;
8
+ ".docx": string;
9
+ ".dotx": string;
10
+ ".docm": string;
11
+ ".dotm": string;
12
+ ".xls": string;
13
+ ".xlt": string;
14
+ ".xla": string;
15
+ ".xlsx": string;
16
+ ".xltx": string;
17
+ ".xlsm": string;
18
+ ".xltm": string;
19
+ ".xlam": string;
20
+ ".xlsb": string;
21
+ ".ppt": string;
22
+ ".pot": string;
23
+ ".pps": string;
24
+ ".ppa": string;
25
+ ".pptx": string;
26
+ ".potx": string;
27
+ ".ppsx": string;
28
+ ".ppam": string;
29
+ ".pptm": string;
30
+ ".potm": string;
31
+ ".ppsm": string;
32
+ };
33
+ export declare const SUPPORTED_EXTENSIONS: string[];
34
+ export declare const SUPPORTED_MIME_OBJECT: any;
35
+ export declare const SUPPORTED_MIME_TYPES: string[];
36
+ export declare const SUPPORTED_FILE_LIST: string;
@@ -0,0 +1 @@
1
+ export declare function blobToBase64(blob: Blob): Promise<string>;
@@ -0,0 +1,7 @@
1
+ interface ReturnProps {
2
+ canvas: HTMLCanvasElement;
3
+ context: CanvasRenderingContext2D;
4
+ }
5
+ export declare function getScaledCanvas(img: HTMLImageElement | HTMLCanvasElement, scale?: number, imageSmoothingEnabled?: boolean): ReturnProps;
6
+ export declare function getRotatedImageCanvas(image: HTMLImageElement, angle?: 0 | 90 | 180 | 270): HTMLCanvasElement;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./load-image";
2
+ export * from "./canvas-utils";
3
+ export * from "./blob-to-base64";
@@ -0,0 +1,3 @@
1
+ import { ScaledImage, ScaledImageBinary } from "@/src/types";
2
+ export declare function loadImageBinary(uri: string, type?: string, quality?: number): Promise<ScaledImageBinary>;
3
+ export declare function loadImageBase64(uriBase64: string): Promise<ScaledImage>;
@@ -0,0 +1,6 @@
1
+ export * from "./cn";
2
+ export * from "./api-mocker";
3
+ export * from "./is-filedrop-error";
4
+ export * from "./error-handling";
5
+ export * from "./image-processing";
6
+ export * from "./date";
@@ -0,0 +1,2 @@
1
+ import { FileDropError } from "../types";
2
+ export declare function isFileDropError(error: any): error is FileDropError;
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@osmandvc/react-upload-control",
3
+ "version": "0.2.1",
4
+ "description": "A completely free and open-source file uploader library designed for modern react applications. This package focuses on delivering a feature-rich experience while prioritizing an exceptional developer experience (DX). Whether you're handling simple uploads or complex multi-file scenarios, this library offers powerful customization, seamless integration, and a smooth workflow for developers. Perfect for those who need an efficient, flexible, and easy-to-use file uploader solution in their projects.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "dist/**/*.d.ts",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc && webpack --mode production",
15
+ "start": "webpack serve --mode development",
16
+ "test": "jest",
17
+ "lint": "eslint src/**/*.ts src/**/*.tsx",
18
+ "storybook": "storybook dev -p 6006",
19
+ "build-storybook": "storybook build"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "keywords": [
25
+ "react",
26
+ "react-upload",
27
+ "file-upload",
28
+ "drag-and-drop",
29
+ "upload",
30
+ "typescript",
31
+ "react-component",
32
+ "file-uploader",
33
+ "react18",
34
+ "tailwindcss",
35
+ "camera-upload",
36
+ "image-upload",
37
+ "file-preview",
38
+ "multiple-upload",
39
+ "async-upload"
40
+ ],
41
+ "author": "Osman Deveci",
42
+ "license": "MIT",
43
+ "dependencies": {
44
+ "@dnd-kit/core": "^6.2.0",
45
+ "@dnd-kit/sortable": "^9.0.0",
46
+ "@emotion/react": "^11.13.3",
47
+ "@emotion/styled": "^11.13.0",
48
+ "@radix-ui/react-dialog": "^1.1.2",
49
+ "@radix-ui/react-progress": "^1.1.0",
50
+ "@radix-ui/react-select": "^2.1.2",
51
+ "@radix-ui/react-separator": "^1.1.0",
52
+ "@radix-ui/react-slot": "^1.1.0",
53
+ "@radix-ui/react-tooltip": "^1.1.3",
54
+ "@storybook/addon-styling": "^1.3.7",
55
+ "@tabler/icons-react": "^3.19.0",
56
+ "@types/react": "^18.3.11",
57
+ "@types/react-dom": "^18.3.1",
58
+ "class-variance-authority": "^0.7.0",
59
+ "date-fns": "^4.1.0",
60
+ "filesize": "^10.1.6",
61
+ "kleur": "^4.1.5",
62
+ "nanoid": "^5.0.7",
63
+ "react": "^18.3.1",
64
+ "react-intl": "^6.4.0",
65
+ "react-medium-image-zoom": "^5.2.10",
66
+ "react-spinners": "^0.14.1",
67
+ "react-wrap-balancer": "^1.1.1",
68
+ "sonner": "^1.5.0",
69
+ "tailwind-merge": "^2.5.4",
70
+ "tailwindcss-animate": "^1.0.7",
71
+ "typescript": "^5.6.3",
72
+ "zod": "^3.23.8"
73
+ },
74
+ "devDependencies": {
75
+ "@babel/core": "^7.25.8",
76
+ "@babel/preset-env": "^7.25.8",
77
+ "@babel/preset-react": "^7.25.7",
78
+ "@babel/preset-typescript": "^7.25.7",
79
+ "@chromatic-com/storybook": "^1.9.0",
80
+ "@storybook/addon-essentials": "^8.3.6",
81
+ "@storybook/addon-interactions": "^8.3.6",
82
+ "@storybook/addon-links": "^8.3.6",
83
+ "@storybook/addon-onboarding": "^8.3.6",
84
+ "@storybook/addon-webpack5-compiler-swc": "^1.0.5",
85
+ "@storybook/blocks": "^8.3.6",
86
+ "@storybook/react": "^8.3.6",
87
+ "@storybook/react-webpack5": "^8.3.6",
88
+ "@storybook/test": "^8.3.6",
89
+ "autoprefixer": "^10.4.20",
90
+ "babel-loader": "^9.2.1",
91
+ "chromatic": "^11.20.2",
92
+ "css-loader": "^7.1.2",
93
+ "postcss": "^8.4.47",
94
+ "postcss-loader": "^8.1.1",
95
+ "process": "^0.11.10",
96
+ "storybook": "^8.3.6",
97
+ "style-loader": "^4.0.0",
98
+ "tailwind-scrollbar": "^3.1.0",
99
+ "tailwindcss": "^3.4.14",
100
+ "ts-loader": "^9.5.1",
101
+ "tsconfig-paths-webpack-plugin": "^4.1.0",
102
+ "webpack": "^5.95.0",
103
+ "webpack-bundle-analyzer": "^4.10.2",
104
+ "webpack-cli": "^5.1.4",
105
+ "webpack-dev-server": "^5.1.0"
106
+ }
107
+ }