gantri-components 2.127.0 → 2.128.1
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/components/color-picker/components/color-picker-item/color-picker-item.styles.d.ts +1 -0
- package/dist/components/file-uploader/components/configured-custom-content/configured-custom-content.d.ts +3 -0
- package/dist/components/file-uploader/components/configured-custom-content/configured-custom-content.types.d.ts +7 -0
- package/dist/components/file-uploader/components/configured-custom-content/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-button-variant/file-uploader-button-variant.d.ts +3 -0
- package/dist/components/file-uploader/components/file-uploader-button-variant/file-uploader-button-variant.types.d.ts +5 -0
- package/dist/components/file-uploader/components/file-uploader-button-variant/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-link-variant/file-uploader-link-variant.d.ts +3 -0
- package/dist/components/file-uploader/components/file-uploader-link-variant/file-uploader-link-variant.types.d.ts +5 -0
- package/dist/components/file-uploader/components/file-uploader-link-variant/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-plain-variant/file-uploader-plain-variant.d.ts +3 -0
- package/dist/components/file-uploader/components/file-uploader-plain-variant/file-uploader-plain-variant.types.d.ts +5 -0
- package/dist/components/file-uploader/components/file-uploader-plain-variant/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/index.d.ts +2 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-render/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-render/thumbnail-render.d.ts +3 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-render/thumbnail-render.types.d.ts +6 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-upload/index.d.ts +1 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-upload/thumbnail-upload.d.ts +3 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/components/thumbnail-upload/thumbnail-upload.types.d.ts +5 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/file-uploader-thumbnail-variant.d.ts +6 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/file-uploader-thumbnail-variant.presets.d.ts +2 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/file-uploader-thumbnail-variant.styles.d.ts +20 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/file-uploader-thumbnail-variant.types.d.ts +7 -0
- package/dist/components/file-uploader/components/file-uploader-thumbnail-variant/index.d.ts +1 -0
- package/dist/components/file-uploader/components/icon-copy-url/icon-copy-url.d.ts +3 -0
- package/dist/components/file-uploader/components/icon-copy-url/icon-copy-url.types.d.ts +4 -0
- package/dist/components/file-uploader/components/icon-copy-url/index.d.ts +1 -0
- package/dist/components/file-uploader/components/icon-delete/icon-delete.d.ts +3 -0
- package/dist/components/file-uploader/components/icon-delete/icon-delete.types.d.ts +5 -0
- package/dist/components/file-uploader/components/icon-delete/index.d.ts +1 -0
- package/dist/components/file-uploader/components/icon-drag/icon-drag.d.ts +3 -0
- package/dist/components/file-uploader/components/icon-drag/icon-drag.types.d.ts +3 -0
- package/dist/components/file-uploader/components/icon-drag/index.d.ts +1 -0
- package/dist/components/file-uploader/components/icon-replace/icon-replace.d.ts +3 -0
- package/dist/components/file-uploader/components/icon-replace/icon-replace.types.d.ts +4 -0
- package/dist/components/file-uploader/components/icon-replace/index.d.ts +1 -0
- package/dist/components/file-uploader/components/index.d.ts +6 -0
- package/dist/components/file-uploader/components/uploader-actions/index.d.ts +1 -0
- package/dist/components/file-uploader/components/uploader-actions/uploader-actions.d.ts +3 -0
- package/dist/components/file-uploader/components/uploader-actions/uploader-actions.types.d.ts +9 -0
- package/dist/components/file-uploader/file-uploader.constants.d.ts +9 -0
- package/dist/components/file-uploader/file-uploader.d.ts +6 -0
- package/dist/components/file-uploader/file-uploader.presets.d.ts +2 -0
- package/dist/components/file-uploader/file-uploader.styles.d.ts +7 -0
- package/dist/components/file-uploader/file-uploader.types.d.ts +137 -0
- package/dist/components/file-uploader/helpers/get-base-64-from-blob/get-base-64-from-blob.d.ts +1 -0
- package/dist/components/file-uploader/helpers/get-base-64-from-blob/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/get-purified-file-name/get-purified-file-name.d.ts +1 -0
- package/dist/components/file-uploader/helpers/get-purified-file-name/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/get-valid-files/get-valid-files.d.ts +2 -0
- package/dist/components/file-uploader/helpers/get-valid-files/get-valid-files.types.d.ts +5 -0
- package/dist/components/file-uploader/helpers/get-valid-files/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/index.d.ts +6 -0
- package/dist/components/file-uploader/helpers/transform-file-name/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/transform-file-name/transform-file-name.d.ts +4 -0
- package/dist/components/file-uploader/helpers/validate-file-size/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/validate-file-size/validate-file-size.d.ts +3 -0
- package/dist/components/file-uploader/helpers/validate-file-size/validate-file-size.types.d.ts +5 -0
- package/dist/components/file-uploader/helpers/validate-image-dimensions/index.d.ts +1 -0
- package/dist/components/file-uploader/helpers/validate-image-dimensions/validate-image-dimensions.d.ts +3 -0
- package/dist/components/file-uploader/helpers/validate-image-dimensions/validate-image-dimensions.types.d.ts +6 -0
- package/dist/components/file-uploader/hooks/index.d.ts +2 -0
- package/dist/components/file-uploader/hooks/use-drag-and-drop-files/index.d.ts +1 -0
- package/dist/components/file-uploader/hooks/use-drag-and-drop-files/use-drag-and-drop-files.d.ts +8 -0
- package/dist/components/file-uploader/hooks/use-drag-and-drop-files/use-drag-and-drop-files.types.d.ts +4 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/hooks/use-handle-selected-files/index.d.ts +1 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/hooks/use-handle-selected-files/use-handle-selected-files.d.ts +2 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/hooks/use-handle-selected-files/use-handle-selected-files.types.d.ts +14 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/index.d.ts +1 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/use-uploader-actions.d.ts +8 -0
- package/dist/components/file-uploader/hooks/use-uploader-actions/use-uploader-actions.types.d.ts +5 -0
- package/dist/components/file-uploader/index.d.ts +4 -0
- package/dist/components/filter-button/filter-button.types.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/pills/components/pill/pill.types.d.ts +1 -0
- package/dist/components/table/components/selectable-row-checkbox-wrapper/selectable-row-checkbox-wrapper.types.d.ts +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/common.d.ts +4 -1
- package/package.json +4 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileUploaderProps } from '../../file-uploader.types';
|
|
2
|
+
import { OptionalValues } from '../../../../types/common';
|
|
3
|
+
export type ConfiguredCustomContentProps = OptionalValues<Pick<FileUploaderProps, 'CustomContent' | 'enableCopyUrl' | 'fileName' | 'fileUrl' | 'isDraggable' | 'isReplaceable' | 'processing' | 'SortableDragHandleWrapper'>> & {
|
|
4
|
+
deleteFile: () => Promise<void>;
|
|
5
|
+
handleOpenFileSelect: () => void;
|
|
6
|
+
isDraggingOver: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './configured-custom-content';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OptionalValues } from '../../../../types/common';
|
|
2
|
+
import { FileUploaderProps } from '../../file-uploader.types';
|
|
3
|
+
export type FileUploaderButtonVariantProps = OptionalValues<Required<Pick<FileUploaderProps, 'buttonProps' | 'disabledDescription' | 'isDisabled' | 'onBlur' | 'onClick'>>> & {
|
|
4
|
+
handleOpenFileSelect: () => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-uploader-button-variant';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileUploaderProps, DeleteFile } from '../../file-uploader.types';
|
|
2
|
+
export type FileUploaderLinkVariantProps = Pick<FileUploaderProps, 'enableCopyUrl' | 'fileName' | 'fileUrl' | 'isReplaceable' | 'onClick'> & {
|
|
3
|
+
deleteFile: DeleteFile;
|
|
4
|
+
handleOpenFileSelect: () => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-uploader-link-variant';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeleteFile, FileUploaderProps } from '../../file-uploader.types';
|
|
2
|
+
export type FileUploaderPlainVariantProps = Pick<FileUploaderProps, 'enableCopyUrl' | 'fileName' | 'fileUrl' | 'isReplaceable' | 'onClick'> & {
|
|
3
|
+
deleteFile: DeleteFile;
|
|
4
|
+
handleOpenFileSelect: () => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-uploader-plain-variant';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './thumbnail-render';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OptionalValues } from '../../../../../../types/common';
|
|
2
|
+
import { DeleteFile, FileUploaderProps } from '../../../../file-uploader.types';
|
|
3
|
+
export type ThumbnailRenderProps = OptionalValues<Required<Pick<FileUploaderProps, 'SortableDragHandleWrapper' | 'enableCopyUrl' | 'fileUrl' | 'isDraggable' | 'isReplaceable' | 'onClick' | 'thumbnailSize' | 'transformThumbnailSrc'>>> & {
|
|
4
|
+
deleteFile: DeleteFile;
|
|
5
|
+
handleOpenFileSelect: () => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './thumbnail-upload';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OptionalValues } from '../../../../../../types/common';
|
|
2
|
+
import { FileUploaderProps } from '../../../../file-uploader.types';
|
|
3
|
+
export type ThumbnailUploadProps = OptionalValues<Required<Pick<FileUploaderProps, 'isDisabled' | 'processing'>>> & {
|
|
4
|
+
isDraggingOver: boolean;
|
|
5
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileUploaderThumbnailVariantProps } from './file-uploader-thumbnail-variant.types';
|
|
3
|
+
export declare const FileUploaderThumbnailVariant: {
|
|
4
|
+
(props: FileUploaderThumbnailVariantProps): React.JSX.Element;
|
|
5
|
+
defaultProps: Pick<FileUploaderThumbnailVariantProps, "thumbnailSize">;
|
|
6
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '../../../box/box.types';
|
|
3
|
+
import { OptionalValues } from '../../../../types/common';
|
|
4
|
+
export declare const StyledThumbnailWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<BoxProps & import("react").RefAttributes<BoxProps>, "ref"> & {
|
|
5
|
+
ref?: ((instance: BoxProps | null) => void) | import("react").RefObject<BoxProps> | null | undefined;
|
|
6
|
+
}, OptionalValues<{
|
|
7
|
+
$fileUrl: string;
|
|
8
|
+
$isActive: boolean;
|
|
9
|
+
$isDisabled: boolean;
|
|
10
|
+
$isDraggingOver: boolean;
|
|
11
|
+
}, undefined>>> & string & Omit<import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<BoxProps>>, keyof import("react").Component<any, {}, any>>;
|
|
12
|
+
export declare const StyledThumbnailIconsFlex: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("../../../flex/flex.types").FlexProps & import("react").RefAttributes<import("../../../flex/flex.types").FlexProps>, "ref"> & {
|
|
13
|
+
ref?: ((instance: import("../../../flex/flex.types").FlexProps | null) => void) | import("react").RefObject<import("../../../flex/flex.types").FlexProps> | null | undefined;
|
|
14
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("../../../flex/flex.types").FlexProps & import("react").RefAttributes<import("../../../flex/flex.types").FlexProps>>, keyof import("react").Component<any, {}, any>>;
|
|
15
|
+
export declare const StyledThumbnailImgBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<BoxProps & import("react").RefAttributes<BoxProps>, "ref"> & {
|
|
16
|
+
ref?: ((instance: BoxProps | null) => void) | import("react").RefObject<BoxProps> | null | undefined;
|
|
17
|
+
}, OptionalValues<{
|
|
18
|
+
$backgroundImage: string;
|
|
19
|
+
onClick: BoxProps['onClick'];
|
|
20
|
+
}, undefined>>> & string & Omit<import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<BoxProps>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileUploaderProps, DeleteFile } from '../../file-uploader.types';
|
|
2
|
+
import { OptionalValues } from '../../../../types/common';
|
|
3
|
+
export type FileUploaderThumbnailVariantProps = OptionalValues<Required<Pick<FileUploaderProps, 'SortableDragHandleWrapper' | 'disabledDescription' | 'enableCopyUrl' | 'fileUrl' | 'isActive' | 'isDisabled' | 'isDraggable' | 'isReplaceable' | 'onClick' | 'processing' | 'thumbnailSize' | 'transformThumbnailSrc'>>> & {
|
|
4
|
+
deleteFile: DeleteFile;
|
|
5
|
+
handleOpenFileSelect: () => void;
|
|
6
|
+
isDraggingOver: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-uploader-thumbnail-variant';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon-copy-url';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon-delete';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon-drag';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './icon-replace';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './configured-custom-content';
|
|
2
|
+
export * from './file-uploader-button-variant';
|
|
3
|
+
export * from './file-uploader-link-variant';
|
|
4
|
+
export * from './file-uploader-plain-variant';
|
|
5
|
+
export * from './file-uploader-thumbnail-variant';
|
|
6
|
+
export * from './uploader-actions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './uploader-actions';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeleteFile } from '../../file-uploader.types';
|
|
2
|
+
import { OptionalValues } from '../../../../types/common';
|
|
3
|
+
export type UploaderActionIconsProps = OptionalValues<{
|
|
4
|
+
deleteFile: DeleteFile;
|
|
5
|
+
enableCopyUrl: boolean;
|
|
6
|
+
fileUrl: string;
|
|
7
|
+
handleOpenFileSelect: () => void;
|
|
8
|
+
isReplaceable: boolean;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const defaultImageExtensions: readonly ["gif", "jpeg", "jpg", "png", "webp"];
|
|
2
|
+
export declare const fileUploaderVariants: {
|
|
3
|
+
readonly button: "button";
|
|
4
|
+
readonly custom: "custom";
|
|
5
|
+
readonly link: "link";
|
|
6
|
+
readonly plain: "plain";
|
|
7
|
+
readonly thumbnail: "thumbnail";
|
|
8
|
+
};
|
|
9
|
+
export declare const oneMegabyteInBytes = 1048576;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OptionalValues } from '../../types/common';
|
|
3
|
+
export declare const StyledFileInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, OptionalValues<{
|
|
4
|
+
$fileUrl: string;
|
|
5
|
+
$isDisabled: boolean;
|
|
6
|
+
$isThumbnail: boolean;
|
|
7
|
+
}, undefined>>> & string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { FocusEventHandler, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../button/button.types';
|
|
3
|
+
import { BoxProps } from '../box/box.types';
|
|
4
|
+
import { fileUploaderVariants } from './file-uploader.constants';
|
|
5
|
+
export type FileUploaderProps = {
|
|
6
|
+
/** Any children passed will appear just within the uploader above everything else. Use this for notifications like download toasts. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
disabledDescription?: string;
|
|
10
|
+
enableCopyUrl?: boolean;
|
|
11
|
+
fileName: string;
|
|
12
|
+
fileUrl: string;
|
|
13
|
+
/** This function should delete the record from the database, ***then*** delete the file. */
|
|
14
|
+
handleDeleteFile: HandleDeleteFile;
|
|
15
|
+
/** Provide this if supporting multiple uploads to prevent multiple calls to update the database. */
|
|
16
|
+
handleUploadsComplete: HandleUploadsComplete;
|
|
17
|
+
inputName?: string;
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/** Use with variant `'thumbnail'` to always show the uploader view. */
|
|
21
|
+
isUploaderOnly?: boolean;
|
|
22
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
23
|
+
onClick?: BoxProps['onClick'];
|
|
24
|
+
onError: OnFileUploaderError;
|
|
25
|
+
/** Used to show loading indicator for `'thumbnail'` variant. For the `'button'` variant, it can be passed here or as part of `buttonProps`. */
|
|
26
|
+
processing: boolean;
|
|
27
|
+
purifyFileName?: boolean;
|
|
28
|
+
/** Sets the size of the thumbnail variant box. */
|
|
29
|
+
thumbnailSize?: BoxProps['width'];
|
|
30
|
+
transformThumbnailSrc?: TransformThumbnailSrc;
|
|
31
|
+
/** If invalid, return the error message to display. */
|
|
32
|
+
validateFile?: ValidateFile;
|
|
33
|
+
/** The 'link' and 'plain' variants will show the 'button' variant if nothing has been uploaded yet. */
|
|
34
|
+
variant: FileUploaderVariant;
|
|
35
|
+
} & Partial<FileUploaderDefaultProps> & (WithDraggableProps | WithoutDraggableProps) & (WithReplaceableProps | WithoutReplaceableProps) & (ImmediatelyUploadProps | DelayUploadProps) & (WithCustomContent | WithoutCustomContent);
|
|
36
|
+
export type FileUploaderVariant = (typeof fileUploaderVariants)[keyof typeof fileUploaderVariants];
|
|
37
|
+
export type HandleDeleteFile = (props: HandleFileDeleteArgs) => Promise<void>;
|
|
38
|
+
export type HandleFileDeleteArgs = {
|
|
39
|
+
fileName: string;
|
|
40
|
+
fileUrl: string;
|
|
41
|
+
isReplacing: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** This is the simplified file deletion function which calls `handleDeleteFile` and handles state management. */
|
|
44
|
+
export type DeleteFile = (options?: {
|
|
45
|
+
isReplacing?: boolean;
|
|
46
|
+
}) => Promise<void>;
|
|
47
|
+
export type HandleUploadFile = (props: SelectedFileDetails) => Promise<UploadedFileDetails>;
|
|
48
|
+
export type HandleUploadsComplete<Data = Record<string, any>> = (uploadedFiles: UploadedFileDetails<Data>[]) => Promise<void>;
|
|
49
|
+
export type UploadedFileDetails<Data = Record<string, any>> = Data & {
|
|
50
|
+
fileName: string;
|
|
51
|
+
fileUrl: string;
|
|
52
|
+
};
|
|
53
|
+
/** Applicable to Firebase uploads. */
|
|
54
|
+
export interface FileMetaData {
|
|
55
|
+
contentType: string;
|
|
56
|
+
name: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SelectedFileDetails {
|
|
59
|
+
fileBlob: Blob;
|
|
60
|
+
fileName: string;
|
|
61
|
+
fileSize: number;
|
|
62
|
+
metadata: FileMetaData;
|
|
63
|
+
}
|
|
64
|
+
/** If invalid, return the error message to display. */
|
|
65
|
+
export type ValidateFile = (file: SelectedFileDetails) => string | undefined | void;
|
|
66
|
+
export type HandleFileSelected = (props: SelectedFileDetails) => Promise<any>;
|
|
67
|
+
export type FileUploaderCustomContent = (props: {
|
|
68
|
+
IconCopyUrl: () => JSX.Element;
|
|
69
|
+
IconDelete: () => JSX.Element;
|
|
70
|
+
IconDrag: () => JSX.Element;
|
|
71
|
+
IconReplace: () => JSX.Element;
|
|
72
|
+
UploaderActionIcons: () => JSX.Element;
|
|
73
|
+
fileName: string;
|
|
74
|
+
fileUrl: string;
|
|
75
|
+
handleOpenFileSelect: () => void;
|
|
76
|
+
isDraggingOver: boolean;
|
|
77
|
+
processing: boolean;
|
|
78
|
+
}) => JSX.Element;
|
|
79
|
+
export type OnFileUploaderError = (props: {
|
|
80
|
+
error: unknown;
|
|
81
|
+
fallbackMessage: string;
|
|
82
|
+
}) => void;
|
|
83
|
+
export type TransformThumbnailSrc = (props: {
|
|
84
|
+
size: number;
|
|
85
|
+
src: string;
|
|
86
|
+
}) => string;
|
|
87
|
+
type ImmediatelyUploadProps = {
|
|
88
|
+
handleFileSelected?: never;
|
|
89
|
+
handleUploadFile: HandleUploadFile;
|
|
90
|
+
};
|
|
91
|
+
type DelayUploadProps = {
|
|
92
|
+
handleFileSelected: HandleFileSelected;
|
|
93
|
+
handleUploadFile?: never;
|
|
94
|
+
};
|
|
95
|
+
type WithDraggableProps = {
|
|
96
|
+
SortableDragHandleWrapper: (props: PropsWithChildren<HTMLAttributes<HTMLElement>>) => JSX.Element;
|
|
97
|
+
isDraggable: boolean;
|
|
98
|
+
};
|
|
99
|
+
type WithoutDraggableProps = {
|
|
100
|
+
SortableDragHandleWrapper?: never;
|
|
101
|
+
isDraggable?: never;
|
|
102
|
+
};
|
|
103
|
+
type WithReplaceableProps = {
|
|
104
|
+
isReplaceable: boolean;
|
|
105
|
+
};
|
|
106
|
+
type WithoutReplaceableProps = {
|
|
107
|
+
isReplaceable?: never;
|
|
108
|
+
onReplace?: never;
|
|
109
|
+
};
|
|
110
|
+
type WithCustomContent = {
|
|
111
|
+
CustomContent: FileUploaderCustomContent;
|
|
112
|
+
variant: 'custom';
|
|
113
|
+
};
|
|
114
|
+
type WithoutCustomContent = {
|
|
115
|
+
CustomContent?: never | undefined;
|
|
116
|
+
variant: FileUploaderVariant;
|
|
117
|
+
};
|
|
118
|
+
export type FileUploaderDefaultProps = {
|
|
119
|
+
buttonProps?: Partial<ButtonProps>;
|
|
120
|
+
/** Set to `null` or `[]` to allow all file types. */
|
|
121
|
+
expectedExtensions: string[];
|
|
122
|
+
maxFileSizeMB: number;
|
|
123
|
+
/** Set this to allow multiple uploads at once. */
|
|
124
|
+
maxUploadsAllowed: number;
|
|
125
|
+
minImageHeight: number;
|
|
126
|
+
minImageWidth: number;
|
|
127
|
+
transformFileName: TransformFileName;
|
|
128
|
+
};
|
|
129
|
+
export type TransformFileName = (props: {
|
|
130
|
+
/** If used, `file_name.extension` becomes`file_name_[TIMESTAMP].extension`. */
|
|
131
|
+
applyUuid: (fileName: string) => string;
|
|
132
|
+
/** The original file name of the uploaded file. */
|
|
133
|
+
fileName: string;
|
|
134
|
+
/** If used, `file name.extension` becomes `file_name.extension`. */
|
|
135
|
+
removeWhitespace: (fileName: string) => string;
|
|
136
|
+
}) => string;
|
|
137
|
+
export {};
|
package/dist/components/file-uploader/helpers/get-base-64-from-blob/get-base-64-from-blob.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBase64FromBlob: (blob: Blob) => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-base-64-from-blob';
|
package/dist/components/file-uploader/helpers/get-purified-file-name/get-purified-file-name.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getPurifiedFileName: (fileName: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getPurifiedFileName: (fileName: string) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileUploaderProps } from '../../file-uploader.types';
|
|
2
|
+
import { OptionalValues } from '../../../../types/common';
|
|
3
|
+
export type GetValidFilesProps = OptionalValues<Pick<FileUploaderProps, 'expectedExtensions' | 'maxFileSizeMB' | 'maxUploadsAllowed' | 'minImageHeight' | 'minImageWidth' | 'onError' | 'transformFileName' | 'validateFile'>> & {
|
|
4
|
+
files: File[];
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-valid-files';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transform-file-name';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TransformFileName } from '../../file-uploader.types';
|
|
2
|
+
export declare const applyUuidDefault: (fileName: string) => string;
|
|
3
|
+
export declare const removeWhitespaceDefault: (fileName: string) => string;
|
|
4
|
+
export declare const transformFileNameDefault: TransformFileName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validate-file-size';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validate-image-dimensions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-drag-and-drop-files';
|
package/dist/components/file-uploader/hooks/use-drag-and-drop-files/use-drag-and-drop-files.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
import { UseDragAndDropFilesProps } from './use-drag-and-drop-files.types';
|
|
3
|
+
export declare const useDragAndDropFiles: (props: UseDragAndDropFilesProps) => {
|
|
4
|
+
isDraggingOver: boolean;
|
|
5
|
+
onDragEnter: (event: DragEvent<HTMLInputElement>) => void;
|
|
6
|
+
onDragLeave: (event: DragEvent<HTMLInputElement>) => void;
|
|
7
|
+
onDrop: (event: DragEvent<HTMLInputElement>) => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-handle-selected-files';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { SelectedFileDetails, FileUploaderProps } from '../../../../file-uploader.types';
|
|
3
|
+
import { OptionalValues } from '../../../../../../types/common';
|
|
4
|
+
export type UseHandleSelectedFilesProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileUrl' | 'handleFileSelected' | 'handleUploadsComplete' | 'isUploaderOnly' | 'maxFileSizeMB' | 'maxUploadsAllowed' | 'minImageHeight' | 'minImageWidth' | 'onError' | 'transformFileName' | 'validateFile'>>> & {
|
|
5
|
+
purgeInput: () => void;
|
|
6
|
+
setFileName: Dispatch<SetStateAction<string>>;
|
|
7
|
+
setFileUrl: Dispatch<SetStateAction<string>>;
|
|
8
|
+
setIsFilePendingUpload: Dispatch<SetStateAction<boolean>>;
|
|
9
|
+
uploadFile: (props: SelectedFileDetails) => Promise<{
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
fileName: string;
|
|
12
|
+
fileUrl: string;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-uploader-actions';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DeleteFile } from '../../file-uploader.types';
|
|
2
|
+
import { UseUploadActionsProps } from './use-uploader-actions.types';
|
|
3
|
+
export declare const useUploaderActions: (props: UseUploadActionsProps) => {
|
|
4
|
+
deleteFile: DeleteFile;
|
|
5
|
+
fileUrl: string;
|
|
6
|
+
handleSelectedFiles: (files: File[]) => Promise<void>;
|
|
7
|
+
purifiedFileName: string;
|
|
8
|
+
};
|
package/dist/components/file-uploader/hooks/use-uploader-actions/use-uploader-actions.types.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileUploaderProps } from '../../file-uploader.types';
|
|
2
|
+
import { OptionalValues } from '../../../../types/common';
|
|
3
|
+
export type UseUploadActionsProps = OptionalValues<Required<Pick<FileUploaderProps, 'expectedExtensions' | 'fileName' | 'fileUrl' | 'handleDeleteFile' | 'handleFileSelected' | 'handleUploadsComplete' | 'handleUploadFile' | 'isUploaderOnly' | 'maxUploadsAllowed' | 'onError' | 'purifyFileName' | 'transformFileName' | 'validateFile'>>> & Partial<Pick<FileUploaderProps, 'maxFileSizeMB' | 'minImageHeight' | 'minImageWidth'>> & {
|
|
4
|
+
purgeInput: () => void;
|
|
5
|
+
};
|
|
@@ -13,6 +13,7 @@ export * from './conditional';
|
|
|
13
13
|
export * from './confirmation-modal';
|
|
14
14
|
export * from './dropdown-menu';
|
|
15
15
|
export * from './dropdown';
|
|
16
|
+
export * from './file-uploader';
|
|
16
17
|
export * from './filter-button';
|
|
17
18
|
export * from './flex';
|
|
18
19
|
export * from './formik-input';
|