@aws-amplify/ui-react-storage 3.9.0 → 3.9.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/browser.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-BcuxpEzi.js');
5
+ var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-Cf4yJo1e.js');
6
6
  var internals = require('@aws-amplify/storage/internals');
7
7
  require('@aws-amplify/ui');
8
8
  require('aws-amplify/storage');
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
32
32
 
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
 
35
- const VERSION = '3.9.0';
35
+ const VERSION = '3.9.1';
36
36
 
37
37
  const constructBucket = ({ bucket: bucketName, region, }) => ({ bucketName, region });
38
38
  const parseAccessGrantLocation = (location) => {
@@ -2540,7 +2540,7 @@ const getProgressHeader = (label) => ({
2540
2540
  type: 'sort',
2541
2541
  content: { label },
2542
2542
  });
2543
- const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey, shouldDisplayProgress = false, onTaskRemove, }) => {
2543
+ const getActionViewTableData = ({ tasks, displayText, getFolderText, isProcessing, shouldDisplayProgress = false, onTaskRemove, }) => {
2544
2544
  const headers = [
2545
2545
  ...getDefaultActionViewHeaders({
2546
2546
  displayText,
@@ -2571,22 +2571,8 @@ const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey,
2571
2571
  };
2572
2572
  }
2573
2573
  case 'folder': {
2574
- if (locationKey) {
2575
- return { key, type: 'text', content: { text: locationKey } };
2576
- }
2577
- if (isFileItem(data)) {
2578
- const { webkitRelativePath } = data.file;
2579
- return {
2580
- key,
2581
- type: 'text',
2582
- content: {
2583
- text: webkitRelativePath
2584
- ? webkitRelativePath.slice(0, webkitRelativePath.lastIndexOf('/') + 1)
2585
- : '-',
2586
- },
2587
- };
2588
- }
2589
- return { key, type: 'text', content: { text: '/' } };
2574
+ const text = getFolderText?.(task) ?? '/';
2575
+ return { key, type: 'text', content: { text } };
2590
2576
  }
2591
2577
  case 'type': {
2592
2578
  return {
@@ -2661,6 +2647,10 @@ const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey,
2661
2647
  return { headers, rows };
2662
2648
  };
2663
2649
 
2650
+ const getFolderText$2 = ({ data: { file: { webkitRelativePath }, }, }) => webkitRelativePath
2651
+ ? webkitRelativePath.slice(0, webkitRelativePath.lastIndexOf('/') + 1)
2652
+ : '-';
2653
+
2664
2654
  function UploadViewProvider({ children, ...props }) {
2665
2655
  const { UploadView: displayText } = useDisplayText();
2666
2656
  const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, addFilesLabel, addFolderLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, overwriteToggleLabel, title, getActionCompleteMessage, getFilesValidationMessage, } = displayText;
@@ -2702,6 +2692,7 @@ function UploadViewProvider({ children, ...props }) {
2702
2692
  statusDisplayFailedLabel,
2703
2693
  statusDisplayQueuedLabel,
2704
2694
  tableData: getActionViewTableData({
2695
+ getFolderText: getFolderText$2,
2705
2696
  tasks,
2706
2697
  shouldDisplayProgress: true,
2707
2698
  displayText,
@@ -3485,15 +3476,16 @@ const FoldersTableControl = () => {
3485
3476
  };
3486
3477
  FoldersTableControl.displayName = 'FoldersTable';
3487
3478
 
3479
+ const getFolderText$1 = ({ data: { fileKey, sourceKey }, }) => sourceKey.slice(0, -fileKey.length);
3480
+
3488
3481
  function CopyViewProvider({ children, ...props }) {
3489
3482
  const { CopyView: displayText } = useDisplayText();
3490
- const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, } = displayText;
3491
- const { destination, folders, isProcessing, isProcessingComplete, location, statusCounts, tasks, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
3483
+ const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, title, } = displayText;
3484
+ const { destination, folders, isProcessing, isProcessingComplete, statusCounts, tasks, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
3492
3485
  const { hasNextPage, highestPageVisited, hasError: hasFoldersError, message: foldersErrorMessage, query, hasExhaustedSearch, isLoading, page, pageItems, onPaginate, onQuery, onSearchClear, onSearch, onSelectFolder, } = folders;
3493
- const { key: locationKey } = location ?? {};
3494
3486
  const tableData = getActionViewTableData({
3487
+ getFolderText: getFolderText$1,
3495
3488
  tasks,
3496
- locationKey,
3497
3489
  isProcessing,
3498
3490
  displayText,
3499
3491
  onTaskRemove,
@@ -3528,6 +3520,7 @@ function CopyViewProvider({ children, ...props }) {
3528
3520
  statusDisplayFailedLabel,
3529
3521
  statusDisplayQueuedLabel,
3530
3522
  tableData,
3523
+ title,
3531
3524
  }, onActionCancel: onActionCancel, onActionExit: onActionExit, onActionStart: onActionStart, onSearch: onSearch, onSearchClear: onSearchClear, onSearchQueryChange: onQuery, onSelectDestination: onSelectDestination },
3532
3525
  React__namespace["default"].createElement(FoldersPaginationProvider, { hasNextPage: hasNextPage, highestPageVisited: highestPageVisited, page: page, onPaginate: onPaginate },
3533
3526
  React__namespace["default"].createElement(FoldersTableProvider, { destination: destination, folders: pageItems, onSelectFolder: onSelectFolder },
@@ -3793,18 +3786,20 @@ CopyView.Statuses = StatusDisplayControl;
3793
3786
  CopyView.TasksTable = DataTableControl;
3794
3787
  CopyView.Title = TitleControl;
3795
3788
 
3789
+ const getFolderText = ({ data: { fileKey, key }, }) => key.slice(0, -fileKey.length);
3790
+
3796
3791
  function DeleteViewProvider({ children, ...props }) {
3797
3792
  const { DeleteView: displayText } = useDisplayText();
3798
3793
  const { actionCancelLabel, actionExitLabel, actionStartLabel, title, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, getActionCompleteMessage, } = displayText;
3799
- const { isProcessing, isProcessingComplete, location, statusCounts, tasks, onActionCancel, onActionStart, onActionExit, onTaskRemove, } = props;
3794
+ const { isProcessing, isProcessingComplete, statusCounts, tasks, onActionCancel, onActionStart, onActionExit, onTaskRemove, } = props;
3800
3795
  const message = isProcessingComplete
3801
3796
  ? getActionCompleteMessage({ counts: statusCounts })
3802
3797
  : undefined;
3803
3798
  const tableData = getActionViewTableData({
3804
3799
  tasks,
3805
- locationKey: location.key,
3806
3800
  isProcessing,
3807
3801
  displayText,
3802
+ getFolderText,
3808
3803
  onTaskRemove,
3809
3804
  });
3810
3805
  return (React__namespace["default"].createElement(ControlsContextProvider, { data: {
@@ -3825,18 +3820,14 @@ function DeleteViewProvider({ children, ...props }) {
3825
3820
  }, onActionStart: onActionStart, onActionExit: onActionExit, onActionCancel: onActionCancel }, children));
3826
3821
  }
3827
3822
 
3823
+ // assign to constant to ensure referential equality
3824
+ const EMPTY_ITEMS = [];
3828
3825
  const useDeleteView = (options) => {
3829
3826
  const { onExit: _onExit } = options ?? {};
3830
3827
  const [{ location, locationItems }, dispatchStoreAction] = useStore();
3831
- const { fileDataItems } = locationItems;
3832
- const { current, key } = location;
3833
- const data = React__namespace["default"].useMemo(() => !fileDataItems
3834
- ? []
3835
- : fileDataItems.map((item) => ({
3836
- ...item,
3837
- key: `${key}${item.fileKey}`,
3838
- })), [fileDataItems, key]);
3839
- const [processState, handleProcess] = useAction('delete', { items: data });
3828
+ const { current } = location;
3829
+ const { fileDataItems: items = EMPTY_ITEMS } = locationItems;
3830
+ const [processState, handleProcess] = useAction('delete', { items });
3840
3831
  const { isProcessing, isProcessingComplete, statusCounts, tasks } = processState;
3841
3832
  const onActionStart = () => {
3842
3833
  if (!current)
@@ -6,16 +6,16 @@ import { getActionViewTableData } from '../getActionViewTableData.mjs';
6
6
  import { FoldersMessageProvider } from './FoldersMessageControl.mjs';
7
7
  import { FoldersPaginationProvider } from './FoldersPaginationControl.mjs';
8
8
  import { FoldersTableProvider } from './FoldersTableControl.mjs';
9
+ import { getFolderText } from './utils.mjs';
9
10
 
10
11
  function CopyViewProvider({ children, ...props }) {
11
12
  const { CopyView: displayText } = useDisplayText();
12
- const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, } = displayText;
13
- const { destination, folders, isProcessing, isProcessingComplete, location, statusCounts, tasks, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
13
+ const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, title, } = displayText;
14
+ const { destination, folders, isProcessing, isProcessingComplete, statusCounts, tasks, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
14
15
  const { hasNextPage, highestPageVisited, hasError: hasFoldersError, message: foldersErrorMessage, query, hasExhaustedSearch, isLoading, page, pageItems, onPaginate, onQuery, onSearchClear, onSearch, onSelectFolder, } = folders;
15
- const { key: locationKey } = location ?? {};
16
16
  const tableData = getActionViewTableData({
17
+ getFolderText,
17
18
  tasks,
18
- locationKey,
19
19
  isProcessing,
20
20
  displayText,
21
21
  onTaskRemove,
@@ -50,6 +50,7 @@ function CopyViewProvider({ children, ...props }) {
50
50
  statusDisplayFailedLabel,
51
51
  statusDisplayQueuedLabel,
52
52
  tableData,
53
+ title,
53
54
  }, onActionCancel: onActionCancel, onActionExit: onActionExit, onActionStart: onActionStart, onSearch: onSearch, onSearchClear: onSearchClear, onSearchQueryChange: onQuery, onSelectDestination: onSelectDestination },
54
55
  React__default.createElement(FoldersPaginationProvider, { hasNextPage: hasNextPage, highestPageVisited: highestPageVisited, page: page, onPaginate: onPaginate },
55
56
  React__default.createElement(FoldersTableProvider, { destination: destination, folders: pageItems, onSelectFolder: onSelectFolder },
@@ -0,0 +1,3 @@
1
+ const getFolderText = ({ data: { fileKey, sourceKey }, }) => sourceKey.slice(0, -fileKey.length);
2
+
3
+ export { getFolderText };
@@ -3,19 +3,20 @@ import { ControlsContextProvider } from '../../../controls/context.mjs';
3
3
  import { useDisplayText } from '../../../displayText/context.mjs';
4
4
  import '@aws-amplify/ui';
5
5
  import { getActionViewTableData } from '../getActionViewTableData.mjs';
6
+ import { getFolderText } from './utils.mjs';
6
7
 
7
8
  function DeleteViewProvider({ children, ...props }) {
8
9
  const { DeleteView: displayText } = useDisplayText();
9
10
  const { actionCancelLabel, actionExitLabel, actionStartLabel, title, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, getActionCompleteMessage, } = displayText;
10
- const { isProcessing, isProcessingComplete, location, statusCounts, tasks, onActionCancel, onActionStart, onActionExit, onTaskRemove, } = props;
11
+ const { isProcessing, isProcessingComplete, statusCounts, tasks, onActionCancel, onActionStart, onActionExit, onTaskRemove, } = props;
11
12
  const message = isProcessingComplete
12
13
  ? getActionCompleteMessage({ counts: statusCounts })
13
14
  : undefined;
14
15
  const tableData = getActionViewTableData({
15
16
  tasks,
16
- locationKey: location.key,
17
17
  isProcessing,
18
18
  displayText,
19
+ getFolderText,
19
20
  onTaskRemove,
20
21
  });
21
22
  return (React__default.createElement(ControlsContextProvider, { data: {
@@ -15,18 +15,14 @@ import '@aws-amplify/storage/internals';
15
15
  import 'aws-amplify/storage';
16
16
  import '../../../actions/configs/context.mjs';
17
17
 
18
+ // assign to constant to ensure referential equality
19
+ const EMPTY_ITEMS = [];
18
20
  const useDeleteView = (options) => {
19
21
  const { onExit: _onExit } = options ?? {};
20
22
  const [{ location, locationItems }, dispatchStoreAction] = useStore();
21
- const { fileDataItems } = locationItems;
22
- const { current, key } = location;
23
- const data = React__default.useMemo(() => !fileDataItems
24
- ? []
25
- : fileDataItems.map((item) => ({
26
- ...item,
27
- key: `${key}${item.fileKey}`,
28
- })), [fileDataItems, key]);
29
- const [processState, handleProcess] = useAction('delete', { items: data });
23
+ const { current } = location;
24
+ const { fileDataItems: items = EMPTY_ITEMS } = locationItems;
25
+ const [processState, handleProcess] = useAction('delete', { items });
30
26
  const { isProcessing, isProcessingComplete, statusCounts, tasks } = processState;
31
27
  const onActionStart = () => {
32
28
  if (!current)
@@ -0,0 +1,3 @@
1
+ const getFolderText = ({ data: { fileKey, key }, }) => key.slice(0, -fileKey.length);
2
+
3
+ export { getFolderText };
@@ -3,6 +3,7 @@ import { ControlsContextProvider } from '../../../controls/context.mjs';
3
3
  import { useDisplayText } from '../../../displayText/context.mjs';
4
4
  import '@aws-amplify/ui';
5
5
  import { getActionViewTableData } from '../getActionViewTableData.mjs';
6
+ import { getFolderText } from './utils.mjs';
6
7
 
7
8
  function UploadViewProvider({ children, ...props }) {
8
9
  const { UploadView: displayText } = useDisplayText();
@@ -45,6 +46,7 @@ function UploadViewProvider({ children, ...props }) {
45
46
  statusDisplayFailedLabel,
46
47
  statusDisplayQueuedLabel,
47
48
  tableData: getActionViewTableData({
49
+ getFolderText,
48
50
  tasks,
49
51
  shouldDisplayProgress: true,
50
52
  displayText,
@@ -0,0 +1,5 @@
1
+ const getFolderText = ({ data: { file: { webkitRelativePath }, }, }) => webkitRelativePath
2
+ ? webkitRelativePath.slice(0, webkitRelativePath.lastIndexOf('/') + 1)
3
+ : '-';
4
+
5
+ export { getFolderText };
@@ -31,7 +31,7 @@ const getProgressHeader = (label) => ({
31
31
  type: 'sort',
32
32
  content: { label },
33
33
  });
34
- const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey, shouldDisplayProgress = false, onTaskRemove, }) => {
34
+ const getActionViewTableData = ({ tasks, displayText, getFolderText, isProcessing, shouldDisplayProgress = false, onTaskRemove, }) => {
35
35
  const headers = [
36
36
  ...getDefaultActionViewHeaders({
37
37
  displayText,
@@ -62,22 +62,8 @@ const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey,
62
62
  };
63
63
  }
64
64
  case 'folder': {
65
- if (locationKey) {
66
- return { key, type: 'text', content: { text: locationKey } };
67
- }
68
- if (isFileItem(data)) {
69
- const { webkitRelativePath } = data.file;
70
- return {
71
- key,
72
- type: 'text',
73
- content: {
74
- text: webkitRelativePath
75
- ? webkitRelativePath.slice(0, webkitRelativePath.lastIndexOf('/') + 1)
76
- : '-',
77
- },
78
- };
79
- }
80
- return { key, type: 'text', content: { text: '/' } };
65
+ const text = getFolderText?.(task) ?? '/';
66
+ return { key, type: 'text', content: { text } };
81
67
  }
82
68
  case 'type': {
83
69
  return {
@@ -1,3 +1,3 @@
1
- const VERSION = '3.9.0';
1
+ const VERSION = '3.9.1';
2
2
 
3
3
  export { VERSION };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var uiReactCore = require('@aws-amplify/ui-react-core');
9
9
  var auth = require('aws-amplify/auth');
10
10
  var storage = require('aws-amplify/storage');
11
11
  var internal = require('@aws-amplify/ui-react/internal');
12
- var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-BcuxpEzi.js');
12
+ var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-Cf4yJo1e.js');
13
13
  require('@aws-amplify/storage/internals');
14
14
  require('@aws-amplify/ui-react-core/elements');
15
15
  require('aws-amplify');
@@ -0,0 +1,3 @@
1
+ import { CopyHandlerData } from '../../../actions';
2
+ import { Task } from '../../../tasks';
3
+ export declare const getFolderText: ({ data: { fileKey, sourceKey }, }: Task<CopyHandlerData>) => string;
@@ -0,0 +1,3 @@
1
+ import { DeleteHandlerData } from '../../../actions';
2
+ import { Task } from '../../../tasks';
3
+ export declare const getFolderText: ({ data: { fileKey, key }, }: Task<DeleteHandlerData>) => string;
@@ -0,0 +1,3 @@
1
+ import { UploadHandlerData } from '../../../actions';
2
+ import { Task } from '../../../tasks';
3
+ export declare const getFolderText: ({ data: { file: { webkitRelativePath }, }, }: Task<UploadHandlerData>) => string;
@@ -2,11 +2,11 @@ import { DataTableProps } from '../../composables/DataTable';
2
2
  import { Task } from '../../tasks';
3
3
  import { TaskData } from '../../actions';
4
4
  import { DefaultActionViewDisplayText } from '../../displayText/types';
5
- export declare const getActionViewTableData: <T extends TaskData = TaskData>({ tasks, displayText, isProcessing, locationKey, shouldDisplayProgress, onTaskRemove, }: {
5
+ export declare const getActionViewTableData: <T extends TaskData = TaskData>({ tasks, displayText, getFolderText, isProcessing, shouldDisplayProgress, onTaskRemove, }: {
6
6
  tasks: Task<T, any>[];
7
7
  isProcessing: boolean;
8
- locationKey?: string | undefined;
9
8
  shouldDisplayProgress?: boolean | undefined;
9
+ getFolderText?: ((task: Task<T, any>) => string) | undefined;
10
10
  displayText: Omit<DefaultActionViewDisplayText, 'getActionCompleteMessage'> & {
11
11
  tableStatusOverwritePreventedLabel?: string;
12
12
  };
@@ -1 +1 @@
1
- export declare const VERSION = "3.9.0";
1
+ export declare const VERSION = "3.9.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@aws-amplify/ui": "6.9.1",
49
- "@aws-amplify/ui-react": "6.9.4",
50
- "@aws-amplify/ui-react-core": "3.3.4",
49
+ "@aws-amplify/ui-react": "6.9.5",
50
+ "@aws-amplify/ui-react-core": "3.3.5",
51
51
  "tslib": "^2.5.2"
52
52
  },
53
53
  "peerDependencies": {