@scbt-ecom/ui 0.49.0 → 0.50.0
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/hooks.js.map +1 -1
- package/dist/{index-BiAdttkO.js → index-DJ_i5IU3.js} +6027 -5836
- package/dist/index-DJ_i5IU3.js.map +1 -0
- package/dist/shared/hooks/useFloating.d.ts +1 -1
- package/dist/shared/ui/calendar/Calendar.d.ts +1 -1
- package/dist/ui.js +2 -2
- package/dist/validation.js +93 -91
- package/dist/validation.js.map +1 -1
- package/dist/widget.js +1 -1
- package/package.json +1 -1
- package/dist/index-BiAdttkO.js.map +0 -1
|
@@ -4,5 +4,5 @@ type FloatingPosition = {
|
|
|
4
4
|
width?: number;
|
|
5
5
|
transformOrigin?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const useFloating: (trigger: React.RefObject<
|
|
7
|
+
export declare const useFloating: (trigger: React.RefObject<HTMLElement>, list: React.RefObject<HTMLElement>, offset: number) => FloatingPosition | null;
|
|
8
8
|
export {};
|
|
@@ -7,5 +7,5 @@ type CalendarProps = DayPickerProps & {
|
|
|
7
7
|
selectOptions?: SelectOptions;
|
|
8
8
|
disabledAfterToday?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare const Calendar: (
|
|
10
|
+
export declare const Calendar: import('react').ForwardRefExoticComponent<CalendarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
11
11
|
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-DJ_i5IU3.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-DJ_i5IU3.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
|
@@ -41,7 +41,7 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
41
41
|
code: o.ZodIssueCode.custom,
|
|
42
42
|
message: "Неверно введено отчество"
|
|
43
43
|
}));
|
|
44
|
-
}),
|
|
44
|
+
}), re = o.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
|
|
45
45
|
const [d, s, n] = (e == null ? void 0 : e.split(".")) ?? "", i = f(`${d}/${s}/${n}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
46
46
|
+n <= 1950 && t.addIssue({
|
|
47
47
|
code: o.ZodIssueCode.custom,
|
|
@@ -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,
|
|
@@ -69,7 +69,7 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
69
69
|
received: "null",
|
|
70
70
|
message: `${I.FIX_LENGTH} 4`
|
|
71
71
|
});
|
|
72
|
-
}).default(null),
|
|
72
|
+
}).default(null), a = {
|
|
73
73
|
NON_EMPTY: () => "Поле не может быть пустым",
|
|
74
74
|
MIN_LENGTH: (e) => `Поле должно содержать минимум символов: ${e}`,
|
|
75
75
|
MAX_LENGTH: (e) => `Поле должно содержать максимум символов: ${e}`,
|
|
@@ -98,84 +98,84 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
|
|
|
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) ||
|
|
101
|
+
return o.string().min(8, (i == null ? void 0 : i.min) || a.DATE_NON_EMPTY()).superRefine((u, r) => {
|
|
102
102
|
const l = d.replace(/\W/g, "").length;
|
|
103
|
-
if (u.replace(/[._-]/g, "").length < l &&
|
|
103
|
+
if (u.replace(/[._-]/g, "").length < l && r.addIssue({
|
|
104
104
|
code: o.ZodIssueCode.too_small,
|
|
105
105
|
minimum: l,
|
|
106
106
|
type: "date",
|
|
107
107
|
inclusive: !0,
|
|
108
|
-
message: (i == null ? void 0 : i.min) ||
|
|
108
|
+
message: (i == null ? void 0 : i.min) || a.DATE_NON_EMPTY()
|
|
109
109
|
}), t) {
|
|
110
110
|
let _ = null;
|
|
111
111
|
try {
|
|
112
112
|
_ = new Date(u);
|
|
113
113
|
} catch {
|
|
114
|
-
|
|
114
|
+
r.addIssue({
|
|
115
115
|
code: o.ZodIssueCode.invalid_date,
|
|
116
|
-
message: (i == null ? void 0 : i.invalidDate) ||
|
|
116
|
+
message: (i == null ? void 0 : i.invalidDate) || a.DATE_INVALID_FORMAT()
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) &&
|
|
119
|
+
s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && r.addIssue({
|
|
120
120
|
code: o.ZodIssueCode.invalid_date,
|
|
121
|
-
message: (i == null ? void 0 : i.min) ||
|
|
122
|
-
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) &&
|
|
121
|
+
message: (i == null ? void 0 : i.min) || a.DATE_MIN(s)
|
|
122
|
+
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && r.addIssue({
|
|
123
123
|
code: o.ZodIssueCode.invalid_date,
|
|
124
|
-
message: (i == null ? void 0 : i.max) ||
|
|
124
|
+
message: (i == null ? void 0 : i.max) || a.DATE_MAX(n)
|
|
125
125
|
});
|
|
126
126
|
} else {
|
|
127
127
|
const _ = f(u, d, /* @__PURE__ */ new Date());
|
|
128
|
-
N(_) ||
|
|
128
|
+
N(_) || r.addIssue({
|
|
129
129
|
code: o.ZodIssueCode.invalid_date,
|
|
130
|
-
message: (i == null ? void 0 : i.invalidDate) ||
|
|
131
|
-
}), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) &&
|
|
130
|
+
message: (i == null ? void 0 : i.invalidDate) || a.DATE_INVALID_FORMAT()
|
|
131
|
+
}), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && r.addIssue({
|
|
132
132
|
code: o.ZodIssueCode.invalid_date,
|
|
133
|
-
message: (i == null ? void 0 : i.min) ||
|
|
134
|
-
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) &&
|
|
133
|
+
message: (i == null ? void 0 : i.min) || a.DATE_MIN(s)
|
|
134
|
+
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && r.addIssue({
|
|
135
135
|
code: o.ZodIssueCode.invalid_date,
|
|
136
|
-
message: (i == null ? void 0 : i.max) ||
|
|
136
|
+
message: (i == null ? void 0 : i.max) || a.DATE_MAX(n)
|
|
137
137
|
});
|
|
138
138
|
}
|
|
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,
|
|
142
|
+
return o.string().transform((u) => u || void 0).superRefine((u, r) => {
|
|
143
143
|
if (c.isString(u) && u.length) {
|
|
144
144
|
const l = d.replace(/\W/g, "").length;
|
|
145
|
-
if (u.replace(/[._-]/g, "").length < l &&
|
|
145
|
+
if (u.replace(/[._-]/g, "").length < l && r.addIssue({
|
|
146
146
|
code: o.ZodIssueCode.too_small,
|
|
147
147
|
minimum: l,
|
|
148
148
|
type: "date",
|
|
149
149
|
inclusive: !0,
|
|
150
|
-
message: (i == null ? void 0 : i.min) ||
|
|
150
|
+
message: (i == null ? void 0 : i.min) || a.DATE_NON_EMPTY()
|
|
151
151
|
}), t) {
|
|
152
152
|
let _ = null;
|
|
153
153
|
try {
|
|
154
154
|
_ = new Date(u);
|
|
155
155
|
} catch {
|
|
156
|
-
|
|
156
|
+
r.addIssue({
|
|
157
157
|
code: o.ZodIssueCode.invalid_date,
|
|
158
|
-
message: (i == null ? void 0 : i.invalidDate) ||
|
|
158
|
+
message: (i == null ? void 0 : i.invalidDate) || a.DATE_INVALID_FORMAT()
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) &&
|
|
161
|
+
s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && r.addIssue({
|
|
162
162
|
code: o.ZodIssueCode.invalid_date,
|
|
163
|
-
message: (i == null ? void 0 : i.min) ||
|
|
164
|
-
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) &&
|
|
163
|
+
message: (i == null ? void 0 : i.min) || a.DATE_MIN(s)
|
|
164
|
+
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && r.addIssue({
|
|
165
165
|
code: o.ZodIssueCode.invalid_date,
|
|
166
|
-
message: (i == null ? void 0 : i.max) ||
|
|
166
|
+
message: (i == null ? void 0 : i.max) || a.DATE_MAX(n)
|
|
167
167
|
});
|
|
168
168
|
} else {
|
|
169
169
|
const _ = f(u, d, /* @__PURE__ */ new Date());
|
|
170
|
-
N(_) ||
|
|
170
|
+
N(_) || r.addIssue({
|
|
171
171
|
code: o.ZodIssueCode.invalid_date,
|
|
172
|
-
message: (i == null ? void 0 : i.invalidDate) ||
|
|
173
|
-
}), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) &&
|
|
172
|
+
message: (i == null ? void 0 : i.invalidDate) || a.DATE_INVALID_FORMAT()
|
|
173
|
+
}), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && r.addIssue({
|
|
174
174
|
code: o.ZodIssueCode.invalid_date,
|
|
175
|
-
message: (i == null ? void 0 : i.min) ||
|
|
176
|
-
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) &&
|
|
175
|
+
message: (i == null ? void 0 : i.min) || a.DATE_MIN(s)
|
|
176
|
+
}), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && r.addIssue({
|
|
177
177
|
code: o.ZodIssueCode.invalid_date,
|
|
178
|
-
message: (i == null ? void 0 : i.max) ||
|
|
178
|
+
message: (i == null ? void 0 : i.max) || a.DATE_MAX(n)
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -187,13 +187,13 @@ function H(e) {
|
|
|
187
187
|
}
|
|
188
188
|
const M = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/g, U = (e) => {
|
|
189
189
|
const { message: t, regexp: d = M } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
|
|
190
|
-
return o.string().min(1, (t == null ? void 0 : t.min) ||
|
|
190
|
+
return o.string().min(1, (t == null ? void 0 : t.min) || a.EMAIL_NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || a.EMAIL_INVALID()).default("");
|
|
191
191
|
}, Y = (e) => {
|
|
192
192
|
const { message: t, regexp: d = M } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
|
|
193
193
|
return o.string().refine(
|
|
194
194
|
(n) => c.isStringEmpty(n) ? !0 : s.test(n),
|
|
195
195
|
{
|
|
196
|
-
message: (t == null ? void 0 : t.invalid) ||
|
|
196
|
+
message: (t == null ? void 0 : t.invalid) || a.EMAIL_INVALID()
|
|
197
197
|
}
|
|
198
198
|
).optional().transform((n) => (n == null ? void 0 : n.length) === 0 ? void 0 : n);
|
|
199
199
|
};
|
|
@@ -204,7 +204,7 @@ function w(e) {
|
|
|
204
204
|
const O = (e) => {
|
|
205
205
|
const { min: t, max: d, message: s } = e || {};
|
|
206
206
|
let n = o.coerce.number();
|
|
207
|
-
return t && (n = n.min(t, (s == null ? void 0 : s.min) ||
|
|
207
|
+
return t && (n = n.min(t, (s == null ? void 0 : s.min) || a.MIN_VALUE(t))), d && (n = n.max(d, (s == null ? void 0 : s.min) || a.MAX_VALUE(d))), n.default(0);
|
|
208
208
|
}, F = (e) => O(e).optional().transform((t) => t || void 0);
|
|
209
209
|
function G(e) {
|
|
210
210
|
const { required: t = !0 } = e || {};
|
|
@@ -212,35 +212,35 @@ function G(e) {
|
|
|
212
212
|
}
|
|
213
213
|
const X = (e) => {
|
|
214
214
|
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = c.isString(d) ? new RegExp(d) : d;
|
|
215
|
-
let i = o.string().superRefine((u,
|
|
215
|
+
let i = o.string().superRefine((u, r) => {
|
|
216
216
|
const l = u.replace(n, ""), E = l.charAt(1);
|
|
217
|
-
["3", "4", "5", "6", "7", "9"].includes(E) ||
|
|
217
|
+
["3", "4", "5", "6", "7", "9"].includes(E) || r.addIssue({
|
|
218
218
|
code: o.ZodIssueCode.invalid_string,
|
|
219
219
|
validation: "regex",
|
|
220
|
-
message: (s == null ? void 0 : s.invalidOperator) ||
|
|
221
|
-
}), l.length < 11 &&
|
|
220
|
+
message: (s == null ? void 0 : s.invalidOperator) || a.PHONE_INVALID_OPERATOR()
|
|
221
|
+
}), l.length < 11 && r.addIssue({
|
|
222
222
|
code: o.ZodIssueCode.too_small,
|
|
223
223
|
minimum: 11,
|
|
224
224
|
inclusive: !0,
|
|
225
225
|
type: "string",
|
|
226
|
-
message: (s == null ? void 0 : s.min) ||
|
|
226
|
+
message: (s == null ? void 0 : s.min) || a.PHONE_NON_EMPTY()
|
|
227
227
|
});
|
|
228
228
|
});
|
|
229
229
|
return t && (i = i.transform((u) => u.replace(n, ""))), i.default("");
|
|
230
230
|
}, $ = (e) => {
|
|
231
231
|
const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = c.isString(d) ? new RegExp(d) : d;
|
|
232
|
-
let i = o.string().superRefine((u,
|
|
232
|
+
let i = o.string().superRefine((u, r) => {
|
|
233
233
|
const l = u.replace(n, ""), E = l.charAt(1);
|
|
234
|
-
["3", "4", "5", "6", "7", "9"].includes(E) ||
|
|
234
|
+
["3", "4", "5", "6", "7", "9"].includes(E) || r.addIssue({
|
|
235
235
|
code: o.ZodIssueCode.invalid_string,
|
|
236
236
|
validation: "regex",
|
|
237
|
-
message: (s == null ? void 0 : s.invalidOperator) ||
|
|
238
|
-
}), l.length < 11 &&
|
|
237
|
+
message: (s == null ? void 0 : s.invalidOperator) || a.PHONE_INVALID_OPERATOR()
|
|
238
|
+
}), l.length < 11 && r.addIssue({
|
|
239
239
|
code: o.ZodIssueCode.too_small,
|
|
240
240
|
minimum: 11,
|
|
241
241
|
inclusive: !0,
|
|
242
242
|
type: "string",
|
|
243
|
-
message: (s == null ? void 0 : s.min) ||
|
|
243
|
+
message: (s == null ? void 0 : s.min) || a.PHONE_NON_EMPTY()
|
|
244
244
|
});
|
|
245
245
|
});
|
|
246
246
|
return t && (i = i.transform((u) => u.replace(n, ""))), i.transform((u) => u || void 0);
|
|
@@ -251,12 +251,12 @@ function x(e) {
|
|
|
251
251
|
}
|
|
252
252
|
const b = (e) => {
|
|
253
253
|
var s, n;
|
|
254
|
-
const { message: t } = e || {}, d = o.string().min(1, (t == null ? void 0 : t.single) ||
|
|
254
|
+
const { message: t } = e || {}, d = o.string().min(1, (t == null ? void 0 : t.single) || a.SELECT_NON_EMPTY()).nullable().refine((i) => !!i, (t == null ? void 0 : t.single) || a.SELECT_NON_EMPTY()).default(null);
|
|
255
255
|
if (e != null && e.multiple) {
|
|
256
|
-
let i = o.array(d).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) ||
|
|
257
|
-
return e != null && e.length ? i.length(e.length, ((s = e.message) == null ? void 0 : s.length) ||
|
|
256
|
+
let i = o.array(d).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) || a.SELECT_MULTIPLE_MIN_LENGTH((e == null ? void 0 : e.minLength) || 0));
|
|
257
|
+
return e != null && e.length ? i.length(e.length, ((s = e.message) == null ? void 0 : s.length) || a.SELECT_FIX_LENGTH(e.length)).default([]) : (e != null && e.maxLength && (i = i.max(
|
|
258
258
|
e.maxLength,
|
|
259
|
-
((n = e.message) == null ? void 0 : n.maxLength) ||
|
|
259
|
+
((n = e.message) == null ? void 0 : n.maxLength) || a.SELECT_MULTIPLE_MAX_LENGTH(e.maxLength)
|
|
260
260
|
)), i.default([]));
|
|
261
261
|
}
|
|
262
262
|
return d;
|
|
@@ -269,25 +269,25 @@ 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
|
-
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) ||
|
|
276
|
-
},
|
|
275
|
+
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || a.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || a.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || a.FIX_LENGTH(s) })), i.refine((u) => !!u.length, { message: (n == null ? void 0 : n.min) || a.NON_EMPTY() }).default("");
|
|
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
|
-
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) ||
|
|
279
|
+
return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || a.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || a.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || a.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((l) => o.literal(l)),
|
|
286
|
+
const { message: d, ...s } = t || {}, [n, i, ...u] = e.map((l) => o.literal(l)), r = d ? typeof d == "function" ? d(e) : d : a.VALUE_OUT_OF_RANGE(e);
|
|
287
287
|
return o.union([n, i, ...u], {
|
|
288
|
-
message:
|
|
288
|
+
message: r,
|
|
289
289
|
...s
|
|
290
|
-
}).nullable().refine(Boolean,
|
|
290
|
+
}).nullable().refine(Boolean, a.NON_EMPTY()).default(null);
|
|
291
291
|
}, k = (e, t) => C(e, t).optional();
|
|
292
292
|
function j(e, t) {
|
|
293
293
|
const { required: d, ...s } = t || {};
|
|
@@ -295,10 +295,10 @@ function j(e, t) {
|
|
|
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
297
|
const { message: t, regexp: d = R } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
|
|
298
|
-
return D().min(1, (t == null ? void 0 : t.min) ||
|
|
298
|
+
return D().min(1, (t == null ? void 0 : t.min) || a.NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || a.INVALID_URL()).default("");
|
|
299
299
|
}, K = (e) => {
|
|
300
300
|
const { message: t, regexp: d = R } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
|
|
301
|
-
return D().refine((n) => c.isStringEmpty(n) ? !0 : s.test(n), (t == null ? void 0 : t.invalid) ||
|
|
301
|
+
return D().refine((n) => c.isStringEmpty(n) ? !0 : s.test(n), (t == null ? void 0 : t.invalid) || a.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 || {};
|
|
@@ -349,38 +349,40 @@ class ce {
|
|
|
349
349
|
const { fillArrayWithValue: s } = d || {};
|
|
350
350
|
if (t instanceof o.ZodEffects)
|
|
351
351
|
return t.innerType() instanceof o.ZodEffects ? this.getZodDefaults(t.innerType(), d) : this.getZodDefaults(o.ZodObject.create(t.innerType().shape), d);
|
|
352
|
-
const n = (
|
|
352
|
+
const n = (r) => {
|
|
353
353
|
switch (!0) {
|
|
354
|
-
case
|
|
355
|
-
return
|
|
356
|
-
case
|
|
354
|
+
case r instanceof o.ZodDefault:
|
|
355
|
+
return r._def.defaultValue();
|
|
356
|
+
case r instanceof o.ZodOptional:
|
|
357
357
|
return;
|
|
358
|
-
case
|
|
358
|
+
case r instanceof o.ZodNullable:
|
|
359
359
|
return null;
|
|
360
|
-
case
|
|
361
|
-
return s ? [n(
|
|
362
|
-
case
|
|
363
|
-
return this.getZodDefaults(
|
|
364
|
-
case
|
|
365
|
-
return n(
|
|
366
|
-
case
|
|
367
|
-
return
|
|
368
|
-
case
|
|
369
|
-
return
|
|
370
|
-
case
|
|
360
|
+
case r instanceof o.ZodArray:
|
|
361
|
+
return s ? [n(r.element)] : [];
|
|
362
|
+
case r instanceof o.ZodObject:
|
|
363
|
+
return this.getZodDefaults(r, d);
|
|
364
|
+
case r instanceof o.ZodUnion:
|
|
365
|
+
return n(r._def.options[0]);
|
|
366
|
+
case r instanceof o.ZodLiteral:
|
|
367
|
+
return r._def.value;
|
|
368
|
+
case r instanceof o.ZodDiscriminatedUnion:
|
|
369
|
+
return n(r._def.options[0]);
|
|
370
|
+
case r instanceof o.ZodEnum:
|
|
371
|
+
return r._def.values[0];
|
|
372
|
+
case r instanceof o.ZodString:
|
|
371
373
|
return "";
|
|
372
|
-
case
|
|
374
|
+
case r instanceof o.ZodNumber:
|
|
373
375
|
return 0;
|
|
374
|
-
case
|
|
376
|
+
case r instanceof o.ZodBoolean:
|
|
375
377
|
return !1;
|
|
376
|
-
case !("innerType" in
|
|
378
|
+
case !("innerType" in r._def):
|
|
377
379
|
return;
|
|
378
380
|
default:
|
|
379
|
-
return n(
|
|
381
|
+
return n(r._def.innerType);
|
|
380
382
|
}
|
|
381
383
|
}, i = {};
|
|
382
|
-
return Object.entries(t.shape).map(([
|
|
383
|
-
i[
|
|
384
|
+
return Object.entries(t.shape).map(([r, l]) => {
|
|
385
|
+
i[r] = n(l);
|
|
384
386
|
}), i;
|
|
385
387
|
}
|
|
386
388
|
}
|
|
@@ -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,
|
|
406
|
+
return o.string().superRefine((u, r) => {
|
|
405
407
|
const { name: l, surname: E, patronymic: _ } = ee(u);
|
|
406
|
-
m.ONLY_CYRILLIC.test(u) ||
|
|
408
|
+
m.ONLY_CYRILLIC.test(u) || r.addIssue({
|
|
407
409
|
code: o.ZodIssueCode.invalid_string,
|
|
408
410
|
validation: "regex",
|
|
409
411
|
message: g.ONLY_CYRILLIC()
|
|
410
|
-
}), (!l || !E) &&
|
|
412
|
+
}), (!l || !E) && r.addIssue({
|
|
411
413
|
code: o.ZodIssueCode.invalid_string,
|
|
412
414
|
validation: "regex",
|
|
413
415
|
message: d || g.NAME_OR_SURNAME_NON_EMPTY()
|
|
414
|
-
}), m.CHECK_HYPHEN.test(l) ||
|
|
416
|
+
}), m.CHECK_HYPHEN.test(l) || r.addIssue({
|
|
415
417
|
code: o.ZodIssueCode.invalid_string,
|
|
416
418
|
validation: "regex",
|
|
417
419
|
message: i || g.INVALID_NAME()
|
|
418
|
-
}), m.CHECK_HYPHEN.test(E) ||
|
|
420
|
+
}), m.CHECK_HYPHEN.test(E) || r.addIssue({
|
|
419
421
|
code: o.ZodIssueCode.invalid_string,
|
|
420
422
|
validation: "regex",
|
|
421
423
|
message: s || g.INVALID_SURNAME()
|
|
422
|
-
}), _ && (m.PATRONYMIC.test(_) ||
|
|
424
|
+
}), _ && (m.PATRONYMIC.test(_) || r.addIssue({
|
|
423
425
|
code: o.ZodIssueCode.invalid_string,
|
|
424
426
|
validation: "regex",
|
|
425
427
|
message: n || g.INVALID_PATRONYMIC()
|
|
@@ -442,13 +444,13 @@ export {
|
|
|
442
444
|
Z as RgxUnicode,
|
|
443
445
|
I as VALIDATION_MESSAGES,
|
|
444
446
|
ce as ZodUtils,
|
|
445
|
-
|
|
447
|
+
a 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
|