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

@tvaliasek/vue-form-inputs

v4.0.2

Published

Wrapper components over the most commonly used bootstrap input components with support for vuelidate, vue i18n and vue 3 datepicker. Originally based on bootstrap-vue-next components, but since version 4 without this dependency.

Downloads

58

Readme

Customized bootstrap vue form inputs for BS 5 and Vue 3

Wrapper components over the most commonly used bootstrap input components with support for vuelidate, vue i18n and vue 3 datepicker. Originally based on bootstrap-vue-next components, but since version 4 without this dependency.

Main goal is to simplify common bootstrap form design in my own projects.

Install

npm install @tvaliasek/vue-form-inputs

# peer dependencies
npm install bootstrap
# for datepicker
npm install @vuepic/vue-datepicker
import { createApp } from 'vue'

import { FormInputsPlugin } from '@tvaliasek/vue-form-inputs'
import '@tvaliasek/vue-form-inputs/dist/vue-form-inputs.css'
import 'bootstrap/dist/css/bootstrap.css'

const app = createApp(App)

app.use(FormInputsPlugin())

// or import individual components

/*
    FormInput
    FormInputDatePicker
    FormInputTextarea
    FormInputSelect
    FormInputRadioGroup
    FormInputCheckbox
    FormInputCheckboxGroup
    FormInputFile
*/

Usage, props and slots

Basic usage example:

<template>
    <!-- Common text input with validation -->
    <FormInput
        id="htmlId"
        label="Common text input"
        :validation="validations.example"
        v-model="example"
    />
</template>

<script setup>
import useVuelidate from '@vuelidate/core'
import { ref, computed } from 'vue'
import { required } from '@vuelidate/validators'

const example = ref('')
const validations = useVuelidate(computed(() => ({ example: { required } })), { example })
</script>

Props

Common props for all components

| prop | type | required | default | description | |------|------|----------|---------|-------------| | label | string | false | empty string | Input label text | | size | string | false | undefined | Size of input - sm, lg or not set | | validationMessages | object | false | empty object | key - value pairs for validation messages | | validation | object | false | empty object | vuelidate validation entry instance | | disabled | boolean | false | false | Input html disabled attribute | | modelValue | undefined | false | undefined | v-model value | | hint | string | false | undefined | hint text for input displayed under form input | | id | string | false | undefined | Input html id attribute | | readOnly | boolean | false | false | toggle for readonly attribute |

Text

| prop | type | required | default | description | |------|------|----------|---------|-------------| | type | string | false | 'text' | Input html attribute type | | placeholder | string | false | undefined | input placeholder html attribute | | formatter | function | false | undefined | function to apply on value as formatter | | renderAsGroup | boolean | false | false | toggle for input group rendering, use slots default / append and prepend | | lazyFormatter | boolean | false | true | control behaviour of formatter function |

Textarea

| prop | type | required | default | description | |------|------|----------|---------|-------------| | placeholder | string | false | undefined | input placeholder html attribute | | formatter | function | false | undefined | function to apply on value as formatter | | lazyFormatter | boolean | false | true | control behaviour of formatter function |

Select

| prop | type | required | default | description | |------|------|----------|---------|-------------| | options | array | true | undefined | [{ value: 'someValue', text: 'Some value' }] | | multi | boolean | false | false | toggle for multiselect rendering | | selectSize | number | false | undefined | set number of rows for multiselect | | placeholder | string | false | undefined | input placeholder html attribute | | renderAsGroup | boolean | false | false | toggle for input group rendering, use slots default / append and prepend |

Radio group, Checkbox group

| prop | type | required | default | description | |------|------|----------|---------|-------------| | options | array | true | undefined | [{ value: 'someValue', text: 'Some value' }] | | stacked | boolean | false | true | toggle to render inputs side by side |

Checkbox

| prop | type | required | default | description | |------|------|----------|---------|-------------| | renderAsSwitch | boolean | false | false | toggle to render input as switch |

Datepicker

Datepicker is wrapped @vuepic/vue-datepicker

| prop | type | required | default | description | |------|------|----------|---------|-------------| | locale | string | false | cs-CZ | language code for Intl | | minDate | Date | false | undefined | minimal date for calendar | | maxDate | Date | false | undefined | maximal date for calendar | | enableTime | boolean | false | false | toggle for date and time selection | | ignoreTimeValidation | boolean | false | true | validate only date part | | dateFormat | function | false | undefined | custom date formatter function | | placeholder | string | false | undefined | input placeholder html attribute | | enforceUtc | boolean | false | undefined | enforces UTC format | | defaultTime | { hours: string | number, minutes: string | number, seconds: string | number } | false | undefined | sets default time |

File

| prop | type | required | default | description | |------|------|----------|---------|-------------| | multiple | boolean | false | false | set to true to enable multiple file selection | | accept | string or string[] | false | [] | define list of extensions or mime type patterns allowed for selection, model value is automatically filtered using these patterns |

i18n

If vue i18n is detected, please add these translations:

{
    "cs": {
        "vueFormInputs": {
            "feedback": {
                "required": "Toto pole je nutné vyplnit.",
                "minLength": "Hodnota musí být minimálně {minLength} znaků dlouhá.",
                "maxLength": "Hodnota musí být maximálně {maxLength} znaků dlouhá.",
                "minValue": "Hodnota musí být minimálně {minValue}.",
                "maxValue": "Hodnota musí být maximálně {maxValue}.",
                "between": "Hodnota musí být mezi {betweenMin} a {betweenMax}.",
                "alpha": "Jsou povoleny pouze písmena.",
                "alphaNum": "Jsou povoleny pouze písmena a čísla.",
                "numeric": "Jsou povoleny pouze čísla.",
                "integer": "Jsou povolena pouze celá čísla.",
                "decimal": "Jsou povolena pouze desetinná čísla.",
                "email": "Chybný formát emailové adresy.",
                "ipAddress": "Chybný formát IP adresy.",
                "macAddress": "Chybný formát MAC adresy.",
                "sameAs": "Hodnota není shodná.",
                "url": "Chybný formát URL adresy.",
                "validatedEmail": "Nefunkční nebo chybná emailová adresa.",
                "invalidValue": "Chybně vyplněná hodnota."
            }
        }
    },
    "en": {
        "vueFormInputs": {
            "feedback": {
                "required": "This field must be filled.",
                "minLength": "The value must be at least {minLength} characters long.",
                "maxLength": "The value must be at most {maxLength} characters long.",
                "minValue": "The value must be at least {minValue}.",
                "maxValue": "The value must be at most {maxValue}.",
                "between": "The value must be between {betweenMin} and {betweenMax}.",
                "alpha": "Only letters are allowed.",
                "alphaNum": "Only letters and numbers are allowed.",
                "numeric": "Only numbers are allowed.",
                "integer": "Only whole numbers are allowed.",
                "decimal": "Only decimal numbers are allowed.",
                "email": "Incorrect email address format.",
                "ipAddress": "Incorrect IP address format.",
                "macAddress": "Incorrect MAC address format.",
                "sameAs": "The values are not identical.",
                "url": "Incorrect URL address format.",
                "validatedEmail": "Broken or incorrect email address.",
                "invalidValue": "Incorrectly filled value."
            }
        }
    }
}