From 39ead3814ebdd781625a84a0effdbbbc2bd1e267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 2 May 2023 11:19:06 +0100 Subject: [PATCH] fix(ui): update to floating-ui v2 --- .../Grid/AlertGrid/AlertGroup/Alert/AlertMenu.tsx | 6 +++--- .../Grid/AlertGrid/AlertGroup/GroupHeader/GroupMenu.tsx | 6 +++--- ui/src/Components/Grid/AlertGrid/GridLabelSelect.tsx | 6 +++--- ui/src/Components/NavBar/FilterInput/History.tsx | 6 +++--- ui/src/Components/SilenceModal/Browser/MassDelete.tsx | 6 +++--- ui/src/Components/TooltipWrapper/index.tsx | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.tsx b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.tsx index 715f367bc..5880e1467 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.tsx +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.tsx @@ -180,7 +180,7 @@ const AlertMenu: FC<{ const rootRef = useRef(null); useOnClickOutside(rootRef, hide, !isHidden); - const { x, y, reference, floating, strategy } = useFloating({ + const { x, y, refs, strategy } = useFloating({ placement: "bottom-start", middleware: [shift(), offset(5)], }); @@ -189,7 +189,7 @@ const AlertMenu: FC<{ @@ -209,7 +209,7 @@ const AlertMenu: FC<{ afterClick={hide} x={x} y={y} - floating={floating} + floating={refs.setFloating} strategy={strategy} /> diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupHeader/GroupMenu.tsx b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupHeader/GroupMenu.tsx index e2c306651..bd95d5d94 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupHeader/GroupMenu.tsx +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupHeader/GroupMenu.tsx @@ -164,7 +164,7 @@ const GroupMenu: FC<{ const rootRef = useRef(null); useOnClickOutside(rootRef, hide, !isHidden); - const { x, y, reference, floating, strategy } = useFloating({ + const { x, y, refs, strategy } = useFloating({ placement: "bottom-start", middleware: [shift(), offset(5)], }); @@ -172,7 +172,7 @@ const GroupMenu: FC<{ return ( diff --git a/ui/src/Components/Grid/AlertGrid/GridLabelSelect.tsx b/ui/src/Components/Grid/AlertGrid/GridLabelSelect.tsx index 9e5d857c5..51b2a4d04 100644 --- a/ui/src/Components/Grid/AlertGrid/GridLabelSelect.tsx +++ b/ui/src/Components/Grid/AlertGrid/GridLabelSelect.tsx @@ -142,7 +142,7 @@ const GridLabelSelect: FC<{ const ref = useRef(null); useOnClickOutside(ref, hide, isVisible); - const { x, y, reference, floating, strategy } = useFloating({ + const { x, y, refs, strategy } = useFloating({ placement: "bottom", middleware: [shift(), offset(5)], }); @@ -150,7 +150,7 @@ const GridLabelSelect: FC<{ return (
diff --git a/ui/src/Components/NavBar/FilterInput/History.tsx b/ui/src/Components/NavBar/FilterInput/History.tsx index 10045e4b0..9a72fdbfe 100644 --- a/ui/src/Components/NavBar/FilterInput/History.tsx +++ b/ui/src/Components/NavBar/FilterInput/History.tsx @@ -196,7 +196,7 @@ const History: FC<{ const hide = useCallback(() => setIsVisible(false), []); const toggle = useCallback(() => setIsVisible(!isVisible), [isVisible]); - const { x, y, reference, floating, strategy } = useFloating({ + const { x, y, refs, strategy } = useFloating({ placement: "bottom-end", middleware: [ shift(), @@ -259,7 +259,7 @@ const History: FC<{ className="input-group-text border-0 rounded-0 bg-inherit px-0" > = ({ title, children, className }) => { - const { x, y, reference, floating, strategy } = useFloating({ + const { x, y, refs, strategy } = useFloating({ placement: "top", middleware: [shift(), flip()], }); @@ -58,7 +58,7 @@ const TooltipWrapper: FC<{ onTouchStart={supportsTouch ? showTooltip : undefined} onTouchCancel={supportsTouch ? hideTooltip : undefined} onTouchEnd={supportsTouch ? hideTooltip : undefined} - ref={reference} + ref={refs.setReference} className={`${className ? className : ""} tooltip-trigger`} > {children} @@ -75,7 +75,7 @@ const TooltipWrapper: FC<{ >