stone-kit 0.0.224 → 0.0.225
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
|
|
1
|
+
import { jsxs as i, Fragment as k, jsx as l } from "react/jsx-runtime";
|
|
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
|
-
import { NewIcon as
|
|
4
|
+
import { NewIcon as h } from "../../NewIcon/ui/NewIcon.js";
|
|
5
5
|
const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_selectedOptionsOpened_1o2mf_25", G = "_selectOptionsDisabled_1o2mf_29", H = "_optionsList_1o2mf_36", J = "_listRight_1o2mf_51", K = "_inputWrapper_1o2mf_55", M = "_option_1o2mf_36", P = "_icon_1o2mf_75", e = {
|
|
6
6
|
multiSelectWrapper: U,
|
|
7
7
|
selectedOptions: q,
|
|
@@ -18,24 +18,24 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
18
18
|
error: D,
|
|
19
19
|
disabled: v,
|
|
20
20
|
additionalClass: L = "",
|
|
21
|
+
additionalClassOption: x,
|
|
22
|
+
additionalClassBtn: E,
|
|
21
23
|
onChange: p,
|
|
22
24
|
onBlur: d,
|
|
23
25
|
selectedValues: n = [],
|
|
24
26
|
isBtn: S = !1,
|
|
25
|
-
btnName: w
|
|
26
|
-
|
|
27
|
-
widthOptionList: E,
|
|
28
|
-
isListRight: y = !1
|
|
27
|
+
btnName: w,
|
|
28
|
+
isListRight: z = !1
|
|
29
29
|
}) => {
|
|
30
|
-
const [s, b] = N(n), [r, m] = N(!1), f = W(null),
|
|
30
|
+
const [s, b] = N(n), [r, m] = N(!1), f = W(null), I = O(
|
|
31
31
|
(t) => () => {
|
|
32
|
-
const
|
|
33
|
-
b(
|
|
32
|
+
const c = s.some((_) => _.value === t.value) ? s.filter((_) => _.value !== t.value) : [...s, t];
|
|
33
|
+
b(c), p && p(c);
|
|
34
34
|
},
|
|
35
35
|
[s, p]
|
|
36
|
-
), u =
|
|
36
|
+
), u = O((t) => {
|
|
37
37
|
f.current && !f.current.contains(t.target) && m(!1);
|
|
38
|
-
}, []),
|
|
38
|
+
}, []), j = O(() => {
|
|
39
39
|
d && d(s);
|
|
40
40
|
}, [s, d]);
|
|
41
41
|
C(() => (document.addEventListener("click", u), () => {
|
|
@@ -44,18 +44,17 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
44
44
|
const g = W(n);
|
|
45
45
|
return C(() => {
|
|
46
46
|
n.length !== g.current.length && (b(n), g.current = n);
|
|
47
|
-
}, [n]), /* @__PURE__ */
|
|
47
|
+
}, [n]), /* @__PURE__ */ i(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
50
|
ref: f,
|
|
51
51
|
className: o(e.multiSelectWrapper, { [e.multiSelectWrapperError]: D }, L),
|
|
52
52
|
tabIndex: 0,
|
|
53
|
-
onBlur:
|
|
54
|
-
style: { width: x },
|
|
53
|
+
onBlur: j,
|
|
55
54
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
!S && /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ i("div", { className: o(e.inputWrapper), children: [
|
|
56
|
+
!S && /* @__PURE__ */ i(k, { children: [
|
|
57
|
+
/* @__PURE__ */ i(
|
|
59
58
|
"div",
|
|
60
59
|
{
|
|
61
60
|
className: o(e.selectedOptions, { [e.selectOptionsDisabled]: v }),
|
|
@@ -67,7 +66,7 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
67
66
|
}
|
|
68
67
|
),
|
|
69
68
|
/* @__PURE__ */ l(
|
|
70
|
-
|
|
69
|
+
h,
|
|
71
70
|
{
|
|
72
71
|
name: "arrowShort",
|
|
73
72
|
deg: r ? "180" : "0",
|
|
@@ -76,17 +75,17 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
76
75
|
}
|
|
77
76
|
)
|
|
78
77
|
] }),
|
|
79
|
-
S && /* @__PURE__ */
|
|
78
|
+
S && /* @__PURE__ */ i(k, { children: [
|
|
80
79
|
/* @__PURE__ */ l(
|
|
81
80
|
"button",
|
|
82
81
|
{
|
|
83
|
-
className: o(e.selectedOptions, { [e.selectOptionsDisabled]: v }),
|
|
82
|
+
className: o(e.selectedOptions, { [e.selectOptionsDisabled]: v }, E),
|
|
84
83
|
onClick: () => m(!r),
|
|
85
84
|
children: w
|
|
86
85
|
}
|
|
87
86
|
),
|
|
88
87
|
/* @__PURE__ */ l(
|
|
89
|
-
|
|
88
|
+
h,
|
|
90
89
|
{
|
|
91
90
|
name: "filter",
|
|
92
91
|
deg: r ? "180" : "0",
|
|
@@ -96,20 +95,20 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
96
95
|
)
|
|
97
96
|
] })
|
|
98
97
|
] }),
|
|
99
|
-
r && /* @__PURE__ */ l("div", { className: o(e.optionsList, { [e.listRight]:
|
|
98
|
+
r && /* @__PURE__ */ l("div", { className: o(e.optionsList, { [e.listRight]: z }, x), children: a == null ? void 0 : a.map((t) => /* @__PURE__ */ i(
|
|
100
99
|
"div",
|
|
101
100
|
{
|
|
102
101
|
className: o(e.option, {
|
|
103
|
-
[e.selected]: s.some((
|
|
102
|
+
[e.selected]: s.some((c) => c.value === t.value)
|
|
104
103
|
}),
|
|
105
|
-
onClick:
|
|
104
|
+
onClick: I(t),
|
|
106
105
|
children: [
|
|
107
106
|
/* @__PURE__ */ l("div", { children: t.label }),
|
|
108
107
|
/* @__PURE__ */ l(
|
|
109
|
-
|
|
108
|
+
h,
|
|
110
109
|
{
|
|
111
110
|
size: "20",
|
|
112
|
-
name: s.some((
|
|
111
|
+
name: s.some((c) => c.value === t.value) ? "selectChecked" : "selectUnchecked"
|
|
113
112
|
}
|
|
114
113
|
)
|
|
115
114
|
]
|
|
@@ -119,7 +118,7 @@ const U = "_multiSelectWrapper_1o2mf_1", q = "_selectedOptions_1o2mf_7", A = "_s
|
|
|
119
118
|
]
|
|
120
119
|
}
|
|
121
120
|
);
|
|
122
|
-
}, T =
|
|
121
|
+
}, T = y(Q);
|
|
123
122
|
T.displayName = "Select";
|
|
124
123
|
export {
|
|
125
124
|
T as Select
|
|
@@ -10,6 +10,8 @@ export interface MultiSelectProps {
|
|
|
10
10
|
error?: boolean;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
additionalClass?: string;
|
|
13
|
+
additionalClassOption?: string;
|
|
14
|
+
additionalClassBtn?: string;
|
|
13
15
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => unknown;
|
|
14
16
|
onBlur?: (e: ChangeEvent<HTMLInputElement>) => unknown;
|
|
15
17
|
selectedValues?: Option[];
|