@aws-amplify/ui-react-storage 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,6 @@
1
1
  import React__default from 'react';
2
- import { ComponentClassName } from '@aws-amplify/ui';
2
+ import { ComponentClassName, humanFileSize } from '@aws-amplify/ui';
3
3
  import { View, Text } from '@aws-amplify/ui-react';
4
- import { humanFileSize } from '../../utils/humanFileSize.mjs';
5
- import 'aws-amplify/auth';
6
- import 'aws-amplify/storage';
7
4
 
8
5
  const UploadDetails = ({ displayName, fileSize, }) => {
9
6
  return (React__default.createElement(React__default.Fragment, null,
@@ -1,4 +1,4 @@
1
- import { humanFileSize } from './humanFileSize.mjs';
1
+ import { humanFileSize } from '@aws-amplify/ui';
2
2
 
3
3
  const checkMaxFileSize = ({ file, getFileSizeErrorText, maxFileSize, }) => {
4
4
  if (maxFileSize === undefined)
@@ -1,3 +1,3 @@
1
- const VERSION = '3.2.0';
1
+ const VERSION = '3.2.1';
2
2
 
3
3
  export { VERSION };
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ function _interopNamespace(e) {
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
35
 
36
- const VERSION = '3.2.0';
36
+ const VERSION = '3.2.1';
37
37
 
38
38
  const MISSING_REQUIRED_PROP_MESSAGE = '`StorageImage` requires either an `imgKey` or `path` prop.';
39
39
  const HAS_DEPRECATED_PROPS_MESSAGE = '`imgKey`, `accessLevel`, and `identityId` will be replaced with `path` in a future major version. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props';
@@ -286,39 +286,11 @@ function useStorageManager(defaultFiles = []) {
286
286
  };
287
287
  }
288
288
 
289
- /**
290
- * Format bytes as human-readable text.
291
- *
292
- * @param bytes Number of bytes.
293
- * @param si True to use metric (SI) units, aka powers of 1000. False to use
294
- * binary (IEC), aka powers of 1024.
295
- * @param dp Number of decimal places to display.
296
- *
297
- * @return Formatted string.
298
- */
299
- function humanFileSize(bytes, si = false, dp = 1) {
300
- const thresh = si ? 1000 : 1024;
301
- if (Math.abs(bytes) < thresh) {
302
- return `${bytes} B`;
303
- }
304
- const units = si
305
- ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
306
- : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
307
- let unit = -1;
308
- const range = 10 ** dp;
309
- do {
310
- bytes /= thresh;
311
- ++unit;
312
- } while (Math.round(Math.abs(bytes) * range) / range >= thresh &&
313
- unit < units.length - 1);
314
- return bytes.toFixed(dp) + ' ' + units[unit];
315
- }
316
-
317
289
  const checkMaxFileSize = ({ file, getFileSizeErrorText, maxFileSize, }) => {
318
290
  if (maxFileSize === undefined)
319
291
  return '';
320
292
  if (file.size > maxFileSize) {
321
- return getFileSizeErrorText(humanFileSize(maxFileSize, true));
293
+ return getFileSizeErrorText(ui.humanFileSize(maxFileSize, true));
322
294
  }
323
295
  return '';
324
296
  };
@@ -578,7 +550,7 @@ const UploadDetails = ({ displayName, fileSize, }) => {
578
550
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
579
551
  React__default["default"].createElement(uiReact.View, { className: ui.ComponentClassName.StorageManagerFileMain },
580
552
  React__default["default"].createElement(uiReact.Text, { className: ui.ComponentClassName.StorageManagerFileName }, displayName)),
581
- React__default["default"].createElement(uiReact.Text, { as: "span", className: ui.ComponentClassName.StorageManagerFileSize }, fileSize ? humanFileSize(fileSize, true) : '')));
553
+ React__default["default"].createElement(uiReact.Text, { as: "span", className: ui.ComponentClassName.StorageManagerFileSize }, fileSize ? ui.humanFileSize(fileSize, true) : '')));
582
554
  };
583
555
 
584
556
  const FileThumbnail = ({ fileName, isImage, url, }) => {
package/dist/styles.css CHANGED
@@ -1640,9 +1640,8 @@ strong.amplify-text {
1640
1640
  padding-inline-start: var(--amplify-components-button-padding-inline-start);
1641
1641
  padding-inline-end: var(--amplify-components-button-padding-inline-end);
1642
1642
  transition: all var(--amplify-components-button-transition-duration);
1643
- -webkit-user-select: none;
1644
- -moz-user-select: none;
1645
- user-select: none;
1643
+ -moz-user-select: none;
1644
+ user-select: none;
1646
1645
  --amplify-internal-button-disabled-color: var(
1647
1646
  --amplify-components-button-disabled-color
1648
1647
  );
@@ -2663,58 +2662,50 @@ strong.amplify-text {
2663
2662
  background-color: var(--amplify-internal-button-disabled-background-color);
2664
2663
  border-color: var(--amplify-internal-button-disabled-border-color);
2665
2664
  color: var(--amplify-internal-button-disabled-color);
2666
- -webkit-text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2667
- text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2665
+ text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2668
2666
  cursor: not-allowed;
2669
2667
  }
2670
2668
  .amplify-button--disabled:hover {
2671
2669
  background-color: var(--amplify-internal-button-disabled-background-color);
2672
2670
  border-color: var(--amplify-internal-button-disabled-border-color);
2673
2671
  color: var(--amplify-internal-button-disabled-color);
2674
- -webkit-text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2675
- text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2672
+ text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2676
2673
  }
2677
2674
  .amplify-button--disabled :focus {
2678
2675
  background-color: var(--amplify-internal-button-disabled-background-color);
2679
2676
  border-color: var(--amplify-internal-button-disabled-border-color);
2680
2677
  color: var(--amplify-internal-button-disabled-color);
2681
- -webkit-text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2682
- text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2678
+ text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2683
2679
  }
2684
2680
  .amplify-button--disabled:active {
2685
2681
  background-color: var(--amplify-internal-button-disabled-background-color);
2686
2682
  border-color: var(--amplify-internal-button-disabled-border-color);
2687
2683
  color: var(--amplify-internal-button-disabled-color);
2688
- -webkit-text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2689
- text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2684
+ text-decoration: var(--amplify-internal-button-disabled-text-decoration);
2690
2685
  }
2691
2686
  .amplify-button--loading {
2692
2687
  background-color: var(--amplify-internal-button-loading-background-color);
2693
2688
  border-color: var(--amplify-internal-button-loading-border-color);
2694
2689
  color: var(--amplify-components-button-loading-color);
2695
- -webkit-text-decoration: var(--amplify-internal-button-loading-text-decoration);
2696
- text-decoration: var(--amplify-internal-button-loading-text-decoration);
2690
+ text-decoration: var(--amplify-internal-button-loading-text-decoration);
2697
2691
  }
2698
2692
  .amplify-button--loading:hover {
2699
2693
  background-color: var(--amplify-internal-button-loading-background-color);
2700
2694
  border-color: var(--amplify-internal-button-loading-border-color);
2701
2695
  color: var(--amplify-components-button-loading-color);
2702
- -webkit-text-decoration: var(--amplify-internal-button-loading-text-decoration);
2703
- text-decoration: var(--amplify-internal-button-loading-text-decoration);
2696
+ text-decoration: var(--amplify-internal-button-loading-text-decoration);
2704
2697
  }
2705
2698
  .amplify-button--loading:focus {
2706
2699
  background-color: var(--amplify-internal-button-loading-background-color);
2707
2700
  border-color: var(--amplify-internal-button-loading-border-color);
2708
2701
  color: var(--amplify-components-button-loading-color);
2709
- -webkit-text-decoration: var(--amplify-internal-button-loading-text-decoration);
2710
- text-decoration: var(--amplify-internal-button-loading-text-decoration);
2702
+ text-decoration: var(--amplify-internal-button-loading-text-decoration);
2711
2703
  }
2712
2704
  .amplify-button--loading:active {
2713
2705
  background-color: var(--amplify-internal-button-loading-background-color);
2714
2706
  border-color: var(--amplify-internal-button-loading-border-color);
2715
2707
  color: var(--amplify-components-button-loading-color);
2716
- -webkit-text-decoration: var(--amplify-internal-button-loading-text-decoration);
2717
- text-decoration: var(--amplify-internal-button-loading-text-decoration);
2708
+ text-decoration: var(--amplify-internal-button-loading-text-decoration);
2718
2709
  }
2719
2710
  .amplify-button__loader-wrapper {
2720
2711
  align-items: var(--amplify-components-button-loader-wrapper-align-items);
@@ -2862,9 +2853,8 @@ strong.amplify-text {
2862
2853
  outline-style: var(--amplify-components-fieldcontrol-outline-style);
2863
2854
  outline-width: var(--amplify-components-fieldcontrol-outline-width);
2864
2855
  outline-offset: var(--amplify-components-fieldcontrol-outline-offset);
2865
- -webkit-user-select: text;
2866
- -moz-user-select: text;
2867
- user-select: text;
2856
+ -moz-user-select: text;
2857
+ user-select: text;
2868
2858
  display: inline-block;
2869
2859
  --amplify-components-fieldcontrol-color: var(
2870
2860
  --amplify-components-input-color
@@ -2947,9 +2937,8 @@ strong.amplify-text {
2947
2937
  outline-style: var(--amplify-components-fieldcontrol-outline-style);
2948
2938
  outline-width: var(--amplify-components-fieldcontrol-outline-width);
2949
2939
  outline-offset: var(--amplify-components-fieldcontrol-outline-offset);
2950
- -webkit-user-select: text;
2951
- -moz-user-select: text;
2952
- user-select: text;
2940
+ -moz-user-select: text;
2941
+ user-select: text;
2953
2942
  white-space: pre-wrap;
2954
2943
  }
2955
2944
  .amplify-textarea:focus {
@@ -3013,29 +3002,24 @@ strong.amplify-text {
3013
3002
 
3014
3003
  .amplify-link {
3015
3004
  color: var(--amplify-components-link-color);
3016
- -webkit-text-decoration: var(--amplify-components-link-text-decoration);
3017
- text-decoration: var(--amplify-components-link-text-decoration);
3005
+ text-decoration: var(--amplify-components-link-text-decoration);
3018
3006
  cursor: pointer;
3019
3007
  }
3020
3008
  .amplify-link:visited {
3021
3009
  color: var(--amplify-components-link-visited-color);
3022
- -webkit-text-decoration: var(--amplify-components-link-visited-text-decoration);
3023
- text-decoration: var(--amplify-components-link-visited-text-decoration);
3010
+ text-decoration: var(--amplify-components-link-visited-text-decoration);
3024
3011
  }
3025
3012
  .amplify-link:active {
3026
3013
  color: var(--amplify-components-link-active-color);
3027
- -webkit-text-decoration: var(--amplify-components-link-active-text-decoration);
3028
- text-decoration: var(--amplify-components-link-active-text-decoration);
3014
+ text-decoration: var(--amplify-components-link-active-text-decoration);
3029
3015
  }
3030
3016
  .amplify-link:focus {
3031
3017
  color: var(--amplify-components-link-focus-color);
3032
- -webkit-text-decoration: var(--amplify-components-link-focus-text-decoration);
3033
- text-decoration: var(--amplify-components-link-focus-text-decoration);
3018
+ text-decoration: var(--amplify-components-link-focus-text-decoration);
3034
3019
  }
3035
3020
  .amplify-link:hover {
3036
3021
  color: var(--amplify-components-link-hover-color);
3037
- -webkit-text-decoration: var(--amplify-components-link-hover-text-decoration);
3038
- text-decoration: var(--amplify-components-link-hover-text-decoration);
3022
+ text-decoration: var(--amplify-components-link-hover-text-decoration);
3039
3023
  }
3040
3024
 
3041
3025
  .amplify-loader {
@@ -3466,16 +3450,14 @@ strong.amplify-text {
3466
3450
  font-weight: var(--amplify-components-breadcrumbs-link-font-weight);
3467
3451
  padding-inline: var(--amplify-components-breadcrumbs-link-padding-inline);
3468
3452
  padding-block: var(--amplify-components-breadcrumbs-link-padding-block);
3469
- -webkit-text-decoration: var(--amplify-components-breadcrumbs-link-text-decoration);
3470
- text-decoration: var(--amplify-components-breadcrumbs-link-text-decoration);
3453
+ text-decoration: var(--amplify-components-breadcrumbs-link-text-decoration);
3471
3454
  }
3472
3455
 
3473
3456
  .amplify-breadcrumbs__link--current {
3474
3457
  color: var(--amplify-components-breadcrumbs-link-current-color);
3475
3458
  font-size: var(--amplify-components-breadcrumbs-link-current-font-size);
3476
3459
  font-weight: var(--amplify-components-breadcrumbs-link-current-font-weight);
3477
- -webkit-text-decoration: var(--amplify-components-breadcrumbs-link-current-text-decoration);
3478
- text-decoration: var(--amplify-components-breadcrumbs-link-current-text-decoration);
3460
+ text-decoration: var(--amplify-components-breadcrumbs-link-current-text-decoration);
3479
3461
  }
3480
3462
 
3481
3463
  .amplify-card {
@@ -5025,9 +5007,8 @@ html[dir=rtl] .amplify-field-group__inner-start {
5025
5007
  padding-block: var(--amplify-components-sliderfield-padding-block);
5026
5008
  position: relative;
5027
5009
  touch-action: none;
5028
- -webkit-user-select: none;
5029
- -moz-user-select: none;
5030
- user-select: none;
5010
+ -moz-user-select: none;
5011
+ user-select: none;
5031
5012
  --amplify-internal-sliderfield-root-height: var(
5032
5013
  --amplify-components-sliderfield-thumb-height
5033
5014
  );
@@ -1,6 +1,5 @@
1
1
  export { checkMaxFileSize } from './checkMaxFileSize';
2
2
  export { defaultStorageManagerDisplayText, StorageManagerDisplayText, StorageManagerDisplayTextDefault, } from './displayText';
3
3
  export { filterAllowedFiles } from './filterAllowedFiles';
4
- export { humanFileSize } from './humanFileSize';
5
4
  export { getInput } from './getInput';
6
5
  export { PathCallback, TaskEvent, TaskHandler, uploadFile, UploadTask, } from './uploadFile';
@@ -1 +1 @@
1
- export declare const VERSION = "3.2.0";
1
+ export declare const VERSION = "3.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-storage",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -39,9 +39,9 @@
39
39
  "typecheck": "tsc --noEmit"
40
40
  },
41
41
  "dependencies": {
42
- "@aws-amplify/ui": "6.1.0",
43
- "@aws-amplify/ui-react": "6.2.0",
44
- "@aws-amplify/ui-react-core": "3.0.18",
42
+ "@aws-amplify/ui": "6.2.0",
43
+ "@aws-amplify/ui-react": "6.2.1",
44
+ "@aws-amplify/ui-react-core": "3.0.19",
45
45
  "lodash": "4.17.21",
46
46
  "tslib": "^2.5.2"
47
47
  },
@@ -1,29 +0,0 @@
1
- /**
2
- * Format bytes as human-readable text.
3
- *
4
- * @param bytes Number of bytes.
5
- * @param si True to use metric (SI) units, aka powers of 1000. False to use
6
- * binary (IEC), aka powers of 1024.
7
- * @param dp Number of decimal places to display.
8
- *
9
- * @return Formatted string.
10
- */
11
- function humanFileSize(bytes, si = false, dp = 1) {
12
- const thresh = si ? 1000 : 1024;
13
- if (Math.abs(bytes) < thresh) {
14
- return `${bytes} B`;
15
- }
16
- const units = si
17
- ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
18
- : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
19
- let unit = -1;
20
- const range = 10 ** dp;
21
- do {
22
- bytes /= thresh;
23
- ++unit;
24
- } while (Math.round(Math.abs(bytes) * range) / range >= thresh &&
25
- unit < units.length - 1);
26
- return bytes.toFixed(dp) + ' ' + units[unit];
27
- }
28
-
29
- export { humanFileSize };
@@ -1,11 +0,0 @@
1
- /**
2
- * Format bytes as human-readable text.
3
- *
4
- * @param bytes Number of bytes.
5
- * @param si True to use metric (SI) units, aka powers of 1000. False to use
6
- * binary (IEC), aka powers of 1024.
7
- * @param dp Number of decimal places to display.
8
- *
9
- * @return Formatted string.
10
- */
11
- export declare function humanFileSize(bytes: number, si?: boolean, dp?: number): string;