mimir-ui-kit 1.64.0 → 1.64.1
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/styles.css +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/components/DatePicker/DatePicker.js +189 -180
- package/dist/components/DatePicker/DatePickerModal.d.ts +2 -1
- package/dist/components/DatePicker/DatePickerModal.js +65 -64
- package/dist/components/DatePicker/MonthPickerModal.d.ts +2 -1
- package/dist/components/DatePicker/MonthPickerModal.js +100 -92
- package/dist/components/DatePicker/YearPickerModal.d.ts +2 -1
- package/dist/components/DatePicker/YearPickerModal.js +90 -82
- package/dist/components/DatePicker/hooks.d.ts +1 -1
- package/dist/components/DatePicker/hooks.js +21 -21
- package/dist/styles.module-DjQdoVeY.js +31 -0
- package/package.json +1 -1
- package/dist/styles.module-DeBRSK_x.js +0 -30
package/dist/assets/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._input-field-group-
|
|
1
|
+
._input-field-group-datePicker_1p14j_3{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:var(--mimir-space-2xs)}._input-field-group-datePicker_1p14j_3._full_1p14j_8{width:100%}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11{--border-color: var(--citrine-100);position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:var(--mimir-control-radius-s)}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18{position:relative;width:100%}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18 ._input-wrapper_1p14j_22{-webkit-box-flex:1;-ms-flex:1;flex:1}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18 ._input-wrapper_1p14j_22 ._right-slot_1p14j_25{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;padding-top:0}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18 ._inputBorderControl_1p14j_29{border:transparent}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18:hover ._input-wrapper_1p14j_22{background-color:var(--input-bg-color-hover)}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18:before{position:absolute;top:0;right:45px;bottom:0;left:0;z-index:3;cursor:pointer;content:""}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18._editable_1p14j_42:before{display:none}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18 svg{cursor:pointer}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18._border-radius-left_1p14j_48 ._input-wrapper_1p14j_22{border-top-right-radius:0!important;border-bottom-right-radius:0!important}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18._border-radius-right_1p14j_52 ._input-wrapper_1p14j_22{border-top-left-radius:0!important;border-bottom-left-radius:0!important}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11 ._date-wrapper_1p14j_18._border-radius-none_1p14j_56 ._input-wrapper_1p14j_22{border-radius:0!important}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11:has([data-status=error]){--border-color: var(--error-normal)}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11:has([data-status=success]){--border-color: var(--success-normal)}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11:has([data-status=alarm]){--border-color: var(--alarm-normal)}._input-field-group-datePicker_1p14j_3 ._wrapper_1p14j_11:has(._calendar-block_1p14j_68) ._input-wrapper_1p14j_22{border-bottom:1px solid var(--input-bottom-color-active)}._input-field-group-datePicker_1p14j_3 ._textError_1p14j_71{color:var(--gos-znak-diplomatic-background-color);font-weight:var(--mimir-font-weight-text-regular);font-size:var(--mimir-size-text-s);font-family:var(--mimir-font-inter);line-height:var(--mimir-size-text-m);text-align:left}[data-disabled=true] ._date-wrapper_1p14j_18:before{cursor:auto}[data-disabled=true] ._date-wrapper_1p14j_18 ._input-wrapper_1p14j_22{background:var(--black-20)}[data-disabled=true] ._date-wrapper_1p14j_18 ._input-wrapper_1p14j_22 label,[data-disabled=true] ._date-wrapper_1p14j_18 ._input-wrapper_1p14j_22 input{color:var(--white)}[data-disabled=true] ._button-wrapper_1p14j_90 svg{color:var(--white);cursor:default;fill:var(--white)}._button-wrapper_1p14j_90{position:absolute;top:0;right:0;z-index:2;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:44px;height:100%;max-height:var(--button-height-xxl)}._button_1p14j_90{-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center;background-color:transparent;border-radius:var(--mimir-control-radius-s)}._calendar-block_1p14j_68{position:absolute;z-index:var(--mimir-zindex-dropdown);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:368px;max-height:none;padding:var(--mimir-space-m);font-weight:var(--mimir-font-weight-text-regular);font-size:var(--mimir-size-text-l);font-family:var(--mimir-font-inter);line-height:var(--mimir-line-height-text-2xs);text-align:center;text-overflow:ellipsis;background:var(--white);border-radius:var(--mimir-control-radius-s);-webkit-box-shadow:0 0 0 0 rgba(22,23,39,.02),0 2px 4px 0 rgba(22,23,39,.02),0 6px 6px 0 rgba(22,23,39,.02),0 15px 9px 0 rgba(22,23,39,.01);box-shadow:0 0 #16172705,0 2px 4px #16172705,0 6px 6px #16172705,0 15px 9px #16172703;opacity:0;-webkit-transition:height .5s ease-in;transition:height .5s ease-in;-webkit-font-feature-settings:"zero";font-feature-settings:"zero";font-variant-numeric:slashed-zero}._calendar-block_1p14j_68._fixed_1p14j_135{position:fixed}._calendar-block_1p14j_68 ._h_1p14j_139{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;color:var(--black-100)}._calendar-block_1p14j_68 ._b_1p14j_48{display:-ms-grid;display:grid;-ms-grid-columns:(1fr)[7];grid-template-columns:repeat(7,1fr)}._calendar-block_1p14j_68 ._d_1p14j_18{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex:1;flex:1;gap:var(--mimir-space-2xs);-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:var(--black-100);font-size:var(--mimir-size-text-l);cursor:pointer}._calendar-block_1p14j_68 ._m_1p14j_161,._calendar-block_1p14j_68 ._a_1p14j_162,._calendar-block_1p14j_68 ._prev_1p14j_163{width:auto;height:48px;overflow:hidden}._calendar-block_1p14j_68 ._m_1p14j_161{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;color:var(--disabled);font-size:var(--mimir-size-text-l)}._calendar-block_1p14j_68 ._orange_1p14j_177{color:var(--citrine-100)}._calendar-block_1p14j_68 ._a_1p14j_162{color:var(--black-100);font-size:var(--mimir-size-text-l);border-radius:var(--mimir-control-radius-s)}._calendar-block_1p14j_68 ._a_1p14j_162:hover{background:var(--black-10)}._calendar-block_1p14j_68 ._a_1p14j_162:active{color:var(--white);background:var(--sapphire-100)}._calendar-block_1p14j_68 ._current_1p14j_194{background:var(--sapphire-10);border-radius:var(--mimir-control-radius-s)}._calendar-block_1p14j_68 ._monthGrid_1p14j_199{display:-ms-grid;display:grid;-ms-grid-columns:(1fr)[3];grid-template-columns:repeat(3,1fr)}._icon-button_1p14j_204{display:-webkit-box;display:-ms-flexbox;display:flex}
|
|
@@ -83,6 +83,10 @@ export type TProps = {
|
|
|
83
83
|
* позиция компонента относительно инпута
|
|
84
84
|
*/
|
|
85
85
|
position?: 'center' | 'bottom' | 'top';
|
|
86
|
+
/**
|
|
87
|
+
* открытие модального окна календаря поверх всех элементов;
|
|
88
|
+
*/
|
|
89
|
+
isFixed?: boolean;
|
|
86
90
|
} & TInputProps;
|
|
87
91
|
export type TDatePickerValue = {
|
|
88
92
|
value?: string;
|
|
@@ -174,4 +178,8 @@ export declare const DatePicker: import('react').MemoExoticComponent<import('rea
|
|
|
174
178
|
* позиция компонента относительно инпута
|
|
175
179
|
*/
|
|
176
180
|
position?: "center" | "bottom" | "top";
|
|
181
|
+
/**
|
|
182
|
+
* открытие модального окна календаря поверх всех элементов;
|
|
183
|
+
*/
|
|
184
|
+
isFixed?: boolean;
|
|
177
185
|
} & import('../Input/types').TInputProps & import('../Input').TAdditionalProps & import('react').RefAttributes<HTMLInputElement>>>;
|
|
@@ -1,55 +1,63 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as R, jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { c as H } from "../../index-DIxK0V-G.js";
|
|
3
|
-
import { memo as
|
|
4
|
-
import { months as
|
|
5
|
-
import { DatePickerModal as
|
|
6
|
-
import { MonthPickerModal as
|
|
7
|
-
import { c as y } from "../../styles.module-
|
|
8
|
-
import { formatDatePart as
|
|
9
|
-
import { YearPickerModal as
|
|
10
|
-
import { useClickOutside as
|
|
11
|
-
import { Icon as
|
|
12
|
-
import { formating as
|
|
13
|
-
import { I as
|
|
14
|
-
import { EInputStatus as
|
|
15
|
-
const
|
|
16
|
-
|
|
3
|
+
import { memo as ht, forwardRef as Mt, useState as A, useEffect as S } from "react";
|
|
4
|
+
import { months as Y, EDatePickerBorderRadius as B, MAX_DAY as gt, MAX_MONTH as Tt, DATE_LENGTH as $t } from "./constants.js";
|
|
5
|
+
import { DatePickerModal as bt } from "./DatePickerModal.js";
|
|
6
|
+
import { MonthPickerModal as At } from "./MonthPickerModal.js";
|
|
7
|
+
import { c as y } from "../../styles.module-DjQdoVeY.js";
|
|
8
|
+
import { formatDatePart as V } from "./utils.js";
|
|
9
|
+
import { YearPickerModal as Pt } from "./YearPickerModal.js";
|
|
10
|
+
import { useClickOutside as St } from "../../hooks/useClickOutside/useClickOutside.js";
|
|
11
|
+
import { Icon as tt } from "../../icons/Icon.js";
|
|
12
|
+
import { formating as p } from "../../utils/index.js";
|
|
13
|
+
import { I as Yt } from "../../Input-CqNPT8os.js";
|
|
14
|
+
import { EInputStatus as It, EInputSize as et } from "../Input/constants.js";
|
|
15
|
+
const xt = ht(
|
|
16
|
+
Mt(
|
|
17
17
|
({
|
|
18
18
|
size: j,
|
|
19
|
-
value:
|
|
20
|
-
onChangeValue:
|
|
21
|
-
name:
|
|
19
|
+
value: N,
|
|
20
|
+
onChangeValue: r,
|
|
21
|
+
name: k,
|
|
22
22
|
before: M,
|
|
23
23
|
type: l = "days",
|
|
24
24
|
dateFormat: h = "full",
|
|
25
|
-
error:
|
|
25
|
+
error: E,
|
|
26
26
|
onError: T,
|
|
27
27
|
onBlur: i,
|
|
28
|
-
validateImmediately:
|
|
29
|
-
variant:
|
|
30
|
-
disabled:
|
|
31
|
-
editable:
|
|
32
|
-
openOnInput:
|
|
33
|
-
sendIntermediateValues:
|
|
34
|
-
disableFuture:
|
|
35
|
-
disablePast:
|
|
36
|
-
disabledDate:
|
|
37
|
-
validRange:
|
|
38
|
-
borderRadius:
|
|
39
|
-
full:
|
|
40
|
-
position:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
validateImmediately: q,
|
|
29
|
+
variant: st,
|
|
30
|
+
disabled: L = !1,
|
|
31
|
+
editable: P = !1,
|
|
32
|
+
openOnInput: J = !0,
|
|
33
|
+
sendIntermediateValues: rt = !1,
|
|
34
|
+
disableFuture: K = !1,
|
|
35
|
+
disablePast: Q = !1,
|
|
36
|
+
disabledDate: O,
|
|
37
|
+
validRange: o,
|
|
38
|
+
borderRadius: _ = B.All,
|
|
39
|
+
full: at,
|
|
40
|
+
position: ot,
|
|
41
|
+
isFixed: U = !1,
|
|
42
|
+
...I
|
|
43
|
+
}, ct) => {
|
|
44
|
+
const [$, D] = A(!1), [X, d] = A(l), [f, g] = A(
|
|
45
|
+
() => N && !isNaN(new Date(N).getTime()) ? new Date(N) : void 0
|
|
46
|
+
), [x, G] = A(E), [it, v] = A(""), [ft, b] = A();
|
|
47
|
+
I.status = !!x && It.Error || I.status;
|
|
48
|
+
const Z = () => {
|
|
49
|
+
D(!1);
|
|
50
|
+
};
|
|
51
|
+
S(() => {
|
|
52
|
+
if (!(!$ || !U))
|
|
53
|
+
return window.addEventListener("scroll", Z, !0), () => window.removeEventListener("scroll", Z, !0);
|
|
54
|
+
}, [$, U]), S(() => {
|
|
55
|
+
G(E);
|
|
56
|
+
}, [E]), S(() => {
|
|
49
57
|
g(
|
|
50
|
-
|
|
58
|
+
N && !isNaN(new Date(N).getTime()) ? new Date(N) : void 0
|
|
51
59
|
);
|
|
52
|
-
}, [
|
|
60
|
+
}, [N]), S(() => {
|
|
53
61
|
if (f && typeof f != "string" && !isNaN(f == null ? void 0 : f.getTime())) {
|
|
54
62
|
let t = "";
|
|
55
63
|
switch (h) {
|
|
@@ -58,64 +66,64 @@ const Yt = Nt(
|
|
|
58
66
|
break;
|
|
59
67
|
}
|
|
60
68
|
case "month": {
|
|
61
|
-
const s =
|
|
69
|
+
const s = Y[f.getMonth()], e = f.getFullYear();
|
|
62
70
|
t = `${s} ${e}`;
|
|
63
71
|
break;
|
|
64
72
|
}
|
|
65
73
|
case "full": {
|
|
66
|
-
t =
|
|
74
|
+
t = p.Date(f, "dd/mm/yyyy");
|
|
67
75
|
break;
|
|
68
76
|
}
|
|
69
77
|
default: {
|
|
70
|
-
t =
|
|
78
|
+
t = p.Date(f, "dd/mm/yyyy");
|
|
71
79
|
break;
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
|
-
|
|
82
|
+
v(t);
|
|
75
83
|
} else
|
|
76
|
-
|
|
84
|
+
v("");
|
|
77
85
|
}, [f, h]);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
isActive:
|
|
86
|
+
const z = N && new Date(N).getTime;
|
|
87
|
+
S(() => {
|
|
88
|
+
q && (z ? (G(!1), T == null || T({ name: k, active: !1 })) : (G(!0), T == null || T({ name: k, active: !0 })));
|
|
89
|
+
}, [q, k, z]), St({
|
|
90
|
+
isActive: $,
|
|
83
91
|
setActive: (t) => {
|
|
84
|
-
D(t),
|
|
92
|
+
D(t), d(l), t || b(void 0);
|
|
85
93
|
},
|
|
86
94
|
className: y["calendar-block"]
|
|
87
95
|
});
|
|
88
|
-
const
|
|
89
|
-
!
|
|
90
|
-
},
|
|
96
|
+
const mt = () => {
|
|
97
|
+
!L && (J || !P) && D(!0);
|
|
98
|
+
}, F = (t) => {
|
|
91
99
|
const s = t.getTime();
|
|
92
100
|
if (t.setHours(0, 0, 0, 0), M && (typeof M == "string" ? new Date(M) : M).getTime() > s)
|
|
93
101
|
return !1;
|
|
94
|
-
if (
|
|
102
|
+
if (K) {
|
|
95
103
|
const e = /* @__PURE__ */ new Date();
|
|
96
104
|
if (e.setHours(0, 0, 0, 0), t.getTime() > e.getTime()) return !1;
|
|
97
105
|
}
|
|
98
|
-
if (
|
|
106
|
+
if (Q) {
|
|
99
107
|
const e = /* @__PURE__ */ new Date();
|
|
100
108
|
if (e.setHours(0, 0, 0, 0), s < e.getTime()) return !1;
|
|
101
109
|
}
|
|
102
|
-
if (
|
|
103
|
-
if (
|
|
110
|
+
if (O && O(t)) return !1;
|
|
111
|
+
if (o) {
|
|
104
112
|
let e;
|
|
105
|
-
typeof
|
|
106
|
-
new Date(
|
|
107
|
-
typeof
|
|
113
|
+
typeof o[0] == "string" ? e = [
|
|
114
|
+
new Date(o[0]),
|
|
115
|
+
typeof o[1] == "string" ? new Date(o[1]) : o[1]
|
|
108
116
|
] : e = [
|
|
109
|
-
|
|
110
|
-
typeof
|
|
117
|
+
o[0],
|
|
118
|
+
typeof o[1] == "string" ? new Date(o[1]) : o[1]
|
|
111
119
|
];
|
|
112
|
-
const [
|
|
120
|
+
const [c, a] = e, m = new Date(c), n = new Date(a);
|
|
113
121
|
if (m.setHours(0, 0, 0, 0), n.setHours(23, 59, 59, 999), t < m || t > n) return !1;
|
|
114
122
|
}
|
|
115
123
|
return !0;
|
|
116
|
-
},
|
|
124
|
+
}, nt = (t) => {
|
|
117
125
|
if (!isNaN(t.getTime())) {
|
|
118
|
-
g(t),
|
|
126
|
+
g(t), b(void 0);
|
|
119
127
|
let e = "";
|
|
120
128
|
switch (h) {
|
|
121
129
|
case "year": {
|
|
@@ -123,25 +131,25 @@ const Yt = Nt(
|
|
|
123
131
|
break;
|
|
124
132
|
}
|
|
125
133
|
case "month": {
|
|
126
|
-
const
|
|
127
|
-
e = `${
|
|
134
|
+
const c = Y[t.getMonth()], a = t.getFullYear();
|
|
135
|
+
e = `${c} ${a}`;
|
|
128
136
|
break;
|
|
129
137
|
}
|
|
130
138
|
case "full": {
|
|
131
|
-
e =
|
|
139
|
+
e = p.Date(t, "yyyy-mm-dd");
|
|
132
140
|
break;
|
|
133
141
|
}
|
|
134
142
|
default: {
|
|
135
|
-
e =
|
|
143
|
+
e = p.Date(t, "yyyy-mm-dd");
|
|
136
144
|
break;
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
|
-
|
|
147
|
+
r == null || r({
|
|
140
148
|
value: e,
|
|
141
|
-
name:
|
|
149
|
+
name: k
|
|
142
150
|
});
|
|
143
151
|
}
|
|
144
|
-
|
|
152
|
+
X === "years" && (l === "years" ? (D(!1), d(l)) : d("months")), X === "months" && (l === "months" ? (D(!1), d(l)) : d("days")), g(t);
|
|
145
153
|
let s = "";
|
|
146
154
|
switch (h) {
|
|
147
155
|
case "year": {
|
|
@@ -149,27 +157,27 @@ const Yt = Nt(
|
|
|
149
157
|
break;
|
|
150
158
|
}
|
|
151
159
|
case "month": {
|
|
152
|
-
const e =
|
|
153
|
-
s = `${e} ${
|
|
160
|
+
const e = Y[t.getMonth()], c = t.getFullYear();
|
|
161
|
+
s = `${e} ${c}`;
|
|
154
162
|
break;
|
|
155
163
|
}
|
|
156
164
|
case "full": {
|
|
157
|
-
s =
|
|
165
|
+
s = p.Date(t, "yyyy-mm-dd");
|
|
158
166
|
break;
|
|
159
167
|
}
|
|
160
168
|
default: {
|
|
161
|
-
s =
|
|
169
|
+
s = p.Date(t, "yyyy-mm-dd");
|
|
162
170
|
break;
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
|
-
|
|
173
|
+
r == null || r({
|
|
166
174
|
value: s,
|
|
167
|
-
name:
|
|
175
|
+
name: k
|
|
168
176
|
}), i == null || i(s);
|
|
169
|
-
},
|
|
170
|
-
const s = f || /* @__PURE__ */ new Date(), e = s.getDate(),
|
|
171
|
-
if (
|
|
172
|
-
g(
|
|
177
|
+
}, lt = (t) => {
|
|
178
|
+
const s = f || /* @__PURE__ */ new Date(), e = s.getDate(), c = s.getMonth() + 1, a = new Date(t, c - 1, e);
|
|
179
|
+
if (a.getFullYear() === t && a.getMonth() === c - 1 && a.getDate() === e && F(a)) {
|
|
180
|
+
g(a), b(void 0);
|
|
173
181
|
let m = "";
|
|
174
182
|
switch (h) {
|
|
175
183
|
case "year": {
|
|
@@ -177,32 +185,32 @@ const Yt = Nt(
|
|
|
177
185
|
break;
|
|
178
186
|
}
|
|
179
187
|
case "month": {
|
|
180
|
-
m = `${
|
|
188
|
+
m = `${Y[c - 1]} ${t}`;
|
|
181
189
|
break;
|
|
182
190
|
}
|
|
183
191
|
case "full": {
|
|
184
|
-
m =
|
|
192
|
+
m = p.Date(a, "yyyy-mm-dd");
|
|
185
193
|
break;
|
|
186
194
|
}
|
|
187
195
|
default: {
|
|
188
|
-
m =
|
|
196
|
+
m = p.Date(a, "yyyy-mm-dd");
|
|
189
197
|
break;
|
|
190
198
|
}
|
|
191
199
|
}
|
|
192
|
-
if (
|
|
200
|
+
if (r == null || r({
|
|
193
201
|
value: m,
|
|
194
|
-
name:
|
|
202
|
+
name: k
|
|
195
203
|
}), i == null || i(m), l === "years") {
|
|
196
|
-
D(!1),
|
|
204
|
+
D(!1), d(l);
|
|
197
205
|
return;
|
|
198
206
|
}
|
|
199
207
|
} else
|
|
200
|
-
|
|
201
|
-
l === "years" ? (D(!1),
|
|
202
|
-
},
|
|
203
|
-
const
|
|
204
|
-
if (n.getFullYear() === t && n.getMonth() === s - 1 && n.getDate() === m &&
|
|
205
|
-
g(n),
|
|
208
|
+
b(new Date(t, c - 1, 1));
|
|
209
|
+
l === "years" ? (D(!1), d(l)) : d("months");
|
|
210
|
+
}, yt = (t, s) => {
|
|
211
|
+
const c = (f || /* @__PURE__ */ new Date()).getDate(), a = new Date(t, s, 0).getDate(), m = Math.min(c, a), n = new Date(t, s - 1, m);
|
|
212
|
+
if (n.getFullYear() === t && n.getMonth() === s - 1 && n.getDate() === m && F(n)) {
|
|
213
|
+
g(n), b(void 0);
|
|
206
214
|
let w = "";
|
|
207
215
|
switch (h) {
|
|
208
216
|
case "year": {
|
|
@@ -210,161 +218,162 @@ const Yt = Nt(
|
|
|
210
218
|
break;
|
|
211
219
|
}
|
|
212
220
|
case "month": {
|
|
213
|
-
w = `${
|
|
221
|
+
w = `${Y[s - 1]} ${t}`;
|
|
214
222
|
break;
|
|
215
223
|
}
|
|
216
224
|
case "full": {
|
|
217
|
-
w =
|
|
225
|
+
w = p.Date(n, "yyyy-mm-dd");
|
|
218
226
|
break;
|
|
219
227
|
}
|
|
220
228
|
default: {
|
|
221
|
-
w =
|
|
229
|
+
w = p.Date(n, "yyyy-mm-dd");
|
|
222
230
|
break;
|
|
223
231
|
}
|
|
224
232
|
}
|
|
225
|
-
if (
|
|
233
|
+
if (r == null || r({
|
|
226
234
|
value: w,
|
|
227
|
-
name:
|
|
235
|
+
name: k
|
|
228
236
|
}), i == null || i(w), l === "months") {
|
|
229
|
-
D(!1),
|
|
237
|
+
D(!1), d(l);
|
|
230
238
|
return;
|
|
231
239
|
}
|
|
232
240
|
} else
|
|
233
|
-
|
|
234
|
-
l === "months" ? (D(!1),
|
|
235
|
-
},
|
|
236
|
-
if (
|
|
241
|
+
b(new Date(t, s - 1, 1));
|
|
242
|
+
l === "months" ? (D(!1), d(l)) : d("days");
|
|
243
|
+
}, Dt = (t) => {
|
|
244
|
+
if (P || t.target.value === "") {
|
|
237
245
|
const s = t.target.value.replace(/[^\d]/g, "");
|
|
238
246
|
if (s.length === 0)
|
|
239
|
-
|
|
247
|
+
v(""), g(void 0), D(!1), r == null || r({ value: "", name: k }), i == null || i("");
|
|
240
248
|
else {
|
|
241
|
-
const [e,
|
|
242
|
-
|
|
243
|
-
|
|
249
|
+
const [e, c, a] = [
|
|
250
|
+
V(s.substring(0, 2), gt),
|
|
251
|
+
V(s.substring(2, 4), Tt),
|
|
244
252
|
s.substring(4, 8)
|
|
245
|
-
], m = [e,
|
|
246
|
-
if (
|
|
247
|
-
const n =
|
|
248
|
-
|
|
253
|
+
], m = [e, c, a].filter(Boolean).join("/");
|
|
254
|
+
if (v(m), rt) {
|
|
255
|
+
const n = a ? `${a}-${c || "00"}-${e || "00"}` : [e, c, a].filter(Boolean).join("-");
|
|
256
|
+
r == null || r({
|
|
249
257
|
value: n,
|
|
250
|
-
name:
|
|
258
|
+
name: k
|
|
251
259
|
});
|
|
252
260
|
}
|
|
253
|
-
if (m.length ===
|
|
254
|
-
const n = parseInt(
|
|
255
|
-
`${n}-${
|
|
261
|
+
if (m.length === $t) {
|
|
262
|
+
const n = parseInt(a), w = /* @__PURE__ */ new Date(
|
|
263
|
+
`${n}-${c.padStart(2, "0")}-${e.padStart(2, "0")}`
|
|
256
264
|
);
|
|
257
|
-
isNaN(w.getTime()) || (g(w),
|
|
258
|
-
value:
|
|
259
|
-
name:
|
|
260
|
-
}), i == null || i(
|
|
265
|
+
isNaN(w.getTime()) || (g(w), r == null || r({
|
|
266
|
+
value: p.Date(w, "yyyy-mm-dd"),
|
|
267
|
+
name: k
|
|
268
|
+
}), i == null || i(p.Date(w, "yyyy-mm-dd")));
|
|
261
269
|
}
|
|
262
270
|
}
|
|
263
271
|
}
|
|
264
|
-
},
|
|
272
|
+
}, dt = H(
|
|
265
273
|
y.wrapper,
|
|
266
|
-
|
|
267
|
-
),
|
|
268
|
-
let
|
|
269
|
-
if (
|
|
274
|
+
$ && !P && y.active
|
|
275
|
+
), pt = H(y.input, y.inputBorderControl);
|
|
276
|
+
let C;
|
|
277
|
+
if (o) {
|
|
270
278
|
let t, s;
|
|
271
|
-
typeof
|
|
279
|
+
typeof o[0] == "string" ? t = new Date(o[0]) : t = o[0], typeof o[1] == "string" ? s = new Date(o[1]) : s = o[1], C = [t, s];
|
|
272
280
|
}
|
|
273
|
-
const
|
|
274
|
-
onChangeValue:
|
|
275
|
-
date:
|
|
281
|
+
const W = {
|
|
282
|
+
onChangeValue: nt,
|
|
283
|
+
date: ft || f || /* @__PURE__ */ new Date(),
|
|
276
284
|
selectedDate: f,
|
|
277
285
|
before: typeof M == "string" ? new Date(M) : M,
|
|
278
|
-
onChangeType:
|
|
286
|
+
onChangeType: d,
|
|
279
287
|
setIsActive: D,
|
|
280
|
-
disableFuture:
|
|
281
|
-
disablePast:
|
|
282
|
-
disabledDate:
|
|
283
|
-
validRange:
|
|
288
|
+
disableFuture: K,
|
|
289
|
+
disablePast: Q,
|
|
290
|
+
disabledDate: O,
|
|
291
|
+
validRange: C,
|
|
284
292
|
dateFormat: h,
|
|
285
|
-
position:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
position: ot,
|
|
294
|
+
isFixed: U
|
|
295
|
+
}, wt = {
|
|
296
|
+
...W,
|
|
297
|
+
onChangeMonth: yt,
|
|
289
298
|
dateFormat: h
|
|
290
|
-
},
|
|
291
|
-
...
|
|
292
|
-
onChangeYear:
|
|
293
|
-
},
|
|
294
|
-
switch (
|
|
299
|
+
}, ut = {
|
|
300
|
+
...W,
|
|
301
|
+
onChangeYear: lt
|
|
302
|
+
}, kt = (() => {
|
|
303
|
+
switch (X) {
|
|
295
304
|
case "months":
|
|
296
|
-
return () => /* @__PURE__ */
|
|
305
|
+
return () => /* @__PURE__ */ u(At, { ...wt });
|
|
297
306
|
case "years":
|
|
298
|
-
return () => /* @__PURE__ */
|
|
307
|
+
return () => /* @__PURE__ */ u(Pt, { ...ut });
|
|
299
308
|
default:
|
|
300
|
-
return () => /* @__PURE__ */
|
|
309
|
+
return () => /* @__PURE__ */ u(bt, { ...W });
|
|
301
310
|
}
|
|
302
|
-
})(),
|
|
303
|
-
e.stopPropagation(),
|
|
304
|
-
}, className: y["icon-button"], children: t ? /* @__PURE__ */
|
|
305
|
-
|
|
311
|
+
})(), Nt = ({ isActive: t }) => /* @__PURE__ */ u("button", { onClick: (e) => {
|
|
312
|
+
e.stopPropagation(), L || D(!t);
|
|
313
|
+
}, className: y["icon-button"], children: t ? /* @__PURE__ */ u(
|
|
314
|
+
tt,
|
|
306
315
|
{
|
|
307
|
-
iconName: j ===
|
|
316
|
+
iconName: j === et.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
|
|
308
317
|
}
|
|
309
|
-
) : /* @__PURE__ */
|
|
310
|
-
|
|
318
|
+
) : /* @__PURE__ */ u(
|
|
319
|
+
tt,
|
|
311
320
|
{
|
|
312
|
-
iconName: j ===
|
|
321
|
+
iconName: j === et.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
|
|
313
322
|
}
|
|
314
323
|
) });
|
|
315
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ R(
|
|
316
325
|
"div",
|
|
317
326
|
{
|
|
318
327
|
className: H(y["input-field-group-datePicker"], {
|
|
319
|
-
[y.full]:
|
|
328
|
+
[y.full]: at
|
|
320
329
|
}),
|
|
321
330
|
children: [
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ R("div", { className: dt, "data-disabled": L, children: [
|
|
332
|
+
/* @__PURE__ */ u(
|
|
324
333
|
"div",
|
|
325
334
|
{
|
|
326
335
|
role: "button",
|
|
327
|
-
"data-status":
|
|
336
|
+
"data-status": I.status,
|
|
328
337
|
className: H(y["date-wrapper"], {
|
|
329
|
-
[y.editable]:
|
|
330
|
-
[y[`border-radius-${
|
|
338
|
+
[y.editable]: P,
|
|
339
|
+
[y[`border-radius-${_}`]]: _ !== B.All
|
|
331
340
|
}),
|
|
332
|
-
onClick:
|
|
333
|
-
children: /* @__PURE__ */
|
|
334
|
-
|
|
341
|
+
onClick: mt,
|
|
342
|
+
children: /* @__PURE__ */ u(
|
|
343
|
+
Yt,
|
|
335
344
|
{
|
|
336
|
-
ref:
|
|
337
|
-
className:
|
|
345
|
+
ref: ct,
|
|
346
|
+
className: pt,
|
|
338
347
|
wrapperClassName: y["input-wrapper"],
|
|
339
348
|
size: j,
|
|
340
349
|
type: "text",
|
|
341
|
-
variant:
|
|
342
|
-
value:
|
|
343
|
-
onChange:
|
|
350
|
+
variant: st,
|
|
351
|
+
value: it,
|
|
352
|
+
onChange: Dt,
|
|
344
353
|
rightAddon: {
|
|
345
354
|
addonType: "react-node",
|
|
346
|
-
addonContent: /* @__PURE__ */
|
|
355
|
+
addonContent: /* @__PURE__ */ u(Nt, { isActive: $ })
|
|
347
356
|
},
|
|
348
357
|
rightSlotClassName: y["right-slot"],
|
|
349
358
|
onFocus: () => {
|
|
350
|
-
|
|
359
|
+
J && !P && D(!0);
|
|
351
360
|
},
|
|
352
|
-
borderRadius:
|
|
353
|
-
...
|
|
361
|
+
borderRadius: _,
|
|
362
|
+
...I
|
|
354
363
|
}
|
|
355
364
|
)
|
|
356
365
|
}
|
|
357
366
|
),
|
|
358
|
-
|
|
367
|
+
$ && /* @__PURE__ */ u(kt, {})
|
|
359
368
|
] }),
|
|
360
|
-
|
|
369
|
+
x && typeof x == "string" && /* @__PURE__ */ u("div", { className: y.textError, children: x })
|
|
361
370
|
]
|
|
362
371
|
}
|
|
363
372
|
);
|
|
364
373
|
}
|
|
365
374
|
)
|
|
366
375
|
);
|
|
367
|
-
|
|
376
|
+
xt.displayName = "DatePicker";
|
|
368
377
|
export {
|
|
369
|
-
|
|
378
|
+
xt as DatePicker
|
|
370
379
|
};
|
|
@@ -11,6 +11,7 @@ type TProps = {
|
|
|
11
11
|
validRange?: [Date, Date];
|
|
12
12
|
dateFormat?: 'full' | 'month' | 'year';
|
|
13
13
|
position?: 'center' | 'bottom' | 'top';
|
|
14
|
+
isFixed?: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare const DatePickerModal: ({ date, selectedDate, onChangeValue, setIsActive, before, onChangeType, disableFuture, disablePast, disabledDate, validRange, dateFormat, position }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const DatePickerModal: ({ date, selectedDate, onChangeValue, setIsActive, before, onChangeType, disableFuture, disablePast, disabledDate, validRange, dateFormat, position, isFixed }: TProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export {};
|