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

up-to-task-validation-form

v0.0.6

Published

This project is a validation system for forms written in React TypeScript. It covers almost all input types, including text, email, checkbox, time, date, number, password, file, and search. Additionally, it includes a radio group component. However, selec

Downloads

19

Readme

React TypeScript Form Validation System

This project is a validation system for forms written in React TypeScript. It covers almost all input types, including text, email, checkbox, time, date, number, password, file, and search. Additionally, it includes a radio group component. However, select and textarea inputs are still not supported.

Installation

To use this project, you'll need to have Node.js installed. Once you have Node.js installed, you can run the following command to install the project's dependencies:

 npm install up-to-task-validation-form

Usage

To use this project, you'll need to import the components. Here's an example of how to use the Form component with some Input components and a RadioGroup component:

    import { Input, RadioGroup, Form} from 'up-to-task-validation-form';

    <Form onSubmit={onFormSubmit}>
      <Input name='name' id='name' label='Type Your Name' required minLength={4} maxLength={10} />
        <Input type='email' 
          name='email' 
          validationMessage='Invalid Email Ex:[email protected]'
          pattern="^[a-zA-Z0-9!#$%&amp;'*+\/=?^_`\{\|\}~.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$" 
          autoComplete='email' 
          required />
        <Input type='checkbox' value='check' required /> />
        <RadioGroup name='gender' id='gender' label='Choose your Gender'  required>
          <input type="radio" value="male" /> Male
          <input type="radio" value="female" />Female
        </RadioGroup>
    </Form>

For proper functionality, please note that the Input and RadioGroup components should be wrapped inside the Form component.

To handle form submissions, you can define a function that will be called when the form is submitted:

    function onFormSubmit (e:React.FormEvent<HTMLFormElement>) {
        const formData = new FormData(e.currentTarget);
        console.log(Object.fromEntries(formData));
    }

Note that this function will only be called if all input validations have passed.

Components

This project includes the following components:

  • Form: a wrapper component for forms.
  • Input: a component for text inputs, email inputs, checkboxes, dates, times, numbers, passwords, and files.
  • RadioGroup: a component for radio group inputs.

Contributions

Contributions are welcome! To contribute to this project, fork the repository and create a pull request.

License

This project is licensed under the MIT License.