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

megawizard

v4.1.0

Published

Reactjs Step Wizard

Downloads

210

Readme

MegaWizard

React Wizard Component

MegaWizard is a React component for easily making step-by-step wizards without having to configure ten thousand seperate props..

Features

  • Super flexibile configuration via a step definition object.
    • Easily embed React components or HTML elements.
    • Optional step validators to prevent advancement until your conditions are met.
    • Optional visibility flag for dynamically hiding/display steps.
    • Execution hooks for entering and leaving steps
  • Step display summary and completed step indications.
  • Super fast rendering that works on both client and server.
  • Only renders markup for currently displayed steps.
  • Best name ever for a wizard.

Limitations

  • Relies on Bootstrap for styling and layout
  • No way to customize step summary

If you are interested in helping with any of this, I would gladly take pull requests.

Using it

To use MegaWizard:

  • Install the component through NPM
  • Require it
  • Create step definition object and pass it to MegaWizard

Component props

MegaWizard has the following component props:

Required:

steps - step definition object

Optional

onStepChanged(currentStep) - function to call after a step is changed. Argument is the current step. Called before onEnter and onExit hooks.

onStepWillChange(currentStep) - function to call before a step is changed. Argument is the current step.

onComplete() - function to call when complete button is clicked on last step. No arguments. Called before onExit hook.

prevButtonText - global text override to display for previous button. Default is "Previous".

nextButtonText - global text override to display for next button. Default is "Next".

completeButtonText - global text override to display for complete button. Default is "Done".

prevButtonClasses - global class override for previous button. If using, you must handle horizontal positioning yourself.

nextButtonClasses - global class override for next button. If using, you must handle horizontal positioning yourself.

completeButtonClasses - global class override for complete button. If using, you must handle horizontal positioning yourself.

Step definition options

Steps definitions are a flexible way to get some fairly complex behaviors into the wizard. Since each step is defined indepentently, you can drive wizard behavior by using state/props from outisde the wizard. Step definitions may have any combination of the following options:

Required:

name - unique indentifier for step

text - display name (shown on sidebar and header)

Optional

onEnter - function to call when entering this step (fires when entering steps via next or previous movement). No arguments.

onExit - function to call when exiting this step (fires when leaving steps via next or previous movement). No arguments.

visible - entire step is hidden if this is defined and false. May truthy, falsy, or bool.

nextValidator - next button is disabled if this is defined and false. May truthy, falsy, or bool.

prevValidator - previous button is disabled if this is defined and false. May truthy, falsy, or bool.

prevButtonText - text to display for previous button. Default is "Previous".

nextButtonText - text to display for next button. Default is "Next".

completeButtonText - text to display for complete button. Default is "Done".

prevButtonClasses - class overrides for previous button. If using, you must handle horizontal positioning yourself.

nextButtonClasses - class overrides for next button. If using, you must handle horizontal positioning yourself.

completeButtonClasses - class overrides for complete button. If using, you must handle horizontal positioning yourself.

display - React element to display when step is active.

Contrived Example:

render() {
  let stepDef = Immutable.fromJS([
    {
      name: 'enterName',
      text: `Enter a name for widget ${this.state.widgetId}`,
      onEnter: this.props.hideWidgetList,
      nextValidator: this.state.nameInputText,
      display: () => {
        return (
          <div>
            <input type='text' value={this.state.nameText} onChange={this.handleInputChange} />
          </div>
        );
      },
    },
    {
      name: 'enterDescription',
      text: 'Enter a description',
      visible: this.state.descriptionRequired,
      nextValidator: this.state.descriptionText,
      display: () => {
        return (
          <DescriptionForm description={this.state.descriptionText}
            onChange={this.handleDescriptionChange} />
        );
      }
    },
    {
      name: 'confirm',
      text: 'Confirm',
      onExit: this.showWidgetList,
      display: () => {
        return (
          <div>
            Are you sure you want to use <strong>{this.state.nameText} - {this.state.descriptionText}</strong> for your widget?
          </div>
        );
      },
    },
  ]);

  return (
    <MegaWizard steps={stepDef} onStepChanged={this.handleStepChanged} onComplete={this.handleWizardComplete} />
  );
}

Contributing

First, setup your local environment:

git clone [email protected]:ZeroarcSoftware/megawizard.git
cd megawizard
npm install

Next, build the project (for use in a npm link scenario):

npm run build

To watch for changes:

npm run watch

Issues

Issues are tracked in Github Issues.

Changes

Changes are tracked as Github Releases.