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

redux-autoform

v0.13.1-experimental

Published

A library for dynamically generating redux-forms out of metadata

Downloads

73

Readme

Logo

Build Status npm version codecov Coverage Status

NPM NPM

Beta version disclaimer

redux-autoform is under active development. APIs will change and things may still not work as expected. If you find any issue, please report it. We'll do my best to fix it.

Introduction

Redux-Autoform is an UI agnostic library for dynamically generating redux-form out of metadata.

Supported UI frameworks

Demos

  • Bootstrap demo.
  • [Material-UI demo] (https://redux-autoform.github.io/redux-autoform-material-ui).

Docs

Docs are available here.

Installing

npm install redux-autoform

Using

AutoForm (source)

The main React component.

import { AutoForm } from 'redux-autoform';

The AutoForm props are listed here.

The 2 most important props AutoForm should receive is the schema and the componentFactory.

The schema represents the application domain. All entities, layouts and their metadata is contained in the schema. More information here.

The ComponentFactory is responsible for determining which React component to use for a given field metadata. redux-autoform doesn't have any built-in factory, for that you can use either Bootstrap (beta state) or Material-UI (beta state).

Assuming Bootstrap, you can get the factories like this:

import { EditComponentFactory, DetailsComponentFactory } from 'redux-autoform-bootstrap-ui';

Either one of these factories now should be passed as prop Autoform as described in the docs.

Localization

AutoForm doesn't directly depend on localization, but both the Bootstrap and Material-UI factories do. So, if you're using these, this is what you should do:

  • Install numbro. This is the library used for number localization.
  • Install moment. This is the library used for datetime localization.
// import moment and numbro
import moment from 'moment';
import numbro from 'numbro';
 // import the localizers
 import { momentLocalizer, numbroLocalizer } from 'redux-autoform';
// if you are using react-widgets, which is used by default on the standard factories, you need to import it's localizer too:
import reactWidgetsMomentLocalizer from 'react-widgets/lib/localizers/moment';
// set up the localizers
momentLocalizer(moment);
numbroLocalizer(numbro);

reactWidgetsMomentLocalizer(moment); // THIS IS ONLY IMPORTANT WHEN USING BOOTSTRAP

Styles

The styling will depend on the UI you're using:

Building and running the demo locally

Redux-Autoform provides a really minimalist demo. In order to run the demo, run:

npm run start

Now the demo should be available here: http://localhost:4000/.

Running the tests

npm run test // will run the Karma tests PhantomJS
// OR
npm run test-chrome // will run the Karma tests on Chrome

Contributing

Pull-requests are really really welcome. If you don't know what to contribute with, please check the issues.

We'll be more than glad to invite frequent contributors to join the organization. If you need help understanding the project, please post an issue and I'll do my best to reply and make sure you understand everything you need.

In order to make a pull request:

  1. Fork it.
  2. Create your feature-branch git checkout -b your-new-feature-branch
  3. Commit your change git commit -am 'Add new feature'
  4. Push to the branch git push origin your-new-feature-branch
  5. Create new Pull Request with master branch

License

redux-autoform is MIT licensed.