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