@zag-js/popover 0.0.0-dev-20220416104915 → 0.0.0-dev-20220418165817
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +237 -233
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +237 -233
- package/dist/index.mjs.map +2 -2
- package/dist/popover.connect.d.ts +2 -3
- package/dist/popover.connect.d.ts.map +1 -1
- package/dist/popover.machine.d.ts +2 -2
- package/dist/popover.machine.d.ts.map +1 -1
- package/dist/popover.types.d.ts +37 -23
- package/dist/popover.types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { connect } from "./popover.connect";
|
|
2
2
|
export { machine } from "./popover.machine";
|
|
3
|
-
export type {
|
|
3
|
+
export type { UserDefinedContext as Context } from "./popover.types";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,YAAY,EAAE,kBAAkB,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -574,29 +574,29 @@ var dom = {
|
|
|
574
574
|
getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
|
|
575
575
|
getAnchorId: (ctx) => {
|
|
576
576
|
var _a, _b;
|
|
577
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.anchor) != null ? _b : `popover
|
|
577
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.anchor) != null ? _b : `popover:${ctx.uid}:anchor`;
|
|
578
578
|
},
|
|
579
579
|
getTriggerId: (ctx) => {
|
|
580
580
|
var _a, _b;
|
|
581
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `popover
|
|
581
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.trigger) != null ? _b : `popover:${ctx.uid}:trigger`;
|
|
582
582
|
},
|
|
583
583
|
getContentId: (ctx) => {
|
|
584
584
|
var _a, _b;
|
|
585
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `popover
|
|
585
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.content) != null ? _b : `popover:${ctx.uid}:content`;
|
|
586
586
|
},
|
|
587
|
-
getPositionerId: (ctx) => `popover
|
|
588
|
-
getArrowId: (ctx) => `popover
|
|
587
|
+
getPositionerId: (ctx) => `popover:${ctx.uid}:popper`,
|
|
588
|
+
getArrowId: (ctx) => `popover:${ctx.uid}:arrow`,
|
|
589
589
|
getTitleId: (ctx) => {
|
|
590
590
|
var _a, _b;
|
|
591
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.title) != null ? _b : `popover
|
|
591
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.title) != null ? _b : `popover:${ctx.uid}:title`;
|
|
592
592
|
},
|
|
593
593
|
getDescriptionId: (ctx) => {
|
|
594
594
|
var _a, _b;
|
|
595
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.description) != null ? _b : `popover
|
|
595
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.description) != null ? _b : `popover:${ctx.uid}:desc`;
|
|
596
596
|
},
|
|
597
597
|
getCloseButtonId: (ctx) => {
|
|
598
598
|
var _a, _b;
|
|
599
|
-
return (_b = (_a = ctx.ids) == null ? void 0 : _a.closeBtn) != null ? _b : `popover
|
|
599
|
+
return (_b = (_a = ctx.ids) == null ? void 0 : _a.closeBtn) != null ? _b : `popover:${ctx.uid}:close-button`;
|
|
600
600
|
},
|
|
601
601
|
getAnchorEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getAnchorId(ctx)),
|
|
602
602
|
getTriggerEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getTriggerId(ctx)),
|
|
@@ -727,245 +727,249 @@ var import_popper2 = require("@zag-js/popper");
|
|
|
727
727
|
var import_aria_hidden = require("aria-hidden");
|
|
728
728
|
var import_focus_trap = require("focus-trap");
|
|
729
729
|
var { and, or } = import_core.guards;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
on: {
|
|
751
|
-
SETUP: {
|
|
752
|
-
target: "closed",
|
|
753
|
-
actions: ["setupDocument", "checkRenderedElements"]
|
|
754
|
-
}
|
|
755
|
-
}
|
|
730
|
+
function machine(ctx = {}) {
|
|
731
|
+
return (0, import_core.createMachine)({
|
|
732
|
+
id: "popover",
|
|
733
|
+
initial: "unknown",
|
|
734
|
+
context: __spreadValues({
|
|
735
|
+
isTitleRendered: true,
|
|
736
|
+
isDescriptionRendered: true,
|
|
737
|
+
isAnchorRendered: false,
|
|
738
|
+
uid: "",
|
|
739
|
+
closeOnBlur: true,
|
|
740
|
+
closeOnEsc: true,
|
|
741
|
+
autoFocus: true,
|
|
742
|
+
modal: false,
|
|
743
|
+
positioning: __spreadValues({
|
|
744
|
+
placement: "bottom"
|
|
745
|
+
}, ctx.positioning),
|
|
746
|
+
currentPlacement: void 0
|
|
747
|
+
}, ctx),
|
|
748
|
+
computed: {
|
|
749
|
+
currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
|
|
756
750
|
},
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
"
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
actions: "focusTrigger"
|
|
784
|
-
},
|
|
785
|
-
TRIGGER_CLICK: {
|
|
786
|
-
target: "closed",
|
|
787
|
-
actions: "focusTrigger"
|
|
788
|
-
},
|
|
789
|
-
ESCAPE: {
|
|
790
|
-
guard: "closeOnEsc",
|
|
791
|
-
target: "closed",
|
|
792
|
-
actions: "focusTrigger"
|
|
793
|
-
},
|
|
794
|
-
TAB: {
|
|
795
|
-
guard: and("isLastTabbableElement", "closeOnBlur", "portalled"),
|
|
796
|
-
target: "closed",
|
|
797
|
-
actions: "focusNextTabbableElementAfterTrigger"
|
|
798
|
-
},
|
|
799
|
-
SHIFT_TAB: {
|
|
800
|
-
guard: and(or("isFirstTabbableElement", "isContentFocused"), "closeOnBlur", "portalled"),
|
|
801
|
-
target: "closed",
|
|
802
|
-
actions: "focusTrigger"
|
|
803
|
-
},
|
|
804
|
-
INTERACT_OUTSIDE: [
|
|
751
|
+
states: {
|
|
752
|
+
unknown: {
|
|
753
|
+
on: {
|
|
754
|
+
SETUP: {
|
|
755
|
+
target: "closed",
|
|
756
|
+
actions: ["setupDocument", "checkRenderedElements"]
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
closed: {
|
|
761
|
+
entry: ["clearPointerDown", "invokeOnClose"],
|
|
762
|
+
on: {
|
|
763
|
+
TRIGGER_CLICK: "open",
|
|
764
|
+
OPEN: "open"
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
open: {
|
|
768
|
+
activities: [
|
|
769
|
+
"trackPointerDown",
|
|
770
|
+
"trapFocus",
|
|
771
|
+
"preventScroll",
|
|
772
|
+
"hideContentBelow",
|
|
773
|
+
"disableOutsidePointerEvents",
|
|
774
|
+
"computePlacement"
|
|
775
|
+
],
|
|
776
|
+
entry: (0, import_core.choose)([
|
|
805
777
|
{
|
|
806
|
-
guard:
|
|
807
|
-
|
|
778
|
+
guard: "autoFocus",
|
|
779
|
+
actions: ["setInitialFocus", "invokeOnOpen"]
|
|
808
780
|
},
|
|
809
|
-
{
|
|
810
|
-
|
|
781
|
+
{ actions: ["focusContent", "invokeOnOpen"] }
|
|
782
|
+
]),
|
|
783
|
+
on: {
|
|
784
|
+
CLOSE: {
|
|
811
785
|
target: "closed",
|
|
812
786
|
actions: "focusTrigger"
|
|
813
|
-
}
|
|
814
|
-
|
|
787
|
+
},
|
|
788
|
+
TRIGGER_CLICK: {
|
|
789
|
+
target: "closed",
|
|
790
|
+
actions: "focusTrigger"
|
|
791
|
+
},
|
|
792
|
+
ESCAPE: {
|
|
793
|
+
guard: "closeOnEsc",
|
|
794
|
+
target: "closed",
|
|
795
|
+
actions: "focusTrigger"
|
|
796
|
+
},
|
|
797
|
+
TAB: {
|
|
798
|
+
guard: and("isLastTabbableElement", "closeOnBlur", "portalled"),
|
|
799
|
+
target: "closed",
|
|
800
|
+
actions: "focusNextTabbableElementAfterTrigger"
|
|
801
|
+
},
|
|
802
|
+
SHIFT_TAB: {
|
|
803
|
+
guard: and(or("isFirstTabbableElement", "isContentFocused"), "closeOnBlur", "portalled"),
|
|
804
|
+
target: "closed",
|
|
805
|
+
actions: "focusTrigger"
|
|
806
|
+
},
|
|
807
|
+
INTERACT_OUTSIDE: [
|
|
808
|
+
{
|
|
809
|
+
guard: and("closeOnBlur", "isRelatedTargetFocusable"),
|
|
810
|
+
target: "closed"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
guard: "closeOnBlur",
|
|
814
|
+
target: "closed",
|
|
815
|
+
actions: "focusTrigger"
|
|
816
|
+
}
|
|
817
|
+
]
|
|
818
|
+
}
|
|
815
819
|
}
|
|
816
820
|
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (!ctx.modal)
|
|
848
|
-
return;
|
|
849
|
-
let unhide;
|
|
850
|
-
nextTick(() => {
|
|
851
|
-
const el = dom.getContentEl(ctx);
|
|
852
|
-
if (!el)
|
|
821
|
+
}, {
|
|
822
|
+
activities: {
|
|
823
|
+
computePlacement(ctx2) {
|
|
824
|
+
ctx2.currentPlacement = ctx2.positioning.placement;
|
|
825
|
+
const anchorEl = ctx2.isAnchorRendered ? dom.getAnchorEl(ctx2) : dom.getTriggerEl(ctx2);
|
|
826
|
+
return (0, import_popper2.getPlacement)(anchorEl, dom.getPositionerEl(ctx2), __spreadProps(__spreadValues({}, ctx2.positioning), {
|
|
827
|
+
onComplete(data) {
|
|
828
|
+
ctx2.currentPlacement = data.placement;
|
|
829
|
+
ctx2.isPlacementComplete = true;
|
|
830
|
+
},
|
|
831
|
+
onCleanup() {
|
|
832
|
+
ctx2.currentPlacement = void 0;
|
|
833
|
+
ctx2.isPlacementComplete = false;
|
|
834
|
+
}
|
|
835
|
+
}));
|
|
836
|
+
},
|
|
837
|
+
trackPointerDown(ctx2) {
|
|
838
|
+
return trackPointerDown(dom.getDoc(ctx2), (el) => {
|
|
839
|
+
ctx2.pointerdownNode = (0, import_core.ref)(el);
|
|
840
|
+
});
|
|
841
|
+
},
|
|
842
|
+
disableOutsidePointerEvents(ctx2) {
|
|
843
|
+
const el = dom.getContentEl(ctx2);
|
|
844
|
+
return preventBodyPointerEvents(el, {
|
|
845
|
+
document: dom.getDoc(ctx2),
|
|
846
|
+
disabled: !ctx2.modal
|
|
847
|
+
});
|
|
848
|
+
},
|
|
849
|
+
hideContentBelow(ctx2) {
|
|
850
|
+
if (!ctx2.modal)
|
|
853
851
|
return;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
if (!
|
|
852
|
+
let unhide;
|
|
853
|
+
nextTick(() => {
|
|
854
|
+
const el = dom.getContentEl(ctx2);
|
|
855
|
+
if (!el)
|
|
856
|
+
return;
|
|
857
|
+
try {
|
|
858
|
+
unhide = (0, import_aria_hidden.hideOthers)(el);
|
|
859
|
+
} catch (e2) {
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
return () => unhide == null ? void 0 : unhide();
|
|
863
|
+
},
|
|
864
|
+
preventScroll(ctx2) {
|
|
865
|
+
return preventBodyScroll({
|
|
866
|
+
allowPinchZoom: true,
|
|
867
|
+
disabled: !ctx2.modal,
|
|
868
|
+
document: dom.getDoc(ctx2)
|
|
869
|
+
});
|
|
870
|
+
},
|
|
871
|
+
trapFocus(ctx2) {
|
|
872
|
+
if (!ctx2.modal)
|
|
875
873
|
return;
|
|
876
|
-
trap
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
874
|
+
let trap;
|
|
875
|
+
nextTick(() => {
|
|
876
|
+
const el = dom.getContentEl(ctx2);
|
|
877
|
+
if (!el)
|
|
878
|
+
return;
|
|
879
|
+
trap = (0, import_focus_trap.createFocusTrap)(el, {
|
|
880
|
+
escapeDeactivates: false,
|
|
881
|
+
allowOutsideClick: true,
|
|
882
|
+
returnFocusOnDeactivate: true,
|
|
883
|
+
document: dom.getDoc(ctx2),
|
|
884
|
+
fallbackFocus: el,
|
|
885
|
+
initialFocus: runIfFn2(ctx2.initialFocusEl)
|
|
886
|
+
});
|
|
887
|
+
try {
|
|
888
|
+
trap.activate();
|
|
889
|
+
} catch (e2) {
|
|
890
|
+
}
|
|
883
891
|
});
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
} catch (e2) {
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
return () => trap == null ? void 0 : trap.deactivate();
|
|
890
|
-
}
|
|
891
|
-
},
|
|
892
|
-
guards: {
|
|
893
|
-
closeOnEsc: (ctx) => !!ctx.closeOnEsc,
|
|
894
|
-
autoFocus: (ctx) => !!ctx.autoFocus,
|
|
895
|
-
modal: (ctx) => !!ctx.modal,
|
|
896
|
-
portalled: (ctx) => !!ctx.portalled,
|
|
897
|
-
isRelatedTargetFocusable: (_ctx, evt) => evt.focusable,
|
|
898
|
-
closeOnBlur: (ctx) => !!ctx.closeOnBlur,
|
|
899
|
-
isContentFocused: (ctx) => dom.getContentEl(ctx) === dom.getActiveEl(ctx),
|
|
900
|
-
isFirstTabbableElement: (ctx) => dom.getFirstTabbableEl(ctx) === dom.getActiveEl(ctx),
|
|
901
|
-
isLastTabbableElement: (ctx) => dom.getLastTabbableEl(ctx) === dom.getActiveEl(ctx)
|
|
902
|
-
},
|
|
903
|
-
actions: {
|
|
904
|
-
checkRenderedElements(ctx) {
|
|
905
|
-
raf(() => {
|
|
906
|
-
ctx.isAnchorRendered = !!dom.getAnchorEl(ctx);
|
|
907
|
-
ctx.isTitleRendered = !!dom.getTitleEl(ctx);
|
|
908
|
-
ctx.isDescriptionRendered = !!dom.getDescriptionEl(ctx);
|
|
909
|
-
});
|
|
910
|
-
},
|
|
911
|
-
setupDocument(ctx, evt) {
|
|
912
|
-
if (evt.doc)
|
|
913
|
-
ctx.doc = (0, import_core.ref)(evt.doc);
|
|
914
|
-
ctx.uid = evt.id;
|
|
892
|
+
return () => trap == null ? void 0 : trap.deactivate();
|
|
893
|
+
}
|
|
915
894
|
},
|
|
916
|
-
|
|
917
|
-
|
|
895
|
+
guards: {
|
|
896
|
+
closeOnEsc: (ctx2) => !!ctx2.closeOnEsc,
|
|
897
|
+
autoFocus: (ctx2) => !!ctx2.autoFocus,
|
|
898
|
+
modal: (ctx2) => !!ctx2.modal,
|
|
899
|
+
portalled: (ctx2) => !!ctx2.portalled,
|
|
900
|
+
isRelatedTargetFocusable: (_ctx, evt) => evt.focusable,
|
|
901
|
+
closeOnBlur: (ctx2) => !!ctx2.closeOnBlur,
|
|
902
|
+
isContentFocused: (ctx2) => dom.getContentEl(ctx2) === dom.getActiveEl(ctx2),
|
|
903
|
+
isFirstTabbableElement: (ctx2) => dom.getFirstTabbableEl(ctx2) === dom.getActiveEl(ctx2),
|
|
904
|
+
isLastTabbableElement: (ctx2) => dom.getLastTabbableEl(ctx2) === dom.getActiveEl(ctx2)
|
|
918
905
|
},
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
906
|
+
actions: {
|
|
907
|
+
checkRenderedElements(ctx2) {
|
|
908
|
+
raf(() => {
|
|
909
|
+
ctx2.isAnchorRendered = !!dom.getAnchorEl(ctx2);
|
|
910
|
+
ctx2.isTitleRendered = !!dom.getTitleEl(ctx2);
|
|
911
|
+
ctx2.isDescriptionRendered = !!dom.getDescriptionEl(ctx2);
|
|
912
|
+
});
|
|
913
|
+
},
|
|
914
|
+
setupDocument(ctx2, evt) {
|
|
915
|
+
if (evt.doc)
|
|
916
|
+
ctx2.doc = (0, import_core.ref)(evt.doc);
|
|
917
|
+
ctx2.uid = evt.id;
|
|
918
|
+
},
|
|
919
|
+
clearPointerDown(ctx2) {
|
|
920
|
+
ctx2.pointerdownNode = null;
|
|
921
|
+
},
|
|
922
|
+
focusContent(ctx2) {
|
|
923
|
+
nextTick(() => {
|
|
924
|
+
var _a;
|
|
925
|
+
(_a = dom.getContentEl(ctx2)) == null ? void 0 : _a.focus();
|
|
926
|
+
});
|
|
927
|
+
},
|
|
928
|
+
setInitialFocus(ctx2) {
|
|
929
|
+
nextTick(() => {
|
|
930
|
+
var _a;
|
|
931
|
+
(_a = dom.getInitialFocusEl(ctx2)) == null ? void 0 : _a.focus();
|
|
932
|
+
});
|
|
933
|
+
},
|
|
934
|
+
focusTrigger(ctx2) {
|
|
935
|
+
nextTick(() => {
|
|
936
|
+
var _a;
|
|
937
|
+
(_a = dom.getTriggerEl(ctx2)) == null ? void 0 : _a.focus();
|
|
938
|
+
});
|
|
939
|
+
},
|
|
940
|
+
invokeOnOpen(ctx2, evt) {
|
|
927
941
|
var _a;
|
|
928
|
-
(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
942
|
+
if (evt.type !== "SETUP") {
|
|
943
|
+
(_a = ctx2.onOpen) == null ? void 0 : _a.call(ctx2);
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
invokeOnClose(ctx2, evt) {
|
|
933
947
|
var _a;
|
|
934
|
-
(
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
return;
|
|
958
|
-
let tabbables = dom.getDocTabbableEls(ctx);
|
|
959
|
-
let elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
|
|
960
|
-
if (elementAfterTrigger === content) {
|
|
961
|
-
tabbables = tabbables.filter((el) => !contains(content, el));
|
|
962
|
-
elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
|
|
948
|
+
if (evt.type !== "SETUP") {
|
|
949
|
+
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
focusNextTabbableElementAfterTrigger(ctx2, evt) {
|
|
953
|
+
const content = dom.getContentEl(ctx2);
|
|
954
|
+
const doc = dom.getDoc(ctx2);
|
|
955
|
+
const button = dom.getTriggerEl(ctx2);
|
|
956
|
+
if (!content || !button)
|
|
957
|
+
return;
|
|
958
|
+
const lastTabbable = dom.getLastTabbableEl(ctx2);
|
|
959
|
+
if (lastTabbable !== doc.activeElement)
|
|
960
|
+
return;
|
|
961
|
+
let tabbables = dom.getDocTabbableEls(ctx2);
|
|
962
|
+
let elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
|
|
963
|
+
if (elementAfterTrigger === content) {
|
|
964
|
+
tabbables = tabbables.filter((el) => !contains(content, el));
|
|
965
|
+
elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
|
|
966
|
+
}
|
|
967
|
+
if (!elementAfterTrigger || elementAfterTrigger === button)
|
|
968
|
+
return;
|
|
969
|
+
evt.preventDefault();
|
|
970
|
+
nextTick(() => elementAfterTrigger == null ? void 0 : elementAfterTrigger.focus());
|
|
963
971
|
}
|
|
964
|
-
if (!elementAfterTrigger || elementAfterTrigger === button)
|
|
965
|
-
return;
|
|
966
|
-
evt.preventDefault();
|
|
967
|
-
nextTick(() => elementAfterTrigger == null ? void 0 : elementAfterTrigger.focus());
|
|
968
972
|
}
|
|
969
|
-
}
|
|
970
|
-
}
|
|
973
|
+
});
|
|
974
|
+
}
|
|
971
975
|
//# sourceMappingURL=index.js.map
|