gantri-components 2.146.0 → 2.147.0-beta.2

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.
@@ -1,6 +1,6 @@
1
1
  import { OptionalValues } from '../../../../../../types/common';
2
2
  import { DeleteFile, FileUploaderProps } from '../../../../file-uploader.types';
3
- export type ThumbnailRenderProps = OptionalValues<Required<Pick<FileUploaderProps, 'SortableDragHandleWrapper' | 'enableCopyUrl' | 'fileUrl' | 'isDisabled' | 'isDraggable' | 'isReplaceable' | 'onClick' | 'thumbnailSize' | 'transformThumbnailSrc'>>> & {
3
+ export type ThumbnailRenderProps = OptionalValues<Required<Pick<FileUploaderProps, 'enableCopyUrl' | 'fileUrl' | 'handleRecoverFile' | 'isDisabled' | 'isDraggable' | 'isReplaceable' | 'onClick' | 'SortableDragHandleWrapper' | 'thumbnailSize' | 'transformThumbnailSrc'>>> & {
4
4
  deleteFile: DeleteFile;
5
5
  handleOpenFileSelect: () => void;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { FileUploaderProps, DeleteFile } from '../../file-uploader.types';
2
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'>>> & {
3
+ export type FileUploaderThumbnailVariantProps = OptionalValues<Required<Pick<FileUploaderProps, 'disabledDescription' | 'enableCopyUrl' | 'fileUrl' | 'handleRecoverFile' | 'isActive' | 'isDisabled' | 'isDraggable' | 'isReplaceable' | 'onClick' | 'processing' | 'SortableDragHandleWrapper' | 'thumbnailSize' | 'transformThumbnailSrc'>>> & {
4
4
  deleteFile: DeleteFile;
5
5
  handleOpenFileSelect: () => void;
6
6
  isDraggingOver: boolean;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { RecoverFileIconPropsDef } from './icon-recover.types';
3
+ export declare const RecoverFileIcon: (props: RecoverFileIconPropsDef) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export type HandleRecoverFileDef = (fileUrl: string) => Promise<void>;
2
+ export interface RecoverFileIconPropsDef {
3
+ fileUrl: string | undefined;
4
+ handleRecoverFile: HandleRecoverFileDef | undefined;
5
+ thumbnailUrl: string | undefined;
6
+ }
@@ -0,0 +1 @@
1
+ export * from './icon-recover';
@@ -5,6 +5,8 @@ export type UploaderActionIconsProps = OptionalValues<{
5
5
  enableCopyUrl: boolean;
6
6
  fileUrl: string;
7
7
  handleOpenFileSelect: () => void;
8
+ handleRecoverFile?: (fileUrl: string) => Promise<void>;
8
9
  isDisabled: boolean;
9
10
  isReplaceable: boolean;
11
+ thumbnailUrl?: string;
10
12
  }>;
@@ -2,6 +2,7 @@ import { FocusEventHandler, HTMLAttributes, PropsWithChildren, ReactNode } from
2
2
  import { ButtonProps } from '../button/button.types';
3
3
  import { BoxProps } from '../box/box.types';
4
4
  import { fileUploaderVariants } from './file-uploader.constants';
5
+ import { HandleRecoverFileDef } from './components/icon-recover/icon-recover.types';
5
6
  export type FileUploaderProps = {
6
7
  /** Any children passed will appear just within the uploader above everything else. Use this for notifications like download toasts. */
7
8
  children?: ReactNode;
@@ -12,6 +13,8 @@ export type FileUploaderProps = {
12
13
  fileUrl: string;
13
14
  /** This function should delete the record from the database, ***then*** delete the file. */
14
15
  handleDeleteFile: HandleDeleteFile;
16
+ /** Provides a method for potential file recovery. */
17
+ handleRecoverFile?: HandleRecoverFileDef;
15
18
  inputName?: string;
16
19
  isActive?: boolean;
17
20
  isDisabled?: boolean;
@@ -73,7 +76,8 @@ export interface SelectedFileDetails {
73
76
  /** If invalid, return the error message to display. */
74
77
  export type ValidateFile = (file: SelectedFileDetails) => Promise<string | undefined | void> | string | undefined | void;
75
78
  export type HandleFileSelected = (validFile: SelectedFileDetails) => Promise<any>;
76
- export type FileUploaderCustomContent = (props: {
79
+ export type FileUploaderCustomContent = (props: FileUploaderCustomContentPropsDef) => JSX.Element;
80
+ export interface FileUploaderCustomContentPropsDef {
77
81
  IconCopyUrl: () => JSX.Element;
78
82
  IconDelete: () => JSX.Element;
79
83
  IconDrag: () => JSX.Element;
@@ -85,7 +89,7 @@ export type FileUploaderCustomContent = (props: {
85
89
  isDisabled: boolean | undefined;
86
90
  isDraggingOver: boolean;
87
91
  processing: boolean;
88
- }) => JSX.Element;
92
+ }
89
93
  export type OnFileUploaderError = (props: {
90
94
  error: unknown;
91
95
  fallbackMessage: string;