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

[Stepper] Add support for expanding all the steps #19200

Merged
merged 1 commit into from
Jan 13, 2020
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
1 change: 1 addition & 0 deletions docs/pages/api/step.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">completed</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Mark the step as completed. Is passed to child components. |
| <span class="prop-name">disabled</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Mark the step as disabled, will also disable the button if `StepButton` is a child of `Step`. Is passed to child components. |
| <span class="prop-name">expanded</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Expand the step. |

The `ref` is forwarded to the root element.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api/stepper.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi

| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">activeStep</span> | <span class="prop-type">number</span> | <span class="prop-default">0</span> | Set the active step (zero based index). |
| <span class="prop-name">activeStep</span> | <span class="prop-type">number</span> | <span class="prop-default">0</span> | Set the active step (zero based index). Set to -1 to disable all the steps. |
| <span class="prop-name">alternativeLabel</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If set to 'true' and orientation is horizontal, then the step label will be positioned under the icon. |
| <span class="prop-name required">children&nbsp;*</span> | <span class="prop-type">node</span> | | Two or more `<Step />` components. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
Expand Down
6 changes: 6 additions & 0 deletions packages/material-ui/src/Step/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const Step = React.forwardRef(function Step(props, ref) {
completed = false,
connector,
disabled = false,
expanded = false,
index,
last,
orientation,
Expand Down Expand Up @@ -85,6 +86,7 @@ const Step = React.forwardRef(function Step(props, ref) {
alternativeLabel,
completed,
disabled,
expanded,
last,
icon: index + 1,
orientation,
Expand Down Expand Up @@ -132,6 +134,10 @@ Step.propTypes = {
* `StepButton` is a child of `Step`. Is passed to child components.
*/
disabled: PropTypes.bool,
/**
* Expand the step.
*/
expanded: PropTypes.bool,
/**
* @ignore
* Used internally for numbering.
Expand Down
7 changes: 6 additions & 1 deletion packages/material-ui/src/StepContent/StepContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const StepContent = React.forwardRef(function StepContent(props, ref) {
classes,
className,
completed,
expanded,
last,
optional,
orientation,
Expand All @@ -57,7 +58,7 @@ const StepContent = React.forwardRef(function StepContent(props, ref) {
return (
<div className={clsx(classes.root, { [classes.last]: last }, className)} ref={ref} {...other}>
<TransitionComponent
in={active}
in={active || expanded}
className={classes.transition}
timeout={transitionDuration}
unmountOnExit
Expand Down Expand Up @@ -97,6 +98,10 @@ StepContent.propTypes = {
* @ignore
*/
completed: PropTypes.bool,
/**
* @ignore
*/
expanded: PropTypes.bool,
/**
* @ignore
*/
Expand Down
8 changes: 5 additions & 3 deletions packages/material-ui/src/StepLabel/StepLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const StepLabel = React.forwardRef(function StepLabel(props, ref) {
completed = false,
disabled = false,
error = false,
expanded,
icon,
last,
optional,
Expand Down Expand Up @@ -143,12 +144,10 @@ const StepLabel = React.forwardRef(function StepLabel(props, ref) {
StepLabel.propTypes = {
/**
* @ignore
* Sets the step as active. Is passed to child components.
*/
active: PropTypes.bool,
/**
* @ignore
* Set internally by Stepper when it's supplied with the alternativeLabel prop.
*/
alternativeLabel: PropTypes.bool,
/**
Expand All @@ -166,7 +165,6 @@ StepLabel.propTypes = {
className: PropTypes.string,
/**
* @ignore
* Mark the step as completed. Is passed to child components.
*/
completed: PropTypes.bool,
/**
Expand All @@ -178,6 +176,10 @@ StepLabel.propTypes = {
* Mark the step as failed.
*/
error: PropTypes.bool,
/**
* @ignore
*/
expanded: PropTypes.bool,
/**
* Override the default label of the step icon.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/src/Stepper/Stepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const Stepper = React.forwardRef(function Stepper(props, ref) {
Stepper.propTypes = {
/**
* Set the active step (zero based index).
* Set to -1 to disable all the steps.
*/
activeStep: PropTypes.number,
/**
Expand Down