@fluentui/react-positioning 9.0.0-rc.7 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +219 -1
- package/CHANGELOG.md +80 -2
- package/dist/index.d.ts +78 -46
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/createArrowStyles.js +3 -1
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +2 -0
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js +4 -5
- 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} +10 -8
- package/lib/usePositioning.js.map +1 -0
- package/lib/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +4 -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 +24 -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 +3 -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 +38 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/isIntersectingModifier.js.map +1 -1
- package/lib-commonjs/{usePopper.js → usePositioning.js} +13 -10
- package/lib-commonjs/usePositioning.js.map +1 -0
- package/lib-commonjs/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +6 -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 +24 -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 +7 -9
- package/lib/createArrowStyles.d.ts +0 -64
- package/lib/createVirtualElementFromClick.d.ts +0 -6
- package/lib/index.d.ts +0 -6
- package/lib/isIntersectingModifier.d.ts +0 -4
- package/lib/types.d.ts +0 -89
- package/lib/usePopper.d.ts +0 -23
- package/lib/usePopper.js.map +0 -1
- package/lib/usePopperMouseTarget.d.ts +0 -11
- package/lib/usePopperMouseTarget.js.map +0 -1
- package/lib/utils/getBasePlacement.d.ts +0 -8
- package/lib/utils/getBasePlacement.js +0 -10
- package/lib/utils/getBasePlacement.js.map +0 -1
- package/lib/utils/getBoundary.d.ts +0 -6
- package/lib/utils/getReactFiberFromNode.d.ts +0 -108
- package/lib/utils/getScrollParent.d.ts +0 -12
- package/lib/utils/index.d.ts +0 -8
- package/lib/utils/mergeArrowOffset.d.ts +0 -10
- package/lib/utils/positioningHelper.d.ts +0 -7
- package/lib/utils/resolvePositioningShorthand.d.ts +0 -2
- package/lib/utils/useCallbackRef.d.ts +0 -19
- package/lib-commonjs/createArrowStyles.d.ts +0 -64
- package/lib-commonjs/createVirtualElementFromClick.d.ts +0 -6
- package/lib-commonjs/index.d.ts +0 -6
- package/lib-commonjs/isIntersectingModifier.d.ts +0 -4
- package/lib-commonjs/types.d.ts +0 -89
- package/lib-commonjs/usePopper.d.ts +0 -23
- package/lib-commonjs/usePopper.js.map +0 -1
- package/lib-commonjs/usePopperMouseTarget.d.ts +0 -11
- package/lib-commonjs/usePopperMouseTarget.js.map +0 -1
- package/lib-commonjs/utils/getBasePlacement.d.ts +0 -8
- package/lib-commonjs/utils/getBasePlacement.js +0 -19
- package/lib-commonjs/utils/getBasePlacement.js.map +0 -1
- package/lib-commonjs/utils/getBoundary.d.ts +0 -6
- package/lib-commonjs/utils/getReactFiberFromNode.d.ts +0 -108
- package/lib-commonjs/utils/getScrollParent.d.ts +0 -12
- package/lib-commonjs/utils/index.d.ts +0 -8
- package/lib-commonjs/utils/mergeArrowOffset.d.ts +0 -10
- package/lib-commonjs/utils/positioningHelper.d.ts +0 -7
- package/lib-commonjs/utils/resolvePositioningShorthand.d.ts +0 -2
- package/lib-commonjs/utils/useCallbackRef.d.ts +0 -19
@@ -1,108 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
declare type ReactEventResponder<E, C> = {
|
3
|
-
$$typeof: Symbol | number;
|
4
|
-
displayName: string;
|
5
|
-
targetEventTypes: null | string[];
|
6
|
-
rootEventTypes: null | string[];
|
7
|
-
getInitialState: null | ((props: Object) => Object);
|
8
|
-
onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);
|
9
|
-
onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);
|
10
|
-
onMount: null | ((context: C, props: Object, state: Object) => void);
|
11
|
-
onUnmount: null | ((context: C, props: Object, state: Object) => void);
|
12
|
-
};
|
13
|
-
declare type ReactEventResponderInstance<E, C> = {
|
14
|
-
fiber: Object;
|
15
|
-
props: Object;
|
16
|
-
responder: ReactEventResponder<E, C>;
|
17
|
-
rootEventTypes: null | Set<string>;
|
18
|
-
state: Object;
|
19
|
-
};
|
20
|
-
export declare type HookType = 'useState' | 'useReducer' | 'useContext' | 'useRef' | 'useEffect' | 'useLayoutEffect' | 'useCallback' | 'useMemo' | 'useImperativeHandle' | 'useDebugValue' | 'useResponder';
|
21
|
-
declare type ReactProviderType<T> = {
|
22
|
-
$$typeof: Symbol | number;
|
23
|
-
_context: ReactContext<T>;
|
24
|
-
};
|
25
|
-
declare type ReactContext<T> = {
|
26
|
-
$$typeof: Symbol | number;
|
27
|
-
Consumer: ReactContext<T>;
|
28
|
-
Provider: ReactProviderType<T>;
|
29
|
-
_calculateChangedBits: ((a: T, b: T) => number) | null;
|
30
|
-
_currentValue: T;
|
31
|
-
_currentValue2: T;
|
32
|
-
_threadCount: number;
|
33
|
-
_currentRenderer?: Object | null;
|
34
|
-
_currentRenderer2?: Object | null;
|
35
|
-
};
|
36
|
-
declare type ContextDependency<T> = {
|
37
|
-
context: ReactContext<T>;
|
38
|
-
observedBits: number;
|
39
|
-
next: ContextDependency<any> | null;
|
40
|
-
};
|
41
|
-
declare enum WorkTag {
|
42
|
-
FunctionComponent = 0,
|
43
|
-
ClassComponent = 1,
|
44
|
-
IndeterminateComponent = 2,
|
45
|
-
HostRoot = 3,
|
46
|
-
HostPortal = 4,
|
47
|
-
HostComponent = 5,
|
48
|
-
HostText = 6,
|
49
|
-
Fragment = 7,
|
50
|
-
Mode = 8,
|
51
|
-
ContextConsumer = 9,
|
52
|
-
ContextProvider = 10,
|
53
|
-
ForwardRef = 11,
|
54
|
-
Profiler = 12,
|
55
|
-
SuspenseComponent = 13,
|
56
|
-
MemoComponent = 14,
|
57
|
-
SimpleMemoComponent = 15,
|
58
|
-
LazyComponent = 16,
|
59
|
-
IncompleteClassComponent = 17,
|
60
|
-
DehydratedFragment = 18,
|
61
|
-
SuspenseListComponent = 19,
|
62
|
-
FundamentalComponent = 20,
|
63
|
-
ScopeComponent = 21
|
64
|
-
}
|
65
|
-
declare type Source = {
|
66
|
-
fileName: string;
|
67
|
-
lineNumber: number;
|
68
|
-
};
|
69
|
-
declare type ExpirationTime = number;
|
70
|
-
declare type Dependencies = {
|
71
|
-
expirationTime: ExpirationTime;
|
72
|
-
firstContext: ContextDependency<any> | null;
|
73
|
-
responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;
|
74
|
-
};
|
75
|
-
export declare type Fiber = {
|
76
|
-
tag: WorkTag;
|
77
|
-
key: null | string;
|
78
|
-
elementType: any;
|
79
|
-
type: any;
|
80
|
-
stateNode: any;
|
81
|
-
return: Fiber | null;
|
82
|
-
child: Fiber | null;
|
83
|
-
sibling: Fiber | null;
|
84
|
-
index: number;
|
85
|
-
ref: React.Ref<any>;
|
86
|
-
pendingProps: any;
|
87
|
-
memoizedProps: any;
|
88
|
-
memoizedState: any;
|
89
|
-
dependencies: Dependencies | null;
|
90
|
-
nextEffect: Fiber | null;
|
91
|
-
firstEffect: Fiber | null;
|
92
|
-
lastEffect: Fiber | null;
|
93
|
-
expirationTime: ExpirationTime;
|
94
|
-
childExpirationTime: ExpirationTime;
|
95
|
-
alternate: Fiber | null;
|
96
|
-
actualDuration?: number;
|
97
|
-
actualStartTime?: number;
|
98
|
-
selfBaseDuration?: number;
|
99
|
-
treeBaseDuration?: number;
|
100
|
-
_debugID?: number;
|
101
|
-
_debugSource?: Source | null;
|
102
|
-
_debugOwner?: Fiber | null;
|
103
|
-
_debugIsCurrentlyTiming?: boolean;
|
104
|
-
_debugNeedsRemount?: boolean;
|
105
|
-
_debugHookTypes?: HookType[] | null;
|
106
|
-
};
|
107
|
-
export declare function getReactFiberFromNode(elm: Node | undefined): Fiber | null;
|
108
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Returns the parent node or the host of the node argument.
|
3
|
-
* @param node - DOM node.
|
4
|
-
* @returns - parent DOM node.
|
5
|
-
*/
|
6
|
-
export declare const getParentNode: (node: HTMLElement) => HTMLElement;
|
7
|
-
/**
|
8
|
-
* Returns the first scrollable parent of the given element.
|
9
|
-
* @param node - DOM node.
|
10
|
-
* @returns - the first scrollable parent.
|
11
|
-
*/
|
12
|
-
export declare const getScrollParent: (node: Document | HTMLElement | null) => HTMLElement;
|
package/lib/utils/index.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
export * from './getBasePlacement';
|
2
|
-
export * from './getBoundary';
|
3
|
-
export * from './getReactFiberFromNode';
|
4
|
-
export * from './getScrollParent';
|
5
|
-
export * from './mergeArrowOffset';
|
6
|
-
export * from './positioningHelper';
|
7
|
-
export * from './resolvePositioningShorthand';
|
8
|
-
export * from './useCallbackRef';
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Offset } from '../types';
|
2
|
-
/**
|
3
|
-
* Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
|
4
|
-
* height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset
|
5
|
-
*
|
6
|
-
* @param userOffset - The offset provided by the user
|
7
|
-
* @param arrowHeight - The height of the arrow in px
|
8
|
-
* @returns User offset augmented with arrow height
|
9
|
-
*/
|
10
|
-
export declare function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
import type { Alignment, Offset, Position } from '../types';
|
3
|
-
/**
|
4
|
-
* @see positioninHelper.test.ts for expected placement values
|
5
|
-
*/
|
6
|
-
export declare const getPlacement: (align?: Alignment | undefined, position?: Position | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
|
-
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
/**
|
3
|
-
* Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content
|
4
|
-
* changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via
|
5
|
-
* React.useState(), but it will cause re-renders always.
|
6
|
-
*
|
7
|
-
* https://reactjs.org/docs/hooks-reference.html#useref
|
8
|
-
* https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
|
9
|
-
*
|
10
|
-
* @param initialValue - initial ref value
|
11
|
-
* @param callback - a callback to run when value changes
|
12
|
-
* @param skipInitialResolve - a flag to skip an initial ref report
|
13
|
-
*
|
14
|
-
* @example
|
15
|
-
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
16
|
-
* ref.current = 1;
|
17
|
-
* // prints 0 -> 1
|
18
|
-
*/
|
19
|
-
export declare function useCallbackRef<T>(initialValue: T | null, callback: (newValue: T | null, lastValue: T | null) => void, skipInitialResolve?: boolean): React.MutableRefObject<T | null>;
|
@@ -1,64 +0,0 @@
|
|
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
|
-
};
|
@@ -1,6 +0,0 @@
|
|
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;
|
package/lib-commonjs/index.d.ts
DELETED
package/lib-commonjs/types.d.ts
DELETED
@@ -1,89 +0,0 @@
|
|
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;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { PositioningProps } from './types';
|
3
|
-
interface UsePopperOptions extends PositioningProps {
|
4
|
-
/**
|
5
|
-
* If false, delays Popper's creation.
|
6
|
-
* @default true
|
7
|
-
*/
|
8
|
-
enabled?: boolean;
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* Exposes Popper positioning API via React hook. Contains few important differences between an official "react-popper"
|
12
|
-
* package:
|
13
|
-
* - style attributes are applied directly on DOM to avoid re-renders
|
14
|
-
* - refs changes and resolution is handled properly without re-renders
|
15
|
-
* - contains a specific to React fix related to initial positioning when containers have components with managed focus
|
16
|
-
* to avoid focus jumps
|
17
|
-
*/
|
18
|
-
export declare function usePopper(options?: UsePopperOptions): {
|
19
|
-
targetRef: React.MutableRefObject<any>;
|
20
|
-
containerRef: React.MutableRefObject<any>;
|
21
|
-
arrowRef: React.MutableRefObject<any>;
|
22
|
-
};
|
23
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["usePopper.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,QAAA,gBAAA,OAAA,CA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AAA,KAAA,CAAV,GAAU,KAAA,CAAV,GAAA,UAAU,CAAE,QAAZ,EAAP,EAA+B;AAC7B,gBAAM,IAAI,GAAG,UAAU,CAAC,WAAxB,CAD6B,CAE7B;;AACA,UAAA,OAAO,CAAC,IAAR,CAAa,WAAb,EAA0B,IAA1B,EAH6B,CAI7B;;AACA,UAAA,OAAO,CAAC,IAAR,CACE,CACE,gGADF,EAEE,qGAFF,EAGE,2EAHF,EAIE,uEAJF,EAKE,IALF,EAME,yFANF,EAOE,oGAPF,EAQE,kGARF,EASE,WATF,EAUE,4FAVF,EAWE,6FAXF,EAYE,IAZF,EAaE,2FAbF,EAcE,2CAdF,EAeE,8EAfF,EAgBE,IAhBF,CAgBO,GAhBP,CADF;AAmBD;AACF,OAhCkB,CAiCnB;AACA;AACA;;AACD,KApCD,EAoCG,EApCH;AAqCD;;AAED,SAAO;AAAE,IAAA,SAAF;AAAa,IAAA,YAAb;AAA2B,IAAA;AAA3B,GAAP;AACD;;AAxLD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["import { useEventCallback, useIsomorphicLayoutEffect, useFirstMount, canUseDOM } from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport * as PopperJs from '@popperjs/core';\nimport * as React from 'react';\n\nimport { isIntersectingModifier } from './isIntersectingModifier';\nimport {\n getScrollParent,\n applyRtlToOffset,\n getPlacement,\n getReactFiberFromNode,\n getBoundary,\n useCallbackRef,\n getBasePlacement,\n} from './utils/index';\nimport type { PopperVirtualElement, PopperOptions, PositioningProps } from './types';\n\ntype PopperInstance = PopperJs.Instance & { isFirstRun?: boolean };\n\ninterface UsePopperOptions extends PositioningProps {\n /**\n * If false, delays Popper's creation.\n * @default true\n */\n enabled?: boolean;\n}\n\n//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nfunction hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n\n/**\n * Provides a callback to resolve Popper options, it's stable and should be used as a dependency to trigger updates\n * of Popper options.\n *\n * A callback is used there intentionally as some of Popper.js modifiers require DOM nodes (targer, container, arrow)\n * that can't be resolved properly during an initial rendering.\n */\nfunction usePopperOptions(options: PopperOptions, popperOriginalPositionRef: React.MutableRefObject<string>) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionFixed,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n } = options;\n\n const isRtl = useFluent().dir === 'rtl';\n const placement = getPlacement(align, position, isRtl);\n const strategy = positionFixed ? 'fixed' : 'absolute';\n\n const offsetModifier = React.useMemo(\n () =>\n offset\n ? {\n name: 'offset',\n options: { offset: isRtl ? applyRtlToOffset(offset) : offset },\n }\n : null,\n [offset, isRtl],\n );\n\n return React.useCallback(\n (\n target: HTMLElement | PopperJs.VirtualElement | null,\n container: HTMLElement | null,\n arrow: HTMLElement | null,\n ): PopperJs.Options => {\n const scrollParentElement: HTMLElement = getScrollParent(container);\n const hasScrollableElement = scrollParentElement\n ? scrollParentElement !== scrollParentElement.ownerDocument?.body\n : false;\n\n const modifiers: PopperJs.Options['modifiers'] = [\n isIntersectingModifier,\n\n /**\n * We are setting the position to `fixed` in the first effect to prevent scroll jumps in case of the content\n * with managed focus. Modifier sets the position to `fixed` before all other modifier effects. Another part of\n * a patch modifies \".forceUpdate()\" directly after a Popper will be created.\n */\n {\n name: 'positionStyleFix',\n enabled: true,\n phase: 'afterWrite' as PopperJs.ModifierPhases,\n effect: ({ state, instance }: { state: PopperJs.State; instance: PopperInstance }) => {\n // \".isFirstRun\" is a part of our patch, on a first evaluation it will \"undefined\"\n // should be disabled for subsequent runs as it breaks positioning for them\n if (instance.isFirstRun !== false) {\n popperOriginalPositionRef.current = state.elements.popper.style.position;\n state.elements.popper.style.position = 'fixed';\n }\n\n return () => undefined;\n },\n requires: [],\n },\n\n { name: 'flip', options: { flipVariations: true } },\n\n /**\n * pinned disables the flip modifier by setting flip.enabled to false; this\n * disables automatic repositioning of the popper box; it will always be placed according to\n * the values of `align` and `position` props, regardless of the size of the component, the\n * reference element or the viewport.\n */\n pinned && { name: 'flip', enabled: false },\n\n /**\n * When the popper box is placed in the context of a scrollable element, we need to set\n * preventOverflow.escapeWithReference to true and flip.boundariesElement to 'scrollParent'\n * (default is 'viewport') so that the popper box will stick with the targetRef when we\n * scroll targetRef out of the viewport.\n */\n hasScrollableElement && { name: 'flip', options: { boundary: 'clippingParents' } },\n hasScrollableElement && { name: 'preventOverflow', options: { boundary: 'clippingParents' } },\n\n offsetModifier,\n\n /**\n * This modifier is necessary to retain behaviour from popper v1 where untethered poppers are allowed by\n * default. i.e. popper is still rendered fully in the viewport even if anchor element is no longer in the\n * viewport.\n */\n unstable_disableTether && {\n name: 'preventOverflow',\n options: { altAxis: unstable_disableTether === 'all', tether: false },\n },\n\n flipBoundary && {\n name: 'flip',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, flipBoundary),\n },\n },\n overflowBoundary && {\n name: 'preventOverflow',\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n },\n\n {\n // Similar code as popper-maxsize-modifier: https://github.com/atomiks/popper.js/blob/master/src/modifiers/maxSize.js\n // popper-maxsize-modifier only calculates the max sizes.\n // This modifier can apply max sizes always, or apply the max sizes only when overflow is detected\n name: 'applyMaxSize',\n enabled: !!autoSize,\n phase: 'beforeWrite' as PopperJs.ModifierPhases,\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n options: {\n altBoundary: true,\n boundary: getBoundary(container, overflowBoundary),\n },\n fn({ state, options: modifierOptions }: PopperJs.ModifierArguments<{}>) {\n const overflow = PopperJs.detectOverflow(state, modifierOptions);\n const { x, y } = state.modifiersData.preventOverflow || { x: 0, y: 0 };\n const { width, height } = state.rects.popper;\n const basePlacement = getBasePlacement(state.placement);\n\n const widthProp: keyof PopperJs.SideObject = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: keyof PopperJs.SideObject = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n state.styles.popper.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n state.styles.popper.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n },\n },\n\n /**\n * This modifier is necessary in order to render the pointer. Refs are resolved in effects, so it can't be\n * placed under computed modifiers. Deep merge is not required as this modifier has only these properties.\n */\n {\n name: 'arrow',\n enabled: !!arrow,\n options: { element: arrow, padding: arrowPadding },\n },\n\n /**\n * Modifies popper offsets to cover the reference rect, but still keep edge alignment\n */\n {\n name: 'coverTarget',\n enabled: !!coverTarget,\n phase: 'main',\n requiresIfExists: ['offset', 'preventOverflow', 'flip'],\n fn({ state }: PopperJs.ModifierArguments<{}>) {\n const basePlacement = getBasePlacement(state.placement);\n switch (basePlacement) {\n case 'bottom':\n state.modifiersData.popperOffsets!.y -= state.rects.reference.height;\n break;\n case 'top':\n state.modifiersData.popperOffsets!.y += state.rects.reference.height;\n break;\n case 'left':\n state.modifiersData.popperOffsets!.x += state.rects.reference.width;\n break;\n case 'right':\n state.modifiersData.popperOffsets!.x -= state.rects.reference.width;\n break;\n }\n },\n },\n ].filter(Boolean) as PopperJs.Options['modifiers']; // filter boolean conditional spreading values\n\n const popperOptions: PopperJs.Options = {\n modifiers,\n\n placement,\n strategy,\n };\n\n return popperOptions;\n },\n [\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offsetModifier,\n overflowBoundary,\n placement,\n strategy,\n unstable_disableTether,\n pinned,\n\n // These can be skipped from deps as they will not ever change\n popperOriginalPositionRef,\n ],\n );\n}\n\n/**\n * Exposes Popper positioning API via React hook. Contains few important differences between an official \"react-popper\"\n * package:\n * - style attributes are applied directly on DOM to avoid re-renders\n * - refs changes and resolution is handled properly without re-renders\n * - contains a specific to React fix related to initial positioning when containers have components with managed focus\n * to avoid focus jumps\n */\nexport function usePopper(\n options: UsePopperOptions = {},\n): {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n} {\n const { enabled = true } = options;\n const isFirstMount = useFirstMount();\n\n const popperOriginalPositionRef = React.useRef<string>('absolute');\n const resolvePopperOptions = usePopperOptions(options, popperOriginalPositionRef);\n\n const popperInstanceRef = React.useRef<PopperInstance | null>(null);\n\n const handlePopperUpdate = useEventCallback(() => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n let popperInstance: PopperInstance | null = null;\n\n if (canUseDOM() && enabled) {\n if (target && containerRef.current) {\n popperInstance = PopperJs.createPopper(\n target,\n containerRef.current,\n resolvePopperOptions(target, containerRef.current, arrowRef.current),\n );\n }\n }\n\n if (popperInstance) {\n /**\n * The patch updates `.forceUpdate()` Popper function which restores the original position before the first\n * forceUpdate() call. See also \"positionStyleFix\" modifier in usePopperOptions().\n */\n const originalForceUpdate = popperInstance.forceUpdate;\n\n popperInstance.isFirstRun = true;\n popperInstance.forceUpdate = () => {\n if (popperInstance?.isFirstRun) {\n popperInstance.state.elements.popper.style.position = popperOriginalPositionRef.current;\n popperInstance.isFirstRun = false;\n }\n\n originalForceUpdate();\n };\n }\n\n popperInstanceRef.current = popperInstance;\n });\n\n // Refs are managed by useCallbackRef() to handle ref updates scenarios.\n //\n // The first scenario are updates for a targetRef, we can handle it properly only via callback refs, but it causes\n // re-renders (we would like to avoid them).\n //\n // The second problem is related to refs resolution on React's layer: refs are resolved in the same order as effects\n // that causes an issue when you have a container inside a target, for example: a menu in ChatMessage.\n //\n // function ChatMessage(props) {\n // <div className=\"message\" ref={targetRef}> // 3) ref will be resolved only now, but it's too late already\n // <Popper target={targetRef}> // 2) create a popper instance\n // <div className=\"menu\" /> // 1) capture ref from this element\n // </Popper>\n // </div>\n // }\n //\n // Check a demo on CodeSandbox: https://codesandbox.io/s/popper-refs-emy60.\n //\n // This again can be solved with callback refs. It's not a huge issue as with hooks we are moving popper's creation\n // to ChatMessage itself, however, without `useCallback()` refs it's still a Pandora box.\n const targetRef = useCallbackRef<HTMLElement | PopperJs.VirtualElement | null>(null, handlePopperUpdate, true);\n const containerRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n const arrowRef = useCallbackRef<HTMLElement | null>(null, handlePopperUpdate, true);\n\n // Stores external target from options.target or setTarget\n const overrideTargetRef = useCallbackRef<HTMLElement | PopperVirtualElement | null>(null, handlePopperUpdate, true);\n\n React.useImperativeHandle(\n options.popperRef,\n () => ({\n updatePosition: () => {\n popperInstanceRef.current?.update();\n },\n setTarget: (target: HTMLElement | PopperVirtualElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n overrideTargetRef.current = target;\n },\n }),\n // Missing deps:\n // options.target - only used for a runtime warning\n // targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n useIsomorphicLayoutEffect(() => {\n if (options.target) {\n overrideTargetRef.current = options.target;\n }\n }, [options.target, overrideTargetRef]);\n useIsomorphicLayoutEffect(() => {\n handlePopperUpdate();\n\n return () => {\n popperInstanceRef.current?.destroy();\n popperInstanceRef.current = null;\n };\n }, [handlePopperUpdate, options.enabled]);\n useIsomorphicLayoutEffect(\n () => {\n if (!isFirstMount) {\n popperInstanceRef.current?.setOptions(\n resolvePopperOptions(overrideTargetRef.current ?? targetRef.current, containerRef.current, arrowRef.current),\n );\n }\n },\n // Missing deps:\n // isFirstMount - Should never change after mount\n // arrowRef, containerRef, targetRef - Stable between renders\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [resolvePopperOptions],\n );\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker?.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n return { targetRef, containerRef, arrowRef };\n}\n"],"sourceRoot":"../src/"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import * as PopperJs from '@popperjs/core';
|
3
|
-
/**
|
4
|
-
* A state hook that manages a popper virtual element from mouseevents.
|
5
|
-
* Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)
|
6
|
-
* React synthetic events are not persisted by this hook
|
7
|
-
*
|
8
|
-
* @param initialState - initializes a user provided state similare to useState
|
9
|
-
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
10
|
-
*/
|
11
|
-
export declare const usePopperMouseTarget: (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement) | undefined) => readonly [PopperJs.VirtualElement | undefined, (event: React.MouseEvent | MouseEvent | undefined | null) => void];
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["usePopperMouseTarget.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,+BAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;AAGA;;;;;;;AAOG;;;AACI,MAAM,oBAAoB,GAAI,YAAD,IAA6E;AAC/G,QAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAoD,YAApD,CAA5C;;AAEA,QAAM,qBAAqB,GAAI,KAAD,IAA4D;AACxF,QAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;AACzC,MAAA,iBAAiB,CAAC,SAAD,CAAjB;AACA;AACD;;AAED,QAAI,UAAJ;;AACA,QAAI,EAAE,KAAK,YAAY,UAAnB,CAAJ,EAAoC;AAClC,MAAA,UAAU,GAAG,KAAK,CAAC,WAAnB;AACD,KAFD,MAEO;AACL,MAAA,UAAU,GAAG,KAAb;AACD;;AAED,QAAI,EAAE,UAAU,YAAY,UAAxB,KAAuC,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAApE,EAAkF;AAChF;AACA,MAAA,OAAO,CAAC,KAAR,CAAc,0DAAd;AACD;;AAED,UAAM,aAAa,GAAG,+BAAA,CAAA,6BAAA,CAA8B,UAA9B,CAAtB;AACA,IAAA,iBAAiB,CAAC,aAAD,CAAjB;AACD,GApBD;;AAsBA,SAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA1BM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport * as PopperJs from '@popperjs/core';\n\n/**\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePopperMouseTarget = (initialState?: PopperJs.VirtualElement | (() => PopperJs.VirtualElement)) => {\n const [virtualElement, setVirtualElement] = React.useState<PopperJs.VirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePopperMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
/**
|
3
|
-
* Returns the base placement value
|
4
|
-
* @param placement - the popper placement (i.e. bottom-start)
|
5
|
-
*
|
6
|
-
* @returns bottom-start -> bottom
|
7
|
-
*/
|
8
|
-
export declare function getBasePlacement(placement: PopperJs.Placement): PopperJs.BasePlacement;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getBasePlacement = void 0;
|
7
|
-
/**
|
8
|
-
* Returns the base placement value
|
9
|
-
* @param placement - the popper placement (i.e. bottom-start)
|
10
|
-
*
|
11
|
-
* @returns bottom-start -> bottom
|
12
|
-
*/
|
13
|
-
|
14
|
-
function getBasePlacement(placement) {
|
15
|
-
return placement.split('-')[0];
|
16
|
-
}
|
17
|
-
|
18
|
-
exports.getBasePlacement = getBasePlacement;
|
19
|
-
//# sourceMappingURL=getBasePlacement.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["utils/getBasePlacement.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;AAKG;;AACH,SAAgB,gBAAhB,CAAiC,SAAjC,EAA8D;AAC5D,SAAO,SAAS,CAAC,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAP;AACD;;AAFD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import * as PopperJs from '@popperjs/core';\n\n/**\n * Returns the base placement value\n * @param placement - the popper placement (i.e. bottom-start)\n *\n * @returns bottom-start -> bottom\n */\nexport function getBasePlacement(placement: PopperJs.Placement): PopperJs.BasePlacement {\n return placement.split('-')[0] as PopperJs.BasePlacement;\n}\n"],"sourceRoot":"../src/"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import * as PopperJs from '@popperjs/core';
|
2
|
-
import type { Boundary } from '../types';
|
3
|
-
/**
|
4
|
-
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
5
|
-
*/
|
6
|
-
export declare function getBoundary(element: HTMLElement | null, boundary?: Boundary): PopperJs.Boundary | undefined;
|
@@ -1,108 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
declare type ReactEventResponder<E, C> = {
|
3
|
-
$$typeof: Symbol | number;
|
4
|
-
displayName: string;
|
5
|
-
targetEventTypes: null | string[];
|
6
|
-
rootEventTypes: null | string[];
|
7
|
-
getInitialState: null | ((props: Object) => Object);
|
8
|
-
onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);
|
9
|
-
onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);
|
10
|
-
onMount: null | ((context: C, props: Object, state: Object) => void);
|
11
|
-
onUnmount: null | ((context: C, props: Object, state: Object) => void);
|
12
|
-
};
|
13
|
-
declare type ReactEventResponderInstance<E, C> = {
|
14
|
-
fiber: Object;
|
15
|
-
props: Object;
|
16
|
-
responder: ReactEventResponder<E, C>;
|
17
|
-
rootEventTypes: null | Set<string>;
|
18
|
-
state: Object;
|
19
|
-
};
|
20
|
-
export declare type HookType = 'useState' | 'useReducer' | 'useContext' | 'useRef' | 'useEffect' | 'useLayoutEffect' | 'useCallback' | 'useMemo' | 'useImperativeHandle' | 'useDebugValue' | 'useResponder';
|
21
|
-
declare type ReactProviderType<T> = {
|
22
|
-
$$typeof: Symbol | number;
|
23
|
-
_context: ReactContext<T>;
|
24
|
-
};
|
25
|
-
declare type ReactContext<T> = {
|
26
|
-
$$typeof: Symbol | number;
|
27
|
-
Consumer: ReactContext<T>;
|
28
|
-
Provider: ReactProviderType<T>;
|
29
|
-
_calculateChangedBits: ((a: T, b: T) => number) | null;
|
30
|
-
_currentValue: T;
|
31
|
-
_currentValue2: T;
|
32
|
-
_threadCount: number;
|
33
|
-
_currentRenderer?: Object | null;
|
34
|
-
_currentRenderer2?: Object | null;
|
35
|
-
};
|
36
|
-
declare type ContextDependency<T> = {
|
37
|
-
context: ReactContext<T>;
|
38
|
-
observedBits: number;
|
39
|
-
next: ContextDependency<any> | null;
|
40
|
-
};
|
41
|
-
declare enum WorkTag {
|
42
|
-
FunctionComponent = 0,
|
43
|
-
ClassComponent = 1,
|
44
|
-
IndeterminateComponent = 2,
|
45
|
-
HostRoot = 3,
|
46
|
-
HostPortal = 4,
|
47
|
-
HostComponent = 5,
|
48
|
-
HostText = 6,
|
49
|
-
Fragment = 7,
|
50
|
-
Mode = 8,
|
51
|
-
ContextConsumer = 9,
|
52
|
-
ContextProvider = 10,
|
53
|
-
ForwardRef = 11,
|
54
|
-
Profiler = 12,
|
55
|
-
SuspenseComponent = 13,
|
56
|
-
MemoComponent = 14,
|
57
|
-
SimpleMemoComponent = 15,
|
58
|
-
LazyComponent = 16,
|
59
|
-
IncompleteClassComponent = 17,
|
60
|
-
DehydratedFragment = 18,
|
61
|
-
SuspenseListComponent = 19,
|
62
|
-
FundamentalComponent = 20,
|
63
|
-
ScopeComponent = 21
|
64
|
-
}
|
65
|
-
declare type Source = {
|
66
|
-
fileName: string;
|
67
|
-
lineNumber: number;
|
68
|
-
};
|
69
|
-
declare type ExpirationTime = number;
|
70
|
-
declare type Dependencies = {
|
71
|
-
expirationTime: ExpirationTime;
|
72
|
-
firstContext: ContextDependency<any> | null;
|
73
|
-
responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;
|
74
|
-
};
|
75
|
-
export declare type Fiber = {
|
76
|
-
tag: WorkTag;
|
77
|
-
key: null | string;
|
78
|
-
elementType: any;
|
79
|
-
type: any;
|
80
|
-
stateNode: any;
|
81
|
-
return: Fiber | null;
|
82
|
-
child: Fiber | null;
|
83
|
-
sibling: Fiber | null;
|
84
|
-
index: number;
|
85
|
-
ref: React.Ref<any>;
|
86
|
-
pendingProps: any;
|
87
|
-
memoizedProps: any;
|
88
|
-
memoizedState: any;
|
89
|
-
dependencies: Dependencies | null;
|
90
|
-
nextEffect: Fiber | null;
|
91
|
-
firstEffect: Fiber | null;
|
92
|
-
lastEffect: Fiber | null;
|
93
|
-
expirationTime: ExpirationTime;
|
94
|
-
childExpirationTime: ExpirationTime;
|
95
|
-
alternate: Fiber | null;
|
96
|
-
actualDuration?: number;
|
97
|
-
actualStartTime?: number;
|
98
|
-
selfBaseDuration?: number;
|
99
|
-
treeBaseDuration?: number;
|
100
|
-
_debugID?: number;
|
101
|
-
_debugSource?: Source | null;
|
102
|
-
_debugOwner?: Fiber | null;
|
103
|
-
_debugIsCurrentlyTiming?: boolean;
|
104
|
-
_debugNeedsRemount?: boolean;
|
105
|
-
_debugHookTypes?: HookType[] | null;
|
106
|
-
};
|
107
|
-
export declare function getReactFiberFromNode(elm: Node | undefined): Fiber | null;
|
108
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Returns the parent node or the host of the node argument.
|
3
|
-
* @param node - DOM node.
|
4
|
-
* @returns - parent DOM node.
|
5
|
-
*/
|
6
|
-
export declare const getParentNode: (node: HTMLElement) => HTMLElement;
|
7
|
-
/**
|
8
|
-
* Returns the first scrollable parent of the given element.
|
9
|
-
* @param node - DOM node.
|
10
|
-
* @returns - the first scrollable parent.
|
11
|
-
*/
|
12
|
-
export declare const getScrollParent: (node: Document | HTMLElement | null) => HTMLElement;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export * from './getBasePlacement';
|
2
|
-
export * from './getBoundary';
|
3
|
-
export * from './getReactFiberFromNode';
|
4
|
-
export * from './getScrollParent';
|
5
|
-
export * from './mergeArrowOffset';
|
6
|
-
export * from './positioningHelper';
|
7
|
-
export * from './resolvePositioningShorthand';
|
8
|
-
export * from './useCallbackRef';
|