Skip to content

Commit

Permalink
fixup! chore(Tooltip): migrate from react-popper to floating-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Oct 17, 2024
1 parent 6e01b41 commit 40288a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/orbit-components/src/Tooltip/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface Props extends Common.Globals {
readonly enabled?: boolean;
readonly onShow?: Common.Callback;
readonly labelClose?: string;
readonly placement?: Placement;
readonly tabIndex?: string | number;
readonly removeUnderlinedText?: boolean;
readonly block?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const Playground: Story = {
removeUnderlinedText: false,
block: false,
noFlip: false,
offset: [0, 0],
offset: [0, 5],
...WithImageInside.args,
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ import { AUTO_PLACEMENTS, getAutoAlignment, isFixedPlacement } from "../../../co
import FOCUSABLE_ELEMENT_SELECTORS from "../../../hooks/useFocusTrap/consts";
import type { Props } from "./types";
import useTheme from "../../../hooks/useTheme";
import type { Theme } from "../../../defaultTheme";

const ARROW_SIZE = 6;

const getArrowColor = ({ error, help, theme }) => {
const getArrowColor = ({
error,
help,
theme,
}: {
error: Props["error"];
help: Props["help"];
theme: Theme;
}) => {
if (error) return theme.orbit.paletteRedNormal;
if (help) return theme.orbit.paletteBlueNormal;
return theme.orbit.paletteInkDark;
Expand Down Expand Up @@ -56,7 +65,7 @@ const TooltipContent = ({
middleware: [
offset({
mainAxis: offsetProp[0] + ARROW_SIZE,
crossAxis: offsetProp[1],
crossAxis: offsetProp[1] - ARROW_SIZE,
}),
!noFlip &&
!isAutoPlacement &&
Expand Down

0 comments on commit 40288a6

Please sign in to comment.