@zag-js/popover 0.82.2 → 1.0.1
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 +38 -23
- package/dist/index.d.ts +38 -23
- package/dist/index.js +268 -265
- package/dist/index.mjs +270 -267
- package/package.json +19 -14
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
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 {
|
|
4
|
+
import { CommonProperties, DirectionProperty, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
5
5
|
import * as _zag_js_core from '@zag-js/core';
|
|
6
|
-
import { Machine,
|
|
7
|
-
import { PositioningOptions } from '@zag-js/popper';
|
|
6
|
+
import { Service, Machine, EventObject } from '@zag-js/core';
|
|
7
|
+
import { PositioningOptions, Placement } from '@zag-js/popper';
|
|
8
8
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
9
|
|
|
10
10
|
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger">;
|
|
@@ -22,7 +22,7 @@ type ElementIds = Partial<{
|
|
|
22
22
|
positioner: string;
|
|
23
23
|
arrow: string;
|
|
24
24
|
}>;
|
|
25
|
-
interface
|
|
25
|
+
interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
26
|
/**
|
|
27
27
|
* The ids of the elements in the popover. Useful for composition.
|
|
28
28
|
*/
|
|
@@ -72,35 +72,50 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
|
|
|
72
72
|
/**
|
|
73
73
|
* The user provided options used to position the popover content
|
|
74
74
|
*/
|
|
75
|
-
positioning
|
|
75
|
+
positioning?: PositioningOptions | undefined;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* The controlled open state of the popover
|
|
78
78
|
*/
|
|
79
79
|
open?: boolean | undefined;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
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.
|
|
82
83
|
*/
|
|
83
|
-
|
|
84
|
+
defaultOpen?: boolean | undefined;
|
|
84
85
|
}
|
|
85
|
-
type
|
|
86
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
|
|
86
87
|
type ComputedContext = Readonly<{
|
|
87
88
|
/**
|
|
88
|
-
* @computed
|
|
89
89
|
* The computed value of `portalled`
|
|
90
90
|
*/
|
|
91
91
|
currentPortalled: boolean;
|
|
92
92
|
}>;
|
|
93
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;
|
|
94
105
|
}
|
|
95
|
-
interface
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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;
|
|
99
115
|
}
|
|
100
|
-
type
|
|
101
|
-
type
|
|
102
|
-
|
|
103
|
-
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
116
|
+
type PopoverService = Service<PopoverSchema>;
|
|
117
|
+
type PopoverMachine = Machine<PopoverSchema>;
|
|
118
|
+
interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
104
119
|
/**
|
|
105
120
|
* Whether the popover is portalled.
|
|
106
121
|
*/
|
|
@@ -129,11 +144,11 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
129
144
|
getCloseTriggerProps(): T["button"];
|
|
130
145
|
}
|
|
131
146
|
|
|
132
|
-
declare function connect<T extends PropTypes>(
|
|
147
|
+
declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
|
|
133
148
|
|
|
134
|
-
declare
|
|
149
|
+
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
135
150
|
|
|
136
|
-
declare const props: (
|
|
137
|
-
declare const splitProps: <Props extends Partial<
|
|
151
|
+
declare const props: (keyof PopoverProps)[];
|
|
152
|
+
declare const splitProps: <Props extends Partial<PopoverProps>>(props: Props) => [Partial<PopoverProps>, Omit<Props, keyof PopoverProps>];
|
|
138
153
|
|
|
139
|
-
export { type
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
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 {
|
|
4
|
+
import { CommonProperties, DirectionProperty, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
5
5
|
import * as _zag_js_core from '@zag-js/core';
|
|
6
|
-
import { Machine,
|
|
7
|
-
import { PositioningOptions } from '@zag-js/popper';
|
|
6
|
+
import { Service, Machine, EventObject } from '@zag-js/core';
|
|
7
|
+
import { PositioningOptions, Placement } from '@zag-js/popper';
|
|
8
8
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
9
9
|
|
|
10
10
|
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger">;
|
|
@@ -22,7 +22,7 @@ type ElementIds = Partial<{
|
|
|
22
22
|
positioner: string;
|
|
23
23
|
arrow: string;
|
|
24
24
|
}>;
|
|
25
|
-
interface
|
|
25
|
+
interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
|
|
26
26
|
/**
|
|
27
27
|
* The ids of the elements in the popover. Useful for composition.
|
|
28
28
|
*/
|
|
@@ -72,35 +72,50 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
|
|
|
72
72
|
/**
|
|
73
73
|
* The user provided options used to position the popover content
|
|
74
74
|
*/
|
|
75
|
-
positioning
|
|
75
|
+
positioning?: PositioningOptions | undefined;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* The controlled open state of the popover
|
|
78
78
|
*/
|
|
79
79
|
open?: boolean | undefined;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
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.
|
|
82
83
|
*/
|
|
83
|
-
|
|
84
|
+
defaultOpen?: boolean | undefined;
|
|
84
85
|
}
|
|
85
|
-
type
|
|
86
|
+
type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
|
|
86
87
|
type ComputedContext = Readonly<{
|
|
87
88
|
/**
|
|
88
|
-
* @computed
|
|
89
89
|
* The computed value of `portalled`
|
|
90
90
|
*/
|
|
91
91
|
currentPortalled: boolean;
|
|
92
92
|
}>;
|
|
93
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;
|
|
94
105
|
}
|
|
95
|
-
interface
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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;
|
|
99
115
|
}
|
|
100
|
-
type
|
|
101
|
-
type
|
|
102
|
-
|
|
103
|
-
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
116
|
+
type PopoverService = Service<PopoverSchema>;
|
|
117
|
+
type PopoverMachine = Machine<PopoverSchema>;
|
|
118
|
+
interface PopoverApi<T extends PropTypes = PropTypes> {
|
|
104
119
|
/**
|
|
105
120
|
* Whether the popover is portalled.
|
|
106
121
|
*/
|
|
@@ -129,11 +144,11 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
129
144
|
getCloseTriggerProps(): T["button"];
|
|
130
145
|
}
|
|
131
146
|
|
|
132
|
-
declare function connect<T extends PropTypes>(
|
|
147
|
+
declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
|
|
133
148
|
|
|
134
|
-
declare
|
|
149
|
+
declare const machine: _zag_js_core.Machine<PopoverSchema>;
|
|
135
150
|
|
|
136
|
-
declare const props: (
|
|
137
|
-
declare const splitProps: <Props extends Partial<
|
|
151
|
+
declare const props: (keyof PopoverProps)[];
|
|
152
|
+
declare const splitProps: <Props extends Partial<PopoverProps>>(props: Props) => [Partial<PopoverProps>, Omit<Props, keyof PopoverProps>];
|
|
138
153
|
|
|
139
|
-
export { type
|
|
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 };
|