Skip to content

Commit 4750506

Browse files
committed
First commit
0 parents  commit 4750506

37 files changed

+9690
-0
lines changed

.babelrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": {
7+
"node": "8"
8+
}
9+
}
10+
],
11+
"stage-2"
12+
],
13+
"plugins": ["transform-flow-strip-types"]
14+
}

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
coverage
3+
dist

.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "react-app",
3+
"rules": {
4+
"jsx-a11y/href-no-hash": 0
5+
}
6+
}

.flowconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[options]
8+
esproposal.decorators=ignore
9+
unsafe.enable_getters_and_setters=true

.github/CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of
9+
experience, nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. The project
59+
team will review and investigate all complaints, and will respond in a way that
60+
it deems appropriate to the circumstances. The project team is obligated to
61+
maintain confidentiality with regard to the reporter of an incident. Further
62+
details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71+
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to 🏁 Final Form! Please take a moment
4+
to review this document **before submitting a pull request**.
5+
6+
We are open to, and grateful for, any contributions made by the community.
7+
8+
## Reporting issues and asking questions
9+
10+
Before opening an issue, please search the
11+
[issue tracker](https://github.com/erikras/final-form/issues) to make sure your
12+
issue hasn’t already been reported.
13+
14+
**We use the issue tracker to keep track of bugs and improvements** to 🏁 Final
15+
Form itself, its examples, and the documentation. We encourage you to open
16+
issues to discuss improvements, architecture, internal implementation, etc. If a
17+
topic has been discussed before, we will ask you to join the previous
18+
discussion.
19+
20+
For support or usage questions, please search and ask on
21+
[StackOverflow with a `final-form` tag](https://stackoverflow.com/questions/tagged/final-form).
22+
We ask you to do this because StackOverflow has a much better job at keeping
23+
popular questions visible. Unfortunately good answers get lost and outdated on
24+
GitHub.
25+
26+
**If you already asked at StackOverflow and still got no answers, post an issue
27+
with the question link, so we can either answer it or evolve into a bug/feature
28+
request.**
29+
30+
## Sending a pull request
31+
32+
**Please ask first before starting work on any significant new features.**
33+
34+
It's never a fun experience to have your pull request declined after investing a
35+
lot of time and effort into a new feature. To avoid this from happening, we
36+
request that contributors create
37+
[an issue](https://github.com/erikras/final-form/issues) to first discuss any
38+
significant new features.
39+
40+
Please try to keep your pull request focused in scope and avoid including
41+
unrelated commits.
42+
43+
After you have submitted your pull request, we’ll try to get back to you as soon
44+
as possible. We may suggest some changes or improvements.
45+
46+
Please format the code before submitting your pull request by running:
47+
48+
```
49+
npm run precommit
50+
```
51+
52+
## Coding standards
53+
54+
Our code formatting rules are defined in
55+
[.eslintrc](https://github.com/erikras/final-form/blob/master/.eslintrc). You
56+
can check your code against these standards by running:
57+
58+
```sh
59+
npm start lint
60+
```
61+
62+
To automatically fix any style violations in your code, you can run:
63+
64+
```sh
65+
npm run precommit
66+
```
67+
68+
## Running tests
69+
70+
You can run the test suite using the following commands:
71+
72+
```sh
73+
npm test
74+
```
75+
76+
Please ensure that the tests are passing when submitting a pull request. If
77+
you're adding new features to 🏁 Final Form, please include tests.

.github/ISSUE_TEMPLATE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
3+
👋 Hey, thanks for taking an interest in 🏁 Final Form!
4+
5+
-->
6+
7+
### Are you submitting a **bug report** or a **feature request**?
8+
9+
<!-- For support request, please use Stack Overflow instead. This issue tracker is reserved for bugs and features. -->
10+
11+
### What is the current behavior?
12+
13+
<!-- If this is a bug, please include steps to reproduce and a minimal demo of the problem using Sandbox, Plunkr, WebpackBin or JSFiddle. -->
14+
15+
### What is the expected behavior?
16+
17+
### Sandbox Link
18+
19+
<!-- Problems are much easier to understand and debug if they can be demonstrated in a minimal environment. -->
20+
21+
### What's your environment?
22+
23+
<!-- Include 🏁 Final Form version, OS/browser affected, Node version, etc. -->
24+
25+
### Other information
26+
27+
<!-- Include here any detailed explanation, stacktraces, related issues, links for Stack Overflow, Twitter, etc. -->

.github/PULL_REQUEST_TEMPLATE.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!--
2+
3+
👋 Hey, thanks for your interest in contributing to 🏁 Final Form!
4+
5+
**Please ask first before starting work on any significant new features.**
6+
7+
It's never a fun experience to have your pull request declined after investing a
8+
lot of time and effort into a new feature. To avoid this from happening, we
9+
request that contributors create an issue to first discuss any significant new
10+
features.
11+
12+
Please try to keep your pull request focused in scope and avoid including
13+
unrelated commits.
14+
15+
After you have submitted your pull request, we’ll try to get back to you as soon
16+
as possible. We may suggest some changes or improvements.
17+
18+
Please format the code before submitting your pull request by running:
19+
20+
```
21+
npm run precommit
22+
```
23+
24+
https://github.com/erikras/final-form/blob/master/.github/CONTRIBUTING.md
25+
26+
-->

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vscode
2+
*.iml
3+
.nyc_output
4+
coverage
5+
flow-coverage
6+
node_modules
7+
dist
8+
lib
9+
es
10+
npm-debug.log
11+
.DS_Store

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
semi: false
2+
singleQuote: true
3+
trailingComma: none

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo: false
2+
language: node_js
3+
cache:
4+
directories:
5+
- node_modules
6+
notifications:
7+
email: false
8+
node_js:
9+
- '8'
10+
script:
11+
- npm start validate
12+
after_success:
13+
- npx codecov
14+
- npm install --global semantic-release
15+
# - semantic-release pre && npm publish && semantic-release post
16+
branches:
17+
only:
18+
- master

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Erik Rasmussen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# 🏁 Final Form Arrays
2+
3+
[![NPM Version](https://img.shields.io/npm/v/final-form-arrays.svg?style=flat)](https://www.npmjs.com/package/final-form-arrays)
4+
[![NPM Downloads](https://img.shields.io/npm/dm/final-form-arrays.svg?style=flat)](https://www.npmjs.com/package/final-form-arrays)
5+
[![Build Status](https://img.shields.io/travis/erikras/final-form-arrays/v6.svg?style=flat)](https://travis-ci.org/erikras/final-form-arrays)
6+
[![codecov.io](https://codecov.io/gh/erikras/final-form-arrays/branch/master/graph/badge.svg)](https://codecov.io/gh/erikras/final-form-arrays)
7+
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
8+
9+
Mutators for updating array fields in
10+
[🏁 Final Form](https://github.com/erikras/final-form).
11+
12+
---
13+
14+
## Installation
15+
16+
```bash
17+
npm install --save final-form-arrays
18+
```
19+
20+
or
21+
22+
```bash
23+
yarn add final-form-arrays
24+
```
25+
26+
## Usage
27+
28+
```js
29+
import { createForm } from 'final-form'
30+
import arrayMutators from 'final-form-arrays'
31+
32+
// Create Form
33+
const form = createForm({
34+
mutators: { ...arrayMutators }
35+
onSubmit
36+
})
37+
38+
// push
39+
form.mutators.push('customers', { firstName: '', lastName: '' })
40+
41+
// pop
42+
const customer = form.mutators.pop('customers')
43+
```
44+
45+
## Table of Contents
46+
47+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
48+
49+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
50+
51+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
52+
53+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
54+
55+
## Mutators
56+
57+
### `form.mutators.insert(name: string, index:number, value: any) => undefined`
58+
59+
Inserts a value into the specified index of the array field.
60+
61+
### `form.mutators.move(name: string, from: number, to: number) => undefined`
62+
63+
Moves a value from one index to another index in the array field.
64+
65+
### `form.mutators.pop(name: string) => any`
66+
67+
Pops a value off the end of an array field. Returns the value.
68+
69+
### `form.mutators.push(name: string, value: any) => void`
70+
71+
Pushes a value onto the end of an array field.
72+
73+
### `form.mutators.remove(name: string, index: number) => any`
74+
75+
Removes a value from the specified index of the array field. Returns the removed
76+
value.
77+
78+
### `form.mutators.shift(name: string) => any`
79+
80+
Removes a value from the beginning of the array field. Returns the value.
81+
82+
### `form.mutators.swap(name: string, indexA: number, indexB: number) => void`
83+
84+
Swaps the position of two values in the array field.
85+
86+
### `form.mutators.unshift(name: string, value: any) => void`
87+
88+
Inserts a value onto the beginning of the array field.

banner.png

50.3 KB
Loading

logo.png

60.5 KB
Loading

0 commit comments

Comments
 (0)