@nr1e/qwik-ui 2.0.8 → 2.0.10
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 +4 -27
- package/lib/components/checkbox-field.qwik.mjs +4 -27
- package/lib/components/select-field.qwik.cjs +7 -130
- package/lib/components/select-field.qwik.mjs +8 -131
- package/lib/components/text-field.qwik.cjs +7 -135
- package/lib/components/text-field.qwik.mjs +8 -136
- package/lib-types/components/checkbox-field.d.ts +2 -2
- package/lib-types/components/select-field.d.ts +4 -17
- package/lib-types/components/text-field.d.ts +5 -50
- package/package.json +1 -2
- package/lib/node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.cjs +0 -24
- package/lib/node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.mjs +0 -24
|
@@ -3,24 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const qwik = require("@builder.io/qwik");
|
|
5
5
|
const CheckboxField = qwik.component$((props) => {
|
|
6
|
-
const error = qwik.useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
7
6
|
const checked = qwik.useSignal(typeof props.checked === "boolean" ? props.checked : props.checked?.value ?? false);
|
|
8
|
-
qwik.useTask$(({ track }) => {
|
|
9
|
-
if (props.error && typeof props.error !== "string") {
|
|
10
|
-
track(() => error.value);
|
|
11
|
-
if (error.value !== props.error?.value) {
|
|
12
|
-
props.error.value = error.value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
qwik.useTask$(({ track }) => {
|
|
17
|
-
if (props.error && typeof props.error !== "string") {
|
|
18
|
-
track(() => props.error.value);
|
|
19
|
-
if (props.error && error.value !== props.error.value) {
|
|
20
|
-
error.value = props.error.value;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
7
|
qwik.useTask$(({ track }) => {
|
|
25
8
|
if (props.checked && typeof props.checked !== "boolean") {
|
|
26
9
|
track(() => checked.value);
|
|
@@ -55,21 +38,15 @@ const CheckboxField = qwik.component$((props) => {
|
|
|
55
38
|
id: props.id
|
|
56
39
|
},
|
|
57
40
|
checked: checked.value,
|
|
58
|
-
class: `checkbox ${error
|
|
59
|
-
onClick$:
|
|
60
|
-
const target = e.target;
|
|
61
|
-
if (props.onClick$) {
|
|
62
|
-
props.onClick$(e, e.target.checked, error);
|
|
63
|
-
}
|
|
64
|
-
checked.value = target.checked;
|
|
65
|
-
}
|
|
41
|
+
class: `checkbox ${props.error ? "checkbox-error" : ""}`,
|
|
42
|
+
onClick$: props.onClick$
|
|
66
43
|
}),
|
|
67
44
|
props.label
|
|
68
45
|
]
|
|
69
46
|
}),
|
|
70
|
-
error
|
|
47
|
+
props.error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
71
48
|
class: "text-error mt-1 text-xs",
|
|
72
|
-
children: error
|
|
49
|
+
children: props.error
|
|
73
50
|
})
|
|
74
51
|
]
|
|
75
52
|
});
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
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
|
-
const error = useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
5
4
|
const checked = useSignal(typeof props.checked === "boolean" ? props.checked : props.checked?.value ?? false);
|
|
6
|
-
useTask$(({ track }) => {
|
|
7
|
-
if (props.error && typeof props.error !== "string") {
|
|
8
|
-
track(() => error.value);
|
|
9
|
-
if (error.value !== props.error?.value) {
|
|
10
|
-
props.error.value = error.value;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
useTask$(({ track }) => {
|
|
15
|
-
if (props.error && typeof props.error !== "string") {
|
|
16
|
-
track(() => props.error.value);
|
|
17
|
-
if (props.error && error.value !== props.error.value) {
|
|
18
|
-
error.value = props.error.value;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
5
|
useTask$(({ track }) => {
|
|
23
6
|
if (props.checked && typeof props.checked !== "boolean") {
|
|
24
7
|
track(() => checked.value);
|
|
@@ -53,21 +36,15 @@ const CheckboxField = component$((props) => {
|
|
|
53
36
|
id: props.id
|
|
54
37
|
},
|
|
55
38
|
checked: checked.value,
|
|
56
|
-
class: `checkbox ${error
|
|
57
|
-
onClick$:
|
|
58
|
-
const target = e.target;
|
|
59
|
-
if (props.onClick$) {
|
|
60
|
-
props.onClick$(e, e.target.checked, error);
|
|
61
|
-
}
|
|
62
|
-
checked.value = target.checked;
|
|
63
|
-
}
|
|
39
|
+
class: `checkbox ${props.error ? "checkbox-error" : ""}`,
|
|
40
|
+
onClick$: props.onClick$
|
|
64
41
|
}),
|
|
65
42
|
props.label
|
|
66
43
|
]
|
|
67
44
|
}),
|
|
68
|
-
error
|
|
45
|
+
props.error && /* @__PURE__ */ jsx("div", {
|
|
69
46
|
class: "text-error mt-1 text-xs",
|
|
70
|
-
children: error
|
|
47
|
+
children: props.error
|
|
71
48
|
})
|
|
72
49
|
]
|
|
73
50
|
});
|
|
@@ -2,36 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const qwik = require("@builder.io/qwik");
|
|
5
|
-
const index = require("../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.cjs");
|
|
6
5
|
const SelectField = qwik.component$((props) => {
|
|
7
|
-
const error = qwik.useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
8
6
|
const value = qwik.useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
9
|
-
const originalValue = typeof props.value === "string" ? props.value : props.value?.value;
|
|
10
|
-
const disabled = qwik.useSignal(false);
|
|
11
|
-
if (props.disabled) {
|
|
12
|
-
if (typeof props.disabled === "boolean") {
|
|
13
|
-
disabled.value = props.disabled;
|
|
14
|
-
} else {
|
|
15
|
-
disabled.value = props.disabled.value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const touched = qwik.useSignal(false);
|
|
19
|
-
qwik.useTask$(({ track }) => {
|
|
20
|
-
if (props.error && typeof props.error !== "string") {
|
|
21
|
-
track(() => error.value);
|
|
22
|
-
if (error.value !== props.error?.value) {
|
|
23
|
-
props.error.value = error.value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
qwik.useTask$(({ track }) => {
|
|
28
|
-
if (props.error && typeof props.error !== "string") {
|
|
29
|
-
track(() => props.error.value);
|
|
30
|
-
if (props.error && error.value !== props.error.value) {
|
|
31
|
-
error.value = props.error.value;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
7
|
qwik.useTask$(({ track }) => {
|
|
36
8
|
if (props.value && typeof props.value !== "string") {
|
|
37
9
|
track(() => value.value);
|
|
@@ -43,77 +15,11 @@ const SelectField = qwik.component$((props) => {
|
|
|
43
15
|
qwik.useTask$(({ track }) => {
|
|
44
16
|
if (props.value && typeof props.value !== "string") {
|
|
45
17
|
track(() => props.value.value);
|
|
46
|
-
if (props.value
|
|
18
|
+
if (props.value.value !== value.value) {
|
|
47
19
|
value.value = props.value.value;
|
|
48
20
|
}
|
|
49
21
|
}
|
|
50
22
|
});
|
|
51
|
-
qwik.useTask$(({ track }) => {
|
|
52
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
53
|
-
track(() => disabled.value);
|
|
54
|
-
if (disabled.value !== props.disabled?.value) {
|
|
55
|
-
props.disabled.value = disabled.value;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
qwik.useTask$(({ track }) => {
|
|
60
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
61
|
-
track(() => props.disabled.value);
|
|
62
|
-
if (props.disabled && disabled.value !== props.disabled.value) {
|
|
63
|
-
disabled.value = props.disabled.value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
qwik.useTask$(async ({ track }) => {
|
|
68
|
-
if (props.triggerReset) {
|
|
69
|
-
track(() => props.triggerReset?.value);
|
|
70
|
-
value.value = originalValue;
|
|
71
|
-
error.value = void 0;
|
|
72
|
-
touched.value = false;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
const validate = qwik.$(async () => {
|
|
76
|
-
if (props.schema$) {
|
|
77
|
-
const schema = await props.schema$();
|
|
78
|
-
const result = index.safeParse(schema, value.value);
|
|
79
|
-
if (!result.success) {
|
|
80
|
-
if (result.issues.length > 0) {
|
|
81
|
-
if (props.valid) {
|
|
82
|
-
props.valid.value = false;
|
|
83
|
-
}
|
|
84
|
-
error.value = result.issues[0].message;
|
|
85
|
-
return;
|
|
86
|
-
} else {
|
|
87
|
-
if (props.valid) {
|
|
88
|
-
props.valid.value = false;
|
|
89
|
-
}
|
|
90
|
-
error.value = "Invalid value";
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (props.validate$) {
|
|
96
|
-
const result = await props.validate$(value.value);
|
|
97
|
-
if (result) {
|
|
98
|
-
if (props.valid) {
|
|
99
|
-
props.valid.value = false;
|
|
100
|
-
}
|
|
101
|
-
error.value = result;
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (props.valid) {
|
|
106
|
-
props.valid.value = true;
|
|
107
|
-
error.value = void 0;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
qwik.useTask$(async ({ track }) => {
|
|
111
|
-
if (props.triggerValidation) {
|
|
112
|
-
track(() => props.triggerValidation?.value);
|
|
113
|
-
touched.value = true;
|
|
114
|
-
await validate();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
23
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
118
24
|
class: "fieldset",
|
|
119
25
|
children: [
|
|
@@ -136,44 +42,15 @@ const SelectField = qwik.component$((props) => {
|
|
|
136
42
|
},
|
|
137
43
|
required: props.required,
|
|
138
44
|
"aria-required": props.required,
|
|
139
|
-
disabled: disabled
|
|
140
|
-
class: `select ${error
|
|
141
|
-
onChange$:
|
|
142
|
-
|
|
143
|
-
if (props.onChange$) {
|
|
144
|
-
props.onChange$(e, target.value, error);
|
|
145
|
-
}
|
|
146
|
-
if (props.onEvent$) {
|
|
147
|
-
props.onEvent$("change", e, target.value, error);
|
|
148
|
-
}
|
|
149
|
-
if (props.value && typeof props.value !== "string") {
|
|
150
|
-
value.value = target.value;
|
|
151
|
-
}
|
|
152
|
-
if (props.validate$) {
|
|
153
|
-
error.value = await props.validate$(target.value);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
onBlur$: async (e) => {
|
|
157
|
-
touched.value = true;
|
|
158
|
-
const target = e.target;
|
|
159
|
-
if (props.onBlur$) {
|
|
160
|
-
props.onBlur$(e, target.value, error);
|
|
161
|
-
}
|
|
162
|
-
if (props.onEvent$) {
|
|
163
|
-
props.onEvent$("blur", e, target.value, error);
|
|
164
|
-
}
|
|
165
|
-
if (props.value && typeof props.value !== "string") {
|
|
166
|
-
value.value = target.value;
|
|
167
|
-
}
|
|
168
|
-
if (props.validate$) {
|
|
169
|
-
error.value = await props.validate$(target.value);
|
|
170
|
-
}
|
|
171
|
-
},
|
|
45
|
+
disabled: props.disabled,
|
|
46
|
+
class: `select ${props.error ? "select-error" : ""}`,
|
|
47
|
+
onChange$: props.onChange$,
|
|
48
|
+
onBlur$: props.onBlur$,
|
|
172
49
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
173
50
|
}),
|
|
174
|
-
error
|
|
51
|
+
props.error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
175
52
|
class: "text-error mt-1 text-xs",
|
|
176
|
-
children: error
|
|
53
|
+
children: props.error
|
|
177
54
|
})
|
|
178
55
|
]
|
|
179
56
|
});
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$, useSignal, useTask$,
|
|
3
|
-
import { safeParse } from "../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.mjs";
|
|
2
|
+
import { component$, useSignal, useTask$, Slot } from "@builder.io/qwik";
|
|
4
3
|
const SelectField = component$((props) => {
|
|
5
|
-
const error = useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
6
4
|
const value = useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
7
|
-
const originalValue = typeof props.value === "string" ? props.value : props.value?.value;
|
|
8
|
-
const disabled = useSignal(false);
|
|
9
|
-
if (props.disabled) {
|
|
10
|
-
if (typeof props.disabled === "boolean") {
|
|
11
|
-
disabled.value = props.disabled;
|
|
12
|
-
} else {
|
|
13
|
-
disabled.value = props.disabled.value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const touched = useSignal(false);
|
|
17
|
-
useTask$(({ track }) => {
|
|
18
|
-
if (props.error && typeof props.error !== "string") {
|
|
19
|
-
track(() => error.value);
|
|
20
|
-
if (error.value !== props.error?.value) {
|
|
21
|
-
props.error.value = error.value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
useTask$(({ track }) => {
|
|
26
|
-
if (props.error && typeof props.error !== "string") {
|
|
27
|
-
track(() => props.error.value);
|
|
28
|
-
if (props.error && error.value !== props.error.value) {
|
|
29
|
-
error.value = props.error.value;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
5
|
useTask$(({ track }) => {
|
|
34
6
|
if (props.value && typeof props.value !== "string") {
|
|
35
7
|
track(() => value.value);
|
|
@@ -41,77 +13,11 @@ const SelectField = component$((props) => {
|
|
|
41
13
|
useTask$(({ track }) => {
|
|
42
14
|
if (props.value && typeof props.value !== "string") {
|
|
43
15
|
track(() => props.value.value);
|
|
44
|
-
if (props.value
|
|
16
|
+
if (props.value.value !== value.value) {
|
|
45
17
|
value.value = props.value.value;
|
|
46
18
|
}
|
|
47
19
|
}
|
|
48
20
|
});
|
|
49
|
-
useTask$(({ track }) => {
|
|
50
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
51
|
-
track(() => disabled.value);
|
|
52
|
-
if (disabled.value !== props.disabled?.value) {
|
|
53
|
-
props.disabled.value = disabled.value;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
useTask$(({ track }) => {
|
|
58
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
59
|
-
track(() => props.disabled.value);
|
|
60
|
-
if (props.disabled && disabled.value !== props.disabled.value) {
|
|
61
|
-
disabled.value = props.disabled.value;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
useTask$(async ({ track }) => {
|
|
66
|
-
if (props.triggerReset) {
|
|
67
|
-
track(() => props.triggerReset?.value);
|
|
68
|
-
value.value = originalValue;
|
|
69
|
-
error.value = void 0;
|
|
70
|
-
touched.value = false;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const validate = $(async () => {
|
|
74
|
-
if (props.schema$) {
|
|
75
|
-
const schema = await props.schema$();
|
|
76
|
-
const result = safeParse(schema, value.value);
|
|
77
|
-
if (!result.success) {
|
|
78
|
-
if (result.issues.length > 0) {
|
|
79
|
-
if (props.valid) {
|
|
80
|
-
props.valid.value = false;
|
|
81
|
-
}
|
|
82
|
-
error.value = result.issues[0].message;
|
|
83
|
-
return;
|
|
84
|
-
} else {
|
|
85
|
-
if (props.valid) {
|
|
86
|
-
props.valid.value = false;
|
|
87
|
-
}
|
|
88
|
-
error.value = "Invalid value";
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (props.validate$) {
|
|
94
|
-
const result = await props.validate$(value.value);
|
|
95
|
-
if (result) {
|
|
96
|
-
if (props.valid) {
|
|
97
|
-
props.valid.value = false;
|
|
98
|
-
}
|
|
99
|
-
error.value = result;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (props.valid) {
|
|
104
|
-
props.valid.value = true;
|
|
105
|
-
error.value = void 0;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
useTask$(async ({ track }) => {
|
|
109
|
-
if (props.triggerValidation) {
|
|
110
|
-
track(() => props.triggerValidation?.value);
|
|
111
|
-
touched.value = true;
|
|
112
|
-
await validate();
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
21
|
return /* @__PURE__ */ jsxs("div", {
|
|
116
22
|
class: "fieldset",
|
|
117
23
|
children: [
|
|
@@ -134,44 +40,15 @@ const SelectField = component$((props) => {
|
|
|
134
40
|
},
|
|
135
41
|
required: props.required,
|
|
136
42
|
"aria-required": props.required,
|
|
137
|
-
disabled: disabled
|
|
138
|
-
class: `select ${error
|
|
139
|
-
onChange$:
|
|
140
|
-
|
|
141
|
-
if (props.onChange$) {
|
|
142
|
-
props.onChange$(e, target.value, error);
|
|
143
|
-
}
|
|
144
|
-
if (props.onEvent$) {
|
|
145
|
-
props.onEvent$("change", e, target.value, error);
|
|
146
|
-
}
|
|
147
|
-
if (props.value && typeof props.value !== "string") {
|
|
148
|
-
value.value = target.value;
|
|
149
|
-
}
|
|
150
|
-
if (props.validate$) {
|
|
151
|
-
error.value = await props.validate$(target.value);
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
onBlur$: async (e) => {
|
|
155
|
-
touched.value = true;
|
|
156
|
-
const target = e.target;
|
|
157
|
-
if (props.onBlur$) {
|
|
158
|
-
props.onBlur$(e, target.value, error);
|
|
159
|
-
}
|
|
160
|
-
if (props.onEvent$) {
|
|
161
|
-
props.onEvent$("blur", e, target.value, error);
|
|
162
|
-
}
|
|
163
|
-
if (props.value && typeof props.value !== "string") {
|
|
164
|
-
value.value = target.value;
|
|
165
|
-
}
|
|
166
|
-
if (props.validate$) {
|
|
167
|
-
error.value = await props.validate$(target.value);
|
|
168
|
-
}
|
|
169
|
-
},
|
|
43
|
+
disabled: props.disabled,
|
|
44
|
+
class: `select ${props.error ? "select-error" : ""}`,
|
|
45
|
+
onChange$: props.onChange$,
|
|
46
|
+
onBlur$: props.onBlur$,
|
|
170
47
|
children: /* @__PURE__ */ jsx(Slot, {})
|
|
171
48
|
}),
|
|
172
|
-
error
|
|
49
|
+
props.error && /* @__PURE__ */ jsx("div", {
|
|
173
50
|
class: "text-error mt-1 text-xs",
|
|
174
|
-
children: error
|
|
51
|
+
children: props.error
|
|
175
52
|
})
|
|
176
53
|
]
|
|
177
54
|
});
|
|
@@ -2,38 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const qwik = require("@builder.io/qwik");
|
|
5
|
-
const index = require("../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.cjs");
|
|
6
5
|
const TextField = qwik.component$((props) => {
|
|
7
|
-
const error = qwik.useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
8
6
|
const value = qwik.useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
9
|
-
const originalValue = typeof props.value === "string" ? props.value : props.value?.value;
|
|
10
|
-
const disabled = qwik.useSignal(false);
|
|
11
|
-
if (props.disabled) {
|
|
12
|
-
if (typeof props.disabled === "boolean") {
|
|
13
|
-
disabled.value = props.disabled;
|
|
14
|
-
} else {
|
|
15
|
-
disabled.value = props.disabled.value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const touched = qwik.useSignal(false);
|
|
19
|
-
const originalTriggerResetValue = props.triggerReset?.value;
|
|
20
|
-
const originalTriggerValidationValue = props.triggerValidation?.value;
|
|
21
|
-
qwik.useTask$(({ track }) => {
|
|
22
|
-
if (props.error && typeof props.error !== "string") {
|
|
23
|
-
track(() => error.value);
|
|
24
|
-
if (error.value !== props.error?.value) {
|
|
25
|
-
props.error.value = error.value;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
qwik.useTask$(({ track }) => {
|
|
30
|
-
if (props.error && typeof props.error !== "string") {
|
|
31
|
-
track(() => props.error.value);
|
|
32
|
-
if (props.error && error.value !== props.error.value) {
|
|
33
|
-
error.value = props.error.value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
7
|
qwik.useTask$(({ track }) => {
|
|
38
8
|
if (props.value && typeof props.value !== "string") {
|
|
39
9
|
track(() => value.value);
|
|
@@ -45,87 +15,11 @@ const TextField = qwik.component$((props) => {
|
|
|
45
15
|
qwik.useTask$(({ track }) => {
|
|
46
16
|
if (props.value && typeof props.value !== "string") {
|
|
47
17
|
track(() => props.value.value);
|
|
48
|
-
if (props.value
|
|
18
|
+
if (props.value.value !== value.value) {
|
|
49
19
|
value.value = props.value.value;
|
|
50
20
|
}
|
|
51
21
|
}
|
|
52
22
|
});
|
|
53
|
-
qwik.useTask$(({ track }) => {
|
|
54
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
55
|
-
track(() => disabled.value);
|
|
56
|
-
if (disabled.value !== props.disabled?.value) {
|
|
57
|
-
props.disabled.value = disabled.value;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
qwik.useTask$(({ track }) => {
|
|
62
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
63
|
-
track(() => props.disabled.value);
|
|
64
|
-
if (props.disabled && disabled.value !== props.disabled.value) {
|
|
65
|
-
disabled.value = props.disabled.value;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
qwik.useTask$(async ({ track }) => {
|
|
70
|
-
if (props.triggerReset) {
|
|
71
|
-
track(() => props.triggerReset?.value);
|
|
72
|
-
if (originalTriggerResetValue !== props.triggerReset.value) {
|
|
73
|
-
value.value = originalValue;
|
|
74
|
-
error.value = void 0;
|
|
75
|
-
touched.value = false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
const validate = qwik.$(async () => {
|
|
80
|
-
if (props.schema$) {
|
|
81
|
-
const schema = await props.schema$();
|
|
82
|
-
const result = index.safeParse(schema, value.value);
|
|
83
|
-
if (!result.success) {
|
|
84
|
-
if (result.issues.length > 0) {
|
|
85
|
-
if (props.valid) {
|
|
86
|
-
props.valid.value = false;
|
|
87
|
-
}
|
|
88
|
-
error.value = result.issues[0].message;
|
|
89
|
-
return;
|
|
90
|
-
} else {
|
|
91
|
-
if (props.valid) {
|
|
92
|
-
props.valid.value = false;
|
|
93
|
-
}
|
|
94
|
-
error.value = "Invalid value";
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (value.value !== result.output) {
|
|
99
|
-
value.value = result.output;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (props.validate$) {
|
|
103
|
-
const result = await props.validate$(value.value);
|
|
104
|
-
if (!result.success) {
|
|
105
|
-
if (props.valid) {
|
|
106
|
-
props.valid.value = false;
|
|
107
|
-
}
|
|
108
|
-
error.value = result.error;
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (value.value !== result.output) {
|
|
112
|
-
value.value = result.output;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (props.valid) {
|
|
116
|
-
props.valid.value = true;
|
|
117
|
-
error.value = void 0;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
qwik.useTask$(async ({ track }) => {
|
|
121
|
-
if (props.triggerValidation) {
|
|
122
|
-
track(() => props.triggerValidation?.value);
|
|
123
|
-
if (props.triggerValidation.value !== originalTriggerValidationValue) {
|
|
124
|
-
touched.value = true;
|
|
125
|
-
await validate();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
23
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
130
24
|
class: "fieldset",
|
|
131
25
|
children: [
|
|
@@ -140,7 +34,7 @@ const TextField = qwik.component$((props) => {
|
|
|
140
34
|
})
|
|
141
35
|
}),
|
|
142
36
|
/* @__PURE__ */ jsxRuntime.jsxs("label", {
|
|
143
|
-
class: `input w-full ${error
|
|
37
|
+
class: `input w-full ${props.error ? "input-error" : ""}`,
|
|
144
38
|
children: [
|
|
145
39
|
/* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {
|
|
146
40
|
name: "left"
|
|
@@ -155,44 +49,22 @@ const TextField = qwik.component$((props) => {
|
|
|
155
49
|
},
|
|
156
50
|
required: props.required,
|
|
157
51
|
"aria-required": props.required,
|
|
158
|
-
disabled: disabled
|
|
52
|
+
disabled: props.disabled,
|
|
159
53
|
maxLength: props.maxLength,
|
|
160
54
|
value: value.value,
|
|
161
55
|
class: "placeholder:opacity-50",
|
|
162
56
|
placeholder: props.placeholder,
|
|
163
|
-
onBlur$:
|
|
164
|
-
|
|
165
|
-
touched.value = true;
|
|
166
|
-
value.value = target.value;
|
|
167
|
-
await validate();
|
|
168
|
-
target.value = value.value ?? "";
|
|
169
|
-
if (props.onBlur$) {
|
|
170
|
-
props.onBlur$(e, target.value, error);
|
|
171
|
-
}
|
|
172
|
-
if (props.onEvent$) {
|
|
173
|
-
props.onEvent$("blur", e, target.value, error);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
onInput$: async (e) => {
|
|
177
|
-
const target = e.target;
|
|
178
|
-
value.value = target.value;
|
|
179
|
-
await validate();
|
|
180
|
-
if (props.onInput$) {
|
|
181
|
-
props.onInput$(e, target.value, error);
|
|
182
|
-
}
|
|
183
|
-
if (props.onEvent$) {
|
|
184
|
-
props.onEvent$("input", e, target.value, error);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
57
|
+
onBlur$: props.onBlur$,
|
|
58
|
+
onInput$: props.onInput$
|
|
187
59
|
}),
|
|
188
60
|
/* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {
|
|
189
61
|
name: "right"
|
|
190
62
|
})
|
|
191
63
|
]
|
|
192
64
|
}),
|
|
193
|
-
error
|
|
65
|
+
props.error && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
194
66
|
class: "text-error mt-1 text-xs",
|
|
195
|
-
children: error
|
|
67
|
+
children: props.error
|
|
196
68
|
})
|
|
197
69
|
]
|
|
198
70
|
});
|
|
@@ -1,37 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$, useSignal, useTask$,
|
|
3
|
-
import { safeParse } from "../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.qwik.mjs";
|
|
2
|
+
import { component$, useSignal, useTask$, Slot } from "@builder.io/qwik";
|
|
4
3
|
const TextField = component$((props) => {
|
|
5
|
-
const error = useSignal(typeof props.error === "string" ? props.error : props.error?.value);
|
|
6
4
|
const value = useSignal(typeof props.value === "string" ? props.value : props.value?.value);
|
|
7
|
-
const originalValue = typeof props.value === "string" ? props.value : props.value?.value;
|
|
8
|
-
const disabled = useSignal(false);
|
|
9
|
-
if (props.disabled) {
|
|
10
|
-
if (typeof props.disabled === "boolean") {
|
|
11
|
-
disabled.value = props.disabled;
|
|
12
|
-
} else {
|
|
13
|
-
disabled.value = props.disabled.value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const touched = useSignal(false);
|
|
17
|
-
const originalTriggerResetValue = props.triggerReset?.value;
|
|
18
|
-
const originalTriggerValidationValue = props.triggerValidation?.value;
|
|
19
|
-
useTask$(({ track }) => {
|
|
20
|
-
if (props.error && typeof props.error !== "string") {
|
|
21
|
-
track(() => error.value);
|
|
22
|
-
if (error.value !== props.error?.value) {
|
|
23
|
-
props.error.value = error.value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
useTask$(({ track }) => {
|
|
28
|
-
if (props.error && typeof props.error !== "string") {
|
|
29
|
-
track(() => props.error.value);
|
|
30
|
-
if (props.error && error.value !== props.error.value) {
|
|
31
|
-
error.value = props.error.value;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
5
|
useTask$(({ track }) => {
|
|
36
6
|
if (props.value && typeof props.value !== "string") {
|
|
37
7
|
track(() => value.value);
|
|
@@ -43,87 +13,11 @@ const TextField = component$((props) => {
|
|
|
43
13
|
useTask$(({ track }) => {
|
|
44
14
|
if (props.value && typeof props.value !== "string") {
|
|
45
15
|
track(() => props.value.value);
|
|
46
|
-
if (props.value
|
|
16
|
+
if (props.value.value !== value.value) {
|
|
47
17
|
value.value = props.value.value;
|
|
48
18
|
}
|
|
49
19
|
}
|
|
50
20
|
});
|
|
51
|
-
useTask$(({ track }) => {
|
|
52
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
53
|
-
track(() => disabled.value);
|
|
54
|
-
if (disabled.value !== props.disabled?.value) {
|
|
55
|
-
props.disabled.value = disabled.value;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
useTask$(({ track }) => {
|
|
60
|
-
if (props.disabled && typeof props.disabled !== "boolean") {
|
|
61
|
-
track(() => props.disabled.value);
|
|
62
|
-
if (props.disabled && disabled.value !== props.disabled.value) {
|
|
63
|
-
disabled.value = props.disabled.value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
useTask$(async ({ track }) => {
|
|
68
|
-
if (props.triggerReset) {
|
|
69
|
-
track(() => props.triggerReset?.value);
|
|
70
|
-
if (originalTriggerResetValue !== props.triggerReset.value) {
|
|
71
|
-
value.value = originalValue;
|
|
72
|
-
error.value = void 0;
|
|
73
|
-
touched.value = false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const validate = $(async () => {
|
|
78
|
-
if (props.schema$) {
|
|
79
|
-
const schema = await props.schema$();
|
|
80
|
-
const result = safeParse(schema, value.value);
|
|
81
|
-
if (!result.success) {
|
|
82
|
-
if (result.issues.length > 0) {
|
|
83
|
-
if (props.valid) {
|
|
84
|
-
props.valid.value = false;
|
|
85
|
-
}
|
|
86
|
-
error.value = result.issues[0].message;
|
|
87
|
-
return;
|
|
88
|
-
} else {
|
|
89
|
-
if (props.valid) {
|
|
90
|
-
props.valid.value = false;
|
|
91
|
-
}
|
|
92
|
-
error.value = "Invalid value";
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (value.value !== result.output) {
|
|
97
|
-
value.value = result.output;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (props.validate$) {
|
|
101
|
-
const result = await props.validate$(value.value);
|
|
102
|
-
if (!result.success) {
|
|
103
|
-
if (props.valid) {
|
|
104
|
-
props.valid.value = false;
|
|
105
|
-
}
|
|
106
|
-
error.value = result.error;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (value.value !== result.output) {
|
|
110
|
-
value.value = result.output;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (props.valid) {
|
|
114
|
-
props.valid.value = true;
|
|
115
|
-
error.value = void 0;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
useTask$(async ({ track }) => {
|
|
119
|
-
if (props.triggerValidation) {
|
|
120
|
-
track(() => props.triggerValidation?.value);
|
|
121
|
-
if (props.triggerValidation.value !== originalTriggerValidationValue) {
|
|
122
|
-
touched.value = true;
|
|
123
|
-
await validate();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
21
|
return /* @__PURE__ */ jsxs("div", {
|
|
128
22
|
class: "fieldset",
|
|
129
23
|
children: [
|
|
@@ -138,7 +32,7 @@ const TextField = component$((props) => {
|
|
|
138
32
|
})
|
|
139
33
|
}),
|
|
140
34
|
/* @__PURE__ */ jsxs("label", {
|
|
141
|
-
class: `input w-full ${error
|
|
35
|
+
class: `input w-full ${props.error ? "input-error" : ""}`,
|
|
142
36
|
children: [
|
|
143
37
|
/* @__PURE__ */ jsx(Slot, {
|
|
144
38
|
name: "left"
|
|
@@ -153,44 +47,22 @@ const TextField = component$((props) => {
|
|
|
153
47
|
},
|
|
154
48
|
required: props.required,
|
|
155
49
|
"aria-required": props.required,
|
|
156
|
-
disabled: disabled
|
|
50
|
+
disabled: props.disabled,
|
|
157
51
|
maxLength: props.maxLength,
|
|
158
52
|
value: value.value,
|
|
159
53
|
class: "placeholder:opacity-50",
|
|
160
54
|
placeholder: props.placeholder,
|
|
161
|
-
onBlur$:
|
|
162
|
-
|
|
163
|
-
touched.value = true;
|
|
164
|
-
value.value = target.value;
|
|
165
|
-
await validate();
|
|
166
|
-
target.value = value.value ?? "";
|
|
167
|
-
if (props.onBlur$) {
|
|
168
|
-
props.onBlur$(e, target.value, error);
|
|
169
|
-
}
|
|
170
|
-
if (props.onEvent$) {
|
|
171
|
-
props.onEvent$("blur", e, target.value, error);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
onInput$: async (e) => {
|
|
175
|
-
const target = e.target;
|
|
176
|
-
value.value = target.value;
|
|
177
|
-
await validate();
|
|
178
|
-
if (props.onInput$) {
|
|
179
|
-
props.onInput$(e, target.value, error);
|
|
180
|
-
}
|
|
181
|
-
if (props.onEvent$) {
|
|
182
|
-
props.onEvent$("input", e, target.value, error);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
55
|
+
onBlur$: props.onBlur$,
|
|
56
|
+
onInput$: props.onInput$
|
|
185
57
|
}),
|
|
186
58
|
/* @__PURE__ */ jsx(Slot, {
|
|
187
59
|
name: "right"
|
|
188
60
|
})
|
|
189
61
|
]
|
|
190
62
|
}),
|
|
191
|
-
error
|
|
63
|
+
props.error && /* @__PURE__ */ jsx("div", {
|
|
192
64
|
class: "text-error mt-1 text-xs",
|
|
193
|
-
children: error
|
|
65
|
+
children: props.error
|
|
194
66
|
})
|
|
195
67
|
]
|
|
196
68
|
});
|
|
@@ -4,7 +4,7 @@ export interface CheckboxFieldProps {
|
|
|
4
4
|
label: string;
|
|
5
5
|
name?: string;
|
|
6
6
|
checked?: boolean | Signal<boolean>;
|
|
7
|
-
error?: string
|
|
8
|
-
onClick$?: QRL<(event: Event
|
|
7
|
+
error?: string;
|
|
8
|
+
onClick$?: QRL<(event: Event) => void>;
|
|
9
9
|
}
|
|
10
10
|
export declare const CheckboxField: import("@builder.io/qwik").Component<CheckboxFieldProps>;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { QRL, Signal } from '@builder.io/qwik';
|
|
2
|
-
import * as v from 'valibot';
|
|
3
2
|
export interface SelectFieldProps {
|
|
4
3
|
id?: string;
|
|
5
4
|
label?: string;
|
|
6
5
|
name?: string;
|
|
7
6
|
value?: string | null | Signal<string | null | undefined>;
|
|
8
|
-
error?: string
|
|
7
|
+
error?: string;
|
|
9
8
|
required?: boolean;
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
onChange$?: QRL<(event: Event
|
|
12
|
-
onBlur$?: QRL<(event: FocusEvent
|
|
13
|
-
onEvent$?: QRL<(type: 'blur' | 'change', event: Event, value: string, error: Signal<string | undefined>) => void>;
|
|
14
|
-
validate$?: QRL<(value: string | null | undefined) => string | undefined>;
|
|
15
|
-
schema$?: QRL<() => v.BaseSchema<any, any, any>>;
|
|
16
|
-
valid?: Signal<undefined | boolean>;
|
|
17
|
-
/**
|
|
18
|
-
* Increment the value of this signal to reset the input to its original value.
|
|
19
|
-
*/
|
|
20
|
-
triggerReset?: Signal<number>;
|
|
21
|
-
/**
|
|
22
|
-
* Increment the value of this signal to force validation to execute.
|
|
23
|
-
*/
|
|
24
|
-
triggerValidation?: Signal<number>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onChange$?: QRL<(event: Event) => void>;
|
|
11
|
+
onBlur$?: QRL<(event: FocusEvent) => void>;
|
|
25
12
|
}
|
|
26
13
|
export declare const SelectField: import("@builder.io/qwik").Component<SelectFieldProps>;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import { QRL, Signal } from '@builder.io/qwik';
|
|
2
|
-
import * as v from 'valibot';
|
|
3
2
|
/**
|
|
4
3
|
* The type of the input field.
|
|
5
4
|
*/
|
|
6
|
-
export type TextFieldType = 'text' | 'date' | 'email' | 'number' | 'tel' | 'url';
|
|
7
|
-
/**
|
|
8
|
-
* The result of validating a form input.
|
|
9
|
-
*/
|
|
10
|
-
export type TextFieldValidationResult = {
|
|
11
|
-
/**
|
|
12
|
-
* True if validation was successful. False if validation failed.
|
|
13
|
-
*/
|
|
14
|
-
success: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The error message if validation failed.
|
|
17
|
-
*/
|
|
18
|
-
error?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The normalized value of the input after successful validation.
|
|
21
|
-
*/
|
|
22
|
-
output: string | null | undefined;
|
|
23
|
-
};
|
|
5
|
+
export type TextFieldType = 'text' | 'date' | 'email' | 'number' | 'tel' | 'url' | 'password';
|
|
24
6
|
/**
|
|
25
7
|
* Properties for the TextField component.
|
|
26
8
|
*/
|
|
@@ -31,45 +13,18 @@ export interface TextFieldProps {
|
|
|
31
13
|
name?: string;
|
|
32
14
|
value?: string | null | Signal<string | null | undefined>;
|
|
33
15
|
placeholder?: string;
|
|
34
|
-
error?: string
|
|
16
|
+
error?: string;
|
|
35
17
|
maxLength?: number;
|
|
36
18
|
required?: boolean;
|
|
37
|
-
disabled?: boolean
|
|
19
|
+
disabled?: boolean;
|
|
38
20
|
/**
|
|
39
21
|
* Called when the input loses focus.
|
|
40
22
|
*/
|
|
41
|
-
onBlur$?: QRL<(event: FocusEvent
|
|
23
|
+
onBlur$?: QRL<(event: FocusEvent) => void>;
|
|
42
24
|
/**
|
|
43
25
|
* Called when the input value changes.
|
|
44
26
|
*/
|
|
45
|
-
onInput$?: QRL<(event: InputEvent
|
|
46
|
-
/**
|
|
47
|
-
* Called on blur or input events
|
|
48
|
-
*/
|
|
49
|
-
onEvent$?: QRL<(type: 'blur' | 'input', event: FocusEvent | InputEvent, value: string, error: Signal<string | undefined>) => void>;
|
|
50
|
-
/**
|
|
51
|
-
* Validates the form input. This is called on input and blur events.
|
|
52
|
-
*/
|
|
53
|
-
validate$?: QRL<(value: string | null | undefined) => TextFieldValidationResult>;
|
|
54
|
-
/**
|
|
55
|
-
* Called to validate the form input. This is called on input and blur events
|
|
56
|
-
* and is an alternative to the validate$ prop.
|
|
57
|
-
*/
|
|
58
|
-
schema$?: QRL<() => v.BaseSchema<any, any, any>>;
|
|
59
|
-
/**
|
|
60
|
-
* An optional signal that indicates whether the input is valid.
|
|
61
|
-
*/
|
|
62
|
-
valid?: Signal<undefined | boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* Increment the value of this signal to reset the input to its original value.
|
|
65
|
-
*/
|
|
66
|
-
triggerReset?: Signal<number>;
|
|
67
|
-
/**
|
|
68
|
-
* Increment the value of this signal to force validation to execute. Be
|
|
69
|
-
* aware that this will also cause the input to be touched, which will
|
|
70
|
-
* display the error message if one exists.
|
|
71
|
-
*/
|
|
72
|
-
triggerValidation?: Signal<number>;
|
|
27
|
+
onInput$?: QRL<(event: InputEvent) => void>;
|
|
73
28
|
}
|
|
74
29
|
/**
|
|
75
30
|
* A standardized text input field meant to be used independently or with Qwik
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nr1e/qwik-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "NR1E Qwik UI Library",
|
|
5
5
|
"author": "NR1E, Inc.",
|
|
6
6
|
"publishConfig": {
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
55
|
"typescript-eslint": "8.56.1",
|
|
56
56
|
"undici": "*",
|
|
57
|
-
"valibot": "^1.2.0",
|
|
58
57
|
"vite": "7.3.1",
|
|
59
58
|
"vite-tsconfig-paths": "^6.1.1",
|
|
60
59
|
"vitest": "4.0.18"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
let store$4;
|
|
4
|
-
// @__NO_SIDE_EFFECTS__
|
|
5
|
-
function getGlobalConfig(config$1) {
|
|
6
|
-
return {
|
|
7
|
-
lang: config$1?.lang ?? store$4?.lang,
|
|
8
|
-
message: config$1?.message,
|
|
9
|
-
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
10
|
-
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
// @__NO_SIDE_EFFECTS__
|
|
14
|
-
function safeParse(schema, input, config$1) {
|
|
15
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
16
|
-
return {
|
|
17
|
-
typed: dataset.typed,
|
|
18
|
-
success: !dataset.issues,
|
|
19
|
-
output: dataset.value,
|
|
20
|
-
issues: dataset.issues
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.getGlobalConfig = getGlobalConfig;
|
|
24
|
-
exports.safeParse = safeParse;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
let store$4;
|
|
2
|
-
// @__NO_SIDE_EFFECTS__
|
|
3
|
-
function getGlobalConfig(config$1) {
|
|
4
|
-
return {
|
|
5
|
-
lang: config$1?.lang ?? store$4?.lang,
|
|
6
|
-
message: config$1?.message,
|
|
7
|
-
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
8
|
-
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
// @__NO_SIDE_EFFECTS__
|
|
12
|
-
function safeParse(schema, input, config$1) {
|
|
13
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
14
|
-
return {
|
|
15
|
-
typed: dataset.typed,
|
|
16
|
-
success: !dataset.issues,
|
|
17
|
-
output: dataset.value,
|
|
18
|
-
issues: dataset.issues
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
getGlobalConfig,
|
|
23
|
-
safeParse
|
|
24
|
-
};
|