stone-kit 0.0.652 → 0.0.654
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,46 +1,46 @@
|
|
|
1
|
-
const
|
|
2
|
-
option:
|
|
1
|
+
const t = ({
|
|
2
|
+
option: e,
|
|
3
3
|
setSelectedOptions: s,
|
|
4
|
-
selectedOptions:
|
|
5
|
-
disabledOptions:
|
|
4
|
+
selectedOptions: u,
|
|
5
|
+
disabledOptions: i,
|
|
6
6
|
onChange: r,
|
|
7
7
|
mode: y,
|
|
8
8
|
optionsParentArr: l
|
|
9
9
|
}) => {
|
|
10
|
-
if (!Array.isArray(
|
|
11
|
-
if (
|
|
10
|
+
if (!Array.isArray(e)) {
|
|
11
|
+
if (i.includes(e))
|
|
12
12
|
return;
|
|
13
|
-
let
|
|
13
|
+
let c = u.some((f) => f.value === e.value) ? u.filter((f) => f.value !== e.value) : [...u, e];
|
|
14
14
|
if (y === "double") {
|
|
15
|
-
"options" in
|
|
16
|
-
const
|
|
17
|
-
!(
|
|
15
|
+
"options" in e && u.includes(e) && (c = c.filter((d) => !e.options.includes(d)));
|
|
16
|
+
const f = l == null ? void 0 : l.filter((S) => "options" in S && S.options.includes(e))[0];
|
|
17
|
+
!(f && u.includes(f)) && f && c.push(f);
|
|
18
18
|
}
|
|
19
|
-
s(
|
|
19
|
+
s(c), r && r(c);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
22
|
-
option:
|
|
21
|
+
}, a = ({
|
|
22
|
+
option: e,
|
|
23
23
|
setSelectedOptions: s,
|
|
24
|
-
selectedOptions:
|
|
25
|
-
disabledOptions:
|
|
24
|
+
selectedOptions: u,
|
|
25
|
+
disabledOptions: i,
|
|
26
26
|
onChange: r
|
|
27
27
|
}) => {
|
|
28
|
-
if (Array.isArray(
|
|
29
|
-
const y =
|
|
30
|
-
if (y.every((l) =>
|
|
31
|
-
const l =
|
|
32
|
-
(
|
|
28
|
+
if (Array.isArray(e)) {
|
|
29
|
+
const y = e.filter((l) => !(i != null && i.includes(l)));
|
|
30
|
+
if (y.every((l) => u.map((c) => c).includes(l))) {
|
|
31
|
+
const l = u.filter(
|
|
32
|
+
(c) => !e.includes(c)
|
|
33
33
|
);
|
|
34
34
|
s(l), r && r(l);
|
|
35
35
|
} else {
|
|
36
36
|
const l = y.filter(
|
|
37
|
-
(
|
|
38
|
-
),
|
|
39
|
-
s(
|
|
37
|
+
(f) => !u.includes(f)
|
|
38
|
+
), c = [...u, ...l];
|
|
39
|
+
s(c), r && r(c);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
a as handleClickModeCategory,
|
|
45
|
+
t as handleClickModeOption
|
|
46
46
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as m, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as m, Fragment as R, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as D, useEffect as W } from "react";
|
|
3
3
|
import { c as G } from "../../../index-rKuIKazb.js";
|
|
4
4
|
import { s as e, O as H } from "../../../Option-a48eBPyn.js";
|
|
5
|
-
import { NewIcon as
|
|
5
|
+
import { NewIcon as j } from "../../NewIcon/ui/NewIcon.js";
|
|
6
6
|
import { Category as J } from "./Category.js";
|
|
7
7
|
import { handleClickModeOption as K, handleClickModeCategory as Q } from "../model/selectMode.js";
|
|
8
|
-
const
|
|
9
|
-
options:
|
|
8
|
+
const a = G.bind(e), ee = ({
|
|
9
|
+
options: t,
|
|
10
10
|
placeholder: z = "Выберите опции",
|
|
11
11
|
error: B,
|
|
12
12
|
disabled: g,
|
|
@@ -16,77 +16,78 @@ const s = G.bind(e), ee = ({
|
|
|
16
16
|
additionalClassBtn: b,
|
|
17
17
|
onChange: F,
|
|
18
18
|
onBlur: u,
|
|
19
|
-
selectedValues:
|
|
19
|
+
selectedValues: c = [],
|
|
20
20
|
isBtn: O = !1,
|
|
21
|
-
btnName:
|
|
22
|
-
clickableOptions:
|
|
21
|
+
btnName: y,
|
|
22
|
+
clickableOptions: C,
|
|
23
23
|
isListRight: P = !1,
|
|
24
24
|
sizeIcon: d,
|
|
25
|
-
mode:
|
|
26
|
-
onClickItem:
|
|
25
|
+
mode: s = "options",
|
|
26
|
+
onClickItem: v,
|
|
27
27
|
onCLickSelect: N,
|
|
28
|
-
size_s:
|
|
29
|
-
size_m:
|
|
28
|
+
size_s: S = "large",
|
|
29
|
+
size_m: k,
|
|
30
30
|
size_l: $
|
|
31
31
|
}) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
t = Array.isArray(t) ? [.../* @__PURE__ */ new Set([...t])] : [];
|
|
33
|
+
const [l, x] = w(c), [o, h] = w(!1), p = D(null), A = (r) => {
|
|
34
|
+
v && v(r);
|
|
35
|
+
const n = {
|
|
36
|
+
option: r,
|
|
37
|
+
selectedOptions: l,
|
|
37
38
|
disabledOptions: f,
|
|
38
39
|
setSelectedOptions: x,
|
|
39
40
|
onChange: F,
|
|
40
|
-
mode:
|
|
41
|
-
optionsParentArr:
|
|
41
|
+
mode: s,
|
|
42
|
+
optionsParentArr: t
|
|
42
43
|
};
|
|
43
|
-
Array.isArray(
|
|
44
|
+
Array.isArray(r) ? Q(n) : K(n);
|
|
44
45
|
}, _ = () => {
|
|
45
|
-
u && u(
|
|
46
|
+
u && u(l);
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const q =
|
|
50
|
-
if (
|
|
48
|
+
W(() => {
|
|
49
|
+
const r = (n) => {
|
|
50
|
+
const q = n.target;
|
|
51
|
+
if (p.current && !p.current.contains(n.target)) {
|
|
51
52
|
if (q.closest("svg"))
|
|
52
53
|
return;
|
|
53
|
-
|
|
54
|
+
h(!1);
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
return document.addEventListener("click",
|
|
57
|
-
document.removeEventListener("click",
|
|
57
|
+
return document.addEventListener("click", r), () => {
|
|
58
|
+
document.removeEventListener("click", r);
|
|
58
59
|
};
|
|
59
60
|
}, []);
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
}, [
|
|
61
|
+
const E = D(c);
|
|
62
|
+
return W(() => {
|
|
63
|
+
c.length !== E.current.length && (x(c), E.current = c);
|
|
64
|
+
}, [c]), /* @__PURE__ */ m(
|
|
64
65
|
"div",
|
|
65
66
|
{
|
|
66
|
-
ref:
|
|
67
|
-
className:
|
|
67
|
+
ref: p,
|
|
68
|
+
className: a(e.multiSelectWrapper, { [e.multiSelectWrapperError]: B }, L),
|
|
68
69
|
tabIndex: 0,
|
|
69
70
|
onBlur: _,
|
|
70
71
|
children: [
|
|
71
|
-
/* @__PURE__ */ m("div", { className:
|
|
72
|
-
!O && /* @__PURE__ */ m(
|
|
73
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ m("div", { className: a(e.inputWrapper), children: [
|
|
73
|
+
!O && /* @__PURE__ */ m(R, { children: [
|
|
74
|
+
/* @__PURE__ */ i(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
|
-
className:
|
|
77
|
+
className: a(
|
|
77
78
|
e.selectedOptions,
|
|
78
|
-
e[`${
|
|
79
|
-
e[`${
|
|
79
|
+
e[`${S}-size`],
|
|
80
|
+
e[`${k}-size_m`],
|
|
80
81
|
e[`${$}-size)_l`],
|
|
81
|
-
{ [e.selectedOptionsNotEmpty]:
|
|
82
|
+
{ [e.selectedOptionsNotEmpty]: l.length > 0 },
|
|
82
83
|
{ [e.selectOptionsDisabled]: g }
|
|
83
84
|
),
|
|
84
|
-
onClick: () =>
|
|
85
|
-
children:
|
|
85
|
+
onClick: () => h(!o),
|
|
86
|
+
children: l.length === 0 ? z : "Выбрано " + l.length
|
|
86
87
|
}
|
|
87
88
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
89
|
+
/* @__PURE__ */ i(
|
|
90
|
+
j,
|
|
90
91
|
{
|
|
91
92
|
name: "arrowShort",
|
|
92
93
|
deg: o ? "180" : "0",
|
|
@@ -95,63 +96,63 @@ const s = G.bind(e), ee = ({
|
|
|
95
96
|
}
|
|
96
97
|
)
|
|
97
98
|
] }),
|
|
98
|
-
O && /* @__PURE__ */ m(
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
O && /* @__PURE__ */ m(R, { children: [
|
|
100
|
+
/* @__PURE__ */ i(
|
|
100
101
|
"button",
|
|
101
102
|
{
|
|
102
|
-
className:
|
|
103
|
+
className: a(
|
|
103
104
|
e.selectedOptions,
|
|
104
|
-
e[`${
|
|
105
|
-
e[`${
|
|
105
|
+
e[`${S}-size`],
|
|
106
|
+
e[`${k}-size_m`],
|
|
106
107
|
e[`${$}-size_l`],
|
|
107
108
|
e.selectedOptionsBtn,
|
|
108
109
|
{ [e.selectOptionsDisabled]: g },
|
|
109
110
|
b
|
|
110
111
|
),
|
|
111
112
|
onClick: () => {
|
|
112
|
-
N && N(),
|
|
113
|
+
N && N(), h(!o);
|
|
113
114
|
},
|
|
114
|
-
children:
|
|
115
|
+
children: y
|
|
115
116
|
}
|
|
116
117
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
118
|
+
/* @__PURE__ */ i(
|
|
119
|
+
j,
|
|
119
120
|
{
|
|
120
121
|
name: "filter",
|
|
121
122
|
deg: o ? "180" : "0",
|
|
122
123
|
size: d ?? "24",
|
|
123
|
-
additionalClass:
|
|
124
|
+
additionalClass: a(e.icon, { [e.iconBtn]: !y })
|
|
124
125
|
}
|
|
125
126
|
)
|
|
126
127
|
] })
|
|
127
128
|
] }),
|
|
128
|
-
o && /* @__PURE__ */ m("div", { className:
|
|
129
|
-
|
|
129
|
+
o && /* @__PURE__ */ m("div", { className: a(e.optionsList, { [e.listRight]: P }, M), children: [
|
|
130
|
+
s === "options" && (t == null ? void 0 : t.map((r, n) => /* @__PURE__ */ i(
|
|
130
131
|
H,
|
|
131
132
|
{
|
|
132
133
|
disabledOptions: f,
|
|
133
|
-
clickableOptions:
|
|
134
|
-
selectedOptions:
|
|
134
|
+
clickableOptions: C,
|
|
135
|
+
selectedOptions: l,
|
|
135
136
|
sizeIcon: d,
|
|
136
|
-
option:
|
|
137
|
-
handleOptionClick:
|
|
137
|
+
option: r,
|
|
138
|
+
handleOptionClick: A
|
|
138
139
|
},
|
|
139
|
-
|
|
140
|
+
n
|
|
140
141
|
))),
|
|
141
|
-
(
|
|
142
|
-
(
|
|
142
|
+
(s === "category" || s === "double") && (t == null ? void 0 : t.map(
|
|
143
|
+
(r, n) => "options" in r ? /* @__PURE__ */ i(
|
|
143
144
|
J,
|
|
144
145
|
{
|
|
145
146
|
disabledOptions: f,
|
|
146
|
-
clickableOptions:
|
|
147
|
-
selectedOptions:
|
|
147
|
+
clickableOptions: C,
|
|
148
|
+
selectedOptions: l,
|
|
148
149
|
sizeIcon: d,
|
|
149
|
-
category:
|
|
150
|
-
mode:
|
|
151
|
-
selectedValues:
|
|
152
|
-
handleOptionClick:
|
|
150
|
+
category: r,
|
|
151
|
+
mode: s,
|
|
152
|
+
selectedValues: c,
|
|
153
|
+
handleOptionClick: A
|
|
153
154
|
},
|
|
154
|
-
|
|
155
|
+
n
|
|
155
156
|
) : null
|
|
156
157
|
))
|
|
157
158
|
] })
|
|
@@ -11,7 +11,7 @@ export type TCategory = {
|
|
|
11
11
|
export type TModeSelect = 'options' | 'category' | 'double';
|
|
12
12
|
type SelectSizes = 'medium' | 'small' | 'large';
|
|
13
13
|
export interface MultiSelectProps {
|
|
14
|
-
options
|
|
14
|
+
options: TOption[] | TCategory[];
|
|
15
15
|
category?: TCategory[];
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
error?: boolean;
|