@aws-amplify/ui-react-storage 3.10.0 → 3.10.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 (31) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/{createStorageBrowser-CooF7BS1.js → createStorageBrowser-BfRLqdUj.js} +14 -14
  3. package/dist/esm/components/FileUploader/hooks/useFileUploader/useFileUploader.mjs +1 -1
  4. package/dist/esm/components/StorageBrowser/actions/handlers/createFolder.mjs +1 -1
  5. package/dist/esm/components/StorageBrowser/actions/handlers/upload.mjs +1 -1
  6. package/dist/esm/components/StorageBrowser/components/defaults.mjs +1 -1
  7. package/dist/esm/components/StorageBrowser/components/elements/defaults.mjs +1 -1
  8. package/dist/esm/components/StorageBrowser/useAction/useListFolderItems.mjs +2 -2
  9. package/dist/esm/components/StorageBrowser/useAction/useListLocationItems.mjs +2 -2
  10. package/dist/esm/components/StorageBrowser/useAction/useListLocations.mjs +2 -2
  11. package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +2 -2
  12. package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +2 -2
  13. package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteViewProvider.mjs +2 -2
  14. package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadViewProvider.mjs +2 -2
  15. package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +2 -2
  16. package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +2 -2
  17. package/dist/esm/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.mjs +2 -2
  18. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/copyResolvers.mjs +2 -2
  19. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/deleteResolvers.mjs +2 -2
  20. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/uploadResolvers.mjs +2 -2
  21. package/dist/esm/version.mjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/types/components/StorageBrowser/components/index.d.ts +1 -1
  24. package/dist/types/components/StorageBrowser/createStorageBrowser/createStorageBrowser.d.ts +1 -2
  25. package/dist/types/components/StorageBrowser/createStorageBrowser/types.d.ts +21 -15
  26. package/dist/types/components/StorageBrowser/index.d.ts +1 -1
  27. package/dist/types/components/StorageBrowser/useAction/createEnhancedListHandler.d.ts +2 -2
  28. package/dist/types/components/StorageBrowser/useAction/types.d.ts +6 -8
  29. package/dist/types/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.d.ts +1 -1
  30. package/dist/types/version.d.ts +1 -1
  31. package/package.json +7 -9
package/dist/browser.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var internals = require('@aws-amplify/storage/internals');
6
6
  require('@aws-amplify/ui');
7
- var createStorageBrowser = require('./createStorageBrowser-CooF7BS1.js');
7
+ var createStorageBrowser = require('./createStorageBrowser-BfRLqdUj.js');
8
8
  require('aws-amplify/storage');
9
9
  require('react');
10
10
  require('@aws-amplify/ui-react');
@@ -32,7 +32,7 @@ function _interopNamespace(e) {
32
32
 
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
 
35
- const VERSION = '3.10.0';
35
+ const VERSION = '3.10.1';
36
36
 
37
37
  const toAccessGrantPermission = (permission) => {
38
38
  let result = '';
@@ -2134,7 +2134,7 @@ const useListLocations = () => {
2134
2134
  });
2135
2135
  const { listLocations } = handlers;
2136
2136
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler(listLocations), [listLocations]);
2137
- return uiReactCore.useDataState(enhancedHandler, {
2137
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2138
2138
  items: [],
2139
2139
  nextToken: undefined,
2140
2140
  });
@@ -2147,7 +2147,7 @@ const useListLocationItems = () => {
2147
2147
  const getConfig = useGetActionInput();
2148
2148
  const { listLocationItems } = handlers;
2149
2149
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
2150
- return uiReactCore.useDataState(enhancedHandler, {
2150
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2151
2151
  items: [],
2152
2152
  nextToken: undefined,
2153
2153
  });
@@ -2160,7 +2160,7 @@ const useListFolderItems = () => {
2160
2160
  const getConfig = useGetActionInput();
2161
2161
  const { listLocationItems } = handlers;
2162
2162
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
2163
- return uiReactCore.useDataState(enhancedHandler, {
2163
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2164
2164
  items: [],
2165
2165
  nextToken: undefined,
2166
2166
  });
@@ -3104,7 +3104,7 @@ function DisplayTextProvider({ children, displayText: _override, }) {
3104
3104
  const isCopyViewDisplayTextKey = (value) => !!DEFAULT_COPY_VIEW_DISPLAY_TEXT[value];
3105
3105
  const isDeleteViewDisplayTextKey = (value) => !!DEFAULT_DELETE_VIEW_DISPLAY_TEXT[value];
3106
3106
 
3107
- function useResolveDataTable(keys, { getCell, getHeader, getRowKey }, { items, props }) {
3107
+ function useResolveTableData(keys, { getCell, getHeader, getRowKey }, { items, props }) {
3108
3108
  return React__namespace["default"].useMemo(() => {
3109
3109
  const getRow = (item) => ({
3110
3110
  key: getRowKey({ item, props }),
@@ -3453,7 +3453,7 @@ function UploadViewProvider({ children, ...props }) {
3453
3453
  const filesValidationMessage = invalidFiles && !isProcessing
3454
3454
  ? getFilesValidationMessage({ invalidFiles })
3455
3455
  : undefined;
3456
- const tableData = useResolveDataTable(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
3456
+ const tableData = useResolveTableData(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
3457
3457
  items,
3458
3458
  props: { displayText, isProcessing, isMultipartUpload, onTaskRemove },
3459
3459
  });
@@ -3854,7 +3854,7 @@ function CopyViewProvider({ children, ...props }) {
3854
3854
  const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, title, } = displayText;
3855
3855
  const { destination, folders, isProcessing, isProcessingComplete, statusCounts, tasks: items, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
3856
3856
  const { hasNextPage, highestPageVisited, hasError: hasFoldersError, message: foldersErrorMessage, query, hasExhaustedSearch, isLoading, page, pageItems, onPaginate, onQuery, onSearchClear, onSearch, onSelectFolder, } = folders;
3857
- const tableData = useResolveDataTable(COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS, {
3857
+ const tableData = useResolveTableData(COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS, {
3858
3858
  items,
3859
3859
  props: { displayText, isProcessing, onTaskRemove },
3860
3860
  });
@@ -4005,8 +4005,8 @@ const DEFAULT_LIST_OPTIONS$2 = {
4005
4005
  const DEFAULT_REFRESH_OPTIONS = { ...DEFAULT_LIST_OPTIONS$2, refresh: true };
4006
4006
  const useFolders = ({ destination, setDestination, }) => {
4007
4007
  const { current, key } = destination;
4008
- const [{ data, hasError, isLoading, message }, handleList] = useList('folderItems');
4009
- const { items, nextToken, search } = data;
4008
+ const [{ value, hasError, isLoading, message }, handleList] = useList('folderItems');
4009
+ const { items, nextToken, search } = value;
4010
4010
  const { hasExhaustedSearch = false } = search ?? {};
4011
4011
  const onInitialize = React__namespace["default"].useCallback(() => {
4012
4012
  handleList({
@@ -4199,7 +4199,7 @@ function DeleteViewProvider({ children, ...props }) {
4199
4199
  const message = isProcessingComplete
4200
4200
  ? getActionCompleteMessage({ counts: statusCounts })
4201
4201
  : undefined;
4202
- const tableData = useResolveDataTable(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
4202
+ const tableData = useResolveTableData(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
4203
4203
  items,
4204
4204
  props: { displayText, isProcessing, onTaskRemove },
4205
4205
  });
@@ -4644,9 +4644,9 @@ const useLocationDetailView = (options) => {
4644
4644
  const { fileDataItems } = locationItems;
4645
4645
  const hasInvalidPrefix = ui.isUndefined(prefix);
4646
4646
  const [{ task }, handleDownload] = useAction('download');
4647
- const [{ data, isLoading, hasError, message }, handleList] = useList('locationItems');
4647
+ const [{ value, isLoading, hasError, message }, handleList] = useList('locationItems');
4648
4648
  // set up pagination
4649
- const { items, nextToken, search } = data;
4649
+ const { items, nextToken, search } = value;
4650
4650
  const { hasExhaustedSearch = false } = search ?? {};
4651
4651
  const onPaginate = () => {
4652
4652
  if (hasInvalidPrefix || !nextToken)
@@ -4981,8 +4981,8 @@ const useLocationsView = (options) => {
4981
4981
  const handleDownload = useAction('download')[1];
4982
4982
  const [state, handleList] = useList('locations');
4983
4983
  const dispatchStoreAction = useStore()[1];
4984
- const { data, message, hasError, isLoading } = state;
4985
- const { items, nextToken, search } = data;
4984
+ const { value, message, hasError, isLoading } = state;
4985
+ const { items, nextToken, search } = value;
4986
4986
  const hasNextToken = !!nextToken;
4987
4987
  const { hasExhaustedSearch = false } = search ?? {};
4988
4988
  const onNavigate = options?.onNavigate;
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import { isObject } from '@aws-amplify/ui';
3
3
  import { FileStatus } from '../../types.mjs';
4
4
  import { fileUploaderStateReducer } from './reducer.mjs';
5
- import { addFilesAction, clearFilesAction, queueFilesAction, setUploadingFileAction, setUploadProgressAction, setUploadSuccessAction, setUploadStatusAction, removeUploadAction } from './actions.mjs';
5
+ import { removeUploadAction, setUploadStatusAction, setUploadSuccessAction, setUploadProgressAction, setUploadingFileAction, queueFilesAction, clearFilesAction, addFilesAction } from './actions.mjs';
6
6
 
7
7
  const isDefaultFile = (file) => !!(isObject(file) && file.key);
8
8
  const createFileFromDefault = (file) => isDefaultFile(file)
@@ -1,6 +1,6 @@
1
1
  import { isFunction } from '@aws-amplify/ui';
2
2
  import { uploadData } from '@aws-amplify/storage/internals';
3
- import { getProgress, constructBucket } from './utils.mjs';
3
+ import { constructBucket, getProgress } from './utils.mjs';
4
4
  import { DEFAULT_CHECKSUM_ALGORITHM } from './constants.mjs';
5
5
 
6
6
  const createFolderHandler = (input) => {
@@ -1,7 +1,7 @@
1
1
  import { isCancelError } from 'aws-amplify/storage';
2
2
  import { isFunction } from '@aws-amplify/ui';
3
3
  import { uploadData } from '@aws-amplify/storage/internals';
4
- import { isMultipartUpload, constructBucket, getProgress } from './utils.mjs';
4
+ import { constructBucket, isMultipartUpload, getProgress } from './utils.mjs';
5
5
  import { DEFAULT_CHECKSUM_ALGORITHM } from './constants.mjs';
6
6
 
7
7
  const UNDEFINED_CALLBACKS = {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { CheckboxField, Pagination as Pagination$1, SearchField as SearchField$1, Breadcrumbs, Loader, TextField, Button, Menu, MenuItem, View, Heading } from '@aws-amplify/ui-react';
2
+ import { Heading, TextField, View, CheckboxField, SearchField as SearchField$1, Breadcrumbs, Pagination as Pagination$1, Loader, Button, Menu, MenuItem } from '@aws-amplify/ui-react';
3
3
  import '@aws-amplify/ui';
4
4
  import './elements/definitions.mjs';
5
5
  import { IconElement } from './elements/IconElement.mjs';
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { Button as Button$1, View as View$1, Label as Label$1, Input as Input$1, Heading as Heading$1, Table as Table$1, TableBody as TableBody$1, TableHead as TableHead$1, TableCell, TableRow as TableRow$1, Text as Text$1, Message, Flex } from '@aws-amplify/ui-react';
2
+ import { View as View$1, Message, Flex, Text as Text$1, TableRow as TableRow$1, TableCell, TableHead as TableHead$1, TableBody as TableBody$1, Table as Table$1, Heading as Heading$1, Label as Label$1, Input as Input$1, Button as Button$1 } from '@aws-amplify/ui-react';
3
3
 
4
4
  function Button(props) {
5
5
  const { disabled, variant } = props;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { useDataState } from '@aws-amplify/ui-react-core';
2
+ import { useAsyncReducer } from '@aws-amplify/ui-react-core';
3
3
  import { USE_LIST_ERROR_MESSAGE } from './constants.mjs';
4
4
  import { useActionHandlers } from './context.mjs';
5
5
  import { createEnhancedListHandler } from './createEnhancedListHandler.mjs';
@@ -15,7 +15,7 @@ const useListFolderItems = () => {
15
15
  const getConfig = useGetActionInput();
16
16
  const { listLocationItems } = handlers;
17
17
  const enhancedHandler = React__default.useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
18
- return useDataState(enhancedHandler, {
18
+ return useAsyncReducer(enhancedHandler, {
19
19
  items: [],
20
20
  nextToken: undefined,
21
21
  });
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { useDataState } from '@aws-amplify/ui-react-core';
2
+ import { useAsyncReducer } from '@aws-amplify/ui-react-core';
3
3
  import '@aws-amplify/ui-react-core/elements';
4
4
  import '../credentials/context.mjs';
5
5
  import '@aws-amplify/storage/internals';
@@ -15,7 +15,7 @@ const useListLocationItems = () => {
15
15
  const getConfig = useGetActionInput();
16
16
  const { listLocationItems } = handlers;
17
17
  const enhancedHandler = React__default.useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
18
- return useDataState(enhancedHandler, {
18
+ return useAsyncReducer(enhancedHandler, {
19
19
  items: [],
20
20
  nextToken: undefined,
21
21
  });
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { useDataState } from '@aws-amplify/ui-react-core';
2
+ import { useAsyncReducer } from '@aws-amplify/ui-react-core';
3
3
  import { USE_LIST_ERROR_MESSAGE } from './constants.mjs';
4
4
  import { useActionHandlers } from './context.mjs';
5
5
  import { createEnhancedListHandler } from './createEnhancedListHandler.mjs';
@@ -10,7 +10,7 @@ const useListLocations = () => {
10
10
  });
11
11
  const { listLocations } = handlers;
12
12
  const enhancedHandler = React__default.useMemo(() => createEnhancedListHandler(listLocations), [listLocations]);
13
- return useDataState(enhancedHandler, {
13
+ return useAsyncReducer(enhancedHandler, {
14
14
  items: [],
15
15
  nextToken: undefined,
16
16
  });
@@ -8,7 +8,7 @@ import '../../../components/composables/context.mjs';
8
8
  import '@aws-amplify/ui-react-core';
9
9
  import '@aws-amplify/ui-react-core/elements';
10
10
  import { useDisplayText } from '../../../displayText/context.mjs';
11
- import useResolveDataTable from '../../hooks/useResolveTableData/useResolveTableData.mjs';
11
+ import useResolveTableData from '../../hooks/useResolveTableData/useResolveTableData.mjs';
12
12
  import { COPY_TABLE_RESOLVERS, COPY_TABLE_KEYS } from '../../utils/tableResolvers/copyResolvers.mjs';
13
13
  import { FoldersMessageProvider } from './FoldersMessageControl.mjs';
14
14
  import { FoldersPaginationProvider } from './FoldersPaginationControl.mjs';
@@ -19,7 +19,7 @@ function CopyViewProvider({ children, ...props }) {
19
19
  const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, title, } = displayText;
20
20
  const { destination, folders, isProcessing, isProcessingComplete, statusCounts, tasks: items, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
21
21
  const { hasNextPage, highestPageVisited, hasError: hasFoldersError, message: foldersErrorMessage, query, hasExhaustedSearch, isLoading, page, pageItems, onPaginate, onQuery, onSearchClear, onSearch, onSelectFolder, } = folders;
22
- const tableData = useResolveDataTable(COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS, {
22
+ const tableData = useResolveTableData(COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS, {
23
23
  items,
24
24
  props: { displayText, isProcessing, onTaskRemove },
25
25
  });
@@ -21,8 +21,8 @@ const DEFAULT_LIST_OPTIONS = {
21
21
  const DEFAULT_REFRESH_OPTIONS = { ...DEFAULT_LIST_OPTIONS, refresh: true };
22
22
  const useFolders = ({ destination, setDestination, }) => {
23
23
  const { current, key } = destination;
24
- const [{ data, hasError, isLoading, message }, handleList] = useList('folderItems');
25
- const { items, nextToken, search } = data;
24
+ const [{ value, hasError, isLoading, message }, handleList] = useList('folderItems');
25
+ const { items, nextToken, search } = value;
26
26
  const { hasExhaustedSearch = false } = search ?? {};
27
27
  const onInitialize = React__default.useCallback(() => {
28
28
  handleList({
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import { ControlsContextProvider } from '../../../controls/context.mjs';
3
3
  import { useDisplayText } from '../../../displayText/context.mjs';
4
4
  import '@aws-amplify/ui';
5
- import useResolveDataTable from '../../hooks/useResolveTableData/useResolveTableData.mjs';
5
+ import useResolveTableData from '../../hooks/useResolveTableData/useResolveTableData.mjs';
6
6
  import { DELETE_TABLE_RESOLVERS, DELETE_TABLE_KEYS } from '../../utils/tableResolvers/deleteResolvers.mjs';
7
7
 
8
8
  function DeleteViewProvider({ children, ...props }) {
@@ -12,7 +12,7 @@ function DeleteViewProvider({ children, ...props }) {
12
12
  const message = isProcessingComplete
13
13
  ? getActionCompleteMessage({ counts: statusCounts })
14
14
  : undefined;
15
- const tableData = useResolveDataTable(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
15
+ const tableData = useResolveTableData(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
16
16
  items,
17
17
  props: { displayText, isProcessing, onTaskRemove },
18
18
  });
@@ -7,7 +7,7 @@ import '../../../actions/configs/context.mjs';
7
7
  import '../../../actions/configs/defaults.mjs';
8
8
  import { ControlsContextProvider } from '../../../controls/context.mjs';
9
9
  import { useDisplayText } from '../../../displayText/context.mjs';
10
- import useResolveDataTable from '../../hooks/useResolveTableData/useResolveTableData.mjs';
10
+ import useResolveTableData from '../../hooks/useResolveTableData/useResolveTableData.mjs';
11
11
  import { UPLOAD_TABLE_RESOLVERS, UPLOAD_TABLE_KEYS } from '../../utils/tableResolvers/uploadResolvers.mjs';
12
12
 
13
13
  function UploadViewProvider({ children, ...props }) {
@@ -27,7 +27,7 @@ function UploadViewProvider({ children, ...props }) {
27
27
  const filesValidationMessage = invalidFiles && !isProcessing
28
28
  ? getFilesValidationMessage({ invalidFiles })
29
29
  : undefined;
30
- const tableData = useResolveDataTable(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
30
+ const tableData = useResolveTableData(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
31
31
  items,
32
32
  props: { displayText, isProcessing, isMultipartUpload, onTaskRemove },
33
33
  });
@@ -38,9 +38,9 @@ const useLocationDetailView = (options) => {
38
38
  const { fileDataItems } = locationItems;
39
39
  const hasInvalidPrefix = isUndefined(prefix);
40
40
  const [{ task }, handleDownload] = useAction('download');
41
- const [{ data, isLoading, hasError, message }, handleList] = useList('locationItems');
41
+ const [{ value, isLoading, hasError, message }, handleList] = useList('locationItems');
42
42
  // set up pagination
43
- const { items, nextToken, search } = data;
43
+ const { items, nextToken, search } = value;
44
44
  const { hasExhaustedSearch = false } = search ?? {};
45
45
  const onPaginate = () => {
46
46
  if (hasInvalidPrefix || !nextToken)
@@ -24,8 +24,8 @@ const useLocationsView = (options) => {
24
24
  const handleDownload = useAction('download')[1];
25
25
  const [state, handleList] = useList('locations');
26
26
  const dispatchStoreAction = useStore()[1];
27
- const { data, message, hasError, isLoading } = state;
28
- const { items, nextToken, search } = data;
27
+ const { value, message, hasError, isLoading } = state;
28
+ const { items, nextToken, search } = value;
29
29
  const hasNextToken = !!nextToken;
30
30
  const { hasExhaustedSearch = false } = search ?? {};
31
31
  const onNavigate = options?.onNavigate;
@@ -1,6 +1,6 @@
1
1
  import React__default from 'react';
2
2
 
3
- function useResolveDataTable(keys, { getCell, getHeader, getRowKey }, { items, props }) {
3
+ function useResolveTableData(keys, { getCell, getHeader, getRowKey }, { items, props }) {
4
4
  return React__default.useMemo(() => {
5
5
  const getRow = (item) => ({
6
6
  key: getRowKey({ item, props }),
@@ -12,4 +12,4 @@ function useResolveDataTable(keys, { getCell, getHeader, getRowKey }, { items, p
12
12
  }, [getCell, getHeader, getRowKey, keys, items, props]);
13
13
  }
14
14
 
15
- export { useResolveDataTable as default };
15
+ export { useResolveTableData as default };
@@ -1,8 +1,8 @@
1
- import { capitalize, noop } from '@aws-amplify/ui';
1
+ import { noop, capitalize } from '@aws-amplify/ui';
2
2
  import '../../../displayText/context.mjs';
3
3
  import { isCopyViewDisplayTextKey } from '../../../displayText/utils.mjs';
4
4
  import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
5
- import { getCopyCellFolder, getFileType, getFileSize, getCopyOrDeleteCancelCellContent } from './utils.mjs';
5
+ import { getCopyOrDeleteCancelCellContent, getFileSize, getFileType, getCopyCellFolder } from './utils.mjs';
6
6
 
7
7
  const COPY_TABLE_KEYS = [
8
8
  'name',
@@ -1,8 +1,8 @@
1
- import { capitalize, noop } from '@aws-amplify/ui';
1
+ import { noop, capitalize } from '@aws-amplify/ui';
2
2
  import '../../../displayText/context.mjs';
3
3
  import { isDeleteViewDisplayTextKey } from '../../../displayText/utils.mjs';
4
4
  import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
5
- import { getDeleteCellFolder, getFileType, getFileSize, getCopyOrDeleteCancelCellContent } from './utils.mjs';
5
+ import { getCopyOrDeleteCancelCellContent, getFileSize, getFileType, getDeleteCellFolder } from './utils.mjs';
6
6
 
7
7
  const DELETE_TABLE_KEYS = [
8
8
  'name',
@@ -1,6 +1,6 @@
1
1
  import { capitalize } from '@aws-amplify/ui';
2
- import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
3
- import { getCellName, getUploadCellFolder, getFileType, getFileSize, getUploadCellProgress } from './utils.mjs';
2
+ import { STATUS_LABELS, STATUS_ICONS } from './constants.mjs';
3
+ import { getFileType, getCellName, getFileSize, getUploadCellProgress, getUploadCellFolder } from './utils.mjs';
4
4
 
5
5
  const UPLOAD_TABLE_KEYS = [
6
6
  'name',
@@ -1,3 +1,3 @@
1
- const VERSION = '3.10.0';
1
+ const VERSION = '3.10.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 createStorageBrowser = require('./createStorageBrowser-CooF7BS1.js');
12
+ var createStorageBrowser = require('./createStorageBrowser-BfRLqdUj.js');
13
13
  require('@aws-amplify/storage/internals');
14
14
  require('aws-amplify');
15
15
  require('aws-amplify/utils');
@@ -5,5 +5,5 @@ export * from './composables/DataTable';
5
5
  export { MessageProps, MessageType } from './composables/Message';
6
6
  export { ComponentsProvider, ComponentsProviderProps, StorageBrowserComponents, } from './ComponentsProvider';
7
7
  export { componentsDefault } from './defaults';
8
- export { ViewElement } from './elements';
8
+ export { StorageBrowserIconType, ViewElement } from './elements';
9
9
  export { WithKey } from './types';
@@ -1,4 +1,3 @@
1
- import { ExtendedActionConfigs } from '../actions';
2
1
  import { CreateStorageBrowserInput, CreateStorageBrowserOutput } from './types';
3
2
  /**
4
3
  * Creates a `StorageBrowser` component and utility hooks from provided configuration `input`.
@@ -6,4 +5,4 @@ import { CreateStorageBrowserInput, CreateStorageBrowserOutput } from './types';
6
5
  * @param input - `StorageBrowser` auth, actions and ui configuration values
7
6
  * @returns `StorageBrowser` component, `useAction` and `useView` hooks
8
7
  */
9
- export default function createStorageBrowser<Input extends CreateStorageBrowserInput, RInput extends Input['actions'] extends ExtendedActionConfigs ? Input['actions'] : ExtendedActionConfigs>(input: Input): CreateStorageBrowserOutput<RInput>;
8
+ export default function createStorageBrowser<TInput extends CreateStorageBrowserInput, TActions extends NonNullable<TInput['actions']>>(input: TInput): CreateStorageBrowserOutput<TActions>;
@@ -110,8 +110,10 @@ export interface CreateStorageBrowserInput {
110
110
  }
111
111
  /**
112
112
  * `StorageBrowser` component properties
113
+ * @template TActionType Optional type of action names rendered by `LocationActionView`
114
+ * @template TViews Optional type of custom action view components.
113
115
  */
114
- export interface StorageBrowserProps<K = string, V = {}> {
116
+ export interface StorageBrowserProps<TActionType = string, TViews = {}> {
115
117
  /**
116
118
  * @description provide to initialize the `StorageBrowser` with a default location, `actionType` or pagination values as an uncontrolled component
117
119
  */
@@ -148,16 +150,17 @@ export interface StorageBrowserProps<K = string, V = {}> {
148
150
  /**
149
151
  * @description accepts default top level `views` overrides and custom `views` defined by the `actions` parameter of `createStorageBrowser`
150
152
  */
151
- views?: StorageBrowserViews<K, V>;
153
+ views?: StorageBrowserViews<TActionType, TViews>;
152
154
  }
153
155
  /**
154
156
  * @description `StorageBrowser.Provider` component properties
157
+ * @template TViews Optional type of custom action view components.
155
158
  */
156
- export interface StorageBrowserProviderProps<V = {}> extends StoreProviderProps, Pick<StorageBrowserProps, 'defaultValue' | 'displayText' | 'onValueChange' | 'value'> {
159
+ export interface StorageBrowserProviderProps<TViews = {}> extends StoreProviderProps, Pick<StorageBrowserProps, 'defaultValue' | 'displayText' | 'onValueChange' | 'value'> {
157
160
  /**
158
161
  * @description accepts custom action views rendered by `LocationActionView`
159
162
  */
160
- views?: V;
163
+ views?: TViews;
161
164
  /**
162
165
  * @deprecated will be removed in a future major verison. Prefer `value` for controlled behavior or `defaultValue` for initializng `actionType`
163
166
  * @description initial `actionType`, does not update
@@ -175,10 +178,12 @@ export interface StorageBrowserProviderProps<V = {}> extends StoreProviderProps,
175
178
  path?: string;
176
179
  }
177
180
  /**
178
- * @description `StorageBrowser` component, provider and view components
181
+ * @description `StorageBrowser` component, provider and view components.
182
+ * @template TActionType Optional type of action names rendered by `LocationActionView`
183
+ * @template TViews Optional type of custom action view components.
179
184
  */
180
- export interface StorageBrowserType<K = string, V = {}> {
181
- (props: StorageBrowserProps<K, V>): React.JSX.Element;
185
+ export interface StorageBrowserType<TActionType = string, TViews = {}> {
186
+ (props: StorageBrowserProps<TActionType, TViews>): React.JSX.Element;
182
187
  displayName: string;
183
188
  /**
184
189
  * @description `StorageBrowser` React.Context provider. Composed `StorageBrowser` components must be a descendant of a `Provider` element
@@ -189,7 +194,7 @@ export interface StorageBrowserType<K = string, V = {}> {
189
194
  * </StorageBrowser.Provider>
190
195
  * ```
191
196
  */
192
- Provider: (props: StorageBrowserProviderProps<V>) => React.JSX.Element;
197
+ Provider: (props: StorageBrowserProviderProps<TViews>) => React.JSX.Element;
193
198
  /**
194
199
  * @description utility view aggregating all action views. Can be used to render a standalone action view
195
200
  * @example
@@ -197,7 +202,7 @@ export interface StorageBrowserType<K = string, V = {}> {
197
202
  * <StorageBrowser.LocationActionView type="copy" />
198
203
  * ```
199
204
  */
200
- LocationActionView: LocationActionViewType<K>;
205
+ LocationActionView: LocationActionViewType<TActionType>;
201
206
  /**
202
207
  * @description displays data related to the selected or provided `location` and action selection
203
208
  */
@@ -214,14 +219,14 @@ export interface StorageBrowserType<K = string, V = {}> {
214
219
  DeleteView: DeleteViewType;
215
220
  UploadView: UploadViewType;
216
221
  }
217
- type DefaultActionType<T = string> = Exclude<T, keyof DefaultActionConfigs>;
222
+ type NonDefaultActionType<T = string> = Exclude<T, keyof DefaultActionConfigs>;
218
223
  /**
219
224
  * @internal
220
225
  * @unstable interface subject to change, not recommended for public use
221
226
  * @description utility type resolving available custom action view component slots
222
227
  */
223
228
  export type DerivedActionViews<T extends StorageBrowserActions> = {
224
- [K in keyof T['custom'] as K extends DefaultActionType<K> ? T['custom'][K] extends {
229
+ [K in keyof T['custom'] as K extends NonDefaultActionType<K> ? T['custom'][K] extends {
225
230
  viewName: `${string}View`;
226
231
  } ? T['custom'][K]['viewName'] : never : never]?: () => React.JSX.Element | null;
227
232
  };
@@ -235,22 +240,23 @@ type DefaultActionWithoutViewType = 'download';
235
240
  * @description utility type resolving available location action view types
236
241
  */
237
242
  export type DerivedActionViewType<T extends StorageBrowserActions> = keyof {
238
- [K in keyof T['custom'] as K extends DefaultActionType<K> ? T['custom'][K] extends {
243
+ [K in keyof T['custom'] as K extends NonDefaultActionType<K> ? T['custom'][K] extends {
239
244
  viewName: `${string}View`;
240
245
  } ? K : never : never]?: any;
241
246
  } | Exclude<keyof DefaultActionConfigs, DefaultActionWithoutViewType>;
242
247
  /**
243
248
  * @description return values of `createStorageBrowser`
249
+ * @template TActions Type of `actions` passed to `createStorageBrowser`
244
250
  */
245
- export interface CreateStorageBrowserOutput<C extends ExtendedActionConfigs = ExtendedActionConfigs> {
251
+ export interface CreateStorageBrowserOutput<TActions extends StorageBrowserActions = ExtendedActionConfigs> {
246
252
  /**
247
253
  * @description `StorageBrowser` component and subcomponents
248
254
  */
249
- StorageBrowser: StorageBrowserType<DerivedActionViewType<C>, DerivedActionViews<C>>;
255
+ StorageBrowser: StorageBrowserType<DerivedActionViewType<TActions>, DerivedActionViews<TActions>>;
250
256
  /**
251
257
  * @description action handler utility hook
252
258
  */
253
- useAction: UseAction<DerivedActionHandlers<C>>;
259
+ useAction: UseAction<DerivedActionHandlers<TActions>>;
254
260
  /**
255
261
  * @description view state utility hook
256
262
  */
@@ -1,6 +1,6 @@
1
1
  export { ActionHandler, ActionViewConfig, CopyHandlerInput, CopyHandlerOutput, CreateFolderHandlerInput, CreateFolderHandlerOutput, defaultActionConfigs, defaultHandlers, DefaultHandlers, DeleteHandlerInput, DeleteHandlerOutput, DownloadHandlerInput, DownloadHandlerOutput, ExtendedActionConfigs, ListLocations, ListLocationsInput, ListLocationsOutput, LocationData, ListLocationItemsHandlerInput, ListLocationItemsHandlerOutput, ListLocationsHandlerInput, ListLocationsHandlerOutput, UploadHandlerInput, UploadHandlerOutput, } from './actions';
2
2
  export { createAmplifyAuthAdapter, createManagedAuthAdapter, CreateManagedAuthAdapterInput, StorageBrowserAuthAdapter, } from './adapters';
3
- export { componentsDefault, StorageBrowserComponents } from './components';
3
+ export { componentsDefault, StorageBrowserComponents, StorageBrowserIconType, } from './components';
4
4
  export { createStorageBrowser, CreateStorageBrowserInput, CreateStorageBrowserOutput, DerivedActionViews, DerivedActionViewType, StorageBrowserConfig, StorageBrowserProps, StorageBrowserProviderProps, StorageBrowserType, } from './createStorageBrowser';
5
5
  export { DefaultStorageBrowserDisplayText, StorageBrowserDisplayText, } from './displayText';
6
6
  export { StorageBrowserEventValue, StorageBrowserValue } from './store';
@@ -1,4 +1,4 @@
1
- import { AsyncDataAction } from '@aws-amplify/ui-react-core';
1
+ import { AsyncReducer } from '@aws-amplify/ui-react-core';
2
2
  import { ListHandler, ListHandlerOptions, ListHandlerInput, ListHandlerOutput } from '../actions';
3
3
  type KeyWithStringValue<T> = keyof {
4
4
  [P in keyof T as T[P] extends string ? P : never]: T[P];
@@ -29,7 +29,7 @@ export interface EnhancedListHandlerOutput<T> extends ListHandlerOutput<T> {
29
29
  }
30
30
  export interface EnhancedListHandlerInput<T, K> extends Omit<ListHandlerInput<EnhancedListHandlerOptions<T, K>>, 'config'> {
31
31
  }
32
- export interface EnhancedListHandler<T, K> extends AsyncDataAction<EnhancedListHandlerOutput<T>, EnhancedListHandlerInput<T, K>> {
32
+ export interface EnhancedListHandler<T, K> extends AsyncReducer<EnhancedListHandlerOutput<T>, EnhancedListHandlerInput<T, K>> {
33
33
  }
34
34
  type ListItem<Action> = Action extends ListHandler<any, ListHandlerOutput<infer T>> ? T : never;
35
35
  type Options<Action> = Action extends ListHandler<Omit<ListHandlerInput<ListHandlerOptions<infer E>>, 'config'>> ? E : never;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { DataState } from '@aws-amplify/ui-react-core';
3
- import { ActionHandler, ExtendedActionConfigs, CopyHandler, CreateFolderHandler, DeleteHandler, DownloadHandler, ListLocationItemsHandler, ListLocations, LocationData, UploadHandler } from '../actions';
2
+ import { AsyncReducerState } from '@aws-amplify/ui-react-core';
3
+ import { ActionHandler, CopyHandler, CreateFolderHandler, DeleteHandler, DownloadHandler, ListLocationItemsHandler, ListLocations, LocationData, UploadHandler } from '../actions';
4
4
  import { ProcessTasksOptions, StatusCounts, Task } from '../tasks';
5
+ import { StorageBrowserActions } from '../createStorageBrowser';
5
6
  export type ListActionState<T = any, K = any> = [
6
- state: DataState<T>,
7
+ state: AsyncReducerState<T>,
7
8
  handleAction: (...input: K[]) => void
8
9
  ];
9
10
  export interface DefaultActionHandlers {
@@ -20,14 +21,11 @@ export interface ActionHandlersContext {
20
21
  export interface ActionHandlersProviderProps extends ActionHandlersContext {
21
22
  children?: React.ReactNode;
22
23
  }
23
- type DerivedCustomActions<T> = T extends {
24
- custom?: infer U;
25
- } ? U : {};
26
24
  export type ResolveHandlerType<T> = T extends {
27
25
  handler: infer X;
28
26
  } | infer X ? X : never;
29
- export type DerivedActionHandlers<C extends ExtendedActionConfigs = ExtendedActionConfigs, D extends DerivedCustomActions<C> = DerivedCustomActions<C>> = DefaultActionHandlers & {
30
- [K in keyof D]: ResolveHandlerType<D[K]>;
27
+ export type DerivedActionHandlers<TActions extends StorageBrowserActions> = DefaultActionHandlers & {
28
+ [K in keyof NonNullable<TActions['custom']>]: ResolveHandlerType<NonNullable<TActions['custom']>[K]>;
31
29
  };
32
30
  export type InferTask<THandler> = THandler extends ActionHandler<infer TData, infer TValue> ? Task<TData, TValue> : never;
33
31
  export interface UseHandlerOptions<TTask extends Task> extends Pick<ProcessTasksOptions<TTask>, 'onTaskError' | 'onTaskProgress' | 'onTaskSuccess'> {
@@ -1,6 +1,6 @@
1
1
  import { DataTableProps } from '../../../components';
2
2
  import { DataTableResolvers } from './types';
3
- export default function useResolveDataTable<K extends string, TItem = {}, TProps = {}>(keys: readonly K[] | K[], { getCell, getHeader, getRowKey }: DataTableResolvers<K, TProps, TItem>, { items, props }: {
3
+ export default function useResolveTableData<K extends string, TItem, TProps>(keys: readonly K[] | K[], { getCell, getHeader, getRowKey }: DataTableResolvers<K, TProps, TItem>, { items, props }: {
4
4
  items?: TItem[];
5
5
  props: TProps;
6
6
  }): DataTableProps;
@@ -1 +1 @@
1
- export declare const VERSION = "3.10.0";
1
+ export declare const VERSION = "3.10.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -45,19 +45,17 @@
45
45
  "typecheck": "tsc --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@aws-amplify/ui": "6.10.1",
49
- "@aws-amplify/ui-react": "6.11.0",
50
- "@aws-amplify/ui-react-core": "3.4.1",
48
+ "@aws-amplify/ui": "6.10.2",
49
+ "@aws-amplify/ui-react": "6.11.1",
50
+ "@aws-amplify/ui-react-core": "3.4.2",
51
51
  "tslib": "^2.5.2"
52
52
  },
53
53
  "peerDependencies": {
54
- "aws-amplify": "^6.9.0",
54
+ "aws-amplify": "^6.14.3",
55
55
  "react": "^16.14 || ^17 || ^18 || ^19",
56
56
  "react-dom": "^16.14 || ^17 || ^18 || ^19"
57
57
  },
58
58
  "devDependencies": {
59
- "jest-tsd": "^0.2.2",
60
- "@tsd/typescript": "^5.1.6",
61
59
  "@types/node": "^18.19.50"
62
60
  },
63
61
  "sideEffects": [
@@ -68,7 +66,7 @@
68
66
  "name": "createStorageBrowser",
69
67
  "path": "dist/esm/browser.mjs",
70
68
  "import": "{ createStorageBrowser }",
71
- "limit": "64 kB",
69
+ "limit": "64.13 kB",
72
70
  "ignore": [
73
71
  "@aws-amplify/storage"
74
72
  ]
@@ -77,7 +75,7 @@
77
75
  "name": "StorageBrowser",
78
76
  "path": "dist/esm/index.mjs",
79
77
  "import": "{ StorageBrowser }",
80
- "limit": "86.5 kB"
78
+ "limit": "86.74 kB"
81
79
  },
82
80
  {
83
81
  "name": "FileUploader",