-
Notifications
You must be signed in to change notification settings - Fork 39
feat(@dpc-sdp/ripple-ui-forms): adds ability to control form step progression [SD-1587] #1358
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
Open
dylankelly
wants to merge
5
commits into
main
Choose a base branch
from
feature/steps-control
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4dddcd9
feat(ripple-ui-forms): adds ability to control form step progression
dylankelly e35a4e6
chore(ripple-ui-forms): fix type linting
dylankelly a269fdb
feat(ripple-ui-forms): adds ability to disable step buttons
dylankelly 50ebc15
fix(ripple-ui-core): update component exports
dylankelly 33028b6
Merge branch 'main' into feature/steps-control
lambry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
246 changes: 246 additions & 0 deletions
246
packages/ripple-ui-forms/src/components/RplForm/RplFormMultiStep.stories.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,246 @@ | ||
| import type { Meta, StoryObj } from '@storybook/vue3' | ||
| import RplForm from './RplForm.vue' | ||
| import { handleEligibilityStepChange } from './fixtures/before-step-change' | ||
| import '@dpc-sdp/ripple-ui-core/style/components' | ||
|
|
||
| export default { | ||
| title: 'Forms/Multi step form', | ||
| component: RplForm | ||
| } satisfies Meta<typeof RplForm> | ||
|
|
||
| type Story = StoryObj<typeof RplForm> | ||
|
|
||
| export const DefaultStory: Story = { | ||
| name: 'Default', | ||
| render: (args) => ({ | ||
| components: { RplForm }, | ||
| setup() { | ||
| return { args } | ||
| }, | ||
| template: ` | ||
| <RplForm | ||
| v-bind="args" | ||
| :style="{ | ||
| '--local-max-width': '695px' | ||
| }" | ||
| > | ||
| <template #belowForm="{ value }"> | ||
| <div class="rpl-storybook-form-values rpl-u-margin-t-6"> | ||
| <h2 class="rpl-type-h4">Internal form values</h2> | ||
| <pre wrap>{{ value }}</pre> | ||
| </div> | ||
| </template> | ||
| </RplForm> | ||
| ` | ||
| }), | ||
| args: { | ||
| id: 'multi-step-form', | ||
| schema: [ | ||
| { | ||
| $step: true, | ||
| id: 'eligibility', | ||
| key: 'eligibility', | ||
| name: 'eligibility', | ||
| title: 'Eligibility', | ||
| nextButton: 'Next', | ||
| beforeStepChange: handleEligibilityStepChange, | ||
| schema: [ | ||
| { | ||
| $formkit: 'RplFormFieldset', | ||
| legend: 'Address', | ||
| name: 'address', | ||
| children: [ | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_organization', | ||
| name: 'organization', | ||
| label: 'Organization', | ||
| validation: [['required']], | ||
| validationMessages: { | ||
| required: 'The message field is required', | ||
| matches: 'Please enter between 10 and 50 characters' | ||
| }, | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_given_name', | ||
| name: 'given_name', | ||
| label: 'Given name', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_family_name', | ||
| name: 'family_name', | ||
| label: 'Family name', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_address_line1', | ||
| name: 'address_line1', | ||
| label: 'Street address', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_address_line2', | ||
| name: 'address_line2', | ||
| label: 'Street address line 2', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_locality', | ||
| name: 'locality', | ||
| label: 'Suburb', | ||
| columnClasses: 'rpl-col-12 rpl-col-5-m', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'RplFormDropdown', | ||
| id: 'forms_address_administrative_area', | ||
| name: 'administrative_area', | ||
| label: 'State', | ||
| columnClasses: 'rpl-col-12 rpl-col-5-m', | ||
| options: [ | ||
| { | ||
| id: 'VIC', | ||
| value: 'VIC', | ||
| label: 'Victoria' | ||
| }, | ||
| { | ||
| id: 'NSW', | ||
| value: 'NSW', | ||
| label: 'New South Wales' | ||
| }, | ||
| { | ||
| id: 'WA', | ||
| value: 'WA', | ||
| label: 'Western Australia' | ||
| }, | ||
| { | ||
| id: 'QLD', | ||
| value: 'QLD', | ||
| label: 'Queensland' | ||
| }, | ||
| { | ||
| id: 'ACT', | ||
| value: 'ACT', | ||
| label: 'Australian Capital Territory' | ||
| }, | ||
| { | ||
| id: 'NT', | ||
| value: 'NT', | ||
| label: 'Northern Territory' | ||
| }, | ||
| { | ||
| id: 'SA', | ||
| value: 'SA', | ||
| label: 'South Australia' | ||
| }, | ||
| { | ||
| id: 'TAS', | ||
| value: 'TAS', | ||
| label: 'Tasmania' | ||
| } | ||
| ], | ||
| validation: [], | ||
| value: '', | ||
| pii: false | ||
| }, | ||
| { | ||
| $formkit: 'RplFormText', | ||
| id: 'forms_address_postal_code', | ||
| name: 'postal_code', | ||
| label: 'Postcode', | ||
| columnClasses: 'rpl-col-6 rpl-col-3-m', | ||
| validation: [], | ||
| value: '' | ||
| }, | ||
| { | ||
| $formkit: 'hidden', | ||
| id: 'forms_address_country_code', | ||
| name: 'country_code', | ||
| value: 'AU' | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| $step: true, | ||
| id: 'not-eligible', | ||
| key: 'not-eligible', | ||
| name: 'not-eligible', | ||
| title: 'Not eligible', | ||
| nextButton: 'Exit', | ||
| prevButton: 'Go backwards', | ||
| beforeStepChange: handleEligibilityStepChange, | ||
| parentStep: 'eligibility', | ||
| schema: [ | ||
| { | ||
| $el: 'div', | ||
| attrs: { | ||
| class: 'rpl-content' | ||
| }, | ||
| children: [ | ||
| { | ||
| $el: 'p', | ||
| children: | ||
| 'Unfortunately, based on the information you have provided, you are not eligible to apply for this grant.' | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| $step: true, | ||
| id: 'eligible', | ||
| key: 'eligible', | ||
| name: 'eligible', | ||
| title: 'You are eligible', | ||
| nextButton: 'Go forwards', | ||
| prevButton: 'Go backwards', | ||
| beforeStepChange: handleEligibilityStepChange, | ||
| parentStep: 'eligibility', | ||
| schema: [ | ||
| { | ||
| $el: 'div', | ||
| attrs: { | ||
| class: ['rpl-content', 'rpl-u-padding-b-4'] | ||
| }, | ||
| children: [ | ||
| { | ||
| $el: 'p', | ||
| children: | ||
| 'Congratulations! Based on the information you have provided, you are eligible to apply for this grant.' | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| $step: true, | ||
| id: 'review', | ||
| key: 'review', | ||
| name: 'review', | ||
| title: 'Review', | ||
| nextButton: 'Submit', | ||
| prevButton: 'Go backwards', | ||
| schema: [ | ||
| { | ||
| $formkit: 'RplFormReview', | ||
| key: 'review_component' | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.