Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
0b3d545
init
ling1726 Feb 17, 2022
707a4a1
final touches
ling1726 Feb 22, 2022
36904c7
Change files
ling1726 Feb 22, 2022
4bd223f
Merge branch 'master' into chore/floating-ui
ling1726 Feb 22, 2022
9738d0c
support imperative handle
ling1726 Feb 22, 2022
ccfbfd5
Merge branch 'master' into chore/floating-ui
ling1726 Feb 23, 2022
8ca61b2
debounce
ling1726 Feb 24, 2022
005166f
changes
ling1726 Feb 25, 2022
fb1c088
finally understood scroll jumping fix
ling1726 Feb 25, 2022
cfe0909
disableTether and positionFixed
ling1726 Feb 26, 2022
5196d59
gpu accel
ling1726 Feb 26, 2022
02b0f8c
remove firstUpdate concept
ling1726 Feb 26, 2022
1eec43e
change doc
ling1726 Feb 26, 2022
7e89d6f
merge master
ling1726 Feb 26, 2022
f5cb3c1
merge master
ling1726 Mar 1, 2022
9775df4
hide middleware and intersection observer
ling1726 Mar 1, 2022
7bb4808
remove old middleware
ling1726 Mar 1, 2022
4b34449
remove popper from deps
ling1726 Mar 1, 2022
636b23c
cleanup event listeners
ling1726 Mar 1, 2022
add88c4
update md
ling1726 Mar 1, 2022
d793aab
cleanup
ling1726 Mar 1, 2022
212326f
cleanup
ling1726 Mar 1, 2022
f178729
add autofocus warning
ling1726 Mar 1, 2022
b4f21e9
fix tests
ling1726 Mar 1, 2022
a6f909d
fix lint
ling1726 Mar 1, 2022
2a6c646
fix typing
ling1726 Mar 1, 2022
11ea988
Merge remote-tracking branch 'origin/master' into chore/floating-ui
ling1726 Mar 1, 2022
6d3bbd2
fix types
ling1726 Mar 1, 2022
d44bc44
bump to latest prerelease
ling1726 Mar 2, 2022
1957163
use custom offset middleware
ling1726 Mar 2, 2022
15e84d8
cleanup
ling1726 Mar 2, 2022
999261f
add comment
ling1726 Mar 2, 2022
6b12cca
unnecessary export
ling1726 Mar 2, 2022
4249318
cleanup
ling1726 Mar 2, 2022
f15c862
remove unnecessary middleware wrapper
ling1726 Mar 2, 2022
3393023
import middleware correctly
ling1726 Mar 2, 2022
566c787
fix rtl placement
ling1726 Mar 2, 2022
f4142fc
rtl independent placement
ling1726 Mar 2, 2022
593cd9e
alignment rtl handled by floating ui
ling1726 Mar 2, 2022
050ea14
use hide middleware twice
ling1726 Mar 2, 2022
be6a273
use only @floating-ui/dom
ling1726 Mar 3, 2022
4b89ff5
merge master
ling1726 Mar 7, 2022
4541dd0
dedupe lock
ling1726 Mar 7, 2022
7a891e2
fix typos
ling1726 Mar 7, 2022
19da8b2
mergeArrowOffset
ling1726 Mar 7, 2022
86bd0ef
rename getBasePlacement to getSide
ling1726 Mar 7, 2022
574556e
docs for debounce
ling1726 Mar 7, 2022
4eefe8e
rename toggleScrollListener
ling1726 Mar 7, 2022
44f1bd6
rename constants
ling1726 Mar 7, 2022
0c26ea5
nit
ling1726 Mar 7, 2022
a545823
update shift middleware
ling1726 Mar 7, 2022
1db7e04
rename middleware to base*
ling1726 Mar 7, 2022
c44a724
rename to intersecting middleware
ling1726 Mar 7, 2022
865a07e
remove middleawre spreading
ling1726 Mar 7, 2022
39fe5f6
fix typo
ling1726 Mar 7, 2022
0f789cd
update change files
ling1726 Mar 7, 2022
7ccb4a6
refactor docs to use new offset values
ling1726 Mar 7, 2022
7560f97
import type
ling1726 Mar 7, 2022
7943657
import type
ling1726 Mar 7, 2022
81e678f
PopperVirtualElement to PositioningVirtualElement
ling1726 Mar 7, 2022
b55f428
fix positioning helper tests
ling1726 Mar 7, 2022
462d537
Popper to Floating UI
ling1726 Mar 7, 2022
162ff51
simplify effects
ling1726 Mar 7, 2022
5ef2430
remove unsed useIsFirstMount
ling1726 Mar 7, 2022
f59159d
improve middleware types
ling1726 Mar 7, 2022
d60fda3
debounce as named export
ling1726 Mar 7, 2022
6388ba6
add position fixed comment
ling1726 Mar 7, 2022
6cb837a
local functions for assignments
ling1726 Mar 7, 2022
bfc3076
hasScrollParent util
ling1726 Mar 7, 2022
6b178c8
Merge branch 'master' into chore/floating-ui
ling1726 Mar 11, 2022
68ec50c
bump, remove custom offset middleware
ling1726 Mar 11, 2022
aef9ff8
create separate ref hooks for elements
ling1726 Mar 11, 2022
08c7f3d
fix useFirstMount tests
ling1726 Mar 11, 2022
13d0e10
Change files
ling1726 Mar 11, 2022
5bd005e
Merge remote-tracking branch 'origin/master' into chore/floating-ui
ling1726 Mar 14, 2022
db1de63
add extra data- attribute
ling1726 Mar 14, 2022
4c5d39d
pr issues
ling1726 Mar 14, 2022
1e178b2
add comment
ling1726 Mar 14, 2022
199597c
move usePopper to top
ling1726 Mar 14, 2022
77386bd
update md
ling1726 Mar 14, 2022
604471b
update API
ling1726 Mar 14, 2022
9d4ceeb
fix tests
ling1726 Mar 17, 2022
8e25099
copy types to retain TS minbar
ling1726 Mar 17, 2022
fffea0b
Merge branch 'master' into chore/floating-ui
ling1726 Mar 30, 2022
e33610f
patch floating ui for minbar test
ling1726 Mar 30, 2022
661689d
remove type layer
ling1726 Mar 30, 2022
dbcbf8f
Merge branch 'master' into chore/floating-ui
ling1726 Mar 30, 2022
03b40a2
update md
ling1726 Mar 30, 2022
7b770a1
Merge branch 'master' into chore/floating-ui
ling1726 Apr 7, 2022
f277cf5
remove first mount update
ling1726 Apr 8, 2022
4f15da7
remove unnecessary changefile
ling1726 Apr 8, 2022
d10771f
Merge branch 'master' into chore/floating-ui
ling1726 Apr 8, 2022
a6e32ef
use window from context
ling1726 Apr 8, 2022
ef658f4
remove jsdoc
ling1726 Apr 8, 2022
4fae144
update API to wrap around floating UI completely
ling1726 Apr 10, 2022
d6d41f8
update react-positioning usages
ling1726 Apr 10, 2022
b296be4
remove export *
ling1726 Apr 10, 2022
02309b9
remove poppse from hook names
ling1726 Apr 10, 2022
c2b3a49
merge master
ling1726 Apr 13, 2022
4759559
Merge branch 'chore/floating-ui' of https://github.com/ling1726/fluen…
ling1726 Apr 13, 2022
b961173
remove duplicate import
ling1726 Apr 13, 2022
3e24d1c
Update change/@fluentui-react-popover-7c1b5c26-eb72-4d8b-8951-f6a5501…
ling1726 Apr 13, 2022
c21ca5a
Update change/@fluentui-react-tooltip-3f810af7-b574-4988-bf02-21dbdde…
ling1726 Apr 13, 2022
b880b4a
change file
ling1726 Apr 13, 2022
31f605f
Merge branch 'chore/floating-ui' of https://github.com/ling1726/fluen…
ling1726 Apr 13, 2022
8445272
Update change/@fluentui-react-menu-16ea1e78-a70f-4378-9515-49a0254f32…
ling1726 Apr 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/node_modules/@floating-ui/core/src/types.d.ts b/node_modules/@floating-ui/core/src/types.d.ts
index f5c4f1b..14cc9b3 100644
--- a/node_modules/@floating-ui/core/src/types.d.ts
+++ b/node_modules/@floating-ui/core/src/types.d.ts
@@ -1,6 +1,14 @@
export declare type Alignment = 'start' | 'end';
export declare type Side = 'top' | 'right' | 'bottom' | 'left';
-export declare type AlignedPlacement = `${Side}-${Alignment}`;
+export declare type AlignedPlacement =
+ | 'top-start'
+ | 'top-end'
+ | 'right-start'
+ | 'right-end'
+ | 'bottom-start'
+ | 'bottom-end'
+ | 'left-start'
+ | 'left-end';
export declare type Placement = Side | AlignedPlacement;
export declare type Strategy = 'absolute' | 'fixed';
export declare type Axis = 'x' | 'y';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
diff --git a/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts b/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts
index 461f170..86d7a4a 100644
--- a/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts
+++ b/node_modules/@floating-ui/dom/src/utils/getOverflowAncestors.d.ts
@@ -1 +1 @@
-export declare function getOverflowAncestors(node: Node, list?: Array<Element | Window>): Array<Element | Window | VisualViewport>;
+export declare function getOverflowAncestors(node: Node, list?: Array<Element | Window>): Array<Element | Window>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Patches for TS minbar test

Some partners might be on incompatible versions of typescript, but are willing to patch incompatible
types on their end. If this is the case, simply create a similar patch for the affected code with
[patch-package](https://github.com/ds300/patch-package) and drop the resulting patch in this folder.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we provide copy pastable command to achieve that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add the command, but it will still involve updating node_modules there's no way around that unfortunately

6 changes: 6 additions & 0 deletions apps/ts-minbar-test-react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function performTest() {
'react@17',
'react-dom@17',
`typescript@${tsVersion}`,
'patch-package',
].join(' ');
await shEcho(`yarn add ${dependencies}`, tempPaths.testApp);
logger(`✔️ Dependencies were installed`);
Expand All @@ -41,6 +42,11 @@ async function performTest() {
fs.mkdirSync(path.join(tempPaths.testApp, 'src'));
fs.copyFileSync(scaffoldPath('index.tsx'), path.join(tempPaths.testApp, 'src/index.tsx'));
fs.copyFileSync(scaffoldPath('tsconfig.json'), path.join(tempPaths.testApp, 'tsconfig.json'));

fs.mkdirSync(path.join(tempPaths.testApp, 'patches/'));
fs.copySync(scaffoldPath('patches/'), path.join(tempPaths.testApp, 'patches/'));
await shEcho(`yarn patch-package`, tempPaths.testApp);

logger(`✔️ Source and configs were copied`);

await shEcho(`npx npm-which yarn`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import {
usePopper,
usePositioning,
createArrowStyles,
PositioningProps,
PopperVirtualElement,
PopperRefHandle,
PositioningVirtualElement,
PositioningImperativeRef,
} from '@fluentui/react-positioning';
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { useMergedRefs } from '@fluentui/react-utilities';
Expand Down Expand Up @@ -103,7 +103,7 @@ const Box = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement

const PositionAndAlignProps: React.FC<{ positionFixed?: boolean }> = ({ positionFixed }) => {
const styles = useStyles();
const positionedRefs = positions.reduce<ReturnType<typeof usePopper>[]>((acc, cur) => {
const positionedRefs = positions.reduce<ReturnType<typeof usePositioning>[]>((acc, cur) => {
const popperOptions: PositioningProps = { position: cur[0], align: cur[1] };
// positionFixed is not public yet
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -112,8 +112,8 @@ const PositionAndAlignProps: React.FC<{ positionFixed?: boolean }> = ({ position

// this loop is deterministic
// eslint-disable-next-line react-hooks/rules-of-hooks
const popperRefs = usePopper(popperOptions);
acc.push(popperRefs);
const positioningRefs = usePositioning(popperOptions);
acc.push(positioningRefs);
return acc;
}, []);

Expand All @@ -131,11 +131,15 @@ const PositionAndAlignProps: React.FC<{ positionFixed?: boolean }> = ({ position

const Offset = () => {
const styles = useStyles();
const positionedRefs = positions.reduce<ReturnType<typeof usePopper>[]>((acc, cur) => {
const positionedRefs = positions.reduce<ReturnType<typeof usePositioning>[]>((acc, cur) => {
// this loop is deterministic
// eslint-disable-next-line react-hooks/rules-of-hooks
const popperRefs = usePopper({ position: cur[0], align: cur[1], offset: [10, 10] });
acc.push(popperRefs);
const positioningRefs = usePositioning({
position: cur[0],
align: cur[1],
offset: { crossAxis: 10, mainAxis: 10 },
});
acc.push(positioningRefs);
return acc;
}, []);

Expand All @@ -153,11 +157,15 @@ const Offset = () => {

const OffsetFunction = () => {
const styles = useStyles();
const positionedRefs = positions.reduce<ReturnType<typeof usePopper>[]>((acc, cur) => {
const positionedRefs = positions.reduce<ReturnType<typeof usePositioning>[]>((acc, cur) => {
// this loop is deterministic
// eslint-disable-next-line react-hooks/rules-of-hooks
const popperRefs = usePopper({ position: cur[0], align: cur[1], offset: () => [10, 10] });
acc.push(popperRefs);
const positioningRefs = usePositioning({
position: cur[0],
align: cur[1],
offset: () => ({ crossAxis: 10, mainAxis: 10 }),
});
acc.push(positioningRefs);
return acc;
}, []);

Expand All @@ -175,11 +183,11 @@ const OffsetFunction = () => {

const CoverTarget = () => {
const styles = useStyles();
const positionedRefs = positions.reduce<ReturnType<typeof usePopper>[]>((acc, cur) => {
const positionedRefs = positions.reduce<ReturnType<typeof usePositioning>[]>((acc, cur) => {
// this loop is deterministic
// eslint-disable-next-line react-hooks/rules-of-hooks
const popperRefs = usePopper({ position: cur[0], align: cur[1], coverTarget: true });
acc.push(popperRefs);
const positioningRefs = usePositioning({ position: cur[0], align: cur[1], coverTarget: true });
acc.push(positioningRefs);
return acc;
}, []);

Expand All @@ -198,8 +206,8 @@ const CoverTarget = () => {
const VerticalFlip = () => {
const styles = useStyles();
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const topPopper = usePopper({ position: 'above', flipBoundary: boundary ?? undefined });
const bottomPopper = usePopper({ position: 'below', flipBoundary: boundary ?? undefined });
const topPopper = usePositioning({ position: 'above', flipBoundary: boundary ?? undefined });
const bottomPopper = usePositioning({ position: 'below', flipBoundary: boundary ?? undefined });

return (
<div
Expand All @@ -221,8 +229,8 @@ const VerticalFlip = () => {
const HorizontalFlip = () => {
const styles = useStyles();
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const startPopper = usePopper({ position: 'before', flipBoundary: boundary ?? undefined });
const endPopper = usePopper({ position: 'after', flipBoundary: boundary ?? undefined });
const startPopper = usePositioning({ position: 'before', flipBoundary: boundary ?? undefined });
const endPopper = usePositioning({ position: 'after', flipBoundary: boundary ?? undefined });
const { dir } = useFluent();
const marginDir = dir === 'ltr' ? 'marginLeft' : 'marginRight';

Expand All @@ -242,8 +250,8 @@ const HorizontalFlip = () => {
const VerticalOverflow = () => {
const styles = useStyles();
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const topPopper = usePopper({ position: 'after', overflowBoundary: boundary ?? undefined });
const bottomPopper = usePopper({ position: 'after', overflowBoundary: boundary ?? undefined });
const topPopper = usePositioning({ position: 'after', overflowBoundary: boundary ?? undefined });
const bottomPopper = usePositioning({ position: 'after', overflowBoundary: boundary ?? undefined });

return (
<div
Expand All @@ -265,8 +273,8 @@ const VerticalOverflow = () => {
const HorizontalOverflow = () => {
const styles = useStyles();
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const startPopper = usePopper({ position: 'below', overflowBoundary: boundary ?? undefined });
const endPopper = usePopper({ position: 'below', overflowBoundary: boundary ?? undefined });
const startPopper = usePositioning({ position: 'below', overflowBoundary: boundary ?? undefined });
const endPopper = usePositioning({ position: 'below', overflowBoundary: boundary ?? undefined });
const { dir } = useFluent();
const marginDir = dir === 'ltr' ? 'marginLeft' : 'marginRight';

Expand All @@ -290,7 +298,7 @@ const HorizontalOverflow = () => {
const Pinned = () => {
const styles = useStyles();
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const { containerRef, targetRef } = usePopper({
const { containerRef, targetRef } = usePositioning({
position: 'above',
flipBoundary: boundary ?? undefined,
pinned: true,
Expand All @@ -310,11 +318,11 @@ const Pinned = () => {

const Arrow: React.FC = () => {
const styles = useStyles();
const positionedRefs = positions.reduce<ReturnType<typeof usePopper>[]>((acc, cur) => {
const positionedRefs = positions.reduce<ReturnType<typeof usePositioning>[]>((acc, cur) => {
// this loop is deterministic
// eslint-disable-next-line react-hooks/rules-of-hooks
const popperRefs = usePopper({ position: cur[0], align: cur[1] });
acc.push(popperRefs);
const positioningRefs = usePositioning({ position: cur[0], align: cur[1] });
acc.push(positioningRefs);
return acc;
}, []);

Expand All @@ -335,7 +343,7 @@ const Arrow: React.FC = () => {

const AutoSize = () => {
const styles = useStyles();
const { containerRef, targetRef } = usePopper({
const { containerRef, targetRef } = usePositioning({
position: 'below',
autoSize: true,
});
Expand Down Expand Up @@ -375,17 +383,20 @@ const AutoSize = () => {

const DisableTether = () => {
const styles = useStyles();
const { containerRef, targetRef } = usePopper({
const [boundary, setBoundary] = React.useState<HTMLDivElement | null>(null);
const { containerRef, targetRef } = usePositioning({
position: 'above',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/naming-convention
unstable_disableTether: 'all',
overflowBoundary: boundary,
});

return (
<>
<div
ref={setBoundary}
className={styles.boundary}
style={{
display: 'flex',
Expand All @@ -396,7 +407,7 @@ const DisableTether = () => {
position: 'relative',
}}
>
<button style={{ position: 'absolute', top: -1000 }} ref={targetRef}>
<button style={{ position: 'absolute', top: -50 }} ref={targetRef}>
Target
</button>
<Box ref={containerRef}>Untethered</Box>
Expand All @@ -411,14 +422,14 @@ const DisableTether = () => {
const VirtualElement = () => {
const [target, setTarget] = React.useState<HTMLButtonElement | null>(null);

const { containerRef, targetRef } = usePopper({
const { containerRef, targetRef } = usePositioning({
position: 'below',
align: 'end',
});

React.useEffect(() => {
if (target) {
const virtualElement: PopperVirtualElement = {
const virtualElement: PositioningVirtualElement = {
getBoundingClientRect: () => target.getBoundingClientRect(),
};

Expand All @@ -437,7 +448,7 @@ const VirtualElement = () => {
const TargetProp = () => {
const [target, setTarget] = React.useState<HTMLButtonElement | null>(null);

const { containerRef } = usePopper({
const { containerRef } = usePositioning({
target,
position: 'below',
align: 'end',
Expand All @@ -452,18 +463,18 @@ const TargetProp = () => {
};

const ImperativeTarget = () => {
const popperRef = React.useRef<PopperRefHandle>({ updatePosition: () => null, setTarget: () => null });
const imperativeRef = React.useRef<PositioningImperativeRef>({ updatePosition: () => null, setTarget: () => null });
const ref = React.useRef<HTMLButtonElement>(null);

const { containerRef } = usePopper({
popperRef,
const { containerRef } = usePositioning({
imperativeRef,
position: 'below',
align: 'end',
});

React.useEffect(() => {
if (ref.current) {
popperRef.current.setTarget(ref.current);
imperativeRef.current.setTarget(ref.current);
}
}, []);

Expand All @@ -477,7 +488,7 @@ const ImperativeTarget = () => {

const VisibilityModifiers = () => {
const styles = useStyles();
const popper = usePopper({ align: 'center', position: 'above' });
const popper = usePositioning({ align: 'center', position: 'above' });

return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "BREAKING: Updates related to internal bump of Popper.js to Floating UI",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "BREAKING: Updates related to internal bump of Popper.js to Floating UI",
"packageName": "@fluentui/react-popover",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "BREAKING: Upgrade PopperJS for FloatingUI",
"packageName": "@fluentui/react-positioning",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "BREAKING: Updates related to internal bump of Popper.js to Floating UI",
"packageName": "@fluentui/react-tooltip",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { resolvePositioningShorthand, usePopper } from '@fluentui/react-positioning';
import { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
import {
getPartitionedNativeProps,
resolveShorthand,
Expand Down Expand Up @@ -56,7 +56,7 @@ export const useCombobox_unstable = (props: ComboboxProps, ref: React.Ref<HTMLBu
}: {
targetRef: React.MutableRefObject<HTMLButtonElement>;
containerRef: React.MutableRefObject<HTMLDivElement>;
} = usePopper(popperOptions);
} = usePositioning(popperOptions);

// update value based on selectedOptions
const isFirstMount = useFirstMount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ CoverTarget.parameters = {

CoverTarget.decorators = [
(Story: React.ElementType) => (
<div style={{ height: 700, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<div style={{ height: 700, display: 'flex', alignItems: 'center' }}>
<Story />
</div>
),
Expand Down
Loading