diff --git a/packages/ui/upload-paste/types/index.d.ts b/packages/ui/upload-paste/types/index.d.ts index e2b62918e..8b0d01e27 100644 --- a/packages/ui/upload-paste/types/index.d.ts +++ b/packages/ui/upload-paste/types/index.d.ts @@ -18,9 +18,9 @@ export interface PasteProps extends UploadOptions, PasteCompProps {} export type PasteUploadHookResult = { toggle: () => boolean, getIsEnabled: () => boolean}; export const usePasteUpload: ( - uploadOptions: UploadOptions, - element: React.RefObject, - onPasteUpload: PasteUploadHandler + uploadOptions?: UploadOptions | null | undefined, + element?: React.RefObject | null | undefined, + onPasteUpload?: PasteUploadHandler ) => PasteUploadHookResult; export const withPasteUpload: (component: React.ForwardRefExoticComponent | React.ComponentType) => React.FC; diff --git a/packages/ui/upload-paste/types/index.test-d.tsx b/packages/ui/upload-paste/types/index.test-d.tsx index 44f06d33b..b1ac4940e 100644 --- a/packages/ui/upload-paste/types/index.test-d.tsx +++ b/packages/ui/upload-paste/types/index.test-d.tsx @@ -29,7 +29,33 @@ const TestPasteUpload: React.FC = () => { ; }; +const TestWindowPasteUpload: React.FC = () => { + const { toggle, getIsEnabled } = usePasteUpload(); + + return ( +
+ paste anywhere on this page + + enabled: {getIsEnabled()} +
+ ); +}; + +const TestWithJustOptions: React.FC = () => { + const { toggle, getIsEnabled } = usePasteUpload({ autoUpload: false }); + + return ( +
+ paste anywhere on this page + + enabled: {getIsEnabled()} +
+ ); +}; + export { TestWithPasteUpload, TestPasteUpload, + TestWindowPasteUpload, + TestWithJustOptions, };