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

@ramenjs/formstepper

v2.2.2

Published

Here Comes the FormStepper - a stepped form module for Ramen

Downloads

74

Readme

Ramen - FormStepper

Here Comes the FormStepper - a stepped form module for Ramen

Installation

npm i @ramenjs/formstepper -S

How to use

  import FormStepper from '@ramenjs/formstepper';
  FormStepper(config);

configuration

  • selector [string] The selector for the DOM element where the form will be rendered E.g. .js-form-stepper
  • onSubmit [function] A callback function thats fired on form submit, recives the form data as the first parameter
  • totalSteps [integer] Indication of how many steps the form has
  • fields [array] Array of fields to be rendered (See blow for examples)

Fields

Todo

Fields Types

Todo

Example Configuration

// Import Dependencies
import FormStepper from '@ramenjs/formstepper';
import { isRequired } from '@ramenjs/utilitybelt';

// Run Application
(() => {
  FormStepper({
    selector: '.js-form-stepper',
    totalSteps: 3,
    onSubmit: (data) => {
      console.log('SUBMIT', data); // eslint-disable-line
    },
    fields: [
      {
        id: 'step1Legend',
        type: 'legend',
        text: 'Step 1 legend',
        step: 1,
      },
      {
        id: 'exampleText',
        name: 'exampleText',
        label: 'Text input',
        type: 'text',
        placeholder: 'Text input placeholder',
        validate: [isRequired],
        step: 1,
      },
      {
        id: 'exampleSelect',
        name: 'exampleSelect',
        label: 'Select dropdown',
        type: 'select',
        options: [
          {
            id: 'option1',
            label: 'Select option 1',
            value: 'Select option 1',
          },
          {
            id: 'option2',
            label: 'Select option 2',
            value: 'Select option 2',
          },
          {
            id: 'option3',
            label: 'Select option 3',
            value: 'Select option 3',
          },
        ],
        step: 1,
      },
      {
        id: 'exampleCheckbox',
        name: 'exampleCheckbox',
        label: 'Checkbox',
        type: 'checkbox',
        options: [
          {
            id: 'exampleCheckbox-option1',
            label: 'Checkbox option 1',
            value: 'Checkbox option 1',
          },
        ],
        value: true,
        step: 1,
      },
      {
        id: 'exampleRadio',
        name: 'exampleRadio',
        label: 'Radio',
        type: 'radio',
        options: [
          {
            id: 'exampleRadio-option1',
            label: 'Radio option 1',
            value: 'Radio option 1',
          },
          {
            id: 'exampleRadio-option2',
            label: 'Radio option 2',
            value: 'Radio option 2',
          },
          {
            id: 'exampleRadio-option3',
            label: 'Radio option 3',
            value: 'Radio option 3',
          },
        ],
        value: 'Radio option 2',
        step: 1,
      },
      {
        id: 'step2Legend',
        type: 'legend',
        text: 'Step 2 legend',
        step: 2,
      },
      {
        id: 'exampleText3',
        name: 'exampleText3',
        label: 'Text input 3',
        type: 'text',
        placeholder: 'Text input placeholder',
        validate: [isRequired],
        step: 2,
      },
      {
        id: 'exampleText4',
        name: 'exampleText4',
        label: 'Text input 4',
        type: 'text',
        placeholder: 'Text input placeholder',
        validate: [isRequired],
        step: 2,
      },
      {
        id: 'secrettest',
        name: 'secrettest',
        label: 'Secret field if you type test ha',
        type: 'text',
        placeholder: 'Text input placeholder',
        showField: formData => formData.exampleText === 'test', // only show this field if 'exampleText' = 'test'
        step: 2,
      },
      {
        id: 'step3Legend',
        type: 'legend',
        text: 'Step 3 legend',
        step: 3,
      },
      {
        id: 'exampleText5',
        name: 'exampleText5',
        label: 'Text input 5',
        type: 'text',
        placeholder: 'Text input placeholder',
        step: 3,
      },
    ],
  });
})();