@zag-js/popover 0.1.3 → 0.1.4
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.js +14 -7
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +14 -7
- package/dist/index.mjs.map +2 -2
- package/dist/popover.connect.d.ts.map +1 -1
- package/dist/popover.dom.d.ts +1 -0
- package/dist/popover.dom.d.ts.map +1 -1
- package/dist/popover.machine.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -629,6 +629,10 @@ var dom = {
|
|
|
629
629
|
return (_a = ctx.doc) != null ? _a : document;
|
|
630
630
|
},
|
|
631
631
|
getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
|
|
632
|
+
getRootNode: (ctx) => {
|
|
633
|
+
var _a;
|
|
634
|
+
return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
|
|
635
|
+
},
|
|
632
636
|
getAnchorId: (ctx) => {
|
|
633
637
|
var _a, _b;
|
|
634
638
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.anchor) != null ? _b : `popover:${ctx.uid}:anchor`;
|
|
@@ -655,12 +659,12 @@ var dom = {
|
|
|
655
659
|
var _a, _b;
|
|
656
660
|
return (_b = (_a = ctx.ids) == null ? void 0 : _a.closeBtn) != null ? _b : `popover:${ctx.uid}:close-button`;
|
|
657
661
|
},
|
|
658
|
-
getAnchorEl: (ctx) => dom.
|
|
659
|
-
getTriggerEl: (ctx) => dom.
|
|
660
|
-
getContentEl: (ctx) => dom.
|
|
661
|
-
getPositionerEl: (ctx) => dom.
|
|
662
|
-
getTitleEl: (ctx) => dom.
|
|
663
|
-
getDescriptionEl: (ctx) => dom.
|
|
662
|
+
getAnchorEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getAnchorId(ctx)),
|
|
663
|
+
getTriggerEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getTriggerId(ctx)),
|
|
664
|
+
getContentEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getContentId(ctx)),
|
|
665
|
+
getPositionerEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getPositionerId(ctx)),
|
|
666
|
+
getTitleEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getTitleId(ctx)),
|
|
667
|
+
getDescriptionEl: (ctx) => dom.getRootNode(ctx).getElementById(dom.getDescriptionId(ctx)),
|
|
664
668
|
getFocusableEls: (ctx) => getFocusables(dom.getContentEl(ctx)),
|
|
665
669
|
getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
|
|
666
670
|
getDocTabbableEls: (ctx) => getTabbables(cast(dom.getDoc(ctx))),
|
|
@@ -681,7 +685,8 @@ function connect(state, send, normalize = normalizeProp) {
|
|
|
681
685
|
const isOpen = state.matches("open");
|
|
682
686
|
const pointerdownNode = state.context.pointerdownNode;
|
|
683
687
|
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
684
|
-
measured: !!state.context.isPlacementComplete
|
|
688
|
+
measured: !!state.context.isPlacementComplete,
|
|
689
|
+
placement: state.context.currentPlacement
|
|
685
690
|
});
|
|
686
691
|
return {
|
|
687
692
|
portalled: state.context.currentPortalled,
|
|
@@ -965,6 +970,8 @@ function machine(ctx = {}) {
|
|
|
965
970
|
setupDocument(ctx2, evt) {
|
|
966
971
|
if (evt.doc)
|
|
967
972
|
ctx2.doc = (0, import_core.ref)(evt.doc);
|
|
973
|
+
if (evt.root)
|
|
974
|
+
ctx2.rootNode = (0, import_core.ref)(evt.root);
|
|
968
975
|
ctx2.uid = evt.id;
|
|
969
976
|
},
|
|
970
977
|
clearPointerDown(ctx2) {
|