# dynamicstepform

> Vanilla js library to create a form by steps

Latest version **1.0.12** (published 2022-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install dynamicstepform
pnpm add dynamicstepform
yarn add dynamicstepform
bun add dynamicstepform
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2022-07-31 |
| First published | 2022-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AndrwcL |
| Maintainers | fairstyle |
| Keywords | form, js, html, form, steps, beautiful, div |

## Links

- npm: https://www.npmjs.com/package/dynamicstepform
- Repository: https://github.com/fairstyle/dynamicstepform
- Homepage: https://github.com/fairstyle/dynamicstepform#readme
- Issues: https://github.com/fairstyle/dynamicstepform/issues
- npm.io page: https://npm.io/package/dynamicstepform

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.12 (latest) — 2022-07-31
- 1.0.11 — 2022-07-31
- 1.0.10 — 2022-07-31
- 1.0.9 — 2022-07-31
- 1.0.8 — 2022-07-31
- 1.0.7 — 2022-07-31
- 1.0.6 — 2022-07-31
- 1.0.5 — 2022-07-28
- 1.0.4 — 2022-07-28
- 1.0.3 — 2022-07-27
- 1.0.2 — 2022-07-26
- 1.0.1 — 2022-07-26
- 1.0.0 — 2022-07-26

## README

# stepform

Whenever I start a new project, I don't know what to write for the first commit. After doing a “git init” there is technically nothing there...

## Warning
This is a very early package. It is not ready for use.

## Install

```npm
npm install dynamicstepform
```

# Usage
This package need tailwindcss for now to work

```javascript
let element = document.getElementById("stepformdiv");
let stepform = new Dynamicstepform();
// stepone | steptwo | stepthree - all this are id of divs
stepform.steps([
    {
        "element": "stepone", 
        "call": resolveAfter3Seconds, //Promisse example
        "clearStep": () => {console.log("clear step 1");return true;}
    },{
        "element": "steptwo", 
        "call": resolveAfterResponse,  //Promisse example
        "clearStep": () => {console.log("clear step 2");return true;}
    },{
        "element": "stepthree", 
        "call": () => {console.log("step 3");return true;}, 
        "clearStep": () => {console.log("clear step 3");return true;}
    }
]);
stepform.opts({
    customAccessVarName: "stepform" // Optional
});
stepform.create(element);
```

### Example calls
Example calls for validate steps with promises

```javascript
function resolveAfter3Seconds() {
    return new Promise(resolve => {
        setTimeout(() => {
            console.log("a");
            resolve(true);
        }, 3000);
    });
}

function resolveAfterResponse() {
    return new Promise(async resolve => {
        let json = await fetch("localhost", {
            method: 'GET',
            headers: new Headers({
                'Access-Control-Allow-Origin': '*',
            }),
        }).then(res => res)
            .catch(error => {
                console.log(error)
            })
            .then(response => {
                return response;
            });
        resolve(json.status === 200);
    });
}
```

### Utils Methods
Methods for manipulating steps

```javascript
// to create a new stepform
stepform.create();

// next step
stepform.nextStep();

// back step
stepform.backStep();

// clear current step
stepform.clearStep();

// reset stepform
stepform.reset();
```

# Contributing
If someone wants to add or improve something, I invite you to collaborate directly in this repository: [dynamicstepform](https://github.com/fairstyle/dynamicstepform)

# License
dynamicstepform is released under the [MIT License](https://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/dynamicstepform · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
