Skip to content

Commit

Permalink
[materia-ui][StepIcon] Add SvgIconOwnProps type to StepIcon props (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 authored Nov 14, 2024
1 parent fd97b17 commit 3251c3a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
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'>,
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,
render,
muiName: 'MuiStepIcon',
testVariantProps: { completed: true },
Expand Down

0 comments on commit 3251c3a

Please sign in to comment.