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] Export useStepperContext #31398

Merged
merged 10 commits into from
May 9, 2022
Merged

Conversation

pzi
Copy link
Contributor

@pzi pzi commented Mar 10, 2022

Pretty much a similar PR to #31021 except this one is targeting the StepperContext as opposed to the StepContext.

I believe this would close #31277 as it would then expose both contexts that @jedimonkey was looking for (note: I work on the same project as @jedimonkey).

Additional context:
We are using the StepperContext to grab the activeStep and compare it to stepContext.index to return 100 or 0 progress value for a LinearProgress component sitting in between steps.

@mui-bot
Copy link

mui-bot commented Mar 10, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 13ecf9d

@pzi pzi marked this pull request as ready for review March 10, 2022 05:59
@pzi pzi mentioned this pull request Mar 10, 2022
2 tasks
@danilo-leal danilo-leal added the component: stepper This is the name of the generic UI component, not the React module! label Mar 11, 2022
@pzi
Copy link
Contributor Author

pzi commented Mar 16, 2022

@danilo-leal are you able to kick off or ask someone to kick off the workflows at least, please? 😬

@pzi
Copy link
Contributor Author

pzi commented Mar 22, 2022

@hbjORbj is it possible to get this looked at by someone @mui, please? or even just get the workflows kicked off, please?

@hbjORbj
Copy link
Member

hbjORbj commented Mar 22, 2022

Hi. Thanks for opening the pull request.

I ran the workflows as you requested.

Many CI tests are failing, so please address them first. You will find this guide useful: https://github.com/mui/material-ui/blob/master/CONTRIBUTING.md#how-to-increase-the-chance-of-being-accepted

@pzi
Copy link
Contributor Author

pzi commented Mar 23, 2022

Hey @hbjORbj , my bad. Copy/paste error. Fixed now and rebased on master.

@pzi
Copy link
Contributor Author

pzi commented Mar 25, 2022

Would be awesome to get this into the next release if possible please @hbjORbj

@pzi
Copy link
Contributor Author

pzi commented Apr 4, 2022

@eps1lon is it possible to get this reviewed, please? It's been sitting here ready to go for 12d :/

@pzi
Copy link
Contributor Author

pzi commented Apr 19, 2022

Can someone please review this? Apparently argos detected changes (that have nothing to do with the content of this PR)... This has been open for more than a month now...

Edit: Looks like argos is ok again. please review and merge if you agree with the proposed changes.

@pzi
Copy link
Contributor Author

pzi commented Apr 26, 2022

@mnajdova Would you mind reviewing this PR, please?

@pzi
Copy link
Contributor Author

pzi commented May 3, 2022

@siriwatknp would you mind reviewing this PR, please?

@siriwatknp
Copy link
Member

@siriwatknp would you mind reviewing this PR, please?

Sure, I am reviewing it.

@siriwatknp siriwatknp self-requested a review May 3, 2022 03:54
Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍 Thanks for the contribution and so sorry for the delay. It will be released next week!

@pzi
Copy link
Contributor Author

pzi commented May 3, 2022

👍 Thanks for the contribution and so sorry for the delay. It will be released next week!

Awesome, thanks for getting back to me @siriwatknp, looking forward to being able to use the StepperContext soon.

@Moshyfawn
Copy link

Moshyfawn commented May 3, 2022

Hey, a great proposal, very convenient!

I'm tinkering with an idea of exposing the Stepper methods along the Stepper state.

IK MUI doesn't provide functions to update the activeStep out the box; something like goToNextStep. It leaves the implementation to the user, which pushes them to create an additional context to expose such methods.

const Funnel = () => (
  <Stepper activeStep={1}>
    <Step>
      <StepLabel>Label</StepLabel>
    </Step>
  </Stepper>
  <StepperMethodsProvider>
    <StepComponent />
  </StepperMethodsProvider>
)

const StepComponent = () => {
  const { goToNextPage } = useStepperMethods()
}

Is this the idiomatic way to deal with providing the custom Stepper methods by creating a custom StepperMethodsProvider or would it be a good idea to propose a unified Stepper interface to potentially expose them down the React tree?

@siriwatknp
Copy link
Member

@Moshyfawn Thanks for the feedback. Can you open a new issue and provide a Code sandbox that replicates what you need?

If there are more people upvoting on the issues, we might work on it. Let's discuss first.

@Moshyfawn
Copy link

@Moshyfawn Thanks for the feedback. Can you open a new issue and provide a Code sandbox that replicates what you need?

If there are more people upvoting on the issues, we might work on it. Let's discuss first.

Got it! Thank you for your amazing work!

@michaldudak michaldudak merged commit 5f98540 into mui:master May 9, 2022
@pzi pzi deleted the export-steppercontext branch May 10, 2022 01:43
@pzi
Copy link
Contributor Author

pzi commented May 10, 2022

Thanks for the merge @michaldudak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: stepper This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Stepper] Expose Step/Stepper contexts
7 participants