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

[material-ui][LinearProgress][CircularProgress] Add variant overrides for module augmentation #45191

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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" />;