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 🙏

© 2025 – Pkg Stats / Ryan Hefner

check-lib-cape

v1.1.0

Published

A comprehensive React library for building dynamic, type-safe forms with Material-UI components. Features advanced field types including autocomplete, date pickers, filter labels, and more.

Readme

check-lib-cape

A comprehensive React library for building dynamic, type-safe forms with Material-UI components. Features advanced field types including autocomplete, date pickers, filter labels, and more.

npm version License: MIT

🚀 Features

  • 🎯 Dynamic Form Generation - Create forms from JSON configurations
  • 🎨 Material-UI Integration - Built on top of MUI components
  • 📝 Advanced Field Types - Autocomplete, date pickers, filter labels, and more
  • 🔧 TypeScript Support - Fully typed with comprehensive type definitions
  • 🎮 Form Control API - Programmatic reset and form management
  • 📱 Responsive Design - Works seamlessly across devices
  • 🧩 Extensible - Easy to customize and extend

📦 Installation

npm install check-lib-cape

Peer Dependencies

This library requires the following peer dependencies:

npm install @mui/material @emotion/react @emotion/styled @mui/icons-material @mui/lab @mui/x-date-pickers @date-io/date-fns date-fns react react-dom react-hook-form

Or install everything at once:

npm install check-lib-cape @mui/material @emotion/react @emotion/styled @mui/icons-material @mui/lab @mui/x-date-pickers @date-io/date-fns date-fns react react-dom react-hook-form

🎯 Quick Start

import React from 'react';
import { DynamicFilter } from 'check-lib-cape';

const MyForm = () => {
  const fields = [
    {
      name: 'name',
      type: 'text',
      label: 'Full Name',
      placeholder: 'Enter your name',
      required: true
    },
    {
      name: 'email',
      type: 'text',
      label: 'Email',
      placeholder: 'Enter your email',
      required: true
    },
    {
      name: 'skills',
      type: 'autocomplete',
      label: 'Skills',
      multiple: true,
      options: [
        { value: 'react', label: 'React' },
        { value: 'typescript', label: 'TypeScript' },
        { value: 'nodejs', label: 'Node.js' }
      ]
    }
  ];

  const handleSubmit = (data) => {
    console.log('Form data:', data);
  };

  return (
    <DynamicFilter
      fields={fields}
      onSubmit={handleSubmit}
      showSubmitButton={true}
    />
  );
};

🎨 Field Types

Text Field

{
  name: 'firstName',
  type: 'text',
  label: 'First Name',
  placeholder: 'Enter your first name',
  required: true
}

Number Field

{
  name: 'age',
  type: 'number',
  label: 'Age',
  placeholder: 'Enter your age',
  min: 0,
  max: 120
}

Password Field

{
  name: 'password',
  type: 'password',
  label: 'Password',
  placeholder: 'Enter password',
  required: true
}

Select Field

{
  name: 'country',
  type: 'select',
  label: 'Country',
  options: [
    { value: 'us', label: 'United States' },
    { value: 'ca', label: 'Canada' },
    { value: 'uk', label: 'United Kingdom' }
  ],
  required: true
}

Autocomplete Field

{
  name: 'technologies',
  type: 'autocomplete',
  label: 'Technologies',
  multiple: true,
  freeSolo: true,
  options: [
    { value: 'react', label: 'React' },
    { value: 'vue', label: 'Vue.js' },
    { value: 'angular', label: 'Angular' }
  ],
  filterSelectedOptions: true,
  limitTags: 3
}

Date Picker

{
  name: 'birthDate',
  type: 'date',
  label: 'Birth Date',
  required: true,
  disableFuture: true
}

Radio Field

{
  name: 'gender',
  type: 'radio',
  label: 'Gender',
  options: [
    { value: 'male', label: 'Male' },
    { value: 'female', label: 'Female' },
    { value: 'other', label: 'Other' }
  ],
  required: true
}

Checkbox Field

{
  name: 'terms',
  type: 'checkbox',
  label: 'I agree to the terms and conditions',
  required: true
}

Filter Labels

{
  name: 'categories',
  type: 'filterlabels',
  label: 'Categories',
  options: [
    { value: 'web', label: 'Web Development' },
    { value: 'mobile', label: 'Mobile Development' },
    { value: 'ai', label: 'Artificial Intelligence' }
  ],
  filterLabelsConfig: {
    direction: 'row',
    allowMultiple: true,
    exclusive: false,
    buttonHeight: 36,
    fontSize: 14
  }
}

🔧 Advanced Usage

Form Control with Refs

import React, { useRef } from 'react';
import { DynamicFilter, DynamicFilterRef } from 'check-lib-cape';

const AdvancedForm = () => {
  const formRef = useRef<DynamicFilterRef>(null);

  const resetForm = () => {
    formRef.current?.resetForm();
  };

  const loadData = () => {
    formRef.current?.resetForm({
      name: 'John Doe',
      email: '[email protected]',
      skills: ['react', 'typescript']
    });
  };

  return (
    <div>
      <DynamicFilter
        ref={formRef}
        fields={fields}
        onSubmit={handleSubmit}
      />
      <button onClick={resetForm}>Reset</button>
      <button onClick={loadData}>Load Sample Data</button>
    </div>
  );
};

Custom Layout

const fields = [
  {
    name: 'preferences',
    type: 'filterlabels',
    label: 'Preferences',
    options: preferences,
    filterLabelsConfig: {
      direction: 'column',
      gap: 2,
      wrap: false,
      allowMultiple: true,
      exclusive: false,
      buttonHeight: 40,
      fontSize: 14,
      textTransform: 'none',
      selectedOpacity: 1,
      unselectedOpacity: 0.6,
      hoverOpacity: 0.8,
      borderColor: '#1976d2'
    }
  }
];

Initial Data

const initialData = {
  name: 'Jane Smith',
  email: '[email protected]',
  skills: ['react', 'nodejs'],
  birthDate: new Date('1990-01-01')
};

<DynamicFilter
  fields={fields}
  initialData={initialData}
  onSubmit={handleSubmit}
/>

🎮 API Reference

DynamicFilter Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | fields | FieldConfig[] | - | Array of field configurations | | onSubmit | (data: Record<string, any>) => void | - | Form submission handler | | initialData | Record<string, any> | {} | Initial form data | | showSubmitButton | boolean | true | Show submit button | | showResetButton | boolean | false | Show reset button | | submitButtonText | string | "Submit" | Submit button text | | resetButtonText | string | "Reset" | Reset button text | | onReset | () => void | - | Reset handler |

DynamicFilterRef Methods

| Method | Type | Description | |--------|------|-------------| | resetForm | (data?: Record<string, any>) => void | Reset form (optionally with new data) |

Field Configuration

All fields share these common properties:

| Property | Type | Required | Description | |----------|------|----------|-------------| | name | string | ✅ | Field name (form key) | | type | FieldType | ✅ | Field type | | label | string | ✅ | Field label | | placeholder | string | ❌ | Placeholder text | | required | boolean | ❌ | Required field | | disabled | boolean | ❌ | Disabled state |

Field-specific properties vary by type. See individual field documentation above.

🛠️ TypeScript Support

The library is fully typed with TypeScript. Import types as needed:

import {
  DynamicFilterProps,
  DynamicFilterRef,
  FieldConfig,
  AutocompleteFieldConfig,
  FilterLabelsFieldConfig,
  DateFieldConfig
} from 'check-lib-cape';

🎨 Theming

The library uses Material-UI components and respects your MUI theme:

import { ThemeProvider, createTheme } from '@mui/material/styles';

const theme = createTheme({
  palette: {
    primary: {
      main: '#1976d2',
    },
  },
});

<ThemeProvider theme={theme}>
  <DynamicFilter fields={fields} onSubmit={handleSubmit} />
</ThemeProvider>

📱 Responsive Design

All components are responsive by default. The FilterLabels component adapts to screen size automatically:

// Will stack vertically on mobile, horizontally on desktop
{
  name: 'filters',
  type: 'filterlabels',
  label: 'Filters',
  options: options,
  filterLabelsConfig: {
    direction: 'row',
    wrap: true  // Enables responsive wrapping
  }
}

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone [repository-url]
cd check-lib-cape

# Install dependencies
npm install

# Start development
npm run dev

# Build library
npm run build

# Run Storybook
npm run storybook

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🐛 Bug Reports & Feature Requests

Please use GitHub Issues to report bugs or request features.

📚 Examples

Check out our demo application for comprehensive examples and use cases.

🔄 Changelog

See CHANGELOG.md for a detailed history of changes.


Made with ❤️ by the check-lib-cape team