@aws-amplify/ui-react-storage 3.7.1 → 3.8.0

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 (31) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/{createAmplifyAuthAdapter-D6MKiBgI.js → createAmplifyAuthAdapter-BcJMLIum.js} +1203 -1200
  3. package/dist/esm/components/FileUploader/FileUploader.mjs +2 -1
  4. package/dist/esm/components/FileUploader/hooks/useUploadFiles/useUploadFiles.mjs +3 -1
  5. package/dist/esm/components/FileUploader/utils/getInput.mjs +8 -2
  6. package/dist/esm/components/StorageBrowser/StorageBrowserDefault.mjs +16 -0
  7. package/dist/esm/components/StorageBrowser/composables/DataTable/DataTable.mjs +40 -38
  8. package/dist/esm/components/StorageBrowser/controls/hooks/useDataTable.mjs +2 -1
  9. package/dist/esm/components/StorageBrowser/createStorageBrowser.mjs +3 -3
  10. package/dist/esm/components/StorageBrowser/views/LocationActionView/getActionViewTableData.mjs +1 -1
  11. package/dist/esm/components/StorageBrowser/views/useView.mjs +4 -4
  12. package/dist/esm/components/StorageImage/StorageImage.mjs +11 -2
  13. package/dist/esm/components/StorageManager/StorageManager.mjs +2 -1
  14. package/dist/esm/version.mjs +1 -1
  15. package/dist/index.js +27 -8
  16. package/dist/types/components/FileUploader/hooks/useUploadFiles/useUploadFiles.d.ts +3 -2
  17. package/dist/types/components/FileUploader/types.d.ts +8 -1
  18. package/dist/types/components/FileUploader/utils/getInput.d.ts +3 -2
  19. package/dist/types/components/StorageBrowser/composables/DataTable/DataTable.d.ts +2 -1
  20. package/dist/types/components/StorageBrowser/index.d.ts +2 -1
  21. package/dist/types/components/StorageBrowser/types.d.ts +1 -2
  22. package/dist/types/components/StorageBrowser/views/index.d.ts +2 -0
  23. package/dist/types/components/StorageBrowser/views/useView.d.ts +4 -4
  24. package/dist/types/components/StorageImage/StorageImage.d.ts +1 -1
  25. package/dist/types/components/StorageImage/types.d.ts +4 -1
  26. package/dist/types/components/StorageManager/types.d.ts +15 -88
  27. package/dist/types/version.d.ts +1 -1
  28. package/package.json +3 -5
  29. package/dist/storage-browser-styles.css +0 -482
  30. package/dist/storage-browser-styles.js +0 -2
  31. package/dist/types/styles/storage-browser-styles.d.ts +0 -1
@@ -22,7 +22,7 @@ const logger = getLogger('Storage');
22
22
  const MISSING_REQUIRED_PROPS_MESSAGE = '`FileUploader` requires a `maxFileCount` prop to be provided.';
23
23
  const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE = '`FileUploader` does not allow usage of a `path` callback prop with an `accessLevel` prop.';
24
24
  const ACCESS_LEVEL_DEPRECATION_MESSAGE = '`accessLevel` has been deprecated and will be removed in a future major version. See migration notes at https://ui.docs.amplify.aws/react/connected-components/storage/FileUploader';
25
- const FileUploaderBase = React.forwardRef(function FileUploader({ acceptedFileTypes = [], accessLevel, autoUpload = true, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
25
+ const FileUploaderBase = React.forwardRef(function FileUploader({ acceptedFileTypes = [], accessLevel, autoUpload = true, bucket, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
26
26
  if (!maxFileCount) {
27
27
  // eslint-disable-next-line no-console
28
28
  console.warn(MISSING_REQUIRED_PROPS_MESSAGE);
@@ -77,6 +77,7 @@ const FileUploaderBase = React.forwardRef(function FileUploader({ acceptedFileTy
77
77
  });
78
78
  useUploadFiles({
79
79
  accessLevel,
80
+ bucket,
80
81
  files,
81
82
  isResumable,
82
83
  maxFileCount,
@@ -4,7 +4,7 @@ import { getInput } from '../../utils/getInput.mjs';
4
4
  import { uploadFile } from '../../utils/uploadFile.mjs';
5
5
  import { FileStatus } from '../../types.mjs';
6
6
 
7
- function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }) {
7
+ function useUploadFiles({ accessLevel, bucket, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }) {
8
8
  React.useEffect(() => {
9
9
  const filesReadyToUpload = files.filter((file) => file.status === FileStatus.QUEUED);
10
10
  if (filesReadyToUpload.length > maxFileCount) {
@@ -24,6 +24,7 @@ function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploa
24
24
  if (file) {
25
25
  const input = getInput({
26
26
  accessLevel,
27
+ bucket,
27
28
  file,
28
29
  key,
29
30
  onProgress,
@@ -58,6 +59,7 @@ function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploa
58
59
  }, [
59
60
  files,
60
61
  accessLevel,
62
+ bucket,
61
63
  isResumable,
62
64
  setUploadProgress,
63
65
  setUploadingFile,
@@ -2,7 +2,7 @@ import { fetchAuthSession } from 'aws-amplify/auth';
2
2
  import { isFunction, isString } from '@aws-amplify/ui';
3
3
  import { resolveFile } from './resolveFile.mjs';
4
4
 
5
- const getInput = ({ accessLevel, file, key, onProgress, path, processFile, useAccelerateEndpoint, }) => {
5
+ const getInput = ({ accessLevel, bucket, file, key, onProgress, path, processFile, useAccelerateEndpoint, }) => {
6
6
  return async () => {
7
7
  const hasCallbackPath = isFunction(path);
8
8
  const hasStringPath = isString(path);
@@ -10,7 +10,13 @@ const getInput = ({ accessLevel, file, key, onProgress, path, processFile, useAc
10
10
  const { file: data, key: processedKey, ...rest } = await resolveFile({ file, key, processFile });
11
11
  const contentType = file.type || 'binary/octet-stream';
12
12
  // IMPORTANT: always pass `...rest` here for backwards compatibility
13
- const options = { contentType, onProgress, useAccelerateEndpoint, ...rest };
13
+ const options = {
14
+ bucket,
15
+ contentType,
16
+ onProgress,
17
+ useAccelerateEndpoint,
18
+ ...rest,
19
+ };
14
20
  let inputResult;
15
21
  if (hasKeyInput) {
16
22
  // legacy handling of `path` is to prefix to `fileKey`
@@ -1,10 +1,26 @@
1
1
  import React__default from 'react';
2
2
  import { useViews } from './views/context/views.mjs';
3
+ import './views/LocationActionView/CopyView/CopyView.mjs';
4
+ import '@aws-amplify/ui';
3
5
  import './providers/store/location/context.mjs';
4
6
  import './providers/store/files/context.mjs';
5
7
  import './providers/store/actionType/context.mjs';
6
8
  import './providers/store/locationItems/context.mjs';
7
9
  import { useStore } from './providers/store/useStore.mjs';
10
+ import './useAction/context.mjs';
11
+ import './providers/configuration/context.mjs';
12
+ import '@aws-amplify/ui-react-core';
13
+ import '@aws-amplify/ui-react-core/elements';
14
+ import './providers/configuration/credentials/context.mjs';
15
+ import '@aws-amplify/storage/internals';
16
+ import 'aws-amplify/storage';
17
+ import './actions/configs/context.mjs';
18
+ import './views/LocationActionView/CreateFolderView/CreateFolderView.mjs';
19
+ import './views/LocationActionView/DeleteView/DeleteView.mjs';
20
+ import './views/context/actionViews.mjs';
21
+ import './views/LocationActionView/UploadView/UploadView.mjs';
22
+ import './views/LocationDetailView/LocationDetailView.mjs';
23
+ import './views/LocationsView/LocationsView.mjs';
8
24
 
9
25
  /**
10
26
  * Handles default `StorageBrowser` behavior:
@@ -9,7 +9,7 @@ import { CheckboxDataCell } from './dataCells/CheckboxDataCell.mjs';
9
9
  import { TextDataCell } from './dataCells/TextDataCell.mjs';
10
10
  import { CheckboxHeader } from './headers/CheckboxHeader.mjs';
11
11
 
12
- const DataTable = ({ headers, rows, }) => {
12
+ const DataTable = ({ headers, isLoading, rows, }) => {
13
13
  const mappedHeaders = headers.map(({ key, content, type }) => {
14
14
  switch (type) {
15
15
  case 'checkbox': {
@@ -33,44 +33,46 @@ const DataTable = ({ headers, rows, }) => {
33
33
  }
34
34
  }
35
35
  });
36
- const mappedRows = rows.map(({ key, content }) => ({
37
- key,
38
- content: content.map(({ key, content, type }) => {
39
- switch (type) {
40
- case 'button': {
41
- return {
42
- key,
43
- content: React__default.createElement(ButtonDataCell, { content: content }),
44
- };
36
+ const mappedRows = isLoading
37
+ ? []
38
+ : rows.map(({ key, content }) => ({
39
+ key,
40
+ content: content.map(({ key, content, type }) => {
41
+ switch (type) {
42
+ case 'button': {
43
+ return {
44
+ key,
45
+ content: React__default.createElement(ButtonDataCell, { content: content }),
46
+ };
47
+ }
48
+ case 'checkbox': {
49
+ return {
50
+ key,
51
+ content: React__default.createElement(CheckboxDataCell, { content: content }),
52
+ };
53
+ }
54
+ case 'date': {
55
+ return {
56
+ key,
57
+ content: React__default.createElement(DateDataCell, { content: content }),
58
+ };
59
+ }
60
+ case 'number': {
61
+ return {
62
+ key,
63
+ content: React__default.createElement(NumberDataCell, { content: content }),
64
+ };
65
+ }
66
+ case 'text':
67
+ default: {
68
+ return {
69
+ key,
70
+ content: React__default.createElement(TextDataCell, { content: content }),
71
+ };
72
+ }
45
73
  }
46
- case 'checkbox': {
47
- return {
48
- key,
49
- content: React__default.createElement(CheckboxDataCell, { content: content }),
50
- };
51
- }
52
- case 'date': {
53
- return {
54
- key,
55
- content: React__default.createElement(DateDataCell, { content: content }),
56
- };
57
- }
58
- case 'number': {
59
- return {
60
- key,
61
- content: React__default.createElement(NumberDataCell, { content: content }),
62
- };
63
- }
64
- case 'text':
65
- default: {
66
- return {
67
- key,
68
- content: React__default.createElement(TextDataCell, { content: content }),
69
- };
70
- }
71
- }
72
- }),
73
- }));
74
+ }),
75
+ }));
74
76
  return React__default.createElement(Table, { headers: mappedHeaders, rows: mappedRows });
75
77
  };
76
78
 
@@ -15,7 +15,7 @@ const GROUP_ORDER = [
15
15
  const UNSORTABLE_GROUPS = ['checkbox'];
16
16
  const useDataTable = () => {
17
17
  const { data } = useControlsContext();
18
- const { tableData } = data;
18
+ const { isLoading, tableData } = data;
19
19
  const defaultSortIndex = React__default.useMemo(() => tableData?.headers?.findIndex(({ type }) => type === 'sort') ?? -1, [tableData]);
20
20
  const [sortState, setSortState] = React__default.useState({
21
21
  index: defaultSortIndex,
@@ -99,6 +99,7 @@ const useDataTable = () => {
99
99
  }, [sortState, tableData]);
100
100
  return {
101
101
  headers: mappedHeaders ?? [],
102
+ isLoading,
102
103
  rows: sortedRows ?? [],
103
104
  };
104
105
  };
@@ -14,6 +14,7 @@ import './context/elements/definitions.mjs';
14
14
  import './context/elements/IconElement.mjs';
15
15
  import { ComponentsProvider } from './ComponentsProvider.mjs';
16
16
  import { componentsDefault } from './componentsDefault.mjs';
17
+ import { DisplayTextProvider } from './displayText/context.mjs';
17
18
  import { ErrorBoundary } from './ErrorBoundary/ErrorBoundary.mjs';
18
19
  import { createConfigurationProvider } from './providers/configuration/createConfigurationProvider.mjs';
19
20
  import './providers/configuration/context.mjs';
@@ -23,11 +24,12 @@ import './providers/store/files/context.mjs';
23
24
  import './providers/store/location/context.mjs';
24
25
  import './providers/store/locationItems/context.mjs';
25
26
  import { StorageBrowserDefault } from './StorageBrowserDefault.mjs';
26
- import { CopyView } from './views/LocationActionView/CopyView/CopyView.mjs';
27
27
  import { ActionHandlersProvider } from './useAction/context.mjs';
28
28
  import { useAction } from './useAction/useAction.mjs';
29
29
  import '@aws-amplify/ui-react-core';
30
30
  import { getActionHandlers } from './useAction/utils.mjs';
31
+ import { ViewsProvider } from './views/context/views.mjs';
32
+ import { CopyView } from './views/LocationActionView/CopyView/CopyView.mjs';
31
33
  import { CreateFolderView } from './views/LocationActionView/CreateFolderView/CreateFolderView.mjs';
32
34
  import { DeleteView } from './views/LocationActionView/DeleteView/DeleteView.mjs';
33
35
  import { LocationActionView } from './views/LocationActionView/LocationActionView.mjs';
@@ -35,8 +37,6 @@ import { UploadView } from './views/LocationActionView/UploadView/UploadView.mjs
35
37
  import { LocationDetailView } from './views/LocationDetailView/LocationDetailView.mjs';
36
38
  import { LocationsView } from './views/LocationsView/LocationsView.mjs';
37
39
  import { useView } from './views/useView.mjs';
38
- import { ViewsProvider } from './views/context/views.mjs';
39
- import { DisplayTextProvider } from './displayText/context.mjs';
40
40
 
41
41
  function createStorageBrowser(input) {
42
42
  assertRegisterAuthListener(input.config.registerAuthListener);
@@ -118,7 +118,7 @@ const getActionViewTableData = ({ tasks, displayText, isProcessing, locationKey,
118
118
  value: progress,
119
119
  displayValue: `${getPercentValue(
120
120
  // Default progress to 100% if progress value is unavailable but status is recognized as complete
121
- progress ?? status === 'COMPLETE' ? 1 : 0)}%`,
121
+ progress ?? (status === 'COMPLETE' ? 1 : 0))}%`,
122
122
  },
123
123
  };
124
124
  }
@@ -18,7 +18,7 @@ import { useLocationsView } from './LocationsView/useLocationsView.mjs';
18
18
  import './LocationDetailView/LocationDetailView.mjs';
19
19
  import { useLocationDetailView } from './LocationDetailView/useLocationDetailView.mjs';
20
20
 
21
- const USE_VIEW_HOOKS = {
21
+ const DEFAULT_VIEW_HOOKS = {
22
22
  Copy: useCopyView,
23
23
  CreateFolder: useCreateFolderView,
24
24
  Delete: useDeleteView,
@@ -26,13 +26,13 @@ const USE_VIEW_HOOKS = {
26
26
  Locations: useLocationsView,
27
27
  Upload: useUploadView,
28
28
  };
29
- const isUseViewType = (value) => !!USE_VIEW_HOOKS?.[value];
29
+ const isUseViewType = (value) => !!DEFAULT_VIEW_HOOKS?.[value];
30
30
  // @ts-expect-error
31
31
  const useView = (type) => {
32
32
  if (!isUseViewType(type)) {
33
33
  throw new Error(`Value of \`${type}\` cannot be used to index \`useView\``);
34
34
  }
35
- return USE_VIEW_HOOKS[type]();
35
+ return DEFAULT_VIEW_HOOKS[type]();
36
36
  };
37
37
 
38
- export { useView };
38
+ export { DEFAULT_VIEW_HOOKS, useView };
@@ -22,7 +22,7 @@ const getDeprecationMessage = ({ hasImgkey, hasPath, hasDeprecatedOptions, }) =>
22
22
  }
23
23
  return message;
24
24
  };
25
- const StorageImage = ({ accessLevel, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence = true, ...rest }) => {
25
+ const StorageImage = ({ accessLevel, bucket, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence = true, ...rest }) => {
26
26
  const hasImgkey = !!imgKey;
27
27
  const hasPath = !!path;
28
28
  const hasDeprecatedOptions = !!accessLevel || !!identityId;
@@ -46,10 +46,19 @@ const StorageImage = ({ accessLevel, className, fallbackSrc, identityId, imgKey,
46
46
  onError,
47
47
  options: {
48
48
  accessLevel,
49
+ bucket,
49
50
  targetIdentityId: identityId,
50
51
  validateObjectExistence,
51
52
  },
52
- }), [accessLevel, imgKey, identityId, onError, path, validateObjectExistence]);
53
+ }), [
54
+ accessLevel,
55
+ bucket,
56
+ imgKey,
57
+ identityId,
58
+ onError,
59
+ path,
60
+ validateObjectExistence,
61
+ ]);
53
62
  const { url } = useGetUrl(input);
54
63
  return (React.createElement(Image, { ...rest, className: classNames(ComponentClassName.StorageImage, className), src: url?.toString() ?? fallbackSrc }));
55
64
  };
@@ -22,7 +22,7 @@ const logger = getLogger('Storage');
22
22
  const MISSING_REQUIRED_PROPS_MESSAGE = '`StorageManager` requires a `maxFileCount` prop to be provided.';
23
23
  const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE = '`StorageManager` does not allow usage of a `path` callback prop with an `accessLevel` prop.';
24
24
  const ACCESS_LEVEL_DEPRECATION_MESSAGE = '`accessLevel` has been deprecated and will be removed in a future major version. See migration notes at https://ui.docs.amplify.aws/react/connected-components/storage/storagemanager';
25
- const StorageManagerBase = React.forwardRef(function StorageManager({ acceptedFileTypes = [], accessLevel, autoUpload = true, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
25
+ const StorageManagerBase = React.forwardRef(function StorageManager({ acceptedFileTypes = [], accessLevel, autoUpload = true, bucket, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
26
26
  useDeprecationWarning({
27
27
  message: 'The `StorageManager` component has been renamed as the `FileUploader` component.',
28
28
  shouldWarn: false,
@@ -81,6 +81,7 @@ const StorageManagerBase = React.forwardRef(function StorageManager({ acceptedFi
81
81
  });
82
82
  useUploadFiles({
83
83
  accessLevel,
84
+ bucket,
84
85
  files,
85
86
  isResumable,
86
87
  maxFileCount,
@@ -1,3 +1,3 @@
1
- const VERSION = '3.7.1';
1
+ const VERSION = '3.8.0';
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-D6MKiBgI.js');
12
+ var createAmplifyAuthAdapter = require('./createAmplifyAuthAdapter-BcJMLIum.js');
13
13
  require('@aws-amplify/storage/internals');
14
14
  require('@aws-amplify/ui-react-core/elements');
15
15
  require('aws-amplify');
@@ -305,7 +305,7 @@ const resolveFile = ({ processFile, ...input }) => {
305
305
  });
306
306
  };
307
307
 
308
- const getInput = ({ accessLevel, file, key, onProgress, path, processFile, useAccelerateEndpoint, }) => {
308
+ const getInput = ({ accessLevel, bucket, file, key, onProgress, path, processFile, useAccelerateEndpoint, }) => {
309
309
  return async () => {
310
310
  const hasCallbackPath = ui.isFunction(path);
311
311
  const hasStringPath = ui.isString(path);
@@ -313,7 +313,13 @@ const getInput = ({ accessLevel, file, key, onProgress, path, processFile, useAc
313
313
  const { file: data, key: processedKey, ...rest } = await resolveFile({ file, key, processFile });
314
314
  const contentType = file.type || 'binary/octet-stream';
315
315
  // IMPORTANT: always pass `...rest` here for backwards compatibility
316
- const options = { contentType, onProgress, useAccelerateEndpoint, ...rest };
316
+ const options = {
317
+ bucket,
318
+ contentType,
319
+ onProgress,
320
+ useAccelerateEndpoint,
321
+ ...rest,
322
+ };
317
323
  let inputResult;
318
324
  if (hasKeyInput) {
319
325
  // legacy handling of `path` is to prefix to `fileKey`
@@ -357,7 +363,7 @@ async function uploadFile({ input, onError, onStart, onComplete, }) {
357
363
  return uploadTask;
358
364
  }
359
365
 
360
- function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }) {
366
+ function useUploadFiles({ accessLevel, bucket, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }) {
361
367
  React__namespace.useEffect(() => {
362
368
  const filesReadyToUpload = files.filter((file) => file.status === FileStatus.QUEUED);
363
369
  if (filesReadyToUpload.length > maxFileCount) {
@@ -377,6 +383,7 @@ function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploa
377
383
  if (file) {
378
384
  const input = getInput({
379
385
  accessLevel,
386
+ bucket,
380
387
  file,
381
388
  key,
382
389
  onProgress,
@@ -411,6 +418,7 @@ function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploa
411
418
  }, [
412
419
  files,
413
420
  accessLevel,
421
+ bucket,
414
422
  isResumable,
415
423
  setUploadProgress,
416
424
  setUploadingFile,
@@ -555,7 +563,7 @@ const logger$1 = ui.getLogger('Storage');
555
563
  const MISSING_REQUIRED_PROPS_MESSAGE$1 = '`FileUploader` requires a `maxFileCount` prop to be provided.';
556
564
  const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE$1 = '`FileUploader` does not allow usage of a `path` callback prop with an `accessLevel` prop.';
557
565
  const ACCESS_LEVEL_DEPRECATION_MESSAGE$1 = '`accessLevel` has been deprecated and will be removed in a future major version. See migration notes at https://ui.docs.amplify.aws/react/connected-components/storage/FileUploader';
558
- const FileUploaderBase = React__namespace.forwardRef(function FileUploader({ acceptedFileTypes = [], accessLevel, autoUpload = true, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
566
+ const FileUploaderBase = React__namespace.forwardRef(function FileUploader({ acceptedFileTypes = [], accessLevel, autoUpload = true, bucket, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
559
567
  if (!maxFileCount) {
560
568
  // eslint-disable-next-line no-console
561
569
  console.warn(MISSING_REQUIRED_PROPS_MESSAGE$1);
@@ -610,6 +618,7 @@ const FileUploaderBase = React__namespace.forwardRef(function FileUploader({ acc
610
618
  });
611
619
  useUploadFiles({
612
620
  accessLevel,
621
+ bucket,
613
622
  files,
614
623
  isResumable,
615
624
  maxFileCount,
@@ -729,7 +738,7 @@ const getDeprecationMessage = ({ hasImgkey, hasPath, hasDeprecatedOptions, }) =>
729
738
  }
730
739
  return message;
731
740
  };
732
- const StorageImage = ({ accessLevel, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence = true, ...rest }) => {
741
+ const StorageImage = ({ accessLevel, bucket, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence = true, ...rest }) => {
733
742
  const hasImgkey = !!imgKey;
734
743
  const hasPath = !!path;
735
744
  const hasDeprecatedOptions = !!accessLevel || !!identityId;
@@ -753,10 +762,19 @@ const StorageImage = ({ accessLevel, className, fallbackSrc, identityId, imgKey,
753
762
  onError,
754
763
  options: {
755
764
  accessLevel,
765
+ bucket,
756
766
  targetIdentityId: identityId,
757
767
  validateObjectExistence,
758
768
  },
759
- }), [accessLevel, imgKey, identityId, onError, path, validateObjectExistence]);
769
+ }), [
770
+ accessLevel,
771
+ bucket,
772
+ imgKey,
773
+ identityId,
774
+ onError,
775
+ path,
776
+ validateObjectExistence,
777
+ ]);
760
778
  const { url } = uiReactCore.useGetUrl(input);
761
779
  return (React__namespace.createElement(uiReact.Image, { ...rest, className: ui.classNames(ui.ComponentClassName.StorageImage, className), src: url?.toString() ?? fallbackSrc }));
762
780
  };
@@ -891,7 +909,7 @@ const logger = ui.getLogger('Storage');
891
909
  const MISSING_REQUIRED_PROPS_MESSAGE = '`StorageManager` requires a `maxFileCount` prop to be provided.';
892
910
  const ACCESS_LEVEL_WITH_PATH_CALLBACK_MESSAGE = '`StorageManager` does not allow usage of a `path` callback prop with an `accessLevel` prop.';
893
911
  const ACCESS_LEVEL_DEPRECATION_MESSAGE = '`accessLevel` has been deprecated and will be removed in a future major version. See migration notes at https://ui.docs.amplify.aws/react/connected-components/storage/storagemanager';
894
- const StorageManagerBase = React__namespace.forwardRef(function StorageManager({ acceptedFileTypes = [], accessLevel, autoUpload = true, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
912
+ const StorageManagerBase = React__namespace.forwardRef(function StorageManager({ acceptedFileTypes = [], accessLevel, autoUpload = true, bucket, components, defaultFiles, displayText: overrideDisplayText, isResumable = false, maxFileCount, maxFileSize, onFileRemove, onUploadError, onUploadStart, onUploadSuccess, path, processFile, showThumbnails = true, useAccelerateEndpoint, }, ref) {
895
913
  uiReactCore.useDeprecationWarning({
896
914
  message: 'The `StorageManager` component has been renamed as the `FileUploader` component.',
897
915
  shouldWarn: false,
@@ -950,6 +968,7 @@ const StorageManagerBase = React__namespace.forwardRef(function StorageManager({
950
968
  });
951
969
  useUploadFiles({
952
970
  accessLevel,
971
+ bucket,
953
972
  files,
954
973
  isResumable,
955
974
  maxFileCount,
@@ -1,8 +1,9 @@
1
1
  import { PathCallback } from '../../utils';
2
- import { FileUploaderProps } from '../../types';
2
+ import { FileUploaderProps, StorageBucket } from '../../types';
3
3
  import { UseFileUploader } from '../useFileUploader';
4
4
  export interface UseUploadFilesProps extends Pick<FileUploaderProps, 'isResumable' | 'onUploadSuccess' | 'onUploadError' | 'onUploadStart' | 'maxFileCount' | 'processFile' | 'useAccelerateEndpoint'>, Pick<UseFileUploader, 'setUploadingFile' | 'setUploadProgress' | 'setUploadSuccess' | 'files'> {
5
5
  accessLevel?: FileUploaderProps['accessLevel'];
6
+ bucket?: StorageBucket;
6
7
  path?: string | PathCallback;
7
8
  }
8
- export declare function useUploadFiles({ accessLevel, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }: UseUploadFilesProps): void;
9
+ export declare function useUploadFiles({ accessLevel, bucket, files, isResumable, maxFileCount, onUploadError, onUploadStart, onUploadSuccess, path, processFile, setUploadingFile, setUploadProgress, setUploadSuccess, useAccelerateEndpoint, }: UseUploadFilesProps): void;
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { ContainerProps, DropZoneProps, FileListHeaderProps, FileListFooterProps, FileListProps, FilePickerProps } from './ui';
3
3
  import { FileUploaderDisplayText, PathCallback, UploadTask } from './utils';
4
+ export interface BucketInfo {
5
+ bucketName: string;
6
+ region: string;
7
+ }
8
+ export type StorageBucket = string | BucketInfo;
4
9
  export declare enum FileStatus {
5
10
  ADDED = "added",
6
11
  QUEUED = "queued",
@@ -115,8 +120,9 @@ export interface FileUploaderProps {
115
120
  */
116
121
  path?: string;
117
122
  useAccelerateEndpoint?: boolean;
123
+ bucket?: never;
118
124
  }
119
- export interface FileUploaderPathProps extends Omit<FileUploaderProps, 'accessLevel' | 'path'> {
125
+ export interface FileUploaderPathProps extends Omit<FileUploaderProps, 'accessLevel' | 'bucket' | 'path'> {
120
126
  /**
121
127
  * S3 bucket key, allows either a `string` or a `PathCallback`:
122
128
  * - `string`: `path` is prefixed to the file `key` for each file
@@ -125,5 +131,6 @@ export interface FileUploaderPathProps extends Omit<FileUploaderProps, 'accessLe
125
131
  */
126
132
  path: string | PathCallback;
127
133
  accessLevel?: never;
134
+ bucket?: StorageBucket;
128
135
  useAccelerateEndpoint?: boolean;
129
136
  }
@@ -1,8 +1,9 @@
1
1
  import { UploadDataWithPathInput, UploadDataInput } from 'aws-amplify/storage';
2
- import { ProcessFile, StorageAccessLevel } from '../types';
2
+ import { ProcessFile, StorageAccessLevel, StorageBucket } from '../types';
3
3
  import { PathCallback, PathInput } from './uploadFile';
4
4
  export interface GetInputParams {
5
5
  accessLevel: StorageAccessLevel | undefined;
6
+ bucket?: StorageBucket;
6
7
  file: File;
7
8
  key: string;
8
9
  onProgress: NonNullable<UploadDataWithPathInput['options']>['onProgress'];
@@ -10,4 +11,4 @@ export interface GetInputParams {
10
11
  processFile: ProcessFile | undefined;
11
12
  useAccelerateEndpoint?: boolean;
12
13
  }
13
- export declare const getInput: ({ accessLevel, file, key, onProgress, path, processFile, useAccelerateEndpoint, }: GetInputParams) => () => Promise<PathInput | UploadDataInput>;
14
+ export declare const getInput: ({ accessLevel, bucket, file, key, onProgress, path, processFile, useAccelerateEndpoint, }: GetInputParams) => () => Promise<PathInput | UploadDataInput>;
@@ -6,6 +6,7 @@ export interface DataTableRow {
6
6
  }
7
7
  export interface DataTableProps {
8
8
  headers: WithKey<DataTableHeader>[];
9
+ isLoading?: boolean;
9
10
  rows: WithKey<DataTableRow>[];
10
11
  }
11
- export declare const DataTable: ({ headers, rows, }: DataTableProps) => React.JSX.Element;
12
+ export declare const DataTable: ({ headers, isLoading, rows, }: DataTableProps) => React.JSX.Element;
@@ -2,5 +2,6 @@ export { componentsDefault } from './componentsDefault';
2
2
  export { createStorageBrowser } from './createStorageBrowser';
3
3
  export { ActionViewConfig, ActionHandler, FileDataItem, ExtendedActionConfigs, } from './actions';
4
4
  export { createAmplifyAuthAdapter, createManagedAuthAdapter, CreateManagedAuthAdapterInput, StorageBrowserAuthAdapter, } from './adapters';
5
- export { CreateStorageBrowserInput, StorageBrowserType, DerivedActionViewType, DerivedActionViews, } from './types';
6
5
  export { DefaultStorageBrowserDisplayText } from './displayText';
6
+ export { CreateStorageBrowserInput, StorageBrowserType, DerivedActionViewType, DerivedActionViews, } from './types';
7
+ export { UseView } from './views';
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { CustomActionConfigs, DefaultActionConfigs, ExtendedActionConfigs, ListLocations } from './actions';
3
3
  import { GetLocationCredentials } from './credentials/types';
4
- import { UseView } from './views/useView';
5
4
  import { Components } from './ComponentsProvider';
6
5
  import { RegisterAuthListener, StoreProviderProps } from './providers';
7
- import { CopyViewType, CreateFolderViewType, DeleteViewType, UploadViewType, LocationActionViewType, LocationDetailViewType, LocationsViewType, Views } from './views';
6
+ import { CopyViewType, CreateFolderViewType, DeleteViewType, UploadViewType, LocationActionViewType, LocationDetailViewType, LocationsViewType, Views, UseView } from './views';
8
7
  import { StorageBrowserDisplayText } from './displayText';
9
8
  import { DerivedActionHandlers, UseAction } from './useAction';
10
9
  export interface Config {
@@ -1,4 +1,6 @@
1
+ export { ViewsProvider, useViews } from './context';
1
2
  export { CopyView, CopyViewType, CreateFolderView, CreateFolderViewType, DeleteView, DeleteViewType, LocationActionView, LocationActionViewProps, LocationActionViewType, UploadView, UploadViewType, } from './LocationActionView';
2
3
  export { LocationDetailView, LocationDetailViewProps, LocationDetailViewType, } from './LocationDetailView';
3
4
  export { LocationsView, LocationsViewProps, LocationsViewType, } from './LocationsView';
5
+ export { useView, UseView } from './useView';
4
6
  export * from './types';
@@ -1,4 +1,4 @@
1
- declare const USE_VIEW_HOOKS: {
1
+ export declare const DEFAULT_VIEW_HOOKS: {
2
2
  Copy: (options?: import("./LocationActionView/CopyView").UseCopyViewOptions | undefined) => import("./LocationActionView").CopyViewState;
3
3
  CreateFolder: (options?: import("./LocationActionView/CreateFolderView").UseCreateFolderViewOptions | undefined) => import("./LocationActionView").CreateFolderViewState;
4
4
  Delete: (options?: import("./LocationActionView/DeleteView").UseDeleteViewOptions | undefined) => import("./LocationActionView").DeleteViewState;
@@ -6,11 +6,11 @@ declare const USE_VIEW_HOOKS: {
6
6
  Locations: (options?: import("./LocationsView/types").UseLocationsViewOptions | undefined) => import("./LocationsView/types").LocationsViewState;
7
7
  Upload: (options?: import("./LocationActionView/UploadView").UseUploadViewOptions | undefined) => import("./LocationActionView").UploadViewState;
8
8
  };
9
- type DefaultUseViews = typeof USE_VIEW_HOOKS;
10
- export type UseViewType = keyof DefaultUseViews;
9
+ type DefaultViewHooks = typeof DEFAULT_VIEW_HOOKS;
10
+ export type UseViewType = keyof DefaultViewHooks;
11
11
  export type ViewKey<T> = T extends Record<string, {
12
12
  componentName?: `${infer U}View`;
13
13
  }> ? U : T extends Record<infer K, any> ? K : never;
14
- export type UseView = <K extends keyof DefaultUseViews, S extends DefaultUseViews[K]>(type: K) => ReturnType<S>;
14
+ export type UseView = <K extends UseViewType, S extends ReturnType<DefaultViewHooks[K]>>(type: K) => S;
15
15
  export declare const useView: UseView;
16
16
  export {};
@@ -4,4 +4,4 @@ export declare const MISSING_REQUIRED_PROP_MESSAGE = "`StorageImage` requires ei
4
4
  export declare const HAS_DEPRECATED_PROPS_MESSAGE = "`imgKey`, `accessLevel`, and `identityId` will be replaced with `path` in a future major version. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props";
5
5
  export declare const HAS_PATH_AND_KEY_MESSAGE = "`imgKey` is ignored when both `imgKey` and `path` props are provided.";
6
6
  export declare const HAS_PATH_AND_UNSUPPORTED_OPTIONS_MESSAGE = "`accessLevel` and `identityId` are ignored when the `path` prop is provided.";
7
- export declare const StorageImage: ({ accessLevel, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence, ...rest }: StorageImageProps | StorageImagePathProps) => React.JSX.Element;
7
+ export declare const StorageImage: ({ accessLevel, bucket, className, fallbackSrc, identityId, imgKey, path, onStorageGetError, onGetUrlError, validateObjectExistence, ...rest }: StorageImageProps | StorageImagePathProps) => React.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { ImageProps } from '@aws-amplify/ui-react';
2
+ import { StorageBucket } from '../FileUploader/types';
2
3
  type StorageAccessLevel = 'guest' | 'protected' | 'private';
3
4
  export interface StorageImageProps extends Omit<ImageProps, 'src'> {
4
5
  /**
@@ -11,6 +12,7 @@ export interface StorageImageProps extends Omit<ImageProps, 'src'> {
11
12
  * `accessLevel` will be replaced with `path` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
12
13
  */
13
14
  accessLevel: StorageAccessLevel;
15
+ bucket?: never;
14
16
  /**
15
17
  * @deprecated
16
18
  * `identityId` will be replaced with `path` in a future major version of Amplify UI. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props
@@ -27,13 +29,14 @@ export interface StorageImageProps extends Omit<ImageProps, 'src'> {
27
29
  onGetUrlError?: (error: Error) => void;
28
30
  path?: never;
29
31
  }
30
- type OmittedPropKey = 'accessLevel' | 'imgKey' | 'identityId' | 'onStorageGetError' | 'path';
32
+ type OmittedPropKey = 'accessLevel' | 'bucket' | 'imgKey' | 'identityId' | 'onStorageGetError' | 'path';
31
33
  export interface StorageImagePathProps extends Omit<StorageImageProps, OmittedPropKey> {
32
34
  path: string | ((input: {
33
35
  identityId?: string;
34
36
  }) => string);
35
37
  imgKey?: never;
36
38
  accessLevel?: never;
39
+ bucket?: StorageBucket;
37
40
  identityId?: never;
38
41
  onStorageGetError?: never;
39
42
  }