Skip to content

Commit 3251c3a

Browse files
authored
[materia-ui][StepIcon] Add SvgIconOwnProps type to StepIcon props (#44337)
1 parent fd97b17 commit 3251c3a

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

docs/pages/material-ui/api/step-icon.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"muiName": "MuiStepIcon",
5656
"forwardsRefTo": "SVGSVGElement",
5757
"filename": "/packages/mui-material/src/StepIcon/StepIcon.js",
58-
"inheritance": null,
58+
"inheritance": { "component": "SvgIcon", "pathname": "/material-ui/api/svg-icon/" },
5959
"demos": "<ul><li><a href=\"/material-ui/react-stepper/\">Stepper</a></li></ul>",
6060
"cssComponent": false
6161
}

packages/mui-material/src/StepIcon/StepIcon.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as React from 'react';
22
import { SxProps } from '@mui/system';
3-
import { InternalStandardProps as StandardProps } from '..';
3+
import { InternalStandardProps as StandardProps, SvgIconOwnProps } from '..';
44
import { Theme } from '../styles';
55
import { StepIconClasses } from './stepIconClasses';
66

77
export interface StepIconProps
8-
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'children'> {
8+
// TODO v7: extend React.HTMLAttributes<SVGSVGElement> as svg is root component of StepIcon not div
9+
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,
10+
Omit<SvgIconOwnProps, 'children'> {
911
/**
1012
* Whether this step is active.
1113
* @default false
@@ -46,5 +48,6 @@ export type StepIconClasskey = keyof NonNullable<StepIconProps['classes']>;
4648
* API:
4749
*
4850
* - [StepIcon API](https://mui.com/material-ui/api/step-icon/)
51+
* - inherits [SvgIcon API](https://mui.com/material-ui/api/svg-icon/)
4952
*/
5053
export default function StepIcon(props: StepIconProps): React.JSX.Element;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as React from 'react';
2+
import StepIcon from '@mui/material/StepIcon';
3+
4+
<StepIcon icon={<div>icon</div>} />;
5+
<StepIcon icon={<div>icon</div>} titleAccess="title" />;

packages/mui-material/src/StepIcon/StepIcon.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import * as React from 'react';
22
import { expect } from 'chai';
33
import { createRenderer } from '@mui/internal-test-utils';
44
import StepIcon, { stepIconClasses as classes } from '@mui/material/StepIcon';
5+
import SvgIcon from '@mui/material/SvgIcon';
56
import describeConformance from '../../test/describeConformance';
67

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

1011
describeConformance(<StepIcon icon={1} />, () => ({
1112
classes,
12-
inheritComponent: 'svg',
13+
inheritComponent: SvgIcon,
1314
render,
1415
muiName: 'MuiStepIcon',
1516
testVariantProps: { completed: true },

0 commit comments

Comments
 (0)