@zag-js/popover 2.0.0-next.3 → 2.0.0-next.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.d.mts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +12 -38
- package/dist/index.mjs +2 -7
- package/dist/popover.anatomy.d.mts +2 -6
- package/dist/popover.anatomy.d.ts +2 -6
- package/dist/popover.anatomy.js +8 -44
- package/dist/popover.anatomy.mjs +4 -18
- package/dist/popover.connect.d.mts +3 -9
- package/dist/popover.connect.d.ts +3 -9
- package/dist/popover.connect.js +270 -210
- package/dist/popover.connect.mjs +263 -172
- package/dist/popover.dom.d.mts +19 -22
- package/dist/popover.dom.d.ts +19 -22
- package/dist/popover.dom.js +59 -87
- package/dist/popover.dom.mjs +38 -45
- package/dist/popover.machine.d.mts +2 -9
- package/dist/popover.machine.d.ts +2 -9
- package/dist/popover.machine.js +466 -359
- package/dist/popover.machine.mjs +459 -321
- package/dist/popover.props.d.mts +3 -10
- package/dist/popover.props.d.ts +3 -10
- package/dist/popover.props.js +34 -59
- package/dist/popover.props.mjs +30 -33
- package/dist/popover.style.d.mts +15 -0
- package/dist/popover.style.d.ts +15 -0
- package/dist/popover.style.js +15 -0
- package/dist/popover.style.mjs +11 -0
- package/dist/popover.types.d.mts +349 -236
- package/dist/popover.types.d.ts +349 -236
- package/dist/popover.types.js +4 -18
- package/dist/popover.types.mjs +1 -0
- package/package.json +12 -12
package/dist/popover.dom.js
CHANGED
|
@@ -1,91 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_popover_anatomy = require("./popover.anatomy.js");
|
|
6
|
+
let _zag_js_utils = require("@zag-js/utils");
|
|
7
|
+
// src/popover.dom.ts
|
|
8
|
+
const getAnchorId = (scope) => scope.ids?.anchor ?? `${scope.id}:anchor`;
|
|
9
|
+
const getTriggerId = (scope, value) => {
|
|
10
|
+
const customId = scope.ids?.trigger;
|
|
11
|
+
if (customId != null) return (0, _zag_js_utils.isFunction)(customId) ? customId(value) : customId;
|
|
12
|
+
return value ? `${scope.id}:trigger:${value}` : `${scope.id}:trigger`;
|
|
9
13
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
14
|
+
const getContentId = (scope, value) => {
|
|
15
|
+
const id = scope.ids?.content ?? `${scope.id}:content`;
|
|
16
|
+
return value != null ? `${id}:${value}` : id;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
getActiveTriggerEl: () => getActiveTriggerEl,
|
|
24
|
-
getAnchorEl: () => getAnchorEl,
|
|
25
|
-
getAnchorId: () => getAnchorId,
|
|
26
|
-
getArrowEl: () => getArrowEl,
|
|
27
|
-
getArrowId: () => getArrowId,
|
|
28
|
-
getCloseTriggerId: () => getCloseTriggerId,
|
|
29
|
-
getContentEl: () => getContentEl,
|
|
30
|
-
getContentId: () => getContentId,
|
|
31
|
-
getDescriptionEl: () => getDescriptionEl,
|
|
32
|
-
getDescriptionId: () => getDescriptionId,
|
|
33
|
-
getFirstFocusableEl: () => getFirstFocusableEl,
|
|
34
|
-
getFocusableEls: () => getFocusableEls,
|
|
35
|
-
getPositionerEl: () => getPositionerEl,
|
|
36
|
-
getPositionerId: () => getPositionerId,
|
|
37
|
-
getTitleEl: () => getTitleEl,
|
|
38
|
-
getTitleId: () => getTitleId,
|
|
39
|
-
getTriggerEls: () => getTriggerEls,
|
|
40
|
-
getTriggerId: () => getTriggerId
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(popover_dom_exports);
|
|
43
|
-
var import_dom_query = require("@zag-js/dom-query");
|
|
44
|
-
var import_utils = require("@zag-js/utils");
|
|
45
|
-
var import_popover = require("./popover.anatomy.js");
|
|
46
|
-
var getAnchorId = (scope) => scope.ids?.anchor ?? `${scope.id}:anchor`;
|
|
47
|
-
var getTriggerId = (scope, value) => {
|
|
48
|
-
const customId = scope.ids?.trigger;
|
|
49
|
-
if (customId != null) return (0, import_utils.isFunction)(customId) ? customId(value) : customId;
|
|
50
|
-
return value ? `${scope.id}:trigger:${value}` : `${scope.id}:trigger`;
|
|
18
|
+
const getPositionerId = (scope) => scope.ids?.positioner ?? `${scope.id}:positioner`;
|
|
19
|
+
const getArrowId = (scope) => scope.ids?.arrow ?? `${scope.id}:arrow`;
|
|
20
|
+
const getTitleId = (scope, value) => {
|
|
21
|
+
const id = scope.ids?.title ?? `${scope.id}:title`;
|
|
22
|
+
return value != null ? `${id}:${value}` : id;
|
|
51
23
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var getTitleId = (scope) => scope.ids?.title ?? `${scope.id}:title`;
|
|
56
|
-
var getDescriptionId = (scope) => scope.ids?.description ?? `${scope.id}:desc`;
|
|
57
|
-
var getCloseTriggerId = (scope) => scope.ids?.closeTrigger ?? `${scope.id}:close`;
|
|
58
|
-
var getAnchorEl = (scope) => scope.query(scope.selector(import_popover.parts.anchor));
|
|
59
|
-
var getTriggerEls = (scope) => scope.queryAll(scope.selector(import_popover.parts.trigger));
|
|
60
|
-
var getActiveTriggerEl = (scope, value) => {
|
|
61
|
-
if (value == null) return getTriggerEls(scope)[0];
|
|
62
|
-
return scope.query(`${scope.selector(import_popover.parts.trigger)}[data-value="${value}"]`);
|
|
24
|
+
const getDescriptionId = (scope, value) => {
|
|
25
|
+
const id = scope.ids?.description ?? `${scope.id}:desc`;
|
|
26
|
+
return value != null ? `${id}:${value}` : id;
|
|
63
27
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
28
|
+
const getCloseTriggerId = (scope) => scope.ids?.closeTrigger ?? `${scope.id}:close`;
|
|
29
|
+
const getAnchorEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.anchor));
|
|
30
|
+
const getTriggerEls = (scope) => scope.queryAll(scope.selector(require_popover_anatomy.parts.trigger));
|
|
31
|
+
const getTriggerEl = (scope, value) => {
|
|
32
|
+
if (value == null) return getTriggerEls(scope)[0] ?? null;
|
|
33
|
+
return scope.query(`${scope.selector(require_popover_anatomy.parts.trigger)}[data-value="${value}"]`);
|
|
34
|
+
};
|
|
35
|
+
const getContentEl = (scope, value) => {
|
|
36
|
+
const selector = scope.selector(require_popover_anatomy.parts.content);
|
|
37
|
+
if (value == null) return scope.query(selector);
|
|
38
|
+
return scope.query(`${selector}[data-value="${value}"]`) ?? scope.query(`${selector}:not([data-value])`);
|
|
39
|
+
};
|
|
40
|
+
const getViewportEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.viewport));
|
|
41
|
+
const getLayerEl = (scope, value) => getViewportEl(scope) ?? getContentEl(scope, value);
|
|
42
|
+
const getPositionerEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.positioner));
|
|
43
|
+
const getArrowEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.arrow));
|
|
44
|
+
const getTitleEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.title));
|
|
45
|
+
const getDescriptionEl = (scope) => scope.query(scope.selector(require_popover_anatomy.parts.description));
|
|
46
|
+
exports.getAnchorEl = getAnchorEl;
|
|
47
|
+
exports.getAnchorId = getAnchorId;
|
|
48
|
+
exports.getArrowEl = getArrowEl;
|
|
49
|
+
exports.getArrowId = getArrowId;
|
|
50
|
+
exports.getCloseTriggerId = getCloseTriggerId;
|
|
51
|
+
exports.getContentEl = getContentEl;
|
|
52
|
+
exports.getContentId = getContentId;
|
|
53
|
+
exports.getDescriptionEl = getDescriptionEl;
|
|
54
|
+
exports.getDescriptionId = getDescriptionId;
|
|
55
|
+
exports.getLayerEl = getLayerEl;
|
|
56
|
+
exports.getPositionerEl = getPositionerEl;
|
|
57
|
+
exports.getPositionerId = getPositionerId;
|
|
58
|
+
exports.getTitleEl = getTitleEl;
|
|
59
|
+
exports.getTitleId = getTitleId;
|
|
60
|
+
exports.getTriggerEl = getTriggerEl;
|
|
61
|
+
exports.getTriggerEls = getTriggerEls;
|
|
62
|
+
exports.getTriggerId = getTriggerId;
|
|
63
|
+
exports.getViewportEl = getViewportEl;
|
package/dist/popover.dom.mjs
CHANGED
|
@@ -1,49 +1,42 @@
|
|
|
1
|
-
// src/popover.dom.ts
|
|
2
|
-
import { getFocusables } from "@zag-js/dom-query";
|
|
3
|
-
import { isFunction } from "@zag-js/utils";
|
|
4
1
|
import { parts } from "./popover.anatomy.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { isFunction } from "@zag-js/utils";
|
|
3
|
+
// src/popover.dom.ts
|
|
4
|
+
const getAnchorId = (scope) => scope.ids?.anchor ?? `${scope.id}:anchor`;
|
|
5
|
+
const getTriggerId = (scope, value) => {
|
|
6
|
+
const customId = scope.ids?.trigger;
|
|
7
|
+
if (customId != null) return isFunction(customId) ? customId(value) : customId;
|
|
8
|
+
return value ? `${scope.id}:trigger:${value}` : `${scope.id}:trigger`;
|
|
9
|
+
};
|
|
10
|
+
const getContentId = (scope, value) => {
|
|
11
|
+
const id = scope.ids?.content ?? `${scope.id}:content`;
|
|
12
|
+
return value != null ? `${id}:${value}` : id;
|
|
13
|
+
};
|
|
14
|
+
const getPositionerId = (scope) => scope.ids?.positioner ?? `${scope.id}:positioner`;
|
|
15
|
+
const getArrowId = (scope) => scope.ids?.arrow ?? `${scope.id}:arrow`;
|
|
16
|
+
const getTitleId = (scope, value) => {
|
|
17
|
+
const id = scope.ids?.title ?? `${scope.id}:title`;
|
|
18
|
+
return value != null ? `${id}:${value}` : id;
|
|
19
|
+
};
|
|
20
|
+
const getDescriptionId = (scope, value) => {
|
|
21
|
+
const id = scope.ids?.description ?? `${scope.id}:desc`;
|
|
22
|
+
return value != null ? `${id}:${value}` : id;
|
|
10
23
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var getAnchorEl = (scope) => scope.query(scope.selector(parts.anchor));
|
|
18
|
-
var getTriggerEls = (scope) => scope.queryAll(scope.selector(parts.trigger));
|
|
19
|
-
var getActiveTriggerEl = (scope, value) => {
|
|
20
|
-
if (value == null) return getTriggerEls(scope)[0];
|
|
21
|
-
return scope.query(`${scope.selector(parts.trigger)}[data-value="${value}"]`);
|
|
24
|
+
const getCloseTriggerId = (scope) => scope.ids?.closeTrigger ?? `${scope.id}:close`;
|
|
25
|
+
const getAnchorEl = (scope) => scope.query(scope.selector(parts.anchor));
|
|
26
|
+
const getTriggerEls = (scope) => scope.queryAll(scope.selector(parts.trigger));
|
|
27
|
+
const getTriggerEl = (scope, value) => {
|
|
28
|
+
if (value == null) return getTriggerEls(scope)[0] ?? null;
|
|
29
|
+
return scope.query(`${scope.selector(parts.trigger)}[data-value="${value}"]`);
|
|
22
30
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var getDescriptionEl = (scope) => scope.query(scope.selector(parts.description));
|
|
28
|
-
var getFocusableEls = (scope) => getFocusables(getContentEl(scope));
|
|
29
|
-
var getFirstFocusableEl = (scope) => getFocusableEls(scope)[0];
|
|
30
|
-
export {
|
|
31
|
-
getActiveTriggerEl,
|
|
32
|
-
getAnchorEl,
|
|
33
|
-
getAnchorId,
|
|
34
|
-
getArrowEl,
|
|
35
|
-
getArrowId,
|
|
36
|
-
getCloseTriggerId,
|
|
37
|
-
getContentEl,
|
|
38
|
-
getContentId,
|
|
39
|
-
getDescriptionEl,
|
|
40
|
-
getDescriptionId,
|
|
41
|
-
getFirstFocusableEl,
|
|
42
|
-
getFocusableEls,
|
|
43
|
-
getPositionerEl,
|
|
44
|
-
getPositionerId,
|
|
45
|
-
getTitleEl,
|
|
46
|
-
getTitleId,
|
|
47
|
-
getTriggerEls,
|
|
48
|
-
getTriggerId
|
|
31
|
+
const getContentEl = (scope, value) => {
|
|
32
|
+
const selector = scope.selector(parts.content);
|
|
33
|
+
if (value == null) return scope.query(selector);
|
|
34
|
+
return scope.query(`${selector}[data-value="${value}"]`) ?? scope.query(`${selector}:not([data-value])`);
|
|
49
35
|
};
|
|
36
|
+
const getViewportEl = (scope) => scope.query(scope.selector(parts.viewport));
|
|
37
|
+
const getLayerEl = (scope, value) => getViewportEl(scope) ?? getContentEl(scope, value);
|
|
38
|
+
const getPositionerEl = (scope) => scope.query(scope.selector(parts.positioner));
|
|
39
|
+
const getArrowEl = (scope) => scope.query(scope.selector(parts.arrow));
|
|
40
|
+
const getTitleEl = (scope) => scope.query(scope.selector(parts.title));
|
|
41
|
+
const getDescriptionEl = (scope) => scope.query(scope.selector(parts.description));
|
|
42
|
+
export { getAnchorEl, getAnchorId, getArrowEl, getArrowId, getCloseTriggerId, getContentEl, getContentId, getDescriptionEl, getDescriptionId, getLayerEl, getPositionerEl, getPositionerId, getTitleEl, getTitleId, getTriggerEl, getTriggerEls, getTriggerId, getViewportEl };
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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 };
|
|
1
|
+
import { PopoverSchema } from "./popover.types.mjs";
|
|
2
|
+
export declare const machine: import("@zag-js/core").Machine<PopoverSchema>;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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 };
|
|
1
|
+
import { PopoverSchema } from "./popover.types.js";
|
|
2
|
+
export declare const machine: import("@zag-js/core").Machine<PopoverSchema>;
|