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.
- package/dist/components/CardTrail/CardTrail.d.ts +1 -1
- package/dist/components/CardTrail/CardTrail.js +84 -83
- package/dist/components/CardTrail/utils.d.ts +1 -0
- package/dist/components/CardTrail/utils.js +16 -7
- package/dist/components/DatePicker/DatePicker.js +135 -199
- package/dist/components/DatePicker/DatePickerModal.d.ts +1 -2
- package/dist/components/DatePicker/DatePickerModal.js +74 -75
- package/dist/components/DatePicker/MonthPickerModal.d.ts +1 -3
- package/dist/components/DatePicker/MonthPickerModal.js +72 -74
- package/dist/components/DatePicker/YearPickerModal.d.ts +1 -3
- package/dist/components/DatePicker/YearPickerModal.js +63 -73
- package/package.json +1 -1
@@ -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,
|
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
|
2
|
-
import { c as
|
3
|
-
import { useState as
|
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
|
5
|
+
import { useDatePickerPosition as R } from "./hooks.js";
|
6
6
|
import { c } from "../../styles.module-Cuqm31CO.js";
|
7
|
-
import { Icon as
|
8
|
-
import { formating as
|
9
|
-
import { Button as
|
10
|
-
const
|
11
|
-
date:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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:
|
18
|
+
validRange: g
|
21
19
|
}) => {
|
22
|
-
const
|
23
|
-
y:
|
24
|
-
d:
|
25
|
-
m:
|
26
|
-
},
|
27
|
-
y:
|
28
|
-
d:
|
29
|
-
m:
|
30
|
-
}, [t,
|
31
|
-
|
32
|
-
},
|
33
|
-
|
34
|
-
},
|
35
|
-
const i = /* @__PURE__ */ new Date(),
|
36
|
-
if (
|
37
|
-
const [
|
38
|
-
|
39
|
-
const
|
40
|
-
|
41
|
-
const
|
42
|
-
if (
|
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 (
|
46
|
-
const
|
47
|
-
if (
|
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 (
|
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
|
54
|
-
for (const
|
55
|
-
const
|
56
|
-
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;
|
57
55
|
}
|
58
|
-
for (let
|
59
|
-
if (
|
60
|
-
const
|
61
|
-
if (!u(
|
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
|
64
|
-
if (
|
65
|
-
const
|
66
|
-
if (!u(
|
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
|
-
},
|
72
|
-
|
69
|
+
}, O = (n) => {
|
70
|
+
x(n) || H(
|
73
71
|
/* @__PURE__ */ new Date(
|
74
|
-
`${t}-${
|
72
|
+
`${t}-${B.Number(2, n)}-${B.Number(2, M.d)}`
|
75
73
|
)
|
76
|
-
)
|
74
|
+
);
|
77
75
|
};
|
78
|
-
return /* @__PURE__ */
|
79
|
-
/* @__PURE__ */
|
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
|
-
|
79
|
+
F,
|
82
80
|
{
|
83
81
|
isIconButton: !0,
|
84
82
|
iconName: "DropdownArrowLeft16px",
|
85
|
-
onClick:
|
83
|
+
onClick: I,
|
86
84
|
variant: "secondary-gray",
|
87
85
|
size: "l"
|
88
86
|
}
|
89
87
|
),
|
90
|
-
/* @__PURE__ */
|
88
|
+
/* @__PURE__ */ p(
|
91
89
|
"button",
|
92
90
|
{
|
93
91
|
type: "button",
|
94
|
-
onClick: () =>
|
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(
|
97
|
+
/* @__PURE__ */ f(_, { iconName: "DropdownArrowBottom16px" })
|
100
98
|
]
|
101
99
|
}
|
102
100
|
),
|
103
101
|
/* @__PURE__ */ f(
|
104
|
-
|
102
|
+
F,
|
105
103
|
{
|
106
104
|
isIconButton: !0,
|
107
105
|
iconName: "DropdownArrowRight16px",
|
108
|
-
onClick:
|
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((
|
115
|
-
const
|
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: () =>
|
118
|
+
onClick: () => O(r),
|
121
119
|
disabled: l,
|
122
|
-
className:
|
123
|
-
[c.current]:
|
120
|
+
className: j(l ? c.m : c.a, {
|
121
|
+
[c.current]: h.y === t && h.m === r
|
124
122
|
}),
|
125
|
-
children:
|
123
|
+
children: n
|
126
124
|
},
|
127
125
|
i
|
128
126
|
);
|
@@ -130,5 +128,5 @@ const Z = ({
|
|
130
128
|
] });
|
131
129
|
};
|
132
130
|
export {
|
133
|
-
|
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,
|
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
|
2
|
-
import { c as
|
3
|
-
import { useState as
|
4
|
-
import { useDatePickerPosition as
|
5
|
-
import { c as
|
6
|
-
import { formating as
|
7
|
-
import { Button as
|
8
|
-
const
|
9
|
-
date:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
21
|
-
y:
|
22
|
-
d:
|
23
|
-
m:
|
24
|
-
},
|
25
|
-
y:
|
26
|
-
d:
|
27
|
-
m:
|
28
|
-
}, [
|
29
|
-
(t) => t +
|
30
|
-
),
|
31
|
-
|
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
|
-
|
31
|
+
N(l - D);
|
34
32
|
}, g = (t) => {
|
35
|
-
const
|
36
|
-
if (
|
37
|
-
const [
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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 (
|
42
|
+
if (p && p.getFullYear() > t || P && t > n || v && t < n)
|
51
43
|
return !0;
|
52
|
-
if (
|
53
|
-
const
|
54
|
-
|
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
|
-
},
|
60
|
-
g(t) || (
|
49
|
+
}, Q = (t) => {
|
50
|
+
g(t) || F(
|
61
51
|
/* @__PURE__ */ new Date(
|
62
|
-
`${t}-${
|
52
|
+
`${t}-${y.Number(2, u.m)}-${y.Number(2, u.d)}`
|
63
53
|
)
|
64
|
-
)
|
54
|
+
);
|
65
55
|
};
|
66
|
-
return /* @__PURE__ */
|
67
|
-
/* @__PURE__ */
|
68
|
-
/* @__PURE__ */
|
69
|
-
|
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__ */
|
68
|
+
/* @__PURE__ */ o(
|
79
69
|
"button",
|
80
70
|
{
|
81
71
|
type: "button",
|
82
|
-
onClick: () =>
|
83
|
-
className:
|
72
|
+
onClick: () => i == null ? void 0 : i("years"),
|
73
|
+
className: e.d
|
84
74
|
}
|
85
75
|
),
|
86
|
-
/* @__PURE__ */
|
87
|
-
|
76
|
+
/* @__PURE__ */ o(
|
77
|
+
A,
|
88
78
|
{
|
89
79
|
isIconButton: !0,
|
90
80
|
iconName: "DropdownArrowRight16px",
|
91
|
-
onClick:
|
81
|
+
onClick: G,
|
92
82
|
variant: "secondary-gray",
|
93
83
|
size: "l"
|
94
84
|
}
|
95
85
|
)
|
96
86
|
] }),
|
97
|
-
/* @__PURE__ */
|
98
|
-
const
|
99
|
-
return /* @__PURE__ */
|
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: () =>
|
104
|
-
disabled:
|
105
|
-
className:
|
106
|
-
[
|
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
|
-
|
100
|
+
k
|
111
101
|
);
|
112
102
|
}) })
|
113
103
|
] });
|