Skip to content

Commit

Permalink
[Drawer] Add missing JoyDrawer in theme components (#39074)
Browse files Browse the repository at this point in the history
Co-authored-by: siriwatknp <[email protected]>
  • Loading branch information
Studio384 and siriwatknp authored Sep 26, 2023
1 parent 5a1e257 commit 59d4e52
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mui-joy/src/Drawer/DrawerProps.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { OverridableStringUnion, OverrideProps } from '@mui/types';
import { ColorPaletteProp, VariantProp, ApplyColorInversion } from '../styles/types';
import { ModalOwnProps } from '../Modal';
import { ModalOwnProps } from '../Modal/ModalProps';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';

export type DrawerSlot = 'root' | 'label' | 'action' | 'startDecorator' | 'endDecorator';
export type DrawerSlot = 'root' | 'backdrop' | 'content';

export interface DrawerSlots {
/**
Expand Down
5 changes: 5 additions & 0 deletions packages/mui-joy/src/styles/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import {
DialogTitleOwnerState,
DialogTitleSlot,
} from '../DialogTitle/DialogTitleProps';
import { DrawerProps, DrawerOwnerState, DrawerSlot } from '../Drawer/DrawerProps';
import {
ScopedCssBaselineProps,
ScopedCssBaselineOwnerState,
Expand Down Expand Up @@ -349,6 +350,10 @@ export interface Components<Theme = unknown> {
defaultProps?: Partial<DialogTitleProps>;
styleOverrides?: StyleOverrides<DialogTitleSlot, DialogTitleOwnerState, Theme>;
};
JoyDrawer?: {
defaultProps?: Partial<DrawerProps>;
styleOverrides?: StyleOverrides<DrawerSlot, DrawerOwnerState, Theme>;
};
JoyScopedCssBaseline?: {
defaultProps?: Partial<ScopedCssBaselineProps>;
styleOverrides?: StyleOverrides<ScopedCssBaselineSlot, ScopedCssBaselineOwnerState, Theme>;
Expand Down
21 changes: 21 additions & 0 deletions packages/mui-joy/src/styles/extendTheme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DialogActionsOwnerState } from '@mui/joy/DialogActions';
import { DialogContentOwnerState } from '@mui/joy/DialogContent';
import { DialogTitleOwnerState } from '@mui/joy/DialogTitle';
import { DividerOwnerState } from '@mui/joy/Divider';
import { DrawerOwnerState } from '@mui/joy/Drawer';
import { FormControlOwnerState } from '@mui/joy/FormControl';
import { FormHelperTextOwnerState } from '@mui/joy/FormHelperText';
import { FormLabelOwnerState } from '@mui/joy/FormLabel';
Expand Down Expand Up @@ -634,6 +635,26 @@ extendTheme({
},
},
},
JoyDrawer: {
defaultProps: {
variant: 'plain',
color: 'neutral',
},
styleOverrides: {
root: ({ ownerState }) => {
expectType<DrawerOwnerState & Record<string, unknown>, typeof ownerState>(ownerState);
return {};
},
backdrop: ({ ownerState }) => {
expectType<DrawerOwnerState & Record<string, unknown>, typeof ownerState>(ownerState);
return {};
},
content: ({ ownerState }) => {
expectType<DrawerOwnerState & Record<string, unknown>, typeof ownerState>(ownerState);
return {};
},
},
},
JoyFormControl: {
styleOverrides: {
root: ({ ownerState }) => {
Expand Down

0 comments on commit 59d4e52

Please sign in to comment.