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

[materia-ui][StepIcon] Add SvgIconOwnProps type to StepIcon props #44337

Merged
merged 13 commits into from
Nov 14, 2024
2 changes: 1 addition & 1 deletion docs/pages/material-ui/api/step-icon.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"muiName": "MuiStepIcon",
"forwardsRefTo": "SVGSVGElement",
"filename": "/packages/mui-material/src/StepIcon/StepIcon.js",
"inheritance": null,
"inheritance": { "component": "SvgIcon", "pathname": "/material-ui/api/svg-icon/" },
"demos": "<ul><li><a href=\"/material-ui/react-stepper/\">Stepper</a></li></ul>",
"cssComponent": false
}
7 changes: 5 additions & 2 deletions packages/mui-material/src/StepIcon/StepIcon.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { InternalStandardProps as StandardProps } from '..';
import { InternalStandardProps as StandardProps, SvgIconOwnProps } from '..';
import { Theme } from '../styles';
import { StepIconClasses } from './stepIconClasses';

export interface StepIconProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'children'> {
// TODO v7: extend React.HTMLAttributes<SVGSVGElement> as svg is root component of StepIcon not div
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wait? Can't we fix this now? It's a bug fix, right?

Omit<SvgIconOwnProps, 'children'> {
/**
* Whether this step is active.
* @default false
Expand Down Expand Up @@ -46,5 +48,6 @@ export type StepIconClasskey = keyof NonNullable<StepIconProps['classes']>;
* API:
*
* - [StepIcon API](https://mui.com/material-ui/api/step-icon/)
* - inherits [SvgIcon API](https://mui.com/material-ui/api/svg-icon/)
*/
export default function StepIcon(props: StepIconProps): React.JSX.Element;
5 changes: 5 additions & 0 deletions packages/mui-material/src/StepIcon/StepIcon.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';
import StepIcon from '@mui/material/StepIcon';

<StepIcon icon={<div>icon</div>} />;
<StepIcon icon={<div>icon</div>} titleAccess="title" />;
3 changes: 2 additions & 1 deletion packages/mui-material/src/StepIcon/StepIcon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import * as React from 'react';
import { expect } from 'chai';
import { createRenderer } from '@mui/internal-test-utils';
import StepIcon, { stepIconClasses as classes } from '@mui/material/StepIcon';
import SvgIcon from '@mui/material/SvgIcon';
import describeConformance from '../../test/describeConformance';

describe('<StepIcon />', () => {
const { render } = createRenderer();

describeConformance(<StepIcon icon={1} />, () => ({
classes,
inheritComponent: 'svg',
inheritComponent: SvgIcon,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is to display Props of the SvgIcon component are also available. in props table.

https://deploy-preview-44337--material-ui.netlify.app/material-ui/api/step-icon/#props

render,
muiName: 'MuiStepIcon',
testVariantProps: { completed: true },
Expand Down