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