mimir-ui-kit 1.59.2 → 1.60.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/assets/Pagination.css +1 -1
- package/dist/assets/PaginationDateButton.css +1 -0
- package/dist/components/DatePicker/DatePickerModal.js +1 -1
- package/dist/components/DatePicker/MonthPickerModal.d.ts +2 -1
- package/dist/components/DatePicker/MonthPickerModal.js +22 -21
- package/dist/components/DatePicker/YearPickerModal.d.ts +2 -1
- package/dist/components/DatePicker/YearPickerModal.js +20 -19
- package/dist/components/DatePicker/hooks.d.ts +1 -1
- package/dist/components/DatePicker/hooks.js +25 -22
- package/dist/components/Pagination/Pagination.js +141 -156
- package/dist/components/Pagination/PaginationDateButton/PaginationDateButton.d.ts +22 -0
- package/dist/components/Pagination/PaginationDateButton/PaginationDateButton.js +49 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.js +4 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +124 -122
- package/dist/index.js +141 -139
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
._pagination-
|
|
1
|
+
._pagination-button_1b4hk_2{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:40px;height:40px;color:var(--black-100);font-weight:var(--mimir-font-weight-text-medium);font-size:var(--mimir-size-text-l);font-family:var(--mimir-font-inter);background-color:transparent;border-radius:var(--mimir-control-radius);-webkit-font-feature-settings:"zero";font-feature-settings:"zero"}._pagination-button_1b4hk_2:active{background-color:var(--pagination-active)}._pagination-button_1b4hk_2:focus-visible,._pagination-button_1b4hk_2:hover{color:var(--sapphire-normal);-webkit-text-decoration:none;text-decoration:none}._pagination-button_1b4hk_2._is-active_1b4hk_23{background-color:var(--pagination-active)}._container_1b4hk_27{--pagination-active: #e5e5e5;display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--mimir-space-2xl);-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 auto}._container_1b4hk_27:not(:last-child){margin-bottom:0 auto var(--mimir-space-xl)}._container--date-mode_1b4hk_37{gap:var(--mimir-space-l)}@media (max-width: 767.9px){._container_1b4hk_27,._container--date-mode_1b4hk_37{gap:var(--mimir-space-xs)}}._container_1b4hk_27 ._ellipsis_1b4hk_48{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}._disabled_1b4hk_53{pointer-events:none}._disabled_1b4hk_53 ._pagination-button_1b4hk_2{color:var(--disabled-color)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._pagination-button_1182x_2{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:40px;color:var(--black-100);font-weight:var(--mimir-font-weight-text-medium);font-size:var(--mimir-size-text-l);font-family:var(--mimir-font-inter);background-color:transparent;border-radius:var(--mimir-control-radius);-webkit-font-feature-settings:"zero";font-feature-settings:"zero"}._pagination-button_1182x_2:active{background-color:var(--pagination-active)}._pagination-button_1182x_2:focus-visible,._pagination-button_1182x_2:hover{color:var(--sapphire-normal);-webkit-text-decoration:none;text-decoration:none}._pagination-button_1182x_2._is-active_1182x_22{background-color:var(--pagination-active)}._pagination-button--date_1182x_25{width:auto;padding:var(--mimir-space-xs) var(--mimir-space-s)}._pagination-button_1182x_2 ._date-content_1182x_29{display:-webkit-box;display:-ms-flexbox;display:flex;gap:var(--mimir-space-2xs);-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-weight:var(--mimir-font-weight-text-regular)}._pagination-button_1182x_2 ._date-text_1182x_35{font-size:var(--mimir-size-text-l);line-height:var(--mimir-line-height-text-s1)}
|
|
@@ -33,7 +33,7 @@ const ct = ({
|
|
|
33
33
|
y: l.getFullYear(),
|
|
34
34
|
d: l.getDate(),
|
|
35
35
|
m: l.getMonth() + 1
|
|
36
|
-
}, [r, b] = V({ y: v.y, m: v.m }), C = K([r]
|
|
36
|
+
}, [r, b] = V({ y: v.y, m: v.m }), C = K(j, [r]), L = (t) => {
|
|
37
37
|
let e = t.getDay();
|
|
38
38
|
return e === 0 && (e = 7), e - 1;
|
|
39
39
|
}, x = r.m - 1, c = new Date(r.y, x), h = [], M = (() => {
|
|
@@ -10,6 +10,7 @@ type TProps = {
|
|
|
10
10
|
disabledDate?: (date: Date) => boolean;
|
|
11
11
|
validRange?: [Date, Date];
|
|
12
12
|
dateFormat?: 'full' | 'month' | 'year';
|
|
13
|
+
position?: 'center' | 'bottom' | 'top';
|
|
13
14
|
};
|
|
14
|
-
export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const MonthPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeMonth, disableFuture, disablePast, disabledDate, validRange, dateFormat, position }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
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 C } from "../../index-DIxK0V-G.js";
|
|
3
|
+
import { useState as L } from "react";
|
|
4
|
+
import { months as b } from "./constants.js";
|
|
5
|
+
import { useDatePickerPosition as q } from "./hooks.js";
|
|
6
6
|
import { c } from "../../styles.module-DeBRSK_x.js";
|
|
7
|
-
import { Icon as
|
|
7
|
+
import { Icon as E } from "../../icons/Icon.js";
|
|
8
8
|
import { formating as P } from "../../utils/index.js";
|
|
9
9
|
import { Button as A } from "../Button/Button.js";
|
|
10
|
-
const
|
|
10
|
+
const tt = ({
|
|
11
11
|
date: F,
|
|
12
12
|
selectedDate: D,
|
|
13
13
|
onChangeValue: G,
|
|
@@ -18,9 +18,10 @@ const T = ({
|
|
|
18
18
|
disablePast: N = !1,
|
|
19
19
|
disabledDate: u,
|
|
20
20
|
validRange: h,
|
|
21
|
-
dateFormat: M
|
|
21
|
+
dateFormat: M,
|
|
22
|
+
position: O
|
|
22
23
|
}) => {
|
|
23
|
-
const
|
|
24
|
+
const S = q(O), d = new Date(F), p = D ? new Date(D) : d, k = {
|
|
24
25
|
y: p.getFullYear(),
|
|
25
26
|
d: p.getDate(),
|
|
26
27
|
m: p.getMonth() + 1
|
|
@@ -28,9 +29,9 @@ const T = ({
|
|
|
28
29
|
y: d.getFullYear(),
|
|
29
30
|
d: d.getDate(),
|
|
30
31
|
m: d.getMonth() + 1
|
|
31
|
-
}, [t, Y] =
|
|
32
|
+
}, [t, Y] = L(x.y), $ = () => {
|
|
32
33
|
Y(t + 1);
|
|
33
|
-
},
|
|
34
|
+
}, j = () => {
|
|
34
35
|
Y(t - 1);
|
|
35
36
|
}, v = (e) => {
|
|
36
37
|
const i = /* @__PURE__ */ new Date(), r = i.getFullYear(), l = i.getMonth() + 1;
|
|
@@ -39,8 +40,8 @@ const T = ({
|
|
|
39
40
|
o.setHours(0, 0, 0, 0), s.setHours(23, 59, 59, 999);
|
|
40
41
|
const B = new Date(n), H = new Date(a);
|
|
41
42
|
B.setHours(0, 0, 0, 0), H.setHours(23, 59, 59, 999);
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
43
|
+
const R = s < B, _ = o > H;
|
|
44
|
+
if (R || _)
|
|
44
45
|
return !0;
|
|
45
46
|
}
|
|
46
47
|
if (m) {
|
|
@@ -69,21 +70,21 @@ const T = ({
|
|
|
69
70
|
return !0;
|
|
70
71
|
}
|
|
71
72
|
return !1;
|
|
72
|
-
},
|
|
73
|
+
}, z = (e) => {
|
|
73
74
|
v(e) || (g ? g(t, e) : G(
|
|
74
75
|
/* @__PURE__ */ new Date(
|
|
75
76
|
`${t}-${P.Number(2, e)}-${P.Number(2, x.d)}`
|
|
76
77
|
)
|
|
77
78
|
));
|
|
78
79
|
};
|
|
79
|
-
return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref:
|
|
80
|
+
return /* @__PURE__ */ w("div", { className: c["calendar-block"], ref: S, children: [
|
|
80
81
|
/* @__PURE__ */ w("div", { className: c.h, children: [
|
|
81
82
|
/* @__PURE__ */ f(
|
|
82
83
|
A,
|
|
83
84
|
{
|
|
84
85
|
isIconButton: !0,
|
|
85
86
|
iconName: "DropdownArrowLeft16px",
|
|
86
|
-
onClick:
|
|
87
|
+
onClick: j,
|
|
87
88
|
variant: "secondary-gray",
|
|
88
89
|
size: "l"
|
|
89
90
|
}
|
|
@@ -97,7 +98,7 @@ const T = ({
|
|
|
97
98
|
onClick: M === "month" ? void 0 : () => y == null ? void 0 : y("years"),
|
|
98
99
|
children: [
|
|
99
100
|
t.toString(),
|
|
100
|
-
M !== "month" && /* @__PURE__ */ f(
|
|
101
|
+
M !== "month" && /* @__PURE__ */ f(E, { iconName: "DropdownArrowBottom16px" })
|
|
101
102
|
]
|
|
102
103
|
}
|
|
103
104
|
),
|
|
@@ -106,21 +107,21 @@ const T = ({
|
|
|
106
107
|
{
|
|
107
108
|
isIconButton: !0,
|
|
108
109
|
iconName: "DropdownArrowRight16px",
|
|
109
|
-
onClick:
|
|
110
|
+
onClick: $,
|
|
110
111
|
variant: "secondary-gray",
|
|
111
112
|
size: "l"
|
|
112
113
|
}
|
|
113
114
|
)
|
|
114
115
|
] }),
|
|
115
|
-
/* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children:
|
|
116
|
+
/* @__PURE__ */ f("div", { className: c.monthGrid, "data-testid": "month-picker", children: b.map((e, i) => {
|
|
116
117
|
const r = i + 1, l = v(r);
|
|
117
118
|
return /* @__PURE__ */ f(
|
|
118
119
|
"button",
|
|
119
120
|
{
|
|
120
121
|
type: "button",
|
|
121
|
-
onClick: () =>
|
|
122
|
+
onClick: () => z(r),
|
|
122
123
|
disabled: l,
|
|
123
|
-
className:
|
|
124
|
+
className: C(l ? c.m : c.a, {
|
|
124
125
|
[c.current]: D && k.y === t && k.m === r
|
|
125
126
|
}),
|
|
126
127
|
children: e
|
|
@@ -131,5 +132,5 @@ const T = ({
|
|
|
131
132
|
] });
|
|
132
133
|
};
|
|
133
134
|
export {
|
|
134
|
-
|
|
135
|
+
tt as MonthPickerModal
|
|
135
136
|
};
|
|
@@ -9,6 +9,7 @@ type TProps = {
|
|
|
9
9
|
disablePast?: boolean;
|
|
10
10
|
disabledDate?: (date: Date) => boolean;
|
|
11
11
|
validRange?: [Date, Date];
|
|
12
|
+
position?: 'center' | 'bottom' | 'top';
|
|
12
13
|
};
|
|
13
|
-
export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const YearPickerModal: ({ date, selectedDate, onChangeValue, before, onChangeType, onChangeYear, disableFuture, disablePast, disabledDate, validRange, position }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as b, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useDatePickerPosition as
|
|
2
|
+
import { c as j } from "../../index-DIxK0V-G.js";
|
|
3
|
+
import { useState as z } from "react";
|
|
4
|
+
import { useDatePickerPosition as I } from "./hooks.js";
|
|
5
5
|
import { c as n } from "../../styles.module-DeBRSK_x.js";
|
|
6
6
|
import { formating as F } from "../../utils/index.js";
|
|
7
7
|
import { Button as P } from "../Button/Button.js";
|
|
8
|
-
const p = 15,
|
|
8
|
+
const p = 15, C = 7, X = ({
|
|
9
9
|
date: v,
|
|
10
10
|
selectedDate: u,
|
|
11
11
|
onChangeValue: E,
|
|
@@ -15,9 +15,10 @@ const p = 15, I = 7, W = ({
|
|
|
15
15
|
disableFuture: S = !1,
|
|
16
16
|
disablePast: _ = !1,
|
|
17
17
|
disabledDate: o,
|
|
18
|
-
validRange: k
|
|
18
|
+
validRange: k,
|
|
19
|
+
position: y
|
|
19
20
|
}) => {
|
|
20
|
-
const
|
|
21
|
+
const G = I(y), i = new Date(v), l = u ? new Date(u) : i, M = {
|
|
21
22
|
y: l.getFullYear(),
|
|
22
23
|
d: l.getDate(),
|
|
23
24
|
m: l.getMonth() + 1
|
|
@@ -25,11 +26,11 @@ const p = 15, I = 7, W = ({
|
|
|
25
26
|
y: i.getFullYear(),
|
|
26
27
|
d: i.getDate(),
|
|
27
28
|
m: i.getMonth() + 1
|
|
28
|
-
}, [D, h] =
|
|
29
|
-
(t) => t +
|
|
30
|
-
),
|
|
29
|
+
}, [D, h] = z(e.y), Q = D - C, B = Array.from(Array(p).keys()).map(
|
|
30
|
+
(t) => t + Q
|
|
31
|
+
), H = () => {
|
|
31
32
|
h(D + p);
|
|
32
|
-
},
|
|
33
|
+
}, R = () => {
|
|
33
34
|
h(D - p);
|
|
34
35
|
}, g = (t) => {
|
|
35
36
|
const s = (/* @__PURE__ */ new Date()).getFullYear();
|
|
@@ -56,21 +57,21 @@ const p = 15, I = 7, W = ({
|
|
|
56
57
|
return o(w) && o(r) && o(m) && o(f);
|
|
57
58
|
}
|
|
58
59
|
return !1;
|
|
59
|
-
},
|
|
60
|
+
}, $ = (t) => {
|
|
60
61
|
g(t) || (N ? N(t) : E(
|
|
61
62
|
/* @__PURE__ */ new Date(
|
|
62
63
|
`${t}-${F.Number(2, e.m)}-${F.Number(2, e.d)}`
|
|
63
64
|
)
|
|
64
65
|
));
|
|
65
66
|
};
|
|
66
|
-
return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref:
|
|
67
|
+
return /* @__PURE__ */ b("div", { className: n["calendar-block"], ref: G, children: [
|
|
67
68
|
/* @__PURE__ */ b("div", { className: n.h, children: [
|
|
68
69
|
/* @__PURE__ */ c(
|
|
69
70
|
P,
|
|
70
71
|
{
|
|
71
72
|
isIconButton: !0,
|
|
72
73
|
iconName: "DropdownArrowLeft16px",
|
|
73
|
-
onClick:
|
|
74
|
+
onClick: R,
|
|
74
75
|
variant: "secondary-gray",
|
|
75
76
|
size: "l"
|
|
76
77
|
}
|
|
@@ -88,22 +89,22 @@ const p = 15, I = 7, W = ({
|
|
|
88
89
|
{
|
|
89
90
|
isIconButton: !0,
|
|
90
91
|
iconName: "DropdownArrowRight16px",
|
|
91
|
-
onClick:
|
|
92
|
+
onClick: H,
|
|
92
93
|
variant: "secondary-gray",
|
|
93
94
|
size: "l"
|
|
94
95
|
}
|
|
95
96
|
)
|
|
96
97
|
] }),
|
|
97
|
-
/* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children:
|
|
98
|
+
/* @__PURE__ */ c("div", { className: n.monthGrid, "data-testid": "year-picker", children: B.map((t, x) => {
|
|
98
99
|
const s = g(t);
|
|
99
100
|
return /* @__PURE__ */ c(
|
|
100
101
|
"button",
|
|
101
102
|
{
|
|
102
103
|
type: "button",
|
|
103
|
-
onClick: () =>
|
|
104
|
+
onClick: () => $(t),
|
|
104
105
|
disabled: s,
|
|
105
|
-
className:
|
|
106
|
-
[n.current]: u &&
|
|
106
|
+
className: j(s ? n.m : n.a, {
|
|
107
|
+
[n.current]: u && M.y === t
|
|
107
108
|
}),
|
|
108
109
|
children: t
|
|
109
110
|
},
|
|
@@ -113,5 +114,5 @@ const p = 15, I = 7, W = ({
|
|
|
113
114
|
] });
|
|
114
115
|
};
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
X as YearPickerModal
|
|
117
118
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DependencyList } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare const useDatePickerPosition: (
|
|
3
|
+
export declare const useDatePickerPosition: (position?: "center" | "bottom" | "top", deps?: DependencyList) => import('react').RefObject<HTMLDivElement>;
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { useRef as d, useEffect as h } from "react";
|
|
2
|
-
import { BLOCK_WIDTH as
|
|
3
|
-
const H = (
|
|
4
|
-
const
|
|
2
|
+
import { BLOCK_WIDTH as l, MAX_MOBILE_WIDTH as w } from "./constants.js";
|
|
3
|
+
const H = (i, a) => {
|
|
4
|
+
const f = d(null);
|
|
5
5
|
return h(() => {
|
|
6
6
|
var c, r, y;
|
|
7
|
-
const x = window.innerHeight,
|
|
7
|
+
const x = window.innerHeight, p = window.innerWidth, t = f.current;
|
|
8
8
|
if (t && t !== null) {
|
|
9
|
-
const u = ((c = t == null ? void 0 : t.parentElement) == null ? void 0 : c.offsetWidth) ?? 0,
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const u = ((c = t == null ? void 0 : t.parentElement) == null ? void 0 : c.offsetWidth) ?? 0, s = ((r = t == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetHeight) ?? 0, o = (y = t == null ? void 0 : t.parentElement) == null ? void 0 : y.getBoundingClientRect(), e = t.offsetHeight;
|
|
10
|
+
if (i) {
|
|
11
|
+
if (i === "center") {
|
|
12
|
+
t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${l / 2}px)`, t.style.opacity = "1";
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (i === "bottom") {
|
|
16
|
+
t.style.top = s + "px", t.style.opacity = "1";
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (i === "top") {
|
|
20
|
+
t.style.top = -e + "px", t.style.opacity = "1";
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
if (p < o.x + l) {
|
|
25
|
+
const n = u - l;
|
|
26
|
+
o.x - Math.abs(n) < 0 ? t.style.left = (n < 0 ? n / 2 : n) + "px" : t.style.left = n + "px";
|
|
27
|
+
}
|
|
28
|
+
x < o.y + e + s ? o.y - e > 0 ? t.style.top = -e + "px" : p > w ? t.style.top = s + "px" : (t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${l / 2}px)`) : t.style.top = s + "px", t.style.opacity = "1";
|
|
13
29
|
}
|
|
14
|
-
if (l === "bottom") {
|
|
15
|
-
t.style.top = n + "px", t.style.opacity = "1";
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (l === "top") {
|
|
19
|
-
t.style.top = -e + "px", t.style.opacity = "1";
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (f < o.x + s) {
|
|
23
|
-
const i = u - s;
|
|
24
|
-
o.x - Math.abs(i) < 0 ? t.style.left = (i < 0 ? i / 2 : i) + "px" : t.style.left = i + "px";
|
|
25
|
-
}
|
|
26
|
-
x < o.y + e + n ? o.y - e > 0 ? t.style.top = -e + "px" : f > w ? t.style.top = n + "px" : (t.style.position = "fixed", t.style.top = `calc(50vh - ${e / 2}px)`, t.style.left = `calc(50vw - ${s / 2}px)`) : t.style.top = n + "px", t.style.opacity = "1";
|
|
27
30
|
}
|
|
28
|
-
}, [a]),
|
|
31
|
+
}, [a, i]), f;
|
|
29
32
|
};
|
|
30
33
|
export {
|
|
31
34
|
H as useDatePickerPosition
|