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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/{createAmplifyAuthAdapter-D6MKiBgI.js → createAmplifyAuthAdapter-BcJMLIum.js} +1203 -1200
  3. package/dist/esm/components/FileUploader/FileUploader.mjs +2 -1
  4. package/dist/esm/components/FileUploader/hooks/useUploadFiles/useUploadFiles.mjs +3 -1
  5. package/dist/esm/components/FileUploader/utils/getInput.mjs +8 -2
  6. package/dist/esm/components/StorageBrowser/StorageBrowserDefault.mjs +16 -0
  7. package/dist/esm/components/StorageBrowser/composables/DataTable/DataTable.mjs +40 -38
  8. package/dist/esm/components/StorageBrowser/controls/hooks/useDataTable.mjs +2 -1
  9. package/dist/esm/components/StorageBrowser/createStorageBrowser.mjs +3 -3
  10. package/dist/esm/components/StorageBrowser/views/LocationActionView/getActionViewTableData.mjs +1 -1
  11. package/dist/esm/components/StorageBrowser/views/useView.mjs +4 -4
  12. package/dist/esm/components/StorageImage/StorageImage.mjs +11 -2
  13. package/dist/esm/components/StorageManager/StorageManager.mjs +2 -1
  14. package/dist/esm/version.mjs +1 -1
  15. package/dist/index.js +27 -8
  16. package/dist/types/components/FileUploader/hooks/useUploadFiles/useUploadFiles.d.ts +3 -2
  17. package/dist/types/components/FileUploader/types.d.ts +8 -1
  18. package/dist/types/components/FileUploader/utils/getInput.d.ts +3 -2
  19. package/dist/types/components/StorageBrowser/composables/DataTable/DataTable.d.ts +2 -1
  20. package/dist/types/components/StorageBrowser/index.d.ts +2 -1
  21. package/dist/types/components/StorageBrowser/types.d.ts +1 -2
  22. package/dist/types/components/StorageBrowser/views/index.d.ts +2 -0
  23. package/dist/types/components/StorageBrowser/views/useView.d.ts +4 -4
  24. package/dist/types/components/StorageImage/StorageImage.d.ts +1 -1
  25. package/dist/types/components/StorageImage/types.d.ts +4 -1
  26. package/dist/types/components/StorageManager/types.d.ts +15 -88
  27. package/dist/types/version.d.ts +1 -1
  28. package/package.json +3 -5
  29. package/dist/storage-browser-styles.css +0 -482
  30. package/dist/storage-browser-styles.js +0 -2
  31. package/dist/types/styles/storage-browser-styles.d.ts +0 -1
@@ -1,7 +1,10 @@
1
- import * as React from 'react';
2
- import { FileStatus, StorageAccessLevel } from '../FileUploader/types';
3
- import { FileUploaderDisplayText as StorageManagerDisplayText, PathCallback, UploadTask } from '../FileUploader/utils';
4
- import { ContainerProps, DropZoneProps, FileListHeaderProps, FileListFooterProps, FileListProps, FilePickerProps } from './ui';
1
+ import { FileStatus, FileUploaderProps } from '../FileUploader/types';
2
+ import { PathCallback, UploadTask } from '../FileUploader/utils';
3
+ interface BucketInfo {
4
+ bucketName: string;
5
+ region: string;
6
+ }
7
+ export type StorageBucket = string | BucketInfo;
5
8
  export interface StorageFile {
6
9
  id: string;
7
10
  file?: File;
@@ -24,91 +27,14 @@ export type ProcessFile = (params: ProcessFileParams) => Promise<ProcessFilePara
24
27
  export interface StorageManagerHandle {
25
28
  clearFiles: () => void;
26
29
  }
27
- export interface StorageManagerProps {
28
- /**
29
- * List of accepted File types, values of `['*']` or undefined allow any files
30
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
31
- */
32
- acceptedFileTypes?: string[];
33
- /**
34
- * Access level for file uploads
35
- * @see https://docs.amplify.aws/lib/storage/configureaccess/q/platform/js/
36
- */
37
- accessLevel: StorageAccessLevel;
38
- /**
39
- * Determines if the upload will automatically start after a file is selected, default value: true
40
- */
41
- autoUpload?: boolean;
42
- /**
43
- * Component overrides
44
- */
45
- components?: {
46
- Container?: React.ComponentType<ContainerProps>;
47
- DropZone?: React.ComponentType<DropZoneProps>;
48
- FileList?: React.ComponentType<FileListProps>;
49
- FilePicker?: React.ComponentType<FilePickerProps>;
50
- FileListHeader?: React.ComponentType<FileListHeaderProps>;
51
- FileListFooter?: React.ComponentType<FileListFooterProps>;
52
- };
53
- /**
54
- * List of default files already uploaded
55
- */
56
- defaultFiles?: DefaultFile[];
57
- /**
58
- * Overrides default display text
59
- */
60
- displayText?: StorageManagerDisplayText;
61
- /**
62
- * Determines if upload can be paused / resumed
63
- */
64
- isResumable?: boolean;
65
- /**
66
- * Maximum total files to upload in each batch
67
- */
68
- maxFileCount: number;
69
- /**
70
- * Maximum file size in bytes
71
- */
72
- maxFileSize?: number;
73
- /**
74
- * When a file is removed
75
- */
76
- onFileRemove?: (file: {
77
- key: string;
78
- }) => void;
79
- /**
80
- * Monitor upload errors
81
- */
82
- onUploadError?: (error: string, file: {
83
- key: string;
84
- }) => void;
85
- /**
86
- * Monitor upload success
87
- */
88
- onUploadSuccess?: (event: {
89
- key?: string;
90
- }) => void;
91
- /**
92
- * When a file begins uploading
93
- */
94
- onUploadStart?: (event: {
95
- key?: string;
96
- }) => void;
97
- /**
98
- * Process file before upload
99
- */
100
- processFile?: ProcessFile;
101
- /**
102
- * Determines if thumbnails show for image files
103
- */
104
- showThumbnails?: boolean;
105
- /**
106
- * Provided value is prefixed to the file `key` for each file
107
- */
108
- path?: string;
109
- useAccelerateEndpoint?: boolean;
30
+ export interface StorageManagerProps extends FileUploaderProps {
110
31
  }
111
- export interface StorageManagerPathProps extends Omit<StorageManagerProps, 'accessLevel' | 'path'> {
32
+ export interface StorageManagerPathProps extends Omit<StorageManagerProps, 'accessLevel' | 'bucket' | 'path'> {
33
+ /** S3 bucket, allows either a string or `BucketInfo`:
34
+ * - `string`: the "friendly name" assigned to the bucket
35
+ * - `BucketInfo`: object containing the actual S3 bucket name and its region
36
+ */
37
+ bucket?: StorageBucket;
112
38
  /**
113
39
  * S3 bucket key, allows either a `string` or a `PathCallback`:
114
40
  * - `string`: `path` is prefixed to the file `key` for each file
@@ -119,3 +45,4 @@ export interface StorageManagerPathProps extends Omit<StorageManagerProps, 'acce
119
45
  accessLevel?: never;
120
46
  useAccelerateEndpoint?: boolean;
121
47
  }
48
+ export {};
@@ -1 +1 @@
1
- export declare const VERSION = "3.7.1";
1
+ export declare const VERSION = "3.8.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "3.7.1",
3
+ "version": "3.8.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -14,12 +14,10 @@
14
14
  "types": "./dist/types/components/StorageBrowser/index.d.ts",
15
15
  "import": "./dist/esm/browser.mjs"
16
16
  },
17
- "./styles.css": "./dist/styles.css",
18
- "./storage-browser-styles.css": "./dist/storage-browser-styles.css"
17
+ "./styles.css": "./dist/styles.css"
19
18
  },
20
19
  "browser": {
21
- "./styles.css": "./dist/styles.css",
22
- "./storage-browser-styles.css": "./dist/storage-browser-styles.css"
20
+ "./styles.css": "./dist/styles.css"
23
21
  },
24
22
  "types": "dist/types/index.d.ts",
25
23
  "license": "Apache-2.0",
@@ -1,482 +0,0 @@
1
- .amplify-storage-browser {
2
- --storage-browser-dropzone-active-color: hsl(190, 95%, 30%);
3
- --storage-browser-gap-small: 0.375rem;
4
- --storage-browser-gap: 0.6rem;
5
- --storage-browser-gap-large: 1.2rem;
6
- --storage-browser-status-error: hsl(0, 95%, 30%);
7
- --storage-browser-status-success: hsl(130, 33%, 37%);
8
- --storage-browser-status-progress: hsl(220, 95%, 30%);
9
- --storage-browser-status-initial: hsl(210, 10%, 58%);
10
- --storage-browser-loading-animation: spin 1s ease-out infinite;
11
- --storage-browser-error-background: hsl(0, 75%, 95%);
12
- --storage-browser-error-text: hsl(0, 100%, 20%);
13
- }
14
-
15
- .storage-browser__pagination {
16
- justify-self: flex-end;
17
- }
18
-
19
- .storage-browser__pagination-list {
20
- gap: var(--storage-browser-gap-small);
21
- }
22
-
23
- .storage-browser__pagination-list {
24
- list-style: none;
25
- margin: 0;
26
- padding: 0;
27
- display: flex;
28
- flex-wrap: wrap;
29
- }
30
-
31
- .storage-browser__pagination-list-item {
32
- display: flex;
33
- align-items: center;
34
- }
35
-
36
- .storage-browser__pagination-button-icon,
37
- .storage-browser__data-refresh-icon,
38
- .storage-browser__message-dismiss-icon,
39
- .storage-browser__menu-toggle-icon {
40
- display: block;
41
- }
42
-
43
- .storage-browser__field {
44
- display: flex;
45
- flex-direction: column;
46
- margin-inline-start: var(--storage-browser-gap);
47
- gap: var(--storage-browser-gap);
48
- }
49
-
50
- .storage-browser__message {
51
- align-items: flex-start;
52
- display: flex;
53
- gap: var(--storage-browser-gap);
54
- }
55
-
56
- .storage-browser__message-dismiss {
57
- flex: 0 0 auto;
58
- }
59
- .storage-browser__message-content {
60
- flex: 1 1 auto;
61
- }
62
-
63
- .storage-browser__upload-destination,
64
- .storage-browser__copy-destination {
65
- flex: 1;
66
- }
67
-
68
- .storage-browser__locations-view-data-refresh,
69
- .storage-browser__locations-detail-view-data-refresh {
70
- justify-self: flex-end;
71
- }
72
-
73
- .storage-browser__action-status {
74
- vertical-align: middle;
75
- margin-inline-end: var(--storage-browser-gap-small);
76
- }
77
-
78
- .storage-browser__menu {
79
- position: relative;
80
- display: inline-block;
81
- justify-self: flex-end;
82
- }
83
-
84
- .storage-browser__menu-list {
85
- display: none;
86
- gap: var(--storage-browser-gap-small);
87
- flex-direction: column;
88
- position: absolute;
89
- inset-inline-end: 0;
90
- inset-block-start: 100%;
91
- width: max-content;
92
- max-width: var(--storage-browser-menu-max-width);
93
- z-index: 2;
94
- }
95
-
96
- .storage-browser__menu-list--open {
97
- display: flex;
98
- }
99
-
100
- .storage-browser__menu-item {
101
- display: flex;
102
- gap: var(--storage-browser-gap-small);
103
- align-items: center;
104
- }
105
-
106
- .storage-browser__add-folder {
107
- justify-self: flex-end;
108
- }
109
-
110
- .storage-browser__action-status--action-initial {
111
- color: var(--storage-browser-status-initial);
112
- }
113
- .storage-browser__action-status--action-success {
114
- color: var(--storage-browser-status-success);
115
- }
116
- .storage-browser__action-status--action-progress {
117
- color: var(--storage-browser-status-progress);
118
- }
119
- .storage-browser__action-status--action-error,
120
- .storage-browser__action-status--action-canceled {
121
- color: var(--storage-browser-status-error);
122
- }
123
-
124
- .storage-browser__empty-message {
125
- text-align: center;
126
- }
127
-
128
- @keyframes spin {
129
- 0% {
130
- transform: rotate(0deg);
131
- }
132
- 100% {
133
- transform: rotate(360deg);
134
- }
135
- }
136
-
137
- /* Action Views */
138
-
139
- .storage-browser__action-header {
140
- /* grid-column: 1 / -1; */
141
- display: flex;
142
- flex-direction: row;
143
- justify-content: space-between;
144
- gap: var(--storage-browser-gap);
145
- align-items: center;
146
- }
147
-
148
- .storage-browser__action-footer {
149
- display: flex;
150
- justify-content: space-between;
151
- gap: var(--storage-browser-gap-medium);
152
- align-items: center;
153
- }
154
-
155
- /* Error boundary */
156
- .storage-browser__error-boundary {
157
- background-color: var(--storage-browser-error-background);
158
- color: var(--storage-browser-error-text);
159
- padding: var(--storage-browser-gap-large);
160
- }
161
- /** Util class to visually hide content only needed for accessibility */
162
- .storage-browser-visually-hidden {
163
- position: absolute;
164
- width: 1px;
165
- height: 1px;
166
- padding: 0;
167
- margin: -1px;
168
- fill: transparent;
169
- overflow: hidden;
170
- clip: rect(0, 0, 0, 0);
171
- white-space: nowrap;
172
- border-width: 0;
173
- }
174
-
175
- .storage-browser__action-destination,
176
- .storage-browser__action-destination .storage-browser__description-list {
177
- display: flex;
178
- gap: var(--storage-browser-gap-small);
179
- align-items: center;
180
- }
181
-
182
- .storage-browser__action-destination > span {
183
- font-weight: var(--amplify-font-weights-bold);
184
- }
185
-
186
- /* Base component styles */
187
- /** DescriptionList **/
188
- .storage-browser__description-list {
189
- margin: 0;
190
- display: flex;
191
- gap: var(--storage-browser-gap-large);
192
- align-items: center;
193
- }
194
-
195
- .storage-browser__description {
196
- display: flex;
197
- align-items: center;
198
- gap: var(--storage-browser-gap-small);
199
- }
200
-
201
- .storage-browser__description-details {
202
- margin: 0;
203
- display: flex;
204
- }
205
-
206
- /** DropZone **/
207
- .storage-browser__drop-zone--active {
208
- outline: 2px solid var(--storage-browser-dropzone-active-color);
209
- }
210
-
211
- /** LoadingIndicator **/
212
- .storage-browser__loading-indicator {
213
- display: flex;
214
- gap: var(--storage-browser-gap-small);
215
- padding: var(--storage-browser-gap-large);
216
- justify-content: center;
217
- }
218
-
219
- .storage-browser__loading-indicator-icon {
220
- animation: var(--storage-browser-loading-animation);
221
- }
222
-
223
- /** Breadcrumb Navigation **/
224
- .storage-browser__breadcrumb-list {
225
- list-style: none;
226
- margin: 0;
227
- padding: 0;
228
- display: flex;
229
- flex-wrap: wrap;
230
- gap: var(--storage-browser-gap-small);
231
- }
232
-
233
- .storage-browser__breadcrumb-list-item {
234
- display: flex;
235
- align-items: center;
236
- gap: var(--storage-browser-gap-small);
237
- }
238
-
239
- /** Table **/
240
- .storage-browser__table {
241
- width: 100%;
242
- position: relative;
243
- }
244
-
245
- .storage-browser__table-wrapper {
246
- flex: 1;
247
- overflow: auto;
248
- position: relative;
249
- border-width: var(--amplify-border-widths-small);
250
- border-style: solid;
251
- border-color: var(--amplify-colors-border-tertiary);
252
- width: 100%;
253
- }
254
-
255
- .storage-browser__table-head {
256
- position: sticky;
257
- top: 0;
258
- background: var(--amplify-colors-background-primary);
259
- box-shadow: var(--amplify-shadows-small);
260
- }
261
-
262
- .storage-browser__table-header {
263
- text-align: start;
264
- }
265
-
266
- .storage-browser__table-sort-header {
267
- padding: var(--storage-browser-gap-small);
268
- display: inline-flex;
269
- align-items: center;
270
- }
271
-
272
- .storage-browser__table-button-data-cell,
273
- .storage-browser__table-date-data-cell,
274
- .storage-browser__table-number-data-cell,
275
- .storage-browser__table-text-data-cell {
276
- display: flex;
277
- width: 100%;
278
- gap: var(--storage-browser-gap-small);
279
- padding: var(--storage-browser-gap-small);
280
- text-overflow: ellipsis;
281
- overflow: hidden;
282
- white-space: nowrap;
283
- align-items: center;
284
- justify-content: flex-start;
285
- }
286
- .storage-browser__table-button-data-cell span,
287
- .storage-browser__table-date-data-cell span,
288
- .storage-browser__table-number-data-cell span,
289
- .storage-browser__table-text-data-cell span {
290
- text-overflow: ellipsis;
291
- overflow: hidden;
292
- }
293
-
294
- .storage-browser__table-button-data-cell--icon-only {
295
- width: initial;
296
- }
297
-
298
- .storage-browser__table-text-data-cell-icon {
299
- flex-shrink: 0;
300
- }
301
- .storage-browser__table-text-data-cell-icon--action-queued {
302
- color: var(--storage-browser-status-initial);
303
- }
304
-
305
- .storage-browser__table-text-data-cell-icon--action-success {
306
- color: var(--storage-browser-status-success);
307
- }
308
-
309
- .storage-browser__table-text-data-cell-icon--action-progress {
310
- color: var(--storage-browser-status-progress);
311
- }
312
-
313
- .storage-browser__table-text-data-cell-icon--action-canceled,
314
- .storage-browser__table-text-data-cell-icon--action-error {
315
- color: var(--storage-browser-status-error);
316
- }
317
-
318
- /* Locations view control wrapper styles */
319
- .storage-browser__locations-view-data-table th:nth-of-type(3) {
320
- width: 8rem;
321
- }
322
-
323
- /* Locations view control wrapper styles */
324
-
325
- .storage-browser__location-detail-view-data-table th:nth-of-type(1) {
326
- width: 2rem;
327
- }
328
-
329
- .storage-browser__location-detail-view-data-table th:nth-of-type(3),
330
- .storage-browser__location-detail-view-data-table th:nth-of-type(5) {
331
- width: 8rem;
332
- }
333
-
334
- .storage-browser__location-detail-view-data-table th:nth-of-type(4) {
335
- width: 12rem;
336
- }
337
-
338
- .storage-browser__location-detail-view-data-table th:nth-of-type(5) {
339
- text-align: end;
340
- }
341
-
342
- .storage-browser__location-detail-view-data-table th:nth-of-type(6) {
343
- width: 4rem;
344
- }
345
-
346
- .storage-browser__location-detail-view-data-table td:nth-of-type(5) div {
347
- justify-content: end;
348
- }
349
-
350
- .storage-browser__location-detail-view-data-table td:nth-of-type(6) button {
351
- justify-content: center;
352
- }
353
-
354
- /* Upload action view control wrapper styles */
355
- .storage-browser__upload-view-data-table th:nth-of-type(3),
356
- .storage-browser__upload-view-data-table th:nth-of-type(4),
357
- .storage-browser__upload-view-data-table th:nth-of-type(5),
358
- .storage-browser__upload-view-data-table th:nth-of-type(6) {
359
- width: 8rem;
360
- }
361
-
362
- .storage-browser__upload-view-data-table th:nth-of-type(4) {
363
- text-align: end;
364
- }
365
-
366
- .storage-browser__upload-view-data-table th:nth-of-type(7) {
367
- width: 4rem;
368
- }
369
-
370
- .storage-browser__upload-view-data-table td:nth-of-type(4) div {
371
- justify-content: end;
372
- }
373
-
374
- /* Upload view control wrapper styles */
375
- .storage-browser__upload-status-display,
376
- .storage-browser__action-status-display {
377
- justify-content: flex-start;
378
- margin: 0;
379
- display: flex;
380
- gap: var(--storage-browser-gap-large);
381
- flex: 1;
382
- }
383
-
384
- .storage-browser__copy-destination-picker {
385
- width: 100%;
386
- flex: 1;
387
- display: flex;
388
- flex-direction: column;
389
- }
390
-
391
- .storage-browser__table-data-cell:first-child,
392
- .storage-browser__table-data-cell:last-child,
393
- .storage-browser__table__data:first-child,
394
- .storage-browser__table__data:last-child,
395
- .storage-browser__table-header:first-child,
396
- .storage-browser__table-header:last-child {
397
- border-left: none;
398
- border-right: none;
399
- }
400
-
401
- .storage-browser__table-header {
402
- border: none;
403
- }
404
-
405
- .storage-browser__location-detail-view-controls {
406
- display: flex;
407
- direction: row;
408
- justify-content: flex-end;
409
- align-items: center;
410
- width: 100%;
411
- }
412
-
413
- /* Copy view styles */
414
- .storage-browser__copy-destination-header {
415
- display: flex;
416
- flex-direction: row;
417
- align-items: center;
418
- justify-content: space-between;
419
- }
420
-
421
- /* Search view styles */
422
- .storage-browser__search {
423
- display: flex;
424
- align-items: center;
425
- flex-wrap: wrap;
426
- min-width: 35rem;
427
- flex: 1;
428
- }
429
-
430
- .storage-browser__search-field-clear {
431
- position: absolute;
432
- display: flex;
433
- right: 0.25rem;
434
- top: 50%;
435
- transform: translateY(-50%);
436
- }
437
-
438
- .storage-browser__search .storage-browser__search-field {
439
- position: relative;
440
- display: flex;
441
- height: 3rem;
442
- }
443
-
444
- .storage-browser__search .storage-browser__search-field-icon {
445
- position: absolute;
446
- left: var(--storage-browser-gap-small);
447
- top: 50%;
448
- transform: translateY(-50%);
449
- }
450
-
451
- .storage-browser__search .storage-browser__search-field-input {
452
- border-radius: 0.25rem 0 0 0.25rem;
453
- padding-inline-start: 2rem;
454
- padding-inline-end: 3.25rem;
455
- flex: 1;
456
- }
457
-
458
- .storage-browser__search-submit {
459
- border-radius: 0 0.25rem 0.25rem 0;
460
- min-height: 3rem;
461
- }
462
-
463
- .storage-browser__search-submit:not(:focus) {
464
- border-inline-start-color: transparent;
465
- }
466
-
467
- .storage-browser__search-subfolder-toggle__label {
468
- margin-left: var(--storage-browser-gap);
469
- }
470
-
471
- /* Shared view styles */
472
- .storage-browser__locations-view-data-table,
473
- .storage-browser__location-detail-view-drop-zone,
474
- .storage-browser__location-detail-view-data-table,
475
- .storage-browser__copy-view-data-table,
476
- .storage-browser__delete-view-data-table,
477
- .storage-browser__upload-view-data-table,
478
- .storage-browser__destination-picker-data-table {
479
- display: grid;
480
- grid-column: 1 / -1;
481
- width: 100%;
482
- }
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- import './storage-browser.css';