Skip to content

Commit

Permalink
use a popover slot to allow overriding styles with slotProps and sx
Browse files Browse the repository at this point in the history
  • Loading branch information
juliawegmayr committed Jan 31, 2024
1 parent 02a2909 commit f17fa7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/tender-dots-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `paper` class key

Instead of using `styleOverrides` for `paper` in the theme, use the `slotProps` and `sx` props.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Check, Reset } from "@comet/admin-icons";
import { Button, ButtonProps, ComponentsOverrides, Popover, Theme } from "@mui/material";
import { Button, ButtonProps, ComponentsOverrides, Popover as MuiPopover, Theme } from "@mui/material";
import { css, styled, useThemeProps } from "@mui/material/styles";
import { ThemedComponentBaseProps } from "helpers/ThemedComponentBaseProps";
import * as React from "react";
Expand All @@ -15,7 +15,7 @@ import { FilterBarButton, FilterBarButtonProps } from "../filterBarButton/Filter
/**
* @deprecated Use MUI X Data Grid in combination with `useDataGridRemote` instead.
*/
export type FilterBarPopoverFilterClassKey = "root" | "fieldBarWrapper" | "popoverContentContainer" | "buttonsContainer";
export type FilterBarPopoverFilterClassKey = "root" | "fieldBarWrapper" | "popoverContentContainer" | "buttonsContainer" | "popover";

const Root = styled("div", {
name: "CometAdminFilterBarPopoverFilter",
Expand Down Expand Up @@ -80,6 +80,14 @@ const ButtonsContainer = styled("div", {
`,
);

const Popover = styled(MuiPopover, {
name: "CometAdminFilterBarPopoverFilter",
slot: "popover",
overridesResolver(_, styles) {
return [styles.popover];
},
})();

/**
* @deprecated Use MUI X Data Grid in combination with `useDataGridRemote` instead.
*/
Expand All @@ -90,6 +98,7 @@ export interface FilterBarPopoverFilterProps
popoverContentContainer: "div";
buttonsContainer: "div";
contentContainer: "div";
popover: typeof Popover;
}> {
label: string;
dirtyFieldsBadge?: React.ComponentType<FilterBarActiveFilterBadgeProps>;
Expand Down Expand Up @@ -149,6 +158,7 @@ export function FilterBarPopoverFilter(inProps: React.PropsWithChildren<FilterBa
<Popover
open={open}
anchorEl={anchorEl}
{...slotProps?.popover}
onClose={() => {
setAnchorEl(null);
handleSubmit();
Expand Down

0 comments on commit f17fa7a

Please sign in to comment.