stone-kit 0.0.243 → 0.0.245
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.
|
@@ -9,18 +9,19 @@ import { NewIcon as At } from "../../NewIcon/ui/NewIcon.js";
|
|
|
9
9
|
import { phoneReg as wt, nameReg as pt, emailReg as Dt } from "../utils/reg.js";
|
|
10
10
|
import { CheckBox as Ge } from "../../CheckBox/CheckBox.js";
|
|
11
11
|
import { TextArea as kt } from "../../TextArea/TextArea.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
import { useClientWidth as St } from "../../../shared/useClientWidth.js";
|
|
13
|
+
const Et = "_btn_q5rib_1", Ct = "_modal_q5rib_9", Bt = "_modalBody_q5rib_16", Tt = "_root_q5rib_21", Rt = "_title_q5rib_31", Lt = "_description_q5rib_38", Mt = "_inputWrapper_q5rib_45", ee = {
|
|
14
|
+
btn: Et,
|
|
15
|
+
modal: Ct,
|
|
16
|
+
modalBody: Bt,
|
|
17
|
+
root: Tt,
|
|
18
|
+
title: Rt,
|
|
19
|
+
description: Lt,
|
|
20
|
+
inputWrapper: Mt
|
|
20
21
|
};
|
|
21
22
|
var ge = (e) => e.type === "checkbox", oe = (e) => e instanceof Date, T = (e) => e == null;
|
|
22
23
|
const at = (e) => typeof e == "object";
|
|
23
|
-
var E = (e) => !T(e) && !Array.isArray(e) && at(e) && !oe(e),
|
|
24
|
+
var E = (e) => !T(e) && !Array.isArray(e) && at(e) && !oe(e), Ot = (e) => E(e) && e.target ? ge(e.target) ? e.target.checked : e.target.value : e, Nt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ut = (e, s) => e.has(Nt(s)), qt = (e) => {
|
|
24
25
|
const s = e.constructor && e.constructor.prototype;
|
|
25
26
|
return E(s) && s.hasOwnProperty("isPrototypeOf");
|
|
26
27
|
}, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -32,7 +33,7 @@ function P(e) {
|
|
|
32
33
|
else if (e instanceof Set)
|
|
33
34
|
s = new Set(e);
|
|
34
35
|
else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r || E(e)))
|
|
35
|
-
if (s = r ? [] : {}, !r && !
|
|
36
|
+
if (s = r ? [] : {}, !r && !qt(e))
|
|
36
37
|
s = e;
|
|
37
38
|
else
|
|
38
39
|
for (const n in e)
|
|
@@ -82,7 +83,7 @@ const Je = {
|
|
|
82
83
|
validate: "validate"
|
|
83
84
|
};
|
|
84
85
|
W.createContext(null);
|
|
85
|
-
var
|
|
86
|
+
var It = (e, s, r, n = !0) => {
|
|
86
87
|
const u = {
|
|
87
88
|
defaultValues: s._defaultValues
|
|
88
89
|
};
|
|
@@ -94,12 +95,12 @@ var qt = (e, s, r, n = !0) => {
|
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
return u;
|
|
97
|
-
}, L = (e) => E(e) && !Object.keys(e).length,
|
|
98
|
+
}, L = (e) => E(e) && !Object.keys(e).length, Pt = (e, s, r, n) => {
|
|
98
99
|
r(e);
|
|
99
100
|
const { name: u, ...l } = e;
|
|
100
101
|
return L(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((y) => s[y] === j.all);
|
|
101
102
|
}, _e = (e) => Array.isArray(e) ? e : [e];
|
|
102
|
-
function
|
|
103
|
+
function Wt(e) {
|
|
103
104
|
const s = W.useRef(e);
|
|
104
105
|
s.current = e, W.useEffect(() => {
|
|
105
106
|
const r = !e.disabled && s.current.subject && s.current.subject.subscribe({
|
|
@@ -110,7 +111,7 @@ function Pt(e) {
|
|
|
110
111
|
};
|
|
111
112
|
}, [e.disabled]);
|
|
112
113
|
}
|
|
113
|
-
var J = (e) => typeof e == "string",
|
|
114
|
+
var J = (e) => typeof e == "string", Ht = (e, s, r, n, u) => J(e) ? (n && s.watch.add(e), d(r, e, u)) : Array.isArray(e) ? e.map((l) => (n && s.watch.add(l), d(r, l))) : (n && (s.watchAll = !0), r), zt = (e, s, r, n, u) => s ? {
|
|
114
115
|
...r[e],
|
|
115
116
|
types: {
|
|
116
117
|
...r[e] && r[e].types ? r[e].types : {},
|
|
@@ -139,7 +140,7 @@ const he = (e, s, r, n) => {
|
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
|
-
var
|
|
143
|
+
var $t = (e, s, r) => {
|
|
143
144
|
const n = _e(d(e, r));
|
|
144
145
|
return V(n, "root", s[r]), V(e, r, n), e;
|
|
145
146
|
}, Me = (e) => e.type === "file", re = (e) => typeof e == "function", be = (e) => {
|
|
@@ -190,7 +191,7 @@ var ue = (e) => E(e) && !xe(e) ? e : {
|
|
|
190
191
|
return {};
|
|
191
192
|
const O = y ? y[0] : l, B = (v) => {
|
|
192
193
|
n && O.reportValidity && (O.setCustomValidity(te(v) ? "" : v || ""), O.reportValidity());
|
|
193
|
-
}, A = {}, Y = Oe(l), ae = ge(l), Q = Y || ae, Z = (z || Me(l)) && w(l.value) && w(m) || be(l) && l.value === "" || m === "" || Array.isArray(m) && !m.length, R =
|
|
194
|
+
}, A = {}, Y = Oe(l), ae = ge(l), Q = Y || ae, Z = (z || Me(l)) && w(l.value) && w(m) || be(l) && l.value === "" || m === "" || Array.isArray(m) && !m.length, R = zt.bind(null, D, r, A), le = (v, b, k, C = X.maxLength, $ = X.minLength) => {
|
|
194
195
|
const I = v ? b : k;
|
|
195
196
|
A[D] = {
|
|
196
197
|
type: v ? C : $,
|
|
@@ -265,22 +266,22 @@ var ue = (e) => E(e) && !xe(e) ? e : {
|
|
|
265
266
|
}
|
|
266
267
|
return B(!0), A;
|
|
267
268
|
};
|
|
268
|
-
function
|
|
269
|
+
function jt(e, s) {
|
|
269
270
|
const r = s.slice(0, -1).length;
|
|
270
271
|
let n = 0;
|
|
271
272
|
for (; n < r; )
|
|
272
273
|
e = w(e) ? n++ : e[s[n++]];
|
|
273
274
|
return e;
|
|
274
275
|
}
|
|
275
|
-
function
|
|
276
|
+
function Kt(e) {
|
|
276
277
|
for (const s in e)
|
|
277
278
|
if (e.hasOwnProperty(s) && !w(e[s]))
|
|
278
279
|
return !1;
|
|
279
280
|
return !0;
|
|
280
281
|
}
|
|
281
282
|
function S(e, s) {
|
|
282
|
-
const r = Array.isArray(s) ? s : Le(s) ? [s] : lt(s), n = r.length === 1 ? e :
|
|
283
|
-
return n && delete n[l], u !== 0 && (E(n) && L(n) || Array.isArray(n) &&
|
|
283
|
+
const r = Array.isArray(s) ? s : Le(s) ? [s] : lt(s), n = r.length === 1 ? e : jt(e, r), u = r.length - 1, l = r[u];
|
|
284
|
+
return n && delete n[l], u !== 0 && (E(n) && L(n) || Array.isArray(n) && Kt(n)) && S(e, r.slice(0, -1)), e;
|
|
284
285
|
}
|
|
285
286
|
var Ce = () => {
|
|
286
287
|
let e = [];
|
|
@@ -322,7 +323,7 @@ function se(e, s) {
|
|
|
322
323
|
}
|
|
323
324
|
return !0;
|
|
324
325
|
}
|
|
325
|
-
var ot = (e) => e.type === "select-multiple",
|
|
326
|
+
var ot = (e) => e.type === "select-multiple", Gt = (e) => Oe(e) || ge(e), Be = (e) => be(e) && e.isConnected, ct = (e) => {
|
|
326
327
|
for (const s in e)
|
|
327
328
|
if (re(e[s]))
|
|
328
329
|
return !0;
|
|
@@ -348,7 +349,7 @@ function Te(e) {
|
|
|
348
349
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : s.disabled))
|
|
349
350
|
return Me(s) ? s.files : Oe(s) ? ut(e.refs).value : ot(s) ? [...s.selectedOptions].map(({ value: r }) => r) : ge(s) ? nt(e.refs).value : dt(w(s.value) ? e.ref.value : s.value, e);
|
|
350
351
|
}
|
|
351
|
-
var
|
|
352
|
+
var Jt = (e, s, r, n) => {
|
|
352
353
|
const u = {};
|
|
353
354
|
for (const l of e) {
|
|
354
355
|
const y = d(s, l);
|
|
@@ -360,7 +361,7 @@ var Gt = (e, s, r, n) => {
|
|
|
360
361
|
fields: u,
|
|
361
362
|
shouldUseNativeValidation: n
|
|
362
363
|
};
|
|
363
|
-
}, ye = (e) => w(e) ? e : xe(e) ? e.source : E(e) ? xe(e.value) ? e.value.source : e.value : e,
|
|
364
|
+
}, ye = (e) => w(e) ? e : xe(e) ? e.source : E(e) ? xe(e.value) ? e.value.source : e.value : e, Qt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
364
365
|
function st(e, s, r) {
|
|
365
366
|
const n = d(e, r);
|
|
366
367
|
if (n || Le(r))
|
|
@@ -384,15 +385,15 @@ function st(e, s, r) {
|
|
|
384
385
|
name: r
|
|
385
386
|
};
|
|
386
387
|
}
|
|
387
|
-
var
|
|
388
|
-
const
|
|
388
|
+
var Xt = (e, s, r, n, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? n.isOnBlur : u.isOnBlur) ? !e : (r ? n.isOnChange : u.isOnChange) ? e : !0, Yt = (e, s) => !Ae(d(e, s)).length && S(e, s);
|
|
389
|
+
const Zt = {
|
|
389
390
|
mode: j.onSubmit,
|
|
390
391
|
reValidateMode: j.onChange,
|
|
391
392
|
shouldFocusError: !0
|
|
392
393
|
};
|
|
393
|
-
function
|
|
394
|
+
function er(e = {}) {
|
|
394
395
|
let s = {
|
|
395
|
-
...
|
|
396
|
+
...Zt,
|
|
396
397
|
...e
|
|
397
398
|
}, r = {
|
|
398
399
|
submitCount: 0,
|
|
@@ -454,7 +455,7 @@ function Zt(e = {}) {
|
|
|
454
455
|
}
|
|
455
456
|
if (o && Array.isArray(d(r.errors, t))) {
|
|
456
457
|
const h = a(d(r.errors, t), f.argA, f.argB);
|
|
457
|
-
c && V(r.errors, t, h),
|
|
458
|
+
c && V(r.errors, t, h), Yt(r.errors, t);
|
|
458
459
|
}
|
|
459
460
|
if (F.touchedFields && o && Array.isArray(d(r.touchedFields, t))) {
|
|
460
461
|
const h = a(d(r.touchedFields, t), f.argA, f.argB);
|
|
@@ -515,7 +516,7 @@ function Zt(e = {}) {
|
|
|
515
516
|
}
|
|
516
517
|
}, Q = async (t) => {
|
|
517
518
|
G(t, !0);
|
|
518
|
-
const i = await s.resolver(l, s.context,
|
|
519
|
+
const i = await s.resolver(l, s.context, Jt(t || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
|
|
519
520
|
return G(t), i;
|
|
520
521
|
}, Z = async (t) => {
|
|
521
522
|
const { errors: i } = await Q(t);
|
|
@@ -540,7 +541,7 @@ function Zt(e = {}) {
|
|
|
540
541
|
const p = await rt(c, l, D, s.shouldUseNativeValidation && !i, x);
|
|
541
542
|
if (G([f]), p[o.name] && (a.valid = !1, i))
|
|
542
543
|
break;
|
|
543
|
-
!i && (d(p, o.name) ? x ?
|
|
544
|
+
!i && (d(p, o.name) ? x ? $t(r.errors, p, o.name) : V(r.errors, o.name, p[o.name]) : S(r.errors, o.name));
|
|
544
545
|
}
|
|
545
546
|
!L(h) && await R(h, i, a);
|
|
546
547
|
}
|
|
@@ -552,7 +553,7 @@ function Zt(e = {}) {
|
|
|
552
553
|
i && (i._f.refs ? i._f.refs.every((a) => !Be(a)) : !Be(i._f.ref)) && we(t);
|
|
553
554
|
}
|
|
554
555
|
g.unMount = /* @__PURE__ */ new Set();
|
|
555
|
-
}, v = (t, i) => (t && i && V(l, t, i), !se(Ne(), u)), b = (t, i, a) =>
|
|
556
|
+
}, v = (t, i) => (t && i && V(l, t, i), !se(Ne(), u)), b = (t, i, a) => Ht(t, g, {
|
|
556
557
|
...y.mount ? l : w(i) ? u : J(t) ? { [t]: i } : i
|
|
557
558
|
}, a, i), k = (t) => Ae(d(y.mount ? l : u, t, e.shouldUnregister ? d(u, t, []) : [])), C = (t, i, a = {}) => {
|
|
558
559
|
const f = d(n, t);
|
|
@@ -587,12 +588,12 @@ function Zt(e = {}) {
|
|
|
587
588
|
y.mount = !0;
|
|
588
589
|
const i = t.target;
|
|
589
590
|
let a = i.name, f = !0;
|
|
590
|
-
const c = d(n, a), o = () => i.type ? Te(c._f) :
|
|
591
|
+
const c = d(n, a), o = () => i.type ? Te(c._f) : Ot(t), h = (x) => {
|
|
591
592
|
f = Number.isNaN(x) || x === d(l, a, x);
|
|
592
593
|
};
|
|
593
594
|
if (c) {
|
|
594
595
|
let x, p;
|
|
595
|
-
const N = o(), ne = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, _t = !
|
|
596
|
+
const N = o(), ne = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, _t = !Qt(c._f) && !s.resolver && !d(r.errors, a) && !c._f.deps || Xt(ne, d(r.touchedFields, a), r.isSubmitted, H, ie), De = Xe(a, g, ne);
|
|
596
597
|
V(l, a, N), ne ? (c._f.onBlur && c._f.onBlur(t), M && M(0)) : c._f.onChange && c._f.onChange(t);
|
|
597
598
|
const ke = Y(a, N, ne, !1), mt = !L(ke) || De;
|
|
598
599
|
if (!ne && _.values.next({
|
|
@@ -704,7 +705,7 @@ function Zt(e = {}) {
|
|
|
704
705
|
ref: (c) => {
|
|
705
706
|
if (c) {
|
|
706
707
|
pe(t, i), a = d(n, t);
|
|
707
|
-
const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h =
|
|
708
|
+
const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Gt(o), x = a._f.refs || [];
|
|
708
709
|
if (h ? x.find((p) => p === o) : o === a._f.ref)
|
|
709
710
|
return;
|
|
710
711
|
V(n, t, {
|
|
@@ -721,7 +722,7 @@ function Zt(e = {}) {
|
|
|
721
722
|
}
|
|
722
723
|
}), A(t, !1, void 0, o);
|
|
723
724
|
} else
|
|
724
|
-
a = d(n, t, {}), a._f && (a._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(
|
|
725
|
+
a = d(n, t, {}), a._f && (a._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Ut(g.array, t) && y.action) && g.unMount.add(t);
|
|
725
726
|
}
|
|
726
727
|
};
|
|
727
728
|
}, Pe = () => s.shouldFocusError && he(n, fe, g.mount), gt = (t) => {
|
|
@@ -899,7 +900,7 @@ function Zt(e = {}) {
|
|
|
899
900
|
getFieldState: Ue
|
|
900
901
|
};
|
|
901
902
|
}
|
|
902
|
-
function
|
|
903
|
+
function tr(e = {}) {
|
|
903
904
|
const s = W.useRef(), r = W.useRef(), [n, u] = W.useState({
|
|
904
905
|
isDirty: !1,
|
|
905
906
|
isValidating: !1,
|
|
@@ -917,14 +918,14 @@ function er(e = {}) {
|
|
|
917
918
|
defaultValues: re(e.defaultValues) ? void 0 : e.defaultValues
|
|
918
919
|
});
|
|
919
920
|
s.current || (s.current = {
|
|
920
|
-
...
|
|
921
|
+
...er(e),
|
|
921
922
|
formState: n
|
|
922
923
|
});
|
|
923
924
|
const l = s.current.control;
|
|
924
|
-
return l._options = e,
|
|
925
|
+
return l._options = e, Wt({
|
|
925
926
|
subject: l._subjects.state,
|
|
926
927
|
next: (y) => {
|
|
927
|
-
|
|
928
|
+
Pt(y, l._proxyFormState, l._updateFormState) && u({ ...l._formState });
|
|
928
929
|
}
|
|
929
930
|
}), W.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), W.useEffect(() => {
|
|
930
931
|
if (l._proxyFormState.isDirty) {
|
|
@@ -943,11 +944,11 @@ function er(e = {}) {
|
|
|
943
944
|
e.shouldUnregister && l._subjects.values.next({
|
|
944
945
|
values: l._getWatch()
|
|
945
946
|
});
|
|
946
|
-
}, [e.shouldUnregister, l]), s.current.formState =
|
|
947
|
+
}, [e.shouldUnregister, l]), s.current.formState = It(n, l), s.current;
|
|
947
948
|
}
|
|
948
949
|
const it = `Я принимаю условия Политики обработки
|
|
949
950
|
и защиты персональных данных, даю согласия на обработку персональных
|
|
950
|
-
данных`,
|
|
951
|
+
данных`, _r = ({
|
|
951
952
|
isFormOpen: e,
|
|
952
953
|
setIsFormOpen: s,
|
|
953
954
|
title: r,
|
|
@@ -971,12 +972,12 @@ const it = `Я принимаю условия Политики обработк
|
|
|
971
972
|
reset: m,
|
|
972
973
|
watch: O,
|
|
973
974
|
formState: { errors: B }
|
|
974
|
-
} =
|
|
975
|
+
} = tr(), A = !!O("email"), { onChange: Y, onBlur: ae, ...Q } = z("phone", {
|
|
975
976
|
required: l || g ? !A : !0,
|
|
976
977
|
pattern: { value: wt, message: "" },
|
|
977
978
|
onBlur: () => G("phone")
|
|
978
|
-
}), Z = O("personalCheckBox"),
|
|
979
|
-
F(
|
|
979
|
+
}), { isMobile: Z } = St(), R = O("personalCheckBox"), le = O("advCheckBox"), v = (b) => {
|
|
980
|
+
F(b), m();
|
|
980
981
|
};
|
|
981
982
|
return /* @__PURE__ */ U(
|
|
982
983
|
Vt,
|
|
@@ -987,7 +988,7 @@ const it = `Я принимаю условия Политики обработк
|
|
|
987
988
|
opacity: 0.7,
|
|
988
989
|
isTransparentBack: !0,
|
|
989
990
|
additionalClassModalBody: ee.modalBody,
|
|
990
|
-
children: /* @__PURE__ */ Se("div", { className: ee.root, style: { width: _ }, children: [
|
|
991
|
+
children: /* @__PURE__ */ Se("div", { className: ee.root, style: { width: Z ? "100%" : _ }, children: [
|
|
991
992
|
/* @__PURE__ */ U("div", { className: ee.title, dangerouslySetInnerHTML: { __html: r ?? "Оставить обращение" } }),
|
|
992
993
|
/* @__PURE__ */ U(
|
|
993
994
|
"div",
|
|
@@ -996,7 +997,7 @@ const it = `Я принимаю условия Политики обработк
|
|
|
996
997
|
dangerouslySetInnerHTML: { __html: q ?? "Оставьте номер телефона для получения консультации" }
|
|
997
998
|
}
|
|
998
999
|
),
|
|
999
|
-
/* @__PURE__ */ Se("form", { onSubmit: K(
|
|
1000
|
+
/* @__PURE__ */ Se("form", { onSubmit: K(v), children: [
|
|
1000
1001
|
/* @__PURE__ */ Se(Ft, { className: ee.inputWrapper, children: [
|
|
1001
1002
|
/* @__PURE__ */ U(
|
|
1002
1003
|
Ee,
|
|
@@ -1044,7 +1045,10 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1044
1045
|
"data-testid": "modal_email",
|
|
1045
1046
|
...z(
|
|
1046
1047
|
"email",
|
|
1047
|
-
{
|
|
1048
|
+
{
|
|
1049
|
+
required: y || g ? A : !1,
|
|
1050
|
+
pattern: Dt
|
|
1051
|
+
}
|
|
1048
1052
|
),
|
|
1049
1053
|
error: !!B.email
|
|
1050
1054
|
}
|
|
@@ -1063,7 +1067,7 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1063
1067
|
Ge,
|
|
1064
1068
|
{
|
|
1065
1069
|
"data-testid": "modal_advCheckBox",
|
|
1066
|
-
isChecked:
|
|
1070
|
+
isChecked: le,
|
|
1067
1071
|
error: !!B.advCheckBox,
|
|
1068
1072
|
text: D.text,
|
|
1069
1073
|
...z("advCheckBox", { required: D == null ? void 0 : D.isRequired })
|
|
@@ -1073,7 +1077,7 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1073
1077
|
Ge,
|
|
1074
1078
|
{
|
|
1075
1079
|
"data-testid": "modal_personalCheckBox",
|
|
1076
|
-
isChecked:
|
|
1080
|
+
isChecked: R,
|
|
1077
1081
|
error: !!B.personalCheckBox,
|
|
1078
1082
|
text: H.text,
|
|
1079
1083
|
...z("personalCheckBox", { required: H.isRequired })
|
|
@@ -1118,5 +1122,5 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1118
1122
|
);
|
|
1119
1123
|
};
|
|
1120
1124
|
export {
|
|
1121
|
-
|
|
1125
|
+
_r as ModalForm
|
|
1122
1126
|
};
|