@symply.io/basic-components 1.5.6 → 1.5.7-alpha.1

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.
@@ -26,13 +26,14 @@ function useInteractions(props) {
26
26
  var exceedError = useMemo(function () { return !!value && (Number(value) < minValue || Number(value) > maxValue); }, [value, minValue, maxValue]);
27
27
  var handleKeyboardEvent = useCallback(function (event) {
28
28
  var key = event.key, currentTarget = event.currentTarget;
29
+ var val = value !== null && value !== void 0 ? value : 0;
29
30
  if (key === "e") {
30
31
  event.preventDefault();
31
32
  }
32
33
  else if (integerOnly && key === ".") {
33
34
  event.preventDefault();
34
35
  }
35
- else if (value.length === 0) {
36
+ else if (String(val).length === 0) {
36
37
  if (minValue >= 0 && key === "-") {
37
38
  event.preventDefault();
38
39
  }
@@ -41,10 +42,10 @@ function useInteractions(props) {
41
42
  if (key === "-") {
42
43
  event.preventDefault();
43
44
  }
44
- else if (String(value).includes(".") && decimals > 0) {
45
+ else if (String(val).includes(".") && decimals > 0) {
45
46
  var selectionStart = currentTarget.selectionStart;
46
- var decimalPointIndex = String(value).lastIndexOf(".");
47
- var decimalStrLen = String(value).split(".")[1].length;
47
+ var decimalPointIndex = String(val).lastIndexOf(".");
48
+ var decimalStrLen = String(val).split(".")[1].length;
48
49
  if (selectionStart && decimalPointIndex < selectionStart) {
49
50
  if (![
50
51
  "Backspace",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.5.6",
3
+ "version": "1.5.7-alpha.1",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",