stone-kit 0.0.651 → 0.0.653
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
|
|
1
|
+
const t = ({
|
|
2
2
|
option: e,
|
|
3
3
|
setSelectedOptions: s,
|
|
4
|
-
selectedOptions:
|
|
5
|
-
disabledOptions:
|
|
6
|
-
onChange:
|
|
4
|
+
selectedOptions: u,
|
|
5
|
+
disabledOptions: i,
|
|
6
|
+
onChange: r,
|
|
7
7
|
mode: y,
|
|
8
|
-
optionsParentArr:
|
|
8
|
+
optionsParentArr: l
|
|
9
9
|
}) => {
|
|
10
10
|
if (!Array.isArray(e)) {
|
|
11
|
-
if (
|
|
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 e &&
|
|
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
|
-
},
|
|
21
|
+
}, a = ({
|
|
22
22
|
option: e,
|
|
23
23
|
setSelectedOptions: s,
|
|
24
|
-
selectedOptions:
|
|
25
|
-
disabledOptions:
|
|
26
|
-
onChange:
|
|
24
|
+
selectedOptions: u,
|
|
25
|
+
disabledOptions: i,
|
|
26
|
+
onChange: r
|
|
27
27
|
}) => {
|
|
28
28
|
if (Array.isArray(e)) {
|
|
29
|
-
const y = e.filter((
|
|
30
|
-
if (y.every((
|
|
31
|
-
const
|
|
32
|
-
(
|
|
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
|
-
s(
|
|
34
|
+
s(l), r && r(l);
|
|
35
35
|
} else {
|
|
36
|
-
const
|
|
37
|
-
(
|
|
38
|
-
),
|
|
39
|
-
s(
|
|
36
|
+
const l = y.filter(
|
|
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 w, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, 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
8
|
const s = G.bind(e), ee = ({
|
|
9
|
-
options:
|
|
9
|
+
options: r,
|
|
10
10
|
placeholder: z = "Выберите опции",
|
|
11
11
|
error: B,
|
|
12
12
|
disabled: g,
|
|
@@ -16,7 +16,7 @@ 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
21
|
btnName: C,
|
|
22
22
|
clickableOptions: v,
|
|
@@ -25,29 +25,30 @@ const s = G.bind(e), ee = ({
|
|
|
25
25
|
mode: a = "options",
|
|
26
26
|
onClickItem: y,
|
|
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
|
-
|
|
32
|
+
r = [.../* @__PURE__ */ new Set([...r])];
|
|
33
|
+
const [l, x] = A(c), [o, p] = A(!1), h = D(null), E = (t) => {
|
|
33
34
|
y && y(t);
|
|
34
|
-
const
|
|
35
|
+
const n = {
|
|
35
36
|
option: t,
|
|
36
|
-
selectedOptions:
|
|
37
|
+
selectedOptions: l,
|
|
37
38
|
disabledOptions: f,
|
|
38
39
|
setSelectedOptions: x,
|
|
39
40
|
onChange: F,
|
|
40
41
|
mode: a,
|
|
41
|
-
optionsParentArr:
|
|
42
|
+
optionsParentArr: r
|
|
42
43
|
};
|
|
43
|
-
Array.isArray(t) ? Q(
|
|
44
|
+
Array.isArray(t) ? Q(n) : K(n);
|
|
44
45
|
}, _ = () => {
|
|
45
|
-
u && u(
|
|
46
|
+
u && u(l);
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
-
const t = (
|
|
49
|
-
const q =
|
|
50
|
-
if (h.current && !h.current.contains(
|
|
48
|
+
W(() => {
|
|
49
|
+
const t = (n) => {
|
|
50
|
+
const q = n.target;
|
|
51
|
+
if (h.current && !h.current.contains(n.target)) {
|
|
51
52
|
if (q.closest("svg"))
|
|
52
53
|
return;
|
|
53
54
|
p(!1);
|
|
@@ -57,10 +58,10 @@ const s = G.bind(e), ee = ({
|
|
|
57
58
|
document.removeEventListener("click", t);
|
|
58
59
|
};
|
|
59
60
|
}, []);
|
|
60
|
-
const R =
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
}, [
|
|
61
|
+
const R = D(c);
|
|
62
|
+
return W(() => {
|
|
63
|
+
c.length !== R.current.length && (x(c), R.current = c);
|
|
64
|
+
}, [c]), /* @__PURE__ */ m(
|
|
64
65
|
"div",
|
|
65
66
|
{
|
|
66
67
|
ref: h,
|
|
@@ -69,24 +70,24 @@ const s = G.bind(e), ee = ({
|
|
|
69
70
|
onBlur: _,
|
|
70
71
|
children: [
|
|
71
72
|
/* @__PURE__ */ m("div", { className: s(e.inputWrapper), children: [
|
|
72
|
-
!O && /* @__PURE__ */ m(
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
!O && /* @__PURE__ */ m(w, { children: [
|
|
74
|
+
/* @__PURE__ */ i(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
77
|
className: s(
|
|
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
85
|
onClick: () => p(!o),
|
|
85
|
-
children:
|
|
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,14 +96,14 @@ const s = G.bind(e), ee = ({
|
|
|
95
96
|
}
|
|
96
97
|
)
|
|
97
98
|
] }),
|
|
98
|
-
O && /* @__PURE__ */ m(
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
O && /* @__PURE__ */ m(w, { children: [
|
|
100
|
+
/* @__PURE__ */ i(
|
|
100
101
|
"button",
|
|
101
102
|
{
|
|
102
103
|
className: s(
|
|
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 },
|
|
@@ -114,8 +115,8 @@ const s = G.bind(e), ee = ({
|
|
|
114
115
|
children: C
|
|
115
116
|
}
|
|
116
117
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
118
|
+
/* @__PURE__ */ i(
|
|
119
|
+
j,
|
|
119
120
|
{
|
|
120
121
|
name: "filter",
|
|
121
122
|
deg: o ? "180" : "0",
|
|
@@ -126,32 +127,32 @@ const s = G.bind(e), ee = ({
|
|
|
126
127
|
] })
|
|
127
128
|
] }),
|
|
128
129
|
o && /* @__PURE__ */ m("div", { className: s(e.optionsList, { [e.listRight]: P }, M), children: [
|
|
129
|
-
a === "options" && (
|
|
130
|
+
a === "options" && (r == null ? void 0 : r.map((t, n) => /* @__PURE__ */ i(
|
|
130
131
|
H,
|
|
131
132
|
{
|
|
132
133
|
disabledOptions: f,
|
|
133
134
|
clickableOptions: v,
|
|
134
|
-
selectedOptions:
|
|
135
|
+
selectedOptions: l,
|
|
135
136
|
sizeIcon: d,
|
|
136
137
|
option: t,
|
|
137
138
|
handleOptionClick: E
|
|
138
139
|
},
|
|
139
|
-
|
|
140
|
+
n
|
|
140
141
|
))),
|
|
141
|
-
(a === "category" || a === "double") && (
|
|
142
|
-
(t,
|
|
142
|
+
(a === "category" || a === "double") && (r == null ? void 0 : r.map(
|
|
143
|
+
(t, n) => "options" in t ? /* @__PURE__ */ i(
|
|
143
144
|
J,
|
|
144
145
|
{
|
|
145
146
|
disabledOptions: f,
|
|
146
147
|
clickableOptions: v,
|
|
147
|
-
selectedOptions:
|
|
148
|
+
selectedOptions: l,
|
|
148
149
|
sizeIcon: d,
|
|
149
150
|
category: t,
|
|
150
151
|
mode: a,
|
|
151
|
-
selectedValues:
|
|
152
|
+
selectedValues: c,
|
|
152
153
|
handleOptionClick: E
|
|
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;
|