@entur/fileupload 0.3.56 → 0.3.58

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/CHANGELOG.md ADDED
@@ -0,0 +1,276 @@
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
+ ## [0.3.58](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.57...@entur/fileupload@0.3.58) (2023-01-19)
7
+
8
+ **Note:** Version bump only for package @entur/fileupload
9
+
10
+ ## [0.3.57](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.54...@entur/fileupload@0.3.57) (2022-12-09)
11
+
12
+ **Note:** Version bump only for package @entur/fileupload
13
+
14
+ ## [0.3.56](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.55...@entur/fileupload@0.3.56) (2022-11-24)
15
+
16
+ **Note:** Version bump only for package @entur/fileupload
17
+
18
+ ## [0.3.55](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.54...@entur/fileupload@0.3.55) (2022-10-31)
19
+
20
+ **Note:** Version bump only for package @entur/fileupload
21
+
22
+ ## [0.3.54](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.53...@entur/fileupload@0.3.54) (2022-10-31)
23
+
24
+ ### Bug Fixes
25
+
26
+ - **file upload:** set onDelete type to be optional as it actually is ([1248b59](https://bitbucket.org/enturas/design-system/commits/1248b597c795459c484d788c077d9c3a58f0a1a2))
27
+
28
+ ## [0.3.53](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.52...@entur/fileupload@0.3.53) (2022-10-31)
29
+
30
+ **Note:** Version bump only for package @entur/fileupload
31
+
32
+ ## [0.3.52](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.51...@entur/fileupload@0.3.52) (2022-10-31)
33
+
34
+ **Note:** Version bump only for package @entur/fileupload
35
+
36
+ ## [0.3.51](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.50...@entur/fileupload@0.3.51) (2022-10-20)
37
+
38
+ **Note:** Version bump only for package @entur/fileupload
39
+
40
+ ## [0.3.50](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.49...@entur/fileupload@0.3.50) (2022-10-20)
41
+
42
+ **Note:** Version bump only for package @entur/fileupload
43
+
44
+ ## [0.3.49](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.48...@entur/fileupload@0.3.49) (2022-10-12)
45
+
46
+ **Note:** Version bump only for package @entur/fileupload
47
+
48
+ ## [0.3.47](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.46...@entur/fileupload@0.3.47) (2022-08-31)
49
+
50
+ **Note:** Version bump only for package @entur/fileupload
51
+
52
+ ## [0.3.46](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.45...@entur/fileupload@0.3.46) (2022-08-31)
53
+
54
+ ### Bug Fixes
55
+
56
+ - **file upload:** add descriptive screen reader text to remove file button ([42c37d1](https://bitbucket.org/enturas/design-system/commits/42c37d131e2db5f712b1ce7cf3336b6d536cadd2))
57
+
58
+ ## [0.3.45](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.44...@entur/fileupload@0.3.45) (2022-08-24)
59
+
60
+ **Note:** Version bump only for package @entur/fileupload
61
+
62
+ ## [0.3.44](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.43...@entur/fileupload@0.3.44) (2022-08-09)
63
+
64
+ **Note:** Version bump only for package @entur/fileupload
65
+
66
+ ## [0.3.43](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.42...@entur/fileupload@0.3.43) (2022-07-05)
67
+
68
+ **Note:** Version bump only for package @entur/fileupload
69
+
70
+ ## [0.3.42](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.41...@entur/fileupload@0.3.42) (2022-06-28)
71
+
72
+ **Note:** Version bump only for package @entur/fileupload
73
+
74
+ ## [0.3.41](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.40...@entur/fileupload@0.3.41) (2022-06-24)
75
+
76
+ **Note:** Version bump only for package @entur/fileupload
77
+
78
+ ## [0.3.40](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.39...@entur/fileupload@0.3.40) (2022-06-02)
79
+
80
+ **Note:** Version bump only for package @entur/fileupload
81
+
82
+ ## [0.3.39](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.38...@entur/fileupload@0.3.39) (2022-05-13)
83
+
84
+ **Note:** Version bump only for package @entur/fileupload
85
+
86
+ ## [0.3.38](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.37...@entur/fileupload@0.3.38) (2022-05-04)
87
+
88
+ **Note:** Version bump only for package @entur/fileupload
89
+
90
+ ## [0.3.37](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.36...@entur/fileupload@0.3.37) (2022-04-27)
91
+
92
+ **Note:** Version bump only for package @entur/fileupload
93
+
94
+ ## [0.3.36](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.35...@entur/fileupload@0.3.36) (2022-04-20)
95
+
96
+ **Note:** Version bump only for package @entur/fileupload
97
+
98
+ ## [0.3.35](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.34...@entur/fileupload@0.3.35) (2022-04-19)
99
+
100
+ **Note:** Version bump only for package @entur/fileupload
101
+
102
+ ## [0.3.34](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.33...@entur/fileupload@0.3.34) (2022-03-01)
103
+
104
+ **Note:** Version bump only for package @entur/fileupload
105
+
106
+ ## [0.3.33](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.32...@entur/fileupload@0.3.33) (2022-02-09)
107
+
108
+ **Note:** Version bump only for package @entur/fileupload
109
+
110
+ ## [0.3.32](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.31...@entur/fileupload@0.3.32) (2021-11-17)
111
+
112
+ **Note:** Version bump only for package @entur/fileupload
113
+
114
+ ## [0.3.31](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.30...@entur/fileupload@0.3.31) (2021-09-23)
115
+
116
+ **Note:** Version bump only for package @entur/fileupload
117
+
118
+ ## [0.3.30](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.29...@entur/fileupload@0.3.30) (2021-09-13)
119
+
120
+ **Note:** Version bump only for package @entur/fileupload
121
+
122
+ ## [0.3.29](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.28...@entur/fileupload@0.3.29) (2021-09-07)
123
+
124
+ ### Bug Fixes
125
+
126
+ - fix lint warning ([6d8d06e](https://bitbucket.org/enturas/design-system/commits/6d8d06e7f2a088d2e857d41d52aa08f4ab50a49f))
127
+ - update dependencies ([d99dbde](https://bitbucket.org/enturas/design-system/commits/d99dbde566107589902f7f19bde3286a7195a600))
128
+ - utilize reworked focus token ([586758f](https://bitbucket.org/enturas/design-system/commits/586758fc86eb5aa52116c63c14ef033eb2e8b12f))
129
+
130
+ ## [0.3.28](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.27...@entur/fileupload@0.3.28) (2021-08-13)
131
+
132
+ **Note:** Version bump only for package @entur/fileupload
133
+
134
+ ## [0.3.27](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.26...@entur/fileupload@0.3.27) (2021-07-16)
135
+
136
+ **Note:** Version bump only for package @entur/fileupload
137
+
138
+ ## [0.3.26](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.25...@entur/fileupload@0.3.26) (2021-06-25)
139
+
140
+ ### Bug Fixes
141
+
142
+ - update dependencies ([30a33f7](https://bitbucket.org/enturas/design-system/commits/30a33f773e488c64c4cec2d1d07a9d617412f46a))
143
+
144
+ ## [0.3.25](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.24...@entur/fileupload@0.3.25) (2021-05-05)
145
+
146
+ **Note:** Version bump only for package @entur/fileupload
147
+
148
+ ## [0.3.24](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.23...@entur/fileupload@0.3.24) (2021-04-23)
149
+
150
+ ### Bug Fixes
151
+
152
+ - utilize new focus tokens ([17113ef](https://bitbucket.org/enturas/design-system/commits/17113ef3f791c86fa6e19e71680fd5acdbae4990))
153
+
154
+ ## [0.3.23](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.22...@entur/fileupload@0.3.23) (2021-04-09)
155
+
156
+ **Note:** Version bump only for package @entur/fileupload
157
+
158
+ ## [0.3.22](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.21...@entur/fileupload@0.3.22) (2021-03-02)
159
+
160
+ **Note:** Version bump only for package @entur/fileupload
161
+
162
+ ## [0.3.21](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.20...@entur/fileupload@0.3.21) (2021-02-17)
163
+
164
+ **Note:** Version bump only for package @entur/fileupload
165
+
166
+ ## [0.3.20](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.19...@entur/fileupload@0.3.20) (2021-01-29)
167
+
168
+ **Note:** Version bump only for package @entur/fileupload
169
+
170
+ ## [0.3.19](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.18...@entur/fileupload@0.3.19) (2021-01-20)
171
+
172
+ **Note:** Version bump only for package @entur/fileupload
173
+
174
+ ## [0.3.18](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.17...@entur/fileupload@0.3.18) (2021-01-13)
175
+
176
+ ### Bug Fixes
177
+
178
+ - transpose grey colors for updated color tokens ([d6a444c](https://bitbucket.org/enturas/design-system/commits/d6a444c2c37339b9bac0702738ed52693367d344))
179
+
180
+ ## [0.3.17](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.16...@entur/fileupload@0.3.17) (2021-01-05)
181
+
182
+ **Note:** Version bump only for package @entur/fileupload
183
+
184
+ ## [0.3.16](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.15...@entur/fileupload@0.3.16) (2020-12-04)
185
+
186
+ **Note:** Version bump only for package @entur/fileupload
187
+
188
+ ## [0.3.15](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.14...@entur/fileupload@0.3.15) (2020-11-10)
189
+
190
+ ### Bug Fixes
191
+
192
+ - **fileupload:** improve typing for onDrop prop ([29005c0](https://bitbucket.org/enturas/design-system/commits/29005c0a37dd2ad2c539072a0b22741ab98b6a3c))
193
+
194
+ ## [0.3.14](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.13...@entur/fileupload@0.3.14) (2020-11-05)
195
+
196
+ **Note:** Version bump only for package @entur/fileupload
197
+
198
+ ## [0.3.13](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.12...@entur/fileupload@0.3.13) (2020-10-28)
199
+
200
+ **Note:** Version bump only for package @entur/fileupload
201
+
202
+ ## [0.3.12](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.11...@entur/fileupload@0.3.12) (2020-10-23)
203
+
204
+ **Note:** Version bump only for package @entur/fileupload
205
+
206
+ ## [0.3.11](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.10...@entur/fileupload@0.3.11) (2020-10-16)
207
+
208
+ **Note:** Version bump only for package @entur/fileupload
209
+
210
+ ## [0.3.10](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.9...@entur/fileupload@0.3.10) (2020-10-09)
211
+
212
+ ### Bug Fixes
213
+
214
+ - **fileupload:** adjust size to accomadate new input fields ([640ab33](https://bitbucket.org/enturas/design-system/commits/640ab33d45b11a325d03e2328eb1b1752a9d47d2))
215
+
216
+ ## [0.3.9](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.8...@entur/fileupload@0.3.9) (2020-09-25)
217
+
218
+ **Note:** Version bump only for package @entur/fileupload
219
+
220
+ ## [0.3.8](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.7...@entur/fileupload@0.3.8) (2020-09-14)
221
+
222
+ **Note:** Version bump only for package @entur/fileupload
223
+
224
+ ## [0.3.7](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.6...@entur/fileupload@0.3.7) (2020-09-02)
225
+
226
+ **Note:** Version bump only for package @entur/fileupload
227
+
228
+ ## [0.3.6](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.5...@entur/fileupload@0.3.6) (2020-08-26)
229
+
230
+ **Note:** Version bump only for package @entur/fileupload
231
+
232
+ ## [0.3.5](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.4...@entur/fileupload@0.3.5) (2020-08-19)
233
+
234
+ **Note:** Version bump only for package @entur/fileupload
235
+
236
+ ## [0.3.4](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.3...@entur/fileupload@0.3.4) (2020-08-11)
237
+
238
+ **Note:** Version bump only for package @entur/fileupload
239
+
240
+ ## [0.3.3](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.2...@entur/fileupload@0.3.3) (2020-07-22)
241
+
242
+ **Note:** Version bump only for package @entur/fileupload
243
+
244
+ ## [0.3.2](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.1...@entur/fileupload@0.3.2) (2020-07-16)
245
+
246
+ **Note:** Version bump only for package @entur/fileupload
247
+
248
+ ## [0.3.1](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.3.0...@entur/fileupload@0.3.1) (2020-07-09)
249
+
250
+ ### Bug Fixes
251
+
252
+ - fix styling bugs for fileupload ([c194c71](https://bitbucket.org/enturas/design-system/commits/c194c71b55cc1e6511959f063928dfbec1c00b47))
253
+
254
+ # [0.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.2.3...@entur/fileupload@0.3.0) (2020-07-03)
255
+
256
+ ### Features
257
+
258
+ - add label prop to fileupload component ([ec235b5](https://bitbucket.org/enturas/design-system/commits/ec235b5b4babc7571a809102528f829df01c526d))
259
+
260
+ ## [0.2.3](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.2.2...@entur/fileupload@0.2.3) (2020-06-17)
261
+
262
+ **Note:** Version bump only for package @entur/fileupload
263
+
264
+ ## [0.2.2](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.2.1...@entur/fileupload@0.2.2) (2020-05-27)
265
+
266
+ **Note:** Version bump only for package @entur/fileupload
267
+
268
+ ## [0.2.1](https://bitbucket.org/enturas/design-system/compare/@entur/fileupload@0.2.0...@entur/fileupload@0.2.1) (2020-05-26)
269
+
270
+ **Note:** Version bump only for package @entur/fileupload
271
+
272
+ # 0.2.0 (2020-05-20)
273
+
274
+ ### Features
275
+
276
+ - add fileuploading component ([06f408d](https://bitbucket.org/enturas/design-system/commits/06f408d575fb2ed03aedfdac5df5d329b3d5895d))
@@ -20,61 +20,69 @@ function _extends() {
20
20
  _extends = Object.assign || function (target) {
21
21
  for (var i = 1; i < arguments.length; i++) {
22
22
  var source = arguments[i];
23
+
23
24
  for (var key in source) {
24
25
  if (Object.prototype.hasOwnProperty.call(source, key)) {
25
26
  target[key] = source[key];
26
27
  }
27
28
  }
28
29
  }
30
+
29
31
  return target;
30
32
  };
33
+
31
34
  return _extends.apply(this, arguments);
32
35
  }
36
+
33
37
  function _objectWithoutPropertiesLoose(source, excluded) {
34
38
  if (source == null) return {};
35
39
  var target = {};
36
40
  var sourceKeys = Object.keys(source);
37
41
  var key, i;
42
+
38
43
  for (i = 0; i < sourceKeys.length; i++) {
39
44
  key = sourceKeys[i];
40
45
  if (excluded.indexOf(key) >= 0) continue;
41
46
  target[key] = source[key];
42
47
  }
48
+
43
49
  return target;
44
50
  }
45
51
 
46
52
  var _excluded = ["standbyText", "errorText", "successText", "errorUpload", "onDrop", "onDelete", "accept", "files", "label", "removeFileButtonDescription", "style"];
47
53
  var FileUpload = function FileUpload(_ref) {
48
54
  var _ref$standbyText = _ref.standbyText,
49
- standbyText = _ref$standbyText === void 0 ? 'Dra fil eller klikk for å laste opp' : _ref$standbyText,
50
- _ref$errorText = _ref.errorText,
51
- errorText = _ref$errorText === void 0 ? 'Feil ved opplasting av fil' : _ref$errorText,
52
- _ref$successText = _ref.successText,
53
- successText = _ref$successText === void 0 ? 'Opplasting fullført' : _ref$successText,
54
- _ref$errorUpload = _ref.errorUpload,
55
- errorUpload = _ref$errorUpload === void 0 ? false : _ref$errorUpload,
56
- onDrop = _ref.onDrop,
57
- _ref$onDelete = _ref.onDelete,
58
- onDelete = _ref$onDelete === void 0 ? function (file) {
59
- return console.log(file);
60
- } : _ref$onDelete,
61
- _ref$accept = _ref.accept,
62
- accept = _ref$accept === void 0 ? '' : _ref$accept,
63
- _ref$files = _ref.files,
64
- files = _ref$files === void 0 ? [] : _ref$files,
65
- label = _ref.label,
66
- _ref$removeFileButton = _ref.removeFileButtonDescription,
67
- removeFileButtonDescription = _ref$removeFileButton === void 0 ? 'Fjern fil' : _ref$removeFileButton,
68
- style = _ref.style,
69
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
55
+ standbyText = _ref$standbyText === void 0 ? 'Dra fil eller klikk for å laste opp' : _ref$standbyText,
56
+ _ref$errorText = _ref.errorText,
57
+ errorText = _ref$errorText === void 0 ? 'Feil ved opplasting av fil' : _ref$errorText,
58
+ _ref$successText = _ref.successText,
59
+ successText = _ref$successText === void 0 ? 'Opplasting fullført' : _ref$successText,
60
+ _ref$errorUpload = _ref.errorUpload,
61
+ errorUpload = _ref$errorUpload === void 0 ? false : _ref$errorUpload,
62
+ onDrop = _ref.onDrop,
63
+ _ref$onDelete = _ref.onDelete,
64
+ onDelete = _ref$onDelete === void 0 ? function (file) {
65
+ return console.log(file);
66
+ } : _ref$onDelete,
67
+ _ref$accept = _ref.accept,
68
+ accept = _ref$accept === void 0 ? '' : _ref$accept,
69
+ _ref$files = _ref.files,
70
+ files = _ref$files === void 0 ? [] : _ref$files,
71
+ label = _ref.label,
72
+ _ref$removeFileButton = _ref.removeFileButtonDescription,
73
+ removeFileButtonDescription = _ref$removeFileButton === void 0 ? 'Fjern fil' : _ref$removeFileButton,
74
+ style = _ref.style,
75
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
76
+
70
77
  var _useDropzone = reactDropzone.useDropzone(_extends({
71
- onDrop: onDrop,
72
- accept: accept
73
- }, rest)),
74
- getRootProps = _useDropzone.getRootProps,
75
- getInputProps = _useDropzone.getInputProps,
76
- isDragActive = _useDropzone.isDragActive,
77
- isDragReject = _useDropzone.isDragReject;
78
+ onDrop: onDrop,
79
+ accept: accept
80
+ }, rest)),
81
+ getRootProps = _useDropzone.getRootProps,
82
+ getInputProps = _useDropzone.getInputProps,
83
+ isDragActive = _useDropzone.isDragActive,
84
+ isDragReject = _useDropzone.isDragReject;
85
+
78
86
  var success = files.length > 0;
79
87
  return React__default["default"].createElement("div", _extends({
80
88
  className: "eds-file-upload__wrapper"
@@ -111,6 +119,7 @@ var FileUpload = function FileUpload(_ref) {
111
119
  }, React__default["default"].createElement(a11y.VisuallyHidden, null, removeFileButtonDescription, ", ", file.name), React__default["default"].createElement(icons.DeleteIcon, null)));
112
120
  })));
113
121
  };
122
+
114
123
  function convertSizeToHuman(size) {
115
124
  if (size < 1000) {
116
125
  return size + 'bytes;';
@@ -1 +1 @@
1
- {"version":3,"file":"fileupload.cjs.development.js","sources":["../src/FileUpload.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n"],"names":["FileUpload","standbyText","errorText","successText","errorUpload","onDrop","onDelete","file","console","log","accept","files","label","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","convertSizeToHuman","size","IconButton","onClick","VisuallyHidden","name","DeleteIcon","toPrecision","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DaA,UAAU,GAA8B,SAAxCA,UAAU;8BACrBC,WAAW;IAAXA,WAAW,iCAAG,qCAAqC;IAAA,sBACnDC,SAAS;IAATA,SAAS,+BAAG,4BAA4B;IAAA,wBACxCC,WAAW;IAAXA,WAAW,iCAAG,qBAAqB;IAAA,wBACnCC,WAAW;IAAXA,WAAW,iCAAG,KAAK;IACnBC,MAAM,QAANA,MAAM;IAAA,qBACNC,QAAQ;IAARA,QAAQ,8BAAG,UAAAC,IAAI;MAAA,OAAIC,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;;IAAA,mBACpCG,MAAM;IAANA,MAAM,4BAAG,EAAE;IAAA,kBACXC,KAAK;IAALA,KAAK,2BAAG,EAAE;IACVC,KAAK,QAALA,KAAK;IAAA,6BACLC,2BAA2B;IAA3BA,2BAA2B,sCAAG,WAAW;IACzCC,KAAK,QAALA,KAAK;IACFC,IAAI;EAEP,mBACEC,yBAAW;MACTX,MAAM,EAANA,MAAM;MACNK,MAAM,EAAEA;OACLK,IAAI,EACP;IALIE,YAAY,gBAAZA,YAAY;IAAEC,aAAa,gBAAbA,aAAa;IAAEC,YAAY,gBAAZA,YAAY;IAAEC,YAAY,gBAAZA,YAAY;EAO/D,IAAMC,OAAO,GAAGV,KAAK,CAACW,MAAM,GAAG,CAAC;EAEhC,OACEC;IAAKC,SAAS,EAAC;KAA+BV,KAAK,GACjDS;IAAKC,SAAS,EAAC;KAA6BP,YAAY,EAAE,GACvDL,KAAK,IAAIW,wCAACE,gBAAK;IAACX,KAAK,EAAE;MAAEY,OAAO,EAAE;;KAAWd,KAAK,CAAS,EAC5DW,8DAAWL,aAAa,EAAE,EAAI,EAC9BK;IACEC,SAAS,EAAEG,8BAAU,CACnB,2BAA2B,EAC3B;MACE,oCAAoC,EAAEN;KACvC,EACD;MAAE,mCAAmC,EAAEF;KAAc,EACrD;MAAE,mCAAmC,EAAEC;KAAc,EACrD;MAAE,kCAAkC,EAAEhB;KAAa;KAGpDiB,OAAO,GAAGlB,WAAW,GAAGC,WAAW,GAAGF,SAAS,GAAGD,WAAW,CACzD,CACH,EACNsB;IAAKC,SAAS,EAAC;KACZb,KAAK,CAACiB,GAAG,CAAC,UAACrB,IAAkB,EAAEsB,KAAK;IAAA,OACnCN;MAAKC,SAAS,EAAC,4BAA4B;MAACM,GAAG,EAAED;OAC/CN,wCAACQ,cAAQ;MAACP,SAAS,EAAC;MAAoC,EACxDD;MAAMC,SAAS,EAAC;OACbjB,IAAI,CAACyB,IAAI,SAAKC,kBAAkB,CAAC1B,IAAI,CAAC2B,IAAI,CAAC,EAAE,GAAG,CAC5C,EACPX,wCAACY,iBAAU;MAACC,OAAO,EAAE;QAAA,OAAM9B,QAAQ,CAACC,IAAI,CAAC;;OACvCgB,wCAACc,mBAAc,QACZxB,2BAA2B,QAAIN,IAAI,CAAC+B,IAAI,CAC1B,EACjBf,wCAACgB,gBAAU,OAAG,CACH,CACT;GACP,CAAC,CACE,CACF;AAEV;AAEA,SAASN,kBAAkB,CAACC,IAAY;EACtC,IAAIA,IAAI,GAAG,IAAI,EAAE;IACf,OAAOA,IAAI,GAAG,QAAQ;GACvB,MAAM,IAAIA,IAAI,GAAG,OAAO,EAAE;IACzB,OAAUA,IAAI,GAAG,IAAI;GACtB,MAAM;IACL,OAAU,CAACA,IAAI,GAAG,OAAO,EAAEM,WAAW,CAAC,CAAC,CAAC;;AAE7C;;AChIAC,4BAAsB,CAAC,YAAY,CAAC;;;;"}
1
+ {"version":3,"file":"fileupload.cjs.development.js","sources":["../src/FileUpload.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n"],"names":["FileUpload","standbyText","errorText","successText","errorUpload","onDrop","onDelete","file","console","log","accept","files","label","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","convertSizeToHuman","size","IconButton","onClick","VisuallyHidden","name","DeleteIcon","toPrecision","warnAboutMissingStyles"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"fileupload.cjs.production.min.js","sources":["../src/index.tsx","../src/FileUpload.tsx"],"sourcesContent":["import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n","import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n"],"names":["warnAboutMissingStyles","standbyText","_ref$errorText","errorText","_ref$successText","successText","_ref$errorUpload","errorUpload","onDrop","_ref$onDelete","onDelete","file","console","log","_ref$accept","accept","_ref$files","files","label","_ref$removeFileButton","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","size","toPrecision","IconButton","onClick","VisuallyHidden","name","DeleteIcon"],"mappings":"itBAGAA,yBAAuB,iCC0D8B,oBACnDC,YAAAA,aAAc,wCAAqCC,IACnDC,UAAAA,aAAY,+BAA4BC,IACxCC,YAAAA,aAAc,wBAAqBC,IACnCC,YAAAA,gBACAC,IAAAA,OAAMC,IACNC,SAAAA,aAAW,SAAAC,GAAI,OAAIC,QAAQC,IAAIF,MAAKG,IACpCC,OAAAA,aAAS,KAAEC,IACXC,MAAAA,aAAQ,KACRC,IAAAA,MAAKC,IACLC,4BAAAA,aAA8B,cAC9BC,IAAAA,MACGC,4IAGDC,iBACEf,OAAAA,EACAO,OAAQA,GACLO,IAJCE,IAAAA,aAAcC,IAAAA,cAAeC,IAAAA,aAAcC,IAAAA,aAO7CC,EAAUX,EAAMY,OAAS,EAE/B,OACEC,iCAAKC,UAAU,4BAA+BV,GAC5CS,iCAAKC,UAAU,0BAA6BP,KACzCN,GAASY,wBAACE,SAAMX,MAAO,CAAEY,QAAS,SAAWf,GAC9CY,qCAAWL,MACXK,gCACEC,UAAWG,UACT,4BACA,CACE,qCAAsCN,GAExC,CAAE,oCAAqCF,GACvC,CAAE,oCAAqCC,GACvC,CAAE,mCAAoCpB,KAGvCqB,EAAUvB,EAAcE,EAAcJ,EAAYF,IAGvD6B,+BAAKC,UAAU,8BACZd,EAAMkB,KAAI,SAACxB,EAAoByB,GAAK,OACnCN,+BAAKC,UAAU,6BAA6BM,IAAKD,GAC/CN,wBAACQ,YAASP,UAAU,oCACpBD,gCAAMC,UAAU,oCACbpB,EAAK4B,YAeQC,EAfoB7B,EAAK6B,MAgBxC,IACFA,EAAO,SACLA,EAAO,IACNA,EAAO,YAENA,EAAO,KAASC,YAAY,SArBiB,KAEhDX,wBAACY,cAAWC,QAAS,WAAA,OAAMjC,EAASC,KAClCmB,wBAACc,sBACExB,OAA+BT,EAAKkC,MAEvCf,wBAACgB,qBASf,IAA4BN"}
1
+ {"version":3,"file":"fileupload.cjs.production.min.js","sources":["../src/index.tsx","../src/FileUpload.tsx"],"sourcesContent":["import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n","import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n"],"names":["warnAboutMissingStyles","standbyText","errorText","successText","errorUpload","onDrop","onDelete","file","console","log","accept","files","label","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","size","toPrecision","IconButton","onClick","VisuallyHidden","name","DeleteIcon"],"mappings":"itBAGAA,yBAAuB,iCC0D8B,oBACnDC,YAAAA,aAAc,4CACdC,UAAAA,aAAY,mCACZC,YAAAA,aAAc,4BACdC,YAAAA,gBACAC,IAAAA,WACAC,SAAAA,aAAW,SAAAC,UAAQC,QAAQC,IAAIF,UAC/BG,OAAAA,aAAS,SACTC,MAAAA,aAAQ,KACRC,IAAAA,UACAC,4BAAAA,aAA8B,cAC9BC,IAAAA,MACGC,4IAGDC,iBACEX,OAAAA,EACAK,OAAQA,GACLK,IAJCE,IAAAA,aAAcC,IAAAA,cAAeC,IAAAA,aAAcC,IAAAA,aAO7CC,EAAUV,EAAMW,OAAS,SAG7BC,iCAAKC,UAAU,4BAA+BV,GAC5CS,iCAAKC,UAAU,0BAA6BP,KACzCL,GAASW,wBAACE,SAAMX,MAAO,CAAEY,QAAS,SAAWd,GAC9CW,qCAAWL,MACXK,gCACEC,UAAWG,UACT,4BACA,sCACwCN,GAExC,qCAAuCF,GACvC,qCAAuCC,GACvC,oCAAsChB,KAGvCiB,EAAUlB,EAAcC,EAAcF,EAAYD,IAGvDsB,+BAAKC,UAAU,8BACZb,EAAMiB,KAAI,SAACrB,EAAoBsB,UAC9BN,+BAAKC,UAAU,6BAA6BM,IAAKD,GAC/CN,wBAACQ,YAASP,UAAU,oCACpBD,gCAAMC,UAAU,oCACbjB,EAAKyB,YAeQC,EAfoB1B,EAAK0B,MAgBxC,IACFA,EAAO,SACLA,EAAO,IACNA,EAAO,YAENA,EAAO,KAASC,YAAY,SArBiB,KAEhDX,wBAACY,cAAWC,QAAS,kBAAM9B,EAASC,KAClCgB,wBAACc,sBACExB,OAA+BN,EAAK+B,MAEvCf,wBAACgB,qBASf,IAA4BN"}
@@ -11,61 +11,69 @@ function _extends() {
11
11
  _extends = Object.assign || function (target) {
12
12
  for (var i = 1; i < arguments.length; i++) {
13
13
  var source = arguments[i];
14
+
14
15
  for (var key in source) {
15
16
  if (Object.prototype.hasOwnProperty.call(source, key)) {
16
17
  target[key] = source[key];
17
18
  }
18
19
  }
19
20
  }
21
+
20
22
  return target;
21
23
  };
24
+
22
25
  return _extends.apply(this, arguments);
23
26
  }
27
+
24
28
  function _objectWithoutPropertiesLoose(source, excluded) {
25
29
  if (source == null) return {};
26
30
  var target = {};
27
31
  var sourceKeys = Object.keys(source);
28
32
  var key, i;
33
+
29
34
  for (i = 0; i < sourceKeys.length; i++) {
30
35
  key = sourceKeys[i];
31
36
  if (excluded.indexOf(key) >= 0) continue;
32
37
  target[key] = source[key];
33
38
  }
39
+
34
40
  return target;
35
41
  }
36
42
 
37
43
  var _excluded = ["standbyText", "errorText", "successText", "errorUpload", "onDrop", "onDelete", "accept", "files", "label", "removeFileButtonDescription", "style"];
38
44
  var FileUpload = function FileUpload(_ref) {
39
45
  var _ref$standbyText = _ref.standbyText,
40
- standbyText = _ref$standbyText === void 0 ? 'Dra fil eller klikk for å laste opp' : _ref$standbyText,
41
- _ref$errorText = _ref.errorText,
42
- errorText = _ref$errorText === void 0 ? 'Feil ved opplasting av fil' : _ref$errorText,
43
- _ref$successText = _ref.successText,
44
- successText = _ref$successText === void 0 ? 'Opplasting fullført' : _ref$successText,
45
- _ref$errorUpload = _ref.errorUpload,
46
- errorUpload = _ref$errorUpload === void 0 ? false : _ref$errorUpload,
47
- onDrop = _ref.onDrop,
48
- _ref$onDelete = _ref.onDelete,
49
- onDelete = _ref$onDelete === void 0 ? function (file) {
50
- return console.log(file);
51
- } : _ref$onDelete,
52
- _ref$accept = _ref.accept,
53
- accept = _ref$accept === void 0 ? '' : _ref$accept,
54
- _ref$files = _ref.files,
55
- files = _ref$files === void 0 ? [] : _ref$files,
56
- label = _ref.label,
57
- _ref$removeFileButton = _ref.removeFileButtonDescription,
58
- removeFileButtonDescription = _ref$removeFileButton === void 0 ? 'Fjern fil' : _ref$removeFileButton,
59
- style = _ref.style,
60
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
46
+ standbyText = _ref$standbyText === void 0 ? 'Dra fil eller klikk for å laste opp' : _ref$standbyText,
47
+ _ref$errorText = _ref.errorText,
48
+ errorText = _ref$errorText === void 0 ? 'Feil ved opplasting av fil' : _ref$errorText,
49
+ _ref$successText = _ref.successText,
50
+ successText = _ref$successText === void 0 ? 'Opplasting fullført' : _ref$successText,
51
+ _ref$errorUpload = _ref.errorUpload,
52
+ errorUpload = _ref$errorUpload === void 0 ? false : _ref$errorUpload,
53
+ onDrop = _ref.onDrop,
54
+ _ref$onDelete = _ref.onDelete,
55
+ onDelete = _ref$onDelete === void 0 ? function (file) {
56
+ return console.log(file);
57
+ } : _ref$onDelete,
58
+ _ref$accept = _ref.accept,
59
+ accept = _ref$accept === void 0 ? '' : _ref$accept,
60
+ _ref$files = _ref.files,
61
+ files = _ref$files === void 0 ? [] : _ref$files,
62
+ label = _ref.label,
63
+ _ref$removeFileButton = _ref.removeFileButtonDescription,
64
+ removeFileButtonDescription = _ref$removeFileButton === void 0 ? 'Fjern fil' : _ref$removeFileButton,
65
+ style = _ref.style,
66
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
67
+
61
68
  var _useDropzone = useDropzone(_extends({
62
- onDrop: onDrop,
63
- accept: accept
64
- }, rest)),
65
- getRootProps = _useDropzone.getRootProps,
66
- getInputProps = _useDropzone.getInputProps,
67
- isDragActive = _useDropzone.isDragActive,
68
- isDragReject = _useDropzone.isDragReject;
69
+ onDrop: onDrop,
70
+ accept: accept
71
+ }, rest)),
72
+ getRootProps = _useDropzone.getRootProps,
73
+ getInputProps = _useDropzone.getInputProps,
74
+ isDragActive = _useDropzone.isDragActive,
75
+ isDragReject = _useDropzone.isDragReject;
76
+
69
77
  var success = files.length > 0;
70
78
  return React.createElement("div", _extends({
71
79
  className: "eds-file-upload__wrapper"
@@ -102,6 +110,7 @@ var FileUpload = function FileUpload(_ref) {
102
110
  }, React.createElement(VisuallyHidden, null, removeFileButtonDescription, ", ", file.name), React.createElement(DeleteIcon, null)));
103
111
  })));
104
112
  };
113
+
105
114
  function convertSizeToHuman(size) {
106
115
  if (size < 1000) {
107
116
  return size + 'bytes;';
@@ -1 +1 @@
1
- {"version":3,"file":"fileupload.esm.js","sources":["../src/FileUpload.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n"],"names":["FileUpload","standbyText","errorText","successText","errorUpload","onDrop","onDelete","file","console","log","accept","files","label","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","convertSizeToHuman","size","IconButton","onClick","VisuallyHidden","name","DeleteIcon","toPrecision","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DaA,UAAU,GAA8B,SAAxCA,UAAU;8BACrBC,WAAW;IAAXA,WAAW,iCAAG,qCAAqC;IAAA,sBACnDC,SAAS;IAATA,SAAS,+BAAG,4BAA4B;IAAA,wBACxCC,WAAW;IAAXA,WAAW,iCAAG,qBAAqB;IAAA,wBACnCC,WAAW;IAAXA,WAAW,iCAAG,KAAK;IACnBC,MAAM,QAANA,MAAM;IAAA,qBACNC,QAAQ;IAARA,QAAQ,8BAAG,UAAAC,IAAI;MAAA,OAAIC,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;;IAAA,mBACpCG,MAAM;IAANA,MAAM,4BAAG,EAAE;IAAA,kBACXC,KAAK;IAALA,KAAK,2BAAG,EAAE;IACVC,KAAK,QAALA,KAAK;IAAA,6BACLC,2BAA2B;IAA3BA,2BAA2B,sCAAG,WAAW;IACzCC,KAAK,QAALA,KAAK;IACFC,IAAI;EAEP,mBACEC,WAAW;MACTX,MAAM,EAANA,MAAM;MACNK,MAAM,EAAEA;OACLK,IAAI,EACP;IALIE,YAAY,gBAAZA,YAAY;IAAEC,aAAa,gBAAbA,aAAa;IAAEC,YAAY,gBAAZA,YAAY;IAAEC,YAAY,gBAAZA,YAAY;EAO/D,IAAMC,OAAO,GAAGV,KAAK,CAACW,MAAM,GAAG,CAAC;EAEhC,OACEC;IAAKC,SAAS,EAAC;KAA+BV,KAAK,GACjDS;IAAKC,SAAS,EAAC;KAA6BP,YAAY,EAAE,GACvDL,KAAK,IAAIW,oBAACE,KAAK;IAACX,KAAK,EAAE;MAAEY,OAAO,EAAE;;KAAWd,KAAK,CAAS,EAC5DW,0CAAWL,aAAa,EAAE,EAAI,EAC9BK;IACEC,SAAS,EAAEG,UAAU,CACnB,2BAA2B,EAC3B;MACE,oCAAoC,EAAEN;KACvC,EACD;MAAE,mCAAmC,EAAEF;KAAc,EACrD;MAAE,mCAAmC,EAAEC;KAAc,EACrD;MAAE,kCAAkC,EAAEhB;KAAa;KAGpDiB,OAAO,GAAGlB,WAAW,GAAGC,WAAW,GAAGF,SAAS,GAAGD,WAAW,CACzD,CACH,EACNsB;IAAKC,SAAS,EAAC;KACZb,KAAK,CAACiB,GAAG,CAAC,UAACrB,IAAkB,EAAEsB,KAAK;IAAA,OACnCN;MAAKC,SAAS,EAAC,4BAA4B;MAACM,GAAG,EAAED;OAC/CN,oBAACQ,QAAQ;MAACP,SAAS,EAAC;MAAoC,EACxDD;MAAMC,SAAS,EAAC;OACbjB,IAAI,CAACyB,IAAI,SAAKC,kBAAkB,CAAC1B,IAAI,CAAC2B,IAAI,CAAC,EAAE,GAAG,CAC5C,EACPX,oBAACY,UAAU;MAACC,OAAO,EAAE;QAAA,OAAM9B,QAAQ,CAACC,IAAI,CAAC;;OACvCgB,oBAACc,cAAc,QACZxB,2BAA2B,QAAIN,IAAI,CAAC+B,IAAI,CAC1B,EACjBf,oBAACgB,UAAU,OAAG,CACH,CACT;GACP,CAAC,CACE,CACF;AAEV;AAEA,SAASN,kBAAkB,CAACC,IAAY;EACtC,IAAIA,IAAI,GAAG,IAAI,EAAE;IACf,OAAOA,IAAI,GAAG,QAAQ;GACvB,MAAM,IAAIA,IAAI,GAAG,OAAO,EAAE;IACzB,OAAUA,IAAI,GAAG,IAAI;GACtB,MAAM;IACL,OAAU,CAACA,IAAI,GAAG,OAAO,EAAEM,WAAW,CAAC,CAAC,CAAC;;AAE7C;;AChIAC,sBAAsB,CAAC,YAAY,CAAC;;;;"}
1
+ {"version":3,"file":"fileupload.esm.js","sources":["../src/FileUpload.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n useDropzone,\n DropzoneOptions,\n FileRejection,\n DropEvent,\n FileWithPath,\n} from 'react-dropzone';\nimport classNames from 'classnames';\n\nimport { FileIcon, DeleteIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Label } from '@entur/typography';\nimport { VisuallyHidden } from '@entur/a11y';\n\nimport './FileUpload.scss';\n\ntype FileUploadProps = DropzoneOptions & {\n /** Tekst som vises ved fullført opplasting\n * @default \"Opplasting fullført\"\n */\n successText?: string;\n /** Tekst som vises om opplasting feilet\n * @default \"Feil ved opplasting av fil\"\n */\n errorText?: string;\n /** Tekst som vises før man laster opp noe\n * @default \"Dra fil eller klikk for å laste opp\"\n */\n standbyText?: string;\n /** Boolean for hvis opplastingen feiler.\n * @default false\n */\n errorUpload?: boolean;\n /** Callback for når en fil legges til */\n onDrop?<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ): void;\n /** Callback for når en fil slettes fra lista */\n onDelete?: (file: FileWithPath) => void;\n /** Hvilken filtyper som skal aksepteres */\n accept?: string | string[];\n /** Filene som er aktive i komponenten */\n files: File[];\n /** Beskrivende tekst som forklarer feltet */\n label?: string;\n /** Mulighet for å laste opp flere filer */\n multiple?: boolean;\n /**Minste filstørrelse */\n minSize?: number;\n /**Største filstørrelse */\n maxSize?: number;\n /**Tekst som leses opp av skjermleser på søppelbøtte-ikonet\n * @default \"Fjern fil\"\n */\n removeFileButtonDescription?: string;\n [key: string]: any;\n};\n\nexport const FileUpload: React.FC<FileUploadProps> = ({\n standbyText = 'Dra fil eller klikk for å laste opp',\n errorText = 'Feil ved opplasting av fil',\n successText = 'Opplasting fullført',\n errorUpload = false,\n onDrop,\n onDelete = file => console.log(file),\n accept = '',\n files = [],\n label,\n removeFileButtonDescription = 'Fjern fil',\n style,\n ...rest\n}) => {\n const { getRootProps, getInputProps, isDragActive, isDragReject } =\n useDropzone({\n onDrop,\n accept: accept,\n ...rest,\n });\n\n const success = files.length > 0;\n\n return (\n <div className=\"eds-file-upload__wrapper\" {...style}>\n <div className=\"eds-file-upload__input\" {...getRootProps()}>\n {label && <Label style={{ display: 'flex' }}>{label}</Label>}\n <input {...getInputProps()} />\n <span\n className={classNames(\n 'eds-file-upload__dropzone',\n {\n 'eds-file-upload__dropzone--success': success,\n },\n { 'eds-file-upload__dropzone--active': isDragActive },\n { 'eds-file-upload__dropzone--reject': isDragReject },\n { 'eds-file-upload__dropzone--error': errorUpload },\n )}\n >\n {success ? successText : errorUpload ? errorText : standbyText}\n </span>\n </div>\n <div className=\"eds-file-upload__file-list\">\n {files.map((file: FileWithPath, index) => (\n <div className=\"eds-file-upload__file-name\" key={index}>\n <FileIcon className=\"eds-file-upload__file-name-icon\" />\n <span className=\"eds-field-upload__file-name-path\">\n {file.path} - {convertSizeToHuman(file.size)}{' '}\n </span>\n <IconButton onClick={() => onDelete(file)}>\n <VisuallyHidden>\n {removeFileButtonDescription}, {file.name}\n </VisuallyHidden>\n <DeleteIcon />\n </IconButton>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nfunction convertSizeToHuman(size: number) {\n if (size < 1000) {\n return size + 'bytes;';\n } else if (size < 1000000) {\n return `${size / 1000} KB`;\n } else {\n return `${(size / 1000000).toPrecision(4)} MB`;\n }\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('fileupload');\n\nexport * from './FileUpload';\n"],"names":["FileUpload","standbyText","errorText","successText","errorUpload","onDrop","onDelete","file","console","log","accept","files","label","removeFileButtonDescription","style","rest","useDropzone","getRootProps","getInputProps","isDragActive","isDragReject","success","length","React","className","Label","display","classNames","map","index","key","FileIcon","path","convertSizeToHuman","size","IconButton","onClick","VisuallyHidden","name","DeleteIcon","toPrecision","warnAboutMissingStyles"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/fileupload",
3
- "version": "0.3.56",
3
+ "version": "0.3.58",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/fileupload.esm.js",
@@ -17,18 +17,18 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
- "start": "yarn run dts watch --noClean",
21
- "build": "yarn run dts build",
22
- "test": "yarn run dts test --env=jsdom",
23
- "lint": "yarn run dts lint"
20
+ "start": "dts watch --noClean",
21
+ "build": "dts build",
22
+ "test": "dts test",
23
+ "lint": "dts lint"
24
24
  },
25
25
  "dependencies": {
26
- "@entur/a11y": "^0.2.51",
27
- "@entur/button": "^2.10.6",
28
- "@entur/icons": "^5.3.0",
29
- "@entur/tokens": "^3.4.2",
30
- "@entur/typography": "^1.7.2",
31
- "@entur/utils": "^0.4.7",
26
+ "@entur/a11y": "^0.2.53",
27
+ "@entur/button": "^2.10.8",
28
+ "@entur/icons": "^5.4.1",
29
+ "@entur/tokens": "^3.4.4",
30
+ "@entur/typography": "^1.7.4",
31
+ "@entur/utils": "^0.4.9",
32
32
  "classnames": "^2.3.1",
33
33
  "react-dropzone": "^11.3.4"
34
34
  },
@@ -36,12 +36,5 @@
36
36
  "react": ">=16.8.0",
37
37
  "react-dom": ">=16.8.0"
38
38
  },
39
- "devDependencies": {
40
- "dts-cli": "^1.1.6",
41
- "jest": "^27.0.0",
42
- "jest-watch-typeahead": "^2.2.0",
43
- "ts-jest": "^27.0.0",
44
- "typescript": "^4.8.0"
45
- },
46
- "gitHead": "8915b1630bd936740ba9a4a88883f3432948a80e"
39
+ "gitHead": "de71e205560a699e2dce301e133966dc9348c459"
47
40
  }