Skip to content

Commit

Permalink
Merge pull request #18 from environment-agency-austria/feature/prepar…
Browse files Browse the repository at this point in the history
…e-2.0.0-release

Feature/prepare 2.0.0 release
  • Loading branch information
maschino authored Nov 19, 2018
2 parents ce9619e + 242ee46 commit 6392d9d
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 108 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

## Unreleased
## [2.0.0] # 2018-11-19
### Breaking changes
**Changed default usage of form fields**
In order to provide the best typescript experience we had to ditch the conect of `<Field component={Input}>`. From version 2.0.0 onwards the field component is used directly, e.g.: `<Input name="demo" label="Demo Input" />`. The field component will still accept the field props. Developers who want to make their own field components now need to wrap those with the new `withField` higher order component. A full migration guide will be available soon.

### Other
- Removed deprecated Form.onFieldValueChanged callback
- Removed deprecated `Form.onFieldValueChanged` callback
- Fixed a bug where a form field would revert its value to '' if its current value evaulated to value == false.
- Added `isRequired` to field meta. It is true if the field / input component contains a required validator.

Expand Down
25 changes: 25 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,28 @@ Then use the form where needed.

## Documentation and Showcase
[API Documentation and Showcase](https://environment-agency-austria.github.io/forms-showcase/#/)

## Upgrading from react-ocean-forms 1.x.x to 2.0.0
From version 2.0.0 onwards the syntax for `Field` has changed. Previously a field would be written like this:

**Before**:
```jsx
<Field
name="demo"
label="My demo field"
component={Input}
/>
```

**After**:
```jsx
<Input
name="demo"
label="My demo field"
/>
```

The input component is now used directly without using it in the component prop of the field.

### Changes for writing custom field components
Custom field components must use the new `withField` higher order component. See [Input.tsx](./src/components/Input/Input.tsx) for an implementation example.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-ocean-forms",
"version": "2.0.0-rc3",
"version": "2.0.0",
"description": "Forms components for react based on the context api.",
"main": "build/index.js",
"typings": "build/index.d.ts",
Expand All @@ -11,7 +11,7 @@
"test:coverage": "jest --coverage",
"start": "webpack --watch --mode development",
"build": "webpack -p",
"lint": "tslint --project ."
"lint": "tslint -t stylish --project ."
},
"jest": {
"setupFiles": [
Expand Down Expand Up @@ -51,24 +51,24 @@
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/plugin-transform-react-jsx": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@types/enzyme": "^3.1.15",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/jest": "^23.3.9",
"@types/react": "^16.4.18",
"@types/react": "^16.7.6",
"babel-loader": "^8.0.4",
"babel-runtime": "^6.26.0",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
"clean-webpack-plugin": "^1.0.0",
"coveralls": "^3.0.2",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.6.0",
"enzyme-adapter-react-16": "^1.7.0",
"jest": "^23.6.0",
"react": "^16.6.0",
"react-dom": "^16.6.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"ts-jest": "^23.10.4",
"ts-loader": "^5.3.0",
"tslint": "^5.11.0",
Expand All @@ -77,7 +77,7 @@
"tslint-microsoft-contrib": "^5.2.1",
"tslint-react": "^3.6.0",
"typescript": "^3.1.6",
"webpack": "^4.25.1",
"webpack": "^4.26.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ ShallowWrapper {
"_currentRenderer2": null,
"_currentValue": undefined,
"_currentValue2": undefined,
"_threadCount": 0,
},
},
},
Expand Down Expand Up @@ -218,6 +219,7 @@ ShallowWrapper {
"_currentRenderer2": null,
"_currentValue": undefined,
"_currentValue2": undefined,
"_threadCount": 0,
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/Form/__snapshots__/Form.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ShallowWrapper {
"_currentRenderer2": null,
"_currentValue": undefined,
"_currentValue2": undefined,
"_threadCount": 0,
},
},
},
Expand Down Expand Up @@ -195,6 +196,7 @@ ShallowWrapper {
"_currentRenderer2": null,
"_currentValue": undefined,
"_currentValue2": undefined,
"_threadCount": 0,
},
},
},
Expand Down
Loading

0 comments on commit 6392d9d

Please sign in to comment.