@greghowe79/the-lib 0.7.5 → 0.7.7
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.
|
@@ -31,6 +31,9 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
31
31
|
const internalError = qwik.useSignal(null);
|
|
32
32
|
const showError = error ?? internalError;
|
|
33
33
|
const inputHandler = qwik.$(async (_, elem) => {
|
|
34
|
+
if (type === "tel") {
|
|
35
|
+
elem.value = elem.value.replace(/[^0-9]/g, "");
|
|
36
|
+
}
|
|
34
37
|
if (value) value.value = elem.value;
|
|
35
38
|
if (onInput$) {
|
|
36
39
|
await onInput$();
|
|
@@ -105,6 +108,12 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
105
108
|
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
106
109
|
e.preventDefault();
|
|
107
110
|
}
|
|
111
|
+
},
|
|
112
|
+
onBeforeInput$: (event) => {
|
|
113
|
+
const e = event;
|
|
114
|
+
if (e.data && /[^0-9]/.test(e.data)) {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
}
|
|
108
117
|
}
|
|
109
118
|
})
|
|
110
119
|
]
|
|
@@ -29,6 +29,9 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
29
29
|
const internalError = useSignal(null);
|
|
30
30
|
const showError = error ?? internalError;
|
|
31
31
|
const inputHandler = $(async (_, elem) => {
|
|
32
|
+
if (type === "tel") {
|
|
33
|
+
elem.value = elem.value.replace(/[^0-9]/g, "");
|
|
34
|
+
}
|
|
32
35
|
if (value) value.value = elem.value;
|
|
33
36
|
if (onInput$) {
|
|
34
37
|
await onInput$();
|
|
@@ -103,6 +106,12 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
103
106
|
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
104
107
|
e.preventDefault();
|
|
105
108
|
}
|
|
109
|
+
},
|
|
110
|
+
onBeforeInput$: (event) => {
|
|
111
|
+
const e = event;
|
|
112
|
+
if (e.data && /[^0-9]/.test(e.data)) {
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
}
|
|
106
115
|
}
|
|
107
116
|
})
|
|
108
117
|
]
|