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

vue-form-ui

v2.2.23

Published

A set of Vue form components with complex validation

Downloads

121

Readme

vue-form-ui

A set of Vue form components with complex validation.

Inputs Included:

:abc: Text input (only allows letters)

:date: Date input (3 inputs split DD/MM/YYYY - only allows valid dates and has optional min/max age validation)

:e-mail: Email input (valid emails only)

:iphone: Phone input (UK mobile or home)

:radio_button: Buttons input (fieldset)

:arrow_down_small: Select input

:pound: Currency input

All input types have these basic properties:

  • Required: (boolean) - is the field required
  • Inputname: (string) - name given to the input e.g. <input name="theName" />
  • Label: (string) - string used to fill question and placerholder text

There is also additional properties for some types:

Text input

  • minLength (string) - to set minimum length of the input
  • maxLength (string) - to set maximum length of the input

Date input

  • minAge (string) - to set minimum age for input
  • maxAge (string) - to set maximum age for input

Phone input

  • type (string) - set type to either 'mobile' or 'home'

Buttons input

  • options (array{}) - array object containing options for the buttons e.g. btnOptions: [{'value': true, 'name': 'Yes'}, {'value': false, 'name': 'No'}]

Installation

npm i --save-dev vue-form-ui

Module

import Vue from 'vue'
import {
  TextInput, 
  EmailInput, 
  DateInput, 
  PhoneInput,
  Buttons,
  SelectInput,
  CurrencyInput,
  CheckboxInput,
  AddressBlock,
  MonthYearInput
} from 'vue-form-ui/dist/vue-form-ui'


// create event hub for validation events
window.Hub = new Vue;

export default {
  name: 'app',
  components: {
    TextInput,
    DateInput,
    EmailInput,
    PhoneInput,
    Buttons
  },
  data () {
      return {
        formData: {},
        skyblueOptions: [
            {
                'value': true, 
                'name': 'Yes'
            }, 
            {
                'value': false, 
                'name': 'No'
            }
        ]
      }
    },
  methods: {
    logResult (result) {
        console.log(result)
        // output:
        /* 
            {
                value: string, 
                name: string, 
                isValid: boolean
            }
        */

        // if input has valid result update formData object with input name and value
        if (result.isValid) {
            this.formData[result.name] = result.value
            console.log(this.formData)
        }
    }
  }
}

Usage

Once installed, it can be used in a template as simply as:

<text-input 
    label="Your name" 
    inputname="name" 
    required="true" 
    minLength="2" 
    maxLength="32"
    v-on:change="logResult">
    </text-input>

<date-input 
    label="Date of birth" 
    inputname="dob" 
    required="true" 
    minage="18" 
    maxage="99"
    v-on:change="logResult">
    </date-input>

<email-input 
    label="Your email" 
    inputname="email" 
    required="true"
    v-on:change="logResult">
    </email-input>

<phone-input 
    label="Home phone" 
    inputname="homephone" 
    required="true"
    type="home"
    v-on:change="logResult">
    </phone-input>

<phone-input 
    label="Mobile phone" 
    inputname="mobilephone" 
    required="true"
    type="mobile"
    v-on:change="logResult">
    </phone-input>

<buttons 
    label="Is the sky blue" 
    inputname="skyblue" 
    required="true" 
    v-bind:options="skyblueOptions" 
    v-on:change="logResult">
    </buttons>