@zag-js/popover 0.49.0 → 0.51.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/index.d.mts +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.js +1 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -439
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -11
- package/src/popover.connect.ts +3 -3
- package/src/popover.dom.ts +1 -10
- package/src/popover.machine.ts +18 -15
- package/src/popover.props.ts +2 -1
- package/src/popover.types.ts +16 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DismissableElementHandlers } from '@zag-js/dismissable';
|
|
1
|
+
import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
|
|
2
2
|
export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
|
|
3
3
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
4
|
-
import { RequiredBy, PropTypes, CommonProperties, DirectionProperty,
|
|
4
|
+
import { RequiredBy, PropTypes, CommonProperties, DirectionProperty, NormalizeProps } from '@zag-js/types';
|
|
5
5
|
import * as _zag_js_core from '@zag-js/core';
|
|
6
6
|
import { StateMachine } from '@zag-js/core';
|
|
7
7
|
import { PositioningOptions } from '@zag-js/popper';
|
|
8
8
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
9
|
|
|
10
|
-
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "
|
|
10
|
+
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "anchor" | "description" | "content" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "closeTrigger">;
|
|
11
11
|
|
|
12
12
|
interface OpenChangeDetails {
|
|
13
13
|
open: boolean;
|
|
@@ -22,7 +22,7 @@ type ElementIds = Partial<{
|
|
|
22
22
|
positioner: string;
|
|
23
23
|
arrow: string;
|
|
24
24
|
}>;
|
|
25
|
-
interface PublicContext extends
|
|
25
|
+
interface PublicContext extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
26
|
/**
|
|
27
27
|
* The ids of the elements in the popover. Useful for composition.
|
|
28
28
|
*/
|
|
@@ -38,7 +38,8 @@ interface PublicContext extends DismissableElementHandlers, CommonProperties, Di
|
|
|
38
38
|
*/
|
|
39
39
|
modal?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
* Whether the popover is
|
|
41
|
+
* Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
|
|
42
|
+
* of the popover content.
|
|
42
43
|
*
|
|
43
44
|
* @default true
|
|
44
45
|
*/
|
|
@@ -46,20 +47,24 @@ interface PublicContext extends DismissableElementHandlers, CommonProperties, Di
|
|
|
46
47
|
/**
|
|
47
48
|
* Whether to automatically set focus on the first focusable
|
|
48
49
|
* content within the popover when opened.
|
|
50
|
+
*
|
|
51
|
+
* @default true
|
|
49
52
|
*/
|
|
50
53
|
autoFocus?: boolean;
|
|
51
54
|
/**
|
|
52
55
|
* The element to focus on when the popover is opened.
|
|
53
56
|
*/
|
|
54
|
-
initialFocusEl?:
|
|
57
|
+
initialFocusEl?: () => HTMLElement | null;
|
|
55
58
|
/**
|
|
56
59
|
* Whether to close the popover when the user clicks outside of the popover.
|
|
60
|
+
* @default true
|
|
57
61
|
*/
|
|
58
62
|
closeOnInteractOutside?: boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Whether to close the popover when the escape key is pressed.
|
|
65
|
+
* @default true
|
|
61
66
|
*/
|
|
62
|
-
|
|
67
|
+
closeOnEscape?: boolean;
|
|
63
68
|
/**
|
|
64
69
|
* Function invoked when the popover opens or closes
|
|
65
70
|
*/
|
|
@@ -96,7 +101,7 @@ type State = StateMachine.State<MachineContext, MachineState>;
|
|
|
96
101
|
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
97
102
|
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
98
103
|
/**
|
|
99
|
-
* Whether the popover is portalled
|
|
104
|
+
* Whether the popover is portalled.
|
|
100
105
|
*/
|
|
101
106
|
portalled: boolean;
|
|
102
107
|
/**
|
|
@@ -127,7 +132,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
127
132
|
|
|
128
133
|
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
129
134
|
|
|
130
|
-
declare const props: ("dir" | "
|
|
131
|
-
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "dir" | "
|
|
135
|
+
declare const props: ("dir" | "id" | "getRootNode" | "open" | "autoFocus" | "onFocusOutside" | "onPointerDownOutside" | "onInteractOutside" | "onEscapeKeyDown" | "ids" | "modal" | "portalled" | "initialFocusEl" | "closeOnInteractOutside" | "closeOnEscape" | "onOpenChange" | "positioning" | "open.controlled" | "persistentElements")[];
|
|
136
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "dir" | "id" | "getRootNode" | "open" | "autoFocus" | "onFocusOutside" | "onPointerDownOutside" | "onInteractOutside" | "onEscapeKeyDown" | "ids" | "modal" | "portalled" | "initialFocusEl" | "closeOnInteractOutside" | "closeOnEscape" | "onOpenChange" | "positioning" | "open.controlled" | "persistentElements">];
|
|
132
137
|
|
|
133
138
|
export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type OpenChangeDetails, anatomy, connect, machine, props, splitProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DismissableElementHandlers } from '@zag-js/dismissable';
|
|
1
|
+
import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
|
|
2
2
|
export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
|
|
3
3
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
4
|
-
import { RequiredBy, PropTypes, CommonProperties, DirectionProperty,
|
|
4
|
+
import { RequiredBy, PropTypes, CommonProperties, DirectionProperty, NormalizeProps } from '@zag-js/types';
|
|
5
5
|
import * as _zag_js_core from '@zag-js/core';
|
|
6
6
|
import { StateMachine } from '@zag-js/core';
|
|
7
7
|
import { PositioningOptions } from '@zag-js/popper';
|
|
8
8
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
9
|
|
|
10
|
-
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "
|
|
10
|
+
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "anchor" | "description" | "content" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "closeTrigger">;
|
|
11
11
|
|
|
12
12
|
interface OpenChangeDetails {
|
|
13
13
|
open: boolean;
|
|
@@ -22,7 +22,7 @@ type ElementIds = Partial<{
|
|
|
22
22
|
positioner: string;
|
|
23
23
|
arrow: string;
|
|
24
24
|
}>;
|
|
25
|
-
interface PublicContext extends
|
|
25
|
+
interface PublicContext extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
26
|
/**
|
|
27
27
|
* The ids of the elements in the popover. Useful for composition.
|
|
28
28
|
*/
|
|
@@ -38,7 +38,8 @@ interface PublicContext extends DismissableElementHandlers, CommonProperties, Di
|
|
|
38
38
|
*/
|
|
39
39
|
modal?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
* Whether the popover is
|
|
41
|
+
* Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
|
|
42
|
+
* of the popover content.
|
|
42
43
|
*
|
|
43
44
|
* @default true
|
|
44
45
|
*/
|
|
@@ -46,20 +47,24 @@ interface PublicContext extends DismissableElementHandlers, CommonProperties, Di
|
|
|
46
47
|
/**
|
|
47
48
|
* Whether to automatically set focus on the first focusable
|
|
48
49
|
* content within the popover when opened.
|
|
50
|
+
*
|
|
51
|
+
* @default true
|
|
49
52
|
*/
|
|
50
53
|
autoFocus?: boolean;
|
|
51
54
|
/**
|
|
52
55
|
* The element to focus on when the popover is opened.
|
|
53
56
|
*/
|
|
54
|
-
initialFocusEl?:
|
|
57
|
+
initialFocusEl?: () => HTMLElement | null;
|
|
55
58
|
/**
|
|
56
59
|
* Whether to close the popover when the user clicks outside of the popover.
|
|
60
|
+
* @default true
|
|
57
61
|
*/
|
|
58
62
|
closeOnInteractOutside?: boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Whether to close the popover when the escape key is pressed.
|
|
65
|
+
* @default true
|
|
61
66
|
*/
|
|
62
|
-
|
|
67
|
+
closeOnEscape?: boolean;
|
|
63
68
|
/**
|
|
64
69
|
* Function invoked when the popover opens or closes
|
|
65
70
|
*/
|
|
@@ -96,7 +101,7 @@ type State = StateMachine.State<MachineContext, MachineState>;
|
|
|
96
101
|
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
97
102
|
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
98
103
|
/**
|
|
99
|
-
* Whether the popover is portalled
|
|
104
|
+
* Whether the popover is portalled.
|
|
100
105
|
*/
|
|
101
106
|
portalled: boolean;
|
|
102
107
|
/**
|
|
@@ -127,7 +132,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
|
|
|
127
132
|
|
|
128
133
|
declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
|
|
129
134
|
|
|
130
|
-
declare const props: ("dir" | "
|
|
131
|
-
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "dir" | "
|
|
135
|
+
declare const props: ("dir" | "id" | "getRootNode" | "open" | "autoFocus" | "onFocusOutside" | "onPointerDownOutside" | "onInteractOutside" | "onEscapeKeyDown" | "ids" | "modal" | "portalled" | "initialFocusEl" | "closeOnInteractOutside" | "closeOnEscape" | "onOpenChange" | "positioning" | "open.controlled" | "persistentElements")[];
|
|
136
|
+
declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "dir" | "id" | "getRootNode" | "open" | "autoFocus" | "onFocusOutside" | "onPointerDownOutside" | "onInteractOutside" | "onEscapeKeyDown" | "ids" | "modal" | "portalled" | "initialFocusEl" | "closeOnInteractOutside" | "closeOnEscape" | "onOpenChange" | "positioning" | "open.controlled" | "persistentElements">];
|
|
132
137
|
|
|
133
138
|
export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type OpenChangeDetails, anatomy, connect, machine, props, splitProps };
|
package/dist/index.js
CHANGED
|
@@ -1,471 +1,2 @@
|
|
|
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/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
anatomy: () => anatomy,
|
|
24
|
-
connect: () => connect,
|
|
25
|
-
machine: () => machine,
|
|
26
|
-
props: () => props,
|
|
27
|
-
splitProps: () => splitProps
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(src_exports);
|
|
30
|
-
|
|
31
|
-
// src/popover.anatomy.ts
|
|
32
|
-
var import_anatomy = require("@zag-js/anatomy");
|
|
33
|
-
var anatomy = (0, import_anatomy.createAnatomy)("popover").parts(
|
|
34
|
-
"arrow",
|
|
35
|
-
"arrowTip",
|
|
36
|
-
"anchor",
|
|
37
|
-
"trigger",
|
|
38
|
-
"indicator",
|
|
39
|
-
"positioner",
|
|
40
|
-
"content",
|
|
41
|
-
"title",
|
|
42
|
-
"description",
|
|
43
|
-
"closeTrigger"
|
|
44
|
-
);
|
|
45
|
-
var parts = anatomy.build();
|
|
46
|
-
|
|
47
|
-
// src/popover.connect.ts
|
|
48
|
-
var import_dom_query2 = require("@zag-js/dom-query");
|
|
49
|
-
var import_popper = require("@zag-js/popper");
|
|
50
|
-
|
|
51
|
-
// src/popover.dom.ts
|
|
52
|
-
var import_dom_query = require("@zag-js/dom-query");
|
|
53
|
-
var import_tabbable = require("@zag-js/tabbable");
|
|
54
|
-
var import_utils = require("@zag-js/utils");
|
|
55
|
-
var dom = (0, import_dom_query.createScope)({
|
|
56
|
-
getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
|
|
57
|
-
getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
|
|
58
|
-
getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
|
|
59
|
-
getPositionerId: (ctx) => ctx.ids?.positioner ?? `popover:${ctx.id}:popper`,
|
|
60
|
-
getArrowId: (ctx) => ctx.ids?.arrow ?? `popover:${ctx.id}:arrow`,
|
|
61
|
-
getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
|
|
62
|
-
getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
|
|
63
|
-
getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
|
|
64
|
-
getAnchorEl: (ctx) => dom.getById(ctx, dom.getAnchorId(ctx)),
|
|
65
|
-
getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
|
|
66
|
-
getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
|
|
67
|
-
getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
|
|
68
|
-
getTitleEl: (ctx) => dom.getById(ctx, dom.getTitleId(ctx)),
|
|
69
|
-
getDescriptionEl: (ctx) => dom.getById(ctx, dom.getDescriptionId(ctx)),
|
|
70
|
-
getFocusableEls: (ctx) => (0, import_tabbable.getFocusables)(dom.getContentEl(ctx)),
|
|
71
|
-
getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
|
|
72
|
-
getInitialFocusEl: (ctx) => {
|
|
73
|
-
let el = (0, import_utils.runIfFn)(ctx.initialFocusEl);
|
|
74
|
-
if (!el && ctx.autoFocus)
|
|
75
|
-
el = dom.getFirstFocusableEl(ctx);
|
|
76
|
-
if (!el)
|
|
77
|
-
el = dom.getContentEl(ctx);
|
|
78
|
-
return el;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// src/popover.connect.ts
|
|
83
|
-
function connect(state, send, normalize) {
|
|
84
|
-
const open = state.matches("open");
|
|
85
|
-
const currentPlacement = state.context.currentPlacement;
|
|
86
|
-
const portalled = state.context.currentPortalled;
|
|
87
|
-
const rendered = state.context.renderedElements;
|
|
88
|
-
const popperStyles = (0, import_popper.getPlacementStyles)({
|
|
89
|
-
...state.context.positioning,
|
|
90
|
-
placement: currentPlacement
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
portalled,
|
|
94
|
-
open,
|
|
95
|
-
setOpen(_open) {
|
|
96
|
-
if (_open === open)
|
|
97
|
-
return;
|
|
98
|
-
send(_open ? "OPEN" : "CLOSE");
|
|
99
|
-
},
|
|
100
|
-
reposition(options = {}) {
|
|
101
|
-
send({ type: "POSITIONING.SET", options });
|
|
102
|
-
},
|
|
103
|
-
arrowProps: normalize.element({
|
|
104
|
-
id: dom.getArrowId(state.context),
|
|
105
|
-
...parts.arrow.attrs,
|
|
106
|
-
dir: state.context.dir,
|
|
107
|
-
style: popperStyles.arrow
|
|
108
|
-
}),
|
|
109
|
-
arrowTipProps: normalize.element({
|
|
110
|
-
...parts.arrowTip.attrs,
|
|
111
|
-
dir: state.context.dir,
|
|
112
|
-
style: popperStyles.arrowTip
|
|
113
|
-
}),
|
|
114
|
-
anchorProps: normalize.element({
|
|
115
|
-
...parts.anchor.attrs,
|
|
116
|
-
dir: state.context.dir,
|
|
117
|
-
id: dom.getAnchorId(state.context)
|
|
118
|
-
}),
|
|
119
|
-
triggerProps: normalize.button({
|
|
120
|
-
...parts.trigger.attrs,
|
|
121
|
-
dir: state.context.dir,
|
|
122
|
-
type: "button",
|
|
123
|
-
"data-placement": currentPlacement,
|
|
124
|
-
id: dom.getTriggerId(state.context),
|
|
125
|
-
"aria-haspopup": "dialog",
|
|
126
|
-
"aria-expanded": open,
|
|
127
|
-
"data-state": open ? "open" : "closed",
|
|
128
|
-
"aria-controls": dom.getContentId(state.context),
|
|
129
|
-
onClick(event) {
|
|
130
|
-
if (event.defaultPrevented)
|
|
131
|
-
return;
|
|
132
|
-
send("TOGGLE");
|
|
133
|
-
},
|
|
134
|
-
onBlur(event) {
|
|
135
|
-
send({ type: "TRIGGER_BLUR", target: event.relatedTarget });
|
|
136
|
-
}
|
|
137
|
-
}),
|
|
138
|
-
indicatorProps: normalize.element({
|
|
139
|
-
...parts.indicator.attrs,
|
|
140
|
-
dir: state.context.dir,
|
|
141
|
-
"data-state": open ? "open" : "closed"
|
|
142
|
-
}),
|
|
143
|
-
positionerProps: normalize.element({
|
|
144
|
-
id: dom.getPositionerId(state.context),
|
|
145
|
-
...parts.positioner.attrs,
|
|
146
|
-
dir: state.context.dir,
|
|
147
|
-
style: popperStyles.floating
|
|
148
|
-
}),
|
|
149
|
-
contentProps: normalize.element({
|
|
150
|
-
...parts.content.attrs,
|
|
151
|
-
dir: state.context.dir,
|
|
152
|
-
id: dom.getContentId(state.context),
|
|
153
|
-
tabIndex: -1,
|
|
154
|
-
role: "dialog",
|
|
155
|
-
hidden: !open,
|
|
156
|
-
"data-state": open ? "open" : "closed",
|
|
157
|
-
"data-expanded": (0, import_dom_query2.dataAttr)(open),
|
|
158
|
-
"aria-labelledby": rendered.title ? dom.getTitleId(state.context) : void 0,
|
|
159
|
-
"aria-describedby": rendered.description ? dom.getDescriptionId(state.context) : void 0,
|
|
160
|
-
"data-placement": currentPlacement
|
|
161
|
-
}),
|
|
162
|
-
titleProps: normalize.element({
|
|
163
|
-
...parts.title.attrs,
|
|
164
|
-
id: dom.getTitleId(state.context),
|
|
165
|
-
dir: state.context.dir
|
|
166
|
-
}),
|
|
167
|
-
descriptionProps: normalize.element({
|
|
168
|
-
...parts.description.attrs,
|
|
169
|
-
id: dom.getDescriptionId(state.context),
|
|
170
|
-
dir: state.context.dir
|
|
171
|
-
}),
|
|
172
|
-
closeTriggerProps: normalize.button({
|
|
173
|
-
...parts.closeTrigger.attrs,
|
|
174
|
-
dir: state.context.dir,
|
|
175
|
-
id: dom.getCloseTriggerId(state.context),
|
|
176
|
-
type: "button",
|
|
177
|
-
"aria-label": "close",
|
|
178
|
-
onClick(event) {
|
|
179
|
-
if (event.defaultPrevented)
|
|
180
|
-
return;
|
|
181
|
-
send("CLOSE");
|
|
182
|
-
}
|
|
183
|
-
})
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// src/popover.machine.ts
|
|
188
|
-
var import_aria_hidden = require("@zag-js/aria-hidden");
|
|
189
|
-
var import_core = require("@zag-js/core");
|
|
190
|
-
var import_dismissable = require("@zag-js/dismissable");
|
|
191
|
-
var import_dom_query3 = require("@zag-js/dom-query");
|
|
192
|
-
var import_popper2 = require("@zag-js/popper");
|
|
193
|
-
var import_remove_scroll = require("@zag-js/remove-scroll");
|
|
194
|
-
var import_tabbable2 = require("@zag-js/tabbable");
|
|
195
|
-
var import_utils2 = require("@zag-js/utils");
|
|
196
|
-
var import_focus_trap = require("focus-trap");
|
|
197
|
-
function machine(userContext) {
|
|
198
|
-
const ctx = (0, import_utils2.compact)(userContext);
|
|
199
|
-
return (0, import_core.createMachine)(
|
|
200
|
-
{
|
|
201
|
-
id: "popover",
|
|
202
|
-
initial: ctx.open ? "open" : "closed",
|
|
203
|
-
context: {
|
|
204
|
-
closeOnInteractOutside: true,
|
|
205
|
-
closeOnEsc: true,
|
|
206
|
-
autoFocus: true,
|
|
207
|
-
modal: false,
|
|
208
|
-
portalled: true,
|
|
209
|
-
positioning: {
|
|
210
|
-
placement: "bottom",
|
|
211
|
-
...ctx.positioning
|
|
212
|
-
},
|
|
213
|
-
currentPlacement: void 0,
|
|
214
|
-
...ctx,
|
|
215
|
-
renderedElements: {
|
|
216
|
-
title: true,
|
|
217
|
-
description: true
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
computed: {
|
|
221
|
-
currentPortalled: (ctx2) => !!ctx2.modal || !!ctx2.portalled
|
|
222
|
-
},
|
|
223
|
-
watch: {
|
|
224
|
-
open: ["toggleVisibility"]
|
|
225
|
-
},
|
|
226
|
-
entry: ["checkRenderedElements"],
|
|
227
|
-
states: {
|
|
228
|
-
closed: {
|
|
229
|
-
on: {
|
|
230
|
-
"CONTROLLED.OPEN": {
|
|
231
|
-
target: "open",
|
|
232
|
-
actions: ["setInitialFocus"]
|
|
233
|
-
},
|
|
234
|
-
TOGGLE: [
|
|
235
|
-
{
|
|
236
|
-
guard: "isOpenControlled",
|
|
237
|
-
actions: ["invokeOnOpen"]
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
target: "open",
|
|
241
|
-
actions: ["invokeOnOpen", "setInitialFocus"]
|
|
242
|
-
}
|
|
243
|
-
],
|
|
244
|
-
OPEN: [
|
|
245
|
-
{
|
|
246
|
-
guard: "isOpenControlled",
|
|
247
|
-
actions: ["invokeOnOpen"]
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
target: "open",
|
|
251
|
-
actions: ["invokeOnOpen", "setInitialFocus"]
|
|
252
|
-
}
|
|
253
|
-
]
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
open: {
|
|
257
|
-
activities: [
|
|
258
|
-
"trapFocus",
|
|
259
|
-
"preventScroll",
|
|
260
|
-
"hideContentBelow",
|
|
261
|
-
"trackPositioning",
|
|
262
|
-
"trackDismissableElement",
|
|
263
|
-
"proxyTabFocus"
|
|
264
|
-
],
|
|
265
|
-
on: {
|
|
266
|
-
"CONTROLLED.CLOSE": {
|
|
267
|
-
target: "closed",
|
|
268
|
-
actions: ["restoreFocus"]
|
|
269
|
-
},
|
|
270
|
-
CLOSE: [
|
|
271
|
-
{
|
|
272
|
-
guard: "isOpenControlled",
|
|
273
|
-
actions: ["invokeOnClose"]
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
target: "closed",
|
|
277
|
-
actions: ["invokeOnClose", "restoreFocus"]
|
|
278
|
-
}
|
|
279
|
-
],
|
|
280
|
-
TOGGLE: [
|
|
281
|
-
{
|
|
282
|
-
guard: "isOpenControlled",
|
|
283
|
-
actions: ["invokeOnClose"]
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
target: "closed",
|
|
287
|
-
actions: ["invokeOnClose"]
|
|
288
|
-
}
|
|
289
|
-
],
|
|
290
|
-
"POSITIONING.SET": {
|
|
291
|
-
actions: "reposition"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
guards: {
|
|
299
|
-
isOpenControlled: (ctx2) => !!ctx2["open.controlled"]
|
|
300
|
-
},
|
|
301
|
-
activities: {
|
|
302
|
-
trackPositioning(ctx2) {
|
|
303
|
-
ctx2.currentPlacement = ctx2.positioning.placement;
|
|
304
|
-
const anchorEl = dom.getAnchorEl(ctx2) ?? dom.getTriggerEl(ctx2);
|
|
305
|
-
const getPositionerEl = () => dom.getPositionerEl(ctx2);
|
|
306
|
-
return (0, import_popper2.getPlacement)(anchorEl, getPositionerEl, {
|
|
307
|
-
...ctx2.positioning,
|
|
308
|
-
defer: true,
|
|
309
|
-
onComplete(data) {
|
|
310
|
-
ctx2.currentPlacement = data.placement;
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
},
|
|
314
|
-
trackDismissableElement(ctx2, _evt, { send }) {
|
|
315
|
-
const getContentEl = () => dom.getContentEl(ctx2);
|
|
316
|
-
let restoreFocus = true;
|
|
317
|
-
return (0, import_dismissable.trackDismissableElement)(getContentEl, {
|
|
318
|
-
pointerBlocking: ctx2.modal,
|
|
319
|
-
exclude: dom.getTriggerEl(ctx2),
|
|
320
|
-
defer: true,
|
|
321
|
-
onEscapeKeyDown(event) {
|
|
322
|
-
ctx2.onEscapeKeyDown?.(event);
|
|
323
|
-
if (ctx2.closeOnEsc)
|
|
324
|
-
return;
|
|
325
|
-
event.preventDefault();
|
|
326
|
-
},
|
|
327
|
-
onInteractOutside(event) {
|
|
328
|
-
ctx2.onInteractOutside?.(event);
|
|
329
|
-
if (event.defaultPrevented)
|
|
330
|
-
return;
|
|
331
|
-
restoreFocus = !(event.detail.focusable || event.detail.contextmenu);
|
|
332
|
-
if (!ctx2.closeOnInteractOutside) {
|
|
333
|
-
event.preventDefault();
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
onPointerDownOutside: ctx2.onPointerDownOutside,
|
|
337
|
-
onFocusOutside: ctx2.onFocusOutside,
|
|
338
|
-
onDismiss() {
|
|
339
|
-
send({ type: "CLOSE", src: "interact-outside", restoreFocus });
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
},
|
|
343
|
-
proxyTabFocus(ctx2) {
|
|
344
|
-
if (ctx2.modal || !ctx2.portalled)
|
|
345
|
-
return;
|
|
346
|
-
const getContentEl = () => dom.getContentEl(ctx2);
|
|
347
|
-
return (0, import_tabbable2.proxyTabFocus)(getContentEl, {
|
|
348
|
-
triggerElement: dom.getTriggerEl(ctx2),
|
|
349
|
-
defer: true,
|
|
350
|
-
onFocus(el) {
|
|
351
|
-
el.focus({ preventScroll: true });
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
},
|
|
355
|
-
hideContentBelow(ctx2) {
|
|
356
|
-
if (!ctx2.modal)
|
|
357
|
-
return;
|
|
358
|
-
const getElements = () => [dom.getContentEl(ctx2), dom.getTriggerEl(ctx2)];
|
|
359
|
-
return (0, import_aria_hidden.ariaHidden)(getElements, { defer: true });
|
|
360
|
-
},
|
|
361
|
-
preventScroll(ctx2) {
|
|
362
|
-
if (!ctx2.modal)
|
|
363
|
-
return;
|
|
364
|
-
return (0, import_remove_scroll.preventBodyScroll)(dom.getDoc(ctx2));
|
|
365
|
-
},
|
|
366
|
-
trapFocus(ctx2) {
|
|
367
|
-
if (!ctx2.modal)
|
|
368
|
-
return;
|
|
369
|
-
let trap;
|
|
370
|
-
(0, import_dom_query3.nextTick)(() => {
|
|
371
|
-
const el = dom.getContentEl(ctx2);
|
|
372
|
-
if (!el)
|
|
373
|
-
return;
|
|
374
|
-
trap = (0, import_focus_trap.createFocusTrap)(el, {
|
|
375
|
-
escapeDeactivates: false,
|
|
376
|
-
allowOutsideClick: true,
|
|
377
|
-
preventScroll: true,
|
|
378
|
-
returnFocusOnDeactivate: true,
|
|
379
|
-
document: dom.getDoc(ctx2),
|
|
380
|
-
fallbackFocus: el,
|
|
381
|
-
initialFocus: (0, import_utils2.runIfFn)(ctx2.initialFocusEl)
|
|
382
|
-
});
|
|
383
|
-
try {
|
|
384
|
-
trap.activate();
|
|
385
|
-
} catch {
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
return () => trap?.deactivate();
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
actions: {
|
|
392
|
-
reposition(ctx2, evt) {
|
|
393
|
-
const anchorEl = dom.getAnchorEl(ctx2) ?? dom.getTriggerEl(ctx2);
|
|
394
|
-
const getPositionerEl = () => dom.getPositionerEl(ctx2);
|
|
395
|
-
(0, import_popper2.getPlacement)(anchorEl, getPositionerEl, {
|
|
396
|
-
...ctx2.positioning,
|
|
397
|
-
...evt.options,
|
|
398
|
-
defer: true,
|
|
399
|
-
listeners: false,
|
|
400
|
-
onComplete(data) {
|
|
401
|
-
ctx2.currentPlacement = data.placement;
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
},
|
|
405
|
-
checkRenderedElements(ctx2) {
|
|
406
|
-
(0, import_dom_query3.raf)(() => {
|
|
407
|
-
Object.assign(ctx2.renderedElements, {
|
|
408
|
-
title: !!dom.getTitleEl(ctx2),
|
|
409
|
-
description: !!dom.getDescriptionEl(ctx2)
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
},
|
|
413
|
-
setInitialFocus(ctx2) {
|
|
414
|
-
(0, import_dom_query3.raf)(() => {
|
|
415
|
-
dom.getInitialFocusEl(ctx2)?.focus({ preventScroll: true });
|
|
416
|
-
});
|
|
417
|
-
},
|
|
418
|
-
restoreFocus(ctx2, evt) {
|
|
419
|
-
if (!evt.restoreFocus)
|
|
420
|
-
return;
|
|
421
|
-
(0, import_dom_query3.raf)(() => {
|
|
422
|
-
dom.getTriggerEl(ctx2)?.focus({ preventScroll: true });
|
|
423
|
-
});
|
|
424
|
-
},
|
|
425
|
-
invokeOnOpen(ctx2) {
|
|
426
|
-
ctx2.onOpenChange?.({ open: true });
|
|
427
|
-
},
|
|
428
|
-
invokeOnClose(ctx2) {
|
|
429
|
-
ctx2.onOpenChange?.({ open: false });
|
|
430
|
-
},
|
|
431
|
-
toggleVisibility(ctx2, evt, { send }) {
|
|
432
|
-
send({ type: ctx2.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: evt });
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// src/popover.props.ts
|
|
440
|
-
var import_types = require("@zag-js/types");
|
|
441
|
-
var import_utils3 = require("@zag-js/utils");
|
|
442
|
-
var props = (0, import_types.createProps)()([
|
|
443
|
-
"autoFocus",
|
|
444
|
-
"closeOnEsc",
|
|
445
|
-
"closeOnInteractOutside",
|
|
446
|
-
"dir",
|
|
447
|
-
"getRootNode",
|
|
448
|
-
"id",
|
|
449
|
-
"ids",
|
|
450
|
-
"initialFocusEl",
|
|
451
|
-
"modal",
|
|
452
|
-
"onEscapeKeyDown",
|
|
453
|
-
"onFocusOutside",
|
|
454
|
-
"onInteractOutside",
|
|
455
|
-
"onOpenChange",
|
|
456
|
-
"onPointerDownOutside",
|
|
457
|
-
"open.controlled",
|
|
458
|
-
"open",
|
|
459
|
-
"portalled",
|
|
460
|
-
"positioning"
|
|
461
|
-
]);
|
|
462
|
-
var splitProps = (0, import_utils3.createSplitProps)(props);
|
|
463
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
464
|
-
0 && (module.exports = {
|
|
465
|
-
anatomy,
|
|
466
|
-
connect,
|
|
467
|
-
machine,
|
|
468
|
-
props,
|
|
469
|
-
splitProps
|
|
470
|
-
});
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var src_exports={};__export(src_exports,{anatomy:()=>anatomy,connect:()=>connect,machine:()=>machine,props:()=>props,splitProps:()=>splitProps});module.exports=__toCommonJS(src_exports);var import_anatomy=require("@zag-js/anatomy");var anatomy=(0,import_anatomy.createAnatomy)("popover").parts("arrow","arrowTip","anchor","trigger","indicator","positioner","content","title","description","closeTrigger");var parts=anatomy.build();var import_dom_query2=require("@zag-js/dom-query");var import_popper=require("@zag-js/popper");var import_dom_query=require("@zag-js/dom-query");var dom=(0,import_dom_query.createScope)({getAnchorId:ctx=>ctx.ids?.anchor??`popover:${ctx.id}:anchor`,getTriggerId:ctx=>ctx.ids?.trigger??`popover:${ctx.id}:trigger`,getContentId:ctx=>ctx.ids?.content??`popover:${ctx.id}:content`,getPositionerId:ctx=>ctx.ids?.positioner??`popover:${ctx.id}:popper`,getArrowId:ctx=>ctx.ids?.arrow??`popover:${ctx.id}:arrow`,getTitleId:ctx=>ctx.ids?.title??`popover:${ctx.id}:title`,getDescriptionId:ctx=>ctx.ids?.description??`popover:${ctx.id}:desc`,getCloseTriggerId:ctx=>ctx.ids?.closeTrigger??`popover:${ctx.id}:close`,getAnchorEl:ctx=>dom.getById(ctx,dom.getAnchorId(ctx)),getTriggerEl:ctx=>dom.getById(ctx,dom.getTriggerId(ctx)),getContentEl:ctx=>dom.getById(ctx,dom.getContentId(ctx)),getPositionerEl:ctx=>dom.getById(ctx,dom.getPositionerId(ctx)),getTitleEl:ctx=>dom.getById(ctx,dom.getTitleId(ctx)),getDescriptionEl:ctx=>dom.getById(ctx,dom.getDescriptionId(ctx)),getFocusableEls:ctx=>(0,import_dom_query.getFocusables)(dom.getContentEl(ctx)),getFirstFocusableEl:ctx=>dom.getFocusableEls(ctx)[0]});function connect(state,send,normalize){const open=state.matches("open");const currentPlacement=state.context.currentPlacement;const portalled=state.context.currentPortalled;const rendered=state.context.renderedElements;const popperStyles=(0,import_popper.getPlacementStyles)({...state.context.positioning,placement:currentPlacement});return{portalled,open,setOpen(nextOpen){if(nextOpen===open)return;send(nextOpen?"OPEN":"CLOSE")},reposition(options={}){send({type:"POSITIONING.SET",options})},arrowProps:normalize.element({id:dom.getArrowId(state.context),...parts.arrow.attrs,dir:state.context.dir,style:popperStyles.arrow}),arrowTipProps:normalize.element({...parts.arrowTip.attrs,dir:state.context.dir,style:popperStyles.arrowTip}),anchorProps:normalize.element({...parts.anchor.attrs,dir:state.context.dir,id:dom.getAnchorId(state.context)}),triggerProps:normalize.button({...parts.trigger.attrs,dir:state.context.dir,type:"button","data-placement":currentPlacement,id:dom.getTriggerId(state.context),"aria-haspopup":"dialog","aria-expanded":open,"data-state":open?"open":"closed","aria-controls":dom.getContentId(state.context),onClick(event){if(event.defaultPrevented)return;send("TOGGLE")},onBlur(event){send({type:"TRIGGER_BLUR",target:event.relatedTarget})}}),indicatorProps:normalize.element({...parts.indicator.attrs,dir:state.context.dir,"data-state":open?"open":"closed"}),positionerProps:normalize.element({id:dom.getPositionerId(state.context),...parts.positioner.attrs,dir:state.context.dir,style:popperStyles.floating}),contentProps:normalize.element({...parts.content.attrs,dir:state.context.dir,id:dom.getContentId(state.context),tabIndex:-1,role:"dialog",hidden:!open,"data-state":open?"open":"closed","data-expanded":(0,import_dom_query2.dataAttr)(open),"aria-labelledby":rendered.title?dom.getTitleId(state.context):void 0,"aria-describedby":rendered.description?dom.getDescriptionId(state.context):void 0,"data-placement":currentPlacement}),titleProps:normalize.element({...parts.title.attrs,id:dom.getTitleId(state.context),dir:state.context.dir}),descriptionProps:normalize.element({...parts.description.attrs,id:dom.getDescriptionId(state.context),dir:state.context.dir}),closeTriggerProps:normalize.button({...parts.closeTrigger.attrs,dir:state.context.dir,id:dom.getCloseTriggerId(state.context),type:"button","aria-label":"close",onClick(event){if(event.defaultPrevented)return;send("CLOSE")}})}}var import_aria_hidden=require("@zag-js/aria-hidden");var import_core=require("@zag-js/core");var import_dismissable=require("@zag-js/dismissable");var import_dom_query3=require("@zag-js/dom-query");var import_popper2=require("@zag-js/popper");var import_remove_scroll=require("@zag-js/remove-scroll");var import_utils=require("@zag-js/utils");var import_focus_trap=require("focus-trap");function machine(userContext){const ctx=(0,import_utils.compact)(userContext);return(0,import_core.createMachine)({id:"popover",initial:ctx.open?"open":"closed",context:{closeOnInteractOutside:true,closeOnEscape:true,autoFocus:true,modal:false,portalled:true,positioning:{placement:"bottom",...ctx.positioning},currentPlacement:void 0,...ctx,renderedElements:{title:true,description:true}},computed:{currentPortalled:ctx2=>!!ctx2.modal||!!ctx2.portalled},watch:{open:["toggleVisibility"]},entry:["checkRenderedElements"],states:{closed:{on:{"CONTROLLED.OPEN":{target:"open",actions:["setInitialFocus"]},TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus"]}]}},open:{activities:["trapFocus","preventScroll","hideContentBelow","trackPositioning","trackDismissableElement","proxyTabFocus"],on:{"CONTROLLED.CLOSE":{target:"closed",actions:["setFinalFocus"]},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","setFinalFocus"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"POSITIONING.SET":{actions:"reposition"}}}}},{guards:{isOpenControlled:ctx2=>!!ctx2["open.controlled"]},activities:{trackPositioning(ctx2){ctx2.currentPlacement=ctx2.positioning.placement;const anchorEl=dom.getAnchorEl(ctx2)??dom.getTriggerEl(ctx2);const getPositionerEl=()=>dom.getPositionerEl(ctx2);return(0,import_popper2.getPlacement)(anchorEl,getPositionerEl,{...ctx2.positioning,defer:true,onComplete(data){ctx2.currentPlacement=data.placement}})},trackDismissableElement(ctx2,_evt,{send}){const getContentEl=()=>dom.getContentEl(ctx2);let restoreFocus=true;return(0,import_dismissable.trackDismissableElement)(getContentEl,{pointerBlocking:ctx2.modal,exclude:dom.getTriggerEl(ctx2),defer:true,onEscapeKeyDown(event){ctx2.onEscapeKeyDown?.(event);if(ctx2.closeOnEscape)return;event.preventDefault()},onInteractOutside(event){ctx2.onInteractOutside?.(event);if(event.defaultPrevented)return;restoreFocus=!(event.detail.focusable||event.detail.contextmenu);if(!ctx2.closeOnInteractOutside){event.preventDefault()}},onPointerDownOutside:ctx2.onPointerDownOutside,onFocusOutside:ctx2.onFocusOutside,persistentElements:ctx2.persistentElements,onDismiss(){send({type:"CLOSE",src:"interact-outside",restoreFocus})}})},proxyTabFocus(ctx2){if(ctx2.modal||!ctx2.portalled)return;const getContentEl=()=>dom.getContentEl(ctx2);return(0,import_dom_query3.proxyTabFocus)(getContentEl,{triggerElement:dom.getTriggerEl(ctx2),defer:true,onFocus(el){el.focus({preventScroll:true})}})},hideContentBelow(ctx2){if(!ctx2.modal)return;const getElements=()=>[dom.getContentEl(ctx2),dom.getTriggerEl(ctx2)];return(0,import_aria_hidden.ariaHidden)(getElements,{defer:true})},preventScroll(ctx2){if(!ctx2.modal)return;return(0,import_remove_scroll.preventBodyScroll)(dom.getDoc(ctx2))},trapFocus(ctx2){if(!ctx2.modal)return;let trap;(0,import_dom_query3.nextTick)(()=>{const contentEl=dom.getContentEl(ctx2);if(!contentEl)return;trap=(0,import_focus_trap.createFocusTrap)(contentEl,{escapeDeactivates:false,allowOutsideClick:true,preventScroll:true,returnFocusOnDeactivate:true,document:dom.getDoc(ctx2),fallbackFocus:contentEl,initialFocus:(0,import_dom_query3.getInitialFocus)(dom.getContentEl(ctx2),ctx2.initialFocusEl)});try{trap.activate()}catch{}});return()=>trap?.deactivate()}},actions:{reposition(ctx2,evt){const anchorEl=dom.getAnchorEl(ctx2)??dom.getTriggerEl(ctx2);const getPositionerEl=()=>dom.getPositionerEl(ctx2);(0,import_popper2.getPlacement)(anchorEl,getPositionerEl,{...ctx2.positioning,...evt.options,defer:true,listeners:false,onComplete(data){ctx2.currentPlacement=data.placement}})},checkRenderedElements(ctx2){(0,import_dom_query3.raf)(()=>{Object.assign(ctx2.renderedElements,{title:!!dom.getTitleEl(ctx2),description:!!dom.getDescriptionEl(ctx2)})})},setInitialFocus(ctx2){(0,import_dom_query3.raf)(()=>{const element=(0,import_dom_query3.getInitialFocus)(dom.getContentEl(ctx2),ctx2.initialFocusEl);element?.focus()})},setFinalFocus(ctx2,evt){if(!evt.restoreFocus)return;(0,import_dom_query3.raf)(()=>{const element=dom.getTriggerEl(ctx2);element?.focus({preventScroll:true})})},invokeOnOpen(ctx2){ctx2.onOpenChange?.({open:true})},invokeOnClose(ctx2){ctx2.onOpenChange?.({open:false})},toggleVisibility(ctx2,evt,{send}){send({type:ctx2.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:evt})}}})}var import_types=require("@zag-js/types");var import_utils2=require("@zag-js/utils");var props=(0,import_types.createProps)()(["autoFocus","closeOnEscape","closeOnInteractOutside","dir","getRootNode","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open.controlled","open","persistentElements","portalled","positioning"]);var splitProps=(0,import_utils2.createSplitProps)(props);0&&(module.exports={anatomy,connect,machine,props,splitProps});
|
|
471
2
|
//# sourceMappingURL=index.js.map
|