mimir-ui-kit 1.35.2 → 1.35.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/styles.css +1 -1
- package/dist/components/Accordion/Accordion.d.ts +5 -3
- package/dist/components/Accordion/Accordion.js +141 -141
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.js +91 -108
- package/dist/components/DatePicker/DatePickerModal.d.ts +5 -5
- package/dist/components/DatePicker/DatePickerModal.js +91 -95
- package/dist/components/DatePicker/MonthPickerModal.d.ts +4 -5
- package/dist/components/DatePicker/MonthPickerModal.js +58 -66
- package/dist/components/DatePicker/YearPickerModal.d.ts +4 -5
- package/dist/components/DatePicker/YearPickerModal.js +61 -61
- package/dist/components/DatePicker/constants.d.ts +5 -0
- package/dist/components/DatePicker/constants.js +12 -6
- package/dist/components/DatePicker/hooks.d.ts +3 -0
- package/dist/components/DatePicker/hooks.js +16 -0
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/utils.d.ts +4 -0
- package/dist/components/DatePicker/utils.js +6 -5
- package/dist/components/Image/Image.js +1 -1
- package/dist/styles.module-Chnn6DA-.js +24 -0
- package/package.json +1 -1
- package/dist/styles.module-BQZZ6FB1.js +0 -25
@@ -1,140 +1,123 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c as
|
3
|
-
import { memo as Q, forwardRef as W, useState as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
|
1
|
+
import { jsxs as J, jsx as I } from "react/jsx-runtime";
|
2
|
+
import { c as g } from "../../index-DIxK0V-G.js";
|
3
|
+
import { memo as Q, forwardRef as W, useState as d, useEffect as N } from "react";
|
4
|
+
import { MAX_DAY as Z, MAX_MONTH as E, DATE_LENGTH as B } from "./constants.js";
|
5
|
+
import { DatePickerModal as V } from "./DatePickerModal.js";
|
6
|
+
import { MonthPickerModal as tt } from "./MonthPickerModal.js";
|
7
|
+
import { c as a } from "../../styles.module-Chnn6DA-.js";
|
8
|
+
import { formatDatePart as j } from "./utils.js";
|
9
|
+
import { YearPickerModal as st } from "./YearPickerModal.js";
|
10
|
+
import { useClickOutside as et } from "../../hooks/useClickOutside/useClickOutside.js";
|
11
|
+
import { formating as it } from "../../utils/index.js";
|
12
|
+
import { I as at } from "../../Input-B-gKQ9FT.js";
|
13
|
+
import { EInputStatus as rt } from "../Input/constants.js";
|
14
|
+
const ot = {
|
15
|
+
days: V,
|
16
|
+
months: tt,
|
17
|
+
years: st
|
18
|
+
}, ct = Q(
|
14
19
|
W(
|
15
20
|
({
|
16
|
-
size:
|
17
|
-
value:
|
18
|
-
onChangeValue:
|
19
|
-
name:
|
20
|
-
before:
|
21
|
-
type:
|
22
|
-
error:
|
23
|
-
onError:
|
24
|
-
onBlur:
|
25
|
-
validateImmediately:
|
26
|
-
variant:
|
27
|
-
disabled:
|
21
|
+
size: Y,
|
22
|
+
value: s,
|
23
|
+
onChangeValue: e,
|
24
|
+
name: r,
|
25
|
+
before: D,
|
26
|
+
type: o = "days",
|
27
|
+
error: y,
|
28
|
+
onError: c,
|
29
|
+
onBlur: m,
|
30
|
+
validateImmediately: v,
|
31
|
+
variant: $,
|
32
|
+
disabled: x = !1,
|
28
33
|
editable: S = !1,
|
29
|
-
...
|
34
|
+
...H
|
30
35
|
}, L) => {
|
31
|
-
const [
|
32
|
-
|
33
|
-
), [
|
34
|
-
|
35
|
-
k(
|
36
|
-
}, [
|
36
|
+
const [n, f] = d(!1), [T, p] = d(o), [i, l] = d(
|
37
|
+
() => s && !isNaN(new Date(s).getTime()) ? new Date(s) : void 0
|
38
|
+
), [A, k] = d(y), [R, M] = d("");
|
39
|
+
N(() => {
|
40
|
+
k(y);
|
41
|
+
}, [y]), N(() => {
|
37
42
|
l(
|
38
|
-
|
43
|
+
s && !isNaN(new Date(s).getTime()) ? new Date(s) : void 0
|
39
44
|
);
|
40
|
-
}, [
|
41
|
-
|
42
|
-
}, [
|
43
|
-
const
|
44
|
-
|
45
|
-
|
46
|
-
}, [
|
47
|
-
isActive:
|
48
|
-
setActive: (
|
49
|
-
|
45
|
+
}, [s]), N(() => {
|
46
|
+
i && typeof i != "string" && !isNaN(i == null ? void 0 : i.getTime()) ? M(it.Date(i, "dd/mm/yyyy")) : M("");
|
47
|
+
}, [i]);
|
48
|
+
const _ = s && new Date(s).getTime;
|
49
|
+
N(() => {
|
50
|
+
v && (_ ? (k(!1), c == null || c({ name: r, active: !1 })) : (k(!0), c == null || c({ name: r, active: !0 })));
|
51
|
+
}, [v, r, _]), et({
|
52
|
+
isActive: n,
|
53
|
+
setActive: (t) => {
|
54
|
+
f(t), p(o);
|
50
55
|
},
|
51
|
-
className:
|
56
|
+
className: a["calendar-block"]
|
52
57
|
});
|
53
|
-
const
|
54
|
-
|
55
|
-
},
|
56
|
-
isNaN(
|
57
|
-
},
|
58
|
+
const X = () => {
|
59
|
+
x || f(!0);
|
60
|
+
}, G = (t) => {
|
61
|
+
isNaN(t.getTime()) || (l(t), e == null || e({ value: t, name: r })), T === "years" && (o === "years" ? (f(!1), p(o)) : p("months")), T === "months" && (o === "months" ? (f(!1), p(o)) : p("days")), l(t), e == null || e({ value: t, name: r }), m == null || m(t);
|
62
|
+
}, K = (t) => {
|
58
63
|
if (S) {
|
59
|
-
const
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
],
|
64
|
-
if (
|
65
|
-
const
|
66
|
-
`${
|
64
|
+
const P = t.target.value.replace(/[^\d]/g, ""), [b, h, u] = [
|
65
|
+
j(P.substring(0, 2), Z),
|
66
|
+
j(P.substring(2, 4), E),
|
67
|
+
P.substring(4, 8)
|
68
|
+
], O = [b, h, u].filter(Boolean).join("/");
|
69
|
+
if (M(O), O.length === B) {
|
70
|
+
const F = parseInt(u), w = /* @__PURE__ */ new Date(
|
71
|
+
`${F}-${h.padStart(2, "0")}-${b.padStart(2, "0")}`
|
67
72
|
);
|
68
|
-
isNaN(
|
73
|
+
isNaN(w.getTime()) || (l(w), e == null || e({ value: w, name: r }), m == null || m(w));
|
69
74
|
}
|
70
75
|
}
|
71
|
-
},
|
72
|
-
|
73
|
-
/* @__PURE__ */
|
76
|
+
}, U = g(a.wrapper, n && a.active), q = g(a.input, a.inputBorderControl), z = {
|
77
|
+
onChangeValue: G,
|
78
|
+
date: i || /* @__PURE__ */ new Date(),
|
79
|
+
before: typeof D == "string" ? new Date(D) : D,
|
80
|
+
onChangeType: p,
|
81
|
+
setIsActive: f
|
82
|
+
}, C = ot[T];
|
83
|
+
return /* @__PURE__ */ J("div", { className: U, "data-disabled": x, children: [
|
84
|
+
/* @__PURE__ */ I(
|
74
85
|
"div",
|
75
86
|
{
|
76
|
-
"
|
77
|
-
|
78
|
-
|
87
|
+
role: "button",
|
88
|
+
"data-error": A,
|
89
|
+
className: g(a["date-wrapper"], {
|
90
|
+
[a.editable]: S
|
79
91
|
}),
|
80
|
-
onClick:
|
81
|
-
children: /* @__PURE__ */
|
82
|
-
|
92
|
+
onClick: X,
|
93
|
+
children: /* @__PURE__ */ I(
|
94
|
+
at,
|
83
95
|
{
|
84
96
|
ref: L,
|
85
|
-
className:
|
86
|
-
wrapperClassName:
|
87
|
-
size:
|
97
|
+
className: q,
|
98
|
+
wrapperClassName: a["input-wrapper"],
|
99
|
+
size: Y,
|
88
100
|
type: "text",
|
89
|
-
variant:
|
90
|
-
status:
|
101
|
+
variant: $,
|
102
|
+
status: A ? rt.Error : void 0,
|
91
103
|
value: R,
|
92
|
-
onChange:
|
104
|
+
onChange: K,
|
93
105
|
rightAddon: {
|
94
106
|
addonType: "icon",
|
95
|
-
addonContent:
|
107
|
+
addonContent: n ? "DropdownArrowUp24px" : "DropdownArrowDown24px"
|
96
108
|
},
|
97
|
-
"data-error":
|
98
|
-
...
|
109
|
+
"data-error": A,
|
110
|
+
...H
|
99
111
|
}
|
100
112
|
)
|
101
113
|
}
|
102
114
|
),
|
103
|
-
|
104
|
-
Z,
|
105
|
-
{
|
106
|
-
onChangeValue: M,
|
107
|
-
date: t || /* @__PURE__ */ new Date(),
|
108
|
-
setActive: c,
|
109
|
-
before: typeof a == "string" ? new Date(a) : a,
|
110
|
-
onType: o
|
111
|
-
}
|
112
|
-
),
|
113
|
-
w === "months" && d && /* @__PURE__ */ N(
|
114
|
-
b,
|
115
|
-
{
|
116
|
-
onChangeValue: M,
|
117
|
-
date: t || /* @__PURE__ */ new Date(),
|
118
|
-
setActive: c,
|
119
|
-
before: typeof a == "string" ? new Date(a) : a,
|
120
|
-
onType: o
|
121
|
-
}
|
122
|
-
),
|
123
|
-
w === "years" && d && /* @__PURE__ */ N(
|
124
|
-
C,
|
125
|
-
{
|
126
|
-
onChangeValue: M,
|
127
|
-
date: t || /* @__PURE__ */ new Date(),
|
128
|
-
setActive: c,
|
129
|
-
before: typeof a == "string" ? new Date(a) : a,
|
130
|
-
onType: o
|
131
|
-
}
|
132
|
-
)
|
115
|
+
n && /* @__PURE__ */ I(C, { ...z })
|
133
116
|
] });
|
134
117
|
}
|
135
118
|
)
|
136
119
|
);
|
137
|
-
|
120
|
+
ct.displayName = "DatePicker";
|
138
121
|
export {
|
139
|
-
|
122
|
+
ct as DatePicker
|
140
123
|
};
|
@@ -1,9 +1,9 @@
|
|
1
|
-
type
|
1
|
+
type TProps = {
|
2
2
|
date: Date;
|
3
|
-
onChangeValue: (d: Date) => void;
|
4
|
-
setActive: (s: boolean) => void;
|
5
3
|
before?: Date;
|
6
|
-
|
4
|
+
onChangeValue: (date: Date) => void;
|
5
|
+
setIsActive: (isActive: boolean) => void;
|
6
|
+
onChangeType?: (s: 'days' | 'months' | 'years') => void;
|
7
7
|
};
|
8
|
-
export declare
|
8
|
+
export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
|
9
9
|
export {};
|
@@ -1,151 +1,147 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
2
|
+
import { c as x } from "../../index-DIxK0V-G.js";
|
3
|
+
import { useState as O } from "react";
|
4
|
+
import { week as Y, COUNT_WORK_DAYS as j } from "./constants.js";
|
5
|
+
import { useDatePickerPosition as z } from "./hooks.js";
|
6
|
+
import { c as o } from "../../styles.module-Chnn6DA-.js";
|
7
|
+
import { getUpdateDate as M } from "./utils.js";
|
8
|
+
import { Icon as G } from "../../icons/Icon.js";
|
9
|
+
import { formating as s } from "../../utils/index.js";
|
10
|
+
import { Button as $ } from "../Button/Button.js";
|
11
|
+
import { parseDate as k } from "../../utils/formating/Date.js";
|
12
|
+
const tt = ({
|
13
|
+
date: i,
|
14
|
+
onChangeValue: P,
|
15
|
+
setIsActive: A,
|
16
|
+
before: h,
|
17
|
+
onChangeType: u
|
18
|
+
}) => {
|
19
|
+
var b;
|
20
|
+
i = isNaN(new Date(i).getTime()) ? /* @__PURE__ */ new Date() : i;
|
21
|
+
const d = k(i), D = k(i), y = {
|
22
|
+
y: d.getFullYear(),
|
23
|
+
d: d.getDate(),
|
24
|
+
m: d.getMonth() + 1
|
23
25
|
}, f = {
|
24
|
-
y:
|
25
|
-
d:
|
26
|
-
m:
|
27
|
-
},
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if (r.current !== null) {
|
32
|
-
const O = ((s = (c = r == null ? void 0 : r.current) == null ? void 0 : c.parentElement) == null ? void 0 : s.offsetWidth) || 0, A = ((W = (M = r == null ? void 0 : r.current) == null ? void 0 : M.parentElement) == null ? void 0 : W.offsetHeight) || 0, E = (C = (B = r == null ? void 0 : r.current) == null ? void 0 : B.parentElement) == null ? void 0 : C.getBoundingClientRect(), H = r.current.offsetHeight;
|
33
|
-
t < E.y + H + A ? r.current.style.top = -H + "px" : r.current.style.top = A + "px", e < E.x + v && (r.current.style.left = O - v + "px"), r.current.style.opacity = "1";
|
34
|
-
}
|
35
|
-
}, [n]);
|
36
|
-
const L = (t) => {
|
37
|
-
let e = t.getDay();
|
38
|
-
return e === 0 && (e = 7), e - 1;
|
39
|
-
}, N = n.m - 1, m = new Date(n.y, N), D = [], x = (() => {
|
26
|
+
y: D.getFullYear(),
|
27
|
+
d: D.getDate(),
|
28
|
+
m: D.getMonth() + 1
|
29
|
+
}, [e, g] = O({ y: f.y, m: f.m }), B = z([e]), I = (t) => {
|
30
|
+
let r = t.getDay();
|
31
|
+
return r === 0 && (r = 7), r - 1;
|
32
|
+
}, N = e.m - 1, m = new Date(e.y, N), p = [], v = (() => {
|
40
33
|
const t = new Date(m);
|
41
34
|
t.setDate(t.getDate() - 1);
|
42
|
-
const
|
43
|
-
for (let
|
44
|
-
c.push(
|
35
|
+
const r = t.getDate(), c = [];
|
36
|
+
for (let n = 0; n < I(m); n++)
|
37
|
+
c.push(r - n);
|
45
38
|
return c.reverse(), c;
|
46
39
|
})();
|
47
40
|
for (; m.getMonth() === N; )
|
48
|
-
|
49
|
-
const
|
50
|
-
const
|
51
|
-
for (let
|
52
|
-
c.push(
|
41
|
+
p.push(m.getDate()), m.setDate(m.getDate() + 1);
|
42
|
+
const S = (() => {
|
43
|
+
const r = 42 - (v.length + p.length), c = [];
|
44
|
+
for (let n = 1; n <= r; n++)
|
45
|
+
c.push(n);
|
53
46
|
return c;
|
54
|
-
})(),
|
55
|
-
|
56
|
-
},
|
57
|
-
|
58
|
-
},
|
59
|
-
|
60
|
-
},
|
61
|
-
|
47
|
+
})(), _ = () => {
|
48
|
+
A(!1);
|
49
|
+
}, C = () => {
|
50
|
+
g(M(e.m + 1, e.y));
|
51
|
+
}, F = () => {
|
52
|
+
g(M(e.m - 1, e.y));
|
53
|
+
}, w = (t) => !!(h && h.getTime() > t), L = (t) => {
|
54
|
+
w(
|
62
55
|
(/* @__PURE__ */ new Date(
|
63
|
-
`${
|
56
|
+
`${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
|
64
57
|
)).getTime()
|
65
|
-
) || (
|
58
|
+
) || (P(
|
66
59
|
/* @__PURE__ */ new Date(
|
67
|
-
`${
|
60
|
+
`${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
|
68
61
|
)
|
69
|
-
),
|
62
|
+
), _());
|
70
63
|
};
|
71
|
-
return /* @__PURE__ */
|
64
|
+
return /* @__PURE__ */ l(
|
72
65
|
"div",
|
73
66
|
{
|
74
|
-
className:
|
75
|
-
ref:
|
67
|
+
className: o["calendar-block"],
|
68
|
+
ref: B,
|
76
69
|
"data-testid": "calendar-modal",
|
77
70
|
children: [
|
78
|
-
/* @__PURE__ */
|
71
|
+
/* @__PURE__ */ l("div", { className: o.h, children: [
|
79
72
|
/* @__PURE__ */ a(
|
80
|
-
|
73
|
+
$,
|
81
74
|
{
|
82
75
|
isIconButton: !0,
|
83
76
|
iconName: "DropdownArrowLeft16px",
|
84
|
-
onClick:
|
77
|
+
onClick: F,
|
85
78
|
variant: "secondary-gray",
|
86
79
|
size: "l"
|
87
80
|
}
|
88
81
|
),
|
89
|
-
/* @__PURE__ */
|
90
|
-
"
|
82
|
+
/* @__PURE__ */ l(
|
83
|
+
"button",
|
91
84
|
{
|
85
|
+
type: "button",
|
92
86
|
className: o.d,
|
93
|
-
onClick: () =>
|
87
|
+
onClick: () => u == null ? void 0 : u("months"),
|
94
88
|
"data-testid": "month-year-button",
|
95
89
|
children: [
|
96
|
-
(
|
90
|
+
(b = s.Month(e.m)) == null ? void 0 : b.name,
|
97
91
|
"’",
|
98
|
-
|
99
|
-
/* @__PURE__ */ a(
|
92
|
+
e.y.toString().slice(-2),
|
93
|
+
/* @__PURE__ */ a(G, { iconName: "DropdownArrowBottom16px" })
|
100
94
|
]
|
101
95
|
}
|
102
96
|
),
|
103
97
|
/* @__PURE__ */ a(
|
104
|
-
|
98
|
+
$,
|
105
99
|
{
|
106
100
|
isIconButton: !0,
|
107
101
|
iconName: "DropdownArrowRight16px",
|
108
|
-
onClick:
|
102
|
+
onClick: C,
|
109
103
|
variant: "secondary-gray",
|
110
104
|
size: "l"
|
111
105
|
}
|
112
106
|
)
|
113
107
|
] }),
|
114
|
-
/* @__PURE__ */
|
115
|
-
|
108
|
+
/* @__PURE__ */ l("div", { className: o.b, children: [
|
109
|
+
Y.map((t, r) => /* @__PURE__ */ a(
|
116
110
|
"div",
|
117
111
|
{
|
118
|
-
className:
|
112
|
+
className: x(o.m, {
|
113
|
+
[o.orange]: r > j
|
114
|
+
}),
|
119
115
|
children: t
|
120
116
|
},
|
121
|
-
`v${
|
117
|
+
`v${r}`
|
122
118
|
)),
|
123
|
-
|
124
|
-
|
125
|
-
"
|
119
|
+
v.map((t, r) => /* @__PURE__ */ a("div", { className: o.m, children: t }, r)),
|
120
|
+
p.map((t, r) => /* @__PURE__ */ a(
|
121
|
+
"button",
|
126
122
|
{
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
123
|
+
type: "button",
|
124
|
+
onClick: () => L(t),
|
125
|
+
className: x(
|
126
|
+
w(
|
127
|
+
(/* @__PURE__ */ new Date(
|
128
|
+
`${e.y}-${s.Number(2, e.m)}-${s.Number(2, t)}`
|
129
|
+
)).getTime()
|
130
|
+
) ? o.m : o.a,
|
134
131
|
{
|
135
|
-
|
136
|
-
onClick: () => _(t),
|
137
|
-
children: t
|
132
|
+
[o.current]: y.y === e.y && y.m === e.m && y.d === t
|
138
133
|
}
|
139
|
-
)
|
134
|
+
),
|
135
|
+
children: t !== 0 && t
|
140
136
|
},
|
141
|
-
|
137
|
+
r
|
142
138
|
)),
|
143
|
-
|
139
|
+
S.map((t, r) => /* @__PURE__ */ a("div", { className: o.m, children: t }, r))
|
144
140
|
] })
|
145
141
|
]
|
146
142
|
}
|
147
|
-
)
|
148
|
-
}
|
143
|
+
);
|
144
|
+
};
|
149
145
|
export {
|
150
|
-
|
146
|
+
tt as DatePickerModal
|
151
147
|
};
|
@@ -1,9 +1,8 @@
|
|
1
|
-
type
|
1
|
+
type TProps = {
|
2
2
|
date: Date;
|
3
|
-
onChangeValue: (d: Date) => void;
|
4
|
-
setActive: (s: boolean) => void;
|
5
3
|
before?: Date;
|
6
|
-
|
4
|
+
onChangeValue: (date: Date) => void;
|
5
|
+
onChangeType?: (type: 'years') => void;
|
7
6
|
};
|
8
|
-
export declare
|
7
|
+
export declare const MonthPickerModal: ({ date, onChangeValue, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
|
9
8
|
export {};
|