@xaypay/tui 0.0.64 → 0.0.66
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 +105 -32
- package/dist/index.js +105 -32
- package/package.json +1 -1
- package/src/components/file/file.module.css +4 -9
- package/src/components/input/index.js +69 -20
- package/src/components/input/input.stories.js +1 -5
- package/src/components/select/index.js +4 -4
- package/src/components/singleCheckbox/index.js +20 -0
- package/src/components/singleCheckbox/singleCheckbox.stories.js +10 -0
- package/src/index.js +1 -1
- package/src/components/selectCheckbox/index.js +0 -20
- package/src/components/selectCheckbox/selectCheckbox.stories.js +0 -10
package/dist/index.es.js
CHANGED
|
@@ -32,7 +32,7 @@ function styleInject(css, ref) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var css_248z$d = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{
|
|
35
|
+
var css_248z$d = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
36
36
|
var styles$c = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
|
|
37
37
|
styleInject(css_248z$d);
|
|
38
38
|
|
|
@@ -566,6 +566,7 @@ const Input = ({
|
|
|
566
566
|
label,
|
|
567
567
|
value,
|
|
568
568
|
width,
|
|
569
|
+
regexp,
|
|
569
570
|
height,
|
|
570
571
|
radius,
|
|
571
572
|
padding,
|
|
@@ -602,13 +603,18 @@ const Input = ({
|
|
|
602
603
|
errorLineHeight,
|
|
603
604
|
labelLineHeight,
|
|
604
605
|
backgroundColor,
|
|
606
|
+
telErrorMessage,
|
|
605
607
|
labelMarginBottom,
|
|
608
|
+
regexpErrorMessage,
|
|
606
609
|
phoneJustifyContent,
|
|
607
610
|
errorAnimationDuration,
|
|
608
611
|
...props
|
|
609
612
|
}) => {
|
|
613
|
+
const phoneNumberRegex = /^\d{8}$/;
|
|
610
614
|
const [show, setShow] = useState(false);
|
|
611
615
|
const [isHover, setIsHover] = useState(false);
|
|
616
|
+
const [innerValue, setInnerValue] = useState('');
|
|
617
|
+
const [innerErrorMessage, setInnerErrorMessage] = useState('');
|
|
612
618
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
613
619
|
const configStyles = compereConfigs();
|
|
614
620
|
const classProps = classnames(className ? className : configStyles.INPUT.className);
|
|
@@ -629,15 +635,20 @@ const Input = ({
|
|
|
629
635
|
animation: ${errorAnimation ? animation : 'none'};
|
|
630
636
|
`;
|
|
631
637
|
const handleChange = event => {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
const currentValue = event.target.value;
|
|
639
|
+
if (onChange) {
|
|
640
|
+
currentValue.length > maxLength ? onChange(currentValue.substr(0, maxLength)) : onChange(currentValue);
|
|
641
|
+
}
|
|
642
|
+
setInnerValue(currentValue);
|
|
643
|
+
if (type === 'tel') {
|
|
644
|
+
!phoneNumberRegex.test(parseInt(currentValue)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
645
|
+
}
|
|
646
|
+
if (maxLength) {
|
|
647
|
+
currentValue.length > maxLength ? setInnerValue(currentValue.substr(0, maxLength)) : setInnerValue(currentValue);
|
|
648
|
+
}
|
|
649
|
+
if (regexp) {
|
|
650
|
+
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
651
|
+
}
|
|
641
652
|
};
|
|
642
653
|
const handleMouseEnter = () => {
|
|
643
654
|
setIsHover(true);
|
|
@@ -645,6 +656,35 @@ const Input = ({
|
|
|
645
656
|
const handleMouseLeave = () => {
|
|
646
657
|
setIsHover(false);
|
|
647
658
|
};
|
|
659
|
+
useEffect(() => {
|
|
660
|
+
if (value && value !== '') {
|
|
661
|
+
setInnerValue(value);
|
|
662
|
+
if (type === 'tel') {
|
|
663
|
+
!phoneNumberRegex.test(parseInt(value)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
664
|
+
}
|
|
665
|
+
if (maxLength) {
|
|
666
|
+
value.length > maxLength ? setInnerValue(value.substr(0, maxLength)) : setInnerValue(value);
|
|
667
|
+
}
|
|
668
|
+
if (regexp) {
|
|
669
|
+
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}, [value]);
|
|
673
|
+
useEffect(() => {
|
|
674
|
+
if (errorMessage) {
|
|
675
|
+
setInnerErrorMessage(errorMessage);
|
|
676
|
+
}
|
|
677
|
+
}, [errorMessage]);
|
|
678
|
+
useEffect(() => {
|
|
679
|
+
if (type === 'tel' && !telErrorMessage) {
|
|
680
|
+
alert('Please add telErrorMessage on input component');
|
|
681
|
+
}
|
|
682
|
+
}, [type]);
|
|
683
|
+
useEffect(() => {
|
|
684
|
+
if (regexp && !regexpErrorMessage) {
|
|
685
|
+
alert('Please add regexpErrorMessage prop on input component');
|
|
686
|
+
}
|
|
687
|
+
}, [regexp]);
|
|
648
688
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
649
689
|
className: `${styles$8["input-wrap"]}`
|
|
650
690
|
}, label ? /*#__PURE__*/React__default.createElement("label", {
|
|
@@ -659,14 +699,14 @@ const Input = ({
|
|
|
659
699
|
}
|
|
660
700
|
}, label, " ", required && /*#__PURE__*/React__default.createElement("sup", {
|
|
661
701
|
style: {
|
|
662
|
-
color: "#ee0000"
|
|
702
|
+
color: errorColor ? errorColor : "#ee0000"
|
|
663
703
|
}
|
|
664
704
|
}, "*")) : '', /*#__PURE__*/React__default.createElement("div", {
|
|
665
705
|
className: `${styles$8["input-content"]}`,
|
|
666
706
|
style: {
|
|
667
707
|
width: width ? width : configStyles.INPUT.width,
|
|
668
708
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
669
|
-
boxShadow:
|
|
709
|
+
boxShadow: innerErrorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
670
710
|
},
|
|
671
711
|
onMouseEnter: handleMouseEnter,
|
|
672
712
|
onMouseLeave: handleMouseLeave
|
|
@@ -695,14 +735,12 @@ const Input = ({
|
|
|
695
735
|
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
696
736
|
display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
|
|
697
737
|
alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
|
|
698
|
-
color:
|
|
738
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
699
739
|
justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
|
|
700
740
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
701
741
|
}
|
|
702
742
|
}, "+374") : '', /*#__PURE__*/React__default.createElement("input", _extends({}, props, {
|
|
703
|
-
|
|
704
|
-
// value={type === 'tel' ? phoneNumberRegex.test(value) ? value : '' : maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value}
|
|
705
|
-
value: maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value,
|
|
743
|
+
value: innerValue,
|
|
706
744
|
className: classProps,
|
|
707
745
|
onChange: handleChange,
|
|
708
746
|
type: show ? 'text' : type,
|
|
@@ -721,7 +759,7 @@ const Input = ({
|
|
|
721
759
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
722
760
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
723
761
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
724
|
-
color:
|
|
762
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
|
|
725
763
|
}
|
|
726
764
|
})), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
727
765
|
onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
|
|
@@ -737,7 +775,7 @@ const Input = ({
|
|
|
737
775
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
738
776
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
739
777
|
}
|
|
740
|
-
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '',
|
|
778
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default.createElement(P, {
|
|
741
779
|
style: {
|
|
742
780
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
743
781
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
@@ -749,7 +787,7 @@ const Input = ({
|
|
|
749
787
|
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform
|
|
750
788
|
},
|
|
751
789
|
className: errorClassName ? errorClassName : configStyles.INPUT.errorClassName
|
|
752
|
-
},
|
|
790
|
+
}, innerErrorMessage) : '');
|
|
753
791
|
};
|
|
754
792
|
Input.propTypes = {
|
|
755
793
|
name: PropTypes.string,
|
|
@@ -788,11 +826,14 @@ Input.propTypes = {
|
|
|
788
826
|
errorPosition: PropTypes.string,
|
|
789
827
|
boxShadowHover: PropTypes.string,
|
|
790
828
|
errorClassName: PropTypes.string,
|
|
829
|
+
telErrorMessage: PropTypes.string,
|
|
791
830
|
backgroundColor: PropTypes.string,
|
|
792
831
|
phoneAlignItems: PropTypes.string,
|
|
793
832
|
errorLineHeight: PropTypes.string,
|
|
794
833
|
labelLineHeight: PropTypes.string,
|
|
795
834
|
labelMarginBottom: PropTypes.string,
|
|
835
|
+
regexpErrorMessage: PropTypes.string,
|
|
836
|
+
regexp: PropTypes.instanceOf(RegExp),
|
|
796
837
|
phoneJustifyContent: PropTypes.string,
|
|
797
838
|
errorAnimationDuration: PropTypes.string,
|
|
798
839
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
@@ -951,24 +992,56 @@ Button.propTypes = {
|
|
|
951
992
|
disabledBackgroundColor: PropTypes.string
|
|
952
993
|
};
|
|
953
994
|
|
|
954
|
-
|
|
995
|
+
const SvgCheckboxUnchecked = ({
|
|
996
|
+
title,
|
|
997
|
+
titleId,
|
|
998
|
+
...props
|
|
999
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({
|
|
1000
|
+
width: "1em",
|
|
1001
|
+
height: "1em",
|
|
1002
|
+
viewBox: "0 0 16 16",
|
|
1003
|
+
fill: "none",
|
|
1004
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1005
|
+
"aria-labelledby": titleId
|
|
1006
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
1007
|
+
id: titleId
|
|
1008
|
+
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1009
|
+
fillRule: "evenodd",
|
|
1010
|
+
clipRule: "evenodd",
|
|
1011
|
+
d: "M3.2 0h9.6A3.2 3.2 0 0 1 16 3.2v9.6a3.2 3.2 0 0 1-3.2 3.2H3.2A3.2 3.2 0 0 1 0 12.8V3.2A3.2 3.2 0 0 1 3.2 0Zm0 1.6a1.6 1.6 0 0 0-1.6 1.6v9.6a1.6 1.6 0 0 0 1.6 1.6h9.6a1.6 1.6 0 0 0 1.6-1.6V3.2a1.6 1.6 0 0 0-1.6-1.6H3.2Z",
|
|
1012
|
+
fill: "#D1D1D1"
|
|
1013
|
+
}));
|
|
955
1014
|
|
|
956
|
-
|
|
1015
|
+
const SvgCheckboxChecked = ({
|
|
1016
|
+
title,
|
|
1017
|
+
titleId,
|
|
1018
|
+
...props
|
|
1019
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({
|
|
1020
|
+
width: "1em",
|
|
1021
|
+
height: "1em",
|
|
1022
|
+
viewBox: "0 0 16 16",
|
|
1023
|
+
fill: "none",
|
|
1024
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1025
|
+
"aria-labelledby": titleId
|
|
1026
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
1027
|
+
id: titleId
|
|
1028
|
+
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1029
|
+
fillRule: "evenodd",
|
|
1030
|
+
clipRule: "evenodd",
|
|
1031
|
+
d: "M12.8 0H3.2A3.2 3.2 0 0 0 0 3.2v9.6A3.2 3.2 0 0 0 3.2 16h9.6a3.2 3.2 0 0 0 3.2-3.2V3.2A3.2 3.2 0 0 0 12.8 0ZM6.85 10.966c.068.023.14.034.218.034.078 0 .151-.011.219-.034a.515.515 0 0 0 .19-.114l5.363-4.94A.496.496 0 0 0 13 5.53a.496.496 0 0 0-.16-.382.589.589 0 0 0-.415-.148.59.59 0 0 0-.416.148l-4.94 4.55-2.085-1.92a.579.579 0 0 0-.408-.147.579.579 0 0 0-.408.148A.52.52 0 0 0 4 8.16a.476.476 0 0 0 .154.383l2.506 2.308a.515.515 0 0 0 .19.114Z",
|
|
1032
|
+
fill: "#00236A"
|
|
1033
|
+
}));
|
|
957
1034
|
|
|
958
|
-
const
|
|
1035
|
+
const SingleCheckbox = ({
|
|
959
1036
|
checked
|
|
960
1037
|
}) => {
|
|
961
1038
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
962
1039
|
style: {
|
|
963
1040
|
marginRight: '9px'
|
|
964
1041
|
}
|
|
965
|
-
}, checked ? /*#__PURE__*/React__default.createElement(
|
|
966
|
-
src: ReactCheckboxChecked
|
|
967
|
-
}) : /*#__PURE__*/React__default.createElement("img", {
|
|
968
|
-
src: ReactCheckbox
|
|
969
|
-
}));
|
|
1042
|
+
}, checked ? /*#__PURE__*/React__default.createElement(SvgCheckboxChecked, null) : /*#__PURE__*/React__default.createElement(SvgCheckboxUnchecked, null));
|
|
970
1043
|
};
|
|
971
|
-
|
|
1044
|
+
SingleCheckbox.propTypes = {
|
|
972
1045
|
checked: PropTypes.bool
|
|
973
1046
|
};
|
|
974
1047
|
|
|
@@ -1234,7 +1307,7 @@ const Select = ({
|
|
|
1234
1307
|
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
1235
1308
|
borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
|
|
1236
1309
|
backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
|
|
1237
|
-
top: selectedMinHeight ? selectedMinHeight.includes('rem') ? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) + 6 + 'px' : configStyles.SELECT.selectedMinHeight.includes('rem') ? parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 3)) + 0.6 + 'rem' : parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 2)) + 6 + 'px'
|
|
1310
|
+
top: selectedMinHeight ? selectedMinHeight.includes('rem') ? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) + 6 + 'px' : configStyles.SELECT.selectedMinHeight.includes('rem') ? parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 2)) + 6 + 'px'
|
|
1238
1311
|
},
|
|
1239
1312
|
className: `${styles$6['select-content-bottom']}`
|
|
1240
1313
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -1260,7 +1333,7 @@ const Select = ({
|
|
|
1260
1333
|
marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
|
|
1261
1334
|
backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
|
|
1262
1335
|
}
|
|
1263
|
-
}, multiple && multipleCheckbox ? /*#__PURE__*/React__default.createElement(
|
|
1336
|
+
}, multiple && multipleCheckbox ? /*#__PURE__*/React__default.createElement(SingleCheckbox, {
|
|
1264
1337
|
checked: option.checked
|
|
1265
1338
|
}) : '', option[keyNames.name]);
|
|
1266
1339
|
}))) : null)), errorMessage ? /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -1670,7 +1743,7 @@ const Toaster = () => {
|
|
|
1670
1743
|
});
|
|
1671
1744
|
};
|
|
1672
1745
|
|
|
1673
|
-
var ReactInfoIcon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\
|
|
1746
|
+
var ReactInfoIcon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8 0C3.58214 0 0 3.58214 0 8C0 12.4179 3.58214 16 8 16C12.4179 16 16 12.4179 16 8C16 3.58214 12.4179 0 8 0ZM8.57143 11.8571C8.57143 11.9357 8.50714 12 8.42857 12H7.57143C7.49286 12 7.42857 11.9357 7.42857 11.8571V7C7.42857 6.92143 7.49286 6.85714 7.57143 6.85714H8.42857C8.50714 6.85714 8.57143 6.92143 8.57143 7V11.8571ZM8 5.71429C7.7757 5.70971 7.56213 5.61739 7.40513 5.45714C7.24812 5.2969 7.16018 5.08149 7.16018 4.85714C7.16018 4.6328 7.24812 4.41739 7.40513 4.25714C7.56213 4.0969 7.7757 4.00458 8 4C8.2243 4.00458 8.43787 4.0969 8.59488 4.25714C8.75189 4.41739 8.83982 4.6328 8.83982 4.85714C8.83982 5.08149 8.75189 5.2969 8.59488 5.45714C8.43787 5.61739 8.2243 5.70971 8 5.71429Z\" fill=\"#D1D1D1\"/>\n</svg>";
|
|
1674
1747
|
|
|
1675
1748
|
var css_248z$4 = ".tooltip-module_tooltip-block__v8U9u{align-items:center;display:flex;justify-content:center;position:relative}.tooltip-module_tooltip__emM6A{padding:10px;position:absolute;z-index:1}.tooltip-module_tooltip-rel__to9gq{align-items:center;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;display:flex;height:auto;justify-content:center;min-height:10px;min-width:30px;position:relative;width:auto}.tooltip-module_tooltip-decor__qvt7t{border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;height:10px;position:absolute;transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);width:10px;z-index:-1}";
|
|
1676
1749
|
var styles$4 = {"tooltip-block":"tooltip-module_tooltip-block__v8U9u","tooltip":"tooltip-module_tooltip__emM6A","tooltip-rel":"tooltip-module_tooltip-rel__to9gq","tooltip-decor":"tooltip-module_tooltip-decor__qvt7t"};
|
|
@@ -2168,4 +2241,4 @@ Autocomplate.defaultProps = {
|
|
|
2168
2241
|
required: false
|
|
2169
2242
|
};
|
|
2170
2243
|
|
|
2171
|
-
export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select,
|
|
2244
|
+
export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select, SingleCheckbox, Stepper, Table, Toaster, Tooltip, Typography, TypographyType, toast };
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function styleInject(css, ref) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
var css_248z$d = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{
|
|
65
|
+
var css_248z$d = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
66
66
|
var styles$c = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
|
|
67
67
|
styleInject(css_248z$d);
|
|
68
68
|
|
|
@@ -596,6 +596,7 @@ const Input = ({
|
|
|
596
596
|
label,
|
|
597
597
|
value,
|
|
598
598
|
width,
|
|
599
|
+
regexp,
|
|
599
600
|
height,
|
|
600
601
|
radius,
|
|
601
602
|
padding,
|
|
@@ -632,13 +633,18 @@ const Input = ({
|
|
|
632
633
|
errorLineHeight,
|
|
633
634
|
labelLineHeight,
|
|
634
635
|
backgroundColor,
|
|
636
|
+
telErrorMessage,
|
|
635
637
|
labelMarginBottom,
|
|
638
|
+
regexpErrorMessage,
|
|
636
639
|
phoneJustifyContent,
|
|
637
640
|
errorAnimationDuration,
|
|
638
641
|
...props
|
|
639
642
|
}) => {
|
|
643
|
+
const phoneNumberRegex = /^\d{8}$/;
|
|
640
644
|
const [show, setShow] = React.useState(false);
|
|
641
645
|
const [isHover, setIsHover] = React.useState(false);
|
|
646
|
+
const [innerValue, setInnerValue] = React.useState('');
|
|
647
|
+
const [innerErrorMessage, setInnerErrorMessage] = React.useState('');
|
|
642
648
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
643
649
|
const configStyles = compereConfigs();
|
|
644
650
|
const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className);
|
|
@@ -659,15 +665,20 @@ const Input = ({
|
|
|
659
665
|
animation: ${errorAnimation ? animation : 'none'};
|
|
660
666
|
`;
|
|
661
667
|
const handleChange = event => {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
668
|
+
const currentValue = event.target.value;
|
|
669
|
+
if (onChange) {
|
|
670
|
+
currentValue.length > maxLength ? onChange(currentValue.substr(0, maxLength)) : onChange(currentValue);
|
|
671
|
+
}
|
|
672
|
+
setInnerValue(currentValue);
|
|
673
|
+
if (type === 'tel') {
|
|
674
|
+
!phoneNumberRegex.test(parseInt(currentValue)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
675
|
+
}
|
|
676
|
+
if (maxLength) {
|
|
677
|
+
currentValue.length > maxLength ? setInnerValue(currentValue.substr(0, maxLength)) : setInnerValue(currentValue);
|
|
678
|
+
}
|
|
679
|
+
if (regexp) {
|
|
680
|
+
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
681
|
+
}
|
|
671
682
|
};
|
|
672
683
|
const handleMouseEnter = () => {
|
|
673
684
|
setIsHover(true);
|
|
@@ -675,6 +686,35 @@ const Input = ({
|
|
|
675
686
|
const handleMouseLeave = () => {
|
|
676
687
|
setIsHover(false);
|
|
677
688
|
};
|
|
689
|
+
React.useEffect(() => {
|
|
690
|
+
if (value && value !== '') {
|
|
691
|
+
setInnerValue(value);
|
|
692
|
+
if (type === 'tel') {
|
|
693
|
+
!phoneNumberRegex.test(parseInt(value)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
694
|
+
}
|
|
695
|
+
if (maxLength) {
|
|
696
|
+
value.length > maxLength ? setInnerValue(value.substr(0, maxLength)) : setInnerValue(value);
|
|
697
|
+
}
|
|
698
|
+
if (regexp) {
|
|
699
|
+
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}, [value]);
|
|
703
|
+
React.useEffect(() => {
|
|
704
|
+
if (errorMessage) {
|
|
705
|
+
setInnerErrorMessage(errorMessage);
|
|
706
|
+
}
|
|
707
|
+
}, [errorMessage]);
|
|
708
|
+
React.useEffect(() => {
|
|
709
|
+
if (type === 'tel' && !telErrorMessage) {
|
|
710
|
+
alert('Please add telErrorMessage on input component');
|
|
711
|
+
}
|
|
712
|
+
}, [type]);
|
|
713
|
+
React.useEffect(() => {
|
|
714
|
+
if (regexp && !regexpErrorMessage) {
|
|
715
|
+
alert('Please add regexpErrorMessage prop on input component');
|
|
716
|
+
}
|
|
717
|
+
}, [regexp]);
|
|
678
718
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
679
719
|
className: `${styles$8["input-wrap"]}`
|
|
680
720
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -689,14 +729,14 @@ const Input = ({
|
|
|
689
729
|
}
|
|
690
730
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
691
731
|
style: {
|
|
692
|
-
color: "#ee0000"
|
|
732
|
+
color: errorColor ? errorColor : "#ee0000"
|
|
693
733
|
}
|
|
694
734
|
}, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
|
|
695
735
|
className: `${styles$8["input-content"]}`,
|
|
696
736
|
style: {
|
|
697
737
|
width: width ? width : configStyles.INPUT.width,
|
|
698
738
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
699
|
-
boxShadow:
|
|
739
|
+
boxShadow: innerErrorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
700
740
|
},
|
|
701
741
|
onMouseEnter: handleMouseEnter,
|
|
702
742
|
onMouseLeave: handleMouseLeave
|
|
@@ -725,14 +765,12 @@ const Input = ({
|
|
|
725
765
|
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
726
766
|
display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
|
|
727
767
|
alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
|
|
728
|
-
color:
|
|
768
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
729
769
|
justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
|
|
730
770
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
731
771
|
}
|
|
732
772
|
}, "+374") : '', /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
|
|
733
|
-
|
|
734
|
-
// value={type === 'tel' ? phoneNumberRegex.test(value) ? value : '' : maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value}
|
|
735
|
-
value: maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value,
|
|
773
|
+
value: innerValue,
|
|
736
774
|
className: classProps,
|
|
737
775
|
onChange: handleChange,
|
|
738
776
|
type: show ? 'text' : type,
|
|
@@ -751,7 +789,7 @@ const Input = ({
|
|
|
751
789
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
752
790
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
753
791
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
754
|
-
color:
|
|
792
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
|
|
755
793
|
}
|
|
756
794
|
})), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
757
795
|
onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
|
|
@@ -767,7 +805,7 @@ const Input = ({
|
|
|
767
805
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
768
806
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
769
807
|
}
|
|
770
|
-
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '',
|
|
808
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
|
|
771
809
|
style: {
|
|
772
810
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
773
811
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
@@ -779,7 +817,7 @@ const Input = ({
|
|
|
779
817
|
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform
|
|
780
818
|
},
|
|
781
819
|
className: errorClassName ? errorClassName : configStyles.INPUT.errorClassName
|
|
782
|
-
},
|
|
820
|
+
}, innerErrorMessage) : '');
|
|
783
821
|
};
|
|
784
822
|
Input.propTypes = {
|
|
785
823
|
name: PropTypes__default["default"].string,
|
|
@@ -818,11 +856,14 @@ Input.propTypes = {
|
|
|
818
856
|
errorPosition: PropTypes__default["default"].string,
|
|
819
857
|
boxShadowHover: PropTypes__default["default"].string,
|
|
820
858
|
errorClassName: PropTypes__default["default"].string,
|
|
859
|
+
telErrorMessage: PropTypes__default["default"].string,
|
|
821
860
|
backgroundColor: PropTypes__default["default"].string,
|
|
822
861
|
phoneAlignItems: PropTypes__default["default"].string,
|
|
823
862
|
errorLineHeight: PropTypes__default["default"].string,
|
|
824
863
|
labelLineHeight: PropTypes__default["default"].string,
|
|
825
864
|
labelMarginBottom: PropTypes__default["default"].string,
|
|
865
|
+
regexpErrorMessage: PropTypes__default["default"].string,
|
|
866
|
+
regexp: PropTypes__default["default"].instanceOf(RegExp),
|
|
826
867
|
phoneJustifyContent: PropTypes__default["default"].string,
|
|
827
868
|
errorAnimationDuration: PropTypes__default["default"].string,
|
|
828
869
|
leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
@@ -981,24 +1022,56 @@ Button.propTypes = {
|
|
|
981
1022
|
disabledBackgroundColor: PropTypes__default["default"].string
|
|
982
1023
|
};
|
|
983
1024
|
|
|
984
|
-
|
|
1025
|
+
const SvgCheckboxUnchecked = ({
|
|
1026
|
+
title,
|
|
1027
|
+
titleId,
|
|
1028
|
+
...props
|
|
1029
|
+
}) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1030
|
+
width: "1em",
|
|
1031
|
+
height: "1em",
|
|
1032
|
+
viewBox: "0 0 16 16",
|
|
1033
|
+
fill: "none",
|
|
1034
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1035
|
+
"aria-labelledby": titleId
|
|
1036
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
1037
|
+
id: titleId
|
|
1038
|
+
}, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
|
|
1039
|
+
fillRule: "evenodd",
|
|
1040
|
+
clipRule: "evenodd",
|
|
1041
|
+
d: "M3.2 0h9.6A3.2 3.2 0 0 1 16 3.2v9.6a3.2 3.2 0 0 1-3.2 3.2H3.2A3.2 3.2 0 0 1 0 12.8V3.2A3.2 3.2 0 0 1 3.2 0Zm0 1.6a1.6 1.6 0 0 0-1.6 1.6v9.6a1.6 1.6 0 0 0 1.6 1.6h9.6a1.6 1.6 0 0 0 1.6-1.6V3.2a1.6 1.6 0 0 0-1.6-1.6H3.2Z",
|
|
1042
|
+
fill: "#D1D1D1"
|
|
1043
|
+
}));
|
|
985
1044
|
|
|
986
|
-
|
|
1045
|
+
const SvgCheckboxChecked = ({
|
|
1046
|
+
title,
|
|
1047
|
+
titleId,
|
|
1048
|
+
...props
|
|
1049
|
+
}) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1050
|
+
width: "1em",
|
|
1051
|
+
height: "1em",
|
|
1052
|
+
viewBox: "0 0 16 16",
|
|
1053
|
+
fill: "none",
|
|
1054
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1055
|
+
"aria-labelledby": titleId
|
|
1056
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
1057
|
+
id: titleId
|
|
1058
|
+
}, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
|
|
1059
|
+
fillRule: "evenodd",
|
|
1060
|
+
clipRule: "evenodd",
|
|
1061
|
+
d: "M12.8 0H3.2A3.2 3.2 0 0 0 0 3.2v9.6A3.2 3.2 0 0 0 3.2 16h9.6a3.2 3.2 0 0 0 3.2-3.2V3.2A3.2 3.2 0 0 0 12.8 0ZM6.85 10.966c.068.023.14.034.218.034.078 0 .151-.011.219-.034a.515.515 0 0 0 .19-.114l5.363-4.94A.496.496 0 0 0 13 5.53a.496.496 0 0 0-.16-.382.589.589 0 0 0-.415-.148.59.59 0 0 0-.416.148l-4.94 4.55-2.085-1.92a.579.579 0 0 0-.408-.147.579.579 0 0 0-.408.148A.52.52 0 0 0 4 8.16a.476.476 0 0 0 .154.383l2.506 2.308a.515.515 0 0 0 .19.114Z",
|
|
1062
|
+
fill: "#00236A"
|
|
1063
|
+
}));
|
|
987
1064
|
|
|
988
|
-
const
|
|
1065
|
+
const SingleCheckbox = ({
|
|
989
1066
|
checked
|
|
990
1067
|
}) => {
|
|
991
1068
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
992
1069
|
style: {
|
|
993
1070
|
marginRight: '9px'
|
|
994
1071
|
}
|
|
995
|
-
}, checked ? /*#__PURE__*/React__default["default"].createElement("
|
|
996
|
-
src: ReactCheckboxChecked
|
|
997
|
-
}) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
998
|
-
src: ReactCheckbox
|
|
999
|
-
}));
|
|
1072
|
+
}, checked ? /*#__PURE__*/React__default["default"].createElement(SvgCheckboxChecked, null) : /*#__PURE__*/React__default["default"].createElement(SvgCheckboxUnchecked, null));
|
|
1000
1073
|
};
|
|
1001
|
-
|
|
1074
|
+
SingleCheckbox.propTypes = {
|
|
1002
1075
|
checked: PropTypes__default["default"].bool
|
|
1003
1076
|
};
|
|
1004
1077
|
|
|
@@ -1264,7 +1337,7 @@ const Select = ({
|
|
|
1264
1337
|
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
1265
1338
|
borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
|
|
1266
1339
|
backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
|
|
1267
|
-
top: selectedMinHeight ? selectedMinHeight.includes('rem') ? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) + 6 + 'px' : configStyles.SELECT.selectedMinHeight.includes('rem') ? parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 3)) + 0.6 + 'rem' : parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 2)) + 6 + 'px'
|
|
1340
|
+
top: selectedMinHeight ? selectedMinHeight.includes('rem') ? parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) + 6 + 'px' : configStyles.SELECT.selectedMinHeight.includes('rem') ? parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 3)) + 0.6 + 'rem' : parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 2)) + 6 + 'px'
|
|
1268
1341
|
},
|
|
1269
1342
|
className: `${styles$6['select-content-bottom']}`
|
|
1270
1343
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -1290,7 +1363,7 @@ const Select = ({
|
|
|
1290
1363
|
marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
|
|
1291
1364
|
backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
|
|
1292
1365
|
}
|
|
1293
|
-
}, multiple && multipleCheckbox ? /*#__PURE__*/React__default["default"].createElement(
|
|
1366
|
+
}, multiple && multipleCheckbox ? /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
|
|
1294
1367
|
checked: option.checked
|
|
1295
1368
|
}) : '', option[keyNames.name]);
|
|
1296
1369
|
}))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -1700,7 +1773,7 @@ const Toaster = () => {
|
|
|
1700
1773
|
});
|
|
1701
1774
|
};
|
|
1702
1775
|
|
|
1703
|
-
var ReactInfoIcon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\
|
|
1776
|
+
var ReactInfoIcon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8 0C3.58214 0 0 3.58214 0 8C0 12.4179 3.58214 16 8 16C12.4179 16 16 12.4179 16 8C16 3.58214 12.4179 0 8 0ZM8.57143 11.8571C8.57143 11.9357 8.50714 12 8.42857 12H7.57143C7.49286 12 7.42857 11.9357 7.42857 11.8571V7C7.42857 6.92143 7.49286 6.85714 7.57143 6.85714H8.42857C8.50714 6.85714 8.57143 6.92143 8.57143 7V11.8571ZM8 5.71429C7.7757 5.70971 7.56213 5.61739 7.40513 5.45714C7.24812 5.2969 7.16018 5.08149 7.16018 4.85714C7.16018 4.6328 7.24812 4.41739 7.40513 4.25714C7.56213 4.0969 7.7757 4.00458 8 4C8.2243 4.00458 8.43787 4.0969 8.59488 4.25714C8.75189 4.41739 8.83982 4.6328 8.83982 4.85714C8.83982 5.08149 8.75189 5.2969 8.59488 5.45714C8.43787 5.61739 8.2243 5.70971 8 5.71429Z\" fill=\"#D1D1D1\"/>\n</svg>";
|
|
1704
1777
|
|
|
1705
1778
|
var css_248z$4 = ".tooltip-module_tooltip-block__v8U9u{align-items:center;display:flex;justify-content:center;position:relative}.tooltip-module_tooltip__emM6A{padding:10px;position:absolute;z-index:1}.tooltip-module_tooltip-rel__to9gq{align-items:center;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;display:flex;height:auto;justify-content:center;min-height:10px;min-width:30px;position:relative;width:auto}.tooltip-module_tooltip-decor__qvt7t{border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;height:10px;position:absolute;transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);width:10px;z-index:-1}";
|
|
1706
1779
|
var styles$4 = {"tooltip-block":"tooltip-module_tooltip-block__v8U9u","tooltip":"tooltip-module_tooltip__emM6A","tooltip-rel":"tooltip-module_tooltip-rel__to9gq","tooltip-decor":"tooltip-module_tooltip-decor__qvt7t"};
|
|
@@ -2209,7 +2282,7 @@ exports.Modal = Modal;
|
|
|
2209
2282
|
exports.Pagination = Pagination;
|
|
2210
2283
|
exports.Radio = Radio;
|
|
2211
2284
|
exports.Select = Select;
|
|
2212
|
-
exports.
|
|
2285
|
+
exports.SingleCheckbox = SingleCheckbox;
|
|
2213
2286
|
exports.Stepper = Stepper;
|
|
2214
2287
|
exports.Table = Table;
|
|
2215
2288
|
exports.Toaster = Toaster;
|
package/package.json
CHANGED
|
@@ -97,16 +97,11 @@
|
|
|
97
97
|
overflow: hidden;
|
|
98
98
|
}
|
|
99
99
|
.upload-file-content > img {
|
|
100
|
-
position: absolute;
|
|
101
|
-
top: 0;
|
|
102
|
-
left: 0;
|
|
103
|
-
right: 0;
|
|
104
|
-
bottom: 0;
|
|
105
|
-
margin: auto;
|
|
106
100
|
display: block;
|
|
107
|
-
width:
|
|
108
|
-
height:
|
|
109
|
-
max-height:
|
|
101
|
+
width: 27.8rem;
|
|
102
|
+
height: auto;
|
|
103
|
+
max-height: 95%;
|
|
104
|
+
object-fit: contain;
|
|
110
105
|
}
|
|
111
106
|
.file-form-title {
|
|
112
107
|
margin-bottom: 10px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { compereConfigs } from "./../../utils";
|
|
@@ -20,6 +20,7 @@ export const Input = ({
|
|
|
20
20
|
label,
|
|
21
21
|
value,
|
|
22
22
|
width,
|
|
23
|
+
regexp,
|
|
23
24
|
height,
|
|
24
25
|
radius,
|
|
25
26
|
padding,
|
|
@@ -56,14 +57,18 @@ export const Input = ({
|
|
|
56
57
|
errorLineHeight,
|
|
57
58
|
labelLineHeight,
|
|
58
59
|
backgroundColor,
|
|
60
|
+
telErrorMessage,
|
|
59
61
|
labelMarginBottom,
|
|
62
|
+
regexpErrorMessage,
|
|
60
63
|
phoneJustifyContent,
|
|
61
64
|
errorAnimationDuration,
|
|
62
65
|
...props
|
|
63
66
|
}) => {
|
|
64
|
-
const phoneNumberRegex = /^\d{
|
|
67
|
+
const phoneNumberRegex = /^\d{8}$/;
|
|
65
68
|
const [show, setShow] = useState(false);
|
|
66
69
|
const [isHover, setIsHover] = useState(false);
|
|
70
|
+
const [innerValue, setInnerValue] = useState('');
|
|
71
|
+
const [innerErrorMessage, setInnerErrorMessage] = useState('');
|
|
67
72
|
|
|
68
73
|
const random = Math.floor((Math.random() * 1000) + 1);
|
|
69
74
|
const configStyles = compereConfigs();
|
|
@@ -91,15 +96,23 @@ export const Input = ({
|
|
|
91
96
|
`;
|
|
92
97
|
|
|
93
98
|
const handleChange = (event) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
const currentValue = event.target.value;
|
|
100
|
+
if (onChange) {
|
|
101
|
+
currentValue.length > maxLength ? onChange(currentValue.substr(0, maxLength)) : onChange(currentValue);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setInnerValue(currentValue);
|
|
105
|
+
if (type === 'tel') {
|
|
106
|
+
!phoneNumberRegex.test(parseInt(currentValue)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (maxLength) {
|
|
110
|
+
currentValue.length > maxLength ? setInnerValue(currentValue.substr(0, maxLength)) : setInnerValue(currentValue);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (regexp) {
|
|
114
|
+
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
115
|
+
}
|
|
103
116
|
};
|
|
104
117
|
|
|
105
118
|
const handleMouseEnter = () => {
|
|
@@ -109,6 +122,41 @@ export const Input = ({
|
|
|
109
122
|
const handleMouseLeave = () => {
|
|
110
123
|
setIsHover(false);
|
|
111
124
|
};
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (value && value !== '') {
|
|
128
|
+
setInnerValue(value);
|
|
129
|
+
if (type === 'tel') {
|
|
130
|
+
!phoneNumberRegex.test(parseInt(value)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (maxLength) {
|
|
134
|
+
value.length > maxLength ? setInnerValue(value.substr(0, maxLength)) : setInnerValue(value);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (regexp) {
|
|
138
|
+
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [value]);
|
|
142
|
+
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (errorMessage) {
|
|
145
|
+
setInnerErrorMessage(errorMessage);
|
|
146
|
+
}
|
|
147
|
+
}, [errorMessage]);
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (type === 'tel' && !telErrorMessage) {
|
|
151
|
+
alert('Please add telErrorMessage on input component');
|
|
152
|
+
}
|
|
153
|
+
}, [type]);
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (regexp && !regexpErrorMessage) {
|
|
157
|
+
alert('Please add regexpErrorMessage prop on input component');
|
|
158
|
+
}
|
|
159
|
+
}, [regexp]);
|
|
112
160
|
|
|
113
161
|
return (
|
|
114
162
|
<div className={`${styles["input-wrap"]}`}>
|
|
@@ -124,7 +172,7 @@ export const Input = ({
|
|
|
124
172
|
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.INPUT.labelMarginBottom
|
|
125
173
|
}}
|
|
126
174
|
>
|
|
127
|
-
{label} {required && <sup style={{ color: "#ee0000" }}>*</sup>}
|
|
175
|
+
{label} {required && <sup style={{ color: errorColor ? errorColor : "#ee0000" }}>*</sup>}
|
|
128
176
|
</label>
|
|
129
177
|
: ''
|
|
130
178
|
}
|
|
@@ -133,7 +181,7 @@ export const Input = ({
|
|
|
133
181
|
style={{
|
|
134
182
|
width: width ? width : configStyles.INPUT.width,
|
|
135
183
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
136
|
-
boxShadow:
|
|
184
|
+
boxShadow: innerErrorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
137
185
|
}}
|
|
138
186
|
onMouseEnter={handleMouseEnter}
|
|
139
187
|
onMouseLeave={handleMouseLeave}
|
|
@@ -171,7 +219,7 @@ export const Input = ({
|
|
|
171
219
|
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
172
220
|
display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
|
|
173
221
|
alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
|
|
174
|
-
color:
|
|
222
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
175
223
|
justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
|
|
176
224
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
177
225
|
}}
|
|
@@ -182,9 +230,7 @@ export const Input = ({
|
|
|
182
230
|
}
|
|
183
231
|
<input
|
|
184
232
|
{...props}
|
|
185
|
-
|
|
186
|
-
// value={type === 'tel' ? phoneNumberRegex.test(value) ? value : '' : maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value}
|
|
187
|
-
value={maxLength && value && value.length > maxLength ? value.substr(0, maxLength) : value}
|
|
233
|
+
value={innerValue}
|
|
188
234
|
className={classProps}
|
|
189
235
|
onChange={handleChange}
|
|
190
236
|
type={show ? 'text' : type}
|
|
@@ -203,7 +249,7 @@ export const Input = ({
|
|
|
203
249
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
204
250
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
205
251
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
206
|
-
color:
|
|
252
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
207
253
|
}}
|
|
208
254
|
/>
|
|
209
255
|
{
|
|
@@ -231,7 +277,7 @@ export const Input = ({
|
|
|
231
277
|
tooltip ? tooltip : ''
|
|
232
278
|
}
|
|
233
279
|
{
|
|
234
|
-
|
|
280
|
+
innerErrorMessage ?
|
|
235
281
|
<P
|
|
236
282
|
style={{
|
|
237
283
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
@@ -245,7 +291,7 @@ export const Input = ({
|
|
|
245
291
|
}}
|
|
246
292
|
className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
|
|
247
293
|
>
|
|
248
|
-
{
|
|
294
|
+
{innerErrorMessage}
|
|
249
295
|
</P>
|
|
250
296
|
: ''
|
|
251
297
|
}
|
|
@@ -290,11 +336,14 @@ Input.propTypes = {
|
|
|
290
336
|
errorPosition: PropTypes.string,
|
|
291
337
|
boxShadowHover: PropTypes.string,
|
|
292
338
|
errorClassName: PropTypes.string,
|
|
339
|
+
telErrorMessage: PropTypes.string,
|
|
293
340
|
backgroundColor: PropTypes.string,
|
|
294
341
|
phoneAlignItems: PropTypes.string,
|
|
295
342
|
errorLineHeight: PropTypes.string,
|
|
296
343
|
labelLineHeight: PropTypes.string,
|
|
297
344
|
labelMarginBottom: PropTypes.string,
|
|
345
|
+
regexpErrorMessage: PropTypes.string,
|
|
346
|
+
regexp: PropTypes.instanceOf(RegExp),
|
|
298
347
|
phoneJustifyContent: PropTypes.string,
|
|
299
348
|
errorAnimationDuration: PropTypes.string,
|
|
300
349
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
title: "Components/Input",
|
|
7
7
|
argsType: {
|
|
8
8
|
onChange: {
|
|
9
|
-
control: { type: '
|
|
9
|
+
control: { type: 'function' }
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -19,7 +19,3 @@ Default.args = {
|
|
|
19
19
|
onChange: (val) => {}
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const PASSWORD = Template.bind({});
|
|
23
|
-
PASSWORD.args = {
|
|
24
|
-
type: InputTypes.PASSWORD,
|
|
25
|
-
};
|
|
@@ -2,7 +2,7 @@ import React, {useEffect, useState, useRef} from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { compereConfigs } from "./../../utils";
|
|
5
|
-
import {
|
|
5
|
+
import { SingleCheckbox } from '../singleCheckbox';
|
|
6
6
|
|
|
7
7
|
import ReactArrowIcon from '../icon/Arrow';
|
|
8
8
|
import ReactCloseIcon from '../icon/CloseIcon';
|
|
@@ -287,8 +287,8 @@ export const Select = ({
|
|
|
287
287
|
parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 3)) + 0.6 + 'rem' :
|
|
288
288
|
parseFloat(selectedMinHeight.substr(0, selectedMinHeight.length - 2)) + 6 + 'px'
|
|
289
289
|
: configStyles.SELECT.selectedMinHeight.includes('rem') ?
|
|
290
|
-
parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 3)) + 0.6 + 'rem' :
|
|
291
|
-
parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight - 2)) + 6 + 'px'
|
|
290
|
+
parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 3)) + 0.6 + 'rem' :
|
|
291
|
+
parseFloat(configStyles.SELECT.selectedMinHeight.substr(0, configStyles.SELECT.selectedMinHeight.length - 2)) + 6 + 'px'
|
|
292
292
|
}}
|
|
293
293
|
className={`${styles['select-content-bottom']}`}
|
|
294
294
|
>
|
|
@@ -316,7 +316,7 @@ export const Select = ({
|
|
|
316
316
|
backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor,
|
|
317
317
|
}}
|
|
318
318
|
>
|
|
319
|
-
{multiple && multipleCheckbox ? <
|
|
319
|
+
{multiple && multipleCheckbox ? <SingleCheckbox checked={option.checked} /> : ''}
|
|
320
320
|
{option[keyNames.name]}
|
|
321
321
|
</div>
|
|
322
322
|
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import ReactCheckbox from '../icon/CheckboxUnchecked';
|
|
5
|
+
import ReactCheckboxChecked from '../icon/CheckboxChecked';
|
|
6
|
+
|
|
7
|
+
export const SingleCheckbox = ({ checked }) => {
|
|
8
|
+
|
|
9
|
+
return <div
|
|
10
|
+
style={{
|
|
11
|
+
marginRight: '9px'
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
{ checked ? <ReactCheckboxChecked /> : <ReactCheckbox /> }
|
|
15
|
+
</div>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
SingleCheckbox.propTypes = {
|
|
19
|
+
checked: PropTypes.bool,
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SingleCheckbox } from ".";
|
|
3
|
+
export default {
|
|
4
|
+
component: SingleCheckbox,
|
|
5
|
+
title: "Components/SingleCheckbox",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <SingleCheckbox {...args} />;
|
|
9
|
+
|
|
10
|
+
export const Default = Template.bind({});
|
package/src/index.js
CHANGED
|
@@ -14,4 +14,4 @@ export * from './components/icon/Icon';
|
|
|
14
14
|
export * from './components/typography';
|
|
15
15
|
export * from './components/pagination';
|
|
16
16
|
export * from './components/autocomplate';
|
|
17
|
-
export * from './components/
|
|
17
|
+
export * from './components/singleCheckbox';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import ReactCheckbox from './../../assets/icons/checkbox-unchecked.svg';
|
|
5
|
-
import ReactCheckboxChecked from './../../assets/icons/checkbox-checked.svg';
|
|
6
|
-
|
|
7
|
-
export const SelectCheckbox = ({ checked }) => {
|
|
8
|
-
|
|
9
|
-
return <div
|
|
10
|
-
style={{
|
|
11
|
-
marginRight: '9px'
|
|
12
|
-
}}
|
|
13
|
-
>
|
|
14
|
-
{ checked ? <img src={ReactCheckboxChecked} /> : <img src={ReactCheckbox} /> }
|
|
15
|
-
</div>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
SelectCheckbox.propTypes = {
|
|
19
|
-
checked: PropTypes.bool,
|
|
20
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SelectCheckbox } from ".";
|
|
3
|
-
export default {
|
|
4
|
-
component: SelectCheckbox,
|
|
5
|
-
title: "Components/SelectCheckbox",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <SelectCheckbox {...args} />;
|
|
9
|
-
|
|
10
|
-
export const Default = Template.bind({});
|