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

formkit-builder

v0.4.4

Published

formkit-builder is a powerful Vue component package designed to streamline form creation and API interaction in Vue.js projects. With formkit-builder, developers can easily generate dynamic forms for data creation and updating, simplifying the process of

Downloads

29

Readme

Sure! Here's a template for a README file for your Formkit Builder npm package:

Formkit Builder

Formkit Builder is a Vue 3 package that provides a wrapper around Formkit forms, offering advanced features such as seamless loading handling, error management, and API calls. It simplifies the process of creating ready-to-use forms by allowing you to pass a sections object, submit handler, and form options.

Features

  • Wraps Formkit forms in a more advanced form component
  • Handles loading state during form submission
  • Manages errors and displays them in the form
  • Supports API calls for form submission
  • Built with Vue 3 and Formkit

Installation

To install Formkit Builder, you need to have Vue 3 and Formkit installed in your project.

npm install formkit-builder

or

yarn add formkit-builder

Usage

Data Create Form

<script setup lang="ts">
// import { DataCreateForm } from './components';
import { FormKitSection, FormKitError, FormKitOptions, FormSubmitHandler } from './types'

const errorHandler: Record<string, FormKitError> = {
  unique_constraint_roles_role_name_key: {
    roleName: 'unique_constraint_roles_role_name_key'
  }
}
const redirectRoute: string = 'roles_list'
const sections: FormKitSection[] = [
  {
    roleInfo: [
      {
        $formkit: 'text',
        outerClass: 'col-4',
        name: 'roleName',
        label: 'roleNameLabel',
        placeholder: 'roleNamePlaceholder',
        validation: 'required|length:3'
      },
      {
        $formkit: 'textarea',
        outerClass: 'col-8',
        name: 'roleDescription',
        label: 'roleDescriptionLabel',
        placeholder: 'roleDescriptionPlaceholder',
        validation: ''
      }
    ]
  }
]
const options: FormKitOptions = {
  title: 'role_create',
  allowBulkDelete: true
}
const submitHandler: FormSubmitHandler<any, any, any> = {
  submit: (req: any) => {
    console.log(req)
    return new Promise(async (resolve) => {
      resolve(null)
    })
  },
  errorHandler,
  redirectRoute
}
</script>

<template>
  <data-create-form :sections="sections" :submitHandler="submitHandler" :options="options" />
</template>

Data Update Form

<script setup lang="ts">
import type { FormKitSection, FormKitError, FormKitOptions, FormSubmitHandler, FormFindDataHandler } from '@/types'
import type { RoleUpdateRequest, RoleUpdateResponse, RoleFindRequest, RoleFindResponse } from '@/api/ApiTypes';
import apiClient from '@/api/ApiMock';
import { useI18n } from 'vue-i18n';

const { t } = useI18n()
const errorHandler: Record<string, FormKitError> = {
  'unique_constraint_roles_role_name_key': {
    roleName: 'unique_constraint_roles_role_name_key'
  }
}
const redirectRoute: string = 'list'
const sections: FormKitSection[] = [
  {
    roleInfo: [
      {
        $formkit: 'text',
        outerClass: "col-4",
        name: 'roleName',
        label: t('roleNameLabel'),
        placeholder: t('roleNamePlaceholder'),
        validation: 'required|length:3',

      },
      {
        $formkit: 'textarea',
        outerClass: "col-8",
        name: 'roleDescription',
        label: t('roleDescriptionLabel'),
        placeholder: t('roleDescriptionPlaceholder'),
        validation: '',
      },
    ],
  },
]
const options: FormKitOptions = {
  title: "role_Update",
  allowBulkDelete: false,
}
const submitHandler: FormSubmitHandler<RoleUpdateRequest, RoleUpdateRequest, RoleUpdateResponse> = {
  submit: apiClient.roleUpdateWithGlobalErr,
  errorHandler,
  redirectRoute,
}
const findDataHandler: FormFindDataHandler<RoleFindRequest, RoleFindResponse, any> = {
  findData: apiClient.roleFind,
  findRequerPropertyName: 'roleId',
}

</script>

<template>
  <data-update-form :sections="sections" :findDataHandler="findDataHandler" :submitHandler="submitHandler"
    :options="options" />
</template>

Documentation

For detailed usage instructions and documentation, please visit the Formkit Builder Documentation.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.

License

This package is open source and available under the MIT License.

Acknowledgements

Formkit Builder is built upon the excellent Formkit library developed by Author's Name. We would like to extend our gratitude to the Formkit team for their amazing work.


Feel free to customize the template to fit your package and add more details as needed. Include sections such as Installation, Usage, Documentation, Contributing, License, and Acknowledgements to provide comprehensive information about your package.