@featherk/composables 0.6.5 → 0.6.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.
@@ -28,7 +28,7 @@ const We = (e) => {
28
28
  );
29
29
  if (p.length === 0) return;
30
30
  const A = p.findIndex(
31
- (C) => C === document.activeElement
31
+ (I) => I === document.activeElement
32
32
  );
33
33
  let S;
34
34
  A === -1 ? S = 0 : o.shiftKey ? S = (A - 1 + p.length) % p.length : S = (A + 1) % p.length, o.preventDefault(), o.stopPropagation(), p[S]?.focus();
@@ -63,14 +63,14 @@ const We = (e) => {
63
63
  y
64
64
  ), N(() => {
65
65
  const S = () => {
66
- const C = Array.from(
66
+ const I = Array.from(
67
67
  i.querySelectorAll(
68
68
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
69
69
  )
70
70
  );
71
- if (C.length === 1)
72
- C[0].focus(), C[0].click(), S.attempts = 0;
73
- else if (C.length > 1) {
71
+ if (I.length === 1)
72
+ I[0].focus(), I[0].click(), S.attempts = 0;
73
+ else if (I.length > 1) {
74
74
  S.attempts = 0;
75
75
  return;
76
76
  } else
@@ -148,15 +148,15 @@ const We = (e) => {
148
148
  if (l) {
149
149
  if (["ArrowDown", "ArrowUp"].includes(o.code)) {
150
150
  const i = (A, S) => {
151
- let C = S === "next" ? A.nextElementSibling : A.previousElementSibling;
152
- for (; C; ) {
153
- const G = C;
151
+ let I = S === "next" ? A.nextElementSibling : A.previousElementSibling;
152
+ for (; I; ) {
153
+ const G = I;
154
154
  try {
155
155
  if (G.hasAttribute && G.classList.contains("k-table-row"))
156
156
  return G;
157
157
  } catch {
158
158
  }
159
- C = S === "next" ? C.nextElementSibling : C.previousElementSibling;
159
+ I = S === "next" ? I.nextElementSibling : I.previousElementSibling;
160
160
  }
161
161
  return null;
162
162
  }, p = o.code === "ArrowDown" ? i(l, "next") : i(l, "previous");
@@ -226,7 +226,7 @@ const We = (e) => {
226
226
  } catch (o) {
227
227
  console.error("Error setting up row navigation:", o);
228
228
  }
229
- }, $ = () => {
229
+ }, C = () => {
230
230
  N(() => {
231
231
  const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
232
232
  m && m.forEach((l) => {
@@ -263,16 +263,16 @@ const We = (e) => {
263
263
  A[i].sortable === !1 ? "false" : "true"
264
264
  );
265
265
  }
266
- const S = l.dataset.featherKFilterable !== "false", C = l.dataset.featherKSortable !== "false";
267
- p.setAttribute("tabindex", "-1"), S || C ? l.style.cursor = "pointer" : l.style.cursor = "default", S ? (l.setAttribute("tabindex", "0"), l.setAttribute("role", "button"), l.setAttribute("aria-haspopup", "menu")) : (l.setAttribute("tabindex", "0"), l.setAttribute("role", "columnheader"), l.removeAttribute("aria-haspopup"));
266
+ const S = l.dataset.featherKFilterable !== "false", I = l.dataset.featherKSortable !== "false";
267
+ p.setAttribute("tabindex", "-1"), S || I ? l.style.cursor = "pointer" : l.style.cursor = "default", S ? (l.setAttribute("tabindex", "0"), l.setAttribute("role", "button"), l.setAttribute("aria-haspopup", "menu")) : (l.setAttribute("tabindex", "0"), l.setAttribute("role", "columnheader"), l.removeAttribute("aria-haspopup"));
268
268
  const G = (H) => {
269
269
  H.target?.closest(".k-column-resizer") || (t.value = l, p.click());
270
270
  }, oe = (H) => {
271
271
  if (S)
272
272
  t.value = l, H.preventDefault(), H.stopPropagation(), G(H);
273
- else if (C) {
273
+ else if (I) {
274
274
  t.value = l;
275
- const J = new KeyboardEvent("keydown", {
275
+ const j = new KeyboardEvent("keydown", {
276
276
  key: "Enter",
277
277
  code: "Enter",
278
278
  keyCode: 13,
@@ -280,19 +280,19 @@ const We = (e) => {
280
280
  bubbles: !0,
281
281
  cancelable: !0
282
282
  });
283
- l.dispatchEvent(J);
283
+ l.dispatchEvent(j);
284
284
  }
285
285
  };
286
286
  l.addEventListener("click", oe), V.push(() => {
287
287
  l.removeEventListener("click", oe);
288
288
  });
289
289
  const Q = (H) => {
290
- if ((H.code === "Enter" || H.code === "Space") && (S || C)) {
290
+ if ((H.code === "Enter" || H.code === "Space") && (S || I)) {
291
291
  if (t.value = l, t.value.focus(), S)
292
292
  H.preventDefault(), H.stopPropagation(), G(H);
293
- else if (C) {
294
- const J = l.querySelector(".k-link");
295
- J && J.click();
293
+ else if (I) {
294
+ const j = l.querySelector(".k-link");
295
+ j && j.click();
296
296
  }
297
297
  }
298
298
  };
@@ -322,7 +322,7 @@ const We = (e) => {
322
322
  }, g = function(o, m) {
323
323
  const l = o?.event.event.target, i = k();
324
324
  if (!l || !i) return;
325
- const p = l.classList.contains("k-link"), A = l.classList.contains("k-columnmenu-item"), S = i.find((C) => C.field === o.event.field)?.sortable && !0;
325
+ const p = l.classList.contains("k-link"), A = l.classList.contains("k-columnmenu-item"), S = i.find((I) => I.field === o.event.field)?.sortable && !0;
326
326
  if (!p) {
327
327
  if (A && !S) {
328
328
  (o.event.sort && void 0)?.filter(
@@ -337,7 +337,7 @@ const We = (e) => {
337
337
  }, F = () => {
338
338
  if (!c)
339
339
  try {
340
- D(), x(), $(), c = !0;
340
+ D(), x(), C(), c = !0;
341
341
  } catch (o) {
342
342
  console.error("initA11y failed:", o), R();
343
343
  }
@@ -361,7 +361,7 @@ function _e(e) {
361
361
  }), x = h(() => {
362
362
  const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
363
363
  return parseInt(a).toString().padStart(4, "0");
364
- }), $ = (a) => {
364
+ }), C = (a) => {
365
365
  if (y.value.length === 0) {
366
366
  e.onChange({ value: null, event: a });
367
367
  return;
@@ -371,75 +371,75 @@ function _e(e) {
371
371
  return;
372
372
  }
373
373
  if ((t.value ?? "").length === 10 && y.value.length === 8) {
374
- const [d, I, te] = t.value.split("/"), r = parseInt(d), u = parseInt(I), v = parseInt(te);
374
+ const [d, M, ee] = t.value.split("/"), r = parseInt(d), u = parseInt(M), v = parseInt(ee);
375
375
  if (o(v, r, u)) {
376
- const M = new Date(v, r - 1, u);
377
- R(M) ? e.onChange({ value: M, event: a }) : e.onChange({ value: null, event: a });
376
+ const $ = new Date(v, r - 1, u);
377
+ R($) ? e.onChange({ value: $, event: a }) : e.onChange({ value: null, event: a });
378
378
  } else
379
379
  e.onChange({ value: null, event: a });
380
380
  }
381
381
  }, R = (a) => {
382
- const d = e.min ?? void 0, I = e.max ?? void 0;
383
- return !(d && a < d || I && a > I);
382
+ const d = e.min ?? void 0, M = e.max ?? void 0;
383
+ return !(d && a < d || M && a > M);
384
384
  }, f = h(() => {
385
385
  if ((t.value ?? "").length === 10 && y.value.length === 8) {
386
- const [a, d, I] = (t.value ?? "").split("/"), te = parseInt(a), r = parseInt(d), u = parseInt(I);
387
- if (o(u, te, r))
388
- return new Date(u, te - 1, r);
386
+ const [a, d, M] = (t.value ?? "").split("/"), ee = parseInt(a), r = parseInt(d), u = parseInt(M);
387
+ if (o(u, ee, r))
388
+ return new Date(u, ee - 1, r);
389
389
  }
390
390
  return null;
391
- }), g = h(() => (t.value ?? "").length === 10 && y.value.length === 8), F = (a, d) => new Date(a, d, 0).getDate(), o = (a, d, I) => d >= 1 && d <= 12 && a >= 1900 && I >= 1 && I <= F(a, d), m = (a) => {
391
+ }), g = h(() => (t.value ?? "").length === 10 && y.value.length === 8), F = (a, d) => new Date(a, d, 0).getDate(), o = (a, d, M) => d >= 1 && d <= 12 && a >= 1900 && M >= 1 && M <= F(a, d), m = (a) => {
392
392
  t.value = a.value;
393
393
  const d = a.event?.target;
394
- c.value = d?.selectionStart ?? 0, $(a);
394
+ c.value = d?.selectionStart ?? 0, C(a);
395
395
  }, l = (a) => {
396
396
  c.value = a.target.selectionStart ?? 0;
397
- }, i = (a, d, I) => {
398
- const te = d?.selectionStart ?? c.value ?? 0;
399
- c.value = te;
397
+ }, i = (a, d, M) => {
398
+ const ee = d?.selectionStart ?? c.value ?? 0;
399
+ c.value = ee;
400
400
  let r = parseInt(L.value), u = parseInt(D.value), v = parseInt(x.value);
401
401
  if (!(y.value.length >= 8) || !o(v, r, u)) {
402
- const z = e.defaultValue ?? /* @__PURE__ */ new Date();
403
- r = z.getMonth() + 1, u = z.getDate(), v = z.getFullYear(), t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
402
+ const X = e.defaultValue ?? /* @__PURE__ */ new Date();
403
+ r = X.getMonth() + 1, u = X.getDate(), v = X.getFullYear(), t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
404
404
  2,
405
405
  "0"
406
406
  )}/${String(v)}`;
407
407
  const O = new Date(v, r - 1, u);
408
- e.onChange({ value: R(O) ? O : null, event: I }), N(() => {
408
+ e.onChange({ value: R(O) ? O : null, event: M }), N(() => {
409
409
  requestAnimationFrame(() => {
410
- const X = document.getElementById(
410
+ const J = document.getElementById(
411
411
  e.id
412
412
  ), Z = c.value ?? 0;
413
- X && (X.focus(), X.setSelectionRange(Z, Z));
413
+ J && (J.focus(), J.setSelectionRange(Z, Z));
414
414
  });
415
415
  });
416
416
  return;
417
417
  }
418
- const U = w(te);
418
+ const U = w(ee);
419
419
  if (U === "mm")
420
420
  r = a === "ArrowUp" ? r < 12 ? r + 1 : 1 : r > 1 ? r - 1 : 12;
421
421
  else if (U === "dd") {
422
- const z = new Date(v, r, 0).getDate();
423
- u = a === "ArrowUp" ? u < z ? u + 1 : 1 : u > 1 ? u - 1 : z;
422
+ const X = new Date(v, r, 0).getDate();
423
+ u = a === "ArrowUp" ? u < X ? u + 1 : 1 : u > 1 ? u - 1 : X;
424
424
  } else U === "yyyy" && (v = a === "ArrowUp" ? v + 1 : Math.max(1, v - 1));
425
425
  t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
426
426
  2,
427
427
  "0"
428
428
  )}/${String(v)}`;
429
- const [ae, j, Y] = t.value.split("/"), ie = new Date(
429
+ const [ae, z, Y] = t.value.split("/"), ie = new Date(
430
430
  parseInt(Y),
431
431
  parseInt(ae) - 1,
432
- parseInt(j)
432
+ parseInt(z)
433
433
  );
434
434
  ie.toString() !== "Invalid Date" && parseInt(Y) >= 1e3 ? e.onChange({
435
435
  value: R(ie) ? ie : null,
436
- event: I
437
- }) : e.onChange({ value: null, event: I }), N(() => {
436
+ event: M
437
+ }) : e.onChange({ value: null, event: M }), N(() => {
438
438
  requestAnimationFrame(() => {
439
- const z = document.getElementById(
439
+ const X = document.getElementById(
440
440
  e.id
441
441
  ), O = c.value ?? 0;
442
- z && (z.focus(), z.setSelectionRange(O, O));
442
+ X && (X.focus(), X.setSelectionRange(O, O));
443
443
  });
444
444
  });
445
445
  }, p = (a) => {
@@ -463,7 +463,7 @@ function _e(e) {
463
463
  return;
464
464
  }
465
465
  k.includes(a.key) && (a.preventDefault(), c.value = d?.selectionStart ?? 0);
466
- }, C = (a) => {
466
+ }, I = (a) => {
467
467
  W.value = !0, V.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && y.value.length === 0 && (e.externalValue.value = "");
468
468
  const d = a.target;
469
469
  d && (c.value = d.selectionStart ?? 0);
@@ -474,8 +474,8 @@ function _e(e) {
474
474
  if (a) {
475
475
  const d = new Date(a);
476
476
  if (d.toString() !== "Invalid Date") {
477
- const I = (d.getMonth() + 1).toString().padStart(2, "0"), te = d.getDate().toString().padStart(2, "0"), r = d.getFullYear().toString();
478
- t.value = `${I}/${te}/${r}`;
477
+ const M = (d.getMonth() + 1).toString().padStart(2, "0"), ee = d.getDate().toString().padStart(2, "0"), r = d.getFullYear().toString();
478
+ t.value = `${M}/${ee}/${r}`;
479
479
  return;
480
480
  }
481
481
  }
@@ -532,18 +532,18 @@ function _e(e) {
532
532
  year: "numeric",
533
533
  month: "2-digit",
534
534
  day: "2-digit"
535
- }) : null, I = e.max ? e.max.toLocaleDateString("en-US", {
535
+ }) : null, M = e.max ? e.max.toLocaleDateString("en-US", {
536
536
  year: "numeric",
537
537
  month: "2-digit",
538
538
  day: "2-digit"
539
539
  }) : null;
540
540
  if (a === "out-of-bounds") {
541
- if (d && I) return `Must be between ${d} and ${I}.`;
541
+ if (d && M) return `Must be between ${d} and ${M}.`;
542
542
  if (d) return `Must be on or after ${d}.`;
543
- if (I) return `Must be on or before ${I}.`;
543
+ if (M) return `Must be on or before ${M}.`;
544
544
  }
545
545
  return "";
546
- }), J = () => {
546
+ }), j = () => {
547
547
  N(() => {
548
548
  const a = document.getElementById(
549
549
  e.id
@@ -553,19 +553,23 @@ function _e(e) {
553
553
  return;
554
554
  }
555
555
  const d = a.closest(".k-datepicker");
556
- if (d) {
557
- const I = d.parentElement;
558
- I ? I.classList.add("fk-datepicker") : console.warn(
559
- `Parent of .k-datepicker not found for #${e.id} styling.`
560
- );
561
- } else {
556
+ if (!d) {
562
557
  console.warn(`.k-datepicker parent not found for #${e.id} styling.`);
563
558
  return;
564
559
  }
560
+ const M = d.parentElement;
561
+ if (M) {
562
+ if (M.classList.contains("fk-datepicker"))
563
+ return;
564
+ M.classList.add("fk-datepicker");
565
+ } else
566
+ console.warn(
567
+ `Parent of .k-datepicker not found for #${e.id} styling.`
568
+ );
565
569
  });
566
570
  };
567
571
  return xe(() => {
568
- J();
572
+ j();
569
573
  }), {
570
574
  raw: t,
571
575
  cursorPos: c,
@@ -585,13 +589,15 @@ function _e(e) {
585
589
  handleWheel: A,
586
590
  handleKeyUp: S,
587
591
  handleClick: l,
588
- handleBlur: C
592
+ handleBlur: I,
593
+ // Expose so consumers can re-run styling when needed
594
+ initStyling: j
589
595
  };
590
596
  }
591
597
  function Ge(e) {
592
598
  const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(!1), W = 365 * (1440 * 60 * 1e3), k = /* @__PURE__ */ new Date(), b = new Date(k.getTime() - W), y = new Date(k.getTime() + W);
593
599
  e.min = e.min ?? b, e.max = e.max ?? y;
594
- const w = h(() => (t.value ?? "").replace(/\D/g, "")), L = (n, s) => new Date(n, s, 0).getDate(), D = (n, s, E) => s >= 1 && s <= 12 && n >= 1e3 && E >= 1 && E <= L(n, s), x = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), $ = (n) => {
600
+ const w = h(() => (t.value ?? "").replace(/\D/g, "")), L = (n, s) => new Date(n, s, 0).getDate(), D = (n, s, E) => s >= 1 && s <= 12 && n >= 1e3 && E >= 1 && E <= L(n, s), x = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), C = (n) => {
595
601
  if (!n) return null;
596
602
  const s = e.min, E = e.max, q = x(n);
597
603
  return q < x(s) || q > x(E) ? null : n;
@@ -601,7 +607,7 @@ function Ge(e) {
601
607
  const s = n.substring(0, 10), E = n.substring(13, 23), [q, ne, le] = s.split("/").map((se) => parseInt(se || "0", 10)), [ye, de, fe] = E.split("/").map((se) => parseInt(se || "0", 10)), me = new Date(le, q - 1, ne), he = new Date(fe, ye - 1, de), we = D(le, q, ne) && me.toString() !== "Invalid Date", ke = D(fe, ye, de) && he.toString() !== "Invalid Date";
602
608
  return { start: we ? me : null, end: ke ? he : null };
603
609
  }, F = e.externalValid ?? _(!0), o = h(() => g(t.value)), m = h(() => {
604
- const n = $(o.value.start), s = $(o.value.end);
610
+ const n = C(o.value.start), s = C(o.value.end);
605
611
  return { start: n, end: s };
606
612
  }), l = h(() => {
607
613
  if (!f.value) return;
@@ -641,10 +647,10 @@ function Ge(e) {
641
647
  default:
642
648
  return "";
643
649
  }
644
- }), C = ["ArrowUp", "ArrowDown"], G = ["ArrowLeft", "ArrowRight"], oe = (n, s) => String(n).padStart(s, "0"), Q = (n) => `${oe(n.getMonth() + 1, 2)}/${oe(n.getDate(), 2)}/${oe(
650
+ }), I = ["ArrowUp", "ArrowDown"], G = ["ArrowLeft", "ArrowRight"], oe = (n, s) => String(n).padStart(s, "0"), Q = (n) => `${oe(n.getMonth() + 1, 2)}/${oe(n.getDate(), 2)}/${oe(
645
651
  n.getFullYear(),
646
652
  4
647
- )}`, H = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, J = (n, s, E) => {
653
+ )}`, H = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, j = (n, s, E) => {
648
654
  const q = s?.selectionStart ?? c.value ?? 0;
649
655
  c.value = q;
650
656
  const { start: ne, end: le } = g(t.value);
@@ -652,10 +658,10 @@ function Ge(e) {
652
658
  const B = /* @__PURE__ */ new Date(), ue = Q(B);
653
659
  t.value = `${ue} - ${ue}`, e.onChange({ value: { start: B, end: B }, event: E }), N(() => {
654
660
  requestAnimationFrame(() => {
655
- const ee = document.getElementById(
661
+ const te = document.getElementById(
656
662
  e.id
657
663
  ), re = c.value ?? 0;
658
- ee && (ee.focus(), ee.setSelectionRange(re, re));
664
+ te && (te.focus(), te.setSelectionRange(re, re));
659
665
  });
660
666
  });
661
667
  return;
@@ -664,16 +670,16 @@ function Ge(e) {
664
670
  let fe = ne ? new Date(ne) : new Date(ye), me = le ? new Date(le) : new Date(ye);
665
671
  const he = (B, ue) => {
666
672
  if (ue === "mm") {
667
- const ee = B.getMonth() + 1, re = n === "ArrowUp" ? ee < 12 ? ee + 1 : 1 : ee > 1 ? ee - 1 : 12;
673
+ const te = B.getMonth() + 1, re = n === "ArrowUp" ? te < 12 ? te + 1 : 1 : te > 1 ? te - 1 : 12;
668
674
  B.setMonth(re - 1);
669
675
  const be = L(B.getFullYear(), re);
670
676
  B.getDate() > be && B.setDate(be);
671
677
  } else if (ue === "dd") {
672
- const ee = L(B.getFullYear(), B.getMonth() + 1), re = B.getDate(), be = n === "ArrowUp" ? re < ee ? re + 1 : 1 : re > 1 ? re - 1 : ee;
678
+ const te = L(B.getFullYear(), B.getMonth() + 1), re = B.getDate(), be = n === "ArrowUp" ? re < te ? re + 1 : 1 : re > 1 ? re - 1 : te;
673
679
  B.setDate(be);
674
680
  } else if (ue === "yyyy") {
675
- const ee = B.getFullYear();
676
- B.setFullYear(n === "ArrowUp" ? ee + 1 : Math.max(1, ee - 1));
681
+ const te = B.getFullYear();
682
+ B.setFullYear(n === "ArrowUp" ? te + 1 : Math.max(1, te - 1));
677
683
  const re = L(B.getFullYear(), B.getMonth() + 1);
678
684
  B.getDate() > re && B.setDate(re);
679
685
  }
@@ -681,7 +687,7 @@ function Ge(e) {
681
687
  de.side === "start" ? he(fe, de.part) : he(me, de.part);
682
688
  const we = Q(fe), ke = Q(me);
683
689
  t.value = `${we} - ${ke}`;
684
- const se = $(fe), De = $(me);
690
+ const se = C(fe), De = C(me);
685
691
  se && De && R(se, De) ? e.onChange({ value: { start: se, end: De }, event: E }) : e.onChange({ value: null, event: E }), N(() => {
686
692
  requestAnimationFrame(() => {
687
693
  const B = document.getElementById(
@@ -696,7 +702,7 @@ function Ge(e) {
696
702
  e.onChange({ value: null, event: n });
697
703
  return;
698
704
  }
699
- const q = $(s), ne = $(E);
705
+ const q = C(s), ne = C(E);
700
706
  if (!q || !ne) {
701
707
  e.onChange({ value: null, event: n });
702
708
  return;
@@ -715,9 +721,9 @@ function Ge(e) {
715
721
  t.value = s;
716
722
  const q = E?.target;
717
723
  c.value = q?.selectionStart ?? 0, a(n);
718
- }, I = (n) => {
724
+ }, M = (n) => {
719
725
  c.value = n.target.selectionStart ?? 0;
720
- }, te = (n) => {
726
+ }, ee = (n) => {
721
727
  if (n.code === "Space" || n.key === " ") {
722
728
  n.preventDefault(), e.onShowCalendar(n);
723
729
  return;
@@ -726,24 +732,24 @@ function Ge(e) {
726
732
  n.preventDefault(), e.onShowCalendar(n);
727
733
  return;
728
734
  }
729
- if (C.includes(n.key)) {
735
+ if (I.includes(n.key)) {
730
736
  n.preventDefault();
731
737
  const s = n.target;
732
- J(n.key, s, n);
738
+ j(n.key, s, n);
733
739
  }
734
740
  }, r = (n) => {
735
741
  n.preventDefault();
736
742
  const s = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
737
- J(s, n.target, n);
743
+ j(s, n.target, n);
738
744
  }, u = (n) => {
739
- if (G.includes(n.key) || C.includes(n.key)) {
745
+ if (G.includes(n.key) || I.includes(n.key)) {
740
746
  n.preventDefault();
741
747
  const s = n.target;
742
748
  c.value = s?.selectionStart ?? 0;
743
749
  }
744
750
  }, v = () => {
745
751
  A.value = p.value, (e.manageValid ?? !0) && (F.value = i.value);
746
- }, M = (n) => {
752
+ }, $ = (n) => {
747
753
  v();
748
754
  }, U = (n) => {
749
755
  console.log("Clear event:", n), t.value = "", c.value = 0, e.onChange({ value: null, event: n }), v(), N(() => {
@@ -771,17 +777,17 @@ function Ge(e) {
771
777
  );
772
778
  const ae = h(
773
779
  () => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
774
- ), j = h(
780
+ ), z = h(
775
781
  () => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
776
782
  ), Y = h(
777
783
  () => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
778
784
  ), ie = h(
779
785
  () => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
780
- ), z = h(
786
+ ), X = h(
781
787
  () => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
782
788
  ), O = h(
783
789
  () => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
784
- ), X = h(() => {
790
+ ), J = h(() => {
785
791
  const { start: n, end: s } = g(t.value);
786
792
  return [
787
793
  {
@@ -799,13 +805,13 @@ function Ge(e) {
799
805
  {
800
806
  label: "Start",
801
807
  value: `${String(ae.value).padStart(2, "0")} / ${String(
802
- j.value
808
+ z.value
803
809
  ).padStart(2, "0")} / ${String(Y.value).padStart(4, "0")}`
804
810
  },
805
811
  {
806
812
  label: "End",
807
813
  value: `${String(ie.value).padStart(2, "0")} / ${String(
808
- z.value
814
+ X.value
809
815
  ).padStart(2, "0")} / ${String(O.value).padStart(4, "0")}`
810
816
  },
811
817
  { label: "Digits only", value: w.value },
@@ -839,7 +845,11 @@ function Ge(e) {
839
845
  return;
840
846
  }
841
847
  const s = n.closest("div");
842
- s ? s.classList.add("fk-daterangepicker") : console.warn(`Parent div of #${e.id} not found for styling.`);
848
+ if (!s) {
849
+ console.warn(`Parent div of #${e.id} not found for styling.`);
850
+ return;
851
+ }
852
+ s.classList.contains("fk-daterangepicker") || s.classList.add("fk-daterangepicker");
843
853
  });
844
854
  };
845
855
  xe(() => {
@@ -878,7 +888,7 @@ function Ge(e) {
878
888
  raw: t,
879
889
  cursorPos: c,
880
890
  debugEnabled: P,
881
- debugLines: X,
891
+ debugLines: J,
882
892
  digitsOnly: w,
883
893
  valid: F,
884
894
  validComputed: K(i),
@@ -886,21 +896,22 @@ function Ge(e) {
886
896
  validationMessage: K(S),
887
897
  spanDays: K(l),
888
898
  month1: K(ae),
889
- day1: K(j),
899
+ day1: K(z),
890
900
  year1: K(Y),
891
901
  month2: K(ie),
892
- day2: K(z),
902
+ day2: K(X),
893
903
  year2: K(O),
894
904
  handleChange: d,
895
- handleKeyDown: te,
905
+ handleKeyDown: ee,
896
906
  handleWheel: r,
897
907
  handleKeyUp: u,
898
- handleClick: I,
899
- handleBlur: M,
908
+ handleClick: M,
909
+ handleBlur: $,
900
910
  handleClear: U,
901
911
  onCalendarChange: () => {
902
912
  T.value = !0;
903
- }
913
+ },
914
+ initStyling: Z
904
915
  };
905
916
  }
906
917
  function je(e) {
@@ -917,26 +928,26 @@ function je(e) {
917
928
  }), x = h(() => {
918
929
  const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", u = parseInt(r);
919
930
  return Math.min(Math.max(u, 0), 59);
920
- }), $ = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = h(() => {
921
- const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u = $.value;
931
+ }), C = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = h(() => {
932
+ const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u = C.value;
922
933
  return r === 12 ? u === "AM" ? 0 : 12 : u === "PM" ? r + 12 : r;
923
934
  }), f = h(() => g.value ? `${String(R.value).padStart(2, "0")}:${String(x.value).padStart(2, "0")}:00` : null), g = h(
924
935
  () => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
925
936
  ), F = (r, u, v) => {
926
- let M = r % 12;
927
- return M === 0 && (M = 12), `${String(M).padStart(2, "0")}:${String(u).padStart(
937
+ let $ = r % 12;
938
+ return $ === 0 && ($ = 12), `${String($).padStart(2, "0")}:${String(u).padStart(
928
939
  2,
929
940
  "0"
930
941
  )} ${v}`;
931
942
  }, o = (r) => {
932
943
  const u = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
933
944
  if (!u) return null;
934
- const v = parseInt(u[1]), M = parseInt(u[2]), U = u[3].toUpperCase();
935
- if (v < 1 || v > 12 || M < 0 || M > 59) return null;
945
+ const v = parseInt(u[1]), $ = parseInt(u[2]), U = u[3].toUpperCase();
946
+ if (v < 1 || v > 12 || $ < 0 || $ > 59) return null;
936
947
  let ae = v % 12;
937
948
  U === "PM" && (ae += 12);
938
- const j = /* @__PURE__ */ new Date();
939
- return j.setSeconds(0, 0), j.setHours(ae), j.setMinutes(M), j;
949
+ const z = /* @__PURE__ */ new Date();
950
+ return z.setSeconds(0, 0), z.setHours(ae), z.setMinutes($), z;
940
951
  }, m = (r) => {
941
952
  if (y.value.length === 0) {
942
953
  e.onChange({ value: null, event: r });
@@ -949,14 +960,14 @@ function je(e) {
949
960
  const u = o(t.value);
950
961
  u && i(u) ? e.onChange({ value: u, event: r }) : e.onChange({ value: null, event: r });
951
962
  }, l = (r) => r.getHours() * 60 + r.getMinutes(), i = (r) => {
952
- const u = e.min ?? void 0, v = e.max ?? void 0, M = l(r);
963
+ const u = e.min ?? void 0, v = e.max ?? void 0, $ = l(r);
953
964
  if (u) {
954
965
  const U = l(u);
955
- if (M < U) return !1;
966
+ if ($ < U) return !1;
956
967
  }
957
968
  if (v) {
958
969
  const U = l(v);
959
- if (M > U) return !1;
970
+ if ($ > U) return !1;
960
971
  }
961
972
  return !0;
962
973
  }, p = (r) => {
@@ -966,15 +977,15 @@ function je(e) {
966
977
  try {
967
978
  const v = c.value ?? 0;
968
979
  if (L(v) === "ampm" && (t.value ?? "").length >= 8) {
969
- const M = t.value.charAt(6);
970
- /[Aa]/.test(M) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, N(() => {
980
+ const $ = t.value.charAt(6);
981
+ /[Aa]/.test($) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, N(() => {
971
982
  requestAnimationFrame(() => {
972
983
  const U = document.getElementById(
973
984
  e.id
974
985
  );
975
986
  U && (U.focus(), U.setSelectionRange(8, 8));
976
987
  });
977
- })) : /[Pp]/.test(M) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, N(() => {
988
+ })) : /[Pp]/.test($) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, N(() => {
978
989
  requestAnimationFrame(() => {
979
990
  const U = document.getElementById(
980
991
  e.id
@@ -989,13 +1000,13 @@ function je(e) {
989
1000
  }, A = (r) => {
990
1001
  c.value = r.target.selectionStart ?? 0;
991
1002
  }, S = (r, u, v) => {
992
- const M = u?.selectionStart ?? c.value ?? 0;
993
- c.value = M;
994
- const U = L(M), ae = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1003
+ const $ = u?.selectionStart ?? c.value ?? 0;
1004
+ c.value = $;
1005
+ const U = L($), ae = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
995
1006
  if (!ae) {
996
1007
  if ((t.value ?? "").length === 0 || y.value.length === 0) {
997
- const O = /* @__PURE__ */ new Date(), X = O.getHours(), Z = X >= 12 ? "PM" : "AM";
998
- t.value = F(X, O.getMinutes(), Z);
1008
+ const O = /* @__PURE__ */ new Date(), J = O.getHours(), Z = J >= 12 ? "PM" : "AM";
1009
+ t.value = F(J, O.getMinutes(), Z);
999
1010
  const ge = o(t.value);
1000
1011
  ge && i(ge) ? e.onChange({ value: ge, event: v }) : e.onChange({ value: null, event: v }), N(() => {
1001
1012
  requestAnimationFrame(() => {
@@ -1008,37 +1019,37 @@ function je(e) {
1008
1019
  }
1009
1020
  return;
1010
1021
  }
1011
- let j = parseInt(ae[1]), Y = parseInt(ae[2]), ie = ae[3].toUpperCase();
1022
+ let z = parseInt(ae[1]), Y = parseInt(ae[2]), ie = ae[3].toUpperCase();
1012
1023
  if (U === "hh")
1013
- r === "ArrowUp" ? j = j < 12 ? j + 1 : 1 : j = j > 1 ? j - 1 : 12;
1024
+ r === "ArrowUp" ? z = z < 12 ? z + 1 : 1 : z = z > 1 ? z - 1 : 12;
1014
1025
  else if (U === "mm") {
1015
1026
  const O = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1016
1027
  if (O === 1)
1017
1028
  r === "ArrowUp" ? Y = Y < 59 ? Y + 1 : 0 : Y = Y > 0 ? Y - 1 : 59;
1018
1029
  else if (r === "ArrowUp") {
1019
- const X = Y % O;
1020
- let Z = X === 0 ? Y + O : Y + (O - X);
1030
+ const J = Y % O;
1031
+ let Z = J === 0 ? Y + O : Y + (O - J);
1021
1032
  Z >= 60 && (Z = 0), Y = Z;
1022
1033
  } else {
1023
- const X = Y % O;
1024
- let Z = X === 0 ? Y - O : Y - X;
1034
+ const J = Y % O;
1035
+ let Z = J === 0 ? Y - O : Y - J;
1025
1036
  Z < 0 && (Z = 60 - O), Y = Z;
1026
1037
  }
1027
1038
  } else U === "ampm" && (ie = ie === "AM" ? "PM" : "AM");
1028
- t.value = `${String(j).padStart(2, "0")}:${String(Y).padStart(
1039
+ t.value = `${String(z).padStart(2, "0")}:${String(Y).padStart(
1029
1040
  2,
1030
1041
  "0"
1031
1042
  )} ${ie}`;
1032
- const z = o(t.value);
1033
- z && i(z) ? e.onChange({ value: z, event: v }) : e.onChange({ value: null, event: v }), N(() => {
1043
+ const X = o(t.value);
1044
+ X && i(X) ? e.onChange({ value: X, event: v }) : e.onChange({ value: null, event: v }), N(() => {
1034
1045
  requestAnimationFrame(() => {
1035
1046
  const O = document.getElementById(
1036
1047
  e.id
1037
- ), X = c.value ?? 0;
1038
- O && (O.focus(), O.setSelectionRange(X, X));
1048
+ ), J = c.value ?? 0;
1049
+ O && (O.focus(), O.setSelectionRange(J, J));
1039
1050
  });
1040
1051
  });
1041
- }, C = (r) => {
1052
+ }, I = (r) => {
1042
1053
  if (r.code === "Space" || r.key === " ") {
1043
1054
  e.onShowPicker(r);
1044
1055
  return;
@@ -1070,8 +1081,8 @@ function je(e) {
1070
1081
  if (r) {
1071
1082
  const u = new Date(r);
1072
1083
  if (u.toString() !== "Invalid Date") {
1073
- const v = u.getHours(), M = v >= 12 ? "PM" : "AM";
1074
- t.value = F(v, u.getMinutes(), M);
1084
+ const v = u.getHours(), $ = v >= 12 ? "PM" : "AM";
1085
+ t.value = F(v, u.getMinutes(), $);
1075
1086
  return;
1076
1087
  }
1077
1088
  }
@@ -1083,12 +1094,12 @@ function je(e) {
1083
1094
  ["Hour (12h)", D.value],
1084
1095
  ["Hour (24h)", R.value],
1085
1096
  ["Minute", x.value],
1086
- ["Period", $.value],
1097
+ ["Period", C.value],
1087
1098
  ["Time (24h)", f.value ?? "--:--:--"],
1088
1099
  ["Digits only", y.value],
1089
1100
  [
1090
1101
  "Parsed Date",
1091
- J.value?.toLocaleDateString("en-US", {
1102
+ j.value?.toLocaleDateString("en-US", {
1092
1103
  hour: "2-digit",
1093
1104
  minute: "2-digit"
1094
1105
  }) ?? null
@@ -1109,30 +1120,30 @@ function je(e) {
1109
1120
  ],
1110
1121
  ["valid", a.value],
1111
1122
  ["reason", d.value],
1112
- ["validationMessage", I.value]
1113
- ]), J = h(
1123
+ ["validationMessage", M.value]
1124
+ ]), j = h(
1114
1125
  () => o(t.value) ?? null
1115
1126
  ), a = h(() => {
1116
1127
  if (!V.value) {
1117
1128
  if (!g.value) return !0;
1118
- const u = J.value;
1129
+ const u = j.value;
1119
1130
  return u ? i(u) : !1;
1120
1131
  }
1121
1132
  if (!W.value) return !0;
1122
- const r = J.value;
1133
+ const r = j.value;
1123
1134
  return !g.value || !r ? !1 : i(r);
1124
1135
  }), d = h(() => {
1125
1136
  if (!V.value) {
1126
1137
  if (!g.value) return;
1127
- const u = J.value;
1138
+ const u = j.value;
1128
1139
  return u ? i(u) ? "valid" : "out-of-bounds" : "invalid-time";
1129
1140
  }
1130
1141
  if (!W.value) return;
1131
1142
  if (y.value.length === 0 || !g.value)
1132
1143
  return "incomplete";
1133
- const r = J.value;
1144
+ const r = j.value;
1134
1145
  return r ? i(r) ? "valid" : "out-of-bounds" : "invalid-time";
1135
- }), I = h(() => {
1146
+ }), M = h(() => {
1136
1147
  const r = d.value;
1137
1148
  if (!r || r === "valid") return "";
1138
1149
  if (r === "incomplete")
@@ -1142,14 +1153,14 @@ function je(e) {
1142
1153
  const u = {
1143
1154
  hour: "2-digit",
1144
1155
  minute: "2-digit"
1145
- }, v = e.min ? e.min.toLocaleTimeString("en-US", u) : null, M = e.max ? e.max.toLocaleTimeString("en-US", u) : null;
1156
+ }, v = e.min ? e.min.toLocaleTimeString("en-US", u) : null, $ = e.max ? e.max.toLocaleTimeString("en-US", u) : null;
1146
1157
  if (r === "out-of-bounds") {
1147
- if (v && M) return `Must be between ${v} and ${M}.`;
1158
+ if (v && $) return `Must be between ${v} and ${$}.`;
1148
1159
  if (v) return `Must be ${v} or later.`;
1149
- if (M) return `Must be ${M} or earlier.`;
1160
+ if ($) return `Must be ${$} or earlier.`;
1150
1161
  }
1151
1162
  return "";
1152
- }), te = () => {
1163
+ }), ee = () => {
1153
1164
  N(() => {
1154
1165
  const r = document.getElementById(e.id);
1155
1166
  if (!r) {
@@ -1157,20 +1168,24 @@ function je(e) {
1157
1168
  return;
1158
1169
  }
1159
1170
  const u = r.closest(".k-timepicker");
1160
- if (!u)
1171
+ if (!u) {
1161
1172
  console.warn(
1162
1173
  `.k-timepicker parent of #${e.id} not found for styling.`
1163
1174
  );
1164
- else {
1165
- const v = u.parentElement;
1166
- v ? v.classList.add("fk-timepicker") : console.warn(
1175
+ return;
1176
+ }
1177
+ const v = u.parentElement;
1178
+ if (!v) {
1179
+ console.warn(
1167
1180
  `Parent of .k-timepicker not found for #${e.id} styling.`
1168
1181
  );
1182
+ return;
1169
1183
  }
1184
+ v.classList.contains("fk-timepicker") || v.classList.add("fk-timepicker");
1170
1185
  });
1171
1186
  };
1172
1187
  return xe(() => {
1173
- te();
1188
+ ee();
1174
1189
  }), {
1175
1190
  raw: t,
1176
1191
  rules: w,
@@ -1179,22 +1194,24 @@ function je(e) {
1179
1194
  placeholder: T,
1180
1195
  isValid: a,
1181
1196
  reason: K(d),
1182
- validationMessage: I,
1197
+ validationMessage: M,
1183
1198
  isComplete: g,
1184
1199
  inRangeTime: i,
1185
1200
  cursorPos: c,
1186
1201
  hour: K(D),
1187
1202
  hour24: K(R),
1188
1203
  minute: K(x),
1189
- period: K($),
1204
+ period: K(C),
1190
1205
  time24: K(f),
1191
- parsedRawTime: K(J),
1206
+ parsedRawTime: K(j),
1192
1207
  handleChange: p,
1193
- handleKeyDown: C,
1208
+ handleKeyDown: I,
1194
1209
  handleKeyUp: oe,
1195
1210
  handleClick: A,
1196
1211
  handleWheel: G,
1197
- handleBlur: Q
1212
+ handleBlur: Q,
1213
+ // Expose so consumers can reapply theming when Kendo updates DOM
1214
+ initStyling: ee
1198
1215
  };
1199
1216
  }
1200
1217
  function Fe(e) {
@@ -1251,7 +1268,7 @@ function Ee(...e) {
1251
1268
  t.push(
1252
1269
  ...k.flatMap(
1253
1270
  (D) => b.flatMap(
1254
- (x) => y.map(($) => P(D, x, $, L))
1271
+ (x) => y.map((C) => P(D, x, C, L))
1255
1272
  )
1256
1273
  )
1257
1274
  );
@@ -1300,7 +1317,7 @@ function Ye(e, t, c = {}) {
1300
1317
  }
1301
1318
  };
1302
1319
  let x = !1;
1303
- const $ = [
1320
+ const C = [
1304
1321
  Ee(P, "click", (f) => {
1305
1322
  x || (x = !0, setTimeout(() => {
1306
1323
  x = !1;
@@ -1317,7 +1334,7 @@ function Ye(e, t, c = {}) {
1317
1334
  ((g = P.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !F?.contains(P.document.activeElement) && t(f);
1318
1335
  }, 0);
1319
1336
  }, { passive: !0 })
1320
- ].filter(Boolean), R = () => $.forEach((f) => f());
1337
+ ].filter(Boolean), R = () => C.forEach((f) => f());
1321
1338
  return k ? {
1322
1339
  stop: R,
1323
1340
  cancel: () => {
@@ -1347,12 +1364,12 @@ function ze(e) {
1347
1364
  const y = () => {
1348
1365
  if (e.resolvePopupEl) return e.resolvePopupEl();
1349
1366
  const w = (D, x) => {
1350
- const $ = Array.from(D.querySelectorAll(x));
1351
- if (!$.length) return null;
1352
- const R = $.filter(
1367
+ const C = Array.from(D.querySelectorAll(x));
1368
+ if (!C.length) return null;
1369
+ const R = C.filter(
1353
1370
  (f) => f.offsetParent !== null || f.getClientRects().length > 0
1354
1371
  );
1355
- return R[R.length - 1] ?? $[$.length - 1] ?? null;
1372
+ return R[R.length - 1] ?? C[C.length - 1] ?? null;
1356
1373
  }, L = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1357
1374
  for (const D of P) {
1358
1375
  const x = w(L, D);
@@ -1376,8 +1393,8 @@ function ze(e) {
1376
1393
  }, document.addEventListener("keydown", k, !0)));
1377
1394
  })) : (W(), k && (document.removeEventListener("keydown", k, !0), k = null), t.value = null, b.value === "outside" && N(() => {
1378
1395
  const L = () => {
1379
- const D = e.triggerEl?.value, x = D?.querySelector("input"), $ = document.activeElement;
1380
- $ && ($ === x || D && D.contains($)) && (x ?? D)?.blur?.();
1396
+ const D = e.triggerEl?.value, x = D?.querySelector("input"), C = document.activeElement;
1397
+ C && (C === x || D && D.contains(C)) && (x ?? D)?.blur?.();
1381
1398
  };
1382
1399
  requestAnimationFrame(() => setTimeout(L, 0));
1383
1400
  }), e.returnFocusToTrigger !== !1 && b.value === "escape" && e.triggerEl?.value && (console.log(