@fluentui/react-positioning 0.0.0-nightly-20220523-0424.1 → 0.0.0-nightly-20220607-0421.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/CHANGELOG.json +84 -9
- package/CHANGELOG.md +39 -7
- package/dist/index.d.ts +72 -46
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +2 -0
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/isIntersectingModifier.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/{usePopper.js → usePositioning.js} +9 -8
- package/lib/usePositioning.js.map +1 -0
- package/lib/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +3 -3
- package/lib/usePositioningMouseTarget.js.map +1 -0
- package/lib/utils/fromPopperPlacement.js +40 -0
- package/lib/utils/fromPopperPlacement.js.map +1 -0
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getPopperOffset.js +44 -0
- package/lib/utils/getPopperOffset.js.map +1 -0
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +23 -22
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parsePopperPlacement.js +14 -0
- package/lib/utils/parsePopperPlacement.js.map +1 -0
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +2 -0
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +7 -7
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/isIntersectingModifier.js.map +1 -1
- package/lib-commonjs/{usePopper.js → usePositioning.js} +12 -10
- package/lib-commonjs/usePositioning.js.map +1 -0
- package/lib-commonjs/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +5 -5
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -0
- package/lib-commonjs/utils/fromPopperPlacement.js +50 -0
- package/lib-commonjs/utils/fromPopperPlacement.js.map +1 -0
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getPopperOffset.js +54 -0
- package/lib-commonjs/utils/getPopperOffset.js.map +1 -0
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +2 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +23 -22
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parsePopperPlacement.js +23 -0
- package/lib-commonjs/utils/parsePopperPlacement.js.map +1 -0
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +5 -5
- package/lib/usePopper.js.map +0 -1
- package/lib/usePopperMouseTarget.js.map +0 -1
- package/lib/utils/getBasePlacement.js +0 -10
- package/lib/utils/getBasePlacement.js.map +0 -1
- package/lib-commonjs/usePopper.js.map +0 -1
- package/lib-commonjs/usePopperMouseTarget.js.map +0 -1
- package/lib-commonjs/utils/getBasePlacement.js +0 -19
- package/lib-commonjs/utils/getBasePlacement.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,84 @@
|
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-positioning_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 07 Jun 2022 04:34:28 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v0.0.0-nightly-20220607-0421.1",
|
7
|
+
"version": "0.0.0-nightly-20220607-0421.1",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-positioning",
|
13
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220607-0421.1",
|
14
|
+
"commit": "b264fd655a010e09847726c4b0481262f8f4a949"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"date": "Tue, 31 May 2022 21:28:42 GMT",
|
21
|
+
"tag": "@fluentui/react-positioning_v9.0.0-rc.11",
|
22
|
+
"version": "9.0.0-rc.11",
|
23
|
+
"comments": {
|
24
|
+
"prerelease": [
|
25
|
+
{
|
26
|
+
"author": "bernardo.sunderhus@gmail.com",
|
27
|
+
"package": "@fluentui/react-positioning",
|
28
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd",
|
29
|
+
"comment": "updates import to react-shared-components"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"author": "olfedias@microsoft.com",
|
33
|
+
"package": "@fluentui/react-positioning",
|
34
|
+
"commit": "0a5e9fa77a72eecafdd07034ccdc0b95fd49877c",
|
35
|
+
"comment": "chore: Update Griffel to latest version"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"author": "beachball",
|
39
|
+
"package": "@fluentui/react-positioning",
|
40
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.10",
|
41
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"author": "beachball",
|
45
|
+
"package": "@fluentui/react-positioning",
|
46
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.10",
|
47
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"date": "Mon, 23 May 2022 18:56:47 GMT",
|
54
|
+
"tag": "@fluentui/react-positioning_v9.0.0-rc.10",
|
55
|
+
"version": "9.0.0-rc.10",
|
56
|
+
"comments": {
|
57
|
+
"prerelease": [
|
58
|
+
{
|
59
|
+
"author": "lingfangao@hotmail.com",
|
60
|
+
"package": "@fluentui/react-positioning",
|
61
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
62
|
+
"comment": "BREAKING CHANGE: Encapsulate Popper API"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"author": "beachball",
|
66
|
+
"package": "@fluentui/react-positioning",
|
67
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.9",
|
68
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"author": "beachball",
|
72
|
+
"package": "@fluentui/react-positioning",
|
73
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.9",
|
74
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"date": "Mon, 23 May 2022 12:13:34 GMT",
|
81
|
+
"tag": "@fluentui/react-positioning_v9.0.0-rc.9",
|
82
|
+
"version": "9.0.0-rc.9",
|
8
83
|
"comments": {
|
9
84
|
"prerelease": [
|
10
85
|
{
|
@@ -28,20 +103,20 @@
|
|
28
103
|
{
|
29
104
|
"author": "beachball",
|
30
105
|
"package": "@fluentui/react-positioning",
|
31
|
-
"comment": "Bump @fluentui/react-shared-contexts to
|
32
|
-
"commit": "
|
106
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.8",
|
107
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
33
108
|
},
|
34
109
|
{
|
35
110
|
"author": "beachball",
|
36
111
|
"package": "@fluentui/react-positioning",
|
37
|
-
"comment": "Bump @fluentui/react-theme to
|
38
|
-
"commit": "
|
112
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.8",
|
113
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
39
114
|
},
|
40
115
|
{
|
41
116
|
"author": "beachball",
|
42
117
|
"package": "@fluentui/react-positioning",
|
43
|
-
"comment": "Bump @fluentui/react-utilities to
|
44
|
-
"commit": "
|
118
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
|
119
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
45
120
|
}
|
46
121
|
]
|
47
122
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,54 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 07 Jun 2022 04:34:28 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20220607-0421.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightly-20220607-0421.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.
|
9
|
+
Tue, 07 Jun 2022 04:34:28 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.11..@fluentui/react-positioning_v0.0.0-nightly-20220607-0421.1)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220607-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/b264fd655a010e09847726c4b0481262f8f4a949) by beachball)
|
15
|
+
|
16
|
+
## [9.0.0-rc.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.11)
|
17
|
+
|
18
|
+
Tue, 31 May 2022 21:28:42 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.10..@fluentui/react-positioning_v9.0.0-rc.11)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
- updates import to react-shared-components ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by bernardo.sunderhus@gmail.com)
|
24
|
+
- chore: Update Griffel to latest version ([PR #23275](https://github.com/microsoft/fluentui/pull/23275) by olfedias@microsoft.com)
|
25
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
26
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
27
|
+
|
28
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.10)
|
29
|
+
|
30
|
+
Mon, 23 May 2022 18:56:47 GMT
|
31
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.9..@fluentui/react-positioning_v9.0.0-rc.10)
|
32
|
+
|
33
|
+
### Changes
|
34
|
+
|
35
|
+
- BREAKING CHANGE: Encapsulate Popper API ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by lingfangao@hotmail.com)
|
36
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
37
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
38
|
+
|
39
|
+
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.9)
|
40
|
+
|
41
|
+
Mon, 23 May 2022 12:13:34 GMT
|
42
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-rc.8..@fluentui/react-positioning_v9.0.0-rc.9)
|
11
43
|
|
12
44
|
### Changes
|
13
45
|
|
14
46
|
- feat: ship rolluped only dts ([PR #22828](https://github.com/microsoft/fluentui/pull/22828) by martinhochel@microsoft.com)
|
15
47
|
- chore: Update Griffel to latest version ([PR #23029](https://github.com/microsoft/fluentui/pull/23029) by olfedias@microsoft.com)
|
16
48
|
- chore: Update Griffel to latest version ([PR #22894](https://github.com/microsoft/fluentui/pull/22894) by olfedias@microsoft.com)
|
17
|
-
- Bump @fluentui/react-shared-contexts to
|
18
|
-
- Bump @fluentui/react-theme to
|
19
|
-
- Bump @fluentui/react-utilities to
|
49
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
50
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
51
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
20
52
|
|
21
53
|
## [9.0.0-rc.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-rc.8)
|
22
54
|
|
package/dist/index.d.ts
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
import type { GriffelStyle } from '@griffel/react';
|
2
|
-
import * as PopperJs from '@popperjs/core';
|
3
2
|
import * as React_2 from 'react';
|
4
3
|
|
5
4
|
export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
|
6
5
|
|
7
6
|
export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;
|
8
7
|
|
9
|
-
export declare type Boundary =
|
8
|
+
export declare type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';
|
10
9
|
|
11
10
|
/**
|
12
11
|
* Creates CSS styles to size the arrow created by createArrowStyles to the given height.
|
@@ -78,7 +77,7 @@ export declare type CreateArrowStylesOptions = {
|
|
78
77
|
* Creates a virtual element based on the position of a click event
|
79
78
|
* Can be used as a target for popper in scenarios such as context menus
|
80
79
|
*/
|
81
|
-
export declare function createVirtualElementFromClick(nativeEvent: MouseEvent):
|
80
|
+
export declare function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement;
|
82
81
|
|
83
82
|
/**
|
84
83
|
* Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
|
@@ -90,22 +89,45 @@ export declare function createVirtualElementFromClick(nativeEvent: MouseEvent):
|
|
90
89
|
*/
|
91
90
|
export declare function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset;
|
92
91
|
|
93
|
-
export declare type Offset = OffsetFunction |
|
92
|
+
export declare type Offset = OffsetFunction | OffsetObject | OffsetShorthand;
|
94
93
|
|
95
|
-
export declare type OffsetFunction = (param: OffsetFunctionParam) =>
|
94
|
+
export declare type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;
|
96
95
|
|
97
96
|
export declare type OffsetFunctionParam = {
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
positionedRect: Rect;
|
98
|
+
targetRect: Rect;
|
99
|
+
position: Position;
|
100
|
+
alignment?: Alignment;
|
101
101
|
};
|
102
102
|
|
103
|
-
export declare
|
103
|
+
export declare type OffsetObject = {
|
104
|
+
crossAxis?: number;
|
105
|
+
mainAxis: number;
|
106
|
+
};
|
107
|
+
|
108
|
+
export declare type OffsetShorthand = number;
|
109
|
+
|
110
|
+
export declare type Position = 'above' | 'below' | 'before' | 'after';
|
111
|
+
|
112
|
+
export declare type PositioningImperativeRef = {
|
113
|
+
/**
|
114
|
+
* Updates the position imperatively.
|
115
|
+
* Useful when the position of the target changes from other factors than scrolling of window resize.
|
116
|
+
*/
|
117
|
+
updatePosition: () => void;
|
118
|
+
/**
|
119
|
+
* Sets the target and updates positioning imperatively.
|
120
|
+
* Useful for avoiding double renders with the target option.
|
121
|
+
*/
|
122
|
+
setTarget: (target: HTMLElement | PositioningVirtualElement) => void;
|
123
|
+
};
|
124
|
+
|
125
|
+
declare interface PositioningOptions {
|
104
126
|
/** Alignment for the component. Only has an effect if used with the @see position option */
|
105
127
|
align?: Alignment;
|
106
|
-
/** The element which will define the boundaries of the
|
128
|
+
/** The element which will define the boundaries of the positioned element for the flip behavior. */
|
107
129
|
flipBoundary?: Boundary;
|
108
|
-
/** The element which will define the boundaries of the
|
130
|
+
/** The element which will define the boundaries of the positioned element for the overflow behavior. */
|
109
131
|
overflowBoundary?: Boundary;
|
110
132
|
/**
|
111
133
|
* Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')
|
@@ -115,12 +137,12 @@ export declare interface PopperOptions {
|
|
115
137
|
*/
|
116
138
|
position?: Position;
|
117
139
|
/**
|
118
|
-
* Enables the
|
140
|
+
* Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')
|
119
141
|
* @default false
|
120
142
|
*/
|
121
143
|
positionFixed?: boolean;
|
122
144
|
/**
|
123
|
-
* Lets you displace a
|
145
|
+
* Lets you displace a positioned element from its reference element.
|
124
146
|
* This can be useful if you need to apply some margin between them or if you need to fine tune the
|
125
147
|
* position according to some custom logic.
|
126
148
|
*/
|
@@ -131,7 +153,7 @@ export declare interface PopperOptions {
|
|
131
153
|
*/
|
132
154
|
arrowPadding?: number;
|
133
155
|
/**
|
134
|
-
* Applies max-height and max-width on
|
156
|
+
* Applies max-height and max-width on the positioned element to fit it within the available space in viewport.
|
135
157
|
* true enables this for both width and height when overflow happens.
|
136
158
|
* 'always' applies `max-height`/`max-width` regardless of overflow.
|
137
159
|
* 'height' applies `max-height` when overflow happens, and 'width' for `max-width`
|
@@ -148,44 +170,56 @@ export declare interface PopperOptions {
|
|
148
170
|
*/
|
149
171
|
pinned?: boolean;
|
150
172
|
/**
|
151
|
-
* When the reference element or the viewport is outside viewport allows a
|
173
|
+
* When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.
|
152
174
|
* "all" enables this behavior for all axis.
|
153
175
|
*/
|
154
176
|
unstable_disableTether?: boolean | 'all';
|
155
177
|
}
|
156
178
|
|
157
|
-
export declare
|
158
|
-
/**
|
159
|
-
* Updates the position of the popper imperatively.
|
160
|
-
* Useful when the position of the target changes from other factors than scrolling of window resize.
|
161
|
-
*/
|
162
|
-
updatePosition: () => void;
|
163
|
-
/**
|
164
|
-
* Sets the target and updates positioning imperatively.
|
165
|
-
* Useful for avoiding double renders with the target option.
|
166
|
-
*/
|
167
|
-
setTarget: (target: HTMLElement | PopperVirtualElement) => void;
|
168
|
-
};
|
169
|
-
|
170
|
-
export declare type PopperVirtualElement = PopperJs.VirtualElement;
|
171
|
-
|
172
|
-
export declare type Position = 'above' | 'below' | 'before' | 'after';
|
173
|
-
|
174
|
-
export declare interface PositioningProps extends Omit<PopperOptions, 'positionFixed' | 'unstable_disableTether'> {
|
179
|
+
export declare interface PositioningProps extends Omit<PositioningOptions, 'positionFixed' | 'unstable_disableTether'> {
|
175
180
|
/** An imperative handle to Popper methods. */
|
176
|
-
|
181
|
+
positioningRef?: React_2.Ref<PositioningImperativeRef>;
|
177
182
|
/**
|
178
|
-
* Manual override for
|
183
|
+
* Manual override for the target element. Useful for scenarios where a component accepts user prop to override target
|
179
184
|
*/
|
180
|
-
target?: HTMLElement |
|
185
|
+
target?: HTMLElement | PositioningVirtualElement | null;
|
181
186
|
}
|
182
187
|
|
183
188
|
export declare type PositioningShorthand = PositioningProps | PositioningShorthandValue;
|
184
189
|
|
185
190
|
export declare type PositioningShorthandValue = 'above' | 'above-start' | 'above-end' | 'below' | 'below-start' | 'below-end' | 'before' | 'before-top' | 'before-bottom' | 'after' | 'after-top' | 'after-bottom';
|
186
191
|
|
192
|
+
export declare type PositioningVirtualElement = {
|
193
|
+
getBoundingClientRect: () => {
|
194
|
+
x: number;
|
195
|
+
y: number;
|
196
|
+
top: number;
|
197
|
+
left: number;
|
198
|
+
bottom: number;
|
199
|
+
right: number;
|
200
|
+
width: number;
|
201
|
+
height: number;
|
202
|
+
};
|
203
|
+
contextElement?: Element;
|
204
|
+
};
|
205
|
+
|
206
|
+
declare type Rect = {
|
207
|
+
width: number;
|
208
|
+
height: number;
|
209
|
+
x: number;
|
210
|
+
y: number;
|
211
|
+
};
|
212
|
+
|
187
213
|
export declare function resolvePositioningShorthand(shorthand: PositioningShorthand | undefined | null): Readonly<PositioningProps>;
|
188
214
|
|
215
|
+
declare interface UsePopperOptions extends PositioningProps {
|
216
|
+
/**
|
217
|
+
* If false, delays Popper's creation.
|
218
|
+
* @default true
|
219
|
+
*/
|
220
|
+
enabled?: boolean;
|
221
|
+
}
|
222
|
+
|
189
223
|
/**
|
190
224
|
* Exposes Popper positioning API via React hook. Contains few important differences between an official "react-popper"
|
191
225
|
* package:
|
@@ -194,7 +228,7 @@ export declare function resolvePositioningShorthand(shorthand: PositioningShorth
|
|
194
228
|
* - contains a specific to React fix related to initial positioning when containers have components with managed focus
|
195
229
|
* to avoid focus jumps
|
196
230
|
*/
|
197
|
-
export declare function
|
231
|
+
export declare function usePositioning(options?: UsePopperOptions): {
|
198
232
|
targetRef: React_2.MutableRefObject<any>;
|
199
233
|
containerRef: React_2.MutableRefObject<any>;
|
200
234
|
arrowRef: React_2.MutableRefObject<any>;
|
@@ -208,14 +242,6 @@ export declare function usePopper(options?: UsePopperOptions): {
|
|
208
242
|
* @param initialState - initializes a user provided state similare to useState
|
209
243
|
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
210
244
|
*/
|
211
|
-
export declare const
|
212
|
-
|
213
|
-
declare interface UsePopperOptions extends PositioningProps {
|
214
|
-
/**
|
215
|
-
* If false, delays Popper's creation.
|
216
|
-
* @default true
|
217
|
-
*/
|
218
|
-
enabled?: boolean;
|
219
|
-
}
|
245
|
+
export declare const usePositioningMouseTarget: (initialState?: PositioningVirtualElement | (() => PositioningVirtualElement) | undefined) => readonly [PositioningVirtualElement | undefined, (event: React_2.MouseEvent | MouseEvent | undefined | null) => void];
|
220
246
|
|
221
247
|
export { }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAqCA;;;;;;;;;;;;;;;;;;;;;AAqBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,OAA5B,EAA6D;
|
1
|
+
{"version":3,"sources":["createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAqCA;;;;;;;;;;;;;;;;;;;;;AAqBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,OAA5B,EAA6D;EACjE,MAAM;IACJ,WADI;IAEJ,WAAW,GAAG,KAFV;IAGJ,WAAW,GAAG,OAHV;IAIJ,WAAW,GAAG,MAAM,CAAC;EAJjB,IAKF,OALJ;EAOA,OAAO;IACL,QAAQ,EAAE,UADL;IAEL,eAAe,EAAE,SAFZ;IAGL,UAAU,EAAE,QAHP;IAIL,MAAM,EAAE,CAAC,CAJJ;IAML,IAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;IAQL,WAAW;MACT,OAAO,EAAE,IADA;MAET,UAAU,EAAE,SAFH;MAGT,QAAQ,EAAE,UAHD;MAIT,SAAS,EAAE,YAJF;MAKT,KAAK,EAAE,SALE;MAMT,MAAM,EAAE,SANC;MAOT,eAAe,EAAE,SAPR;MAQT,GAAG,UAAU,CAAC,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARM;MAaT,GAAG,UAAU,CAAC,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbM;MAcT,uBAAuB,EAAE,MAAM,CAAC,iBAdvB;MAeT,SAAS,EAAE;IAfF,CARN;IA0BL;IACA,2CAA2C;MACzC,MAAM,EAAE,IAAI,WAAW,EADkB;MAEzC,WAAW;IAF8B,CA3BtC;IA+BL,6CAA6C;MAC3C,IAAI,EAAE,IAAI,WAAW,gBADsB;MAE3C,WAAW;IAFgC,CA/BxC;IAmCL,8CAA8C;MAC5C,GAAG,EAAE,IAAI,WAAW,EADwB;MAE5C,WAAW;IAFiC,CAnCzC;IAuCL,4CAA4C;MAC1C,KAAK,EAAE,IAAI,WAAW,gBADoB;MAE1C,WAAW;IAF+B;EAvCvC,CAAP;AA4CD;AAED;;;;;AAKG;;AACH,OAAM,SAAU,uBAAV,CAAkC,WAAlC,EAAqD;EACzD;EACA;EACA,MAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;EACA,OAAO;IAAE,KAAK,EAAE,UAAT;IAAqB,MAAM,EAAE;EAA7B,CAAP;AACD","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n ':before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;
|
1
|
+
{"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;EACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;EACA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;EACA,MAAM,KAAK,GAAG,IAAI,GAAG,CAArB;EACA,MAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;EAEA,SAAS,qBAAT,GAA8B;IAC5B,OAAO;MACL,IADK;MAEL,GAFK;MAGL,KAHK;MAIL,MAJK;MAKL,CAAC,EAAE,IALE;MAML,CAAC,EAAE,GANE;MAOL,MAAM,EAAE,CAPH;MAQL,KAAK,EAAE;IARF,CAAP;EAUD;;EAED,OAAO;IACL;EADK,CAAP;AAGD","sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { createVirtualElementFromClick } from './createVirtualElementFromClick';
|
2
2
|
export { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';
|
3
|
-
export {
|
4
|
-
export {
|
3
|
+
export { usePositioning } from './usePositioning';
|
4
|
+
export { usePositioningMouseTarget } from './usePositioningMouseTarget';
|
5
5
|
export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { createVirtualElementFromClick } from './createVirtualElementFromClick';\nexport { createArrowHeightStyles, createArrowStyles } from './createArrowStyles';\nexport type { CreateArrowStylesOptions } from './createArrowStyles';\nexport { usePositioning } from './usePositioning';\nexport { usePositioningMouseTarget } from './usePositioningMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport type {\n Alignment,\n AutoSize,\n Boundary,\n Offset,\n OffsetFunction,\n OffsetFunctionParam,\n OffsetObject,\n OffsetShorthand,\n Position,\n PositioningImperativeRef,\n PositioningProps,\n PositioningShorthand,\n PositioningShorthandValue,\n PositioningVirtualElement,\n} from './types';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAAyC,gBAAzC;AAEA,OAAO,MAAM,sBAAsB,GAA2B;
|
1
|
+
{"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAAyC,gBAAzC;AAEA,OAAO,MAAM,sBAAsB,GAA2B;EAC5D,IAAI,EAAE,0BADsD;EAE5D,OAAO,EAAE,IAFmD;EAG5D,KAAK,EAAE,MAHqD;EAI5D,QAAQ,EAAE,CAAC,iBAAD,CAJkD;EAK5D,EAAE,EAAE,CAAC;IAAE,KAAF;IAAS;EAAT,CAAD,KAAoB;IACtB,MAAM,UAAU,GAAG,KAAK,CAAC,KAAN,CAAY,MAA/B;IACA,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAD,EAAQ;MAAE,WAAW,EAAE;IAAf,CAAR,CAAxC;IAEA,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,GAAlB,GAAwB,UAAU,CAAC,MAAnC,IAA6C,iBAAiB,CAAC,GAAlB,GAAwB,CAA/F;IACA,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,MAAlB,GAA2B,UAAU,CAAC,MAAtC,IAAgD,iBAAiB,CAAC,MAAlB,GAA2B,CAAxG;IAEA,MAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;IAEA,KAAK,CAAC,aAAN,CAAoB,IAApB,IAA4B;MAC1B;IAD0B,CAA5B;IAGA,KAAK,CAAC,UAAN,CAAiB,MAAjB,GAA0B,EACxB,GAAG,KAAK,CAAC,UAAN,CAAiB,MADI;MAExB,+BAA+B;IAFP,CAA1B;EAID;AArB2D,CAAvD","sourcesContent":["import { detectOverflow, Modifier } from '@popperjs/core';\n\nexport const isIntersectingModifier: IsIntersectingModifier = {\n name: 'is-intersecting-modifier',\n enabled: true,\n phase: 'main',\n requires: ['preventOverflow'],\n fn: ({ state, name }) => {\n const popperRect = state.rects.popper;\n const popperAltOverflow = detectOverflow(state, { altBoundary: true });\n\n const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;\n const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n state.modifiersData[name] = {\n isIntersecting,\n };\n state.attributes.popper = {\n ...state.attributes.popper,\n 'data-popper-is-intersecting': isIntersecting,\n };\n },\n};\n\ntype IsIntersectingModifier = Modifier<'is-intersecting-modifier', never>;\n"],"sourceRoot":"../src/"}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: HTMLElement | PositioningVirtualElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n}\n\nexport interface PositioningProps\n // \"positionFixed\" & \"unstable_disableTether\" are not exported as public API (yet)\n extends Omit<PositioningOptions, 'positionFixed' | 'unstable_disableTether'> {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: HTMLElement | PositioningVirtualElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"]}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { useEventCallback, useIsomorphicLayoutEffect, useFirstMount, canUseDOM } from '@fluentui/react-utilities';
|
2
|
-
import { useFluent } from '@fluentui/react-shared-contexts';
|
2
|
+
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
3
3
|
import * as PopperJs from '@popperjs/core';
|
4
4
|
import * as React from 'react';
|
5
5
|
import { isIntersectingModifier } from './isIntersectingModifier';
|
6
|
-
import { getScrollParent, applyRtlToOffset, getPlacement, getReactFiberFromNode, getBoundary, useCallbackRef,
|
6
|
+
import { getScrollParent, applyRtlToOffset, getPlacement, getReactFiberFromNode, getBoundary, useCallbackRef, parsePopperPlacement } from './utils/index';
|
7
|
+
import { getPopperOffset } from './utils/getPopperOffset'; //
|
7
8
|
// Dev utils to detect if nodes have "autoFocus" props.
|
8
9
|
//
|
9
10
|
|
@@ -58,7 +59,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
|
|
58
59
|
const offsetModifier = React.useMemo(() => offset ? {
|
59
60
|
name: 'offset',
|
60
61
|
options: {
|
61
|
-
offset: isRtl ? applyRtlToOffset(offset) : offset
|
62
|
+
offset: isRtl ? applyRtlToOffset(getPopperOffset(offset)) : getPopperOffset(offset)
|
62
63
|
}
|
63
64
|
} : null, [offset, isRtl]);
|
64
65
|
return React.useCallback((target, container, arrow) => {
|
@@ -175,7 +176,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
|
|
175
176
|
width,
|
176
177
|
height
|
177
178
|
} = state.rects.popper;
|
178
|
-
const basePlacement =
|
179
|
+
const basePlacement = parsePopperPlacement(state.placement).basePlacement;
|
179
180
|
const widthProp = basePlacement === 'left' ? 'left' : 'right';
|
180
181
|
const heightProp = basePlacement === 'top' ? 'top' : 'bottom';
|
181
182
|
const applyMaxWidth = autoSize === 'always' || autoSize === 'width-always' || overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width');
|
@@ -215,7 +216,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
|
|
215
216
|
fn({
|
216
217
|
state
|
217
218
|
}) {
|
218
|
-
const basePlacement =
|
219
|
+
const basePlacement = parsePopperPlacement(state.placement).basePlacement;
|
219
220
|
|
220
221
|
switch (basePlacement) {
|
221
222
|
case 'bottom':
|
@@ -257,7 +258,7 @@ function usePopperOptions(options, popperOriginalPositionRef) {
|
|
257
258
|
*/
|
258
259
|
|
259
260
|
|
260
|
-
export function
|
261
|
+
export function usePositioning(options = {}) {
|
261
262
|
const {
|
262
263
|
enabled = true
|
263
264
|
} = options;
|
@@ -324,7 +325,7 @@ export function usePopper(options = {}) {
|
|
324
325
|
const arrowRef = useCallbackRef(null, handlePopperUpdate, true); // Stores external target from options.target or setTarget
|
325
326
|
|
326
327
|
const overrideTargetRef = useCallbackRef(null, handlePopperUpdate, true);
|
327
|
-
React.useImperativeHandle(options.
|
328
|
+
React.useImperativeHandle(options.positioningRef, () => ({
|
328
329
|
updatePosition: () => {
|
329
330
|
var _a;
|
330
331
|
|
@@ -404,4 +405,4 @@ export function usePopper(options = {}) {
|
|
404
405
|
arrowRef
|
405
406
|
};
|
406
407
|
}
|
407
|
-
//# sourceMappingURL=
|
408
|
+
//# sourceMappingURL=usePositioning.js.map
|