-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tooltip placement bugs by upgrading Popper
- Loading branch information
1 parent
26b7652
commit 3b476fb
Showing
15 changed files
with
85 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2021 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import type { Modifier } from '@popperjs/core'; | ||
import type { OffsetModifier } from '@popperjs/core/lib/modifiers/offset'; | ||
|
||
/** | ||
* Shorthand for the [offset modifier][0] when you just wanna set the distance. | ||
* | ||
* [0]: https://popper.js.org/docs/v2/modifiers/offset/ | ||
*/ | ||
export const offsetDistanceModifier = ( | ||
distance: number | ||
): Partial<OffsetModifier> => ({ | ||
name: 'offset', | ||
options: { offset: [undefined, distance] }, | ||
}); | ||
|
||
/** | ||
* Make the popper element the same width as the reference, even when you resize. | ||
* | ||
* Should probably be used with the "top-start", "top-end", "bottom-start", or | ||
* "bottom-end" placement. | ||
*/ | ||
export const sameWidthModifier: Modifier<'sameWidth', unknown> = { | ||
name: 'sameWidth', | ||
enabled: true, | ||
phase: 'write', | ||
fn({ state }) { | ||
// eslint-disable-next-line no-param-reassign | ||
state.elements.popper.style.width = `${state.rects.reference.width}px`; | ||
}, | ||
}; |
Oops, something went wrong.