mimir-ui-kit 1.64.0 → 1.64.2

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,105 +1,106 @@
1
1
  import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
- import { c as A } from "../../index-DIxK0V-G.js";
3
- import { useState as V } from "react";
4
- import { week as W, COUNT_WORK_DAYS as E } from "./constants.js";
5
- import { useDatePickerPosition as K } from "./hooks.js";
6
- import { c as n } from "../../styles.module-DeBRSK_x.js";
7
- import { getUpdateDate as B } from "./utils.js";
8
- import { Icon as R } from "../../icons/Icon.js";
2
+ import { c as g } from "../../index-DIxK0V-G.js";
3
+ import { useState as E } from "react";
4
+ import { week as F, COUNT_WORK_DAYS as K } from "./constants.js";
5
+ import { useDatePickerPosition as R } from "./hooks.js";
6
+ import { c as n } from "../../styles.module-DjQdoVeY.js";
7
+ import { getUpdateDate as H } from "./utils.js";
8
+ import { Icon as q } from "../../icons/Icon.js";
9
9
  import { formating as m } from "../../utils/index.js";
10
- import { Button as H } from "../Button/Button.js";
11
- import { parseDate as I } from "../../utils/formating/Date.js";
12
- const ct = ({
10
+ import { Button as I } from "../Button/Button.js";
11
+ import { parseDate as O } from "../../utils/formating/Date.js";
12
+ const it = ({
13
13
  date: i,
14
14
  selectedDate: d,
15
- onChangeValue: O,
16
- setIsActive: S,
17
- before: g,
15
+ onChangeValue: S,
16
+ setIsActive: T,
17
+ before: p,
18
18
  onChangeType: D,
19
- disableFuture: T = !1,
20
- disablePast: _ = !1,
21
- disabledDate: p,
22
- validRange: N,
23
- dateFormat: w,
24
- position: j
19
+ disableFuture: _ = !1,
20
+ disablePast: j = !1,
21
+ disabledDate: N,
22
+ validRange: w,
23
+ dateFormat: v,
24
+ position: C,
25
+ isFixed: b
25
26
  }) => {
26
- var k;
27
+ var A;
27
28
  i = isNaN(new Date(i).getTime()) ? /* @__PURE__ */ new Date() : i;
28
- const l = I(i), f = d ? I(d) : l, y = {
29
+ const l = O(i), f = d ? O(d) : l, y = {
29
30
  y: f.getFullYear(),
30
31
  d: f.getDate(),
31
32
  m: f.getMonth() + 1
32
- }, v = {
33
+ }, x = {
33
34
  y: l.getFullYear(),
34
35
  d: l.getDate(),
35
36
  m: l.getMonth() + 1
36
- }, [r, b] = V({ y: v.y, m: v.m }), C = K(j, [r]), L = (t) => {
37
+ }, [r, M] = E({ y: x.y, m: x.m }), L = R(C, b, [r]), Y = (t) => {
37
38
  let e = t.getDay();
38
39
  return e === 0 && (e = 7), e - 1;
39
- }, x = r.m - 1, c = new Date(r.y, x), h = [], M = (() => {
40
+ }, $ = r.m - 1, c = new Date(r.y, $), h = [], k = (() => {
40
41
  const t = new Date(c);
41
42
  t.setDate(t.getDate() - 1);
42
43
  const e = t.getDate(), o = [];
43
- for (let s = 0; s < L(c); s++)
44
+ for (let s = 0; s < Y(c); s++)
44
45
  o.push(e - s);
45
46
  return o.reverse(), o;
46
47
  })();
47
- for (; c.getMonth() === x; )
48
+ for (; c.getMonth() === $; )
48
49
  h.push(c.getDate()), c.setDate(c.getDate() + 1);
49
- const Y = (() => {
50
- const e = 42 - (M.length + h.length), o = [];
50
+ const z = (() => {
51
+ const e = 42 - (k.length + h.length), o = [];
51
52
  for (let s = 1; s <= e; s++)
52
53
  o.push(s);
53
54
  return o;
54
- })(), z = () => {
55
- S(!1);
56
- }, F = () => {
57
- b(B(r.m + 1, r.y));
58
- }, G = () => {
59
- b(B(r.m - 1, r.y));
60
- }, $ = (t) => {
55
+ })(), G = () => {
56
+ T(!1);
57
+ }, U = () => {
58
+ M(H(r.m + 1, r.y));
59
+ }, V = () => {
60
+ M(H(r.m - 1, r.y));
61
+ }, P = (t) => {
61
62
  const e = new Date(t);
62
- if (e.setHours(0, 0, 0, 0), g && g.getTime() > t)
63
+ if (e.setHours(0, 0, 0, 0), p && p.getTime() > t)
63
64
  return !0;
64
- if (T) {
65
+ if (_) {
65
66
  const o = /* @__PURE__ */ new Date();
66
67
  if (o.setHours(0, 0, 0, 0), e.getTime() > o.getTime()) return !0;
67
68
  }
68
- if (_) {
69
+ if (j) {
69
70
  const o = /* @__PURE__ */ new Date();
70
71
  if (o.setHours(0, 0, 0, 0), t < o.getTime()) return !0;
71
72
  }
72
- if (p && p(e)) return !0;
73
- if (N) {
74
- const [o, s] = N, P = new Date(t);
75
- if (o.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), P < o || P > s) return !0;
73
+ if (N && N(e)) return !0;
74
+ if (w) {
75
+ const [o, s] = w, B = new Date(t);
76
+ if (o.setHours(0, 0, 0, 0), s.setHours(0, 0, 0, 0), B < o || B > s) return !0;
76
77
  }
77
78
  return !1;
78
- }, U = (t) => {
79
- $(
79
+ }, W = (t) => {
80
+ P(
80
81
  (/* @__PURE__ */ new Date(
81
82
  `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
82
83
  )).getTime()
83
- ) || (O(
84
+ ) || (S(
84
85
  /* @__PURE__ */ new Date(
85
86
  `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
86
87
  )
87
- ), z());
88
+ ), G());
88
89
  };
89
90
  return /* @__PURE__ */ u(
90
91
  "div",
91
92
  {
92
- className: n["calendar-block"],
93
- ref: C,
93
+ className: g(n["calendar-block"], b && n.fixed),
94
+ ref: L,
94
95
  "data-testid": "calendar-modal",
95
96
  children: [
96
97
  /* @__PURE__ */ u("div", { className: n.h, children: [
97
98
  /* @__PURE__ */ a(
98
- H,
99
+ I,
99
100
  {
100
101
  isIconButton: !0,
101
102
  iconName: "DropdownArrowLeft16px",
102
- onClick: G,
103
+ onClick: V,
103
104
  variant: "secondary-gray",
104
105
  size: "l"
105
106
  }
@@ -110,45 +111,45 @@ const ct = ({
110
111
  type: "button",
111
112
  className: n.d,
112
113
  "data-testid": "month-year-button",
113
- onClick: w === "month" ? void 0 : () => D == null ? void 0 : D("months"),
114
+ onClick: v === "month" ? void 0 : () => D == null ? void 0 : D("months"),
114
115
  children: [
115
- (k = m.Month(r.m)) == null ? void 0 : k.name,
116
+ (A = m.Month(r.m)) == null ? void 0 : A.name,
116
117
  "’",
117
118
  r.y.toString().slice(-2),
118
- w !== "month" && /* @__PURE__ */ a(R, { iconName: "DropdownArrowBottom16px" })
119
+ v !== "month" && /* @__PURE__ */ a(q, { iconName: "DropdownArrowBottom16px" })
119
120
  ]
120
121
  }
121
122
  ),
122
123
  /* @__PURE__ */ a(
123
- H,
124
+ I,
124
125
  {
125
126
  isIconButton: !0,
126
127
  iconName: "DropdownArrowRight16px",
127
- onClick: F,
128
+ onClick: U,
128
129
  variant: "secondary-gray",
129
130
  size: "l"
130
131
  }
131
132
  )
132
133
  ] }),
133
134
  /* @__PURE__ */ u("div", { className: n.b, children: [
134
- W.map((t, e) => /* @__PURE__ */ a(
135
+ F.map((t, e) => /* @__PURE__ */ a(
135
136
  "div",
136
137
  {
137
- className: A(n.m, {
138
- [n.orange]: e > E
138
+ className: g(n.m, {
139
+ [n.orange]: e > K
139
140
  }),
140
141
  children: t
141
142
  },
142
143
  `v${e}`
143
144
  )),
144
- M.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e)),
145
+ k.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e)),
145
146
  h.map((t, e) => /* @__PURE__ */ a(
146
147
  "button",
147
148
  {
148
149
  type: "button",
149
- onClick: () => U(t),
150
- className: A(
151
- $(
150
+ onClick: () => W(t),
151
+ className: g(
152
+ P(
152
153
  (/* @__PURE__ */ new Date(
153
154
  `${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
154
155
  )).getTime()
@@ -161,12 +162,12 @@ const ct = ({
161
162
  },
162
163
  e
163
164
  )),
164
- Y.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e))
165
+ z.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e))
165
166
  ] })
166
167
  ]
167
168
  }
168
169
  );
169
170
  };
170
171
  export {
171
- ct as DatePickerModal
172
+ it as DatePickerModal
172
173
  };
@@ -11,6 +11,7 @@ type TProps = {
11
11
  validRange?: [Date, Date];
12
12
  dateFormat?: 'full' | 'month' | 'year';
13
13
  position?: 'center' | 'bottom' | 'top';
14
+ isFixed?: boolean;
14
15
  };
15
- export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat, position }: TProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat, position, isFixed }: TProps) => import("react/jsx-runtime").JSX.Element;
16
17
  export {};
@@ -1,136 +1,144 @@
1
- import { jsxs as w, jsx as f } from "react/jsx-runtime";
2
- import { c as C } from "../../index-DIxK0V-G.js";
3
- import { useState as L } from "react";
4
- import { months as b } from "./constants.js";
5
- import { useDatePickerPosition as q } from "./hooks.js";
6
- import { c } from "../../styles.module-DeBRSK_x.js";
7
- import { Icon as E } from "../../icons/Icon.js";
8
- import { formating as P } from "../../utils/index.js";
9
- import { Button as A } from "../Button/Button.js";
10
- const tt = ({
11
- date: F,
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
+ import { c as A } from "../../index-DIxK0V-G.js";
3
+ import { useState as b } from "react";
4
+ import { months as q } from "./constants.js";
5
+ import { useDatePickerPosition as E } from "./hooks.js";
6
+ import { c as a } from "../../styles.module-DjQdoVeY.js";
7
+ import { Icon as J } from "../../icons/Icon.js";
8
+ import { formating as G } from "../../utils/index.js";
9
+ import { Button as I } from "../Button/Button.js";
10
+ const et = ({
11
+ date: N,
12
12
  selectedDate: D,
13
- onChangeValue: G,
13
+ onChangeValue: O,
14
14
  before: m,
15
15
  onChangeType: y,
16
16
  onChangeMonth: g,
17
- disableFuture: I = !1,
18
- disablePast: N = !1,
17
+ disableFuture: S = !1,
18
+ disablePast: $ = !1,
19
19
  disabledDate: u,
20
20
  validRange: h,
21
21
  dateFormat: M,
22
- position: O
22
+ position: j,
23
+ isFixed: k
23
24
  }) => {
24
- const S = q(O), d = new Date(F), p = D ? new Date(D) : d, k = {
25
+ const z = E(j, k), d = new Date(N), p = D ? new Date(D) : d, x = {
25
26
  y: p.getFullYear(),
26
27
  d: p.getDate(),
27
28
  m: p.getMonth() + 1
28
- }, x = {
29
+ }, Y = {
29
30
  y: d.getFullYear(),
30
31
  d: d.getDate(),
31
32
  m: d.getMonth() + 1
32
- }, [t, Y] = L(x.y), $ = () => {
33
- Y(t + 1);
34
- }, j = () => {
35
- Y(t - 1);
36
- }, v = (e) => {
37
- const i = /* @__PURE__ */ new Date(), r = i.getFullYear(), l = i.getMonth() + 1;
33
+ }, [t, v] = b(Y.y), F = () => {
34
+ v(t + 1);
35
+ }, R = () => {
36
+ v(t - 1);
37
+ }, B = (e) => {
38
+ const i = /* @__PURE__ */ new Date(), r = i.getFullYear(), f = i.getMonth() + 1;
38
39
  if (h) {
39
- const [n, a] = h, o = new Date(t, e - 1, 1), s = new Date(t, e, 0);
40
+ const [n, c] = h, o = new Date(t, e - 1, 1), s = new Date(t, e, 0);
40
41
  o.setHours(0, 0, 0, 0), s.setHours(23, 59, 59, 999);
41
- const B = new Date(n), H = new Date(a);
42
- B.setHours(0, 0, 0, 0), H.setHours(23, 59, 59, 999);
43
- const R = s < B, _ = o > H;
44
- if (R || _)
42
+ const H = new Date(n), P = new Date(c);
43
+ H.setHours(0, 0, 0, 0), P.setHours(23, 59, 59, 999);
44
+ const C = s < H, L = o > P;
45
+ if (C || L)
45
46
  return !0;
46
47
  }
47
48
  if (m) {
48
- const n = m.getFullYear(), a = m.getMonth() + 1;
49
- if (n > t || n === t && a > e)
49
+ const n = m.getFullYear(), c = m.getMonth() + 1;
50
+ if (n > t || n === t && c > e)
50
51
  return !0;
51
52
  }
52
- if (I && (t > r || t === r && e > l) || N && (t < r || t === r && e < l))
53
+ if (S && (t > r || t === r && e > f) || $ && (t < r || t === r && e < f))
53
54
  return !0;
54
55
  if (u) {
55
- const n = new Date(t, e, 0).getDate(), a = [1, Math.ceil(n / 2), n];
56
- for (const o of a) {
56
+ const n = new Date(t, e, 0).getDate(), c = [1, Math.ceil(n / 2), n];
57
+ for (const o of c) {
57
58
  const s = new Date(t, e - 1, o);
58
59
  if (!u(s)) return !1;
59
60
  }
60
61
  for (let o = 2; o < n; o += 3) {
61
- if (a.includes(o)) continue;
62
+ if (c.includes(o)) continue;
62
63
  const s = new Date(t, e - 1, o);
63
64
  if (!u(s)) return !1;
64
65
  }
65
66
  for (let o = 1; o <= n; o++) {
66
- if (a.includes(o) || (o - 2) % 3 === 0) continue;
67
+ if (c.includes(o) || (o - 2) % 3 === 0) continue;
67
68
  const s = new Date(t, e - 1, o);
68
69
  if (!u(s)) return !1;
69
70
  }
70
71
  return !0;
71
72
  }
72
73
  return !1;
73
- }, z = (e) => {
74
- v(e) || (g ? g(t, e) : G(
74
+ }, _ = (e) => {
75
+ B(e) || (g ? g(t, e) : O(
75
76
  /* @__PURE__ */ new Date(
76
- `${t}-${P.Number(2, e)}-${P.Number(2, x.d)}`
77
+ `${t}-${G.Number(2, e)}-${G.Number(2, Y.d)}`
77
78
  )
78
79
  ));
79
80
  };
80
- return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref: S, children: [
81
- /* @__PURE__ */ w("div", { className: c.h, children: [
82
- /* @__PURE__ */ f(
83
- A,
84
- {
85
- isIconButton: !0,
86
- iconName: "DropdownArrowLeft16px",
87
- onClick: j,
88
- variant: "secondary-gray",
89
- size: "l"
90
- }
91
- ),
92
- /* @__PURE__ */ w(
93
- "button",
94
- {
95
- type: "button",
96
- className: c.d,
97
- "data-testid": "year-button",
98
- onClick: M === "month" ? void 0 : () => y == null ? void 0 : y("years"),
99
- children: [
100
- t.toString(),
101
- M !== "month" && /* @__PURE__ */ f(E, { iconName: "DropdownArrowBottom16px" })
102
- ]
103
- }
104
- ),
105
- /* @__PURE__ */ f(
106
- A,
107
- {
108
- isIconButton: !0,
109
- iconName: "DropdownArrowRight16px",
110
- onClick: $,
111
- variant: "secondary-gray",
112
- size: "l"
113
- }
114
- )
115
- ] }),
116
- /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: b.map((e, i) => {
117
- const r = i + 1, l = v(r);
118
- return /* @__PURE__ */ f(
119
- "button",
120
- {
121
- type: "button",
122
- onClick: () => z(r),
123
- disabled: l,
124
- className: C(l ? c.m : c.a, {
125
- [c.current]: D && k.y === t && k.m === r
126
- }),
127
- children: e
128
- },
129
- i
130
- );
131
- }) })
132
- ] });
81
+ return /* @__PURE__ */ w(
82
+ "div",
83
+ {
84
+ className: A(a["calendar-block"], k && a.fixed),
85
+ ref: z,
86
+ children: [
87
+ /* @__PURE__ */ w("div", { className: a.h, children: [
88
+ /* @__PURE__ */ l(
89
+ I,
90
+ {
91
+ isIconButton: !0,
92
+ iconName: "DropdownArrowLeft16px",
93
+ onClick: R,
94
+ variant: "secondary-gray",
95
+ size: "l"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ w(
99
+ "button",
100
+ {
101
+ type: "button",
102
+ className: a.d,
103
+ "data-testid": "year-button",
104
+ onClick: M === "month" ? void 0 : () => y == null ? void 0 : y("years"),
105
+ children: [
106
+ t.toString(),
107
+ M !== "month" && /* @__PURE__ */ l(J, { iconName: "DropdownArrowBottom16px" })
108
+ ]
109
+ }
110
+ ),
111
+ /* @__PURE__ */ l(
112
+ I,
113
+ {
114
+ isIconButton: !0,
115
+ iconName: "DropdownArrowRight16px",
116
+ onClick: F,
117
+ variant: "secondary-gray",
118
+ size: "l"
119
+ }
120
+ )
121
+ ] }),
122
+ /* @__PURE__ */ l("div", { className: a.monthGrid, "data-testid": "month-picker", children: q.map((e, i) => {
123
+ const r = i + 1, f = B(r);
124
+ return /* @__PURE__ */ l(
125
+ "button",
126
+ {
127
+ type: "button",
128
+ onClick: () => _(r),
129
+ disabled: f,
130
+ className: A(f ? a.m : a.a, {
131
+ [a.current]: D && x.y === t && x.m === r
132
+ }),
133
+ children: e
134
+ },
135
+ i
136
+ );
137
+ }) })
138
+ ]
139
+ }
140
+ );
133
141
  };
134
142
  export {
135
- tt as MonthPickerModal
143
+ et as MonthPickerModal
136
144
  };
@@ -10,6 +10,7 @@ type TProps = {
10
10
  disabledDate?: (date: Date) => boolean;
11
11
  validRange?: [Date, Date];
12
12
  position?: 'center' | 'bottom' | 'top';
13
+ isFixed?: boolean;
13
14
  };
14
- export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange, position }: TProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange, position, isFixed }: TProps) => import("react/jsx-runtime").JSX.Element;
15
16
  export {};