npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-flow-controller

v0.0.5

Published

The Flow Controller is a component that consists of several steps and dictates the order that the steps can be used, notifies the user of the current progress through the steps, and what steps are remaining.

Downloads

3

Readme

React Flow Controller

The Flow Controller is a component that consists of several steps and dictates the order that the steps can be used, notifies the user of the current progress through the steps, and what steps are remaining.

Purpose

The purpose of this package is the following:

  1. Provide a clean, simple interface for creating a user interface that directs the user through a sequence of steps.
  2. This interface will enable a very flexible system for styling the UI.
  3. The flow controller will be agnostic to the functioning of its child components except insofar as they permit the verification of the individual components, each referred to as a step.

Usage

Installation

Run $ yarn add react-flow-controller

Requirements

  1. React Flow Controller requires the use of React Router
  2. Run yarn add react-router-dom in your project
  3. If its is not already somewhere in your project, add a <Router/> - specifically BrowserRouter. This component is needed in order to use Link and link to the first step of your flow controller.

Props

  1. title - optional string
  2. completionIndicator - optional react component that itself takes an isCompleted prop. Any other props for this component will be ignored. By default a component is provided to render a check mark next to the step title in the progress indicator. If not completion indicator is desired, you can pass completionIndicator={() => null} to the <FlowControllerRenderer/>, but what fun is that?
  3. steps - this prop is an array of objects with the shape
{
    component: React component
    label: string,
    link: string,
    isCompleted: boolean,
}

Since the component that makes up a step will nearly by necessity take props itself, the way to format these components is like so:

...
component: ReactComponent({prop1: prop1})
...

Integration

React Flow Controller is agnostic to the functioning of the individual step components except that each step component must be able to signal that the work taking place there is complete and the user can advance to the next step. See the

  1. Add a <FlowControllerRenderer> element somewhere within the router.
  2. Use a <Link> element somewhere will load the Flow Controller. If the location where the Flow Controller is launched is a nested route, the <Link> to property should use match.pathname as detailed here so that the Flow Controller will add as another nested set of routes.
  3. <FlowControllerRenderer> takes three props, title and completionIndicator are optional as detailed above, while steps is more involved.
  4. When the work in each step is completed - thereby changing appropriate member of the steps array's isCompleted property, the Flow Controller will allow the user to advance to the next step, either by the "Next" button or by using the links in the Progress Indicator. When all the steps have isCompleted true, the "Finish" button will be enabled. Upon clicking "Finish" the url will return to where the flow controller began.

Styling

  • All the elements of the Flow Controller have CSS class names to enable whatever sort of styling is desired.
  • The example included shows how these classes may be used.
  • There is a default styles .css file included - import it with import react-flow-controller/dist/DefaultStyles.css

Examples

Both examples share the same components.

  1. Example where the Flow Controller is nested within other routes
  1. Example where the Flow Controller is not nested

MVP Features

  • Enable adding or removing the controller
  • Have a system for moving through steps
  • Have a system for determining which steps are verified and which are not.
  • Redirect to last verified step if attempting to navigate to an unverified step.
  • Include a progress indicator that can also link to previous steps
  • Last step will have a button labeled "FINISH"

This project was bootstrapped with Create React App.