@zag-js/popover 0.5.0 → 0.7.0
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/{chunk-QLF6NDJW.mjs → chunk-HRZXZNMW.mjs} +2 -2
- package/dist/{chunk-I6GHRN6K.mjs → chunk-HXXI3VDD.mjs} +3 -3
- package/dist/{chunk-4IGGT6KB.mjs → chunk-UA4OMIJI.mjs} +2 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +3 -3
- package/dist/popover.connect.d.ts +1 -1
- package/dist/popover.connect.js +3 -3
- package/dist/popover.connect.mjs +2 -2
- package/dist/popover.dom.js +2 -2
- package/dist/popover.dom.mjs +1 -1
- package/dist/popover.machine.js +4 -4
- package/dist/popover.machine.mjs +2 -2
- package/dist/popover.types.d.ts +8 -2
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KTOPDXGV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
dom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UA4OMIJI.mjs";
|
|
7
7
|
|
|
8
8
|
// src/popover.connect.ts
|
|
9
9
|
import { dataAttr } from "@zag-js/dom-query";
|
|
@@ -40,7 +40,7 @@ function connect(state, send, normalize) {
|
|
|
40
40
|
/**
|
|
41
41
|
* Function to reposition the popover
|
|
42
42
|
*/
|
|
43
|
-
setPositioning(options) {
|
|
43
|
+
setPositioning(options = {}) {
|
|
44
44
|
send({ type: "SET_POSITIONING", options });
|
|
45
45
|
},
|
|
46
46
|
arrowProps: normalize.element({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UA4OMIJI.mjs";
|
|
4
4
|
|
|
5
5
|
// src/popover.machine.ts
|
|
6
6
|
import { ariaHidden } from "@zag-js/aria-hidden";
|
|
@@ -195,10 +195,10 @@ function machine(userContext) {
|
|
|
195
195
|
raf(() => dom.getTriggerEl(ctx2)?.focus());
|
|
196
196
|
},
|
|
197
197
|
invokeOnOpen(ctx2) {
|
|
198
|
-
ctx2.
|
|
198
|
+
ctx2.onOpen?.();
|
|
199
199
|
},
|
|
200
200
|
invokeOnClose(ctx2) {
|
|
201
|
-
ctx2.
|
|
201
|
+
ctx2.onClose?.();
|
|
202
202
|
},
|
|
203
203
|
toggleVisibility(ctx2, _evt, { send }) {
|
|
204
204
|
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
|
@@ -7,8 +7,8 @@ var dom = createScope({
|
|
|
7
7
|
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
8
8
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
9
9
|
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
10
|
-
getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
|
|
11
|
-
getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
|
|
10
|
+
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
11
|
+
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
12
12
|
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
13
13
|
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
14
14
|
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
package/dist/index.js
CHANGED
|
@@ -54,8 +54,8 @@ var dom = (0, import_dom_query.createScope)({
|
|
|
54
54
|
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
55
55
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
56
56
|
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
57
|
-
getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
|
|
58
|
-
getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
|
|
57
|
+
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
58
|
+
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
59
59
|
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
60
60
|
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
61
61
|
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
|
@@ -114,7 +114,7 @@ function connect(state, send, normalize) {
|
|
|
114
114
|
/**
|
|
115
115
|
* Function to reposition the popover
|
|
116
116
|
*/
|
|
117
|
-
setPositioning(options) {
|
|
117
|
+
setPositioning(options = {}) {
|
|
118
118
|
send({ type: "SET_POSITIONING", options });
|
|
119
119
|
},
|
|
120
120
|
arrowProps: normalize.element({
|
|
@@ -375,10 +375,10 @@ function machine(userContext) {
|
|
|
375
375
|
(0, import_dom_query3.raf)(() => dom.getTriggerEl(ctx2)?.focus());
|
|
376
376
|
},
|
|
377
377
|
invokeOnOpen(ctx2) {
|
|
378
|
-
ctx2.
|
|
378
|
+
ctx2.onOpen?.();
|
|
379
379
|
},
|
|
380
380
|
invokeOnClose(ctx2) {
|
|
381
|
-
ctx2.
|
|
381
|
+
ctx2.onClose?.();
|
|
382
382
|
},
|
|
383
383
|
toggleVisibility(ctx2, _evt, { send }) {
|
|
384
384
|
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HRZXZNMW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
anatomy
|
|
6
6
|
} from "./chunk-KTOPDXGV.mjs";
|
|
7
7
|
import {
|
|
8
8
|
machine
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-HXXI3VDD.mjs";
|
|
10
|
+
import "./chunk-UA4OMIJI.mjs";
|
|
11
11
|
export {
|
|
12
12
|
anatomy,
|
|
13
13
|
connect,
|
|
@@ -24,7 +24,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
24
24
|
/**
|
|
25
25
|
* Function to reposition the popover
|
|
26
26
|
*/
|
|
27
|
-
setPositioning(options
|
|
27
|
+
setPositioning(options?: Partial<PositioningOptions>): void;
|
|
28
28
|
arrowProps: T["element"];
|
|
29
29
|
arrowTipProps: T["element"];
|
|
30
30
|
anchorProps: T["element"];
|
package/dist/popover.connect.js
CHANGED
|
@@ -50,8 +50,8 @@ var dom = (0, import_dom_query.createScope)({
|
|
|
50
50
|
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
51
51
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
52
52
|
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
53
|
-
getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
|
|
54
|
-
getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
|
|
53
|
+
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
54
|
+
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
55
55
|
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
56
56
|
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
57
57
|
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
|
@@ -110,7 +110,7 @@ function connect(state, send, normalize) {
|
|
|
110
110
|
/**
|
|
111
111
|
* Function to reposition the popover
|
|
112
112
|
*/
|
|
113
|
-
setPositioning(options) {
|
|
113
|
+
setPositioning(options = {}) {
|
|
114
114
|
send({ type: "SET_POSITIONING", options });
|
|
115
115
|
},
|
|
116
116
|
arrowProps: normalize.element({
|
package/dist/popover.connect.mjs
CHANGED
package/dist/popover.dom.js
CHANGED
|
@@ -31,8 +31,8 @@ var dom = (0, import_dom_query.createScope)({
|
|
|
31
31
|
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
32
32
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
33
33
|
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
34
|
-
getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
|
|
35
|
-
getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
|
|
34
|
+
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
35
|
+
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
36
36
|
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
37
37
|
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
38
38
|
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
package/dist/popover.dom.mjs
CHANGED
package/dist/popover.machine.js
CHANGED
|
@@ -42,8 +42,8 @@ var dom = (0, import_dom_query.createScope)({
|
|
|
42
42
|
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
43
43
|
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
44
44
|
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
45
|
-
getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
|
|
46
|
-
getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
|
|
45
|
+
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
46
|
+
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
47
47
|
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
48
48
|
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
49
49
|
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
|
@@ -253,10 +253,10 @@ function machine(userContext) {
|
|
|
253
253
|
(0, import_dom_query2.raf)(() => dom.getTriggerEl(ctx2)?.focus());
|
|
254
254
|
},
|
|
255
255
|
invokeOnOpen(ctx2) {
|
|
256
|
-
ctx2.
|
|
256
|
+
ctx2.onOpen?.();
|
|
257
257
|
},
|
|
258
258
|
invokeOnClose(ctx2) {
|
|
259
|
-
ctx2.
|
|
259
|
+
ctx2.onClose?.();
|
|
260
260
|
},
|
|
261
261
|
toggleVisibility(ctx2, _evt, { send }) {
|
|
262
262
|
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
package/dist/popover.machine.mjs
CHANGED
package/dist/popover.types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ type ElementIds = Partial<{
|
|
|
10
10
|
title: string;
|
|
11
11
|
description: string;
|
|
12
12
|
closeTrigger: string;
|
|
13
|
+
positioner: string;
|
|
14
|
+
arrow: string;
|
|
13
15
|
}>;
|
|
14
16
|
type PublicContext = DismissableElementHandlers & CommonProperties & {
|
|
15
17
|
/**
|
|
@@ -48,9 +50,13 @@ type PublicContext = DismissableElementHandlers & CommonProperties & {
|
|
|
48
50
|
*/
|
|
49
51
|
closeOnEsc?: boolean;
|
|
50
52
|
/**
|
|
51
|
-
* Function invoked when the popover is
|
|
53
|
+
* Function invoked when the popover is closed
|
|
52
54
|
*/
|
|
53
|
-
|
|
55
|
+
onClose?: VoidFunction;
|
|
56
|
+
/**
|
|
57
|
+
* Function invoked when the popover is opened
|
|
58
|
+
*/
|
|
59
|
+
onOpen?: VoidFunction;
|
|
54
60
|
/**
|
|
55
61
|
* The user provided options used to position the popover content
|
|
56
62
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popover",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Core logic for the popover widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"focus-trap": "7.4.0",
|
|
30
30
|
"@zag-js/anatomy": "0.1.4",
|
|
31
31
|
"@zag-js/aria-hidden": "0.2.2",
|
|
32
|
-
"@zag-js/core": "0.
|
|
32
|
+
"@zag-js/core": "0.7.0",
|
|
33
33
|
"@zag-js/dom-query": "0.1.4",
|
|
34
34
|
"@zag-js/utils": "0.3.4",
|
|
35
|
-
"@zag-js/dismissable": "0.
|
|
35
|
+
"@zag-js/dismissable": "0.6.0",
|
|
36
36
|
"@zag-js/tabbable": "0.1.1",
|
|
37
37
|
"@zag-js/popper": "0.2.7",
|
|
38
38
|
"@zag-js/remove-scroll": "0.2.4",
|