@xaypay/tui 0.0.58 → 0.0.60
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 +124 -50
- package/dist/index.js +124 -49
- package/package.json +1 -1
- package/src/assets/icons/checkbox-checked.svg +3 -0
- package/src/assets/icons/checkbox-unchecked.svg +3 -0
- package/src/components/autocomplate/index.js +4 -4
- package/src/components/file/index.js +5 -12
- package/src/components/input/index.js +10 -1
- package/src/components/select/index.js +91 -25
- package/src/components/select/select.stories.js +11 -3
- package/src/components/selectCheckbox/index.js +20 -0
- package/src/components/selectCheckbox/selectCheckbox.stories.js +10 -0
- package/src/components/table/index.js +1 -1
- package/src/components/typography/index.js +0 -6
- package/src/index.js +2 -1
- package/src/stories/changelog.stories.mdx +14 -1
- package/src/stories/configuration.stories.mdx +7 -22
- package/tui.config.js +6 -21
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ const File = ({
|
|
|
57
57
|
onChange,
|
|
58
58
|
className,
|
|
59
59
|
defaultData,
|
|
60
|
-
|
|
60
|
+
errorMessage,
|
|
61
61
|
fileExtensions,
|
|
62
62
|
...props
|
|
63
63
|
}) => {
|
|
@@ -108,12 +108,6 @@ const File = ({
|
|
|
108
108
|
setFileName('no selected file');
|
|
109
109
|
document.querySelector(`.${name}`).value = "";
|
|
110
110
|
};
|
|
111
|
-
React.useEffect(() => {
|
|
112
|
-
return () => {
|
|
113
|
-
setError('');
|
|
114
|
-
setImage(null);
|
|
115
|
-
};
|
|
116
|
-
}, []);
|
|
117
111
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
118
112
|
className: `${styles$b['file-form-title']} ile-form-title-rem`
|
|
119
113
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
@@ -124,7 +118,7 @@ const File = ({
|
|
|
124
118
|
className: classnames__default["default"](`${styles$b['file-form-wrap']} file-form-wrap-rem`, image ? styles$b['active'] : '')
|
|
125
119
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
126
120
|
onChange: e => console.log(e),
|
|
127
|
-
className: `${styles$b['file-form']} file-form-rem ${
|
|
121
|
+
className: `${styles$b['file-form']} file-form-rem ${errorMessage ? styles$b['error'] : ''}`,
|
|
128
122
|
onClick: () => document.querySelector(`.${name}`).click()
|
|
129
123
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
130
124
|
hidden: true,
|
|
@@ -153,11 +147,11 @@ const File = ({
|
|
|
153
147
|
onClick: handleRemoveFile
|
|
154
148
|
}, /*#__PURE__*/React__default["default"].createElement("i", {
|
|
155
149
|
className: "icon-delete"
|
|
156
|
-
})),
|
|
150
|
+
})), errorMessage || error ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
157
151
|
style: {
|
|
158
152
|
color: 'red'
|
|
159
153
|
}
|
|
160
|
-
},
|
|
154
|
+
}, errorMessage || error) : null));
|
|
161
155
|
};
|
|
162
156
|
File.propTypes = {
|
|
163
157
|
label: PropTypes__default["default"].string,
|
|
@@ -166,7 +160,7 @@ File.propTypes = {
|
|
|
166
160
|
onChange: PropTypes__default["default"].func,
|
|
167
161
|
maxSize: PropTypes__default["default"].number,
|
|
168
162
|
className: PropTypes__default["default"].string,
|
|
169
|
-
|
|
163
|
+
errorMessage: PropTypes__default["default"].string,
|
|
170
164
|
defaultData: PropTypes__default["default"].object,
|
|
171
165
|
fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
|
|
172
166
|
};
|
|
@@ -358,7 +352,7 @@ Table.propTypes = {
|
|
|
358
352
|
Table.defaultProps = {
|
|
359
353
|
className: "",
|
|
360
354
|
onChange: undefined,
|
|
361
|
-
|
|
355
|
+
errorMessage: "",
|
|
362
356
|
config: {
|
|
363
357
|
isHeader: true,
|
|
364
358
|
isCheckbox: {
|
|
@@ -415,8 +409,6 @@ const Typography = ({
|
|
|
415
409
|
radius,
|
|
416
410
|
border,
|
|
417
411
|
cursor,
|
|
418
|
-
margin,
|
|
419
|
-
padding,
|
|
420
412
|
variant,
|
|
421
413
|
onClick,
|
|
422
414
|
children,
|
|
@@ -453,9 +445,7 @@ const Typography = ({
|
|
|
453
445
|
cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
|
|
454
446
|
borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
|
|
455
447
|
fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
|
|
456
|
-
margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
|
|
457
448
|
fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
|
|
458
|
-
padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
|
|
459
449
|
textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
|
|
460
450
|
textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
|
|
461
451
|
fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
|
|
@@ -481,9 +471,7 @@ Typography.propTypes = {
|
|
|
481
471
|
weight: PropTypes__default["default"].string,
|
|
482
472
|
border: PropTypes__default["default"].string,
|
|
483
473
|
cursor: PropTypes__default["default"].string,
|
|
484
|
-
margin: PropTypes__default["default"].string,
|
|
485
474
|
radius: PropTypes__default["default"].string,
|
|
486
|
-
padding: PropTypes__default["default"].string,
|
|
487
475
|
textAlign: PropTypes__default["default"].string,
|
|
488
476
|
className: PropTypes__default["default"].string,
|
|
489
477
|
fontStyle: PropTypes__default["default"].string,
|
|
@@ -610,6 +598,7 @@ const Input = ({
|
|
|
610
598
|
errorZindex,
|
|
611
599
|
errorBottom,
|
|
612
600
|
labelWeight,
|
|
601
|
+
phoneDisplay,
|
|
613
602
|
errorMessage,
|
|
614
603
|
autoComplete,
|
|
615
604
|
labelDisplay,
|
|
@@ -617,10 +606,12 @@ const Input = ({
|
|
|
617
606
|
boxShadowHover,
|
|
618
607
|
errorClassName,
|
|
619
608
|
errorAnimation,
|
|
609
|
+
phoneAlignItems,
|
|
620
610
|
errorLineHeight,
|
|
621
611
|
labelLineHeight,
|
|
622
612
|
backgroundColor,
|
|
623
613
|
labelMarginBottom,
|
|
614
|
+
phoneJustifyContent,
|
|
624
615
|
errorAnimationDuration,
|
|
625
616
|
...props
|
|
626
617
|
}) => {
|
|
@@ -702,8 +693,11 @@ const Input = ({
|
|
|
702
693
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
703
694
|
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
704
695
|
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
705
|
-
|
|
706
|
-
|
|
696
|
+
display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
|
|
697
|
+
alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
|
|
698
|
+
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
699
|
+
justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
|
|
700
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
707
701
|
}
|
|
708
702
|
}, "+374") : '', /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
|
|
709
703
|
value: value,
|
|
@@ -784,6 +778,7 @@ Input.propTypes = {
|
|
|
784
778
|
errorBottom: PropTypes__default["default"].string,
|
|
785
779
|
labelWeight: PropTypes__default["default"].string,
|
|
786
780
|
errorMessage: PropTypes__default["default"].string,
|
|
781
|
+
phoneDisplay: PropTypes__default["default"].string,
|
|
787
782
|
autoComplete: PropTypes__default["default"].string,
|
|
788
783
|
errorAnimation: PropTypes__default["default"].bool,
|
|
789
784
|
labelDisplay: PropTypes__default["default"].string,
|
|
@@ -791,9 +786,11 @@ Input.propTypes = {
|
|
|
791
786
|
boxShadowHover: PropTypes__default["default"].string,
|
|
792
787
|
errorClassName: PropTypes__default["default"].string,
|
|
793
788
|
backgroundColor: PropTypes__default["default"].string,
|
|
789
|
+
phoneAlignItems: PropTypes__default["default"].string,
|
|
794
790
|
errorLineHeight: PropTypes__default["default"].string,
|
|
795
791
|
labelLineHeight: PropTypes__default["default"].string,
|
|
796
792
|
labelMarginBottom: PropTypes__default["default"].string,
|
|
793
|
+
phoneJustifyContent: PropTypes__default["default"].string,
|
|
797
794
|
errorAnimationDuration: PropTypes__default["default"].string,
|
|
798
795
|
leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
799
796
|
rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
@@ -951,6 +948,27 @@ Button.propTypes = {
|
|
|
951
948
|
disabledBackgroundColor: PropTypes__default["default"].string
|
|
952
949
|
};
|
|
953
950
|
|
|
951
|
+
var ReactCheckbox = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.2 0H12.8C14.5673 0 16 1.43269 16 3.2V12.8C16 14.5673 14.5673 16 12.8 16H3.2C1.43269 16 0 14.5673 0 12.8V3.2C0 1.43269 1.43269 0 3.2 0ZM3.2 1.6C2.31634 1.6 1.6 2.31634 1.6 3.2V12.8C1.6 13.6837 2.31634 14.4 3.2 14.4H12.8C13.6837 14.4 14.4 13.6837 14.4 12.8V3.2C14.4 2.31634 13.6837 1.6 12.8 1.6H3.2Z\" fill=\"#D1D1D1\"/>\n</svg>";
|
|
952
|
+
|
|
953
|
+
var ReactCheckboxChecked = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8 0H3.2C1.43269 0 0 1.43269 0 3.2V12.8C0 14.5673 1.43269 16 3.2 16H12.8C14.5673 16 16 14.5673 16 12.8V3.2C16 1.43269 14.5673 0 12.8 0ZM6.84979 10.9662C6.9178 10.9887 6.99067 11 7.0684 11C7.14613 11 7.219 10.9887 7.28701 10.9662C7.35502 10.944 7.41818 10.906 7.47647 10.8523L12.8397 5.91275C12.9466 5.81432 13 5.68671 13 5.52993C13 5.37351 12.9466 5.24609 12.8397 5.14765C12.7328 5.04922 12.5945 5 12.4246 5C12.2544 5 12.1158 5.04922 12.009 5.14765L7.0684 9.69799L4.98433 7.77852C4.87745 7.68009 4.74143 7.63087 4.57625 7.63087C4.41108 7.63087 4.27506 7.68009 4.16818 7.77852C4.06131 7.87696 4.00534 8.00438 4.00029 8.1608C3.99563 8.31758 4.04673 8.44519 4.15361 8.54362L6.66033 10.8523C6.71863 10.906 6.78178 10.944 6.84979 10.9662Z\" fill=\"#00236A\"/>\n</svg>";
|
|
954
|
+
|
|
955
|
+
const SelectCheckbox = ({
|
|
956
|
+
checked
|
|
957
|
+
}) => {
|
|
958
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
959
|
+
style: {
|
|
960
|
+
marginRight: '9px'
|
|
961
|
+
}
|
|
962
|
+
}, checked ? /*#__PURE__*/React__default["default"].createElement("img", {
|
|
963
|
+
src: ReactCheckboxChecked
|
|
964
|
+
}) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
965
|
+
src: ReactCheckbox
|
|
966
|
+
}));
|
|
967
|
+
};
|
|
968
|
+
SelectCheckbox.propTypes = {
|
|
969
|
+
checked: PropTypes__default["default"].bool
|
|
970
|
+
};
|
|
971
|
+
|
|
954
972
|
var ReactArrowIcon = "<svg width=\"15\" height=\"9\" viewBox=\"0 0 15 9\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7.9878 8.00003C7.75456 8.00049 7.52851 7.91911 7.34892 7.77003L1.3594 2.77003C1.15554 2.60029 1.02734 2.35638 1.003 2.09196C0.978666 1.82753 1.06019 1.56425 1.22963 1.36003C1.39907 1.15581 1.64255 1.02739 1.90652 1.00301C2.17048 0.978631 2.4333 1.06029 2.63716 1.23003L7.9878 5.71003L13.3384 1.39003C13.4405 1.30697 13.558 1.24493 13.6842 1.2075C13.8103 1.17007 13.9425 1.15798 14.0733 1.17192C14.2041 1.18586 14.3309 1.22555 14.4463 1.28873C14.5618 1.3519 14.6636 1.4373 14.746 1.54003C14.8374 1.64285 14.9066 1.76348 14.9493 1.89435C14.9921 2.02523 15.0073 2.16353 14.9942 2.30059C14.9811 2.43765 14.9399 2.57053 14.8731 2.69088C14.8063 2.81124 14.7155 2.91649 14.6062 3.00003L8.6167 7.83003C8.43194 7.95555 8.21051 8.0154 7.9878 8.00003Z\" fill=\"#3C393E\"/>\n</svg>";
|
|
955
973
|
|
|
956
974
|
var ReactCloseIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.4253 0.241029L12.431 0.236144C12.6129 0.0804082 12.8468 -0.00097097 13.0861 0.00827014C13.3253 0.0175112 13.5523 0.116692 13.7216 0.285992C13.8909 0.455292 13.9901 0.682241 13.9993 0.921488C14.0085 1.16074 13.9272 1.39466 13.7714 1.57651L13.7665 1.58222L8.38622 6.96254L13.7665 12.3429L13.7714 12.3486C13.9272 12.5304 14.0085 12.7643 13.9993 13.0036C13.9901 13.2428 13.8909 13.4698 13.7216 13.6391C13.5523 13.8084 13.3253 13.9076 13.0861 13.9168C12.8468 13.926 12.6129 13.8447 12.431 13.6889L12.4253 13.684L7.04493 8.30363L1.66742 13.6738C1.58315 13.7705 1.48016 13.8492 1.36462 13.9051C1.24669 13.9622 1.11823 13.9942 0.987309 13.9993C0.85639 14.0043 0.72584 13.9823 0.603852 13.9345C0.481865 13.8867 0.371073 13.8142 0.27843 13.7216C0.185788 13.6289 0.113295 13.5181 0.0655034 13.3961C0.0177115 13.2742 -0.00434842 13.1436 0.000708381 13.0127C0.00576522 12.8818 0.0378304 12.7533 0.0948891 12.6354C0.150805 12.5198 0.229542 12.4168 0.326326 12.3325L5.70384 6.96235L0.323475 1.57461L0.318633 1.56895C0.162897 1.3871 0.0815178 1.15317 0.0907589 0.913926C0.1 0.674678 0.199181 0.447729 0.36848 0.27843C0.53778 0.10913 0.76473 0.00995005 1.00398 0.000708956C1.24322 -0.00853214 1.47715 0.0728459 1.659 0.228582L1.66476 0.233511L7.04512 5.62125L12.4253 0.241029Z\" fill=\"#3C393E\"/>\n</svg>";
|
|
@@ -960,8 +978,9 @@ var styles$5 = {"select-content":"select-module_select-content__GCMDX","select-c
|
|
|
960
978
|
styleInject(css_248z$5);
|
|
961
979
|
|
|
962
980
|
const Select = ({
|
|
981
|
+
options,
|
|
982
|
+
multiple,
|
|
963
983
|
disabled,
|
|
964
|
-
jsonData,
|
|
965
984
|
required,
|
|
966
985
|
onChange,
|
|
967
986
|
keyNames,
|
|
@@ -971,6 +990,7 @@ const Select = ({
|
|
|
971
990
|
closeIcon,
|
|
972
991
|
errorMessage,
|
|
973
992
|
defaultOption,
|
|
993
|
+
multipleCheckbox,
|
|
974
994
|
label,
|
|
975
995
|
labelColor,
|
|
976
996
|
labelWeight,
|
|
@@ -984,7 +1004,7 @@ const Select = ({
|
|
|
984
1004
|
errorColor,
|
|
985
1005
|
selectedColor,
|
|
986
1006
|
selectedRadius,
|
|
987
|
-
|
|
1007
|
+
selectedMinHeight,
|
|
988
1008
|
selectedBorder,
|
|
989
1009
|
selectedPadding,
|
|
990
1010
|
selectedFontSize,
|
|
@@ -1010,11 +1030,11 @@ const Select = ({
|
|
|
1010
1030
|
optionItemBackgroudColor,
|
|
1011
1031
|
optionItemBackgroudColorHover
|
|
1012
1032
|
}) => {
|
|
1013
|
-
const options = jsonData.length ? JSON.parse(jsonData) : [];
|
|
1014
1033
|
const ref = React.useRef();
|
|
1015
1034
|
const [opened, setOpened] = React.useState(false);
|
|
1016
1035
|
const [isHover, setIsHover] = React.useState(false);
|
|
1017
|
-
const [newSelected, setNewSelected] = React.useState(
|
|
1036
|
+
const [newSelected, setNewSelected] = React.useState([]);
|
|
1037
|
+
const [existOptions, setExistOptions] = React.useState([]);
|
|
1018
1038
|
const configStyles = compereConfigs();
|
|
1019
1039
|
const classProps = classnames__default["default"](className);
|
|
1020
1040
|
const handleOpenClose = () => {
|
|
@@ -1022,13 +1042,37 @@ const Select = ({
|
|
|
1022
1042
|
};
|
|
1023
1043
|
const handleClearSelect = e => {
|
|
1024
1044
|
onChange({});
|
|
1025
|
-
setNewSelected(
|
|
1045
|
+
setNewSelected([]);
|
|
1046
|
+
const clearedOptions = existOptions && existOptions.length > 0 && existOptions.map(item => {
|
|
1047
|
+
item.checked = false;
|
|
1048
|
+
return item;
|
|
1049
|
+
});
|
|
1050
|
+
setExistOptions(clearedOptions);
|
|
1026
1051
|
e.stopPropagation();
|
|
1027
1052
|
};
|
|
1028
1053
|
const handleSelectItem = option => {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1054
|
+
const checkedOption = {
|
|
1055
|
+
...option
|
|
1056
|
+
};
|
|
1057
|
+
delete checkedOption.checked;
|
|
1058
|
+
onChange(checkedOption);
|
|
1059
|
+
if (!multiple) {
|
|
1060
|
+
setOpened(!opened);
|
|
1061
|
+
setNewSelected([option]);
|
|
1062
|
+
} else {
|
|
1063
|
+
const indexOfObject = newSelected.findIndex(obj => {
|
|
1064
|
+
return obj.value === option.value;
|
|
1065
|
+
});
|
|
1066
|
+
if (indexOfObject === -1) {
|
|
1067
|
+
option.checked = true;
|
|
1068
|
+
setNewSelected(prev => {
|
|
1069
|
+
return [...prev, option];
|
|
1070
|
+
});
|
|
1071
|
+
} else {
|
|
1072
|
+
option.checked = false;
|
|
1073
|
+
setNewSelected([...newSelected.slice(0, indexOfObject), ...newSelected.slice(indexOfObject + 1)]);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1032
1076
|
};
|
|
1033
1077
|
const handleMouseEnter = () => {
|
|
1034
1078
|
setIsHover(true);
|
|
@@ -1044,10 +1088,6 @@ const Select = ({
|
|
|
1044
1088
|
e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor;
|
|
1045
1089
|
e.target.style.backgroundColor = optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor;
|
|
1046
1090
|
};
|
|
1047
|
-
React.useEffect(() => {
|
|
1048
|
-
const parseSelectedData = selected.length !== 0 ? JSON.parse(selected) : {};
|
|
1049
|
-
setNewSelected(parseSelectedData);
|
|
1050
|
-
}, [selected]);
|
|
1051
1091
|
React.useEffect(() => {
|
|
1052
1092
|
if (opened) {
|
|
1053
1093
|
const checkIfClickedOutside = e => {
|
|
@@ -1061,6 +1101,25 @@ const Select = ({
|
|
|
1061
1101
|
};
|
|
1062
1102
|
}
|
|
1063
1103
|
}, [opened]);
|
|
1104
|
+
React.useEffect(() => {
|
|
1105
|
+
selected && selected.length > 0 && setNewSelected(selected);
|
|
1106
|
+
if (!multiple) {
|
|
1107
|
+
options && options.length > 0 && setExistOptions(options);
|
|
1108
|
+
} else {
|
|
1109
|
+
const modifiedOptions = options && options.length > 0 && options.map((item, index) => {
|
|
1110
|
+
item.checked = false;
|
|
1111
|
+
if (selected && selected.length > 0) {
|
|
1112
|
+
selected.map(innerItem => {
|
|
1113
|
+
if (innerItem.value === item.value) {
|
|
1114
|
+
item.checked = true;
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
return item;
|
|
1119
|
+
});
|
|
1120
|
+
setExistOptions(modifiedOptions);
|
|
1121
|
+
}
|
|
1122
|
+
}, [options, multiple, selected]);
|
|
1064
1123
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1065
1124
|
className: classProps
|
|
1066
1125
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -1084,7 +1143,7 @@ const Select = ({
|
|
|
1084
1143
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1085
1144
|
style: {
|
|
1086
1145
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
|
|
1087
|
-
|
|
1146
|
+
minHeight: selectedMinHeight ? selectedMinHeight : configStyles.SELECT.selectedMinHeight,
|
|
1088
1147
|
border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
|
|
1089
1148
|
padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
|
|
1090
1149
|
borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
|
|
@@ -1096,19 +1155,30 @@ const Select = ({
|
|
|
1096
1155
|
borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
|
|
1097
1156
|
},
|
|
1098
1157
|
onClick: disabled ? _ => _ : _ => handleOpenClose(),
|
|
1099
|
-
onMouseEnter: disabled ? _ => _ : handleMouseEnter,
|
|
1100
|
-
onMouseLeave: disabled ? _ => _ : handleMouseLeave,
|
|
1158
|
+
onMouseEnter: disabled ? _ => _ : _ => handleMouseEnter(),
|
|
1159
|
+
onMouseLeave: disabled ? _ => _ : _ => handleMouseLeave(),
|
|
1101
1160
|
className: `${styles$5['select-content-top']}`
|
|
1102
1161
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1103
1162
|
className: `${styles$5['select-content-top-text']}`,
|
|
1104
1163
|
style: {
|
|
1105
1164
|
color: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : isHover ? selectedHoverColor ? selectedHoverColor : configStyles.SELECT.selectedHoverColor : selectedColor ? selectedColor : configStyles.SELECT.selectedColor
|
|
1106
1165
|
}
|
|
1107
|
-
}, newSelected && newSelected[keyNames.name] ? newSelected[keyNames.name] :
|
|
1166
|
+
}, !multiple && newSelected && newSelected[0] && newSelected[0][keyNames.name] ? newSelected[0][keyNames.name] : newSelected && newSelected.length > 0 ? newSelected.map((_, index) => {
|
|
1167
|
+
if (newSelected[index][keyNames.name]) {
|
|
1168
|
+
if (index > 0) {
|
|
1169
|
+
return ', ' + newSelected[index][keyNames.name];
|
|
1170
|
+
} else {
|
|
1171
|
+
return newSelected[index][keyNames.name];
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1108
1175
|
className: `${styles$5['select-content-top-icon']}`
|
|
1109
|
-
},
|
|
1176
|
+
}, multiple && newSelected.length > 1 && /*#__PURE__*/React__default["default"].createElement("span", null, newSelected.length), newSelected && newSelected.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1110
1177
|
className: `${styles$5['close-icon']}`,
|
|
1111
|
-
onClick: disabled ? _ => _ : handleClearSelect
|
|
1178
|
+
onClick: disabled ? _ => _ : handleClearSelect,
|
|
1179
|
+
style: {
|
|
1180
|
+
marginLeft: multiple && newSelected.length > 1 ? '17px' : '0px'
|
|
1181
|
+
}
|
|
1112
1182
|
}, closeIcon ? closeIcon : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1113
1183
|
src: ReactCloseIcon,
|
|
1114
1184
|
alt: "icon"
|
|
@@ -1125,12 +1195,12 @@ const Select = ({
|
|
|
1125
1195
|
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
1126
1196
|
borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
|
|
1127
1197
|
backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
|
|
1128
|
-
top: parseFloat(
|
|
1198
|
+
top: parseFloat(selectedMinHeight ? selectedMinHeight.substring(0, selectedMinHeight.length - 2) : configStyles.SELECT.selectedMinHeight.substring(0, configStyles.SELECT.selectedMinHeight.length - 2)) + 6 + 'px'
|
|
1129
1199
|
},
|
|
1130
1200
|
className: `${styles$5['select-content-bottom']}`
|
|
1131
1201
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1132
1202
|
className: `${styles$5['select-content-bottom-inner']}`
|
|
1133
|
-
},
|
|
1203
|
+
}, existOptions && existOptions.length > 0 && existOptions.map((option, i) => {
|
|
1134
1204
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1135
1205
|
key: i,
|
|
1136
1206
|
disabled: true,
|
|
@@ -1151,7 +1221,9 @@ const Select = ({
|
|
|
1151
1221
|
marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
|
|
1152
1222
|
backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
|
|
1153
1223
|
}
|
|
1154
|
-
},
|
|
1224
|
+
}, multiple && multipleCheckbox ? /*#__PURE__*/React__default["default"].createElement(SelectCheckbox, {
|
|
1225
|
+
checked: option.checked
|
|
1226
|
+
}) : '', option[keyNames.name]);
|
|
1155
1227
|
}))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1156
1228
|
style: {
|
|
1157
1229
|
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
@@ -1160,17 +1232,19 @@ const Select = ({
|
|
|
1160
1232
|
}, errorMessage) : '');
|
|
1161
1233
|
};
|
|
1162
1234
|
Select.propTypes = {
|
|
1235
|
+
options: PropTypes__default["default"].array,
|
|
1236
|
+
multiple: PropTypes__default["default"].bool,
|
|
1163
1237
|
onChange: PropTypes__default["default"].func,
|
|
1164
1238
|
required: PropTypes__default["default"].bool,
|
|
1165
1239
|
disabled: PropTypes__default["default"].bool,
|
|
1166
|
-
selected: PropTypes__default["default"].
|
|
1167
|
-
jsonData: PropTypes__default["default"].string,
|
|
1240
|
+
selected: PropTypes__default["default"].array,
|
|
1168
1241
|
keyNames: PropTypes__default["default"].object,
|
|
1169
1242
|
className: PropTypes__default["default"].string,
|
|
1170
1243
|
arrowIcon: PropTypes__default["default"].element,
|
|
1171
1244
|
closeIcon: PropTypes__default["default"].element,
|
|
1172
1245
|
errorMessage: PropTypes__default["default"].string,
|
|
1173
1246
|
defaultOption: PropTypes__default["default"].string,
|
|
1247
|
+
multipleCheckbox: PropTypes__default["default"].bool,
|
|
1174
1248
|
label: PropTypes__default["default"].string,
|
|
1175
1249
|
labelColor: PropTypes__default["default"].string,
|
|
1176
1250
|
labelWeight: PropTypes__default["default"].string,
|
|
@@ -1185,7 +1259,7 @@ Select.propTypes = {
|
|
|
1185
1259
|
selectedColor: PropTypes__default["default"].string,
|
|
1186
1260
|
selectedBorder: PropTypes__default["default"].string,
|
|
1187
1261
|
selectedRadius: PropTypes__default["default"].string,
|
|
1188
|
-
|
|
1262
|
+
selectedMinHeight: PropTypes__default["default"].string,
|
|
1189
1263
|
selectedPadding: PropTypes__default["default"].string,
|
|
1190
1264
|
selectedFontSize: PropTypes__default["default"].string,
|
|
1191
1265
|
selectedBoxSizing: PropTypes__default["default"].string,
|
|
@@ -1587,7 +1661,7 @@ const Autocomplate = ({
|
|
|
1587
1661
|
className,
|
|
1588
1662
|
searchCount,
|
|
1589
1663
|
placeHolder,
|
|
1590
|
-
|
|
1664
|
+
errorMessage,
|
|
1591
1665
|
autoComplete,
|
|
1592
1666
|
jsonOptionsData,
|
|
1593
1667
|
jsonSelectedOptionsData,
|
|
@@ -1675,7 +1749,7 @@ const Autocomplate = ({
|
|
|
1675
1749
|
id: inputId,
|
|
1676
1750
|
type: "text",
|
|
1677
1751
|
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
1678
|
-
className: `${styles['autocomplate-content-top']} autocomplate-content-top-rem ${
|
|
1752
|
+
className: `${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMessage ? styles.errorBorder : ''}`,
|
|
1679
1753
|
disabled: disabled,
|
|
1680
1754
|
onChange: handleChange,
|
|
1681
1755
|
onClick: () => {
|
|
@@ -1683,9 +1757,9 @@ const Autocomplate = ({
|
|
|
1683
1757
|
},
|
|
1684
1758
|
value: inputValue,
|
|
1685
1759
|
placeholder: placeHolder
|
|
1686
|
-
}, props)),
|
|
1760
|
+
}, props)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1687
1761
|
className: styles.errorMessage
|
|
1688
|
-
},
|
|
1762
|
+
}, errorMessage) : null, optionList));
|
|
1689
1763
|
};
|
|
1690
1764
|
Autocomplate.propTypes = {
|
|
1691
1765
|
label: PropTypes__default["default"].string,
|
|
@@ -1696,7 +1770,7 @@ Autocomplate.propTypes = {
|
|
|
1696
1770
|
keyNames: PropTypes__default["default"].object,
|
|
1697
1771
|
className: PropTypes__default["default"].string,
|
|
1698
1772
|
searchCount: PropTypes__default["default"].number,
|
|
1699
|
-
|
|
1773
|
+
errorMessage: PropTypes__default["default"].string,
|
|
1700
1774
|
placeHolder: PropTypes__default["default"].string,
|
|
1701
1775
|
autoComplete: PropTypes__default["default"].string,
|
|
1702
1776
|
jsonOptionsData: PropTypes__default["default"].string,
|
|
@@ -1717,6 +1791,7 @@ exports.Modal = Modal;
|
|
|
1717
1791
|
exports.Pagination = Pagination;
|
|
1718
1792
|
exports.Radio = Radio;
|
|
1719
1793
|
exports.Select = Select;
|
|
1794
|
+
exports.SelectCheckbox = SelectCheckbox;
|
|
1720
1795
|
exports.Stepper = Stepper;
|
|
1721
1796
|
exports.Table = Table;
|
|
1722
1797
|
exports.Tooltip = Tooltip;
|
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8 0H3.2C1.43269 0 0 1.43269 0 3.2V12.8C0 14.5673 1.43269 16 3.2 16H12.8C14.5673 16 16 14.5673 16 12.8V3.2C16 1.43269 14.5673 0 12.8 0ZM6.84979 10.9662C6.9178 10.9887 6.99067 11 7.0684 11C7.14613 11 7.219 10.9887 7.28701 10.9662C7.35502 10.944 7.41818 10.906 7.47647 10.8523L12.8397 5.91275C12.9466 5.81432 13 5.68671 13 5.52993C13 5.37351 12.9466 5.24609 12.8397 5.14765C12.7328 5.04922 12.5945 5 12.4246 5C12.2544 5 12.1158 5.04922 12.009 5.14765L7.0684 9.69799L4.98433 7.77852C4.87745 7.68009 4.74143 7.63087 4.57625 7.63087C4.41108 7.63087 4.27506 7.68009 4.16818 7.77852C4.06131 7.87696 4.00534 8.00438 4.00029 8.1608C3.99563 8.31758 4.04673 8.44519 4.15361 8.54362L6.66033 10.8523C6.71863 10.906 6.78178 10.944 6.84979 10.9662Z" fill="#00236A"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.2 0H12.8C14.5673 0 16 1.43269 16 3.2V12.8C16 14.5673 14.5673 16 12.8 16H3.2C1.43269 16 0 14.5673 0 12.8V3.2C0 1.43269 1.43269 0 3.2 0ZM3.2 1.6C2.31634 1.6 1.6 2.31634 1.6 3.2V12.8C1.6 13.6837 2.31634 14.4 3.2 14.4H12.8C13.6837 14.4 14.4 13.6837 14.4 12.8V3.2C14.4 2.31634 13.6837 1.6 12.8 1.6H3.2Z" fill="#D1D1D1"/>
|
|
3
|
+
</svg>
|
|
@@ -14,7 +14,7 @@ export const Autocomplate = ({
|
|
|
14
14
|
className,
|
|
15
15
|
searchCount,
|
|
16
16
|
placeHolder,
|
|
17
|
-
|
|
17
|
+
errorMessage,
|
|
18
18
|
autoComplete,
|
|
19
19
|
jsonOptionsData,
|
|
20
20
|
jsonSelectedOptionsData,
|
|
@@ -101,7 +101,7 @@ export const Autocomplate = ({
|
|
|
101
101
|
id={inputId}
|
|
102
102
|
type="text"
|
|
103
103
|
autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
|
|
104
|
-
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${
|
|
104
|
+
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMessage ? styles.errorBorder : ''}`}
|
|
105
105
|
disabled={disabled}
|
|
106
106
|
onChange={handleChange}
|
|
107
107
|
onClick={() => { setShowOptions(!showOptions) }}
|
|
@@ -109,7 +109,7 @@ export const Autocomplate = ({
|
|
|
109
109
|
placeholder={placeHolder}
|
|
110
110
|
{...props}
|
|
111
111
|
/>
|
|
112
|
-
{
|
|
112
|
+
{errorMessage ? <span className={styles.errorMessage}>{errorMessage}</span> : null}
|
|
113
113
|
{optionList}
|
|
114
114
|
</div>
|
|
115
115
|
</>
|
|
@@ -125,7 +125,7 @@ Autocomplate.propTypes = {
|
|
|
125
125
|
keyNames: PropTypes.object,
|
|
126
126
|
className: PropTypes.string,
|
|
127
127
|
searchCount: PropTypes.number,
|
|
128
|
-
|
|
128
|
+
errorMessage: PropTypes.string,
|
|
129
129
|
placeHolder: PropTypes.string,
|
|
130
130
|
autoComplete: PropTypes.string,
|
|
131
131
|
jsonOptionsData: PropTypes.string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import styles from "./file.module.css";
|
|
@@ -13,7 +13,7 @@ export const File = ({
|
|
|
13
13
|
onChange,
|
|
14
14
|
className,
|
|
15
15
|
defaultData,
|
|
16
|
-
|
|
16
|
+
errorMessage,
|
|
17
17
|
fileExtensions,
|
|
18
18
|
...props
|
|
19
19
|
}) => {
|
|
@@ -62,13 +62,6 @@ export const File = ({
|
|
|
62
62
|
document.querySelector(`.${name}`).value = "";
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
return () => {
|
|
67
|
-
setError('');
|
|
68
|
-
setImage(null);
|
|
69
|
-
}
|
|
70
|
-
}, []);
|
|
71
|
-
|
|
72
65
|
return (
|
|
73
66
|
<>
|
|
74
67
|
<p className={`${styles['file-form-title']} ile-form-title-rem`}>
|
|
@@ -77,7 +70,7 @@ export const File = ({
|
|
|
77
70
|
<div className={classnames(`${styles['file-form-wrap']} file-form-wrap-rem`,image ? styles['active'] : '')}>
|
|
78
71
|
<div
|
|
79
72
|
onChange={(e) => console.log(e)}
|
|
80
|
-
className={`${styles['file-form']} file-form-rem ${
|
|
73
|
+
className={`${styles['file-form']} file-form-rem ${errorMessage ? styles['error'] : '' }`}
|
|
81
74
|
onClick={() => document.querySelector(`.${name}`).click()}
|
|
82
75
|
>
|
|
83
76
|
<input
|
|
@@ -110,7 +103,7 @@ export const File = ({
|
|
|
110
103
|
<i className="icon-delete"/>
|
|
111
104
|
</div>
|
|
112
105
|
{
|
|
113
|
-
|
|
106
|
+
errorMessage || error ? <span style={{ color: 'red' }}>{errorMessage || error}</span> : null
|
|
114
107
|
}
|
|
115
108
|
</div>
|
|
116
109
|
</>
|
|
@@ -124,7 +117,7 @@ File.propTypes = {
|
|
|
124
117
|
onChange: PropTypes.func,
|
|
125
118
|
maxSize: PropTypes.number,
|
|
126
119
|
className: PropTypes.string,
|
|
127
|
-
|
|
120
|
+
errorMessage: PropTypes.string,
|
|
128
121
|
defaultData: PropTypes.object,
|
|
129
122
|
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
130
123
|
};
|
|
@@ -43,6 +43,7 @@ export const Input = ({
|
|
|
43
43
|
errorZindex,
|
|
44
44
|
errorBottom,
|
|
45
45
|
labelWeight,
|
|
46
|
+
phoneDisplay,
|
|
46
47
|
errorMessage,
|
|
47
48
|
autoComplete,
|
|
48
49
|
labelDisplay,
|
|
@@ -50,10 +51,12 @@ export const Input = ({
|
|
|
50
51
|
boxShadowHover,
|
|
51
52
|
errorClassName,
|
|
52
53
|
errorAnimation,
|
|
54
|
+
phoneAlignItems,
|
|
53
55
|
errorLineHeight,
|
|
54
56
|
labelLineHeight,
|
|
55
57
|
backgroundColor,
|
|
56
58
|
labelMarginBottom,
|
|
59
|
+
phoneJustifyContent,
|
|
57
60
|
errorAnimationDuration,
|
|
58
61
|
...props
|
|
59
62
|
}) => {
|
|
@@ -156,8 +159,11 @@ export const Input = ({
|
|
|
156
159
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
157
160
|
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
158
161
|
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
159
|
-
|
|
162
|
+
display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
|
|
163
|
+
alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
|
|
160
164
|
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
165
|
+
justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
|
|
166
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
161
167
|
}}
|
|
162
168
|
>
|
|
163
169
|
+374
|
|
@@ -264,6 +270,7 @@ Input.propTypes = {
|
|
|
264
270
|
errorBottom: PropTypes.string,
|
|
265
271
|
labelWeight: PropTypes.string,
|
|
266
272
|
errorMessage: PropTypes.string,
|
|
273
|
+
phoneDisplay: PropTypes.string,
|
|
267
274
|
autoComplete: PropTypes.string,
|
|
268
275
|
errorAnimation: PropTypes.bool,
|
|
269
276
|
labelDisplay: PropTypes.string,
|
|
@@ -271,9 +278,11 @@ Input.propTypes = {
|
|
|
271
278
|
boxShadowHover: PropTypes.string,
|
|
272
279
|
errorClassName: PropTypes.string,
|
|
273
280
|
backgroundColor: PropTypes.string,
|
|
281
|
+
phoneAlignItems: PropTypes.string,
|
|
274
282
|
errorLineHeight: PropTypes.string,
|
|
275
283
|
labelLineHeight: PropTypes.string,
|
|
276
284
|
labelMarginBottom: PropTypes.string,
|
|
285
|
+
phoneJustifyContent: PropTypes.string,
|
|
277
286
|
errorAnimationDuration: PropTypes.string,
|
|
278
287
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
279
288
|
rightIcon: PropTypes.arrayOf(PropTypes.element),
|