@xaypay/tui 0.0.70 → 0.0.71
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/dist/index.es.js +685 -85
- package/dist/index.js +685 -84
- package/package.json +3 -2
- package/src/components/captcha/captcha.module.css +3 -3
- package/src/components/captcha/index.js +10 -7
- package/src/components/file/index.js +2 -3
- package/src/components/icon/Arrow.js +2 -2
- package/src/components/icon/CheckboxChecked.js +2 -2
- package/src/components/icon/CheckboxUnchecked.js +2 -2
- package/src/components/icon/CloseIcon.js +2 -2
- package/src/components/icon/DeleteComponent.js +20 -0
- package/src/components/icon/Dots.js +6 -6
- package/src/components/icon/ListItemDelete.js +19 -0
- package/src/components/icon/ListItemJpg.js +21 -0
- package/src/components/icon/ListItemPdf.js +21 -0
- package/src/components/icon/Nextarrow.js +19 -0
- package/src/components/icon/RangeArrowDefault.js +54 -0
- package/src/components/icon/RangeArrowError.js +54 -0
- package/src/components/icon/RangeArrowSuccess.js +54 -0
- package/src/components/icon/RemoveFile.js +20 -0
- package/src/components/icon/ToasterClose.js +2 -2
- package/src/components/icon/ToasterError.js +2 -2
- package/src/components/icon/ToasterInfo.js +2 -2
- package/src/components/icon/ToasterSuccess.js +2 -2
- package/src/components/icon/ToasterWarning.js +2 -2
- package/src/components/icon/Tooltip.js +2 -2
- package/src/components/icon/Upload.js +25 -0
- package/src/components/icon/index.js +1 -15
- package/src/components/input/index.js +36 -31
- package/src/components/newFile/index.js +463 -0
- package/src/components/newFile/newFile.stories.js +41 -0
- package/src/components/pagination/index.js +5 -5
- package/src/components/textarea/index.js +63 -27
- package/src/components/textarea/textarea.stories.js +3 -3
- package/src/components/toaster/Toast.js +1 -1
- package/src/components/tooltip/index.js +2 -2
- package/src/index.js +1 -0
- package/src/stories/configuration.stories.mdx +1 -0
- package/tui.config.js +23 -0
- package/src/assets/icons/arrow.svg +0 -3
- package/src/assets/icons/checkbox-checked.svg +0 -3
- package/src/assets/icons/checkbox-unchecked.svg +0 -3
- package/src/assets/icons/close-icon.svg +0 -3
- package/src/assets/icons/dots.svg +0 -3
- package/src/assets/icons/nextarrow.svg +0 -3
- package/src/assets/icons/toaster-close.svg +0 -3
- package/src/assets/icons/toaster-error.svg +0 -3
- package/src/assets/icons/toaster-info.svg +0 -3
- package/src/assets/icons/toaster-success.svg +0 -3
- package/src/assets/icons/toaster-warning.svg +0 -3
- package/src/assets/icons/tooltip.svg +0 -3
- package/src/assets/upload.svg +0 -4
- package/src/components/icon/NextArrow.js +0 -19
- /package/src/assets/{icons/range-arrow-default.svg → range-arrow-default.svg} +0 -0
- /package/src/assets/{icons/range-arrow-error.svg → range-arrow-error.svg} +0 -0
- /package/src/assets/{icons/range-arrow-success.svg → range-arrow-success.svg} +0 -0
|
@@ -64,7 +64,7 @@ export const Input = ({
|
|
|
64
64
|
errorAnimationDuration,
|
|
65
65
|
...props
|
|
66
66
|
}) => {
|
|
67
|
-
const phoneNumberRegex = /^\d
|
|
67
|
+
const phoneNumberRegex = /^\d+$/;
|
|
68
68
|
const [show, setShow] = useState(false);
|
|
69
69
|
const [isHover, setIsHover] = useState(false);
|
|
70
70
|
const [innerValue, setInnerValue] = useState('');
|
|
@@ -100,33 +100,36 @@ export const Input = ({
|
|
|
100
100
|
|
|
101
101
|
setInnerValue(currentValue);
|
|
102
102
|
if (type === 'tel') {
|
|
103
|
-
if (currentValue
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (!phoneNumberRegex.test(currentValue) && telErrorMessage) {
|
|
108
|
-
setInnerErrorMessage(telErrorMessage);
|
|
103
|
+
if (!phoneNumberRegex.test(currentValue)) {
|
|
104
|
+
telErrorMessage && setInnerErrorMessage(telErrorMessage);
|
|
105
|
+
setInnerValue('');
|
|
109
106
|
} else {
|
|
110
107
|
setInnerErrorMessage('');
|
|
108
|
+
if (currentValue.length > 8) {
|
|
109
|
+
setInnerValue(currentValue.substr(0, 8));
|
|
110
|
+
if (onChange) {
|
|
111
|
+
onChange(currentValue.substr(0, 8));
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
setInnerValue(currentValue);
|
|
115
|
+
if (onChange) {
|
|
116
|
+
onChange(currentValue);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
if (maxLength && currentValue.length > maxLength && type !== 'tel') {
|
|
115
123
|
setInnerValue(currentValue.substr(0, maxLength));
|
|
124
|
+
if (onChange) {
|
|
125
|
+
onChange(currentValue.substr(0, maxLength));
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
119
|
-
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('')
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (onChange) {
|
|
123
|
-
onChange(currentValue);
|
|
124
|
-
if (type === 'tel' && currentValue.length > 8) {
|
|
125
|
-
onChange(currentValue.substr(0, 8));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (maxLength && currentValue.length > maxLength && type !== 'tel') {
|
|
129
|
-
onChange(currentValue.substr(0, maxLength));
|
|
130
|
+
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
131
|
+
if (onChange) {
|
|
132
|
+
onChange(currentValue);
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
};
|
|
@@ -140,19 +143,27 @@ export const Input = ({
|
|
|
140
143
|
};
|
|
141
144
|
|
|
142
145
|
useEffect(() => {
|
|
146
|
+
if (errorMessage) {
|
|
147
|
+
setInnerErrorMessage(errorMessage);
|
|
148
|
+
} else {
|
|
149
|
+
setInnerErrorMessage('');
|
|
150
|
+
}
|
|
151
|
+
|
|
143
152
|
if (value !== undefined && value !== null) {
|
|
144
153
|
setInnerValue(value);
|
|
145
154
|
if (type === 'tel') {
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!phoneNumberRegex.test(value) && telErrorMessage) {
|
|
151
|
-
setInnerErrorMessage(telErrorMessage);
|
|
155
|
+
if (!phoneNumberRegex.test(currentValue)) {
|
|
156
|
+
telErrorMessage && setInnerErrorMessage(telErrorMessage);
|
|
157
|
+
setInnerValue('');
|
|
152
158
|
} else {
|
|
153
159
|
setInnerErrorMessage('');
|
|
160
|
+
if (value.length > 8) {
|
|
161
|
+
setInnerValue(value.substr(0, 8));
|
|
162
|
+
} else {
|
|
163
|
+
setInnerValue(value);
|
|
164
|
+
}
|
|
154
165
|
}
|
|
155
|
-
}
|
|
166
|
+
}
|
|
156
167
|
|
|
157
168
|
if (maxLength && value.length > maxLength && type !== 'tel') {
|
|
158
169
|
setInnerValue(value.substr(0, maxLength));
|
|
@@ -162,12 +173,6 @@ export const Input = ({
|
|
|
162
173
|
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('')
|
|
163
174
|
}
|
|
164
175
|
}
|
|
165
|
-
|
|
166
|
-
if (errorMessage) {
|
|
167
|
-
setInnerErrorMessage(errorMessage);
|
|
168
|
-
} else {
|
|
169
|
-
setInnerErrorMessage('');
|
|
170
|
-
}
|
|
171
176
|
}, [type, value, regexp, maxLength, errorMessage, regexpErrorMessage]);
|
|
172
177
|
|
|
173
178
|
return (
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
|
|
6
|
+
import { compereConfigs } from './../../utils';
|
|
7
|
+
|
|
8
|
+
import SvgUpload from './../icon/Upload';
|
|
9
|
+
import SvgRemoveFile from './../icon/RemoveFile';
|
|
10
|
+
import SvgListItemPdf from './../icon/ListItemPdf';
|
|
11
|
+
import SvgListItemJpg from './../icon/ListItemJpg';
|
|
12
|
+
import SvgListItemDelete from './../icon/ListItemDelete';
|
|
13
|
+
import SvgDeleteComponent from './../icon/DeleteComponent';
|
|
14
|
+
|
|
15
|
+
export const NewFile = ({
|
|
16
|
+
size,
|
|
17
|
+
name,
|
|
18
|
+
color,
|
|
19
|
+
label,
|
|
20
|
+
width,
|
|
21
|
+
weight,
|
|
22
|
+
height,
|
|
23
|
+
radius,
|
|
24
|
+
change,
|
|
25
|
+
border,
|
|
26
|
+
maxSize,
|
|
27
|
+
disabled,
|
|
28
|
+
multiple,
|
|
29
|
+
required,
|
|
30
|
+
errorSize,
|
|
31
|
+
labelSize,
|
|
32
|
+
labelColor,
|
|
33
|
+
errorColor,
|
|
34
|
+
filesArray,
|
|
35
|
+
borderColor,
|
|
36
|
+
uploadColor,
|
|
37
|
+
defaultData,
|
|
38
|
+
errorMessage,
|
|
39
|
+
fileExtensions,
|
|
40
|
+
backgroundColor,
|
|
41
|
+
deleteComponent,
|
|
42
|
+
borderHoverColor,
|
|
43
|
+
progressTrackColor,
|
|
44
|
+
labelRequiredColor,
|
|
45
|
+
hiddenBackgroundColor,
|
|
46
|
+
extentionsRowMarginTop,
|
|
47
|
+
listItemBackgroundColor
|
|
48
|
+
}) => {
|
|
49
|
+
const ref = useRef(null);
|
|
50
|
+
const inpRef = useRef(null);
|
|
51
|
+
const [error, setError] = useState('');
|
|
52
|
+
const [image, setImage] = useState('');
|
|
53
|
+
const [progress, setProgress] = useState(5);
|
|
54
|
+
const [isHover, setIsHover] = useState(false);
|
|
55
|
+
const [multipleFiles, setMultipleFiles] = useState([]);
|
|
56
|
+
|
|
57
|
+
const configStyles = compereConfigs();
|
|
58
|
+
|
|
59
|
+
const handleRemoveComponent = () => {
|
|
60
|
+
const node = ReactDOM.findDOMNode(ref.current);
|
|
61
|
+
const parent = node.parentNode;
|
|
62
|
+
parent.removeChild(node);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleRemoveFile = () => {
|
|
66
|
+
if (!multiple) {
|
|
67
|
+
setImage('');
|
|
68
|
+
onChange(null);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleChange = (e) => {
|
|
73
|
+
const file = e.target.files;
|
|
74
|
+
|
|
75
|
+
if (file[0]) {
|
|
76
|
+
if (file[0].size <= maxSize * Math.pow(2, 20)) {
|
|
77
|
+
if (fileExtensions.includes(file[0].type.split('/')[1])) {
|
|
78
|
+
setError('');
|
|
79
|
+
if (multiple) {
|
|
80
|
+
change({
|
|
81
|
+
uuid: uuidv4(),
|
|
82
|
+
file: file[0]
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
change({file});
|
|
86
|
+
if (file[0].type === 'application/pdf') {
|
|
87
|
+
setImage('pdf');
|
|
88
|
+
} else {
|
|
89
|
+
setImage(URL.createObjectURL(file[0]));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
setImage('')
|
|
94
|
+
setError('ֆայլի սխալ ֆորմատ');
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
setImage('')
|
|
98
|
+
setError('առավելագույն ծավալ');
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
// TODO:
|
|
102
|
+
if (!multiple || multiple && filesArray && filesArray.length === 0) {
|
|
103
|
+
setImage('');
|
|
104
|
+
setError('Ֆայլը ընտրված չէ');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const handleClick = () => {
|
|
110
|
+
if (!image) {
|
|
111
|
+
inpRef.current.click();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const handleMouseEnter = () => {
|
|
116
|
+
setIsHover(true);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleMouseLeave = () => {
|
|
120
|
+
setIsHover(false);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const handleStopPropagation = (e) => {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (!multiple && defaultData) {
|
|
129
|
+
if (defaultData.type && defaultData.type !== 'application/pdf') {
|
|
130
|
+
setImage(defaultData.url);
|
|
131
|
+
} else {
|
|
132
|
+
setImage('pdf');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (multiple && !filesArray) {
|
|
137
|
+
alert('In multiple mode, you should add filesArray prop for drawing files');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (filesArray) {
|
|
141
|
+
setMultipleFiles(filesArray);
|
|
142
|
+
}
|
|
143
|
+
}, [multiple, filesArray && filesArray.length, defaultData]);
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (errorMessage) {
|
|
147
|
+
setError(errorMessage);
|
|
148
|
+
} else {
|
|
149
|
+
setError('');
|
|
150
|
+
}
|
|
151
|
+
}, [errorMessage]);
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (!change) {
|
|
155
|
+
alert('Please add change prop on File component');
|
|
156
|
+
}
|
|
157
|
+
}, [change]);
|
|
158
|
+
|
|
159
|
+
console.log(multipleFiles, 'multipleFiles');
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
ref={ref}
|
|
164
|
+
style={{
|
|
165
|
+
width: width ? width : configStyles.File.width,
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<div
|
|
169
|
+
style={{
|
|
170
|
+
display: 'flex',
|
|
171
|
+
marginBottom: '6px',
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
justifyContent: label ? 'space-between' : 'flex-end'
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
{
|
|
177
|
+
label && <label
|
|
178
|
+
style={{
|
|
179
|
+
color: labelColor ? labelColor : configStyles.File.labelColor,
|
|
180
|
+
fontSize: labelSize ? labelSize : configStyles.File.labelSize,
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{label}
|
|
184
|
+
{required &&
|
|
185
|
+
<sup
|
|
186
|
+
style={{color: labelRequiredColor ? labelRequiredColor : configStyles.File.labelRequiredColor}}
|
|
187
|
+
>*</sup>
|
|
188
|
+
}
|
|
189
|
+
</label>
|
|
190
|
+
}
|
|
191
|
+
{
|
|
192
|
+
deleteComponent && <span style={{cursor: 'pointer'}} onClick={handleRemoveComponent}>
|
|
193
|
+
<SvgDeleteComponent />
|
|
194
|
+
</span>
|
|
195
|
+
}
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
<div
|
|
200
|
+
style={{
|
|
201
|
+
width: '100%',
|
|
202
|
+
display: 'flex',
|
|
203
|
+
alignItems: 'center',
|
|
204
|
+
position: 'relative',
|
|
205
|
+
boxSizing: 'border-box',
|
|
206
|
+
justifyContent: 'center',
|
|
207
|
+
cursor: !disabled ? 'pointer' : 'not-allowed',
|
|
208
|
+
height: height ? height : configStyles.File.height,
|
|
209
|
+
border: border ? border : configStyles.File.border,
|
|
210
|
+
borderRadius: radius ? radius : configStyles.File.radius ,
|
|
211
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.File.backgroundColor,
|
|
212
|
+
borderColor:
|
|
213
|
+
error ?
|
|
214
|
+
errorColor ? errorColor : configStyles.File.errorColor :
|
|
215
|
+
disabled ? borderColor ? borderColor : configStyles.File.borderColor :
|
|
216
|
+
isHover ? borderHoverColor ? borderHoverColor : configStyles.File.borderHoverColor :
|
|
217
|
+
borderColor ? borderColor : configStyles.File.borderColor
|
|
218
|
+
}}
|
|
219
|
+
onClick={handleClick}
|
|
220
|
+
onMouseEnter={handleMouseEnter}
|
|
221
|
+
onMouseLeave={handleMouseLeave}
|
|
222
|
+
>
|
|
223
|
+
<input
|
|
224
|
+
hidden
|
|
225
|
+
name={name}
|
|
226
|
+
type='file'
|
|
227
|
+
ref={inpRef}
|
|
228
|
+
disabled={disabled}
|
|
229
|
+
onChange={handleChange}
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
<div
|
|
233
|
+
style={{
|
|
234
|
+
width: '100%',
|
|
235
|
+
height: '100%',
|
|
236
|
+
display: 'flex',
|
|
237
|
+
textAlign: 'center',
|
|
238
|
+
alignItems: 'center',
|
|
239
|
+
flexDirection: 'column',
|
|
240
|
+
justifyContent: 'center',
|
|
241
|
+
color: color ? color : configStyles.File.color,
|
|
242
|
+
fontSize: size ? size : configStyles.File.size,
|
|
243
|
+
fontWeight: weight ? weight : configStyles.File.weight,
|
|
244
|
+
}}
|
|
245
|
+
>
|
|
246
|
+
{
|
|
247
|
+
!multiple && image ?
|
|
248
|
+
image === 'pdf' ?
|
|
249
|
+
<PDF /> :
|
|
250
|
+
<img
|
|
251
|
+
src={image}
|
|
252
|
+
style={{
|
|
253
|
+
maxHeight: '100%',
|
|
254
|
+
}}
|
|
255
|
+
alt='file preview'
|
|
256
|
+
/>
|
|
257
|
+
: <>
|
|
258
|
+
<div>
|
|
259
|
+
<SvgUpload />
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div>
|
|
263
|
+
<p
|
|
264
|
+
style={{
|
|
265
|
+
margin: '0px'
|
|
266
|
+
}}
|
|
267
|
+
>
|
|
268
|
+
Տեղադրել ֆայլը այստեղ
|
|
269
|
+
<br />
|
|
270
|
+
կամ <span
|
|
271
|
+
style={{
|
|
272
|
+
color: uploadColor ? uploadColor : configStyles.File.uploadColor
|
|
273
|
+
}}
|
|
274
|
+
>Բեռնել</span>
|
|
275
|
+
</p>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<div
|
|
279
|
+
style={{
|
|
280
|
+
marginTop: extentionsRowMarginTop ? extentionsRowMarginTop : configStyles.File.extentionsRowMarginTop
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
<p
|
|
284
|
+
style={{
|
|
285
|
+
margin: '0px'
|
|
286
|
+
}}
|
|
287
|
+
>
|
|
288
|
+
Առավելագույնը {maxSize}ՄԲ ( { fileExtensions.toString().split(',').join(', ') } )
|
|
289
|
+
</p>
|
|
290
|
+
</div>
|
|
291
|
+
</>
|
|
292
|
+
}
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
<div
|
|
298
|
+
style={{
|
|
299
|
+
position: 'absolute',
|
|
300
|
+
top: '0px',
|
|
301
|
+
left: '0px',
|
|
302
|
+
zIndex: '1',
|
|
303
|
+
width: '100%',
|
|
304
|
+
height: '100%',
|
|
305
|
+
padding: '10px',
|
|
306
|
+
cursor: 'default',
|
|
307
|
+
boxSizing: 'border-box',
|
|
308
|
+
alignItems: 'flex-start',
|
|
309
|
+
justifyContent: 'flex-end',
|
|
310
|
+
borderRadius: radius ? radius : configStyles.File.radius,
|
|
311
|
+
display: !multiple && !disabled && image && !error && isHover ? 'flex' : 'none',
|
|
312
|
+
backgroundColor: hiddenBackgroundColor ? hiddenBackgroundColor : configStyles.File.hiddenBackgroundColor
|
|
313
|
+
}}
|
|
314
|
+
onClick={handleStopPropagation}
|
|
315
|
+
>
|
|
316
|
+
<div
|
|
317
|
+
style={{
|
|
318
|
+
cursor: 'pointer'
|
|
319
|
+
}}
|
|
320
|
+
onClick={handleRemoveFile}
|
|
321
|
+
>
|
|
322
|
+
<SvgRemoveFile />
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
{
|
|
328
|
+
error ? <span
|
|
329
|
+
style={{
|
|
330
|
+
marginTop: '6px',
|
|
331
|
+
display: 'inline-block',
|
|
332
|
+
color: errorColor ? errorColor : configStyles.File.errorColor,
|
|
333
|
+
fontSize: errorSize ? errorSize : configStyles.File.errorSize
|
|
334
|
+
}}
|
|
335
|
+
>{ error }</span> : ''
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
{
|
|
340
|
+
multiple && multipleFiles && multipleFiles.length > 0 && multipleFiles.map((item, index) => {
|
|
341
|
+
return (
|
|
342
|
+
<div
|
|
343
|
+
key={`${item.file.name}_${index}`}
|
|
344
|
+
style={{
|
|
345
|
+
display: 'flex',
|
|
346
|
+
width: '100%',
|
|
347
|
+
height: '70px',
|
|
348
|
+
marginTop: '6px',
|
|
349
|
+
alignItems: 'center',
|
|
350
|
+
padding: '14px 20px',
|
|
351
|
+
boxSizing: 'border-box',
|
|
352
|
+
justifyContent: 'space-between',
|
|
353
|
+
borderRadius: radius ? radius : configStyles.File.radius,
|
|
354
|
+
backgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor
|
|
355
|
+
}}
|
|
356
|
+
>
|
|
357
|
+
<div
|
|
358
|
+
style={{
|
|
359
|
+
width: '32px'
|
|
360
|
+
}}
|
|
361
|
+
>
|
|
362
|
+
{
|
|
363
|
+
item.file.type.split('/')[1].toLowerCase() === 'pdf' ? <SvgListItemPdf /> :
|
|
364
|
+
item.file.type.split('/')[1].toLowerCase() === 'jpeg' ? <SvgListItemJpg /> : ''
|
|
365
|
+
}
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<div
|
|
370
|
+
style={{
|
|
371
|
+
position: 'relative',
|
|
372
|
+
display: 'flex',
|
|
373
|
+
height: '40px',
|
|
374
|
+
margin: '0px 14px',
|
|
375
|
+
alignItems: 'flex-end',
|
|
376
|
+
width: 'calc(100% - 82px)',
|
|
377
|
+
}}
|
|
378
|
+
>
|
|
379
|
+
|
|
380
|
+
<div>
|
|
381
|
+
<p className='new' >{item.file.name}</p>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div
|
|
385
|
+
style={{
|
|
386
|
+
position: 'absolute',
|
|
387
|
+
left: '0px',
|
|
388
|
+
bottom: '5px',
|
|
389
|
+
width: '100%',
|
|
390
|
+
height: '4px',
|
|
391
|
+
borderRadius: '10px',
|
|
392
|
+
backgroundColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor
|
|
393
|
+
}}
|
|
394
|
+
>
|
|
395
|
+
<div
|
|
396
|
+
style={{
|
|
397
|
+
width: progress + '%',
|
|
398
|
+
height: '100%',
|
|
399
|
+
borderRadius: '10px',
|
|
400
|
+
backgroundColor: 'green'
|
|
401
|
+
}}
|
|
402
|
+
>
|
|
403
|
+
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
<div
|
|
411
|
+
style={{
|
|
412
|
+
width: '22px',
|
|
413
|
+
cursor: 'pointer'
|
|
414
|
+
}}
|
|
415
|
+
>
|
|
416
|
+
<SvgListItemDelete />
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
)
|
|
420
|
+
})
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
</div>
|
|
424
|
+
);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
NewFile.propTypes = {
|
|
428
|
+
size: PropTypes.string,
|
|
429
|
+
label: PropTypes.string,
|
|
430
|
+
width: PropTypes.string,
|
|
431
|
+
color: PropTypes.string,
|
|
432
|
+
height: PropTypes.string,
|
|
433
|
+
disabled: PropTypes.bool,
|
|
434
|
+
radius: PropTypes.string,
|
|
435
|
+
border: PropTypes.string,
|
|
436
|
+
required: PropTypes.bool,
|
|
437
|
+
weight: PropTypes.number,
|
|
438
|
+
maxSize: PropTypes.number,
|
|
439
|
+
errorSize: PropTypes.string,
|
|
440
|
+
labelSize: PropTypes.string,
|
|
441
|
+
labelColor: PropTypes.string,
|
|
442
|
+
errorColor: PropTypes.string,
|
|
443
|
+
borderColor: PropTypes.string,
|
|
444
|
+
uploadColor: PropTypes.string,
|
|
445
|
+
defaultData: PropTypes.object,
|
|
446
|
+
errorMessage: PropTypes.string,
|
|
447
|
+
deleteComponent: PropTypes.bool,
|
|
448
|
+
backgroundColor: PropTypes.string,
|
|
449
|
+
change: PropTypes.func.isRequired,
|
|
450
|
+
borderHoverColor: PropTypes.string,
|
|
451
|
+
labelRequiredColor: PropTypes.string,
|
|
452
|
+
progressTrackColor: PropTypes.string,
|
|
453
|
+
hiddenBackgroundColor: PropTypes.string,
|
|
454
|
+
extentionsRowMarginTop: PropTypes.string,
|
|
455
|
+
listItemBackgroundColor: PropTypes.string,
|
|
456
|
+
filesArray: PropTypes.arrayOf(PropTypes.object),
|
|
457
|
+
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
NewFile.defaultProps = {
|
|
461
|
+
maxSize: 5,
|
|
462
|
+
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
463
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { NewFile } from './index';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
component: NewFile,
|
|
6
|
+
title: 'Components/NewFile',
|
|
7
|
+
argTypes: {
|
|
8
|
+
change: {
|
|
9
|
+
control: 'function'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => {
|
|
15
|
+
const [files, setFiles] = useState([]);
|
|
16
|
+
|
|
17
|
+
const handleChange = (file) => {
|
|
18
|
+
setFiles(prev => {
|
|
19
|
+
return [
|
|
20
|
+
...prev,
|
|
21
|
+
file
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return <NewFile change={handleChange} filesArray={files} {...args} />;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Default = Template.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
label: 'File component',
|
|
33
|
+
deleteComponent: true,
|
|
34
|
+
disabled: false,
|
|
35
|
+
defaultData: {
|
|
36
|
+
url: 'https://images.pexels.com/photos/753626/pexels-photo-753626.jpeg?auto=compress&cs=tinysrgb&w=1600',
|
|
37
|
+
type: "image/png",
|
|
38
|
+
},
|
|
39
|
+
multiple: true,
|
|
40
|
+
name: 'sss'
|
|
41
|
+
};
|
|
@@ -6,7 +6,7 @@ import { PaginationRange, Dots } from "./paginationRange";
|
|
|
6
6
|
import Icon from "../icon/Icon";
|
|
7
7
|
|
|
8
8
|
import DotsIcon from './../../components/icon/Dots';
|
|
9
|
-
import
|
|
9
|
+
import SvgNextarrow from './../../components/icon/Nextarrow';
|
|
10
10
|
|
|
11
11
|
export const Pagination = ({
|
|
12
12
|
onChange,
|
|
@@ -78,7 +78,7 @@ export const Pagination = ({
|
|
|
78
78
|
onClick={onPrevious}
|
|
79
79
|
disabled={currentPage === 1 ? true : false}
|
|
80
80
|
>
|
|
81
|
-
<
|
|
81
|
+
<SvgNextarrow />
|
|
82
82
|
</button>
|
|
83
83
|
|
|
84
84
|
{paginationRange.map((pageNumber, id) => {
|
|
@@ -115,7 +115,7 @@ export const Pagination = ({
|
|
|
115
115
|
transform: 'rotate(180deg)'
|
|
116
116
|
}}
|
|
117
117
|
>
|
|
118
|
-
<
|
|
118
|
+
<SvgNextarrow />
|
|
119
119
|
</span>
|
|
120
120
|
</>
|
|
121
121
|
) : (
|
|
@@ -132,7 +132,7 @@ export const Pagination = ({
|
|
|
132
132
|
`${styles["pagination-jump-next-arrow"]} pagination-jump-next-arrow-rem`
|
|
133
133
|
}
|
|
134
134
|
>
|
|
135
|
-
<
|
|
135
|
+
<SvgNextarrow />
|
|
136
136
|
</span>
|
|
137
137
|
</>
|
|
138
138
|
)}
|
|
@@ -162,7 +162,7 @@ export const Pagination = ({
|
|
|
162
162
|
className={`${styles["pagination-btn"]} pagination-btn-rem`}
|
|
163
163
|
disabled={currentPageNumber === lastPage ? true : false}
|
|
164
164
|
>
|
|
165
|
-
<
|
|
165
|
+
<SvgNextarrow />
|
|
166
166
|
</button>
|
|
167
167
|
</ul>
|
|
168
168
|
);
|