@xaypay/tui 0.0.117 → 0.0.119
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/README.md +92 -0
- package/dist/index.es.js +357 -162
- package/dist/index.js +358 -161
- package/package.json +1 -1
- package/src/components/captcha/index.js +2 -2
- package/src/components/newFile/index.js +77 -3
- package/src/components/newFile/newFile.stories.js +47 -11
- package/src/components/radio/index.js +222 -41
- package/src/components/radio/radio.stories.js +52 -3
- package/src/components/table/index.js +38 -0
- package/src/components/table/table.module.css +1 -4
- package/src/components/table/td.js +17 -8
- package/src/components/table/th.js +4 -1
- package/src/components/textarea/index.js +51 -17
- package/src/components/textarea/textarea.stories.js +7 -1
- package/src/stories/changelog.stories.mdx +44 -3
- package/src/stories/configuration.stories.mdx +46 -17
- package/src/stories/static/radio-usage.png +0 -0
- package/src/stories/usage.stories.mdx +5 -4
- package/tui.config.js +32 -3
- package/src/stories/static/single-checkbox-usage.png +0 -0
package/package.json
CHANGED
|
@@ -42,8 +42,8 @@ export const Captcha = ({ size, color, range, label, className, getRange }) => {
|
|
|
42
42
|
{label && (
|
|
43
43
|
<p
|
|
44
44
|
style={{
|
|
45
|
-
fontSize: size ? size : configStyles.
|
|
46
|
-
color: color ? color : configStyles.
|
|
45
|
+
fontSize: size ? size : configStyles.CAPTCHA.size,
|
|
46
|
+
color: color ? color : configStyles.CAPTCHA.color,
|
|
47
47
|
}}
|
|
48
48
|
>
|
|
49
49
|
{label}
|
|
@@ -6,6 +6,7 @@ import classnames from 'classnames'
|
|
|
6
6
|
import FileItem from './fileItem'
|
|
7
7
|
|
|
8
8
|
import { compereConfigs } from './../../utils'
|
|
9
|
+
import { Button } from './../button'
|
|
9
10
|
|
|
10
11
|
import SvgPdf from './../icon/PDF'
|
|
11
12
|
import SvgHeic from './../icon/Heic'
|
|
@@ -26,6 +27,7 @@ export const NewFile = ({
|
|
|
26
27
|
change,
|
|
27
28
|
border,
|
|
28
29
|
upload,
|
|
30
|
+
preview,
|
|
29
31
|
maxSize,
|
|
30
32
|
maxWidth,
|
|
31
33
|
disabled,
|
|
@@ -49,6 +51,14 @@ export const NewFile = ({
|
|
|
49
51
|
maxSizeError,
|
|
50
52
|
progressColor,
|
|
51
53
|
noChoosenFile,
|
|
54
|
+
|
|
55
|
+
uploadBtnFont,
|
|
56
|
+
uploadBtnSize,
|
|
57
|
+
uploadBtnLabel,
|
|
58
|
+
uploadBtnColor,
|
|
59
|
+
uploadBtnHeight,
|
|
60
|
+
uploadBtnBackgroundColor,
|
|
61
|
+
|
|
52
62
|
fileExtensions,
|
|
53
63
|
listItemHeight,
|
|
54
64
|
backgroundColor,
|
|
@@ -99,6 +109,7 @@ export const NewFile = ({
|
|
|
99
109
|
|
|
100
110
|
const handleRemoveFile = () => {
|
|
101
111
|
setImage(null)
|
|
112
|
+
setSingleFile(null)
|
|
102
113
|
removeFile && removeFile(singleFile)
|
|
103
114
|
}
|
|
104
115
|
|
|
@@ -422,7 +433,7 @@ export const NewFile = ({
|
|
|
422
433
|
fontWeight: weight ? weight : configStyles.FILE.weight,
|
|
423
434
|
}}
|
|
424
435
|
>
|
|
425
|
-
{!multiple && image ? (
|
|
436
|
+
{!multiple && image && preview ? (
|
|
426
437
|
image === 'pdf' ? (
|
|
427
438
|
<SvgPdf />
|
|
428
439
|
) : image === 'heif' || image === 'heic' ? (
|
|
@@ -445,7 +456,7 @@ export const NewFile = ({
|
|
|
445
456
|
alt="file preview"
|
|
446
457
|
/>
|
|
447
458
|
)
|
|
448
|
-
) : (
|
|
459
|
+
) : preview ? (
|
|
449
460
|
<>
|
|
450
461
|
<div>
|
|
451
462
|
<SvgUpload />
|
|
@@ -482,11 +493,63 @@ export const NewFile = ({
|
|
|
482
493
|
margin: '0px',
|
|
483
494
|
}}
|
|
484
495
|
>
|
|
485
|
-
{fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText} {maxSize}ՄԲ ({' '}
|
|
496
|
+
{fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText} {maxSize} ՄԲ ({' '}
|
|
486
497
|
{fileExtensions.toString().split(',').join(', ')} )
|
|
487
498
|
</p>
|
|
488
499
|
</div>
|
|
489
500
|
</>
|
|
501
|
+
) : (
|
|
502
|
+
<>
|
|
503
|
+
<div
|
|
504
|
+
style={{
|
|
505
|
+
width: '100%',
|
|
506
|
+
padding: '5px',
|
|
507
|
+
display: 'flex',
|
|
508
|
+
alignItems: 'center',
|
|
509
|
+
boxSizing: 'border-box',
|
|
510
|
+
justifyContent: 'space-between',
|
|
511
|
+
}}
|
|
512
|
+
>
|
|
513
|
+
<Button
|
|
514
|
+
contentWidth
|
|
515
|
+
onClick={(_) => _}
|
|
516
|
+
font={uploadBtnFont ? uploadBtnFont : configStyles.FILE.uploadBtnFont}
|
|
517
|
+
size={uploadBtnSize ? uploadBtnSize : configStyles.FILE.uploadBtnSize}
|
|
518
|
+
label={uploadBtnLabel ? uploadBtnLabel : configStyles.FILE.uploadBtnLabel}
|
|
519
|
+
color={uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor}
|
|
520
|
+
height={uploadBtnHeight ? uploadBtnHeight : configStyles.FILE.uploadBtnHeight}
|
|
521
|
+
hoverColor={uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor}
|
|
522
|
+
backgroundColor={
|
|
523
|
+
uploadBtnBackgroundColor
|
|
524
|
+
? uploadBtnBackgroundColor
|
|
525
|
+
: configStyles.FILE.uploadBtnBackgroundColor
|
|
526
|
+
}
|
|
527
|
+
backgroundHoverColor={
|
|
528
|
+
uploadBtnBackgroundColor
|
|
529
|
+
? uploadBtnBackgroundColor
|
|
530
|
+
: configStyles.FILE.uploadBtnBackgroundColor
|
|
531
|
+
}
|
|
532
|
+
/>
|
|
533
|
+
<p
|
|
534
|
+
style={{
|
|
535
|
+
margin: '0px',
|
|
536
|
+
marginLeft: '5px',
|
|
537
|
+
overflow: 'hidden',
|
|
538
|
+
whiteSpace: 'nowrap',
|
|
539
|
+
textOverflow: 'ellipsis',
|
|
540
|
+
}}
|
|
541
|
+
>
|
|
542
|
+
{singleFile ? (
|
|
543
|
+
singleFile[0].name
|
|
544
|
+
) : (
|
|
545
|
+
<span>
|
|
546
|
+
{fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText} {maxSize} ՄԲ
|
|
547
|
+
( {fileExtensions.toString().split(',').join(', ')} )
|
|
548
|
+
</span>
|
|
549
|
+
)}
|
|
550
|
+
</p>
|
|
551
|
+
</div>
|
|
552
|
+
</>
|
|
490
553
|
)}
|
|
491
554
|
</div>
|
|
492
555
|
|
|
@@ -595,6 +658,7 @@ export const NewFile = ({
|
|
|
595
658
|
NewFile.propTypes = {
|
|
596
659
|
or: PropTypes.string,
|
|
597
660
|
size: PropTypes.string,
|
|
661
|
+
preview: PropTypes.bool,
|
|
598
662
|
label: PropTypes.string,
|
|
599
663
|
color: PropTypes.string,
|
|
600
664
|
height: PropTypes.string,
|
|
@@ -605,6 +669,7 @@ NewFile.propTypes = {
|
|
|
605
669
|
upload: PropTypes.string,
|
|
606
670
|
weight: PropTypes.number,
|
|
607
671
|
maxSize: PropTypes.number,
|
|
672
|
+
maxWidth: PropTypes.string,
|
|
608
673
|
removeFile: PropTypes.func,
|
|
609
674
|
className: PropTypes.string,
|
|
610
675
|
errorSize: PropTypes.string,
|
|
@@ -624,6 +689,14 @@ NewFile.propTypes = {
|
|
|
624
689
|
progressColor: PropTypes.string,
|
|
625
690
|
deleteComponent: PropTypes.bool,
|
|
626
691
|
removeComponent: PropTypes.func,
|
|
692
|
+
|
|
693
|
+
uploadBtnFont: PropTypes.string,
|
|
694
|
+
uploadBtnSize: PropTypes.string,
|
|
695
|
+
uploadBtnLabel: PropTypes.string,
|
|
696
|
+
uploadBtnColor: PropTypes.string,
|
|
697
|
+
uploadBtnHeight: PropTypes.string,
|
|
698
|
+
uploadBtnBackgroundColor: PropTypes.string,
|
|
699
|
+
|
|
627
700
|
listItemHeight: PropTypes.string,
|
|
628
701
|
backgroundColor: PropTypes.string,
|
|
629
702
|
change: PropTypes.func.isRequired,
|
|
@@ -652,6 +725,7 @@ NewFile.propTypes = {
|
|
|
652
725
|
|
|
653
726
|
NewFile.defaultProps = {
|
|
654
727
|
maxSize: 10,
|
|
728
|
+
preview: true,
|
|
655
729
|
timeForRemoveError: 5000,
|
|
656
730
|
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'heic'],
|
|
657
731
|
}
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
|
|
14
14
|
const Template = (args) => {
|
|
15
15
|
const [files, setFiles] = useState([])
|
|
16
|
+
const [secondFiles, setSecondFiles] = useState([])
|
|
16
17
|
|
|
17
18
|
const handleChange = (file) => {
|
|
18
19
|
setFiles((prev) => {
|
|
@@ -28,18 +29,53 @@ const Template = (args) => {
|
|
|
28
29
|
alert(`You want to remove component with id, ${componentId}`)
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
const secondHandleChange = (file) => {
|
|
33
|
+
setSecondFiles((prev) => {
|
|
34
|
+
return [...prev, file]
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const secondHandleRemove = (id) => {
|
|
39
|
+
setSecondFiles((prevItems) => prevItems.filter((item) => item.uuid !== id))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const secondHandleRemoveComponent = (componentId) => {
|
|
43
|
+
alert(`You want to remove component with id, ${componentId}`)
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
return (
|
|
32
|
-
<
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
display: 'flex',
|
|
50
|
+
justifyContent: 'space-between',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<NewFile
|
|
54
|
+
{...args}
|
|
55
|
+
removeFromDOM
|
|
56
|
+
componentId={2}
|
|
57
|
+
filesArray={files}
|
|
58
|
+
change={handleChange}
|
|
59
|
+
removeFile={handleRemove}
|
|
60
|
+
removeComponent={handleRemoveComponent}
|
|
61
|
+
formatError="Փաստաթղթի ֆորմատը չի համապատասխանում"
|
|
62
|
+
maxSizeError="Փաստաթուղթը գերազանցում է առավելագույն չափը"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<NewFile
|
|
66
|
+
{...args}
|
|
67
|
+
removeFromDOM
|
|
68
|
+
height="50px"
|
|
69
|
+
preview={false}
|
|
70
|
+
componentId={2}
|
|
71
|
+
filesArray={secondFiles}
|
|
72
|
+
change={secondHandleChange}
|
|
73
|
+
removeFile={secondHandleRemove}
|
|
74
|
+
removeComponent={secondHandleRemoveComponent}
|
|
75
|
+
formatError="Փաստաթղթի ֆորմատը չի համապատասխանում"
|
|
76
|
+
maxSizeError="Փաստաթուղթը գերազանցում է առավելագույն չափը"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
43
79
|
)
|
|
44
80
|
}
|
|
45
81
|
|
|
@@ -1,55 +1,236 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { compereConfigs } from './../../utils'
|
|
7
|
+
|
|
8
|
+
export const RadioDirectionMode = {
|
|
9
|
+
VERTICAL: 'vertical',
|
|
10
|
+
HORINZONTAL: 'horizontal',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Radio = ({
|
|
14
|
+
data,
|
|
15
|
+
size,
|
|
16
|
+
getData,
|
|
17
|
+
selected,
|
|
18
|
+
keyNames,
|
|
19
|
+
diraction,
|
|
20
|
+
className,
|
|
21
|
+
borderSize,
|
|
22
|
+
labelColor,
|
|
23
|
+
borderColor,
|
|
24
|
+
borderStyle,
|
|
25
|
+
labelFontSize,
|
|
26
|
+
labelFontFamily,
|
|
27
|
+
labelFontWeight,
|
|
28
|
+
labelLineHeight,
|
|
29
|
+
radioMarginRight,
|
|
30
|
+
borderActiveColor,
|
|
31
|
+
radioItemMarginRight,
|
|
32
|
+
radioItemMarginBottom,
|
|
33
|
+
}) => {
|
|
34
|
+
const configStyles = compereConfigs()
|
|
35
|
+
const classProps = classNames(className ? className : configStyles.RADIO.className)
|
|
36
|
+
const [innerData, setInnerData] = useState([])
|
|
37
|
+
const [radioInnerSize, setRadioInnerSize] = useState('')
|
|
38
|
+
const [radioInnerFormat, setRadioInnerFormat] = useState('')
|
|
39
|
+
const [innerSelectedData, setInnerSelectedData] = useState({})
|
|
40
|
+
|
|
41
|
+
const handleMouseEnter = (id, elemID) => {
|
|
42
|
+
const elem = document.querySelector(`#${elemID}`)
|
|
43
|
+
elem.style.backgroundColor =
|
|
44
|
+
id === innerSelectedData?.id
|
|
45
|
+
? borderActiveColor
|
|
46
|
+
? borderActiveColor
|
|
47
|
+
: configStyles.RADIO.borderActiveColor
|
|
48
|
+
: borderColor
|
|
49
|
+
? borderColor
|
|
50
|
+
: configStyles.RADIO.borderColor
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const handleMouseLeave = (id, elemID) => {
|
|
54
|
+
const elem = document.querySelector(`#${elemID}`)
|
|
55
|
+
elem.style.backgroundColor =
|
|
56
|
+
id === innerSelectedData?.id
|
|
57
|
+
? borderActiveColor
|
|
58
|
+
? borderActiveColor
|
|
59
|
+
: configStyles.RADIO.borderActiveColor
|
|
60
|
+
: 'transparent'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const handleChecked = (selItem) => {
|
|
64
|
+
setInnerSelectedData(selItem)
|
|
65
|
+
getData && getData(selItem)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (Array.isArray(data)) {
|
|
70
|
+
setInnerData(data)
|
|
71
|
+
} else {
|
|
72
|
+
setInnerData([data])
|
|
73
|
+
}
|
|
74
|
+
}, [data])
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
let radioSize = ''
|
|
78
|
+
let radioSizeFormat = ''
|
|
79
|
+
const checkSize = size || configStyles.RADIO.size
|
|
80
|
+
if (checkSize && typeof checkSize === 'string') {
|
|
81
|
+
if (checkSize.length > 0) {
|
|
82
|
+
checkSize.split('').map((item) => {
|
|
83
|
+
if (!isNaN(parseInt(item))) {
|
|
84
|
+
radioSize += item
|
|
85
|
+
} else {
|
|
86
|
+
radioSizeFormat += item
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (radioSize < '10') {
|
|
93
|
+
radioSize = '10'
|
|
94
|
+
}
|
|
95
|
+
setRadioInnerFormat(radioSizeFormat)
|
|
96
|
+
setRadioInnerSize(`${parseInt(radioSize) / 2}`)
|
|
97
|
+
}, [size, configStyles.RADIO.size])
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
setInnerSelectedData(selected)
|
|
101
|
+
}, [selected])
|
|
9
102
|
|
|
10
103
|
return (
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
104
|
+
<div
|
|
105
|
+
className={classProps}
|
|
106
|
+
style={{
|
|
107
|
+
display: 'flex',
|
|
108
|
+
flexDirection: diraction === 'horizontal' ? 'row' : 'column',
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{innerData &&
|
|
112
|
+
innerData.length > 0 &&
|
|
113
|
+
innerData.map((item, index) => {
|
|
114
|
+
const elemId = `TUI_${index}_radio_inner` + uuidv4()
|
|
115
|
+
return (
|
|
116
|
+
<div
|
|
117
|
+
key={`TUI_${index}_radio`}
|
|
118
|
+
style={{
|
|
119
|
+
display: 'flex',
|
|
120
|
+
cursor: item.disabled ? 'not-allowed' : 'pointer',
|
|
121
|
+
width: 'fit-content',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
marginRight:
|
|
124
|
+
diraction === 'horizontal'
|
|
125
|
+
? radioItemMarginRight
|
|
126
|
+
? radioItemMarginRight
|
|
127
|
+
: configStyles.RADIO.radioItemMarginRight
|
|
128
|
+
: '0px',
|
|
129
|
+
marginBottom:
|
|
130
|
+
diraction === 'vertical'
|
|
131
|
+
? radioItemMarginBottom
|
|
132
|
+
? radioItemMarginBottom
|
|
133
|
+
: configStyles.RADIO.radioItemMarginBottom
|
|
134
|
+
: '0px',
|
|
135
|
+
}}
|
|
136
|
+
onClick={item.disabled ? (_) => _ : () => handleChecked(item)}
|
|
137
|
+
onMouseEnter={() => handleMouseEnter(item[keyNames.id], elemId)}
|
|
138
|
+
onMouseLeave={() => handleMouseLeave(item[keyNames.id], elemId)}
|
|
139
|
+
>
|
|
140
|
+
<div
|
|
141
|
+
style={{
|
|
142
|
+
display: 'flex',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
borderRadius: '100%',
|
|
145
|
+
justifyContent: 'center',
|
|
146
|
+
width: size ? size : configStyles.RADIO.size,
|
|
147
|
+
height: size ? size : configStyles.RADIO.size,
|
|
148
|
+
marginRight: item.label
|
|
149
|
+
? radioMarginRight
|
|
150
|
+
? radioMarginRight
|
|
151
|
+
: configStyles.RADIO.radioMarginRight
|
|
152
|
+
: '0px',
|
|
153
|
+
border: `${borderSize ? borderSize : configStyles.RADIO.borderSize} ${
|
|
154
|
+
borderStyle ? borderStyle : configStyles.RADIO.borderStyle
|
|
155
|
+
}`,
|
|
156
|
+
borderColor:
|
|
157
|
+
item[keyNames.id] === innerSelectedData?.id
|
|
158
|
+
? borderActiveColor
|
|
159
|
+
? borderActiveColor
|
|
160
|
+
: configStyles.RADIO.borderActiveColor
|
|
161
|
+
: borderColor
|
|
162
|
+
? borderColor
|
|
163
|
+
: configStyles.RADIO.borderColor,
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<div
|
|
167
|
+
id={elemId}
|
|
168
|
+
style={{
|
|
169
|
+
borderRadius: '100%',
|
|
170
|
+
width: radioInnerSize + radioInnerFormat,
|
|
171
|
+
height: radioInnerSize + radioInnerFormat,
|
|
172
|
+
backgroundColor:
|
|
173
|
+
item[keyNames.id] === innerSelectedData?.id
|
|
174
|
+
? borderActiveColor
|
|
175
|
+
? borderActiveColor
|
|
176
|
+
: configStyles.RADIO.borderActiveColor
|
|
177
|
+
: 'transparent',
|
|
178
|
+
}}
|
|
179
|
+
></div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
{item[keyNames.label] ? (
|
|
183
|
+
<span
|
|
184
|
+
style={{
|
|
185
|
+
color: labelColor ? labelColor : configStyles.RADIO.labelColor,
|
|
186
|
+
fontSize: labelFontSize ? labelFontSize : configStyles.RADIO.labelFontSize,
|
|
187
|
+
fontFamily: labelFontFamily
|
|
188
|
+
? labelFontFamily
|
|
189
|
+
: configStyles.RADIO.labelFontFamily,
|
|
190
|
+
fontWeight: labelFontWeight
|
|
191
|
+
? labelFontWeight
|
|
192
|
+
: configStyles.RADIO.labelFontWeight,
|
|
193
|
+
lineHeight: labelLineHeight
|
|
194
|
+
? labelLineHeight
|
|
195
|
+
: configStyles.RADIO.labelLineHeight,
|
|
196
|
+
}}
|
|
197
|
+
onMouseEnter={() => handleMouseEnter(item[keyNames.id], elemId)}
|
|
198
|
+
onMouseLeave={() => handleMouseLeave(item[keyNames.id], elemId)}
|
|
199
|
+
>
|
|
200
|
+
{item[keyNames.label]}
|
|
201
|
+
</span>
|
|
202
|
+
) : (
|
|
203
|
+
''
|
|
204
|
+
)}
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
})}
|
|
208
|
+
</div>
|
|
35
209
|
)
|
|
36
210
|
}
|
|
37
211
|
|
|
38
212
|
Radio.propTypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
required: PropTypes.bool,
|
|
42
|
-
defaultChecked: PropTypes.bool,
|
|
43
|
-
disabled: PropTypes.bool,
|
|
44
|
-
name: PropTypes.string,
|
|
45
|
-
value: PropTypes.string,
|
|
46
|
-
jsonData: PropTypes.string,
|
|
47
|
-
label: PropTypes.string,
|
|
213
|
+
size: PropTypes.string,
|
|
214
|
+
selected: PropTypes.object,
|
|
48
215
|
keyNames: PropTypes.object,
|
|
216
|
+
className: PropTypes.string,
|
|
217
|
+
borderSize: PropTypes.string,
|
|
218
|
+
labelColor: PropTypes.string,
|
|
219
|
+
borderColor: PropTypes.string,
|
|
220
|
+
borderStyle: PropTypes.string,
|
|
221
|
+
labelFontSize: PropTypes.string,
|
|
222
|
+
labelFontFamily: PropTypes.string,
|
|
223
|
+
labelFontWeight: PropTypes.string,
|
|
224
|
+
labelLineHeight: PropTypes.string,
|
|
225
|
+
radioMarginRight: PropTypes.string,
|
|
226
|
+
getData: PropTypes.func.isRequired,
|
|
227
|
+
borderActiveColor: PropTypes.string,
|
|
228
|
+
radioItemMarginRight: PropTypes.string,
|
|
229
|
+
radioItemMarginBottom: PropTypes.string,
|
|
230
|
+
diraction: PropTypes.oneOf(Object.values(RadioDirectionMode)),
|
|
231
|
+
data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
49
232
|
}
|
|
50
233
|
|
|
51
234
|
Radio.defaultProps = {
|
|
52
|
-
|
|
53
|
-
jsonData:
|
|
54
|
-
'[{"value":"email", "name":"contact", "label":"Email", "id":"contactChoice1"}, {"value":"phone", "name":"contact", "label":"Phone", "id":"contactChoice2"}]',
|
|
235
|
+
diraction: 'vertical',
|
|
55
236
|
}
|
|
@@ -1,10 +1,59 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Radio } from '.'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Radio, RadioDirectionMode } from '.'
|
|
3
3
|
export default {
|
|
4
4
|
component: Radio,
|
|
5
5
|
title: 'Components/Radio',
|
|
6
|
+
argsType: {
|
|
7
|
+
direction: {
|
|
8
|
+
options: Object.values(RadioDirectionMode),
|
|
9
|
+
},
|
|
10
|
+
},
|
|
6
11
|
}
|
|
7
12
|
|
|
8
|
-
const
|
|
13
|
+
const radioData = [
|
|
14
|
+
{
|
|
15
|
+
id: 1,
|
|
16
|
+
disabled: false,
|
|
17
|
+
label: 'radio label 1',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 2,
|
|
21
|
+
disabled: false,
|
|
22
|
+
label: 'radio label 2',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 3,
|
|
26
|
+
disabled: true,
|
|
27
|
+
label: 'radio label 3',
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const selectedRadio = {
|
|
32
|
+
id: 3,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Template = (args) => {
|
|
36
|
+
const [innerData] = useState(radioData)
|
|
37
|
+
const [innerSelectedData, setInnerSelectedData] = useState(selectedRadio)
|
|
38
|
+
|
|
39
|
+
const handleGetData = (selected) => {
|
|
40
|
+
console.log(selected, 'selected - - -')
|
|
41
|
+
setInnerSelectedData(selected)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Radio
|
|
46
|
+
{...args}
|
|
47
|
+
data={innerData}
|
|
48
|
+
getData={handleGetData}
|
|
49
|
+
selected={innerSelectedData}
|
|
50
|
+
keyNames={{
|
|
51
|
+
id: 'id',
|
|
52
|
+
label: 'label',
|
|
53
|
+
disabled: 'disabled',
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
9
58
|
|
|
10
59
|
export const RadioButton = Template.bind({})
|
|
@@ -19,6 +19,8 @@ export const Table = ({
|
|
|
19
19
|
tableRowRadius,
|
|
20
20
|
tableRowBGColor,
|
|
21
21
|
tableRowBoxShadow,
|
|
22
|
+
tableColumnMaxWidth,
|
|
23
|
+
tableColumnMinWidth,
|
|
22
24
|
|
|
23
25
|
tHeadColor,
|
|
24
26
|
tHeadFamily,
|
|
@@ -41,6 +43,8 @@ export const Table = ({
|
|
|
41
43
|
|
|
42
44
|
className,
|
|
43
45
|
openListColor,
|
|
46
|
+
openListFontSize,
|
|
47
|
+
openListFontFamily,
|
|
44
48
|
hideBorder,
|
|
45
49
|
}) => {
|
|
46
50
|
const [body, setBody] = useState([])
|
|
@@ -618,6 +622,16 @@ export const Table = ({
|
|
|
618
622
|
: configStyles.TABLE.tHeadBorderRadius
|
|
619
623
|
: '0px'
|
|
620
624
|
}
|
|
625
|
+
tableColumnMinWidth={
|
|
626
|
+
tableColumnMinWidth
|
|
627
|
+
? tableColumnMinWidth
|
|
628
|
+
: configStyles.TABLE.tableColumnMinWidth
|
|
629
|
+
}
|
|
630
|
+
tableColumnMaxWidth={
|
|
631
|
+
tableColumnMaxWidth
|
|
632
|
+
? tableColumnMaxWidth
|
|
633
|
+
: configStyles.TABLE.tableColumnMaxWidth
|
|
634
|
+
}
|
|
621
635
|
/>
|
|
622
636
|
)
|
|
623
637
|
})}
|
|
@@ -667,6 +681,26 @@ export const Table = ({
|
|
|
667
681
|
openListColor={
|
|
668
682
|
openListColor ? openListColor : configStyles.TABLE.openListColor
|
|
669
683
|
}
|
|
684
|
+
tableColumnMinWidth={
|
|
685
|
+
tableColumnMinWidth
|
|
686
|
+
? tableColumnMinWidth
|
|
687
|
+
: configStyles.TABLE.tableColumnMinWidth
|
|
688
|
+
}
|
|
689
|
+
tableColumnMaxWidth={
|
|
690
|
+
tableColumnMaxWidth
|
|
691
|
+
? tableColumnMaxWidth
|
|
692
|
+
: configStyles.TABLE.tableColumnMaxWidth
|
|
693
|
+
}
|
|
694
|
+
openListFontSize={
|
|
695
|
+
openListFontSize
|
|
696
|
+
? openListFontSize
|
|
697
|
+
: configStyles.TABLE.openListFontSize
|
|
698
|
+
}
|
|
699
|
+
openListFontFamily={
|
|
700
|
+
openListFontFamily
|
|
701
|
+
? openListFontFamily
|
|
702
|
+
: configStyles.TABLE.openListFontFamily
|
|
703
|
+
}
|
|
670
704
|
handleCheckedBody={handleCheckedBody}
|
|
671
705
|
handleBodyActionClick={handleBodyActionClick}
|
|
672
706
|
handleMoreOptionsClick={handleMoreOptionsClick}
|
|
@@ -725,6 +759,8 @@ Table.propTypes = {
|
|
|
725
759
|
tableRowRadius: PropTypes.string,
|
|
726
760
|
tableRowBGColor: PropTypes.string,
|
|
727
761
|
tableRowBoxShadow: PropTypes.string,
|
|
762
|
+
tableColumnMaxWidth: PropTypes.string,
|
|
763
|
+
tableColumnMinWidth: PropTypes.string,
|
|
728
764
|
|
|
729
765
|
tHeadColor: PropTypes.string,
|
|
730
766
|
tHeadFamily: PropTypes.string,
|
|
@@ -747,5 +783,7 @@ Table.propTypes = {
|
|
|
747
783
|
className: PropTypes.string,
|
|
748
784
|
tBodyRowBorder: PropTypes.string,
|
|
749
785
|
openListColor: PropTypes.string,
|
|
786
|
+
openListFontSize: PropTypes.string,
|
|
787
|
+
openListFontFamily: PropTypes.string,
|
|
750
788
|
hideBorder: PropTypes.bool,
|
|
751
789
|
}
|