@greghowe79/the-lib 0.7.6 → 0.7.8
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.
|
@@ -43,6 +43,12 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
43
43
|
if (!error) internalError.value = result;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
+
const beforeInputHandler = qwik.$((event) => {
|
|
47
|
+
const e = event;
|
|
48
|
+
if (e.data && /[^0-9]/.test(e.data)) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
46
52
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
47
53
|
class: "input-container",
|
|
48
54
|
children: [
|
|
@@ -108,7 +114,8 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
108
114
|
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
109
115
|
e.preventDefault();
|
|
110
116
|
}
|
|
111
|
-
}
|
|
117
|
+
},
|
|
118
|
+
onBeforeInput$: beforeInputHandler
|
|
112
119
|
})
|
|
113
120
|
]
|
|
114
121
|
})
|
|
@@ -41,6 +41,12 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
41
41
|
if (!error) internalError.value = result;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
const beforeInputHandler = $((event) => {
|
|
45
|
+
const e = event;
|
|
46
|
+
if (e.data && /[^0-9]/.test(e.data)) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
return /* @__PURE__ */ jsxs("div", {
|
|
45
51
|
class: "input-container",
|
|
46
52
|
children: [
|
|
@@ -106,7 +112,8 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
106
112
|
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
107
113
|
e.preventDefault();
|
|
108
114
|
}
|
|
109
|
-
}
|
|
115
|
+
},
|
|
116
|
+
onBeforeInput$: beforeInputHandler
|
|
110
117
|
})
|
|
111
118
|
]
|
|
112
119
|
})
|