@xaypay/tui 0.0.70 → 0.0.72

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.
Files changed (71) hide show
  1. package/dist/index.es.js +1009 -121
  2. package/dist/index.js +1009 -120
  3. package/package.json +3 -2
  4. package/src/components/autocomplate/autocomplate.stories.js +1 -1
  5. package/src/components/captcha/captcha.module.css +3 -3
  6. package/src/components/captcha/index.js +10 -7
  7. package/src/components/file/index.js +2 -3
  8. package/src/components/icon/Arrow.js +2 -2
  9. package/src/components/icon/CheckboxChecked.js +2 -2
  10. package/src/components/icon/CheckboxUnchecked.js +2 -2
  11. package/src/components/icon/CloseIcon.js +2 -2
  12. package/src/components/icon/DeleteComponent.js +20 -0
  13. package/src/components/icon/Dots.js +6 -6
  14. package/src/components/icon/ListItemDelete.js +19 -0
  15. package/src/components/icon/ListItemJpeg.js +21 -0
  16. package/src/components/icon/ListItemJpg.js +21 -0
  17. package/src/components/icon/ListItemPdf.js +21 -0
  18. package/src/components/icon/ListItemPng.js +21 -0
  19. package/src/components/icon/Nextarrow.js +19 -0
  20. package/src/components/icon/RangeArrowDefault.js +54 -0
  21. package/src/components/icon/RangeArrowError.js +54 -0
  22. package/src/components/icon/RangeArrowSuccess.js +54 -0
  23. package/src/components/icon/RemoveFile.js +20 -0
  24. package/src/components/icon/ToasterClose.js +2 -2
  25. package/src/components/icon/ToasterError.js +2 -2
  26. package/src/components/icon/ToasterInfo.js +2 -2
  27. package/src/components/icon/ToasterSuccess.js +2 -2
  28. package/src/components/icon/ToasterWarning.js +2 -2
  29. package/src/components/icon/Tooltip.js +2 -2
  30. package/src/components/icon/Upload.js +25 -0
  31. package/src/components/icon/index.js +2 -15
  32. package/src/components/input/index.js +49 -37
  33. package/src/components/input/input.stories.js +11 -5
  34. package/src/components/newAutocomplete/NewAutocomplete.stories.js +26 -26
  35. package/src/components/newAutocomplete/index.js +113 -92
  36. package/src/components/newFile/fileItem.js +213 -0
  37. package/src/components/newFile/index.js +488 -0
  38. package/src/components/newFile/newFile.stories.js +44 -0
  39. package/src/components/pagination/index.js +5 -5
  40. package/src/components/textarea/index.js +93 -28
  41. package/src/components/textarea/textarea.stories.js +3 -3
  42. package/src/components/toaster/Toast.js +1 -1
  43. package/src/components/tooltip/index.js +2 -2
  44. package/src/index.js +1 -0
  45. package/src/stories/configuration.stories.mdx +43 -0
  46. package/src/stories/static/autocomplete-usage.png +0 -0
  47. package/src/stories/static/file-single-usage.png +0 -0
  48. package/src/stories/static/file-usage.png +0 -0
  49. package/src/stories/static/input-usage.png +0 -0
  50. package/src/stories/static/tooltip-usage.png +0 -0
  51. package/src/stories/usage.stories.mdx +17 -8
  52. package/tui.config.js +41 -0
  53. package/src/assets/icons/arrow.svg +0 -3
  54. package/src/assets/icons/checkbox-checked.svg +0 -3
  55. package/src/assets/icons/checkbox-unchecked.svg +0 -3
  56. package/src/assets/icons/close-icon.svg +0 -3
  57. package/src/assets/icons/dots.svg +0 -3
  58. package/src/assets/icons/nextarrow.svg +0 -3
  59. package/src/assets/icons/toaster-close.svg +0 -3
  60. package/src/assets/icons/toaster-error.svg +0 -3
  61. package/src/assets/icons/toaster-info.svg +0 -3
  62. package/src/assets/icons/toaster-success.svg +0 -3
  63. package/src/assets/icons/toaster-warning.svg +0 -3
  64. package/src/assets/icons/tooltip.svg +0 -3
  65. package/src/assets/upload.svg +0 -4
  66. package/src/components/icon/NextArrow.js +0 -19
  67. package/src/stories/static/input-tooltip-usage.png +0 -0
  68. package/src/stories/static/new-autocomplete-usage.png +0 -0
  69. /package/src/assets/{icons/range-arrow-default.svg → range-arrow-default.svg} +0 -0
  70. /package/src/assets/{icons/range-arrow-error.svg → range-arrow-error.svg} +0 -0
  71. /package/src/assets/{icons/range-arrow-success.svg → range-arrow-success.svg} +0 -0
@@ -0,0 +1,213 @@
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ import SvgListItemPdf from './../icon/ListItemPdf';
4
+ import SvgListItemJpg from './../icon/ListItemJpg';
5
+ import SvgListItemPng from './../icon/ListItemPng';
6
+ import SvgListItemJpeg from './../icon/ListItemJpeg';
7
+ import SvgListItemDelete from './../icon/ListItemDelete';
8
+
9
+ const FileItem = React.memo(({
10
+ size,
11
+ name,
12
+ uuid,
13
+ check,
14
+ radius,
15
+ status,
16
+ removeFile,
17
+ fileFormat,
18
+ progressColor,
19
+ listItemHeight,
20
+ listItemPadding,
21
+ progressFontSize,
22
+ listItemErrorSize,
23
+ listItemErrorColor,
24
+ progressTrackColor,
25
+ progressFailedColor,
26
+ progressSuccessColor,
27
+ progressLoadingColor,
28
+ listItemBackgroundColor,
29
+ listItemBackgroundErrorColor
30
+ }) => {
31
+ const [i, setI] = useState(_ => _);
32
+ const [t, setT] = useState(_ => _);
33
+ const [progress, setProgress] = useState(7);
34
+
35
+ const handleRemoveItem = (id) => {
36
+ removeFile(id);
37
+ };
38
+
39
+ useEffect(() => {
40
+ let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900;
41
+ let fileSizeInMB = Math.round(size / (1024 * 1024));
42
+ if (fileSizeInMB > 5) {
43
+ const times = [
44
+ Math.floor(Math.random() * (1700 - 1300 + 1)) + 1300,
45
+ Math.floor(Math.random() * (3200 - 2800 + 1)) + 2800,
46
+ Math.floor(Math.random() * (4700 - 4300 + 1)) + 4300,
47
+ Math.floor(Math.random() * (6200 - 5800 + 1)) + 5800,
48
+ Math.floor(Math.random() * (7700 - 7300 + 1)) + 7300
49
+ ];
50
+ const index = Math.min(Math.floor((size - 1) / 15), times.length - 1);
51
+ time = times[index];
52
+ }
53
+ setI(setInterval(() => {
54
+ setProgress(prev => {
55
+ return prev += 7;
56
+ });
57
+ }, time));
58
+ return () => {
59
+ setI(_ => _);
60
+ clearTimeout(t);
61
+ clearInterval(i);
62
+ };
63
+ }, []);
64
+
65
+ useEffect(() => {
66
+ if (progress > 84) {
67
+ clearInterval(i);
68
+ }
69
+ }, [progress]);
70
+
71
+ useEffect(() => {
72
+ if (status === 'success') {
73
+ setProgress(100);
74
+ clearInterval(i);
75
+ }
76
+
77
+ if (status === 'failed') {
78
+ setProgress(0);
79
+ clearInterval(i);
80
+ }
81
+ }, [status]);
82
+
83
+ useEffect(() => {
84
+ if (check !== '') {
85
+ setT(setTimeout(() => {
86
+ removeFile(uuid);
87
+ }, 3500));
88
+ }
89
+ }, [check]);
90
+
91
+ return (
92
+ <div
93
+ style={{
94
+ width: '100%',
95
+ display: 'flex',
96
+ marginTop: '6px',
97
+ alignItems: 'center',
98
+ borderRadius: radius,
99
+ height: listItemHeight,
100
+ boxSizing: 'border-box',
101
+ padding: listItemPadding,
102
+ flexDirection: check !== '' ? 'column' : 'row',
103
+ justifyContent: check !== '' ? 'space-around' : 'space-between',
104
+ backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor
105
+ }}
106
+ >
107
+ {
108
+ check !== ''
109
+ ? <>
110
+ <p style={{
111
+ margin: '0px',
112
+ color: listItemErrorColor,
113
+ fontSize: listItemErrorSize
114
+ }}>{ name }</p>
115
+ <p style={{
116
+ margin: '0px',
117
+ color: listItemErrorColor,
118
+ fontSize: listItemErrorSize
119
+ }}>{ check }</p>
120
+ </>
121
+ : <>
122
+ <div
123
+ style={{
124
+ width: '32px'
125
+ }}
126
+ >
127
+ {
128
+ fileFormat === 'pdf' ? <SvgListItemPdf /> :
129
+ fileFormat === 'jpg' ? <SvgListItemJpg /> :
130
+ fileFormat === 'png' ? <SvgListItemPng /> :
131
+ fileFormat === 'jpeg' ? <SvgListItemJpeg /> : ''
132
+ }
133
+ </div>
134
+
135
+
136
+ <div
137
+ style={{
138
+ position: 'relative',
139
+ display: 'flex',
140
+ height: '40px',
141
+ margin: '0px 14px',
142
+ alignItems: 'flex-end',
143
+ width: 'calc(100% - 82px)'
144
+ }}
145
+ >
146
+ <div
147
+ style={{
148
+ width: '100%',
149
+ height: '100%',
150
+ display: 'flex',
151
+ paddingTop: '5px',
152
+ color: progressColor,
153
+ boxSizing: 'border-box',
154
+ alignItems: 'flex-start',
155
+ fontSize: progressFontSize,
156
+ justifyContent: 'space-between'
157
+ }}
158
+ >
159
+ <p
160
+ style={{
161
+ margin: '0px',
162
+ overflow: 'hidden',
163
+ whiteSpace: 'nowrap',
164
+ textOverflow: 'ellipsis',
165
+ maxWidth: 'calc(100% - 56px)'
166
+ }}
167
+ >{name}</p>
168
+
169
+ <span>
170
+ {progress} %
171
+ </span>
172
+ </div>
173
+
174
+ <div
175
+ style={{
176
+ position: 'absolute',
177
+ left: '0px',
178
+ bottom: '5px',
179
+ width: '100%',
180
+ height: '4px',
181
+ borderRadius: '10px',
182
+ backgroundColor: progressTrackColor
183
+ }}
184
+ >
185
+ <div
186
+ style={{
187
+ height: '100%',
188
+ borderRadius: '10px',
189
+ width: status === 'failed' ? '100%' : progress + '%',
190
+ backgroundColor: status === 'success' ? progressSuccessColor : status === 'failed' ? progressFailedColor : progressLoadingColor
191
+ }}
192
+ ></div>
193
+ </div>
194
+
195
+ </div>
196
+
197
+
198
+ <div
199
+ style={{
200
+ width: '22px',
201
+ cursor: 'pointer'
202
+ }}
203
+ onClick={() => handleRemoveItem(uuid)}
204
+ >
205
+ <SvgListItemDelete />
206
+ </div>
207
+ </>
208
+ }
209
+ </div>
210
+ )
211
+ });
212
+
213
+ export default FileItem;
@@ -0,0 +1,488 @@
1
+ import React, { useRef, useState, useEffect, useMemo } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import PropTypes from 'prop-types';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+
6
+ import FileItem from './fileItem';
7
+
8
+ import { compereConfigs } from './../../utils';
9
+
10
+ import SvgPdf from './../icon/PDF';
11
+ import SvgUpload from './../icon/Upload';
12
+ import SvgRemoveFile from './../icon/RemoveFile';
13
+ import SvgDeleteComponent from './../icon/DeleteComponent';
14
+
15
+ export const NewFile = ({
16
+ or,
17
+ size,
18
+ name,
19
+ color,
20
+ label,
21
+ width,
22
+ weight,
23
+ height,
24
+ radius,
25
+ change,
26
+ border,
27
+ upload,
28
+ maxSize,
29
+ disabled,
30
+ multiple,
31
+ required,
32
+ errorSize,
33
+ labelSize,
34
+ removeFile,
35
+ labelColor,
36
+ errorColor,
37
+ filesArray,
38
+ putFileHere,
39
+ borderColor,
40
+ uploadColor,
41
+ defaultData,
42
+ errorMessage,
43
+ fileSizeText,
44
+ progressColor,
45
+ fileExtensions,
46
+ listItemHeight,
47
+ backgroundColor,
48
+ deleteComponent,
49
+ listItemPadding,
50
+ progressFontSize,
51
+ borderHoverColor,
52
+ listItemErrorSize,
53
+ progressTrackColor,
54
+ fileAreaImageWidth,
55
+ listItemErrorColor,
56
+ labelRequiredColor,
57
+ progressFailedColor,
58
+ fileAreaImageHeight,
59
+ progressSuccessColor,
60
+ progressLoadingColor,
61
+ hiddenBackgroundColor,
62
+ extentionsRowMarginTop,
63
+ listItemBackgroundColor,
64
+ listItemBackgroundErrorColor
65
+ }) => {
66
+ const ref = useRef(null);
67
+ const inpRef = useRef(null);
68
+ const memoizedItems = useMemo(() => filesArray, [filesArray]);
69
+
70
+ const [error, setError] = useState('');
71
+ const [isHover, setIsHover] = useState(false);
72
+ const [singleFile, setSingleFile] = useState(null);
73
+ const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
74
+
75
+ const configStyles = compereConfigs();
76
+
77
+ const handleRemoveComponent = () => {
78
+ const node = ReactDOM.findDOMNode(ref.current);
79
+ const parent = node.parentNode;
80
+ parent.removeChild(node);
81
+ };
82
+
83
+ const handleRemoveFile = () => {
84
+ setImage(null);
85
+ removeFile(singleFile);
86
+ };
87
+
88
+ const handleChange = (e) => {
89
+ const file = e.target.files;
90
+
91
+ if (multiple) {
92
+ setError('');
93
+ setImage(null);
94
+ for (let ix = 0; ix < file.length; ix++) {
95
+ if (file[ix]) {
96
+ if (file[ix].size <= maxSize * Math.pow(2, 20)) {
97
+ if (fileExtensions.includes(file[ix].type.split('/')[1])) {
98
+ change({
99
+ id: '',
100
+ check: '',
101
+ status: '',
102
+ file: file[ix],
103
+ uuid: uuidv4()
104
+ });
105
+ } else {
106
+ change({
107
+ file: file[ix],
108
+ uuid: uuidv4(),
109
+ check: 'ֆայլի սխալ ֆորմատ'
110
+ });
111
+ }
112
+ } else {
113
+ change({
114
+ file: file[ix],
115
+ uuid: uuidv4(),
116
+ check: 'առավելագույն ծավալ'
117
+ });
118
+ }
119
+ }
120
+ }
121
+ if (file.length === 0 && memoizedItems.length === 0) {
122
+ setError('Ֆայլը ընտրված չէ');
123
+ }
124
+ } else {
125
+ if (file[0]) {
126
+ if (file[0].size <= maxSize * Math.pow(2, 20)) {
127
+ if (fileExtensions.includes(file[0].type.split('/')[1])) {
128
+ setError('');
129
+ change(file);
130
+ setSingleFile(file);
131
+ if (file[0].type === 'application/pdf') {
132
+ setImage('pdf');
133
+ } else {
134
+ setImage(URL.createObjectURL(file[0]));
135
+ }
136
+ } else {
137
+ setImage(null);
138
+ setError('ֆայլի սխալ ֆորմատ');
139
+ }
140
+ } else {
141
+ setImage(null);
142
+ setError('առավելագույն ծավալ');
143
+ }
144
+ }
145
+ if (file.length === 0) {
146
+ setImage(null);
147
+ setError('Ֆայլը ընտրված չէ');
148
+ }
149
+ }
150
+ };
151
+
152
+ const handleClick = () => {
153
+ if (!image) {
154
+ inpRef.current.click();
155
+ }
156
+ };
157
+
158
+ const handleDrop = (e) => {
159
+ if (!disabled) {
160
+ e.preventDefault();
161
+ handleChange({target: { files: e.dataTransfer.files }});
162
+ }
163
+ };
164
+
165
+ const handleDragOver = (e) => {
166
+ if (!disabled) {
167
+ e.preventDefault();
168
+ }
169
+ };
170
+
171
+ const handleMouseEnter = () => {
172
+ setIsHover(true);
173
+ };
174
+
175
+ const handleMouseLeave = () => {
176
+ setIsHover(false);
177
+ };
178
+
179
+ const handleStopPropagation = (e) => {
180
+ e.stopPropagation();
181
+ };
182
+
183
+ useEffect(() => {
184
+ if (!multiple && defaultData) {
185
+ if (!defaultData.type) {
186
+ alert('Please add type in defaultData prop');
187
+ }
188
+
189
+ if (!defaultData.url) {
190
+ alert('Please add url in defaultData prop');
191
+ }
192
+ }
193
+
194
+ if (multiple && !filesArray) {
195
+ alert('In multiple mode, you should add filesArray prop for drawing files');
196
+ }
197
+
198
+ if (multiple) {
199
+ setSingleFile(null);
200
+ }
201
+ }, [multiple, filesArray && filesArray.length, defaultData]);
202
+
203
+ useEffect(() => {
204
+ if (errorMessage) {
205
+ setError(errorMessage);
206
+ } else {
207
+ setError('');
208
+ }
209
+ }, [errorMessage]);
210
+
211
+ useEffect(() => {
212
+ if (!change) {
213
+ alert('Please add change prop on File component');
214
+ }
215
+
216
+ if (!removeFile) {
217
+ alert('Please add removeFile prop on File component');
218
+ }
219
+ }, [change, removeFile]);
220
+
221
+ return (
222
+ <div
223
+ ref={ref}
224
+ style={{
225
+ width: width ? width : configStyles.File.width
226
+ }}
227
+ >
228
+ <div
229
+ style={{
230
+ display: 'flex',
231
+ marginBottom: '6px',
232
+ alignItems: 'center',
233
+ justifyContent: label ? 'space-between' : 'flex-end'
234
+ }}
235
+ >
236
+ {
237
+ label && <label
238
+ style={{
239
+ color: labelColor ? labelColor : configStyles.File.labelColor,
240
+ fontSize: labelSize ? labelSize : configStyles.File.labelSize,
241
+ }}
242
+ >
243
+ {label}
244
+ {required &&
245
+ <sup
246
+ style={{color: labelRequiredColor ? labelRequiredColor : configStyles.File.labelRequiredColor}}
247
+ >*</sup>
248
+ }
249
+ </label>
250
+ }
251
+ {
252
+ deleteComponent && <span style={{cursor: 'pointer'}} onClick={handleRemoveComponent}>
253
+ <SvgDeleteComponent />
254
+ </span>
255
+ }
256
+ </div>
257
+
258
+ <div
259
+ style={{
260
+ width: '100%',
261
+ display: 'flex',
262
+ alignItems: 'center',
263
+ position: 'relative',
264
+ boxSizing: 'border-box',
265
+ justifyContent: 'center',
266
+ cursor: !disabled ? 'pointer' : 'not-allowed',
267
+ height: height ? height : configStyles.File.height,
268
+ border: border ? border : configStyles.File.border,
269
+ borderRadius: radius ? radius : configStyles.File.radius ,
270
+ backgroundColor: backgroundColor ? backgroundColor : configStyles.File.backgroundColor,
271
+ borderColor:
272
+ error ?
273
+ errorColor ? errorColor : configStyles.File.errorColor :
274
+ disabled ? borderColor ? borderColor : configStyles.File.borderColor :
275
+ isHover ? borderHoverColor ? borderHoverColor : configStyles.File.borderHoverColor :
276
+ borderColor ? borderColor : configStyles.File.borderColor
277
+ }}
278
+ onDrop={handleDrop}
279
+ onClick={handleClick}
280
+ onDragOver={handleDragOver}
281
+ onMouseEnter={handleMouseEnter}
282
+ onMouseLeave={handleMouseLeave}
283
+ >
284
+ <input
285
+ hidden
286
+ name={name}
287
+ type='file'
288
+ ref={inpRef}
289
+ disabled={disabled}
290
+ multiple={multiple}
291
+ onChange={handleChange}
292
+ />
293
+
294
+ <div
295
+ style={{
296
+ width: '100%',
297
+ height: '100%',
298
+ display: 'flex',
299
+ textAlign: 'center',
300
+ alignItems: 'center',
301
+ flexDirection: 'column',
302
+ justifyContent: 'center',
303
+ color: color ? color : configStyles.File.color,
304
+ fontSize: size ? size : configStyles.File.size,
305
+ fontWeight: weight ? weight : configStyles.File.weight,
306
+ }}
307
+ >
308
+ {
309
+ !multiple && image ?
310
+ image === 'pdf' ?
311
+ <SvgPdf /> :
312
+ <img
313
+ src={image}
314
+ style={{
315
+ display: 'block',
316
+ maxWidth: '100%',
317
+ maxHeight: '95%',
318
+ objectFit: 'contain',
319
+ width: fileAreaImageWidth ? fileAreaImageWidth : configStyles.File.fileAreaImageWidth,
320
+ height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.File.fileAreaImageHeight,
321
+ }}
322
+ alt='file preview'
323
+ />
324
+ : <>
325
+ <div>
326
+ <SvgUpload />
327
+ </div>
328
+
329
+ <div>
330
+ <p
331
+ style={{
332
+ margin: '0px'
333
+ }}
334
+ >
335
+ {putFileHere ? putFileHere : configStyles.File.putFileHere}
336
+ <br />
337
+ {or ? or : configStyles.File.or} <span
338
+ style={{
339
+ color: uploadColor ? uploadColor : configStyles.File.uploadColor
340
+ }}
341
+ >{upload ? upload : configStyles.File.upload}</span>
342
+ </p>
343
+ </div>
344
+
345
+ <div
346
+ style={{
347
+ marginTop: extentionsRowMarginTop ? extentionsRowMarginTop : configStyles.File.extentionsRowMarginTop
348
+ }}
349
+ >
350
+ <p
351
+ style={{
352
+ margin: '0px'
353
+ }}
354
+ >
355
+ {fileSizeText ? fileSizeText : configStyles.File.fileSizeText} {maxSize}ՄԲ ( { fileExtensions.toString().split(',').join(', ') } )
356
+ </p>
357
+ </div>
358
+ </>
359
+ }
360
+ </div>
361
+
362
+ <div
363
+ style={{
364
+ position: 'absolute',
365
+ top: '0px',
366
+ left: '0px',
367
+ zIndex: '1',
368
+ width: '100%',
369
+ height: '100%',
370
+ padding: '10px',
371
+ cursor: 'default',
372
+ boxSizing: 'border-box',
373
+ alignItems: 'flex-start',
374
+ justifyContent: 'flex-end',
375
+ borderRadius: radius ? radius : configStyles.File.radius,
376
+ display: !multiple && !disabled && image && !error && isHover ? 'flex' : 'none',
377
+ backgroundColor: hiddenBackgroundColor ? hiddenBackgroundColor : configStyles.File.hiddenBackgroundColor
378
+ }}
379
+ onClick={handleStopPropagation}
380
+ >
381
+ <div
382
+ style={{
383
+ cursor: 'pointer'
384
+ }}
385
+ onClick={handleRemoveFile}
386
+ >
387
+ <SvgRemoveFile />
388
+ </div>
389
+ </div>
390
+ </div>
391
+
392
+ {
393
+ error ? <span
394
+ style={{
395
+ marginTop: '6px',
396
+ display: 'inline-block',
397
+ color: errorColor ? errorColor : configStyles.File.errorColor,
398
+ fontSize: errorSize ? errorSize : configStyles.File.errorSize
399
+ }}
400
+ >{ error }</span> : ''
401
+ }
402
+
403
+
404
+ {
405
+ multiple && memoizedItems && memoizedItems.length > 0 && memoizedItems.map(item => {
406
+ return <FileItem
407
+ key={item.uuid}
408
+ uuid={item.uuid}
409
+ check={item.check}
410
+ status={item.status}
411
+ size={item.file.size}
412
+ name={item.file.name}
413
+ removeFile={removeFile}
414
+ radius={radius ? radius : configStyles.File.radius}
415
+ fileFormat={item.file.type.split('/')[1].toLowerCase()}
416
+ progressColor={progressColor ? progressColor : configStyles.File.progressColor}
417
+ listItemHeight={listItemHeight ? listItemHeight : configStyles.File.listItemHeight}
418
+ listItemPadding={listItemPadding ? listItemPadding : configStyles.File.listItemPadding}
419
+ progressFontSize={progressFontSize ? progressFontSize : configStyles.File.progressFontSize}
420
+ listItemErrorSize={listItemErrorSize ? listItemErrorSize : configStyles.File.listItemErrorSize}
421
+ listItemErrorColor={listItemErrorColor ? listItemErrorColor : configStyles.File.listItemErrorColor}
422
+ progressTrackColor={progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor}
423
+ progressFailedColor={progressFailedColor ? progressFailedColor : configStyles.File.progressFailedColor}
424
+ progressSuccessColor={progressSuccessColor ? progressSuccessColor : configStyles.File.progressSuccessColor}
425
+ progressLoadingColor={progressLoadingColor ? progressLoadingColor : configStyles.File.progressLoadingColor}
426
+ listItemBackgroundColor={listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor}
427
+ listItemBackgroundErrorColor={listItemBackgroundErrorColor ? listItemBackgroundErrorColor : configStyles.File.listItemBackgroundErrorColor}
428
+ />
429
+ })
430
+ }
431
+ </div>
432
+ );
433
+ };
434
+
435
+ NewFile.propTypes = {
436
+ or: PropTypes.string,
437
+ size: PropTypes.string,
438
+ label: PropTypes.string,
439
+ width: PropTypes.string,
440
+ color: PropTypes.string,
441
+ height: PropTypes.string,
442
+ disabled: PropTypes.bool,
443
+ radius: PropTypes.string,
444
+ border: PropTypes.string,
445
+ required: PropTypes.bool,
446
+ upload: PropTypes.string,
447
+ weight: PropTypes.number,
448
+ maxSize: PropTypes.number,
449
+ errorSize: PropTypes.string,
450
+ labelSize: PropTypes.string,
451
+ labelColor: PropTypes.string,
452
+ errorColor: PropTypes.string,
453
+ putFileHere: PropTypes.string,
454
+ borderColor: PropTypes.string,
455
+ uploadColor: PropTypes.string,
456
+ defaultData: PropTypes.object,
457
+ errorMessage: PropTypes.string,
458
+ fileSizeText: PropTypes.string,
459
+ progressColor: PropTypes.string,
460
+ deleteComponent: PropTypes.bool,
461
+ listItemHeight: PropTypes.string,
462
+ backgroundColor: PropTypes.string,
463
+ change: PropTypes.func.isRequired,
464
+ listItemPadding: PropTypes.string,
465
+ progressFontSize: PropTypes.string,
466
+ borderHoverColor: PropTypes.string,
467
+ listItemErrorSize: PropTypes.string,
468
+ labelRequiredColor: PropTypes.string,
469
+ progressTrackColor: PropTypes.string,
470
+ fileAreaImageWidth: PropTypes.string,
471
+ listItemErrorColor: PropTypes.string,
472
+ removeFile: PropTypes.func.isRequired,
473
+ fileAreaImageHeight: PropTypes.string,
474
+ progressFailedColor: PropTypes.string,
475
+ progressSuccessColor: PropTypes.string,
476
+ progressLoadingColor: PropTypes.string,
477
+ hiddenBackgroundColor: PropTypes.string,
478
+ extentionsRowMarginTop: PropTypes.string,
479
+ listItemBackgroundColor: PropTypes.string,
480
+ listItemBackgroundErrorColor: PropTypes.string,
481
+ filesArray: PropTypes.arrayOf(PropTypes.object),
482
+ fileExtensions: PropTypes.arrayOf(PropTypes.string)
483
+ };
484
+
485
+ NewFile.defaultProps = {
486
+ maxSize: 50,
487
+ fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
488
+ };