@zag-js/popper 0.74.1 → 0.75.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 +26 -26
- package/dist/index.d.ts +26 -26
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -7,98 +7,98 @@ type MaybeFn<T> = T | (() => T);
|
|
|
7
7
|
type PlacementSide = "top" | "right" | "bottom" | "left";
|
|
8
8
|
type PlacementAlign = "start" | "center" | "end";
|
|
9
9
|
interface AnchorRect {
|
|
10
|
-
x?: number;
|
|
11
|
-
y?: number;
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
10
|
+
x?: number | undefined;
|
|
11
|
+
y?: number | undefined;
|
|
12
|
+
width?: number | undefined;
|
|
13
|
+
height?: number | undefined;
|
|
14
14
|
}
|
|
15
15
|
interface PositioningOptions {
|
|
16
16
|
/**
|
|
17
17
|
* Whether the popover should be hidden when the reference element is detached
|
|
18
18
|
*/
|
|
19
|
-
hideWhenDetached?: boolean;
|
|
19
|
+
hideWhenDetached?: boolean | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* The strategy to use for positioning
|
|
22
22
|
*/
|
|
23
|
-
strategy?: "absolute" | "fixed";
|
|
23
|
+
strategy?: "absolute" | "fixed" | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* The initial placement of the floating element
|
|
26
26
|
*/
|
|
27
|
-
placement?: Placement;
|
|
27
|
+
placement?: Placement | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* The offset of the floating element
|
|
30
30
|
*/
|
|
31
31
|
offset?: {
|
|
32
32
|
mainAxis?: number;
|
|
33
33
|
crossAxis?: number;
|
|
34
|
-
};
|
|
34
|
+
} | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* The main axis offset or gap between the reference and floating elements
|
|
37
37
|
*/
|
|
38
|
-
gutter?: number;
|
|
38
|
+
gutter?: number | undefined;
|
|
39
39
|
/**
|
|
40
40
|
* The secondary axis offset or gap between the reference and floating elements
|
|
41
41
|
*/
|
|
42
|
-
shift?: number;
|
|
42
|
+
shift?: number | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* The virtual padding around the viewport edges to check for overflow
|
|
45
45
|
*/
|
|
46
|
-
overflowPadding?: number;
|
|
46
|
+
overflowPadding?: number | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* The minimum padding between the arrow and the floating element's corner.
|
|
49
49
|
* @default 4
|
|
50
50
|
*/
|
|
51
|
-
arrowPadding?: number;
|
|
51
|
+
arrowPadding?: number | undefined;
|
|
52
52
|
/**
|
|
53
53
|
* Whether to flip the placement
|
|
54
54
|
*/
|
|
55
|
-
flip?: boolean | Placement[];
|
|
55
|
+
flip?: boolean | Placement[] | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* Whether the popover should slide when it overflows.
|
|
58
58
|
*/
|
|
59
|
-
slide?: boolean;
|
|
59
|
+
slide?: boolean | undefined;
|
|
60
60
|
/**
|
|
61
61
|
* Whether the floating element can overlap the reference element
|
|
62
62
|
* @default false
|
|
63
63
|
*/
|
|
64
|
-
overlap?: boolean;
|
|
64
|
+
overlap?: boolean | undefined;
|
|
65
65
|
/**
|
|
66
66
|
* Whether to make the floating element same width as the reference element
|
|
67
67
|
*/
|
|
68
|
-
sameWidth?: boolean;
|
|
68
|
+
sameWidth?: boolean | undefined;
|
|
69
69
|
/**
|
|
70
70
|
* Whether the popover should fit the viewport.
|
|
71
71
|
*/
|
|
72
|
-
fitViewport?: boolean;
|
|
72
|
+
fitViewport?: boolean | undefined;
|
|
73
73
|
/**
|
|
74
74
|
* The overflow boundary of the reference element
|
|
75
75
|
*/
|
|
76
|
-
boundary?: () => Boundary;
|
|
76
|
+
boundary?: (() => Boundary) | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Options to activate auto-update listeners
|
|
79
79
|
*/
|
|
80
|
-
listeners?: boolean | AutoUpdateOptions;
|
|
80
|
+
listeners?: boolean | AutoUpdateOptions | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* Function called when the placement is computed
|
|
83
83
|
*/
|
|
84
|
-
onComplete
|
|
84
|
+
onComplete?: ((data: ComputePositionReturn) => void) | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* Function called when the floating element is positioned or not
|
|
87
87
|
*/
|
|
88
|
-
onPositioned
|
|
88
|
+
onPositioned?: ((data: {
|
|
89
89
|
placed: boolean;
|
|
90
|
-
})
|
|
90
|
+
}) => void) | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Function that returns the anchor rect
|
|
93
93
|
*/
|
|
94
|
-
getAnchorRect?: (element: HTMLElement | VirtualElement | null) => AnchorRect | null;
|
|
94
|
+
getAnchorRect?: ((element: HTMLElement | VirtualElement | null) => AnchorRect | null) | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* A callback that will be called when the popover needs to calculate its
|
|
97
97
|
* position.
|
|
98
98
|
*/
|
|
99
|
-
updatePosition?: (data: {
|
|
99
|
+
updatePosition?: ((data: {
|
|
100
100
|
updatePosition: () => Promise<void>;
|
|
101
|
-
}) => void | Promise<void
|
|
101
|
+
}) => void | Promise<void>) | undefined;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
declare function getPlacement(referenceOrFn: MaybeFn<MaybeRectElement>, floatingOrFn: MaybeFn<MaybeElement>, opts?: PositioningOptions & {
|
|
@@ -106,7 +106,7 @@ declare function getPlacement(referenceOrFn: MaybeFn<MaybeRectElement>, floating
|
|
|
106
106
|
}): () => void;
|
|
107
107
|
|
|
108
108
|
interface GetPlacementStylesOptions {
|
|
109
|
-
placement?: Placement;
|
|
109
|
+
placement?: Placement | undefined;
|
|
110
110
|
}
|
|
111
111
|
declare function getPlacementStyles(options?: Pick<PositioningOptions, "placement" | "sameWidth" | "fitViewport" | "strategy">): {
|
|
112
112
|
arrow: {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,98 +7,98 @@ type MaybeFn<T> = T | (() => T);
|
|
|
7
7
|
type PlacementSide = "top" | "right" | "bottom" | "left";
|
|
8
8
|
type PlacementAlign = "start" | "center" | "end";
|
|
9
9
|
interface AnchorRect {
|
|
10
|
-
x?: number;
|
|
11
|
-
y?: number;
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
10
|
+
x?: number | undefined;
|
|
11
|
+
y?: number | undefined;
|
|
12
|
+
width?: number | undefined;
|
|
13
|
+
height?: number | undefined;
|
|
14
14
|
}
|
|
15
15
|
interface PositioningOptions {
|
|
16
16
|
/**
|
|
17
17
|
* Whether the popover should be hidden when the reference element is detached
|
|
18
18
|
*/
|
|
19
|
-
hideWhenDetached?: boolean;
|
|
19
|
+
hideWhenDetached?: boolean | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* The strategy to use for positioning
|
|
22
22
|
*/
|
|
23
|
-
strategy?: "absolute" | "fixed";
|
|
23
|
+
strategy?: "absolute" | "fixed" | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* The initial placement of the floating element
|
|
26
26
|
*/
|
|
27
|
-
placement?: Placement;
|
|
27
|
+
placement?: Placement | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* The offset of the floating element
|
|
30
30
|
*/
|
|
31
31
|
offset?: {
|
|
32
32
|
mainAxis?: number;
|
|
33
33
|
crossAxis?: number;
|
|
34
|
-
};
|
|
34
|
+
} | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* The main axis offset or gap between the reference and floating elements
|
|
37
37
|
*/
|
|
38
|
-
gutter?: number;
|
|
38
|
+
gutter?: number | undefined;
|
|
39
39
|
/**
|
|
40
40
|
* The secondary axis offset or gap between the reference and floating elements
|
|
41
41
|
*/
|
|
42
|
-
shift?: number;
|
|
42
|
+
shift?: number | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* The virtual padding around the viewport edges to check for overflow
|
|
45
45
|
*/
|
|
46
|
-
overflowPadding?: number;
|
|
46
|
+
overflowPadding?: number | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* The minimum padding between the arrow and the floating element's corner.
|
|
49
49
|
* @default 4
|
|
50
50
|
*/
|
|
51
|
-
arrowPadding?: number;
|
|
51
|
+
arrowPadding?: number | undefined;
|
|
52
52
|
/**
|
|
53
53
|
* Whether to flip the placement
|
|
54
54
|
*/
|
|
55
|
-
flip?: boolean | Placement[];
|
|
55
|
+
flip?: boolean | Placement[] | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* Whether the popover should slide when it overflows.
|
|
58
58
|
*/
|
|
59
|
-
slide?: boolean;
|
|
59
|
+
slide?: boolean | undefined;
|
|
60
60
|
/**
|
|
61
61
|
* Whether the floating element can overlap the reference element
|
|
62
62
|
* @default false
|
|
63
63
|
*/
|
|
64
|
-
overlap?: boolean;
|
|
64
|
+
overlap?: boolean | undefined;
|
|
65
65
|
/**
|
|
66
66
|
* Whether to make the floating element same width as the reference element
|
|
67
67
|
*/
|
|
68
|
-
sameWidth?: boolean;
|
|
68
|
+
sameWidth?: boolean | undefined;
|
|
69
69
|
/**
|
|
70
70
|
* Whether the popover should fit the viewport.
|
|
71
71
|
*/
|
|
72
|
-
fitViewport?: boolean;
|
|
72
|
+
fitViewport?: boolean | undefined;
|
|
73
73
|
/**
|
|
74
74
|
* The overflow boundary of the reference element
|
|
75
75
|
*/
|
|
76
|
-
boundary?: () => Boundary;
|
|
76
|
+
boundary?: (() => Boundary) | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Options to activate auto-update listeners
|
|
79
79
|
*/
|
|
80
|
-
listeners?: boolean | AutoUpdateOptions;
|
|
80
|
+
listeners?: boolean | AutoUpdateOptions | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* Function called when the placement is computed
|
|
83
83
|
*/
|
|
84
|
-
onComplete
|
|
84
|
+
onComplete?: ((data: ComputePositionReturn) => void) | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* Function called when the floating element is positioned or not
|
|
87
87
|
*/
|
|
88
|
-
onPositioned
|
|
88
|
+
onPositioned?: ((data: {
|
|
89
89
|
placed: boolean;
|
|
90
|
-
})
|
|
90
|
+
}) => void) | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Function that returns the anchor rect
|
|
93
93
|
*/
|
|
94
|
-
getAnchorRect?: (element: HTMLElement | VirtualElement | null) => AnchorRect | null;
|
|
94
|
+
getAnchorRect?: ((element: HTMLElement | VirtualElement | null) => AnchorRect | null) | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* A callback that will be called when the popover needs to calculate its
|
|
97
97
|
* position.
|
|
98
98
|
*/
|
|
99
|
-
updatePosition?: (data: {
|
|
99
|
+
updatePosition?: ((data: {
|
|
100
100
|
updatePosition: () => Promise<void>;
|
|
101
|
-
}) => void | Promise<void
|
|
101
|
+
}) => void | Promise<void>) | undefined;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
declare function getPlacement(referenceOrFn: MaybeFn<MaybeRectElement>, floatingOrFn: MaybeFn<MaybeElement>, opts?: PositioningOptions & {
|
|
@@ -106,7 +106,7 @@ declare function getPlacement(referenceOrFn: MaybeFn<MaybeRectElement>, floating
|
|
|
106
106
|
}): () => void;
|
|
107
107
|
|
|
108
108
|
interface GetPlacementStylesOptions {
|
|
109
|
-
placement?: Placement;
|
|
109
|
+
placement?: Placement | undefined;
|
|
110
110
|
}
|
|
111
111
|
declare function getPlacementStyles(options?: Pick<PositioningOptions, "placement" | "sameWidth" | "fitViewport" | "strategy">): {
|
|
112
112
|
arrow: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "Dynamic positioning logic for ui machines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@floating-ui/dom": "1.6.11",
|
|
26
|
-
"@zag-js/dom-query": "0.
|
|
27
|
-
"@zag-js/utils": "0.
|
|
26
|
+
"@zag-js/dom-query": "0.75.0",
|
|
27
|
+
"@zag-js/utils": "0.75.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"clean-package": "2.2.0"
|