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

@qazi9amaan/formlibrary

v0.0.1-9.alpha.14

Published

A delightful npm package that provides you with Tailwind CSS styled UI elements 🌟, fully compatible with Formik πŸ“. Unleash your creativity with a variety of components πŸ”§ and utilities πŸ”§ to design stunning dashboards πŸ“Š, including tables πŸ“‹, forms πŸ“,

Downloads

854

Readme

🎨✨ @qazi9amaan/formlibrary

A delightful npm package that provides you with Tailwind CSS styled UI elements 🌟, fully compatible with Formik πŸ“. Unleash your creativity with a variety of components and utilities to design stunning dashboards, including tables, forms, and more! Get ready to level up your web projects! πŸš€πŸ’―

🌟 Features

  • Tailwind CSS styled components
  • Formik support for form handling
  • Dashboard components: tables, forms, and more
  • Highly modular and reusable code

πŸš€ Getting Started

Installation

  1. Install the package via npm:
npm install @qazi9amaan/formlibrary
  1. Import the style.css file in your index:
import '@qazi9amaan/formlibrary/dist/style.css'
  1. Import the components you need in your project:
import { Table, Form } from '@qazi9amaan/formlibrary';

πŸ“ Documentation

// form components
import { Button } from '@qazi9amaan/formlibrary';
import { FormInput } from '@qazi9amaan/formlibrary';
import { FormDate } from '@qazi9amaan/formlibrary';
import { FormButton } from '@qazi9amaan/formlibrary';
import { FormSelect } from '@qazi9amaan/formlibrary';
import { FormMultiSelect } from '@qazi9amaan/formlibrary';
import { FormCheckbox } from '@qazi9amaan/formlibrary';
import { FormRadio } from '@qazi9amaan/formlibrary';
import { FormChips } from '@qazi9amaan/formlibrary';
import { FormTextarea } from '@qazi9amaan/formlibrary';

// formik builder forms from json
import { FormikBuilder } from '@qazi9amaan/formlibrary'

// layouts
import { Row } from '@qazi9amaan/formlibrary'
import { Column } from '@qazi9amaan/formlibrary'
import { AutoLayout } from '@qazi9amaan/formlibrary'

import { Alert } from '@qazi9amaan/formlibrary'

import { Button } from '@qazi9amaan/formlibrary'
import { EmptyPlaceHolder } from '@qazi9amaan/formlibrary'
import { Header } from '@qazi9amaan/formlibrary'
import { Panel } from '@qazi9amaan/formlibrary'

// Loader with utility
import { Loader } from '@qazi9amaan/formlibrary'
import { useLoader } from '@qazi9amaan/formlibrary'
import { LoaderProvider, LoaderContext } from '@qazi9amaan/formlibrary'

// Modal with utility
import { Modal } from '@qazi9amaan/formlibrary'
import { useModal } from '@qazi9amaan/formlibrary';
import { ModalContext, ModalProvider } from '@qazi9amaan/formlibrary';

// hocs, hooks and utils
import { useError } from '@qazi9amaan/formlibrary';
import { withForm } from '@qazi9amaan/formlibrary';
import { useForm } from '@qazi9amaan/formlibrary'; //<- has custom helpers

// table
import { Table } from '@qazi9amaan/formlibrary';

πŸ“ withForm

import { withForm } from '@qazi9amaan/formlibrary';
const LoginForm = withForm<ILogin>({
  initialValues: {
    username: '',
    password: '',
  },
  mapPropsToValues: (props) => {
    return { username: props.hello };
  },
  validationSchema: Yup.object().shape({
    username: Yup.string().required('Username is required'),
    password: Yup.string().required('Password is required'),
  }),
  mode: 'CREATE',
})(LoginWrappedForm);

πŸ“ FormikBuilder

 // formik builder
    <FormikBuilder
        mode='CREATE'
        formJSON={formJSON}
        handleSubmit={handleSubmit}
        initialValues={initialValues}
        validationSchema={validationSchema}
    />

    export type IReg = {
        email: string;
        password: string;
        confirmPassword?: string;
    };

    export const initialValues: IReg = {
        email: '',
        password: '',
        confirmPassword: '',
    };

    export const validationSchema = Yup.object().shape({
        email: Yup.string().email('Invalid email').required('Required'),
        password: Yup.string().required('Required'),
        confirmPassword: Yup.string()
            .oneOf([Yup.ref('password')], 'Passwords must match')
            .required('Required'),
    });

    export const formJSON: IFormJSON<IReg, IBuilderProps<IReg>> = [
        {
            id: 1,
            items: [
            {
                label: 'Email',
                name: 'email',
                type: 'email',
            },
            ],
        },
        {
            id: 2,
            items: [
            {
                label: 'Password',
                name: 'password',
                type: 'password',
            },
            {
                label: 'Confirm Password',
                name: 'confirmPassword',
                type: 'password',
            },
            ],
        },
    ];   

πŸ“ useError

import { useError } from '@qazi9amaan/formlibrary';

const { error, setError } = useError();

setError('Error message');

πŸ“ useLoader


import { useLoader } from '@qazi9amaan/formlibrary';
const { loading, setLoading } = useLoader();
setLoading(true);

πŸ“ useModal

import { useModal } from '@qazi9amaan/formlibrary';
const { openDeleteModal } = useModal();
openDeleteModal();

Table


import { ITableHeader, Table } from '@qazi9amaan/formlibrary';

type IBook = {
  name: string;
  author: string;
};

const header: ITableHeader<IBook> = [
  { type: 'string', label: 'Name', sortable: true, key: 'name' },
  { type: 'string', label: 'Author', key: 'author' },
  { type: 'actions', label: 'Actions', actions: ['view'] },
];

const books: IBook[] = [
  {
    name: 'The Lord of the Rings',
    author: 'J.R.R. Tolkien',
  },
];

export const App = () => {
  //
  return (
    <Table
      idKey='name' // key to be used as unique identifier
      showSelect // show checkbox
      showSearch // show search input
      header={header} // table header
      data={books} // table data
      selectActions={['view', 'edit']} // actions to be shown in when checkbox is selected
      handleActions={console.log} // handle actions when clicked
      handleCellClick={console.log} // handle cell click
      handleSelectAction={console.log} // handle select action
      pagination={{
        totalPages: 10, // total number of pages
        page: 1, // current page
        handlePagination: console.log, // handle pagination
      }}
    />
  );
};

🀝 Contributing

Contributions are more than welcome! πŸŽ‰

πŸ‘₯ Credits

Built with ❀️ by Qazi Amaan.