@fluentui/react-positioning 0.0.0-nightly-20220302-0405.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.
Files changed (103) hide show
  1. package/CHANGELOG.json +1614 -0
  2. package/CHANGELOG.md +719 -0
  3. package/LICENSE +15 -0
  4. package/README.md +25 -0
  5. package/dist/react-positioning.d.ts +221 -0
  6. package/lib/createArrowStyles.d.ts +64 -0
  7. package/lib/createArrowStyles.js +87 -0
  8. package/lib/createArrowStyles.js.map +1 -0
  9. package/lib/createVirtualElementFromClick.d.ts +6 -0
  10. package/lib/createVirtualElementFromClick.js +26 -0
  11. package/lib/createVirtualElementFromClick.js.map +1 -0
  12. package/lib/index.d.ts +6 -0
  13. package/lib/index.js +7 -0
  14. package/lib/index.js.map +1 -0
  15. package/lib/isIntersectingModifier.d.ts +4 -0
  16. package/lib/isIntersectingModifier.js +26 -0
  17. package/lib/isIntersectingModifier.js.map +1 -0
  18. package/lib/tsdoc-metadata.json +11 -0
  19. package/lib/types.d.ts +89 -0
  20. package/lib/types.js +2 -0
  21. package/lib/types.js.map +1 -0
  22. package/lib/usePopper.d.ts +23 -0
  23. package/lib/usePopper.js +407 -0
  24. package/lib/usePopper.js.map +1 -0
  25. package/lib/usePopperMouseTarget.d.ts +11 -0
  26. package/lib/usePopperMouseTarget.js +40 -0
  27. package/lib/usePopperMouseTarget.js.map +1 -0
  28. package/lib/utils/getBasePlacement.d.ts +8 -0
  29. package/lib/utils/getBasePlacement.js +10 -0
  30. package/lib/utils/getBasePlacement.js.map +1 -0
  31. package/lib/utils/getBoundary.d.ts +6 -0
  32. package/lib/utils/getBoundary.js +23 -0
  33. package/lib/utils/getBoundary.js.map +1 -0
  34. package/lib/utils/getReactFiberFromNode.d.ts +108 -0
  35. package/lib/utils/getReactFiberFromNode.js +46 -0
  36. package/lib/utils/getReactFiberFromNode.js.map +1 -0
  37. package/lib/utils/getScrollParent.d.ts +12 -0
  38. package/lib/utils/getScrollParent.js +65 -0
  39. package/lib/utils/getScrollParent.js.map +1 -0
  40. package/lib/utils/index.d.ts +8 -0
  41. package/lib/utils/index.js +9 -0
  42. package/lib/utils/index.js.map +1 -0
  43. package/lib/utils/mergeArrowOffset.d.ts +10 -0
  44. package/lib/utils/mergeArrowOffset.js +42 -0
  45. package/lib/utils/mergeArrowOffset.js.map +1 -0
  46. package/lib/utils/positioningHelper.d.ts +7 -0
  47. package/lib/utils/positioningHelper.js +49 -0
  48. package/lib/utils/positioningHelper.js.map +1 -0
  49. package/lib/utils/resolvePositioningShorthand.d.ts +2 -0
  50. package/lib/utils/resolvePositioningShorthand.js +63 -0
  51. package/lib/utils/resolvePositioningShorthand.js.map +1 -0
  52. package/lib/utils/useCallbackRef.d.ts +19 -0
  53. package/lib/utils/useCallbackRef.js +57 -0
  54. package/lib/utils/useCallbackRef.js.map +1 -0
  55. package/lib-commonjs/createArrowStyles.d.ts +64 -0
  56. package/lib-commonjs/createArrowStyles.js +100 -0
  57. package/lib-commonjs/createArrowStyles.js.map +1 -0
  58. package/lib-commonjs/createVirtualElementFromClick.d.ts +6 -0
  59. package/lib-commonjs/createVirtualElementFromClick.js +35 -0
  60. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -0
  61. package/lib-commonjs/index.d.ts +6 -0
  62. package/lib-commonjs/index.js +34 -0
  63. package/lib-commonjs/index.js.map +1 -0
  64. package/lib-commonjs/isIntersectingModifier.d.ts +4 -0
  65. package/lib-commonjs/isIntersectingModifier.js +34 -0
  66. package/lib-commonjs/isIntersectingModifier.js.map +1 -0
  67. package/lib-commonjs/types.d.ts +89 -0
  68. package/lib-commonjs/types.js +6 -0
  69. package/lib-commonjs/types.js.map +1 -0
  70. package/lib-commonjs/usePopper.d.ts +23 -0
  71. package/lib-commonjs/usePopper.js +422 -0
  72. package/lib-commonjs/usePopper.js.map +1 -0
  73. package/lib-commonjs/usePopperMouseTarget.d.ts +11 -0
  74. package/lib-commonjs/usePopperMouseTarget.js +51 -0
  75. package/lib-commonjs/usePopperMouseTarget.js.map +1 -0
  76. package/lib-commonjs/utils/getBasePlacement.d.ts +8 -0
  77. package/lib-commonjs/utils/getBasePlacement.js +19 -0
  78. package/lib-commonjs/utils/getBasePlacement.js.map +1 -0
  79. package/lib-commonjs/utils/getBoundary.d.ts +6 -0
  80. package/lib-commonjs/utils/getBoundary.js +33 -0
  81. package/lib-commonjs/utils/getBoundary.js.map +1 -0
  82. package/lib-commonjs/utils/getReactFiberFromNode.d.ts +108 -0
  83. package/lib-commonjs/utils/getReactFiberFromNode.js +54 -0
  84. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -0
  85. package/lib-commonjs/utils/getScrollParent.d.ts +12 -0
  86. package/lib-commonjs/utils/getScrollParent.js +76 -0
  87. package/lib-commonjs/utils/getScrollParent.js.map +1 -0
  88. package/lib-commonjs/utils/index.d.ts +8 -0
  89. package/lib-commonjs/utils/index.js +24 -0
  90. package/lib-commonjs/utils/index.js.map +1 -0
  91. package/lib-commonjs/utils/mergeArrowOffset.d.ts +10 -0
  92. package/lib-commonjs/utils/mergeArrowOffset.js +51 -0
  93. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -0
  94. package/lib-commonjs/utils/positioningHelper.d.ts +7 -0
  95. package/lib-commonjs/utils/positioningHelper.js +61 -0
  96. package/lib-commonjs/utils/positioningHelper.js.map +1 -0
  97. package/lib-commonjs/utils/resolvePositioningShorthand.d.ts +2 -0
  98. package/lib-commonjs/utils/resolvePositioningShorthand.js +72 -0
  99. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -0
  100. package/lib-commonjs/utils/useCallbackRef.d.ts +19 -0
  101. package/lib-commonjs/utils/useCallbackRef.js +68 -0
  102. package/lib-commonjs/utils/useCallbackRef.js.map +1 -0
  103. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ @fluentui/react-positioning
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
15
+ Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @fluentui/react-positioning
2
+
3
+ A react hook wrapper around [Popper.js](https://popper.js.org/) for Fluent UI.
4
+
5
+ These are not production-ready utilities and **should never be used in product**. This space is useful for testing new utilities whose APIs might change before final release.
6
+
7
+ ## Usage
8
+
9
+ ```tsx
10
+ import React from 'react';
11
+ import { usePopper } from '@fluentui/react-positioning';
12
+
13
+ function PopupExample: React.FC = ({ children }) => {
14
+ const {targetRef, containerRef} = usePopper();
15
+ const [open, setOpen] = React.useState(false);
16
+
17
+ const onClick = () => setOpen(s => !s);
18
+ return (
19
+ <>
20
+ <button ref={targetRef} onClick={onClick}> Toggle popup </button>
21
+ { open && <div ref={containerRef}>{children}</div> }
22
+ </>
23
+ )
24
+ }
25
+ ```
@@ -0,0 +1,221 @@
1
+ import type { GriffelStyle } from '@griffel/react';
2
+ import * as PopperJs from '@popperjs/core';
3
+ import * as React_2 from 'react';
4
+
5
+ export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
6
+
7
+ export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;
8
+
9
+ export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
10
+
11
+ /**
12
+ * Creates CSS styles to size the arrow created by createArrowStyles to the given height.
13
+ *
14
+ * Use this when you need to create classes for several different arrow sizes. If you only need a
15
+ * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
16
+ */
17
+ export declare function createArrowHeightStyles(arrowHeight: number): {
18
+ width: string;
19
+ height: string;
20
+ };
21
+
22
+ /**
23
+ * Helper that creates a makeStyles rule for an arrow element.
24
+ * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
25
+ *
26
+ * ```ts
27
+ * makeStyles({
28
+ * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
29
+ *
30
+ * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
31
+ * mediumArrow: createArrowHeightStyles(4),
32
+ * smallArrow: createArrowHeightStyles(2),
33
+ * })
34
+ * ...
35
+ *
36
+ * state.arrowWithSize.className = styles.arrowWithSize;
37
+ * state.arrowWithoutSize.className = mergeClasses(
38
+ * styles.arrowWithoutSize,
39
+ * state.smallArrow && styles.smallArrow,
40
+ * state.mediumArrow && styles.mediumArrow,
41
+ * )
42
+ * ```
43
+ */
44
+ export declare function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle;
45
+
46
+ /**
47
+ * Options parameter for the createArrowStyles function
48
+ */
49
+ export declare type CreateArrowStylesOptions = {
50
+ /**
51
+ * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.
52
+ *
53
+ * This can be undefined to leave out the arrow size styles. You must then add styles created by
54
+ * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.
55
+ */
56
+ arrowHeight: number | undefined;
57
+ /**
58
+ * The borderWidth of the arrow. Should be the same borderWidth as the parent element.
59
+ *
60
+ * @defaultvalue 1px
61
+ */
62
+ borderWidth?: GriffelStyle['borderBottomWidth'];
63
+ /**
64
+ * The borderStyle for the arrow. Should be the same borderStyle as the parent element.
65
+ *
66
+ * @defaultvalue solid
67
+ */
68
+ borderStyle?: GriffelStyle['borderBottomStyle'];
69
+ /**
70
+ * The borderColor of the arrow. Should be the same borderColor as the parent element.
71
+ *
72
+ * @defaultvalue tokens.colorTransparentStroke
73
+ */
74
+ borderColor?: GriffelStyle['borderBottomColor'];
75
+ };
76
+
77
+ /**
78
+ * Creates a virtual element based on the position of a click event
79
+ * Can be used as a target for popper in scenarios such as context menus
80
+ */
81
+ export declare function createVirtualElementFromClick(nativeEvent: MouseEvent): PopperVirtualElement;
82
+
83
+ /**
84
+ * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
85
+ * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset
86
+ *
87
+ * @param userOffset - The offset provided by the user
88
+ * @param arrowHeight - The height of the arrow in px
89
+ * @returns User offset augmented with arrow height
90
+ */
91
+ export declare function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset;
92
+
93
+ export declare type Offset = OffsetFunction | [number | null | undefined, number | null | undefined];
94
+
95
+ export declare type OffsetFunction = (param: OffsetFunctionParam) => [number | null | undefined, number | null | undefined];
96
+
97
+ export declare type OffsetFunctionParam = {
98
+ popper: PopperJs.Rect;
99
+ reference: PopperJs.Rect;
100
+ placement: PopperJs.Placement;
101
+ };
102
+
103
+ export declare interface PopperOptions {
104
+ /** Alignment for the component. Only has an effect if used with the @see position option */
105
+ align?: Alignment;
106
+ /** The element which will define the boundaries of the popper position for the flip behavior. */
107
+ flipBoundary?: Boundary;
108
+ /** The element which will define the boundaries of the popper position for the overflow behavior. */
109
+ overflowBoundary?: Boundary;
110
+ /**
111
+ * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')
112
+ * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'
113
+ * and 'start' | 'end' respectively),
114
+ * then provided value for 'align' will be ignored and 'center' will be used instead.
115
+ */
116
+ position?: Position;
117
+ /**
118
+ * Enables the Popper box to position itself in 'fixed' mode (default value is position: 'absolute')
119
+ * @default false
120
+ */
121
+ positionFixed?: boolean;
122
+ /**
123
+ * Lets you displace a popper element from its reference element.
124
+ * This can be useful if you need to apply some margin between them or if you need to fine tune the
125
+ * position according to some custom logic.
126
+ */
127
+ offset?: Offset;
128
+ /**
129
+ * Defines padding between the corner of the popup element and the arrow.
130
+ * Use to prevent the arrow from overlapping a rounded corner, for example.
131
+ */
132
+ arrowPadding?: number;
133
+ /**
134
+ * Applies max-height and max-width on popper to fit it within the available space in viewport.
135
+ * true enables this for both width and height when overflow happens.
136
+ * 'always' applies `max-height`/`max-width` regardless of overflow.
137
+ * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`
138
+ * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`
139
+ */
140
+ autoSize?: AutoSize;
141
+ /**
142
+ * Modifies position and alignment to cover the target
143
+ */
144
+ coverTarget?: boolean;
145
+ /**
146
+ * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and
147
+ * `position` props, regardless of the size of the component, the reference element or the viewport.
148
+ */
149
+ pinned?: boolean;
150
+ /**
151
+ * When the reference element or the viewport is outside viewport allows a popper element to be fully in viewport.
152
+ * "all" enables this behavior for all axis.
153
+ */
154
+ unstable_disableTether?: boolean | 'all';
155
+ }
156
+
157
+ export declare type PopperRefHandle = {
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'> {
175
+ /** An imperative handle to Popper methods. */
176
+ popperRef?: React_2.Ref<PopperRefHandle>;
177
+ /**
178
+ * Manual override for popper target. Useful for scenarios where a component accepts user prop to override target
179
+ */
180
+ target?: HTMLElement | PopperVirtualElement | null;
181
+ }
182
+
183
+ export declare type PositioningShorthand = PositioningProps | PositioningShorthandValue;
184
+
185
+ 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
+
187
+ export declare function resolvePositioningShorthand(shorthand: PositioningShorthand | undefined | null): Readonly<PositioningProps>;
188
+
189
+ /**
190
+ * Exposes Popper positioning API via React hook. Contains few important differences between an official "react-popper"
191
+ * package:
192
+ * - style attributes are applied directly on DOM to avoid re-renders
193
+ * - refs changes and resolution is handled properly without re-renders
194
+ * - contains a specific to React fix related to initial positioning when containers have components with managed focus
195
+ * to avoid focus jumps
196
+ */
197
+ export declare function usePopper(options?: UsePopperOptions): {
198
+ targetRef: React_2.MutableRefObject<any>;
199
+ containerRef: React_2.MutableRefObject<any>;
200
+ arrowRef: React_2.MutableRefObject<any>;
201
+ };
202
+
203
+ /**
204
+ * A state hook that manages a popper virtual element from mouseevents.
205
+ * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)
206
+ * React synthetic events are not persisted by this hook
207
+ *
208
+ * @param initialState - initializes a user provided state similare to useState
209
+ * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
210
+ */
211
+ export declare const usePopperMouseTarget: (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement) | undefined) => readonly [PopperJs.VirtualElement | undefined, (event: React_2.MouseEvent | MouseEvent | undefined | null) => void];
212
+
213
+ declare interface UsePopperOptions extends PositioningProps {
214
+ /**
215
+ * If false, delays Popper's creation.
216
+ * @default true
217
+ */
218
+ enabled?: boolean;
219
+ }
220
+
221
+ export { }
@@ -0,0 +1,64 @@
1
+ import type { GriffelStyle } from '@griffel/react';
2
+ /**
3
+ * Options parameter for the createArrowStyles function
4
+ */
5
+ export declare type CreateArrowStylesOptions = {
6
+ /**
7
+ * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.
8
+ *
9
+ * This can be undefined to leave out the arrow size styles. You must then add styles created by
10
+ * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.
11
+ */
12
+ arrowHeight: number | undefined;
13
+ /**
14
+ * The borderWidth of the arrow. Should be the same borderWidth as the parent element.
15
+ *
16
+ * @defaultvalue 1px
17
+ */
18
+ borderWidth?: GriffelStyle['borderBottomWidth'];
19
+ /**
20
+ * The borderStyle for the arrow. Should be the same borderStyle as the parent element.
21
+ *
22
+ * @defaultvalue solid
23
+ */
24
+ borderStyle?: GriffelStyle['borderBottomStyle'];
25
+ /**
26
+ * The borderColor of the arrow. Should be the same borderColor as the parent element.
27
+ *
28
+ * @defaultvalue tokens.colorTransparentStroke
29
+ */
30
+ borderColor?: GriffelStyle['borderBottomColor'];
31
+ };
32
+ /**
33
+ * Helper that creates a makeStyles rule for an arrow element.
34
+ * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
35
+ *
36
+ * ```ts
37
+ * makeStyles({
38
+ * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
39
+ *
40
+ * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
41
+ * mediumArrow: createArrowHeightStyles(4),
42
+ * smallArrow: createArrowHeightStyles(2),
43
+ * })
44
+ * ...
45
+ *
46
+ * state.arrowWithSize.className = styles.arrowWithSize;
47
+ * state.arrowWithoutSize.className = mergeClasses(
48
+ * styles.arrowWithoutSize,
49
+ * state.smallArrow && styles.smallArrow,
50
+ * state.mediumArrow && styles.mediumArrow,
51
+ * )
52
+ * ```
53
+ */
54
+ export declare function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle;
55
+ /**
56
+ * Creates CSS styles to size the arrow created by createArrowStyles to the given height.
57
+ *
58
+ * Use this when you need to create classes for several different arrow sizes. If you only need a
59
+ * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
60
+ */
61
+ export declare function createArrowHeightStyles(arrowHeight: number): {
62
+ width: string;
63
+ height: string;
64
+ };
@@ -0,0 +1,87 @@
1
+ import { shorthands } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ /**
4
+ * Helper that creates a makeStyles rule for an arrow element.
5
+ * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
6
+ *
7
+ * ```ts
8
+ * makeStyles({
9
+ * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),
10
+ *
11
+ * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),
12
+ * mediumArrow: createArrowHeightStyles(4),
13
+ * smallArrow: createArrowHeightStyles(2),
14
+ * })
15
+ * ...
16
+ *
17
+ * state.arrowWithSize.className = styles.arrowWithSize;
18
+ * state.arrowWithoutSize.className = mergeClasses(
19
+ * styles.arrowWithoutSize,
20
+ * state.smallArrow && styles.smallArrow,
21
+ * state.mediumArrow && styles.mediumArrow,
22
+ * )
23
+ * ```
24
+ */
25
+
26
+ export function createArrowStyles(options) {
27
+ const {
28
+ arrowHeight,
29
+ borderWidth = '1px',
30
+ borderStyle = 'solid',
31
+ borderColor = tokens.colorTransparentStroke
32
+ } = options;
33
+ return {
34
+ position: 'absolute',
35
+ backgroundColor: 'inherit',
36
+ visibility: 'hidden',
37
+ zIndex: -1,
38
+ ...(arrowHeight && createArrowHeightStyles(arrowHeight)),
39
+ ':before': {
40
+ content: '""',
41
+ visibility: 'visible',
42
+ position: 'absolute',
43
+ boxSizing: 'border-box',
44
+ width: 'inherit',
45
+ height: 'inherit',
46
+ backgroundColor: 'inherit',
47
+ ...shorthands.borderRight(`${borderWidth} /* @noflip */`, `${borderStyle} /* @noflip */`, `${borderColor} /* @noflip */`),
48
+ ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),
49
+ borderBottomRightRadius: tokens.borderRadiusSmall,
50
+ transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)'
51
+ },
52
+ // Popper sets data-popper-placement on the root element, which is used to align the arrow
53
+ ':global([data-popper-placement^="top"])': {
54
+ bottom: `-${borderWidth}`,
55
+ '--angle': '0'
56
+ },
57
+ ':global([data-popper-placement^="right"])': {
58
+ left: `-${borderWidth} /* @noflip */`,
59
+ '--angle': '90deg'
60
+ },
61
+ ':global([data-popper-placement^="bottom"])': {
62
+ top: `-${borderWidth}`,
63
+ '--angle': '180deg'
64
+ },
65
+ ':global([data-popper-placement^="left"])': {
66
+ right: `-${borderWidth} /* @noflip */`,
67
+ '--angle': '270deg'
68
+ }
69
+ };
70
+ }
71
+ /**
72
+ * Creates CSS styles to size the arrow created by createArrowStyles to the given height.
73
+ *
74
+ * Use this when you need to create classes for several different arrow sizes. If you only need a
75
+ * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
76
+ */
77
+
78
+ export function createArrowHeightStyles(arrowHeight) {
79
+ // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.
80
+ // Multiply the triangle's height by sqrt(2) to get length of its edges.
81
+ const edgeLength = `${1.414 * arrowHeight}px`;
82
+ return {
83
+ width: edgeLength,
84
+ height: edgeLength
85
+ };
86
+ }
87
+ //# sourceMappingURL=createArrowStyles.js.map
@@ -0,0 +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;AACjE,QAAM;AACJ,IAAA,WADI;AAEJ,IAAA,WAAW,GAAG,KAFV;AAGJ,IAAA,WAAW,GAAG,OAHV;AAIJ,IAAA,WAAW,GAAG,MAAM,CAAC;AAJjB,MAKF,OALJ;AAOA,SAAO;AACL,IAAA,QAAQ,EAAE,UADL;AAEL,IAAA,eAAe,EAAE,SAFZ;AAGL,IAAA,UAAU,EAAE,QAHP;AAIL,IAAA,MAAM,EAAE,CAAC,CAJJ;AAML,QAAI,WAAW,IAAI,uBAAuB,CAAC,WAAD,CAA1C,CANK;AAQL,eAAW;AACT,MAAA,OAAO,EAAE,IADA;AAET,MAAA,UAAU,EAAE,SAFH;AAGT,MAAA,QAAQ,EAAE,UAHD;AAIT,MAAA,SAAS,EAAE,YAJF;AAKT,MAAA,KAAK,EAAE,SALE;AAMT,MAAA,MAAM,EAAE,SANC;AAOT,MAAA,eAAe,EAAE,SAPR;AAQT,SAAG,UAAU,CAAC,WAAX,CACD,GAAG,WAAW,gBADb,EAED,GAAG,WAAW,gBAFb,EAGD,GAAG,WAAW,gBAHb,CARM;AAaT,SAAG,UAAU,CAAC,YAAX,CAAwB,WAAxB,EAAqC,WAArC,EAAkD,WAAlD,CAbM;AAcT,MAAA,uBAAuB,EAAE,MAAM,CAAC,iBAdvB;AAeT,MAAA,SAAS,EAAE;AAfF,KARN;AA0BL;AACA,+CAA2C;AACzC,MAAA,MAAM,EAAE,IAAI,WAAW,EADkB;AAEzC,iBAAW;AAF8B,KA3BtC;AA+BL,iDAA6C;AAC3C,MAAA,IAAI,EAAE,IAAI,WAAW,gBADsB;AAE3C,iBAAW;AAFgC,KA/BxC;AAmCL,kDAA8C;AAC5C,MAAA,GAAG,EAAE,IAAI,WAAW,EADwB;AAE5C,iBAAW;AAFiC,KAnCzC;AAuCL,gDAA4C;AAC1C,MAAA,KAAK,EAAE,IAAI,WAAW,gBADoB;AAE1C,iBAAW;AAF+B;AAvCvC,GAAP;AA4CD;AAED;;;;;AAKG;;AACH,OAAM,SAAU,uBAAV,CAAkC,WAAlC,EAAqD;AACzD;AACA;AACA,QAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,IAAzC;AACA,SAAO;AAAE,IAAA,KAAK,EAAE,UAAT;AAAqB,IAAA,MAAM,EAAE;AAA7B,GAAP;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/"}
@@ -0,0 +1,6 @@
1
+ import type { PopperVirtualElement } from './types';
2
+ /**
3
+ * Creates a virtual element based on the position of a click event
4
+ * Can be used as a target for popper in scenarios such as context menus
5
+ */
6
+ export declare function createVirtualElementFromClick(nativeEvent: MouseEvent): PopperVirtualElement;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Creates a virtual element based on the position of a click event
3
+ * Can be used as a target for popper in scenarios such as context menus
4
+ */
5
+ export function createVirtualElementFromClick(nativeEvent) {
6
+ const left = nativeEvent.clientX;
7
+ const top = nativeEvent.clientY;
8
+ const right = left + 1;
9
+ const bottom = top + 1;
10
+
11
+ function getBoundingClientRect() {
12
+ return {
13
+ left,
14
+ top,
15
+ right,
16
+ bottom,
17
+ height: 1,
18
+ width: 1
19
+ };
20
+ }
21
+
22
+ return {
23
+ getBoundingClientRect
24
+ };
25
+ }
26
+ //# sourceMappingURL=createVirtualElementFromClick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;AACnE,QAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;AACA,QAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;AACA,QAAM,KAAK,GAAG,IAAI,GAAG,CAArB;AACA,QAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;AAEA,WAAS,qBAAT,GAA8B;AAC5B,WAAO;AACL,MAAA,IADK;AAEL,MAAA,GAFK;AAGL,MAAA,KAHK;AAIL,MAAA,MAJK;AAML,MAAA,MAAM,EAAE,CANH;AAOL,MAAA,KAAK,EAAE;AAPF,KAAP;AASD;;AAED,SAAO;AACL,IAAA;AADK,GAAP;AAGD","sourcesContent":["import type { PopperVirtualElement } 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): PopperVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect(): ClientRect {\n return {\n left,\n top,\n right,\n bottom,\n\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './createVirtualElementFromClick';
2
+ export * from './createArrowStyles';
3
+ export * from './usePopper';
4
+ export * from './usePopperMouseTarget';
5
+ export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
6
+ export * from './types';
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './createVirtualElementFromClick';
2
+ export * from './createArrowStyles';
3
+ export * from './usePopper';
4
+ export * from './usePopperMouseTarget';
5
+ export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
6
+ export * from './types';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,cAAc,SAAS,CAAC","sourcesContent":["export * from './createVirtualElementFromClick';\nexport * from './createArrowStyles';\nexport * from './usePopper';\nexport * from './usePopperMouseTarget';\nexport { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';\nexport * from './types';\n"]}
@@ -0,0 +1,4 @@
1
+ import { Modifier } from '@popperjs/core';
2
+ export declare const isIntersectingModifier: IsIntersectingModifier;
3
+ declare type IsIntersectingModifier = Modifier<'is-intersecting-modifier', never>;
4
+ export {};
@@ -0,0 +1,26 @@
1
+ import { detectOverflow } from '@popperjs/core';
2
+ export const isIntersectingModifier = {
3
+ name: 'is-intersecting-modifier',
4
+ enabled: true,
5
+ phase: 'main',
6
+ requires: ['preventOverflow'],
7
+ fn: ({
8
+ state,
9
+ name
10
+ }) => {
11
+ const popperRect = state.rects.popper;
12
+ const popperAltOverflow = detectOverflow(state, {
13
+ altBoundary: true
14
+ });
15
+ const isIntersectingTop = popperAltOverflow.top < popperRect.height && popperAltOverflow.top > 0;
16
+ const isIntersectingBottom = popperAltOverflow.bottom < popperRect.height && popperAltOverflow.bottom > 0;
17
+ const isIntersecting = isIntersectingTop || isIntersectingBottom;
18
+ state.modifiersData[name] = {
19
+ isIntersecting
20
+ };
21
+ state.attributes.popper = { ...state.attributes.popper,
22
+ 'data-popper-is-intersecting': isIntersecting
23
+ };
24
+ }
25
+ };
26
+ //# sourceMappingURL=isIntersectingModifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["isIntersectingModifier.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAAyC,gBAAzC;AAEA,OAAO,MAAM,sBAAsB,GAA2B;AAC5D,EAAA,IAAI,EAAE,0BADsD;AAE5D,EAAA,OAAO,EAAE,IAFmD;AAG5D,EAAA,KAAK,EAAE,MAHqD;AAI5D,EAAA,QAAQ,EAAE,CAAC,iBAAD,CAJkD;AAK5D,EAAA,EAAE,EAAE,CAAC;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,GAAD,KAAoB;AACtB,UAAM,UAAU,GAAG,KAAK,CAAC,KAAN,CAAY,MAA/B;AACA,UAAM,iBAAiB,GAAG,cAAc,CAAC,KAAD,EAAQ;AAAE,MAAA,WAAW,EAAE;AAAf,KAAR,CAAxC;AAEA,UAAM,iBAAiB,GAAG,iBAAiB,CAAC,GAAlB,GAAwB,UAAU,CAAC,MAAnC,IAA6C,iBAAiB,CAAC,GAAlB,GAAwB,CAA/F;AACA,UAAM,oBAAoB,GAAG,iBAAiB,CAAC,MAAlB,GAA2B,UAAU,CAAC,MAAtC,IAAgD,iBAAiB,CAAC,MAAlB,GAA2B,CAAxG;AAEA,UAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;AAEA,IAAA,KAAK,CAAC,aAAN,CAAoB,IAApB,IAA4B;AAC1B,MAAA;AAD0B,KAA5B;AAGA,IAAA,KAAK,CAAC,UAAN,CAAiB,MAAjB,GAA0B,EACxB,GAAG,KAAK,CAAC,UAAN,CAAiB,MADI;AAExB,qCAA+B;AAFP,KAA1B;AAID;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/"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
package/lib/types.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import * as PopperJs from '@popperjs/core';
2
+ import * as React from 'react';
3
+ export declare type OffsetFunctionParam = {
4
+ popper: PopperJs.Rect;
5
+ reference: PopperJs.Rect;
6
+ placement: PopperJs.Placement;
7
+ };
8
+ export declare type OffsetFunction = (param: OffsetFunctionParam) => [number | null | undefined, number | null | undefined];
9
+ export declare type Offset = OffsetFunction | [number | null | undefined, number | null | undefined];
10
+ export declare type Position = 'above' | 'below' | 'before' | 'after';
11
+ export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
12
+ export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;
13
+ export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
14
+ export declare type PopperRefHandle = {
15
+ /**
16
+ * Updates the position of the popper imperatively.
17
+ * Useful when the position of the target changes from other factors than scrolling of window resize.
18
+ */
19
+ updatePosition: () => void;
20
+ /**
21
+ * Sets the target and updates positioning imperatively.
22
+ * Useful for avoiding double renders with the target option.
23
+ */
24
+ setTarget: (target: HTMLElement | PopperVirtualElement) => void;
25
+ };
26
+ export declare type PopperVirtualElement = PopperJs.VirtualElement;
27
+ export interface PopperOptions {
28
+ /** Alignment for the component. Only has an effect if used with the @see position option */
29
+ align?: Alignment;
30
+ /** The element which will define the boundaries of the popper position for the flip behavior. */
31
+ flipBoundary?: Boundary;
32
+ /** The element which will define the boundaries of the popper position for the overflow behavior. */
33
+ overflowBoundary?: Boundary;
34
+ /**
35
+ * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')
36
+ * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'
37
+ * and 'start' | 'end' respectively),
38
+ * then provided value for 'align' will be ignored and 'center' will be used instead.
39
+ */
40
+ position?: Position;
41
+ /**
42
+ * Enables the Popper box to position itself in 'fixed' mode (default value is position: 'absolute')
43
+ * @default false
44
+ */
45
+ positionFixed?: boolean;
46
+ /**
47
+ * Lets you displace a popper element from its reference element.
48
+ * This can be useful if you need to apply some margin between them or if you need to fine tune the
49
+ * position according to some custom logic.
50
+ */
51
+ offset?: Offset;
52
+ /**
53
+ * Defines padding between the corner of the popup element and the arrow.
54
+ * Use to prevent the arrow from overlapping a rounded corner, for example.
55
+ */
56
+ arrowPadding?: number;
57
+ /**
58
+ * Applies max-height and max-width on popper to fit it within the available space in viewport.
59
+ * true enables this for both width and height when overflow happens.
60
+ * 'always' applies `max-height`/`max-width` regardless of overflow.
61
+ * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`
62
+ * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`
63
+ */
64
+ autoSize?: AutoSize;
65
+ /**
66
+ * Modifies position and alignment to cover the target
67
+ */
68
+ coverTarget?: boolean;
69
+ /**
70
+ * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and
71
+ * `position` props, regardless of the size of the component, the reference element or the viewport.
72
+ */
73
+ pinned?: boolean;
74
+ /**
75
+ * When the reference element or the viewport is outside viewport allows a popper element to be fully in viewport.
76
+ * "all" enables this behavior for all axis.
77
+ */
78
+ unstable_disableTether?: boolean | 'all';
79
+ }
80
+ export interface PositioningProps extends Omit<PopperOptions, 'positionFixed' | 'unstable_disableTether'> {
81
+ /** An imperative handle to Popper methods. */
82
+ popperRef?: React.Ref<PopperRefHandle>;
83
+ /**
84
+ * Manual override for popper target. Useful for scenarios where a component accepts user prop to override target
85
+ */
86
+ target?: HTMLElement | PopperVirtualElement | null;
87
+ }
88
+ export declare type PositioningShorthandValue = 'above' | 'above-start' | 'above-end' | 'below' | 'below-start' | 'below-end' | 'before' | 'before-top' | 'before-bottom' | 'after' | 'after-top' | 'after-bottom';
89
+ export declare type PositioningShorthand = PositioningProps | PositioningShorthandValue;
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"../src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import * as PopperJs from '@popperjs/core';\nimport * as React from 'react';\n\nexport type OffsetFunctionParam = {\n popper: PopperJs.Rect;\n reference: PopperJs.Rect;\n placement: PopperJs.Placement;\n};\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => [number | null | undefined, number | null | undefined];\n\nexport type Offset = OffsetFunction | [number | null | undefined, number | null | undefined];\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 = PopperJs.Boundary | 'scrollParent' | 'window';\n\nexport type PopperRefHandle = {\n /**\n * Updates the position of the popper 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 | PopperVirtualElement) => void;\n};\n\nexport type PopperVirtualElement = PopperJs.VirtualElement;\n\nexport interface PopperOptions {\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 popper position for the flip behavior. */\n flipBoundary?: Boundary;\n\n /** The element which will define the boundaries of the popper position 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 Popper box to position itself in 'fixed' mode (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a popper 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 popper 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 popper 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<PopperOptions, 'positionFixed' | 'unstable_disableTether'> {\n /** An imperative handle to Popper methods. */\n popperRef?: React.Ref<PopperRefHandle>;\n\n /**\n * Manual override for popper target. Useful for scenarios where a component accepts user prop to override target\n */\n target?: HTMLElement | PopperVirtualElement | 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"]}