@xaypay/tui 0.0.83 → 0.0.84

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,
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -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
 
@@ -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}`}