react-autocompleter
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -42,3 +42,3 @@ 'use strict'; | ||
filteredItemList: [], | ||
inputValue: '', | ||
inputValue: this.props.value, | ||
navigate: 0 | ||
@@ -54,2 +54,3 @@ }; | ||
_this.onChange(value); | ||
if (_this.props.onSelect) { | ||
@@ -76,3 +77,13 @@ _this.props.onSelect(value); | ||
this.onChange = function (value) { | ||
if (_this.props.onChange) { | ||
_this.props.onChange(value); | ||
} | ||
}; | ||
this.handleInputChange = function (e) { | ||
if (_this.props.onChange) { | ||
_this.props.onChange(e.target.value); | ||
} | ||
var updatedList = []; | ||
@@ -162,3 +173,3 @@ | ||
_react2['default'].createElement(_Input2['default'], { value: inputValue, placeholder: placeholder, className: classes.input, styles: styles.input, props: inputProps, onChange: this.handleInputChange, onBlur: this.onBlur, onFocus: this.onFocus }), | ||
_react2['default'].createElement(_ListContainer2['default'], { data: filteredItemList, onSelect: this.onSelect, className: classes.listContainer, itemClassName: classes.listItems, styles: styles.listContainer, itemStyles: styles.listItems, navigate: navigate - 1 }) | ||
_react2['default'].createElement(_ListContainer2['default'], { data: filteredItemList, onSelect: this.onSelect, className: classes.listContainer, itemClassName: classes.listItems, styles: styles.listContainer, itemStyles: styles.listItems, navigate: navigate - 1, onChange: this.onChange }) | ||
); | ||
@@ -176,2 +187,3 @@ } | ||
onFocus: _react.PropTypes.func, | ||
onChange: _react.PropTypes.func, | ||
data: _react.PropTypes.array.isRequired, | ||
@@ -183,3 +195,4 @@ placeholder: _react.PropTypes.string, | ||
inputProps: _react.PropTypes.object, | ||
keyboard: _react.PropTypes.bool | ||
keyboard: _react.PropTypes.bool, | ||
value: _react.PropTypes.string | ||
}, | ||
@@ -200,3 +213,4 @@ enumerable: true | ||
inputProps: {}, | ||
keyboard: true | ||
keyboard: true, | ||
value: '' | ||
}, | ||
@@ -203,0 +217,0 @@ enumerable: true |
@@ -37,3 +37,4 @@ 'use strict'; | ||
itemStyles: _react.PropTypes.object, | ||
navigate: _react.PropTypes.number.isRequired | ||
navigate: _react.PropTypes.number.isRequired, | ||
onChange: _react.PropTypes.func | ||
}, | ||
@@ -76,2 +77,3 @@ enumerable: true | ||
var navigate = _props.navigate; | ||
var onChange = _props.onChange; | ||
var activeStyle = this.state.activeStyle; | ||
@@ -88,2 +90,3 @@ | ||
if (navigate === index) { | ||
onChange(item); | ||
return _react2['default'].createElement(_ListItem2['default'], { onSelect: onSelect, content: item, key: item, className: itemClassName, styles: activeStyle, active: navigate === index }); | ||
@@ -90,0 +93,0 @@ } |
{ | ||
"name": "react-autocompleter", | ||
"author": "Invertase", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A simple, configurable, styleable ReactJS component which completes your phrase with keyboard navigation support.", | ||
@@ -6,0 +6,0 @@ "main": "./dist/AutoCompleter.js", |
@@ -110,2 +110,10 @@ # React AutoCompleter | ||
#### value (string) | ||
The initial/default value on the input. | ||
``` | ||
value='keyword' | ||
``` | ||
#### keyboard (bool|default:true) | ||
@@ -143,2 +151,10 @@ | ||
#### onChange (function) | ||
Triggered on input change, including the navigated and selected value. | ||
``` | ||
onChange={ (value) => { console.log('input changed to', value) } } | ||
``` | ||
#### inputProps (object) | ||
@@ -145,0 +161,0 @@ |
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
25076
389
181