Skip to content

Commit

Permalink
[material-ui][LinearProgress][CircularProgress] Add variant overrides…
Browse files Browse the repository at this point in the history
… for module augumentation (#45163)

Co-authored-by: ZeeshanTamboli <[email protected]>
  • Loading branch information
kingflamez and ZeeshanTamboli authored Feb 3, 2025
1 parent 78350c7 commit d580b43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InternalStandardProps as StandardProps, Theme } from '..';
import { CircularProgressClasses } from './circularProgressClasses';

export interface CircularProgressPropsColorOverrides {}
export interface CircularProgressPropsVariantOverrides {}

export interface CircularProgressProps
extends StandardProps<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
Expand Down Expand Up @@ -55,7 +56,10 @@ export interface CircularProgressProps
* Use indeterminate when there is no progress value.
* @default 'indeterminate'
*/
variant?: 'determinate' | 'indeterminate';
variant?: OverridableStringUnion<
'determinate' | 'indeterminate',
CircularProgressPropsVariantOverrides
>;
}

/**
Expand Down
6 changes: 5 additions & 1 deletion packages/mui-material/src/LinearProgress/LinearProgress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InternalStandardProps as StandardProps, Theme } from '..';
import { LinearProgressClasses } from './linearProgressClasses';

export interface LinearProgressPropsColorOverrides {}
export interface LinearProgressPropsVariantOverrides {}

export interface LinearProgressProps
extends StandardProps<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
Expand Down Expand Up @@ -41,7 +42,10 @@ export interface LinearProgressProps
* Use indeterminate or query when there is no progress value.
* @default 'indeterminate'
*/
variant?: 'determinate' | 'indeterminate' | 'buffer' | 'query';
variant?: OverridableStringUnion<
'determinate' | 'indeterminate' | 'buffer' | 'query',
LinearProgressPropsVariantOverrides
>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@ declare module '@mui/material/CircularProgress' {
interface CircularProgressPropsColorOverrides {
customCircularColor: true;
}
interface CircularProgressPropsVariantOverrides {
dashed: true;
}
}
declare module '@mui/material/LinearProgress' {
interface LinearProgressPropsColorOverrides {
customLinearColor: true;
}
interface LinearProgressPropsVariantOverrides {
dashed: true;
}
}

<CircularProgress color="customCircularColor" />;
<CircularProgress variant="dashed" />;

// @ts-expect-error unknown color
<CircularProgress color="foo" />;

<LinearProgress color="customLinearColor" />;
<LinearProgress variant="dashed" />;

// @ts-expect-error unknown color
<LinearProgress color="foo" />;

0 comments on commit d580b43

Please sign in to comment.