@sb1/ffe-file-upload-react 5.0.1 → 5.0.5

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
@@ -6,54 +6,54 @@ var FileItem = function FileItem(_ref) {
6
6
  onFileDeleted = _ref.onFileDeleted,
7
7
  cancelText = _ref.cancelText,
8
8
  deleteText = _ref.deleteText;
9
- return React.createElement("li", null, // File is loading
10
- !file.document && !file.error && React.createElement("div", {
9
+ return /*#__PURE__*/React.createElement("li", null, // File is loading
10
+ !file.document && !file.error && /*#__PURE__*/React.createElement("div", {
11
11
  className: "ffe-file-upload__file-item-stencil"
12
- }, React.createElement("button", {
12
+ }, /*#__PURE__*/React.createElement("button", {
13
13
  type: "button",
14
14
  id: file.name,
15
15
  className: "ffe-file-upload__file-item-delete-button",
16
16
  onClick: onFileDeleted
17
- }, cancelText, React.createElement("div", {
17
+ }, cancelText, /*#__PURE__*/React.createElement("div", {
18
18
  id: file.name,
19
19
  className: "ffe-file-upload__file-item-delete-icon"
20
- })), React.createElement("div", {
20
+ })), /*#__PURE__*/React.createElement("div", {
21
21
  className: "ffe-file-upload__file-item-stencil-info"
22
- }, React.createElement("div", {
22
+ }, /*#__PURE__*/React.createElement("div", {
23
23
  className: "ffe-file-upload__file-item-stencil-info-background"
24
- }), React.createElement("div", {
24
+ }), /*#__PURE__*/React.createElement("div", {
25
25
  className: "ffe-file-upload__file-item-stencil-info-filename"
26
26
  }, file.name))), // File finished loading
27
- file.document && React.createElement("div", {
27
+ file.document && /*#__PURE__*/React.createElement("div", {
28
28
  className: "ffe-file-upload__file-item-loaded"
29
- }, React.createElement("button", {
29
+ }, /*#__PURE__*/React.createElement("button", {
30
30
  type: "button",
31
31
  id: file.name,
32
32
  className: "ffe-file-upload__file-item-delete-button",
33
33
  onClick: onFileDeleted
34
- }, deleteText, React.createElement("div", {
34
+ }, deleteText, /*#__PURE__*/React.createElement("div", {
35
35
  id: file.name,
36
36
  className: "ffe-file-upload__file-item-delete-icon"
37
- })), React.createElement("div", {
37
+ })), /*#__PURE__*/React.createElement("div", {
38
38
  className: "ffe-file-upload__file-item-filename"
39
39
  }, file.name)), // File has error
40
- file.error && React.createElement("div", {
40
+ file.error && /*#__PURE__*/React.createElement("div", {
41
41
  className: "ffe-file-upload__file-item-error"
42
- }, React.createElement("div", {
42
+ }, /*#__PURE__*/React.createElement("div", {
43
43
  className: "ffe-file-upload__file-item-error-icon ffe-field-error-message"
44
- }), React.createElement("button", {
44
+ }), /*#__PURE__*/React.createElement("button", {
45
45
  type: "button",
46
46
  id: file.name,
47
47
  className: "ffe-file-upload__file-item-delete-button",
48
48
  onClick: onFileDeleted
49
- }, deleteText, React.createElement("div", {
49
+ }, deleteText, /*#__PURE__*/React.createElement("div", {
50
50
  id: file.name,
51
51
  className: "ffe-file-upload__file-item-delete-icon"
52
- })), React.createElement("div", {
52
+ })), /*#__PURE__*/React.createElement("div", {
53
53
  className: "ffe-file-upload__file-item-error-info"
54
- }, React.createElement("div", {
54
+ }, /*#__PURE__*/React.createElement("div", {
55
55
  className: "ffe-file-upload__file-item-error-filename"
56
- }, file.name), React.createElement("div", {
56
+ }, file.name), /*#__PURE__*/React.createElement("div", {
57
57
  className: "ffe-file-upload__file-item-error-message"
58
58
  }, file.error))));
59
59
  };
package/es/FileUpload.js CHANGED
@@ -1,4 +1,4 @@
1
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
2
 
3
3
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
4
 
@@ -6,32 +6,36 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
6
6
 
7
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
8
 
9
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
10
 
11
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
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
+
15
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
16
 
13
17
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
18
 
15
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
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; } }
16
20
 
17
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
18
22
 
19
23
  import React from 'react';
20
24
  import { object, bool, func, string as stringType } from 'prop-types';
21
25
  import FileItem from './FileItem';
22
26
  import classNames from 'classnames';
23
27
 
24
- var FileUpload =
25
- /*#__PURE__*/
26
- function (_React$Component) {
28
+ var FileUpload = /*#__PURE__*/function (_React$Component) {
27
29
  _inherits(FileUpload, _React$Component);
28
30
 
31
+ var _super = _createSuper(FileUpload);
32
+
29
33
  function FileUpload(props) {
30
34
  var _this;
31
35
 
32
36
  _classCallCheck(this, FileUpload);
33
37
 
34
- _this = _possibleConstructorReturn(this, _getPrototypeOf(FileUpload).call(this, props));
38
+ _this = _super.call(this, props);
35
39
  _this.onFilesSelected = _this.onFilesSelected.bind(_assertThisInitialized(_this));
36
40
  _this.onFilesDropped = _this.onFilesDropped.bind(_assertThisInitialized(_this));
37
41
  _this.onFileDeleted = _this.onFileDeleted.bind(_assertThisInitialized(_this));
@@ -96,27 +100,27 @@ function (_React$Component) {
96
100
  uploadMicroText = _this$props.uploadMicroText,
97
101
  uploadSubText = _this$props.uploadSubText,
98
102
  onFileDeleted = _this$props.onFileDeleted;
99
- return React.createElement("div", {
103
+ return /*#__PURE__*/React.createElement("div", {
100
104
  className: "ffe-file-upload"
101
- }, React.createElement("div", {
105
+ }, /*#__PURE__*/React.createElement("div", {
102
106
  className: "ffe-file-upload__title"
103
- }, title), Object.keys(files).length > 0 ? React.createElement("div", {
107
+ }, title), Object.keys(files).length > 0 ? /*#__PURE__*/React.createElement("div", {
104
108
  className: "ffe-file-upload__file-items-section"
105
109
  }, Object.keys(files).map(function (file) {
106
- return React.createElement(FileItem, {
110
+ return /*#__PURE__*/React.createElement(FileItem, {
107
111
  key: file,
108
112
  file: files[file],
109
113
  cancelText: cancelText,
110
114
  deleteText: deleteText,
111
115
  onFileDeleted: onFileDeleted
112
116
  });
113
- })) : React.createElement("div", {
117
+ })) : /*#__PURE__*/React.createElement("div", {
114
118
  className: "ffe-file-upload__info-section"
115
- }, React.createElement("div", {
119
+ }, /*#__PURE__*/React.createElement("div", {
116
120
  className: "ffe-file-upload__info-section-text"
117
- }, infoText), React.createElement("div", {
121
+ }, infoText), /*#__PURE__*/React.createElement("div", {
118
122
  className: "ffe-file-upload__info-section-subtext"
119
- }, infoSubText)), React.createElement("div", {
123
+ }, infoSubText)), /*#__PURE__*/React.createElement("div", {
120
124
  className: "ffe-file-upload__upload-section",
121
125
  role: "presentation",
122
126
  onDrop: this.onFilesDropped,
@@ -132,25 +136,25 @@ function (_React$Component) {
132
136
  hover: false
133
137
  });
134
138
  }
135
- }, React.createElement("div", {
139
+ }, /*#__PURE__*/React.createElement("div", {
136
140
  className: classNames('ffe-file-upload__upload-section-border', {
137
141
  'ffe-file-upload__upload-section-border--hover': this.state.hover
138
142
  })
139
- }, React.createElement("div", {
143
+ }, /*#__PURE__*/React.createElement("div", {
140
144
  className: "ffe-file-upload__upload-section-title"
141
- }, uploadTitle), React.createElement("div", {
145
+ }, uploadTitle), /*#__PURE__*/React.createElement("div", {
142
146
  className: "ffe-file-upload__upload-section-microtext"
143
- }, uploadMicroText), React.createElement("button", {
147
+ }, uploadMicroText), /*#__PURE__*/React.createElement("button", {
144
148
  type: "button",
145
149
  className: "ffe-file-upload__upload-button",
146
150
  onClick: this.triggerUploadFileNativeHandler
147
- }, React.createElement("span", {
151
+ }, /*#__PURE__*/React.createElement("span", {
148
152
  className: "ffe-file-upload__upload-button-icon"
149
- }), React.createElement("span", {
153
+ }), /*#__PURE__*/React.createElement("span", {
150
154
  id: "".concat(id, "-label")
151
- }, label)), React.createElement("div", {
155
+ }, label)), /*#__PURE__*/React.createElement("div", {
152
156
  className: "ffe-file-upload__upload-section-subtext"
153
- }, uploadSubText))), React.createElement("input", {
157
+ }, uploadSubText))), /*#__PURE__*/React.createElement("input", {
154
158
  id: id,
155
159
  type: "file",
156
160
  multiple: multiple,
package/lib/FileItem.js CHANGED
@@ -16,54 +16,54 @@ var FileItem = function FileItem(_ref) {
16
16
  onFileDeleted = _ref.onFileDeleted,
17
17
  cancelText = _ref.cancelText,
18
18
  deleteText = _ref.deleteText;
19
- return _react.default.createElement("li", null, // File is loading
20
- !file.document && !file.error && _react.default.createElement("div", {
19
+ return /*#__PURE__*/_react.default.createElement("li", null, // File is loading
20
+ !file.document && !file.error && /*#__PURE__*/_react.default.createElement("div", {
21
21
  className: "ffe-file-upload__file-item-stencil"
22
- }, _react.default.createElement("button", {
22
+ }, /*#__PURE__*/_react.default.createElement("button", {
23
23
  type: "button",
24
24
  id: file.name,
25
25
  className: "ffe-file-upload__file-item-delete-button",
26
26
  onClick: onFileDeleted
27
- }, cancelText, _react.default.createElement("div", {
27
+ }, cancelText, /*#__PURE__*/_react.default.createElement("div", {
28
28
  id: file.name,
29
29
  className: "ffe-file-upload__file-item-delete-icon"
30
- })), _react.default.createElement("div", {
30
+ })), /*#__PURE__*/_react.default.createElement("div", {
31
31
  className: "ffe-file-upload__file-item-stencil-info"
32
- }, _react.default.createElement("div", {
32
+ }, /*#__PURE__*/_react.default.createElement("div", {
33
33
  className: "ffe-file-upload__file-item-stencil-info-background"
34
- }), _react.default.createElement("div", {
34
+ }), /*#__PURE__*/_react.default.createElement("div", {
35
35
  className: "ffe-file-upload__file-item-stencil-info-filename"
36
36
  }, file.name))), // File finished loading
37
- file.document && _react.default.createElement("div", {
37
+ file.document && /*#__PURE__*/_react.default.createElement("div", {
38
38
  className: "ffe-file-upload__file-item-loaded"
39
- }, _react.default.createElement("button", {
39
+ }, /*#__PURE__*/_react.default.createElement("button", {
40
40
  type: "button",
41
41
  id: file.name,
42
42
  className: "ffe-file-upload__file-item-delete-button",
43
43
  onClick: onFileDeleted
44
- }, deleteText, _react.default.createElement("div", {
44
+ }, deleteText, /*#__PURE__*/_react.default.createElement("div", {
45
45
  id: file.name,
46
46
  className: "ffe-file-upload__file-item-delete-icon"
47
- })), _react.default.createElement("div", {
47
+ })), /*#__PURE__*/_react.default.createElement("div", {
48
48
  className: "ffe-file-upload__file-item-filename"
49
49
  }, file.name)), // File has error
50
- file.error && _react.default.createElement("div", {
50
+ file.error && /*#__PURE__*/_react.default.createElement("div", {
51
51
  className: "ffe-file-upload__file-item-error"
52
- }, _react.default.createElement("div", {
52
+ }, /*#__PURE__*/_react.default.createElement("div", {
53
53
  className: "ffe-file-upload__file-item-error-icon ffe-field-error-message"
54
- }), _react.default.createElement("button", {
54
+ }), /*#__PURE__*/_react.default.createElement("button", {
55
55
  type: "button",
56
56
  id: file.name,
57
57
  className: "ffe-file-upload__file-item-delete-button",
58
58
  onClick: onFileDeleted
59
- }, deleteText, _react.default.createElement("div", {
59
+ }, deleteText, /*#__PURE__*/_react.default.createElement("div", {
60
60
  id: file.name,
61
61
  className: "ffe-file-upload__file-item-delete-icon"
62
- })), _react.default.createElement("div", {
62
+ })), /*#__PURE__*/_react.default.createElement("div", {
63
63
  className: "ffe-file-upload__file-item-error-info"
64
- }, _react.default.createElement("div", {
64
+ }, /*#__PURE__*/_react.default.createElement("div", {
65
65
  className: "ffe-file-upload__file-item-error-filename"
66
- }, file.name), _react.default.createElement("div", {
66
+ }, file.name), /*#__PURE__*/_react.default.createElement("div", {
67
67
  className: "ffe-file-upload__file-item-error-message"
68
68
  }, file.error))));
69
69
  };
package/lib/FileUpload.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -15,35 +17,37 @@ var _classnames = _interopRequireDefault(require("classnames"));
15
17
 
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
19
-
20
20
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
21
 
22
22
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
23
 
24
24
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
25
 
26
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
26
+ 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
+
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
29
 
28
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
30
+ 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); }; }
31
+
32
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
29
33
 
30
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
35
 
32
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
36
+ 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; } }
33
37
 
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
39
 
36
- var FileUpload =
37
- /*#__PURE__*/
38
- function (_React$Component) {
40
+ var FileUpload = /*#__PURE__*/function (_React$Component) {
39
41
  _inherits(FileUpload, _React$Component);
40
42
 
43
+ var _super = _createSuper(FileUpload);
44
+
41
45
  function FileUpload(props) {
42
46
  var _this;
43
47
 
44
48
  _classCallCheck(this, FileUpload);
45
49
 
46
- _this = _possibleConstructorReturn(this, _getPrototypeOf(FileUpload).call(this, props));
50
+ _this = _super.call(this, props);
47
51
  _this.onFilesSelected = _this.onFilesSelected.bind(_assertThisInitialized(_this));
48
52
  _this.onFilesDropped = _this.onFilesDropped.bind(_assertThisInitialized(_this));
49
53
  _this.onFileDeleted = _this.onFileDeleted.bind(_assertThisInitialized(_this));
@@ -108,27 +112,27 @@ function (_React$Component) {
108
112
  uploadMicroText = _this$props.uploadMicroText,
109
113
  uploadSubText = _this$props.uploadSubText,
110
114
  onFileDeleted = _this$props.onFileDeleted;
111
- return _react.default.createElement("div", {
115
+ return /*#__PURE__*/_react.default.createElement("div", {
112
116
  className: "ffe-file-upload"
113
- }, _react.default.createElement("div", {
117
+ }, /*#__PURE__*/_react.default.createElement("div", {
114
118
  className: "ffe-file-upload__title"
115
- }, title), Object.keys(files).length > 0 ? _react.default.createElement("div", {
119
+ }, title), Object.keys(files).length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
116
120
  className: "ffe-file-upload__file-items-section"
117
121
  }, Object.keys(files).map(function (file) {
118
- return _react.default.createElement(_FileItem.default, {
122
+ return /*#__PURE__*/_react.default.createElement(_FileItem.default, {
119
123
  key: file,
120
124
  file: files[file],
121
125
  cancelText: cancelText,
122
126
  deleteText: deleteText,
123
127
  onFileDeleted: onFileDeleted
124
128
  });
125
- })) : _react.default.createElement("div", {
129
+ })) : /*#__PURE__*/_react.default.createElement("div", {
126
130
  className: "ffe-file-upload__info-section"
127
- }, _react.default.createElement("div", {
131
+ }, /*#__PURE__*/_react.default.createElement("div", {
128
132
  className: "ffe-file-upload__info-section-text"
129
- }, infoText), _react.default.createElement("div", {
133
+ }, infoText), /*#__PURE__*/_react.default.createElement("div", {
130
134
  className: "ffe-file-upload__info-section-subtext"
131
- }, infoSubText)), _react.default.createElement("div", {
135
+ }, infoSubText)), /*#__PURE__*/_react.default.createElement("div", {
132
136
  className: "ffe-file-upload__upload-section",
133
137
  role: "presentation",
134
138
  onDrop: this.onFilesDropped,
@@ -144,25 +148,25 @@ function (_React$Component) {
144
148
  hover: false
145
149
  });
146
150
  }
147
- }, _react.default.createElement("div", {
151
+ }, /*#__PURE__*/_react.default.createElement("div", {
148
152
  className: (0, _classnames.default)('ffe-file-upload__upload-section-border', {
149
153
  'ffe-file-upload__upload-section-border--hover': this.state.hover
150
154
  })
151
- }, _react.default.createElement("div", {
155
+ }, /*#__PURE__*/_react.default.createElement("div", {
152
156
  className: "ffe-file-upload__upload-section-title"
153
- }, uploadTitle), _react.default.createElement("div", {
157
+ }, uploadTitle), /*#__PURE__*/_react.default.createElement("div", {
154
158
  className: "ffe-file-upload__upload-section-microtext"
155
- }, uploadMicroText), _react.default.createElement("button", {
159
+ }, uploadMicroText), /*#__PURE__*/_react.default.createElement("button", {
156
160
  type: "button",
157
161
  className: "ffe-file-upload__upload-button",
158
162
  onClick: this.triggerUploadFileNativeHandler
159
- }, _react.default.createElement("span", {
163
+ }, /*#__PURE__*/_react.default.createElement("span", {
160
164
  className: "ffe-file-upload__upload-button-icon"
161
- }), _react.default.createElement("span", {
165
+ }), /*#__PURE__*/_react.default.createElement("span", {
162
166
  id: "".concat(id, "-label")
163
- }, label)), _react.default.createElement("div", {
167
+ }, label)), /*#__PURE__*/_react.default.createElement("div", {
164
168
  className: "ffe-file-upload__upload-section-subtext"
165
- }, uploadSubText))), _react.default.createElement("input", {
169
+ }, uploadSubText))), /*#__PURE__*/_react.default.createElement("input", {
166
170
  id: id,
167
171
  type: "file",
168
172
  multiple: multiple,
package/lib/index.js CHANGED
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
  Object.defineProperty(exports, "getFileContent", {
7
8
  enumerable: true,
8
9
  get: function get() {
9
10
  return _fileContent.getFileContent;
10
11
  }
11
12
  });
12
- exports.default = void 0;
13
13
 
14
14
  var _FileUpload = _interopRequireDefault(require("./FileUpload"));
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-file-upload-react",
3
- "version": "5.0.1",
3
+ "version": "5.0.5",
4
4
  "description": "Upload file button with validation and list of uploaded files.",
5
5
  "keywords": [
6
6
  "ffe"
@@ -19,10 +19,8 @@
19
19
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
20
20
  },
21
21
  "scripts": {
22
- "build": "npm run build:cjs && npm run build:es",
23
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
24
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
25
- "lint": "eslint src/.",
22
+ "build": "ffe-buildtool babel --no-copy-typedef",
23
+ "lint": "eslint src",
26
24
  "test": "jest",
27
25
  "test:watch": "jest --watch"
28
26
  },
@@ -30,19 +28,20 @@
30
28
  "setupTestFrameworkScriptFile": "../../test-setup.js"
31
29
  },
32
30
  "dependencies": {
33
- "classnames": "^2.2.5"
31
+ "classnames": "^2.3.1"
34
32
  },
35
33
  "devDependencies": {
34
+ "@sb1/ffe-buildtool": "^0.1.0",
36
35
  "enzyme": "^3.7.0",
37
36
  "enzyme-adapter-react-16": "^1.7.0",
38
- "jest": "^23.4.2",
37
+ "jest": "^26.0.0",
39
38
  "react": "^16.9.0",
40
39
  "react-dom": "^16.9.0"
41
40
  },
42
41
  "peerDependencies": {
43
- "@sb1/ffe-core": "^15.2.0",
44
- "@sb1/ffe-form": ">=11.0.1",
45
- "react": "^16.9.0"
42
+ "@sb1/ffe-core": "*",
43
+ "@sb1/ffe-form": "*",
44
+ "react": ">=16.9.0"
46
45
  },
47
46
  "publishConfig": {
48
47
  "access": "public"
@@ -50,5 +49,5 @@
50
49
  "depencencies": {
51
50
  "prop-types": "^15.6.0"
52
51
  },
53
- "gitHead": "e5b885de1323a8f19028ef7f2e72d866f387fc82"
52
+ "gitHead": "59eb2e12625e744f1a116c14a40cf69f1bbecdc6"
54
53
  }
package/CHANGELOG.md DELETED
@@ -1,257 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [5.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@5.0.0...@sb1/ffe-file-upload-react@5.0.1) (2019-10-16)
7
-
8
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
9
-
10
- # [5.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@4.0.0...@sb1/ffe-file-upload-react@5.0.0) (2019-09-16)
11
-
12
- ### Code Refactoring
13
-
14
- - **ffe-file-upload-react:** Refactor with new design ([30400f2](https://github.com/SpareBank1/designsystem/commit/30400f2))
15
-
16
- ### BREAKING CHANGES
17
-
18
- - **ffe-file-upload-react:** Redesign of module with new design, including drag and drop support
19
-
20
- # [4.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.11...@sb1/ffe-file-upload-react@4.0.0) (2019-08-27)
21
-
22
- ### chore
23
-
24
- - bump React to 16.9 to allow for using hooks etc ([e3901f1](https://github.com/SpareBank1/designsystem/commit/e3901f1))
25
-
26
- ### BREAKING CHANGES
27
-
28
- - peerDep of React is raised to 16.9. While this in itself
29
- isn't a breaking change, it allows for the use of hooks in later releases.
30
- Such changes would just be a minor version, or even a patch, but without
31
- this major version bump it would result in a runtime error for consumers.
32
-
33
- ## [3.0.11](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.10...@sb1/ffe-file-upload-react@3.0.11) (2019-06-26)
34
-
35
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
36
-
37
- ## [3.0.10](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.9...@sb1/ffe-file-upload-react@3.0.10) (2019-05-21)
38
-
39
- ### Bug Fixes
40
-
41
- - **ffe-file-upload-react:** ffe-form compat ([ece3fd3](https://github.com/SpareBank1/designsystem/commit/ece3fd3))
42
-
43
- ## [3.0.9](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.8...@sb1/ffe-file-upload-react@3.0.9) (2018-12-11)
44
-
45
- ### Bug Fixes
46
-
47
- - Build tree shakeable packages ([fb4a9ea](https://github.com/SpareBank1/designsystem/commit/fb4a9ea))
48
-
49
- ## [3.0.8](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.7...@sb1/ffe-file-upload-react@3.0.8) (2018-11-26)
50
-
51
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
52
-
53
- ## [3.0.7](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.6...@sb1/ffe-file-upload-react@3.0.7) (2018-11-09)
54
-
55
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
56
-
57
- ## [3.0.6](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.5...@sb1/ffe-file-upload-react@3.0.6) (2018-11-08)
58
-
59
- ### Bug Fixes
60
-
61
- - **ffe-file-upload-react:** fixed async issues with setState ([0a6b546](https://github.com/SpareBank1/designsystem/commit/0a6b546))
62
-
63
- <a name="3.0.5"></a>
64
-
65
- ## [3.0.5](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.4...@sb1/ffe-file-upload-react@3.0.5) (2018-08-09)
66
-
67
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
68
-
69
- <a name="3.0.4"></a>
70
-
71
- ## [3.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.3...@sb1/ffe-file-upload-react@3.0.4) (2018-06-20)
72
-
73
- ### Bug Fixes
74
-
75
- - **ffe-file-upload-react:** added peerDependency to ffe-core@^13.0.0 ([bb426a9](https://github.com/SpareBank1/designsystem/commit/bb426a9))
76
-
77
- <a name="3.0.3"></a>
78
-
79
- ## [3.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.2...@sb1/ffe-file-upload-react@3.0.3) (2018-03-27)
80
-
81
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
82
-
83
- <a name="3.0.2"></a>
84
-
85
- ## [3.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.0...@sb1/ffe-file-upload-react@3.0.2) (2018-03-07)
86
-
87
- ### Bug Fixes
88
-
89
- - Correct peerDependencies after breaking change ([aab59ce](https://github.com/SpareBank1/designsystem/commit/aab59ce))
90
-
91
- <a name="3.0.1"></a>
92
-
93
- ## [3.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.0...@sb1/ffe-file-upload-react@3.0.1) (2018-03-02)
94
-
95
- ### Bug Fixes
96
-
97
- - Correct peerDependencies after breaking change ([4318363](https://github.com/SpareBank1/designsystem/commit/4318363))
98
-
99
- <a name="3.0.0"></a>
100
-
101
- # 3.0.0 (2018-02-25)
102
-
103
- ### Chores
104
-
105
- - **ffe-file-upload-react:** Moving in ([870b07f](https://github.com/SpareBank1/designsystem/commit/870b07f))
106
- - add [@sb1](https://github.com/sb1)/ scope to all packages ([37efbb4](https://github.com/SpareBank1/designsystem/commit/37efbb4))
107
-
108
- ### BREAKING CHANGES
109
-
110
- - All packages have been renamed to add the @sb1 scope.
111
-
112
- See links [1] and [2] to read more about package scopes.
113
-
114
- Unfortunately this requires you update both your dependencies in
115
- `package.json` and all `import` or `require` statements in your code.
116
- Also, you unfortunately have to upgrade all FFE packages at once due to
117
- dependency between packages. If you are on the latest version prior to
118
- this breaking change the upgrade should be a matter of updating
119
- `package.json` with new package names and versions, and updating your
120
- imports.
121
-
122
- To help find the proper package versions you can either browse to the
123
- packages you need or check out the list of Git tags either on
124
- Github [3] or by cloning the repository and running the `git tag`
125
- command. All package versions get a tag in the format
126
- _package@version_.
127
-
128
- Update your `package.json` with the latest package version and add the
129
- @sb1 scope to the package name:
130
-
131
- ```diff
132
- - "ffe-core": "11.0.2",
133
- + "@sb1/ffe-core": "11.0.2",
134
- ```
135
-
136
- Scoped packages all get put in a subdirectory in `node_modules/`. In our
137
- case packages will be put in the `node_modules/@sb1/` directory. If your
138
- build depends on file paths (for instance for copying fonts) you need to
139
- update that path to include the scope.
140
-
141
- The directory structure also means you have to update your imports, both
142
- in Less and in JavaScript.
143
-
144
- Using `less-plugin-npm-import`:
145
-
146
- ```diff
147
- - @import 'npm://ffe-core/less/ffe';
148
- + @import 'npm://@sb1/ffe-core/less/ffe';
149
- ```
150
-
151
- Using Webpack:
152
-
153
- ```diff
154
- - @import '~ffe-core/less/ffe';
155
- + @import '~@sb1/ffe-core/less/ffe';
156
- ```
157
-
158
- Using plain old paths:
159
-
160
- ```diff
161
- - @import '../path/to/node_modules/ffe-core/less/ffe';
162
- + @import '../path/to/node_modules/@sb1/ffe-core/less/ffe';
163
- ```
164
-
165
- JavaScript `import`:
166
-
167
- ```diff
168
- - import { ActionButton } from 'ffe-buttons-react';
169
- + import { ActionButton } from '@sb1/ffe-buttons-react';
170
- ```
171
-
172
- JavaScript `require`:
173
-
174
- ```diff
175
- - const { ActionButton } = require('ffe-buttons-react').default;
176
- + const { ActionButton } = require('@sb1/ffe-buttons-react').default;
177
- ```
178
-
179
- [1]: https://docs.npmjs.com/misc/scope
180
- [2]: https://docs.npmjs.com/getting-started/scoped-packages
181
- [3]: https://github.com/sparebank1/designsystem/tags
182
-
183
- - **ffe-file-upload-react:** Requires React 16.2 or newer
184
-
185
- With this ffe-file-upload-react is moved to the monorepo. A breaking
186
- change is introduced to remove support for React 15. The upgrade should
187
- be a drop-in upgrade for users of React 16.2 or newer.
188
-
189
- <a name="2.0.6"></a>
190
-
191
- ## [2.0.6](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.5...ffe-file-upload-react@2.0.6) (2018-02-23)
192
-
193
- **Note:** Version bump only for package ffe-file-upload-react
194
-
195
- <a name="2.0.5"></a>
196
-
197
- ## [2.0.5](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.4...ffe-file-upload-react@2.0.5) (2018-02-22)
198
-
199
- **Note:** Version bump only for package ffe-file-upload-react
200
-
201
- <a name="2.0.4"></a>
202
-
203
- ## [2.0.4](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.3...ffe-file-upload-react@2.0.4) (2018-02-16)
204
-
205
- **Note:** Version bump only for package ffe-file-upload-react
206
-
207
- <a name="2.0.3"></a>
208
-
209
- ## [2.0.3](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.2...ffe-file-upload-react@2.0.3) (2018-01-22)
210
-
211
- **Note:** Version bump only for package ffe-file-upload-react
212
-
213
- <a name="2.0.2"></a>
214
-
215
- ## [2.0.2](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.1...ffe-file-upload-react@2.0.2) (2018-01-19)
216
-
217
- **Note:** Version bump only for package ffe-file-upload-react
218
-
219
- <a name="2.0.1"></a>
220
-
221
- ## [2.0.1](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.0...ffe-file-upload-react@2.0.1) (2018-01-18)
222
-
223
- **Note:** Version bump only for package ffe-file-upload-react
224
-
225
- <a name="2.0.0"></a>
226
-
227
- # 2.0.0 (2018-01-12)
228
-
229
- ### Chores
230
-
231
- - **ffe-file-upload-react:** Moving in
232
-
233
- ### BREAKING CHANGES
234
-
235
- - **ffe-file-upload-react:** Requires React 16.2 or newer
236
-
237
- With this ffe-file-upload-react is moved to the monorepo. A breaking
238
- change is introduced to remove support for React 15. The upgrade should
239
- be a drop-in upgrade for users of React 16.2 or newer.
240
-
241
- # 1.2.0
242
-
243
- - aria-label is now set by label
244
-
245
- # 1.1.0
246
-
247
- - Moved clearing of input to enable multiple upload
248
- - Adding success and info message support
249
- - Adding support for multiple error messages
250
-
251
- ## 1.0.1
252
-
253
- - Fixed bug where file input element was not cleared after each upload(causing sequential upload of files with same filename to not perform onChange and therefore no upload)
254
-
255
- # 1.0.0
256
-
257
- - Initial version
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import sinon from 'sinon';
3
- import { shallow } from 'enzyme';
4
- import FileUpload from '../src/FileUpload';
5
- describe('<FileUpload/>', function () {
6
- var component;
7
- var onFilesSelected;
8
- var onFileDeleted;
9
- var onFilesDropped;
10
- beforeEach(function () {
11
- onFilesSelected = sinon.spy();
12
- onFileDeleted = sinon.spy();
13
- onFilesDropped = sinon.spy();
14
- });
15
- describe('initial state', function () {
16
- beforeEach(function () {
17
- component = shallow(React.createElement(FileUpload, {
18
- id: "file-upload",
19
- label: "label",
20
- title: "title",
21
- infoText: "infoText",
22
- uploadTitle: "uploadTitle",
23
- uploadMicroText: "uploadMicroText",
24
- uploadSubText: "uploadSubText",
25
- files: {},
26
- onFilesSelected: onFilesSelected,
27
- onFileDeleted: onFileDeleted,
28
- onFilesDropped: onFilesDropped
29
- }));
30
- });
31
- it('should have a button and input', function () {
32
- expect(component.find('.ffe-file-upload__upload-button').exists()).toBe(true);
33
- expect(component.find('#file-upload').exists()).toBe(true);
34
- });
35
- it('should render input label', function () {
36
- expect(component.find('.ffe-file-upload__upload-button').text()).toBe('label');
37
- });
38
- it('should add label as aria-label', function () {
39
- expect(component.find('#file-upload-label').text()).toBe('label');
40
- });
41
- it('should extract and return files when user finishes selecting files', function () {
42
- component.find('#file-upload').simulate('change', {
43
- target: {
44
- files: {
45
- filename: {
46
- name: 'filename'
47
- }
48
- }
49
- }
50
- });
51
- expect(onFilesSelected.calledOnce).toBe(true);
52
- });
53
- });
54
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- var _react = _interopRequireDefault(require("react"));
4
-
5
- var _sinon = _interopRequireDefault(require("sinon"));
6
-
7
- var _enzyme = require("enzyme");
8
-
9
- var _FileUpload = _interopRequireDefault(require("../src/FileUpload"));
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
- describe('<FileUpload/>', function () {
14
- var component;
15
- var onFilesSelected;
16
- var onFileDeleted;
17
- var onFilesDropped;
18
- beforeEach(function () {
19
- onFilesSelected = _sinon.default.spy();
20
- onFileDeleted = _sinon.default.spy();
21
- onFilesDropped = _sinon.default.spy();
22
- });
23
- describe('initial state', function () {
24
- beforeEach(function () {
25
- component = (0, _enzyme.shallow)(_react.default.createElement(_FileUpload.default, {
26
- id: "file-upload",
27
- label: "label",
28
- title: "title",
29
- infoText: "infoText",
30
- uploadTitle: "uploadTitle",
31
- uploadMicroText: "uploadMicroText",
32
- uploadSubText: "uploadSubText",
33
- files: {},
34
- onFilesSelected: onFilesSelected,
35
- onFileDeleted: onFileDeleted,
36
- onFilesDropped: onFilesDropped
37
- }));
38
- });
39
- it('should have a button and input', function () {
40
- expect(component.find('.ffe-file-upload__upload-button').exists()).toBe(true);
41
- expect(component.find('#file-upload').exists()).toBe(true);
42
- });
43
- it('should render input label', function () {
44
- expect(component.find('.ffe-file-upload__upload-button').text()).toBe('label');
45
- });
46
- it('should add label as aria-label', function () {
47
- expect(component.find('#file-upload-label').text()).toBe('label');
48
- });
49
- it('should extract and return files when user finishes selecting files', function () {
50
- component.find('#file-upload').simulate('change', {
51
- target: {
52
- files: {
53
- filename: {
54
- name: 'filename'
55
- }
56
- }
57
- }
58
- });
59
- expect(onFilesSelected.calledOnce).toBe(true);
60
- });
61
- });
62
- });