@scbt-ecom/ui 0.49.1 → 0.50.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/dist/{index-DJ_i5IU3.js → index-DXLhMM4P.js} +2 -1
- package/dist/{index-DJ_i5IU3.js.map → index-DXLhMM4P.js.map} +1 -1
- package/dist/shared/validation/utils/zodUtils.d.ts +1 -1
- package/dist/ui.js +2 -2
- package/dist/validation.js +66 -64
- package/dist/validation.js.map +1 -1
- package/dist/widget.js +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,6 @@ export declare class ZodUtils {
|
|
|
36
36
|
* // }
|
|
37
37
|
* // }
|
|
38
38
|
*/
|
|
39
|
-
static getZodDefaults<ZodSchema extends z.AnyZodObject, Schema = z.TypeOf<ZodSchema>>(zodSchema: ZodSchema | z.ZodEffects<ZodSchema>, options?: ZodUtilsGetDefaultsOptions): Schema;
|
|
39
|
+
static getZodDefaults<ZodSchema extends z.AnyZodObject, Schema = z.TypeOf<ZodSchema>>(zodSchema: ZodSchema | z.ZodEffects<ZodSchema> | z.ZodIntersection<ZodSchema, ZodSchema>, options?: ZodUtilsGetDefaultsOptions): Schema;
|
|
40
40
|
}
|
|
41
41
|
export {};
|
package/dist/ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as p, c as We, R as Ye, B as E, u as Je, f as Qe, g as Ze, h as et, i as k, k as ve, l as tt, m as nt, n as U, o as ot, A as rt, H as it, I as N, p as lt, q as me, D as ut, V as st, O as at } from "./index-
|
|
2
|
-
import { d as Kn, r as Xn, e as Wn, C as Yn, s as Jn, K as Qn, L as Zn, N as eo, P as to, a as no, S as oo, t as ro, U as io, b as lo } from "./index-
|
|
1
|
+
import { j as p, c as We, R as Ye, B as E, u as Je, f as Qe, g as Ze, h as et, i as k, k as ve, l as tt, m as nt, n as U, o as ot, A as rt, H as it, I as N, p as lt, q as me, D as ut, V as st, O as at } from "./index-DXLhMM4P.js";
|
|
2
|
+
import { d as Kn, r as Xn, e as Wn, C as Yn, s as Jn, K as Qn, L as Zn, N as eo, P as to, a as no, S as oo, t as ro, U as io, b as lo } from "./index-DXLhMM4P.js";
|
|
3
3
|
import * as P from "react";
|
|
4
4
|
import { forwardRef as D, useState as he, useEffect as gt } from "react";
|
|
5
5
|
import { c as w, T as Se } from "./typeGuards-BigW-JS1.js";
|
package/dist/validation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as o, p as
|
|
2
|
-
import { T as
|
|
1
|
+
import { z as o, p as m, i as N, f as T, D as L, s as D } from "./utils-Od0KoTas.js";
|
|
2
|
+
import { T as l } from "./typeGuards-BigW-JS1.js";
|
|
3
3
|
const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/, h = /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i, I = {
|
|
4
4
|
REQUIRED: "Поле обязательно к заполнению",
|
|
5
5
|
MIN_LENGTH: "Минимальная длина символов должна быть не менее",
|
|
@@ -41,8 +41,8 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
41
41
|
code: o.ZodIssueCode.custom,
|
|
42
42
|
message: "Неверно введено отчество"
|
|
43
43
|
}));
|
|
44
|
-
}),
|
|
45
|
-
const [d, s, n] = (e == null ? void 0 : e.split(".")) ?? "", i =
|
|
44
|
+
}), re = o.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
|
|
45
|
+
const [d, s, n] = (e == null ? void 0 : e.split(".")) ?? "", i = m(`${d}/${s}/${n}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
46
46
|
+n <= 1950 && t.addIssue({
|
|
47
47
|
code: o.ZodIssueCode.custom,
|
|
48
48
|
message: I.INVALID_DATE
|
|
@@ -53,7 +53,7 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
53
53
|
code: o.ZodIssueCode.custom,
|
|
54
54
|
message: I.FUTURE_DATE_NOT_ALLOWED
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
56
|
+
}), ae = o.string().superRefine((e, t) => {
|
|
57
57
|
const d = e.charAt(0);
|
|
58
58
|
["3", "4", "5", "6", "9"].includes(d) || t.addIssue({
|
|
59
59
|
code: o.ZodIssueCode.custom,
|
|
@@ -88,21 +88,21 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
88
88
|
DATE_NON_EMPTY: () => "Укажите дату",
|
|
89
89
|
VALUE_OUT_OF_RANGE: (e) => `Выберите один из вариантов ${e.join(", ")}`,
|
|
90
90
|
DATE_MIN: (e) => {
|
|
91
|
-
const t =
|
|
91
|
+
const t = l.isString(e) ? new Date(e) : e;
|
|
92
92
|
return `Выбранная дата должна быть не раньше ${T(t)}`;
|
|
93
93
|
},
|
|
94
94
|
DATE_MAX: (e) => {
|
|
95
|
-
const t =
|
|
95
|
+
const t = l.isString(e) ? new Date(e) : e;
|
|
96
96
|
return `Выбранная дата должна быть не позже ${T(t)}`;
|
|
97
97
|
},
|
|
98
98
|
INVALID_URL: () => "Ссылка введена некорректно. Пример: https://example.com, example.com"
|
|
99
99
|
}, V = (e) => {
|
|
100
100
|
const { iso: t = !0, pattern: d = L, min: s, max: n, message: i } = e || {};
|
|
101
|
-
return o.string().min(8, (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()).superRefine((u,
|
|
102
|
-
const
|
|
103
|
-
if (u.replace(/[._-]/g, "").length <
|
|
101
|
+
return o.string().min(8, (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()).superRefine((u, c) => {
|
|
102
|
+
const a = d.replace(/\W/g, "").length;
|
|
103
|
+
if (u.replace(/[._-]/g, "").length < a && c.addIssue({
|
|
104
104
|
code: o.ZodIssueCode.too_small,
|
|
105
|
-
minimum:
|
|
105
|
+
minimum: a,
|
|
106
106
|
type: "date",
|
|
107
107
|
inclusive: !0,
|
|
108
108
|
message: (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()
|
|
@@ -111,27 +111,27 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
111
111
|
try {
|
|
112
112
|
_ = new Date(u);
|
|
113
113
|
} catch {
|
|
114
|
-
|
|
114
|
+
c.addIssue({
|
|
115
115
|
code: o.ZodIssueCode.invalid_date,
|
|
116
116
|
message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
s && _.getTime() < (
|
|
119
|
+
s && _.getTime() < (l.isString(s) ? new Date(s).getTime() : s.getTime()) && c.addIssue({
|
|
120
120
|
code: o.ZodIssueCode.invalid_date,
|
|
121
121
|
message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
|
|
122
|
-
}), n && _.getTime() > (
|
|
122
|
+
}), n && _.getTime() > (l.isString(n) ? new Date(n).getTime() : n.getTime()) && c.addIssue({
|
|
123
123
|
code: o.ZodIssueCode.invalid_date,
|
|
124
124
|
message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
|
|
125
125
|
});
|
|
126
126
|
} else {
|
|
127
|
-
const _ =
|
|
128
|
-
N(_) ||
|
|
127
|
+
const _ = m(u, d, /* @__PURE__ */ new Date());
|
|
128
|
+
N(_) || c.addIssue({
|
|
129
129
|
code: o.ZodIssueCode.invalid_date,
|
|
130
130
|
message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
|
|
131
|
-
}), s && _.getTime() < (
|
|
131
|
+
}), s && _.getTime() < (l.isString(s) ? new Date(s).getTime() : s.getTime()) && c.addIssue({
|
|
132
132
|
code: o.ZodIssueCode.invalid_date,
|
|
133
133
|
message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
|
|
134
|
-
}), n && _.getTime() > (
|
|
134
|
+
}), n && _.getTime() > (l.isString(n) ? new Date(n).getTime() : n.getTime()) && c.addIssue({
|
|
135
135
|
code: o.ZodIssueCode.invalid_date,
|
|
136
136
|
message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
|
|
137
137
|
});
|
|
@@ -139,12 +139,12 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
139
139
|
}).default("");
|
|
140
140
|
}, y = (e) => {
|
|
141
141
|
const { iso: t = !0, pattern: d = L, min: s, max: n, message: i } = e || {};
|
|
142
|
-
return o.string().transform((u) => u || void 0).superRefine((u,
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
if (u.replace(/[._-]/g, "").length <
|
|
142
|
+
return o.string().transform((u) => u || void 0).superRefine((u, c) => {
|
|
143
|
+
if (l.isString(u) && u.length) {
|
|
144
|
+
const a = d.replace(/\W/g, "").length;
|
|
145
|
+
if (u.replace(/[._-]/g, "").length < a && c.addIssue({
|
|
146
146
|
code: o.ZodIssueCode.too_small,
|
|
147
|
-
minimum:
|
|
147
|
+
minimum: a,
|
|
148
148
|
type: "date",
|
|
149
149
|
inclusive: !0,
|
|
150
150
|
message: (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()
|
|
@@ -153,27 +153,27 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
153
153
|
try {
|
|
154
154
|
_ = new Date(u);
|
|
155
155
|
} catch {
|
|
156
|
-
|
|
156
|
+
c.addIssue({
|
|
157
157
|
code: o.ZodIssueCode.invalid_date,
|
|
158
158
|
message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
s && _.getTime() < (
|
|
161
|
+
s && _.getTime() < (l.isString(s) ? new Date(s).getTime() : s.getTime()) && c.addIssue({
|
|
162
162
|
code: o.ZodIssueCode.invalid_date,
|
|
163
163
|
message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
|
|
164
|
-
}), n && _.getTime() > (
|
|
164
|
+
}), n && _.getTime() > (l.isString(n) ? new Date(n).getTime() : n.getTime()) && c.addIssue({
|
|
165
165
|
code: o.ZodIssueCode.invalid_date,
|
|
166
166
|
message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
|
|
167
167
|
});
|
|
168
168
|
} else {
|
|
169
|
-
const _ =
|
|
170
|
-
N(_) ||
|
|
169
|
+
const _ = m(u, d, /* @__PURE__ */ new Date());
|
|
170
|
+
N(_) || c.addIssue({
|
|
171
171
|
code: o.ZodIssueCode.invalid_date,
|
|
172
172
|
message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
|
|
173
|
-
}), s && _.getTime() < (
|
|
173
|
+
}), s && _.getTime() < (l.isString(s) ? new Date(s).getTime() : s.getTime()) && c.addIssue({
|
|
174
174
|
code: o.ZodIssueCode.invalid_date,
|
|
175
175
|
message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
|
|
176
|
-
}), n && _.getTime() > (
|
|
176
|
+
}), n && _.getTime() > (l.isString(n) ? new Date(n).getTime() : n.getTime()) && c.addIssue({
|
|
177
177
|
code: o.ZodIssueCode.invalid_date,
|
|
178
178
|
message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
|
|
179
179
|
});
|
|
@@ -186,12 +186,12 @@ function H(e) {
|
|
|
186
186
|
return t ? V(e) : y(e);
|
|
187
187
|
}
|
|
188
188
|
const M = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/g, U = (e) => {
|
|
189
|
-
const { message: t, regexp: d = M } = e || {}, s =
|
|
189
|
+
const { message: t, regexp: d = M } = e || {}, s = l.isString(d) ? new RegExp(d) : d;
|
|
190
190
|
return o.string().min(1, (t == null ? void 0 : t.min) || r.EMAIL_NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()).default("");
|
|
191
191
|
}, Y = (e) => {
|
|
192
|
-
const { message: t, regexp: d = M } = e || {}, s =
|
|
192
|
+
const { message: t, regexp: d = M } = e || {}, s = l.isString(d) ? new RegExp(d) : d;
|
|
193
193
|
return o.string().refine(
|
|
194
|
-
(n) =>
|
|
194
|
+
(n) => l.isStringEmpty(n) ? !0 : s.test(n),
|
|
195
195
|
{
|
|
196
196
|
message: (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()
|
|
197
197
|
}
|
|
@@ -211,14 +211,14 @@ function G(e) {
|
|
|
211
211
|
return t ? O(e) : F(e);
|
|
212
212
|
}
|
|
213
213
|
const X = (e) => {
|
|
214
|
-
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n =
|
|
215
|
-
let i = o.string().superRefine((u,
|
|
216
|
-
const
|
|
217
|
-
["3", "4", "5", "6", "7", "9"].includes(E) ||
|
|
214
|
+
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = l.isString(d) ? new RegExp(d) : d;
|
|
215
|
+
let i = o.string().superRefine((u, c) => {
|
|
216
|
+
const a = u.replace(n, ""), E = a.charAt(1);
|
|
217
|
+
["3", "4", "5", "6", "7", "9"].includes(E) || c.addIssue({
|
|
218
218
|
code: o.ZodIssueCode.invalid_string,
|
|
219
219
|
validation: "regex",
|
|
220
220
|
message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
|
|
221
|
-
}),
|
|
221
|
+
}), a.length < 11 && c.addIssue({
|
|
222
222
|
code: o.ZodIssueCode.too_small,
|
|
223
223
|
minimum: 11,
|
|
224
224
|
inclusive: !0,
|
|
@@ -228,14 +228,14 @@ const X = (e) => {
|
|
|
228
228
|
});
|
|
229
229
|
return t && (i = i.transform((u) => u.replace(n, ""))), i.default("");
|
|
230
230
|
}, $ = (e) => {
|
|
231
|
-
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n =
|
|
232
|
-
let i = o.string().superRefine((u,
|
|
233
|
-
const
|
|
234
|
-
["3", "4", "5", "6", "7", "9"].includes(E) ||
|
|
231
|
+
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = l.isString(d) ? new RegExp(d) : d;
|
|
232
|
+
let i = o.string().superRefine((u, c) => {
|
|
233
|
+
const a = u.replace(n, ""), E = a.charAt(1);
|
|
234
|
+
["3", "4", "5", "6", "7", "9"].includes(E) || c.addIssue({
|
|
235
235
|
code: o.ZodIssueCode.invalid_string,
|
|
236
236
|
validation: "regex",
|
|
237
237
|
message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
|
|
238
|
-
}),
|
|
238
|
+
}), a.length < 11 && c.addIssue({
|
|
239
239
|
code: o.ZodIssueCode.too_small,
|
|
240
240
|
minimum: 11,
|
|
241
241
|
inclusive: !0,
|
|
@@ -269,23 +269,23 @@ function v(e) {
|
|
|
269
269
|
const { required: t = !0 } = e || {};
|
|
270
270
|
return t ? b(e) : q(e);
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const p = (e) => {
|
|
273
273
|
const { min: t, max: d, length: s, message: n } = e || {};
|
|
274
274
|
let i = o.string({ message: n == null ? void 0 : n.root });
|
|
275
275
|
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || r.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || r.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || r.FIX_LENGTH(s) })), i.refine((u) => !!u.length, { message: (n == null ? void 0 : n.min) || r.NON_EMPTY() }).default("");
|
|
276
|
-
},
|
|
276
|
+
}, z = (e) => {
|
|
277
277
|
const { min: t, max: d, length: s, message: n } = e || {};
|
|
278
278
|
let i = o.string({ message: n == null ? void 0 : n.root });
|
|
279
279
|
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || r.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || r.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || r.FIX_LENGTH(s) })), i.optional().transform((u) => u != null && u.length ? u : void 0);
|
|
280
280
|
};
|
|
281
281
|
function B(e) {
|
|
282
282
|
const { required: t = !0, ...d } = e || {};
|
|
283
|
-
return t ?
|
|
283
|
+
return t ? p(d) : z(d);
|
|
284
284
|
}
|
|
285
285
|
const C = (e, t) => {
|
|
286
|
-
const { message: d, ...s } = t || {}, [n, i, ...u] = e.map((
|
|
286
|
+
const { message: d, ...s } = t || {}, [n, i, ...u] = e.map((a) => o.literal(a)), c = d ? typeof d == "function" ? d(e) : d : r.VALUE_OUT_OF_RANGE(e);
|
|
287
287
|
return o.union([n, i, ...u], {
|
|
288
|
-
message:
|
|
288
|
+
message: c,
|
|
289
289
|
...s
|
|
290
290
|
}).nullable().refine(Boolean, r.NON_EMPTY()).default(null);
|
|
291
291
|
}, k = (e, t) => C(e, t).optional();
|
|
@@ -294,11 +294,11 @@ function j(e, t) {
|
|
|
294
294
|
return d ? C(e, s) : k(e, s);
|
|
295
295
|
}
|
|
296
296
|
const R = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, W = (e) => {
|
|
297
|
-
const { message: t, regexp: d = R } = e || {}, s =
|
|
297
|
+
const { message: t, regexp: d = R } = e || {}, s = l.isString(d) ? new RegExp(d) : d;
|
|
298
298
|
return D().min(1, (t == null ? void 0 : t.min) || r.NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || r.INVALID_URL()).default("");
|
|
299
299
|
}, K = (e) => {
|
|
300
|
-
const { message: t, regexp: d = R } = e || {}, s =
|
|
301
|
-
return D().refine((n) =>
|
|
300
|
+
const { message: t, regexp: d = R } = e || {}, s = l.isString(d) ? new RegExp(d) : d;
|
|
301
|
+
return D().refine((n) => l.isStringEmpty(n) ? !0 : s.test(n), (t == null ? void 0 : t.invalid) || r.INVALID_URL()).optional().transform((n) => n != null && n.length ? n : void 0);
|
|
302
302
|
};
|
|
303
303
|
function Q(e) {
|
|
304
304
|
const { required: t = !0 } = e || {};
|
|
@@ -365,6 +365,8 @@ class ce {
|
|
|
365
365
|
return n(a._def.options[0]);
|
|
366
366
|
case a instanceof o.ZodLiteral:
|
|
367
367
|
return a._def.value;
|
|
368
|
+
case a instanceof o.ZodDiscriminatedUnion:
|
|
369
|
+
return n(a._def.options[0]);
|
|
368
370
|
case a instanceof o.ZodEnum:
|
|
369
371
|
return a._def.values[0];
|
|
370
372
|
case a instanceof o.ZodString:
|
|
@@ -378,9 +380,9 @@ class ce {
|
|
|
378
380
|
default:
|
|
379
381
|
return n(a._def.innerType);
|
|
380
382
|
}
|
|
381
|
-
}, i = {};
|
|
382
|
-
return Object.entries(
|
|
383
|
-
i[a] = n(
|
|
383
|
+
}, i = {}, u = t instanceof o.ZodIntersection ? t._def.left.merge(t._def.right).shape : t.shape;
|
|
384
|
+
return Object.entries(u).map(([a, E]) => {
|
|
385
|
+
i[a] = n(E);
|
|
384
386
|
}), i;
|
|
385
387
|
}
|
|
386
388
|
}
|
|
@@ -392,7 +394,7 @@ const g = {
|
|
|
392
394
|
INVALID_NAME: () => "Неверно введено имя",
|
|
393
395
|
INVALID_SURNAME: () => "Неверно введена фамилия",
|
|
394
396
|
INVALID_PATRONYMIC: () => "Неверно введено отчество"
|
|
395
|
-
},
|
|
397
|
+
}, f = {
|
|
396
398
|
ONLY_CYRILLIC: /[\u0400-\u04FF\u00CB\u00EB -]/g,
|
|
397
399
|
CHECK_HYPHEN: /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/,
|
|
398
400
|
PATRONYMIC: /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i
|
|
@@ -401,25 +403,25 @@ const g = {
|
|
|
401
403
|
return { surname: t, name: d, patronymic: n };
|
|
402
404
|
}, S = (e) => {
|
|
403
405
|
const { message: t } = e || {}, { nameOrSurnameEmpty: d, invalidSurname: s, invalidPatronymic: n, invalidName: i } = t || {};
|
|
404
|
-
return o.string().superRefine((u,
|
|
405
|
-
const { name:
|
|
406
|
-
|
|
406
|
+
return o.string().superRefine((u, c) => {
|
|
407
|
+
const { name: a, surname: E, patronymic: _ } = ee(u);
|
|
408
|
+
f.ONLY_CYRILLIC.test(u) || c.addIssue({
|
|
407
409
|
code: o.ZodIssueCode.invalid_string,
|
|
408
410
|
validation: "regex",
|
|
409
411
|
message: g.ONLY_CYRILLIC()
|
|
410
|
-
}), (!
|
|
412
|
+
}), (!a || !E) && c.addIssue({
|
|
411
413
|
code: o.ZodIssueCode.invalid_string,
|
|
412
414
|
validation: "regex",
|
|
413
415
|
message: d || g.NAME_OR_SURNAME_NON_EMPTY()
|
|
414
|
-
}),
|
|
416
|
+
}), f.CHECK_HYPHEN.test(a) || c.addIssue({
|
|
415
417
|
code: o.ZodIssueCode.invalid_string,
|
|
416
418
|
validation: "regex",
|
|
417
419
|
message: i || g.INVALID_NAME()
|
|
418
|
-
}),
|
|
420
|
+
}), f.CHECK_HYPHEN.test(E) || c.addIssue({
|
|
419
421
|
code: o.ZodIssueCode.invalid_string,
|
|
420
422
|
validation: "regex",
|
|
421
423
|
message: s || g.INVALID_SURNAME()
|
|
422
|
-
}), _ && (
|
|
424
|
+
}), _ && (f.PATRONYMIC.test(_) || c.addIssue({
|
|
423
425
|
code: o.ZodIssueCode.invalid_string,
|
|
424
426
|
validation: "regex",
|
|
425
427
|
message: n || g.INVALID_PATRONYMIC()
|
|
@@ -445,10 +447,10 @@ export {
|
|
|
445
447
|
r as baseDefaultMessages,
|
|
446
448
|
J as baseValidationSchemas,
|
|
447
449
|
P as formattedDadataFio,
|
|
448
|
-
|
|
450
|
+
re as zodCalendarValidate,
|
|
449
451
|
oe as zodDadataFioSchema,
|
|
450
452
|
ue as zodOtpCodeSchema,
|
|
451
|
-
|
|
453
|
+
ae as zodPhoneSchema,
|
|
452
454
|
le as zodValidators
|
|
453
455
|
};
|
|
454
456
|
//# sourceMappingURL=validation.js.map
|