@zag-js/popover 1.34.1 → 1.35.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 +8 -152
- package/dist/index.d.ts +8 -152
- package/dist/index.js +37 -445
- package/dist/index.mjs +10 -441
- package/dist/popover.anatomy.d.mts +6 -0
- package/dist/popover.anatomy.d.ts +6 -0
- package/dist/popover.anatomy.js +45 -0
- package/dist/popover.anatomy.mjs +19 -0
- package/dist/popover.connect.d.mts +9 -0
- package/dist/popover.connect.d.ts +9 -0
- package/dist/popover.connect.js +173 -0
- package/dist/popover.connect.mjs +138 -0
- package/dist/popover.dom.d.mts +20 -0
- package/dist/popover.dom.d.ts +20 -0
- package/dist/popover.dom.js +76 -0
- package/dist/popover.dom.mjs +36 -0
- package/dist/popover.machine.d.mts +9 -0
- package/dist/popover.machine.d.ts +9 -0
- package/dist/popover.machine.js +292 -0
- package/dist/popover.machine.mjs +257 -0
- package/dist/popover.props.d.mts +10 -0
- package/dist/popover.props.d.ts +10 -0
- package/dist/popover.props.js +56 -0
- package/dist/popover.props.mjs +30 -0
- package/dist/popover.types.d.mts +142 -0
- package/dist/popover.types.d.ts +142 -0
- package/dist/popover.types.js +18 -0
- package/dist/popover.types.mjs +0 -0
- package/package.json +22 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,154 +1,10 @@
|
|
|
1
|
-
import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
|
|
2
1
|
export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export { anatomy } from './popover.anatomy.mjs';
|
|
3
|
+
export { connect } from './popover.connect.mjs';
|
|
4
|
+
export { machine } from './popover.machine.mjs';
|
|
5
|
+
export { props, splitProps } from './popover.props.mjs';
|
|
6
|
+
export { PopoverApi as Api, ElementIds, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.mjs';
|
|
8
7
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
interface OpenChangeDetails {
|
|
13
|
-
open: boolean;
|
|
14
|
-
}
|
|
15
|
-
type ElementIds = Partial<{
|
|
16
|
-
anchor: string;
|
|
17
|
-
trigger: string;
|
|
18
|
-
content: string;
|
|
19
|
-
title: string;
|
|
20
|
-
description: string;
|
|
21
|
-
closeTrigger: string;
|
|
22
|
-
positioner: string;
|
|
23
|
-
arrow: string;
|
|
24
|
-
}>;
|
|
25
|
-
interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
|
-
/**
|
|
27
|
-
* The ids of the elements in the popover. Useful for composition.
|
|
28
|
-
*/
|
|
29
|
-
ids?: ElementIds | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Whether the popover should be modal. When set to `true`:
|
|
32
|
-
* - interaction with outside elements will be disabled
|
|
33
|
-
* - only popover content will be visible to screen readers
|
|
34
|
-
* - scrolling is blocked
|
|
35
|
-
* - focus is trapped within the popover
|
|
36
|
-
*
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
modal?: boolean | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
|
|
42
|
-
* of the popover content.
|
|
43
|
-
*
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
portalled?: boolean | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Whether to automatically set focus on the first focusable
|
|
49
|
-
* content within the popover when opened.
|
|
50
|
-
*
|
|
51
|
-
* @default true
|
|
52
|
-
*/
|
|
53
|
-
autoFocus?: boolean | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* The element to focus on when the popover is opened.
|
|
56
|
-
*/
|
|
57
|
-
initialFocusEl?: (() => HTMLElement | null) | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Whether to close the popover when the user clicks outside of the popover.
|
|
60
|
-
* @default true
|
|
61
|
-
*/
|
|
62
|
-
closeOnInteractOutside?: boolean | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Whether to close the popover when the escape key is pressed.
|
|
65
|
-
* @default true
|
|
66
|
-
*/
|
|
67
|
-
closeOnEscape?: boolean | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Function invoked when the popover opens or closes
|
|
70
|
-
*/
|
|
71
|
-
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* The user provided options used to position the popover content
|
|
74
|
-
*/
|
|
75
|
-
positioning?: PositioningOptions | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* The controlled open state of the popover
|
|
78
|
-
*/
|
|
79
|
-
open?: boolean | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* The initial open state of the popover when rendered.
|
|
82
|
-
* Use when you don't need to control the open state of the popover.
|
|
83
|
-
*/
|
|
84
|
-
defaultOpen?: boolean | undefined;
|
|
85
|
-
}
|
|
86
|
-
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
|
|
87
|
-
type ComputedContext = Readonly<{
|
|
88
|
-
/**
|
|
89
|
-
* The computed value of `portalled`
|
|
90
|
-
*/
|
|
91
|
-
currentPortalled: boolean;
|
|
92
|
-
}>;
|
|
93
|
-
interface PrivateContext {
|
|
94
|
-
/**
|
|
95
|
-
* The elements that are rendered on mount
|
|
96
|
-
*/
|
|
97
|
-
renderedElements: {
|
|
98
|
-
title: boolean;
|
|
99
|
-
description: boolean;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* The computed placement (maybe different from initial placement)
|
|
103
|
-
*/
|
|
104
|
-
currentPlacement?: Placement | undefined;
|
|
105
|
-
}
|
|
106
|
-
interface PopoverSchema {
|
|
107
|
-
props: RequiredBy<PopoverProps, PropsWithDefault>;
|
|
108
|
-
state: "open" | "closed";
|
|
109
|
-
context: PrivateContext;
|
|
110
|
-
computed: ComputedContext;
|
|
111
|
-
event: EventObject;
|
|
112
|
-
action: string;
|
|
113
|
-
effect: string;
|
|
114
|
-
guard: string;
|
|
115
|
-
}
|
|
116
|
-
type PopoverService = Service<PopoverSchema>;
|
|
117
|
-
type PopoverMachine = Machine<PopoverSchema>;
|
|
118
|
-
interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
119
|
-
/**
|
|
120
|
-
* Whether the popover is portalled.
|
|
121
|
-
*/
|
|
122
|
-
portalled: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Whether the popover is open
|
|
125
|
-
*/
|
|
126
|
-
open: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Function to open or close the popover
|
|
129
|
-
*/
|
|
130
|
-
setOpen: (open: boolean) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Function to reposition the popover
|
|
133
|
-
*/
|
|
134
|
-
reposition: (options?: Partial<PositioningOptions>) => void;
|
|
135
|
-
getArrowProps: () => T["element"];
|
|
136
|
-
getArrowTipProps: () => T["element"];
|
|
137
|
-
getAnchorProps: () => T["element"];
|
|
138
|
-
getTriggerProps: () => T["button"];
|
|
139
|
-
getIndicatorProps: () => T["element"];
|
|
140
|
-
getPositionerProps: () => T["element"];
|
|
141
|
-
getContentProps: () => T["element"];
|
|
142
|
-
getTitleProps: () => T["element"];
|
|
143
|
-
getDescriptionProps: () => T["element"];
|
|
144
|
-
getCloseTriggerProps: () => T["button"];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
|
|
148
|
-
|
|
149
|
-
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
150
|
-
|
|
151
|
-
declare const props: (keyof PopoverProps)[];
|
|
152
|
-
declare const splitProps: <Props extends Partial<PopoverProps>>(props: Props) => [Partial<PopoverProps>, Omit<Props, keyof PopoverProps>];
|
|
153
|
-
|
|
154
|
-
export { type PopoverApi as Api, type ElementIds, type PopoverMachine as Machine, type OpenChangeDetails, type PopoverProps as Props, type PopoverService as Service, anatomy, connect, machine, props, splitProps };
|
|
8
|
+
import '@zag-js/anatomy';
|
|
9
|
+
import '@zag-js/types';
|
|
10
|
+
import '@zag-js/core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,154 +1,10 @@
|
|
|
1
|
-
import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
|
|
2
1
|
export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export { anatomy } from './popover.anatomy.js';
|
|
3
|
+
export { connect } from './popover.connect.js';
|
|
4
|
+
export { machine } from './popover.machine.js';
|
|
5
|
+
export { props, splitProps } from './popover.props.js';
|
|
6
|
+
export { PopoverApi as Api, ElementIds, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.js';
|
|
8
7
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
interface OpenChangeDetails {
|
|
13
|
-
open: boolean;
|
|
14
|
-
}
|
|
15
|
-
type ElementIds = Partial<{
|
|
16
|
-
anchor: string;
|
|
17
|
-
trigger: string;
|
|
18
|
-
content: string;
|
|
19
|
-
title: string;
|
|
20
|
-
description: string;
|
|
21
|
-
closeTrigger: string;
|
|
22
|
-
positioner: string;
|
|
23
|
-
arrow: string;
|
|
24
|
-
}>;
|
|
25
|
-
interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
|
-
/**
|
|
27
|
-
* The ids of the elements in the popover. Useful for composition.
|
|
28
|
-
*/
|
|
29
|
-
ids?: ElementIds | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Whether the popover should be modal. When set to `true`:
|
|
32
|
-
* - interaction with outside elements will be disabled
|
|
33
|
-
* - only popover content will be visible to screen readers
|
|
34
|
-
* - scrolling is blocked
|
|
35
|
-
* - focus is trapped within the popover
|
|
36
|
-
*
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
modal?: boolean | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
|
|
42
|
-
* of the popover content.
|
|
43
|
-
*
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
portalled?: boolean | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Whether to automatically set focus on the first focusable
|
|
49
|
-
* content within the popover when opened.
|
|
50
|
-
*
|
|
51
|
-
* @default true
|
|
52
|
-
*/
|
|
53
|
-
autoFocus?: boolean | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* The element to focus on when the popover is opened.
|
|
56
|
-
*/
|
|
57
|
-
initialFocusEl?: (() => HTMLElement | null) | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Whether to close the popover when the user clicks outside of the popover.
|
|
60
|
-
* @default true
|
|
61
|
-
*/
|
|
62
|
-
closeOnInteractOutside?: boolean | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Whether to close the popover when the escape key is pressed.
|
|
65
|
-
* @default true
|
|
66
|
-
*/
|
|
67
|
-
closeOnEscape?: boolean | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Function invoked when the popover opens or closes
|
|
70
|
-
*/
|
|
71
|
-
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* The user provided options used to position the popover content
|
|
74
|
-
*/
|
|
75
|
-
positioning?: PositioningOptions | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* The controlled open state of the popover
|
|
78
|
-
*/
|
|
79
|
-
open?: boolean | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* The initial open state of the popover when rendered.
|
|
82
|
-
* Use when you don't need to control the open state of the popover.
|
|
83
|
-
*/
|
|
84
|
-
defaultOpen?: boolean | undefined;
|
|
85
|
-
}
|
|
86
|
-
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
|
|
87
|
-
type ComputedContext = Readonly<{
|
|
88
|
-
/**
|
|
89
|
-
* The computed value of `portalled`
|
|
90
|
-
*/
|
|
91
|
-
currentPortalled: boolean;
|
|
92
|
-
}>;
|
|
93
|
-
interface PrivateContext {
|
|
94
|
-
/**
|
|
95
|
-
* The elements that are rendered on mount
|
|
96
|
-
*/
|
|
97
|
-
renderedElements: {
|
|
98
|
-
title: boolean;
|
|
99
|
-
description: boolean;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* The computed placement (maybe different from initial placement)
|
|
103
|
-
*/
|
|
104
|
-
currentPlacement?: Placement | undefined;
|
|
105
|
-
}
|
|
106
|
-
interface PopoverSchema {
|
|
107
|
-
props: RequiredBy<PopoverProps, PropsWithDefault>;
|
|
108
|
-
state: "open" | "closed";
|
|
109
|
-
context: PrivateContext;
|
|
110
|
-
computed: ComputedContext;
|
|
111
|
-
event: EventObject;
|
|
112
|
-
action: string;
|
|
113
|
-
effect: string;
|
|
114
|
-
guard: string;
|
|
115
|
-
}
|
|
116
|
-
type PopoverService = Service<PopoverSchema>;
|
|
117
|
-
type PopoverMachine = Machine<PopoverSchema>;
|
|
118
|
-
interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
119
|
-
/**
|
|
120
|
-
* Whether the popover is portalled.
|
|
121
|
-
*/
|
|
122
|
-
portalled: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Whether the popover is open
|
|
125
|
-
*/
|
|
126
|
-
open: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Function to open or close the popover
|
|
129
|
-
*/
|
|
130
|
-
setOpen: (open: boolean) => void;
|
|
131
|
-
/**
|
|
132
|
-
* Function to reposition the popover
|
|
133
|
-
*/
|
|
134
|
-
reposition: (options?: Partial<PositioningOptions>) => void;
|
|
135
|
-
getArrowProps: () => T["element"];
|
|
136
|
-
getArrowTipProps: () => T["element"];
|
|
137
|
-
getAnchorProps: () => T["element"];
|
|
138
|
-
getTriggerProps: () => T["button"];
|
|
139
|
-
getIndicatorProps: () => T["element"];
|
|
140
|
-
getPositionerProps: () => T["element"];
|
|
141
|
-
getContentProps: () => T["element"];
|
|
142
|
-
getTitleProps: () => T["element"];
|
|
143
|
-
getDescriptionProps: () => T["element"];
|
|
144
|
-
getCloseTriggerProps: () => T["button"];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
|
|
148
|
-
|
|
149
|
-
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
150
|
-
|
|
151
|
-
declare const props: (keyof PopoverProps)[];
|
|
152
|
-
declare const splitProps: <Props extends Partial<PopoverProps>>(props: Props) => [Partial<PopoverProps>, Omit<Props, keyof PopoverProps>];
|
|
153
|
-
|
|
154
|
-
export { type PopoverApi as Api, type ElementIds, type PopoverMachine as Machine, type OpenChangeDetails, type PopoverProps as Props, type PopoverService as Service, anatomy, connect, machine, props, splitProps };
|
|
8
|
+
import '@zag-js/anatomy';
|
|
9
|
+
import '@zag-js/types';
|
|
10
|
+
import '@zag-js/core';
|