stone-kit 0.0.474 → 0.0.475
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,135 +1,136 @@
|
|
|
1
|
-
import { jsxs as r, Fragment as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { c as
|
|
4
|
-
import { NewIcon as
|
|
5
|
-
const
|
|
6
|
-
multiSelectWrapper:
|
|
7
|
-
selectedOptions:
|
|
8
|
-
selectedOptionsBtn:
|
|
9
|
-
selectedOptionsOpened:
|
|
10
|
-
selectedOptionsNotEmpty:
|
|
11
|
-
selectOptionsDisabled:
|
|
12
|
-
optionsList:
|
|
13
|
-
listRight:
|
|
14
|
-
inputWrapper:
|
|
15
|
-
option:
|
|
16
|
-
optionDisabled:
|
|
17
|
-
optionClickable:
|
|
18
|
-
icon:
|
|
19
|
-
}, c =
|
|
1
|
+
import { jsxs as r, Fragment as D, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as U, useState as W, useRef as E, useCallback as h, useEffect as R } from "react";
|
|
3
|
+
import { c as $ } from "../../../index-rKuIKazb.js";
|
|
4
|
+
import { NewIcon as b } from "../../NewIcon/ui/NewIcon.js";
|
|
5
|
+
const q = "_multiSelectWrapper_11it8_1", A = "_selectedOptions_11it8_8", G = "_selectedOptionsBtn_11it8_27", H = "_selectedOptionsOpened_11it8_31", J = "_selectedOptionsNotEmpty_11it8_35", K = "_selectOptionsDisabled_11it8_40", M = "_optionsList_11it8_47", P = "_listRight_11it8_63", Q = "_inputWrapper_11it8_67", T = "_option_11it8_47", X = "_optionDisabled_11it8_88", Y = "_optionClickable_11it8_92", Z = "_icon_11it8_96", e = {
|
|
6
|
+
multiSelectWrapper: q,
|
|
7
|
+
selectedOptions: A,
|
|
8
|
+
selectedOptionsBtn: G,
|
|
9
|
+
selectedOptionsOpened: H,
|
|
10
|
+
selectedOptionsNotEmpty: J,
|
|
11
|
+
selectOptionsDisabled: K,
|
|
12
|
+
optionsList: M,
|
|
13
|
+
listRight: P,
|
|
14
|
+
inputWrapper: Q,
|
|
15
|
+
option: T,
|
|
16
|
+
optionDisabled: X,
|
|
17
|
+
optionClickable: Y,
|
|
18
|
+
icon: Z
|
|
19
|
+
}, c = $.bind(e), V = ({
|
|
20
20
|
options: p,
|
|
21
|
-
placeholder:
|
|
22
|
-
error:
|
|
23
|
-
disabled:
|
|
24
|
-
disabledOptions:
|
|
25
|
-
additionalClass:
|
|
26
|
-
additionalClassOption:
|
|
27
|
-
additionalClassBtn:
|
|
21
|
+
placeholder: L = "Выберите опции",
|
|
22
|
+
error: x,
|
|
23
|
+
disabled: g,
|
|
24
|
+
disabledOptions: k = [],
|
|
25
|
+
additionalClass: y = "",
|
|
26
|
+
additionalClassOption: w,
|
|
27
|
+
additionalClassBtn: j,
|
|
28
28
|
onChange: d,
|
|
29
29
|
onBlur: m,
|
|
30
30
|
selectedValues: l = [],
|
|
31
31
|
isBtn: _ = !1,
|
|
32
|
-
btnName:
|
|
33
|
-
clickableOptions:
|
|
34
|
-
isListRight:
|
|
32
|
+
btnName: B,
|
|
33
|
+
clickableOptions: N,
|
|
34
|
+
isListRight: z = !1,
|
|
35
|
+
sizeIcon: u
|
|
35
36
|
}) => {
|
|
36
|
-
const [s,
|
|
37
|
+
const [s, S] = W(l), [o, O] = W(!1), v = E(null), F = h(
|
|
37
38
|
(t) => () => {
|
|
38
|
-
if (
|
|
39
|
+
if (k.some((a) => a.value === t.value))
|
|
39
40
|
return;
|
|
40
41
|
const i = s.some((a) => a.value === t.value) ? s.filter((a) => a.value !== t.value) : [...s, t];
|
|
41
|
-
|
|
42
|
+
S(i), d && d(i);
|
|
42
43
|
},
|
|
43
44
|
[s, d]
|
|
44
|
-
),
|
|
45
|
-
if (
|
|
45
|
+
), f = h((t) => {
|
|
46
|
+
if (v.current && !v.current.contains(t.target)) {
|
|
46
47
|
if (t.target.closest("svg"))
|
|
47
48
|
return;
|
|
48
|
-
|
|
49
|
+
O(!1);
|
|
49
50
|
}
|
|
50
|
-
}, []),
|
|
51
|
+
}, []), I = h(() => {
|
|
51
52
|
m && m(s);
|
|
52
53
|
}, [s, m]);
|
|
53
|
-
|
|
54
|
-
document.removeEventListener("click",
|
|
55
|
-
}), [
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
l.length !==
|
|
54
|
+
R(() => (document.addEventListener("click", f), () => {
|
|
55
|
+
document.removeEventListener("click", f);
|
|
56
|
+
}), [f]);
|
|
57
|
+
const C = E(l);
|
|
58
|
+
return R(() => {
|
|
59
|
+
l.length !== C.current.length && (S(l), C.current = l);
|
|
59
60
|
}, [l]), /* @__PURE__ */ r(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
|
-
ref:
|
|
63
|
-
className: c(e.multiSelectWrapper, { [e.multiSelectWrapperError]:
|
|
63
|
+
ref: v,
|
|
64
|
+
className: c(e.multiSelectWrapper, { [e.multiSelectWrapperError]: x }, y),
|
|
64
65
|
tabIndex: 0,
|
|
65
|
-
onBlur:
|
|
66
|
+
onBlur: I,
|
|
66
67
|
children: [
|
|
67
68
|
/* @__PURE__ */ r("div", { className: c(e.inputWrapper), children: [
|
|
68
|
-
!_ && /* @__PURE__ */ r(
|
|
69
|
+
!_ && /* @__PURE__ */ r(D, { children: [
|
|
69
70
|
/* @__PURE__ */ n(
|
|
70
71
|
"div",
|
|
71
72
|
{
|
|
72
73
|
className: c(
|
|
73
74
|
e.selectedOptions,
|
|
74
75
|
{ [e.selectedOptionsNotEmpty]: s.length > 0 },
|
|
75
|
-
{ [e.selectOptionsDisabled]:
|
|
76
|
+
{ [e.selectOptionsDisabled]: g }
|
|
76
77
|
),
|
|
77
|
-
onClick: () =>
|
|
78
|
-
children: s.length === 0 ?
|
|
78
|
+
onClick: () => O(!o),
|
|
79
|
+
children: s.length === 0 ? L : "Выбрано " + s.length
|
|
79
80
|
}
|
|
80
81
|
),
|
|
81
82
|
/* @__PURE__ */ n(
|
|
82
|
-
|
|
83
|
+
b,
|
|
83
84
|
{
|
|
84
85
|
name: "arrowShort",
|
|
85
86
|
deg: o ? "180" : "0",
|
|
86
|
-
size: "24",
|
|
87
|
+
size: u ?? "24",
|
|
87
88
|
additionalClass: e.icon
|
|
88
89
|
}
|
|
89
90
|
)
|
|
90
91
|
] }),
|
|
91
|
-
_ && /* @__PURE__ */ r(
|
|
92
|
+
_ && /* @__PURE__ */ r(D, { children: [
|
|
92
93
|
/* @__PURE__ */ n(
|
|
93
94
|
"button",
|
|
94
95
|
{
|
|
95
96
|
className: c(
|
|
96
97
|
e.selectedOptions,
|
|
97
98
|
e.selectedOptionsBtn,
|
|
98
|
-
{ [e.selectOptionsDisabled]:
|
|
99
|
-
|
|
99
|
+
{ [e.selectOptionsDisabled]: g },
|
|
100
|
+
j
|
|
100
101
|
),
|
|
101
|
-
onClick: () =>
|
|
102
|
-
children:
|
|
102
|
+
onClick: () => O(!o),
|
|
103
|
+
children: B
|
|
103
104
|
}
|
|
104
105
|
),
|
|
105
106
|
/* @__PURE__ */ n(
|
|
106
|
-
|
|
107
|
+
b,
|
|
107
108
|
{
|
|
108
109
|
name: "filter",
|
|
109
110
|
deg: o ? "180" : "0",
|
|
110
|
-
size: "24",
|
|
111
|
+
size: u ?? "24",
|
|
111
112
|
additionalClass: e.icon
|
|
112
113
|
}
|
|
113
114
|
)
|
|
114
115
|
] })
|
|
115
116
|
] }),
|
|
116
|
-
o && /* @__PURE__ */ n("div", { className: c(e.optionsList, { [e.listRight]:
|
|
117
|
+
o && /* @__PURE__ */ n("div", { className: c(e.optionsList, { [e.listRight]: z }, w), children: p == null ? void 0 : p.map((t) => /* @__PURE__ */ r(
|
|
117
118
|
"div",
|
|
118
119
|
{
|
|
119
120
|
className: c(e.option, {
|
|
120
121
|
[e.selected]: s.some((i) => i.value === t.value),
|
|
121
|
-
[e.optionDisabled]:
|
|
122
|
+
[e.optionDisabled]: k.some(
|
|
122
123
|
(i) => i.value === t.value
|
|
123
124
|
),
|
|
124
|
-
[e.optionClickable]:
|
|
125
|
+
[e.optionClickable]: N && N.includes(`${t.value}`) || _
|
|
125
126
|
}),
|
|
126
|
-
onClick:
|
|
127
|
+
onClick: F(t),
|
|
127
128
|
children: [
|
|
128
129
|
/* @__PURE__ */ n("div", { children: t.label }),
|
|
129
130
|
/* @__PURE__ */ n(
|
|
130
|
-
|
|
131
|
+
b,
|
|
131
132
|
{
|
|
132
|
-
size: "20",
|
|
133
|
+
size: u ?? "20",
|
|
133
134
|
name: s.some((i) => i.value === t.value) ? "selectChecked" : "selectUnchecked"
|
|
134
135
|
}
|
|
135
136
|
)
|
|
@@ -140,8 +141,8 @@ const $ = "_multiSelectWrapper_11it8_1", q = "_selectedOptions_11it8_8", A = "_s
|
|
|
140
141
|
]
|
|
141
142
|
}
|
|
142
143
|
);
|
|
143
|
-
},
|
|
144
|
-
|
|
144
|
+
}, ee = U(V);
|
|
145
|
+
ee.displayName = "Select";
|
|
145
146
|
export {
|
|
146
|
-
|
|
147
|
+
ee as Select
|
|
147
148
|
};
|