@aws-amplify/ui-react-storage 3.10.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/{createStorageBrowser-CooF7BS1.js → createStorageBrowser-Cbdy8OAN.js} +39 -30
  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/tasks/useProcessTasks.mjs +20 -11
  9. package/dist/esm/components/StorageBrowser/useAction/useHandler.mjs +5 -5
  10. package/dist/esm/components/StorageBrowser/useAction/useListFolderItems.mjs +2 -2
  11. package/dist/esm/components/StorageBrowser/useAction/useListLocationItems.mjs +2 -2
  12. package/dist/esm/components/StorageBrowser/useAction/useListLocations.mjs +2 -2
  13. package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +2 -2
  14. package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/useFolders.mjs +2 -2
  15. package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/DeleteViewProvider.mjs +2 -2
  16. package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadViewProvider.mjs +2 -2
  17. package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +2 -2
  18. package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +2 -2
  19. package/dist/esm/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.mjs +2 -2
  20. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/copyResolvers.mjs +2 -2
  21. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/deleteResolvers.mjs +2 -2
  22. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/uploadResolvers.mjs +2 -2
  23. package/dist/esm/version.mjs +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/types/components/StorageBrowser/components/index.d.ts +1 -1
  26. package/dist/types/components/StorageBrowser/createStorageBrowser/createStorageBrowser.d.ts +1 -2
  27. package/dist/types/components/StorageBrowser/createStorageBrowser/types.d.ts +21 -15
  28. package/dist/types/components/StorageBrowser/index.d.ts +1 -1
  29. package/dist/types/components/StorageBrowser/tasks/types.d.ts +10 -3
  30. package/dist/types/components/StorageBrowser/tasks/useProcessTasks.d.ts +2 -2
  31. package/dist/types/components/StorageBrowser/useAction/createEnhancedListHandler.d.ts +2 -2
  32. package/dist/types/components/StorageBrowser/useAction/types.d.ts +6 -8
  33. package/dist/types/components/StorageBrowser/views/hooks/useResolveTableData/useResolveTableData.d.ts +1 -1
  34. package/dist/types/version.d.ts +1 -1
  35. 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-Cbdy8OAN.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.2';
36
36
 
37
37
  const toAccessGrantPermission = (permission) => {
38
38
  let result = '';
@@ -1923,9 +1923,9 @@ const QUEUED_TASK_BASE = {
1923
1923
  progress: undefined,
1924
1924
  status: 'QUEUED',
1925
1925
  };
1926
- const isTaskHandlerInput = (input) => !!input.data;
1926
+ const isSingleTaskInput = (input) => !!input.data;
1927
1927
  function useProcessTasks(handler, options) {
1928
- const { concurrency, items, ...callbacks } = options ?? {};
1928
+ const { items, ...callbacks } = options ?? {};
1929
1929
  const callbacksRef = React__namespace["default"].useRef(callbacks);
1930
1930
  if (callbacks) {
1931
1931
  callbacksRef.current = callbacks;
@@ -1996,13 +1996,13 @@ function useProcessTasks(handler, options) {
1996
1996
  });
1997
1997
  flush();
1998
1998
  }, [createTask, flush, updateTask, items, refreshTaskData]);
1999
- const processNextTask = (_input) => {
2000
- const hasInputData = isTaskHandlerInput(_input);
2001
- if (hasInputData) {
1999
+ const processTask = (_input) => {
2000
+ const isSingleTask = isSingleTaskInput(_input);
2001
+ if (isSingleTask) {
2002
2002
  createTask(_input.data);
2003
2003
  flush();
2004
2004
  }
2005
- const { data } = hasInputData
2005
+ const { data } = isSingleTask
2006
2006
  ? _input
2007
2007
  : [...tasksRef.current.values()].find(({ status }) => status === 'QUEUED') ?? {};
2008
2008
  if (!data)
@@ -2047,10 +2047,10 @@ function useProcessTasks(handler, options) {
2047
2047
  const task = getTask();
2048
2048
  if (task && ui.isFunction(onTaskComplete))
2049
2049
  onTaskComplete(task);
2050
- // ignore process next task for single operation inputs
2051
- if (hasInputData)
2050
+ // ignore process next task for single task
2051
+ if (isSingleTask)
2052
2052
  return;
2053
- processNextTask(_input);
2053
+ processTask(_input);
2054
2054
  });
2055
2055
  updateTask(data.id, { cancel, status: 'PENDING' });
2056
2056
  };
@@ -2062,13 +2062,22 @@ function useProcessTasks(handler, options) {
2062
2062
  if (isProcessing) {
2063
2063
  return;
2064
2064
  }
2065
+ // if single task, run `processTask` once
2066
+ if (isSingleTaskInput(input)) {
2067
+ processTask(input);
2068
+ return;
2069
+ }
2070
+ const { concurrency, ...options } = input.options ?? {};
2071
+ // reconstruct `input` without `concurrency`
2072
+ const _input = { ...input, options };
2073
+ // for batch tasks, if no `concurrency` process tasks individually
2065
2074
  if (!concurrency) {
2066
- processNextTask(input);
2075
+ processTask(_input);
2067
2076
  return;
2068
2077
  }
2069
2078
  let count = 0;
2070
2079
  while (count < concurrency) {
2071
- processNextTask(input);
2080
+ processTask(_input);
2072
2081
  count++;
2073
2082
  }
2074
2083
  };
@@ -2084,10 +2093,7 @@ function useProcessTasks(handler, options) {
2084
2093
  const isOptionsWithItems = (options) => !!options?.items;
2085
2094
  const isHandleTaskInput = (value) => !!value?.data;
2086
2095
  function useHandler(handler, options) {
2087
- const [state, handleProcessing] = useProcessTasks(handler, {
2088
- ...options,
2089
- concurrency: DEFAULT_ACTION_CONCURRENCY,
2090
- });
2096
+ const [state, handleProcessing] = useProcessTasks(handler, options);
2091
2097
  const getConfig = useGetActionInput();
2092
2098
  const { reset, isProcessing, tasks, ...rest } = state;
2093
2099
  const handleDispatch = React__namespace["default"].useCallback((input) => {
@@ -2098,7 +2104,10 @@ function useHandler(handler, options) {
2098
2104
  reset();
2099
2105
  handleProcessing({
2100
2106
  config,
2101
- ...(hasData ? { data: input.data } : undefined),
2107
+ ...(hasData
2108
+ ? { data: input.data }
2109
+ : // if no `data` provided, provide `concurrency` to `options`
2110
+ { options: { concurrency: DEFAULT_ACTION_CONCURRENCY } }),
2102
2111
  });
2103
2112
  }, [getConfig, handleProcessing, reset]);
2104
2113
  if (isOptionsWithItems(options)) {
@@ -2134,7 +2143,7 @@ const useListLocations = () => {
2134
2143
  });
2135
2144
  const { listLocations } = handlers;
2136
2145
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler(listLocations), [listLocations]);
2137
- return uiReactCore.useDataState(enhancedHandler, {
2146
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2138
2147
  items: [],
2139
2148
  nextToken: undefined,
2140
2149
  });
@@ -2147,7 +2156,7 @@ const useListLocationItems = () => {
2147
2156
  const getConfig = useGetActionInput();
2148
2157
  const { listLocationItems } = handlers;
2149
2158
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
2150
- return uiReactCore.useDataState(enhancedHandler, {
2159
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2151
2160
  items: [],
2152
2161
  nextToken: undefined,
2153
2162
  });
@@ -2160,7 +2169,7 @@ const useListFolderItems = () => {
2160
2169
  const getConfig = useGetActionInput();
2161
2170
  const { listLocationItems } = handlers;
2162
2171
  const enhancedHandler = React__namespace["default"].useMemo(() => createEnhancedListHandler((input) => listLocationItems({ ...input, config: getConfig() })), [getConfig, listLocationItems]);
2163
- return uiReactCore.useDataState(enhancedHandler, {
2172
+ return uiReactCore.useAsyncReducer(enhancedHandler, {
2164
2173
  items: [],
2165
2174
  nextToken: undefined,
2166
2175
  });
@@ -3104,7 +3113,7 @@ function DisplayTextProvider({ children, displayText: _override, }) {
3104
3113
  const isCopyViewDisplayTextKey = (value) => !!DEFAULT_COPY_VIEW_DISPLAY_TEXT[value];
3105
3114
  const isDeleteViewDisplayTextKey = (value) => !!DEFAULT_DELETE_VIEW_DISPLAY_TEXT[value];
3106
3115
 
3107
- function useResolveDataTable(keys, { getCell, getHeader, getRowKey }, { items, props }) {
3116
+ function useResolveTableData(keys, { getCell, getHeader, getRowKey }, { items, props }) {
3108
3117
  return React__namespace["default"].useMemo(() => {
3109
3118
  const getRow = (item) => ({
3110
3119
  key: getRowKey({ item, props }),
@@ -3453,7 +3462,7 @@ function UploadViewProvider({ children, ...props }) {
3453
3462
  const filesValidationMessage = invalidFiles && !isProcessing
3454
3463
  ? getFilesValidationMessage({ invalidFiles })
3455
3464
  : undefined;
3456
- const tableData = useResolveDataTable(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
3465
+ const tableData = useResolveTableData(UPLOAD_TABLE_KEYS, UPLOAD_TABLE_RESOLVERS, {
3457
3466
  items,
3458
3467
  props: { displayText, isProcessing, isMultipartUpload, onTaskRemove },
3459
3468
  });
@@ -3854,7 +3863,7 @@ function CopyViewProvider({ children, ...props }) {
3854
3863
  const { actionCancelLabel, actionDestinationLabel, actionExitLabel, actionStartLabel, getActionCompleteMessage, overwriteWarningMessage, searchPlaceholder, searchSubmitLabel, searchClearLabel, statusDisplayCanceledLabel, statusDisplayCompletedLabel, statusDisplayFailedLabel, statusDisplayQueuedLabel, title, } = displayText;
3855
3864
  const { destination, folders, isProcessing, isProcessingComplete, statusCounts, tasks: items, onActionCancel, onActionExit, onActionStart, onSelectDestination, onTaskRemove, } = props;
3856
3865
  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, {
3866
+ const tableData = useResolveTableData(COPY_TABLE_KEYS, COPY_TABLE_RESOLVERS, {
3858
3867
  items,
3859
3868
  props: { displayText, isProcessing, onTaskRemove },
3860
3869
  });
@@ -4005,8 +4014,8 @@ const DEFAULT_LIST_OPTIONS$2 = {
4005
4014
  const DEFAULT_REFRESH_OPTIONS = { ...DEFAULT_LIST_OPTIONS$2, refresh: true };
4006
4015
  const useFolders = ({ destination, setDestination, }) => {
4007
4016
  const { current, key } = destination;
4008
- const [{ data, hasError, isLoading, message }, handleList] = useList('folderItems');
4009
- const { items, nextToken, search } = data;
4017
+ const [{ value, hasError, isLoading, message }, handleList] = useList('folderItems');
4018
+ const { items, nextToken, search } = value;
4010
4019
  const { hasExhaustedSearch = false } = search ?? {};
4011
4020
  const onInitialize = React__namespace["default"].useCallback(() => {
4012
4021
  handleList({
@@ -4199,7 +4208,7 @@ function DeleteViewProvider({ children, ...props }) {
4199
4208
  const message = isProcessingComplete
4200
4209
  ? getActionCompleteMessage({ counts: statusCounts })
4201
4210
  : undefined;
4202
- const tableData = useResolveDataTable(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
4211
+ const tableData = useResolveTableData(DELETE_TABLE_KEYS, DELETE_TABLE_RESOLVERS, {
4203
4212
  items,
4204
4213
  props: { displayText, isProcessing, onTaskRemove },
4205
4214
  });
@@ -4644,9 +4653,9 @@ const useLocationDetailView = (options) => {
4644
4653
  const { fileDataItems } = locationItems;
4645
4654
  const hasInvalidPrefix = ui.isUndefined(prefix);
4646
4655
  const [{ task }, handleDownload] = useAction('download');
4647
- const [{ data, isLoading, hasError, message }, handleList] = useList('locationItems');
4656
+ const [{ value, isLoading, hasError, message }, handleList] = useList('locationItems');
4648
4657
  // set up pagination
4649
- const { items, nextToken, search } = data;
4658
+ const { items, nextToken, search } = value;
4650
4659
  const { hasExhaustedSearch = false } = search ?? {};
4651
4660
  const onPaginate = () => {
4652
4661
  if (hasInvalidPrefix || !nextToken)
@@ -4981,8 +4990,8 @@ const useLocationsView = (options) => {
4981
4990
  const handleDownload = useAction('download')[1];
4982
4991
  const [state, handleList] = useList('locations');
4983
4992
  const dispatchStoreAction = useStore()[1];
4984
- const { data, message, hasError, isLoading } = state;
4985
- const { items, nextToken, search } = data;
4993
+ const { value, message, hasError, isLoading } = state;
4994
+ const { items, nextToken, search } = value;
4986
4995
  const hasNextToken = !!nextToken;
4987
4996
  const { hasExhaustedSearch = false } = search ?? {};
4988
4997
  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;
@@ -8,9 +8,9 @@ const QUEUED_TASK_BASE = {
8
8
  progress: undefined,
9
9
  status: 'QUEUED',
10
10
  };
11
- const isTaskHandlerInput = (input) => !!input.data;
11
+ const isSingleTaskInput = (input) => !!input.data;
12
12
  function useProcessTasks(handler, options) {
13
- const { concurrency, items, ...callbacks } = options ?? {};
13
+ const { items, ...callbacks } = options ?? {};
14
14
  const callbacksRef = React__default.useRef(callbacks);
15
15
  if (callbacks) {
16
16
  callbacksRef.current = callbacks;
@@ -81,13 +81,13 @@ function useProcessTasks(handler, options) {
81
81
  });
82
82
  flush();
83
83
  }, [createTask, flush, updateTask, items, refreshTaskData]);
84
- const processNextTask = (_input) => {
85
- const hasInputData = isTaskHandlerInput(_input);
86
- if (hasInputData) {
84
+ const processTask = (_input) => {
85
+ const isSingleTask = isSingleTaskInput(_input);
86
+ if (isSingleTask) {
87
87
  createTask(_input.data);
88
88
  flush();
89
89
  }
90
- const { data } = hasInputData
90
+ const { data } = isSingleTask
91
91
  ? _input
92
92
  : [...tasksRef.current.values()].find(({ status }) => status === 'QUEUED') ?? {};
93
93
  if (!data)
@@ -132,10 +132,10 @@ function useProcessTasks(handler, options) {
132
132
  const task = getTask();
133
133
  if (task && isFunction(onTaskComplete))
134
134
  onTaskComplete(task);
135
- // ignore process next task for single operation inputs
136
- if (hasInputData)
135
+ // ignore process next task for single task
136
+ if (isSingleTask)
137
137
  return;
138
- processNextTask(_input);
138
+ processTask(_input);
139
139
  });
140
140
  updateTask(data.id, { cancel, status: 'PENDING' });
141
141
  };
@@ -147,13 +147,22 @@ function useProcessTasks(handler, options) {
147
147
  if (isProcessing) {
148
148
  return;
149
149
  }
150
+ // if single task, run `processTask` once
151
+ if (isSingleTaskInput(input)) {
152
+ processTask(input);
153
+ return;
154
+ }
155
+ const { concurrency, ...options } = input.options ?? {};
156
+ // reconstruct `input` without `concurrency`
157
+ const _input = { ...input, options };
158
+ // for batch tasks, if no `concurrency` process tasks individually
150
159
  if (!concurrency) {
151
- processNextTask(input);
160
+ processTask(_input);
152
161
  return;
153
162
  }
154
163
  let count = 0;
155
164
  while (count < concurrency) {
156
- processNextTask(input);
165
+ processTask(_input);
157
166
  count++;
158
167
  }
159
168
  };
@@ -9,10 +9,7 @@ import { useProcessTasks } from '../tasks/useProcessTasks.mjs';
9
9
  const isOptionsWithItems = (options) => !!options?.items;
10
10
  const isHandleTaskInput = (value) => !!value?.data;
11
11
  function useHandler(handler, options) {
12
- const [state, handleProcessing] = useProcessTasks(handler, {
13
- ...options,
14
- concurrency: DEFAULT_ACTION_CONCURRENCY,
15
- });
12
+ const [state, handleProcessing] = useProcessTasks(handler, options);
16
13
  const getConfig = useGetActionInput();
17
14
  const { reset, isProcessing, tasks, ...rest } = state;
18
15
  const handleDispatch = React__default.useCallback((input) => {
@@ -23,7 +20,10 @@ function useHandler(handler, options) {
23
20
  reset();
24
21
  handleProcessing({
25
22
  config,
26
- ...(hasData ? { data: input.data } : undefined),
23
+ ...(hasData
24
+ ? { data: input.data }
25
+ : // if no `data` provided, provide `concurrency` to `options`
26
+ { options: { concurrency: DEFAULT_ACTION_CONCURRENCY } }),
27
27
  });
28
28
  }, [getConfig, handleProcessing, reset]);
29
29
  if (isOptionsWithItems(options)) {
@@ -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.2';
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-Cbdy8OAN.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 { TaskHandlerInput, TaskData, TaskResult, TaskResultStatus } from '../actions';
1
+ import { TaskHandlerInput, TaskData, TaskResult, TaskResultStatus, TaskHandlerOptions } from '../actions';
2
2
  /**
3
3
  * extends {@link TaskResultStatus} to include `QUEUED` and `PENDING` statuses
4
4
  * used in task processing
@@ -9,7 +9,6 @@ export type TaskStatus = TaskResultStatus | 'QUEUED' | 'PENDING';
9
9
  */
10
10
  export type StatusCounts = Record<TaskStatus | 'TOTAL', number>;
11
11
  export interface ProcessTasksOptions<TTask extends Task, TItems = []> {
12
- concurrency?: number;
13
12
  items?: TItems;
14
13
  onTaskCancel?: (task: TTask) => void;
15
14
  onTaskComplete?: (task: TTask) => void;
@@ -48,4 +47,12 @@ export type UseProcessTasksState<TTask, TInput> = [
48
47
  TasksState<TTask>,
49
48
  HandleProcessTasks<TInput>
50
49
  ];
51
- export type InferHandleTasksInput<TItems, TData extends TaskData> = TItems extends NonNullable<TItems> ? Omit<TaskHandlerInput<TData>, 'data'> : TaskHandlerInput<TData>;
50
+ interface HandleTasksOptions extends TaskHandlerOptions {
51
+ concurrency?: number;
52
+ }
53
+ export interface HandleBatchTasksInput<TData extends TaskData> extends Omit<TaskHandlerInput<TData, HandleTasksOptions>, 'data'> {
54
+ }
55
+ export interface HandleSingleTaskInput<TData extends TaskData> extends TaskHandlerInput<TData> {
56
+ }
57
+ export type InferHandleTasksInput<TItems, TData extends TaskData> = TItems extends NonNullable<TItems> ? HandleBatchTasksInput<TData> : HandleSingleTaskInput<TData>;
58
+ export {};
@@ -1,3 +1,3 @@
1
- import { ActionHandler } from '../actions';
2
- import { InferHandleTasksInput, Task, ProcessTasksOptions, UseProcessTasksState } from './types';
1
+ import type { ActionHandler } from '../actions';
2
+ import type { InferHandleTasksInput, Task, ProcessTasksOptions, UseProcessTasksState } from './types';
3
3
  export declare function useProcessTasks<TData, TValue, TTask extends Task<TData, TValue>, TInput extends InferHandleTasksInput<TItems, TTask['data']>, TItems extends TTask['data'][] | undefined = undefined>(handler: ActionHandler<TData, TValue>, options?: ProcessTasksOptions<TTask, TItems>): UseProcessTasksState<TTask, TInput>;
@@ -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.2";
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.2",
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.19 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",