Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Refactor theming of Admin components to remove legacy @mui/styles package #1376

Merged
merged 81 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
2d8967a
Make AppHeader themeable without @mui/styles (#1195)
johnnyomair Nov 7, 2023
b5753e6
Only require partial props for theme `defaultProps` (#1378)
jamesricky Nov 13, 2023
92eae2b
COM-85: Docs, changelog & types for new theming method (#1400)
jamesricky Nov 23, 2023
eff7cf1
COM-85: Allow extending slots from Admin components (#1444)
jamesricky Nov 28, 2023
5a2b17a
Merge pull request #1458 from vivid-planet/next
jamesricky Nov 29, 2023
5441de5
COM-85: Refactor Tooltip theming (#1379)
jamesricky Nov 29, 2023
e817030
COM-85: Refactor theming of ErrorBoundary (#1451)
jamesricky Nov 29, 2023
74c36fa
COM-85: Add theming-example story from the docs (#1427)
jamesricky Nov 29, 2023
87a442f
COM-85: Refactor AppHeader theming (#1426)
jamesricky Nov 29, 2023
47ec528
COM-85: Refactor FieldContainer theming (#1381)
jamesricky Dec 7, 2023
1c0ac5a
COM-85: Refactor theming of Toolbar components (#1445)
jamesricky Dec 18, 2023
b87c3c2
COM-85: Refactor Theming of Picker Components (#1471)
jamesricky Jan 4, 2024
4f8ad32
Merge remote-tracking branch 'origin/next' into feature/refactor-admi…
jamesricky Jan 4, 2024
e412e9f
Refactor theming of `Tabs` (#1555)
NataliaVizintini Jan 22, 2024
19eaee4
Refactor theming of `TabScrollButton` (#1550)
NataliaVizintini Jan 22, 2024
3b878c0
Refactor theming of `RouterTabs` (#1558)
NataliaVizintini Jan 22, 2024
6111274
Refactor theming of `OkayButton` (#1573)
NataliaVizintini Jan 22, 2024
4b141ec
Refactor theming of `CancelButton` (#1574)
NataliaVizintini Jan 22, 2024
28eef3a
Refactor theming of `DeleteButton` (#1575)
NataliaVizintini Jan 22, 2024
a535454
Refactor theming of `ClearInputButton` (#1563)
NataliaVizintini Jan 23, 2024
cd1e256
Refactor theming of `StackBackButton` (#1580)
juliawegmayr Jan 23, 2024
1bd0e24
Refactor theming of `MainContent` (#1605)
NataliaVizintini Jan 23, 2024
0bfd389
Refactor theming of `FormSection` (#1604)
NataliaVizintini Jan 23, 2024
5e05671
COM-304: Refactor theming of `FinalFormRangeInput` (#1609)
juliawegmayr Jan 24, 2024
1be2924
COM-302: Refactor theming of `SaveButton` (#1572)
NataliaVizintini Jan 25, 2024
6c4f43b
Refactor theming of `FinalFormSearchTextField` (#1611)
juliawegmayr Jan 25, 2024
165a680
Refactor theming of `MasterLayout` (#1603)
NataliaVizintini Jan 25, 2024
8a44ce9
Refactor theming for `AppHeaderFillSpace` (#1598)
andrearutrecht Jan 25, 2024
96eb8fb
Refactor theming of `FilterBarActiveFilterBadge` (#1571)
juliawegmayr Jan 25, 2024
5e29232
Refactor theming of `SplitButton` (#1602)
NataliaVizintini Jan 25, 2024
f820f4d
Merge remote-tracking branch 'origin/next' into merge-next-into-featu…
jamesricky Jan 27, 2024
b640c97
Merge pull request #1627 from vivid-planet/merge-next-into-feature-re…
johnnyomair Jan 29, 2024
1c7a2a0
Refactor theming of `FilterBar` (#1579)
juliawegmayr Jan 29, 2024
a55b34d
Refactor theming of `MenuCollapsibleItem` (#1618)
juliawegmayr Jan 29, 2024
956111a
Refactor theming of `FilterBarMoreFilters` (#1588)
juliawegmayr Jan 29, 2024
3223d4b
Refactor theming of `RouterConfirmationDialog` (#1615)
juliawegmayr Jan 29, 2024
a2f278b
Refactor theming of `AppHeaderDropdown` (#1608)
andrearutrecht Jan 29, 2024
241249b
COM-291: Refactor theming of `AppHeaderButton` (#1595)
andrearutrecht Jan 30, 2024
3c0e325
Refactor theming of RTE `Toolbar` (#1601)
andrearutrecht Jan 30, 2024
5a219da
Remove `slotProps` when extending `AppHeaderButtonProps` (#1642)
jamesricky Jan 31, 2024
4529359
Fix the type of the `component` prop on `styled(Typography)` (#1616)
jamesricky Jan 31, 2024
d2e64d1
Refactor theming of `FilterBarPopoverFilter` (#1586)
juliawegmayr Jan 31, 2024
ef8c531
Refactor theming of `FilterBarButton` (#1589)
juliawegmayr Jan 31, 2024
1a1d831
Refactor theming of `MenuItem` (#1597)
juliawegmayr Jan 31, 2024
a1bb636
Refactor theming of TableBodyRow
Jan 29, 2024
946773c
improve root ownerstate logic
Feb 5, 2024
db2c05c
Refactor theming of TableQuery
Jan 30, 2024
e782cd7
Refactor theming of `FeaturesButtonGroup` (#1640)
juliawegmayr Feb 6, 2024
1821ba1
Merge pull request #1630 from vivid-planet/refactorTableBodyRow
F10Ragger Feb 7, 2024
46d7420
Merge pull request #1641 from vivid-planet/refactorTableQuery
F10Ragger Feb 7, 2024
48b38fc
Merge remote-tracking branch 'origin/next' into merge-next-into-featu…
jamesricky Feb 7, 2024
6ed951d
Merge pull request #1672 from vivid-planet/merge-next-into-feature-re…
johnnyomair Feb 8, 2024
c7b96e2
Refactor theming of `HoverActions` (#1687)
stekalt Feb 13, 2024
2b31151
Refactor theming of `AppHeaderMenuButton` (#1680)
stekalt Feb 13, 2024
272c0d9
Refactor theming of `TableDndOrder` (#1636)
F10Ragger Feb 13, 2024
557f079
Merge remote-tracking branch 'origin/next' into feature/refactor-admi…
jamesricky Feb 13, 2024
481962d
Merge pull request #1692 from vivid-planet/merge-next-into-feature-re…
johnnyomair Feb 13, 2024
af95a31
Refactor theming of RTE `ControlButton` (#1635)
juliawegmayr Feb 13, 2024
abb696a
Refactor theming of `Rte` (#1660)
andrearutrecht Feb 19, 2024
918a6e3
Refactor theming of `BlockElement` (#1719)
juliawegmayr Feb 20, 2024
7314001
Refactor theming of `Menu` (#1607)
juliawegmayr Feb 20, 2024
41be827
Refactor theming of `StackBreadcrumbs` (#1606)
juliawegmayr Feb 21, 2024
04ed68c
Refactor theming of `CopyToClipboardButton` (#1728)
stekalt Feb 21, 2024
a717078
Refactor theming of `BlockTypesControls` (#1720)
juliawegmayr Feb 21, 2024
023540f
Refactor theming of `LinkControls` (#1651)
juliawegmayr Feb 22, 2024
bb4cb60
Refactor theming of `ClearInputAdornment` (#1731)
stekalt Feb 22, 2024
e00c8e1
Refactor theming of `ReactSelect` (#1744)
juliawegmayr Feb 26, 2024
5600301
Refactor theming of `FinalFormSaveCancelButtonsLegacy` (#1734)
NataliaVizintini Feb 26, 2024
af2765a
Merge remote-tracking branch 'origin/next' into feature/refactor-admi…
jamesricky Feb 26, 2024
9578334
Fix import
jamesricky Feb 26, 2024
c962a24
Merge pull request #1753 from vivid-planet/merge-next-into-feature-re…
johnnyomair Feb 26, 2024
e90a82d
Refactor component styling without `@mui/styles` (#1757)
jamesricky Feb 27, 2024
2a7bc76
Refactor theming of remaining Admin components and remove module augm…
jamesricky Feb 27, 2024
5061377
Fully remove legacy `@mui/styles` package and remaining usages (#1765)
jamesricky Feb 28, 2024
5a2239f
Fix menu-width by adding the missing unit to the value (#1764)
jamesricky Feb 28, 2024
b4bfeb9
Merge branch 'next' into feature/refactor-admin-component-theming
jamesricky Feb 28, 2024
d1244dc
Merge pull request #1774 from vivid-planet/merge-next-into-feature-re…
johnnyomair Feb 28, 2024
580a1f0
Fixes and refactoring for theming refactor (#1768)
jamesricky Feb 29, 2024
3aff04e
Merge pull request #1813 from vivid-planet/next
johnnyomair Mar 11, 2024
fe2d443
Explain missing styles in changelog (#1831)
jamesricky Mar 13, 2024
3a18e50
Automatically generate `className` for component slots with `createCo…
jamesricky Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-clocks-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-color-picker": major
---

Replace the `componentsProps` prop with `slotProps` in `ColorPicker` and remove the `ColorPickerComponentsProps` type
8 changes: 8 additions & 0 deletions .changeset/cyan-drinks-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin": major
---

Change theming method of `Menu`

- Rename `permanent` class-key to `permanentDrawer` and `temporary` class-key to `temporaryDrawer`
- Replace the `permanentDrawerProps` and `temporaryDrawerProps` props with `slotProps`
7 changes: 7 additions & 0 deletions .changeset/great-insects-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `FieldContainerComponent` component

`FieldContainerComponent` was never intended to be exported, use `FieldContainer` instead.
5 changes: 5 additions & 0 deletions .changeset/happy-ladybugs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": major
---

Rename the `FilterBarMoveFilersClassKey` type to `FilterBarMoreFiltersClassKey`
7 changes: 7 additions & 0 deletions .changeset/khaki-cobras-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `disabled` class-key in `TabScrollButton`

Use the `:disabled` selector instead when styling the disabled state.
8 changes: 8 additions & 0 deletions .changeset/long-crabs-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin": major
---

Remove the `components` and `componentProps` props from `CopyToClipboardButton`

Instead, for the icons, use the `copyIcon` and `successIcon` props to pass a `ReactNode` instead of separately passing in values to the `components` and `componentProps` objects.
Use `slotPops` to pass props to the remaining elements.
9 changes: 9 additions & 0 deletions .changeset/proud-cheetahs-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@comet/admin-color-picker": patch
"@comet/admin-react-select": patch
"@comet/admin-date-time": patch
"@comet/admin-rte": patch
"@comet/admin": patch
---

Allow partial props in the theme's `defaultProps` instead of requiring all props when setting the `defaultProps` of a component
5 changes: 5 additions & 0 deletions .changeset/quick-foxes-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": major
---

Replace the `componentsProps` prop with `slotProps` in `FieldSet`
5 changes: 5 additions & 0 deletions .changeset/serious-ravens-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": major
---

Replace the `componentsProps` prop with `slotProps` in `InputWithPopper` and remove the `InputWithPopperComponentsProps` type
7 changes: 7 additions & 0 deletions .changeset/strange-steaks-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `message` class-key from `Alert`

Use the `.MuiAlert-message` selector instead to style the message of the underlying MUI `Alert` component.
29 changes: 29 additions & 0 deletions .changeset/ten-turkeys-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"@comet/admin-date-time": major
---

Rename multiple props and class-keys and remove the `componentsProps` types:

- `DatePicker`:

- Replace the `componentsProps` prop with `slotProps`
- Remove the `DatePickerComponentsProps` type

- `DateRangePicker`:

- Replace the `componentsProps` prop with `slotProps`
- Remove the `DateRangePickerComponentsProps` type
- Rename the `calendar` class-key to `dateRange`

- `DateTimePicker`:

- Replace the `componentsProps` prop with `slotProps`
- Remove the `DateTimePickerComponentsProps` type
- Replace the `formControl` class-key with two separate class-keys: `dateFormControl` and `timeFormControl`

- `TimeRangePicker`:

- Replace the `componentsProps` prop with `slotProps`
- Remove the `TimeRangePickerComponentsProps` and `TimeRangePickerIndividualPickerProps` types
- Replace the `formControl` class-key with two separate class-keys: `startFormControl` and `endFormControl`
- Replace the `timePicker` class-key with two separate class-keys: `startTimePicker` and `endTimePicker`
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 from `FilterBarPopoverFilter`

Instead of using `styleOverrides` for `paper` in the theme, use the `slotProps` and `sx` props.
7 changes: 7 additions & 0 deletions .changeset/thin-ligers-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin-react-select": major
---

Remove `ControlInput` component

`ControlInput` was never intended to be exported, use MUI's `InputBase` instead.
8 changes: 8 additions & 0 deletions .changeset/tough-zoos-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin": major
---

Remove the `disabled` and `focusVisible` class-keys and rename the `inner` class-key to `content` in `AppHeaderButton`

Use the `:disabled` selector instead when styling the disabled state.
Use the `:focus` selector instead when styling the focus state.
7 changes: 7 additions & 0 deletions .changeset/twelve-spoons-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/admin": major
---

Remove the `disabled` class-key in `ClearInputButton`

Use the `:disabled` selector instead when styling the disabled state.
5 changes: 5 additions & 0 deletions .changeset/two-lions-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": major
---

`MenuItem` no longer supports props from MUI's `ListItem` but those from `ListItemButton` instead
8 changes: 8 additions & 0 deletions .changeset/violet-wombats-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@comet/admin": major
---

Remove the `popoverPaper` class-key and rename the `popoverRoot` class-key to `popover` in `AppHeaderDropdown`

Instead of using `styleOverrides` for `popoverPaper` in the theme, use the `slotProps` and `sx` props.
Use the `popover` prop instead of `popoverRoot` to override styles.
106 changes: 106 additions & 0 deletions .changeset/yellow-houses-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
"@comet/admin-color-picker": major
"@comet/admin-react-select": major
"@comet/admin-date-time": major
"@comet/blocks-admin": major
"@comet/admin-theme": major
"@comet/admin-rte": major
"@comet/cms-admin": major
"@comet/admin": major
---

Change the method of overriding the styling of Admin components

- Remove dependency on the legacy `@mui/styles` package in favor of `@mui/material/styles`.
- Add the ability to style components using [MUI's `sx` prop](https://mui.com/system/getting-started/the-sx-prop/).
- Add the ability to style individual elements (slots) of a component using the `slotProps` and `sx` props.
- The `$` syntax in the theme's `styleOverrides` is no longer supported, see: https://mui.com/material-ui/migration/v5-style-changes/#migrate-theme-styleoverrides-to-emotion

```diff
const theme = createCometTheme({
components: {
CometAdminMyComponent: {
styleOverrides: {
- root: {
- "&$hasShadow": {
- boxShadow: "2px 2px 5px 0 rgba(0, 0, 0, 0.25)",
- },
- "& $header": {
- backgroundColor: "lime",
- },
- },
+ hasShadow: {
+ boxShadow: "2px 2px 5px 0 rgba(0, 0, 0, 0.25)",
+ },
+ header: {
+ backgroundColor: "lime",
+ },
},
},
},
});
```

- Overriding a component's styles using `withStyles` is no longer supported. Use the `sx` and `slotProps` props instead:

```diff
-import { withStyles } from "@mui/styles";
-
-const StyledMyComponent = withStyles({
- root: {
- backgroundColor: "lime",
- },
- header: {
- backgroundColor: "fuchsia",
- },
-})(MyComponent);
-
-// ...
-
-<StyledMyComponent title="Hello World" />;
+<MyComponent
+ title="Hello World"
+ sx={{
+ backgroundColor: "lime",
+ }}
+ slotProps={{
+ header: {
+ sx: {
+ backgroundColor: "fuchsia",
+ },
+ },
+ }}
+/>
```

- The module augmentation for the `DefaultTheme` type from `@mui/styles/defaultTheme` is no longer needed and needs to be removed from the admins theme file, usually located in `admin/src/theme.ts`:

```diff
-declare module "@mui/styles/defaultTheme" {
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
- export interface DefaultTheme extends Theme {}
-}
```

- Class-keys originating from MUI components have been removed from Comet Admin components, causing certain class-names and `styleOverrides` to no longer be applied.
The components `root` class-key is not affected. Other class-keys will retain the class-names and `styleOverrides` from the underlying MUI component.
For example, in `ClearInputAdornment` (when used with `position="end"`) the class-name `CometAdminClearInputAdornment-positionEnd` and the `styleOverrides` for `CometAdminClearInputAdornment.positionEnd` will no longer be applied.
The component will retain the class-names `MuiInputAdornment-positionEnd`, `MuiInputAdornment-root`, and `CometAdminClearInputAdornment-root`.
Also, the `styleOverrides` for `MuiInputAdornment.positionEnd`, `MuiInputAdornment.root`, and `CometAdminClearInputAdornment.root` will continue to be applied.

This affects the following components:

- `AppHeader`
- `AppHeaderMenuButton`
- `ClearInputAdornment`
- `Tooltip`
- `CancelButton`
- `DeleteButton`
- `OkayButton`
- `SaveButton`
- `StackBackButton`
- `DatePicker`
- `DateRangePicker`
- `TimePicker`

- For more details, see MUI's migration guide: https://mui.com/material-ui/migration/v5-style-changes/#mui-styles
1 change: 0 additions & 1 deletion demo/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@mui/icons-material": "^5.0.0",
"@mui/lab": "^5.0.0-alpha.76",
"@mui/material": "^5.0.0",
"@mui/styles": "^5.0.0",
"@mui/system": "^5.0.0",
"@mui/x-data-grid": "^5.15.2",
"@mui/x-data-grid-pro": "^5.15.2",
Expand Down
6 changes: 0 additions & 6 deletions demo/admin/src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { createCometTheme } from "@comet/admin-theme";
import type {} from "@mui/lab/themeAugmentation";
import { Theme } from "@mui/material";

export default createCometTheme();

declare module "@mui/styles/defaultTheme" {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface DefaultTheme extends Theme {}
}
Loading
Loading