mimir-ui-kit 1.36.9 → 1.36.11
Sign up to get free protection for your applications and to get access to all the features.
@@ -57,9 +57,17 @@ type TProps = {
|
|
57
57
|
* Дополнительный класс для footer.
|
58
58
|
*/
|
59
59
|
classNameFooter?: string;
|
60
|
+
/**
|
61
|
+
* Флаг, определяющий, закрывать ли Drawer при клике вне его области
|
62
|
+
*/
|
63
|
+
closeOnClickOutside?: boolean;
|
64
|
+
/**
|
65
|
+
* Флаг, определяющий, показывать ли кнопку закрытия в заголовке
|
66
|
+
*/
|
67
|
+
showCloseButton?: boolean;
|
60
68
|
};
|
61
69
|
/**
|
62
70
|
* Компонент шторки, который может выезжать слева, справа или внизу.
|
63
71
|
*/
|
64
|
-
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children, classNameInner, classNameFooter }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
72
|
+
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children, classNameInner, classNameFooter, closeOnClickOutside, showCloseButton }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
65
73
|
export {};
|
@@ -1,93 +1,97 @@
|
|
1
|
-
import { jsxs as m, jsx as t, Fragment as
|
1
|
+
import { jsxs as m, jsx as t, Fragment as X } from "react/jsx-runtime";
|
2
2
|
import { c as s } from "../../index-DIxK0V-G.js";
|
3
|
-
import { useState as
|
4
|
-
import { EDrawerPosition as
|
5
|
-
import { useMediaQuery as
|
6
|
-
import { EMediaQuery as
|
7
|
-
import { useLockBodyScroll as
|
8
|
-
import { useResizeObserver as
|
9
|
-
import { Button as
|
10
|
-
import { EButtonVariantDefault as
|
11
|
-
import { Loader as
|
12
|
-
import { Portal as
|
13
|
-
import '../../assets/Drawer.css';const
|
14
|
-
drawer:
|
15
|
-
content:
|
3
|
+
import { useState as N, useRef as j, useCallback as u, useEffect as P } from "react";
|
4
|
+
import { EDrawerPosition as w } from "./constants.js";
|
5
|
+
import { useMediaQuery as Q } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
6
|
+
import { EMediaQuery as F } from "../../hooks/useMediaQuery/constants.js";
|
7
|
+
import { useLockBodyScroll as G } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
|
8
|
+
import { useResizeObserver as H } from "../../hooks/useResizeObserver/useResizeObserver.js";
|
9
|
+
import { Button as k } from "../Button/Button.js";
|
10
|
+
import { EButtonVariantDefault as K, EButtonSize as n } from "../Button/constants.js";
|
11
|
+
import { Loader as V } from "../Loader/Loader.js";
|
12
|
+
import { Portal as W } from "../Portal/Portal.js";
|
13
|
+
import '../../assets/Drawer.css';const Y = "_drawer_1xs4d_3", q = "_content_1xs4d_27", J = "_header_1xs4d_45", U = "_title_1xs4d_59", Z = "_space_1xs4d_73", $ = "_inner_1xs4d_84", O = "_button_1xs4d_87", ee = "_footer_1xs4d_92", te = "_left_1xs4d_105", oe = "_right_1xs4d_109", se = "_full_1xs4d_113", re = "_bottom_1xs4d_123", ne = "_opened_1xs4d_140", ae = "_overlay_1xs4d_196", ie = "_unmount_1xs4d_212", e = {
|
14
|
+
drawer: Y,
|
15
|
+
content: q,
|
16
16
|
"is-loading": "_is-loading_1xs4d_41",
|
17
|
-
header:
|
17
|
+
header: J,
|
18
18
|
"sticky-header": "_sticky-header_1xs4d_53",
|
19
|
-
title:
|
20
|
-
space:
|
21
|
-
inner:
|
22
|
-
button:
|
23
|
-
footer:
|
19
|
+
title: U,
|
20
|
+
space: Z,
|
21
|
+
inner: $,
|
22
|
+
button: O,
|
23
|
+
footer: ee,
|
24
24
|
"footer-button": "_footer-button_1xs4d_101",
|
25
|
-
left:
|
26
|
-
right:
|
27
|
-
full:
|
28
|
-
bottom:
|
25
|
+
left: te,
|
26
|
+
right: oe,
|
27
|
+
full: se,
|
28
|
+
bottom: re,
|
29
29
|
"full-bottom-height": "_full-bottom-height_1xs4d_134",
|
30
|
-
opened:
|
30
|
+
opened: ne,
|
31
31
|
"is-closing": "_is-closing_1xs4d_159",
|
32
|
-
overlay:
|
33
|
-
unmount:
|
34
|
-
},
|
32
|
+
overlay: ae,
|
33
|
+
unmount: ie
|
34
|
+
}, le = 300, ve = ({
|
35
35
|
isOpen: r,
|
36
|
-
onClose:
|
37
|
-
title:
|
38
|
-
className:
|
36
|
+
onClose: a,
|
37
|
+
title: E,
|
38
|
+
className: M,
|
39
39
|
unmount: f = !0,
|
40
40
|
isLoading: i = !1,
|
41
41
|
stickyHeader: B,
|
42
|
-
fullBottomHeight:
|
43
|
-
position:
|
44
|
-
paddingRight:
|
42
|
+
fullBottomHeight: I = !1,
|
43
|
+
position: l = w.RIGHT,
|
44
|
+
paddingRight: S = 8,
|
45
45
|
footer: c,
|
46
|
-
children:
|
47
|
-
classNameInner:
|
48
|
-
classNameFooter:
|
46
|
+
children: T,
|
47
|
+
classNameInner: C,
|
48
|
+
classNameFooter: D,
|
49
|
+
closeOnClickOutside: h = !0,
|
50
|
+
showCloseButton: x = !0
|
49
51
|
}) => {
|
50
|
-
const [
|
51
|
-
enabled:
|
52
|
+
const [p, y] = N(!1), [z, b] = N(!1), g = j(), d = Q(F.XS1), { ref: L } = H({
|
53
|
+
enabled: l === w.BOTTOM
|
52
54
|
});
|
53
|
-
|
54
|
-
on:
|
55
|
-
paddingRight:
|
55
|
+
G({
|
56
|
+
on: r && !p,
|
57
|
+
paddingRight: S
|
56
58
|
});
|
57
|
-
const o =
|
58
|
-
|
59
|
-
|
60
|
-
},
|
61
|
-
}, [
|
62
|
-
(
|
63
|
-
|
59
|
+
const o = u(() => {
|
60
|
+
a && (y(!0), g.current = setTimeout(() => {
|
61
|
+
a(), y(!1);
|
62
|
+
}, le));
|
63
|
+
}, [a]), R = u(() => {
|
64
|
+
h && o();
|
65
|
+
}, [h, o]), _ = u(
|
66
|
+
(A) => {
|
67
|
+
A.key === "Escape" && o();
|
64
68
|
},
|
65
69
|
[o]
|
66
70
|
);
|
67
|
-
|
68
|
-
|
71
|
+
P(() => (r && (b(!0), window.addEventListener("keydown", _)), () => {
|
72
|
+
b(!1), clearTimeout(g.current), window.removeEventListener("keydown", _);
|
69
73
|
}), [r, _]);
|
70
|
-
const
|
71
|
-
[e.opened]:
|
72
|
-
[e["is-closing"]]:
|
73
|
-
[e["full-bottom-height"]]:
|
74
|
+
const v = {
|
75
|
+
[e.opened]: z,
|
76
|
+
[e["is-closing"]]: p,
|
77
|
+
[e["full-bottom-height"]]: I,
|
74
78
|
[e["is-loading"]]: i
|
75
79
|
};
|
76
|
-
return !r && f ? null : /* @__PURE__ */ m(
|
80
|
+
return !r && f ? null : /* @__PURE__ */ m(W, { children: [
|
77
81
|
/* @__PURE__ */ t(
|
78
82
|
"div",
|
79
83
|
{
|
80
84
|
"aria-hidden": !r,
|
81
85
|
role: "dialog",
|
82
|
-
className: s(e.drawer, e[
|
86
|
+
className: s(e.drawer, e[l], v, M),
|
83
87
|
children: /* @__PURE__ */ t(
|
84
88
|
"section",
|
85
89
|
{
|
86
|
-
ref:
|
87
|
-
className: s(e.content, e[
|
90
|
+
ref: L,
|
91
|
+
className: s(e.content, e[l], {
|
88
92
|
[e["is-loading"]]: !!i
|
89
93
|
}),
|
90
|
-
children: i ? /* @__PURE__ */ t(
|
94
|
+
children: i ? /* @__PURE__ */ t(V, {}) : /* @__PURE__ */ m(X, { children: [
|
91
95
|
/* @__PURE__ */ m(
|
92
96
|
"header",
|
93
97
|
{
|
@@ -95,11 +99,11 @@ import '../../assets/Drawer.css';const V = "_drawer_1xs4d_3", W = "_content_1xs4
|
|
95
99
|
[e["sticky-header"]]: B
|
96
100
|
}),
|
97
101
|
children: [
|
98
|
-
/* @__PURE__ */ t("h2", { className: e.title, children:
|
99
|
-
/* @__PURE__ */ t("div", { className: e.space, children: /* @__PURE__ */ t(
|
100
|
-
|
102
|
+
/* @__PURE__ */ t("h2", { className: e.title, children: E }),
|
103
|
+
/* @__PURE__ */ t("div", { className: e.space, children: x && /* @__PURE__ */ t(
|
104
|
+
k,
|
101
105
|
{
|
102
|
-
variant:
|
106
|
+
variant: K.SecondaryWhite,
|
103
107
|
isIconButton: !0,
|
104
108
|
size: d ? n.S : n.M,
|
105
109
|
iconName: "Close16px",
|
@@ -110,9 +114,9 @@ import '../../assets/Drawer.css';const V = "_drawer_1xs4d_3", W = "_content_1xs4
|
|
110
114
|
]
|
111
115
|
}
|
112
116
|
),
|
113
|
-
/* @__PURE__ */ t("div", { className: s(e.inner,
|
114
|
-
/* @__PURE__ */ t("footer", { className: s(e.footer,
|
115
|
-
|
117
|
+
/* @__PURE__ */ t("div", { className: s(e.inner, C), children: T }),
|
118
|
+
/* @__PURE__ */ t("footer", { className: s(e.footer, D), children: typeof c == "function" ? c({ handleClose: o }) : c || x && /* @__PURE__ */ t(
|
119
|
+
k,
|
116
120
|
{
|
117
121
|
size: d ? n.M : n.XXL,
|
118
122
|
full: d,
|
@@ -134,15 +138,15 @@ import '../../assets/Drawer.css';const V = "_drawer_1xs4d_3", W = "_content_1xs4
|
|
134
138
|
{
|
135
139
|
[e.unmount]: !f
|
136
140
|
},
|
137
|
-
|
141
|
+
v
|
138
142
|
),
|
139
143
|
"data-testid": "drawer-overlay",
|
140
|
-
onClick:
|
144
|
+
onClick: R
|
141
145
|
}
|
142
146
|
)
|
143
147
|
] });
|
144
148
|
};
|
145
149
|
export {
|
146
|
-
|
147
|
-
|
150
|
+
le as ANIMATION_DELAY,
|
151
|
+
ve as Drawer
|
148
152
|
};
|