stone-kit 0.0.228 → 0.0.229
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,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as r, Fragment as b, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { memo as y, useState as N, useRef as W, useCallback as O, useEffect as C } from "react";
|
|
3
3
|
import { c as F } from "../../../index-rKuIKazb.js";
|
|
4
4
|
import { NewIcon as h } from "../../NewIcon/ui/NewIcon.js";
|
|
@@ -12,7 +12,7 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
12
12
|
inputWrapper: K,
|
|
13
13
|
option: M,
|
|
14
14
|
icon: P
|
|
15
|
-
},
|
|
15
|
+
}, l = F.bind(e), Q = ({
|
|
16
16
|
options: a,
|
|
17
17
|
placeholder: R = "Выберите опции",
|
|
18
18
|
error: D,
|
|
@@ -22,15 +22,15 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
22
22
|
additionalClassBtn: E,
|
|
23
23
|
onChange: p,
|
|
24
24
|
onBlur: d,
|
|
25
|
-
selectedValues:
|
|
25
|
+
selectedValues: c = [],
|
|
26
26
|
isBtn: S = !1,
|
|
27
27
|
btnName: w,
|
|
28
28
|
isListRight: z = !1
|
|
29
29
|
}) => {
|
|
30
|
-
const [s,
|
|
30
|
+
const [s, g] = N(c), [o, m] = N(!1), f = W(null), I = O(
|
|
31
31
|
(t) => () => {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const i = s.some((_) => _.value === t.value) ? s.filter((_) => _.value !== t.value) : [...s, t];
|
|
33
|
+
g(i), p && p(i);
|
|
34
34
|
},
|
|
35
35
|
[s, p]
|
|
36
36
|
), u = O((t) => {
|
|
@@ -41,79 +41,80 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
41
41
|
C(() => (document.addEventListener("click", u), () => {
|
|
42
42
|
document.removeEventListener("click", u);
|
|
43
43
|
}), [u]);
|
|
44
|
-
const
|
|
44
|
+
const k = W(c);
|
|
45
45
|
return C(() => {
|
|
46
|
-
|
|
47
|
-
}, [
|
|
46
|
+
c.length !== k.current.length && (g(c), k.current = c);
|
|
47
|
+
}, [c]), /* @__PURE__ */ r(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
50
|
ref: f,
|
|
51
|
-
className:
|
|
51
|
+
className: l(e.multiSelectWrapper, { [e.multiSelectWrapperError]: D }, L),
|
|
52
52
|
tabIndex: 0,
|
|
53
53
|
onBlur: j,
|
|
54
54
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
!S && /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ r("div", { className: l(e.inputWrapper), children: [
|
|
56
|
+
!S && /* @__PURE__ */ r(b, { children: [
|
|
57
|
+
/* @__PURE__ */ n(
|
|
58
58
|
"div",
|
|
59
59
|
{
|
|
60
|
-
className:
|
|
61
|
-
onClick: () => m(!
|
|
62
|
-
children:
|
|
63
|
-
" ",
|
|
64
|
-
s.length === 0 ? R : "Выбрано " + s.length
|
|
65
|
-
]
|
|
60
|
+
className: l(e.selectedOptions, { [e.selectOptionsDisabled]: v }),
|
|
61
|
+
onClick: () => m(!o),
|
|
62
|
+
children: s.length === 0 ? R : "Выбрано " + s.length
|
|
66
63
|
}
|
|
67
64
|
),
|
|
68
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ n(
|
|
69
66
|
h,
|
|
70
67
|
{
|
|
71
68
|
name: "arrowShort",
|
|
72
|
-
deg:
|
|
69
|
+
deg: o ? "180" : "0",
|
|
73
70
|
size: "24",
|
|
74
71
|
additionalClass: e.icon
|
|
75
72
|
}
|
|
76
73
|
)
|
|
77
74
|
] }),
|
|
78
|
-
S && /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
75
|
+
S && /* @__PURE__ */ r(b, { children: [
|
|
76
|
+
/* @__PURE__ */ n(
|
|
80
77
|
"button",
|
|
81
78
|
{
|
|
82
|
-
className:
|
|
83
|
-
|
|
79
|
+
className: l(
|
|
80
|
+
e.selectedOptions,
|
|
81
|
+
{ [e.selectOptionsDisabled]: v },
|
|
82
|
+
E
|
|
83
|
+
),
|
|
84
|
+
onClick: () => m(!o),
|
|
84
85
|
children: w
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ n(
|
|
88
89
|
h,
|
|
89
90
|
{
|
|
90
91
|
name: "filter",
|
|
91
|
-
deg:
|
|
92
|
+
deg: o ? "180" : "0",
|
|
92
93
|
size: "24",
|
|
93
94
|
additionalClass: e.icon
|
|
94
95
|
}
|
|
95
96
|
)
|
|
96
97
|
] })
|
|
97
98
|
] }),
|
|
98
|
-
|
|
99
|
+
o && /* @__PURE__ */ n("div", { className: l(e.optionsList, { [e.listRight]: z }, x), children: a == null ? void 0 : a.map((t) => /* @__PURE__ */ r(
|
|
99
100
|
"div",
|
|
100
101
|
{
|
|
101
|
-
className:
|
|
102
|
-
[e.selected]: s.some((
|
|
102
|
+
className: l(e.option, {
|
|
103
|
+
[e.selected]: s.some((i) => i.value === t.value)
|
|
103
104
|
}),
|
|
104
105
|
onClick: I(t),
|
|
105
106
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ n("div", { children: t.label }),
|
|
108
|
+
/* @__PURE__ */ n(
|
|
108
109
|
h,
|
|
109
110
|
{
|
|
110
111
|
size: "20",
|
|
111
|
-
name: s.some((
|
|
112
|
+
name: s.some((i) => i.value === t.value) ? "selectChecked" : "selectUnchecked"
|
|
112
113
|
}
|
|
113
114
|
)
|
|
114
115
|
]
|
|
115
116
|
},
|
|
116
|
-
t.
|
|
117
|
+
t.value
|
|
117
118
|
)) })
|
|
118
119
|
]
|
|
119
120
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
|
|
3
1
|
export interface Option {
|
|
4
2
|
value: string | number;
|
|
5
3
|
label: string;
|
|
@@ -12,8 +10,8 @@ export interface MultiSelectProps {
|
|
|
12
10
|
additionalClass?: string;
|
|
13
11
|
additionalClassOption?: string;
|
|
14
12
|
additionalClassBtn?: string;
|
|
15
|
-
onChange?: (
|
|
16
|
-
onBlur?: (
|
|
13
|
+
onChange?: (selectedOptions: Option[]) => unknown;
|
|
14
|
+
onBlur?: (selectedOptions: Option[]) => unknown;
|
|
17
15
|
selectedValues?: Option[];
|
|
18
16
|
isBtn?: boolean;
|
|
19
17
|
btnName?: string;
|