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