@aws-amplify/ui-react-storage 3.17.0 → 3.17.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 (49) hide show
  1. package/dist/browser.js +2 -2
  2. package/dist/{createStorageBrowser-De4hcP-u.js → createStorageBrowser-CtfBkr62.js} +81 -90
  3. package/dist/esm/browser.mjs +1 -1
  4. package/dist/esm/components/StorageBrowser/StorageBrowserAmplify.mjs +1 -1
  5. package/dist/esm/components/StorageBrowser/actions/configs/defaults.mjs +1 -1
  6. package/dist/esm/components/StorageBrowser/actions/handlers/composedDownloadHandler.mjs +6 -0
  7. package/dist/esm/components/StorageBrowser/actions/handlers/defaults.mjs +2 -2
  8. package/dist/esm/components/StorageBrowser/actions/handlers/download.mjs +38 -0
  9. package/dist/esm/components/StorageBrowser/actions/handlers/utils.mjs +1 -1
  10. package/dist/esm/components/StorageBrowser/actions/handlers/zipdownload.mjs +35 -76
  11. package/dist/esm/components/StorageBrowser/adapters/createAmplifyAuthAdapter/getPaginatedLocations.mjs +1 -1
  12. package/dist/esm/components/StorageBrowser/adapters/createManagedAuthAdapter/createManagedAuthAdapter.mjs +1 -1
  13. package/dist/esm/components/StorageBrowser/controls/hooks/useResolvedComposable.mjs +2 -3
  14. package/dist/esm/components/StorageBrowser/createStorageBrowser/StorageBrowserDefault.mjs +1 -1
  15. package/dist/esm/components/StorageBrowser/createStorageBrowser/createProvider.mjs +1 -1
  16. package/dist/esm/components/StorageBrowser/createStorageBrowser/createStorageBrowser.mjs +1 -1
  17. package/dist/esm/components/StorageBrowser/locationItems/context.mjs +1 -1
  18. package/dist/esm/components/StorageBrowser/views/LocationActionView/CopyView/CopyViewProvider.mjs +1 -1
  19. package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/useDeleteView.mjs +1 -1
  20. package/dist/esm/components/StorageBrowser/views/LocationActionView/DeleteView/utils.mjs +2 -2
  21. package/dist/esm/components/StorageBrowser/views/LocationActionView/DownloadView/DownloadViewProvider.mjs +1 -1
  22. package/dist/esm/components/StorageBrowser/views/LocationActionView/UploadView/UploadViewProvider.mjs +1 -1
  23. package/dist/esm/components/StorageBrowser/views/LocationDetailView/getLocationDetailViewTableData/getLocationDetailViewTableData.mjs +1 -1
  24. package/dist/esm/components/StorageBrowser/views/LocationDetailView/useLocationDetailView.mjs +1 -1
  25. package/dist/esm/components/StorageBrowser/views/LocationsView/useLocationsView.mjs +1 -1
  26. package/dist/esm/components/StorageBrowser/views/context/actionViews.mjs +1 -1
  27. package/dist/esm/components/StorageBrowser/views/context/primaryViews.mjs +1 -1
  28. package/dist/esm/components/StorageBrowser/views/hooks/useFilePreview/useFilePreview.mjs +2 -2
  29. package/dist/esm/components/StorageBrowser/views/utils/files/fileSize.mjs +1 -1
  30. package/dist/esm/components/StorageBrowser/views/utils/files/fileType.mjs +1 -1
  31. package/dist/esm/components/StorageBrowser/views/utils/files/safeGetProperties.mjs +1 -1
  32. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/copyResolvers.mjs +1 -1
  33. package/dist/esm/components/StorageBrowser/views/utils/tableResolvers/deleteResolvers.mjs +1 -1
  34. package/dist/esm/version.mjs +1 -1
  35. package/dist/index.js +2 -2
  36. package/dist/styles.css +4 -1
  37. package/dist/types/components/StorageBrowser/actions/configs/index.d.ts +1 -1
  38. package/dist/types/components/StorageBrowser/actions/handlers/composedDownloadHandler.d.ts +2 -0
  39. package/dist/types/components/StorageBrowser/actions/handlers/index.d.ts +1 -1
  40. package/dist/types/components/StorageBrowser/fileItems/index.d.ts +1 -1
  41. package/dist/types/components/StorageBrowser/views/LocationActionView/CopyView/index.d.ts +1 -1
  42. package/dist/types/components/StorageBrowser/views/LocationActionView/CreateFolderView/index.d.ts +1 -1
  43. package/dist/types/components/StorageBrowser/views/LocationActionView/DeleteView/index.d.ts +1 -1
  44. package/dist/types/components/StorageBrowser/views/LocationActionView/DownloadView/index.d.ts +1 -1
  45. package/dist/types/components/StorageBrowser/views/LocationActionView/UploadView/index.d.ts +1 -1
  46. package/dist/types/components/StorageBrowser/views/hooks/useFilePreview/index.d.ts +1 -1
  47. package/dist/types/components/StorageBrowser/views/index.d.ts +1 -1
  48. package/dist/types/version.d.ts +1 -1
  49. package/package.json +7 -7
package/dist/browser.js CHANGED
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var internals = require('@aws-amplify/storage/internals');
6
6
  require('aws-amplify');
7
7
  require('@aws-amplify/ui');
8
- var createStorageBrowser = require('./createStorageBrowser-De4hcP-u.js');
9
- require('jszip');
8
+ var createStorageBrowser = require('./createStorageBrowser-CtfBkr62.js');
9
+ require('@zip.js/zip.js');
10
10
  require('aws-amplify/storage');
11
11
  require('react');
12
12
  require('@aws-amplify/ui-react');
@@ -10,11 +10,9 @@ var uiReact = require('@aws-amplify/ui-react');
10
10
  var elements = require('@aws-amplify/ui-react-core/elements');
11
11
  var internal = require('@aws-amplify/ui-react/internal');
12
12
  var uiReactCore = require('@aws-amplify/ui-react-core');
13
- var JSZip = require('jszip');
13
+ var zip_js = require('@zip.js/zip.js');
14
14
  var storage = require('aws-amplify/storage');
15
15
 
16
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
-
18
16
  function _interopNamespace(e) {
19
17
  if (e && e.__esModule) return e;
20
18
  var n = Object.create(null);
@@ -34,9 +32,8 @@ function _interopNamespace(e) {
34
32
  }
35
33
 
36
34
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
37
- var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
38
35
 
39
- const VERSION = '3.17.0';
36
+ const VERSION = '3.17.2';
40
37
 
41
38
  const DEFAULT_CHECKSUM_ALGORITHM = 'crc-32';
42
39
  // 5MiB for multipart upload
@@ -56,7 +53,7 @@ const getBucketRegion = (bucketName, fallbackRegion) => {
56
53
  }
57
54
  return fallbackRegion;
58
55
  }
59
- catch (error) {
56
+ catch {
60
57
  return fallbackRegion;
61
58
  }
62
59
  };
@@ -261,7 +258,7 @@ const getPaginatedLocations = ({ items, pageSize, nextToken, }) => {
261
258
  if (Number(nextToken) > items.length) {
262
259
  return { items: [], nextToken: undefined };
263
260
  }
264
- const start = -nextToken;
261
+ const start = parseInt(nextToken, 10) * -1;
265
262
  const end = start + pageSize < 0 ? start + pageSize : undefined;
266
263
  return {
267
264
  items: items.slice(start, end),
@@ -476,83 +473,73 @@ const deleteHandler = ({ config, data, options, }) => {
476
473
  return { result, cancel };
477
474
  };
478
475
 
479
- const zipProgressManager = ({ dataMap, onZipProgress, }) => {
480
- const iter = (() => {
481
- let f;
482
- let i = 0;
483
- return (str) => {
484
- if (!f) {
485
- f = str;
486
- }
487
- else if (str !== f) {
488
- ++i;
489
- f = str;
490
- }
491
- return i;
492
- };
493
- })();
494
- const progressMap = new Map(Array.from(dataMap.keys()).map((k) => [k, 0]));
495
- const total = dataMap.size;
496
- dataMap.forEach((data, key) => {
497
- onZipProgress(key, 0, data);
476
+ function downloadFromUrl(fileName, url) {
477
+ const a = document.createElement('a');
478
+ a.href = url;
479
+ a.download = fileName;
480
+ a.target = '_blank';
481
+ document.body.appendChild(a);
482
+ a.click();
483
+ document.body.removeChild(a);
484
+ }
485
+ const downloadHandler$1 = ({ config, data }) => {
486
+ const { accountId, credentials, customEndpoint } = config;
487
+ const { key } = data;
488
+ const result = internals.getUrl({
489
+ path: key,
490
+ options: {
491
+ bucket: constructBucket$1(config),
492
+ customEndpoint,
493
+ locationCredentialsProvider: credentials,
494
+ validateObjectExistence: true,
495
+ contentDisposition: 'attachment',
496
+ expectedBucketOwner: accountId,
497
+ },
498
+ })
499
+ .then(({ url }) => {
500
+ downloadFromUrl(key, url.toString());
501
+ return { status: 'COMPLETE', value: { url } };
502
+ })
503
+ .catch((error) => {
504
+ const { message } = error;
505
+ return { error, message, status: 'FAILED' };
498
506
  });
499
- return ({ percent, currentFile, }) => {
500
- if (currentFile) {
501
- const item = iter(currentFile);
502
- const sliceSize = 100 / total; // when 3 this is 33.3%
503
- const start = sliceSize * item; // this is 66.6% for last item of 3;
504
- // take percent and calculate the percent of the slice
505
- const progress = percent - start;
506
- const actualPercent = (progress / sliceSize) * 100;
507
- progressMap.set(currentFile, Math.max(actualPercent, progressMap.get(currentFile) ?? 0));
508
- onZipProgress(currentFile, progressMap.get(currentFile), dataMap.get(currentFile));
509
- }
510
- };
507
+ return { result };
511
508
  };
509
+
512
510
  const zipper = (() => {
513
- let zip = null;
514
- const dataMap = new Map();
511
+ let blobWriter = null;
512
+ let zipWriter = null;
515
513
  return {
516
- addFile: (file, name, data) => {
517
- if (!zip) {
518
- zip = new JSZip__default["default"]();
514
+ addFile: async (file, name, options) => {
515
+ const { data, signal, onProgress } = options ?? {};
516
+ if (!blobWriter) {
517
+ blobWriter = new zip_js.BlobWriter('application/zip');
518
+ zipWriter = new zip_js.ZipWriter(blobWriter);
519
519
  }
520
- dataMap.set(name, data);
521
- return new Promise((ok, no) => {
522
- try {
523
- zip?.file(name, file);
524
- ok();
525
- }
526
- catch (e) {
527
- no();
528
- }
520
+ await zipWriter.add(name, new zip_js.BlobReader(file), {
521
+ level: 0,
522
+ signal,
523
+ onprogress: (progress, total) => {
524
+ if (ui.isFunction(onProgress) && data) {
525
+ onProgress(progress / total, name, data);
526
+ }
527
+ return undefined;
528
+ },
529
529
  });
530
530
  },
531
- getBlobUrl: async (onProgress) => {
532
- if (!zip) {
531
+ getBlobUrl: async () => {
532
+ if (!zipWriter) {
533
533
  throw new Error('no zip');
534
534
  }
535
- const blob = await zip.generateAsync({
536
- type: 'blob',
537
- streamFiles: true,
538
- compression: 'DEFLATE',
539
- compressionOptions: {
540
- level: 5,
541
- },
542
- }, zipProgressManager({
543
- dataMap,
544
- onZipProgress: (file, progress, data) => {
545
- if (ui.isFunction(onProgress)) {
546
- onProgress(progress, file, data);
547
- }
548
- },
549
- }));
550
- zip = null;
535
+ const blob = await zipWriter.close();
536
+ zipWriter = null;
537
+ blobWriter = null;
551
538
  return URL.createObjectURL(blob);
552
539
  },
553
540
  destroy: () => {
554
- dataMap.clear();
555
- zip = null;
541
+ zipWriter = null;
542
+ blobWriter = null;
556
543
  },
557
544
  };
558
545
  })();
@@ -601,7 +588,15 @@ const download = async ({ config, data, all, options }, abortController) => {
601
588
  });
602
589
  const blob = await readBody(response, { data, options });
603
590
  const [filename] = key.split('/').reverse();
604
- await zipper.addFile(blob, filename, data);
591
+ await zipper.addFile(blob, filename, {
592
+ data,
593
+ signal: abortController.signal,
594
+ onProgress: (progress, _name, _data) => {
595
+ if (ui.isFunction(options?.onProgress)) {
596
+ options?.onProgress(_data, progress, progress === 1 ? 'COMPLETE' : 'FINISHING');
597
+ }
598
+ },
599
+ });
605
600
  return filename;
606
601
  };
607
602
  const downloadHandler = (() => {
@@ -620,7 +615,7 @@ const downloadHandler = (() => {
620
615
  .then(() => {
621
616
  fileDownloadQueue.set(key, true);
622
617
  return {
623
- status: 'LOADED',
618
+ status: 'COMPLETE',
624
619
  };
625
620
  })
626
621
  .catch((e) => {
@@ -638,12 +633,7 @@ const downloadHandler = (() => {
638
633
  });
639
634
  if (done) {
640
635
  zipper
641
- .getBlobUrl((percent, name, _data) => {
642
- if (ui.isFunction(options?.onProgress)) {
643
- const progress = percent / 100;
644
- options?.onProgress(_data, progress, progress === 1 ? 'COMPLETE' : 'FINISHING');
645
- }
646
- })
636
+ .getBlobUrl()
647
637
  .then((blobURL) => {
648
638
  if (blobURL) {
649
639
  zipper.destroy();
@@ -665,6 +655,8 @@ const downloadHandler = (() => {
665
655
  return handler;
666
656
  })();
667
657
 
658
+ const composedDownloadHandler = (input) => input.all.length === 1 ? downloadHandler$1(input) : downloadHandler(input);
659
+
668
660
  const DEFAULT_PAGE_SIZE$2 = 1000;
669
661
  const parseItems = (items, excludedPath) => items
670
662
  // remove root `key` from results
@@ -786,7 +778,7 @@ const defaultHandlers = {
786
778
  copy: copyHandler,
787
779
  createFolder: createFolderHandler,
788
780
  delete: deleteHandler,
789
- download: downloadHandler,
781
+ download: composedDownloadHandler,
790
782
  listLocationItems: listLocationItemsHandler,
791
783
  upload: uploadHandler,
792
784
  };
@@ -3097,7 +3089,7 @@ function determineFileType(options) {
3097
3089
  return customResult;
3098
3090
  }
3099
3091
  }
3100
- catch (error) {
3092
+ catch {
3101
3093
  //
3102
3094
  }
3103
3095
  }
@@ -3705,11 +3697,10 @@ const useActionCancel = () => {
3705
3697
  function useResolvedComposable(DefaultComposable, name) {
3706
3698
  const { composables } = useComposables();
3707
3699
  const Composable = React__namespace["default"].useMemo(() => {
3708
- const ResolvedComposable = (props) => {
3700
+ function ResolvedComposable(props) {
3709
3701
  const Resolved = composables?.[name] ?? DefaultComposable;
3710
3702
  return React__namespace["default"].createElement(Resolved, { ...props });
3711
- };
3712
- ResolvedComposable.displayName = name;
3703
+ }
3713
3704
  return ResolvedComposable;
3714
3705
  }, [composables, DefaultComposable, name]);
3715
3706
  return Composable;
@@ -4483,7 +4474,7 @@ const countFilesInFolder = async (folderKey, config) => {
4483
4474
  }
4484
4475
  return fileCount;
4485
4476
  }
4486
- catch (error) {
4477
+ catch {
4487
4478
  return 0;
4488
4479
  }
4489
4480
  };
@@ -5720,7 +5711,7 @@ const useDeleteView = (options) => {
5720
5711
  const totalCount = await countFilesInFolder(folder.key, config);
5721
5712
  folderCountsRef.current.set(folder.id, totalCount);
5722
5713
  }
5723
- catch (error) {
5714
+ catch {
5724
5715
  folderCountsRef.current.set(folder.id, null);
5725
5716
  }
5726
5717
  }));
@@ -6298,7 +6289,7 @@ function resolveMaxFileSize(maxFileSize, fileType) {
6298
6289
  return result;
6299
6290
  }
6300
6291
  }
6301
- catch (error) {
6292
+ catch {
6302
6293
  //
6303
6294
  }
6304
6295
  }
@@ -6311,7 +6302,7 @@ async function safeGetProperties(params) {
6311
6302
  try {
6312
6303
  return await storage.getProperties(params);
6313
6304
  }
6314
- catch (error) {
6305
+ catch {
6315
6306
  return {};
6316
6307
  }
6317
6308
  }
@@ -6382,7 +6373,7 @@ function useFilePreview({ activeFile, }) {
6382
6373
  url: url.toString(),
6383
6374
  });
6384
6375
  }
6385
- catch (error) {
6376
+ catch {
6386
6377
  setFilePreviewContent({
6387
6378
  isLoading: false,
6388
6379
  ok: false,
@@ -2,7 +2,7 @@ import '@aws-amplify/storage/internals';
2
2
  import 'aws-amplify';
3
3
  import '@aws-amplify/ui';
4
4
  export { defaultHandlers } from './components/StorageBrowser/actions/handlers/defaults.mjs';
5
- import 'jszip';
5
+ import '@zip.js/zip.js';
6
6
  import 'aws-amplify/storage';
7
7
  import './components/StorageBrowser/actions/configs/context.mjs';
8
8
  export { defaultActionConfigs } from './components/StorageBrowser/actions/configs/defaults.mjs';
@@ -3,7 +3,7 @@ import { createAmplifyAuthAdapter } from './adapters/createAmplifyAuthAdapter/cr
3
3
  import '@aws-amplify/storage/internals';
4
4
  import 'aws-amplify';
5
5
  import '@aws-amplify/ui';
6
- import 'jszip';
6
+ import '@zip.js/zip.js';
7
7
  import 'aws-amplify/storage';
8
8
  import './actions/configs/context.mjs';
9
9
  import './actions/configs/defaults.mjs';
@@ -3,7 +3,7 @@ import '@aws-amplify/storage/internals';
3
3
  import 'aws-amplify';
4
4
  import '@aws-amplify/ui';
5
5
  import { defaultHandlers } from '../handlers/defaults.mjs';
6
- import 'jszip';
6
+ import '@zip.js/zip.js';
7
7
  import 'aws-amplify/storage';
8
8
 
9
9
  const copyActionConfig = {
@@ -0,0 +1,6 @@
1
+ import { downloadHandler } from './download.mjs';
2
+ import { zipDownloadHandler as downloadHandler$1 } from './zipdownload.mjs';
3
+
4
+ const composedDownloadHandler = (input) => input.all.length === 1 ? downloadHandler(input) : downloadHandler$1(input);
5
+
6
+ export { composedDownloadHandler };
@@ -1,7 +1,7 @@
1
1
  import { copyHandler } from './copy.mjs';
2
2
  import { createFolderHandler } from './createFolder.mjs';
3
3
  import { deleteHandler } from './delete.mjs';
4
- import { zipDownloadHandler as downloadHandler } from './zipdownload.mjs';
4
+ import { composedDownloadHandler } from './composedDownloadHandler.mjs';
5
5
  import { listLocationItemsHandler } from './listLocationItems.mjs';
6
6
  import { uploadHandler } from './upload.mjs';
7
7
 
@@ -9,7 +9,7 @@ const defaultHandlers = {
9
9
  copy: copyHandler,
10
10
  createFolder: createFolderHandler,
11
11
  delete: deleteHandler,
12
- download: downloadHandler,
12
+ download: composedDownloadHandler,
13
13
  listLocationItems: listLocationItemsHandler,
14
14
  upload: uploadHandler,
15
15
  };
@@ -0,0 +1,38 @@
1
+ import { getUrl } from '@aws-amplify/storage/internals';
2
+ import { constructBucket } from './utils.mjs';
3
+
4
+ function downloadFromUrl(fileName, url) {
5
+ const a = document.createElement('a');
6
+ a.href = url;
7
+ a.download = fileName;
8
+ a.target = '_blank';
9
+ document.body.appendChild(a);
10
+ a.click();
11
+ document.body.removeChild(a);
12
+ }
13
+ const downloadHandler = ({ config, data }) => {
14
+ const { accountId, credentials, customEndpoint } = config;
15
+ const { key } = data;
16
+ const result = getUrl({
17
+ path: key,
18
+ options: {
19
+ bucket: constructBucket(config),
20
+ customEndpoint,
21
+ locationCredentialsProvider: credentials,
22
+ validateObjectExistence: true,
23
+ contentDisposition: 'attachment',
24
+ expectedBucketOwner: accountId,
25
+ },
26
+ })
27
+ .then(({ url }) => {
28
+ downloadFromUrl(key, url.toString());
29
+ return { status: 'COMPLETE', value: { url } };
30
+ })
31
+ .catch((error) => {
32
+ const { message } = error;
33
+ return { error, message, status: 'FAILED' };
34
+ });
35
+ return { result };
36
+ };
37
+
38
+ export { downloadHandler };
@@ -14,7 +14,7 @@ const getBucketRegion = (bucketName, fallbackRegion) => {
14
14
  }
15
15
  return fallbackRegion;
16
16
  }
17
- catch (error) {
17
+ catch {
18
18
  return fallbackRegion;
19
19
  }
20
20
  };
@@ -1,85 +1,41 @@
1
1
  import { getUrl } from '@aws-amplify/storage/internals';
2
2
  import { isFunction } from '@aws-amplify/ui';
3
3
  import { getProgress } from './utils.mjs';
4
- import JSZip from 'jszip';
4
+ import { BlobWriter, ZipWriter, BlobReader } from '@zip.js/zip.js';
5
5
 
6
- const zipProgressManager = ({ dataMap, onZipProgress, }) => {
7
- const iter = (() => {
8
- let f;
9
- let i = 0;
10
- return (str) => {
11
- if (!f) {
12
- f = str;
13
- }
14
- else if (str !== f) {
15
- ++i;
16
- f = str;
17
- }
18
- return i;
19
- };
20
- })();
21
- const progressMap = new Map(Array.from(dataMap.keys()).map((k) => [k, 0]));
22
- const total = dataMap.size;
23
- dataMap.forEach((data, key) => {
24
- onZipProgress(key, 0, data);
25
- });
26
- return ({ percent, currentFile, }) => {
27
- if (currentFile) {
28
- const item = iter(currentFile);
29
- const sliceSize = 100 / total; // when 3 this is 33.3%
30
- const start = sliceSize * item; // this is 66.6% for last item of 3;
31
- // take percent and calculate the percent of the slice
32
- const progress = percent - start;
33
- const actualPercent = (progress / sliceSize) * 100;
34
- progressMap.set(currentFile, Math.max(actualPercent, progressMap.get(currentFile) ?? 0));
35
- onZipProgress(currentFile, progressMap.get(currentFile), dataMap.get(currentFile));
36
- }
37
- };
38
- };
39
6
  const zipper = (() => {
40
- let zip = null;
41
- const dataMap = new Map();
7
+ let blobWriter = null;
8
+ let zipWriter = null;
42
9
  return {
43
- addFile: (file, name, data) => {
44
- if (!zip) {
45
- zip = new JSZip();
10
+ addFile: async (file, name, options) => {
11
+ const { data, signal, onProgress } = options ?? {};
12
+ if (!blobWriter) {
13
+ blobWriter = new BlobWriter('application/zip');
14
+ zipWriter = new ZipWriter(blobWriter);
46
15
  }
47
- dataMap.set(name, data);
48
- return new Promise((ok, no) => {
49
- try {
50
- zip?.file(name, file);
51
- ok();
52
- }
53
- catch (e) {
54
- no();
55
- }
16
+ await zipWriter.add(name, new BlobReader(file), {
17
+ level: 0,
18
+ signal,
19
+ onprogress: (progress, total) => {
20
+ if (isFunction(onProgress) && data) {
21
+ onProgress(progress / total, name, data);
22
+ }
23
+ return undefined;
24
+ },
56
25
  });
57
26
  },
58
- getBlobUrl: async (onProgress) => {
59
- if (!zip) {
27
+ getBlobUrl: async () => {
28
+ if (!zipWriter) {
60
29
  throw new Error('no zip');
61
30
  }
62
- const blob = await zip.generateAsync({
63
- type: 'blob',
64
- streamFiles: true,
65
- compression: 'DEFLATE',
66
- compressionOptions: {
67
- level: 5,
68
- },
69
- }, zipProgressManager({
70
- dataMap,
71
- onZipProgress: (file, progress, data) => {
72
- if (isFunction(onProgress)) {
73
- onProgress(progress, file, data);
74
- }
75
- },
76
- }));
77
- zip = null;
31
+ const blob = await zipWriter.close();
32
+ zipWriter = null;
33
+ blobWriter = null;
78
34
  return URL.createObjectURL(blob);
79
35
  },
80
36
  destroy: () => {
81
- dataMap.clear();
82
- zip = null;
37
+ zipWriter = null;
38
+ blobWriter = null;
83
39
  },
84
40
  };
85
41
  })();
@@ -128,7 +84,15 @@ const download = async ({ config, data, all, options }, abortController) => {
128
84
  });
129
85
  const blob = await readBody(response, { data, options });
130
86
  const [filename] = key.split('/').reverse();
131
- await zipper.addFile(blob, filename, data);
87
+ await zipper.addFile(blob, filename, {
88
+ data,
89
+ signal: abortController.signal,
90
+ onProgress: (progress, _name, _data) => {
91
+ if (isFunction(options?.onProgress)) {
92
+ options?.onProgress(_data, progress, progress === 1 ? 'COMPLETE' : 'FINISHING');
93
+ }
94
+ },
95
+ });
132
96
  return filename;
133
97
  };
134
98
  const downloadHandler = (() => {
@@ -147,7 +111,7 @@ const downloadHandler = (() => {
147
111
  .then(() => {
148
112
  fileDownloadQueue.set(key, true);
149
113
  return {
150
- status: 'LOADED',
114
+ status: 'COMPLETE',
151
115
  };
152
116
  })
153
117
  .catch((e) => {
@@ -165,12 +129,7 @@ const downloadHandler = (() => {
165
129
  });
166
130
  if (done) {
167
131
  zipper
168
- .getBlobUrl((percent, name, _data) => {
169
- if (isFunction(options?.onProgress)) {
170
- const progress = percent / 100;
171
- options?.onProgress(_data, progress, progress === 1 ? 'COMPLETE' : 'FINISHING');
172
- }
173
- })
132
+ .getBlobUrl()
174
133
  .then((blobURL) => {
175
134
  if (blobURL) {
176
135
  zipper.destroy();
@@ -4,7 +4,7 @@ const getPaginatedLocations = ({ items, pageSize, nextToken, }) => {
4
4
  if (Number(nextToken) > items.length) {
5
5
  return { items: [], nextToken: undefined };
6
6
  }
7
- const start = -nextToken;
7
+ const start = parseInt(nextToken, 10) * -1;
8
8
  const end = start + pageSize < 0 ? start + pageSize : undefined;
9
9
  return {
10
10
  items: items.slice(start, end),
@@ -2,7 +2,7 @@ import { createLocationCredentialsHandler } from './createLocationCredentialsHan
2
2
  import '@aws-amplify/storage/internals';
3
3
  import 'aws-amplify';
4
4
  import '@aws-amplify/ui';
5
- import 'jszip';
5
+ import '@zip.js/zip.js';
6
6
  import 'aws-amplify/storage';
7
7
  import { listLocationsHandler } from '../../actions/handlers/listLocations.mjs';
8
8
  import '../../actions/configs/context.mjs';
@@ -4,11 +4,10 @@ import { useComposables } from '../../components/composables/context.mjs';
4
4
  function useResolvedComposable(DefaultComposable, name) {
5
5
  const { composables } = useComposables();
6
6
  const Composable = React__default.useMemo(() => {
7
- const ResolvedComposable = (props) => {
7
+ function ResolvedComposable(props) {
8
8
  const Resolved = composables?.[name] ?? DefaultComposable;
9
9
  return React__default.createElement(Resolved, { ...props });
10
- };
11
- ResolvedComposable.displayName = name;
10
+ }
12
11
  return ResolvedComposable;
13
12
  }, [composables, DefaultComposable, name]);
14
13
  return Composable;
@@ -19,7 +19,7 @@ import '@aws-amplify/ui-react';
19
19
  import '../components/elements/definitions.mjs';
20
20
  import '../components/elements/IconElement.mjs';
21
21
  import 'aws-amplify';
22
- import 'jszip';
22
+ import '@zip.js/zip.js';
23
23
  import 'aws-amplify/storage';
24
24
  import '../views/LocationActionView/DownloadView/DownloadView.mjs';
25
25
  import '../views/context/actionViews.mjs';
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import '@aws-amplify/storage/internals';
3
3
  import 'aws-amplify';
4
4
  import '@aws-amplify/ui';
5
- import 'jszip';
5
+ import '@zip.js/zip.js';
6
6
  import 'aws-amplify/storage';
7
7
  import { ActionConfigsProvider } from '../actions/configs/context.mjs';
8
8
  import { defaultActionConfigs } from '../actions/configs/defaults.mjs';
@@ -24,7 +24,7 @@ import '@aws-amplify/ui-react';
24
24
  import '../components/elements/definitions.mjs';
25
25
  import '../components/elements/IconElement.mjs';
26
26
  import 'aws-amplify';
27
- import 'jszip';
27
+ import '@zip.js/zip.js';
28
28
  import 'aws-amplify/storage';
29
29
  import { DownloadView } from '../views/LocationActionView/DownloadView/DownloadView.mjs';
30
30
  import { LocationActionView } from '../views/LocationActionView/LocationActionView.mjs';
@@ -3,7 +3,7 @@ import { createContextUtilities } from '@aws-amplify/ui-react-core';
3
3
  import { noop } from '@aws-amplify/ui';
4
4
  import '@aws-amplify/storage/internals';
5
5
  import { createFileDataItem } from '../actions/handlers/utils.mjs';
6
- import 'jszip';
6
+ import '@zip.js/zip.js';
7
7
  import 'aws-amplify/storage';
8
8
  import '../actions/configs/context.mjs';
9
9
  import '../actions/configs/defaults.mjs';
@@ -19,7 +19,7 @@ import useResolveTableData from '../../hooks/useResolveTableData/useResolveTable
19
19
  import { COPY_TABLE_RESOLVERS } from '../../utils/tableResolvers/copyResolvers.mjs';
20
20
  import { FILE_DATA_ITEM_TABLE_KEYS } from '../../utils/tableResolvers/constants.mjs';
21
21
  import 'aws-amplify';
22
- import 'jszip';
22
+ import '@zip.js/zip.js';
23
23
  import 'aws-amplify/storage';
24
24
  import '../../../actions/configs/context.mjs';
25
25
  import { FoldersMessageProvider } from './FoldersMessageControl.mjs';
@@ -57,7 +57,7 @@ const useDeleteView = (options) => {
57
57
  const totalCount = await countFilesInFolder(folder.key, config);
58
58
  folderCountsRef.current.set(folder.id, totalCount);
59
59
  }
60
- catch (error) {
60
+ catch {
61
61
  folderCountsRef.current.set(folder.id, null);
62
62
  }
63
63
  }));
@@ -6,7 +6,7 @@ import '../../../components/elements/IconElement.mjs';
6
6
  import { list } from '@aws-amplify/storage/internals';
7
7
  import { constructBucket } from '../../../actions/handlers/utils.mjs';
8
8
  import '@aws-amplify/ui';
9
- import 'jszip';
9
+ import '@zip.js/zip.js';
10
10
  import 'aws-amplify/storage';
11
11
 
12
12
  const getFolderName = (folderKey) => {
@@ -79,7 +79,7 @@ const countFilesInFolder = async (folderKey, config) => {
79
79
  }
80
80
  return fileCount;
81
81
  }
82
- catch (error) {
82
+ catch {
83
83
  return 0;
84
84
  }
85
85
  };
@@ -5,7 +5,7 @@ import useResolveTableData from '../../hooks/useResolveTableData/useResolveTable
5
5
  import '@aws-amplify/ui';
6
6
  import '@aws-amplify/storage/internals';
7
7
  import 'aws-amplify';
8
- import 'jszip';
8
+ import '@zip.js/zip.js';
9
9
  import 'aws-amplify/storage';
10
10
  import '../../../actions/configs/context.mjs';
11
11
  import '../../../actions/configs/defaults.mjs';
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import '@aws-amplify/storage/internals';
3
3
  import { isMultipartUpload } from '../../../actions/handlers/utils.mjs';
4
4
  import '@aws-amplify/ui';
5
- import 'jszip';
5
+ import '@zip.js/zip.js';
6
6
  import 'aws-amplify/storage';
7
7
  import '../../../actions/configs/context.mjs';
8
8
  import '../../../actions/configs/defaults.mjs';
@@ -1,7 +1,7 @@
1
1
  import '@aws-amplify/storage/internals';
2
2
  import { createFileDataItem } from '../../../actions/handlers/utils.mjs';
3
3
  import '@aws-amplify/ui';
4
- import 'jszip';
4
+ import '@zip.js/zip.js';
5
5
  import 'aws-amplify/storage';
6
6
  import '../../../actions/configs/context.mjs';
7
7
  import '../../../actions/configs/defaults.mjs';
@@ -3,7 +3,7 @@ import { isUndefined, isFunction } from '@aws-amplify/ui';
3
3
  import { usePaginate } from '../hooks/usePaginate.mjs';
4
4
  import '@aws-amplify/storage/internals';
5
5
  import 'aws-amplify';
6
- import 'jszip';
6
+ import '@zip.js/zip.js';
7
7
  import 'aws-amplify/storage';
8
8
  import { useActionConfigs } from '../../actions/configs/context.mjs';
9
9
  import '../../actions/configs/defaults.mjs';
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import '@aws-amplify/storage/internals';
3
3
  import { getFileKey } from '../../actions/handlers/utils.mjs';
4
4
  import '@aws-amplify/ui';
5
- import 'jszip';
5
+ import '@zip.js/zip.js';
6
6
  import 'aws-amplify/storage';
7
7
  import '../../actions/configs/context.mjs';
8
8
  import '../../actions/configs/defaults.mjs';
@@ -20,7 +20,7 @@ import '@aws-amplify/ui-react';
20
20
  import '../../components/elements/definitions.mjs';
21
21
  import '../../components/elements/IconElement.mjs';
22
22
  import 'aws-amplify';
23
- import 'jszip';
23
+ import '@zip.js/zip.js';
24
24
  import 'aws-amplify/storage';
25
25
  import { DownloadView } from '../LocationActionView/DownloadView/DownloadView.mjs';
26
26
 
@@ -18,7 +18,7 @@ import '@aws-amplify/ui-react';
18
18
  import '../../components/elements/definitions.mjs';
19
19
  import '../../components/elements/IconElement.mjs';
20
20
  import 'aws-amplify';
21
- import 'jszip';
21
+ import '@zip.js/zip.js';
22
22
  import 'aws-amplify/storage';
23
23
  import '../LocationActionView/DownloadView/DownloadView.mjs';
24
24
  import { LocationActionView } from '../LocationActionView/LocationActionView.mjs';
@@ -8,7 +8,7 @@ import { safeGetProperties } from '../../utils/files/safeGetProperties.mjs';
8
8
  import { getUrl } from '@aws-amplify/storage/internals';
9
9
  import { constructBucket } from '../../../actions/handlers/utils.mjs';
10
10
  import '@aws-amplify/ui';
11
- import 'jszip';
11
+ import '@zip.js/zip.js';
12
12
  import 'aws-amplify/storage';
13
13
  import { useStore } from '../../../store/context.mjs';
14
14
 
@@ -78,7 +78,7 @@ function useFilePreview({ activeFile, }) {
78
78
  url: url.toString(),
79
79
  });
80
80
  }
81
- catch (error) {
81
+ catch {
82
82
  setFilePreviewContent({
83
83
  isLoading: false,
84
84
  ok: false,
@@ -11,7 +11,7 @@ function resolveMaxFileSize(maxFileSize, fileType) {
11
11
  return result;
12
12
  }
13
13
  }
14
- catch (error) {
14
+ catch {
15
15
  //
16
16
  }
17
17
  }
@@ -67,7 +67,7 @@ function determineFileType(options) {
67
67
  return customResult;
68
68
  }
69
69
  }
70
- catch (error) {
70
+ catch {
71
71
  //
72
72
  }
73
73
  }
@@ -4,7 +4,7 @@ async function safeGetProperties(params) {
4
4
  try {
5
5
  return await getProperties(params);
6
6
  }
7
- catch (error) {
7
+ catch {
8
8
  return {};
9
9
  }
10
10
  }
@@ -1,4 +1,4 @@
1
- import { noop, capitalize } from '@aws-amplify/ui';
1
+ import { capitalize, noop } from '@aws-amplify/ui';
2
2
  import '../../../displayText/context.mjs';
3
3
  import { isCopyViewDisplayTextKey } from '../../../displayText/utils.mjs';
4
4
  import { STATUS_LABELS } from './constants.mjs';
@@ -5,7 +5,7 @@ import { STATUS_ICONS, STATUS_LABELS } from './constants.mjs';
5
5
  import { getFileSize, getFileType, getCellName } from './utils.mjs';
6
6
  import '@aws-amplify/storage/internals';
7
7
  import { getFileKey } from '../../../actions/handlers/utils.mjs';
8
- import 'jszip';
8
+ import '@zip.js/zip.js';
9
9
  import 'aws-amplify/storage';
10
10
  import '../../../actions/configs/context.mjs';
11
11
  import '../../../actions/configs/defaults.mjs';
@@ -1,3 +1,3 @@
1
- const VERSION = '3.17.0';
1
+ const VERSION = '3.17.2';
2
2
 
3
3
  export { VERSION };
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ 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-De4hcP-u.js');
12
+ var createStorageBrowser = require('./createStorageBrowser-CtfBkr62.js');
13
13
  require('@aws-amplify/storage/internals');
14
14
  require('aws-amplify');
15
- require('jszip');
15
+ require('@zip.js/zip.js');
16
16
  require('aws-amplify/utils');
17
17
  require('@aws-amplify/ui-react-core/elements');
18
18
 
package/dist/styles.css CHANGED
@@ -4891,11 +4891,14 @@ html[dir=rtl] .amplify-field-group__inner-start {
4891
4891
  overflow-y: auto;
4892
4892
  box-sizing: border-box;
4893
4893
  list-style: disc;
4894
+ display: flex;
4895
+ flex-direction: column;
4896
+ gap: var(--amplify-space-xxs);
4894
4897
  }
4895
4898
 
4896
4899
  .amplify-modal__list-item.amplify-modal__list-item {
4900
+ display: list-item;
4897
4901
  margin-bottom: var(--amplify-space-xxs);
4898
- box-sizing: border-box;
4899
4902
  }
4900
4903
 
4901
4904
  .amplify-pagination {
@@ -2,5 +2,5 @@ export type { ActionConfigsProviderProps } from './context';
2
2
  export { ActionConfigsProvider, useActionConfigs } from './context';
3
3
  export type { DefaultActionViewType } from './defaults';
4
4
  export { defaultActionConfigs, defaultActionViewConfigs, isDefaultActionViewType, } from './defaults';
5
- export * from './types';
5
+ export type * from './types';
6
6
  export { getActionConfigs } from './utils';
@@ -0,0 +1,2 @@
1
+ import type { DownloadHandler } from './download';
2
+ export declare const composedDownloadHandler: DownloadHandler;
@@ -8,4 +8,4 @@ export * from './listLocationItems';
8
8
  export * from './listLocations';
9
9
  export * from './upload';
10
10
  export * from './utils';
11
- export * from './types';
11
+ export type * from './types';
@@ -1,3 +1,3 @@
1
1
  export { FileItemsContext, FileItemsProvider, useFileItems } from './context';
2
- export * from './types';
2
+ export type * from './types';
3
3
  export { defaultValidateFile } from './utils';
@@ -1,3 +1,3 @@
1
1
  export { CopyView } from './CopyView';
2
2
  export { useCopyView } from './useCopyView';
3
- export * from './types';
3
+ export type * from './types';
@@ -1,3 +1,3 @@
1
1
  export { CreateFolderView } from './CreateFolderView';
2
2
  export { useCreateFolderView } from './useCreateFolderView';
3
- export * from './types';
3
+ export type * from './types';
@@ -1,3 +1,3 @@
1
1
  export { DeleteView } from './DeleteView';
2
2
  export { useDeleteView } from './useDeleteView';
3
- export * from './types';
3
+ export type * from './types';
@@ -1,3 +1,3 @@
1
1
  export { DownloadView } from './DownloadView';
2
2
  export { useDownloadView } from './useDownloadView';
3
- export * from './types';
3
+ export type * from './types';
@@ -1,3 +1,3 @@
1
1
  export { UploadView } from './UploadView';
2
2
  export { useUploadView } from './useUploadView';
3
- export * from './types';
3
+ export type * from './types';
@@ -1,2 +1,2 @@
1
1
  export * from './useFilePreview';
2
- export * from './types';
2
+ export type * from './types';
@@ -7,4 +7,4 @@ export type { LocationsViewProps, LocationsViewType } from './LocationsView';
7
7
  export { LocationsView } from './LocationsView';
8
8
  export type { UseView } from './useView';
9
9
  export { useView } from './useView';
10
- export * from './types';
10
+ export type * from './types';
@@ -1 +1 @@
1
- export declare const VERSION = "3.17.0";
1
+ export declare const VERSION = "3.17.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "3.17.0",
3
+ "version": "3.17.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -46,11 +46,11 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@aws-amplify/ui": "6.15.1",
50
- "@aws-amplify/ui-react": "6.15.1",
51
- "@aws-amplify/ui-react-core": "3.6.1",
49
+ "@aws-amplify/ui": "6.15.3",
50
+ "@aws-amplify/ui-react": "6.15.3",
51
+ "@aws-amplify/ui-react-core": "3.6.3",
52
52
  "tslib": "^2.5.2",
53
- "jszip": "^3.10.1"
53
+ "@zip.js/zip.js": "^2.7.53"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "aws-amplify": "^6.16.0",
@@ -69,7 +69,7 @@
69
69
  "name": "createStorageBrowser",
70
70
  "path": "dist/esm/browser.mjs",
71
71
  "import": "{ createStorageBrowser }",
72
- "limit": "97 kB",
72
+ "limit": "130 kB",
73
73
  "ignore": [
74
74
  "@aws-amplify/storage"
75
75
  ]
@@ -78,7 +78,7 @@
78
78
  "name": "StorageBrowser",
79
79
  "path": "dist/esm/index.mjs",
80
80
  "import": "{ StorageBrowser }",
81
- "limit": "121.1 kB"
81
+ "limit": "154 kB"
82
82
  },
83
83
  {
84
84
  "name": "FileUploader",