formsy-mui
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -65,7 +65,4 @@ 'use strict'; | ||
var value = props.value, | ||
defaultDate = props.defaultDate; | ||
var date = 'value' in props ? props.value : props.defaultDate; | ||
var date = value || defaultDate; | ||
_this.state = (0, _assign2.default)(_this.state, { | ||
@@ -72,0 +69,0 @@ _value: date, |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,11 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var FormsyRadio = function FormsyRadio() {}; | ||
exports.default = FormsyRadio; |
@@ -65,8 +65,4 @@ 'use strict'; | ||
var _this$props = _this.props, | ||
valueSelected = _this$props.valueSelected, | ||
defaultSelected = _this$props.defaultSelected; | ||
var selected = 'valueSelected' in props ? props.valueSelected : props.defaultSelected; | ||
var selected = valueSelected || defaultSelected || ''; | ||
_this.state = (0, _assign2.default)(_this.state, { | ||
@@ -73,0 +69,0 @@ _value: selected, |
@@ -69,3 +69,3 @@ 'use strict'; | ||
var value = props.value || props.defaultValue || ''; | ||
var value = 'value' in props ? props.value : props.defaultValue; | ||
@@ -72,0 +72,0 @@ _this.state = (0, _assign2.default)(_this.state, { |
@@ -65,7 +65,4 @@ 'use strict'; | ||
var value = props.value, | ||
defaultTime = props.defaultTime; | ||
var time = 'value' in props ? props.value : props.defaultTime; | ||
var time = value || defaultTime; | ||
_this.state = (0, _assign2.default)(_this.state, { | ||
@@ -72,0 +69,0 @@ _value: time, |
{ | ||
"name": "formsy-mui", | ||
"author": "Andrew MacCuaig <andrewmaccuaig@gmail.com>", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A Formsy wrapper for Material-UI components", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
@@ -1,2 +0,66 @@ | ||
# formsy-mui | ||
A Formsy wrapper for Material-UI components | ||
# Formsy MUI | ||
[![npm](https://img.shields.io/npm/v/formsy-mui.svg)](https://www.npmjs.com/package/formsy-mui) | ||
[![npm](https://img.shields.io/npm/dw/formsy-mui.svg)](https://www.npmjs.com/package/formsy-mui) | ||
[![license](https://img.shields.io/github/license/st-andrew/formsy-mui.svg)](https://github.com/st-andrew/formsy-mui) | ||
--- | ||
A [Formsy](https://github.com/st-andrew/formsy-react-2) wrapper for [Material-UI](https://github.com/callemall/material-ui) components | ||
### Installation | ||
To get started with Formsy MUI, you can simply install it with npm: | ||
```bash | ||
npm i --save formsy-mui | ||
``` | ||
or with yarn | ||
```bash | ||
yarn add formsy-mui | ||
``` | ||
Formsy MUI is currently compatible with React 15.5x. For React 15.4.x and below it is recommended that you install [formsy-material-ui](https://github.com/mbrookes/formsy-material-ui) and [formsy-react](https://github.com/christianalfoni/formsy-react) instead. | ||
### Basic Usage | ||
```jsx | ||
import React from 'react'; | ||
import Formsy from 'formsy-react-2'; | ||
import FormsyText from 'formsy-mui/FormsyText'; | ||
class MyForm extends React.Component { | ||
state = { | ||
formIsValid: false | ||
} | ||
enableSubmit() { | ||
this.setState({formIsValid: true}); | ||
} | ||
disableSubmit() { | ||
this.setState({formIsValid: false}); | ||
} | ||
submit(model) { | ||
console.log(model); | ||
// model = { | ||
// foo: 'foo@foo.com', | ||
// bar: 10 | ||
// } | ||
} | ||
// This code results in a form with Material UI text field and a submit button | ||
// that will run the `submit` method when the submit button is clicked with a | ||
// valid email. The submit button is disabled as long as the foo input is empty | ||
// and the value is not an email. On validation error it will show the error message. | ||
render() { | ||
<Formsy.Form onValidSubmit={this.submit} onValid={this.enableSubmit} onInvalid={this.disableSubmit}> | ||
<FormsyText name='foo' validations='isEmail' validationError='This is not a valid email' required /> | ||
<button type="submit" disabled={!this.state.formIsValid}>Submit</button> | ||
</Formsy.Form> | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40649
67
778