mimir-ui-kit 1.42.2 → 1.43.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.
Files changed (83) hide show
  1. package/dist/ProgressBar-COdzy3fY.js +67 -0
  2. package/dist/assets/MultiSelectSearch.css +1 -1
  3. package/dist/assets/Pagination.css +1 -1
  4. package/dist/assets/SelectSearch.css +1 -1
  5. package/dist/assets/Switcher.css +1 -1
  6. package/dist/assets/TabTrail.css +1 -1
  7. package/dist/assets/hooks.css +1 -0
  8. package/dist/{combobox-Dv6-ANkb.js → combobox-fIVOzEhl.js} +6 -6
  9. package/dist/components/Accordion/Accordion.d.ts +6 -0
  10. package/dist/components/Accordion/Accordion.js +202 -182
  11. package/dist/components/AnchorLink/Link.d.ts +2 -0
  12. package/dist/components/AnchorLink/Link.js +54 -42
  13. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  14. package/dist/components/DatePicker/DatePicker.d.ts +32 -0
  15. package/dist/components/DatePicker/DatePicker.js +125 -111
  16. package/dist/components/DatePicker/DatePickerModal.d.ts +5 -1
  17. package/dist/components/DatePicker/DatePickerModal.js +97 -75
  18. package/dist/components/DatePicker/MonthPickerModal.d.ts +5 -1
  19. package/dist/components/DatePicker/MonthPickerModal.js +96 -58
  20. package/dist/components/DatePicker/YearPickerModal.d.ts +5 -1
  21. package/dist/components/DatePicker/YearPickerModal.js +75 -57
  22. package/dist/components/Drawer/Drawer.d.ts +7 -1
  23. package/dist/components/Drawer/Drawer.js +122 -106
  24. package/dist/components/Drawer/hooks.d.ts +9 -0
  25. package/dist/components/Drawer/hooks.js +24 -0
  26. package/dist/components/Dropdown/Dropdown.d.ts +18 -1
  27. package/dist/components/Dropdown/Dropdown.js +361 -343
  28. package/dist/components/Dropdown/constants.d.ts +11 -0
  29. package/dist/components/Dropdown/constants.js +5 -0
  30. package/dist/components/Dropdown/hooks.d.ts +19 -0
  31. package/dist/components/Dropdown/hooks.js +11 -0
  32. package/dist/components/Dropdown/index.d.ts +1 -0
  33. package/dist/components/Dropdown/index.js +5 -2
  34. package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +8 -1
  35. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +461 -302
  36. package/dist/components/MultiSelectSearch/constants.d.ts +6 -0
  37. package/dist/components/MultiSelectSearch/constants.js +7 -5
  38. package/dist/components/MultiSelectSearch/index.d.ts +1 -1
  39. package/dist/components/MultiSelectSearch/index.js +5 -4
  40. package/dist/components/MultiSelectSearch/types.d.ts +33 -1
  41. package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
  42. package/dist/components/MultiSelectSearch/utils.js +31 -17
  43. package/dist/components/Pagination/Pagination.d.ts +23 -0
  44. package/dist/components/Pagination/Pagination.js +137 -99
  45. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  46. package/dist/components/SelectSearch/SelectSearch.d.ts +8 -1
  47. package/dist/components/SelectSearch/SelectSearch.js +381 -220
  48. package/dist/components/SelectSearch/constants.d.ts +6 -0
  49. package/dist/components/SelectSearch/constants.js +3 -2
  50. package/dist/components/SelectSearch/index.d.ts +1 -1
  51. package/dist/components/SelectSearch/index.js +5 -4
  52. package/dist/components/SelectSearch/types.d.ts +32 -1
  53. package/dist/components/SelectSearch/utils.d.ts +2 -0
  54. package/dist/components/SelectSearch/utils.js +28 -14
  55. package/dist/components/Switcher/Switcher.js +66 -59
  56. package/dist/components/Switcher/types.d.ts +1 -0
  57. package/dist/components/TabTrail/TabTrail.d.ts +9 -0
  58. package/dist/components/TabTrail/TabTrail.js +198 -190
  59. package/dist/components/Toasts/ProgressBar.d.ts +4 -2
  60. package/dist/components/Toasts/ProgressBar.js +1 -1
  61. package/dist/components/Toasts/Toast.d.ts +5 -1
  62. package/dist/components/Toasts/Toast.js +59 -44
  63. package/dist/components/Toasts/ToastList.js +1 -1
  64. package/dist/components/Toasts/ToastsProvider.js +1 -1
  65. package/dist/components/index.d.ts +3 -2
  66. package/dist/components/index.js +154 -149
  67. package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
  68. package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
  69. package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
  70. package/dist/hooks/useTimer/index.d.ts +2 -1
  71. package/dist/hooks/useTimer/index.js +55 -41
  72. package/dist/hooks-HgN6Yauq.js +117 -0
  73. package/dist/index.js +182 -177
  74. package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
  75. package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
  76. package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
  77. package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
  78. package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
  79. package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
  80. package/package.json +3 -1
  81. package/dist/ProgressBar-DEFs1tWq.js +0 -55
  82. package/dist/assets/Dropdown.css +0 -1
  83. package/dist/components/Pagination/types.d.ts +0 -0
@@ -1,139 +1,153 @@
1
- import { jsxs as m, jsx as o, Fragment as G } from "react/jsx-runtime";
1
+ import { jsxs as f, Fragment as I, jsx as t } from "react/jsx-runtime";
2
2
  import { c as n } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as K, useState as v, useRef as V, useCallback as _, useEffect as W } from "react";
4
- import { EDrawerPosition as k } from "./constants.js";
5
- import { useMediaQuery as Y } from "../../hooks/useMediaQuery/useMediaQuery.js";
6
- import { EMediaQuery as q } from "../../hooks/useMediaQuery/constants.js";
7
- import { useLockBodyScroll as J } from "../../hooks/useLockBodyScroll/useLockBodyScroll.js";
8
- import { useResizeObserver as U } from "../../hooks/useResizeObserver/useResizeObserver.js";
9
- import { Button as C } from "../Button/Button.js";
10
- import { EButtonVariantDefault as Z, EButtonSize as a } from "../Button/constants.js";
11
- import { Loader as $ } from "../Loader/Loader.js";
12
- import { Portal as ee } from "../Portal/Portal.js";
13
- import '../../assets/Drawer.css';const oe = "_drawer_13ua6_2", te = "_content_13ua6_26", ne = "_header_13ua6_44", se = "_title_13ua6_58", ae = "_space_13ua6_72", re = "_inner_13ua6_83", ie = "_button_13ua6_86", le = "_footer_13ua6_91", ce = "_left_13ua6_104", ue = "_right_13ua6_108", de = "_full_13ua6_112", me = "_bottom_13ua6_122", _e = "_opened_13ua6_139", fe = "_overlay_13ua6_195", he = "_unmount_13ua6_211", e = {
14
- drawer: oe,
15
- content: te,
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,
16
17
  "is-loading": "_is-loading_13ua6_40",
17
- header: ne,
18
+ header: le,
18
19
  "sticky-header": "_sticky-header_13ua6_52",
19
- title: se,
20
- space: ae,
21
- inner: re,
22
- button: ie,
23
- footer: le,
20
+ title: ce,
21
+ space: ue,
22
+ inner: de,
23
+ button: me,
24
+ footer: _e,
24
25
  "footer-button": "_footer-button_13ua6_100",
25
- left: ce,
26
- right: ue,
27
- full: de,
28
- bottom: me,
26
+ left: fe,
27
+ right: he,
28
+ full: pe,
29
+ bottom: ye,
29
30
  "full-bottom-height": "_full-bottom-height_13ua6_133",
30
- opened: _e,
31
+ opened: ge,
31
32
  "is-closing": "_is-closing_13ua6_158",
32
- overlay: fe,
33
- unmount: he
34
- }, pe = 300, Ie = K(
35
- (B, E) => {
33
+ overlay: Ce,
34
+ unmount: ve
35
+ }, Ne = 300, be = (a) => a ? {
36
+ drawer: {
37
+ position: "absolute",
38
+ zIndex: 100
39
+ },
40
+ overlay: {
41
+ position: "absolute",
42
+ zIndex: 90
43
+ }
44
+ } : {}, Ae = q(
45
+ (a, L) => {
36
46
  const {
37
- as: M = "div",
47
+ as: R = "div",
38
48
  isOpen: s,
39
- onClose: r,
40
- title: O,
41
- className: I,
42
- unmount: f = !0,
43
- isLoading: i = !1,
44
- stickyHeader: L,
45
- fullBottomHeight: R = !1,
46
- position: l = k.RIGHT,
47
- paddingRight: T = 8,
48
- footer: c,
49
- children: S,
50
- classNameTitle: D,
51
- classNameHeader: x,
52
- classNameInner: z,
53
- classNameContent: H,
54
- classNameFooter: A,
55
- closeOnClickOutside: h = !0,
56
- showCloseButton: p = !0,
57
- ...P
58
- } = B, [g, N] = v(!1), [X, y] = v(!1), b = V(), u = Y(q.XS1), { ref: j } = U({
59
- enabled: l === k.BOTTOM
60
- });
61
- J({
62
- on: s && !g,
63
- paddingRight: T
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
64
75
  });
65
- const t = _(() => {
66
- r && (N(!0), b.current = setTimeout(() => {
67
- r(), N(!1);
68
- }, pe));
69
- }, [r]), F = _(() => {
70
- h && t();
71
- }, [h, t]), d = _(
72
- (Q) => {
73
- Q.key === "Escape" && t();
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();
74
85
  },
75
- [t]
86
+ [o]
76
87
  );
77
- W(() => (s && (y(!0), window.addEventListener("keydown", d)), () => {
78
- y(!1), clearTimeout(b.current), window.removeEventListener("keydown", d);
79
- }), [s, d]);
80
- const w = {
81
- [e.opened]: X,
82
- [e["is-closing"]]: g,
83
- [e["full-bottom-height"]]: R,
84
- [e["is-loading"]]: i
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,
93
+ [e["is-closing"]]: C,
94
+ [e["full-bottom-height"]]: D,
95
+ [e["is-loading"]]: l
85
96
  };
86
- return !s && f ? null : /* @__PURE__ */ m(ee, { children: [
87
- /* @__PURE__ */ o(
88
- M,
97
+ if (!s && p)
98
+ return null;
99
+ const B = be(d !== void 0 && d !== !1), E = /* @__PURE__ */ f(I, { children: [
100
+ /* @__PURE__ */ t(
101
+ R,
89
102
  {
90
- ref: E,
103
+ ref: L,
91
104
  "aria-hidden": !s,
92
105
  role: "dialog",
93
- className: n(e.drawer, e[l], w, I),
94
- ...P,
95
- children: /* @__PURE__ */ o(
106
+ style: B.drawer,
107
+ className: n(e.drawer, e[c], k, x),
108
+ ...G,
109
+ children: /* @__PURE__ */ t(
96
110
  "section",
97
111
  {
98
- ref: j,
112
+ ref: V,
99
113
  className: n(
100
114
  e.content,
101
- H,
102
- e[l],
115
+ F,
116
+ e[c],
103
117
  {
104
- [e["is-loading"]]: !!i
118
+ [e["is-loading"]]: !!l
105
119
  }
106
120
  ),
107
- children: i ? /* @__PURE__ */ o($, {}) : /* @__PURE__ */ m(G, { children: [
108
- /* @__PURE__ */ m(
121
+ children: l ? /* @__PURE__ */ t(se, {}) : /* @__PURE__ */ f(I, { children: [
122
+ /* @__PURE__ */ f(
109
123
  "header",
110
124
  {
111
- className: n(e.header, x, {
112
- [e["sticky-header"]]: L
125
+ className: n(e.header, X, {
126
+ [e["sticky-header"]]: z
113
127
  }),
114
128
  children: [
115
- /* @__PURE__ */ o("h2", { className: n(e.title, D), children: O }),
116
- /* @__PURE__ */ o("div", { className: e.space, children: p && /* @__PURE__ */ o(
117
- C,
129
+ /* @__PURE__ */ t("h2", { className: n(e.title, P), children: T }),
130
+ /* @__PURE__ */ t("div", { className: e.space, children: g && /* @__PURE__ */ t(
131
+ S,
118
132
  {
119
- variant: Z.SecondaryWhite,
133
+ variant: ne.SecondaryWhite,
120
134
  isIconButton: !0,
121
- size: u ? a.S : a.M,
135
+ size: m ? r.S : r.M,
122
136
  iconName: "Close16px",
123
- onClick: t,
137
+ onClick: o,
124
138
  className: e.button
125
139
  }
126
140
  ) })
127
141
  ]
128
142
  }
129
143
  ),
130
- /* @__PURE__ */ o("div", { className: n(e.inner, z), children: S }),
131
- /* @__PURE__ */ o("footer", { className: n(e.footer, A), children: typeof c == "function" ? c({ handleClose: t }) : c || p && /* @__PURE__ */ o(
132
- C,
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,
133
147
  {
134
- size: u ? a.M : a.XXL,
135
- full: u,
136
- onClick: t,
148
+ size: m ? r.M : r.XXL,
149
+ full: m,
150
+ onClick: o,
137
151
  className: e["footer-button"],
138
152
  children: "Закрыть"
139
153
  }
@@ -143,24 +157,26 @@ import '../../assets/Drawer.css';const oe = "_drawer_13ua6_2", te = "_content_13
143
157
  )
144
158
  }
145
159
  ),
146
- /* @__PURE__ */ o(
160
+ /* @__PURE__ */ t(
147
161
  "div",
148
162
  {
149
163
  className: n(
150
164
  e.overlay,
151
165
  {
152
- [e.unmount]: !f
166
+ [e.unmount]: !p
153
167
  },
154
- w
168
+ k
155
169
  ),
170
+ style: B.overlay,
156
171
  "data-testid": "drawer-overlay",
157
- onClick: F
172
+ onClick: W
158
173
  }
159
174
  )
160
175
  ] });
176
+ return w === !1 ? E : /* @__PURE__ */ t(re, { element: w, children: E });
161
177
  }
162
178
  );
163
179
  export {
164
- pe as ANIMATION_DELAY,
165
- Ie as Drawer
180
+ Ne as ANIMATION_DELAY,
181
+ Ae as Drawer
166
182
  };
@@ -0,0 +1,9 @@
1
+ import { RefObject } from 'react';
2
+
3
+ type TContainerInput = HTMLElement | RefObject<HTMLElement> | undefined | false;
4
+ type TContainerOutput = HTMLElement | undefined | false;
5
+ /**
6
+ * Хук для безопасного получения DOM-элемента из различных источников
7
+ */
8
+ export declare function useContainer(container: TContainerInput): TContainerOutput;
9
+ export {};
@@ -0,0 +1,24 @@
1
+ import { useState as f, useRef as s, useEffect as l } from "react";
2
+ function m(e) {
3
+ const [u, r] = f(
4
+ e === !1 ? !1 : void 0
5
+ ), t = s(null);
6
+ return l(() => {
7
+ if (e === !1) {
8
+ r(!1);
9
+ return;
10
+ }
11
+ if (e instanceof HTMLElement) {
12
+ r(e);
13
+ return;
14
+ }
15
+ if (e && "current" in e) {
16
+ e.current !== t.current && (t.current = e.current, r(e.current || void 0));
17
+ return;
18
+ }
19
+ r(void 0);
20
+ }, [e]), u;
21
+ }
22
+ export {
23
+ m as useContainer
24
+ };
@@ -53,9 +53,26 @@ type TProps = {
53
53
  * Время автоматического закрытия в миллисекундах.
54
54
  */
55
55
  autoCloseTimeout?: number;
56
+ /**
57
+ * Произвольный элемент-триггер для открытия выпадающего меню.
58
+ * Если указан, то buttonContent игнорируется.
59
+ */
60
+ triggerElement?: ReactNode | ((props: {
61
+ open: boolean;
62
+ }) => JSX.Element);
63
+ /**
64
+ * Вариант оформления выпадающего меню.
65
+ * @default 'default'
66
+ */
67
+ variant?: 'default' | 'black';
68
+ /**
69
+ * Показывать ли стрелку, указывающую на триггер.
70
+ * @default false
71
+ */
72
+ arrow?: boolean;
56
73
  };
57
74
  /**
58
75
  * Компонент Dropdown, содержит в себе кнопку и панель выпадающего меню
59
76
  */
60
- export declare const Dropdown: import('react').MemoExoticComponent<({ children, position, popoverProps, className, buttonClassName, panelClassName, menuItemsClassName, buttonContent, needCloseButton, openOnHover, isOpen, autoCloseTimeout }: TProps) => import("react/jsx-runtime").JSX.Element>;
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>;
61
78
  export {};