@zag-js/popover 0.2.15 → 0.5.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.
|
@@ -17,7 +17,7 @@ function machine(userContext) {
|
|
|
17
17
|
return createMachine(
|
|
18
18
|
{
|
|
19
19
|
id: "popover",
|
|
20
|
-
initial: ctx.
|
|
20
|
+
initial: ctx.open ? "open" : "closed",
|
|
21
21
|
context: {
|
|
22
22
|
closeOnInteractOutside: true,
|
|
23
23
|
closeOnEsc: true,
|
|
@@ -38,6 +38,9 @@ function machine(userContext) {
|
|
|
38
38
|
computed: {
|
|
39
39
|
currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
|
|
40
40
|
},
|
|
41
|
+
watch: {
|
|
42
|
+
open: ["toggleVisibility"]
|
|
43
|
+
},
|
|
41
44
|
entry: ["checkRenderedElements"],
|
|
42
45
|
states: {
|
|
43
46
|
closed: {
|
|
@@ -196,6 +199,9 @@ function machine(userContext) {
|
|
|
196
199
|
},
|
|
197
200
|
invokeOnClose(ctx2) {
|
|
198
201
|
ctx2.onOpenChange?.(false);
|
|
202
|
+
},
|
|
203
|
+
toggleVisibility(ctx2, _evt, { send }) {
|
|
204
|
+
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
|
199
205
|
}
|
|
200
206
|
}
|
|
201
207
|
}
|
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ function machine(userContext) {
|
|
|
197
197
|
return (0, import_core.createMachine)(
|
|
198
198
|
{
|
|
199
199
|
id: "popover",
|
|
200
|
-
initial: ctx.
|
|
200
|
+
initial: ctx.open ? "open" : "closed",
|
|
201
201
|
context: {
|
|
202
202
|
closeOnInteractOutside: true,
|
|
203
203
|
closeOnEsc: true,
|
|
@@ -218,6 +218,9 @@ function machine(userContext) {
|
|
|
218
218
|
computed: {
|
|
219
219
|
currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
|
|
220
220
|
},
|
|
221
|
+
watch: {
|
|
222
|
+
open: ["toggleVisibility"]
|
|
223
|
+
},
|
|
221
224
|
entry: ["checkRenderedElements"],
|
|
222
225
|
states: {
|
|
223
226
|
closed: {
|
|
@@ -376,6 +379,9 @@ function machine(userContext) {
|
|
|
376
379
|
},
|
|
377
380
|
invokeOnClose(ctx2) {
|
|
378
381
|
ctx2.onOpenChange?.(false);
|
|
382
|
+
},
|
|
383
|
+
toggleVisibility(ctx2, _evt, { send }) {
|
|
384
|
+
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
|
379
385
|
}
|
|
380
386
|
}
|
|
381
387
|
}
|
package/dist/index.mjs
CHANGED
package/dist/popover.machine.js
CHANGED
|
@@ -75,7 +75,7 @@ function machine(userContext) {
|
|
|
75
75
|
return (0, import_core.createMachine)(
|
|
76
76
|
{
|
|
77
77
|
id: "popover",
|
|
78
|
-
initial: ctx.
|
|
78
|
+
initial: ctx.open ? "open" : "closed",
|
|
79
79
|
context: {
|
|
80
80
|
closeOnInteractOutside: true,
|
|
81
81
|
closeOnEsc: true,
|
|
@@ -96,6 +96,9 @@ function machine(userContext) {
|
|
|
96
96
|
computed: {
|
|
97
97
|
currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
|
|
98
98
|
},
|
|
99
|
+
watch: {
|
|
100
|
+
open: ["toggleVisibility"]
|
|
101
|
+
},
|
|
99
102
|
entry: ["checkRenderedElements"],
|
|
100
103
|
states: {
|
|
101
104
|
closed: {
|
|
@@ -254,6 +257,9 @@ function machine(userContext) {
|
|
|
254
257
|
},
|
|
255
258
|
invokeOnClose(ctx2) {
|
|
256
259
|
ctx2.onOpenChange?.(false);
|
|
260
|
+
},
|
|
261
|
+
toggleVisibility(ctx2, _evt, { send }) {
|
|
262
|
+
send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
|
|
257
263
|
}
|
|
258
264
|
}
|
|
259
265
|
}
|
package/dist/popover.machine.mjs
CHANGED
package/dist/popover.types.d.ts
CHANGED
|
@@ -56,9 +56,9 @@ type PublicContext = DismissableElementHandlers & CommonProperties & {
|
|
|
56
56
|
*/
|
|
57
57
|
positioning: PositioningOptions;
|
|
58
58
|
/**
|
|
59
|
-
* Whether
|
|
59
|
+
* Whether the popover is open
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
open?: boolean;
|
|
62
62
|
};
|
|
63
63
|
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
64
64
|
type ComputedContext = Readonly<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popover",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Core logic for the popover widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,14 +29,14 @@
|
|
|
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.5.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.5.0",
|
|
36
|
+
"@zag-js/tabbable": "0.1.1",
|
|
36
37
|
"@zag-js/popper": "0.2.7",
|
|
37
38
|
"@zag-js/remove-scroll": "0.2.4",
|
|
38
|
-
"@zag-js/
|
|
39
|
-
"@zag-js/types": "0.3.4"
|
|
39
|
+
"@zag-js/types": "0.5.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"clean-package": "2.2.0"
|