stone-kit 0.0.121 → 0.0.122
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,95 +1,97 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsxs as u, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { memo as E, useState as f, useRef as S, useCallback as v, useEffect as b } from "react";
|
|
3
3
|
import { c as w } from "../../../index-DIxK0V-G.js";
|
|
4
|
-
import { NewIcon as
|
|
5
|
-
const y = "_multiSelectWrapper_1hlrv_1", I = "_selectedOptions_1hlrv_7",
|
|
4
|
+
import { NewIcon as k } from "../../NewIcon/ui/NewIcon.js";
|
|
5
|
+
const y = "_multiSelectWrapper_1hlrv_1", I = "_selectedOptions_1hlrv_7", R = "_selectedOptionsOpened_1hlrv_28", j = "_selectOptionsDisabled_1hlrv_32", z = "_optionsList_1hlrv_39", U = "_inputWrapper_1hlrv_54", q = "_option_1hlrv_39", A = "_icon_1hlrv_76", s = {
|
|
6
6
|
multiSelectWrapper: y,
|
|
7
7
|
selectedOptions: I,
|
|
8
|
-
selectedOptionsOpened:
|
|
8
|
+
selectedOptionsOpened: R,
|
|
9
9
|
selectOptionsDisabled: j,
|
|
10
10
|
optionsList: z,
|
|
11
|
-
inputWrapper:
|
|
12
|
-
option:
|
|
13
|
-
icon:
|
|
14
|
-
},
|
|
15
|
-
options:
|
|
16
|
-
placeholder:
|
|
17
|
-
error:
|
|
18
|
-
disabled:
|
|
19
|
-
additionalClass:
|
|
20
|
-
onChange:
|
|
21
|
-
onBlur:
|
|
22
|
-
selectedValues:
|
|
11
|
+
inputWrapper: U,
|
|
12
|
+
option: q,
|
|
13
|
+
icon: A
|
|
14
|
+
}, i = w.bind(s), B = ({
|
|
15
|
+
options: W,
|
|
16
|
+
placeholder: N = "Выберите опции",
|
|
17
|
+
error: x,
|
|
18
|
+
disabled: C,
|
|
19
|
+
additionalClass: L = "",
|
|
20
|
+
onChange: o,
|
|
21
|
+
onBlur: r,
|
|
22
|
+
selectedValues: n = []
|
|
23
23
|
}) => {
|
|
24
|
-
const [t, _] =
|
|
24
|
+
const [t, _] = f(n), [p, h] = f(!1), a = S(null), D = v(
|
|
25
25
|
(e) => () => {
|
|
26
|
-
const
|
|
27
|
-
_(
|
|
26
|
+
const l = t.some((m) => m.value === e.value) ? t.filter((m) => m.value !== e.value) : [...t, e];
|
|
27
|
+
_(l), o && o(l);
|
|
28
28
|
},
|
|
29
|
-
[t,
|
|
29
|
+
[t, o]
|
|
30
30
|
), d = v((e) => {
|
|
31
|
-
|
|
32
|
-
}, []),
|
|
33
|
-
|
|
34
|
-
}, [t,
|
|
35
|
-
|
|
31
|
+
a.current && !a.current.contains(e.target) && h(!1);
|
|
32
|
+
}, []), g = v(() => {
|
|
33
|
+
r && r(t);
|
|
34
|
+
}, [t, r]);
|
|
35
|
+
b(() => (document.addEventListener("click", d), () => {
|
|
36
36
|
document.removeEventListener("click", d);
|
|
37
|
-
}), [d])
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
}), [d]);
|
|
38
|
+
const O = S(n);
|
|
39
|
+
return b(() => {
|
|
40
|
+
n.length !== O.current.length && (_(n), O.current = n);
|
|
41
|
+
}, [n]), /* @__PURE__ */ u(
|
|
40
42
|
"div",
|
|
41
43
|
{
|
|
42
|
-
ref:
|
|
43
|
-
className:
|
|
44
|
+
ref: a,
|
|
45
|
+
className: i(s.multiSelectWrapper, { [s.multiSelectWrapperError]: x }, L),
|
|
44
46
|
tabIndex: 0,
|
|
45
|
-
onBlur:
|
|
47
|
+
onBlur: g,
|
|
46
48
|
children: [
|
|
47
|
-
/* @__PURE__ */ u("div", { className:
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ u("div", { className: i(s.inputWrapper), children: [
|
|
50
|
+
/* @__PURE__ */ c(
|
|
49
51
|
"input",
|
|
50
52
|
{
|
|
51
53
|
type: "text",
|
|
52
54
|
readOnly: !0,
|
|
53
|
-
value: t.length === 0 ?
|
|
54
|
-
className:
|
|
55
|
-
onClick: () =>
|
|
55
|
+
value: t.length === 0 ? N : "Выбрано " + t.length + " опции",
|
|
56
|
+
className: i(s.selectedOptions, { [s.selectOptionsDisabled]: C }),
|
|
57
|
+
onClick: () => h(!p)
|
|
56
58
|
}
|
|
57
59
|
),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
60
|
+
/* @__PURE__ */ c(
|
|
61
|
+
k,
|
|
60
62
|
{
|
|
61
63
|
name: "arrowShort",
|
|
62
|
-
deg:
|
|
64
|
+
deg: p ? "180" : "0",
|
|
63
65
|
size: "24",
|
|
64
66
|
additionalClass: s.icon
|
|
65
67
|
}
|
|
66
68
|
)
|
|
67
69
|
] }),
|
|
68
|
-
|
|
70
|
+
p && /* @__PURE__ */ c("div", { className: s.optionsList, children: W.map((e) => /* @__PURE__ */ u(
|
|
69
71
|
"div",
|
|
70
72
|
{
|
|
71
|
-
className:
|
|
72
|
-
[s.selected]: t.some((
|
|
73
|
+
className: i(s.option, {
|
|
74
|
+
[s.selected]: t.some((l) => l.value === e.value)
|
|
73
75
|
}),
|
|
74
|
-
onClick:
|
|
76
|
+
onClick: D(e),
|
|
75
77
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
78
|
+
/* @__PURE__ */ c("div", { children: e.label }),
|
|
79
|
+
/* @__PURE__ */ c(
|
|
80
|
+
k,
|
|
79
81
|
{
|
|
80
82
|
size: "20",
|
|
81
|
-
name: t.some((
|
|
83
|
+
name: t.some((l) => l.value === e.value) ? "selectChecked" : "selectUnchecked"
|
|
82
84
|
}
|
|
83
85
|
)
|
|
84
86
|
]
|
|
85
87
|
},
|
|
86
|
-
e.
|
|
88
|
+
e.label
|
|
87
89
|
)) })
|
|
88
90
|
]
|
|
89
91
|
}
|
|
90
92
|
);
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
+
}, F = E(B);
|
|
94
|
+
F.displayName = "Select";
|
|
93
95
|
export {
|
|
94
|
-
|
|
96
|
+
F as Select
|
|
95
97
|
};
|