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

storm-number-incrementer

v0.2.0

Published

Numeric input incrementer

Downloads

21

Readme

Storm Number Incrementer

Build Status codecov.io npm version

Numeric input incrementer

Example

https://mjbp.github.io/storm-number-incrementer

Usage

HTML

<div class="field__container js-number-incrementer">
    <button type="button" class="field__number-btn" data-change="decrement">
        <svg class="field__number-icon" fill="#575755" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
            <title>Decrease</title>
            <path d="M19 13H5v-2h14v2z"/>
            <path d="M0 0h24v24H0z" fill="none"/>
        </svg>
    </button>
    <input class="field field__number" type="text" id="7" name="7" value="0" min="0" max="10" readonly>
    <button type="button" class="field__number-btn" data-change="increment">
        <svg class="field__number-icon" fill="#575755" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
            <title>Increase</title>
            <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
            <path d="M0 0h24v24H0z" fill="none"/>
        </svg>
    </button>
    <label class="field__number-label" for="7">Label</label>
</div>

CSS Example CSS implementation

.field__container {
    position: relative;
    display: block;
}
.field__number-btn {
    display: inline-block;
    padding: 12px 18px;
    cursor: pointer;
    vertical-align: middle;
}
.field__number-icon {
    position: relative;
    top: 3px;
}
.field {
    color: #575755;
    width: 100%;
    padding: 18px;
    background: transparent;
    border: 1px solid #D0D0D0;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    display: block;
    font-size: 16px;
    text-align: left;
    z-index: 1;
    position: relative;
    -webkit-transition: border-color 120ms ease;
    transition: border-color 120ms ease;
}
.field__number {
    display: inline-block;
    vertical-align: middle;
    width: 70px;
    text-align: center;
    height: 55px;
    background-color: #fff;
}
.field__number-btn {
    display: inline-block;
    padding: 12px 18px;
    cursor: pointer;
    vertical-align: middle;
    background-color: transparent;
    border-radius: 0;
    border: 0 none;
}
.field__number-label {
    padding: 0 15px;
}

JS

npm i -S storm-number-incrementer

either using es6 import

import NumberIncrementer from 'storm-number-incrementer';

NumberIncrementer.init('.js-number-incrementer');

asynchronous browser loading (use the .standalone version in the /dist folder) using the global name (Storm + capitalised package name)

import Load from 'storm-load';

Load('{{path}}/storm-number-incrementer.standalone.js')
    .then(() => {
        StormNumberIncrementer.init('.js-number-incrementer');
    });

Options

{
    min: 100,   //can be overridden in min/max attributes on the input
    max: 0
}

Tests

npm run test

Browser support

This is module has both es6 and es5 distributions. The es6 version should be used in a workflow that transpiles.

The es5 version depends upon Object.assign, element.classList, and Promises so all evergreen browsers are supported out of the box, ie9+ is supported with polyfills. ie8+ will work with even more polyfills for Array functions and eventListeners.

Dependencies

None

License

MIT