@zag-js/popover 1.34.1 → 1.35.1
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.mts +8 -152
- package/dist/index.d.ts +8 -152
- package/dist/index.js +37 -445
- package/dist/index.mjs +10 -441
- package/dist/popover.anatomy.d.mts +6 -0
- package/dist/popover.anatomy.d.ts +6 -0
- package/dist/popover.anatomy.js +45 -0
- package/dist/popover.anatomy.mjs +19 -0
- package/dist/popover.connect.d.mts +9 -0
- package/dist/popover.connect.d.ts +9 -0
- package/dist/popover.connect.js +173 -0
- package/dist/popover.connect.mjs +138 -0
- package/dist/popover.dom.d.mts +20 -0
- package/dist/popover.dom.d.ts +20 -0
- package/dist/popover.dom.js +76 -0
- package/dist/popover.dom.mjs +36 -0
- package/dist/popover.machine.d.mts +9 -0
- package/dist/popover.machine.d.ts +9 -0
- package/dist/popover.machine.js +292 -0
- package/dist/popover.machine.mjs +257 -0
- package/dist/popover.props.d.mts +10 -0
- package/dist/popover.props.d.ts +10 -0
- package/dist/popover.props.js +56 -0
- package/dist/popover.props.mjs +30 -0
- package/dist/popover.types.d.mts +142 -0
- package/dist/popover.types.d.ts +142 -0
- package/dist/popover.types.js +18 -0
- package/dist/popover.types.mjs +0 -0
- package/package.json +22 -12
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/popover.connect.ts
|
|
31
|
+
var popover_connect_exports = {};
|
|
32
|
+
__export(popover_connect_exports, {
|
|
33
|
+
connect: () => connect
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(popover_connect_exports);
|
|
36
|
+
var import_dom_query = require("@zag-js/dom-query");
|
|
37
|
+
var import_popper = require("@zag-js/popper");
|
|
38
|
+
var import_popover = require("./popover.anatomy.cjs");
|
|
39
|
+
var dom = __toESM(require("./popover.dom.cjs"));
|
|
40
|
+
function connect(service, normalize) {
|
|
41
|
+
const { state, context, send, computed, prop, scope } = service;
|
|
42
|
+
const open = state.matches("open");
|
|
43
|
+
const currentPlacement = context.get("currentPlacement");
|
|
44
|
+
const portalled = computed("currentPortalled");
|
|
45
|
+
const rendered = context.get("renderedElements");
|
|
46
|
+
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
47
|
+
...prop("positioning"),
|
|
48
|
+
placement: currentPlacement
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
portalled,
|
|
52
|
+
open,
|
|
53
|
+
setOpen(nextOpen) {
|
|
54
|
+
const open2 = state.matches("open");
|
|
55
|
+
if (open2 === nextOpen) return;
|
|
56
|
+
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
57
|
+
},
|
|
58
|
+
reposition(options = {}) {
|
|
59
|
+
send({ type: "POSITIONING.SET", options });
|
|
60
|
+
},
|
|
61
|
+
getArrowProps() {
|
|
62
|
+
return normalize.element({
|
|
63
|
+
id: dom.getArrowId(scope),
|
|
64
|
+
...import_popover.parts.arrow.attrs,
|
|
65
|
+
dir: prop("dir"),
|
|
66
|
+
style: popperStyles.arrow
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
getArrowTipProps() {
|
|
70
|
+
return normalize.element({
|
|
71
|
+
...import_popover.parts.arrowTip.attrs,
|
|
72
|
+
dir: prop("dir"),
|
|
73
|
+
style: popperStyles.arrowTip
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
getAnchorProps() {
|
|
77
|
+
return normalize.element({
|
|
78
|
+
...import_popover.parts.anchor.attrs,
|
|
79
|
+
dir: prop("dir"),
|
|
80
|
+
id: dom.getAnchorId(scope)
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
getTriggerProps() {
|
|
84
|
+
return normalize.button({
|
|
85
|
+
...import_popover.parts.trigger.attrs,
|
|
86
|
+
dir: prop("dir"),
|
|
87
|
+
type: "button",
|
|
88
|
+
"data-placement": currentPlacement,
|
|
89
|
+
id: dom.getTriggerId(scope),
|
|
90
|
+
"aria-haspopup": "dialog",
|
|
91
|
+
"aria-expanded": open,
|
|
92
|
+
"data-state": open ? "open" : "closed",
|
|
93
|
+
"aria-controls": dom.getContentId(scope),
|
|
94
|
+
onPointerDown(event) {
|
|
95
|
+
if (!(0, import_dom_query.isLeftClick)(event)) return;
|
|
96
|
+
if ((0, import_dom_query.isSafari)()) {
|
|
97
|
+
event.currentTarget.focus();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onClick(event) {
|
|
101
|
+
if (event.defaultPrevented) return;
|
|
102
|
+
send({ type: "TOGGLE" });
|
|
103
|
+
},
|
|
104
|
+
onBlur(event) {
|
|
105
|
+
send({ type: "TRIGGER_BLUR", target: event.relatedTarget });
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
getIndicatorProps() {
|
|
110
|
+
return normalize.element({
|
|
111
|
+
...import_popover.parts.indicator.attrs,
|
|
112
|
+
dir: prop("dir"),
|
|
113
|
+
"data-state": open ? "open" : "closed"
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
getPositionerProps() {
|
|
117
|
+
return normalize.element({
|
|
118
|
+
id: dom.getPositionerId(scope),
|
|
119
|
+
...import_popover.parts.positioner.attrs,
|
|
120
|
+
dir: prop("dir"),
|
|
121
|
+
style: popperStyles.floating
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
getContentProps() {
|
|
125
|
+
return normalize.element({
|
|
126
|
+
...import_popover.parts.content.attrs,
|
|
127
|
+
dir: prop("dir"),
|
|
128
|
+
id: dom.getContentId(scope),
|
|
129
|
+
tabIndex: -1,
|
|
130
|
+
role: "dialog",
|
|
131
|
+
"aria-modal": (0, import_dom_query.ariaAttr)(prop("modal")),
|
|
132
|
+
hidden: !open,
|
|
133
|
+
"data-state": open ? "open" : "closed",
|
|
134
|
+
"data-expanded": (0, import_dom_query.dataAttr)(open),
|
|
135
|
+
"aria-labelledby": rendered.title ? dom.getTitleId(scope) : void 0,
|
|
136
|
+
"aria-describedby": rendered.description ? dom.getDescriptionId(scope) : void 0,
|
|
137
|
+
"data-placement": currentPlacement
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
getTitleProps() {
|
|
141
|
+
return normalize.element({
|
|
142
|
+
...import_popover.parts.title.attrs,
|
|
143
|
+
id: dom.getTitleId(scope),
|
|
144
|
+
dir: prop("dir")
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
getDescriptionProps() {
|
|
148
|
+
return normalize.element({
|
|
149
|
+
...import_popover.parts.description.attrs,
|
|
150
|
+
id: dom.getDescriptionId(scope),
|
|
151
|
+
dir: prop("dir")
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
getCloseTriggerProps() {
|
|
155
|
+
return normalize.button({
|
|
156
|
+
...import_popover.parts.closeTrigger.attrs,
|
|
157
|
+
dir: prop("dir"),
|
|
158
|
+
id: dom.getCloseTriggerId(scope),
|
|
159
|
+
type: "button",
|
|
160
|
+
"aria-label": "close",
|
|
161
|
+
onClick(event) {
|
|
162
|
+
if (event.defaultPrevented) return;
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
send({ type: "CLOSE" });
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
+
0 && (module.exports = {
|
|
172
|
+
connect
|
|
173
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// src/popover.connect.ts
|
|
2
|
+
import { ariaAttr, dataAttr, isLeftClick, isSafari } from "@zag-js/dom-query";
|
|
3
|
+
import { getPlacementStyles } from "@zag-js/popper";
|
|
4
|
+
import { parts } from "./popover.anatomy.mjs";
|
|
5
|
+
import * as dom from "./popover.dom.mjs";
|
|
6
|
+
function connect(service, normalize) {
|
|
7
|
+
const { state, context, send, computed, prop, scope } = service;
|
|
8
|
+
const open = state.matches("open");
|
|
9
|
+
const currentPlacement = context.get("currentPlacement");
|
|
10
|
+
const portalled = computed("currentPortalled");
|
|
11
|
+
const rendered = context.get("renderedElements");
|
|
12
|
+
const popperStyles = getPlacementStyles({
|
|
13
|
+
...prop("positioning"),
|
|
14
|
+
placement: currentPlacement
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
portalled,
|
|
18
|
+
open,
|
|
19
|
+
setOpen(nextOpen) {
|
|
20
|
+
const open2 = state.matches("open");
|
|
21
|
+
if (open2 === nextOpen) return;
|
|
22
|
+
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
23
|
+
},
|
|
24
|
+
reposition(options = {}) {
|
|
25
|
+
send({ type: "POSITIONING.SET", options });
|
|
26
|
+
},
|
|
27
|
+
getArrowProps() {
|
|
28
|
+
return normalize.element({
|
|
29
|
+
id: dom.getArrowId(scope),
|
|
30
|
+
...parts.arrow.attrs,
|
|
31
|
+
dir: prop("dir"),
|
|
32
|
+
style: popperStyles.arrow
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
getArrowTipProps() {
|
|
36
|
+
return normalize.element({
|
|
37
|
+
...parts.arrowTip.attrs,
|
|
38
|
+
dir: prop("dir"),
|
|
39
|
+
style: popperStyles.arrowTip
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
getAnchorProps() {
|
|
43
|
+
return normalize.element({
|
|
44
|
+
...parts.anchor.attrs,
|
|
45
|
+
dir: prop("dir"),
|
|
46
|
+
id: dom.getAnchorId(scope)
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
getTriggerProps() {
|
|
50
|
+
return normalize.button({
|
|
51
|
+
...parts.trigger.attrs,
|
|
52
|
+
dir: prop("dir"),
|
|
53
|
+
type: "button",
|
|
54
|
+
"data-placement": currentPlacement,
|
|
55
|
+
id: dom.getTriggerId(scope),
|
|
56
|
+
"aria-haspopup": "dialog",
|
|
57
|
+
"aria-expanded": open,
|
|
58
|
+
"data-state": open ? "open" : "closed",
|
|
59
|
+
"aria-controls": dom.getContentId(scope),
|
|
60
|
+
onPointerDown(event) {
|
|
61
|
+
if (!isLeftClick(event)) return;
|
|
62
|
+
if (isSafari()) {
|
|
63
|
+
event.currentTarget.focus();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
onClick(event) {
|
|
67
|
+
if (event.defaultPrevented) return;
|
|
68
|
+
send({ type: "TOGGLE" });
|
|
69
|
+
},
|
|
70
|
+
onBlur(event) {
|
|
71
|
+
send({ type: "TRIGGER_BLUR", target: event.relatedTarget });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
getIndicatorProps() {
|
|
76
|
+
return normalize.element({
|
|
77
|
+
...parts.indicator.attrs,
|
|
78
|
+
dir: prop("dir"),
|
|
79
|
+
"data-state": open ? "open" : "closed"
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
getPositionerProps() {
|
|
83
|
+
return normalize.element({
|
|
84
|
+
id: dom.getPositionerId(scope),
|
|
85
|
+
...parts.positioner.attrs,
|
|
86
|
+
dir: prop("dir"),
|
|
87
|
+
style: popperStyles.floating
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
getContentProps() {
|
|
91
|
+
return normalize.element({
|
|
92
|
+
...parts.content.attrs,
|
|
93
|
+
dir: prop("dir"),
|
|
94
|
+
id: dom.getContentId(scope),
|
|
95
|
+
tabIndex: -1,
|
|
96
|
+
role: "dialog",
|
|
97
|
+
"aria-modal": ariaAttr(prop("modal")),
|
|
98
|
+
hidden: !open,
|
|
99
|
+
"data-state": open ? "open" : "closed",
|
|
100
|
+
"data-expanded": dataAttr(open),
|
|
101
|
+
"aria-labelledby": rendered.title ? dom.getTitleId(scope) : void 0,
|
|
102
|
+
"aria-describedby": rendered.description ? dom.getDescriptionId(scope) : void 0,
|
|
103
|
+
"data-placement": currentPlacement
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
getTitleProps() {
|
|
107
|
+
return normalize.element({
|
|
108
|
+
...parts.title.attrs,
|
|
109
|
+
id: dom.getTitleId(scope),
|
|
110
|
+
dir: prop("dir")
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
getDescriptionProps() {
|
|
114
|
+
return normalize.element({
|
|
115
|
+
...parts.description.attrs,
|
|
116
|
+
id: dom.getDescriptionId(scope),
|
|
117
|
+
dir: prop("dir")
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
getCloseTriggerProps() {
|
|
121
|
+
return normalize.button({
|
|
122
|
+
...parts.closeTrigger.attrs,
|
|
123
|
+
dir: prop("dir"),
|
|
124
|
+
id: dom.getCloseTriggerId(scope),
|
|
125
|
+
type: "button",
|
|
126
|
+
"aria-label": "close",
|
|
127
|
+
onClick(event) {
|
|
128
|
+
if (event.defaultPrevented) return;
|
|
129
|
+
event.stopPropagation();
|
|
130
|
+
send({ type: "CLOSE" });
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
connect
|
|
138
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Scope } from '@zag-js/core';
|
|
2
|
+
|
|
3
|
+
declare const getAnchorId: (scope: Scope) => any;
|
|
4
|
+
declare const getTriggerId: (scope: Scope) => any;
|
|
5
|
+
declare const getContentId: (scope: Scope) => any;
|
|
6
|
+
declare const getPositionerId: (scope: Scope) => any;
|
|
7
|
+
declare const getArrowId: (scope: Scope) => any;
|
|
8
|
+
declare const getTitleId: (scope: Scope) => any;
|
|
9
|
+
declare const getDescriptionId: (scope: Scope) => any;
|
|
10
|
+
declare const getCloseTriggerId: (scope: Scope) => any;
|
|
11
|
+
declare const getAnchorEl: (scope: Scope) => HTMLElement | null;
|
|
12
|
+
declare const getTriggerEl: (scope: Scope) => HTMLElement | null;
|
|
13
|
+
declare const getContentEl: (scope: Scope) => HTMLElement | null;
|
|
14
|
+
declare const getPositionerEl: (scope: Scope) => HTMLElement | null;
|
|
15
|
+
declare const getTitleEl: (scope: Scope) => HTMLElement | null;
|
|
16
|
+
declare const getDescriptionEl: (scope: Scope) => HTMLElement | null;
|
|
17
|
+
declare const getFocusableEls: (scope: Scope) => HTMLElement[];
|
|
18
|
+
declare const getFirstFocusableEl: (scope: Scope) => HTMLElement;
|
|
19
|
+
|
|
20
|
+
export { getAnchorEl, getAnchorId, getArrowId, getCloseTriggerId, getContentEl, getContentId, getDescriptionEl, getDescriptionId, getFirstFocusableEl, getFocusableEls, getPositionerEl, getPositionerId, getTitleEl, getTitleId, getTriggerEl, getTriggerId };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Scope } from '@zag-js/core';
|
|
2
|
+
|
|
3
|
+
declare const getAnchorId: (scope: Scope) => any;
|
|
4
|
+
declare const getTriggerId: (scope: Scope) => any;
|
|
5
|
+
declare const getContentId: (scope: Scope) => any;
|
|
6
|
+
declare const getPositionerId: (scope: Scope) => any;
|
|
7
|
+
declare const getArrowId: (scope: Scope) => any;
|
|
8
|
+
declare const getTitleId: (scope: Scope) => any;
|
|
9
|
+
declare const getDescriptionId: (scope: Scope) => any;
|
|
10
|
+
declare const getCloseTriggerId: (scope: Scope) => any;
|
|
11
|
+
declare const getAnchorEl: (scope: Scope) => HTMLElement | null;
|
|
12
|
+
declare const getTriggerEl: (scope: Scope) => HTMLElement | null;
|
|
13
|
+
declare const getContentEl: (scope: Scope) => HTMLElement | null;
|
|
14
|
+
declare const getPositionerEl: (scope: Scope) => HTMLElement | null;
|
|
15
|
+
declare const getTitleEl: (scope: Scope) => HTMLElement | null;
|
|
16
|
+
declare const getDescriptionEl: (scope: Scope) => HTMLElement | null;
|
|
17
|
+
declare const getFocusableEls: (scope: Scope) => HTMLElement[];
|
|
18
|
+
declare const getFirstFocusableEl: (scope: Scope) => HTMLElement;
|
|
19
|
+
|
|
20
|
+
export { getAnchorEl, getAnchorId, getArrowId, getCloseTriggerId, getContentEl, getContentId, getDescriptionEl, getDescriptionId, getFirstFocusableEl, getFocusableEls, getPositionerEl, getPositionerId, getTitleEl, getTitleId, getTriggerEl, getTriggerId };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover.dom.ts
|
|
21
|
+
var popover_dom_exports = {};
|
|
22
|
+
__export(popover_dom_exports, {
|
|
23
|
+
getAnchorEl: () => getAnchorEl,
|
|
24
|
+
getAnchorId: () => getAnchorId,
|
|
25
|
+
getArrowId: () => getArrowId,
|
|
26
|
+
getCloseTriggerId: () => getCloseTriggerId,
|
|
27
|
+
getContentEl: () => getContentEl,
|
|
28
|
+
getContentId: () => getContentId,
|
|
29
|
+
getDescriptionEl: () => getDescriptionEl,
|
|
30
|
+
getDescriptionId: () => getDescriptionId,
|
|
31
|
+
getFirstFocusableEl: () => getFirstFocusableEl,
|
|
32
|
+
getFocusableEls: () => getFocusableEls,
|
|
33
|
+
getPositionerEl: () => getPositionerEl,
|
|
34
|
+
getPositionerId: () => getPositionerId,
|
|
35
|
+
getTitleEl: () => getTitleEl,
|
|
36
|
+
getTitleId: () => getTitleId,
|
|
37
|
+
getTriggerEl: () => getTriggerEl,
|
|
38
|
+
getTriggerId: () => getTriggerId
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(popover_dom_exports);
|
|
41
|
+
var import_dom_query = require("@zag-js/dom-query");
|
|
42
|
+
var getAnchorId = (scope) => scope.ids?.anchor ?? `popover:${scope.id}:anchor`;
|
|
43
|
+
var getTriggerId = (scope) => scope.ids?.trigger ?? `popover:${scope.id}:trigger`;
|
|
44
|
+
var getContentId = (scope) => scope.ids?.content ?? `popover:${scope.id}:content`;
|
|
45
|
+
var getPositionerId = (scope) => scope.ids?.positioner ?? `popover:${scope.id}:popper`;
|
|
46
|
+
var getArrowId = (scope) => scope.ids?.arrow ?? `popover:${scope.id}:arrow`;
|
|
47
|
+
var getTitleId = (scope) => scope.ids?.title ?? `popover:${scope.id}:title`;
|
|
48
|
+
var getDescriptionId = (scope) => scope.ids?.description ?? `popover:${scope.id}:desc`;
|
|
49
|
+
var getCloseTriggerId = (scope) => scope.ids?.closeTrigger ?? `popover:${scope.id}:close`;
|
|
50
|
+
var getAnchorEl = (scope) => scope.getById(getAnchorId(scope));
|
|
51
|
+
var getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
52
|
+
var getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
53
|
+
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
54
|
+
var getTitleEl = (scope) => scope.getById(getTitleId(scope));
|
|
55
|
+
var getDescriptionEl = (scope) => scope.getById(getDescriptionId(scope));
|
|
56
|
+
var getFocusableEls = (scope) => (0, import_dom_query.getFocusables)(getContentEl(scope));
|
|
57
|
+
var getFirstFocusableEl = (scope) => getFocusableEls(scope)[0];
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
getAnchorEl,
|
|
61
|
+
getAnchorId,
|
|
62
|
+
getArrowId,
|
|
63
|
+
getCloseTriggerId,
|
|
64
|
+
getContentEl,
|
|
65
|
+
getContentId,
|
|
66
|
+
getDescriptionEl,
|
|
67
|
+
getDescriptionId,
|
|
68
|
+
getFirstFocusableEl,
|
|
69
|
+
getFocusableEls,
|
|
70
|
+
getPositionerEl,
|
|
71
|
+
getPositionerId,
|
|
72
|
+
getTitleEl,
|
|
73
|
+
getTitleId,
|
|
74
|
+
getTriggerEl,
|
|
75
|
+
getTriggerId
|
|
76
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/popover.dom.ts
|
|
2
|
+
import { getFocusables } from "@zag-js/dom-query";
|
|
3
|
+
var getAnchorId = (scope) => scope.ids?.anchor ?? `popover:${scope.id}:anchor`;
|
|
4
|
+
var getTriggerId = (scope) => scope.ids?.trigger ?? `popover:${scope.id}:trigger`;
|
|
5
|
+
var getContentId = (scope) => scope.ids?.content ?? `popover:${scope.id}:content`;
|
|
6
|
+
var getPositionerId = (scope) => scope.ids?.positioner ?? `popover:${scope.id}:popper`;
|
|
7
|
+
var getArrowId = (scope) => scope.ids?.arrow ?? `popover:${scope.id}:arrow`;
|
|
8
|
+
var getTitleId = (scope) => scope.ids?.title ?? `popover:${scope.id}:title`;
|
|
9
|
+
var getDescriptionId = (scope) => scope.ids?.description ?? `popover:${scope.id}:desc`;
|
|
10
|
+
var getCloseTriggerId = (scope) => scope.ids?.closeTrigger ?? `popover:${scope.id}:close`;
|
|
11
|
+
var getAnchorEl = (scope) => scope.getById(getAnchorId(scope));
|
|
12
|
+
var getTriggerEl = (scope) => scope.getById(getTriggerId(scope));
|
|
13
|
+
var getContentEl = (scope) => scope.getById(getContentId(scope));
|
|
14
|
+
var getPositionerEl = (scope) => scope.getById(getPositionerId(scope));
|
|
15
|
+
var getTitleEl = (scope) => scope.getById(getTitleId(scope));
|
|
16
|
+
var getDescriptionEl = (scope) => scope.getById(getDescriptionId(scope));
|
|
17
|
+
var getFocusableEls = (scope) => getFocusables(getContentEl(scope));
|
|
18
|
+
var getFirstFocusableEl = (scope) => getFocusableEls(scope)[0];
|
|
19
|
+
export {
|
|
20
|
+
getAnchorEl,
|
|
21
|
+
getAnchorId,
|
|
22
|
+
getArrowId,
|
|
23
|
+
getCloseTriggerId,
|
|
24
|
+
getContentEl,
|
|
25
|
+
getContentId,
|
|
26
|
+
getDescriptionEl,
|
|
27
|
+
getDescriptionId,
|
|
28
|
+
getFirstFocusableEl,
|
|
29
|
+
getFocusableEls,
|
|
30
|
+
getPositionerEl,
|
|
31
|
+
getPositionerId,
|
|
32
|
+
getTitleEl,
|
|
33
|
+
getTitleId,
|
|
34
|
+
getTriggerEl,
|
|
35
|
+
getTriggerId
|
|
36
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _zag_js_core from '@zag-js/core';
|
|
2
|
+
import { PopoverSchema } from './popover.types.mjs';
|
|
3
|
+
import '@zag-js/dismissable';
|
|
4
|
+
import '@zag-js/popper';
|
|
5
|
+
import '@zag-js/types';
|
|
6
|
+
|
|
7
|
+
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
8
|
+
|
|
9
|
+
export { machine };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _zag_js_core from '@zag-js/core';
|
|
2
|
+
import { PopoverSchema } from './popover.types.js';
|
|
3
|
+
import '@zag-js/dismissable';
|
|
4
|
+
import '@zag-js/popper';
|
|
5
|
+
import '@zag-js/types';
|
|
6
|
+
|
|
7
|
+
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
8
|
+
|
|
9
|
+
export { machine };
|