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

@whppt/form-builder

v2.3.7

Published

Whppt form builder modules for use with the nuxt framework

Downloads

73

Readme

@whppt/form-builder

npm version npm downloads Github Actions CI Codecov License

Whppt form builder modules for use with the nuxt framework, @whppt/nuxt and @whppt/api-express

📖 Release Notes

Table of Contents

Features

  • Simple Form creation and integration with core Whppt modules to easily build forms and send them via select services.
  • Options for Build and Runtime configuration of the site key.

Installation

  1. Add @whppt/form-builder dependency to your project
yarn add @whppt/form-builder # or npm install @whppt/form-builder
  1. Add @whppt/form-builder to the modules section of nuxt.config.js
// ~/nuxt.config.js
{
  modules: [
    // Simple usage
    '@whppt/form-builder',

    // With options
    [
      '@whppt/form-builder',
      {
        // ... see options below: Setting up Google recaptcha
      },
    ],
  ];
}
  1. Make a few updates to your ~/nuxt.config.js file.
// ~/nuxt.config.js
export default {
  build: {
    transpile: ['@whppt/form-builder'],
  },
};
  1. Including the css (optional)

Out of the box we supply some standard styling which can be added to a nuxt project like so.

// ~/nuxt.config.js
export default {
  css: [
    '@whppt/form-builder/lib/styles/styles.css',
    // any other styles you need go here 
    // if you want to override the default styles, you can include your own css file here
  ]
}

Usage

Adding in the API module

~/server/index.js

const express = require('express');
const Whppt = require('@whppt/api-express');

/* Import/require the api module from @whppt/form-builder */
const forms = require('@whppt/form-builder/lib/api');

/* Add the module to the options that will be passed to @whppt/api-express */
const options = {
  modules: {
    forms,
  },
};

const app = express();

Whppt(options).then(whppt => app.use(whppt));

module.exports = app;

Registering the component with @whppt/nuxt

Inside any whppt plugin that you wish to use the form-builder component on add the following

/* Import/require the Form definition from @whppt/form-builder, this is a whppt component */
import { Form } from '@whppt/form-builder/lib/components';

export default {
  name: 'MyPlugin',
  pageType: {
    name: 'my-plugin',
    label: 'My Plugin',
    collection: { name: 'my-plugin-collection' },
    components: {
      /* Register the Form definition to this plugin, this will now show up as a usable component on the template */
      Form,
    },
  },
};

Setting up Google recaptcha - Build time config (Optional)

This module leverages vue-recaptcha for fast setup and working Google Recaptcha. Don't forget to star their repo on github as well!

  1. Add in the siteKey option where you register the module (see options for more info)
{
  modules: {
    ['@whppt/form-builder', { recaptcha_sitekey: 'my-google-site-key' }];
  }
}
  1. Add in the env variable RECAPTCHA_SECRET (see options for more info)
RECAPTCHA_SECRET=MySuperSecretRecaptchaSecretForMyEyesOnly

Setting up Google recaptcha - Run time config (Optional)

This module leverages vue-recaptcha for fast setup and working Google Recaptcha. Don't forget to star their repo on github as well!

  1. Add in the siteKey option to public runtime config in nuxt.config.js
export default {
  publicRuntimeConfig: {
    recaptcha_sitekey: '<your public sitekey>',
  },
};
  1. Add in the env variable RECAPTCHA_SECRET (see options for more info)
RECAPTCHA_SECRET=MySuperSecretRecaptchaSecretForMyEyesOnly

Options

Module Options

| Option | default | Required | type | Description | | ----------------- | --------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | | recaptcha_sitekey | undefined | false | string | Google reCAPTCHA V2 sitekey, can be found/generated here. This is required to use the recaptcha field. |

Env Variables

| Option | default | Required | Description | | ---------------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | RECAPTCHA_SECRET | undefined | false | Google reCAPTCHA V2 secret key, can be found/generated here. This is required to use the recaptcha field. |

License

MIT License

Copyright (c) lucas [email protected]