@mercury-fx/core 2.4.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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/cx.d.ts +3 -0
- package/dist/date.d.ts +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/internal/arrays.d.ts +95 -0
- package/dist/internal/attrs.d.ts +33 -0
- package/dist/internal/clamp.d.ts +4 -0
- package/dist/internal/create-id.d.ts +8 -0
- package/dist/internal/css-escape.d.ts +7 -0
- package/dist/internal/date-time/calendar/use-calendar.d.ts +63 -0
- package/dist/internal/date-time/field/helpers.d.ts +86 -0
- package/dist/internal/date-time/field/parts.d.ts +8 -0
- package/dist/internal/date-time/field/segments.d.ts +60 -0
- package/dist/internal/date-time/field/time-helpers.d.ts +82 -0
- package/dist/internal/date-time/field/types.d.ts +25 -0
- package/dist/internal/date-time/field/use-date-field.d.ts +61 -0
- package/dist/internal/date-time/formatter.d.ts +114 -0
- package/dist/internal/date-time/placeholders.d.ts +8 -0
- package/dist/internal/date-time/time-value.d.ts +11 -0
- package/dist/internal/date-time/utils.d.ts +76 -0
- package/dist/internal/debounce.d.ts +4 -0
- package/dist/internal/dom.d.ts +7 -0
- package/dist/internal/elements.d.ts +2 -0
- package/dist/internal/focus.d.ts +5 -0
- package/dist/internal/get-directional-keys.d.ts +21 -0
- package/dist/internal/is.d.ts +25 -0
- package/dist/internal/kbd-constants.d.ts +42 -0
- package/dist/internal/kbd.d.ts +1 -0
- package/dist/internal/locale.d.ts +6 -0
- package/dist/internal/math.d.ts +1 -0
- package/dist/internal/noop.d.ts +4 -0
- package/dist/internal/should-enable-focus-trap.d.ts +4 -0
- package/dist/internal/types.d.ts +14 -0
- package/dist/internal/use-anchored-position.d.ts +45 -0
- package/dist/internal/use-arrow-navigation.d.ts +62 -0
- package/dist/internal/use-dismiss.d.ts +31 -0
- package/dist/internal/use-focus-trap.d.ts +31 -0
- package/dist/internal/use-id.d.ts +6 -0
- package/dist/internal/warn.d.ts +1 -0
- package/dist/mercury-core.js +865 -0
- package/dist/mercury-core.js.map +1 -0
- package/dist/shared/date/types.d.ts +100 -0
- package/dist/shared/index.d.ts +36 -0
- package/dist/shared/types.d.ts +13 -0
- package/dist/types.d.ts +31 -0
- package/dist/utils/after-sleep.d.ts +4 -0
- package/dist/utils/clsx.d.ts +7 -0
- package/dist/utils/dom.d.ts +14 -0
- package/dist/utils/event-list.d.ts +1 -0
- package/dist/utils/events.d.ts +13 -0
- package/dist/utils/execute-callbacks.d.ts +7 -0
- package/dist/utils/is.d.ts +4 -0
- package/dist/utils/merge-props.d.ts +22 -0
- package/dist/utils/strings.d.ts +3 -0
- package/dist/utils/style-to-css.d.ts +9 -0
- package/dist/utils/style.d.ts +2 -0
- package/package.json +51 -0
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
import { useRef as I, useState as N, useMemo as D, useCallback as F, useEffect as te, useLayoutEffect as he } from "react";
|
|
2
|
+
import { ZonedDateTime as ne, getLocalTimeZone as B, getDayOfWeek as ge, CalendarDateTime as re, Time as be, DateFormatter as S, CalendarDate as oe, today as V, isSameDay as K } from "@internationalized/date";
|
|
3
|
+
import { CalendarDate as lt, parseDate as dt } from "@internationalized/date";
|
|
4
|
+
function Qe(...e) {
|
|
5
|
+
return e.filter(Boolean).join(" ");
|
|
6
|
+
}
|
|
7
|
+
function P(e, t = B()) {
|
|
8
|
+
return e instanceof ne ? e.toDate() : e.toDate(t);
|
|
9
|
+
}
|
|
10
|
+
function ve(e) {
|
|
11
|
+
return e instanceof re;
|
|
12
|
+
}
|
|
13
|
+
function O(e) {
|
|
14
|
+
return e instanceof ne;
|
|
15
|
+
}
|
|
16
|
+
function pe(e) {
|
|
17
|
+
return ve(e) || O(e);
|
|
18
|
+
}
|
|
19
|
+
function we(e) {
|
|
20
|
+
if (e instanceof Date) {
|
|
21
|
+
const t = e.getFullYear(), n = e.getMonth() + 1;
|
|
22
|
+
return new Date(t, n, 0).getDate();
|
|
23
|
+
} else
|
|
24
|
+
return e.set({ day: 100 }).day;
|
|
25
|
+
}
|
|
26
|
+
function ke(e, t, n) {
|
|
27
|
+
const r = ge(e, n);
|
|
28
|
+
return t > r ? e.subtract({ days: r + 7 - t }) : t === r ? e : e.subtract({ days: r - t });
|
|
29
|
+
}
|
|
30
|
+
function Y(e) {
|
|
31
|
+
return e instanceof be ? new re(2020, 1, 1, e.hour, e.minute, e.second, e.millisecond) : e;
|
|
32
|
+
}
|
|
33
|
+
const ae = {
|
|
34
|
+
year: "numeric",
|
|
35
|
+
month: "numeric",
|
|
36
|
+
day: "numeric",
|
|
37
|
+
hour: "numeric",
|
|
38
|
+
minute: "numeric",
|
|
39
|
+
second: "numeric"
|
|
40
|
+
};
|
|
41
|
+
function Se(e) {
|
|
42
|
+
return typeof e == "object" && e !== null && "current" in e;
|
|
43
|
+
}
|
|
44
|
+
function M(e) {
|
|
45
|
+
return Se(e) ? () => e.current : () => e;
|
|
46
|
+
}
|
|
47
|
+
function ie(e) {
|
|
48
|
+
const t = M(e.locale), n = M(e.monthFormat ?? "long"), r = M(e.yearFormat ?? "numeric");
|
|
49
|
+
let c;
|
|
50
|
+
const l = () => c ?? t();
|
|
51
|
+
function s(u) {
|
|
52
|
+
c = u;
|
|
53
|
+
}
|
|
54
|
+
function o() {
|
|
55
|
+
return l();
|
|
56
|
+
}
|
|
57
|
+
function a(u, m) {
|
|
58
|
+
return new S(l(), m).format(u);
|
|
59
|
+
}
|
|
60
|
+
function i(u, m = !0) {
|
|
61
|
+
return pe(u) && m ? a(P(u), { dateStyle: "long", timeStyle: "long" }) : a(P(u), { dateStyle: "long" });
|
|
62
|
+
}
|
|
63
|
+
function f(u) {
|
|
64
|
+
const m = n(), g = r();
|
|
65
|
+
if (typeof m != "function" && typeof g != "function")
|
|
66
|
+
return new S(l(), { month: m, year: g }).format(u);
|
|
67
|
+
const k = typeof m == "function" ? m(u.getMonth() + 1) : new S(l(), { month: m }).format(u), v = typeof g == "function" ? g(u.getFullYear()) : new S(l(), { year: g }).format(u);
|
|
68
|
+
return `${k} ${v}`;
|
|
69
|
+
}
|
|
70
|
+
function d(u) {
|
|
71
|
+
return new S(l(), { month: "long" }).format(u);
|
|
72
|
+
}
|
|
73
|
+
function y(u) {
|
|
74
|
+
return new S(l(), { year: "numeric" }).format(u);
|
|
75
|
+
}
|
|
76
|
+
function h(u, m) {
|
|
77
|
+
return O(u) ? new S(l(), { ...m, timeZone: u.timeZone }).formatToParts(
|
|
78
|
+
P(u)
|
|
79
|
+
) : new S(l(), m).formatToParts(P(u));
|
|
80
|
+
}
|
|
81
|
+
function w(u, m = "narrow") {
|
|
82
|
+
return new S(l(), { weekday: m }).format(u);
|
|
83
|
+
}
|
|
84
|
+
function b(u, m = void 0) {
|
|
85
|
+
return new S(l(), {
|
|
86
|
+
hour: "numeric",
|
|
87
|
+
minute: "numeric",
|
|
88
|
+
hourCycle: m === 24 ? "h23" : void 0
|
|
89
|
+
}).formatToParts(u).find((v) => v.type === "dayPeriod")?.value === "PM" ? "PM" : "AM";
|
|
90
|
+
}
|
|
91
|
+
function T(u, m, g = {}) {
|
|
92
|
+
return h(u, { ...ae, ...g }).find((v) => v.type === m)?.value ?? "";
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
setLocale: s,
|
|
96
|
+
getLocale: o,
|
|
97
|
+
custom: a,
|
|
98
|
+
selectedDate: i,
|
|
99
|
+
fullMonthAndYear: f,
|
|
100
|
+
fullMonth: d,
|
|
101
|
+
fullYear: y,
|
|
102
|
+
toParts: h,
|
|
103
|
+
dayOfWeek: w,
|
|
104
|
+
dayPeriod: b,
|
|
105
|
+
part: T
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function et(e) {
|
|
109
|
+
const t = M(e);
|
|
110
|
+
let n;
|
|
111
|
+
const r = () => n ?? t();
|
|
112
|
+
function c(d) {
|
|
113
|
+
n = d;
|
|
114
|
+
}
|
|
115
|
+
function l() {
|
|
116
|
+
return r();
|
|
117
|
+
}
|
|
118
|
+
function s(d, y) {
|
|
119
|
+
return new S(r(), y).format(d);
|
|
120
|
+
}
|
|
121
|
+
function o(d) {
|
|
122
|
+
return s(P(Y(d)), { timeStyle: "long" });
|
|
123
|
+
}
|
|
124
|
+
function a(d, y) {
|
|
125
|
+
const h = Y(d);
|
|
126
|
+
return O(h) ? new S(r(), {
|
|
127
|
+
...y,
|
|
128
|
+
timeZone: h.timeZone
|
|
129
|
+
}).formatToParts(P(h)) : new S(r(), y).formatToParts(P(h));
|
|
130
|
+
}
|
|
131
|
+
function i(d, y = void 0) {
|
|
132
|
+
return new S(r(), {
|
|
133
|
+
hour: "numeric",
|
|
134
|
+
minute: "numeric",
|
|
135
|
+
hourCycle: y === 24 ? "h23" : void 0
|
|
136
|
+
}).formatToParts(d).find((b) => b.type === "dayPeriod")?.value === "PM" ? "PM" : "AM";
|
|
137
|
+
}
|
|
138
|
+
function f(d, y, h = {}) {
|
|
139
|
+
return a(d, { ...ae, ...h }).find((b) => b.type === y)?.value ?? "";
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
setLocale: c,
|
|
143
|
+
getLocale: l,
|
|
144
|
+
custom: s,
|
|
145
|
+
selectedTime: o,
|
|
146
|
+
toParts: a,
|
|
147
|
+
dayPeriod: i,
|
|
148
|
+
part: f
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const Te = [
|
|
152
|
+
"ach",
|
|
153
|
+
"af",
|
|
154
|
+
"am",
|
|
155
|
+
"an",
|
|
156
|
+
"ar",
|
|
157
|
+
"ast",
|
|
158
|
+
"az",
|
|
159
|
+
"be",
|
|
160
|
+
"bg",
|
|
161
|
+
"bn",
|
|
162
|
+
"br",
|
|
163
|
+
"bs",
|
|
164
|
+
"ca",
|
|
165
|
+
"cak",
|
|
166
|
+
"ckb",
|
|
167
|
+
"cs",
|
|
168
|
+
"cy",
|
|
169
|
+
"da",
|
|
170
|
+
"de",
|
|
171
|
+
"dsb",
|
|
172
|
+
"el",
|
|
173
|
+
"en",
|
|
174
|
+
"eo",
|
|
175
|
+
"es",
|
|
176
|
+
"et",
|
|
177
|
+
"eu",
|
|
178
|
+
"fa",
|
|
179
|
+
"ff",
|
|
180
|
+
"fi",
|
|
181
|
+
"fr",
|
|
182
|
+
"fy",
|
|
183
|
+
"ga",
|
|
184
|
+
"gd",
|
|
185
|
+
"gl",
|
|
186
|
+
"he",
|
|
187
|
+
"hr",
|
|
188
|
+
"hsb",
|
|
189
|
+
"hu",
|
|
190
|
+
"ia",
|
|
191
|
+
"id",
|
|
192
|
+
"it",
|
|
193
|
+
"ja",
|
|
194
|
+
"ka",
|
|
195
|
+
"kk",
|
|
196
|
+
"kn",
|
|
197
|
+
"ko",
|
|
198
|
+
"lb",
|
|
199
|
+
"lo",
|
|
200
|
+
"lt",
|
|
201
|
+
"lv",
|
|
202
|
+
"meh",
|
|
203
|
+
"ml",
|
|
204
|
+
"ms",
|
|
205
|
+
"nl",
|
|
206
|
+
"nn",
|
|
207
|
+
"no",
|
|
208
|
+
"oc",
|
|
209
|
+
"pl",
|
|
210
|
+
"pt",
|
|
211
|
+
"rm",
|
|
212
|
+
"ro",
|
|
213
|
+
"ru",
|
|
214
|
+
"sc",
|
|
215
|
+
"scn",
|
|
216
|
+
"sk",
|
|
217
|
+
"sl",
|
|
218
|
+
"sr",
|
|
219
|
+
"sv",
|
|
220
|
+
"szl",
|
|
221
|
+
"tg",
|
|
222
|
+
"th",
|
|
223
|
+
"tr",
|
|
224
|
+
"uk",
|
|
225
|
+
"zh-CN",
|
|
226
|
+
"zh-TW"
|
|
227
|
+
], De = ["year", "month", "day"], Z = {
|
|
228
|
+
ach: { year: "mwaka", month: "dwe", day: "nino" },
|
|
229
|
+
af: { year: "jjjj", month: "mm", day: "dd" },
|
|
230
|
+
am: { year: "ዓዓዓዓ", month: "ሚሜ", day: "ቀቀ" },
|
|
231
|
+
an: { year: "aaaa", month: "mm", day: "dd" },
|
|
232
|
+
ar: { year: "سنة", month: "شهر", day: "يوم" },
|
|
233
|
+
ast: { year: "aaaa", month: "mm", day: "dd" },
|
|
234
|
+
az: { year: "iiii", month: "aa", day: "gg" },
|
|
235
|
+
be: { year: "гггг", month: "мм", day: "дд" },
|
|
236
|
+
bg: { year: "гггг", month: "мм", day: "дд" },
|
|
237
|
+
bn: { year: "yyyy", month: "মিমি", day: "dd" },
|
|
238
|
+
br: { year: "bbbb", month: "mm", day: "dd" },
|
|
239
|
+
bs: { year: "gggg", month: "mm", day: "dd" },
|
|
240
|
+
ca: { year: "aaaa", month: "mm", day: "dd" },
|
|
241
|
+
cak: { year: "jjjj", month: "ii", day: "q'q'" },
|
|
242
|
+
ckb: { year: "ساڵ", month: "مانگ", day: "ڕۆژ" },
|
|
243
|
+
cs: { year: "rrrr", month: "mm", day: "dd" },
|
|
244
|
+
cy: { year: "bbbb", month: "mm", day: "dd" },
|
|
245
|
+
da: { year: "åååå", month: "mm", day: "dd" },
|
|
246
|
+
de: { year: "jjjj", month: "mm", day: "tt" },
|
|
247
|
+
dsb: { year: "llll", month: "mm", day: "źź" },
|
|
248
|
+
el: { year: "εεεε", month: "μμ", day: "ηη" },
|
|
249
|
+
en: { year: "yyyy", month: "mm", day: "dd" },
|
|
250
|
+
eo: { year: "jjjj", month: "mm", day: "tt" },
|
|
251
|
+
es: { year: "aaaa", month: "mm", day: "dd" },
|
|
252
|
+
et: { year: "aaaa", month: "kk", day: "pp" },
|
|
253
|
+
eu: { year: "uuuu", month: "hh", day: "ee" },
|
|
254
|
+
fa: { year: "سال", month: "ماه", day: "روز" },
|
|
255
|
+
ff: { year: "hhhh", month: "ll", day: "ññ" },
|
|
256
|
+
fi: { year: "vvvv", month: "kk", day: "pp" },
|
|
257
|
+
fr: { year: "aaaa", month: "mm", day: "jj" },
|
|
258
|
+
fy: { year: "jjjj", month: "mm", day: "dd" },
|
|
259
|
+
ga: { year: "bbbb", month: "mm", day: "ll" },
|
|
260
|
+
gd: { year: "bbbb", month: "mm", day: "ll" },
|
|
261
|
+
gl: { year: "aaaa", month: "mm", day: "dd" },
|
|
262
|
+
he: { year: "שנה", month: "חודש", day: "יום" },
|
|
263
|
+
hr: { year: "gggg", month: "mm", day: "dd" },
|
|
264
|
+
hsb: { year: "llll", month: "mm", day: "dd" },
|
|
265
|
+
hu: { year: "éééé", month: "hh", day: "nn" },
|
|
266
|
+
ia: { year: "aaaa", month: "mm", day: "dd" },
|
|
267
|
+
id: { year: "tttt", month: "bb", day: "hh" },
|
|
268
|
+
it: { year: "aaaa", month: "mm", day: "gg" },
|
|
269
|
+
ja: { year: " 年 ", month: "月", day: "日" },
|
|
270
|
+
ka: { year: "წწწწ", month: "თთ", day: "რრ" },
|
|
271
|
+
kk: { year: "жжжж", month: "аа", day: "кк" },
|
|
272
|
+
kn: { year: "ವವವವ", month: "ಮಿಮೀ", day: "ದಿದಿ" },
|
|
273
|
+
ko: { year: "연도", month: "월", day: "일" },
|
|
274
|
+
lb: { year: "jjjj", month: "mm", day: "dd" },
|
|
275
|
+
lo: { year: "ປປປປ", month: "ດດ", day: "ວວ" },
|
|
276
|
+
lt: { year: "mmmm", month: "mm", day: "dd" },
|
|
277
|
+
lv: { year: "gggg", month: "mm", day: "dd" },
|
|
278
|
+
meh: { year: "aaaa", month: "mm", day: "dd" },
|
|
279
|
+
ml: { year: "വർഷം", month: "മാസം", day: "തീയതി" },
|
|
280
|
+
ms: { year: "tttt", month: "mm", day: "hh" },
|
|
281
|
+
nl: { year: "jjjj", month: "mm", day: "dd" },
|
|
282
|
+
nn: { year: "åååå", month: "mm", day: "dd" },
|
|
283
|
+
no: { year: "åååå", month: "mm", day: "dd" },
|
|
284
|
+
oc: { year: "aaaa", month: "mm", day: "jj" },
|
|
285
|
+
pl: { year: "rrrr", month: "mm", day: "dd" },
|
|
286
|
+
pt: { year: "aaaa", month: "mm", day: "dd" },
|
|
287
|
+
rm: { year: "oooo", month: "mm", day: "dd" },
|
|
288
|
+
ro: { year: "aaaa", month: "ll", day: "zz" },
|
|
289
|
+
ru: { year: "гггг", month: "мм", day: "дд" },
|
|
290
|
+
sc: { year: "aaaa", month: "mm", day: "dd" },
|
|
291
|
+
scn: { year: "aaaa", month: "mm", day: "jj" },
|
|
292
|
+
sk: { year: "rrrr", month: "mm", day: "dd" },
|
|
293
|
+
sl: { year: "llll", month: "mm", day: "dd" },
|
|
294
|
+
sr: { year: "гггг", month: "мм", day: "дд" },
|
|
295
|
+
sv: { year: "åååå", month: "mm", day: "dd" },
|
|
296
|
+
szl: { year: "rrrr", month: "mm", day: "dd" },
|
|
297
|
+
tg: { year: "сссс", month: "мм", day: "рр" },
|
|
298
|
+
th: { year: "ปปปป", month: "ดด", day: "วว" },
|
|
299
|
+
tr: { year: "yyyy", month: "aa", day: "gg" },
|
|
300
|
+
uk: { year: "рррр", month: "мм", day: "дд" },
|
|
301
|
+
"zh-CN": { year: "年", month: "月", day: "日" },
|
|
302
|
+
"zh-TW": { year: "年", month: "月", day: "日" }
|
|
303
|
+
};
|
|
304
|
+
function Pe(e) {
|
|
305
|
+
if (G(e))
|
|
306
|
+
return Z[e];
|
|
307
|
+
{
|
|
308
|
+
const t = xe(e);
|
|
309
|
+
return G(t) ? Z[t] : Z.en;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function z(e, t, n) {
|
|
313
|
+
return Ae(e) ? Pe(n)[e] : je(e) ? t : Ee(e) ? "––" : "";
|
|
314
|
+
}
|
|
315
|
+
function G(e) {
|
|
316
|
+
return Te.includes(e);
|
|
317
|
+
}
|
|
318
|
+
function Ae(e) {
|
|
319
|
+
return De.includes(e);
|
|
320
|
+
}
|
|
321
|
+
function Ee(e) {
|
|
322
|
+
return e === "hour" || e === "minute" || e === "second";
|
|
323
|
+
}
|
|
324
|
+
function je(e) {
|
|
325
|
+
return e === "era" || e === "dayPeriod";
|
|
326
|
+
}
|
|
327
|
+
function xe(e) {
|
|
328
|
+
return Intl.Locale ? new Intl.Locale(e).language : e.split("-")[0];
|
|
329
|
+
}
|
|
330
|
+
const ue = ["day", "month", "year"], Le = ["hour", "minute", "second", "dayPeriod"], Ce = ["literal", "timeZoneName"], R = [
|
|
331
|
+
...ue,
|
|
332
|
+
...Le
|
|
333
|
+
], Me = [
|
|
334
|
+
...R,
|
|
335
|
+
...Ce
|
|
336
|
+
], Ne = typeof document < "u";
|
|
337
|
+
function Fe(e) {
|
|
338
|
+
return e instanceof HTMLElement;
|
|
339
|
+
}
|
|
340
|
+
function j(e) {
|
|
341
|
+
return e === null;
|
|
342
|
+
}
|
|
343
|
+
function U(e, t) {
|
|
344
|
+
const n = t.indexOf(e);
|
|
345
|
+
if (n === t.length - 1 || n === -1) return null;
|
|
346
|
+
const r = n + 1;
|
|
347
|
+
return t[r];
|
|
348
|
+
}
|
|
349
|
+
function Ie(e, t) {
|
|
350
|
+
const n = t.indexOf(e);
|
|
351
|
+
if (n === 0 || n === -1) return null;
|
|
352
|
+
const r = n - 1;
|
|
353
|
+
return t[r];
|
|
354
|
+
}
|
|
355
|
+
function se(e) {
|
|
356
|
+
return e ? Array.from(e.querySelectorAll("[data-segment]")).filter(
|
|
357
|
+
(n) => {
|
|
358
|
+
if (!Fe(n)) return !1;
|
|
359
|
+
const r = n.dataset.segment;
|
|
360
|
+
return r === "trigger" ? !0 : !(!ze(r) || r === "literal");
|
|
361
|
+
}
|
|
362
|
+
) : [];
|
|
363
|
+
}
|
|
364
|
+
let H = 0;
|
|
365
|
+
function tt(e = "mx") {
|
|
366
|
+
return H += 1, `${e}-${H.toString(36)}`;
|
|
367
|
+
}
|
|
368
|
+
function ce(e) {
|
|
369
|
+
const t = ["hour", "minute", "second"], n = R.map((r) => r === "dayPeriod" ? [r, "AM"] : [r, null]).filter(([r]) => r === "literal" || r === null ? !1 : !t.includes(r));
|
|
370
|
+
return Object.fromEntries(n);
|
|
371
|
+
}
|
|
372
|
+
function Oe(e) {
|
|
373
|
+
const { segmentValues: t, formatter: n, locale: r, dateRef: c } = e, l = Object.keys(t).reduce((o, a) => {
|
|
374
|
+
if (!le(a)) return o;
|
|
375
|
+
if ("hour" in t && a === "dayPeriod") {
|
|
376
|
+
const i = t[a];
|
|
377
|
+
j(i) ? o[a] = z(a, "AM", r) : o[a] = i;
|
|
378
|
+
} else
|
|
379
|
+
o[a] = s(a);
|
|
380
|
+
return o;
|
|
381
|
+
}, {});
|
|
382
|
+
function s(o) {
|
|
383
|
+
if ("hour" in t) {
|
|
384
|
+
const a = t[o], i = typeof a == "string" && a?.startsWith("0"), f = a !== null ? Number.parseInt(a) : null;
|
|
385
|
+
if (a === "0" && o !== "year")
|
|
386
|
+
return "0";
|
|
387
|
+
if (!j(a) && !j(f)) {
|
|
388
|
+
const d = n.part(c.set({ [o]: a }), o, {
|
|
389
|
+
hourCycle: e.hourCycle === 24 ? "h23" : void 0
|
|
390
|
+
}), y = e.hourCycle === 12 || e.hourCycle === void 0 && Be(r) === 12;
|
|
391
|
+
if (o === "hour" && y) {
|
|
392
|
+
if (f > 12) {
|
|
393
|
+
const h = f - 12;
|
|
394
|
+
return h === 0 ? "12" : h < 10 ? `0${h}` : `${h}`;
|
|
395
|
+
}
|
|
396
|
+
return f === 0 ? "12" : f < 10 ? `0${f}` : `${f}`;
|
|
397
|
+
}
|
|
398
|
+
return o === "year" ? `${a}` : i && d.length === 1 ? `0${d}` : d;
|
|
399
|
+
} else
|
|
400
|
+
return z(o, "", r);
|
|
401
|
+
} else {
|
|
402
|
+
if (_(o)) {
|
|
403
|
+
const a = t[o], i = typeof a == "string" && a?.startsWith("0");
|
|
404
|
+
if (a === "0")
|
|
405
|
+
return "0";
|
|
406
|
+
if (j(a))
|
|
407
|
+
return z(o, "", r);
|
|
408
|
+
{
|
|
409
|
+
const f = n.part(c.set({ [o]: a }), o);
|
|
410
|
+
return o === "year" ? `${a}` : i && f.length === 1 ? `0${f}` : f;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return "";
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return l;
|
|
417
|
+
}
|
|
418
|
+
function Re(e) {
|
|
419
|
+
const { granularity: t, dateRef: n, formatter: r, contentObj: c, hideTimeZone: l, hourCycle: s } = e;
|
|
420
|
+
return r.toParts(n, Ze(t, s)).map((i) => ["literal", "dayPeriod", "timeZoneName", null].includes(i.type) || !le(i.type) ? {
|
|
421
|
+
part: i.type,
|
|
422
|
+
value: i.value
|
|
423
|
+
} : {
|
|
424
|
+
part: i.type,
|
|
425
|
+
value: c[i.type]
|
|
426
|
+
}).filter((i) => !(j(i.part) || j(i.value) || i.part === "timeZoneName" && (!O(n) || l)));
|
|
427
|
+
}
|
|
428
|
+
function _e(e) {
|
|
429
|
+
const t = Oe(e), n = Re({
|
|
430
|
+
contentObj: t,
|
|
431
|
+
...e
|
|
432
|
+
});
|
|
433
|
+
return {
|
|
434
|
+
obj: t,
|
|
435
|
+
arr: n
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function Ze(e, t) {
|
|
439
|
+
const n = {
|
|
440
|
+
year: "numeric",
|
|
441
|
+
month: "2-digit",
|
|
442
|
+
day: "2-digit",
|
|
443
|
+
hour: "2-digit",
|
|
444
|
+
minute: "2-digit",
|
|
445
|
+
second: "2-digit",
|
|
446
|
+
timeZoneName: "short",
|
|
447
|
+
hourCycle: t === 24 ? "h23" : void 0,
|
|
448
|
+
hour12: t === 24 ? !1 : void 0
|
|
449
|
+
};
|
|
450
|
+
return e === "day" && (delete n.second, delete n.hour, delete n.minute, delete n.timeZoneName), e === "hour" && delete n.minute, e === "minute" && delete n.second, n;
|
|
451
|
+
}
|
|
452
|
+
function _(e) {
|
|
453
|
+
return ue.includes(e);
|
|
454
|
+
}
|
|
455
|
+
function le(e) {
|
|
456
|
+
return R.includes(e);
|
|
457
|
+
}
|
|
458
|
+
function ze(e) {
|
|
459
|
+
return Me.includes(e);
|
|
460
|
+
}
|
|
461
|
+
function de(e) {
|
|
462
|
+
return !Ne || !e ? [] : se(e).map((n) => n.dataset.segment).filter((n) => R.includes(n));
|
|
463
|
+
}
|
|
464
|
+
function W(e) {
|
|
465
|
+
const { segmentObj: t, fieldNode: n, dateRef: r } = e, c = de(n);
|
|
466
|
+
let l = r;
|
|
467
|
+
for (const s of c)
|
|
468
|
+
if ("hour" in t) {
|
|
469
|
+
const o = t[s];
|
|
470
|
+
if (j(o)) continue;
|
|
471
|
+
l = l.set({ [s]: t[s] });
|
|
472
|
+
} else if (_(s)) {
|
|
473
|
+
const o = t[s];
|
|
474
|
+
if (j(o)) continue;
|
|
475
|
+
l = l.set({ [s]: t[s] });
|
|
476
|
+
}
|
|
477
|
+
return l;
|
|
478
|
+
}
|
|
479
|
+
function q(e, t) {
|
|
480
|
+
const n = de(t);
|
|
481
|
+
for (const r of n)
|
|
482
|
+
if ("hour" in e) {
|
|
483
|
+
if (e[r] === null)
|
|
484
|
+
return !1;
|
|
485
|
+
} else if (_(r) && e[r] === null)
|
|
486
|
+
return !1;
|
|
487
|
+
return !0;
|
|
488
|
+
}
|
|
489
|
+
function Be(e) {
|
|
490
|
+
return new Intl.DateTimeFormat(e, { hour: "numeric" }).formatToParts(/* @__PURE__ */ new Date("2023-01-01T13:00:00")).find((c) => c.type === "hour")?.value === "1" ? 12 : 24;
|
|
491
|
+
}
|
|
492
|
+
const me = 2024;
|
|
493
|
+
function X(e) {
|
|
494
|
+
return {
|
|
495
|
+
...ce(),
|
|
496
|
+
day: String(e.day),
|
|
497
|
+
month: String(e.month),
|
|
498
|
+
year: String(e.year)
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function $e(e) {
|
|
502
|
+
return we(
|
|
503
|
+
new oe(Number(e.year) || me, Number(e.month) || 1, 1)
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
function J(e, t) {
|
|
507
|
+
return e === "month" ? 12 : e === "year" ? 9999 : $e(t);
|
|
508
|
+
}
|
|
509
|
+
function nt(e = {}) {
|
|
510
|
+
const { value: t, defaultValue: n, onChange: r, locale: c = "en" } = e, l = t !== void 0, s = I(null), [o, a] = N(
|
|
511
|
+
() => n !== void 0 ? X(n) : ce()
|
|
512
|
+
), i = D(
|
|
513
|
+
() => t !== void 0 ? X(t) : o,
|
|
514
|
+
[t, o]
|
|
515
|
+
), f = D(() => ie({ locale: c }), [c]), d = D(() => new oe(me, 1, 1), []), y = D(
|
|
516
|
+
() => _e({
|
|
517
|
+
segmentValues: i,
|
|
518
|
+
formatter: f,
|
|
519
|
+
locale: c,
|
|
520
|
+
dateRef: d,
|
|
521
|
+
granularity: "day",
|
|
522
|
+
hideTimeZone: !1,
|
|
523
|
+
hourCycle: void 0
|
|
524
|
+
}),
|
|
525
|
+
[i, f, c, d]
|
|
526
|
+
), h = F(
|
|
527
|
+
(u) => (m) => {
|
|
528
|
+
const g = s.current, k = se(g), v = i[u], A = u === "year" ? 4 : 2, x = J(u, i), L = (E) => {
|
|
529
|
+
const p = { ...i, [u]: E };
|
|
530
|
+
l || a(p), g && q(p, g) ? r?.(W({ segmentObj: p, fieldNode: g, dateRef: d })) : r?.(void 0);
|
|
531
|
+
};
|
|
532
|
+
if (/^[0-9]$/.test(m.key)) {
|
|
533
|
+
m.preventDefault();
|
|
534
|
+
let p = (v && v.length < A ? v : "") + m.key;
|
|
535
|
+
Number(p) > x && (p = m.key);
|
|
536
|
+
const $ = p.length >= A || Number(p) * 10 > x, ye = $ && p.length < A ? p.padStart(A, "0") : p;
|
|
537
|
+
L(ye), $ && U(m.currentTarget, k)?.focus();
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (m.key === "ArrowUp" || m.key === "ArrowDown") {
|
|
541
|
+
m.preventDefault();
|
|
542
|
+
const E = m.key === "ArrowUp" ? 1 : -1;
|
|
543
|
+
let p = Number(v);
|
|
544
|
+
!v || Number.isNaN(p) ? p = E > 0 ? 1 : x : (p += E, p > x && (p = 1), p < 1 && (p = x)), L(u === "year" ? String(p) : String(p).padStart(2, "0"));
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (m.key === "ArrowLeft") {
|
|
548
|
+
m.preventDefault(), Ie(m.currentTarget, k)?.focus();
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (m.key === "ArrowRight") {
|
|
552
|
+
m.preventDefault(), U(m.currentTarget, k)?.focus();
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (m.key === "Backspace")
|
|
556
|
+
if (m.preventDefault(), !v)
|
|
557
|
+
L(null);
|
|
558
|
+
else {
|
|
559
|
+
const E = v.slice(0, -1);
|
|
560
|
+
L(E.length ? E : null);
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
[i, l, r, d]
|
|
564
|
+
), w = F(
|
|
565
|
+
(u) => _(u) ? {
|
|
566
|
+
"data-segment": u,
|
|
567
|
+
role: "spinbutton",
|
|
568
|
+
inputMode: "numeric",
|
|
569
|
+
tabIndex: 0,
|
|
570
|
+
"aria-label": u,
|
|
571
|
+
"aria-valuenow": Number(i[u]) || void 0,
|
|
572
|
+
"aria-valuemin": 1,
|
|
573
|
+
"aria-valuemax": J(u, i),
|
|
574
|
+
onKeyDown: h(u)
|
|
575
|
+
} : { "data-segment": u },
|
|
576
|
+
[i, h]
|
|
577
|
+
), b = D(
|
|
578
|
+
() => y.arr.map((u) => ({ part: u.part, value: u.value })),
|
|
579
|
+
[y]
|
|
580
|
+
), T = D(() => {
|
|
581
|
+
if (t !== void 0) return t;
|
|
582
|
+
const u = s.current;
|
|
583
|
+
if (u && q(i, u))
|
|
584
|
+
return W({ segmentObj: i, fieldNode: u, dateRef: d });
|
|
585
|
+
}, [t, i, d]);
|
|
586
|
+
return {
|
|
587
|
+
segments: b,
|
|
588
|
+
fieldProps: { ref: s, role: "group" },
|
|
589
|
+
segmentProps: w,
|
|
590
|
+
value: T
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
const Ve = 42;
|
|
594
|
+
function rt(e = {}) {
|
|
595
|
+
const { value: t, defaultValue: n, onChange: r, locale: c = "en", firstDayOfWeek: l = 0 } = e, s = t !== void 0, [o, a] = N(n), i = s ? t : o, [f, d] = N(
|
|
596
|
+
() => (t ?? n ?? V(B())).set({ day: 1 })
|
|
597
|
+
), y = D(() => ie({ locale: c }), [c]), h = D(() => V(B()), []), w = D(
|
|
598
|
+
() => y.fullMonthAndYear(P(f)),
|
|
599
|
+
[y, f]
|
|
600
|
+
), b = D(
|
|
601
|
+
() => ke(f.set({ day: 1 }), l, c),
|
|
602
|
+
[f, l, c]
|
|
603
|
+
), T = D(
|
|
604
|
+
() => Array.from(
|
|
605
|
+
{ length: 7 },
|
|
606
|
+
(g, k) => y.dayOfWeek(P(b.add({ days: k })), "short")
|
|
607
|
+
),
|
|
608
|
+
[y, b]
|
|
609
|
+
), u = F(
|
|
610
|
+
(g) => {
|
|
611
|
+
s || a(g), r?.(g);
|
|
612
|
+
},
|
|
613
|
+
[s, r]
|
|
614
|
+
), m = D(
|
|
615
|
+
() => Array.from({ length: Ve }, (g, k) => {
|
|
616
|
+
const v = b.add({ days: k }), A = i != null && K(v, i);
|
|
617
|
+
return {
|
|
618
|
+
date: v,
|
|
619
|
+
label: String(v.day),
|
|
620
|
+
isSelected: A,
|
|
621
|
+
isToday: K(v, h),
|
|
622
|
+
isOutsideMonth: v.month !== f.month,
|
|
623
|
+
cellProps: {
|
|
624
|
+
role: "gridcell",
|
|
625
|
+
"aria-selected": A,
|
|
626
|
+
"aria-label": y.selectedDate(v, !1),
|
|
627
|
+
tabIndex: A ? 0 : -1,
|
|
628
|
+
onClick: () => u(v)
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
}),
|
|
632
|
+
[b, i, h, f, y, u]
|
|
633
|
+
);
|
|
634
|
+
return {
|
|
635
|
+
monthLabel: w,
|
|
636
|
+
weekdays: T,
|
|
637
|
+
cells: m,
|
|
638
|
+
gridProps: { role: "grid", "aria-label": w },
|
|
639
|
+
selected: i,
|
|
640
|
+
prevButtonProps: {
|
|
641
|
+
onClick: () => d((g) => g.subtract({ months: 1 })),
|
|
642
|
+
"aria-label": "Previous month"
|
|
643
|
+
},
|
|
644
|
+
nextButtonProps: {
|
|
645
|
+
onClick: () => d((g) => g.add({ months: 1 })),
|
|
646
|
+
"aria-label": "Next month"
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
function Ke({
|
|
651
|
+
forceMount: e,
|
|
652
|
+
open: t
|
|
653
|
+
}) {
|
|
654
|
+
return t;
|
|
655
|
+
}
|
|
656
|
+
const Ye = [
|
|
657
|
+
"a[href]",
|
|
658
|
+
"button:not([disabled])",
|
|
659
|
+
"input:not([disabled])",
|
|
660
|
+
"textarea:not([disabled])",
|
|
661
|
+
"select:not([disabled])",
|
|
662
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
663
|
+
].join(",");
|
|
664
|
+
function Ge(e) {
|
|
665
|
+
return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
|
|
666
|
+
}
|
|
667
|
+
function Q(e) {
|
|
668
|
+
return Array.from(e.querySelectorAll(Ye)).filter((n) => Ge(n) && n.getAttribute("aria-hidden") !== "true");
|
|
669
|
+
}
|
|
670
|
+
function ee(e) {
|
|
671
|
+
return e ? "current" in e ? e.current : e : null;
|
|
672
|
+
}
|
|
673
|
+
function ot(e, { active: t, returnFocusTo: n, initialFocus: r, forceMount: c = !1 }) {
|
|
674
|
+
const l = I(null);
|
|
675
|
+
te(() => {
|
|
676
|
+
const s = Ke({ forceMount: c, open: t }), o = e.current;
|
|
677
|
+
if (!s || !o) return;
|
|
678
|
+
l.current = document.activeElement ?? null;
|
|
679
|
+
const a = ee(r), i = Q(o).at(0) ?? null;
|
|
680
|
+
(a ?? i ?? o).focus?.();
|
|
681
|
+
const f = (d) => {
|
|
682
|
+
if (d.key !== "Tab") return;
|
|
683
|
+
const y = Q(o);
|
|
684
|
+
if (y.length === 0) {
|
|
685
|
+
d.preventDefault(), o.focus?.();
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const h = y[0], w = y[y.length - 1], b = document.activeElement;
|
|
689
|
+
if (!b || !o.contains(b)) {
|
|
690
|
+
d.preventDefault(), (d.shiftKey ? w : h)?.focus?.();
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
d.shiftKey && b === h ? (d.preventDefault(), w?.focus?.()) : !d.shiftKey && b === w && (d.preventDefault(), h?.focus?.());
|
|
694
|
+
};
|
|
695
|
+
return document.addEventListener("keydown", f, !0), () => {
|
|
696
|
+
document.removeEventListener("keydown", f, !0), (ee(n) ?? l.current)?.focus?.();
|
|
697
|
+
};
|
|
698
|
+
}, [t, c, e, n, r]);
|
|
699
|
+
}
|
|
700
|
+
function Ue(e, t) {
|
|
701
|
+
const { clientX: n, clientY: r } = e, c = t.getBoundingClientRect();
|
|
702
|
+
return n < c.left || n > c.right || r < c.top || r > c.bottom;
|
|
703
|
+
}
|
|
704
|
+
function at(e, t) {
|
|
705
|
+
const n = I(t);
|
|
706
|
+
n.current = t;
|
|
707
|
+
const r = t.enabled ?? !0;
|
|
708
|
+
te(() => {
|
|
709
|
+
if (!r) return;
|
|
710
|
+
const c = (s) => {
|
|
711
|
+
const o = n.current;
|
|
712
|
+
if (o.outsideClick === !1) return;
|
|
713
|
+
const a = e.current;
|
|
714
|
+
if (!a) return;
|
|
715
|
+
const i = s.target;
|
|
716
|
+
if (!(i && a.contains(i))) {
|
|
717
|
+
if (o.ignore)
|
|
718
|
+
for (const f of o.ignore) {
|
|
719
|
+
const d = f?.current;
|
|
720
|
+
if (d && i && d.contains(i)) return;
|
|
721
|
+
}
|
|
722
|
+
Ue(s, a) && o.onDismiss();
|
|
723
|
+
}
|
|
724
|
+
}, l = (s) => {
|
|
725
|
+
const o = n.current;
|
|
726
|
+
o.escapeKey !== !1 && s.key === "Escape" && o.onDismiss();
|
|
727
|
+
};
|
|
728
|
+
return document.addEventListener("pointerdown", c, !0), document.addEventListener("keydown", l, !0), () => {
|
|
729
|
+
document.removeEventListener("pointerdown", c, !0), document.removeEventListener("keydown", l, !0);
|
|
730
|
+
};
|
|
731
|
+
}, [r, e]);
|
|
732
|
+
}
|
|
733
|
+
function He(e, t) {
|
|
734
|
+
const n = e.indexOf("-"), r = n === -1 ? e : e.slice(0, n), c = n === -1 ? void 0 : e.slice(n + 1);
|
|
735
|
+
return { side: r, align: c ?? t ?? "center" };
|
|
736
|
+
}
|
|
737
|
+
function C(e, t, n, r) {
|
|
738
|
+
return r === "start" ? e : r === "end" ? t - n : e + (t - e - n) / 2;
|
|
739
|
+
}
|
|
740
|
+
function We(e, t, n, r) {
|
|
741
|
+
const { side: c, align: l } = He(r.placement ?? "bottom-start", r.align), s = r.gap ?? 8, o = r.padding ?? 8;
|
|
742
|
+
let a = 0, i = 0;
|
|
743
|
+
switch (c) {
|
|
744
|
+
case "top":
|
|
745
|
+
a = e.top - n - s, i = C(e.left, e.right, t, l);
|
|
746
|
+
break;
|
|
747
|
+
case "bottom":
|
|
748
|
+
a = e.bottom + s, i = C(e.left, e.right, t, l);
|
|
749
|
+
break;
|
|
750
|
+
case "left":
|
|
751
|
+
i = e.left - t - s, a = C(e.top, e.bottom, n, l);
|
|
752
|
+
break;
|
|
753
|
+
case "right":
|
|
754
|
+
i = e.right + s, a = C(e.top, e.bottom, n, l);
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
const f = Math.max(o, window.innerWidth - t - o), d = Math.max(o, window.innerHeight - n - o);
|
|
758
|
+
return {
|
|
759
|
+
top: Math.min(Math.max(o, a), d),
|
|
760
|
+
left: Math.min(Math.max(o, i), f)
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function it(e, t, n = {}) {
|
|
764
|
+
const r = I(n);
|
|
765
|
+
r.current = n;
|
|
766
|
+
const [c, l] = N({
|
|
767
|
+
position: "fixed",
|
|
768
|
+
top: 0,
|
|
769
|
+
left: 0,
|
|
770
|
+
visibility: "hidden"
|
|
771
|
+
}), s = F(() => {
|
|
772
|
+
const o = r.current;
|
|
773
|
+
if (o.open === !1) return;
|
|
774
|
+
const a = t.current;
|
|
775
|
+
if (!a) return;
|
|
776
|
+
const i = a.getBoundingClientRect(), f = o.width ?? i.width, d = i.height;
|
|
777
|
+
let y = null;
|
|
778
|
+
if (o.point)
|
|
779
|
+
y = { top: o.point.y, bottom: o.point.y, left: o.point.x, right: o.point.x };
|
|
780
|
+
else {
|
|
781
|
+
const b = e.current;
|
|
782
|
+
if (b) {
|
|
783
|
+
const T = b.getBoundingClientRect();
|
|
784
|
+
y = { top: T.top, bottom: T.bottom, left: T.left, right: T.right };
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
if (!y) return;
|
|
788
|
+
const { top: h, left: w } = We(y, f, d, o);
|
|
789
|
+
l({
|
|
790
|
+
position: "fixed",
|
|
791
|
+
top: h,
|
|
792
|
+
left: w,
|
|
793
|
+
visibility: "visible",
|
|
794
|
+
...o.width != null ? { width: o.width } : {}
|
|
795
|
+
});
|
|
796
|
+
}, [e, t]);
|
|
797
|
+
return he(() => {
|
|
798
|
+
if (n.open !== !1)
|
|
799
|
+
return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
800
|
+
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
801
|
+
};
|
|
802
|
+
}, [
|
|
803
|
+
n.open,
|
|
804
|
+
n.placement,
|
|
805
|
+
n.align,
|
|
806
|
+
n.width,
|
|
807
|
+
n.gap,
|
|
808
|
+
n.point?.x,
|
|
809
|
+
n.point?.y,
|
|
810
|
+
s
|
|
811
|
+
]), { style: c, update: s };
|
|
812
|
+
}
|
|
813
|
+
const qe = ["INPUT", "TEXTAREA"];
|
|
814
|
+
function ut(e, t, n, r) {
|
|
815
|
+
if (!t || r.enableIgnoredElement && qe.includes(t.nodeName))
|
|
816
|
+
return null;
|
|
817
|
+
const {
|
|
818
|
+
arrowKeyOptions: c = "both",
|
|
819
|
+
candidateSelector: l,
|
|
820
|
+
itemsArray: s = [],
|
|
821
|
+
loop: o = !0,
|
|
822
|
+
dir: a = "ltr",
|
|
823
|
+
preventScroll: i = !0,
|
|
824
|
+
focus: f = !1
|
|
825
|
+
} = r, [d, y, h, w, b, T] = [
|
|
826
|
+
e.key === "ArrowRight",
|
|
827
|
+
e.key === "ArrowLeft",
|
|
828
|
+
e.key === "ArrowUp",
|
|
829
|
+
e.key === "ArrowDown",
|
|
830
|
+
e.key === "Home",
|
|
831
|
+
e.key === "End"
|
|
832
|
+
], u = h || w, m = d || y;
|
|
833
|
+
if (!b && !T && (!u && !m || c === "vertical" && m || c === "horizontal" && u))
|
|
834
|
+
return null;
|
|
835
|
+
const g = n ? Array.from(n.querySelectorAll(l)) : s;
|
|
836
|
+
if (!g.length) return null;
|
|
837
|
+
i && e.preventDefault();
|
|
838
|
+
let k = null;
|
|
839
|
+
return m || u ? k = fe(g, t, {
|
|
840
|
+
goForward: u ? w : a === "ltr" ? d : y,
|
|
841
|
+
loop: o
|
|
842
|
+
}) : b ? k = g.at(0) || null : T && (k = g.at(-1) || null), f && k?.focus(), k;
|
|
843
|
+
}
|
|
844
|
+
function fe(e, t, { goForward: n, loop: r }, c = e.length) {
|
|
845
|
+
if (--c === 0) return null;
|
|
846
|
+
const l = e.indexOf(t), s = n ? l + 1 : l - 1;
|
|
847
|
+
if (!r && (s < 0 || s >= e.length)) return null;
|
|
848
|
+
const o = (s + e.length) % e.length, a = e[o];
|
|
849
|
+
return a ? a.hasAttribute("disabled") && a.getAttribute("disabled") !== "false" ? fe(e, a, { goForward: n, loop: r }, c) : a : null;
|
|
850
|
+
}
|
|
851
|
+
export {
|
|
852
|
+
lt as CalendarDate,
|
|
853
|
+
ie as createFormatter,
|
|
854
|
+
et as createTimeFormatter,
|
|
855
|
+
Qe as cx,
|
|
856
|
+
dt as parseDate,
|
|
857
|
+
it as useAnchoredPosition,
|
|
858
|
+
ut as useArrowNavigation,
|
|
859
|
+
rt as useCalendar,
|
|
860
|
+
nt as useDateField,
|
|
861
|
+
at as useDismiss,
|
|
862
|
+
ot as useFocusTrap,
|
|
863
|
+
tt as useId
|
|
864
|
+
};
|
|
865
|
+
//# sourceMappingURL=mercury-core.js.map
|