@xaypay/tui 0.0.101 → 0.0.102

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
@@ -801,14 +801,7 @@ const Input = ({
801
801
  }
802
802
  }
803
803
  if (type === 'number') {
804
- const regNum = /^\d+(\.)?(^\d+)?$/;
805
- if (!regNum.test(currentValue)) {
806
- const newStr = currentValue.replace(/[^\d+]/g, '');
807
- setInnerValue(newStr);
808
- if (change) {
809
- change(newStr);
810
- }
811
- }
804
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
812
805
  if (minNumSize && currentValue < minNumSize) {
813
806
  setInnerValue(`${minNumSize}`);
814
807
  if (change) {
@@ -821,7 +814,7 @@ const Input = ({
821
814
  change(`${maxNumSize}`);
822
815
  }
823
816
  }
824
- if (floatToFix && floatToFix > 0) {
817
+ if (floatToFix > 0) {
825
818
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
826
819
  const int = floatNumParts[0];
827
820
  const float = floatNumParts[1];
@@ -859,7 +852,7 @@ const Input = ({
859
852
  }
860
853
  }
861
854
  }
862
- } else if (floatToFix === 0) {
855
+ } else {
863
856
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
864
857
  const int = floatNumParts[0];
865
858
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -869,6 +862,15 @@ const Input = ({
869
862
  }
870
863
  }
871
864
  }
865
+ if (!regNum.test(currentValue)) {
866
+ const newStr = currentValue.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
867
+ return b + c.replace(/\./g, '');
868
+ });
869
+ setInnerValue(newStr);
870
+ if (change) {
871
+ change(newStr);
872
+ }
873
+ }
872
874
  if (currentValue === '') {
873
875
  setInnerValue('');
874
876
  if (change) {
@@ -931,14 +933,7 @@ const Input = ({
931
933
  }
932
934
  }
933
935
  if (type === 'number') {
934
- const regNum = /^\d+(\.)?(\d+)?$/;
935
- if (!regNum.test(value)) {
936
- const newStr = value.replace(/[^\d+]/g, '');
937
- setInnerValue(newStr);
938
- if (change) {
939
- change(newStr);
940
- }
941
- }
936
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
942
937
  if (minNumSize && value < minNumSize) {
943
938
  setInnerValue(`${minNumSize}`);
944
939
  if (change) {
@@ -951,7 +946,7 @@ const Input = ({
951
946
  change(`${maxNumSize}`);
952
947
  }
953
948
  }
954
- if (floatToFix && floatToFix > 0) {
949
+ if (floatToFix > 0) {
955
950
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
956
951
  const int = floatNumParts[0];
957
952
  const float = floatNumParts[1];
@@ -989,7 +984,7 @@ const Input = ({
989
984
  }
990
985
  }
991
986
  }
992
- } else if (floatToFix === 0) {
987
+ } else {
993
988
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
994
989
  const int = floatNumParts[0];
995
990
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -999,6 +994,15 @@ const Input = ({
999
994
  }
1000
995
  }
1001
996
  }
997
+ if (!regNum.test(value)) {
998
+ const newStr = value.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
999
+ return b + c.replace(/\./g, '');
1000
+ });
1001
+ setInnerValue(newStr);
1002
+ if (change) {
1003
+ change(newStr);
1004
+ }
1005
+ }
1002
1006
  if (value === '') {
1003
1007
  setInnerValue('');
1004
1008
  if (change) {
@@ -1599,7 +1603,7 @@ const Select = ({
1599
1603
  }
1600
1604
  }) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default.createElement("div", {
1601
1605
  className: `${styles$8['select-content-top-icon']}`
1602
- }, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default.createElement("span", null, newSelected.length), (showCloseIcon || configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default.createElement("div", {
1606
+ }, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default.createElement("span", null, newSelected.length), (showCloseIcon === true || showCloseIcon === false ? showCloseIcon : configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default.createElement("div", {
1603
1607
  className: `${styles$8['close-icon']}`,
1604
1608
  onClick: disabled ? _ => _ : handleClearSelect,
1605
1609
  style: {
@@ -1977,7 +1981,7 @@ const createToast = ({
1977
1981
  toastParentBlock = document.createElement('div');
1978
1982
  toastParentBlock.style.position = 'fixed';
1979
1983
  toastParentBlock.style.display = 'flex';
1980
- toastParentBlock.style.zIndex = 9999999999999999999999999;
1984
+ toastParentBlock.style.zIndex = 999999999999;
1981
1985
  toastParentBlock.style.flexDirection = position === 'top-left' || position === 'top-right' || position === 'top-center' ? 'column-reverse' : 'column';
1982
1986
  toastParentBlock.setAttribute('id', styles$7[position]);
1983
1987
  toastParentBlock.appendChild(toastBlock);
package/dist/index.js CHANGED
@@ -831,14 +831,7 @@ const Input = ({
831
831
  }
832
832
  }
833
833
  if (type === 'number') {
834
- const regNum = /^\d+(\.)?(^\d+)?$/;
835
- if (!regNum.test(currentValue)) {
836
- const newStr = currentValue.replace(/[^\d+]/g, '');
837
- setInnerValue(newStr);
838
- if (change) {
839
- change(newStr);
840
- }
841
- }
834
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
842
835
  if (minNumSize && currentValue < minNumSize) {
843
836
  setInnerValue(`${minNumSize}`);
844
837
  if (change) {
@@ -851,7 +844,7 @@ const Input = ({
851
844
  change(`${maxNumSize}`);
852
845
  }
853
846
  }
854
- if (floatToFix && floatToFix > 0) {
847
+ if (floatToFix > 0) {
855
848
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
856
849
  const int = floatNumParts[0];
857
850
  const float = floatNumParts[1];
@@ -889,7 +882,7 @@ const Input = ({
889
882
  }
890
883
  }
891
884
  }
892
- } else if (floatToFix === 0) {
885
+ } else {
893
886
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
894
887
  const int = floatNumParts[0];
895
888
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -899,6 +892,15 @@ const Input = ({
899
892
  }
900
893
  }
901
894
  }
895
+ if (!regNum.test(currentValue)) {
896
+ const newStr = currentValue.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
897
+ return b + c.replace(/\./g, '');
898
+ });
899
+ setInnerValue(newStr);
900
+ if (change) {
901
+ change(newStr);
902
+ }
903
+ }
902
904
  if (currentValue === '') {
903
905
  setInnerValue('');
904
906
  if (change) {
@@ -961,14 +963,7 @@ const Input = ({
961
963
  }
962
964
  }
963
965
  if (type === 'number') {
964
- const regNum = /^\d+(\.)?(\d+)?$/;
965
- if (!regNum.test(value)) {
966
- const newStr = value.replace(/[^\d+]/g, '');
967
- setInnerValue(newStr);
968
- if (change) {
969
- change(newStr);
970
- }
971
- }
966
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
972
967
  if (minNumSize && value < minNumSize) {
973
968
  setInnerValue(`${minNumSize}`);
974
969
  if (change) {
@@ -981,7 +976,7 @@ const Input = ({
981
976
  change(`${maxNumSize}`);
982
977
  }
983
978
  }
984
- if (floatToFix && floatToFix > 0) {
979
+ if (floatToFix > 0) {
985
980
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
986
981
  const int = floatNumParts[0];
987
982
  const float = floatNumParts[1];
@@ -1019,7 +1014,7 @@ const Input = ({
1019
1014
  }
1020
1015
  }
1021
1016
  }
1022
- } else if (floatToFix === 0) {
1017
+ } else {
1023
1018
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
1024
1019
  const int = floatNumParts[0];
1025
1020
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -1029,6 +1024,15 @@ const Input = ({
1029
1024
  }
1030
1025
  }
1031
1026
  }
1027
+ if (!regNum.test(value)) {
1028
+ const newStr = value.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
1029
+ return b + c.replace(/\./g, '');
1030
+ });
1031
+ setInnerValue(newStr);
1032
+ if (change) {
1033
+ change(newStr);
1034
+ }
1035
+ }
1032
1036
  if (value === '') {
1033
1037
  setInnerValue('');
1034
1038
  if (change) {
@@ -1629,7 +1633,7 @@ const Select = ({
1629
1633
  }
1630
1634
  }) : defaultOption ? defaultOption : ''), /*#__PURE__*/React__default["default"].createElement("div", {
1631
1635
  className: `${styles$8['select-content-top-icon']}`
1632
- }, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default["default"].createElement("span", null, newSelected.length), (showCloseIcon || configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
1636
+ }, !disabled && multiple && newSelected.length > 1 && /*#__PURE__*/React__default["default"].createElement("span", null, newSelected.length), (showCloseIcon === true || showCloseIcon === false ? showCloseIcon : configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
1633
1637
  className: `${styles$8['close-icon']}`,
1634
1638
  onClick: disabled ? _ => _ : handleClearSelect,
1635
1639
  style: {
@@ -2007,7 +2011,7 @@ const createToast = ({
2007
2011
  toastParentBlock = document.createElement('div');
2008
2012
  toastParentBlock.style.position = 'fixed';
2009
2013
  toastParentBlock.style.display = 'flex';
2010
- toastParentBlock.style.zIndex = 9999999999999999999999999;
2014
+ toastParentBlock.style.zIndex = 999999999999;
2011
2015
  toastParentBlock.style.flexDirection = position === 'top-left' || position === 'top-right' || position === 'top-center' ? 'column-reverse' : 'column';
2012
2016
  toastParentBlock.setAttribute('id', styles$7[position]);
2013
2017
  toastParentBlock.appendChild(toastBlock);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.101",
3
+ "version": "0.0.102",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -136,14 +136,8 @@ export const Input = ({
136
136
  }
137
137
 
138
138
  if (type === 'number') {
139
- const regNum = /^\d+(\.)?(^\d+)?$/;
140
- if (!regNum.test(currentValue)) {
141
- const newStr = currentValue.replace(/[^\d+]/g, '');
142
- setInnerValue(newStr);
143
- if (change) {
144
- change(newStr);
145
- }
146
- }
139
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
140
+
147
141
  if (minNumSize && currentValue < minNumSize) {
148
142
  setInnerValue(`${minNumSize}`);
149
143
  if (change) {
@@ -156,7 +150,7 @@ export const Input = ({
156
150
  change(`${maxNumSize}`);
157
151
  }
158
152
  }
159
- if (floatToFix && floatToFix > 0) {
153
+ if (floatToFix > 0) {
160
154
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
161
155
  const int = floatNumParts[0];
162
156
  const float = floatNumParts[1];
@@ -195,7 +189,7 @@ export const Input = ({
195
189
  }
196
190
  }
197
191
  }
198
- } else if (floatToFix === 0) {
192
+ } else {
199
193
  const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
200
194
  const int = floatNumParts[0];
201
195
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -206,6 +200,15 @@ export const Input = ({
206
200
  }
207
201
  }
208
202
 
203
+ if (!regNum.test(currentValue)) {
204
+ const newStr = currentValue.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
205
+ return b + c.replace(/\./g, '');
206
+ });
207
+ setInnerValue(newStr);
208
+ if (change) {
209
+ change(newStr);
210
+ }
211
+ }
209
212
  if (currentValue === '') {
210
213
  setInnerValue('');
211
214
  if (change) {
@@ -276,14 +279,8 @@ export const Input = ({
276
279
  }
277
280
 
278
281
  if (type === 'number') {
279
- const regNum = /^\d+(\.)?(\d+)?$/;
280
- if (!regNum.test(value)) {
281
- const newStr = value.replace(/[^\d+]/g, '');
282
- setInnerValue(newStr);
283
- if (change) {
284
- change(newStr);
285
- }
286
- }
282
+ const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
283
+
287
284
  if (minNumSize && value < minNumSize) {
288
285
  setInnerValue(`${minNumSize}`);
289
286
  if (change) {
@@ -296,7 +293,7 @@ export const Input = ({
296
293
  change(`${maxNumSize}`);
297
294
  }
298
295
  }
299
- if (floatToFix && floatToFix > 0) {
296
+ if (floatToFix > 0) {
300
297
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
301
298
  const int = floatNumParts[0];
302
299
  const float = floatNumParts[1];
@@ -335,7 +332,7 @@ export const Input = ({
335
332
  }
336
333
  }
337
334
  }
338
- } else if (floatToFix === 0) {
335
+ } else {
339
336
  const floatNumParts = typeof value === 'string' ? value.split('.') : value;
340
337
  const int = floatNumParts[0];
341
338
  if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
@@ -345,6 +342,15 @@ export const Input = ({
345
342
  }
346
343
  }
347
344
  }
345
+ if (!regNum.test(value)) {
346
+ const newStr = value.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
347
+ return b + c.replace(/\./g, '');
348
+ });
349
+ setInnerValue(newStr);
350
+ if (change) {
351
+ change(newStr);
352
+ }
353
+ }
348
354
  if (value === '') {
349
355
  setInnerValue('');
350
356
  if (change) {
@@ -270,7 +270,7 @@ export const Select = ({
270
270
  !disabled && multiple && newSelected.length > 1 && <span>{newSelected.length}</span>
271
271
  }
272
272
 
273
- {(showCloseIcon || configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 &&
273
+ {(showCloseIcon === true || showCloseIcon === false ? showCloseIcon : configStyles.SELECT.showCloseIcon) && !disabled && newSelected && newSelected.length > 0 &&
274
274
  <div
275
275
  className={`${styles['close-icon']}`}
276
276
  onClick={disabled ? _ => _ : handleClearSelect}
@@ -52,7 +52,7 @@ const createToast = ({
52
52
  toastParentBlock = document.createElement('div');
53
53
  toastParentBlock.style.position = 'fixed';
54
54
  toastParentBlock.style.display = 'flex';
55
- toastParentBlock.style.zIndex = 9999999999999999999999999;
55
+ toastParentBlock.style.zIndex = 999999999999;
56
56
  toastParentBlock.style.flexDirection = position === 'top-left' || position === 'top-right' || position === 'top-center' ? 'column-reverse' : 'column';
57
57
  toastParentBlock.setAttribute('id', styles[position]);
58
58
  toastParentBlock.appendChild(toastBlock);
package/tui.config.js CHANGED
@@ -182,7 +182,7 @@ module.exports = {
182
182
  // default properties for <Select /> component
183
183
  SELECT: {
184
184
  dots: false, // for options, cut text and add dots
185
- showCloseIcon: false, // for select reset icon, when prop exist or true is show, otherwise is hide
185
+ showCloseIcon: true, // for select reset icon, when prop exist or true is show, otherwise is hide
186
186
  marginTop: '10px', // for error message postion from top
187
187
  labelWeight: '500', // for label font weight
188
188
  labelColor: '#3C393E', // for label color