@greghowe79/the-lib 0.7.8 → 0.8.0
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.
|
@@ -32,7 +32,8 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
32
32
|
const showError = error ?? internalError;
|
|
33
33
|
const inputHandler = qwik.$(async (_, elem) => {
|
|
34
34
|
if (type === "tel") {
|
|
35
|
-
|
|
35
|
+
if (!/^[0-9]*$/.test(elem.value)) return;
|
|
36
|
+
if (value) value.value = elem.value;
|
|
36
37
|
}
|
|
37
38
|
if (value) value.value = elem.value;
|
|
38
39
|
if (onInput$) {
|
|
@@ -43,12 +44,6 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
43
44
|
if (!error) internalError.value = result;
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
|
-
const beforeInputHandler = qwik.$((event) => {
|
|
47
|
-
const e = event;
|
|
48
|
-
if (e.data && /[^0-9]/.test(e.data)) {
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
47
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
53
48
|
class: "input-container",
|
|
54
49
|
children: [
|
|
@@ -108,14 +103,7 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
108
103
|
placeholder,
|
|
109
104
|
"bind:value": value,
|
|
110
105
|
onInput$: inputHandler,
|
|
111
|
-
onBlur$: inputHandler
|
|
112
|
-
onKeyDown$: (e) => {
|
|
113
|
-
const allowed = /[0-9]/;
|
|
114
|
-
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
115
|
-
e.preventDefault();
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
onBeforeInput$: beforeInputHandler
|
|
106
|
+
onBlur$: inputHandler
|
|
119
107
|
})
|
|
120
108
|
]
|
|
121
109
|
})
|
|
@@ -30,7 +30,8 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
30
30
|
const showError = error ?? internalError;
|
|
31
31
|
const inputHandler = $(async (_, elem) => {
|
|
32
32
|
if (type === "tel") {
|
|
33
|
-
|
|
33
|
+
if (!/^[0-9]*$/.test(elem.value)) return;
|
|
34
|
+
if (value) value.value = elem.value;
|
|
34
35
|
}
|
|
35
36
|
if (value) value.value = elem.value;
|
|
36
37
|
if (onInput$) {
|
|
@@ -41,12 +42,6 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
41
42
|
if (!error) internalError.value = result;
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
|
-
const beforeInputHandler = $((event) => {
|
|
45
|
-
const e = event;
|
|
46
|
-
if (e.data && /[^0-9]/.test(e.data)) {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
45
|
return /* @__PURE__ */ jsxs("div", {
|
|
51
46
|
class: "input-container",
|
|
52
47
|
children: [
|
|
@@ -106,14 +101,7 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
106
101
|
placeholder,
|
|
107
102
|
"bind:value": value,
|
|
108
103
|
onInput$: inputHandler,
|
|
109
|
-
onBlur$: inputHandler
|
|
110
|
-
onKeyDown$: (e) => {
|
|
111
|
-
const allowed = /[0-9]/;
|
|
112
|
-
if (!allowed.test(e.key) && e.key.length === 1) {
|
|
113
|
-
e.preventDefault();
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
onBeforeInput$: beforeInputHandler
|
|
104
|
+
onBlur$: inputHandler
|
|
117
105
|
})
|
|
118
106
|
]
|
|
119
107
|
})
|