@greghowe79/the-lib 1.1.7 → 1.1.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.
|
@@ -31,21 +31,6 @@ 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 === "number") {
|
|
35
|
-
const num = Number(elem.value);
|
|
36
|
-
if (num > 100) {
|
|
37
|
-
elem.value = elem.value.slice(0, -1);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (isNaN(num) || num < 1) {
|
|
41
|
-
if (value) {
|
|
42
|
-
elem.value = value.value;
|
|
43
|
-
} else {
|
|
44
|
-
elem.value = "";
|
|
45
|
-
}
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
34
|
if (type === "tel") {
|
|
50
35
|
if (!/^[0-9]*$/.test(elem.value)) {
|
|
51
36
|
if (value) {
|
|
@@ -56,7 +41,7 @@ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate
|
|
|
56
41
|
}
|
|
57
42
|
if (value) value.value = elem.value;
|
|
58
43
|
if (onInput$) {
|
|
59
|
-
await onInput$();
|
|
44
|
+
await onInput$(_);
|
|
60
45
|
}
|
|
61
46
|
if (onValidate$) {
|
|
62
47
|
const result = await onValidate$(elem.value);
|
|
@@ -29,21 +29,6 @@ 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 === "number") {
|
|
33
|
-
const num = Number(elem.value);
|
|
34
|
-
if (num > 100) {
|
|
35
|
-
elem.value = elem.value.slice(0, -1);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (isNaN(num) || num < 1) {
|
|
39
|
-
if (value) {
|
|
40
|
-
elem.value = value.value;
|
|
41
|
-
} else {
|
|
42
|
-
elem.value = "";
|
|
43
|
-
}
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
32
|
if (type === "tel") {
|
|
48
33
|
if (!/^[0-9]*$/.test(elem.value)) {
|
|
49
34
|
if (value) {
|
|
@@ -54,7 +39,7 @@ const Input = component$(({ id, type, placeholder, value, error, onValidate$, on
|
|
|
54
39
|
}
|
|
55
40
|
if (value) value.value = elem.value;
|
|
56
41
|
if (onInput$) {
|
|
57
|
-
await onInput$();
|
|
42
|
+
await onInput$(_);
|
|
58
43
|
}
|
|
59
44
|
if (onValidate$) {
|
|
60
45
|
const result = await onValidate$(elem.value);
|
|
@@ -8,7 +8,7 @@ export interface InputProps {
|
|
|
8
8
|
value?: Signal<string>;
|
|
9
9
|
error?: Signal<string | null>;
|
|
10
10
|
onValidate$?: QRL<(value: string) => Promise<string>>;
|
|
11
|
-
onInput$?: QRL<() => void>;
|
|
11
|
+
onInput$?: QRL<(ev: Event) => void>;
|
|
12
12
|
bgLight?: boolean;
|
|
13
13
|
currentFile?: Signal<any>;
|
|
14
14
|
selectedFile?: Signal<string>;
|