Socket
Socket
Sign inDemoInstall

form-mechanics

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

form-mechanics

Compose forms through a nice API


Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Form stuff

Layered approach

Input component layer

  • props that an input component must implement to work with the system
  • two static methods: validate and isEmpty
  • actual UI components are out of scope for this repo

exports:

  • inputProps(raw, clean, inputProps) -> proptypes

Context layer

  • and components that link data across a component tree
  • decorators for injecting stuff out of context where needed

exports:

  • `

State layer

  • vanilla component state, mobx-state-tree, or redux adapters that work with the lower-level APIs to move data around

MST exports (at form-mechanics/dist/mst)

  • formModel

Data formats

Input values
  { state: VALID, cleanValue: T }
| { state: INVALID, reason: string }
| { state: VALIDATING }
Form values
raw: { fieldName: rawType }  // always available, useful for serialization
clean: { state: VALID, cleanVaue: { field: cleanType } }
     | { state: INVALID, reason: { field: string } }
     | { state: VALIDATING }

FAQs

Package last updated on 03 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc