@xaypay/tui 0.0.81 → 0.0.83
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 +232 -144
- package/dist/index.js +232 -144
- package/package.json +1 -1
- package/src/components/autocomplate/autocomplate.stories.js +1 -1
- package/src/components/icon/Arrow.js +2 -2
- package/src/components/icon/CaptchaArrowDown.js +2 -2
- package/src/components/icon/CaptchaArrowUp.js +2 -2
- package/src/components/icon/CheckboxChecked.js +2 -2
- package/src/components/icon/CheckboxUnchecked.js +2 -2
- package/src/components/icon/Close.js +2 -2
- package/src/components/icon/CloseIcon.js +2 -2
- package/src/components/icon/CloseSlide.js +2 -2
- package/src/components/icon/DeleteComponent.js +2 -2
- package/src/components/icon/Dots.js +2 -2
- package/src/components/icon/HeartFilled.js +2 -2
- package/src/components/icon/HeartOutline.js +2 -2
- package/src/components/icon/ListItemDelete.js +2 -2
- package/src/components/icon/ListItemJpeg.js +2 -2
- package/src/components/icon/ListItemJpg.js +2 -2
- package/src/components/icon/ListItemPdf.js +2 -2
- package/src/components/icon/ListItemPng.js +2 -2
- package/src/components/icon/Next.js +2 -2
- package/src/components/icon/Nextarrow.js +2 -2
- package/src/components/icon/PDF.js +2 -2
- package/src/components/icon/Prev.js +2 -2
- package/src/components/icon/RangeArrowDefault.js +2 -2
- package/src/components/icon/RangeArrowError.js +2 -2
- package/src/components/icon/RangeArrowSuccess.js +2 -2
- package/src/components/icon/RemoveFile.js +2 -2
- 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 +2 -2
- package/src/components/input/index.js +11 -21
- package/src/components/modal/index.js +26 -15
- package/src/components/modal/modal.stories.js +1 -1
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +4 -3
- package/src/components/newAutocomplete/index.js +25 -13
- package/src/components/select/index.js +15 -6
- package/src/components/select/select.stories.js +1 -0
- package/src/components/singleCheckbox/index.js +27 -5
- package/src/components/table/index.js +28 -11
- package/src/components/table/table.stories.js +398 -258
- package/src/components/table/td.js +48 -8
- package/src/components/table/th.js +28 -5
- package/src/components/textarea/index.js +21 -15
- package/src/components/textarea/textarea.stories.js +4 -0
- package/src/stories/configuration.stories.mdx +17 -5
- package/tui.config.js +17 -6
|
@@ -12,7 +12,7 @@ export const InputTypes = {
|
|
|
12
12
|
PASSWORD: "password",
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const P = styled.
|
|
15
|
+
const P = styled.span`
|
|
16
16
|
animation: ${props => props.errorAnimation ? props.animation : 'none'};
|
|
17
17
|
`;
|
|
18
18
|
|
|
@@ -33,6 +33,7 @@ export const Input = ({
|
|
|
33
33
|
leftIcon,
|
|
34
34
|
required,
|
|
35
35
|
disabled,
|
|
36
|
+
marginTop,
|
|
36
37
|
transform,
|
|
37
38
|
iconWidth,
|
|
38
39
|
rightIcon,
|
|
@@ -48,7 +49,6 @@ export const Input = ({
|
|
|
48
49
|
borderRight,
|
|
49
50
|
placeholder,
|
|
50
51
|
errorZindex,
|
|
51
|
-
errorBottom,
|
|
52
52
|
labelWeight,
|
|
53
53
|
phoneDisplay,
|
|
54
54
|
errorMessage,
|
|
@@ -112,10 +112,6 @@ export const Input = ({
|
|
|
112
112
|
if (!phoneNumberRegex.test(currentValue)) {
|
|
113
113
|
if (currentValue === '') {
|
|
114
114
|
setInnerErrorMessage('');
|
|
115
|
-
setInnerValue('');
|
|
116
|
-
if (change) {
|
|
117
|
-
change('');
|
|
118
|
-
}
|
|
119
115
|
} else {
|
|
120
116
|
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
121
117
|
setInnerValue(prevValue);
|
|
@@ -130,11 +126,6 @@ export const Input = ({
|
|
|
130
126
|
if (change) {
|
|
131
127
|
change(currentValue.substr(0, 8));
|
|
132
128
|
}
|
|
133
|
-
} else {
|
|
134
|
-
setInnerValue(currentValue);
|
|
135
|
-
if (change) {
|
|
136
|
-
change(currentValue);
|
|
137
|
-
}
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
}
|
|
@@ -181,16 +172,14 @@ export const Input = ({
|
|
|
181
172
|
} else {
|
|
182
173
|
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
183
174
|
}
|
|
184
|
-
setInnerValue('');
|
|
185
175
|
} else {
|
|
186
|
-
|
|
187
|
-
|
|
176
|
+
if (value.length < 8) {
|
|
177
|
+
telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
|
|
178
|
+
} else if (value.length > 8) {
|
|
188
179
|
setInnerValue(value.substr(0, 8));
|
|
189
|
-
} else {
|
|
190
|
-
setInnerValue(value);
|
|
191
180
|
}
|
|
192
181
|
}
|
|
193
|
-
}
|
|
182
|
+
}
|
|
194
183
|
|
|
195
184
|
if (maxLength && value.length > maxLength && type !== 'tel') {
|
|
196
185
|
setInnerValue(value.substr(0, maxLength));
|
|
@@ -301,8 +290,8 @@ export const Input = ({
|
|
|
301
290
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
302
291
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
303
292
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
304
|
-
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
305
293
|
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
294
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
306
295
|
}}
|
|
307
296
|
/>
|
|
308
297
|
{
|
|
@@ -336,13 +325,14 @@ export const Input = ({
|
|
|
336
325
|
animation={animation}
|
|
337
326
|
style={{
|
|
338
327
|
margin: '0px',
|
|
328
|
+
position: 'absolute',
|
|
329
|
+
width: width ? width : configStyles.INPUT.width,
|
|
339
330
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
340
331
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
341
332
|
fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
|
|
342
|
-
bottom: errorBottom ? errorBottom : configStyles.INPUT.errorBottom,
|
|
343
333
|
zIndex: errorZindex ? errorZindex : configStyles.INPUT.errorZindex,
|
|
344
|
-
position: errorPosition ? errorPosition : configStyles.INPUT.errorPosition,
|
|
345
334
|
lineHeight: errorLineHeight ? errorLineHeight : configStyles.INPUT.errorLineHeight,
|
|
335
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
346
336
|
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform,
|
|
347
337
|
}}
|
|
348
338
|
className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
|
|
@@ -368,6 +358,7 @@ Input.propTypes = {
|
|
|
368
358
|
padding: PropTypes.string,
|
|
369
359
|
fontSize: PropTypes.string,
|
|
370
360
|
tooltip: PropTypes.element,
|
|
361
|
+
marginTop: PropTypes.string,
|
|
371
362
|
transform: PropTypes.string,
|
|
372
363
|
className: PropTypes.string,
|
|
373
364
|
iconWidth: PropTypes.string,
|
|
@@ -382,7 +373,6 @@ Input.propTypes = {
|
|
|
382
373
|
borderRight: PropTypes.string,
|
|
383
374
|
placeholder: PropTypes.string,
|
|
384
375
|
errorZindex: PropTypes.string,
|
|
385
|
-
errorBottom: PropTypes.string,
|
|
386
376
|
labelWeight: PropTypes.string,
|
|
387
377
|
errorMessage: PropTypes.string,
|
|
388
378
|
phoneDisplay: PropTypes.string,
|
|
@@ -13,7 +13,9 @@ import SvgCloseSlide from './../icon/CloseSlide';
|
|
|
13
13
|
export const Modal = ({
|
|
14
14
|
type,
|
|
15
15
|
data,
|
|
16
|
+
width,
|
|
16
17
|
radius,
|
|
18
|
+
height,
|
|
17
19
|
padding,
|
|
18
20
|
setShow,
|
|
19
21
|
selected,
|
|
@@ -21,13 +23,18 @@ export const Modal = ({
|
|
|
21
23
|
minWidth,
|
|
22
24
|
minHeight,
|
|
23
25
|
className,
|
|
26
|
+
mMaxWidth,
|
|
27
|
+
alignItems,
|
|
28
|
+
mMaxHeight,
|
|
24
29
|
headerText,
|
|
25
30
|
imageWidth,
|
|
26
31
|
headerSize,
|
|
27
32
|
imageHeight,
|
|
28
33
|
headerColor,
|
|
34
|
+
outsideClose,
|
|
29
35
|
headerWeight,
|
|
30
36
|
headerHeight,
|
|
37
|
+
justifyContent,
|
|
31
38
|
backgroundColor,
|
|
32
39
|
layerBackgroundColor,
|
|
33
40
|
}) => {
|
|
@@ -45,8 +52,7 @@ export const Modal = ({
|
|
|
45
52
|
e.stopPropagation();
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
const handleGoTo = (
|
|
49
|
-
const goTo = e.target.getAttribute('data-go');
|
|
55
|
+
const handleGoTo = (goTo) => {
|
|
50
56
|
if (goTo === 'next') {
|
|
51
57
|
if (select >= data.length - 1) {
|
|
52
58
|
setSelect(0);
|
|
@@ -97,7 +103,7 @@ export const Modal = ({
|
|
|
97
103
|
|
|
98
104
|
return (
|
|
99
105
|
<div
|
|
100
|
-
onClick={handleCloseModal}
|
|
106
|
+
onClick={outsideClose || configStyles.MODAL.outsideClose ? handleCloseModal : _ => _}
|
|
101
107
|
style={{
|
|
102
108
|
top: '0px',
|
|
103
109
|
left: '0px',
|
|
@@ -114,25 +120,25 @@ export const Modal = ({
|
|
|
114
120
|
display: 'flex',
|
|
115
121
|
width: '100%',
|
|
116
122
|
height: '100vh',
|
|
117
|
-
alignItems:
|
|
118
|
-
justifyContent:
|
|
123
|
+
alignItems: alignItems ? alignItems : configStyles.MODAL.alignItems,
|
|
124
|
+
justifyContent: justifyContent ? justifyContent : configStyles.MODAL.justifyContent
|
|
119
125
|
}}
|
|
120
126
|
>
|
|
121
127
|
<div
|
|
122
128
|
className={`${classProps} ${styles['animation__modal']}`}
|
|
123
129
|
onClick={handleStopClosing}
|
|
124
130
|
style={{
|
|
125
|
-
maxWidth: '95%',
|
|
126
131
|
overflow: 'auto',
|
|
127
|
-
maxHeight: '95vh',
|
|
128
|
-
width: 'fit-content',
|
|
129
|
-
height: 'fit-content',
|
|
130
132
|
boxSizing: 'border-box',
|
|
133
|
+
width: width ? width : configStyles.MODAL.width,
|
|
134
|
+
height: height ? height : configStyles.MODAL.height,
|
|
131
135
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
|
|
137
|
+
maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
|
|
138
|
+
minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
|
|
134
139
|
padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
|
|
135
140
|
backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
|
|
141
|
+
minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : '',
|
|
136
142
|
}}
|
|
137
143
|
>
|
|
138
144
|
<div
|
|
@@ -246,8 +252,7 @@ export const Modal = ({
|
|
|
246
252
|
{
|
|
247
253
|
innerData && innerData.length > 1 && <>
|
|
248
254
|
<button
|
|
249
|
-
onClick={handleGoTo}
|
|
250
|
-
data-go='prev'
|
|
255
|
+
onClick={_ => handleGoTo('prev')}
|
|
251
256
|
style={{
|
|
252
257
|
position: 'absolute',
|
|
253
258
|
left: '14px',
|
|
@@ -264,8 +269,7 @@ export const Modal = ({
|
|
|
264
269
|
<SvgPrev />
|
|
265
270
|
</button>
|
|
266
271
|
<button
|
|
267
|
-
onClick={handleGoTo}
|
|
268
|
-
data-go='next'
|
|
272
|
+
onClick={_ => handleGoTo('next')}
|
|
269
273
|
style={{
|
|
270
274
|
position: 'absolute',
|
|
271
275
|
width: '24px',
|
|
@@ -297,19 +301,26 @@ Modal.propTypes = {
|
|
|
297
301
|
data: PropTypes.array,
|
|
298
302
|
type: PropTypes.string,
|
|
299
303
|
setShow: PropTypes.func,
|
|
304
|
+
width: PropTypes.string,
|
|
300
305
|
radius: PropTypes.string,
|
|
306
|
+
height: PropTypes.string,
|
|
301
307
|
padding: PropTypes.string,
|
|
302
308
|
selected: PropTypes.number,
|
|
303
309
|
minWidth: PropTypes.string,
|
|
310
|
+
mMaxWidth: PropTypes.string,
|
|
304
311
|
minHeight: PropTypes.string,
|
|
305
312
|
className: PropTypes.string,
|
|
313
|
+
alignItems: PropTypes.string,
|
|
314
|
+
mMaxHeight: PropTypes.string,
|
|
306
315
|
headerText: PropTypes.string,
|
|
307
316
|
imageWidth: PropTypes.string,
|
|
308
317
|
headerSize: PropTypes.string,
|
|
318
|
+
outsideClose: PropTypes.bool,
|
|
309
319
|
headerColor: PropTypes.string,
|
|
310
320
|
imageHeight: PropTypes.string,
|
|
311
321
|
headerWeight: PropTypes.string,
|
|
312
322
|
headerHeight: PropTypes.string,
|
|
323
|
+
justifyContent: PropTypes.string,
|
|
313
324
|
backgroundColor: PropTypes.string,
|
|
314
325
|
layerBackgroundColor: PropTypes.string,
|
|
315
326
|
};
|
|
@@ -55,7 +55,7 @@ const Template = ({ headerText, className }) => {
|
|
|
55
55
|
style={{ cursor: 'pointer', padding: '8px', fontSize: '16px' }}
|
|
56
56
|
>Change type to {type === 'content' ? 'images' : 'content'}</button>
|
|
57
57
|
{show && (
|
|
58
|
-
<Modal type={type} selected={0} data={data} setShow={setShow}
|
|
58
|
+
<Modal type={type} selected={0} data={data} setShow={setShow} className={className}>
|
|
59
59
|
<p>
|
|
60
60
|
Children content
|
|
61
61
|
</p>
|
|
@@ -24,11 +24,11 @@ const Template = (args) => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const handleChange = (value) => {
|
|
27
|
-
fetch(`http://dev2.govazd-api.yerevan.am/api/v1/companies/autocomplete?slug=${value}`, {
|
|
27
|
+
fetch(`http://dev2.govazd-api.yerevan.am/api/v1/companies/autocomplete?slug=${value.name ? value.name : ''}`, {
|
|
28
28
|
method: 'GET',
|
|
29
29
|
headers: {
|
|
30
30
|
'Content-Type': 'application/json',
|
|
31
|
-
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.
|
|
31
|
+
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
|
|
32
32
|
},
|
|
33
33
|
}).then((res)=> {
|
|
34
34
|
return res.json()
|
|
@@ -47,5 +47,6 @@ const Template = (args) => {
|
|
|
47
47
|
export const Default = Template.bind({});
|
|
48
48
|
Default.args = {
|
|
49
49
|
searchCount: 3,
|
|
50
|
-
|
|
50
|
+
keyNames: { name: 'name', id: 'bbb' },
|
|
51
|
+
selected: { "bbb":"0", "name":"gasdfgdsfgdsg" },
|
|
51
52
|
}
|
|
@@ -10,11 +10,13 @@ export const NewAutocomplete = ({
|
|
|
10
10
|
change,
|
|
11
11
|
options,
|
|
12
12
|
getItem,
|
|
13
|
+
keyNames,
|
|
13
14
|
required,
|
|
14
15
|
disabled,
|
|
15
16
|
selected,
|
|
16
17
|
errorSize,
|
|
17
18
|
labelSize,
|
|
19
|
+
marginTop,
|
|
18
20
|
errorColor,
|
|
19
21
|
labelColor,
|
|
20
22
|
labelWeight,
|
|
@@ -48,6 +50,7 @@ export const NewAutocomplete = ({
|
|
|
48
50
|
contentTopBoxSizing,
|
|
49
51
|
contentTopLineHeight,
|
|
50
52
|
contentBottomMaxWidth,
|
|
53
|
+
contentTopBorderHover,
|
|
51
54
|
contentBottomOverflow,
|
|
52
55
|
contentBottomPosition,
|
|
53
56
|
contentBottomRowColor,
|
|
@@ -55,6 +58,7 @@ export const NewAutocomplete = ({
|
|
|
55
58
|
contentBottomBoxShadow,
|
|
56
59
|
contentBottomRowHeight,
|
|
57
60
|
contentBottomRowCursor,
|
|
61
|
+
contentTopBorderActive,
|
|
58
62
|
contentBottomRowDisplay,
|
|
59
63
|
contentBottomRowPadding,
|
|
60
64
|
contentBottomRowFontSize,
|
|
@@ -65,8 +69,6 @@ export const NewAutocomplete = ({
|
|
|
65
69
|
contentBottomRowAlignItems,
|
|
66
70
|
contentBottomRowTransition,
|
|
67
71
|
contentBottomRowHoverColor,
|
|
68
|
-
contentTopBorderHover,
|
|
69
|
-
contentTopBorderActive,
|
|
70
72
|
contentBottomInnerOverflowY,
|
|
71
73
|
contentBottomInnerOverflowX,
|
|
72
74
|
contentBottomInnerMaxHeight,
|
|
@@ -77,6 +79,7 @@ export const NewAutocomplete = ({
|
|
|
77
79
|
contentBottomRowHoverBackgroundColor,
|
|
78
80
|
...props
|
|
79
81
|
}) => {
|
|
82
|
+
const [id, setId] = useState('');
|
|
80
83
|
const [show, setShow] = useState(false);
|
|
81
84
|
const [isHover, setIsHover] = useState(false);
|
|
82
85
|
const [isFocus, setIsFocus] = useState(false);
|
|
@@ -122,10 +125,11 @@ export const NewAutocomplete = ({
|
|
|
122
125
|
|
|
123
126
|
const handleChange = (e) => {
|
|
124
127
|
const value = e.target.value;
|
|
128
|
+
const currentId = e.target.id;
|
|
125
129
|
value.length > 0 ? setShow(true) : setShow(false);
|
|
126
130
|
setInnerValue(value);
|
|
127
131
|
if (value.length >= searchCount) {
|
|
128
|
-
change(value);
|
|
132
|
+
change({ name: value, id: currentId });
|
|
129
133
|
} else {
|
|
130
134
|
change('');
|
|
131
135
|
}
|
|
@@ -133,8 +137,9 @@ export const NewAutocomplete = ({
|
|
|
133
137
|
|
|
134
138
|
const handleClick = (selectedValue) => {
|
|
135
139
|
setShow(false);
|
|
136
|
-
|
|
140
|
+
setId(selectedValue.id);
|
|
137
141
|
setInnerValue(selectedValue.name);
|
|
142
|
+
getItem(selectedValue);
|
|
138
143
|
};
|
|
139
144
|
|
|
140
145
|
const optionList = (
|
|
@@ -200,7 +205,7 @@ export const NewAutocomplete = ({
|
|
|
200
205
|
backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
|
|
201
206
|
}}
|
|
202
207
|
>
|
|
203
|
-
{item.name}
|
|
208
|
+
{item[keyNames.name]}
|
|
204
209
|
</p>
|
|
205
210
|
)
|
|
206
211
|
})
|
|
@@ -209,11 +214,12 @@ export const NewAutocomplete = ({
|
|
|
209
214
|
</div>
|
|
210
215
|
: innerOptions.length <= 0
|
|
211
216
|
?
|
|
212
|
-
<
|
|
217
|
+
<span
|
|
213
218
|
style={{
|
|
214
|
-
|
|
219
|
+
position: 'absolute',
|
|
215
220
|
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
216
221
|
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
222
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
217
223
|
height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
218
224
|
padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
|
|
219
225
|
lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
|
|
@@ -225,7 +231,7 @@ export const NewAutocomplete = ({
|
|
|
225
231
|
? 'Նման տվյալ առկա չէ'
|
|
226
232
|
: `Լրացնել առնվազն ${searchCount} նիշ`
|
|
227
233
|
}
|
|
228
|
-
</
|
|
234
|
+
</span>
|
|
229
235
|
: ''
|
|
230
236
|
: ''
|
|
231
237
|
}
|
|
@@ -258,11 +264,13 @@ export const NewAutocomplete = ({
|
|
|
258
264
|
|
|
259
265
|
useEffect(() => {
|
|
260
266
|
if (selected) {
|
|
261
|
-
|
|
267
|
+
setId(selected[keyNames.id]);
|
|
268
|
+
setInnerValue(selected[keyNames.name]);
|
|
262
269
|
} else {
|
|
270
|
+
setId('');
|
|
263
271
|
setInnerValue('');
|
|
264
272
|
}
|
|
265
|
-
}, [selected
|
|
273
|
+
}, [selected]);
|
|
266
274
|
|
|
267
275
|
return (
|
|
268
276
|
<>
|
|
@@ -300,6 +308,7 @@ export const NewAutocomplete = ({
|
|
|
300
308
|
}}
|
|
301
309
|
>
|
|
302
310
|
<input
|
|
311
|
+
id={id}
|
|
303
312
|
type='text'
|
|
304
313
|
value={innerValue}
|
|
305
314
|
disabled={disabled}
|
|
@@ -339,10 +348,11 @@ export const NewAutocomplete = ({
|
|
|
339
348
|
errorMessage
|
|
340
349
|
? <span
|
|
341
350
|
style={{
|
|
342
|
-
|
|
343
|
-
|
|
351
|
+
left: '0px',
|
|
352
|
+
position: 'absolute',
|
|
344
353
|
color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
|
|
345
354
|
fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
|
|
355
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
|
|
346
356
|
maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
|
|
347
357
|
}}
|
|
348
358
|
>
|
|
@@ -363,8 +373,10 @@ NewAutocomplete.propTypes = {
|
|
|
363
373
|
label: PropTypes.string,
|
|
364
374
|
required: PropTypes.bool,
|
|
365
375
|
disabled: PropTypes.bool,
|
|
366
|
-
|
|
376
|
+
keyNames: PropTypes.object,
|
|
377
|
+
selected: PropTypes.object,
|
|
367
378
|
errorSize: PropTypes.string,
|
|
379
|
+
marginTop: PropTypes.string,
|
|
368
380
|
labelSize: PropTypes.string,
|
|
369
381
|
errorColor: PropTypes.string,
|
|
370
382
|
labelColor: PropTypes.string,
|
|
@@ -18,9 +18,12 @@ export const Select = ({
|
|
|
18
18
|
keyNames,
|
|
19
19
|
selected,
|
|
20
20
|
className,
|
|
21
|
+
marginTop,
|
|
21
22
|
arrowIcon,
|
|
22
23
|
closeIcon,
|
|
24
|
+
errorZindex,
|
|
23
25
|
errorMessage,
|
|
26
|
+
showCloseIcon,
|
|
24
27
|
defaultOption,
|
|
25
28
|
multipleCheckbox,
|
|
26
29
|
|
|
@@ -198,7 +201,7 @@ export const Select = ({
|
|
|
198
201
|
}, [options, multiple, selected, selected?.length]);
|
|
199
202
|
|
|
200
203
|
return (
|
|
201
|
-
<div className={classProps}>
|
|
204
|
+
<div className={classProps} style={{ position: 'relative' }}>
|
|
202
205
|
{
|
|
203
206
|
label ?
|
|
204
207
|
<label
|
|
@@ -261,11 +264,11 @@ export const Select = ({
|
|
|
261
264
|
!disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>
|
|
262
265
|
}
|
|
263
266
|
|
|
264
|
-
{!disabled && newSelected && newSelected.length > 0 &&
|
|
267
|
+
{showCloseIcon && !disabled && newSelected && newSelected.length > 0 &&
|
|
265
268
|
<div
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
className={`${styles['close-icon']}`}
|
|
270
|
+
onClick={disabled ? _ => _ : handleClearSelect}
|
|
271
|
+
style={{marginLeft: multiple && newSelected.length > 1 ? '17px' : '0px'}}
|
|
269
272
|
>
|
|
270
273
|
{ closeIcon ? closeIcon : <ReactCloseIcon /> }
|
|
271
274
|
</div>
|
|
@@ -338,8 +341,11 @@ export const Select = ({
|
|
|
338
341
|
errorMessage ?
|
|
339
342
|
<span
|
|
340
343
|
style={{
|
|
344
|
+
position: 'absolute',
|
|
341
345
|
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
342
|
-
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
|
|
346
|
+
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize,
|
|
347
|
+
zIndex: errorZindex ? errorZindex : configStyles.SELECT.errorZindex,
|
|
348
|
+
top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`
|
|
343
349
|
}}
|
|
344
350
|
>
|
|
345
351
|
{errorMessage}
|
|
@@ -358,9 +364,12 @@ Select.propTypes = {
|
|
|
358
364
|
disabled: PropTypes.bool,
|
|
359
365
|
selected: PropTypes.array,
|
|
360
366
|
keyNames: PropTypes.object,
|
|
367
|
+
marginTop: PropTypes.string,
|
|
361
368
|
className: PropTypes.string,
|
|
362
369
|
arrowIcon: PropTypes.element,
|
|
363
370
|
closeIcon: PropTypes.element,
|
|
371
|
+
showCloseIcon: PropTypes.bool,
|
|
372
|
+
errorZindex: PropTypes.number,
|
|
364
373
|
errorMessage: PropTypes.string,
|
|
365
374
|
defaultOption: PropTypes.string,
|
|
366
375
|
multipleCheckbox: PropTypes.bool,
|
|
@@ -17,6 +17,7 @@ const Template = (args) => <Select label='' {...args} >Default</Select>;
|
|
|
17
17
|
|
|
18
18
|
export const Default = Template.bind({});
|
|
19
19
|
Default.args = {
|
|
20
|
+
showCloseIcon: true,
|
|
20
21
|
label: 'վարչական շրջան',
|
|
21
22
|
options: [{"bbb":"0", "value":"Արաբկիր"}, {"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
|
|
22
23
|
onChange: (newValue)=> {
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import ReactCheckbox from '../icon/CheckboxUnchecked';
|
|
5
5
|
import ReactCheckboxChecked from '../icon/CheckboxChecked';
|
|
6
6
|
|
|
7
|
-
export const SingleCheckbox = ({
|
|
7
|
+
export const SingleCheckbox = ({
|
|
8
|
+
id,
|
|
9
|
+
float,
|
|
10
|
+
checked,
|
|
11
|
+
onClick,
|
|
12
|
+
content,
|
|
13
|
+
disabled,
|
|
14
|
+
checkedColor,
|
|
15
|
+
unCheckedColor
|
|
16
|
+
}) => {
|
|
17
|
+
const [innerCheckd, setInnerChecked] = useState(false);
|
|
8
18
|
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setInnerChecked(checked);
|
|
21
|
+
}, [checked]);
|
|
9
22
|
return <div
|
|
10
23
|
style={{
|
|
11
|
-
|
|
24
|
+
width: '16px',
|
|
25
|
+
height: '16px',
|
|
26
|
+
marginRight: '9px',
|
|
27
|
+
display: 'inline-block',
|
|
28
|
+
float: float ? float : '',
|
|
29
|
+
cursor: !disabled && onClick ? 'pointer' : 'normal'
|
|
12
30
|
}}
|
|
13
31
|
>
|
|
14
|
-
{
|
|
32
|
+
{ innerCheckd
|
|
33
|
+
? <ReactCheckboxChecked onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={checkedColor ? checkedColor : ''} />
|
|
34
|
+
: <ReactCheckbox onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={unCheckedColor ? unCheckedColor : ''} />
|
|
35
|
+
}
|
|
15
36
|
</div>;
|
|
16
37
|
};
|
|
17
38
|
|
|
18
39
|
SingleCheckbox.propTypes = {
|
|
19
|
-
|
|
40
|
+
disabled: PropTypes.bool,
|
|
41
|
+
checked: PropTypes.bool.isRequired,
|
|
20
42
|
}
|
|
@@ -7,7 +7,8 @@ import TD from './td';
|
|
|
7
7
|
import { compereConfigs } from './../../utils';
|
|
8
8
|
|
|
9
9
|
const Table = ({
|
|
10
|
-
|
|
10
|
+
dataBody,
|
|
11
|
+
dataHeader,
|
|
11
12
|
|
|
12
13
|
tHeadColor,
|
|
13
14
|
tHeadFamily,
|
|
@@ -23,7 +24,12 @@ const Table = ({
|
|
|
23
24
|
tBodyFontWeight,
|
|
24
25
|
tBodyFontFamily,
|
|
25
26
|
|
|
26
|
-
tBodyRowBorder
|
|
27
|
+
tBodyRowBorder,
|
|
28
|
+
|
|
29
|
+
handleCheckedBody,
|
|
30
|
+
handleCheckedHeader,
|
|
31
|
+
handleHeaderItemClick,
|
|
32
|
+
handleBodyActionClick
|
|
27
33
|
}) => {
|
|
28
34
|
const [body, setBody] = useState([]);
|
|
29
35
|
const [header, setHeader] = useState([]);
|
|
@@ -31,24 +37,24 @@ const Table = ({
|
|
|
31
37
|
const configStyles = compereConfigs();
|
|
32
38
|
|
|
33
39
|
useEffect(() => {
|
|
34
|
-
setBody(
|
|
35
|
-
}, [
|
|
40
|
+
setBody(dataBody);
|
|
41
|
+
}, [dataBody]);
|
|
36
42
|
|
|
37
43
|
useEffect(() => {
|
|
38
|
-
setHeader(
|
|
39
|
-
}, [
|
|
44
|
+
setHeader(dataHeader);
|
|
45
|
+
}, [dataHeader]);
|
|
40
46
|
|
|
41
47
|
return (
|
|
42
48
|
<>
|
|
43
49
|
<table
|
|
44
50
|
style={{
|
|
45
|
-
width: '
|
|
51
|
+
width: '2000px',
|
|
46
52
|
borderCollapse: 'collapse'
|
|
47
53
|
}}
|
|
48
54
|
>
|
|
49
55
|
|
|
50
56
|
{
|
|
51
|
-
header && header
|
|
57
|
+
header && header.length > 0 && <thead>
|
|
52
58
|
<tr
|
|
53
59
|
style={{
|
|
54
60
|
color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
|
|
@@ -62,7 +68,9 @@ const Table = ({
|
|
|
62
68
|
item={item}
|
|
63
69
|
key={`${item}_${index}`}
|
|
64
70
|
tHeadFamily={tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily}
|
|
71
|
+
handleCheckedHeader={handleCheckedHeader ? handleCheckedHeader : _ => _}
|
|
65
72
|
tHeadPadding={tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding}
|
|
73
|
+
handleHeaderItemClick={handleHeaderItemClick ? handleHeaderItemClick : _ => _}
|
|
66
74
|
tHeadFontWeight={tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight}
|
|
67
75
|
borderTopLeftRadius={index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
68
76
|
borderTopRightRadius={index === header.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
|
|
@@ -75,7 +83,7 @@ const Table = ({
|
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
{
|
|
78
|
-
body && body
|
|
86
|
+
body && body.length > 0 && <tbody
|
|
79
87
|
style={{
|
|
80
88
|
boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
|
|
81
89
|
}}
|
|
@@ -94,9 +102,12 @@ const Table = ({
|
|
|
94
102
|
return (
|
|
95
103
|
<TD
|
|
96
104
|
item={innerItem}
|
|
105
|
+
id={item.id ? item.id : ''}
|
|
97
106
|
key={`${innerItem}_${innerIndex}`}
|
|
107
|
+
handleCheckedBody={handleCheckedBody ? handleCheckedBody : _ => _}
|
|
98
108
|
tBodyColor={tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor}
|
|
99
109
|
tBodyPadding={tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding}
|
|
110
|
+
handleBodyActionClick={handleBodyActionClick ? handleBodyActionClick : _ => _}
|
|
100
111
|
tBodyFontSize={tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize}
|
|
101
112
|
tBodyTextAlign={tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign}
|
|
102
113
|
tBodyFontFamily={tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily}
|
|
@@ -118,7 +129,8 @@ const Table = ({
|
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
Table.propTypes = {
|
|
121
|
-
|
|
132
|
+
dataBody: PropTypes.array,
|
|
133
|
+
dataHeader: PropTypes.array,
|
|
122
134
|
|
|
123
135
|
tHeadColor: PropTypes.string,
|
|
124
136
|
tHeadFamily: PropTypes.string,
|
|
@@ -134,7 +146,12 @@ Table.propTypes = {
|
|
|
134
146
|
tBodyFontWeight: PropTypes.string,
|
|
135
147
|
tBodyFontFamily: PropTypes.string,
|
|
136
148
|
|
|
137
|
-
tBodyRowBorder: PropTypes.string
|
|
149
|
+
tBodyRowBorder: PropTypes.string,
|
|
150
|
+
|
|
151
|
+
handleCheckedBody: PropTypes.func,
|
|
152
|
+
handleCheckedHeader: PropTypes.func,
|
|
153
|
+
handleHeaderItemClick: PropTypes.func,
|
|
154
|
+
handleBodyActionClick: PropTypes.func
|
|
138
155
|
};
|
|
139
156
|
|
|
140
157
|
export default Table;
|