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

tjb-input

v0.3.13

Published

awesome input webcomponent

Downloads

30

Readme

tjb-input

Webcomponents input (optionally with labelfield).

Features

  • easy to use
  • accessible
  • time saving

Example

https://tjb-webcomponents.github.io/tjb-input/

Add to project

You might want to use a Polyfill for WebComponent:

<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-lite.js"></script>

Include via HTML

Include it:

<script
  src="https://tjb-webcomponents.github.io/tjb-input/tjb-input.min.js"
  type="module"
></script>

Include via JavaScript

import 'https://tjb-webcomponents.github.io/tjb-input/tjb-input.min.js'

Include via NPM

Console:

npm i -S tjb-input

Then in your code:

import 'tjb-input';

Useage

<tjb-input></tjb-input>

Attributes

Tiny Example:

<tjb-input
  label="Password"
  type="password"
  name="password"
  info="minimum 8 digits"
  pattern=".{8,}"
  errormessage="please check this input"
></tjb-input>

All attributes:

| attribute | example | description | | -------------- | ----------------------------------------- | ---------------------------------------------------------------------- | | label | label="Password" | the text of the corresponding label field. | | type | type="password" | type of the input field | | name | name="password" | name of the input field | | info | info="minimum 8 digits | tiny info text shown besides the label | | pattern | pattern=".{8,}" | regex pattern to check if input is valid | | errormessage | errormessage="please check your password" | message to display if input is invalid | | successmessage | successmessage="√" | message to display if input is valid | | required | required="true" | add required flag to input | | nosubmit | nosubmit="true" | whether or not the nearest form feald should be submitted on enter key | | value | value="foo" | sets the value of the input field |

Methods

| method | properties | example | description | | ------------- | ------------------------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------- | | showMessage | - type (@String) ['error' / 'success'] | tjbInput.showMessage("error") | displays the respective border color and message text | | hideMessage | - | tjbInput.hideMessage() | hides border color and message text | | checkValidity | - | tjbInput.checkValidity() | checks whether or not the input field is valid. Displays the success message if so and the error message if not | | submit | - | tjbInput.submit() | submits the nearest form element if input is valid | | focus | - | tjbInput.focus() | focus the input node |

events

| event | description | | ------ | -------------------------------------------- | | change | when the value of the input field is changed |

Styling

Default public values:

:host {
  --input-color-error: #fa354c;
  --input-color-success: limegreen;
  --input-padding: 10px;
  --input-margin: 0 0 30px 0;
  --input-width: 100%;
  --input-border: 1px solid transparent;
  --input-border-bottom: 1px solid lightgrey;
  --input-border-radius: 0;
  --input-font-size: 1rem;
  --input-info-color: grey;
  --input-info-font-size: 0.8rem;
  --input-label-margin: 0 0 5px 0;
}

These can be overwritten easily by targetting the element. Example:

tjb-input {
  --input-width: 300px;
}

Enjoy

Typewriter Gif