mimir-ui-kit 1.43.3 → 1.43.4

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,14 +1,12 @@
1
1
  type TProps = {
2
2
  date: Date;
3
- selectedDate?: Date;
4
3
  before?: Date;
5
4
  onChangeValue: (date: Date) => void;
6
5
  onChangeType?: (type: 'years') => void;
7
- onChangeMonth?: (year: number, month: number) => void;
8
6
  disableFuture?: boolean;
9
7
  disablePast?: boolean;
10
8
  disabledDate?: (date: Date) => boolean;
11
9
  validRange?: [Date, Date];
12
10
  };
13
- export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange }: 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;
14
12
  export {};
@@ -1,128 +1,126 @@
1
- import { jsxs as w, jsx as f } from "react/jsx-runtime";
2
- import { c as R } from "../../index-DIxK0V-G.js";
3
- import { useState as _ } from "react";
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
4
  import { months as C } from "./constants.js";
5
- import { useDatePickerPosition as L } from "./hooks.js";
5
+ import { useDatePickerPosition as R } from "./hooks.js";
6
6
  import { c } from "../../styles.module-Cuqm31CO.js";
7
- import { Icon as b } from "../../icons/Icon.js";
8
- import { formating as F } from "../../utils/index.js";
9
- import { Button as H } from "../Button/Button.js";
10
- const Z = ({
11
- date: P,
12
- selectedDate: D,
13
- onChangeValue: A,
14
- before: m,
15
- onChangeType: y,
16
- onChangeMonth: g,
17
- disableFuture: G = !1,
18
- disablePast: I = !1,
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,
19
17
  disabledDate: u,
20
- validRange: M
18
+ validRange: g
21
19
  }) => {
22
- const N = L(), d = new Date(P), p = D ? new Date(D) : d, h = {
23
- y: p.getFullYear(),
24
- d: p.getDate(),
25
- m: p.getMonth() + 1
26
- }, k = {
27
- y: d.getFullYear(),
28
- d: d.getDate(),
29
- m: d.getMonth() + 1
30
- }, [t, x] = _(k.y), O = () => {
31
- x(t + 1);
32
- }, S = () => {
33
- x(t - 1);
34
- }, Y = (e) => {
35
- const i = /* @__PURE__ */ new Date(), n = i.getFullYear(), l = i.getMonth() + 1;
36
- if (M) {
37
- const [r, a] = M, o = new Date(t, e - 1, 1), s = new Date(t, e, 0);
38
- o.setHours(0, 0, 0, 0), s.setHours(23, 59, 59, 999);
39
- const v = new Date(r), B = new Date(a);
40
- v.setHours(0, 0, 0, 0), B.setHours(23, 59, 59, 999);
41
- const j = s < v, z = o > B;
42
- if (j || z)
20
+ const A = R(), m = new Date(w), y = new Date(w), h = {
21
+ y: m.getFullYear(),
22
+ d: m.getDate(),
23
+ m: m.getMonth() + 1
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 || $)
43
41
  return !0;
44
42
  }
45
- if (m) {
46
- const r = m.getFullYear(), a = m.getMonth() + 1;
47
- if (r > t || r === t && a > e)
43
+ if (d) {
44
+ const o = d.getFullYear(), s = d.getMonth() + 1;
45
+ if (o > t || o === t && s > n)
48
46
  return !0;
49
47
  }
50
- if (G && (t > n || t === n && e > l) || I && (t < n || t === n && e < l))
48
+ if (N && (t > r || t === r && n > l) || P && (t < r || t === r && n < l))
51
49
  return !0;
52
50
  if (u) {
53
- const r = new Date(t, e, 0).getDate(), a = [1, Math.ceil(r / 2), r];
54
- for (const o of a) {
55
- const s = new Date(t, e - 1, o);
56
- if (!u(s)) return !1;
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;
57
55
  }
58
- for (let o = 2; o < r; o += 3) {
59
- if (a.includes(o)) continue;
60
- const s = new Date(t, e - 1, o);
61
- if (!u(s)) return !1;
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;
62
60
  }
63
- for (let o = 1; o <= r; o++) {
64
- if (a.includes(o) || (o - 2) % 3 === 0) continue;
65
- const s = new Date(t, e - 1, o);
66
- if (!u(s)) return !1;
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;
67
65
  }
68
66
  return !0;
69
67
  }
70
68
  return !1;
71
- }, $ = (e) => {
72
- Y(e) || (g ? g(t, e) : A(
69
+ }, O = (n) => {
70
+ x(n) || H(
73
71
  /* @__PURE__ */ new Date(
74
- `${t}-${F.Number(2, e)}-${F.Number(2, k.d)}`
72
+ `${t}-${B.Number(2, n)}-${B.Number(2, M.d)}`
75
73
  )
76
- ));
74
+ );
77
75
  };
78
- return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref: N, children: [
79
- /* @__PURE__ */ w("div", { className: c.h, children: [
76
+ return /* @__PURE__ */ p("div", { className: c["calendar-block"], ref: A, children: [
77
+ /* @__PURE__ */ p("div", { className: c.h, children: [
80
78
  /* @__PURE__ */ f(
81
- H,
79
+ F,
82
80
  {
83
81
  isIconButton: !0,
84
82
  iconName: "DropdownArrowLeft16px",
85
- onClick: S,
83
+ onClick: I,
86
84
  variant: "secondary-gray",
87
85
  size: "l"
88
86
  }
89
87
  ),
90
- /* @__PURE__ */ w(
88
+ /* @__PURE__ */ p(
91
89
  "button",
92
90
  {
93
91
  type: "button",
94
- onClick: () => y == null ? void 0 : y("years"),
92
+ onClick: () => D == null ? void 0 : D("years"),
95
93
  className: c.d,
96
94
  "data-testid": "year-button",
97
95
  children: [
98
96
  t.toString(),
99
- /* @__PURE__ */ f(b, { iconName: "DropdownArrowBottom16px" })
97
+ /* @__PURE__ */ f(_, { iconName: "DropdownArrowBottom16px" })
100
98
  ]
101
99
  }
102
100
  ),
103
101
  /* @__PURE__ */ f(
104
- H,
102
+ F,
105
103
  {
106
104
  isIconButton: !0,
107
105
  iconName: "DropdownArrowRight16px",
108
- onClick: O,
106
+ onClick: G,
109
107
  variant: "secondary-gray",
110
108
  size: "l"
111
109
  }
112
110
  )
113
111
  ] }),
114
- /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: C.map((e, i) => {
115
- const n = i + 1, l = Y(n);
112
+ /* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: C.map((n, i) => {
113
+ const r = i + 1, l = x(r);
116
114
  return /* @__PURE__ */ f(
117
115
  "button",
118
116
  {
119
117
  type: "button",
120
- onClick: () => $(n),
118
+ onClick: () => O(r),
121
119
  disabled: l,
122
- className: R(l ? c.m : c.a, {
123
- [c.current]: D && h.y === t && h.m === n
120
+ className: j(l ? c.m : c.a, {
121
+ [c.current]: h.y === t && h.m === r
124
122
  }),
125
- children: e
123
+ children: n
126
124
  },
127
125
  i
128
126
  );
@@ -130,5 +128,5 @@ const Z = ({
130
128
  ] });
131
129
  };
132
130
  export {
133
- Z as MonthPickerModal
131
+ W as MonthPickerModal
134
132
  };
@@ -1,14 +1,12 @@
1
1
  type TProps = {
2
2
  date: Date;
3
- selectedDate?: Date;
4
3
  before?: Date;
5
4
  onChangeValue: (date: Date) => void;
6
5
  onChangeType?: (type: 'years') => void;
7
- onChangeYear?: (year: number) => void;
8
6
  disableFuture?: boolean;
9
7
  disablePast?: boolean;
10
8
  disabledDate?: (date: Date) => boolean;
11
9
  validRange?: [Date, Date];
12
10
  };
13
- export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange }: 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;
14
12
  export {};
@@ -1,72 +1,62 @@
1
- import { jsxs as b, jsx as c } from "react/jsx-runtime";
2
- import { c as $ } from "../../index-DIxK0V-G.js";
3
- import { useState as j } from "react";
4
- import { useDatePickerPosition as z } from "./hooks.js";
5
- import { c as n } from "../../styles.module-Cuqm31CO.js";
6
- import { formating as F } from "../../utils/index.js";
7
- import { Button as P } from "../Button/Button.js";
8
- const p = 15, I = 7, W = ({
9
- date: v,
10
- selectedDate: u,
11
- onChangeValue: E,
12
- before: Y,
13
- onChangeType: d,
14
- onChangeYear: N,
15
- disableFuture: S = !1,
16
- disablePast: _ = !1,
17
- disabledDate: o,
18
- validRange: k
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
19
17
  }) => {
20
- const y = z(), i = new Date(v), l = u ? new Date(u) : i, G = {
21
- y: l.getFullYear(),
22
- d: l.getDate(),
23
- m: l.getMonth() + 1
24
- }, e = {
25
- y: i.getFullYear(),
26
- d: i.getDate(),
27
- m: i.getMonth() + 1
28
- }, [D, h] = j(e.y), M = D - I, Q = Array.from(Array(p).keys()).map(
29
- (t) => t + M
30
- ), B = () => {
31
- h(D + p);
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);
32
30
  }, H = () => {
33
- h(D - p);
31
+ N(l - D);
34
32
  }, g = (t) => {
35
- const s = (/* @__PURE__ */ new Date()).getFullYear();
36
- if (k) {
37
- const [a, w] = k;
38
- let r;
39
- if (e.m && e.d)
40
- r = new Date(t, e.m - 1, e.d);
41
- else {
42
- const A = /* @__PURE__ */ new Date();
43
- r = new Date(t, A.getMonth(), A.getDate());
44
- }
45
- r.setHours(0, 0, 0, 0);
46
- const m = new Date(a), f = new Date(w);
47
- if (m.setHours(0, 0, 0, 0), f.setHours(23, 59, 59, 999), r < m || r > f)
48
- return !0;
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;
49
41
  }
50
- if (Y && Y.getFullYear() > t || S && t > s || _ && t < s)
42
+ if (p && p.getFullYear() > t || P && t > n || v && t < n)
51
43
  return !0;
52
- if (o) {
53
- const a = new Date(t, e.m - 1, e.d);
54
- if (!o(a)) return !1;
55
- const w = new Date(t, 2, 15), r = new Date(t, 5, 15), m = new Date(t, 8, 15), f = new Date(t, 11, 15);
56
- return o(w) && o(r) && o(m) && o(f);
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);
57
47
  }
58
48
  return !1;
59
- }, R = (t) => {
60
- g(t) || (N ? N(t) : E(
49
+ }, Q = (t) => {
50
+ g(t) || F(
61
51
  /* @__PURE__ */ new Date(
62
- `${t}-${F.Number(2, e.m)}-${F.Number(2, e.d)}`
52
+ `${t}-${y.Number(2, u.m)}-${y.Number(2, u.d)}`
63
53
  )
64
- ));
54
+ );
65
55
  };
66
- return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: y, children: [
67
- /* @__PURE__ */ b("div", { className: n.h, children: [
68
- /* @__PURE__ */ c(
69
- P,
56
+ return /* @__PURE__ */ x("div", { className: e["calendar-block"], ref: E, children: [
57
+ /* @__PURE__ */ x("div", { className: e.h, children: [
58
+ /* @__PURE__ */ o(
59
+ A,
70
60
  {
71
61
  isIconButton: !0,
72
62
  iconName: "DropdownArrowLeft16px",
@@ -75,39 +65,39 @@ const p = 15, I = 7, W = ({
75
65
  size: "l"
76
66
  }
77
67
  ),
78
- /* @__PURE__ */ c(
68
+ /* @__PURE__ */ o(
79
69
  "button",
80
70
  {
81
71
  type: "button",
82
- onClick: () => d == null ? void 0 : d("years"),
83
- className: n.d
72
+ onClick: () => i == null ? void 0 : i("years"),
73
+ className: e.d
84
74
  }
85
75
  ),
86
- /* @__PURE__ */ c(
87
- P,
76
+ /* @__PURE__ */ o(
77
+ A,
88
78
  {
89
79
  isIconButton: !0,
90
80
  iconName: "DropdownArrowRight16px",
91
- onClick: B,
81
+ onClick: G,
92
82
  variant: "secondary-gray",
93
83
  size: "l"
94
84
  }
95
85
  )
96
86
  ] }),
97
- /* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: Q.map((t, x) => {
98
- const s = g(t);
99
- return /* @__PURE__ */ c(
87
+ /* @__PURE__ */ o("div", { className: e.monthGrid, "data-testid": "year-picker", children: _.map((t, k) => {
88
+ const n = g(t);
89
+ return /* @__PURE__ */ o(
100
90
  "button",
101
91
  {
102
92
  type: "button",
103
- onClick: () => R(t),
104
- disabled: s,
105
- className: $(s ? n.m : n.a, {
106
- [n.current]: u && G.y === t
93
+ onClick: () => Q(t),
94
+ disabled: n,
95
+ className: O(n ? e.m : e.a, {
96
+ [e.current]: R.y === t
107
97
  }),
108
98
  children: t
109
99
  },
110
- x
100
+ k
111
101
  );
112
102
  }) })
113
103
  ] });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.43.3",
4
+ "version": "1.43.4",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {