stone-kit 0.0.139 → 0.0.141
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as D, useState as
|
|
1
|
+
import { jsxs as _, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as D, useState as S, useRef as g, useCallback as O, useEffect as w } from "react";
|
|
3
3
|
import { c as E } from "../../../index-DIxK0V-G.js";
|
|
4
|
-
import { NewIcon as
|
|
4
|
+
import { NewIcon as b } from "../../NewIcon/ui/NewIcon.js";
|
|
5
5
|
const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_selectedOptionsOpened_100gw_28", j = "_selectOptionsDisabled_100gw_32", z = "_optionsList_100gw_39", U = "_inputWrapper_100gw_54", q = "_option_100gw_39", A = "_icon_100gw_76", s = {
|
|
6
6
|
multiSelectWrapper: y,
|
|
7
7
|
selectedOptions: I,
|
|
@@ -11,54 +11,54 @@ const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_s
|
|
|
11
11
|
inputWrapper: U,
|
|
12
12
|
option: q,
|
|
13
13
|
icon: A
|
|
14
|
-
},
|
|
15
|
-
options:
|
|
14
|
+
}, i = E.bind(s), B = ({
|
|
15
|
+
options: o,
|
|
16
16
|
placeholder: k = "Выберите опции",
|
|
17
17
|
error: W,
|
|
18
18
|
disabled: N,
|
|
19
19
|
additionalClass: x = "",
|
|
20
|
-
onChange:
|
|
21
|
-
onBlur:
|
|
20
|
+
onChange: r,
|
|
21
|
+
onBlur: a,
|
|
22
22
|
selectedValues: n = []
|
|
23
23
|
}) => {
|
|
24
|
-
const [t,
|
|
24
|
+
const [t, v] = S(n), [p, f] = S(!1), d = g(null), C = O(
|
|
25
25
|
(e) => () => {
|
|
26
|
-
const c = t.some((
|
|
27
|
-
|
|
26
|
+
const c = t.some((u) => u.value === e.value) ? t.filter((u) => u.value !== e.value) : [...t, e];
|
|
27
|
+
v(c), r && r(c);
|
|
28
28
|
},
|
|
29
|
-
[t,
|
|
30
|
-
),
|
|
31
|
-
|
|
32
|
-
}, []), L =
|
|
33
|
-
|
|
34
|
-
}, [t,
|
|
35
|
-
|
|
36
|
-
document.removeEventListener("click",
|
|
37
|
-
}), [
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
n.length !==
|
|
41
|
-
}, [n]), /* @__PURE__ */
|
|
29
|
+
[t, r]
|
|
30
|
+
), m = O((e) => {
|
|
31
|
+
d.current && !d.current.contains(e.target) && f(!1);
|
|
32
|
+
}, []), L = O(() => {
|
|
33
|
+
a && a(t);
|
|
34
|
+
}, [t, a]);
|
|
35
|
+
w(() => (document.addEventListener("click", m), () => {
|
|
36
|
+
document.removeEventListener("click", m);
|
|
37
|
+
}), [m]);
|
|
38
|
+
const h = g(n);
|
|
39
|
+
return w(() => {
|
|
40
|
+
n.length !== h.current.length && (v(n), h.current = n);
|
|
41
|
+
}, [n]), /* @__PURE__ */ _(
|
|
42
42
|
"div",
|
|
43
43
|
{
|
|
44
|
-
ref:
|
|
45
|
-
className:
|
|
44
|
+
ref: d,
|
|
45
|
+
className: i(s.multiSelectWrapper, { [s.multiSelectWrapperError]: W }, x),
|
|
46
46
|
tabIndex: 0,
|
|
47
47
|
onBlur: L,
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ _("div", { className: i(s.inputWrapper), children: [
|
|
50
|
+
/* @__PURE__ */ l(
|
|
51
51
|
"input",
|
|
52
52
|
{
|
|
53
53
|
type: "text",
|
|
54
54
|
readOnly: !0,
|
|
55
55
|
value: t.length === 0 ? k : "Выбрано " + t.length + " опции",
|
|
56
|
-
className:
|
|
57
|
-
onClick: () =>
|
|
56
|
+
className: i(s.selectedOptions, { [s.selectOptionsDisabled]: N }),
|
|
57
|
+
onClick: () => f(!p)
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
60
|
+
/* @__PURE__ */ l(
|
|
61
|
+
b,
|
|
62
62
|
{
|
|
63
63
|
name: "arrowShort",
|
|
64
64
|
deg: p ? "180" : "0",
|
|
@@ -67,17 +67,17 @@ const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_s
|
|
|
67
67
|
}
|
|
68
68
|
)
|
|
69
69
|
] }),
|
|
70
|
-
p && /* @__PURE__ */
|
|
70
|
+
p && /* @__PURE__ */ l("div", { className: s.optionsList, children: o == null ? void 0 : o.map((e) => /* @__PURE__ */ _(
|
|
71
71
|
"div",
|
|
72
72
|
{
|
|
73
|
-
className:
|
|
73
|
+
className: i(s.option, {
|
|
74
74
|
[s.selected]: t.some((c) => c.value === e.value)
|
|
75
75
|
}),
|
|
76
76
|
onClick: C(e),
|
|
77
77
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
78
|
+
/* @__PURE__ */ l("div", { children: e.label }),
|
|
79
|
+
/* @__PURE__ */ l(
|
|
80
|
+
b,
|
|
81
81
|
{
|
|
82
82
|
size: "20",
|
|
83
83
|
name: t.some((c) => c.value === e.value) ? "selectChecked" : "selectUnchecked"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useState as I, useRef as L, useEffect as W } from "react";
|
|
3
3
|
import { c as B } from "../../../index-DIxK0V-G.js";
|
|
4
4
|
import { s as e, u as E } from "../../../useSortSelect-Dy4WKDDY.js";
|
|
@@ -19,44 +19,44 @@ import "../../MetroTag/ui/MetroTag.js";
|
|
|
19
19
|
import "../../Select/ui/Select.js";
|
|
20
20
|
import { useClientWidth as w } from "../../../shared/useClientWidth.js";
|
|
21
21
|
const s = B.bind(e), D = ({
|
|
22
|
-
options:
|
|
22
|
+
options: r,
|
|
23
23
|
selectedOption: S,
|
|
24
24
|
placeholder: O = "",
|
|
25
25
|
error: h,
|
|
26
26
|
disabled: v,
|
|
27
27
|
additionalClass: N = "",
|
|
28
|
-
onChange:
|
|
28
|
+
onChange: a,
|
|
29
29
|
onBlur: b,
|
|
30
30
|
mini: x,
|
|
31
|
-
openOnTop:
|
|
31
|
+
openOnTop: m = !1
|
|
32
32
|
}) => {
|
|
33
|
-
const [
|
|
33
|
+
const [i, o] = I(!1), n = L(null), { isMobile: d, isDesktop: y } = w(), { handleBlur: k, getInputValue: C, getOption: p, handleDocumentClick: u } = E({
|
|
34
34
|
selectedOption: S,
|
|
35
|
-
setSelectedOption:
|
|
36
|
-
setIsOpen:
|
|
37
|
-
containerRef:
|
|
38
|
-
isOpen:
|
|
35
|
+
setSelectedOption: a,
|
|
36
|
+
setIsOpen: o,
|
|
37
|
+
containerRef: n,
|
|
38
|
+
isOpen: i,
|
|
39
39
|
isDesktop: y,
|
|
40
40
|
placeholder: O,
|
|
41
|
-
onChange:
|
|
41
|
+
onChange: a,
|
|
42
42
|
onBlur: b
|
|
43
43
|
});
|
|
44
44
|
return W(() => (document.addEventListener("click", u), () => {
|
|
45
45
|
document.removeEventListener("click", u);
|
|
46
|
-
}), []), /* @__PURE__ */
|
|
46
|
+
}), []), /* @__PURE__ */ l(
|
|
47
47
|
"div",
|
|
48
48
|
{
|
|
49
|
-
ref:
|
|
49
|
+
ref: n,
|
|
50
50
|
className: s(
|
|
51
51
|
e.sortSelectWrapper,
|
|
52
52
|
{ [e.sortSelectWrapperError]: h },
|
|
53
|
-
{ [e.sortSelectWrapperTop]:
|
|
53
|
+
{ [e.sortSelectWrapperTop]: m },
|
|
54
54
|
N
|
|
55
55
|
),
|
|
56
56
|
tabIndex: 0,
|
|
57
57
|
onBlur: k,
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ l("div", { className: s(e.inputWrapper), children: [
|
|
60
60
|
/* @__PURE__ */ t(
|
|
61
61
|
"input",
|
|
62
62
|
{
|
|
@@ -68,7 +68,7 @@ const s = B.bind(e), D = ({
|
|
|
68
68
|
{ [e.selectOptionsDisabled]: v },
|
|
69
69
|
{ [e.selectionOptionMini]: x }
|
|
70
70
|
),
|
|
71
|
-
onClick: () =>
|
|
71
|
+
onClick: () => o(!i)
|
|
72
72
|
}
|
|
73
73
|
),
|
|
74
74
|
/* @__PURE__ */ t(
|
|
@@ -80,17 +80,17 @@ const s = B.bind(e), D = ({
|
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
] }),
|
|
83
|
-
|
|
83
|
+
i && d && /* @__PURE__ */ l(
|
|
84
84
|
j,
|
|
85
85
|
{
|
|
86
|
-
isOpen:
|
|
87
|
-
emitIsOpen:
|
|
86
|
+
isOpen: i,
|
|
87
|
+
emitIsOpen: o,
|
|
88
88
|
additionalClassModalBody: e.modalAddBody,
|
|
89
89
|
createPortalObj: { domNode: document.querySelector("body") },
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ l("div", { className: e.mobileSortHeader, children: [
|
|
92
92
|
/* @__PURE__ */ t(M, { children: "Сортировка" }),
|
|
93
|
-
/* @__PURE__ */ t("div", { onClick: () =>
|
|
93
|
+
/* @__PURE__ */ t("div", { onClick: () => o(!1), children: /* @__PURE__ */ t(
|
|
94
94
|
f,
|
|
95
95
|
{
|
|
96
96
|
name: "close",
|
|
@@ -98,11 +98,11 @@ const s = B.bind(e), D = ({
|
|
|
98
98
|
}
|
|
99
99
|
) })
|
|
100
100
|
] }),
|
|
101
|
-
/* @__PURE__ */ t("div", { className: e.mobileOptionList, children:
|
|
101
|
+
/* @__PURE__ */ t("div", { className: e.mobileOptionList, children: r == null ? void 0 : r.map((c) => p(c)) })
|
|
102
102
|
]
|
|
103
103
|
}
|
|
104
104
|
),
|
|
105
|
-
|
|
105
|
+
i && !d && /* @__PURE__ */ t("div", { className: s(e.optionsList, { [e.optionListOnTop]: m }), children: r == null ? void 0 : r.map((c) => p(c)) })
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
);
|