diff --git a/src/components/ReactFileUtilities/FileIcon/FileIconSet/v1.tsx b/src/components/ReactFileUtilities/FileIcon/FileIconSet/v1.tsx index 91eedb0ff..d0b4fb52a 100644 --- a/src/components/ReactFileUtilities/FileIcon/FileIconSet/v1.tsx +++ b/src/components/ReactFileUtilities/FileIcon/FileIconSet/v1.tsx @@ -2,9 +2,9 @@ * Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */ -import React, { SVGProps } from 'react'; +import React, { ComponentPropsWithoutRef } from 'react'; -export type IconPropsV1 = { size?: number } & SVGProps; +export type IconPropsV1 = { size?: number } & ComponentPropsWithoutRef<'svg'>; const DEFAULT_SIZE = 20; diff --git a/src/components/ReactFileUtilities/FileIcon/FileIconSet/v2.tsx b/src/components/ReactFileUtilities/FileIcon/FileIconSet/v2.tsx index 92eb56ea7..3fb7a1d87 100644 --- a/src/components/ReactFileUtilities/FileIcon/FileIconSet/v2.tsx +++ b/src/components/ReactFileUtilities/FileIcon/FileIconSet/v2.tsx @@ -1,4 +1,4 @@ -import React, { SVGProps } from 'react'; +import React, { ComponentPropsWithoutRef } from 'react'; export type IconTypeV2 = 'standard' | 'alt'; @@ -6,7 +6,7 @@ export type IconPropsV2 = { mimeType?: string; size?: number; type?: IconTypeV2; -} & SVGProps; +} & ComponentPropsWithoutRef<'svg'>; const DEFAULT_SIZE = 40; diff --git a/src/components/ReactFileUtilities/FileUploadButton.tsx b/src/components/ReactFileUtilities/FileUploadButton.tsx index f28723ef0..4fab9bf34 100644 --- a/src/components/ReactFileUtilities/FileUploadButton.tsx +++ b/src/components/ReactFileUtilities/FileUploadButton.tsx @@ -1,7 +1,7 @@ import React, { PropsWithChildren } from 'react'; -import { AttachmentIcon } from './AttachmentIcon'; -import { useHandleFileChangeWrapper } from './utils'; +import { AttachmentIcon } from './icons'; +import { UploadButton } from './UploadButton'; export type FileUploadButtonProps = { handleFiles: (files: FileList | File[]) => void; @@ -11,6 +11,9 @@ export type FileUploadButtonProps = { resetOnChange?: boolean; }; +/** + * @deprecated will be removed in the next major release + */ export const FileUploadButton = ({ disabled = false, multiple = false, @@ -24,19 +27,17 @@ export const FileUploadButton = ({ className = `${className} rfu-file-upload-button--disabled`; } - const onFileChange = useHandleFileChangeWrapper(resetOnChange, handleFiles); - return (
diff --git a/src/components/ReactFileUtilities/ImagePreviewer.tsx b/src/components/ReactFileUtilities/ImagePreviewer.tsx index 957fdb401..74c925b61 100644 --- a/src/components/ReactFileUtilities/ImagePreviewer.tsx +++ b/src/components/ReactFileUtilities/ImagePreviewer.tsx @@ -3,7 +3,7 @@ import React, { MouseEvent, useCallback } from 'react'; import { LoadingIndicator } from './LoadingIndicator'; import { Thumbnail } from './Thumbnail'; import { ThumbnailPlaceholder } from './ThumbnailPlaceholder'; -import { RetryIcon } from './RetryIcon'; +import { RetryIcon } from './icons'; import type { ImageUpload } from './types'; import clsx from 'clsx'; diff --git a/src/components/ReactFileUtilities/ImageUploadButton.tsx b/src/components/ReactFileUtilities/ImageUploadButton.tsx index f7c5645b9..900d62780 100644 --- a/src/components/ReactFileUtilities/ImageUploadButton.tsx +++ b/src/components/ReactFileUtilities/ImageUploadButton.tsx @@ -1,7 +1,7 @@ import React, { PropsWithChildren } from 'react'; -import { PictureIcon } from './PictureIcon'; -import { useHandleFileChangeWrapper } from './utils'; +import { PictureIcon } from './icons'; +import { UploadButton } from './UploadButton'; export type ImageUploadButtonProps = { handleFiles: (files: File[]) => void; @@ -10,29 +10,28 @@ export type ImageUploadButtonProps = { resetOnChange?: boolean; }; +/** + * @deprecated will be removed in the next major release + */ export const ImageUploadButton = ({ multiple = false, disabled = false, handleFiles, children = , resetOnChange = false, -}: PropsWithChildren) => { - const onFileChange = useHandleFileChangeWrapper(resetOnChange, handleFiles); - - return ( -
- -
- ); -}; +}: PropsWithChildren) => ( +
+ +
+); diff --git a/src/components/ReactFileUtilities/Thumbnail.tsx b/src/components/ReactFileUtilities/Thumbnail.tsx index ae8aa2cf8..0c8e56fd4 100644 --- a/src/components/ReactFileUtilities/Thumbnail.tsx +++ b/src/components/ReactFileUtilities/Thumbnail.tsx @@ -1,8 +1,7 @@ import React, { MouseEventHandler, useCallback } from 'react'; import { IconButton } from './IconButton'; -import { FilePlaceholder } from './FilePlaceholder'; -import { CloseIcon } from './CloseIcon'; +import { CloseIcon, FilePlaceholderIcon } from './icons'; export type ThumbnailProps = { image: string; @@ -30,7 +29,10 @@ export const Thumbnail = ({ alt, handleClose, image, size = 100 }: ThumbnailProp {image ? ( {alt ) : ( - + )}
); diff --git a/src/components/ReactFileUtilities/AttachmentIcon.tsx b/src/components/ReactFileUtilities/icons/AttachmentIcon.tsx similarity index 100% rename from src/components/ReactFileUtilities/AttachmentIcon.tsx rename to src/components/ReactFileUtilities/icons/AttachmentIcon.tsx diff --git a/src/components/ReactFileUtilities/CloseIcon.tsx b/src/components/ReactFileUtilities/icons/CloseIcon.tsx similarity index 100% rename from src/components/ReactFileUtilities/CloseIcon.tsx rename to src/components/ReactFileUtilities/icons/CloseIcon.tsx diff --git a/src/components/ReactFileUtilities/FilePlaceholder.tsx b/src/components/ReactFileUtilities/icons/FilePlaceholderIcon.tsx similarity index 96% rename from src/components/ReactFileUtilities/FilePlaceholder.tsx rename to src/components/ReactFileUtilities/icons/FilePlaceholderIcon.tsx index 0ac9ef0f7..03bd41529 100644 --- a/src/components/ReactFileUtilities/FilePlaceholder.tsx +++ b/src/components/ReactFileUtilities/icons/FilePlaceholderIcon.tsx @@ -1,6 +1,6 @@ -import React, { SVGProps } from 'react'; +import React, { ComponentPropsWithoutRef } from 'react'; -export const FilePlaceholder = (props: SVGProps) => ( +export const FilePlaceholderIcon = (props: ComponentPropsWithoutRef<'svg'>) => (