Skip to content

Commit

Permalink
name update; add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismllr committed Jun 12, 2020
1 parent 0d8cb5d commit 2ad84cb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Installation

* `git clone <repository-url>`
* `cd ember-validation-decorator`
* `cd ember-validation-state`
* `npm install`

## Linting
Expand Down
59 changes: 44 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
ember-validation-decorator
==============================================================================
# `ember-validation-state`

[Short description of the addon.]
Provides an Octane-ready decorator which can be used in conjunction with ember-validation validators, to provide form field validation state.

This addon takes heavy inspiration, and is based mostly upon, the work in [`ember-cp-validations`](https://github.com/offirgolan/ember-cp-validations), but with a more straightforward approach, and smaller API.

Compatibility
------------------------------------------------------------------------------

## Compatibility

* Ember.js v3.12 or above
* Ember CLI v2.13 or above
* Node.js v10 or above


Installation
------------------------------------------------------------------------------
## Installation

```
ember install ember-validation-decorator
ember install ember-validation-state
```


Usage
------------------------------------------------------------------------------
## Usage

```js
import validationState, { validate } from 'ember-validation-state';

const Validators = {
username: [validate('presence', { presence: true })],
password: [validate('length', { min: 6 })]
};

class MyForm extends Component {
@tracked username = null;
@tracked password = null;

@validationState(Validators) validationState;
}
```

[Longer description of how to use the addon in apps.]
### ValidationState type definition

```ts
interface AttributeValidation {
messages: string[];
isValid: boolean;
}

interface Attrs {
[propertyName: string]: AttributeValidation;
}

interface ValidationState {
isValid: boolean;
attrs: Attrs
}
```

## Contributing

Contributing
------------------------------------------------------------------------------

See the [Contributing](CONTRIBUTING.md) guide for details.


License
------------------------------------------------------------------------------
## License


This project is licensed under the [MIT License](LICENSE.md).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ember-validation-decorator",
"name": "ember-validation-state",
"version": "0.0.0",
"description": "The default blueprint for ember-cli addons.",
"keywords": [
Expand Down

0 comments on commit 2ad84cb

Please sign in to comment.