@scbt-ecom/ui 0.45.1 → 0.46.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.
Files changed (28) hide show
  1. package/dist/{index-DV_MMMPA.js → index-BrkPKCF9.js} +5938 -5904
  2. package/dist/index-BrkPKCF9.js.map +1 -0
  3. package/dist/shared/ui/formElements/uncontrolled/autocomplete/Autocomplete.d.ts +1 -5
  4. package/dist/shared/ui/formElements/uncontrolled/index.d.ts +1 -0
  5. package/dist/shared/ui/formElements/uncontrolled/select/Select.d.ts +8 -0
  6. package/dist/shared/ui/formElements/uncontrolled/select/index.d.ts +1 -2
  7. package/dist/shared/ui/formElements/uncontrolled/select/model/index.d.ts +1 -1
  8. package/dist/shared/ui/formElements/uncontrolled/select/model/types.d.ts +1 -1
  9. package/dist/shared/validation/base/base.constants.d.ts +1 -0
  10. package/dist/shared/validation/base/base.validators.d.ts +2 -0
  11. package/dist/shared/validation/base/url.validators.d.ts +28 -0
  12. package/dist/shared/validation/index.d.ts +1 -0
  13. package/dist/ui.js +73 -73
  14. package/dist/ui.js.map +1 -1
  15. package/dist/{utils-DnWHDMk6.js → utils-SIizw_5C.js} +544 -530
  16. package/dist/utils-SIizw_5C.js.map +1 -0
  17. package/dist/validation.js +174 -161
  18. package/dist/validation.js.map +1 -1
  19. package/dist/widget.js +250 -280
  20. package/dist/widget.js.map +1 -1
  21. package/dist/widgets/banner/Banner.d.ts +7 -10
  22. package/dist/widgets/banner/ui/banners/BannerImageFull.d.ts +1 -1
  23. package/dist/widgets/banner/ui/banners/BannerWithSeparateImg.d.ts +1 -1
  24. package/dist/widgets/banner/ui/index.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/dist/index-DV_MMMPA.js.map +0 -1
  27. package/dist/shared/ui/formElements/uncontrolled/select/model/compareByValue.d.ts +0 -2
  28. package/dist/utils-DnWHDMk6.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { z as d, p as g, i as T, f as N, D as L } from "./utils-DnWHDMk6.js";
1
+ import { z as d, p as g, i as N, f as T, D as L, s as D } from "./utils-SIizw_5C.js";
2
2
  import { T as _ } from "./typeGuards-yOWv7RXH.js";
3
- const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/, S = /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i, I = {
3
+ const S = /^[\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: "Минимальная длина символов должна быть не менее",
6
6
  MAX_LENGTH: "Максимальная длина символов должна быть не более",
@@ -12,57 +12,57 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
12
12
  INVALID_DATE: "Введите корректную дату",
13
13
  FUTURE_DATE_NOT_ALLOWED: "Нельзя выбрать дату позже текущей",
14
14
  INVALID_URL: "Некорректная ссылка"
15
- }, R = (e) => {
16
- const t = e.trim().replace(/\s+/g, " ").split(" "), [a, s, ...i] = t, n = i == null ? void 0 : i.join(" ");
15
+ }, P = (e) => {
16
+ const t = e.trim().replace(/\s+/g, " ").split(" "), [o, s, ...i] = t, n = i == null ? void 0 : i.join(" ");
17
17
  return {
18
- surname: a,
18
+ surname: o,
19
19
  name: s,
20
20
  patronymic: n
21
21
  };
22
- }, te = d.string({ invalid_type_error: "Обязательно к заполнению", required_error: "Обязательно к заполнению" }).superRefine((e, t) => {
22
+ }, oe = d.string({ invalid_type_error: "Обязательно к заполнению", required_error: "Обязательно к заполнению" }).superRefine((e, t) => {
23
23
  e === "" && t.addIssue({
24
24
  code: d.ZodIssueCode.custom,
25
25
  message: "Введите имя и фамилию"
26
- }), Z.test(e) || t.addIssue({
26
+ }), S.test(e) || t.addIssue({
27
27
  code: d.ZodIssueCode.custom,
28
28
  message: "Должна быть только кириллица"
29
29
  });
30
- const { surname: a, name: s, patronymic: i } = R(e);
31
- (!a || !s) && t.addIssue({
30
+ const { surname: o, name: s, patronymic: i } = P(e);
31
+ (!o || !s) && t.addIssue({
32
32
  code: d.ZodIssueCode.custom,
33
33
  message: "Введите имя и фамилию"
34
34
  }), A.test(s) || t.addIssue({
35
35
  code: d.ZodIssueCode.custom,
36
36
  message: "Неверно введено имя"
37
- }), A.test(a) || t.addIssue({
37
+ }), A.test(o) || t.addIssue({
38
38
  code: d.ZodIssueCode.custom,
39
39
  message: "Неверно введена фамилия"
40
- }), i && (S.test(i) || t.addIssue({
40
+ }), i && (h.test(i) || t.addIssue({
41
41
  code: d.ZodIssueCode.custom,
42
42
  message: "Неверно введено отчество"
43
43
  }));
44
- }), ne = d.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
45
- const [a, s, i] = (e == null ? void 0 : e.split(".")) ?? "", n = g(`${a}/${s}/${i}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
44
+ }), ae = d.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
45
+ const [o, s, i] = (e == null ? void 0 : e.split(".")) ?? "", n = g(`${o}/${s}/${i}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
46
46
  +i <= 1950 && t.addIssue({
47
47
  code: d.ZodIssueCode.custom,
48
48
  message: I.INVALID_DATE
49
- }), T(n) || t.addIssue({
49
+ }), N(n) || t.addIssue({
50
50
  code: d.ZodIssueCode.custom,
51
51
  message: I.INVALID_DATE
52
52
  }), (/* @__PURE__ */ new Date()).getTime() < new Date(n).getTime() && t.addIssue({
53
53
  code: d.ZodIssueCode.custom,
54
54
  message: I.FUTURE_DATE_NOT_ALLOWED
55
55
  });
56
- }), ie = d.string().superRefine((e, t) => {
57
- const a = e.charAt(0);
58
- ["3", "4", "5", "6", "9"].includes(a) || t.addIssue({
56
+ }), re = d.string().superRefine((e, t) => {
57
+ const o = e.charAt(0);
58
+ ["3", "4", "5", "6", "9"].includes(o) || t.addIssue({
59
59
  code: d.ZodIssueCode.custom,
60
60
  message: "Код города/оператора должен начинаться с цифры 3, 4, 5, 6 или 9"
61
61
  }), e.length !== 10 && t.addIssue({
62
62
  code: d.ZodIssueCode.custom,
63
63
  message: "Введите номер телефона полностью"
64
64
  });
65
- }).transform((e) => `7${e}`), se = d.coerce.number().min(1e3, `${I.FIX_LENGTH} 4`).max(9999, `${I.FIX_LENGTH} 4`).nullable().superRefine((e, t) => {
65
+ }).transform((e) => `7${e}`), ue = d.coerce.number().min(1e3, `${I.FIX_LENGTH} 4`).max(9999, `${I.FIX_LENGTH} 4`).nullable().superRefine((e, t) => {
66
66
  e === null && t.addIssue({
67
67
  code: d.ZodIssueCode.invalid_type,
68
68
  expected: "number",
@@ -89,17 +89,18 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
89
89
  VALUE_OUT_OF_RANGE: (e) => `Выберите один из вариантов ${e.join(", ")}`,
90
90
  DATE_MIN: (e) => {
91
91
  const t = _.isString(e) ? new Date(e) : e;
92
- return `Выбранная дата должна быть не раньше ${N(t)}`;
92
+ return `Выбранная дата должна быть не раньше ${T(t)}`;
93
93
  },
94
94
  DATE_MAX: (e) => {
95
95
  const t = _.isString(e) ? new Date(e) : e;
96
- return `Выбранная дата должна быть не позже ${N(t)}`;
97
- }
98
- }, h = (e) => {
99
- const { iso: t = !0, pattern: a = L, min: s, max: i, message: n } = e || {};
100
- return d.string().min(8, (n == null ? void 0 : n.min) || r.DATE_NON_EMPTY()).superRefine((u, o) => {
101
- const l = a.replace(/\W/g, "").length;
102
- if (u.replace(/[._-]/g, "").length < l && o.addIssue({
96
+ return `Выбранная дата должна быть не позже ${T(t)}`;
97
+ },
98
+ INVALID_URL: () => "Ссылка введена некорректно. Пример: https://example.com, example.com"
99
+ }, V = (e) => {
100
+ const { iso: t = !0, pattern: o = L, min: s, max: i, message: n } = e || {};
101
+ return d.string().min(8, (n == null ? void 0 : n.min) || r.DATE_NON_EMPTY()).superRefine((u, a) => {
102
+ const l = o.replace(/\W/g, "").length;
103
+ if (u.replace(/[._-]/g, "").length < l && a.addIssue({
103
104
  code: d.ZodIssueCode.too_small,
104
105
  minimum: l,
105
106
  type: "date",
@@ -110,38 +111,38 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
110
111
  try {
111
112
  c = new Date(u);
112
113
  } catch {
113
- o.addIssue({
114
+ a.addIssue({
114
115
  code: d.ZodIssueCode.invalid_date,
115
116
  message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
116
117
  });
117
118
  }
118
- s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && o.addIssue({
119
+ s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
119
120
  code: d.ZodIssueCode.invalid_date,
120
121
  message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
121
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && o.addIssue({
122
+ }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
122
123
  code: d.ZodIssueCode.invalid_date,
123
124
  message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
124
125
  });
125
126
  } else {
126
- const c = g(u, a, /* @__PURE__ */ new Date());
127
- T(c) || o.addIssue({
127
+ const c = g(u, o, /* @__PURE__ */ new Date());
128
+ N(c) || a.addIssue({
128
129
  code: d.ZodIssueCode.invalid_date,
129
130
  message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
130
- }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && o.addIssue({
131
+ }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
131
132
  code: d.ZodIssueCode.invalid_date,
132
133
  message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
133
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && o.addIssue({
134
+ }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
134
135
  code: d.ZodIssueCode.invalid_date,
135
136
  message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
136
137
  });
137
138
  }
138
139
  }).default("");
139
- }, P = (e) => {
140
- const { iso: t = !0, pattern: a = L, min: s, max: i, message: n } = e || {};
141
- return d.string().transform((u) => u || void 0).superRefine((u, o) => {
140
+ }, y = (e) => {
141
+ const { iso: t = !0, pattern: o = L, min: s, max: i, message: n } = e || {};
142
+ return d.string().transform((u) => u || void 0).superRefine((u, a) => {
142
143
  if (_.isString(u) && u.length) {
143
- const l = a.replace(/\W/g, "").length;
144
- if (u.replace(/[._-]/g, "").length < l && o.addIssue({
144
+ const l = o.replace(/\W/g, "").length;
145
+ if (u.replace(/[._-]/g, "").length < l && a.addIssue({
145
146
  code: d.ZodIssueCode.too_small,
146
147
  minimum: l,
147
148
  type: "date",
@@ -152,27 +153,27 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
152
153
  try {
153
154
  c = new Date(u);
154
155
  } catch {
155
- o.addIssue({
156
+ a.addIssue({
156
157
  code: d.ZodIssueCode.invalid_date,
157
158
  message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
158
159
  });
159
160
  }
160
- s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && o.addIssue({
161
+ s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
161
162
  code: d.ZodIssueCode.invalid_date,
162
163
  message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
163
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && o.addIssue({
164
+ }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
164
165
  code: d.ZodIssueCode.invalid_date,
165
166
  message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
166
167
  });
167
168
  } else {
168
- const c = g(u, a, /* @__PURE__ */ new Date());
169
- T(c) || o.addIssue({
169
+ const c = g(u, o, /* @__PURE__ */ new Date());
170
+ N(c) || a.addIssue({
170
171
  code: d.ZodIssueCode.invalid_date,
171
172
  message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
172
- }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && o.addIssue({
173
+ }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
173
174
  code: d.ZodIssueCode.invalid_date,
174
175
  message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
175
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && o.addIssue({
176
+ }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
176
177
  code: d.ZodIssueCode.invalid_date,
177
178
  message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
178
179
  });
@@ -180,44 +181,44 @@ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
180
181
  }
181
182
  }).optional();
182
183
  };
183
- function V(e) {
184
+ function H(e) {
184
185
  const { required: t = !0 } = e || {};
185
- return t ? h(e) : P(e);
186
+ return t ? V(e) : y(e);
186
187
  }
187
- const D = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/g, H = (e) => {
188
- const { message: t, regexp: a = D } = e || {};
189
- return d.string().min(1, (t == null ? void 0 : t.min) || r.EMAIL_NON_EMPTY()).regex(a, (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()).default("");
190
- }, y = (e) => {
191
- const { message: t, regexp: a = D } = e || {};
188
+ const M = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/g, U = (e) => {
189
+ const { message: t, regexp: o = M } = e || {};
190
+ return d.string().min(1, (t == null ? void 0 : t.min) || r.EMAIL_NON_EMPTY()).regex(o, (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()).default("");
191
+ }, Y = (e) => {
192
+ const { message: t, regexp: o = M } = e || {};
192
193
  return d.string().refine(
193
- (s) => _.isStringEmpty(s) ? !0 : a.test(s),
194
+ (s) => _.isStringEmpty(s) ? !0 : o.test(s),
194
195
  {
195
196
  message: (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()
196
197
  }
197
198
  ).optional().transform((s) => (s == null ? void 0 : s.length) === 0 ? void 0 : s);
198
199
  };
199
- function Y(e) {
200
+ function F(e) {
200
201
  const { required: t = !0 } = e || {};
201
- return t ? H(e) : y(e);
202
+ return t ? U(e) : Y(e);
202
203
  }
203
- const M = (e) => {
204
- const { min: t, max: a, message: s } = e || {};
204
+ const O = (e) => {
205
+ const { min: t, max: o, message: s } = e || {};
205
206
  let i = d.coerce.number();
206
- return t && (i = i.min(t, (s == null ? void 0 : s.min) || r.MIN_VALUE(t))), a && (i = i.max(a, (s == null ? void 0 : s.min) || r.MAX_VALUE(a))), i.default(0);
207
- }, F = (e) => M(e).optional().transform((t) => t || void 0);
208
- function U(e) {
207
+ return t && (i = i.min(t, (s == null ? void 0 : s.min) || r.MIN_VALUE(t))), o && (i = i.max(o, (s == null ? void 0 : s.min) || r.MAX_VALUE(o))), i.default(0);
208
+ }, G = (e) => O(e).optional().transform((t) => t || void 0);
209
+ function w(e) {
209
210
  const { required: t = !0 } = e || {};
210
- return t ? M(e) : F(e);
211
+ return t ? O(e) : G(e);
211
212
  }
212
- const G = (e) => {
213
- const { ignoreMask: t = !0, maskSymbols: a = /[()+_ -]/g, message: s } = e || {};
213
+ const X = (e) => {
214
+ const { ignoreMask: t = !0, maskSymbols: o = /[()+_ -]/g, message: s } = e || {};
214
215
  let i = d.string().superRefine((n, u) => {
215
- const o = n.replace(a, ""), l = o.charAt(1);
216
+ const a = n.replace(o, ""), l = a.charAt(1);
216
217
  ["3", "4", "5", "6", "7", "9"].includes(l) || u.addIssue({
217
218
  code: d.ZodIssueCode.invalid_string,
218
219
  validation: "regex",
219
220
  message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
220
- }), o.length < 11 && u.addIssue({
221
+ }), a.length < 11 && u.addIssue({
221
222
  code: d.ZodIssueCode.too_small,
222
223
  minimum: 11,
223
224
  inclusive: !0,
@@ -225,16 +226,16 @@ const G = (e) => {
225
226
  message: (s == null ? void 0 : s.min) || r.PHONE_NON_EMPTY()
226
227
  });
227
228
  });
228
- return t && (i = i.transform((n) => n.replace(a, ""))), i.default("");
229
- }, X = (e) => {
230
- const { ignoreMask: t = !0, maskSymbols: a = /[()+_ -]/g, message: s } = e || {};
229
+ return t && (i = i.transform((n) => n.replace(o, ""))), i.default("");
230
+ }, $ = (e) => {
231
+ const { ignoreMask: t = !0, maskSymbols: o = /[()+_ -]/g, message: s } = e || {};
231
232
  let i = d.string().superRefine((n, u) => {
232
- const o = n.replace(a, ""), l = o.charAt(1);
233
+ const a = n.replace(o, ""), l = a.charAt(1);
233
234
  ["3", "4", "5", "6", "7", "9"].includes(l) || u.addIssue({
234
235
  code: d.ZodIssueCode.invalid_string,
235
236
  validation: "regex",
236
237
  message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
237
- }), o.length < 11 && u.addIssue({
238
+ }), a.length < 11 && u.addIssue({
238
239
  code: d.ZodIssueCode.too_small,
239
240
  minimum: 11,
240
241
  inclusive: !0,
@@ -242,66 +243,78 @@ const G = (e) => {
242
243
  message: (s == null ? void 0 : s.min) || r.PHONE_NON_EMPTY()
243
244
  });
244
245
  });
245
- return t && (i = i.transform((n) => n.replace(a, ""))), i.transform((n) => n || void 0);
246
+ return t && (i = i.transform((n) => n.replace(o, ""))), i.transform((n) => n || void 0);
246
247
  };
247
- function $(e) {
248
+ function b(e) {
248
249
  const { required: t = !0 } = e || {};
249
- return t ? G(e) : X(e);
250
+ return t ? X(e) : $(e);
250
251
  }
251
- const b = (e) => {
252
+ const q = (e) => {
252
253
  var s, i;
253
- const { message: t } = e || {}, a = d.string().min(1, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).nullable().refine((n) => !!n, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).default(null);
254
+ const { message: t } = e || {}, o = d.string().min(1, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).nullable().refine((n) => !!n, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).default(null);
254
255
  if (e != null && e.multiple) {
255
- let n = d.array(a).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) || r.SELECT_MULTIPLE_MIN_LENGTH((e == null ? void 0 : e.minLength) || 0));
256
+ let n = d.array(o).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) || r.SELECT_MULTIPLE_MIN_LENGTH((e == null ? void 0 : e.minLength) || 0));
256
257
  return e != null && e.length ? n.length(e.length, ((s = e.message) == null ? void 0 : s.length) || r.SELECT_FIX_LENGTH(e.length)).default([]) : (e != null && e.maxLength && (n = n.max(
257
258
  e.maxLength,
258
259
  ((i = e.message) == null ? void 0 : i.maxLength) || r.SELECT_MULTIPLE_MAX_LENGTH(e.maxLength)
259
260
  )), n.default([]));
260
261
  }
261
- return a;
262
+ return o;
262
263
  };
263
- function w(e) {
264
+ function v(e) {
264
265
  const t = d.string().nullable().optional();
265
266
  return e != null && e.multiple ? d.array(t).optional() : t;
266
267
  }
267
- function v(e) {
268
+ function x(e) {
268
269
  const { required: t = !0 } = e || {};
269
- return t ? b(e) : w(e);
270
+ return t ? q(e) : v(e);
270
271
  }
271
- const q = (e) => {
272
- const { min: t, max: a, length: s, message: i } = e || {};
272
+ const z = (e) => {
273
+ const { min: t, max: o, length: s, message: i } = e || {};
273
274
  let n = d.string({ message: i == null ? void 0 : i.root });
274
- return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), a && (n = n.max(a, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(a) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.refine((u) => !!u.length, { message: (i == null ? void 0 : i.min) || r.NON_EMPTY() }).default("");
275
- }, z = (e) => {
276
- const { min: t, max: a, length: s, message: i } = e || {};
275
+ return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), o && (n = n.max(o, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(o) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.refine((u) => !!u.length, { message: (i == null ? void 0 : i.min) || r.NON_EMPTY() }).default("");
276
+ }, B = (e) => {
277
+ const { min: t, max: o, length: s, message: i } = e || {};
277
278
  let n = d.string({ message: i == null ? void 0 : i.root });
278
- return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), a && (n = n.max(a, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(a) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.optional().transform((u) => u != null && u.length ? u : void 0);
279
+ return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), o && (n = n.max(o, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(o) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.optional().transform((u) => u != null && u.length ? u : void 0);
279
280
  };
280
- function B(e) {
281
- const { required: t = !0, ...a } = e || {};
282
- return t ? q(a) : z(a);
281
+ function j(e) {
282
+ const { required: t = !0, ...o } = e || {};
283
+ return t ? z(o) : B(o);
283
284
  }
284
285
  const C = (e, t) => {
285
- const { message: a, ...s } = t || {}, [i, n, ...u] = e.map((l) => d.literal(l)), o = a ? typeof a == "function" ? a(e) : a : r.VALUE_OUT_OF_RANGE(e);
286
+ const { message: o, ...s } = t || {}, [i, n, ...u] = e.map((l) => d.literal(l)), a = o ? typeof o == "function" ? o(e) : o : r.VALUE_OUT_OF_RANGE(e);
286
287
  return d.union([i, n, ...u], {
287
- message: o,
288
+ message: a,
288
289
  ...s
289
290
  }).nullable().refine(Boolean, r.NON_EMPTY()).default(null);
290
- }, x = (e, t) => C(e, t).optional();
291
- function j(e, t) {
292
- const { required: a, ...s } = t || {};
293
- return a ? C(e, s) : x(e, s);
291
+ }, p = (e, t) => C(e, t).optional();
292
+ function W(e, t) {
293
+ const { required: o, ...s } = t || {};
294
+ return o ? C(e, s) : p(e, s);
295
+ }
296
+ const Z = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, k = (e) => {
297
+ const { message: t, regexp: o = Z } = e || {};
298
+ return D().min(1, (t == null ? void 0 : t.min) || r.NON_EMPTY()).regex(o, (t == null ? void 0 : t.invalid) || r.INVALID_URL()).default("");
299
+ }, K = (e) => {
300
+ const { message: t, regexp: o = Z } = e || {};
301
+ return D().refine((s) => _.isStringEmpty(s) ? !0 : o.test(s), (t == null ? void 0 : t.invalid) || r.INVALID_URL()).optional().transform((s) => s != null && s.length ? s : void 0);
302
+ };
303
+ function Q(e) {
304
+ const { required: t = !0 } = e || {};
305
+ return t ? k(e) : K(e);
294
306
  }
295
- const W = {
296
- getStringSchema: B,
297
- getEmailSchema: Y,
298
- getSelectSchema: v,
299
- getNumberSchema: U,
300
- getPhoneSchema: $,
301
- getDateSchema: V,
302
- getUnionSchema: j
307
+ const J = {
308
+ getStringSchema: j,
309
+ getEmailSchema: F,
310
+ getSelectSchema: x,
311
+ getNumberSchema: w,
312
+ getPhoneSchema: b,
313
+ getDateSchema: H,
314
+ getUnionSchema: W,
315
+ getUrlSchema: Q
303
316
  };
304
- class de {
317
+ class ce {
305
318
  /**
306
319
  * Функция для получения значения по умолчанию исходя из схемы
307
320
  * @param zodSchema схема формы
@@ -332,42 +345,42 @@ class de {
332
345
  * // }
333
346
  * // }
334
347
  */
335
- static getZodDefaults(t, a) {
336
- const { fillArrayWithValue: s } = a || {};
348
+ static getZodDefaults(t, o) {
349
+ const { fillArrayWithValue: s } = o || {};
337
350
  if (t instanceof d.ZodEffects)
338
- return t.innerType() instanceof d.ZodEffects ? this.getZodDefaults(t.innerType(), a) : this.getZodDefaults(d.ZodObject.create(t.innerType().shape), a);
339
- const i = (o) => {
351
+ return t.innerType() instanceof d.ZodEffects ? this.getZodDefaults(t.innerType(), o) : this.getZodDefaults(d.ZodObject.create(t.innerType().shape), o);
352
+ const i = (a) => {
340
353
  switch (!0) {
341
- case o instanceof d.ZodDefault:
342
- return o._def.defaultValue();
343
- case o instanceof d.ZodOptional:
354
+ case a instanceof d.ZodDefault:
355
+ return a._def.defaultValue();
356
+ case a instanceof d.ZodOptional:
344
357
  return;
345
- case o instanceof d.ZodNullable:
358
+ case a instanceof d.ZodNullable:
346
359
  return null;
347
- case o instanceof d.ZodArray:
348
- return s ? [i(o.element)] : [];
349
- case o instanceof d.ZodObject:
350
- return this.getZodDefaults(o, a);
351
- case o instanceof d.ZodUnion:
352
- return i(o._def.options[0]);
353
- case o instanceof d.ZodLiteral:
354
- return o._def.value;
355
- case o instanceof d.ZodEnum:
356
- return o._def.values[0];
357
- case o instanceof d.ZodString:
360
+ case a instanceof d.ZodArray:
361
+ return s ? [i(a.element)] : [];
362
+ case a instanceof d.ZodObject:
363
+ return this.getZodDefaults(a, o);
364
+ case a instanceof d.ZodUnion:
365
+ return i(a._def.options[0]);
366
+ case a instanceof d.ZodLiteral:
367
+ return a._def.value;
368
+ case a instanceof d.ZodEnum:
369
+ return a._def.values[0];
370
+ case a instanceof d.ZodString:
358
371
  return "";
359
- case o instanceof d.ZodNumber:
372
+ case a instanceof d.ZodNumber:
360
373
  return 0;
361
- case o instanceof d.ZodBoolean:
374
+ case a instanceof d.ZodBoolean:
362
375
  return !1;
363
- case !("innerType" in o._def):
376
+ case !("innerType" in a._def):
364
377
  return;
365
378
  default:
366
- return i(o._def.innerType);
379
+ return i(a._def.innerType);
367
380
  }
368
381
  }, n = {};
369
- return Object.entries(t.shape).map(([o, l]) => {
370
- n[o] = i(l);
382
+ return Object.entries(t.shape).map(([a, l]) => {
383
+ n[a] = i(l);
371
384
  }), n;
372
385
  }
373
386
  }
@@ -383,59 +396,59 @@ const E = {
383
396
  ONLY_CYRILLIC: /[\u0400-\u04FF\u00CB\u00EB -]/g,
384
397
  CHECK_HYPHEN: /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/,
385
398
  PATRONYMIC: /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i
386
- }, k = (e) => {
387
- const [t, a, ...s] = e.trim().replace(/\s+/g, " ").split(" "), i = s.join(" ");
388
- return { surname: t, name: a, patronymic: i };
389
- }, O = (e) => {
390
- const { message: t } = e || {}, { nameOrSurnameEmpty: a, invalidSurname: s, invalidPatronymic: i, invalidName: n } = t || {};
391
- return d.string().superRefine((u, o) => {
392
- const { name: l, surname: m, patronymic: c } = k(u);
393
- f.ONLY_CYRILLIC.test(u) || o.addIssue({
399
+ }, ee = (e) => {
400
+ const [t, o, ...s] = e.trim().replace(/\s+/g, " ").split(" "), i = s.join(" ");
401
+ return { surname: t, name: o, patronymic: i };
402
+ }, R = (e) => {
403
+ const { message: t } = e || {}, { nameOrSurnameEmpty: o, invalidSurname: s, invalidPatronymic: i, invalidName: n } = t || {};
404
+ return d.string().superRefine((u, a) => {
405
+ const { name: l, surname: m, patronymic: c } = ee(u);
406
+ f.ONLY_CYRILLIC.test(u) || a.addIssue({
394
407
  code: d.ZodIssueCode.invalid_string,
395
408
  validation: "regex",
396
409
  message: E.ONLY_CYRILLIC()
397
- }), (!l || !m) && o.addIssue({
410
+ }), (!l || !m) && a.addIssue({
398
411
  code: d.ZodIssueCode.invalid_string,
399
412
  validation: "regex",
400
- message: a || E.NAME_OR_SURNAME_NON_EMPTY()
401
- }), f.CHECK_HYPHEN.test(l) || o.addIssue({
413
+ message: o || E.NAME_OR_SURNAME_NON_EMPTY()
414
+ }), f.CHECK_HYPHEN.test(l) || a.addIssue({
402
415
  code: d.ZodIssueCode.invalid_string,
403
416
  validation: "regex",
404
417
  message: n || E.INVALID_NAME()
405
- }), f.CHECK_HYPHEN.test(m) || o.addIssue({
418
+ }), f.CHECK_HYPHEN.test(m) || a.addIssue({
406
419
  code: d.ZodIssueCode.invalid_string,
407
420
  validation: "regex",
408
421
  message: s || E.INVALID_SURNAME()
409
- }), c && (f.PATRONYMIC.test(c) || o.addIssue({
422
+ }), c && (f.PATRONYMIC.test(c) || a.addIssue({
410
423
  code: d.ZodIssueCode.invalid_string,
411
424
  validation: "regex",
412
425
  message: i || E.INVALID_PATRONYMIC()
413
426
  }));
414
427
  }).transform((u) => u.trimEnd()).default("");
415
- }, K = (e) => O(e).optional().transform((t) => t != null && t.length ? t : void 0);
416
- function Q(e) {
417
- const { required: t = !0, ...a } = e || {};
418
- return t ? O(a) : K(a);
428
+ }, te = (e) => R(e).optional().transform((t) => t != null && t.length ? t : void 0);
429
+ function ne(e) {
430
+ const { required: t = !0, ...o } = e || {};
431
+ return t ? R(o) : te(o);
419
432
  }
420
- const J = {
421
- getFioSchema: Q
422
- }, ae = {
423
- base: W,
424
- dadata: J
433
+ const ie = {
434
+ getFioSchema: ne
435
+ }, le = {
436
+ base: J,
437
+ dadata: ie
425
438
  };
426
439
  export {
427
440
  A as RgxCheckForHyphen,
428
- S as RgxPatronymic,
429
- Z as RgxUnicode,
441
+ h as RgxPatronymic,
442
+ S as RgxUnicode,
430
443
  I as VALIDATION_MESSAGES,
431
- de as ZodUtils,
444
+ ce as ZodUtils,
432
445
  r as baseDefaultMessages,
433
- W as baseValidationSchemas,
434
- R as formattedDadataFio,
435
- ne as zodCalendarValidate,
436
- te as zodDadataFioSchema,
437
- se as zodOtpCodeSchema,
438
- ie as zodPhoneSchema,
439
- ae as zodValidators
446
+ J as baseValidationSchemas,
447
+ P as formattedDadataFio,
448
+ ae as zodCalendarValidate,
449
+ oe as zodDadataFioSchema,
450
+ ue as zodOtpCodeSchema,
451
+ re as zodPhoneSchema,
452
+ le as zodValidators
440
453
  };
441
454
  //# sourceMappingURL=validation.js.map