@featherk/composables 0.13.1 → 0.13.2
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/README.md +8 -0
- package/dist/docs-manifest.d.ts +1 -0
- package/dist/docs-manifest.js +24 -22
- package/dist/featherk-composables.es.js +170 -163
- package/dist/featherk-composables.es.js.map +1 -1
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/featherk-composables.umd.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/trap/usePopupTrap.d.ts +14 -0
- package/docs/menu/usePopupMenu.md +21 -2
- package/docs/menu/usePopupMenuAndActiveIdRegistry.md +185 -0
- package/docs/menu/usePopupMenuGridOrchestration.md +7 -4
- package/docs/trap/usePopupTrap.md +24 -0
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ref as X, onBeforeUnmount as qe, nextTick as j, computed as y, watchEffect as
|
|
1
|
+
import { ref as X, onBeforeUnmount as qe, nextTick as j, computed as y, watchEffect as Oe, toValue as ne, reactive as Ke, watch as le, useId as ze, unref as Ue, onUnmounted as Te, shallowRef as ye, shallowReactive as Be, readonly as ee, onMounted as Re } from "vue";
|
|
2
2
|
import { useFocusTrap as Ye } from "@vueuse/integrations/useFocusTrap";
|
|
3
3
|
const bt = (e, t) => {
|
|
4
4
|
const n = X(null);
|
|
5
5
|
let p = !1, a = null, d = null;
|
|
6
|
-
const b = [], D = ".k-table-row[data-grid-row-index] [tabindex]",
|
|
6
|
+
const b = [], D = ".k-table-row[data-grid-row-index] [tabindex]", O = () => {
|
|
7
7
|
const c = e?.value?.$el;
|
|
8
8
|
return c ? c.closest(".k-grid") : null;
|
|
9
9
|
}, K = (c) => {
|
|
10
|
-
const A =
|
|
10
|
+
const A = O();
|
|
11
11
|
if (!A) return !1;
|
|
12
12
|
const g = c.closest(".k-grid-aria-root");
|
|
13
13
|
if (g)
|
|
@@ -69,7 +69,7 @@ const bt = (e, t) => {
|
|
|
69
69
|
"button, [role='button'], .k-link"
|
|
70
70
|
)?.focus();
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, $ = () => {
|
|
73
73
|
a = new MutationObserver((c) => {
|
|
74
74
|
c.forEach((A) => {
|
|
75
75
|
A.addedNodes.forEach((g) => {
|
|
@@ -274,7 +274,7 @@ const bt = (e, t) => {
|
|
|
274
274
|
"keydown",
|
|
275
275
|
k
|
|
276
276
|
);
|
|
277
|
-
}),
|
|
277
|
+
}), $(), B();
|
|
278
278
|
});
|
|
279
279
|
}, W = () => {
|
|
280
280
|
const A = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
|
|
@@ -387,10 +387,10 @@ const bt = (e, t) => {
|
|
|
387
387
|
handleSortChange: Y,
|
|
388
388
|
initA11y: J
|
|
389
389
|
};
|
|
390
|
-
}, He = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Xe = (e) => !!e && typeof e == "object" && "field" in e,
|
|
391
|
-
(n) =>
|
|
390
|
+
}, He = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Xe = (e) => !!e && typeof e == "object" && "field" in e, Le = (e, t) => !e || typeof e != "object" ? !1 : He(e) ? e.filters.some(
|
|
391
|
+
(n) => Le(n, t)
|
|
392
392
|
) : Xe(e) ? e.field === t : !1, wt = (e) => (t) => e.value?.filters && e.value.filters.some(
|
|
393
|
-
(n) =>
|
|
393
|
+
(n) => Le(n, t)
|
|
394
394
|
) ? "active" : "", We = [
|
|
395
395
|
"button",
|
|
396
396
|
"a",
|
|
@@ -420,7 +420,7 @@ const bt = (e, t) => {
|
|
|
420
420
|
} = e, D = [
|
|
421
421
|
...We,
|
|
422
422
|
...a
|
|
423
|
-
],
|
|
423
|
+
], O = (f, u) => {
|
|
424
424
|
if (!f) return !1;
|
|
425
425
|
const v = D.join(",");
|
|
426
426
|
return f.closest && f.closest(v) ? !0 : d && u ? d(f, u) : !1;
|
|
@@ -474,7 +474,7 @@ const bt = (e, t) => {
|
|
|
474
474
|
if (u && u.button !== void 0 && u.button !== 0)
|
|
475
475
|
return;
|
|
476
476
|
const v = u?.target || f?.target;
|
|
477
|
-
if (v &&
|
|
477
|
+
if (v && O(v, u || f) || k(v))
|
|
478
478
|
return;
|
|
479
479
|
const I = {
|
|
480
480
|
dataItem: f.dataItem,
|
|
@@ -499,7 +499,7 @@ const bt = (e, t) => {
|
|
|
499
499
|
const W = q.closest(
|
|
500
500
|
".k-table-row[data-grid-row-index], .k-table-row"
|
|
501
501
|
);
|
|
502
|
-
if (!W ||
|
|
502
|
+
if (!W || O(q, f))
|
|
503
503
|
return;
|
|
504
504
|
f.preventDefault(), f.stopPropagation();
|
|
505
505
|
const B = W.getAttribute("data-grid-row-index"), Y = B !== null ? parseInt(B, 10) : void 0;
|
|
@@ -522,7 +522,7 @@ const bt = (e, t) => {
|
|
|
522
522
|
};
|
|
523
523
|
t(J, c);
|
|
524
524
|
},
|
|
525
|
-
isIgnoredTarget:
|
|
525
|
+
isIgnoredTarget: O
|
|
526
526
|
};
|
|
527
527
|
}, Ze = "Enter a valid ZIP code with exactly 5 or 9 digits.", Fe = (e) => {
|
|
528
528
|
const t = e.replace(/\D/g, "").slice(0, 9);
|
|
@@ -533,8 +533,8 @@ const bt = (e, t) => {
|
|
|
533
533
|
), a = y(() => t.value.replace(/\D/g, "")), d = y(() => {
|
|
534
534
|
const x = a.value.length;
|
|
535
535
|
return x === 5 || x === 9;
|
|
536
|
-
}), b = y(() => n.value && !d.value), D = y(() => !n.value || d.value),
|
|
537
|
-
const f = je(
|
|
536
|
+
}), b = y(() => n.value && !d.value), D = y(() => !n.value || d.value), O = y(() => n.value), K = (x, $) => {
|
|
537
|
+
const f = je($);
|
|
538
538
|
j(() => {
|
|
539
539
|
x.isConnected && x.setSelectionRange(f, f);
|
|
540
540
|
});
|
|
@@ -551,10 +551,10 @@ const bt = (e, t) => {
|
|
|
551
551
|
isZipValid: d,
|
|
552
552
|
showZipError: b,
|
|
553
553
|
textBoxValid: D,
|
|
554
|
-
textBoxValidate:
|
|
554
|
+
textBoxValidate: O,
|
|
555
555
|
// actions
|
|
556
556
|
handleZipInput: (...x) => {
|
|
557
|
-
const
|
|
557
|
+
const $ = x[0], u = $?.event?.target, v = $?.value, I = Array.isArray(v) ? v.join("") : String(v ?? ""), q = u?.selectionStart !== void 0 && u.selectionStart !== null ? _e(
|
|
558
558
|
u.value,
|
|
559
559
|
u.selectionStart
|
|
560
560
|
) : I.replace(/\D/g, "").length;
|
|
@@ -562,19 +562,19 @@ const bt = (e, t) => {
|
|
|
562
562
|
},
|
|
563
563
|
submitAndValidate: (x) => {
|
|
564
564
|
n.value = !0;
|
|
565
|
-
const
|
|
566
|
-
return
|
|
565
|
+
const $ = d.value;
|
|
566
|
+
return !$ && x?.focus && j(() => {
|
|
567
567
|
document.getElementById(
|
|
568
568
|
e.id
|
|
569
569
|
)?.focus();
|
|
570
|
-
}),
|
|
570
|
+
}), $;
|
|
571
571
|
},
|
|
572
572
|
buildPayload: () => ({ zip: a.value })
|
|
573
573
|
};
|
|
574
574
|
};
|
|
575
575
|
function Je(e, t) {
|
|
576
576
|
const n = X(!1);
|
|
577
|
-
|
|
577
|
+
Oe(() => {
|
|
578
578
|
e.value?.setAttribute("aria-invalid", String(!t.isValid()));
|
|
579
579
|
});
|
|
580
580
|
function p(d) {
|
|
@@ -595,11 +595,11 @@ function Qe(e, t) {
|
|
|
595
595
|
function D(k) {
|
|
596
596
|
return y(() => !a.value || ne(k));
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function O(k) {
|
|
599
599
|
return Object.fromEntries(
|
|
600
|
-
Object.entries(k).map(([x,
|
|
600
|
+
Object.entries(k).map(([x, $]) => [
|
|
601
601
|
x,
|
|
602
|
-
D(
|
|
602
|
+
D($)
|
|
603
603
|
])
|
|
604
604
|
);
|
|
605
605
|
}
|
|
@@ -626,7 +626,7 @@ function Qe(e, t) {
|
|
|
626
626
|
onFocusout: M,
|
|
627
627
|
reset: R,
|
|
628
628
|
createFieldValidity: D,
|
|
629
|
-
createFieldValidationsMap:
|
|
629
|
+
createFieldValidationsMap: O,
|
|
630
630
|
focusFirstInvalidField: K
|
|
631
631
|
};
|
|
632
632
|
}
|
|
@@ -764,17 +764,17 @@ function kt(e) {
|
|
|
764
764
|
const t = X(
|
|
765
765
|
ne(e.fieldsetRef)
|
|
766
766
|
);
|
|
767
|
-
|
|
767
|
+
Oe(() => {
|
|
768
768
|
t.value = ne(e.fieldsetRef);
|
|
769
769
|
});
|
|
770
770
|
const n = X(!1), p = X(!1), a = y(() => ne(e.required) ?? !0), {
|
|
771
771
|
formData: d,
|
|
772
772
|
onAddress1Input: b,
|
|
773
773
|
onAddress2Input: D,
|
|
774
|
-
onCityInput:
|
|
774
|
+
onCityInput: O,
|
|
775
775
|
onStateChange: K,
|
|
776
776
|
resetFormData: M
|
|
777
|
-
} = tt(), R = `${e.addressId}-zip`, { zipDisplay: k, isZipValid: x, zipWrapperClass:
|
|
777
|
+
} = tt(), R = `${e.addressId}-zip`, { zipDisplay: k, isZipValid: x, zipWrapperClass: $, onZipInput: f, resetZip: u } = nt(d, R), {
|
|
778
778
|
strictAddress1Valid: v,
|
|
779
779
|
strictCityValid: I,
|
|
780
780
|
strictStateValid: q,
|
|
@@ -810,7 +810,7 @@ function kt(e) {
|
|
|
810
810
|
() => a.value ? U.value : !0
|
|
811
811
|
), h = y(
|
|
812
812
|
() => a.value ? _.value : !0
|
|
813
|
-
),
|
|
813
|
+
), L = { value: null, label: "State" }, V = et.map(({ label: m, value: T }) => ({
|
|
814
814
|
label: m,
|
|
815
815
|
value: T
|
|
816
816
|
})), r = y(() => ({
|
|
@@ -819,10 +819,10 @@ function kt(e) {
|
|
|
819
819
|
city: d.city.trim(),
|
|
820
820
|
state: (d.state ?? "").trim().toUpperCase(),
|
|
821
821
|
zip: d.zip.replace(/\D/g, "")
|
|
822
|
-
})), i = y(() => d.address1.trim() === "" && d.address2.trim() === "" && d.city.trim() === "" && (d.state ?? "").trim() === "" && d.zip.replace(/\D/g, "") === ""),
|
|
822
|
+
})), i = y(() => d.address1.trim() === "" && d.address2.trim() === "" && d.city.trim() === "" && (d.state ?? "").trim() === "" && d.zip.replace(/\D/g, "") === ""), P = y(() => !i.value), N = y(() => !a.value && P.value && (!v.value || !I.value || !q.value)), H = y(() => {
|
|
823
823
|
const m = d.zip.replace(/\D/g, "");
|
|
824
|
-
return !a.value &&
|
|
825
|
-
}), te = y(() => !a.value &&
|
|
824
|
+
return !a.value && P.value && m.length !== 5 && m.length !== 9;
|
|
825
|
+
}), te = y(() => !a.value && P.value && !B.value), Z = y(() => !a.value && te.value && (p.value || n.value));
|
|
826
826
|
return le(r, () => {
|
|
827
827
|
a.value || (p.value = !1);
|
|
828
828
|
}), le(a, (m) => {
|
|
@@ -841,13 +841,13 @@ function kt(e) {
|
|
|
841
841
|
optionalPartialInvalid: te,
|
|
842
842
|
optionalMissingRequiredFields: N,
|
|
843
843
|
optionalZipInvalid: H,
|
|
844
|
-
stateDefaultItem:
|
|
844
|
+
stateDefaultItem: L,
|
|
845
845
|
stateOptions: V,
|
|
846
846
|
zipDisplay: k,
|
|
847
|
-
zipWrapperClass:
|
|
847
|
+
zipWrapperClass: $,
|
|
848
848
|
onAddress1Input: b,
|
|
849
849
|
onAddress2Input: D,
|
|
850
|
-
onCityInput:
|
|
850
|
+
onCityInput: O,
|
|
851
851
|
onStateChange: K,
|
|
852
852
|
onZipInput: f,
|
|
853
853
|
onFieldsetFocusout: (m) => {
|
|
@@ -867,7 +867,7 @@ function kt(e) {
|
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
|
-
const
|
|
870
|
+
const Pe = (e) => e === "left" ? "right" : e === "right" ? "left" : "center", $e = (e) => e === "top" ? "bottom" : e === "bottom" ? "top" : "center", Me = (e, t, n, p) => {
|
|
871
871
|
const a = e.left + (n.horizontal === "right" ? e.width : n.horizontal === "center" ? e.width / 2 : 0), d = e.top + (n.vertical === "bottom" ? e.height : n.vertical === "center" ? e.height / 2 : 0), b = t ? p.horizontal === "right" ? t.width : p.horizontal === "center" ? t.width / 2 : 0 : 0, D = t ? p.vertical === "bottom" ? t.height : p.vertical === "center" ? t.height / 2 : 0 : 0;
|
|
872
872
|
return { left: a - b, top: d - D };
|
|
873
873
|
}, lt = ({
|
|
@@ -880,20 +880,20 @@ const $e = (e) => e === "left" ? "right" : e === "right" ? "left" : "center", Pe
|
|
|
880
880
|
const d = Me(e, t, n, p);
|
|
881
881
|
if (!t) return d;
|
|
882
882
|
let { left: b, top: D } = d;
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
883
|
+
const O = b + t.width - a.right, K = a.left - b;
|
|
884
|
+
if (O > 0 || K > 0) {
|
|
885
885
|
const k = Me(
|
|
886
886
|
e,
|
|
887
887
|
t,
|
|
888
888
|
{
|
|
889
|
-
horizontal:
|
|
889
|
+
horizontal: Pe(n.horizontal),
|
|
890
890
|
vertical: n.vertical
|
|
891
891
|
},
|
|
892
892
|
{
|
|
893
|
-
horizontal:
|
|
893
|
+
horizontal: Pe(p.horizontal),
|
|
894
894
|
vertical: p.vertical
|
|
895
895
|
}
|
|
896
|
-
), x = Math.max(
|
|
896
|
+
), x = Math.max(O, 0) + Math.max(K, 0);
|
|
897
897
|
Math.max(k.left + t.width - a.right, 0) + Math.max(a.left - k.left, 0) < x && (b = k.left);
|
|
898
898
|
}
|
|
899
899
|
const M = D + t.height - a.bottom, R = a.top - D;
|
|
@@ -903,11 +903,11 @@ const $e = (e) => e === "left" ? "right" : e === "right" ? "left" : "center", Pe
|
|
|
903
903
|
t,
|
|
904
904
|
{
|
|
905
905
|
horizontal: n.horizontal,
|
|
906
|
-
vertical:
|
|
906
|
+
vertical: $e(n.vertical)
|
|
907
907
|
},
|
|
908
908
|
{
|
|
909
909
|
horizontal: p.horizontal,
|
|
910
|
-
vertical:
|
|
910
|
+
vertical: $e(p.vertical)
|
|
911
911
|
}
|
|
912
912
|
), x = Math.max(M, 0) + Math.max(R, 0);
|
|
913
913
|
Math.max(k.top + t.height - a.bottom, 0) + Math.max(a.top - k.top, 0) < x && (D = k.top);
|
|
@@ -948,10 +948,10 @@ function Ce(...e) {
|
|
|
948
948
|
Ie(Ue(n.value ? e[2] : e[1])),
|
|
949
949
|
ne(n.value ? e[3] : e[2])
|
|
950
950
|
];
|
|
951
|
-
}, ([p, a, d, b], D,
|
|
951
|
+
}, ([p, a, d, b], D, O) => {
|
|
952
952
|
if (!p?.length || !a?.length || !d?.length) return;
|
|
953
953
|
const K = ut(b) ? { ...b } : b, M = p.flatMap((R) => a.flatMap((k) => d.map((x) => t(R, k, x, K))));
|
|
954
|
-
|
|
954
|
+
O(() => {
|
|
955
955
|
M.forEach((R) => R());
|
|
956
956
|
});
|
|
957
957
|
}, { flush: "post" });
|
|
@@ -963,7 +963,7 @@ function Ne(e, t, n = {}) {
|
|
|
963
963
|
cancel: ke,
|
|
964
964
|
trigger: ke
|
|
965
965
|
} : ke;
|
|
966
|
-
let
|
|
966
|
+
let O = !0;
|
|
967
967
|
const K = (u) => ne(a).some((v) => {
|
|
968
968
|
if (typeof v == "string") return Array.from(p.document.querySelectorAll(v)).some((I) => I === u.target || u.composedPath().includes(I));
|
|
969
969
|
{
|
|
@@ -982,15 +982,15 @@ function Ne(e, t, n = {}) {
|
|
|
982
982
|
const k = (u) => {
|
|
983
983
|
const v = we(e);
|
|
984
984
|
if (u.target != null && !(!(v instanceof Element) && M(e) && R(e, u)) && !(!v || v === u.target || u.composedPath().includes(v))) {
|
|
985
|
-
if ("detail" in u && u.detail === 0 && (
|
|
986
|
-
|
|
985
|
+
if ("detail" in u && u.detail === 0 && (O = !K(u)), !O) {
|
|
986
|
+
O = !0;
|
|
987
987
|
return;
|
|
988
988
|
}
|
|
989
989
|
t(u);
|
|
990
990
|
}
|
|
991
991
|
};
|
|
992
992
|
let x = !1;
|
|
993
|
-
const
|
|
993
|
+
const $ = [
|
|
994
994
|
Ce(p, "click", (u) => {
|
|
995
995
|
x || (x = !0, setTimeout(() => {
|
|
996
996
|
x = !1;
|
|
@@ -1001,7 +1001,7 @@ function Ne(e, t, n = {}) {
|
|
|
1001
1001
|
}),
|
|
1002
1002
|
Ce(p, "pointerdown", (u) => {
|
|
1003
1003
|
const v = we(e);
|
|
1004
|
-
|
|
1004
|
+
O = !K(u) && !!(v && !u.composedPath().includes(v));
|
|
1005
1005
|
}, { passive: !0 }),
|
|
1006
1006
|
b && Ce(p, "blur", (u) => {
|
|
1007
1007
|
setTimeout(() => {
|
|
@@ -1011,14 +1011,14 @@ function Ne(e, t, n = {}) {
|
|
|
1011
1011
|
I?.tagName === "IFRAME" && !v?.contains(p.document.activeElement) && t(u);
|
|
1012
1012
|
}, 0);
|
|
1013
1013
|
}, { passive: !0 })
|
|
1014
|
-
].filter(Boolean), f = () =>
|
|
1014
|
+
].filter(Boolean), f = () => $.forEach((u) => u());
|
|
1015
1015
|
return D ? {
|
|
1016
1016
|
stop: f,
|
|
1017
1017
|
cancel: () => {
|
|
1018
|
-
|
|
1018
|
+
O = !1;
|
|
1019
1019
|
},
|
|
1020
1020
|
trigger: (u) => {
|
|
1021
|
-
|
|
1021
|
+
O = !0, k(u), O = !1;
|
|
1022
1022
|
}
|
|
1023
1023
|
} : f;
|
|
1024
1024
|
}
|
|
@@ -1057,7 +1057,7 @@ const dt = (e) => {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
return n;
|
|
1059
1059
|
}, Dt = (e) => {
|
|
1060
|
-
const t = X(null), n = e.menuItemSelector ?? ".k-menu-item:not(.k-disabled)", p = e.triggerMode, a = e.anchor === !0 ? {} : e.anchor, d = a?.activationPoint ? a.activationPoint === !0 ? {} : a.activationPoint : null, b = ye(null), D = ye(null),
|
|
1060
|
+
const t = X(null), n = e.menuItemSelector ?? ".k-menu-item:not(.k-disabled)", p = e.triggerMode, a = e.anchor === !0 ? {} : e.anchor, d = a?.activationPoint ? a.activationPoint === !0 ? {} : a.activationPoint : null, b = ye(null), D = ye(null), O = a?.anchorAlign ?? {
|
|
1061
1061
|
horizontal: "left",
|
|
1062
1062
|
vertical: "bottom"
|
|
1063
1063
|
}, K = a?.popupAlign ?? {
|
|
@@ -1065,7 +1065,7 @@ const dt = (e) => {
|
|
|
1065
1065
|
vertical: "top"
|
|
1066
1066
|
}, M = ye(null), R = () => he(e.triggerRef.value), k = y(() => R()), x = y(
|
|
1067
1067
|
() => a && a.hideWhenAnchorClipped !== !1 ? k.value : null
|
|
1068
|
-
),
|
|
1068
|
+
), $ = () => {
|
|
1069
1069
|
const s = a?.clipRoot ? ne(a.clipRoot) : null;
|
|
1070
1070
|
if (s) {
|
|
1071
1071
|
const h = s.getBoundingClientRect();
|
|
@@ -1085,16 +1085,16 @@ const dt = (e) => {
|
|
|
1085
1085
|
}, f = y(() => {
|
|
1086
1086
|
const s = b.value;
|
|
1087
1087
|
if (!e.isOpen.value || !s) return { left: 0, top: 0 };
|
|
1088
|
-
const h =
|
|
1088
|
+
const h = $(), L = lt({
|
|
1089
1089
|
anchor: s,
|
|
1090
1090
|
popup: M.value,
|
|
1091
|
-
anchorAlign:
|
|
1091
|
+
anchorAlign: O,
|
|
1092
1092
|
popupAlign: K,
|
|
1093
1093
|
bounds: h
|
|
1094
1094
|
});
|
|
1095
1095
|
return {
|
|
1096
|
-
left:
|
|
1097
|
-
top:
|
|
1096
|
+
left: L.left + window.scrollX,
|
|
1097
|
+
top: L.top + window.scrollY
|
|
1098
1098
|
};
|
|
1099
1099
|
}), u = () => {
|
|
1100
1100
|
const s = e.resolveFocusTarget?.() ?? he(e.focusTargetRef?.value);
|
|
@@ -1103,20 +1103,20 @@ const dt = (e) => {
|
|
|
1103
1103
|
) ?? null : null);
|
|
1104
1104
|
}, v = (s, h) => {
|
|
1105
1105
|
if (!d) return !1;
|
|
1106
|
-
const
|
|
1107
|
-
if (!
|
|
1106
|
+
const L = he(s);
|
|
1107
|
+
if (!L)
|
|
1108
1108
|
return D.value = null, !1;
|
|
1109
|
-
const V =
|
|
1109
|
+
const V = L.getBoundingClientRect();
|
|
1110
1110
|
if (h.triggerType === "keyboard") {
|
|
1111
|
-
const r = d.keyboardPosition, i = r?.y ?? "center",
|
|
1111
|
+
const r = d.keyboardPosition, i = r?.y ?? "center", P = typeof i == "number" ? i : i === "top" ? 0 : i === "bottom" ? V.height : V.height / 2;
|
|
1112
1112
|
return D.value = {
|
|
1113
|
-
trigger:
|
|
1114
|
-
point: { x: r?.x ?? 8, y:
|
|
1113
|
+
trigger: L,
|
|
1114
|
+
point: { x: r?.x ?? 8, y: P },
|
|
1115
1115
|
hasMatchedTrigger: !1
|
|
1116
1116
|
}, !0;
|
|
1117
1117
|
}
|
|
1118
1118
|
return h.coordinates ? (D.value = {
|
|
1119
|
-
trigger:
|
|
1119
|
+
trigger: L,
|
|
1120
1120
|
point: {
|
|
1121
1121
|
x: h.coordinates.clientX - V.left + (d.pointerOffset?.x ?? 0),
|
|
1122
1122
|
y: h.coordinates.clientY - V.top + (d.pointerOffset?.y ?? 0)
|
|
@@ -1150,7 +1150,7 @@ const dt = (e) => {
|
|
|
1150
1150
|
};
|
|
1151
1151
|
le(
|
|
1152
1152
|
[k, D],
|
|
1153
|
-
([s], h,
|
|
1153
|
+
([s], h, L) => {
|
|
1154
1154
|
if (!a || !s) {
|
|
1155
1155
|
b.value = null;
|
|
1156
1156
|
return;
|
|
@@ -1173,12 +1173,12 @@ const dt = (e) => {
|
|
|
1173
1173
|
b.value = a.getRect?.(s) ?? s.getBoundingClientRect();
|
|
1174
1174
|
}, i = () => {
|
|
1175
1175
|
V === null && (V = window.requestAnimationFrame(r));
|
|
1176
|
-
},
|
|
1177
|
-
|
|
1176
|
+
}, P = typeof window.ResizeObserver == "function" ? new window.ResizeObserver(i) : null;
|
|
1177
|
+
P?.observe(s), window.addEventListener("scroll", i, {
|
|
1178
1178
|
capture: !0,
|
|
1179
1179
|
passive: !0
|
|
1180
|
-
}), window.addEventListener("resize", i, { passive: !0 }), i(),
|
|
1181
|
-
V !== null && window.cancelAnimationFrame(V),
|
|
1180
|
+
}), window.addEventListener("resize", i, { passive: !0 }), i(), L(() => {
|
|
1181
|
+
V !== null && window.cancelAnimationFrame(V), P?.disconnect(), window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
|
|
1182
1182
|
});
|
|
1183
1183
|
},
|
|
1184
1184
|
{ immediate: !0, flush: "post" }
|
|
@@ -1186,7 +1186,7 @@ const dt = (e) => {
|
|
|
1186
1186
|
const g = () => he(e.popupContentRef?.value ?? e.menuRef.value);
|
|
1187
1187
|
a && le(
|
|
1188
1188
|
e.isOpen,
|
|
1189
|
-
(s, h,
|
|
1189
|
+
(s, h, L) => {
|
|
1190
1190
|
if (!s) {
|
|
1191
1191
|
M.value = null;
|
|
1192
1192
|
return;
|
|
@@ -1198,8 +1198,8 @@ const dt = (e) => {
|
|
|
1198
1198
|
M.value = H?.getBoundingClientRect() ?? null;
|
|
1199
1199
|
}, i = () => {
|
|
1200
1200
|
V === null && (V = window.requestAnimationFrame(r));
|
|
1201
|
-
},
|
|
1202
|
-
N?.observe(
|
|
1201
|
+
}, P = g(), N = P && typeof window.ResizeObserver == "function" ? new window.ResizeObserver(i) : null;
|
|
1202
|
+
N?.observe(P), i(), L(() => {
|
|
1203
1203
|
V !== null && window.cancelAnimationFrame(V), N?.disconnect();
|
|
1204
1204
|
});
|
|
1205
1205
|
},
|
|
@@ -1230,8 +1230,8 @@ const dt = (e) => {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
w && w !== h && E(), h.setAttribute("aria-expanded", s ? "true" : "false"), w = h;
|
|
1232
1232
|
}, U = () => {
|
|
1233
|
-
const s = he(e.menuRef.value), h = s?.matches('[role="menubar"]') ? s : s?.querySelector('[role="menubar"]'),
|
|
1234
|
-
C && C !== h && C.removeAttribute("aria-label"), h && (
|
|
1233
|
+
const s = he(e.menuRef.value), h = s?.matches('[role="menubar"]') ? s : s?.querySelector('[role="menubar"]'), L = ne(e.menuLabel)?.trim();
|
|
1234
|
+
C && C !== h && C.removeAttribute("aria-label"), h && (L ? h.setAttribute("aria-label", L) : h.removeAttribute("aria-label")), C = h ?? null;
|
|
1235
1235
|
};
|
|
1236
1236
|
le(
|
|
1237
1237
|
[e.isOpen, e.triggerRef],
|
|
@@ -1289,9 +1289,9 @@ const dt = (e) => {
|
|
|
1289
1289
|
* closes an open menu or focuses the configured target when already closed.
|
|
1290
1290
|
*/
|
|
1291
1291
|
handleTriggerKeydown: (...s) => {
|
|
1292
|
-
const h = s[0],
|
|
1292
|
+
const h = s[0], L = s[1];
|
|
1293
1293
|
if (h.key === "Enter" || h.code === "Space") {
|
|
1294
|
-
h.preventDefault(), _(
|
|
1294
|
+
h.preventDefault(), _(L);
|
|
1295
1295
|
return;
|
|
1296
1296
|
}
|
|
1297
1297
|
if (h.key === "Escape") {
|
|
@@ -1333,8 +1333,8 @@ const dt = (e) => {
|
|
|
1333
1333
|
const t = e && "$el" in e ? e.$el : null;
|
|
1334
1334
|
return t instanceof HTMLElement ? t : null;
|
|
1335
1335
|
}, xt = () => {
|
|
1336
|
-
const e = Be(/* @__PURE__ */ new Map()), t = X(null), n = (D,
|
|
1337
|
-
const K = gt(
|
|
1336
|
+
const e = Be(/* @__PURE__ */ new Map()), t = X(null), n = (D, O) => {
|
|
1337
|
+
const K = gt(O);
|
|
1338
1338
|
K ? e.set(D, K) : e.delete(D);
|
|
1339
1339
|
}, p = (D) => e.get(D) ?? null, a = (D) => {
|
|
1340
1340
|
t.value = D;
|
|
@@ -1355,13 +1355,13 @@ const dt = (e) => {
|
|
|
1355
1355
|
};
|
|
1356
1356
|
};
|
|
1357
1357
|
function Mt(e) {
|
|
1358
|
-
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(e.dateFormat ?? "mm/dd/yyyy"), d = y(() => !!e.required), b = 1e3, D = X(!1),
|
|
1358
|
+
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(e.dateFormat ?? "mm/dd/yyyy"), d = y(() => !!e.required), b = 1e3, D = X(!1), O = ["ArrowUp", "ArrowDown"], K = ["ArrowLeft", "ArrowRight"], M = y(() => (t.value ?? "").replace(/\D/g, "")), R = (o) => o <= 2 ? "mm" : o <= 5 ? "dd" : M.value.length <= 10 ? "yyyy" : "mm", k = y(() => {
|
|
1359
1359
|
const o = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
|
|
1360
1360
|
return parseInt(o).toString().padStart(2, "0");
|
|
1361
1361
|
}), x = y(() => {
|
|
1362
1362
|
const o = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
|
|
1363
1363
|
return parseInt(o).toString().padStart(2, "0");
|
|
1364
|
-
}),
|
|
1364
|
+
}), $ = y(() => {
|
|
1365
1365
|
const o = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
|
|
1366
1366
|
return parseInt(o).toString().padStart(4, "0");
|
|
1367
1367
|
}), f = (o) => {
|
|
@@ -1374,9 +1374,9 @@ function Mt(e) {
|
|
|
1374
1374
|
return;
|
|
1375
1375
|
}
|
|
1376
1376
|
if ((t.value ?? "").length === 10 && M.value.length === 8) {
|
|
1377
|
-
const [S, s, h] = t.value.split("/"),
|
|
1378
|
-
if (B(r,
|
|
1379
|
-
const i = q(r,
|
|
1377
|
+
const [S, s, h] = t.value.split("/"), L = parseInt(S), V = parseInt(s), r = parseInt(h);
|
|
1378
|
+
if (B(r, L, V)) {
|
|
1379
|
+
const i = q(r, L, V);
|
|
1380
1380
|
u(i) ? e.onChange({ value: i, event: o }) : e.onChange({ value: null, event: o });
|
|
1381
1381
|
} else
|
|
1382
1382
|
e.onChange({ value: null, event: o });
|
|
@@ -1386,9 +1386,9 @@ function Mt(e) {
|
|
|
1386
1386
|
return !(S && o < S || s && o > s);
|
|
1387
1387
|
}, v = y(() => {
|
|
1388
1388
|
if ((t.value ?? "").length === 10 && M.value.length === 8) {
|
|
1389
|
-
const [o, S, s] = (t.value ?? "").split("/"), h = parseInt(o),
|
|
1390
|
-
if (B(V, h,
|
|
1391
|
-
return q(V, h,
|
|
1389
|
+
const [o, S, s] = (t.value ?? "").split("/"), h = parseInt(o), L = parseInt(S), V = parseInt(s);
|
|
1390
|
+
if (B(V, h, L))
|
|
1391
|
+
return q(V, h, L);
|
|
1392
1392
|
}
|
|
1393
1393
|
return null;
|
|
1394
1394
|
}), I = y(() => (t.value ?? "").length === 10 && M.value.length === 8), q = (o, S, s) => {
|
|
@@ -1403,25 +1403,25 @@ function Mt(e) {
|
|
|
1403
1403
|
}, c = (o, S, s) => {
|
|
1404
1404
|
const h = S?.selectionStart ?? n.value ?? 0;
|
|
1405
1405
|
n.value = h;
|
|
1406
|
-
let
|
|
1407
|
-
if (!(M.value.length >= 8) || !B(r,
|
|
1406
|
+
let L = parseInt(k.value), V = parseInt(x.value), r = parseInt($.value);
|
|
1407
|
+
if (!(M.value.length >= 8) || !B(r, L, V)) {
|
|
1408
1408
|
const G = e.defaultValue ?? /* @__PURE__ */ new Date();
|
|
1409
|
-
|
|
1409
|
+
L = G.getMonth() + 1, V = G.getDate(), r = G.getFullYear(), t.value = `${String(L).padStart(2, "0")}/${String(V).padStart(
|
|
1410
1410
|
2,
|
|
1411
1411
|
"0"
|
|
1412
1412
|
)}/${String(r)}`;
|
|
1413
|
-
const ce = q(r,
|
|
1413
|
+
const ce = q(r, L, V);
|
|
1414
1414
|
e.onChange({ value: u(ce) ? ce : null, event: s }), E({ useRAF: !0 });
|
|
1415
1415
|
return;
|
|
1416
1416
|
}
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1419
|
-
|
|
1420
|
-
else if (
|
|
1421
|
-
const G = new Date(r,
|
|
1417
|
+
const P = R(h);
|
|
1418
|
+
if (P === "mm")
|
|
1419
|
+
L = o === "ArrowUp" ? L < 12 ? L + 1 : 1 : L > 1 ? L - 1 : 12;
|
|
1420
|
+
else if (P === "dd") {
|
|
1421
|
+
const G = new Date(r, L, 0).getDate();
|
|
1422
1422
|
V = o === "ArrowUp" ? V < G ? V + 1 : 1 : V > 1 ? V - 1 : G;
|
|
1423
|
-
} else
|
|
1424
|
-
t.value = `${String(
|
|
1423
|
+
} else P === "yyyy" && (r = o === "ArrowUp" ? r + 1 : Math.max(1, r - 1));
|
|
1424
|
+
t.value = `${String(L).padStart(2, "0")}/${String(V).padStart(
|
|
1425
1425
|
2,
|
|
1426
1426
|
"0"
|
|
1427
1427
|
)}/${String(r)}`;
|
|
@@ -1443,7 +1443,7 @@ function Mt(e) {
|
|
|
1443
1443
|
o.preventDefault(), o.stopPropagation(), e.onShowCalendar(o);
|
|
1444
1444
|
return;
|
|
1445
1445
|
}
|
|
1446
|
-
if (
|
|
1446
|
+
if (O.includes(o.key)) {
|
|
1447
1447
|
if (o.altKey) return;
|
|
1448
1448
|
o.preventDefault(), o.stopPropagation();
|
|
1449
1449
|
const S = o.target;
|
|
@@ -1460,7 +1460,7 @@ function Mt(e) {
|
|
|
1460
1460
|
n.value = S?.selectionStart ?? 0;
|
|
1461
1461
|
return;
|
|
1462
1462
|
}
|
|
1463
|
-
if (
|
|
1463
|
+
if (O.includes(o.key)) {
|
|
1464
1464
|
if (o.altKey) return;
|
|
1465
1465
|
n.value = S?.selectionStart ?? 0;
|
|
1466
1466
|
}
|
|
@@ -1498,8 +1498,8 @@ function Mt(e) {
|
|
|
1498
1498
|
if (o) {
|
|
1499
1499
|
const S = new Date(o);
|
|
1500
1500
|
if (S.toString() !== "Invalid Date") {
|
|
1501
|
-
const s = (S.getMonth() + 1).toString().padStart(2, "0"), h = S.getDate().toString().padStart(2, "0"),
|
|
1502
|
-
t.value = `${s}/${h}/${
|
|
1501
|
+
const s = (S.getMonth() + 1).toString().padStart(2, "0"), h = S.getDate().toString().padStart(2, "0"), L = S.getFullYear().toString();
|
|
1502
|
+
t.value = `${s}/${h}/${L}`, E({ delay: 50 });
|
|
1503
1503
|
return;
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
@@ -1507,7 +1507,7 @@ function Mt(e) {
|
|
|
1507
1507
|
{ immediate: !0 }
|
|
1508
1508
|
);
|
|
1509
1509
|
const F = y(() => [
|
|
1510
|
-
["Date", `${k.value} / ${x.value} / ${
|
|
1510
|
+
["Date", `${k.value} / ${x.value} / ${$.value}`],
|
|
1511
1511
|
["Digits only", M.value],
|
|
1512
1512
|
[
|
|
1513
1513
|
"min",
|
|
@@ -1606,7 +1606,7 @@ function Mt(e) {
|
|
|
1606
1606
|
digitsOnly: M,
|
|
1607
1607
|
month: ee(k),
|
|
1608
1608
|
day: ee(x),
|
|
1609
|
-
year: ee(
|
|
1609
|
+
year: ee($),
|
|
1610
1610
|
datePart: R,
|
|
1611
1611
|
handleChange: Y,
|
|
1612
1612
|
handleKeyDown: A,
|
|
@@ -1619,9 +1619,9 @@ function Mt(e) {
|
|
|
1619
1619
|
};
|
|
1620
1620
|
}
|
|
1621
1621
|
function It(e) {
|
|
1622
|
-
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(!1), d = 1440 * 60 * 1e3, b = 365 * d, D = /* @__PURE__ */ new Date(),
|
|
1623
|
-
e.min = e.min ??
|
|
1624
|
-
const M = y(() => (t.value ?? "").replace(/\D/g, "")), R = (l, m) => new Date(l, m, 0).getDate(), k = (l, m, T) => m >= 1 && m <= 12 && l >= 1e3 && T >= 1 && T <= R(l, m), x = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate()),
|
|
1622
|
+
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(!1), d = 1440 * 60 * 1e3, b = 365 * d, D = /* @__PURE__ */ new Date(), O = new Date(D.getTime() - b), K = new Date(D.getTime() + b);
|
|
1623
|
+
e.min = e.min ?? O, e.max = e.max ?? K;
|
|
1624
|
+
const M = y(() => (t.value ?? "").replace(/\D/g, "")), R = (l, m) => new Date(l, m, 0).getDate(), k = (l, m, T) => m >= 1 && m <= 12 && l >= 1e3 && T >= 1 && T <= R(l, m), x = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate()), $ = (l) => {
|
|
1625
1625
|
if (!l) return null;
|
|
1626
1626
|
const m = e.min ?? new Date(Date.now() - 90 * d), T = e.max ?? /* @__PURE__ */ new Date(), z = x(l);
|
|
1627
1627
|
return z < x(m) || z > x(T) ? null : l;
|
|
@@ -1631,7 +1631,7 @@ function It(e) {
|
|
|
1631
1631
|
const m = l.substring(0, 10), T = l.substring(13, 23), [z, ae, oe] = m.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, me, ve] = T.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(oe, z - 1, ae), be = new Date(ve, fe - 1, me), Ae = k(oe, z, ae) && ge.toString() !== "Invalid Date", De = k(ve, fe, me) && be.toString() !== "Invalid Date";
|
|
1632
1632
|
return { start: Ae ? ge : null, end: De ? be : null };
|
|
1633
1633
|
}, I = e.externalValid ?? X(!0), q = y(() => v(t.value)), W = y(() => {
|
|
1634
|
-
const l =
|
|
1634
|
+
const l = $(q.value.start), m = $(q.value.end);
|
|
1635
1635
|
return { start: l, end: m };
|
|
1636
1636
|
}), B = y(() => {
|
|
1637
1637
|
if (!u.value) return;
|
|
@@ -1707,7 +1707,7 @@ function It(e) {
|
|
|
1707
1707
|
me.side === "start" ? be(ve, me.part) : be(ge, me.part);
|
|
1708
1708
|
const Ae = E(ve), De = E(ge);
|
|
1709
1709
|
t.value = `${Ae} - ${De}`;
|
|
1710
|
-
const pe =
|
|
1710
|
+
const pe = $(ve), Ee = $(ge);
|
|
1711
1711
|
pe && Ee && f(pe, Ee) ? e.onChange({ value: { start: pe, end: Ee }, event: T }) : e.onChange({ value: null, event: T }), j(() => {
|
|
1712
1712
|
requestAnimationFrame(() => {
|
|
1713
1713
|
const Q = document.getElementById(
|
|
@@ -1722,7 +1722,7 @@ function It(e) {
|
|
|
1722
1722
|
e.onChange({ value: null, event: l });
|
|
1723
1723
|
return;
|
|
1724
1724
|
}
|
|
1725
|
-
const z =
|
|
1725
|
+
const z = $(m), ae = $(T);
|
|
1726
1726
|
if (!z || !ae) {
|
|
1727
1727
|
e.onChange({ value: null, event: l });
|
|
1728
1728
|
return;
|
|
@@ -1769,7 +1769,7 @@ function It(e) {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
}, h = () => {
|
|
1771
1771
|
Y.value = !0, (e.manageValid ?? !0) && (I.value = c.value);
|
|
1772
|
-
},
|
|
1772
|
+
}, L = (l) => {
|
|
1773
1773
|
h();
|
|
1774
1774
|
}, V = (l) => {
|
|
1775
1775
|
t.value = "", n.value = 0, e.onChange({ value: null, event: l }), h(), j(() => {
|
|
@@ -1799,7 +1799,7 @@ function It(e) {
|
|
|
1799
1799
|
() => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
|
|
1800
1800
|
), i = y(
|
|
1801
1801
|
() => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
|
|
1802
|
-
),
|
|
1802
|
+
), P = y(
|
|
1803
1803
|
() => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
|
|
1804
1804
|
), N = y(
|
|
1805
1805
|
() => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
|
|
@@ -1826,7 +1826,7 @@ function It(e) {
|
|
|
1826
1826
|
label: "Start",
|
|
1827
1827
|
value: `${String(r.value).padStart(2, "0")} / ${String(
|
|
1828
1828
|
i.value
|
|
1829
|
-
).padStart(2, "0")} / ${String(
|
|
1829
|
+
).padStart(2, "0")} / ${String(P.value).padStart(4, "0")}`
|
|
1830
1830
|
},
|
|
1831
1831
|
{
|
|
1832
1832
|
label: "End",
|
|
@@ -1917,7 +1917,7 @@ function It(e) {
|
|
|
1917
1917
|
spanDays: ee(B),
|
|
1918
1918
|
month1: ee(r),
|
|
1919
1919
|
day1: ee(i),
|
|
1920
|
-
year1: ee(
|
|
1920
|
+
year1: ee(P),
|
|
1921
1921
|
month2: ee(N),
|
|
1922
1922
|
day2: ee(H),
|
|
1923
1923
|
year2: ee(te),
|
|
@@ -1926,7 +1926,7 @@ function It(e) {
|
|
|
1926
1926
|
handleWheel: S,
|
|
1927
1927
|
handleKeyUp: s,
|
|
1928
1928
|
handleClick: ue,
|
|
1929
|
-
handleBlur:
|
|
1929
|
+
handleBlur: L,
|
|
1930
1930
|
handleClear: V,
|
|
1931
1931
|
onCalendarChange: () => {
|
|
1932
1932
|
a.value = !0;
|
|
@@ -1935,7 +1935,7 @@ function It(e) {
|
|
|
1935
1935
|
};
|
|
1936
1936
|
}
|
|
1937
1937
|
function Ct(e) {
|
|
1938
|
-
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(e.timeFormat ?? "hh:mm AM"), d = y(() => !!e.required), b = X(!1), D = ["ArrowUp", "ArrowDown"],
|
|
1938
|
+
const t = X(""), n = X(void 0), p = X(!!e.debug), a = X(e.timeFormat ?? "hh:mm AM"), d = y(() => !!e.required), b = X(!1), D = ["ArrowUp", "ArrowDown"], O = ["ArrowLeft", "ArrowRight"], K = y(() => (t.value ?? "").replace(/\D/g, "")), M = {
|
|
1939
1939
|
H: /[0-9]/,
|
|
1940
1940
|
h: /[0-9]/,
|
|
1941
1941
|
M: /[0-9]/,
|
|
@@ -1948,23 +1948,23 @@ function Ct(e) {
|
|
|
1948
1948
|
}), x = y(() => {
|
|
1949
1949
|
const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(r);
|
|
1950
1950
|
return Math.min(Math.max(i, 0), 59);
|
|
1951
|
-
}),
|
|
1952
|
-
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i =
|
|
1951
|
+
}), $ = y(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), f = y(() => {
|
|
1952
|
+
const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = $.value;
|
|
1953
1953
|
return r === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? r + 12 : r;
|
|
1954
1954
|
}), u = y(() => v.value ? `${String(f.value).padStart(2, "0")}:${String(x.value).padStart(2, "0")}:00` : null), v = y(
|
|
1955
1955
|
() => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
|
|
1956
|
-
), I = (r, i,
|
|
1956
|
+
), I = (r, i, P) => {
|
|
1957
1957
|
let N = r % 12;
|
|
1958
1958
|
return N === 0 && (N = 12), `${String(N).padStart(2, "0")}:${String(i).padStart(
|
|
1959
1959
|
2,
|
|
1960
1960
|
"0"
|
|
1961
|
-
)} ${
|
|
1961
|
+
)} ${P}`;
|
|
1962
1962
|
}, q = (r) => {
|
|
1963
1963
|
const i = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
1964
1964
|
if (!i) return null;
|
|
1965
|
-
const
|
|
1966
|
-
if (
|
|
1967
|
-
let te =
|
|
1965
|
+
const P = parseInt(i[1]), N = parseInt(i[2]), H = i[3].toUpperCase();
|
|
1966
|
+
if (P < 1 || P > 12 || N < 0 || N > 59) return null;
|
|
1967
|
+
let te = P % 12;
|
|
1968
1968
|
H === "PM" && (te += 12);
|
|
1969
1969
|
const Z = /* @__PURE__ */ new Date();
|
|
1970
1970
|
return Z.setSeconds(0, 0), Z.setHours(te), Z.setMinutes(N), Z;
|
|
@@ -1980,19 +1980,19 @@ function Ct(e) {
|
|
|
1980
1980
|
const i = q(t.value);
|
|
1981
1981
|
i && Y(i) ? e.onChange({ value: i, event: r }) : e.onChange({ value: null, event: r });
|
|
1982
1982
|
}, B = (r) => r.getHours() * 60 + r.getMinutes(), Y = (r) => {
|
|
1983
|
-
const i = e.min ?? void 0,
|
|
1983
|
+
const i = e.min ?? void 0, P = e.max ?? void 0, N = B(r);
|
|
1984
1984
|
if (i) {
|
|
1985
1985
|
const H = B(i);
|
|
1986
1986
|
if (N < H) return !1;
|
|
1987
1987
|
}
|
|
1988
|
-
if (
|
|
1989
|
-
const H = B(
|
|
1988
|
+
if (P) {
|
|
1989
|
+
const H = B(P);
|
|
1990
1990
|
if (N > H) return !1;
|
|
1991
1991
|
}
|
|
1992
1992
|
return !0;
|
|
1993
1993
|
}, J = (r) => {
|
|
1994
|
-
const i = r.getHours(),
|
|
1995
|
-
t.value = I(i, r.getMinutes(),
|
|
1994
|
+
const i = r.getHours(), P = i >= 12 ? "PM" : "AM";
|
|
1995
|
+
t.value = I(i, r.getMinutes(), P);
|
|
1996
1996
|
}, c = (r, i) => {
|
|
1997
1997
|
e.onChange({ value: r, event: i });
|
|
1998
1998
|
}, A = () => {
|
|
@@ -2018,15 +2018,15 @@ function Ct(e) {
|
|
|
2018
2018
|
}, C = (...r) => {
|
|
2019
2019
|
const i = r[0];
|
|
2020
2020
|
if (!i) return;
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2021
|
+
const P = g(i);
|
|
2022
|
+
if (P === "now") {
|
|
2023
2023
|
const H = /* @__PURE__ */ new Date();
|
|
2024
2024
|
J(H), w(H, i), A();
|
|
2025
2025
|
return;
|
|
2026
2026
|
}
|
|
2027
2027
|
if (i?.value instanceof Date) {
|
|
2028
2028
|
const H = new Date(i.value);
|
|
2029
|
-
J(H), w(H, i),
|
|
2029
|
+
J(H), w(H, i), P === "set" && A();
|
|
2030
2030
|
return;
|
|
2031
2031
|
}
|
|
2032
2032
|
if (i?.value === null) {
|
|
@@ -2061,7 +2061,7 @@ function Ct(e) {
|
|
|
2061
2061
|
W(i);
|
|
2062
2062
|
}, E = (r) => {
|
|
2063
2063
|
n.value = r.target.selectionStart ?? 0;
|
|
2064
|
-
}, F = (r, i,
|
|
2064
|
+
}, F = (r, i, P) => {
|
|
2065
2065
|
const N = i?.selectionStart ?? n.value ?? 0;
|
|
2066
2066
|
n.value = N;
|
|
2067
2067
|
const H = R(N), te = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
|
|
@@ -2070,7 +2070,7 @@ function Ct(e) {
|
|
|
2070
2070
|
const m = /* @__PURE__ */ new Date(), T = m.getHours(), z = T >= 12 ? "PM" : "AM";
|
|
2071
2071
|
t.value = I(T, m.getMinutes(), z);
|
|
2072
2072
|
const ae = q(t.value);
|
|
2073
|
-
w(ae,
|
|
2073
|
+
w(ae, P), j(() => {
|
|
2074
2074
|
requestAnimationFrame(() => {
|
|
2075
2075
|
const oe = document.getElementById(
|
|
2076
2076
|
e.id
|
|
@@ -2103,7 +2103,7 @@ function Ct(e) {
|
|
|
2103
2103
|
"0"
|
|
2104
2104
|
)} ${ce}`;
|
|
2105
2105
|
const l = q(t.value);
|
|
2106
|
-
w(l,
|
|
2106
|
+
w(l, P), j(() => {
|
|
2107
2107
|
requestAnimationFrame(() => {
|
|
2108
2108
|
const m = document.getElementById(
|
|
2109
2109
|
e.id
|
|
@@ -2133,7 +2133,7 @@ function Ct(e) {
|
|
|
2133
2133
|
F(i, r.target, r);
|
|
2134
2134
|
}, re = (r) => {
|
|
2135
2135
|
const i = r.target;
|
|
2136
|
-
if (
|
|
2136
|
+
if (O.includes(r.key)) {
|
|
2137
2137
|
n.value = i?.selectionStart ?? 0;
|
|
2138
2138
|
return;
|
|
2139
2139
|
}
|
|
@@ -2152,8 +2152,8 @@ function Ct(e) {
|
|
|
2152
2152
|
if (r) {
|
|
2153
2153
|
const i = new Date(r);
|
|
2154
2154
|
if (i.toString() !== "Invalid Date") {
|
|
2155
|
-
const
|
|
2156
|
-
t.value = I(
|
|
2155
|
+
const P = i.getHours(), N = P >= 12 ? "PM" : "AM";
|
|
2156
|
+
t.value = I(P, i.getMinutes(), N);
|
|
2157
2157
|
return;
|
|
2158
2158
|
}
|
|
2159
2159
|
}
|
|
@@ -2165,7 +2165,7 @@ function Ct(e) {
|
|
|
2165
2165
|
["Hour (12h)", k.value],
|
|
2166
2166
|
["Hour (24h)", f.value],
|
|
2167
2167
|
["Minute", x.value],
|
|
2168
|
-
["Period",
|
|
2168
|
+
["Period", $.value],
|
|
2169
2169
|
["Time (24h)", u.value ?? "--:--:--"],
|
|
2170
2170
|
["Digits only", K.value],
|
|
2171
2171
|
[
|
|
@@ -2191,7 +2191,7 @@ function Ct(e) {
|
|
|
2191
2191
|
],
|
|
2192
2192
|
["valid", s.value],
|
|
2193
2193
|
["reason", h.value],
|
|
2194
|
-
["validationMessage",
|
|
2194
|
+
["validationMessage", L.value]
|
|
2195
2195
|
]), S = y(
|
|
2196
2196
|
() => q(t.value) ?? null
|
|
2197
2197
|
), s = y(() => {
|
|
@@ -2214,7 +2214,7 @@ function Ct(e) {
|
|
|
2214
2214
|
return "incomplete";
|
|
2215
2215
|
const r = S.value;
|
|
2216
2216
|
return r ? Y(r) ? "valid" : "out-of-bounds" : "invalid-time";
|
|
2217
|
-
}),
|
|
2217
|
+
}), L = y(() => {
|
|
2218
2218
|
const r = h.value;
|
|
2219
2219
|
if (!r || r === "valid") return "";
|
|
2220
2220
|
if (r === "incomplete")
|
|
@@ -2224,10 +2224,10 @@ function Ct(e) {
|
|
|
2224
2224
|
const i = {
|
|
2225
2225
|
hour: "2-digit",
|
|
2226
2226
|
minute: "2-digit"
|
|
2227
|
-
},
|
|
2227
|
+
}, P = e.min ? e.min.toLocaleTimeString("en-US", i) : null, N = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
|
|
2228
2228
|
if (r === "out-of-bounds") {
|
|
2229
|
-
if (
|
|
2230
|
-
if (
|
|
2229
|
+
if (P && N) return `Must be between ${P} and ${N}.`;
|
|
2230
|
+
if (P) return `Must be ${P} or later.`;
|
|
2231
2231
|
if (N) return `Must be ${N} or earlier.`;
|
|
2232
2232
|
}
|
|
2233
2233
|
return "";
|
|
@@ -2245,14 +2245,14 @@ function Ct(e) {
|
|
|
2245
2245
|
);
|
|
2246
2246
|
return;
|
|
2247
2247
|
}
|
|
2248
|
-
const
|
|
2249
|
-
if (
|
|
2248
|
+
const P = i.parentElement;
|
|
2249
|
+
if (!P) {
|
|
2250
2250
|
console.warn(
|
|
2251
2251
|
`Parent of .k-timepicker not found for #${e.id} styling.`
|
|
2252
2252
|
);
|
|
2253
2253
|
return;
|
|
2254
2254
|
}
|
|
2255
|
-
|
|
2255
|
+
P.classList.contains("fk-timepicker") || P.classList.add("fk-timepicker");
|
|
2256
2256
|
});
|
|
2257
2257
|
};
|
|
2258
2258
|
return Re(() => {
|
|
@@ -2265,14 +2265,14 @@ function Ct(e) {
|
|
|
2265
2265
|
placeholder: a,
|
|
2266
2266
|
isValid: s,
|
|
2267
2267
|
reason: ee(h),
|
|
2268
|
-
validationMessage:
|
|
2268
|
+
validationMessage: L,
|
|
2269
2269
|
isComplete: v,
|
|
2270
2270
|
inRangeTime: Y,
|
|
2271
2271
|
cursorPos: n,
|
|
2272
2272
|
hour: ee(k),
|
|
2273
2273
|
hour24: ee(f),
|
|
2274
2274
|
minute: ee(x),
|
|
2275
|
-
period: ee(
|
|
2275
|
+
period: ee($),
|
|
2276
2276
|
time24: ee(u),
|
|
2277
2277
|
parsedRawTime: ee(S),
|
|
2278
2278
|
handleChange: C,
|
|
@@ -2285,7 +2285,13 @@ function Ct(e) {
|
|
|
2285
2285
|
initStyling: V
|
|
2286
2286
|
};
|
|
2287
2287
|
}
|
|
2288
|
-
|
|
2288
|
+
const Tt = {
|
|
2289
|
+
returnFocusToTrigger: !1,
|
|
2290
|
+
focusTrapOptions: {
|
|
2291
|
+
returnFocusOnDeactivate: !1
|
|
2292
|
+
}
|
|
2293
|
+
};
|
|
2294
|
+
function Rt(e) {
|
|
2289
2295
|
const t = ye(null), n = [
|
|
2290
2296
|
".k-animation-container .k-popup",
|
|
2291
2297
|
".k-popup",
|
|
@@ -2305,16 +2311,16 @@ function Tt(e) {
|
|
|
2305
2311
|
initialFocus: () => a(t.value),
|
|
2306
2312
|
...e.focusTrapOptions ?? {}
|
|
2307
2313
|
});
|
|
2308
|
-
let D = null,
|
|
2314
|
+
let D = null, O = X(null);
|
|
2309
2315
|
const K = () => {
|
|
2310
2316
|
if (e.resolvePopupEl) return e.resolvePopupEl();
|
|
2311
2317
|
const M = (k, x) => {
|
|
2312
|
-
const
|
|
2313
|
-
if (
|
|
2314
|
-
const f =
|
|
2318
|
+
const $ = Array.from(k.querySelectorAll(x));
|
|
2319
|
+
if (!$.length) return null;
|
|
2320
|
+
const f = $.filter(
|
|
2315
2321
|
(u) => u.offsetParent !== null || u.getClientRects().length > 0
|
|
2316
2322
|
);
|
|
2317
|
-
return f[f.length - 1] ??
|
|
2323
|
+
return f[f.length - 1] ?? $[$.length - 1] ?? null;
|
|
2318
2324
|
}, R = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
|
|
2319
2325
|
for (const k of p) {
|
|
2320
2326
|
const x = M(R, k);
|
|
@@ -2327,11 +2333,11 @@ function Tt(e) {
|
|
|
2327
2333
|
return null;
|
|
2328
2334
|
};
|
|
2329
2335
|
return Ne(t, (M) => {
|
|
2330
|
-
|
|
2336
|
+
O.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", M);
|
|
2331
2337
|
}), le(
|
|
2332
2338
|
() => e.isOpen.value,
|
|
2333
2339
|
(M) => {
|
|
2334
|
-
M ? (
|
|
2340
|
+
M ? (O.value = null, j(() => {
|
|
2335
2341
|
const R = K();
|
|
2336
2342
|
R && (R.tabIndex < 0 && (R.tabIndex = -1), t.value = R, setTimeout(() => {
|
|
2337
2343
|
try {
|
|
@@ -2343,15 +2349,15 @@ function Tt(e) {
|
|
|
2343
2349
|
);
|
|
2344
2350
|
}
|
|
2345
2351
|
}, 0), D || (D = (k) => {
|
|
2346
|
-
k.key === "Escape" && (
|
|
2352
|
+
k.key === "Escape" && (O.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", k));
|
|
2347
2353
|
}, document.addEventListener("keydown", D, !0)));
|
|
2348
|
-
})) : (b(), D && (document.removeEventListener("keydown", D, !0), D = null), t.value = null,
|
|
2354
|
+
})) : (b(), D && (document.removeEventListener("keydown", D, !0), D = null), t.value = null, O.value === "outside" && j(() => {
|
|
2349
2355
|
const R = () => {
|
|
2350
|
-
const k = e.triggerEl?.value, x = k?.querySelector("input"),
|
|
2351
|
-
|
|
2356
|
+
const k = e.triggerEl?.value, x = k?.querySelector("input"), $ = document.activeElement;
|
|
2357
|
+
$ && ($ === x || k && k.contains($)) && (x ?? k)?.blur?.();
|
|
2352
2358
|
};
|
|
2353
2359
|
requestAnimationFrame(() => setTimeout(R, 0));
|
|
2354
|
-
}), e.returnFocusToTrigger !== !1 &&
|
|
2360
|
+
}), e.returnFocusToTrigger !== !1 && O.value === "escape" && e.triggerEl?.value && j(() => {
|
|
2355
2361
|
const R = () => {
|
|
2356
2362
|
const k = e.triggerEl?.value;
|
|
2357
2363
|
if (!k) return;
|
|
@@ -2364,11 +2370,12 @@ function Tt(e) {
|
|
|
2364
2370
|
popupRef: t,
|
|
2365
2371
|
activate: d,
|
|
2366
2372
|
deactivate: b,
|
|
2367
|
-
lastCloseReason: ee(
|
|
2373
|
+
lastCloseReason: ee(O),
|
|
2368
2374
|
setPopupEl: (M) => t.value = M
|
|
2369
2375
|
};
|
|
2370
2376
|
}
|
|
2371
2377
|
export {
|
|
2378
|
+
Tt as POPUP_MENU_TRAP_OPTIONS,
|
|
2372
2379
|
lt as computeFlippedOffset,
|
|
2373
2380
|
xt as useActiveIdRegistry,
|
|
2374
2381
|
At as useCompositeId,
|
|
@@ -2383,7 +2390,7 @@ export {
|
|
|
2383
2390
|
It as useMaskedDateRangeInput,
|
|
2384
2391
|
Ct as useMaskedTimeInput,
|
|
2385
2392
|
Dt as usePopupMenu,
|
|
2386
|
-
|
|
2393
|
+
Rt as usePopupTrap,
|
|
2387
2394
|
kt as useUSAddress,
|
|
2388
2395
|
Ge as useZipTextBox
|
|
2389
2396
|
};
|