mimir-ui-kit 1.37.16 → 1.38.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/Dropdown.css +1 -0
- package/dist/assets/Slider.css +1 -1
- package/dist/close-provider-CEutdhG8.js +9 -0
- package/dist/combobox-CVtJDVoZ.js +980 -0
- package/dist/components/Accordion/Accordion.js +91 -95
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/Drawer/Drawer.d.ts +5 -1
- package/dist/components/Drawer/Drawer.js +45 -44
- package/dist/components/Dropdown/Dropdown.d.ts +45 -0
- package/dist/components/Dropdown/Dropdown.js +333 -0
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/index.js +4 -0
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.js +21 -21
- package/dist/components/Slider/Slider.d.ts +19 -1
- package/dist/components/Slider/Slider.js +570 -533
- package/dist/components/Slider/constants.d.ts +4 -0
- package/dist/components/Slider/constants.js +4 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +2 -0
- package/dist/components/Switcher/Switcher.js +4 -4
- package/dist/components/TabTrail/TabTrail.js +4 -4
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +121 -117
- package/dist/{field-C1kt7aNM.js → field-FJ34aSs4.js} +2 -2
- package/dist/{focus-management-DOYCPyGg.js → focus-management-DE4t_lW3.js} +2 -1
- package/dist/{hidden-PvGXrYUY.js → hidden-DbgtYPOH.js} +1 -1
- package/dist/index.js +149 -145
- package/dist/{keyboard-mgWkd2Vh.js → keyboard-B0lm_zyn.js} +111 -114
- package/dist/{label-D4GFpe5F.js → label-y3ANLTNC.js} +2 -2
- package/dist/open-closed-CdldUPoq.js +86 -0
- package/dist/portal-WDFNoIMz.js +1908 -0
- package/dist/{use-active-press-CqLGIFz7.js → use-active-press-86hajhdd.js} +1 -1
- package/package.json +1 -1
- package/dist/combobox-BpYucpxz.js +0 -2896
- package/dist/open-closed-D2VjDhAN.js +0 -86
@@ -1,28 +1,24 @@
|
|
1
|
-
import { jsxs as A, Fragment as
|
2
|
-
import { c as
|
3
|
-
import
|
1
|
+
import { jsxs as A, Fragment as H, jsx as I } from "react/jsx-runtime";
|
2
|
+
import { c as v } from "../../index-DIxK0V-G.js";
|
3
|
+
import x, { createContext as K, useRef as oe, Fragment as re, useReducer as pe, useMemo as O, useId as se, useEffect as le, useState as ae, useContext as U, forwardRef as me } from "react";
|
4
4
|
import { AccordionItem as fe } from "./AccordionItem/AccordionItem.js";
|
5
|
-
import { EAccordionButtonType as
|
5
|
+
import { EAccordionButtonType as P, EAccordionSize as B, EAccordionLinkIconSize as J, EAccordionButtonStyle as _e, EAccordionIconType as Y, EAccordionButtonIconSize as Z } from "./constants.js";
|
6
6
|
import { useMediaQuery as ye } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
7
7
|
import { EMediaQuery as Ee } from "../../hooks/useMediaQuery/constants.js";
|
8
8
|
import { Icon as Se } from "../../icons/Icon.js";
|
9
9
|
import { Link as ke } from "../AnchorLink/Link.js";
|
10
|
-
import { M as ee, W as q, y as j, T as Ie, o as $, a as W, H as Q, I as ce, $ as be, b as
|
11
|
-
import { w as he } from "../../use-active-press-
|
12
|
-
import { e as
|
13
|
-
import { c as $e, i as R, u as
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
|
17
|
-
|
18
|
-
return b.createElement(Ce.Provider, { value: e }, t);
|
19
|
-
}
|
20
|
-
var ne;
|
21
|
-
let Be = (ne = b.startTransition) != null ? ne : function(e) {
|
10
|
+
import { M as ee, W as q, y as j, T as Ie, o as $, a as W, H as Q, I as ce, $ as be, b as xe, D as te, u as De, c as T } from "../../keyboard-B0lm_zyn.js";
|
11
|
+
import { w as he } from "../../use-active-press-86hajhdd.js";
|
12
|
+
import { e as ve } from "../../use-resolve-button-type-DhFdPxnv.js";
|
13
|
+
import { c as $e, i as R, u as ge, R as Pe, H as Te, s as we } from "../../open-closed-CdldUPoq.js";
|
14
|
+
import { C as Ne } from "../../close-provider-CEutdhG8.js";
|
15
|
+
import { r as Ce } from "../../bugs-diTMAGNw.js";
|
16
|
+
import '../../assets/Accordion.css';var ne;
|
17
|
+
let Ae = (ne = x.startTransition) != null ? ne : function(e) {
|
22
18
|
e();
|
23
19
|
};
|
24
|
-
var
|
25
|
-
let
|
20
|
+
var Be = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Be || {}), Oe = ((e) => (e[e.ToggleDisclosure = 0] = "ToggleDisclosure", e[e.CloseDisclosure = 1] = "CloseDisclosure", e[e.SetButtonId = 2] = "SetButtonId", e[e.SetPanelId = 3] = "SetPanelId", e[e.SetButtonElement = 4] = "SetButtonElement", e[e.SetPanelElement = 5] = "SetPanelElement", e))(Oe || {});
|
21
|
+
let Re = { 0: (e) => ({ ...e, disclosureState: W(e.disclosureState, { 0: 1, 1: 0 }) }), 1: (e) => e.disclosureState === 1 ? e : { ...e, disclosureState: 1 }, 2(e, t) {
|
26
22
|
return e.buttonId === t.buttonId ? e : { ...e, buttonId: t.buttonId };
|
27
23
|
}, 3(e, t) {
|
28
24
|
return e.panelId === t.panelId ? e : { ...e, panelId: t.panelId };
|
@@ -30,7 +26,7 @@ let Me = { 0: (e) => ({ ...e, disclosureState: W(e.disclosureState, { 0: 1, 1: 0
|
|
30
26
|
return e.buttonElement === t.element ? e : { ...e, buttonElement: t.element };
|
31
27
|
}, 5(e, t) {
|
32
28
|
return e.panelElement === t.element ? e : { ...e, panelElement: t.element };
|
33
|
-
} }, V =
|
29
|
+
} }, V = K(null);
|
34
30
|
V.displayName = "DisclosureContext";
|
35
31
|
function z(e) {
|
36
32
|
let t = U(V);
|
@@ -40,7 +36,7 @@ function z(e) {
|
|
40
36
|
}
|
41
37
|
return t;
|
42
38
|
}
|
43
|
-
let X =
|
39
|
+
let X = K(null);
|
44
40
|
X.displayName = "DisclosureAPIContext";
|
45
41
|
function ie(e) {
|
46
42
|
let t = U(X);
|
@@ -50,40 +46,40 @@ function ie(e) {
|
|
50
46
|
}
|
51
47
|
return t;
|
52
48
|
}
|
53
|
-
let G =
|
49
|
+
let G = K(null);
|
54
50
|
G.displayName = "DisclosurePanelContext";
|
55
|
-
function
|
51
|
+
function Me() {
|
56
52
|
return U(G);
|
57
53
|
}
|
58
|
-
function
|
59
|
-
return W(t.type,
|
54
|
+
function Fe(e, t) {
|
55
|
+
return W(t.type, Re, e, t);
|
60
56
|
}
|
61
|
-
let
|
62
|
-
function
|
63
|
-
let { defaultOpen: u = !1, ...p } = e,
|
64
|
-
|
65
|
-
}, e.as === void 0 || e.as === re)), a = pe(
|
57
|
+
let Le = re;
|
58
|
+
function He(e, t) {
|
59
|
+
let { defaultOpen: u = !1, ...p } = e, l = oe(null), m = j(t, Ie((c) => {
|
60
|
+
l.current = c;
|
61
|
+
}, e.as === void 0 || e.as === re)), a = pe(Fe, { disclosureState: u ? 0 : 1, buttonElement: null, panelElement: null, buttonId: null, panelId: null }), [{ disclosureState: n, buttonId: r }, y] = a, s = $((c) => {
|
66
62
|
y({ type: 1 });
|
67
|
-
let f =
|
63
|
+
let f = De(l);
|
68
64
|
if (!f || !r) return;
|
69
65
|
let _ = c ? c instanceof HTMLElement ? c : c.current instanceof HTMLElement ? c.current : f.getElementById(r) : f.getElementById(r);
|
70
66
|
_ == null || _.focus();
|
71
|
-
}),
|
72
|
-
return
|
67
|
+
}), b = O(() => ({ close: s }), [s]), E = O(() => ({ open: n === 0, close: s }), [n, s]), S = { ref: m };
|
68
|
+
return x.createElement(V.Provider, { value: a }, x.createElement(X.Provider, { value: b }, x.createElement(Ne, { value: s }, x.createElement($e, { value: W(n, { 0: R.Open, 1: R.Closed }) }, Q({ ourProps: S, theirProps: p, slot: E, defaultTag: Le, name: "Disclosure" })))));
|
73
69
|
}
|
74
|
-
let
|
75
|
-
function
|
76
|
-
let u =
|
77
|
-
if (!
|
70
|
+
let Ke = "button";
|
71
|
+
function Ue(e, t) {
|
72
|
+
let u = se(), { id: p = `headlessui-disclosure-button-${u}`, disabled: l = !1, autoFocus: m = !1, ...a } = e, [n, r] = z("Disclosure.Button"), y = Me(), s = y === null ? !1 : y === n.panelId, b = oe(null), E = j(b, t, $((i) => {
|
73
|
+
if (!s) return r({ type: 4, element: i });
|
78
74
|
})), S = ce();
|
79
|
-
|
80
|
-
if (!
|
75
|
+
le(() => {
|
76
|
+
if (!s) return r({ type: 2, buttonId: p }), () => {
|
81
77
|
r({ type: 2, buttonId: null });
|
82
78
|
};
|
83
|
-
}, [p, r,
|
79
|
+
}, [p, r, s]);
|
84
80
|
let c = $((i) => {
|
85
81
|
var o;
|
86
|
-
if (
|
82
|
+
if (s) {
|
87
83
|
if (n.disclosureState === 1) return;
|
88
84
|
switch (i.key) {
|
89
85
|
case T.Space:
|
@@ -105,85 +101,85 @@ function qe(e, t) {
|
|
105
101
|
}
|
106
102
|
}), _ = $((i) => {
|
107
103
|
var o;
|
108
|
-
|
109
|
-
}), { isFocusVisible:
|
110
|
-
return Q({ mergeRefs: S, ourProps:
|
104
|
+
Ce(i.currentTarget) || l || (s ? (r({ type: 0 }), (o = n.buttonElement) == null || o.focus()) : r({ type: 0 }));
|
105
|
+
}), { isFocusVisible: D, focusProps: h } = be({ autoFocus: m }), { isHovered: w, hoverProps: N } = xe({ isDisabled: l }), { pressed: k, pressProps: g } = he({ disabled: l }), M = O(() => ({ open: n.disclosureState === 0, hover: w, active: k, disabled: l, focus: D, autofocus: m }), [n, w, k, D, l, m]), C = ve(e, n.buttonElement), F = s ? te({ ref: E, type: C, disabled: l || void 0, autoFocus: m, onKeyDown: c, onClick: _ }, h, N, g) : te({ ref: E, id: p, type: C, "aria-expanded": n.disclosureState === 0, "aria-controls": n.panelElement ? n.panelId : void 0, disabled: l || void 0, autoFocus: m, onKeyDown: c, onKeyUp: f, onClick: _ }, h, N, g);
|
106
|
+
return Q({ mergeRefs: S, ourProps: F, theirProps: a, slot: M, defaultTag: Ke, name: "Disclosure.Button" });
|
111
107
|
}
|
112
|
-
let
|
113
|
-
function
|
114
|
-
let u =
|
115
|
-
|
116
|
-
}),
|
117
|
-
|
108
|
+
let qe = "div", je = ee.RenderStrategy | ee.Static;
|
109
|
+
function We(e, t) {
|
110
|
+
let u = se(), { id: p = `headlessui-disclosure-panel-${u}`, transition: l = !1, ...m } = e, [a, n] = z("Disclosure.Panel"), { close: r } = ie("Disclosure.Panel"), y = ce(), [s, b] = ae(null), E = j(t, $((h) => {
|
111
|
+
Ae(() => n({ type: 5, element: h }));
|
112
|
+
}), b);
|
113
|
+
le(() => (n({ type: 3, panelId: p }), () => {
|
118
114
|
n({ type: 3, panelId: null });
|
119
115
|
}), [p, n]);
|
120
|
-
let S =
|
121
|
-
return
|
116
|
+
let S = ge(), [c, f] = Pe(l, s, S !== null ? (S & R.Open) === R.Open : a.disclosureState === 0), _ = O(() => ({ open: a.disclosureState === 0, close: r }), [a.disclosureState, r]), D = { ref: E, id: p, ...Te(f) };
|
117
|
+
return x.createElement(we, null, x.createElement(G.Provider, { value: a.panelId }, Q({ mergeRefs: y, ourProps: D, theirProps: m, slot: _, defaultTag: qe, features: je, visible: c, name: "Disclosure.Panel" })));
|
122
118
|
}
|
123
|
-
let
|
124
|
-
const
|
125
|
-
icon:
|
119
|
+
let Qe = q(He), ue = q(Ue), de = q(We), Ve = Object.assign(Qe, { Button: ue, Panel: de });
|
120
|
+
const ze = "_icon_1yk0x_2", Xe = "_open_1yk0x_15", Ge = "_square_1yk0x_19", Je = "_circle_1yk0x_23", Ye = "_disabled_1yk0x_23", Ze = "_accordion_1yk0x_37", et = "_header_1yk0x_45", tt = "_title_1yk0x_61", nt = "_panel_1yk0x_88", ot = "_m_1yk0x_112", rt = "_s_1yk0x_19", d = {
|
121
|
+
icon: ze,
|
126
122
|
"icon-container": "_icon-container_1yk0x_8",
|
127
|
-
open:
|
128
|
-
square:
|
129
|
-
circle:
|
130
|
-
disabled:
|
131
|
-
accordion:
|
123
|
+
open: Xe,
|
124
|
+
square: Ge,
|
125
|
+
circle: Je,
|
126
|
+
disabled: Ye,
|
127
|
+
accordion: Ze,
|
132
128
|
"is-link": "_is-link_1yk0x_41",
|
133
|
-
header:
|
134
|
-
title:
|
129
|
+
header: et,
|
130
|
+
title: tt,
|
135
131
|
"title-uppercase": "_title-uppercase_1yk0x_64",
|
136
|
-
panel:
|
132
|
+
panel: nt,
|
137
133
|
"link-open": "_link-open_1yk0x_108",
|
138
|
-
m:
|
139
|
-
s:
|
134
|
+
m: ot,
|
135
|
+
s: rt,
|
140
136
|
"wrapper-button": "_wrapper-button_1yk0x_140"
|
141
137
|
}, It = me(
|
142
138
|
({
|
143
139
|
title: e,
|
144
140
|
disabled: t,
|
145
|
-
buttonType: u =
|
141
|
+
buttonType: u = P.BUTTON,
|
146
142
|
children: p,
|
147
|
-
showTitleByDefault:
|
143
|
+
showTitleByDefault: l = !0,
|
148
144
|
linkClassName: m,
|
149
145
|
size: a = B.M,
|
150
146
|
titleUppercase: n,
|
151
147
|
buttonStyle: r = _e.CIRCLE,
|
152
148
|
iconType: y = Y.ARROW,
|
153
|
-
classNameTitle:
|
154
|
-
classNameContent:
|
149
|
+
classNameTitle: s,
|
150
|
+
classNameContent: b,
|
155
151
|
classNameAccordion: E,
|
156
152
|
classNameIconButton: S,
|
157
153
|
subtitleNode: c,
|
158
154
|
onlyOpenSubtitleNode: f,
|
159
155
|
classNameSubtitleContainer: _
|
160
|
-
},
|
161
|
-
const [h, w] = ae(!1), N = ye(Ee.XS1), k = u ===
|
156
|
+
}, D) => {
|
157
|
+
const [h, w] = ae(!1), N = ye(Ee.XS1), k = u === P.LINK, g = {
|
162
158
|
[d["is-link"]]: k
|
163
|
-
},
|
159
|
+
}, M = () => {
|
164
160
|
t || w((o) => !o);
|
165
|
-
}, C = a === B.S ? J.S : J.M,
|
161
|
+
}, C = a === B.S ? J.S : J.M, F = (o) => ({
|
166
162
|
variant: "anchor",
|
167
163
|
size: N ? "s" : "l",
|
168
164
|
rightIcon: {
|
169
165
|
iconName: C,
|
170
|
-
className:
|
166
|
+
className: v({
|
171
167
|
[d["link-open"]]: o
|
172
168
|
})
|
173
169
|
}
|
174
170
|
}), i = (o) => {
|
175
|
-
const
|
171
|
+
const L = () => y === Y.DROPDOWN ? a === B.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px" : a === B.S ? Z.S : Z.M;
|
176
172
|
switch (u) {
|
177
|
-
case
|
173
|
+
case P.LINK:
|
178
174
|
return e;
|
179
|
-
case
|
180
|
-
return /* @__PURE__ */ A(
|
175
|
+
case P.BUTTON:
|
176
|
+
return /* @__PURE__ */ A(H, { children: [
|
181
177
|
/* @__PURE__ */ I(
|
182
178
|
"span",
|
183
179
|
{
|
184
|
-
className:
|
180
|
+
className: v(
|
185
181
|
d.title,
|
186
|
-
|
182
|
+
s,
|
187
183
|
n && d["title-uppercase"]
|
188
184
|
),
|
189
185
|
children: e
|
@@ -192,7 +188,7 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
192
188
|
/* @__PURE__ */ I(
|
193
189
|
"div",
|
194
190
|
{
|
195
|
-
className:
|
191
|
+
className: v(
|
196
192
|
d["icon-container"],
|
197
193
|
o && d.open,
|
198
194
|
t && d.disabled,
|
@@ -203,7 +199,7 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
203
199
|
children: /* @__PURE__ */ I(
|
204
200
|
Se,
|
205
201
|
{
|
206
|
-
iconName:
|
202
|
+
iconName: L(),
|
207
203
|
className: d.icon,
|
208
204
|
"data-testid": "accordion-icon"
|
209
205
|
}
|
@@ -215,44 +211,44 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
215
211
|
return null;
|
216
212
|
}
|
217
213
|
};
|
218
|
-
return /* @__PURE__ */ A(
|
214
|
+
return /* @__PURE__ */ A(H, { children: [
|
219
215
|
/* @__PURE__ */ I(
|
220
216
|
"div",
|
221
217
|
{
|
222
|
-
className:
|
218
|
+
className: v(
|
223
219
|
d.accordion,
|
224
220
|
d[a],
|
225
|
-
|
221
|
+
g,
|
226
222
|
E
|
227
223
|
),
|
228
|
-
children: /* @__PURE__ */ I(
|
229
|
-
(!o ||
|
224
|
+
children: /* @__PURE__ */ I(Ve, { ref: D, children: ({ open: o, close: L }) => /* @__PURE__ */ A(H, { children: [
|
225
|
+
(!o || l) && /* @__PURE__ */ I(
|
230
226
|
ue,
|
231
227
|
{
|
232
228
|
disabled: t,
|
233
|
-
as: k ? ke :
|
234
|
-
onClick:
|
235
|
-
className:
|
229
|
+
as: k ? ke : P.BUTTON,
|
230
|
+
onClick: M,
|
231
|
+
className: v({
|
236
232
|
[d.header]: !k,
|
237
233
|
[d.disabled]: t,
|
238
234
|
[m ?? ""]: k && m
|
239
235
|
}),
|
240
|
-
...k ?
|
241
|
-
children: (!o ||
|
236
|
+
...k ? F(o) : {},
|
237
|
+
children: (!o || l) && i(o)
|
242
238
|
}
|
243
239
|
),
|
244
240
|
o && /* @__PURE__ */ I(
|
245
241
|
de,
|
246
242
|
{
|
247
243
|
"data-testid": "accordion-panel",
|
248
|
-
className:
|
244
|
+
className: v(
|
249
245
|
d.panel,
|
250
|
-
|
251
|
-
|
246
|
+
b,
|
247
|
+
g
|
252
248
|
),
|
253
249
|
children: /* @__PURE__ */ I(fe, { size: a, children: typeof p == "function" ? p({
|
254
250
|
open: o,
|
255
|
-
close:
|
251
|
+
close: L
|
256
252
|
}) : p })
|
257
253
|
}
|
258
254
|
)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsxs as L, jsx as p } from "react/jsx-runtime";
|
2
|
-
import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-
|
2
|
+
import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-B0lm_zyn.js";
|
3
3
|
import h, { useId as J, useState as Q, useMemo as Y, useCallback as Z, forwardRef as ee } from "react";
|
4
|
-
import { w as re } from "../../use-active-press-
|
5
|
-
import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-
|
4
|
+
import { w as re } from "../../use-active-press-86hajhdd.js";
|
5
|
+
import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-y3ANLTNC.js";
|
6
6
|
import { r as be } from "../../bugs-diTMAGNw.js";
|
7
|
-
import { H as ue } from "../../field-
|
7
|
+
import { H as ue } from "../../field-FJ34aSs4.js";
|
8
8
|
import { c as me } from "../../index-DIxK0V-G.js";
|
9
9
|
import { Icon as fe } from "../../icons/Icon.js";
|
10
10
|
import '../../assets/CheckboxMimir.css';let pe = "span";
|
@@ -57,6 +57,10 @@ type TProps = {
|
|
57
57
|
* Дополнительный класс для header.
|
58
58
|
*/
|
59
59
|
classNameHeader?: string;
|
60
|
+
/**
|
61
|
+
* Дополнительный класс для content.
|
62
|
+
*/
|
63
|
+
classNameContent?: string;
|
60
64
|
/**
|
61
65
|
* Дополнительный класс для inner.
|
62
66
|
*/
|
@@ -77,5 +81,5 @@ type TProps = {
|
|
77
81
|
/**
|
78
82
|
* Компонент шторки, который может выезжать слева, справа или внизу.
|
79
83
|
*/
|
80
|
-
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children, classNameTitle, classNameHeader, classNameInner, classNameFooter, closeOnClickOutside, showCloseButton }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
84
|
+
export declare const Drawer: ({ isOpen, onClose, title, className, unmount, isLoading, stickyHeader, fullBottomHeight, position, paddingRight, footer, children, classNameTitle, classNameHeader, classNameInner, classNameContent, classNameFooter, closeOnClickOutside, showCloseButton }: PropsWithChildren<TProps>) => import("react/jsx-runtime").JSX.Element | null;
|
81
85
|
export {};
|
@@ -1,37 +1,37 @@
|
|
1
|
-
import { jsxs as m, jsx as t, Fragment as
|
1
|
+
import { jsxs as m, jsx as t, Fragment as Q } from "react/jsx-runtime";
|
2
2
|
import { c as s } from "../../index-DIxK0V-G.js";
|
3
|
-
import { useState as N, useRef as
|
3
|
+
import { useState as N, useRef as F, useCallback as u, useEffect as G } from "react";
|
4
4
|
import { EDrawerPosition as w } from "./constants.js";
|
5
|
-
import { useMediaQuery as
|
6
|
-
import { EMediaQuery as
|
7
|
-
import { useLockBodyScroll as
|
8
|
-
import { useResizeObserver as
|
5
|
+
import { useMediaQuery as H } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
6
|
+
import { EMediaQuery as K } from "../../hooks/useMediaQuery/constants.js";
|
7
|
+
import { useLockBodyScroll as V } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
|
8
|
+
import { useResizeObserver as W } from "../../hooks/useResizeObserver/useResizeObserver.js";
|
9
9
|
import { Button as k } 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 Y, EButtonSize as n } from "../Button/constants.js";
|
11
|
+
import { Loader as q } from "../Loader/Loader.js";
|
12
|
+
import { Portal as J } from "../Portal/Portal.js";
|
13
|
+
import '../../assets/Drawer.css';const U = "_drawer_1xs4d_3", Z = "_content_1xs4d_27", $ = "_header_1xs4d_45", O = "_title_1xs4d_59", ee = "_space_1xs4d_73", te = "_inner_1xs4d_84", oe = "_button_1xs4d_87", se = "_footer_1xs4d_92", re = "_left_1xs4d_105", ne = "_right_1xs4d_109", ae = "_full_1xs4d_113", ie = "_bottom_1xs4d_123", le = "_opened_1xs4d_140", ce = "_overlay_1xs4d_196", de = "_unmount_1xs4d_212", e = {
|
14
|
+
drawer: U,
|
15
|
+
content: Z,
|
16
16
|
"is-loading": "_is-loading_1xs4d_41",
|
17
|
-
header:
|
17
|
+
header: $,
|
18
18
|
"sticky-header": "_sticky-header_1xs4d_53",
|
19
|
-
title:
|
20
|
-
space:
|
21
|
-
inner:
|
22
|
-
button:
|
23
|
-
footer:
|
19
|
+
title: O,
|
20
|
+
space: ee,
|
21
|
+
inner: te,
|
22
|
+
button: oe,
|
23
|
+
footer: se,
|
24
24
|
"footer-button": "_footer-button_1xs4d_101",
|
25
|
-
left:
|
26
|
-
right:
|
27
|
-
full:
|
28
|
-
bottom:
|
25
|
+
left: re,
|
26
|
+
right: ne,
|
27
|
+
full: ae,
|
28
|
+
bottom: ie,
|
29
29
|
"full-bottom-height": "_full-bottom-height_1xs4d_134",
|
30
|
-
opened:
|
30
|
+
opened: le,
|
31
31
|
"is-closing": "_is-closing_1xs4d_159",
|
32
|
-
overlay:
|
33
|
-
unmount:
|
34
|
-
},
|
32
|
+
overlay: ce,
|
33
|
+
unmount: de
|
34
|
+
}, _e = 300, ke = ({
|
35
35
|
isOpen: r,
|
36
36
|
onClose: a,
|
37
37
|
title: E,
|
@@ -47,39 +47,40 @@ import '../../assets/Drawer.css';const J = "_drawer_1xs4d_3", U = "_content_1xs4
|
|
47
47
|
classNameTitle: C,
|
48
48
|
classNameHeader: D,
|
49
49
|
classNameInner: z,
|
50
|
-
|
50
|
+
classNameContent: L,
|
51
|
+
classNameFooter: R,
|
51
52
|
closeOnClickOutside: h = !0,
|
52
53
|
showCloseButton: x = !0
|
53
54
|
}) => {
|
54
|
-
const [p, y] = N(!1), [
|
55
|
+
const [p, y] = N(!1), [A, b] = N(!1), g = F(), d = H(K.XS1), { ref: X } = W({
|
55
56
|
enabled: l === w.BOTTOM
|
56
57
|
});
|
57
|
-
|
58
|
+
V({
|
58
59
|
on: r && !p,
|
59
60
|
paddingRight: S
|
60
61
|
});
|
61
62
|
const o = u(() => {
|
62
63
|
a && (y(!0), g.current = setTimeout(() => {
|
63
64
|
a(), y(!1);
|
64
|
-
},
|
65
|
-
}, [a]),
|
65
|
+
}, _e));
|
66
|
+
}, [a]), j = u(() => {
|
66
67
|
h && o();
|
67
68
|
}, [h, o]), _ = u(
|
68
|
-
(
|
69
|
-
|
69
|
+
(P) => {
|
70
|
+
P.key === "Escape" && o();
|
70
71
|
},
|
71
72
|
[o]
|
72
73
|
);
|
73
|
-
|
74
|
+
G(() => (r && (b(!0), window.addEventListener("keydown", _)), () => {
|
74
75
|
b(!1), clearTimeout(g.current), window.removeEventListener("keydown", _);
|
75
76
|
}), [r, _]);
|
76
77
|
const v = {
|
77
|
-
[e.opened]:
|
78
|
+
[e.opened]: A,
|
78
79
|
[e["is-closing"]]: p,
|
79
80
|
[e["full-bottom-height"]]: I,
|
80
81
|
[e["is-loading"]]: i
|
81
82
|
};
|
82
|
-
return !r && f ? null : /* @__PURE__ */ m(
|
83
|
+
return !r && f ? null : /* @__PURE__ */ m(J, { children: [
|
83
84
|
/* @__PURE__ */ t(
|
84
85
|
"div",
|
85
86
|
{
|
@@ -89,11 +90,11 @@ import '../../assets/Drawer.css';const J = "_drawer_1xs4d_3", U = "_content_1xs4
|
|
89
90
|
children: /* @__PURE__ */ t(
|
90
91
|
"section",
|
91
92
|
{
|
92
|
-
ref:
|
93
|
-
className: s(e.content, e[l], {
|
93
|
+
ref: X,
|
94
|
+
className: s(e.content, L, e[l], {
|
94
95
|
[e["is-loading"]]: !!i
|
95
96
|
}),
|
96
|
-
children: i ? /* @__PURE__ */ t(
|
97
|
+
children: i ? /* @__PURE__ */ t(q, {}) : /* @__PURE__ */ m(Q, { children: [
|
97
98
|
/* @__PURE__ */ m(
|
98
99
|
"header",
|
99
100
|
{
|
@@ -105,7 +106,7 @@ import '../../assets/Drawer.css';const J = "_drawer_1xs4d_3", U = "_content_1xs4
|
|
105
106
|
/* @__PURE__ */ t("div", { className: e.space, children: x && /* @__PURE__ */ t(
|
106
107
|
k,
|
107
108
|
{
|
108
|
-
variant:
|
109
|
+
variant: Y.SecondaryWhite,
|
109
110
|
isIconButton: !0,
|
110
111
|
size: d ? n.S : n.M,
|
111
112
|
iconName: "Close16px",
|
@@ -117,7 +118,7 @@ import '../../assets/Drawer.css';const J = "_drawer_1xs4d_3", U = "_content_1xs4
|
|
117
118
|
}
|
118
119
|
),
|
119
120
|
/* @__PURE__ */ t("div", { className: s(e.inner, z), children: T }),
|
120
|
-
/* @__PURE__ */ t("footer", { className: s(e.footer,
|
121
|
+
/* @__PURE__ */ t("footer", { className: s(e.footer, R), children: typeof c == "function" ? c({ handleClose: o }) : c || x && /* @__PURE__ */ t(
|
121
122
|
k,
|
122
123
|
{
|
123
124
|
size: d ? n.M : n.XXL,
|
@@ -143,12 +144,12 @@ import '../../assets/Drawer.css';const J = "_drawer_1xs4d_3", U = "_content_1xs4
|
|
143
144
|
v
|
144
145
|
),
|
145
146
|
"data-testid": "drawer-overlay",
|
146
|
-
onClick:
|
147
|
+
onClick: j
|
147
148
|
}
|
148
149
|
)
|
149
150
|
] });
|
150
151
|
};
|
151
152
|
export {
|
152
|
-
|
153
|
-
|
153
|
+
_e as ANIMATION_DELAY,
|
154
|
+
ke as Drawer
|
154
155
|
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { PopoverProps, PopoverPanelProps } from '@headlessui/react';
|
2
|
+
import { ReactNode } from 'react';
|
3
|
+
|
4
|
+
export declare const ANIMATION_DELAY = 300;
|
5
|
+
type TProps = {
|
6
|
+
/**
|
7
|
+
* Пропсы для Popover
|
8
|
+
*/
|
9
|
+
popoverProps?: PopoverProps;
|
10
|
+
/**
|
11
|
+
* Позиция выпадающего меню относительно кнопки.
|
12
|
+
*/
|
13
|
+
position?: PopoverPanelProps['anchor'];
|
14
|
+
/**
|
15
|
+
* Компонент при клике на который выпадающее меню открывается.
|
16
|
+
*/
|
17
|
+
buttonContent?: ReactNode;
|
18
|
+
/**
|
19
|
+
* Компонент выпадающего меню.
|
20
|
+
*/
|
21
|
+
children?: ReactNode | ((props: {
|
22
|
+
close: VoidFunction;
|
23
|
+
}) => JSX.Element);
|
24
|
+
/**
|
25
|
+
* Дополнительный класс для компонента.
|
26
|
+
*/
|
27
|
+
className?: string;
|
28
|
+
/**
|
29
|
+
* Дополнительный класс для кнопки.
|
30
|
+
*/
|
31
|
+
buttonClassName?: string;
|
32
|
+
/**
|
33
|
+
* Дополнительный класс для панели.
|
34
|
+
*/
|
35
|
+
panelClassName?: string;
|
36
|
+
/**
|
37
|
+
* Дополнительный класс для меню.
|
38
|
+
*/
|
39
|
+
menuItemsClassName?: string;
|
40
|
+
};
|
41
|
+
/**
|
42
|
+
* Компонент Dropdown, содержит в себе кнопку и панель выпадающего меню
|
43
|
+
*/
|
44
|
+
export declare const Dropdown: import('react').MemoExoticComponent<({ children, position, popoverProps, className, buttonClassName, panelClassName, menuItemsClassName, buttonContent }: TProps) => import("react/jsx-runtime").JSX.Element>;
|
45
|
+
export {};
|