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