mimir-ui-kit 1.42.1 → 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 (89) hide show
  1. package/dist/ProgressBar-COdzy3fY.js +67 -0
  2. package/dist/assets/CardTrail.css +1 -1
  3. package/dist/assets/MultiSelectSearch.css +1 -1
  4. package/dist/assets/Pagination.css +1 -1
  5. package/dist/assets/SelectSearch.css +1 -1
  6. package/dist/assets/Switcher.css +1 -1
  7. package/dist/assets/TabTrail.css +1 -1
  8. package/dist/assets/hooks.css +1 -0
  9. package/dist/{combobox-Dv6-ANkb.js → combobox-fIVOzEhl.js} +6 -6
  10. package/dist/components/Accordion/Accordion.d.ts +6 -0
  11. package/dist/components/Accordion/Accordion.js +202 -182
  12. package/dist/components/AnchorLink/Link.d.ts +2 -0
  13. package/dist/components/AnchorLink/Link.js +54 -42
  14. package/dist/components/CardTrail/CardTrail.js +47 -46
  15. package/dist/components/CardTrail/utils.d.ts +0 -1
  16. package/dist/components/CardTrail/utils.js +7 -8
  17. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  18. package/dist/components/DatePicker/DatePicker.d.ts +32 -0
  19. package/dist/components/DatePicker/DatePicker.js +125 -111
  20. package/dist/components/DatePicker/DatePickerModal.d.ts +5 -1
  21. package/dist/components/DatePicker/DatePickerModal.js +97 -75
  22. package/dist/components/DatePicker/MonthPickerModal.d.ts +5 -1
  23. package/dist/components/DatePicker/MonthPickerModal.js +96 -58
  24. package/dist/components/DatePicker/YearPickerModal.d.ts +5 -1
  25. package/dist/components/DatePicker/YearPickerModal.js +75 -57
  26. package/dist/components/Drawer/Drawer.d.ts +7 -1
  27. package/dist/components/Drawer/Drawer.js +122 -106
  28. package/dist/components/Drawer/hooks.d.ts +9 -0
  29. package/dist/components/Drawer/hooks.js +24 -0
  30. package/dist/components/Dropdown/Dropdown.d.ts +18 -1
  31. package/dist/components/Dropdown/Dropdown.js +361 -343
  32. package/dist/components/Dropdown/constants.d.ts +11 -0
  33. package/dist/components/Dropdown/constants.js +5 -0
  34. package/dist/components/Dropdown/hooks.d.ts +19 -0
  35. package/dist/components/Dropdown/hooks.js +11 -0
  36. package/dist/components/Dropdown/index.d.ts +1 -0
  37. package/dist/components/Dropdown/index.js +5 -2
  38. package/dist/components/Image/Image.d.ts +16 -0
  39. package/dist/components/Image/Image.js +65 -37
  40. package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +8 -1
  41. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +461 -302
  42. package/dist/components/MultiSelectSearch/constants.d.ts +6 -0
  43. package/dist/components/MultiSelectSearch/constants.js +7 -5
  44. package/dist/components/MultiSelectSearch/index.d.ts +1 -1
  45. package/dist/components/MultiSelectSearch/index.js +5 -4
  46. package/dist/components/MultiSelectSearch/types.d.ts +33 -1
  47. package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
  48. package/dist/components/MultiSelectSearch/utils.js +31 -17
  49. package/dist/components/Pagination/Pagination.d.ts +23 -0
  50. package/dist/components/Pagination/Pagination.js +137 -99
  51. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  52. package/dist/components/SelectSearch/SelectSearch.d.ts +8 -1
  53. package/dist/components/SelectSearch/SelectSearch.js +381 -220
  54. package/dist/components/SelectSearch/constants.d.ts +6 -0
  55. package/dist/components/SelectSearch/constants.js +3 -2
  56. package/dist/components/SelectSearch/index.d.ts +1 -1
  57. package/dist/components/SelectSearch/index.js +5 -4
  58. package/dist/components/SelectSearch/types.d.ts +32 -1
  59. package/dist/components/SelectSearch/utils.d.ts +2 -0
  60. package/dist/components/SelectSearch/utils.js +28 -14
  61. package/dist/components/Switcher/Switcher.js +66 -59
  62. package/dist/components/Switcher/types.d.ts +1 -0
  63. package/dist/components/TabTrail/TabTrail.d.ts +9 -0
  64. package/dist/components/TabTrail/TabTrail.js +198 -190
  65. package/dist/components/Toasts/ProgressBar.d.ts +4 -2
  66. package/dist/components/Toasts/ProgressBar.js +1 -1
  67. package/dist/components/Toasts/Toast.d.ts +5 -1
  68. package/dist/components/Toasts/Toast.js +59 -44
  69. package/dist/components/Toasts/ToastList.js +1 -1
  70. package/dist/components/Toasts/ToastsProvider.js +1 -1
  71. package/dist/components/index.d.ts +3 -2
  72. package/dist/components/index.js +154 -149
  73. package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
  74. package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
  75. package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
  76. package/dist/hooks/useTimer/index.d.ts +2 -1
  77. package/dist/hooks/useTimer/index.js +55 -41
  78. package/dist/hooks-HgN6Yauq.js +117 -0
  79. package/dist/index.js +182 -177
  80. package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
  81. package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
  82. package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
  83. package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
  84. package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
  85. package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
  86. package/package.json +3 -1
  87. package/dist/ProgressBar-DEFs1tWq.js +0 -55
  88. package/dist/assets/Dropdown.css +0 -1
  89. package/dist/components/Pagination/types.d.ts +0 -0
@@ -1,80 +1,102 @@
1
1
  import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { c as x } from "../../index-DIxK0V-G.js";
3
- import { useState as O } from "react";
4
- import { week as Y, COUNT_WORK_DAYS as j } from "./constants.js";
5
- import { useDatePickerPosition as z } from "./hooks.js";
6
- import { c as o } from "../../styles.module-Cuqm31CO.js";
7
- import { getUpdateDate as M } from "./utils.js";
8
- import { Icon as G } from "../../icons/Icon.js";
9
- import { formating as s } from "../../utils/index.js";
10
- import { Button as $ } from "../Button/Button.js";
11
- import { parseDate as k } from "../../utils/formating/Date.js";
12
- const tt = ({
2
+ import { c as k } from "../../index-DIxK0V-G.js";
3
+ import { useState as z } from "react";
4
+ import { week as G, COUNT_WORK_DAYS as U } from "./constants.js";
5
+ import { useDatePickerPosition as V } from "./hooks.js";
6
+ import { c as n } from "../../styles.module-Cuqm31CO.js";
7
+ import { getUpdateDate as P } from "./utils.js";
8
+ import { Icon as W } from "../../icons/Icon.js";
9
+ import { formating as m } from "../../utils/index.js";
10
+ import { Button as A } from "../Button/Button.js";
11
+ import { parseDate as B } from "../../utils/formating/Date.js";
12
+ const st = ({
13
13
  date: i,
14
- onChangeValue: P,
15
- setIsActive: A,
16
- before: h,
17
- onChangeType: u
14
+ onChangeValue: H,
15
+ setIsActive: I,
16
+ before: g,
17
+ onChangeType: u,
18
+ disableFuture: O = !1,
19
+ disablePast: S = !1,
20
+ disabledDate: p,
21
+ validRange: h
18
22
  }) => {
19
- var b;
23
+ var M;
20
24
  i = isNaN(new Date(i).getTime()) ? /* @__PURE__ */ new Date() : i;
21
- const d = k(i), D = k(i), y = {
22
- y: d.getFullYear(),
23
- d: d.getDate(),
24
- m: d.getMonth() + 1
25
- }, f = {
25
+ const D = B(i), d = B(i), f = {
26
26
  y: D.getFullYear(),
27
27
  d: D.getDate(),
28
28
  m: D.getMonth() + 1
29
- }, [e, g] = O({ y: f.y, m: f.m }), B = z([e]), I = (t) => {
30
- let r = t.getDay();
31
- return r === 0 && (r = 7), r - 1;
32
- }, N = e.m - 1, m = new Date(e.y, N), p = [], v = (() => {
33
- const t = new Date(m);
29
+ }, N = {
30
+ y: d.getFullYear(),
31
+ d: d.getDate(),
32
+ m: d.getMonth() + 1
33
+ }, [r, w] = z({ y: N.y, m: N.m }), T = V([r]), _ = (t) => {
34
+ let e = t.getDay();
35
+ return e === 0 && (e = 7), e - 1;
36
+ }, b = r.m - 1, c = new Date(r.y, b), y = [], v = (() => {
37
+ const t = new Date(c);
34
38
  t.setDate(t.getDate() - 1);
35
- const r = t.getDate(), c = [];
36
- for (let n = 0; n < I(m); n++)
37
- c.push(r - n);
38
- return c.reverse(), c;
39
+ const e = t.getDate(), o = [];
40
+ for (let s = 0; s < _(c); s++)
41
+ o.push(e - s);
42
+ return o.reverse(), o;
39
43
  })();
40
- for (; m.getMonth() === N; )
41
- p.push(m.getDate()), m.setDate(m.getDate() + 1);
42
- const S = (() => {
43
- const r = 42 - (v.length + p.length), c = [];
44
- for (let n = 1; n <= r; n++)
45
- c.push(n);
46
- return c;
47
- })(), _ = () => {
48
- A(!1);
49
- }, C = () => {
50
- g(M(e.m + 1, e.y));
44
+ for (; c.getMonth() === b; )
45
+ y.push(c.getDate()), c.setDate(c.getDate() + 1);
46
+ const j = (() => {
47
+ const e = 42 - (v.length + y.length), o = [];
48
+ for (let s = 1; s <= e; s++)
49
+ o.push(s);
50
+ return o;
51
+ })(), C = () => {
52
+ I(!1);
51
53
  }, F = () => {
52
- g(M(e.m - 1, e.y));
53
- }, w = (t) => !!(h && h.getTime() > t), L = (t) => {
54
- w(
54
+ w(P(r.m + 1, r.y));
55
+ }, L = () => {
56
+ w(P(r.m - 1, r.y));
57
+ }, x = (t) => {
58
+ const e = new Date(t);
59
+ if (e.setHours(0, 0, 0, 0), g && g.getTime() > t)
60
+ return !0;
61
+ if (O) {
62
+ const o = /* @__PURE__ */ new Date();
63
+ if (o.setHours(0, 0, 0, 0), e.getTime() > o.getTime()) return !0;
64
+ }
65
+ if (S) {
66
+ const o = /* @__PURE__ */ new Date();
67
+ if (o.setHours(0, 0, 0, 0), t < o.getTime()) return !0;
68
+ }
69
+ if (p && p(e)) return !0;
70
+ if (h) {
71
+ const [o, s] = h, $ = new Date(t);
72
+ if (o.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), $ < o || $ > s) return !0;
73
+ }
74
+ return !1;
75
+ }, Y = (t) => {
76
+ x(
55
77
  (/* @__PURE__ */ new Date(
56
- `${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
78
+ `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
57
79
  )).getTime()
58
- ) || (P(
80
+ ) || (H(
59
81
  /* @__PURE__ */ new Date(
60
- `${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
82
+ `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
61
83
  )
62
- ), _());
84
+ ), C());
63
85
  };
64
86
  return /* @__PURE__ */ l(
65
87
  "div",
66
88
  {
67
- className: o["calendar-block"],
68
- ref: B,
89
+ className: n["calendar-block"],
90
+ ref: T,
69
91
  "data-testid": "calendar-modal",
70
92
  children: [
71
- /* @__PURE__ */ l("div", { className: o.h, children: [
93
+ /* @__PURE__ */ l("div", { className: n.h, children: [
72
94
  /* @__PURE__ */ a(
73
- $,
95
+ A,
74
96
  {
75
97
  isIconButton: !0,
76
98
  iconName: "DropdownArrowLeft16px",
77
- onClick: F,
99
+ onClick: L,
78
100
  variant: "secondary-gray",
79
101
  size: "l"
80
102
  }
@@ -83,65 +105,65 @@ const tt = ({
83
105
  "button",
84
106
  {
85
107
  type: "button",
86
- className: o.d,
108
+ className: n.d,
87
109
  onClick: () => u == null ? void 0 : u("months"),
88
110
  "data-testid": "month-year-button",
89
111
  children: [
90
- (b = s.Month(e.m)) == null ? void 0 : b.name,
112
+ (M = m.Month(r.m)) == null ? void 0 : M.name,
91
113
  "’",
92
- e.y.toString().slice(-2),
93
- /* @__PURE__ */ a(G, { iconName: "DropdownArrowBottom16px" })
114
+ r.y.toString().slice(-2),
115
+ /* @__PURE__ */ a(W, { iconName: "DropdownArrowBottom16px" })
94
116
  ]
95
117
  }
96
118
  ),
97
119
  /* @__PURE__ */ a(
98
- $,
120
+ A,
99
121
  {
100
122
  isIconButton: !0,
101
123
  iconName: "DropdownArrowRight16px",
102
- onClick: C,
124
+ onClick: F,
103
125
  variant: "secondary-gray",
104
126
  size: "l"
105
127
  }
106
128
  )
107
129
  ] }),
108
- /* @__PURE__ */ l("div", { className: o.b, children: [
109
- Y.map((t, r) => /* @__PURE__ */ a(
130
+ /* @__PURE__ */ l("div", { className: n.b, children: [
131
+ G.map((t, e) => /* @__PURE__ */ a(
110
132
  "div",
111
133
  {
112
- className: x(o.m, {
113
- [o.orange]: r > j
134
+ className: k(n.m, {
135
+ [n.orange]: e > U
114
136
  }),
115
137
  children: t
116
138
  },
117
- `v${r}`
139
+ `v${e}`
118
140
  )),
119
- v.map((t, r) => /* @__PURE__ */ a("div", { className: o.m, children: t }, r)),
120
- p.map((t, r) => /* @__PURE__ */ a(
141
+ v.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e)),
142
+ y.map((t, e) => /* @__PURE__ */ a(
121
143
  "button",
122
144
  {
123
145
  type: "button",
124
- onClick: () => L(t),
125
- className: x(
126
- w(
146
+ onClick: () => Y(t),
147
+ className: k(
148
+ x(
127
149
  (/* @__PURE__ */ new Date(
128
- `${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
150
+ `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
129
151
  )).getTime()
130
- ) ? o.m : o.a,
152
+ ) ? n.m : n.a,
131
153
  {
132
- [o.current]: y.y === e.y && y.m === e.m && y.d === t
154
+ [n.current]: f.y === r.y && f.m === r.m && f.d === t
133
155
  }
134
156
  ),
135
157
  children: t !== 0 && t
136
158
  },
137
- r
159
+ e
138
160
  )),
139
- S.map((t, r) => /* @__PURE__ */ a("div", { className: o.m, children: t }, r))
161
+ j.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e))
140
162
  ] })
141
163
  ]
142
164
  }
143
165
  );
144
166
  };
145
167
  export {
146
- tt as DatePickerModal
168
+ st as DatePickerModal
147
169
  };
@@ -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 MonthPickerModal: ({ date, onChangeValue, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const MonthPickerModal: ({ date, onChangeValue, before, onChangeType, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export {};
@@ -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
  /**