@bbl-digital/snorre 2.2.58 → 2.2.62

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.
@@ -0,0 +1,3 @@
1
+ export declare const formatBytes: (bytes?: number | undefined) => string;
2
+ export declare const isAllFilesValid: (files: File[], maxFileSizeInBytes: number) => boolean;
3
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/packages/utils/file.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wCASvB,CAAA;AAED,eAAO,MAAM,eAAe,UACnB,IAAI,EAAE,sBACO,MAAM,KACzB,OAMF,CAAA"}
@@ -0,0 +1,12 @@
1
+ export const formatBytes = bytes => {
2
+ if (!bytes || bytes === 0) return '0 KB';
3
+ const k = 1024;
4
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
5
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
6
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
7
+ };
8
+ export const isAllFilesValid = (files, maxFileSizeInBytes) => {
9
+ // Checks if all files in file array are valid sizes
10
+ const exceeds = files.some(file => file.size > maxFileSizeInBytes);
11
+ return !exceeds;
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.2.58",
3
+ "version": "2.2.62",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "draft-convert": "^2.1.12",
23
23
  "draft-js": "^0.11.7",
24
+ "draft-js-import-html": "^1.4.1",
24
25
  "draftjs-to-html": "^0.9.1",
25
26
  "react-day-picker": "^7.4.8",
26
27
  "react-draft-wysiwyg": "^1.14.7",