mimir-ui-kit 1.43.1 → 1.43.3

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