Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Forms for human beings
See https://sgmonda.github.io/formelio/ for documentation and usage examples.
To use Formelio
from a React component, just install it with your favorite package manager (like NPM):
npm install --save formelio
Once installed, you'll be able to import and use it from your Javascript/Typescript code. Here's a simple example of a simple login form, without validation or password hiding (please, don't do this in production 😜):
import React, { useState } from 'react';
import { Form } from 'formelio';
import 'formelio/dist/index.css';
export const MyForm = () => {
const [value, onChange] = useState({});
const fields = [{ name: 'email' }, { name: 'password' }];
return <Form {...{ fields, value, onChange }} />;
};
Go to https://sgmonda.github.io/formelio/ to see this and other usage examples working.
A form requires the following main properties:
Property | Required | Description | Default |
---|---|---|---|
fields | [X] | Form inputs to include in the form | - |
onChange | [X] | Change event handler, receiving form value and validity status | - |
value | [ ] | Initial or current value for all (or some) inputs | {} |
delay | [ ] | Time to wait before triggering onChange() after an input change | 500ms |
colors | [ ] | Simple customization | { accent: '#5196D5', error: '#D65947' } |
fields
: A list (Array
) of field definitions. A field definition is a plain object where field properties are defined. See the next section. Example:
<Form
...
fields={[
{ name: 'firstName', type: 'text', required: true },
{ name: 'age', type: 'number' },
]}
...
/>
onChange
: A change event handler, that will be called when the form is modified. It also receives a validation state, according with required
properties and custom validators (see next section). Example:
<Form
...
onChange={ (value, isValid) => { /* Do whatever you want */ } }
...
/>
A form supports also the following optional properties:
colors
delay
value
Now lets see how to define each property correctly:
GPL-3.0 © Sergio Garcia Mondaray
This project uses git hooks for:
$ npm run storybook
$ npm i
To prevent Invalid hook call
error during development of another app using formelio as file dependency, I mean:
// path/to/myOtherProject/package.json
"dependencies": {
"formelio": "path/to/formelio",
}
We should link react version from formelio project. Example:
$ npm link path/to/myOtherProject/node_modules/react-dom
$ cd path/to/myOtherProject/ && npm i
Terminal 1: Open dev server, to compile and bundle everything on every change:
$ npm run dev
Terminal 2: Open test watcher, to run tests on every change:
$ npm run dev:test
Terminal 3: Serve (watching) the example
$ npm run dev:site
To publish on npm:
$ npm publish
To update gh pages:
$ npm run site:deploy
FAQs
Forms for humans
We found that formelio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.