Skip to content

Commit

Permalink
[@mantine/core] Popover: Fix styles prop being handled incorrectly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Nov 16, 2024
1 parent ed68c87 commit bd40d73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface PopoverContext {
variant: string | undefined;
keepMounted: boolean | undefined;
getStyles: GetStylesApi<PopoverFactory>;
resolvedStyles: Record<string, any>;
floatingStrategy: FloatingStrategy | undefined;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/@mantine/core/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
StylesApiProps,
useDirection,
useProps,
useResolvedStylesApi,
useStyles,
} from '../../core';
import {
Expand Down Expand Up @@ -232,6 +233,8 @@ export function Popover(_props: PopoverProps) {
varsResolver,
});

const { resolvedStyles } = useResolvedStylesApi<PopoverFactory>({ classNames, styles, props });

const arrowRef = useRef<HTMLDivElement | null>(null);
const [targetNode, setTargetNode] = useState<HTMLElement | null>(null);
const [dropdownNode, setDropdownNode] = useState<HTMLElement | null>(null);
Expand Down Expand Up @@ -318,6 +321,7 @@ export function Popover(_props: PopoverProps) {
variant,
keepMounted,
getStyles,
resolvedStyles,
floatingStrategy,
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export const PopoverDropdown = factory<PopoverDropdownFactory>((_props, ref) =>
left: ctx.x ?? 0,
width: ctx.width === 'target' ? undefined : rem(ctx.width),
},
ctx.resolvedStyles.dropdown,
styles?.dropdown,
style,
],
})}
Expand Down

0 comments on commit bd40d73

Please sign in to comment.