stone-kit 0.0.131 → 0.0.136
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.
- package/dist/components/SortSelect/hooks/useSortSelect.d.ts +1 -1
- package/dist/components/SortSelect/hooks/useSortSelect.js +1 -1
- package/dist/components/SortSelect/ui/SortSelect.js +36 -35
- package/dist/components/SortSelect/ui/SortSelect.types.d.ts +2 -1
- package/dist/{useSortSelect-C-PfwcIF.js → useSortSelect-BTrKnFKx.js} +13 -14
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Option } from '../ui/SortSelect.types';
|
|
|
3
3
|
|
|
4
4
|
interface IUseSortSelect {
|
|
5
5
|
selectedOption: Option | null;
|
|
6
|
-
setSelectedOption:
|
|
6
|
+
setSelectedOption?: (event: Option | null) => void;
|
|
7
7
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
8
8
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
9
9
|
isOpen: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { c as
|
|
4
|
-
import { s as e, u as
|
|
2
|
+
import { useState as C, useRef as I, useEffect as B } from "react";
|
|
3
|
+
import { c as E } from "../../../index-DIxK0V-G.js";
|
|
4
|
+
import { s as e, u as L } from "../../../useSortSelect-BTrKnFKx.js";
|
|
5
5
|
import { NewIcon as u } from "../../NewIcon/ui/NewIcon.js";
|
|
6
6
|
import "../../Button/ui/Button.js";
|
|
7
7
|
import "../../mobileButton/ui/MobileButton.js";
|
|
@@ -9,56 +9,57 @@ import "../../DestinationTab/ui/DestinationTab.js";
|
|
|
9
9
|
import "../../RoundButton/ui/RoundButton.js";
|
|
10
10
|
import "../../Tag/ui/Tag.js";
|
|
11
11
|
import "../../Switcher/ui/Switcher.js";
|
|
12
|
-
import { Text as
|
|
12
|
+
import { Text as M } from "../../Text/ui/Text.js";
|
|
13
13
|
import "../../Flex/ui/Flex.js";
|
|
14
14
|
import "../../Input/ui/Input.js";
|
|
15
|
-
import { Modal as
|
|
15
|
+
import { Modal as W } from "../../Modal/ui/Modal.js";
|
|
16
16
|
import "../../TabSwitcher/ui/TabSwitcher.js";
|
|
17
17
|
import "../../GroupedInput/ui/GroupedInputs.js";
|
|
18
18
|
import "../../MetroTag/ui/MetroTag.js";
|
|
19
19
|
import "../../Select/ui/Select.js";
|
|
20
|
-
import { useClientWidth as
|
|
21
|
-
const
|
|
22
|
-
options:
|
|
23
|
-
|
|
20
|
+
import { useClientWidth as j } from "../../../shared/useClientWidth.js";
|
|
21
|
+
const l = E.bind(e), w = ({
|
|
22
|
+
options: n,
|
|
23
|
+
selectedOption: f,
|
|
24
|
+
placeholder: S = "",
|
|
24
25
|
error: O,
|
|
25
|
-
disabled:
|
|
26
|
-
additionalClass:
|
|
27
|
-
onChange:
|
|
26
|
+
disabled: h,
|
|
27
|
+
additionalClass: v = "",
|
|
28
|
+
onChange: c,
|
|
28
29
|
onBlur: N,
|
|
29
30
|
mini: b
|
|
30
31
|
}) => {
|
|
31
|
-
const [
|
|
32
|
-
selectedOption:
|
|
33
|
-
setSelectedOption:
|
|
32
|
+
const [o, i] = C(!1), m = I(null), { isMobile: a, isDesktop: x } = j(), { handleBlur: y, getInputValue: k, getOption: d, handleDocumentClick: p } = L({
|
|
33
|
+
selectedOption: f,
|
|
34
|
+
setSelectedOption: c,
|
|
34
35
|
setIsOpen: i,
|
|
35
|
-
containerRef:
|
|
36
|
+
containerRef: m,
|
|
36
37
|
isOpen: o,
|
|
37
|
-
isDesktop:
|
|
38
|
-
placeholder:
|
|
39
|
-
onChange:
|
|
38
|
+
isDesktop: x,
|
|
39
|
+
placeholder: S,
|
|
40
|
+
onChange: c,
|
|
40
41
|
onBlur: N
|
|
41
42
|
});
|
|
42
|
-
return
|
|
43
|
-
document.removeEventListener("click",
|
|
43
|
+
return B(() => (document.addEventListener("click", p), () => {
|
|
44
|
+
document.removeEventListener("click", p);
|
|
44
45
|
}), []), /* @__PURE__ */ r(
|
|
45
46
|
"div",
|
|
46
47
|
{
|
|
47
|
-
ref:
|
|
48
|
-
className:
|
|
48
|
+
ref: m,
|
|
49
|
+
className: l(e.sortSelectWrapper, { [e.sortSelectWrapperError]: O }, v),
|
|
49
50
|
tabIndex: 0,
|
|
50
|
-
onBlur:
|
|
51
|
+
onBlur: y,
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */ r("div", { className:
|
|
53
|
+
/* @__PURE__ */ r("div", { className: l(e.inputWrapper), children: [
|
|
53
54
|
/* @__PURE__ */ t(
|
|
54
55
|
"input",
|
|
55
56
|
{
|
|
56
57
|
type: "text",
|
|
57
58
|
readOnly: !0,
|
|
58
|
-
value:
|
|
59
|
-
className:
|
|
59
|
+
value: k(),
|
|
60
|
+
className: l(
|
|
60
61
|
e.selectedOptions,
|
|
61
|
-
{ [e.selectOptionsDisabled]:
|
|
62
|
+
{ [e.selectOptionsDisabled]: h },
|
|
62
63
|
{ [e.selectionOptionMini]: b }
|
|
63
64
|
),
|
|
64
65
|
onClick: () => i(!o)
|
|
@@ -73,8 +74,8 @@ const n = L.bind(e), D = ({
|
|
|
73
74
|
}
|
|
74
75
|
)
|
|
75
76
|
] }),
|
|
76
|
-
o &&
|
|
77
|
-
|
|
77
|
+
o && a && /* @__PURE__ */ r(
|
|
78
|
+
W,
|
|
78
79
|
{
|
|
79
80
|
isOpen: o,
|
|
80
81
|
emitIsOpen: i,
|
|
@@ -82,7 +83,7 @@ const n = L.bind(e), D = ({
|
|
|
82
83
|
createPortalObj: { domNode: document.querySelector("body") },
|
|
83
84
|
children: [
|
|
84
85
|
/* @__PURE__ */ r("div", { className: e.mobileSortHeader, children: [
|
|
85
|
-
/* @__PURE__ */ t(
|
|
86
|
+
/* @__PURE__ */ t(M, { children: "Сортировка" }),
|
|
86
87
|
/* @__PURE__ */ t("div", { onClick: () => i(!1), children: /* @__PURE__ */ t(
|
|
87
88
|
u,
|
|
88
89
|
{
|
|
@@ -91,16 +92,16 @@ const n = L.bind(e), D = ({
|
|
|
91
92
|
}
|
|
92
93
|
) })
|
|
93
94
|
] }),
|
|
94
|
-
/* @__PURE__ */ t("div", { className: e.mobileOptionList, children:
|
|
95
|
+
/* @__PURE__ */ t("div", { className: e.mobileOptionList, children: n.map((s) => d(s)) })
|
|
95
96
|
]
|
|
96
97
|
}
|
|
97
98
|
),
|
|
98
|
-
o && !
|
|
99
|
+
o && !a && /* @__PURE__ */ t("div", { className: e.optionsList, children: n.map((s) => d(s)) })
|
|
99
100
|
]
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
103
|
};
|
|
103
|
-
|
|
104
|
+
w.displayName = "SortSelect";
|
|
104
105
|
export {
|
|
105
|
-
|
|
106
|
+
w as SortSelect
|
|
106
107
|
};
|
|
@@ -4,10 +4,11 @@ export interface Option {
|
|
|
4
4
|
}
|
|
5
5
|
export interface SortSelectProps {
|
|
6
6
|
options: Option[];
|
|
7
|
+
selectedOption: Option | null;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
error?: boolean;
|
|
9
10
|
disabled?: boolean;
|
|
10
|
-
onChange?: (event: Option) => void;
|
|
11
|
+
onChange?: (event: Option | null) => void;
|
|
11
12
|
onBlur?: (event: Option) => void;
|
|
12
13
|
additionalClass?: string;
|
|
13
14
|
mini?: boolean;
|
|
@@ -16,42 +16,41 @@ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_s
|
|
|
16
16
|
checkBox: A,
|
|
17
17
|
checkBoxChecked: H,
|
|
18
18
|
innerCheck: M
|
|
19
|
-
},
|
|
19
|
+
}, l = p.bind(e), q = ({
|
|
20
20
|
selectedOption: n,
|
|
21
|
-
setSelectedOption:
|
|
22
|
-
setIsOpen:
|
|
23
|
-
containerRef:
|
|
24
|
-
onBlur:
|
|
21
|
+
setSelectedOption: s,
|
|
22
|
+
setIsOpen: m,
|
|
23
|
+
containerRef: r,
|
|
24
|
+
onBlur: i,
|
|
25
25
|
onChange: a,
|
|
26
26
|
isDesktop: k,
|
|
27
27
|
placeholder: u
|
|
28
28
|
}) => {
|
|
29
29
|
const v = (t) => (o) => {
|
|
30
30
|
o.stopPropagation();
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
31
|
+
const _ = (n == null ? void 0 : n.value) === t.value ? null : t;
|
|
32
|
+
if (s && s(_), a) {
|
|
33
33
|
const d = {
|
|
34
34
|
...o,
|
|
35
|
-
target: { value:
|
|
35
|
+
target: { value: _ }
|
|
36
36
|
};
|
|
37
37
|
a(d);
|
|
38
38
|
}
|
|
39
|
-
s(!1);
|
|
40
39
|
};
|
|
41
40
|
return { handleDocumentClick: (t) => {
|
|
42
|
-
|
|
41
|
+
r.current && !r.current.contains(t.target) && m(!1);
|
|
43
42
|
}, handleBlur: (t) => {
|
|
44
|
-
if (
|
|
43
|
+
if (i) {
|
|
45
44
|
const o = {
|
|
46
45
|
...t,
|
|
47
46
|
target: { value: n }
|
|
48
47
|
};
|
|
49
|
-
|
|
48
|
+
i(o);
|
|
50
49
|
}
|
|
51
50
|
}, getInputValue: () => k ? n ? n.label : u : "", getOption: (t) => /* @__PURE__ */ h(
|
|
52
51
|
"div",
|
|
53
52
|
{
|
|
54
|
-
className:
|
|
53
|
+
className: l(e.option, {
|
|
55
54
|
[e.selected]: (n == null ? void 0 : n.value) === t.value
|
|
56
55
|
}),
|
|
57
56
|
onClick: v(t),
|
|
@@ -60,7 +59,7 @@ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_s
|
|
|
60
59
|
/* @__PURE__ */ c(
|
|
61
60
|
"div",
|
|
62
61
|
{
|
|
63
|
-
className:
|
|
62
|
+
className: l(e.checkBox, {
|
|
64
63
|
[e.checkBoxChecked]: (n == null ? void 0 : n.value) === t.value
|
|
65
64
|
}),
|
|
66
65
|
children: (n == null ? void 0 : n.value) === t.value && /* @__PURE__ */ c("div", { className: e.innerCheck })
|