@sb1/ffe-file-upload-react 6.0.5 → 6.1.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.
package/es/FileItem.js CHANGED
@@ -23,8 +23,8 @@ var FileItem = function FileItem(_ref) {
23
23
  className: "ffe-file-upload__file-item-stencil-info-background"
24
24
  }), /*#__PURE__*/React.createElement("div", {
25
25
  className: "ffe-file-upload__file-item-stencil-info-filename"
26
- }, file.name))), // File finished loading
27
- file.document && /*#__PURE__*/React.createElement("div", {
26
+ }, file.name))), // File finished loading without error
27
+ file.document && !file.error && /*#__PURE__*/React.createElement("div", {
28
28
  className: "ffe-file-upload__file-item-loaded"
29
29
  }, /*#__PURE__*/React.createElement("button", {
30
30
  type: "button",
package/es/FileUpload.js CHANGED
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
8
8
 
9
9
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
10
 
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
12
 
13
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
14
 
@@ -18,7 +18,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
18
18
 
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
 
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
22
 
23
23
  import React from 'react';
24
24
  import { object, bool, func, string as stringType } from 'prop-types';
package/lib/FileItem.js CHANGED
@@ -33,8 +33,8 @@ var FileItem = function FileItem(_ref) {
33
33
  className: "ffe-file-upload__file-item-stencil-info-background"
34
34
  }), /*#__PURE__*/_react.default.createElement("div", {
35
35
  className: "ffe-file-upload__file-item-stencil-info-filename"
36
- }, file.name))), // File finished loading
37
- file.document && /*#__PURE__*/_react.default.createElement("div", {
36
+ }, file.name))), // File finished loading without error
37
+ file.document && !file.error && /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "ffe-file-upload__file-item-loaded"
39
39
  }, /*#__PURE__*/_react.default.createElement("button", {
40
40
  type: "button",
package/lib/FileUpload.js CHANGED
@@ -29,7 +29,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
29
29
 
30
30
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
31
 
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
33
 
34
34
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
35
 
@@ -39,7 +39,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
39
39
 
40
40
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
41
 
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
43
 
44
44
  var FileUpload = /*#__PURE__*/function (_React$Component) {
45
45
  _inherits(FileUpload, _React$Component);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-file-upload-react",
3
- "version": "6.0.5",
3
+ "version": "6.1.2",
4
4
  "description": "Upload file button with validation and list of uploaded files.",
5
5
  "keywords": [
6
6
  "ffe"
@@ -9,24 +9,26 @@
9
9
  "author": "SpareBank 1",
10
10
  "files": [
11
11
  "lib",
12
- "es"
12
+ "es",
13
+ "types"
13
14
  ],
14
15
  "main": "lib/index.js",
15
16
  "module": "es/index.js",
17
+ "types": "types/index.d.ts",
16
18
  "sideEffects": false,
17
19
  "repository": {
18
20
  "type": "git",
19
21
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
20
22
  },
21
23
  "scripts": {
22
- "build": "ffe-buildtool babel --no-copy-typedef",
24
+ "build": "ffe-buildtool babel",
23
25
  "watch": "ffe-buildtool babel-watch",
24
26
  "lint": "eslint src",
25
27
  "test": "ffe-buildtool jest",
26
28
  "test:watch": "ffe-buildtool jest --watch"
27
29
  },
28
30
  "dependencies": {
29
- "@sb1/ffe-buttons-react": "^16.0.2",
31
+ "@sb1/ffe-buttons-react": "^16.0.3",
30
32
  "@sb1/ffe-icons-react": "^7.3.2",
31
33
  "classnames": "^2.3.1"
32
34
  },
@@ -46,5 +48,5 @@
46
48
  "depencencies": {
47
49
  "prop-types": "^15.6.0"
48
50
  },
49
- "gitHead": "aedebe00873310156565d8bd15a210558f2dd57f"
51
+ "gitHead": "9d34a84587007eec50ba28d59a4141da044ed353"
50
52
  }
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+
3
+ export interface FileItem {
4
+ name: string;
5
+ document?: File;
6
+ error?: string;
7
+ }
8
+
9
+ export interface FileUploadProps {
10
+ id: string;
11
+ label: string;
12
+ files: Record<string, FileItem>;
13
+ onFilesSelected(fileList: FileList): void;
14
+ onFilesDropped(fileList: FileList): void;
15
+ onFileDeleted(file: File): void;
16
+ multiple?: boolean;
17
+ title: string;
18
+ infoText: string;
19
+ infoSubText?: string;
20
+ cancelText?: string;
21
+ deleteText?: string;
22
+ uploadTitle: string;
23
+ uploadMicroText: string;
24
+ uploadSubText: string;
25
+ }
26
+ declare class FileUpload extends React.Component<FileUploadProps, any> {}
27
+
28
+ declare function getFileContent(file: File): Promise<any>;
29
+
30
+ export default FileUpload;
31
+ export { getFileContent };