mimir-ui-kit 1.42.1 → 1.43.0
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/ProgressBar-COdzy3fY.js +67 -0
- package/dist/assets/CardTrail.css +1 -1
- package/dist/assets/MultiSelectSearch.css +1 -1
- package/dist/assets/Pagination.css +1 -1
- package/dist/assets/SelectSearch.css +1 -1
- package/dist/assets/Switcher.css +1 -1
- package/dist/assets/TabTrail.css +1 -1
- package/dist/assets/hooks.css +1 -0
- package/dist/{combobox-Dv6-ANkb.js → combobox-fIVOzEhl.js} +6 -6
- package/dist/components/Accordion/Accordion.d.ts +6 -0
- package/dist/components/Accordion/Accordion.js +202 -182
- package/dist/components/AnchorLink/Link.d.ts +2 -0
- package/dist/components/AnchorLink/Link.js +54 -42
- package/dist/components/CardTrail/CardTrail.js +47 -46
- package/dist/components/CardTrail/utils.d.ts +0 -1
- package/dist/components/CardTrail/utils.js +7 -8
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/DatePicker/DatePicker.d.ts +32 -0
- package/dist/components/DatePicker/DatePicker.js +125 -111
- package/dist/components/DatePicker/DatePickerModal.d.ts +5 -1
- package/dist/components/DatePicker/DatePickerModal.js +97 -75
- package/dist/components/DatePicker/MonthPickerModal.d.ts +5 -1
- package/dist/components/DatePicker/MonthPickerModal.js +96 -58
- package/dist/components/DatePicker/YearPickerModal.d.ts +5 -1
- package/dist/components/DatePicker/YearPickerModal.js +75 -57
- package/dist/components/Drawer/Drawer.d.ts +7 -1
- package/dist/components/Drawer/Drawer.js +122 -106
- package/dist/components/Drawer/hooks.d.ts +9 -0
- package/dist/components/Drawer/hooks.js +24 -0
- package/dist/components/Dropdown/Dropdown.d.ts +18 -1
- package/dist/components/Dropdown/Dropdown.js +361 -343
- package/dist/components/Dropdown/constants.d.ts +11 -0
- package/dist/components/Dropdown/constants.js +5 -0
- package/dist/components/Dropdown/hooks.d.ts +19 -0
- package/dist/components/Dropdown/hooks.js +11 -0
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/index.js +5 -2
- package/dist/components/Image/Image.d.ts +16 -0
- package/dist/components/Image/Image.js +65 -37
- package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +8 -1
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +461 -302
- package/dist/components/MultiSelectSearch/constants.d.ts +6 -0
- package/dist/components/MultiSelectSearch/constants.js +7 -5
- package/dist/components/MultiSelectSearch/index.d.ts +1 -1
- package/dist/components/MultiSelectSearch/index.js +5 -4
- package/dist/components/MultiSelectSearch/types.d.ts +33 -1
- package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
- package/dist/components/MultiSelectSearch/utils.js +31 -17
- package/dist/components/Pagination/Pagination.d.ts +23 -0
- package/dist/components/Pagination/Pagination.js +137 -99
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.d.ts +8 -1
- package/dist/components/SelectSearch/SelectSearch.js +381 -220
- package/dist/components/SelectSearch/constants.d.ts +6 -0
- package/dist/components/SelectSearch/constants.js +3 -2
- package/dist/components/SelectSearch/index.d.ts +1 -1
- package/dist/components/SelectSearch/index.js +5 -4
- package/dist/components/SelectSearch/types.d.ts +32 -1
- package/dist/components/SelectSearch/utils.d.ts +2 -0
- package/dist/components/SelectSearch/utils.js +28 -14
- package/dist/components/Switcher/Switcher.js +66 -59
- package/dist/components/Switcher/types.d.ts +1 -0
- package/dist/components/TabTrail/TabTrail.d.ts +9 -0
- package/dist/components/TabTrail/TabTrail.js +198 -190
- package/dist/components/Toasts/ProgressBar.d.ts +4 -2
- package/dist/components/Toasts/ProgressBar.js +1 -1
- package/dist/components/Toasts/Toast.d.ts +5 -1
- package/dist/components/Toasts/Toast.js +59 -44
- package/dist/components/Toasts/ToastList.js +1 -1
- package/dist/components/Toasts/ToastsProvider.js +1 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +154 -149
- package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
- package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
- package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
- package/dist/hooks/useTimer/index.d.ts +2 -1
- package/dist/hooks/useTimer/index.js +55 -41
- package/dist/hooks-HgN6Yauq.js +117 -0
- package/dist/index.js +182 -177
- package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
- package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
- package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
- package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
- package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
- package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
- package/package.json +3 -1
- package/dist/ProgressBar-DEFs1tWq.js +0 -55
- package/dist/assets/Dropdown.css +0 -1
- package/dist/components/Pagination/types.d.ts +0 -0
@@ -1,80 +1,102 @@
|
|
1
1
|
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
2
|
-
import { c as
|
3
|
-
import { useState as
|
4
|
-
import { week as
|
5
|
-
import { useDatePickerPosition as
|
6
|
-
import { c as
|
7
|
-
import { getUpdateDate as
|
8
|
-
import { Icon as
|
9
|
-
import { formating as
|
10
|
-
import { Button as
|
11
|
-
import { parseDate as
|
12
|
-
const
|
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";
|
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";
|
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 = ({
|
13
13
|
date: i,
|
14
|
-
onChangeValue:
|
15
|
-
setIsActive:
|
16
|
-
before:
|
17
|
-
onChangeType: u
|
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
|
18
22
|
}) => {
|
19
|
-
var
|
23
|
+
var M;
|
20
24
|
i = isNaN(new Date(i).getTime()) ? /* @__PURE__ */ new Date() : i;
|
21
|
-
const
|
22
|
-
y: d.getFullYear(),
|
23
|
-
d: d.getDate(),
|
24
|
-
m: d.getMonth() + 1
|
25
|
-
}, f = {
|
25
|
+
const D = B(i), d = B(i), f = {
|
26
26
|
y: D.getFullYear(),
|
27
27
|
d: D.getDate(),
|
28
28
|
m: D.getMonth() + 1
|
29
|
-
},
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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) => {
|
34
|
+
let e = t.getDay();
|
35
|
+
return e === 0 && (e = 7), e - 1;
|
36
|
+
}, b = r.m - 1, c = new Date(r.y, b), y = [], v = (() => {
|
37
|
+
const t = new Date(c);
|
34
38
|
t.setDate(t.getDate() - 1);
|
35
|
-
const
|
36
|
-
for (let
|
37
|
-
|
38
|
-
return
|
39
|
+
const e = t.getDate(), o = [];
|
40
|
+
for (let s = 0; s < _(c); s++)
|
41
|
+
o.push(e - s);
|
42
|
+
return o.reverse(), o;
|
39
43
|
})();
|
40
|
-
for (;
|
41
|
-
|
42
|
-
const
|
43
|
-
const
|
44
|
-
for (let
|
45
|
-
|
46
|
-
return
|
47
|
-
})(),
|
48
|
-
|
49
|
-
}, C = () => {
|
50
|
-
g(M(e.m + 1, e.y));
|
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 = [];
|
48
|
+
for (let s = 1; s <= e; s++)
|
49
|
+
o.push(s);
|
50
|
+
return o;
|
51
|
+
})(), C = () => {
|
52
|
+
I(!1);
|
51
53
|
}, F = () => {
|
52
|
-
|
53
|
-
},
|
54
|
-
w(
|
54
|
+
w(P(r.m + 1, r.y));
|
55
|
+
}, L = () => {
|
56
|
+
w(P(r.m - 1, r.y));
|
57
|
+
}, x = (t) => {
|
58
|
+
const e = new Date(t);
|
59
|
+
if (e.setHours(0, 0, 0, 0), g && g.getTime() > t)
|
60
|
+
return !0;
|
61
|
+
if (O) {
|
62
|
+
const o = /* @__PURE__ */ new Date();
|
63
|
+
if (o.setHours(0, 0, 0, 0), e.getTime() > o.getTime()) return !0;
|
64
|
+
}
|
65
|
+
if (S) {
|
66
|
+
const o = /* @__PURE__ */ new Date();
|
67
|
+
if (o.setHours(0, 0, 0, 0), t < o.getTime()) return !0;
|
68
|
+
}
|
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;
|
73
|
+
}
|
74
|
+
return !1;
|
75
|
+
}, Y = (t) => {
|
76
|
+
x(
|
55
77
|
(/* @__PURE__ */ new Date(
|
56
|
-
`${
|
78
|
+
`${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
|
57
79
|
)).getTime()
|
58
|
-
) || (
|
80
|
+
) || (H(
|
59
81
|
/* @__PURE__ */ new Date(
|
60
|
-
`${
|
82
|
+
`${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
|
61
83
|
)
|
62
|
-
),
|
84
|
+
), C());
|
63
85
|
};
|
64
86
|
return /* @__PURE__ */ l(
|
65
87
|
"div",
|
66
88
|
{
|
67
|
-
className:
|
68
|
-
ref:
|
89
|
+
className: n["calendar-block"],
|
90
|
+
ref: T,
|
69
91
|
"data-testid": "calendar-modal",
|
70
92
|
children: [
|
71
|
-
/* @__PURE__ */ l("div", { className:
|
93
|
+
/* @__PURE__ */ l("div", { className: n.h, children: [
|
72
94
|
/* @__PURE__ */ a(
|
73
|
-
|
95
|
+
A,
|
74
96
|
{
|
75
97
|
isIconButton: !0,
|
76
98
|
iconName: "DropdownArrowLeft16px",
|
77
|
-
onClick:
|
99
|
+
onClick: L,
|
78
100
|
variant: "secondary-gray",
|
79
101
|
size: "l"
|
80
102
|
}
|
@@ -83,65 +105,65 @@ const tt = ({
|
|
83
105
|
"button",
|
84
106
|
{
|
85
107
|
type: "button",
|
86
|
-
className:
|
108
|
+
className: n.d,
|
87
109
|
onClick: () => u == null ? void 0 : u("months"),
|
88
110
|
"data-testid": "month-year-button",
|
89
111
|
children: [
|
90
|
-
(
|
112
|
+
(M = m.Month(r.m)) == null ? void 0 : M.name,
|
91
113
|
"’",
|
92
|
-
|
93
|
-
/* @__PURE__ */ a(
|
114
|
+
r.y.toString().slice(-2),
|
115
|
+
/* @__PURE__ */ a(W, { iconName: "DropdownArrowBottom16px" })
|
94
116
|
]
|
95
117
|
}
|
96
118
|
),
|
97
119
|
/* @__PURE__ */ a(
|
98
|
-
|
120
|
+
A,
|
99
121
|
{
|
100
122
|
isIconButton: !0,
|
101
123
|
iconName: "DropdownArrowRight16px",
|
102
|
-
onClick:
|
124
|
+
onClick: F,
|
103
125
|
variant: "secondary-gray",
|
104
126
|
size: "l"
|
105
127
|
}
|
106
128
|
)
|
107
129
|
] }),
|
108
|
-
/* @__PURE__ */ l("div", { className:
|
109
|
-
|
130
|
+
/* @__PURE__ */ l("div", { className: n.b, children: [
|
131
|
+
G.map((t, e) => /* @__PURE__ */ a(
|
110
132
|
"div",
|
111
133
|
{
|
112
|
-
className:
|
113
|
-
[
|
134
|
+
className: k(n.m, {
|
135
|
+
[n.orange]: e > U
|
114
136
|
}),
|
115
137
|
children: t
|
116
138
|
},
|
117
|
-
`v${
|
139
|
+
`v${e}`
|
118
140
|
)),
|
119
|
-
v.map((t,
|
120
|
-
|
141
|
+
v.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e)),
|
142
|
+
y.map((t, e) => /* @__PURE__ */ a(
|
121
143
|
"button",
|
122
144
|
{
|
123
145
|
type: "button",
|
124
|
-
onClick: () =>
|
125
|
-
className:
|
126
|
-
|
146
|
+
onClick: () => Y(t),
|
147
|
+
className: k(
|
148
|
+
x(
|
127
149
|
(/* @__PURE__ */ new Date(
|
128
|
-
`${
|
150
|
+
`${r.y}-${m.Number(2, r.m)}-${m.Number(2, t)}`
|
129
151
|
)).getTime()
|
130
|
-
) ?
|
152
|
+
) ? n.m : n.a,
|
131
153
|
{
|
132
|
-
[
|
154
|
+
[n.current]: f.y === r.y && f.m === r.m && f.d === t
|
133
155
|
}
|
134
156
|
),
|
135
157
|
children: t !== 0 && t
|
136
158
|
},
|
137
|
-
|
159
|
+
e
|
138
160
|
)),
|
139
|
-
|
161
|
+
j.map((t, e) => /* @__PURE__ */ a("div", { className: n.m, children: t }, e))
|
140
162
|
] })
|
141
163
|
]
|
142
164
|
}
|
143
165
|
);
|
144
166
|
};
|
145
167
|
export {
|
146
|
-
|
168
|
+
st as DatePickerModal
|
147
169
|
};
|
@@ -3,6 +3,10 @@ type TProps = {
|
|
3
3
|
before?: Date;
|
4
4
|
onChangeValue: (date: Date) => void;
|
5
5
|
onChangeType?: (type: 'years') => void;
|
6
|
+
disableFuture?: boolean;
|
7
|
+
disablePast?: boolean;
|
8
|
+
disabledDate?: (date: Date) => boolean;
|
9
|
+
validRange?: [Date, Date];
|
6
10
|
};
|
7
|
-
export declare const MonthPickerModal: ({ date, onChangeValue, before, onChangeType }: 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;
|
8
12
|
export {};
|
@@ -1,94 +1,132 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c as
|
3
|
-
import { useState as
|
4
|
-
import { months as
|
5
|
-
import { useDatePickerPosition as
|
6
|
-
import { c
|
7
|
-
import { Icon as
|
8
|
-
import { formating as
|
9
|
-
import { Button as
|
10
|
-
const
|
11
|
-
date:
|
12
|
-
onChangeValue:
|
13
|
-
before:
|
14
|
-
onChangeType:
|
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
|
+
import { months as C } from "./constants.js";
|
5
|
+
import { useDatePickerPosition as R } from "./hooks.js";
|
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,
|
17
|
+
disabledDate: u,
|
18
|
+
validRange: g
|
15
19
|
}) => {
|
16
|
-
const
|
17
|
-
y: c.getFullYear(),
|
18
|
-
d: c.getDate(),
|
19
|
-
m: c.getMonth() + 1
|
20
|
-
}, s = {
|
20
|
+
const A = R(), m = new Date(w), y = new Date(w), h = {
|
21
21
|
y: m.getFullYear(),
|
22
22
|
d: m.getDate(),
|
23
23
|
m: m.getMonth() + 1
|
24
|
-
},
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
},
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
)
|
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 || $)
|
41
|
+
return !0;
|
42
|
+
}
|
43
|
+
if (d) {
|
44
|
+
const o = d.getFullYear(), s = d.getMonth() + 1;
|
45
|
+
if (o > t || o === t && s > n)
|
46
|
+
return !0;
|
47
|
+
}
|
48
|
+
if (N && (t > r || t === r && n > l) || P && (t < r || t === r && n < l))
|
49
|
+
return !0;
|
50
|
+
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;
|
55
|
+
}
|
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;
|
60
|
+
}
|
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;
|
65
|
+
}
|
66
|
+
return !0;
|
67
|
+
}
|
68
|
+
return !1;
|
69
|
+
}, O = (n) => {
|
70
|
+
x(n) || H(
|
34
71
|
/* @__PURE__ */ new Date(
|
35
|
-
`${t}-${
|
72
|
+
`${t}-${B.Number(2, n)}-${B.Number(2, M.d)}`
|
36
73
|
)
|
37
74
|
);
|
38
75
|
};
|
39
|
-
return /* @__PURE__ */
|
40
|
-
/* @__PURE__ */
|
41
|
-
/* @__PURE__ */
|
42
|
-
|
76
|
+
return /* @__PURE__ */ p("div", { className: c["calendar-block"], ref: A, children: [
|
77
|
+
/* @__PURE__ */ p("div", { className: c.h, children: [
|
78
|
+
/* @__PURE__ */ f(
|
79
|
+
F,
|
43
80
|
{
|
44
81
|
isIconButton: !0,
|
45
82
|
iconName: "DropdownArrowLeft16px",
|
46
|
-
onClick:
|
83
|
+
onClick: I,
|
47
84
|
variant: "secondary-gray",
|
48
85
|
size: "l"
|
49
86
|
}
|
50
87
|
),
|
51
|
-
/* @__PURE__ */
|
88
|
+
/* @__PURE__ */ p(
|
52
89
|
"button",
|
53
90
|
{
|
54
91
|
type: "button",
|
55
|
-
onClick: () =>
|
56
|
-
className:
|
92
|
+
onClick: () => D == null ? void 0 : D("years"),
|
93
|
+
className: c.d,
|
57
94
|
"data-testid": "year-button",
|
58
95
|
children: [
|
59
96
|
t.toString(),
|
60
|
-
/* @__PURE__ */
|
97
|
+
/* @__PURE__ */ f(_, { iconName: "DropdownArrowBottom16px" })
|
61
98
|
]
|
62
99
|
}
|
63
100
|
),
|
64
|
-
/* @__PURE__ */
|
65
|
-
|
101
|
+
/* @__PURE__ */ f(
|
102
|
+
F,
|
66
103
|
{
|
67
104
|
isIconButton: !0,
|
68
105
|
iconName: "DropdownArrowRight16px",
|
69
|
-
onClick:
|
106
|
+
onClick: G,
|
70
107
|
variant: "secondary-gray",
|
71
108
|
size: "l"
|
72
109
|
}
|
73
110
|
)
|
74
111
|
] }),
|
75
|
-
/* @__PURE__ */
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
+
return /* @__PURE__ */ f(
|
115
|
+
"button",
|
116
|
+
{
|
117
|
+
type: "button",
|
118
|
+
onClick: () => O(r),
|
119
|
+
disabled: l,
|
120
|
+
className: j(l ? c.m : c.a, {
|
121
|
+
[c.current]: h.y === t && h.m === r
|
122
|
+
}),
|
123
|
+
children: n
|
124
|
+
},
|
125
|
+
i
|
126
|
+
);
|
127
|
+
}) })
|
90
128
|
] });
|
91
129
|
};
|
92
130
|
export {
|
93
|
-
|
131
|
+
W as MonthPickerModal
|
94
132
|
};
|
@@ -3,6 +3,10 @@ type TProps = {
|
|
3
3
|
before?: Date;
|
4
4
|
onChangeValue: (date: Date) => void;
|
5
5
|
onChangeType?: (type: 'years') => void;
|
6
|
+
disableFuture?: boolean;
|
7
|
+
disablePast?: boolean;
|
8
|
+
disabledDate?: (date: Date) => boolean;
|
9
|
+
validRange?: [Date, Date];
|
6
10
|
};
|
7
|
-
export declare const YearPickerModal: ({ date, onChangeValue, before, onChangeType }: 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;
|
8
12
|
export {};
|
@@ -1,47 +1,66 @@
|
|
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
|
-
onChangeValue:
|
11
|
-
before:
|
12
|
-
onChangeType:
|
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
|
13
17
|
}) => {
|
14
|
-
const
|
15
|
-
y:
|
16
|
-
d:
|
17
|
-
m:
|
18
|
-
},
|
19
|
-
y:
|
20
|
-
d:
|
21
|
-
m:
|
22
|
-
}, [
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
},
|
27
|
-
|
28
|
-
|
29
|
-
|
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);
|
30
|
+
}, H = () => {
|
31
|
+
N(l - D);
|
32
|
+
}, g = (t) => {
|
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;
|
41
|
+
}
|
42
|
+
if (p && p.getFullYear() > t || P && t > n || v && t < n)
|
43
|
+
return !0;
|
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);
|
47
|
+
}
|
48
|
+
return !1;
|
49
|
+
}, Q = (t) => {
|
50
|
+
g(t) || F(
|
32
51
|
/* @__PURE__ */ new Date(
|
33
|
-
`${
|
52
|
+
`${t}-${y.Number(2, u.m)}-${y.Number(2, u.d)}`
|
34
53
|
)
|
35
54
|
);
|
36
55
|
};
|
37
|
-
return /* @__PURE__ */
|
38
|
-
/* @__PURE__ */
|
56
|
+
return /* @__PURE__ */ x("div", { className: e["calendar-block"], ref: E, children: [
|
57
|
+
/* @__PURE__ */ x("div", { className: e.h, children: [
|
39
58
|
/* @__PURE__ */ o(
|
40
|
-
|
59
|
+
A,
|
41
60
|
{
|
42
61
|
isIconButton: !0,
|
43
62
|
iconName: "DropdownArrowLeft16px",
|
44
|
-
onClick:
|
63
|
+
onClick: H,
|
45
64
|
variant: "secondary-gray",
|
46
65
|
size: "l"
|
47
66
|
}
|
@@ -50,40 +69,39 @@ const F = ({
|
|
50
69
|
"button",
|
51
70
|
{
|
52
71
|
type: "button",
|
53
|
-
onClick: () =>
|
54
|
-
className:
|
72
|
+
onClick: () => i == null ? void 0 : i("years"),
|
73
|
+
className: e.d
|
55
74
|
}
|
56
75
|
),
|
57
76
|
/* @__PURE__ */ o(
|
58
|
-
|
77
|
+
A,
|
59
78
|
{
|
60
79
|
isIconButton: !0,
|
61
80
|
iconName: "DropdownArrowRight16px",
|
62
|
-
onClick:
|
81
|
+
onClick: G,
|
63
82
|
variant: "secondary-gray",
|
64
83
|
size: "l"
|
65
84
|
}
|
66
85
|
)
|
67
86
|
] }),
|
68
|
-
/* @__PURE__ */ o("div", { className:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
)) })
|
87
|
+
/* @__PURE__ */ o("div", { className: e.monthGrid, "data-testid": "year-picker", children: _.map((t, k) => {
|
88
|
+
const n = g(t);
|
89
|
+
return /* @__PURE__ */ o(
|
90
|
+
"button",
|
91
|
+
{
|
92
|
+
type: "button",
|
93
|
+
onClick: () => Q(t),
|
94
|
+
disabled: n,
|
95
|
+
className: O(n ? e.m : e.a, {
|
96
|
+
[e.current]: R.y === t
|
97
|
+
}),
|
98
|
+
children: t
|
99
|
+
},
|
100
|
+
k
|
101
|
+
);
|
102
|
+
}) })
|
85
103
|
] });
|
86
104
|
};
|
87
105
|
export {
|
88
|
-
|
106
|
+
W as YearPickerModal
|
89
107
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ElementType, ReactElement, ReactNode } from 'react';
|
1
|
+
import { ElementType, ReactElement, ReactNode, RefObject } from 'react';
|
2
2
|
import { EDrawerPosition } from './constants';
|
3
3
|
import { Props } from '../../types/propsWithAs';
|
4
4
|
|
@@ -78,6 +78,12 @@ type TProps = {
|
|
78
78
|
* Флаг, определяющий, показывать ли кнопку закрытия в заголовке
|
79
79
|
*/
|
80
80
|
showCloseButton?: boolean;
|
81
|
+
/**
|
82
|
+
* Указывает DOM-элемент, в который будет рендериться Drawer.
|
83
|
+
* Если не указан, используется document.body.
|
84
|
+
* Если указано false, компонент рендерится без использования Portal.
|
85
|
+
*/
|
86
|
+
getContainer?: HTMLElement | RefObject<HTMLElement> | false;
|
81
87
|
};
|
82
88
|
type TDrawerComponent = <C extends ElementType = 'div'>(props: Props<C, TProps>) => ReactElement | ReactNode;
|
83
89
|
/**
|