Skip to content

Conversation

@jpuzz0
Copy link
Contributor

@jpuzz0 jpuzz0 commented Jul 15, 2022

What: Closes #7663
Depends on:

Note:

  • Unit tests for ancillary wizard components will be included in a follow-up PR.
  • 3 starting Examples have been made under a new tab called React composable in the /wizard/components doc, and the older wizard examples still reside in a React legacy tab (mimicking the composable table doc approach).

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from 1a9b7da to fc1abb7 Compare July 15, 2022 20:50
@patternfly-build
Copy link
Collaborator

patternfly-build commented Jul 15, 2022

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch 7 times, most recently from ab0c8ac to 735f2e1 Compare July 19, 2022 19:47
@nicolethoen nicolethoen requested a review from jenny-s51 July 20, 2022 17:27
Copy link
Contributor

@nicolethoen nicolethoen left a 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.
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@jpuzz0
Copy link
Contributor Author

jpuzz0 commented Jul 21, 2022

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.

@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.

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from 6867956 to d24c010 Compare July 21, 2022 16:07
Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jenny-s51 jenny-s51 left a 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.
Copy link
Contributor

@jenny-s51 jenny-s51 Jul 25, 2022

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

@jpuzz0 jpuzz0 Jul 26, 2022

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

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

👍👍

@nicolethoen nicolethoen requested a review from tlabaj July 27, 2022 14:15
@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from e719e61 to 2e1f205 Compare July 27, 2022 17:42
Copy link
Contributor

@thatblindgeye thatblindgeye 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 making the updates! Only have a couple more things below

aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
className={css(styles.wizardMain)}
{...(Wrapper === 'div' && { role: 'main' })}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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:

Modal wizard elements pane

Copy link
Contributor Author

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">
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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"

Copy link
Contributor

@tlabaj tlabaj left a 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.

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch 2 times, most recently from c167c9b to fd2a892 Compare August 18, 2022 19:35
Copy link
Contributor

@nicolethoen nicolethoen left a 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

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from fd2a892 to 6e00aff Compare August 19, 2022 15:23
Copy link
Contributor

@tlabaj tlabaj left a 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.
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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.

```ts file="./WizardBasic.tsx"
```

### Custom Nav
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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.
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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 */
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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 */
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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 */
Copy link
Contributor

@tlabaj tlabaj Aug 19, 2022

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';
Copy link
Contributor

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.

@tlabaj tlabaj requested review from mcarrano and mmenestr August 19, 2022 17:13
@tlabaj
Copy link
Contributor

tlabaj commented Aug 19, 2022

@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.
This is a beta components so will be continuing to work on documentation of use cases that were supported by the current wizard.

cc @jeffpuzzo

@mcarrano
Copy link
Member

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?

@tlabaj
Copy link
Contributor

tlabaj commented Aug 19, 2022

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".

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from 2468984 to 08077a2 Compare August 19, 2022 20:45
@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from 08077a2 to 5982c3f Compare August 19, 2022 20:51
Copy link
Contributor

@tlabaj tlabaj left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

image

@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from 7a7448e to d1a70a9 Compare August 22, 2022 18:18
@jpuzz0 jpuzz0 force-pushed the feature/composable-wizard branch from d1a70a9 to 78a090b Compare August 22, 2022 18:20
jpuzz0 added 2 commits August 23, 2022 13:28
…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;
Copy link
Contributor

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

Copy link
Contributor

@tlabaj tlabaj left a 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.

@jpuzz0
Copy link
Contributor Author

jpuzz0 commented Aug 23, 2022

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 WizardStepProps vs WizardStep (as an example) does not include those defaults.

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

Looks great Jeff!

@nicolethoen nicolethoen merged commit 76eab29 into patternfly:main Aug 23, 2022
@patternfly-build
Copy link
Collaborator

Your changes have been released in:

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wizard - Improve composability

7 participants