@uxf/form 10.0.0-beta.21 → 10.0.0-beta.23

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.
@@ -41,8 +41,19 @@ function NumberInput(props) {
41
41
  };
42
42
  const onKeyDown = (event) => {
43
43
  var _a;
44
- if (event.key === "e") {
45
- event.preventDefault();
44
+ // Allow special keys
45
+ const specialKeys = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"];
46
+ // Allow keys for copy/paste/select/cut
47
+ const controlKeys = ["v", "V", "c", "C", "x", "X", "a", "A"];
48
+ // Allow digits and decimal point (.,)
49
+ const allowedDigits = /[0-9+\-.,]/;
50
+ const key = event.key;
51
+ // Check if the key is allowed
52
+ if (!specialKeys.includes(key) && !allowedDigits.test(key)) {
53
+ // Check if Ctrl or Command key is pressed along with control key
54
+ if (!(event.ctrlKey || event.metaKey) || !controlKeys.includes(key)) {
55
+ event.preventDefault();
56
+ }
46
57
  }
47
58
  (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
48
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/form",
3
- "version": "10.0.0-beta.21",
3
+ "version": "10.0.0-beta.23",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,7 @@
12
12
  "author": "UX Fans s.r.o",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@uxf/ui": "10.0.0-beta.21",
15
+ "@uxf/ui": "10.0.0-beta.22",
16
16
  "react-hook-form": "7.44.3",
17
17
  "coordinate-parser": "1.0.7"
18
18
  }