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