-
Notifications
You must be signed in to change notification settings - Fork 376
feat(WizardComposable): Created composable spinoff of wizard w/ enhancements #7703
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
feat(WizardComposable): Created composable spinoff of wizard w/ enhancements #7703
Conversation
1a9b7da to
fc1abb7
Compare
|
Preview: https://patternfly-react-pr-7703.surge.sh A11y report: https://patternfly-react-pr-7703-a11y.surge.sh |
ab0c8ac to
735f2e1
Compare
nicolethoen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird observation, half of the components in the side nav are missing?
Also, i think this is really great!
@thatblindgeye has just done some work on improving documentation for composable components included in this PR. It think it'd be good to include the prop table descriptions like he did for the File upload - multiple documentations, as well as the composable structure section.
| import FinishedStep from './FinishedStep'; | ||
| import SampleForm from './SampleForm'; | ||
|
|
||
| If you seek a Wizard solution that allows for more composition, see the [React composition](/components/wizard/react-composition) tab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React composable not react composition
| <StepWithCustomFooter /> | ||
| </WizardComposableStep> | ||
| <WizardComposableStep id="fourth-step" name="Fourth step"> | ||
| Step 4 content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the 4th step include a drawer maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think since step 1 has a drawer already, it's probably not needed. What I can do though is make it a custom component (not use WizardComposableStep), which would be another form of uniqueness to add to the sink.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I didn't even realize it for step 1.
So if you want to add more uniqueness to the sink, that's up to you.
@nicolethoen Good catch on the left nav. I think that should be fixed now. Also added descriptions to the interfaces for those Composable prop tables & added a "Structure" section as well. |
6867956 to
d24c010
Compare
nicolethoen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jenny-s51
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work on an exciting new Wizard implementation @jeffpuzzo ! Will be a fantastic new addition to PF4!
Left a couple of suggestions to update the copy, which should help us align it more with the composable table copy! What do you think?
Otherwise LGTM!
| import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon'; | ||
| import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-icon'; | ||
|
|
||
| PatternFly has two implementations of a `Wizard`, where the latest `WizardComposable`. Its temporary name speaks to the improvements made to the composition of the Wizard and its ansillary components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PatternFly has two implementations of a `Wizard`, where the latest `WizardComposable`. Its temporary name speaks to the improvements made to the composition of the Wizard and its ansillary components. | |
| PatternFly has two implementations of a `Wizard`. | |
| The first is the newest `WizardComposable`. It takes a more explicit and declarative approach. Its temporary name speaks to the improvements made to the composition of the Wizard and its ancillary components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That first sentence I had definitely didn't sound right, so thanks for this suggestion. The changes have been made.
|
|
||
| PatternFly has two implementations of a `Wizard`, where the latest `WizardComposable`. Its temporary name speaks to the improvements made to the composition of the Wizard and its ansillary components. | ||
|
|
||
| The documentation for the older `Wizard` implementation can be found under the [React legacy](/components/wizard/react-legacy) tab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The documentation for the older `Wizard` implementation can be found under the [React legacy](/components/wizard/react-legacy) tab. | |
| The second is the original `Wizard` component. It is configuration-based and takes a less declarative and more implicit approach. The documentation for the older `Wizard` implementation can be found under the [React legacy](/components/wizard/react-legacy) tab. |
jenny-s51
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
packages/react-core/src/components/WizardComposable/examples/WizardComposable.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/WizardComposable/examples/WizardComposable.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/WizardComposable/examples/WizardComposable.md
Outdated
Show resolved
Hide resolved
e719e61 to
2e1f205
Compare
thatblindgeye
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the updates! Only have a couple more things below
| aria-label={ariaLabel} | ||
| aria-labelledby={ariaLabelledBy} | ||
| className={css(styles.wizardMain)} | ||
| {...(Wrapper === 'div' && { role: 'main' })} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe we should set role="main" on the component anywhere, just because it's best practice to only include one main role/element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is what inspired the idea: https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Wizard/WizardToggle.tsx#L96, but I can see where some divs might not want that role defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah interesting. So in terms of a modal-like Wizard, setting a main within the Wizard can work as long as we hide any other main elements/roles on the page. Testing the basic wizard example out a little, I added the isOpen prop to it to get a <main> element rendered in the wizard body, then ran aXe and didn't get any errors regarding any main element.
Once I removed aria-hidden="true" on the #root div, though, aXe flagged some things regarding the two main elements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into that, because I was curious as well.
|
|
||
| export const WizardBasic: React.FunctionComponent = () => ( | ||
| <WizardComposable height={400}> | ||
| <WizardComposableStep name="First step" id="first-step"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to all WizardComposableStep components in all three examples, but they just need to have unique IDs across examples rather than each having a step with id "first-step", etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting that in some cases we make the examples use a different naming convention for the unique ids?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah when you reuse id's in examples, then we have duplicate ids in the docs. so maybe the composable steps in the basic example can have ids like "basic-first-step"
tlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far Jeff! I think we want to nail down the naming of new components before taking this one in.
c167c9b to
fd2a892
Compare
nicolethoen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffpuzzo @tlabaj this is failing because there is still something wrong with the full page demos in this PR and the a11y tests is trying to test them. I think we might need to re-address the changes made in org for this PR to fix the full page demos
fd2a892 to
6e00aff
Compare
tlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great Jeff! I have some nit comments.
These are things we can work towards since tis is Beta.
- We also need to figure out the documentation for certain types and functions.
- We will also want to build up the examples so we demonstrate functionality we had with the current wizard.
| import FinishedStep from './FinishedStep'; | ||
| import SampleForm from './SampleForm'; | ||
|
|
||
| If you seek a Wizard solution that allows for more composition, see the [React next](/components/wizard/react-next) tab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. Wizard should be lowercase here.
packages/react-core/src/next/components/Wizard/examples/WizardKitchenSink.tsx
Outdated
Show resolved
Hide resolved
| ```ts file="./WizardBasic.tsx" | ||
| ``` | ||
|
|
||
| ### Custom Nav |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. could this be updated to "Custom navigation"
| ```ts file="./WizardCustomNav.tsx" | ||
| ``` | ||
|
|
||
| ### Kitchen Sink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. this one should be sentence case please.
|
|
||
| /** | ||
| * Wrapper for all steps and hosts state, including navigation helpers, within context. | ||
| * The WizardContext provided by default gives any child of Wizard access to those resources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. wizard her should be lowercase.
| nav?: DefaultWizardNavProps | CustomWizardNavFunction; | ||
| /** The initial index the wizard is to start on (1 or higher). Defaults to 1. */ | ||
| startIndex?: number; | ||
| /** Additional classes spread to the Wizard */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. lowercase wizard
| height?: number | string; | ||
| /** Callback function when a step in the nav is clicked */ | ||
| onNavByIndex?: WizardNavStepFunction; | ||
| /** Callback function after Next button is clicked */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. lowercase next
| onNavByIndex?: WizardNavStepFunction; | ||
| /** Callback function after Next button is clicked */ | ||
| onNext?: WizardNavStepFunction; | ||
| /** Callback function after Back button is clicked */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. lowercase back.
| export * from './WizardToggle'; | ||
| export * from './WizardStep'; | ||
| export { useWizardFooter } from './hooks/useWizardFooter'; | ||
| export * from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to export all the types her for consumption, they should be documented on the website.
|
@mcarrano @mmenestr This PR add the new composable wizard with the naming and documentation standards we had proposed. Please take a look at the React next tab and let us know if you have any concerns with naming. cc @jeffpuzzo |
|
I think the examples look good @tlabaj @jeffpuzzo with the assumption that we can continue to add to this. So is "React next" the labeling we want to apply to these types of new and improved components? It deviates from what we've done elsewhere with using "Legacy." We might need more discussion on how to talk this presentation on the website, i.e. as a consumer of PatternFly do I know what "React next" means? |
@mcarrano the tab name can easily be changed if it is determined to not be meaningful enough. We did meet with Sam in terms of naming the import paths for the new components and "next" is what we proposed. That is why we decided to name the tab "React next". |
…ate path alias, export as separate module
2468984 to
08077a2
Compare
08077a2 to
5982c3f
Compare
tlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great. The new Hooks section is a great addition. THere are still a few prop types that are not documented e.g. DefaultWizardFooterProps
|
|
||
| /** Initially inferred from WizardStep components, these properties represent what is controllable from within WizardContext for a given step. */ | ||
|
|
||
| export interface Step { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically if an exported type/enum/interface is directly related to a component and we do no have the intention of using it elsewhere, we prefix it with component name. This also helps avoiding collisions. Maybe rename it to WizardControllableStep?
This comment also applies to the SubStep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure if users will need access to DefaultWizardFooterProps or other types within the types file outside of Step & SubStep, which is why the index file was updated to only expose those 2;
| import * as Types from './types'; | |
| export type Step = Types.Step; | |
| export type SubStep = Types.SubStep; |
Users would need to use an import statement like the following in order to access them:
import { DefaultWizardFooterProps } from '@patternfly/react-core/src/next/components/Wizard/types';.
Is our policy that if the user can access something exported in any fashion they need to be visible in our docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think If the consumer is required to use the types, it should be documented.
The reason I mention DefaultWizardFooterProps is because it is in the prop table. If something is in the prop table I think it should be defined since it is something the consumer would need to know the definition of to use it.
7a7448e to
d1a70a9
Compare
…xt' doc for Wizard
d1a70a9 to
78a090b
Compare
…gside other 'next' components, update documentation to describe types and update comments for those types in their respective locations
| /** Callback function after back button is clicked */ | ||
| onBack?: WizardNavStepFunction; | ||
| /** Callback function to save at the end of the wizard, if not specified uses onClose */ | ||
| onSave?(): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For documentation purposes, can you define the functions as onSave?: () => void;. The way this is defined it is showing the prop type as void an has no default value definition
tlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that none of the Prop interfaces are listing default values in the docs. Even the props that not defaulted to undefined are blank.
@tlabaj Should be good with the latest changes. Turns out specifying |
tlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great Jeff!
|
Your changes have been released in:
Thanks for your contribution! 🎉 |


What: Closes #7663
Depends on:
Note:
React composablein the/wizard/componentsdoc, and the older wizard examples still reside in aReact legacytab (mimicking the composable table doc approach).