Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erikras committed Jan 11, 2018
0 parents commit f155c8f
Show file tree
Hide file tree
Showing 21 changed files with 9,257 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"env",
{
"targets": {
"node": "8"
}
}
],
"stage-2"
],
"plugins": ["transform-flow-strip-types"]
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
coverage
dist
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "react-app",
"rules": {
"jsx-a11y/href-no-hash": 0
}
}
10 changes: 10 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ignore]
dist/.*

[include]

[libs]

[options]
esproposal.decorators=ignore
unsafe.enable_getters_and_setters=true
74 changes: 74 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. The project
team will review and investigate all complaints, and will respond in a way that
it deems appropriate to the circumstances. The project team is obligated to
maintain confidentiality with regard to the reporter of an incident. Further
details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
78 changes: 78 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing

Thanks for your interest in contributing to 🏁 Final Form Set Field Touched! Please
take a moment to review this document **before submitting a pull request**.

We are open to, and grateful for, any contributions made by the community.

## Reporting issues and asking questions

Before opening an issue, please search the
[issue tracker](https://github.com/final-form/final-form-set-field-touched/issues)
to make sure your issue hasn’t already been reported.

**We use the issue tracker to keep track of bugs and improvements** to 🏁 Final
Form Set Field Touched itself, its examples, and the documentation. We encourage
you to open issues to discuss improvements, architecture, internal
implementation, etc. If a topic has been discussed before, we will ask you to
join the previous discussion.

For support or usage questions, please search and ask on
[StackOverflow with a `final-form-set-field-touched` tag](https://stackoverflow.com/questions/tagged/final-form-set-field-touched).
We ask you to do this because StackOverflow has a much better job at keeping
popular questions visible. Unfortunately good answers get lost and outdated on
GitHub.

**If you already asked at StackOverflow and still got no answers, post an issue
with the question link, so we can either answer it or evolve into a bug/feature
request.**

## Sending a pull request

**Please ask first before starting work on any significant new features.**

It's never a fun experience to have your pull request declined after investing a
lot of time and effort into a new feature. To avoid this from happening, we
request that contributors create
[an issue](https://github.com/final-form/final-form-set-field-touched/issues) to
first discuss any significant new features.

Please try to keep your pull request focused in scope and avoid including
unrelated commits.

After you have submitted your pull request, we’ll try to get back to you as soon
as possible. We may suggest some changes or improvements.

Please format the code before submitting your pull request by running:

```
npm run precommit
```

## Coding standards

Our code formatting rules are defined in
[.eslintrc](https://github.com/final-form/final-form-set-field-touched/blob/master/.eslintrc).
You can check your code against these standards by running:

```sh
npm start lint
```

To automatically fix any style violations in your code, you can run:

```sh
npm run precommit
```

## Running tests

You can run the test suite using the following commands:

```sh
npm test
```

Please ensure that the tests are passing when submitting a pull request. If
you're adding new features to 🏁 Final Form Set Field Touched, please include
tests.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
👋 Hey, thanks for taking an interest in 🏁 Final Form Set Field Touched!
-->

### Are you submitting a **bug report** or a **feature request**?

<!-- For support request, please use Stack Overflow instead. This issue tracker is reserved for bugs and features. -->

### What is the current behavior?

<!-- If this is a bug, please include steps to reproduce and a minimal demo of the problem using Sandbox, Plunkr, WebpackBin or JSFiddle. -->

### What is the expected behavior?

### Sandbox Link

<!-- Problems are much easier to understand and debug if they can be demonstrated in a minimal environment. -->

### What's your environment?

<!-- Include 🏁 Final Form Set Field Touched version, 🏁 Final Form version, OS/browser affected, Node version, etc. -->

### Other information

<!-- Include here any detailed explanation, stacktraces, related issues, links for Stack Overflow, Twitter, etc. -->
26 changes: 26 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
👋 Hey, thanks for your interest in contributing to 🏁 Final Form Set Field Touched!
**Please ask first before starting work on any significant new features.**
It's never a fun experience to have your pull request declined after investing a
lot of time and effort into a new feature. To avoid this from happening, we
request that contributors create an issue to first discuss any significant new
features.
Please try to keep your pull request focused in scope and avoid including
unrelated commits.
After you have submitted your pull request, we’ll try to get back to you as soon
as possible. We may suggest some changes or improvements.
Please format the code before submitting your pull request by running:
```
npm run precommit
```
https://github.com/final-form/final-form-set-field-touched/blob/master/.github/CONTRIBUTING.md
-->
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.vscode
*.iml
.nyc_output
coverage
flow-coverage
node_modules
dist
lib
es
npm-debug.log
.DS_Store
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semi: false
singleQuote: true
trailingComma: none
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '8'
script:
- npm start validate
after_success:
- npx codecov
- npm install --global semantic-release
# - semantic-release pre && npm publish && semantic-release post
branches:
only:
- master
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Erik Rasmussen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 🏁 Final Form Set Field Touched

[![NPM Version](https://img.shields.io/npm/v/final-form-set-field-touched.svg?style=flat)](https://www.npmjs.com/package/final-form-set-field-touched)
[![NPM Downloads](https://img.shields.io/npm/dm/final-form-set-field-touched.svg?style=flat)](https://www.npmjs.com/package/final-form-set-field-touched)
[![Build Status](https://travis-ci.org/final-form/final-form-set-field-touched.svg?branch=master)](https://travis-ci.org/final-form/final-form-set-field-touched)
[![codecov.io](https://codecov.io/gh/final-form/final-form-set-field-touched/branch/master/graph/badge.svg)](https://codecov.io/gh/final-form/final-form-set-field-touched)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

Mutator for setting a field as "touched" in [🏁 Final Form](https://github.com/final-form/final-form).

---

## Installation

```bash
npm install --save final-form-set-field-touched
```

or

```bash
yarn add final-form-set-field-touched
```

## Usage

```js
import { createForm } from 'final-form'
import setFieldTouched from 'final-form-set-field-touched'

// Create Form
const form = createForm({
mutators: { setFieldTouched },
onSubmit
})

form.mutators.setFieldTouched('firstName', true)

form.registerField(
'firstName',
fieldState => {
const { touched } = fieldState // true
},
{
// ...other subscription items
touched: true
}
)
```

## Mutator

### `form.mutators.setFieldTouched(name: string, touched: boolean) => void`

Sets the specified field's `touched` flag to the boolean value provided.
Loading

0 comments on commit f155c8f

Please sign in to comment.