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