@xaypay/tui 0.0.65 → 0.0.67

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 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{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.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)}";
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,21 @@ const Input = ({
629
635
  animation: ${errorAnimation ? animation : 'none'};
630
636
  `;
631
637
  const handleChange = event => {
632
- // TODO: need to discuss
633
- // onChange
634
- // ? type === 'tel'
635
- // ? phoneNumberRegex.test(event.target.value)
636
- // ? onChange(event.target.value)
637
- // : _ => _
638
- // : onChange(event.target.value)
639
- // : _ => _;
640
- onChange ? onChange(event.target.value) : _ => _;
638
+ const currentValue = event.target.value;
639
+ if (onChange) {
640
+ onChange(currentValue);
641
+ } else {
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
+ }
652
+ }
641
653
  };
642
654
  const handleMouseEnter = () => {
643
655
  setIsHover(true);
@@ -645,6 +657,38 @@ const Input = ({
645
657
  const handleMouseLeave = () => {
646
658
  setIsHover(false);
647
659
  };
660
+ useEffect(() => {
661
+ if (value !== undefined && value !== null) {
662
+ setInnerValue(value);
663
+ if (type === 'tel') {
664
+ !phoneNumberRegex.test(parseInt(value)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
665
+ }
666
+ if (maxLength) {
667
+ value.length > maxLength ? setInnerValue(value.substr(0, maxLength)) : setInnerValue(value);
668
+ }
669
+ if (regexp) {
670
+ !regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
671
+ }
672
+ }
673
+ if (onChange && (value === undefined || value === null)) {
674
+ alert('Please add value prop on input component');
675
+ }
676
+ }, [value, onChange]);
677
+ useEffect(() => {
678
+ if (errorMessage) {
679
+ setInnerErrorMessage(errorMessage);
680
+ }
681
+ }, [errorMessage]);
682
+ useEffect(() => {
683
+ if (type === 'tel' && !telErrorMessage) {
684
+ alert('Please add telErrorMessage on input component');
685
+ }
686
+ }, [type]);
687
+ useEffect(() => {
688
+ if (regexp && !regexpErrorMessage) {
689
+ alert('Please add regexpErrorMessage prop on input component');
690
+ }
691
+ }, [regexp]);
648
692
  return /*#__PURE__*/React__default.createElement("div", {
649
693
  className: `${styles$8["input-wrap"]}`
650
694
  }, label ? /*#__PURE__*/React__default.createElement("label", {
@@ -659,14 +703,14 @@ const Input = ({
659
703
  }
660
704
  }, label, " ", required && /*#__PURE__*/React__default.createElement("sup", {
661
705
  style: {
662
- color: "#ee0000"
706
+ color: errorColor ? errorColor : "#ee0000"
663
707
  }
664
708
  }, "*")) : '', /*#__PURE__*/React__default.createElement("div", {
665
709
  className: `${styles$8["input-content"]}`,
666
710
  style: {
667
711
  width: width ? width : configStyles.INPUT.width,
668
712
  borderRadius: radius ? radius : configStyles.INPUT.radius,
669
- boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
713
+ 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
714
  },
671
715
  onMouseEnter: handleMouseEnter,
672
716
  onMouseLeave: handleMouseLeave
@@ -695,14 +739,12 @@ const Input = ({
695
739
  borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
696
740
  display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
697
741
  alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
698
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
742
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
699
743
  justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
700
744
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
701
745
  }
702
746
  }, "+374") : '', /*#__PURE__*/React__default.createElement("input", _extends({}, props, {
703
- // TODO: need to discuss
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,
747
+ value: innerValue,
706
748
  className: classProps,
707
749
  onChange: handleChange,
708
750
  type: show ? 'text' : type,
@@ -721,7 +763,7 @@ const Input = ({
721
763
  borderRadius: radius ? radius : configStyles.INPUT.radius,
722
764
  boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
723
765
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
724
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
766
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
725
767
  }
726
768
  })), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
727
769
  onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
@@ -737,7 +779,7 @@ const Input = ({
737
779
  borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
738
780
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
739
781
  }
740
- }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React__default.createElement(P, {
782
+ }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default.createElement(P, {
741
783
  style: {
742
784
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
743
785
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
@@ -749,7 +791,7 @@ const Input = ({
749
791
  transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform
750
792
  },
751
793
  className: errorClassName ? errorClassName : configStyles.INPUT.errorClassName
752
- }, errorMessage) : '');
794
+ }, innerErrorMessage) : '');
753
795
  };
754
796
  Input.propTypes = {
755
797
  name: PropTypes.string,
@@ -788,11 +830,14 @@ Input.propTypes = {
788
830
  errorPosition: PropTypes.string,
789
831
  boxShadowHover: PropTypes.string,
790
832
  errorClassName: PropTypes.string,
833
+ telErrorMessage: PropTypes.string,
791
834
  backgroundColor: PropTypes.string,
792
835
  phoneAlignItems: PropTypes.string,
793
836
  errorLineHeight: PropTypes.string,
794
837
  labelLineHeight: PropTypes.string,
795
838
  labelMarginBottom: PropTypes.string,
839
+ regexpErrorMessage: PropTypes.string,
840
+ regexp: PropTypes.instanceOf(RegExp),
796
841
  phoneJustifyContent: PropTypes.string,
797
842
  errorAnimationDuration: PropTypes.string,
798
843
  leftIcon: PropTypes.arrayOf(PropTypes.element),
@@ -951,24 +996,56 @@ Button.propTypes = {
951
996
  disabledBackgroundColor: PropTypes.string
952
997
  };
953
998
 
954
- 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>";
999
+ const SvgCheckboxUnchecked = ({
1000
+ title,
1001
+ titleId,
1002
+ ...props
1003
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
1004
+ width: "1em",
1005
+ height: "1em",
1006
+ viewBox: "0 0 16 16",
1007
+ fill: "none",
1008
+ xmlns: "http://www.w3.org/2000/svg",
1009
+ "aria-labelledby": titleId
1010
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
1011
+ id: titleId
1012
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
1013
+ fillRule: "evenodd",
1014
+ clipRule: "evenodd",
1015
+ 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",
1016
+ fill: "#D1D1D1"
1017
+ }));
955
1018
 
956
- 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>";
1019
+ const SvgCheckboxChecked = ({
1020
+ title,
1021
+ titleId,
1022
+ ...props
1023
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
1024
+ width: "1em",
1025
+ height: "1em",
1026
+ viewBox: "0 0 16 16",
1027
+ fill: "none",
1028
+ xmlns: "http://www.w3.org/2000/svg",
1029
+ "aria-labelledby": titleId
1030
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
1031
+ id: titleId
1032
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
1033
+ fillRule: "evenodd",
1034
+ clipRule: "evenodd",
1035
+ 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",
1036
+ fill: "#00236A"
1037
+ }));
957
1038
 
958
- const SelectCheckbox = ({
1039
+ const SingleCheckbox = ({
959
1040
  checked
960
1041
  }) => {
961
1042
  return /*#__PURE__*/React__default.createElement("div", {
962
1043
  style: {
963
1044
  marginRight: '9px'
964
1045
  }
965
- }, checked ? /*#__PURE__*/React__default.createElement("img", {
966
- src: ReactCheckboxChecked
967
- }) : /*#__PURE__*/React__default.createElement("img", {
968
- src: ReactCheckbox
969
- }));
1046
+ }, checked ? /*#__PURE__*/React__default.createElement(SvgCheckboxChecked, null) : /*#__PURE__*/React__default.createElement(SvgCheckboxUnchecked, null));
970
1047
  };
971
- SelectCheckbox.propTypes = {
1048
+ SingleCheckbox.propTypes = {
972
1049
  checked: PropTypes.bool
973
1050
  };
974
1051
 
@@ -1234,7 +1311,7 @@ const Select = ({
1234
1311
  boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
1235
1312
  borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
1236
1313
  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'
1314
+ 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
1315
  },
1239
1316
  className: `${styles$6['select-content-bottom']}`
1240
1317
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -1260,7 +1337,7 @@ const Select = ({
1260
1337
  marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
1261
1338
  backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
1262
1339
  }
1263
- }, multiple && multipleCheckbox ? /*#__PURE__*/React__default.createElement(SelectCheckbox, {
1340
+ }, multiple && multipleCheckbox ? /*#__PURE__*/React__default.createElement(SingleCheckbox, {
1264
1341
  checked: option.checked
1265
1342
  }) : '', option[keyNames.name]);
1266
1343
  }))) : null)), errorMessage ? /*#__PURE__*/React__default.createElement("span", {
@@ -2168,4 +2245,4 @@ Autocomplate.defaultProps = {
2168
2245
  required: false
2169
2246
  };
2170
2247
 
2171
- export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select, SelectCheckbox, Stepper, Table, Toaster, Tooltip, Typography, TypographyType, toast };
2248
+ 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{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.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)}";
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,21 @@ const Input = ({
659
665
  animation: ${errorAnimation ? animation : 'none'};
660
666
  `;
661
667
  const handleChange = event => {
662
- // TODO: need to discuss
663
- // onChange
664
- // ? type === 'tel'
665
- // ? phoneNumberRegex.test(event.target.value)
666
- // ? onChange(event.target.value)
667
- // : _ => _
668
- // : onChange(event.target.value)
669
- // : _ => _;
670
- onChange ? onChange(event.target.value) : _ => _;
668
+ const currentValue = event.target.value;
669
+ if (onChange) {
670
+ onChange(currentValue);
671
+ } else {
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
+ }
682
+ }
671
683
  };
672
684
  const handleMouseEnter = () => {
673
685
  setIsHover(true);
@@ -675,6 +687,38 @@ const Input = ({
675
687
  const handleMouseLeave = () => {
676
688
  setIsHover(false);
677
689
  };
690
+ React.useEffect(() => {
691
+ if (value !== undefined && value !== null) {
692
+ setInnerValue(value);
693
+ if (type === 'tel') {
694
+ !phoneNumberRegex.test(parseInt(value)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
695
+ }
696
+ if (maxLength) {
697
+ value.length > maxLength ? setInnerValue(value.substr(0, maxLength)) : setInnerValue(value);
698
+ }
699
+ if (regexp) {
700
+ !regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
701
+ }
702
+ }
703
+ if (onChange && (value === undefined || value === null)) {
704
+ alert('Please add value prop on input component');
705
+ }
706
+ }, [value, onChange]);
707
+ React.useEffect(() => {
708
+ if (errorMessage) {
709
+ setInnerErrorMessage(errorMessage);
710
+ }
711
+ }, [errorMessage]);
712
+ React.useEffect(() => {
713
+ if (type === 'tel' && !telErrorMessage) {
714
+ alert('Please add telErrorMessage on input component');
715
+ }
716
+ }, [type]);
717
+ React.useEffect(() => {
718
+ if (regexp && !regexpErrorMessage) {
719
+ alert('Please add regexpErrorMessage prop on input component');
720
+ }
721
+ }, [regexp]);
678
722
  return /*#__PURE__*/React__default["default"].createElement("div", {
679
723
  className: `${styles$8["input-wrap"]}`
680
724
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
@@ -689,14 +733,14 @@ const Input = ({
689
733
  }
690
734
  }, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
691
735
  style: {
692
- color: "#ee0000"
736
+ color: errorColor ? errorColor : "#ee0000"
693
737
  }
694
738
  }, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
695
739
  className: `${styles$8["input-content"]}`,
696
740
  style: {
697
741
  width: width ? width : configStyles.INPUT.width,
698
742
  borderRadius: radius ? radius : configStyles.INPUT.radius,
699
- boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
743
+ 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
744
  },
701
745
  onMouseEnter: handleMouseEnter,
702
746
  onMouseLeave: handleMouseLeave
@@ -725,14 +769,12 @@ const Input = ({
725
769
  borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
726
770
  display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
727
771
  alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
728
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
772
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
729
773
  justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
730
774
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
731
775
  }
732
776
  }, "+374") : '', /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
733
- // TODO: need to discuss
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,
777
+ value: innerValue,
736
778
  className: classProps,
737
779
  onChange: handleChange,
738
780
  type: show ? 'text' : type,
@@ -751,7 +793,7 @@ const Input = ({
751
793
  borderRadius: radius ? radius : configStyles.INPUT.radius,
752
794
  boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
753
795
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
754
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
796
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color
755
797
  }
756
798
  })), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
757
799
  onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
@@ -767,7 +809,7 @@ const Input = ({
767
809
  borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
768
810
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
769
811
  }
770
- }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
812
+ }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
771
813
  style: {
772
814
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
773
815
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
@@ -779,7 +821,7 @@ const Input = ({
779
821
  transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform
780
822
  },
781
823
  className: errorClassName ? errorClassName : configStyles.INPUT.errorClassName
782
- }, errorMessage) : '');
824
+ }, innerErrorMessage) : '');
783
825
  };
784
826
  Input.propTypes = {
785
827
  name: PropTypes__default["default"].string,
@@ -818,11 +860,14 @@ Input.propTypes = {
818
860
  errorPosition: PropTypes__default["default"].string,
819
861
  boxShadowHover: PropTypes__default["default"].string,
820
862
  errorClassName: PropTypes__default["default"].string,
863
+ telErrorMessage: PropTypes__default["default"].string,
821
864
  backgroundColor: PropTypes__default["default"].string,
822
865
  phoneAlignItems: PropTypes__default["default"].string,
823
866
  errorLineHeight: PropTypes__default["default"].string,
824
867
  labelLineHeight: PropTypes__default["default"].string,
825
868
  labelMarginBottom: PropTypes__default["default"].string,
869
+ regexpErrorMessage: PropTypes__default["default"].string,
870
+ regexp: PropTypes__default["default"].instanceOf(RegExp),
826
871
  phoneJustifyContent: PropTypes__default["default"].string,
827
872
  errorAnimationDuration: PropTypes__default["default"].string,
828
873
  leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
@@ -981,24 +1026,56 @@ Button.propTypes = {
981
1026
  disabledBackgroundColor: PropTypes__default["default"].string
982
1027
  };
983
1028
 
984
- 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>";
1029
+ const SvgCheckboxUnchecked = ({
1030
+ title,
1031
+ titleId,
1032
+ ...props
1033
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
1034
+ width: "1em",
1035
+ height: "1em",
1036
+ viewBox: "0 0 16 16",
1037
+ fill: "none",
1038
+ xmlns: "http://www.w3.org/2000/svg",
1039
+ "aria-labelledby": titleId
1040
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
1041
+ id: titleId
1042
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
1043
+ fillRule: "evenodd",
1044
+ clipRule: "evenodd",
1045
+ 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",
1046
+ fill: "#D1D1D1"
1047
+ }));
985
1048
 
986
- 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>";
1049
+ const SvgCheckboxChecked = ({
1050
+ title,
1051
+ titleId,
1052
+ ...props
1053
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
1054
+ width: "1em",
1055
+ height: "1em",
1056
+ viewBox: "0 0 16 16",
1057
+ fill: "none",
1058
+ xmlns: "http://www.w3.org/2000/svg",
1059
+ "aria-labelledby": titleId
1060
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
1061
+ id: titleId
1062
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
1063
+ fillRule: "evenodd",
1064
+ clipRule: "evenodd",
1065
+ 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",
1066
+ fill: "#00236A"
1067
+ }));
987
1068
 
988
- const SelectCheckbox = ({
1069
+ const SingleCheckbox = ({
989
1070
  checked
990
1071
  }) => {
991
1072
  return /*#__PURE__*/React__default["default"].createElement("div", {
992
1073
  style: {
993
1074
  marginRight: '9px'
994
1075
  }
995
- }, checked ? /*#__PURE__*/React__default["default"].createElement("img", {
996
- src: ReactCheckboxChecked
997
- }) : /*#__PURE__*/React__default["default"].createElement("img", {
998
- src: ReactCheckbox
999
- }));
1076
+ }, checked ? /*#__PURE__*/React__default["default"].createElement(SvgCheckboxChecked, null) : /*#__PURE__*/React__default["default"].createElement(SvgCheckboxUnchecked, null));
1000
1077
  };
1001
- SelectCheckbox.propTypes = {
1078
+ SingleCheckbox.propTypes = {
1002
1079
  checked: PropTypes__default["default"].bool
1003
1080
  };
1004
1081
 
@@ -1264,7 +1341,7 @@ const Select = ({
1264
1341
  boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
1265
1342
  borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
1266
1343
  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'
1344
+ 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
1345
  },
1269
1346
  className: `${styles$6['select-content-bottom']}`
1270
1347
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -1290,7 +1367,7 @@ const Select = ({
1290
1367
  marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
1291
1368
  backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
1292
1369
  }
1293
- }, multiple && multipleCheckbox ? /*#__PURE__*/React__default["default"].createElement(SelectCheckbox, {
1370
+ }, multiple && multipleCheckbox ? /*#__PURE__*/React__default["default"].createElement(SingleCheckbox, {
1294
1371
  checked: option.checked
1295
1372
  }) : '', option[keyNames.name]);
1296
1373
  }))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
@@ -2209,7 +2286,7 @@ exports.Modal = Modal;
2209
2286
  exports.Pagination = Pagination;
2210
2287
  exports.Radio = Radio;
2211
2288
  exports.Select = Select;
2212
- exports.SelectCheckbox = SelectCheckbox;
2289
+ exports.SingleCheckbox = SingleCheckbox;
2213
2290
  exports.Stepper = Stepper;
2214
2291
  exports.Table = Table;
2215
2292
  exports.Toaster = Toaster;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -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: auto;
108
- height: 190px;
109
- max-height: 190px;
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{0,8}$/;
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
- // TODO: need to discuss
95
- // onChange
96
- // ? type === 'tel'
97
- // ? phoneNumberRegex.test(event.target.value)
98
- // ? onChange(event.target.value)
99
- // : _ => _
100
- // : onChange(event.target.value)
101
- // : _ => _;
102
- onChange ? onChange(event.target.value) : _ => _
99
+ const currentValue = event.target.value;
100
+ if (onChange) {
101
+ onChange(currentValue);
102
+ } else {
103
+ setInnerValue(currentValue);
104
+ if (type === 'tel') {
105
+ !phoneNumberRegex.test(parseInt(currentValue)) ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage('');
106
+ }
107
+
108
+ if (maxLength) {
109
+ currentValue.length > maxLength ? setInnerValue(currentValue.substr(0, maxLength)) : setInnerValue(currentValue);
110
+ }
111
+
112
+ if (regexp) {
113
+ !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
114
+ }
115
+ }
103
116
  };
104
117
 
105
118
  const handleMouseEnter = () => {
@@ -109,6 +122,45 @@ export const Input = ({
109
122
  const handleMouseLeave = () => {
110
123
  setIsHover(false);
111
124
  };
125
+
126
+ useEffect(() => {
127
+ if (value !== undefined && value !== null) {
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
+
142
+ if (onChange && (value === undefined || value === null)) {
143
+ alert('Please add value prop on input component');
144
+ }
145
+ }, [value, onChange]);
146
+
147
+ useEffect(() => {
148
+ if (errorMessage) {
149
+ setInnerErrorMessage(errorMessage);
150
+ }
151
+ }, [errorMessage]);
152
+
153
+ useEffect(() => {
154
+ if (type === 'tel' && !telErrorMessage) {
155
+ alert('Please add telErrorMessage on input component');
156
+ }
157
+ }, [type]);
158
+
159
+ useEffect(() => {
160
+ if (regexp && !regexpErrorMessage) {
161
+ alert('Please add regexpErrorMessage prop on input component');
162
+ }
163
+ }, [regexp]);
112
164
 
113
165
  return (
114
166
  <div className={`${styles["input-wrap"]}`}>
@@ -124,7 +176,7 @@ export const Input = ({
124
176
  marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.INPUT.labelMarginBottom
125
177
  }}
126
178
  >
127
- {label} {required && <sup style={{ color: "#ee0000" }}>*</sup>}
179
+ {label} {required && <sup style={{ color: errorColor ? errorColor : "#ee0000" }}>*</sup>}
128
180
  </label>
129
181
  : ''
130
182
  }
@@ -133,7 +185,7 @@ export const Input = ({
133
185
  style={{
134
186
  width: width ? width : configStyles.INPUT.width,
135
187
  borderRadius: radius ? radius : configStyles.INPUT.radius,
136
- boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
188
+ 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
189
  }}
138
190
  onMouseEnter={handleMouseEnter}
139
191
  onMouseLeave={handleMouseLeave}
@@ -171,7 +223,7 @@ export const Input = ({
171
223
  borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
172
224
  display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
173
225
  alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
174
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
226
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
175
227
  justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
176
228
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
177
229
  }}
@@ -182,9 +234,7 @@ export const Input = ({
182
234
  }
183
235
  <input
184
236
  {...props}
185
- // TODO: need to discuss
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}
237
+ value={innerValue}
188
238
  className={classProps}
189
239
  onChange={handleChange}
190
240
  type={show ? 'text' : type}
@@ -203,7 +253,7 @@ export const Input = ({
203
253
  borderRadius: radius ? radius : configStyles.INPUT.radius,
204
254
  boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
205
255
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
206
- color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
256
+ color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
207
257
  }}
208
258
  />
209
259
  {
@@ -231,7 +281,7 @@ export const Input = ({
231
281
  tooltip ? tooltip : ''
232
282
  }
233
283
  {
234
- errorMessage ?
284
+ innerErrorMessage ?
235
285
  <P
236
286
  style={{
237
287
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
@@ -245,7 +295,7 @@ export const Input = ({
245
295
  }}
246
296
  className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
247
297
  >
248
- {errorMessage}
298
+ {innerErrorMessage}
249
299
  </P>
250
300
  : ''
251
301
  }
@@ -290,11 +340,14 @@ Input.propTypes = {
290
340
  errorPosition: PropTypes.string,
291
341
  boxShadowHover: PropTypes.string,
292
342
  errorClassName: PropTypes.string,
343
+ telErrorMessage: PropTypes.string,
293
344
  backgroundColor: PropTypes.string,
294
345
  phoneAlignItems: PropTypes.string,
295
346
  errorLineHeight: PropTypes.string,
296
347
  labelLineHeight: PropTypes.string,
297
348
  labelMarginBottom: PropTypes.string,
349
+ regexpErrorMessage: PropTypes.string,
350
+ regexp: PropTypes.instanceOf(RegExp),
298
351
  phoneJustifyContent: PropTypes.string,
299
352
  errorAnimationDuration: PropTypes.string,
300
353
  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: 'object' }
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 { SelectCheckbox } from './../selectCheckbox';
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 ? <SelectCheckbox checked={option.checked} /> : ''}
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({});
@@ -0,0 +1,153 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import { compereConfigs } from "./../../utils";
5
+
6
+ import './textarea.module.css';
7
+
8
+ export const Textarea = ({
9
+ size,
10
+ label,
11
+ width,
12
+ value,
13
+ height,
14
+ resize,
15
+ border,
16
+ radius,
17
+ padding,
18
+ required,
19
+ onChange,
20
+ minWidth,
21
+ maxWidth,
22
+ minHeight,
23
+ maxHeight,
24
+ boxSizing,
25
+ maxLength,
26
+ labelSize,
27
+ labelColor,
28
+ borderColor,
29
+ labelWeight,
30
+ placeholder,
31
+ labelDisplay,
32
+ backgroundColor,
33
+ borderFocusColor,
34
+ borderHoverColor,
35
+ labelRequiredColor
36
+ }) => {
37
+ const [isHover, setIsHover] = useState(false);
38
+ const [isFocus, setIsFocus] = useState(false);
39
+
40
+ const configStyles = compereConfigs();
41
+
42
+ const handleMouseEnter = () => {
43
+ setIsHover(true);
44
+ };
45
+
46
+ const handleMouseLeave = () => {
47
+ setIsHover(false);
48
+ };
49
+
50
+ const handleFocus = () => {
51
+ setIsFocus(true);
52
+ };
53
+
54
+ const handleBlur = () => {
55
+ setIsFocus(false);
56
+ };
57
+
58
+ useEffect(() => {
59
+ if (value === undefined) {
60
+ alert('Please add value prop on Textarea component');
61
+ }
62
+
63
+ if (!onChange) {
64
+ alert('Please add onChange function on Textarea component');
65
+ }
66
+ }, [value, onChange]);
67
+
68
+ return (
69
+ <>
70
+ {
71
+ label
72
+ ? <label
73
+ style={{
74
+ color: labelColor ? labelColor : configStyles.TEXTAREA.labelColor,
75
+ fontSize: labelSize ? labelSize : configStyles.TEXTAREA.labelSize,
76
+ display: labelDisplay ? labelDisplay : configStyles.TEXTAREA.labelDisplay,
77
+ fontWeight: labelWeight ? labelWeight : configStyles.TEXTAREA.labelWeight
78
+ }}
79
+ >
80
+ {label}
81
+ {
82
+ required &&
83
+ <sup style={{color: labelRequiredColor ? labelRequiredColor : configStyles.TEXTAREA.labelRequiredColor}}>*</sup>
84
+ }
85
+ </label>
86
+ : ''
87
+ }
88
+ <textarea
89
+ style={{
90
+ outline: 'none',
91
+ overflow: 'auto',
92
+ fontSize: size ? size : configStyles.TEXTAREA.size,
93
+ width: width ? width : configStyles.TEXTAREA.width,
94
+ height: height ? height : configStyles.TEXTAREA.height,
95
+ border: border ? border : configStyles.TEXTAREA.border,
96
+ padding: padding ? padding : configStyles.TEXTAREA.padding,
97
+ borderRadius: radius ? radius : configStyles.TEXTAREA.radius,
98
+ minWidth: minWidth ? minWidth : configStyles.TEXTAREA.minWidth,
99
+ maxWidth: maxWidth ? maxWidth : configStyles.TEXTAREA.maxWidth,
100
+ minHeight: minHeight ? minHeight : configStyles.TEXTAREA.minHeight,
101
+ maxHeight: maxHeight ? maxHeight : configStyles.TEXTAREA.maxHeight,
102
+ boxSizing: boxSizing ? boxSizing : configStyles.TEXTAREA.boxSizing,
103
+ backgroundColor: backgroundColor ? backgroundColor : configStyles.TEXTAREA.backgroundColor,
104
+ borderColor: isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor :
105
+ isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor :
106
+ borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
107
+ resize: resize ? resize : configStyles.TEXTAREA.resize,
108
+ }}
109
+ onBlur={handleBlur}
110
+ onChange={onChange}
111
+ onFocus={handleFocus}
112
+ placeholder={placeholder}
113
+ onMouseEnter={handleMouseEnter}
114
+ onMouseLeave={handleMouseLeave}
115
+ value={
116
+ maxLength ? value.length > maxLength ? value.substr(0, maxLength) : value :
117
+ configStyles.TEXTAREA.maxLength ? value.length > configStyles.TEXTAREA.maxLength ? value.substr(0, configStyles.TEXTAREA.maxLength) : value :
118
+ value
119
+ }
120
+ ></textarea>
121
+ </>
122
+ );
123
+ };
124
+
125
+ Textarea.propTypes = {
126
+ size: PropTypes.string,
127
+ label: PropTypes.string,
128
+ width: PropTypes.string,
129
+ height: PropTypes.string,
130
+ resize: PropTypes.string,
131
+ border: PropTypes.string,
132
+ radius: PropTypes.string,
133
+ required: PropTypes.bool,
134
+ padding: PropTypes.string,
135
+ minWidth: PropTypes.string,
136
+ maxWidth: PropTypes.string,
137
+ boxSizing: PropTypes.string,
138
+ minHeight: PropTypes.string,
139
+ maxHeight: PropTypes.string,
140
+ maxLength: PropTypes.number,
141
+ labelSize: PropTypes.string,
142
+ labelColor: PropTypes.string,
143
+ labelWeight: PropTypes.string,
144
+ borderColor: PropTypes.string,
145
+ placeholder: PropTypes.string,
146
+ labelDisplay: PropTypes.string,
147
+ backgroundColor: PropTypes.string,
148
+ value: PropTypes.string.isRequired,
149
+ borderFocusColor: PropTypes.string,
150
+ borderHoverColor: PropTypes.string,
151
+ onChange: PropTypes.func.isRequired,
152
+ labelRequiredColor: PropTypes.string
153
+ }
@@ -0,0 +1,21 @@
1
+ textarea::-webkit-scrollbar {
2
+ width: 6px;
3
+ }
4
+
5
+ textarea::-webkit-scrollbar-track {
6
+ background: #EEEEEE;
7
+ border-radius: 3px;
8
+ -webkit-border-radius: 3px;
9
+ -moz-border-radius: 3px;
10
+ -ms-border-radius: 3px;
11
+ -o-border-radius: 3px;
12
+ }
13
+
14
+ textarea::-webkit-scrollbar-thumb {
15
+ background: #D1D1D1;
16
+ border-radius: 3px;
17
+ -webkit-border-radius: 3px;
18
+ -moz-border-radius: 3px;
19
+ -ms-border-radius: 3px;
20
+ -o-border-radius: 3px;
21
+ }
@@ -0,0 +1,49 @@
1
+ import React, { useState } from 'react';
2
+ import { Textarea } from '.';
3
+
4
+ export default {
5
+ Comment: Textarea,
6
+ title: 'Components/Textarea'
7
+ }
8
+
9
+ const Template = (args) => {
10
+ const [val, setVal] = useState('');
11
+
12
+ const handleChangeValue = (e) => {
13
+ setVal(e.target.value);
14
+ }
15
+
16
+ return (
17
+ <Textarea value={val} onChange={handleChangeValue} {...args} />
18
+ );
19
+ };
20
+
21
+ export const Default = Template.bind({});
22
+ Default.args = {
23
+ label: 'Label for textarea',
24
+ required: true,
25
+ size: '16px',
26
+ radius: '6px',
27
+ width: '400px',
28
+ noResize: false,
29
+ height: '134px',
30
+ maxLength: 1500,
31
+ color: '#3C393E',
32
+ minWidth: '200px',
33
+ maxWidth: '500px',
34
+ labelSize: '16px',
35
+ resize: 'vertical',
36
+ minHeight: '100px',
37
+ maxHeight: '300px',
38
+ border: '2px solid',
39
+ padding: '12px 15px',
40
+ labelColor: '#3C393E',
41
+ labelWeight: 'normal',
42
+ labelDisplay: 'block',
43
+ borderColor: '#D1D1D1',
44
+ boxSizing: 'border-box',
45
+ backgroundColor: 'white',
46
+ borderHoverColor: '#3C393E',
47
+ borderFocusColor: '#00236A',
48
+ labelRequiredColor: '#ee0000',
49
+ }
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/selectCheckbox';
17
+ export * from './components/singleCheckbox';
@@ -403,3 +403,33 @@ import StackAlt from './assets/stackalt.svg';
403
403
  });
404
404
  }
405
405
  ```
406
+
407
+ ### Textarea
408
+
409
+ ```
410
+ {
411
+ size: '16px', // for font size
412
+ radius: '6px', // for border radius
413
+ width: '400px', // for width
414
+ resize: 'none', // for resize
415
+ height: '134px', // for height
416
+ maxLength: 1500, // for characters maximum count
417
+ color: '#3C393E', // for color
418
+ minWidth: '200px', // for minimum width
419
+ maxWidth: '500px', // for maximum width
420
+ labelSize: '16px', // for label font size
421
+ minHeight: '100px', // for minimum height
422
+ maxHeight: '300px', // for maximum height
423
+ border: '2px solid', // for border
424
+ padding: '12px 15px', // for padding
425
+ labelColor: '#3C393E', // for label color
426
+ labelWeight: 'normal', // for label font weight
427
+ labelDisplay: 'block', // for label display
428
+ borderColor: '#D1D1D1', // for border color
429
+ boxSizing: 'border-box', // for box sizing
430
+ backgroundColor: 'white', // for background color
431
+ borderHoverColor: '#3C393E', // for border color when hover action is happaning
432
+ borderFocusColor: '#00236A', // for boredr color when focus action is happaning
433
+ labelRequiredColor: '#ee0000', // for label required mark color
434
+ }
435
+ ```
@@ -12,7 +12,8 @@ import buttonImage from './static/button-usage.png';
12
12
  import selectImage from './static/select-usage.png';
13
13
  import inputTooltipImage from './static/input-tooltip-usage.png';
14
14
  import toasterImage from './static/toaster-container-usage.png';
15
- import toastImage from './static/toaster-usage.png'
15
+ import toastImage from './static/toaster-usage.png';
16
+ import textareaImage from './static/textarea-usage.png';
16
17
 
17
18
  <Meta title="Intro/Usage" />
18
19
 
@@ -145,3 +146,7 @@ import toastImage from './static/toaster-usage.png'
145
146
 
146
147
  #### createToast function usage
147
148
  <img src={toastImage} alt="toaster image" />
149
+
150
+ ### Textarea
151
+
152
+ <img src={textareaImage} alt="textarea image" />
package/tui.config.js CHANGED
@@ -225,5 +225,30 @@ module.exports = {
225
225
  optionItemBoxSizing: 'border-box', // for option box sizing
226
226
  optionItemBackgroudColor: '#ffffff', // for option background color
227
227
  optionItemBackgroudColorHover: 'unset', // for option background color ( when hover )
228
+ },
229
+ // default properties for <Textarea /> component
230
+ TEXTAREA: {
231
+ size: '16px',
232
+ radius: '6px',
233
+ width: '400px',
234
+ height: '134px',
235
+ color: '#3C393E',
236
+ minWidth: '200px',
237
+ maxWidth: '500px',
238
+ labelSize: '16px',
239
+ resize: 'vertical',
240
+ minHeight: '100px',
241
+ maxHeight: '300px',
242
+ border: '2px solid',
243
+ padding: '12px 15px',
244
+ labelColor: '#3C393E',
245
+ labelWeight: 'normal',
246
+ labelDisplay: 'block',
247
+ borderColor: '#D1D1D1',
248
+ boxSizing: 'border-box',
249
+ backgroundColor: 'white',
250
+ borderHoverColor: '#3C393E',
251
+ borderFocusColor: '#00236A',
252
+ labelRequiredColor: '#ee0000',
228
253
  }
229
254
  };
@@ -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({});