@fluentui/react-positioning 0.0.0-nightlyfc5cfdc52420220215.1 → 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +376 -10
- package/CHANGELOG.md +200 -75
- package/dist/{react-positioning.d.ts → 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 +26 -0
- package/lib/isIntersectingModifier.js.map +1 -0
- package/lib/types.js.map +1 -1
- package/lib/{usePopper.js → usePositioning.js} +12 -9
- 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 +34 -0
- package/lib-commonjs/isIntersectingModifier.js.map +1 -0
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/{usePopper.js → usePositioning.js} +16 -11
- 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 +16 -14
- package/lib/createArrowStyles.d.ts +0 -64
- package/lib/createVirtualElementFromClick.d.ts +0 -6
- package/lib/index.d.ts +0 -6
- 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/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,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';
|
@@ -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>;
|