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
@@ -49,6 +49,22 @@ export type TProps = {
49
49
  * Флаг отправки промежуточных значений в родительский компонент
50
50
  */
51
51
  sendIntermediateValues?: boolean;
52
+ /**
53
+ * Флаг отключения выбора будущих дат
54
+ */
55
+ disableFuture?: boolean;
56
+ /**
57
+ * Флаг отключения выбора прошлых дат
58
+ */
59
+ disablePast?: boolean;
60
+ /**
61
+ * Функция для определения недоступных дат
62
+ */
63
+ disabledDate?: (date: Date) => boolean;
64
+ /**
65
+ * Диапазон доступных дат [от, до]
66
+ */
67
+ validRange?: [Date | string, Date | string];
52
68
  } & TInputProps;
53
69
  export type TDatePickerValue = {
54
70
  value?: string;
@@ -107,4 +123,20 @@ export declare const DatePicker: import('react').MemoExoticComponent<import('rea
107
123
  * Флаг отправки промежуточных значений в родительский компонент
108
124
  */
109
125
  sendIntermediateValues?: boolean;
126
+ /**
127
+ * Флаг отключения выбора будущих дат
128
+ */
129
+ disableFuture?: boolean;
130
+ /**
131
+ * Флаг отключения выбора прошлых дат
132
+ */
133
+ disablePast?: boolean;
134
+ /**
135
+ * Функция для определения недоступных дат
136
+ */
137
+ disabledDate?: (date: Date) => boolean;
138
+ /**
139
+ * Диапазон доступных дат [от, до]
140
+ */
141
+ validRange?: [Date | string, Date | string];
110
142
  } & import('../Input/types').TInputProps & import('../Input').TAdditionalProps & import('react').RefAttributes<HTMLInputElement>>>;
@@ -1,164 +1,178 @@
1
- import { jsxs as R, jsx as o } from "react/jsx-runtime";
2
- import { c as u } from "../../index-DIxK0V-G.js";
3
- import { memo as tt, forwardRef as st, useState as w, useEffect as x } from "react";
4
- import { MAX_DAY as et, MAX_MONTH as it, DATE_LENGTH as rt } from "./constants.js";
5
- import { DatePickerModal as ct } from "./DatePickerModal.js";
6
- import { MonthPickerModal as at } from "./MonthPickerModal.js";
1
+ import { jsxs as E, jsx as m } from "react/jsx-runtime";
2
+ import { c as Y } from "../../index-DIxK0V-G.js";
3
+ import { memo as ot, forwardRef as ct, useState as N, useEffect as v } from "react";
4
+ import { MAX_DAY as at, MAX_MONTH as mt, DATE_LENGTH as ft } from "./constants.js";
5
+ import { DatePickerModal as pt } from "./DatePickerModal.js";
6
+ import { MonthPickerModal as dt } from "./MonthPickerModal.js";
7
7
  import { c as e } from "../../styles.module-Cuqm31CO.js";
8
- import { formatDatePart as U } from "./utils.js";
9
- import { YearPickerModal as ot } from "./YearPickerModal.js";
10
- import { useClickOutside as mt } from "../../hooks/useClickOutside/useClickOutside.js";
11
- import { Icon as X } from "../../icons/Icon.js";
12
- import { formating as n } from "../../utils/index.js";
13
- import { I as pt } from "../../Input-BU_6U1CW.js";
14
- import { EInputStatus as dt, EInputSize as E } from "../Input/constants.js";
15
- const ft = {
16
- days: ct,
17
- months: at,
18
- years: ot
19
- }, yt = tt(
20
- st(
8
+ import { formatDatePart as F } from "./utils.js";
9
+ import { YearPickerModal as yt } from "./YearPickerModal.js";
10
+ import { useClickOutside as nt } from "../../hooks/useClickOutside/useClickOutside.js";
11
+ import { Icon as G } from "../../icons/Icon.js";
12
+ import { formating as D } from "../../utils/index.js";
13
+ import { I as lt } from "../../Input-BU_6U1CW.js";
14
+ import { EInputStatus as Dt, EInputSize as K } from "../Input/constants.js";
15
+ const wt = {
16
+ days: pt,
17
+ months: dt,
18
+ years: yt
19
+ }, Nt = ot(
20
+ ct(
21
21
  ({
22
- size: S,
22
+ size: $,
23
23
  value: i,
24
- onChangeValue: t,
24
+ onChangeValue: s,
25
25
  name: c,
26
- before: $,
27
- type: p = "days",
28
- error: _,
29
- onError: d,
26
+ before: _,
27
+ type: d = "days",
28
+ error: j,
29
+ onError: y,
30
30
  onBlur: r,
31
- validateImmediately: O,
32
- variant: F,
33
- disabled: g = !1,
34
- editable: D = !1,
35
- openOnInput: Y = !0,
36
- sendIntermediateValues: G = !1,
37
- ...k
38
- }, K) => {
39
- const [A, m] = w(!1), [j, f] = w(p), [a, I] = w(
31
+ validateImmediately: g,
32
+ variant: W,
33
+ disabled: b = !1,
34
+ editable: k = !1,
35
+ openOnInput: H = !0,
36
+ sendIntermediateValues: q = !1,
37
+ disableFuture: J = !1,
38
+ disablePast: Q = !1,
39
+ disabledDate: Z,
40
+ validRange: f,
41
+ ...A
42
+ }, z) => {
43
+ const [I, p] = N(!1), [h, n] = N(d), [a, P] = N(
40
44
  () => i && !isNaN(new Date(i).getTime()) ? new Date(i) : void 0
41
- ), [P, b] = w(_), [W, T] = w("");
42
- k.status = !!P && dt.Error || k.status, x(() => {
43
- b(_);
44
- }, [_]), x(() => {
45
- I(
45
+ ), [T, u] = N(j), [R, M] = N("");
46
+ A.status = !!T && Dt.Error || A.status, v(() => {
47
+ u(j);
48
+ }, [j]), v(() => {
49
+ P(
46
50
  i && !isNaN(new Date(i).getTime()) ? new Date(i) : void 0
47
51
  );
48
- }, [i]), x(() => {
49
- a && typeof a != "string" && !isNaN(a == null ? void 0 : a.getTime()) ? T(n.Date(a, "dd/mm/yyyy")) : T("");
52
+ }, [i]), v(() => {
53
+ a && typeof a != "string" && !isNaN(a == null ? void 0 : a.getTime()) ? M(D.Date(a, "dd/mm/yyyy")) : M("");
50
54
  }, [a]);
51
- const H = i && new Date(i).getTime;
52
- x(() => {
53
- O && (H ? (b(!1), d == null || d({ name: c, active: !1 })) : (b(!0), d == null || d({ name: c, active: !0 })));
54
- }, [O, c, H]), mt({
55
- isActive: A,
56
- setActive: (s) => {
57
- m(s), f(p);
55
+ const L = i && new Date(i).getTime;
56
+ v(() => {
57
+ g && (L ? (u(!1), y == null || y({ name: c, active: !1 })) : (u(!0), y == null || y({ name: c, active: !0 })));
58
+ }, [g, c, L]), nt({
59
+ isActive: I,
60
+ setActive: (t) => {
61
+ p(t), n(d);
58
62
  },
59
63
  className: e["calendar-block"]
60
64
  });
61
- const q = () => {
62
- !g && (Y || !D) && m(!0);
63
- }, J = (s) => {
64
- isNaN(s.getTime()) || (I(s), t == null || t({
65
- value: n.Date(s, "yyyy-mm-dd"),
65
+ const C = () => {
66
+ !b && (H || !k) && p(!0);
67
+ }, B = (t) => {
68
+ isNaN(t.getTime()) || (P(t), s == null || s({
69
+ value: D.Date(t, "yyyy-mm-dd"),
66
70
  name: c
67
- })), j === "years" && (p === "years" ? (m(!1), f(p)) : f("months")), j === "months" && (p === "months" ? (m(!1), f(p)) : f("days")), I(s), t == null || t({
68
- value: n.Date(s, "yyyy-mm-dd"),
71
+ })), h === "years" && (d === "years" ? (p(!1), n(d)) : n("months")), h === "months" && (d === "months" ? (p(!1), n(d)) : n("days")), P(t), s == null || s({
72
+ value: D.Date(t, "yyyy-mm-dd"),
69
73
  name: c
70
- }), r == null || r(n.Date(s, "yyyy-mm-dd"));
71
- }, Q = (s) => {
72
- if (D) {
73
- const l = s.target.value.replace(/[^\d]/g, "");
74
- if (l.length === 0)
75
- T(""), t == null || t({ value: "", name: c }), r == null || r("");
74
+ }), r == null || r(D.Date(t, "yyyy-mm-dd"));
75
+ }, V = (t) => {
76
+ if (k) {
77
+ const o = t.target.value.replace(/[^\d]/g, "");
78
+ if (o.length === 0)
79
+ M(""), s == null || s({ value: "", name: c }), r == null || r("");
76
80
  else {
77
- const [y, M, N] = [
78
- U(l.substring(0, 2), et),
79
- U(l.substring(2, 4), it),
80
- l.substring(4, 8)
81
- ], L = [y, M, N].filter(Boolean).join("/");
82
- if (T(L), G) {
83
- const h = N ? `${N}-${M || "00"}-${y || "00"}` : [y, M, N].filter(Boolean).join("-");
84
- t == null || t({
85
- value: h,
81
+ const [l, x, w] = [
82
+ F(o.substring(0, 2), at),
83
+ F(o.substring(2, 4), mt),
84
+ o.substring(4, 8)
85
+ ], X = [l, x, w].filter(Boolean).join("/");
86
+ if (M(X), q) {
87
+ const O = w ? `${w}-${x || "00"}-${l || "00"}` : [l, x, w].filter(Boolean).join("-");
88
+ s == null || s({
89
+ value: O,
86
90
  name: c
87
91
  });
88
92
  }
89
- if (L.length === rt) {
90
- const h = parseInt(N), v = /* @__PURE__ */ new Date(
91
- `${h}-${M.padStart(2, "0")}-${y.padStart(2, "0")}`
93
+ if (X.length === ft) {
94
+ const O = parseInt(w), S = /* @__PURE__ */ new Date(
95
+ `${O}-${x.padStart(2, "0")}-${l.padStart(2, "0")}`
92
96
  );
93
- isNaN(v.getTime()) || (I(v), t == null || t({
94
- value: n.Date(v, "yyyy-mm-dd"),
97
+ isNaN(S.getTime()) || (P(S), s == null || s({
98
+ value: D.Date(S, "yyyy-mm-dd"),
95
99
  name: c
96
- }), r == null || r(n.Date(v, "yyyy-mm-dd")));
100
+ }), r == null || r(D.Date(S, "yyyy-mm-dd")));
97
101
  }
98
102
  }
99
103
  }
100
- }, Z = u(e.wrapper, A && e.active), z = u(e.input, e.inputBorderControl), C = {
101
- onChangeValue: J,
104
+ }, tt = Y(e.wrapper, I && e.active), st = Y(e.input, e.inputBorderControl);
105
+ let U;
106
+ if (f) {
107
+ let t, o;
108
+ typeof f[0] == "string" ? t = new Date(f[0]) : t = f[0], typeof f[1] == "string" ? o = new Date(f[1]) : o = f[1], U = [t, o];
109
+ }
110
+ const et = {
111
+ onChangeValue: B,
102
112
  date: a || /* @__PURE__ */ new Date(),
103
- before: typeof $ == "string" ? new Date($) : $,
104
- onChangeType: f,
105
- setIsActive: m
106
- }, B = ft[j], V = ({ isActive: s }) => /* @__PURE__ */ o("button", { onClick: (y) => {
107
- y.stopPropagation(), g || m(!s);
108
- }, className: e["icon-button"], children: s ? /* @__PURE__ */ o(
109
- X,
113
+ before: typeof _ == "string" ? new Date(_) : _,
114
+ onChangeType: n,
115
+ setIsActive: p,
116
+ disableFuture: J,
117
+ disablePast: Q,
118
+ disabledDate: Z,
119
+ validRange: U
120
+ }, it = wt[h], rt = ({ isActive: t }) => /* @__PURE__ */ m("button", { onClick: (l) => {
121
+ l.stopPropagation(), b || p(!t);
122
+ }, className: e["icon-button"], children: t ? /* @__PURE__ */ m(
123
+ G,
110
124
  {
111
- iconName: S === E.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
125
+ iconName: $ === K.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
112
126
  }
113
- ) : /* @__PURE__ */ o(
114
- X,
127
+ ) : /* @__PURE__ */ m(
128
+ G,
115
129
  {
116
- iconName: S === E.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
130
+ iconName: $ === K.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
117
131
  }
118
132
  ) });
119
- return /* @__PURE__ */ R("div", { className: e["input-field-group-datePicker"], children: [
120
- /* @__PURE__ */ R("div", { className: Z, "data-disabled": g, children: [
121
- /* @__PURE__ */ o(
133
+ return /* @__PURE__ */ E("div", { className: e["input-field-group-datePicker"], children: [
134
+ /* @__PURE__ */ E("div", { className: tt, "data-disabled": b, children: [
135
+ /* @__PURE__ */ m(
122
136
  "div",
123
137
  {
124
138
  role: "button",
125
- "data-status": k.status,
126
- className: u(e["date-wrapper"], {
127
- [e.editable]: D
139
+ "data-status": A.status,
140
+ className: Y(e["date-wrapper"], {
141
+ [e.editable]: k
128
142
  }),
129
- onClick: q,
130
- children: /* @__PURE__ */ o(
131
- pt,
143
+ onClick: C,
144
+ children: /* @__PURE__ */ m(
145
+ lt,
132
146
  {
133
- ref: K,
134
- className: z,
147
+ ref: z,
148
+ className: st,
135
149
  wrapperClassName: e["input-wrapper"],
136
- size: S,
150
+ size: $,
137
151
  type: "text",
138
- variant: F,
139
- value: W,
140
- onChange: Q,
152
+ variant: W,
153
+ value: R,
154
+ onChange: V,
141
155
  rightAddon: {
142
156
  addonType: "react-node",
143
- addonContent: /* @__PURE__ */ o(V, { isActive: A })
157
+ addonContent: /* @__PURE__ */ m(rt, { isActive: I })
144
158
  },
145
159
  rightSlotClassName: e["right-slot"],
146
160
  onFocus: () => {
147
- Y && !D && m(!0);
161
+ H && !k && p(!0);
148
162
  },
149
- ...k
163
+ ...A
150
164
  }
151
165
  )
152
166
  }
153
167
  ),
154
- A && /* @__PURE__ */ o(B, { ...C })
168
+ I && /* @__PURE__ */ m(it, { ...et })
155
169
  ] }),
156
- P && typeof P == "string" && /* @__PURE__ */ o("div", { className: e.textError, children: P })
170
+ T && typeof T == "string" && /* @__PURE__ */ m("div", { className: e.textError, children: T })
157
171
  ] });
158
172
  }
159
173
  )
160
174
  );
161
- yt.displayName = "DatePicker";
175
+ Nt.displayName = "DatePicker";
162
176
  export {
163
- yt as DatePicker
177
+ Nt as DatePicker
164
178
  };
@@ -4,6 +4,10 @@ type TProps = {
4
4
  onChangeValue: (date: Date) => void;
5
5
  setIsActive: (isActive: boolean) => void;
6
6
  onChangeType?: (s: 'days' | 'months' | 'years') => void;
7
+ disableFuture?: boolean;
8
+ disablePast?: boolean;
9
+ disabledDate?: (date: Date) => boolean;
10
+ validRange?: [Date, Date];
7
11
  };
8
- export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
9
13
  export {};
@@ -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 {};