@utk09/finra-ui 0.0.4 → 0.0.6

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.
Files changed (58) hide show
  1. package/dist/Calendar-EtS0i3_l.js +664 -0
  2. package/dist/Calendar-EtS0i3_l.js.map +1 -0
  3. package/dist/Calendar.module-D02DGwqf.js +374 -0
  4. package/dist/Calendar.module-D02DGwqf.js.map +1 -0
  5. package/dist/DateInput-DhLq-Jah.js +230 -0
  6. package/dist/DateInput-DhLq-Jah.js.map +1 -0
  7. package/dist/assets/icons/CalendarIcon.d.ts +2 -0
  8. package/dist/assets/icons/CheckIcon.d.ts +2 -0
  9. package/dist/assets/icons/ChevronDownIcon.d.ts +2 -0
  10. package/dist/assets/icons/ChevronLeftIcon.d.ts +2 -0
  11. package/dist/assets/icons/ChevronRightIcon.d.ts +2 -0
  12. package/dist/assets/icons/CloseIcon.d.ts +2 -0
  13. package/dist/assets/icons/CloseSmallIcon.d.ts +2 -0
  14. package/dist/assets/icons/DashIcon.d.ts +2 -0
  15. package/dist/assets/icons/MinusIcon.d.ts +2 -0
  16. package/dist/assets/icons/PlusIcon.d.ts +2 -0
  17. package/dist/assets/icons/SpinnerIcon.d.ts +2 -0
  18. package/dist/assets/icons/UploadIcon.d.ts +2 -0
  19. package/dist/assets/icons/index.d.ts +12 -0
  20. package/dist/components/Badge/Badge.d.ts +1 -1
  21. package/dist/components/Button/Button.d.ts +1 -1
  22. package/dist/components/ComboBox/ComboBox.d.ts +36 -0
  23. package/dist/components/DateInput/DateInput.d.ts +16 -0
  24. package/dist/components/DateTenorInput/DateTenorInput.d.ts +16 -0
  25. package/dist/components/FormField/FormField.d.ts +1 -1
  26. package/dist/components/Input/Input.d.ts +1 -1
  27. package/dist/components/NumberInput/NumberInput.d.ts +1 -1
  28. package/dist/components/TenorInput/TenorInput.d.ts +14 -0
  29. package/dist/components/Textarea/Textarea.d.ts +1 -1
  30. package/dist/components/componentIds.d.ts +15 -0
  31. package/dist/dateFormat-CGZCSpqw.js +77 -0
  32. package/dist/dateFormat-CGZCSpqw.js.map +1 -0
  33. package/dist/finance.d.ts +8 -0
  34. package/dist/finance.js +486 -0
  35. package/dist/finance.js.map +1 -0
  36. package/dist/index.d.ts +20 -16
  37. package/dist/index.js +821 -805
  38. package/dist/index.js.map +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/unstyled/Calendar/Calendar.d.ts +54 -0
  41. package/dist/unstyled/ComboBox/ComboBox.d.ts +108 -0
  42. package/dist/unstyled/DateInput/DateInput.d.ts +58 -0
  43. package/dist/unstyled/DateTenorInput/DateTenorInput.d.ts +78 -0
  44. package/dist/unstyled/FormField/FormField.d.ts +1 -1
  45. package/dist/unstyled/Slot.d.ts +1 -1
  46. package/dist/unstyled/TenorInput/TenorInput.d.ts +27 -0
  47. package/dist/unstyled.d.ts +24 -18
  48. package/dist/unstyled.js +146 -153
  49. package/dist/unstyled.js.map +1 -1
  50. package/dist/utils/dateFormat.d.ts +17 -0
  51. package/dist/utils/mergeRefs.d.ts +2 -0
  52. package/dist/utils/tenor.d.ts +15 -0
  53. package/dist/utils.d.ts +5 -0
  54. package/dist/utils.js +98 -0
  55. package/dist/utils.js.map +1 -0
  56. package/package.json +11 -1
  57. package/dist/Slider-BXQjDfhb.js +0 -73
  58. package/dist/Slider-BXQjDfhb.js.map +0 -1
@@ -0,0 +1,664 @@
1
+ import { jsx as c, jsxs as w, Fragment as we } from "react/jsx-runtime";
2
+ import { forwardRef as Ie, useId as We, useRef as se, useState as ee, useCallback as M, useMemo as H, useEffect as te } from "react";
3
+ import { m as Me } from "./dateFormat-CGZCSpqw.js";
4
+ function Ke(a, r) {
5
+ return r ? a.label.toLowerCase().includes(r.toLowerCase()) : !0;
6
+ }
7
+ function Se(a) {
8
+ const r = [], p = /* @__PURE__ */ new Map(), d = [];
9
+ for (const h of a)
10
+ if (h.favourite && r.push(h), h.group) {
11
+ const S = p.get(h.group) ?? [];
12
+ S.push(h), p.set(h.group, S);
13
+ } else
14
+ d.push(h);
15
+ const I = [];
16
+ for (const [h, S] of p)
17
+ I.push({ label: h, options: S });
18
+ return { favourites: r, groups: I, ungrouped: d };
19
+ }
20
+ function be(...a) {
21
+ return a.filter(Boolean).join(" ") || void 0;
22
+ }
23
+ function Pe({
24
+ options: a,
25
+ value: r,
26
+ onChange: p,
27
+ multiple: d = !1,
28
+ inputValue: I,
29
+ onInputChange: h,
30
+ filterFn: S,
31
+ loading: T = !1,
32
+ onLoadOptions: f,
33
+ creatable: U = !1,
34
+ onCreateOption: A,
35
+ formatCreateLabel: $,
36
+ header: L,
37
+ footer: W,
38
+ placeholder: C,
39
+ disabled: m = !1,
40
+ noOptionsMessage: F = "No options",
41
+ renderOption: O,
42
+ renderValue: v,
43
+ renderCheckIcon: g,
44
+ renderIndicator: y,
45
+ renderPillRemoveIcon: K,
46
+ renderLoading: P,
47
+ open: Y,
48
+ onOpenChange: D,
49
+ classNames: t,
50
+ dataAttributes: V,
51
+ "aria-label": z,
52
+ "aria-labelledby": ie,
53
+ ...le
54
+ }, ae) {
55
+ const s = We(), i = `${s}-listbox`, o = se(null), Q = se(null), j = se(null), [ue, Ee] = ee(""), [Ae, Ce] = ee(!1), [k, E] = ee(-1), u = Y ?? Ae, b = I ?? ue, N = M(
56
+ (e) => {
57
+ Y === void 0 && Ce(e), D?.(e);
58
+ },
59
+ [Y, D]
60
+ ), B = M(
61
+ (e) => {
62
+ I === void 0 && Ee(e), h?.(e);
63
+ },
64
+ [I, h]
65
+ ), x = H(() => r == null ? [] : Array.isArray(r) ? r : [r], [r]), ce = M(
66
+ (e) => x.some((n) => n === e),
67
+ [x]
68
+ ), ve = S ?? Ke, ne = H(
69
+ () => a.filter((e) => ve(e, b)),
70
+ [a, ve, b]
71
+ ), X = H(() => {
72
+ const { favourites: e, groups: n, ungrouped: l } = Se(ne), R = [];
73
+ for (const G of e) R.push(G);
74
+ for (const G of n)
75
+ for (const xe of G.options)
76
+ xe.favourite || R.push(xe);
77
+ for (const G of l)
78
+ G.favourite || R.push(G);
79
+ return R;
80
+ }, [ne]), Z = U && b.trim() !== "" && !a.some((e) => e.label.toLowerCase() === b.trim().toLowerCase()), _e = $ ? $(b.trim()) : `Create "${b.trim()}"`, J = X.length + (Z ? 1 : 0), de = M(
81
+ (e) => {
82
+ if (!e.disabled) {
83
+ if (d) {
84
+ const n = ce(e.value) ? x.filter((l) => l !== e.value) : [...x, e.value];
85
+ p?.(n), B("");
86
+ } else
87
+ p?.(e.value), B(e.label), N(!1);
88
+ o.current?.focus();
89
+ }
90
+ },
91
+ [d, ce, x, p, B, N]
92
+ ), fe = M(
93
+ (e) => {
94
+ if (!d) return;
95
+ const n = x.filter((l) => l !== e);
96
+ p?.(n.length > 0 ? n : null), o.current?.focus();
97
+ },
98
+ [d, x, p]
99
+ ), $e = M(
100
+ (e) => {
101
+ if (!m)
102
+ switch (e.key) {
103
+ case "ArrowDown": {
104
+ e.preventDefault(), u ? E((n) => (n + 1) % J) : (N(!0), E(0));
105
+ break;
106
+ }
107
+ case "ArrowUp": {
108
+ e.preventDefault(), u ? E((n) => (n - 1 + J) % J) : (N(!0), E(J - 1));
109
+ break;
110
+ }
111
+ case "Enter": {
112
+ e.preventDefault(), u && k >= 0 ? k < X.length ? de(X[k]) : Z && (A?.(b.trim()), B("")) : u || N(!0);
113
+ break;
114
+ }
115
+ case "Escape": {
116
+ u && (e.preventDefault(), N(!1), E(-1));
117
+ break;
118
+ }
119
+ case "Backspace": {
120
+ d && b === "" && x.length > 0 && fe(x[x.length - 1]);
121
+ break;
122
+ }
123
+ case "Home": {
124
+ u && (e.preventDefault(), E(0));
125
+ break;
126
+ }
127
+ case "End": {
128
+ u && (e.preventDefault(), E(J - 1));
129
+ break;
130
+ }
131
+ }
132
+ },
133
+ [
134
+ m,
135
+ u,
136
+ N,
137
+ k,
138
+ J,
139
+ X,
140
+ de,
141
+ Z,
142
+ A,
143
+ b,
144
+ B,
145
+ d,
146
+ x,
147
+ fe
148
+ ]
149
+ ), Le = M(
150
+ (e) => {
151
+ const n = e.target.value;
152
+ B(n), u || N(!0), E(0), f?.(n);
153
+ },
154
+ [B, u, N, f]
155
+ ), Oe = M(() => {
156
+ !m && !u && N(!0);
157
+ }, [m, u, N]);
158
+ te(() => {
159
+ if (!u) return;
160
+ const e = (n) => {
161
+ j.current && !j.current.contains(n.target) && (N(!1), E(-1));
162
+ };
163
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
164
+ }, [u, N]), te(() => {
165
+ if (k < 0 || !Q.current) return;
166
+ const e = Q.current.querySelector(`[data-index="${k}"]`);
167
+ e && e.scrollIntoView?.({ block: "nearest" });
168
+ }, [k]);
169
+ const { favourites: pe, groups: De, ungrouped: Ye } = H(
170
+ () => Se(ne),
171
+ [ne]
172
+ ), he = (e) => `${s}-option-${e}`, re = (e, n) => {
173
+ const l = {
174
+ isSelected: ce(e.value),
175
+ isHighlighted: k === n,
176
+ isDisabled: e.disabled ?? !1,
177
+ isFavourite: e.favourite ?? !1
178
+ };
179
+ return /* @__PURE__ */ c(
180
+ "div",
181
+ {
182
+ id: he(n),
183
+ role: "option",
184
+ tabIndex: -1,
185
+ "data-index": n,
186
+ "aria-selected": l.isSelected,
187
+ "aria-disabled": l.isDisabled || void 0,
188
+ "data-highlighted": l.isHighlighted || void 0,
189
+ "data-selected": l.isSelected || void 0,
190
+ "data-disabled": l.isDisabled || void 0,
191
+ className: be(
192
+ t?.option,
193
+ l.isHighlighted && t?.optionHighlighted,
194
+ l.isSelected && t?.optionSelected,
195
+ l.isDisabled && t?.optionDisabled
196
+ ),
197
+ onMouseDown: (R) => {
198
+ R.preventDefault(), de(e);
199
+ },
200
+ onMouseEnter: () => E(n),
201
+ children: O ? O(e, l) : /* @__PURE__ */ w(we, { children: [
202
+ /* @__PURE__ */ c("span", { className: t?.optionLabel, children: e.label }),
203
+ l.isSelected && g ? g() : null
204
+ ] })
205
+ },
206
+ `${n}-${String(e.value)}`
207
+ );
208
+ }, Be = () => d ? x.map((e) => {
209
+ const n = a.find((l) => l.value === e);
210
+ return n ? /* @__PURE__ */ w("span", { className: t?.pill, "data-combobox-pill": !0, children: [
211
+ /* @__PURE__ */ c("span", { className: t?.pillText, children: v ? v(n) : n.label }),
212
+ m ? null : /* @__PURE__ */ c(
213
+ "button",
214
+ {
215
+ type: "button",
216
+ className: t?.pillRemove,
217
+ tabIndex: -1,
218
+ "aria-label": `Remove ${n.label}`,
219
+ onMouseDown: (l) => {
220
+ l.preventDefault(), l.stopPropagation(), fe(e);
221
+ },
222
+ children: K ? K() : "×"
223
+ }
224
+ )
225
+ ] }, String(e)) : null;
226
+ }) : null, Re = H(() => {
227
+ if (d || u) return b;
228
+ if (r != null && !v) {
229
+ const e = a.find((n) => n.value === r);
230
+ if (e) return e.label;
231
+ }
232
+ return b;
233
+ }, [d, u, b, r, a, v]), ye = H(() => {
234
+ if (d || u || r == null || !v) return null;
235
+ const e = a.find((n) => n.value === r);
236
+ return e ? /* @__PURE__ */ c("span", { className: t?.singleValue, children: v(e) }) : null;
237
+ }, [d, u, r, a, v, t?.singleValue]), q = [];
238
+ let _ = 0;
239
+ pe.length > 0 && q.push(
240
+ /* @__PURE__ */ w(
241
+ "div",
242
+ {
243
+ role: "group",
244
+ "aria-label": "Favourites",
245
+ className: t?.group,
246
+ "data-combobox-group": "favourites",
247
+ children: [
248
+ /* @__PURE__ */ c("div", { className: t?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: "Favourites" }),
249
+ pe.map((e) => {
250
+ const n = re(e, _);
251
+ return _++, n;
252
+ })
253
+ ]
254
+ },
255
+ "__fav-group"
256
+ )
257
+ );
258
+ for (const e of De) {
259
+ const n = e.options.filter((l) => !l.favourite);
260
+ n.length !== 0 && q.push(
261
+ /* @__PURE__ */ w(
262
+ "div",
263
+ {
264
+ role: "group",
265
+ "aria-label": e.label,
266
+ className: t?.group,
267
+ "data-combobox-group": e.label,
268
+ children: [
269
+ /* @__PURE__ */ c("div", { className: t?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: e.label }),
270
+ n.map((l) => {
271
+ const R = re(l, _);
272
+ return _++, R;
273
+ })
274
+ ]
275
+ },
276
+ `__group-${e.label}`
277
+ )
278
+ );
279
+ }
280
+ const ge = Ye.filter((e) => !e.favourite);
281
+ if (ge.length > 0)
282
+ if (pe.length > 0 || De.length > 0)
283
+ q.push(
284
+ /* @__PURE__ */ w(
285
+ "div",
286
+ {
287
+ role: "group",
288
+ "aria-label": "All",
289
+ className: t?.group,
290
+ "data-combobox-group": "all",
291
+ children: [
292
+ /* @__PURE__ */ c("div", { className: t?.groupLabel, "data-combobox-group-label": !0, "aria-hidden": "true", children: "All" }),
293
+ ge.map((e) => {
294
+ const n = re(e, _);
295
+ return _++, n;
296
+ })
297
+ ]
298
+ },
299
+ "__ungrouped"
300
+ )
301
+ );
302
+ else
303
+ for (const e of ge)
304
+ q.push(re(e, _)), _++;
305
+ if (Z) {
306
+ const e = _;
307
+ q.push(
308
+ /* @__PURE__ */ c(
309
+ "div",
310
+ {
311
+ id: he(e),
312
+ role: "option",
313
+ tabIndex: -1,
314
+ "data-index": e,
315
+ "aria-selected": !1,
316
+ "data-highlighted": k === e || void 0,
317
+ "data-combobox-create": !0,
318
+ className: be(
319
+ t?.option,
320
+ t?.optionCreate,
321
+ k === e && t?.optionHighlighted
322
+ ),
323
+ onMouseDown: (n) => {
324
+ n.preventDefault(), A?.(b.trim()), B("");
325
+ },
326
+ onMouseEnter: () => E(e),
327
+ children: _e
328
+ },
329
+ "__create"
330
+ )
331
+ );
332
+ }
333
+ const He = X.length > 0 || Z, Ne = {
334
+ type: "text",
335
+ role: "searchbox",
336
+ "aria-autocomplete": "list",
337
+ "aria-controls": u ? i : void 0,
338
+ "aria-activedescendant": u && k >= 0 ? he(k) : void 0,
339
+ "aria-label": z ?? C,
340
+ "aria-labelledby": ie,
341
+ onChange: Le,
342
+ onKeyDown: $e,
343
+ onFocus: Oe,
344
+ disabled: m
345
+ };
346
+ return /* @__PURE__ */ w("div", { ref: j, className: t?.root, ...V, ...le, children: [
347
+ /* @__PURE__ */ w(
348
+ "div",
349
+ {
350
+ role: "combobox",
351
+ "aria-expanded": u,
352
+ "aria-controls": u ? i : void 0,
353
+ "aria-haspopup": "listbox",
354
+ "aria-disabled": m || void 0,
355
+ className: t?.wrapper,
356
+ children: [
357
+ d ? /* @__PURE__ */ w("div", { className: t?.multiValueContainer, children: [
358
+ Be(),
359
+ /* @__PURE__ */ c(
360
+ "input",
361
+ {
362
+ ref: Me(ae, o),
363
+ className: t?.input,
364
+ ...Ne,
365
+ value: b,
366
+ placeholder: x.length === 0 ? C : void 0
367
+ }
368
+ )
369
+ ] }) : /* @__PURE__ */ w(we, { children: [
370
+ ye,
371
+ /* @__PURE__ */ c(
372
+ "input",
373
+ {
374
+ ref: Me(ae, o),
375
+ className: be(t?.input, ye ? t?.inputHidden : void 0),
376
+ ...Ne,
377
+ value: Re,
378
+ placeholder: C
379
+ }
380
+ )
381
+ ] }),
382
+ y ? y(u) : null
383
+ ]
384
+ }
385
+ ),
386
+ u ? /* @__PURE__ */ w("div", { className: t?.listbox, children: [
387
+ L ? /* @__PURE__ */ c("div", { className: t?.header, children: L }) : null,
388
+ /* @__PURE__ */ c(
389
+ "div",
390
+ {
391
+ ref: Q,
392
+ id: i,
393
+ role: "listbox",
394
+ "aria-multiselectable": d || void 0,
395
+ className: t?.options,
396
+ tabIndex: -1,
397
+ children: T ? /* @__PURE__ */ c("div", { role: "presentation", className: t?.loading, "aria-live": "polite", children: P ? P() : "Loading..." }) : He ? q : /* @__PURE__ */ c("div", { role: "presentation", className: t?.empty, "aria-live": "polite", children: F })
398
+ }
399
+ ),
400
+ W ? /* @__PURE__ */ c("div", { className: t?.footer, children: W }) : null
401
+ ] }) : null
402
+ ] });
403
+ }
404
+ const Ue = Ie(Pe);
405
+ Ue.displayName = "ComboBoxBase";
406
+ function me(a, r) {
407
+ return a.getFullYear() === r.getFullYear() && a.getMonth() === r.getMonth() && a.getDate() === r.getDate();
408
+ }
409
+ function oe(a) {
410
+ return new Date(a.getFullYear(), a.getMonth(), a.getDate());
411
+ }
412
+ const Te = [
413
+ "January",
414
+ "February",
415
+ "March",
416
+ "April",
417
+ "May",
418
+ "June",
419
+ "July",
420
+ "August",
421
+ "September",
422
+ "October",
423
+ "November",
424
+ "December"
425
+ ], Ve = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], je = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Je = [
426
+ "Monday",
427
+ "Tuesday",
428
+ "Wednesday",
429
+ "Thursday",
430
+ "Friday",
431
+ "Saturday",
432
+ "Sunday"
433
+ ], qe = [
434
+ "Sunday",
435
+ "Monday",
436
+ "Tuesday",
437
+ "Wednesday",
438
+ "Thursday",
439
+ "Friday",
440
+ "Saturday"
441
+ ];
442
+ function Ge(a, r) {
443
+ return (a.getDay() - r + 7) % 7;
444
+ }
445
+ function ze(a, r, p, d, I, h, S, T) {
446
+ const f = new Date(a, r, 1), U = Ge(f, p), A = new Date(a, r, 1 - U), $ = [], L = h ? oe(h) : null, W = S ? oe(S) : null, C = oe(I);
447
+ for (let m = 0; m < 42; m++) {
448
+ const F = new Date(A.getFullYear(), A.getMonth(), A.getDate() + m), O = oe(F), v = F.getMonth() === r && F.getFullYear() === a;
449
+ let g = !v;
450
+ v && (L && O < L && (g = !0), W && O > W && (g = !0), !g && T && (typeof T == "function" ? g = T(F) : g = T.some((y) => me(y, F)))), $.push({
451
+ date: F,
452
+ isCurrentMonth: v,
453
+ isToday: me(F, C),
454
+ isSelected: d != null && me(F, d),
455
+ isDisabled: g
456
+ });
457
+ }
458
+ return $;
459
+ }
460
+ function Fe(...a) {
461
+ return a.filter(Boolean).join(" ") || void 0;
462
+ }
463
+ function ke(a, r) {
464
+ return `${Te[r]} ${a}`;
465
+ }
466
+ function Qe(a) {
467
+ return `${Te[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
468
+ }
469
+ const Xe = Ie(
470
+ ({
471
+ value: a,
472
+ onSelect: r,
473
+ month: p,
474
+ onMonthChange: d,
475
+ min: I,
476
+ max: h,
477
+ disabledDates: S,
478
+ weekStartsOn: T = 1,
479
+ classNames: f,
480
+ renderNavPrev: U,
481
+ renderNavNext: A,
482
+ footer: $,
483
+ today: L
484
+ }, W) => {
485
+ const C = H(() => L ?? /* @__PURE__ */ new Date(), [L]), m = se(null), [F, O] = ee(() => p || (a ? new Date(a.getFullYear(), a.getMonth(), 1) : new Date(C.getFullYear(), C.getMonth(), 1))), v = p ?? F, g = v.getFullYear(), y = v.getMonth(), K = M(
486
+ (s) => {
487
+ p || O(s), d?.(s);
488
+ },
489
+ [p, d]
490
+ );
491
+ te(() => {
492
+ p && O(p);
493
+ }, [p]);
494
+ const P = M(() => {
495
+ K(new Date(g, y - 1, 1));
496
+ }, [g, y, K]), Y = M(() => {
497
+ K(new Date(g, y + 1, 1));
498
+ }, [g, y, K]), D = H(
499
+ () => ze(
500
+ g,
501
+ y,
502
+ T,
503
+ a,
504
+ C,
505
+ I,
506
+ h,
507
+ S
508
+ ),
509
+ [g, y, T, a, C, I, h, S]
510
+ ), [t, V] = ee(() => {
511
+ const s = D.findIndex((o) => o.isSelected && o.isCurrentMonth);
512
+ if (s >= 0) return s;
513
+ const i = D.findIndex((o) => o.isToday && o.isCurrentMonth);
514
+ return i >= 0 ? i : D.findIndex((o) => o.isCurrentMonth);
515
+ });
516
+ te(() => {
517
+ const s = D.findIndex((o) => o.isSelected && o.isCurrentMonth);
518
+ if (s >= 0) {
519
+ V(s);
520
+ return;
521
+ }
522
+ const i = D.findIndex((o) => o.isToday && o.isCurrentMonth);
523
+ if (i >= 0) {
524
+ V(i);
525
+ return;
526
+ }
527
+ V(D.findIndex((o) => o.isCurrentMonth));
528
+ }, [D]), te(() => {
529
+ const s = m.current;
530
+ if (!s) return;
531
+ const i = s.querySelector(`[data-day-index="${t}"]`);
532
+ i && s.contains(document.activeElement) && i.focus();
533
+ }, [t]);
534
+ const z = M(
535
+ (s) => {
536
+ s.isDisabled || r?.(s.date);
537
+ },
538
+ [r]
539
+ ), ie = M(
540
+ (s) => {
541
+ let i = t;
542
+ switch (s.key) {
543
+ case "ArrowRight":
544
+ s.preventDefault(), i = t + 1;
545
+ break;
546
+ case "ArrowLeft":
547
+ s.preventDefault(), i = t - 1;
548
+ break;
549
+ case "ArrowDown":
550
+ s.preventDefault(), i = t + 7;
551
+ break;
552
+ case "ArrowUp":
553
+ s.preventDefault(), i = t - 7;
554
+ break;
555
+ case "Enter":
556
+ case " ":
557
+ s.preventDefault(), t >= 0 && t < D.length && z(D[t]);
558
+ return;
559
+ case "PageDown":
560
+ s.preventDefault(), Y();
561
+ return;
562
+ case "PageUp":
563
+ s.preventDefault(), P();
564
+ return;
565
+ default:
566
+ return;
567
+ }
568
+ if (i < 0) {
569
+ P();
570
+ return;
571
+ }
572
+ if (i >= 42) {
573
+ Y();
574
+ return;
575
+ }
576
+ V(i);
577
+ },
578
+ [t, D, z, Y, P]
579
+ ), le = T === 1 ? Ve : je, ae = T === 1 ? Je : qe;
580
+ return /* @__PURE__ */ w("div", { ref: W, className: f?.root, children: [
581
+ /* @__PURE__ */ w("div", { className: f?.header, children: [
582
+ /* @__PURE__ */ c(
583
+ "button",
584
+ {
585
+ type: "button",
586
+ className: f?.navButton,
587
+ onClick: P,
588
+ "aria-label": "Previous month",
589
+ children: U ? U() : "◀"
590
+ }
591
+ ),
592
+ /* @__PURE__ */ c("div", { className: f?.title, "aria-live": "polite", children: ke(g, y) }),
593
+ /* @__PURE__ */ c(
594
+ "button",
595
+ {
596
+ type: "button",
597
+ className: f?.navButton,
598
+ onClick: Y,
599
+ "aria-label": "Next month",
600
+ children: A ? A() : "▶"
601
+ }
602
+ )
603
+ ] }),
604
+ /* @__PURE__ */ w(
605
+ "div",
606
+ {
607
+ ref: m,
608
+ className: f?.grid,
609
+ role: "grid",
610
+ tabIndex: -1,
611
+ "aria-label": ke(g, y),
612
+ onKeyDown: ie,
613
+ children: [
614
+ /* @__PURE__ */ c("div", { className: Fe(f?.weekdayRow, f?.row), role: "row", children: le.map((s, i) => /* @__PURE__ */ c(
615
+ "span",
616
+ {
617
+ className: f?.weekday,
618
+ role: "columnheader",
619
+ "aria-label": ae[i],
620
+ children: s
621
+ },
622
+ s
623
+ )) }),
624
+ Array.from({ length: 6 }, (s, i) => /* @__PURE__ */ c("div", { className: f?.row, role: "row", children: D.slice(i * 7, i * 7 + 7).map((o, Q) => {
625
+ const j = i * 7 + Q;
626
+ return /* @__PURE__ */ c(
627
+ "button",
628
+ {
629
+ type: "button",
630
+ role: "gridcell",
631
+ "data-day-index": j,
632
+ tabIndex: j === t ? 0 : -1,
633
+ "aria-label": Qe(o.date),
634
+ "aria-selected": o.isSelected || void 0,
635
+ "aria-disabled": o.isDisabled || void 0,
636
+ disabled: o.isDisabled,
637
+ className: Fe(
638
+ f?.day,
639
+ o.isToday && f?.dayToday,
640
+ o.isSelected && f?.daySelected,
641
+ o.isDisabled && f?.dayDisabled,
642
+ !o.isCurrentMonth && f?.dayOutside
643
+ ),
644
+ onMouseDown: (ue) => {
645
+ ue.preventDefault(), z(o);
646
+ },
647
+ children: o.date.getDate()
648
+ },
649
+ o.date.getTime()
650
+ );
651
+ }) }, i))
652
+ ]
653
+ }
654
+ ),
655
+ $ ? /* @__PURE__ */ c("div", { className: f?.footer, children: $ }) : null
656
+ ] });
657
+ }
658
+ );
659
+ Xe.displayName = "CalendarBase";
660
+ export {
661
+ Ue as C,
662
+ Xe as a
663
+ };
664
+ //# sourceMappingURL=Calendar-EtS0i3_l.js.map