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

react-router-event-manager

v1.0.2

Published

Manager component for event driven changes to react router routes

Downloads

5

Readme

React Router Event Manager

Overview

Manager component for handling event driven changes to react router routes. This decouples lower level components from having to know their containing application is leveraging react-router-dom for route management. Instead of applicaiton components directly modifying the router history attribute (history.push()), components instead trigger ROUTE_CHANGE_EVENT or ROUTE_UPDATE_EVENT (which this manger subscribes to) and the manager handles modification of the route.

Installation

Run the following NPM command to install:

> npm install --save configurable-form-builder

Run the following NPM command to launch a sample demo:

> npm start

Usage

The Configurable Form Builder can be used as follows:

import ConfigurableForm from 'configurable-form-builder';

...

primaryCallback = (submittedFormValueMap) => {
    [do some logic with submitted form attribute value pairs]
}

...

<ConfigurableForm 
    title="Sample Config Form Title",
    fields=[
    {
      id: "id",
      type: "text",
      label: "Name"
    },
    {
      id: "status",
      type: "enum",
      label: "Status",
      values: ["active", "error", "pending"]
    }
  ],
  primaryButtonText: "Search",
  noAttrText: "No searchable attributes for selected entity types",
  breakpoints: {350: 1, 750: 2, 900: 3},
  primaryButtonCallback={this.primaryCallback} />

in order to generate the following:

Sample Form Screenshot

If no 'title' property is configured, there will be no title displayed.

Responsiveness

By default the form shall display all of it's attribute files in a single column. It is possible to spread the form fields out over multiple columns while keeping it responsive to varying screen sizes. By using the 'breakpoints' property, the form can be configured to spread it's content over a number of columns (order is dictated by the order of the 'fields' property).

Example: The following properties setting will render all fields in a single column when the form is 350px, 2 columns when 750px wide and 3 columns when 900px or more breakpoints: {350: 1, 750: 2, 900: 3}

Form width larger than 900px Form width larger than 750px Form width less than 350px

Configuration Properties

ConfigurableForm.propTypes = {
  title: PropTypes.string,
  fields: PropTypes.arrayOf(
    PropTypes.shape({
      id: PropTypes.string.isRequired,
      type: PropTypes.string.isRequired,
      label: PropTypes.string,
      values: PropTypes.arrayOf(PropTypes.string)
    })
  ),
  values: PropTypes.object,
  primaryButtonText: PropTypes.string,
  primaryButtonCallback: PropTypes.func.isRequired,
  noAttrText: PropTypes.string,
  breakpoints: PropTypes.object
}

ConfigurableForm.defaultProps = {
  fields: [],
  primaryButtonText: PRIMARY_BUTTON_DEFAULT_TEXT,
  noAttrText: NO_FORM_ATTRIBUTES,
  breakpoints: {}
}

Form properties:

Property Name | Type | Required | Description | Default ------------- | ---- | -------- | ----------- | ------- title | String | No | Optional title to display above the form | N/A fields | Array | No | a list of form fields to be rendered | [] values | Object | No | an object mapping the value set for each attribute | N/A primaryButtonText | String | No | Optional text to display in the primary form button | "Submit" primaryButtonCallback | Function | Yes | The callback method when the form is submitted | N/A noAttrText | String | No | Text to display when there are no attribute fileds for the form to render | "No available attributes" breakpoints | Object | No | Configurable breakpoints to make the form responsive | {}

Field Properties:

Property Name | Type | Required | Description ------------- | ---- | -------- | ----------- id | String | Yes | the unique identifier of the form field type | String | Yes | the type of the form field label | String | No | Optional text to display as the form field label values | Array | No | optional list of values for ENUM type fields

Valid Field Property Types:

Type | Rendered Component ---- | ------------------ ENUM | Dropdown Anything Else | Textfield