mimir-ui-kit 1.43.17 → 1.43.19

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.
@@ -1,38 +1,41 @@
1
- import { jsxs as f, Fragment as I, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as a, Fragment as oe, jsx as t } from "react/jsx-runtime";
2
2
  import { c as n } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as q, useState as M, useRef as J, useCallback as h, useEffect as U } from "react";
4
- import { EDrawerPosition as O } from "./constants.js";
5
- import { useContainer as Z } from "./hooks.js";
6
- import { useMediaQuery as $ } from "../../hooks/useMediaQuery/useMediaQuery.js";
7
- import { EMediaQuery as ee } from "../../hooks/useMediaQuery/constants.js";
8
- import { useLockBodyScroll as te } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
9
- import { useResizeObserver as oe } from "../../hooks/useResizeObserver/useResizeObserver.js";
10
- import { Button as S } from "../Button/Button.js";
11
- import { EButtonVariantDefault as ne, EButtonSize as r } from "../Button/constants.js";
12
- import { Loader as se } from "../Loader/Loader.js";
13
- import { Portal as re } from "../Portal/Portal.js";
14
- import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13ua6_26", le = "_header_13ua6_44", ce = "_title_13ua6_58", ue = "_space_13ua6_72", de = "_inner_13ua6_83", me = "_button_13ua6_86", _e = "_footer_13ua6_91", fe = "_left_13ua6_104", he = "_right_13ua6_108", pe = "_full_13ua6_112", ye = "_bottom_13ua6_122", ge = "_opened_13ua6_139", Ce = "_overlay_13ua6_195", ve = "_unmount_13ua6_211", e = {
15
- drawer: ae,
16
- content: ie,
17
- "is-loading": "_is-loading_13ua6_40",
18
- header: le,
19
- "sticky-header": "_sticky-header_13ua6_52",
20
- title: ce,
21
- space: ue,
22
- inner: de,
23
- button: me,
24
- footer: _e,
25
- "footer-button": "_footer-button_13ua6_100",
26
- left: fe,
27
- right: he,
28
- full: pe,
29
- bottom: ye,
30
- "full-bottom-height": "_full-bottom-height_13ua6_133",
31
- opened: ge,
32
- "is-closing": "_is-closing_13ua6_158",
33
- overlay: Ce,
34
- unmount: ve
35
- }, Ne = 300, be = (a) => a ? {
3
+ import { forwardRef as ne, useState as z, useRef as L, useEffect as M, useCallback as g } from "react";
4
+ import { EDrawerPosition as R } from "./constants.js";
5
+ import { useContainer as re } from "./hooks.js";
6
+ import { ScrollWrapper as se } from "./ScrollWrapper/index.js";
7
+ import { useMediaQuery as ie } from "../../hooks/useMediaQuery/useMediaQuery.js";
8
+ import { EMediaQuery as le } from "../../hooks/useMediaQuery/constants.js";
9
+ import { useLockBodyScroll as ae } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
10
+ import { useResizeObserver as ce } from "../../hooks/useResizeObserver/useResizeObserver.js";
11
+ import { Button as H } from "../Button/Button.js";
12
+ import { EButtonVariantDefault as ue, EButtonSize as c } from "../Button/constants.js";
13
+ import { Loader as me } from "../Loader/Loader.js";
14
+ import { Portal as de } from "../Portal/Portal.js";
15
+ import { EScrollBarVariant as fe, EScrollBarSize as _e } from "../ScrollBar/constants.js";
16
+ import '../../assets/Drawer.css';const he = "_drawer_14uzm_2", pe = "_content_14uzm_26", ze = "_header_14uzm_45", ge = "_title_14uzm_59", ye = "_space_14uzm_73", ve = "_inner_14uzm_84", be = "_button_14uzm_95", Ce = "_footer_14uzm_100", we = "_left_14uzm_116", Ne = "_right_14uzm_120", ke = "_full_14uzm_124", Se = "_bottom_14uzm_134", Be = "_opened_14uzm_151", Ee = "_overlay_14uzm_207", Ie = "_unmount_14uzm_223", e = {
17
+ drawer: he,
18
+ content: pe,
19
+ "is-loading": "_is-loading_14uzm_41",
20
+ header: ze,
21
+ "sticky-header": "_sticky-header_14uzm_53",
22
+ title: ge,
23
+ space: ye,
24
+ inner: ve,
25
+ button: be,
26
+ footer: Ce,
27
+ "has-scroll": "_has-scroll_14uzm_109",
28
+ "footer-button": "_footer-button_14uzm_112",
29
+ left: we,
30
+ right: Ne,
31
+ full: ke,
32
+ bottom: Se,
33
+ "full-bottom-height": "_full-bottom-height_14uzm_145",
34
+ opened: Be,
35
+ "is-closing": "_is-closing_14uzm_170",
36
+ overlay: Ee,
37
+ unmount: Ie
38
+ }, Oe = 300, Le = (u) => u ? {
36
39
  drawer: {
37
40
  position: "absolute",
38
41
  zIndex: 100
@@ -41,120 +44,157 @@ import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13
41
44
  position: "absolute",
42
45
  zIndex: 90
43
46
  }
44
- } : {}, Ae = q(
45
- (a, L) => {
47
+ } : {}, Ye = ne(
48
+ (u, T) => {
46
49
  const {
47
- as: R = "div",
48
- isOpen: s,
49
- onClose: i,
50
- title: T,
51
- className: x,
52
- unmount: p = !0,
53
- isLoading: l = !1,
54
- stickyHeader: z,
55
- fullBottomHeight: D = !1,
56
- position: c = O.RIGHT,
57
- paddingRight: A = 8,
58
- footer: u,
59
- children: H,
60
- classNameTitle: P,
61
- classNameHeader: X,
62
- classNameInner: j,
63
- classNameContent: F,
64
- classNameFooter: Q,
65
- closeOnClickOutside: y = !0,
66
- showCloseButton: g = !0,
67
- getContainer: d,
68
- ...G
69
- } = a, [C, v] = M(!1), [K, N] = M(!1), b = J(), m = $(ee.XS1), { ref: V } = oe({
70
- enabled: c === O.BOTTOM
71
- }), w = Z(d);
72
- te({
73
- on: s && !C,
74
- paddingRight: A
50
+ as: x = "div",
51
+ isOpen: r,
52
+ onClose: m,
53
+ title: D,
54
+ className: A,
55
+ unmount: y = !0,
56
+ isLoading: s = !1,
57
+ stickyHeader: P,
58
+ fullBottomHeight: X = !1,
59
+ position: d = R.RIGHT,
60
+ paddingRight: j = 8,
61
+ footer: f,
62
+ children: F,
63
+ classNameTitle: G,
64
+ classNameHeader: Q,
65
+ classNameInner: V,
66
+ classNameContent: W,
67
+ classNameFooter: K,
68
+ closeOnClickOutside: v = !0,
69
+ showCloseButton: b = !0,
70
+ getContainer: _,
71
+ ...Y
72
+ } = u, [C, w] = z(!1), [q, N] = z(!1), k = L(), h = ie(le.XS1), { ref: J } = ce({
73
+ enabled: d === R.BOTTOM
74
+ }), S = re(_), i = L(null), [U, Z] = z(!1);
75
+ M(() => {
76
+ const l = () => {
77
+ if (i.current) {
78
+ const { scrollHeight: ee, clientHeight: te } = i.current;
79
+ Z(ee > te);
80
+ }
81
+ };
82
+ l();
83
+ const O = new ResizeObserver(l);
84
+ return i.current && O.observe(i.current), () => {
85
+ O.disconnect();
86
+ };
87
+ }, [r, s]), ae({
88
+ on: r && !C,
89
+ paddingRight: j
75
90
  });
76
- const o = h(() => {
77
- i && (v(!0), b.current = setTimeout(() => {
78
- i(), v(!1);
79
- }, Ne));
80
- }, [i]), W = h(() => {
81
- y && o();
82
- }, [y, o]), _ = h(
83
- (Y) => {
84
- Y.key === "Escape" && o();
91
+ const o = g(() => {
92
+ m && (w(!0), k.current = setTimeout(() => {
93
+ m(), w(!1);
94
+ }, Oe));
95
+ }, [m]), $ = g(() => {
96
+ v && o();
97
+ }, [v, o]), p = g(
98
+ (l) => {
99
+ l.key === "Escape" && o();
85
100
  },
86
101
  [o]
87
102
  );
88
- U(() => (s && (N(!0), window.addEventListener("keydown", _)), () => {
89
- N(!1), clearTimeout(b.current), window.removeEventListener("keydown", _);
90
- }), [s, _]);
91
- const k = {
92
- [e.opened]: K,
103
+ M(() => (r && (N(!0), window.addEventListener("keydown", p)), () => {
104
+ N(!1), clearTimeout(k.current), window.removeEventListener("keydown", p);
105
+ }), [r, p]);
106
+ const B = {
107
+ [e.opened]: q,
93
108
  [e["is-closing"]]: C,
94
- [e["full-bottom-height"]]: D,
95
- [e["is-loading"]]: l
109
+ [e["full-bottom-height"]]: X,
110
+ [e["is-loading"]]: s
96
111
  };
97
- if (!s && p)
112
+ if (!r && y)
98
113
  return null;
99
- const B = be(d !== void 0 && d !== !1), E = /* @__PURE__ */ f(I, { children: [
100
- /* @__PURE__ */ t(
101
- R,
114
+ const E = Le(_ !== void 0 && _ !== !1), I = /* @__PURE__ */ a(oe, { children: [
115
+ /* @__PURE__ */ a(
116
+ x,
102
117
  {
103
- ref: L,
104
- "aria-hidden": !s,
118
+ ref: T,
119
+ "aria-hidden": !r,
105
120
  role: "dialog",
106
- style: B.drawer,
107
- className: n(e.drawer, e[c], k, x),
108
- ...G,
109
- children: /* @__PURE__ */ t(
110
- "section",
111
- {
112
- ref: V,
113
- className: n(
114
- e.content,
115
- F,
116
- e[c],
117
- {
118
- [e["is-loading"]]: !!l
119
- }
120
- ),
121
- children: l ? /* @__PURE__ */ t(se, {}) : /* @__PURE__ */ f(I, { children: [
122
- /* @__PURE__ */ f(
123
- "header",
121
+ style: E.drawer,
122
+ className: n(e.drawer, e[d], B, A),
123
+ ...Y,
124
+ children: [
125
+ /* @__PURE__ */ a(
126
+ "section",
127
+ {
128
+ ref: J,
129
+ className: n(
130
+ e.content,
131
+ W,
132
+ e[d],
124
133
  {
125
- className: n(e.header, X, {
126
- [e["sticky-header"]]: z
127
- }),
128
- children: [
129
- /* @__PURE__ */ t("h2", { className: n(e.title, P), children: T }),
130
- /* @__PURE__ */ t("div", { className: e.space, children: g && /* @__PURE__ */ t(
131
- S,
132
- {
133
- variant: ne.SecondaryWhite,
134
- isIconButton: !0,
135
- size: m ? r.S : r.M,
136
- iconName: "Close16px",
137
- onClick: o,
138
- className: e.button
139
- }
140
- ) })
141
- ]
134
+ [e["is-loading"]]: !!s
142
135
  }
143
136
  ),
144
- /* @__PURE__ */ t("div", { className: n(e.inner, j), children: H }),
145
- /* @__PURE__ */ t("footer", { className: n(e.footer, Q), children: typeof u == "function" ? u({ handleClose: o }) : u || g && /* @__PURE__ */ t(
146
- S,
137
+ children: [
138
+ /* @__PURE__ */ a(
139
+ "header",
140
+ {
141
+ className: n(e.header, Q, {
142
+ [e["sticky-header"]]: P
143
+ }),
144
+ children: [
145
+ /* @__PURE__ */ t("h2", { className: n(e.title, G), children: D }),
146
+ /* @__PURE__ */ t("div", { className: e.space, children: b && /* @__PURE__ */ t(
147
+ H,
148
+ {
149
+ variant: ue.SecondaryWhite,
150
+ isIconButton: !0,
151
+ size: h ? c.S : c.M,
152
+ iconName: "Close16px",
153
+ onClick: o,
154
+ className: e.button
155
+ }
156
+ ) })
157
+ ]
158
+ }
159
+ ),
160
+ /* @__PURE__ */ t(
161
+ se,
162
+ {
163
+ ref: i,
164
+ className: n(
165
+ e.inner,
166
+ {
167
+ [e["is-loading"]]: !!s
168
+ },
169
+ V
170
+ ),
171
+ variant: fe.LIGHT,
172
+ size: _e.M,
173
+ children: s ? /* @__PURE__ */ t(me, {}) : F
174
+ }
175
+ )
176
+ ]
177
+ }
178
+ ),
179
+ /* @__PURE__ */ t(
180
+ "footer",
181
+ {
182
+ className: n(e.footer, K, {
183
+ [e["has-scroll"]]: U
184
+ }),
185
+ children: typeof f == "function" ? f({ handleClose: o }) : f || b && /* @__PURE__ */ t(
186
+ H,
147
187
  {
148
- size: m ? r.M : r.XXL,
149
- full: m,
188
+ size: h ? c.L : c.XXL,
189
+ full: h,
150
190
  onClick: o,
151
191
  className: e["footer-button"],
152
192
  children: "Закрыть"
153
193
  }
154
- ) })
155
- ] })
156
- }
157
- )
194
+ )
195
+ }
196
+ )
197
+ ]
158
198
  }
159
199
  ),
160
200
  /* @__PURE__ */ t(
@@ -163,20 +203,20 @@ import '../../assets/Drawer.css';const ae = "_drawer_13ua6_2", ie = "_content_13
163
203
  className: n(
164
204
  e.overlay,
165
205
  {
166
- [e.unmount]: !p
206
+ [e.unmount]: !y
167
207
  },
168
- k
208
+ B
169
209
  ),
170
- style: B.overlay,
210
+ style: E.overlay,
171
211
  "data-testid": "drawer-overlay",
172
- onClick: W
212
+ onClick: $
173
213
  }
174
214
  )
175
215
  ] });
176
- return w === !1 ? E : /* @__PURE__ */ t(re, { element: w, children: E });
216
+ return S === !1 ? I : /* @__PURE__ */ t(de, { element: S, children: I });
177
217
  }
178
218
  );
179
219
  export {
180
- Ne as ANIMATION_DELAY,
181
- Ae as Drawer
220
+ Oe as ANIMATION_DELAY,
221
+ Ye as Drawer
182
222
  };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { EScrollBarSize, EScrollBarVariant } from '../../ScrollBar/constants';
3
+
4
+ type TProps = {
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ variant?: `${EScrollBarVariant}`;
8
+ size?: `${EScrollBarSize}`;
9
+ };
10
+ export declare const ScrollWrapper: React.ForwardRefExoticComponent<TProps & React.RefAttributes<HTMLDivElement>>;
11
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { c as t } from "../../../index-DIxK0V-G.js";
3
+ import { forwardRef as i } from "react";
4
+ import { EScrollBarVariant as e, EScrollBarSize as m } from "../../ScrollBar/constants.js";
5
+ import '../../../assets/index2.css';const n = {
6
+ "scroll-container": "_scroll-container_7yixd_2"
7
+ }, p = i(
8
+ ({
9
+ children: r,
10
+ className: a,
11
+ variant: o = e.LIGHT,
12
+ size: l = m.M
13
+ }, c) => /* @__PURE__ */ s(
14
+ "div",
15
+ {
16
+ ref: c,
17
+ className: t(n["scroll-container"], a),
18
+ "data-variant": o,
19
+ "data-size": l,
20
+ children: r
21
+ }
22
+ )
23
+ );
24
+ p.displayName = "ScrollWrapper";
25
+ export {
26
+ p as ScrollWrapper
27
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.43.17",
4
+ "version": "1.43.19",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {