mimir-ui-kit 1.64.4 → 1.65.0

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,42 +1,43 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { c as r } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as se, useState as C, useRef as x, useEffect as D, useCallback as w } from "react";
1
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import { c as n } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as re, useState as C, useRef as x, useEffect as D, useCallback as w } from "react";
4
4
  import { EDrawerPosition as A } from "./constants.js";
5
- import { useContainer as ne } from "./hooks.js";
5
+ import { useContainer as se } from "./hooks.js";
6
6
  import { ScrollWrapper as ie } from "./ScrollWrapper/index.js";
7
- import { useMediaQuery as ce } from "../../hooks/useMediaQuery/useMediaQuery.js";
7
+ import { useMediaQuery as ae } from "../../hooks/useMediaQuery/useMediaQuery.js";
8
8
  import { EMediaQuery as le } from "../../hooks/useMediaQuery/constants.js";
9
- import { useLockBodyScroll as ae } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
9
+ import { useLockBodyScroll as ce } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
10
10
  import { useResizeObserver as ue } from "../../hooks/useResizeObserver/useResizeObserver.js";
11
11
  import { Button as P } from "../Button/Button.js";
12
12
  import { EButtonVariantDefault as de, EButtonSize as u } from "../Button/constants.js";
13
13
  import { Loader as me } from "../Loader/Loader.js";
14
- import { Portal as fe } from "../Portal/Portal.js";
15
- import { EScrollBarVariant as _e, EScrollBarSize as pe } from "../ScrollBar/constants.js";
16
- import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_drawer_zs4pc_2", Ce = "_content_zs4pc_31", we = "_header_zs4pc_46", ye = "_title_zs4pc_60", ge = "_space_zs4pc_74", ve = "_inner_zs4pc_85", be = "_button_zs4pc_101", Ne = "_footer_zs4pc_106", ke = "_left_zs4pc_122", Se = "_right_zs4pc_126", Be = "_full_zs4pc_130", Ee = "_bottom_zs4pc_140", Oe = "_opened_zs4pc_157", Le = "_overlay_zs4pc_213", He = "_unmount_zs4pc_231", e = {
14
+ import { Portal as _e } from "../Portal/Portal.js";
15
+ import { EScrollBarVariant as fe, EScrollBarSize as be } from "../ScrollBar/constants.js";
16
+ import '../../assets/Drawer.css';const he = "_drawerContainer_abn3o_2", pe = "_drawer_abn3o_2", Ce = "_content_abn3o_31", we = "_header_abn3o_46", ye = "_title_abn3o_60", ge = "_space_abn3o_74", ve = "_inner_abn3o_85", Ne = "_button_abn3o_101", ke = "_footer_abn3o_106", Se = "_left_abn3o_122", Be = "_right_abn3o_126", Ee = "_center_abn3o_130", ze = "_full_abn3o_139", Oe = "_bottom_abn3o_149", Le = "_opened_abn3o_166", He = "_overlay_abn3o_230", xe = "_unmount_abn3o_248", e = {
17
17
  drawerContainer: he,
18
- drawer: ze,
18
+ drawer: pe,
19
19
  content: Ce,
20
20
  header: we,
21
- "sticky-header": "_sticky-header_zs4pc_54",
21
+ "sticky-header": "_sticky-header_abn3o_54",
22
22
  title: ye,
23
23
  space: ge,
24
24
  inner: ve,
25
- "is-loading": "_is-loading_zs4pc_90",
26
- button: be,
27
- footer: Ne,
28
- "has-scroll": "_has-scroll_zs4pc_115",
29
- "footer-button": "_footer-button_zs4pc_118",
30
- left: ke,
31
- right: Se,
32
- full: Be,
33
- bottom: Ee,
34
- "full-bottom-height": "_full-bottom-height_zs4pc_151",
35
- opened: Oe,
36
- "is-closing": "_is-closing_zs4pc_176",
37
- overlay: Le,
38
- unmount: He
39
- }, xe = 300, De = (d) => d ? {
25
+ "is-loading": "_is-loading_abn3o_90",
26
+ button: Ne,
27
+ footer: ke,
28
+ "has-scroll": "_has-scroll_abn3o_115",
29
+ "footer-button": "_footer-button_abn3o_118",
30
+ left: Se,
31
+ right: Be,
32
+ center: Ee,
33
+ full: ze,
34
+ bottom: Oe,
35
+ "full-bottom-height": "_full-bottom-height_abn3o_160",
36
+ opened: Le,
37
+ "is-closing": "_is-closing_abn3o_189",
38
+ overlay: He,
39
+ unmount: xe
40
+ }, De = 300, Ae = (d) => d ? {
40
41
  drawer: {
41
42
  position: "absolute",
42
43
  zIndex: 100
@@ -45,11 +46,11 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
45
46
  position: "absolute",
46
47
  zIndex: 90
47
48
  }
48
- } : {}, Ue = se(
49
+ } : {}, Ze = re(
49
50
  (d, X) => {
50
51
  const {
51
52
  as: j = "div",
52
- isOpen: n,
53
+ isOpen: s,
53
54
  onClose: m,
54
55
  title: G,
55
56
  className: Q,
@@ -57,9 +58,9 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
57
58
  isLoading: i = !1,
58
59
  stickyHeader: V,
59
60
  fullBottomHeight: W = !1,
60
- position: f = A.RIGHT,
61
+ position: _ = A.RIGHT,
61
62
  paddingRight: F = 8,
62
- footer: _,
63
+ footer: f,
63
64
  children: I,
64
65
  classNameTitle: K,
65
66
  classNameHeader: Y,
@@ -69,88 +70,88 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
69
70
  classNameFooter: R,
70
71
  closeOnClickOutside: g = !0,
71
72
  showCloseButton: v = !0,
72
- getContainer: p,
73
+ getContainer: b,
73
74
  dataTestIdReactMap: o,
74
75
  ...U
75
- } = d, [b, N] = C(!1), [Z, k] = C(!1), S = x(), h = ce(le.XS1), { ref: $ } = ue({
76
- enabled: f === A.BOTTOM
77
- }), B = ne(p), c = x(null), [T, ee] = C(!1);
76
+ } = d, [N, k] = C(!1), [Z, S] = C(!1), B = x(), h = ae(le.XS1), { ref: $ } = ue({
77
+ enabled: _ === A.BOTTOM
78
+ }), E = se(b), a = x(null), [T, ee] = C(!1);
78
79
  D(() => {
79
80
  const l = () => {
80
- if (c.current) {
81
- const { scrollHeight: te, clientHeight: re } = c.current;
82
- ee(te > re);
81
+ if (a.current) {
82
+ const { scrollHeight: te, clientHeight: ne } = a.current;
83
+ ee(te > ne);
83
84
  }
84
85
  };
85
86
  l();
86
87
  const H = new ResizeObserver(l);
87
- return c.current && H.observe(c.current), () => {
88
+ return a.current && H.observe(a.current), () => {
88
89
  H.disconnect();
89
90
  };
90
- }, [n, i]), ae({
91
- on: n && !b,
91
+ }, [s, i]), ce({
92
+ on: s && !N,
92
93
  paddingRight: F
93
94
  });
94
- const s = w(() => {
95
- m && (N(!0), S.current = setTimeout(() => {
96
- m(), N(!1);
97
- }, xe));
95
+ const r = w(() => {
96
+ m && (k(!0), B.current = setTimeout(() => {
97
+ m(), k(!1);
98
+ }, De));
98
99
  }, [m]), oe = w(() => {
99
- g && s();
100
- }, [g, s]), z = w(
100
+ g && r();
101
+ }, [g, r]), p = w(
101
102
  (l) => {
102
- l.key === "Escape" && s();
103
+ l.key === "Escape" && r();
103
104
  },
104
- [s]
105
+ [r]
105
106
  );
106
- D(() => (n && (k(!0), window.addEventListener("keydown", z)), () => {
107
- k(!1), clearTimeout(S.current), window.removeEventListener("keydown", z);
108
- }), [n, z]);
109
- const E = {
107
+ D(() => (s && (S(!0), window.addEventListener("keydown", p)), () => {
108
+ S(!1), clearTimeout(B.current), window.removeEventListener("keydown", p);
109
+ }), [s, p]);
110
+ const z = {
110
111
  [e.opened]: Z,
111
- [e["is-closing"]]: b,
112
+ [e["is-closing"]]: N,
112
113
  [e["full-bottom-height"]]: W,
113
114
  [e["is-loading"]]: i
114
115
  };
115
- if (!n && y)
116
+ if (!s && y)
116
117
  return null;
117
- const O = De(p !== void 0 && p !== !1), L = /* @__PURE__ */ a(
118
+ const O = Ae(b !== void 0 && b !== !1), L = /* @__PURE__ */ c(
118
119
  "div",
119
120
  {
120
121
  "data-testid-react": o == null ? void 0 : o.drawer,
121
- className: r(e.drawerContainer, J),
122
+ className: n(e.drawerContainer, J),
122
123
  children: [
123
- /* @__PURE__ */ a(
124
+ /* @__PURE__ */ c(
124
125
  j,
125
126
  {
126
127
  ref: X,
127
- "aria-hidden": !n,
128
+ "aria-hidden": !s,
128
129
  role: "dialog",
129
130
  style: O.drawer,
130
- className: r(e.drawer, e[f], E, Q),
131
+ className: n(e.drawer, e[_], z, Q),
131
132
  ...U,
132
133
  children: [
133
- /* @__PURE__ */ a(
134
+ /* @__PURE__ */ c(
134
135
  "section",
135
136
  {
136
137
  ref: $,
137
- className: r(
138
+ className: n(
138
139
  e.content,
139
140
  M,
140
- e[f],
141
+ e[_],
141
142
  {
142
143
  [e["is-loading"]]: !!i
143
144
  }
144
145
  ),
145
146
  children: [
146
- /* @__PURE__ */ a(
147
+ /* @__PURE__ */ c(
147
148
  "header",
148
149
  {
149
- className: r(e.header, Y, {
150
+ className: n(e.header, Y, {
150
151
  [e["sticky-header"]]: V
151
152
  }),
152
153
  children: [
153
- /* @__PURE__ */ t("h2", { className: r(e.title, K), children: G }),
154
+ /* @__PURE__ */ t("h2", { className: n(e.title, K), children: G }),
154
155
  /* @__PURE__ */ t("div", { className: e.space, children: v && /* @__PURE__ */ t(
155
156
  P,
156
157
  {
@@ -159,7 +160,7 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
159
160
  isIconButton: !0,
160
161
  size: h ? u.S : u.M,
161
162
  iconName: "Close16px",
162
- onClick: s,
163
+ onClick: r,
163
164
  className: e.button
164
165
  }
165
166
  ) })
@@ -169,16 +170,16 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
169
170
  /* @__PURE__ */ t(
170
171
  ie,
171
172
  {
172
- ref: c,
173
- className: r(
173
+ ref: a,
174
+ className: n(
174
175
  e.inner,
175
176
  {
176
177
  [e["is-loading"]]: !!i
177
178
  },
178
179
  q
179
180
  ),
180
- variant: _e.LIGHT,
181
- size: pe.M,
181
+ variant: fe.LIGHT,
182
+ size: be.M,
182
183
  children: i ? /* @__PURE__ */ t(me, {}) : I
183
184
  }
184
185
  )
@@ -189,16 +190,16 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
189
190
  "footer",
190
191
  {
191
192
  "data-testid-react": o == null ? void 0 : o.footer,
192
- className: r(e.footer, R, {
193
+ className: n(e.footer, R, {
193
194
  [e["has-scroll"]]: T
194
195
  }),
195
- children: typeof _ == "function" ? _({ handleClose: s }) : _ || v && /* @__PURE__ */ t(
196
+ children: typeof f == "function" ? f({ handleClose: r }) : f || v && /* @__PURE__ */ t(
196
197
  P,
197
198
  {
198
199
  "data-testid-react": o == null ? void 0 : o.footerCloseButton,
199
200
  size: h ? u.L : u.XXL,
200
201
  full: h,
201
- onClick: s,
202
+ onClick: r,
202
203
  className: e["footer-button"],
203
204
  children: "Закрыть"
204
205
  }
@@ -212,12 +213,12 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
212
213
  "div",
213
214
  {
214
215
  "data-testid-react": o == null ? void 0 : o.overlay,
215
- className: r(
216
+ className: n(
216
217
  e.overlay,
217
218
  {
218
219
  [e.unmount]: !y
219
220
  },
220
- E
221
+ z
221
222
  ),
222
223
  style: O.overlay,
223
224
  "data-testid": "drawer-overlay",
@@ -227,10 +228,10 @@ import '../../assets/Drawer.css';const he = "_drawerContainer_zs4pc_2", ze = "_d
227
228
  ]
228
229
  }
229
230
  );
230
- return B === !1 ? L : /* @__PURE__ */ t(fe, { element: B, children: L });
231
+ return E === !1 ? L : /* @__PURE__ */ t(_e, { element: E, children: L });
231
232
  }
232
233
  );
233
234
  export {
234
- xe as ANIMATION_DELAY,
235
- Ue as Drawer
235
+ De as ANIMATION_DELAY,
236
+ Ze as Drawer
236
237
  };
@@ -2,5 +2,6 @@ export declare enum EDrawerPosition {
2
2
  LEFT = "left",
3
3
  RIGHT = "right",
4
4
  BOTTOM = "bottom",
5
- FULL = "full"
5
+ FULL = "full",
6
+ CENTER = "center"
6
7
  }
@@ -1,4 +1,4 @@
1
- var l = /* @__PURE__ */ ((T) => (T.LEFT = "left", T.RIGHT = "right", T.BOTTOM = "bottom", T.FULL = "full", T))(l || {});
1
+ var l = /* @__PURE__ */ ((T) => (T.LEFT = "left", T.RIGHT = "right", T.BOTTOM = "bottom", T.FULL = "full", T.CENTER = "center", T))(l || {});
2
2
  export {
3
3
  l as EDrawerPosition
4
4
  };
@@ -45,10 +45,18 @@ type TProps = {
45
45
  * Нужна ли кнопка закрытия.
46
46
  */
47
47
  needCloseButton?: boolean;
48
+ /**
49
+ * Флаг указывающий, что компонент котроллируемый.
50
+ */
51
+ isControlled?: boolean;
48
52
  /**
49
53
  * Флаг открытия.
50
54
  */
51
55
  isOpen?: boolean;
56
+ /**
57
+ * Коллбэк изменения состояния (управляемый режим).
58
+ */
59
+ onOpenChange?: (open?: boolean) => void;
52
60
  /**
53
61
  * Время автоматического закрытия в миллисекундах.
54
62
  */
@@ -58,7 +66,8 @@ type TProps = {
58
66
  * Если указан, то buttonContent игнорируется.
59
67
  */
60
68
  triggerElement?: ReactNode | ((props: {
61
- open: boolean;
69
+ open?: boolean;
70
+ close: () => void;
62
71
  }) => JSX.Element);
63
72
  /**
64
73
  * Вариант оформления выпадающего меню.
@@ -74,5 +83,5 @@ type TProps = {
74
83
  /**
75
84
  * Компонент Dropdown, содержит в себе кнопку и панель выпадающего меню
76
85
  */
77
- export declare const Dropdown: import('react').MemoExoticComponent<({ children, position, popoverProps, className, buttonClassName, panelClassName, menuItemsClassName, buttonContent, needCloseButton, openOnHover, isOpen, autoCloseTimeout, triggerElement, variant, arrow }: TProps) => import("react/jsx-runtime").JSX.Element>;
86
+ export declare const Dropdown: import('react').MemoExoticComponent<({ children, position, popoverProps, className, buttonClassName, panelClassName, menuItemsClassName, buttonContent, needCloseButton, openOnHover, isOpen, isControlled, onOpenChange, autoCloseTimeout, triggerElement, variant, arrow }: TProps) => import("react/jsx-runtime").JSX.Element>;
78
87
  export {};