@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.
Files changed (101) hide show
  1. package/CHANGELOG.json +376 -10
  2. package/CHANGELOG.md +200 -75
  3. package/dist/{react-positioning.d.ts → index.d.ts} +78 -46
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/createArrowStyles.js +3 -1
  6. package/lib/createArrowStyles.js.map +1 -1
  7. package/lib/createVirtualElementFromClick.js +2 -0
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/index.js +4 -5
  10. package/lib/index.js.map +1 -1
  11. package/lib/isIntersectingModifier.js +26 -0
  12. package/lib/isIntersectingModifier.js.map +1 -0
  13. package/lib/types.js.map +1 -1
  14. package/lib/{usePopper.js → usePositioning.js} +12 -9
  15. package/lib/usePositioning.js.map +1 -0
  16. package/lib/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +4 -3
  17. package/lib/usePositioningMouseTarget.js.map +1 -0
  18. package/lib/utils/fromPopperPlacement.js +40 -0
  19. package/lib/utils/fromPopperPlacement.js.map +1 -0
  20. package/lib/utils/getBoundary.js.map +1 -1
  21. package/lib/utils/getPopperOffset.js +44 -0
  22. package/lib/utils/getPopperOffset.js.map +1 -0
  23. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  24. package/lib/utils/getScrollParent.js.map +1 -1
  25. package/lib/utils/index.js +1 -1
  26. package/lib/utils/index.js.map +1 -1
  27. package/lib/utils/mergeArrowOffset.js +24 -22
  28. package/lib/utils/mergeArrowOffset.js.map +1 -1
  29. package/lib/utils/parsePopperPlacement.js +14 -0
  30. package/lib/utils/parsePopperPlacement.js.map +1 -0
  31. package/lib/utils/positioningHelper.js.map +1 -1
  32. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  33. package/lib/utils/useCallbackRef.js.map +1 -1
  34. package/lib-commonjs/createArrowStyles.js +3 -1
  35. package/lib-commonjs/createArrowStyles.js.map +1 -1
  36. package/lib-commonjs/createVirtualElementFromClick.js +2 -0
  37. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  38. package/lib-commonjs/index.js +38 -8
  39. package/lib-commonjs/index.js.map +1 -1
  40. package/lib-commonjs/isIntersectingModifier.js +34 -0
  41. package/lib-commonjs/isIntersectingModifier.js.map +1 -0
  42. package/lib-commonjs/types.js.map +1 -1
  43. package/lib-commonjs/{usePopper.js → usePositioning.js} +16 -11
  44. package/lib-commonjs/usePositioning.js.map +1 -0
  45. package/lib-commonjs/{usePopperMouseTarget.js → usePositioningMouseTarget.js} +6 -5
  46. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -0
  47. package/lib-commonjs/utils/fromPopperPlacement.js +50 -0
  48. package/lib-commonjs/utils/fromPopperPlacement.js.map +1 -0
  49. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  50. package/lib-commonjs/utils/getPopperOffset.js +54 -0
  51. package/lib-commonjs/utils/getPopperOffset.js.map +1 -0
  52. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  53. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  54. package/lib-commonjs/utils/index.js +2 -2
  55. package/lib-commonjs/utils/index.js.map +1 -1
  56. package/lib-commonjs/utils/mergeArrowOffset.js +24 -22
  57. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  58. package/lib-commonjs/utils/parsePopperPlacement.js +23 -0
  59. package/lib-commonjs/utils/parsePopperPlacement.js.map +1 -0
  60. package/lib-commonjs/utils/positioningHelper.js.map +1 -1
  61. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  62. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  63. package/package.json +16 -14
  64. package/lib/createArrowStyles.d.ts +0 -64
  65. package/lib/createVirtualElementFromClick.d.ts +0 -6
  66. package/lib/index.d.ts +0 -6
  67. package/lib/types.d.ts +0 -89
  68. package/lib/usePopper.d.ts +0 -23
  69. package/lib/usePopper.js.map +0 -1
  70. package/lib/usePopperMouseTarget.d.ts +0 -11
  71. package/lib/usePopperMouseTarget.js.map +0 -1
  72. package/lib/utils/getBasePlacement.d.ts +0 -8
  73. package/lib/utils/getBasePlacement.js +0 -10
  74. package/lib/utils/getBasePlacement.js.map +0 -1
  75. package/lib/utils/getBoundary.d.ts +0 -6
  76. package/lib/utils/getReactFiberFromNode.d.ts +0 -108
  77. package/lib/utils/getScrollParent.d.ts +0 -12
  78. package/lib/utils/index.d.ts +0 -8
  79. package/lib/utils/mergeArrowOffset.d.ts +0 -10
  80. package/lib/utils/positioningHelper.d.ts +0 -7
  81. package/lib/utils/resolvePositioningShorthand.d.ts +0 -2
  82. package/lib/utils/useCallbackRef.d.ts +0 -19
  83. package/lib-commonjs/createArrowStyles.d.ts +0 -64
  84. package/lib-commonjs/createVirtualElementFromClick.d.ts +0 -6
  85. package/lib-commonjs/index.d.ts +0 -6
  86. package/lib-commonjs/types.d.ts +0 -89
  87. package/lib-commonjs/usePopper.d.ts +0 -23
  88. package/lib-commonjs/usePopper.js.map +0 -1
  89. package/lib-commonjs/usePopperMouseTarget.d.ts +0 -11
  90. package/lib-commonjs/usePopperMouseTarget.js.map +0 -1
  91. package/lib-commonjs/utils/getBasePlacement.d.ts +0 -8
  92. package/lib-commonjs/utils/getBasePlacement.js +0 -19
  93. package/lib-commonjs/utils/getBasePlacement.js.map +0 -1
  94. package/lib-commonjs/utils/getBoundary.d.ts +0 -6
  95. package/lib-commonjs/utils/getReactFiberFromNode.d.ts +0 -108
  96. package/lib-commonjs/utils/getScrollParent.d.ts +0 -12
  97. package/lib-commonjs/utils/index.d.ts +0 -8
  98. package/lib-commonjs/utils/mergeArrowOffset.d.ts +0 -10
  99. package/lib-commonjs/utils/positioningHelper.d.ts +0 -7
  100. package/lib-commonjs/utils/resolvePositioningShorthand.d.ts +0 -2
  101. 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,2 +0,0 @@
1
- import type { PositioningShorthand, PositioningProps } from '../types';
2
- export declare function resolvePositioningShorthand(shorthand: PositioningShorthand | undefined | null): Readonly<PositioningProps>;
@@ -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>;