Skip to content

Commit

Permalink
Add CircularProgressOwnerState type
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Aug 29, 2022
1 parent 0da996f commit c63fd9a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Expand Up @@ -54,3 +54,5 @@ export type CircularProgressProps<
D extends React.ElementType = CircularProgressTypeMap['defaultComponent'],
P = { component?: React.ElementType },
> = OverrideProps<CircularProgressTypeMap<P, D>, D>;

export interface CircularProgressOwnerState extends CircularProgressProps {}
3 changes: 2 additions & 1 deletion packages/mui-joy/src/styles/components.d.ts
Expand Up @@ -40,6 +40,7 @@ import {
} from '../ChipDelete/ChipDeleteProps';
import {
CircularProgressProps,
CircularProgressOwnerState,
CircularProgressSlot,
} from '../CircularProgress/CircularProgressProps';
import { ContainerProps, ContainerSlot } from '../Container/ContainerProps';
Expand Down Expand Up @@ -157,7 +158,7 @@ export interface Components<Theme = unknown> {
};
JoyCircularProgress?: {
defaultProps?: Partial<CircularProgressProps>;
styleOverrides?: OverridesStyleRules<CircularProgressSlot, CircularProgressProps, Theme>;
styleOverrides?: OverridesStyleRules<CircularProgressSlot, CircularProgressOwnerState, Theme>;
};
JoyCard?: {
defaultProps?: Partial<CardProps>;
Expand Down
17 changes: 17 additions & 0 deletions packages/mui-joy/src/styles/extendTheme.spec.ts
Expand Up @@ -14,6 +14,7 @@ import { CardOverflowOwnerState } from '@mui/joy/CardOverflow';
import { CheckboxOwnerState } from '@mui/joy/Checkbox';
import { ChipOwnerState } from '@mui/joy/Chip';
import { ChipDeleteOwnerState } from '@mui/joy/ChipDelete';
import { CircularProgressOwnerState } from '@mui/joy/CircularProgress';
import { ContainerProps } from '@mui/joy/Container';
import { FormHelperTextOwnerState } from '@mui/joy/FormHelperText';
import { FormLabelOwnerState } from '@mui/joy/FormLabel';
Expand Down Expand Up @@ -275,6 +276,22 @@ extendTheme({
},
},
},
JoyCircularProgress: {
defaultProps: {
variant: 'solid',
color: 'success',
},
styleOverrides: {
root: ({ ownerState }) => {
expectType<CircularProgressOwnerState & Record<string, unknown>, typeof ownerState>(ownerState);
return {};
},
progress: ({ ownerState }) => {
expectType<CircularProgressOwnerState & Record<string, unknown>, typeof ownerState>(ownerState);
return {};
},
},
},
JoyContainer: {
defaultProps: {
disableGutters: true,
Expand Down

0 comments on commit c63fd9a

Please sign in to comment.