mimir-ui-kit 1.42.2 → 1.43.1

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 (87) 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/Slider/Slider.d.ts +6 -2
  56. package/dist/components/Slider/Slider.js +123 -109
  57. package/dist/components/Slider/utils.d.ts +1 -0
  58. package/dist/components/Slider/utils.js +4 -0
  59. package/dist/components/Switcher/Switcher.js +66 -59
  60. package/dist/components/Switcher/types.d.ts +1 -0
  61. package/dist/components/TabTrail/TabTrail.d.ts +9 -0
  62. package/dist/components/TabTrail/TabTrail.js +198 -190
  63. package/dist/components/Toasts/ProgressBar.d.ts +4 -2
  64. package/dist/components/Toasts/ProgressBar.js +1 -1
  65. package/dist/components/Toasts/Toast.d.ts +5 -1
  66. package/dist/components/Toasts/Toast.js +59 -44
  67. package/dist/components/Toasts/ToastList.js +1 -1
  68. package/dist/components/Toasts/ToastsProvider.js +1 -1
  69. package/dist/components/index.d.ts +3 -2
  70. package/dist/components/index.js +154 -149
  71. package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
  72. package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
  73. package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
  74. package/dist/hooks/useTimer/index.d.ts +2 -1
  75. package/dist/hooks/useTimer/index.js +55 -41
  76. package/dist/hooks-HgN6Yauq.js +117 -0
  77. package/dist/index.js +182 -177
  78. package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
  79. package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
  80. package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
  81. package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
  82. package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
  83. package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
  84. package/package.json +3 -1
  85. package/dist/ProgressBar-DEFs1tWq.js +0 -55
  86. package/dist/assets/Dropdown.css +0 -1
  87. package/dist/components/Pagination/types.d.ts +0 -0
@@ -1,94 +1,132 @@
1
- import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
- import { c as k } from "../../index-DIxK0V-G.js";
3
- import { useState as $ } from "react";
4
- import { months as x } from "./constants.js";
5
- import { useDatePickerPosition as v } from "./hooks.js";
6
- import { c as e } from "../../styles.module-Cuqm31CO.js";
7
- import { Icon as B } from "../../icons/Icon.js";
8
- import { formating as a } from "../../utils/index.js";
9
- import { Button as b } from "../Button/Button.js";
10
- const F = ({
11
- date: d,
12
- onChangeValue: D,
13
- before: u,
14
- onChangeType: i
1
+ import { jsxs as p, jsx as f } from "react/jsx-runtime";
2
+ import { c as j } from "../../index-DIxK0V-G.js";
3
+ import { useState as z } from "react";
4
+ import { months as C } from "./constants.js";
5
+ import { useDatePickerPosition as R } from "./hooks.js";
6
+ import { c } from "../../styles.module-Cuqm31CO.js";
7
+ import { Icon as _ } from "../../icons/Icon.js";
8
+ import { formating as B } from "../../utils/index.js";
9
+ import { Button as F } from "../Button/Button.js";
10
+ const W = ({
11
+ date: w,
12
+ onChangeValue: H,
13
+ before: d,
14
+ onChangeType: D,
15
+ disableFuture: N = !1,
16
+ disablePast: P = !1,
17
+ disabledDate: u,
18
+ validRange: g
15
19
  }) => {
16
- const h = v(), c = new Date(d), m = new Date(d), f = {
17
- y: c.getFullYear(),
18
- d: c.getDate(),
19
- m: c.getMonth() + 1
20
- }, s = {
20
+ const A = R(), m = new Date(w), y = new Date(w), h = {
21
21
  y: m.getFullYear(),
22
22
  d: m.getDate(),
23
23
  m: m.getMonth() + 1
24
- }, [t, p] = $(s.y), w = () => {
25
- p(t + 1);
26
- }, g = () => {
27
- p(t - 1);
28
- }, N = (r) => !!(u && u.getTime() > r), y = (r) => {
29
- N(
30
- (/* @__PURE__ */ new Date(
31
- `${t}-${a.Number(2, r)}-${a.Number(2, s.d)}`
32
- )).getTime()
33
- ) || D(
24
+ }, M = {
25
+ y: y.getFullYear(),
26
+ d: y.getDate(),
27
+ m: y.getMonth() + 1
28
+ }, [t, k] = z(M.y), G = () => {
29
+ k(t + 1);
30
+ }, I = () => {
31
+ k(t - 1);
32
+ }, x = (n) => {
33
+ const i = /* @__PURE__ */ new Date(), r = i.getFullYear(), l = i.getMonth() + 1;
34
+ if (g) {
35
+ const [o, s] = g, e = new Date(t, n - 1, 1), a = new Date(t, n, 0);
36
+ e.setHours(0, 0, 0, 0), a.setHours(23, 59, 59, 999);
37
+ const Y = new Date(o), v = new Date(s);
38
+ Y.setHours(0, 0, 0, 0), v.setHours(23, 59, 59, 999);
39
+ const S = a < Y, $ = e > v;
40
+ if (S || $)
41
+ return !0;
42
+ }
43
+ if (d) {
44
+ const o = d.getFullYear(), s = d.getMonth() + 1;
45
+ if (o > t || o === t && s > n)
46
+ return !0;
47
+ }
48
+ if (N && (t > r || t === r && n > l) || P && (t < r || t === r && n < l))
49
+ return !0;
50
+ if (u) {
51
+ const o = new Date(t, n, 0).getDate(), s = [1, Math.ceil(o / 2), o];
52
+ for (const e of s) {
53
+ const a = new Date(t, n - 1, e);
54
+ if (!u(a)) return !1;
55
+ }
56
+ for (let e = 2; e < o; e += 3) {
57
+ if (s.includes(e)) continue;
58
+ const a = new Date(t, n - 1, e);
59
+ if (!u(a)) return !1;
60
+ }
61
+ for (let e = 1; e <= o; e++) {
62
+ if (s.includes(e) || (e - 2) % 3 === 0) continue;
63
+ const a = new Date(t, n - 1, e);
64
+ if (!u(a)) return !1;
65
+ }
66
+ return !0;
67
+ }
68
+ return !1;
69
+ }, O = (n) => {
70
+ x(n) || H(
34
71
  /* @__PURE__ */ new Date(
35
- `${t}-${a.Number(2, r)}-${a.Number(2, s.d)}`
72
+ `${t}-${B.Number(2, n)}-${B.Number(2, M.d)}`
36
73
  )
37
74
  );
38
75
  };
39
- return /* @__PURE__ */ l("div", { className: e["calendar-block"], ref: h, children: [
40
- /* @__PURE__ */ l("div", { className: e.h, children: [
41
- /* @__PURE__ */ n(
42
- b,
76
+ return /* @__PURE__ */ p("div", { className: c["calendar-block"], ref: A, children: [
77
+ /* @__PURE__ */ p("div", { className: c.h, children: [
78
+ /* @__PURE__ */ f(
79
+ F,
43
80
  {
44
81
  isIconButton: !0,
45
82
  iconName: "DropdownArrowLeft16px",
46
- onClick: g,
83
+ onClick: I,
47
84
  variant: "secondary-gray",
48
85
  size: "l"
49
86
  }
50
87
  ),
51
- /* @__PURE__ */ l(
88
+ /* @__PURE__ */ p(
52
89
  "button",
53
90
  {
54
91
  type: "button",
55
- onClick: () => i == null ? void 0 : i("years"),
56
- className: e.d,
92
+ onClick: () => D == null ? void 0 : D("years"),
93
+ className: c.d,
57
94
  "data-testid": "year-button",
58
95
  children: [
59
96
  t.toString(),
60
- /* @__PURE__ */ n(B, { iconName: "DropdownArrowBottom16px" })
97
+ /* @__PURE__ */ f(_, { iconName: "DropdownArrowBottom16px" })
61
98
  ]
62
99
  }
63
100
  ),
64
- /* @__PURE__ */ n(
65
- b,
101
+ /* @__PURE__ */ f(
102
+ F,
66
103
  {
67
104
  isIconButton: !0,
68
105
  iconName: "DropdownArrowRight16px",
69
- onClick: w,
106
+ onClick: G,
70
107
  variant: "secondary-gray",
71
108
  size: "l"
72
109
  }
73
110
  )
74
111
  ] }),
75
- /* @__PURE__ */ n("div", { className: e.monthGrid, "data-testid": "month-picker", children: x.map((r, o) => /* @__PURE__ */ n(
76
- "button",
77
- {
78
- type: "button",
79
- onClick: () => y(o + 1),
80
- className: k(
81
- N(
82
- (/* @__PURE__ */ new Date(`${t}-${a.Number(2, o + 1)}`)).getTime()
83
- ) ? e.m : e.a,
84
- { [e.current]: f.y === t && f.m === o + 1 }
85
- ),
86
- children: r
87
- },
88
- o
89
- )) })
112
+ /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: C.map((n, i) => {
113
+ const r = i + 1, l = x(r);
114
+ return /* @__PURE__ */ f(
115
+ "button",
116
+ {
117
+ type: "button",
118
+ onClick: () => O(r),
119
+ disabled: l,
120
+ className: j(l ? c.m : c.a, {
121
+ [c.current]: h.y === t && h.m === r
122
+ }),
123
+ children: n
124
+ },
125
+ i
126
+ );
127
+ }) })
90
128
  ] });
91
129
  };
92
130
  export {
93
- F as MonthPickerModal
131
+ W as MonthPickerModal
94
132
  };
@@ -3,6 +3,10 @@ type TProps = {
3
3
  before?: Date;
4
4
  onChangeValue: (date: Date) => void;
5
5
  onChangeType?: (type: 'years') => void;
6
+ disableFuture?: boolean;
7
+ disablePast?: boolean;
8
+ disabledDate?: (date: Date) => boolean;
9
+ validRange?: [Date, Date];
6
10
  };
7
- export declare const YearPickerModal: ({ date, onChangeValue, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const YearPickerModal: ({ date, onChangeValue, before, onChangeType, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export {};
@@ -1,47 +1,66 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { c as v } from "../../index-DIxK0V-G.js";
3
- import { useState as x } from "react";
4
- import { useDatePickerPosition as Y } from "./hooks.js";
5
- import { c as t } from "../../styles.module-Cuqm31CO.js";
6
- import { formating as n } from "../../utils/index.js";
7
- import { Button as y } from "../Button/Button.js";
8
- const F = ({
9
- date: m,
10
- onChangeValue: b,
11
- before: l,
12
- onChangeType: a
1
+ import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
+ import { c as O } from "../../index-DIxK0V-G.js";
3
+ import { useState as $ } from "react";
4
+ import { useDatePickerPosition as j } from "./hooks.js";
5
+ import { c as e } from "../../styles.module-Cuqm31CO.js";
6
+ import { formating as y } from "../../utils/index.js";
7
+ import { Button as A } from "../Button/Button.js";
8
+ const D = 15, z = 7, W = ({
9
+ date: w,
10
+ onChangeValue: F,
11
+ before: p,
12
+ onChangeType: i,
13
+ disableFuture: P = !1,
14
+ disablePast: v = !1,
15
+ disabledDate: r,
16
+ validRange: Y
13
17
  }) => {
14
- const D = Y(), s = new Date(m), c = new Date(m), u = {
15
- y: s.getFullYear(),
16
- d: s.getDate(),
17
- m: s.getMonth() + 1
18
- }, r = {
19
- y: c.getFullYear(),
20
- d: c.getDate(),
21
- m: c.getMonth() + 1
22
- }, [i, d] = x(r.y), g = i - 7, k = Array.from(Array(15).keys()).map((e) => e + g), w = () => {
23
- d(i + 15);
24
- }, $ = () => {
25
- d(i - 15);
26
- }, f = (e) => !!(l && l.getTime() > e), h = (e) => {
27
- f(
28
- (/* @__PURE__ */ new Date(
29
- `${e}-${n.Number(2, r.m)}-${n.Number(2, r.d)}`
30
- )).getTime()
31
- ) || b(
18
+ const E = j(), m = new Date(w), f = new Date(w), R = {
19
+ y: m.getFullYear(),
20
+ d: m.getDate(),
21
+ m: m.getMonth() + 1
22
+ }, u = {
23
+ y: f.getFullYear(),
24
+ d: f.getDate(),
25
+ m: f.getMonth() + 1
26
+ }, [l, N] = $(u.y), S = l - z, _ = Array.from(Array(D).keys()).map(
27
+ (t) => t + S
28
+ ), G = () => {
29
+ N(l + D);
30
+ }, H = () => {
31
+ N(l - D);
32
+ }, g = (t) => {
33
+ const n = (/* @__PURE__ */ new Date()).getFullYear();
34
+ if (Y) {
35
+ const [s, d] = Y, c = new Date(t, 0, 1), a = new Date(t, 11, 31);
36
+ c.setHours(0, 0, 0, 0), a.setHours(23, 59, 59, 999);
37
+ const b = new Date(s), h = new Date(d);
38
+ b.setHours(0, 0, 0, 0), h.setHours(23, 59, 59, 999);
39
+ const B = a < b, M = c > h;
40
+ if (B || M) return !0;
41
+ }
42
+ if (p && p.getFullYear() > t || P && t > n || v && t < n)
43
+ return !0;
44
+ if (r) {
45
+ const s = new Date(t, 2, 15), d = new Date(t, 5, 15), c = new Date(t, 8, 15), a = new Date(t, 11, 15);
46
+ return r(s) && r(d) && r(c) && r(a);
47
+ }
48
+ return !1;
49
+ }, Q = (t) => {
50
+ g(t) || F(
32
51
  /* @__PURE__ */ new Date(
33
- `${e}-${n.Number(2, r.m)}-${n.Number(2, r.d)}`
52
+ `${t}-${y.Number(2, u.m)}-${y.Number(2, u.d)}`
34
53
  )
35
54
  );
36
55
  };
37
- return /* @__PURE__ */ p("div", { className: t["calendar-block"], ref: D, children: [
38
- /* @__PURE__ */ p("div", { className: t.h, children: [
56
+ return /* @__PURE__ */ x("div", { className: e["calendar-block"], ref: E, children: [
57
+ /* @__PURE__ */ x("div", { className: e.h, children: [
39
58
  /* @__PURE__ */ o(
40
- y,
59
+ A,
41
60
  {
42
61
  isIconButton: !0,
43
62
  iconName: "DropdownArrowLeft16px",
44
- onClick: $,
63
+ onClick: H,
45
64
  variant: "secondary-gray",
46
65
  size: "l"
47
66
  }
@@ -50,40 +69,39 @@ const F = ({
50
69
  "button",
51
70
  {
52
71
  type: "button",
53
- onClick: () => a == null ? void 0 : a("years"),
54
- className: t.d
72
+ onClick: () => i == null ? void 0 : i("years"),
73
+ className: e.d
55
74
  }
56
75
  ),
57
76
  /* @__PURE__ */ o(
58
- y,
77
+ A,
59
78
  {
60
79
  isIconButton: !0,
61
80
  iconName: "DropdownArrowRight16px",
62
- onClick: w,
81
+ onClick: G,
63
82
  variant: "secondary-gray",
64
83
  size: "l"
65
84
  }
66
85
  )
67
86
  ] }),
68
- /* @__PURE__ */ o("div", { className: t.monthGrid, "data-testid": "year-picker", children: k.map((e, N) => /* @__PURE__ */ o(
69
- "button",
70
- {
71
- type: "button",
72
- onClick: () => h(e),
73
- className: v(
74
- f(
75
- (/* @__PURE__ */ new Date(`${e}-${n.Number(2, u.m)}`)).getTime()
76
- ) ? t.m : t.a,
77
- {
78
- [t.current]: u.y === e
79
- }
80
- ),
81
- children: e
82
- },
83
- N
84
- )) })
87
+ /* @__PURE__ */ o("div", { className: e.monthGrid, "data-testid": "year-picker", children: _.map((t, k) => {
88
+ const n = g(t);
89
+ return /* @__PURE__ */ o(
90
+ "button",
91
+ {
92
+ type: "button",
93
+ onClick: () => Q(t),
94
+ disabled: n,
95
+ className: O(n ? e.m : e.a, {
96
+ [e.current]: R.y === t
97
+ }),
98
+ children: t
99
+ },
100
+ k
101
+ );
102
+ }) })
85
103
  ] });
86
104
  };
87
105
  export {
88
- F as YearPickerModal
106
+ W as YearPickerModal
89
107
  };
@@ -1,4 +1,4 @@
1
- import { ElementType, ReactElement, ReactNode } from 'react';
1
+ import { ElementType, ReactElement, ReactNode, RefObject } from 'react';
2
2
  import { EDrawerPosition } from './constants';
3
3
  import { Props } from '../../types/propsWithAs';
4
4
 
@@ -78,6 +78,12 @@ type TProps = {
78
78
  * Флаг, определяющий, показывать ли кнопку закрытия в заголовке
79
79
  */
80
80
  showCloseButton?: boolean;
81
+ /**
82
+ * Указывает DOM-элемент, в который будет рендериться Drawer.
83
+ * Если не указан, используется document.body.
84
+ * Если указано false, компонент рендерится без использования Portal.
85
+ */
86
+ getContainer?: HTMLElement | RefObject<HTMLElement> | false;
81
87
  };
82
88
  type TDrawerComponent = <C extends ElementType = 'div'>(props: Props<C, TProps>) => ReactElement | ReactNode;
83
89
  /**