@zag-js/popover 1.46.0 → 1.48.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 +7 -10
- package/dist/index.d.ts +7 -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 +164 -187
- package/dist/popover.connect.mjs +158 -150
- package/dist/popover.dom.d.mts +19 -22
- package/dist/popover.dom.d.ts +19 -22
- package/dist/popover.dom.js +47 -89
- package/dist/popover.dom.mjs +25 -46
- package/dist/popover.machine.d.mts +2 -9
- package/dist/popover.machine.d.ts +2 -9
- package/dist/popover.machine.js +299 -335
- package/dist/popover.machine.mjs +291 -296
- package/dist/popover.props.d.mts +3 -10
- package/dist/popover.props.d.ts +3 -10
- package/dist/popover.props.js +35 -60
- package/dist/popover.props.mjs +31 -34
- package/dist/popover.types.d.mts +185 -188
- package/dist/popover.types.d.ts +185 -188
- package/dist/popover.types.js +4 -18
- package/dist/popover.types.mjs +1 -0
- package/package.json +13 -13
package/dist/popover.props.js
CHANGED
|
@@ -1,62 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.props.ts
|
|
21
|
-
var popover_props_exports = {};
|
|
22
|
-
__export(popover_props_exports, {
|
|
23
|
-
props: () => props,
|
|
24
|
-
splitProps: () => splitProps
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
25
4
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"triggerValue"
|
|
5
|
+
let _zag_js_utils = require("@zag-js/utils");
|
|
6
|
+
// src/popover.props.ts
|
|
7
|
+
const props = (0, require("@zag-js/types").createProps)()([
|
|
8
|
+
"autoFocus",
|
|
9
|
+
"closeOnEscape",
|
|
10
|
+
"closeOnInteractOutside",
|
|
11
|
+
"defaultOpen",
|
|
12
|
+
"defaultTriggerValue",
|
|
13
|
+
"dir",
|
|
14
|
+
"getRootNode",
|
|
15
|
+
"id",
|
|
16
|
+
"ids",
|
|
17
|
+
"finalFocusEl",
|
|
18
|
+
"initialFocusEl",
|
|
19
|
+
"modal",
|
|
20
|
+
"onEscapeKeyDown",
|
|
21
|
+
"onFocusOutside",
|
|
22
|
+
"onInteractOutside",
|
|
23
|
+
"onOpenChange",
|
|
24
|
+
"onPointerDownOutside",
|
|
25
|
+
"onTriggerValueChange",
|
|
26
|
+
"onRequestDismiss",
|
|
27
|
+
"open",
|
|
28
|
+
"persistentElements",
|
|
29
|
+
"portalled",
|
|
30
|
+
"restoreFocus",
|
|
31
|
+
"positioning",
|
|
32
|
+
"translations",
|
|
33
|
+
"triggerValue"
|
|
56
34
|
]);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
props,
|
|
61
|
-
splitProps
|
|
62
|
-
});
|
|
35
|
+
const splitProps = (0, _zag_js_utils.createSplitProps)(props);
|
|
36
|
+
exports.props = props;
|
|
37
|
+
exports.splitProps = splitProps;
|
package/dist/popover.props.mjs
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
// src/popover.props.ts
|
|
2
|
-
import { createProps } from "@zag-js/types";
|
|
3
1
|
import { createSplitProps } from "@zag-js/utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
import { createProps } from "@zag-js/types";
|
|
3
|
+
// src/popover.props.ts
|
|
4
|
+
const props = createProps()([
|
|
5
|
+
"autoFocus",
|
|
6
|
+
"closeOnEscape",
|
|
7
|
+
"closeOnInteractOutside",
|
|
8
|
+
"defaultOpen",
|
|
9
|
+
"defaultTriggerValue",
|
|
10
|
+
"dir",
|
|
11
|
+
"getRootNode",
|
|
12
|
+
"id",
|
|
13
|
+
"ids",
|
|
14
|
+
"finalFocusEl",
|
|
15
|
+
"initialFocusEl",
|
|
16
|
+
"modal",
|
|
17
|
+
"onEscapeKeyDown",
|
|
18
|
+
"onFocusOutside",
|
|
19
|
+
"onInteractOutside",
|
|
20
|
+
"onOpenChange",
|
|
21
|
+
"onPointerDownOutside",
|
|
22
|
+
"onTriggerValueChange",
|
|
23
|
+
"onRequestDismiss",
|
|
24
|
+
"open",
|
|
25
|
+
"persistentElements",
|
|
26
|
+
"portalled",
|
|
27
|
+
"restoreFocus",
|
|
28
|
+
"positioning",
|
|
29
|
+
"translations",
|
|
30
|
+
"triggerValue"
|
|
31
31
|
]);
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
props,
|
|
35
|
-
splitProps
|
|
36
|
-
};
|
|
32
|
+
const splitProps = createSplitProps(props);
|
|
33
|
+
export { props, splitProps };
|
package/dist/popover.types.d.mts
CHANGED
|
@@ -1,201 +1,198 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface OpenChangeDetails {
|
|
8
|
-
open: boolean;
|
|
1
|
+
import { Placement, PositioningOptions } from "@zag-js/popper";
|
|
2
|
+
import { EventObject, Machine, Service } from "@zag-js/core";
|
|
3
|
+
import { DismissableElementHandlers, PersistentElementOptions } from "@zag-js/dismissable";
|
|
4
|
+
import { CommonProperties, DirectionProperty, MaybeElement, PropTypes, RequiredBy } from "@zag-js/types";
|
|
5
|
+
export interface OpenChangeDetails {
|
|
6
|
+
open: boolean;
|
|
9
7
|
}
|
|
10
|
-
interface TriggerValueChangeDetails {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
export interface TriggerValueChangeDetails {
|
|
9
|
+
/**
|
|
10
|
+
* The value of the trigger
|
|
11
|
+
*/
|
|
12
|
+
value: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* The trigger element
|
|
15
|
+
*/
|
|
16
|
+
triggerElement: HTMLElement | null;
|
|
19
17
|
}
|
|
20
|
-
interface IntlTranslations {
|
|
21
|
-
|
|
18
|
+
export interface IntlTranslations {
|
|
19
|
+
closeTriggerLabel?: string | undefined;
|
|
22
20
|
}
|
|
23
|
-
interface ElementIds {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
export interface ElementIds {
|
|
22
|
+
anchor?: string | undefined;
|
|
23
|
+
trigger?: (string | ((value?: string) => string)) | undefined;
|
|
24
|
+
content?: string | undefined;
|
|
25
|
+
title?: string | undefined;
|
|
26
|
+
description?: string | undefined;
|
|
27
|
+
closeTrigger?: string | undefined;
|
|
28
|
+
positioner?: string | undefined;
|
|
29
|
+
arrow?: string | undefined;
|
|
32
30
|
}
|
|
33
|
-
interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
31
|
+
export interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
34
|
+
*/
|
|
35
|
+
translations?: IntlTranslations | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The ids of the elements in the popover. Useful for composition.
|
|
38
|
+
*/
|
|
39
|
+
ids?: ElementIds | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the popover should be modal. When set to `true`:
|
|
42
|
+
* - interaction with outside elements will be disabled
|
|
43
|
+
* - only popover content will be visible to screen readers
|
|
44
|
+
* - scrolling is blocked
|
|
45
|
+
* - focus is trapped within the popover
|
|
46
|
+
*
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
modal?: boolean | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
|
|
52
|
+
* of the popover content.
|
|
53
|
+
*
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
portalled?: boolean | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to automatically set focus on the first focusable
|
|
59
|
+
* content within the popover when opened.
|
|
60
|
+
*
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
autoFocus?: boolean | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The element to focus on when the popover is opened.
|
|
66
|
+
* Return `false` to skip moving focus, or `null` to use the default.
|
|
67
|
+
*/
|
|
68
|
+
initialFocusEl?: (() => HTMLElement | null | false) | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Element to receive focus when the popover is closed.
|
|
71
|
+
*/
|
|
72
|
+
finalFocusEl?: (() => MaybeElement) | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to restore focus to the element that had focus before the popover was opened.
|
|
75
|
+
*
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
restoreFocus?: boolean | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to close the popover when the user clicks outside of the popover.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
closeOnInteractOutside?: boolean | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Whether to close the popover when the escape key is pressed.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
closeOnEscape?: boolean | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Function invoked when the popover opens or closes
|
|
91
|
+
*/
|
|
92
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The user provided options used to position the popover content
|
|
95
|
+
*/
|
|
96
|
+
positioning?: PositioningOptions | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The controlled open state of the popover
|
|
99
|
+
*/
|
|
100
|
+
open?: boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The initial open state of the popover when rendered.
|
|
103
|
+
* Use when you don't need to control the open state of the popover.
|
|
104
|
+
*/
|
|
105
|
+
defaultOpen?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* The controlled trigger value
|
|
108
|
+
*/
|
|
109
|
+
triggerValue?: string | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* The initial trigger value when rendered.
|
|
112
|
+
* Use when you don't need to control the trigger value.
|
|
113
|
+
*/
|
|
114
|
+
defaultTriggerValue?: string | null | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Function called when the trigger value changes.
|
|
117
|
+
*/
|
|
118
|
+
onTriggerValueChange?: ((details: TriggerValueChangeDetails) => void) | undefined;
|
|
121
119
|
}
|
|
122
120
|
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "restoreFocus" | "positioning";
|
|
123
121
|
type ComputedContext = Readonly<{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The computed value of `portalled`
|
|
124
|
+
*/
|
|
125
|
+
currentPortalled: boolean;
|
|
128
126
|
}>;
|
|
129
127
|
interface PrivateContext {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The elements that are rendered on mount
|
|
130
|
+
*/
|
|
131
|
+
renderedElements: {
|
|
132
|
+
title: boolean;
|
|
133
|
+
description: boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The computed placement (maybe different from initial placement)
|
|
137
|
+
*/
|
|
138
|
+
currentPlacement?: Placement | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* The trigger value
|
|
141
|
+
*/
|
|
142
|
+
triggerValue: string | null;
|
|
145
143
|
}
|
|
146
|
-
interface PopoverSchema {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
export interface PopoverSchema {
|
|
145
|
+
props: RequiredBy<PopoverProps, PropsWithDefault>;
|
|
146
|
+
state: "open" | "closed";
|
|
147
|
+
context: PrivateContext;
|
|
148
|
+
computed: ComputedContext;
|
|
149
|
+
event: EventObject;
|
|
150
|
+
action: string;
|
|
151
|
+
effect: string;
|
|
152
|
+
guard: string;
|
|
155
153
|
}
|
|
156
|
-
type PopoverService = Service<PopoverSchema>;
|
|
157
|
-
type PopoverMachine = Machine<PopoverSchema>;
|
|
158
|
-
interface TriggerProps {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
export type PopoverService = Service<PopoverSchema>;
|
|
155
|
+
export type PopoverMachine = Machine<PopoverSchema>;
|
|
156
|
+
export interface TriggerProps {
|
|
157
|
+
/**
|
|
158
|
+
* The value that identifies this specific trigger
|
|
159
|
+
*/
|
|
160
|
+
value?: string | undefined;
|
|
163
161
|
}
|
|
164
|
-
interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
162
|
+
export interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
163
|
+
/**
|
|
164
|
+
* Whether the popover is portalled.
|
|
165
|
+
*/
|
|
166
|
+
portalled: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Whether the popover is open
|
|
169
|
+
*/
|
|
170
|
+
open: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Function to open or close the popover
|
|
173
|
+
*/
|
|
174
|
+
setOpen: (open: boolean) => void;
|
|
175
|
+
/**
|
|
176
|
+
* The trigger value
|
|
177
|
+
*/
|
|
178
|
+
triggerValue: string | null;
|
|
179
|
+
/**
|
|
180
|
+
* Function to set the trigger value
|
|
181
|
+
*/
|
|
182
|
+
setTriggerValue: (value: string | null) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Function to reposition the popover
|
|
185
|
+
*/
|
|
186
|
+
reposition: (options?: Partial<PositioningOptions>) => void;
|
|
187
|
+
getArrowProps: () => T["element"];
|
|
188
|
+
getArrowTipProps: () => T["element"];
|
|
189
|
+
getAnchorProps: () => T["element"];
|
|
190
|
+
getTriggerProps: (props?: TriggerProps) => T["button"];
|
|
191
|
+
getIndicatorProps: () => T["element"];
|
|
192
|
+
getPositionerProps: () => T["element"];
|
|
193
|
+
getContentProps: () => T["element"];
|
|
194
|
+
getTitleProps: () => T["element"];
|
|
195
|
+
getDescriptionProps: () => T["element"];
|
|
196
|
+
getCloseTriggerProps: () => T["button"];
|
|
199
197
|
}
|
|
200
|
-
|
|
201
|
-
export type { ElementIds, IntlTranslations, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService, TriggerProps, TriggerValueChangeDetails };
|
|
198
|
+
export type { Placement, PositioningOptions };
|