@xaypay/tui 0.0.118 → 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/dist/index.es.js +89 -21
- package/dist/index.js +89 -20
- 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/table/td.js +5 -4
- 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 +7 -0
- package/tui.config.js +7 -0
package/dist/index.es.js
CHANGED
|
@@ -526,6 +526,7 @@ const TD = ({
|
|
|
526
526
|
fontWeight: tBodyFontWeight,
|
|
527
527
|
minWidth: tableColumnMinWidth,
|
|
528
528
|
maxWidth: tableColumnMaxWidth,
|
|
529
|
+
whiteSpace: Array.isArray(item) ? 'nowrap' : 'wrap',
|
|
529
530
|
borderColor: hideBorder ? 'transparent' : '#eeeeee',
|
|
530
531
|
boxShadow: hasOwnerProperty(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : '',
|
|
531
532
|
borderTopLeftRadius: rowItem && innerIndex === 0 ? rowRadius : '0px',
|
|
@@ -602,9 +603,9 @@ const TD = ({
|
|
|
602
603
|
unCheckedColor: item.checkBox.unCheckedColor
|
|
603
604
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
604
605
|
style: {
|
|
605
|
-
flexShrink:
|
|
606
|
-
marginLeft: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '0px' : '
|
|
607
|
-
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '
|
|
606
|
+
flexShrink: 11,
|
|
607
|
+
marginLeft: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '0px' : '11px' : hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow') ? '11px' : '0px' : '0px',
|
|
608
|
+
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '11px' : '0px' : '0px' : '0px'
|
|
608
609
|
}
|
|
609
610
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
610
611
|
style: {
|
|
@@ -3600,8 +3601,8 @@ const Captcha = ({
|
|
|
3600
3601
|
className: classProps
|
|
3601
3602
|
}, label && /*#__PURE__*/React__default.createElement("p", {
|
|
3602
3603
|
style: {
|
|
3603
|
-
fontSize: size ? size : configStyles.
|
|
3604
|
-
color: color ? color : configStyles.
|
|
3604
|
+
fontSize: size ? size : configStyles.CAPTCHA.size,
|
|
3605
|
+
color: color ? color : configStyles.CAPTCHA.color
|
|
3605
3606
|
}
|
|
3606
3607
|
}, label), /*#__PURE__*/React__default.createElement("div", {
|
|
3607
3608
|
style: {
|
|
@@ -4135,6 +4136,7 @@ const NewFile = ({
|
|
|
4135
4136
|
change,
|
|
4136
4137
|
border,
|
|
4137
4138
|
upload,
|
|
4139
|
+
preview,
|
|
4138
4140
|
maxSize,
|
|
4139
4141
|
maxWidth,
|
|
4140
4142
|
disabled,
|
|
@@ -4158,6 +4160,12 @@ const NewFile = ({
|
|
|
4158
4160
|
maxSizeError,
|
|
4159
4161
|
progressColor,
|
|
4160
4162
|
noChoosenFile,
|
|
4163
|
+
uploadBtnFont,
|
|
4164
|
+
uploadBtnSize,
|
|
4165
|
+
uploadBtnLabel,
|
|
4166
|
+
uploadBtnColor,
|
|
4167
|
+
uploadBtnHeight,
|
|
4168
|
+
uploadBtnBackgroundColor,
|
|
4161
4169
|
fileExtensions,
|
|
4162
4170
|
listItemHeight,
|
|
4163
4171
|
backgroundColor,
|
|
@@ -4203,6 +4211,7 @@ const NewFile = ({
|
|
|
4203
4211
|
};
|
|
4204
4212
|
const handleRemoveFile = () => {
|
|
4205
4213
|
setImage(null);
|
|
4214
|
+
setSingleFile(null);
|
|
4206
4215
|
removeFile && removeFile(singleFile);
|
|
4207
4216
|
};
|
|
4208
4217
|
const handleUploadFiles = file => {
|
|
@@ -4456,7 +4465,7 @@ const NewFile = ({
|
|
|
4456
4465
|
fontSize: size ? size : configStyles.FILE.size,
|
|
4457
4466
|
fontWeight: weight ? weight : configStyles.FILE.weight
|
|
4458
4467
|
}
|
|
4459
|
-
}, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default.createElement(SvgPdf, null) : image === 'heif' || image === 'heic' ? /*#__PURE__*/React__default.createElement(SvgHeic, null) : /*#__PURE__*/React__default.createElement("img", {
|
|
4468
|
+
}, !multiple && image && preview ? image === 'pdf' ? /*#__PURE__*/React__default.createElement(SvgPdf, null) : image === 'heif' || image === 'heic' ? /*#__PURE__*/React__default.createElement(SvgHeic, null) : /*#__PURE__*/React__default.createElement("img", {
|
|
4460
4469
|
src: image,
|
|
4461
4470
|
style: {
|
|
4462
4471
|
display: 'block',
|
|
@@ -4467,7 +4476,7 @@ const NewFile = ({
|
|
|
4467
4476
|
height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.FILE.fileAreaImageHeight
|
|
4468
4477
|
},
|
|
4469
4478
|
alt: "file preview"
|
|
4470
|
-
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SvgUpload, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
|
|
4479
|
+
}) : preview ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SvgUpload, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
|
|
4471
4480
|
style: {
|
|
4472
4481
|
margin: '0px'
|
|
4473
4482
|
}
|
|
@@ -4483,7 +4492,35 @@ const NewFile = ({
|
|
|
4483
4492
|
style: {
|
|
4484
4493
|
margin: '0px'
|
|
4485
4494
|
}
|
|
4486
|
-
}, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, "\u0544\u0532 (", ' ', fileExtensions.toString().split(',').join(', '), " )")))
|
|
4495
|
+
}, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, " \u0544\u0532 (", ' ', fileExtensions.toString().split(',').join(', '), " )"))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
4496
|
+
style: {
|
|
4497
|
+
width: '100%',
|
|
4498
|
+
padding: '5px',
|
|
4499
|
+
display: 'flex',
|
|
4500
|
+
alignItems: 'center',
|
|
4501
|
+
boxSizing: 'border-box',
|
|
4502
|
+
justifyContent: 'space-between'
|
|
4503
|
+
}
|
|
4504
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
4505
|
+
contentWidth: true,
|
|
4506
|
+
onClick: _ => _,
|
|
4507
|
+
font: uploadBtnFont ? uploadBtnFont : configStyles.FILE.uploadBtnFont,
|
|
4508
|
+
size: uploadBtnSize ? uploadBtnSize : configStyles.FILE.uploadBtnSize,
|
|
4509
|
+
label: uploadBtnLabel ? uploadBtnLabel : configStyles.FILE.uploadBtnLabel,
|
|
4510
|
+
color: uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor,
|
|
4511
|
+
height: uploadBtnHeight ? uploadBtnHeight : configStyles.FILE.uploadBtnHeight,
|
|
4512
|
+
hoverColor: uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor,
|
|
4513
|
+
backgroundColor: uploadBtnBackgroundColor ? uploadBtnBackgroundColor : configStyles.FILE.uploadBtnBackgroundColor,
|
|
4514
|
+
backgroundHoverColor: uploadBtnBackgroundColor ? uploadBtnBackgroundColor : configStyles.FILE.uploadBtnBackgroundColor
|
|
4515
|
+
}), /*#__PURE__*/React__default.createElement("p", {
|
|
4516
|
+
style: {
|
|
4517
|
+
margin: '0px',
|
|
4518
|
+
marginLeft: '5px',
|
|
4519
|
+
overflow: 'hidden',
|
|
4520
|
+
whiteSpace: 'nowrap',
|
|
4521
|
+
textOverflow: 'ellipsis'
|
|
4522
|
+
}
|
|
4523
|
+
}, singleFile ? singleFile[0].name : /*#__PURE__*/React__default.createElement("span", null, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, " \u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )"))))), /*#__PURE__*/React__default.createElement("div", {
|
|
4487
4524
|
style: {
|
|
4488
4525
|
position: 'absolute',
|
|
4489
4526
|
top: '0px',
|
|
@@ -4543,6 +4580,7 @@ const NewFile = ({
|
|
|
4543
4580
|
NewFile.propTypes = {
|
|
4544
4581
|
or: PropTypes.string,
|
|
4545
4582
|
size: PropTypes.string,
|
|
4583
|
+
preview: PropTypes.bool,
|
|
4546
4584
|
label: PropTypes.string,
|
|
4547
4585
|
color: PropTypes.string,
|
|
4548
4586
|
height: PropTypes.string,
|
|
@@ -4553,6 +4591,7 @@ NewFile.propTypes = {
|
|
|
4553
4591
|
upload: PropTypes.string,
|
|
4554
4592
|
weight: PropTypes.number,
|
|
4555
4593
|
maxSize: PropTypes.number,
|
|
4594
|
+
maxWidth: PropTypes.string,
|
|
4556
4595
|
removeFile: PropTypes.func,
|
|
4557
4596
|
className: PropTypes.string,
|
|
4558
4597
|
errorSize: PropTypes.string,
|
|
@@ -4572,6 +4611,12 @@ NewFile.propTypes = {
|
|
|
4572
4611
|
progressColor: PropTypes.string,
|
|
4573
4612
|
deleteComponent: PropTypes.bool,
|
|
4574
4613
|
removeComponent: PropTypes.func,
|
|
4614
|
+
uploadBtnFont: PropTypes.string,
|
|
4615
|
+
uploadBtnSize: PropTypes.string,
|
|
4616
|
+
uploadBtnLabel: PropTypes.string,
|
|
4617
|
+
uploadBtnColor: PropTypes.string,
|
|
4618
|
+
uploadBtnHeight: PropTypes.string,
|
|
4619
|
+
uploadBtnBackgroundColor: PropTypes.string,
|
|
4575
4620
|
listItemHeight: PropTypes.string,
|
|
4576
4621
|
backgroundColor: PropTypes.string,
|
|
4577
4622
|
change: PropTypes.func.isRequired,
|
|
@@ -4599,6 +4644,7 @@ NewFile.propTypes = {
|
|
|
4599
4644
|
};
|
|
4600
4645
|
NewFile.defaultProps = {
|
|
4601
4646
|
maxSize: 10,
|
|
4647
|
+
preview: true,
|
|
4602
4648
|
timeForRemoveError: 5000,
|
|
4603
4649
|
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'heic']
|
|
4604
4650
|
};
|
|
@@ -4696,6 +4742,10 @@ Checkbox.defaultProps = {
|
|
|
4696
4742
|
var css_248z$4 = "textarea{-webkit-appearance:none}textarea::-webkit-scrollbar{width:6px}textarea::-webkit-scrollbar-track{background:#eee}textarea::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-track{border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px}textarea::-webkit-scrollbar-thumb{background:#d1d1d1}";
|
|
4697
4743
|
styleInject(css_248z$4);
|
|
4698
4744
|
|
|
4745
|
+
const PositionSide = {
|
|
4746
|
+
TOP: 'top',
|
|
4747
|
+
BOTTOM: 'bottom'
|
|
4748
|
+
};
|
|
4699
4749
|
const Textarea = ({
|
|
4700
4750
|
size,
|
|
4701
4751
|
label,
|
|
@@ -4730,7 +4780,8 @@ const Textarea = ({
|
|
|
4730
4780
|
borderFocusColor,
|
|
4731
4781
|
borderHoverColor,
|
|
4732
4782
|
labelMarginBottom,
|
|
4733
|
-
showCharacterCount
|
|
4783
|
+
showCharacterCount,
|
|
4784
|
+
characterCountPosition
|
|
4734
4785
|
}) => {
|
|
4735
4786
|
const [error, setError] = useState('');
|
|
4736
4787
|
const [isHover, setIsHover] = useState(false);
|
|
@@ -4770,18 +4821,16 @@ const Textarea = ({
|
|
|
4770
4821
|
if (!onChange) {
|
|
4771
4822
|
alert('Please add onChange function on Textarea component');
|
|
4772
4823
|
}
|
|
4773
|
-
if (value === '') {
|
|
4774
|
-
setError('');
|
|
4775
|
-
}
|
|
4776
|
-
setInnerValue(value);
|
|
4777
|
-
}, [value, onChange]);
|
|
4778
|
-
useEffect(() => {
|
|
4779
4824
|
if (errorMessage) {
|
|
4780
4825
|
setError(errorMessage);
|
|
4781
4826
|
} else {
|
|
4782
4827
|
setError('');
|
|
4783
4828
|
}
|
|
4784
|
-
|
|
4829
|
+
if (value === '') {
|
|
4830
|
+
setError('');
|
|
4831
|
+
}
|
|
4832
|
+
setInnerValue(value);
|
|
4833
|
+
}, [value, onChange, errorMessage]);
|
|
4785
4834
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
4786
4835
|
style: {
|
|
4787
4836
|
width: width ? width : configStyles.TEXTAREA.width
|
|
@@ -4802,7 +4851,7 @@ const Textarea = ({
|
|
|
4802
4851
|
display: labelDisplay ? labelDisplay : configStyles.TEXTAREA.labelDisplay,
|
|
4803
4852
|
fontWeight: labelWeight ? labelWeight : configStyles.TEXTAREA.labelWeight
|
|
4804
4853
|
}
|
|
4805
|
-
}, label, required && /*#__PURE__*/React__default.createElement("sup", null, /*#__PURE__*/React__default.createElement(SvgRequired, null))) : '', showCharacterCount && maxLength && /*#__PURE__*/React__default.createElement("span", {
|
|
4854
|
+
}, label, required && /*#__PURE__*/React__default.createElement("sup", null, /*#__PURE__*/React__default.createElement(SvgRequired, null))) : '', showCharacterCount && maxLength && characterCountPosition === 'top' && /*#__PURE__*/React__default.createElement("span", {
|
|
4806
4855
|
style: {
|
|
4807
4856
|
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
4808
4857
|
fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize
|
|
@@ -4835,14 +4884,29 @@ const Textarea = ({
|
|
|
4835
4884
|
placeholder: placeholder,
|
|
4836
4885
|
onMouseEnter: handleMouseEnter,
|
|
4837
4886
|
onMouseLeave: handleMouseLeave
|
|
4838
|
-
}),
|
|
4887
|
+
}), showCharacterCount && maxLength && characterCountPosition === 'bottom' && /*#__PURE__*/React__default.createElement("div", {
|
|
4888
|
+
style: {
|
|
4889
|
+
float: 'right'
|
|
4890
|
+
}
|
|
4891
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
4892
|
+
style: {
|
|
4893
|
+
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
4894
|
+
fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize
|
|
4895
|
+
}
|
|
4896
|
+
}, maxLength - value.length, " \u0576\u056B\u0577")), error ? /*#__PURE__*/React__default.createElement("div", {
|
|
4897
|
+
style: {
|
|
4898
|
+
clear: 'both',
|
|
4899
|
+
wordBreak: 'break-all',
|
|
4900
|
+
maxWidth: width ? width : configStyles.TEXTAREA.width
|
|
4901
|
+
}
|
|
4902
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
4839
4903
|
style: {
|
|
4840
4904
|
display: 'inline-block',
|
|
4841
4905
|
fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
|
|
4842
4906
|
color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor,
|
|
4843
4907
|
marginTop: marginTop ? marginTop : configStyles.TEXTAREA.marginTop
|
|
4844
4908
|
}
|
|
4845
|
-
}, error) : '');
|
|
4909
|
+
}, error)) : '');
|
|
4846
4910
|
};
|
|
4847
4911
|
Textarea.propTypes = {
|
|
4848
4912
|
size: PropTypes.string,
|
|
@@ -4878,7 +4942,11 @@ Textarea.propTypes = {
|
|
|
4878
4942
|
borderFocusColor: PropTypes.string,
|
|
4879
4943
|
borderHoverColor: PropTypes.string,
|
|
4880
4944
|
labelMarginBottom: PropTypes.string,
|
|
4881
|
-
onChange: PropTypes.func.isRequired
|
|
4945
|
+
onChange: PropTypes.func.isRequired,
|
|
4946
|
+
characterCountPosition: PropTypes.oneOf(Object.values(PositionSide))
|
|
4947
|
+
};
|
|
4948
|
+
Textarea.defaultProps = {
|
|
4949
|
+
characterCountPosition: 'top'
|
|
4882
4950
|
};
|
|
4883
4951
|
|
|
4884
4952
|
var css_248z$3 = "";
|
|
@@ -5734,4 +5802,4 @@ NewAutocomplete.defaultProps = {
|
|
|
5734
5802
|
disabled: false
|
|
5735
5803
|
};
|
|
5736
5804
|
|
|
5737
|
-
export { Autocomplate, Button, Captcha, Checkbox, DirectionMode, File, Input, InputTypes, Modal, NewAutocomplete, NewFile, Pagination, Radio, RadioDirectionMode, Select, Stepper, Table, Textarea, Toaster, Tooltip, Typography, TypographyType, toast };
|
|
5805
|
+
export { Autocomplate, Button, Captcha, Checkbox, DirectionMode, File, Input, InputTypes, Modal, NewAutocomplete, NewFile, Pagination, PositionSide, Radio, RadioDirectionMode, Select, Stepper, Table, Textarea, Toaster, Tooltip, Typography, TypographyType, toast };
|
package/dist/index.js
CHANGED
|
@@ -556,6 +556,7 @@ const TD = ({
|
|
|
556
556
|
fontWeight: tBodyFontWeight,
|
|
557
557
|
minWidth: tableColumnMinWidth,
|
|
558
558
|
maxWidth: tableColumnMaxWidth,
|
|
559
|
+
whiteSpace: Array.isArray(item) ? 'nowrap' : 'wrap',
|
|
559
560
|
borderColor: hideBorder ? 'transparent' : '#eeeeee',
|
|
560
561
|
boxShadow: hasOwnerProperty(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : '',
|
|
561
562
|
borderTopLeftRadius: rowItem && innerIndex === 0 ? rowRadius : '0px',
|
|
@@ -632,9 +633,9 @@ const TD = ({
|
|
|
632
633
|
unCheckedColor: item.checkBox.unCheckedColor
|
|
633
634
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
634
635
|
style: {
|
|
635
|
-
flexShrink:
|
|
636
|
-
marginLeft: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '0px' : '
|
|
637
|
-
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '
|
|
636
|
+
flexShrink: 11,
|
|
637
|
+
marginLeft: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '0px' : '11px' : hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow') ? '11px' : '0px' : '0px',
|
|
638
|
+
marginRight: hasOwnerProperty(item, 'contentList') && (!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true) ? hasOwnerProperty(item, 'rightArrow') ? item.rightArrow === true ? '11px' : '0px' : '0px' : '0px'
|
|
638
639
|
}
|
|
639
640
|
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
640
641
|
style: {
|
|
@@ -3630,8 +3631,8 @@ const Captcha = ({
|
|
|
3630
3631
|
className: classProps
|
|
3631
3632
|
}, label && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3632
3633
|
style: {
|
|
3633
|
-
fontSize: size ? size : configStyles.
|
|
3634
|
-
color: color ? color : configStyles.
|
|
3634
|
+
fontSize: size ? size : configStyles.CAPTCHA.size,
|
|
3635
|
+
color: color ? color : configStyles.CAPTCHA.color
|
|
3635
3636
|
}
|
|
3636
3637
|
}, label), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3637
3638
|
style: {
|
|
@@ -4165,6 +4166,7 @@ const NewFile = ({
|
|
|
4165
4166
|
change,
|
|
4166
4167
|
border,
|
|
4167
4168
|
upload,
|
|
4169
|
+
preview,
|
|
4168
4170
|
maxSize,
|
|
4169
4171
|
maxWidth,
|
|
4170
4172
|
disabled,
|
|
@@ -4188,6 +4190,12 @@ const NewFile = ({
|
|
|
4188
4190
|
maxSizeError,
|
|
4189
4191
|
progressColor,
|
|
4190
4192
|
noChoosenFile,
|
|
4193
|
+
uploadBtnFont,
|
|
4194
|
+
uploadBtnSize,
|
|
4195
|
+
uploadBtnLabel,
|
|
4196
|
+
uploadBtnColor,
|
|
4197
|
+
uploadBtnHeight,
|
|
4198
|
+
uploadBtnBackgroundColor,
|
|
4191
4199
|
fileExtensions,
|
|
4192
4200
|
listItemHeight,
|
|
4193
4201
|
backgroundColor,
|
|
@@ -4233,6 +4241,7 @@ const NewFile = ({
|
|
|
4233
4241
|
};
|
|
4234
4242
|
const handleRemoveFile = () => {
|
|
4235
4243
|
setImage(null);
|
|
4244
|
+
setSingleFile(null);
|
|
4236
4245
|
removeFile && removeFile(singleFile);
|
|
4237
4246
|
};
|
|
4238
4247
|
const handleUploadFiles = file => {
|
|
@@ -4486,7 +4495,7 @@ const NewFile = ({
|
|
|
4486
4495
|
fontSize: size ? size : configStyles.FILE.size,
|
|
4487
4496
|
fontWeight: weight ? weight : configStyles.FILE.weight
|
|
4488
4497
|
}
|
|
4489
|
-
}, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgPdf, null) : image === 'heif' || image === 'heic' ? /*#__PURE__*/React__default["default"].createElement(SvgHeic, null) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
4498
|
+
}, !multiple && image && preview ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgPdf, null) : image === 'heif' || image === 'heic' ? /*#__PURE__*/React__default["default"].createElement(SvgHeic, null) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
4490
4499
|
src: image,
|
|
4491
4500
|
style: {
|
|
4492
4501
|
display: 'block',
|
|
@@ -4497,7 +4506,7 @@ const NewFile = ({
|
|
|
4497
4506
|
height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.FILE.fileAreaImageHeight
|
|
4498
4507
|
},
|
|
4499
4508
|
alt: "file preview"
|
|
4500
|
-
}) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(SvgUpload, null)), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4509
|
+
}) : preview ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(SvgUpload, null)), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4501
4510
|
style: {
|
|
4502
4511
|
margin: '0px'
|
|
4503
4512
|
}
|
|
@@ -4513,7 +4522,35 @@ const NewFile = ({
|
|
|
4513
4522
|
style: {
|
|
4514
4523
|
margin: '0px'
|
|
4515
4524
|
}
|
|
4516
|
-
}, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, "\u0544\u0532 (", ' ', fileExtensions.toString().split(',').join(', '), " )")))
|
|
4525
|
+
}, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, " \u0544\u0532 (", ' ', fileExtensions.toString().split(',').join(', '), " )"))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4526
|
+
style: {
|
|
4527
|
+
width: '100%',
|
|
4528
|
+
padding: '5px',
|
|
4529
|
+
display: 'flex',
|
|
4530
|
+
alignItems: 'center',
|
|
4531
|
+
boxSizing: 'border-box',
|
|
4532
|
+
justifyContent: 'space-between'
|
|
4533
|
+
}
|
|
4534
|
+
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
4535
|
+
contentWidth: true,
|
|
4536
|
+
onClick: _ => _,
|
|
4537
|
+
font: uploadBtnFont ? uploadBtnFont : configStyles.FILE.uploadBtnFont,
|
|
4538
|
+
size: uploadBtnSize ? uploadBtnSize : configStyles.FILE.uploadBtnSize,
|
|
4539
|
+
label: uploadBtnLabel ? uploadBtnLabel : configStyles.FILE.uploadBtnLabel,
|
|
4540
|
+
color: uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor,
|
|
4541
|
+
height: uploadBtnHeight ? uploadBtnHeight : configStyles.FILE.uploadBtnHeight,
|
|
4542
|
+
hoverColor: uploadBtnColor ? uploadBtnColor : configStyles.FILE.uploadBtnColor,
|
|
4543
|
+
backgroundColor: uploadBtnBackgroundColor ? uploadBtnBackgroundColor : configStyles.FILE.uploadBtnBackgroundColor,
|
|
4544
|
+
backgroundHoverColor: uploadBtnBackgroundColor ? uploadBtnBackgroundColor : configStyles.FILE.uploadBtnBackgroundColor
|
|
4545
|
+
}), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
4546
|
+
style: {
|
|
4547
|
+
margin: '0px',
|
|
4548
|
+
marginLeft: '5px',
|
|
4549
|
+
overflow: 'hidden',
|
|
4550
|
+
whiteSpace: 'nowrap',
|
|
4551
|
+
textOverflow: 'ellipsis'
|
|
4552
|
+
}
|
|
4553
|
+
}, singleFile ? singleFile[0].name : /*#__PURE__*/React__default["default"].createElement("span", null, fileSizeText ? fileSizeText : configStyles.FILE.fileSizeText, " ", maxSize, " \u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )"))))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4517
4554
|
style: {
|
|
4518
4555
|
position: 'absolute',
|
|
4519
4556
|
top: '0px',
|
|
@@ -4573,6 +4610,7 @@ const NewFile = ({
|
|
|
4573
4610
|
NewFile.propTypes = {
|
|
4574
4611
|
or: PropTypes__default["default"].string,
|
|
4575
4612
|
size: PropTypes__default["default"].string,
|
|
4613
|
+
preview: PropTypes__default["default"].bool,
|
|
4576
4614
|
label: PropTypes__default["default"].string,
|
|
4577
4615
|
color: PropTypes__default["default"].string,
|
|
4578
4616
|
height: PropTypes__default["default"].string,
|
|
@@ -4583,6 +4621,7 @@ NewFile.propTypes = {
|
|
|
4583
4621
|
upload: PropTypes__default["default"].string,
|
|
4584
4622
|
weight: PropTypes__default["default"].number,
|
|
4585
4623
|
maxSize: PropTypes__default["default"].number,
|
|
4624
|
+
maxWidth: PropTypes__default["default"].string,
|
|
4586
4625
|
removeFile: PropTypes__default["default"].func,
|
|
4587
4626
|
className: PropTypes__default["default"].string,
|
|
4588
4627
|
errorSize: PropTypes__default["default"].string,
|
|
@@ -4602,6 +4641,12 @@ NewFile.propTypes = {
|
|
|
4602
4641
|
progressColor: PropTypes__default["default"].string,
|
|
4603
4642
|
deleteComponent: PropTypes__default["default"].bool,
|
|
4604
4643
|
removeComponent: PropTypes__default["default"].func,
|
|
4644
|
+
uploadBtnFont: PropTypes__default["default"].string,
|
|
4645
|
+
uploadBtnSize: PropTypes__default["default"].string,
|
|
4646
|
+
uploadBtnLabel: PropTypes__default["default"].string,
|
|
4647
|
+
uploadBtnColor: PropTypes__default["default"].string,
|
|
4648
|
+
uploadBtnHeight: PropTypes__default["default"].string,
|
|
4649
|
+
uploadBtnBackgroundColor: PropTypes__default["default"].string,
|
|
4605
4650
|
listItemHeight: PropTypes__default["default"].string,
|
|
4606
4651
|
backgroundColor: PropTypes__default["default"].string,
|
|
4607
4652
|
change: PropTypes__default["default"].func.isRequired,
|
|
@@ -4629,6 +4674,7 @@ NewFile.propTypes = {
|
|
|
4629
4674
|
};
|
|
4630
4675
|
NewFile.defaultProps = {
|
|
4631
4676
|
maxSize: 10,
|
|
4677
|
+
preview: true,
|
|
4632
4678
|
timeForRemoveError: 5000,
|
|
4633
4679
|
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf', 'heic']
|
|
4634
4680
|
};
|
|
@@ -4726,6 +4772,10 @@ Checkbox.defaultProps = {
|
|
|
4726
4772
|
var css_248z$4 = "textarea{-webkit-appearance:none}textarea::-webkit-scrollbar{width:6px}textarea::-webkit-scrollbar-track{background:#eee}textarea::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-track{border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px}textarea::-webkit-scrollbar-thumb{background:#d1d1d1}";
|
|
4727
4773
|
styleInject(css_248z$4);
|
|
4728
4774
|
|
|
4775
|
+
const PositionSide = {
|
|
4776
|
+
TOP: 'top',
|
|
4777
|
+
BOTTOM: 'bottom'
|
|
4778
|
+
};
|
|
4729
4779
|
const Textarea = ({
|
|
4730
4780
|
size,
|
|
4731
4781
|
label,
|
|
@@ -4760,7 +4810,8 @@ const Textarea = ({
|
|
|
4760
4810
|
borderFocusColor,
|
|
4761
4811
|
borderHoverColor,
|
|
4762
4812
|
labelMarginBottom,
|
|
4763
|
-
showCharacterCount
|
|
4813
|
+
showCharacterCount,
|
|
4814
|
+
characterCountPosition
|
|
4764
4815
|
}) => {
|
|
4765
4816
|
const [error, setError] = React.useState('');
|
|
4766
4817
|
const [isHover, setIsHover] = React.useState(false);
|
|
@@ -4800,18 +4851,16 @@ const Textarea = ({
|
|
|
4800
4851
|
if (!onChange) {
|
|
4801
4852
|
alert('Please add onChange function on Textarea component');
|
|
4802
4853
|
}
|
|
4803
|
-
if (value === '') {
|
|
4804
|
-
setError('');
|
|
4805
|
-
}
|
|
4806
|
-
setInnerValue(value);
|
|
4807
|
-
}, [value, onChange]);
|
|
4808
|
-
React.useEffect(() => {
|
|
4809
4854
|
if (errorMessage) {
|
|
4810
4855
|
setError(errorMessage);
|
|
4811
4856
|
} else {
|
|
4812
4857
|
setError('');
|
|
4813
4858
|
}
|
|
4814
|
-
|
|
4859
|
+
if (value === '') {
|
|
4860
|
+
setError('');
|
|
4861
|
+
}
|
|
4862
|
+
setInnerValue(value);
|
|
4863
|
+
}, [value, onChange, errorMessage]);
|
|
4815
4864
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4816
4865
|
style: {
|
|
4817
4866
|
width: width ? width : configStyles.TEXTAREA.width
|
|
@@ -4832,7 +4881,7 @@ const Textarea = ({
|
|
|
4832
4881
|
display: labelDisplay ? labelDisplay : configStyles.TEXTAREA.labelDisplay,
|
|
4833
4882
|
fontWeight: labelWeight ? labelWeight : configStyles.TEXTAREA.labelWeight
|
|
4834
4883
|
}
|
|
4835
|
-
}, label, required && /*#__PURE__*/React__default["default"].createElement("sup", null, /*#__PURE__*/React__default["default"].createElement(SvgRequired, null))) : '', showCharacterCount && maxLength && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4884
|
+
}, label, required && /*#__PURE__*/React__default["default"].createElement("sup", null, /*#__PURE__*/React__default["default"].createElement(SvgRequired, null))) : '', showCharacterCount && maxLength && characterCountPosition === 'top' && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4836
4885
|
style: {
|
|
4837
4886
|
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
4838
4887
|
fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize
|
|
@@ -4865,14 +4914,29 @@ const Textarea = ({
|
|
|
4865
4914
|
placeholder: placeholder,
|
|
4866
4915
|
onMouseEnter: handleMouseEnter,
|
|
4867
4916
|
onMouseLeave: handleMouseLeave
|
|
4868
|
-
}),
|
|
4917
|
+
}), showCharacterCount && maxLength && characterCountPosition === 'bottom' && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4918
|
+
style: {
|
|
4919
|
+
float: 'right'
|
|
4920
|
+
}
|
|
4921
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4922
|
+
style: {
|
|
4923
|
+
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
4924
|
+
fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize
|
|
4925
|
+
}
|
|
4926
|
+
}, maxLength - value.length, " \u0576\u056B\u0577")), error ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4927
|
+
style: {
|
|
4928
|
+
clear: 'both',
|
|
4929
|
+
wordBreak: 'break-all',
|
|
4930
|
+
maxWidth: width ? width : configStyles.TEXTAREA.width
|
|
4931
|
+
}
|
|
4932
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4869
4933
|
style: {
|
|
4870
4934
|
display: 'inline-block',
|
|
4871
4935
|
fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
|
|
4872
4936
|
color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor,
|
|
4873
4937
|
marginTop: marginTop ? marginTop : configStyles.TEXTAREA.marginTop
|
|
4874
4938
|
}
|
|
4875
|
-
}, error) : '');
|
|
4939
|
+
}, error)) : '');
|
|
4876
4940
|
};
|
|
4877
4941
|
Textarea.propTypes = {
|
|
4878
4942
|
size: PropTypes__default["default"].string,
|
|
@@ -4908,7 +4972,11 @@ Textarea.propTypes = {
|
|
|
4908
4972
|
borderFocusColor: PropTypes__default["default"].string,
|
|
4909
4973
|
borderHoverColor: PropTypes__default["default"].string,
|
|
4910
4974
|
labelMarginBottom: PropTypes__default["default"].string,
|
|
4911
|
-
onChange: PropTypes__default["default"].func.isRequired
|
|
4975
|
+
onChange: PropTypes__default["default"].func.isRequired,
|
|
4976
|
+
characterCountPosition: PropTypes__default["default"].oneOf(Object.values(PositionSide))
|
|
4977
|
+
};
|
|
4978
|
+
Textarea.defaultProps = {
|
|
4979
|
+
characterCountPosition: 'top'
|
|
4912
4980
|
};
|
|
4913
4981
|
|
|
4914
4982
|
var css_248z$3 = "";
|
|
@@ -5776,6 +5844,7 @@ exports.Modal = Modal;
|
|
|
5776
5844
|
exports.NewAutocomplete = NewAutocomplete;
|
|
5777
5845
|
exports.NewFile = NewFile;
|
|
5778
5846
|
exports.Pagination = Pagination;
|
|
5847
|
+
exports.PositionSide = PositionSide;
|
|
5779
5848
|
exports.Radio = Radio;
|
|
5780
5849
|
exports.RadioDirectionMode = RadioDirectionMode;
|
|
5781
5850
|
exports.Select = Select;
|
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
|
|
|
@@ -90,6 +90,7 @@ const TD = ({
|
|
|
90
90
|
fontWeight: tBodyFontWeight,
|
|
91
91
|
minWidth: tableColumnMinWidth,
|
|
92
92
|
maxWidth: tableColumnMaxWidth,
|
|
93
|
+
whiteSpace: Array.isArray(item) ? 'nowrap' : 'wrap',
|
|
93
94
|
borderColor: hideBorder ? 'transparent' : '#eeeeee',
|
|
94
95
|
boxShadow: hasOwnerProperty(item, 'colorStatus') ? `inset 3px 0px 0px 0px ${item.colorStatus}` : '',
|
|
95
96
|
borderTopLeftRadius: rowItem && innerIndex === 0 ? rowRadius : '0px',
|
|
@@ -219,16 +220,16 @@ const TD = ({
|
|
|
219
220
|
|
|
220
221
|
<div
|
|
221
222
|
style={{
|
|
222
|
-
flexShrink:
|
|
223
|
+
flexShrink: 11,
|
|
223
224
|
marginLeft:
|
|
224
225
|
hasOwnerProperty(item, 'contentList') &&
|
|
225
226
|
(!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true)
|
|
226
227
|
? hasOwnerProperty(item, 'rightArrow')
|
|
227
228
|
? item.rightArrow === true
|
|
228
229
|
? '0px'
|
|
229
|
-
: '
|
|
230
|
+
: '11px'
|
|
230
231
|
: hasOwnerProperty(item, 'closeArrow') || hasOwnerProperty(item, 'openArrow')
|
|
231
|
-
? '
|
|
232
|
+
? '11px'
|
|
232
233
|
: '0px'
|
|
233
234
|
: '0px',
|
|
234
235
|
marginRight:
|
|
@@ -236,7 +237,7 @@ const TD = ({
|
|
|
236
237
|
(!hasOwnerProperty(item, 'hideArrow') || item.hideArrow !== true)
|
|
237
238
|
? hasOwnerProperty(item, 'rightArrow')
|
|
238
239
|
? item.rightArrow === true
|
|
239
|
-
? '
|
|
240
|
+
? '11px'
|
|
240
241
|
: '0px'
|
|
241
242
|
: '0px'
|
|
242
243
|
: '0px',
|
|
@@ -7,6 +7,11 @@ import SvgRequired from './../icon/Required'
|
|
|
7
7
|
|
|
8
8
|
import './textarea.module.css'
|
|
9
9
|
|
|
10
|
+
export const PositionSide = {
|
|
11
|
+
TOP: 'top',
|
|
12
|
+
BOTTOM: 'bottom',
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
export const Textarea = ({
|
|
11
16
|
size,
|
|
12
17
|
label,
|
|
@@ -42,6 +47,7 @@ export const Textarea = ({
|
|
|
42
47
|
borderHoverColor,
|
|
43
48
|
labelMarginBottom,
|
|
44
49
|
showCharacterCount,
|
|
50
|
+
characterCountPosition,
|
|
45
51
|
}) => {
|
|
46
52
|
const [error, setError] = useState('')
|
|
47
53
|
const [isHover, setIsHover] = useState(false)
|
|
@@ -90,20 +96,18 @@ export const Textarea = ({
|
|
|
90
96
|
alert('Please add onChange function on Textarea component')
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
if (value === '') {
|
|
94
|
-
setError('')
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setInnerValue(value)
|
|
98
|
-
}, [value, onChange])
|
|
99
|
-
|
|
100
|
-
useEffect(() => {
|
|
101
99
|
if (errorMessage) {
|
|
102
100
|
setError(errorMessage)
|
|
103
101
|
} else {
|
|
104
102
|
setError('')
|
|
105
103
|
}
|
|
106
|
-
|
|
104
|
+
|
|
105
|
+
if (value === '') {
|
|
106
|
+
setError('')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
setInnerValue(value)
|
|
110
|
+
}, [value, onChange, errorMessage])
|
|
107
111
|
|
|
108
112
|
return (
|
|
109
113
|
<div
|
|
@@ -141,7 +145,7 @@ export const Textarea = ({
|
|
|
141
145
|
''
|
|
142
146
|
)}
|
|
143
147
|
|
|
144
|
-
{showCharacterCount && maxLength && (
|
|
148
|
+
{showCharacterCount && maxLength && characterCountPosition === 'top' && (
|
|
145
149
|
<span
|
|
146
150
|
style={{
|
|
147
151
|
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
@@ -195,17 +199,42 @@ export const Textarea = ({
|
|
|
195
199
|
onMouseEnter={handleMouseEnter}
|
|
196
200
|
onMouseLeave={handleMouseLeave}
|
|
197
201
|
></textarea>
|
|
202
|
+
{showCharacterCount && maxLength && characterCountPosition === 'bottom' && (
|
|
203
|
+
<div
|
|
204
|
+
style={{
|
|
205
|
+
float: 'right',
|
|
206
|
+
}}
|
|
207
|
+
>
|
|
208
|
+
<span
|
|
209
|
+
style={{
|
|
210
|
+
color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
|
|
211
|
+
fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize,
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
{maxLength - value.length} նիշ
|
|
215
|
+
</span>
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
|
|
198
219
|
{error ? (
|
|
199
|
-
<
|
|
220
|
+
<div
|
|
200
221
|
style={{
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
marginTop: marginTop ? marginTop : configStyles.TEXTAREA.marginTop,
|
|
222
|
+
clear: 'both',
|
|
223
|
+
wordBreak: 'break-all',
|
|
224
|
+
maxWidth: width ? width : configStyles.TEXTAREA.width,
|
|
205
225
|
}}
|
|
206
226
|
>
|
|
207
|
-
|
|
208
|
-
|
|
227
|
+
<span
|
|
228
|
+
style={{
|
|
229
|
+
display: 'inline-block',
|
|
230
|
+
fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
|
|
231
|
+
color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor,
|
|
232
|
+
marginTop: marginTop ? marginTop : configStyles.TEXTAREA.marginTop,
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{error}
|
|
236
|
+
</span>
|
|
237
|
+
</div>
|
|
209
238
|
) : (
|
|
210
239
|
''
|
|
211
240
|
)}
|
|
@@ -248,4 +277,9 @@ Textarea.propTypes = {
|
|
|
248
277
|
borderHoverColor: PropTypes.string,
|
|
249
278
|
labelMarginBottom: PropTypes.string,
|
|
250
279
|
onChange: PropTypes.func.isRequired,
|
|
280
|
+
characterCountPosition: PropTypes.oneOf(Object.values(PositionSide)),
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
Textarea.defaultProps = {
|
|
284
|
+
characterCountPosition: 'top',
|
|
251
285
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { Textarea } from '.'
|
|
2
|
+
import { Textarea, PositionSide } from '.'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
Comment: Textarea,
|
|
6
6
|
title: 'Components/Textarea',
|
|
7
|
+
argsType: {
|
|
8
|
+
characterCountPosition: {
|
|
9
|
+
options: Object.values(PositionSide),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
const Template = (args) => {
|
|
@@ -47,4 +52,5 @@ Default.args = {
|
|
|
47
52
|
showCharacterCount: true, // for showing textarea character count
|
|
48
53
|
borderHoverColor: '#3C393E',
|
|
49
54
|
borderFocusColor: '#00236A',
|
|
55
|
+
characterCountPosition: 'top',
|
|
50
56
|
}
|
|
@@ -116,9 +116,47 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
116
116
|
|
|
117
117
|
# Changelog
|
|
118
118
|
|
|
119
|
-
### v0.0.
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
### v0.0.119
|
|
120
|
+
1. Bugfix: white space
|
|
121
|
+
2. Change: Textarea show error message logic
|
|
122
|
+
3. Change: errorMessage location in useEffect
|
|
123
|
+
4. Add: posibility to change character coount position in textarea component
|
|
124
|
+
5. Add: posibility use NewFile component without preview mode
|
|
125
|
+
6. Add: props preview for NewFile, uploadBtnFont, uploadBtnSize, uploadBtnLabel, uploadBtnColor, uploadBtnHeight, uploadBtnBackgroundColor
|
|
126
|
+
7. Change: captcha to uppercase, Add: second file component in story
|
|
127
|
+
|
|
128
|
+
### v0.0.118
|
|
129
|
+
|
|
130
|
+
1. Change: Radio component implementation
|
|
131
|
+
2. Refactor: structure Radio component, Add: possibility custom styles
|
|
132
|
+
3. Add: props on table component, for min max width, open list font-size and font family
|
|
133
|
+
4. Remove: dots from table open list
|
|
134
|
+
|
|
135
|
+
### v0.0.117
|
|
136
|
+
1. Add: call toString function on every content with value 0 in table component
|
|
137
|
+
2. Add: font family prop on input, select, newautocomplete, textarea components
|
|
138
|
+
3. Fix: configStyles declaration position
|
|
139
|
+
|
|
140
|
+
### v0.0.116
|
|
141
|
+
1. Change: property check in Select component
|
|
142
|
+
2. Add: CheckboxGroup component
|
|
143
|
+
3. Change: SingleCheckbox component, check props in TUI usage and configuration sections
|
|
144
|
+
4. Add: hover logic on modal component for show zoom icon
|
|
145
|
+
5. Change: show content logic in table component
|
|
146
|
+
6. Set: prop type array or object in checkbox component
|
|
147
|
+
7. Add: hideBorder boolean prop on table component for hide borders
|
|
148
|
+
8. Set: css outline none, on button component
|
|
149
|
+
9. Change: Proptypes.oneOf to Proptypes.oneOfType for checkbox
|
|
150
|
+
10. Refactor: className props for all components
|
|
151
|
+
11. Change: table body textAlign show logic, Add: the same logic for header
|
|
152
|
+
12. Add: tHeadTextAlign prop in propTypes object in Table component
|
|
153
|
+
13. Change: configStyles variable declaration place
|
|
154
|
+
14. Add: errorSize prop in config just for set value by default
|
|
155
|
+
15. Add: posibility on table to show row as items, see props in configuration tab
|
|
156
|
+
|
|
157
|
+
### v0.0.115
|
|
158
|
+
Refactor: table check sortingArrows property logic
|
|
159
|
+
Add: maxLength prop to global config for input component, set highest value by default 255 characters
|
|
122
160
|
|
|
123
161
|
### v0.0.60
|
|
124
162
|
|
|
@@ -128,4 +166,7 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
128
166
|
4. Change: select prop jsonData to options always get an array
|
|
129
167
|
5. Add: new functionality on select component, multiple mode
|
|
130
168
|
|
|
169
|
+
### v0.0.59
|
|
170
|
+
|
|
171
|
+
1. Change: errorMesage to errorMessage (in all components)
|
|
131
172
|
|
|
@@ -589,6 +589,13 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
589
589
|
putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
|
|
590
590
|
hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
|
|
591
591
|
listItemBackgroundErrorColor: 'rgba(255, 0, 0, 0.7)', // for file multiple mode error background color
|
|
592
|
+
|
|
593
|
+
uploadBtnFont: 'Arial', // for button font familty
|
|
594
|
+
uploadBtnSize: '14px', // for button font size
|
|
595
|
+
uploadBtnLabel: 'Բեռնել', // for button text
|
|
596
|
+
uploadBtnColor: '#fff', // for button color
|
|
597
|
+
uploadBtnHeight: '30px', // for button height
|
|
598
|
+
uploadBtnBackgroundColor: 'rgba(0, 35, 106, 1)' // for button background color
|
|
592
599
|
}
|
|
593
600
|
```
|
|
594
601
|
|
package/tui.config.js
CHANGED
|
@@ -388,6 +388,13 @@ module.exports = {
|
|
|
388
388
|
putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
|
|
389
389
|
hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
|
|
390
390
|
listItemBackgroundErrorColor: '#F6F8F8', // for file multiple mode error background color
|
|
391
|
+
|
|
392
|
+
uploadBtnFont: 'Arial', // for button font familty
|
|
393
|
+
uploadBtnSize: '14px', // for button font size
|
|
394
|
+
uploadBtnLabel: 'Բեռնել', // for button text
|
|
395
|
+
uploadBtnColor: '#fff', // for button color
|
|
396
|
+
uploadBtnHeight: '30px', // for button height
|
|
397
|
+
uploadBtnBackgroundColor: 'rgba(0, 35, 106, 1)' // for button background color
|
|
391
398
|
},
|
|
392
399
|
// default properties for <Modal /> component
|
|
393
400
|
MODAL: {
|