feat(modal): implement multi-step (steps) mechanism#290
Open
uttam12331 wants to merge 1 commit into
Open
Conversation
Add multi-step modal support via a new `steps` prop. Each step defines its own `elements` and is rendered one page at a time with Next/Back navigation, GSAP-animated transitions, a progress indicator and per-step titles. - Reuses the existing field rendering and validation pipeline (SerializeData, handleValidation) per step. - Next/Back replace the submit button; Next becomes submit on the final step. - Per-step validation runs before advancing; the final submit re-validates every step. - `data` and `errors` persist across steps. - Classic `elements` based modals are unaffected (the field wrapper uses display: contents when not stepped). - Adds a two-step registration example to the devbench. Closes younisdev#276
|
@uttam12331 is attempting to deploy a commit to the younis' projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
Hey @uttam12331, great work on this! I'll get to reviewing it soon! Just been a bit busy. Thanks for your patience! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the multi-step modal feature from #276. A new
stepsprop splits a modal into sequential pages withNext/Backnavigation and animated transitions, while leaving classicelementsbased modals unchanged.What it does
elementsare shown, reusing the existing field-rendering block andSerializeDatapipeline (each step is serialized through the same path).Next/Backbuttons replace the default submit button;Nextbecomes the submit action on the final step.Backis hidden on the first step.handleValidationruns against the active step before allowingNext; the final submit re-validates every step so a back-navigated/skipped step can't slip through.dataanderrorslive in shared state and persist across steps (fields are initialised once across all steps, so navigation never resets input).elementsmodals are untouched; the field wrapper usesdisplay: contentswhen not stepped, so layout is identical to before.Testing
devbench/src/component/modal.jsx), toggleable viauseSteps.npm run build -w devbenchsucceeds (96 modules transformed).Closes #276