@dmsi/wedgekit-react 3.1.0 → 3.2.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/components/CalendarIconButton.d.ts +10 -0
- package/dist/components/CalendarIconButton.d.ts.map +1 -0
- package/dist/components/CalendarIconButton.js +29 -0
- package/dist/components/DataGridCell.d.ts.map +1 -1
- package/dist/components/DataGridCell.js +124 -110
- package/dist/components/DateInput.d.ts.map +1 -1
- package/dist/components/DateInput.js +146 -135
- package/dist/components/DateRangeInput.d.ts.map +1 -1
- package/dist/components/DateRangeInput.js +268 -256
- package/package.json +1 -1
|
@@ -1,369 +1,381 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { InputBase as
|
|
6
|
-
import { CalendarRange as
|
|
7
|
-
import {
|
|
8
|
-
import { findDocumentRoot as
|
|
9
|
-
import { parseInputDate as d, isValidDate as
|
|
10
|
-
import { marginTopUsingComponentGap as
|
|
11
|
-
import { useMatchesMobile as
|
|
12
|
-
function
|
|
13
|
-
id:
|
|
2
|
+
import { jsxs as wt, Fragment as Pt, jsx as T } from "react/jsx-runtime";
|
|
3
|
+
import { useState as b, useRef as z, useEffect as H, useLayoutEffect as St } from "react";
|
|
4
|
+
import { createPortal as yt } from "react-dom";
|
|
5
|
+
import { InputBase as Vt } from "./Input.js";
|
|
6
|
+
import { CalendarRange as Mt } from "./CalendarRange.js";
|
|
7
|
+
import { CalendarIconButton as vt } from "./CalendarIconButton.js";
|
|
8
|
+
import { findDocumentRoot as Ft } from "../utils.js";
|
|
9
|
+
import { parseInputDate as d, isValidDate as P, formatDate as K, isValidDateRangeOrder as Yt, formatInputValue as O, calculateCursorPosition as xt } from "../utils/date.js";
|
|
10
|
+
import { marginTopUsingComponentGap as It } from "../classNames.js";
|
|
11
|
+
import { useMatchesMobile as kt } from "../hooks/useMatchesMedia.js";
|
|
12
|
+
function Ct({
|
|
13
|
+
id: s,
|
|
14
14
|
testid: i,
|
|
15
|
-
value:
|
|
15
|
+
value: M,
|
|
16
16
|
onChange: r,
|
|
17
17
|
placeholder: p = "MM/DD/YYYY - MM/DD/YYYY",
|
|
18
|
-
disabled:
|
|
19
|
-
readOnly:
|
|
18
|
+
disabled: v,
|
|
19
|
+
readOnly: h = !1,
|
|
20
20
|
single: k = !1,
|
|
21
21
|
disableRange: a = !1,
|
|
22
22
|
label: E,
|
|
23
|
-
isDateAvailable:
|
|
24
|
-
onPendingFromChange:
|
|
25
|
-
theme:
|
|
26
|
-
...
|
|
23
|
+
isDateAvailable: g,
|
|
24
|
+
onPendingFromChange: _,
|
|
25
|
+
theme: tt,
|
|
26
|
+
...et
|
|
27
27
|
}) {
|
|
28
|
-
const
|
|
28
|
+
const nt = kt(), [q, S] = b(!1), W = z(null), [Y, u] = b(""), [X, D] = b(!1), R = z(null), C = z(null), l = z(null), [N, rt] = b({
|
|
29
29
|
top: 0,
|
|
30
30
|
left: 0,
|
|
31
31
|
width: 0
|
|
32
|
-
}), [
|
|
33
|
-
|
|
32
|
+
}), [L, B] = M.split("|");
|
|
33
|
+
H(() => {
|
|
34
34
|
if (!X) {
|
|
35
|
-
const t =
|
|
35
|
+
const t = Z(L, B);
|
|
36
36
|
t && u(t);
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const t =
|
|
44
|
-
|
|
38
|
+
}, [L, B, X, a]), St(() => {
|
|
39
|
+
q && A();
|
|
40
|
+
}, [q]);
|
|
41
|
+
const A = () => {
|
|
42
|
+
if (C.current) {
|
|
43
|
+
const t = C.current.getBoundingClientRect();
|
|
44
|
+
rt({
|
|
45
45
|
top: t.bottom + window.scrollY,
|
|
46
46
|
left: t.left + window.scrollX,
|
|
47
47
|
width: t.width
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const t = new ResizeObserver(
|
|
54
|
-
return l.current && t.observe(l.current), window.addEventListener("scroll",
|
|
55
|
-
t.disconnect(), window.removeEventListener("scroll",
|
|
51
|
+
H(() => {
|
|
52
|
+
A();
|
|
53
|
+
const t = new ResizeObserver(A);
|
|
54
|
+
return l.current && t.observe(l.current), window.addEventListener("scroll", A), () => {
|
|
55
|
+
t.disconnect(), window.removeEventListener("scroll", A);
|
|
56
56
|
};
|
|
57
|
-
}, []),
|
|
57
|
+
}, []), H(() => {
|
|
58
58
|
const t = (e) => {
|
|
59
|
-
e.key === "Escape" &&
|
|
59
|
+
e.key === "Escape" && R.current && (S(!1), l.current?.blur());
|
|
60
60
|
};
|
|
61
61
|
return document.addEventListener("keydown", t), () => {
|
|
62
62
|
document.removeEventListener("keydown", t);
|
|
63
63
|
};
|
|
64
|
-
}, []),
|
|
64
|
+
}, []), H(() => {
|
|
65
65
|
const t = (e) => {
|
|
66
|
-
|
|
66
|
+
R.current && !R.current.contains(e.target) && l.current && !l.current.contains(e.target) && !W.current?.contains(e.target) && S(!1);
|
|
67
67
|
};
|
|
68
68
|
return document.addEventListener("mousedown", t), () => {
|
|
69
69
|
document.removeEventListener("mousedown", t);
|
|
70
70
|
};
|
|
71
71
|
}, []);
|
|
72
|
-
function
|
|
73
|
-
r(a ? `${t}|${t}` : `${t}|${e}`),
|
|
72
|
+
function st(t, e) {
|
|
73
|
+
r(a ? `${t}|${t}` : `${t}|${e}`), S(!1), D(!1);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
75
|
+
const J = () => {
|
|
76
|
+
h || S(!0);
|
|
77
|
+
}, ot = () => {
|
|
78
|
+
J();
|
|
79
|
+
}, ct = () => {
|
|
80
|
+
h || S((t) => !t);
|
|
81
|
+
}, it = (t) => {
|
|
82
|
+
if (h) return;
|
|
83
|
+
const e = t.target.value, o = t.target.selectionStart || 0;
|
|
84
|
+
if (at(e)) {
|
|
85
|
+
lt(e, o);
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
const n = F(e), c =
|
|
88
|
+
D(!0);
|
|
89
|
+
const n = F(e), c = ut(n, e) ? `${n} - ` : n;
|
|
88
90
|
u(c);
|
|
89
|
-
const f =
|
|
91
|
+
const f = ft(
|
|
90
92
|
e,
|
|
91
93
|
n,
|
|
92
94
|
c,
|
|
93
|
-
|
|
95
|
+
o
|
|
94
96
|
);
|
|
95
97
|
requestAnimationFrame(() => {
|
|
96
|
-
|
|
97
|
-
}),
|
|
98
|
-
},
|
|
99
|
-
const
|
|
98
|
+
Q(f);
|
|
99
|
+
}), dt(c);
|
|
100
|
+
}, at = (t) => !a && t.includes("-") && !t.includes(" - "), lt = (t, e) => {
|
|
101
|
+
const o = t.replace(/-/g, ""), n = F(o);
|
|
100
102
|
u(n), requestAnimationFrame(() => {
|
|
101
103
|
const c = Math.min(
|
|
102
104
|
e - 1,
|
|
103
105
|
n.length
|
|
104
106
|
);
|
|
105
|
-
|
|
107
|
+
Q(c);
|
|
106
108
|
});
|
|
107
|
-
},
|
|
109
|
+
}, ut = (t, e) => {
|
|
108
110
|
if (a || t.includes(" - ") || !t.match(/^(\d{2})\/(\d{2})\/(\d{4})$/) || e.length !== t.length)
|
|
109
111
|
return !1;
|
|
110
112
|
const n = e.length - 1;
|
|
111
113
|
return !F(e.slice(0, n)).match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
112
|
-
},
|
|
114
|
+
}, ft = (t, e, o, n) => o !== e ? o.length : Rt(
|
|
113
115
|
t,
|
|
114
|
-
|
|
116
|
+
o,
|
|
115
117
|
n,
|
|
116
118
|
a
|
|
117
|
-
),
|
|
119
|
+
), Q = (t) => {
|
|
118
120
|
l.current && l.current.setSelectionRange(t, t);
|
|
119
|
-
}, ut = (t) => {
|
|
120
|
-
a ? ft(t) : dt(t);
|
|
121
|
-
}, ft = (t) => {
|
|
122
|
-
const e = d(t);
|
|
123
|
-
e && g(e) && r(`${e}|${e}`);
|
|
124
121
|
}, dt = (t) => {
|
|
122
|
+
a ? mt(t) : pt(t);
|
|
123
|
+
}, mt = (t) => {
|
|
124
|
+
const e = d(t);
|
|
125
|
+
e && P(e) && r(`${e}|${e}`);
|
|
126
|
+
}, pt = (t) => {
|
|
125
127
|
if (t === "") {
|
|
126
128
|
r("");
|
|
127
129
|
return;
|
|
128
130
|
}
|
|
129
131
|
const e = t.match(/^(.+?)\s*-\s*(.+)$/);
|
|
130
|
-
e ?
|
|
131
|
-
},
|
|
132
|
-
const [, e,
|
|
133
|
-
n && c &&
|
|
134
|
-
},
|
|
132
|
+
e ? ht(e) : Dt(t);
|
|
133
|
+
}, ht = (t) => {
|
|
134
|
+
const [, e, o] = t, n = d(e.trim()), c = d(o.trim());
|
|
135
|
+
n && c && j(n, c) && r(`${n}|${c}`);
|
|
136
|
+
}, Dt = (t) => {
|
|
135
137
|
const e = d(t);
|
|
136
|
-
e &&
|
|
138
|
+
e && P(e) && r(`${e}|`);
|
|
139
|
+
}, $t = () => {
|
|
140
|
+
if (D(!1), a) {
|
|
141
|
+
const t = d(Y);
|
|
142
|
+
if (!t || !P(t)) {
|
|
143
|
+
const e = Z(L, B);
|
|
144
|
+
u(e || "");
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
const t = Y.match(/^(.+?)\s*-\s*(.+)$/);
|
|
148
|
+
if (t) {
|
|
149
|
+
const [, e, o] = t, n = d(e.trim()), c = d(o.trim());
|
|
150
|
+
(!n || !c || !j(n, c)) && (u(""), r(""));
|
|
151
|
+
} else if (Y.includes(" - "))
|
|
152
|
+
u(""), r("");
|
|
153
|
+
else {
|
|
154
|
+
const e = d(Y);
|
|
155
|
+
!e || P(e), u(""), r("");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, gt = (t) => {
|
|
159
|
+
if (!a && t.key === "-") {
|
|
160
|
+
t.preventDefault();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (t.key === "Backspace") {
|
|
164
|
+
const e = t.target, o = e.selectionStart || 0, n = e.value;
|
|
165
|
+
if (o > 0 && n[o - 1] === "/") {
|
|
166
|
+
t.preventDefault();
|
|
167
|
+
const c = n.slice(0, o - 2) + n.slice(o), f = F(c);
|
|
168
|
+
u(f), requestAnimationFrame(() => {
|
|
169
|
+
if (l.current) {
|
|
170
|
+
const x = Math.max(0, o - 2);
|
|
171
|
+
l.current.setSelectionRange(x, x);
|
|
172
|
+
}
|
|
173
|
+
}), D(!0);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (!a && n.includes(" - ")) {
|
|
177
|
+
const c = n.indexOf(" - "), f = c, x = c + 3;
|
|
178
|
+
if (o >= f && o <= x) {
|
|
179
|
+
t.preventDefault();
|
|
180
|
+
const w = n.slice(0, f).trim(), y = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
181
|
+
if (y) {
|
|
182
|
+
const [, m, $, V] = y, G = V.slice(0, -1), U = `${m}/${$}/${G}`, I = F(U);
|
|
183
|
+
u(I), r(""), requestAnimationFrame(() => {
|
|
184
|
+
l.current && l.current.setSelectionRange(
|
|
185
|
+
I.length,
|
|
186
|
+
I.length
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
} else {
|
|
190
|
+
const m = F(w);
|
|
191
|
+
u(m);
|
|
192
|
+
const $ = d(w);
|
|
193
|
+
$ && P($) ? r(`${$}|`) : r(""), requestAnimationFrame(() => {
|
|
194
|
+
if (l.current) {
|
|
195
|
+
const V = m.length;
|
|
196
|
+
l.current.setSelectionRange(V, V);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
D(!0);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (o === x) {
|
|
204
|
+
t.preventDefault();
|
|
205
|
+
const w = n.slice(0, f).trim(), y = `${w} - `;
|
|
206
|
+
u(y);
|
|
207
|
+
const m = d(w);
|
|
208
|
+
m && P(m) && r(`${m}|`), requestAnimationFrame(() => {
|
|
209
|
+
l.current && l.current.setSelectionRange(
|
|
210
|
+
y.length,
|
|
211
|
+
y.length
|
|
212
|
+
);
|
|
213
|
+
}), D(!0);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (t.key === "Delete") {
|
|
219
|
+
const e = t.target, o = e.selectionStart || 0, n = e.value;
|
|
220
|
+
if (!a && n.includes(" - ")) {
|
|
221
|
+
const c = n.indexOf(" - "), f = c, x = c + 3;
|
|
222
|
+
if (o >= f && o <= x) {
|
|
223
|
+
t.preventDefault();
|
|
224
|
+
const w = n.slice(0, f).trim(), y = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
225
|
+
if (y) {
|
|
226
|
+
const [, m, $, V] = y, G = V.slice(0, -1), U = `${m}/${$}/${G}`, I = F(U);
|
|
227
|
+
u(I), r(""), requestAnimationFrame(() => {
|
|
228
|
+
l.current && l.current.setSelectionRange(
|
|
229
|
+
I.length,
|
|
230
|
+
I.length
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
const m = F(w);
|
|
235
|
+
u(m);
|
|
236
|
+
const $ = d(w);
|
|
237
|
+
$ && P($) ? r(`${$}|`) : r(""), requestAnimationFrame(() => {
|
|
238
|
+
if (l.current) {
|
|
239
|
+
const V = m.length;
|
|
240
|
+
l.current.setSelectionRange(V, V);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
D(!0);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (t.key === "Enter")
|
|
250
|
+
if (a) {
|
|
251
|
+
const e = d(Y);
|
|
252
|
+
e && P(e) && (r(`${e}|${e}`), S(!1), D(!1));
|
|
253
|
+
} else {
|
|
254
|
+
const e = Y.match(/^(.+?)\s*-\s*(.+)$/);
|
|
255
|
+
if (e) {
|
|
256
|
+
const [, o, n] = e, c = d(o.trim()), f = d(n.trim());
|
|
257
|
+
c && f && j(c, f) ? (r(`${c}|${f}`), S(!1), D(!1)) : (u(""), r(""), S(!1), D(!1));
|
|
258
|
+
} else
|
|
259
|
+
u(""), r(""), S(!1), D(!1);
|
|
260
|
+
}
|
|
137
261
|
};
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
262
|
+
return /* @__PURE__ */ wt(Pt, { children: [
|
|
263
|
+
/* @__PURE__ */ T(
|
|
264
|
+
Vt,
|
|
141
265
|
{
|
|
142
|
-
id:
|
|
266
|
+
id: s,
|
|
143
267
|
testid: i,
|
|
144
268
|
ref: (t) => {
|
|
145
269
|
l.current = t;
|
|
146
270
|
},
|
|
147
|
-
...
|
|
148
|
-
wrapperRef:
|
|
149
|
-
value:
|
|
271
|
+
...et,
|
|
272
|
+
wrapperRef: C,
|
|
273
|
+
value: Y,
|
|
150
274
|
placeholder: a ? "MM/DD/YYYY" : p,
|
|
151
|
-
disabled:
|
|
152
|
-
readOnly:
|
|
153
|
-
after: /* @__PURE__ */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
u(e || "");
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
const t = v.match(/^(.+?)\s*-\s*(.+)$/);
|
|
166
|
-
if (t) {
|
|
167
|
-
const [, e, s] = t, n = d(e.trim()), c = d(s.trim());
|
|
168
|
-
(!n || !c || !T(n, c)) && (u(""), r(""));
|
|
169
|
-
} else if (v.includes(" - "))
|
|
170
|
-
u(""), r("");
|
|
171
|
-
else {
|
|
172
|
-
const e = d(v);
|
|
173
|
-
!e || g(e), u(""), r("");
|
|
174
|
-
}
|
|
275
|
+
disabled: v,
|
|
276
|
+
readOnly: h,
|
|
277
|
+
after: /* @__PURE__ */ T(
|
|
278
|
+
vt,
|
|
279
|
+
{
|
|
280
|
+
ref: W,
|
|
281
|
+
id: s ? `${s}-calendar-button` : void 0,
|
|
282
|
+
testid: i ? `${i}-calendar-button` : void 0,
|
|
283
|
+
disabled: v || h,
|
|
284
|
+
expanded: q,
|
|
285
|
+
onToggle: ct
|
|
175
286
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (t.key === "Backspace") {
|
|
183
|
-
const e = t.target, s = e.selectionStart || 0, n = e.value;
|
|
184
|
-
if (s > 0 && n[s - 1] === "/") {
|
|
185
|
-
t.preventDefault();
|
|
186
|
-
const c = n.slice(0, s - 2) + n.slice(s), f = F(c);
|
|
187
|
-
u(f), requestAnimationFrame(() => {
|
|
188
|
-
if (l.current) {
|
|
189
|
-
const I = Math.max(0, s - 2);
|
|
190
|
-
l.current.setSelectionRange(I, I);
|
|
191
|
-
}
|
|
192
|
-
}), h(!0);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
if (!a && n.includes(" - ")) {
|
|
196
|
-
const c = n.indexOf(" - "), f = c, I = c + 3;
|
|
197
|
-
if (s >= f && s <= I) {
|
|
198
|
-
t.preventDefault();
|
|
199
|
-
const w = n.slice(0, f).trim(), P = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
200
|
-
if (P) {
|
|
201
|
-
const [, m, D, S] = P, G = S.slice(0, -1), U = `${m}/${D}/${G}`, x = F(U);
|
|
202
|
-
u(x), r(""), requestAnimationFrame(() => {
|
|
203
|
-
l.current && l.current.setSelectionRange(
|
|
204
|
-
x.length,
|
|
205
|
-
x.length
|
|
206
|
-
);
|
|
207
|
-
});
|
|
208
|
-
} else {
|
|
209
|
-
const m = F(w);
|
|
210
|
-
u(m);
|
|
211
|
-
const D = d(w);
|
|
212
|
-
D && g(D) ? r(`${D}|`) : r(""), requestAnimationFrame(() => {
|
|
213
|
-
if (l.current) {
|
|
214
|
-
const S = m.length;
|
|
215
|
-
l.current.setSelectionRange(S, S);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
h(!0);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (s === I) {
|
|
223
|
-
t.preventDefault();
|
|
224
|
-
const w = n.slice(0, f).trim(), P = `${w} - `;
|
|
225
|
-
u(P);
|
|
226
|
-
const m = d(w);
|
|
227
|
-
m && g(m) && r(`${m}|`), requestAnimationFrame(() => {
|
|
228
|
-
l.current && l.current.setSelectionRange(
|
|
229
|
-
P.length,
|
|
230
|
-
P.length
|
|
231
|
-
);
|
|
232
|
-
}), h(!0);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if (t.key === "Delete") {
|
|
238
|
-
const e = t.target, s = e.selectionStart || 0, n = e.value;
|
|
239
|
-
if (!a && n.includes(" - ")) {
|
|
240
|
-
const c = n.indexOf(" - "), f = c, I = c + 3;
|
|
241
|
-
if (s >= f && s <= I) {
|
|
242
|
-
t.preventDefault();
|
|
243
|
-
const w = n.slice(0, f).trim(), P = w.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
244
|
-
if (P) {
|
|
245
|
-
const [, m, D, S] = P, G = S.slice(0, -1), U = `${m}/${D}/${G}`, x = F(U);
|
|
246
|
-
u(x), r(""), requestAnimationFrame(() => {
|
|
247
|
-
l.current && l.current.setSelectionRange(
|
|
248
|
-
x.length,
|
|
249
|
-
x.length
|
|
250
|
-
);
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
const m = F(w);
|
|
254
|
-
u(m);
|
|
255
|
-
const D = d(w);
|
|
256
|
-
D && g(D) ? r(`${D}|`) : r(""), requestAnimationFrame(() => {
|
|
257
|
-
if (l.current) {
|
|
258
|
-
const S = m.length;
|
|
259
|
-
l.current.setSelectionRange(S, S);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
h(!0);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (t.key === "Enter")
|
|
269
|
-
if (a) {
|
|
270
|
-
const e = d(v);
|
|
271
|
-
e && g(e) && (r(`${e}|${e}`), M(!1), h(!1));
|
|
272
|
-
} else {
|
|
273
|
-
const e = v.match(/^(.+?)\s*-\s*(.+)$/);
|
|
274
|
-
if (e) {
|
|
275
|
-
const [, s, n] = e, c = d(s.trim()), f = d(n.trim());
|
|
276
|
-
c && f && T(c, f) ? (r(`${c}|${f}`), M(!1), h(!1)) : (u(""), r(""), M(!1), h(!1));
|
|
277
|
-
} else
|
|
278
|
-
u(""), r(""), M(!1), h(!1);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
287
|
+
),
|
|
288
|
+
onFocus: J,
|
|
289
|
+
onClick: ot,
|
|
290
|
+
onChange: it,
|
|
291
|
+
onBlur: $t,
|
|
292
|
+
onKeyDown: gt,
|
|
281
293
|
label: E,
|
|
282
294
|
secondaryIconColor: !0
|
|
283
295
|
}
|
|
284
296
|
),
|
|
285
|
-
|
|
286
|
-
/* @__PURE__ */
|
|
297
|
+
q && !h && yt(
|
|
298
|
+
/* @__PURE__ */ T(
|
|
287
299
|
"div",
|
|
288
300
|
{
|
|
289
301
|
ref: (t) => {
|
|
290
|
-
|
|
302
|
+
R.current = t;
|
|
291
303
|
},
|
|
292
|
-
className: `absolute z-40 ${
|
|
293
|
-
"data-theme":
|
|
304
|
+
className: `absolute z-40 ${It}`,
|
|
305
|
+
"data-theme": tt,
|
|
294
306
|
style: {
|
|
295
|
-
top: `${
|
|
296
|
-
left: `${
|
|
297
|
-
minWidth: `${
|
|
307
|
+
top: `${N.top}px`,
|
|
308
|
+
left: `${N.left}px`,
|
|
309
|
+
minWidth: `${N.width}px`
|
|
298
310
|
},
|
|
299
|
-
children: /* @__PURE__ */
|
|
300
|
-
|
|
311
|
+
children: /* @__PURE__ */ T(
|
|
312
|
+
Mt,
|
|
301
313
|
{
|
|
302
|
-
id:
|
|
314
|
+
id: s ? `${s}-calendar` : void 0,
|
|
303
315
|
testid: i ? `${i}-calendar` : void 0,
|
|
304
|
-
from:
|
|
305
|
-
to:
|
|
306
|
-
onChange:
|
|
316
|
+
from: L,
|
|
317
|
+
to: B,
|
|
318
|
+
onChange: st,
|
|
307
319
|
cardStyle: !0,
|
|
308
|
-
mode: k ||
|
|
320
|
+
mode: k || nt ? "single" : "double",
|
|
309
321
|
disableRange: a,
|
|
310
|
-
isDateAvailable:
|
|
311
|
-
onPendingFromChange:
|
|
322
|
+
isDateAvailable: g,
|
|
323
|
+
onPendingFromChange: _
|
|
312
324
|
}
|
|
313
325
|
)
|
|
314
326
|
}
|
|
315
327
|
),
|
|
316
|
-
|
|
328
|
+
Ft(R.current)
|
|
317
329
|
)
|
|
318
330
|
] });
|
|
319
331
|
function F(t) {
|
|
320
|
-
return
|
|
332
|
+
return Et(t, a);
|
|
321
333
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
334
|
+
function Z(t, e) {
|
|
335
|
+
return At(t, e, a);
|
|
324
336
|
}
|
|
325
337
|
}
|
|
326
|
-
function
|
|
327
|
-
return
|
|
338
|
+
function j(s, i) {
|
|
339
|
+
return Yt(s, i);
|
|
328
340
|
}
|
|
329
|
-
function
|
|
341
|
+
function Et(s, i) {
|
|
330
342
|
if (i)
|
|
331
|
-
return
|
|
332
|
-
if (
|
|
333
|
-
const [r, p] =
|
|
334
|
-
return `${
|
|
343
|
+
return O(s);
|
|
344
|
+
if (s.includes(" - ")) {
|
|
345
|
+
const [r, p] = s.split(" - "), v = O(r), h = O(p || "");
|
|
346
|
+
return `${v} - ${h}`;
|
|
335
347
|
}
|
|
336
|
-
const
|
|
337
|
-
return
|
|
348
|
+
const M = s.replace(/-/g, "");
|
|
349
|
+
return O(M);
|
|
338
350
|
}
|
|
339
|
-
function
|
|
351
|
+
function Rt(s, i, M, r) {
|
|
340
352
|
if (!r && i.includes(" - ")) {
|
|
341
|
-
const p = i.indexOf(" - "),
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
353
|
+
const p = i.indexOf(" - "), v = s.indexOf("-");
|
|
354
|
+
if (v !== -1 && M > v) {
|
|
355
|
+
const h = s.slice(v + 1).replace(/\D/g, "").length, k = i.slice(p + 3);
|
|
344
356
|
let a = p + 3, E = 0;
|
|
345
|
-
for (let
|
|
346
|
-
if (/\d/.test(k[
|
|
347
|
-
|
|
357
|
+
for (let g = 0; g < k.length; g++) {
|
|
358
|
+
if (/\d/.test(k[g]) && (E++, E >= h)) {
|
|
359
|
+
g + 1 < k.length && k[g + 1] === "/" ? a = p + 3 + g + 2 : a = p + 3 + g + 1;
|
|
348
360
|
break;
|
|
349
361
|
}
|
|
350
|
-
E <
|
|
362
|
+
E < h && (a = p + 3 + g + 1);
|
|
351
363
|
}
|
|
352
364
|
return Math.min(a, i.length);
|
|
353
365
|
}
|
|
354
366
|
}
|
|
355
|
-
return
|
|
356
|
-
|
|
367
|
+
return xt(
|
|
368
|
+
s,
|
|
357
369
|
i,
|
|
358
|
-
|
|
370
|
+
M
|
|
359
371
|
);
|
|
360
372
|
}
|
|
361
|
-
function
|
|
362
|
-
if (!
|
|
373
|
+
function At(s, i, M) {
|
|
374
|
+
if (!s && !i)
|
|
363
375
|
return "";
|
|
364
|
-
const r =
|
|
365
|
-
return
|
|
376
|
+
const r = s ? P(s) : !1, p = i ? P(i) : !1;
|
|
377
|
+
return M ? r && s ? K(s) : "" : r && p && s && i && j(s, i) ? `${K(s)} - ${K(i)}` : r && !i && s ? `${K(s)} - ` : "";
|
|
366
378
|
}
|
|
367
379
|
export {
|
|
368
|
-
|
|
380
|
+
Ct as DateRangeInput
|
|
369
381
|
};
|