From dfd6610cb1ab29bd203aba054b6450585178750c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Argot?= Date: Thu, 17 May 2018 14:17:27 +0200 Subject: [PATCH 1/3] Allow to have a stepIconProps property to be passed to --- packages/material-ui/src/StepLabel/StepLabel.d.ts | 1 + packages/material-ui/src/StepLabel/StepLabel.js | 14 +++++++++++++- .../material-ui/src/StepLabel/StepLabel.test.js | 5 ++++- pages/api/step-label.md | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/material-ui/src/StepLabel/StepLabel.d.ts b/packages/material-ui/src/StepLabel/StepLabel.d.ts index 2fb2d16aaeed48..bea0ff04e99e29 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.d.ts +++ b/packages/material-ui/src/StepLabel/StepLabel.d.ts @@ -15,6 +15,7 @@ export interface StepLabelProps last?: boolean; optional?: React.ReactNode; orientation?: Orientation; + stepIconProps?: object; } export type StepLabelClasskey = diff --git a/packages/material-ui/src/StepLabel/StepLabel.js b/packages/material-ui/src/StepLabel/StepLabel.js index 3627e79f1e6d52..6352995929ba57 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.js +++ b/packages/material-ui/src/StepLabel/StepLabel.js @@ -66,6 +66,7 @@ function StepLabel(props) { last, optional, orientation, + stepIconProps, ...other } = props; @@ -89,7 +90,14 @@ function StepLabel(props) { [classes.alternativeLabel]: alternativeLabel, })} > - + )} @@ -165,6 +173,10 @@ StepLabel.propTypes = { * @ignore */ orientation: PropTypes.oneOf(['horizontal', 'vertical']), + /** + * The properties passed to the child . + */ + stepIconProps: PropTypes.object, }; StepLabel.defaultProps = { diff --git a/packages/material-ui/src/StepLabel/StepLabel.test.js b/packages/material-ui/src/StepLabel/StepLabel.test.js index 9e666612e688c4..d55a20dc7053ca 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.test.js +++ b/packages/material-ui/src/StepLabel/StepLabel.test.js @@ -44,8 +44,9 @@ describe('', () => { }); it('renders ', () => { + const stepIconProps = { prop1: 'value1', prop2: 'value2' }; const wrapper = shallow( - + Step One , ); @@ -53,6 +54,8 @@ describe('', () => { assert.strictEqual(stepIcon.length, 1, 'should have an '); const props = stepIcon.props(); assert.strictEqual(props.icon, 1, 'should set icon'); + assert.strictEqual(props.prop1, 'value1', 'should have inherited custom prop1'); + assert.strictEqual(props.prop2, 'value2', 'should have inherited custom prop2'); }); }); diff --git a/pages/api/step-label.md b/pages/api/step-label.md index d164b1c781c47e..0d6caee62139ad 100644 --- a/pages/api/step-label.md +++ b/pages/api/step-label.md @@ -18,6 +18,7 @@ filename: /packages/material-ui/src/StepLabel/StepLabel.js | error | bool | false | Mark the step as failed. | | icon | node | | Override the default icon. | | optional | node | | The optional node to display. | +| stepIconProps | object | | The properties passed to the child `StepIcon`. | Any other properties supplied will be [spread to the root element](/guides/api#spread). From b002ae18f9b2fcddc4e0b52751bf2e82d3d315b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Argot?= Date: Fri, 18 May 2018 12:14:22 +0200 Subject: [PATCH 2/3] Renamed stepIconProps as StepIconProps --- packages/material-ui/src/StepLabel/StepLabel.d.ts | 2 +- packages/material-ui/src/StepLabel/StepLabel.js | 6 +++--- packages/material-ui/src/StepLabel/StepLabel.test.js | 2 +- pages/api/step-label.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/material-ui/src/StepLabel/StepLabel.d.ts b/packages/material-ui/src/StepLabel/StepLabel.d.ts index bea0ff04e99e29..2c52f074bc931a 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.d.ts +++ b/packages/material-ui/src/StepLabel/StepLabel.d.ts @@ -15,7 +15,7 @@ export interface StepLabelProps last?: boolean; optional?: React.ReactNode; orientation?: Orientation; - stepIconProps?: object; + StepIconProps?: object; } export type StepLabelClasskey = diff --git a/packages/material-ui/src/StepLabel/StepLabel.js b/packages/material-ui/src/StepLabel/StepLabel.js index 6352995929ba57..09165a45d7d180 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.js +++ b/packages/material-ui/src/StepLabel/StepLabel.js @@ -66,7 +66,7 @@ function StepLabel(props) { last, optional, orientation, - stepIconProps, + StepIconProps, ...other } = props; @@ -96,7 +96,7 @@ function StepLabel(props) { error={error} icon={icon} alternativeLabel={alternativeLabel} - {...stepIconProps} + {...StepIconProps} /> )} @@ -176,7 +176,7 @@ StepLabel.propTypes = { /** * The properties passed to the child . */ - stepIconProps: PropTypes.object, + StepIconProps: PropTypes.object, }; StepLabel.defaultProps = { diff --git a/packages/material-ui/src/StepLabel/StepLabel.test.js b/packages/material-ui/src/StepLabel/StepLabel.test.js index d55a20dc7053ca..a262854e7a94e7 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.test.js +++ b/packages/material-ui/src/StepLabel/StepLabel.test.js @@ -46,7 +46,7 @@ describe('', () => { it('renders ', () => { const stepIconProps = { prop1: 'value1', prop2: 'value2' }; const wrapper = shallow( - + Step One , ); diff --git a/pages/api/step-label.md b/pages/api/step-label.md index 0d6caee62139ad..20eec3fda064b9 100644 --- a/pages/api/step-label.md +++ b/pages/api/step-label.md @@ -18,7 +18,7 @@ filename: /packages/material-ui/src/StepLabel/StepLabel.js | error | bool | false | Mark the step as failed. | | icon | node | | Override the default icon. | | optional | node | | The optional node to display. | -| stepIconProps | object | | The properties passed to the child `StepIcon`. | +| StepIconProps | object | | The properties passed to the child `StepIcon`. | Any other properties supplied will be [spread to the root element](/guides/api#spread). From a062808d37fb911c46811c128d331ff7dfcf98e0 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 19 May 2018 18:17:30 +0200 Subject: [PATCH 3/3] ready to merge :) --- packages/material-ui/src/StepLabel/StepLabel.d.ts | 3 ++- packages/material-ui/src/StepLabel/StepLabel.js | 3 +-- pages/api/step-label.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/material-ui/src/StepLabel/StepLabel.d.ts b/packages/material-ui/src/StepLabel/StepLabel.d.ts index 2c52f074bc931a..7cd20ee23f9df0 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.d.ts +++ b/packages/material-ui/src/StepLabel/StepLabel.d.ts @@ -2,6 +2,7 @@ import * as React from 'react'; import { StandardProps } from '..'; import { Orientation } from '../Stepper'; import { StepButtonIcon } from '../StepButton'; +import { StepIconProps } from '../StepIcon'; export interface StepLabelProps extends StandardProps, StepLabelClasskey> { @@ -15,7 +16,7 @@ export interface StepLabelProps last?: boolean; optional?: React.ReactNode; orientation?: Orientation; - StepIconProps?: object; + StepIconProps?: Partial; } export type StepLabelClasskey = diff --git a/packages/material-ui/src/StepLabel/StepLabel.js b/packages/material-ui/src/StepLabel/StepLabel.js index 09165a45d7d180..123803b50f6b3e 100644 --- a/packages/material-ui/src/StepLabel/StepLabel.js +++ b/packages/material-ui/src/StepLabel/StepLabel.js @@ -95,7 +95,6 @@ function StepLabel(props) { active={active} error={error} icon={icon} - alternativeLabel={alternativeLabel} {...StepIconProps} /> @@ -174,7 +173,7 @@ StepLabel.propTypes = { */ orientation: PropTypes.oneOf(['horizontal', 'vertical']), /** - * The properties passed to the child . + * Properties applied to the `StepIcon` element. */ StepIconProps: PropTypes.object, }; diff --git a/pages/api/step-label.md b/pages/api/step-label.md index 20eec3fda064b9..83cdeb7a5f2e6e 100644 --- a/pages/api/step-label.md +++ b/pages/api/step-label.md @@ -18,7 +18,7 @@ filename: /packages/material-ui/src/StepLabel/StepLabel.js | error | bool | false | Mark the step as failed. | | icon | node | | Override the default icon. | | optional | node | | The optional node to display. | -| StepIconProps | object | | The properties passed to the child `StepIcon`. | +| StepIconProps | object | | Properties applied to the `StepIcon` element. | Any other properties supplied will be [spread to the root element](/guides/api#spread).