@xaypay/tui 0.0.83 → 0.0.85

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
@@ -657,13 +657,14 @@ Modal.defaultProps = {
657
657
  type: 'content'
658
658
  };
659
659
 
660
- var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
661
- var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k"};
660
+ var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
661
+ var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
662
662
  styleInject(css_248z$b);
663
663
 
664
664
  const InputTypes = {
665
665
  TEL: 'tel',
666
666
  TEXT: "text",
667
+ NUMBER: 'number',
667
668
  PASSWORD: "password"
668
669
  };
669
670
  const P = styled.span`
@@ -697,6 +698,8 @@ const Input = ({
697
698
  errorSize,
698
699
  labelSize,
699
700
  maxLength,
701
+ minNumSize,
702
+ maxNumSize,
700
703
  labelColor,
701
704
  errorColor,
702
705
  borderRight,
@@ -731,7 +734,7 @@ const Input = ({
731
734
  const [innerErrorMessage, setInnerErrorMessage] = useState('');
732
735
  const random = Math.floor(Math.random() * 1000 + 1);
733
736
  const configStyles = compereConfigs();
734
- const classProps = classnames(className ? className : configStyles.INPUT.className);
737
+ const classProps = classnames(className ? className : configStyles.INPUT.className, type === 'number' ? styles$9['inp-num'] : '');
735
738
  const errorShow = keyframes`
736
739
  100% {
737
740
  bottom: '-20px';
@@ -773,13 +776,33 @@ const Input = ({
773
776
  }
774
777
  }
775
778
  }
776
- if (maxLength && currentValue.length > maxLength && type !== 'tel') {
779
+ if (type === 'number') {
780
+ if (minNumSize && currentValue < minNumSize) {
781
+ setInnerValue(minNumSize);
782
+ if (change) {
783
+ change(minNumSize);
784
+ }
785
+ }
786
+ if (maxNumSize && currentValue > maxNumSize) {
787
+ setInnerValue(maxNumSize);
788
+ if (change) {
789
+ change(maxNumSize);
790
+ }
791
+ }
792
+ if (currentValue === '') {
793
+ setInnerValue('');
794
+ if (change) {
795
+ change('');
796
+ }
797
+ }
798
+ }
799
+ if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
777
800
  setInnerValue(currentValue.substr(0, maxLength));
778
801
  if (change) {
779
802
  change(currentValue.substr(0, maxLength));
780
803
  }
781
804
  }
782
- if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
805
+ if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
783
806
  !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
784
807
  if (change) {
785
808
  change(currentValue);
@@ -892,6 +915,8 @@ const Input = ({
892
915
  name: name ? name : `tui_${random}_tui`,
893
916
  placeholder: placeholder ? placeholder : '',
894
917
  autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
918
+ min: type === 'number' && minNumSize ? minNumSize : '',
919
+ max: type === 'number' && maxNumSize ? maxNumSize : '',
895
920
  style: {
896
921
  border: 'none',
897
922
  outline: 'none',
@@ -960,6 +985,8 @@ Input.propTypes = {
960
985
  errorLeft: PropTypes.string,
961
986
  labelSize: PropTypes.string,
962
987
  maxLength: PropTypes.number,
988
+ minNumSize: PropTypes.number,
989
+ maxNumSize: PropTypes.number,
963
990
  errorColor: PropTypes.string,
964
991
  labelColor: PropTypes.string,
965
992
  borderRight: PropTypes.string,
@@ -1068,12 +1095,14 @@ const Button = ({
1068
1095
  disabled,
1069
1096
  className,
1070
1097
  boxSizing,
1098
+ hoverColor,
1071
1099
  transition,
1072
1100
  contentWidth,
1073
1101
  disabledColor,
1074
1102
  textTransform,
1075
1103
  backgroundColor,
1076
1104
  disabledLineColor,
1105
+ backgroundHoverColor,
1077
1106
  disabledBackgroundColor,
1078
1107
  ...props
1079
1108
  }) => {
@@ -1108,9 +1137,9 @@ const Button = ({
1108
1137
  width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
1109
1138
  cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
1110
1139
  textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
1111
- backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
1140
+ backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : !outline && !disabled && isHover ? backgroundHoverColor ? backgroundHoverColor : configStyles.BUTTON.backgroundHoverColor : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
1112
1141
  boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` : 'none',
1113
- color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
1142
+ color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : !outline && !disabled && isHover ? hoverColor ? hoverColor : configStyles.BUTTON.hoverColor : color ? color : configStyles.BUTTON.color
1114
1143
  },
1115
1144
  type: type ? type : configStyles.BUTTON.type,
1116
1145
  disabled: disabled ? disabled : configStyles.BUTTON.disabled,
@@ -1139,12 +1168,14 @@ Button.propTypes = {
1139
1168
  padding: PropTypes.string,
1140
1169
  boxSizing: PropTypes.string,
1141
1170
  className: PropTypes.string,
1171
+ hoverColor: PropTypes.string,
1142
1172
  transition: PropTypes.string,
1143
1173
  contentWidth: PropTypes.bool,
1144
1174
  textTransform: PropTypes.string,
1145
1175
  disabledColor: PropTypes.string,
1146
1176
  backgroundColor: PropTypes.string,
1147
1177
  disabledLineColor: PropTypes.string,
1178
+ backgroundHoverColor: PropTypes.string,
1148
1179
  disabledBackgroundColor: PropTypes.string
1149
1180
  };
1150
1181
 
@@ -3853,7 +3884,10 @@ const NewAutocomplete = ({
3853
3884
  id: currentId
3854
3885
  });
3855
3886
  } else {
3856
- change('');
3887
+ change({
3888
+ name: '',
3889
+ id: ''
3890
+ });
3857
3891
  }
3858
3892
  };
3859
3893
  const handleClick = selectedValue => {
@@ -3947,7 +3981,7 @@ const NewAutocomplete = ({
3947
3981
  setId('');
3948
3982
  setInnerValue('');
3949
3983
  }
3950
- }, [selected]);
3984
+ }, []);
3951
3985
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label ? /*#__PURE__*/React__default.createElement("label", {
3952
3986
  style: {
3953
3987
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
package/dist/index.js CHANGED
@@ -687,13 +687,14 @@ Modal.defaultProps = {
687
687
  type: 'content'
688
688
  };
689
689
 
690
- var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
691
- var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k"};
690
+ var css_248z$b = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
691
+ var styles$9 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
692
692
  styleInject(css_248z$b);
693
693
 
694
694
  const InputTypes = {
695
695
  TEL: 'tel',
696
696
  TEXT: "text",
697
+ NUMBER: 'number',
697
698
  PASSWORD: "password"
698
699
  };
699
700
  const P = styled__default["default"].span`
@@ -727,6 +728,8 @@ const Input = ({
727
728
  errorSize,
728
729
  labelSize,
729
730
  maxLength,
731
+ minNumSize,
732
+ maxNumSize,
730
733
  labelColor,
731
734
  errorColor,
732
735
  borderRight,
@@ -761,7 +764,7 @@ const Input = ({
761
764
  const [innerErrorMessage, setInnerErrorMessage] = React.useState('');
762
765
  const random = Math.floor(Math.random() * 1000 + 1);
763
766
  const configStyles = compereConfigs();
764
- const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className);
767
+ const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className, type === 'number' ? styles$9['inp-num'] : '');
765
768
  const errorShow = styled.keyframes`
766
769
  100% {
767
770
  bottom: '-20px';
@@ -803,13 +806,33 @@ const Input = ({
803
806
  }
804
807
  }
805
808
  }
806
- if (maxLength && currentValue.length > maxLength && type !== 'tel') {
809
+ if (type === 'number') {
810
+ if (minNumSize && currentValue < minNumSize) {
811
+ setInnerValue(minNumSize);
812
+ if (change) {
813
+ change(minNumSize);
814
+ }
815
+ }
816
+ if (maxNumSize && currentValue > maxNumSize) {
817
+ setInnerValue(maxNumSize);
818
+ if (change) {
819
+ change(maxNumSize);
820
+ }
821
+ }
822
+ if (currentValue === '') {
823
+ setInnerValue('');
824
+ if (change) {
825
+ change('');
826
+ }
827
+ }
828
+ }
829
+ if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
807
830
  setInnerValue(currentValue.substr(0, maxLength));
808
831
  if (change) {
809
832
  change(currentValue.substr(0, maxLength));
810
833
  }
811
834
  }
812
- if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
835
+ if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
813
836
  !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
814
837
  if (change) {
815
838
  change(currentValue);
@@ -922,6 +945,8 @@ const Input = ({
922
945
  name: name ? name : `tui_${random}_tui`,
923
946
  placeholder: placeholder ? placeholder : '',
924
947
  autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
948
+ min: type === 'number' && minNumSize ? minNumSize : '',
949
+ max: type === 'number' && maxNumSize ? maxNumSize : '',
925
950
  style: {
926
951
  border: 'none',
927
952
  outline: 'none',
@@ -990,6 +1015,8 @@ Input.propTypes = {
990
1015
  errorLeft: PropTypes__default["default"].string,
991
1016
  labelSize: PropTypes__default["default"].string,
992
1017
  maxLength: PropTypes__default["default"].number,
1018
+ minNumSize: PropTypes__default["default"].number,
1019
+ maxNumSize: PropTypes__default["default"].number,
993
1020
  errorColor: PropTypes__default["default"].string,
994
1021
  labelColor: PropTypes__default["default"].string,
995
1022
  borderRight: PropTypes__default["default"].string,
@@ -1098,12 +1125,14 @@ const Button = ({
1098
1125
  disabled,
1099
1126
  className,
1100
1127
  boxSizing,
1128
+ hoverColor,
1101
1129
  transition,
1102
1130
  contentWidth,
1103
1131
  disabledColor,
1104
1132
  textTransform,
1105
1133
  backgroundColor,
1106
1134
  disabledLineColor,
1135
+ backgroundHoverColor,
1107
1136
  disabledBackgroundColor,
1108
1137
  ...props
1109
1138
  }) => {
@@ -1138,9 +1167,9 @@ const Button = ({
1138
1167
  width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
1139
1168
  cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
1140
1169
  textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
1141
- backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
1170
+ backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : !outline && !disabled && isHover ? backgroundHoverColor ? backgroundHoverColor : configStyles.BUTTON.backgroundHoverColor : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
1142
1171
  boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` : 'none',
1143
- color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
1172
+ color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : !outline && !disabled && isHover ? hoverColor ? hoverColor : configStyles.BUTTON.hoverColor : color ? color : configStyles.BUTTON.color
1144
1173
  },
1145
1174
  type: type ? type : configStyles.BUTTON.type,
1146
1175
  disabled: disabled ? disabled : configStyles.BUTTON.disabled,
@@ -1169,12 +1198,14 @@ Button.propTypes = {
1169
1198
  padding: PropTypes__default["default"].string,
1170
1199
  boxSizing: PropTypes__default["default"].string,
1171
1200
  className: PropTypes__default["default"].string,
1201
+ hoverColor: PropTypes__default["default"].string,
1172
1202
  transition: PropTypes__default["default"].string,
1173
1203
  contentWidth: PropTypes__default["default"].bool,
1174
1204
  textTransform: PropTypes__default["default"].string,
1175
1205
  disabledColor: PropTypes__default["default"].string,
1176
1206
  backgroundColor: PropTypes__default["default"].string,
1177
1207
  disabledLineColor: PropTypes__default["default"].string,
1208
+ backgroundHoverColor: PropTypes__default["default"].string,
1178
1209
  disabledBackgroundColor: PropTypes__default["default"].string
1179
1210
  };
1180
1211
 
@@ -3883,7 +3914,10 @@ const NewAutocomplete = ({
3883
3914
  id: currentId
3884
3915
  });
3885
3916
  } else {
3886
- change('');
3917
+ change({
3918
+ name: '',
3919
+ id: ''
3920
+ });
3887
3921
  }
3888
3922
  };
3889
3923
  const handleClick = selectedValue => {
@@ -3977,7 +4011,7 @@ const NewAutocomplete = ({
3977
4011
  setId('');
3978
4012
  setInnerValue('');
3979
4013
  }
3980
- }, [selected]);
4014
+ }, []);
3981
4015
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
3982
4016
  style: {
3983
4017
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -22,12 +22,14 @@ export const Button = ({
22
22
  disabled,
23
23
  className,
24
24
  boxSizing,
25
+ hoverColor,
25
26
  transition,
26
27
  contentWidth,
27
28
  disabledColor,
28
29
  textTransform,
29
30
  backgroundColor,
30
31
  disabledLineColor,
32
+ backgroundHoverColor,
31
33
  disabledBackgroundColor,
32
34
  ...props
33
35
  }) => {
@@ -73,7 +75,9 @@ export const Button = ({
73
75
  textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
74
76
  backgroundColor:
75
77
  (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor :
76
- outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
78
+ outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' :
79
+ !outline && !disabled && isHover? backgroundHoverColor ? backgroundHoverColor : configStyles.BUTTON.backgroundHoverColor :
80
+ backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
77
81
  boxShadow:
78
82
  outline ?
79
83
  disabled ?
@@ -82,7 +86,9 @@ export const Button = ({
82
86
  'none',
83
87
  color:
84
88
  (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor :
85
- outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
89
+ outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor :
90
+ !outline && !disabled && isHover ? hoverColor ? hoverColor : configStyles.BUTTON.hoverColor :
91
+ color ? color : configStyles.BUTTON.color
86
92
  }}
87
93
  type={type ? type : configStyles.BUTTON.type}
88
94
  disabled={disabled ? disabled : configStyles.BUTTON.disabled}
@@ -116,11 +122,13 @@ Button.propTypes = {
116
122
  padding: PropTypes.string,
117
123
  boxSizing: PropTypes.string,
118
124
  className: PropTypes.string,
125
+ hoverColor: PropTypes.string,
119
126
  transition: PropTypes.string,
120
127
  contentWidth: PropTypes.bool,
121
128
  textTransform: PropTypes.string,
122
129
  disabledColor: PropTypes.string,
123
130
  backgroundColor: PropTypes.string,
124
131
  disabledLineColor: PropTypes.string,
132
+ backgroundHoverColor: PropTypes.string,
125
133
  disabledBackgroundColor: PropTypes.string
126
134
  };
@@ -9,6 +9,7 @@ import styles from "./input.module.css";
9
9
  export const InputTypes = {
10
10
  TEL: 'tel',
11
11
  TEXT: "text",
12
+ NUMBER: 'number',
12
13
  PASSWORD: "password",
13
14
  };
14
15
 
@@ -44,6 +45,8 @@ export const Input = ({
44
45
  errorSize,
45
46
  labelSize,
46
47
  maxLength,
48
+ minNumSize,
49
+ maxNumSize,
47
50
  labelColor,
48
51
  errorColor,
49
52
  borderRight,
@@ -80,7 +83,8 @@ export const Input = ({
80
83
  const random = Math.floor((Math.random() * 1000) + 1);
81
84
  const configStyles = compereConfigs();
82
85
  const classProps = classnames(
83
- className ? className : configStyles.INPUT.className
86
+ className ? className : configStyles.INPUT.className,
87
+ type === 'number' ? styles['inp-num'] : ''
84
88
  );
85
89
 
86
90
  const errorShow = keyframes`
@@ -128,16 +132,37 @@ export const Input = ({
128
132
  }
129
133
  }
130
134
  }
131
- }
135
+ }
136
+
137
+ if (type === 'number') {
138
+ if (minNumSize && currentValue < minNumSize) {
139
+ setInnerValue(minNumSize);
140
+ if (change) {
141
+ change(minNumSize);
142
+ }
143
+ }
144
+ if (maxNumSize && currentValue > maxNumSize) {
145
+ setInnerValue(maxNumSize);
146
+ if (change) {
147
+ change(maxNumSize);
148
+ }
149
+ }
150
+ if (currentValue === '') {
151
+ setInnerValue('');
152
+ if (change) {
153
+ change('');
154
+ }
155
+ }
156
+ }
132
157
 
133
- if (maxLength && currentValue.length > maxLength && type !== 'tel') {
158
+ if (maxLength && currentValue.length > maxLength && type !== 'tel' && type !== 'number') {
134
159
  setInnerValue(currentValue.substr(0, maxLength));
135
160
  if (change) {
136
161
  change(currentValue.substr(0, maxLength));
137
162
  }
138
163
  }
139
164
 
140
- if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
165
+ if (regexp && regexpErrorMessage && !maxLength && type !== 'tel' && type !== 'number') {
141
166
  !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
142
167
  if (change) {
143
168
  change(currentValue);
@@ -280,6 +305,8 @@ export const Input = ({
280
305
  name={name ? name : `tui_${random}_tui`}
281
306
  placeholder={placeholder ? placeholder : ''}
282
307
  autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
308
+ min={type === 'number' && minNumSize ? minNumSize: ''}
309
+ max={type === 'number' && maxNumSize ? maxNumSize : ''}
283
310
  style={{
284
311
  border: 'none',
285
312
  outline: 'none',
@@ -368,6 +395,8 @@ Input.propTypes = {
368
395
  errorLeft: PropTypes.string,
369
396
  labelSize: PropTypes.string,
370
397
  maxLength: PropTypes.number,
398
+ minNumSize: PropTypes.number,
399
+ maxNumSize: PropTypes.number,
371
400
  errorColor: PropTypes.string,
372
401
  labelColor: PropTypes.string,
373
402
  borderRight: PropTypes.string,
@@ -20,6 +20,18 @@ input:-webkit-autofill:active {
20
20
  animation-fill-mode: forwards;
21
21
  }
22
22
 
23
+ /* Works for Chrome, Safari, Edge, Opera */
24
+ .inp-num::-webkit-outer-spin-button,
25
+ .inp-num::-webkit-inner-spin-button {
26
+ -webkit-appearance: none;
27
+ margin: 0;
28
+ }
29
+
30
+ /* Works for Firefox */
31
+ .inp-num[type="number"] {
32
+ -moz-appearance: textfield;
33
+ }
34
+
23
35
  @keyframes error-show {
24
36
  100% {
25
37
  bottom: -20px;
@@ -22,6 +22,8 @@ const Template = (args) => {
22
22
 
23
23
  export const Default = Template.bind({});
24
24
  Default.args = {
25
- type: InputTypes.TEXT
25
+ type: InputTypes.TEXT,
26
+ minNumSize: 1,
27
+ maxNumSize: 8.8
26
28
  };
27
29
 
@@ -28,7 +28,7 @@ const Template = (args) => {
28
28
  method: 'GET',
29
29
  headers: {
30
30
  'Content-Type': 'application/json',
31
- 'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjYyYTU0MzhmYjY3ODZmYzgzY2NkZmVkMGNlYzExZDZjY2IxNmRhNWJhYTVlOTMwMWVjNDU2MWRmYzIyMDcyYTc0ZjEyY2IxZGEzOTJlMjE5IiwiaWF0IjoxNjg2MDM0NTA0LjU5OTMzOSwibmJmIjoxNjg2MDM0NTA0LjU5OTM2NywiZXhwIjoxNjg2MDU5NzA0LjU4NDkxMiwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.DzzdZFLHiFTyUIlKIK25IMSxnjI0cQ5EaUT3vdMoZT3XjclPA1uohP4hiRr30Duy6psyOcPuQuZ2t8KuGUy5n500Di-Wbw0tZDVW-ctyOQNQRPjcTL41lN7xrTaRzxrkSa3KHlZT0_w4KjHTp32wo6XHWjLwrbZIFlBBbJv-bMBqj0KIcsLWHBMfHb2lU8UK6_xMgSbsV_E3FzrhbgmBeFifBTn9BVkduz450jWKmib5zKFRv4lqpFrMJo7gOQRj0-uQliCCdtnvOBW3QqBeT0Zl-RFH-Vc22GAxSYWF7PZ1M-tOZ2PlR7pyfJabp6nEtsRii5PhoejUBAynYmZBKxY-TvKGjfpOXcULm2w0zIqrV2KRf4acj189Kok_nE5rpReqc0xk6hxDdhyBPdBDtgm58c25G_fkkSpMJvDyZg0fqpCB7wkYfGpqeYH-eW4KYuZeReU1OyIKCTxBJhDfcFqZRb4x7TUIxNoFXknLhhU4mB7t75ZZxpUwtJRXqF_Ps8eiBWcfmt5uZfVQqzFXcBlx6lmDwBn7RIF0jy5oKvs6ss5mBjv0SdKSJrpRMa9GIVT9lUJDqKA15JZIGXdugjBXwlrzFfekePXA_7AAFrxgS0Dn7EZJCh7EmBdGG3slPLRtnkcVru2AOLHZ-aRPtVluzxgip9RU23VMVXvoX-I',
31
+ 'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIwMjE0NzEyYTllNzQwZWMyMjNhYzE2MGQyNGVkY2UzNyIsImp0aSI6IjJjNDMwNzVlNzExZTc4OWI1YzE3ZTY1OGZmMjdmZWZiMWU3NWU3ZGVkYjU5MTJlNjExMjg1YzE5YjAxZDQwYjc0OTg0ZTk5OTI0MTkxY2M0IiwiaWF0IjoxNjg2MjAxNDM4LjEyMzYwNiwibmJmIjoxNjg2MjAxNDM4LjEyMzYxMywiZXhwIjoxNjg2MjI2NjM4LjEwOTI5Niwic3ViIjoibWluYXM4OUBtYWlsLnJ1Iiwic2NvcGVzIjpbImVtYWlsIl19.EaNRUEWtVxPAV0yD5Ci53zxCRgxqw4ljfDEkkVcLqh8ypcymHDBITyQJackmopdTi9pqLq43G9XVynBgB5SYDp3mmfpJGdFipFLYG2h6X4VNFmwNaLDi5fAOzZ7bQCg3DDVcQ-_jYc4ph2PJYQT2ZafZ4EPwIBScra-PqrxvkdB7ww5KLELGRdDeqOVhGbXFWxe72gzjL_rAg9YTYEFjP-Qmue-Qqx_sYzRu1fuN8xZ0HJnEB5Ctzpdf8dV4qbb5SyOCtqbR34uTR7iFVu73kzw_udJvtyaywUjWXVrVlh-VOVgHEaUVmktyfwYo8dw6L3KIVWzkx09SePa4YpH5t6XyPD5sFbL7sx-fP3_uiiCtjAZc7vzRZmfbvOQc3C3-28FgjUADtV3f1qf5Kvdss4_8Q0iXaC2-SGHNcVL7SecD68l_px5Jl16mmkRCklo86EEWcV3Av-fAYnQ-4-6sVgkRtfABqi79gQfZac_emBxGEDE4trI81U6ApfTMcaRLfIehJauz9m94zwOyHPIv4t-1eLGRl0wvCTP8BLhgpMWq6F1UfHpTSSnr6dVTBv8IUKjTe4wJfwgU_TCnVbb0sZa2L3GR3vNsf1kDTe5sgOTCaq8INp-VfhxeULQr2eQaP2vTE4zrghKnQTA1YF1n1Hth4Rgc6pEhqW8f0oO-9Wk',
32
32
  },
33
33
  }).then((res)=> {
34
34
  return res.json()
@@ -42,11 +42,11 @@ const Template = (args) => {
42
42
  });
43
43
  };
44
44
 
45
- return <NewAutocomplete {...args} getItem={handleClick} options={newOptions} change={handleChange} />
45
+ return <NewAutocomplete {...args} getItem={handleClick} selected={{ "bbb":"0", "name":"gasdfgdsfgdsg" }} options={newOptions} change={handleChange} />
46
46
  };
47
47
  export const Default = Template.bind({});
48
48
  Default.args = {
49
49
  searchCount: 3,
50
50
  keyNames: { name: 'name', id: 'bbb' },
51
- selected: { "bbb":"0", "name":"gasdfgdsfgdsg" },
51
+ selected: { "bbb":"0", "name":"gasdfgdsfgdsg" }
52
52
  }
@@ -131,7 +131,7 @@ export const NewAutocomplete = ({
131
131
  if (value.length >= searchCount) {
132
132
  change({ name: value, id: currentId });
133
133
  } else {
134
- change('');
134
+ change({ name: '', id: '' });
135
135
  }
136
136
  };
137
137
 
@@ -270,7 +270,7 @@ export const NewAutocomplete = ({
270
270
  setId('');
271
271
  setInnerValue('');
272
272
  }
273
- }, [selected]);
273
+ }, []);
274
274
 
275
275
  return (
276
276
  <>
@@ -294,18 +294,27 @@ const bodyData = [
294
294
  'text for => test',
295
295
  ]
296
296
  },
297
- create: {
298
- content: '27.05.2022'
299
- },
297
+ create: [
298
+ [
299
+ {
300
+ content: '21'
301
+ }
302
+ ],
303
+ [
304
+ {
305
+ content: '13'
306
+ }
307
+ ]
308
+ ],
300
309
  actions: [
301
310
  [
302
311
  {
303
- id: 20037,
312
+ id: 21031,
304
313
  type: 'attach',
305
314
  content: <ReactSVGAttach />
306
315
  },
307
316
  {
308
- id: 20037,
317
+ id: 21031,
309
318
  type: 'plus',
310
319
  content: <ReactSVGPlus />
311
320
  }
@@ -58,27 +58,34 @@ const TD = ({
58
58
  </span>
59
59
  )
60
60
  } else if (newItem && Array.isArray(newItem)) {
61
- const x = item[newIndex].map((iT, iN) => {
62
- // console.log(iT, ' - - - ->>>>>>>>>>>>>>>>>>>>>>>');
63
- // return <span key={`${iT.id}_${iN}`}>
64
- // {iT}
65
- // </span>;
66
- return <span
61
+ return (
62
+ <span
67
63
  style={{
68
- width: '32px',
69
- height: '32px',
70
- marginRight: '10px'
64
+ display: 'inline-block',
65
+ marginRight: newIndex !== item.length - 1 ? '10px' : '0px',
66
+ borderRight: newIndex !== item.length - 1 ? '1px solid rgb(238, 238, 238)' : 'none'
71
67
  }}
72
- id={iT.id}
73
- type={iT.type}
74
- className={styles['td-span']}
75
- key={`${iT.id}_${iN}`}
76
- onClick={handleBodyActionClick}
77
68
  >
78
- { iT.content }
69
+ {
70
+ item[newIndex].map((iT, iN) => {
71
+ return <span
72
+ style={{
73
+ width: '32px',
74
+ height: '32px',
75
+ marginRight: '10px',
76
+ }}
77
+ id={iT.id ? iT.id : ''}
78
+ type={iT.type ? iT.type : ''}
79
+ className={styles['td-span']}
80
+ onClick={handleBodyActionClick}
81
+ key={`${iT.id || iT.content}_${iN}`}
82
+ >
83
+ { iT.content }
84
+ </span>
85
+ })
86
+ }
79
87
  </span>
80
- });
81
- console.log(x, 'x');
88
+ );
82
89
  } else {
83
90
  return <span
84
91
  key={`${newItem}_${newIndex}`}
@@ -144,6 +144,8 @@ import StackAlt from './assets/stackalt.svg';
144
144
  disabledLineColor: 'rgba(60, 57, 62, 1)', // for border color (outline) in disabled mode
145
145
  disabledBackgroundColor: 'rgba(238, 238, 238, 1)', // for background color in disabled mode
146
146
  transition: 'background-color 240ms, color 240ms', // for transition
147
+ hoverColor: '#001745', // for hover color
148
+ backgroundHoverColor: '#CB3A3A' // for hover background color
147
149
  }
148
150
  ```
149
151
 
package/tui.config.js CHANGED
@@ -21,6 +21,8 @@ module.exports = {
21
21
  disabledLineColor: 'rgba(60, 57, 62, 1)', // for border color (outline) in disabled mode
22
22
  disabledBackgroundColor: 'rgba(238, 238, 238, 1)', // for background color in disabled mode
23
23
  transition: 'background-color 240ms, color 240ms', // for transition
24
+ hoverColor: '#001745', // for hover color
25
+ backgroundHoverColor: '#CB3A3A' // for hover background color
24
26
  },
25
27
  // default properties for <Input /> component
26
28
  INPUT: {