@nr1e/qwik-ui 0.0.23 → 0.0.24
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.
- package/lib/components/checkbox-field.qwik.cjs +18 -3
- package/lib/components/checkbox-field.qwik.mjs +18 -3
- package/lib/components/text-field.qwik.cjs +18 -3
- package/lib/components/text-field.qwik.mjs +18 -3
- package/lib-types/components/checkbox-field.d.ts +1 -1
- package/lib-types/components/text-field.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
|
4
4
|
const qwik = require("@builder.io/qwik");
|
|
5
5
|
const CheckboxField = qwik.component$((props) => {
|
|
6
6
|
const error = qwik.useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
7
|
+
const checked = qwik.useSignal(typeof props.checked === "boolean" ? props.checked : props.checked?.value ?? false);
|
|
7
8
|
qwik.useTask$(({ track }) => {
|
|
8
9
|
if (props.error && typeof props.error !== "string") {
|
|
9
10
|
track(() => error.value);
|
|
@@ -20,6 +21,22 @@ const CheckboxField = qwik.component$((props) => {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
});
|
|
24
|
+
qwik.useTask$(({ track }) => {
|
|
25
|
+
if (props.checked && typeof props.checked !== "boolean") {
|
|
26
|
+
track(() => checked.value);
|
|
27
|
+
if (checked.value !== props.checked?.value) {
|
|
28
|
+
props.checked.value = checked.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
qwik.useTask$(({ track }) => {
|
|
33
|
+
if (props.checked && typeof props.checked !== "boolean") {
|
|
34
|
+
track(() => props.checked.value);
|
|
35
|
+
if (props.checked && checked.value !== props.checked.value) {
|
|
36
|
+
checked.value = props.checked.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
23
40
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
24
41
|
class: "fieldset",
|
|
25
42
|
children: [
|
|
@@ -37,9 +54,7 @@ const CheckboxField = qwik.component$((props) => {
|
|
|
37
54
|
...props.id && {
|
|
38
55
|
id: props.id
|
|
39
56
|
},
|
|
40
|
-
|
|
41
|
-
checked: props.checked
|
|
42
|
-
},
|
|
57
|
+
checked: checked.value,
|
|
43
58
|
class: `checkbox ${error.value ? "checkbox-error" : ""}`,
|
|
44
59
|
onClick$: (e) => props.onClick$ && props.onClick$(e, e.target.checked, error)
|
|
45
60
|
}),
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
|
2
2
|
import { component$, useSignal, useTask$ } from "@builder.io/qwik";
|
|
3
3
|
const CheckboxField = component$((props) => {
|
|
4
4
|
const error = useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
5
|
+
const checked = useSignal(typeof props.checked === "boolean" ? props.checked : props.checked?.value ?? false);
|
|
5
6
|
useTask$(({ track }) => {
|
|
6
7
|
if (props.error && typeof props.error !== "string") {
|
|
7
8
|
track(() => error.value);
|
|
@@ -18,6 +19,22 @@ const CheckboxField = component$((props) => {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
});
|
|
22
|
+
useTask$(({ track }) => {
|
|
23
|
+
if (props.checked && typeof props.checked !== "boolean") {
|
|
24
|
+
track(() => checked.value);
|
|
25
|
+
if (checked.value !== props.checked?.value) {
|
|
26
|
+
props.checked.value = checked.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
useTask$(({ track }) => {
|
|
31
|
+
if (props.checked && typeof props.checked !== "boolean") {
|
|
32
|
+
track(() => props.checked.value);
|
|
33
|
+
if (props.checked && checked.value !== props.checked.value) {
|
|
34
|
+
checked.value = props.checked.value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
21
38
|
return /* @__PURE__ */ jsxs("div", {
|
|
22
39
|
class: "fieldset",
|
|
23
40
|
children: [
|
|
@@ -35,9 +52,7 @@ const CheckboxField = component$((props) => {
|
|
|
35
52
|
...props.id && {
|
|
36
53
|
id: props.id
|
|
37
54
|
},
|
|
38
|
-
|
|
39
|
-
checked: props.checked
|
|
40
|
-
},
|
|
55
|
+
checked: checked.value,
|
|
41
56
|
class: `checkbox ${error.value ? "checkbox-error" : ""}`,
|
|
42
57
|
onClick$: (e) => props.onClick$ && props.onClick$(e, e.target.checked, error)
|
|
43
58
|
}),
|
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
|
4
4
|
const qwik = require("@builder.io/qwik");
|
|
5
5
|
const TextField = qwik.component$((props) => {
|
|
6
6
|
const error = qwik.useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
7
|
+
const value = qwik.useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
7
8
|
qwik.useTask$(({ track }) => {
|
|
8
9
|
if (props.error && typeof props.error !== "string") {
|
|
9
10
|
track(() => error.value);
|
|
@@ -20,6 +21,22 @@ const TextField = qwik.component$((props) => {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
});
|
|
24
|
+
qwik.useTask$(({ track }) => {
|
|
25
|
+
if (props.value && typeof props.value !== "string") {
|
|
26
|
+
track(() => value.value);
|
|
27
|
+
if (value.value !== props.value?.value) {
|
|
28
|
+
props.value.value = value.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
qwik.useTask$(({ track }) => {
|
|
33
|
+
if (props.value && typeof props.value !== "string") {
|
|
34
|
+
track(() => props.value.value);
|
|
35
|
+
if (props.value && error.value !== props.value.value) {
|
|
36
|
+
value.value = props.value.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
23
40
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
24
41
|
class: "fieldset",
|
|
25
42
|
children: [
|
|
@@ -47,9 +64,7 @@ const TextField = qwik.component$((props) => {
|
|
|
47
64
|
...props.name && {
|
|
48
65
|
name: props.name
|
|
49
66
|
},
|
|
50
|
-
|
|
51
|
-
value: props.value
|
|
52
|
-
},
|
|
67
|
+
value: value.value,
|
|
53
68
|
class: "placeholder:opacity-50",
|
|
54
69
|
placeholder: props.placeholder,
|
|
55
70
|
onBlur$: (e) => {
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
|
2
2
|
import { component$, useSignal, useTask$, Slot } from "@builder.io/qwik";
|
|
3
3
|
const TextField = component$((props) => {
|
|
4
4
|
const error = useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
5
|
+
const value = useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
5
6
|
useTask$(({ track }) => {
|
|
6
7
|
if (props.error && typeof props.error !== "string") {
|
|
7
8
|
track(() => error.value);
|
|
@@ -18,6 +19,22 @@ const TextField = component$((props) => {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
});
|
|
22
|
+
useTask$(({ track }) => {
|
|
23
|
+
if (props.value && typeof props.value !== "string") {
|
|
24
|
+
track(() => value.value);
|
|
25
|
+
if (value.value !== props.value?.value) {
|
|
26
|
+
props.value.value = value.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
useTask$(({ track }) => {
|
|
31
|
+
if (props.value && typeof props.value !== "string") {
|
|
32
|
+
track(() => props.value.value);
|
|
33
|
+
if (props.value && error.value !== props.value.value) {
|
|
34
|
+
value.value = props.value.value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
21
38
|
return /* @__PURE__ */ jsxs("div", {
|
|
22
39
|
class: "fieldset",
|
|
23
40
|
children: [
|
|
@@ -45,9 +62,7 @@ const TextField = component$((props) => {
|
|
|
45
62
|
...props.name && {
|
|
46
63
|
name: props.name
|
|
47
64
|
},
|
|
48
|
-
|
|
49
|
-
value: props.value
|
|
50
|
-
},
|
|
65
|
+
value: value.value,
|
|
51
66
|
class: "placeholder:opacity-50",
|
|
52
67
|
placeholder: props.placeholder,
|
|
53
68
|
onBlur$: (e) => {
|
|
@@ -3,7 +3,7 @@ export interface CheckboxFieldProps {
|
|
|
3
3
|
id?: string;
|
|
4
4
|
label: string;
|
|
5
5
|
name?: string;
|
|
6
|
-
checked?: boolean
|
|
6
|
+
checked?: boolean | Signal<boolean>;
|
|
7
7
|
error?: string | Signal<string | undefined>;
|
|
8
8
|
onClick$?: QRL<(event: Event, checked: boolean, error: Signal<string | undefined>) => void>;
|
|
9
9
|
}
|