@gemsorg/modules
Advanced tools
Comparing version 0.1.23 to 0.1.24
{ | ||
"name": "@gemsorg/modules", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "gems modules", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "ea6506b15ff46bc73f3efecf06b43c3d492848d3" | ||
"gitHead": "93425338e881cd35b054dbd9e72c3f0939029759" | ||
} |
@@ -23,2 +23,3 @@ import React, { Component } from 'react'; | ||
value: PropTypes.string, | ||
initial: PropTypes.string, | ||
onChange: PropTypes.func.isRequired, | ||
@@ -30,2 +31,3 @@ }; | ||
value: '', | ||
initial: null, | ||
label: null, | ||
@@ -37,4 +39,7 @@ placeholder: '', | ||
state = { touched: false }; | ||
handleChange = ({ target }) => { | ||
const { name, onChange } = this.props; | ||
this.setState({ touched: true }); | ||
onChange(name, target.value); | ||
@@ -44,3 +49,7 @@ }; | ||
render() { | ||
const { inputType, placeholder, label, value } = this.props; | ||
const { inputType, placeholder, label, value, initial } = this.props; | ||
const { touched } = this.state; | ||
const val = !value && !touched && initial ? initial : value; | ||
return ( | ||
@@ -52,3 +61,3 @@ <Label className={styles.label} label={label}> | ||
onChange={this.handleChange} | ||
value={value} | ||
value={val} | ||
autoComplete="off" | ||
@@ -55,0 +64,0 @@ placeholder={placeholder} |
@@ -30,2 +30,6 @@ // @flow | ||
}, | ||
initial: { | ||
type: PropControlTypes.string, | ||
placeholder: 'Default value', | ||
}, | ||
label: { | ||
@@ -32,0 +36,0 @@ type: PropControlTypes.string, |
@@ -21,4 +21,5 @@ | ||
| *label* | string | - | - | text label | | ||
| *initial* | string | - | - | initial value | | ||
| *[validation](https://gemsorg.github.io/gems-components/?selectedKind=Form%20Builder&selectedStory=Validation)* | validtion | - | - | validation rules | | ||
## Playground |
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
277972
7422