@twintag/twintag-form 1.6.1 → 1.6.2-beta.1
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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +221 -209
- package/README.md +407 -370
- package/dev/index.css +32 -32
- package/dev/main.tsx +460 -459
- package/dist/components/fields/date-picker.d.ts +1 -1
- package/dist/components/fields/file.d.ts +1 -1
- package/dist/components/fields/input.d.ts +1 -1
- package/dist/components/fields/textarea.d.ts +1 -1
- package/dist/components/provider.d.ts +1 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +152 -143
- package/dist/types/index.d.ts +16 -6
- package/dist/webcomponent.cjs +1 -1
- package/dist/webcomponent.d.ts +1 -1
- package/dist/webcomponent.js +3 -0
- package/lib/components/fields/date-picker.tsx +154 -154
- package/lib/components/fields/file.tsx +84 -83
- package/lib/components/fields/input.tsx +70 -70
- package/lib/components/fields/textarea.tsx +72 -68
- package/lib/components/provider.tsx +162 -163
- package/lib/index.tsx +45 -41
- package/lib/types/index.ts +102 -82
- package/lib/webcomponent.ts +2 -2
- package/package.json +1 -1
- package/vite.config.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -39,10 +39,10 @@ var qt = (...r) => Wt(r).filter(Boolean), Gt = (r, e) => {
|
|
|
39
39
|
for (let t in e) r.hasOwnProperty(t) ? r[t] = Ze(r[t], e[t]) : r[t] = e[t];
|
|
40
40
|
return r;
|
|
41
41
|
}, I = (r, e) => {
|
|
42
|
-
let { extend: t = null, slots: a = {}, variants: s = {}, compoundVariants: n = [], compoundSlots: i = [], defaultVariants: o = {} } = r, d = { ...sa, ...e }, l = t != null && t.base ? Ze(t.base, r == null ? void 0 : r.base) : r == null ? void 0 : r.base,
|
|
42
|
+
let { extend: t = null, slots: a = {}, variants: s = {}, compoundVariants: n = [], compoundSlots: i = [], defaultVariants: o = {} } = r, d = { ...sa, ...e }, l = t != null && t.base ? Ze(t.base, r == null ? void 0 : r.base) : r == null ? void 0 : r.base, f = t != null && t.variants && !D(t.variants) ? Gt(s, t.variants) : s, x = t != null && t.defaultVariants && !D(t.defaultVariants) ? { ...t.defaultVariants, ...o } : o;
|
|
43
43
|
!D(d.twMergeConfig) && !na(d.twMergeConfig, ae) && (ht = !0, ae = d.twMergeConfig);
|
|
44
44
|
let M = D(t == null ? void 0 : t.slots), P = D(a) ? {} : { base: Ze(r == null ? void 0 : r.base, M && (t == null ? void 0 : t.base)), ...a }, Re = M ? P : Vt({ ...t == null ? void 0 : t.slots }, D(P) ? { base: r == null ? void 0 : r.base } : P), be = D(t == null ? void 0 : t.compoundVariants) ? n : qt(t == null ? void 0 : t.compoundVariants, n), te = ($) => {
|
|
45
|
-
if (D(
|
|
45
|
+
if (D(f) && D(a) && M) return Se(l, $ == null ? void 0 : $.class, $ == null ? void 0 : $.className)(d);
|
|
46
46
|
if (be && !Array.isArray(be)) throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof be}`);
|
|
47
47
|
if (i && !Array.isArray(i)) throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof i}`);
|
|
48
48
|
let Vr = (k, C, N = [], R) => {
|
|
@@ -59,7 +59,7 @@ var qt = (...r) => Wt(r).filter(Boolean), Gt = (r, e) => {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
return A;
|
|
62
|
-
}, Tt = (k, C =
|
|
62
|
+
}, Tt = (k, C = f, N = null, R = null) => {
|
|
63
63
|
var A;
|
|
64
64
|
let S = C[k];
|
|
65
65
|
if (!S || D(S)) return null;
|
|
@@ -76,11 +76,11 @@ var qt = (...r) => Wt(r).filter(Boolean), Gt = (r, e) => {
|
|
|
76
76
|
}
|
|
77
77
|
let He = j != null && typeof j != "object" ? j : Ot(xe), it = S[He || "false"];
|
|
78
78
|
return typeof W == "object" && typeof N == "string" && W[N] ? Vt(W, it) : W.length > 0 ? (W.push(it), N === "base" ? W.join(" ") : W) : it;
|
|
79
|
-
}, Zr = () =>
|
|
80
|
-
if (!
|
|
79
|
+
}, Zr = () => f ? Object.keys(f).map((k) => Tt(k, f)) : null, jr = (k, C) => {
|
|
80
|
+
if (!f || typeof f != "object") return null;
|
|
81
81
|
let N = new Array();
|
|
82
|
-
for (let R in
|
|
83
|
-
let A = Tt(R,
|
|
82
|
+
for (let R in f) {
|
|
83
|
+
let A = Tt(R, f, k, C), S = k === "base" && typeof A == "string" ? A : A && A[k];
|
|
84
84
|
S && (N[N.length] = S);
|
|
85
85
|
}
|
|
86
86
|
return N;
|
|
@@ -148,9 +148,9 @@ var qt = (...r) => Wt(r).filter(Boolean), Gt = (r, e) => {
|
|
|
148
148
|
}
|
|
149
149
|
return Se(l, Zr(), Rt(be), $ == null ? void 0 : $.class, $ == null ? void 0 : $.className)(d);
|
|
150
150
|
}, Ir = () => {
|
|
151
|
-
if (!(!
|
|
151
|
+
if (!(!f || typeof f != "object")) return Object.keys(f);
|
|
152
152
|
};
|
|
153
|
-
return te.variantKeys = Ir(), te.extend = t, te.base = l, te.slots = Re, te.variants =
|
|
153
|
+
return te.variantKeys = Ir(), te.extend = t, te.base = l, te.slots = Re, te.variants = f, te.defaultVariants = x, te.compoundSlots = i, te.compoundVariants = be, te;
|
|
154
154
|
};
|
|
155
155
|
const Zt = pe.Root, ia = I({
|
|
156
156
|
base: "border-b"
|
|
@@ -466,7 +466,7 @@ const Ke = (r) => {
|
|
|
466
466
|
message: o
|
|
467
467
|
};
|
|
468
468
|
}, va = [];
|
|
469
|
-
function
|
|
469
|
+
function h(r, e) {
|
|
470
470
|
const t = Ye(), a = Ke({
|
|
471
471
|
issueData: e,
|
|
472
472
|
data: r.data,
|
|
@@ -572,8 +572,8 @@ function _(r) {
|
|
|
572
572
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
573
573
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
574
574
|
var d, l;
|
|
575
|
-
const { message:
|
|
576
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
575
|
+
const { message: f } = r;
|
|
576
|
+
return i.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: (d = f ?? a) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (l = f ?? t) !== null && l !== void 0 ? l : o.defaultError };
|
|
577
577
|
}, description: s };
|
|
578
578
|
}
|
|
579
579
|
class b {
|
|
@@ -831,7 +831,7 @@ class q extends b {
|
|
|
831
831
|
_parse(e) {
|
|
832
832
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
|
|
833
833
|
const n = this._getOrReturnCtx(e);
|
|
834
|
-
return
|
|
834
|
+
return h(n, {
|
|
835
835
|
code: u.invalid_type,
|
|
836
836
|
expected: m.string,
|
|
837
837
|
received: n.parsedType
|
|
@@ -841,7 +841,7 @@ class q extends b {
|
|
|
841
841
|
let s;
|
|
842
842
|
for (const n of this._def.checks)
|
|
843
843
|
if (n.kind === "min")
|
|
844
|
-
e.data.length < n.value && (s = this._getOrReturnCtx(e, s),
|
|
844
|
+
e.data.length < n.value && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
845
845
|
code: u.too_small,
|
|
846
846
|
minimum: n.value,
|
|
847
847
|
type: "string",
|
|
@@ -850,7 +850,7 @@ class q extends b {
|
|
|
850
850
|
message: n.message
|
|
851
851
|
}), a.dirty());
|
|
852
852
|
else if (n.kind === "max")
|
|
853
|
-
e.data.length > n.value && (s = this._getOrReturnCtx(e, s),
|
|
853
|
+
e.data.length > n.value && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
854
854
|
code: u.too_big,
|
|
855
855
|
maximum: n.value,
|
|
856
856
|
type: "string",
|
|
@@ -860,14 +860,14 @@ class q extends b {
|
|
|
860
860
|
}), a.dirty());
|
|
861
861
|
else if (n.kind === "length") {
|
|
862
862
|
const i = e.data.length > n.value, o = e.data.length < n.value;
|
|
863
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
863
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? h(s, {
|
|
864
864
|
code: u.too_big,
|
|
865
865
|
maximum: n.value,
|
|
866
866
|
type: "string",
|
|
867
867
|
inclusive: !0,
|
|
868
868
|
exact: !0,
|
|
869
869
|
message: n.message
|
|
870
|
-
}) : o &&
|
|
870
|
+
}) : o && h(s, {
|
|
871
871
|
code: u.too_small,
|
|
872
872
|
minimum: n.value,
|
|
873
873
|
type: "string",
|
|
@@ -876,43 +876,43 @@ class q extends b {
|
|
|
876
876
|
message: n.message
|
|
877
877
|
}), a.dirty());
|
|
878
878
|
} else if (n.kind === "email")
|
|
879
|
-
Na.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
879
|
+
Na.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
880
880
|
validation: "email",
|
|
881
881
|
code: u.invalid_string,
|
|
882
882
|
message: n.message
|
|
883
883
|
}), a.dirty());
|
|
884
884
|
else if (n.kind === "emoji")
|
|
885
|
-
dt || (dt = new RegExp(Ta, "u")), dt.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
885
|
+
dt || (dt = new RegExp(Ta, "u")), dt.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
886
886
|
validation: "emoji",
|
|
887
887
|
code: u.invalid_string,
|
|
888
888
|
message: n.message
|
|
889
889
|
}), a.dirty());
|
|
890
890
|
else if (n.kind === "uuid")
|
|
891
|
-
ba.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
891
|
+
ba.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
892
892
|
validation: "uuid",
|
|
893
893
|
code: u.invalid_string,
|
|
894
894
|
message: n.message
|
|
895
895
|
}), a.dirty());
|
|
896
896
|
else if (n.kind === "nanoid")
|
|
897
|
-
xa.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
897
|
+
xa.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
898
898
|
validation: "nanoid",
|
|
899
899
|
code: u.invalid_string,
|
|
900
900
|
message: n.message
|
|
901
901
|
}), a.dirty());
|
|
902
902
|
else if (n.kind === "cuid")
|
|
903
|
-
ga.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
903
|
+
ga.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
904
904
|
validation: "cuid",
|
|
905
905
|
code: u.invalid_string,
|
|
906
906
|
message: n.message
|
|
907
907
|
}), a.dirty());
|
|
908
908
|
else if (n.kind === "cuid2")
|
|
909
|
-
ya.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
909
|
+
ya.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
910
910
|
validation: "cuid2",
|
|
911
911
|
code: u.invalid_string,
|
|
912
912
|
message: n.message
|
|
913
913
|
}), a.dirty());
|
|
914
914
|
else if (n.kind === "ulid")
|
|
915
|
-
_a.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
915
|
+
_a.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
916
916
|
validation: "ulid",
|
|
917
917
|
code: u.invalid_string,
|
|
918
918
|
message: n.message
|
|
@@ -921,61 +921,61 @@ class q extends b {
|
|
|
921
921
|
try {
|
|
922
922
|
new URL(e.data);
|
|
923
923
|
} catch {
|
|
924
|
-
s = this._getOrReturnCtx(e, s),
|
|
924
|
+
s = this._getOrReturnCtx(e, s), h(s, {
|
|
925
925
|
validation: "url",
|
|
926
926
|
code: u.invalid_string,
|
|
927
927
|
message: n.message
|
|
928
928
|
}), a.dirty();
|
|
929
929
|
}
|
|
930
|
-
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
930
|
+
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
931
931
|
validation: "regex",
|
|
932
932
|
code: u.invalid_string,
|
|
933
933
|
message: n.message
|
|
934
|
-
}), a.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (s = this._getOrReturnCtx(e, s),
|
|
934
|
+
}), a.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
935
935
|
code: u.invalid_string,
|
|
936
936
|
validation: { includes: n.value, position: n.position },
|
|
937
937
|
message: n.message
|
|
938
|
-
}), a.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (s = this._getOrReturnCtx(e, s),
|
|
938
|
+
}), a.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
939
939
|
code: u.invalid_string,
|
|
940
940
|
validation: { startsWith: n.value },
|
|
941
941
|
message: n.message
|
|
942
|
-
}), a.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (s = this._getOrReturnCtx(e, s),
|
|
942
|
+
}), a.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
943
943
|
code: u.invalid_string,
|
|
944
944
|
validation: { endsWith: n.value },
|
|
945
945
|
message: n.message
|
|
946
|
-
}), a.dirty()) : n.kind === "datetime" ? rr(n).test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
946
|
+
}), a.dirty()) : n.kind === "datetime" ? rr(n).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
947
947
|
code: u.invalid_string,
|
|
948
948
|
validation: "datetime",
|
|
949
949
|
message: n.message
|
|
950
|
-
}), a.dirty()) : n.kind === "date" ? Ia.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
950
|
+
}), a.dirty()) : n.kind === "date" ? Ia.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
951
951
|
code: u.invalid_string,
|
|
952
952
|
validation: "date",
|
|
953
953
|
message: n.message
|
|
954
|
-
}), a.dirty()) : n.kind === "time" ? Va(n).test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
954
|
+
}), a.dirty()) : n.kind === "time" ? Va(n).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
955
955
|
code: u.invalid_string,
|
|
956
956
|
validation: "time",
|
|
957
957
|
message: n.message
|
|
958
|
-
}), a.dirty()) : n.kind === "duration" ? ka.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
958
|
+
}), a.dirty()) : n.kind === "duration" ? ka.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
959
959
|
validation: "duration",
|
|
960
960
|
code: u.invalid_string,
|
|
961
961
|
message: n.message
|
|
962
|
-
}), a.dirty()) : n.kind === "ip" ? Za(e.data, n.version) || (s = this._getOrReturnCtx(e, s),
|
|
962
|
+
}), a.dirty()) : n.kind === "ip" ? Za(e.data, n.version) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
963
963
|
validation: "ip",
|
|
964
964
|
code: u.invalid_string,
|
|
965
965
|
message: n.message
|
|
966
|
-
}), a.dirty()) : n.kind === "jwt" ? ja(e.data, n.alg) || (s = this._getOrReturnCtx(e, s),
|
|
966
|
+
}), a.dirty()) : n.kind === "jwt" ? ja(e.data, n.alg) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
967
967
|
validation: "jwt",
|
|
968
968
|
code: u.invalid_string,
|
|
969
969
|
message: n.message
|
|
970
|
-
}), a.dirty()) : n.kind === "cidr" ? Ma(e.data, n.version) || (s = this._getOrReturnCtx(e, s),
|
|
970
|
+
}), a.dirty()) : n.kind === "cidr" ? Ma(e.data, n.version) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
971
971
|
validation: "cidr",
|
|
972
972
|
code: u.invalid_string,
|
|
973
973
|
message: n.message
|
|
974
|
-
}), a.dirty()) : n.kind === "base64" ? Ea.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
974
|
+
}), a.dirty()) : n.kind === "base64" ? Ea.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
975
975
|
validation: "base64",
|
|
976
976
|
code: u.invalid_string,
|
|
977
977
|
message: n.message
|
|
978
|
-
}), a.dirty()) : n.kind === "base64url" ? Oa.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
978
|
+
}), a.dirty()) : n.kind === "base64url" ? Oa.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
|
|
979
979
|
validation: "base64url",
|
|
980
980
|
code: u.invalid_string,
|
|
981
981
|
message: n.message
|
|
@@ -1225,7 +1225,7 @@ class de extends b {
|
|
|
1225
1225
|
_parse(e) {
|
|
1226
1226
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
|
|
1227
1227
|
const n = this._getOrReturnCtx(e);
|
|
1228
|
-
return
|
|
1228
|
+
return h(n, {
|
|
1229
1229
|
code: u.invalid_type,
|
|
1230
1230
|
expected: m.number,
|
|
1231
1231
|
received: n.parsedType
|
|
@@ -1234,30 +1234,30 @@ class de extends b {
|
|
|
1234
1234
|
let a;
|
|
1235
1235
|
const s = new L();
|
|
1236
1236
|
for (const n of this._def.checks)
|
|
1237
|
-
n.kind === "int" ? w.isInteger(e.data) || (a = this._getOrReturnCtx(e, a),
|
|
1237
|
+
n.kind === "int" ? w.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1238
1238
|
code: u.invalid_type,
|
|
1239
1239
|
expected: "integer",
|
|
1240
1240
|
received: "float",
|
|
1241
1241
|
message: n.message
|
|
1242
|
-
}), s.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a),
|
|
1242
|
+
}), s.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1243
1243
|
code: u.too_small,
|
|
1244
1244
|
minimum: n.value,
|
|
1245
1245
|
type: "number",
|
|
1246
1246
|
inclusive: n.inclusive,
|
|
1247
1247
|
exact: !1,
|
|
1248
1248
|
message: n.message
|
|
1249
|
-
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a),
|
|
1249
|
+
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1250
1250
|
code: u.too_big,
|
|
1251
1251
|
maximum: n.value,
|
|
1252
1252
|
type: "number",
|
|
1253
1253
|
inclusive: n.inclusive,
|
|
1254
1254
|
exact: !1,
|
|
1255
1255
|
message: n.message
|
|
1256
|
-
}), s.dirty()) : n.kind === "multipleOf" ? Pa(e.data, n.value) !== 0 && (a = this._getOrReturnCtx(e, a),
|
|
1256
|
+
}), s.dirty()) : n.kind === "multipleOf" ? Pa(e.data, n.value) !== 0 && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1257
1257
|
code: u.not_multiple_of,
|
|
1258
1258
|
multipleOf: n.value,
|
|
1259
1259
|
message: n.message
|
|
1260
|
-
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a),
|
|
1260
|
+
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1261
1261
|
code: u.not_finite,
|
|
1262
1262
|
message: n.message
|
|
1263
1263
|
}), s.dirty()) : w.assertNever(n);
|
|
@@ -1406,19 +1406,19 @@ class le extends b {
|
|
|
1406
1406
|
let a;
|
|
1407
1407
|
const s = new L();
|
|
1408
1408
|
for (const n of this._def.checks)
|
|
1409
|
-
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a),
|
|
1409
|
+
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1410
1410
|
code: u.too_small,
|
|
1411
1411
|
type: "bigint",
|
|
1412
1412
|
minimum: n.value,
|
|
1413
1413
|
inclusive: n.inclusive,
|
|
1414
1414
|
message: n.message
|
|
1415
|
-
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a),
|
|
1415
|
+
}), s.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1416
1416
|
code: u.too_big,
|
|
1417
1417
|
type: "bigint",
|
|
1418
1418
|
maximum: n.value,
|
|
1419
1419
|
inclusive: n.inclusive,
|
|
1420
1420
|
message: n.message
|
|
1421
|
-
}), s.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a),
|
|
1421
|
+
}), s.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), h(a, {
|
|
1422
1422
|
code: u.not_multiple_of,
|
|
1423
1423
|
multipleOf: n.value,
|
|
1424
1424
|
message: n.message
|
|
@@ -1427,7 +1427,7 @@ class le extends b {
|
|
|
1427
1427
|
}
|
|
1428
1428
|
_getInvalidInput(e) {
|
|
1429
1429
|
const t = this._getOrReturnCtx(e);
|
|
1430
|
-
return
|
|
1430
|
+
return h(t, {
|
|
1431
1431
|
code: u.invalid_type,
|
|
1432
1432
|
expected: m.bigint,
|
|
1433
1433
|
received: t.parsedType
|
|
@@ -1530,7 +1530,7 @@ class Me extends b {
|
|
|
1530
1530
|
_parse(e) {
|
|
1531
1531
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1532
1532
|
const a = this._getOrReturnCtx(e);
|
|
1533
|
-
return
|
|
1533
|
+
return h(a, {
|
|
1534
1534
|
code: u.invalid_type,
|
|
1535
1535
|
expected: m.boolean,
|
|
1536
1536
|
received: a.parsedType
|
|
@@ -1548,7 +1548,7 @@ class ge extends b {
|
|
|
1548
1548
|
_parse(e) {
|
|
1549
1549
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
|
|
1550
1550
|
const n = this._getOrReturnCtx(e);
|
|
1551
|
-
return
|
|
1551
|
+
return h(n, {
|
|
1552
1552
|
code: u.invalid_type,
|
|
1553
1553
|
expected: m.date,
|
|
1554
1554
|
received: n.parsedType
|
|
@@ -1556,21 +1556,21 @@ class ge extends b {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
if (isNaN(e.data.getTime())) {
|
|
1558
1558
|
const n = this._getOrReturnCtx(e);
|
|
1559
|
-
return
|
|
1559
|
+
return h(n, {
|
|
1560
1560
|
code: u.invalid_date
|
|
1561
1561
|
}), g;
|
|
1562
1562
|
}
|
|
1563
1563
|
const a = new L();
|
|
1564
1564
|
let s;
|
|
1565
1565
|
for (const n of this._def.checks)
|
|
1566
|
-
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s),
|
|
1566
|
+
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1567
1567
|
code: u.too_small,
|
|
1568
1568
|
message: n.message,
|
|
1569
1569
|
inclusive: !0,
|
|
1570
1570
|
exact: !1,
|
|
1571
1571
|
minimum: n.value,
|
|
1572
1572
|
type: "date"
|
|
1573
|
-
}), a.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (s = this._getOrReturnCtx(e, s),
|
|
1573
|
+
}), a.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (s = this._getOrReturnCtx(e, s), h(s, {
|
|
1574
1574
|
code: u.too_big,
|
|
1575
1575
|
message: n.message,
|
|
1576
1576
|
inclusive: !0,
|
|
@@ -1626,7 +1626,7 @@ class Xe extends b {
|
|
|
1626
1626
|
_parse(e) {
|
|
1627
1627
|
if (this._getType(e) !== m.symbol) {
|
|
1628
1628
|
const a = this._getOrReturnCtx(e);
|
|
1629
|
-
return
|
|
1629
|
+
return h(a, {
|
|
1630
1630
|
code: u.invalid_type,
|
|
1631
1631
|
expected: m.symbol,
|
|
1632
1632
|
received: a.parsedType
|
|
@@ -1643,7 +1643,7 @@ class Pe extends b {
|
|
|
1643
1643
|
_parse(e) {
|
|
1644
1644
|
if (this._getType(e) !== m.undefined) {
|
|
1645
1645
|
const a = this._getOrReturnCtx(e);
|
|
1646
|
-
return
|
|
1646
|
+
return h(a, {
|
|
1647
1647
|
code: u.invalid_type,
|
|
1648
1648
|
expected: m.undefined,
|
|
1649
1649
|
received: a.parsedType
|
|
@@ -1660,7 +1660,7 @@ class $e extends b {
|
|
|
1660
1660
|
_parse(e) {
|
|
1661
1661
|
if (this._getType(e) !== m.null) {
|
|
1662
1662
|
const a = this._getOrReturnCtx(e);
|
|
1663
|
-
return
|
|
1663
|
+
return h(a, {
|
|
1664
1664
|
code: u.invalid_type,
|
|
1665
1665
|
expected: m.null,
|
|
1666
1666
|
received: a.parsedType
|
|
@@ -1700,7 +1700,7 @@ me.create = (r) => new me({
|
|
|
1700
1700
|
class se extends b {
|
|
1701
1701
|
_parse(e) {
|
|
1702
1702
|
const t = this._getOrReturnCtx(e);
|
|
1703
|
-
return
|
|
1703
|
+
return h(t, {
|
|
1704
1704
|
code: u.invalid_type,
|
|
1705
1705
|
expected: m.never,
|
|
1706
1706
|
received: t.parsedType
|
|
@@ -1715,7 +1715,7 @@ class et extends b {
|
|
|
1715
1715
|
_parse(e) {
|
|
1716
1716
|
if (this._getType(e) !== m.undefined) {
|
|
1717
1717
|
const a = this._getOrReturnCtx(e);
|
|
1718
|
-
return
|
|
1718
|
+
return h(a, {
|
|
1719
1719
|
code: u.invalid_type,
|
|
1720
1720
|
expected: m.void,
|
|
1721
1721
|
received: a.parsedType
|
|
@@ -1732,14 +1732,14 @@ class G extends b {
|
|
|
1732
1732
|
_parse(e) {
|
|
1733
1733
|
const { ctx: t, status: a } = this._processInputParams(e), s = this._def;
|
|
1734
1734
|
if (t.parsedType !== m.array)
|
|
1735
|
-
return
|
|
1735
|
+
return h(t, {
|
|
1736
1736
|
code: u.invalid_type,
|
|
1737
1737
|
expected: m.array,
|
|
1738
1738
|
received: t.parsedType
|
|
1739
1739
|
}), g;
|
|
1740
1740
|
if (s.exactLength !== null) {
|
|
1741
1741
|
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1742
|
-
(i || o) && (
|
|
1742
|
+
(i || o) && (h(t, {
|
|
1743
1743
|
code: i ? u.too_big : u.too_small,
|
|
1744
1744
|
minimum: o ? s.exactLength.value : void 0,
|
|
1745
1745
|
maximum: i ? s.exactLength.value : void 0,
|
|
@@ -1749,14 +1749,14 @@ class G extends b {
|
|
|
1749
1749
|
message: s.exactLength.message
|
|
1750
1750
|
}), a.dirty());
|
|
1751
1751
|
}
|
|
1752
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (
|
|
1752
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (h(t, {
|
|
1753
1753
|
code: u.too_small,
|
|
1754
1754
|
minimum: s.minLength.value,
|
|
1755
1755
|
type: "array",
|
|
1756
1756
|
inclusive: !0,
|
|
1757
1757
|
exact: !1,
|
|
1758
1758
|
message: s.minLength.message
|
|
1759
|
-
}), a.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (
|
|
1759
|
+
}), a.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (h(t, {
|
|
1760
1760
|
code: u.too_big,
|
|
1761
1761
|
maximum: s.maxLength.value,
|
|
1762
1762
|
type: "array",
|
|
@@ -1830,7 +1830,7 @@ class E extends b {
|
|
|
1830
1830
|
_parse(e) {
|
|
1831
1831
|
if (this._getType(e) !== m.object) {
|
|
1832
1832
|
const l = this._getOrReturnCtx(e);
|
|
1833
|
-
return
|
|
1833
|
+
return h(l, {
|
|
1834
1834
|
code: u.invalid_type,
|
|
1835
1835
|
expected: m.object,
|
|
1836
1836
|
received: l.parsedType
|
|
@@ -1842,49 +1842,49 @@ class E extends b {
|
|
|
1842
1842
|
i.includes(l) || o.push(l);
|
|
1843
1843
|
const d = [];
|
|
1844
1844
|
for (const l of i) {
|
|
1845
|
-
const
|
|
1845
|
+
const f = n[l], x = s.data[l];
|
|
1846
1846
|
d.push({
|
|
1847
1847
|
key: { status: "valid", value: l },
|
|
1848
|
-
value:
|
|
1848
|
+
value: f._parse(new Y(s, x, s.path, l)),
|
|
1849
1849
|
alwaysSet: l in s.data
|
|
1850
1850
|
});
|
|
1851
1851
|
}
|
|
1852
1852
|
if (this._def.catchall instanceof se) {
|
|
1853
1853
|
const l = this._def.unknownKeys;
|
|
1854
1854
|
if (l === "passthrough")
|
|
1855
|
-
for (const
|
|
1855
|
+
for (const f of o)
|
|
1856
1856
|
d.push({
|
|
1857
|
-
key: { status: "valid", value:
|
|
1858
|
-
value: { status: "valid", value: s.data[
|
|
1857
|
+
key: { status: "valid", value: f },
|
|
1858
|
+
value: { status: "valid", value: s.data[f] }
|
|
1859
1859
|
});
|
|
1860
1860
|
else if (l === "strict")
|
|
1861
|
-
o.length > 0 && (
|
|
1861
|
+
o.length > 0 && (h(s, {
|
|
1862
1862
|
code: u.unrecognized_keys,
|
|
1863
1863
|
keys: o
|
|
1864
1864
|
}), a.dirty());
|
|
1865
1865
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1866
1866
|
} else {
|
|
1867
1867
|
const l = this._def.catchall;
|
|
1868
|
-
for (const
|
|
1869
|
-
const x = s.data[
|
|
1868
|
+
for (const f of o) {
|
|
1869
|
+
const x = s.data[f];
|
|
1870
1870
|
d.push({
|
|
1871
|
-
key: { status: "valid", value:
|
|
1871
|
+
key: { status: "valid", value: f },
|
|
1872
1872
|
value: l._parse(
|
|
1873
|
-
new Y(s, x, s.path,
|
|
1873
|
+
new Y(s, x, s.path, f)
|
|
1874
1874
|
//, ctx.child(key), value, getParsedType(value)
|
|
1875
1875
|
),
|
|
1876
|
-
alwaysSet:
|
|
1876
|
+
alwaysSet: f in s.data
|
|
1877
1877
|
});
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
1880
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1881
1881
|
const l = [];
|
|
1882
|
-
for (const
|
|
1883
|
-
const x = await
|
|
1882
|
+
for (const f of d) {
|
|
1883
|
+
const x = await f.key, M = await f.value;
|
|
1884
1884
|
l.push({
|
|
1885
1885
|
key: x,
|
|
1886
1886
|
value: M,
|
|
1887
|
-
alwaysSet:
|
|
1887
|
+
alwaysSet: f.alwaysSet
|
|
1888
1888
|
});
|
|
1889
1889
|
}
|
|
1890
1890
|
return l;
|
|
@@ -2115,7 +2115,7 @@ class ze extends b {
|
|
|
2115
2115
|
if (o.result.status === "dirty")
|
|
2116
2116
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2117
2117
|
const i = n.map((o) => new B(o.ctx.common.issues));
|
|
2118
|
-
return
|
|
2118
|
+
return h(t, {
|
|
2119
2119
|
code: u.invalid_union,
|
|
2120
2120
|
unionErrors: i
|
|
2121
2121
|
}), g;
|
|
@@ -2150,19 +2150,19 @@ class ze extends b {
|
|
|
2150
2150
|
issues: []
|
|
2151
2151
|
},
|
|
2152
2152
|
parent: null
|
|
2153
|
-
},
|
|
2153
|
+
}, f = d._parseSync({
|
|
2154
2154
|
data: t.data,
|
|
2155
2155
|
path: t.path,
|
|
2156
2156
|
parent: l
|
|
2157
2157
|
});
|
|
2158
|
-
if (
|
|
2159
|
-
return
|
|
2160
|
-
|
|
2158
|
+
if (f.status === "valid")
|
|
2159
|
+
return f;
|
|
2160
|
+
f.status === "dirty" && !n && (n = { result: f, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2161
2161
|
}
|
|
2162
2162
|
if (n)
|
|
2163
2163
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2164
2164
|
const o = i.map((d) => new B(d));
|
|
2165
|
-
return
|
|
2165
|
+
return h(t, {
|
|
2166
2166
|
code: u.invalid_union,
|
|
2167
2167
|
unionErrors: o
|
|
2168
2168
|
}), g;
|
|
@@ -2182,7 +2182,7 @@ class nt extends b {
|
|
|
2182
2182
|
_parse(e) {
|
|
2183
2183
|
const { ctx: t } = this._processInputParams(e);
|
|
2184
2184
|
if (t.parsedType !== m.object)
|
|
2185
|
-
return
|
|
2185
|
+
return h(t, {
|
|
2186
2186
|
code: u.invalid_type,
|
|
2187
2187
|
expected: m.object,
|
|
2188
2188
|
received: t.parsedType
|
|
@@ -2196,7 +2196,7 @@ class nt extends b {
|
|
|
2196
2196
|
data: t.data,
|
|
2197
2197
|
path: t.path,
|
|
2198
2198
|
parent: t
|
|
2199
|
-
}) : (
|
|
2199
|
+
}) : (h(t, {
|
|
2200
2200
|
code: u.invalid_union_discriminator,
|
|
2201
2201
|
options: Array.from(this.optionsMap.keys()),
|
|
2202
2202
|
path: [a]
|
|
@@ -2272,7 +2272,7 @@ class Le extends b {
|
|
|
2272
2272
|
if (pt(n) || pt(i))
|
|
2273
2273
|
return g;
|
|
2274
2274
|
const o = gt(n.value, i.value);
|
|
2275
|
-
return o.valid ? ((vt(n) || vt(i)) && t.dirty(), { status: t.value, value: o.data }) : (
|
|
2275
|
+
return o.valid ? ((vt(n) || vt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(a, {
|
|
2276
2276
|
code: u.invalid_intersection_types
|
|
2277
2277
|
}), g);
|
|
2278
2278
|
};
|
|
@@ -2308,20 +2308,20 @@ class K extends b {
|
|
|
2308
2308
|
_parse(e) {
|
|
2309
2309
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2310
2310
|
if (a.parsedType !== m.array)
|
|
2311
|
-
return
|
|
2311
|
+
return h(a, {
|
|
2312
2312
|
code: u.invalid_type,
|
|
2313
2313
|
expected: m.array,
|
|
2314
2314
|
received: a.parsedType
|
|
2315
2315
|
}), g;
|
|
2316
2316
|
if (a.data.length < this._def.items.length)
|
|
2317
|
-
return
|
|
2317
|
+
return h(a, {
|
|
2318
2318
|
code: u.too_small,
|
|
2319
2319
|
minimum: this._def.items.length,
|
|
2320
2320
|
inclusive: !0,
|
|
2321
2321
|
exact: !1,
|
|
2322
2322
|
type: "array"
|
|
2323
2323
|
}), g;
|
|
2324
|
-
!this._def.rest && a.data.length > this._def.items.length && (
|
|
2324
|
+
!this._def.rest && a.data.length > this._def.items.length && (h(a, {
|
|
2325
2325
|
code: u.too_big,
|
|
2326
2326
|
maximum: this._def.items.length,
|
|
2327
2327
|
inclusive: !0,
|
|
@@ -2364,7 +2364,7 @@ class Fe extends b {
|
|
|
2364
2364
|
_parse(e) {
|
|
2365
2365
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2366
2366
|
if (a.parsedType !== m.object)
|
|
2367
|
-
return
|
|
2367
|
+
return h(a, {
|
|
2368
2368
|
code: u.invalid_type,
|
|
2369
2369
|
expected: m.object,
|
|
2370
2370
|
received: a.parsedType
|
|
@@ -2405,7 +2405,7 @@ class tt extends b {
|
|
|
2405
2405
|
_parse(e) {
|
|
2406
2406
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2407
2407
|
if (a.parsedType !== m.map)
|
|
2408
|
-
return
|
|
2408
|
+
return h(a, {
|
|
2409
2409
|
code: u.invalid_type,
|
|
2410
2410
|
expected: m.map,
|
|
2411
2411
|
received: a.parsedType
|
|
@@ -2418,20 +2418,20 @@ class tt extends b {
|
|
|
2418
2418
|
const o = /* @__PURE__ */ new Map();
|
|
2419
2419
|
return Promise.resolve().then(async () => {
|
|
2420
2420
|
for (const d of i) {
|
|
2421
|
-
const l = await d.key,
|
|
2422
|
-
if (l.status === "aborted" ||
|
|
2421
|
+
const l = await d.key, f = await d.value;
|
|
2422
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2423
2423
|
return g;
|
|
2424
|
-
(l.status === "dirty" ||
|
|
2424
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2425
2425
|
}
|
|
2426
2426
|
return { status: t.value, value: o };
|
|
2427
2427
|
});
|
|
2428
2428
|
} else {
|
|
2429
2429
|
const o = /* @__PURE__ */ new Map();
|
|
2430
2430
|
for (const d of i) {
|
|
2431
|
-
const l = d.key,
|
|
2432
|
-
if (l.status === "aborted" ||
|
|
2431
|
+
const l = d.key, f = d.value;
|
|
2432
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2433
2433
|
return g;
|
|
2434
|
-
(l.status === "dirty" ||
|
|
2434
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2435
2435
|
}
|
|
2436
2436
|
return { status: t.value, value: o };
|
|
2437
2437
|
}
|
|
@@ -2447,20 +2447,20 @@ class ye extends b {
|
|
|
2447
2447
|
_parse(e) {
|
|
2448
2448
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2449
2449
|
if (a.parsedType !== m.set)
|
|
2450
|
-
return
|
|
2450
|
+
return h(a, {
|
|
2451
2451
|
code: u.invalid_type,
|
|
2452
2452
|
expected: m.set,
|
|
2453
2453
|
received: a.parsedType
|
|
2454
2454
|
}), g;
|
|
2455
2455
|
const s = this._def;
|
|
2456
|
-
s.minSize !== null && a.data.size < s.minSize.value && (
|
|
2456
|
+
s.minSize !== null && a.data.size < s.minSize.value && (h(a, {
|
|
2457
2457
|
code: u.too_small,
|
|
2458
2458
|
minimum: s.minSize.value,
|
|
2459
2459
|
type: "set",
|
|
2460
2460
|
inclusive: !0,
|
|
2461
2461
|
exact: !1,
|
|
2462
2462
|
message: s.minSize.message
|
|
2463
|
-
}), t.dirty()), s.maxSize !== null && a.data.size > s.maxSize.value && (
|
|
2463
|
+
}), t.dirty()), s.maxSize !== null && a.data.size > s.maxSize.value && (h(a, {
|
|
2464
2464
|
code: u.too_big,
|
|
2465
2465
|
maximum: s.maxSize.value,
|
|
2466
2466
|
type: "set",
|
|
@@ -2471,10 +2471,10 @@ class ye extends b {
|
|
|
2471
2471
|
const n = this._def.valueType;
|
|
2472
2472
|
function i(d) {
|
|
2473
2473
|
const l = /* @__PURE__ */ new Set();
|
|
2474
|
-
for (const
|
|
2475
|
-
if (
|
|
2474
|
+
for (const f of d) {
|
|
2475
|
+
if (f.status === "aborted")
|
|
2476
2476
|
return g;
|
|
2477
|
-
|
|
2477
|
+
f.status === "dirty" && t.dirty(), l.add(f.value);
|
|
2478
2478
|
}
|
|
2479
2479
|
return { status: t.value, value: l };
|
|
2480
2480
|
}
|
|
@@ -2514,7 +2514,7 @@ class Ne extends b {
|
|
|
2514
2514
|
_parse(e) {
|
|
2515
2515
|
const { ctx: t } = this._processInputParams(e);
|
|
2516
2516
|
if (t.parsedType !== m.function)
|
|
2517
|
-
return
|
|
2517
|
+
return h(t, {
|
|
2518
2518
|
code: u.invalid_type,
|
|
2519
2519
|
expected: m.function,
|
|
2520
2520
|
received: t.parsedType
|
|
@@ -2555,9 +2555,9 @@ class Ne extends b {
|
|
|
2555
2555
|
if (this._def.returns instanceof Ae) {
|
|
2556
2556
|
const o = this;
|
|
2557
2557
|
return F(async function(...d) {
|
|
2558
|
-
const l = new B([]),
|
|
2558
|
+
const l = new B([]), f = await o._def.args.parseAsync(d, n).catch((P) => {
|
|
2559
2559
|
throw l.addIssue(a(d, P)), l;
|
|
2560
|
-
}), x = await Reflect.apply(i, this,
|
|
2560
|
+
}), x = await Reflect.apply(i, this, f);
|
|
2561
2561
|
return await o._def.returns._def.type.parseAsync(x, n).catch((P) => {
|
|
2562
2562
|
throw l.addIssue(s(x, P)), l;
|
|
2563
2563
|
});
|
|
@@ -2568,9 +2568,9 @@ class Ne extends b {
|
|
|
2568
2568
|
const l = o._def.args.safeParse(d, n);
|
|
2569
2569
|
if (!l.success)
|
|
2570
2570
|
throw new B([a(d, l.error)]);
|
|
2571
|
-
const
|
|
2571
|
+
const f = Reflect.apply(i, this, l.data), x = o._def.returns.safeParse(f, n);
|
|
2572
2572
|
if (!x.success)
|
|
2573
|
-
throw new B([s(
|
|
2573
|
+
throw new B([s(f, x.error)]);
|
|
2574
2574
|
return x.data;
|
|
2575
2575
|
});
|
|
2576
2576
|
}
|
|
@@ -2626,7 +2626,7 @@ class Ue extends b {
|
|
|
2626
2626
|
_parse(e) {
|
|
2627
2627
|
if (e.data !== this._def.value) {
|
|
2628
2628
|
const t = this._getOrReturnCtx(e);
|
|
2629
|
-
return
|
|
2629
|
+
return h(t, {
|
|
2630
2630
|
received: t.data,
|
|
2631
2631
|
code: u.invalid_literal,
|
|
2632
2632
|
expected: this._def.value
|
|
@@ -2657,7 +2657,7 @@ class ue extends b {
|
|
|
2657
2657
|
_parse(e) {
|
|
2658
2658
|
if (typeof e.data != "string") {
|
|
2659
2659
|
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2660
|
-
return
|
|
2660
|
+
return h(t, {
|
|
2661
2661
|
expected: w.joinValues(a),
|
|
2662
2662
|
received: t.parsedType,
|
|
2663
2663
|
code: u.invalid_type
|
|
@@ -2665,7 +2665,7 @@ class ue extends b {
|
|
|
2665
2665
|
}
|
|
2666
2666
|
if (Qe(this, Oe) || Xt(this, Oe, new Set(this._def.values)), !Qe(this, Oe).has(e.data)) {
|
|
2667
2667
|
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
2668
|
-
return
|
|
2668
|
+
return h(t, {
|
|
2669
2669
|
received: t.data,
|
|
2670
2670
|
code: u.invalid_enum_value,
|
|
2671
2671
|
options: a
|
|
@@ -2717,7 +2717,7 @@ class Be extends b {
|
|
|
2717
2717
|
const t = w.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e);
|
|
2718
2718
|
if (a.parsedType !== m.string && a.parsedType !== m.number) {
|
|
2719
2719
|
const s = w.objectValues(t);
|
|
2720
|
-
return
|
|
2720
|
+
return h(a, {
|
|
2721
2721
|
expected: w.joinValues(s),
|
|
2722
2722
|
received: a.parsedType,
|
|
2723
2723
|
code: u.invalid_type
|
|
@@ -2725,7 +2725,7 @@ class Be extends b {
|
|
|
2725
2725
|
}
|
|
2726
2726
|
if (Qe(this, Ie) || Xt(this, Ie, new Set(w.getValidEnumValues(this._def.values))), !Qe(this, Ie).has(e.data)) {
|
|
2727
2727
|
const s = w.objectValues(t);
|
|
2728
|
-
return
|
|
2728
|
+
return h(a, {
|
|
2729
2729
|
received: a.data,
|
|
2730
2730
|
code: u.invalid_enum_value,
|
|
2731
2731
|
options: s
|
|
@@ -2750,7 +2750,7 @@ class Ae extends b {
|
|
|
2750
2750
|
_parse(e) {
|
|
2751
2751
|
const { ctx: t } = this._processInputParams(e);
|
|
2752
2752
|
if (t.parsedType !== m.promise && t.common.async === !1)
|
|
2753
|
-
return
|
|
2753
|
+
return h(t, {
|
|
2754
2754
|
code: u.invalid_type,
|
|
2755
2755
|
expected: m.promise,
|
|
2756
2756
|
received: t.parsedType
|
|
@@ -2777,7 +2777,7 @@ class J extends b {
|
|
|
2777
2777
|
_parse(e) {
|
|
2778
2778
|
const { status: t, ctx: a } = this._processInputParams(e), s = this._def.effect || null, n = {
|
|
2779
2779
|
addIssue: (i) => {
|
|
2780
|
-
|
|
2780
|
+
h(a, i), i.fatal ? t.abort() : t.dirty();
|
|
2781
2781
|
},
|
|
2782
2782
|
get path() {
|
|
2783
2783
|
return a.path;
|
|
@@ -2949,7 +2949,7 @@ class rt extends b {
|
|
|
2949
2949
|
_parse(e) {
|
|
2950
2950
|
if (this._getType(e) !== m.nan) {
|
|
2951
2951
|
const a = this._getOrReturnCtx(e);
|
|
2952
|
-
return
|
|
2952
|
+
return h(a, {
|
|
2953
2953
|
code: u.invalid_type,
|
|
2954
2954
|
expected: m.nan,
|
|
2955
2955
|
received: a.parsedType
|
|
@@ -3040,9 +3040,9 @@ function nr(r, e = {}, t) {
|
|
|
3040
3040
|
const o = r(a);
|
|
3041
3041
|
if (o instanceof Promise)
|
|
3042
3042
|
return o.then((d) => {
|
|
3043
|
-
var l,
|
|
3043
|
+
var l, f;
|
|
3044
3044
|
if (!d) {
|
|
3045
|
-
const x = Mt(e, a), M = (
|
|
3045
|
+
const x = Mt(e, a), M = (f = (l = x.fatal) !== null && l !== void 0 ? l : t) !== null && f !== void 0 ? f : !0;
|
|
3046
3046
|
s.addIssue({ code: "custom", ...x, fatal: M });
|
|
3047
3047
|
}
|
|
3048
3048
|
});
|
|
@@ -3078,7 +3078,7 @@ var y = /* @__PURE__ */ Object.freeze({
|
|
|
3078
3078
|
getErrorMap: Ye,
|
|
3079
3079
|
makeIssue: Ke,
|
|
3080
3080
|
EMPTY_PATH: va,
|
|
3081
|
-
addIssueToContext:
|
|
3081
|
+
addIssueToContext: h,
|
|
3082
3082
|
ParseStatus: L,
|
|
3083
3083
|
INVALID: g,
|
|
3084
3084
|
DIRTY: ke,
|
|
@@ -3243,7 +3243,8 @@ const cr = zr({
|
|
|
3243
3243
|
inputs: /* @__PURE__ */ new Map(),
|
|
3244
3244
|
components: /* @__PURE__ */ new Map(),
|
|
3245
3245
|
config: [],
|
|
3246
|
-
resetValues: {}
|
|
3246
|
+
resetValues: {},
|
|
3247
|
+
acceptFileType: void 0
|
|
3247
3248
|
}), U = () => {
|
|
3248
3249
|
const r = Lr(cr);
|
|
3249
3250
|
if (!r)
|
|
@@ -3286,21 +3287,23 @@ const cr = zr({
|
|
|
3286
3287
|
inputs: t,
|
|
3287
3288
|
components: a,
|
|
3288
3289
|
config: s,
|
|
3289
|
-
|
|
3290
|
+
acceptFileType: n,
|
|
3291
|
+
children: i
|
|
3290
3292
|
}) => {
|
|
3291
|
-
const
|
|
3293
|
+
const o = lt(() => Array.isArray(s) ? s.map((l) => yt(l, a)) : yt(s, a), [s, a]), d = lt(() => Rn(o, t), [o, t]);
|
|
3292
3294
|
return /* @__PURE__ */ c(
|
|
3293
3295
|
cr.Provider,
|
|
3294
3296
|
{
|
|
3295
3297
|
value: {
|
|
3296
|
-
config:
|
|
3298
|
+
config: o,
|
|
3297
3299
|
variant: r,
|
|
3298
3300
|
size: e,
|
|
3299
3301
|
inputs: t,
|
|
3300
3302
|
components: a,
|
|
3301
|
-
resetValues:
|
|
3303
|
+
resetValues: d,
|
|
3304
|
+
acceptFileType: n
|
|
3302
3305
|
},
|
|
3303
|
-
children:
|
|
3306
|
+
children: i
|
|
3304
3307
|
}
|
|
3305
3308
|
);
|
|
3306
3309
|
}, zt = I({
|
|
@@ -3365,7 +3368,7 @@ const En = I({
|
|
|
3365
3368
|
item: o,
|
|
3366
3369
|
trigger: d,
|
|
3367
3370
|
icon: l,
|
|
3368
|
-
content:
|
|
3371
|
+
content: f
|
|
3369
3372
|
} = En({ size: i, variant: n });
|
|
3370
3373
|
return /* @__PURE__ */ T(
|
|
3371
3374
|
Ht,
|
|
@@ -3378,7 +3381,7 @@ const En = I({
|
|
|
3378
3381
|
t ? /* @__PURE__ */ c(ha, { name: t, className: l() }) : /* @__PURE__ */ c(Z, {}),
|
|
3379
3382
|
r
|
|
3380
3383
|
] }) }),
|
|
3381
|
-
/* @__PURE__ */ c(Kt, { className:
|
|
3384
|
+
/* @__PURE__ */ c(Kt, { className: f(), children: a })
|
|
3382
3385
|
]
|
|
3383
3386
|
}
|
|
3384
3387
|
);
|
|
@@ -3948,7 +3951,7 @@ const Wn = I({
|
|
|
3948
3951
|
);
|
|
3949
3952
|
Nt.displayName = "Input";
|
|
3950
3953
|
const _r = "", Jn = ({ label: r, bind: e, options: t }) => {
|
|
3951
|
-
const { control: a } = ie(), { variant: s, size: n } = U(),
|
|
3954
|
+
const { control: a } = ie(), { variant: s, size: n, acceptFileType: i } = U(), o = t == null ? void 0 : t.optionalField;
|
|
3952
3955
|
return /* @__PURE__ */ c(
|
|
3953
3956
|
he,
|
|
3954
3957
|
{
|
|
@@ -3956,31 +3959,32 @@ const _r = "", Jn = ({ label: r, bind: e, options: t }) => {
|
|
|
3956
3959
|
control: a,
|
|
3957
3960
|
name: e,
|
|
3958
3961
|
rules: {
|
|
3959
|
-
required:
|
|
3962
|
+
required: o ? !1 : (t == null ? void 0 : t.error) ?? !0
|
|
3960
3963
|
},
|
|
3961
|
-
render: ({ field:
|
|
3964
|
+
render: ({ field: d, formState: l }) => /* @__PURE__ */ T(Q, { variant: s, children: [
|
|
3962
3965
|
/* @__PURE__ */ T("div", { className: "space-y-1", children: [
|
|
3963
3966
|
/* @__PURE__ */ T(X, { htmlFor: e, size: n, children: [
|
|
3964
3967
|
r,
|
|
3965
|
-
|
|
3968
|
+
o ? /* @__PURE__ */ c(Z, {}) : /* @__PURE__ */ c("span", { className: "ml-0.5 inline-block", children: /* @__PURE__ */ c(_e, { className: "h-3 w-3 text-tf-destructive" }) })
|
|
3966
3969
|
] }),
|
|
3967
3970
|
t != null && t.description ? /* @__PURE__ */ c(oe, { size: n, children: t.description }) : /* @__PURE__ */ c(Z, {})
|
|
3968
3971
|
] }),
|
|
3969
3972
|
/* @__PURE__ */ c(ee, { children: /* @__PURE__ */ c(
|
|
3970
3973
|
Nt,
|
|
3971
3974
|
{
|
|
3972
|
-
ref: (
|
|
3973
|
-
|
|
3975
|
+
ref: (f) => {
|
|
3976
|
+
d.ref(f), f && l.isSubmitSuccessful && (f.value = "");
|
|
3974
3977
|
},
|
|
3975
3978
|
id: e,
|
|
3976
3979
|
type: "file",
|
|
3977
|
-
|
|
3980
|
+
accept: (t == null ? void 0 : t.accept) ?? i,
|
|
3981
|
+
name: d.name,
|
|
3978
3982
|
size: n,
|
|
3979
3983
|
variant: s,
|
|
3980
3984
|
multiple: !0,
|
|
3981
|
-
onBlur:
|
|
3982
|
-
onChange: (
|
|
3983
|
-
|
|
3985
|
+
onBlur: d.onBlur,
|
|
3986
|
+
onChange: (f) => {
|
|
3987
|
+
f.target.files && d.onChange(f.target.files);
|
|
3984
3988
|
}
|
|
3985
3989
|
}
|
|
3986
3990
|
) }),
|
|
@@ -4149,7 +4153,11 @@ const kr = "", Qn = ({ label: r, bind: e, items: t, options: a }) => {
|
|
|
4149
4153
|
}
|
|
4150
4154
|
);
|
|
4151
4155
|
Nr.displayName = "Textarea";
|
|
4152
|
-
const Tr = "", ts = ({
|
|
4156
|
+
const Tr = "", ts = ({
|
|
4157
|
+
label: r,
|
|
4158
|
+
bind: e,
|
|
4159
|
+
options: t
|
|
4160
|
+
}) => {
|
|
4153
4161
|
const { control: a } = ie(), { variant: s, size: n } = U(), i = t == null ? void 0 : t.optionalField;
|
|
4154
4162
|
return /* @__PURE__ */ c(
|
|
4155
4163
|
he,
|
|
@@ -4284,10 +4292,10 @@ const Ar = !1, as = ({ label: r, bind: e, options: t }) => {
|
|
|
4284
4292
|
className: r
|
|
4285
4293
|
}),
|
|
4286
4294
|
onClick: (l) => {
|
|
4287
|
-
var
|
|
4295
|
+
var f;
|
|
4288
4296
|
if (l.preventDefault(), a !== void 0) {
|
|
4289
4297
|
const x = Object.keys(Lt.variants.state), M = x.indexOf(a.toString()), P = M === x.length - 1 ? 0 : M + 1;
|
|
4290
|
-
(
|
|
4298
|
+
(f = e.onValueChange) == null || f.call(e, [P]);
|
|
4291
4299
|
}
|
|
4292
4300
|
},
|
|
4293
4301
|
...e,
|
|
@@ -4397,7 +4405,7 @@ const Sr = null, ns = ({ label: r, bind: e, options: t }) => {
|
|
|
4397
4405
|
(P = n.current) == null || P.dispatchEvent(M);
|
|
4398
4406
|
}, l = () => {
|
|
4399
4407
|
i.handleSubmit(o, d)();
|
|
4400
|
-
},
|
|
4408
|
+
}, f = () => {
|
|
4401
4409
|
var P;
|
|
4402
4410
|
const x = i.getValues(), M = new CustomEvent("twintag-form-values", {
|
|
4403
4411
|
detail: x,
|
|
@@ -4409,8 +4417,8 @@ const Sr = null, ns = ({ label: r, bind: e, options: t }) => {
|
|
|
4409
4417
|
};
|
|
4410
4418
|
return Et(() => {
|
|
4411
4419
|
const x = n.current;
|
|
4412
|
-
return x && (x.addEventListener("twintag-form-validate", l), x.addEventListener("twintag-form-get_values",
|
|
4413
|
-
x && (x.removeEventListener("twintag-form-validate", l), x.removeEventListener("twintag-form-get_values",
|
|
4420
|
+
return x && (x.addEventListener("twintag-form-validate", l), x.addEventListener("twintag-form-get_values", f)), () => {
|
|
4421
|
+
x && (x.removeEventListener("twintag-form-validate", l), x.removeEventListener("twintag-form-get_values", f));
|
|
4414
4422
|
};
|
|
4415
4423
|
}, []), /* @__PURE__ */ c(jn, { ...i, children: /* @__PURE__ */ c(
|
|
4416
4424
|
"form",
|
|
@@ -4439,6 +4447,7 @@ const Sr = null, ns = ({ label: r, bind: e, options: t }) => {
|
|
|
4439
4447
|
variant: e == null ? void 0 : e.variant,
|
|
4440
4448
|
size: e == null ? void 0 : e.size,
|
|
4441
4449
|
config: r,
|
|
4450
|
+
acceptFileType: e == null ? void 0 : e.acceptFileType,
|
|
4442
4451
|
children: /* @__PURE__ */ c(
|
|
4443
4452
|
cs,
|
|
4444
4453
|
{
|