@aws-amplify/ui-react-storage 2.2.0 → 2.3.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.
Files changed (29) hide show
  1. package/dist/esm/components/StorageManager/StorageManager.mjs +1 -1
  2. package/dist/esm/components/StorageManager/hooks/useStorageManager/actions.mjs +1 -1
  3. package/dist/esm/components/StorageManager/hooks/useStorageManager/reducer.mjs +1 -1
  4. package/dist/esm/components/StorageManager/hooks/useStorageManager/types.mjs +1 -1
  5. package/dist/esm/components/StorageManager/hooks/useStorageManager/useStorageManager.mjs +1 -1
  6. package/dist/esm/components/StorageManager/types.mjs +1 -1
  7. package/dist/esm/components/StorageManager/ui/FileListFooter/FileListFooter.mjs +1 -0
  8. package/dist/esm/components/StorageManager/ui/FileListHeader/FileListHeader.mjs +1 -1
  9. package/dist/esm/components/StorageManager/utils/displayText.mjs +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/styles.css +472 -199
  12. package/dist/types/components/StorageManager/StorageManager.d.ts +2 -1
  13. package/dist/types/components/StorageManager/hooks/index.d.ts +0 -1
  14. package/dist/types/components/StorageManager/hooks/useStorageManager/actions.d.ts +2 -1
  15. package/dist/types/components/StorageManager/hooks/useStorageManager/types.d.ts +5 -0
  16. package/dist/types/components/StorageManager/hooks/useStorageManager/useStorageManager.d.ts +3 -1
  17. package/dist/types/components/StorageManager/index.d.ts +1 -1
  18. package/dist/types/components/StorageManager/types.d.ts +7 -1
  19. package/dist/types/components/StorageManager/ui/FileListFooter/FileListFooter.d.ts +9 -0
  20. package/dist/types/components/StorageManager/ui/FileListFooter/index.d.ts +1 -0
  21. package/dist/types/components/StorageManager/ui/FileListHeader/FileListHeader.d.ts +4 -3
  22. package/dist/types/components/StorageManager/ui/index.d.ts +1 -0
  23. package/dist/types/components/StorageManager/utils/displayText.d.ts +1 -0
  24. package/dist/types/components/index.d.ts +1 -1
  25. package/dist/types/index.d.ts +1 -1
  26. package/package.json +4 -4
  27. package/dist/esm/components/StorageManager/hooks/useDropZone/useDropZone.mjs +0 -1
  28. package/dist/types/components/StorageManager/hooks/useDropZone/index.d.ts +0 -1
  29. package/dist/types/components/StorageManager/hooks/useDropZone/useDropZone.d.ts +0 -13
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { StorageManagerProps, StorageManagerHandle } from './types';
3
- import { Container, DropZone, FileList, FileListHeader, FilePicker } from './ui';
3
+ import { Container, DropZone, FileList, FileListHeader, FileListFooter, FilePicker } from './ui';
4
4
  declare const StorageManager: React.ForwardRefExoticComponent<StorageManagerProps & React.RefAttributes<StorageManagerHandle>> & {
5
5
  Container: typeof Container;
6
6
  DropZone: typeof DropZone;
7
7
  FileList: typeof FileList;
8
8
  FileListHeader: typeof FileListHeader;
9
+ FileListFooter: typeof FileListFooter;
9
10
  FilePicker: typeof FilePicker;
10
11
  };
11
12
  export { StorageManager };
@@ -1,3 +1,2 @@
1
- export { useDropZone } from './useDropZone';
2
1
  export { useStorageManager, UseStorageManager } from './useStorageManager';
3
2
  export { useUploadFiles } from './useUploadFiles';
@@ -1,8 +1,9 @@
1
1
  import { UploadTask } from '@aws-amplify/storage';
2
2
  import { FileStatus } from '../../types';
3
3
  import { Action, AddFilesActionParams } from './types';
4
- export declare const addFilesAction: ({ files, getFileErrorMessage, }: AddFilesActionParams) => Action;
4
+ export declare const addFilesAction: ({ files, status, getFileErrorMessage, }: AddFilesActionParams) => Action;
5
5
  export declare const clearFilesAction: () => Action;
6
+ export declare const queueFilesAction: () => Action;
6
7
  export declare const setUploadingFileAction: ({ id, uploadTask, }: {
7
8
  id: string;
8
9
  uploadTask: UploadTask | undefined;
@@ -6,6 +6,7 @@ export interface UseStorageManagerState {
6
6
  export declare enum StorageManagerActionTypes {
7
7
  ADD_FILES = "ADD_FILES",
8
8
  CLEAR_FILES = "CLEAR_FILES",
9
+ QUEUE_FILES = "QUEUE_FILES",
9
10
  SET_STATUS = "SET_STATUS",
10
11
  SET_STATUS_UPLOADING = "SET_STATUS_UPLOADING",
11
12
  SET_UPLOAD_PROGRESS = "SET_UPLOAD_PROGRESS",
@@ -15,6 +16,7 @@ export type GetFileErrorMessage = (file: File) => string;
15
16
  export type Action = {
16
17
  type: StorageManagerActionTypes.ADD_FILES;
17
18
  files: File[];
19
+ status: FileStatus;
18
20
  getFileErrorMessage: GetFileErrorMessage;
19
21
  } | {
20
22
  type: StorageManagerActionTypes.CLEAR_FILES;
@@ -22,6 +24,8 @@ export type Action = {
22
24
  type: StorageManagerActionTypes.SET_STATUS;
23
25
  id: string;
24
26
  status: FileStatus;
27
+ } | {
28
+ type: StorageManagerActionTypes.QUEUE_FILES;
25
29
  } | {
26
30
  type: StorageManagerActionTypes.SET_STATUS_UPLOADING;
27
31
  id: string;
@@ -36,5 +40,6 @@ export type Action = {
36
40
  };
37
41
  export interface AddFilesActionParams {
38
42
  files: File[];
43
+ status: FileStatus;
39
44
  getFileErrorMessage: GetFileErrorMessage;
40
45
  }
@@ -1,12 +1,14 @@
1
1
  import { UploadTask } from '@aws-amplify/storage';
2
- import { StorageFiles, DefaultFile } from '../../types';
2
+ import { StorageFiles, FileStatus, DefaultFile } from '../../types';
3
3
  import { GetFileErrorMessage } from './types';
4
4
  export interface UseStorageManager {
5
5
  addFiles: (params: {
6
6
  files: File[];
7
+ status: FileStatus;
7
8
  getFileErrorMessage: GetFileErrorMessage;
8
9
  }) => void;
9
10
  clearFiles: () => void;
11
+ queueFiles: () => void;
10
12
  setUploadingFile: (params: {
11
13
  id: string;
12
14
  uploadTask?: UploadTask;
@@ -1,3 +1,3 @@
1
1
  export { StorageManager } from './StorageManager';
2
2
  export { StorageManagerProps } from './types';
3
- export { DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, } from './ui';
3
+ export { DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, FileListFooterProps, } from './ui';
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import type { StorageAccessLevel, UploadTask } from '@aws-amplify/storage';
3
- import { ContainerProps, DropZoneProps, FileListHeaderProps, FileListProps, FilePickerProps } from './ui';
3
+ import { ContainerProps, DropZoneProps, FileListHeaderProps, FileListFooterProps, FileListProps, FilePickerProps } from './ui';
4
4
  import { StorageManagerDisplayText } from './utils';
5
5
  export declare enum FileStatus {
6
+ ADDED = "added",
6
7
  QUEUED = "queued",
7
8
  UPLOADING = "uploading",
8
9
  PAUSED = "paused",
@@ -37,6 +38,10 @@ export interface StorageManagerProps {
37
38
  * @see https://docs.amplify.aws/lib/storage/configureaccess/q/platform/js/
38
39
  */
39
40
  accessLevel: StorageAccessLevel;
41
+ /**
42
+ * Determines if the upload will automatically start after a file is selected, default value: true
43
+ */
44
+ autoUpload?: boolean;
40
45
  /**
41
46
  * Component overrides
42
47
  */
@@ -46,6 +51,7 @@ export interface StorageManagerProps {
46
51
  FileList?: React.ComponentType<FileListProps>;
47
52
  FilePicker?: React.ComponentType<FilePickerProps>;
48
53
  FileListHeader?: React.ComponentType<FileListHeaderProps>;
54
+ FileListFooter?: React.ComponentType<FileListFooterProps>;
49
55
  };
50
56
  /**
51
57
  * List of default files already uploaded
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { StorageManagerDisplayText } from '../../utils';
3
+ export interface FileListFooterProps {
4
+ remainingFilesCount: number;
5
+ displayText: StorageManagerDisplayText;
6
+ onClearAll: () => void;
7
+ onUploadAll: () => void;
8
+ }
9
+ export declare function FileListFooter({ displayText, remainingFilesCount, onClearAll, onUploadAll, }: FileListFooterProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export { FileListFooter, FileListFooterProps } from './FileListFooter';
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { StorageManagerDisplayText } from '../../utils/displayText';
3
3
  export interface FileListHeaderProps {
4
+ allUploadsSuccessful: boolean;
5
+ displayText: StorageManagerDisplayText;
4
6
  fileCount: number;
5
7
  remainingFilesCount: number;
6
- displayText: StorageManagerDisplayText;
7
- allUploadsSuccessful: boolean;
8
+ selectedFilesCount?: number;
8
9
  }
9
- export declare function FileListHeader({ fileCount, remainingFilesCount, displayText, allUploadsSuccessful, }: FileListHeaderProps): JSX.Element;
10
+ export declare function FileListHeader({ allUploadsSuccessful, displayText, fileCount, remainingFilesCount, selectedFilesCount, }: FileListHeaderProps): JSX.Element;
@@ -2,4 +2,5 @@ export { Container, ContainerProps } from './Container';
2
2
  export { DropZone, DropZoneProps } from './DropZone';
3
3
  export { FileList, FileListProps } from './FileList';
4
4
  export { FileListHeader, FileListHeaderProps } from './FileListHeader';
5
+ export { FileListFooter, FileListFooterProps } from './FileListFooter';
5
6
  export { FilePicker, FilePickerProps } from './FilePicker';
@@ -2,6 +2,7 @@ export declare const defaultStorageManagerDisplayText: {
2
2
  getFilesUploadedText(count: number): string;
3
3
  getFileSizeErrorText(sizeText: string): string;
4
4
  getRemainingFilesText(count: number): string;
5
+ getSelectedFilesText(count: number): string;
5
6
  getUploadingText(percentage: number): string;
6
7
  getUploadButtonText(count: number): string;
7
8
  getMaxFilesErrorText(count: number): string;
@@ -1,2 +1,2 @@
1
1
  export { StorageImage, StorageImageProps } from './StorageImage';
2
- export { StorageManager, StorageManagerProps, DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, } from './StorageManager';
2
+ export { StorageManager, StorageManagerProps, DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, FileListFooterProps, } from './StorageManager';
@@ -1 +1 @@
1
- export { StorageImage, StorageImageProps, StorageManager, StorageManagerProps, DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, } from './components';
1
+ export { StorageImage, StorageImageProps, StorageManager, StorageManagerProps, DropZoneProps, ContainerProps, FileListProps, FilePickerProps, FileListHeaderProps, FileListFooterProps, } from './components';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -40,9 +40,9 @@
40
40
  "typecheck": "tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
- "@aws-amplify/ui": "5.7.2",
44
- "@aws-amplify/ui-react": "5.2.0",
45
- "@aws-amplify/ui-react-core": "2.1.31",
43
+ "@aws-amplify/ui": "5.8.1",
44
+ "@aws-amplify/ui-react": "5.3.1",
45
+ "@aws-amplify/ui-react-core": "2.1.33",
46
46
  "classnames": "2.3.1",
47
47
  "lodash": "4.17.21",
48
48
  "tslib": "2.4.1"
@@ -1 +0,0 @@
1
- import{useState as a}from"react";function r({onChange:r}){const[t,o]=a(!1);return{onDragStart:a=>{a.dataTransfer.clearData()},onDragEnter:a=>{a.preventDefault(),a.stopPropagation()},onDragLeave:a=>{a.preventDefault(),a.stopPropagation(),o(!1)},onDragOver:a=>{a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",o(!0)},onDrop:a=>{a.preventDefault(),a.stopPropagation(),o(!1),r(a)},inDropZone:t}}export{r as useDropZone};
@@ -1 +0,0 @@
1
- export { useDropZone } from './useDropZone';
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- export interface UseDropZoneProps {
3
- onChange: (event: React.DragEvent<HTMLDivElement>) => void;
4
- }
5
- export interface UseDropZoneReturn {
6
- onDragStart: (event: React.DragEvent<HTMLDivElement>) => void;
7
- onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void;
8
- onDragLeave: (event: React.DragEvent<HTMLDivElement>) => void;
9
- onDragOver: (event: React.DragEvent<HTMLDivElement>) => void;
10
- onDrop: (event: React.DragEvent<HTMLDivElement>) => void;
11
- inDropZone: boolean;
12
- }
13
- export declare function useDropZone({ onChange }: UseDropZoneProps): UseDropZoneReturn;